#include "IAnalysisModuleBase.hxx" ClassImp(COMET::IAnalysisModuleBase); COMET::IAnalysisModuleBase::IAnalysisModuleBase(): TNamed("Undefined: Problem in derived class!", "Undefined: Problem in derived class!"), fIsEnabled(kFALSE), fIsUsedForPreselection(kFALSE), fOutputTree(NULL), fBufferSize(32000), fSplitLevel(99), fDescription("Undefined"), fCVSTagName("Undefined: Problem in derived class!"), fCVSID("Undefined: Problem in derived class!") { } COMET::IAnalysisModuleBase::~IAnalysisModuleBase() {} Bool_t COMET::IAnalysisModuleBase::Configure(std::string &option) { COMETError("No configurable options defined for this class"); return kFALSE; } std::string const COMET::IAnalysisModuleBase::GetDirectoryName() const { switch (GetTreeType()) { case kHeader: return "HeaderDir"; case kTruth: return "TruthDir"; case kRecon: return "ReconDir"; case kLowLevel: return "LowLevelDir"; default: throw COMET::EUndefinedTreeType(); } } void COMET::IAnalysisModuleBase::Initialize(TTree *tree) { fOutputTree = tree; // Fix to bug 386 fOutputTree->SetAutoFlush(3000000); InitializeModule(); fOutputTree->Branch("RunID", &fRunID, "RunID/I", fBufferSize); fOutputTree->Branch("EventID", &fEventID, "EventID/I", fBufferSize); fOutputTree->Branch("Preselected", &fPreselected, "Preselected/B", fBufferSize); fOutputTree->Branch("SubrunID", &fSubrunID, "SubrunID/I", fBufferSize); InitializeBranches(); } bool COMET::IAnalysisModuleBase::Process(COMET::ICOMETEvent& event) { fRunID = event.GetRunId(); fEventID = event.GetEventId(); fSubrunID = event.GetContext().GetSubRun(); if(!FillTree(event)){ throw EAnalysisFailure(); } fPreselected = IsFullEventWorthSaving(event); fOutputTree->Fill(); return fPreselected; } bool COMET::IAnalysisModuleBase::IsFullEventWorthSaving(COMET::ICOMETEvent& event){ return false; // Do not save the main event tree entry by default, just the analysis one } Bool_t COMET::IAnalysisModuleBase::ProcessFirstEvent(COMET::ICOMETEvent&) { return true; } void COMET::IAnalysisModuleBase::Print() { // override this function if more details need to be printed out COMETLog("Module: " << GetName() << (IsEnabled() ? " (Enabled) " : " (Disabled) ") << (IsUsedForPreselection() ? " (Preselecting) " : " (Not Preselecting) ")); COMETLog(" Description: " << GetDescription()); }