199 if(
m_provider->msg().level() <= MSG::VERBOSE) {
211 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
212 m_provider->msg(MSG::VERBOSE) <<
" using beam position\tx=" << xbeam <<
"\ty=" << ybeam <<
endmsg;
214 std::vector<std::string> configuredChains = (*(
m_tdt))->getListOfTriggers(
"L2_.*, EF_.*, HLT_.*");
216 for (
unsigned i=0 ; i<configuredChains.size() ; i++ ) {
224 std::vector<ChainString>::iterator chainitr =
m_chainNames.begin();
226 std::vector<ChainString> chains;
236 if (
m_provider->msg().level() <= MSG::VERBOSE) {
240 if ( chainName.
head() ==
"" ) {
242 std::string selectChain = chainName.
raw();
250 std::vector<std::string> selectChains = (*(
m_tdt))->getListOfTriggers( chainName.
head() );
252 for (
unsigned iselected=0 ; iselected<selectChains.size() ; iselected++ ) {
254 selectChains[iselected] = chainName.
subs( selectChains[iselected] );
257 std::cout <<
"sorting:: chain specification: " << chainName <<
"\traw:" << chainName.
raw() << std::endl;
258 std::cout <<
"\tchain: " << chainName.
head() << std::endl;
259 std::cout <<
"\tkey: " << chainName.
tail() << std::endl;
260 std::cout <<
"\tind: " << chainName.
extra() << std::endl;
261 std::cout <<
"\troi: " << chainName.
roi() << std::endl;
262 std::cout <<
"\tvtx: " << chainName.
vtx() << std::endl;
263 std::cout <<
"\tte: " << chainName.
element() << std::endl;
267 chains.push_back(
ChainString(selectChains[iselected]) );
269 if(
m_provider->msg().level() <= MSG::VERBOSE) {
270 m_provider->msg(MSG::VERBOSE) <<
"Matching chain " << selectChains[iselected] <<
" (" << chainName.
head() <<
")" <<
endmsg;
284 if(
m_provider->msg().level() <= MSG::VERBOSE) {
319 if ( xbeam!=0 || ybeam!=0 ) {
332 unsigned run_number = 0;
333 unsigned long long event_number = 0;
334 unsigned lumi_block = 0;
335 unsigned bunch_crossing_id = 0;
336 unsigned time_stamp = 0;
341 if ( this->
template retrieve(pEventInfo,
"EventInfo").isFailure() ) {
349 bunch_crossing_id = pEventInfo->
bcid();
353 if(
m_provider->msg().level() <= MSG::VERBOSE){
354 m_provider->msg(MSG::VERBOSE) <<
"run " << run_number
355 <<
"\tevent " << event_number
356 <<
"\tlb " << lumi_block <<
endmsg;
369 m_event->run_number(run_number);
370 m_event->event_number(event_number);
371 m_event->lumi_block(lumi_block);
372 m_event->time_stamp(time_stamp);
373 m_event->bunch_crossing_id(bunch_crossing_id);
379 bool analyse =
false;
385 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
387 const std::string& chainname =
m_chainNames[ichain].head();
389 if ( chainname ==
"" ) analyse =
true;
393 if ( chainname.find(
"L2") == std::string::npos &&
394 chainname.find(
"EF") == std::string::npos &&
395 chainname.find(
"HLT") == std::string::npos )
continue;
397 if (
m_provider->msg().level() <= MSG::DEBUG ) {
398 m_provider->msg(MSG::DEBUG) <<
"Chain " << chainname
399 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
400 <<
"\tpres " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
406 if ( (*(
m_tdt))->isPassed(chainname) || (*(
m_tdt))->getPrescale(chainname) ) analyse =
true;
419 if(
m_provider->msg().level() <= MSG::VERBOSE) {
420 m_provider->msg(MSG::VERBOSE) <<
"No chains passed unprescaled - not processing this event" <<
endmsg;
430 selectorTruth.
clear();
442 if ( this->
template retrieve(truthMap,
"TrigInDetTrackTruthMap").isFailure()) {
444 m_provider->msg(MSG::VERBOSE) <<
"TrigInDetTrackTruthMap not found" <<
endmsg;
457 std::vector<TIDA::Vertex> vertices;
458 std::vector<TIDA::Vertex> vertices_rec;
460 std::vector<double> refbeamspot;
461 std::vector<double> testbeamspot;
465 m_provider->msg(MSG::VERBOSE) <<
"fetching AOD Primary vertex container" <<
endmsg;
467 if ( !this->
select( vertices,
"PrimaryVertices" ) ) {
468 m_provider->msg(MSG::VERBOSE) <<
"could not retrieve vertex collection " "PrimaryVertices" << std::endl;
482 for (
unsigned i=0 ; i<vertices.size() ; i++ ) {
484 m_provider->msg(MSG::VERBOSE) <<
"vertex " << i <<
" " << vertices[i] <<
endmsg;
485 m_event->addVertex(vertices[i]);
492 std::vector<TIDA::Track*> offline_tracks;
493 std::vector<TIDA::Track*> electron_tracks;
494 std::vector<TIDA::Track*> muon_tracks;
496 std::vector<TIDA::Track*> ref_tracks;
497 std::vector<TIDA::Track*> test_tracks;
499 offline_tracks.clear();
500 electron_tracks.clear();
507 if (
m_provider->msg().level() <= MSG::VERBOSE )
510 bool foundTruth =
false;
516 selectorTruth.
clear();
518 if (
m_provider->msg().level() <= MSG::VERBOSE )
542 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
543 m_provider->msg(MSG::VERBOSE) <<
"Truth not found - none whatsoever!" <<
endmsg;
549 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
559 std::string keys[4] = {
"GEN_AOD",
"TruthEvent",
"",
"G4Truth" };
561 std::string key =
"";
563 bool foundcollection =
false;
565 for (
int ik=0 ; ik<4 ; ik++ ) {
567 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
568 m_provider->msg(MSG::VERBOSE) <<
"Try McEventCollection: " << keys[ik] <<
endmsg;
572 if(
m_provider->msg().level() <= MSG::VERBOSE )
573 m_provider->msg(MSG::VERBOSE) <<
"No McEventCollection: " << keys[ik] <<
endmsg;
577 if (
m_provider->msg().level() <= MSG::VERBOSE )
578 m_provider->msg(MSG::VERBOSE) <<
"evtStore()->retrieve( mcevent, " << keys[ik] <<
" )" <<
endmsg;
580 if ( this->
template retrieve( mcevent, keys[ik] ).isFailure() ) {
581 if (
m_provider->msg().level() <= MSG::VERBOSE )
582 m_provider->msg(MSG::VERBOSE) <<
"Failed to get McEventCollection: " << keys[ik] <<
endmsg;
588 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
endmsg;
589 foundcollection =
true;
595 if ( !foundcollection ) {
597 m_provider->msg(MSG::WARNING) <<
"No MC Truth Collections of any sort, whatsoever!!!" <<
endmsg;
605 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
606 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
"\tNevents " << mcevent->size() <<
endmsg;
617 while ( evitr!=evend ) {
626 for (
auto pitr: *(*evitr) ) {
646 if(
m_provider->msg().level() <= MSG::VERBOSE){
647 m_provider->msg(MSG::VERBOSE) <<
"Found " << ip <<
" TruthParticles (GenParticles) in " << ie_ip <<
" GenEvents out of " << ie <<
endmsg;
648 m_provider->msg(MSG::VERBOSE) <<
"selected " << selectorTruth.
size() <<
" TruthParticles (GenParticles)" <<
endmsg;
651 if(selectorTruth.
size() > 0) foundTruth =
true;
671 else if (
m_provider->msg().level() <= MSG::WARNING ) {
681 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
686 const std::string& chainname =
m_chainNames[ichain].head();
688 const std::string& vtx_name =
m_chainNames[ichain].vtx();
695 std::string ptvalue =
m_chainNames[ichain].postvalue(
"pt");
701 unsigned decisiontype;
713 if ( chainname!=
"" &&
m_provider->msg().level() <= MSG::VERBOSE ) {
715 m_provider->msg(MSG::VERBOSE) <<
"status for chain " << chainname
716 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
717 <<
"\tprescale " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
719 m_provider->msg(MSG::VERBOSE) <<
"fetching features for chain " << chainname <<
endmsg;
721 m_provider->msg(MSG::VERBOSE) << chainname <<
"\tpassed: " << (*m_tdt)->isPassed( chainname ) <<
endmsg;
734 if ( chainname!=
"" && !this->
m_keepAllEvents && !(*m_tdt)->isPassed( chainname, decisiontype ) )
continue;
745 std::vector<std::string> chainNames ;
756 for (
unsigned i = 0 ; i < chainNames.size() ; ++i ) {
759 std::string chainName = chainConfig.
head();
761 m_event->addChain( chainNames[i] );
765 if ( chainName ==
"" ) {
775 chain.addRoi( *roiInfo );
782 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
784 chain.back().addTracks(testtracks);
786 if ( vtx_name!=
"" ) {
790 m_provider->msg(MSG::VERBOSE) <<
"\tFetch xAOD::VertexContainer with key " << vtx_name <<
endmsg;
792 std::vector<TIDA::Vertex> tidavertices;
794 if ( this->
select( tidavertices, vtx_name ) ) chain.back().addVertices( tidavertices );
807 std::string roi_key = chainConfig.
roi();
817 if ( chainConfig.
element()!=
"" ) {
818 leg = std::atoi(chainConfig.
element().c_str());
821 std::vector< TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> > rois =
841 if ( roi_key==
"SuperRoi" && iroi>1 )
continue;
848 if ( roi_key!=
"" && roi_link.
dataID()!=roi_key )
continue;
858 if (
m_provider->msg().level() <= MSG::VERBOSE) {
859 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainname <<
" " << **roiptr <<
endmsg;
876 chain.addRoi( *roiInfo );
880 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
882 chain.back().addTracks(testtracks);
887 if ( vtx_name!=
"" ) {
889 std::vector<TIDA::Vertex> tidavertices;
891 this->
select( tidavertices, roi_link, vtx_name );
893 chain.back().addVertices( tidavertices );
900 std::cout <<
"\tTIDA analysis for chain: " << chainname <<
"\t key: " << key <<
"\t" << **roiptr << std::endl;
901 std::cout <<
"\tcollections: " << chain.back() << std::endl;
915 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
923 for (
unsigned ichain=0 ; ichain<
m_event->size() ; ichain++ ) {
927 const std::string& vtx_name = chainConfig.
vtx();
930 if ( TnP_flag && chainConfig.
extra().find(
"_tag")!=std::string::npos ) continue ;
932 std::vector<TIDA::Roi*> rois ;
939 rois.reserve( chain.size() );
940 for (
size_t ir=0 ;
ir<chain.size() ;
ir++ ) {
941 rois.push_back( &(chain.rois()[
ir]) );
947 for (
unsigned iroi=0 ; iroi<rois.size() ; iroi++ ) {
950 filterRef.
setRoi( &(rois.at(iroi)->roi() ) );
953 else filterRef.
setRoi( 0 );
973 if (
m_provider->msg().level() <= MSG::VERBOSE )
984 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
994 for (
unsigned itrk=0 ; itrk<rois.at(iroi)->tracks().size() ; itrk++ ) {
995 test_tracks.push_back(&(rois.at(iroi)->tracks().at(itrk)));
1000 _analysis->setvertices( vertices.size() );
1002 if ( refbeamspot.size()>0 )
_analysis->setBeamRef( refbeamspot );
1003 if ( testbeamspot.size()>0 )
_analysis->setBeamTest( testbeamspot );
1043 _analysis->setroi( &rois.at(iroi)->roi() );
1046 if ( vtx_name!=
"" ) {
1048 std::vector<TIDA::Vertex> vr = rois.at(iroi)->vertices();
1049 std::vector<TIDA::Vertex*> vtx_rec;
1050 for (
unsigned iv=0 ; iv<vr.size() ; iv++ ) vtx_rec.push_back( &vr[iv] );
1052 std::vector<TIDA::Vertex*> vtx;
1054 for (
unsigned iv=0 ; iv<vertices.size() ; iv++ ) vtx.push_back( &vertices[iv] );
1057 if ( vertices.size()>
unsigned(this->getVtxIndex()) ) vtx.push_back( &vertices[this->
getVtxIndex()] );
1060 _analysis->execute_vtx( vtx, vtx_rec,
m_event );
1067 <<
"\trun " << run_number
1068 <<
"\tevent " << event_number
1069 <<
"\tlb " << lumi_block <<
endmsg;
1076 if (
m_provider->msg().level() <= MSG::VERBOSE ) {