CMS 3D CMS Logo

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

#include <HCalSD.h>

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

Public Member Functions

 HCalSD (const std::string &, const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
uint32_t setDetUnitId (const G4Step *step) override
 
void setNumberingScheme (HcalNumberingScheme *)
 
 ~HCalSD () override=default
 
- 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 ()
 
- Public Member Functions inherited from Observer< const BeginOfJob * >
 Observer ()
 
void slotForUpdate (const BeginOfJob * iT)
 
virtual ~Observer ()
 

Protected Member Functions

bool filterHit (CaloG4Hit *, double) override
 
double getEnergyDeposit (const G4Step *) override
 
bool getFromLibrary (const G4Step *) override
 
void initRun () override
 
void update (const BeginOfJob *) override
 This routine will be called when the appropriate signal arrives. More...
 
- Protected Member Functions inherited from CaloSD
bool checkHit ()
 
CaloG4HitcreateNewHit (const G4Step *, const G4Track *)
 
virtual void endEvent ()
 
double getAttenuation (const G4Step *aStep, double birk1, double birk2, double birk3) const
 
virtual uint16_t getDepth (const G4Step *)
 
int getNumberOfHits ()
 
double getResponseWt (const G4Track *)
 
virtual int getTrackID (const G4Track *)
 
bool hitExists (const G4Step *)
 
virtual void initEvent (const BeginOfEvent *)
 
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

void fillLogVolumeVector (const std::string &, const std::vector< std::string > &, std::vector< const G4LogicalVolume * > &)
 
void getFromHFLibrary (const G4Step *step, bool &isKilled)
 
void getFromParam (const G4Step *step, bool &isKilled)
 
void getHitFibreBundle (const G4Step *step, bool type)
 
void getHitPMT (const G4Step *step)
 
void hitForFibre (const G4Step *step)
 
bool isItConicalBundle (const G4LogicalVolume *)
 
bool isItFibre (const G4LogicalVolume *)
 
bool isItFibre (const G4String &)
 
bool isItHF (const G4Step *)
 
bool isItHF (const G4String &)
 
bool isItinFidVolume (const G4ThreeVector &)
 
bool isItPMT (const G4LogicalVolume *)
 
bool isItScintillator (const G4Material *)
 
bool isItStraightBundle (const G4LogicalVolume *)
 
double layerWeight (int, const G4ThreeVector &, int, int)
 
void modifyDepth (HcalNumberingFromDDD::HcalID &id)
 
void plotHF (const G4ThreeVector &pos, bool emType)
 
void plotProfile (const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
 
void readWeightFromFile (const std::string &)
 
uint32_t setDetUnitId (int, const G4ThreeVector &, int, int)
 
uint32_t setDetUnitId (HcalNumberingFromDDD::HcalID &tmp)
 

Private Attributes

bool agingFlagHB
 
bool agingFlagHE
 
bool applyFidCut
 
double betaThr
 
double birk1
 
double birk2
 
double birk3
 
double deliveredLumi
 
int depth_
 
TH1F * dist_ [9]
 
double eminHitHB
 
double eminHitHE
 
double eminHitHF
 
double eminHitHO
 
std::vector< const G4LogicalVolume * > fibre1LV
 
std::vector< const G4LogicalVolume * > fibre2LV
 
std::vector< const G4LogicalVolume * > fibreLV
 
std::vector< std::string > fibreNames
 
std::vector< double > gpar
 
const HcalDDDSimConstantshcalConstants_
 
const HcalDDDSimulationConstantshcalSimConstants_
 
std::vector< int > hfLevels
 
std::vector< const G4LogicalVolume * > hfLV
 
std::vector< std::string > hfNames
 
std::unique_ptr< HFShowerhfshower
 
TH1F * hit_ [9]
 
TH1F * hzvem
 
TH1F * hzvhad
 
bool isHF
 
std::map< uint32_t, double > layerWeights
 
const HBHEDarkeningm_HBDarkening
 
std::unique_ptr< HcalTestNSm_HcalTestNS
 
const HBHEDarkeningm_HEDarkening
 
std::unique_ptr< HFDarkeningm_HFDarkening
 
std::vector< const G4Material * > materials
 
std::vector< std::string > matNames
 
bool neutralDensity
 
std::unique_ptr< HcalNumberingFromDDDnumberingFromDDD
 
std::unique_ptr< HcalNumberingSchemenumberingScheme
 
std::vector< const G4LogicalVolume * > pmtLV
 
std::unique_ptr< HFShowerFibreBundleshowerBundle
 
std::unique_ptr< HFShowerLibraryshowerLibrary
 
std::unique_ptr< HFShowerParamshowerParam
 
std::unique_ptr< HFShowerPMTshowerPMT
 
bool testNS_
 
bool testNumber
 
TH1F * time_ [9]
 
bool useBirk
 
bool useFibreBundle
 
bool useHF
 
bool useLayerWt
 
bool useParam
 
bool usePMTHit
 
bool useShowerLibrary
 
double weight_
 

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

Definition at line 38 of file HCalSD.h.

Constructor & Destructor Documentation

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

Definition at line 44 of file HCalSD.cc.

References agingFlagHB, agingFlagHE, applyFidCut, betaThr, birk1, birk2, birk3, deliveredLumi, dist_, eminHitHB, eminHitHE, eminHitHF, eminHitHO, Exception, fibre1LV, fibre2LV, fibreLV, fibreNames, FrontierConditions_GlobalTag_cff::file, fillLogVolumeVector(), g, edm::EventSetup::get(), HcalDDDSimConstants::getGparHF(), HcalDDDSimConstants::getMaxDepth(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), gpar, hcalConstants_, HcalSimulationParameters::hcalMaterialNames_, hcalSimConstants_, HcalDDDSimulationConstants::hcalsimpar(), HcalSimulationParameters::hfFibreConicalNames_, HcalSimulationParameters::hfFibreNames_, HcalSimulationParameters::hfFibreStraightNames_, hfLevels, HcalSimulationParameters::hfLevels_, hfLV, hfNames, HcalSimulationParameters::hfNames_, HcalSimulationParameters::hfPMTNames_, hfshower, hit_, hzvem, hzvhad, mps_fire::i, edm::Service< T >::isAvailable(), edm::ESHandleBase::isValid(), CaloSD::kmaxIon, CaloSD::kmaxNeutron, CaloSD::kmaxProton, SummaryClient_cfi::labels, m_HBDarkening, m_HcalTestNS, m_HEDarkening, m_HFDarkening, TFileDirectory::make(), materials, matNames, MeV, TFileService::mkdir(), Skims_PA_cff::name, neutralDensity, numberingFromDDD, numberingScheme, AlCaHLTBitMon_ParallelJobs::p, pmtLV, edm::ESHandle< T >::product(), readWeightFromFile(), generator_cfi::scheme, setNumberingScheme(), CaloSD::setParameterized(), showerBundle, showerLibrary, showerParam, showerPMT, AlCaHLTBitMon_QueryRunRegistry::string, CaloSD::suppressHeavy, groupFilesInBlocks::temp, testNS_, testNumber, compare::tfile, time_, overlapproblemtsosanalyzer_cfi::title, useBirk, useFibreBundle, useHF, useLayerWt, useParam, usePMTHit, useShowerLibrary, and relativeConstraints::value.

49  : CaloSD(name,
50  es,
51  clg,
52  p,
53  manager,
54  (float)(p.getParameter<edm::ParameterSet>("HCalSD").getParameter<double>("TimeSliceUnit")),
55  p.getParameter<edm::ParameterSet>("HCalSD").getParameter<bool>("IgnoreTrackID")),
56  hcalConstants_(nullptr),
57  hcalSimConstants_(nullptr),
58  m_HBDarkening(nullptr),
59  m_HEDarkening(nullptr),
60  isHF(false),
61  weight_(1.0),
62  depth_(1) {
63  numberingFromDDD.reset(nullptr);
64  numberingScheme.reset(nullptr);
65  showerLibrary.reset(nullptr);
66  hfshower.reset(nullptr);
67  showerParam.reset(nullptr);
68  showerPMT.reset(nullptr);
69  showerBundle.reset(nullptr);
70  m_HFDarkening.reset(nullptr);
71  m_HcalTestNS.reset(nullptr);
72 
73  //static SimpleConfigurable<double> bk1(0.013, "HCalSD:BirkC1");
74  //static SimpleConfigurable<double> bk2(0.0568,"HCalSD:BirkC2");
75  //static SimpleConfigurable<double> bk3(1.75, "HCalSD:BirkC3");
76  // Values from NIM 80 (1970) 239-244: as implemented in Geant3
77 
78  edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("HCalSD");
79  useBirk = m_HC.getParameter<bool>("UseBirkLaw");
80  birk1 = m_HC.getParameter<double>("BirkC1") * (g / (MeV * cm2));
81  birk2 = m_HC.getParameter<double>("BirkC2");
82  birk3 = m_HC.getParameter<double>("BirkC3");
83  useShowerLibrary = m_HC.getParameter<bool>("UseShowerLibrary");
84  useParam = m_HC.getParameter<bool>("UseParametrize");
85  testNumber = m_HC.getParameter<bool>("TestNumberingScheme");
86  neutralDensity = m_HC.getParameter<bool>("doNeutralDensityFilter");
87  usePMTHit = m_HC.getParameter<bool>("UsePMTHits");
88  betaThr = m_HC.getParameter<double>("BetaThreshold");
89  eminHitHB = m_HC.getParameter<double>("EminHitHB") * MeV;
90  eminHitHE = m_HC.getParameter<double>("EminHitHE") * MeV;
91  eminHitHO = m_HC.getParameter<double>("EminHitHO") * MeV;
92  eminHitHF = m_HC.getParameter<double>("EminHitHF") * MeV;
93  useFibreBundle = m_HC.getParameter<bool>("UseFibreBundleHits");
94  deliveredLumi = m_HC.getParameter<double>("DelivLuminosity");
95  agingFlagHB = m_HC.getParameter<bool>("HBDarkening");
96  agingFlagHE = m_HC.getParameter<bool>("HEDarkening");
97  bool agingFlagHF = m_HC.getParameter<bool>("HFDarkening");
98  useHF = m_HC.getUntrackedParameter<bool>("UseHF", true);
99  bool forTBHC = m_HC.getUntrackedParameter<bool>("ForTBHCAL", false);
100  bool forTBH2 = m_HC.getUntrackedParameter<bool>("ForTBH2", false);
101  useLayerWt = m_HC.getUntrackedParameter<bool>("UseLayerWt", false);
102  std::string file = m_HC.getUntrackedParameter<std::string>("WtFile", "None");
103  testNS_ = m_HC.getUntrackedParameter<bool>("TestNS", false);
104  edm::ParameterSet m_HF = p.getParameter<edm::ParameterSet>("HFShower");
105  applyFidCut = m_HF.getParameter<bool>("ApplyFiducialCut");
106 
107 #ifdef EDM_ML_DEBUG
108  edm::LogVerbatim("HcalSim") << "***************************************************"
109  << "\n"
110  << "* Constructing a HCalSD with name " << name << "\n"
111  << "\n"
112  << "***************************************************";
113 #endif
114  edm::LogVerbatim("HcalSim") << "HCalSD:: Use of HF code is set to " << useHF
115  << "\nUse of shower parametrization set to " << useParam
116  << "\nUse of shower library is set to " << useShowerLibrary << "\nUse PMT Hit is set to "
117  << usePMTHit << " with beta Threshold " << betaThr << "\nUSe of FibreBundle Hit set to "
118  << useFibreBundle << "\n Use of Birks law is set to " << useBirk
119  << " with three constants kB = " << birk1 << ", C1 = " << birk2 << ", C2 = " << birk3;
120  edm::LogVerbatim("HcalSim") << "HCalSD:: Suppression Flag " << suppressHeavy << " protons below " << kmaxProton
121  << " MeV,"
122  << " neutrons below " << kmaxNeutron << " MeV and"
123  << " ions below " << kmaxIon << " MeV\n"
124  << " Threshold for storing hits in HB: " << eminHitHB << " HE: " << eminHitHE
125  << " HO: " << eminHitHO << " HF: " << eminHitHF << "\n"
126  << "Delivered luminosity for Darkening " << deliveredLumi << " Flag (HE) " << agingFlagHE
127  << " Flag (HB) " << agingFlagHB << " Flag (HF) " << agingFlagHF << "\n"
128  << "Application of Fiducial Cut " << applyFidCut
129  << "Flag for test number|neutral density filter " << testNumber << " " << neutralDensity;
130 
131  // Get pointers to HcalDDDConstant and HcalSimulationParameters
133  es.get<HcalSimNumberingRecord>().get(hdc);
134  if (hdc.isValid()) {
135  hcalConstants_ = hdc.product();
136  } else {
137  edm::LogError("HcalSim") << "HCalSD : Cannot find HcalDDDSimConstant";
138  throw cms::Exception("Unknown", "HCalSD") << "Cannot find HcalDDDSimConstant\n";
139  }
140  if (forTBHC) {
141  useHF = false;
142  matNames.emplace_back("Scintillator");
143  } else {
145  es.get<HcalSimNumberingRecord>().get(hdsc);
146  if (hdsc.isValid()) {
147  hcalSimConstants_ = hdsc.product();
149  } else {
150  edm::LogError("HcalSim") << "HCalSD : Cannot find HcalDDDSimulationConstant";
151  throw cms::Exception("Unknown", "HCalSD") << "Cannot find HcalDDDSimulationConstant\n";
152  }
153  }
154 
156  if (testNumber || forTBH2) {
157  scheme = dynamic_cast<HcalNumberingScheme*>(new HcalTestNumberingScheme(forTBH2));
158  } else {
159  scheme = new HcalNumberingScheme();
160  }
161  setNumberingScheme(scheme);
162 
163  // always call getFromLibrary() method to identify HF region
164  setParameterized(true);
165 
166  const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
167  // std::vector<G4LogicalVolume *>::const_iterator lvcite;
168  const G4LogicalVolume* lv;
169  std::string attribute, value;
170 
171  if (useHF) {
172  if (useParam) {
173  showerParam = std::make_unique<HFShowerParam>(name, hcalConstants_, hcalSimConstants_->hcalsimpar(), p);
174  } else {
175  if (useShowerLibrary) {
176  showerLibrary = std::make_unique<HFShowerLibrary>(name, hcalConstants_, hcalSimConstants_->hcalsimpar(), p);
177  }
178  hfshower = std::make_unique<HFShower>(name, hcalConstants_, hcalSimConstants_->hcalsimpar(), p, 0);
179  }
180 
181  // HF volume names
183  const std::vector<int>& temp = hcalSimConstants_->hcalsimpar()->hfLevels_;
184 #ifdef EDM_ML_DEBUG
185  std::stringstream ss0;
186  ss0 << "HCalSD: Names to be tested for Volume = HF has " << hfNames.size() << " elements";
187 #endif
188  for (unsigned int i = 0; i < hfNames.size(); ++i) {
189  G4String namv = static_cast<G4String>(hfNames[i]);
190  lv = nullptr;
191  for (auto lvol : *lvs) {
192  if (lvol->GetName() == namv) {
193  lv = lvol;
194  break;
195  }
196  }
197  hfLV.emplace_back(lv);
198  hfLevels.emplace_back(temp[i]);
199 #ifdef EDM_ML_DEBUG
200  ss0 << "\n HF[" << i << "] = " << namv << " LV " << lv << " at level " << temp[i];
201 #endif
202  }
203 #ifdef EDM_ML_DEBUG
204  edm::LogVerbatim("HcalSim") << ss0.str();
205 #endif
206  // HF Fibre volume names
209  const std::vector<std::string>& pmtNames = hcalSimConstants_->hcalsimpar()->hfPMTNames_;
210  fillLogVolumeVector("HFPMT", pmtNames, pmtLV);
211  const std::vector<std::string>& straightNames = hcalSimConstants_->hcalsimpar()->hfFibreStraightNames_;
212  fillLogVolumeVector("HFFibreBundleStraight", straightNames, fibre1LV);
213  const std::vector<std::string>& conicalNames = hcalSimConstants_->hcalsimpar()->hfFibreConicalNames_;
214  fillLogVolumeVector("HFFibreBundleConical", conicalNames, fibre2LV);
215  }
216 
217  //Material list for HB/HE/HO sensitive detectors
218  const G4MaterialTable* matTab = G4Material::GetMaterialTable();
219  std::vector<G4Material*>::const_iterator matite;
220  for (auto const& namx : matNames) {
221  const G4Material* mat = nullptr;
222  for (matite = matTab->begin(); matite != matTab->end(); ++matite) {
223  if ((*matite)->GetName() == static_cast<G4String>(namx)) {
224  mat = (*matite);
225  break;
226  }
227  }
228  materials.emplace_back(mat);
229  }
230 #ifdef EDM_ML_DEBUG
231  std::stringstream ss1;
232  for (unsigned int i = 0; i < matNames.size(); ++i) {
233  if (i / 10 * 10 == i) {
234  ss1 << "\n";
235  }
236  ss1 << " " << matNames[i];
237  }
238  edm::LogVerbatim("HcalSim") << "HCalSD: Material names for HCAL: " << ss1.str();
239 #endif
240  if (useLayerWt) {
241  readWeightFromFile(file);
242  }
243  numberingFromDDD = std::make_unique<HcalNumberingFromDDD>(hcalConstants_);
244 
245  //Special Geometry parameters
246  gpar = hcalConstants_->getGparHF();
247 #ifdef EDM_ML_DEBUG
248  std::stringstream ss2;
249  for (unsigned int ig = 0; ig < gpar.size(); ig++) {
250  ss2 << "\n gpar[" << ig << "] = " << gpar[ig] / cm << " cm";
251  }
252  edm::LogVerbatim("HcalSim") << "Maximum depth for HF " << hcalConstants_->getMaxDepth(2) << gpar.size()
253  << " gpar (cm)" << ss2.str();
254 #endif
255 
256  //Test Hcal Numbering Scheme
257  if (testNS_)
258  m_HcalTestNS = std::make_unique<HcalTestNS>(&es);
259 
260  if (agingFlagHB) {
262  es.get<HBHEDarkeningRecord>().get("HB", hdark);
263  m_HBDarkening = &*hdark;
264  }
265  if (agingFlagHE) {
267  es.get<HBHEDarkeningRecord>().get("HE", hdark);
268  m_HEDarkening = &*hdark;
269  }
270 
271  for (int i = 0; i < 9; ++i) {
272  hit_[i] = time_[i] = dist_[i] = nullptr;
273  }
274  hzvem = hzvhad = nullptr;
275 
276  if (agingFlagHF) {
277  m_HFDarkening = std::make_unique<HFDarkening>(m_HC.getParameter<edm::ParameterSet>("HFDarkeningParameterBlock"));
278  }
279 #ifdef plotDebug
281 
282  if (tfile.isAvailable()) {
283  static const char* const labels[] = {"HB",
284  "HE",
285  "HO",
286  "HF Absorber",
287  "HF PMT",
288  "HF Absorber Long",
289  "HF Absorber Short",
290  "HF PMT Long",
291  "HF PMT Short"};
292  TFileDirectory hcDir = tfile->mkdir("ProfileFromHCalSD");
293  char name[20], title[60];
294  for (int i = 0; i < 9; ++i) {
295  sprintf(title, "Hit energy in %s", labels[i]);
296  sprintf(name, "HCalSDHit%d", i);
297  hit_[i] = hcDir.make<TH1F>(name, title, 2000, 0., 2000.);
298  sprintf(title, "Energy (MeV)");
299  hit_[i]->GetXaxis()->SetTitle(title);
300  hit_[i]->GetYaxis()->SetTitle("Hits");
301  sprintf(title, "Time of the hit in %s", labels[i]);
302  sprintf(name, "HCalSDTime%d", i);
303  time_[i] = hcDir.make<TH1F>(name, title, 2000, 0., 2000.);
304  sprintf(title, "Time (ns)");
305  time_[i]->GetXaxis()->SetTitle(title);
306  time_[i]->GetYaxis()->SetTitle("Hits");
307  sprintf(title, "Longitudinal profile in %s", labels[i]);
308  sprintf(name, "HCalSDDist%d", i);
309  dist_[i] = hcDir.make<TH1F>(name, title, 2000, 0., 2000.);
310  sprintf(title, "Distance (mm)");
311  dist_[i]->GetXaxis()->SetTitle(title);
312  dist_[i]->GetYaxis()->SetTitle("Hits");
313  }
314  if (useHF && (!useParam)) {
315  hzvem = hcDir.make<TH1F>("hzvem", "Longitudinal Profile (EM Part)", 330, 0.0, 1650.0);
316  hzvem->GetXaxis()->SetTitle("Longitudinal Profile (EM Part)");
317  hzvhad = hcDir.make<TH1F>("hzvhad", "Longitudinal Profile (Had Part)", 330, 0.0, 1650.0);
318  hzvhad->GetXaxis()->SetTitle("Longitudinal Profile (Hadronic Part)");
319  }
320  }
321 #endif
322 }
T getParameter(std::string const &) const
std::vector< std::string > matNames
Definition: HCalSD.h:110
T getUntrackedParameter(std::string const &, T const &) const
void readWeightFromFile(const std::string &)
Definition: HCalSD.cc:928
std::vector< const G4LogicalVolume * > hfLV
Definition: HCalSD.h:112
bool useParam
Definition: HCalSD.h:101
double eminHitHE
Definition: HCalSD.h:102
TH1F * time_[9]
Definition: HCalSD.h:114
double kmaxNeutron
Definition: CaloSD.h:138
void fillLogVolumeVector(const std::string &, const std::vector< std::string > &, std::vector< const G4LogicalVolume * > &)
Definition: HCalSD.cc:324
bool useLayerWt
Definition: HCalSD.h:98
std::vector< std::string > fibreNames
Definition: HCalSD.h:109
std::unique_ptr< HFShowerParam > showerParam
Definition: HCalSD.h:85
double weight_
Definition: HCalSD.h:104
std::vector< double > gpar
Definition: HCalSD.h:106
bool useFibreBundle
Definition: HCalSD.h:98
const HcalDDDSimConstants * hcalConstants_
Definition: HCalSD.h:89
double betaThr
Definition: HCalSD.h:100
std::vector< std::string > hfNames_
double deliveredLumi
Definition: HCalSD.h:103
std::vector< std::string > hfFibreNames_
double eminHitHB
Definition: HCalSD.h:102
bool useShowerLibrary
Definition: HCalSD.h:101
std::vector< std::string > hfNames
Definition: HCalSD.h:108
double birk2
Definition: HCalSD.h:100
bool usePMTHit
Definition: HCalSD.h:98
std::vector< const G4LogicalVolume * > fibre2LV
Definition: HCalSD.h:112
void setNumberingScheme(HcalNumberingScheme *)
Definition: HCalSD.cc:550
bool agingFlagHE
Definition: HCalSD.h:97
double birk1
Definition: HCalSD.h:100
double kmaxProton
Definition: CaloSD.h:138
std::unique_ptr< HFShowerPMT > showerPMT
Definition: HCalSD.h:86
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
TH1F * hzvhad
Definition: HCalSD.h:114
double eminHitHF
Definition: HCalSD.h:102
const double MeV
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
Definition: HCalSD.h:81
TH1F * hit_[9]
Definition: HCalSD.h:114
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
bool agingFlagHB
Definition: HCalSD.h:97
bool testNumber
Definition: HCalSD.h:99
double kmaxIon
Definition: CaloSD.h:138
bool suppressHeavy
Definition: CaloSD.h:137
std::vector< std::string > hfFibreConicalNames_
bool useBirk
Definition: HCalSD.h:98
std::unique_ptr< HFDarkening > m_HFDarkening
Definition: HCalSD.h:93
double birk3
Definition: HCalSD.h:100
const HBHEDarkening * m_HEDarkening
Definition: HCalSD.h:92
bool isAvailable() const
Definition: Service.h:40
bool applyFidCut
Definition: HCalSD.h:101
TH1F * dist_[9]
Definition: HCalSD.h:114
std::unique_ptr< HcalTestNS > m_HcalTestNS
Definition: HCalSD.h:94
T * make(const Args &...args) const
make new ROOT object
std::vector< int > hfLevels
Definition: HCalSD.h:107
bool testNS_
Definition: HCalSD.h:99
double eminHitHO
Definition: HCalSD.h:102
const HcalSimulationParameters * hcalsimpar() const
TH1F * hzvem
Definition: HCalSD.h:114
std::vector< const G4LogicalVolume * > pmtLV
Definition: HCalSD.h:112
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
bool neutralDensity
Definition: HCalSD.h:99
bool isHF
Definition: HCalSD.h:96
std::vector< std::string > hcalMaterialNames_
std::unique_ptr< HFShowerFibreBundle > showerBundle
Definition: HCalSD.h:87
std::vector< std::string > hfPMTNames_
std::unique_ptr< HFShowerLibrary > showerLibrary
Definition: HCalSD.h:83
int depth_
Definition: HCalSD.h:105
T get() const
Definition: EventSetup.h:73
std::vector< std::string > hfFibreStraightNames_
std::unique_ptr< HcalNumberingScheme > numberingScheme
Definition: HCalSD.h:82
std::unique_ptr< HFShower > hfshower
Definition: HCalSD.h:84
std::vector< const G4LogicalVolume * > fibreLV
Definition: HCalSD.h:112
bool isValid() const
Definition: ESHandle.h:44
std::vector< const G4LogicalVolume * > fibre1LV
Definition: HCalSD.h:112
std::vector< const G4Material * > materials
Definition: HCalSD.h:111
T const * product() const
Definition: ESHandle.h:86
const HBHEDarkening * m_HBDarkening
Definition: HCalSD.h:91
bool useHF
Definition: HCalSD.h:101
void setParameterized(bool val)
Definition: CaloSD.h:100
const HcalDDDSimulationConstants * hcalSimConstants_
Definition: HCalSD.h:90
HCalSD::~HCalSD ( )
overridedefault

Member Function Documentation

void HCalSD::fillLogVolumeVector ( const std::string &  value,
const std::vector< std::string > &  lvnames,
std::vector< const G4LogicalVolume * > &  lvvec 
)
private

Definition at line 324 of file HCalSD.cc.

References mps_fire::i.

Referenced by HCalSD().

326  {
327  const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
328  const G4LogicalVolume* lv;
329  std::stringstream ss3;
330  ss3 << "HCalSD: " << lvnames.size() << " names to be tested for Volume <" << value << ">:";
331  for (unsigned int i = 0; i < lvnames.size(); ++i) {
332  G4String namv = static_cast<G4String>(lvnames[i]);
333  lv = nullptr;
334  for (auto lvol : *lvs) {
335  if (lvol->GetName() == namv) {
336  lv = lvol;
337  break;
338  }
339  }
340  lvvec.emplace_back(lv);
341  if (i / 10 * 10 == i) {
342  ss3 << "\n";
343  }
344  ss3 << " " << namv;
345  }
346  edm::LogVerbatim("HcalSim") << ss3.str();
347 }
Definition: value.py:1
bool HCalSD::filterHit ( CaloG4Hit aHit,
double  time 
)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 561 of file HCalSD.cc.

References eminHitHB, eminHitHE, eminHitHF, eminHitHO, CaloG4Hit::getEnergyDeposit(), CaloG4Hit::getUnitID(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, MessageLogger_cff::threshold, and CaloSD::tmaxHit.

561  {
562  double threshold = 0;
563  DetId theId(aHit->getUnitID());
564  switch (theId.subdetId()) {
565  case HcalBarrel:
566  threshold = eminHitHB;
567  break;
568  case HcalEndcap:
569  threshold = eminHitHE;
570  break;
571  case HcalOuter:
572  threshold = eminHitHO;
573  break;
574  case HcalForward:
575  threshold = eminHitHF;
576  break;
577  default:
578  break;
579  }
580  return ((time <= tmaxHit) && (aHit->getEnergyDeposit() > threshold));
581 }
double eminHitHE
Definition: HCalSD.h:102
double eminHitHB
Definition: HCalSD.h:102
double eminHitHF
Definition: HCalSD.h:102
double eminHitHO
Definition: HCalSD.h:102
double tmaxHit
Definition: CaloSD.h:133
Definition: DetId.h:17
uint32_t getUnitID() const
Definition: CaloG4Hit.h:65
double getEnergyDeposit() const
Definition: CaloG4Hit.h:77
double HCalSD::getEnergyDeposit ( const G4Step *  aStep)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 406 of file HCalSD.cc.

References birk1, birk2, birk3, HBHEDarkening::degradation(), deliveredLumi, LEDCalibrationChannels::depth, depth_, CaloSD::getAttenuation(), getHitFibreBundle(), getHitPMT(), HcalDDDSimConstants::getLayer0Wt(), CaloSD::getResponseWt(), hcalConstants_, hitForFibre(), LEDCalibrationChannels::ieta, HcalDetId::ietaAbs(), HcalDetId::iphi(), isHF, isItConicalBundle(), isItFibre(), isItPMT(), isItScintillator(), isItStraightBundle(), G4TrackToParticleID::isMuon(), TrackInformation::isPrimary(), ke, CaloSD::kmaxIon, CaloSD::kmaxNeutron, CaloSD::kmaxProton, layerWeight(), m_HBDarkening, m_HEDarkening, neutralDensity, phi, setDetUnitId(), showerBundle, showerPMT, DetId::subdetId(), CaloSD::suppressHeavy, testNumber, HcalTestNumbering::unpackHcalIndex(), useBirk, useFibreBundle, useLayerWt, usePMTHit, useShowerLibrary, weight_, z, and HcalDetId::zside().

406  {
407  double destep(0.0);
408  auto const lv = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
409  auto const theTrack = aStep->GetTrack();
410 
411  if (isHF) {
412  if (useShowerLibrary && G4TrackToParticleID::isMuon(theTrack) && isItFibre(lv)) {
413 #ifdef EDM_ML_DEBUG
414  edm::LogVerbatim("HcalSim") << "HCalSD: Hit at Fibre in LV " << lv->GetName() << " for track "
415  << aStep->GetTrack()->GetTrackID() << " ("
416  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
417 #endif
418  hitForFibre(aStep);
419  }
420  return destep;
421  }
422 
423  if (isItPMT(lv)) {
424  if (usePMTHit && showerPMT) {
425  getHitPMT(aStep);
426  }
427 #ifdef EDM_ML_DEBUG
428  edm::LogVerbatim("HcalSim") << "HCalSD: Hit from PMT parametrization in LV " << lv->GetName() << " for Track "
429  << aStep->GetTrack()->GetTrackID() << " ("
430  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
431 #endif
432  return destep;
433 
434  } else if (isItStraightBundle(lv)) {
435  if (useFibreBundle && showerBundle) {
436  getHitFibreBundle(aStep, false);
437  }
438 #ifdef EDM_ML_DEBUG
439  edm::LogVerbatim("HcalSim") << "HCalSD: Hit from straight FibreBundle in LV: " << lv->GetName() << " for track "
440  << aStep->GetTrack()->GetTrackID() << " ("
441  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
442 #endif
443  return destep;
444 
445  } else if (isItConicalBundle(lv)) {
446  if (useFibreBundle && showerBundle) {
447  getHitFibreBundle(aStep, true);
448  }
449 #ifdef EDM_ML_DEBUG
450  edm::LogVerbatim("HcalSim") << "HCalSD: Hit from conical FibreBundle PV: " << lv->GetName() << " for track "
451  << aStep->GetTrack()->GetTrackID() << " ("
452  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
453 #endif
454  return destep;
455  }
456 
457  // normal hit
458  destep = aStep->GetTotalEnergyDeposit();
459 
460  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
461  uint32_t detid = setDetUnitId(aStep);
462  int det(0), ieta(0), phi(0), z(0), lay, depth(-1);
463  if (testNumber) {
464  HcalTestNumbering::unpackHcalIndex(detid, det, z, depth, ieta, phi, lay);
465  if (z == 0) {
466  z = -1;
467  }
468  } else {
469  HcalDetId hcid(detid);
470  det = hcid.subdetId();
471  ieta = hcid.ietaAbs();
472  phi = hcid.iphi();
473  z = hcid.zside();
474  }
475  lay = (touch->GetReplicaNumber(0) / 10) % 100 + 1;
476 #ifdef EDM_ML_DEBUG
477  edm::LogVerbatim("HcalSim") << "HCalSD: det: " << det << " ieta: " << ieta << " iphi: " << phi << " zside " << z
478  << " lay: " << lay - 2;
479 #endif
480  if (depth_ == 0 && (det == 1 || det == 2) && ((!testNumber) || neutralDensity))
482  if (useLayerWt) {
483  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
484  weight_ = layerWeight(det + 2, hitPoint, depth_, lay);
485  }
486 
487  if (m_HBDarkening && det == 1) {
488  double dweight = m_HBDarkening->degradation(deliveredLumi, ieta, lay);
489  weight_ *= dweight;
490 #ifdef EDM_ML_DEBUG
491  edm::LogVerbatim("HcalSim") << "HCalSD: HB Lumi: " << deliveredLumi << " coefficient = " << dweight
492  << " Weight= " << weight_;
493 #endif
494  }
495 
496  if (m_HEDarkening && det == 2) {
497  double dweight = m_HEDarkening->degradation(deliveredLumi, ieta, lay);
498  weight_ *= dweight;
499 #ifdef EDM_ML_DEBUG
500  edm::LogVerbatim("HcalSim") << "HCalSD: HB Lumi: " << deliveredLumi << " coefficient = " << dweight
501  << " Weight= " << weight_;
502 #endif
503  }
504 
505  if (suppressHeavy) {
506  TrackInformation* trkInfo = (TrackInformation*)(theTrack->GetUserInformation());
507  if (trkInfo) {
508  int pdg = theTrack->GetDefinition()->GetPDGEncoding();
509  if (!(trkInfo->isPrimary())) { // Only secondary particles
510  double ke = theTrack->GetKineticEnergy();
511  if (pdg / 1000000000 == 1 && (pdg / 10000) % 100 > 0 && (pdg / 10) % 100 > 0 && ke < kmaxIon)
512  weight_ = 0;
513  if ((pdg == 2212) && (ke < kmaxProton))
514  weight_ = 0;
515  if ((pdg == 2112) && (ke < kmaxNeutron))
516  weight_ = 0;
517  }
518  }
519  }
520  if (useBirk) {
521  const G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
522  if (isItScintillator(mat))
523  weight_ *= getAttenuation(aStep, birk1, birk2, birk3);
524  }
525  double wt1 = getResponseWt(theTrack);
526  double wt2 = theTrack->GetWeight();
527  double edep = weight_ * wt1 * destep;
528  if (wt2 > 0.0) {
529  edep *= wt2;
530  }
531 #ifdef EDM_ML_DEBUG
532  edm::LogVerbatim("HcalSim") << "HCalSD: edep= " << edep << " Det: " << det + 2 << " depth= " << depth_
533  << " weight= " << weight_ << " wt1= " << wt1 << " wt2= " << wt2;
534 #endif
535  return edep;
536 }
double kmaxNeutron
Definition: CaloSD.h:138
void hitForFibre(const G4Step *step)
Definition: HCalSD.cc:735
static bool isMuon(int pdgCode)
bool useLayerWt
Definition: HCalSD.h:98
double weight_
Definition: HCalSD.h:104
bool useFibreBundle
Definition: HCalSD.h:98
const HcalDDDSimConstants * hcalConstants_
Definition: HCalSD.h:89
double deliveredLumi
Definition: HCalSD.h:103
bool useShowerLibrary
Definition: HCalSD.h:101
double birk2
Definition: HCalSD.h:100
bool usePMTHit
Definition: HCalSD.h:98
double birk1
Definition: HCalSD.h:100
double kmaxProton
Definition: CaloSD.h:138
std::unique_ptr< HFShowerPMT > showerPMT
Definition: HCalSD.h:86
bool isItConicalBundle(const G4LogicalVolume *)
Definition: HCalSD.cc:660
bool testNumber
Definition: HCalSD.h:99
double kmaxIon
Definition: CaloSD.h:138
bool suppressHeavy
Definition: CaloSD.h:137
bool useBirk
Definition: HCalSD.h:98
double birk3
Definition: HCalSD.h:100
const HBHEDarkening * m_HEDarkening
Definition: HCalSD.h:92
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:538
double getLayer0Wt(const int &det, const int &phi, const int &zside) const
bool isItStraightBundle(const G4LogicalVolume *)
Definition: HCalSD.cc:652
bool neutralDensity
Definition: HCalSD.h:99
bool isHF
Definition: HCalSD.h:96
void getHitFibreBundle(const G4Step *step, bool type)
Definition: HCalSD.cc:866
int ke
bool isPrimary() const
std::unique_ptr< HFShowerFibreBundle > showerBundle
Definition: HCalSD.h:87
bool isItPMT(const G4LogicalVolume *)
Definition: HCalSD.cc:644
void getHitPMT(const G4Step *step)
Definition: HCalSD.cc:807
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:434
double layerWeight(int, const G4ThreeVector &, int, int)
Definition: HCalSD.cc:952
int depth_
Definition: HCalSD.h:105
bool isItScintillator(const G4Material *)
Definition: HCalSD.cc:668
double getResponseWt(const G4Track *)
Definition: CaloSD.cc:620
const HBHEDarkening * m_HBDarkening
Definition: HCalSD.h:91
float degradation(float intlumi, int ieta, int lay) const
bool isItFibre(const G4LogicalVolume *)
Definition: HCalSD.cc:628
void HCalSD::getFromHFLibrary ( const G4Step *  step,
bool &  isKilled 
)
private

Definition at line 692 of file HCalSD.cc.

References CaloSD::currentID, LEDCalibrationChannels::depth, CaloSD::edepositEM, CaloSD::edepositHAD, GeV, hfClusterShapes_cfi::hits, mps_fire::i, G4TrackToParticleID::isGammaElectronPositron(), isItinFidVolume(), plotHF(), plotProfile(), CaloSD::processHit(), CaloSD::resetForNewPrimary(), setDetUnitId(), CaloHitID::setID(), CaloSD::setTrackID(), showerLibrary, ntuplemaker::time, and weight_.

Referenced by getFromLibrary().

692  {
693  std::vector<HFShowerLibrary::Hit> hits = showerLibrary->getHits(aStep, isKilled, weight_, false);
694  if (!isKilled || hits.empty()) {
695  return;
696  }
697 
698  int primaryID = setTrackID(aStep);
699 
700  // Reset entry point for new primary
701  resetForNewPrimary(aStep);
702 
703  auto const theTrack = aStep->GetTrack();
704  int det = 5;
705 
707  edepositEM = 1. * GeV;
708  edepositHAD = 0.;
709  } else {
710  edepositEM = 0.;
711  edepositHAD = 1. * GeV;
712  }
713 #ifdef EDM_ML_DEBUG
714  edm::LogVerbatim("HcalSim") << "HCalSD::getFromLibrary " << hits.size() << " hits for " << GetName() << " of "
715  << primaryID << " with " << theTrack->GetDefinition()->GetParticleName() << " of "
716  << aStep->GetPreStepPoint()->GetKineticEnergy() / GeV << " GeV";
717 #endif
718  for (unsigned int i = 0; i < hits.size(); ++i) {
719  G4ThreeVector hitPoint = hits[i].position;
720  if (isItinFidVolume(hitPoint)) {
721  int depth = hits[i].depth;
722  double time = hits[i].time;
723  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
724  currentID.setID(unitID, time, primaryID, 0);
725 #ifdef plotDebug
726  plotProfile(aStep, hitPoint, 1.0 * GeV, time, depth);
727  bool emType = G4TrackToParticleID::isGammaElectronPositron(theTrack->GetDefinition()->GetPDGEncoding());
728  plotHF(hitPoint, emType);
729 #endif
730  processHit(aStep);
731  }
732  }
733 }
float edepositEM
Definition: CaloSD.h:129
const double GeV
Definition: MathUtil.h:16
double weight_
Definition: HCalSD.h:104
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:972
void processHit(const G4Step *step)
Definition: CaloSD.h:103
float edepositHAD
Definition: CaloSD.h:129
void resetForNewPrimary(const G4Step *)
Definition: CaloSD.cc:421
void plotHF(const G4ThreeVector &pos, bool emType)
Definition: HCalSD.cc:1032
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:538
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:40
CaloHitID currentID
Definition: CaloSD.h:131
bool isItinFidVolume(const G4ThreeVector &)
Definition: HCalSD.cc:676
std::unique_ptr< HFShowerLibrary > showerLibrary
Definition: HCalSD.h:83
virtual int setTrackID(const G4Step *)
Definition: CaloSD.cc:589
static bool isGammaElectronPositron(int pdgCode)
bool HCalSD::getFromLibrary ( const G4Step *  aStep)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 349 of file HCalSD.cc.

References funct::abs(), deliveredLumi, depth_, getFromHFLibrary(), getFromParam(), CaloSD::getNumberOfHits(), mps_fire::i, createfilelist::int, G4TrackToParticleID::isGammaElectronPositron(), isHF, isItHF(), G4TrackToParticleID::isMuon(), G4TrackToParticleID::isStableHadronIon(), HFDarkening::lowZLimit, m_HFDarkening, HFDarkening::numberOfZLayers, alignCSCRings::r, HLT_2018_cff::track, HFDarkening::upperZLimit, useParam, useShowerLibrary, weight_, and z.

349  {
350  auto const track = aStep->GetTrack();
351  depth_ = (aStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber(0)) % 10;
352  weight_ = 1.0;
353  bool kill(false);
354  isHF = isItHF(aStep);
355  if (isHF) {
356  if (m_HFDarkening) {
357  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
358  const double invcm = 1. / CLHEP::cm;
359  double r = hitPoint.perp() * invcm;
360  double z = std::abs(hitPoint.z()) * invcm;
361  double dose_acquired = 0.;
363  unsigned int hfZLayer = (unsigned int)((z - HFDarkening::lowZLimit) / 5);
364  if (hfZLayer >= HFDarkening::upperZLimit)
365  hfZLayer = (HFDarkening::upperZLimit - 1);
366  float normalized_lumi = m_HFDarkening->int_lumi(deliveredLumi);
367  for (int i = hfZLayer; i != HFDarkening::numberOfZLayers; ++i) {
368  dose_acquired = m_HFDarkening->dose(i, r);
369  weight_ *= m_HFDarkening->degradation(normalized_lumi * dose_acquired);
370  }
371  }
372 #ifdef EDM_ML_DEBUG
373  edm::LogVerbatim("HcalSim") << "HCalSD::getFromLibrary: HFLumiDarkening at "
374  << "r= " << r << ", z= " << z << " Dose= " << dose_acquired << " weight= " << weight_;
375 #endif
376  }
377 
378  if (useParam) {
379  getFromParam(aStep, kill);
380 #ifdef EDM_ML_DEBUG
381  G4String nameVolume = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
382  edm::LogVerbatim("HcalSim") << "HCalSD: " << getNumberOfHits() << " hits from parametrization in " << nameVolume
383  << " for Track " << track->GetTrackID() << " ("
384  << track->GetDefinition()->GetParticleName() << ")";
385 #endif
388 #ifdef EDM_ML_DEBUG
389  auto nameVolume = aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName();
390  edm::LogVerbatim("HcalSim") << "HCalSD: Starts shower library from " << nameVolume << " for Track "
391  << track->GetTrackID() << " (" << track->GetDefinition()->GetParticleName() << ")";
392 
393 #endif
394  getFromHFLibrary(aStep, kill);
395  }
396  }
397  }
398 #ifdef EDM_ML_DEBUG
399  edm::LogVerbatim("HcalSim") << "HCalSD::getFromLibrary ID= " << track->GetTrackID() << " ("
400  << track->GetDefinition()->GetParticleName() << ") kill= " << kill
401  << " weight= " << weight_ << " depth= " << depth_ << " isHF: " << isHF;
402 #endif
403  return kill;
404 }
bool useParam
Definition: HCalSD.h:101
static bool isMuon(int pdgCode)
double weight_
Definition: HCalSD.h:104
double deliveredLumi
Definition: HCalSD.h:103
bool useShowerLibrary
Definition: HCalSD.h:101
static const unsigned int numberOfZLayers
Definition: HFDarkening.h:24
std::unique_ptr< HFDarkening > m_HFDarkening
Definition: HCalSD.h:93
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int getNumberOfHits()
Definition: CaloSD.cc:342
void getFromParam(const G4Step *step, bool &isKilled)
Definition: HCalSD.cc:777
void getFromHFLibrary(const G4Step *step, bool &isKilled)
Definition: HCalSD.cc:692
static bool isStableHadronIon(const G4Track *)
static const unsigned int lowZLimit
Definition: HFDarkening.h:27
static const unsigned int upperZLimit
Definition: HFDarkening.h:28
bool isHF
Definition: HCalSD.h:96
int depth_
Definition: HCalSD.h:105
bool isItHF(const G4Step *)
Definition: HCalSD.cc:607
static bool isGammaElectronPositron(int pdgCode)
void HCalSD::getFromParam ( const G4Step *  step,
bool &  isKilled 
)
private

