ATLAS Offline Software
Loading...
Searching...
No Matches
EndcapFastSimDedicatedSD Class Reference

NEEDS DOCUMENTATION. More...

#include <EndcapFastSimDedicatedSD.h>

Inheritance diagram for EndcapFastSimDedicatedSD:
Collaboration diagram for EndcapFastSimDedicatedSD:

Public Types

enum  LArHitTimeBins { HitTimeBinDefault = 0 , HitTimeBinUniform = 1 }

Public Member Functions

 EndcapFastSimDedicatedSD (StoreGateSvc *, std::string hitCollectionName, bool verbose)
 ~EndcapFastSimDedicatedSD ()
 EndcapFastSimDedicatedSD (const EndcapFastSimDedicatedSD &)=delete
EndcapFastSimDedicatedSDoperator= (const EndcapFastSimDedicatedSD &)=delete
void ProcessSpot (const EnergySpot &spot, double weight) override final
 ProcessHitsMethod.
void Initialize (G4HCofThisEvent *) override
 Register this regular SD with the event-owned builder.
G4bool ProcessHits (G4Step *a_step, G4TouchableHistory *) override
 Main processing method.
G4bool SimpleHit (const LArG4Identifier &lar_id, G4double time, G4double energy)
 First method translates to this - also for fast sims.
void setupHelpers (const LArEM_ID *EM, const LArFCAL_ID *FCAL, const LArHEC_ID *HEC)
 Sets the ID helper pointers.
Identifier ConvertID (const LArG4Identifier &a_ident) const
 Helper function for making "real" identifiers from LArG4Identifiers.

Protected Member Functions

G4int getTimeBin (G4double time) const
 Helper method for time info.
LArHitContainerBuildergetHitContainer () const

Protected Attributes

ILArCalculatorSvcm_calculator
 Member variable - the calculator we'll use.
G4int m_numberInvalidHits
 Count the number of invalid hits.
LArG4SimpleSD::LArHitTimeBins m_timeBinType
G4float m_timeBinWidth
 Width of the time bins for summing hits - for the uniform binning.
const LArEM_IDm_larEmID
 Pointers to the identifier helpers.
const LArFCAL_IDm_larFcalID
const LArHEC_IDm_larHecID

Private Member Functions

 FRIEND_TEST (LArG4SimpleSDtest, ProcessHits)
 FRIEND_TEST (LArG4SimpleSDtest, setupHelpers)
 FRIEND_TEST (LArG4SimpleSDtest, getTimeBin)
 FRIEND_TEST (LArG4SimpleSDtest, SimpleHit)
 FRIEND_TEST (LArG4SimpleSDtest, ConvertID)

Private Attributes

EMECDetectorManagerm_emecManager
LArWheelCalculatorm_innerWheelCalculatorPos
LArWheelCalculatorm_innerWheelCalculatorNeg
LArWheelCalculatorm_outerWheelCalculatorPos
LArWheelCalculatorm_outerWheelCalculatorNeg
LArG4Identifier m_larID
 My LAr identifier.
std::string m_hitCollectionName
std::string m_hitSourceName

Detailed Description

NEEDS DOCUMENTATION.

Definition at line 23 of file EndcapFastSimDedicatedSD.h.

Member Enumeration Documentation

◆ LArHitTimeBins

Enumerator
HitTimeBinDefault 
HitTimeBinUniform 

Definition at line 46 of file LArG4SimpleSD.h.

47 {
50 };

Constructor & Destructor Documentation

◆ EndcapFastSimDedicatedSD() [1/2]

EndcapFastSimDedicatedSD::EndcapFastSimDedicatedSD ( StoreGateSvc * detStore,
std::string hitCollectionName,
bool verbose )

Definition at line 38 of file EndcapFastSimDedicatedSD.cxx.

