Fiber.cc
Go to the documentation of this file.
1 #include <mdet/Fiber.h>
2 
3 #include <mdet/Scintillator.h>
4 #include <mdet/MHierarchyInfo.h>
5 #include <mdet/Module.h>
6 //
7 #include <utl/Vector.h>
8 #include <utl/RandomEngine.h>
9 //
10 #include <fwk/RandomEngineRegistry.h>
11 //
12 #include <CLHEP/Random/RandPoisson.h>
13 #include <CLHEP/Random/RandExponential.h>
14 //
15 #include <cmath>
16 
17 namespace {
18 
19  struct ScintShaper
20  {
21  double GetWidth() const
22  {
23  return fW;
24  }
25  double GetLength() const
26  {
27  return fL;
28  }
29  double GetHeight() const
30  {
31  return fH;
32  }
33  void Box(const mdet::Scintillator&, double w, double l, double h)
34  {
35  fW = w;
36  fL = l;
37  fH = h;
38  }
39  // No need to init them: the call to Box does that job.
40  double fW;
41  double fL;
42  double fH;
43  };
44 
45 }
46 
47 namespace mdet {
48 
49  const char* const
51 
52  const char* const
54 
55  // Implement the pure virtual method from MPositionable.
58  const
59  {
60  // We refer to the Scints's system.
62  }
63 
64  double
66  const
67  {
68  return GetData(fOnManifoldLength, "onManifoldLength");
69  }
70 
71  double
73  const
74  {
75  // return GetData(fOnScintillatorLength, "onScintillatorLength");
76  /*
77  * Total overlap with its scintillator: it's glued in the scint.
78  *
79  * Note that this fact is not coupled to the actual position, which
80  * is given by configuration: we leave those degrees of freedom, tough
81  * assuming always this total overlap.
82  */
83  ScintShaper s;
84  return GetModule().GetScintillatorFor(*this).VisitShape(s).GetLength();
85  }
86 
87  double
89  const
90  {
91  return GetData(fRadius, "radius");
92  }
93 
94  double
96  const
97  {
98  return GetData(fRadius, "numericalAperture");
99  }
100 
101  double
103  const
104  {
105  return GetData(fRefractionIndex, "refractionIndex");
106  }
107 
108  double
110  const
111  {
112  return GetData(fDecayTime, "decayTime");
113  }
114 
115  double
117  const
118  {
119  // This method gives sense to the bare number decay time: it's an exponential process.
120  utl::RandomEngine& rnd = fwk::RandomEngineRegistry::GetInstance().Get(fwk::RandomEngineRegistry::eDetector);
121 
122  double decayTime = CLHEP::RandExponential::shoot(& rnd.GetEngine(), GetDecayTime());
123 
124  return decayTime;
125  }
126 
127  double
129  const
130  {
131  // The mean is the parameter.
132  return GetDecayTime();
133  }
134 
135  double
137  const
138  {
139  // For an exponential process the std-dev equals the mean value.
140  return GetDecayDelayMean();
141  }
142 
143  double
145  const
146  {
147  return GetData(fAttenuationLengthA, "attenuationLengthA");
148  }
149 
150  double
152  const
153  {
154  return GetData(fAttenuationLengthB, "attenuationLengthB");
155  }
156 
157  double
159  const
160  {
161  return GetData(fAttenuationAmplitudeA, "attenuationAmplitudeA");
162  }
163 
164  double
166  const
167  {
168  return GetData(fAttenuationAmplitudeB, "attenuationAmplitudeB");
169  }
170 
171  double
173  const
174  {
175  return GetData(fAttenuationLengthASiPM, "attenuationLengthASiPM");
176  }
177 
178  double
180  const
181  {
182  return GetData(fAttenuationLengthBSiPM, "attenuationLengthBSiPM");
183  }
184 
185  double
187  const
188  {
189  return GetData(fAttenuationAmplitudeASiPM, "attenuationAmplitudeASiPM");
190  }
191 
192  double
194  const
195  {
196  return GetData(fAttenuationAmplitudeBSiPM, "attenuationAmplitudeBSiPM");
197  }
198 
199  double
201  const
202  {
203  return GetData(fAttenuationReferenceThickness, "attenuationReferenceThickness");
204  }
205 
206  double
208  const
209  {
210  return GetData(fAttenuationReferenceEnergy, "attenuationReferenceEnergy");
211  }
212 
213  const char * const
215  "thickness",
216  "energy",
217  };
218 
221  const
222  {
223  return AttenuationReferenceCreator::Create(GetData(fAttenuationReference, "attenuationReference"));
224  }
225 
226  unsigned int
227  Fiber::ComputeSPENumber(double x, double l, double e)
228  const
229  {
230 
231  double attenuationAmplitudeA;
232  double attenuationAmplitudeB;
233  double attenuationLengthA;
234  double attenuationLengthB;
235 
236  if(!GetModule().IsSiPM()){
237  attenuationAmplitudeA = GetAttenuationAmplitudeA();
238  attenuationAmplitudeB = GetAttenuationAmplitudeB();
239  attenuationLengthA = GetAttenuationLengthA();
240  attenuationLengthB = GetAttenuationLengthB();
241 
242  }else{
243  attenuationAmplitudeA = GetAttenuationAmplitudeASiPM();
244  attenuationAmplitudeB = GetAttenuationAmplitudeBSiPM();
245  attenuationLengthA = GetAttenuationLengthASiPM();
246  attenuationLengthB = GetAttenuationLengthBSiPM();
247  }
248 
249  double lambda0 = attenuationAmplitudeA * std::exp(-x / attenuationLengthA) +
250  attenuationAmplitudeB * std::exp(-x / attenuationLengthB);
251 
252  double lambda = lambda0;
253  switch (GetAttenuationReference()) {
254  case eThickness:
255  lambda *= l / GetAttenuationReferenceThickness();
256  break;
257  case eEnergy:
258  lambda *= e / GetAttenuationReferenceEnergy();
259  break;
260  }
261  utl::RandomEngine& rnd = fwk::RandomEngineRegistry::GetInstance().Get(fwk::RandomEngineRegistry::eDetector);
262  return CLHEP::RandPoisson::shoot(& rnd.GetEngine(), lambda);
263  }
264 
265 
267  (int fId, const det::VManager::IndexMap& parentMap, const Module& parent) :
268  MDetectorComponent<Fiber>::Type(fId, parentMap),
270  fModule(parent)
271  {
272  Register(fOnScintillatorLength);
273  Register(fOnManifoldLength);
274  Register(fNumericalAperture);
275  Register(fRadius);
276  Register(fRefractionIndex);
277  Register(fDecayTime);
278  Register(fAttenuationLengthA);
279  Register(fAttenuationLengthB);
280  Register(fAttenuationAmplitudeA);
281  Register(fAttenuationAmplitudeB);
282  Register(fAttenuationReferenceThickness);
283  }
284 
285 }
double GetAttenuationLengthASiPM() const
Definition: Fiber.cc:172
AttenuationReference GetAttenuationReference() const
Return the type of refrence to use.
Definition: Fiber.cc:220
double GetOnScintillatorLength() const
The length of the fiber along its scintillator.
Definition: Fiber.cc:72
double GetAttenuationAmplitudeA() const
Definition: Fiber.cc:158
utl::Validated< double > fRefractionIndex
Definition: Fiber.h:258
static EnumType Create(const int k)
int version of the overloaded creation method.
utl::Validated< double > fAttenuationAmplitudeBSiPM
Definition: Fiber.h:276
RandomEngineType & GetEngine()
Definition: RandomEngine.h:32
unsigned int ComputeSPENumber(double x, double l, double e) const
Computes a number of SPE given the impinging distance, the length of the track and the energy of the ...
Definition: Fiber.cc:227
Mixin class to be inherited from objects that have a position.
static const char *const kComponentsNames[13]
det::DetectorComponent< C, MManagerProvider > Type
Type specializing det::DetectorComponent for Muon hierarchy.
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Local system based on position and configured rotations.
utl::Validated< double > fAttenuationAmplitudeASiPM
Definition: Fiber.h:274
static const char *const kComponentsIds[13]
double GetRadius() const
The radius of the fiber.
Definition: Fiber.cc:88
utl::Validated< double > fAttenuationReferenceEnergy
Definition: Fiber.h:280
static const char *const AttenuationReferenceTags[]
Tags for textual representation.
Definition: Fiber.h:179
double GetAttenuationLengthA() const
Definition: Fiber.cc:144
double GetAttenuationLengthBSiPM() const
Definition: Fiber.cc:179
T & GetData(P< T > &d, const std::string &p) const
Common utility function for configuration.
utl::Validated< double > fAttenuationLengthB
Definition: Fiber.h:264
Actual muon-sensitive objects.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
constexpr double s
Definition: AugerUnits.h:163
double GetDecayTime() const
The characteristic decay time of the fiber.
Definition: Fiber.cc:109
double GetNumericalAperture() const
The numerical aperture of the fiber.
Definition: Fiber.cc:95
Wraps the random number engine used to generate distributions.
Definition: RandomEngine.h:27
utl::Validated< double > fAttenuationLengthASiPM
Definition: Fiber.h:270
Array of Scintillator.
AttenuationReference
Kinds of possible attenuation references.
Definition: Fiber.h:169
V & VisitShape(V &v) const
Callback method for inspecting shape-aware properties.
double GetAttenuationReferenceThickness() const
Definition: Fiber.cc:200
utl::Validated< double > fAttenuationAmplitudeB
Definition: Fiber.h:268
utl::Validated< double > fAttenuationLengthA
Definition: Fiber.h:262
const Scintillator & GetScintillatorFor(const Component &c) const
Returns the associated mdet::Scintillator.
utl::CoordinateSystemPtr GetReferenceCoordinateSystem() const
The reference is the local coordinate system of mdet::Scintillator.
Definition: Fiber.cc:57
double GetAttenuationAmplitudeASiPM() const
Definition: Fiber.cc:186
double GetDecayDelayMean() const
The mean value of the delay time.
Definition: Fiber.cc:128
double GetDecayDelayStdDev() const
The standard deviation fo the delay time.
Definition: Fiber.cc:136
utl::Validated< AttenuationReferenceForConfig > fAttenuationReference
Definition: Fiber.h:288
utl::Validated< double > fRadius
Definition: Fiber.h:256
utl::Validated< double > fAttenuationLengthBSiPM
Definition: Fiber.h:272
const Module & GetModule() const
Retrieve the parent mdet::Module.
Definition: Fiber.h:144
static const char *const kComponentId
Definition: Fiber.h:62
double GetAttenuationAmplitudeBSiPM() const
Definition: Fiber.cc:193
std::map< std::string, std::string > IndexMap
Definition: VManager.h:133
double GetAttenuationAmplitudeB() const
Definition: Fiber.cc:165
utl::Validated< double > fDecayTime
Definition: Fiber.h:260
double GetAttenuationLengthB() const
Definition: Fiber.cc:151
utl::Validated< double > fOnManifoldLength
Definition: Fiber.h:252
double ComputeDecayDelay() const
Computes a delay due to decay process.
Definition: Fiber.cc:116
static const char *const kComponentName
Definition: Fiber.h:60
utl::Validated< double > fAttenuationAmplitudeA
Definition: Fiber.h:266
double GetAttenuationReferenceEnergy() const
Definition: Fiber.cc:207
Fiber(int fId, const det::VManager::IndexMap &parentMap, const Module &parent)
Constructs the Fiber (obviously!).
Definition: Fiber.cc:267
utl::Validated< double > fAttenuationReferenceThickness
Definition: Fiber.h:278
double GetRefractionIndex() const
The refraction (or refractive) index of the fiber.
Definition: Fiber.cc:102
double GetOnManifoldLength() const
The length of the fiber along the path that joins the scintillator to its pixel on the PMT...
Definition: Fiber.cc:65

, generated on Tue Sep 26 2023.