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 edm::EventSetup &, 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 edm::EventSetup &es, 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 edm::EventSetup &es, 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 edm::EventSetup &es, 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 *, const G4Track *)
 
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 edm::EventSetup &)
 

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 edm::EventSetup es,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 39 of file HcalTB02SD.cc.

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

44  : CaloSD(name, es, clg, p, manager), numberingScheme(nullptr) {
45  edm::ParameterSet m_SD = p.getParameter<edm::ParameterSet>("HcalTB02SD");
46  useBirk = m_SD.getUntrackedParameter<bool>("UseBirkLaw", false);
47  birk1 = m_SD.getUntrackedParameter<double>("BirkC1", 0.013) * (g / (MeV * cm2));
48  birk2 = m_SD.getUntrackedParameter<double>("BirkC2", 0.0568);
49  birk3 = m_SD.getUntrackedParameter<double>("BirkC3", 1.75);
50  useWeight = true;
51 
53  if (name == "EcalHitsEB") {
54  scheme = dynamic_cast<HcalTB02NumberingScheme*>(new HcalTB02XtalNumberingScheme());
55  useBirk = false;
56  } else if (name == "HcalHits") {
57  scheme = dynamic_cast<HcalTB02NumberingScheme*>(new HcalTB02HcalNumberingScheme());
58  useWeight = false;
59  } else {
60  edm::LogWarning("HcalTBSim") << "HcalTB02SD: ReadoutName " << name << " not supported\n";
61  }
62 
63  if (scheme)
64  setNumberingScheme(scheme);
65  LogDebug("HcalTBSim") << "***************************************************"
66  << "\n"
67  << "* *"
68  << "\n"
69  << "* Constructing a HcalTB02SD with name " << GetName() << "\n"
70  << "* *"
71  << "\n"
72  << "***************************************************";
73  edm::LogInfo("HcalTBSim") << "HcalTB02SD:: Use of Birks law is set to " << useBirk
74  << " with three constants kB = " << birk1 << ", C1 = " << birk2
75  << ", C2 = " << birk3;
76 
77  if (useWeight)
78  initMap(name, es);
79 }
#define LogDebug(id)
double birk2
Definition: HcalTB02SD.h:52
T getUntrackedParameter(std::string const &, T const &) const
HcalTB02NumberingScheme * numberingScheme
Definition: HcalTB02SD.h:49
void initMap(const std::string &, const edm::EventSetup &)
Definition: HcalTB02SD.cc:119
bool useWeight
Definition: HcalTB02SD.h:50
bool useBirk
Definition: HcalTB02SD.h:51
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
CaloSD(const std::string &aSDname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
Definition: CaloSD.cc:27
double birk3
Definition: HcalTB02SD.h:52
void setNumberingScheme(HcalTB02NumberingScheme *scheme)
Definition: HcalTB02SD.cc:110
double birk1
Definition: HcalTB02SD.h:52
HcalTB02SD::~HcalTB02SD ( )
override

Definition at line 81 of file HcalTB02SD.cc.

References numberingScheme.

81  {
82  if (numberingScheme)
83  delete numberingScheme;
84 }
HcalTB02NumberingScheme * numberingScheme
Definition: HcalTB02SD.h:49

Member Function Documentation

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

Definition at line 169 of file HcalTB02SD.cc.

References lengthMap.

Referenced by curve_LY().

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

Definition at line 149 of file HcalTB02SD.cc.

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

Referenced by getEnergyDeposit().

149  {
150  double weight = 1.;
151  G4ThreeVector localPoint = setToLocal(stepPoint->GetPosition(), 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 = " << crlength
160  << " crystal name = " << nameVolume << " z of localPoint = " << localPoint.z()
161  << " take weight = " << weight;
162  }
163  LogDebug("HcalTBSim") << "HcalTB02SD, light coll curve : " << dapd << " crlength = " << crlength
164  << " crystal name = " << nameVolume << " z of localPoint = " << localPoint.z()
165  << " take weight = " << weight;
166  return weight;
167 }
#define LogDebug(id)
double crystalLength(const G4String &)
Definition: HcalTB02SD.cc:169
Definition: weight.py:1
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *) const
Definition: CaloSD.cc:291
double HcalTB02SD::getEnergyDeposit ( const G4Step *  aStep)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 90 of file HcalTB02SD.cc.

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

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

Definition at line 119 of file HcalTB02SD.cc.

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

Referenced by HcalTB02SD().

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

Implements CaloSD.

Definition at line 106 of file HcalTB02SD.cc.

References HcalTB02NumberingScheme::getUnitID(), and numberingScheme.

106  {
107  return (numberingScheme == nullptr ? 0 : (uint32_t)(numberingScheme->getUnitID(aStep)));
108 }
HcalTB02NumberingScheme * numberingScheme
Definition: HcalTB02SD.h:49
virtual int getUnitID(const G4Step *aStep) const =0
void HcalTB02SD::setNumberingScheme ( HcalTB02NumberingScheme scheme)

Definition at line 110 of file HcalTB02SD.cc.

References numberingScheme, and generator_cfi::scheme.

Referenced by HcalTB02SD().

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

Member Data Documentation

double HcalTB02SD::birk1
private

Definition at line 52 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

double HcalTB02SD::birk2
private

Definition at line 52 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

double HcalTB02SD::birk3
private

Definition at line 52 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

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

Definition at line 53 of file HcalTB02SD.h.

Referenced by crystalLength(), and initMap().

HcalTB02NumberingScheme* HcalTB02SD::numberingScheme
private

Definition at line 49 of file HcalTB02SD.h.

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

bool HcalTB02SD::useBirk
private

Definition at line 51 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

bool HcalTB02SD::useWeight
private

Definition at line 50 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().