Public Member Functions | Private Member Functions | Private Attributes | List of all members
opdet::DUNEOpDetResponse Class Reference

#include <DUNEOpDetResponse.h>

Inheritance diagram for opdet::DUNEOpDetResponse:
opdet::OpDetResponseInterface

Public Member Functions

 DUNEOpDetResponse (fhicl::ParameterSet const &pset, art::ActivityRegistry &reg)
 
 ~DUNEOpDetResponse () throw ()
 
bool detectedLiteWithChannel (int OpDet, int &newOpChannel, int &hardwareChannel) const
 
- Public Member Functions inherited from opdet::OpDetResponseInterface
virtual ~OpDetResponseInterface ()=default
 
virtual void reconfigure (fhicl::ParameterSet const &p)
 
virtual int NOpChannels () const
 
virtual int readoutToGeoChannel (int readoutChannel) const
 
virtual bool detected (int OpChannel, const sim::OnePhoton &Phot, int &newOpChannel) const
 
virtual bool detected (int OpChannel, const sim::OnePhoton &Phot) const
 
virtual bool detectedLite (int OpChannel, int &newOpChannel) const
 
virtual bool detectedLite (int OpChannel) const
 
virtual float wavelength (double energy) const
 

Private Member Functions

virtual void doReconfigure (fhicl::ParameterSet const &p)
 
virtual int doNOpChannels () const
 
virtual bool doDetected (int OpDet, const sim::OnePhoton &Phot, int &newOpChannel) const
 
virtual bool doDetectedLite (int OpDet, int &newOpChannel) const
 
bool doDetectedLiteWithChannel (int OpDet, int &newOpChannel, int &hardwareChannel) const
 

Private Attributes

float fQE
 
float fWavelengthCutLow
 
float fWavelengthCutHigh
 
bool fLightGuideAttenuation
 
double lambdaShort
 
double lambdaLong
 
double fracShort
 
double fracLong
 
std::string fChannelConversion
 
bool fFullSimChannelConvert
 
bool fFastSimChannelConvert
 
int fLongAxis
 

Detailed Description

Definition at line 22 of file DUNEOpDetResponse.h.

Constructor & Destructor Documentation

opdet::DUNEOpDetResponse::DUNEOpDetResponse ( fhicl::ParameterSet const &  pset,
art::ActivityRegistry reg 
)

Definition at line 22 of file DUNEOpDetResponse_service.cc.

24  {
25  this->doReconfigure(pset);
26  }
virtual void doReconfigure(fhicl::ParameterSet const &p)
opdet::DUNEOpDetResponse::~DUNEOpDetResponse ( )
throw (
)

Definition at line 29 of file DUNEOpDetResponse_service.cc.

30  { }

Member Function Documentation

bool opdet::DUNEOpDetResponse::detectedLiteWithChannel ( int  OpDet,
int &  newOpChannel,
int &  hardwareChannel 
) const
inline

Definition at line 31 of file DUNEOpDetResponse.h.

32  {
33  return doDetectedLiteWithChannel( OpDet, newOpChannel, hardwareChannel);
34  }
bool doDetectedLiteWithChannel(int OpDet, int &newOpChannel, int &hardwareChannel) const
bool opdet::DUNEOpDetResponse::doDetected ( int  OpDet,
const sim::OnePhoton Phot,
int &  newOpChannel 
) const
privatevirtual

Implements opdet::OpDetResponseInterface.

Definition at line 95 of file DUNEOpDetResponse_service.cc.

