All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
PhotonPropogationICARUS Class Reference
Inheritance diagram for PhotonPropogationICARUS:

Public Member Functions

 PhotonPropogationICARUS (fhicl::ParameterSet const &pset)
 
virtual void configure (fhicl::ParameterSet const &pset)
 
virtual void produce (art::Event &e) override
 
virtual void beginJob () override
 Begin job method. More...
 
virtual void endJob () override
 End job method. More...
 

Private Attributes

art::InputTag fSimPhotonModuleLabel
 The full collection of SimPhotons. More...
 
unsigned int fNumEvent = 0
 Number of events seen. More...
 
geo::GeometryCore const * fGeometry = nullptr
 Pointer to Geometry service. More...
 
CLHEP::HepRandomEngine & fPhotonEngine
 

Static Private Attributes

static constexpr unsigned int MaxPhotons = 10000000U
 We don't keep more than this number of photons per sim::SimPhoton. More...
 

Detailed Description

Definition at line 54 of file PhotonPropogationICARUS_module.cc.

Constructor & Destructor Documentation

PhotonPropogationICARUS::PhotonPropogationICARUS ( fhicl::ParameterSet const &  pset)
explicit

Constructor.

Arguments:

pset - Fcl parameters.

Definition at line 93 of file PhotonPropogationICARUS_module.cc.

94  : EDProducer{pset}, fGeometry(lar::providerFrom<geo::Geometry>())
95  , fPhotonEngine(art::ServiceHandle<rndm::NuRandomService>()->createEngine(*this, "HepJamesRandom", "icarusphoton", pset, "SeedPhoton"))
96 // , fDetectorProperties(lar::providerFrom<detinfo::DetectorPropertiesService>())
97 {
98  configure(pset);
99 
100  produces<std::vector<sim::SimPhotons>>();
101 
102  // Report.
103  mf::LogDebug("PhotonPropogationICARUS") << "PhotonPropogationICARUS configured";
104 } // PhotonPropagationICARUS::PhotonPropagationICARUS()
geo::GeometryCore const * fGeometry
Pointer to Geometry service.
CLHEP::HepRandomEngine & fPhotonEngine
virtual void configure(fhicl::ParameterSet const &pset)

Member Function Documentation

void PhotonPropogationICARUS::beginJob ( )
overridevirtual

Begin job method.

Definition at line 120 of file PhotonPropogationICARUS_module.cc.

121 {
122  // Access ART's TFileService, which will handle creating and writing
123  // histograms and n-tuples for us.
124 // art::ServiceHandle<art::TFileService> tfs;
125 
126 // art::TFileDirectory dir = tfs->mkdir(Form("PhotonPropogation"));
127 
128  return;
129 }
void PhotonPropogationICARUS::configure ( fhicl::ParameterSet const &  pset)
virtual

Reconfigure method.

Arguments:

pset - Fcl parameter set.

Definition at line 113 of file PhotonPropogationICARUS_module.cc.

114 {
115  fSimPhotonModuleLabel = pset.get<art::InputTag>("SimPhotonsModuleLabel");
116 }
art::InputTag fSimPhotonModuleLabel
The full collection of SimPhotons.
void PhotonPropogationICARUS::endJob ( )
overridevirtual

End job method.

Definition at line 243 of file PhotonPropogationICARUS_module.cc.

244 {
245  mf::LogInfo("PhotonPropogationICARUS") << "Looked at " << fNumEvent << " events" << std::endl;
246 }
unsigned int fNumEvent
Number of events seen.
void PhotonPropogationICARUS::produce ( art::Event &  event)
overridevirtual

Produce method.

Arguments:

evt - Art event.

This is the primary method.

Definition at line 140 of file PhotonPropogationICARUS_module.cc.

