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();
281 if (
retrieve(truthMap,
"TrigInDetTrackTruthMap").isFailure()) {
308 m_provider->msg(MSG::WARNING) <<
"Truth not found - none whatsoever!" <<
endmsg;
338 std::vector<TIDA::Vertex> vertices;
340 std::string vertexType =
"PrimaryVertices";
341 std::string vertexChainname =
"Vertex";
344 vertexChainname +=
":" + vertexType;
347 m_provider->msg(MSG::VERBOSE) <<
"fetching offline AOD vertex container with key " << vertexType <<
endmsg;
351 if (
retrieve( xaodVtxCollection, vertexType ).isFailure()) {
352 if (
m_provider->msg().level() <= MSG::WARNING)
m_provider->msg(MSG::WARNING) <<
"xAOD vertex container not found with key " << vertexType <<
endmsg;
355 if ( xaodVtxCollection!=0 ) {
357 m_provider->msg(MSG::DEBUG) <<
"xAOD vertex container " << vertexType <<
" found with " << xaodVtxCollection->
size() <<
" entries" <<
endmsg;
361 if ( vertexType.find(
"SecVtx") != std::string::npos ) {
362 vertices = vertexBuilder.
select( xaodVtxCollection, &selectorRef.
tracks(),
true );
365 vertices = vertexBuilder.
select( xaodVtxCollection, &selectorRef.
tracks() );
371 m_event->addChain( vertexChainname );
373 m_event->back().back().addVertices( vertices );
389 for (
unsigned i=0 ; i<vertices.size() ; i++ ) {
390 m_provider->msg(MSG::DEBUG) <<
"vertex " << i <<
" " << vertices[i] <<
endmsg;
391 m_event->addVertex(vertices[i]);
406 m_event->addChain(
"Offline" );
411 std::vector<double> beamline_;
412 beamline_.push_back( selectorRef.
getBeamX() );
413 beamline_.push_back( selectorRef.
getBeamY() );
414 beamline_.push_back( selectorRef.
getBeamZ() );
415 m_event->back().back().addUserData(beamline_);
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 );
470 m_provider->msg(MSG::WARNING) <<
"\tcollection " << collectionname <<
" not found" <<
endmsg;
476 std::vector<TIDA::Vertex> tidavertices;
478 m_provider->msg(MSG::DEBUG) <<
"\tFetch xAOD::VertexContainer with key " << vtx_name <<
endmsg;
480 if ( vtx_name!=
"" ) {
482 m_provider->msg(MSG::DEBUG) <<
"\tFetch xAOD::VertexContainer with key " << vtx_name <<
endmsg;
488 if (
retrieve( xaodVtxCollection, vtx_name ).isFailure() ) {
489 if (
m_provider->msg().level() <= MSG::WARNING)
m_provider->msg(MSG::WARNING) <<
"xAOD vertex container not found with key " << vtx_name <<
endmsg;
492 if ( xaodVtxCollection!=0 ) {
494 m_provider->msg(MSG::DEBUG) <<
"\txAOD::VertexContainer found with size " << xaodVtxCollection->
size()
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 );
512 m_event->addChain( chainname );
514 if ( vtx_name!=
"" )
m_event->back().back().addVertices( tidavertices );
518 std::vector<double> beamline_;
519 beamline_.push_back( selectorTest.
getBeamX() );
520 beamline_.push_back( selectorTest.
getBeamY() );
521 beamline_.push_back( selectorTest.
getBeamZ() );
522 m_event->back().back().addUserData(beamline_);
525 int Ntest = selectorTest.
tracks().size();
527 m_provider->msg(MSG::DEBUG) <<
"collection " << collectionname <<
"\ttest tracks.size() " << Ntest <<
endmsg;
528 for (
int ii=Ntest ; ii-- ; )
m_provider->msg(MSG::DEBUG) <<
" test track " << ii <<
" " << *selectorTest.
tracks()[ii] <<
endmsg;
533 std::string ElectronRef[7] = {
535 "TightCB",
"MediumCB",
"LooseCB",
536 "TightLH",
"MediumLH",
"LooseLH" };
546 for (
int it=0 ; it<7 ; it++ )
if (
m_electronType[ielec]==ElectronRef[it] ) itype = it;
547 if ( itype<0 )
continue;
549 std::vector<TrackTrigObject> elevec;
551 std::string echain = std::string(
"Electrons");
556 if ( Nel_ < 1 )
continue;
566 m_event->back().back().addObjects( elevec );
569 std::vector<double> beamline_;
570 beamline_.push_back( selectorRef.
getBeamX() );
571 beamline_.push_back( selectorRef.
getBeamY() );
572 beamline_.push_back( selectorRef.
getBeamZ() );
573 m_event->back().back().addUserData(beamline_);
579 std::string MuonRef[5] = {
"",
"Tight",
"Medium",
"Loose",
"VeryLoose" };
582 for (
size_t imuon=0 ; imuon<
m_muonType.size() ; imuon++ ) {
587 for (
int it=0 ; it<5 ; it++ )
if (
m_muonType[imuon] == MuonRef[it] ) muonType=it;
588 if ( muonType<0 )
continue;
590 std::string mchain =
"Muons";
593 int Nmu_ =
processMuons( selectorRef, muonType, 0, mchain );
595 if ( Nmu_ < 1 )
continue;
599 m_provider->msg(MSG::DEBUG) <<
"found " << Nmu <<
" offline muons " <<
endmsg;
608 std::vector<double> beamline_;
609 beamline_.push_back( selectorRef.
getBeamX() );
610 beamline_.push_back( selectorRef.
getBeamY() );
611 beamline_.push_back( selectorRef.
getBeamZ() );
612 m_event->back().back().addUserData(beamline_);
616 for (
int ii=selectorRef.
tracks().size() ; ii-- ; )
m_provider->msg(MSG::DEBUG) <<
" ref muon track " << ii <<
" " << *selectorRef.
tracks()[ii] <<
endmsg;
629 m_provider->msg(MSG::DEBUG) <<
"found " << Nmu <<
" offline muons " <<
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++ ) {
650 for (
int it=0 ; it<4 ; it++ )
if (
m_tauType[itau]==TauRef[it] ) itype = it;
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");
675 m_event->back().back().addObjects( tauvec ) ;
678 std::vector<double> beamline_;
679 beamline_.push_back( selectorRef.
getBeamX() );
680 beamline_.push_back( selectorRef.
getBeamY() );
681 beamline_.push_back( selectorRef.
getBeamZ() );
682 m_event->back().back().addUserData(beamline_);
688 if ( Nmu==0 && Noff==0 && Nel==0 && Ntau==0 )
m_provider->msg(MSG::DEBUG) <<
"No offline objects found " <<
endmsg;
689 else foundOffline =
true;
694 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
699 const std::string& chainName =
m_chainNames[ichain].head();
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;
712 m_provider->msg(MSG::DEBUG) <<
"chain " << chainName
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 ) {
751 for (
unsigned ir=0 ;
ir<roist.size() ;
ir++ )
m_provider->msg(MSG::DEBUG) <<
"\t\tRetrieved roi " << roi_name <<
"\t" << *roist[
ir].cptr() <<
endmsg;
754 m_provider->msg(MSG::WARNING) <<
"\t\tRequested roi " << roi_name <<
" not found" <<
endmsg;
774 leg = std::atoi(
m_chainNames[ichain].element().c_str());
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;
839 if (
m_provider->msg().level() <= MSG::VERBOSE) {
840 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainName <<
" " << **roiptr <<
endmsg;
853 selectorTest.
clear();
856 if ( chainName.find(
"HLT_")!=std::string::npos ) {
859 if (
m_provider->msg().level() <= MSG::DEBUG) {
860 m_provider->msg(MSG::WARNING) <<
"\tNo track collection " << collectionName <<
" found" <<
endmsg;
867 std::vector<TIDA::Vertex> tidavertices;
869 if ( vtx_name!=
"" ) {
871 m_provider->msg(MSG::DEBUG) <<
"\tFetch xAOD::VertexContainer for chain " << chainName <<
" with key " << vtx_name <<
endmsg;
878 if ( vtx_itrpair.first == vtx_itrpair.second ) {
879 if (
m_provider->msg().level() <= MSG::DEBUG ) {
880 m_provider->msg(MSG::WARNING) <<
"\tNo xAOD::Vertex for chain " << chainName <<
" for key " << vtx_name <<
endmsg;
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();
909 m_provider->msg(MSG::DEBUG) <<
"\ttest tracks.size() " << testTracks.size() <<
endmsg;
910 for (
unsigned int ii=0; ii < testTracks.size(); ii++) {
911 m_provider->msg(MSG::DEBUG) <<
" test track " << ii <<
"for chain " << chainName +
":" + collectionName <<
" " << *testTracks[ii] <<
endmsg;
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);
930 if ( chainName.find(
"HLT_j")!=std::string::npos ) chain.back().addObjects( jets );
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_);
958 std::vector<std::string> chainnames =
m_event->chainnames();
962 for (
size_t ic=chainnames.size() ; ic-- ; ) {
963 if ( chainnames[ic] ==
"Offline" ) {
971 std::vector<TIDA::Chain>& chains =
m_event->chains();
972 std::vector<TIDA::Chain>::iterator citr = chains.begin();
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();
1000 for ( std::vector<TIDA::Track>::iterator it=tracks.begin() ; it<tracks.end() ; ) {
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 ); }