ATLAS Offline Software
Loading...
Searching...
No Matches
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
9const LArCoudeAbsorbers* LArCoudeAbsorbers::GetInstance(const std::string& strDetector)
10{
11 static const LArCoudeAbsorbers instance(strDetector);
12 return &instance;
13}
14
15
16LArCoudeAbsorbers::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}
std::map< std::string, double > instance
LArCoudeAbsorbers(const std::string &strDetector="")
double m_xcent[1024][15]
double m_ycent[1024][15]
static const LArCoudeAbsorbers * GetInstance(const std::string &strDetector="")
double m_phirot[1024][15]
void SetPhysicalVolumeList(const std::string &)
const G4VPhysicalVolume * GetPhysicalVolume(int) const