141 {
142  ++fNumEvent;
143 
144  /*
145  * In LArSoft, detected photons are organised optical channel by channel,
146  * each channel with its own sim::SimPhotons.
147  * Each channel contains individual information for each of the photons
148  * it has detected.
149  * Here we go through all detected photons from all the channels,
150  * and for each we assign a delay to the start time, parametrized by the
151  * distance between its generation point and the PMT.
152  *
153  */
154  // Agreed convention is to ALWAYS output to the event store so get a pointer to our collection
155  auto simPhotonVec = std::make_unique<std::vector<sim::SimPhotons>>();
156 
157  // Read in the digit List object(s).
158  auto const& srcSimPhotons
159  = *(event.getValidHandle< std::vector<sim::SimPhotons> >(fSimPhotonModuleLabel));
160 
161  if (srcSimPhotons.empty()) {
162  mf::LogWarning("PhotonPropagationICARUS") << "No photons! Nice event you have here.";
163  event.put(std::move(simPhotonVec));
164  return;
165  }
166 
167  // get hold of all needed services
168 // auto const& pvs = *(art::ServiceHandle<phot::PhotonVisibilityService>());
169  CLHEP::RandLandau landauGen(fPhotonEngine);
170 
171  // Loop through the input photons (this might need to be more complicated...)
172  for(const auto& simPhoton : srcSimPhotons)
173  {
174  auto const channel = simPhoton.OpChannel();
175  if (simPhoton.empty()) continue;
176 
177  auto const& PMTcenter = fGeometry->OpDetGeoFromOpChannel(channel).GetCenter();
178 
179  // TODO restore the "MF_LOG_TRACE" line for normal operations
180  // (MF_LOG_TRACE will print only in debug mode, with debug qualifiers and proper messagefacility settings)
181  // MF_LOG_TRACE("LightPropagationICARUS")
182 // mf::LogVerbatim("LightPropagationICARUS")
183 // << "Processing photon channel #" << channel << ", detector center: " << PMTcenter;
184  //
185  // fix the arrival time
186  //
187  sim::SimPhotons localPhoton = simPhoton; // modify a copy of the original photon
188  unsigned int photonNo = 0;
189  for (auto& onePhoton: localPhoton)
190  {
191  //
192  // sanity check: if there are too many photons we are in trouble
193  // (like in: not enough computing resources)
194  //
195  if (photonNo++ >= MaxPhotons) {
196  mf::LogError("LightPropagationICARUS")
197  << "Too many photons to handle! only " << (photonNo - 1) << " saved.";
198  break;
199  }
200 
201  geo::Point_t const position = geo::vect::toPoint(onePhoton.InitialPosition);
202  double const dis = (position - PMTcenter).R();
203 
204  double mean = 0.18*dis; // TODO
205  double sigma = 0.75*dis; // TODO
206 
207  //double time_plus = -1;
208 
209  //while (time_plus<dis/21.74){time_plus=mean + landauGen.fire() * sigma; }// TODO
210 
211  const double minPropTime = dis / 21.74; // d / (c/n) in [ns]
212  //const double maxPropTime = 2000 / 21.74; // dimension / (c/n) in [ns]
213  double time_plus;
214  do {
215  time_plus = mean + landauGen.fire() * sigma; // TODO
216  //time_plus = landauGen.fire(mean,sigma); // TODO
217  } while (time_plus < minPropTime);
218 
219  // TODO restore the "MF_LOG_TRACE" line for normal operations
220  MF_LOG_TRACE("LightPropagationICARUS");
221 // mf::LogVerbatim("LightPropagationICARUS")
222 // << "Photon #" << photonNo
223 // << " (at " << position << ", " << dis << " cm far from PMT) given offset "
224 // << time_plus;
225  //double time_plus = dis/21.74;
226  //TRandom r;
227 
228  onePhoton.Time += time_plus;
229  //onePhoton.Time = time_plus;
230 
231  } // for photons in simPhoton
232  // move the photon with the new arrival time into the new output collection
233  simPhotonVec->push_back(std::move(localPhoton));
234  } // for all simPhoton channels
235 
236  // Add tracks and associations to event.
237  event.put(std::move(simPhotonVec));
238 
239 } // LightPropagationICARUS::produce()
static constexpr unsigned int MaxPhotons
We don&#39;t keep more than this number of photons per sim::SimPhoton.
geo::GeometryCore const * fGeometry
Pointer to Geometry service.
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
void GetCenter(double *xyz, double localz=0.0) const
Definition: OpDetGeo.cxx:40
unsigned int fNumEvent
Number of events seen.
CLHEP::HepRandomEngine & fPhotonEngine
art::InputTag fSimPhotonModuleLabel
The full collection of SimPhotons.
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:13
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:136
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
OpDetGeo const & OpDetGeoFromOpChannel(unsigned int OpChannel) const
Returns the geo::OpDetGeo object for the given channel number.

Member Data Documentation

geo::GeometryCore const* PhotonPropogationICARUS::fGeometry = nullptr
private

Pointer to Geometry service.

Definition at line 76 of file PhotonPropogationICARUS_module.cc.

unsigned int PhotonPropogationICARUS::fNumEvent = 0
private

Number of events seen.

Definition at line 73 of file PhotonPropogationICARUS_module.cc.

CLHEP::HepRandomEngine& PhotonPropogationICARUS::fPhotonEngine
private

Definition at line 77 of file PhotonPropogationICARUS_module.cc.

art::InputTag PhotonPropogationICARUS::fSimPhotonModuleLabel
private

The full collection of SimPhotons.

Definition at line 70 of file PhotonPropogationICARUS_module.cc.

constexpr unsigned int PhotonPropogationICARUS::MaxPhotons = 10000000U
staticprivate

We don't keep more than this number of photons per sim::SimPhoton.

Definition at line 80 of file PhotonPropogationICARUS_module.cc.


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