Line data Source code
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),
34 : kDropUnspecifiedBranches = BIT(15),
35 : kToMerge = BIT(16)
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 0 : Int_t GetNtotal() const {return fNtotal;}
44 0 : Int_t GetNpassed() const {return fNpassed;}
45 0 : const char* GetOutputFileName() const {return TNamed::GetName();}
46 0 : AliAODEvent* GetAOD() const {return fAODEvent;}
47 0 : TTree* GetTree() const {return fTreeE;}
48 : Bool_t Init(Option_t *option);
49 0 : Bool_t IsFilteredAOD() const {return TObject::TestBit(kFilteredAOD);}
50 0 : Bool_t IsEventSelected() const {return fSelected;}
51 0 : Bool_t IsToMerge() const {return TObject::TestBit(kToMerge);}
52 0 : void SelectEvent(Bool_t flag=kTRUE) {fSelected = flag;}
53 : void SetEvent(AliAODEvent* event);
54 0 : void SetOutputFileName(const char* fname) {TNamed::SetName(fname);}
55 0 : void SetToMerge(Bool_t flag) {TObject::SetBit(kToMerge,flag);}
56 0 : void SetTreeBuffSize(Long64_t sz=30000000) {fTreeBuffSize = sz;}
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 0 : void DropUnspecifiedBranches() { TObject::SetBit(kDropUnspecifiedBranches); }
63 :
64 : // Branches not specified in any FilterBranch call will be kept by default
65 0 : 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 0 : void DisableReferences() { fEnableReferences=kFALSE; }
73 :
74 0 : void EnableReferences() { fEnableReferences=kTRUE; }
75 :
76 : void AddAODtoTreeUserInfo();
77 : void FillTree();
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.
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)
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
98 :
99 170 : ClassDef(AliAODExtension, 3) // Support for extra AOD branches in a separate AOD file
100 : };
101 :
102 : #endif
|