CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 SensitiveCaloDetector Observer< const BeginOfRun * > Observer< const BeginOfEvent * > Observer< const BeginOfTrack * > Observer< const EndOfTrack * > Observer< const EndOfEvent * > SensitiveDetector

Public Member Functions

virtual double getEnergyDeposit (G4Step *)
 
 HCalSD (G4String, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
virtual bool ProcessHits (G4Step *, G4TouchableHistory *)
 
virtual uint32_t setDetUnitId (G4Step *step)
 
void setNumberingScheme (HcalNumberingScheme *)
 
virtual ~HCalSD ()
 
- Public Member Functions inherited from CaloSD
 CaloSD (G4String aSDname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, int tSlice=1, bool ignoreTkID=false)
 
virtual void clear ()
 
virtual void DrawAll ()
 
virtual void EndOfEvent (G4HCofThisEvent *eventHC)
 
void fillHits (edm::PCaloHitContainer &, std::string n)
 
virtual void Initialize (G4HCofThisEvent *HCE)
 
virtual void PrintAll ()
 
virtual bool ProcessHits (G4GFlashSpot *aSpot, G4TouchableHistory *)
 
virtual ~CaloSD ()
 
- Public Member Functions inherited from SensitiveCaloDetector
 SensitiveCaloDetector (std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
virtual void AssignSD (std::string &vname)
 
Local3DPoint ConvertToLocal3DPoint (G4ThreeVector point)
 
Local3DPoint FinalStepPosition (G4Step *s, coordinates)
 
virtual std::vector< std::string > getNames ()
 
Local3DPoint InitialStepPosition (G4Step *s, coordinates)
 
std::string nameOfSD ()
 
void NaNTrap (G4Step *step)
 
void Register ()
 
 SensitiveDetector (std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
virtual ~SensitiveDetector ()
 
- Public Member Functions inherited from Observer< const BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack * >
 Observer ()
 
void slotForUpdate (const BeginOfTrack *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfTrack * >
 Observer ()
 
void slotForUpdate (const EndOfTrack *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent * >
 Observer ()
 
void slotForUpdate (const EndOfEvent *iT)
 
virtual ~Observer ()
 

Protected Member Functions

virtual bool filterHit (CaloG4Hit *, double)
 
virtual void initRun ()
 
- Protected Member Functions inherited from CaloSD
G4bool checkHit ()
 
virtual void clearHits ()
 
CaloG4HitcreateNewHit ()
 
double getAttenuation (G4Step *aStep, double birk1, double birk2, double birk3)
 
virtual uint16_t getDepth (G4Step *)
 
int getNumberOfHits ()
 
double getResponseWt (G4Track *)
 
virtual G4bool getStepInfo (G4Step *aStep)
 
virtual int getTrackID (G4Track *)
 
G4bool hitExists ()
 
void resetForNewPrimary (G4ThreeVector, double)
 
G4ThreeVector setToLocal (G4ThreeVector, const G4VTouchable *)
 
virtual void update (const BeginOfRun *)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const BeginOfEvent *)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const BeginOfTrack *trk)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const EndOfTrack *trk)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const ::EndOfEvent *)
 
void updateHit (CaloG4Hit *)
 
- 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)
 
void getFromParam (G4Step *step)
 
void getHitFibreBundle (G4Step *step, bool type)
 
void getHitPMT (G4Step *step)
 
std::vector< G4String > getNames (DDFilteredView &)
 
void hitForFibre (G4Step *step)
 
bool isItConicalBundle (G4LogicalVolume *)
 
bool isItFibre (G4LogicalVolume *)
 
bool isItFibre (G4String)
 
bool isItHF (G4Step *)
 
bool isItHF (G4String)
 
bool isItPMT (G4LogicalVolume *)
 
bool isItScintillator (G4Material *)
 
bool isItStraightBundle (G4LogicalVolume *)
 
double layerWeight (int, G4ThreeVector, int, int)
 
void plotProfile (G4Step *step, G4ThreeVector pos, double edep, double time, int id)
 
void readWeightFromFile (std::string)
 
uint32_t setDetUnitId (int, G4ThreeVector, int, int)
 
int setTrackID (G4Step *step)
 

Private Attributes

bool applyFidCut
 
double betaThr
 
double birk1
 
double birk2
 
double birk3
 
TH1F * dist_ [9]
 
double eminHitHB
 
double eminHitHE
 
double eminHitHF
 
double eminHitHO
 
std::vector< G4LogicalVolume * > fibre1LV
 
std::vector< G4LogicalVolume * > fibre2LV
 
std::vector< G4LogicalVolume * > fibreLV
 
std::vector< G4String > fibreNames
 
std::vector< int > hfLevels
 
std::vector< G4LogicalVolume * > hfLV
 