Definition at line 777 of file HCalSD.cc.

References CaloSD::currentID, LEDCalibrationChannels::depth, CaloSD::edepositEM, CaloSD::edepositHAD, GeV, hfClusterShapes_cfi::hits, mps_fire::i, plotProfile(), CaloSD::processHit(), setDetUnitId(), CaloHitID::setID(), CaloSD::setTrackID(), showerParam, ntuplemaker::time, and weight_.

Referenced by getFromLibrary().

777  {
778  std::vector<HFShowerParam::Hit> hits = showerParam->getHits(aStep, weight_, isKilled);
779  if (!isKilled || hits.empty()) {
780  return;
781  }
782 
783  int primaryID = setTrackID(aStep);
784  int det = 5;
785 
786 #ifdef EDM_ML_DEBUG
787  edm::LogVerbatim("HcalSim") << "HCalSD::getFromParam " << hits.size() << " hits for " << GetName() << " of "
788  << primaryID << " with " << aStep->GetTrack()->GetDefinition()->GetParticleName()
789  << " of " << aStep->GetPreStepPoint()->GetKineticEnergy() / GeV
790  << " GeV in detector type " << det;
791 #endif
792  for (unsigned int i = 0; i < hits.size(); ++i) {
793  G4ThreeVector hitPoint = hits[i].position;
794  int depth = hits[i].depth;
795  double time = hits[i].time;
796  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
797  currentID.setID(unitID, time, primaryID, 0);
798  edepositEM = hits[i].edep * GeV;
799  edepositHAD = 0.;
800 #ifdef plotDebug
801  plotProfile(aStep, hitPoint, edepositEM, time, depth);
802 #endif
803  processHit(aStep);
804  }
805 }
float edepositEM
Definition: CaloSD.h:129
const double GeV
Definition: MathUtil.h:16
std::unique_ptr< HFShowerParam > showerParam
Definition: HCalSD.h:85
double weight_
Definition: HCalSD.h:104
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:972
void processHit(const G4Step *step)
Definition: CaloSD.h:103
float edepositHAD
Definition: CaloSD.h:129
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:538
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:40
CaloHitID currentID
Definition: CaloSD.h:131
virtual int setTrackID(const G4Step *)
Definition: CaloSD.cc:589
void HCalSD::getHitFibreBundle ( const G4Step *  step,
bool  type 
)
private

