A++ » INC » AtlRunEvtSelectionTool

class AtlRunEvtSelectionTool: public AtlAnalysisTool


 Run/Event Selection Tool

 With the help of this tool an analysis can be run over a
 pre-selected list of events either given by a text file or by a
 flat Root tree. The tool is designed fot high speed and good
 performance, also for large lists.

 Usage:

 Note that when using tasks the content of the tool's data members
 can be set by using AtlAppAnalysiTask::AtlSetToolVariable() in the
 usual way.

 (1) Create tool with text file:
 AtlRunEvtSelectionTool *tool = new AtlRunEvtSelectionTool("runevttool", "Run/Evt Selection Tool");
 tool->fInputName("runevt.dat");

 The file runevt.dat looks like (events can be disordered):
 1243393 1020
 1243393 998
 1243393 2346
 1243393 10044
 1243355 25

 In case the file has a different format, the format string for
 reading the file can be stored by the data member fInputFormat.

 (2) Create tool with ntuple:
 AtlRunEvtSelectionTool *tool = new AtlRunEvtSelectionTool("runevt_tool", "RunEvt Tool")
 tool->fInputFilename = "AntiElectronQCDModel.root"
 tool->fInputTreename = "AntiElectrons"
 tool->fBranchnameRun = "runnumber"
 tool->fBranchnameEvent = "eventnumber"

 (3) Inside the analysis simply ask by using
 Bool_t IsValid = tool->IsValidEvent();
 if the current event is contained in the list. This information can
 be used, for instance, in ProcessCuut to select only the given
 events. In a similar way an inverted selection would be possible as
 well.  The tool makes it easy to convert a given list (text fiel or
 ntuple) into an EntryList which can be used in a subsequent
 analysis.


 Author: Oliver Maria Kind <mailto: kind@mail.desy.de>
 Update: $Id: AtlRunEvtSelectionTool.cxx,v 1.3 2011/06/09 08:17:35 kind Exp $
 Copyright: 2011 (C) Oliver Maria Kind

Function Members (Methods)

