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
ZdcSD Class Reference

#include <ZdcSD.h>

Inheritance diagram for ZdcSD:
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 *, edm::ParameterSet const &)
 
void getFromLibrary (G4Step *step)
 
virtual bool ProcessHits (G4Step *step, G4TouchableHistory *tHistory)
 
virtual uint32_t setDetUnitId (G4Step *step)
 
void setNumberingScheme (ZdcNumberingScheme *scheme)
 
 ZdcSD (G4String, const DDCompactView &, SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
virtual ~ZdcSD ()
 
- 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 double getEnergyDeposit (G4Step *step)
 
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 void initRun ()
 
- Protected Member Functions inherited from CaloSD
G4bool checkHit ()
 
virtual void clearHits ()
 
CaloG4HitcreateNewHit ()
 
virtual bool filterHit (CaloG4Hit *, double)
 
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

int setTrackID (G4Step *step)
 

Private Attributes

std::vector
< ZdcShowerLibrary::Hit
hits
 
ZdcNumberingSchemenumberingScheme
 
ZdcShowerLibraryshowerLibrary
 
double thFibDir
 
bool useShowerHits
 
bool useShowerLibrary
 
int verbosity
 
double zdcHitEnergyCut
 

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 14 of file ZdcSD.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file ZdcSD.cc.

References edm::ParameterSet::getParameter(), setNumberingScheme(), showerLibrary, useShowerHits, useShowerLibrary, verbosity, and zdcHitEnergyCut.

23  :
24  CaloSD(name, cpv, clg, p, manager), numberingScheme(0) {
25  edm::ParameterSet m_ZdcSD = p.getParameter<edm::ParameterSet>("ZdcSD");
26  useShowerLibrary = m_ZdcSD.getParameter<bool>("UseShowerLibrary");
27  useShowerHits = m_ZdcSD.getParameter<bool>("UseShowerHits");
28  zdcHitEnergyCut = m_ZdcSD.getParameter<double>("ZdcHitEnergyCut")*GeV;
29  verbosity = m_ZdcSD.getParameter<int>("Verbosity");
30  int verbn = verbosity/10;
31  verbosity %= 10;
32  ZdcNumberingScheme* scheme;
33  scheme = new ZdcNumberingScheme(verbn);
34  setNumberingScheme(scheme);
35 
36  edm::LogInfo("ForwardSim")
37  << "***************************************************\n"
38  << "* *\n"
39  << "* Constructing a ZdcSD with name " << name <<" *\n"
40  << "* *\n"
41  << "***************************************************";
42 
43  edm::LogInfo("ForwardSim")
44  << "\nUse of shower library is set to "
45  << useShowerLibrary
46  << "\nUse of Shower hits method is set to "
47  << useShowerHits;
48 
49  edm::LogInfo("ForwardSim")
50  << "\nEnergy Threshold Cut set to "
51  << zdcHitEnergyCut/GeV
52  <<" (GeV)";
53 
54  if(useShowerLibrary){
55  showerLibrary = new ZdcShowerLibrary(name, cpv, p);
56  }
57 }
void setNumberingScheme(ZdcNumberingScheme *scheme)
Definition: ZdcSD.cc:416
T getParameter(std::string const &) const
int verbosity
Definition: ZdcSD.h:33
ZdcNumberingScheme * numberingScheme
Definition: ZdcSD.h:39
bool useShowerHits
Definition: ZdcSD.h:34
CaloSD(G4String aSDname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, int tSlice=1, bool ignoreTkID=false)
Definition: CaloSD.cc:21
double zdcHitEnergyCut
Definition: ZdcSD.h:37
bool useShowerLibrary
Definition: ZdcSD.h:34
ZdcShowerLibrary * showerLibrary
Definition: ZdcSD.h:38
ZdcSD::~ZdcSD ( )
virtual

Definition at line 59 of file ZdcSD.cc.

References numberingScheme, and showerLibrary.

59  {
60 
62  if(showerLibrary)delete showerLibrary;
63 
64  edm::LogInfo("ForwardSim")
65  <<"end of ZdcSD\n";
66 }
ZdcNumberingScheme * numberingScheme
Definition: ZdcSD.h:39
ZdcShowerLibrary * showerLibrary
Definition: ZdcSD.h:38

Member Function Documentation

double ZdcSD::getEnergyDeposit ( G4Step *  aStep,
edm::ParameterSet const &  p 
)
virtual

Definition at line 180 of file ZdcSD.cc.

References a, beta, DeDxDiscriminatorTools::charge(), eta(), edm::ParameterSet::getParameter(), create_public_lumi_plots::log, LogDebug, max(), min, NULL, phi, pi, CaloSD::preStepPoint, alignCSCRings::r, mathSSE::sqrt(), funct::tan(), theta(), CaloSD::theTrack, and thFibDir.

180  {
181 
182  float NCherPhot = 0.;
183  //std::cout<<"I go through here"<<std::endl;
184 
185  if (aStep == NULL) {
186  LogDebug("ForwardSim") << "ZdcSD:: getEnergyDeposit: aStep is NULL!";
187  return 0;
188  } else {
189  // preStepPoint information
190  G4SteppingControl stepControlFlag = aStep->GetControlFlag();
191  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
192  G4VPhysicalVolume* currentPV = preStepPoint->GetPhysicalVolume();
193  G4String nameVolume = currentPV->GetName();
194 
195  G4ThreeVector hitPoint = preStepPoint->GetPosition();
196  G4ThreeVector hit_mom = preStepPoint->GetMomentumDirection();
197  G4double stepL = aStep->GetStepLength()/cm;
198  G4double beta = preStepPoint->GetBeta();
199  G4double charge = preStepPoint->GetCharge();
200 
201  // G4VProcess* curprocess = preStepPoint->GetProcessDefinedStep();
202  // G4String namePr = preStepPoint->GetProcessDefinedStep()->GetProcessName();
203  // G4LogicalVolume* lv = currentPV->GetLogicalVolume();
204  // G4Material* mat = lv->GetMaterial();
205  // G4double rad = mat->GetRadlen();
206 
207  // postStepPoint information
208  G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
209  G4VPhysicalVolume* postPV = postStepPoint->GetPhysicalVolume();
210  G4String postnameVolume = postPV->GetName();
211 
212  // theTrack information
213  G4Track* theTrack = aStep->GetTrack();
214  G4String particleType = theTrack->GetDefinition()->GetParticleName();
215  G4int primaryID = theTrack->GetTrackID();
216  G4double entot = theTrack->GetTotalEnergy();
217  G4ThreeVector vert_mom = theTrack->GetVertexMomentumDirection();
218  G4ThreeVector localPoint = theTrack->GetTouchable()->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
219 
220  // calculations
221  float costheta = vert_mom.z()/sqrt(vert_mom.x()*vert_mom.x()+
222  vert_mom.y()*vert_mom.y()+
223  vert_mom.z()*vert_mom.z());
224  float theta = acos(std::min(std::max(costheta,float(-1.)),float(1.)));
225  float eta = -log(tan(theta/2));
226  float phi = -100.;
227  if (vert_mom.x() != 0) phi = atan2(vert_mom.y(),vert_mom.x());
228  if (phi < 0.) phi += twopi;
229 
230  // Get the total energy deposit
231  double stepE = aStep->GetTotalEnergyDeposit();
232  LogDebug("ForwardSim")
233  << "ZdcSD:: getEnergyDeposit: "
234  <<"*****************HHHHHHHHHHHHHHHHHHHHHHHHHHLLLLLLLLLlllllllllll&&&&&&&&&&\n"
235  << " preStepPoint: " << nameVolume << "," << stepL << "," << stepE
236  << "," << beta << "," << charge << "\n"
237  << " postStepPoint: " << postnameVolume << "," << costheta << ","
238  << theta << "," << eta << "," << phi << "," << particleType << ","
239  << primaryID;
240 
241  float bThreshold = 0.67;
242  if ((beta > bThreshold) && (charge != 0) && (nameVolume == "ZDC_EMFiber" || nameVolume == "ZDC_HadFiber")) {
243  LogDebug("ForwardSim") << "ZdcSD:: getEnergyDeposit: pass ";
244 
245  float nMedium = 1.4925;
246  // float photEnSpectrDL = 10714.285714;
247  // photEnSpectrDL = (1./400.nm-1./700.nm)*10000000.cm/nm; /* cm-1 */
248 
249  float photEnSpectrDE = 1.24;
250  // E = 2pi*(1./137.)*(eV*cm/370.)/lambda = 12.389184*(eV*cm)/lambda
251  // Emax = 12.389184*(eV*cm)/400nm*10-7cm/nm = 3.01 eV
252  // Emin = 12.389184*(eV*cm)/700nm*10-7cm/nm = 1.77 eV
253  // delE = Emax - Emin = 1.24 eV
254 
255  float effPMTandTransport = 0.15;
256 
257  // Check these values
258  float thFullRefl = 23.;
259  float thFullReflRad = thFullRefl*pi/180.;
260 
261  edm::ParameterSet m_ZdcSD = p.getParameter<edm::ParameterSet>("ZdcSD");
262  thFibDir = m_ZdcSD.getParameter<double>("FiberDirection");
263  //float thFibDir = 90.;
264  float thFibDirRad = thFibDir*pi/180.;
265 
266  // at which theta the point is located:
267  // float th1 = hitPoint.theta();
268 
269  // theta of charged particle in LabRF(hit momentum direction):
270  float costh = hit_mom.z()/sqrt(hit_mom.x()*hit_mom.x()+
271  hit_mom.y()*hit_mom.y()+
272  hit_mom.z()*hit_mom.z());
273  float th = acos(std::min(std::max(costh,float(-1.)),float(1.)));
274  // just in case (can do both standard ranges of phi):
275  if (th < 0.) th += twopi;
276 
277  // theta of cone with Cherenkov photons w.r.t.direction of charged part.:
278  float costhcher =1./(nMedium*beta);
279  float thcher = acos(std::min(std::max(costhcher,float(-1.)),float(1.)));
280 
281  // diff thetas of charged part. and quartz direction in LabRF:
282  float DelFibPart = fabs(th - thFibDirRad);
283 
284  // define real distances:
285  float d = fabs(tan(th)-tan(thFibDirRad));
286 
287  // float a = fabs(tan(thFibDirRad)-tan(thFibDirRad+thFullReflRad));
288  // float r = fabs(tan(th)-tan(th+thcher));
289  float a = tan(thFibDirRad)+tan(fabs(thFibDirRad-thFullReflRad));
290  float r = tan(th)+tan(fabs(th-thcher));
291 
292  // std::cout.testOut << " d=|tan(" << th << ")-tan(" << thFibDirRad << ")| "
293  // << "=|" << tan(th) << "-" << tan(thFibDirRad) << "| = " << d;
294  // std::cout.testOut << " a=tan(" << thFibDirRad << ")=" << tan(thFibDirRad)
295  // << " + tan(|" << thFibDirRad << " - " << thFullReflRad << "|)="
296  // << tan(fabs(thFibDirRad-thFullReflRad)) << " = " << a;
297  // std::cout.testOut << " r=tan(" << th << ")=" << tan(th) << " + tan(|" << th
298  // << " - " << thcher << "|)=" << tan(fabs(th-thcher)) << " = " << r;
299 
300  // define losses d_qz in cone of full reflection inside quartz direction
301  float d_qz = -1;
302  float variant = -1;
303 
304  // if (d > (r+a))
305  if (DelFibPart > (thFullReflRad + thcher) ) {
306  variant = 0.; d_qz = 0.;
307  } else {
308  // if ((DelFibPart + thcher) < thFullReflRad ) [(d+r) < a]
309  if ((th + thcher) < (thFibDirRad+thFullReflRad) && (th - thcher) > (thFibDirRad-thFullReflRad) ) {
310  variant = 1.; d_qz = 1.;
311  } else {
312  // if ((thcher - DelFibPart ) > thFullReflRad ) [(r-d) > a]
313  if ((thFibDirRad + thFullReflRad) < (th + thcher) && (thFibDirRad - thFullReflRad) > (th - thcher) ) {
314  variant = 2.; d_qz = 0.;
315  } else {
316  // if ((thcher + DelFibPart ) > thFullReflRad && thcher < (DelFibPart+thFullReflRad) ) { [(r+d) > a && (r-d) < a)]
317  variant = 3.; // d_qz is calculated below
318 
319  // use crossed length of circles(cone projection) - dC1/dC2 :
320  float arg_arcos = 0.;
321  float tan_arcos = 2.*a*d;
322  if (tan_arcos != 0.) arg_arcos =(r*r-a*a-d*d)/tan_arcos;
323  // std::cout.testOut << " d_qz: " << r << "," << a << "," << d << " " << tan_arcos << " " << arg_arcos;
324  arg_arcos = fabs(arg_arcos);
325  // std::cout.testOut << "," << arg_arcos;
326  float th_arcos = acos(std::min(std::max(arg_arcos,float(-1.)),float(1.)));
327  // std::cout.testOut << " " << th_arcos;
328  d_qz = th_arcos/pi/2.;
329  // std::cout.testOut << " " << d_qz;
330  d_qz = fabs(d_qz);
331  // std::cout.testOut << "," << d_qz;
332  }
333  }
334  }
335 
336  // std::cout<< std::endl;
337 
338  double meanNCherPhot = 0.;
339  G4int poissNCherPhot = 0;
340  if (d_qz > 0) {
341  meanNCherPhot = 370.*charge*charge*( 1. - 1./(nMedium*nMedium*beta*beta) ) * photEnSpectrDE * stepL;
342 
343  // dLamdX: meanNCherPhot = (2.*pi/137.)*charge*charge*
344  // ( 1. - 1./(nMedium*nMedium*beta*beta) ) * photEnSpectrDL * stepL;
345  poissNCherPhot = (G4int) G4Poisson(meanNCherPhot);
346 
347  if (poissNCherPhot < 0) poissNCherPhot = 0;
348 
349  // NCherPhot = meanNCherPhot;
350  NCherPhot = poissNCherPhot * effPMTandTransport * d_qz;
351  }
352 
353  LogDebug("ForwardSim")
354  << "ZdcSD:: getEnergyDeposit: gED: "
355  << stepE
356  << "," << costh
357  << "," << th
358  << "," << costhcher
359  << "," << thcher
360  << "," << DelFibPart
361  << "," << d
362  << "," << a
363  << "," << r
364  << "," << hitPoint
365  << "," << hit_mom
366  << "," << stepControlFlag
367  << "," << entot
368  << "," << vert_mom
369  << "," << localPoint
370  << "," << charge
371  << "," << beta
372  << "," << stepL
373  << "," << d_qz
374  << "," << variant
375  << "," << meanNCherPhot
376  << "," << poissNCherPhot
377  << "," << NCherPhot;
378  // --constants-----------------
379  // << "," << photEnSpectrDE
380  // << "," << nMedium
381  // << "," << bThreshold
382  // << "," << thFibDirRad
383  // << "," << thFullReflRad
384  // << "," << effPMTandTransport
385  // --other variables-----------
386  // << "," << curprocess
387  // << "," << nameProcess
388  // << "," << name
389  // << "," << rad
390  // << "," << mat
391 
392  } else {
393  // determine failure mode: beta, charge, and/or nameVolume
394  if (beta <= bThreshold)
395  LogDebug("ForwardSim")
396  << "ZdcSD:: getEnergyDeposit: fail beta=" << beta;
397  if (charge == 0)
398  LogDebug("ForwardSim")
399  << "ZdcSD:: getEnergyDeposit: fail charge=0";
400  if ( !(nameVolume == "ZDC_EMFiber" || nameVolume == "ZDC_HadFiber") )
401  LogDebug("ForwardSim")
402  << "ZdcSD:: getEnergyDeposit: fail nv=" << nameVolume;
403  }
404 
405  return NCherPhot;
406  }
407 }
#define LogDebug(id)
const double beta
double thFibDir
Definition: ZdcSD.h:36
T getParameter(std::string const &) const
Geom::Theta< T > theta() const
#define NULL
Definition: scimark2.h:8
#define min(a, b)
Definition: mlp_lapack.h:161
T eta() const
double charge(const std::vector< uint8_t > &Ampls)
const T & max(const T &a, const T &b)
T sqrt(T t)
Definition: SSEVec.h:46
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
G4Track * theTrack
Definition: CaloSD.h:117
G4StepPoint * preStepPoint
Definition: CaloSD.h:119
double a
Definition: hdecay.h:121
double pi
Definition: DDAxes.h:10
void ZdcSD::getFromLibrary ( G4Step *  step)

Definition at line 96 of file ZdcSD.cc.

References CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::currentID, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::entranceLocal, CaloSD::entrancePoint, CaloG4Hit::getEM(), CaloG4Hit::getEntryLocal(), CaloG4Hit::getHadr(), ZdcShowerLibrary::getHits(), CaloG4Hit::getIncidentEnergy(), CaloG4Hit::getTrackID(), CaloG4Hit::getUnitID(), GetVolume(), hits, i, GetRecoTauVFromDQM_MC_cff::kk, LogDebug, convertSQLiteXML::ok, CaloSD::posGlobal, CaloSD::preStepPoint, CaloSD::previousID, CaloSD::resetForNewPrimary(), CaloHitID::setID(), CaloG4Hit::setIncidentEnergy(), setTrackID(), showerLibrary, CaloSD::theTrack, cond::rpcobgas::time, CaloSD::updateHit(), and zdcHitEnergyCut.

Referenced by ProcessHits().

96  {
97  bool ok = true;
98 
99  preStepPoint = aStep->GetPreStepPoint();
100  theTrack = aStep->GetTrack();
101 
102  double etrack = preStepPoint->GetKineticEnergy();
103  int primaryID = setTrackID(aStep);
104 
105  hits.clear();
106 
107  /*
108  if (etrack >= zdcHitEnergyCut) {
109  primaryID = theTrack->GetTrackID();
110  } else {
111  primaryID = theTrack->GetParentID();
112  if (primaryID == 0) primaryID = theTrack->GetTrackID();
113  }
114  */
115 
116  // Reset entry point for new primary
117  posGlobal = preStepPoint->GetPosition();
118  resetForNewPrimary(posGlobal, etrack);
119 
120  if (etrack >= zdcHitEnergyCut){
121  // create hits only if above threshold
122 
123  LogDebug("ForwardSim")
124  //std::cout
125  <<"----------------New track------------------------------\n"
126  <<"Incident EnergyTrack: "<<etrack<< " MeV \n"
127  <<"Zdc Cut Energy for Hits: "<<zdcHitEnergyCut<<" MeV \n"
128  << "ZdcSD::getFromLibrary " <<hits.size() <<" hits for "
129  << GetName() << " of " << primaryID << " with "
130  << theTrack->GetDefinition()->GetParticleName() << " of "
131  << preStepPoint->GetKineticEnergy()<< " MeV\n";
132 
133  hits.swap(showerLibrary->getHits(aStep, ok));
134  }
135 
136  entrancePoint = preStepPoint->GetPosition();
137  for (unsigned int i=0; i<hits.size(); i++) {
138  posGlobal = hits[i].position;
139  entranceLocal = hits[i].entryLocal;
140  double time = hits[i].time;
141  unsigned int unitID = hits[i].detID;
142  edepositHAD = hits[i].DeHad;
143  edepositEM = hits[i].DeEM;
144  currentID.setID(unitID, time, primaryID);
145 
146  // check if it is in the same unit and timeslice as the previous on
147  if (currentID == previousID) {
149  } else {
151  }
152 
153  // currentHit->setPosition(hitPoint.x(),hitPoint.y(),hitPoint.z());
154  // currentHit->setEM(eEM);
155  // currentHit->setHadr(eHAD);
156  currentHit->setIncidentEnergy(etrack);
157  // currentHit->setEntryLocal(hitEntry.x(),hitEntry.y(),hitEntry.z());
158 
159  LogDebug("ForwardSim") << "ZdcSD: Final Hit number:"<<i<<"-->"
160  <<"New HitID: "<<currentHit->getUnitID()
161  <<" New Hit trackID: "<<currentHit->getTrackID()
162  <<" New EM Energy: "<<currentHit->getEM()/GeV
163  <<" New HAD Energy: "<<currentHit->getHadr()/GeV
164  <<" New HitEntryPoint: "<<currentHit->getEntryLocal()
165  <<" New IncidentEnergy: "<<currentHit->getIncidentEnergy()/GeV
166  <<" New HitPosition: "<<posGlobal;
167  }
168 
169  //Now kill the current track
170  if (ok) {
171  theTrack->SetTrackStatus(fStopAndKill);
172  G4TrackVector tv = *(aStep->GetSecondary());
173  for (unsigned int kk=0; kk<tv.size(); kk++) {
174  if (tv[kk]->GetVolume() == preStepPoint->GetPhysicalVolume())
175  tv[kk]->SetTrackStatus(fStopAndKill);
176  }
177  }
178 }
#define LogDebug(id)
float edepositEM
Definition: CaloSD.h:120
int i
Definition: DBlmapReader.cc:9
void updateHit(CaloG4Hit *)
Definition: CaloSD.cc:429
std::vector< ZdcShowerLibrary::Hit > hits
Definition: ZdcSD.h:41
void setIncidentEnergy(double e)
Definition: CaloG4Hit.h:66
double getIncidentEnergy() const
Definition: CaloG4Hit.h:65
G4ThreeVector posGlobal
Definition: CaloSD.h:112
std::vector< Hit > & getHits(G4Step *aStep, bool &ok)
float edepositHAD
Definition: CaloSD.h:120
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)
int getTrackID() const
Definition: CaloG4Hit.h:68
CaloHitID currentID
Definition: CaloSD.h:116
double getEM() const
Definition: CaloG4Hit.h:59
double zdcHitEnergyCut
Definition: ZdcSD.h:37
math::XYZPoint getEntryLocal() const
Definition: CaloG4Hit.h:53
int setTrackID(G4Step *step)
Definition: ZdcSD.cc:425
void resetForNewPrimary(G4ThreeVector, double)
Definition: CaloSD.cc:443
uint32_t getUnitID() const
Definition: CaloG4Hit.h:69
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:352
G4ThreeVector entrancePoint
Definition: CaloSD.h:110
G4ThreeVector entranceLocal
Definition: CaloSD.h:111
double getHadr() const
Definition: CaloG4Hit.h:62
ZdcShowerLibrary * showerLibrary
Definition: ZdcSD.h:38
void ZdcSD::initRun ( )
protectedvirtual

