Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
photrans::ImprovedTransport Class Reference

a class for transporting photons in a roughly realistic way More...

Inheritance diagram for photrans::ImprovedTransport:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 ImprovedTransport (fhicl::ParameterSet const &pset)
 
virtual ~ImprovedTransport ()
 
void beginRun (art::Run &run)
 
void produce (art::Event &evt)
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

double FiberTransmission (double x)
 
double ScintTime (double dEdx)
 
bool LoadHistos ()
 
void StepAlongHit (sim::FLSHit &hit)
 
void CreatePhotoElectrons (double meanPE, double stepTime, double dist, double dEdx, bool isScint, RateInfo &info, double &lambda)
 
void ClusterPhotoElectrons (int planeId, int cellId, int trackId)
 
double GetPosCorr (const sim::FLSHit &hit)
 
CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

void SetPosCorrMapIndex (const std::vector< TH2D * > *const maps, const unsigned int i)
 
void LoadPosCorrHists ()
 Reads in the efficiency maps from fPosCorrFile. More...
 

Private Attributes

std::string fFilterModuleLabel
 module that filtered the fls hits More...
 
fhicl::ParameterSet fPSetNDOS
 
fhicl::ParameterSet fPSetND
 
fhicl::ParameterSet fPSetFD
 
fhicl::ParameterSet fPSetTB
 
double fPhotonsPerMeV
 blue photon production scale More...
 
double fXViewFactor
 scale factor for the x-view More...
 
double fYViewFactor
 scale factor for the y-view More...
 
double fLightLevelScale
 shift overall light yield by multiplicative factor More...
 
double fCerenkovEff
 Absorption and re-emission efficiency for Cerenkov photons. More...
 
double fQuantumEff
 APD quantum efficiency. More...
 
double fFiberIndexOfRefraction
 n for fiber core More...
 
double fEmissionTau
 exponential time constant for green photon emission More...
 
std::vector< double > fAttenPars
 from Leon's fit More...
 
double fTimeClustering
 groups photons closer than this many ns apart More...
 
bool fWriteEmptySignals
 Write an empty PhotonSignal if there's 0 PE. More...
 
double fStep
 step size for walking along the track (cm) More...
 
bool fApplyBirks
 Use EdepBirks from FLSHits instead of calculating here. More...
 
std::string fCollectionRateFile
 Relative path to the collection rate histo file. More...
 
bool fApplyFiberSmearing
 Turn on fiber smearing. More...
 
std::string fSmearingHistoFile
 Relative path to the fiber smearing histo file. More...
 
std::string fBrightnessMode
 correct the fiber brightness by cell, by module, or not at all More...
 
std::string fBrightnessFile
 Relative path to the brightness correction file. More...
 
bool fApplyTweak
 Turn on the data driven attenuation correction for each view. More...
 
std::string fTweakFile
 Relative path to the data driven attenuation correction for each view. More...
 
bool fSimulateDrift
 whether to vary light level as a function of time More...
 
int fDriftReference
 drift reference time (ie. where the slope is fixed to 1) More...
 
double fDriftGradient
 gradient for light level detector aging systematic [fraction/year] More...
 
bool fUseScintTime
 Turn on sampling from PDF of scintillator decay time, see arXiv:1704.02291 for more details. More...
 
double fCherenkovTau
 Time constant for directly excited PC to PPO scintillation. More...
 
double fScintBetaDEDX
 Approximate dE/dx of betas used to determine PDF. More...
 
std::vector< double > fScintBetaProb
 Cumulative probability for each exponential component for betas. More...
 
std::vector< double > fScintBetaTau
 Time constants of each exponential component for betas. More...
 
double fScintAlphaDEDX
 Approximate dE/dx of alphas used to determine PDF. More...
 
std::vector< double > fScintAlphaProb
 Cumulative probability for each exponential component for alphas. More...
 
std::vector< double > fScintAlphaTau
 Time constants of each exponential component for alphas. More...
 
std::string fPosCorrFile
 
int msglevel
 
double fFiberSpeedOfLight
 Speed of light in the fiber. More...
 
TH2D fCollectionRateHisto
 Collection rate for given dT vs. dZ. More...
 
TH1D fFiberSmearingHisto
 Smearing histo for photons bouncing around in fiber. More...
 
TH1D fTweak_X
 A data/mc correction for the X-View. More...
 
TH1D fTweak_Y
 A data/mc correction for the Y-View. More...
 
TH1D fTweak_XMC
 A data/mc correction for the X-View in the muon catcher. More...
 
TH1D fTweak_YMC
 A data/mc correction for the Y-View in the muon catcher. More...
 
std::vector< std::vector< double > > fBrightnessMap
 The brightness correction by cell. More...
 
std::string fBrightnessMapName
 
std::string fBrightnessValueName
 
std::string fBrightnessValueMapName
 
BrightnessLevelfBrightnessLevel
 
std::vector< TH2D * > fBigHorizMap
 
std::vector< TH2D * > fBigHorizClumpMap
 
std::vector< TH2D * > fSmallHorizMap
 
std::vector< TH2D * > fSmallHorizClumpMap
 
std::vector< TH2D * > fSmallHorizBubbleMap
 
std::vector< TH2D * > fSmallHorizBubbleClumpMap
 
std::vector< TH2D * > fBigVertMap
 
std::vector< TH2D * > fBigVertCornerMap
 
std::vector< TH2D * > fSmallVertMap
 
std::vector< TH2D * > fSmallVertCornerMap
 
uint16_t fPosCorrMapIndex = -1
 
TRandom3 fPosCorrHasher
 
uint64_t fPosCorrEvtId
 
art::ServiceHandle< geo::GeometryfGeo
 Handle to the geometry service. More...
 
std::list< double > fPETimes
 List of photo-electron times (each representing one observed PE) More...
 
std::list< RateInfofRateInfo
 List of RateInfo object. More...
 
std::unique_ptr< std::vector< sim::PhotonSignal > > fSignals
 Produced vector of PhotonSignals. More...
 
CLHEP::RandPoissonQfPoisson
 
CLHEP::RandFlatfFlat
 
RandHistofRandHisto
 
CLHEP::RandGaussQfGauss
 
CLHEP::RandExponentialfExp
 
bool fFirstTime
 
TH1D * fScintTime
 

Detailed Description

a class for transporting photons in a roughly realistic way

Definition at line 65 of file ImprovedTransport_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

photrans::ImprovedTransport::ImprovedTransport ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 211 of file ImprovedTransport_module.cc.

References art::EngineCreator::createEngine(), fExp, fFlat, fGauss, fPoisson, fRandHisto, fhicl::ParameterSet::get(), art::RandomNumberGenerator::getEngine(), sim::GetRandomNumberSeed(), art::EngineCreator::rng(), and seed.

212  : fFilterModuleLabel (pset.get< std::string>("FilterModuleLabel"))
213  , fPSetNDOS (pset.get<fhicl::ParameterSet>("ndos"))
214  , fPSetND (pset.get<fhicl::ParameterSet>("nd"))
215  , fPSetFD (pset.get<fhicl::ParameterSet>("fd"))
216  , fPSetTB (pset.get<fhicl::ParameterSet>("tb"))
217  , fSignals (new std::vector<sim::PhotonSignal>)
218  , fFirstTime(true)
219  {
220  // get the random number seed, use a random default if not specified
221  // in the configuration file.
222  unsigned int seed = pset.get< unsigned int >("Seed", sim::GetRandomNumberSeed());
223 
224  createEngine( seed );
225 
226  // get the RandomNumberGenerator service
228  CLHEP::HepRandomEngine &engine = rng->getEngine();
229  fPoisson = new CLHEP::RandPoissonQ(engine);
230  fFlat = new CLHEP::RandFlat(engine);
231  fRandHisto = new RandHisto(engine);
232  fGauss = new CLHEP::RandGaussQ(engine);
233  fExp = new CLHEP::RandExponential(engine);
234 
235  produces< std::vector<sim::PhotonSignal> >();
236  //Add by Pengfei -- begin
237  produces<BrightnessLevel, art::InRun> ();
238  //Add by Pengfei -- end
239  }
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
base_engine_t & createEngine(seed_t seed)
std::unique_ptr< std::vector< sim::PhotonSignal > > fSignals
Produced vector of PhotonSignals.
base_engine_t & getEngine() const
unsigned int seed
Definition: runWimpSim.h:102
unsigned int GetRandomNumberSeed()
Definition: Simulation.cxx:13
std::string fFilterModuleLabel
module that filtered the fls hits
enum BeamMode string
photrans::ImprovedTransport::~ImprovedTransport ( )
virtual

Definition at line 242 of file ImprovedTransport_module.cc.

References fFlat, fGauss, fPoisson, and fRandHisto.

243  {
244  delete fPoisson;
245  delete fFlat;
246  delete fRandHisto;
247  delete fGauss;
248  }

Member Function Documentation

void photrans::ImprovedTransport::beginRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 250 of file ImprovedTransport_module.cc.

References ana::assert(), plot_validation_datamc::c, om::cout, geo::GeometryBase::DetId(), e, fApplyBirks, fApplyFiberSmearing, fApplyTweak, fAttenPars, fBrightnessFile, fBrightnessMapName, fBrightnessMode, fBrightnessValueMapName, fBrightnessValueName, fCerenkovEff, fCherenkovTau, fCollectionRateFile, fDriftGradient, fDriftReference, fEmissionTau, fFiberIndexOfRefraction, fFiberSpeedOfLight, fFirstTime, fLightLevelScale, fPhotonsPerMeV, fPosCorrFile, fPSetFD, fPSetND, fPSetNDOS, fPSetTB, fQuantumEff, fScintAlphaDEDX, fScintAlphaProb, fScintAlphaTau, fScintBetaDEDX, fScintBetaProb, fScintBetaTau, fScintTime, fSimulateDrift, fSmearingHistoFile, fStep, fTimeClustering, fTweakFile, fUseScintTime, fWriteEmptySignals, fXViewFactor, fYViewFactor, geom(), novadaq::cnv::kFARDET, novadaq::cnv::kNDOS, novadaq::cnv::kNEARDET, novadaq::cnv::kTESTBEAM, LoadHistos(), art::TFileDirectory::make(), msglevel, art::Run::put(), and string.

