]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenFLUKAsource.cxx
Use enum constants for particle selection.
[u/mrichter/AliRoot.git] / EVGEN / AliGenFLUKAsource.cxx
index f02e4aedb1ab48d02cf9d80c445f3bc2b62c5d80..290576723da5f76857b8a9f599f8a2828f9b12f1 100644 (file)
 
 /*
 $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
+
+Revision 1.11  2000/06/14 15:20:40  morsch
+Include clean-up (IH)
+
+Revision 1.10  2000/06/09 20:31:34  morsch
+All coding rule violations except RS3 corrected
+
 Revision 1.9  2000/03/07 13:52:54  morsch
 static Int_t irwn=0;
 
@@ -30,12 +42,20 @@ Introduction of the Copyright and cvs Log
 
 */
 
+
+
+// Read background particles from a FLUKA boundary source file
+// This is a very special generator that works for background studies for the muon-spectrometer.
+// The input files come from FLUKA simulations.
+// Files can be chained. 
+// Author: andreas.morsch@cern.ch
+
 #include "AliGenFLUKAsource.h"
-#include "AliGenMUONlib.h"
 #include "AliMC.h"
 #include "AliRun.h"
 #include "AliPDG.h"
-#include <TDirectory.h>
+
+
 #include <TFile.h>
 #include <TTree.h>
 #include <TChain.h>
@@ -60,23 +80,21 @@ 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)
     :AliGenerator(npart)
 {
     // Constructor
-    fName="FLUKA";
-    fTitle="FLUKA Boundary Source";
+    fName  = "FLUKA";
+    fTitle = "FLUKA Boundary Source";
     // Read in all particle types by default
     fIkine=6;
     // Set maximum admitted age of particles to 1.e-05 by default 
@@ -90,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"); 
@@ -176,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();
@@ -198,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;
            }
@@ -227,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,  
@@ -248,13 +271,13 @@ void AliGenFLUKAsource::Generate()
        wgt = (part == 13) ? fWgt*fAddWeight : fWgt;
        iwgt=Int_t(wgt);
        fwgt=wgt-Float_t(iwgt);
-       gMC->Rndm(random,2);
+       Rndm(random,2);
        if (random[0] < fwgt) iwgt++;
        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,"Primary",nt);
-           gMC->Rndm(random,2);
+           gAlice->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);
            Float_t pn2=p[0]*TMath::Cos(phi) + p[1]*TMath::Sin(phi);