102 auto const geop = lar::providerFrom<geo::Geometry>();
103 auto opf_v = std::unique_ptr<std::vector<recob::OpFlash> >(
new std::vector<recob::OpFlash>());
105 art::Handle< std::vector< simb::MCTruth > > mct_h;
107 if(!mct_h.isValid()) {
108 std::cerr <<
"std::vector<simb::MCTruth> could not be found with a label: " <<
_mct_label << std::endl;
109 throw std::exception();
112 art::Handle< std::vector< recob::OpHit > > oph_h;
114 if(!oph_h.isValid()) {
115 std::cerr <<
"std::vector<recob::OpHit> could not be found with a label: " <<
_hit_label << std::endl;
116 throw std::exception();
119 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
e);
120 std::set<double> flash_time_s;
121 for(
auto const& mct : *mct_h) {
122 for(
int i=0; i<mct.NParticles(); ++i) {
123 auto const& part = mct.GetParticle(i);
124 if( (
int)(part.StatusCode()) != 1 )
continue;
125 double flash_time = clockData.G4ToElecTime(part.T()) - clockData.TriggerTime();
126 flash_time_s.insert(flash_time);
129 std::vector<double> flash_time_v;
130 flash_time_v.reserve(flash_time_s.size());
131 double last_time = -1.1e20;
132 for(
auto const& time : flash_time_s) {
133 if(time > (last_time +
_merge_period)) flash_time_v.push_back(time);
137 for(
auto const& flash_time : flash_time_v) {
138 std::vector<double> pe_v(geop->NOpChannels(),0.);
143 for(
auto const& oph : *oph_h) {
144 auto opch = oph.OpChannel();
149 if(oph.PeakTime() < flash_time || oph.PeakTime() > (flash_time +
_merge_period)) {
158 pe_v[opch] += oph.PE();
159 pe_total = (pe_total < 0. ? oph.PE() : pe_total + oph.PE());
163 double y,
z,ywidth,zwidth;
166 pe_v,
false, 0, 0, 0, 0, 0, 0);
167 opf_v->emplace_back(std::move(f));
169 e.put(std::move(opf_v));
process_name opflash particleana ie ie ie z
BEGIN_PROLOG could also be cerr
void GetFlashLocation(std::vector< double > pePerOpChannel, double &Ycenter, double &Zcenter, double &Ywidth, double &Zwidth) const
process_name opflash particleana ie ie y
std::vector< bool > _enabled_opch_v