96  {
97 
98  // Find the Optical Detector using the geometry service
100 
101 
103  // Override default number of channels for Fiber and Plank
104  float NOpHardwareChannels = geom->NOpHardwareChannels(OpDet);
105  int hardwareChannel = (int) ( CLHEP::RandFlat::shoot(1.0) * NOpHardwareChannels );
106  newOpChannel = geom->OpChannel(OpDet, hardwareChannel);
107  }
108  else{
109  newOpChannel = OpDet;
110  }
111 
112  // Check QE
113  if ( CLHEP::RandFlat::shoot(1.0) > fQE ) return false;
114 
115  double wavel = wavelength(Phot.Energy);
116  // Check wavelength acceptance
117  if (wavel < fWavelengthCutLow) return false;
118  if (wavel > fWavelengthCutHigh) return false;
119 
121  // Get the length of the photon detector
122  const TGeoNode* node = geom->OpDetGeoFromOpDet(OpDet).Node();
123  TGeoBBox *box = (TGeoBBox*)node->GetVolume()->GetShape();
124  double opdetLength = 0;
125  double sipmDistance = 0;
126 
127  if (fLongAxis == 0) {
128  opdetLength = box->GetDX();
129  sipmDistance = opdetLength - Phot.FinalLocalPosition.x();
130  }
131  else if (fLongAxis == 1) {
132  opdetLength = box->GetDY();
133  sipmDistance = opdetLength - Phot.FinalLocalPosition.y();
134  }
135  else if (fLongAxis == 2) {
136  opdetLength = box->GetDZ();
137  sipmDistance = opdetLength - Phot.FinalLocalPosition.z();
138  }
139  else {
140  mf::LogError("DUNEOpDetResponse") << "Unknown axis, fLongAxis = " << fLongAxis;
141  std::abort();
142  }
143 
144 
145 
146  // Throw away some photons based on attenuation
147  double AttenuationProb = fracShort*exp(-sipmDistance/lambdaShort) + fracLong*exp(-sipmDistance/lambdaLong);
148 
149  //mf::LogVerbatim("DUNEOpDetResponse") << "OpDet: " << OpDet
150  // << " has length " << opdetLength << " in detector "
151  // << box->GetDX() << " x " << box->GetDY() << " x " << box->GetDZ();
152  //mf::LogVerbatim("DUNEOpDetResponse") << " Local Position = (" << Phot.FinalLocalPosition.x()
153  // << ", " << Phot.FinalLocalPosition.y() << ", " << Phot.FinalLocalPosition.z() << ")";
154  //mf::LogVerbatim("DUNEOpDetResponse") << " Distance to SiPM = " << sipmDistance << " along axis " << fLongAxis;
155  //mf::LogVerbatim("DUNEOpDetResponse") << " Attenuation Probability = " << AttenuationProb;
156 
157  if ( CLHEP::RandFlat::shoot(1.0) > AttenuationProb ) return false;
158 
159 
160  }
161 
162  return true;
163  }
const TGeoNode * Node() const
Returns the ROOT object describing the detector geometry.
Definition: OpDetGeo.h:146
OpDetGeo const & OpDetGeoFromOpDet(unsigned int OpDet) const
Returns the geo::OpDetGeo object for the given detector number.
unsigned int NOpHardwareChannels(int opDet) const
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
unsigned int OpChannel(int detNum, int hardwareChannel) const
Convert detector number and hardware channel to unique channel.
Index NOpHardwareChannels(Index opDet)
geo::OpticalPoint_t FinalLocalPosition
Where photon enters the optical detector in local coordinates [cm].
Definition: SimPhotons.h:75
float Energy
Scintillation photon energy [GeV].
Definition: SimPhotons.h:82
virtual float wavelength(double energy) const
bool opdet::DUNEOpDetResponse::doDetectedLite ( int  OpDet,
int &  newOpChannel 
) const
privatevirtual

Implements opdet::OpDetResponseInterface.

Definition at line 166 of file DUNEOpDetResponse_service.cc.

167  {
169 
170  // Find the Optical Detector using the geometry service
172  // Here OpDet must be opdet since we are introducing
173  // channel mapping here.
174  float NOpHardwareChannels = geom->NOpHardwareChannels(OpDet);
175  int hardwareChannel = (int) ( CLHEP::RandFlat::shoot(1.0) * NOpHardwareChannels );
176  newOpChannel = geom->OpChannel(OpDet, hardwareChannel);
177  }
178  else{
179  newOpChannel = OpDet;
180  }
181 
182  // Check QE
183  if ( CLHEP::RandFlat::shoot(1.0) > fQE ) return false;
184 
185 
186  return true;
187  }
unsigned int NOpHardwareChannels(int opDet) const
unsigned int OpChannel(int detNum, int hardwareChannel) const
Convert detector number and hardware channel to unique channel.
Index NOpHardwareChannels(Index opDet)
bool opdet::DUNEOpDetResponse::doDetectedLiteWithChannel ( int  OpDet,
int &  newOpChannel,
int &  hardwareChannel 
) const
private

Definition at line 190 of file DUNEOpDetResponse_service.cc.

191  {
193 
194  // Find the Optical Detector using the geometry service
196  // Here OpDet must be opdet since we are introducing
197  // channel mapping here.
198  float NOpHardwareChannels = geom->NOpHardwareChannels(OpDet);
199  hardwareChannel = (int) ( CLHEP::RandFlat::shoot(1.0) * NOpHardwareChannels );
200  newOpChannel = geom->OpChannel(OpDet, hardwareChannel);
201  }
202  else{
203  newOpChannel = OpDet;
204  }
205 
206  // Check QE
207  if ( CLHEP::RandFlat::shoot(1.0) > fQE ) return false;
208 
209 
210  return true;
211  }
unsigned int NOpHardwareChannels(int opDet) const
unsigned int OpChannel(int detNum, int hardwareChannel) const
Convert detector number and hardware channel to unique channel.
Index NOpHardwareChannels(Index opDet)
int opdet::DUNEOpDetResponse::doNOpChannels ( ) const
privatevirtual

