CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
HcalTB02SD Class Reference

#include <SimG4CMS/HcalTestBeam/interface/HcalTB02SD.h>

Inheritance diagram for HcalTB02SD:
CaloSD SensitiveCaloDetector Observer< const BeginOfRun * > Observer< const BeginOfEvent * > Observer< const BeginOfTrack * > Observer< const EndOfTrack * > Observer< const EndOfEvent * > SensitiveDetector

Public Member Functions

 HcalTB02SD (const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
uint32_t setDetUnitId (const G4Step *step) override
 
void setNumberingScheme (HcalTB02NumberingScheme *scheme)
 
 ~HcalTB02SD () override
 
- Public Member Functions inherited from CaloSD
 CaloSD (const std::string &aSDname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
 
void clear () override
 
void clearHits () override
 
void DrawAll () override
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
void fillHits (edm::PCaloHitContainer &, const std::string &) override
 
void Initialize (G4HCofThisEvent *HCE) override
 
void PrintAll () override
 
G4bool ProcessHits (G4Step *step, G4TouchableHistory *) override
 
bool ProcessHits (G4GFlashSpot *aSpot, G4TouchableHistory *) override
 
void reset () override
 
 ~CaloSD () override
 
- Public Member Functions inherited from SensitiveCaloDetector
 SensitiveCaloDetector (const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
const std::vector< std::string > & getNames () const
 
void Initialize (G4HCofThisEvent *eventHC) override
 
bool isCaloSD () const
 
 SensitiveDetector (const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p, bool calo)
 
 ~SensitiveDetector () override
 
- Public Member Functions inherited from Observer< const BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack * >
 Observer ()
 
void slotForUpdate (const BeginOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfTrack * >
 Observer ()
 
void slotForUpdate (const EndOfTrack * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent * >
 Observer ()
 
void slotForUpdate (const EndOfEvent * iT)
 
virtual ~Observer ()
 

Protected Member Functions

double getEnergyDeposit (const G4Step *) override
 
- Protected Member Functions inherited from CaloSD
bool checkHit ()
 
CaloG4HitcreateNewHit (const G4Step *)
 
virtual void endEvent ()
 
virtual bool filterHit (CaloG4Hit *, double)
 
double getAttenuation (const G4Step *aStep, double birk1, double birk2, double birk3) const
 
virtual uint16_t getDepth (const G4Step *)
 
virtual bool getFromLibrary (const G4Step *step)
 
int getNumberOfHits ()
 
double getResponseWt (const G4Track *)
 
virtual int getTrackID (const G4Track *)
 
bool hitExists (const G4Step *)
 
virtual void initEvent (const BeginOfEvent *)
 
virtual void initRun ()
 
void processHit (const G4Step *step)
 
void resetForNewPrimary (const G4Step *)
 
void setNumberCheckedHits (int val)
 
void setParameterized (bool val)
 
G4ThreeVector setToGlobal (const G4ThreeVector &, const G4VTouchable *) const
 
G4ThreeVector setToLocal (const G4ThreeVector &, const G4VTouchable *) const
 
virtual int setTrackID (const G4Step *)
 
void setUseMap (bool val)
 
void update (const BeginOfRun *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const ::EndOfEvent *) override
 
void updateHit (CaloG4Hit *)
 
- Protected Member Functions inherited from SensitiveDetector
TrackInformationcmsTrackInformation (const G4Track *aTrack)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point) const
 
Local3DPoint FinalStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint InitialStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint LocalPostStepPosition (const G4Step *step) const
 
Local3DPoint LocalPreStepPosition (const G4Step *step) const
 
void NaNTrap (const G4Step *step) const
 
void setNames (const std::vector< std::string > &)
 
- Protected Member Functions inherited from Observer< const EndOfEvent * >
virtual void update (const EndOfEvent *)=0
 This routine will be called when the appropriate signal arrives. More...
 

Private Member Functions

double crystalLength (const G4String &)
 
double curve_LY (const G4String &, const G4StepPoint *)
 
void initMap (const std::string &, const DDCompactView &)
 

Private Attributes

double birk1
 
double birk2
 
double birk3
 
std::map< G4String, double > lengthMap
 
HcalTB02NumberingSchemenumberingScheme
 
bool useBirk
 
bool useWeight
 

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Protected Attributes inherited from CaloSD
CaloG4HitcurrentHit
 
CaloHitID currentID
 
float edepositEM
 
float edepositHAD
 
double eminHit
 
double energyCut
 
G4ThreeVector entranceLocal
 
G4ThreeVector entrancePoint
 
bool forceSave
 
float incidentEnergy
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 
G4ThreeVector posGlobal
 
CaloHitID previousID
 
bool suppressHeavy
 
double tmaxHit
 

Detailed Description

Description: Stores hits of Test Beam 2002 calorimeters

Usage: Activation is done using the XML file by choosing HcalTB02SensitiveDetector

Definition at line 29 of file HcalTB02SD.h.

Constructor & Destructor Documentation

HcalTB02SD::HcalTB02SD ( const std::string &  name,
const DDCompactView cpv,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 36 of file HcalTB02SD.cc.

References birk1, birk2, birk3, g, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), initMap(), LogDebug, MeV, setNumberingScheme(), useBirk, and useWeight.

39  :
40  CaloSD(name, cpv, clg, p, manager), numberingScheme(nullptr) {
41 
42  edm::ParameterSet m_SD = p.getParameter<edm::ParameterSet>("HcalTB02SD");
43  useBirk= m_SD.getUntrackedParameter<bool>("UseBirkLaw",false);
44  birk1 = m_SD.getUntrackedParameter<double>("BirkC1",0.013)*(g/(MeV*cm2));
45  birk2 = m_SD.getUntrackedParameter<double>("BirkC2",0.0568);
46  birk3 = m_SD.getUntrackedParameter<double>("BirkC3",1.75);
47  useWeight= true;
48 
49  HcalTB02NumberingScheme* scheme=nullptr;
50  if (name == "EcalHitsEB") {
51  scheme = dynamic_cast<HcalTB02NumberingScheme*>(new HcalTB02XtalNumberingScheme());
52  useBirk = false;
53  } else if (name == "HcalHits") {
54  scheme = dynamic_cast<HcalTB02NumberingScheme*>(new HcalTB02HcalNumberingScheme());
55  useWeight= false;
56  } else {edm::LogWarning("HcalTBSim") << "HcalTB02SD: ReadoutName " << name
57  << " not supported\n";}
58 
59  if (scheme) setNumberingScheme(scheme);
60  LogDebug("HcalTBSim")
61  << "***************************************************"
62  << "\n"
63  << "* *"
64  << "\n"
65  << "* Constructing a HcalTB02SD with name " << GetName()
66  << "\n"
67  << "* *"
68  << "\n"
69  << "***************************************************" ;
70  edm::LogInfo("HcalTBSim") << "HcalTB02SD:: Use of Birks law is set to "
71  << useBirk << " with three constants kB = "
72  << birk1 << ", C1 = " << birk2 << ", C2 = "
73  << birk3;
74 
75  if (useWeight) initMap(name,cpv);
76 
77 }
#define LogDebug(id)
double birk2
Definition: HcalTB02SD.h:53
T getUntrackedParameter(std::string const &, T const &) const
HcalTB02NumberingScheme * numberingScheme
Definition: HcalTB02SD.h:50
bool useWeight
Definition: HcalTB02SD.h:51
bool useBirk
Definition: HcalTB02SD.h:52
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
const double MeV
double birk3
Definition: HcalTB02SD.h:53
CaloSD(const std::string &aSDname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
Definition: CaloSD.cc:27
void setNumberingScheme(HcalTB02NumberingScheme *scheme)
Definition: HcalTB02SD.cc:107
void initMap(const std::string &, const DDCompactView &)
Definition: HcalTB02SD.cc:116
double birk1
Definition: HcalTB02SD.h:53
HcalTB02SD::~HcalTB02SD ( )
override

Definition at line 79 of file HcalTB02SD.cc.

References numberingScheme.

79  {
80  if (numberingScheme) delete numberingScheme;
81 }
HcalTB02NumberingScheme * numberingScheme
Definition: HcalTB02SD.h:50

Member Function Documentation

double HcalTB02SD::crystalLength ( const G4String &  name)
private

Definition at line 172 of file HcalTB02SD.cc.

References lengthMap.

Referenced by curve_LY().

172  {
173 
174  double length = 230.;
175  std::map<G4String,double>::const_iterator it = lengthMap.find(name);
176  if (it != lengthMap.end()) length = it->second;
177  return length;
178 }
std::map< G4String, double > lengthMap
Definition: HcalTB02SD.h:54
double HcalTB02SD::curve_LY ( const G4String &  nameVolume,
const G4StepPoint *  stepPoint 
)
private

Definition at line 147 of file HcalTB02SD.cc.

References crystalLength(), LogDebug, CaloSD::setToLocal(), and mps_merge::weight.

Referenced by getEnergyDeposit().

147  {
148 
149  double weight = 1.;
150  G4ThreeVector localPoint = setToLocal(stepPoint->GetPosition(),
151  stepPoint->GetTouchable());
152  double crlength = crystalLength(nameVolume);
153  double dapd = 0.5 * crlength - localPoint.z();
154  if (dapd >= -0.1 || dapd <= crlength+0.1) {
155  if (dapd <= 100.)
156  weight = 1.05 - dapd * 0.0005;
157  } else {
158  edm::LogWarning("HcalTBSim") << "HcalTB02SD: light coll curve : wrong "
159  << "distance to APD " << dapd <<" crlength = "
160  << crlength << " crystal name = " <<nameVolume
161  << " z of localPoint = " << localPoint.z()
162  << " take weight = " << weight;
163  }
164  LogDebug("HcalTBSim") << "HcalTB02SD, light coll curve : " << dapd
165  << " crlength = " << crlength
166  << " crystal name = " << nameVolume
167  << " z of localPoint = " << localPoint.z()
168  << " take weight = " << weight;
169  return weight;
170 }
#define LogDebug(id)
double crystalLength(const G4String &)
Definition: HcalTB02SD.cc:172
Definition: weight.py:1
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *) const
Definition: CaloSD.cc:294
double HcalTB02SD::getEnergyDeposit ( const G4Step *  aStep)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 87 of file HcalTB02SD.cc.

References birk1, birk2, birk3, curve_LY(), CaloSD::getAttenuation(), LogDebug, MeV, useBirk, useWeight, and mps_merge::weight.

87  {
88 
89  auto const preStepPoint = aStep->GetPreStepPoint();
90  auto const & nameVolume = preStepPoint->GetPhysicalVolume()->GetName();
91 
92  // take into account light collection curve for crystals
93  double weight = 1.;
94  if (useWeight) weight *= curve_LY(nameVolume, preStepPoint);
95  if (useBirk) weight *= getAttenuation(aStep, birk1, birk2, birk3);
96  double edep = aStep->GetTotalEnergyDeposit() * weight;
97  LogDebug("HcalTBSim") << "HcalTB02SD:: " << nameVolume
98  <<" Light Collection Efficiency " << weight
99  << " Weighted Energy Deposit " << edep/MeV << " MeV";
100  return edep;
101 }
#define LogDebug(id)
double birk2
Definition: HcalTB02SD.h:53
Definition: weight.py:1
bool useWeight
Definition: HcalTB02SD.h:51
bool useBirk
Definition: HcalTB02SD.h:52
const double MeV
double curve_LY(const G4String &, const G4StepPoint *)
Definition: HcalTB02SD.cc:147
double birk3
Definition: HcalTB02SD.h:53
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:438
double birk1
Definition: HcalTB02SD.h:53
void HcalTB02SD::initMap ( const std::string &  sd,
const DDCompactView cpv 
)
private

Definition at line 116 of file HcalTB02SD.cc.

References ddtrap, PVValHelper::dz, ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), mps_fire::i, lengthMap, LogDebug, DDFilteredView::logicalPart(), DDName::name(), dataset::name, DDBase< N, C >::name(), DDFilteredView::next(), DDSolid::parameters(), DDSolid::shape(), and DDLogicalPart::solid().

Referenced by HcalTB02SD().

116  {
117 
118  G4String attribute = "ReadOutName";
120  DDFilteredView fv(cpv,filter);
121  fv.firstChild();
122 
123  bool dodet=true;
124  while (dodet) {
125  const DDSolid & sol = fv.logicalPart().solid();
126  const std::vector<double> & paras = sol.parameters();
127  G4String name = sol.name().name();
128  LogDebug("HcalTBSim") << "HcalTB02SD::initMap (for " << sd << "): Solid "
129  << name << " Shape " << sol.shape()
130  << " Parameter 0 = " << paras[0];
131  if (sol.shape() == DDSolidShape::ddtrap) {
132  double dz = 2*paras[0];
133  lengthMap.insert(std::pair<G4String,double>(name,dz));
134  }
135  dodet = fv.next();
136  }
137  LogDebug("HcalTBSim") << "HcalTB02SD: Length Table for " << attribute
138  << " = " << sd << ":";
139  std::map<G4String,double>::const_iterator it = lengthMap.begin();
140  int i=0;
141  for (; it != lengthMap.end(); it++, i++) {
142  LogDebug("HcalTBSim") << " " << i << " " << it->first << " L = "
143  << it->second;
144  }
145 }
#define LogDebug(id)
std::map< G4String, double > lengthMap
Definition: HcalTB02SD.h:54
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:144
const N & name() const
Definition: DDBase.h:74
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:138
double sd
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
uint32_t HcalTB02SD::setDetUnitId ( const G4Step *  step)
overridevirtual

Implements CaloSD.

Definition at line 103 of file HcalTB02SD.cc.

References HcalTB02NumberingScheme::getUnitID(), and numberingScheme.

103  {
104  return (numberingScheme == nullptr ? 0 : (uint32_t)(numberingScheme->getUnitID(aStep)));
105 }
HcalTB02NumberingScheme * numberingScheme
Definition: HcalTB02SD.h:50
virtual int getUnitID(const G4Step *aStep) const =0
void HcalTB02SD::setNumberingScheme ( HcalTB02NumberingScheme scheme)

Definition at line 107 of file HcalTB02SD.cc.

References numberingScheme.

Referenced by HcalTB02SD().

107  {
108  if (scheme != nullptr) {
109  edm::LogInfo("HcalTBSim") << "HcalTB02SD: updates numbering scheme for "
110  << GetName();
111  if (numberingScheme) delete numberingScheme;
112  numberingScheme = scheme;
113  }
114 }
HcalTB02NumberingScheme * numberingScheme
Definition: HcalTB02SD.h:50

Member Data Documentation

double HcalTB02SD::birk1
private

Definition at line 53 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

double HcalTB02SD::birk2
private

Definition at line 53 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

double HcalTB02SD::birk3
private

Definition at line 53 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

std::map<G4String,double> HcalTB02SD::lengthMap
private

Definition at line 54 of file HcalTB02SD.h.

Referenced by crystalLength(), and initMap().

HcalTB02NumberingScheme* HcalTB02SD::numberingScheme
private

Definition at line 50 of file HcalTB02SD.h.

Referenced by setDetUnitId(), setNumberingScheme(), and ~HcalTB02SD().

bool HcalTB02SD::useBirk
private

Definition at line 52 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

bool HcalTB02SD::useWeight
private

Definition at line 51 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().