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
 
bool isItFineCalo (const G4VTouchable *touch)
 
void PrintAll () override
 
bool ProcessHits (G4GFlashSpot *aSpot, G4TouchableHistory *) override
 
G4bool ProcessHits (G4Step *step, 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 double EnergyCorrected (const G4Step &step, const G4Track *)
 
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 *)
 
void ignoreRejection ()
 
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 ::EndOfEvent *) override
 
void update (const BeginOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfRun *) 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 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 }
 
- 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::HcalTB02SD ( const std::string &  name,
const edm::EventSetup es,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 35 of file HcalTB02SD.cc.

40  : CaloSD(name, es, clg, p, manager) {
41  numberingScheme_.reset(nullptr);
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) * (CLHEP::g / (CLHEP::MeV * CLHEP::cm2));
45  birk2_ = m_SD.getUntrackedParameter<double>("BirkC2", 0.0568);
46  birk3_ = m_SD.getUntrackedParameter<double>("BirkC3", 1.75);
47  useWeight_ = true;
48 
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 {
57  edm::LogWarning("HcalTBSim") << "HcalTB02SD: ReadoutName " << name << " not supported\n";
58  }
59 
60  if (scheme)
62 #ifdef EDM_ML_DEBUG
63  edm::LogVerbatim("HcalTBSim") << "***************************************************\n"
64  << "* *\n"
65  << "* Constructing a HcalTB02SD with name " << GetName() << "\n"
66  << "* *\n"
67  << "***************************************************";
68  edm::LogVerbatim("HcalTBSim") << "HcalTB02SD:: Use of Birks law is set to " << useBirk_
69  << " with three constants kB = " << birk1_ << ", C1 = " << birk2_
70  << ", C2 = " << birk3_;
71 #endif
72  // Get pointers to HcalTB02Parameters
74  es.get<IdealGeometryRecord>().get(hdc);
75  if (hdc.isValid()) {
77  } else {
78  throw cms::Exception("Unknown", "HcalTB02SD") << "Cannot find HcalTB02Parameters\n";
79  }
80 }

References birk1_, birk2_, birk3_, Exception, g, edm::EventSetup::get(), get, edm::ParameterSet::getUntrackedParameter(), hcalTB02Parameters_, edm::ESHandleBase::isValid(), MeV, Skims_PA_cff::name, numberingScheme_, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), generator_cfi::scheme, setNumberingScheme(), useBirk_, and useWeight_.

◆ ~HcalTB02SD()

HcalTB02SD::~HcalTB02SD ( )
override

Definition at line 82 of file HcalTB02SD.cc.

82 {}

Member Function Documentation

◆ crystalLength()

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

Definition at line 139 of file HcalTB02SD.cc.

139  {
140  double length = 230.;
141  std::map<std::string, double>::const_iterator it = hcalTB02Parameters_->lengthMap_.find(name);
142  if (it != hcalTB02Parameters_->lengthMap_.end())
143  length = it->second;
144  return length;
145 }

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

Referenced by curve_LY().

◆ curve_LY()

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

Definition at line 117 of file HcalTB02SD.cc.

117  {
118  double weight = 1.;
119  G4ThreeVector localPoint = setToLocal(stepPoint->GetPosition(), stepPoint->GetTouchable());
120  double crlength = crystalLength(nameVolume);
121  double dapd = 0.5 * crlength - localPoint.z();
122  if (dapd >= -0.1 || dapd <= crlength + 0.1) {
123  if (dapd <= 100.)
124  weight = 1.05 - dapd * 0.0005;
125  } else {
126  edm::LogWarning("HcalTBSim") << "HcalTB02SD: light coll curve : wrong "
127  << "distance to APD " << dapd << " crlength = " << crlength
128  << " crystal name = " << nameVolume << " z of localPoint = " << localPoint.z()
129  << " take weight = " << weight;
130  }
131 #ifdef EDM_ML_DEBUG
132  edm::LogVerbatim("HcalTBSim") << "HcalTB02SD, light coll curve : " << dapd << " crlength = " << crlength
133  << " crystal name = " << nameVolume << " z of localPoint = " << localPoint.z()
134  << " take weight = " << weight;
135 #endif
136  return weight;
137 }

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

Referenced by getEnergyDeposit().

◆ getEnergyDeposit()

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

Reimplemented from CaloSD.

Definition at line 88 of file HcalTB02SD.cc.