Reimplemented from opdet::OpDetResponseInterface.

Definition at line 83 of file DUNEOpDetResponse_service.cc.

84  {
87  return geom->NOpChannels();
88  else
89  return geom->NOpDets();
90 
91  }
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
unsigned int NOpDets() const
Number of OpDets in the whole detector.
void opdet::DUNEOpDetResponse::doReconfigure ( fhicl::ParameterSet const &  p)
privatevirtual

Implements opdet::OpDetResponseInterface.

Definition at line 34 of file DUNEOpDetResponse_service.cc.

35  {
36  double tempfQE = pset.get<double>("QuantumEfficiency");
37  fWavelengthCutLow = pset.get<double>("WavelengthCutLow");
38  fWavelengthCutHigh = pset.get<double>("WavelengthCutHigh");
39  fLightGuideAttenuation = pset.get<bool>("LightGuideAttenuation");
40  lambdaShort = pset.get<double>("LambdaShort");
41  lambdaLong = pset.get<double>("LambdaLong");
42  fracShort = pset.get<double>("FracShort");
43  fracLong = pset.get<double>("FracLong");
44  fChannelConversion = pset.get<std::string>("ChannelConversion");
45  std::string tmpAxis = pset.get<std::string>("LongAxis");
46 
47  boost::algorithm::to_lower(tmpAxis);
48 
49  if (tmpAxis == "x") fLongAxis = 0;
50  if (tmpAxis == "y") fLongAxis = 1;
51  if (tmpAxis == "z") fLongAxis = 2;
52 
53  // Only allow channel conversion once - so it must be set to happen
54  // either during full simulation (library generation) or during
55  // fast simulation (library use).
56 
57  boost::algorithm::to_lower(fChannelConversion);
58 
59  fFullSimChannelConvert = false;
60  fFastSimChannelConvert = false;
61 
62  if (fChannelConversion == "full") fFullSimChannelConvert = true;
63  if (fChannelConversion == "fast") fFastSimChannelConvert = true;
64 
65  // Correct out the prescaling applied during simulation
66  auto const *LarProp = lar::providerFrom<detinfo::LArPropertiesService>();
67  fQE = tempfQE / LarProp->ScintPreScale();
68 
69  if (fQE > 1.0001 ) {
70  mf::LogError("DUNEOpDetResponse_service") << "Quantum efficiency set in OpDetResponse_service, " << tempfQE
71  << " is too large. It is larger than the prescaling applied during simulation, "
72  << LarProp->ScintPreScale()
73  << " (fQE="
74  << fQE
75  << "). Final QE must be equal to or smaller than the QE applied at simulation time.";
76  std::abort();
77  }
78 
79  }
std::string string
Definition: nybbler.cc:12
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError

Member Data Documentation

std::string opdet::DUNEOpDetResponse::fChannelConversion
private

Definition at line 60 of file DUNEOpDetResponse.h.

bool opdet::DUNEOpDetResponse::fFastSimChannelConvert
private

Definition at line 62 of file DUNEOpDetResponse.h.

bool opdet::DUNEOpDetResponse::fFullSimChannelConvert
private

Definition at line 61 of file DUNEOpDetResponse.h.

bool opdet::DUNEOpDetResponse::fLightGuideAttenuation
private

Definition at line 53 of file DUNEOpDetResponse.h.

int opdet::DUNEOpDetResponse::fLongAxis
private

Definition at line 64 of file DUNEOpDetResponse.h.

float opdet::DUNEOpDetResponse::fQE
private

Definition at line 48 of file DUNEOpDetResponse.h.

double opdet::DUNEOpDetResponse::fracLong
private

Definition at line 57 of file DUNEOpDetResponse.h.

double opdet::DUNEOpDetResponse::fracShort
private

Definition at line 56 of file DUNEOpDetResponse.h.

float opdet::DUNEOpDetResponse::fWavelengthCutHigh
private

Definition at line 51 of file DUNEOpDetResponse.h.

float opdet::DUNEOpDetResponse::fWavelengthCutLow
private

Definition at line 50 of file DUNEOpDetResponse.h.

double opdet::DUNEOpDetResponse::lambdaLong
private

Definition at line 55 of file DUNEOpDetResponse.h.

double opdet::DUNEOpDetResponse::lambdaShort
private

Definition at line 54 of file DUNEOpDetResponse.h.


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