113 double DistFromPoint (
double StartY,
double EndY,
double StartZ,
double EndZ,
double PointY,
double PointZ );
169 produces< std::vector<anab::T0> >();
170 produces< art::Assns<recob::Track , anab::T0> >();
171 produces< art::Assns<recob::Shower, anab::T0> > ();
200 fTree = tfs->
make<TTree>(
"PhotonCounterT0Matching",
"PhotonCounterT0");
211 hPredX_T = tfs->
make<TH2D>(
"hPredX_T" ,
"Predicted X from timing information against reconstructed X; Reconstructed X (cm); Predicted X (cm)", 30, 0, 300, 30, 0, 300 );
212 hPredX_PE = tfs->
make<TH2D>(
"hPredX_PE",
"Predicted X from PE information against reconstructed X; Reconstructed X (cm); Predicted X (cm)" , 30, 0, 300, 30, 0, 300 );
214 "Predicted X position from time and PE information; Predicted X from timing information (cm); Predicted X from PE information",
215 60, 0, 300, 60, 0, 300);
217 "Difference between X predicted from PE's and T agaisnt distance of flash from track in YZ; Difference in X predicted from PE's and T (cm); Distance of flash from track in YZ (cm)",
218 40, 0, 200, 40, 0, 100);
220 "Distance of flash from track against track length; Distance from flash to track (cm); Track length (cm)",
221 20, 0, 100, 60, 0, 300);
222 hFitParam_Length = tfs->
make<TH2D>(
"hFitParam_Length",
"How fit correlates with track length; Fit correlation; Track Length (cm)", 50, 0, 250, 30, 0, 300);
223 hPhotonT0_MCT0 = tfs->
make<TH2D>(
"hPhotonT0_MCT0" ,
"Comparing Photon Counter reconstructed T0 against MCTruth T0; Photon Counter T0 (us); MCTruthT0 T0 (us)", 1760, -1600, 16000, 1760, -1600, 16000);
224 hT0_diff_full = tfs->
make<TH1D>(
"hT0_diff_full" ,
"Difference between MCTruth T0 and photon detector T0; Time difference (us); Number", 500, -2500, 2500);
225 hT0_diff_zoom = tfs->
make<TH1D>(
"hT0_diff_zoom" ,
"Difference between MCTruth T0 and photon detector T0; Time difference (us); Number", 320, -1.6, 1.6);
232 auto const* detprop = lar::providerFrom<detinfo::DetectorPropertiesService>();
233 auto const* timeservice = lar::providerFrom<detinfo::DetectorClocksService>();
239 std::vector<art::Ptr<recob::Track> > tracklist;
245 std::vector<art::Ptr<recob::Shower> > showerlist;
251 std::vector<art::Ptr<recob::Hit> > hitlist;
257 std::vector<art::Ptr<recob::OpFlash> > flashlist;
263 std::unique_ptr< std::vector<anab::T0> > T0col(
new std::vector<anab::T0>);
267 if (trackListHandle.isValid() && flashListHandle.
isValid() ){
272 size_t NTracks = tracklist.size();
273 size_t NFlashes = flashlist.size();
276 std::cout <<
"There were " << NTracks <<
" tracks and " << NFlashes <<
" flashes in this event." << std::endl;
279 for(
size_t iTrk=0; iTrk < NTracks; ++iTrk) {
280 if (
fVerbosity) std::cout <<
"\n New Track " << (int)iTrk << std::endl;
284 bool ValidTrack =
false;
288 std::tie(trackStart, trackEnd) = tracklist[iTrk]->Extent();
289 std::vector< art::Ptr<recob::Hit> > allHits = fmtht.at(iTrk);
290 size_t nHits = allHits.size();
291 trkTimeStart = allHits[nHits-1]->PeakTime() / timeservice->TPCClock().Frequency();
292 trkTimeEnd = allHits[0]->PeakTime() / timeservice->TPCClock().Frequency();
301 std::cout << trackStart.X() <<
" " << trackEnd.X() <<
" " <<
TrackLength_X <<
" " << TrackCentre_X
302 <<
"\n" << trackStart.Y() <<
" " << trackEnd.Y() <<
" " <<
TrackLength_Y <<
" " << TrackCentre_Y
303 <<
"\n" << trackStart.Z() <<
" " << trackEnd.Z() <<
" " <<
TrackLength_Z <<
" " << TrackCentre_Z
304 <<
"\n" << trkTimeStart <<
" " << trkTimeEnd <<
" " << trkTimeLengh <<
" " << trkTimeCentre
308 for (
size_t iFlash=0; iFlash < NFlashes; ++iFlash ) {
316 if ( TimeSep < 0 || TimeSep > (
fDriftWindowSize/timeservice->TPCClock().Frequency() ) )
continue;
319 if ( flashlist[iFlash]->TotalPE() <
fPEThreshold )
continue;
327 for (
size_t Point = 1;
Point < tracklist[iTrk]->NumberTrajectoryPoints(); ++
Point ) {
328 TVector3 NewPoint = tracklist[iTrk]->LocationAtPoint(
Point);
329 TVector3 PrevPoint = tracklist[iTrk]->LocationAtPoint(
Point-1);
331 flashlist[iFlash]->YCenter(), flashlist[iFlash]->ZCenter());
343 std::cout <<
"\nFlash " << (int)iFlash <<
" " << TrackCentre_X <<
", " <<
TimeSepPredX <<
" - " <<
PredictedX <<
" = " 376 if ( fmtruth.isValid() ) {
377 std::vector<const anab::T0*> T0s = fmtruth.at((
int)iTrk);
378 for (
size_t i=0; i<T0s.size(); ++i) {
389 T0col->push_back(
anab::T0(BestFlashTime * 1e3,
445 evt.
put(std::move(T0col));
446 evt.
put(std::move(Trackassn));
447 evt.
put(std::move(Showerassn));
457 TrackLength_X = fabs ( TrackEnd_X - TrackStart_X );
458 if ( TrackStart_X < TrackEnd_X ) TrackCentre_X = TrackStart_X + 0.5*
TrackLength_X;
461 TrackLength_Y = fabs ( TrackEnd_Y - TrackStart_Y );
462 if ( TrackStart_Y < TrackEnd_Y ) TrackCentre_Y = TrackStart_Y + 0.5*
TrackLength_Y;
465 TrackLength_Z = fabs ( TrackEnd_Z - TrackStart_Z );
466 if ( TrackStart_Z < TrackEnd_Z ) TrackCentre_Z = TrackStart_Z + 0.5*
TrackLength_Z;
472 TrackLength = pow( pow((TrackEnd_X-TrackStart_X), 2) + pow((TrackEnd_Y-TrackStart_Y), 2) + pow((TrackEnd_Z-TrackStart_Z), 2) , 0.5);
479 double Length = hypot ( fabs( EndY - StartY), fabs ( EndZ - StartZ ) );
481 double distance = ( (PointZ - StartZ) * (EndY - StartY) - (PointY - StartY) * (EndZ - StartZ) ) / Length;
482 return fabs(distance);
std::string fShowerModuleLabel
std::string fFlashModuleLabel
Declaration of signal hit object.
TNtupleSim Fill(f1, f2, f3, f4)
double DistFromPoint(double StartY, double EndY, double StartZ, double EndZ, double PointY, double PointZ)
void reconfigure(fhicl::ParameterSet const &p)
ProductID put(std::unique_ptr< PROD > &&product)
#define DEFINE_ART_MODULE(klass)
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
double fPredictedXConstant
T get(std::string const &key) const
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)
Provides recob::Track data product.
double fPredictedExpGradient
Encapsulate the geometry of a wire.
T * make(ARGS...args) const
Utility object to perform functions of association.
Encapsulate the construction of a single detector plane.
PhotonCounterT0Matching(fhicl::ParameterSet const &p)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
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