ATLAS Offline Software
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 
5 #include "LArCoudeElectrodes.h"
7 
8 
9 const LArCoudeElectrodes* LArCoudeElectrodes::GetInstance(const std::string& strDetector)
10 {
11  static const LArCoudeElectrodes instance(strDetector);
12  return &instance;
13 }
14 
15 
16 LArCoudeElectrodes::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 }
PhysicalVolumeAccessor.h
LArCoudeElectrodes::GetInstance
static const LArCoudeElectrodes * GetInstance(const std::string &strDetector="")
Definition: LArCoudeElectrodes.cxx:9
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
LArCoudeElectrodes::m_xcent
double m_xcent[1024][15]
Definition: LArCoudeElectrodes.h:13
PhysicalVolumeAccessor
Definition: PhysicalVolumeAccessor.h:18
LArCoudeElectrodes::LArCoudeElectrodes
LArCoudeElectrodes(const std::string &strDetector="")
Definition: LArCoudeElectrodes.cxx:16
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
LArCoudeElectrodes
Definition: LArCoudeElectrodes.h:10
PhysicalVolumeAccessor::SetPhysicalVolumeList
void SetPhysicalVolumeList(const std::string &)
Definition: PhysicalVolumeAccessor.cxx:53
LArCoudeElectrodes.h
PhysicalVolumeAccessor::GetPhysicalVolume
const G4VPhysicalVolume * GetPhysicalVolume(int) const
Definition: PhysicalVolumeAccessor.cxx:42
LArCoudeElectrodes::m_ycent
double m_ycent[1024][15]
Definition: LArCoudeElectrodes.h:14
python.changerun.pv
pv
Definition: changerun.py:81
LArCoudeElectrodes::m_phirot
double m_phirot[1024][15]
Definition: LArCoudeElectrodes.h:15