192 if(
m_provider->msg().level() <= MSG::VERBOSE) {
204 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
205 m_provider->msg(MSG::VERBOSE) <<
" using beam position\tx=" << xbeam <<
"\ty=" << ybeam <<
endmsg;
207 std::vector<std::string> configuredChains = (*(
m_tdt))->getListOfTriggers(
"L2_.*, EF_.*, HLT_.*");
209 for (
unsigned i=0 ; i<configuredChains.size() ; i++ ) {
217 std::vector<ChainString>::iterator chainitr =
m_chainNames.begin();
219 std::vector<ChainString> chains;
229 if (
m_provider->msg().level() <= MSG::VERBOSE) {
233 if ( chainName.
head() ==
"" ) {
235 std::string selectChain = chainName.
raw();
243 std::vector<std::string> selectChains = (*(
m_tdt))->getListOfTriggers( chainName.
head() );
245 for (
unsigned iselected=0 ; iselected<selectChains.size() ; iselected++ ) {
247 selectChains[iselected] = chainName.
subs( selectChains[iselected] );
250 std::cout <<
"sorting:: chain specification: " << chainName <<
"\traw:" << chainName.
raw() << std::endl;
251 std::cout <<
"\tchain: " << chainName.
head() << std::endl;
252 std::cout <<
"\tkey: " << chainName.
tail() << std::endl;
253 std::cout <<
"\tind: " << chainName.
extra() << 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;
260 chains.push_back(
ChainString(selectChains[iselected]) );
262 if(
m_provider->msg().level() <= MSG::VERBOSE) {
263 m_provider->msg(MSG::VERBOSE) <<
"Matching chain " << selectChains[iselected] <<
" (" << chainName.
head() <<
")" <<
endmsg;
277 if(
m_provider->msg().level() <= MSG::VERBOSE) {
312 if ( xbeam!=0 || ybeam!=0 ) {
325 unsigned run_number = 0;
326 unsigned long long event_number = 0;
327 unsigned lumi_block = 0;
328 unsigned bunch_crossing_id = 0;
329 unsigned time_stamp = 0;
334 if ( this->
template retrieve(pEventInfo,
"EventInfo").isFailure() ) {
342 bunch_crossing_id = pEventInfo->
bcid();
346 if(
m_provider->msg().level() <= MSG::VERBOSE){
347 m_provider->msg(MSG::VERBOSE) <<
"run " << run_number
348 <<
"\tevent " << event_number
349 <<
"\tlb " << lumi_block <<
endmsg;
362 m_event->run_number(run_number);
363 m_event->event_number(event_number);
364 m_event->lumi_block(lumi_block);
365 m_event->time_stamp(time_stamp);
366 m_event->bunch_crossing_id(bunch_crossing_id);
372 bool analyse =
false;
378 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
380 const std::string& chainname =
m_chainNames[ichain].head();
382 if ( chainname ==
"" ) analyse =
true;
386 if ( chainname.find(
"L2") == std::string::npos &&
387 chainname.find(
"EF") == std::string::npos &&
388 chainname.find(
"HLT") == std::string::npos )
continue;
390 if (
m_provider->msg().level() <= MSG::DEBUG ) {
391 m_provider->msg(MSG::DEBUG) <<
"Chain " << chainname
392 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
393 <<
"\tpres " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
399 if ( (*(
m_tdt))->isPassed(chainname) || (*(
m_tdt))->getPrescale(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;
423 selectorTruth.
clear();
435 std::vector<TIDA::Vertex> vertices;
436 std::vector<TIDA::Vertex> vertices_rec;
438 std::vector<double> refbeamspot;
439 std::vector<double> testbeamspot;
443 m_provider->msg(MSG::VERBOSE) <<
"fetching AOD Primary vertex container" <<
endmsg;
445 if ( !this->
select( vertices,
"PrimaryVertices" ) ) {
446 m_provider->msg(MSG::VERBOSE) <<
"could not retrieve vertex collection " "PrimaryVertices" << std::endl;
460 for (
unsigned i=0 ; i<vertices.size() ; i++ ) {
462 m_provider->msg(MSG::VERBOSE) <<
"vertex " << i <<
" " << vertices[i] <<
endmsg;
463 m_event->addVertex(vertices[i]);
470 std::vector<TIDA::Track*> offline_tracks;
471 std::vector<TIDA::Track*> electron_tracks;
472 std::vector<TIDA::Track*> muon_tracks;
474 std::vector<TIDA::Track*> ref_tracks;
475 std::vector<TIDA::Track*> test_tracks;
477 offline_tracks.clear();
478 electron_tracks.clear();
485 if (
m_provider->msg().level() <= MSG::VERBOSE )
488 bool foundTruth =
false;
494 selectorTruth.
clear();
496 if (
m_provider->msg().level() <= MSG::VERBOSE )
520 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
521 m_provider->msg(MSG::VERBOSE) <<
"Truth not found - none whatsoever!" <<
endmsg;
527 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
538 std::string keys[4] = {
"GEN_AOD",
"TruthEvent",
"",
"G4Truth" };
540 std::string key =
"";
542 bool foundcollection =
false;
544 for (
int ik=0 ; ik<4 ; ik++ ) {
546 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
547 m_provider->msg(MSG::VERBOSE) <<
"Try McEventCollection: " << keys[ik] <<
endmsg;
551 if(
m_provider->msg().level() <= MSG::VERBOSE )
552 m_provider->msg(MSG::VERBOSE) <<
"No McEventCollection: " << keys[ik] <<
endmsg;
556 if (
m_provider->msg().level() <= MSG::VERBOSE )
557 m_provider->msg(MSG::VERBOSE) <<
"evtStore()->retrieve( mcevent, " << keys[ik] <<
" )" <<
endmsg;
559 if ( this->
template retrieve( mcevent, keys[ik] ).isFailure() ) {
560 if (
m_provider->msg().level() <= MSG::VERBOSE )
561 m_provider->msg(MSG::VERBOSE) <<
"Failed to get McEventCollection: " << keys[ik] <<
endmsg;
567 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
endmsg;
568 foundcollection =
true;
574 if ( !foundcollection ) {
576 m_provider->msg(MSG::WARNING) <<
"No MC Truth Collections of any sort, whatsoever!!!" <<
endmsg;
584 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
585 m_provider->msg(MSG::VERBOSE) <<
"Found McEventCollection: " << key <<
"\tNevents " << mcevent->
size() <<
endmsg;
596 while ( evitr!=evend ) {
605 for (
auto pitr: *(*evitr) ) {
625 if(
m_provider->msg().level() <= MSG::VERBOSE){
626 m_provider->msg(MSG::VERBOSE) <<
"Found " << ip <<
" TruthParticles (GenParticles) in " << ie_ip <<
" GenEvents out of " << ie <<
endmsg;
627 m_provider->msg(MSG::VERBOSE) <<
"selected " << selectorTruth.
size() <<
" TruthParticles (GenParticles)" <<
endmsg;
630 if(selectorTruth.
size() > 0) foundTruth =
true;
647 else if (
m_provider->msg().level() <= MSG::WARNING ) {
657 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
662 const std::string& chainname =
m_chainNames[ichain].head();
664 const std::string& vtx_name =
m_chainNames[ichain].vtx();
671 std::string ptvalue =
m_chainNames[ichain].postvalue(
"pt");
677 unsigned decisiontype;
689 if ( chainname!=
"" &&
m_provider->msg().level() <= MSG::VERBOSE ) {
691 m_provider->msg(MSG::VERBOSE) <<
"status for chain " << chainname
692 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
693 <<
"\tprescale " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
695 m_provider->msg(MSG::VERBOSE) <<
"fetching features for chain " << chainname <<
endmsg;
697 m_provider->msg(MSG::VERBOSE) << chainname <<
"\tpassed: " << (*m_tdt)->isPassed( chainname ) <<
endmsg;
710 if ( chainname!=
"" && !this->
m_keepAllEvents && !(*m_tdt)->isPassed( chainname, decisiontype ) )
continue;
721 std::vector<std::string> chainNames ;
732 for (
unsigned i = 0 ; i < chainNames.size() ; ++i ) {
735 std::string chainName = chainConfig.
head();
737 m_event->addChain( chainNames[i] );
741 if ( chainName ==
"" ) {
751 chain.addRoi( *roiInfo );
758 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
760 chain.back().addTracks(testtracks);
762 if ( vtx_name!=
"" ) {
766 m_provider->msg(MSG::VERBOSE) <<
"\tFetch xAOD::VertexContainer with key " << vtx_name <<
endmsg;
768 std::vector<TIDA::Vertex> tidavertices;
770 if ( this->
select( tidavertices, vtx_name ) ) chain.back().addVertices( tidavertices );
783 std::string roi_key = chainConfig.
roi();
793 if ( chainConfig.
element()!=
"" ) {
794 leg = std::atoi(chainConfig.
element().c_str());
797 std::vector< TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> > rois =
817 if ( roi_key==
"SuperRoi" && iroi>1 )
continue;
824 if ( roi_key!=
"" && roi_link.
dataID()!=roi_key )
continue;
834 if (
m_provider->msg().level() <= MSG::VERBOSE) {
835 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainname <<
" " << **roiptr <<
endmsg;
852 chain.addRoi( *roiInfo );
856 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
858 chain.back().addTracks(testtracks);
863 if ( vtx_name!=
"" ) {
865 std::vector<TIDA::Vertex> tidavertices;
867 this->
select( tidavertices, roi_link, vtx_name );
869 chain.back().addVertices( tidavertices );
876 std::cout <<
"\tTIDA analysis for chain: " << chainname <<
"\t key: " << key <<
"\t" << **roiptr << std::endl;
877 std::cout <<
"\tcollections: " << chain.back() << std::endl;
891 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
899 for (
unsigned ichain=0 ; ichain<
m_event->size() ; ichain++ ) {
903 const std::string& vtx_name = chainConfig.
vtx();
906 if ( TnP_flag && chainConfig.
extra().find(
"_tag")!=std::string::npos ) continue ;
908 std::vector<TIDA::Roi*> rois ;
915 rois.reserve( chain.size() );
916 for (
size_t ir=0 ;
ir<chain.size() ;
ir++ ) {
917 rois.push_back( &(chain.rois()[
ir]) );
923 for (
unsigned iroi=0 ; iroi<rois.size() ; iroi++ ) {
926 filterRef.
setRoi( &(rois.at(iroi)->roi() ) );
929 else filterRef.
setRoi( 0 );
949 if (
m_provider->msg().level() <= MSG::VERBOSE )
960 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
970 for (
unsigned itrk=0 ; itrk<rois.at(iroi)->tracks().
size() ; itrk++ ) {
971 test_tracks.push_back(&(rois.at(iroi)->tracks().at(itrk)));
976 _analysis->setvertices( vertices.size() );
978 if ( refbeamspot.size()>0 )
_analysis->setBeamRef( refbeamspot );
979 if ( testbeamspot.size()>0 )
_analysis->setBeamTest( testbeamspot );
1019 _analysis->setroi( &rois.at(iroi)->roi() );
1022 if ( vtx_name!=
"" ) {
1024 std::vector<TIDA::Vertex> vr = rois.at(iroi)->vertices();
1025 std::vector<TIDA::Vertex*> vtx_rec;
1026 for (
unsigned iv=0 ; iv<vr.size() ; iv++ ) vtx_rec.push_back( &vr[iv] );
1028 std::vector<TIDA::Vertex*> vtx;
1030 for (
unsigned iv=0 ; iv<vertices.size() ; iv++ ) vtx.push_back( &vertices[iv] );
1033 if ( vertices.size()>
unsigned(this->getVtxIndex()) ) vtx.push_back( &vertices[this->
getVtxIndex()] );
1036 _analysis->execute_vtx( vtx, vtx_rec,
m_event );
1043 <<
"\trun " << run_number
1044 <<
"\tevent " << event_number
1045 <<
"\tlb " << lumi_block <<
endmsg;
1052 if (
m_provider->msg().level() <= MSG::VERBOSE ) {