LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
OpDetResponseInterface.h
Go to the documentation of this file.
1 // \file OpDetResponse.h
3 //
4 // \brief service containing information about the response of optical detectors
5 //
6 // \author ahimmel@phy.duke.edu
7 //
9 
10 #ifndef OPDET_RESPONSE_INTERFACE_H
11 #define OPDET_RESPONSE_INTERFACE_H
12 
13 // LArSoft includes
15 namespace sim {
16  struct OnePhoton;
17 }
18 
19 // ART includes
22 #include "fhiclcpp/fwd.h"
23 
24 namespace opdet {
26  public:
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  inline void OpDetResponseInterface::reconfigure(fhicl::ParameterSet const& p)
57  {
58  doReconfigure(p);
59  }
60 
61  //-------------------------------------------------------------------------------------------------------------
62  inline int OpDetResponseInterface::NOpChannels() const
63  {
64  return doNOpChannels();
65  }
66 
67  //-------------------------------------------------------------------------------------------------------------
68  inline int OpDetResponseInterface::doNOpChannels() const
69  {
70  // By default return the number of detector channels
71  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
72  return wireReadoutGeom.NOpChannels();
73  }
74 
75  //-------------------------------------------------------------------------------------------------------------
76  inline int OpDetResponseInterface::readoutToGeoChannel(int readoutChannel) const
77  {
78  return doReadoutToGeoChannel(readoutChannel);
79  }
80 
81  //-------------------------------------------------------------------------------------------------------------
82  inline int OpDetResponseInterface::doReadoutToGeoChannel(int readoutChannel) const
83  {
84  auto const& wireReadoutGeom = art::ServiceHandle<geo::WireReadout const>()->Get();
85  return wireReadoutGeom.OpDetFromOpChannel(readoutChannel);
86  }
87 
88  //-------------------------------------------------------------------------------------------------------------
89  inline bool OpDetResponseInterface::detected(int OpChannel,
90  const sim::OnePhoton& Phot,
91  int& newOpChannel) const
92  {
93  return doDetected(OpChannel, Phot, newOpChannel);
94  }
95 
96  //-------------------------------------------------------------------------------------------------------------
97  inline bool OpDetResponseInterface::detected(int OpChannel, const sim::OnePhoton& Phot) const
98  {
99  int newOpChannel;
100  return doDetected(OpChannel, Phot, newOpChannel);
101  }
102 
103  //-------------------------------------------------------------------------------------------------------------
104  inline bool OpDetResponseInterface::detectedLite(int OpChannel, int& newOpChannel) const
105  {
106  return doDetectedLite(OpChannel, newOpChannel);
107  }
108 
109  //-------------------------------------------------------------------------------------------------------------
110  inline bool OpDetResponseInterface::detectedLite(int OpChannel) const
111  {
112  int newOpChannel;
113  return doDetectedLite(OpChannel, newOpChannel);
114  }
115 
116  //-------------------------------------------------------------------------------------------------------------
117  inline float OpDetResponseInterface::wavelength(double energy) const
118  {
119  return (2.0 * 3.142) * 0.000197 / energy;
120  }
121 
122 } //namespace opdet
123 
125 
126 #endif //OPDET_RESPONSE_H
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:60
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
double energy
Definition: plottest35.C:25
Monte Carlo Simulation.
#define DECLARE_ART_SERVICE_INTERFACE(svc, scope)