118 auto StoragePtr = std::make_unique<std::vector<raw::OpDetPulse>>();
125 double const TimeBegin_ns =
fTimeBegin * 1000;
126 double const TimeEnd_ns =
fTimeEnd * 1000;
129 int const nSamples = ( TimeEnd_ns-TimeBegin_ns)*SampleFreq_ns;
134 std::vector<std::vector<double> > PulsesFromDetPhotons(NOpChannels,std::vector<double>(nSamples,0.0));
136 if(!fUseLitePhotons) {
140 for(
auto const& pr : ThePhotCollection) {
149 if(!odresponse->
detected(Ch, Phot, readoutCh)) {
157 if((Phot.Time > TimeBegin_ns) && (Phot.Time < TimeEnd_ns)) {
158 auto const binTime =
static_cast<int>((Phot.Time - TimeBegin_ns) * SampleFreq_ns);
165 auto const photons = *evt.
getValidHandle<std::vector<sim::SimPhotonsLite>>(
"largeant");
167 for (
auto const& photon : photons) {
168 int const Ch=photon.OpChannel;
171 std::map<int, int> PhotonsMap = photon.DetectedPhotons;
174 for(
auto const& pr : photon.DetectedPhotons) {
175 for(
int i = 0; i < pr.second; i++) {
181 if((pr.first > TimeBegin_ns) && (pr.first < TimeEnd_ns)) {
182 auto const binTime =
static_cast<int>((pr.first - TimeBegin_ns) * SampleFreq_ns);
194 std::vector<raw::OpDetPulse*> ThePulses(NOpChannels);
196 PulsesFromDetPhotons[iCh].resize((TimeEnd_ns - TimeBegin_ns) * SampleFreq_ns);
200 unsigned const int NumberOfPulses =
fPoissonRandom.fire(MeanDarkPulses);
202 for(
size_t i=0; i!=NumberOfPulses; ++i) {
204 int const binTime =
static_cast<int>(PulseTime *
fSampleFreq);
210 for(
size_t i=0; i!=PulsesFromDetPhotons[iCh].size(); ++i) {
216 std::vector<short> shortvec;
218 for(
size_t i=0; i!=PulsesFromDetPhotons[iCh].size(); ++i) {
220 int ThisSample = PulsesFromDetPhotons[iCh].at(i);
223 shortvec.push_back(
int(ThisSample));
225 shortvec.push_back(
int(ThisSample)+1);
229 shortvec.push_back(
int(ThisSample));
231 shortvec.push_back(
int(ThisSample)-1);
235 StoragePtr->emplace_back(iCh, shortvec ,0,
fTimeBegin);
int OpChannel() const
Returns the optical channel number this object is associated to.
void AddTimedWaveform(int time, std::vector< double > &OldPulse, std::vector< double > &NewPulse)
All information of a photon entering the sensitive optical detector volume.
virtual bool detected(int OpChannel, const sim::OnePhoton &Phot, int &newOpChannel) const
virtual int NOpChannels() const
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
virtual bool detectedLite(int OpChannel, int &newOpChannel) const
Collection of photons which recorded on one channel.
std::vector< double > fSinglePEWaveform
CLHEP::RandFlat fFlatRandom
Collection of sim::SimPhotons, indexed by channel number.
static sim::SimPhotonsCollection GetSimPhotonsCollection(const art::Event &evt, std::string moduleLabel)
bool UseLitePhotons() const
CLHEP::RandPoisson fPoissonRandom