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