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;
650 else if (
m_provider->msg().level() <= MSG::WARNING ) {
660 for (
unsigned ichain=0 ; ichain<
m_chainNames.size() ; ichain++ ) {
665 const std::string& chainname =
m_chainNames[ichain].head();
667 const std::string& vtx_name =
m_chainNames[ichain].vtx();
674 std::string ptvalue =
m_chainNames[ichain].postvalue(
"pt");
680 unsigned decisiontype;
692 if ( chainname!=
"" &&
m_provider->msg().level() <= MSG::VERBOSE ) {
694 m_provider->msg(MSG::VERBOSE) <<
"status for chain " << chainname
695 <<
"\tpass " << (*m_tdt)->isPassed(chainname)
696 <<
"\tprescale " << (*m_tdt)->getPrescale(chainname) <<
endmsg;
698 m_provider->msg(MSG::VERBOSE) <<
"fetching features for chain " << chainname <<
endmsg;
700 m_provider->msg(MSG::VERBOSE) << chainname <<
"\tpassed: " << (*m_tdt)->isPassed( chainname ) <<
endmsg;
713 if ( chainname!=
"" && !this->
m_keepAllEvents && !(*m_tdt)->isPassed( chainname, decisiontype ) )
continue;
724 std::vector<std::string> chainNames ;
735 for (
unsigned i = 0 ; i < chainNames.size() ; ++i ) {
738 std::string chainName = chainConfig.
head();
740 m_event->addChain( chainNames[i] );
744 if ( chainName ==
"" ) {
754 chain.addRoi( *roiInfo );
761 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
763 chain.back().addTracks(testtracks);
765 if ( vtx_name!=
"" ) {
769 m_provider->msg(MSG::VERBOSE) <<
"\tFetch xAOD::VertexContainer with key " << vtx_name <<
endmsg;
771 std::vector<TIDA::Vertex> tidavertices;
773 if ( this->
select( tidavertices, vtx_name ) ) chain.back().addVertices( tidavertices );
786 std::string roi_key = chainConfig.
roi();
796 if ( chainConfig.
element()!=
"" ) {
797 leg = std::atoi(chainConfig.
element().c_str());
800 std::vector< TrigCompositeUtils::LinkInfo<TrigRoiDescriptorCollection> > rois =
820 if ( roi_key==
"SuperRoi" && iroi>1 )
continue;
827 if ( roi_key!=
"" && roi_link.
dataID()!=roi_key )
continue;
837 if (
m_provider->msg().level() <= MSG::VERBOSE) {
838 m_provider->msg(MSG::VERBOSE) <<
" RoI descriptor for seeded chain " << chainname <<
" " << **roiptr <<
endmsg;
855 chain.addRoi( *roiInfo );
859 const std::vector<TIDA::Track*>& testtracks =
m_selectorTest->tracks();
861 chain.back().addTracks(testtracks);
866 if ( vtx_name!=
"" ) {
868 std::vector<TIDA::Vertex> tidavertices;
870 this->
select( tidavertices, roi_link, vtx_name );
872 chain.back().addVertices( tidavertices );
879 std::cout <<
"\tTIDA analysis for chain: " << chainname <<
"\t key: " << key <<
"\t" << **roiptr << std::endl;
880 std::cout <<
"\tcollections: " << chain.back() << std::endl;
894 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
902 for (
unsigned ichain=0 ; ichain<
m_event->size() ; ichain++ ) {
906 const std::string& vtx_name = chainConfig.
vtx();
909 if ( TnP_flag && chainConfig.
extra().find(
"_tag")!=std::string::npos ) continue ;
911 std::vector<TIDA::Roi*> rois ;
918 rois.reserve( chain.size() );
919 for (
size_t ir=0 ;
ir<chain.size() ;
ir++ ) {
920 rois.push_back( &(chain.rois()[
ir]) );
926 for (
unsigned iroi=0 ; iroi<rois.size() ; iroi++ ) {
929 filterRef.
setRoi( &(rois.at(iroi)->roi() ) );
932 else filterRef.
setRoi( 0 );
952 if (
m_provider->msg().level() <= MSG::VERBOSE )
963 if (
m_provider->msg().level() <= MSG::VERBOSE ) {
973 for (
unsigned itrk=0 ; itrk<rois.at(iroi)->tracks().
size() ; itrk++ ) {
974 test_tracks.push_back(&(rois.at(iroi)->tracks().at(itrk)));
979 _analysis->setvertices( vertices.size() );
981 if ( refbeamspot.size()>0 )
_analysis->setBeamRef( refbeamspot );
982 if ( testbeamspot.size()>0 )
_analysis->setBeamTest( testbeamspot );
1022 _analysis->setroi( &rois.at(iroi)->roi() );
1025 if ( vtx_name!=
"" ) {
1027 std::vector<TIDA::Vertex> vr = rois.at(iroi)->vertices();
1028 std::vector<TIDA::Vertex*> vtx_rec;
1029 for (
unsigned iv=0 ; iv<vr.size() ; iv++ ) vtx_rec.push_back( &vr[iv] );
1031 std::vector<TIDA::Vertex*> vtx;
1033 for (
unsigned iv=0 ; iv<vertices.size() ; iv++ ) vtx.push_back( &vertices[iv] );
1036 if ( vertices.size()>
unsigned(this->getVtxIndex()) ) vtx.push_back( &vertices[this->
getVtxIndex()] );
1039 _analysis->execute_vtx( vtx, vtx_rec,
m_event );
1046 <<
"\trun " << run_number
1047 <<
"\tevent " << event_number
1048 <<
"\tlb " << lumi_block <<
endmsg;
1055 if (
m_provider->msg().level() <= MSG::VERBOSE ) {