]>
Commit | Line | Data |
---|---|---|
14d6fad5 | 1 | #ifndef ALIAODEXTENSION_H |
2 | #define ALIAODEXTENSION_H | |
3 | ||
4 | /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | /* $Id$ */ | |
8 | ||
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 | |
13 | // stored. | |
14 | // Author: Andrei Gheata, CERN | |
15 | //------------------------------------------------------------------------- | |
16 | ||
17 | #ifndef ROOT_TNamed | |
18 | # include "TNamed.h" | |
19 | #endif | |
20 | ||
21 | class AliAODBranchReplicator; | |
22 | class AliAODEvent; | |
23 | class TFile; | |
24 | class TList; | |
25 | class TMap; | |
26 | class TTree; | |
27 | ||
28 | class AliAODExtension : public TNamed { | |
29 | ||
30 | public: | |
31 | ||
32 | enum EAliAODExtensionFlags { | |
33 | kFilteredAOD = BIT(14), | |
0c0825e4 | 34 | kDropUnspecifiedBranches = BIT(15), |
35 | kToMerge = BIT(16) | |
14d6fad5 | 36 | }; |
37 | ||
38 | AliAODExtension(); | |
39 | AliAODExtension(const char* name, const char* title, Bool_t isfilter=kFALSE); | |
40 | virtual ~AliAODExtension(); | |
41 | void AddBranch(const char* cname, void* addobj); | |
42 | Bool_t FinishEvent(); | |
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;} | |
0c0825e4 | 51 | Bool_t IsToMerge() const {return TObject::TestBit(kToMerge);} |
14d6fad5 | 52 | void SelectEvent(Bool_t flag=kTRUE) {fSelected = flag;} |
53 | void SetEvent(AliAODEvent* event); | |
54 | void SetOutputFileName(const char* fname) {TNamed::SetName(fname);} | |
0c0825e4 | 55 | void SetToMerge(Bool_t flag) {TObject::SetBit(kToMerge,flag);} |
92f945a7 | 56 | void SetTreeBuffSize(Long64_t sz=30000000) {fTreeBuffSize = sz;} |
14d6fad5 | 57 | Bool_t TerminateIO(); |
58 | ||
59 | void Print(Option_t* opt="") const; | |
60 | ||
61 | // Branches not specified in any FilterBranch call will be dropped by default | |
62 | void DropUnspecifiedBranches() { TObject::SetBit(kDropUnspecifiedBranches); } | |
63 | ||
64 | // Branches not specified in any FilterBranch call will be kept by default | |
65 | void KeepUnspecifiedBranches() { TObject::ResetBit(kDropUnspecifiedBranches); } | |
66 | ||
67 | void FilterBranch(const char* branchName, AliAODBranchReplicator* replicator=0x0); | |
68 | ||
69 | /* Use DisableReferences if and only if the output AOD contains no TRef or TRefArray, | |
70 | otherwise the produced AOD won't be valid. | |
71 | */ | |
72 | void DisableReferences() { fEnableReferences=kFALSE; } | |
73 | ||
74 | void EnableReferences() { fEnableReferences=kTRUE; } | |
75 | ||
76 | void AddAODtoTreeUserInfo(); | |
92f945a7 | 77 | void FillTree(); |
14d6fad5 | 78 | |
79 | private: | |
80 | AliAODExtension(const AliAODExtension&); // Not implemented | |
81 | AliAODExtension& operator=(const AliAODExtension&); // Not implemented | |
82 | ||
83 | private: | |
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. | |
92f945a7 | 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) | |
14d6fad5 | 92 | |
93 | TMap* fRepFiMap; // which branch(es) to filter out / and or replicate | |
94 | TList* fRepFiList; // list of unique filter/replicator | |
95 | ||
96 | Bool_t fEnableReferences; // whether or not to enable the TRefTable branch | |
97 | TList* fObjectList; //! internal list of which objects to keep | |
92f945a7 | 98 | |
99 | ClassDef(AliAODExtension, 3) // Support for extra AOD branches in a separate AOD file | |
14d6fad5 | 100 | }; |
101 | ||
102 | #endif |