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 ) {
147 if ( xbeam_online!=0 || ybeam_online!=0 ) {
148 selectorTest.
setBeamline( xbeam_online, ybeam_online, zbeam_online );
161 unsigned run_number = 0;
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();
180 m_provider->msg(MSG::DEBUG) <<
"run " << run_number
181 <<
"\tevent " << event_number
182 <<
"\tlb " << lumi_block <<
endmsg;
184 m_event->run_number(run_number);
185 m_event->event_number(event_number);
186 m_event->lumi_block(lumi_block);
187 m_event->time_stamp(time_stamp);
188 m_event->bunch_crossing_id(bunch_crossing_id);
197 <<
"L2 pass " << L2chain->
isPassed() <<
"\t"
198 <<
"EF pass " << EFchain->
isPassed() <<
"\t"
199 <<
"HLT pass " << HLTchain->
isPassed() <<
"␛[m"
205 bool analyse =
false;
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() ) {
231 m_provider->msg(MSG::WARNING) <<
"␛[91;1m" <<
"Chain " << chainName
232 <<
" is not configured for this event" <<
"␛[m"
240 std::string roistring =
"";
243 bool passPhysics = (*m_tdt)->isPassed(chainName);
245 m_provider->msg(MSG::DEBUG) <<
"Chain " << chainName <<
"\troi " << roistring
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;
250 if ( (*m_tdt)->isPassed(chainName, decisiontype ) || !
m_chainNames[ichain].passed() ) {
262 m_provider->msg(MSG::DEBUG) <<
"No chains passed unprescaled - not processing this event: " << run_number <<
" " << event_number <<
" " << lumi_block <<
endmsg;
274 selectorTruth.
clear();
302 m_provider->msg(MSG::WARNING) <<
"Truth not found - none whatsoever!" <<
endmsg;
332 std::vector<TIDA::Vertex> vertices;
334 std::string vertexType =
"PrimaryVertices";
335 std::string vertexChainname =
"Vertex";
338 vertexChainname +=
":" + vertexType;
341 m_provider->msg(MSG::VERBOSE) <<
"fetching offline AOD vertex container with key " << vertexType <<
endmsg;
345 if (
retrieve( xaodVtxCollection, vertexType ).isFailure()) {
346 if (
m_provider->msg().level() <= MSG::WARNING)
m_provider->msg(MSG::WARNING) <<
"xAOD vertex container not found with key " << vertexType <<
endmsg;
349 if ( xaodVtxCollection!=0 ) {
351 m_provider->msg(MSG::DEBUG) <<
"xAOD vertex container " << vertexType <<
" found with " << xaodVtxCollection->
size() <<
" entries" <<
endmsg;
355 if ( vertexType.find(
"SecVtx") != std::string::npos ) {
356 vertices = vertexBuilder.
select( xaodVtxCollection, &selectorRef.
tracks(),
true );
359 vertices = vertexBuilder.
select( xaodVtxCollection, &selectorRef.
tracks() );
365 m_event->addChain( vertexChainname );
367 m_event->back().back().addVertices( vertices );
383 for (
unsigned i=0 ; i<vertices.size() ; i++ ) {
384 m_provider->msg(MSG::DEBUG) <<
"vertex " << i <<
" " << vertices[i] <<
endmsg;
385 m_event->addVertex(vertices[i]);
400 m_event->addChain(
"Offline" );
405 std::vector<double> beamline_;
406 beamline_.push_back( selectorRef.
getBeamX() );
407 beamline_.push_back( selectorRef.
getBeamY() );
408 beamline_.push_back( selectorRef.
getBeamZ() );
409 m_event->back().back().addUserData(beamline_);
413 Noff = selectorRef.
tracks().size();
416 for (
int ii=selectorRef.
tracks().size() ; ii-- ; )
m_provider->msg(MSG::DEBUG) <<
" ref track " << ii <<
" " << *selectorRef.
tracks()[ii] <<
endmsg;
421 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
428 std::string collectionname =
m_chainNames[ichain].tail();
432 if ( chainname!=
"" )
continue;
433 if ( collectionname==
"" )
continue;
435 chainname = collectionname;
436 if ( vtx_name!=
"" ) chainname +=
":" + vtx_name;
443 selectorTest.
clear();
447 std::string collection_test = collectionname;
448 size_t pos = collectionname.find(
"/");
449 if ( pos!=std::string::npos ) collection_test = collectionname.substr( pos+1, collectionname.size()-pos );
461 m_provider->msg(MSG::WARNING) <<
"\tcollection " << collectionname <<
" not found" <<
endmsg;
467 std::vector<TIDA::Vertex> tidavertices;
469 m_provider->msg(MSG::DEBUG) <<
"\tFetch xAOD::VertexContainer with key " << vtx_name <<
endmsg;
471 if ( vtx_name!=
"" ) {
473 m_provider->msg(MSG::DEBUG) <<
"\tFetch xAOD::VertexContainer with key " << vtx_name <<
endmsg;
479 if (
retrieve( xaodVtxCollection, vtx_name ).isFailure() ) {
480 if (
m_provider->msg().level() <= MSG::WARNING)
m_provider->msg(MSG::WARNING) <<
"xAOD vertex container not found with key " << vtx_name <<
endmsg;
483 if ( xaodVtxCollection!=0 ) {
485 m_provider->msg(MSG::DEBUG) <<
"\txAOD::VertexContainer found with size " << xaodVtxCollection->
size()
486 <<
"\t" << vtx_name <<
endmsg;
490 if ( vtx_name.find(
"SecVtx") != std::string::npos ) {
491 tidavertices = vertexBuilder.
select( xaodVtxCollection, 0,
true );
494 tidavertices = vertexBuilder.
select( xaodVtxCollection );
503 m_event->addChain( chainname );
505 if ( vtx_name!=
"" )
m_event->back().back().addVertices( tidavertices );
509 std::vector<double> beamline_;
510 beamline_.push_back( selectorTest.
getBeamX() );
511 beamline_.push_back( selectorTest.
getBeamY() );
512 beamline_.push_back( selectorTest.
getBeamZ() );
513 m_event->back().back().addUserData(beamline_);
516 int Ntest = selectorTest.
tracks().size();
518 m_provider->msg(MSG::DEBUG) <<
"collection " << collectionname <<
"\ttest tracks.size() " << Ntest <<
endmsg;
519 for (
int ii=Ntest ; ii-- ; )
m_provider->msg(MSG::DEBUG) <<
" test track " << ii <<
" " << *selectorTest.
tracks()[ii] <<
endmsg;
524 std::string ElectronRef[7] = {
526 "TightCB",
"MediumCB",
"LooseCB",
527 "TightLH",
"MediumLH",
"LooseLH" };
537 for (
int it=0 ; it<7 ; it++ )
if (
m_electronType[ielec]==ElectronRef[it] ) itype = it;
538 if ( itype<0 )
continue;
540 std::vector<TrackTrigObject> elevec;
542 std::string echain = std::string(
"Electrons");
547 if ( Nel_ < 1 )
continue;
557 m_event->back().back().addObjects( elevec );
560 std::vector<double> beamline_;
561 beamline_.push_back( selectorRef.
getBeamX() );
562 beamline_.push_back( selectorRef.
getBeamY() );
563 beamline_.push_back( selectorRef.
getBeamZ() );
564 m_event->back().back().addUserData(beamline_);
570 std::string MuonRef[5] = {
"",
"Tight",
"Medium",
"Loose",
"VeryLoose" };
573 for (
size_t imuon=0 ; imuon<
m_muonType.size() ; imuon++ ) {
578 for (
int it=0 ; it<5 ; it++ )
if (
m_muonType[imuon] == MuonRef[it] ) muonType=it;
579 if ( muonType<0 )
continue;
581 std::string mchain =
"Muons";
584 int Nmu_ =
processMuons( selectorRef, muonType, 0, mchain );
586 if ( Nmu_ < 1 )
continue;
590 m_provider->msg(MSG::DEBUG) <<
"found " << Nmu <<
" offline muons " <<
endmsg;
599 std::vector<double> beamline_;
600 beamline_.push_back( selectorRef.
getBeamX() );
601 beamline_.push_back( selectorRef.
getBeamY() );
602 beamline_.push_back( selectorRef.
getBeamZ() );
603 m_event->back().back().addUserData(beamline_);
607 for (
int ii=selectorRef.
tracks().size() ; ii-- ; )
m_provider->msg(MSG::DEBUG) <<
" ref muon track " << ii <<
" " << *selectorRef.
tracks()[ii] <<
endmsg;
620 m_provider->msg(MSG::DEBUG) <<
"found " << Nmu <<
" offline muons " <<
endmsg;
627 for (
int ii=selectorRef.
tracks().size() ; ii-- ; )
m_provider->msg(MSG::DEBUG) <<
" ref muon track " << ii <<
" " << *selectorRef.
tracks()[ii] <<
endmsg;
633 std::string TauRef[4] = {
"",
"Tight",
"Medium",
"Loose" };
636 for (
size_t itau=0 ; itau<
m_tauType.size() ; itau++ ) {
641 for (
int it=0 ; it<4 ; it++ )
if (
m_tauType[itau]==TauRef[it] ) itype = it;
642 if ( itype<0 )
continue;
645 int requireNtracks = 0;
646 if (
m_tauProngs[itau]==
"3Prong" ) requireNtracks = 3;
647 if (
m_tauProngs[itau]==
"1Prong" ) requireNtracks = 1;
649 std::vector<TrackTrigObject> tauvec;
651 int Ntau_ =
processTaus( selectorRef, &tauvec, itype, requireNtracks, 20000 );
659 std::string tchain = std::string(
"Taus");
666 m_event->back().back().addObjects( tauvec ) ;
669 std::vector<double> beamline_;
670 beamline_.push_back( selectorRef.
getBeamX() );
671 beamline_.push_back( selectorRef.
getBeamY() );
672 beamline_.push_back( selectorRef.
getBeamZ() );
673 m_event->back().back().addUserData(beamline_);
679 if ( Nmu==0 && Noff==0 && Nel==0 && Ntau==0 )
m_provider->msg(MSG::DEBUG) <<
"No offline objects found " <<
endmsg;
680 else foundOffline =
true;
685 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
690 const std::string& chainName =
m_chainNames[ichain].head();
693 const std::string& collectionName =
m_chainNames[ichain].tail();
695 if( chainName.find(
"L2_")==std::string::npos &&
696 chainName.find(
"EF_")==std::string::npos &&
697 chainName.find(
"HLT_")==std::string::npos )
continue;
703 m_provider->msg(MSG::DEBUG) <<
"chain " << chainName
704 <<
"\tprescale " << (*m_tdt)->getPrescale(chainName)
705 <<
"\tpass " << (*m_tdt)->isPassed(chainName) <<
" physics "
706 <<
" (req dec " << (*m_tdt)->isPassed(chainName, decisiontype ) <<
" dec type " << decisiontype <<
")"
713 if ( !(*m_tdt)->isPassed( chainName, decisiontype ) )
continue;
729 if ( roi_name!=
"" ) {
731 std::string roi_name_tmp = roi_name;
732 std::string roi_tename =
"";
734 if ( roi_name.find(
"/")!=std::string::npos ) {
735 roi_name_tmp = roi_name.substr( roi_name.find(
"/")+1, roi_name.size()-roi_name.find(
"/") );
736 roi_tename = roi_name.substr( 0, roi_name.find(
"/") );
741 if ( roist.size()>0 ) {
742 for (
unsigned ir=0 ;
ir<roist.size() ;
ir++ )
m_provider->msg(MSG::DEBUG) <<
"\t\tRetrieved roi " << roi_name <<
"\t" << *roist[
ir].cptr() <<
endmsg;
745 m_provider->msg(MSG::WARNING) <<
"\t\tRequested roi " << roi_name <<
" not found" <<
endmsg;
765 leg = std::atoi(
m_chainNames[ichain].element().c_str());
769 std::string rgex = roi_key;
771 std::vector< TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> > rois =
781 if ( rois.empty() ) {
782 if ( !rgex.empty() ) {
797 if ( rois.size()==0 )
continue;
814 if ( roi_key==
"SuperRoi" && iroi>1 )
continue;
816 if ( roi_key.find(
"JetSuper")!=std::string::npos && iroi>1 )
continue;
821 if ( roi_key!=
"" && roi_link.
dataID()!=rgex )
continue;
830 if (
m_provider->msg().level() <= MSG::VERBOSE) {
831 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainName <<
" " << **roiptr <<
endmsg;
844 selectorTest.
clear();
847 if ( chainName.find(
"HLT_")!=std::string::npos ) {
850 if (
m_provider->msg().level() <= MSG::DEBUG) {
851 m_provider->msg(MSG::WARNING) <<
"\tNo track collection " << collectionName <<
" found" <<
endmsg;
858 std::vector<TIDA::Vertex> tidavertices;
860 if ( vtx_name!=
"" ) {
862 m_provider->msg(MSG::DEBUG) <<
"\tFetch xAOD::VertexContainer for chain " << chainName <<
" with key " << vtx_name <<
endmsg;
869 if ( vtx_itrpair.first == vtx_itrpair.second ) {
870 if (
m_provider->msg().level() <= MSG::DEBUG ) {
871 m_provider->msg(MSG::WARNING) <<
"\tNo xAOD::Vertex for chain " << chainName <<
" for key " << vtx_name <<
endmsg;
876 m_provider->msg(MSG::DEBUG) <<
"\txAOD::VertexContainer found with size " << (vtx_itrpair.second - vtx_itrpair.first)
877 <<
"\t" << vtx_name <<
endmsg;
881 if ( vtx_name.find(
"SecVtx") != std::string::npos ) {
882 tidavertices = vertexBuilder.
select( vtx_itrpair.first, vtx_itrpair.second, &selectorRef.
tracks(),
true );
885 tidavertices = vertexBuilder.
select( vtx_itrpair.first, vtx_itrpair.second, &selectorTest.
tracks() );
893 std::vector<TrackTrigObject> jets;
894 if ( chainName.find(
"HLT_j")!=std::string::npos ) {
899 const std::vector<TIDA::Track*>& testTracks = selectorTest.
tracks();
900 m_provider->msg(MSG::DEBUG) <<
"\ttest tracks.size() " << testTracks.size() <<
endmsg;
901 for (
unsigned int ii=0; ii < testTracks.size(); ii++) {
902 m_provider->msg(MSG::DEBUG) <<
" test track " << ii <<
"for chain " << chainName +
":" + collectionName <<
" " << *testTracks[ii] <<
endmsg;
909 if ( roi_tmp == 0 ) {
910 if ( testTracks.size()>0 )
m_provider->msg(MSG::WARNING) <<
"\ttest tracks.size() " << testTracks.size() <<
"found but no roi!!!" <<
endmsg;
914 chain.addRoi( *roi_tmp );
916 chain.back().addTracks(testTracks);
917 chain.back().addVertices(tidavertices);
921 if ( chainName.find(
"HLT_j")!=std::string::npos ) chain.back().addObjects( jets );
925 std::vector<double> beamline_;
926 beamline_.push_back( selectorTest.
getBeamX() );
927 beamline_.push_back( selectorTest.
getBeamY() );
928 beamline_.push_back( selectorTest.
getBeamZ() );
929 chain.back().addUserData(beamline_);
949 std::vector<std::string> chainnames =
m_event->chainnames();
953 for (
size_t ic=chainnames.size() ; ic-- ; ) {
954 if ( chainnames[ic] ==
"Offline" ) {
962 std::vector<TIDA::Chain>& chains =
m_event->chains();
963 std::vector<TIDA::Chain>::iterator citr = chains.begin();
965 std::vector<std::pair<double,double> > philims;
967 for ( ; citr!=chains.end() ; ++citr ) {
968 if ( citr->name().find(
"HLT_")!=std::string::npos ) {
969 for (
size_t ir=0 ;
ir<citr->size() ;
ir++ ) {
972 for (
size_t isub=0 ; isub<roi.
size() ; isub++ ) {
973 philims.push_back( std::pair<double,double>( roi[isub]->phiMinus(), roi[isub]->phiPlus() ) );
976 else philims.push_back( std::pair<double,double>( roi.
phiMinus(), roi.
phiPlus() ) );
983 for (
size_t iroi=0 ; iroi<
offline->size() ; iroi++ ) {
985 std::vector<TIDA::Track>& tracks =
offline->rois()[iroi].tracks();
991 for ( std::vector<TIDA::Track>::iterator it=tracks.begin() ; it<tracks.end() ; ) {
994 if ( std::fabs(it->pT())<
m_ptmin ) { inc=
false; tracks.erase( it ); }
997 bool remove_track =
true;
998 for (
size_t isub=0 ; isub<philims.size() ; isub++ ) {
1000 if ( philims[isub].first < philims[isub].second ) {
1001 if ( it->phi()>=philims[isub].first && it->phi()<=philims[isub].second ) {
1002 remove_track =
false;
1007 if ( it->phi()>=philims[isub].first || it->phi()<=philims[isub].second ) {
1008 remove_track =
false;
1013 if ( remove_track ) { inc=
false; tracks.erase( it ); }