//______________________________________________________________________________
AliAODExtension::AliAODExtension() : TNamed(),
fAODEvent(0), fTreeE(0), fFileE(0), fNtotal(0), fNpassed(0),
-fSelected(kFALSE), fRepFiMap(0x0), fRepFiList(0x0), fEnableReferences(kTRUE), fObjectList(0x0)
+fSelected(kFALSE), fTreeBuffSize(30000000), fMemCountAOD(0),
+fRepFiMap(0x0), fRepFiList(0x0), fEnableReferences(kTRUE)
{
// default ctor
}
fNtotal(0),
fNpassed(0),
fSelected(kFALSE),
+fTreeBuffSize(30000000),
+fMemCountAOD(0),
fRepFiMap(0x0),
fRepFiList(0x0),
fEnableReferences(kTRUE),
fNtotal++;
if (!IsFilteredAOD()) {
fAODEvent->MakeEntriesReferencable();
- fTreeE->Fill();
+ FillTree();
return kTRUE;
}
// Filtered AOD. Fill only if event is selected.
repfi->ReplicateAndFilter(*fAODEvent);
}
fNpassed++;
- fTreeE->Fill();
+ FillTree();
fSelected = kFALSE; // so that next event will not be selected unless demanded
return kTRUE;
}
+//______________________________________________________________________________
+void AliAODExtension::FillTree()
+{
+ //
+ // Fill AOD extension tree and check AutoFlush settings
+ //
+
+ Long64_t nbf = fTreeE->Fill();
+
+ // Check buffer size and set autoflush if fTreeBuffSize is reached
+ if (fTreeBuffSize>0 && fTreeE->GetAutoFlush()<0 &&
+ (fMemCountAOD += nbf)>fTreeBuffSize ) { // default limit is still not reached
+ nbf = fTreeE->GetZipBytes();
+ if (nbf>0) nbf = -nbf;
+ else nbf = fTreeE->GetEntries();
+ fTreeE->SetAutoFlush(nbf);
+ AliInfo(Form("Calling fTreeE->SetAutoFlush(%lld) | W:%lld T:%lld Z:%lld",
+ nbf,fMemCountAOD,fTreeE->GetTotBytes(),fTreeE->GetZipBytes()));
+
+ }
+}
+
//______________________________________________________________________________
Bool_t AliAODExtension::Init(Option_t *option)
{
void SelectEvent(Bool_t flag=kTRUE) {fSelected = flag;}
void SetEvent(AliAODEvent* event);
void SetOutputFileName(const char* fname) {TNamed::SetName(fname);}
+ void SetTreeBuffSize(Long64_t sz=30000000) {fTreeBuffSize = sz;}
Bool_t TerminateIO();
void Print(Option_t* opt="") const;
void EnableReferences() { fEnableReferences=kTRUE; }
void AddAODtoTreeUserInfo();
+ void FillTree();
private:
AliAODExtension(const AliAODExtension&); // Not implemented
Int_t fNtotal; //! Number of processed events
Int_t fNpassed; //! Number of events that passed the filter
Bool_t fSelected; //! Select current event for filtered AOD's. Made false at event start.
+ Long64_t fTreeBuffSize; // Requested buffer size for AOD tree
+ Long64_t fMemCountAOD; // Number of bytes filled in tree (accumulates until requested bytes reached)
TMap* fRepFiMap; // which branch(es) to filter out / and or replicate
TList* fRepFiList; // list of unique filter/replicator
Bool_t fEnableReferences; // whether or not to enable the TRefTable branch
TList* fObjectList; //! internal list of which objects to keep
-
- ClassDef(AliAODExtension, 2) // Support for extra AOD branches in a separate AOD file
+
+ ClassDef(AliAODExtension, 3) // Support for extra AOD branches in a separate AOD file
};
#endif