All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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
15 namespace sim { struct OnePhoton; }
16 
17 // ART includes
18 #include "art/Framework/Services/Registry/ServiceHandle.h"
19 #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
20 namespace fhicl { class ParameterSet; }
21 
22 namespace opdet
23 {
25  public:
26 
27  virtual ~OpDetResponseInterface() = default;
28 
29  virtual void reconfigure(fhicl::ParameterSet const& p);
30 
31  virtual int NOpChannels() const;
32 
33  // Can only uniquely go from readout to geometry since
34  // one geometrical channel goes to multiple readout channels
35  virtual int readoutToGeoChannel(int readoutChannel) const;
36 
37  virtual bool detected(int OpChannel, const sim::OnePhoton& Phot, int &newOpChannel) const;
38  virtual bool detected(int OpChannel, const sim::OnePhoton& Phot) const;
39  virtual bool detectedLite(int OpChannel, int &newOpChannel) const;
40  virtual bool detectedLite(int OpChannel) const;
41 
42  virtual float wavelength(double energy) const;
43 
44  private:
45  virtual void doReconfigure(fhicl::ParameterSet const& p) = 0;
46 
47  virtual int doNOpChannels() const;
48  virtual int doReadoutToGeoChannel(int readoutChannel) const;
49 
50  virtual bool doDetected(int OpChannel, const sim::OnePhoton& Phot, int &newOpChannel) const = 0;
51  virtual bool doDetectedLite(int OpChannel, int &newOpChannel) const = 0;
52 
53  }; // class OpDetResponse
54 
55 
56  //-------------------------------------------------------------------------------------------------------------
57  inline void OpDetResponseInterface::reconfigure(fhicl::ParameterSet const& p)
58  {
59  doReconfigure(p);
60  }
61 
62 
63 
64 
65  //-------------------------------------------------------------------------------------------------------------
67  {
68  return doNOpChannels();
69  }
70 
71  //-------------------------------------------------------------------------------------------------------------
73  {
74  // By default return the number of detector channels
75  art::ServiceHandle<geo::Geometry const> geom;
76  return geom->NOpChannels();
77  }
78 
79  //-------------------------------------------------------------------------------------------------------------
80  inline int OpDetResponseInterface::readoutToGeoChannel(int readoutChannel) const
81  {
82  return doReadoutToGeoChannel(readoutChannel);
83  }
84 
85  //-------------------------------------------------------------------------------------------------------------
86  inline int OpDetResponseInterface::doReadoutToGeoChannel(int readoutChannel) const
87  {
88  // Pass this call off to the geometry service
89  art::ServiceHandle<geo::Geometry const> geom;
90  return geom->OpDetFromOpChannel(readoutChannel);
91  }
92 
93 
94 
95 
96  //-------------------------------------------------------------------------------------------------------------
97  inline bool OpDetResponseInterface::detected(int OpChannel, const sim::OnePhoton& Phot, int &newOpChannel) const
98  {
99  return doDetected(OpChannel, Phot, newOpChannel);
100  }
101 
102  //-------------------------------------------------------------------------------------------------------------
103  inline bool OpDetResponseInterface::detected(int OpChannel, const sim::OnePhoton& Phot) const
104  {
105  int newOpChannel;
106  return doDetected(OpChannel, Phot, newOpChannel);
107  }
108 
109  //-------------------------------------------------------------------------------------------------------------
110  inline bool OpDetResponseInterface::detectedLite(int OpChannel, int &newOpChannel) const
111  {
112  return doDetectedLite(OpChannel, newOpChannel);
113  }
114 
115  //-------------------------------------------------------------------------------------------------------------
116  inline bool OpDetResponseInterface::detectedLite(int OpChannel) const
117  {
118  int newOpChannel;
119  return doDetectedLite(OpChannel, newOpChannel);
120  }
121 
122  //-------------------------------------------------------------------------------------------------------------
123  inline float OpDetResponseInterface::wavelength(double energy) const
124  {
125  return (2.0*3.142)*0.000197/energy;
126  }
127 
128 } //namespace opdet
129 
130 
131 DECLARE_ART_SERVICE_INTERFACE(opdet::OpDetResponseInterface, LEGACY)
132 
133 #endif //OPDET_RESPONSE_H
virtual bool doDetectedLite(int OpChannel, int &newOpChannel) const =0
virtual void reconfigure(fhicl::ParameterSet const &p)
pdgs p
Definition: selectors.fcl:22
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
virtual void doReconfigure(fhicl::ParameterSet const &p)=0
virtual ~OpDetResponseInterface()=default
virtual bool detectedLite(int OpChannel, int &newOpChannel) const
virtual bool doDetected(int OpChannel, const sim::OnePhoton &Phot, int &newOpChannel) const =0
virtual int doReadoutToGeoChannel(int readoutChannel) const
virtual int readoutToGeoChannel(int readoutChannel) const
virtual float wavelength(double energy) const
art framework interface to geometry description