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 ) {
740 if ( chainName.find(
"L2_")!=std::string::npos ) {
743 else m_provider->msg(MSG::WARNING) <<
"No track collection " << key <<
" found" <<
endmsg;
748 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
750 m_provider->msg(MSG::VERBOSE) <<
"test tracks.size() " << testtracks.size() <<
endmsg;
755 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
756 m_provider->msg(MSG::VERBOSE) <<
"test tracks.size() " << testtracks.size() <<
endmsg;
757 for (
int ii=testtracks.size() ; ii-- ; ) {
758 m_provider->msg(MSG::VERBOSE) <<
" test track " << ii <<
" " << *testtracks[ii] <<
endmsg;
763 chain.addRoi( *roiInfo );
765 chain.back().addTracks(testtracks);
775 if ( vtx_name!=
"" ) {
777 m_provider->msg(MSG::VERBOSE) <<
"\tFetch xAOD::VertexContainer for chain " << chainConfig <<
" with key " << vtx_name <<
endmsg;
779 std::vector< Trig::Feature<xAOD::VertexContainer> > xaodtrigvertices = c->get<
xAOD::VertexContainer>(vtx_name);
781 if ( xaodtrigvertices.empty() ) {
782 if (
m_provider->msg().level() <= MSG::DEBUG ) {
783 m_provider->msg(MSG::WARNING) <<
"\tNo xAOD::VertexContainer for chain " << chainConfig <<
" for key " << vtx_name <<
endmsg;
788 m_provider->msg(MSG::VERBOSE) <<
"\txAOD::VertexContainer found with size " << xaodtrigvertices.size() <<
"\t" << vtx_name <<
endmsg;
790 for (
unsigned iv=0 ; iv<xaodtrigvertices.size() ; iv++ ) {
794 m_provider->msg(MSG::VERBOSE) <<
"\t" << iv <<
" xAOD VxContainer for " << chainConfig <<
" " << vert <<
" key " << vtx_name <<
endmsg;
798 for ( ; vtxitr != vert->
end(); ++vtxitr) {
802 if ( (*vtxitr)->vertexType()!=0 || vtx_name==
"EFHistoPrmVtx" ) {
810 (*vtxitr)->nTrackParticles(),
812 (*vtxitr)->chiSquared(),
813 (*vtxitr)->numberDoF() ) );
828 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
834 for (
unsigned iroi=0 ; iroi<chain.size() ; iroi++ ) {
839 filterRef.
setRoi( &chain.rois().at(iroi).roi() );
842 else filterRef.
setRoi( 0 );
861 if (
m_provider->msg().level() <= MSG::VERBOSE )
864 bool foundTruth =
false;
869 else filter_truth.
setRoi( 0 );
871 selectorTruth.
clear();
873 if (
m_provider->msg().level() <= MSG::VERBOSE )
892 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
893 m_provider->msg(MSG::VERBOSE) <<
"Truth not found - none whatsoever!" <<
endmsg;
900 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
911 std::string keys[4] = {
"GEN_AOD",
"TruthEvent",
"",
"G4Truth" };
913 std::string key =
"";
915 bool foundcollection =
false;
917 for (
int ik=0 ; ik<4 ; ik++ ) {
919 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
920 m_provider->msg(MSG::VERBOSE) <<
"Try McEventCollection: " << keys[ik] <<
endmsg;
924 if(
m_provider->msg().level() <= MSG::VERBOSE )
925 m_provider->msg(MSG::VERBOSE) <<
"No McEventCollection: " << keys[ik] <<
endmsg;
929 if (
m_provider->msg().level() <= MSG::VERBOSE )
930 m_provider->msg(MSG::VERBOSE) <<
"evtStore()->retrieve( mcevent, " << keys[ik] <<
" )" <<
endmsg;
932 if ( this->
template retrieve( mcevent, keys[ik] ).isFailure() ) {
933 if (
m_provider->msg().level() <= MSG::VERBOSE )
934 m_provider->msg(MSG::VERBOSE) <<
"Failed to get McEventCollection: " << keys[ik] <<
endmsg;
940 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
endmsg;
941 foundcollection =
true;
947 if ( !foundcollection ) {
949 m_provider->msg(MSG::WARNING) <<
"No MC Truth Collections of any sort, whatsoever!!!" <<
endmsg;
957 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
958 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
"\tNevents " << mcevent->
size() <<
endmsg;
969 while ( evitr!=evend ) {
978 for (
auto pitr: *(*evitr)) {
998 if(
m_provider->msg().level() <= MSG::VERBOSE){
999 m_provider->msg(MSG::VERBOSE) <<
"Found " << ip <<
" TruthParticles (GenParticles) in " << ie_ip <<
" GenEvents out of " << ie <<
endmsg;
1000 m_provider->msg(MSG::VERBOSE) <<
"selected " << selectorTruth.
size() <<
" TruthParticles (GenParticles)" <<
endmsg;
1003 if(selectorTruth.
size() > 0) foundTruth =
true;
1022 else if (
m_provider->msg().level() <= MSG::WARNING ) {
1028 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
1039 ref_tracks=selectorTruth.
tracks();
1045 test_tracks.clear();
1047 for (
unsigned itrk=0 ; itrk<chain.rois().at(iroi).tracks().
size() ; itrk++ ) {
1048 test_tracks.push_back(&(chain.rois().at(iroi).tracks().at(itrk)));
1054 _analysis->setvertices( vertices.size() );
1056 if ( refbeamspot.size()>0 )
_analysis->setBeamRef( refbeamspot );
1057 if ( testbeamspot.size()>0 )
_analysis->setBeamTest( testbeamspot );
1099 _analysis->setroi( &chain.rois().at(iroi).roi() );
1104 if ( vtx_name!=
"" ) {
1106 std::vector<TIDA::Vertex> vr = chain.rois().at(iroi).vertices();
1107 std::vector<TIDA::Vertex*> vtx_rec;
1108 for (
unsigned iv=0 ; iv<vr.size() ; iv++ ) vtx_rec.push_back( &vr[iv] );
1110 std::vector<TIDA::Vertex*> vtx;
1112 for (
unsigned iv=0 ; iv<vertices.size() ; iv++ ) vtx.push_back( &vertices[iv] );
1115 if ( vertices.size()>
unsigned(this->getVtxIndex()) ) vtx.push_back( &vertices[this->
getVtxIndex()] );
1125 <<
"\trun " << run_number
1126 <<
"\tevent " << event_number
1127 <<
"\tlb " << lumi_block <<
endmsg;
1134 if (
m_provider->msg().level() <= MSG::VERBOSE ) {