Definition at line 866 of file HCalSD.cc.

References zMuMuMuonUserData::beta, CaloSD::currentID, TauDecayModes::dec, LEDCalibrationChannels::depth, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::energyCut, GeV, HcalForward, numberingFromDDD, phi, plotProfile(), CaloSD::processHit(), CaloSD::resetForNewPrimary(), findQualityFiles::rr, setDetUnitId(), CaloHitID::setID(), showerBundle, ntuplemaker::time, and createJobs::tmp.

Referenced by getEnergyDeposit().

866  {
867  auto const preStepPoint = aStep->GetPreStepPoint();
868  auto const theTrack = aStep->GetTrack();
869  double edep = showerBundle->getHits(aStep, type);
870 
871  if (edep >= 0.0) {
872  edep *= GeV;
873  double etrack = preStepPoint->GetKineticEnergy();
874  int primaryID = 0;
875  if (etrack >= energyCut) {
876  primaryID = theTrack->GetTrackID();
877  } else {
878  primaryID = theTrack->GetParentID();
879  if (primaryID == 0)
880  primaryID = theTrack->GetTrackID();
881  }
882  // Reset entry point for new primary
883  resetForNewPrimary(aStep);
884  //
885  int det = static_cast<int>(HcalForward);
886  const G4ThreeVector& hitPoint = preStepPoint->GetPosition();
887  double rr = hitPoint.x() * hitPoint.x() + hitPoint.y() * hitPoint.y();
888  double phi = rr == 0. ? 0. : atan2(hitPoint.y(), hitPoint.x());
889  double etaR = showerBundle->getRadius();
890  int depth = 1;
891  if (etaR < 0.) {
892  depth = 2;
893  etaR = -etaR;
894  }
895  if (hitPoint.z() < 0.)
896  etaR = -etaR;
897 #ifdef EDM_ML_DEBUG
898  edm::LogVerbatim("HcalSim") << "HCalSD::Hit for Detector " << det << " etaR " << etaR << " phi " << phi / deg
899  << " depth " << depth;
900 #endif
901  double time = (aStep->GetPostStepPoint()->GetGlobalTime());
902  uint32_t unitID = 0;
903  if (numberingFromDDD) {
904  HcalNumberingFromDDD::HcalID tmp = numberingFromDDD->unitID(det, etaR, phi, depth, 1);
905  unitID = setDetUnitId(tmp);
906  }
907  if (type)
908  currentID.setID(unitID, time, primaryID, 3);
909  else
910  currentID.setID(unitID, time, primaryID, 2);
911 
912  edepositHAD = aStep->GetTotalEnergyDeposit();
913  edepositEM = -edepositHAD + edep;
914 #ifdef plotDebug
915  plotProfile(aStep, hitPoint, edep, time, depth);
916 #endif
917 #ifdef EDM_ML_DEBUG
918  double beta = preStepPoint->GetBeta();
919  edm::LogVerbatim("HcalSim") << "HCalSD::getHitFibreBundle 1 hit for " << GetName() << " of " << primaryID
920  << " with " << theTrack->GetDefinition()->GetParticleName() << " of "
921  << preStepPoint->GetKineticEnergy() / GeV << " GeV with velocity " << beta << " UnitID "
922  << std::hex << unitID << std::dec;
923 #endif
924  processHit(aStep);
925  } // non-zero energy deposit
926 }
float edepositEM
Definition: CaloSD.h:129
double energyCut
Definition: CaloSD.h:133
type
Definition: HCALResponse.h:21
const double GeV
Definition: MathUtil.h:16
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:972
void processHit(const G4Step *step)
Definition: CaloSD.h:103
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
Definition: HCalSD.h:81
float edepositHAD
Definition: CaloSD.h:129
void resetForNewPrimary(const G4Step *)
Definition: CaloSD.cc:421
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:538
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:40
CaloHitID currentID
Definition: CaloSD.h:131
std::unique_ptr< HFShowerFibreBundle > showerBundle
Definition: HCalSD.h:87
tmp
align.sh
Definition: createJobs.py:716
void HCalSD::getHitPMT ( const G4Step *  step)
private