Reimplemented from CaloSD.

Definition at line 68 of file ZdcSD.cc.

References hits, ZdcShowerLibrary::initRun(), showerLibrary, and useShowerLibrary.

68  {
69  if(useShowerLibrary){
70  G4ParticleTable *theParticleTable = G4ParticleTable::GetParticleTable();
71  showerLibrary->initRun(theParticleTable);
72  }
73  hits.clear();
74 }
std::vector< ZdcShowerLibrary::Hit > hits
Definition: ZdcSD.h:41
void initRun(G4ParticleTable *theParticleTable)
bool useShowerLibrary
Definition: ZdcSD.h:34
ZdcShowerLibrary * showerLibrary
Definition: ZdcSD.h:38
bool ZdcSD::ProcessHits ( G4Step *  step,
G4TouchableHistory *  tHistory 
)
virtual

Reimplemented from CaloSD.

Definition at line 76 of file ZdcSD.cc.

References CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::edepositEM, CaloSD::edepositHAD, getFromLibrary(), CaloSD::getStepInfo(), CaloSD::hitExists(), SensitiveDetector::NaNTrap(), NULL, useShowerHits, and useShowerLibrary.

76  {
77 
78  NaNTrap( aStep ) ;
79 
80  if (aStep == NULL) {
81  return true;
82  } else {
83  if(useShowerLibrary){
84  getFromLibrary(aStep);
85  }
86  if(useShowerHits){
87  if (getStepInfo(aStep)) {
88  if (hitExists() == false && edepositEM+edepositHAD>0.)
90  }
91  }
92  }
93  return true;
94 }
float edepositEM
Definition: CaloSD.h:120
#define NULL
Definition: scimark2.h:8
bool useShowerHits
Definition: ZdcSD.h:34
float edepositHAD
Definition: CaloSD.h:120
CaloG4Hit * currentHit
Definition: CaloSD.h:127
void NaNTrap(G4Step *step)
virtual G4bool getStepInfo(G4Step *aStep)
Definition: CaloSD.cc:247
void getFromLibrary(G4Step *step)
Definition: ZdcSD.cc:96
G4bool hitExists()
Definition: CaloSD.cc:299
bool useShowerLibrary
Definition: ZdcSD.h:34
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:352
uint32_t ZdcSD::setDetUnitId ( G4Step *  step)
virtual

