CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HCalSD.cc
Go to the documentation of this file.
1 // File: HCalSD.cc
3 // Description: Sensitive Detector class for calorimeters
5 
16 
19 
20 #include "G4LogicalVolumeStore.hh"
21 #include "G4LogicalVolume.hh"
22 #include "G4Step.hh"
23 #include "G4Track.hh"
24 #include "G4ParticleTable.hh"
25 
26 #include <iostream>
27 #include <fstream>
28 #include <iomanip>
29 
30 //#define DebugLog
31 
32 HCalSD::HCalSD(G4String name, const DDCompactView & cpv,
34  edm::ParameterSet const & p, const SimTrackManager* manager) :
35  CaloSD(name, cpv, clg, p, manager,
36  p.getParameter<edm::ParameterSet>("HCalSD").getParameter<int>("TimeSliceUnit"),
37  p.getParameter<edm::ParameterSet>("HCalSD").getParameter<bool>("IgnoreTrackID")),
38  numberingFromDDD(0), numberingScheme(0), showerLibrary(0), hfshower(0),
39  showerParam(0), showerPMT(0), showerBundle(0) {
40 
41  //static SimpleConfigurable<bool> on1(false, "HCalSD:UseBirkLaw");
42  //static SimpleConfigurable<double> bk1(0.013, "HCalSD:BirkC1");
43  //static SimpleConfigurable<double> bk2(0.0568,"HCalSD:BirkC2");
44  //static SimpleConfigurable<double> bk3(1.75, "HCalSD:BirkC3");
45  // Values from NIM 80 (1970) 239-244: as implemented in Geant3
46  //static SimpleConfigurable<bool> on2(true,"HCalSD:UseShowerLibrary");
48  useBirk = m_HC.getParameter<bool>("UseBirkLaw");
49  birk1 = m_HC.getParameter<double>("BirkC1")*(g/(MeV*cm2));
50  birk2 = m_HC.getParameter<double>("BirkC2");
51  birk3 = m_HC.getParameter<double>("BirkC3");
52  useShowerLibrary = m_HC.getParameter<bool>("UseShowerLibrary");
53  useParam = m_HC.getParameter<bool>("UseParametrize");
54  bool testNumber = m_HC.getParameter<bool>("TestNumberingScheme");
55  usePMTHit = m_HC.getParameter<bool>("UsePMTHits");
56  betaThr = m_HC.getParameter<double>("BetaThreshold");
57  eminHitHB = m_HC.getParameter<double>("EminHitHB")*MeV;
58  eminHitHE = m_HC.getParameter<double>("EminHitHE")*MeV;
59  eminHitHO = m_HC.getParameter<double>("EminHitHO")*MeV;
60  eminHitHF = m_HC.getParameter<double>("EminHitHF")*MeV;
61  useFibreBundle = m_HC.getParameter<bool>("UseFibreBundleHits");
62  useHF = m_HC.getUntrackedParameter<bool>("UseHF",true);
63  bool forTBH2 = m_HC.getUntrackedParameter<bool>("ForTBH2",false);
64  useLayerWt = m_HC.getUntrackedParameter<bool>("UseLayerWt",false);
65  std::string file = m_HC.getUntrackedParameter<std::string>("WtFile","None");
66 
67 #ifdef DebugLog
68  LogDebug("HcalSim") << "***************************************************"
69  << "\n"
70  << "* *"
71  << "\n"
72  << "* Constructing a HCalSD with name " << name << "\n"
73  << "* *"
74  << "\n"
75  << "***************************************************";
76 #endif
77  edm::LogInfo("HcalSim") << "HCalSD:: Use of HF code is set to " << useHF
78  << "\nUse of shower parametrization set to "
79  << useParam << "\nUse of shower library is set to "
80  << useShowerLibrary << "\nUse PMT Hit is set to "
81  << usePMTHit << " with beta Threshold "<< betaThr
82  << "\nUSe of FibreBundle Hit set to "<<useFibreBundle
83  << "\n Use of Birks law is set to "
84  << useBirk << " with three constants kB = "
85  << birk1 << ", C1 = " << birk2 << ", C2 = " << birk3;
86  edm::LogInfo("HcalSim") << "HCalSD:: Suppression Flag " << suppressHeavy
87  << " protons below " << kmaxProton << " MeV,"
88  << " neutrons below " << kmaxNeutron << " MeV and"
89  << " ions below " << kmaxIon << " MeV\n"
90  << " Threshold for storing hits in HB: "
91  << eminHitHB << " HE: " << eminHitHE << " HO: "
92  << eminHitHO << " HF: " << eminHitHF;
93 
94  numberingFromDDD = new HcalNumberingFromDDD(name, cpv);
95  HcalNumberingScheme* scheme;
96  if (testNumber || forTBH2)
97  scheme = dynamic_cast<HcalNumberingScheme*>(new HcalTestNumberingScheme(forTBH2));
98  else
99  scheme = new HcalNumberingScheme();
100  setNumberingScheme(scheme);
101 
102  const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
103  std::vector<G4LogicalVolume *>::const_iterator lvcite;
104  G4LogicalVolume* lv;
105  std::string attribute, value;
106  if (useHF) {
107  if (useParam) {
108  showerParam = new HFShowerParam(name, cpv, p);
109  } else {
110  if (useShowerLibrary) showerLibrary = new HFShowerLibrary(name, cpv, p);
111  hfshower = new HFShower(name, cpv, p, 0);
112  }
113 
114  // HF volume names
115  attribute = "Volume";
116  value = "HF";
117  DDSpecificsFilter filter0;
118  DDValue ddv0(attribute, value, 0);
119  filter0.setCriteria(ddv0, DDSpecificsFilter::equals);
120  DDFilteredView fv0(cpv);
121  fv0.addFilter(filter0);
122  hfNames = getNames(fv0);
123  fv0.firstChild();
124  DDsvalues_type sv0(fv0.mergedSpecifics());
125  std::vector<double> temp = getDDDArray("Levels",sv0);
126  edm::LogInfo("HcalSim") << "HCalSD: Names to be tested for " << attribute
127  << " = " << value << " has " << hfNames.size() << " elements";
128  for (unsigned int i=0; i < hfNames.size(); ++i) {
129  G4String namv = hfNames[i];
130  lv = 0;
131  for(lvcite=lvs->begin(); lvcite!=lvs->end(); lvcite++)
132  if((*lvcite)->GetName()==namv) {
133  lv = (*lvcite);
134  break;
135  }
136  hfLV.push_back(lv);
137  int level = static_cast<int>(temp[i]);
138  hfLevels.push_back(level);
139  edm::LogInfo("HcalSim") << "HCalSD: HF[" << i << "] = " << hfNames[i]
140  << " LV " << hfLV[i] << " at level "
141  << hfLevels[i];
142  }
143 
144  // HF Fibre volume names
145  value = "HFFibre";
146  DDSpecificsFilter filter1;
147  DDValue ddv1(attribute,value,0);
148  filter1.setCriteria(ddv1, DDSpecificsFilter::equals);
149  DDFilteredView fv1(cpv);
150  fv1.addFilter(filter1);
151  fibreNames = getNames(fv1);
152  edm::LogInfo("HcalSim") << "HCalSD: Names to be tested for " << attribute
153  << " = " << value << ":";
154  for (unsigned int i=0; i<fibreNames.size(); ++i) {
155  G4String namv = fibreNames[i];
156  lv = 0;
157  for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite) {
158  if ((*lvcite)->GetName() == namv) {
159  lv = (*lvcite);
160  break;
161  }
162  }
163  fibreLV.push_back(lv);
164  edm::LogInfo("HcalSim") << "HCalSD: (" << i << ") " << fibreNames[i]
165  << " LV " << fibreLV[i];
166  }
167 
168  // HF PMT volume names
169  value = "HFPMT";
170  DDSpecificsFilter filter3;
171  DDValue ddv3(attribute,value,0);
173  DDFilteredView fv3(cpv);
174  fv3.addFilter(filter3);
175  std::vector<G4String> pmtNames = getNames(fv3);
176  edm::LogInfo("HcalSim") << "HCalSD: Names to be tested for " << attribute << " = "
177  << value << " have " << pmtNames.size() << " entries";
178  for (unsigned int i=0; i<pmtNames.size(); ++i) {
179  G4String namv = pmtNames[i];
180  lv = 0;
181  for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite)
182  if ((*lvcite)->GetName() == namv) {
183  lv = (*lvcite);
184  break;
185  }
186  pmtLV.push_back(lv);
187  edm::LogInfo("HcalSim") << "HCalSD: (" << i << ") " << pmtNames[i]
188  << " LV " << pmtLV[i];
189  }
190  if (pmtNames.size() > 0) showerPMT = new HFShowerPMT (name, cpv, p);
191 
192  // HF Fibre bundles
193  value = "HFFibreBundleStraight";
194  DDSpecificsFilter filter4;
195  DDValue ddv4(attribute,value,0);
197  DDFilteredView fv4(cpv);
198  fv4.addFilter(filter4);
199  std::vector<G4String> fibreNames = getNames(fv4);
200  edm::LogInfo("HcalSim") << "HCalSD: Names to be tested for " << attribute
201  << " = " << value << " have " << fibreNames.size()
202  << " entries";
203  for (unsigned int i=0; i<fibreNames.size(); ++i) {
204  G4String namv = fibreNames[i];
205  lv = 0;
206  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
207  if ((*lvcite)->GetName() == namv) {
208  lv = (*lvcite);
209  break;
210  }
211  fibre1LV.push_back(lv);
212  edm::LogInfo("HcalSim") << "HCalSD: (" << i << ") " << fibreNames[i]
213  << " LV " << fibre1LV[i];
214  }
215 
216  value = "HFFibreBundleConical";
217  DDSpecificsFilter filter5;
218  DDValue ddv5(attribute,value,0);
220  DDFilteredView fv5(cpv);
221  fv5.addFilter(filter5);
222  fibreNames = getNames(fv5);
223  edm::LogInfo("HcalSim") << "HCalSD: Names to be tested for " << attribute << " = "
224  << value << " have " << fibreNames.size() << " entries";
225  for (unsigned int i=0; i<fibreNames.size(); ++i) {
226  G4String namv = fibreNames[i];
227  lv = 0;
228  for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite)
229  if ((*lvcite)->GetName() == namv) {
230  lv = (*lvcite);
231  break;
232  }
233  fibre2LV.push_back(lv);
234  edm::LogInfo("HcalSim") << "HCalSD: (" << i << ") " << fibreNames[i]
235  << " LV " << fibre2LV[i];
236  }
237  if (fibre1LV.size() > 0 || fibre2LV.size() > 0)
238  showerBundle = new HFShowerFibreBundle (name, cpv, p);
239  }
240 
241  //Material list for HB/HE/HO sensitive detectors
242  attribute = "ReadOutName";
243  DDSpecificsFilter filter2;
244  DDValue ddv2(attribute,name,0);
246  DDFilteredView fv2(cpv);
247  fv2.addFilter(filter2);
248  bool dodet = fv2.firstChild();
249 
251  //Layer0 Weight
252  layer0wt = getDDDArray("Layer0Wt",sv);
253  edm::LogInfo("HcalSim") << "HCalSD: " << layer0wt.size() << " Layer0Wt";
254  for (unsigned int it=0; it<layer0wt.size(); ++it)
255  edm::LogInfo("HcalSim") << "HCalSD: [" << it << "] " << layer0wt[it];
256 
257  const G4MaterialTable * matTab = G4Material::GetMaterialTable();
258  std::vector<G4Material*>::const_iterator matite;
259  while (dodet) {
260  const DDLogicalPart & log = fv2.logicalPart();
261  G4String namx = log.name().name();
262  if (!isItHF(namx) && !isItFibre(namx)) {
263  bool notIn = true;
264  for (unsigned int i=0; i<matNames.size(); ++i) {
265  if (!strcmp(matNames[i].c_str(),log.material().name().name().c_str())){
266  notIn = false;
267  break;
268  }
269  }
270  if (notIn) {
271  namx = log.material().name().name();
272  matNames.push_back(namx);
273  G4Material* mat;
274  for (matite = matTab->begin(); matite != matTab->end(); ++matite) {
275  if ((*matite)->GetName() == namx) {
276  mat = (*matite);
277  break;
278  }
279  }
280  materials.push_back(mat);
281  }
282  }
283  dodet = fv2.next();
284  }
285 
286  edm::LogInfo("HcalSim") << "HCalSD: Material names for " << attribute
287  << " = " << name << ":";
288  for (unsigned int i=0; i<matNames.size(); ++i)
289  edm::LogInfo("HcalSim") << "HCalSD: (" << i << ") " << matNames[i]
290  << " pointer " << materials[i];
291 
292  mumPDG = mupPDG = 0;
293 
294  if (useLayerWt) readWeightFromFile(file);
295 
296  for (int i=0; i<9; ++i) hit_[i] = time_[i]= dist_[i] = 0;
297 
298 #ifdef DebugLog
300 
301  if ( tfile.isAvailable() ) {
302  static std::string labels[9] = {"HB", "HE", "HO", "HF Absorber", "HF PMT",
303  "HF Absorber Long", "HF Absorber Short",
304  "HF PMT Long", "HF PMT Short"};
305  char name[20], title[60];
306  for (int i=0; i<9; ++i) {
307  sprintf (title, "Hit energy in %s", labels[i].c_str());
308  sprintf (name, "HCalSDHit%d", i);
309  hit_[i] = tfile->make<TH1F>(name, title, 2000, 0., 2000.);
310  sprintf (title, "Energy (MeV)");
311  hit_[i]->GetXaxis()->SetTitle(title);
312  hit_[i]->GetYaxis()->SetTitle("Hits");
313  sprintf (title, "Time of the hit in %s", labels[i].c_str());
314  sprintf (name, "HCalSDTime%d", i);
315  time_[i] = tfile->make<TH1F>(name, title, 2000, 0., 2000.);
316  sprintf (title, "Time (ns)");
317  time_[i]->GetXaxis()->SetTitle(title);
318  time_[i]->GetYaxis()->SetTitle("Hits");
319  sprintf (title, "Longitudinal profile in %s", labels[i].c_str());
320  sprintf (name, "HCalSDDist%d", i);
321  dist_[i] = tfile->make<TH1F>(name, title, 2000, 0., 2000.);
322  sprintf (title, "Distance (mm)");
323  dist_[i]->GetXaxis()->SetTitle(title);
324  dist_[i]->GetYaxis()->SetTitle("Hits");
325  }
326  }
327 #endif
328 }
329 
331 
333  if (numberingScheme) delete numberingScheme;
334  if (showerLibrary) delete showerLibrary;
335  if (hfshower) delete hfshower;
336  if (showerParam) delete showerParam;
337  if (showerPMT) delete showerPMT;
338  if (showerBundle) delete showerBundle;
339 }
340 
341 bool HCalSD::ProcessHits(G4Step * aStep, G4TouchableHistory * ) {
342 
343  NaNTrap( aStep ) ;
344 
345  if (aStep == NULL) {
346  return true;
347  } else {
348  G4LogicalVolume* lv= aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
349  G4String nameVolume = lv->GetName();
350  if (isItHF(aStep)) {
351  G4int parCode =aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
352  if (useParam) {
353 #ifdef DebugLog
354  LogDebug("HcalSim") << "HCalSD: " << getNumberOfHits()
355  << " hits from parametrization in " << nameVolume
356  << " for Track " << aStep->GetTrack()->GetTrackID()
357  <<" (" << aStep->GetTrack()->GetDefinition()->GetParticleName()
358  <<")";
359 #endif
360  getFromParam(aStep);
361 #ifdef DebugLog
362  LogDebug("HcalSim") << "HCalSD: " << getNumberOfHits()
363  << " hits afterParamS*";
364 #endif
365  } else {
366  bool notaMuon = true;
367  if (parCode == mupPDG || parCode == mumPDG ) notaMuon = false;
368  if (useShowerLibrary && notaMuon) {
369 #ifdef DebugLog
370  LogDebug("HcalSim") << "HCalSD: Starts shower library from "
371  << nameVolume << " for Track "
372  << aStep->GetTrack()->GetTrackID() << " ("
373  <<aStep->GetTrack()->GetDefinition()->GetParticleName()<<")";
374 #endif
375  getFromLibrary(aStep);
376  } else if (isItFibre(lv)) {
377 #ifdef DebugLog
378  LogDebug("HcalSim") << "HCalSD: Hit at Fibre in " << nameVolume
379  << " for Track "
380  << aStep->GetTrack()->GetTrackID() <<" ("
381  <<aStep->GetTrack()->GetDefinition()->GetParticleName()<<")";
382 #endif
383  hitForFibre(aStep);
384  }
385  }
386  } else if (isItPMT(lv)) {
387 #ifdef DebugLog
388  LogDebug("HcalSim") << "HCalSD: Hit from PMT parametrization from "
389  << nameVolume << " for Track "
390  << aStep->GetTrack()->GetTrackID() << " ("
391  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
392 #endif
393  if (usePMTHit && showerPMT) getHitPMT(aStep);
394  } else if (isItStraightBundle(lv) || isItConicalBundle(lv)) {
395 #ifdef DebugLog
396  LogDebug("HcalSim") << "HCalSD: Hit from FibreBundle from "
397  << nameVolume << " for Track "
398  << aStep->GetTrack()->GetTrackID() << " ("
399  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
400 #endif
402  } else {
403 #ifdef DebugLog
404  LogDebug("HcalSim") << "HCalSD: Hit from standard path from "
405  << nameVolume << " for Track "
406  << aStep->GetTrack()->GetTrackID() << " ("
407  << aStep->GetTrack()->GetDefinition()->GetParticleName() << ")";
408 #endif
409  if (getStepInfo(aStep)) {
410 #ifdef DebugLog
411  if (edepositEM+edepositHAD > 0)
412  plotProfile(aStep, aStep->GetPreStepPoint()->GetPosition(),
413  edepositEM+edepositHAD,aStep->GetPostStepPoint()->GetGlobalTime(),0);
414 #endif
415  if (hitExists() == false && edepositEM+edepositHAD>0.) currentHit = createNewHit();
416  }
417  }
418  return true;
419  }
420 }
421 
422 double HCalSD::getEnergyDeposit(G4Step* aStep) {
423  double destep = aStep->GetTotalEnergyDeposit();
424  double weight = 1;
425  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
426  int depth = (touch->GetReplicaNumber(0))%10;
427  int det = ((touch->GetReplicaNumber(1))/1000)-3;
428  if (depth==0 && (det==0 || det==1)) weight = layer0wt[det];
429  if (useLayerWt) {
430  int lay = (touch->GetReplicaNumber(0)/10)%100 + 1;
431  G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition();
432  weight = layerWeight(det+3, hitPoint, depth, lay);
433  }
434 
435  if (suppressHeavy) {
436  G4Track* theTrack = aStep->GetTrack();
437  TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
438  if (trkInfo) {
439  int pdg = theTrack->GetDefinition()->GetPDGEncoding();
440  if (!(trkInfo->isPrimary())) { // Only secondary particles
441  double ke = theTrack->GetKineticEnergy()/MeV;
442  if ( pdg/1000000000 == 1 && (pdg/10000)%100 > 0 &&
443  (pdg/10)%100 > 0 && ke <kmaxIon ) weight = 0;
444  if ((pdg == 2212) && (ke < kmaxProton)) weight = 0;
445  if ((pdg == 2112) && (ke < kmaxNeutron)) weight = 0;
446 #ifdef DebugLog
447  if (weight == 0)
448  edm::LogInfo("HcalSim") << "HCalSD:Ignore Track "
449  << theTrack->GetTrackID() << " Type "
450  << theTrack->GetDefinition()->GetParticleName()
451  << " Kinetic Energy " << ke << " MeV";
452 #endif
453  }
454  }
455  }
456 #ifdef DebugLog
457  double weight0 = weight;
458 #endif
459  if (useBirk) {
460  G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
461  if (isItScintillator(mat)) weight *= getAttenuation(aStep, birk1, birk2, birk3);
462  }
463  double wt1 = getResponseWt(theTrack);
464 #ifdef DebugLog
465  edm::LogInfo("HcalSim") << "HCalSD: Detector " << det+3 << " Depth " << depth
466  << " weight " << weight0 << " " << weight << " " << wt1;
467 #endif
468  return weight*wt1*destep;
469 }
470 
471 uint32_t HCalSD::setDetUnitId(G4Step * aStep) {
472 
473  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
474  const G4VTouchable* touch = preStepPoint->GetTouchable();
475  G4ThreeVector hitPoint = preStepPoint->GetPosition();
476 
477  int depth = (touch->GetReplicaNumber(0))%10 + 1;
478  int lay = (touch->GetReplicaNumber(0)/10)%100 + 1;
479  int det = (touch->GetReplicaNumber(1))/1000;
480 
481  return setDetUnitId (det, hitPoint, depth, lay);
482 }
483 
485  if (scheme != 0) {
486  edm::LogInfo("HcalSim") << "HCalSD: updates numbering scheme for " << GetName() <<"\n";
487  if (numberingScheme) delete numberingScheme;
488  numberingScheme = scheme;
489  }
490 }
491 
493  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
494  G4String particleName;
495  mumPDG = theParticleTable->FindParticle(particleName="mu-")->GetPDGEncoding();
496  mupPDG = theParticleTable->FindParticle(particleName="mu+")->GetPDGEncoding();
497 #ifdef DebugLog
498  edm::LogInfo("HcalSim") << "HCalSD: Particle code for mu- = " << mumPDG
499  << " for mu+ = " << mupPDG;
500 #endif
501  if (showerLibrary) showerLibrary->initRun(theParticleTable);
502  if (showerParam) showerParam->initRun(theParticleTable);
503  if (hfshower) hfshower->initRun(theParticleTable);
504 }
505 
506 bool HCalSD::filterHit(CaloG4Hit* aHit, double time) {
507  double threshold=0;
508  DetId theId(aHit->getUnitID());
509  switch (theId.subdetId()) {
510  case HcalBarrel:
511  threshold = eminHitHB; break;
512  case HcalEndcap:
513  threshold = eminHitHE; break;
514  case HcalOuter:
515  threshold = eminHitHO; break;
516  case HcalForward:
517  threshold = eminHitHF; break;
518  default:
519  break;
520  }
521  return ((time <= tmaxHit) && (aHit->getEnergyDeposit() > threshold));
522 }
523 
524 
525 uint32_t HCalSD::setDetUnitId (int det, G4ThreeVector pos, int depth, int lay=1) {
526  uint32_t id = 0;
527  if (numberingFromDDD) {
528  //get the ID's as eta, phi, depth, ... indices
529  HcalNumberingFromDDD::HcalID tmp = numberingFromDDD->unitID(det, pos, depth, lay);
530  //get the ID
531  if (numberingScheme) id = numberingScheme->getUnitID(tmp);
532  }
533  return id;
534 }
535 
536 std::vector<double> HCalSD::getDDDArray(const std::string & str,
537  const DDsvalues_type & sv) {
538 #ifdef DebugLog
539  LogDebug("HcalSim") << "HCalSD:getDDDArray called for " << str;
540 #endif
541  DDValue value(str);
542  if (DDfetch(&sv,value)) {
543 #ifdef DebugLog
544  LogDebug("HcalSim") << value;
545 #endif
546  const std::vector<double> & fvec = value.doubles();
547  int nval = fvec.size();
548  if (nval < 1) {
549  edm::LogError("HcalSim") << "HCalSD : # of " << str << " bins " << nval
550  << " < 2 ==> illegal";
551  throw cms::Exception("Unknown", "HCalSD") << "nval < 2 for array " << str << "\n";
552  }
553 
554  return fvec;
555  } else {
556  edm::LogError("HcalSim") << "HCalSD : cannot get array " << str;
557  throw cms::Exception("Unknown", "HCalSD") << "cannot get array " << str << "\n";
558  }
559 }
560 
561 std::vector<G4String> HCalSD::getNames(DDFilteredView& fv) {
562 
563  std::vector<G4String> tmp;
564  bool dodet = fv.firstChild();
565  while (dodet) {
566  const DDLogicalPart & log = fv.logicalPart();
567  bool ok = true;
568 
569  for (unsigned int i=0; i<tmp.size(); ++i) {
570  if (!strcmp(tmp[i].c_str(), log.name().name().c_str())) {
571  ok = false;
572  break;
573  }
574  }
575  if (ok) tmp.push_back(log.name().name());
576  dodet = fv.next();
577  }
578  return tmp;
579 }
580 
581 bool HCalSD::isItHF(G4Step * aStep) {
582  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
583  int levels = (touch->GetHistoryDepth()) + 1;
584  for (unsigned int it=0; it < hfNames.size(); ++it) {
585  if (levels >= hfLevels[it]) {
586  G4LogicalVolume* lv = touch->GetVolume(levels-hfLevels[it])->GetLogicalVolume();
587  if (lv == hfLV[it]) return true;
588  }
589  }
590  return false;
591 }
592 
593 bool HCalSD::isItHF (G4String name) {
594  std::vector<G4String>::const_iterator it = hfNames.begin();
595  for (; it != hfNames.end(); ++it) if (name == *it) return true;
596  return false;
597 }
598 
599 bool HCalSD::isItFibre (G4LogicalVolume* lv) {
600  std::vector<G4LogicalVolume*>::const_iterator ite = fibreLV.begin();
601  for (; ite != fibreLV.end(); ++ite) if (lv == *ite) return true;
602  return false;
603 }
604 
605 bool HCalSD::isItFibre (G4String name) {
606  std::vector<G4String>::const_iterator it = fibreNames.begin();
607  for (; it != fibreNames.end(); ++it) if (name == *it) return true;
608  return false;
609 }
610 
611 bool HCalSD::isItPMT (G4LogicalVolume* lv) {
612  std::vector<G4LogicalVolume*>::const_iterator ite = pmtLV.begin();
613  for (; ite != pmtLV.end(); ++ite) if (lv == *ite) return true;
614  return false;
615 }
616 
617 bool HCalSD::isItStraightBundle (G4LogicalVolume* lv) {
618  std::vector<G4LogicalVolume*>::const_iterator ite = fibre1LV.begin();
619  for (; ite != fibre1LV.end(); ++ite) if (lv == *ite) return true;
620  return false;
621 }
622 
623 bool HCalSD::isItConicalBundle (G4LogicalVolume* lv) {
624  std::vector<G4LogicalVolume*>::const_iterator ite = fibre2LV.begin();
625  for (; ite != fibre2LV.end(); ++ite) if (lv == *ite) return true;
626  return false;
627 }
628 
629 bool HCalSD::isItScintillator (G4Material* mat) {
630  std::vector<G4Material*>::const_iterator ite = materials.begin();
631  for (; ite != materials.end(); ++ite) if (mat == *ite) return true;
632  return false;
633 }
634 
635 void HCalSD::getFromLibrary (G4Step* aStep) {
636  preStepPoint = aStep->GetPreStepPoint();
637  theTrack = aStep->GetTrack();
638  int det = 5;
639  bool ok;
640 
641  std::vector<HFShowerLibrary::Hit> hits = showerLibrary->getHits(aStep, ok);
642 
643  double etrack = preStepPoint->GetKineticEnergy();
644  int primaryID = setTrackID(aStep);
645  /*
646  int primaryID = 0;
647  if (etrack >= energyCut) {
648  primaryID = theTrack->GetTrackID();
649  } else {
650  primaryID = theTrack->GetParentID();
651  if (primaryID == 0) primaryID = theTrack->GetTrackID();
652  }
653  */
654 
655  // Reset entry point for new primary
656  posGlobal = preStepPoint->GetPosition();
657  resetForNewPrimary(posGlobal, etrack);
658 
659  G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
660  if (particleCode==emPDG || particleCode==epPDG || particleCode==gammaPDG) {
661  edepositEM = 1.*GeV;
662  edepositHAD = 0.;
663  } else {
664  edepositEM = 0.;
665  edepositHAD = 1.*GeV;
666  }
667 #ifdef DebugLog
668  edm::LogInfo("HcalSim") << "HCalSD::getFromLibrary " <<hits.size()
669  << " hits for " << GetName() << " of " << primaryID
670  << " with " << theTrack->GetDefinition()->GetParticleName()
671  << " of " << preStepPoint->GetKineticEnergy()/GeV << " GeV";
672 #endif
673  for (unsigned int i=0; i<hits.size(); ++i) {
674  G4ThreeVector hitPoint = hits[i].position;
675  int depth = hits[i].depth;
676  double time = hits[i].time;
677  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
678  currentID.setID(unitID, time, primaryID, 0);
679 #ifdef DebugLog
680  plotProfile(aStep, hitPoint, 1.0*GeV, time, depth);
681 #endif
682 
683  // check if it is in the same unit and timeslice as the previous one
684  if (currentID == previousID) {
686  } else {
687  if (!checkHit()) currentHit = createNewHit();
688  }
689  }
690 
691  //Now kill the current track
692  if (ok) {
693  theTrack->SetTrackStatus(fStopAndKill);
694  G4TrackVector tv = *(aStep->GetSecondary());
695  for (unsigned int kk=0; kk<tv.size(); ++kk)
696  if (tv[kk]->GetVolume() == preStepPoint->GetPhysicalVolume())
697  tv[kk]->SetTrackStatus(fStopAndKill);
698  }
699 }
700 
701 void HCalSD::hitForFibre (G4Step* aStep) { // if not ParamShower
702 
703  preStepPoint = aStep->GetPreStepPoint();
704  theTrack = aStep->GetTrack();
705  int primaryID = setTrackID(aStep);
706 
707  int det = 5;
708  std::vector<HFShower::Hit> hits = hfshower->getHits(aStep);
709 
710  G4int particleCode = theTrack->GetDefinition()->GetPDGEncoding();
711  if (particleCode==emPDG || particleCode==epPDG || particleCode==gammaPDG) {
712  edepositEM = 1.*GeV;
713  edepositHAD = 0.;
714  } else {
715  edepositEM = 0.;
716  edepositHAD = 1.*GeV;
717  }
718 
719 #ifdef DebugLog
720  edm::LogInfo("HcalSim") << "HCalSD::hitForFibre " << hits.size()
721  << " hits for " << GetName() << " of " << primaryID
722  << " with " << theTrack->GetDefinition()->GetParticleName()
723  << " of " << preStepPoint->GetKineticEnergy()/GeV
724  << " GeV in detector type " << det;
725 #endif
726  if (hits.size() > 0) {
727  G4ThreeVector hitPoint = preStepPoint->GetPosition();
728  for (unsigned int i=0; i<hits.size(); ++i) {
729  G4ThreeVector hitPoint = hits[i].position;
730  int depth = hits[i].depth;
731  double time = hits[i].time;
732  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
733  currentID.setID(unitID, time, primaryID, 0);
734 #ifdef DebugLog
735  plotProfile(aStep, hitPoint, edepositEM, time, depth);
736 #endif
737  // check if it is in the same unit and timeslice as the previous one
738  if (currentID == previousID) {
740  } else {
741  posGlobal = preStepPoint->GetPosition();
742  if (!checkHit()) currentHit = createNewHit();
743  }
744  }
745  }
746 }
747 
748 void HCalSD::getFromParam (G4Step* aStep) {
749  std::vector<HFShowerParam::Hit> hits = showerParam->getHits(aStep);
750  int nHit = static_cast<int>(hits.size());
751 
752  if (nHit > 0) {
753  preStepPoint = aStep->GetPreStepPoint();
754  int primaryID = setTrackID(aStep);
755 
756  int det = 5;
757 #ifdef DebugLog
758  edm::LogInfo("HcalSim") << "HCalSD::getFromParam " << nHit << " hits for "
759  << GetName() << " of " << primaryID << " with "
760  << aStep->GetTrack()->GetDefinition()->GetParticleName()
761  << " of " << preStepPoint->GetKineticEnergy()/GeV
762  << " GeV in detector type " << det;
763 #endif
764  for (int i = 0; i<nHit; ++i) {
765  G4ThreeVector hitPoint = hits[i].position;
766  int depth = hits[i].depth;
767  double time = hits[i].time;
768  unsigned int unitID = setDetUnitId(det, hitPoint, depth);
769  currentID.setID(unitID, time, primaryID, 0);
770  edepositEM = hits[i].edep*GeV;
771  edepositHAD = 0.;
772 #ifdef DebugLog
773  plotProfile(aStep, hitPoint, edepositEM, time, depth);
774 #endif
775 
776  // check if it is in the same unit and timeslice as the previous one
777  if (currentID == previousID) {
779  } else {
780  posGlobal = preStepPoint->GetPosition();
781  if (!checkHit()) currentHit = createNewHit();
782  }
783  }
784  }
785 }
786 
787 void HCalSD::getHitPMT (G4Step * aStep) {
788 
789  preStepPoint = aStep->GetPreStepPoint();
790  theTrack = aStep->GetTrack();
791  double edep = showerPMT->getHits(aStep);
792 
793  if (edep >= 0) {
794  double etrack = preStepPoint->GetKineticEnergy();
795  int primaryID = 0;
796  if (etrack >= energyCut) {
797  primaryID = theTrack->GetTrackID();
798  } else {
799  primaryID = theTrack->GetParentID();
800  if (primaryID == 0) primaryID = theTrack->GetTrackID();
801  }
802  // Reset entry point for new primary
803  posGlobal = preStepPoint->GetPosition();
804  resetForNewPrimary(posGlobal, etrack);
805 
806  //
807  int det = static_cast<int>(HcalForward);
808  G4ThreeVector hitPoint = preStepPoint->GetPosition();
809  double rr = (hitPoint.x()*hitPoint.x() + hitPoint.y()*hitPoint.y());
810  double phi = (rr == 0. ? 0. :atan2(hitPoint.y(),hitPoint.x()));
811  double etaR = showerPMT->getRadius();
812  int depth = 1;
813  if (etaR < 0) {
814  depth = 2;
815  etaR =-etaR;
816  }
817  if (hitPoint.z() < 0) etaR =-etaR;
818 #ifdef DebugLog
819  edm::LogInfo("HcalSim") << "HCalSD::Hit for Detector " << det << " etaR "
820  << etaR << " phi " << phi/deg << " depth " <<depth;
821 #endif
822  double time = (aStep->GetPostStepPoint()->GetGlobalTime());
823  uint32_t unitID = 0;
824  if (numberingFromDDD) {
826  depth,1);
827  if (numberingScheme) unitID = numberingScheme->getUnitID(tmp);
828  }
829  currentID.setID(unitID, time, primaryID, 1);
830 
831  edepositHAD = aStep->GetTotalEnergyDeposit();
832  edepositEM =-edepositHAD + (edep*GeV);
833 #ifdef DebugLog
834  plotProfile(aStep, hitPoint, edep*GeV, time, depth);
835  double beta = preStepPoint->GetBeta();
836  LogDebug("HcalSim") << "HCalSD::getHitPMT 1 hit for " << GetName()
837  << " of " << primaryID << " with "
838  << theTrack->GetDefinition()->GetParticleName()
839  << " of " << preStepPoint->GetKineticEnergy()/GeV
840  << " GeV with velocity " << beta << " UnitID "
841  << std::hex << unitID << std::dec;
842 #endif
843  // check if it is in the same unit and timeslice as the previous one
844  if (currentID == previousID) {
846  } else {
847  if (!checkHit()) currentHit = createNewHit();
848  }
849  }
850 }
851 
852 void HCalSD::getHitFibreBundle (G4Step* aStep, bool type) {
853  preStepPoint = aStep->GetPreStepPoint();
854  theTrack = aStep->GetTrack();
855  double edep = showerBundle->getHits(aStep, type);
856 
857  if (edep >= 0) {
858  double etrack = preStepPoint->GetKineticEnergy();
859  int primaryID = 0;
860  if (etrack >= energyCut) {
861  primaryID = theTrack->GetTrackID();
862  } else {
863  primaryID = theTrack->GetParentID();
864  if (primaryID == 0) primaryID = theTrack->GetTrackID();
865  }
866  // Reset entry point for new primary
867  posGlobal = preStepPoint->GetPosition();
868  resetForNewPrimary(posGlobal, etrack);
869 
870  //
871  int det = static_cast<int>(HcalForward);
872  G4ThreeVector hitPoint = preStepPoint->GetPosition();
873  double rr = (hitPoint.x()*hitPoint.x() + hitPoint.y()*hitPoint.y());
874  double phi = (rr == 0. ? 0. :atan2(hitPoint.y(),hitPoint.x()));
875  double etaR = showerBundle->getRadius();
876  int depth = 1;
877  if (etaR < 0) {
878  depth = 2;
879  etaR =-etaR;
880  }
881  if (hitPoint.z() < 0) etaR =-etaR;
882 #ifdef DebugLog
883  edm::LogInfo("HcalSim") << "HCalSD::Hit for Detector " << det << " etaR "
884  << etaR << " phi " << phi/deg << " depth " <<depth;
885 #endif
886  double time = (aStep->GetPostStepPoint()->GetGlobalTime());
887  uint32_t unitID = 0;
888  if (numberingFromDDD) {
889  HcalNumberingFromDDD::HcalID tmp = numberingFromDDD->unitID(det,etaR,phi,depth,1);
890  if (numberingScheme) unitID = numberingScheme->getUnitID(tmp);
891  }
892  if (type) currentID.setID(unitID, time, primaryID, 3);
893  else currentID.setID(unitID, time, primaryID, 2);
894 
895  edepositHAD = aStep->GetTotalEnergyDeposit();
896  edepositEM =-edepositHAD + (edep*GeV);
897 #ifdef DebugLog
898  plotProfile(aStep, hitPoint, edep*GeV, time, depth);
899  double beta = preStepPoint->GetBeta();
900  LogDebug("HcalSim") << "HCalSD::getHitFibreBundle 1 hit for " << GetName()
901  << " of " << primaryID << " with "
902  << theTrack->GetDefinition()->GetParticleName()
903  << " of " << preStepPoint->GetKineticEnergy()/GeV
904  << " GeV with velocity " << beta << " UnitID "
905  << std::hex << unitID << std::dec;
906 #endif
907  // check if it is in the same unit and timeslice as the previous one
909  else if (!checkHit()) currentHit = createNewHit();
910  } // non-zero energy deposit
911 }
912 
913 int HCalSD::setTrackID (G4Step* aStep) {
914  theTrack = aStep->GetTrack();
915 
916  double etrack = preStepPoint->GetKineticEnergy();
917  TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
918  int primaryID = trkInfo->getIDonCaloSurface();
919  if (primaryID == 0) {
920 #ifdef DebugLog
921  edm::LogInfo("HcalSim") << "HCalSD: Problem with primaryID **** set by "
922  << "force to TkID **** " <<theTrack->GetTrackID();
923 #endif
924  primaryID = theTrack->GetTrackID();
925  }
926 
927  if (primaryID != previousID.trackID())
928  resetForNewPrimary(preStepPoint->GetPosition(), etrack);
929 
930  return primaryID;
931 }
932 
934 
935  std::ifstream infile;
936  int entry=0;
937  infile.open(fName.c_str(), std::ios::in);
938  if (infile) {
939  int det, zside, etaR, phi, lay;
940  double wt;
941  while (infile >> det >> zside >> etaR >> phi >> lay >> wt) {
942  uint32_t id = HcalTestNumbering::packHcalIndex(det,zside,1,etaR,phi,lay);
943  layerWeights.insert(std::pair<uint32_t,double>(id,wt));
944  ++entry;
945 #ifdef DebugLog
946  edm::LogInfo("HcalSim") << "HCalSD::readWeightFromFile:Entry " << entry
947  << " ID " << std::hex << id << std::dec << " ("
948  << det << "/" << zside << "/1/" << etaR << "/"
949  << phi << "/" << lay << ") Weight " << wt;
950 #endif
951  }
952  infile.close();
953  }
954  edm::LogInfo("HcalSim") << "HCalSD::readWeightFromFile: reads " << entry
955  << " weights from " << fName;
956  if (entry <= 0) useLayerWt = false;
957 }
958 
959 double HCalSD::layerWeight(int det, G4ThreeVector pos, int depth, int lay) {
960 
961  double wt = 1.;
962  if (numberingFromDDD) {
963  //get the ID's as eta, phi, depth, ... indices
965  depth, lay);
966  uint32_t id = HcalTestNumbering::packHcalIndex(tmp.subdet, tmp.zside, 1,
967  tmp.etaR, tmp.phis,tmp.lay);
968  std::map<uint32_t,double>::const_iterator ite = layerWeights.find(id);
969  if (ite != layerWeights.end()) wt = ite->second;
970 #ifdef DebugLog
971  edm::LogInfo("HcalSim") << "HCalSD::layerWeight: ID " << std::hex << id
972  << std::dec << " (" << tmp.subdet << "/"
973  << tmp.zside << "/1/" << tmp.etaR << "/"
974  << tmp.phis << "/" << tmp.lay << ") Weight " <<wt;
975 #endif
976  }
977  return wt;
978 }
979 
980 void HCalSD::plotProfile(G4Step* aStep, G4ThreeVector global, double edep,
981  double time, int id) {
982 
983  const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
984  static G4String modName[8] = {"HEModule", "HVQF" , "HBModule", "MBAT",
985  "MBBT" , "MBBTC", "MBBT_R1P", "MBBT_R1M"};
986  G4ThreeVector local;
987  bool found=false;
988  double depth=-2000;
989  int idx = 4;
990  for (int n=0; n<touch->GetHistoryDepth(); ++n) {
991  G4String name = touch->GetVolume(n)->GetName();
992 #ifdef DebugLog
993  LogDebug("HcalSim") << "plotProfile Depth " << n << " Name " << name;
994 #endif
995  for (unsigned int ii=0; ii<8; ++ii) {
996  if (name == modName[ii]) {
997  found = true;
998  int dn = touch->GetHistoryDepth() - n;
999  local = touch->GetHistory()->GetTransform(dn).TransformPoint(global);
1000  if (ii == 0) {depth = local.z() - 4006.5; idx = 1;}
1001  else if (ii == 1) {depth = local.z() + 825.0; idx = 3;}
1002  else if (ii == 2) {depth = local.x() - 1775.; idx = 0;}
1003  else {depth = local.y() + 15.; idx = 2;}
1004  break;
1005  }
1006  }
1007  if (found) break;
1008  }
1009  if (!found) depth = std::abs(global.z()) - 11500;
1010 #ifdef DebugLog
1011  LogDebug("HcalSim") << "plotProfile Found " << found << " Global " << global
1012  << " Local " << local << " depth " << depth << " ID " << id
1013  << " EDEP " << edep << " Time " << time;
1014 #endif
1015  if (hit_[idx] != 0) hit_[idx]->Fill(edep);
1016  if (time_[idx] != 0) time_[idx]->Fill(time,edep);
1017  if (dist_[idx] != 0) dist_[idx]->Fill(depth,edep);
1018  int jd = 2*idx + id - 7;
1019  if (jd >= 0 && jd < 4) {
1020  jd += 5;
1021  if (hit_[jd] != 0) hit_[jd]->Fill(edep);
1022  if (time_[jd] != 0) time_[jd]->Fill(time,edep);
1023  if (dist_[jd] != 0) dist_[jd]->Fill(depth,edep);
1024  }
1025 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:120
const double beta
double energyCut
Definition: CaloSD.h:122
type
Definition: HCALResponse.h:22
T getParameter(std::string const &) const
std::vector< double > layer0wt
Definition: HCalSD.h:85
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
bool useParam
Definition: HCalSD.h:82
double eminHitHE
Definition: HCalSD.h:83
HFShowerParam * showerParam
Definition: HCalSD.h:77
TH1F * time_[9]
Definition: HCalSD.h:95
G4int emPDG
Definition: CaloSD.h:135
double getRadius()
Definition: HFShowerPMT.cc:150
void getFromLibrary(G4Step *step)
Definition: HCalSD.cc:635
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
Definition: DDValue.cc:134
std::vector< Hit > getHits(G4Step *aStep, bool &ok, bool onlyLong=false)
double kmaxNeutron
Definition: CaloSD.h:133
virtual uint32_t getUnitID(const HcalNumberingFromDDD::HcalID id)
void addFilter(const DDFilter &, log_op op=AND)
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:429
const N & name() const
Definition: DDBase.h:82
std::vector< Hit > getHits(G4Step *aStep)
int getIDonCaloSurface() const
bool useLayerWt
Definition: HCalSD.h:80
Definition: CaloSD.h:42
void initRun(G4ParticleTable *)
Definition: HFShower.cc:340
bool isItStraightBundle(G4LogicalVolume *)
Definition: HCalSD.cc:617
virtual bool ProcessHits(G4Step *, G4TouchableHistory *)
Definition: HCalSD.cc:341
bool useFibreBundle
Definition: HCalSD.h:80
double betaThr
Definition: HCalSD.h:81
HFShowerFibreBundle * showerBundle
Definition: HCalSD.h:79
std::vector< G4LogicalVolume * > fibre1LV
Definition: HCalSD.h:93
std::vector< G4LogicalVolume * > fibreLV
Definition: HCalSD.h:89
double eminHitHB
Definition: HCalSD.h:83
bool useShowerLibrary
Definition: HCalSD.h:82
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
Definition: HCalSD.cc:536
#define abs(x)
Definition: mlp_lapack.h:159
double getHits(G4Step *aStep, bool type)
#define NULL
Definition: scimark2.h:8
virtual uint32_t setDetUnitId(G4Step *step)
Definition: HCalSD.cc:471
double birk2
Definition: HCalSD.h:81
int setTrackID(G4Step *step)
Definition: HCalSD.cc:913
bool usePMTHit
Definition: HCalSD.h:82
G4ThreeVector posGlobal
Definition: CaloSD.h:112
void setNumberingScheme(HcalNumberingScheme *)
Definition: HCalSD.cc:484
type of data representation of DDCompactView
Definition: DDCompactView.h:77
double birk1
Definition: HCalSD.h:81
double kmaxProton
Definition: CaloSD.h:133
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:102
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
bool isItHF(G4Step *)
Definition: HCalSD.cc:581
G4bool checkHit()
Definition: CaloSD.cc:320
static TrackerG4SimHitNumberingScheme & numberingScheme(const DDCompactView &cpv, const GeometricDet &det)
double eminHitHF
Definition: HCalSD.h:83
std::vector< Hit > getHits(G4Step *aStep)
Definition: HFShower.cc:70
bool isItConicalBundle(G4LogicalVolume *)
Definition: HCalSD.cc:623
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
TH1F * hit_[9]
Definition: HCalSD.h:95
virtual void initRun()
Definition: HCalSD.cc:492
std::vector< G4LogicalVolume * > pmtLV
Definition: HCalSD.h:93
std::vector< G4LogicalVolume * > hfLV
Definition: HCalSD.h:86
double kmaxIon
Definition: CaloSD.h:133
bool suppressHeavy
Definition: CaloSD.h:131
bool isItScintillator(G4Material *)
Definition: HCalSD.cc:629
bool next()
set current node to the next node in the filtered tree
HFShower * hfshower
Definition: HCalSD.h:76
bool useBirk
Definition: HCalSD.h:80
float edepositHAD
Definition: CaloSD.h:120
double birk3
Definition: HCalSD.h:81
int trackID() const
Definition: CaloHitID.h:25
virtual double getEnergyDeposit(G4Step *)
Definition: HCalSD.cc:422
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
G4int epPDG
Definition: CaloSD.h:135
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:19
G4int gammaPDG
Definition: CaloSD.h:135
bool isAvailable() const
Definition: Service.h:47
TH1F * dist_[9]
Definition: HCalSD.h:95
virtual ~HCalSD()
Definition: HCalSD.cc:330
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
HcalNumberingScheme * numberingScheme
Definition: HCalSD.h:74
void getHitPMT(G4Step *step)
Definition: HCalSD.cc:787
int getNumberOfHits()
Definition: CaloSD.cc:350
CaloHitID previousID
Definition: CaloSD.h:116
double getAttenuation(G4Step *aStep, double birk1, double birk2, double birk3)
Definition: CaloSD.cc:454
CaloG4Hit * currentHit
Definition: CaloSD.h:127
std::vector< int > hfLevels
Definition: HCalSD.h:88
virtual std::vector< std::string > getNames()
void NaNTrap(G4Step *step)
G4Track * theTrack
Definition: CaloSD.h:117
virtual G4bool getStepInfo(G4Step *aStep)
Definition: CaloSD.cc:247
bool isItPMT(G4LogicalVolume *)
Definition: HCalSD.cc:611
G4int mupPDG
Definition: HCalSD.h:84
double eminHitHO
Definition: HCalSD.h:83
double tmaxHit
Definition: CaloSD.h:122
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:119
Definition: DetId.h:20
static const G4LogicalVolume * GetVolume(const std::string &name)
CaloHitID currentID
Definition: CaloSD.h:116
void readWeightFromFile(std::string)
Definition: HCalSD.cc:933
void plotProfile(G4Step *step, G4ThreeVector pos, double edep, double time, int id)
Definition: HCalSD.cc:980
void getHitFibreBundle(G4Step *step, bool type)
Definition: HCalSD.cc:852
int ke
bool isPrimary() const
DDsvalues_type mergedSpecifics() const
void hitForFibre(G4Step *step)
Definition: HCalSD.cc:701
double getHits(G4Step *aStep)
Definition: HFShowerPMT.cc:104
void initRun(G4ParticleTable *theParticleTable)
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:73
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double getResponseWt(G4Track *)
Definition: CaloSD.cc:596
void initRun(G4ParticleTable *)
std::vector< G4String > fibreNames
Definition: HCalSD.h:90
list infile
Definition: EdgesToViz.py:90
G4bool hitExists()
Definition: CaloSD.cc:299
bool firstChild()
set the current node to the first child ...
std::vector< G4Material * > materials
Definition: HCalSD.h:92
virtual bool filterHit(CaloG4Hit *, double)
Definition: HCalSD.cc:506
T * make() const
make new ROOT object
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
double layerWeight(int, G4ThreeVector, int, int)
Definition: HCalSD.cc:959
std::vector< G4String > hfNames
Definition: HCalSD.h:87
G4int mumPDG
Definition: HCalSD.h:84
void resetForNewPrimary(G4ThreeVector, double)
Definition: CaloSD.cc:443
std::map< uint32_t, double > layerWeights
Definition: HCalSD.h:94
tuple level
Definition: testEve_cfg.py:34
HcalID unitID(int det, CLHEP::Hep3Vector pos, int depth, int lay=-1) const
HFShowerPMT * showerPMT
Definition: HCalSD.h:78
uint32_t getUnitID() const
Definition: CaloG4Hit.h:69
HCalSD(G4String, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
Definition: HCalSD.cc:32
HFShowerLibrary * showerLibrary
Definition: HCalSD.h:75
std::vector< G4LogicalVolume * > fibre2LV
Definition: HCalSD.h:93
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
void getFromParam(G4Step *step)
Definition: HCalSD.cc:748
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:352
std::vector< G4String > matNames
Definition: HCalSD.h:91
bool isItFibre(G4LogicalVolume *)
Definition: HCalSD.cc:599
double getEnergyDeposit() const
Definition: CaloG4Hit.h:81
bool useHF
Definition: HCalSD.h:82
Definition: DDAxes.h:10
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37