Definition at line 807 of file HCalSD.cc.

References zMuMuMuonUserData::beta, CaloSD::currentID, TauDecayModes::dec, LEDCalibrationChannels::depth, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::energyCut, GeV, HcalForward, numberingFromDDD, phi, plotProfile(), CaloSD::processHit(), CaloSD::resetForNewPrimary(), findQualityFiles::rr, setDetUnitId(), CaloHitID::setID(), showerPMT, ntuplemaker::time, and createJobs::tmp.

Referenced by getEnergyDeposit().

807  {
808  auto const preStepPoint = aStep->GetPreStepPoint();
809  auto const theTrack = aStep->GetTrack();
810  double edep = showerPMT->getHits(aStep);
811 
812  if (edep >= 0.) {
813  edep *= GeV;
814  double etrack = preStepPoint->GetKineticEnergy();
815  int primaryID = 0;
816  if (etrack >= energyCut) {
817  primaryID = theTrack->GetTrackID();
818  } else {
819  primaryID = theTrack->GetParentID();
820  if (primaryID == 0)
821  primaryID = theTrack->GetTrackID();
822  }
823  // Reset entry point for new primary
824  resetForNewPrimary(aStep);
825  //
826  int det = static_cast<int>(HcalForward);
827  const G4ThreeVector& hitPoint = preStepPoint->GetPosition();
828  double rr = (hitPoint.x() * hitPoint.x() + hitPoint.y() * hitPoint.y());
829  double phi = (rr == 0. ? 0. : atan2(hitPoint.y(), hitPoint.x()));
830  double etaR = showerPMT->getRadius();
831  int depth = 1;
832  if (etaR < 0) {
833  depth = 2;
834  etaR = -etaR;
835  }
836  if (hitPoint.z() < 0)
837  etaR = -etaR;
838 #ifdef EDM_ML_DEBUG
839  edm::LogVerbatim("HcalSim") << "HCalSD::Hit for Detector " << det << " etaR " << etaR << " phi " << phi / deg
840  << " depth " << depth;
841 #endif
842  double time = (aStep->GetPostStepPoint()->GetGlobalTime());
843  uint32_t unitID = 0;
844  if (numberingFromDDD) {
845  HcalNumberingFromDDD::HcalID tmp = numberingFromDDD->unitID(det, etaR, phi, depth, 1);
846  unitID = setDetUnitId(tmp);
847  }
848  currentID.setID(unitID, time, primaryID, 1);
849 
850  edepositHAD = aStep->GetTotalEnergyDeposit();
851  edepositEM = -edepositHAD + edep;
852 #ifdef plotDebug
853  plotProfile(aStep, hitPoint, edep, time, depth);
854 #endif
855 #ifdef EDM_ML_DEBUG
856  double beta = preStepPoint->GetBeta();
857  edm::LogVerbatim("HcalSim") << "HCalSD::getHitPMT 1 hit for " << GetName() << " of " << primaryID << " with "
858  << theTrack->GetDefinition()->GetParticleName() << " of "
859  << preStepPoint->GetKineticEnergy() / GeV << " GeV with velocity " << beta << " UnitID "
860  << std::hex << unitID << std::dec;
861 #endif
862  processHit(aStep);
863  }
864 }
float edepositEM
Definition: CaloSD.h:129
double energyCut
Definition: CaloSD.h:133
const double GeV
Definition: MathUtil.h:16
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:972
void processHit(const G4Step *step)
Definition: CaloSD.h:103
std::unique_ptr< HFShowerPMT > showerPMT
Definition: HCalSD.h:86
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
Definition: HCalSD.h:81
float edepositHAD
Definition: CaloSD.h:129
void resetForNewPrimary(const G4Step *)
Definition: CaloSD.cc:421
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:538
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:40
CaloHitID currentID
Definition: CaloSD.h:131
tmp
align.sh
Definition: createJobs.py:716
void HCalSD::hitForFibre ( const G4Step *  step)
private

