181 if(
m_provider->msg().level() <= MSG::VERBOSE) {
193 m_provider->msg(MSG::VERBOSE) <<
" using beam position\tx=" << xbeam <<
"\ty=" << ybeam <<
endmsg;
195 if (
m_provider->msg().level() <= MSG::VERBOSE) {
197 std::vector<std::string> configuredChains = (*(
m_tdt))->getListOfTriggers(
"L2_.*, EF_.*, HLT_.*");
199 for (
unsigned i=0 ; i<configuredChains.size() ; i++ ) {
206 std::vector<ChainString>::iterator chainitr =
m_chainNames.begin();
208 std::vector<ChainString> chains;
220 if ( chainName.
head() ==
"" ) {
222 std::string selectChain = chainName.
raw();
226 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
227 m_provider->msg(MSG::VERBOSE) <<
"Matching chain " << selectChain <<
" (" << chainName.
head() <<
")" <<
endmsg;
234 std::vector<std::string> selectChains = (*(
m_tdt))->getListOfTriggers( chainName.
head() );
237 for (
unsigned iselected=0 ; iselected<selectChains.size() ; iselected++ ) {
239 selectChains[iselected] = chainName.
subs( selectChains[iselected] );
242 std::cout <<
"sorting:: chain specification: " << chainName <<
"\traw:" << chainName.
raw() << std::endl;
243 std::cout <<
"\tchain: " << chainName.
head() << std::endl;
244 std::cout <<
"\tkey: " << chainName.
tail() << std::endl;
245 std::cout <<
"\troi: " << chainName.
roi() << std::endl;
246 std::cout <<
"\tvtx: " << chainName.
vtx() << std::endl;
247 std::cout <<
"\tte: " << chainName.
element() << std::endl;
248 std::cout <<
"\tind: " << chainName.
extra() << std::endl;
252 chains.push_back(
ChainString(selectChains[iselected]) );
254 if(
m_provider->msg().level() <= MSG::VERBOSE) {
255 m_provider->msg(MSG::VERBOSE) <<
"Matching chain " << selectChains[iselected] <<
" (" << chainName.
head() <<
")" <<
endmsg;
298 if ( xbeam!=0 || ybeam!=0 ) {
308#ifndef XAODTRACKING_TRACKPARTICLE_H
313 unsigned run_number = 0;
314 uint64_t event_number = 0;
315 unsigned lumi_block = 0;
316 unsigned bunch_crossing_id = 0;
317 unsigned time_stamp = 0;
320 if ( this->
template retrieve(pEventInfo,
"EventInfo").isFailure() ) {
324#ifndef XAODTRACKING_TRACKPARTICLE_H
325 run_number = pEventInfo->
event_ID()->run_number();
326 event_number = pEventInfo->
event_ID()->event_number();
327 lumi_block = pEventInfo->
event_ID()->lumi_block();
328 time_stamp = pEventInfo->
event_ID()->time_stamp();
329 bunch_crossing_id = pEventInfo->
event_ID()->bunch_crossing_id();
332 run_number = pEventInfo->runNumber();
333 event_number = pEventInfo->eventNumber();
334 lumi_block = pEventInfo->lumiBlock();
335 time_stamp = pEventInfo->timeStamp();
336 bunch_crossing_id = pEventInfo->bcid();
341 if(
m_provider->msg().level() <= MSG::VERBOSE){
342 m_provider->msg(MSG::VERBOSE) <<
"run " << run_number
343 <<
"\tevent " << event_number
344 <<
"\tlb " << lumi_block <<
endmsg;
357 m_event->run_number(run_number);
358 m_event->event_number(event_number);
359 m_event->lumi_block(lumi_block);
360 m_event->time_stamp(time_stamp);
361 m_event->bunch_crossing_id(bunch_crossing_id);
367 bool analyse =
false;
371 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
373 const std::string& chainname =
m_chainNames[ichain].head();
375 if ( chainname ==
"" ) analyse =
true;
379 if ( chainname.find(
"L2") == std::string::npos &&
380 chainname.find(
"EF") == std::string::npos &&
381 chainname.find(
"HLT") == std::string::npos )
continue;
383 if (
m_provider->msg().level() <= MSG::DEBUG ) {
384 m_provider->msg(MSG::DEBUG) <<
"Chain " << chainname
385 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
386 <<
"\tpres " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
392 if ( (*(
m_tdt))->isPassed(chainname) || (*(
m_tdt))->getPrescale(chainname) ) analyse =
true;
410 m_provider->msg(MSG::VERBOSE) <<
"No chains passed unprescaled - not processing this event" <<
endmsg;
416 selectorTruth.
clear();
426 std::vector<TIDA::Vertex> vertices;
427 std::vector<TIDA::Vertex> vertices_rec;
429 std::vector<double> refbeamspot;
430 std::vector<double> testbeamspot;
434#ifndef XAODTRACKING_TRACKPARTICLE_H
440 if ( this->
template retrieve(primaryVtxCollection,
"VxPrimaryCandidate").isFailure()) {
441 if (
m_provider->msg().level() <= MSG::WARNING)
m_provider->msg(MSG::WARNING) <<
"Primary vertex container not found" <<
endmsg;
445 for ( ; vtxitr != primaryVtxCollection->
end(); ++vtxitr) {
446 if ( (*vtxitr)->vxTrackAtVertex()->size()>0 ) {
447 vertices.push_back(
TIDA::Vertex( (*vtxitr)->recVertex().position().x(),
448 (*vtxitr)->recVertex().position().y(),
449 (*vtxitr)->recVertex().position().z(),
451 (*vtxitr)->vxTrackAtVertex()->size() ) );
464 m_provider->msg(MSG::VERBOSE) <<
"fetching AOD Primary vertex container" <<
endmsg;
468 if ( this->
template retrieve( xaodVtxCollection,
"PrimaryVertices" ).isFailure()) {
469 if (
m_provider->msg().level() <= MSG::WARNING)
m_provider->msg(MSG::WARNING) <<
"xAOD Primary vertex container not found with key " <<
"PrimaryVertices" <<
endmsg;
472 if ( xaodVtxCollection!=0 ) {
474 m_provider->msg(MSG::VERBOSE) <<
"xAOD Primary vertex container " << xaodVtxCollection->
size() <<
" entries" <<
endmsg;
477 for ( ; vtxitr != xaodVtxCollection->
end(); ++vtxitr ) {
478 if ( (*vtxitr)->nTrackParticles()>0 && (*vtxitr)->vertexType()!=0 ) {
486 (*vtxitr)->nTrackParticles(),
488 (*vtxitr)->chiSquared(),
489 (*vtxitr)->numberDoF() ) );
509 for (
unsigned i=0 ; i<vertices.size() ; i++ ) {
511 m_provider->msg(MSG::VERBOSE) <<
"vertex " << i <<
" " << vertices[i] <<
endmsg;
512 m_event->addVertex(vertices[i]);
519 std::vector<TIDA::Track*> offline_tracks;
520 std::vector<TIDA::Track*> electron_tracks;
521 std::vector<TIDA::Track*> muon_tracks;
523 std::vector<TIDA::Track*> ref_tracks;
524 std::vector<TIDA::Track*> test_tracks;
526 offline_tracks.clear();
527 electron_tracks.clear();
534 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
541 const std::string& chainname =
m_chainNames[ichain].head();
543 const std::string& vtx_name =
m_chainNames[ichain].vtx();
551 std::string ptvalue =
m_chainNames[ichain].postvalue(
"pt");
558 unsigned decisiontype;
566 if ( chainname!=
"" &&
m_provider->msg().level() <= MSG::VERBOSE ) {
568 m_provider->msg(MSG::VERBOSE) <<
"status for chain " << chainname
569 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
570 <<
"\tprescale " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
572 m_provider->msg(MSG::VERBOSE) <<
"fetching features for chain " << chainname <<
endmsg;
574 m_provider->msg(MSG::VERBOSE) << chainname <<
"\tpassed: " << (*m_tdt)->isPassed( chainname ) <<
endmsg;
586 if ( chainname!=
"" && !this->
m_keepAllEvents && !(*m_tdt)->isPassed( chainname, decisiontype ) )
continue;
597 std::string chainName = chainConfig.
head();
599 m_event->addChain( chainConfig );
603 if ( chainName ==
"" ) {
611 chain.addRoi( *roiInfo );
614# ifdef XAODTRACKING_TRACKPARTICLE_H
621 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
623 chain.back().addTracks(testtracks);
636 if(
m_provider->msg().level() <= MSG::VERBOSE){
637 m_provider->msg(MSG::VERBOSE) <<
"No combinations: skipping this chain " << chainname <<
endmsg;
642 if(
m_provider->msg().level() <= MSG::VERBOSE) {
643 m_provider->msg(MSG::VERBOSE) <<
"combinations for chain " << chainname <<
" " << (cEnd-c) <<
endmsg;
648 for( ; c!=cEnd ; ++c ) {
658 std::vector< Trig::Feature<TrigRoiDescriptor> > initRois;
662 if ( roi_key==
"SuperRoi" && icomb>1 )
continue;
670 if ( initRois.empty() ) initRois = c->get<
TrigRoiDescriptor>(
"initialRoI", decisiontype );
675 if ( initRois.empty() )
continue;
683 if(initRois.size()>1 && roi_key!=
"SuperRoi" ) {
685 m_provider->msg(MSG::VERBOSE) <<
" More than one initial RoI found for seeded chain " << chainname <<
": not yet supported" <<
endmsg;
691 if( !initRois.empty() ) {
695 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainname <<
" " << *roid <<
endmsg;
723 m_provider->msg(MSG::VERBOSE) <<
"Searching for collection " << key <<
endmsg;
727 if ( key.find(
"InDetTrigParticleCreation")!=std::string::npos ||
728 key.find(
"_IDTrig")!=std::string::npos ||
729 key.find(
"_EFID")!=std::string::npos ||
730 chainName.find(
"EF_")!=std::string::npos ||
731 chainName.find(
"HLT_")!=std::string::npos ) {
732# ifdef XAODTRACKING_TRACKPARTICLE_H
745 if ( chainName.find(
"L2_")!=std::string::npos ) {
748# ifdef XAODTRACKING_TRACKPARTICLE_H
751 else m_provider->msg(MSG::WARNING) <<
"No track collection " << key <<
" found" <<
endmsg;
756 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
758 m_provider->msg(MSG::VERBOSE) <<
"test tracks.size() " << testtracks.size() <<
endmsg;
763 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
764 m_provider->msg(MSG::VERBOSE) <<
"test tracks.size() " << testtracks.size() <<
endmsg;
765 for (
int ii=testtracks.size() ; ii-- ; ) {
766 m_provider->msg(MSG::VERBOSE) <<
" test track " << ii <<
" " << *testtracks[ii] <<
endmsg;
771 chain.addRoi( *roiInfo );
773 chain.back().addTracks(testtracks);
783 if ( vtx_name!=
"" ) {
785 m_provider->msg(MSG::VERBOSE) <<
"\tFetch xAOD::VertexContainer for chain " << chainConfig <<
" with key " << vtx_name <<
endmsg;
787 std::vector< Trig::Feature<xAOD::VertexContainer> > xaodtrigvertices = c->get<
xAOD::VertexContainer>(vtx_name);
789 if ( xaodtrigvertices.empty() ) {
790 if (
m_provider->msg().level() <= MSG::DEBUG ) {
791 m_provider->msg(MSG::WARNING) <<
"\tNo xAOD::VertexContainer for chain " << chainConfig <<
" for key " << vtx_name <<
endmsg;
796 m_provider->msg(MSG::VERBOSE) <<
"\txAOD::VertexContainer found with size " << xaodtrigvertices.size() <<
"\t" << vtx_name <<
endmsg;
798 for (
unsigned iv=0 ; iv<xaodtrigvertices.size() ; iv++ ) {
802 m_provider->msg(MSG::VERBOSE) <<
"\t" << iv <<
" xAOD VxContainer for " << chainConfig <<
" " << vert <<
" key " << vtx_name <<
endmsg;
806 for ( ; vtxitr != vert->
end(); ++vtxitr) {
810 if ( (*vtxitr)->vertexType()!=0 || vtx_name==
"EFHistoPrmVtx" ) {
818 (*vtxitr)->nTrackParticles(),
820 (*vtxitr)->chiSquared(),
821 (*vtxitr)->numberDoF() ) );
836 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
842 for (
unsigned iroi=0 ; iroi<chain.size() ; iroi++ ) {
847 filterRef.
setRoi( &chain.rois().at(iroi).roi() );
850 else filterRef.
setRoi( 0 );
869 if (
m_provider->msg().level() <= MSG::VERBOSE )
872 bool foundTruth =
false;
877 else filter_truth.
setRoi( 0 );
879 selectorTruth.
clear();
881 if (
m_provider->msg().level() <= MSG::VERBOSE )
900 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
901 m_provider->msg(MSG::VERBOSE) <<
"Truth not found - none whatsoever!" <<
endmsg;
908 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
919 std::string keys[4] = {
"GEN_AOD",
"TruthEvent",
"",
"G4Truth" };
921 std::string key =
"";
923 bool foundcollection =
false;
925 for (
int ik=0 ; ik<4 ; ik++ ) {
927 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
928 m_provider->msg(MSG::VERBOSE) <<
"Try McEventCollection: " << keys[ik] <<
endmsg;
932 if(
m_provider->msg().level() <= MSG::VERBOSE )
933 m_provider->msg(MSG::VERBOSE) <<
"No McEventCollection: " << keys[ik] <<
endmsg;
937 if (
m_provider->msg().level() <= MSG::VERBOSE )
938 m_provider->msg(MSG::VERBOSE) <<
"evtStore()->retrieve( mcevent, " << keys[ik] <<
" )" <<
endmsg;
940 if ( this->
template retrieve( mcevent, keys[ik] ).isFailure() ) {
941 if (
m_provider->msg().level() <= MSG::VERBOSE )
942 m_provider->msg(MSG::VERBOSE) <<
"Failed to get McEventCollection: " << keys[ik] <<
endmsg;
948 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
endmsg;
949 foundcollection =
true;
955 if ( !foundcollection ) {
957 m_provider->msg(MSG::WARNING) <<
"No MC Truth Collections of any sort, whatsoever!!!" <<
endmsg;
965 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
966 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
"\tNevents " << mcevent->
size() <<
endmsg;
977 while ( evitr!=evend ) {
986 for (
auto pitr: *(*evitr)) {
1006 if(
m_provider->msg().level() <= MSG::VERBOSE){
1007 m_provider->msg(MSG::VERBOSE) <<
"Found " << ip <<
" TruthParticles (GenParticles) in " << ie_ip <<
" GenEvents out of " << ie <<
endmsg;
1008 m_provider->msg(MSG::VERBOSE) <<
"selected " << selectorTruth.
size() <<
" TruthParticles (GenParticles)" <<
endmsg;
1011 if(selectorTruth.
size() > 0) foundTruth =
true;
1026# ifdef XAODTRACKING_TRACKPARTICLE_H
1039 else if (
m_provider->msg().level() <= MSG::WARNING ) {
1045 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
1056 ref_tracks=selectorTruth.
tracks();
1062 test_tracks.clear();
1064 for (
unsigned itrk=0 ; itrk<chain.rois().at(iroi).tracks().
size() ; itrk++ ) {
1065 test_tracks.push_back(&(chain.rois().at(iroi).tracks().at(itrk)));
1071 _analysis->setvertices( vertices.size() );
1073 if ( refbeamspot.size()>0 )
_analysis->setBeamRef( refbeamspot );
1074 if ( testbeamspot.size()>0 )
_analysis->setBeamTest( testbeamspot );
1116 _analysis->setroi( &chain.rois().at(iroi).roi() );
1121 if ( vtx_name!=
"" ) {
1123 std::vector<TIDA::Vertex> vr = chain.rois().at(iroi).vertices();
1124 std::vector<TIDA::Vertex*> vtx_rec;
1125 for (
unsigned iv=0 ; iv<vr.size() ; iv++ ) vtx_rec.push_back( &vr[iv] );
1127 std::vector<TIDA::Vertex*> vtx;
1129 for (
unsigned iv=0 ; iv<vertices.size() ; iv++ ) vtx.push_back( &vertices[iv] );
1132 if ( vertices.size()>
unsigned(this->getVtxIndex()) ) vtx.push_back( &vertices[this->
getVtxIndex()] );
1142 <<
"\trun " << run_number
1143 <<
"\tevent " << event_number
1144 <<
"\tlb " << lumi_block <<
endmsg;
1151 if (
m_provider->msg().level() <= MSG::VERBOSE ) {