88  {
89  auto const preStepPoint = aStep->GetPreStepPoint();
90  std::string nameVolume = static_cast<std::string>(preStepPoint->GetPhysicalVolume()->GetName());
91 
92  // take into account light collection curve for crystals
93  double weight = 1.;
94  if (useWeight_)
95  weight *= curve_LY(nameVolume, preStepPoint);
96  if (useBirk_)
98  double edep = aStep->GetTotalEnergyDeposit() * weight;
99 #ifdef EDM_ML_DEBUG
100  edm::LogVerbatim("HcalTBSim") << "HcalTB02SD:: " << nameVolume << " Light Collection Efficiency " << weight
101  << " Weighted Energy Deposit " << edep / CLHEP::MeV << " MeV";
102 #endif
103  return edep;
104 }

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

◆ setDetUnitId()

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

Implements CaloSD.

Definition at line 106 of file HcalTB02SD.cc.

106  {
107  return (numberingScheme_ == nullptr ? 0 : (uint32_t)(numberingScheme_->getUnitID(aStep)));
108 }

References numberingScheme_.

◆ setNumberingScheme()

void HcalTB02SD::setNumberingScheme ( HcalTB02NumberingScheme scheme)

Definition at line 110 of file HcalTB02SD.cc.

110  {
111  if (scheme != nullptr) {
112  edm::LogVerbatim("HcalTBSim") << "HcalTB02SD: updates numbering scheme for " << GetName();
113  numberingScheme_.reset(scheme);
114  }
115 }

References numberingScheme_, and generator_cfi::scheme.

Referenced by HcalTB02SD().

Member Data Documentation

◆ birk1_

double HcalTB02SD::birk1_
private

Definition at line 49 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

◆ birk2_

double HcalTB02SD::birk2_
private

Definition at line 49 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

◆ birk3_

double HcalTB02SD::birk3_
private

Definition at line 49 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

◆ hcalTB02Parameters_

const HcalTB02Parameters* HcalTB02SD::hcalTB02Parameters_
private

Definition at line 50 of file HcalTB02SD.h.

Referenced by crystalLength(), and HcalTB02SD().

◆ numberingScheme_

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

Definition at line 47 of file HcalTB02SD.h.

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

◆ useBirk_

bool HcalTB02SD::useBirk_
private

Definition at line 48 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

◆ useWeight_

bool HcalTB02SD::useWeight_
private

Definition at line 48 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
HcalTB02SD::numberingScheme_
std::unique_ptr< HcalTB02NumberingScheme > numberingScheme_
Definition: HcalTB02SD.h:47
HcalTB02XtalNumberingScheme
Definition: HcalTB02XtalNumberingScheme.h:24
mps_merge.weight
weight
Definition: mps_merge.py:88
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HcalTB02SD::birk1_
double birk1_
Definition: HcalTB02SD.h:49
CaloSD::getAttenuation
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:517
MeV
const double MeV
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
HcalTB02SD::setNumberingScheme
void setNumberingScheme(HcalTB02NumberingScheme *scheme)
Definition: HcalTB02SD.cc:110
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
HcalTB02SD::birk2_
double birk2_
Definition: HcalTB02SD.h:49
CaloSD::setToLocal
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *) const
Definition: CaloSD.cc:373
HcalTB02SD::birk3_
double birk3_
Definition: HcalTB02SD.h:49
edm::ESHandle
Definition: DTSurvey.h:22
HcalTB02SD::hcalTB02Parameters_
const HcalTB02Parameters * hcalTB02Parameters_
Definition: HcalTB02SD.h:50
HcalTB02SD::useBirk_
bool useBirk_
Definition: HcalTB02SD.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
CaloSD::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)
Definition: CaloSD.cc:33
HcalTB02SD::useWeight_
bool useWeight_
Definition: HcalTB02SD.h:48
HcalTB02Parameters::lengthMap_
std::map< std::string, double > lengthMap_
Definition: HcalTB02Parameters.h:14
get
#define get
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
generator_cfi.scheme
scheme
Definition: generator_cfi.py:22
HcalTB02HcalNumberingScheme
Definition: HcalTB02HcalNumberingScheme.h:24
HcalTB02NumberingScheme
Definition: HcalTB02NumberingScheme.h:24
HcalTB02SD::curve_LY
double curve_LY(const std::string &, const G4StepPoint *)
Definition: HcalTB02SD.cc:117
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
HcalTB02SD::crystalLength
double crystalLength(const std::string &)
Definition: HcalTB02SD.cc:139
weight
Definition: weight.py:1
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
g
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