]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALJetFinderInputSimPrep.cxx
Enlarging array
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALJetFinderInputSimPrep.cxx
index b4f3ec99102a185c0f872144488b5df35f42bec2..09959bdaca8d739af806ecafac93a9d18d30e43d 100755 (executable)
  **************************************************************************/
 
 
-/*
-$Log$
-Revision 1.1.1.1  2003/05/29 18:56:43  horner
-Initial import - Mark
-
-*/
+/* $Id$ */
 
 //_________________________________________________________________________
 //  Class for JetFinder Input preparation from simulated data 
@@ -53,12 +46,14 @@ Initial import - Mark
 #include "AliGenPythiaEventHeader.h"
 #include "AliGenerator.h"
 #include "AliHeader.h"
+#include "AliMC.h"
 
 
 ClassImp(AliEMCALJetFinderInputSimPrep)
        
 AliEMCALJetFinderInputSimPrep::AliEMCALJetFinderInputSimPrep()
 {
+       // Default constructor
 if (fDebug > 0) Info("AliEMCALJetFinderInputSimPrep","Beginning Constructor"); 
   
   fDebug = 0;
@@ -76,6 +71,7 @@ if (fDebug > 0) Info("~AliEMCALJetFinderInputSimPrep","Beginning Destructor");
 
 void AliEMCALJetFinderInputSimPrep::Reset(AliEMCALJetFinderResetType_t resettype)
 {
+       // Method to reset data
 if (fDebug > 1) Info("Reset","Beginning Reset");
        switch (resettype){
 
@@ -148,8 +144,9 @@ if (fDebug > 1) Info("FillFromFile","Beginning FillFromFile");
    return 0;   
 }
 
-void AliEMCALJetFinderInputSimPrep::FillHits()         // Fill from the hits to input object from simulation
+void AliEMCALJetFinderInputSimPrep::FillHits()         
 {
+       // Fill from the hits to input object from simulation
 if (fDebug > 1) Info("FillHits","Beginning FillHits");
        
 // Access hit information
@@ -157,9 +154,6 @@ if (fDebug > 1) Info("FillHits","Beginning FillHits");
     AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
     Info("AliEMCALJetFinderInputSimPrep","Title of the geometry is %s",pEMCAL->GetTitle());
     AliEMCALGeometry* geom =  AliEMCALGetter::Instance()->EMCALGeometry();
-//    Float_t samplingF = geom->GetSampling();
-    Float_t samplingF = 11.6;
-    Info("AliEMCALJetFinderInputSimPrep","Sampling fraction is %f",samplingF);  
     TTree *treeH = AliEMCALGetter::Instance()->TreeH();
     Int_t ntracks = (Int_t) treeH->GetEntries();
 //
@@ -189,7 +183,7 @@ if (fDebug > 1) Info("FillHits","Beginning FillHits");
             Float_t theta  =    TMath::ATan2(r,z);
             Float_t eta    =   -TMath::Log(TMath::Tan(theta/2.));
             Float_t phi    =    TMath::ATan2(y,x);
-            etH = samplingF*eloss*TMath::Sin(theta);
+            etH = eloss*TMath::Sin(theta);
            if (fDebug > 10) Info("FillHits","Values of hit energy %i",Int_t(1e7*etH));
            if (geom->TowerIndexFromEtaPhi(eta,180.0/TMath::Pi()*phi) == -1) 
            {
@@ -206,13 +200,14 @@ if (fDebug > 1) Info("FillHits","Beginning FillHits");
 
 
 }
-void AliEMCALJetFinderInputSimPrep::FillTracks()       // Fill from particles simulating a TPC to input object from simulation
+void AliEMCALJetFinderInputSimPrep::FillTracks()       
 {
+       // Fill from particles simulating a TPC to input object from simulation
 
     if (fDebug > 1) Info("FillTracks","Beginning FillTracks");
        
     TParticlePDG* pdgP = 0;
-    TParticle *MPart;
+    TParticle *mPart;
     Int_t npart = (gAlice->GetHeader())->GetNprimary();
     Float_t bfield,rEMCAL;              
     
@@ -228,23 +223,23 @@ void AliEMCALJetFinderInputSimPrep::FillTracks()  // Fill from particles simulati
     if (fDebug > 1) Info("FillTracks","Starting particle loop");
            
     for (Int_t part = 0; part < npart; part++) {
-       MPart = gAlice->Particle(part);
+       mPart = gAlice->GetMCApp()->Particle(part);
        //if (part%10) gObjectTable->Print();
-       pdgP = MPart->GetPDG();
+       pdgP = mPart->GetPDG();
 
        if (fDebug > 5) Info("FillTracks","Checking if track is a primary");
        
        if (fFileType == kPythia) {
-           if (MPart->GetStatusCode() != 1) continue;
+           if (mPart->GetStatusCode() != 1) continue;
        } else if (fFileType == kHijing) {
-           if (MPart->GetFirstDaughter() >= 0 && MPart->GetFirstDaughter() < npart) continue;
+           if (mPart->GetFirstDaughter() >= 0 && mPart->GetFirstDaughter() < npart) continue;
        }
        
-       if (fDebug > 15) Info("FillTracks","Checking if track (eta - %f, phi - %f) is in acceptance",MPart->Eta(),MPart->Phi());
+       if (fDebug > 15) Info("FillTracks","Checking if track (eta - %f, phi - %f) is in acceptance",mPart->Eta(),mPart->Phi());
        if (fDebug > 10) Info("FillTracks","Checking if EMCAL acceptance  ( %f < eta < %f, %f < phi < %f) is in acceptance",fEtaMin,fEtaMax,fPhiMin,fPhiMax);
 
-       if (MPart->Eta() > fEtaMax || MPart->Eta() < fEtaMin)    continue;
-       if (MPart->Phi() > fPhiMax || MPart->Phi() < fPhiMin )   continue;
+       if (mPart->Eta() > fEtaMax || mPart->Eta() < fEtaMin)    continue;
+       if (mPart->Phi() > fPhiMax || mPart->Phi() < fPhiMin )   continue;
        
 /*
        {kProton, kProtonBar, kElectron, kPositron,
@@ -267,7 +262,7 @@ void AliEMCALJetFinderInputSimPrep::FillTracks()    // Fill from particles simulati
 
        bfield = gAlice->Field()->SolenoidField();
        rEMCAL = AliEMCALGeometry::GetInstance()->GetIPDistance();
-       Float_t rB = 3335.6 * MPart->Pt() / bfield;  // [cm]  (case of |charge|=1)
+       Float_t rB = 3335.6 * mPart->Pt() / bfield;  // [cm]  (case of |charge|=1)
        if (2.*rB < rEMCAL) continue;  // track curls away
        
        //if (part%10) gObjectTable->Print();
@@ -278,30 +273,32 @@ void AliEMCALJetFinderInputSimPrep::FillTracks()  // Fill from particles simulati
                if (fDebug > 5) Info("FillTracks","Storing track");
                if (fSmearType == kSmear ||
                    fSmearType == kSmearEffic ){
-                       Smear(MPart);/*
+                       Smear(mPart);/*
                        TParticle *tmp = Smear(MPart);
                        fInputObject.AddTrack(Smear(MPart));
                        delete tmp;*/
                }else{
-                       fInputObject.AddTrack(*MPart);
+                       fInputObject.AddTrack(*mPart);
                }
           break;
           case kEM:   // All Electromagnetic particles
-               if (MPart->GetPdgCode() == kElectron ||
-                   MPart->GetPdgCode() == kPositron ){
+               if (mPart->GetPdgCode() == kElectron  ||
+                    mPart->GetPdgCode() == kMuonPlus  || 
+                    mPart->GetPdgCode() == kMuonMinus ||
+                   mPart->GetPdgCode() == kPositron ){
                      if (fDebug > 5) Info("FillTracks","Storing electron or positron");
                      if (fSmearType == kSmear ||
                            fSmearType == kSmearEffic ){
-                             Smear(MPart);/*
+                             Smear(mPart);/*
                              TParticle *tmp = Smear(MPart); 
                              fInputObject.AddTrack(tmp);
                              delete tmp;*/
                      }else{
-                         fInputObject.AddTrack(*MPart);
+                         fInputObject.AddTrack(*mPart);
                      }
                }
-               if ( MPart->GetPdgCode() == kGamma ){ 
-                       fInputObject.AddTrack(*MPart);
+               if ( mPart->GetPdgCode() == kGamma ){ 
+                       fInputObject.AddTrack(*mPart);
                        if (fDebug > 5) Info("FillTracks","Storing gamma");
                }
                        
@@ -311,56 +308,60 @@ void AliEMCALJetFinderInputSimPrep::FillTracks()  // Fill from particles simulati
                        if (fDebug > 5) Info("FillTracks","Storing charged track");
                        if (fSmearType == kSmear ||
                            fSmearType == kSmearEffic ){
-                               Smear(MPart);/*
+                               Smear(mPart);/*
                                TParticle *tmp = Smear(MPart);
                                fInputObject.AddTrack(tmp);
                                delete tmp;*/
                        }else{
-                        fInputObject.AddTrack(*MPart);
+                        fInputObject.AddTrack(*mPart);
                        }
                }
           break;
           case kNeutral: // All particles with no charge
                if (pdgP->Charge() == 0){ 
-                       fInputObject.AddTrack(*MPart);
+                       fInputObject.AddTrack(*mPart);
                        if (fDebug > 5) Info("FillTracks","Storing neutral");
                }
           break;
           case kHadron: //All hadrons
-               if (MPart->GetPdgCode() != kElectron &&
-                    MPart->GetPdgCode() != kPositron &&
-                    MPart->GetPdgCode() != kGamma ) 
+               if (mPart->GetPdgCode() != kElectron  &&
+                    mPart->GetPdgCode() != kPositron  &&
+                    mPart->GetPdgCode() != kMuonPlus  &&
+                    mPart->GetPdgCode() != kMuonMinus &&
+                    mPart->GetPdgCode() != kGamma ) 
                {
                        if (fDebug > 5) Info("FillTracks","Storing hadron");
                        if (pdgP->Charge() == 0){
-                           fInputObject.AddTrack(*MPart);
+                           fInputObject.AddTrack(*mPart);
                        }else{
                                if (fSmearType == kSmear ||
                                    fSmearType == kSmearEffic ){
-                                       Smear(MPart);/*
+                                       Smear(mPart);/*
                                        TParticle *tmp = Smear(MPart);  
                                        fInputObject.AddTrack(tmp);
                                        delete tmp;*/
                                }else{
-                                   fInputObject.AddTrack(*MPart);
+                                   fInputObject.AddTrack(*mPart);
                                }
                        }
                }
           break;
           case kChargedHadron:  // only charged hadrons
-               if (MPart->GetPdgCode() != kElectron &&
-                    MPart->GetPdgCode() != kPositron &&
-                    MPart->GetPdgCode() != kGamma    &&
+               if (mPart->GetPdgCode() != kElectron  &&
+                    mPart->GetPdgCode() != kPositron  &&
+                    mPart->GetPdgCode() != kGamma     &&
+                    mPart->GetPdgCode() != kMuonPlus  &&
+                    mPart->GetPdgCode() != kMuonMinus &&
                    pdgP->Charge()      != 0       ){
                        if (fDebug > 5) Info("FillTracks","Storing charged hadron");
                        if (fSmearType == kSmear ||
                            fSmearType == kSmearEffic ){
-                               Smear(MPart);/*
+                               Smear(mPart);/*
                                TParticle *tmp = Smear(MPart);
                                fInputObject.AddTrack(tmp);
                                delete tmp;*/
                        }else{
-                              fInputObject.AddTrack(*MPart);
+                              fInputObject.AddTrack(*mPart);
                        }
                }
           break;
@@ -368,7 +369,7 @@ void AliEMCALJetFinderInputSimPrep::FillTracks()    // Fill from particles simulati
           break;
           default:
           break;
-          delete MPart;
+          delete mPart;
         }      //end of switch
 //     Info("FillTracks","After Particle Storage");
        //if (part%10) gObjectTable->Print();
@@ -377,8 +378,10 @@ void AliEMCALJetFinderInputSimPrep::FillTracks()   // Fill from particles simulati
    //gObjectTable->Print();    
 }
 
-void AliEMCALJetFinderInputSimPrep::FillPartons()              // Fill partons to input object from simulation
+void AliEMCALJetFinderInputSimPrep::FillPartons()      
 {
+       // Fill partons to
+       // input object from simulation
 if (fDebug > 1) Info("FillPartons","Beginning FillPartons");
 
   AliGenEventHeader* evHeader = ((AliHeader*)(gAlice->GetHeader()))->GenEventHeader();
@@ -403,29 +406,30 @@ if (fDebug > 1) Info("FillPartons","Beginning FillPartons");
   }
 }
 
-void AliEMCALJetFinderInputSimPrep::FillParticles()            // Fill particles to input object from simulation
+void AliEMCALJetFinderInputSimPrep::FillParticles()            
 {
+       // Fill particles to input object from simulation
 if (fDebug > 1) Info("FillParticles","Beginning FillParticles");
 
     Int_t npart = (gAlice->GetHeader())->GetNprimary();
     TParticlePDG* pdgP = 0;
  
     for (Int_t part = 0; part < npart; part++) {
-       TParticle *MPart = gAlice->Particle(part);
-       pdgP = MPart->GetPDG();
+       TParticle *mPart = gAlice->GetMCApp()->Particle(part);
+       pdgP = mPart->GetPDG();
        
        if (fDebug > 10) Info("FillParticles","Checking if particle is a primary");
        
        if (fFileType == kPythia) {
-           if (MPart->GetStatusCode() != 1) continue;
+           if (mPart->GetStatusCode() != 1) continue;
        } else if (fFileType == kHijing) {
-           if (MPart->GetFirstDaughter() >= 0 && MPart->GetFirstDaughter() < npart) continue;
+           if (mPart->GetFirstDaughter() >= 0 && mPart->GetFirstDaughter() < npart) continue;
        }
 
        if (fDebug > 10) Info("FillParticles","Checking if particle is in acceptance");
        
-       if (MPart->Eta() > fEtaMax || MPart->Eta() < fEtaMin)    continue;
-       if (MPart->Phi() > fPhiMax || MPart->Phi() < fPhiMin )   continue;
+       if (mPart->Eta() > fEtaMax || mPart->Eta() < fEtaMin)    continue;
+       if (mPart->Phi() > fPhiMax || mPart->Phi() < fPhiMin )   continue;
        
 
 /*
@@ -441,45 +445,45 @@ if (fDebug > 1) Info("FillParticles","Beginning FillParticles");
 
           case kAll:  // All Stable particles to be included
                if (fDebug > 5) Info("FillParticles","Storing particle");
-               fInputObject.AddParticle(MPart);
+               fInputObject.AddParticle(mPart);
           break;
           case kEM:   // All Electromagnetic particles
-               if (MPart->GetPdgCode() == kElectron ||
-                   MPart->GetPdgCode() == kPositron ||
-                   MPart->GetPdgCode() == kGamma){
+               if (mPart->GetPdgCode() == kElectron ||
+                   mPart->GetPdgCode() == kPositron ||
+                   mPart->GetPdgCode() == kGamma){
                        if (fDebug > 5) Info("FillParticles","Storing electromagnetic particle");
-                       fInputObject.AddParticle(MPart);
+                       fInputObject.AddParticle(mPart);
                }
           break;
            case kCharged: // All Particles with non-zero charge
                if (pdgP->Charge() != 0) {
                        if (fDebug > 5) Info("FillParticles","Storing charged particle");
-                       fInputObject.AddParticle(MPart);
+                       fInputObject.AddParticle(mPart);
                }
           break;
           case kNeutral: // All particles with no charge
                if (pdgP->Charge() == 0){
                        if (fDebug > 5) Info("FillParticles","Storing neutral particle");
-                       fInputObject.AddParticle(MPart);
+                       fInputObject.AddParticle(mPart);
                }
           break;
           case kHadron: //All hadrons
-               if (MPart->GetPdgCode() != kElectron &&
-                    MPart->GetPdgCode() != kPositron &&
-                    MPart->GetPdgCode() != kGamma ) 
+               if (mPart->GetPdgCode() != kElectron &&
+                    mPart->GetPdgCode() != kPositron &&
+                    mPart->GetPdgCode() != kGamma ) 
                {
 
                if (fDebug > 5) Info("FillParticles","Storing hadron");
-                   fInputObject.AddParticle(MPart);
+                   fInputObject.AddParticle(mPart);
                }
           break;
           case kChargedHadron:  // only charged hadrons
-               if (MPart->GetPdgCode() != kElectron &&
-                    MPart->GetPdgCode() != kPositron &&
-                    MPart->GetPdgCode() != kGamma    &&
+               if (mPart->GetPdgCode() != kElectron &&
+                    mPart->GetPdgCode() != kPositron &&
+                    mPart->GetPdgCode() != kGamma    &&
                    pdgP->Charge()      != 0       ){
                if (fDebug > 5) Info("FillParticles","Storing charged hadron");
-                      fInputObject.AddParticle(MPart);
+                      fInputObject.AddParticle(mPart);
                }
           break;
           case kNoTracks:
@@ -490,13 +494,15 @@ if (fDebug > 1) Info("FillParticles","Beginning FillParticles");
     }// end of loop over particles
 
 }
-void AliEMCALJetFinderInputSimPrep::FillDigits()               // Fill digits to input object  
+void AliEMCALJetFinderInputSimPrep::FillDigits()  
 {
+       // Fill digits to input object
 
 }
 
 void AliEMCALJetFinderInputSimPrep::Smear(TParticle *particle)
 {
+       // Smear particle momentum
 if (fDebug > 5) Info("Smear","Beginning Smear");
 
        Float_t tmp = AliEMCALFast::SmearMomentum(1,particle->P());
@@ -516,7 +522,7 @@ if (fDebug > 5) Info("Smear","Beginning Smear");
 
 void AliEMCALJetFinderInputSimPrep::FillPartonTracks(AliEMCALParton *parton)
 {
-
+       // Populate parton tracks for input distributions
        if (fDebug>1) Info("FillPartonTracks","Beginning FillPartonTracks");    
        Int_t npart = (gAlice->GetHeader())->GetNprimary();
        Int_t ntracks =0;
@@ -524,7 +530,7 @@ void AliEMCALJetFinderInputSimPrep::FillPartonTracks(AliEMCALParton *parton)
        TParticle *tempPart;
        for (Int_t part = 0; part < npart; part++)
        {
-               tempPart = gAlice->Particle(part);
+               tempPart = gAlice->GetMCApp()->Particle(part);
                if (tempPart->GetStatusCode() != 1) continue;
                if (tempPart->Eta() > fEtaMax || tempPart->Eta() < fEtaMin || 
                    tempPart->Phi() > fPhiMax || tempPart->Phi() < fPhiMin ){
@@ -539,14 +545,14 @@ void AliEMCALJetFinderInputSimPrep::FillPartonTracks(AliEMCALParton *parton)
                if ( (parton->Eta() - tempPart->Eta())*(parton->Eta() - tempPart->Eta()) +
                (parton->Phi() - tempPart->Phi())*(parton->Phi() - tempPart->Phi()) < 1.0 ) ntracks++;
        }
-       Float_t *Energy = new Float_t[ntracks];
-       Float_t *Eta    = new Float_t[ntracks];
-       Float_t *Phi    = new Float_t[ntracks];
-       Int_t   *Pdg    = new Int_t[ntracks];
+       Float_t *energy = new Float_t[ntracks];
+       Float_t *eta    = new Float_t[ntracks];
+       Float_t *phi    = new Float_t[ntracks];
+       Int_t   *pdg    = new Int_t[ntracks];
        ntracks=0;
        for (Int_t part = 0; part < npart; part++)
        {
-               tempPart = gAlice->Particle(part);
+               tempPart = gAlice->GetMCApp()->Particle(part);
                if (tempPart->GetStatusCode() != 1) continue;
                if (tempPart->Eta() > fEtaMax || tempPart->Eta() < fEtaMin ||
                    tempPart->Phi() > fPhiMax || tempPart->Phi() < fPhiMin ){ 
@@ -562,13 +568,13 @@ void AliEMCALJetFinderInputSimPrep::FillPartonTracks(AliEMCALParton *parton)
                if (   (parton->Eta() - tempPart->Eta())*(parton->Eta() - tempPart->Eta()) +
                (parton->Phi() - tempPart->Phi())*(parton->Phi() - tempPart->Phi()) < 1.0 )
                {
-                       Energy[ntracks] = tempPart->Pt();
-                       Eta[ntracks] = tempPart->Eta();
-                       Phi[ntracks] = tempPart->Phi();
-                       Pdg[ntracks] = tempPart->GetPdgCode();
+                       energy[ntracks] = tempPart->Pt();
+                       eta[ntracks] = tempPart->Eta();
+                       phi[ntracks] = tempPart->Phi();
+                       pdg[ntracks] = tempPart->GetPdgCode();
                        ntracks++;
                }
        }
-       parton->SetTrackList(ntracks,Energy,Eta,Phi,Pdg);
+       parton->SetTrackList(ntracks,energy,eta,phi,pdg);
 }