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;
637 bool found_offline =
false;
643 found_offline =
true;
650 if ( !found_offline ) {
656 m_provider->msg(MSG::WARNING) <<
"Offline tracks not found: " <<
"TrackParticleCandidate" <<
endmsg;
664 std::unique_ptr<TrackAssociator> associator =
m_associator->uclone();
669 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
674 const std::string& chainname =
m_chainNames[ichain].head();
676 const std::string& vtx_name =
m_chainNames[ichain].vtx();
684 std::string ptvalue =
m_chainNames[ichain].postvalue(
"pt");
697 if ( chainname!=
"" &&
m_provider->msg().level() <= MSG::VERBOSE ) {
699 m_provider->msg(MSG::VERBOSE) <<
"status for chain " << chainname
700 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
701 <<
"\tprescale " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
703 m_provider->msg(MSG::VERBOSE) <<
"fetching features for chain " << chainname <<
endmsg;
705 m_provider->msg(MSG::VERBOSE) << chainname <<
"\tpassed: " << (*m_tdt)->isPassed( chainname ) <<
endmsg;
718 if ( chainname!=
"" && !this->
m_keepAllEvents && !(*m_tdt)->isPassed( chainname, decisiontype ) )
continue;
728 std::vector<std::string> chainNames ;
734 chainNames.push_back(pTnP_tool->
tag());
735 chainNames.push_back(pTnP_tool->
probe());
739 for (
size_t i=0 ; i<chainNames.size() ; i++ ) {
742 std::string chainName = chainConfig.
head();
748 if ( chainName ==
"" ) {
752 pselectorTest->
clear();
767 const std::vector<TIDA::Track*>& testtracks = pselectorTest->
tracks();
769 chain.back().addTracks(testtracks);
771 if ( vtx_name!=
"" ) {
775 m_provider->msg(MSG::VERBOSE) <<
"\tFetch xAOD::VertexContainer with key " << vtx_name <<
endmsg;
777 std::vector<TIDA::Vertex> tidavertices;
779 if ( this->
select( tidavertices, vtx_name ) ) chain.back().addVertices( tidavertices );
792 std::string roi_key = chainConfig.
roi();
802 if ( chainConfig.
element()!=
"" ) {
803 leg = std::atoi(chainConfig.
element().c_str());
806 std::string rgex = roi_key;
808 std::vector< TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> > rois =
819 if ( rois.empty() ) {
820 if ( !rgex.empty() ) {
841 if ( roi_key==
"SuperRoi" && iroi>1 )
continue;
848 if ( roi_key!=
"" && roi_link.
dataID()!=rgex )
continue;
851 if ( !roi_link.
isValid() )
continue;
855 if ( roiptr == 0 )
continue;
861 if (
m_provider->msg().level() <= MSG::VERBOSE) {
862 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainname <<
" " << **roiptr <<
endmsg;
871 pselectorTest->
clear();
879 chain.addRoi( *roiInfo );
883 const std::vector<TIDA::Track*>& testtracks = pselectorTest->
tracks();
885 chain.back().addTracks(testtracks);
890 if ( vtx_name!=
"" ) {
892 std::vector<TIDA::Vertex> tidavertices;
894 this->
select( tidavertices, roi_link, vtx_name );
896 chain.back().addVertices( tidavertices );
903 std::cout <<
"\tTIDA analysis for chain: " << chainname <<
"\t key: " << key <<
"\t" << **roiptr << std::endl;
904 std::cout <<
"\tcollections: " << chain.back() << std::endl;
918 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
926 for (
unsigned ichain=0 ; ichain<eventp->
size() ; ichain++ ) {
930 const std::string& vtx_name = chainConfig.
vtx();
933 if (
m_tnp_flag && chainConfig.
extra().find(
"_tag")!=std::string::npos ) continue ;
935 std::vector<TIDA::Roi*> rois ;
942 rois.reserve( chain.size() );
943 for (
size_t ir=0 ;
ir<chain.size() ;
ir++ ) {
944 rois.push_back( &(chain.rois()[
ir]) );
950 for (
unsigned iroi=0 ; iroi<rois.size() ; iroi++ ) {
953 filterRef.
setRoi( &(rois.at(iroi)->roi() ) );
956 else filterRef.
setRoi( 0 );
976 if (
m_provider->msg().level() <= MSG::VERBOSE )
981 ref_tracks = pselectorRef->
tracks(&filter_truth);
984 ref_tracks = pselectorRef->
tracks(&filterRef) ;
987 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
989 for (
int ii=pselectorRef->
tracks().size() ; ii-- ; ) {
997 for (
unsigned itrk=0 ; itrk<rois.at(iroi)->tracks().
size() ; itrk++ ) {
998 test_tracks.push_back(&(rois.at(iroi)->tracks().at(itrk)));
1006 beamline[0] = pselectorTest->
getBeamX();
1007 beamline[1] = pselectorTest->
getBeamY();
1008 beamline[2] = pselectorTest->
getBeamZ();
1010 beamline[3] = vertices.size();
1036 associator->match( test_tracks, ref_tracks );
1038 m_manalysis->execute( test_tracks, ref_tracks, associator.get(), eventp, beamline );
1060 associator->match( ref_tracks, test_tracks );
1067 m_manalysis->execute( ref_tracks, test_tracks, associator.get(), eventp, beamline, &(rois.at(iroi)->roi()) );
1069 if ( vtx_name!=
"" ) {
1071 std::vector<TIDA::Vertex> vr = rois.at(iroi)->vertices();
1072 std::vector<TIDA::Vertex*> vtx_rec;
1073 for (
unsigned iv=0 ; iv<vr.size() ; iv++ ) vtx_rec.push_back( &vr[iv] );
1075 std::vector<TIDA::Vertex*> vtx;
1077 for (
unsigned iv=0 ; iv<vertices.size() ; iv++ ) vtx.push_back( &vertices[iv] );
1080 if ( vertices.size()>
unsigned(this->getVtxIndex()) ) vtx.push_back( &vertices[this->
getVtxIndex()] );
1083 m_manalysis->execute_vtx( vtx, vtx_rec, eventp );
1090 <<
"\trun " << run_number
1091 <<
"\tevent " << event_number
1092 <<
"\tlb " << lumi_block <<
endmsg;
1101 if (
m_provider->msg().level() <= MSG::VERBOSE ) {