112 std::unique_ptr< std::vector<recob::OpFlash> > opflashes(
new std::vector<recob::OpFlash>);
113 std::unique_ptr< art::Assns <recob::OpHit, recob::OpFlash> > flash2hit_assn_v
114 (
new art::Assns<recob::OpHit, recob::OpFlash>);
116 std::vector<art::Ptr<recob::OpHit>> ophit_v;
124 art::Handle<std::vector<recob::OpHit> > ophit_h;
125 e.getByLabel(producer, ophit_h);
128 if(!ophit_h.isValid()) {
129 std::cerr <<
"\033[93m[ERROR]\033[00m ... could not locate OpHit!" << std::endl;
130 throw std::exception();
133 std::vector<art::Ptr<recob::OpHit>> temp_v;
134 art::fill_ptr_vector(temp_v, ophit_h);
135 ophit_v.insert(ophit_v.end(), temp_v.begin(), temp_v.end());
138 for(
auto const oph : ophit_v) {
140 if(trigger_time > 1.e20) trigger_time = oph->PeakTimeAbs() - oph->PeakTime();
148 loph.
channel = oph->OpChannel();
149 ophits.emplace_back(std::move(loph));
154 for(
const auto& lflash : flash_v) {
157 double Ycenter, Zcenter, Ywidth, Zwidth;
158 _flashgeo->GetFlashLocation(lflash.channel_pe, Ycenter, Zcenter, Ywidth, Zwidth);
161 double flasht0 = lflash.time;
171 double drift_distance =
_driftestimator->GetDriftPosition( lflash.channel_pe );
172 double propagation_time =
_driftestimator->GetPropagationTime( drift_distance );
173 flasht0 = flasht0-propagation_time * 1
e-3;
175 drift_distance = (lflash.tpc==0 ? -drift_distance : drift_distance);
177 recob::OpFlash flash(flasht0, lflash.time_err, trigger_time + flasht0,
178 (trigger_time + flasht0) / 1600., lflash.channel_pe,
180 drift_distance, -1, Ycenter, Ywidth, Zcenter, Zwidth);
181 opflashes->emplace_back(std::move(flash));
184 recob::OpFlash flash(flasht0, lflash.time_err, trigger_time + flasht0,
185 (trigger_time + flasht0) / 1600., lflash.channel_pe,
187 100., -1., Ycenter, Ywidth, Zcenter, Zwidth);
188 opflashes->emplace_back(std::move(flash));
192 for(
auto const& hitidx : lflash.asshit_idx) {
193 const art::Ptr<recob::OpHit> hit_ptr(ophit_v.at(hitidx));
198 e.put(std::move(opflashes));
199 e.put(std::move(flash2hit_assn_v));
std::unique_ptr< lightana::DriftEstimatorBase > _driftestimator
std::string _ophit_input_time
BEGIN_PROLOG could also be cerr
::lightana::PECalib _pecalib
bool _correct_light_propagation
timescale_traits< TriggerTimeCategory >::time_point_t trigger_time
A point in time on the trigger time scale.
std::vector< lightana::LiteOpHit_t > LiteOpHitArray_t
double Calibrate(const size_t opdet, const double area) const
std::unique_ptr< lightana::FlashGeoBase > _flashgeo
::lightana::FlashFinderManager _mgr
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
size_t OpDetFromOpChannel(size_t opch)
std::vector< std::string > _hit_producers
std::unique_ptr< lightana::FlashT0Base > _flasht0calculator
LiteOpFlashArray_t RecoFlash(const LiteOpHitArray_t &ophits) const
::lightana::LiteOpHitArray_t GetAssociatedLiteHits(::lightana::LiteOpFlash_t lite_flash,::lightana::LiteOpHitArray_t lite_hits_v)