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 HcalTB02Parameters *, 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 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
 
bool isItFineCalo (const G4VTouchable *touch)
 
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 SensitiveDetectorCatalog &clg)
 
- 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 SensitiveDetectorCatalog &, 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 double EnergyCorrected (const G4Step &step, const G4Track *)
 
virtual bool filterHit (CaloG4Hit *, double)
 
unsigned int findBoundaryCrossingParent (const G4Track *track, bool markParentAsSaveable=true)
 
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 *)
 
void ignoreRejection ()
 
virtual void initEvent (const BeginOfEvent *)
 
virtual void initRun ()
 
void printDetectorLevels (const G4VTouchable *) const
 
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)
 
std::string shortreprID (const CaloHitID &ID)
 
std::string shortreprID (const CaloG4Hit *hit)
 
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 std::string &)
 
double curve_LY (const std::string &, const G4StepPoint *)
 

Private Attributes

double birk1_
 
double birk2_
 
double birk3_
 
const HcalTB02ParametershcalTB02Parameters_
 
std::unique_ptr< HcalTB02NumberingSchemenumberingScheme_
 
bool useBirk_
 
bool useWeight_
 

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Static Protected Member Functions inherited from CaloSD
static std::string printableDecayChain (const std::vector< unsigned int > &decayChain)
 
- 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 31 of file HcalTB02SD.h.

Constructor & Destructor Documentation

◆ HcalTB02SD()

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

Definition at line 34 of file HcalTB02SD.cc.

References birk1_, birk2_, birk3_, g, edm::ParameterSet::getUntrackedParameter(), Skims_PA_cff::name, numberingScheme_, AlCaHLTBitMon_ParallelJobs::p, generator_cfi::scheme, setNumberingScheme(), useBirk_, and useWeight_.

39  : CaloSD(name, clg, p, manager), hcalTB02Parameters_(es) {
40  numberingScheme_.reset(nullptr);
41  edm::ParameterSet m_SD = p.getParameter<edm::ParameterSet>("HcalTB02SD");
42  useBirk_ = m_SD.getUntrackedParameter<bool>("UseBirkLaw", false);
43  birk1_ = m_SD.getUntrackedParameter<double>("BirkC1", 0.013) * (CLHEP::g / (CLHEP::MeV * CLHEP::cm2));
44  birk2_ = m_SD.getUntrackedParameter<double>("BirkC2", 0.0568);
45  birk3_ = m_SD.getUntrackedParameter<double>("BirkC3", 1.75);
46  useWeight_ = true;
47 
49  if (name == "EcalHitsEB") {
51  useBirk_ = false;
52  } else if (name == "HcalHits") {
54  useWeight_ = false;
55  } else {
56  edm::LogWarning("HcalTBSim") << "HcalTB02SD: ReadoutName " << name << " not supported\n";
57  }
58 
59  if (scheme)
61 #ifdef EDM_ML_DEBUG
62  edm::LogVerbatim("HcalTBSim") << "***************************************************\n"
63  << "* *\n"
64  << "* Constructing a HcalTB02SD with name " << GetName() << "\n"
65  << "* *\n"
66  << "***************************************************";
67  edm::LogVerbatim("HcalTBSim") << "HcalTB02SD:: Use of Birks law is set to " << useBirk_
68  << " with three constants kB = " << birk1_ << ", C1 = " << birk2_
69  << ", C2 = " << birk3_;
70 #endif
71 }
Log< level::Info, true > LogVerbatim
bool useBirk_
Definition: HcalTB02SD.h:50
bool useWeight_
Definition: HcalTB02SD.h:50
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
T getUntrackedParameter(std::string const &, T const &) const
std::unique_ptr< HcalTB02NumberingScheme > numberingScheme_
Definition: HcalTB02SD.h:49
double birk1_
Definition: HcalTB02SD.h:51
void setNumberingScheme(HcalTB02NumberingScheme *scheme)
Definition: HcalTB02SD.cc:101
double birk2_
Definition: HcalTB02SD.h:51
CaloSD(const std::string &aSDname, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
Definition: CaloSD.cc:33
const HcalTB02Parameters * hcalTB02Parameters_
Definition: HcalTB02SD.h:52
Log< level::Warning, false > LogWarning
double birk3_
Definition: HcalTB02SD.h:51

◆ ~HcalTB02SD()

HcalTB02SD::~HcalTB02SD ( )
override

Definition at line 73 of file HcalTB02SD.cc.

73 {}

Member Function Documentation

◆ crystalLength()

double HcalTB02SD::crystalLength ( const std::string &  name)
private

Definition at line 130 of file HcalTB02SD.cc.

References hcalTB02Parameters_, HcalTB02Parameters::lengthMap_, and Skims_PA_cff::name.

Referenced by curve_LY().

130  {
131  double length = 230.;
132  std::map<std::string, double>::const_iterator it = hcalTB02Parameters_->lengthMap_.find(name);
133  if (it != hcalTB02Parameters_->lengthMap_.end())
134  length = it->second;
135  return length;
136 }
std::map< std::string, double > lengthMap_
const HcalTB02Parameters * hcalTB02Parameters_
Definition: HcalTB02SD.h:52

◆ curve_LY()

double HcalTB02SD::curve_LY ( const std::string &  nameVolume,
const G4StepPoint *  stepPoint 
)
private

Definition at line 108 of file HcalTB02SD.cc.

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

Referenced by getEnergyDeposit().

108  {
109  double weight = 1.;
110  G4ThreeVector localPoint = setToLocal(stepPoint->GetPosition(), stepPoint->GetTouchable());
111  double crlength = crystalLength(nameVolume);
112  double dapd = 0.5 * crlength - localPoint.z();
113  if (dapd >= -0.1 || dapd <= crlength + 0.1) {
114  if (dapd <= 100.)
115  weight = 1.05 - dapd * 0.0005;
116  } else {
117  edm::LogWarning("HcalTBSim") << "HcalTB02SD: light coll curve : wrong "
118  << "distance to APD " << dapd << " crlength = " << crlength
119  << " crystal name = " << nameVolume << " z of localPoint = " << localPoint.z()
120  << " take weight = " << weight;
121  }
122 #ifdef EDM_ML_DEBUG
123  edm::LogVerbatim("HcalTBSim") << "HcalTB02SD, light coll curve : " << dapd << " crlength = " << crlength
124  << " crystal name = " << nameVolume << " z of localPoint = " << localPoint.z()
125  << " take weight = " << weight;
126 #endif
127  return weight;
128 }
Log< level::Info, true > LogVerbatim
double crystalLength(const std::string &)
Definition: HcalTB02SD.cc:130
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *) const
Definition: CaloSD.cc:394
Definition: weight.py:1
Log< level::Warning, false > LogWarning

