check whether the chains have actually run, otherwise there's no point doing anything
bomb out if no chains passed and not told to keep all events and found no offline objects
keep this printout here, but commented for usefull debug purposes ...
hmm, if we stored the types as a map it would be more straightforward than having to stick all this in a loop
hmm, if we stored the types as a map it would be more straightforward than having to stick all this in a loop
now decide whether we want all the TEs for this chain, or just those that are still active
a hack to fetch back the Rois with "_probe" in the name if the standard named RoiDescriptors are not actually present for this chain ...
don't extract any additional rois if a superRoi is requested: In this case, the superRoi would be shared between the different chains
useful diagnostic - leave in place ... m_provider->msg(MSG::INFO) << "TIDARoi " << *roi_tmp << "\tcollectionName: " << collectionName << endmsg;
fetch vertices if available ...
100 <<
" compiled " << __DATE__ <<
" " << __TIME__ <<
"\t: " <<
date() <<
"[m" <<
endmsg;
103 bool foundOffline =
false;
109 std::vector<double> beamline;
113 double xbeam_online = 0;
114 double ybeam_online = 0;
115 double zbeam_online = 0;
117 std::vector<double> beamline_online;
142 if ( xbeam!=0 || ybeam!=0 ) {
143 selectorTruth.setBeamline( xbeam, ybeam,
zbeam );
144 selectorRef.setBeamline( xbeam, ybeam,
zbeam );
147 if ( xbeam_online!=0 || ybeam_online!=0 ) {
148 selectorTest.setBeamline( xbeam_online, ybeam_online, zbeam_online );
151 selectorTruth.correctTracks(
true );
152 selectorRef.correctTracks(
true );
153 selectorTest.correctTracks(
true );
162 unsigned long long event_number = 0;
163 unsigned lumi_block = 0;
164 unsigned bunch_crossing_id = 0;
165 unsigned time_stamp = 0;
168 if (
retrieve(pEventInfo,
"EventInfo").isFailure() ) {
176 bunch_crossing_id = pEventInfo->
bcid();
181 <<
"\tevent " << event_number
182 <<
"\tlb " << lumi_block <<
endmsg;
197 <<
"L2 pass " << L2chain->
isPassed() <<
"\t"
198 <<
"EF pass " << EFchain->
isPassed() <<
"\t"
199 <<
"HLT pass " << HLTchain->
isPassed() <<
"[m"
205 bool analyse =
false;
207 unsigned decisiontype = TrigDefs::Physics;
211 int passed_chains = 0;
220 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
226 if (
chainName.find(
"L2") == std::string::npos &&
227 chainName.find(
"EF") == std::string::npos &&
228 chainName.find(
"HLT") == std::string::npos )
continue;
230 if ( configuredHLTChains.find(
chainName)==configuredHLTChains.end() ) {
232 <<
" is not configured for this event" <<
"[m"
238 else decisiontype = TrigDefs::includeFailedDecisions;
240 std::string roistring =
"";
243 bool passPhysics = (*m_tdt)->isPassed(
chainName);
246 <<
"\tpres " << (*m_tdt)->getPrescale(
chainName)
247 << ( passPhysics ?
"[91;1m" :
"" ) <<
"\tpass physics " << passPhysics << ( passPhysics ?
"[m" :
"" )
248 <<
"\t: ( pass " << (*m_tdt)->isPassed(
chainName, decisiontype ) <<
"\tdec type " << decisiontype <<
" ) " <<
endmsg;
274 selectorTruth.clear();
281 if (
retrieve(truthMap,
"TrigInDetTrackTruthMap").isFailure()) {
289 selectTracks<TruthParticleContainer>( &selectorTruth,
"INav4MomTruthEvent" );
293 selectTracks<TruthParticleContainer>( &selectorTruth,
"SpclMC");
297 selectTracks<TruthParticleContainer>( &selectorTruth,
"");
301 selectTracks<xAOD::TruthParticleContainer>( &selectorTruth,
"TruthParticles" );
305 selectTracks<xAOD::TruthParticleContainer>( &selectorTruth,
"" );
325 selectTracks<xAOD::TrackParticleContainer>( &selectorRef,
"InDetTrackParticles" );
328 selectTracks<Rec::TrackParticleContainer>( &selectorRef,
"TrackParticleCandidate" );
338 std::vector<TIDA::Vertex> vertices;
341 std::string vertexChainname =
"Vertex";
355 if ( xaodVtxCollection!=0 ) {
361 if (
vertexType.find(
"SecVtx") != std::string::npos ) {
362 vertices = vertexBuilder.
select( xaodVtxCollection, &selectorRef.tracks(),
true );
365 vertices = vertexBuilder.
select( xaodVtxCollection, &selectorRef.tracks() );
388 for (
unsigned i=0 ;
i<vertices.size() ;
i++ ) {
410 if ( selectorRef.getBeamX()!=0 || selectorRef.getBeamY()!=0 || selectorRef.getBeamZ()!=0 ) {
411 std::vector<double> beamline_;
412 beamline_.push_back( selectorRef.getBeamX() );
413 beamline_.push_back( selectorRef.getBeamY() );
414 beamline_.push_back( selectorRef.getBeamZ() );
419 Noff = selectorRef.tracks().size();
422 for (
int ii=selectorRef.tracks().size() ; ii-- ; )
m_provider->
msg(
MSG::DEBUG) <<
" ref track " << ii <<
" " << *selectorRef.tracks()[ii] <<
endmsg;
427 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
434 std::string collectionname =
m_chainNames[ichain].tail();
438 if ( chainname!=
"" )
continue;
439 if ( collectionname==
"" )
continue;
441 chainname = collectionname;
442 if ( vtx_name!=
"" ) chainname +=
":" + vtx_name;
449 selectorTest.clear();
453 std::string collection_test = collectionname;
454 size_t pos = collectionname.find(
"/");
455 if (
pos!=std::string::npos ) collection_test = collectionname.substr(
pos+1, collectionname.size()-
pos );
458 found = selectTracks<Rec::TrackParticleContainer>( &selectorTest, collectionname );
461 found = selectTracks<xAOD::TrackParticleContainer>( &selectorTest, collectionname );
464 found = selectTracks<TrigInDetTrackCollection>( &selectorTest, collectionname );
467 found = selectTracks<TrackCollection>( &selectorTest, collectionname );
470 m_provider->
msg(MSG::WARNING) <<
"\tcollection " << collectionname <<
" not found" <<
endmsg;
476 std::vector<TIDA::Vertex> tidavertices;
480 if ( vtx_name!=
"" ) {
488 if (
retrieve( xaodVtxCollection, vtx_name ).isFailure() ) {
492 if ( xaodVtxCollection!=0 ) {
495 <<
"\t" << vtx_name <<
endmsg;
499 if ( vtx_name.find(
"SecVtx") != std::string::npos ) {
500 tidavertices = vertexBuilder.
select( xaodVtxCollection, 0,
true );
503 tidavertices = vertexBuilder.
select( xaodVtxCollection );
517 if ( selectorTest.getBeamX()!=0 || selectorTest.getBeamY()!=0 || selectorTest.getBeamZ()!=0 ) {
518 std::vector<double> beamline_;
519 beamline_.push_back( selectorTest.getBeamX() );
520 beamline_.push_back( selectorTest.getBeamY() );
521 beamline_.push_back( selectorTest.getBeamZ() );
525 int Ntest = selectorTest.tracks().size();
533 std::string ElectronRef[7] = {
535 "TightCB",
"MediumCB",
"LooseCB",
536 "TightLH",
"MediumLH",
"LooseLH" };
547 if ( itype<0 )
continue;
549 std::vector<TrackTrigObject> elevec;
551 std::string echain = std::string(
"Electrons");
556 if ( Nel_ < 1 )
continue;
568 if ( selectorRef.getBeamX()!=0 || selectorRef.getBeamY()!=0 || selectorRef.getBeamZ()!=0 ) {
569 std::vector<double> beamline_;
570 beamline_.push_back( selectorRef.getBeamX() );
571 beamline_.push_back( selectorRef.getBeamY() );
572 beamline_.push_back( selectorRef.getBeamZ() );
579 std::string MuonRef[5] = {
"",
"Tight",
"Medium",
"Loose",
"VeryLoose" };
582 for (
size_t imuon=0 ; imuon<
m_muonType.size() ; imuon++ ) {
588 if ( muonType<0 )
continue;
590 std::string mchain =
"Muons";
593 int Nmu_ =
processMuons( selectorRef, muonType, 0, mchain );
595 if ( Nmu_ < 1 )
continue;
607 if ( selectorRef.getBeamX()!=0 || selectorRef.getBeamY()!=0 || selectorRef.getBeamZ()!=0 ) {
608 std::vector<double> beamline_;
609 beamline_.push_back( selectorRef.getBeamX() );
610 beamline_.push_back( selectorRef.getBeamY() );
611 beamline_.push_back( selectorRef.getBeamZ() );
616 for (
int ii=selectorRef.tracks().size() ; ii-- ; )
m_provider->
msg(
MSG::DEBUG) <<
" ref muon track " << ii <<
" " << *selectorRef.tracks()[ii] <<
endmsg;
636 for (
int ii=selectorRef.tracks().size() ; ii-- ; )
m_provider->
msg(
MSG::DEBUG) <<
" ref muon track " << ii <<
" " << *selectorRef.tracks()[ii] <<
endmsg;
642 std::string TauRef[4] = {
"",
"Tight",
"Medium",
"Loose" };
645 for (
size_t itau=0 ; itau<
m_tauType.size() ; itau++ ) {
651 if ( itype<0 )
continue;
654 int requireNtracks = 0;
655 if (
m_tauProngs[itau]==
"3Prong" ) requireNtracks = 3;
656 if (
m_tauProngs[itau]==
"1Prong" ) requireNtracks = 1;
658 std::vector<TrackTrigObject> tauvec;
660 int Ntau_ =
processTaus( selectorRef, &tauvec, itype, requireNtracks, 20000 );
668 std::string tchain = std::string(
"Taus");
677 if ( selectorRef.getBeamX()!=0 || selectorRef.getBeamY()!=0 || selectorRef.getBeamZ()!=0 ) {
678 std::vector<double> beamline_;
679 beamline_.push_back( selectorRef.getBeamX() );
680 beamline_.push_back( selectorRef.getBeamY() );
681 beamline_.push_back( selectorRef.getBeamZ() );
689 else foundOffline =
true;
694 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
702 const std::string& collectionName =
m_chainNames[ichain].tail();
704 if(
chainName.find(
"L2_")==std::string::npos &&
705 chainName.find(
"EF_")==std::string::npos &&
706 chainName.find(
"HLT_")==std::string::npos )
continue;
709 else decisiontype = TrigDefs::includeFailedDecisions;
713 <<
"\tprescale " << (*m_tdt)->getPrescale(
chainName)
714 <<
"\tpass " << (*m_tdt)->isPassed(
chainName) <<
" physics "
715 <<
" (req dec " << (*m_tdt)->isPassed(
chainName, decisiontype ) <<
" dec type " << decisiontype <<
")"
722 if ( !(*m_tdt)->isPassed(
chainName, decisiontype ) )
continue;
738 if ( roi_name!=
"" ) {
740 std::string roi_name_tmp = roi_name;
741 std::string roi_tename =
"";
743 if ( roi_name.find(
"/")!=std::string::npos ) {
744 roi_name_tmp = roi_name.substr( roi_name.find(
"/")+1, roi_name.size()-roi_name.find(
"/") );
745 roi_tename = roi_name.substr( 0, roi_name.find(
"/") );
750 if ( roist.size()>0 ) {
754 m_provider->
msg(MSG::WARNING) <<
"\t\tRequested roi " << roi_name <<
" not found" <<
endmsg;
767 unsigned feature_type = TrigDefs::lastFeatureOfType;
769 if ( roi_key!=
"" ) feature_type = TrigDefs::allFeaturesOfType;
778 std::string rgex = roi_key;
780 std::vector< TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> >
rois =
790 if (
rois.empty() ) {
791 if ( !rgex.empty() ) {
806 if (
rois.size()==0 )
continue;
823 if ( roi_key==
"SuperRoi" && iroi>1 )
continue;
825 if ( roi_key.find(
"JetSuper")!=std::string::npos && iroi>1 )
continue;
830 if ( roi_key!=
"" && roi_link.
dataID()!=rgex )
continue;
853 selectorTest.clear();
856 if (
chainName.find(
"HLT_")!=std::string::npos ) {
857 if ( selectTracks<xAOD::TrackParticleContainer>( &selectorTest, roi_link, collectionName ) );
860 m_provider->
msg(MSG::WARNING) <<
"\tNo track collection " << collectionName <<
" found" <<
endmsg;
867 std::vector<TIDA::Vertex> tidavertices;
869 if ( vtx_name!=
"" ) {
878 if ( vtx_itrpair.first == vtx_itrpair.second ) {
885 m_provider->
msg(
MSG::DEBUG) <<
"\txAOD::VertexContainer found with size " << (vtx_itrpair.second - vtx_itrpair.first)
886 <<
"\t" << vtx_name <<
endmsg;
890 if ( vtx_name.find(
"SecVtx") != std::string::npos ) {
891 tidavertices = vertexBuilder.
select( vtx_itrpair.first, vtx_itrpair.second, &selectorRef.tracks(), true );
894 tidavertices = vertexBuilder.
select( vtx_itrpair.first, vtx_itrpair.second, &selectorTest.tracks() );
902 std::vector<TrackTrigObject>
jets;
903 if (
chainName.find(
"HLT_j")!=std::string::npos ) {
908 const std::vector<TIDA::Track*>& testTracks = selectorTest.tracks();
910 for (
unsigned int ii=0; ii < testTracks.size(); ii++) {
918 if ( roi_tmp == 0 ) {
919 if ( testTracks.size()>0 )
m_provider->
msg(MSG::WARNING) <<
"\ttest tracks.size() " << testTracks.size() <<
"found but no roi!!!" <<
endmsg;
923 chain.addRoi( *roi_tmp );
925 chain.back().addTracks(testTracks);
926 chain.back().addVertices(tidavertices);
933 if ( selectorTest.getBeamX()!=0 || selectorTest.getBeamY()!=0 || selectorTest.getBeamZ()!=0 ) {
934 std::vector<double> beamline_;
935 beamline_.push_back( selectorTest.getBeamX() );
936 beamline_.push_back( selectorTest.getBeamY() );
937 beamline_.push_back( selectorTest.getBeamZ() );
938 chain.back().addUserData(beamline_);
962 for (
size_t ic=chainnames.size() ;
ic-- ; ) {
963 if ( chainnames[
ic] ==
"Offline" ) {
974 std::vector<std::pair<double,double> > philims;
976 for ( ; citr!=
chains.end() ; ++citr ) {
977 if ( citr->name().find(
"HLT_")!=std::string::npos ) {
978 for (
size_t ir=0 ;
ir<citr->size() ;
ir++ ) {
981 for (
size_t isub=0 ; isub<roi.
size() ; isub++ ) {
982 philims.push_back( std::pair<double,double>( roi[isub]->phiMinus(), roi[isub]->phiPlus() ) );
985 else philims.push_back( std::pair<double,double>( roi.
phiMinus(), roi.
phiPlus() ) );
992 for (
size_t iroi=0 ; iroi<
offline->size() ; iroi++ ) {
994 std::vector<TIDA::Track>& tracks =
offline->rois()[iroi].tracks();
1003 if ( std::fabs(
it->pT())<
m_ptmin ) { inc=
false; tracks.erase(
it ); }
1006 bool remove_track =
true;
1007 for (
size_t isub=0 ; isub<philims.size() ; isub++ ) {
1009 if ( philims[isub].
first < philims[isub].
second ) {
1010 if (
it->phi()>=philims[isub].first &&
it->phi()<=philims[isub].second ) {
1011 remove_track =
false;
1016 if (
it->phi()>=philims[isub].first ||
it->phi()<=philims[isub].second ) {
1017 remove_track =
false;
1022 if ( remove_track ) { inc=
false; tracks.erase(
it ); }