43 #include "Riostream.h" 55 fFillExtension(kTRUE),
56 fNeedsHeaderReplication(kFALSE),
57 fNeedsTOFHeaderReplication(kFALSE),
58 fNeedsVZEROReplication(kFALSE),
59 fNeedsTracksBranchReplication(kFALSE),
60 fNeedsVerticesBranchReplication(kFALSE),
61 fNeedsV0sBranchReplication(kFALSE),
62 fNeedsCascadesBranchReplication(kFALSE),
63 fNeedsTrackletsBranchReplication(kFALSE),
64 fNeedsPMDClustersBranchReplication(kFALSE),
65 fNeedsJetsBranchReplication(kFALSE),
66 fNeedsFMDClustersBranchReplication(kFALSE),
67 fNeedsCaloClustersBranchReplication(kFALSE),
68 fNeedsCaloTriggerBranchReplication(kFALSE),
69 fNeedsMCParticlesBranchReplication(kFALSE),
70 fNeedsDimuonsBranchReplication(kFALSE),
71 fNeedsHMPIDBranchReplication(kFALSE),
72 fAODIsReplicated(kFALSE),
73 fTreeBuffSize(30000000),
92 fFillExtension(kTRUE),
93 fNeedsHeaderReplication(kFALSE),
94 fNeedsTOFHeaderReplication(kFALSE),
95 fNeedsVZEROReplication(kFALSE),
96 fNeedsTracksBranchReplication(kFALSE),
97 fNeedsVerticesBranchReplication(kFALSE),
98 fNeedsV0sBranchReplication(kFALSE),
99 fNeedsCascadesBranchReplication(kFALSE),
100 fNeedsTrackletsBranchReplication(kFALSE),
101 fNeedsPMDClustersBranchReplication(kFALSE),
102 fNeedsJetsBranchReplication(kFALSE),
103 fNeedsFMDClustersBranchReplication(kFALSE),
104 fNeedsCaloClustersBranchReplication(kFALSE),
105 fNeedsCaloTriggerBranchReplication(kFALSE),
106 fNeedsMCParticlesBranchReplication(kFALSE),
107 fNeedsDimuonsBranchReplication(kFALSE),
108 fNeedsHMPIDBranchReplication(kFALSE),
109 fAODIsReplicated(kFALSE),
110 fTreeBuffSize(30000000),
157 TDirectory *owd = gDirectory;
158 if (option.Contains(
"proof")) {
161 gROOT->ProcessLine(Form(
"AliAnalysisDataContainer *c_common_out = AliAnalysisManager::GetAnalysisManager()->GetCommonOutputContainer();"));
162 gROOT->ProcessLine(Form(
"AliAnalysisManager::GetAnalysisManager()->OpenProofFile(c_common_out, \"RECREATE\");"));
181 filteredAOD->
Init(option);
197 cout << opt <<
fExtensions->GetEntries() <<
" extensions :" << endl;
202 cout << opt <<
fFilters->GetEntries() <<
" filters :" << endl;
214 while ( ( ext = static_cast<AliAODExtension*>(next()) ) )
268 mcHeader->
SetVertex(vtxMC[0],vtxMC[1],vtxMC[2]);
272 if(genCocktailHeader){
275 TList* headerList = genCocktailHeader->
GetHeaders();
279 AliFatal(
"AliGenEventHeader entry not found in the header list");
305 TClonesArray& l = *mcarray;
307 for(
int i = 0; i < np; ++i){
339 }
else if(d1 < 0 && d0 >= 0) {
349 else if (d0 > 0 && d1 > 0 ){
354 for(
int id = d0;
id<=d1;++id){
367 AliError(Form(
"Unxpected indices %d %d",d0,d1));
374 else AliError(Form(
"PROBLEM Mother not selected %d \n", m));
381 AliInfo(Form(
"AliAODHandler::StoreMCParticles: Selected %d (Primaries %d / total %d) after validation \n",
393 if(!track)
AliFatal(
"Not a standard AOD");
404 if(label > np || track->
GetLabel() == 0){
415 for (Int_t i = 0; i < 3; i++) {
417 Int_t nlabel = label;
418 if (label < 0)
continue;
420 if(nlabel > np || label == 0) {
421 AliWarning(Form(
"Wrong TOF label %5d (%5d)", label, nlabel));
425 AliWarning(Form(
"New TOF label not found for %5d %5d, Track label was: %5d",i, label, labelT));
426 tofLabel[i] = -label;
428 tofLabel[i] = labelN;
443 Int_t* labels =
const_cast<Int_t*
>(cluster->
GetLabels());
445 for(UInt_t i = 0;i < nLabel;++i){
454 Int_t iCell, nCell, cellMCLabel, cellMCLabelNew;;
456 Double_t cellE, cellT, cellEFrac;
463 for( iCell = 0; iCell < nCell; iCell++ ){
464 cells->
GetCell( iCell, cellAbsId, cellE, cellT, cellMCLabel, cellEFrac );
466 if( cellMCLabel < 0 )
467 cellMCLabelNew = cellMCLabel;
471 cells->
SetCell( iCell, cellAbsId, cellE, cellT, cellMCLabelNew, cellEFrac );
478 for( iCell = 0; iCell < nCell; iCell++ ){
479 cells->
GetCell( iCell, cellAbsId, cellE, cellT, cellMCLabel, cellEFrac );
481 if( cellMCLabel < 0 )
482 cellMCLabelNew = cellMCLabel;
486 cells->
SetCell( iCell, cellAbsId, cellE, cellT, cellMCLabelNew, cellEFrac );
494 int label0 = tracklets->
GetLabel(it,0);
495 int label1 = tracklets->
GetLabel(it,1);
540 if(mcarray) mcarray->Delete();
543 if(mcHeader) mcHeader->
Reset();
560 while ((ext=static_cast<AliAODExtension*>(nextF())))
566 while ((ext=static_cast<AliAODExtension*>(nextE())))
590 while ((ext=static_cast<AliAODExtension*>(nextF())))
596 while ((ext=static_cast<AliAODExtension*>(nextE())))
609 fTreeA =
new TTree(
"aodTree",
"AliAOD tree");
611 if (flag == 0)
fTreeA->SetDirectory(0);
621 Long64_t nbf =
fTreeA->Fill();
623 nbf =
fTreeA->GetZipBytes();
624 if (nbf>0) nbf = -nbf;
625 else nbf =
fTreeA->GetEntries();
626 fTreeA->SetAutoFlush(nbf);
627 AliInfo(Form(
"Calling fTreeA->SetAutoFlush(%lld) | W:%lld T:%lld Z:%lld",
649 if (strlen(filename))
664 TDirectory *owd = gDirectory;
670 char** apointer = (
char**) addobj;
671 TObject* obj = (TObject*) *apointer;
675 const Int_t kSplitlevel = 99;
676 const Int_t kBufsize = 32000;
678 if (!
fTreeA->FindBranch(obj->GetName()))
684 kBufsize, kSplitlevel - 1);
694 TString
fname(filename);
695 if (!fname.EndsWith(
".root")) fname +=
".root";
766 static TString eoutputs;
772 if (merge && !obj->
IsToMerge())
continue;
773 if (!eoutputs.IsNull()) eoutputs +=
",";
774 eoutputs += obj->GetName();
780 if (merge && !obj->
IsToMerge())
continue;
781 if (!eoutputs.IsNull()) eoutputs +=
",";
782 eoutputs += obj->GetName();
785 return eoutputs.Data();
806 if(!genHeader)
return;
808 if (pythiaGenHeader) {
816 if (dpmJetGenHeader){
Class for calorimeter cluster, EMCal and PHOS, data handling.
virtual Int_t GetMother() const
virtual const char * GetExtraOutputs(Bool_t merge=kTRUE) const
void CreateTree(Int_t flag)
void PrintExtensions(const TObjArray &array) const
Implementation of the Event Handler Interface for AOD.
virtual Bool_t IsPhysicalPrimary(Int_t i) const
void AddBranch(const char *cname, void *addobj)
virtual Int_t GetNumberOfPrimaries() const
Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time, Int_t &mclabel, Double_t &efrac) const
void MakeEntriesReferencable()
Bool_t HasExtensions() const
void SetEvent(AliAODEvent *event)
Bool_t fAODIsReplicated
Flag true if replication as been executed.
Int_t GetNumberOfCaloClusters() const
Class for calorimeter cell AOD data handling.
Bool_t IsParticleSelected(Int_t i)
void ResetStd(Int_t trkArrSize=0, Int_t vtxArrSize=0, Int_t v0ArrSize=0, Int_t cascadeArrSize=0, Int_t jetSize=0, Int_t caloClusSize=0, Int_t fmdClusSize=0, Int_t pmdClusSize=0, Int_t hmpidRingsSize=0, Int_t dimuonArrsize=0, Int_t nTrdTracks=0)
UInt_t GetNLabels() const
virtual Bool_t IsSecondaryFromMaterial(Int_t index)
AliAODTracklets * GetTracklets() const
TClonesArray * GetTracks() const
void SetMCProcessCode(UInt_t mcProcess)
AliAODExtension * GetFilteredAOD(const char *filename) const
Int_t GetLabelAt(UInt_t i) const
TString fFileName
Output file name.
Float_t ImpactParameter() const
virtual Int_t BgLabelToIndex(Int_t label)
virtual Int_t GetNumberOfTracklets() const
virtual const char * GetOutputFileName() const
Bool_t fIsStandard
Flag for standard aod creation.
static const char * StdBranchName()
#define AliWarning(message)
AliAODExtension * AddExtension(const char *filename, const char *title="", Bool_t tomerge=kFALSE)
virtual Bool_t FinishEvent()
AliVParticle realisation for MC Particles in the AOD.
AliAODExtension * GetExtension(const char *filename) const
virtual Int_t GetDaughter(Int_t i) const
AOD class to store tracklets.
virtual Int_t GetLabel(Int_t i, Int_t layer) const
virtual void SetLabel(Int_t i, Int_t layer, Int_t label)
void SetMCHeaderInfo(AliAODMCHeader *mcHeader, AliGenEventHeader *genHeader)
void AddObject(TObject *obj)
void SetTOFLabel(const Int_t *p)
AliAODCaloCluster * GetCaloCluster(Int_t nCluster) const
virtual Bool_t Init(Option_t *option)
virtual AliVParticle * GetTrack(Int_t i) const
static Int_t BgLabelOffset()
TObject * FindListObject(const char *objName) const
void SetLabel(Int_t label)
AliAODEvent * fAODEvent
! Pointer to the AOD event
AliAODCaloCells * GetPHOSCells() const
TTree * fTreeA
! tree for AOD persistency
AliMCEventHandler * fMCEventH
! Pointer to mc event handler needed not to depend on the manager
virtual void SetMother(Int_t im)
void AddAODtoTreeUserInfo()
Short_t GetNumberOfCells() const
TObjArray * fExtensions
List of extensions.
Int_t * GetLabels() const
Long64_t fMemCountAOD
! accumulated AOD size before AutoSave
#define AliFatal(message)
void AddAODtoTreeUserInfo()
void Print(Option_t *opt="") const
void SetStatus(Int_t status)
virtual Int_t GetNumberOfTracks() const
void GetTOFLabel(Int_t *p) const
Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time, Int_t mclabel=-1, Double_t efrac=0., Bool_t isHG=kFALSE)
virtual void SetDaughter(Int_t i, Int_t id)
Int_t GetNewLabel(Int_t i)
void Print(Option_t *opt="") const
Bool_t Init(Option_t *option)
virtual TParticle * Particle() const
TClonesArray * GetCaloClusters() const
AliMCEvent * MCEvent() const
void AddBranch(const char *cname, void *addobj, const char *fname="")
virtual void SetOutputFileName(const char *fname)
virtual Bool_t Terminate()
AliAODCaloCells * GetEMCALCells() const
Bool_t fFillExtension
Flag for filling or the delta AOD tree at the end.
virtual Bool_t TerminateIO()
Bool_t fFillAOD
Flag for filling of the AOD tree at the end (all or nothing evt by evt)
#define AliError(message)
void SetToMerge(Bool_t flag)
AliAODExtension * AddFilteredAOD(const char *filename, const char *filtername, Bool_t tomerge=kFALSE)
AliVTrack * GetTrack(Int_t nTrack) const
Bool_t fFillAODRun
Flag for filling of the AOD tree at the end (run)
virtual Bool_t IsSecondaryFromWeakDecay(Int_t index)
TFile * fFileA
! Output file
AOD track implementation of AliVTrack.
Long64_t fTreeBuffSize
allowed uncompressed buffer size per tree
Int_t GetNumberOfTracks() const
TObjArray * fFilters
List of filtered AOD's.
Support class for AOD extensions. This is created by the user analysis.