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

double getEnergyDeposit (G4Step *) override
 
 HCalSD (const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
uint32_t setDetUnitId (const G4Step *step) override
 
void setNumberingScheme (HcalNumberingScheme *)
 
 ~HCalSD () override
 
- Public Member Functions inherited from CaloSD
 CaloSD (const std::string &aSDname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
 
void clear () override
 
void clearHits () override
 
void DrawAll () override
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
void fillHits (edm::PCaloHitContainer &, const std::string &) override
 
void Initialize (G4HCofThisEvent *HCE) override
 
void PrintAll () override
 
bool ProcessHits (G4GFlashSpot *aSpot, G4TouchableHistory *) override
 
 ~CaloSD () override
 
- Public Member Functions inherited from SensitiveCaloDetector
 SensitiveCaloDetector (const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
const std::vector< std::string > & getNames () const
 
void Initialize (G4HCofThisEvent *eventHC) override
 
 SensitiveDetector (const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
 ~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
 
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
G4bool checkHit ()
 
CaloG4HitcreateNewHit ()
 
double getAttenuation (const G4Step *aStep, double birk1, double birk2, double birk3)
 
virtual uint16_t getDepth (const G4Step *)
 
int getNumberOfHits ()
 
double getResponseWt (const G4Track *)
 
virtual G4bool getStepInfo (G4Step *aStep)
 
virtual int getTrackID (const G4Track *)
 
G4bool hitExists ()
 
void resetForNewPrimary (const G4ThreeVector &, double)
 
G4ThreeVector setToGlobal (const G4ThreeVector &, const G4VTouchable *)
 
G4ThreeVector setToLocal (const G4ThreeVector &, const G4VTouchable *)
 
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
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

std::vector< double > getDDDArray (const std::string &, const DDsvalues_type &)
 
void getFromLibrary (G4Step *step, double weight)
 
void getFromParam (G4Step *step, double weight)
 
void getHitFibreBundle (const G4Step *step, bool type)
 
void getHitPMT (const G4Step *step)
 
std::vector< G4String > getNames (DDFilteredView &)
 
void hitForFibre (const G4Step *step, double weight)
 
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)
 
int setTrackID (const G4Step *step)
 

Private Attributes

bool agingFlagHB
 
bool agingFlagHE
 
bool applyFidCut
 
double betaThr
 
double birk1
 
double birk2
 
double birk3
 
double deliveredLumi
 
G4int 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< G4String > fibreNames
 
std::vector< double > gpar
 
HcalDDDSimConstantshcalConstants
 
HcalTestNShcalTestNS_
 
std::vector< int > hfLevels
 
std::vector< const G4LogicalVolume * > hfLV
 
std::vector< G4String > hfNames
 
HFShowerhfshower
 
TH1F * hit_ [9]
 
TH1F * hzvem
 
TH1F * hzvhad
 
std::map< uint32_t, double > layerWeights
 
const HBHEDarkeningm_HBDarkening
 
const HBHEDarkeningm_HEDarkening
 
std::unique_ptr< HFDarkeningm_HFDarkening
 
std::vector< const G4Material * > materials
 
std::vector< G4String > matNames
 
G4int mumPDG
 
G4int mupPDG
 
bool neutralDensity
 
HcalNumberingFromDDDnumberingFromDDD
 
HcalNumberingSchemenumberingScheme
 
std::vector< const G4LogicalVolume * > pmtLV
 
HFShowerFibreBundleshowerBundle
 
HFShowerLibraryshowerLibrary
 
HFShowerParamshowerParam
 
HFShowerPMTshowerPMT
 
bool testNS_
 
bool testNumber
 
TH1F * time_ [9]
 
bool useBirk
 
bool useFibreBundle
 
bool useHF
 
bool useLayerWt
 
bool useParam
 
bool usePMTHit
 
bool useShowerLibrary
 

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Protected Attributes inherited from CaloSD
int checkHits
 
double correctT
 
bool corrTOFBeam
 
CaloG4HitcurrentHit
 
CaloHitID currentID
 
float edepositEM
 
float edepositHAD
 
double eminHit
 
double eminHitD
 
G4int emPDG
 
double energyCut
 
G4ThreeVector entranceLocal
 
G4ThreeVector entrancePoint
 
G4int epPDG
 
bool forceSave
 
G4int gammaPDG
 
float incidentEnergy
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 
const SimTrackManagerm_trackManager
 
G4ThreeVector posGlobal
 
G4StepPoint * preStepPoint
 
CaloHitID previousID
 
int primIDSaved
 
bool runInit
 
bool suppressHeavy
 
G4Track * theTrack
 
double tmaxHit
 
bool useMap
 

Detailed Description

Definition at line 36 of file HCalSD.h.

Constructor & Destructor Documentation

HCalSD::HCalSD ( const std::string &  name,
const DDCompactView cpv,
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, fibre1LV, fibre2LV, fibreLV, fibreNames, FrontierConditions_GlobalTag_cff::file, DDFilteredView::firstChild(), g, getDDDArray(), SensitiveDetector::getNames(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hcalUnsuppressedDigis_cfi::HFDarkening, hfLevels, hfLV, hfNames, hfshower, g4SimHits_cfi::HFShower, g4SimHits_cfi::HFShowerLibrary, hit_, hzvem, hzvhad, mps_fire::i, edm::Service< T >::isAvailable(), isItFibre(), isItHF(), CaloSD::kmaxIon, CaloSD::kmaxNeutron, CaloSD::kmaxProton, tablePrinter::labels, hcalDigis_cfi::level, cmsBatch::log, LogDebug, DDFilteredView::logicalPart(), m_HFDarkening, TFileDirectory::make(), DDLogicalPart::material(), materials, matNames, DDFilteredView::mergedSpecifics(), MeV, TFileService::mkdir(), mumPDG, mupPDG, DDName::name(), dataset::name, DDBase< N, C >::name(), neutralDensity, DDFilteredView::next(), pmtLV, readWeightFromFile(), setNumberingScheme(), showerBundle, showerLibrary, showerParam, showerPMT, AlCaHLTBitMon_QueryRunRegistry::string, CaloSD::suppressHeavy, groupFilesInBlocks::temp, testNS_, testNumber, compare::tfile, time_, fftjetcommon_cfi::title, useBirk, useFibreBundle, useHF, useLayerWt, useParam, usePMTHit, useShowerLibrary, and relativeConstraints::value.

46  :
47  CaloSD(name, cpv, clg, p, manager,
48  (float)(p.getParameter<edm::ParameterSet>("HCalSD").getParameter<double>("TimeSliceUnit")),
49  p.getParameter<edm::ParameterSet>("HCalSD").getParameter<bool>("IgnoreTrackID")),
50  hcalConstants(nullptr), numberingFromDDD(nullptr), numberingScheme(nullptr),
51  showerLibrary(nullptr), hfshower(nullptr), showerParam(nullptr), showerPMT(nullptr),
52  showerBundle(nullptr), m_HBDarkening(nullptr), m_HEDarkening(nullptr),
53  m_HFDarkening(nullptr), hcalTestNS_(nullptr), depth_(1) {
54 
55  //static SimpleConfigurable<double> bk1(0.013, "HCalSD:BirkC1");
56  //static SimpleConfigurable<double> bk2(0.0568,"HCalSD:BirkC2");
57  //static SimpleConfigurable<double> bk3(1.75, "HCalSD:BirkC3");
58  // Values from NIM 80 (1970) 239-244: as implemented in Geant3
59 
60  edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("HCalSD");
61  useBirk = m_HC.getParameter<bool>("UseBirkLaw");
62  birk1 = m_HC.getParameter<double>("BirkC1")*(g/(MeV*cm2));
63  birk2 = m_HC.getParameter<double>("BirkC2");
64  birk3 = m_HC.getParameter<double>("BirkC3");
65  useShowerLibrary = m_HC.getParameter<bool>("UseShowerLibrary");
66  useParam = m_HC.getParameter<bool>("UseParametrize");
67  testNumber = m_HC.getParameter<bool>("TestNumberingScheme");
68  neutralDensity = m_HC.getParameter<bool>("doNeutralDensityFilter");
69  usePMTHit = m_HC.getParameter<bool>("UsePMTHits");
70  betaThr = m_HC.getParameter<double>("BetaThreshold");
71  eminHitHB = m_HC.getParameter<double>("EminHitHB")*MeV;
72  eminHitHE = m_HC.getParameter<double>("EminHitHE")*MeV;
73  eminHitHO = m_HC.getParameter<double>("EminHitHO")*MeV;
74  eminHitHF = m_HC.getParameter<double>("EminHitHF")*MeV;
75  useFibreBundle = m_HC.getParameter<bool>("UseFibreBundleHits");
76  deliveredLumi = m_HC.getParameter<double>("DelivLuminosity");
77  agingFlagHB = m_HC.getParameter<bool>("HBDarkening");
78  agingFlagHE = m_HC.getParameter<bool>("HEDarkening");
79  bool agingFlagHF = m_HC.getParameter<bool>("HFDarkening");
80  useHF = m_HC.getUntrackedParameter<bool>("UseHF",true);
81  bool forTBH2 = m_HC.getUntrackedParameter<bool>("ForTBH2",false);
82  useLayerWt = m_HC.getUntrackedParameter<bool>("UseLayerWt",false);
83  std::string file = m_HC.getUntrackedParameter<std::string>("WtFile","None");
84  testNS_ = m_HC.getUntrackedParameter<bool>("TestNS",false);
85  edm::ParameterSet m_HF = p.getParameter<edm::ParameterSet>("HFShower");
86  applyFidCut = m_HF.getParameter<bool>("ApplyFiducialCut");
87 
88 #ifdef EDM_ML_DEBUG
89  LogDebug("HcalSim") << "***************************************************"
90  << "\n"
91  << "* *"
92  << "\n"
93  << "* Constructing a HCalSD with name " << name << "\n"
94  << "* *"
95  << "\n"
96  << "***************************************************";
97 #endif
98  edm::LogInfo("HcalSim") << "HCalSD:: Use of HF code is set to " << useHF
99  << "\nUse of shower parametrization set to "
100  << useParam << "\nUse of shower library is set to "
101  << useShowerLibrary << "\nUse PMT Hit is set to "
102  << usePMTHit << " with beta Threshold "<< betaThr
103  << "\nUSe of FibreBundle Hit set to "<<useFibreBundle
104  << "\n Use of Birks law is set to "
105  << useBirk << " with three constants kB = "
106  << birk1 << ", C1 = " << birk2 << ", C2 = " << birk3;
107  edm::LogInfo("HcalSim") << "HCalSD:: Suppression Flag " << suppressHeavy
108  << " protons below " << kmaxProton << " MeV,"
109  << " neutrons below " << kmaxNeutron << " MeV and"
110  << " ions below " << kmaxIon << " MeV\n"
111  << " Threshold for storing hits in HB: "
112  << eminHitHB << " HE: " << eminHitHE << " HO: "
113  << eminHitHO << " HF: " << eminHitHF << "\n"
114  << "Delivered luminosity for Darkening "
115  << deliveredLumi << " Flag (HE) " << agingFlagHE
116  << " Flag (HB) " << agingFlagHB
117  << " Flag (HF) " << agingFlagHF << "\n"
118  << "Application of Fiducial Cut " << applyFidCut
119  << "Flag for test number|neutral density filter "
120  << testNumber << " " << neutralDensity;
121 
122  HcalNumberingScheme* scheme;
123  if (testNumber || forTBH2)
124  scheme = dynamic_cast<HcalNumberingScheme*>(new HcalTestNumberingScheme(forTBH2));
125  else
126  scheme = new HcalNumberingScheme();
127  setNumberingScheme(scheme);
128 
129  const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
130  std::vector<G4LogicalVolume *>::const_iterator lvcite;
131  const G4LogicalVolume* lv;
132  std::string attribute, value;
133  if (useHF) {
134  if (useParam) {
135  showerParam = new HFShowerParam(name, cpv, p);
136  } else {
137  if (useShowerLibrary) showerLibrary = new HFShowerLibrary(name, cpv, p);
138  hfshower = new HFShower(name, cpv, p, 0);
139  }
140 
141  // HF volume names
142  attribute = "Volume";
143  value = "HF";
144  DDSpecificsMatchesValueFilter filter0{DDValue(attribute,value,0)};
145  DDFilteredView fv0(cpv,filter0);
146  hfNames = getNames(fv0);
147  fv0.firstChild();
148  DDsvalues_type sv0(fv0.mergedSpecifics());
149  std::vector<double> temp = getDDDArray("Levels",sv0);
150  edm::LogInfo("HcalSim") << "HCalSD: Names to be tested for " << attribute
151  << " = " << value << " has " << hfNames.size()
152  << " elements";
153  for (unsigned int i=0; i < hfNames.size(); ++i) {
154  G4String namv = hfNames[i];
155  lv = nullptr;
156  for(lvcite=lvs->begin(); lvcite!=lvs->end(); lvcite++)
157  if((*lvcite)->GetName()==namv) {
158  lv = (*lvcite);
159  break;
160  }
161  hfLV.push_back(lv);
162  int level = static_cast<int>(temp[i]);
163  hfLevels.push_back(level);
164  edm::LogInfo("HcalSim") << "HCalSD: HF[" << i << "] = " << hfNames[i]
165  << " LV " << hfLV[i] << " at level "
166  << hfLevels[i];
167  }
168 
169  // HF Fibre volume names
170  value = "HFFibre";
171  DDSpecificsMatchesValueFilter filter1{DDValue(attribute,value,0)};
172  DDFilteredView fv1(cpv,filter1);
173  fibreNames = getNames(fv1);
174  edm::LogInfo("HcalSim") << "HCalSD: Names to be tested for " << attribute
175  << " = " << value << ":";
176  for (unsigned int i=0; i<fibreNames.size(); ++i) {
177  G4String namv = fibreNames[i];
178  lv = nullptr;
179  for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite) {
180  if ((*lvcite)->GetName() == namv) {
181  lv = (*lvcite);
182  break;
183  }
184  }
185  fibreLV.push_back(lv);
186  edm::LogInfo("HcalSim") << "HCalSD: (" << i << ") " << fibreNames[i]
187  << " LV " << fibreLV[i];
188  }
189 
190  // HF PMT volume names
191  value = "HFPMT";
192  DDSpecificsMatchesValueFilter filter3{DDValue(attribute,value,0)};
193  DDFilteredView fv3(cpv,filter3);
194  std::vector<G4String> pmtNames = getNames(fv3);
195  edm::LogInfo("HcalSim") << "HCalSD: Names to be tested for " << attribute
196  << " = " << value << " have " << pmtNames.size()
197  << " entries";
198  for (unsigned int i=0; i<pmtNames.size(); ++i) {
199  G4String namv = pmtNames[i];
200  lv = nullptr;
201  for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite)
202  if ((*lvcite)->GetName() == namv) {
203  lv = (*lvcite);
204  break;
205  }
206  pmtLV.push_back(lv);
207  edm::LogInfo("HcalSim") << "HCalSD: (" << i << ") " << pmtNames[i]
208  << " LV " << pmtLV[i];
209  }
210  if (!pmtNames.empty()) showerPMT = new HFShowerPMT (name, cpv, p);
211 
212  // HF Fibre bundles
213  value = "HFFibreBundleStraight";
214  DDSpecificsMatchesValueFilter filter4{DDValue(attribute,value,0)};
215  DDFilteredView fv4(cpv,filter4);
216  std::vector<G4String> fibreNames = getNames(fv4);
217  edm::LogInfo("HcalSim") << "HCalSD: Names to be tested for " << attribute
218  << " = " << value << " have " << fibreNames.size()
219  << " entries";
220  for (unsigned int i=0; i<fibreNames.size(); ++i) {
221  G4String namv = fibreNames[i];
222  lv = nullptr;
223  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
224  if ((*lvcite)->GetName() == namv) {
225  lv = (*lvcite);
226  break;
227  }
228  fibre1LV.push_back(lv);
229  edm::LogInfo("HcalSim") << "HCalSD: (" << i << ") " << fibreNames[i]
230  << " LV " << fibre1LV[i];
231  }
232 
233  // Geometry parameters for HF
234  value = "HFFibreBundleConical";
235  DDSpecificsMatchesValueFilter filter5{DDValue(attribute,value,0)};
236  DDFilteredView fv5(cpv,filter5);
237  fibreNames = getNames(fv5);
238  edm::LogInfo("HcalSim") << "HCalSD: Names to be tested for " << attribute
239  << " = " << value << " have " << fibreNames.size()
240  << " entries";
241  for (unsigned int i=0; i<fibreNames.size(); ++i) {
242  G4String namv = fibreNames[i];
243  lv = nullptr;
244  for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite)
245  if ((*lvcite)->GetName() == namv) {
246  lv = (*lvcite);
247  break;
248  }
249  fibre2LV.push_back(lv);
250  edm::LogInfo("HcalSim") << "HCalSD: (" << i << ") " << fibreNames[i]
251  << " LV " << fibre2LV[i];
252  }
253  if (!fibre1LV.empty() || !fibre2LV.empty())
254  showerBundle = new HFShowerFibreBundle (name, cpv, p);
255  }
256 
257  //Material list for HB/HE/HO sensitive detectors
258  const G4MaterialTable * matTab = G4Material::GetMaterialTable();
259  std::vector<G4Material*>::const_iterator matite;
260  attribute = "OnlyForHcalSimNumbering";
261  DDSpecificsHasNamedValueFilter filter2{attribute};
262  DDFilteredView fv2(cpv,filter2);
263  bool dodet = fv2.firstChild();
264  DDsvalues_type sv(fv2.mergedSpecifics());
265 
266  while (dodet) {
267  const DDLogicalPart & log = fv2.logicalPart();
268  G4String namx = log.name().name();
269  if (!isItHF(namx) && !isItFibre(namx)) {
270  bool notIn = true;
271  for (unsigned int i=0; i<matNames.size(); ++i) {
272  if (!strcmp(matNames[i].c_str(),log.material().name().name().c_str())){
273  notIn = false;
274  break;
275  }
276  }
277  if (notIn) {
278  namx = log.material().name().name();
279  matNames.push_back(namx);
280  const G4Material* mat = nullptr;
281  for (matite = matTab->begin(); matite != matTab->end(); ++matite) {
282  if ((*matite)->GetName() == namx) {
283  mat = (*matite);
284  break;
285  }
286  }
287  materials.push_back(mat);
288  }
289  }
290  dodet = fv2.next();
291  }
292 
293  edm::LogInfo("HcalSim") << "HCalSD: Material names for " << attribute
294  << " = " << name << ":";
295  for (unsigned int i=0; i<matNames.size(); ++i)
296  edm::LogInfo("HcalSim") << "HCalSD: (" << i << ") " << matNames[i]
297  << " pointer " << materials[i];
298 
299  mumPDG = mupPDG = 0;
300 
301  if (useLayerWt) readWeightFromFile(file);
302 
303  for (int i=0; i<9; ++i) hit_[i] = time_[i]= dist_[i] = nullptr;
304  hzvem = hzvhad = nullptr;
305 
306  if (agingFlagHF) m_HFDarkening.reset(new HFDarkening(m_HC.getParameter<edm::ParameterSet>("HFDarkeningParameterBlock")));
307 #ifdef plotDebug
309 
310  if ( tfile.isAvailable() ) {
311  static const char * const labels[] = {"HB", "HE", "HO", "HF Absorber", "HF PMT",
312  "HF Absorber Long", "HF Absorber Short",
313  "HF PMT Long", "HF PMT Short"};
314  TFileDirectory hcDir = tfile->mkdir("ProfileFromHCalSD");
315  char name[20], title[60];
316  for (int i=0; i<9; ++i) {
317  sprintf (title, "Hit energy in %s", labels[i]);
318  sprintf (name, "HCalSDHit%d", i);
319  hit_[i] = hcDir.make<TH1F>(name, title, 2000, 0., 2000.);
320  sprintf (title, "Energy (MeV)");
321  hit_[i]->GetXaxis()->SetTitle(title);
322  hit_[i]->GetYaxis()->SetTitle("Hits");
323  sprintf (title, "Time of the hit in %s", labels[i]);
324  sprintf (name, "HCalSDTime%d", i);
325  time_[i] = hcDir.make<TH1F>(name, title, 2000, 0., 2000.);
326  sprintf (title, "Time (ns)");
327  time_[i]->GetXaxis()->SetTitle(title);
328  time_[i]->GetYaxis()->SetTitle("Hits");
329  sprintf (title, "Longitudinal profile in %s", labels[i]);
330  sprintf (name, "HCalSDDist%d", i);
331  dist_[i] = hcDir.make<TH1F>(name, title, 2000, 0., 2000.);
332  sprintf (title, "Distance (mm)");
333  dist_[i]->GetXaxis()->SetTitle(title);
334  dist_[i]->GetYaxis()->SetTitle("Hits");
335  }
336  if (useHF && (!useParam)) {
337  hzvem = hcDir.make<TH1F>("hzvem", "Longitudinal Profile (EM Part)",330,0.0,1650.0);
338  hzvem->GetXaxis()->SetTitle("Longitudinal Profile (EM Part)");
339  hzvhad = hcDir.make<TH1F>("hzvhad","Longitudinal Profile (Had Part)",330,0.0,1650.0);
340  hzvhad->GetXaxis()->SetTitle("Longitudinal Profile (Hadronic Part)");
341  }
342  }
343 #endif
344 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void readWeightFromFile(const std::string &)
Definition: HCalSD.cc:1090
std::vector< const G4LogicalVolume * > hfLV
Definition: HCalSD.h:107
bool useParam
Definition: HCalSD.h:99
double eminHitHE
Definition: HCalSD.h:100
HFShowerParam * showerParam
Definition: HCalSD.h:88
TH1F * time_[9]
Definition: HCalSD.h:109
double kmaxNeutron
Definition: CaloSD.h:135
const N & name() const
Definition: DDBase.h:78
G4int depth_
Definition: HCalSD.h:102
bool useLayerWt
Definition: HCalSD.h:96
bool useFibreBundle
Definition: HCalSD.h:96
double betaThr
Definition: HCalSD.h:98
double deliveredLumi
Definition: HCalSD.h:101
HFShowerFibreBundle * showerBundle
Definition: HCalSD.h:90
double eminHitHB
Definition: HCalSD.h:100
bool useShowerLibrary
Definition: HCalSD.h:99
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
Definition: HCalSD.cc:669
double birk2
Definition: HCalSD.h:98
bool usePMTHit
Definition: HCalSD.h:96
std::vector< const G4LogicalVolume * > fibre2LV
Definition: HCalSD.h:107
void setNumberingScheme(HcalNumberingScheme *)
Definition: HCalSD.cc:564
bool agingFlagHE
Definition: HCalSD.h:91
double birk1
Definition: HCalSD.h:98
double kmaxProton
Definition: CaloSD.h:135
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:109
double eminHitHF
Definition: HCalSD.h:100
const double MeV
TH1F * hit_[9]
Definition: HCalSD.h:109
bool agingFlagHB
Definition: HCalSD.h:91
bool testNumber
Definition: HCalSD.h:97
double kmaxIon
Definition: CaloSD.h:135
bool suppressHeavy
Definition: CaloSD.h:133
const std::vector< std::string > & getNames() const
HFShower * hfshower
Definition: HCalSD.h:87
bool useBirk
Definition: HCalSD.h:96
std::unique_ptr< HFDarkening > m_HFDarkening
Definition: HCalSD.h:94
double birk3
Definition: HCalSD.h:98
const HBHEDarkening * m_HEDarkening
Definition: HCalSD.h:93
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:20
bool isAvailable() const
Definition: Service.h:46
bool applyFidCut
Definition: HCalSD.h:99
TH1F * dist_[9]
Definition: HCalSD.h:109
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
HcalNumberingScheme * numberingScheme
Definition: HCalSD.h:85
T * make(const Args &...args) const
make new ROOT object
CaloSD(const std::string &aSDname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
Definition: CaloSD.cc:24
std::vector< int > hfLevels
Definition: HCalSD.h:104
bool testNS_
Definition: HCalSD.h:97
G4int mupPDG
Definition: HCalSD.h:102
double eminHitHO
Definition: HCalSD.h:100
TH1F * hzvem
Definition: HCalSD.h:109
std::vector< const G4LogicalVolume * > pmtLV
Definition: HCalSD.h:107
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
bool neutralDensity
Definition: HCalSD.h:97
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:84
bool isItHF(const G4Step *)
Definition: HCalSD.cc:714
std::vector< G4String > fibreNames
Definition: HCalSD.h:105
std::vector< G4String > hfNames
Definition: HCalSD.h:105
std::vector< const G4LogicalVolume * > fibreLV
Definition: HCalSD.h:107
G4int mumPDG
Definition: HCalSD.h:102
HcalTestNS * hcalTestNS_
Definition: HCalSD.h:95
HFShowerPMT * showerPMT
Definition: HCalSD.h:89
std::vector< const G4LogicalVolume * > fibre1LV
Definition: HCalSD.h:107
HFShowerLibrary * showerLibrary
Definition: HCalSD.h:86
std::vector< const G4Material * > materials
Definition: HCalSD.h:106
const HBHEDarkening * m_HBDarkening
Definition: HCalSD.h:92
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
std::vector< G4String > matNames
Definition: HCalSD.h:105
bool useHF
Definition: HCalSD.h:99
bool isItFibre(const G4LogicalVolume *)
Definition: HCalSD.cc:732
HcalDDDSimConstants * hcalConstants
Definition: HCalSD.h:83
HCalSD::~HCalSD ( )
override

Definition at line 346 of file HCalSD.cc.

References hcalTestNS_, hfshower, numberingFromDDD, numberingScheme, showerBundle, showerLibrary, showerParam, and showerPMT.

346  {
347 
349  if (numberingScheme) delete numberingScheme;
350  if (showerLibrary) delete showerLibrary;
351  if (hfshower) delete hfshower;
352  if (showerParam) delete showerParam;
353  if (showerPMT) delete showerPMT;
354  if (showerBundle) delete showerBundle;
355  if (hcalTestNS_) delete hcalTestNS_;
356 }
HFShowerParam * showerParam
Definition: HCalSD.h:88
HFShowerFibreBundle * showerBundle
Definition: HCalSD.h:90
HFShower * hfshower
Definition: HCalSD.h:87
HcalNumberingScheme * numberingScheme
Definition: HCalSD.h:85
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:84
HcalTestNS * hcalTestNS_
Definition: HCalSD.h:95
HFShowerPMT * showerPMT
Definition: HCalSD.h:89
HFShowerLibrary * showerLibrary
Definition: HCalSD.h:86

Member Function Documentation

bool HCalSD::filterHit ( CaloG4Hit aHit,
double  time 
)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 625 of file HCalSD.cc.

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

625  {
626  double threshold=0;
627  DetId theId(aHit->getUnitID());
628  switch (theId.subdetId()) {
629  case HcalBarrel:
630  threshold = eminHitHB; break;
631  case HcalEndcap:
632  threshold = eminHitHE; break;
633  case HcalOuter:
634  threshold = eminHitHO; break;
635  case HcalForward:
636  threshold = eminHitHF; break;
637  default:
638  break;
639  }
640  return ((time <= tmaxHit) && (aHit->getEnergyDeposit() > threshold));
641 }
double eminHitHE
Definition: HCalSD.h:100
double eminHitHB
Definition: HCalSD.h:100
double eminHitHF
Definition: HCalSD.h:100
double eminHitHO
Definition: HCalSD.h:100
double tmaxHit
Definition: CaloSD.h:124
Definition: DetId.h:18
uint32_t getUnitID() const
Definition: CaloG4Hit.h:69
double getEnergyDeposit() const
Definition: CaloG4Hit.h:81
std::vector< double > HCalSD::getDDDArray ( const std::string &  str,
const DDsvalues_type sv 
)
private

Definition at line 669 of file HCalSD.cc.

References DDfetch(), DDValue::doubles(), Exception, LogDebug, harvestTrackValidationPlots::str, and relativeConstraints::value.

Referenced by HCalSD().

670  {
671 #ifdef EDM_ML_DEBUG
672  LogDebug("HcalSim") << "HCalSD:getDDDArray called for " << str;
673 #endif
674  DDValue value(str);
675  if (DDfetch(&sv,value)) {
676 #ifdef EDM_ML_DEBUG
677  LogDebug("HcalSim") << value;
678 #endif
679  const std::vector<double> & fvec = value.doubles();
680  int nval = fvec.size();
681  if (nval < 1) {
682  edm::LogError("HcalSim") << "HCalSD : # of " << str << " bins " << nval
683  << " < 2 ==> illegal";
684  throw cms::Exception("Unknown", "HCalSD") << "nval < 2 for array " << str << "\n";
685  }
686 
687  return fvec;
688  } else {
689  edm::LogError("HcalSim") << "HCalSD : cannot get array " << str;
690  throw cms::Exception("Unknown", "HCalSD") << "cannot get array " << str << "\n";
691  }
692 }
#define LogDebug(id)
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
Definition: value.py:1
double HCalSD::getEnergyDeposit ( G4Step *  aStep)
overridevirtual

Reimplemented from CaloSD.

Definition at line 463 of file HCalSD.cc.

References birk1, birk2, birk3, HBHEDarkening::degradation(), deliveredLumi, egammaForCoreTracking_cff::depth, depth_, CaloSD::getAttenuation(), HcalDDDSimConstants::getLayer0Wt(), CaloSD::getResponseWt(), hcalConstants, HcalDetId::ietaAbs(), HcalDetId::iphi(), isItScintillator(), TrackInformation::isPrimary(), ke, CaloSD::kmaxIon, CaloSD::kmaxNeutron, CaloSD::kmaxProton, layerWeight(), m_HBDarkening, m_HEDarkening, MeV, neutralDensity, phi, setDetUnitId(), DetId::subdetId(), CaloSD::suppressHeavy, testNumber, CaloSD::theTrack, HcalTestNumbering::unpackHcalIndex(), useBirk, useLayerWt, mps_merge::weight, z, and HcalDetId::zside().

463  {
464  double destep = aStep->GetTotalEnergyDeposit();
465  double weight = 1;
466  theTrack = aStep->GetTrack();
467 
468  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
469  uint32_t detid = setDetUnitId(aStep);
470  int det(0), ieta(0), phi(0), z(0), lay, depth(-1);
471  if (testNumber) {
472  HcalTestNumbering::unpackHcalIndex(detid,det,z,depth,ieta,phi,lay);
473  if (z==0) z = -1;
474  } else {
475  HcalDetId hcid(detid);
476  det = hcid.subdetId();
477  ieta = hcid.ietaAbs();
478  phi = hcid.iphi();
479  z = hcid.zside();
480  }
481  lay = (touch->GetReplicaNumber(0)/10)%100 + 1;
482 #ifdef EDM_ML_DEBUG
483  edm::LogInfo("HcalSim") << "HCalSD: det: " << det << " ieta: "<< ieta
484  << " iphi: " << phi << " zside " << z << " lay: "
485  << lay-2;
486 #endif
487  if (depth_==0 && (det==1 || det==2) && ((!testNumber) || neutralDensity))
488  weight = hcalConstants->getLayer0Wt(det,phi,z);
489  if (useLayerWt) {
490  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
491  weight = layerWeight(det+2, hitPoint, depth_, lay);
492  }
493 
494  if (m_HBDarkening && det == 1) {
495  float dweight = m_HBDarkening->degradation(deliveredLumi,ieta,lay);
496  weight *= dweight;
497 #ifdef EDM_ML_DEBUG
498  edm::LogInfo("HcalSim") << "HCalSD: >>> HB Lumi: " << deliveredLumi
499  << " coefficient = " << dweight;
500 #endif
501  }
502 
503  if (m_HEDarkening && det == 2) {
504  float dweight = m_HEDarkening->degradation(deliveredLumi,ieta,lay);
505  weight *= dweight;
506 #ifdef EDM_ML_DEBUG
507  edm::LogInfo("HcalSim") << "HCalSD: >>> HE Lumi: " << deliveredLumi
508  << " coefficient = " << dweight;
509 #endif
510  }
511 
512  if (suppressHeavy) {
513  TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
514  if (trkInfo) {
515  int pdg = theTrack->GetDefinition()->GetPDGEncoding();
516  if (!(trkInfo->isPrimary())) { // Only secondary particles
517  double ke = theTrack->GetKineticEnergy()/MeV;
518  if ( pdg/1000000000 == 1 && (pdg/10000)%100 > 0 &&
519  (pdg/10)%100 > 0 && ke <kmaxIon ) weight = 0;
520  if ((pdg == 2212) && (ke < kmaxProton)) weight = 0;
521  if ((pdg == 2112) && (ke < kmaxNeutron)) weight = 0;
522 #ifdef EDM_ML_DEBUG
523  if (weight == 0)
524  edm::LogInfo("HcalSim") << "HCalSD:Ignore Track "
525  << theTrack->GetTrackID() << " Type "
526  << theTrack->GetDefinition()->GetParticleName()
527  << " Kinetic Energy " << ke << " MeV";
528 #endif
529  }
530  }
531  }
532 #ifdef EDM_ML_DEBUG
533  double weight0 = weight;
534 #endif
535  if (useBirk) {
536  const G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
537  if (isItScintillator(mat)) weight *= getAttenuation(aStep, birk1, birk2, birk3);
538  }
539  double wt1 = getResponseWt(theTrack);
540  double wt2 = theTrack->GetWeight();
541 #ifdef EDM_ML_DEBUG
542  edm::LogInfo("HcalSim") << "HCalSD: Detector " << det+2 << " Depth " << depth_
543  << " weight " << weight0 << " " << weight << " " << wt1
544  << " " << wt2;
545 #endif
546  double edep = weight*wt1*destep;
547  if (wt2 > 0.0) { edep *= wt2; }
548  return edep;
549 }
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3)
Definition: CaloSD.cc:439
double kmaxNeutron
Definition: CaloSD.h:135
G4int depth_
Definition: HCalSD.h:102
bool useLayerWt
Definition: HCalSD.h:96
double deliveredLumi
Definition: HCalSD.h:101
Definition: weight.py:1
double birk2
Definition: HCalSD.h:98
double birk1
Definition: HCalSD.h:98
double kmaxProton
Definition: CaloSD.h:135
const double MeV
bool testNumber
Definition: HCalSD.h:97
double kmaxIon
Definition: CaloSD.h:135
bool suppressHeavy
Definition: CaloSD.h:133
bool useBirk
Definition: HCalSD.h:96
double birk3
Definition: HCalSD.h:98
const HBHEDarkening * m_HEDarkening
Definition: HCalSD.h:93
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:551
G4Track * theTrack
Definition: CaloSD.h:119
double getLayer0Wt(const int &det, const int &phi, const int &zside) const
bool neutralDensity
Definition: HCalSD.h:97
int ke
bool isPrimary() const
double layerWeight(int, const G4ThreeVector &, int, int)
Definition: HCalSD.cc:1116
bool isItScintillator(const G4Material *)
Definition: HCalSD.cc:762
double getResponseWt(const G4Track *)
Definition: CaloSD.cc:581
const HBHEDarkening * m_HBDarkening
Definition: HCalSD.h:92
float degradation(float intlumi, int ieta, int lay) const
HcalDDDSimConstants * hcalConstants
Definition: HCalSD.h:83
void HCalSD::getFromLibrary ( G4Step *  step,
double  weight 
)
private

Definition at line 785 of file HCalSD.cc.

References CaloSD::checkHit(), CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, egammaForCoreTracking_cff::depth, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::emPDG, CaloSD::epPDG, CaloSD::gammaPDG, HFShowerLibrary::getHits(), GetVolume(), GeV, hfClusterShapes_cfi::hits, mps_fire::i, isItinFidVolume(), GetRecoTauVFromDQM_MC_cff::kk, convertSQLiteXML::ok, plotHF(), plotProfile(), CaloSD::posGlobal, CaloSD::preStepPoint, CaloSD::previousID, CaloSD::resetForNewPrimary(), setDetUnitId(), CaloHitID::setID(), setTrackID(), showerLibrary, CaloSD::theTrack, ntuplemaker::time, and CaloSD::updateHit().

Referenced by ProcessHits().

785  {
786  preStepPoint = aStep->GetPreStepPoint();
787  theTrack = aStep->GetTrack();
788  int det = 5;
789  bool ok;
790 
791  std::vector<HFShowerLibrary::Hit> hits = showerLibrary->getHits(aStep, ok, weight, false);
792 
793  double etrack = preStepPoint->GetKineticEnergy();
794  int primaryID = setTrackID(aStep);
795 
796  // Reset entry point for new primary
797  posGlobal = preStepPoint->GetPosition();
798  resetForNewPrimary(posGlobal, etrack);
799 
800  G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
801  if (particleCode==emPDG || particleCode==epPDG || particleCode==gammaPDG) {
802  edepositEM = 1.*GeV;
803  edepositHAD = 0.;
804  } else {
805  edepositEM = 0.;
806  edepositHAD = 1.*GeV;
807  }
808 #ifdef EDM_ML_DEBUG
809  edm::LogInfo("HcalSim") << "HCalSD::getFromLibrary " <<hits.size()
810  << " hits for " << GetName() << " of " << primaryID
811  << " with " << theTrack->GetDefinition()->GetParticleName()
812  << " of " << preStepPoint->GetKineticEnergy()/GeV << " GeV";
813 #endif
814  for (unsigned int i=0; i<hits.size(); ++i) {
815  G4ThreeVector hitPoint = hits[i].position;
816  if (isItinFidVolume (hitPoint)) {
817  int depth = hits[i].depth;
818  double time = hits[i].time;
819  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
820  currentID.setID(unitID, time, primaryID, 0);
821 #ifdef plotDebug
822  plotProfile(aStep, hitPoint, 1.0*GeV, time, depth);
823  bool emType = false;
824  if (particleCode==emPDG || particleCode==epPDG || particleCode==gammaPDG)
825  emType = true;
826  plotHF(hitPoint,emType);
827 #endif
828 
829  // check if it is in the same unit and timeslice as the previous one
830  if (currentID == previousID) {
832  } else {
833  if (!checkHit()) currentHit = createNewHit();
834  }
835  }
836  }
837 
838  //Now kill the current track
839  if (ok) {
840  theTrack->SetTrackStatus(fStopAndKill);
841  G4TrackVector tv = *(aStep->GetSecondary());
842  for (unsigned int kk=0; kk<tv.size(); ++kk)
843  if (tv[kk]->GetVolume() == preStepPoint->GetPhysicalVolume())
844  tv[kk]->SetTrackStatus(fStopAndKill);
845  }
846 }
float edepositEM
Definition: CaloSD.h:122
G4int emPDG
Definition: CaloSD.h:137
const double GeV
Definition: MathUtil.h:16
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:414
std::vector< Hit > getHits(G4Step *aStep, bool &ok, double weight, bool onlyLong=false)
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:1138
Definition: weight.py:1
G4ThreeVector posGlobal
Definition: CaloSD.h:114
G4bool checkHit()
Definition: CaloSD.cc:305
int setTrackID(const G4Step *step)
Definition: HCalSD.cc:1069
void resetForNewPrimary(const G4ThreeVector &, double)
Definition: CaloSD.cc:428
float edepositHAD
Definition: CaloSD.h:122
G4int epPDG
Definition: CaloSD.h:137
G4int gammaPDG
Definition: CaloSD.h:137
void plotHF(const G4ThreeVector &pos, bool emType)
Definition: HCalSD.cc:1185
CaloHitID previousID
Definition: CaloSD.h:118
CaloG4Hit * currentHit
Definition: CaloSD.h:129
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:551
G4Track * theTrack
Definition: CaloSD.h:119
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:121
static const G4LogicalVolume * GetVolume(const std::string &name)
CaloHitID currentID
Definition: CaloSD.h:118
bool isItinFidVolume(const G4ThreeVector &)
Definition: HCalSD.cc:768
HFShowerLibrary * showerLibrary
Definition: HCalSD.h:86
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:337
void HCalSD::getFromParam ( G4Step *  step,
double  weight 
)
private

Definition at line 900 of file HCalSD.cc.

References CaloSD::checkHit(), CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, egammaForCoreTracking_cff::depth, CaloSD::edepositEM, CaloSD::edepositHAD, HFShowerParam::getHits(), GeV, hfClusterShapes_cfi::hits, mps_fire::i, plotProfile(), CaloSD::posGlobal, CaloSD::preStepPoint, CaloSD::previousID, setDetUnitId(), CaloHitID::setID(), setTrackID(), showerParam, ntuplemaker::time, and CaloSD::updateHit().

Referenced by ProcessHits().

900  {
901  std::vector<HFShowerParam::Hit> hits = showerParam->getHits(aStep, weight);
902  int nHit = static_cast<int>(hits.size());
903 
904  if (nHit > 0) {
905  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
906  int primaryID = setTrackID(aStep);
907 
908  int det = 5;
909 #ifdef EDM_ML_DEBUG
910  edm::LogInfo("HcalSim") << "HCalSD::getFromParam " << nHit << " hits for "
911  << GetName() << " of " << primaryID << " with "
912  << aStep->GetTrack()->GetDefinition()->GetParticleName()
913  << " of " << preStepPoint->GetKineticEnergy()/GeV
914  << " GeV in detector type " << det;
915 #endif
916  for (int i = 0; i<nHit; ++i) {
917  G4ThreeVector hitPoint = hits[i].position;
918  int depth = hits[i].depth;
919  double time = hits[i].time;
920  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
921  currentID.setID(unitID, time, primaryID, 0);
922  edepositEM = hits[i].edep*GeV;
923  edepositHAD = 0.;
924 #ifdef plotDebug
925  plotProfile(aStep, hitPoint, edepositEM, time, depth);
926 #endif
927 
928  // check if it is in the same unit and timeslice as the previous one
929  if (currentID == previousID) {
931  } else {
932  posGlobal = preStepPoint->GetPosition();
933  if (!checkHit()) currentHit = createNewHit();
934  }
935  }
936  }
937 }
float edepositEM
Definition: CaloSD.h:122
HFShowerParam * showerParam
Definition: HCalSD.h:88
const double GeV
Definition: MathUtil.h:16
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:414
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:1138
Definition: weight.py:1
G4ThreeVector posGlobal
Definition: CaloSD.h:114
G4bool checkHit()
Definition: CaloSD.cc:305
int setTrackID(const G4Step *step)
Definition: HCalSD.cc:1069
float edepositHAD
Definition: CaloSD.h:122
CaloHitID previousID
Definition: CaloSD.h:118
CaloG4Hit * currentHit
Definition: CaloSD.h:129
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:551
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:121
CaloHitID currentID
Definition: CaloSD.h:118
std::vector< Hit > getHits(G4Step *aStep, double weight)
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:337
void HCalSD::getHitFibreBundle ( const G4Step *  step,
bool  type 
)
private

Definition at line 1006 of file HCalSD.cc.

References beta, CaloSD::checkHit(), CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, TauDecayModes::dec, egammaForCoreTracking_cff::depth, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::energyCut, HFShowerFibreBundle::getHits(), HFShowerFibreBundle::getRadius(), GeV, HcalForward, LogDebug, numberingFromDDD, phi, plotProfile(), CaloSD::posGlobal, CaloSD::preStepPoint, CaloSD::previousID, CaloSD::resetForNewPrimary(), findQualityFiles::rr, setDetUnitId(), CaloHitID::setID(), showerBundle, CaloSD::theTrack, ntuplemaker::time, tmp, HcalNumberingFromDDD::unitID(), and CaloSD::updateHit().

Referenced by ProcessHits().

1006  {
1007  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
1008  const G4Track* theTrack = aStep->GetTrack();
1009  double edep = showerBundle->getHits(aStep, type);
1010 
1011  if (edep >= 0) {
1012  double etrack = preStepPoint->GetKineticEnergy();
1013  int primaryID = 0;
1014  if (etrack >= energyCut) {
1015  primaryID = theTrack->GetTrackID();
1016  } else {
1017  primaryID = theTrack->GetParentID();
1018  if (primaryID == 0) primaryID = theTrack->GetTrackID();
1019  }
1020  // Reset entry point for new primary
1021  posGlobal = preStepPoint->GetPosition();
1022  resetForNewPrimary(posGlobal, etrack);
1023 
1024  //
1025  int det = static_cast<int>(HcalForward);
1026  const G4ThreeVector& hitPoint = preStepPoint->GetPosition();
1027  double rr = (hitPoint.x()*hitPoint.x() + hitPoint.y()*hitPoint.y());
1028  double phi = (rr == 0. ? 0. :atan2(hitPoint.y(),hitPoint.x()));
1029  double etaR = showerBundle->getRadius();
1030  int depth = 1;
1031  if (etaR < 0) {
1032  depth = 2;
1033  etaR =-etaR;
1034  }
1035  if (hitPoint.z() < 0) etaR =-etaR;
1036 #ifdef EDM_ML_DEBUG
1037  LogDebug("HcalSim") << "HCalSD::Hit for Detector " << det << " etaR "
1038  << etaR << " phi " << phi/deg << " depth " <<depth;
1039 #endif
1040  double time = (aStep->GetPostStepPoint()->GetGlobalTime());
1041  uint32_t unitID = 0;
1042  if (numberingFromDDD) {
1043  HcalNumberingFromDDD::HcalID tmp = numberingFromDDD->unitID(det,etaR,phi,depth,1);
1044  unitID = setDetUnitId(tmp);
1045  }
1046  if (type) currentID.setID(unitID, time, primaryID, 3);
1047  else currentID.setID(unitID, time, primaryID, 2);
1048 
1049  edepositHAD = aStep->GetTotalEnergyDeposit();
1050  edepositEM =-edepositHAD + (edep*GeV);
1051 #ifdef plotDebug
1052  plotProfile(aStep, hitPoint, edep*GeV, time, depth);
1053 #endif
1054 #ifdef EDM_ML_DEBUG
1055  double beta = preStepPoint->GetBeta();
1056  LogDebug("HcalSim") << "HCalSD::getHitFibreBundle 1 hit for " << GetName()
1057  << " of " << primaryID << " with "
1058  << theTrack->GetDefinition()->GetParticleName()
1059  << " of " << preStepPoint->GetKineticEnergy()/GeV
1060  << " GeV with velocity " << beta << " UnitID "
1061  << std::hex << unitID << std::dec;
1062 #endif
1063  // check if it is in the same unit and timeslice as the previous one
1065  else if (!checkHit()) currentHit = createNewHit();
1066  } // non-zero energy deposit
1067 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:122
const double beta
double energyCut
Definition: CaloSD.h:124
type
Definition: HCALResponse.h:21
const double GeV
Definition: MathUtil.h:16
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:414
HFShowerFibreBundle * showerBundle
Definition: HCalSD.h:90
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:1138
G4ThreeVector posGlobal
Definition: CaloSD.h:114
G4bool checkHit()
Definition: CaloSD.cc:305
void resetForNewPrimary(const G4ThreeVector &, double)
Definition: CaloSD.cc:428
float edepositHAD
Definition: CaloSD.h:122
double getHits(const G4Step *aStep, bool type)
CaloHitID previousID
Definition: CaloSD.h:118
CaloG4Hit * currentHit
Definition: CaloSD.h:129
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:551
G4Track * theTrack
Definition: CaloSD.h:119
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:121
CaloHitID currentID
Definition: CaloSD.h:118
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:84
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
HcalID unitID(int det, const CLHEP::Hep3Vector &pos, int depth, int lay=-1) const
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:337
void HCalSD::getHitPMT ( const G4Step *  step)
private

Definition at line 939 of file HCalSD.cc.

References beta, CaloSD::checkHit(), CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, TauDecayModes::dec, egammaForCoreTracking_cff::depth, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::energyCut, HFShowerPMT::getHits(), HFShowerPMT::getRadius(), GeV, HcalForward, LogDebug, numberingFromDDD, phi, plotProfile(), CaloSD::posGlobal, CaloSD::preStepPoint, CaloSD::previousID, CaloSD::resetForNewPrimary(), findQualityFiles::rr, setDetUnitId(), CaloHitID::setID(), showerPMT, CaloSD::theTrack, ntuplemaker::time, tmp, HcalNumberingFromDDD::unitID(), and CaloSD::updateHit().

Referenced by ProcessHits().

939  {
940 
941  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
942  const G4Track* theTrack = aStep->GetTrack();
943  double edep = showerPMT->getHits(aStep);
944 
945  if (edep >= 0) {
946  double etrack = preStepPoint->GetKineticEnergy();
947  int primaryID = 0;
948  if (etrack >= energyCut) {
949  primaryID = theTrack->GetTrackID();
950  } else {
951  primaryID = theTrack->GetParentID();
952  if (primaryID == 0) primaryID = theTrack->GetTrackID();
953  }
954  // Reset entry point for new primary
955  posGlobal = preStepPoint->GetPosition();
956  resetForNewPrimary(posGlobal, etrack);
957 
958  //
959  int det = static_cast<int>(HcalForward);
960  const G4ThreeVector& hitPoint = preStepPoint->GetPosition();
961  double rr = (hitPoint.x()*hitPoint.x() + hitPoint.y()*hitPoint.y());
962  double phi = (rr == 0. ? 0. :atan2(hitPoint.y(),hitPoint.x()));
963  double etaR = showerPMT->getRadius();
964  int depth = 1;
965  if (etaR < 0) {
966  depth = 2;
967  etaR =-etaR;
968  }
969  if (hitPoint.z() < 0) etaR =-etaR;
970 #ifdef EDM_ML_DEBUG
971  edm::LogInfo("HcalSim") << "HCalSD::Hit for Detector " << det << " etaR "
972  << etaR << " phi " << phi/deg << " depth " <<depth;
973 #endif
974  double time = (aStep->GetPostStepPoint()->GetGlobalTime());
975  uint32_t unitID = 0;
976  if (numberingFromDDD) {
978  depth,1);
979  unitID = setDetUnitId(tmp);
980  }
981  currentID.setID(unitID, time, primaryID, 1);
982 
983  edepositHAD = aStep->GetTotalEnergyDeposit();
984  edepositEM =-edepositHAD + (edep*GeV);
985 #ifdef plotDebug
986  plotProfile(aStep, hitPoint, edep*GeV, time, depth);
987 #endif
988 #ifdef EDM_ML_DEBUG
989  double beta = preStepPoint->GetBeta();
990  LogDebug("HcalSim") << "HCalSD::getHitPMT 1 hit for " << GetName()
991  << " of " << primaryID << " with "
992  << theTrack->GetDefinition()->GetParticleName()
993  << " of " << preStepPoint->GetKineticEnergy()/GeV
994  << " GeV with velocity " << beta << " UnitID "
995  << std::hex << unitID << std::dec;
996 #endif
997  // check if it is in the same unit and timeslice as the previous one
998  if (currentID == previousID) {
1000  } else {
1001  if (!checkHit()) currentHit = createNewHit();
1002  }
1003  }
1004 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:122
const double beta
double energyCut
Definition: CaloSD.h:124
double getRadius()
Definition: HFShowerPMT.cc:134
const double GeV
Definition: MathUtil.h:16
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:414
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:1138
G4ThreeVector posGlobal
Definition: CaloSD.h:114
G4bool checkHit()
Definition: CaloSD.cc:305
double getHits(const G4Step *aStep)
Definition: HFShowerPMT.cc:88
void resetForNewPrimary(const G4ThreeVector &, double)
Definition: CaloSD.cc:428
float edepositHAD
Definition: CaloSD.h:122
CaloHitID previousID
Definition: CaloSD.h:118
CaloG4Hit * currentHit
Definition: CaloSD.h:129
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:551
G4Track * theTrack
Definition: CaloSD.h:119
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:121
CaloHitID currentID
Definition: CaloSD.h:118
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:84
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
HFShowerPMT * showerPMT
Definition: HCalSD.h:89
HcalID unitID(int det, const CLHEP::Hep3Vector &pos, int depth, int lay=-1) const
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:337
std::vector< G4String > HCalSD::getNames ( DDFilteredView fv)
private

Definition at line 694 of file HCalSD.cc.

References DDFilteredView::firstChild(), mps_fire::i, cmsBatch::log, DDFilteredView::logicalPart(), DDName::name(), DDBase< N, C >::name(), DDFilteredView::next(), convertSQLiteXML::ok, and tmp.

694  {
695 
696  std::vector<G4String> tmp;
697  bool dodet = fv.firstChild();
698  while (dodet) {
699  const DDLogicalPart & log = fv.logicalPart();
700  bool ok = true;
701 
702  for (unsigned int i=0; i<tmp.size(); ++i) {
703  if (!strcmp(tmp[i].c_str(), log.name().name().c_str())) {
704  ok = false;
705  break;
706  }
707  }
708  if (ok) tmp.push_back(log.name().name());
709  dodet = fv.next();
710  }
711  return tmp;
712 }
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:78
bool next()
set current node to the next node in the filtered tree
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
bool firstChild()
set the current node to the first child ...
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
void HCalSD::hitForFibre ( const G4Step *  step,
double  weight 
)
private

Definition at line 848 of file HCalSD.cc.

References CaloSD::checkHit(), CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, egammaForCoreTracking_cff::depth, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::emPDG, CaloSD::epPDG, CaloSD::gammaPDG, HFShower::getHits(), GeV, hfshower, hfClusterShapes_cfi::hits, mps_fire::i, isItinFidVolume(), plotHF(), plotProfile(), CaloSD::posGlobal, CaloSD::preStepPoint, CaloSD::previousID, setDetUnitId(), CaloHitID::setID(), setTrackID(), CaloSD::theTrack, ntuplemaker::time, and CaloSD::updateHit().

Referenced by ProcessHits().

848  { // if not ParamShower
849 
850  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
851  const G4Track* theTrack = aStep->GetTrack();
852  int primaryID = setTrackID(aStep);
853 
854  int det = 5;
855  std::vector<HFShower::Hit> hits = hfshower->getHits(aStep, weight);
856 
857  G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
858  if (particleCode==emPDG || particleCode==epPDG || particleCode==gammaPDG) {
859  edepositEM = 1.*GeV;
860  edepositHAD = 0.;
861  } else {
862  edepositEM = 0.;
863  edepositHAD = 1.*GeV;
864  }
865 
866 #ifdef EDM_ML_DEBUG
867  edm::LogInfo("HcalSim") << "HCalSD::hitForFibre " << hits.size()
868  << " hits for " << GetName() << " of " << primaryID
869  << " with " << theTrack->GetDefinition()->GetParticleName()
870  << " of " << preStepPoint->GetKineticEnergy()/GeV
871  << " GeV in detector type " << det;
872 #endif
873  if (!hits.empty()) {
874  for (unsigned int i=0; i<hits.size(); ++i) {
875  G4ThreeVector hitPoint = hits[i].position;
876  if (isItinFidVolume (hitPoint)) {
877  int depth = hits[i].depth;
878  double time = hits[i].time;
879  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
880  currentID.setID(unitID, time, primaryID, 0);
881 #ifdef plotDebug
882  plotProfile(aStep, hitPoint, edepositEM, time, depth);
883  bool emType = false;
884  if (particleCode==emPDG || particleCode==epPDG || particleCode==gammaPDG)
885  emType = true;
886  plotHF(hitPoint,emType);
887 #endif
888  // check if it is in the same unit and timeslice as the previous one
889  if (currentID == previousID) {
891  } else {
892  posGlobal = preStepPoint->GetPosition();
893  if (!checkHit()) currentHit = createNewHit();
894  }
895  }
896  }
897  }
898 }
float edepositEM
Definition: CaloSD.h:122
G4int emPDG
Definition: CaloSD.h:137
const double GeV
Definition: MathUtil.h:16
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:414
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:1138
Definition: weight.py:1
G4ThreeVector posGlobal
Definition: CaloSD.h:114
G4bool checkHit()
Definition: CaloSD.cc:305
std::vector< Hit > getHits(const G4Step *aStep, double weight)
Definition: HFShower.cc:47
int setTrackID(const G4Step *step)
Definition: HCalSD.cc:1069
HFShower * hfshower
Definition: HCalSD.h:87
float edepositHAD
Definition: CaloSD.h:122
G4int epPDG
Definition: CaloSD.h:137
G4int gammaPDG
Definition: CaloSD.h:137
void plotHF(const G4ThreeVector &pos, bool emType)
Definition: HCalSD.cc:1185
CaloHitID previousID
Definition: CaloSD.h:118
CaloG4Hit * currentHit
Definition: CaloSD.h:129
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:551
G4Track * theTrack
Definition: CaloSD.h:119
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:121
CaloHitID currentID
Definition: CaloSD.h:118
bool isItinFidVolume(const G4ThreeVector &)
Definition: HCalSD.cc:768
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:337
void HCalSD::initRun ( )
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 609 of file HCalSD.cc.

References hcalConstants, hfshower, HFShowerPMT::initRun(), HFShowerFibreBundle::initRun(), HFShower::initRun(), HFShowerParam::initRun(), HFShowerLibrary::initRun(), LogDebug, mumPDG, mupPDG, HiggsValidation_cfi::particleName, showerBundle, showerLibrary, showerParam, and showerPMT.

609  {
610  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
611  G4String particleName;
612  mumPDG = theParticleTable->FindParticle(particleName="mu-")->GetPDGEncoding();
613  mupPDG = theParticleTable->FindParticle(particleName="mu+")->GetPDGEncoding();
614 #ifdef EDM_ML_DEBUG
615  LogDebug("HcalSim") << "HCalSD: Particle code for mu- = " << mumPDG
616  << " for mu+ = " << mupPDG;
617 #endif
618  if (showerLibrary) showerLibrary->initRun(theParticleTable,hcalConstants);
619  if (showerParam) showerParam->initRun(theParticleTable,hcalConstants);
620  if (hfshower) hfshower->initRun(theParticleTable,hcalConstants);
621  if (showerPMT) showerPMT->initRun(theParticleTable,hcalConstants);
622  if (showerBundle) showerBundle->initRun(theParticleTable,hcalConstants);
623 }
#define LogDebug(id)
HFShowerParam * showerParam
Definition: HCalSD.h:88
void initRun(G4ParticleTable *, HcalDDDSimConstants *)
Definition: HFShower.cc:454
HFShowerFibreBundle * showerBundle
Definition: HCalSD.h:90
void initRun(G4ParticleTable *, HcalDDDSimConstants *)
Definition: HFShowerPMT.cc:77
HFShower * hfshower
Definition: HCalSD.h:87
void initRun(G4ParticleTable *, HcalDDDSimConstants *)
G4int mupPDG
Definition: HCalSD.h:102
void initRun(G4ParticleTable *, HcalDDDSimConstants *)
G4int mumPDG
Definition: HCalSD.h:102
HFShowerPMT * showerPMT
Definition: HCalSD.h:89
HFShowerLibrary * showerLibrary
Definition: HCalSD.h:86
void initRun(G4ParticleTable *, HcalDDDSimConstants *)
HcalDDDSimConstants * hcalConstants
Definition: HCalSD.h:83
bool HCalSD::isItConicalBundle ( const G4LogicalVolume *  lv)
private

Definition at line 756 of file HCalSD.cc.

References fibre2LV.

Referenced by ProcessHits().

756  {
757  std::vector<const G4LogicalVolume*>::const_iterator ite = fibre2LV.begin();
758  for (; ite != fibre2LV.end(); ++ite) if (lv == *ite) return true;
759  return false;
760 }
std::vector< const G4LogicalVolume * > fibre2LV
Definition: HCalSD.h:107
bool HCalSD::isItFibre ( const G4LogicalVolume *  lv)
private

Definition at line 732 of file HCalSD.cc.

References fibreLV.

Referenced by HCalSD(), and ProcessHits().

732  {
733  std::vector<const G4LogicalVolume*>::const_iterator ite = fibreLV.begin();
734  for (; ite != fibreLV.end(); ++ite) if (lv == *ite) return true;
735  return false;
736 }
std::vector< const G4LogicalVolume * > fibreLV
Definition: HCalSD.h:107
bool HCalSD::isItFibre ( const G4String &  name)
private

Definition at line 738 of file HCalSD.cc.

References fibreNames.

738  {
739  std::vector<G4String>::const_iterator it = fibreNames.begin();
740  for (; it != fibreNames.end(); ++it) if (name == *it) return true;
741  return false;
742 }
std::vector< G4String > fibreNames
Definition: HCalSD.h:105
bool HCalSD::isItHF ( const G4Step *  aStep)
private

Definition at line 714 of file HCalSD.cc.

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

Referenced by HCalSD(), and ProcessHits().

714  {
715  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
716  int levels = (touch->GetHistoryDepth()) + 1;
717  for (unsigned int it=0; it < hfNames.size(); ++it) {
718  if (levels >= hfLevels[it]) {
719  const G4LogicalVolume* lv = touch->GetVolume(levels-hfLevels[it])->GetLogicalVolume();
720  if (lv == hfLV[it]) return true;
721  }
722  }
723  return false;
724 }
std::vector< const G4LogicalVolume * > hfLV
Definition: HCalSD.h:107
std::vector< int > hfLevels
Definition: HCalSD.h:104
std::vector< G4String > hfNames
Definition: HCalSD.h:105
bool HCalSD::isItHF ( const G4String &  name)
private

Definition at line 726 of file HCalSD.cc.

References hfNames.

726  {
727  std::vector<G4String>::const_iterator it = hfNames.begin();
728  for (; it != hfNames.end(); ++it) if (name == *it) return true;
729  return false;
730 }
std::vector< G4String > hfNames
Definition: HCalSD.h:105
bool HCalSD::isItinFidVolume ( const G4ThreeVector &  hitPoint)
private

Definition at line 768 of file HCalSD.cc.

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

Referenced by getFromLibrary(), and hitForFibre().

768  {
769  bool flag = true;
770  if (applyFidCut) {
771  int npmt = HFFibreFiducial:: PMTNumber(hitPoint);
772 #ifdef EDM_ML_DEBUG
773  edm::LogInfo("HcalSim") << "HCalSD::isItinFidVolume:#PMT= " << npmt
774  << " for hit point " << hitPoint;
775 #endif
776  if (npmt <= 0) flag = false;
777  }
778 #ifdef EDM_ML_DEBUG
779  edm::LogInfo("HcalSim") << "HCalSD::isItinFidVolume: point " << hitPoint
780  << " return flag " << flag;
781 #endif
782  return flag;
783 }
static int PMTNumber(const G4ThreeVector &pe_effect)
bool applyFidCut
Definition: HCalSD.h:99
bool HCalSD::isItPMT ( const G4LogicalVolume *  lv)
private

Definition at line 744 of file HCalSD.cc.

References pmtLV.

Referenced by ProcessHits().

744  {
745  std::vector<const G4LogicalVolume*>::const_iterator ite = pmtLV.begin();
746  for (; ite != pmtLV.end(); ++ite) if (lv == *ite) return true;
747  return false;
748 }
std::vector< const G4LogicalVolume * > pmtLV
Definition: HCalSD.h:107
bool HCalSD::isItScintillator ( const G4Material *  mat)
private

Definition at line 762 of file HCalSD.cc.

References materials.

Referenced by getEnergyDeposit().

762  {
763  std::vector<const G4Material*>::const_iterator ite = materials.begin();
764  for (; ite != materials.end(); ++ite) if (mat == *ite) return true;
765  return false;
766 }
std::vector< const G4Material * > materials
Definition: HCalSD.h:106
bool HCalSD::isItStraightBundle ( const G4LogicalVolume *  lv)
private

Definition at line 750 of file HCalSD.cc.

References fibre1LV.

Referenced by ProcessHits().

750  {
751  std::vector<const G4LogicalVolume*>::const_iterator ite = fibre1LV.begin();
752  for (; ite != fibre1LV.end(); ++ite) if (lv == *ite) return true;
753  return false;
754 }
std::vector< const G4LogicalVolume * > fibre1LV
Definition: HCalSD.h:107
double HCalSD::layerWeight ( int  det,
const G4ThreeVector &  pos,
int  depth,
int  lay 
)
private

Definition at line 1116 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, tmp, HcalNumberingFromDDD::unitID(), and HcalNumberingFromDDD::HcalID::zside.

Referenced by getEnergyDeposit().

1116  {
1117 
1118  double wt = 1.;
1119  if (numberingFromDDD) {
1120  //get the ID's as eta, phi, depth, ... indices
1122  depth, lay);
1123  modifyDepth(tmp);
1124  uint32_t id = HcalTestNumbering::packHcalIndex(tmp.subdet, tmp.zside, 1,
1125  tmp.etaR, tmp.phis,tmp.lay);
1126  std::map<uint32_t,double>::const_iterator ite = layerWeights.find(id);
1127  if (ite != layerWeights.end()) wt = ite->second;
1128 #ifdef EDM_ML_DEBUG
1129  edm::LogInfo("HcalSim") << "HCalSD::layerWeight: ID " << std::hex << id
1130  << std::dec << " (" << tmp.subdet << "/"
1131  << tmp.zside << "/1/" << tmp.etaR << "/"
1132  << tmp.phis << "/" << tmp.lay << ") Weight " <<wt;
1133 #endif
1134  }
1135  return wt;
1136 }
void modifyDepth(HcalNumberingFromDDD::HcalID &id)
Definition: HCalSD.cc:1194
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:84
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
#define EDM_ML_DEBUG
std::map< uint32_t, double > layerWeights
Definition: HCalSD.h:108
HcalID unitID(int det, const CLHEP::Hep3Vector &pos, int depth, int lay=-1) const
void HCalSD::modifyDepth ( HcalNumberingFromDDD::HcalID id)
private

Definition at line 1194 of file HCalSD.cc.

References egammaForCoreTracking_cff::depth, depth_, hcalConstants, HcalDDDSimConstants::maxHFDepth(), and testNumber.

Referenced by layerWeight(), and setDetUnitId().

1194  {
1195  if (id.subdet == 4) {
1196  int ieta = (id.zside == 0) ? -id.etaR : id.etaR;
1197  if (hcalConstants->maxHFDepth(ieta,id.phis) > 2) {
1198  if (id.depth <= 2) {
1199  if (G4UniformRand() > 0.5) id.depth += 2;
1200  }
1201  }
1202  } else if ((id.subdet == 1 || id.subdet ==2) && testNumber) {
1203  if (depth_ == 0) id.depth = 1;
1204  else id.depth = 2;
1205  }
1206 }
G4int depth_
Definition: HCalSD.h:102
bool testNumber
Definition: HCalSD.h:97
int maxHFDepth(const int &ieta, const int &iphi) const
HcalDDDSimConstants * hcalConstants
Definition: HCalSD.h:83
void HCalSD::plotHF ( const G4ThreeVector &  pos,
bool  emType 
)
private

Definition at line 1185 of file HCalSD.cc.

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

Referenced by getFromLibrary(), and hitForFibre().

1185  {
1186  double zv = std::abs(hitPoint.z()) - gpar[4];
1187  if (emType) {
1188  if (hzvem != nullptr) hzvem->Fill(zv);
1189  } else {
1190  if (hzvhad != nullptr) hzvhad->Fill(zv);
1191  }
1192 }
std::vector< double > gpar
Definition: HCalSD.h:103
TH1F * hzvhad
Definition: HCalSD.h:109
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TH1F * hzvem
Definition: HCalSD.h:109
void HCalSD::plotProfile ( const G4Step *  step,
const G4ThreeVector &  pos,
double  edep,
double  time,
int  id 
)
private

Definition at line 1138 of file HCalSD.cc.

References funct::abs(), egammaForCoreTracking_cff::depth, dist_, runEdmFileComparison::found, hit_, training_settings::idx, cuy::ii, DTRecHitClients_cfi::local, LogDebug, gen::n, dataset::name, ntuplemaker::time, and time_.

Referenced by getFromLibrary(), getFromParam(), getHitFibreBundle(), getHitPMT(), hitForFibre(), and ProcessHits().

1139  {
1140 
1141  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
1142  static const G4String modName[8] = {"HEModule", "HVQF" , "HBModule", "MBAT",
1143  "MBBT" , "MBBTC", "MBBT_R1P", "MBBT_R1M"};
1144  G4ThreeVector local;
1145  bool found=false;
1146  double depth=-2000;
1147  int idx = 4;
1148  for (int n=0; n<touch->GetHistoryDepth(); ++n) {
1149  G4String name = touch->GetVolume(n)->GetName();
1150 #ifdef EDM_ML_DEBUG
1151  LogDebug("HcalSim") << "plotProfile Depth " << n << " Name " << name;
1152 #endif
1153  for (unsigned int ii=0; ii<8; ++ii) {
1154  if (name == modName[ii]) {
1155  found = true;
1156  int dn = touch->GetHistoryDepth() - n;
1157  local = touch->GetHistory()->GetTransform(dn).TransformPoint(global);
1158  if (ii == 0) {depth = local.z() - 4006.5; idx = 1;}
1159  else if (ii == 1) {depth = local.z() + 825.0; idx = 3;}
1160  else if (ii == 2) {depth = local.x() - 1775.; idx = 0;}
1161  else {depth = local.y() + 15.; idx = 2;}
1162  break;
1163  }
1164  }
1165  if (found) break;
1166  }
1167  if (!found) depth = std::abs(global.z()) - 11500;
1168 #ifdef EDM_ML_DEBUG
1169  LogDebug("HcalSim") << "plotProfile Found " << found << " Global " << global
1170  << " Local " << local << " depth " << depth << " ID "
1171  << id << " EDEP " << edep << " Time " << time;
1172 #endif
1173  if (hit_[idx] != nullptr) hit_[idx]->Fill(edep);
1174  if (time_[idx] != nullptr) time_[idx]->Fill(time,edep);
1175  if (dist_[idx] != nullptr) dist_[idx]->Fill(depth,edep);
1176  int jd = 2*idx + id - 7;
1177  if (jd >= 0 && jd < 4) {
1178  jd += 5;
1179  if (hit_[jd] != nullptr) hit_[jd]->Fill(edep);
1180  if (time_[jd] != nullptr) time_[jd]->Fill(time,edep);
1181  if (dist_[jd] != nullptr) dist_[jd]->Fill(depth,edep);
1182  }
1183 }
#define LogDebug(id)
TH1F * time_[9]
Definition: HCalSD.h:109
TH1F * hit_[9]
Definition: HCalSD.h:109
TH1F * dist_[9]
Definition: HCalSD.h:109
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ii
Definition: cuy.py:588
bool HCalSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
overridevirtual

Reimplemented from CaloSD.

Definition at line 358 of file HCalSD.cc.

References funct::abs(), CaloSD::createNewHit(), CaloSD::currentHit, deliveredLumi, depth_, CaloSD::edepositEM, CaloSD::edepositHAD, getFromLibrary(), getFromParam(), getHitFibreBundle(), getHitPMT(), CaloSD::getNumberOfHits(), CaloSD::getStepInfo(), CaloSD::hitExists(), hitForFibre(), mps_fire::i, createfilelist::int, isItConicalBundle(), isItFibre(), isItHF(), isItPMT(), isItStraightBundle(), LogDebug, HFDarkening::lowZLimit, m_HFDarkening, mumPDG, mupPDG, SensitiveDetector::NaNTrap(), HFDarkening::numberOfZLayers, plotProfile(), alignCSCRings::r, showerBundle, showerPMT, HFDarkening::upperZLimit, useFibreBundle, useParam, usePMTHit, useShowerLibrary, mps_merge::weight, and z.

358  {
359 
360  NaNTrap( aStep ) ;
361 
362  if (aStep == nullptr) {
363  return true;
364  } else {
365  depth_ = (aStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber(0))%10;
366  const G4LogicalVolume* lv =
367  aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
368  G4String nameVolume = lv->GetName();
369  if (isItHF(aStep)) {
370  G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
371  double weight(1.0);
372  if (m_HFDarkening) {
373  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
374  double r = hitPoint.perp()/CLHEP::cm;
375  double z = std::abs(hitPoint.z())/CLHEP::cm;
376  double dose_acquired = 0.;
378  unsigned int hfZLayer = (int)((z - HFDarkening::lowZLimit)/5);
379  if (hfZLayer >= HFDarkening::upperZLimit) hfZLayer = (HFDarkening::upperZLimit-1);
380  float normalized_lumi = m_HFDarkening->int_lumi(deliveredLumi);
381  for (int i = hfZLayer; i != HFDarkening::numberOfZLayers; ++i) {
382  dose_acquired = m_HFDarkening->dose(i,r);
383  weight *= m_HFDarkening->degradation(normalized_lumi*dose_acquired);
384  }
385  }
386 #ifdef EDM_ML_DEBUG
387  LogDebug("HcalSim") << "HCalSD: HFLumiDarkening at r = " << r
388  << ", z = " << z << " Dose " << dose_acquired
389  << " weight " << weight;
390 #endif
391  }
392  if (useParam) {
393 #ifdef EDM_ML_DEBUG
394  LogDebug("HcalSim") << "HCalSD: " << getNumberOfHits()
395  << " hits from parametrization in " << nameVolume
396  << " for Track " << aStep->GetTrack()->GetTrackID()
397  <<" (" << aStep->GetTrack()->GetDefinition()->GetParticleName()
398  <<")";
399 #endif
400  getFromParam(aStep, weight);
401 #ifdef EDM_ML_DEBUG
402  LogDebug("HcalSim") << "HCalSD: " << getNumberOfHits()
403  << " hits afterParamS*";
404 #endif
405  } else {
406  bool notaMuon = true;
407  if (parCode == mupPDG || parCode == mumPDG ) notaMuon = false;
408  if (useShowerLibrary && notaMuon) {
409 #ifdef EDM_ML_DEBUG
410  LogDebug("HcalSim") << "HCalSD: Starts shower library from "
411  << nameVolume << " for Track "
412  << aStep->GetTrack()->GetTrackID() << " ("
413  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
414 #endif
415  getFromLibrary(aStep, weight);
416  } else if (isItFibre(lv)) {
417 #ifdef EDM_ML_DEBUG
418  LogDebug("HcalSim") << "HCalSD: Hit at Fibre in " << nameVolume
419  << " for Track "
420  << aStep->GetTrack()->GetTrackID() <<" ("
421  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
422 #endif
423  hitForFibre(aStep, weight);
424  }
425  }
426  } else if (isItPMT(lv)) {
427 #ifdef EDM_ML_DEBUG
428  LogDebug("HcalSim") << "HCalSD: Hit from PMT parametrization from "
429  << nameVolume << " for Track "
430  << aStep->GetTrack()->GetTrackID() << " ("
431  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
432 #endif
433  if (usePMTHit && showerPMT) getHitPMT(aStep);
434  } else if (isItStraightBundle(lv) || isItConicalBundle(lv)) {
435 #ifdef EDM_ML_DEBUG
436  LogDebug("HcalSim") << "HCalSD: Hit from FibreBundle from "
437  << nameVolume << " for Track "
438  << aStep->GetTrack()->GetTrackID() << " ("
439  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
440 #endif
443  } else {
444 #ifdef EDM_ML_DEBUG
445  LogDebug("HcalSim") << "HCalSD: Hit from standard path from "
446  << nameVolume << " for Track "
447  << aStep->GetTrack()->GetTrackID() << " ("
448  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
449 #endif
450  if (getStepInfo(aStep)) {
451 #ifdef plotDebug
452  if (edepositEM+edepositHAD > 0)
453  plotProfile(aStep, aStep->GetPreStepPoint()->GetPosition(),
454  edepositEM+edepositHAD,aStep->GetPostStepPoint()->GetGlobalTime(),0);
455 #endif
456  if (hitExists() == false && edepositEM+edepositHAD>0.) currentHit = createNewHit();
457  }
458  }
459  return true;
460  }
461 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:122
bool useParam
Definition: HCalSD.h:99
void getFromParam(G4Step *step, double weight)
Definition: HCalSD.cc:900
G4int depth_
Definition: HCalSD.h:102
bool useFibreBundle
Definition: HCalSD.h:96
double deliveredLumi
Definition: HCalSD.h:101
HFShowerFibreBundle * showerBundle
Definition: HCalSD.h:90
bool useShowerLibrary
Definition: HCalSD.h:99
void plotProfile(const G4Step *step, const G4ThreeVector &pos, double edep, double time, int id)
Definition: HCalSD.cc:1138
Definition: weight.py:1
void getFromLibrary(G4Step *step, double weight)
Definition: HCalSD.cc:785
bool usePMTHit
Definition: HCalSD.h:96
static const unsigned int numberOfZLayers
Definition: HFDarkening.h:26
bool isItConicalBundle(const G4LogicalVolume *)
Definition: HCalSD.cc:756
float edepositHAD
Definition: CaloSD.h:122
std::unique_ptr< HFDarkening > m_HFDarkening
Definition: HCalSD.h:94
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int getNumberOfHits()
Definition: CaloSD.cc:335
CaloG4Hit * currentHit
Definition: CaloSD.h:129
virtual G4bool getStepInfo(G4Step *aStep)
Definition: CaloSD.cc:224
bool isItStraightBundle(const G4LogicalVolume *)
Definition: HCalSD.cc:750
G4int mupPDG
Definition: HCalSD.h:102
static const unsigned int lowZLimit
Definition: HFDarkening.h:29
static const unsigned int upperZLimit
Definition: HFDarkening.h:30
void getHitFibreBundle(const G4Step *step, bool type)
Definition: HCalSD.cc:1006
void hitForFibre(const G4Step *step, double weight)
Definition: HCalSD.cc:848
bool isItPMT(const G4LogicalVolume *)
Definition: HCalSD.cc:744
void getHitPMT(const G4Step *step)
Definition: HCalSD.cc:939
bool isItHF(const G4Step *)
Definition: HCalSD.cc:714
G4bool hitExists()
Definition: CaloSD.cc:284
G4int mumPDG
Definition: HCalSD.h:102
HFShowerPMT * showerPMT
Definition: HCalSD.h:89
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:337
bool isItFibre(const G4LogicalVolume *)
Definition: HCalSD.cc:732
void NaNTrap(const G4Step *step) const
void HCalSD::readWeightFromFile ( const std::string &  fName)
private

Definition at line 1090 of file HCalSD.cc.

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

Referenced by HCalSD().

1090  {
1091 
1092  std::ifstream infile;
1093  int entry=0;
1094  infile.open(fName.c_str(), std::ios::in);
1095  if (infile) {
1096  int det, zside, etaR, phi, lay;
1097  double wt;
1098  while (infile >> det >> zside >> etaR >> phi >> lay >> wt) {
1099  uint32_t id = HcalTestNumbering::packHcalIndex(det,zside,1,etaR,phi,lay);
1100  layerWeights.insert(std::pair<uint32_t,double>(id,wt));
1101  ++entry;
1102 #ifdef EDM_ML_DEBUG
1103  edm::LogInfo("HcalSim") << "HCalSD::readWeightFromFile:Entry " << entry
1104  << " ID " << std::hex << id << std::dec << " ("
1105  << det << "/" << zside << "/1/" << etaR << "/"
1106  << phi << "/" << lay << ") Weight " << wt;
1107 #endif
1108  }
1109  infile.close();
1110  }
1111  edm::LogInfo("HcalSim") << "HCalSD::readWeightFromFile: reads " << entry
1112  << " weights from " << fName;
1113  if (entry <= 0) useLayerWt = false;
1114 }
bool useLayerWt
Definition: HCalSD.h:96
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:108
uint32_t HCalSD::setDetUnitId ( const G4Step *  step)
overridevirtual

Implements CaloSD.

Definition at line 551 of file HCalSD.cc.

References egammaForCoreTracking_cff::depth.

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

551  {
552 
553  const G4StepPoint* prePoint = aStep->GetPreStepPoint();
554  const G4VTouchable* touch = prePoint->GetTouchable();
555  const G4ThreeVector& hitPoint = prePoint->GetPosition();
556 
557  int depth = (touch->GetReplicaNumber(0))%10 + 1;
558  int lay = (touch->GetReplicaNumber(0)/10)%100 + 1;
559  int det = (touch->GetReplicaNumber(1))/1000;
560 
561  return setDetUnitId (det, hitPoint, depth, lay);
562 }
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:551
uint32_t HCalSD::setDetUnitId ( int  det,
const G4ThreeVector &  pos,
int  depth,
int  lay = 1 
)
private

Definition at line 643 of file HCalSD.cc.

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

643  {
644  uint32_t id = 0;
645  if (numberingFromDDD) {
646  //get the ID's as eta, phi, depth, ... indices
648  id = setDetUnitId(tmp);
649  }
650  return id;
651 }
uint32_t setDetUnitId(const G4Step *step) override
Definition: HCalSD.cc:551
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:84
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
HcalID unitID(int det, const CLHEP::Hep3Vector &pos, int depth, int lay=-1) const
uint32_t HCalSD::setDetUnitId ( HcalNumberingFromDDD::HcalID tmp)
private

Definition at line 653 of file HCalSD.cc.

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

653  {
654  modifyDepth(tmp);
655  uint32_t id = (numberingScheme) ? numberingScheme->getUnitID(tmp) : 0;
656  if ((!testNumber) && hcalTestNS_) {
657  bool ok = hcalTestNS_->compare(tmp,id);
658  if (!ok)
659  edm::LogWarning("HcalSim") << "Det ID from HCalSD " << HcalDetId(id)
660  << " " << std::hex << id << std::dec
661  << " does not match one from relabller for "
662  << tmp.subdet << ":" << tmp.etaR << ":"
663  << tmp.phi << ":" << tmp.phis << ":"
664  << tmp.depth << ":" << tmp.lay << std::endl;
665  }
666  return id;
667 }
virtual uint32_t getUnitID(const HcalNumberingFromDDD::HcalID &id)
void modifyDepth(HcalNumberingFromDDD::HcalID &id)
Definition: HCalSD.cc:1194
bool compare(HcalNumberingFromDDD::HcalID const &, uint32_t const &)
Definition: HcalTestNS.cc:25
bool testNumber
Definition: HCalSD.h:97
HcalNumberingScheme * numberingScheme
Definition: HCalSD.h:85
HcalTestNS * hcalTestNS_
Definition: HCalSD.h:95
void HCalSD::setNumberingScheme ( HcalNumberingScheme scheme)

Definition at line 564 of file HCalSD.cc.

References numberingScheme.

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

564  {
565  if (scheme != nullptr) {
566  edm::LogInfo("HcalSim") << "HCalSD: updates numbering scheme for " << GetName();
567  if (numberingScheme) delete numberingScheme;
568  numberingScheme = scheme;
569  }
570 }
HcalNumberingScheme * numberingScheme
Definition: HCalSD.h:85
int HCalSD::setTrackID ( const G4Step *  step)
private

Definition at line 1069 of file HCalSD.cc.

References TrackInformation::getIDonCaloSurface(), CaloSD::preStepPoint, CaloSD::previousID, CaloSD::resetForNewPrimary(), CaloSD::theTrack, and CaloHitID::trackID().

Referenced by getFromLibrary(), getFromParam(), and hitForFibre().

1069  {
1070  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
1071  const G4Track* theTrack = aStep->GetTrack();
1072 
1073  double etrack = preStepPoint->GetKineticEnergy();
1074  TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
1075  int primaryID = trkInfo->getIDonCaloSurface();
1076  if (primaryID == 0) {
1077 #ifdef EDM_ML_DEBUG
1078  edm::LogInfo("HcalSim") << "HCalSD: Problem with primaryID **** set by "
1079  << "force to TkID **** " <<theTrack->GetTrackID();
1080 #endif
1081  primaryID = theTrack->GetTrackID();
1082  }
1083 
1084  if (primaryID != previousID.trackID())
1085  resetForNewPrimary(preStepPoint->GetPosition(), etrack);
1086 
1087  return primaryID;
1088 }
int getIDonCaloSurface() const
void resetForNewPrimary(const G4ThreeVector &, double)
Definition: CaloSD.cc:428
int trackID() const
Definition: CaloHitID.h:25
CaloHitID previousID
Definition: CaloSD.h:118
G4Track * theTrack
Definition: CaloSD.h:119
G4StepPoint * preStepPoint
Definition: CaloSD.h:121
void HCalSD::update ( const BeginOfJob )
overrideprotectedvirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfJob * >.

Definition at line 572 of file HCalSD.cc.

References agingFlagHB, agingFlagHE, Exception, edm::EventSetup::get(), HcalDDDSimConstants::getGparHF(), HcalDDDSimConstants::getMaxDepth(), gpar, hcalConstants, hcalTestNS_, m_HBDarkening, m_HEDarkening, numberingFromDDD, and testNS_.

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().

572  {
573 
574  const edm::EventSetup* es = (*job)();
576  es->get<HcalSimNumberingRecord>().get(hdc);
577  if (hdc.isValid()) {
578  hcalConstants = (HcalDDDSimConstants*)(&(*hdc));
579  } else {
580  edm::LogError("HcalSim") << "HCalSD : Cannot find HcalDDDSimConstant";
581  throw cms::Exception("Unknown", "HCalSD") << "Cannot find HcalDDDSimConstant" << "\n";
582  }
583 
585 
586  edm::LogInfo("HcalSim") << "Maximum depth for HF " << hcalConstants->getMaxDepth(2);
587 
588  //Special Geometry parameters
590  edm::LogInfo("HcalSim") << "HCalSD: " << gpar.size()<< " gpar (cm)";
591  for (unsigned int ig=0; ig<gpar.size(); ig++)
592  edm::LogInfo("HcalSim") << "HCalSD: gpar[" << ig << "] = "
593  << gpar[ig]/cm << " cm";
594  //Test Hcal Numbering Scheme
595  if (testNS_) hcalTestNS_ = new HcalTestNS(es);
596 
597  if (agingFlagHB) {
599  es->get<HBHEDarkeningRecord>().get("HB",hdark);
600  m_HBDarkening = &*hdark;
601  }
602  if (agingFlagHE) {
604  es->get<HBHEDarkeningRecord>().get("HE",hdark);
605  m_HEDarkening = &*hdark;
606  }
607 }
std::vector< double > gpar
Definition: HCalSD.h:103
bool agingFlagHE
Definition: HCalSD.h:91
int getMaxDepth(const int &type) const
bool agingFlagHB
Definition: HCalSD.h:91
const HBHEDarkening * m_HEDarkening
Definition: HCalSD.h:93
bool testNS_
Definition: HCalSD.h:97
const std::vector< double > & getGparHF() const
const T & get() const
Definition: EventSetup.h:59
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:84
HcalTestNS * hcalTestNS_
Definition: HCalSD.h:95
const HBHEDarkening * m_HBDarkening
Definition: HCalSD.h:92
HcalDDDSimConstants * hcalConstants
Definition: HCalSD.h:83

Member Data Documentation

bool HCalSD::agingFlagHB
private

Definition at line 91 of file HCalSD.h.

Referenced by HCalSD(), and update().

bool HCalSD::agingFlagHE
private

Definition at line 91 of file HCalSD.h.

Referenced by HCalSD(), and update().

bool HCalSD::applyFidCut
private

Definition at line 99 of file HCalSD.h.

Referenced by HCalSD(), and isItinFidVolume().

double HCalSD::betaThr
private

Definition at line 98 of file HCalSD.h.

Referenced by HCalSD().

double HCalSD::birk1
private

Definition at line 98 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

double HCalSD::birk2
private

Definition at line 98 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

double HCalSD::birk3
private

Definition at line 98 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

double HCalSD::deliveredLumi
private

Definition at line 101 of file HCalSD.h.

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

G4int HCalSD::depth_
private

Definition at line 102 of file HCalSD.h.

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

TH1F * HCalSD::dist_[9]
private

Definition at line 109 of file HCalSD.h.

Referenced by HCalSD(), and plotProfile().

double HCalSD::eminHitHB
private

Definition at line 100 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

double HCalSD::eminHitHE
private

Definition at line 100 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

double HCalSD::eminHitHF
private

Definition at line 100 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

double HCalSD::eminHitHO
private

Definition at line 100 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

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

Definition at line 107 of file HCalSD.h.

Referenced by HCalSD(), and isItStraightBundle().

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

Definition at line 107 of file HCalSD.h.

Referenced by HCalSD(), and isItConicalBundle().

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

Definition at line 107 of file HCalSD.h.

Referenced by HCalSD(), and isItFibre().

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

Definition at line 105 of file HCalSD.h.

Referenced by HCalSD(), and isItFibre().

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

Definition at line 103 of file HCalSD.h.

Referenced by plotHF(), and update().

HcalDDDSimConstants* HCalSD::hcalConstants
private

Definition at line 83 of file HCalSD.h.

Referenced by getEnergyDeposit(), initRun(), modifyDepth(), and update().

HcalTestNS* HCalSD::hcalTestNS_
private

Definition at line 95 of file HCalSD.h.

Referenced by setDetUnitId(), update(), and ~HCalSD().

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

Definition at line 104 of file HCalSD.h.

Referenced by HCalSD(), and isItHF().

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

Definition at line 107 of file HCalSD.h.

Referenced by HCalSD(), and isItHF().

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

Definition at line 105 of file HCalSD.h.

Referenced by HCalSD(), and isItHF().

HFShower* HCalSD::hfshower
private

Definition at line 87 of file HCalSD.h.

Referenced by HCalSD(), hitForFibre(), initRun(), and ~HCalSD().

TH1F* HCalSD::hit_[9]
private

Definition at line 109 of file HCalSD.h.

Referenced by HCalSD(), and plotProfile().

TH1F * HCalSD::hzvem
private

Definition at line 109 of file HCalSD.h.

Referenced by HCalSD(), and plotHF().

TH1F * HCalSD::hzvhad
private

Definition at line 109 of file HCalSD.h.

Referenced by HCalSD(), and plotHF().

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

Definition at line 108 of file HCalSD.h.

Referenced by layerWeight(), and readWeightFromFile().

const HBHEDarkening* HCalSD::m_HBDarkening
private

Definition at line 92 of file HCalSD.h.

Referenced by getEnergyDeposit(), and update().

const HBHEDarkening* HCalSD::m_HEDarkening
private

Definition at line 93 of file HCalSD.h.

Referenced by getEnergyDeposit(), and update().

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

Definition at line 94 of file HCalSD.h.

Referenced by HCalSD(), and ProcessHits().

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

Definition at line 106 of file HCalSD.h.

Referenced by HCalSD(), and isItScintillator().

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

Definition at line 105 of file HCalSD.h.

Referenced by HCalSD().

G4int HCalSD::mumPDG
private

Definition at line 102 of file HCalSD.h.

Referenced by HCalSD(), initRun(), and ProcessHits().

G4int HCalSD::mupPDG
private

Definition at line 102 of file HCalSD.h.

Referenced by HCalSD(), initRun(), and ProcessHits().

bool HCalSD::neutralDensity
private

Definition at line 97 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

HcalNumberingFromDDD* HCalSD::numberingFromDDD
private

Definition at line 84 of file HCalSD.h.

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

HcalNumberingScheme* HCalSD::numberingScheme
private

Definition at line 85 of file HCalSD.h.

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

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

Definition at line 107 of file HCalSD.h.

Referenced by HCalSD(), and isItPMT().

HFShowerFibreBundle* HCalSD::showerBundle
private

Definition at line 90 of file HCalSD.h.

Referenced by getHitFibreBundle(), HCalSD(), initRun(), ProcessHits(), and ~HCalSD().

HFShowerLibrary* HCalSD::showerLibrary
private

Definition at line 86 of file HCalSD.h.

Referenced by getFromLibrary(), HCalSD(), initRun(), and ~HCalSD().

HFShowerParam* HCalSD::showerParam
private

Definition at line 88 of file HCalSD.h.

Referenced by getFromParam(), HCalSD(), initRun(), and ~HCalSD().

HFShowerPMT* HCalSD::showerPMT
private

Definition at line 89 of file HCalSD.h.

Referenced by getHitPMT(), HCalSD(), initRun(), ProcessHits(), and ~HCalSD().

bool HCalSD::testNS_
private

Definition at line 97 of file HCalSD.h.

Referenced by HCalSD(), and update().

bool HCalSD::testNumber
private

Definition at line 97 of file HCalSD.h.

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

TH1F * HCalSD::time_[9]
private

Definition at line 109 of file HCalSD.h.

Referenced by HCalSD(), and plotProfile().

bool HCalSD::useBirk
private

Definition at line 96 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

bool HCalSD::useFibreBundle
private

Definition at line 96 of file HCalSD.h.

Referenced by HCalSD(), and ProcessHits().

bool HCalSD::useHF
private

Definition at line 99 of file HCalSD.h.

Referenced by HCalSD().

bool HCalSD::useLayerWt
private

Definition at line 96 of file HCalSD.h.

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

bool HCalSD::useParam
private

Definition at line 99 of file HCalSD.h.

Referenced by HCalSD(), and ProcessHits().

bool HCalSD::usePMTHit
private

Definition at line 96 of file HCalSD.h.

Referenced by HCalSD(), and ProcessHits().

bool HCalSD::useShowerLibrary
private

Definition at line 99 of file HCalSD.h.

Referenced by HCalSD(), and ProcessHits().