]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Use enum constants for particle selection.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 21 Mar 2001 11:28:20 +0000 (11:28 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 21 Mar 2001 11:28:20 +0000 (11:28 +0000)
EVGEN/AliGenFLUKAsource.cxx
EVGEN/AliGenFLUKAsource.h

index 9aff879791b74e338b432d88cf269ae6f49e61c5..290576723da5f76857b8a9f599f8a2828f9b12f1 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.13  2000/12/21 16:24:06  morsch
+Coding convention clean-up
+
 Revision 1.12  2000/11/30 07:12:50  alibrary
 Introducing new Rndm and QA classes
 
@@ -77,15 +80,13 @@ Introduction of the Copyright and cvs Log
     // whole volume of the MUON Arm 
     fZshift=0;
     // Set the default file 
-    fFileName="flukasource.root";
+    fFileName="";
 
     fTreeFluka=0;
     fTreeChain = new TChain("h1");
 //
 //  Read all particles
     fNpart=-1;
-
-    
 }
 
 AliGenFLUKAsource::AliGenFLUKAsource(Int_t npart)
@@ -107,7 +108,7 @@ AliGenFLUKAsource::AliGenFLUKAsource(Int_t npart)
     // whole volume of the MUON Arm 
     fZshift=0;
     // Set the default file 
-    fFileName="flukasource.root";
+    fFileName="";
 
     fTreeFluka=0;
     fTreeChain = new TChain("h1"); 
@@ -193,7 +194,8 @@ void AliGenFLUKAsource::Generate()
     TChain *h2=fTreeChain;
     Int_t nentries = (Int_t) h2->GetEntries();
     if (fNpart == -1) fNpart=Int_t(nentries*fFrac);
-  
+    
+
   // loop over number of particles
     Int_t nb=0;
     Int_t ev=gMC->CurrentEvent();
@@ -215,27 +217,31 @@ void AliGenFLUKAsource::Generate()
            printf("Generate - I'm out \n");
            return;
        }   
+       
+       Int_t ifip = Int_t(fIp);
+       
 
        if (fSourceId != -1 && fIgas !=fSourceId) {
            irwn++;
            continue;
        }
        
