LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
OpFastScintillation.cxx
Go to the documentation of this file.
1 // Class adapted for LArSoft by Ben Jones, MIT 10/10/12
2 //
3 // This class is a physics process based on the standard Geant4
4 // scintillation process.
5 //
6 // It has been stripped down and adapted to form the backbone of
7 // the LArG4 fast optical simulation. Photons, instead of being
8 // produced and added to the geant4 particle stack, are logged
9 // and used to predict the visibility of this step to each PMT in
10 // the detector.
11 //
12 // The photonvisibilityservice looks up the visibility of the relevant
13 // xyz point, and if a photon is detected at a given PMT, one OnePhoton
14 // object is logged in the OpDetPhotonTable
15 //
16 // At the end of the event, the OpDetPhotonTable is read out
17 // by LArG4, and detected photons are stored in the event.
18 //
19 // This process can be used alongside the standard Cerenkov process,
20 // which does step geant4 opticalphotons. Both the fast scintillation
21 // table and the geant4 sensitive detectors are read out by LArG4 to
22 // produce a combined SimPhoton collection.
23 //
24 // Added disclaimer : This code is gross. Thats basically because
25 // it adheres to the original, gross Geant4 implementation.
26 //
27 //
28 // ********************************************************************
29 // * License and Disclaimer *
30 // * *
31 // * The Geant4 software is copyright of the Copyright Holders of *
32 // * the Geant4 Collaboration. It is provided under the terms and *
33 // * conditions of the Geant4 Software License, included in the file *
34 // * LICENSE and available at http://cern.ch/geant4/license . These *
35 // * include a list of copyright holders. *
36 // * *
37 // * Neither the authors of this software system, nor their employing *
38 // * institutes,nor the agencies providing financial support for this *
39 // * work make any representation or warranty, express or implied, *
40 // * regarding this software system or assume any liability for its *
41 // * use. Please see the license in the file LICENSE and URL above *
42 // * for the full disclaimer and the limitation of liability. *
43 // * *
44 // * This code implementation is the result of the scientific and *
45 // * technical work of the GEANT4 collaboration. *
46 // * By using, copying, modifying or distributing the software (or *
47 // * any work based on the software) you agree to acknowledge its *
48 // * use in resulting scientific publications, and indicate your *
49 // * acceptance of all terms of the Geant4 Software license. *
50 // ********************************************************************
51 //
52 //
53 // GEANT4 tag $Name: not supported by cvs2svn $
54 //
56 // Scintillation Light Class Implementation
58 //
59 // File: OpFastScintillation.cc
60 // Description: RestDiscrete Process - Generation of Scintillation Photons
61 // Version: 1.0
62 // Created: 1998-11-07
63 // Author: Peter Gumplinger
64 // Updated: 2010-10-20 Allow the scintillation yield to be a function
65 // of energy deposited by particle type
66 // Thanks to Zach Hartwig (Department of Nuclear
67 // Science and Engineeering - MIT)
68 // 2010-09-22 by Peter Gumplinger
69 // > scintillation rise time included, thanks to
70 // > Martin Goettlich/DESY
71 // 2005-08-17 by Peter Gumplinger
72 // > change variable name MeanNumPhotons -> MeanNumberOfPhotons
73 // 2005-07-28 by Peter Gumplinger
74 // > add G4ProcessType to constructor
75 // 2004-08-05 by Peter Gumplinger
76 // > changed StronglyForced back to Forced in GetMeanLifeTime
77 // 2002-11-21 by Peter Gumplinger
78 // > change to use G4Poisson for small MeanNumberOfPhotons
79 // 2002-11-07 by Peter Gumplinger
80 // > now allow for fast and slow scintillation component
81 // 2002-11-05 by Peter Gumplinger
82 // > now use scintillation constants from G4Material
83 // 2002-05-09 by Peter Gumplinger
84 // > use only the PostStepPoint location for the origin of
85 // scintillation photons when energy is lost to the medium
86 // by a neutral particle
87 // 2000-09-18 by Peter Gumplinger
88 // > change: aSecondaryPosition=x0+rand*aStep.GetDeltaPosition();
89 // aSecondaryTrack->SetTouchable(0);
90 // 2001-09-17, migration of Materials to pure STL (mma)
91 // 2003-06-03, V.Ivanchenko fix compilation warnings
92 //
93 // mail: gum@triumf.ca
94 //
96 
97 //#include "Geant4/g4ios.hh"
98 #include "TLorentzVector.h"
99 
100 #include "Geant4/globals.hh"
101 #include "Geant4/G4ParticleTypes.hh"
102 #include "Geant4/G4EmProcessSubType.hh"
103 #include "Geant4/Randomize.hh"
104 #include "Geant4/G4Poisson.hh"
105 #include "Geant4/G4VPhysicalVolume.hh"
106 
107 
120 
123 
125 
126 // support libraries
127 #include "cetlib_except/exception.h"
128 
129 #include "TRandom3.h"
130 #include "TMath.h"
131 #include "boost/algorithm/string.hpp"
132 
133 namespace larg4{
134 
136 // Class Implementation
138 
140  // Operators
142 
143  // OpFastScintillation::operator=(const OpFastScintillation &right)
144  // {
145  // }
146 
148  // Constructors
150 
151  OpFastScintillation::OpFastScintillation(const G4String& processName, G4ProcessType type)
152  : G4VRestDiscreteProcess(processName, type)
153  , bPropagate(!(art::ServiceHandle<sim::LArG4Parameters>()->NoPhotonPropagation()))
154  {
155  G4cout<<"BEA1 timing distribution"<<G4endl;
156  SetProcessSubType(25);
157 
158  fTrackSecondariesFirst = false;
159  fFiniteRiseTime = false;
160 
161 
162  YieldFactor=1.0;
163  ExcitationRatio = 1.0;
164 
165  const detinfo::LArProperties* larp = lar::providerFrom<detinfo::LArPropertiesService>();
166 
168 
169  theFastIntegralTable = NULL;
170  theSlowIntegralTable = NULL;
171 
172  if (verboseLevel>0) {
173  G4cout << GetProcessName() << " is created " << G4endl;
174  }
175 
177 
178  emSaturation = NULL;
179 
180  if (bPropagate) {
182  if(pvs->IncludePropTime()) {
185  }
186  }
187 
188  tpbemission=lar::providerFrom<detinfo::LArPropertiesService>()->TpbEm();
189  const int nbins=tpbemission.size();
190  double * parent=new double[nbins];
191  int ii=0;
192  for( std::map<double, double>::iterator iter = tpbemission.begin(); iter != tpbemission.end(); ++iter)
193  {
194  parent[ii++]=(*iter).second;
195  }
196  rgen0 = new CLHEP::RandGeneral(parent,nbins);
197 
198  }
199 
200 
201 
203  : G4VRestDiscreteProcess(rhs.GetProcessName(), rhs.GetProcessType())
204  {
207 
213  emSaturation = rhs.GetSaturation();
214 
216  }
217 
218 
220  // Destructors
222 
224  {
225  if (theFastIntegralTable != NULL) {
226  theFastIntegralTable->clearAndDestroy();
227  delete theFastIntegralTable;
228  }
229  if (theSlowIntegralTable != NULL) {
230  theSlowIntegralTable->clearAndDestroy();
231  delete theSlowIntegralTable;
232  }
233 
234  }
235 
237  // Methods
239 
240 // AtRestDoIt
241 // ----------
242 //
243  G4VParticleChange*
244  OpFastScintillation::AtRestDoIt(const G4Track& aTrack, const G4Step& aStep)
245 
246  // This routine simply calls the equivalent PostStepDoIt since all the
247  // necessary information resides in aStep.GetTotalEnergyDeposit()
248 
249  {
250  return OpFastScintillation::PostStepDoIt(aTrack, aStep);
251  }
252 
253 // PostStepDoIt
254 // -------------
255 //
256  G4VParticleChange*
257  OpFastScintillation::PostStepDoIt(const G4Track& aTrack, const G4Step& aStep)
258  // This routine is called for each tracking step of a charged particle
259  // in a scintillator. A Poisson/Gauss-distributed number of photons is
260  // generated according to the scintillation yield formula, distributed
261  // evenly along the track segment and uniformly into 4pi.
262 
263  {
264  aParticleChange.Initialize(aTrack);
265 
266  // Check that we are in a material with a properties table, if not
267  // just return
268  const G4Material* aMaterial = aTrack.GetMaterial();
269  G4MaterialPropertiesTable* aMaterialPropertiesTable =
270  aMaterial->GetMaterialPropertiesTable();
271  if (!aMaterialPropertiesTable)
272  return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
273 
274  G4StepPoint* pPreStepPoint = aStep.GetPreStepPoint();
275 
276  G4ThreeVector x0 = pPreStepPoint->GetPosition();
277  G4ThreeVector p0 = aStep.GetDeltaPosition().unit();
278 
279 
281  // This is the old G4 way - but we do things differently - Ben J, Oct Nov 2012.
283  //
284  // if (MeanNumberOfPhotons > 10.)
285  // {
286  // G4double sigma = ResolutionScale * std::sqrt(MeanNumberOfPhotons);
287  // NumPhotons = G4int(G4RandGauss::shoot(MeanNumberOfPhotons,sigma)+0.5);
288  // }
289  // else
290  // {
291  // NumPhotons = G4int(G4Poisson(MeanNumberOfPhotons));
292  // }
293  //
294  //
295  //
296  // if (NumPhotons <= 0)
297  // {
298  // // return unchanged particle and no secondaries
299  //
300  // aParticleChange.SetNumberOfSecondaries(0);
301  //
302  // return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
303  // }
304  //
305  //
306  // aParticleChange.SetNumberOfSecondaries(NumPhotons);
307  //
308  //
309  // if (fTrackSecondariesFirst) {
310  // if (aTrack.GetTrackStatus() == fAlive )
311  // aParticleChange.ProposeTrackStatus(fSuspend);
312  // }
313  //
314  //
315  //
316  //
318  //
319 
320 
322  // The fast sim way - Ben J, Nov 2012
324  //
325  //
326 
327  // We don't want to produce any trackable G4 secondaries
328  aParticleChange.SetNumberOfSecondaries(0);
329 
330 
331  // Retrieve the Scintillation Integral for this material
332  // new G4PhysicsOrderedFreeVector allocated to hold CII's
333 
334 
335  // Some explanation for later improvements to scint yield code:
336  //
337  // What does G4 do here?
338  // It produces light in 2 steps, fast (scnt=1) then slow (scnt=2)
339  //
340  // The ratio of slow photons to fast photons is related by the yieldratio
341  // parameter. G4's poisson fluctuating scheme is a bit different to ours
342  // - we should check that they are equivalent.
343  //
344  // G4 poisson fluctuates the number of initial photons then divides them
345  // with a constant factor between fast + slow, whereas we poisson
346  // fluctuate separateyly the fast and slow detection numbers.
347  //
348 
349  // get the number of photons produced from the IonizationAndScintillation
350  // singleton
353 // double stepEnergy = larg4::IonizationAndScintillation::Instance()->VisibleEnergyDeposit()/CLHEP::MeV;
354  RecordPhotonsProduced(aStep, MeanNumberOfPhotons);//, stepEnergy);
355 
356  if (verboseLevel>0) {
357  G4cout << "\n Exiting from OpFastScintillation::DoIt -- NumberOfSecondaries = "
358  << aParticleChange.GetNumberOfSecondaries() << G4endl;
359  }
360 
361 
362  return G4VRestDiscreteProcess::PostStepDoIt(aTrack, aStep);
363  }
364 
365 
366 //-------------------------------------------------------------
367  void OpFastScintillation::ProcessStep( const G4Step& step)
368  {
369  if(step.GetTotalEnergyDeposit() <= 0) return;
370 
372  (-1,
373  -1,
374  (double)(step.GetTotalEnergyDeposit()/CLHEP::MeV), //energy in MeV
375  (float)(step.GetPreStepPoint()->GetPosition().x()/CLHEP::cm),
376  (float)(step.GetPreStepPoint()->GetPosition().y()/CLHEP::cm),
377  (float)(step.GetPreStepPoint()->GetPosition().z()/CLHEP::cm),
378  (float)(step.GetPostStepPoint()->GetPosition().x()/CLHEP::cm),
379  (float)(step.GetPostStepPoint()->GetPosition().y()/CLHEP::cm),
380  (float)(step.GetPostStepPoint()->GetPosition().z()/CLHEP::cm),
381  (double)(step.GetPreStepPoint()->GetGlobalTime()),
382  (double)(step.GetPostStepPoint()->GetGlobalTime()),
383  //step.GetTrack()->GetTrackID(),
385  step.GetTrack()->GetParticleDefinition()->GetPDGEncoding(),
386  step.GetPreStepPoint()->GetPhysicalVolume()->GetName()
387  );
388  }
389 
390 //-------------------------------------------------------------
391 
392  bool OpFastScintillation::RecordPhotonsProduced(const G4Step& aStep, double MeanNumberOfPhotons)//, double stepEnergy)
393  {
394  // make sure that whatever happens afterwards, the energy deposition is stored
396  if(lgp->FillSimEnergyDeposits())
397  ProcessStep(aStep);
398 
399 
400  // Get the pointer to the fast scintillation table
402 
403  const G4Track * aTrack = aStep.GetTrack();
404 
405  G4StepPoint const* pPreStepPoint = aStep.GetPreStepPoint();
406  // unused G4StepPoint const* pPostStepPoint = aStep.GetPostStepPoint();
407 
408  const G4DynamicParticle* aParticle = aTrack->GetDynamicParticle();
409  const G4Material* aMaterial = aTrack->GetMaterial();
410 
411  G4int materialIndex = aMaterial->GetIndex();
412  G4int tracknumber = aStep.GetTrack()->GetTrackID();
413 
414  G4ThreeVector x0 = pPreStepPoint->GetPosition();
415  G4ThreeVector p0 = aStep.GetDeltaPosition().unit();
416  //G4double t0 = pPreStepPoint->GetGlobalTime() - fGlobalTimeOffset;
417  G4double t0 = pPreStepPoint->GetGlobalTime();
418 
419 
420  G4MaterialPropertiesTable* aMaterialPropertiesTable =
421  aMaterial->GetMaterialPropertiesTable();
422 
423  G4MaterialPropertyVector* Fast_Intensity =
424  aMaterialPropertiesTable->GetProperty("FASTCOMPONENT");
425  G4MaterialPropertyVector* Slow_Intensity =
426  aMaterialPropertiesTable->GetProperty("SLOWCOMPONENT");
427 
428  if (!Fast_Intensity && !Slow_Intensity )
429  return 1;
430 
431  if(!bPropagate)
432  return 0;
433 
434  // Get the visibility vector for this point
436  size_t const NOpChannels = pvs->NOpChannels();
437 
438 
439  G4int nscnt = 1;
440  if (Fast_Intensity && Slow_Intensity) nscnt = 2;
441 
442 
443  double Num = 0;
444  double YieldRatio=0;
445 
446 
448  // The scintillation response is a function of the energy
449  // deposited by particle types.
450 
451  // Get the definition of the current particle
452  G4ParticleDefinition *pDef = aParticle->GetDefinition();
453 
454  // Obtain the G4MaterialPropertyVectory containing the
455  // scintillation light yield as a function of the deposited
456  // energy for the current particle type
457 
458  // Protons
459  if(pDef==G4Proton::ProtonDefinition())
460  {
461  YieldRatio = aMaterialPropertiesTable->
462  GetConstProperty("PROTONYIELDRATIO");
463 
464  }
465 
466  // Muons
467  else if(pDef==G4MuonPlus::MuonPlusDefinition()||pDef==G4MuonMinus::MuonMinusDefinition())
468  {
469  YieldRatio = aMaterialPropertiesTable->
470  GetConstProperty("MUONYIELDRATIO");
471  }
472 
473  // Pions
474  else if(pDef==G4PionPlus::PionPlusDefinition()||pDef==G4PionMinus::PionMinusDefinition())
475  {
476  YieldRatio = aMaterialPropertiesTable->
477  GetConstProperty("PIONYIELDRATIO");
478  }
479 
480  // Kaons
481  else if(pDef==G4KaonPlus::KaonPlusDefinition()||pDef==G4KaonMinus::KaonMinusDefinition())
482  {
483  YieldRatio = aMaterialPropertiesTable->
484  GetConstProperty("KAONYIELDRATIO");
485  }
486 
487  // Alphas
488  else if(pDef==G4Alpha::AlphaDefinition())
489  {
490  YieldRatio = aMaterialPropertiesTable->
491  GetConstProperty("ALPHAYIELDRATIO");
492  }
493 
494  // Electrons (must also account for shell-binding energy
495  // attributed to gamma from standard PhotoElectricEffect)
496  else if(pDef==G4Electron::ElectronDefinition() ||
497  pDef==G4Gamma::GammaDefinition())
498  {
499  YieldRatio = aMaterialPropertiesTable->
500  GetConstProperty("ELECTRONYIELDRATIO");
501  }
502 
503  // Default for particles not enumerated/listed above
504  else
505  {
506  YieldRatio = aMaterialPropertiesTable->
507  GetConstProperty("ELECTRONYIELDRATIO");
508  }
509 
510  // If the user has not specified yields for (p,d,t,a,carbon)
511  // then these unspecified particles will default to the
512  // electron's scintillation yield
513  if(YieldRatio==0){
514  {
515 
516  YieldRatio = aMaterialPropertiesTable->
517  GetConstProperty("ELECTRONYIELDRATIO");
518 
519  }
520  }
521  }
522 
523  double const xyz[3] = { x0[0]/CLHEP::cm, x0[1]/CLHEP::cm, x0[2]/CLHEP::cm };
524  float const* Visibilities = pvs->GetAllVisibilities(xyz);
525 
526  float const* ReflVisibilities = nullptr;
527 
528 
529  // Store timing information in the object for use in propagation_time method
530  if(pvs->StoreReflected()) {
531  ReflVisibilities = pvs->GetAllVisibilities(xyz,true);
532  if(pvs->StoreReflT0())
533  ReflT0s = pvs->GetReflT0s(xyz);
534  }
535  if(pvs->IncludeParPropTime())
536  {
537  ParPropTimeTF1 = pvs->GetTimingTF1(xyz);
538  }
539 
540  /*
541  // For Kazu to debug # photons generated using csv file, by default should be commented out
542  // but don't remove as it's useful. Separated portion of code relevant to this block
543  // is labeled as "CASE-DEBUG DO NOT REMOVE THIS COMMENT"
544  // (2017 May 2nd ... "kazuhiro at nevis dot columbia dot edu")
545  //
546  static bool first_time=false;
547  if(!first_time) {
548  std::cout<<"LOGMEid,pdg,mass,ke,te,de,x,y,z,t,dr,mean_npe,gen_npe,det_npe"<<std::endl;
549  first_time=true;
550  }
551 
552  std::cout<<"LOGME"
553  <<aStep.GetTrack()->GetTrackID()<<","
554  <<aParticle->GetDefinition()->GetPDGEncoding()<<","
555  <<aParticle->GetDefinition()->GetPDGMass()/CLHEP::MeV<<","
556  <<pPreStepPoint->GetKineticEnergy()<<","
557  <<pPreStepPoint->GetTotalEnergy()<<","
558  <<aStep.GetTotalEnergyDeposit()<<","
559  <<xyz[0]<<","<<xyz[1]<<","<<xyz[2]<<","<<t0<<","
560  <<aStep.GetDeltaPosition().mag()<<","
561  <<MeanNumberOfPhotons<<","<<std::flush;
562 
563  double gen_photon_ctr=0;
564  double det_photon_ctr=0;
565  */
566  for (G4int scnt = 1; scnt <= nscnt; scnt++) {
567 
568  G4double ScintillationTime = 0.*CLHEP::ns;
569  G4double ScintillationRiseTime = 0.*CLHEP::ns;
570  G4PhysicsOrderedFreeVector* ScintillationIntegral = NULL;
571 
572  if (scnt == 1) {
573  if (nscnt == 1) {
574  if(Fast_Intensity){
575  ScintillationTime = aMaterialPropertiesTable->
576  GetConstProperty("FASTTIMECONSTANT");
577  if (fFiniteRiseTime) {
578  ScintillationRiseTime = aMaterialPropertiesTable->
579  GetConstProperty("FASTSCINTILLATIONRISETIME");
580  }
581  ScintillationIntegral =
582  (G4PhysicsOrderedFreeVector*)((*theFastIntegralTable)(materialIndex));
583  }
584  if(Slow_Intensity){
585  ScintillationTime = aMaterialPropertiesTable->
586  GetConstProperty("SLOWTIMECONSTANT");
587  if (fFiniteRiseTime) {
588  ScintillationRiseTime = aMaterialPropertiesTable->
589  GetConstProperty("SLOWSCINTILLATIONRISETIME");
590  }
591  ScintillationIntegral =
592  (G4PhysicsOrderedFreeVector*)((*theSlowIntegralTable)(materialIndex));
593  }
594  }//endif nscnt=1
595  else {
596  if(YieldRatio==0)
597  YieldRatio = aMaterialPropertiesTable->
598  GetConstProperty("YIELDRATIO");
599 
600 
601  if ( ExcitationRatio == 1.0 ) {
602  Num = std::min(YieldRatio,1.0)*MeanNumberOfPhotons;
603  }
604  else {
605  Num = std::min(ExcitationRatio,1.0)*MeanNumberOfPhotons;
606  }
607  ScintillationTime = aMaterialPropertiesTable->
608  GetConstProperty("FASTTIMECONSTANT");
609  if (fFiniteRiseTime) {
610  ScintillationRiseTime = aMaterialPropertiesTable->
611  GetConstProperty("FASTSCINTILLATIONRISETIME");
612  }
613  ScintillationIntegral =
614  (G4PhysicsOrderedFreeVector*)((*theFastIntegralTable)(materialIndex));
615  }//endif nscnt!=1
616  }//end scnt=1
617 
618  else {
619  Num = MeanNumberOfPhotons - Num;
620  ScintillationTime = aMaterialPropertiesTable->
621  GetConstProperty("SLOWTIMECONSTANT");
622  if (fFiniteRiseTime) {
623  ScintillationRiseTime = aMaterialPropertiesTable->
624  GetConstProperty("SLOWSCINTILLATIONRISETIME");
625  }
626  ScintillationIntegral =
627  (G4PhysicsOrderedFreeVector*)((*theSlowIntegralTable)(materialIndex));
628  }
629 
630  if (!ScintillationIntegral) continue;
631 
632  //gen_photon_ctr += Num; // CASE-DEBUG DO NOT REMOVE THIS COMMENT
633 
634  // Max Scintillation Integral
635 
636  // G4double CIImax = ScintillationIntegral->GetMaxValue();
637 
638 
639  //std::cout << "++++++++++++" << Num << "++++++++++" << std::endl;
640 
641 
642  // here we go: now if visibilities are invalid, we are in trouble
643  //if (!Visibilities && (NOpChannels > 0)) {
644  // throw cet::exception("OpFastScintillator")
645  // << "Photon library does not cover point ( " << xyz[0] << ", "
646  // << xyz[1] << ", " << xyz[2] << " ) cm.\n";
647  //}
648 
649  if(!Visibilities){
650  }else{
651  std::map<int, int> DetectedNum;
652 
653  std::map<int, int> ReflDetectedNum;
654 
655  for(size_t OpDet=0; OpDet!=NOpChannels; OpDet++)
656  {
657  G4int DetThisPMT = G4int(G4Poisson(Visibilities[OpDet] * Num));
658 
659  if(DetThisPMT>0)
660  {
661  DetectedNum[OpDet]=DetThisPMT;
662  // mf::LogInfo("OpFastScintillation") << "FastScint: " <<
663  // // it->second<<" " << Num << " " << DetThisPMT;
664 
665  //det_photon_ctr += DetThisPMT; // CASE-DEBUG DO NOT REMOVE THIS COMMENT
666  }
667  if(pvs->StoreReflected()) {
668  G4int ReflDetThisPMT = G4int(G4Poisson(ReflVisibilities[OpDet] * Num));
669  if(ReflDetThisPMT>0)
670  {
671  ReflDetectedNum[OpDet]=ReflDetThisPMT;
672  }
673  }
674 
675  }
676 
677 
678  // Now we run through each PMT figuring out num of detected photons
679  for (int Reflected = 0; Reflected <= 1; Reflected++) {
680  // Only do the reflected loop if we have reflected visibilities
681  if (Reflected && !pvs->StoreReflected())
682  continue;
683 
686  if (Reflected) {
687  itstart = ReflDetectedNum.begin();
688  itend = ReflDetectedNum.end();
689  }
690  else{
691  itstart = DetectedNum.begin();
692  itend = DetectedNum.end();
693  }
694 
695  for(std::map<int,int>::const_iterator itdetphot=itstart; itdetphot!=itend; ++itdetphot)
696  {
697  int OpChannel = itdetphot->first;
698  int NPhotons = itdetphot->second;
699 
700  // Set up the OpDetBTR information
701  sim::OpDetBacktrackerRecord tmpOpDetBTRecord(OpChannel);
702  int thisG4TrackID = ParticleListAction::GetCurrentTrackID();
703  double xyzPos[3];
704  average_position(aStep, xyzPos);
705  double Edeposited = larg4::IonizationAndScintillation::Instance()->VisibleEnergyDeposit()/CLHEP::MeV;
706 
707  // Get the transport time distribution
708  std::vector<double> arrival_time_dist = propagation_time(x0, OpChannel, NPhotons, Reflected);
709 
710  // Loop through the photons
711  for (G4int i = 0; i < NPhotons; ++i)
712  {
713  G4double Time = t0
714  + scint_time(aStep, ScintillationTime, ScintillationRiseTime)
715  + arrival_time_dist[i]*CLHEP::ns;
716 
717  // Always store the BTR
718  tmpOpDetBTRecord.AddScintillationPhotons(thisG4TrackID, Time, 1, xyzPos, Edeposited);
719 
720  // Store as lite photon or as OnePhoton
721  if(lgp->UseLitePhotons())
722  {
723  fst->AddLitePhoton(OpChannel, static_cast<int>(Time), 1, Reflected);
724  }
725  else {
726  // The sim photon in this case stores its production point and time
727  TVector3 PhotonPosition( x0[0], x0[1], x0[2] );
728 
729  float PhotonEnergy = 0;
730  if (Reflected) PhotonEnergy = reemission_energy()*CLHEP::eV;
731  else PhotonEnergy = 9.7*CLHEP::eV;
732 
733  // Make a photon object for the collection
734  sim::OnePhoton PhotToAdd;
735  PhotToAdd.InitialPosition = PhotonPosition;
736  PhotToAdd.Energy = PhotonEnergy;
737  PhotToAdd.Time = Time;
738  PhotToAdd.SetInSD = false;
739  PhotToAdd.MotherTrackID = tracknumber;
740 
741  fst->AddPhoton(OpChannel, std::move(PhotToAdd), Reflected);
742  }
743  }
744  fst->AddOpDetBacktrackerRecord(tmpOpDetBTRecord, Reflected);
745  }
746  }
747  }
748  }
749 
750  //std::cout<<gen_photon_ctr<<","<<det_photon_ctr<<std::endl; // CASE-DEBUG DO NOT REMOVE THIS COMMENT
751  return 0;
752  }
753 
754 
755 // BuildThePhysicsTable for the scintillation process
756 // --------------------------------------------------
757 //
758 
760  {
762 
763  const G4MaterialTable* theMaterialTable =
764  G4Material::GetMaterialTable();
765  G4int numOfMaterials = G4Material::GetNumberOfMaterials();
766 
767  // create new physics table
768 
769  if(!theFastIntegralTable)theFastIntegralTable = new G4PhysicsTable(numOfMaterials);
770  if(!theSlowIntegralTable)theSlowIntegralTable = new G4PhysicsTable(numOfMaterials);
771 
772  // loop for materials
773 
774  for (G4int i=0 ; i < numOfMaterials; i++)
775  {
776  G4PhysicsOrderedFreeVector* aPhysicsOrderedFreeVector =
777  new G4PhysicsOrderedFreeVector();
778  G4PhysicsOrderedFreeVector* bPhysicsOrderedFreeVector =
779  new G4PhysicsOrderedFreeVector();
780 
781  // Retrieve vector of scintillation wavelength intensity for
782  // the material from the material's optical properties table.
783 
784  G4Material* aMaterial = (*theMaterialTable)[i];
785 
786  G4MaterialPropertiesTable* aMaterialPropertiesTable =
787  aMaterial->GetMaterialPropertiesTable();
788 
789  if (aMaterialPropertiesTable) {
790 
791  G4MaterialPropertyVector* theFastLightVector =
792  aMaterialPropertiesTable->GetProperty("FASTCOMPONENT");
793 
794  if (theFastLightVector) {
795 
796  // Retrieve the first intensity point in vector
797  // of (photon energy, intensity) pairs
798 
799  G4double currentIN = (*theFastLightVector)[0];
800 
801  if (currentIN >= 0.0) {
802 
803  // Create first (photon energy, Scintillation
804  // Integral pair
805 
806  G4double currentPM = theFastLightVector->Energy(0);
807 
808  G4double currentCII = 0.0;
809 
810  aPhysicsOrderedFreeVector->
811  InsertValues(currentPM , currentCII);
812 
813  // Set previous values to current ones prior to loop
814 
815  G4double prevPM = currentPM;
816  G4double prevCII = currentCII;
817  G4double prevIN = currentIN;
818 
819  // loop over all (photon energy, intensity)
820  // pairs stored for this material
821 
822  for (size_t i = 1;
823  i < theFastLightVector->GetVectorLength();
824  i++)
825  {
826  currentPM = theFastLightVector->Energy(i);
827  currentIN = (*theFastLightVector)[i];
828 
829  currentCII = 0.5 * (prevIN + currentIN);
830 
831  currentCII = prevCII +
832  (currentPM - prevPM) * currentCII;
833 
834  aPhysicsOrderedFreeVector->
835  InsertValues(currentPM, currentCII);
836 
837  prevPM = currentPM;
838  prevCII = currentCII;
839  prevIN = currentIN;
840  }
841 
842  }
843  }
844 
845  G4MaterialPropertyVector* theSlowLightVector =
846  aMaterialPropertiesTable->GetProperty("SLOWCOMPONENT");
847 
848  if (theSlowLightVector) {
849 
850  // Retrieve the first intensity point in vector
851  // of (photon energy, intensity) pairs
852 
853  G4double currentIN = (*theSlowLightVector)[0];
854 
855  if (currentIN >= 0.0) {
856 
857  // Create first (photon energy, Scintillation
858  // Integral pair
859 
860  G4double currentPM = theSlowLightVector->Energy(0);
861 
862  G4double currentCII = 0.0;
863 
864  bPhysicsOrderedFreeVector->
865  InsertValues(currentPM , currentCII);
866 
867  // Set previous values to current ones prior to loop
868 
869  G4double prevPM = currentPM;
870  G4double prevCII = currentCII;
871  G4double prevIN = currentIN;
872 
873  // loop over all (photon energy, intensity)
874  // pairs stored for this material
875 
876  for (size_t i = 1;
877  i < theSlowLightVector->GetVectorLength();
878  i++)
879  {
880  currentPM = theSlowLightVector->Energy(i);
881  currentIN = (*theSlowLightVector)[i];
882 
883  currentCII = 0.5 * (prevIN + currentIN);
884 
885  currentCII = prevCII +
886  (currentPM - prevPM) * currentCII;
887 
888  bPhysicsOrderedFreeVector->
889  InsertValues(currentPM, currentCII);
890 
891  prevPM = currentPM;
892  prevCII = currentCII;
893  prevIN = currentIN;
894  }
895 
896  }
897  }
898  }
899 
900  // The scintillation integral(s) for a given material
901  // will be inserted in the table(s) according to the
902  // position of the material in the material table.
903 
904  theFastIntegralTable->insertAt(i,aPhysicsOrderedFreeVector);
905  theSlowIntegralTable->insertAt(i,bPhysicsOrderedFreeVector);
906 
907  }
908  }
909 
910 // Called by the user to set the scintillation yield as a function
911 // of energy deposited by particle type
912 
914  {
915  if (emSaturation) {
916  G4Exception("OpFastScintillation::SetScintillationByParticleType", "Scint02",
917  JustWarning, "Redefinition: Birks Saturation is replaced by ScintillationByParticleType!");
919  }
920  scintillationByParticleType = scintType;
921  }
922 
923 // GetMeanFreePath
924 // ---------------
925 //
926 
927  G4double OpFastScintillation::GetMeanFreePath(const G4Track&,
928  G4double ,
929  G4ForceCondition* condition)
930  {
931  *condition = StronglyForced;
932 
933  return DBL_MAX;
934 
935  }
936 
937 // GetMeanLifeTime
938 // ---------------
939 //
940 
941  G4double OpFastScintillation::GetMeanLifeTime(const G4Track&,
942  G4ForceCondition* condition)
943  {
944  *condition = Forced;
945 
946  return DBL_MAX;
947 
948  }
949 
950  G4double OpFastScintillation::scint_time(const G4Step& aStep,
951  G4double ScintillationTime,
952  G4double ScintillationRiseTime) const
953  {
954  G4StepPoint const* pPreStepPoint = aStep.GetPreStepPoint();
955  G4StepPoint const* pPostStepPoint = aStep.GetPostStepPoint();
956  G4double avgVelocity = (pPreStepPoint->GetVelocity() + pPostStepPoint->GetVelocity())/2.;
957 
958  G4double deltaTime = aStep.GetStepLength() / avgVelocity;
959 
960  if (ScintillationRiseTime==0.0) {
961  deltaTime = deltaTime -
962  ScintillationTime * std::log( G4UniformRand() );
963  } else {
964  deltaTime = deltaTime +
965  sample_time(ScintillationRiseTime, ScintillationTime);
966  }
967  return deltaTime;
968  }
969 
970 
971  std::vector<double> OpFastScintillation::propagation_time(G4ThreeVector x0, int OpChannel, int NPhotons, bool Reflected) const
972  {
975 
976  // Initialize vector of the right length with all 0's
977  std::vector<double> arrival_time_dist(NPhotons, 0);
978 
979 
980  if (pvs->IncludeParPropTime() && pvs->IncludePropTime()) {
981  throw cet::exception("OpFastScintillation") << "Cannot have both propagation time models simultaneously.";
982  }
983 
984  else if (pvs->IncludeParPropTime() && !(ParPropTimeTF1 && (ParPropTimeTF1[OpChannel].GetNdim()==1)) )
985  {
986  //Warning: TF1::GetNdim()==1 will tell us if the TF1 is really defined or it is the default one.
987  //This will fix a segfault when using timing and interpolation.
988  G4cout << "WARNING: Requested parameterized timing, but no function found. Not applying propagation time." << G4endl;
989  }
990 
991  else if (pvs->IncludeParPropTime()) {
992  if (Reflected)
993  throw cet::exception("OpFastScintillation") << "No parameterized propagation time for reflected light";
994 
995  for (int i = 0; i < NPhotons; i++) {
996  arrival_time_dist[i] = ParPropTimeTF1[OpChannel].GetRandom();
997  }
998  }
999 
1000  else if (pvs->IncludePropTime()) {
1001  // Get VUV photons arrival time distribution from the parametrization
1002  double OpDetCenter[3];
1003  geo->OpDetGeoFromOpDet(OpChannel).GetCenter(OpDetCenter);
1004  G4ThreeVector OpDetPoint(OpDetCenter[0]*CLHEP::cm,OpDetCenter[1]*CLHEP::cm,OpDetCenter[2]*CLHEP::cm);
1005  if (!Reflected) {
1006  double distance_in_cm = (x0 - OpDetPoint).mag()/CLHEP::cm; // this must be in CENTIMETERS!
1007  arrival_time_dist = GetVUVTime(distance_in_cm, NPhotons);//in ns
1008  }
1009  else {
1010  double t0_vis_lib = ReflT0s[OpChannel];
1011  arrival_time_dist = GetVisibleTimeOnlyCathode(t0_vis_lib, NPhotons);
1012  }
1013  }
1014 
1015  return arrival_time_dist;
1016  }
1017 
1018 
1019 
1020 
1021  G4double OpFastScintillation::sample_time(G4double tau1, G4double tau2) const
1022  {
1023 // tau1: rise time and tau2: decay time
1024 
1025  while(1) {
1026  // two random numbers
1027  G4double ran1 = G4UniformRand();
1028  G4double ran2 = G4UniformRand();
1029  //
1030  // exponential distribution as envelope function: very efficient
1031  //
1032  G4double d = (tau1+tau2)/tau2;
1033  // make sure the envelope function is
1034  // always larger than the bi-exponential
1035  G4double t = -1.0*tau2*std::log(1-ran1);
1036  G4double g = d*single_exp(t,tau2);
1037  if (ran2 <= bi_exp(t,tau1,tau2)/g) return t;
1038  }
1039  return -1.0;
1040  }
1041 
1042 
1044  {
1045  return rgen0->fire()*((*(--tpbemission.end())).first-(*tpbemission.begin()).first)+(*tpbemission.begin()).first;
1046  }
1047 
1048 
1049  void OpFastScintillation::average_position(G4Step const& aStep, double *xyzPos) const
1050  {
1051  CLHEP::Hep3Vector prePoint = (aStep.GetPreStepPoint())->GetPosition();
1052  CLHEP::Hep3Vector postPoint = (aStep.GetPostStepPoint())->GetPosition();
1053  xyzPos[0] = ( ( (prePoint.getX() + postPoint.getX() ) / 2.0) / CLHEP::cm );
1054  xyzPos[1] = ( ( (prePoint.getY() + postPoint.getY() ) / 2.0) / CLHEP::cm );
1055  xyzPos[2] = ( ( (prePoint.getZ() + postPoint.getZ() ) / 2.0) / CLHEP::cm );
1056  }
1057 
1058 
1059 
1060 
1061 // ======TIMING PARAMETRIZATION===== //
1062 
1063 // Parametrization of the VUV light timing (result from direct transport + Rayleigh scattering ONLY)
1064 // using a landau + expo function.The function below returns the arrival time distribution given the
1065 // distance IN CENTIMETERS between the scintillation/ionization point and the optical detectotr.
1066  std::vector<double> OpFastScintillation::GetVUVTime(double distance, int number_photons) const {
1067 
1068  //-----Distances in cm and times in ns-----//
1069  //gRandom->SetSeed(0);
1070  std::vector<double> arrival_time_distrb;
1071  arrival_time_distrb.clear();
1072 
1073  // Parametrization data:
1074 
1075  if(distance < 10 || distance > fd_max) {
1076  G4cout<<"WARNING: Parametrization of Direct Light not fully reliable"<<G4endl;
1077  G4cout<<"Too close/far to the PMT -> set 0 VUV photons(?)!!!!!!"<<G4endl;
1078  return arrival_time_distrb;
1079  }
1080  //signals (remember this is transportation) no longer than 1us
1081  const double signal_t_range = 1000.;
1082  const double vuv_vgroup = 10.13;//cm/ns
1083  double t_direct = distance/vuv_vgroup;
1084  // Defining the two functions (Landau + Exponential) describing the timing vs distance
1085  double pars_landau[3] = {functions_vuv[1]->Eval(distance), functions_vuv[2]->Eval(distance),
1086  pow(10.,functions_vuv[0]->Eval(distance))};
1087  if(distance > fd_break) {
1088  pars_landau[0]=functions_vuv[6]->Eval(distance);
1089  pars_landau[1]=functions_vuv[2]->Eval(fd_break);
1090  pars_landau[2]=pow(10.,functions_vuv[5]->Eval(distance));
1091  }
1092  TF1 *flandau = new TF1("flandau","[2]*TMath::Landau(x,[0],[1])",0,signal_t_range/2);
1093  flandau->SetParameters(pars_landau);
1094  double pars_expo[2] = {functions_vuv[3]->Eval(distance), functions_vuv[4]->Eval(distance)};
1095  if(distance > (fd_break - 50.)) {
1096  pars_expo[0] = functions_vuv[7]->Eval(distance);
1097  pars_expo[1] = functions_vuv[4]->Eval(fd_break - 50.);
1098  }
1099  TF1 *fexpo = new TF1("fexpo","expo",0, signal_t_range/2);
1100  fexpo->SetParameters(pars_expo);
1101  //this is to find the intersection point between the two functions:
1102  TF1 *fint = new TF1("fint",finter_d,flandau->GetMaximumX(),3*t_direct,5);
1103  double parsInt[5] = {pars_landau[0], pars_landau[1], pars_landau[2], pars_expo[0], pars_expo[1]};
1104  fint->SetParameters(parsInt);
1105  double t_int = fint->GetMinimumX();
1106  double minVal = fint->Eval(t_int);
1107  //the functions must intersect!!!
1108  if(minVal>0.015)
1109  G4cout<<"WARNING: Parametrization of Direct Light discontinuous (landau + expo)!!!!!!"<<G4endl;
1110 
1111  TF1 *fVUVTiming = new TF1("fTiming",LandauPlusExpoFinal,0,signal_t_range,6);
1112  double parsfinal[6] = {t_int, pars_landau[0], pars_landau[1], pars_landau[2], pars_expo[0], pars_expo[1]};
1113  fVUVTiming->SetParameters(parsfinal);
1114  // Set the number of points used to sample the function
1115 
1116  int f_sampling = 1000;
1117  if(distance < 50)
1118  f_sampling *= ftf1_sampling_factor;
1119  fVUVTiming->SetNpx(f_sampling);
1120 
1121  for(int i=0; i<number_photons; i++)
1122  arrival_time_distrb.push_back(fVUVTiming->GetRandom());
1123 
1124  //deleting ...
1125  delete flandau;
1126  delete fexpo;
1127  delete fint;
1128  delete fVUVTiming;
1129  G4cout<<"BEAMAUS timing distribution hecha"<<G4endl;
1130  return arrival_time_distrb;
1131  }
1132 
1133 // Parametrization of the Visible light timing (result from direct transport + Rayleigh scattering ONLY)
1134 // using a landau + exponential function. The function below returns the arrival time distribution given the
1135 // time of the first visible photon in the PMT. The light generated has been reflected by the cathode ONLY.
1136  std::vector<double> OpFastScintillation::GetVisibleTimeOnlyCathode(double t0, int number_photons) const{
1137  //-----Distances in cm and times in ns-----//
1138  //gRandom->SetSeed(0);
1139 
1140  std::vector<double> arrival_time_distrb;
1141  arrival_time_distrb.clear();
1142  // Parametrization data:
1143 
1144  if(t0 < 8 || t0 > ft0_max) {
1145  G4cout<<"WARNING: Parametrization of Cathode-Only reflected Light not fully reliable"<<G4endl;
1146  G4cout<<"Too close/far to the PMT -> set 0 Visible photons(?)!!!!!!"<<G4endl;
1147  return arrival_time_distrb;
1148  }
1149  //signals (remember this is transportation) no longer than 1us
1150  const double signal_t_range = 1000.;
1151  double pars_landau[3] = {functions_vis[1]->Eval(t0), functions_vis[2]->Eval(t0),
1152  pow(10.,functions_vis[0]->Eval(t0))};
1153  double pars_expo[2] = {functions_vis[3]->Eval(t0), functions_vis[4]->Eval(t0)};
1154  if(t0 > ft0_break_point) {
1155  pars_landau[0] = -0.798934 + 1.06216*t0;
1156  pars_landau[1] = functions_vis[2]->Eval(ft0_break_point);
1157  pars_landau[2] = pow(10.,functions_vis[0]->Eval(ft0_break_point));
1158  pars_expo[0] = functions_vis[3]->Eval(ft0_break_point);
1159  pars_expo[1] = functions_vis[4]->Eval(ft0_break_point);
1160  }
1161 
1162  // Defining the two functions (Landau + Exponential) describing the timing vs t0
1163  TF1 *flandau = new TF1("flandau","[2]*TMath::Landau(x,[0],[1])",0,signal_t_range/2);
1164  flandau->SetParameters(pars_landau);
1165  TF1 *fexpo = new TF1("fexpo","expo",0, signal_t_range/2);
1166  fexpo->SetParameters(pars_expo);
1167  //this is to find the intersection point between the two functions:
1168  TF1 *fint = new TF1("fint",finter_d,flandau->GetMaximumX(),2*t0,5);
1169  double parsInt[5] = {pars_landau[0], pars_landau[1], pars_landau[2], pars_expo[0], pars_expo[1]};
1170  fint->SetParameters(parsInt);
1171  double t_int = fint->GetMinimumX();
1172  double minVal = fint->Eval(t_int);
1173  //the functions must intersect!!!
1174  if(minVal>0.015)
1175  G4cout<<"WARNING: Parametrization of Direct Light discontinuous (landau + expo)!!!!!!"<<G4endl;
1176 
1177  TF1 *fVisTiming = new TF1("fTiming",LandauPlusExpoFinal,0,signal_t_range,6);
1178  double parsfinal[6] = {t_int, pars_landau[0], pars_landau[1], pars_landau[2], pars_expo[0], pars_expo[1]};
1179  fVisTiming->SetParameters(parsfinal);
1180  // Set the number of points used to sample the function
1181 
1182  int f_sampling = 1000;
1183  if(t0 < 20)
1184  f_sampling *= ftf1_sampling_factor;
1185  fVisTiming->SetNpx(f_sampling);
1186 
1187  for(int i=0; i<number_photons; i++)
1188  arrival_time_distrb.push_back(fVisTiming->GetRandom());
1189 
1190  //deleting ...
1191 
1192  delete flandau;
1193  delete fexpo;
1194  delete fint;
1195  delete fVisTiming;
1196  G4cout<<"Timing distribution BEAMAUS!"<<G4endl;
1197  return arrival_time_distrb;
1198  }
1199 
1200  double finter_d(double *x, double *par) {
1201 
1202  double y1 = par[2]*TMath::Landau(x[0],par[0],par[1]);
1203  double y2 = TMath::Exp(par[3]+x[0]*par[4]);
1204 
1205  return TMath::Abs(y1 - y2);
1206  }
1207  double LandauPlusExpoFinal(double *x, double *par)
1208  {
1209  // par0 = joining point
1210  // par1 = Landau MPV
1211  // par2 = Landau widt
1212  // par3 = normalization
1213  // par4 = Expo cte
1214  // par5 = Expo tau
1215  double y1 = par[3]*TMath::Landau(x[0],par[1],par[2]);
1216  double y2 = TMath::Exp(par[4]+x[0]*par[5]);
1217  if(x[0] > par[0]) y1 = 0.;
1218  if(x[0] < par[0]) y2 = 0.;
1219 
1220  return (y1 + y2);
1221  }
1222 
1223 
1224  double finter_r(double *x, double *par) {
1225 
1226  double y1 = par[2]*TMath::Landau(x[0],par[0],par[1]);
1227  double y2 = par[5]*TMath::Landau(x[0],par[3],par[4]);
1228 
1229  return TMath::Abs(y1 - y2);
1230  }
1231 
1232 
1233 
1234 }
Float_t x
Definition: compare.C:6
code to link reconstructed objects back to the MC truth information
Store parameters for running LArG4.
G4PhysicsTable * GetSlowIntegralTable() const
G4EmSaturation * GetSaturation() const
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Number of OpDets in the whole detector.
void average_position(G4Step const &aStep, double *xzyPos) const
G4double sample_time(G4double tau1, G4double tau2) const
Encapsulate the construction of a single cyostat.
void SetDirectLightPropFunctions(TF1 const *functions[8], double &d_break, double &d_max, double &tf1_sampling_factor) const
Float_t y1[n_points_granero]
Definition: compare.C:5
G4double GetScintillationExcitationRatio() const
intermediate_table::iterator iterator
G4bool GetTrackSecondariesFirst() const
void AddEnergyDeposit(int n_elec, int n_photon, double energy, float start_x, float start_y, float start_z, float end_x, float end_y, float end_z, double start_time, double end_time, int trackid, int pdgcode, std::string const &vol="EMPTY")
std::vector< double > propagation_time(G4ThreeVector x0, int OpChannel, int NPhotons, bool Reflected=false) const
Geant4 interface.
void ProcessStep(const G4Step &step)
void GetCenter(double *xyz, double localz=0.0) const
Definition: OpDetGeo.cxx:47
double finter_d(double *x, double *par)
double finter_r(double *x, double *par)
G4double scint_time(const G4Step &aStep, G4double ScintillationTime, G4double ScintillationRiseTime) const
std::map< double, double > tpbemission
Energy deposited on a readout Optical Detector by simulated tracks.
OpFastScintillation(const G4String &processName="Scintillation", G4ProcessType type=fElectromagnetic)
Float_t y2[n_points_geant4]
Definition: compare.C:26
void SetReflectedCOLightPropFunctions(TF1 const *functions[5], double &t0_max, double &t0_break_point) const
G4double bi_exp(G4double t, G4double tau1, G4double tau2) const
virtual G4VParticleChange * AtRestDoIt(const G4Track &aTrack, const G4Step &aStep)
contains objects relating to OpDet hits
Use Geant4&#39;s user "hooks" to maintain a list of particles generated by Geant4.
intermediate_table::const_iterator const_iterator
float const * GetAllVisibilities(double const *xyz, bool wantReflected=false) const
void AddPhoton(size_t opchannel, sim::OnePhoton &&photon, bool Reflected=false)
void SetScintillationByParticleType(const G4bool)
bool RecordPhotonsProduced(const G4Step &aStep, double N)
TF1 * GetTimingTF1(double const *xyz) const
static IonizationAndScintillation * Instance()
G4double single_exp(G4double t, G4double tau2) const
bool FillSimEnergyDeposits() const
Float_t d
Definition: plot.C:237
G4PhysicsTable * GetFastIntegralTable() const
void AddOpDetBacktrackerRecord(sim::OpDetBacktrackerRecord soc, bool Reflected=false)
std::vector< double > GetVisibleTimeOnlyCathode(double, int) const
void AddLitePhoton(int opchannel, int time, int nphotons, bool Reflected=false)
G4bool GetScintillationByParticleType() const
Monte Carlo Simulation.
void AddScintillationPhotons(TrackID_t trackID, timePDclock_t timePDclock, double numberPhotons, double const *xyz, double energy)
Add scintillation photons and energy to this OpticalDetector.
std::vector< double > GetVUVTime(double, int) const
Encapsulate the geometry of an optical detector.
static OpDetPhotonTable * Instance(bool LitePhotons=false)
bool bPropagate
Whether propagation of photons is enabled.
TVector3 InitialPosition
Definition: SimPhotons.h:49
Int_t min
Definition: plot.C:26
Singleton to access a unified treatment of ionization and scintillation in LAr.
contains information for a single step in the detector simulation
virtual G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
HLT enums.
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
G4double GetMeanLifeTime(const G4Track &aTrack, G4ForceCondition *)
virtual bool ScintByParticleType() const =0
Namespace collecting geometry-related classes utilities.
G4double GetScintillationYieldFactor() const
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
bool UseLitePhotons() const
double LandauPlusExpoFinal(double *x, double *par)
float const * GetReflT0s(double const *xyz) const