251  {
252  if (fFirstTime) {
254  fScintTime = tfs->make<TH1D>("hScintTime", ";time;photons", 1000, 0, 5000);
255 
256  // Figure out which parameter set we're using
257  fhicl::ParameterSet pset;
259  switch(geom->DetId()){
260  case novadaq::cnv::kNDOS:
261  pset = fPSetNDOS;
262  break;
264  pset = fPSetND;
265  break;
267  pset = fPSetFD;
268  break;
270  pset = fPSetTB;
271  break;
272  default:
273  assert(0 && "Unknown detector");
274  }
275 
276  fPhotonsPerMeV = pset.get< double >("PhotonsPerMeV");
277  fXViewFactor = pset.get< double >("XViewFactor");
278  fYViewFactor = pset.get< double >("YViewFactor");
279  fLightLevelScale = pset.get< double >("LightLevelScale");
280  fCerenkovEff = pset.get< double >("CerenkovEff");
281  fQuantumEff = pset.get< double >("QuantumEff");
282  fFiberIndexOfRefraction = pset.get< double >("FiberIndexOfRefraction");
283  fEmissionTau = pset.get< double >("EmissionTau");
284  fAttenPars = pset.get< std::vector<double> >("AttenPars");
285  fTimeClustering = pset.get< double >("TimeClustering");
286  fWriteEmptySignals = pset.get< bool >("WriteEmptySignals");
287  fStep = pset.get< double >("Step");
288  fApplyBirks = pset.get< bool >("ApplyBirks");
289  fCollectionRateFile = pset.get< std::string >("CollectionRateFile");
290  fSmearingHistoFile = pset.get< std::string >("SmearingHistoFile");
291  fBrightnessFile = pset.get< std::string >("BrightnessFile");
292  fBrightnessMode = pset.get< std::string >("BrightnessMode");
293  fUseScintTime = pset.get< bool >("UseScintTime");
294  fCherenkovTau = pset.get< double >("CherenkovTau");
295  fScintBetaDEDX = pset.get< double >("ScintBetaDEDX");
296  fScintBetaProb = pset.get< std::vector<double> >("ScintBetaProb");
297  fScintBetaTau = pset.get< std::vector<double> >("ScintBetaTau");
298  fScintAlphaDEDX = pset.get< double >("ScintAlphaDEDX");
299  fScintAlphaProb = pset.get< std::vector<double> >("ScintAlphaProb");
300  fScintAlphaTau = pset.get< std::vector<double> >("ScintAlphaTau");
301  //Add by Pengfei -- begin
302  fBrightnessMapName = pset.get< std::string >("BrightnessMapName");
303  fBrightnessValueName = pset.get< std::string >("BrightnessValueName");
304  fBrightnessValueMapName = pset.get< std::string >("BrightnessValueMapName");
305  //Add by Pengfei -- end
306  fApplyTweak = pset.get< bool >("ApplyTweak");
307  fTweakFile = pset.get< std::string >("TweakFile");
308  fSimulateDrift = pset.get< bool >("SimulateDrift");
309  fDriftReference = pset.get< int >("DriftReference");
310  fDriftGradient = pset.get< double >("DriftGradient");
311  fPosCorrFile = pset.get< std::string >("PosCorrFile");
312  fApplyFiberSmearing = pset.get< bool >("ApplyFiberSmearing");
313  msglevel = pset.get< int >("MessageLevel");
314 
315  // constructor decides if initialized value is a path or an environment variable
316  cet::search_path sp("FW_SEARCH_PATH");
317 
318  const double c = TMath::Ccgs()*1e-9; // c in cm/ns
320 
321  sp.find_file(pset.get< std::string >("CollectionRateFile"), fCollectionRateFile);
322  // Check the collection rate file
323  struct stat sb;
324  if ( fCollectionRateFile.empty() || stat(fCollectionRateFile.c_str(), &sb)!=0 ){
325  // failed to resolve the file name
326  throw cet::exception("NoCollectionRateFile") << "collection rate file " << fCollectionRateFile << " not found!\n" << __FILE__ << ":" << __LINE__ << "\n";
327  }
328 
329  sp.find_file(pset.get< std::string >("SmearingHistoFile"), fSmearingHistoFile);
330  if ( fSmearingHistoFile.empty() || stat(fSmearingHistoFile.c_str(), &sb)!=0 ){
331  // failed to resolve the file name
332  throw cet::exception("NoSmearingHistoFile") << "smearing histo file " << fSmearingHistoFile << " not found!\n" << __FILE__ << ":" << __LINE__ << "\n";
333  }
334 
335  if (fBrightnessMode != "None") {
336  fBrightnessFile = pset.get< std::string >("BrightnessFile");
337  sp.find_file(pset.get< std::string >("BrightnessFile"), fBrightnessFile);
338  if ( fBrightnessFile.empty() || stat(fBrightnessFile.c_str(), &sb)!=0 ){
339  // failed to resolve the file name
340  throw cet::exception("NoBrightnessFile") << "fiber brightness histo file " << fBrightnessFile << " not found!\n" << __FILE__ << ":" << __LINE__ << "\n";
341  }
342  }
343 
344  if (fApplyTweak) {
345  sp.find_file(pset.get< std::string >("TweakFile"), fTweakFile);
346  if ( fTweakFile.empty() || stat(fTweakFile.c_str(), &sb)!=0 ) {
347  // failed to resolve the file name
348  throw cet::exception("NoTweakFile") << "tweak file " << fTweakFile << " not found!\n" << __FILE__ << ":" << __LINE__ << "\n";
349  }
350  }
351 
352  sp.find_file(pset.get< std::string >("PosCorrFile"), fPosCorrFile);
353  if(fPosCorrFile.empty()){
354  if(msglevel >= 10)
355  std::cout << "Fiber position efficiency correction disabled\n";
356  }
357  else{
358  if(stat(fPosCorrFile.c_str(), &sb) != 0)
359  throw cet::exception("NoPosCorrFile") << "Efficiency map file "
360  << fPosCorrFile << " not found!\n" << __FILE__ << ":" << __LINE__
361  << "\n";
362  }
363 
364  if ( !LoadHistos() )
365  {
366  throw cet::exception("NoCollectionRateHisto")
367  << "can't load histos\n"
368  << __FILE__ << ":" << __LINE__ << "\n";
369  return;
370  }
371 
372  //Add by Pengfei -- begin
373  if (fBrightnessMode == "ByCell"){
374  std::unique_ptr<BrightnessLevel> pfb(new BrightnessLevel(fBrightnessFile, fBrightnessMapName, fBrightnessValueName,fBrightnessValueMapName));
375  run.put(std::move(pfb));
376  }
377  else if (fBrightnessMode == "ByBin"){
378  std::unique_ptr<BrightnessLevel> pfb(new BrightnessLevel(fBrightnessFile, fBrightnessMapName, fBrightnessValueName));
379  run.put(std::move(pfb));
380  }
381  //Add by Pengfei -- end
382 
383  //don't reinitialize after the first time through
384  fFirstTime = false;
385  }
386  }
double fCerenkovEff
Absorption and re-emission efficiency for Cerenkov photons.
bool fApplyFiberSmearing
Turn on fiber smearing.
bool fApplyTweak
Turn on the data driven attenuation correction for each view.
double fStep
step size for walking along the track (cm)
std::string fCollectionRateFile
Relative path to the collection rate histo file.
double fYViewFactor
scale factor for the y-view
double fXViewFactor
scale factor for the x-view
double fTimeClustering
groups photons closer than this many ns apart
double fLightLevelScale
shift overall light yield by multiplicative factor
bool fWriteEmptySignals
Write an empty PhotonSignal if there&#39;s 0 PE.
double fFiberSpeedOfLight
Speed of light in the fiber.
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:149
double fFiberIndexOfRefraction
n for fiber core
double fScintBetaDEDX
Approximate dE/dx of betas used to determine PDF.
double fCherenkovTau
Time constant for directly excited PC to PPO scintillation.
std::vector< double > fScintAlphaTau
Time constants of each exponential component for alphas.
std::vector< double > fAttenPars
from Leon&#39;s fit
Far Detector at Ash River, MN.
std::vector< double > fScintBetaProb
Cumulative probability for each exponential component for betas.
double fDriftGradient
gradient for light level detector aging systematic [fraction/year]
Prototype Near Detector on the surface at FNAL.
std::string fBrightnessMode
correct the fiber brightness by cell, by module, or not at all
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
Near Detector in the NuMI cavern.
std::string fTweakFile
Relative path to the data driven attenuation correction for each view.
bool fSimulateDrift
whether to vary light level as a function of time
double fEmissionTau
exponential time constant for green photon emission
OStream cout
Definition: OStream.cxx:6
double fScintAlphaDEDX
Approximate dE/dx of alphas used to determine PDF.
bool fUseScintTime
Turn on sampling from PDF of scintillator decay time, see arXiv:1704.02291 for more details...
bool fApplyBirks
Use EdepBirks from FLSHits instead of calculating here.
T * make(ARGS...args) const
std::vector< double > fScintAlphaProb
Cumulative probability for each exponential component for alphas.
std::vector< double > fScintBetaTau
Time constants of each exponential component for betas.
void geom(int which=0)
Definition: geom.C:163
std::string fSmearingHistoFile
Relative path to the fiber smearing histo file.
assert(nhit_max >=nhit_nbins)
double fPhotonsPerMeV
blue photon production scale
std::string fBrightnessFile
Relative path to the brightness correction file.
double fQuantumEff
APD quantum efficiency.
Float_t e
Definition: plot.C:35
int fDriftReference
drift reference time (ie. where the slope is fixed to 1)
enum BeamMode string
void photrans::ImprovedTransport::ClusterPhotoElectrons ( int  planeId,
int  cellId,
int  trackId 
)
protected

Definition at line 903 of file ImprovedTransport_module.cc.

References stan::math::fabs(), fPETimes, fSignals, fTimeClustering, it, sim::PhotonSignal::SetNPhoton(), sim::PhotonSignal::SetPlaneCell(), sim::PhotonSignal::SetTimeMean(), and sim::PhotonSignal::SetTrackId().

Referenced by StepAlongHit().