Definition at line 735 of file HCalSD.cc.

References CaloSD::currentID, LEDCalibrationChannels::depth, CaloSD::edepositEM, CaloSD::edepositHAD, GeV, hfshower, hfClusterShapes_cfi::hits, mps_fire::i, G4TrackToParticleID::isGammaElectronPositron(), isItinFidVolume(), plotHF(), plotProfile(), CaloSD::processHit(), setDetUnitId(), CaloHitID::setID(), CaloSD::setTrackID(), ntuplemaker::time, and weight_.

Referenced by getEnergyDeposit().

735  { // if not ParamShower
736 
737  std::vector<HFShower::Hit> hits = hfshower->getHits(aStep, weight_);
738  if (hits.empty()) {
739  return;
740  }
741 
742  auto const theTrack = aStep->GetTrack();
743  int primaryID = setTrackID(aStep);
744  int det = 5;
745 
747  edepositEM = 1. * GeV;
748  edepositHAD = 0.;
749  } else {
750  edepositEM = 0.;
751  edepositHAD = 1. * GeV;
752  }
753 
754 #ifdef EDM_ML_DEBUG
755  edm::LogVerbatim("HcalSim") << "HCalSD::hitForFibre " << hits.size() << " hits for " << GetName() << " of "
756  << primaryID << " with " << theTrack->GetDefinition()->GetParticleName() << " of "
757  << aStep->GetPreStepPoint()->GetKineticEnergy() / GeV << " GeV in detector type " << det;
758 #endif
759 
760  for (unsigned int i = 0; i < hits.size(); ++i) {
761  G4ThreeVector hitPoint = hits[i].position;
762  if (isItinFidVolume(hitPoint)) {
763  int depth = hits[i].depth;
764  double time = hits[i].time;
765  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
766  currentID.setID(unitID, time, primaryID, 0);
767 #ifdef plotDebug
768  plotProfile(aStep, hitPoint, edepositEM, time, depth);
769  bool emType = (edepositEM > 0.) ? true : false;
770  plotHF(hitPoint, emType);
771 #endif
772  processHit(aStep);
773  }
774  }
775 }
float edepositEM
Definition: CaloSD.h:129
const double GeV
Definition: MathUtil.h:16
double weight_
Definition: HCalSD.h:104
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:972
void processHit(const G4Step *step)
Definition: CaloSD.h:103
float edepositHAD
Definition: CaloSD.h:129
void plotHF(const G4ThreeVector &pos, bool emType)
Definition: HCalSD.cc:1032
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:538
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:40
CaloHitID currentID
Definition: CaloSD.h:131
bool isItinFidVolume(const G4ThreeVector &)
Definition: HCalSD.cc:676
virtual int setTrackID(const G4Step *)
Definition: CaloSD.cc:589
static bool isGammaElectronPositron(int pdgCode)
std::unique_ptr< HFShower > hfshower
Definition: HCalSD.h:84
void HCalSD::initRun ( )
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 559 of file HCalSD.cc.

