37 #include "art_root_io/TFileService.h" 160 produces<std::vector<anab::T0>>();
161 produces<art::Assns<recob::Track, anab::T0>>();
162 produces<art::Assns<recob::Shower, anab::T0>>();
186 fTree = tfs->make<TTree>(
"PhotonCounterT0Matching",
"PhotonCounterT0");
197 hPredX_T = tfs->make<TH2D>(
"hPredX_T",
198 "Predicted X from timing information against reconstructed X; " 199 "Reconstructed X (cm); Predicted X (cm)",
207 "Predicted X from PE information against reconstructed X; " 208 "Reconstructed X (cm); Predicted X (cm)",
216 "Predicted X position from time and PE information; Predicted X " 217 "from timing information (cm); Predicted X from PE information",
226 "Difference between X predicted from PE's and T agaisnt distance of flash from track in YZ; " 227 "Difference in X predicted from PE's and T (cm); Distance of flash from track in YZ (cm)",
235 "Distance of flash from track against track length; Distance " 236 "from flash to track (cm); Track length (cm)",
244 tfs->make<TH2D>(
"hFitParam_Length",
245 "How fit correlates with track length; Fit correlation; Track Length (cm)",
253 "Comparing Photon Counter reconstructed T0 against MCTruth T0; " 254 "Photon Counter T0 (us); MCTruthT0 T0 (us)",
263 "Difference between MCTruth T0 and photon detector T0; Time difference (us); Number",
269 "Difference between MCTruth T0 and photon detector T0; Time difference (us); Number",
285 std::vector<art::Ptr<recob::Track>> tracklist;
291 std::vector<art::Ptr<recob::Shower>> showerlist;
297 std::vector<art::Ptr<recob::Hit>> hitlist;
302 std::vector<art::Ptr<recob::OpFlash>> flashlist;
308 std::unique_ptr<std::vector<anab::T0>> T0col(
new std::vector<anab::T0>);
309 std::unique_ptr<art::Assns<recob::Track, anab::T0>> Trackassn(
311 std::unique_ptr<art::Assns<recob::Shower, anab::T0>> Showerassn(
319 size_t NTracks = tracklist.size();
320 size_t NFlashes = flashlist.size();
323 std::cout <<
"There were " << NTracks <<
" tracks and " << NFlashes
324 <<
" flashes in this event." << std::endl;
327 for (
size_t iTrk = 0; iTrk < NTracks; ++iTrk) {
328 if (
fVerbosity) std::cout <<
"\n New Track " << (int)iTrk << std::endl;
332 bool ValidTrack =
false;
336 std::tie(trackStart, trackEnd) = tracklist[iTrk]->Extent();
337 std::vector<art::Ptr<recob::Hit>> allHits = fmtht.at(iTrk);
338 size_t nHits = allHits.size();
340 clock_data.TPCClock().Frequency();
342 allHits[0]->PeakTime() / clock_data.TPCClock().Frequency();
363 std::cout << trackStart.X() <<
" " << trackEnd.X() <<
" " <<
TrackLength_X <<
" " 364 << TrackCentre_X <<
"\n" 365 << trackStart.Y() <<
" " << trackEnd.Y() <<
" " <<
TrackLength_Y <<
" " 366 << TrackCentre_Y <<
"\n" 367 << trackStart.Z() <<
" " << trackEnd.Z() <<
" " <<
TrackLength_Z <<
" " 368 << TrackCentre_Z <<
"\n" 369 << trkTimeStart <<
" " << trkTimeEnd <<
" " << trkTimeLengh <<
" " 370 << trkTimeCentre << std::endl;
373 for (
size_t iFlash = 0; iFlash < NFlashes; ++iFlash) {
381 if (TimeSep < 0 || TimeSep > (
fDriftWindowSize / clock_data.TPCClock().Frequency()))
385 if (flashlist[iFlash]->TotalPE() <
fPEThreshold)
continue;
395 for (
size_t Point = 1;
Point < tracklist[iTrk]->NumberTrajectoryPoints(); ++
Point) {
396 auto NewPoint = tracklist[iTrk]->LocationAtPoint(
Point);
397 auto PrevPoint = tracklist[iTrk]->LocationAtPoint(
Point - 1);
402 flashlist[iFlash]->YCenter(),
403 flashlist[iFlash]->ZCenter());
419 std::cout <<
"\nFlash " << (int)iFlash <<
" " << TrackCentre_X <<
", " <<
TimeSepPredX 451 if (fmtruth.isValid()) {
452 std::vector<const anab::T0*> T0s = fmtruth.at((
int)iTrk);
453 for (
size_t i = 0; i < T0s.size(); ++i) {
469 evt.
put(std::move(T0col));
470 evt.
put(std::move(Trackassn));
471 evt.
put(std::move(Showerassn));
494 TrackLength_X = fabs(TrackEnd_X - TrackStart_X);
495 if (TrackStart_X < TrackEnd_X)
500 TrackLength_Y = fabs(TrackEnd_Y - TrackStart_Y);
501 if (TrackStart_Y < TrackEnd_Y)
506 TrackLength_Z = fabs(TrackEnd_Z - TrackStart_Z);
507 if (TrackStart_Z < TrackEnd_Z)
515 TrackLength = pow(pow((TrackEnd_X - TrackStart_X), 2) + pow((TrackEnd_Y - TrackStart_Y), 2) +
516 pow((TrackEnd_Z - TrackStart_Z), 2),
530 double Length = hypot(fabs(EndY - StartY), fabs(EndZ - StartZ));
532 ((PointZ - StartZ) * (EndY - StartY) - (PointY - StartY) * (EndZ - StartZ)) / Length;
533 return fabs(distance);
float Length(const PFPStruct &pfp)
std::string fShowerModuleLabel
std::string fFlashModuleLabel
Declaration of signal hit object.
EDProducer(fhicl::ParameterSet const &pset)
double DistFromPoint(double StartY, double EndY, double StartZ, double EndZ, double PointY, double PointZ)
bool isValid() const noexcept
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
#define DEFINE_ART_MODULE(klass)
double fPredictedXConstant
Provides recob::Track data product.
void TrackProp(double TrackStart_X, double TrackEnd_X, double &TrackLength_X, double &TrackCentre_X, double TrackStart_Y, double TrackEnd_Y, double &TrackLength_Y, double &TrackCentre_Y, double TrackStart_Z, double TrackEnd_Z, double &TrackLength_Z, double &TrackCentre_Z, double trkTimeStart, double trkTimeEnd, double &trkTimeLengh, double &trkTimeCentre, double &TrackLength)
double fPredictedExpGradient
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.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Utility object to perform functions of association.
PhotonCounterT0Matching(fhicl::ParameterSet const &p)
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
std::string fTruthT0ModuleLabel
tracking::Point_t Point_t
double fPredictedExpConstant
std::string fTrackModuleLabel
PhotonCounterT0Matching & operator=(PhotonCounterT0Matching const &)=delete
void produce(art::Event &e) override
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
art framework interface to geometry description
std::string fHitsModuleLabel