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 ) {
560 std::string keys[4] = {
"GEN_AOD",
"TruthEvent",
"",
"G4Truth" };
562 std::string key =
"";
564 bool foundcollection =
false;
566 for (
int ik=0 ; ik<4 ; ik++ ) {
568 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
569 m_provider->msg(MSG::VERBOSE) <<
"Try McEventCollection: " << keys[ik] <<
endmsg;
573 if(
m_provider->msg().level() <= MSG::VERBOSE )
574 m_provider->msg(MSG::VERBOSE) <<
"No McEventCollection: " << keys[ik] <<
endmsg;
578 if (
m_provider->msg().level() <= MSG::VERBOSE )
579 m_provider->msg(MSG::VERBOSE) <<
"evtStore()->retrieve( mcevent, " << keys[ik] <<
" )" <<
endmsg;
581 if ( this->
template retrieve( mcevent, keys[ik] ).isFailure() ) {
582 if (
m_provider->msg().level() <= MSG::VERBOSE )
583 m_provider->msg(MSG::VERBOSE) <<
"Failed to get McEventCollection: " << keys[ik] <<
endmsg;
589 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
endmsg;
590 foundcollection =
true;
596 if ( !foundcollection ) {
598 m_provider->msg(MSG::WARNING) <<
"No MC Truth Collections of any sort, whatsoever!!!" <<
endmsg;
606 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
607 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
"\tNevents " << mcevent->
size() <<
endmsg;
618 while ( evitr!=evend ) {
627 for (
auto pitr: *(*evitr) ) {
647 if(
m_provider->msg().level() <= MSG::VERBOSE){
648 m_provider->msg(MSG::VERBOSE) <<
"Found " << ip <<
" TruthParticles (GenParticles) in " << ie_ip <<
" GenEvents out of " << ie <<
endmsg;
649 m_provider->msg(MSG::VERBOSE) <<
"selected " << selectorTruth.
size() <<
" TruthParticles (GenParticles)" <<
endmsg;
652 if(selectorTruth.
size() > 0) foundTruth =
true;
672 else if (
m_provider->msg().level() <= MSG::WARNING ) {
682 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
687 const std::string& chainname =
m_chainNames[ichain].head();
689 const std::string& vtx_name =
m_chainNames[ichain].vtx();
696 std::string ptvalue =
m_chainNames[ichain].postvalue(
"pt");
702 unsigned decisiontype;
714 if ( chainname!=
"" &&
m_provider->msg().level() <= MSG::VERBOSE ) {
716 m_provider->msg(MSG::VERBOSE) <<
"status for chain " << chainname
717 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
718 <<
"\tprescale " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
720 m_provider->msg(MSG::VERBOSE) <<
"fetching features for chain " << chainname <<
endmsg;
722 m_provider->msg(MSG::VERBOSE) << chainname <<
"\tpassed: " << (*m_tdt)->isPassed( chainname ) <<
endmsg;
735 if ( chainname!=
"" && !this->
m_keepAllEvents && !(*m_tdt)->isPassed( chainname, decisiontype ) )
continue;
746 std::vector<std::string> chainNames ;
757 for (
unsigned i = 0 ; i < chainNames.size() ; ++i ) {
760 std::string chainName = chainConfig.
head();
762 m_event->addChain( chainNames[i] );
766 if ( chainName ==
"" ) {
776 chain.addRoi( *roiInfo );
783 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
785 chain.back().addTracks(testtracks);
787 if ( vtx_name!=
"" ) {
791 m_provider->msg(MSG::VERBOSE) <<
"\tFetch xAOD::VertexContainer with key " << vtx_name <<
endmsg;
793 std::vector<TIDA::Vertex> tidavertices;
795 if ( this->
select( tidavertices, vtx_name ) ) chain.back().addVertices( tidavertices );
808 std::string roi_key = chainConfig.
roi();
818 if ( chainConfig.
element()!=
"" ) {
819 leg = std::atoi(chainConfig.
element().c_str());
822 std::vector< TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> > rois =
842 if ( roi_key==
"SuperRoi" && iroi>1 )
continue;
849 if ( roi_key!=
"" && roi_link.
dataID()!=roi_key )
continue;
859 if (
m_provider->msg().level() <= MSG::VERBOSE) {
860 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainname <<
" " << **roiptr <<
endmsg;
877 chain.addRoi( *roiInfo );
881 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
883 chain.back().addTracks(testtracks);
888 if ( vtx_name!=
"" ) {
890 std::vector<TIDA::Vertex> tidavertices;
892 this->
select( tidavertices, roi_link, vtx_name );
894 chain.back().addVertices( tidavertices );
901 std::cout <<
"\tTIDA analysis for chain: " << chainname <<
"\t key: " << key <<
"\t" << **roiptr << std::endl;
902 std::cout <<
"\tcollections: " << chain.back() << std::endl;
916 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
924 for (
unsigned ichain=0 ; ichain<
m_event->size() ; ichain++ ) {
928 const std::string& vtx_name = chainConfig.
vtx();
931 if ( TnP_flag && chainConfig.
extra().find(
"_tag")!=std::string::npos ) continue ;
933 std::vector<TIDA::Roi*> rois ;
940 rois.reserve( chain.size() );
941 for (
size_t ir=0 ;
ir<chain.size() ;
ir++ ) {
942 rois.push_back( &(chain.rois()[
ir]) );
948 for (
unsigned iroi=0 ; iroi<rois.size() ; iroi++ ) {
951 filterRef.
setRoi( &(rois.at(iroi)->roi() ) );
954 else filterRef.
setRoi( 0 );
974 if (
m_provider->msg().level() <= MSG::VERBOSE )
985 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
995 for (
unsigned itrk=0 ; itrk<rois.at(iroi)->tracks().
size() ; itrk++ ) {
996 test_tracks.push_back(&(rois.at(iroi)->tracks().at(itrk)));
1001 _analysis->setvertices( vertices.size() );
1003 if ( refbeamspot.size()>0 )
_analysis->setBeamRef( refbeamspot );
1004 if ( testbeamspot.size()>0 )
_analysis->setBeamTest( testbeamspot );
1044 _analysis->setroi( &rois.at(iroi)->roi() );
1047 if ( vtx_name!=
"" ) {
1049 std::vector<TIDA::Vertex> vr = rois.at(iroi)->vertices();
1050 std::vector<TIDA::Vertex*> vtx_rec;
1051 for (
unsigned iv=0 ; iv<vr.size() ; iv++ ) vtx_rec.push_back( &vr[iv] );
1053 std::vector<TIDA::Vertex*> vtx;
1055 for (
unsigned iv=0 ; iv<vertices.size() ; iv++ ) vtx.push_back( &vertices[iv] );
1058 if ( vertices.size()>
unsigned(this->getVtxIndex()) ) vtx.push_back( &vertices[this->
getVtxIndex()] );
1061 _analysis->execute_vtx( vtx, vtx_rec,
m_event );
1068 <<
"\trun " << run_number
1069 <<
"\tevent " << event_number
1070 <<
"\tlb " << lumi_block <<
endmsg;
1077 if (
m_provider->msg().level() <= MSG::VERBOSE ) {