ATLAS Offline Software
Loading...
Searching...
No Matches
LArCoudeElectrodes.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8
9const LArCoudeElectrodes* LArCoudeElectrodes::GetInstance(const std::string& strDetector)
10{
11 static const LArCoudeElectrodes instance(strDetector);
12 return &instance;
13}
14
15
16LArCoudeElectrodes::LArCoudeElectrodes(const std::string& strDetector)
17{
18 static const PhysicalVolumeAccessor theCoudes = [&]() {
19 const std::string prefix = strDetector.empty() ? "" : strDetector+"::";
20 PhysicalVolumeAccessor pva(prefix+"LAr::EMB::STAC",
21 prefix+"LAr::EMB::Electrode::CornerDownFold");
22 pva.SetPhysicalVolumeList(prefix+"LAr::EMB::Electrode::CornerUpFold");
23 return pva;
24 }();
25
26 for (int stackid=0; stackid<15; stackid++) {
27 for (int cellid=0; cellid<1024; cellid++) {
28 const int id=cellid+stackid*10000;
29 const G4VPhysicalVolume *pv=theCoudes.GetPhysicalVolume(id);
30 if (pv) {
31 const G4ThreeVector& tv=pv->GetTranslation();
32 m_xcent[cellid][stackid] = tv.x();
33 m_ycent[cellid][stackid] = tv.y();
34
35 // Calculate phirot
36 const G4RotationMatrix *rm=pv->GetRotation();
37 double alpha;
38 if (!rm) alpha=0.;
39 else alpha = rm->phiX();
40 // for down fold
41 if (pv->GetName().find("DownFold") != std::string::npos) alpha=alpha-3.14159;
42 // old way was assuming we start with a down fold if (stackid%2==0) alpha=alpha-3.14159;
43 m_phirot[cellid][stackid] = alpha;
44 }
45 }
46 }
47}
std::map< std::string, double > instance
double m_phirot[1024][15]
double m_xcent[1024][15]
static const LArCoudeElectrodes * GetInstance(const std::string &strDetector="")
double m_ycent[1024][15]
LArCoudeElectrodes(const std::string &strDetector="")
void SetPhysicalVolumeList(const std::string &)
const G4VPhysicalVolume * GetPhysicalVolume(int) const