29 m_tdt(
"Trig::TrigDecisionTool/TrigDecisionTool"),
47# ifdef USE_DATE_TIME_STAMP
48 msg(MSG::INFO) <<
"TrigR3Mon::TrigR3Mon() compiled: " << __DATE__ <<
" " << __TIME__ <<
endmsg;
121 msg(MSG::INFO) <<
"TrigR3Mon::TrigR3Mon() exiting " << gDirectory->GetName() <<
endmsg;
145 msg(MSG::DEBUG) <<
" ----- enter initialize() ----- " <<
endmsg;
147 msg(MSG::INFO) <<
"TrigR3Mon::initialize() " << gDirectory->GetName() <<
" " <<
m_sliceTag <<
endmsg;
154 std::cout <<
"TrigR3Mon::name = " << name() << std::endl;
155 std::cout <<
"TrigR3Mon::SliceTag = " <<
m_sliceTag << std::endl;
157 std::cout <<
"TrigR3Mon::Legacy = " <<
m_legacy << std::endl;
183 ATH_MSG_INFO(
" TrigR3Mon::book() " << gDirectory->GetName() );
193 std::string lastvtx =
"";
202 if (
m_tdt->getNavigationFormat() ==
"TriggerElement" ) {
256 std::vector<std::string> chains;
263 std::vector<ToolHandle<GenericMonitoringTool>*> monTools;
266 ToolHandleArray<GenericMonitoringTool>::iterator toolitr =
m_monTools.begin();;
277 if ( chainName.
head() ==
"" ) {
279 std::string selectChain = chainName.
raw();
284 if (std::find(chains.begin(), chains.end(), selectChain) == chains.end()) {
285 chains.push_back( selectChain );
286 monTools.push_back( &(*toolitr) );
294 if ( chainName.
head().find(
"HLT_")==std::string::npos && chainName.
head().find(
"EF_")==std::string::npos ) {
301 std::string selectChain = chainName.
head();
307 if ( selectChain==
"" ) {
308 msg(MSG::WARNING) <<
"^[[91;1m" <<
"No chain matched\tchain input " << chainName.
head() <<
" : " << chainName.
tail() <<
"^[[m"<<
endmsg;
313 std::string mchain = selectChain;
315 if ( chainName.
tail()!=
"" ) mchain +=
"/"+chainName.
tail();
316 if ( chainName.
roi()!=
"" ) mchain +=
"_"+chainName.
roi();
317 if ( chainName.
vtx()!=
"" ) mchain +=
"_"+chainName.
vtx();
319 if ( chainName.
extra()!=
"" ) mchain +=
"_"+chainName.
extra();
320 if ( !chainName.
passed() ) mchain +=
"_DTE";
322 selectChain = chainName.
subs( selectChain );
326 std::cout <<
"\nTrigR3Mon::chain specification: " << chainName <<
"\t" << chainName.
raw() << std::endl;
327 std::cout <<
"\tchain: " << chainName.
head() << std::endl;
328 std::cout <<
"\tkey: " << chainName.
tail() << std::endl;
329 std::cout <<
"\troi: " << chainName.
roi() << std::endl;
330 std::cout <<
"\tvtx: " << chainName.
vtx() << std::endl;
331 std::cout <<
"\tte: " << chainName.
element() << std::endl;
332 std::cout <<
"\textra: " << chainName.
extra() << std::endl;
339 int shifter_efid = 0;
341 int shifter_efid_run1 = 0;
349 if ( chainName.
tail().find(
"_FTF")!=std::string::npos ) {
351 if ( shifter_ftf>=shifterChains ||
352 ( shifter_ftf<shifterChains && chainName.
vtx()!=
"" && chainName.
vtx()==lastvtx ) ) {
353 msg(MSG::DEBUG) <<
"^[[91;1m" <<
"Matching chain " << selectChain <<
" excluded - Shifter chain already definied^[[m" <<
endmsg;
359 lastvtx = chainName.
vtx();
361 else if ( chainName.
tail().find(
"_IDTrig")!=std::string::npos || chainName.
tail().find(
"CosmicsN_EFID")!=std::string::npos ) {
364 if ( shifter_efid>shifterChains ) {
365 msg(MSG::DEBUG) <<
"^[[91;1m" <<
"Matching chain " << selectChain <<
" excluded - Shifter chain already definied^[[m" <<
endmsg;
370 else if ( chainName.
tail().find(
"_EFID")!=std::string::npos ) {
373 if ( shifter_efid_run1>shifterChains ) {
374 msg(MSG::DEBUG) <<
"^[[91;1m" <<
"Matching chain " << selectChain <<
" excluded - Shifter chain already definied^[[m" <<
endmsg;
382 if ( std::find(chains.begin(), chains.end(), selectChain) == chains.end() ) {
383 chains.push_back( selectChain );
384 monTools.push_back( &(*toolitr) );
397 std::vector<ChainString> allcs;
399 allcs.reserve(allchains.size());
403 std::vector<std::string> mtypes;
405 for (
size_t i=0 ; i<allchains.size() ; i++ ) {
407 if ( allcs.back().head().find(
"HLT_")==0 )
continue;
408 if ( allcs.back().head().find(
"EF_")==0 )
continue;
409 if ( allcs.back().head()==
"Offline" ) {
411 if ( allcs.back().tail()!=
"" ) {
412 if ( allcs.back().tail().find(
"+")==0 ) {
413 mtypes.push_back( allcs.back().tail().substr(1) );
414 ATH_MSG_INFO(
"Adding Offline reference collection: " << mtypes.back() );
417 if ( mtypes.size()<1 )
ATH_MSG_WARNING(
"Too Many reference collections : " << allcs.back().tail() );
419 mtypes.push_back( allcs.back().tail() );
420 ATH_MSG_INFO(
"Offline reference collection: " << mtypes.back() );
425 mtypes.push_back(
"" );
436 if ( probe.
extra().find(
"probe")!=std::string::npos ) {
438 std::string probe_key = std::string(probe.
extra()).erase( probe.
extra().find(
"probe"), 5 ) ;
440 for (
size_t j=0 ; j<allchains.size() ; j++ ) {
445 if ( tag.head() != probe.
head() )
continue;
446 if ( tag.element() == probe.
element() )
continue;
447 if ( tag.extra().find(
"tag")==std::string::npos )
continue;
449 std::string tag_key = std::string(tag.extra()).erase( tag.extra().find(
"tag"), 3 ) ;
451 if ( tag_key != probe_key )
continue;
454 double massMax = 150;
456 if ( tag.head().find(
"Jpsi")!=std::string::npos ) {
461 if ( mcTruth ) tnp =
new TagNProbe(
"Truth", massMin, massMax );
462 else tnp =
new TagNProbe(
"Offline", massMin, massMax );
464 tnp->
tag(tag.raw()) ;
467 ATH_MSG_DEBUG(
"Tag and probe pair found: " << tag <<
" : " << probe );
484 filterTest, filterRef,
494 if ( mtypes.size()>0 ) analysis->
setTypes( mtypes );
508 std::string highestPT_str =
"";
509 std::string vtxindex_str =
"";
512 highestPT_str =
": using highest PT only";
518 vtxindex_str =
": searching for vertex index ";
539 for (
unsigned i=0 ; i<
m_sequences.size() ; i++ ) {
552 return StatusCode::SUCCESS;
568 static std::once_flag flag;
569 std::call_once(flag, [&]() {
570 for (
unsigned i=0 ; i<selectChains.size() ; i++ ) {
571 ATH_MSG_DEBUG(
"\tchain " << selectChains[i] <<
" from TDT" );
574 for (
size_t i=selectChains.size() ; i-- ; ) {
576 ATH_MSG_INFO(
"^[[91;1m" <<
"configured chain " << selectChains[i] <<
"^[[m" );
582 for (
unsigned i=0 ; i<selectChains.size() ; i++ ) {
584 ATH_MSG_DEBUG(
"chain " << selectChains[i] <<
"\tpass: " << isPassed[i] <<
"\tprescale: " <<
m_tdt->getPrescale(selectChains[i]) );
589 for (
unsigned i=0 ; i<
m_sequences.size() ; i++ ) {
595 return StatusCode::SUCCESS;
613 return StatusCode::SUCCESS;
T_AnalysisConfigR3_Tier0< AthReentrantAlgorithm, AnalysisR3_Tier0 > AnalysisConfigR3_Tier0
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
generic track filter to filter on kinematics, si and trt hit content NB: Should really make this up f...
emacs: this is -* c++ -*-
TIDA::Associator< TIDA::Track > TrackAssociator
emacs: this is -*- c++ -*-
emacs: this is -*- c++ -*-
void set_fiducial_radius(double d)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
bool msgLvl(const MSG::Level lvl) const
virtual StatusCode initialize() override
initialize
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
const std::string & extra() const
const std::string & roi() const
std::string subs(std::string s) const
const std::string & raw() const
const std::string & head() const
const std::string & tail() const
const std::string & vtx() const
const std::string & element() const
sadly need to include a root dependency, but no matter - the TIDA::Track class itself inherets from T...
void setParentPdgID(int i=0)
void setMCTruthRef(bool b)
void setRunPurity(bool b)
void set_monTool(ToolHandle< GenericMonitoringTool > *m)
void setOfflineRef(bool b)
void setTypes(const std::vector< std::string > &t)
void containTracks(bool b)
void probe(const std::string &chainName)
void tag(const std::string &chainName)
getters and setters
std::vector< T_AnalysisConfig< AthReentrantAlgorithm > * > m_sequences
do we need this ??? why not the base class ???
bool m_runPurity
also run purity analyses
std::vector< TrackFilter * > m_filters
bool m_shifter
determine whether this should be treated as a shifter chain
std::vector< std::string > m_chainNames
int m_selectParentTruthPdgId
SG::ReadHandleKeyArray< xAOD::TrackParticleContainer > m_trackdummykeys
std::string m_releaseMetaData
virtual StatusCode initialize() override
initialize
std::string m_analysis_config
TrigR3Mon(const std::string &name, ISvcLocator *pSvcLocator)
bool m_keepAllEvents
kepp events even if they fail the requested trigger chains
std::string m_outputFileName
virtual StatusCode fillHistograms(const EventContext &context) const override
adds event to the monitoring histograms
std::vector< std::string > m_ntupleChainNames
bool m_useHighestPT
use only the highest pt tracks
std::string m_sliceTag
additional string for the histogram directory
std::vector< TrackAssociator * > m_associators
double m_fiducial_radius
ntuple building variables
ToolHandleArray< GenericMonitoringTool > m_monTools
SG::ReadHandleKeyArray< xAOD::VertexContainer > m_vtxdummykeys
bool m_fileopen
if an ntple file open?
ToolHandle< Trig::TrigDecisionTool > m_tdt
int m_shifterChains
max number of shifter chains to use - must be < 2 at the moment
bool m_containTracks
do we want basic, or rigorous roi track containment
virtual StatusCode finalize() override
virtual StatusCode bookHistograms()
int m_vtxIndex
if performing the vertex analysis, the index of the offline vertex to look for
std::vector< bool > isPassedForEach(unsigned int condition=TrigDefs::Physics) const
return vector with isPassed decision for each chain
std::vector< std::string > getListOfTriggers() const
std::string find(const std::string &s)
return a remapped string