Implements CaloSD.

Definition at line 409 of file ZdcSD.cc.

References ZdcNumberingScheme::getUnitID(), and numberingScheme.

409  {
410  uint32_t returnNumber = 0;
411  if(numberingScheme != 0)returnNumber = numberingScheme->getUnitID(aStep);
412  // edm: return (numberingScheme == 0 ? 0 : numberingScheme->getUnitID(aStep));
413  return returnNumber;
414 }
virtual unsigned int getUnitID(const G4Step *aStep) const
ZdcNumberingScheme * numberingScheme
Definition: ZdcSD.h:39
void ZdcSD::setNumberingScheme ( ZdcNumberingScheme scheme)

Definition at line 416 of file ZdcSD.cc.

References numberingScheme.

Referenced by ZdcSD().

416  {
417  if (scheme != 0) {
418  edm::LogInfo("ForwardSim") << "ZdcSD: updates numbering scheme for "
419  << GetName();
420  if (numberingScheme) delete numberingScheme;
421  numberingScheme = scheme;
422  }
423 }
ZdcNumberingScheme * numberingScheme
Definition: ZdcSD.h:39
int ZdcSD::setTrackID ( G4Step *  step)
private

Definition at line 425 of file ZdcSD.cc.

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

Referenced by getFromLibrary().

