From 5d12ce3847b64498d417a697c24fb86f715f2752 Mon Sep 17 00:00:00 2001 From: hristov Date: Thu, 23 Oct 2003 16:32:20 +0000 Subject: [PATCH] MC-dependent part of AliRun extracted in AliMC (F.Carminati) --- ALIFAST/AliFTrackMaker.cxx | 5 +- CRT/AliCRT.h | 12 +- CRT/AliCRTv0.cxx | 1 + CRT/AliCRTv0.h | 12 +- CRT/AliCRTv1.cxx | 6 +- EMCAL/AliEMCALGetter.cxx | 3 +- EMCAL/AliEMCALJetFinder.cxx | 15 +- EMCAL/AliEMCALJetFinderInputSimPrep.cxx | 9 +- EMCAL/AliEMCALJetMicroDst.cxx | 3 +- EMCAL/AliEMCALv0.cxx | 1 + EMCAL/AliEMCALv1.cxx | 10 +- EVGEN/AliDimuCombinator.cxx | 3 +- EVGEN/AliGenCocktail.cxx | 3 +- EVGEN/AliGenCocktailAfterBurner.cxx | 3 +- EVGEN/AliGenFLUKAsource.cxx | 1 + EVGEN/AliGenHIJINGpara.cxx | 1 + EVGEN/AliGenParam.cxx | 4 +- FMD/AliFMD.cxx | 3 +- FMD/AliFMDv0.cxx | 1 + FMD/AliFMDv1.cxx | 3 +- HBTAN/AliHBTReaderITSv1.cxx | 5 +- ITS/AliITS.cxx | 3 +- ITS/AliITSFindClustersV2.cxx | 5 +- ITS/AliITSRiemannFit.cxx | 3 +- ITS/AliITSTrackerV1.cxx | 3 +- ITS/AliITSclustererV2.cxx | 5 +- ITS/AliITShit.cxx | 3 +- ITS/AliITStestV2.C | 4 +- ITS/AliITSv5.cxx | 3 +- ITS/AliITSv5asymm.cxx | 3 +- ITS/AliITSv5symm.cxx | 3 +- ITS/AliITSvPPRasymm.cxx | 5 +- ITS/AliITSvPPRasymmFMD.cxx | 5 +- ITS/AliITSvSPD02.cxx | 5 +- ITS/AliITSvtest.cxx | 3 +- MUON/AliMUONClusterFinderAZ.cxx | 3 +- MUON/AliMUONDisplay.cxx | 3 +- MUON/AliMUONEventReconstructor.cxx | 3 +- MUON/AliMUONRecoDisplay.cxx | 3 +- MUON/AliMUONv0.cxx | 3 +- MUON/AliMUONv1.cxx | 5 +- MUON/AliMUONv2.cxx | 1 + PHOS/AliPHOSGetter.cxx | 3 +- PHOS/AliPHOSv1.cxx | 17 +- PHOS/AliPHOSvImpacts.cxx | 5 +- PMD/AliPMD.cxx | 3 +- PMD/AliPMDDigitizer.cxx | 13 +- PMD/AliPMDv0.cxx | 3 +- PMD/AliPMDv1.cxx | 6 +- PYTHIA6/AliGenPythia.cxx | 5 +- RICH/AliRICH.cxx | 10 +- RICH/AliRICH.h | 4 +- RICH/AliRICHDisplay.cxx | 5 +- RICH/AliRICHPoints.cxx | 7 +- RICH/AliRICHResponseV0.cxx | 5 +- RICH/AliRICHv0.cxx | 3 +- RICH/AliRICHv1.cxx | 9 +- RICH/AliRICHv3.cxx | 21 +- START/AliSTART.cxx | 5 +- START/AliSTARTv1.cxx | 3 +- START/AliSTARTv2.cxx | 5 +- STEER/AliDetector.cxx | 3 +- STEER/AliDisplay.cxx | 11 +- STEER/AliGenerator.cxx | 15 +- STEER/AliHit.cxx | 9 +- STEER/AliLego.cxx | 6 +- STEER/AliLegoGenerator.cxx | 3 +- STEER/AliLegoGeneratorEta.cxx | 3 +- STEER/AliLegoGeneratorPhiZ.cxx | 3 +- STEER/AliLegoGeneratorXYZ.cxx | 3 +- STEER/AliMC.cxx | 982 ++++++++++++++++++++++++ STEER/AliMC.h | 119 +++ STEER/AliMCQA.cxx | 5 +- STEER/AliModule.cxx | 4 +- STEER/AliPoints.cxx | 7 +- STEER/AliRun.cxx | 947 +---------------------- STEER/AliRun.h | 99 +-- STEER/AliStack.cxx | 5 +- STEER/STEERLinkDef.h | 1 + STEER/libSTEER.pkg | 3 +- STRUCT/AliFRAMEv0.cxx | 1 + STRUCT/AliFRAMEv1.cxx | 1 + STRUCT/AliFRAMEv2.cxx | 4 +- STRUCT/AliSHILv2.cxx | 4 +- STRUCT/AliSHILvF.cxx | 4 +- THerwig/AliGenHerwig.cxx | 7 +- TOF/AliTOF.cxx | 5 +- TOF/AliTOFReconstructioner.cxx | 7 +- TOF/AliTOFReconstructionerV2.cxx | 3 +- TOF/AliTOFSDigitizer.cxx | 3 +- TOF/AliTOFT0.cxx | 5 +- TOF/AliTOFv0.cxx | 3 +- TOF/AliTOFv1.cxx | 3 +- TOF/AliTOFv2.cxx | 3 +- TOF/AliTOFv2FHoles.cxx | 3 +- TOF/AliTOFv3.cxx | 3 +- TOF/AliTOFv4.cxx | 3 +- TOF/AliTOFv4T0.cxx | 3 +- TPC/AliTPC.cxx | 19 +- TPC/AliTPCtrackerParam.cxx | 5 +- TPC/AliTPCv1.cxx | 7 +- TPC/AliTPCv2.cxx | 9 +- TPC/AliTPCv3.cxx | 3 +- TRD/AliTRD.cxx | 11 +- TRD/AliTRDpid.cxx | 5 +- TRD/AliTRDsimpleGen.cxx | 3 +- TRD/AliTRDsimpleMC.cxx | 3 +- TRD/AliTRDv0.cxx | 3 +- TRD/AliTRDv1.cxx | 9 +- VZERO/AliVZERO.cxx | 3 +- VZERO/AliVZEROv0.cxx | 3 +- VZERO/AliVZEROv2.cxx | 5 +- ZDC/AliGenZDC.cxx | 3 +- ZDC/AliZDC.cxx | 5 +- ZDC/AliZDCv1.cxx | 17 +- ZDC/AliZDCv2.cxx | 19 +- 116 files changed, 1500 insertions(+), 1235 deletions(-) create mode 100644 STEER/AliMC.cxx create mode 100644 STEER/AliMC.h diff --git a/ALIFAST/AliFTrackMaker.cxx b/ALIFAST/AliFTrackMaker.cxx index cf7557f3a24..67617fb5de5 100644 --- a/ALIFAST/AliFTrackMaker.cxx +++ b/ALIFAST/AliFTrackMaker.cxx @@ -60,6 +60,7 @@ #include "AliFTrackMaker.h" #include "AliFTrack.h" #include "AliFDet.h" +#include "AliMC.h" const Double_t kPi = TMath::Pi(); const Double_t k2Pi = 2*kPi; @@ -200,10 +201,10 @@ void AliFTrackMaker::Make() Int_t idPart, idTrack; Double_t charge, pT, eta, phi; TParticle *part; - Int_t nparticles = gAlice->GetNtrack(); + Int_t nparticles = gAlice->GetMCApp()->GetNtrack(); printf("%10s%10d\n","nparticles",nparticles); for(Int_t ind=0;indParticle(ind); + part = gAlice->GetMCApp()->Particle(ind); idPart = part->GetPdgCode(); charge = part->GetPDG()->Charge(); pT = part->Pt(); diff --git a/CRT/AliCRT.h b/CRT/AliCRT.h index 3fcc578bc57..7f32bac3d91 100644 --- a/CRT/AliCRT.h +++ b/CRT/AliCRT.h @@ -21,8 +21,8 @@ public: AliCRT& operator=(const AliCRT& crt); virtual void CreateMaterials(); - virtual Int_t IsVersion() const; - virtual TString Version(); +// virtual Int_t IsVersion() const; +// virtual TString Version(); virtual void SetTreeAddress(); @@ -30,9 +30,9 @@ private: ClassDef(AliCRT, 1) // Cosmic Ray Trigger (ACORDE) base class }; -inline Int_t AliCRT::IsVersion() const -{ return 0; } +// inline Int_t AliCRT::IsVersion() const +// { return 0; } -inline TString AliCRT::Version() -{ return TString(""); } +// inline TString AliCRT::Version() +// { return TString(""); } #endif // ALICRT_H diff --git a/CRT/AliCRTv0.cxx b/CRT/AliCRTv0.cxx index b23d9885f06..221c60eca1d 100644 --- a/CRT/AliCRTv0.cxx +++ b/CRT/AliCRTv0.cxx @@ -48,6 +48,7 @@ #include #include #include +#include #include "AliRun.h" #include "AliConst.h" diff --git a/CRT/AliCRTv0.h b/CRT/AliCRTv0.h index e6d4e794b47..6d1dc183844 100644 --- a/CRT/AliCRTv0.h +++ b/CRT/AliCRTv0.h @@ -19,8 +19,8 @@ public: AliCRTv0& operator=(const AliCRTv0& crt); - virtual TString Version(); - virtual Int_t IsVersion() const; + // virtual TString Version(); + // virtual Int_t IsVersion() const; virtual void CreateGeometry(); virtual void BuildGeometry(); @@ -34,9 +34,9 @@ private: ClassDef(AliCRTv0,1) // Cosmic Ray Trigger (ACORDE). }; -inline TString AliCRTv0::Version() -{ return TString("v0"); } +// inline TString AliCRTv0::Version() +// { return TString("v0"); } -inline Int_t AliCRTv0::IsVersion() const -{ return 0; } +// inline Int_t AliCRTv0::IsVersion() const +// { return 0; } #endif // ALICRTV0_H diff --git a/CRT/AliCRTv1.cxx b/CRT/AliCRTv1.cxx index 6c532d28ae4..708bfb2c990 100644 --- a/CRT/AliCRTv1.cxx +++ b/CRT/AliCRTv1.cxx @@ -50,12 +50,14 @@ #include #include #include +#include #include "AliRun.h" #include "AliConst.h" #include "AliCRThit.h" #include "AliCRTConstants.h" +#include "AliMC.h" ClassImp(AliCRTv1) @@ -85,7 +87,7 @@ AliCRTv1::AliCRTv1(const char *name, const char *title) fIshunt = 1; // All hits are associated with primary particles fHits = new TClonesArray("AliCRThit",400); - gAlice->AddHitList(fHits); + gAlice->GetMCApp()->AddHitList(fHits); SetMarkerColor(7); SetMarkerStyle(2); @@ -585,7 +587,7 @@ void AliCRTv1::StepManager() else vol[0] = -1;// ? //vol[0] = gMC->GetMedium(); //layer(flay) - AddHit(gAlice->GetCurrentTrackNumber(),vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits); // Reset the deposited energy only when you reach the Magnet if ( (strcmp(gMC->CurrentVolName(),"CRT4")==0) ) eloss = 0; diff --git a/EMCAL/AliEMCALGetter.cxx b/EMCAL/AliEMCALGetter.cxx index 66bb000368a..7ab61d26334 100644 --- a/EMCAL/AliEMCALGetter.cxx +++ b/EMCAL/AliEMCALGetter.cxx @@ -57,6 +57,7 @@ #include "AliRunLoader.h" #include "AliStack.h" #include "AliEMCALLoader.h" +#include "AliMC.h" ClassImp(AliEMCALGetter) @@ -602,7 +603,7 @@ TParticle * AliEMCALGetter::Secondary(const TParticle* p, const Int_t index) con if(p) { Int_t daughterIndex = p->GetDaughter(index-1) ; AliRunLoader * rl = AliRunLoader::GetRunLoader(EmcalLoader()->GetTitle()); - return rl->GetAliRun()->Particle(daughterIndex) ; + return rl->GetAliRun()->GetMCApp()->Particle(daughterIndex) ; } else return 0 ; diff --git a/EMCAL/AliEMCALJetFinder.cxx b/EMCAL/AliEMCALJetFinder.cxx index c391d8f13d5..eab4ee982b7 100644 --- a/EMCAL/AliEMCALJetFinder.cxx +++ b/EMCAL/AliEMCALJetFinder.cxx @@ -59,6 +59,7 @@ #include "AliEMCALGetter.h" // Interface to FORTRAN #include "Ecommon.h" +#include "AliMC.h" ClassImp(AliEMCALJetFinder) @@ -780,7 +781,7 @@ void AliEMCALJetFinder::FillFromTracks(Int_t flag, Int_t ich) // this is for Pythia ?? for (Int_t part = 0; part < npart; part++) { - TParticle *MPart = gAlice->Particle(part); + TParticle *MPart = gAlice->GetMCApp()->Particle(part); Int_t mpart = MPart->GetPdgCode(); Int_t child1 = MPart->GetFirstDaughter(); Float_t pT = MPart->Pt(); @@ -1157,7 +1158,7 @@ void AliEMCALJetFinder::FillFromHitFlaggedTracks(Int_t flag) fNtS = 0; for (Int_t track = 0; track < ntracks; track++) { - TParticle *MPart = gAlice->Particle(track); + TParticle *MPart = gAlice->GetMCApp()->Particle(track); Float_t pT = MPart->Pt(); Float_t phi = MPart->Phi(); Float_t eta = MPart->Eta(); @@ -1207,7 +1208,7 @@ void AliEMCALJetFinder::FillFromParticles() fTrackList[part] = 0; - MPart = gAlice->Particle(part); + MPart = gAlice->GetMCApp()->Particle(part); mpart = MPart->GetPdgCode(); child1 = MPart->GetFirstDaughter(); child2 = MPart->GetLastDaughter(); @@ -1291,7 +1292,7 @@ void AliEMCALJetFinder::FillFromPartons() // Go through the partons Int_t statusCode=0; for (Int_t part = 8; part < npart; part++) { - TParticle *MPart = gAlice->Particle(part); + TParticle *MPart = gAlice->GetMCApp()->Particle(part); Int_t mpart = MPart->GetPdgCode(); // Int_t child1 = MPart->GetFirstDaughter(); Float_t pT = MPart->Pt(); @@ -1367,7 +1368,7 @@ void AliEMCALJetFinder::BuildTrackFlagTable() { Int_t idprim = mHit->GetPrimary(); // primary particle //Determine the origin point of this particle - it made a hit in the EMCAL - TParticle *trkPart = gAlice->Particle(iTrk); + TParticle *trkPart = gAlice->GetMCApp()->Particle(iTrk); TParticlePDG *trkPdg = trkPart->GetPDG(); Int_t trkCode = trkPart->GetPdgCode(); Double_t trkChg; @@ -1384,7 +1385,7 @@ void AliEMCALJetFinder::BuildTrackFlagTable() { //Loop through the ancestry of the EMCAL entrance particles Int_t ancestor = trkPart->GetFirstMother(); //Get track's Mother while (ancestor != -1) { - TParticle *ancPart = gAlice->Particle(ancestor); //get particle info on ancestor + TParticle *ancPart = gAlice->GetMCApp()->Particle(ancestor); //get particle info on ancestor TParticlePDG *ancPdg = ancPart->GetPDG(); Int_t ancCode = ancPart->GetPdgCode(); Double_t ancChg; @@ -1401,7 +1402,7 @@ void AliEMCALJetFinder::BuildTrackFlagTable() { } //Determine the origin point of the primary particle associated with the hit - TParticle *primPart = gAlice->Particle(idprim); + TParticle *primPart = gAlice->GetMCApp()->Particle(idprim); TParticlePDG *primPdg = primPart->GetPDG(); Int_t primCode = primPart->GetPdgCode(); Double_t primChg; diff --git a/EMCAL/AliEMCALJetFinderInputSimPrep.cxx b/EMCAL/AliEMCALJetFinderInputSimPrep.cxx index 7b5b6122173..300c04844ed 100755 --- a/EMCAL/AliEMCALJetFinderInputSimPrep.cxx +++ b/EMCAL/AliEMCALJetFinderInputSimPrep.cxx @@ -46,6 +46,7 @@ #include "AliGenPythiaEventHeader.h" #include "AliGenerator.h" #include "AliHeader.h" +#include "AliMC.h" ClassImp(AliEMCALJetFinderInputSimPrep) @@ -221,7 +222,7 @@ 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(); @@ -410,7 +411,7 @@ if (fDebug > 1) Info("FillParticles","Beginning FillParticles"); TParticlePDG* pdgP = 0; for (Int_t part = 0; part < npart; part++) { - TParticle *MPart = gAlice->Particle(part); + TParticle *MPart = gAlice->GetMCApp()->Particle(part); pdgP = MPart->GetPDG(); if (fDebug > 10) Info("FillParticles","Checking if particle is a primary"); @@ -523,7 +524,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 ){ @@ -545,7 +546,7 @@ void AliEMCALJetFinderInputSimPrep::FillPartonTracks(AliEMCALParton *parton) 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 ){ diff --git a/EMCAL/AliEMCALJetMicroDst.cxx b/EMCAL/AliEMCALJetMicroDst.cxx index d2bbec7c8a5..444b08f491e 100644 --- a/EMCAL/AliEMCALJetMicroDst.cxx +++ b/EMCAL/AliEMCALJetMicroDst.cxx @@ -31,6 +31,7 @@ #include #include #include +#include "AliMC.h" ClassImp(AliEMCALJetMicroDst) @@ -337,7 +338,7 @@ void AliEMCALJetMicroDst::FillPartons() TParticle *MPart; Int_t ind; for(Int_t i=6; i<8; i++){ - MPart = gAlice->Particle(i); + MPart = gAlice->GetMCApp()->Particle(i); ind = i-6; xpt[ind] = MPart->Pt(); xeta[ind] = MPart->Eta(); diff --git a/EMCAL/AliEMCALv0.cxx b/EMCAL/AliEMCALv0.cxx index 2e3fe27f621..f13ea3d9028 100644 --- a/EMCAL/AliEMCALv0.cxx +++ b/EMCAL/AliEMCALv0.cxx @@ -35,6 +35,7 @@ #include "TNode.h" #include "TRandom.h" #include "TGeometry.h" +#include "TVirtualMC.h" // --- Standard library --- diff --git a/EMCAL/AliEMCALv1.cxx b/EMCAL/AliEMCALv1.cxx index 061196cde78..0540291af51 100644 --- a/EMCAL/AliEMCALv1.cxx +++ b/EMCAL/AliEMCALv1.cxx @@ -38,6 +38,7 @@ #include "TTree.h" #include "TGeometry.h" #include "TParticle.h" +#include "TVirtualMC.h" // --- Standard library --- @@ -55,6 +56,7 @@ #include "AliEMCALGeometry.h" #include "AliConst.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliEMCALv1) @@ -71,7 +73,7 @@ AliEMCALv1::AliEMCALv1(const char *name, const char *title): // Standard Creator. fHits= new TClonesArray("AliEMCALHit",1000); - gAlice->AddHitList(fHits); + gAlice->GetMCApp()->AddHitList(fHits); fNhits = 0; fIshunt = 2; // All hits are associated with particles entering the calorimeter @@ -130,7 +132,7 @@ void AliEMCALv1::StepManager(void){ Float_t pmom[4]={0.,0.,0.,0.}; TLorentzVector pos; // Lorentz vector of the track current position. TLorentzVector mom; // Lorentz vector of the track current momentum. - Int_t tracknumber = gAlice->GetCurrentTrackNumber(); + Int_t tracknumber = gAlice->GetMCApp()->GetCurrentTrackNumber(); Int_t primary = 0; static Int_t iparent = 0; static Float_t ienergy = 0; @@ -152,7 +154,7 @@ void AliEMCALv1::StepManager(void){ Int_t parent = iparent ; while ( parent != -1 ) { // <------------- flags this particle to be kept and //all the ancestors of this particle - part = gAlice->Particle(parent) ; + part = gAlice->GetMCApp()->Particle(parent) ; part->SetBit(kKeepBit); parent = part->GetFirstMother() ; } @@ -196,7 +198,7 @@ void AliEMCALv1::StepManager(void){ ; xyzte[4] = lightYield ; - primary = gAlice->GetPrimary(tracknumber); + primary = gAlice->GetMCApp()->GetPrimary(tracknumber); if (gDebug == 2) Info("StepManager", "id0 = %d, id1 = %d, absid = %d tower = %d layer = %d energy = %f\n", id[0], id[1], absid, tower, layer, xyzte[4]) ; diff --git a/EVGEN/AliDimuCombinator.cxx b/EVGEN/AliDimuCombinator.cxx index 96010dba29c..4d64b095f90 100644 --- a/EVGEN/AliDimuCombinator.cxx +++ b/EVGEN/AliDimuCombinator.cxx @@ -31,6 +31,7 @@ #include "AliDimuCombinator.h" #include "AliRun.h" +#include "AliMC.h" // ClassImp(AliDimuCombinator) @@ -66,7 +67,7 @@ AliDimuCombinator::AliDimuCombinator(const AliDimuCombinator & combinator) // TParticle* AliDimuCombinator::Particle(Int_t i) { - return gAlice->Particle(i); + return gAlice->GetMCApp()->Particle(i); } TParticle* AliDimuCombinator::FirstMuon() diff --git a/EVGEN/AliGenCocktail.cxx b/EVGEN/AliGenCocktail.cxx index 4e9a2e9485b..89a6580e705 100644 --- a/EVGEN/AliGenCocktail.cxx +++ b/EVGEN/AliGenCocktail.cxx @@ -30,6 +30,7 @@ #include "AliGenCocktailEntry.h" #include "AliCollisionGeometry.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliGenCocktail) @@ -129,7 +130,7 @@ AddGenerator(AliGenerator *Generator, char* Name, Float_t RateExp) AliGenCocktailEntry *preventry = 0; AliGenerator* gen = 0; - TObjArray *partArray = gAlice->Particles(); + TObjArray *partArray = gAlice->GetMCApp()->Particles(); // // Generate the vertex position used by all generators diff --git a/EVGEN/AliGenCocktailAfterBurner.cxx b/EVGEN/AliGenCocktailAfterBurner.cxx index 3cd04970960..8127ab026f9 100644 --- a/EVGEN/AliGenCocktailAfterBurner.cxx +++ b/EVGEN/AliGenCocktailAfterBurner.cxx @@ -40,6 +40,7 @@ #include "AliGenCocktailAfterBurner.h" #include "AliGenCocktailEntry.h" #include "AliStack.h" +#include "AliMC.h" ClassImp(AliGenCocktailAfterBurner) @@ -344,7 +345,7 @@ void AliGenCocktailAfterBurner::SetTracks(Int_t stackno) mech = AliGenCocktailAfterBurner::IntToMCProcess(p->GetUniqueID()); weight = p->GetWeight(); - gAlice->PushTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof, + gAlice->GetMCApp()->PushTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof, polx, poly, polz, mech, ntr, weight); } } diff --git a/EVGEN/AliGenFLUKAsource.cxx b/EVGEN/AliGenFLUKAsource.cxx index 520da1f4cb8..c99ef8ee3aa 100644 --- a/EVGEN/AliGenFLUKAsource.cxx +++ b/EVGEN/AliGenFLUKAsource.cxx @@ -24,6 +24,7 @@ #include #include "TPDGCode.h" #include "TDatabasePDG.h" +#include #include "AliGenFLUKAsource.h" #include "AliRun.h" diff --git a/EVGEN/AliGenHIJINGpara.cxx b/EVGEN/AliGenHIJINGpara.cxx index 76174048c90..99d8b5a9586 100644 --- a/EVGEN/AliGenHIJINGpara.cxx +++ b/EVGEN/AliGenHIJINGpara.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include "AliConst.h" #include "AliDecayer.h" diff --git a/EVGEN/AliGenParam.cxx b/EVGEN/AliGenParam.cxx index 32191ad8695..9203eb92561 100644 --- a/EVGEN/AliGenParam.cxx +++ b/EVGEN/AliGenParam.cxx @@ -29,10 +29,12 @@ #include #include #include +#include #include #include #include +#include "AliMC.h" ClassImp(AliGenParam) @@ -442,7 +444,7 @@ void AliGenParam::Generate() } // kinematic selection else // nodecay option, so parent will be tracked by GEANT (pions, kaons, eta, omegas, baryons) { - gAlice-> + gAlice->GetMCApp()-> PushTrack(fTrackIt,-1,iPart,p,origin0,polar,0,kPPrimary,nt,wgtp); ipa++; } diff --git a/FMD/AliFMD.cxx b/FMD/AliFMD.cxx index 3218fee01f7..feb90fe96aa 100644 --- a/FMD/AliFMD.cxx +++ b/FMD/AliFMD.cxx @@ -63,6 +63,7 @@ #include "AliLoader.h" #include "AliMagF.h" #include "AliRun.h" +#include "AliMC.h" ClassImp (AliFMD) //_____________________________________________________________________________ @@ -91,7 +92,7 @@ AliDetector (name, title) // Digits for each Si disk fDigits = new TClonesArray ("AliFMDdigit", 1000); fReconParticles=new TClonesArray("AliFMDReconstParticles",1000); - gAlice->AddHitList (fHits); + gAlice->GetMCApp()->AddHitList (fHits); fIshunt = 0; // fMerger = 0; diff --git a/FMD/AliFMDv0.cxx b/FMD/AliFMDv0.cxx index a183fc4bfb8..8185875280a 100644 --- a/FMD/AliFMDv0.cxx +++ b/FMD/AliFMDv0.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include "AliFMDv0.h" #include "AliMagF.h" diff --git a/FMD/AliFMDv1.cxx b/FMD/AliFMDv1.cxx index bb217fadd6c..1a8aa6bcad5 100644 --- a/FMD/AliFMDv1.cxx +++ b/FMD/AliFMDv1.cxx @@ -48,6 +48,7 @@ #include "AliFMDv1.h" #include "AliMagF.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliFMDv1) @@ -414,7 +415,7 @@ void AliFMDv1::StepManager() gMC->IsTrackStop()) { hits[6]=de+1000.*gMC->Edep(); - new(lhits[fNhits++]) AliFMDhit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); + new(lhits[fNhits++]) AliFMDhit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits); } // IsTrackExiting() } } diff --git a/HBTAN/AliHBTReaderITSv1.cxx b/HBTAN/AliHBTReaderITSv1.cxx index 8e96eec46a4..82c3e3360f1 100644 --- a/HBTAN/AliHBTReaderITSv1.cxx +++ b/HBTAN/AliHBTReaderITSv1.cxx @@ -20,6 +20,7 @@ #include #include #include +#include "AliMC.h" ClassImp(AliHBTReaderITSv1) /********************************************************************/ @@ -170,7 +171,7 @@ Int_t AliHBTReaderITSv1::Read(AliHBTRun* particles, AliHBTRun *tracks) gAliceFile->cd(); gAlice->GetEvent(currentEvent); - gAlice->Particles(); + gAlice->GetMCApp()->Particles(); Int_t nentr=(Int_t)tracktree->GetEntries(); @@ -188,7 +189,7 @@ Int_t AliHBTReaderITSv1::Read(AliHBTRun* particles, AliHBTRun *tracks) continue; } - TParticle *p = (TParticle*)gAlice->Particle(label); + TParticle *p = (TParticle*)gAlice->GetMCApp()->Particle(label); if(!p) { Warning("Read","Can not get particle with label &d",label); diff --git a/ITS/AliITS.cxx b/ITS/AliITS.cxx index c68fe672845..1235c1844ba 100644 --- a/ITS/AliITS.cxx +++ b/ITS/AliITS.cxx @@ -104,6 +104,7 @@ the AliITS class. #include "AliITSsimulationSDD.h" #include "AliITSsimulationSPD.h" #include "AliITSsimulationSSD.h" +#include "AliMC.h" ClassImp(AliITS) @@ -175,7 +176,7 @@ AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){ fIshunt = 0; // not zeroed in AliDetector fHits = new TClonesArray("AliITShit", 1560);//not done in AliDetector - gAlice->AddHitList(fHits); // Not done in AliDetector. + gAlice->GetMCApp()->AddHitList(fHits); // Not done in AliDetector. fEuclidOut = 0; fITSgeom = 0; diff --git a/ITS/AliITSFindClustersV2.cxx b/ITS/AliITSFindClustersV2.cxx index a89787f9164..b56125a5a16 100644 --- a/ITS/AliITSFindClustersV2.cxx +++ b/ITS/AliITSFindClustersV2.cxx @@ -30,6 +30,7 @@ #include "AliITSFindClustersV2.h" #include "AliITSclusterV2.h" #include "AliITSgeom.h" +#include "AliMC.h" ClassImp(AliITSFindClustersV2) @@ -338,7 +339,7 @@ void AliITSFindClustersV2::Exec(const Option_t *opt){ lab[3] = i; lad = lab[0]; if(lad>=0){ - part = (TParticle*) fAr->Particle(lad); + part = (TParticle*) fAr->GetMCApp()->Particle(lad); lad = -3; while(part->P() < 0.005){ if(part->GetFirstMother()<0){ @@ -346,7 +347,7 @@ void AliITSFindClustersV2::Exec(const Option_t *opt){ break; } // end if part->GetFirstMother()<0 lad = part->GetFirstMother(); - part = (TParticle*) fAr->Particle(lad); + part = (TParticle*) fAr->GetMCApp()->Particle(lad); } // end while part->P() < 0.005 if(lab[1]<0) lab[1] = lad; else if(lab[2]<0) lab[2] = lad; diff --git a/ITS/AliITSRiemannFit.cxx b/ITS/AliITSRiemannFit.cxx index 53be0002c65..5c9ea1defa5 100644 --- a/ITS/AliITSRiemannFit.cxx +++ b/ITS/AliITSRiemannFit.cxx @@ -69,6 +69,7 @@ #include "AliITSRecPoint.h" #include "AliITSgeom.h" #include "AliITSmodule.h" +#include "AliMC.h" ClassImp(AliITSRiemannFit) @@ -258,7 +259,7 @@ void AliITSRiemannFit::InitPoints(Int_t ntracks,AliITS *ITS, if(track <0 ) continue; xcluster=recp->GetX(); // x on cluster zcluster=recp->GetZ(); // z on cluster - part = (TParticle*) gAlice->Particle(track); + part = (TParticle*) gAlice->GetMCApp()->Particle(track); part->ProductionVertex(OT); // set the vertex part->Momentum(PE); // set the vertex momentum name = part->GetName(); diff --git a/ITS/AliITSTrackerV1.cxx b/ITS/AliITSTrackerV1.cxx index a7cc77b2dd2..ca8f6f463a1 100644 --- a/ITS/AliITSTrackerV1.cxx +++ b/ITS/AliITSTrackerV1.cxx @@ -58,6 +58,7 @@ #include "AliITSTrackerV1.h" #include "AliITSVertex.h" #include "AliITSPid.h" +#include "AliMC.h" ClassImp(AliITSTrackerV1) //______________________________________________________________________ @@ -720,7 +721,7 @@ void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr, for(k=0; k<3; k++){ Int_t lpp=(Int_t)vecLabRef(k); if(lpp>=0) { - TParticle *p=(TParticle*) gAlice->Particle(lpp); + TParticle *p=(TParticle*) gAlice->GetMCApp()->Particle(lpp); Int_t pcode=p->GetPdgCode(); if(pcode==11) vecLabRef(k)=p->GetFirstMother(); } // end if diff --git a/ITS/AliITSclustererV2.cxx b/ITS/AliITSclustererV2.cxx index 80df738bb3f..afa5d7e41e1 100644 --- a/ITS/AliITSclustererV2.cxx +++ b/ITS/AliITSclustererV2.cxx @@ -20,6 +20,7 @@ #include #include "AliITSgeom.h" #include "AliITSdigit.h" +#include "AliMC.h" ClassImp(AliITSclustererV2) @@ -222,7 +223,7 @@ static void CheckLabels(Int_t lab[3]) { //------------------------------------------------------------ Int_t label=lab[0]; if (label>=0) { - TParticle *part=(TParticle*)gAlice->Particle(label); + TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label); label=-3; while (part->P() < 0.005) { Int_t m=part->GetFirstMother(); @@ -235,7 +236,7 @@ static void CheckLabels(Int_t lab[3]) { break; } label=m; - part=(TParticle*)gAlice->Particle(label); + part=(TParticle*)gAlice->GetMCApp()->Particle(label); } if (lab[1]<0) lab[1]=label; else if (lab[2]<0) lab[2]=label; diff --git a/ITS/AliITShit.cxx b/ITS/AliITShit.cxx index b298beaeebc..55048bc9318 100644 --- a/ITS/AliITShit.cxx +++ b/ITS/AliITShit.cxx @@ -29,6 +29,7 @@ #include "AliITS.h" #include "AliITSgeom.h" #include "AliITShit.h" +#include "AliMC.h" ClassImp(AliITShit) @@ -560,7 +561,7 @@ TParticle * AliITShit::GetParticle(){ // this hit. From the TParticle all kinds of information about this // particle can be found. See the TParticle class. //////////////////////////////////////////////////////////////////////// - return gAlice->Particle(GetTrack()); + return gAlice->GetMCApp()->Particle(GetTrack()); } //---------------------------------------------------------------------- void AliITShit::Print(ostream *os){ diff --git a/ITS/AliITStestV2.C b/ITS/AliITStestV2.C index e2ef8353c8c..ade8c991e7e 100644 --- a/ITS/AliITStestV2.C +++ b/ITS/AliITStestV2.C @@ -36,10 +36,10 @@ Int_t AliITStestV2(Int_t nev=5, Char_t SlowOrFast='s') { AliITSSDigits2Digits(); } gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindClustersV2.C"); - if (rc=AliITSFindClustersV2(nev,SlowOrFast)) return rc; + if (rc=AliITSFindClustersV2(SlowOrFast)) return rc; gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSFindTracksV2.C"); - if (rc=AliITSFindTracksV2(nev)) return rc; + if (rc=AliITSFindTracksV2()) return rc; gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSComparisonV2.C"); if (rc=AliITSComparisonV2()) return rc; diff --git a/ITS/AliITSv5.cxx b/ITS/AliITSv5.cxx index 118733e792a..d84c96796a5 100644 --- a/ITS/AliITSv5.cxx +++ b/ITS/AliITSv5.cxx @@ -53,6 +53,7 @@ #include "AliITShit.h" #include "AliITSv5.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliITSv5) @@ -801,6 +802,6 @@ void AliITSv5::StepManager(){ hits[6]=gMC->Edep(); hits[7]=gMC->TrackTime(); // Fill hit structure with this new hit. - new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); + new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits); return; } diff --git a/ITS/AliITSv5asymm.cxx b/ITS/AliITSv5asymm.cxx index 27e3e6d2510..fc0510f989f 100644 --- a/ITS/AliITSv5asymm.cxx +++ b/ITS/AliITSv5asymm.cxx @@ -53,6 +53,7 @@ #include "AliITShit.h" #include "AliITSv5asymm.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliITSv5asymm) @@ -815,6 +816,6 @@ void AliITSv5asymm::StepManager(){ hits[6]=gMC->Edep(); hits[7]=gMC->TrackTime(); // Fill hit structure with this new hit. - new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); + new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits); return; } diff --git a/ITS/AliITSv5symm.cxx b/ITS/AliITSv5symm.cxx index 76b180eed2e..cc2c0391a8e 100644 --- a/ITS/AliITSv5symm.cxx +++ b/ITS/AliITSv5symm.cxx @@ -53,6 +53,7 @@ #include "AliITShit.h" #include "AliITSv5symm.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliITSv5symm) @@ -807,6 +808,6 @@ void AliITSv5symm::StepManager(){ hits[6]=gMC->Edep(); hits[7]=gMC->TrackTime(); // Fill hit structure with this new hit. - new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); + new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits); return; } diff --git a/ITS/AliITSvPPRasymm.cxx b/ITS/AliITSvPPRasymm.cxx index 5a90b752600..efaec5d1d67 100644 --- a/ITS/AliITSvPPRasymm.cxx +++ b/ITS/AliITSvPPRasymm.cxx @@ -72,6 +72,7 @@ #include "AliITSsimulationSPD.h" #include "AliITSsimulationSSD.h" #include "AliITSvPPRasymm.h" +#include "AliMC.h" ClassImp(AliITSvPPRasymm) @@ -29197,7 +29198,7 @@ void AliITSvPPRasymm::StepManager(){ copy = fTrackReferences->GetEntriesFast(); TClonesArray &lTR = *fTrackReferences; // Fill TrackReference structure with this new TrackReference. - new(lTR[copy]) AliTrackReference(gAlice->GetCurrentTrackNumber()); + new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); } // if Outer ITS mother Volume if(!(this->IsActive())){ return; @@ -29286,7 +29287,7 @@ void AliITSvPPRasymm::StepManager(){ return; } // end if IsEntering // Fill hit structure with this new hit. - new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetCurrentTrackNumber(),vol, + new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, gMC->Edep(),gMC->TrackTime(),position, position0,momentum); // diff --git a/ITS/AliITSvPPRasymmFMD.cxx b/ITS/AliITSvPPRasymmFMD.cxx index 2f16ff403db..5893b4de0ab 100644 --- a/ITS/AliITSvPPRasymmFMD.cxx +++ b/ITS/AliITSvPPRasymmFMD.cxx @@ -74,6 +74,7 @@ #include "AliMagF.h" #include "AliRun.h" #include "AliTrackReference.h" +#include "AliMC.h" #define GEANTGEOMETRY kTRUE @@ -5351,7 +5352,7 @@ void AliITSvPPRasymmFMD::StepManager(){ copy = fTrackReferences->GetEntriesFast(); TClonesArray &lTR = *fTrackReferences; // Fill TrackReference structure with this new TrackReference. - new(lTR[copy]) AliTrackReference(gAlice->GetCurrentTrackNumber()); + new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); } // if Outer ITS mother Volume @@ -5439,7 +5440,7 @@ void AliITSvPPRasymmFMD::StepManager(){ return; } // end if IsEntering // Fill hit structure with this new hit. - new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetCurrentTrackNumber(),vol, + new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, gMC->Edep(),gMC->TrackTime(),position, position0,momentum); // diff --git a/ITS/AliITSvSPD02.cxx b/ITS/AliITSvSPD02.cxx index 7fa549ae3dc..583207e73ba 100644 --- a/ITS/AliITSvSPD02.cxx +++ b/ITS/AliITSvSPD02.cxx @@ -58,6 +58,7 @@ #include "AliITSClusterFinderSPD.h" #include "AliITSClusterFinderSDD.h" #include "AliITSClusterFinderSSD.h" +#include "AliMC.h" ClassImp(AliITSvSPD02) @@ -745,7 +746,7 @@ void AliITSvSPD02::StepManager(){ copy = fTrackReferences->GetEntriesFast(); TClonesArray &lTR = *fTrackReferences; // Fill TrackReference structure with this new TrackReference. - new(lTR[copy]) AliTrackReference(gAlice->GetCurrentTrackNumber()); + new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); } // if Outer ITS mother Volume if(!(this->IsActive())){ return; @@ -790,7 +791,7 @@ void AliITSvSPD02::StepManager(){ return; } // end if IsEntering // Fill hit structure with this new hit only for non-entrerance hits. - else new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetCurrentTrackNumber(),vol, + else new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, gMC->Edep(),gMC->TrackTime(),position, position0,momentum); // diff --git a/ITS/AliITSvtest.cxx b/ITS/AliITSvtest.cxx index cd062e6d487..bdde5973bd0 100644 --- a/ITS/AliITSvtest.cxx +++ b/ITS/AliITSvtest.cxx @@ -46,6 +46,7 @@ #include "AliITShit.h" #include "AliITSvtest.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliITSvtest) @@ -411,7 +412,7 @@ void AliITSvtest::StepManager(){ hits[6]=gMC->Edep(); hits[7]=gMC->TrackTime(); // Fill hit structure with this new hit. - new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); + new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits); return; } diff --git a/MUON/AliMUONClusterFinderAZ.cxx b/MUON/AliMUONClusterFinderAZ.cxx index 85c7f590aed..308150d9f83 100644 --- a/MUON/AliMUONClusterFinderAZ.cxx +++ b/MUON/AliMUONClusterFinderAZ.cxx @@ -23,6 +23,7 @@ #include "AliMUONRawCluster.h" #include "AliMUONClusterInput.h" #include "AliMUONPixel.h" +#include "AliMC.h" // This function is used for fitting void fcn1(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag); @@ -110,7 +111,7 @@ newev: AliLoader * gime = rl->GetLoader("MUONLoader"); if (!fReco) nparticles = rl->GetEvent(nev); - else nparticles = gAlice->GetNtrack(); + else nparticles = gAlice->GetMCApp()->GetNtrack(); cout << "nev " << nev <AddText(ptitle); - Int_t nparticles = gAlice->Particles()->GetEntriesFast(); + Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast(); sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d", nparticles, fHitsCuts,fClustersCuts); title->AddText(ptitle); diff --git a/MUON/AliMUONEventReconstructor.cxx b/MUON/AliMUONEventReconstructor.cxx index f0a365fdb77..e5b25215013 100644 --- a/MUON/AliMUONEventReconstructor.cxx +++ b/MUON/AliMUONEventReconstructor.cxx @@ -53,6 +53,7 @@ #include "AliLoader.h" #include "AliMUONTrackK.h" //AZ #include //AZ +#include "AliMC.h" //************* Defaults parameters for reconstruction static const Double_t kDefaultMinBendingMomentum = 3.0; @@ -1457,7 +1458,7 @@ void AliMUONEventReconstructor::EventDump(void) z, x, y, pX, pY, pZ, c); } // informations about generated particles - np = gAlice->GetNtrack(); + np = gAlice->GetMCApp()->GetNtrack(); printf(" **** number of generated particles: %d \n", np); // for (Int_t iPart = 0; iPart < np; iPart++) { diff --git a/MUON/AliMUONRecoDisplay.cxx b/MUON/AliMUONRecoDisplay.cxx index 14fe22fc7ed..31ddc46f77e 100644 --- a/MUON/AliMUONRecoDisplay.cxx +++ b/MUON/AliMUONRecoDisplay.cxx @@ -61,6 +61,7 @@ #include "AliMUONRecoEvent.h" #include "AliMUONRecoDisplay.h" +#include "AliMC.h" ClassImp(AliMUONRecoDisplay) @@ -183,7 +184,7 @@ void AliMUONRecoDisplay::MapEvent(Int_t nevent) for (Int_t track=0; trackFirstHit(track); if (!hit) continue; - particle = gAlice->Particle(hit->Track()); + particle = gAlice->GetMCApp()->Particle(hit->Track()); if (IsReconstructible(track) && TMath::Abs(particle->GetPdgCode())==13) { gtrack = fEvGen->AddEmptyTrack(); gtrack->SetSign(TMath::Sign((Int_t)1, -particle->GetPdgCode())); diff --git a/MUON/AliMUONv0.cxx b/MUON/AliMUONv0.cxx index 00066520e9f..6ce42ba69a8 100644 --- a/MUON/AliMUONv0.cxx +++ b/MUON/AliMUONv0.cxx @@ -37,6 +37,7 @@ #include "AliMUONv0.h" #include "AliMagF.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliMUONv0) @@ -214,7 +215,7 @@ void AliMUONv0::StepManager() hits[13] = mom[2]; // Pz hits[14] = gMC->TrackTime(); // time of flight new(lhits[fNhits++]) - AliMUONHit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); + AliMUONHit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits); } // if( gMC->IsTrackExiting()) gMC->StopTrack(); diff --git a/MUON/AliMUONv1.cxx b/MUON/AliMUONv1.cxx index 75ca00984e9..1898696ac19 100644 --- a/MUON/AliMUONv1.cxx +++ b/MUON/AliMUONv1.cxx @@ -40,6 +40,7 @@ #include "AliMUONv1.h" #include "AliMagF.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliMUONv1) @@ -1742,7 +1743,7 @@ void AliMUONv1::StepManager() // One hit per chamber - GetMUONData()->AddHit(fIshunt, gAlice->GetCurrentTrackNumber(), iChamber, ipart, + GetMUONData()->AddHit(fIshunt, gAlice->GetMCApp()->GetCurrentTrackNumber(), iChamber, ipart, fTrackPosition.X(), fTrackPosition.Y()+YAngleEffect, fTrackPosition.Z(), 0.0, fTrackMomentum.P(),theta, phi, fStepSum[idvol], fDestepSum[idvol], fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()); @@ -1903,7 +1904,7 @@ void AliMUONv1::StepManagerOld() // new hit new(lhits[fNhits++]) - AliMUONHit(fIshunt, gAlice->GetCurrentTrackNumber(), vol,hits); + AliMUONHit(fIshunt, gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits); eloss = 0; // // Check additional signal generation conditions diff --git a/MUON/AliMUONv2.cxx b/MUON/AliMUONv2.cxx index b89bf3f8365..d782b933ade 100644 --- a/MUON/AliMUONv2.cxx +++ b/MUON/AliMUONv2.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include "AliMpFiles.h" #include "AliMpReader.h" diff --git a/PHOS/AliPHOSGetter.cxx b/PHOS/AliPHOSGetter.cxx index b1b412721ff..1b221d95466 100644 --- a/PHOS/AliPHOSGetter.cxx +++ b/PHOS/AliPHOSGetter.cxx @@ -56,6 +56,7 @@ // #include "AliPHOSRaw2Digits.h" //#include "AliPHOSCalibrationDB.h" #include "AliPHOSBeamTestEvent.h" +#include "AliMC.h" ClassImp(AliPHOSGetter) @@ -585,7 +586,7 @@ TParticle * AliPHOSGetter::Secondary(const TParticle* p, const Int_t index) cons if(p) { Int_t daughterIndex = p->GetDaughter(index-1) ; AliRunLoader * rl = AliRunLoader::GetRunLoader(PhosLoader()->GetTitle()); - return rl->GetAliRun()->Particle(daughterIndex) ; + return rl->GetAliRun()->GetMCApp()->Particle(daughterIndex) ; } else return 0 ; diff --git a/PHOS/AliPHOSv1.cxx b/PHOS/AliPHOSv1.cxx index de16fc74412..307533ee85c 100644 --- a/PHOS/AliPHOSv1.cxx +++ b/PHOS/AliPHOSv1.cxx @@ -51,6 +51,7 @@ #include "AliPHOSQAMeanChecker.h" #include "AliPHOSv1.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliPHOSv1) @@ -94,7 +95,7 @@ AliPHOSv1::AliPHOSv1(const char *name, const char *title): // and the TreeD at the end of the event (branch is set in FinishEvent() ). fHits= new TClonesArray("AliPHOSHit",1000) ; - gAlice->AddHitList(fHits) ; + gAlice->GetMCApp()->AddHitList(fHits) ; fNhits = 0 ; @@ -280,7 +281,7 @@ void AliPHOSv1::StepManager(void) TLorentzVector pos ; // Lorentz vector of the track current position Int_t copy ; - Int_t tracknumber = gAlice->GetCurrentTrackNumber() ; + Int_t tracknumber = gAlice->GetMCApp()->GetCurrentTrackNumber() ; TString name = GetGeometry()->GetName() ; Int_t moduleNumber ; @@ -400,9 +401,9 @@ void AliPHOSv1::StepManager(void) gMC -> Gmtod (xyzte, xyzd, 1); // transform coordinate from master to daughter system if (xyzd[1] < -GetGeometry()->GetCrystalSize(1)/2.+0.001){ //Entered close to forward surface TParticle * part = 0 ; - Int_t parent = gAlice->GetCurrentTrackNumber() ; + Int_t parent = gAlice->GetMCApp()->GetCurrentTrackNumber() ; while ( parent != -1 ) { - part = gAlice->Particle(parent) ; + part = gAlice->GetMCApp()->Particle(parent) ; part->SetBit(kKeepBit); parent = part->GetFirstMother() ; } @@ -438,17 +439,17 @@ void AliPHOSv1::StepManager(void) Int_t primary =-1 ; if(fIshunt == 1) - primary = gAlice->GetPrimary( gAlice->GetCurrentTrackNumber() ); + primary = gAlice->GetMCApp()->GetPrimary( gAlice->GetMCApp()->GetCurrentTrackNumber() ); else if(fIshunt == 2){ - primary = gAlice->GetCurrentTrackNumber() ; - TParticle * part = gAlice->Particle(primary) ; + primary = gAlice->GetMCApp()->GetCurrentTrackNumber() ; + TParticle * part = gAlice->GetMCApp()->Particle(primary) ; while ( !part->TestBit(kKeepBit) ) { primary = part->GetFirstMother() ; if(primary == -1) break ; //there is a possibility that particle passed e.g. thermal isulator and hits a side //surface of the crystal. In this case it may have no primary at all. //We can not easily separate this case from the case when this is part of the shower, //developed in the neighboring crystal. - part = gAlice->Particle(primary) ; + part = gAlice->GetMCApp()->Particle(primary) ; } } diff --git a/PHOS/AliPHOSvImpacts.cxx b/PHOS/AliPHOSvImpacts.cxx index e698cfb7e54..e8dc33efeed 100644 --- a/PHOS/AliPHOSvImpacts.cxx +++ b/PHOS/AliPHOSvImpacts.cxx @@ -40,6 +40,7 @@ #include "AliPHOSImpact.h" #include "AliPHOSvImpacts.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliPHOSvImpacts) @@ -191,8 +192,8 @@ void AliPHOSvImpacts::StepManager(void) TLorentzVector pos ; // Lorentz vector of the track current position Int_t copy ; - Int_t tracknumber = gAlice->GetCurrentTrackNumber() ; - Int_t primary = gAlice->GetPrimary( gAlice->GetCurrentTrackNumber() ); + Int_t tracknumber = gAlice->GetMCApp()->GetCurrentTrackNumber() ; + Int_t primary = gAlice->GetMCApp()->GetPrimary( gAlice->GetMCApp()->GetCurrentTrackNumber() ); TString name = GetGeometry()->GetName() ; // Add impact to EMC diff --git a/PMD/AliPMD.cxx b/PMD/AliPMD.cxx index 9eacfe19c76..938b197ce24 100644 --- a/PMD/AliPMD.cxx +++ b/PMD/AliPMD.cxx @@ -51,6 +51,7 @@ #include "AliPMD.h" #include "AliPMDRecPoint.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliPMD) @@ -77,7 +78,7 @@ AliPMD::AliPMD(const char *name, const char *title) // // Allocate the array of hits fHits = new TClonesArray("AliPMDhit", 405); - gAlice->AddHitList(fHits); + gAlice->GetMCApp()->AddHitList(fHits); fRecPoints = new TClonesArray("AliPMDRecPoint",10000); fNRecPoints = 0; diff --git a/PMD/AliPMDDigitizer.cxx b/PMD/AliPMDDigitizer.cxx index abc9a1c7c82..743a0142ada 100644 --- a/PMD/AliPMDDigitizer.cxx +++ b/PMD/AliPMDDigitizer.cxx @@ -32,6 +32,7 @@ #include "AliPMDdigit.h" #include "AliPMDDigitizer.h" #include "AliPMDClustering.h" +#include "AliMC.h" ClassImp(AliPMDDigitizer) // @@ -150,7 +151,7 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt) Int_t nparticles = fRunLoader->GetHeader()->GetNtrack(); printf("Number of Particles = %d \n", nparticles); fRunLoader->GetEvent(ievt); - Particles = gAlice->Particles(); + Particles = gAlice->GetMCApp()->Particles(); // ------------------------------------------------------- // // Pointer to specific detector hits. // Get pointers to Alice detectors and Hits containers @@ -189,7 +190,7 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt) // get kinematics of the particles - particle = gAlice->Particle(trackno); + particle = gAlice->GetMCApp()->Particle(trackno); trackpid = particle->GetPdgCode(); Int_t igatr = -999; @@ -212,7 +213,7 @@ void AliPMDDigitizer::Hits2SDigits(Int_t ievt) while((imo = mparticle->GetFirstMother()) >= 0) { igen++; - mparticle = gAlice->Particle(imo); + mparticle = gAlice->GetMCApp()->Particle(imo); id_mo = mparticle->GetPdgCode(); vx = mparticle->Vx(); @@ -385,7 +386,7 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt) Int_t nparticles = fRunLoader->GetHeader()->GetNtrack(); printf("Number of Particles = %d \n", nparticles); fRunLoader->GetEvent(ievt); - Particles = gAlice->Particles(); + Particles = gAlice->GetMCApp()->Particles(); // ------------------------------------------------------- // // Pointer to specific detector hits. // Get pointers to Alice detectors and Hits containers @@ -429,7 +430,7 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt) // get kinematics of the particles - particle = gAlice->Particle(trackno); + particle = gAlice->GetMCApp()->Particle(trackno); trackpid = particle->GetPdgCode(); Int_t igatr = -999; @@ -452,7 +453,7 @@ void AliPMDDigitizer::Hits2Digits(Int_t ievt) while((imo = mparticle->GetFirstMother()) >= 0) { igen++; - mparticle = gAlice->Particle(imo); + mparticle = gAlice->GetMCApp()->Particle(imo); id_mo = mparticle->GetPdgCode(); vx = mparticle->Vx(); diff --git a/PMD/AliPMDv0.cxx b/PMD/AliPMDv0.cxx index ffbbd8e892f..f478ea5aedc 100644 --- a/PMD/AliPMDv0.cxx +++ b/PMD/AliPMDv0.cxx @@ -37,6 +37,7 @@ #include "AliMagF.h" #include "AliPMDv0.h" #include "AliRun.h" +#include "AliMC.h" static Int_t kdet, ncell_sm, ncell_hole; static Float_t zdist, zdist1; @@ -998,7 +999,7 @@ void AliPMDv0::StepManager() gMC->Gdtom(center,hits,1); hits[3] = destep*1e9; //Number in eV - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } } diff --git a/PMD/AliPMDv1.cxx b/PMD/AliPMDv1.cxx index 20ccfc72e00..10109aac9d6 100644 --- a/PMD/AliPMDv1.cxx +++ b/PMD/AliPMDv1.cxx @@ -14,6 +14,9 @@ **************************************************************************/ /* $Log$ +Revision 1.29 2003/10/13 05:28:59 bnandi +gaspmd[2] value changed 0.25->7.0 because of overlap + Revision 1.28 2003/10/08 12:59:08 bnandi zpos is positive @@ -55,6 +58,7 @@ June 2003 #include "AliMagF.h" #include "Riostream.h" #include +#include "AliMC.h" static Int_t ncol_um1,ncol_um2, nrow_um1, nrow_um2; static Int_t kdet; @@ -887,7 +891,7 @@ void AliPMDv1::StepManager() gMC->Gdtom(center,hits,1); hits[3] = destep*1e9; //Number in eV - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } } diff --git a/PYTHIA6/AliGenPythia.cxx b/PYTHIA6/AliGenPythia.cxx index 549c6ca3066..22034acefa9 100644 --- a/PYTHIA6/AliGenPythia.cxx +++ b/PYTHIA6/AliGenPythia.cxx @@ -40,6 +40,7 @@ #include "AliRun.h" #include "AliStack.h" #include "AliRunLoader.h" +#include "AliMC.h" ClassImp(AliGenPythia) @@ -615,9 +616,9 @@ void AliGenPythia::AdjustWeights() // Adjust the weights after generation of all events // TParticle *part; - Int_t ntrack=gAlice->GetNtrack(); + Int_t ntrack=gAlice->GetMCApp()->GetNtrack(); for (Int_t i=0; iParticle(i); + part= gAlice->GetMCApp()->Particle(i); part->SetWeight(part->GetWeight()*fKineBias); } } diff --git a/RICH/AliRICH.cxx b/RICH/AliRICH.cxx index c76cec7b660..c05f260ea47 100644 --- a/RICH/AliRICH.cxx +++ b/RICH/AliRICH.cxx @@ -26,6 +26,8 @@ #include "AliRICHRecHit1D.h" #include #include +#include "AliMC.h" +#include ClassImp(AliRICHhit) //__________________________________________________________________________________________________ @@ -77,12 +79,12 @@ AliRICH::AliRICH(const char *name, const char *title) fpParam = new AliRICHParam; fChambers = 0; CreateChambers(); //AliDetector ctor deals with Hits and Digits (reset them to 0, does not create them) - fHits= 0; CreateHits(); gAlice->AddHitList(fHits); + fHits= 0; CreateHits(); gAlice->GetMCApp()->AddHitList(fHits); fSdigits= 0; fDigitsNew= 0; fClusters= 0; - fCerenkovs= 0; CreateCerenkovsOld(); gAlice->AddHitList(fCerenkovs); + fCerenkovs= 0; CreateCerenkovsOld(); gAlice->GetMCApp()->AddHitList(fCerenkovs); fSpecials= 0; CreateSpecialsOld(); fDchambers= 0; //CreateDigitsOld(); fRawClusters=0; //CreateRawClustersOld(); @@ -997,8 +999,8 @@ void AliRICH::GenerateFeedbacks(Int_t iChamber,Float_t eloss) for(j=0;j<3;j++) pol[j]=e1[j]*TMath::Sin(phi)+e2[j]*TMath::Cos(phi); gMC->Gdtom(pol, pol, 2); Int_t outputNtracksStored; - gAlice->PushTrack(1, //do not transport - gAlice->GetCurrentTrackNumber(),//parent track + gAlice->GetMCApp()->PushTrack(1, //do not transport + gAlice->GetMCApp()->GetCurrentTrackNumber(),//parent track kFeedback, //PID mom[0],mom[1],mom[2],mom[3], //track momentum x4.X(),x4.Y(),x4.Z(),x4.T(), //track origin diff --git a/RICH/AliRICH.h b/RICH/AliRICH.h index 698d0b3aca1..d3555226e70 100644 --- a/RICH/AliRICH.h +++ b/RICH/AliRICH.h @@ -236,8 +236,8 @@ public: AliRICHChamber* C(Int_t iC) const{return (AliRICHChamber*)fChambers->At(iC-1);} AliRICHParam* Param() const{return fpParam;} - AliRICHhit* FirstHit(Int_t iTrkN) {return (AliRICHhit*)AliDetector::FirstHit(iTrkN);} //virtual - AliRICHhit* NextHit() {return (AliRICHhit*)AliDetector::NextHit();} //virtual + // AliRICHhit* FirstHit(Int_t iTrkN) {return (AliRICHhit*)AliDetector::FirstHit(iTrkN);} //virtual + // AliRICHhit* NextHit() {return (AliRICHhit*)AliDetector::NextHit();} //virtual void CreateChambers(); void CreateMaterials(); //virtual diff --git a/RICH/AliRICHDisplay.cxx b/RICH/AliRICHDisplay.cxx index 38a953439d4..4d67d343524 100644 --- a/RICH/AliRICHDisplay.cxx +++ b/RICH/AliRICHDisplay.cxx @@ -64,6 +64,7 @@ #include "AliRICHDigit.h" #include "AliRICHRawCluster.h" #include "AliRICHRecHit1D.h" +#include "AliMC.h" ClassImp(AliRICHDisplay) @@ -611,7 +612,7 @@ void AliRICHDisplay::DrawTitle(Option_t *option) sprintf(ptitle,"Alice event: %d, Run:%d", gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun()); title->AddText(ptitle); - Int_t nparticles = gAlice->Particles()->GetEntriesFast(); + Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast(); sprintf(ptitle,"Nparticles = %d Nhits = %d Npads fired = %d", nparticles, fHitsCuts,fClustersCuts); title->AddText(ptitle); @@ -981,7 +982,7 @@ void AliRICHDisplay::LoadHits(Int_t chamber) points = new AliRICHPoints(1); fPhits->AddAt(points,npoints); mHit = (AliRICHhit*)pRICHhits->UncheckedAt(hit); - TParticle *current = (TParticle*)gAlice->Particle(mHit->Track()); + TParticle *current = (TParticle*)gAlice->GetMCApp()->Particle(mHit->Track()); if (current->GetPdgCode() == 50000050) { points->SetMarkerColor(kBlue); } else if (current->GetPdgCode() == 50000051) { diff --git a/RICH/AliRICHPoints.cxx b/RICH/AliRICHPoints.cxx index d902b392ac0..c095a5becf5 100644 --- a/RICH/AliRICHPoints.cxx +++ b/RICH/AliRICHPoints.cxx @@ -42,6 +42,7 @@ #include "AliRICHSDigit.h" #include "AliRICHDigit.h" #include "AliRICHRawCluster.h" +#include "AliMC.h" const Int_t kMaxNipx=400, kMaxNipy=800; @@ -139,8 +140,8 @@ TParticle *AliRICHPoints::GetParticle() const // // Returns pointer to particle index in AliRun::fParticles // - if (fIndex < 0 || fIndex >= gAlice->GetNtrack()) return 0; - return gAlice->Particle(fIndex); + if (fIndex < 0 || fIndex >= gAlice->GetMCApp()->GetNtrack()) return 0; + return gAlice->GetMCApp()->Particle(fIndex); } //_____________________________________________________________________________ @@ -251,7 +252,7 @@ void AliRICHPoints::ShowRing(Int_t highlight) { if (marker) marker->Draw(); } - TParticle *p = gAlice->Particle(fIndex); + TParticle *p = gAlice->GetMCApp()->Particle(fIndex); printf("\nTrack index %d\n",fTrackIndex); printf("Particle ID %d\n",p->GetPdgCode()); printf("Parent %d\n",p->GetFirstMother()); diff --git a/RICH/AliRICHResponseV0.cxx b/RICH/AliRICHResponseV0.cxx index 2acd070b9b9..9fe9f6fa5dc 100644 --- a/RICH/AliRICHResponseV0.cxx +++ b/RICH/AliRICHResponseV0.cxx @@ -23,6 +23,7 @@ #include "AliRICHResponseV0.h" #include "AliRun.h" #include "AliSegmentation.h" +#include "AliMC.h" //___________________________________________ ClassImp(AliRICHResponseV0) @@ -201,7 +202,7 @@ Int_t AliRICHResponseV0::FeedBackPhotons(Float_t *source, Float_t qtot) // Get weight of current particle TParticle *current = (TParticle*) - (*gAlice->Particles())[gAlice->GetCurrentTrackNumber()]; + (*gAlice->GetMCApp()->Particles())[gAlice->GetMCApp()->GetCurrentTrackNumber()]; ifeed = Int_t(current->GetWeight()/100+0.5); ipart = gMC->TrackPid(); @@ -291,7 +292,7 @@ Int_t AliRICHResponseV0::FeedBackPhotons(Float_t *source, Float_t qtot) // Put photon on the stack and label it as feedback (51, 52) ++sNfeed; - gAlice->PushTrack(Int_t(1), gAlice->GetCurrentTrackNumber(), Int_t(50000051), + gAlice->GetMCApp()->PushTrack(Int_t(1), gAlice->GetMCApp()->GetCurrentTrackNumber(), Int_t(50000051), mom[0],mom[1],mom[2],mom[3],source[0],source[1],source[2],position[3],pol[0],pol[1],pol[2], kPFeedBackPhoton, nt, 1.); diff --git a/RICH/AliRICHv0.cxx b/RICH/AliRICHv0.cxx index 73004e216aa..dc8e0b25a3b 100644 --- a/RICH/AliRICHv0.cxx +++ b/RICH/AliRICHv0.cxx @@ -19,6 +19,7 @@ #include "AliRICHConst.h" #include #include +#include "AliMC.h" ClassImp(AliRICHv0) @@ -45,7 +46,7 @@ void AliRICHv0::StepManager() Info("","event=%i hunt=%i tid=%i pid=%i(%s) m=%f q=%3.1f", gMC->CurrentEvent(), fIshunt, - gAlice->GetCurrentTrackNumber(), + gAlice->GetMCApp()->GetCurrentTrackNumber(), gMC->TrackPid(), sParticle, gMC->TrackMass(), diff --git a/RICH/AliRICHv1.cxx b/RICH/AliRICHv1.cxx index 9e9cb8b8340..6a2aa160d79 100644 --- a/RICH/AliRICHv1.cxx +++ b/RICH/AliRICHv1.cxx @@ -24,6 +24,7 @@ #include #include #include +#include ClassImp(AliRICHv1) //______________________________________________________________________________ @@ -59,7 +60,7 @@ void AliRICHv1::StepManager() static Float_t eloss, tlength; const Float_t kBig=1.e10; - TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->GetCurrentTrackNumber()]; + TParticle *current = (TParticle*)(*gAlice->GetMCApp()->Particles())[gAlice->GetMCApp()->GetCurrentTrackNumber()]; @@ -80,7 +81,7 @@ void AliRICHv1::StepManager() if(gMC->IsNewTrack()){//C+E+enter+FRE+new Int_t mother=current->GetFirstMother(); ckovData[10]=mother; - ckovData[11]=gAlice->GetCurrentTrackNumber(); + ckovData[11]=gAlice->GetMCApp()->GetCurrentTrackNumber(); ckovData[12]=1; //Media where photon was produced 1->Freon, 2->Quarz fCkovNumber++; fFreonProd=1; @@ -234,7 +235,7 @@ void AliRICHv1::StepManager() coscerenkov = 0; ckovData[18]=TMath::ACos(coscerenkov);//Cerenkov angle } - AddHit(gAlice->GetCurrentTrackNumber(),vol,ckovData);//PHOTON HIT CF+CSI+DE + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData);//PHOTON HIT CF+CSI+DE //AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData); }//CF+CSI+DE }//CF+CSI @@ -285,7 +286,7 @@ void AliRICHv1::StepManager() hits[8]= hits[8]+1; hits[9]= (Float_t) fNsdigits; } - AddHit(gAlice->GetCurrentTrackNumber(),vol,hits);//MIP HIT MIP+GAP+Exit + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);//MIP HIT MIP+GAP+Exit eloss = 0; }/*MIP+GAP+Exit*/else if(Param()->SigGenCond(localPos[0], localPos[2])){//MIP+GAP+Spec Param()->SigGenInit(localPos[0], localPos[2]); diff --git a/RICH/AliRICHv3.cxx b/RICH/AliRICHv3.cxx index 86cf48be370..8df30aedc67 100644 --- a/RICH/AliRICHv3.cxx +++ b/RICH/AliRICHv3.cxx @@ -41,6 +41,7 @@ #include "AliRICHRawCluster.h" #include "AliRICHDigit.h" #include "AliRICHRecHit1D.h" +#include "AliMC.h" ClassImp(AliRICHv3) @@ -112,7 +113,7 @@ void AliRICHv3::StepManager() const Float_t kBig=1.e10; TClonesArray &lhits = *fHits; - TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->GetCurrentTrackNumber()]; + TParticle *current = (TParticle*)(*gAlice->GetMCApp()->Particles())[gAlice->GetMCApp()->GetCurrentTrackNumber()]; //if (current->Energy()>1) //{ @@ -163,7 +164,7 @@ void AliRICHv3::StepManager() //printf("Second Mother:%d\n",current->GetSecondMother()); ckovData[10] = mother; - ckovData[11] = gAlice->GetCurrentTrackNumber(); + ckovData[11] = gAlice->GetMCApp()->GetCurrentTrackNumber(); ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz //printf("Produced in FREO\n"); fCkovNumber++; @@ -207,7 +208,7 @@ void AliRICHv3::StepManager() if (ranf[0] > t) { gMC->StopTrack(); ckovData[13] = 5; - AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData); + AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData); //printf("Added One (1)!\n"); //printf("Lost one in grid\n"); } @@ -237,7 +238,7 @@ void AliRICHv3::StepManager() if (ranf[0] < t) { gMC->StopTrack(); ckovData[13] = 6; - AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData); + AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData); //printf("Added One (2)!\n"); //printf("Lost by Fresnel\n"); @@ -285,7 +286,7 @@ void AliRICHv3::StepManager() ckovData[13]=16; } gMC->StopTrack(); - AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData); + AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData); //printf("Added One (3)!\n"); //printf("Added cerenkov %d\n",fCkovNumber); } //absorption question @@ -295,7 +296,7 @@ void AliRICHv3::StepManager() else if (procs[i] == kPStop) { //is it below energy treshold? ckovData[13]=21; gMC->StopTrack(); - AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData); + AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData); //printf("Added One (4)!\n"); } // energy treshold question } //number of mechanisms cycle @@ -421,8 +422,8 @@ void AliRICHv3::StepManager() } //if (sector != -1) //{ - AddHit(gAlice->GetCurrentTrackNumber(),vol,ckovData); - AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData); + AddCerenkov(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,ckovData); //printf("Added One (5)!\n"); //} } @@ -566,7 +567,7 @@ void AliRICHv3::StepManager() } //if(sector !=-1) - new(lhits[fNhits++]) AliRICHhit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); + new(lhits[fNhits++]) AliRICHhit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits); eloss = 0; // // Check additional signal generation conditions @@ -714,7 +715,7 @@ void AliRICHv3::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2) Float_t PTfinal; Float_t PTvertex; - TParticle *current = gAlice->Particle(index); + TParticle *current = gAlice->GetMCApp()->Particle(index); //Float_t energy=current->Energy(); diff --git a/START/AliSTART.cxx b/START/AliSTART.cxx index b4cdac59cec..151c362de5e 100755 --- a/START/AliSTART.cxx +++ b/START/AliSTART.cxx @@ -55,6 +55,7 @@ #include "AliSTARThit.h" #include "AliSTARThitPhoton.h" #include "AliSTARTvertex.h" +#include "AliMC.h" ClassImp(AliSTART) @@ -84,10 +85,10 @@ AliSTART::AliSTART(const char *name, const char *title) // // Initialise Hit array fHits = new TClonesArray("AliSTARThit", 405); - gAlice->AddHitList(fHits); + gAlice->GetMCApp()->AddHitList(fHits); fPhotons = new TClonesArray("AliSTARThitPhoton", 10000); - gAlice->AddHitList (fPhotons); + gAlice->GetMCApp()->AddHitList (fPhotons); fIshunt = 1; fIdSens = 0; diff --git a/START/AliSTARTv1.cxx b/START/AliSTARTv1.cxx index 6954df9e4f0..1ec55b2be23 100755 --- a/START/AliSTARTv1.cxx +++ b/START/AliSTARTv1.cxx @@ -41,6 +41,7 @@ #include "AliRun.h" #include "AliSTARThit.h" #include "AliSTARTv1.h" +#include "AliMC.h" ClassImp(AliSTARTv1) @@ -612,7 +613,7 @@ void AliSTARTv1::StepManager() Float_t de=gMC->Edep(); edep=edep+de; hits[3]=edep*1e3; - new(lhits[fNhits++]) AliSTARThit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); + new(lhits[fNhits++]) AliSTARThit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits); } } //--------------------------------------------------------------------- diff --git a/START/AliSTARTv2.cxx b/START/AliSTARTv2.cxx index 2188db9fb3d..39716f99882 100644 --- a/START/AliSTARTv2.cxx +++ b/START/AliSTARTv2.cxx @@ -45,6 +45,7 @@ #include "AliRun.h" #include "AliSTARThit.h" #include "AliSTARTv2.h" +#include "AliMC.h" //#include "AliSTARThitPhoton.h" //#include "TGeant3.h" @@ -372,7 +373,7 @@ void AliSTARTv2::StepManager() hitPhoton[4] = 1e9 * gMC->TrackTime(); hitPhoton[5] = 1e9 * gMC->Etot(); - AddHitPhoton (gAlice->GetCurrentTrackNumber(), vol, hitPhoton); + AddHitPhoton (gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hitPhoton); } gMC->StopTrack(); } @@ -436,7 +437,7 @@ void AliSTARTv2::StepManager() // printf(" HITS on START Exit %f\n",hits[i]); } //for (i=0; i<=1; i++) { printf("START vol %d\n",vol[i]);} - new(lhits[fNhits++]) AliSTARThit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); + new(lhits[fNhits++]) AliSTARThit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits); } } diff --git a/STEER/AliDetector.cxx b/STEER/AliDetector.cxx index bea7d3b91ab..7e90fda061f 100644 --- a/STEER/AliDetector.cxx +++ b/STEER/AliDetector.cxx @@ -48,6 +48,7 @@ #include "AliPoints.h" #include "AliLoader.h" #include "AliRun.h" +#include "AliMC.h" // Static variables for the hit iterator routines @@ -288,7 +289,7 @@ void AliDetector::LoadPoints(Int_t) // Error("LoadPoints","nhits == 0. Name is %s",GetName()); return; } - Int_t tracks = gAlice->GetNtrack(); + Int_t tracks = gAlice->GetMCApp()->GetNtrack(); if (fPoints == 0) fPoints = new TObjArray(tracks); AliHit *ahit; // diff --git a/STEER/AliDisplay.cxx b/STEER/AliDisplay.cxx index c6c876099f5..47fd86bafc9 100644 --- a/STEER/AliDisplay.cxx +++ b/STEER/AliDisplay.cxx @@ -45,6 +45,7 @@ #include "AliStack.h" #include "TGeometry.h" #include "TParticle.h" +#include "AliMC.h" static const Float_t kptcutmax = 2; static const Float_t ketacutmax = 1.5; @@ -369,7 +370,7 @@ void AliDisplay::ShowTrack(Int_t idx) // fPad->Modified(); // TClonesArray *particles=gAlice->Particles(); // TParticle *p = (TParticle*)particles->UncheckedAt(idx); - TParticle *p = gAlice->Particle(idx); + TParticle *p = gAlice->GetMCApp()->Particle(idx); printf("\nTrack index %d\n",idx); printf("Particle ID %d\n",p->GetPdgCode()); printf("Parent %d\n",p->GetFirstMother()); @@ -646,7 +647,7 @@ void AliDisplay::DrawTitle(Option_t *option) char ptitle[100]; sprintf(ptitle,"Alice event: %d, Run:%d",gAlice->GetHeader()->GetEvent(), gAlice->GetHeader()->GetRun()); title->AddText(ptitle); - Int_t nparticles = gAlice->Particles()->GetEntriesFast(); + Int_t nparticles = gAlice->GetMCApp()->Particles()->GetEntriesFast(); sprintf(ptitle,"Nparticles = %d Nhits = %d",nparticles, fHitsCuts); title->AddText(ptitle); } else { @@ -809,7 +810,7 @@ void AliDisplay::LoadPoints() gAlice->ResetPoints(); TIter next(gAlice->Modules()); AliModule *module; - Int_t ntracks = gAlice->GetNtrack(); + Int_t ntracks = gAlice->GetMCApp()->GetNtrack(); while((module = (AliModule*)next())) { @@ -825,14 +826,14 @@ void AliDisplay::LoadPoints() for (Int_t track=0; trackResetHits(); - Int_t nev = nprim-1-gAlice->GetPrimary(fTracksToDisplay[track]); + Int_t nev = nprim-1-gAlice->GetMCApp()->GetPrimary(fTracksToDisplay[track]); while((module = (AliModule*)next())) { AliDetector* detector = dynamic_cast(module); if(detector) { detector->TreeH()->GetEvent(nev); - module->LoadPoints(nprim-1-gAlice->GetPrimary(fTracksToDisplay[track])); + module->LoadPoints(nprim-1-gAlice->GetMCApp()->GetPrimary(fTracksToDisplay[track])); } } next.Reset(); diff --git a/STEER/AliGenerator.cxx b/STEER/AliGenerator.cxx index 654cfebd244..8a3887e5e41 100644 --- a/STEER/AliGenerator.cxx +++ b/STEER/AliGenerator.cxx @@ -41,6 +41,7 @@ #include "AliGenerator.h" #include "AliRun.h" #include "AliStack.h" +#include "AliMC.h" ClassImp(AliGenerator) @@ -80,7 +81,8 @@ AliGenerator::AliGenerator(): if (gAlice) { if (gAlice->GetDebug()>0) printf("\n AliGenerator Default Constructor\n\n"); - gAlice->SetGenerator(this); + AliMC * mc = gAlice->GetMCApp(); + if (mc) mc->SetGenerator(this); } SetThetaRange(); ResetBit(kThetaRange); @@ -136,7 +138,8 @@ AliGenerator::AliGenerator(Int_t npart): if (gAlice) { if (gAlice->GetDebug()>0) printf("\n AliGenerator Constructor initializing number of particles \n\n"); - gAlice->SetGenerator(this); + AliMC * mc = gAlice->GetMCApp(); + if (mc) mc->SetGenerator(this); } SetThetaRange(); ResetBit(kThetaRange); @@ -402,7 +405,7 @@ void AliGenerator::PushTrack(Int_t done, Int_t parent, Int_t pdg, fStack->PushTrack(done, parent, pdg, pmom, vpos, polar, tof, mech, ntr, weight, is); else - gAlice->PushTrack(done, parent, pdg, pmom, vpos, polar, tof, + gAlice->GetMCApp()->PushTrack(done, parent, pdg, pmom, vpos, polar, tof, mech, ntr, weight, is); } @@ -421,7 +424,7 @@ void AliGenerator::PushTrack(Int_t done, Int_t parent, Int_t pdg, fStack->PushTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof, polx, poly, polz, mech, ntr, weight, is); else - gAlice->PushTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof, + gAlice->GetMCApp()->PushTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof, polx, poly, polz, mech, ntr, weight, is); } @@ -435,7 +438,7 @@ void AliGenerator:: KeepTrack(Int_t itrack) if (fStack) fStack->KeepTrack(itrack); else - gAlice->KeepTrack(itrack); + gAlice->GetMCApp()->KeepTrack(itrack); } @@ -448,7 +451,7 @@ void AliGenerator:: SetHighWaterMark(Int_t nt) if (fStack) fStack->SetHighWaterMark(nt); else - gAlice->SetHighWaterMark(nt); + gAlice->GetMCApp()->SetHighWaterMark(nt); } void AliGenerator::FinishRun() diff --git a/STEER/AliHit.cxx b/STEER/AliHit.cxx index 9517767c630..02cb1ce1f6c 100644 --- a/STEER/AliHit.cxx +++ b/STEER/AliHit.cxx @@ -26,6 +26,7 @@ #include "AliHit.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliHit) @@ -52,8 +53,8 @@ AliHit::AliHit(Int_t shunt, Int_t track): // Standard constructor // if(shunt == 1) { - int primary = gAlice->GetPrimary(track); - gAlice->Particle(primary)->SetBit(kKeepBit); + int primary = gAlice->GetMCApp()->GetPrimary(track); + gAlice->GetMCApp()->Particle(primary)->SetBit(kKeepBit); fTrack=primary; } @@ -67,7 +68,7 @@ AliHit::AliHit(Int_t shunt, Int_t track): Int_t parent=track; while (1) { current=parent; - part = gAlice->Particle(current); + part = gAlice->GetMCApp()->Particle(current); parent=part->GetFirstMother(); if(parent<0 || part->TestBit(kKeepBit)) break; @@ -77,6 +78,6 @@ AliHit::AliHit(Int_t shunt, Int_t track): else { fTrack=track; - gAlice->FlagTrack(fTrack); + gAlice->GetMCApp()->FlagTrack(fTrack); } } diff --git a/STEER/AliLego.cxx b/STEER/AliLego.cxx index 4e848713178..5282b61ceff 100644 --- a/STEER/AliLego.cxx +++ b/STEER/AliLego.cxx @@ -49,12 +49,14 @@ #include "TH2.h" #include "TMath.h" #include "TString.h" +#include "TVirtualMC.h" #include "AliConst.h" #include "AliDebugVolume.h" #include "AliLego.h" #include "AliLegoGenerator.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliLego) @@ -220,7 +222,7 @@ void AliLego::BeginEvent() fStepsForward = 0; fStepsBackward = 0; fErrorCondition = 0; - if (gAlice->GetCurrentTrackNumber() == 0) fStepBack = 0; + if (gAlice->GetMCApp()->GetCurrentTrackNumber() == 0) fStepBack = 0; } } @@ -349,7 +351,7 @@ void AliLego::StepManager() orig[1] = vect[1]; orig[2] = vect[2]; - gAlice->PushTrack(1, gAlice->GetCurrentTrackNumber(), + gAlice->GetMCApp()->PushTrack(1, gAlice->GetMCApp()->GetCurrentTrackNumber(), 0, pmom, orig, polar, 0., kPNoProcess, ntr); } // debug diff --git a/STEER/AliLegoGenerator.cxx b/STEER/AliLegoGenerator.cxx index 9bb7a812921..3fd56ab3187 100644 --- a/STEER/AliLegoGenerator.cxx +++ b/STEER/AliLegoGenerator.cxx @@ -24,6 +24,7 @@ #include "AliLegoGenerator.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliLegoGenerator) @@ -125,7 +126,7 @@ void AliLegoGenerator::Generate() Float_t polar[3]={0.,0.,0.}; Int_t ntr; - gAlice->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr); + gAlice->GetMCApp()->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr); } diff --git a/STEER/AliLegoGeneratorEta.cxx b/STEER/AliLegoGeneratorEta.cxx index 4dc14891960..ca803d5a179 100644 --- a/STEER/AliLegoGeneratorEta.cxx +++ b/STEER/AliLegoGeneratorEta.cxx @@ -24,6 +24,7 @@ #include "AliLegoGeneratorEta.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliLegoGeneratorEta) @@ -81,6 +82,6 @@ void AliLegoGeneratorEta::Generate() Float_t polar[3]={0.,0.,0.}; Int_t ntr; - gAlice->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr); + gAlice->GetMCApp()->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr); } diff --git a/STEER/AliLegoGeneratorPhiZ.cxx b/STEER/AliLegoGeneratorPhiZ.cxx index 3c4be206e3d..e8ea0376b37 100644 --- a/STEER/AliLegoGeneratorPhiZ.cxx +++ b/STEER/AliLegoGeneratorPhiZ.cxx @@ -24,6 +24,7 @@ #include "AliLegoGeneratorPhiZ.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliLegoGeneratorPhiZ) @@ -78,6 +79,6 @@ void AliLegoGeneratorPhiZ::Generate() Float_t polar[3]={0.,0.,0.}; Int_t ntr; - gAlice->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr); + gAlice->GetMCApp()->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr); } diff --git a/STEER/AliLegoGeneratorXYZ.cxx b/STEER/AliLegoGeneratorXYZ.cxx index 80da3022687..740c56c0920 100644 --- a/STEER/AliLegoGeneratorXYZ.cxx +++ b/STEER/AliLegoGeneratorXYZ.cxx @@ -24,6 +24,7 @@ #include "AliLegoGeneratorXYZ.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliLegoGeneratorXYZ) @@ -128,7 +129,7 @@ void AliLegoGeneratorXYZ::Generate() Float_t polar[3]={0.,0.,0.}; Int_t ntr; - gAlice->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr); + gAlice->GetMCApp()->PushTrack(1, -1, kMpart, pmom, orig, polar, 0, kPPrimary, ntr); } diff --git a/STEER/AliMC.cxx b/STEER/AliMC.cxx new file mode 100644 index 00000000000..c331790b287 --- /dev/null +++ b/STEER/AliMC.cxx @@ -0,0 +1,982 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +#include +#include +#include +#include + +#include "AliDetector.h" +#include "AliGenerator.h" +#include "AliHeader.h" +#include "AliLego.h" +#include "AliMC.h" +#include "AliMCQA.h" +#include "AliRun.h" +#include "AliStack.h" +#include "AliTrackReference.h" + + +ClassImp(AliMC) + +//_______________________________________________________________________ +AliMC::AliMC() : + fGenerator(0), + fEventEnergy(0), + fSummEnergy(0), + fSum2Energy(0), + fTrRmax(1.e10), + fTrZmax(1.e10), + fImedia(0), + fTransParName("\0"), + fMCQA(0), + fHitLists(0), + fTrackReferences(0) + +{ +} + +//_______________________________________________________________________ +AliMC::AliMC(const char *name, const char *title) : + TVirtualMCApplication(name, title), + fGenerator(0), + fEventEnergy(0), + fSummEnergy(0), + fSum2Energy(0), + fTrRmax(1.e10), + fTrZmax(1.e10), + fImedia(new TArrayI(1000)), + fTransParName("\0"), + fMCQA(0), + fHitLists(new TList()), + fTrackReferences(new TClonesArray("AliTrackReference", 100)) +{ + + // Set transport parameters + SetTransPar(); + + // Prepare the tracking medium lists + for(Int_t i=0;i<1000;i++) (*fImedia)[i]=-99; + +} + +//_______________________________________________________________________ +AliMC::AliMC(const AliMC &mc) : + TVirtualMCApplication(mc), + fGenerator(0), + fEventEnergy(0), + fSummEnergy(0), + fSum2Energy(0), + fTrRmax(1.e10), + fTrZmax(1.e10), + fImedia(0), + fTransParName("\0"), + fMCQA(0), + fHitLists(0), + fTrackReferences(0) +{ + // + // Copy constructor for AliRun + // + mc.Copy(*this); +} + +//_______________________________________________________________________ +AliMC::~AliMC() +{ + delete fGenerator; + delete fImedia; + delete fMCQA; + delete fHitLists; + // Delete track references + if (fTrackReferences) { + fTrackReferences->Delete(); + delete fTrackReferences; + fTrackReferences = 0; + } + +} + +//_______________________________________________________________________ +void AliMC::Copy(AliMC &) const +{ + Fatal("Copy","Not implemented!\n"); +} + +//_______________________________________________________________________ +void AliMC::ConstructGeometry() +{ + // + // Create modules, materials, geometry + // + + TStopwatch stw; + TIter next(gAlice->Modules()); + AliModule *detector; + if (GetDebug()) Info("ConstructGeometry","Geometry creation:"); + while((detector = dynamic_cast(next()))) { + stw.Start(); + // Initialise detector materials and geometry + detector->CreateMaterials(); + detector->CreateGeometry(); + printf("%10s R:%.2fs C:%.2fs\n", + detector->GetName(),stw.RealTime(),stw.CpuTime()); + } +} + +//_______________________________________________________________________ +void AliMC::InitGeometry() +{ + // + // Initialize detectors and display geometry + // + + printf("Initialisation:\n"); + TStopwatch stw; + TIter next(gAlice->Modules()); + AliModule *detector; + while((detector = dynamic_cast(next()))) { + stw.Start(); + // Initialise detector and display geometry + detector->Init(); + detector->BuildGeometry(); + printf("%10s R:%.2fs C:%.2fs\n", + detector->GetName(),stw.RealTime(),stw.CpuTime()); + } + +} + +//_______________________________________________________________________ +void AliMC::GeneratePrimaries() +{ + // + // Generate primary particles and fill them in the stack. + // + + Generator()->Generate(); +} + +//_______________________________________________________________________ +void AliMC::SetGenerator(AliGenerator *generator) +{ + // + // Load the event generator + // + if(!fGenerator) fGenerator = generator; +} + +//_______________________________________________________________________ +void AliMC::ResetGenerator(AliGenerator *generator) +{ + // + // Load the event generator + // + if(fGenerator) + if(generator) + Warning("ResetGenerator","Replacing generator %s with %s\n", + fGenerator->GetName(),generator->GetName()); + else + Warning("ResetGenerator","Replacing generator %s with NULL\n", + fGenerator->GetName()); + fGenerator = generator; +} + +//_______________________________________________________________________ +void AliMC::FinishRun() +{ + // Clean generator information + if (GetDebug()) Info("FinishRun"," fGenerator->FinishRun()"); + fGenerator->FinishRun(); + + //Output energy summary tables + if (GetDebug()) Info("FinishRun"," EnergySummary()"); + EnergySummary(); + +} + +//_______________________________________________________________________ +void AliMC::BeginPrimary() +{ + // + // Called at the beginning of each primary track + // + + // Reset Hits info + ResetHits(); + ResetTrackReferences(); + +} + +//_______________________________________________________________________ +void AliMC::PreTrack() +{ + TObjArray &dets = *gAlice->Modules(); + AliModule *module; + + for(Int_t i=0; i<=gAlice->GetNdets(); i++) + if((module = dynamic_cast(dets[i]))) + module->PreTrack(); + + fMCQA->PreTrack(); +} + +//_______________________________________________________________________ +void AliMC::Stepping() +{ + // + // Called at every step during transport + // + + Int_t id = DetFromMate(gMC->GetMedium()); + if (id < 0) return; + + // + // --- If lego option, do it and leave + if (gAlice->Lego()) + gAlice->Lego()->StepManager(); + else { + Int_t copy; + //Update energy deposition tables + AddEnergyDeposit(gMC->CurrentVolID(copy),gMC->Edep()); + + //Call the appropriate stepping routine; + AliModule *det = dynamic_cast(gAlice->Modules()->At(id)); + if(det && det->StepManagerIsEnabled()) { + fMCQA->StepManager(id); + det->StepManager(); + } + } +} + +//_______________________________________________________________________ +void AliMC::EnergySummary() +{ + // + // Print summary of deposited energy + // + + Int_t ndep=0; + Float_t edtot=0; + Float_t ed, ed2; + Int_t kn, i, left, j, id; + const Float_t kzero=0; + Int_t ievent=gAlice->GetRunLoader()->GetHeader()->GetEvent()+1; + // + // Energy loss information + if(ievent) { + printf("***************** Energy Loss Information per event (GEV) *****************\n"); + for(kn=1;kn0) { + fEventEnergy[ndep]=kn; + if(ievent>1) { + ed=ed/ievent; + ed2=fSum2Energy[kn]; + ed2=ed2/ievent; + ed2=100*TMath::Sqrt(TMath::Max(ed2-ed*ed,kzero))/ed; + } else + ed2=99; + fSummEnergy[ndep]=ed; + fSum2Energy[ndep]=TMath::Min(static_cast(99.),TMath::Max(ed2,kzero)); + edtot+=ed; + ndep++; + } + } + for(kn=0;kn<(ndep-1)/3+1;kn++) { + left=ndep-kn*3; + for(i=0;i<(3VolName(id),fSummEnergy[j],fSum2Energy[j]); + } + printf("\n"); + } + // + // Relative energy loss in different detectors + printf("******************** Relative Energy Loss per event ********************\n"); + printf("Total energy loss per event %10.3f GeV\n",edtot); + for(kn=0;kn<(ndep-1)/5+1;kn++) { + left=ndep-kn*5; + for(i=0;i<(5VolName(id),100*fSummEnergy[j]/edtot); + } + printf("\n"); + } + for(kn=0;kn<75;kn++) printf("*"); + printf("\n"); + } + // + // Reset the TArray's + // fEventEnergy.Set(0); + // fSummEnergy.Set(0); + // fSum2Energy.Set(0); +} + +//_____________________________________________________________________________ +void AliMC::BeginEvent() +{ + // + // Clean-up previous event + // Energy scores + if (GetDebug()) + { + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("BeginEvent"," BEGINNING EVENT "); + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + } + + AliRunLoader *runloader=gAlice->GetRunLoader(); + + /*******************************/ + /* Clean after eventual */ + /* previous event */ + /*******************************/ + + + //Set the next event in Run Loader -> Cleans trees (TreeK and all trees in detectors), + gAlice->SetEventNrInRun(gAlice->GetEventNrInRun()+1); + runloader->SetEventNumber(gAlice->GetEventNrInRun());// sets new files, cleans the previous event stuff, if necessary, etc., + if (GetDebug()) Info("BeginEvent","EventNr is %d",gAlice->GetEventNrInRun()); + + fEventEnergy.Reset(); + // Clean detector information + + if (runloader->Stack()) + runloader->Stack()->Reset();//clean stack -> tree is unloaded + else + runloader->MakeStack();//or make a new one + + if (GetDebug()) Info("BeginEvent"," fRunLoader->MakeTree(K)"); + runloader->MakeTree("K"); + if (GetDebug()) Info("BeginEvent"," gMC->SetStack(fRunLoader->Stack())"); + gMC->SetStack(gAlice->GetRunLoader()->Stack());//Was in InitMC - but was moved here + //because we don't have guarantee that + //stack pointer is not going to change from event to event + //since it bellobgs to header and is obtained via RunLoader + // + // Reset all Detectors & kinematics & make/reset trees + // + + runloader->GetHeader()->Reset(gAlice->GetRunNumber(),gAlice->GetEvNumber(), + gAlice->GetEventNrInRun()); +// fRunLoader->WriteKinematics("OVERWRITE"); is there any reason to rewrite here since MakeTree does so + + if (GetDebug()) Info("BeginEvent"," fRunLoader->MakeTrackRefsContainer()"); + runloader->MakeTrackRefsContainer();//for insurance + + if (GetDebug()) Info("BeginEvent"," ResetHits()"); + ResetHits(); + if (GetDebug()) Info("BeginEvent"," fRunLoader->MakeTree(H)"); + runloader->MakeTree("H"); + + // + if(gAlice->Lego()) + { + gAlice->Lego()->BeginEvent(); + return; + } + + //create new branches and SetAdresses + TIter next(gAlice->Modules()); + AliModule *detector; + while((detector = (AliModule*)next())) + { + if (GetDebug()) Info("BeginEvent"," %s->MakeBranch(H)",detector->GetName()); + detector->MakeBranch("H"); + if (GetDebug()) Info("BeginEvent"," %s->MakeBranchTR()",detector->GetName()); + detector->MakeBranchTR(); + if (GetDebug()) Info("BeginEvent"," %s->SetTreeAddress()",detector->GetName()); + detector->SetTreeAddress(); + } +} + +//_______________________________________________________________________ +void AliMC::ResetHits() +{ + // + // Reset all Detectors hits + // + TIter next(gAlice->Modules()); + AliModule *detector; + while((detector = dynamic_cast(next()))) { + detector->ResetHits(); + } +} + +//_______________________________________________________________________ +void AliMC::PostTrack() +{ + TObjArray &dets = *gAlice->Modules(); + AliModule *module; + + for(Int_t i=0; i<=gAlice->GetNdets(); i++) + if((module = dynamic_cast(dets[i]))) + module->PostTrack(); +} + +//_______________________________________________________________________ +void AliMC::FinishPrimary() +{ + // + // Called at the end of each primary track + // + AliRunLoader *runloader=gAlice->GetRunLoader(); + // static Int_t count=0; + // const Int_t times=10; + // This primary is finished, purify stack + runloader->Stack()->PurifyKine(); + + TIter next(gAlice->Modules()); + AliModule *detector; + while((detector = dynamic_cast(next()))) { + detector->FinishPrimary(); + if(detector->GetLoader()) + detector->GetLoader()->TreeH()->Fill(); + } + + // Write out track references if any + if (runloader->TreeTR()) runloader->TreeTR()->Fill(); +} + +//_______________________________________________________________________ +void AliMC::FinishEvent() +{ + // + // Called at the end of the event. + // + + // + if(gAlice->Lego()) gAlice->Lego()->FinishEvent(); + + TIter next(gAlice->Modules()); + AliModule *detector; + while((detector = dynamic_cast(next()))) { + detector->FinishEvent(); + } + + //Update the energy deposit tables + Int_t i; + for(i=0;iGetRunLoader(); + + AliHeader* header = runloader->GetHeader(); + AliStack* stack = runloader->Stack(); + if ( (header == 0x0) || (stack == 0x0) ) + {//check if we got header and stack. If not cry and exit aliroot + Fatal("AliRun","Can not get the stack or header from LOADER"); + return;//never reached + } + // Update Header information + header->SetNprimary(stack->GetNprimary()); + header->SetNtrack(stack->GetNtrack()); + + + // Write out the kinematics + stack->FinishEvent(); + + // Write out the event Header information + TTree* treeE = runloader->TreeE(); + if (treeE) + { + header->SetStack(stack); + treeE->Fill(); + } + else + { + Error("FinishEvent","Can not get TreeE from RL"); + } + + runloader->WriteKinematics("OVERWRITE"); + runloader->WriteTrackRefs("OVERWRITE"); + runloader->WriteHits("OVERWRITE"); + + if (GetDebug()) + { + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + Info("FinishEvent"," FINISHING EVENT "); + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); + } +} + +//_______________________________________________________________________ +void AliMC::Field(const Double_t* x, Double_t* b) const +{ + gAlice->Field(x,b); +} + +//_______________________________________________________________________ +void AliMC::Init() +{ + + //=================Create Materials and geometry + gMC->Init(); + gMC->DefineParticles(); //Create standard MC particles + + //Read the cuts for all materials + ReadTransPar(); + //Build the special IMEDIA table + MediaTable(); + + //Compute cross-sections + gMC->BuildPhysics(); + + //Write Geometry object to current file. + gAlice->GetRunLoader()->WriteGeometry(); + + //Initialise geometry deposition table + fEventEnergy.Set(gMC->NofVolumes()+1); + fSummEnergy.Set(gMC->NofVolumes()+1); + fSum2Energy.Set(gMC->NofVolumes()+1); + + // + fMCQA = new AliMCQA(gAlice->GetNdets()); + + // Register MC in configuration + AliConfig::Instance()->Add(gMC); + +} + +//_______________________________________________________________________ +void AliMC::MediaTable() +{ + // + // Built media table to get from the media number to + // the detector id + // + + Int_t kz, nz, idt, lz, i, k, ind; + // Int_t ibeg; + TObjArray &dets = *gAlice->Detectors(); + AliModule *det; + Int_t ndets=gAlice->GetNdets(); + // + // For all detectors + for (kz=0;kz(dets[kz]))) { + TArrayI &idtmed = *(det->GetIdtmed()); + for(nz=0;nz<100;nz++) { + // Find max and min material number + if((idt=idtmed[nz])) { + det->LoMedium() = det->LoMedium() < idt ? det->LoMedium() : idt; + det->HiMedium() = det->HiMedium() > idt ? det->HiMedium() : idt; + } + } + if(det->LoMedium() > det->HiMedium()) { + det->LoMedium() = 0; + det->HiMedium() = 0; + } else { + if(det->HiMedium() > fImedia->GetSize()) { + Error("MediaTable","Increase fImedia from %d to %d", + fImedia->GetSize(),det->HiMedium()); + return; + } + // Tag all materials in rage as belonging to detector kz + for(lz=det->LoMedium(); lz<= det->HiMedium(); lz++) { + (*fImedia)[lz]=kz; + } + } + } + } + // + // Print summary table + printf(" Traking media ranges:\n"); + for(i=0;i<(ndets-1)/6+1;i++) { + for(k=0;k< (6(dets[ind]); + if(det) + printf(" %6s: %3d -> %3d;",det->GetName(),det->LoMedium(), + det->HiMedium()); + else + printf(" %6s: %3d -> %3d;","NULL",0,0); + } + printf("\n"); + } +} + +//_______________________________________________________________________ +void AliMC::ReadTransPar() +{ + // + // Read filename to set the transport parameters + // + + + const Int_t kncuts=10; + const Int_t knflags=11; + const Int_t knpars=kncuts+knflags; + const char kpars[knpars][7] = {"CUTGAM" ,"CUTELE","CUTNEU","CUTHAD","CUTMUO", + "BCUTE","BCUTM","DCUTE","DCUTM","PPCUTM","ANNI", + "BREM","COMP","DCAY","DRAY","HADR","LOSS", + "MULS","PAIR","PHOT","RAYL"}; + char line[256]; + char detName[7]; + char* filtmp; + Float_t cut[kncuts]; + Int_t flag[knflags]; + Int_t i, itmed, iret, ktmed, kz; + FILE *lun; + // + // See whether the file is there + filtmp=gSystem->ExpandPathName(fTransParName.Data()); + lun=fopen(filtmp,"r"); + delete [] filtmp; + if(!lun) { + Warning("ReadTransPar","File %s does not exist!\n",fTransParName.Data()); + return; + } + // + if(fDebug) { + printf(" "); for(i=0;i<60;i++) printf("*"); printf("\n"); + printf(" *%59s\n","*"); + printf(" * Please check carefully what you are doing!%10s\n","*"); + printf(" *%59s\n","*"); + } + // + while(1) { + // Initialise cuts and flags + for(i=0;iGetModule(detName); + if(mod) { + // Get the array of media numbers + TArrayI &idtmed = *mod->GetIdtmed(); + // Check that the tracking medium code is valid + if(0<=itmed && itmed < 100) { + ktmed=idtmed[itmed]; + if(!ktmed) { + Warning("ReadTransPar","Invalid tracking medium code %d for %s\n",itmed,mod->GetName()); + continue; + } + // Set energy thresholds + for(kz=0;kz=0) { + if(fDebug) printf(" * %-6s set to %10.3E for tracking medium code %4d for %s\n", + kpars[kz],cut[kz],itmed,mod->GetName()); + gMC->Gstpar(ktmed,kpars[kz],cut[kz]); + } + } + // Set transport mechanisms + for(kz=0;kz=0) { + if(fDebug) printf(" * %-6s set to %10d for tracking medium code %4d for %s\n", + kpars[kncuts+kz],flag[kz],itmed,mod->GetName()); + gMC->Gstpar(ktmed,kpars[kncuts+kz],Float_t(flag[kz])); + } + } + } else { + Warning("ReadTransPar","Invalid medium code %d *\n",itmed); + continue; + } + } else { + if(fDebug) printf("%s::ReadTransParModule: %s not present\n",ClassName(),detName); + continue; + } + } +} + +//_______________________________________________________________________ +void AliMC::SetTransPar(const char *filename) +{ + // + // Sets the file name for transport parameters + // + fTransParName = filename; +} + +//_______________________________________________________________________ +void AliMC::Browse(TBrowser *b) +{ + // + // Called when the item "Run" is clicked on the left pane + // of the Root browser. + // It displays the Root Trees and all detectors. + // + //detectors are in folders anyway + b->Add(fMCQA,"AliMCQA"); +} + +//PH +//_______________________________________________________________________ +void AliMC::AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const +{ + // + // Add a hit to detector id + // + TObjArray &dets = *gAlice->Modules(); + if(dets[id]) dynamic_cast(dets[id])->AddHit(track,vol,hits); +} + +//_______________________________________________________________________ +void AliMC::AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const +{ + // + // Add digit to detector id + // + TObjArray &dets = *gAlice->Modules(); + if(dets[id]) dynamic_cast(dets[id])->AddDigit(tracks,digits); +} + +//_______________________________________________________________________ +Int_t AliMC::GetCurrentTrackNumber() const { + // + // Returns current track + // + return gAlice->GetRunLoader()->Stack()->GetCurrentTrackNumber(); +} + +//_______________________________________________________________________ +void AliMC::DumpPart (Int_t i) const +{ + // + // Dumps particle i in the stack + // + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader->Stack()) + runloader->Stack()->DumpPart(i); +} + +//_______________________________________________________________________ +void AliMC::DumpPStack () const +{ + // + // Dumps the particle stack + // + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader->Stack()) + runloader->Stack()->DumpPStack(); +} + +//_______________________________________________________________________ +Int_t AliMC::GetNtrack() const { + // + // Returns number of tracks in stack + // + Int_t ntracks = -1; + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader->Stack()) + ntracks = runloader->Stack()->GetNtrack(); + return ntracks; +} + +//_______________________________________________________________________ +Int_t AliMC::GetPrimary(Int_t track) const +{ + // + // return number of primary that has generated track + // + Int_t nprimary = -999; + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader->Stack()) + nprimary = runloader->Stack()->GetPrimary(track); + return nprimary; +} + +//_______________________________________________________________________ +TParticle* AliMC::Particle(Int_t i) const +{ + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader) + if (runloader->Stack()) + return runloader->Stack()->Particle(i); + return 0x0; +} + +//_______________________________________________________________________ +TObjArray* AliMC::Particles() const { + // + // Returns pointer to Particles array + // + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader) + if (runloader->Stack()) + return runloader->Stack()->Particles(); + return 0x0; +} + +//_______________________________________________________________________ +void AliMC::PushTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom, + Float_t *vpos, Float_t *polar, Float_t tof, + TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) +{ +// Delegate to stack +// + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader) + if (runloader->Stack()) + runloader->Stack()->PushTrack(done, parent, pdg, pmom, vpos, polar, tof, + mech, ntr, weight, is); +} + +//_______________________________________________________________________ +void AliMC::PushTrack(Int_t done, Int_t parent, Int_t pdg, + Double_t px, Double_t py, Double_t pz, Double_t e, + Double_t vx, Double_t vy, Double_t vz, Double_t tof, + Double_t polx, Double_t poly, Double_t polz, + TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) +{ + // Delegate to stack + // + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader) + if (runloader->Stack()) + runloader->Stack()->PushTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof, + polx, poly, polz, mech, ntr, weight, is); +} + +//_______________________________________________________________________ +void AliMC::SetHighWaterMark(const Int_t nt) +{ + // + // Set high water mark for last track in event + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader) + if (runloader->Stack()) + runloader->Stack()->SetHighWaterMark(nt); +} + +//_______________________________________________________________________ +void AliMC::KeepTrack(const Int_t track) +{ + // + // Delegate to stack + // + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader) + if (runloader->Stack()) + runloader->Stack()->KeepTrack(track); +} + +//_______________________________________________________________________ +void AliMC::FlagTrack(Int_t track) +{ + // Delegate to stack + // + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader) + if (runloader->Stack()) + runloader->Stack()->FlagTrack(track); +} + +//_______________________________________________________________________ +void AliMC::SetCurrentTrack(Int_t track) +{ + // + // Set current track number + // + AliRunLoader * runloader = gAlice->GetRunLoader(); + if (runloader) + if (runloader->Stack()) + runloader->Stack()->SetCurrentTrack(track); +} + +//_______________________________________________________________________ +void AliMC::AddTrackReference(Int_t label){ + // + // add a trackrefernce to the list + if (!fTrackReferences) { + cerr<<"Container trackrefernce not active\n"; + return; + } + Int_t nref = fTrackReferences->GetEntriesFast(); + TClonesArray &lref = *fTrackReferences; + new(lref[nref]) AliTrackReference(label); +} + + + +//_______________________________________________________________________ +void AliMC::ResetTrackReferences() +{ + // + // Reset all references + // + if (fTrackReferences) fTrackReferences->Clear(); + + TIter next(gAlice->Modules()); + AliModule *detector; + while((detector = dynamic_cast(next()))) { + detector->ResetTrackReferences(); + } +} + +void AliMC::RemapTrackReferencesIDs(Int_t *map) +{ + // + // Remapping track reference + // Called at finish primary + // + if (!fTrackReferences) return; + for (Int_t i=0;iGetEntries();i++){ + AliTrackReference * ref = dynamic_cast(fTrackReferences->UncheckedAt(i)); + if (ref) { + Int_t newID = map[ref->GetTrack()]; + if (newID>=0) ref->SetTrack(newID); + else { + //ref->SetTrack(-1); + ref->SetBit(kNotDeleted,kFALSE); + fTrackReferences->RemoveAt(i); + } + } + } + fTrackReferences->Compress(); +} diff --git a/STEER/AliMC.h b/STEER/AliMC.h new file mode 100644 index 00000000000..92818143f6f --- /dev/null +++ b/STEER/AliMC.h @@ -0,0 +1,119 @@ +#ifndef ALIMC_H +#define ALIMC_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include +#include +#include + +class AliGenerator; +class AliMCQA; + +class AliMC : public TVirtualMCApplication { +public: + AliMC(); + AliMC(const char *name, const char *title); + AliMC(const AliMC &mc); + virtual ~AliMC(); + + AliMC operator = (const AliMC &mc) + {mc.Copy(*this); return *this;} + +// +// MC Application +// + virtual void ConstructGeometry(); + virtual void InitGeometry(); + virtual void GeneratePrimaries(); + virtual void BeginEvent(); + virtual void BeginPrimary(); + virtual void PreTrack(); + virtual void Stepping(); + virtual void PostTrack(); + virtual void FinishPrimary(); + virtual void FinishEvent(); + virtual Double_t TrackingZmax() const {return fTrZmax;} + virtual Double_t TrackingRmax() const {return fTrRmax;} + virtual void Field(const Double_t* x, Double_t* b) const; + virtual Int_t DetFromMate(Int_t i) const { return (*fImedia)[i];} +// + + virtual AliGenerator* Generator() const {return fGenerator;} + virtual void SetGenerator(AliGenerator *generator); + virtual void ResetGenerator(AliGenerator *generator); + +// + virtual void ReadTransPar(); + virtual void MediaTable(); + virtual void EnergySummary(); + virtual void FinishRun(); + void AddEnergyDeposit(Int_t id, Float_t edep) + {fEventEnergy[id]+=edep;} + virtual void ResetHits(); + virtual void TrackingLimits( Float_t rmax=1.e10, Float_t zmax=1.e10) + {fTrRmax=rmax; fTrZmax=zmax;} + Int_t GetDebug() const {return fDebug;} + virtual void SetDebug(const Int_t level=0) {fDebug = level;} + virtual void Init(); + virtual void SetTransPar(const char *filename="$(ALICE_ROOT)/data/galice.cuts"); + virtual void Browse(TBrowser *b); + AliMCQA *GetMCQA() const {return fMCQA;} + //PH + virtual void AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const; + virtual void AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const; + virtual void AddHitList(TCollection *hitList) {fHitLists->Add(hitList);} + Int_t GetCurrentTrackNumber() const; + virtual void DumpPart (Int_t i) const; + virtual void DumpPStack () const; + TList* GetHitLists() const {return fHitLists ;} + Int_t GetNtrack() const; + virtual Int_t GetPrimary(Int_t track) const; + TObjArray *Particles() const; + TParticle *Particle(Int_t i) const; + virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg, + Float_t *pmom, Float_t *vpos, Float_t *polar, + Float_t tof, TMCProcess mech, Int_t &ntr, + Float_t weight = 1, Int_t is = 0); + virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg, + Double_t px, Double_t py, Double_t pz, Double_t e, + Double_t vx, Double_t vy, Double_t vz, Double_t tof, + Double_t polx, Double_t poly, Double_t polz, + TMCProcess mech, Int_t &ntr, Float_t weight=1, + Int_t is = 0); + virtual void SetHighWaterMark(const Int_t nt); + + virtual void KeepTrack(const Int_t itra); + virtual void FlagTrack(Int_t track); + virtual void SetCurrentTrack(Int_t track); +// Track reference related + virtual void AddTrackReference(Int_t label); + TClonesArray *TrackReferences() const {return fTrackReferences;} + virtual void RemapTrackReferencesIDs(Int_t *map); //remaping track references MI + virtual void ResetTrackReferences(); + + + +private: + void Copy (AliMC &mc) const; + AliGenerator *fGenerator; // Generator used in the MC + TArrayF fEventEnergy; //! Energy deposit for current event + TArrayF fSummEnergy; //! Energy per event in each volume + TArrayF fSum2Energy; //! Energy squared per event in each volume + Float_t fTrRmax; // Maximum radius for tracking + Float_t fTrZmax; // Maximu z for tracking + Int_t fDebug; // Debug flag + TArrayI *fImedia; //! Array of correspondence between media and detectors + TString fTransParName; // Name of the transport parameters file + AliMCQA *fMCQA; // Pointer to MC Quality assurance class + //PH + TList *fHitLists; //! Lists of hits to be remapped by PurifyKine + TClonesArray *fTrackReferences; //!list of track references - for one primary track only -MI + + ClassDef(AliMC,1) +}; + + +#endif diff --git a/STEER/AliMCQA.cxx b/STEER/AliMCQA.cxx index 79886abde6d..68789c7823c 100644 --- a/STEER/AliMCQA.cxx +++ b/STEER/AliMCQA.cxx @@ -37,10 +37,12 @@ #include #include #include +#include #include "AliMCQA.h" #include "AliModule.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliMCQA) @@ -147,9 +149,10 @@ AliMCQA::AliMCQA(Int_t ndets): // // Build list of volume names // + AliMC * mc = gAlice->GetMCApp(); for(i=0;i - ((*gAlice->Modules())[gAlice->DetFromMate(gMC->VolId2Mate(i+1))]); + ((*gAlice->Modules())[mc->DetFromMate(gMC->VolId2Mate(i+1))]); (*fVolNames)[i]=new TNamed(gMC->VolName(i+1),mod->GetName()); } diff --git a/STEER/AliModule.cxx b/STEER/AliModule.cxx index 3e90897ad73..edd106e62bb 100644 --- a/STEER/AliModule.cxx +++ b/STEER/AliModule.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include "AliConfig.h" #include "AliLoader.h" @@ -46,6 +47,7 @@ #include "AliModule.h" #include "AliRun.h" #include "AliTrackReference.h" +#include "AliMC.h" ClassImp(AliModule) @@ -699,7 +701,7 @@ AliTrackReference* AliModule::FirstTrackReference(Int_t track) { AliRunLoader* rl = AliRunLoader::GetRunLoader(); - rl->GetAliRun()->ResetTrackReferences(); + rl->GetAliRun()->GetMCApp()->ResetTrackReferences(); rl->TreeTR()->GetEvent(track); if (rl == 0x0) Fatal("FirstTrackReference","AliRunLoader not initialized. Can not proceed"); diff --git a/STEER/AliPoints.cxx b/STEER/AliPoints.cxx index 42124931f4b..358986f8c79 100644 --- a/STEER/AliPoints.cxx +++ b/STEER/AliPoints.cxx @@ -35,6 +35,7 @@ #include "AliDetector.h" #include "AliPoints.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliPoints) @@ -174,8 +175,8 @@ TParticle *AliPoints::GetParticle() const // // Returns pointer to particle index in AliRun::fParticles // - if (fIndex < 0 || fIndex >= gAlice->GetNtrack()) return 0; - else return gAlice->Particle(fIndex); + if (fIndex < 0 || fIndex >= gAlice->GetMCApp()->GetNtrack()) return 0; + else return gAlice->GetMCApp()->Particle(fIndex); } //_______________________________________________________________________ @@ -200,7 +201,7 @@ void AliPoints::Propagate() // TIter next(gAlice->Detectors()); AliDetector *detector; - while((detector = dynamic_cast(next()))) { + while((detector = (AliDetector*)(next()))) { if (!detector->IsActive()) continue; points = detector->Points(); if (!points) continue; diff --git a/STEER/AliRun.cxx b/STEER/AliRun.cxx index 053126ffa13..fe45e36d5d9 100644 --- a/STEER/AliRun.cxx +++ b/STEER/AliRun.cxx @@ -40,50 +40,33 @@ // // /////////////////////////////////////////////////////////////////////////////// -#include -#include -#include -#include - #include -#include #include -#include -#include +#include #include -#include #include -#include -#include #include -#include #include #include -#include +#include #include - -#include "AliConfig.h" +// #include "AliDetector.h" #include "AliDisplay.h" -#include "AliGenEventHeader.h" -#include "AliGenerator.h" #include "AliHeader.h" -#include "AliHit.h" #include "AliLego.h" #include "AliLegoGenerator.h" -#include "AliLoader.h" -#include "AliMCQA.h" +#include "AliMC.h" #include "AliMagFC.h" #include "AliMagFCM.h" #include "AliMagFDM.h" #include "AliPDG.h" #include "AliRun.h" -#include "AliRunLoader.h" #include "AliStack.h" -#include "AliTrackReference.h" AliRun *gAlice; + ClassImp(AliRun) //_______________________________________________________________________ @@ -95,28 +78,18 @@ AliRun::AliRun(): fDebug(0), fModules(0), fGeometry(0), + fMCApp(0), fDisplay(0), fTimer(), fField(0), fMC(0), - fImedia(0), fNdets(0), - fTrRmax(1.e10), - fTrZmax(1.e10), - fGenerator(0), fInitDone(kFALSE), fLego(0), fPDGDB(0), //Particle factory object - fHitLists(0), - fEventEnergy(0), - fSummEnergy(0), - fSum2Energy(0), fConfigFunction("\0"), fRandom(0), - fMCQA(0), - fTransParName("\0"), - fRunLoader(0x0), - fTrackReferences(0) + fRunLoader(0x0) { // // Default constructor for AliRun @@ -127,7 +100,7 @@ AliRun::AliRun(): //_______________________________________________________________________ AliRun::AliRun(const AliRun& arun): - TVirtualMCApplication(arun), + TNamed(arun), fRun(0), fEvent(0), fEventNrInRun(0), @@ -135,27 +108,17 @@ AliRun::AliRun(const AliRun& arun): fDebug(0), fModules(0), fGeometry(0), + fMCApp(0), fDisplay(0), fTimer(), fField(0), fMC(0), - fImedia(0), fNdets(0), - fTrRmax(1.e10), - fTrZmax(1.e10), - fGenerator(0), fInitDone(kFALSE), fLego(0), fPDGDB(0), //Particle factory object - fHitLists(0), - fEventEnergy(0), - fSummEnergy(0), - fSum2Energy(0), fConfigFunction("\0"), fRandom(0), - fMCQA(0), - fTransParName("\0"), - fTrackReferences(new TClonesArray("AliTrackReference", 100)), fRunLoader(0x0) { // @@ -166,7 +129,7 @@ AliRun::AliRun(const AliRun& arun): //_____________________________________________________________________________ AliRun::AliRun(const char *name, const char *title): - TVirtualMCApplication(name,title), + TNamed(name,title), fRun(0), fEvent(0), fEventNrInRun(0), @@ -174,26 +137,17 @@ AliRun::AliRun(const char *name, const char *title): fDebug(0), fModules(new TObjArray(77)), // Support list for the Detectors fGeometry(0), + fMCApp(0), fDisplay(0), fTimer(), fField(0), fMC(gMC), - fImedia(new TArrayI(1000)), fNdets(0), - fTrRmax(1.e10), - fTrZmax(1.e10), - fGenerator(0), fInitDone(kFALSE), fLego(0), fPDGDB(TDatabasePDG::Instance()), //Particle factory object! - fHitLists(new TList()), // Create HitLists list - fEventEnergy(0), - fSummEnergy(0), - fSum2Energy(0), fConfigFunction("Config();"), fRandom(new TRandom3()), - fMCQA(0), - fTransParName("\0"), fRunLoader(0x0) { // @@ -220,14 +174,9 @@ AliRun::AliRun(const char *name, const char *title): // Create default mag field SetField(); - // Prepare the tracking medium lists - for(Int_t i=0;i<1000;i++) (*fImedia)[i]=-99; - // Add particle list to configuration AliConfig::Instance()->Add(fPDGDB); - // Set transport parameters - SetTransPar(); } @@ -250,30 +199,20 @@ AliRun::~AliRun() modfold->Remove(mod); } } - - delete fImedia; + + delete fField; - // delete fMC; + delete fMCApp; delete gMC; gMC=0; delete fGeometry; delete fDisplay; - delete fGenerator; delete fLego; if (fModules) { fModules->Delete(); delete fModules; } - delete fHitLists; delete fPDGDB; - delete fMCQA; - // Delete track references - if (fTrackReferences) { - fTrackReferences->Delete(); - delete fTrackReferences; - fTrackReferences = 0; - } - } //_______________________________________________________________________ @@ -282,38 +221,6 @@ void AliRun::Copy(AliRun &) const Fatal("Copy","Not implemented!\n"); } -//_______________________________________________________________________ -void AliRun::AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const -{ - // - // Add a hit to detector id - // - TObjArray &dets = *fModules; - if(dets[id]) dynamic_cast(dets[id])->AddHit(track,vol,hits); -} - -//_______________________________________________________________________ -void AliRun::AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const -{ - // - // Add digit to detector id - // - TObjArray &dets = *fModules; - if(dets[id]) dynamic_cast(dets[id])->AddDigit(tracks,digits); -} - -//_______________________________________________________________________ -void AliRun::Browse(TBrowser *b) -{ - // - // Called when the item "Run" is clicked on the left pane - // of the Root browser. - // It displays the Root Trees and all detectors. - // - //detectors are in folders anyway - b->Add(fMCQA,"AliMCQA"); -} - //_______________________________________________________________________ void AliRun::Build() { @@ -348,33 +255,15 @@ void AliRun::CleanDetectors() } //_______________________________________________________________________ -Int_t AliRun::DistancetoPrimitive(Int_t, Int_t) const -{ - // - // Return the distance from the mouse to the AliRun object - // Dummy routine - // - return 9999; -} - -//_______________________________________________________________________ -void AliRun::DumpPart (Int_t i) const +void AliRun::ResetHits() { - // - // Dumps particle i in the stack - // - if (fRunLoader->Stack()) - fRunLoader->Stack()->DumpPart(i); + fMCApp->ResetHits(); } //_______________________________________________________________________ -void AliRun::DumpPStack () const +AliGenerator* AliRun::Generator() const { - // - // Dumps the particle stack - // - if (fRunLoader->Stack()) - fRunLoader->Stack()->DumpPStack(); + return fMCApp->Generator(); } //_______________________________________________________________________ @@ -454,10 +343,6 @@ void AliRun::FinishRun() detector->FinishRun(); } - //Output energy summary tables - if (GetDebug()) Info("FinishRun"," EnergySummary()"); - EnergySummary(); - if (GetDebug()) Info("FinishRun"," fRunLoader->WriteHeader(OVERWRITE)"); fRunLoader->WriteHeader("OVERWRITE"); @@ -470,84 +355,9 @@ void AliRun::FinishRun() if (GetDebug()) Info("FinishRun"," fRunLoader->Stack()->FinishRun()"); fRunLoader->Stack()->FinishRun(); - // Clean detector information - if (GetDebug()) Info("FinishRun"," fGenerator->FinishRun()"); - fGenerator->FinishRun(); - fRunLoader->Synchronize(); -} + if(fMCApp) fMCApp->FinishRun(); -//_______________________________________________________________________ -void AliRun::FlagTrack(Int_t track) -{ - // Delegate to stack - // - fRunLoader->Stack()->FlagTrack(track); -} - -//_______________________________________________________________________ -void AliRun::EnergySummary() -{ - // - // Print summary of deposited energy - // - - Int_t ndep=0; - Float_t edtot=0; - Float_t ed, ed2; - Int_t kn, i, left, j, id; - const Float_t kzero=0; - Int_t ievent=fRunLoader->GetHeader()->GetEvent()+1; - // - // Energy loss information - if(ievent) { - printf("***************** Energy Loss Information per event (GEV) *****************\n"); - for(kn=1;kn0) { - fEventEnergy[ndep]=kn; - if(ievent>1) { - ed=ed/ievent; - ed2=fSum2Energy[kn]; - ed2=ed2/ievent; - ed2=100*TMath::Sqrt(TMath::Max(ed2-ed*ed,kzero))/ed; - } else - ed2=99; - fSummEnergy[ndep]=ed; - fSum2Energy[ndep]=TMath::Min(static_cast(99.),TMath::Max(ed2,kzero)); - edtot+=ed; - ndep++; - } - } - for(kn=0;kn<(ndep-1)/3+1;kn++) { - left=ndep-kn*3; - for(i=0;i<(3VolName(id),fSummEnergy[j],fSum2Energy[j]); - } - printf("\n"); - } - // - // Relative energy loss in different detectors - printf("******************** Relative Energy Loss per event ********************\n"); - printf("Total energy loss per event %10.3f GeV\n",edtot); - for(kn=0;kn<(ndep-1)/5+1;kn++) { - left=ndep-kn*5; - for(i=0;i<(5VolName(id),100*fSummEnergy[j]/edtot); - } - printf("\n"); - } - for(kn=0;kn<75;kn++) printf("*"); - printf("\n"); - } - // - // Reset the TArray's - // fEventEnergy.Set(0); - // fSummEnergy.Set(0); - // fSum2Energy.Set(0); + fRunLoader->Synchronize(); } //_______________________________________________________________________ @@ -617,8 +427,8 @@ Int_t AliRun::GetEvent(Int_t event) /**** P R E R E L O A D I N G ****/ /*****************************************/ // Reset existing structures - ResetHits(); - ResetTrackReferences(); + fMCApp->ResetHits(); + fMCApp->ResetTrackReferences(); ResetDigits(); ResetSDigits(); @@ -672,320 +482,12 @@ TGeometry *AliRun::GetGeometry() return fGeometry; } -//_______________________________________________________________________ -Int_t AliRun::GetPrimary(Int_t track) const -{ - // - // return number of primary that has generated track - // - return fRunLoader->Stack()->GetPrimary(track); -} - -//_______________________________________________________________________ -void AliRun::MediaTable() -{ - // - // Built media table to get from the media number to - // the detector id - // - - Int_t kz, nz, idt, lz, i, k, ind; - // Int_t ibeg; - TObjArray &dets = *gAlice->Detectors(); - AliModule *det; - // - // For all detectors - for (kz=0;kz(dets[kz]))) { - TArrayI &idtmed = *(det->GetIdtmed()); - for(nz=0;nz<100;nz++) { - // Find max and min material number - if((idt=idtmed[nz])) { - det->LoMedium() = det->LoMedium() < idt ? det->LoMedium() : idt; - det->HiMedium() = det->HiMedium() > idt ? det->HiMedium() : idt; - } - } - if(det->LoMedium() > det->HiMedium()) { - det->LoMedium() = 0; - det->HiMedium() = 0; - } else { - if(det->HiMedium() > fImedia->GetSize()) { - Error("MediaTable","Increase fImedia from %d to %d", - fImedia->GetSize(),det->HiMedium()); - return; - } - // Tag all materials in rage as belonging to detector kz - for(lz=det->LoMedium(); lz<= det->HiMedium(); lz++) { - (*fImedia)[lz]=kz; - } - } - } - } - // - // Print summary table - printf(" Traking media ranges:\n"); - for(i=0;i<(fNdets-1)/6+1;i++) { - for(k=0;k< (6(dets[ind]); - if(det) - printf(" %6s: %3d -> %3d;",det->GetName(),det->LoMedium(), - det->HiMedium()); - else - printf(" %6s: %3d -> %3d;","NULL",0,0); - } - printf("\n"); - } -} - -//_______________________________________________________________________ -void AliRun::SetGenerator(AliGenerator *generator) -{ - // - // Load the event generator - // - if(!fGenerator) fGenerator = generator; -} - -//_______________________________________________________________________ -void AliRun::ResetGenerator(AliGenerator *generator) -{ - // - // Load the event generator - // - if(fGenerator) - if(generator) - Warning("ResetGenerator","Replacing generator %s with %s\n", - fGenerator->GetName(),generator->GetName()); - else - Warning("ResetGenerator","Replacing generator %s with NULL\n", - fGenerator->GetName()); - fGenerator = generator; -} - -//_______________________________________________________________________ -void AliRun::SetTransPar(const char *filename) -{ - // - // Sets the file name for transport parameters - // - fTransParName = filename; -} - //_______________________________________________________________________ void AliRun::SetBaseFile(const char *filename) { fBaseFileName = filename; } -//_______________________________________________________________________ -void AliRun::ReadTransPar() -{ - // - // Read filename to set the transport parameters - // - - - const Int_t kncuts=10; - const Int_t knflags=11; - const Int_t knpars=kncuts+knflags; - const char kpars[knpars][7] = {"CUTGAM" ,"CUTELE","CUTNEU","CUTHAD","CUTMUO", - "BCUTE","BCUTM","DCUTE","DCUTM","PPCUTM","ANNI", - "BREM","COMP","DCAY","DRAY","HADR","LOSS", - "MULS","PAIR","PHOT","RAYL"}; - char line[256]; - char detName[7]; - char* filtmp; - Float_t cut[kncuts]; - Int_t flag[knflags]; - Int_t i, itmed, iret, ktmed, kz; - FILE *lun; - // - // See whether the file is there - filtmp=gSystem->ExpandPathName(fTransParName.Data()); - lun=fopen(filtmp,"r"); - delete [] filtmp; - if(!lun) { - Warning("ReadTransPar","File %s does not exist!\n",fTransParName.Data()); - return; - } - // - if(fDebug) { - printf(" "); for(i=0;i<60;i++) printf("*"); printf("\n"); - printf(" *%59s\n","*"); - printf(" * Please check carefully what you are doing!%10s\n","*"); - printf(" *%59s\n","*"); - } - // - while(1) { - // Initialise cuts and flags - for(i=0;iGetIdtmed(); - // Check that the tracking medium code is valid - if(0<=itmed && itmed < 100) { - ktmed=idtmed[itmed]; - if(!ktmed) { - Warning("ReadTransPar","Invalid tracking medium code %d for %s\n",itmed,mod->GetName()); - continue; - } - // Set energy thresholds - for(kz=0;kz=0) { - if(fDebug) printf(" * %-6s set to %10.3E for tracking medium code %4d for %s\n", - kpars[kz],cut[kz],itmed,mod->GetName()); - gMC->Gstpar(ktmed,kpars[kz],cut[kz]); - } - } - // Set transport mechanisms - for(kz=0;kz=0) { - if(fDebug) printf(" * %-6s set to %10d for tracking medium code %4d for %s\n", - kpars[kncuts+kz],flag[kz],itmed,mod->GetName()); - gMC->Gstpar(ktmed,kpars[kncuts+kz],Float_t(flag[kz])); - } - } - } else { - Warning("ReadTransPar","Invalid medium code %d *\n",itmed); - continue; - } - } else { - if(fDebug) printf("%s::ReadTransParModule: %s not present\n",ClassName(),detName); - continue; - } - } -} -//_____________________________________________________________________________ - -void AliRun::BeginEvent() -{ - // - // Clean-up previous event - // Energy scores - if (GetDebug()) - { - Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - Info("BeginEvent"," BEGINNING EVENT "); - Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - Info("BeginEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - } - - /*******************************/ - /* Clean after eventual */ - /* previous event */ - /*******************************/ - - - //Set the next event in Run Loader -> Cleans trees (TreeK and all trees in detectors), - fRunLoader->SetEventNumber(++fEventNrInRun);// sets new files, cleans the previous event stuff, if necessary, etc., - if (GetDebug()) Info("BeginEvent","EventNr is %d",fEventNrInRun); - - fEventEnergy.Reset(); - // Clean detector information - - if (fRunLoader->Stack()) - fRunLoader->Stack()->Reset();//clean stack -> tree is unloaded - else - fRunLoader->MakeStack();//or make a new one - - if (GetDebug()) Info("BeginEvent"," fRunLoader->MakeTree(K)"); - fRunLoader->MakeTree("K"); - if (GetDebug()) Info("BeginEvent"," gMC->SetStack(fRunLoader->Stack())"); - gMC->SetStack(fRunLoader->Stack());//Was in InitMC - but was moved here - //because we don't have guarantee that - //stack pointer is not going to change from event to event - //since it bellobgs to header and is obtained via RunLoader - // - // Reset all Detectors & kinematics & make/reset trees - // - - fRunLoader->GetHeader()->Reset(fRun,fEvent,fEventNrInRun); -// fRunLoader->WriteKinematics("OVERWRITE"); is there any reason to rewrite here since MakeTree does so - - if (GetDebug()) Info("BeginEvent"," fRunLoader->MakeTrackRefsContainer()"); - fRunLoader->MakeTrackRefsContainer();//for insurance - - if (GetDebug()) Info("BeginEvent"," ResetHits()"); - ResetHits(); - if (GetDebug()) Info("BeginEvent"," fRunLoader->MakeTree(H)"); - fRunLoader->MakeTree("H"); - - // - if(fLego) - { - fLego->BeginEvent(); - return; - } - - //create new branches and SetAdresses - TIter next(fModules); - AliModule *detector; - while((detector = (AliModule*)next())) - { - if (GetDebug()) Info("BeginEvent"," %s->MakeBranch(H)",detector->GetName()); - detector->MakeBranch("H"); - if (GetDebug()) Info("BeginEvent"," %s->MakeBranchTR()",detector->GetName()); - detector->MakeBranchTR(); - if (GetDebug()) Info("BeginEvent"," %s->SetTreeAddress()",detector->GetName()); - detector->SetTreeAddress(); - } - // make branch for AliRun track References - TTree * treeTR = fRunLoader->TreeTR(); - if (treeTR){ - // make branch for central track references - if (!fTrackReferences) fTrackReferences = new TClonesArray("AliTrackReference",0); - TBranch *branch; - branch = treeTR->Branch("AliRun",&fTrackReferences); - branch->SetAddress(&fTrackReferences); - } - // -} - -//_______________________________________________________________________ -TParticle* AliRun::Particle(Int_t i) const -{ - if (fRunLoader) - if (fRunLoader->Stack()) - return fRunLoader->Stack()->Particle(i); - return 0x0; -} - //_______________________________________________________________________ void AliRun::ResetDigits() { @@ -1012,71 +514,6 @@ void AliRun::ResetSDigits() } } -//_______________________________________________________________________ -void AliRun::ResetHits() -{ - // - // Reset all Detectors hits - // - TIter next(fModules); - AliModule *detector; - while((detector = dynamic_cast(next()))) { - detector->ResetHits(); - } -} -//_______________________________________________________________________ - -void AliRun::AddTrackReference(Int_t label){ - // - // add a trackrefernce to the list - if (!fTrackReferences) { - cerr<<"Container trackrefernce not active\n"; - return; - } - Int_t nref = fTrackReferences->GetEntriesFast(); - TClonesArray &lref = *fTrackReferences; - new(lref[nref]) AliTrackReference(label); -} - - - -void AliRun::ResetTrackReferences() -{ - // - // Reset all references - // - if (fTrackReferences) fTrackReferences->Clear(); - - TIter next(fModules); - AliModule *detector; - while((detector = dynamic_cast(next()))) { - detector->ResetTrackReferences(); - } -} - -void AliRun::RemapTrackReferencesIDs(Int_t *map) -{ - // - // Remapping track reference - // Called at finish primary - // - if (!fTrackReferences) return; - for (Int_t i=0;iGetEntries();i++){ - AliTrackReference * ref = dynamic_cast(fTrackReferences->UncheckedAt(i)); - if (ref) { - Int_t newID = map[ref->GetTrack()]; - if (newID>=0) ref->SetTrack(newID); - else { - //ref->SetTrack(-1); - ref->SetBit(kNotDeleted,kFALSE); - fTrackReferences->RemoveAt(i); - } - } - } - fTrackReferences->Compress(); -} - - //_______________________________________________________________________ @@ -1096,7 +533,7 @@ void AliRun::ResetPoints() void AliRun::InitMC(const char *setup) { // - // Initialize the Alice setup + // Initialize ALICE Simulation run // Announce(); @@ -1105,12 +542,11 @@ void AliRun::InitMC(const char *setup) return; } + fMCApp=new AliMC(GetName(),GetTitle()); + gROOT->LoadMacro(setup); gInterpreter->ProcessLine(fConfigFunction.Data()); - // Register MC in configuration - AliConfig::Instance()->Add(gMC); - InitLoaders(); fRunLoader->MakeTree("E"); @@ -1121,24 +557,20 @@ void AliRun::InitMC(const char *setup) fRunLoader->CdGAFile(); - gMC->DefineParticles(); //Create standard MC particles AliPDG::AddParticlesToPdgDataBase(); - TObject *objfirst, *objlast; - fNdets = fModules->GetLast()+1; // - //=================Create Materials and geometry - gMC->Init(); // Added also after in case of interactive initialisation of modules fNdets = fModules->GetLast()+1; TIter next(fModules); - AliModule *detector; - while((detector = dynamic_cast(next()))) + for(Int_t i=0; i(fModules->At(i)); objlast = gDirectory->GetList()->Last(); // Add Detector histograms in Detector list of histograms @@ -1150,25 +582,11 @@ void AliRun::InitMC(const char *setup) objfirst = gDirectory->GetList()->After(objfirst); } } - ReadTransPar(); //Read the cuts for all materials - - MediaTable(); //Build the special IMEDIA table - - //Initialise geometry deposition table - fEventEnergy.Set(gMC->NofVolumes()+1); - fSummEnergy.Set(gMC->NofVolumes()+1); - fSum2Energy.Set(gMC->NofVolumes()+1); - //Compute cross-sections - gMC->BuildPhysics(); - - //Write Geometry object to current file. - fRunLoader->WriteGeometry(); + fMCApp->Init(); fInitDone = kTRUE; - fMCQA = new AliMCQA(fNdets); - // // Save stuff at the beginning of the file to avoid file corruption Write(); @@ -1350,13 +768,14 @@ void AliRun::RunLego(const char *setup, Int_t nc1, Float_t c1min, // check if initialisation has been done if (!fInitDone) InitMC(setup); - // Save current generator - AliGenerator *gen=Generator(); + //Save current generator + AliGenerator *gen=fMCApp->Generator(); // If runloader has been initialized, set the number of events per file to nc1 * nc2 if (fRunLoader) fRunLoader->SetNumberOfEventsPerFile(nc1 * nc2); + // Set new generator if (!gener) gener = new AliLegoGenerator(); - ResetGenerator(gener); + fMCApp->ResetGenerator(gener); // // Configure Generator gener->SetRadiusRange(rmin, rmax); @@ -1382,7 +801,7 @@ void AliRun::RunLego(const char *setup, Int_t nc1, Float_t c1min, // End of this run, close files FinishRun(); // Restore current generator - ResetGenerator(gen); + fMCApp->ResetGenerator(gen); // Delete Lego Object delete fLego; fLego=0; } @@ -1397,280 +816,10 @@ void AliRun::SetConfigFunction(const char * config) fConfigFunction=config; } -//_______________________________________________________________________ -void AliRun::SetCurrentTrack(Int_t track) -{ - // - // Set current track number - // - fRunLoader->Stack()->SetCurrentTrack(track); -} - -//_______________________________________________________________________ -void AliRun::PushTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom, - Float_t *vpos, Float_t *polar, Float_t tof, - TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) -{ -// Delegate to stack -// - fRunLoader->Stack()->PushTrack(done, parent, pdg, pmom, vpos, polar, tof, - mech, ntr, weight, is); -} - -//_______________________________________________________________________ -void AliRun::PushTrack(Int_t done, Int_t parent, Int_t pdg, - Double_t px, Double_t py, Double_t pz, Double_t e, - Double_t vx, Double_t vy, Double_t vz, Double_t tof, - Double_t polx, Double_t poly, Double_t polz, - TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is) -{ - // Delegate to stack - // - fRunLoader->Stack()->PushTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof, - polx, poly, polz, mech, ntr, weight, is); -} - -//_______________________________________________________________________ -void AliRun::SetHighWaterMark(const Int_t nt) -{ - // - // Set high water mark for last track in event - fRunLoader->Stack()->SetHighWaterMark(nt); -} - -//_______________________________________________________________________ -void AliRun::KeepTrack(const Int_t track) -{ - // - // Delegate to stack - // - fRunLoader->Stack()->KeepTrack(track); -} - // // MC Application // -//_______________________________________________________________________ -void AliRun::ConstructGeometry() -{ - // - // Create modules, materials, geometry - // - - TStopwatch stw; - TIter next(fModules); - AliModule *detector; - if (GetDebug()) Info("ConstructGeometry","Geometry creation:"); - while((detector = dynamic_cast(next()))) { - stw.Start(); - // Initialise detector materials and geometry - detector->CreateMaterials(); - detector->CreateGeometry(); - printf("%10s R:%.2fs C:%.2fs\n", - detector->GetName(),stw.RealTime(),stw.CpuTime()); - } -} - -//_______________________________________________________________________ -void AliRun::InitGeometry() -{ - // - // Initialize detectors and display geometry - // - - printf("Initialisation:\n"); - TStopwatch stw; - TIter next(fModules); - AliModule *detector; - while((detector = dynamic_cast(next()))) { - stw.Start(); - // Initialise detector and display geometry - detector->Init(); - detector->BuildGeometry(); - printf("%10s R:%.2fs C:%.2fs\n", - detector->GetName(),stw.RealTime(),stw.CpuTime()); - } - -} -//_______________________________________________________________________ - -void AliRun::GeneratePrimaries() -{ - // - // Generate primary particles and fill them in the stack. - // - - Generator()->Generate(); -} -//_______________________________________________________________________ - -void AliRun::BeginPrimary() -{ - // - // Called at the beginning of each primary track - // - - // Reset Hits info - gAlice->ResetHits(); - gAlice->ResetTrackReferences(); - -} - -//_______________________________________________________________________ -void AliRun::PreTrack() -{ - TObjArray &dets = *fModules; - AliModule *module; - - for(Int_t i=0; i<=fNdets; i++) - if((module = dynamic_cast(dets[i]))) - module->PreTrack(); - - fMCQA->PreTrack(); -} - -//_______________________________________________________________________ -void AliRun::Stepping() -{ - // - // Called at every step during transport - // - - Int_t id = DetFromMate(gMC->GetMedium()); - - if (id < 0) return; - - // - // --- If lego option, do it and leave - if (fLego) - fLego->StepManager(); - else { - Int_t copy; - //Update energy deposition tables - AddEnergyDeposit(gMC->CurrentVolID(copy),gMC->Edep()); - // - // write tracke reference for track which is dissapearing - MI - if (gMC->IsTrackDisappeared()) { - if (gMC->Etot()>0.05) AddTrackReference(GetCurrentTrackNumber()); - } - - //Call the appropriate stepping routine; - AliModule *det = dynamic_cast(fModules->At(id)); - if(det && det->StepManagerIsEnabled()) { - fMCQA->StepManager(id); - det->StepManager(); - } - } -} - -//_______________________________________________________________________ -void AliRun::PostTrack() -{ - TObjArray &dets = *fModules; - AliModule *module; - - for(Int_t i=0; i<=fNdets; i++) - if((module = dynamic_cast(dets[i]))) - module->PostTrack(); -} - -//_______________________________________________________________________ -void AliRun::FinishPrimary() -{ - // - // Called at the end of each primary track - // - - // static Int_t count=0; - // const Int_t times=10; - // This primary is finished, purify stack - fRunLoader->Stack()->PurifyKine(); - - TIter next(fModules); - AliModule *detector; - while((detector = dynamic_cast(next()))) { - detector->FinishPrimary(); - if(detector->GetLoader()) - { - detector->GetLoader()->TreeH()->Fill(); - } - } - - // Write out track references if any - if (fRunLoader->TreeTR()) - { - fRunLoader->TreeTR()->Fill(); - } -} - -//_______________________________________________________________________ -void AliRun::FinishEvent() -{ - // - // Called at the end of the event. - // - - // - if(fLego) fLego->FinishEvent(); - - TIter next(fModules); - AliModule *detector; - while((detector = dynamic_cast(next()))) { - detector->FinishEvent(); - } - - //Update the energy deposit tables - Int_t i; - for(i=0;iGetHeader(); - AliStack* stack = fRunLoader->Stack(); - if ( (header == 0x0) || (stack == 0x0) ) - {//check if we got header and stack. If not cry and exit aliroot - Fatal("AliRun","Can not get the stack or header from LOADER"); - return;//never reached - } - // Update Header information - header->SetNprimary(stack->GetNprimary()); - header->SetNtrack(stack->GetNtrack()); - - - // Write out the kinematics - stack->FinishEvent(); - - // Write out the event Header information - TTree* treeE = fRunLoader->TreeE(); - if (treeE) - { - header->SetStack(stack); - treeE->Fill(); - } - else - { - Error("FinishEvent","Can not get TreeE from RL"); - } - - fRunLoader->WriteKinematics("OVERWRITE"); - fRunLoader->WriteTrackRefs("OVERWRITE"); - fRunLoader->WriteHits("OVERWRITE"); - - if (GetDebug()) - { - Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - Info("FinishEvent"," FINISHING EVENT "); - Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - Info("FinishEvent","<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); - } -} - //_______________________________________________________________________ void AliRun::Field(const Double_t* x, Double_t *b) const { @@ -1711,34 +860,6 @@ void AliRun::Streamer(TBuffer &R__b) //_______________________________________________________________________ -Int_t AliRun::GetCurrentTrackNumber() const { - // - // Returns current track - // - return fRunLoader->Stack()->GetCurrentTrackNumber(); -} - -//_______________________________________________________________________ -Int_t AliRun::GetNtrack() const { - // - // Returns number of tracks in stack - // - return fRunLoader->Stack()->GetNtrack(); -} -//_______________________________________________________________________ - -//_______________________________________________________________________ -TObjArray* AliRun::Particles() const { - // - // Returns pointer to Particles array - // - if (fRunLoader) - if (fRunLoader->Stack()) - return fRunLoader->Stack()->Particles(); - return 0x0; -} - -//___________________________________________________________________________ //_______________________________________________________________________ void AliRun::SetGenEventHeader(AliGenEventHeader* header) diff --git a/STEER/AliRun.h b/STEER/AliRun.h index 0e9a68c1823..76135cb873b 100644 --- a/STEER/AliRun.h +++ b/STEER/AliRun.h @@ -5,45 +5,29 @@ /* $Id$ */ -#include -#include -#include #include #include -#include -#include #include -class TBranch; -class TBrowser; -class TDatabasePDG; -class TFile; class TGeometry; -class TList; class TParticle; class TRandom; class TTree; #include "AliRunLoader.h" -class AliDetector; class AliDisplay; class AliGenEventHeader; class AliGenerator; class AliHeader; class AliLego; class AliLegoGenerator; -class AliLegoGenerator; -class AliMCQA; +class AliMC; class AliMagF; -class AliModule; class AliStack; -class AliTrackReference; - enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4}; - -class AliRun : public TVirtualMCApplication { +class AliRun : public TNamed { public: // Creators - distructors AliRun(); @@ -53,25 +37,14 @@ public: AliRun& operator = (const AliRun &arun) {arun.Copy(*this); return (*this);} - virtual void AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const; - virtual void AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const; - virtual void AddHitList(TCollection *hitList) {fHitLists->Add(hitList);} - virtual void Browse(TBrowser *b); virtual void Build(); virtual void BuildSimpleGeometry(); virtual void CleanDetectors(); TObjArray *Detectors() const {return fModules;} TObjArray *Modules() const {return fModules;} - Int_t GetCurrentTrackNumber() const; AliDisplay *Display() const { return fDisplay;} - virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) const; - virtual void DumpPart (Int_t i) const; - virtual void DumpPStack () const; virtual AliMagF *Field() const {return fField;} virtual void FinishRun(); - virtual void FlagTrack(Int_t track); - void AddEnergyDeposit(Int_t id, Float_t edep) - {fEventEnergy[id]+=edep;} void AddModule(AliModule* mod); Int_t GetEvNumber() const; Int_t GetRunNumber() const {return fRun;} @@ -79,11 +52,10 @@ public: void SetEventNrInRun(Int_t event) {fEventNrInRun=event;} Int_t GetEventNrInRun() const {return fEventNrInRun;} Int_t GetEventsPerRun() const {return fEventsPerRun;} + Int_t GetNdets() const {return fNdets;} Int_t GetDebug() const {return fDebug;} AliModule *GetModule(const char *name) const; - TList* GetHitLists() const {return fHitLists ;} AliDetector *GetDetector(const char *name) const; - AliMCQA *GetMCQA() const {return fMCQA;} Int_t GetModuleID(const char *name) const; virtual const char *GetBaseFile() const {return fBaseFileName.Data();} @@ -94,8 +66,7 @@ public: {return fConfigFunction.Data();} TGeometry *GetGeometry(); virtual void SetGenEventHeader(AliGenEventHeader* header); - Int_t GetNtrack() const; - virtual Int_t GetPrimary(Int_t track) const; + AliMC* GetMCApp() const {return fMCApp;} virtual void Hits2Digits(const char *detector=0); virtual void Hits2SDigits(const char *detector=0) {Tree2Tree("S",detector);} virtual void SDigits2Digits(const char *detector=0) {Tree2Tree("D",detector);} @@ -105,21 +76,10 @@ public: Bool_t IsFolder() const {return kTRUE;} virtual AliLego* Lego() const {return fLego;} - TObjArray *Particles() const; - TParticle *Particle(Int_t i) const; virtual void ResetDigits(); virtual void ResetSDigits(); - virtual void ResetHits(); -// Track reference related - virtual void AddTrackReference(Int_t label); - TClonesArray *TrackReferences() const {return fTrackReferences;} - virtual void RemapTrackReferencesIDs(Int_t *map); //remaping track references MI - virtual void ResetTrackReferences(); - virtual void ResetPoints(); - virtual void SetTransPar(const char *filename="$(ALICE_ROOT)/data/galice.cuts"); virtual void SetBaseFile(const char *filename="galice.root"); - virtual void ReadTransPar(); virtual void RunMC(Int_t nevent=1, const char *setup="Config.C"); virtual void Run(Int_t nevent=1, const char *setup="Config.C") {RunMC(nevent,setup);} virtual void RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178, @@ -127,48 +87,17 @@ public: Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL); virtual Bool_t IsLegoRun() const {return (fLego!=0);} virtual void RunReco(const char *detector=0, Int_t first = 0, Int_t last = 0); - virtual void SetCurrentTrack(Int_t track); virtual void SetDebug(const Int_t level=0) {fDebug = level;} virtual void SetDisplay(AliDisplay *display) {fDisplay = display;} virtual void SetField(Int_t type=2, Int_t version=1, Float_t scale=1, Float_t maxField=10, char*filename="$(ALICE_ROOT)/data/field01.dat"); virtual void SetField(AliMagF* magField); - virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg, - Float_t *pmom, Float_t *vpos, Float_t *polar, - Float_t tof, TMCProcess mech, Int_t &ntr, - Float_t weight = 1, Int_t is = 0); - virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg, - Double_t px, Double_t py, Double_t pz, Double_t e, - Double_t vx, Double_t vy, Double_t vz, Double_t tof, - Double_t polx, Double_t poly, Double_t polz, - TMCProcess mech, Int_t &ntr, Float_t weight=1, - Int_t is = 0); - virtual void SetHighWaterMark(const Int_t nt); - - virtual void KeepTrack(const Int_t itra); - virtual void MediaTable(); - virtual void TrackingLimits( Float_t rmax=1.e10, Float_t zmax=1.e10) {fTrRmax=rmax; fTrZmax=zmax;} - virtual Int_t DetFromMate(Int_t i) const { return (*fImedia)[i];} - virtual AliGenerator* Generator() const {return fGenerator;} - virtual void SetGenerator(AliGenerator *generator); - virtual void ResetGenerator(AliGenerator *generator); - virtual void EnergySummary(); virtual TDatabasePDG* PDGDB() const {return fPDGDB;} - // MC Application - // - virtual void ConstructGeometry(); - virtual void InitGeometry(); - virtual void GeneratePrimaries(); - virtual void BeginEvent(); - virtual void BeginPrimary(); - virtual void PreTrack(); - virtual void Stepping(); - virtual void PostTrack(); - virtual void FinishPrimary(); - virtual void FinishEvent(); - virtual Double_t TrackingZmax() const {return fTrZmax;} - virtual Double_t TrackingRmax() const {return fTrRmax;} virtual void Field(const Double_t* x, Double_t* b) const; + + // Delegations + virtual void ResetHits(); + virtual AliGenerator* Generator() const; // // End of MC Application @@ -206,29 +135,19 @@ protected: Int_t fDebug; // Debug flag TObjArray *fModules; // List of Detectors TGeometry *fGeometry; // Pointer to geometry + AliMC *fMCApp; // Pointer to virtual MC Application AliDisplay *fDisplay; //! Pointer to event display TStopwatch fTimer; // Timer object AliMagF *fField; // Magnetic Field Map TVirtualMC *fMC; //! Pointer to MonteCarlo object - TArrayI *fImedia; //! Array of correspondence between media and detectors Int_t fNdets; // Number of detectors - Float_t fTrRmax; // Maximum radius for tracking - Float_t fTrZmax; // Maximu z for tracking - AliGenerator *fGenerator; // Generator used in the MC Bool_t fInitDone; //! True when initialisation done AliLego *fLego; //! Pointer to aliLego object if it exists TDatabasePDG *fPDGDB; // Particle factory object - TList *fHitLists; //! Lists of hits to be remapped by PurifyKine - TArrayF fEventEnergy; //! Energy deposit for current event - TArrayF fSummEnergy; //! Energy per event in each volume - TArrayF fSum2Energy; //! Energy squared per event in each volume TString fConfigFunction; // Configuration file to be executed TRandom *fRandom; // Pointer to the random number generator - AliMCQA *fMCQA; // Pointer to MC Quality assurance class - TString fTransParName; // Name of the transport parameters file TString fBaseFileName; // Name of the base root file - TClonesArray *fTrackReferences; //!list of track references - for one primary track only -MI AliRunLoader *fRunLoader; //!run getter - written as a separate object private: void Copy(AliRun &arun) const; diff --git a/STEER/AliStack.cxx b/STEER/AliStack.cxx index 373e869c76b..9ee1ed7723c 100644 --- a/STEER/AliStack.cxx +++ b/STEER/AliStack.cxx @@ -32,6 +32,7 @@ #include "AliHit.h" #include "AliModule.h" #include "AliRun.h" +#include "AliMC.h" #include "AliRunLoader.h" #include "AliStack.h" @@ -359,7 +360,7 @@ void AliStack::PurifyKine() } // Now loop on all registered hit lists - TList* hitLists = gAlice->GetHitLists(); + TList* hitLists = gAlice->GetMCApp()->GetHitLists(); TIter next(hitLists); TCollection *hitList; while((hitList = dynamic_cast(next()))) { @@ -383,7 +384,7 @@ void AliStack::PurifyKine() detector->RemapTrackReferencesIDs(map.GetArray()); } // - gAlice->RemapTrackReferencesIDs(map.GetArray()); + gAlice->GetMCApp()->RemapTrackReferencesIDs(map.GetArray()); // Now the output bit, from fHgwmk to nkeep we write everything and we erase if(nkeep>fParticleFileMap.GetSize()) fParticleFileMap.Set(Int_t (nkeep*1.5)); diff --git a/STEER/STEERLinkDef.h b/STEER/STEERLinkDef.h index da0d742f1f6..bd6ad43bfbd 100644 --- a/STEER/STEERLinkDef.h +++ b/STEER/STEERLinkDef.h @@ -74,6 +74,7 @@ #pragma link C++ class AliCollisionGeometry+; #pragma link C++ class AliMemoryWatcher+; #pragma link C++ class AliBarrelTrack+; +#pragma link C++ class AliMC+; #endif diff --git a/STEER/libSTEER.pkg b/STEER/libSTEER.pkg index 365873ca2a7..b5e5cc6c4ca 100644 --- a/STEER/libSTEER.pkg +++ b/STEER/libSTEER.pkg @@ -16,7 +16,8 @@ AliMergeCombi.cxx AliMagFMaps.cxx AliFieldMap.cxx \ AliGausCorr.cxx AliTrackReference.cxx AliESD.cxx \ AliTrackMap.cxx AliTrackMapper.cxx AliCollisionGeometry.cxx \ AliMemoryWatcher.cxx AliBarrelTrack.cxx \ -AliESDtrack.cxx AliESDv0.cxx AliESDcascade.cxx AliESDvertex.cxx AliESDpid.cxx +AliESDtrack.cxx AliESDv0.cxx AliESDcascade.cxx AliESDvertex.cxx AliESDpid.cxx \ +AliMC.cxx HDRS:= $(SRCS:.cxx=.h) DHDR= STEERLinkDef.h diff --git a/STRUCT/AliFRAMEv0.cxx b/STRUCT/AliFRAMEv0.cxx index 658d7c53ef7..5d3e03bdead 100644 --- a/STRUCT/AliFRAMEv0.cxx +++ b/STRUCT/AliFRAMEv0.cxx @@ -24,6 +24,7 @@ #include "AliFRAMEv0.h" #include "AliRun.h" #include "TSystem.h" +#include ClassImp(AliFRAMEv0) diff --git a/STRUCT/AliFRAMEv1.cxx b/STRUCT/AliFRAMEv1.cxx index 0d1132ed716..7f1a56870f3 100644 --- a/STRUCT/AliFRAMEv1.cxx +++ b/STRUCT/AliFRAMEv1.cxx @@ -22,6 +22,7 @@ //------------------------------------------------------------------------- #include +#include #include "AliFRAMEv1.h" #include "AliRun.h" diff --git a/STRUCT/AliFRAMEv2.cxx b/STRUCT/AliFRAMEv2.cxx index ff8da636961..e94d4d464fd 100644 --- a/STRUCT/AliFRAMEv2.cxx +++ b/STRUCT/AliFRAMEv2.cxx @@ -22,11 +22,13 @@ //------------------------------------------------------------------------ #include +#include #include "AliFRAMEv2.h" #include "AliMagF.h" #include "AliRun.h" #include "AliConst.h" +#include "AliMC.h" ClassImp(AliFRAMEv2) @@ -1351,7 +1353,7 @@ void AliFRAMEv2::StepManager() // // Add the reference track // - AddTrackReference(gAlice->GetCurrentTrackNumber()); + AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); } diff --git a/STRUCT/AliSHILv2.cxx b/STRUCT/AliSHILv2.cxx index 953933195b4..ca2ffdf5b80 100644 --- a/STRUCT/AliSHILv2.cxx +++ b/STRUCT/AliSHILv2.cxx @@ -21,8 +21,10 @@ // Author: A.Morsch //------------------------------------------------------------------------- +#include +#include + #include "AliSHILv2.h" -#include "AliRun.h" #include "AliConst.h" #include "AliALIFE.h" diff --git a/STRUCT/AliSHILvF.cxx b/STRUCT/AliSHILvF.cxx index b69c8d3f134..d7ab57ef6a8 100644 --- a/STRUCT/AliSHILvF.cxx +++ b/STRUCT/AliSHILvF.cxx @@ -21,8 +21,10 @@ // Author: A.Morsch //------------------------------------------------------------------------- +#include +#include + #include "AliSHILvF.h" -#include "AliRun.h" #include "AliConst.h" #include "AliALIFE.h" diff --git a/THerwig/AliGenHerwig.cxx b/THerwig/AliGenHerwig.cxx index 6f15f6ee2e0..53b7f73921a 100644 --- a/THerwig/AliGenHerwig.cxx +++ b/THerwig/AliGenHerwig.cxx @@ -27,6 +27,7 @@ #include "THerwig6.h" #include "Riostream.h" +#include "AliMC.h" ClassImp(AliGenHerwig) @@ -204,7 +205,7 @@ void AliGenHerwig::Generate() Float_t tof = kconv*iparticle->T(); Int_t iparent = (imo > -1) ? newPos[imo] : -1; Int_t trackIt = (ks == 1) && fTrackIt; - gAlice->PushTrack(trackIt, iparent, kf, + gAlice->GetMCApp()->PushTrack(trackIt, iparent, kf, p[0], p[1], p[2], p[3], origin[0], origin[1], origin[2], tof, @@ -239,9 +240,9 @@ void AliGenHerwig::AdjustWeights() { // Adjust the weights after generation of all events TParticle *part; - Int_t ntrack=gAlice->GetNtrack(); + Int_t ntrack=gAlice->GetMCApp()->GetNtrack(); for (Int_t i=0; iParticle(i); + part= gAlice->GetMCApp()->Particle(i); part->SetWeight(part->GetWeight()*fKineBias); } } diff --git a/TOF/AliTOF.cxx b/TOF/AliTOF.cxx index e8fa2e4b8cd..666d28ee05c 100644 --- a/TOF/AliTOF.cxx +++ b/TOF/AliTOF.cxx @@ -69,6 +69,7 @@ #include "AliTOFdigit.h" #include "AliTOFhit.h" #include "AliTOFhitT0.h" +#include "AliMC.h" ClassImp(AliTOF) @@ -120,8 +121,8 @@ AliTOF::AliTOF(const char *name, const char *title, Option_t *option) if (gAlice==0) { Fatal("AliTOF","gAlice==0 !"); } - if (gAlice->GetHitLists()) - gAlice->AddHitList(fHits); + if (gAlice->GetMCApp()->GetHitLists()) + gAlice->GetMCApp()->AddHitList(fHits); else Error("AliTOF","gAlice->GetHitLists()==0"); fIshunt = 0; diff --git a/TOF/AliTOFReconstructioner.cxx b/TOF/AliTOFReconstructioner.cxx index e6d81703c97..39f36c0d140 100644 --- a/TOF/AliTOFReconstructioner.cxx +++ b/TOF/AliTOFReconstructioner.cxx @@ -74,6 +74,7 @@ #include "AliTOFv3.h" #include "AliTOFv4.h" #include "AliTOFv4T0.h" +#include "AliMC.h" // #include "../TPC/AliTPC.h" // AliTPChit class or somewhere @@ -1701,7 +1702,7 @@ void AliTOFReconstructioner::ReadTOFHits(Int_t ntracks, TTree* treehits, ipart = tofHit->GetTrack(); if(ipart>=fMaxAllTracks) break; Float_t geantTime= tofHit->GetTof(); // it is given in [s] - particle = (TParticle*)gAlice->Particle(ipart); + particle = (TParticle*)gAlice->GetMCApp()->Particle(ipart); Int_t pdgCode=particle->GetPdgCode(); // Only high momentum tracks (see fPBound value) @@ -3020,7 +3021,7 @@ void AliTOFReconstructioner::Matching(AliTOFTrack* trackArray, AliTOFRecHit* hit //Test if(PRINT) { if(iTOFpixel[ipart] && match!=3) { - particle = (TParticle*)gAlice->Particle(ipart); //for V3.05 + particle = (TParticle*)gAlice->GetMCApp()->Particle(ipart); //for V3.05 printf(" ipixel=%i (Sector=%i, Plate=%i, Strip=%i, Pixel=%i), fired by %i track\n",iTOFpixel[ipart], pixelArray[iTOFpixel[ipart]-1].GetSector(),pixelArray[iTOFpixel[ipart]-1].GetPlate(), @@ -3171,7 +3172,7 @@ void AliTOFReconstructioner::FillNtuple(Int_t ntracks, AliTOFTrack* trackArray, cout << "particle " << i << endl; cout << "total " << numberOfParticles << endl; */ - TParticle *part = (TParticle *) gAlice->Particle(i); + TParticle *part = (TParticle *) gAlice->GetMCApp()->Particle(i); if(charge[PDGtoGeantCode(part->GetPdgCode())-1]) { icharge++; /* diff --git a/TOF/AliTOFReconstructionerV2.cxx b/TOF/AliTOFReconstructionerV2.cxx index df1c0ea5fe9..cf939d5d4c7 100644 --- a/TOF/AliTOFReconstructionerV2.cxx +++ b/TOF/AliTOFReconstructionerV2.cxx @@ -53,6 +53,7 @@ #include "AliTOFTrackV2.h" #include "AliTOFdigit.h" #include "AliTOFhitT0.h" +#include "AliMC.h" ClassImp(AliTOFReconstructionerV2) @@ -991,7 +992,7 @@ void AliTOFReconstructionerV2::Comparison(Int_t* rtIndex) if(ipart >= 80000) continue; if(rtIndex[ipart] < 0) continue; - TParticle *part = gAlice->Particle(ipart); + TParticle *part = gAlice->GetMCApp()->Particle(ipart); // get first the pdg code Int_t pdgCode=part->GetPdgCode(); diff --git a/TOF/AliTOFSDigitizer.cxx b/TOF/AliTOFSDigitizer.cxx index 8707e0e78b4..0be6089e08e 100644 --- a/TOF/AliTOFSDigitizer.cxx +++ b/TOF/AliTOFSDigitizer.cxx @@ -55,6 +55,7 @@ #include "AliTOFv2.h" #include "AliTOFv3.h" #include "AliTOFv4.h" +#include "AliMC.h" ClassImp(AliTOFSDigitizer) @@ -272,7 +273,7 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption, Option_t *allEvents) { gAlice->ResetHits(); //PH TH->GetEvent(track); tofHitsBranch->GetEvent(track); - particle = gAlice->Particle(track); + particle = gAlice->GetMCApp()->Particle(track); Int_t nhits = TOFhits->GetEntriesFast(); // cleaning all hits of the same track in the same pad volume // it is a rare event, however it happens diff --git a/TOF/AliTOFT0.cxx b/TOF/AliTOFT0.cxx index 3e292740b70..a4b0ea04b99 100644 --- a/TOF/AliTOFT0.cxx +++ b/TOF/AliTOFT0.cxx @@ -86,6 +86,7 @@ #include "AliTOFT0.h" #include "AliTOFhitT0.h" #include "AliTOFv4T0.h" +#include "AliMC.h" ClassImp(AliTOFT0) @@ -254,7 +255,7 @@ void AliTOFT0::Exec(Option_t *option) gAlice->ResetHits(); TH->GetEvent(track); - particle = gAlice->Particle(track); + particle = gAlice->GetMCApp()->Particle(track); Int_t nhits = TOFhits->GetEntriesFast(); for (Int_t hit = 0; hit < nhits; hit++) @@ -266,7 +267,7 @@ void AliTOFT0::Exec(Option_t *option) if (ipart != ipartold){ - particle = (TParticle*)gAlice->Particle(ipart); + particle = (TParticle*)gAlice->GetMCApp()->Particle(ipart); Float_t idealtime=tofHit->GetTof(); // Float_t time=idealtime; diff --git a/TOF/AliTOFv0.cxx b/TOF/AliTOFv0.cxx index 847461d912a..1fec9745dc0 100644 --- a/TOF/AliTOFv0.cxx +++ b/TOF/AliTOFv0.cxx @@ -57,6 +57,7 @@ #include "AliRun.h" #include "AliTOFv0.h" #include "AliTOFConstants.h" // AdC +#include "AliMC.h" ClassImp(AliTOFv0) @@ -1052,7 +1053,7 @@ void AliTOFv0::StepManager() vol[3]= padx; vol[4]= padz; - AddHit(gAlice->GetCurrentTrackNumber(),vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits); } } diff --git a/TOF/AliTOFv1.cxx b/TOF/AliTOFv1.cxx index 5642e860ea1..8e0b8ee64b7 100644 --- a/TOF/AliTOFv1.cxx +++ b/TOF/AliTOFv1.cxx @@ -58,6 +58,7 @@ #include "AliRun.h" #include "AliTOFv1.h" #include "AliTOFConstants.h" // AdC +#include "AliMC.h" ClassImp(AliTOFv1) @@ -1141,7 +1142,7 @@ void AliTOFv1::StepManager() vol[3]= padx; vol[4]= padz; - AddHit(gAlice->GetCurrentTrackNumber(),vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits); } } diff --git a/TOF/AliTOFv2.cxx b/TOF/AliTOFv2.cxx index f77382614b3..549f7f1f2dc 100644 --- a/TOF/AliTOFv2.cxx +++ b/TOF/AliTOFv2.cxx @@ -58,6 +58,7 @@ #include "AliRun.h" #include "AliTOFv2.h" #include "AliTOFConstants.h" // AdC +#include "AliMC.h" ClassImp(AliTOFv2) @@ -1153,6 +1154,6 @@ void AliTOFv2::StepManager() vol[3]= padx; vol[4]= padz; - AddHit(gAlice->GetCurrentTrackNumber(),vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits); } } diff --git a/TOF/AliTOFv2FHoles.cxx b/TOF/AliTOFv2FHoles.cxx index e50d38a0b7f..7dde1d8f516 100644 --- a/TOF/AliTOFv2FHoles.cxx +++ b/TOF/AliTOFv2FHoles.cxx @@ -58,6 +58,7 @@ #include "AliRun.h" #include "AliTOFv2FHoles.h" #include "AliTOFConstants.h" // AdC +#include "AliMC.h" ClassImp(AliTOFv2FHoles) @@ -1171,6 +1172,6 @@ void AliTOFv2FHoles::StepManager() vol[3]= padx; vol[4]= padz; - AddHit(gAlice->GetCurrentTrackNumber(),vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits); } } diff --git a/TOF/AliTOFv3.cxx b/TOF/AliTOFv3.cxx index 589d27e4aef..c7bf9dd9a91 100644 --- a/TOF/AliTOFv3.cxx +++ b/TOF/AliTOFv3.cxx @@ -57,6 +57,7 @@ #include "AliRun.h" #include "AliTOFv3.h" #include "AliTOFConstants.h" // AdC +#include "AliMC.h" ClassImp(AliTOFv3) @@ -1140,6 +1141,6 @@ void AliTOFv3::StepManager() vol[3]= padx; vol[4]= padz; - AddHit(gAlice->GetCurrentTrackNumber(),vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits); } } diff --git a/TOF/AliTOFv4.cxx b/TOF/AliTOFv4.cxx index 1bafa73cf2b..93ae0ae4d85 100644 --- a/TOF/AliTOFv4.cxx +++ b/TOF/AliTOFv4.cxx @@ -58,6 +58,7 @@ #include "AliRun.h" #include "AliTOFv4.h" #include "AliTOFConstants.h" // AdC +#include "AliMC.h" ClassImp(AliTOFv4) @@ -1140,6 +1141,6 @@ void AliTOFv4::StepManager() vol[3]= padx; vol[4]= padz; - AddHit(gAlice->GetCurrentTrackNumber(),vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits); } } diff --git a/TOF/AliTOFv4T0.cxx b/TOF/AliTOFv4T0.cxx index eb2927ef41d..04155d65204 100644 --- a/TOF/AliTOFv4T0.cxx +++ b/TOF/AliTOFv4T0.cxx @@ -52,6 +52,7 @@ #include "AliRun.h" #include "AliTOFv4T0.h" #include "AliTOFConstants.h" // AdC +#include "AliMC.h" ClassImp(AliTOFv4T0) @@ -1135,6 +1136,6 @@ void AliTOFv4T0::StepManager() vol[3]= padx; vol[4]= padz; - AddT0Hit(gAlice->GetCurrentTrackNumber(),vol, hits); + AddT0Hit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits); } } diff --git a/TPC/AliTPC.cxx b/TPC/AliTPC.cxx index 9a1e1b249ba..8d5521191c4 100644 --- a/TPC/AliTPC.cxx +++ b/TPC/AliTPC.cxx @@ -74,6 +74,7 @@ #include "AliTPCTrackHitsV2.h" #include "AliTPCcluster.h" #include "AliTrackReference.h" +#include "AliMC.h" ClassImp(AliTPC) @@ -138,7 +139,7 @@ AliTPC::AliTPC(const char *name, const char *title) // // Initialise arrays of hits and digits fHits = new TClonesArray("AliTPChit", 176); - gAlice->AddHitList(fHits); + gAlice->GetMCApp()->AddHitList(fHits); fDigitsArray = 0; fClustersArray= 0; fDefaults = 0; @@ -965,7 +966,7 @@ void AliTPC::Hits2Clusters(Int_t /*eventn*/) continue; } ipart=tpcHit->Track(); - particle=gAlice->Particle(ipart); + particle=gAlice->GetMCApp()->Particle(ipart); pl=particle->Pz(); pt=particle->Pt(); if(pt < 1.e-9) pt=1.e-9; @@ -1082,7 +1083,7 @@ void AliTPC::Hits2ExactClustersSector(Int_t isec) SetTreeAddress(); Stat_t ntracks = tH->GetEntries(); - Int_t npart = gAlice->GetNtrack(); + Int_t npart = gAlice->GetMCApp()->GetNtrack(); //MI change TBranch * branch=0; if (fHitType>1) branch = tH->GetBranch("TPC2"); @@ -1119,7 +1120,7 @@ void AliTPC::Hits2ExactClustersSector(Int_t isec) } ipart=tpcHit->Track(); - if (ipartParticle(ipart); + if (ipartGetMCApp()->Particle(ipart); //find row number @@ -2529,12 +2530,12 @@ void AliTPC::AddHit2(Int_t track, Int_t *vol, Float_t *hits) // add hit to the list Int_t rtrack; if (fIshunt) { - int primary = gAlice->GetPrimary(track); - gAlice->Particle(primary)->SetBit(kKeepBit); + int primary = gAlice->GetMCApp()->GetPrimary(track); + gAlice->GetMCApp()->Particle(primary)->SetBit(kKeepBit); rtrack=primary; } else { rtrack=track; - gAlice->FlagTrack(track); + gAlice->GetMCApp()->FlagTrack(track); } //AliTPChit *hit = (AliTPChit*)fHits->UncheckedAt(fNhits-1); //if (hit->fTrack!=rtrack) @@ -2709,7 +2710,7 @@ void AliTPC::LoadPoints2(Int_t) if (fHitType&2) nhits = fTrackHitsOld->GetEntriesFast(); if (nhits == 0) return; - Int_t tracks = gAlice->GetNtrack(); + Int_t tracks = gAlice->GetMCApp()->GetNtrack(); if (fPoints == 0) fPoints = new TObjArray(tracks); AliHit *ahit; // @@ -2784,7 +2785,7 @@ void AliTPC::LoadPoints3(Int_t) // Int_t nhits = fTrackHits->GetEntriesFast(); if (nhits == 0) return; - Int_t tracks = gAlice->GetNtrack(); + Int_t tracks = gAlice->GetMCApp()->GetNtrack(); if (fPoints == 0) fPoints = new TObjArray(2*tracks); fPoints->Expand(2*tracks); AliHit *ahit; diff --git a/TPC/AliTPCtrackerParam.cxx b/TPC/AliTPCtrackerParam.cxx index 3c06e0e7fb8..842817552c4 100644 --- a/TPC/AliTPCtrackerParam.cxx +++ b/TPC/AliTPCtrackerParam.cxx @@ -78,6 +78,7 @@ #include "AliTPCtrack.h" #include "AliTrackReference.h" #include "AliTPCtrackerParam.h" +#include "AliMC.h" //----------------------------- Double_t RegFunc(Double_t *x,Double_t *par) { @@ -305,7 +306,7 @@ Int_t AliTPCtrackerParam::BuildTPCtracks(const TFile *inp, TFile *out) { // loop on particles and store pdg codes for(Int_t l=0; lParticle(l); + Part = (TParticle*)gAlice->GetMCApp()->Particle(l); pdgCodes[l] = Part->GetPdgCode(); ptkine[l] = Part->Pt(); pzkine[l] = Part->Pz(); @@ -1197,7 +1198,7 @@ void AliTPCtrackerParam::CompareTPCtracks( geatree->GetEvent(j); label = geatrack->GetLabel(); - Part = (TParticle*)gAlice->Particle(label); + Part = (TParticle*)gAlice->GetMCApp()->Particle(label); // use only injected tracks with fixed values of pT ptgener = Part->Pt(); diff --git a/TPC/AliTPCv1.cxx b/TPC/AliTPCv1.cxx index 538402fc95e..a34dffca1c2 100644 --- a/TPC/AliTPCv1.cxx +++ b/TPC/AliTPCv1.cxx @@ -46,6 +46,7 @@ #include "AliTPCParamSR.h" #include "AliTPCv1.h" #include "TLorentzVector.h" +#include "AliMC.h" ClassImp(AliTPCv1) @@ -1768,7 +1769,7 @@ void AliTPCv1::StepManager() hits[3]=0.; // this hit has no energy loss // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); - AddHit(gAlice->GetCurrentTrackNumber(), vol,hits); // M.I. + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits); // M.I. gMC->TrackPosition(p); hits[0]=p[0]; @@ -1777,7 +1778,7 @@ void AliTPCv1::StepManager() hits[3]=0.; // this hit has no energy loss // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); - AddHit(gAlice->GetCurrentTrackNumber(), vol,hits); // M.I. + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits); // M.I. } @@ -1786,7 +1787,7 @@ void AliTPCv1::StepManager() hits[3]=1; //I'd like to have something positive here (I.Belikov) // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); - AddHit(gAlice->GetCurrentTrackNumber(), vol,hits); // M.I. + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits); // M.I. } diff --git a/TPC/AliTPCv2.cxx b/TPC/AliTPCv2.cxx index 432b38ae5db..454617f3258 100644 --- a/TPC/AliTPCv2.cxx +++ b/TPC/AliTPCv2.cxx @@ -43,6 +43,7 @@ #include "AliTPCParamSR.h" #include "AliTPCTrackHitsV2.h" #include "AliTPCv2.h" +#include "AliMC.h" ClassImp(AliTPCv2) @@ -1858,7 +1859,7 @@ void AliTPCv2::StepManager() if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting()) && ((id == fIdLSec) || (id == fIdUSec)) ) { - AddTrackReference(gAlice->GetCurrentTrackNumber()); + AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); } if(id == fIdLSec){ @@ -1904,7 +1905,7 @@ void AliTPCv2::StepManager() hits[3]=0.; // this hit has no energy loss // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); - AddHit(gAlice->GetCurrentTrackNumber(), vol,hits); //MI change + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits); //MI change } @@ -1915,7 +1916,7 @@ void AliTPCv2::StepManager() hits[3]=0.; // this hit has no energy loss // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits); - AddHit(gAlice->GetCurrentTrackNumber(), vol,hits); //MI change + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits); //MI change } else return; @@ -1944,7 +1945,7 @@ void AliTPCv2::StepManager() Float_t precision = (momentum>0.1) ? 0.002 :0.01; fTrackHits->SetHitPrecision(precision); } - AddHit(gAlice->GetCurrentTrackNumber(), vol,hits); //MI change + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits); //MI change } diff --git a/TPC/AliTPCv3.cxx b/TPC/AliTPCv3.cxx index 84fe72bdbe7..da2a4856b7c 100644 --- a/TPC/AliTPCv3.cxx +++ b/TPC/AliTPCv3.cxx @@ -44,6 +44,7 @@ #include "AliTPCParamSR.h" #include "AliTPCTrackHitsV2.h" #include "AliTPCv3.h" +#include "AliMC.h" ClassImp(AliTPCv3) //_____________________________________________________________________________ @@ -1680,7 +1681,7 @@ void AliTPCv3::StepManager() // Add this hit - AddHit(gAlice->GetCurrentTrackNumber(), vol,hits); //MI change + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits); //MI change } diff --git a/TRD/AliTRD.cxx b/TRD/AliTRD.cxx index 3a8e4e57ed4..a8fa23b9510 100644 --- a/TRD/AliTRD.cxx +++ b/TRD/AliTRD.cxx @@ -55,6 +55,7 @@ #include "AliTRDrecPoint.h" #include "AliTRDtrackHits.h" #include "AliTrackReference.h" +#include "AliMC.h" ClassImp(AliTRD) @@ -118,7 +119,7 @@ AliTRD::AliTRD(const char *name, const char *title) // Allocate the hit array fHits = new TClonesArray("AliTRDhit" ,405); - gAlice->AddHitList(fHits); + gAlice->GetMCApp()->AddHitList(fHits); // Allocate the digits array fDigits = 0; @@ -844,7 +845,7 @@ void AliTRD::LoadPoints(Int_t ) } if (nhits == 0) return; - Int_t tracks = gAlice->GetNtrack(); + Int_t tracks = gAlice->GetMCApp()->GetNtrack(); if (fPoints == 0) fPoints = new TObjArray(tracks); AliTRDhit *ahit; @@ -1292,13 +1293,13 @@ void AliTRD::AddHit2(Int_t track, Int_t det, Float_t *hits, Int_t q Int_t rtrack; if (fIshunt) { - Int_t primary = gAlice->GetPrimary(track); - gAlice->Particle(primary)->SetBit(kKeepBit); + Int_t primary = gAlice->GetMCApp()->GetPrimary(track); + gAlice->GetMCApp()->Particle(primary)->SetBit(kKeepBit); rtrack = primary; } else { rtrack = track; - gAlice->FlagTrack(track); + gAlice->GetMCApp()->FlagTrack(track); } if ((fTrackHits) && (fHitType > 0)) { diff --git a/TRD/AliTRDpid.cxx b/TRD/AliTRDpid.cxx index c50929ccbda..d42e656693f 100644 --- a/TRD/AliTRDpid.cxx +++ b/TRD/AliTRDpid.cxx @@ -42,6 +42,7 @@ #include "AliTRDtrack.h" #include "AliTRDtracker.h" #include "AliTRDgeometry.h" +#include "AliMC.h" ClassImp(AliTRDpid) @@ -471,7 +472,7 @@ Int_t AliTRDpid::MCpid(const AliTRDtrack *t) } if (accept) { - particle = gAlice->Particle(track0); + particle = gAlice->GetMCApp()->Particle(track0); if (particle->GetFirstMother() == -1) { switch (TMath::Abs(particle->GetPdgCode())) { case kPdgEl: @@ -577,7 +578,7 @@ Int_t AliTRDpid::MCpid(const AliTRDtrack *t, Int_t *pdg Int_t trackIndex = cluster->GetLabel(iTrack); if (trackIndex >= 0) { - particle = gAlice->Particle(trackIndex); + particle = gAlice->GetMCApp()->Particle(trackIndex); Int_t pdgCode = particle->GetPdgCode(); Bool_t newPart = kTRUE; for (iPart = 0; iPart < nPart; iPart++) { diff --git a/TRD/AliTRDsimpleGen.cxx b/TRD/AliTRDsimpleGen.cxx index 1db2cd9a6da..08797125221 100644 --- a/TRD/AliTRDsimpleGen.cxx +++ b/TRD/AliTRDsimpleGen.cxx @@ -30,6 +30,7 @@ #include "AliTRDsimpleGen.h" #include "AliTRDsimpleMC.h" +#include "AliMC.h" ClassImp(AliTRDsimpleGen) @@ -116,7 +117,7 @@ void AliTRDsimpleGen::NewParticle(Int_t ievent) Float_t vtx[3] = { 0.0 }; Float_t pol[3] = { 0.0 }; Int_t ntr = 0; - gAlice->PushTrack(0,-1,fPdg,mom,vtx,pol,0.0,kPPrimary,ntr); + gAlice->GetMCApp()->PushTrack(0,-1,fPdg,mom,vtx,pol,0.0,kPPrimary,ntr); } diff --git a/TRD/AliTRDsimpleMC.cxx b/TRD/AliTRDsimpleMC.cxx index ffd45b47cf0..79fdb6a3974 100644 --- a/TRD/AliTRDsimpleMC.cxx +++ b/TRD/AliTRDsimpleMC.cxx @@ -31,6 +31,7 @@ #include "AliTRDsimpleMC.h" #include "AliTRDv1.h" #include "AliTRDparameter.h" +#include "AliMC.h" ClassImp(AliTRDsimpleMC) @@ -202,7 +203,7 @@ void AliTRDsimpleMC::NewTrack(Int_t iTrack, Int_t pdg fTrackY = 0.0; fTrackZ = 0.0; - gAlice->SetCurrentTrack(0); + gAlice->GetMCApp()->SetCurrentTrack(0); } diff --git a/TRD/AliTRDv0.cxx b/TRD/AliTRDv0.cxx index 1ec364ada06..06ffa3dfc9e 100644 --- a/TRD/AliTRDv0.cxx +++ b/TRD/AliTRDv0.cxx @@ -41,6 +41,7 @@ #include "AliTRDgeometry.h" #include "AliTRDhit.h" #include "AliTRDv0.h" +#include "AliMC.h" ClassImp(AliTRDv0) @@ -176,7 +177,7 @@ void AliTRDv0::StepManager() pla = ((Int_t) idChamber % kNplan); det = fGeometry->GetDetector(pla,cha,sec); - AddHit(gAlice->GetCurrentTrackNumber(),det,hits,0,kTRUE); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),det,hits,0,kTRUE); } diff --git a/TRD/AliTRDv1.cxx b/TRD/AliTRDv1.cxx index 6d2139e003b..f49669b20bb 100644 --- a/TRD/AliTRDv1.cxx +++ b/TRD/AliTRDv1.cxx @@ -44,6 +44,7 @@ #include "AliTRDmatrix.h" #include "AliTRDsim.h" #include "AliTRDv1.h" +#include "AliMC.h" ClassImp(AliTRDv1) @@ -264,7 +265,7 @@ void AliTRDv1::CreateTRhit(Int_t det) // Add the hit to the array. TR photon hits are marked // by negative charge - AddHit(gAlice->GetCurrentTrackNumber(),det,posHit,-q,kTRUE); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),det,posHit,-q,kTRUE); } @@ -553,7 +554,7 @@ void AliTRDv1::StepManager() // momentum components of the particle if (gMC->IsTrackEntering() || gMC->IsTrackExiting()) { gMC->TrackMomentum(mom); - AddTrackReference(gAlice->GetCurrentTrackNumber()); + AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); } // Create the hits from TR photons @@ -570,10 +571,10 @@ void AliTRDv1::StepManager() // Create a new dEdx hit if (drRegion) { - AddHit(gAlice->GetCurrentTrackNumber(),det,hits,qTot,kTRUE); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),det,hits,qTot,kTRUE); } else { - AddHit(gAlice->GetCurrentTrackNumber(),det,hits,qTot,kFALSE); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),det,hits,qTot,kFALSE); } // Calculate the maximum step size for the next tracking step diff --git a/VZERO/AliVZERO.cxx b/VZERO/AliVZERO.cxx index a2ffdacd394..3d906101a20 100755 --- a/VZERO/AliVZERO.cxx +++ b/VZERO/AliVZERO.cxx @@ -33,6 +33,7 @@ #include "AliVZEROLoader.h" #include "AliVZEROdigit.h" #include "AliVZEROhit.h" +#include "AliMC.h" ClassImp(AliVZERO) @@ -50,7 +51,7 @@ AliVZERO::AliVZERO(const char *name, const char *title) fHits = new TClonesArray("AliVZEROhit", 400); fDigits = new TClonesArray("AliVZEROdigit",400); - gAlice->AddHitList(fHits); + gAlice->GetMCApp()->AddHitList(fHits); fThickness = 4.1; // total thickness of the V0R box fThickness1 = 0.7; // thickness of the thickest cell (2.5 in version 0) diff --git a/VZERO/AliVZEROv0.cxx b/VZERO/AliVZEROv0.cxx index f1c447c6fa2..db0e5044e22 100755 --- a/VZERO/AliVZEROv0.cxx +++ b/VZERO/AliVZEROv0.cxx @@ -53,6 +53,7 @@ #include "AliVZEROdigit.h" #include "AliVZEROhit.h" #include "AliVZEROv0.h" +#include "AliMC.h" ClassImp(AliVZEROv0) @@ -1493,7 +1494,7 @@ void AliVZEROv0::StepManager() hits[13] = mom[2]; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } diff --git a/VZERO/AliVZEROv2.cxx b/VZERO/AliVZEROv2.cxx index 258bdee7e95..1a20a6bad40 100755 --- a/VZERO/AliVZEROv2.cxx +++ b/VZERO/AliVZEROv2.cxx @@ -58,6 +58,7 @@ #include "AliVZEROdigit.h" #include "AliVZEROhit.h" #include "AliVZEROv2.h" +#include "AliMC.h" ClassImp(AliVZEROv2) @@ -1052,7 +1053,7 @@ void AliVZEROv2::StepManager() hits[12] = mom[1]; hits[13] = mom[2]; - TParticle *par = gAlice->Particle(gAlice->GetCurrentTrackNumber()); + TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber()); hits[14] = par->Vx(); hits[15] = par->Vy(); hits[16] = par->Vz(); @@ -1067,7 +1068,7 @@ void AliVZEROv2::StepManager() hits[17] = eloss; hits[18] = tlength; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); tlength = 0.0; eloss = 0.0; diff --git a/ZDC/AliGenZDC.cxx b/ZDC/AliGenZDC.cxx index 11e1ae2aa7a..06f094dc9ff 100644 --- a/ZDC/AliGenZDC.cxx +++ b/ZDC/AliGenZDC.cxx @@ -27,6 +27,7 @@ #include "AliConst.h" #include "AliGenZDC.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliGenZDC) @@ -154,7 +155,7 @@ void AliGenZDC::Generate() } Float_t polar[3] = {0,0,0}; - gAlice->PushTrack(fTrackIt,-1,fIpart,fPTrack,fOrigin.GetArray(),polar,0, + gAlice->GetMCApp()->PushTrack(fTrackIt,-1,fIpart,fPTrack,fOrigin.GetArray(),polar,0, kPPrimary,nt); if(fDebugOpt == 1){ printf("\n\n Track momentum:\n"); diff --git a/ZDC/AliZDC.cxx b/ZDC/AliZDC.cxx index ef9f121bf9e..d5915bd6a76 100644 --- a/ZDC/AliZDC.cxx +++ b/ZDC/AliZDC.cxx @@ -51,6 +51,7 @@ #include "AliHeader.h" #include "AliLoader.h" #include "AliRun.h" +#include "AliMC.h" ClassImp(AliZDC) @@ -93,7 +94,7 @@ AliZDC::AliZDC(const char *name, const char *title) // Allocate the hits array fHits = new TClonesArray("AliZDCHit",1000); - gAlice->AddHitList(fHits); + gAlice->GetMCApp()->AddHitList(fHits); // Allocate the merged hits array fMergedHits = new TClonesArray("AliZDCMergedHit",1000); @@ -135,7 +136,7 @@ void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits) if(fNhits==0){ // First hit -> setting flag for primary or secondary particle - Int_t primary = gAlice->GetPrimary(track); + Int_t primary = gAlice->GetMCApp()->GetPrimary(track); if(track != primary){ newquad->fSFlag = 1; // SECONDARY particle entering the ZDC } diff --git a/ZDC/AliZDCv1.cxx b/ZDC/AliZDCv1.cxx index bdc745fa8ce..7a17b80f434 100644 --- a/ZDC/AliZDCv1.cxx +++ b/ZDC/AliZDCv1.cxx @@ -44,6 +44,7 @@ #include "AliRun.h" #include "AliZDCHit.h" #include "AliZDCv1.h" +#include "AliMC.h" ClassImp(AliZDCv1) @@ -1253,7 +1254,7 @@ void AliZDCv1::StepManager() // Int_t PcID = gMC->TrackPid(); // printf("Pc ID -> %d\n",PcID); - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); if(fNoShower==1){ // fpDetected += 1; @@ -1273,13 +1274,13 @@ void AliZDCv1::StepManager() hits[9] = ekin; hits[7] = 0.; hits[8] = 0.; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } else{ hits[9] = destep; hits[7] = 0.; hits[8] = 0.; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } // printf(" Dep. E = %f \n",hits[9]); } @@ -1359,13 +1360,13 @@ void AliZDCv1::StepManager() hits[7] = nphe; //fLightPMQ hits[8] = 0; hits[9] = 0; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } else{ hits[7] = 0; hits[8] = nphe; //fLightPMC hits[9] = 0; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } } else if((vol[0]==2)) { // (2) ZP fibres @@ -1378,13 +1379,13 @@ void AliZDCv1::StepManager() hits[7] = nphe; //fLightPMQ hits[8] = 0; hits[9] = 0; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } else{ hits[7] = 0; hits[8] = nphe; //fLightPMC hits[9] = 0; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } } else if((vol[0]==3)) { // (3) ZEM fibres @@ -1410,7 +1411,7 @@ void AliZDCv1::StepManager() hits[7] = 0; hits[8] = nphe; //fLightPMC hits[9] = 0; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } } } diff --git a/ZDC/AliZDCv2.cxx b/ZDC/AliZDCv2.cxx index eb8eabdb7ef..8a9a4b9c9e7 100644 --- a/ZDC/AliZDCv2.cxx +++ b/ZDC/AliZDCv2.cxx @@ -45,6 +45,7 @@ #include "AliRun.h" #include "AliZDCHit.h" #include "AliZDCv2.h" +#include "AliMC.h" ClassImp(AliZDCv2) @@ -1308,7 +1309,7 @@ void AliZDCv2::StepManager() // Int_t PcID = gMC->TrackPid(); // printf("Pc ID -> %d\n",PcID); - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); if(fNoShower==1){ fpDetected += 1; @@ -1328,13 +1329,13 @@ void AliZDCv2::StepManager() hits[9] = ekin; hits[7] = 0.; hits[8] = 0.; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } else{ hits[9] = destep; hits[7] = 0.; hits[8] = 0.; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } // printf(" Dep. E = %f \n",hits[9]); } @@ -1416,13 +1417,13 @@ void AliZDCv2::StepManager() hits[7] = nphe; //fLightPMQ hits[8] = 0; hits[9] = 0; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } else{ hits[7] = 0; hits[8] = nphe; //fLightPMC hits[9] = 0; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } } else if((vol[0]==2)) { // (2) ZP fibres @@ -1435,13 +1436,13 @@ void AliZDCv2::StepManager() hits[7] = nphe; //fLightPMQ hits[8] = 0; hits[9] = 0; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } else{ hits[7] = 0; hits[8] = nphe; //fLightPMC hits[9] = 0; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } } else if((vol[0]==3)) { // (3) ZEM fibres @@ -1468,13 +1469,13 @@ void AliZDCv2::StepManager() hits[7] = 0; hits[8] = nphe; //fLightPMC (ZEM1) hits[9] = 0; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } else{ hits[7] = nphe; //fLightPMQ (ZEM2) hits[8] = 0; hits[9] = 0; - AddHit(gAlice->GetCurrentTrackNumber(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } } } -- 2.43.0