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