190 if(
m_provider->msg().level() <= MSG::VERBOSE) {
202 m_provider->msg(MSG::VERBOSE) <<
" using beam position\tx=" << xbeam <<
"\ty=" << ybeam <<
endmsg;
204 if (
m_provider->msg().level() <= MSG::VERBOSE) {
206 std::vector<std::string> configuredChains = (*(
m_tdt))->getListOfTriggers(
"L2_.*, EF_.*, HLT_.*");
208 for (
unsigned i=0 ; i<configuredChains.size() ; i++ ) {
215 std::vector<ChainString>::iterator chainitr =
m_chainNames.begin();
217 std::vector<ChainString> chains;
229 if ( chainName.
head() ==
"" ) {
231 std::string selectChain = chainName.
raw();
235 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
236 m_provider->msg(MSG::VERBOSE) <<
"Matching chain " << selectChain <<
" (" << chainName.
head() <<
")" <<
endmsg;
243 std::vector<std::string> selectChains = (*(
m_tdt))->getListOfTriggers( chainName.
head() );
246 for (
unsigned iselected=0 ; iselected<selectChains.size() ; iselected++ ) {
248 selectChains[iselected] = chainName.
subs( selectChains[iselected] );
251 std::cout <<
"sorting:: chain specification: " << chainName <<
"\traw:" << chainName.
raw() << std::endl;
252 std::cout <<
"\tchain: " << chainName.
head() << std::endl;
253 std::cout <<
"\tkey: " << chainName.
tail() << std::endl;
254 std::cout <<
"\troi: " << chainName.
roi() << std::endl;
255 std::cout <<
"\tvtx: " << chainName.
vtx() << std::endl;
256 std::cout <<
"\tte: " << chainName.
element() << std::endl;
257 std::cout <<
"\tind: " << chainName.
extra() << std::endl;
261 chains.push_back(
ChainString(selectChains[iselected]) );
263 if(
m_provider->msg().level() <= MSG::VERBOSE) {
264 m_provider->msg(MSG::VERBOSE) <<
"Matching chain " << selectChains[iselected] <<
" (" << chainName.
head() <<
")" <<
endmsg;
307 if ( xbeam!=0 || ybeam!=0 ) {
317#ifndef XAODTRACKING_TRACKPARTICLE_H
322 unsigned run_number = 0;
323 uint64_t event_number = 0;
324 unsigned lumi_block = 0;
325 unsigned bunch_crossing_id = 0;
326 unsigned time_stamp = 0;
329 if ( this->
template retrieve(pEventInfo,
"EventInfo").isFailure() ) {
333#ifndef XAODTRACKING_TRACKPARTICLE_H
334 run_number = pEventInfo->
event_ID()->run_number();
335 event_number = pEventInfo->
event_ID()->event_number();
336 lumi_block = pEventInfo->
event_ID()->lumi_block();
337 time_stamp = pEventInfo->
event_ID()->time_stamp();
338 bunch_crossing_id = pEventInfo->
event_ID()->bunch_crossing_id();
341 run_number = pEventInfo->runNumber();
342 event_number = pEventInfo->eventNumber();
343 lumi_block = pEventInfo->lumiBlock();
344 time_stamp = pEventInfo->timeStamp();
345 bunch_crossing_id = pEventInfo->bcid();
350 if(
m_provider->msg().level() <= MSG::VERBOSE){
351 m_provider->msg(MSG::VERBOSE) <<
"run " << run_number
352 <<
"\tevent " << event_number
353 <<
"\tlb " << lumi_block <<
endmsg;
366 m_event->run_number(run_number);
367 m_event->event_number(event_number);
368 m_event->lumi_block(lumi_block);
369 m_event->time_stamp(time_stamp);
370 m_event->bunch_crossing_id(bunch_crossing_id);
376 bool analyse =
false;
380 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
382 const std::string& chainname =
m_chainNames[ichain].head();
384 if ( chainname ==
"" ) analyse =
true;
388 if ( chainname.find(
"L2") == std::string::npos &&
389 chainname.find(
"EF") == std::string::npos &&
390 chainname.find(
"HLT") == std::string::npos )
continue;
392 if (
m_provider->msg().level() <= MSG::DEBUG ) {
393 m_provider->msg(MSG::DEBUG) <<
"Chain " << chainname
394 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
395 <<
"\tpres " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
401 if ( (*(
m_tdt))->isPassed(chainname) || (*(
m_tdt))->getPrescale(chainname) ) analyse =
true;
419 m_provider->msg(MSG::VERBOSE) <<
"No chains passed unprescaled - not processing this event" <<
endmsg;
425 selectorTruth.
clear();
435 if ( this->
template retrieve(truthMap,
"TrigInDetTrackTruthMap").isFailure()) {
437 m_provider->msg(MSG::VERBOSE) <<
"TrigInDetTrackTruthMap not found" <<
endmsg;
450 std::vector<TIDA::Vertex> vertices;
451 std::vector<TIDA::Vertex> vertices_rec;
453 std::vector<double> refbeamspot;
454 std::vector<double> testbeamspot;
458#ifndef XAODTRACKING_TRACKPARTICLE_H
464 if ( this->
template retrieve(primaryVtxCollection,
"VxPrimaryCandidate").isFailure()) {
465 if (
m_provider->msg().level() <= MSG::WARNING)
m_provider->msg(MSG::WARNING) <<
"Primary vertex container not found" <<
endmsg;
469 for ( ; vtxitr != primaryVtxCollection->
end(); ++vtxitr) {
470 if ( (*vtxitr)->vxTrackAtVertex()->size()>0 ) {
471 vertices.push_back(
TIDA::Vertex( (*vtxitr)->recVertex().position().x(),
472 (*vtxitr)->recVertex().position().y(),
473 (*vtxitr)->recVertex().position().z(),
475 (*vtxitr)->vxTrackAtVertex()->size() ) );
488 m_provider->msg(MSG::VERBOSE) <<
"fetching AOD Primary vertex container" <<
endmsg;
492 if ( this->
template retrieve( xaodVtxCollection,
"PrimaryVertices" ).isFailure()) {
493 if (
m_provider->msg().level() <= MSG::WARNING)
m_provider->msg(MSG::WARNING) <<
"xAOD Primary vertex container not found with key " <<
"PrimaryVertices" <<
endmsg;
496 if ( xaodVtxCollection!=0 ) {
498 m_provider->msg(MSG::VERBOSE) <<
"xAOD Primary vertex container " << xaodVtxCollection->
size() <<
" entries" <<
endmsg;
501 for ( ; vtxitr != xaodVtxCollection->
end(); ++vtxitr ) {
502 if ( (*vtxitr)->nTrackParticles()>0 && (*vtxitr)->vertexType()!=0 ) {
510 (*vtxitr)->nTrackParticles(),
512 (*vtxitr)->chiSquared(),
513 (*vtxitr)->numberDoF() ) );
533 for (
unsigned i=0 ; i<vertices.size() ; i++ ) {
535 m_provider->msg(MSG::VERBOSE) <<
"vertex " << i <<
" " << vertices[i] <<
endmsg;
536 m_event->addVertex(vertices[i]);
543 std::vector<TIDA::Track*> offline_tracks;
544 std::vector<TIDA::Track*> electron_tracks;
545 std::vector<TIDA::Track*> muon_tracks;
547 std::vector<TIDA::Track*> ref_tracks;
548 std::vector<TIDA::Track*> test_tracks;
550 offline_tracks.clear();
551 electron_tracks.clear();
558 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
565 const std::string& chainname =
m_chainNames[ichain].head();
567 const std::string& vtx_name =
m_chainNames[ichain].vtx();
575 std::string ptvalue =
m_chainNames[ichain].postvalue(
"pt");
582 unsigned decisiontype;
595 const std::string& key_index_string =
m_chainNames[ichain].extra();
596 unsigned key_index = 0;
597 if ( key_index_string!=
"" ) key_index = std::atoi( key_index_string.c_str() );
599 if ( chainname!=
"" &&
m_provider->msg().level() <= MSG::VERBOSE ) {
601 m_provider->msg(MSG::VERBOSE) <<
"status for chain " << chainname
602 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
603 <<
"\tprescale " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
605 m_provider->msg(MSG::VERBOSE) <<
"fetching features for chain " << chainname <<
endmsg;
607 m_provider->msg(MSG::VERBOSE) << chainname <<
"\tpassed: " << (*m_tdt)->isPassed( chainname ) <<
endmsg;
619 if ( chainname!=
"" && !this->
m_keepAllEvents && !(*m_tdt)->isPassed( chainname, decisiontype ) )
continue;
630 std::string chainName = chainConfig.
head();
632 m_event->addChain( chainConfig );
636 if ( chainName ==
"" ) {
644 chain.addRoi( *roiInfo );
647# ifdef XAODTRACKING_TRACKPARTICLE_H
654 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
656 chain.back().addTracks(testtracks);
669 if(
m_provider->msg().level() <= MSG::VERBOSE){
670 m_provider->msg(MSG::VERBOSE) <<
"No combinations: skipping this chain " << chainname <<
endmsg;
675 if(
m_provider->msg().level() <= MSG::VERBOSE) {
676 m_provider->msg(MSG::VERBOSE) <<
"combinations for chain " << chainname <<
" " << (cEnd-c) <<
endmsg;
681 for( ; c!=cEnd ; ++c ) {
691 std::vector< Trig::Feature<TrigRoiDescriptor> > initRois;
695 if ( roi_key==
"SuperRoi" && icomb>1 )
continue;
703 if ( initRois.empty() ) initRois = c->get<
TrigRoiDescriptor>(
"initialRoI", decisiontype );
708 if ( initRois.empty() )
continue;
716 if(initRois.size()>1 && roi_key!=
"SuperRoi" ) {
718 m_provider->msg(MSG::VERBOSE) <<
" More than one initial RoI found for seeded chain " << chainname <<
": not yet supported" <<
endmsg;
724 if( !initRois.empty() ) {
728 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainname <<
" " << *roid <<
endmsg;
756 m_provider->msg(MSG::VERBOSE) <<
"Searching for collection " << key <<
endmsg;
760 if ( key.find(
"InDetTrigParticleCreation")!=std::string::npos ||
761 key.find(
"_IDTrig")!=std::string::npos ||
762 key.find(
"_EFID")!=std::string::npos ||
763 chainName.find(
"EF_")!=std::string::npos ||
764 chainName.find(
"HLT_")!=std::string::npos ) {
765# ifdef XAODTRACKING_TRACKPARTICLE_H
779 if ( chainName.find(
"L2_")!=std::string::npos ) {
783# ifdef XAODTRACKING_TRACKPARTICLE_H
786 else m_provider->msg(MSG::WARNING) <<
"No track collection " << key <<
" found" <<
endmsg;
791 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
793 m_provider->msg(MSG::VERBOSE) <<
"test tracks.size() " << testtracks.size() <<
endmsg;
798 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
799 m_provider->msg(MSG::VERBOSE) <<
"test tracks.size() " << testtracks.size() <<
endmsg;
800 for (
int ii=testtracks.size() ; ii-- ; ) {
801 m_provider->msg(MSG::VERBOSE) <<
" test track " << ii <<
" " << *testtracks[ii] <<
endmsg;
806 chain.addRoi( *roiInfo );
808 chain.back().addTracks(testtracks);
818 if ( vtx_name!=
"" ) {
820 m_provider->msg(MSG::VERBOSE) <<
"\tFetch xAOD::VertexContainer for chain " << chainConfig <<
" with key " << vtx_name <<
endmsg;
822 std::vector< Trig::Feature<xAOD::VertexContainer> > xaodtrigvertices = c->get<
xAOD::VertexContainer>(vtx_name);
824 if ( xaodtrigvertices.empty() ) {
825 if (
m_provider->msg().level() <= MSG::DEBUG ) {
826 m_provider->msg(MSG::WARNING) <<
"\tNo xAOD::VertexContainer for chain " << chainConfig <<
" for key " << vtx_name <<
endmsg;
831 m_provider->msg(MSG::VERBOSE) <<
"\txAOD::VertexContainer found with size " << xaodtrigvertices.size() <<
"\t" << vtx_name <<
endmsg;
833 for (
unsigned iv=0 ; iv<xaodtrigvertices.size() ; iv++ ) {
837 m_provider->msg(MSG::VERBOSE) <<
"\t" << iv <<
" xAOD VxContainer for " << chainConfig <<
" " << vert <<
" key " << vtx_name <<
endmsg;
841 for ( ; vtxitr != vert->
end(); ++vtxitr) {
845 if ( (*vtxitr)->vertexType()!=0 || vtx_name==
"EFHistoPrmVtx" ) {
853 (*vtxitr)->nTrackParticles(),
855 (*vtxitr)->chiSquared(),
856 (*vtxitr)->numberDoF() ) );
871 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
877 for (
unsigned iroi=0 ; iroi<chain.size() ; iroi++ ) {
882 filterRef.
setRoi( &chain.rois().at(iroi).roi() );
885 else filterRef.
setRoi( 0 );
904 if (
m_provider->msg().level() <= MSG::VERBOSE )
907 bool foundTruth =
false;
912 else filter_truth.
setRoi( 0 );
914 selectorTruth.
clear();
916 if (
m_provider->msg().level() <= MSG::VERBOSE )
935 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
936 m_provider->msg(MSG::VERBOSE) <<
"Truth not found - none whatsoever!" <<
endmsg;
943 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
953 std::string keys[4] = {
"GEN_AOD",
"TruthEvent",
"",
"G4Truth" };
955 std::string key =
"";
957 bool foundcollection =
false;
959 for (
int ik=0 ; ik<4 ; ik++ ) {
961 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
962 m_provider->msg(MSG::VERBOSE) <<
"Try McEventCollection: " << keys[ik] <<
endmsg;
966 if(
m_provider->msg().level() <= MSG::VERBOSE )
967 m_provider->msg(MSG::VERBOSE) <<
"No McEventCollection: " << keys[ik] <<
endmsg;
971 if (
m_provider->msg().level() <= MSG::VERBOSE )
972 m_provider->msg(MSG::VERBOSE) <<
"evtStore()->retrieve( mcevent, " << keys[ik] <<
" )" <<
endmsg;
974 if ( this->
template retrieve( mcevent, keys[ik] ).isFailure() ) {
975 if (
m_provider->msg().level() <= MSG::VERBOSE )
976 m_provider->msg(MSG::VERBOSE) <<
"Failed to get McEventCollection: " << keys[ik] <<
endmsg;
982 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
endmsg;
983 foundcollection =
true;
989 if ( !foundcollection ) {
991 m_provider->msg(MSG::WARNING) <<
"No MC Truth Collections of any sort, whatsoever!!!" <<
endmsg;
999 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
1000 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
"\tNevents " << mcevent->size() <<
endmsg;
1011 while ( evitr!=evend ) {
1020 for (
auto pitr: *(*evitr)) {
1040 if(
m_provider->msg().level() <= MSG::VERBOSE){
1041 m_provider->msg(MSG::VERBOSE) <<
"Found " << ip <<
" TruthParticles (GenParticles) in " << ie_ip <<
" GenEvents out of " << ie <<
endmsg;
1042 m_provider->msg(MSG::VERBOSE) <<
"selected " << selectorTruth.
size() <<
" TruthParticles (GenParticles)" <<
endmsg;
1045 if(selectorTruth.
size() > 0) foundTruth =
true;
1060# ifdef XAODTRACKING_TRACKPARTICLE_H
1073 else if (
m_provider->msg().level() <= MSG::WARNING ) {
1079 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
1090 ref_tracks=selectorTruth.
tracks();
1096 test_tracks.clear();
1098 for (
unsigned itrk=0 ; itrk<chain.rois().at(iroi).tracks().size() ; itrk++ ) {
1099 test_tracks.push_back(&(chain.rois().at(iroi).tracks().at(itrk)));
1105 _analysis->setvertices( vertices.size() );
1107 if ( refbeamspot.size()>0 )
_analysis->setBeamRef( refbeamspot );
1108 if ( testbeamspot.size()>0 )
_analysis->setBeamTest( testbeamspot );
1150 _analysis->setroi( &chain.rois().at(iroi).roi() );
1155 if ( vtx_name!=
"" ) {
1157 std::vector<TIDA::Vertex> vr = chain.rois().at(iroi).vertices();
1158 std::vector<TIDA::Vertex*> vtx_rec;
1159 for (
unsigned iv=0 ; iv<vr.size() ; iv++ ) vtx_rec.push_back( &vr[iv] );
1161 std::vector<TIDA::Vertex*> vtx;
1163 for (
unsigned iv=0 ; iv<vertices.size() ; iv++ ) vtx.push_back( &vertices[iv] );
1166 if ( vertices.size()>
unsigned(this->getVtxIndex()) ) vtx.push_back( &vertices[this->
getVtxIndex()] );
1176 <<
"\trun " << run_number
1177 <<
"\tevent " << event_number
1178 <<
"\tlb " << lumi_block <<
endmsg;
1185 if (
m_provider->msg().level() <= MSG::VERBOSE ) {