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