559 {}
bool HCalSD::isItConicalBundle ( const G4LogicalVolume *  lv)
private

Definition at line 660 of file HCalSD.cc.

References fibre2LV.

Referenced by getEnergyDeposit().

660  {
661  for (auto lvol : fibre2LV)
662  if (lv == lvol) {
663  return true;
664  }
665  return false;
666 }
std::vector< const G4LogicalVolume * > fibre2LV
Definition: HCalSD.h:112
bool HCalSD::isItFibre ( const G4LogicalVolume *  lv)
private

Definition at line 628 of file HCalSD.cc.

References fibreLV.

Referenced by getEnergyDeposit().

628  {
629  for (auto lvol : fibreLV)
630  if (lv == lvol) {
631  return true;
632  }
633  return false;
634 }
std::vector< const G4LogicalVolume * > fibreLV
Definition: HCalSD.h:112
bool HCalSD::isItFibre ( const G4String &  name)
private

Definition at line 636 of file HCalSD.cc.

References fibreNames.

636  {
637  for (auto nam : fibreNames)
638  if (name == static_cast<G4String>(nam)) {
639  return true;
640  }
641  return false;
642 }
std::vector< std::string > fibreNames
Definition: HCalSD.h:109
bool HCalSD::isItHF ( const G4Step *  aStep)
private

Definition at line 607 of file HCalSD.cc.

References hfLevels, hfLV, hfNames, and jets_cff::levels.

Referenced by getFromLibrary().

607  {
608  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
609  int levels = (touch->GetHistoryDepth()) + 1;
610  for (unsigned int it = 0; it < hfNames.size(); ++it) {
611  if (levels >= hfLevels[it]) {
612  const G4LogicalVolume* lv = touch->GetVolume(levels - hfLevels[it])->GetLogicalVolume();
613  if (lv == hfLV[it])
614  return true;
615  }
616  }
617  return false;
618 }
std::vector< const G4LogicalVolume * > hfLV
Definition: HCalSD.h:112
std::vector< std::string > hfNames
Definition: HCalSD.h:108
std::vector< int > hfLevels
Definition: HCalSD.h:107
bool HCalSD::isItHF ( const G4String &  name)
private

Definition at line 620 of file HCalSD.cc.

References hfNames.

620  {
621  for (auto nam : hfNames)
622  if (name == static_cast<G4String>(nam)) {
623  return true;
624  }
625  return false;
626 }
std::vector< std::string > hfNames
Definition: HCalSD.h:108
bool HCalSD::isItinFidVolume ( const G4ThreeVector &  hitPoint)
private

Definition at line 676 of file HCalSD.cc.

References applyFidCut, RemoveAddSevLevel::flag, and HFFibreFiducial::PMTNumber().

Referenced by getFromHFLibrary(), and hitForFibre().

676  {
677  bool flag = true;
678  if (applyFidCut) {
679  int npmt = HFFibreFiducial::PMTNumber(hitPoint);
680 #ifdef EDM_ML_DEBUG
681  edm::LogVerbatim("HcalSim") << "HCalSD::isItinFidVolume:#PMT= " << npmt << " for hit point " << hitPoint;
682 #endif
683  if (npmt <= 0)
684  flag = false;
685  }
686 #ifdef EDM_ML_DEBUG
687  edm::LogVerbatim("HcalSim") << "HCalSD::isItinFidVolume: point " << hitPoint << " return flag " << flag;
688 #endif
689  return flag;
690 }
bool applyFidCut
Definition: HCalSD.h:101
int PMTNumber(const G4ThreeVector &pe_effect)
bool HCalSD::isItPMT ( const G4LogicalVolume *  lv)
private

Definition at line 644 of file HCalSD.cc.

References pmtLV.

Referenced by getEnergyDeposit().

644  {
645  for (auto lvol : pmtLV)
646  if (lv == lvol) {
647  return true;
648  }
649  return false;
650 }
std::vector< const G4LogicalVolume * > pmtLV
Definition: HCalSD.h:112
bool HCalSD::isItScintillator ( const G4Material *  mat)
private

Definition at line 668 of file HCalSD.cc.

References materials.

Referenced by getEnergyDeposit().

