ATLAS Offline Software
FPGATrackSimMapMakerAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 #include "TH2.h"
10 #include "TFile.h"
11 
12 #include "GaudiKernel/IEventProcessor.h"
13 
14 
16 // Initialize
17 
18 FPGATrackSimMapMakerAlg::FPGATrackSimMapMakerAlg (const std::string& name, ISvcLocator* pSvcLocator) :
19  AthAlgorithm(name, pSvcLocator)
20 {
21 }
22 
23 
25 {
26 
27  m_monitorFile = new TFile((m_outFileName.value() + ".root").c_str(), "RECREATE");
28  std::stringstream ss(m_description);
29  std::string line;
30  ATH_MSG_INFO("Tag config:");
31  if (m_description.value() != "")
32  while (std::getline(ss, line, '\n'))
33  ATH_MSG_INFO('\t' << line);
34 
35  // reset Hit and Module vectors
36  m_pbHits.clear(); m_peHits.clear(); m_sbHits.clear(); m_seHits.clear(); m_allHits.clear();
37  m_track2modules.clear(); m_track2slice.clear(); m_slice2modules.clear();
38  m_key_etamods.clear(); m_key_etamods2.clear(); m_usedTracks.clear();
39  m_radii.clear(); m_keylayer.clear(); m_keylayer2.clear();
40  m_modules.clear();
41 
42  // Set up the module relabel tool.
44 
45  // We need to select this before calling parseKeyString() in case the user
46  // has specified a plane (logical layer) as the keystring.
47  if (m_doSpacePoints) {
49  } else {
51  }
52 
54  ATH_CHECK(m_hitInputTool.retrieve());
55 
56  ATH_MSG_DEBUG("initialize() Instantiating root objects");
57  ATH_MSG_DEBUG("initialize() Finished");
58 
59 
60  return StatusCode::SUCCESS;
61 }
62 
64 // MAIN EXECUTE ROUTINE //
66 
68 {
69  // Read inputs
70  bool done = false;
71  ATH_CHECK(readInputs(done));
72 
73  if (done) {
74  IEventProcessor* appMgr=nullptr;
75  ATH_CHECK(service("ApplicationMgr",appMgr));
76  if (!appMgr) {
77  ATH_MSG_ERROR("Failed to retrieve ApplicationMgr as IEventProcessor");
78  return StatusCode::FAILURE;
79  }
80  return appMgr->stopRun();
81  }
82 
83  // Reset data pointers
85 
86  return StatusCode::SUCCESS;
87 }
88 
89 
91 // INPUT READING AND PROCESSING //
93 
94 
96 {
97  // Read primary input
98  ATH_CHECK(m_hitInputTool->readData(&m_eventHeader, done));
99  if (done)
100  {
101  ATH_MSG_INFO("Cannot read more events from file, returning");
102  return StatusCode::SUCCESS; // end of loop over events
103  }
104 
106  ATH_MSG_DEBUG ("Getting Event " << eventinfo);
107 
108  for (auto hit: m_eventHeader.hits()) // fill track to modules map and hit vectors
109  {
110  // barcode cut: these hits are not associated with our single muon tracks
111  if (hit.getBarcodePt() == 0) continue;
112 
113  SiliconTech det = hit.getDetType();
114  DetectorZone bec = hit.getDetectorZone();
115  int lyr = hit.getPhysLayer();
116  int eta = hit.getEtaModule();
117  int phi = hit.getPhiModule();
118 
119  if (hit.isPixel() && hit.isBarrel()) {
120  m_pbHits.push_back(hit);
121  if (lyr > m_pbmax) m_pbmax = lyr;
122  }
123  else if (hit.isPixel() && !hit.isBarrel()) {
124  // Perform the layer + module number remapping using our tool.
125  m_moduleRelabel->remap(hit);
126  eta = hit.getEtaModule();
127  lyr = hit.getPhysLayer();
128 
129  m_peHits.push_back(hit);
130  if (bec == DetectorZone::posEndcap && lyr > m_pemax[0]) m_pemax[0] = lyr;
131  if (bec == DetectorZone::negEndcap && lyr > m_pemax[1]) m_pemax[1] = lyr;
132  }
133  else if (!hit.isPixel() && hit.isBarrel()) {
134  m_sbHits.push_back(hit);
135  if (lyr > m_sbmax) m_sbmax = lyr;
136  }
137  else if (!hit.isPixel() && !hit.isBarrel()) {
138  m_seHits.push_back(hit);
139  if (bec == DetectorZone::posEndcap && lyr > m_semax[0]) m_semax[0] = lyr;
140  if (bec == DetectorZone::negEndcap && lyr > m_semax[1]) m_semax[1] = lyr;
141  }
142  else ATH_MSG_ERROR("Invalid Region");
143 
144  // keep track of all etamods on the key layer for slicing
145  if (isOnKeyLayer(1,det,bec,lyr)) {
146  if (m_key_etamods.count(eta) == 0) {
147  m_key_etamods.insert(std::pair<int, int>(eta, 1));
148  } else {
149  m_key_etamods[eta] += 1;
150  }
151  }
152 
153  if (m_key2) // if doing 2D slicing
154  if (isOnKeyLayer(2,det,bec,lyr)) m_key_etamods2.insert(eta);
155 
156  // Keep a global record of all modules as we see them, indexed by the ID tuple.
157  Module mod = Module(det, bec, lyr, eta, phi);
158  if (m_modules.count(mod.moduleId()) == 0) {
159  m_modules.insert(std::pair<FPGATrackSimModuleId, Module>(mod.moduleId(), mod));
160  }
161  Module* modref = &(m_modules[mod.moduleId()]);
162 
163  if (std::find(m_track2modules[hit.getEventIndex()].begin(), m_track2modules[hit.getEventIndex()].end(), modref) == m_track2modules[hit.getEventIndex()].end())
164  m_track2modules[hit.getEventIndex()].push_back(modref);
165  m_allHits.push_back(hit);
166  }
167 
168  return StatusCode::SUCCESS;
169 }
170 
171 
172 
173 
175 // OUTPUT WRITING AND MONITORING //
177 StatusCode FPGATrackSimMapMakerAlg::writePmapAndRmap(std::vector<FPGATrackSimHit> const & pbHits, std::vector<FPGATrackSimHit> const & peHits, std::vector<FPGATrackSimHit> const & sbHits, std::vector<FPGATrackSimHit> const & seHits, int reg)
178 {
179  // Plane Map
180 
181  // to avoid vector _M_range_check errors, print at least one line for each DetectorZone
182  if (m_pbmax == -1) m_pbmax = 0;
183  if (m_sbmax == -1) m_sbmax = 0;
184  if (m_pemax[0] == -1) m_pemax[0] = 0;
185  if (m_pemax[1] == -1) m_pemax[1] = 0;
186  if (m_semax[0] == -1) m_semax[0] = 0;
187  if (m_semax[1] == -1) m_semax[1] = 0;
188 
189  std::string pmap_path = m_outFileName.value() + "region" + std::to_string(m_region) + ".pmap";
190  ATH_MSG_INFO("Creating pmap: " << pmap_path);
191  m_pmap.open(pmap_path, std::ofstream::out);
192 
193  m_pmap << m_geoTag.value() << "\n" << m_planes->at(reg).size() << " logical_s1\n" << m_planes2[reg].size() << " logical_s2\n";
194  m_pmap << m_pbmax+1 << " pixel barrel \n" << m_pemax[0]+1 << " pixel endcap+ \n" << m_pemax[1]+1 << " pixel endcap- \n";
195  m_pmap << m_sbmax+1 << " SCT barrel \n" << m_semax[0]+1 << " SCT endcap+\n" << m_semax[1]+1 << " SCT endcap-\n";
196  m_pmap << "! silicon endCap physDisk physLayer ['stereo' stripSide <strip only>] 'plane1' logiLayer1 'plane2' logiLayer2\n";
197  m_pmap << "\nregion " << reg << "\n";
198 
199  int p1,p2;
200  for (int lyr = 0; lyr <= m_pbmax; lyr++) { // Pixel Barrel
201  p1 = findPlane(m_planes->at(reg), "pb" + std::to_string(lyr));
202  p2 = findPlane(m_planes2[reg], "pb" + std::to_string(lyr));
203  m_pmap << "pixel 0 -1 " << lyr << " plane1 " << p1 << " plane2 " << p2 << "\n";
204  }
205  for (int lyr = 0; lyr <= m_pemax[0]; lyr++) { // Pixel Postive Endap
206  p1 = findPlane(m_planes->at(reg), "pe" + std::to_string(lyr) + "+");
207  p2 = findPlane(m_planes2[reg], "pe" + std::to_string(lyr) + "+");
208  m_pmap << "pixel 1 " << lyr << " " << lyr << " plane1 " << p1 << " plane2 " << p2 << "\n";
209  }
210  for (int lyr = 0; lyr <= m_pemax[1]; lyr++) { // Pixel Negative Endcap
211  p1 = findPlane(m_planes->at(reg), "pe" + std::to_string(lyr) + "-");
212  p2 = findPlane(m_planes2[reg], "pe" + std::to_string(lyr) + "-");
213  m_pmap << "pixel 2 " << lyr << " " << lyr << " plane1 " << p1 << " plane2 " << p2 << "\n";
214  }
215  for (int lyr = 0; lyr <= m_sbmax; lyr++) { // Strip Barrel
216  p1 = findPlane(m_planes->at(reg), "sb" + std::to_string(lyr));
217  p2 = findPlane(m_planes2[reg], "sb" + std::to_string(lyr));
218  m_pmap << "SCT 0 -1 " << lyr << " stereo " << lyr % 2 << " plane1 " << p1 << " plane2 " << p2 << "\n";
219  }
220  for (int lyr = 0; lyr <= m_semax[0]; lyr++) { // Strip Positive Endcap
221  p1 = findPlane(m_planes->at(reg), "se" + std::to_string(lyr) + "+");
222  p2 = findPlane(m_planes2[reg], "se" + std::to_string(lyr) + "+");
223  m_pmap << "SCT 1 " << lyr/2 << " " << lyr << " stereo " << lyr % 2 << " plane1 " << p1 << " plane2 " << p2 << "\n";
224  }
225  for (int lyr = 0; lyr <= m_semax[1]; lyr++) { // Strip Negative Endcap
226  p1 = findPlane(m_planes->at(reg), "se" + std::to_string(lyr) + "-");
227  p2 = findPlane(m_planes2[reg], "se" + std::to_string(lyr) + "-");
228  m_pmap << "SCT 2 " << lyr/2 << " " << lyr << " stereo " << lyr % 2 << " plane1 " << p1 << " plane2 " << p2 << "\n";
229  }
230 
231  // Region Map
232  std::string rmap_path = m_outFileName.value() + "region" + std::to_string(m_region) + ".rmap";
233  ATH_MSG_INFO("Creating rmap: " << rmap_path);
234  m_rmap.open(rmap_path, std::ofstream::out);
235  m_rmap << "towers 1 phi 16\n\n0\n";
236 
240 
244 
245  m_pmap.close();
246  m_rmap.close();
247 
248 
249  return StatusCode::SUCCESS;
250 }
251 
252 StatusCode FPGATrackSimMapMakerAlg::writeSubrmap(std::vector<FPGATrackSimHit> const & allHits)
253 {
254  /* ---------- Create z-slices ---------- */
255 
256  // BEFORE DOING ANYTHING ELSE, apply global trimming to m_key_etamods.
257  std::set<int> key_etamods;
258  // First, sum up the total number of hits in the key layer. There should be a one-liner for this...
259  float total_hits = 0;
260  for (auto const &etamod : m_key_etamods) {
261  total_hits += etamod.second;
262  }
263  ATH_MSG_INFO("Found " << total_hits << " hits in the key layer, applying global trim factor of " << m_globalTrim << "%");
264 
265  // Then, do the trim.
266  for (auto const &etamod : m_key_etamods) {
267  if (m_globalTrim == 0 || ((etamod.second / total_hits) >= m_globalTrim*0.01)) {
268  key_etamods.insert(etamod.first);
269  } else {
270  ATH_MSG_INFO("Eta module " << etamod.first << " only contains " << etamod.second << " out of " << total_hits << " hits, excluding from slices.");
271  }
272  }
273 
274  if (m_nSlices.value() == -1) m_nSlices.value() = key_etamods.size(); //default is full granularity slicing
275  float etasPerSlice = float(key_etamods.size())/m_nSlices.value();
276  std::vector<std::vector<int>> key_modules_for_slices; // indexed by slice, holds module eta values
277 
278  // easier to use vector than set, convert m_key_etamods into key_etas
279  std::vector<int> key_etas;
280  std::vector<int> key_etas2; // used if 2D slicing
281  key_etas.insert(key_etas.end(), key_etamods.begin(), key_etamods.end());
282 
283  for (unsigned i = 0; i < key_etas.size(); i++)
284  {
285  if (i >= (key_modules_for_slices.size() * etasPerSlice)) key_modules_for_slices.push_back(std::vector<int>());
286  key_modules_for_slices.back().push_back(key_etas[i]);
287  }
288 
289  std::map<int, int> keymod2slice;
290  for (unsigned s = 0; s < key_modules_for_slices.size(); s++)
291  for (unsigned e = 0; e < key_modules_for_slices[s].size(); e++)
292  keymod2slice[key_modules_for_slices[s][e]] = s;
293 
294  std::string key = m_keystring.value();
295  key.erase(std::remove(key.begin(), key.end(), ','), key.end());
296  key.erase(std::remove(key.begin(), key.end(), ' '), key.end());
297  std::string key2 = m_keystring2.value();
298  key2.erase(std::remove(key2.begin(), key2.end(), ','), key2.end());
299  key2.erase(std::remove(key2.begin(), key2.end(), ' '), key2.end());
300 
301  ATH_MSG_INFO("Doing z-slicing");
302  if (key_etamods.size() == 0) ATH_MSG_ERROR("Found 0 slices using the keystring: '" << m_keystring << "'");
303  ATH_MSG_INFO("Nslices = " << std::to_string(m_nSlices.value()) << ":");
304 
305  std::stringstream eta_slices;
306  for (unsigned s = 0; s < key_modules_for_slices.size(); s++){
307  for (unsigned e = 0; e < key_modules_for_slices[s].size(); e++){
308  eta_slices << key_modules_for_slices[s][e] << " ";
309  }
310  eta_slices << ", ";
311  }
312  ATH_MSG_INFO(eta_slices.str());
313 
314  // 2D key layer slicing
315  if (m_key2)
316  { // make new slices from combinations of keylayer1 slices and keylayer2 slices
317 
318  /*------------- setup keylayer2 keymodule to slice map -------------- */
319  std::vector<std::vector<int>> key_modules_for_slices2;
320  float etasPerSlice2 = float(m_key_etamods2.size())/m_nSlices.value();
321  key_etas2.insert(key_etas2.end(), m_key_etamods2.begin(), m_key_etamods2.end());
322  for (unsigned i = 0; i < key_etas2.size(); i++)
323  {
324  if (i >= (key_modules_for_slices2.size() * etasPerSlice2)) key_modules_for_slices2.push_back(std::vector<int>());
325  key_modules_for_slices2.back().push_back(key_etas2[i]);
326  }
327 
328  std::map<int, int> keymod2slice2;
329  for (unsigned s = 0; s < key_modules_for_slices2.size(); s++)
330  for (unsigned e = 0; e < key_modules_for_slices2[s].size(); e++)
331  keymod2slice2[key_modules_for_slices2[s][e]] = s;
332  /*----------------------------------------------------------------- */
333 
334  int new_nSlice = m_nSlices.value();
335  for (int s1 = 0; s1 < m_nSlices.value(); s1++){ // loop over keylayer1's slices
336  for (int s2 = 0; s2 < m_nSlices.value(); s2++){ // loop over keylayer2's slices
337 
338  for (auto& pair: m_track2modules) // track loop
339  {
340  if (m_usedTracks.find(pair.first) != m_usedTracks.end()) continue; // skip if already assigned a slice to this track
341  bool key1 = false;
342  bool key2 = false;
343  for (auto& m: pair.second) // module loop
344  {
345  if (isOnKeyLayer(1,m->det,m->bec,m->lyr))
346  if (keymod2slice[m->eta] == s1) key1 = true;
347 
348  if (isOnKeyLayer(2,m->det,m->bec,m->lyr))
349  if (keymod2slice2[m->eta] == s2) key2 = true;
350  }
351 
352  if (key1 && key2)
353  {
354  int newSlice = m_nSlices.value()*s1 + s2;
355  m_track2slice[pair.first] = newSlice;
356  m_usedTracks.insert(pair.first);
357  if (newSlice + 1 > new_nSlice) new_nSlice = newSlice + 1; // find max slice, to set new total number of slices
358  }
359  }
360  }
361  }
362  m_nSlices.value() = new_nSlice;
363  ATH_MSG_INFO("These slices were further divided based on the key layer 2: '" << key2 << "'. Now nSlices = " << m_nSlices.value());
364  ATH_MSG_INFO("Using " << m_usedTracks.size() << " tracks out of " << m_maxEvents << ". The rest were missing a hit in one or both of the key layers");
365  }
366 
367 
368  // 1D key layer slicing
369  else
370  {
371  for (const FPGATrackSimHit& hit: allHits) // Fill the track to slice map
372  {
373  if (m_usedTracks.find(hit.getEventIndex()) != m_usedTracks.end()) continue; // skip if already done a hit from this track
374  if (isOnKeyLayer(1,hit.getDetType(),hit.getDetectorZone(), hit.getPhysLayer()))
375  { // if hit is in key layer, add it's barcode to the map
376  if (keymod2slice.count(hit.getEtaModule()) > 0) {
377  int s = keymod2slice[hit.getEtaModule()];
378  m_track2slice[hit.getEventIndex()] = s;
379  m_usedTracks.insert(hit.getEventIndex());
380  }
381  }
382  }
383  ATH_MSG_INFO("Using " << m_usedTracks.size() << " tracks out of " << m_maxEvents << ". The rest missed the key layer");
384  }
385 
386  std::stringstream trim;
387  std::stringstream gtrim;
388  trim << std::fixed << std::setprecision(3) << m_trim;
389  gtrim << std::fixed << std::setprecision(3) << m_globalTrim;
390  std::string str_trim = trim.str();
391  std::string str_gtrim = gtrim.str();
392  int dot = str_trim.find_last_of(".");
393  str_trim.replace(dot,1,"p");
394  str_gtrim.replace(str_gtrim.find_last_of("."), 1, "p");
395 
396  std::string subrmap_path = m_outFileName.value() + "region" + std::to_string(m_region) + "_" + key + "_" + key2 + "_trim" + str_trim + "_gtrim" + str_gtrim + "_NSlices-" + std::to_string(m_nSlices.value()) + ".rmap";
397 
398  ATH_MSG_INFO("Creating subrmap: " << subrmap_path);
399  m_subrmap.open(subrmap_path, std::ofstream::out);
400  m_subrmap << "towers " << m_nSlices.value() << " phi 16\n\n";
401 
402  // Resize numTracks vector to be equal to the number of slices
403  // Now that this just stores module pointers we could loop over m_modules instead.
404  for (auto& pair: m_track2modules) {
405  for (Module* m: pair.second) {
406  if (m->numTracks.empty()) {
407  m->numTracks.resize(m_nSlices.value(), 0);
408  }
409  }
410  }
411 
412 
413  // Count tracks per slice
414  ATH_MSG_INFO("Counting number of tracks per slice.");
415  std::vector<std::vector<int>> slicedTracks (m_nSlices.value()); // vector of tracks, indexed by slice
416  for (auto trk: m_usedTracks) {
417  int s = m_track2slice[trk];
418  slicedTracks[s].push_back(trk);
419  std::vector<Module*> mods = m_track2modules[trk];
420  for (Module* mod: mods) {
421  mod->numTracks[s]++;
422  }
423  }
424 
425  if (m_drawSlices)
426  drawSlices(allHits);
427 
428  // Now do trimming and Fill slice2module map
429  int trimmed = 0;
430  for (int s = 0; s < m_nSlices.value(); s++) {
431  ATH_MSG_INFO("Applying local trimming in slice " << s);
432  for (auto trk : slicedTracks[s]) {
433  auto it = std::remove_if (m_track2modules[trk].begin(),
434  m_track2modules[trk].end(),
435  [&] (const Module* m) {
436  return 100 * ( float(m->numTracks[s]) / float(slicedTracks[s].size()) ) < m_trim;
437  });
438  trimmed += m_track2modules[trk].end() - it;
439  m_track2modules[trk].erase (it, m_track2modules[trk].end());
440 
441  ATH_MSG_DEBUG("About to query trk2slice");
442  int s = m_track2slice[trk];
443  ATH_MSG_DEBUG("Queried trk2slice.");
444  // add all modules from track to slices
445  if (m_track2modules[trk].size() > 0) {
446  ATH_MSG_DEBUG("About to insert trk2modules");
448  ATH_MSG_DEBUG("Inserted trk2modules.");
449  }
450  }
451  }
452  ATH_MSG_INFO("Trimmed off " << trimmed << " modules that were hit by less than " << m_trim << "% of tracks");
453 
454  /* ---------- Print z-slice map ---------- */
455 
456  for (int s = 0; s < m_nSlices.value(); s++)
457  {
458  m_subrmap << s << "\n";
462 
466  m_subrmap << "\n\n";
467  }
468 
469  m_subrmap.close();
470  return StatusCode::SUCCESS;
471 }
472 
474 {
475  std::stringstream trim;
476  std::stringstream gtrim;
477  trim << std::fixed << std::setprecision(3) << m_trim;
478  gtrim << std::fixed << std::setprecision(3) << m_globalTrim;
479  std::string str_trim = trim.str();
480  std::string str_gtrim = gtrim.str();
481  int dot = str_trim.find_last_of(".");
482  str_trim.replace(dot,1,"p");
483  str_gtrim.replace(str_gtrim.find_last_of("."), 1, "p");
484 
485  std::string slicingType = "";
486  if (m_key2) slicingType = "2D";
487  std::string etapat_path = m_outFileName.value() + "region" + std::to_string(m_region) + "_trim" + str_trim + + "_gtrim" + str_gtrim + "_NSlices-" + std::to_string(m_nSlices.value()) + slicingType + "_etapatterns.patt";
488 
489  ATH_MSG_INFO("Creating eta patterns file: " << etapat_path);
490  m_etapat.open(etapat_path, std::ofstream::out);
491 
492  // assign logical layer to each module
493  for (auto& pair: m_track2modules) {
494  for (auto& m: pair.second)
495  {
496  if (m->det == SiliconTech::pixel && m->bec == DetectorZone::barrel) m->plane = findPlane(m_planes->at(m_region), "pb" + std::to_string(m->lyr));
497  if (m->det == SiliconTech::pixel && m->bec == DetectorZone::posEndcap) m->plane = findPlane(m_planes->at(m_region), "pe" + std::to_string(m->lyr) + "+");
498  if (m->det == SiliconTech::pixel && m->bec == DetectorZone::negEndcap) m->plane = findPlane(m_planes->at(m_region), "pe" + std::to_string(m->lyr) + "-");
499 
500  if (m->det == SiliconTech::strip && m->bec == DetectorZone::barrel) m->plane = findPlane(m_planes->at(m_region), "sb" + std::to_string(m->lyr));
501  if (m->det == SiliconTech::strip && m->bec == DetectorZone::posEndcap) m->plane = findPlane(m_planes->at(m_region), "se" + std::to_string(m->lyr) + "+");
502  if (m->det == SiliconTech::strip && m->bec == DetectorZone::negEndcap) m->plane = findPlane(m_planes->at(m_region), "se" + std::to_string(m->lyr) + "-");
503  }
504  }
505 
506  for(auto trk: m_usedTracks)
507  {
508  std::stringstream track_etapatts;
509  unsigned planesDone = 0;
510  for (unsigned p = 0; p < (m_planes->at(m_region)).size(); p++)
511  {
512  for (const Module* m : m_track2modules[trk]) {
513  if (m->plane == static_cast<int>(p))
514  {
515  track_etapatts << std::to_string(static_cast<int>(m->det)) << "\t" << std::to_string(static_cast<int>(m->bec)) << "\t" << std::to_string(m->eta) << "\t\t";
516  planesDone++;
517  break;
518  }
519  }
520  }
521  if (planesDone == (m_planes->at(m_region)).size())
522  m_etapat << track_etapatts.str() << "\n";
523 
524  }
525  m_etapat.close();
526  return StatusCode::SUCCESS;
527 }
528 
529 StatusCode FPGATrackSimMapMakerAlg::writeRadiiFile(std::vector<FPGATrackSimHit> const & allHits)
530 {
531  // calculate mean radii.
532  m_radii.resize(m_nSlices.value(), std::vector<std::vector<float>>(m_planes->at(m_region).size(),std::vector<float>(0)));
533  for (const auto& hit: allHits)
534  {
535  SiliconTech det = hit.getDetType();
536  DetectorZone bec = hit.getDetectorZone();
537  int lyr = hit.getPhysLayer();
538  int slice = m_track2slice[hit.getEventIndex()];
539  int plane = -1;
540  if (det == SiliconTech::pixel && bec == DetectorZone::barrel) plane = findPlane(m_planes->at(m_region), "pb" + std::to_string(lyr));
541  if (det == SiliconTech::pixel && bec == DetectorZone::posEndcap) plane = findPlane(m_planes->at(m_region), "pe" + std::to_string(lyr) + "+");
542  if (det == SiliconTech::pixel && bec == DetectorZone::negEndcap) plane = findPlane(m_planes->at(m_region), "pe" + std::to_string(lyr) + "-");
543  if (det == SiliconTech::strip && bec == DetectorZone::barrel) plane = findPlane(m_planes->at(m_region), "sb" + std::to_string(lyr));
544  if (det == SiliconTech::strip && bec == DetectorZone::posEndcap) plane = findPlane(m_planes->at(m_region), "se" + std::to_string(lyr) + "+");
545  if (det == SiliconTech::strip && bec == DetectorZone::negEndcap) plane = findPlane(m_planes->at(m_region), "se" + std::to_string(lyr) + "-");
546 
547  if (plane != -1) {
548  m_radii[slice][plane].push_back(hit.getR());
549  }
550  }
551 
552  // print file
553  std::string radii_path = m_outFileName.value() + "region" + std::to_string(m_region) + "_NSlices-" + std::to_string(m_nSlices.value()) + "_MeanRadii.txt";
554  ATH_MSG_INFO("Creating radii file: " << radii_path);
555  m_radfile.open(radii_path, std::ofstream::out);
556  for (int s = 0; s < m_nSlices.value(); s++){
557  m_radfile << std::to_string(s) << " ";
558  for (unsigned p = 0; p < (m_planes->at(m_region)).size(); p++){
559  if (m_radii[s][p].size() != 0){
560  // "If left to type inference, op operates on values of the same type as
561  // init which can result in unwanted casting of the iterator elements."
562  // https://en.cppreference.com/w/cpp/algorithm/accumulate
563  float avg = std::accumulate(m_radii[s][p].begin(), m_radii[s][p].end(), 0.0f) / float(m_radii[s][p].size());
564  m_radfile << std::setprecision(3) << std::fixed << avg << " ";
565  } else {
566  int avg = -1;
567  m_radfile << avg << " ";
568  }
569  }
570  m_radfile << "\n";
571  }
572 
573  // Calculate global mean radii by reversing the order of the above two loops.
574  m_radfile << -1 << " ";
575  for (unsigned p = 0; p < (m_planes->at(m_region)).size(); p++) {
576  float avg = 0;
577  int count = 0;
578  for (int s = 0; s < m_nSlices.value(); s++) {
579  if (m_radii[s][p].size() != 0) {
581  count += m_radii[s][p].size();
582  }
583  }
584  if (count > 0) {
585  avg /= float(count);
586  m_radfile << std::setprecision(3) << std::fixed << avg << " ";
587  } else {
588  m_radfile << -1 << " ";
589  }
590  }
591  m_radfile << std::endl;
592 
593  m_radfile.close();
594 
595  return StatusCode::SUCCESS;
596 }
597 
598 StatusCode FPGATrackSimMapMakerAlg::writeMedianZFile(std::vector<FPGATrackSimHit> const & allHits)
599 {
600  // calculate median z. We do this globally and slice-by-slice.
601  m_z.resize(m_nSlices.value(), std::vector<std::vector<float>>((m_planes->at(m_region)).size(),std::vector<float>(0)));
602  for (const auto& hit: allHits)
603  {
604  SiliconTech det = hit.getDetType();
605  DetectorZone bec = hit.getDetectorZone();
606  int lyr = hit.getPhysLayer();
607  int slice = m_track2slice[hit.getEventIndex()];
608  int plane = -1;
609  if (det == SiliconTech::pixel && bec == DetectorZone::barrel) plane = findPlane(m_planes->at(m_region), "pb" + std::to_string(lyr));
610  if (det == SiliconTech::pixel && bec == DetectorZone::posEndcap) plane = findPlane(m_planes->at(m_region), "pe" + std::to_string(lyr) + "+");
611  if (det == SiliconTech::pixel && bec == DetectorZone::negEndcap) plane = findPlane(m_planes->at(m_region), "pe" + std::to_string(lyr) + "-");
612  if (det == SiliconTech::strip && bec == DetectorZone::barrel) plane = findPlane(m_planes->at(m_region), "sb" + std::to_string(lyr));
613  if (det == SiliconTech::strip && bec == DetectorZone::posEndcap) plane = findPlane(m_planes->at(m_region), "se" + std::to_string(lyr) + "+");
614  if (det == SiliconTech::strip && bec == DetectorZone::negEndcap) plane = findPlane(m_planes->at(m_region), "se" + std::to_string(lyr) + "-");
615 
616  if (plane != -1) {
617  m_z[slice][plane].push_back(hit.getZ());
618  }
619  }
620 
621  // print file
622  std::string zed_path = m_outFileName.value() + "region" + std::to_string(m_region) + "_NSlices-" + std::to_string(m_nSlices.value()) + "_MedianZ.txt";
623  ATH_MSG_INFO("Creating median z file: " << zed_path);
624  m_zedfile.open(zed_path, std::ofstream::out);
625  for (int s = 0; s < m_nSlices.value(); s++){
626  m_zedfile << std::to_string(s) << " ";
627  for (unsigned p = 0; p < (m_planes->at(m_region)).size(); p++){
628  if (m_z[s][p].size() != 0){
629  float minZ = *std::min_element(m_z[s][p].begin(), m_z[s][p].end());
630  float maxZ = *std::max_element(m_z[s][p].begin(), m_z[s][p].end());
631  float median = (minZ + maxZ)/2;
632  m_zedfile << std::setprecision(3) << std::fixed << median << " ";
633  } else {
634  int median = -1;
635  m_zedfile << median << " ";
636  }
637  }
638  m_zedfile << std::endl;
639  }
640 
641  // Now do this globally. Note: should this be meanZ instead of medianZ in the forward region?
642  m_zedfile << -1 << " ";
643  for (unsigned p = 0; p < (m_planes->at(m_region)).size(); p++) {
644  float minZ = 0;
645  float maxZ = 0;
646  bool doneInitial = false;
647  for (int s = 0; s < m_nSlices.value(); s++) {
648  if (m_z[s][p].size() != 0) {
649  float newMinZ = *std::min_element(m_z[s][p].begin(), m_z[s][p].end());
650  float newMaxZ = *std::max_element(m_z[s][p].begin(), m_z[s][p].end());
651  // slightly clunky, but z can be positive and negative so there's not a sane initial/placeholder value.
652  if (doneInitial) {
653  minZ = std::min(minZ, newMinZ);
654  maxZ = std::max(maxZ, newMaxZ);
655  } else {
656  minZ = newMinZ;
657  maxZ = newMaxZ;
658  doneInitial = true;
659  }
660  }
661  }
662  if (doneInitial) {
663  float median = (minZ + maxZ)/2;
664  m_zedfile << std::setprecision(3) << std::fixed << median << " ";
665  } else {
666  int median = -1;
667  m_zedfile << median << " ";
668  }
669  }
670  m_zedfile << std::endl;
671 
672  m_zedfile.close();
673 
674  return StatusCode::SUCCESS;
675 }
677 // Finalize
679 {
680  // Write the output
686  delete m_monitorFile;
687  m_monitorFile = nullptr;
688  delete m_moduleRelabel;
689  m_moduleRelabel = nullptr;
690  return StatusCode::SUCCESS;
691 }
692 
693 
695 // Helpers
696 
697 void FPGATrackSimMapMakerAlg::drawSlices(std::vector<FPGATrackSimHit> const & allHits)
698 {
699  m_monitorFile->cd();
700 
701  std::vector<TH2F*> h_slicemap;
702  char *hname = new char[20];
703 
704  for (unsigned i = 0; i < (unsigned)m_nSlices.value(); i++)
705  {
706  sprintf(hname,"rz_slice%u",i);
707  // This should just default to the entire range, I think.
708  // The user can reduce the binning.
709  TH2F *h = new TH2F(hname,hname,7000,-3500,3500,1200,0,1200);
710  h_slicemap.push_back(h);
711  }
712 
713  for (const auto& hit: allHits)
714  {
715  if (m_usedTracks.find(hit.getEventIndex()) == m_usedTracks.end()) continue; // skip if we don't use this track
716  int s = m_track2slice[hit.getEventIndex()];
717  h_slicemap[s]->Fill(hit.getZ(),hit.getR());
718  }
719 
720  for (int i = 0; i < m_nSlices.value(); i++)
721  h_slicemap[i]->Write();
722 
723  delete [] hname;
724 }
725 
726 bool FPGATrackSimMapMakerAlg::isOnKeyLayer(int keynum, SiliconTech t_det, DetectorZone t_bec, int lyr)
727 {
728  int det = static_cast<int>(t_det);
729  int bec = static_cast<int>(t_bec);
730  if (keynum == 1)
731  if (m_keylayer["det"].find(det) != m_keylayer["det"].end() && m_keylayer["bec"].find(bec) != m_keylayer["bec"].end() && m_keylayer["lyr"].find(lyr) != m_keylayer["lyr"].end())
732  return true;
733 
734  if (keynum == 2)
735  if (m_keylayer2["det"].find(det) != m_keylayer2["det"].end() && m_keylayer2["bec"].find(bec) != m_keylayer2["bec"].end() && m_keylayer2["lyr"].find(lyr) != m_keylayer2["lyr"].end())
736  return true;
737 
738  return false;
739 }
740 
741 int FPGATrackSimMapMakerAlg::findPlane(const std::vector<std::vector<std::string>>& planes, const std::string& test) // find what plane a layer is assigned to.
742 {
743  int pcounter = 0;
744  for (auto& plane : planes) {
745  for (auto& layer : plane) {
746  if (test == layer) return pcounter;
747  }
748  pcounter ++;
749  }
750  return -1;
751 }
752 
753 std::string FPGATrackSimMapMakerAlg::makeRmapLines(std::vector<FPGATrackSimHit> const & hits, SiliconTech det, DetectorZone bec, int max)
754 {
755  std::stringstream rmap_line;
756  std::set<int> etas, phis;
757 
758  for(int lyr = 0; lyr <= max; lyr++)
759  {
760  etas.clear();
761  phis.clear();
762  for (const auto& hit: hits)
763  {
764  if(static_cast<int>(hit.getPhysLayer()) == lyr && hit.getDetectorZone() == bec) // cast from uint to int just to remove Wsign-compare warnings
765  {
766  etas.insert(hit.getEtaModule());
767  phis.insert(hit.getPhiModule());
768  }
769  }
770  if (etas.size() != 0) rmap_line << static_cast<int>(det) << " " << static_cast<int>(bec) << " " << lyr << " " << *phis.begin() << " " << *phis.rbegin() << " " << phis.size() << " " << *etas.begin() << " " << *etas.rbegin() << " " << etas.size() << "\n";
771  else rmap_line << static_cast<int>(det) << " " << static_cast<int>(bec) << " " << lyr << " 0 0 0 0 0 0\n";
772 
773  }
774 
775  return rmap_line.str();
776 }
777 
779 {
780  // Parse keystring and define the Key Layer
781  std::string delimiter = ",";
782  std::string s = m_keystring.value();
783  std::string det, bec, lyr;
784  std::map <std::string, std::vector<std::string>> abrevs = { {"pb",{"pixel","barrel"}}, {"pe",{"pixel","endcap"}}, {"sb",{"strip","barrel"}}, {"se",{"strip","endcap"}} };
785  if( s.find(delimiter) != std::string::npos) // keylayer format is 'strip,barrel,4'
786  {
787  try {
788  std::string det = s.substr(0, s.find(delimiter));
789  s.erase(0, s.find(delimiter) + delimiter.length());
790  std::string bec = s.substr(0, s.find(delimiter));
791  s.erase(0, s.find(delimiter) + delimiter.length());
792  std::string lyr = s.substr(0, s.find(delimiter));
793  s.erase(0, s.find(delimiter) + delimiter.length());
794  m_keylayer["det"].insert(static_cast<int>(m_det2tech[det]));
795  m_keylayer["bec"].insert(static_cast<int>(m_bec2zone[bec]));
796  m_keylayer["lyr"].insert(std::stoi(lyr));
797  } catch (...){
798  ATH_MSG_ERROR("Invalid KeyString: '" << m_keystring << "'." << "Accepted formats are 'strip,posEndcap,2', 'pixel,barrel,3', or 'plane 0'");
799  }
800  }
801  else // keylayer format is 'plane 0'
802  {
803  std::string delimiter = " ";
804  try {
805  s.erase(0, s.find(delimiter) + delimiter.length());
806  std::string plane = s.substr(0, s.find(delimiter));
807  std::vector<std::string> s = (m_planes->at(m_region))[std::stoi(plane)];
808  for (unsigned i = 0; i < s.size(); i++){
809  std::string reg = s[i].substr(0, 2);
810  std::vector<std::string> zone = abrevs[reg];
811  if (s[i].back() == '+') zone[1] = "posEndcap";
812  if (s[i].back() == '-') zone[1] = "negEndcap";
813  s[i].erase(std::remove(s[i].begin(), s[i].end(), '+'), s[i].end());
814  s[i].erase(std::remove(s[i].begin(), s[i].end(), '-'), s[i].end());
815  std::string lyr = s[i].substr(2);
816  m_keylayer["det"].insert(static_cast<int>(m_det2tech[zone[0]]));
817  m_keylayer["bec"].insert(static_cast<int>(m_bec2zone[zone[1]]));
818  m_keylayer["lyr"].insert(std::stoi(lyr));
819  }
820  } catch (...){
821  ATH_MSG_ERROR("Invalid KeyString: '" << m_keystring << "'." << "Accepted formats are 'strip,posEndcap,2', 'pixel,barrel,3', or 'plane 0'");
822  }
823  }
824 
825  // if 2D slicing
826  if (m_keystring2.value() != "")
827  {
828  m_key2 = true;
829  std::string s = m_keystring2.value();
830  if( s.find(delimiter) != std::string::npos) // keylayer format is 'strip,barrel,8'
831  {
832  try {
833  std::string det = s.substr(0, s.find(delimiter));
834  s.erase(0, s.find(delimiter) + delimiter.length());
835  std::string bec = s.substr(0, s.find(delimiter));
836  s.erase(0, s.find(delimiter) + delimiter.length());
837  std::string lyr = s.substr(0, s.find(delimiter));
838  s.erase(0, s.find(delimiter) + delimiter.length());
839  m_keylayer2["det"].insert(static_cast<int>(m_det2tech[det]));
840  m_keylayer2["bec"].insert(static_cast<int>(m_bec2zone[bec]));
841  m_keylayer2["lyr"].insert(std::stoi(lyr));
842  } catch (...){
843  ATH_MSG_ERROR("Invalid KeyString2: '" << m_keystring2 << "'." << "Accepted formats are 'strip,posEndcap,2', 'pixel,barrel,3', or 'plane 0'");
844  }
845  }
846  else // keylayer format is 'plane 0'
847  {
848  std::string delimiter = " ";
849  try {
850  s.erase(0, s.find(delimiter) + delimiter.length());
851  std::string plane = s.substr(0, s.find(delimiter));
852  std::vector<std::string> s = (m_planes->at(m_region))[std::stoi(plane)];
853  for (unsigned i = 0; i < s.size(); i++){
854  std::string reg = s[i].substr(0, 2);
855  std::vector<std::string> zone = abrevs[reg];
856  if (s[i].back() == '+') zone[1] = "posEndcap";
857  if (s[i].back() == '-') zone[1] = "negEndcap";
858  s[i].erase(std::remove(s[i].begin(), s[i].end(), '+'), s[i].end());
859  s[i].erase(std::remove(s[i].begin(), s[i].end(), '-'), s[i].end());
860  std::string lyr = s[i].substr(2);
861  m_keylayer2["det"].insert(static_cast<int>(m_det2tech[zone[0]]));
862  m_keylayer2["bec"].insert(static_cast<int>(m_bec2zone[zone[1]]));
863  m_keylayer2["lyr"].insert(std::stoi(lyr));
864  }
865  } catch (...){
866  ATH_MSG_ERROR("Invalid KeyString2: '" << m_keystring2 << "'." << "Accepted formats are 'strip,posEndcap,2', 'pixel,barrel,3', or 'plane 0'");
867  }
868  }
869  }
870 }
871 
872 std::string FPGATrackSimMapMakerAlg::makeSubrmapLines(std::vector<Module*> const & allmods, SiliconTech det, DetectorZone bec, int max)
873 {
874  std::stringstream subrmap_line;
875  std::set<int> etas, phis;
876 
877  std::vector<Module*> mods;
878  for (auto* mod: allmods) // just want modules in pb/pe/sb/se etc, not all at once
879  if (mod->det == det && mod->bec == bec) mods.push_back(mod);
880 
881  for(int lyr = 0; lyr <= max; lyr++)
882  {
883  etas.clear();
884  phis.clear();
885  for (auto mod: mods)
886  {
887  if(mod->lyr == lyr)
888  {
889  etas.insert(mod->eta);
890  phis.insert(mod->phi);
891  }
892  }
893  if (etas.size() != 0) subrmap_line << static_cast<int>(det) << " " << static_cast<int>(bec) << " " << lyr << " " << *phis.begin() << " " << *phis.rbegin() << " " << phis.size() << " " << *etas.begin() << " " << *etas.rbegin() << " " << etas.size() << "\n";
894  else subrmap_line << static_cast<int>(det) << " " << static_cast<int>(bec) << " " << lyr << " 0 0 0 0 0 0\n";
895 
896  }
897 
898  return subrmap_line.str();
899 }
FPGATrackSimMapMakerAlg::m_planes_default
const std::vector< std::vector< std::vector< std::string > > > m_planes_default
Definition: FPGATrackSimMapMakerAlg.h:115
FPGATrackSimMapMakerAlg::m_subrmap
std::ofstream m_subrmap
Definition: FPGATrackSimMapMakerAlg.h:223
FPGATrackSimMapMakerAlg::m_rmap
std::ofstream m_rmap
Definition: FPGATrackSimMapMakerAlg.h:223
FPGATrackSimMapMakerAlg::makeSubrmapLines
std::string makeSubrmapLines(std::vector< Module * > const &allmods, SiliconTech det, DetectorZone bec, int max)
Definition: FPGATrackSimMapMakerAlg.cxx:872
FPGATrackSimMapMakerAlg::m_description
Gaudi::Property< std::string > m_description
Definition: FPGATrackSimMapMakerAlg.h:86
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
FPGATrackSimMapMakerAlg::m_track2modules
std::map< int, std::vector< Module * > > m_track2modules
Definition: FPGATrackSimMapMakerAlg.h:96
checkFileSG.line
line
Definition: checkFileSG.py:75
FPGATrackSimEventInputHeader::hits
const std::vector< FPGATrackSimHit > & hits() const
Definition: FPGATrackSimEventInputHeader.h:36
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
SiliconTech::strip
@ strip
FPGATrackSimMapMakerAlg::m_outFileName
Gaudi::Property< std::string > m_outFileName
Definition: FPGATrackSimMapMakerAlg.h:80
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
max
#define max(a, b)
Definition: cfImp.cxx:41
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
FPGATrackSimMapMakerAlg::m_maxEvents
Gaudi::Property< int > m_maxEvents
Definition: FPGATrackSimMapMakerAlg.h:77
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FPGATrackSimMapMakerAlg::m_monitorFile
TFile * m_monitorFile
Definition: FPGATrackSimMapMakerAlg.h:224
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
FPGATrackSimMapMakerAlg::drawSlices
void drawSlices(std::vector< FPGATrackSimHit > const &allHits)
Definition: FPGATrackSimMapMakerAlg.cxx:697
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
FPGATrackSimMapMakerAlg::m_planes_sp
const std::vector< std::vector< std::vector< std::string > > > m_planes_sp
Definition: FPGATrackSimMapMakerAlg.h:147
trim
std::string trim(const std::string &str, const std::string &whitespace=" \t")
Definition: BTaggingTruthTaggingTool.cxx:1149
TH2F
Definition: rootspy.cxx:420
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:272
FPGATrackSimMapMakerAlg::initialize
StatusCode initialize() override
Definition: FPGATrackSimMapMakerAlg.cxx:24
DetectorZone::posEndcap
@ posEndcap
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
FPGATrackSimMapMakerAlg::isOnKeyLayer
bool isOnKeyLayer(int keynum, SiliconTech det, DetectorZone bec, int lyr)
Definition: FPGATrackSimMapMakerAlg.cxx:726
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
FPGATrackSimMapMakerAlg::m_globalTrim
Gaudi::Property< float > m_globalTrim
Definition: FPGATrackSimMapMakerAlg.h:85
FPGATrackSimMapMakerAlg::m_sbHits
std::vector< FPGATrackSimHit > m_sbHits
Definition: FPGATrackSimMapMakerAlg.h:100
FPGATrackSimMapMakerAlg::m_det2tech
std::map< std::string, SiliconTech > m_det2tech
Definition: FPGATrackSimMapMakerAlg.h:239
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
skel.it
it
Definition: skel.GENtoEVGEN.py:423
FPGATrackSimMapMakerAlg::findPlane
int findPlane(const std::vector< std::vector< std::string >> &planes, const std::string &test)
Definition: FPGATrackSimMapMakerAlg.cxx:741
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
FPGATrackSimMapMakerAlg::readInputs
StatusCode readInputs(bool &done)
Definition: FPGATrackSimMapMakerAlg.cxx:95
InDet::median
float median(std::vector< float > &Vec)
Definition: BTagVrtSec.cxx:35
FPGATrackSimMapMakerAlg::m_eventHeader
FPGATrackSimEventInputHeader m_eventHeader
Definition: FPGATrackSimMapMakerAlg.h:47
FPGATrackSimMapMakerAlg::m_hitInputTool
ToolHandle< IFPGATrackSimEventInputHeaderTool > m_hitInputTool
Definition: FPGATrackSimMapMakerAlg.h:45
FPGATrackSimMapMakerAlg::m_pbHits
std::vector< FPGATrackSimHit > m_pbHits
Definition: FPGATrackSimMapMakerAlg.h:100
FPGATrackSimMapMakerAlg::m_pmap
std::ofstream m_pmap
Definition: FPGATrackSimMapMakerAlg.h:223
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:144
FPGATrackSimMapMakerAlg::m_peHits
std::vector< FPGATrackSimHit > m_peHits
Definition: FPGATrackSimMapMakerAlg.h:100
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
python.DomainsRegistry.reg
reg
globals -----------------------------------------------------------------—
Definition: DomainsRegistry.py:343
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
FPGATrackSimMapMakerAlg::m_pbmax
int m_pbmax
Definition: FPGATrackSimMapMakerAlg.h:102
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
FPGATrackSimMapMakerAlg::writePmapAndRmap
StatusCode writePmapAndRmap(std::vector< FPGATrackSimHit > const &pbHits, std::vector< FPGATrackSimHit > const &peHits, std::vector< FPGATrackSimHit > const &sbHits, std::vector< FPGATrackSimHit > const &seHits, int region)
Definition: FPGATrackSimMapMakerAlg.cxx:177
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
FPGATrackSimMapMakerAlg::m_track2slice
std::map< int, int > m_track2slice
Definition: FPGATrackSimMapMakerAlg.h:97
module_driven_slicing.key2
key2
Definition: module_driven_slicing.py:159
FPGATrackSimHit
Definition: FPGATrackSimHit.h:38
FPGATrackSimMapMakerAlg::m_keylayer2
std::map< std::string, std::set< int > > m_keylayer2
Definition: FPGATrackSimMapMakerAlg.h:214
FPGATrackSimMapMakerAlg::writeRadiiFile
StatusCode writeRadiiFile(std::vector< FPGATrackSimHit > const &allHits)
Definition: FPGATrackSimMapMakerAlg.cxx:529
FPGATrackSimMapMakerAlg::m_key_etamods
std::map< int, int > m_key_etamods
Definition: FPGATrackSimMapMakerAlg.h:217
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
CaloSwCorrections.etamod
def etamod(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:206
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
FPGATrackSimMapMakerAlg::m_sbmax
int m_sbmax
Definition: FPGATrackSimMapMakerAlg.h:103
FPGATrackSimEventInfo
Definition: FPGATrackSimEventInfo.h:14
FPGATrackSimMapMakerAlg::m_usedTracks
std::set< int > m_usedTracks
Definition: FPGATrackSimMapMakerAlg.h:219
python.AthDsoLogger.delimiter
delimiter
Definition: AthDsoLogger.py:71
FPGATrackSimMapMakerAlg::m_planes2
const std::vector< std::vector< std::vector< std::string > > > m_planes2
Definition: FPGATrackSimMapMakerAlg.h:185
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
FPGATrackSimMapMakerAlg::m_keystring2
Gaudi::Property< std::string > m_keystring2
Definition: FPGATrackSimMapMakerAlg.h:82
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
perfmonmt-refit.slice
slice
Definition: perfmonmt-refit.py:52
FPGATrackSimMapMakerAlg::m_zedfile
std::ofstream m_zedfile
Definition: FPGATrackSimMapMakerAlg.h:223
SiliconTech
SiliconTech
Definition: FPGATrackSimTypes.h:25
FPGATrackSimMapMakerAlg::makeRmapLines
std::string makeRmapLines(std::vector< FPGATrackSimHit > const &hits, SiliconTech det, DetectorZone bec, int max)
Definition: FPGATrackSimMapMakerAlg.cxx:753
lumiFormat.i
int i
Definition: lumiFormat.py:92
FPGATrackSimMapMakerAlg::m_etapat
std::ofstream m_etapat
Definition: FPGATrackSimMapMakerAlg.h:223
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Recovery.avg
def avg(a, b)
Definition: Recovery.py:79
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
WritePulseShapeToCool.det
det
Definition: WritePulseShapeToCool.py:204
FPGATrackSimMapMakerAlg::m_radii
std::vector< std::vector< std::vector< float > > > m_radii
Definition: FPGATrackSimMapMakerAlg.h:220
FPGATrackSimMapMakerAlg::m_drawSlices
Gaudi::Property< bool > m_drawSlices
Definition: FPGATrackSimMapMakerAlg.h:89
FPGATrackSimModuleRelabel.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FPGATrackSimMapMakerAlg::m_keylayer
std::map< std::string, std::set< int > > m_keylayer
Definition: FPGATrackSimMapMakerAlg.h:213
FPGATrackSimMapMakerAlg::writeEtaPatterns
StatusCode writeEtaPatterns()
Definition: FPGATrackSimMapMakerAlg.cxx:473
FPGATrackSimMapMakerAlg::m_nSlices
Gaudi::Property< int > m_nSlices
Definition: FPGATrackSimMapMakerAlg.h:83
FPGATrackSimMapMakerAlg::m_remapModules
Gaudi::Property< bool > m_remapModules
Definition: FPGATrackSimMapMakerAlg.h:88
AthAlgorithm
Definition: AthAlgorithm.h:47
FPGATrackSimEventInputHeader::event
FPGATrackSimEventInfo const & event() const
Definition: FPGATrackSimEventInputHeader.h:32
FPGATrackSimMapMakerAlg::m_bec2zone
std::map< std::string, DetectorZone > m_bec2zone
Definition: FPGATrackSimMapMakerAlg.h:240
min
#define min(a, b)
Definition: cfImp.cxx:40
FPGATrackSimMapMakerAlg::m_keystring
Gaudi::Property< std::string > m_keystring
Definition: FPGATrackSimMapMakerAlg.h:81
FPGATrackSimMapMakerAlg::m_key_etamods2
std::set< int > m_key_etamods2
Definition: FPGATrackSimMapMakerAlg.h:218
FPGATrackSimMapMakerAlg::Module
Definition: FPGATrackSimMapMakerAlg.h:49
python.draw_obj.zone
def zone(nx, ny)
Definition: draw_obj.py:288
FPGATrackSimMapMakerAlg::writeMedianZFile
StatusCode writeMedianZFile(std::vector< FPGATrackSimHit > const &allHits)
Definition: FPGATrackSimMapMakerAlg.cxx:598
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
FPGATrackSimMapMakerAlg::m_z
std::vector< std::vector< std::vector< float > > > m_z
Definition: FPGATrackSimMapMakerAlg.h:221
FPGATrackSimMapMakerAlg::m_key2
bool m_key2
Definition: FPGATrackSimMapMakerAlg.h:216
FPGATrackSimMapMakerAlg::m_trim
Gaudi::Property< float > m_trim
Definition: FPGATrackSimMapMakerAlg.h:79
FPGATrackSimMapMakerAlg::m_doSpacePoints
Gaudi::Property< bool > m_doSpacePoints
Definition: FPGATrackSimMapMakerAlg.h:84
FPGATrackSimMapMakerAlg::FPGATrackSimMapMakerAlg
FPGATrackSimMapMakerAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: FPGATrackSimMapMakerAlg.cxx:18
FPGATrackSimMapMakerAlg::finalize
StatusCode finalize() override
Definition: FPGATrackSimMapMakerAlg.cxx:678
FPGATrackSimMapMakerAlg::m_geoTag
Gaudi::Property< std::string > m_geoTag
Definition: FPGATrackSimMapMakerAlg.h:87
DetectorZone::negEndcap
@ negEndcap
FPGATrackSimMapMakerAlg::m_seHits
std::vector< FPGATrackSimHit > m_seHits
Definition: FPGATrackSimMapMakerAlg.h:100
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
FPGATrackSimMapMakerAlg::m_modules
std::map< FPGATrackSimModuleId, Module > m_modules
Definition: FPGATrackSimMapMakerAlg.h:95
DetectorZone
DetectorZone
Definition: FPGATrackSimTypes.h:28
FPGATrackSimMapMakerAlg::m_moduleRelabel
FPGATrackSimModuleRelabel * m_moduleRelabel
Definition: FPGATrackSimMapMakerAlg.h:92
FPGATrackSimMapMakerAlg::m_semax
std::vector< int > m_semax
Definition: FPGATrackSimMapMakerAlg.h:105
h
IFPGATrackSimEventOutputHeaderTool.h
FPGATrackSimMapMakerAlg::m_pemax
std::vector< int > m_pemax
Definition: FPGATrackSimMapMakerAlg.h:104
FPGATrackSimMapMakerAlg::m_radfile
std::ofstream m_radfile
Definition: FPGATrackSimMapMakerAlg.h:223
FPGATrackSimMapMakerAlg::writeSubrmap
StatusCode writeSubrmap(std::vector< FPGATrackSimHit > const &allHits)
Definition: FPGATrackSimMapMakerAlg.cxx:252
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
FPGATrackSimMapMakerAlg::m_region
Gaudi::Property< int > m_region
Definition: FPGATrackSimMapMakerAlg.h:78
DetectorZone::barrel
@ barrel
dot
Definition: dot.py:1
FPGATrackSimMapMakerAlg::m_allHits
std::vector< FPGATrackSimHit > m_allHits
Definition: FPGATrackSimMapMakerAlg.h:100
FPGATrackSimEventInputHeader::reset
void reset()
Definition: FPGATrackSimEventInputHeader.cxx:15
FPGATrackSimMapMakerAlg.h
FPGATrackSimMapMakerAlg::parseKeyString
void parseKeyString()
Definition: FPGATrackSimMapMakerAlg.cxx:778
FPGATrackSimMapMakerAlg::m_slice2modules
std::map< int, std::vector< Module * > > m_slice2modules
Definition: FPGATrackSimMapMakerAlg.h:96
FPGATrackSimModuleRelabel::remap
bool remap(FPGATrackSimHit &hit) const
Definition: FPGATrackSimModuleRelabel.cxx:25
readCCLHist.float
float
Definition: readCCLHist.py:83
EgEfficiencyCorr_testFixedInput.etas
list etas
Definition: EgEfficiencyCorr_testFixedInput.py:9
SiliconTech::pixel
@ pixel
FPGATrackSimMapMakerAlg::m_planes
const std::vector< std::vector< std::vector< std::string > > > * m_planes
Definition: FPGATrackSimMapMakerAlg.h:114
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
FPGATrackSimModuleRelabel
Definition: FPGATrackSimModuleRelabel.h:30
FPGATrackSimMapMakerAlg::execute
StatusCode execute() override
Definition: FPGATrackSimMapMakerAlg.cxx:67
module_driven_slicing.key1
key1
Definition: module_driven_slicing.py:158