37 #include "art_root_io/TFileService.h" 38 #include "canvas/Persistency/Common/FindManyP.h" 62 class PhotonCounterT0Matching;
160 produces<std::vector<anab::T0>>();
161 produces<art::Assns<recob::Track, anab::T0>>();
162 produces<art::Assns<recob::Shower, anab::T0>>();
187 fTree = tfs->make<TTree>(
"PhotonCounterT0Matching",
"PhotonCounterT0");
198 hPredX_T = tfs->make<TH2D>(
"hPredX_T",
199 "Predicted X from timing information against reconstructed X; " 200 "Reconstructed X (cm); Predicted X (cm)",
208 "Predicted X from PE information against reconstructed X; " 209 "Reconstructed X (cm); Predicted X (cm)",
217 "Predicted X position from time and PE information; Predicted X " 218 "from timing information (cm); Predicted X from PE information",
227 "Difference between X predicted from PE's and T agaisnt distance of flash from track in YZ; " 228 "Difference in X predicted from PE's and T (cm); Distance of flash from track in YZ (cm)",
236 "Distance of flash from track against track length; Distance " 237 "from flash to track (cm); Track length (cm)",
245 tfs->make<TH2D>(
"hFitParam_Length",
246 "How fit correlates with track length; Fit correlation; Track Length (cm)",
254 "Comparing Photon Counter reconstructed T0 against MCTruth T0; " 255 "Photon Counter T0 (us); MCTruthT0 T0 (us)",
264 "Difference between MCTruth T0 and photon detector T0; Time difference (us); Number",
270 "Difference between MCTruth T0 and photon detector T0; Time difference (us); Number",
281 auto const clock_data =
288 std::vector<art::Ptr<recob::Track>> tracklist;
294 std::vector<art::Ptr<recob::Shower>> showerlist;
300 std::vector<art::Ptr<recob::Hit>> hitlist;
305 std::vector<art::Ptr<recob::OpFlash>> flashlist;
311 std::unique_ptr<std::vector<anab::T0>> T0col(
new std::vector<anab::T0>);
312 std::unique_ptr<art::Assns<recob::Track, anab::T0>> Trackassn(
314 std::unique_ptr<art::Assns<recob::Shower, anab::T0>> Showerassn(
322 size_t NTracks = tracklist.size();
323 size_t NFlashes = flashlist.size();
326 std::cout <<
"There were " << NTracks <<
" tracks and " << NFlashes
327 <<
" flashes in this event." <<
std::endl;
330 for (
size_t iTrk = 0; iTrk < NTracks; ++iTrk) {
331 if (
fVerbosity) std::cout <<
"\n New Track " << (
int)iTrk << std::endl;
335 bool ValidTrack =
false;
339 std::tie(trackStart, trackEnd) = tracklist[iTrk]->Extent();
340 std::vector<art::Ptr<recob::Hit>> allHits = fmtht.at(iTrk);
341 size_t nHits = allHits.size();
343 clock_data.TPCClock().Frequency();
345 allHits[0]->PeakTime() / clock_data.TPCClock().Frequency();
366 std::cout << trackStart.X() <<
" " << trackEnd.X() <<
" " <<
TrackLength_X <<
" " 367 << TrackCentre_X <<
"\n" 368 << trackStart.Y() <<
" " << trackEnd.Y() <<
" " <<
TrackLength_Y <<
" " 369 << TrackCentre_Y <<
"\n" 370 << trackStart.Z() <<
" " << trackEnd.Z() <<
" " <<
TrackLength_Z <<
" " 371 << TrackCentre_Z <<
"\n" 372 << trkTimeStart <<
" " << trkTimeEnd <<
" " << trkTimeLengh <<
" " 376 for (
size_t iFlash = 0; iFlash < NFlashes; ++iFlash) {
384 if (TimeSep < 0 || TimeSep > (
fDriftWindowSize / clock_data.TPCClock().Frequency()))
388 if (flashlist[iFlash]->TotalPE() <
fPEThreshold)
continue;
398 for (
size_t Point = 1;
Point < tracklist[iTrk]->NumberTrajectoryPoints(); ++
Point) {
399 auto NewPoint = tracklist[iTrk]->LocationAtPoint(
Point);
400 auto PrevPoint = tracklist[iTrk]->LocationAtPoint(
Point - 1);
405 flashlist[iFlash]->YCenter(),
406 flashlist[iFlash]->ZCenter());
422 std::cout <<
"\nFlash " << (
int)iFlash <<
" " << TrackCentre_X <<
", " <<
TimeSepPredX 454 if (fmtruth.isValid()) {
455 std::vector<const anab::T0*> T0s = fmtruth.at((
int)iTrk);
456 for (
size_t i = 0; i < T0s.size(); ++i) {
498 TrackLength_X = fabs(TrackEnd_X - TrackStart_X);
499 if (TrackStart_X < TrackEnd_X)
504 TrackLength_Y = fabs(TrackEnd_Y - TrackStart_Y);
505 if (TrackStart_Y < TrackEnd_Y)
510 TrackLength_Z = fabs(TrackEnd_Z - TrackStart_Z);
511 if (TrackStart_Z < TrackEnd_Z)
519 TrackLength =
pow(
pow((TrackEnd_X - TrackStart_X), 2) +
pow((TrackEnd_Y - TrackStart_Y), 2) +
520 pow((TrackEnd_Z - TrackStart_Z), 2),
535 double Length =
hypot(fabs(EndY - StartY), fabs(EndZ - StartZ));
537 ((PointZ - StartZ) * (EndY - StartY) - (PointY - StartY) * (EndZ - StartZ)) / Length;
538 return fabs(distance);
float Length(const PFPStruct &pfp)
std::string fShowerModuleLabel
std::string fFlashModuleLabel
EDProducer(fhicl::ParameterSet const &pset)
double DistFromPoint(double StartY, double EndY, double StartZ, double EndZ, double PointY, double PointZ)
art framework interface to geometry description
std::enable_if_t< std::is_arithmetic_v< T >, T > hypot(T x, T y)
bool isValid() const noexcept
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#define DEFINE_ART_MODULE(klass)
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
double fPredictedXConstant
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
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 distance(double x1, double y1, double z1, double x2, double y2, double z2)
double fPredictedExpGradient
Declaration of signal hit object.
PhotonCounterT0Matching(fhicl::ParameterSet const &p)
std::string fTruthT0ModuleLabel
tracking::Point_t Point_t
double fPredictedExpConstant
Provides recob::Track data product.
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)
QTextStream & endl(QTextStream &s)
std::string fHitsModuleLabel