668  {
669  for (auto amat : materials)
670  if (amat == mat) {
671  return true;
672  }
673  return false;
674 }
std::vector< const G4Material * > materials
Definition: HCalSD.h:111
bool HCalSD::isItStraightBundle ( const G4LogicalVolume *  lv)
private

Definition at line 652 of file HCalSD.cc.

References fibre1LV.

Referenced by getEnergyDeposit().

652  {
653  for (auto lvol : fibre1LV)
654  if (lv == lvol) {
655  return true;
656  }
657  return false;
658 }
std::vector< const G4LogicalVolume * > fibre1LV
Definition: HCalSD.h:112
double HCalSD::layerWeight ( int  det,
const G4ThreeVector &  pos,
int  depth,
int  lay 
)
private

Definition at line 952 of file HCalSD.cc.

References TauDecayModes::dec, EDM_ML_DEBUG, HcalNumberingFromDDD::HcalID::etaR, HcalNumberingFromDDD::HcalID::lay, layerWeights, modifyDepth(), numberingFromDDD, HcalTestNumbering::packHcalIndex(), HcalNumberingFromDDD::HcalID::phis, HcalNumberingFromDDD::HcalID::subdet, createJobs::tmp, and HcalNumberingFromDDD::HcalID::zside.

Referenced by getEnergyDeposit().

952  {
953  double wt = 1.;
954  if (numberingFromDDD) {
955  //get the ID's as eta, phi, depth, ... indices
957  numberingFromDDD->unitID(det, math::XYZVectorD(pos.x(), pos.y(), pos.z()), depth, lay);
958  modifyDepth(tmp);
959  uint32_t id = HcalTestNumbering::packHcalIndex(tmp.subdet, tmp.zside, 1, tmp.etaR, tmp.phis, tmp.lay);
960  std::map<uint32_t, double>::const_iterator ite = layerWeights.find(id);
961  if (ite != layerWeights.end())
962  wt = ite->second;
963 #ifdef EDM_ML_DEBUG
964  edm::LogVerbatim("HcalSim") << "HCalSD::layerWeight: ID " << std::hex << id << std::dec << " (" << tmp.subdet << "/"
965  << tmp.zside << "/1/" << tmp.etaR << "/" << tmp.phis << "/" << tmp.lay << ") Weight "
966  << wt;
967 #endif
968  }
969  return wt;
970 }
void modifyDepth(HcalNumberingFromDDD::HcalID &id)
Definition: HCalSD.cc:1043
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
Definition: HCalSD.h:81
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
std::map< uint32_t, double > layerWeights
Definition: HCalSD.h:113
#define EDM_ML_DEBUG
tmp
align.sh
Definition: createJobs.py:716
void HCalSD::modifyDepth ( HcalNumberingFromDDD::HcalID id)
private

Definition at line 1043 of file HCalSD.cc.

References LEDCalibrationChannels::depth, depth_, hcalConstants_, LEDCalibrationChannels::ieta, HcalDDDSimConstants::maxHFDepth(), and testNumber.

Referenced by layerWeight(), and setDetUnitId().

1043  {
1044  if (id.subdet == 4) {
1045  int ieta = (id.zside == 0) ? -id.etaR : id.etaR;
1046  if (hcalConstants_->maxHFDepth(ieta, id.phis) > 2) {
1047  if (id.depth <= 2) {
1048  if (G4UniformRand() > 0.5)
1049  id.depth += 2;
1050  }
1051  }
1052  } else if ((id.subdet == 1 || id.subdet == 2) && testNumber) {
1053  id.depth = (depth_ == 0) ? 1 : 2;
1054  }
1055 }
const HcalDDDSimConstants * hcalConstants_
Definition: HCalSD.h:89
bool testNumber
Definition: HCalSD.h:99
int depth_
Definition: HCalSD.h:105
int maxHFDepth(const int &ieta, const int &iphi) const
void HCalSD::plotHF ( const G4ThreeVector &  pos,
bool  emType 
)
private

Definition at line 1032 of file HCalSD.cc.

References funct::abs(), gpar, hzvem, and hzvhad.

Referenced by getFromHFLibrary(), and hitForFibre().

1032  {
1033  double zv = std::abs(hitPoint.z()) - gpar[4];
1034  if (emType) {
1035  if (hzvem != nullptr)
1036  hzvem->Fill(zv);
1037  } else {
1038  if (hzvhad != nullptr)
1039  hzvhad->Fill(zv);
1040  }
1041 }
std::vector< double > gpar
Definition: HCalSD.h:106
TH1F * hzvhad
Definition: HCalSD.h:114
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TH1F * hzvem
Definition: HCalSD.h:114
void HCalSD::plotProfile ( const G4Step *  step,
const G4ThreeVector &  pos,
double  edep,
double  time,
int  id 
)
private

Definition at line 972 of file HCalSD.cc.

References funct::abs(), LEDCalibrationChannels::depth, dist_, newFWLiteAna::found, hit_, training_settings::idx, cuy::ii, DTRecHitClients_cfi::local, dqmiodumpmetadata::n, Skims_PA_cff::name, ntuplemaker::time, and time_.

Referenced by getFromHFLibrary(), getFromParam(), getHitFibreBundle(), getHitPMT(), and hitForFibre().

972  {
973  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
974  static const G4String modName[8] = {"HEModule", "HVQF", "HBModule", "MBAT", "MBBT", "MBBTC", "MBBT_R1P", "MBBT_R1M"};
975  G4ThreeVector local;
976  bool found = false;
977  double depth = -2000;
978  int idx = 4;
979  for (int n = 0; n < touch->GetHistoryDepth(); ++n) {
980  G4String name = touch->GetVolume(n)->GetName();
981 #ifdef EDM_ML_DEBUG
982  edm::LogVerbatim("HcalSim") << "plotProfile Depth " << n << " Name " << name;
983 #endif
984  for (unsigned int ii = 0; ii < 8; ++ii) {
985  if (name == modName[ii]) {
986  found = true;
987  int dn = touch->GetHistoryDepth() - n;
988  local = touch->GetHistory()->GetTransform(dn).TransformPoint(global);
989  if (ii == 0) {
990  depth = local.z() - 4006.5;
991  idx = 1;
992  } else if (ii == 1) {
993  depth = local.z() + 825.0;
994  idx = 3;
995  } else if (ii == 2) {
996  depth = local.x() - 1775.;
997  idx = 0;
998  } else {
999  depth = local.y() + 15.;
1000  idx = 2;
1001  }
1002  break;
1003  }
1004  }
1005  if (found)
1006  break;
1007  }
1008  if (!found)
1009  depth = std::abs(global.z()) - 11500;
1010 #ifdef EDM_ML_DEBUG
1011  edm::LogVerbatim("HcalSim") << "plotProfile Found " << found << " Global " << global << " Local " << local
1012  << " depth " << depth << " ID " << id << " EDEP " << edep << " Time " << time;
1013 #endif
1014  if (hit_[idx] != nullptr)
1015  hit_[idx]->Fill(edep);
1016  if (time_[idx] != nullptr)
1017  time_[idx]->Fill(time, edep);
1018  if (dist_[idx] != nullptr)
1019  dist_[idx]->Fill(depth, edep);
1020  int jd = 2 * idx + id - 7;
1021  if (jd >= 0 && jd < 4) {
1022  jd += 5;
1023  if (hit_[jd] != nullptr)
1024  hit_[jd]->Fill(edep);
1025  if (time_[jd] != nullptr)
1026  time_[jd]->Fill(time, edep);
1027  if (dist_[jd] != nullptr)
1028  dist_[jd]->Fill(depth, edep);
1029  }
1030 }
TH1F * time_[9]
Definition: HCalSD.h:114
TH1F * hit_[9]
Definition: HCalSD.h:114
TH1F * dist_[9]
Definition: HCalSD.h:114
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ii
Definition: cuy.py:590
void HCalSD::readWeightFromFile ( const std::string &  fName)
private

Definition at line 928 of file HCalSD.cc.

References TauDecayModes::dec, mps_splice::entry, MainPageGenerator::fName, recoMuon::in, timingPdfMaker::infile, layerWeights, HcalTestNumbering::packHcalIndex(), phi, useLayerWt, and ecaldqm::zside().

Referenced by HCalSD().

928  {
929  std::ifstream infile;
930  int entry = 0;
931  infile.open(fName.c_str(), std::ios::in);
932  if (infile) {
933  int det, zside, etaR, phi, lay;
934  double wt;
935  while (infile >> det >> zside >> etaR >> phi >> lay >> wt) {
936  uint32_t id = HcalTestNumbering::packHcalIndex(det, zside, 1, etaR, phi, lay);
937  layerWeights.insert(std::pair<uint32_t, double>(id, wt));
938  ++entry;
939 #ifdef EDM_ML_DEBUG
940  edm::LogVerbatim("HcalSim") << "HCalSD::readWeightFromFile:Entry " << entry << " ID " << std::hex << id
941  << std::dec << " (" << det << "/" << zside << "/1/" << etaR << "/" << phi << "/"
942  << lay << ") Weight " << wt;
943 #endif
944  }
945  infile.close();
946  }
947  edm::LogVerbatim("HcalSim") << "HCalSD::readWeightFromFile: reads " << entry << " weights from " << fName;
948  if (entry <= 0)
949  useLayerWt = false;
950 }
bool useLayerWt
Definition: HCalSD.h:98
int zside(DetId const &)
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
std::map< uint32_t, double > layerWeights
Definition: HCalSD.h:113
uint32_t HCalSD::setDetUnitId ( const G4Step *  step)
overridevirtual

Implements CaloSD.

Definition at line 538 of file HCalSD.cc.

References LEDCalibrationChannels::depth.

Referenced by getEnergyDeposit(), getFromHFLibrary(), getFromParam(), getHitFibreBundle(), getHitPMT(), hitForFibre(), and setDetUnitId().

538  {
539  auto const prePoint = aStep->GetPreStepPoint();
540  auto const touch = prePoint->GetTouchable();
541  const G4ThreeVector& hitPoint = prePoint->GetPosition();
542 
543  int depth = (touch->GetReplicaNumber(0)) % 10 + 1;
544  int lay = (touch->GetReplicaNumber(0) / 10) % 100 + 1;
545  int det = (touch->GetReplicaNumber(1)) / 1000;
546 
547  return setDetUnitId(det, hitPoint, depth, lay);
548 }
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:538
uint32_t HCalSD::setDetUnitId ( int  det,
const G4ThreeVector &  pos,
int  depth,
int  lay = 1 
)
private

Definition at line 583 of file HCalSD.cc.

References triggerObjects_cff::id, numberingFromDDD, setDetUnitId(), and createJobs::tmp.