std::vector< G4String > hfNames
 
HFShowerhfshower
 
TH1F * hit_ [9]
 
std::vector< double > layer0wt
 
std::map< uint32_t, double > layerWeights
 
std::vector< G4Material * > materials
 
std::vector< G4String > matNames
 
G4int mumPDG
 
G4int mupPDG
 
HcalNumberingFromDDDnumberingFromDDD
 
HcalNumberingSchemenumberingScheme
 
std::vector< G4LogicalVolume * > pmtLV
 
HFShowerFibreBundleshowerBundle
 
HFShowerLibraryshowerLibrary
 
HFShowerParamshowerParam
 
HFShowerPMTshowerPMT
 
TH1F * time_ [9]
 
bool useBirk
 
bool useFibreBundle
 
bool useHF
 
bool useLayerWt
 
bool useParam
 
bool usePMTHit
 
bool useShowerLibrary
 

Additional Inherited Members

- Public 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 31 of file HCalSD.h.

Constructor & Destructor Documentation

HCalSD::HCalSD ( G4String  name,
const DDCompactView cpv,
SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 32 of file HCalSD.cc.

References DDFilteredView::addFilter(), betaThr, birk1, birk2, birk3, dist_, eminHitHB, eminHitHE, eminHitHF, eminHitHO, DDSpecificsFilter::equals, fibre1LV, fibre2LV, fibreLV, fibreNames, mergeVDriftHistosByStation::file, DDFilteredView::firstChild(), g, getDDDArray(), SensitiveDetector::getNames(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hfLevels, hfLV, hfNames, hfshower, hit_, i, edm::Service< T >::isAvailable(), isItFibre(), isItHF(), CaloSD::kmaxIon, CaloSD::kmaxNeutron, CaloSD::kmaxProton, reco_calib_source_client_cfg::labels, layer0wt, testEve_cfg::level, create_public_lumi_plots::log, LogDebug, DDFilteredView::logicalPart(), TFileDirectory::make(), DDLogicalPart::material(), materials, matNames, DDFilteredView::mergedSpecifics(), mumPDG, mupPDG, DDName::name(), SensitiveDetector::name, DDBase< N, C >::name(), DDFilteredView::next(), numberingFromDDD, pmtLV, readWeightFromFile(), DDSpecificsFilter::setCriteria(), setNumberingScheme(), showerBundle, showerLibrary, showerParam, showerPMT, CaloSD::suppressHeavy, groupFilesInBlocks::temp, time_, indexGen::title, useBirk, useFibreBundle, useHF, useLayerWt, useParam, usePMTHit, useShowerLibrary, and relativeConstraints::value.

34  :
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")),
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");
47  edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("HCalSD");
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 
250  DDsvalues_type sv(fv2.mergedSpecifics());
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 }
#define LogDebug(id)
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
double kmaxNeutron
Definition: CaloSD.h:133
const N & name() const
Definition: DDBase.h:82
bool useLayerWt
Definition: HCalSD.h:80
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
double birk2
Definition: HCalSD.h:81
bool usePMTHit
Definition: HCalSD.h:82
void setNumberingScheme(HcalNumberingScheme *)
Definition: HCalSD.cc:484
double birk1
Definition: HCalSD.h:81
double kmaxProton
Definition: CaloSD.h:133
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
double eminHitHF
Definition: HCalSD.h:83
CaloSD(G4String aSDname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, int tSlice=1, bool ignoreTkID=false)
Definition: CaloSD.cc:21
TH1F * hit_[9]
Definition: HCalSD.h:95
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
HFShower * hfshower
Definition: HCalSD.h:76
bool useBirk
Definition: HCalSD.h:80
double birk3
Definition: HCalSD.h:81
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
bool isAvailable() const
Definition: Service.h:47
TH1F * dist_[9]
Definition: HCalSD.h:95
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
HcalNumberingScheme * numberingScheme
Definition: HCalSD.h:74
std::vector< int > hfLevels
Definition: HCalSD.h:88
virtual std::vector< std::string > getNames()
G4int mupPDG
Definition: HCalSD.h:84
double eminHitHO
Definition: HCalSD.h:83
void readWeightFromFile(std::string)
Definition: HCalSD.cc:933
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:73
std::vector< G4String > fibreNames
Definition: HCalSD.h:90
std::vector< G4Material * > materials
Definition: HCalSD.h:92
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
std::vector< G4String > hfNames
Definition: HCalSD.h:87
G4int mumPDG
Definition: HCalSD.h:84
tuple level
Definition: testEve_cfg.py:34
HFShowerPMT * showerPMT
Definition: HCalSD.h:78
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
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
std::vector< G4String > matNames
Definition: HCalSD.h:91
bool isItFibre(G4LogicalVolume *)
Definition: HCalSD.cc:599
bool useHF
Definition: HCalSD.h:82
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37
HCalSD::~HCalSD ( )
virtual

Definition at line 330 of file HCalSD.cc.

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

330  {
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 }
HFShowerParam * showerParam
Definition: HCalSD.h:77
HFShowerFibreBundle * showerBundle
Definition: HCalSD.h:79
HFShower * hfshower
Definition: HCalSD.h:76
HcalNumberingScheme * numberingScheme
Definition: HCalSD.h:74
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:73
HFShowerPMT * showerPMT
Definition: HCalSD.h:78
HFShowerLibrary * showerLibrary
Definition: HCalSD.h:75

Member Function Documentation

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

Reimplemented from CaloSD.

Definition at line 506 of file HCalSD.cc.

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

506  {
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 }
double eminHitHE
Definition: HCalSD.h:83
double eminHitHB
Definition: HCalSD.h:83
double eminHitHF
Definition: HCalSD.h:83
double eminHitHO
Definition: HCalSD.h:83
double tmaxHit
Definition: CaloSD.h:122
Definition: DetId.h:20
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 536 of file HCalSD.cc.

References DDfetch(), DDValue::doubles(), edm::hlt::Exception, LogDebug, and relativeConstraints::value.

Referenced by HCalSD().

537  {
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 }
#define LogDebug(id)
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:102
double HCalSD::getEnergyDeposit ( G4Step *  aStep)
virtual

Reimplemented from CaloSD.

Definition at line 422 of file HCalSD.cc.

References birk1, birk2, birk3, CaloSD::getAttenuation(), CaloSD::getResponseWt(), isItScintillator(), TrackInformation::isPrimary(), ke, CaloSD::kmaxIon, CaloSD::kmaxNeutron, CaloSD::kmaxProton, layer0wt, layerWeight(), CaloSD::suppressHeavy, CaloSD::theTrack, useBirk, useLayerWt, and CommonMethods::weight().

422  {
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 }
std::vector< double > layer0wt
Definition: HCalSD.h:85
double kmaxNeutron
Definition: CaloSD.h:133
bool useLayerWt
Definition: HCalSD.h:80
double birk2
Definition: HCalSD.h:81
double birk1
Definition: HCalSD.h:81
double kmaxProton
Definition: CaloSD.h:133
double kmaxIon
Definition: CaloSD.h:133
bool suppressHeavy
Definition: CaloSD.h:131
bool isItScintillator(G4Material *)
Definition: HCalSD.cc:629
bool useBirk
Definition: HCalSD.h:80
double birk3
Definition: HCalSD.h:81
double getAttenuation(G4Step *aStep, double birk1, double birk2, double birk3)
Definition: CaloSD.cc:454
G4Track * theTrack
Definition: CaloSD.h:117
int ke
bool isPrimary() const
double getResponseWt(G4Track *)
Definition: CaloSD.cc:596
double layerWeight(int, G4ThreeVector, int, int)
Definition: HCalSD.cc:959
void HCalSD::getFromLibrary ( G4Step *  step)
private

Definition at line 635 of file HCalSD.cc.

References CaloSD::checkHit(), CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::emPDG, CaloSD::epPDG, CaloSD::gammaPDG, HFShowerLibrary::getHits(), GetVolume(), i, GetRecoTauVFromDQM_MC_cff::kk, convertSQLiteXML::ok, plotProfile(), CaloSD::posGlobal, CaloSD::preStepPoint, CaloSD::previousID, CaloSD::resetForNewPrimary(), setDetUnitId(), CaloHitID::setID(), setTrackID(), showerLibrary, CaloSD::theTrack, cond::rpcobgas::time, and CaloSD::updateHit().

Referenced by ProcessHits().

635  {
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 }
float edepositEM
Definition: CaloSD.h:120
int i
Definition: DBlmapReader.cc:9
G4int emPDG
Definition: CaloSD.h:135
std::vector< Hit > getHits(G4Step *aStep, bool &ok, bool onlyLong=false)
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:429
virtual uint32_t setDetUnitId(G4Step *step)
Definition: HCalSD.cc:471
int setTrackID(G4Step *step)
Definition: HCalSD.cc:913
G4ThreeVector posGlobal
Definition: CaloSD.h:112
G4bool checkHit()
Definition: CaloSD.cc:320
float edepositHAD
Definition: CaloSD.h:120
G4int epPDG
Definition: CaloSD.h:135
G4int gammaPDG
Definition: CaloSD.h:135
CaloHitID previousID
Definition: CaloSD.h:116
CaloG4Hit * currentHit
Definition: CaloSD.h:127
G4Track * theTrack
Definition: CaloSD.h:117
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:119
static const G4LogicalVolume * GetVolume(const std::string &name)
CaloHitID currentID
Definition: CaloSD.h:116
void plotProfile(G4Step *step, G4ThreeVector pos, double edep, double time, int id)
Definition: HCalSD.cc:980
void resetForNewPrimary(G4ThreeVector, double)
Definition: CaloSD.cc:443
HFShowerLibrary * showerLibrary
Definition: HCalSD.h:75
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:352
void HCalSD::getFromParam ( G4Step *  step)
private

Definition at line 748 of file HCalSD.cc.

References CaloSD::checkHit(), CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, CaloSD::edepositEM, CaloSD::edepositHAD, HFShowerParam::getHits(), i, plotProfile(), CaloSD::posGlobal, CaloSD::preStepPoint, CaloSD::previousID, setDetUnitId(), CaloHitID::setID(), setTrackID(), showerParam, cond::rpcobgas::time, and CaloSD::updateHit().

Referenced by ProcessHits().

748  {
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 }
float edepositEM
Definition: CaloSD.h:120
int i
Definition: DBlmapReader.cc:9
HFShowerParam * showerParam
Definition: HCalSD.h:77
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:429
std::vector< Hit > getHits(G4Step *aStep)
virtual uint32_t setDetUnitId(G4Step *step)
Definition: HCalSD.cc:471
int setTrackID(G4Step *step)
Definition: HCalSD.cc:913
G4ThreeVector posGlobal
Definition: CaloSD.h:112
G4bool checkHit()
Definition: CaloSD.cc:320
float edepositHAD
Definition: CaloSD.h:120
CaloHitID previousID
Definition: CaloSD.h:116
CaloG4Hit * currentHit
Definition: CaloSD.h:127
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:119
CaloHitID currentID
Definition: CaloSD.h:116
void plotProfile(G4Step *step, G4ThreeVector pos, double edep, double time, int id)
Definition: HCalSD.cc:980
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:352
void HCalSD::getHitFibreBundle ( G4Step *  step,
bool  type 
)
private

Definition at line 852 of file HCalSD.cc.

References beta, CaloSD::checkHit(), CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::energyCut, HFShowerFibreBundle::getHits(), HFShowerFibreBundle::getRadius(), HcalNumberingScheme::getUnitID(), HcalForward, LogDebug, numberingFromDDD, numberingScheme, phi, plotProfile(), CaloSD::posGlobal, CaloSD::preStepPoint, CaloSD::previousID, CaloSD::resetForNewPrimary(), findQualityFiles::rr, CaloHitID::setID(), showerBundle, CaloSD::theTrack, cond::rpcobgas::time, tmp, HcalNumberingFromDDD::unitID(), and CaloSD::updateHit().

Referenced by ProcessHits().

852  {
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 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:120
const double beta
double energyCut
Definition: CaloSD.h:122
type
Definition: HCALResponse.h:22
virtual uint32_t getUnitID(const HcalNumberingFromDDD::HcalID id)
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:429
HFShowerFibreBundle * showerBundle
Definition: HCalSD.h:79
double getHits(G4Step *aStep, bool type)
G4ThreeVector posGlobal
Definition: CaloSD.h:112
G4bool checkHit()
Definition: CaloSD.cc:320
float edepositHAD
Definition: CaloSD.h:120
HcalNumberingScheme * numberingScheme
Definition: HCalSD.h:74
CaloHitID previousID
Definition: CaloSD.h:116
CaloG4Hit * currentHit
Definition: CaloSD.h:127
G4Track * theTrack
Definition: CaloSD.h:117
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:119
CaloHitID currentID
Definition: CaloSD.h:116
void plotProfile(G4Step *step, G4ThreeVector pos, double edep, double time, int id)
Definition: HCalSD.cc:980
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:73
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void resetForNewPrimary(G4ThreeVector, double)
Definition: CaloSD.cc:443
HcalID unitID(int det, CLHEP::Hep3Vector pos, int depth, int lay=-1) const
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:352
Definition: DDAxes.h:10
void HCalSD::getHitPMT ( G4Step *  step)
private

Definition at line 787 of file HCalSD.cc.

References beta, CaloSD::checkHit(), CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::energyCut, HFShowerPMT::getHits(), HFShowerPMT::getRadius(), HcalNumberingScheme::getUnitID(), HcalForward, LogDebug, numberingFromDDD, numberingScheme, phi, plotProfile(), CaloSD::posGlobal, CaloSD::preStepPoint, CaloSD::previousID, CaloSD::resetForNewPrimary(), findQualityFiles::rr, CaloHitID::setID(), showerPMT, CaloSD::theTrack, cond::rpcobgas::time, tmp, HcalNumberingFromDDD::unitID(), and CaloSD::updateHit().

Referenced by ProcessHits().

787  {
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 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:120
const double beta
double energyCut
Definition: CaloSD.h:122
double getRadius()
Definition: HFShowerPMT.cc:150
virtual uint32_t getUnitID(const HcalNumberingFromDDD::HcalID id)
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:429
G4ThreeVector posGlobal
Definition: CaloSD.h:112
G4bool checkHit()
Definition: CaloSD.cc:320
float edepositHAD
Definition: CaloSD.h:120
HcalNumberingScheme * numberingScheme
Definition: HCalSD.h:74
CaloHitID previousID
Definition: CaloSD.h:116
CaloG4Hit * currentHit
Definition: CaloSD.h:127
G4Track * theTrack
Definition: CaloSD.h:117
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:119
CaloHitID currentID
Definition: CaloSD.h:116
void plotProfile(G4Step *step, G4ThreeVector pos, double edep, double time, int id)
Definition: HCalSD.cc:980
double getHits(G4Step *aStep)
Definition: HFShowerPMT.cc:104
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:73
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void resetForNewPrimary(G4ThreeVector, double)
Definition: CaloSD.cc:443
HcalID unitID(int det, CLHEP::Hep3Vector pos, int depth, int lay=-1) const
HFShowerPMT * showerPMT
Definition: HCalSD.h:78
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:352
Definition: DDAxes.h:10
std::vector< G4String > HCalSD::getNames ( DDFilteredView fv)
private

Definition at line 561 of file HCalSD.cc.

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

561  {
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 }
int i
Definition: DBlmapReader.cc:9
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:82
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:88
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:87
void HCalSD::hitForFibre ( G4Step *  step)
private

Definition at line 701 of file HCalSD.cc.

References CaloSD::checkHit(), CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::emPDG, CaloSD::epPDG, CaloSD::gammaPDG, HFShower::getHits(), hfshower, i, plotProfile(), CaloSD::posGlobal, CaloSD::preStepPoint, CaloSD::previousID, setDetUnitId(), CaloHitID::setID(), setTrackID(), CaloSD::theTrack, cond::rpcobgas::time, and CaloSD::updateHit().

Referenced by ProcessHits().

701  { // 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 }
float edepositEM
Definition: CaloSD.h:120
int i
Definition: DBlmapReader.cc:9
G4int emPDG
Definition: CaloSD.h:135
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:429
virtual uint32_t setDetUnitId(G4Step *step)
Definition: HCalSD.cc:471
int setTrackID(G4Step *step)
Definition: HCalSD.cc:913
G4ThreeVector posGlobal
Definition: CaloSD.h:112
G4bool checkHit()
Definition: CaloSD.cc:320
std::vector< Hit > getHits(G4Step *aStep)
Definition: HFShower.cc:70
HFShower * hfshower
Definition: HCalSD.h:76
float edepositHAD
Definition: CaloSD.h:120
G4int epPDG
Definition: CaloSD.h:135
G4int gammaPDG
Definition: CaloSD.h:135
CaloHitID previousID
Definition: CaloSD.h:116
CaloG4Hit * currentHit
Definition: CaloSD.h:127
G4Track * theTrack
Definition: CaloSD.h:117
void setID(uint32_t unitID, double timeSlice, int trackID, uint16_t depth=0)
Definition: CaloHitID.cc:44
G4StepPoint * preStepPoint
Definition: CaloSD.h:119
CaloHitID currentID
Definition: CaloSD.h:116
void plotProfile(G4Step *step, G4ThreeVector pos, double edep, double time, int id)
Definition: HCalSD.cc:980
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:352
void HCalSD::initRun ( )
protectedvirtual

Reimplemented from CaloSD.

Definition at line 492 of file HCalSD.cc.

References hfshower, HFShower::initRun(), HFShowerParam::initRun(), HFShowerLibrary::initRun(), mumPDG, mupPDG, showerLibrary, and showerParam.

492  {
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 }
HFShowerParam * showerParam
Definition: HCalSD.h:77
void initRun(G4ParticleTable *)
Definition: HFShower.cc:340
HFShower * hfshower
Definition: HCalSD.h:76
G4int mupPDG
Definition: HCalSD.h:84
void initRun(G4ParticleTable *theParticleTable)
void initRun(G4ParticleTable *)
G4int mumPDG
Definition: HCalSD.h:84
HFShowerLibrary * showerLibrary
Definition: HCalSD.h:75
bool HCalSD::isItConicalBundle ( G4LogicalVolume *  lv)
private

Definition at line 623 of file HCalSD.cc.

References fibre2LV.

Referenced by ProcessHits().

623  {
624  std::vector<G4LogicalVolume*>::const_iterator ite = fibre2LV.begin();
625  for (; ite != fibre2LV.end(); ++ite) if (lv == *ite) return true;
626  return false;
627 }
std::vector< G4LogicalVolume * > fibre2LV
Definition: HCalSD.h:93
bool HCalSD::isItFibre ( G4LogicalVolume *  lv)
private

Definition at line 599 of file HCalSD.cc.

References fibreLV.

Referenced by HCalSD(), and ProcessHits().

599  {
600  std::vector<G4LogicalVolume*>::const_iterator ite = fibreLV.begin();
601  for (; ite != fibreLV.end(); ++ite) if (lv == *ite) return true;
602  return false;
603 }
std::vector< G4LogicalVolume * > fibreLV
Definition: HCalSD.h:89
bool HCalSD::isItFibre ( G4String  name)
private

Definition at line 605 of file HCalSD.cc.

References fibreNames.

605  {
606  std::vector<G4String>::const_iterator it = fibreNames.begin();
607  for (; it != fibreNames.end(); ++it) if (name == *it) return true;
608  return false;
609 }
std::vector< G4String > fibreNames
Definition: HCalSD.h:90
bool HCalSD::isItHF ( G4Step *  aStep)
private

Definition at line 581 of file HCalSD.cc.

References hfLevels, hfLV, and hfNames.

Referenced by HCalSD(), and ProcessHits().

581  {
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 }
std::vector< G4LogicalVolume * > hfLV
Definition: HCalSD.h:86
std::vector< int > hfLevels
Definition: HCalSD.h:88
std::vector< G4String > hfNames
Definition: HCalSD.h:87
bool HCalSD::isItHF ( G4String  name)
private

Definition at line 593 of file HCalSD.cc.

References hfNames.

593  {
594  std::vector<G4String>::const_iterator it = hfNames.begin();
595  for (; it != hfNames.end(); ++it) if (name == *it) return true;
596  return false;
597 }
std::vector< G4String > hfNames
Definition: HCalSD.h:87
bool HCalSD::isItPMT ( G4LogicalVolume *  lv)
private

Definition at line 611 of file HCalSD.cc.

References pmtLV.

Referenced by ProcessHits().

611  {
612  std::vector<G4LogicalVolume*>::const_iterator ite = pmtLV.begin();
613  for (; ite != pmtLV.end(); ++ite) if (lv == *ite) return true;
614  return false;
615 }
std::vector< G4LogicalVolume * > pmtLV
Definition: HCalSD.h:93
bool HCalSD::isItScintillator ( G4Material *  mat)
private

Definition at line 629 of file HCalSD.cc.

References materials.

Referenced by getEnergyDeposit().

629  {
630  std::vector<G4Material*>::const_iterator ite = materials.begin();
631  for (; ite != materials.end(); ++ite) if (mat == *ite) return true;
632  return false;
633 }
std::vector< G4Material * > materials
Definition: HCalSD.h:92
bool HCalSD::isItStraightBundle ( G4LogicalVolume *  lv)
private

Definition at line 617 of file HCalSD.cc.

References fibre1LV.

Referenced by ProcessHits().

617  {
618  std::vector<G4LogicalVolume*>::const_iterator ite = fibre1LV.begin();
619  for (; ite != fibre1LV.end(); ++ite) if (lv == *ite) return true;
620  return false;
621 }
std::vector< G4LogicalVolume * > fibre1LV
Definition: HCalSD.h:93
double HCalSD::layerWeight ( int  det,
G4ThreeVector  pos,
int  depth,
int  lay 
)
private

Definition at line 959 of file HCalSD.cc.

References HcalNumberingFromDDD::HcalID::etaR, HcalNumberingFromDDD::HcalID::lay, layerWeights, numberingFromDDD, HcalTestNumbering::packHcalIndex(), HcalNumberingFromDDD::HcalID::phis, HcalNumberingFromDDD::HcalID::subdet, tmp, HcalNumberingFromDDD::unitID(), and HcalNumberingFromDDD::HcalID::zside.

Referenced by getEnergyDeposit().

959  {
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 }
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:73
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::map< uint32_t, double > layerWeights
Definition: HCalSD.h:94
HcalID unitID(int det, CLHEP::Hep3Vector pos, int depth, int lay=-1) const
void HCalSD::plotProfile ( G4Step *  step,
G4ThreeVector  pos,
double  edep,
double  time,
int  id 
)
private

Definition at line 980 of file HCalSD.cc.

References abs, dist_, newFWLiteAna::found, hit_, LogDebug, n, SensitiveDetector::name, cond::rpcobgas::time, and time_.

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

981  {
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)
TH1F * time_[9]
Definition: HCalSD.h:95
#define abs(x)
Definition: mlp_lapack.h:159
TH1F * hit_[9]
Definition: HCalSD.h:95
TH1F * dist_[9]
Definition: HCalSD.h:95
bool HCalSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
virtual

Reimplemented from CaloSD.

Definition at line 341 of file HCalSD.cc.

References CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::edepositEM, CaloSD::edepositHAD, getFromLibrary(), getFromParam(), getHitFibreBundle(), getHitPMT(), CaloSD::getNumberOfHits(), CaloSD::getStepInfo(), CaloSD::hitExists(), hitForFibre(), isItConicalBundle(), isItFibre(), isItHF(), isItPMT(), isItStraightBundle(), LogDebug, mumPDG, mupPDG, SensitiveDetector::NaNTrap(), NULL, plotProfile(), showerBundle, showerPMT, useFibreBundle, useParam, usePMTHit, and useShowerLibrary.

341  {
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 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:120
bool useParam
Definition: HCalSD.h:82
void getFromLibrary(G4Step *step)
Definition: HCalSD.cc:635
bool isItStraightBundle(G4LogicalVolume *)
Definition: HCalSD.cc:617
bool useFibreBundle
Definition: HCalSD.h:80
HFShowerFibreBundle * showerBundle
Definition: HCalSD.h:79
bool useShowerLibrary
Definition: HCalSD.h:82
#define NULL
Definition: scimark2.h:8
bool usePMTHit
Definition: HCalSD.h:82
bool isItHF(G4Step *)
Definition: HCalSD.cc:581
bool isItConicalBundle(G4LogicalVolume *)
Definition: HCalSD.cc:623
float edepositHAD
Definition: CaloSD.h:120
void getHitPMT(G4Step *step)
Definition: HCalSD.cc:787
int getNumberOfHits()
Definition: CaloSD.cc:350
CaloG4Hit * currentHit
Definition: CaloSD.h:127
void NaNTrap(G4Step *step)
virtual G4bool getStepInfo(G4Step *aStep)
Definition: CaloSD.cc:247
bool isItPMT(G4LogicalVolume *)
Definition: HCalSD.cc:611
G4int mupPDG
Definition: HCalSD.h:84
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
void hitForFibre(G4Step *step)
Definition: HCalSD.cc:701
G4bool hitExists()
Definition: CaloSD.cc:299
G4int mumPDG
Definition: HCalSD.h:84
HFShowerPMT * showerPMT
Definition: HCalSD.h:78
void getFromParam(G4Step *step)
Definition: HCalSD.cc:748
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:352
bool isItFibre(G4LogicalVolume *)
Definition: HCalSD.cc:599
void HCalSD::readWeightFromFile ( std::string  fName)
private

Definition at line 933 of file HCalSD.cc.

References MainPageGenerator::fName, recoMuon::in, EdgesToViz::infile, layerWeights, HcalTestNumbering::packHcalIndex(), phi, and useLayerWt.

Referenced by HCalSD().

933  {
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 }
bool useLayerWt
Definition: HCalSD.h:80
static uint32_t packHcalIndex(int det, int z, int depth, int eta, int phi, int lay)
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
list infile
Definition: EdgesToViz.py:90
std::map< uint32_t, double > layerWeights
Definition: HCalSD.h:94
Definition: DDAxes.h:10
uint32_t HCalSD::setDetUnitId ( G4Step *  step)
virtual

Implements CaloSD.

Definition at line 471 of file HCalSD.cc.

References CaloSD::preStepPoint.

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

471  {
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 }
virtual uint32_t setDetUnitId(G4Step *step)
Definition: HCalSD.cc:471
G4StepPoint * preStepPoint
Definition: CaloSD.h:119
uint32_t HCalSD::setDetUnitId ( int  det,
G4ThreeVector  pos,
int  depth,
int  lay = 1 
)
private

Definition at line 525 of file HCalSD.cc.

References HcalNumberingScheme::getUnitID(), errorMatrix2Lands_multiChannel::id, numberingFromDDD, numberingScheme, tmp, and HcalNumberingFromDDD::unitID().

525  {
526  uint32_t id = 0;
527  if (numberingFromDDD) {
528  //get the ID's as eta, phi, depth, ... indices
530  //get the ID
531  if (numberingScheme) id = numberingScheme->getUnitID(tmp);
532  }
533  return id;
534 }
virtual uint32_t getUnitID(const HcalNumberingFromDDD::HcalID id)
HcalNumberingScheme * numberingScheme
Definition: HCalSD.h:74
HcalNumberingFromDDD * numberingFromDDD
Definition: HCalSD.h:73
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
HcalID unitID(int det, CLHEP::Hep3Vector pos, int depth, int lay=-1) const
void HCalSD::setNumberingScheme ( HcalNumberingScheme scheme)

Definition at line 484 of file HCalSD.cc.

References numberingScheme.

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

484  {
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 }
HcalNumberingScheme * numberingScheme
Definition: HCalSD.h:74
int HCalSD::setTrackID ( G4Step *  step)
private

Definition at line 913 of file HCalSD.cc.

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

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

913  {
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 }
int getIDonCaloSurface() const
int trackID() const
Definition: CaloHitID.h:25
CaloHitID previousID
Definition: CaloSD.h:116
G4Track * theTrack
Definition: CaloSD.h:117
G4StepPoint * preStepPoint
Definition: CaloSD.h:119
void resetForNewPrimary(G4ThreeVector, double)
Definition: CaloSD.cc:443

Member Data Documentation

bool HCalSD::applyFidCut
private

Definition at line 80 of file HCalSD.h.

double HCalSD::betaThr
private

Definition at line 81 of file HCalSD.h.

Referenced by HCalSD().

double HCalSD::birk1
private

Definition at line 81 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

double HCalSD::birk2
private

Definition at line 81 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

double HCalSD::birk3
private

Definition at line 81 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

TH1F * HCalSD::dist_[9]
private

Definition at line 95 of file HCalSD.h.

Referenced by HCalSD(), and plotProfile().

double HCalSD::eminHitHB
private

Definition at line 83 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

double HCalSD::eminHitHE
private

Definition at line 83 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

double HCalSD::eminHitHF
private

Definition at line 83 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

double HCalSD::eminHitHO
private

Definition at line 83 of file HCalSD.h.

Referenced by filterHit(), and HCalSD().

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

Definition at line 93 of file HCalSD.h.

Referenced by HCalSD(), and isItStraightBundle().

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

Definition at line 93 of file HCalSD.h.

Referenced by HCalSD(), and isItConicalBundle().

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

Definition at line 89 of file HCalSD.h.

Referenced by HCalSD(), and isItFibre().

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

Definition at line 90 of file HCalSD.h.

Referenced by HCalSD(), and isItFibre().

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

Definition at line 88 of file HCalSD.h.

Referenced by HCalSD(), and isItHF().

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

Definition at line 86 of file HCalSD.h.

Referenced by HCalSD(), and isItHF().

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

Definition at line 87 of file HCalSD.h.

Referenced by HCalSD(), and isItHF().

HFShower* HCalSD::hfshower
private

Definition at line 76 of file HCalSD.h.

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

TH1F* HCalSD::hit_[9]
private

Definition at line 95 of file HCalSD.h.

Referenced by HCalSD(), and plotProfile().

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

Definition at line 85 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

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

Definition at line 94 of file HCalSD.h.

Referenced by layerWeight(), and readWeightFromFile().

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

Definition at line 92 of file HCalSD.h.

Referenced by HCalSD(), and isItScintillator().

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

Definition at line 91 of file HCalSD.h.

Referenced by HCalSD().

G4int HCalSD::mumPDG
private

Definition at line 84 of file HCalSD.h.

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

G4int HCalSD::mupPDG
private

Definition at line 84 of file HCalSD.h.

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

HcalNumberingFromDDD* HCalSD::numberingFromDDD
private

Definition at line 73 of file HCalSD.h.

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

HcalNumberingScheme* HCalSD::numberingScheme
private

Definition at line 74 of file HCalSD.h.

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

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

Definition at line 93 of file HCalSD.h.

Referenced by HCalSD(), and isItPMT().

HFShowerFibreBundle* HCalSD::showerBundle
private

Definition at line 79 of file HCalSD.h.

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

HFShowerLibrary* HCalSD::showerLibrary
private

Definition at line 75 of file HCalSD.h.

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

HFShowerParam* HCalSD::showerParam
private

Definition at line 77 of file HCalSD.h.

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

HFShowerPMT* HCalSD::showerPMT
private

Definition at line 78 of file HCalSD.h.

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

TH1F * HCalSD::time_[9]
private

Definition at line 95 of file HCalSD.h.

Referenced by HCalSD(), and plotProfile().

bool HCalSD::useBirk
private

Definition at line 80 of file HCalSD.h.

Referenced by getEnergyDeposit(), and HCalSD().

bool HCalSD::useFibreBundle
private

Definition at line 80 of file HCalSD.h.

Referenced by HCalSD(), and ProcessHits().

bool HCalSD::useHF
private

Definition at line 82 of file HCalSD.h.

Referenced by HCalSD().

bool HCalSD::useLayerWt
private

Definition at line 80 of file HCalSD.h.

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

bool HCalSD::useParam
private

Definition at line 82 of file HCalSD.h.

Referenced by HCalSD(), and ProcessHits().

bool HCalSD::usePMTHit
private

Definition at line 82 of file HCalSD.h.

Referenced by HCalSD(), and ProcessHits().

bool HCalSD::useShowerLibrary
private

Definition at line 82 of file HCalSD.h.

Referenced by HCalSD(), and ProcessHits().