41 : IFastSimDedicatedSD("EndcapFastSimDedicatedSD", detStore,
42 std::move(hitCollectionName))
43 , m_emecManager(nullptr)
48{
49 if (verbose) { G4cout << GetName() << "::initialize()" << G4endl; }
50 if ( detStore->retrieve( m_emecManager ).isFailure() ){
51 throw std::runtime_error("Could not retrieve EMEC manager");
52 }
53
54
55
56 ISvcLocator* svcLocator = Gaudi::svcLocator();
57
58 // Access the GeoModelSvc:
59 SmartIF<IGeoModelSvc> geoModel{svcLocator->service ("GeoModelSvc")};
60 if ( !geoModel ) {
61 G4Exception(
62 "LArWheelSliceSolid", "AccessGeoModel", FatalException,
63 "createSolid cannot access GeoModelSvc");
64 }
65
66 SmartIF<IGeoDbTagSvc> geoDbTagSvc{svcLocator->service ("GeoDbTagSvc")};
67 if ( !geoDbTagSvc ) {
68 G4Exception(
69 "LArWheelSliceSolid", "AccessDbTagSvc", FatalException,
70 "createSolid cannot access DbTagSvc");
71 }
72
73 // Access the geometry database:
74 SmartIF<IRDBAccessSvc> pAccessSvc{svcLocator->service(geoDbTagSvc->getParamSvcName())};
75 if ( !pAccessSvc ) {
76 G4Exception(
77 "LArWheelSliceSolid", "AccessAccessSvc", FatalException,
78 "createSolid cannot access AccessSvc");
79 }
80
81 DecodeVersionKey larVersionKey(geoModel, "LAr");
82 EMECData emecData=toEMECData(pAccessSvc,larVersionKey);
83
84
85
86 m_innerWheelCalculatorPos = new LArWheelCalculator(emecData,LArG4::InnerAbsorberWheel,+1);
87 m_innerWheelCalculatorNeg = new LArWheelCalculator(emecData,LArG4::InnerAbsorberWheel,-1);
88 m_outerWheelCalculatorPos = new LArWheelCalculator(emecData,LArG4::OuterAbsorberWheel,+1);
89 m_outerWheelCalculatorNeg = new LArWheelCalculator(emecData,LArG4::OuterAbsorberWheel,-1);
90}
EMECDetectorManager * m_emecManager
LArWheelCalculator * m_innerWheelCalculatorNeg
LArWheelCalculator * m_outerWheelCalculatorNeg
LArWheelCalculator * m_outerWheelCalculatorPos
LArWheelCalculator * m_innerWheelCalculatorPos
IFastSimDedicatedSD(const std::string &name, StoreGateSvc *detStore, std::string hitCollectionName)
Simple constructor and destructor.
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
bool verbose
Definition hcg.cxx:75
EMECData toEMECData(IRDBAccessSvc *rdbAccess, const DecodeVersionKey &larVersionKey)
Definition toEMECData.h:13

◆ ~EndcapFastSimDedicatedSD()

EndcapFastSimDedicatedSD::~EndcapFastSimDedicatedSD ( )
inline

Definition at line 33 of file EndcapFastSimDedicatedSD.h.

33{}

◆ EndcapFastSimDedicatedSD() [2/2]

EndcapFastSimDedicatedSD::EndcapFastSimDedicatedSD ( const EndcapFastSimDedicatedSD & )
delete

Member Function Documentation

◆ ConvertID()

Identifier LArG4SimpleSD::ConvertID ( const LArG4Identifier & a_ident) const
inherited

Helper function for making "real" identifiers from LArG4Identifiers.

◆ FRIEND_TEST() [1/5]

LArG4SimpleSD::FRIEND_TEST ( LArG4SimpleSDtest ,
ConvertID  )
privateinherited

◆ FRIEND_TEST() [2/5]

LArG4SimpleSD::FRIEND_TEST ( LArG4SimpleSDtest ,
getTimeBin  )
privateinherited

◆ FRIEND_TEST() [3/5]