583  {
584  uint32_t id = 0;
585  if (numberingFromDDD.get()) {
586  //get the ID's as eta, phi, depth, ... indices
588  numberingFromDDD->unitID(det, math::XYZVectorD(pos.x(), pos.y(), pos.z()), depth, lay);
589  id = setDetUnitId(tmp);
590  }
591  return id;
592 }
std::unique_ptr< HcalNumberingFromDDD > numberingFromDDD
Definition: HCalSD.h:81
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:8
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:538
tmp
align.sh
Definition: createJobs.py:716
uint32_t HCalSD::setDetUnitId ( HcalNumberingFromDDD::HcalID tmp)
private

Definition at line 594 of file HCalSD.cc.

References TauDecayModes::dec, HcalNumberingFromDDD::HcalID::depth, HcalNumberingFromDDD::HcalID::etaR, triggerObjects_cff::id, HcalNumberingFromDDD::HcalID::lay, m_HcalTestNS, modifyDepth(), numberingScheme, convertSQLiteXML::ok, HcalNumberingFromDDD::HcalID::phi, HcalNumberingFromDDD::HcalID::phis, HcalNumberingFromDDD::HcalID::subdet, and testNumber.

594  {
595  modifyDepth(tmp);
596  uint32_t id = (numberingScheme.get()) ? numberingScheme->getUnitID(tmp) : 0;
597  if ((!testNumber) && m_HcalTestNS.get()) {
598  bool ok = m_HcalTestNS->compare(tmp, id);
599  if (!ok)
600  edm::LogWarning("HcalSim") << "Det ID from HCalSD " << HcalDetId(id) << " " << std::hex << id << std::dec
601  << " does not match one from relabller for " << tmp.subdet << ":" << tmp.etaR << ":"
602  << tmp.phi << ":" << tmp.phis << ":" << tmp.depth << ":" << tmp.lay << std::endl;
603  }
604  return id;
605 }
void modifyDepth(HcalNumberingFromDDD::HcalID &id)
Definition: HCalSD.cc:1043
bool testNumber
Definition: HCalSD.h:99
std::unique_ptr< HcalTestNS > m_HcalTestNS
Definition: HCalSD.h:94
std::unique_ptr< HcalNumberingScheme > numberingScheme
Definition: HCalSD.h:82
void HCalSD::setNumberingScheme ( HcalNumberingScheme scheme)

Definition at line 550 of file HCalSD.cc.

References numberingScheme.

Referenced by HCalSD(), HcalTestAnalysis::update(), SimG4HcalValidation::update(), and HcalTB04Analysis::update().

550  {
551  if (scheme != nullptr) {
552  edm::LogVerbatim("HcalSim") << "HCalSD: updates numbering scheme for " << GetName();
553  numberingScheme.reset(scheme);
554  }
555 }
std::unique_ptr< HcalNumberingScheme > numberingScheme
Definition: HCalSD.h:82
void HCalSD::update ( const BeginOfJob )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob * >.

Definition at line 557 of file HCalSD.cc.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

557 {}

Member Data Documentation

bool HCalSD::agingFlagHB
private

Definition at line 97 of file HCalSD.h.

Referenced by HCalSD().

bool HCalSD::agingFlagHE
private

Definition at line 97 of file HCalSD.h.

Referenced by HCalSD().

bool HCalSD::applyFidCut
private

Definition at line 101 of file HCalSD.h.

Referenced by HCalSD(), and isItinFidVolume().

double HCalSD::betaThr
private

Definition at line 100 of file HCalSD.h.

Referenced by HCalSD().

double HCalSD::birk1
private

Definition at line 100 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

double HCalSD::birk2
private

Definition at line 100 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

double HCalSD::birk3
private

Definition at line 100 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

double HCalSD::deliveredLumi
private

Definition at line 103 of file HCalSD.h.

Referenced by getEnergyDeposit(), getFromLibrary(), and HCalSD().

int HCalSD::depth_
private

Definition at line 105 of file HCalSD.h.

Referenced by getEnergyDeposit(), getFromLibrary(), and modifyDepth().

TH1F * HCalSD::dist_[9]
private

Definition at line 114 of file HCalSD.h.

Referenced by HCalSD(), and plotProfile().

double HCalSD::eminHitHB
private

Definition at line 102 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

double HCalSD::eminHitHE
private

Definition at line 102 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

double HCalSD::eminHitHF
private

Definition at line 102 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

double HCalSD::eminHitHO
private

Definition at line 102 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

std::vector<const G4LogicalVolume*> HCalSD::fibre1LV
private

Definition at line 112 of file HCalSD.h.

Referenced by HCalSD(), and isItStraightBundle().

std::vector<const G4LogicalVolume*> HCalSD::fibre2LV
private

Definition at line 112 of file HCalSD.h.

Referenced by HCalSD(), and isItConicalBundle().

std::vector<const G4LogicalVolume*> HCalSD::fibreLV
private

Definition at line 112 of file HCalSD.h.

Referenced by HCalSD(), and isItFibre().

std::vector<std::string> HCalSD::fibreNames
private

Definition at line 109 of file HCalSD.h.

Referenced by HCalSD(), and isItFibre().

std::vector<double> HCalSD::gpar
private

Definition at line 106 of file HCalSD.h.

Referenced by HCalSD(), and plotHF().

const HcalDDDSimConstants* HCalSD::hcalConstants_
private

Definition at line 89 of file HCalSD.h.

Referenced by getEnergyDeposit(), HCalSD(), and modifyDepth().

const HcalDDDSimulationConstants* HCalSD::hcalSimConstants_
private

Definition at line 90 of file HCalSD.h.

Referenced by HCalSD().

std::vector<int> HCalSD::hfLevels
private

Definition at line 107 of file HCalSD.h.

Referenced by HCalSD(), and isItHF().

std::vector<const G4LogicalVolume*> HCalSD::hfLV
private

Definition at line 112 of file HCalSD.h.

Referenced by HCalSD(), and isItHF().

std::vector<std::string> HCalSD::hfNames
private

Definition at line 108 of file HCalSD.h.

Referenced by HCalSD(), and isItHF().

std::unique_ptr<HFShower> HCalSD::hfshower
private

Definition at line 84 of file HCalSD.h.

Referenced by HCalSD(), and hitForFibre().

TH1F* HCalSD::hit_[9]
private

Definition at line 114 of file HCalSD.h.

Referenced by HCalSD(), and plotProfile().

TH1F * HCalSD::hzvem
private

Definition at line 114 of file HCalSD.h.

Referenced by HCalSD(), and plotHF().

TH1F * HCalSD::hzvhad
private

Definition at line 114 of file HCalSD.h.

Referenced by HCalSD(), and plotHF().

bool HCalSD::isHF
private

Definition at line 96 of file HCalSD.h.

Referenced by getEnergyDeposit(), and getFromLibrary().

std::map<uint32_t, double> HCalSD::layerWeights
private

Definition at line 113 of file HCalSD.h.

Referenced by layerWeight(), and readWeightFromFile().

const HBHEDarkening* HCalSD::m_HBDarkening
private

Definition at line 91 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

std::unique_ptr<HcalTestNS> HCalSD::m_HcalTestNS
private

Definition at line 94 of file HCalSD.h.

Referenced by HCalSD(), and setDetUnitId().

const HBHEDarkening* HCalSD::m_HEDarkening
private

Definition at line 92 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

std::unique_ptr<HFDarkening> HCalSD::m_HFDarkening
private

Definition at line 93 of file HCalSD.h.

Referenced by getFromLibrary(), and HCalSD().

std::vector<const G4Material*> HCalSD::materials
private

Definition at line 111 of file HCalSD.h.

Referenced by HCalSD(), and isItScintillator().

std::vector<std::string> HCalSD::matNames
private

Definition at line 110 of file HCalSD.h.

Referenced by HCalSD().

bool HCalSD::neutralDensity
private

Definition at line 99 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

std::unique_ptr<HcalNumberingFromDDD> HCalSD::numberingFromDDD
private

Definition at line 81 of file HCalSD.h.

Referenced by getHitFibreBundle(), getHitPMT(), HCalSD(), layerWeight(), and setDetUnitId().

std::unique_ptr<HcalNumberingScheme> HCalSD::numberingScheme
private

Definition at line 82 of file HCalSD.h.

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

std::vector<const G4LogicalVolume*> HCalSD::pmtLV
private

Definition at line 112 of file HCalSD.h.

Referenced by HCalSD(), and isItPMT().

std::unique_ptr<HFShowerFibreBundle> HCalSD::showerBundle
private

Definition at line 87 of file HCalSD.h.

Referenced by getEnergyDeposit(), getHitFibreBundle(), and HCalSD().

std::unique_ptr<HFShowerLibrary> HCalSD::showerLibrary
private

Definition at line 83 of file HCalSD.h.

Referenced by getFromHFLibrary(), and HCalSD().

std::unique_ptr<HFShowerParam> HCalSD::showerParam
private

Definition at line 85 of file HCalSD.h.

Referenced by getFromParam(), and HCalSD().

std::unique_ptr<HFShowerPMT> HCalSD::showerPMT
private

Definition at line 86 of file HCalSD.h.

Referenced by getEnergyDeposit(), getHitPMT(), and HCalSD().

bool HCalSD::testNS_
private

Definition at line 99 of file HCalSD.h.

Referenced by HCalSD().

bool HCalSD::testNumber
private

Definition at line 99 of file HCalSD.h.

Referenced by getEnergyDeposit(), HCalSD(), modifyDepth(), and setDetUnitId().

TH1F * HCalSD::time_[9]
private

Definition at line 114 of file HCalSD.h.

Referenced by HCalSD(), and plotProfile().

bool HCalSD::useBirk
private

Definition at line 98 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

bool HCalSD::useFibreBundle
private

Definition at line 98 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

bool HCalSD::useHF
private

Definition at line 101 of file HCalSD.h.

Referenced by HCalSD().

bool HCalSD::useLayerWt
private

Definition at line 98 of file HCalSD.h.

Referenced by getEnergyDeposit(), HCalSD(), and readWeightFromFile().

bool HCalSD::useParam
private

Definition at line 101 of file HCalSD.h.

Referenced by getFromLibrary(), and HCalSD().

bool HCalSD::usePMTHit
private

Definition at line 98 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

bool HCalSD::useShowerLibrary
private

Definition at line 101 of file HCalSD.h.

Referenced by getEnergyDeposit(), getFromLibrary(), and HCalSD().

double HCalSD::weight_
private