39 #include <TTreeCache.h> 42 #include <TParticle.h> 44 #include <TClonesArray.h> 45 #include <TDirectoryFile.h> 65 fPathName(new TString("./")),
71 fSubsidiaryHandlers(0),
72 fEventsInContainer(0),
73 fPreReadMode(kLmPreRead),
100 fPathName(new TString(
"./")),
106 fSubsidiaryHandlers(0),
107 fEventsInContainer(0),
108 fPreReadMode(kLmPreRead),
135 if (!(strcmp(opt,
"proof")) || !(strcmp(opt,
"local")))
return kTRUE;
137 if (
fPathName->BeginsWith(
"alien://") && !gGrid && !TGrid::Connect(
"alien://")) {
138 AliFatal(
"Failed to connect to alien");
142 AliError(Form(
"AliMCEventHandler:galice.root not found in directory %s ! \n",
fPathName->Data()));
151 AliInfo(
"galice.root contains paths of background for embedding");
152 embBKGPaths->Print();
153 for (
int ib=0;ib<embBKGPaths->GetEntriesFast();ib++) {
157 TString pth = gSystem->DirName(embBKGPaths->At(ib)->GetName());
159 if ( !pth.BeginsWith(
"/") && !pth.BeginsWith(
"alien://")) {
161 if (pths.EndsWith(
"#")) {
162 int indSl = pths.Last(
'/')+1;
163 if (!pth.EndsWith(
"/")) pth +=
"/";
164 pths.Insert(indSl,pth);
188 AliError(Form(
"AliMCEventHandler:Kinematics.root not found in directory %s ! \n",
fPathName->Data()));
199 AliError(Form(
"AliMCEventHandler:TrackRefs.root not found in directory %s ! \n",
fPathName->Data()));
208 AliInfo(Form(
"Number of events in this directory %5d \n",
fNEvent));
233 Bool_t firsttree = (
fTreeK==0) ? kTRUE : kFALSE;
244 snprintf(folder, 20,
"Event%d", iev);
250 AliWarning(Form(
"AliMCEventHandler: Event #%5d - Cannot get kinematics\n", iev));
256 AliError(Form(
"AliMCEventHandler: Event #%5d - Cannot get TreeK\n",iev));
266 AliError(Form(
"AliMCEventHandler: Event #%5d - Cannot get track references\n",iev));
273 AliError(Form(
"AliMCEventHandler: Event #%5d - Cannot get TreeTR\n",iev));
283 TTreeCache::SetLearnEntries(1);
284 fTreeK->AddBranchToCache(
"*",kTRUE);
285 if (firsttree) Info(
"LoadEvent",
"Read cache enabled %lld bytes for TreeK",
fCacheSize);
289 TTreeCache::SetLearnEntries(1);
290 fTreeTR->AddBranchToCache(
"*",kTRUE);
291 if (firsttree) Info(
"LoadEvent",
"Read cache enabled %lld bytes for TreeTR",
fCacheSize);
362 AliWarning(Form(
"AliMCEventHandler: Event number out of range %5lld %5d\n", entry,
fNEvent));
371 if (repFactor>0) entry /= repFactor;
380 if (!handler->
MCEvent())
continue;
438 return fLabelMap.GetValue(TMath::Abs(i));
502 TString dirname = gSystem->DirName(fileName);
503 TString basename = gSystem->BaseName(fileName);
504 Int_t index = basename.Index(
"#");
505 basename = basename(0, index+1);
508 fileName += basename;
526 if (spath->Contains(
"merged")) {
611 TString tmps =
fname;
615 else if (!tmps.EndsWith(
"#")) {
616 if (!tmps.EndsWith(
"/")) tmps +=
"/";
TFile * fFileTR
File with TreeK.
virtual void AddSubsidiaryEvent(AliMCEvent *event)
virtual void SetPreReadMode(PreReadMode_t mode)
TFile * Open(const char *filename, Long64_t &nevents)
virtual void SetReadTR(Bool_t flag)
virtual Int_t GetNumberOfPrimaries() const
virtual void FinishEvent()
TTree * fTreeE
File with TreeTR.
virtual void DrawCheck(Int_t i, Int_t search)
Bool_t IsParticleSelected(Int_t i)
Int_t fFileNumber
File name extension.
TTree * fTreeK
TreeE (Event Headers)
TExMap fParticleSelected
Directory for TR Tree.
virtual Bool_t FinishEvent()
virtual void ConnectTreeK(TTree *tree)
TString * fPathName
Current event.
virtual void ConnectTreeTR(TTree *tree)
static void AddParticlesToPdgDataBase()
virtual Int_t BgLabelToIndex(Int_t label)
TList * fSubsidiaryHandlers
#define AliInfoF(message,...)
virtual Int_t GetMother() const
void DrawCheck(Int_t i, Int_t search=0)
TString fileName(const char *dir, int runNumber, const char *da, int i, const char *type)
virtual Bool_t LoadEvent(Int_t iev)
virtual void ConnectTreeE(TTree *tree)
TExMap fLabelMap
List of selected MC particles for t.
#define AliWarning(message)
virtual Bool_t BeginEvent(Long64_t entry)
static const char * GetEmbeddingBKGPathsKey()
Int_t fEventsPerFile
Input file number.
Int_t fNEvent
Stores the Map of MC (ESDLabel,AODlabel)
virtual Int_t GetParticleAndTR(Int_t i, TParticle *&particle, TClonesArray *&trefs)
TDirectoryFile * fDirTR
Directory for Kine Tree.
const Char_t * fkExtension
Input file path.
virtual AliVParticle * GetTrack(Int_t i) const
virtual ~AliMCEventHandler()
static Int_t BgLabelOffset()
TTreeCache * fCacheTR
Cache for kinematics tree.
Int_t fEvent
Number of events.
virtual Bool_t Init(Option_t *opt)
void SelectParticle(Int_t i)
#define AliFatal(message)
Int_t fEventsInContainer
List of subsidiary MC handlers (for example for Background)
TTree * fTreeTR
TreeK (kinematics tree)
virtual Int_t GetNumberOfTracks() const
PreReadMode_t fPreReadMode
Number of events in container class.
Int_t GetNewLabel(Int_t i)
virtual Bool_t InitIO(Option_t *opt)
virtual void PreReadAll()
AliMCEvent * MCEvent() const
TFile * fFileK
File with TreeE.
Int_t GetParticleAndTR(Int_t i, TParticle *&particle, TClonesArray *&trefs)
virtual void AddSubsidiaryHandler(AliMCEventHandler *handler)
virtual Bool_t TerminateIO()
#define AliError(message)
virtual void SetInputPath(const char *fname)
Bool_t fReadTR
Number of events per file.
void VerifySelectedParticles()
TDirectoryFile * fDirK
TreeTR (track references tree)
virtual Bool_t Terminate()
virtual TString * GetInputPath() const