1 #ifndef ALIAODEXTENSION_H
2 #define ALIAODEXTENSION_H
4 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
9 //-------------------------------------------------------------------------
10 // Support class for AOD extensions. This is created by the user analysis
11 // that requires a separate file for some AOD branches. The name of the
12 // AliAODExtension object is the file name where the AOD branches will be
14 // Author: Andrei Gheata, CERN
15 //-------------------------------------------------------------------------
21 class AliAODBranchReplicator;
28 class AliAODExtension : public TNamed {
32 enum EAliAODExtensionFlags {
33 kFilteredAOD = BIT(14),
34 kDropUnspecifiedBranches = BIT(15),
39 AliAODExtension(const char* name, const char* title, Bool_t isfilter=kFALSE);
40 virtual ~AliAODExtension();
41 void AddBranch(const char* cname, void* addobj);
43 Int_t GetNtotal() const {return fNtotal;}
44 Int_t GetNpassed() const {return fNpassed;}
45 const char* GetOutputFileName() const {return TNamed::GetName();}
46 AliAODEvent* GetAOD() const {return fAODEvent;}
47 TTree* GetTree() const {return fTreeE;}
48 Bool_t Init(Option_t *option);
49 Bool_t IsFilteredAOD() const {return TObject::TestBit(kFilteredAOD);}
50 Bool_t IsEventSelected() const {return fSelected;}
51 Bool_t IsToMerge() const {return TObject::TestBit(kToMerge);}
52 void SelectEvent(Bool_t flag=kTRUE) {fSelected = flag;}
53 void SetEvent(AliAODEvent* event);
54 void SetOutputFileName(const char* fname) {TNamed::SetName(fname);}
55 void SetToMerge(Bool_t flag) {TObject::SetBit(kToMerge,flag);}
56 void SetTreeBuffSize(Long64_t sz=30000000) {fTreeBuffSize = sz;}
59 void Print(Option_t* opt="") const;
61 // Branches not specified in any FilterBranch call will be dropped by default
62 void DropUnspecifiedBranches() { TObject::SetBit(kDropUnspecifiedBranches); }
64 // Branches not specified in any FilterBranch call will be kept by default
65 void KeepUnspecifiedBranches() { TObject::ResetBit(kDropUnspecifiedBranches); }
67 void FilterBranch(const char* branchName, AliAODBranchReplicator* replicator=0x0);
69 /* Use DisableReferences if and only if the output AOD contains no TRef or TRefArray,
70 otherwise the produced AOD won't be valid.
72 void DisableReferences() { fEnableReferences=kFALSE; }
74 void EnableReferences() { fEnableReferences=kTRUE; }
76 void AddAODtoTreeUserInfo();
80 AliAODExtension(const AliAODExtension&); // Not implemented
81 AliAODExtension& operator=(const AliAODExtension&); // Not implemented
84 AliAODEvent *fAODEvent; //! Pointer to the AOD event
85 TTree *fTreeE; //! tree for AOD persistency
86 TFile *fFileE; //! Output file
87 Int_t fNtotal; //! Number of processed events
88 Int_t fNpassed; //! Number of events that passed the filter
89 Bool_t fSelected; //! Select current event for filtered AOD's. Made false at event start.
90 Long64_t fTreeBuffSize; // Requested buffer size for AOD tree
91 Long64_t fMemCountAOD; // Number of bytes filled in tree (accumulates until requested bytes reached)
93 TMap* fRepFiMap; // which branch(es) to filter out / and or replicate
94 TList* fRepFiList; // list of unique filter/replicator
96 Bool_t fEnableReferences; // whether or not to enable the TRefTable branch
97 TList* fObjectList; //! internal list of which objects to keep
99 ClassDef(AliAODExtension, 3) // Support for extra AOD branches in a separate AOD file