29 m_tdt(
"Trig::TrigDecisionTool/TrigDecisionTool"),
47 msg(MSG::INFO) <<
"TrigR3Mon::TrigR3Mon() compiled: " << __DATE__ <<
" " << __TIME__ <<
endmsg;
119 msg(MSG::INFO) <<
"TrigR3Mon::TrigR3Mon() exiting " << gDirectory->GetName() <<
endmsg;
143 msg(MSG::DEBUG) <<
" ----- enter initialize() ----- " <<
endmsg;
145 msg(MSG::INFO) <<
"TrigR3Mon::initialize() " << gDirectory->GetName() <<
" " <<
m_sliceTag <<
endmsg;
152 std::cout <<
"TrigR3Mon::name = " << name() << std::endl;
153 std::cout <<
"TrigR3Mon::SliceTag = " <<
m_sliceTag << std::endl;
155 std::cout <<
"TrigR3Mon::Legacy = " <<
m_legacy << std::endl;
181 ATH_MSG_INFO(
" TrigR3Mon::book() " << gDirectory->GetName() );
191 std::string lastvtx =
"";
200 if (
m_tdt->getNavigationFormat() ==
"TriggerElement" ) {
254 std::vector<std::string> chains;
261 std::vector<ToolHandle<GenericMonitoringTool>*> monTools;
264 ToolHandleArray<GenericMonitoringTool>::iterator toolitr =
m_monTools.begin();;
275 if ( chainName.
head() ==
"" ) {
277 std::string selectChain = chainName.
raw();
282 if (std::find(chains.begin(), chains.end(), selectChain) == chains.end()) {
283 chains.push_back( selectChain );
284 monTools.push_back( &(*toolitr) );
292 if ( chainName.
head().find(
"HLT_")==std::string::npos ) {
299 std::string selectChain = chainName.
head();
305 if ( selectChain==
"" ) {
306 msg(MSG::WARNING) <<
"^[[91;1m" <<
"No chain matched\tchain input " << chainName.
head() <<
" : " << chainName.
tail() <<
"^[[m"<<
endmsg;
311 std::string mchain = selectChain;
313 if ( chainName.
tail()!=
"" ) mchain +=
"/"+chainName.
tail();
314 if ( chainName.
roi()!=
"" ) mchain +=
"_"+chainName.
roi();
315 if ( chainName.
vtx()!=
"" ) mchain +=
"_"+chainName.
vtx();
317 if ( chainName.
extra()!=
"" ) mchain +=
"_"+chainName.
extra();
318 if ( !chainName.
passed() ) mchain +=
"_DTE";
320 selectChain = chainName.
subs( selectChain );
324 std::cout <<
"\nTrigR3Mon::chain specification: " << chainName <<
"\t" << chainName.
raw() << std::endl;
325 std::cout <<
"\tchain: " << chainName.
head() << std::endl;
326 std::cout <<
"\tkey: " << chainName.
tail() << std::endl;
327 std::cout <<
"\troi: " << chainName.
roi() << std::endl;
328 std::cout <<
"\tvtx: " << chainName.
vtx() << std::endl;
329 std::cout <<
"\tte: " << chainName.
element() << std::endl;
330 std::cout <<
"\textra: " << chainName.
extra() << std::endl;
337 int shifter_efid = 0;
339 int shifter_efid_run1 = 0;
347 if ( chainName.
tail().find(
"_FTF")!=std::string::npos ) {
349 if ( shifter_ftf>=shifterChains ||
350 ( shifter_ftf<shifterChains && chainName.
vtx()!=
"" && chainName.
vtx()==lastvtx ) ) {
351 msg(MSG::DEBUG) <<
"^[[91;1m" <<
"Matching chain " << selectChain <<
" excluded - Shifter chain already definied^[[m" <<
endmsg;
357 lastvtx = chainName.
vtx();
359 else if ( chainName.
tail().find(
"_IDTrig")!=std::string::npos || chainName.
tail().find(
"CosmicsN_EFID")!=std::string::npos ) {
362 if ( shifter_efid>shifterChains ) {
363 msg(MSG::DEBUG) <<
"^[[91;1m" <<
"Matching chain " << selectChain <<
" excluded - Shifter chain already definied^[[m" <<
endmsg;
368 else if ( chainName.
tail().find(
"_EFID")!=std::string::npos ) {
371 if ( shifter_efid_run1>shifterChains ) {
372 msg(MSG::DEBUG) <<
"^[[91;1m" <<
"Matching chain " << selectChain <<
" excluded - Shifter chain already definied^[[m" <<
endmsg;
380 if ( std::find(chains.begin(), chains.end(), selectChain) == chains.end() ) {
381 chains.push_back( selectChain );
382 monTools.push_back( &(*toolitr) );
395 std::vector<ChainString> allcs;
397 allcs.reserve(allchains.size());
401 std::vector<std::string> mtypes;
403 for (
size_t i=0 ; i<allchains.size() ; i++ ) {
405 if ( allcs.back().head().find(
"HLT_")==0 )
continue;
406 if ( allcs.back().head()==
"Offline" ) {
408 if ( allcs.back().tail()!=
"" ) {
409 if ( allcs.back().tail().find(
"+")==0 ) {
410 mtypes.push_back( allcs.back().tail().substr(1) );
411 ATH_MSG_INFO(
"Adding Offline reference collection: " << mtypes.back() );
414 if ( mtypes.size()<1 )
ATH_MSG_WARNING(
"Too Many reference collections : " << allcs.back().tail() );
416 mtypes.push_back( allcs.back().tail() );
417 ATH_MSG_INFO(
"Offline reference collection: " << mtypes.back() );
422 mtypes.push_back(
"" );
433 if ( probe.
extra().find(
"probe")!=std::string::npos ) {
435 std::string probe_key = std::string(probe.
extra()).erase( probe.
extra().find(
"probe"), 5 ) ;
437 for (
size_t j=0 ; j<allchains.size() ; j++ ) {
442 if ( tag.head() != probe.
head() )
continue;
443 if ( tag.element() == probe.
element() )
continue;
444 if ( tag.extra().find(
"tag")==std::string::npos )
continue;
446 std::string tag_key = std::string(tag.extra()).erase( tag.extra().find(
"tag"), 3 ) ;
448 if ( tag_key != probe_key )
continue;
451 double massMax = 150;
453 if ( tag.head().find(
"Jpsi")!=std::string::npos ) {
458 if ( mcTruth ) tnp =
new TagNProbe(
"Truth", massMin, massMax );
459 else tnp =
new TagNProbe(
"Offline", massMin, massMax );
461 tnp->
tag(tag.raw()) ;
464 ATH_MSG_DEBUG(
"Tag and probe pair found: " << tag <<
" : " << probe );
481 filterTest, filterRef,
491 if ( mtypes.size()>0 ) analysis->
setTypes( mtypes );
505 std::string highestPT_str =
"";
506 std::string vtxindex_str =
"";
509 highestPT_str =
": using highest PT only";
515 vtxindex_str =
": searching for vertex index ";
536 for (
unsigned i=0 ; i<
m_sequences.size() ; i++ ) {
549 return StatusCode::SUCCESS;
566 static std::once_flag flag;
567 std::call_once(flag, [&]() {
568 for (
unsigned i=0 ; i<selectChains.size() ; i++ ) {
569 ATH_MSG_DEBUG(
"\tchain " << selectChains[i] <<
" from TDT" );
572 for (
size_t i=selectChains.size() ; i-- ; ) {
574 ATH_MSG_INFO(
"^[[91;1m" <<
"configured chain " << selectChains[i] <<
"^[[m" );
580 for (
unsigned i=0 ; i<selectChains.size() ; i++ ) {
582 ATH_MSG_DEBUG(
"chain " << selectChains[i] <<
"\tpass: " << isPassed[i] <<
"\tprescale: " <<
m_tdt->getPrescale(selectChains[i]) );
587 for (
unsigned i=0 ; i<
m_sequences.size() ; i++ ) {
593 return StatusCode::SUCCESS;
611 return StatusCode::SUCCESS;
T_AnalysisConfigR3_Tier0< AthReentrantAlgorithm, AnalysisR3_Tier0 > AnalysisConfigR3_Tier0
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
generic track filter to filter on kinematics, si and trt hit content NB: Should really make this up f...
emacs: this is -* c++ -*-
emacs: this is -*- c++ -*-
TIDA::Associator< TIDA::Track > TrackAssociator
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