425  {
426  theTrack = aStep->GetTrack();
427  double etrack = preStepPoint->GetKineticEnergy();
428  TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
429  int primaryID = trkInfo->getIDonCaloSurface();
430  if (primaryID == 0) {
431 #ifdef DebugLog
432  LogDebug("ZdcSD") << "ZdcSD: Problem with primaryID **** set by force "
433  << "to TkID **** " << theTrack->GetTrackID();
434 #endif
435  primaryID = theTrack->GetTrackID();
436  }
437  if (primaryID != previousID.trackID())
438  resetForNewPrimary(preStepPoint->GetPosition(), etrack);
439  return primaryID;
440 }
#define LogDebug(id)
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

std::vector<ZdcShowerLibrary::Hit> ZdcSD::hits
private

Definition at line 41 of file ZdcSD.h.

Referenced by getFromLibrary(), and initRun().

ZdcNumberingScheme* ZdcSD::numberingScheme
private

Definition at line 39 of file ZdcSD.h.

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

ZdcShowerLibrary* ZdcSD::showerLibrary
private

Definition at line 38 of file ZdcSD.h.

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

double ZdcSD::thFibDir
private

Definition at line 36 of file ZdcSD.h.

Referenced by getEnergyDeposit().

bool ZdcSD::useShowerHits
private

Definition at line 34 of file ZdcSD.h.

Referenced by ProcessHits(), and ZdcSD().

bool ZdcSD::useShowerLibrary
private

Definition at line 34 of file ZdcSD.h.

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

int ZdcSD::verbosity
private

Definition at line 33 of file ZdcSD.h.

Referenced by ZdcSD().

double ZdcSD::zdcHitEnergyCut
private

Definition at line 37 of file ZdcSD.h.

Referenced by getFromLibrary(), and ZdcSD().