public:
virtual~AtlRunEvtSelectionTool()
voidTObject::AbstractMethod(const char* method) const
virtual Bool_tAtlAnalysisTool::AnalyzeEvent()
virtual voidTObject::AppendPad(Option_t* option = "")
AtlRunEvtSelectionTool(const AtlRunEvtSelectionTool&)
AtlRunEvtSelectionTool(const char* name, const char* title)
virtual voidBookHistograms()
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidAtlAnalysisTool::Clear()
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
voidExportAsText()
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual voidFillHistograms()
virtual voidAtlAnalysisTool::FillHistogramsNoEvtSel()
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
const char*AtlAnalysisTool::GetOutputDir() const
Float_tAtlAnalysisTool::GetPreTagEvtWeight() const
static const char*AtlAnalysisTool::GetProcessModeName(AtlAnalysisTool::EProcessMode mode)
Float_tAtlAnalysisTool::GetTagEvtWeight() const
virtual const char*TNamed::GetTitle() const
AtlAnalysisTool*AtlAnalysisTool::GetTool(const char* ClassName, const char* ToolName = "", Bool_t force = kFALSE) const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidAtlAnalysisTool::Init()
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tAtlAnalysisTool::IsIndividual() const
Bool_tAtlAnalysisTool::IsMainAnalysis() const
Bool_tAtlAnalysisTool::IsObjectsDefinition() const
Bool_tAtlAnalysisTool::IsOff() const
Bool_tTObject::IsOnHeap() const
Bool_tAtlAnalysisTool::IsPostAnalysis() const
Bool_tAtlAnalysisTool::IsPreAnalysis() const
Bool_tAtlAnalysisTool::IsScaleFactor() const
virtual Bool_tTNamed::IsSortable() const
Bool_tAtlAnalysisTool::IsSystematics() const
Bool_tIsValidEvent()
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tAtlAnalysisTool::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
AtlRunEvtSelectionTool&operator=(const AtlRunEvtSelectionTool&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint() const
Bool_tAtlAnalysisTool::Process()
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidReset()
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidSetBranchStatus()
virtual voidAtlAnalysisTool::SetCutDefaults()
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidAtlAnalysisTool::SetEvent(AtlEvent* evt)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
voidAtlAnalysisTool::SetOutputDir(const char* dir)
voidAtlAnalysisTool::SetOutputFile(TFile* f)
voidAtlAnalysisTool::SetParent(AtlSelector* parent)
virtual voidTNamed::SetTitle(const char* title = "")MENU
voidAtlAnalysisTool::SetTree(TTree* t)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
virtual voidAtlAnalysisTool::Terminate()
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
voidAdd(Int_t run, Int_t evt)
AtlRunItem*AddRun(Int_t xrun)
Bool_tContains(Int_t run, Int_t evt, Bool_t remove = kFALSE)
AtlRunItem*FindRunItem(Int_t run)
voidParseInputFile()
voidParseRootFile()
voidParseTextFile()

Data Members

public:
TStringfBranchnameEventName of the event branch
TStringfBranchnameRunName of the run branch
TStringfInputFilenameName of the input file (text or Root file)
TStringfInputFormatFormat string for text input files (default is %d%d)
TStringfInputTreenameName of the inpu tree
TStringAtlAnalysisTool::fOutputDirDirectory in root output file, where histogram dir is created
AtlAnalysisTool::EProcessModeAtlAnalysisTool::fProcessModeDefines when exactly the tool is run (see AtlAnalysisTool class description for details)
Int_tAtlAnalysisTool::fVerbosityLevelIndicates the degree of verbosity of tool (0 = no info/debug output, 1 = info, 2 = info+debug)
static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static AtlAnalysisTool::EProcessModeAtlAnalysisTool::kIndividual
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static AtlAnalysisTool::EProcessModeAtlAnalysisTool::kMainAnalysis
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static AtlAnalysisTool::EProcessModeAtlAnalysisTool::kObjectsDefinition
static AtlAnalysisTool::EProcessModeAtlAnalysisTool::kOff
static TObject::(anonymous)TObject::kOverwrite
static AtlAnalysisTool::EProcessModeAtlAnalysisTool::kPostAnalysis
static AtlAnalysisTool::EProcessModeAtlAnalysisTool::kPreAnalysis
static AtlAnalysisTool::EProcessModeAtlAnalysisTool::kScaleFactor
static TObject::(anonymous)TObject::kSingleKey
static AtlAnalysisTool::EProcessModeAtlAnalysisTool::kSystematics
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
protected:
AtlEvent*AtlAnalysisTool::fEventPointer to current event
TStringTNamed::fNameobject identifier
TString*AtlAnalysisTool::fOptionOption string
TFile*AtlAnalysisTool::fOutputFileOutput file
AtlSelector*AtlAnalysisTool::fParentPointer to parent selector
TStringTNamed::fTitleobject title
TTree*AtlAnalysisTool::fTreeEvent tree
private:
AtlRunItem*fLastRunRun number cache
TList*fListOfRunsOrdered list of selected runs
Int_tfNEventsTotal number of added events
Int_tfNRunsTotal number of included runs

Class Charts

Inheritance Chart:
TObject
TNamed
AtlAnalysisTool
AtlRunEvtSelectionTool

Function documentation

AtlRunEvtSelectionTool(const char* name, const char* title)
 Default constructor

~AtlRunEvtSelectionTool()
 Default destructor

void BookHistograms()
 Initialze the tool

void ParseInputFile()
 Read from input file (either text or Root file and setup
 run-event structure for fast comparison

void ParseRootFile()
 Parse Root input file

void ParseTextFile()
 Parse text (ASCII) input file

void Add(Int_t run, Int_t evt)
  Add run/evt to the internal structure
  Prevent from double filling

void ExportAsText()
 Export run-evt structure as text

AtlRunItem* FindRunItem(Int_t run)
 Returns pointer to item with given run number - otherwise 0

AtlRunItem* AddRun(Int_t xrun)
 Add run item to the list of runs

Bool_t Contains(Int_t run, Int_t evt, Bool_t remove = kFALSE)
 Checks if run/evt is contained in existing run-evt structure

void SetBranchStatus()
 Switch on needed branches

void Reset()
 Reset run-evt structure

void Print() const
 Print toof information

AtlRunEvtSelectionTool(const char* name, const char* title)
void FillHistograms()
{;}
Bool_t IsValidEvent()
 Check if the current event is contained in the given run/evt list.
 !!! Important !!! if the event is found it will be removed from
 list for performance reasons.