5 #include "GaudiKernel/ConcurrencyFlags.h"
13 m_detManager(nullptr),
14 m_MmIdHelper(nullptr),
17 declareInterface<NSWL1::IMMTriggerTool>(
this);
27 << std::setfill(
' ') << std::setiosflags(std::ios::right) );
34 const INamedInterface* pnamed =
dynamic_cast<const INamedInterface*
>(
parent);
35 const std::string& algo_name = pnamed->name();
37 if (Gaudi::Concurrency::ConcurrencyFlags::numConcurrentEvents() > 1) {
38 ATH_MSG_ERROR(
"DoNtuple is not possible in multi-threaded mode");
39 return StatusCode::FAILURE;
45 if ( algo_name==
"NSWL1Simulation" ) {
46 SmartIF<ITHistSvc> tHistSvc{service(
"THistSvc")};
50 std::string ntuple_name = algo_name+
"Tree";
51 ATH_CHECK( tHistSvc->getTree(ntuple_name,m_tree) );
66 return StatusCode::SUCCESS;
71 int event = ctx.eventID().event_number();
72 ATH_MSG_DEBUG(
"********************************************************* EVENT NUMBER = " <<
event);
80 std::map<std::string, std::shared_ptr<MMT_Parameters> >
pars;
85 std::map<std::pair<int, unsigned int>,std::vector<digitWrapper> >
entries;
86 std::map<std::pair<int, unsigned int>,std::vector<hitData_entry> > Hits_Data_Set_Time;
87 std::map<std::pair<int, unsigned int>,
evInf_entry> Event_Info;
93 if( !readMcEventCollection.
isValid() ){
95 return StatusCode::FAILURE;
97 if(
m_doTruth) ptrMcEventCollection = readMcEventCollection.
cptr();
99 if( !readMuonEntryLayer.
isValid() ){
101 return StatusCode::FAILURE;
107 if( !readMmDigitContainer.
isValid() ){
109 return StatusCode::FAILURE;
112 ATH_CHECK(
load.getMMDigitsInfo(ctx, ptrMcEventCollection, ptrMuonEntryLayer, readMmDigitContainer.
cptr(),
entries, Hits_Data_Set_Time, Event_Info, histDigVars) );
117 Hits_Data_Set_Time.clear();
119 return StatusCode::SUCCESS;
122 std::unique_ptr<MMT_Diamond> diamond = std::make_unique<MMT_Diamond>(
m_detManager);
136 for (
const auto &
it : Event_Info) {
137 double trueta = -999., truphi = -999., trutheta = -999., trupt = -999.,
dt = -999., tpos = -999., ppos = -999.,
epos = -999., tent = -999., pent = -999., eent = -999.;
138 trutheta =
it.second.theta_ip;
139 truphi =
it.second.phi_ip;
140 trueta =
it.second.eta_ip;
141 trupt =
it.second.pt;
142 tpos =
it.second.theta_pos;
143 ppos =
it.second.phi_pos;
145 tent =
it.second.theta_ent;
146 pent =
it.second.phi_ent;
147 eent =
it.second.eta_ent;
148 dt =
it.second.dtheta;
150 m_trigger_trueEtaRange->push_back(trueta);
151 m_trigger_truePtRange->push_back(trupt);
152 m_trigger_trueThe->push_back(trutheta);
153 m_trigger_truePhi->push_back(truphi);
154 m_trigger_trueDth->push_back(
dt);
155 m_trigger_trueEtaPos->push_back(
epos);
156 m_trigger_trueThePos->push_back(tpos);
157 m_trigger_truePhiPos->push_back(ppos);
158 m_trigger_trueEtaEnt->push_back(eent);
159 m_trigger_trueTheEnt->push_back(tent);
160 m_trigger_truePhiEnt->push_back(pent);
166 std::pair<int, unsigned int> pair_event (
event,
i);
169 std::string station =
"-";
170 auto event_it =
entries.find(pair_event);
171 station = event_it->second[0].stName;
174 int stationPhi = -999;
180 auto reco_it = Hits_Data_Set_Time.find(pair_event);
181 if (reco_it != Hits_Data_Set_Time.end()) {
190 for(
const auto &hit : reco_it->second) {
191 m_trigger_VMM->push_back(hit.VMM_chip);
192 m_trigger_plane->push_back(hit.plane);
193 m_trigger_station->push_back(hit.station_eta);
194 m_trigger_strip->push_back(hit.strip);
197 for (
const auto &
s : slopes) m_trigger_RZslopes->push_back(
s);
212 m_trigger_diamond_bc->push_back(slope.BC);
213 m_trigger_diamond_totalCount->push_back(slope.totalCount);
214 m_trigger_diamond_realCount->push_back(slope.realCount);
215 m_trigger_diamond_XbkgCount->push_back(slope.xbkg);
216 m_trigger_diamond_UVbkgCount->push_back(slope.uvbkg);
217 m_trigger_diamond_XmuonCount->push_back(slope.xmuon);
218 m_trigger_diamond_UVmuonCount->push_back(slope.uvmuon);
219 m_trigger_diamond_iX->push_back(slope.iRoad);
220 m_trigger_diamond_iU->push_back(slope.iRoadu);
221 m_trigger_diamond_iV->push_back(slope.iRoadv);
222 m_trigger_diamond_age->push_back(slope.age);
223 m_trigger_diamond_mx->push_back(slope.mx);
224 m_trigger_diamond_my->push_back(slope.my);
225 m_trigger_diamond_Uavg->push_back(slope.uavg);
226 m_trigger_diamond_Vavg->push_back(slope.vavg);
227 m_trigger_diamond_mxl->push_back(slope.mxl);
228 m_trigger_diamond_theta->push_back(slope.theta);
229 m_trigger_diamond_eta->push_back(slope.eta);
230 m_trigger_diamond_dtheta->push_back(slope.dtheta);
231 m_trigger_diamond_phi->push_back(slope.phi);
232 m_trigger_diamond_phiShf->push_back(slope.phiShf);
237 std::vector<int> slopeBC;
239 std::sort(slopeBC.begin(), slopeBC.end());
240 slopeBC.erase( std::unique(slopeBC.begin(), slopeBC.end()), slopeBC.end() );
241 for (
const auto &bc : slopeBC) {
245 if (bc == slope.BC) {
262 if (
m_doNtuple) m_trigger_diamond_TP_phi_id->push_back(phi_id);
265 double extrapolatedR = 7824.46*std::abs(
std::tan(slope.theta));
272 if (extrapolatedR < (
m_rMin+j*Rsteps)) {
279 if (
m_doNtuple) m_trigger_diamond_TP_R_id->push_back(R_id);
295 if (
m_doNtuple) m_trigger_diamond_TP_dTheta_id->push_back(dTheta_id);
298 trigRawDataSegment->
setLowRes(slope.lowRes);
300 trigRawData->
push_back(trigRawDataSegment);
305 ATH_MSG_DEBUG(
"Filled MM RDO container now having size: " << rdo->
size() <<
". Clearing event information!");
309 ATH_MSG_DEBUG(
"Available hits are " << reco_it->second.size() <<
", less than X+UV threshold, skipping" );
318 Hits_Data_Set_Time.clear();
322 return StatusCode::SUCCESS;