ATLAS Offline Software
Loading...
Searching...
No Matches
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{
48 curr_map::iterator it=m_theMap.begin();
49 while (it != m_theMap.end()) {
50 delete (*it).second;
51 m_theMap.erase(it++);
52 }
53}
54
55const 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}
std::map< std::string, double > instance
static std::string find_directory(const std::string &logical_file_name, const std::string &search_path)
void Reset()
Definition PsMap.cxx:46
const CurrMap * GetMap(int module) const
Definition PsMap.cxx:55
PsMap()
Definition PsMap.cxx:12
curr_map m_theMap
Definition PsMap.h:24
static const PsMap * GetPsMap()
Definition PsMap.cxx:40