LArG4SimpleSD::FRIEND_TEST ( LArG4SimpleSDtest ,
ProcessHits  )
privateinherited

◆ FRIEND_TEST() [4/5]

LArG4SimpleSD::FRIEND_TEST ( LArG4SimpleSDtest ,
setupHelpers  )
privateinherited

◆ FRIEND_TEST() [5/5]

LArG4SimpleSD::FRIEND_TEST ( LArG4SimpleSDtest ,
SimpleHit  )
privateinherited

◆ getHitContainer()

LArHitContainerBuilder * LArG4SimpleSD::getHitContainer ( ) const
protectedinherited

◆ getTimeBin()

G4int LArG4SimpleSD::getTimeBin ( G4double time) const
protectedinherited

Helper method for time info.

◆ Initialize()

void LArG4SimpleSD::Initialize ( G4HCofThisEvent * )
overrideinherited

Register this regular SD with the event-owned builder.

◆ operator=()

EndcapFastSimDedicatedSD & EndcapFastSimDedicatedSD::operator= ( const EndcapFastSimDedicatedSD & )
delete

◆ ProcessHits()

G4bool LArG4SimpleSD::ProcessHits ( G4Step * a_step,
G4TouchableHistory *  )
overrideinherited

Main processing method.

◆ ProcessSpot()

void EndcapFastSimDedicatedSD::ProcessSpot ( const EnergySpot & spot,
double weight )
finaloverridevirtual

ProcessHitsMethod.

Process a single energy spot from a frozen shower. The appropriate region of the sensitive detector is calculated and a LArIdentifier is constructed

Implements IFastSimDedicatedSD.

Definition at line 93 of file EndcapFastSimDedicatedSD.cxx.

