#ifndef ATLAS_AtlSelector
#define ATLAS_AtlSelector
#ifndef ROOT_TSelector
#include <TSelector.h>
#endif
#ifndef ROOT_TList
#include <TList.h>
#endif
#ifndef ROOT_TChain
#include <TChain.h>
#endif
#ifndef ROOT_TFile
#include <TFile.h>
#endif
#ifndef ROOT_TStopwatch
#include <TStopwatch.h>
#endif
#ifndef ATLAS_AtlEvent
#include <AtlEvent.h>
#endif
#ifndef ATLAS_AtlAnalysisTool
#include <AtlAnalysisTool.h>
#endif
#ifndef ATLAS_AtlTriggerConf
#include <AtlTriggerConf.h>
#endif
#ifndef ROOT_TEntryList
#include <TEntryList.h>
#endif
#ifndef ROOT_TH1F
#include <TH1F.h>
#endif
#ifndef ROOT_TH1D
#include <TH1D.h>
#endif
class TString;
class TROOT;
class TSystem;
class AtlEvtReaderBase;
class AtlEvtWriterBase;
class TChainElement;
class AtlSelector : public TSelector {
public:
enum EIOMode { kApp,
kD3PDSgTop,
kD3PDSgTop_v2,
kD3PDCKM,
kMemNtuple,
kCustom,
};
static const Int_t fgNumLepChannels = 2;
static const Int_t fgNumJetMults = 11;
enum ELepChannel {
kElectron = BIT(0),
kMuon = BIT(1),
kLepton = BIT(2)
};
enum EJetMult {
kOneJet = BIT(0),
kTwoJet = BIT(1),
kThreeJet = BIT(2),
kFourJet = BIT(3),
kFiveJet = BIT(4),
kSixJet = BIT(5),
k4To6Jets = BIT(6),
kOneOrMoreJets = BIT(7),
kTwoOrMoreJets = BIT(8),
kThreeOrMoreJets = BIT(9),
kAllJets = BIT(10)
};
Bool_t fDoTruthTree;
protected:
EIOMode fInputMode;
EIOMode fOutputMode;
TTree *fTree;
TTree *fCurrentTree;
TObjArray *fBookkeepingList;
Int_t fNBookkeeping;
AtlEvtReaderBase *fEvtReader;
AtlEvtReaderBase *fEvtReaderUser;
AtlEvtWriterBase *fEvtWriter;
AtlEvent *fEvent;
TFile *fOutputFile;
TString *fOutputFilename;
Bool_t fIsChain;
TString *fOutputTreeName;
TString *fOutputTreeTitle;
TTree *fOutputTree;
TTree *fOutputTriggerConfTree;
Int_t fProcessedEvents;
Int_t fAcceptedEvents;
Int_t fPreAcceptedEvents;
Int_t fJetBinEvents;
Float_t fProcessedEventsW;
Float_t fAcceptedEventsW;
Float_t fAcceptedEventsB;
Float_t fPreAcceptedEventsW;
Float_t fJetBinEventsW;
Float_t fPreTaggedEvents;
Float_t fPreTaggedEventsW;
TStopwatch fStopwatch;
Long64_t fEntry;
TList *fListOfTools;
Bool_t fWriteEntryList;
TEntryList *fEntryList;
TH1F *fHistEvents;
TH1F *fHistEvtWeights;
TH1D *fHistCutflow_NoWeights;
TH1D *fHistCutflow_genWeights;
TH1D *fHistCutflow_genXpileupWeights;
TH1D *fHistCutflow_genXpileupXzvertexWeights;
TH1D *fHistCutflow_allEventsHFOR_NoWeights;
TH1D *fHistCutflow_allEventsHFOR_genWeights;
ProcInfo_t *fProcInfo;
MemInfo_t *fMemInfo;
Bool_t fPrintEvent;
Bool_t fPrintObjectTable;
Bool_t fPassedSelection;
Bool_t fCountUnfilteredEvents;
public:
AtlSelector(const char* OutputFilename);
virtual ~AtlSelector();
virtual Int_t Version() const { return 2; }
virtual void Begin(TTree *tree);
virtual void SlaveBegin(TTree *tree);
virtual void Init(TTree *tree = 0);
virtual Bool_t Notify();
virtual Bool_t Process(Long64_t entry);
virtual void SetOption(const char *option) { fOption = option; }
virtual void SetObject(TObject *obj) { fObject = obj; }
virtual void SetInputList(TList *input) { fInput = input; }
virtual TList* GetOutputList() const { return fOutput; }
virtual void SlaveTerminate();
virtual void Terminate();
virtual void SetBranchStatus() = 0;
virtual void InitEvent() {;}
virtual void BookHistograms() = 0;
virtual void FillHistograms() = 0;
virtual void ProcessFill();
virtual void SetBranches();
virtual Int_t GetEntry(Long64_t entry = 0);
virtual void SetCutDefaults();
virtual void Clear(Option_t *otpion = "");
virtual void Print(Option_t *option = "") const;
void SetOutputTree(const char* name, const char* title);
void ProcessInfo();
void PrintSummary();
void AddTool(AtlAnalysisTool *tool);
AtlAnalysisTool* GetTool(const char* ClassName,
const char* ToolName = "", Bool_t force = kFALSE);
AtlTriggerConf* LoadTriggerConfig();
static const char* GetJetMultEnum(UInt_t jetmult);
static const char* GetJetMultLabel(EJetMult jetmult);
static const char* GetJetMultLabel(Int_t i);
static const char* GetLeptonLabel(ELepChannel lep);
static const char* GetLeptonLabel(Int_t i);
static const char* GetLeptonEnum(UInt_t lep);
inline TTree* GetTree() { return fTree; }
inline TTree* GetCurrentTree() const { return fCurrentTree; }
inline AtlEvent* GetEvent() const { return fEvent; }
inline Float_t GetPreTagEvtWeight() const { return fEvent->GetPreTagEvtWeight(); }
inline Float_t GetTagEvtWeight() const { return fEvent->GetTagEvtWeight(); }
inline TFile* GetOutputFile() { return fOutputFile; }
inline virtual Bool_t ProcessCut() { return kTRUE; }
inline virtual Bool_t ProcessPreCut() { return kTRUE; }
inline Bool_t GetWriteEntryList() const { return fWriteEntryList; }
inline Bool_t PassedSelection() const { return fPassedSelection; }
inline void SetWriteEntryList(Bool_t WriteEntryList)
{ fWriteEntryList = WriteEntryList; }
inline TList* GetListOfTools() const { return fListOfTools; }
inline Int_t GetProcessedEvents() const { return fProcessedEvents; }
inline Bool_t HasOutputTree() const {
return ( fOutputTreeName->Length() > 0 );
}
inline Bool_t IsFirstEvent() const { return fProcessedEvents == 0; }
inline void SetPrintEvent(Bool_t PrintEvent) {
fPrintEvent = PrintEvent;
}
inline void SetPrintObjectTable(Bool_t PrintObjectTable) {
fPrintObjectTable = PrintObjectTable;
}
inline void SetPassedSelection(Bool_t result) { fPassedSelection = result; }
void SetInputMode(EIOMode inputMode);
void SetEvtReader(AtlEvtReaderBase * reader);
protected:
void BookJobInfoHistograms();
void SetSumw2(TDirectory *dir);
void ChangeOutputFile();
void DoBookkeeping(TFile *InputFile);
ClassDef(AtlSelector,0)
};
#endif