185 if(
m_provider->msg().level() <= MSG::VERBOSE) {
197 m_provider->msg(MSG::VERBOSE) <<
" using beam position\tx=" << xbeam <<
"\ty=" << ybeam <<
endmsg;
199 if (
m_provider->msg().level() <= MSG::VERBOSE) {
201 std::vector<std::string> configuredChains = (*(
m_tdt))->getListOfTriggers(
"L2_.*, EF_.*, HLT_.*");
203 for (
unsigned i=0 ; i<configuredChains.size() ; i++ ) {
210 std::vector<ChainString>::iterator chainitr =
m_chainNames.begin();
212 std::vector<ChainString> chains;
224 if ( chainName.
head() ==
"" ) {
226 std::string selectChain = chainName.
raw();
230 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
231 m_provider->msg(MSG::VERBOSE) <<
"Matching chain " << selectChain <<
" (" << chainName.
head() <<
")" <<
endmsg;
238 std::vector<std::string> selectChains = (*(
m_tdt))->getListOfTriggers( chainName.
head() );
241 for (
unsigned iselected=0 ; iselected<selectChains.size() ; iselected++ ) {
243 selectChains[iselected] = chainName.
subs( selectChains[iselected] );
246 std::cout <<
"sorting:: chain specification: " << chainName <<
"\traw:" << chainName.
raw() << std::endl;
247 std::cout <<
"\tchain: " << chainName.
head() << std::endl;
248 std::cout <<
"\tkey: " << chainName.
tail() << std::endl;
249 std::cout <<
"\troi: " << chainName.
roi() << std::endl;
250 std::cout <<
"\tvtx: " << chainName.
vtx() << std::endl;
251 std::cout <<
"\tte: " << chainName.
element() << std::endl;
252 std::cout <<
"\tind: " << chainName.
extra() << std::endl;
256 chains.push_back(
ChainString(selectChains[iselected]) );
258 if(
m_provider->msg().level() <= MSG::VERBOSE) {
259 m_provider->msg(MSG::VERBOSE) <<
"Matching chain " << selectChains[iselected] <<
" (" << chainName.
head() <<
")" <<
endmsg;
302 if ( xbeam!=0 || ybeam!=0 ) {
312#ifndef XAODTRACKING_TRACKPARTICLE_H
317 unsigned run_number = 0;
318 uint64_t event_number = 0;
319 unsigned lumi_block = 0;
320 unsigned bunch_crossing_id = 0;
321 unsigned time_stamp = 0;
324 if ( this->
template retrieve(pEventInfo,
"EventInfo").isFailure() ) {
328#ifndef XAODTRACKING_TRACKPARTICLE_H
329 run_number = pEventInfo->
event_ID()->run_number();
330 event_number = pEventInfo->
event_ID()->event_number();
331 lumi_block = pEventInfo->
event_ID()->lumi_block();
332 time_stamp = pEventInfo->
event_ID()->time_stamp();
333 bunch_crossing_id = pEventInfo->
event_ID()->bunch_crossing_id();
336 run_number = pEventInfo->runNumber();
337 event_number = pEventInfo->eventNumber();
338 lumi_block = pEventInfo->lumiBlock();
339 time_stamp = pEventInfo->timeStamp();
340 bunch_crossing_id = pEventInfo->bcid();
345 if(
m_provider->msg().level() <= MSG::VERBOSE){
346 m_provider->msg(MSG::VERBOSE) <<
"run " << run_number
347 <<
"\tevent " << event_number
348 <<
"\tlb " << lumi_block <<
endmsg;
361 m_event->run_number(run_number);
362 m_event->event_number(event_number);
363 m_event->lumi_block(lumi_block);
364 m_event->time_stamp(time_stamp);
365 m_event->bunch_crossing_id(bunch_crossing_id);
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;
396 if ( (*(
m_tdt))->isPassed(chainname) || (*(
m_tdt))->getPrescale(chainname) ) analyse =
true;
414 m_provider->msg(MSG::VERBOSE) <<
"No chains passed unprescaled - not processing this event" <<
endmsg;
420 selectorTruth.
clear();
430 std::vector<TIDA::Vertex> vertices;
431 std::vector<TIDA::Vertex> vertices_rec;
433 std::vector<double> refbeamspot;
434 std::vector<double> testbeamspot;
438#ifndef XAODTRACKING_TRACKPARTICLE_H
444 if ( this->
template retrieve(primaryVtxCollection,
"VxPrimaryCandidate").isFailure()) {
445 if (
m_provider->msg().level() <= MSG::WARNING)
m_provider->msg(MSG::WARNING) <<
"Primary vertex container not found" <<
endmsg;
449 for ( ; vtxitr != primaryVtxCollection->
end(); ++vtxitr) {
450 if ( (*vtxitr)->vxTrackAtVertex()->size()>0 ) {
451 vertices.push_back(
TIDA::Vertex( (*vtxitr)->recVertex().position().x(),
452 (*vtxitr)->recVertex().position().y(),
453 (*vtxitr)->recVertex().position().z(),
455 (*vtxitr)->vxTrackAtVertex()->size() ) );
468 m_provider->msg(MSG::VERBOSE) <<
"fetching AOD Primary vertex container" <<
endmsg;
472 if ( this->
template retrieve( xaodVtxCollection,
"PrimaryVertices" ).isFailure()) {
473 if (
m_provider->msg().level() <= MSG::WARNING)
m_provider->msg(MSG::WARNING) <<
"xAOD Primary vertex container not found with key " <<
"PrimaryVertices" <<
endmsg;
476 if ( xaodVtxCollection!=0 ) {
478 m_provider->msg(MSG::VERBOSE) <<
"xAOD Primary vertex container " << xaodVtxCollection->
size() <<
" entries" <<
endmsg;
481 for ( ; vtxitr != xaodVtxCollection->
end(); ++vtxitr ) {
482 if ( (*vtxitr)->nTrackParticles()>0 && (*vtxitr)->vertexType()!=0 ) {
490 (*vtxitr)->nTrackParticles(),
492 (*vtxitr)->chiSquared(),
493 (*vtxitr)->numberDoF() ) );
513 for (
unsigned i=0 ; i<vertices.size() ; i++ ) {
515 m_provider->msg(MSG::VERBOSE) <<
"vertex " << i <<
" " << vertices[i] <<
endmsg;
516 m_event->addVertex(vertices[i]);
523 std::vector<TIDA::Track*> offline_tracks;
524 std::vector<TIDA::Track*> electron_tracks;
525 std::vector<TIDA::Track*> muon_tracks;
527 std::vector<TIDA::Track*> ref_tracks;
528 std::vector<TIDA::Track*> test_tracks;
530 offline_tracks.clear();
531 electron_tracks.clear();
538 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
545 const std::string& chainname =
m_chainNames[ichain].head();
547 const std::string& vtx_name =
m_chainNames[ichain].vtx();
555 std::string ptvalue =
m_chainNames[ichain].postvalue(
"pt");
562 unsigned decisiontype;
570 if ( chainname!=
"" &&
m_provider->msg().level() <= MSG::VERBOSE ) {
572 m_provider->msg(MSG::VERBOSE) <<
"status for chain " << chainname
573 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
574 <<
"\tprescale " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
576 m_provider->msg(MSG::VERBOSE) <<
"fetching features for chain " << chainname <<
endmsg;
578 m_provider->msg(MSG::VERBOSE) << chainname <<
"\tpassed: " << (*m_tdt)->isPassed( chainname ) <<
endmsg;
590 if ( chainname!=
"" && !this->
m_keepAllEvents && !(*m_tdt)->isPassed( chainname, decisiontype ) )
continue;
601 std::string chainName = chainConfig.
head();
603 m_event->addChain( chainConfig );
607 if ( chainName ==
"" ) {
615 chain.addRoi( *roiInfo );
618# ifdef XAODTRACKING_TRACKPARTICLE_H
625 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
627 chain.back().addTracks(testtracks);
640 if(
m_provider->msg().level() <= MSG::VERBOSE){
641 m_provider->msg(MSG::VERBOSE) <<
"No combinations: skipping this chain " << chainname <<
endmsg;
646 if(
m_provider->msg().level() <= MSG::VERBOSE) {
647 m_provider->msg(MSG::VERBOSE) <<
"combinations for chain " << chainname <<
" " << (cEnd-c) <<
endmsg;
652 for( ; c!=cEnd ; ++c ) {
662 std::vector< Trig::Feature<TrigRoiDescriptor> > initRois;
666 if ( roi_key==
"SuperRoi" && icomb>1 )
continue;
674 if ( initRois.empty() ) initRois = c->get<
TrigRoiDescriptor>(
"initialRoI", decisiontype );
679 if ( initRois.empty() )
continue;
687 if(initRois.size()>1 && roi_key!=
"SuperRoi" ) {
689 m_provider->msg(MSG::VERBOSE) <<
" More than one initial RoI found for seeded chain " << chainname <<
": not yet supported" <<
endmsg;
695 if( !initRois.empty() ) {
699 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainname <<
" " << *roid <<
endmsg;
727 m_provider->msg(MSG::VERBOSE) <<
"Searching for collection " << key <<
endmsg;
731 if ( key.find(
"InDetTrigParticleCreation")!=std::string::npos ||
732 key.find(
"_IDTrig")!=std::string::npos ||
733 key.find(
"_EFID")!=std::string::npos ||
734 chainName.find(
"EF_")!=std::string::npos ||
735 chainName.find(
"HLT_")!=std::string::npos ) {
736# ifdef XAODTRACKING_TRACKPARTICLE_H
749 if ( chainName.find(
"L2_")!=std::string::npos ) {
752# ifdef XAODTRACKING_TRACKPARTICLE_H
755 else m_provider->msg(MSG::WARNING) <<
"No track collection " << key <<
" found" <<
endmsg;
760 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
762 m_provider->msg(MSG::VERBOSE) <<
"test tracks.size() " << testtracks.size() <<
endmsg;
767 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
768 m_provider->msg(MSG::VERBOSE) <<
"test tracks.size() " << testtracks.size() <<
endmsg;
769 for (
int ii=testtracks.size() ; ii-- ; ) {
770 m_provider->msg(MSG::VERBOSE) <<
" test track " << ii <<
" " << *testtracks[ii] <<
endmsg;
775 chain.addRoi( *roiInfo );
777 chain.back().addTracks(testtracks);
787 if ( vtx_name!=
"" ) {
789 m_provider->msg(MSG::VERBOSE) <<
"\tFetch xAOD::VertexContainer for chain " << chainConfig <<
" with key " << vtx_name <<
endmsg;
791 std::vector< Trig::Feature<xAOD::VertexContainer> > xaodtrigvertices = c->get<
xAOD::VertexContainer>(vtx_name);
793 if ( xaodtrigvertices.empty() ) {
794 if (
m_provider->msg().level() <= MSG::DEBUG ) {
795 m_provider->msg(MSG::WARNING) <<
"\tNo xAOD::VertexContainer for chain " << chainConfig <<
" for key " << vtx_name <<
endmsg;
800 m_provider->msg(MSG::VERBOSE) <<
"\txAOD::VertexContainer found with size " << xaodtrigvertices.size() <<
"\t" << vtx_name <<
endmsg;
802 for (
unsigned iv=0 ; iv<xaodtrigvertices.size() ; iv++ ) {
806 m_provider->msg(MSG::VERBOSE) <<
"\t" << iv <<
" xAOD VxContainer for " << chainConfig <<
" " << vert <<
" key " << vtx_name <<
endmsg;
810 for ( ; vtxitr != vert->
end(); ++vtxitr) {
814 if ( (*vtxitr)->vertexType()!=0 || vtx_name==
"EFHistoPrmVtx" ) {
822 (*vtxitr)->nTrackParticles(),
824 (*vtxitr)->chiSquared(),
825 (*vtxitr)->numberDoF() ) );
840 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
846 for (
unsigned iroi=0 ; iroi<chain.size() ; iroi++ ) {
851 filterRef.
setRoi( &chain.rois().at(iroi).roi() );
854 else filterRef.
setRoi( 0 );
873 if (
m_provider->msg().level() <= MSG::VERBOSE )
876 bool foundTruth =
false;
881 else filter_truth.
setRoi( 0 );
883 selectorTruth.
clear();
885 if (
m_provider->msg().level() <= MSG::VERBOSE )
904 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
905 m_provider->msg(MSG::VERBOSE) <<
"Truth not found - none whatsoever!" <<
endmsg;
912 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
923 std::string keys[4] = {
"GEN_AOD",
"TruthEvent",
"",
"G4Truth" };
925 std::string key =
"";
927 bool foundcollection =
false;
929 for (
int ik=0 ; ik<4 ; ik++ ) {
931 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
932 m_provider->msg(MSG::VERBOSE) <<
"Try McEventCollection: " << keys[ik] <<
endmsg;
936 if(
m_provider->msg().level() <= MSG::VERBOSE )
937 m_provider->msg(MSG::VERBOSE) <<
"No McEventCollection: " << keys[ik] <<
endmsg;
941 if (
m_provider->msg().level() <= MSG::VERBOSE )
942 m_provider->msg(MSG::VERBOSE) <<
"evtStore()->retrieve( mcevent, " << keys[ik] <<
" )" <<
endmsg;
944 if ( this->
template retrieve( mcevent, keys[ik] ).isFailure() ) {
945 if (
m_provider->msg().level() <= MSG::VERBOSE )
946 m_provider->msg(MSG::VERBOSE) <<
"Failed to get McEventCollection: " << keys[ik] <<
endmsg;
952 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
endmsg;
953 foundcollection =
true;
959 if ( !foundcollection ) {
961 m_provider->msg(MSG::WARNING) <<
"No MC Truth Collections of any sort, whatsoever!!!" <<
endmsg;
969 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
970 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
"\tNevents " << mcevent->
size() <<
endmsg;
981 while ( evitr!=evend ) {
990 for (
auto pitr: *(*evitr)) {
1010 if(
m_provider->msg().level() <= MSG::VERBOSE){
1011 m_provider->msg(MSG::VERBOSE) <<
"Found " << ip <<
" TruthParticles (GenParticles) in " << ie_ip <<
" GenEvents out of " << ie <<
endmsg;
1012 m_provider->msg(MSG::VERBOSE) <<
"selected " << selectorTruth.
size() <<
" TruthParticles (GenParticles)" <<
endmsg;
1015 if(selectorTruth.
size() > 0) foundTruth =
true;
1030# ifdef XAODTRACKING_TRACKPARTICLE_H
1043 else if (
m_provider->msg().level() <= MSG::WARNING ) {
1049 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
1060 ref_tracks=selectorTruth.
tracks();
1066 test_tracks.clear();
1068 for (
unsigned itrk=0 ; itrk<chain.rois().at(iroi).tracks().
size() ; itrk++ ) {
1069 test_tracks.push_back(&(chain.rois().at(iroi).tracks().at(itrk)));
1075 _analysis->setvertices( vertices.size() );
1077 if ( refbeamspot.size()>0 )
_analysis->setBeamRef( refbeamspot );
1078 if ( testbeamspot.size()>0 )
_analysis->setBeamTest( testbeamspot );
1120 _analysis->setroi( &chain.rois().at(iroi).roi() );
1125 if ( vtx_name!=
"" ) {
1127 std::vector<TIDA::Vertex> vr = chain.rois().at(iroi).vertices();
1128 std::vector<TIDA::Vertex*> vtx_rec;
1129 for (
unsigned iv=0 ; iv<vr.size() ; iv++ ) vtx_rec.push_back( &vr[iv] );
1131 std::vector<TIDA::Vertex*> vtx;
1133 for (
unsigned iv=0 ; iv<vertices.size() ; iv++ ) vtx.push_back( &vertices[iv] );
1136 if ( vertices.size()>
unsigned(this->getVtxIndex()) ) vtx.push_back( &vertices[this->
getVtxIndex()] );
1146 <<
"\trun " << run_number
1147 <<
"\tevent " << event_number
1148 <<
"\tlb " << lumi_block <<
endmsg;
1155 if (
m_provider->msg().level() <= MSG::VERBOSE ) {