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 *, bool verbose)
 ~EndcapFastSimDedicatedSD ()
 EndcapFastSimDedicatedSD (const EndcapFastSimDedicatedSD &)=delete
EndcapFastSimDedicatedSDoperator= (const EndcapFastSimDedicatedSD &)=delete
void ProcessSpot (const EnergySpot &spot, double weight) override final
 ProcessHitsMethod.
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 EndOfAthenaEvent (LArHitContainer *hitContnainer)
 End of athena event processing.
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 Types

typedef std::set< LArHit *, LessHithits_t
typedef std::map< G4int, hits_t * > timeBins_t

Protected Member Functions

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

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.
timeBins_t m_timeBins
 The map of hit sets binned in time.
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, EndOfAthenaEvent)
 FRIEND_TEST (LArG4SimpleSDtest, setupHelpers)
 FRIEND_TEST (LArG4SimpleSDtest, getTimeBin)
 FRIEND_TEST (LArG4SimpleSDtest, SimpleHit)
 FRIEND_TEST (LArG4SimpleSDtest, ConvertID)
 FRIEND_TEST (SDWrappertest, Initialize)
 FRIEND_TEST (SDWrappertest, EndOfAthenaEvent)
 FRIEND_TEST (SDWrappertest, addSD)
 FRIEND_TEST (SDWrappertest, addFastSimSD)
 FRIEND_TEST (SDWrappertest, ProcessHits)

Private Attributes

EMECDetectorManagerm_emecManager
LArWheelCalculatorm_innerWheelCalculatorPos
LArWheelCalculatorm_innerWheelCalculatorNeg
LArWheelCalculatorm_outerWheelCalculatorPos
LArWheelCalculatorm_outerWheelCalculatorNeg
LArG4Identifier m_larID
 My LAr identifier.

Detailed Description

NEEDS DOCUMENTATION.

Definition at line 23 of file EndcapFastSimDedicatedSD.h.

Member Typedef Documentation

◆ hits_t

typedef std::set< LArHit*, LessHit > LArG4SimpleSD::hits_t
protectedinherited

Definition at line 113 of file LArG4SimpleSD.h.

◆ timeBins_t

typedef std::map< G4int, hits_t* > LArG4SimpleSD::timeBins_t
protectedinherited

Definition at line 119 of file LArG4SimpleSD.h.

Member Enumeration Documentation

◆ LArHitTimeBins

Enumerator
HitTimeBinDefault 
HitTimeBinUniform 

Definition at line 50 of file LArG4SimpleSD.h.

51 {
54 };

Constructor & Destructor Documentation

◆ EndcapFastSimDedicatedSD() [1/2]

EndcapFastSimDedicatedSD::EndcapFastSimDedicatedSD ( StoreGateSvc * detStore,
bool verbose )

Definition at line 36 of file EndcapFastSimDedicatedSD.cxx.

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

◆ ~EndcapFastSimDedicatedSD()

EndcapFastSimDedicatedSD::~EndcapFastSimDedicatedSD ( )
inline

Definition at line 32 of file EndcapFastSimDedicatedSD.h.

32{}

◆ 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.

◆ EndOfAthenaEvent()

void LArG4SimpleSD::EndOfAthenaEvent ( LArHitContainer * hitContnainer)
inherited

End of athena event processing.

◆ FRIEND_TEST() [1/11]

LArG4SimpleSD::FRIEND_TEST ( LArG4SimpleSDtest ,
ConvertID  )
privateinherited

◆ FRIEND_TEST() [2/11]

LArG4SimpleSD::FRIEND_TEST ( LArG4SimpleSDtest ,
EndOfAthenaEvent  )
privateinherited

◆ FRIEND_TEST() [3/11]

LArG4SimpleSD::FRIEND_TEST ( LArG4SimpleSDtest ,
getTimeBin  )
privateinherited

◆ FRIEND_TEST() [4/11]

LArG4SimpleSD::FRIEND_TEST ( LArG4SimpleSDtest ,
ProcessHits  )
privateinherited

◆ FRIEND_TEST() [5/11]

LArG4SimpleSD::FRIEND_TEST ( LArG4SimpleSDtest ,
setupHelpers  )
privateinherited

◆ FRIEND_TEST() [6/11]

LArG4SimpleSD::FRIEND_TEST ( LArG4SimpleSDtest ,
SimpleHit  )
privateinherited

