243 if(
m_provider->msg().level() <= MSG::VERBOSE) {
258 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
259 m_provider->msg(MSG::VERBOSE) <<
" using beam position\tx=" << xbeam <<
"\ty=" << ybeam <<
endmsg;
261 std::vector<std::string> configuredChains = (*(
m_tdt))->getListOfTriggers(
"L2_.*, EF_.*, HLT_.*");
263 for (
unsigned i=0 ; i<configuredChains.size() ; i++ ) {
308 if (
m_mcTruth ) pselectorRef = &selectorTruth;
321 double beamline[4] = { 0, 0, 0, 0 };
330 unsigned run_number = 0;
331 unsigned long long event_number = 0;
332 unsigned lumi_block = 0;
333 unsigned bunch_crossing_id = 0;
334 unsigned time_stamp = 0;
340 if ( this->
template retrieve( pEventInfo,
"EventInfo" ).isFailure() ) {
348 bunch_crossing_id = pEventInfo->
bcid();
352 if(
m_provider->msg().level() <= MSG::VERBOSE){
353 m_provider->msg(MSG::VERBOSE) <<
"run " << run_number
354 <<
"\tevent " << event_number
355 <<
"\tlb " << lumi_block <<
endmsg;
371 bool analyse =
false;
375 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
377 const std::string& chainname =
m_chainNames[ichain].head();
379 if ( chainname ==
"" ) analyse =
true;
383 if ( chainname.find(
"L2") == std::string::npos &&
384 chainname.find(
"EF") == std::string::npos &&
385 chainname.find(
"HLT") == std::string::npos )
continue;
387 if (
m_provider->msg().level() <= MSG::DEBUG ) {
388 m_provider->msg(MSG::DEBUG) <<
"Chain " << chainname
389 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
390 <<
"\tpres " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
397 if ( (*(
m_tdt))->isPassed(chainname) ) analyse =
true;
405 if(
m_provider->msg().level() <= MSG::VERBOSE) {
406 m_provider->msg(MSG::VERBOSE) <<
"No chains passed unprescaled - not processing this event" <<
endmsg;
414 selectorTruth.
clear();
421 std::vector<TIDA::Vertex> vertices;
422 std::vector<TIDA::Vertex> vertices_rec;
424 std::vector<double> refbeamspot;
425 std::vector<double> testbeamspot;
429 m_provider->msg(MSG::VERBOSE) <<
"fetching AOD Primary vertex container" <<
endmsg;
431 if ( !this->
select( vertices,
"PrimaryVertices" ) ) {
432 m_provider->msg(MSG::VERBOSE) <<
"could not retrieve the 'PrimaryVertices' vertex collection" << std::endl;
446 for (
unsigned i=0 ; i<vertices.size() ; i++ ) {
448 m_provider->msg(MSG::VERBOSE) <<
"vertex " << i <<
" " << vertices[i] <<
endmsg;
457 std::vector<TIDA::Track*> offline_tracks;
458 std::vector<TIDA::Track*> electron_tracks;
459 std::vector<TIDA::Track*> muon_tracks;
461 std::vector<TIDA::Track*> ref_tracks;
462 std::vector<TIDA::Track*> test_tracks;
464 offline_tracks.clear();
465 electron_tracks.clear();
472 if (
m_provider->msg().level() <= MSG::VERBOSE )
475 bool foundTruth =
false;
483 selectorTruth.
clear();
485 if (
m_provider->msg().level() <= MSG::VERBOSE )
509 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
510 m_provider->msg(MSG::VERBOSE) <<
"Truth not found - none whatsoever!" <<
endmsg;
516 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
526 std::string keys[4] = {
"GEN_AOD",
"TruthEvent",
"",
"G4Truth" };
528 std::string key =
"";
530 bool foundcollection =
false;
532 for (
int ik=0 ; ik<4 ; ik++ ) {
534 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
535 m_provider->msg(MSG::VERBOSE) <<
"Try McEventCollection: " << keys[ik] <<
endmsg;
539 if(
m_provider->msg().level() <= MSG::VERBOSE )
540 m_provider->msg(MSG::VERBOSE) <<
"No McEventCollection: " << keys[ik] <<
endmsg;
544 if (
m_provider->msg().level() <= MSG::VERBOSE )
545 m_provider->msg(MSG::VERBOSE) <<
"evtStore()->retrieve( mcevent, " << keys[ik] <<
" )" <<
endmsg;
547 if ( this->
template retrieve( mcevent, keys[ik] ).isFailure() ) {
548 if (
m_provider->msg().level() <= MSG::VERBOSE )
549 m_provider->msg(MSG::VERBOSE) <<
"Failed to get McEventCollection: " << keys[ik] <<
endmsg;
555 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
endmsg;
556 foundcollection =
true;
562 if ( !foundcollection ) {
564 m_provider->msg(MSG::WARNING) <<
"No MC Truth Collections of any sort, whatsoever!!!" <<
endmsg;
572 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
573 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
"\tNevents " << mcevent->
size() <<
endmsg;
584 while ( evitr!=evend ) {
601 while ( pitr!=pend ) {
621 if(
m_provider->msg().level() <= MSG::VERBOSE){
622 m_provider->msg(MSG::VERBOSE) <<
"Found " << ip <<
" TruthParticles (GenParticles) in " << ie_ip <<
" GenEvents out of " << ie <<
endmsg;
623 m_provider->msg(MSG::VERBOSE) <<
"selected " << selectorTruth.
size() <<
" TruthParticles (GenParticles)" <<
endmsg;
626 if(selectorTruth.
size() > 0) foundTruth =
true;
651 std::unique_ptr<TrackAssociator> associator =
m_associator->uclone();
656 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
661 const std::string& chainname =
m_chainNames[ichain].head();
663 const std::string& vtx_name =
m_chainNames[ichain].vtx();
671 std::string ptvalue =
m_chainNames[ichain].postvalue(
"pt");
684 if ( chainname!=
"" &&
m_provider->msg().level() <= MSG::VERBOSE ) {
686 m_provider->msg(MSG::VERBOSE) <<
"status for chain " << chainname
687 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
688 <<
"\tprescale " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
690 m_provider->msg(MSG::VERBOSE) <<
"fetching features for chain " << chainname <<
endmsg;
692 m_provider->msg(MSG::VERBOSE) << chainname <<
"\tpassed: " << (*m_tdt)->isPassed( chainname ) <<
endmsg;
705 if ( chainname!=
"" && !this->
m_keepAllEvents && !(*m_tdt)->isPassed( chainname, decisiontype ) )
continue;
715 std::vector<std::string> chainNames ;
721 chainNames.push_back(pTnP_tool->
tag());
722 chainNames.push_back(pTnP_tool->
probe());
726 for (
size_t i=0 ; i<chainNames.size() ; i++ ) {
729 std::string chainName = chainConfig.
head();
735 if ( chainName ==
"" ) {
739 pselectorTest->
clear();
754 const std::vector<TIDA::Track*>& testtracks = pselectorTest->
tracks();
756 chain.back().addTracks(testtracks);
758 if ( vtx_name!=
"" ) {
762 m_provider->msg(MSG::VERBOSE) <<
"\tFetch xAOD::VertexContainer with key " << vtx_name <<
endmsg;
764 std::vector<TIDA::Vertex> tidavertices;
766 if ( this->
select( tidavertices, vtx_name ) ) chain.back().addVertices( tidavertices );
779 std::string roi_key = chainConfig.
roi();
789 if ( chainConfig.
element()!=
"" ) {
790 leg = std::atoi(chainConfig.
element().c_str());
793 std::string rgex = roi_key;
795 std::vector< TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> > rois =
806 if ( rois.empty() ) {
807 if ( !rgex.empty() ) {
828 if ( roi_key==
"SuperRoi" && iroi>1 )
continue;
835 if ( roi_key!=
"" && roi_link.
dataID()!=rgex )
continue;
838 if ( !roi_link.
isValid() )
continue;
842 if ( roiptr == 0 )
continue;
848 if (
m_provider->msg().level() <= MSG::VERBOSE) {
849 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainname <<
" " << **roiptr <<
endmsg;
858 pselectorTest->
clear();
866 chain.addRoi( *roiInfo );
870 const std::vector<TIDA::Track*>& testtracks = pselectorTest->
tracks();
872 chain.back().addTracks(testtracks);
877 if ( vtx_name!=
"" ) {
879 std::vector<TIDA::Vertex> tidavertices;
881 this->
select( tidavertices, roi_link, vtx_name );
883 chain.back().addVertices( tidavertices );
890 std::cout <<
"\tTIDA analysis for chain: " << chainname <<
"\t key: " << key <<
"\t" << **roiptr << std::endl;
891 std::cout <<
"\tcollections: " << chain.back() << std::endl;
905 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
913 for (
unsigned ichain=0 ; ichain<eventp->
size() ; ichain++ ) {
917 const std::string& vtx_name = chainConfig.
vtx();
920 if (
m_tnp_flag && chainConfig.
extra().find(
"_tag")!=std::string::npos ) continue ;
922 std::vector<TIDA::Roi*> rois ;
929 rois.reserve( chain.size() );
930 for (
size_t ir=0 ;
ir<chain.size() ;
ir++ ) {
931 rois.push_back( &(chain.rois()[
ir]) );
937 for (
unsigned iroi=0 ; iroi<rois.size() ; iroi++ ) {
940 filterRef.
setRoi( &(rois.at(iroi)->roi() ) );
943 else filterRef.
setRoi( 0 );
963 if (
m_provider->msg().level() <= MSG::VERBOSE )
968 ref_tracks = pselectorRef->
tracks(&filter_truth);
971 ref_tracks = pselectorRef->
tracks(&filterRef) ;
974 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
976 for (
int ii=pselectorRef->
tracks().size() ; ii-- ; ) {
984 for (
unsigned itrk=0 ; itrk<rois.at(iroi)->tracks().
size() ; itrk++ ) {
985 test_tracks.push_back(&(rois.at(iroi)->tracks().at(itrk)));
993 beamline[0] = pselectorTest->
getBeamX();
994 beamline[1] = pselectorTest->
getBeamY();
995 beamline[2] = pselectorTest->
getBeamZ();
997 beamline[3] = vertices.size();
1023 associator->match( test_tracks, ref_tracks );
1025 m_manalysis->execute( test_tracks, ref_tracks, associator.get(), eventp, beamline );
1047 associator->match( ref_tracks, test_tracks );
1054 m_manalysis->execute( ref_tracks, test_tracks, associator.get(), eventp, beamline, &(rois.at(iroi)->roi()) );
1056 if ( vtx_name!=
"" ) {
1058 std::vector<TIDA::Vertex> vr = rois.at(iroi)->vertices();
1059 std::vector<TIDA::Vertex*> vtx_rec;
1060 for (
unsigned iv=0 ; iv<vr.size() ; iv++ ) vtx_rec.push_back( &vr[iv] );
1062 std::vector<TIDA::Vertex*> vtx;
1064 for (
unsigned iv=0 ; iv<vertices.size() ; iv++ ) vtx.push_back( &vertices[iv] );
1067 if ( vertices.size()>
unsigned(this->getVtxIndex()) ) vtx.push_back( &vertices[this->
getVtxIndex()] );
1070 m_manalysis->execute_vtx( vtx, vtx_rec, eventp );
1077 <<
"\trun " << run_number
1078 <<
"\tevent " << event_number
1079 <<
"\tlb " << lumi_block <<
endmsg;
1088 if (
m_provider->msg().level() <= MSG::VERBOSE ) {