◆ getEnergyDeposit()

double HcalTB02SD::getEnergyDeposit ( const G4Step *  aStep)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 79 of file HcalTB02SD.cc.

References birk1_, birk2_, birk3_, curve_LY(), CaloSD::getAttenuation(), AlCaHLTBitMon_QueryRunRegistry::string, useBirk_, useWeight_, and mps_merge::weight.

79  {
80  auto const preStepPoint = aStep->GetPreStepPoint();
81  std::string nameVolume = static_cast<std::string>(preStepPoint->GetPhysicalVolume()->GetName());
82 
83  // take into account light collection curve for crystals
84  double weight = 1.;
85  if (useWeight_)
86  weight *= curve_LY(nameVolume, preStepPoint);
87  if (useBirk_)
89  double edep = aStep->GetTotalEnergyDeposit() * weight;
90 #ifdef EDM_ML_DEBUG
91  edm::LogVerbatim("HcalTBSim") << "HcalTB02SD:: " << nameVolume << " Light Collection Efficiency " << weight
92  << " Weighted Energy Deposit " << edep / CLHEP::MeV << " MeV";
93 #endif
94  return edep;
95 }
Log< level::Info, true > LogVerbatim
bool useBirk_
Definition: HcalTB02SD.h:50
bool useWeight_
Definition: HcalTB02SD.h:50
double curve_LY(const std::string &, const G4StepPoint *)
Definition: HcalTB02SD.cc:108
Definition: weight.py:1
double birk1_
Definition: HcalTB02SD.h:51
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:657
double birk2_
Definition: HcalTB02SD.h:51
double birk3_
Definition: HcalTB02SD.h:51

◆ setDetUnitId()

uint32_t HcalTB02SD::setDetUnitId ( const G4Step *  step)
overridevirtual

Implements CaloSD.

Definition at line 97 of file HcalTB02SD.cc.

References numberingScheme_.

97  {
98  return (numberingScheme_ == nullptr ? 0 : (uint32_t)(numberingScheme_->getUnitID(aStep)));
99 }
std::unique_ptr< HcalTB02NumberingScheme > numberingScheme_
Definition: HcalTB02SD.h:49

◆ setNumberingScheme()

void HcalTB02SD::setNumberingScheme ( HcalTB02NumberingScheme scheme)

Definition at line 101 of file HcalTB02SD.cc.

References numberingScheme_, and generator_cfi::scheme.

Referenced by HcalTB02SD().

101  {
102  if (scheme != nullptr) {
103  edm::LogVerbatim("HcalTBSim") << "HcalTB02SD: updates numbering scheme for " << GetName();
104  numberingScheme_.reset(scheme);
105  }
106 }
Log< level::Info, true > LogVerbatim
std::unique_ptr< HcalTB02NumberingScheme > numberingScheme_
Definition: HcalTB02SD.h:49

Member Data Documentation

◆ birk1_

double HcalTB02SD::birk1_
private

Definition at line 51 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

◆ birk2_

double HcalTB02SD::birk2_
private

Definition at line 51 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

◆ birk3_

double HcalTB02SD::birk3_
private

Definition at line 51 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

◆ hcalTB02Parameters_

const HcalTB02Parameters* HcalTB02SD::hcalTB02Parameters_
private

Definition at line 52 of file HcalTB02SD.h.

Referenced by crystalLength().

◆ numberingScheme_

std::unique_ptr<HcalTB02NumberingScheme> HcalTB02SD::numberingScheme_
private

Definition at line 49 of file HcalTB02SD.h.

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

◆ useBirk_

bool HcalTB02SD::useBirk_
private

Definition at line 50 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

◆ useWeight_

bool HcalTB02SD::useWeight_
private

Definition at line 50 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().