◆ FRIEND_TEST() [7/11]

LArG4SimpleSD::FRIEND_TEST ( SDWrappertest ,
addFastSimSD  )
privateinherited

◆ FRIEND_TEST() [8/11]

LArG4SimpleSD::FRIEND_TEST ( SDWrappertest ,
addSD  )
privateinherited

◆ FRIEND_TEST() [9/11]

LArG4SimpleSD::FRIEND_TEST ( SDWrappertest ,
EndOfAthenaEvent  )
privateinherited

◆ FRIEND_TEST() [10/11]

LArG4SimpleSD::FRIEND_TEST ( SDWrappertest ,
Initialize  )
privateinherited

◆ FRIEND_TEST() [11/11]

LArG4SimpleSD::FRIEND_TEST ( SDWrappertest ,
ProcessHits  )
privateinherited

◆ getTimeBin()

G4int LArG4SimpleSD::getTimeBin ( G4double time) const
protectedinherited

Helper method for time info.

◆ 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 88 of file EndcapFastSimDedicatedSD.cxx.

88 {
89
90 // Fill the identifier.
91 Point3D<double> globalPosition=spot.GetPosition();
92
93 static const Transform3D xfPos = Amg::EigenTransformToCLHEP(m_emecManager->getDetectorRegion(1,1,0,0)->getAbsoluteTransform().inverse());
94 static const Transform3D xfNeg = Amg::EigenTransformToCLHEP(m_emecManager->getDetectorRegion(0,1,0,0)->getAbsoluteTransform().inverse());
95
96
97 Point3D<double> localPosition = globalPosition.z()<0 ? xfNeg*globalPosition : xfPos*globalPosition;
98 Point3D<double> shiftedLocalPosition = localPosition + Point3D<double>(0.0,0.0,m_emecManager->getFocalToRef()+m_emecManager->getRefToActive());
99 int zIndex = globalPosition.z()<0 ? 0:1;
100 double eta = shiftedLocalPosition.getEta();
101 double phi = localPosition.getPhi();
102 double z = localPosition.z();
103
105 for (e=m_emecManager->beginDetectorRegion();e!=m_emecManager->endDetectorRegion(); ++e) {
106 const EMECDetectorRegion *region = *e;
107 if (region->getEndcapIndex()!=zIndex) continue;
108 const EMECDetDescr *regionDescriptor=region->getDescriptor();
109 const CellBinning & etaBinning=regionDescriptor->getEtaBinning();
110 if (eta>etaBinning.getStart() && eta<etaBinning.getEnd()) {
111
112 unsigned int etaIndex = int((eta - etaBinning.getStart())/etaBinning.getDelta()) + etaBinning.getFirstDivisionNumber();
113 unsigned int phiIndex = 0;
114 EMECCellConstLink cellPtr = region->getEMECCell(etaIndex,phiIndex);
115 double zmax = cellPtr->getZLocal(EMECCell::BACK);
116 double zmin = cellPtr->getZLocal(EMECCell::FRONT);
117 if (z>zmin && z<zmax) {
118 const CellBinning & phiBinning=regionDescriptor->getPhiBinning();
119 double minPhi=std::min(phiBinning.getStart(), phiBinning.getEnd());
120 double maxPhi=std::max(phiBinning.getStart(), phiBinning.getEnd());
121 while (phi<minPhi) phi += 2*M_PI;
122 while (phi>maxPhi) phi -= 2*M_PI;
123
124 unsigned int regionIndex = region->getRegionIndex();
125 unsigned int samplingIndex = region->getSamplingIndex();
126 //unsigned int phiIndex = int((phi - phiBinning.getStart())/phiBinning.getDelta()) + phiBinning.getFirstDivisionNumber();
127 int wheel = region->getRadialIndex()==0 ? 2:3;
128 int sWheel = zIndex==0 ? -wheel: wheel;
129
130 // But now we are more sophisticated...:
131
132 LArWheelCalculator *wheelCalc=nullptr;
133 int nGaps= region->getRadialIndex()==0 ? 768:256;
134 int nBins= phiBinning.getNumDivisions();
135 int gapsPerBin = nGaps/nBins;
136
137
138 if (zIndex==0 && region->getRadialIndex()==0) {
139 wheelCalc=const_cast<LArWheelCalculator *> (m_outerWheelCalculatorNeg);
140 }
141 else if (zIndex==0 && region->getRadialIndex()==1){
142 wheelCalc=const_cast<LArWheelCalculator *> (m_innerWheelCalculatorPos);
143 }
144 else if (zIndex==1 && region->getRadialIndex()==0){
145 wheelCalc=const_cast<LArWheelCalculator *>(m_outerWheelCalculatorNeg);
146 }
147 else if (zIndex==1 && region->getRadialIndex()==1){
148 wheelCalc=const_cast<LArWheelCalculator *> (m_innerWheelCalculatorPos);
149 }
150 else {
151 throw std::runtime_error("Error, unknown wheel in EndcapFastSimDedicatedSD");
152 }
153
154 int phiBin = wheelCalc->GetPhiGap(localPosition)/gapsPerBin;
155
156 if (zIndex==0) {
157 phiBin = (nBins-2)/2 - phiBin;
158 if(phiBin < 0) {
159 phiBin += nBins;
160 }
161 }
162
163 //std::cout << didIt << "Compare phi gap: " << nGaps << ' ' << nBins << ' ' << gapsPerBin << ':' << phiBin << '/' << phiIndex << std::endl;
164
165 //static LArG4Identifier id;
166 m_larID.clear();
167 m_larID << 4 // LArCalorimeter
168 << 1 // LArEM
169 << sWheel
170 << samplingIndex
171 << regionIndex
172 << etaIndex
173 << phiBin;
174 // call process to add this to the collection
175 SimpleHit(m_larID, spot.GetTime(), spot.GetEnergy()*weight);
176 return;
177 }
178 }
179 }
180
181
182}
#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 77 of file LArG4SimpleSD.h.

