|
ATLAS Offline Software
|
Go to the documentation of this file.
19 #include <TEfficiency.h>
22 #ifdef XAOD_STANDALONE
28 #ifndef XAOD_STANDALONE
29 #include <GaudiKernel/IIncidentSvc.h>
30 #include <GaudiKernel/ServiceHandle.h>
42 #ifndef XAOD_STANDALONE
46 #ifdef XAOD_STANDALONE
52 , m_inputMetaStore (
"StoreGateSvc/InputMetaDataStore",
name)
53 , m_outputMetaStore (
"StoreGateSvc/MetaDataStore",
name)
56 #ifdef XAOD_STANDALONE
57 declareProperty (
"RootStreamName", m_treeStreamName =
"ANALYSIS",
58 "Name of the stream to put trees into");
74 #ifdef XAOD_STANDALONE
78 #endif // XAOD_STANDALONE
83 #ifdef XAOD_STANDALONE
87 #endif // XAOD_STANDALONE
94 #ifdef XAOD_STANDALONE
98 #endif // XAOD_STANDALONE
103 #ifdef XAOD_STANDALONE
107 #endif // XAOD_STANDALONE
112 #ifdef XAOD_STANDALONE
117 throw std::logic_error (
"no evtStore set on algorithm " +
name());
126 histogramWorker()->addOutput (
hist.Clone());
127 return ::StatusCode::SUCCESS;
135 histogramWorker()->addOutput (
hist.Clone());
136 return ::StatusCode::SUCCESS;
141 template<> TObject *AnaAlgorithm ::
142 hist<TObject> (
const std::string&
name)
const
144 return histogramWorker()->getOutputHist (
name);
152 return hist<TH2>(
name);
160 return hist<TH3>(
name);
165 TEfficiency *AnaAlgorithm ::
166 histeff (
const std::string&
name)
const
168 return hist<TEfficiency>(
name);
173 IHistogramWorker *AnaAlgorithm ::
174 histogramWorker ()
const
176 if (!m_histogramWorker)
177 throw std::logic_error (
"no histogram worker set on algorithm " +
name());
178 return m_histogramWorker;
187 ANA_CHECK( treeWorker()->addTree(
tree, m_treeStreamName ) );
188 return ::StatusCode::SUCCESS;
194 tree (
const std::string&
name)
const
196 return treeWorker()->getOutputTree(
name, m_treeStreamName );
201 ITreeWorker *AnaAlgorithm ::
204 if( ! m_treeWorker ) {
205 throw std::logic_error(
"no tree worker set on algorithm " +
name() );
215 return filterWorker()->filterPassed();
221 setFilterPassed (
bool val_filterPassed)
223 filterWorker()->setFilterPassed (val_filterPassed);
228 IFilterWorker *AnaAlgorithm ::
229 filterWorker ()
const
232 throw std::logic_error (
"no filter worker set on algorithm " +
name());
233 return m_filterWorker;
238 IWorker *AnaAlgorithm ::
242 throw std::logic_error (
"no worker set on algorithm " +
name());
254 #ifndef XAOD_STANDALONE
261 incSvc->removeListener(
this, IncidentType::BeginInputFile );
262 incSvc->addListener(
this, IncidentType::BeginInputFile, 0,
true );
265 return StatusCode::SUCCESS;
275 #ifndef XAOD_STANDALONE
282 incSvc->removeListener(
this, IncidentType::BeginInputFile );
283 incSvc->addListener(
this, IncidentType::BeginInputFile, 0,
true );
286 return StatusCode::SUCCESS;
296 #ifndef XAOD_STANDALONE
303 incSvc->removeListener(
this, IncidentType::EndInputFile );
304 incSvc->addListener(
this, IncidentType::EndInputFile, 0,
true );
307 return StatusCode::SUCCESS;
315 return StatusCode::SUCCESS;
323 return StatusCode::SUCCESS;
331 return StatusCode::SUCCESS;
345 return StatusCode::SUCCESS;
353 return StatusCode::SUCCESS;
361 return StatusCode::SUCCESS;
366 #ifdef XAOD_STANDALONE
404 ANA_MSG_FATAL (
"called fileExecute(), though it was not registered");
405 return StatusCode::FAILURE;
417 ANA_MSG_FATAL (
"called beginInputFile(), though it was not registered");
418 return StatusCode::FAILURE;
430 ANA_MSG_FATAL (
"called endInputFile(), though it was not registered");
431 return StatusCode::FAILURE;
442 throw std::logic_error (
"set evtStore twice on algorithm " +
name());
445 val_evtStore->
event());
447 val_evtStore->
event());
453 setHistogramWorker (IHistogramWorker *val_histogramWorker)
455 if (m_histogramWorker)
456 throw std::logic_error (
"set histogram worker twice on algorithm " +
name());
457 m_histogramWorker = val_histogramWorker;
463 setTreeWorker (ITreeWorker *val_treeWorker)
466 throw std::logic_error(
"set tree worker twice on algorithm " +
469 m_treeWorker = val_treeWorker;
475 setFilterWorker (IFilterWorker *val_filterWorker)
478 throw std::logic_error (
"set filter worker twice on algorithm " +
name());
479 m_filterWorker = val_filterWorker;
485 setWk (IWorker *val_wk)
488 throw std::logic_error (
"set wk twice on algorithm " +
name());
495 hasFileExecute ()
const noexcept
503 hasBeginInputFile ()
const noexcept
511 hasEndInputFile ()
const noexcept
519 #ifndef XAOD_STANDALONE
521 handle (
const Incident& inc)
523 if (inc.type() == IncidentType::BeginInputFile)
529 }
else if (inc.type() == IncidentType::EndInputFile)
::StatusCode requestFileExecute()
register this algorithm to have an implementation of fileexecute
bool m_hasBeginInputFile
the value of hasBeginInputFile
TH2 * hist2d(const std::string &histName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered 2-d histograms.
virtual ::StatusCode endInputFile()
perform the action for the end of an input file
StatusCode book(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.
MetaStore_t m_inputMetaStore
Object accessing the input metadata store.
MetaStore_t m_outputMetaStore
Object accessing the output metadata store.
ConstMetaStorePtr_t inputMetaStore() const
virtual ::StatusCode execute()
execute this algorithm
virtual ::StatusCode beginInputFile()
perform the action for the beginning of an input file
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
virtual ~AnaAlgorithm() noexcept
standard (virtual) destructor
virtual void print() const
print the state of the algorithm
bool const RAWDATA *ch2 const
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
virtual ::StatusCode fileExecute()
perform the action exactly once for each file in the dataset
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
TH3 * hist3d(const std::string &histName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered 3-d histograms.
void handle(const Incident &inc)
receive the given incident
virtual ::StatusCode finalize()
finalize this algorithm
::StatusCode StatusCode
StatusCode definition for legacy code.
::StatusCode requestBeginInputFile()
register this algorithm to have an implementation of beginInputFile
This module defines the arguments passed from the BATCH driver to the BATCH worker.
bool m_hasFileExecute
the value of hasFileExecute
::StatusCode requestEndInputFile()
register this algorithm to have an implementation of endInputFile
virtual StatusCode sysInitialize()
Initialization method invoked by the framework.
Wrapper for TEvent to make it look like StoreGate.
#define ATH_MSG_WARNING(x)
bool m_hasEndInputFile
the value of hasEndInputFile
filterPassed
now, add a sequencer: it will only execute seqalg1 and 2 and never 3
TH1 * hist(const std::string &histName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered histograms of any type.
xAOD::TEvent * event() const
Return the underlying event manager.
virtual ::StatusCode initialize()
initialize this algorithm
ConstMetaStorePtr_t outputMetaStore() const
TTree * tree(const std::string &treeName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered TTrees.