-       if (fIp > 28 || fIp < 0) {
+       if (ifip > 28 || ifip < 0) {
            irwn++;
            continue;
        }
        
-       if ((fIp != fIkine && fIkine != 6 && fIkine != 9 && fIkine != 10) || fAge > fAgeMax){
+       if ((ifip != fIkine && fIkine != kAll && fIkine != kCharged 
+            && fIkine != 10) || fAge > fAgeMax){
            irwn++;
            continue;
-       } else if (fIkine == 9) {
-           if (fIp == 7 || fIp == 8 || fAge > fAgeMax) { 
+       } else if (fIkine == kCharged) {
+           if (ifip == 7 || ifip == 8 || fAge > fAgeMax) { 
                irwn++;
                continue;
            }
-       } else if (fIkine == 10) {
-           if (fIp == 8 || fAge > fAgeMax) { 
+       } else if (fIkine == kNoNeutron) {
+           if (ifip == 8 || fAge > fAgeMax) { 
                irwn++;
                continue;
            }
@@ -244,8 +250,8 @@ void AliGenFLUKAsource::Generate()
 
        irwn++;
 //
-// PDG code from FLUKA particle type (fIp)
-       part=kIfluge[int(fIp)-1];       
+// PDG code from FLUKA particle type (ifip)
+       part=kIfluge[int(ifip)-1];      
 //
 // Calculate momentum from kinetic energy and mass of the particle
        gMC->Gfpart(part, name, itrtyp,  
index 01a600d5e01bce2d3fa65d434d29e67721efdacf..482ecf6b4e7e0d1f42192efafde9cd4a41e9ada3 100644 (file)
@@ -17,72 +17,70 @@ class AliGenFLUKAsource : public AliGenerator
 
 {
 public:
-  AliGenFLUKAsource();
-  AliGenFLUKAsource(Int_t npart);
-  AliGenFLUKAsource(const AliGenFLUKAsource &FLUKAsource);
-  virtual ~AliGenFLUKAsource();
-  // Initialise 
-  virtual void Init() {}
-  // Initialise fluka data 
-  virtual void FlukaInit();
-  // choose particle type
-  virtual void SetPartFlag(Int_t ikine) {fIkine=ikine;}
-  // set time cut 
-  virtual void SetAgeMax(Float_t agemax) {fAgeMax=agemax;}
-  // use additional weight on neutrals
-  virtual void SetAddWeight(Float_t addwgt) {fAddWeight=addwgt;}
-  // z-shift of vertex
-  virtual void SetZshift(Float_t zshift) {fZshift=zshift;}
-  // set file name of data file
-  virtual void SetFileName(const Text_t *filname) {fFileName=filname;}
-  // set source
-  virtual void SetSourceId(Int_t id=-1){fSourceId=id;}
-  // add a new source file       
-  virtual void AddFile(const Text_t *filname) ;  
-  // read only fraction of data  
-  virtual void SetFraction(Float_t frac=1.){fFrac=frac;}
-  // generate event
-  virtual void Generate();
-  AliGenFLUKAsource & operator=(const AliGenFLUKAsource & rhs);
-protected:
-
-  Int_t fIkine;               // Flag to choose type of particles to be read in
-                              // 6 - all particles types
-                              // 7 - only gammas
-                              // 8 - only neutrons
-                              // 9 - only charged particles
-  Float_t     fAgeMax;        // Maximum age of particle
-  Float_t     fAddWeight;     // Add weight for neutrons 
-  Float_t     fZshift;        // Shift the Z of impact point by this quantity
-  Float_t     fFrac;          // Fraction of file that corresponds to one event
-  Int_t       fSourceId;      // Source identifier (-1: all sources)
+    enum constants {kAll = 6, kGammas = 7, kNeutrons = 8, kCharged = 9, kNoNeutron = 10};
+
+    AliGenFLUKAsource();
+    AliGenFLUKAsource(Int_t npart);
+    AliGenFLUKAsource(const AliGenFLUKAsource &FLUKAsource);
+    virtual ~AliGenFLUKAsource();
+    // Initialise 
+    virtual void Init() {}
+    // Initialise fluka data 
+    virtual void FlukaInit();
+    // choose particle type
+    virtual void SetPartFlag(Int_t ikine) {fIkine=ikine;}
+    // set time cut 
+    virtual void SetAgeMax(Float_t agemax) {fAgeMax=agemax;}
+    // use additional weight on neutrals
+    virtual void SetAddWeight(Float_t addwgt) {fAddWeight=addwgt;}
+    // z-shift of vertex
+    virtual void SetZshift(Float_t zshift) {fZshift=zshift;}
+    // set file name of data file
+    virtual void SetFileName(const Text_t *filname) {fFileName=filname;}
+    // set source
+    virtual void SetSourceId(Int_t id=-1){fSourceId=id;}
+    // add a new source file     
+    virtual void AddFile(const Text_t *filname) ;  
+    // read only fraction of data  
+    virtual void SetFraction(Float_t frac=1.){fFrac=frac;}
+    // generate event
+    virtual void Generate();
+    AliGenFLUKAsource & operator=(const AliGenFLUKAsource & rhs);
+ protected:
+
+    Int_t       fIkine;         // Flag to choose type of particles to be read
+    Float_t     fAgeMax;        // Maximum age of particle
+    Float_t     fAddWeight;     // Add weight for neutrons 
+    Float_t     fZshift;        // Shift the Z of impact point by this quantity
+    Float_t     fFrac;          // Fraction of file that corresponds to one event
+    Int_t       fSourceId;      // Source identifier (-1: all sources)
   
   
-  const Text_t    *fFileName;          //!Choose the file
-  TChain          *fTreeChain;         //file chaining
-  TTree           *fTreeFluka;         //pointer to the TTree
+    const Text_t    *fFileName;          //!Choose the file
+    TChain          *fTreeChain;         //file chaining
+    TTree           *fTreeFluka;         //pointer to the TTree
 //Declaration of variables read from the file -- TTree type
-  Float_t         fIp;     // Particle type
-  Float_t         fIpp;    // Primary particle type
-  Float_t         fXi;     // x-Impact 
-  Float_t         fYi;     // y-Impact
-  Float_t         fZi;     // z-Impact
-  Float_t         fPx;     // Direction cosine x
-  Float_t         fPy;     // Direction cosine y
-  Float_t         fPz;     // Direction cosine z
-  Float_t         fEkin;   // Kinetic energy
-  Float_t         fZv;     // z-Position of particle vertex
-  Float_t         fRv;     // r-Position of particle vertex
-  Float_t         fItra;   // Primary track number
-  Float_t         fIgas;   // Volume identifier
-  Float_t         fWgt;    // Particle weight
-  Float_t         fEtag;   // Pseudorapidity of primary particle
-  Float_t         fPtg;    // Pt of primary particle
-  Float_t         fAge;    // Time of flight
-
-
-
-  ClassDef(AliGenFLUKAsource,1) //Boundary source
+    Float_t         fIp;     // Particle type
+    Float_t         fIpp;    // Primary particle type
+    Float_t         fXi;     // x-Impact 
+    Float_t         fYi;     // y-Impact
+    Float_t         fZi;     // z-Impact
+    Float_t         fPx;     // Direction cosine x
+    Float_t         fPy;     // Direction cosine y
+    Float_t         fPz;     // Direction cosine z
+    Float_t         fEkin;   // Kinetic energy
+    Float_t         fZv;     // z-Position of particle vertex
+    Float_t         fRv;     // r-Position of particle vertex
+    Float_t         fItra;   // Primary track number
+    Float_t         fIgas;   // Volume identifier
+    Float_t         fWgt;    // Particle weight
+    Float_t         fEtag;   // Pseudorapidity of primary particle
+    Float_t         fPtg;    // Pt of primary particle
+    Float_t         fAge;    // Time of flight
+
+
+
+    ClassDef(AliGenFLUKAsource,1) //Boundary source
 };
 #endif