79 {
80 m_larEmID = EM;
83 }
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 93 of file LArG4SimpleSD.h.

◆ m_emecManager

EMECDetectorManager* EndcapFastSimDedicatedSD::m_emecManager
private

Definition at line 42 of file EndcapFastSimDedicatedSD.h.

◆ m_innerWheelCalculatorNeg

LArWheelCalculator* EndcapFastSimDedicatedSD::m_innerWheelCalculatorNeg
private

Definition at line 44 of file EndcapFastSimDedicatedSD.h.

◆ m_innerWheelCalculatorPos

LArWheelCalculator* EndcapFastSimDedicatedSD::m_innerWheelCalculatorPos
private

Definition at line 43 of file EndcapFastSimDedicatedSD.h.

◆ m_larEmID

const LArEM_ID* LArG4SimpleSD::m_larEmID
protectedinherited

Pointers to the identifier helpers.

Definition at line 143 of file LArG4SimpleSD.h.

◆ m_larFcalID

const LArFCAL_ID* LArG4SimpleSD::m_larFcalID
protectedinherited

Definition at line 144 of file LArG4SimpleSD.h.

◆ m_larHecID

const LArHEC_ID* LArG4SimpleSD::m_larHecID
protectedinherited

Definition at line 145 of file LArG4SimpleSD.h.

◆ m_larID

LArG4Identifier EndcapFastSimDedicatedSD::m_larID
private

My LAr identifier.

Definition at line 49 of file EndcapFastSimDedicatedSD.h.

◆ m_numberInvalidHits

G4int LArG4SimpleSD::m_numberInvalidHits
protectedinherited

Count the number of invalid hits.

Definition at line 96 of file LArG4SimpleSD.h.

◆ m_outerWheelCalculatorNeg

LArWheelCalculator* EndcapFastSimDedicatedSD::m_outerWheelCalculatorNeg
private

Definition at line 46 of file EndcapFastSimDedicatedSD.h.

◆ m_outerWheelCalculatorPos

LArWheelCalculator* EndcapFastSimDedicatedSD::m_outerWheelCalculatorPos
private

Definition at line 45 of file EndcapFastSimDedicatedSD.h.

◆ m_timeBins

timeBins_t LArG4SimpleSD::m_timeBins
protectedinherited

The map of hit sets binned in time.

Definition at line 140 of file LArG4SimpleSD.h.

◆ m_timeBinType

LArG4SimpleSD::LArHitTimeBins LArG4SimpleSD::m_timeBinType
protectedinherited

Definition at line 134 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 137 of file LArG4SimpleSD.h.


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