93 {
94
95 // Fill the identifier.
96 Point3D<double> globalPosition=spot.GetPosition();
97
98 static const Transform3D xfPos = Amg::EigenTransformToCLHEP(m_emecManager->getDetectorRegion(1,1,0,0)->getAbsoluteTransform().inverse());
99 static const Transform3D xfNeg = Amg::EigenTransformToCLHEP(m_emecManager->getDetectorRegion(0,1,0,0)->getAbsoluteTransform().inverse());
100
101
102 Point3D<double> localPosition = globalPosition.z()<0 ? xfNeg*globalPosition : xfPos*globalPosition;
103 Point3D<double> shiftedLocalPosition = localPosition + Point3D<double>(0.0,0.0,m_emecManager->getFocalToRef()+m_emecManager->getRefToActive());
104 int zIndex = globalPosition.z()<0 ? 0:1;
105 double eta = shiftedLocalPosition.getEta();
106 double phi = localPosition.getPhi();
107 double z = localPosition.z();
108
110 for (e=m_emecManager->beginDetectorRegion();e!=m_emecManager->endDetectorRegion(); ++e) {
111 const EMECDetectorRegion *region = *e;
112 if (region->getEndcapIndex()!=zIndex) continue;
113 const EMECDetDescr *regionDescriptor=region->getDescriptor();
114 const CellBinning & etaBinning=regionDescriptor->getEtaBinning();
115 if (eta>etaBinning.getStart() && eta<etaBinning.getEnd()) {
116
117 unsigned int etaIndex = int((eta - etaBinning.getStart())/etaBinning.getDelta()) + etaBinning.getFirstDivisionNumber();
118 unsigned int phiIndex = 0;
119 EMECCellConstLink cellPtr = region->getEMECCell(etaIndex,phiIndex);
120 double zmax = cellPtr->getZLocal(EMECCell::BACK);
121 double zmin = cellPtr->getZLocal(EMECCell::FRONT);
122 if (z>zmin && z<zmax) {
123 const CellBinning & phiBinning=regionDescriptor->getPhiBinning();
124 double minPhi=std::min(phiBinning.getStart(), phiBinning.getEnd());
125 double maxPhi=std::max(phiBinning.getStart(), phiBinning.getEnd());
126 while (phi<minPhi) phi += 2*M_PI;
127 while (phi>maxPhi) phi -= 2*M_PI;
128
129 unsigned int regionIndex = region->getRegionIndex();
130 unsigned int samplingIndex = region->getSamplingIndex();
131 //unsigned int phiIndex = int((phi - phiBinning.getStart())/phiBinning.getDelta()) + phiBinning.getFirstDivisionNumber();
132 int wheel = region->getRadialIndex()==0 ? 2:3;
133 int sWheel = zIndex==0 ? -wheel: wheel;
134
135 // But now we are more sophisticated...:
136
137 LArWheelCalculator *wheelCalc=nullptr;
138 int nGaps= region->getRadialIndex()==0 ? 768:256;
139 int nBins= phiBinning.getNumDivisions();
140 int gapsPerBin = nGaps/nBins;
141
142
143 if (zIndex==0 && region->getRadialIndex()==0) {
144 wheelCalc=const_cast<LArWheelCalculator *> (m_outerWheelCalculatorNeg);
145 }
146 else if (zIndex==0 && region->getRadialIndex()==1){
147 wheelCalc=const_cast<LArWheelCalculator *> (m_innerWheelCalculatorPos);
148 }
149 else if (zIndex==1 && region->getRadialIndex()==0){
150 wheelCalc=const_cast<LArWheelCalculator *>(m_outerWheelCalculatorNeg);
151 }
152 else if (zIndex==1 && region->getRadialIndex()==1){
153 wheelCalc=const_cast<LArWheelCalculator *> (m_innerWheelCalculatorPos);
154 }
155 else {
156 throw std::runtime_error("Error, unknown wheel in EndcapFastSimDedicatedSD");
157 }
158
159 int phiBin = wheelCalc->GetPhiGap(localPosition)/gapsPerBin;
160
161 if (zIndex==0) {
162 phiBin = (nBins-2)/2 - phiBin;
163 if(phiBin < 0) {
164 phiBin += nBins;
165 }
166 }
167
168 //std::cout << didIt << "Compare phi gap: " << nGaps << ' ' << nBins << ' ' << gapsPerBin << ':' << phiBin << '/' << phiIndex << std::endl;
169
170 //static LArG4Identifier id;
171 m_larID.clear();
172 m_larID << 4 // LArCalorimeter
173 << 1 // LArEM
174 << sWheel
175 << samplingIndex
176 << regionIndex
177 << etaIndex
178 << phiBin;
179 // call process to add this to the collection
180 SimpleHit(m_larID, spot.GetTime(), spot.GetEnergy()*weight);
181 return;
182 }
183 }
184 }
185
186
187}
#define M_PI
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
Eigen::Affine3d Transform3D
#define z
const CellBinning & getEtaBinning() const
The Binning in Eta.
const CellBinning & getPhiBinning() const
The Binning in Phi.
std::vector< constEMECDetectorRegion * >::const_iterator DetectorRegionConstIterator
EMECCellConstLink getEMECCell(unsigned int ieta, unsigned int iphi) const
Access to Cells.
unsigned int getRadialIndex() const
Returns the Radial (Outer Wheel=0,InnerWheel=1) Index.
unsigned int getRegionIndex() const
Returns the Region Index.
EMECDetectorRegion::DetectorSide getEndcapIndex() const
The endcap index.
const EMECDetDescr * getDescriptor() const
Returns the Descriptor for this region.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index.
LArG4Identifier m_larID
My LAr identifier.
G4ThreeVector GetPosition() const
Definition EnergySpot.h:40
G4double GetEnergy() const
Definition EnergySpot.h:37
G4double GetTime() const
Definition EnergySpot.h:43
G4bool SimpleHit(const LArG4Identifier &lar_id, G4double time, G4double energy)
First method translates to this - also for fast sims.
int GetPhiGap(const CLHEP::Hep3Vector &p) const
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition EtaPhiLUT.cxx:23
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setPhiMap phiBin