904  {
905  if (fPETimes.empty()) return;
906  //cluster photons into PhotonSignals fTimeClustering long
907 
908  sim::PhotonSignal photon;
909  photon.SetPlaneCell(planeId, cellId);
910  photon.SetTrackId(trackId);
911 
912  // TODO: Would like to record which map is used, but having trouble
913  // getting it to work.
914  // photon.SetPosCorrI(fPosCorrFile.empty()?-1:fPosCorrMapIndex);
915 
916  double meanTime(0);
917  int nPE(0);
918 
919  fPETimes.sort();
920  std::list< double >::iterator it;
921  for (it = fPETimes.begin(); it != fPETimes.end(); ++it) {
922  double currTime = *it;
923  if (nPE == 0) {
924  meanTime = currTime;
925  nPE = 1;
926  }
927  else if ( fabs(meanTime - currTime) < fTimeClustering ) {
928  //add to cluster
929  meanTime = meanTime*nPE + currTime;
930  ++nPE;
931  meanTime /= nPE;
932  }
933  else {
934  photon.SetTimeMean(meanTime);
935  photon.SetNPhoton(nPE);
936  fSignals->push_back(photon);
937 
938  //Set variables with current iteration
939  nPE = 1;
940  meanTime = currTime;
941  }
942  }
943  //there is one PhotonSignal that hasn't been saved yet
944  photon.SetTimeMean(meanTime);
945  photon.SetNPhoton(nPE);
946  fSignals->push_back(photon);
947 
948  return;
949  }
void SetTrackId(int t)
Definition: PhotonSignal.h:25
set< int >::iterator it
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
double fTimeClustering
groups photons closer than this many ns apart
void SetPlaneCell(int plane, int cell)
Definition: PhotonSignal.h:24
std::unique_ptr< std::vector< sim::PhotonSignal > > fSignals
Produced vector of PhotonSignals.
void SetNPhoton(int npe)
Definition: PhotonSignal.h:23
std::list< double > fPETimes
List of photo-electron times (each representing one observed PE)
void SetTimeMean(double t)
Definition: PhotonSignal.h:22
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
void photrans::ImprovedTransport::CreatePhotoElectrons ( double  meanPE,
double  stepTime,
double  dist,
double  dEdx,
bool  isScint,
RateInfo info,
double &  lambda 
)
protected
Parameters
meanPEThe photons entering the fiber
stepTimeWhen they entered
distHow far to the readout
lambdaAccumulates total mean expected at readout into here

Definition at line 855 of file ImprovedTransport_module.cc.

References expect, fApplyFiberSmearing, fCherenkovTau, fEmissionTau, fExp, fFiberSmearingHisto, fFiberSpeedOfLight, fFlat, FiberTransmission(), CLHEP::RandExponential::fire(), CLHEP::RandPoissonQ::fire(), CLHEP::RandFlat::fire(), fPETimes, fPoisson, fRandHisto, fScintTime, fUseScintTime, RandHisto::GetRandom(), ScintTime(), photrans::RateInfo::timePDF, and ana::weight.

Referenced by StepAlongHit().

856  {
857  double expect = meanPE*FiberTransmission(dist);
858  lambda += expect;
859 
860  int nPE = fPoisson->fire( expect );
861  double rand0(0), rand1(0), rand2(0);
862  for (int iPE=0; iPE < nPE; ++iPE) {
863  double time = stepTime;
864  time += dist/fFiberSpeedOfLight;
865 
866  fRandHisto->GetRandom( &info.timePDF, rand0, rand1, rand2 );
867  time += rand0;
868 
869  time += fExp->fire( fEmissionTau );
870 
871  double scintTime(0);
872  if (fUseScintTime)
873  {
874  if (isScint) scintTime = ScintTime(dEdx);
875  else scintTime = fExp->fire( fCherenkovTau );
876  }
877  time += scintTime;
878 
879  double fiberspread = 0;
880  if (fApplyFiberSmearing) {
881  double weight(-1.0), uweight(0.0);
882  while (weight < uweight) {
883  // Draw a Dt/z value then multiply by "dist" to get time (in ns)
884  fRandHisto->GetRandom( &fFiberSmearingHisto, rand0, rand1, rand2 );
885  fiberspread = dist*rand0;
886 
887  // Use fiber attenuation to deweight longer times (<==>longer distances)
888  // This is an approximation, but should be pretty close.
889  double Delta_dist = fiberspread*fFiberSpeedOfLight;
891  uweight = fFlat->fire(0,1);
892  }
893  }
894  time += fiberspread;
895  fPETimes.push_back( time );
896  fScintTime->Fill(time - stepTime);
897  }
898  return;
899  }
bool fApplyFiberSmearing
Turn on fiber smearing.
const XML_Char XML_Encoding * info
Definition: expat.h:530
const Var weight
double fFiberSpeedOfLight
Speed of light in the fiber.
double fCherenkovTau
Time constant for directly excited PC to PPO scintillation.
double dist
Definition: runWimpSim.h:113
std::list< double > fPETimes
List of photo-electron times (each representing one observed PE)
double fEmissionTau
exponential time constant for green photon emission
bool fUseScintTime
Turn on sampling from PDF of scintillator decay time, see arXiv:1704.02291 for more details...
#define expect(expr, value)
Definition: lz4.cxx:117
TH1D fFiberSmearingHisto
Smearing histo for photons bouncing around in fiber.
void GetRandom(TH1 *histo, double &x, double &y, double &z)
Definition: RandHisto.cxx:8
CurrentProcessingContext const* art::EDProducer::currentContext ( ) const
protectedinherited
double photrans::ImprovedTransport::FiberTransmission ( double  x)
protected

Definition at line 1116 of file ImprovedTransport_module.cc.

References stan::math::exp(), and fAttenPars.

Referenced by CreatePhotoElectrons().

1117  {
1118  // currently, all fibers are the same
1119 
1120  // fAttenPars holds a series of (c,L) pairs that form the
1121  // function:
1122  // transmission = c0*exp(-x/L0) + c1*exp(-x/L1) + ...
1123  //
1124  // Thus, we should have an even number of parameters
1125 
1126  double answer = 0;
1127 
1128  int nPar = fAttenPars.size();
1129  if (!nPar) {
1130  mf::LogWarning("AttenPars") << "No AttenPars entries. Fiber transmission set to 1!";
1131  answer = 1;
1132  }
1133  else if (nPar%2) {
1134  mf::LogWarning("AttenPars") << "Odd number of AttenPars entries. Fiber transmission set to 1!";
1135  answer = 1;
1136  }
1137  else {
1138  answer = 0;
1139  for (Int_t iP=0;iP<nPar;iP+=2) answer += fAttenPars[iP]*exp(-x/fAttenPars[iP+1]);
1140  }
1141  return answer;
1142  }
std::vector< double > fAttenPars
from Leon&#39;s fit
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
double photrans::ImprovedTransport::GetPosCorr ( const sim::FLSHit hit)
protected

Get correction for the varying efficiency across the cross section of of the cell caused by fiber position.

Definition at line 582 of file ImprovedTransport_module.cc.

References geo::GeometryBase::DetId(), nd_projection_maker::eff, stan::math::exp(), fBigHorizClumpMap, fBigHorizMap, fBigVertCornerMap, fBigVertMap, fPosCorrEvtId, fPosCorrFile, fPosCorrHasher, fSmallHorizBubbleClumpMap, fSmallHorizBubbleMap, fSmallHorizClumpMap, fSmallHorizMap, fSmallVertCornerMap, fSmallVertMap, geom(), sim::FLSHit::GetCellID(), sim::FLSHit::GetCellUniqueId(), sim::FLSHit::GetEntryX(), sim::FLSHit::GetEntryY(), sim::FLSHit::GetEntryZ(), sim::FLSHit::GetExitX(), sim::FLSHit::GetExitY(), sim::FLSHit::GetExitZ(), sim::FLSHit::GetPlaneID(), geo::CellGeo::HalfL(), cet::hypot(), geo::GeometryBase::IdToCell(), novadaq::cnv::kFARDET, novadaq::cnv::kNEARDET, novadaq::cnv::kTESTBEAM, photrans::line_efficiency(), LoadPosCorrHists(), printf(), scale, SetPosCorrMapIndex(), and Z.

Referenced by StepAlongHit().

583  {
584  // If no file is specified for the efficiency maps -> disable
585  if(fPosCorrFile.empty()) return 1;
586 
587  // Y is the large dimension of the cell
588  const double Xa = hit.GetEntryX();
589  const double Ya = hit.GetEntryY();
590  const double Xb = hit.GetExitX();
591  const double Yb = hit.GetExitY();
592  const int planeId = hit.GetPlaneID();
593  const int cellId = hit.GetCellID();
594  const geo::CellUniqueId uniqueID = hit.GetCellUniqueId();
595 
596  const bool horizontal = planeId%2 == 0;
597 
598  const bool largecell = cellId%16 != 0 && cellId%16 != 15;
599 
600  const bool topcell = horizontal && cellId%32 == 31;
601 
603 
604  // This does not test whether we used a geometry that includes air
605  // bubbles, so you need to only use this code if you are. Preferably,
606  // the size of the bubbles should match between the geometry and
607  // the efficiency maps too, which also is not enforced here.
608  const bool hasbubble = topcell &&
609  (geom->DetId() == novadaq::cnv::kFARDET ||
610  geom->DetId() == novadaq::cnv::kTESTBEAM);
611 
612  if(!fPosCorrFile.empty() && fBigHorizMap.empty()) LoadPosCorrHists();
613 
614  // 64 bits of seed are settable. Try to make a decently unique
615  // combination of the event number and cell number with this space. This
616  // gets us the same map within each art::Event given the same cell, but a
617  // different map if either the event or the cell is different. So
618  // multiple energy depositions in a cell in one event are treated sensibly
619  // (although not perfectly: this takes the efficiency to be constant along
620  // the length of the cell)
621  fPosCorrHasher.SetSeed(fPosCorrEvtId ^ uniqueID);
622 
623  // TODO: make probability into a fcl parameter
624  const double clumpfrac = geom->DetId() == novadaq::cnv::kFARDET? 0.16
625  :geom->DetId() == novadaq::cnv::kNEARDET? 0.08
626  : 0.07 /* TESTBEAM (and any others...) */;
627  const bool clump = horizontal && fPosCorrHasher.Rndm() < clumpfrac;
628 
629  bool sagged = false;
630  if(!horizontal){
631  const double Z = (hit.GetEntryZ() + hit.GetExitZ())/2;
632  int dum1 = 0, dum2 = 0;
633  const double frombottom =
634  Z + geom->IdToCell(uniqueID, &dum1, &dum2)->HalfL();
635 
636  // Characteristic distance from bottom where fiber starts to
637  // be free-floating instead sagged against the walls as per
638  // doc-39723. We don't know this number precisely at all, but it
639  // should probably be slightly larger for small cells, so we do
640  // that by the ratio of perimeters of the cells.
641  // TODO: make into a fcl parameter.
642  const double chardist = 100.0 * (1 + 0.012*(!largecell));
643 
644  sagged = fPosCorrHasher.Rndm() < exp(-frombottom/chardist);
645  }
646 
647  // If the vertical fiber is sagged, guess that it will be in opposite
648  // corners half the time, and against the walls elsewhere otherwise.
649  const bool saggedcorner = sagged? fPosCorrHasher.Rndm() < 0.5: false;
650 
651  std::vector<TH2D *> * maps =
652  &(horizontal?
653  (hasbubble?
655  : // no bubble
656  largecell?
658  : // no bubble small cell
660  : // vertical
661  (largecell?
662  (sagged?
663  // For sagged fibers not in the corner, use a *horizontal* map
664  // since those are also have the fibers against the walls. Of
665  // course, it is always the same side wall, so this isn't perfect.
666  (saggedcorner? fBigVertCornerMap: fBigHorizMap /* sic */)
667  : fBigVertMap)
668  : // small cell
669  (sagged?
670  (saggedcorner? fSmallVertCornerMap: fSmallHorizMap /* sic */)
671  : fSmallVertMap)));
672 
673  const unsigned int mapi = fPosCorrHasher.Integer(maps->size());
674  TH2D * themap = (*maps)[mapi];
675  SetPosCorrMapIndex(maps, mapi);
676 
677  // Want this correction to be 1 on average, which this approximates.
678  // It's not important to get this correct to three (or more) digits.
679  // This scale doesn't take into account thresholds, for instance.
680  // It will be necessary to calibrate at a higher level in any case.
681  const double scale = 1/0.134;
682 
683  const double eff = line_efficiency(themap, Xa, Ya, Xb, Yb);
684  #if 0
685  printf("GetPosCorr gave %f for path %f %f %f %f len %f when %s %s %s %s\n",
686  eff, Xa, Ya, Xb, Yb, hypot(Yb-Ya, Xb-Xa),
687  horizontal?"horizontal":"vertical",
688  sagged?"sagged":"notsagged",
689  hasbubble?"bubble":"nobubble",
690  largecell?"large":"small");
691  #endif
692  return eff * scale;
693  }
geo::CellUniqueId GetCellUniqueId() const
Unique Cell ID.
Definition: FLSHit.h:41
float GetEntryX() const
Entry point of the particle (position, time and energy)
Definition: FLSHit.h:48
double HalfL() const
Definition: CellGeo.cxx:198
std::vector< TH2D * > fSmallHorizBubbleClumpMap
int GetPlaneID() const
Plane ID.
Definition: FLSHit.h:37
std::enable_if_t< std::is_arithmetic< T >::value, T > hypot(T x, T y)
Definition: hypot.h:60
int GetCellID() const
Cell ID.
Definition: FLSHit.h:39
void LoadPosCorrHists()
Reads in the efficiency maps from fPosCorrFile.
float GetExitX() const
Exit point of the particle (position, time and energy)
Definition: FLSHit.h:54
Float_t Z
Definition: plot.C:38
Double_t scale
Definition: plot.C:25
Far Detector at Ash River, MN.
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
printf("%d Experimental points found\n", nlines)
void SetPosCorrMapIndex(const std::vector< TH2D * > *const maps, const unsigned int i)
Near Detector in the NuMI cavern.
float GetEntryZ() const
Definition: FLSHit.h:50
unsigned long long int CellUniqueId
Definition: CellUniqueId.h:15
std::vector< TH2D * > fSmallVertCornerMap
static double line_efficiency(TH2D *themap, const double Xa, const double Ya, const double Xb, const double Yb)
void geom(int which=0)
Definition: geom.C:163
std::vector< TH2D * > fSmallHorizClumpMap
float GetExitY() const
Definition: FLSHit.h:55
float GetExitZ() const
Definition: FLSHit.h:56
const CellGeo * IdToCell(const CellUniqueId &id, int *iplane, int *icell) const
std::vector< TH2D * > fSmallHorizBubbleMap
float GetEntryY() const
Definition: FLSHit.h:49
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

Referenced by skim::NueSkimmer::CopyMichelSlice(), and skim::NueSkimmer::CopyMichelTrack().

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
bool photrans::ImprovedTransport::LoadHistos ( )
protected

Definition at line 952 of file ImprovedTransport_module.cc.

References makeBrightnessMap::brightness, getBrightness::cell, om::cerr, allTimeWatchdog::endl, f1, f2, f3, f4, fApplyTweak, fBrightnessFile, fBrightnessLevel, fBrightnessMap, fBrightnessMapName, fBrightnessMode, fBrightnessValueMapName, fBrightnessValueName, fCollectionRateFile, fCollectionRateHisto, fFiberSmearingHisto, fGeo, fRateInfo, fSmearingHistoFile, fTweak_X, fTweak_Y, fTweakFile, photrans::BrightnessLevel::getBrightnessLevel(), geo::PlaneGeo::Ncells(), geo::GeometryBase::NPlanes(), geo::GeometryBase::Plane(), NDAPDHVSetting::plane, photrans::RateInfo::rate, photrans::RateInfo::timePDF, yhi, ylo, photrans::RateInfo::z, and photrans::RateInfo::zWidth.

Referenced by beginRun().

953  {
954  // just read a file from disk for now. should eventually be in the DB.
955  // use FileInPath to get the histogram file
956  struct stat sb;
957  if ( stat(fCollectionRateFile.c_str(), &sb) !=0 ) {
958  throw cet::exception("NoCollectionRateFile")
959  << "ImprovedTransport: Unable to open "
960  << fCollectionRateFile << "\n"
961  << __FILE__ << ":" << __LINE__ << "\n";
962  return false;
963  }
964 
965  if ( stat(fSmearingHistoFile.c_str(), &sb) !=0 ) {
966  throw cet::exception("NoSmearingHistoFile") << "ImprovedTransport: Unable to open " << fSmearingHistoFile << "\n" << __FILE__ << ":" << __LINE__ << "\n";
967  return false;
968  }
969 
970  TFile f1(fCollectionRateFile.c_str());
971  TH2D *htemp = (TH2D*)f1.Get("dT_dZ_CollectionRate")->Clone();
972  if (!htemp) {
973  std::cerr << "ImprovedTransport: Histogram dT_dZ_CollectionRate not found in " << fCollectionRateFile << std::endl;
974  return false;
975  }
976 
977  fCollectionRateHisto = *htemp;
978  fCollectionRateHisto.SetDirectory(0);
979  f1.Close();
980 
981  TFile f2(fSmearingHistoFile.c_str());
982  TH1D *htemp2 = (TH1D*)f2.Get("Dt_per_z")->Clone();
983  if (!htemp2) {
984  std::cerr << "ImprovedTransport: Histogram Dt_per_z_distribution not found in " << fSmearingHistoFile << std::endl;
985  return false;
986  }
987 
988  fFiberSmearingHisto = *htemp2;
989  fFiberSmearingHisto.SetDirectory(0);
990  f2.Close();
991 
992  for (unsigned int plane = 0; plane < fGeo->NPlanes(); plane++){
993  std::vector< double > plane_brightness;
994  for (unsigned int cell = 0; cell < fGeo->Plane(plane)->Ncells(); cell++){
995  plane_brightness.push_back(1.0);
996  }
997  fBrightnessMap.push_back(plane_brightness);
998  }
999 
1000  if (fBrightnessMode != "None") {
1001  TFile f3(fBrightnessFile.c_str());
1002  TH1D* hBrightness1D(0);
1003  TH2D* hBrightness2D(0);
1004  if (fBrightnessMode == "ByCell") {
1005  hBrightness2D = (TH2D*)f3.Get("BrightnessByCell");
1006  if (!hBrightness2D) {
1007  std::cerr << "ImprovedTransport: Histogram BrightnessByCell not found in " << fBrightnessFile << std::endl;
1008  return false;
1009  }
1010  }
1011  else if (fBrightnessMode == "ByModule") {
1012  hBrightness2D = (TH2D*)f3.Get("BrightnessByModule");
1013  if (!hBrightness2D) {
1014  std::cerr << "ImprovedTransport: Histogram BrightnessByModule not found in " << fBrightnessFile << std::endl;
1015  return false;
1016  }
1017  }
1018  else if (fBrightnessMode == "ByPlane") {
1019  hBrightness1D = (TH1D*)f3.Get("BrightnessByPlane");
1020  if (!hBrightness1D) {
1021  std::cerr << "ImprovedTransport: Histogram BrightnessByPlane not found in " << fBrightnessFile << std::endl;
1022  return false;
1023  }
1024  }
1025  //Add by Pengfei -- begin
1026  else if (fBrightnessMode == "ByBin") {
1028  }
1029  //Add by Pengfei -- end
1030  else {
1031  std::cerr << "ImprovedTransport: " << fBrightnessMode << " is not a recognized brightness correction mode. Valid choices are None, ByCell, ByModule, or ByPlane " << std::endl;
1032  return false;
1033  }
1034 
1035  for (unsigned int plane = 0; plane < fGeo->NPlanes(); plane++){
1036  for (unsigned int cell = 0; cell < fGeo->Plane(plane)->Ncells(); cell++){
1037  double brightness(1.0);
1038  if (fBrightnessMode == "ByCell") brightness = hBrightness2D->GetBinContent(plane+1, cell+1);
1039  else if (fBrightnessMode == "ByModule") brightness = hBrightness2D->GetBinContent(plane+1, cell/32 + 1);
1040  else if (fBrightnessMode == "ByPlane") brightness = hBrightness1D->GetBinContent(plane+1);
1041  //Add by Pengfei -- begin
1042  else if (fBrightnessMode == "ByBin") {
1044  }
1045  //Add by Pengfei -- end
1047  }
1048  }
1049  f3.Close();
1050  }
1051 
1052  if (fApplyTweak) {
1053  TFile f4(fTweakFile.c_str());
1054  TH1D* tmpTweak(0);
1055  tmpTweak = (TH1D*)f4.Get("Tweak_X")->Clone();
1056  if (!tmpTweak) {
1057  std::cerr << "Histogram Tweak_X not found in " << fTweakFile << std::endl;
1058  return false;
1059  }
1060  fTweak_X = *tmpTweak;
1061  fTweak_X.SetDirectory(0);
1062 
1063  tmpTweak = 0;
1064  tmpTweak = (TH1D*)f4.Get("Tweak_Y")->Clone();
1065  if (!tmpTweak) {
1066  std::cerr << "Histogram Tweak_Y not found in " << fTweakFile <<std::endl;
1067  return false;
1068  }
1069  fTweak_Y = *tmpTweak;
1070  fTweak_Y.SetDirectory(0);
1071 
1072  f4.Close();
1073  }
1074 
1075  fRateInfo.clear();
1076  std::stringstream hName;
1077  int nbinsY = fCollectionRateHisto.GetNbinsY();
1078  double ylo = fCollectionRateHisto.GetYaxis()->GetXmin();
1079  double yhi = fCollectionRateHisto.GetYaxis()->GetXmax();
1080  for (int iZ = 1; iZ <= fCollectionRateHisto.GetNbinsX(); ++iZ) {
1081  RateInfo info_pos;
1082  info_pos.rate = 0.0;
1083  info_pos.z = fCollectionRateHisto.GetXaxis()->GetBinCenter(iZ);
1084  info_pos.zWidth = fCollectionRateHisto.GetXaxis()->GetBinWidth(iZ);
1085  hName.str("timePDF_Pos_");
1086  hName << iZ;
1087  info_pos.timePDF.SetName(hName.str().c_str());
1088  info_pos.timePDF.SetBins(nbinsY, ylo, yhi);
1089  info_pos.timePDF.SetDirectory(0);
1090 
1091  RateInfo info_neg;
1092  info_neg.rate = 0.0;
1093  info_neg.z = -fCollectionRateHisto.GetXaxis()->GetBinCenter(iZ);
1094  info_neg.zWidth = fCollectionRateHisto.GetXaxis()->GetBinWidth(iZ);
1095  hName.str("timePDF_Neg_");
1096  hName << iZ;
1097  info_neg.timePDF.SetName(hName.str().c_str());
1098  info_neg.timePDF.SetBins(nbinsY, ylo, yhi);
1099  info_neg.timePDF.SetDirectory(0);
1100 
1101  for (int iT = 1; iT <= fCollectionRateHisto.GetNbinsY(); ++iT) {
1102  double collectionRate = 0.5*fCollectionRateHisto.GetBinContent(iZ,iT);
1103  info_pos.rate += collectionRate;
1104  info_pos.timePDF.SetBinContent(iT, collectionRate);
1105 
1106  info_neg.rate += collectionRate;
1107  info_neg.timePDF.SetBinContent(iT, collectionRate);
1108  }
1109  fRateInfo.push_back(info_pos);
1110  fRateInfo.push_back(info_neg);
1111  }
1112  return true;
1113  }
Float_t f4
bool fApplyTweak
Turn on the data driven attenuation correction for each view.
TH2D fCollectionRateHisto
Collection rate for given dT vs. dZ.
std::string fCollectionRateFile
Relative path to the collection rate histo file.
TH1D fTweak_Y
A data/mc correction for the Y-View.
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
OStream cerr
Definition: OStream.cxx:7
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
art::ServiceHandle< geo::Geometry > fGeo
Handle to the geometry service.
Float_t f2
const PlaneGeo * Plane(unsigned int i) const
std::list< RateInfo > fRateInfo
List of RateInfo object.
Float_t f3
double getBrightnessLevel(unsigned int plane, unsigned int cell) const
std::string fBrightnessMode
correct the fiber brightness by cell, by module, or not at all
std::string fTweakFile
Relative path to the data driven attenuation correction for each view.
Float_t f1
std::vector< std::vector< double > > fBrightnessMap
The brightness correction by cell.
TH1D fFiberSmearingHisto
Smearing histo for photons bouncing around in fiber.
std::string fSmearingHistoFile
Relative path to the fiber smearing histo file.
std::string fBrightnessFile
Relative path to the brightness correction file.
unsigned int NPlanes() const
TH1D fTweak_X
A data/mc correction for the X-View.
void photrans::ImprovedTransport::LoadPosCorrHists ( )
private

Reads in the efficiency maps from fPosCorrFile.

Definition at line 509 of file ImprovedTransport_module.cc.

References MakeMiniprodValidationCuts::f, fBigHorizClumpMap, fBigHorizMap, fBigVertCornerMap, fBigVertMap, fPosCorrFile, fSmallHorizBubbleClumpMap, fSmallHorizBubbleMap, fSmallHorizClumpMap, fSmallHorizMap, fSmallVertCornerMap, fSmallVertMap, photrans::load_hset(), msglevel, and copy_new_pkl_files::verbose.

Referenced by GetPosCorr().

510  {
511  TFile * f = new TFile(fPosCorrFile.c_str());
512  if(f == NULL || f->IsZombie())
513  throw cet::exception("NoPosCorrHistFile")
514  << "ImprovedTransport: Unable to open "
515  << fPosCorrFile << "\n" << __FILE__ << ":" << __LINE__ << "\n";
516 
517  const bool verbose = msglevel >= 10;
518 
519  load_hset(f, "big_horiz",
520  "big horizontal cell maps",
521  fBigHorizMap, verbose);
522  load_hset(f, "big_horiz_clump",
523  "big horizontal cell maps with clumped fibers",
524  fBigHorizClumpMap, verbose);
525  load_hset(f, "small_horiz",
526  "small horizontal cell maps",
527  fSmallHorizMap, verbose);
528  load_hset(f, "small_horiz_clump",
529  "small horizontal cell maps with clumped fibers",
530  fSmallHorizClumpMap, verbose);
531  load_hset(f, "small_horiz_bubble",
532  "small horizontal cell maps with bubbles",
533  fSmallHorizBubbleMap, verbose);
534  load_hset(f, "small_horiz_bubble_clump",
535  "small horizontal cell maps with bubbles and clumped fibers",
536  fSmallHorizBubbleClumpMap, verbose);
537  load_hset(f, "big_vert",
538  "big vertical cell maps",
539  fBigVertMap, verbose);
540  load_hset(f, "big_vert_corner",
541  "big vertical cell maps with fibers in corners",
542  fBigVertCornerMap, verbose);
543  load_hset(f, "small_vert",
544  "small vertical cell maps",
545  fSmallVertMap, verbose);
546  load_hset(f, "small_vert_corner",
547  "small vertical cell maps with fibers in corners",
548  fSmallVertCornerMap, verbose);
549 
550  delete f;
551  }
std::vector< TH2D * > fSmallHorizBubbleClumpMap
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::vector< TH2D * > fSmallVertCornerMap
std::vector< TH2D * > fSmallHorizClumpMap
void load_hset(TFile *f, const char *name, const char *humanname, std::vector< TH2D * > &hold, const bool verbose)
std::vector< TH2D * > fSmallHorizBubbleMap
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void photrans::ImprovedTransport::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 390 of file ImprovedTransport_module.cc.

References art::Event::event(), fFilterModuleLabel, fPosCorrEvtId, fSignals, art::DataViewImpl::getByLabel(), hits(), art::Event::put(), art::Event::run(), StepAlongHit(), and art::Event::subRun().

391  {
392  // get list of hits
394  evt.getByLabel(fFilterModuleLabel, flslistHandle);
395 
396  //clear output vector
397  fSignals->clear();
398 
399  // Reasonably unique event number (unique if run, subrun < 65536)
400  // for use with cell efficiency maps.
401  fPosCorrEvtId = ((uint64_t)evt.run() << 48)
402  +((uint64_t)evt.subRun() << 32)
403  +((uint64_t)evt.event() );
404 
405  for (unsigned int ilist = 0; ilist < flslistHandle->size(); ++ilist) {
406  const std::vector<sim::FLSHit> hits = flslistHandle->at(ilist).fHits;
407  for (unsigned int ihit = 0; ihit < hits.size(); ++ihit) {
408  sim::FLSHit hit = hits[ihit];
409  //step along the hit and fill fPETimes (clustering done at end of StepAlongHit)
410  StepAlongHit( hit );
411  }
412  }
413 
414  // make a new collection into which we will put the sim::PhotonSignals. That new collection
415  // will then be put into the event. If we tried to put fSignals in the event, the std::move
416  // call changes ownership of the vector and the next time we try to access fSignals would
417  // cause a seg fault
418  std::unique_ptr<std::vector<sim::PhotonSignal>> pscol(new std::vector<sim::PhotonSignal>);
419  pscol->swap(*fSignals);
420 
421  //put vector<sim::PhotonSignal> into the event
422  evt.put(std::move( pscol ));
423 
424  return;
425  }
SubRunNumber_t subRun() const
Definition: Event.h:72
A single unit of energy deposition in the liquid scintillator.
Definition: FLSHit.h:19
std::unique_ptr< std::vector< sim::PhotonSignal > > fSignals
Produced vector of PhotonSignals.
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void hits()
Definition: readHits.C:15
EventNumber_t event() const
Definition: Event.h:67
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Definition: structs.h:12
RunNumber_t run() const
Definition: Event.h:77
std::string fFilterModuleLabel
module that filtered the fls hits
double photrans::ImprovedTransport::ScintTime ( double  dEdx)
protected

Definition at line 1145 of file ImprovedTransport_module.cc.

References DEFINE_ART_MODULE(), fExp, fFlat, CLHEP::RandExponential::fire(), CLHEP::RandFlat::fire(), fScintAlphaDEDX, fScintAlphaProb, fScintAlphaTau, fScintBetaDEDX, fScintBetaProb, fScintBetaTau, and submit_hadd::u.

Referenced by CreatePhotoElectrons().

1146  {
1147  // sample from a sum of multiple exponentials to get the scintilator decay time for each photon
1148  // if dEdx is less than that used for measuring the beta distribution, use the beta distribution
1149  // if dEdx is greater than that used for measuring the alpha distribution, use the alpha distribution
1150  // if dEdx is between the two, smoothly transition between the distributions
1151 
1152  int nProbBeta = fScintBetaProb.size();
1153  int nProbAlpha = fScintAlphaProb.size();
1154  int nTauBeta = fScintBetaTau.size();
1155  int nTauAlpha = fScintAlphaTau.size();
1156 
1157  double time = 0;
1158  if (!nProbBeta) {
1159  mf::LogWarning("ScintTime") << "No ScintBetaProb entries. No scintillation delays applied!";
1160  time = 0;
1161  }
1162  else if (!nProbAlpha) {
1163  mf::LogWarning("ScintTime") << "No ScintAlphaProb entries. No scintillation delays applied!";
1164  time = 0;
1165  }
1166  else if (nProbBeta != nTauBeta) {
1167  mf::LogWarning("ScintTime") << "Number of entries in ScintBetaProb and ScintBetaTau not the same. No scintillation delays applied!";
1168  time = 0;
1169  }
1170  else if (nProbAlpha != nTauAlpha) {
1171  mf::LogWarning("ScintTime") << "Number of entries in ScintBetaAlpha and ScintBetaAlpha not the same. No scintillation delays applied!";
1172  time = 0;
1173  }
1174  else if (fScintBetaDEDX >= fScintAlphaDEDX) {
1175  mf::LogWarning("ScintTime") << "Beta dEdx must be strictly smaller than alpha dEdx. No scintillation delays applied!";
1176  time = 0;
1177  }
1178  else {
1179  //actually sample the distribution
1180  double probBeta = (dEdx - fScintBetaDEDX)/(fScintBetaDEDX - fScintAlphaDEDX) + 1;
1181  double u = fFlat->fire(0,1);
1182  bool useBeta = (u < probBeta);
1183  u = fFlat->fire(0,1);
1184  if (useBeta) {
1185  for (int iC = 0; iC < nProbBeta; ++iC) {
1186  if (u <= fScintBetaProb[iC]) {
1187  time = fExp->fire(fScintBetaTau[iC]);
1188  break;
1189  }
1190  }
1191  }
1192  else {
1193  for (int iC = 0; iC < nProbAlpha; ++iC) {
1194  if (u <= fScintAlphaProb[iC]) {
1195  time = fExp->fire(fScintAlphaTau[iC]);
1196  break;
1197  }
1198  }
1199  }
1200  }
1201  return time;
1202  }
::xsd::cxx::tree::time< char, simple_type > time
Definition: Database.h:194
double fScintBetaDEDX
Approximate dE/dx of betas used to determine PDF.
std::vector< double > fScintAlphaTau
Time constants of each exponential component for alphas.
std::vector< double > fScintBetaProb
Cumulative probability for each exponential component for betas.
double fScintAlphaDEDX
Approximate dE/dx of alphas used to determine PDF.
std::vector< double > fScintAlphaProb
Cumulative probability for each exponential component for alphas.
std::vector< double > fScintBetaTau
Time constants of each exponential component for betas.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void photrans::ImprovedTransport::SetPosCorrMapIndex ( const std::vector< TH2D * > *const  maps,
const unsigned int  i 
)
private

Definition at line 556 of file ImprovedTransport_module.cc.

References fBigHorizClumpMap, fBigHorizMap, fBigVertCornerMap, fBigVertMap, fPosCorrMapIndex, fSmallHorizBubbleClumpMap, fSmallHorizBubbleMap, fSmallHorizClumpMap, fSmallHorizMap, fSmallVertCornerMap, fSmallVertMap, and MECModelEnuComparisons::i.

Referenced by GetPosCorr().

558  {
559  fPosCorrMapIndex = 0;
560  if(maps == &fBigHorizMap){ fPosCorrMapIndex += i; return; }
561  fPosCorrMapIndex += fBigHorizMap.size();
562  if(maps == &fBigHorizClumpMap){ fPosCorrMapIndex += i; return; }
564  if(maps == &fSmallHorizMap){ fPosCorrMapIndex += i; return; }
566  if(maps == &fSmallHorizClumpMap){ fPosCorrMapIndex += i; return; }
568  if(maps == &fSmallHorizBubbleMap){ fPosCorrMapIndex += i; return; }
570  if(maps == &fSmallHorizBubbleClumpMap){ fPosCorrMapIndex += i; return; }
572  if(maps == &fBigVertMap){ fPosCorrMapIndex += i; return; }
573  fPosCorrMapIndex += fBigVertMap.size();
574  if(maps == &fBigVertCornerMap){ fPosCorrMapIndex += i; return; }
576  if(maps == &fSmallVertMap){ fPosCorrMapIndex += i; return; }
578  if(maps == &fSmallVertCornerMap){ fPosCorrMapIndex += i; return; }
580  }
std::vector< TH2D * > fSmallHorizBubbleClumpMap
std::vector< TH2D * > fSmallVertCornerMap
std::vector< TH2D * > fSmallHorizClumpMap
std::vector< TH2D * > fSmallHorizBubbleMap
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void photrans::ImprovedTransport::StepAlongHit ( sim::FLSHit hit)
protected

Definition at line 696 of file ImprovedTransport_module.cc.

References stan::math::ceil(), geo::PlaneGeo::Cell(), ClusterPhotoElectrons(), CreatePhotoElectrons(), geo::GeometryBase::DetId(), nova::dbi::RunHistory::Duration(), stan::math::fabs(), fApplyBirks, fApplyTweak, fBrightnessMap, fCerenkovEff, fDriftGradient, fDriftReference, fGeo, geo::GeometryBase::FirstPlaneInMuonCatcher(), fLightLevelScale, fPETimes, fPhotonsPerMeV, fQuantumEff, fRateInfo, fSignals, fSimulateDrift, fStep, fTweak_X, fTweak_XMC, fTweak_Y, fTweak_YMC, fWriteEmptySignals, fXViewFactor, fYViewFactor, sim::FLSHit::GetCellID(), sim::FLSHit::GetEdep(), sim::FLSHit::GetEdepBirks(), sim::FLSHit::GetEntryT(), sim::FLSHit::GetEntryX(), sim::FLSHit::GetEntryY(), sim::FLSHit::GetEntryZ(), sim::FLSHit::GetExitT(), sim::FLSHit::GetExitX(), sim::FLSHit::GetExitY(), sim::FLSHit::GetExitZ(), sim::FLSHit::GetNCerenkov(), geo::GeometryBase::GetPigtail(), sim::FLSHit::GetPlaneID(), GetPosCorr(), sim::FLSHit::GetTrackID(), geo::CellGeo::HalfL(), MECModelEnuComparisons::i, geo::CellGeo::Id(), novadaq::cnv::kFARDET, novadaq::cnv::kNEARDET, geo::kX, nsteps, geo::GeometryBase::Plane(), util::pythag(), rh, sim::PhotonSignal::SetPlaneCell(), febshutoff_auto::start, nova::dbi::RunHistory::TStart(), and geo::PlaneGeo::View().

Referenced by produce().

697  {
698  //clear photo-electron times for this hit
699  fPETimes.clear();
700 
701  const double MeVPerGeV = 1000.;
702  //const double green_scale = MeVPerGeV * fPhotonsPerMeV * fQuantumEff;
703 
704  //for cleaner-looking code below...
705  double Xa = hit.GetEntryX();
706  double Ya = hit.GetEntryY();
707  double Za = hit.GetEntryZ();
708  double Ta = hit.GetEntryT();
709 
710  double Xb = hit.GetExitX();
711  double Yb = hit.GetExitY();
712  double Zb = hit.GetExitZ();
713  double Tb = hit.GetExitT();
714 
715  int planeId = hit.GetPlaneID();
716  int cellId = hit.GetCellID();
717  int trackId = hit.GetTrackID();
718 
719  const double positionCorr = GetPosCorr(hit);
720 
721  double brightnessCorr = fBrightnessMap[planeId][cellId];
722 
723  double seglength = util::pythag(Xb - Xa, Yb - Ya, Zb - Za);
724 
725  //cell half-width
726  double DZ = fGeo->Plane((unsigned int)(planeId))->Cell ((unsigned int)(cellId ))->HalfL();
727  //pigtail for cell
728  double pigtail = fGeo->GetPigtail(fGeo->Plane(planeId)->Cell(cellId)->Id());
729 
730  double factor;
731  if (fGeo->Plane(planeId)->View() == geo::kX) factor = fXViewFactor;
732  else factor = fYViewFactor;
733 
734  factor *= fLightLevelScale; // Nominally this is one, but can be modified for LL shifts
735 
736  // If we're simulating drift, randomly throw the light level
737  // not ready to go just yet -- j.
738  if (fSimulateDrift) {
740  int time = rh->TStart() + (0.5*rh->Duration()); // set to midpoint of run;
741  double yDiff = 3.17098e-8 * (time - fDriftReference); // Amount of drift in years
742  //std::cout << "Drifting " << yDiff << " years with respect to nominal." << std::endl;
743  double drift = 1 - (fDriftGradient*yDiff);
744  //std::cout << "Calculated drift of " << drift
745  // << " from nominal, factor corrected from " << factor << " to ";
746  factor *= drift;
747  //std::cout << factor << std::endl;
748  }
749 
750  bool inMC = false;
751  if (fGeo->DetId() == novadaq::cnv::kNEARDET) {
752  if (planeId >= int(fGeo->FirstPlaneInMuonCatcher())) inMC = true;
753  }
754 
755  //find out how many steps to take
756  int nsteps = ceil( seglength/fStep );
757 
758  //Get approximate dEdx for scintillation time scaling
759  //If segment length is zero, dEdx won't make sense.
760  //Default to zero - the beta PDF is almost always going to be more relevant than the alpha one, I think
761  double dEdx = (seglength > 0) ? MeVPerGeV*hit.GetEdep()/seglength : 0.0;
762 
763  // The total number of PE that would have been produced are accumulated in
764  // here, whether or not fluctuations allowed a PhotonSignal to be created
765  // for them to live in.
766  double lambda = 0;
767 
768  for (int istep = 0; istep < nsteps; ++istep) {
769  //at midpoint of the step
770  double stepZ = Za + ((Zb-Za)/nsteps)*(istep+0.5);
771  double stepT = Ta + ((Tb-Ta)/nsteps)*(istep+0.5);
772  double stepE = (fApplyBirks) ? hit.GetEdepBirks()/nsteps : hit.GetEdep()/nsteps;
773  double stepCerenkov = hit.GetNCerenkov()/nsteps;
774 
775  double tweakCorr(1.0);
776  if (fApplyTweak) {
777  //Tweak is currently only available for non-muon catcher cells
778  if (fGeo->DetId() == novadaq::cnv::kFARDET) {
779  if (fGeo->Plane(planeId)->View() == geo::kX) tweakCorr = fTweak_X.Interpolate(DZ - stepZ);
780  else tweakCorr = fTweak_Y.Interpolate(DZ - stepZ);
781  }
782  if (fGeo->DetId() == novadaq::cnv::kNEARDET) {
783  if (inMC) {
784  if (fGeo->Plane(planeId)->View() == geo::kX) tweakCorr = fTweak_XMC.Interpolate(DZ - stepZ);
785  else tweakCorr = fTweak_YMC.Interpolate(DZ - stepZ);
786  }
787  else {
788  if (fGeo->Plane(planeId)->View() == geo::kX) tweakCorr = fTweak_X.Interpolate(DZ - stepZ);
789  else tweakCorr = fTweak_Y.Interpolate(DZ - stepZ);
790  }
791  }
792  }
793 
794  //green_scale*stepE*collectionRate = N Photo-electrons (before attenuation)
795  std::list<RateInfo>::iterator rate_it;
796  for (rate_it = fRateInfo.begin(); rate_it != fRateInfo.end(); ++rate_it) {
797  double collectionRate = rate_it->rate;
798  double currZ = stepZ + rate_it->z;
799  double fraction(1.0);
800 
801  //is this currZ inside the cell?
802  if ( std::fabs(currZ) - 0.5*rate_it->zWidth > DZ ) continue;
803  else if ( std::fabs(currZ) + 0.5*rate_it->zWidth < DZ ) fraction = 1.0;
804  else fraction = (DZ - ( std::fabs(currZ) - 0.5*rate_it->zWidth ))/rate_it->zWidth;
805  collectionRate *= fraction;
806 
807  double scintillationPhotons = MeVPerGeV*fPhotonsPerMeV*stepE;
808  double cerenkovPhotons = fCerenkovEff*stepCerenkov;
809  double muGreenScint = fQuantumEff*collectionRate*brightnessCorr*tweakCorr*
810  positionCorr*factor*scintillationPhotons;
811  double muGreenCkv = fQuantumEff*collectionRate*brightnessCorr*tweakCorr*
812  positionCorr*factor*cerenkovPhotons;
813  //short and long length to the electronics
814  double dist0 = DZ - currZ + pigtail;
815  double dist1 = 3*DZ + currZ + pigtail;
816 
817  CreatePhotoElectrons( 0.5*muGreenScint, stepT, dist0, dEdx, true, *rate_it, lambda );
818  CreatePhotoElectrons( 0.5*muGreenScint, stepT, dist1, dEdx, true, *rate_it, lambda );
819  CreatePhotoElectrons( 0.5*muGreenCkv, stepT, dist0, dEdx, false, *rate_it, lambda );
820  CreatePhotoElectrons( 0.5*muGreenCkv, stepT, dist1, dEdx, false, *rate_it, lambda );
821  }
822  }
823 
824  // Keep track of how many we have so far so we know which ones get newly
825  // added by ClusterPhotoElectrons().
826  unsigned int start = fSignals->size();
827 
828  ClusterPhotoElectrons(planeId, cellId, trackId);
829 
830  // Divide the poission lambda evenly among all PhotonSignals. When someone
831  // adds them up downstream they'll get the right overall answer for this
832  // FLSHit.
833  const int N = fSignals->size()-start;
834  if(N > 0){
835  for(unsigned int i = start; i < fSignals->size(); ++i){
836  (*fSignals)[i].SetPoissonLambda(lambda/N);
837  }
838  }
839  else{
840  if(fWriteEmptySignals){
841  // Create a PhotonSignal with zero PE, just to have somewhere to attach
842  // the PoissonLambda to.
843  sim::PhotonSignal photon(hit.GetEntryT(), 0);
844  photon.SetPlaneCell(planeId, cellId);
845  photon.SetTrackId(trackId);
846  photon.SetPoissonLambda(lambda);
847  fSignals->push_back(photon);
848  }
849  }
850 
851  return;
852  }
double fCerenkovEff
Absorption and re-emission efficiency for Cerenkov photons.
float GetEntryX() const
Entry point of the particle (position, time and energy)
Definition: FLSHit.h:48
bool fApplyTweak
Turn on the data driven attenuation correction for each view.
double HalfL() const
Definition: CellGeo.cxx:198
void ClusterPhotoElectrons(int planeId, int cellId, int trackId)
double fStep
step size for walking along the track (cm)
TH2 * rh
Definition: drawXsec.C:5
int GetPlaneID() const
Plane ID.
Definition: FLSHit.h:37
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
double fYViewFactor
scale factor for the y-view
TH1D fTweak_XMC
A data/mc correction for the X-View in the muon catcher.
TH1D fTweak_Y
A data/mc correction for the Y-View.
double fXViewFactor
scale factor for the x-view
double GetPosCorr(const sim::FLSHit &hit)
int GetCellID() const
Cell ID.
Definition: FLSHit.h:39
float GetExitT() const
Definition: FLSHit.h:57
const int nsteps
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
double fLightLevelScale
shift overall light yield by multiplicative factor
Vertical planes which measure X.
Definition: PlaneGeo.h:28
bool fWriteEmptySignals
Write an empty PhotonSignal if there&#39;s 0 PE.
float GetNCerenkov() const
Get total N Cerenkov photons.
Definition: FLSHit.h:35
art::ServiceHandle< geo::Geometry > fGeo
Handle to the geometry service.
const PlaneGeo * Plane(unsigned int i) const
float GetExitX() const
Exit point of the particle (position, time and energy)
Definition: FLSHit.h:54
TH1D fTweak_YMC
A data/mc correction for the Y-View in the muon catcher.
void SetPlaneCell(int plane, int cell)
Definition: PhotonSignal.h:24
std::unique_ptr< std::vector< sim::PhotonSignal > > fSignals
Produced vector of PhotonSignals.
const CellUniqueId & Id() const
Definition: CellGeo.h:55
std::list< RateInfo > fRateInfo
List of RateInfo object.
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
Far Detector at Ash River, MN.
double fDriftGradient
gradient for light level detector aging systematic [fraction/year]
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
Near Detector in the NuMI cavern.
int Duration()
in units of seconds
Definition: RunHistory.h:389
bool fSimulateDrift
whether to vary light level as a function of time
std::list< double > fPETimes
List of photo-electron times (each representing one observed PE)
float GetEdepBirks() const
Get total Energy with Birks suppression deposited into the cell for the whole FLSHit.
Definition: FLSHit.h:33
double GetPigtail(const CellUniqueId &id) const
Return length of fiber in cm from end of cell to apd.
float GetEntryZ() const
Definition: FLSHit.h:50
std::vector< std::vector< double > > fBrightnessMap
The brightness correction by cell.
bool fApplyBirks
Use EdepBirks from FLSHits instead of calculating here.
float GetEntryT() const
Definition: FLSHit.h:51
void CreatePhotoElectrons(double meanPE, double stepTime, double dist, double dEdx, bool isScint, RateInfo &info, double &lambda)
int GetTrackID() const
Track ID.
Definition: FLSHit.h:45
double pythag(double x, double y)
2D Euclidean distance
Definition: MathUtil.h:29
double fPhotonsPerMeV
blue photon production scale
float GetEdep() const
Get total Energy deposited into the cell for the whole FLSHit.
Definition: FLSHit.h:31
float GetExitY() const
Definition: FLSHit.h:55
double fQuantumEff
APD quantum efficiency.
float GetExitZ() const
Definition: FLSHit.h:56
int fDriftReference
drift reference time (ie. where the slope is fixed to 1)
fvar< T > ceil(const fvar< T > &x)
Definition: ceil.hpp:11
TH1D fTweak_X
A data/mc correction for the X-View.
float GetEntryY() const
Definition: FLSHit.h:49
const unsigned int FirstPlaneInMuonCatcher() const
Returns the index of the first plane contained in the muon catcher.
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

bool photrans::ImprovedTransport::fApplyBirks
private

Use EdepBirks from FLSHits instead of calculating here.

Definition at line 107 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

bool photrans::ImprovedTransport::fApplyFiberSmearing
private

Turn on fiber smearing.

Definition at line 109 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and CreatePhotoElectrons().

bool photrans::ImprovedTransport::fApplyTweak
private

Turn on the data driven attenuation correction for each view.

Definition at line 113 of file ImprovedTransport_module.cc.

Referenced by beginRun(), LoadHistos(), and StepAlongHit().

std::vector<double> photrans::ImprovedTransport::fAttenPars
private

from Leon's fit

Definition at line 103 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and FiberTransmission().

std::vector<TH2D *> photrans::ImprovedTransport::fBigHorizClumpMap
private

Definition at line 157 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr(), LoadPosCorrHists(), and SetPosCorrMapIndex().

std::vector<TH2D *> photrans::ImprovedTransport::fBigHorizMap
private

Definition at line 156 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr(), LoadPosCorrHists(), and SetPosCorrMapIndex().

std::vector<TH2D *> photrans::ImprovedTransport::fBigVertCornerMap
private

Definition at line 170 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr(), LoadPosCorrHists(), and SetPosCorrMapIndex().

std::vector<TH2D *> photrans::ImprovedTransport::fBigVertMap
private

Definition at line 169 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr(), LoadPosCorrHists(), and SetPosCorrMapIndex().

std::string photrans::ImprovedTransport::fBrightnessFile
private

Relative path to the brightness correction file.

Definition at line 112 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and LoadHistos().

BrightnessLevel* photrans::ImprovedTransport::fBrightnessLevel
private

Definition at line 148 of file ImprovedTransport_module.cc.

Referenced by LoadHistos().

std::vector< std::vector< double > > photrans::ImprovedTransport::fBrightnessMap
private

The brightness correction by cell.

Definition at line 143 of file ImprovedTransport_module.cc.

Referenced by LoadHistos(), and StepAlongHit().

std::string photrans::ImprovedTransport::fBrightnessMapName
private

Definition at line 145 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and LoadHistos().

std::string photrans::ImprovedTransport::fBrightnessMode
private

correct the fiber brightness by cell, by module, or not at all

Definition at line 111 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and LoadHistos().

std::string photrans::ImprovedTransport::fBrightnessValueMapName
private

Definition at line 147 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and LoadHistos().

std::string photrans::ImprovedTransport::fBrightnessValueName
private

Definition at line 146 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and LoadHistos().

double photrans::ImprovedTransport::fCerenkovEff
private

Absorption and re-emission efficiency for Cerenkov photons.

Definition at line 99 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

double photrans::ImprovedTransport::fCherenkovTau
private

Time constant for directly excited PC to PPO scintillation.

Definition at line 120 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and CreatePhotoElectrons().

std::string photrans::ImprovedTransport::fCollectionRateFile
private

Relative path to the collection rate histo file.

Definition at line 108 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and LoadHistos().

TH2D photrans::ImprovedTransport::fCollectionRateHisto
private

Collection rate for given dT vs. dZ.

Definition at line 136 of file ImprovedTransport_module.cc.

Referenced by LoadHistos().

double photrans::ImprovedTransport::fDriftGradient
private

gradient for light level detector aging systematic [fraction/year]

Definition at line 117 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

int photrans::ImprovedTransport::fDriftReference
private

drift reference time (ie. where the slope is fixed to 1)

Definition at line 116 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

double photrans::ImprovedTransport::fEmissionTau
private

exponential time constant for green photon emission

Definition at line 102 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and CreatePhotoElectrons().

CLHEP::RandExponential* photrans::ImprovedTransport::fExp
private

Definition at line 203 of file ImprovedTransport_module.cc.

Referenced by CreatePhotoElectrons(), ImprovedTransport(), and ScintTime().

double photrans::ImprovedTransport::fFiberIndexOfRefraction
private

n for fiber core

Definition at line 101 of file ImprovedTransport_module.cc.

Referenced by beginRun().

TH1D photrans::ImprovedTransport::fFiberSmearingHisto
private

Smearing histo for photons bouncing around in fiber.

Definition at line 137 of file ImprovedTransport_module.cc.

Referenced by CreatePhotoElectrons(), and LoadHistos().

double photrans::ImprovedTransport::fFiberSpeedOfLight
private

Speed of light in the fiber.

Definition at line 135 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and CreatePhotoElectrons().

std::string photrans::ImprovedTransport::fFilterModuleLabel
private

module that filtered the fls hits

Definition at line 92 of file ImprovedTransport_module.cc.

Referenced by produce().

bool photrans::ImprovedTransport::fFirstTime
private

Definition at line 204 of file ImprovedTransport_module.cc.

Referenced by beginRun().

CLHEP::RandFlat* photrans::ImprovedTransport::fFlat
private
CLHEP::RandGaussQ* photrans::ImprovedTransport::fGauss
private

Definition at line 202 of file ImprovedTransport_module.cc.

Referenced by ImprovedTransport(), and ~ImprovedTransport().

art::ServiceHandle<geo::Geometry> photrans::ImprovedTransport::fGeo
private

Handle to the geometry service.

Definition at line 194 of file ImprovedTransport_module.cc.

Referenced by LoadHistos(), and StepAlongHit().

double photrans::ImprovedTransport::fLightLevelScale
private

shift overall light yield by multiplicative factor

Definition at line 98 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

std::list< double > photrans::ImprovedTransport::fPETimes
private

List of photo-electron times (each representing one observed PE)

Definition at line 195 of file ImprovedTransport_module.cc.

Referenced by ClusterPhotoElectrons(), CreatePhotoElectrons(), and StepAlongHit().

double photrans::ImprovedTransport::fPhotonsPerMeV
private

blue photon production scale

Definition at line 95 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

CLHEP::RandPoissonQ* photrans::ImprovedTransport::fPoisson
private
uint64_t photrans::ImprovedTransport::fPosCorrEvtId
private

Definition at line 192 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr(), and produce().

std::string photrans::ImprovedTransport::fPosCorrFile
private

Relative path to the cell efficiency maps. If left empty, do not apply this correction.

Definition at line 130 of file ImprovedTransport_module.cc.

Referenced by beginRun(), GetPosCorr(), and LoadPosCorrHists().

TRandom3 photrans::ImprovedTransport::fPosCorrHasher
private

Definition at line 191 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr().

uint16_t photrans::ImprovedTransport::fPosCorrMapIndex = -1
private

Definition at line 180 of file ImprovedTransport_module.cc.

Referenced by SetPosCorrMapIndex().

fhicl::ParameterSet photrans::ImprovedTransport::fPSetFD
private

Definition at line 93 of file ImprovedTransport_module.cc.

Referenced by beginRun().

fhicl::ParameterSet photrans::ImprovedTransport::fPSetND
private

Definition at line 93 of file ImprovedTransport_module.cc.

Referenced by beginRun().

fhicl::ParameterSet photrans::ImprovedTransport::fPSetNDOS
private

Definition at line 93 of file ImprovedTransport_module.cc.

Referenced by beginRun().

fhicl::ParameterSet photrans::ImprovedTransport::fPSetTB
private

Definition at line 93 of file ImprovedTransport_module.cc.

Referenced by beginRun().

double photrans::ImprovedTransport::fQuantumEff
private

APD quantum efficiency.

Definition at line 100 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

RandHisto* photrans::ImprovedTransport::fRandHisto
private
std::list< RateInfo > photrans::ImprovedTransport::fRateInfo
private

List of RateInfo object.

Definition at line 196 of file ImprovedTransport_module.cc.

Referenced by LoadHistos(), and StepAlongHit().

double photrans::ImprovedTransport::fScintAlphaDEDX
private

Approximate dE/dx of alphas used to determine PDF.

Definition at line 124 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and ScintTime().

std::vector<double> photrans::ImprovedTransport::fScintAlphaProb
private

Cumulative probability for each exponential component for alphas.

Definition at line 125 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and ScintTime().

std::vector<double> photrans::ImprovedTransport::fScintAlphaTau
private

Time constants of each exponential component for alphas.

Definition at line 126 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and ScintTime().

double photrans::ImprovedTransport::fScintBetaDEDX
private

Approximate dE/dx of betas used to determine PDF.

Definition at line 121 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and ScintTime().

std::vector<double> photrans::ImprovedTransport::fScintBetaProb
private

Cumulative probability for each exponential component for betas.

Definition at line 122 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and ScintTime().

std::vector<double> photrans::ImprovedTransport::fScintBetaTau
private

Time constants of each exponential component for betas.

Definition at line 123 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and ScintTime().

TH1D* photrans::ImprovedTransport::fScintTime
private

Definition at line 207 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and CreatePhotoElectrons().

std::unique_ptr<std::vector<sim::PhotonSignal> > photrans::ImprovedTransport::fSignals
private

Produced vector of PhotonSignals.

Definition at line 198 of file ImprovedTransport_module.cc.

Referenced by ClusterPhotoElectrons(), produce(), and StepAlongHit().

bool photrans::ImprovedTransport::fSimulateDrift
private

whether to vary light level as a function of time

Definition at line 115 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

std::vector<TH2D *> photrans::ImprovedTransport::fSmallHorizBubbleClumpMap
private

Definition at line 165 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr(), LoadPosCorrHists(), and SetPosCorrMapIndex().

std::vector<TH2D *> photrans::ImprovedTransport::fSmallHorizBubbleMap
private

Definition at line 164 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr(), LoadPosCorrHists(), and SetPosCorrMapIndex().

std::vector<TH2D *> photrans::ImprovedTransport::fSmallHorizClumpMap
private

Definition at line 161 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr(), LoadPosCorrHists(), and SetPosCorrMapIndex().

std::vector<TH2D *> photrans::ImprovedTransport::fSmallHorizMap
private

Definition at line 160 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr(), LoadPosCorrHists(), and SetPosCorrMapIndex().

std::vector<TH2D *> photrans::ImprovedTransport::fSmallVertCornerMap
private

Definition at line 174 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr(), LoadPosCorrHists(), and SetPosCorrMapIndex().

std::vector<TH2D *> photrans::ImprovedTransport::fSmallVertMap
private

Definition at line 173 of file ImprovedTransport_module.cc.

Referenced by GetPosCorr(), LoadPosCorrHists(), and SetPosCorrMapIndex().

std::string photrans::ImprovedTransport::fSmearingHistoFile
private

Relative path to the fiber smearing histo file.

Definition at line 110 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and LoadHistos().

double photrans::ImprovedTransport::fStep
private

step size for walking along the track (cm)

Definition at line 106 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

double photrans::ImprovedTransport::fTimeClustering
private

groups photons closer than this many ns apart

Definition at line 104 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and ClusterPhotoElectrons().

TH1D photrans::ImprovedTransport::fTweak_X
private

A data/mc correction for the X-View.

Definition at line 138 of file ImprovedTransport_module.cc.

Referenced by LoadHistos(), and StepAlongHit().

TH1D photrans::ImprovedTransport::fTweak_XMC
private

A data/mc correction for the X-View in the muon catcher.

Definition at line 140 of file ImprovedTransport_module.cc.

Referenced by StepAlongHit().

TH1D photrans::ImprovedTransport::fTweak_Y
private

A data/mc correction for the Y-View.

Definition at line 139 of file ImprovedTransport_module.cc.

Referenced by LoadHistos(), and StepAlongHit().

TH1D photrans::ImprovedTransport::fTweak_YMC
private

A data/mc correction for the Y-View in the muon catcher.

Definition at line 141 of file ImprovedTransport_module.cc.

Referenced by StepAlongHit().

std::string photrans::ImprovedTransport::fTweakFile
private

Relative path to the data driven attenuation correction for each view.

Definition at line 114 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and LoadHistos().

bool photrans::ImprovedTransport::fUseScintTime
private

Turn on sampling from PDF of scintillator decay time, see arXiv:1704.02291 for more details.

Definition at line 119 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and CreatePhotoElectrons().

bool photrans::ImprovedTransport::fWriteEmptySignals
private

Write an empty PhotonSignal if there's 0 PE.

Definition at line 105 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

double photrans::ImprovedTransport::fXViewFactor
private

scale factor for the x-view

Definition at line 96 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

double photrans::ImprovedTransport::fYViewFactor
private

scale factor for the y-view

Definition at line 97 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and StepAlongHit().

int photrans::ImprovedTransport::msglevel
private

Definition at line 132 of file ImprovedTransport_module.cc.

Referenced by beginRun(), and LoadPosCorrHists().


The documentation for this class was generated from the following file: