12 #ifndef SIPMOpSensorSim_h 13 #define SIPMOpSensorSim_h 26 #include "art_root_io/TFileService.h" 27 #include "art_root_io/TFileDirectory.h" 32 #include "nurandom/RandomUtils/NuRandomService.h" 52 #include "CLHEP/Random/RandExponential.h" 53 #include "CLHEP/Random/RandFlat.h" 54 #include "CLHEP/Random/RandPoissonQ.h" 153 produces< std::vector< sim::OpDetDivRec > >();
159 <<
"Dark noise rate should be non-negative!\n";
164 if (tempQE < 0 || tempQE > 1) {
168 <<
" leading to total efficiency: " << tempQE <<
"\n" 169 <<
"It should be between 0 and 1!\n";
173 auto const *LarProp = lar::providerFrom<detinfo::LArPropertiesService>();
174 fQE = tempQE / LarProp->ScintPreScale();
180 <<
" leading to total efficiency: " << tempQE <<
"\n" 182 <<
"It is larger than the prescaling applied during simulation, " << LarProp->ScintPreScale() <<
".\n" 183 <<
"Final QE must be equal to or smaller than the QE applied at simulation time.\n";
189 for (
unsigned int opDet = 0; opDet < geometry->
NOpDets() ; ++opDet) {
193 <<
" channels associated with it. \n" 194 <<
"This kind of channel mapping is not supported by SIPMOpSensorSim.\n" 195 <<
"You need to use the legacy OpDetDigitizerDUNE instead.\n";
208 if (haveBoundary != haveCorrection) {
210 <<
"Must specify both LateLightCorrection and LateLightBoundary in order to apply correction.\n" 211 <<
"Leave both out to not adjust late light.\n";
222 <<
"It is larger than the prescaling applied during simulation, " << LarProp->ScintPreScale() <<
".\n" 223 <<
"Final QE must be equal to or smaller than the QE applied at simulation time.\n";
232 auto OpDetDivRecPtr = std::make_unique< std::vector< sim::OpDetDivRec > >();
235 auto const & btr_handle =
event.getValidHandle(
fInputToken);
238 for (
auto const& btr : *btr_handle) {
239 int opDet = btr.OpDetNum();
250 OpDetDivRecPtr->emplace_back(DivRecPlusNoise);
269 if (time < firstTime) firstTime = time;
276 double lateScale = 1.;
283 for(
auto const& sdp : sdps) {
289 for(
int truePh=0; truePh<nphot; ++truePh) {
293 for(
unsigned int i = 0; i < PE; i++) {
324 for(
int j = 0; j < PE; j++) {
342 double maxDrift = 0.0;
343 for (
geo::TPCGeo const& tpc : geometry->IterateTPCs())
344 if (maxDrift < tpc.DriftDistance()) maxDrift = tpc.DriftDistance();
347 fTimeBegin = -1*maxDrift/detProp.DriftVelocity();
351 fTimeEnd = detProp.ReadOutWindowSize() / clockData.TPCClock().Frequency();
base_engine_t & createEngine(seed_t seed)
CLHEP::HepRandomEngine & fSIPMEngine
Store parameters for running LArG4.
fhicl::Atom< art::InputTag > InputTag
double fLateLightCorrection
EDProducer(fhicl::ParameterSet const &pset)
Geometry information for a single TPC.
fhicl::Atom< double > CrossTalk
ChannelGroupService::Name Name
unsigned int NOpHardwareChannels(int opDet) const
fhicl::Atom< double > DarkNoiseRate
Energy deposited on a readout Optical Detector by simulated tracks.
SIPMOpSensorSim(Parameters const &config)
fhicl::OptionalAtom< double > LateLightCorrection
Simulation objects for optical detectors.
int OpDetNum() const
Returns the readout Optical Detector this object describes.
#define DEFINE_ART_MODULE(klass)
unsigned short CrossTalk()
void AddDarkNoise(sim::OpDetDivRec &)
CLHEP::RandPoissonQ fRandPoissPhot
void produce(art::Event &) override
art::ProductToken< std::vector< sim::OpDetBacktrackerRecord > > fInputToken
CLHEP::RandFlat fRandFlat
unsigned int NOpDets() const
Number of OpDets in the whole detector.
fhicl::OptionalAtom< double > LateLightBoundary
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
CLHEP::RandExponential fRandExponential
fhicl::Atom< double > Correction
double fLateLightBoundary
fhicl::Atom< double > QuantumEfficiency
Tools and modules for checking out the basics of the Monte Carlo.
timePDclockSDPs_t const & timePDclockSDPsMap() const
Returns all the deposited energy information as stored.
void AddPhoton(int opchan, int tid, OpDet_Time_Chans::stored_time_t pdTime)
Event finding and building.
void PhotonsToPE(sim::OpDetBacktrackerRecord const &btr, sim::OpDetDivRec &dr_plusnoise)