OpDetResponseInterface.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file OpDetResponse.h
3 //
4 // \brief service containing information about the response of optical detectors
5 //
6 // \author ahimmel@phy.duke.edu
7 //
8 ////////////////////////////////////////////////////////////////////////
9 
10 #ifndef OPDET_RESPONSE_INTERFACE_H
11 #define OPDET_RESPONSE_INTERFACE_H
12 
13 // LArSoft includes
14 //#include "OpticalDetectorData/OpticalTypes.h"
17 
18 // ART includes
19 #include "fhiclcpp/ParameterSet.h"
21 
22 #include "CLHEP/Random/RandFlat.h"
23 
24 
25 namespace opdet
26 {
28  public:
29 
30  virtual ~OpDetResponseInterface() = default;
31 
32  virtual void reconfigure(fhicl::ParameterSet const& p);
33 
34  virtual int NOpChannels() const;
35 
36  // Can only uniquely go from readout to geometry since
37  // one geometrical channel goes to multiple readout channels
38  virtual int readoutToGeoChannel(int readoutChannel) const;
39 
40  virtual bool detected(int OpChannel, const sim::OnePhoton& Phot, int &newOpChannel) const;
41  virtual bool detected(int OpChannel, const sim::OnePhoton& Phot) const;
42  virtual bool detectedLite(int OpChannel, int &newOpChannel) const;
43  virtual bool detectedLite(int OpChannel) const;
44 
45  virtual float wavelength(double energy) const;
46 
47  private:
48  virtual void doReconfigure(fhicl::ParameterSet const& p) = 0;
49 
50  virtual int doNOpChannels() const;
51  virtual int doReadoutToGeoChannel(int readoutChannel) const;
52 
53  virtual bool doDetected(int OpChannel, const sim::OnePhoton& Phot, int &newOpChannel) const = 0;
54  virtual bool doDetectedLite(int OpChannel, int &newOpChannel) const = 0;
55 
56  }; // class OpDetResponse
57 
58 
59  //-------------------------------------------------------------------------------------------------------------
61  {
62  doReconfigure(p);
63  }
64 
65 
66 
67 
68  //-------------------------------------------------------------------------------------------------------------
70  {
71  return doNOpChannels();
72  }
73 
74  //-------------------------------------------------------------------------------------------------------------
76  {
77  // By default return the number of detector channels
79  return geom->NOpChannels();
80  }
81 
82  //-------------------------------------------------------------------------------------------------------------
83  inline int OpDetResponseInterface::readoutToGeoChannel(int readoutChannel) const
84  {
85  return doReadoutToGeoChannel(readoutChannel);
86  }
87 
88  //-------------------------------------------------------------------------------------------------------------
89  inline int OpDetResponseInterface::doReadoutToGeoChannel(int readoutChannel) const
90  {
91  // Pass this call off to the geometry service
93  return geom->OpDetFromOpChannel(readoutChannel);
94  }
95 
96 
97 
98 
99  //-------------------------------------------------------------------------------------------------------------
100  inline bool OpDetResponseInterface::detected(int OpChannel, const sim::OnePhoton& Phot, int &newOpChannel) const
101  {
102  return doDetected(OpChannel, Phot, newOpChannel);
103  }
104 
105  //-------------------------------------------------------------------------------------------------------------
106  inline bool OpDetResponseInterface::detected(int OpChannel, const sim::OnePhoton& Phot) const
107  {
108  int newOpChannel;
109  return doDetected(OpChannel, Phot, newOpChannel);
110  }
111 
112  //-------------------------------------------------------------------------------------------------------------
113  inline bool OpDetResponseInterface::detectedLite(int OpChannel, int &newOpChannel) const
114  {
115  return doDetectedLite(OpChannel, newOpChannel);
116  }
117 
118  //-------------------------------------------------------------------------------------------------------------
120  {
121  int newOpChannel;
122  return doDetectedLite(OpChannel, newOpChannel);
123  }
124 
125  //-------------------------------------------------------------------------------------------------------------
126  inline float OpDetResponseInterface::wavelength(double energy) const
127  {
128  return (2.0*3.142)*0.000197/energy;
129  }
130 
131 } //namespace opdet
132 
133 
135 
136 #endif //OPDET_RESPONSE_H
Index OpChannel(Index detNum, Index channel)
virtual void reconfigure(fhicl::ParameterSet const &p)
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:64
virtual bool detected(int OpChannel, const sim::OnePhoton &Phot, int &newOpChannel) const
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
art framework interface to geometry description
unsigned int OpDetFromOpChannel(int opChannel) const
Convert unique channel to detector number.
virtual void doReconfigure(fhicl::ParameterSet const &p)=0
Simulation objects for optical detectors.
virtual ~OpDetResponseInterface()=default
p
Definition: test.py:223
virtual bool doDetected(int OpChannel, const sim::OnePhoton &Phot, int &newOpChannel) const =0
virtual bool detectedLite(int OpChannel, int &newOpChannel) const
virtual bool doDetectedLite(int OpChannel, int &newOpChannel) const =0
virtual int doReadoutToGeoChannel(int readoutChannel) const
virtual int readoutToGeoChannel(int readoutChannel) const
#define DECLARE_ART_SERVICE_INTERFACE(svc, scope)
virtual float wavelength(double energy) const