◆ setupHelpers()

void LArG4SimpleSD::setupHelpers ( const LArEM_ID * EM,
const LArFCAL_ID * FCAL,
const LArHEC_ID * HEC )
inlineinherited

Sets the ID helper pointers.

Definition at line 75 of file LArG4SimpleSD.h.

77 {
78 m_larEmID = EM;
81 }
const LArHEC_ID * m_larHecID
const LArFCAL_ID * m_larFcalID
const LArEM_ID * m_larEmID
Pointers to the identifier helpers.

◆ SimpleHit()

G4bool LArG4SimpleSD::SimpleHit ( const LArG4Identifier & lar_id,
G4double time,
G4double energy )
inherited

First method translates to this - also for fast sims.

Member Data Documentation

◆ m_calculator

ILArCalculatorSvc* LArG4SimpleSD::m_calculator
protectedinherited

Member variable - the calculator we'll use.

Definition at line 91 of file LArG4SimpleSD.h.

◆ m_emecManager

EMECDetectorManager* EndcapFastSimDedicatedSD::m_emecManager
private

Definition at line 43 of file EndcapFastSimDedicatedSD.h.

◆ m_hitCollectionName

std::string LArG4SimpleSD::m_hitCollectionName
privateinherited

Definition at line 122 of file LArG4SimpleSD.h.

◆ m_hitSourceName

std::string LArG4SimpleSD::m_hitSourceName
privateinherited

Definition at line 123 of file LArG4SimpleSD.h.

◆ m_innerWheelCalculatorNeg

LArWheelCalculator* EndcapFastSimDedicatedSD::m_innerWheelCalculatorNeg
private

Definition at line 45 of file EndcapFastSimDedicatedSD.h.

◆ m_innerWheelCalculatorPos

LArWheelCalculator* EndcapFastSimDedicatedSD::m_innerWheelCalculatorPos
private

Definition at line 44 of file EndcapFastSimDedicatedSD.h.

◆ m_larEmID

const LArEM_ID* LArG4SimpleSD::m_larEmID
protectedinherited

Pointers to the identifier helpers.

Definition at line 115 of file LArG4SimpleSD.h.

◆ m_larFcalID

const LArFCAL_ID* LArG4SimpleSD::m_larFcalID
protectedinherited

Definition at line 116 of file LArG4SimpleSD.h.

◆ m_larHecID

const LArHEC_ID* LArG4SimpleSD::m_larHecID
protectedinherited

Definition at line 117 of file LArG4SimpleSD.h.

◆ m_larID

LArG4Identifier EndcapFastSimDedicatedSD::m_larID
private

My LAr identifier.

Definition at line 50 of file EndcapFastSimDedicatedSD.h.

◆ m_numberInvalidHits

G4int LArG4SimpleSD::m_numberInvalidHits
protectedinherited

Count the number of invalid hits.

Definition at line 94 of file LArG4SimpleSD.h.

◆ m_outerWheelCalculatorNeg

LArWheelCalculator* EndcapFastSimDedicatedSD::m_outerWheelCalculatorNeg
private

Definition at line 47 of file EndcapFastSimDedicatedSD.h.

◆ m_outerWheelCalculatorPos

LArWheelCalculator* EndcapFastSimDedicatedSD::m_outerWheelCalculatorPos
private

Definition at line 46 of file EndcapFastSimDedicatedSD.h.

◆ m_timeBinType

LArG4SimpleSD::LArHitTimeBins LArG4SimpleSD::m_timeBinType
protectedinherited

Definition at line 109 of file LArG4SimpleSD.h.

◆ m_timeBinWidth

G4float LArG4SimpleSD::m_timeBinWidth
protectedinherited

Width of the time bins for summing hits - for the uniform binning.

Definition at line 112 of file LArG4SimpleSD.h.


The documentation for this class was generated from the following files: