173 for(
size_t i=0; i<4; i++) {
184 auto const& mctruths =
185 *
e.getValidHandle<vector<simb::MCTruth>>(
fGenLabel);
187 auto const&
nu = mctruths[0].GetNeutrino();
192 const TLorentzVector nuxyzt = nu.Nu().Position(0);
199 art::Handle< std::vector<sim::SimPhotons>> photHandle;
200 std::vector< art::Ptr<sim::SimPhotons> > photList;
202 art::fill_ptr_vector(photList, photHandle);
204 double tphotmin = DBL_MAX;
205 for(
auto const& phot : photList){
206 for(
size_t i=0; i<phot->size(); i++) {
207 if ((phot->at(i)).Time < tphotmin)
208 tphotmin = (phot->at(i)).Time;
214 map<int,art::Handle< std::vector<recob::OpFlash> > > flashHandles;
215 map<int,vector< art::Ptr<recob::OpFlash> >> flashLists;
217 art::fill_ptr_vector(flashLists[0], flashHandles[0]);
219 art::fill_ptr_vector(flashLists[1], flashHandles[1]);
221 art::fill_ptr_vector(flashLists[2], flashHandles[2]);
223 art::fill_ptr_vector(flashLists[3], flashHandles[3]);
225 for(
auto flashList : flashLists) {
227 int tpc = flashList.first;
228 size_t nflashtpc = flashList.second.size();
229 if(nflashtpc==0)
continue;
232 std::sort(flashList.second.begin(),flashList.second.end(),
233 [](art::Ptr<recob::OpFlash> f1, art::Ptr<recob::OpFlash> f2)
234 {
return f1->Time()<f2->Time();}
237 art::FindManyP<recob::OpHit> findManyHits(
241 for(
size_t iflash=0; iflash < nflashtpc; iflash++) {
242 auto const& flash0 = flashList.second[iflash];
244 dt = flash0->Time()*1.0e3 -
fNuXYZT[3];
255 auto const& pes= flash0->PEs();
260 for(
size_t i=0; i<4; i++)
263 double tPmtMax=-DBL_MAX, tPmtMin=DBL_MAX;
264 vector<art::Ptr<recob::OpHit>> hits = findManyHits.at(iflash);
265 for(
auto const&
hit : hits) {
269 if(
hit->PeakTime()<tPmtMin){
270 tPmtMin =
hit->PeakTime();
277 if(
hit->PeakTime()>tPmtMax){
278 tPmtMax =
hit->PeakTime();
290 for(
size_t i=0; i<nflashtpc-1; i++) {
291 auto const& flash = flashList.second.at(i);
292 auto const& flashnext = flashList.second.at(i+1);
293 fDeltaTFlash->Fill((flashnext->Time()-flash->Time())*1.0e3);
298 art::Handle< std::vector<recob::OpHit> > opHitHandle;
299 std::vector< art::Ptr<recob::OpHit> > opHitList;
303 art::fill_ptr_vector(opHitList, opHitHandle);
304 fNHit = opHitList.size();
306 std::cout <<
"empty OpHit vector!" << std::endl;
307 for(
int i=0; i<4; i++)
fHitXYZT[i] = DBL_MAX;
314 std::sort(opHitList.begin(),opHitList.end(),
315 [](art::Ptr<recob::OpHit> h1, art::Ptr<recob::OpHit> h2)
316 {
return h1->PeakTime()<h2->PeakTime();}
318 if(opHitList.size()>1 && opHitList[0]->PeakTime()>opHitList.back()->PeakTime())
319 std::cout <<
"OpHits time sort failed!" << std::endl;
324 for(
int i=0; i<3; i++)
fHitXYZT[i] = pos[i];
325 fHitXYZT[3] = opHitList[0]->PeakTime()*1.0e3;
327 for(
int i=0; i<3; i++)
331 fHitPE = opHitList[0]->PE();
335 std::cout <<
"no OpHit handle found!" << std::endl;
geo::GeometryCore const * fGeometryService
pointer to Geometry provider
art::InputTag fFlashLabel1
art::InputTag fFlashLabel0
void GetCenter(double *xyz, double localz=0.0) const
Geometry information for a single cryostat.
map< int, art::InputTag > fFlashLabels
art::InputTag fFlashLabel3
const OpDetGeo & OpDet(unsigned int iopdet) const
Return the iopdet'th optical detector in the cryostat.
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
unsigned int GetMaxChan(vector< double > const &pes)
art::InputTag fFlashLabel2
BEGIN_PROLOG could also be cout