ATLAS Offline Software
PsMap.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "PsMap.h"
6 #include <iostream>
7 #include <sstream>
8 #ifndef LARG4_STAND_ALONE
10 #endif
11 
13 {
14 #ifndef LARG4_STAND_ALONE
15  //std::string larLocation = PathResolver::find_directory("lar","DATAPATH");
16  std::string larLocation = PathResolver::find_directory("LArG4Barrel","ATLASCALDATA");
17 #endif
18 
19  const double xnorm=15.9; // nA/MeV normalisation for PS maps
20 
21  for (int imap=0;imap<5;imap++) {
22  // accordion folds
23  std::ostringstream fn;
24  fn << "presampler_"<<imap<<".map";
25  std::string filename = fn.str();
26  std::string fileLocation;
27 #ifdef LARG4_STAND_ALONE
28  fileLocation=m_directory+"/"+filename;
29 #else
30  //fileLocation=larLocation+"/calo_data/"+filename;
31  fileLocation=larLocation+"/"+filename;
32 #endif
33  CurrMap* cm = new CurrMap(fileLocation,xnorm);
34  int code=imap;
35  m_theMap[code]=cm;
36  }
37 
38 }
39 
41 {
42  static const PsMap instance;
43  return &instance;
44 }
45 
47 {
49  while (it != m_theMap.end()) {
50  delete (*it).second;
51  m_theMap.erase(it++);
52  }
53 }
54 
55 const CurrMap* PsMap::GetMap(int module) const
56 {
57  // module 0 and 1 have their own maps (code = 0 and 1)
58  // module 2 and 3 have the same map (same geometry) with code 2
59  // module 4 and 5 have the same map (same geometry) with code 3
60  // module 6 and 7 have the same map (same geometry) with code 4
61  int code = -1;
62  if (module==0 || module==1) code=module;
63  if (module > 1 && module < 8) code=(module-2)/2 + 2;
64  auto it = m_theMap.find(code);
65  if (it != m_theMap.end())
66  return it->second;
67  else {
68  std::cout << " Code " << module << " not found in map ..." << std::endl;
69  return nullptr;
70  }
71 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
PsMap.h
skel.it
it
Definition: skel.GENtoEVGEN.py:396
PathResolver::find_directory
static std::string find_directory(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:307
PsMap::m_theMap
curr_map m_theMap
Definition: PsMap.h:24
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
python.PyAthena.module
module
Definition: PyAthena.py:131
PsMap::GetMap
const CurrMap * GetMap(int module) const
Definition: PsMap.cxx:55
histSizes.code
code
Definition: histSizes.py:129
python.getCurrentFolderTag.fn
fn
Definition: getCurrentFolderTag.py:65
CurrMap
Definition: CurrMap.h:10
PsMap::Reset
void Reset()
Definition: PsMap.cxx:46
PathResolver.h
PsMap::PsMap
PsMap()
Definition: PsMap.cxx:12
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
PsMap
Definition: PsMap.h:16
PsMap::GetPsMap
static const PsMap * GetPsMap()
Definition: PsMap.cxx:40