250 if(
m_provider->msg().level() <= MSG::VERBOSE) {
265 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
266 m_provider->msg(MSG::VERBOSE) <<
" using beam position\tx=" << xbeam <<
"\ty=" << ybeam <<
endmsg;
268 std::vector<std::string> configuredChains = (*(
m_tdt))->getListOfTriggers(
"L2_.*, EF_.*, HLT_.*");
270 for (
unsigned i=0 ; i<configuredChains.size() ; i++ ) {
315 if (
m_mcTruth ) pselectorRef = &selectorTruth;
328 double beamline[4] = { 0, 0, 0, 0 };
337 unsigned run_number = 0;
338 unsigned long long event_number = 0;
339 unsigned lumi_block = 0;
340 unsigned bunch_crossing_id = 0;
341 unsigned time_stamp = 0;
347 if ( this->
template retrieve( pEventInfo,
"EventInfo" ).isFailure() ) {
355 bunch_crossing_id = pEventInfo->
bcid();
359 if(
m_provider->msg().level() <= MSG::VERBOSE){
360 m_provider->msg(MSG::VERBOSE) <<
"run " << run_number
361 <<
"\tevent " << event_number
362 <<
"\tlb " << lumi_block <<
endmsg;
378 bool analyse =
false;
382 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
384 const std::string& chainname =
m_chainNames[ichain].head();
386 if ( chainname ==
"" ) analyse =
true;
390 if ( chainname.find(
"L2") == std::string::npos &&
391 chainname.find(
"EF") == std::string::npos &&
392 chainname.find(
"HLT") == std::string::npos )
continue;
394 if (
m_provider->msg().level() <= MSG::DEBUG ) {
395 m_provider->msg(MSG::DEBUG) <<
"Chain " << chainname
396 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
397 <<
"\tpres " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
404 if ( (*(
m_tdt))->isPassed(chainname) ) analyse =
true;
412 if(
m_provider->msg().level() <= MSG::VERBOSE) {
413 m_provider->msg(MSG::VERBOSE) <<
"No chains passed unprescaled - not processing this event" <<
endmsg;
421 selectorTruth.
clear();
428 std::vector<TIDA::Vertex> vertices;
429 std::vector<TIDA::Vertex> vertices_rec;
431 std::vector<double> refbeamspot;
432 std::vector<double> testbeamspot;
436 m_provider->msg(MSG::VERBOSE) <<
"fetching AOD Primary vertex container" <<
endmsg;
438 if ( !this->
select( vertices,
"PrimaryVertices" ) ) {
439 m_provider->msg(MSG::VERBOSE) <<
"could not retrieve the 'PrimaryVertices' vertex collection" << std::endl;
453 for (
unsigned i=0 ; i<vertices.size() ; i++ ) {
455 m_provider->msg(MSG::VERBOSE) <<
"vertex " << i <<
" " << vertices[i] <<
endmsg;
464 std::vector<TIDA::Track*> offline_tracks;
465 std::vector<TIDA::Track*> electron_tracks;
466 std::vector<TIDA::Track*> muon_tracks;
468 std::vector<TIDA::Track*> ref_tracks;
469 std::vector<TIDA::Track*> test_tracks;
471 offline_tracks.clear();
472 electron_tracks.clear();
479 if (
m_provider->msg().level() <= MSG::VERBOSE )
482 bool foundTruth =
false;
490 selectorTruth.
clear();
492 if (
m_provider->msg().level() <= MSG::VERBOSE )
516 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
517 m_provider->msg(MSG::VERBOSE) <<
"Truth not found - none whatsoever!" <<
endmsg;
523 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
533 std::string keys[4] = {
"GEN_AOD",
"TruthEvent",
"",
"G4Truth" };
535 std::string key =
"";
537 bool foundcollection =
false;
539 for (
int ik=0 ; ik<4 ; ik++ ) {
541 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
542 m_provider->msg(MSG::VERBOSE) <<
"Try McEventCollection: " << keys[ik] <<
endmsg;
546 if(
m_provider->msg().level() <= MSG::VERBOSE )
547 m_provider->msg(MSG::VERBOSE) <<
"No McEventCollection: " << keys[ik] <<
endmsg;
551 if (
m_provider->msg().level() <= MSG::VERBOSE )
552 m_provider->msg(MSG::VERBOSE) <<
"evtStore()->retrieve( mcevent, " << keys[ik] <<
" )" <<
endmsg;
554 if ( this->
template retrieve( mcevent, keys[ik] ).isFailure() ) {
555 if (
m_provider->msg().level() <= MSG::VERBOSE )
556 m_provider->msg(MSG::VERBOSE) <<
"Failed to get McEventCollection: " << keys[ik] <<
endmsg;
562 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
endmsg;
563 foundcollection =
true;
569 if ( !foundcollection ) {
571 m_provider->msg(MSG::WARNING) <<
"No MC Truth Collections of any sort, whatsoever!!!" <<
endmsg;
579 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
580 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
"\tNevents " << mcevent->
size() <<
endmsg;
591 while ( evitr!=evend ) {
608 while ( pitr!=pend ) {
628 if(
m_provider->msg().level() <= MSG::VERBOSE){
629 m_provider->msg(MSG::VERBOSE) <<
"Found " << ip <<
" TruthParticles (GenParticles) in " << ie_ip <<
" GenEvents out of " << ie <<
endmsg;
630 m_provider->msg(MSG::VERBOSE) <<
"selected " << selectorTruth.
size() <<
" TruthParticles (GenParticles)" <<
endmsg;
633 if(selectorTruth.
size() > 0) foundTruth =
true;
644 bool found_offline =
false;
650 found_offline =
true;
657 if ( !found_offline ) {
663 m_provider->msg(MSG::WARNING) <<
"Offline tracks not found: " <<
"TrackParticleCandidate" <<
endmsg;
676 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
681 const std::string& chainname =
m_chainNames[ichain].head();
683 const std::string& vtx_name =
m_chainNames[ichain].vtx();
691 std::string ptvalue =
m_chainNames[ichain].postvalue(
"pt");
704 if ( chainname!=
"" &&
m_provider->msg().level() <= MSG::VERBOSE ) {
706 m_provider->msg(MSG::VERBOSE) <<
"status for chain " << chainname
707 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
708 <<
"\tprescale " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
710 m_provider->msg(MSG::VERBOSE) <<
"fetching features for chain " << chainname <<
endmsg;
712 m_provider->msg(MSG::VERBOSE) << chainname <<
"\tpassed: " << (*m_tdt)->isPassed( chainname ) <<
endmsg;
725 if ( chainname!=
"" && !this->
m_keepAllEvents && !(*m_tdt)->isPassed( chainname, decisiontype ) )
continue;
735 std::vector<std::string> chainNames ;
741 chainNames.push_back(pTnP_tool->
tag());
742 chainNames.push_back(pTnP_tool->
probe());
746 for (
size_t i=0 ; i<chainNames.size() ; i++ ) {
749 std::string chainName = chainConfig.
head();
755 if ( chainName ==
"" ) {
759 pselectorTest->
clear();
774 const std::vector<TIDA::Track*>& testtracks = pselectorTest->
tracks();
776 chain.back().addTracks(testtracks);
778 if ( vtx_name!=
"" ) {
782 m_provider->msg(MSG::VERBOSE) <<
"\tFetch xAOD::VertexContainer with key " << vtx_name <<
endmsg;
784 std::vector<TIDA::Vertex> tidavertices;
786 if ( this->
select( tidavertices, vtx_name ) ) chain.back().addVertices( tidavertices );
799 std::string roi_key = chainConfig.
roi();
809 if ( chainConfig.
element()!=
"" ) {
810 leg = std::atoi(chainConfig.
element().c_str());
813 std::string rgex = roi_key;
815 std::vector< TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> > rois =
826 if ( rois.empty() ) {
827 if ( !rgex.empty() ) {
848 if ( roi_key==
"SuperRoi" && iroi>1 )
continue;
855 if ( roi_key!=
"" && roi_link.
dataID()!=rgex )
continue;
858 if ( !roi_link.
isValid() )
continue;
862 if ( roiptr == 0 )
continue;
868 if (
m_provider->msg().level() <= MSG::VERBOSE) {
869 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainname <<
" " << **roiptr <<
endmsg;
878 pselectorTest->
clear();
886 chain.addRoi( *roiInfo );
890 const std::vector<TIDA::Track*>& testtracks = pselectorTest->
tracks();
892 chain.back().addTracks(testtracks);
897 if ( vtx_name!=
"" ) {
899 std::vector<TIDA::Vertex> tidavertices;
901 this->
select( tidavertices, roi_link, vtx_name );
903 chain.back().addVertices( tidavertices );
910 std::cout <<
"\tTIDA analysis for chain: " << chainname <<
"\t key: " << key <<
"\t" << **roiptr << std::endl;
911 std::cout <<
"\tcollections: " << chain.back() << std::endl;
925 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
933 for (
unsigned ichain=0 ; ichain<eventp->
size() ; ichain++ ) {
937 const std::string& vtx_name = chainConfig.
vtx();
940 if (
m_tnp_flag && chainConfig.
extra().find(
"_tag")!=std::string::npos ) continue ;
942 std::vector<TIDA::Roi*> rois ;
949 rois.reserve( chain.size() );
950 for (
size_t ir=0 ;
ir<chain.size() ;
ir++ ) {
951 rois.push_back( &(chain.rois()[
ir]) );
957 for (
unsigned iroi=0 ; iroi<rois.size() ; iroi++ ) {
960 filterRef.
setRoi( &(rois.at(iroi)->roi() ) );
963 else filterRef.
setRoi( 0 );
983 if (
m_provider->msg().level() <= MSG::VERBOSE )
988 ref_tracks = pselectorRef->
tracks(&filter_truth);
991 ref_tracks = pselectorRef->
tracks(&filterRef) ;
994 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
996 for (
int ii=pselectorRef->
tracks().size() ; ii-- ; ) {
1001 test_tracks.clear();
1004 for (
unsigned itrk=0 ; itrk<rois.at(iroi)->tracks().size() ; itrk++ ) {
1005 test_tracks.push_back(&(rois.at(iroi)->tracks().at(itrk)));
1013 beamline[0] = pselectorTest->
getBeamX();
1014 beamline[1] = pselectorTest->
getBeamY();
1015 beamline[2] = pselectorTest->
getBeamZ();
1017 beamline[3] = vertices.size();
1043 associator->
match( test_tracks, ref_tracks );
1045 m_manalysis->execute( test_tracks, ref_tracks, associator, eventp, beamline );
1067 associator->
match( ref_tracks, test_tracks );
1074 m_manalysis->execute( ref_tracks, test_tracks, associator, eventp, beamline, &(rois.at(iroi)->roi()) );
1076 if ( vtx_name!=
"" ) {
1078 std::vector<TIDA::Vertex> vr = rois.at(iroi)->vertices();
1079 std::vector<TIDA::Vertex*> vtx_rec;
1080 for (
unsigned iv=0 ; iv<vr.size() ; iv++ ) vtx_rec.push_back( &vr[iv] );
1082 std::vector<TIDA::Vertex*> vtx;
1084 for (
unsigned iv=0 ; iv<vertices.size() ; iv++ ) vtx.push_back( &vertices[iv] );
1087 if ( vertices.size()>
unsigned(this->getVtxIndex()) ) vtx.push_back( &vertices[this->
getVtxIndex()] );
1090 m_manalysis->execute_vtx( vtx, vtx_rec, eventp );
1097 <<
"\trun " << run_number
1098 <<
"\tevent " << event_number
1099 <<
"\tlb " << lumi_block <<
endmsg;
1108 if (
m_provider->msg().level() <= MSG::VERBOSE ) {