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)
38 AliAODExtension(const char* name, const char* title, Bool_t isfilter=kFALSE);
39 virtual ~AliAODExtension();
40 void AddBranch(const char* cname, void* addobj);
42 Int_t GetNtotal() const {return fNtotal;}
43 Int_t GetNpassed() const {return fNpassed;}
44 const char* GetOutputFileName() const {return TNamed::GetName();}
45 AliAODEvent* GetAOD() const {return fAODEvent;}
46 TTree* GetTree() const {return fTreeE;}
47 Bool_t Init(Option_t *option);
48 Bool_t IsFilteredAOD() const {return TObject::TestBit(kFilteredAOD);}
49 Bool_t IsEventSelected() const {return fSelected;}
50 void SelectEvent(Bool_t flag=kTRUE) {fSelected = flag;}
51 void SetEvent(AliAODEvent* event);
52 void SetOutputFileName(const char* fname) {TNamed::SetName(fname);}
55 void Print(Option_t* opt="") const;
57 // Branches not specified in any FilterBranch call will be dropped by default
58 void DropUnspecifiedBranches() { TObject::SetBit(kDropUnspecifiedBranches); }
60 // Branches not specified in any FilterBranch call will be kept by default
61 void KeepUnspecifiedBranches() { TObject::ResetBit(kDropUnspecifiedBranches); }
63 void FilterBranch(const char* branchName, AliAODBranchReplicator* replicator=0x0);
65 /* Use DisableReferences if and only if the output AOD contains no TRef or TRefArray,
66 otherwise the produced AOD won't be valid.
68 void DisableReferences() { fEnableReferences=kFALSE; }
70 void EnableReferences() { fEnableReferences=kTRUE; }
72 void AddAODtoTreeUserInfo();
75 AliAODExtension(const AliAODExtension&); // Not implemented
76 AliAODExtension& operator=(const AliAODExtension&); // Not implemented
79 AliAODEvent *fAODEvent; //! Pointer to the AOD event
80 TTree *fTreeE; //! tree for AOD persistency
81 TFile *fFileE; //! Output file
82 Int_t fNtotal; //! Number of processed events
83 Int_t fNpassed; //! Number of events that passed the filter
84 Bool_t fSelected; //! Select current event for filtered AOD's. Made false at event start.
86 TMap* fRepFiMap; // which branch(es) to filter out / and or replicate
87 TList* fRepFiList; // list of unique filter/replicator
89 Bool_t fEnableReferences; // whether or not to enable the TRefTable branch
90 TList* fObjectList; //! internal list of which objects to keep
92 ClassDef(AliAODExtension, 2) // Support for extra AOD branches in a separate AOD file