]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenFLUKAsource.cxx
Fully commented version by Bruno Espagnon.
[u/mrichter/AliRoot.git] / EVGEN / AliGenFLUKAsource.cxx
index 9aff879791b74e338b432d88cf269ae6f49e61c5..d4e05f075881d35b953fb55cb63a819481e89dde 100644 (file)
 
 /*
 $Log$
+Revision 1.14  2001/03/21 11:28:20  morsch
+Use enum constants for particle selection.
+
+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 +83,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 +111,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 +197,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 +220,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 +253,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,  
@@ -270,7 +279,7 @@ void AliGenFLUKAsource::Generate()
        if (part==1 && iwgt>100) iwgt=100;
        Int_t nstack=0;
        for (j=0; j<iwgt; j++) {
-           gAlice->SetTrack(fTrackIt,-1,part,p,origin,polar,fAge,kPPrimary,nt);
+           SetTrack(fTrackIt,-1,part,p,origin,polar,fAge,kPPrimary,nt);
            Rndm(random,2);
            phi=2*random[1]*TMath::Pi();
            Float_t pn1=p[0]*TMath::Sin(phi) - p[1]*TMath::Cos(phi);