24 #include "art_root_io/TFileService.h" 44 #include "range/v3/view.hpp" 47 using ranges::views::transform;
131 ,
fMinX(pset.
get<
double>("MinX", -1.e10))
132 ,
fMaxX(pset.
get<
double>("MaxX", 1.e10))
133 ,
fMinY(pset.
get<
double>("MinY", -1.e10))
134 ,
fMaxY(pset.
get<
double>("MaxY", 1.e10))
135 ,
fMinZ(pset.
get<
double>("MinZ", -1.e10))
136 ,
fMaxZ(pset.
get<
double>("MaxZ", 1.e10))
138 mf::LogInfo(
"SpacePointAna") <<
"SpacePointAna configured with the following parameters:\n" 151 auto const& tpc = geom->
TPC({0, 0});
153 art::TFileDirectory
dir = tfs->mkdir(
"sptana",
"SpacePointAna histograms");
155 unsigned int nwiresU = 0, nwiresV = 0, nwiresW = 0;
162 for (
auto const& pgeom : wireReadoutGeom.Iterate<
geo::PlaneGeo>()) {
163 unsigned int const nwires = pgeom.Nwires();
164 switch (pgeom.View()) {
165 case geo::kU: nwiresU = nwires;
break;
166 case geo::kV: nwiresV = nwires;
break;
167 case geo::kZ: nwiresW = nwires;
break;
174 fHDTUE = dir.make<TH1F>(
"MCDTUE",
"U-Drift Electrons Time Difference", 100, -5., 5.);
175 fHDTVE = dir.make<TH1F>(
"MCDTVE",
"V-Drift Electrons Time Difference", 100, -5., 5.);
176 fHDTWE = dir.make<TH1F>(
"MCDTWE",
"W-Drift Electrons Time Difference", 100, -5., 5.);
177 fHDTUPull = dir.make<TH1F>(
"MCDTUPull",
"U-Drift Electrons Time Pull", 100, -50., 50.);
178 fHDTVPull = dir.make<TH1F>(
"MCDTVPull",
"V-Drift Electrons Time Pull", 100, -50., 50.);
179 fHDTWPull = dir.make<TH1F>(
"MCDTWPull",
"W-Drift Electrons Time Pull", 100, -50., 50.);
182 fHDTUV = dir.make<TH1F>(
"DTUV",
"U-V time difference", 100, -20., 20.);
183 fHDTVW = dir.make<TH1F>(
"DTVW",
"V-W time difference", 100, -20., 20.);
184 fHDTWU = dir.make<TH1F>(
"DTWU",
"W-U time difference", 100, -20., 20.);
186 "DTUVU",
"U-V time difference vs. U", 100, 0., double(nwiresU), 100, -20., 20.);
188 "DTUVV",
"U-V time difference vs. V", 100, 0., double(nwiresV), 100, -20., 20.);
190 "DTVWV",
"V-W time difference vs. V", 100, 0., double(nwiresV), 100, -20., 20.);
192 "DTVWW",
"V-W time difference vs. W", 100, 0., double(nwiresW), 100, -20., 20.);
194 "DTWUW",
"W-U time difference vs. W", 100, 0., double(nwiresW), 100, -20., 20.);
196 "DTWUU",
"W-U time difference vs. U", 100, 0., double(nwiresU), 100, -20., 20.);
197 fHS = dir.make<TH1F>(
"DS",
"Spatial Separation", 100, -2., 2.);
199 fHchisq = dir.make<TH1F>(
"chisq",
"Chisquare", 100, 0., 20.);
201 fHx = dir.make<TH1F>(
"xpos",
"X Position", 100, 0., 2. * tpc.HalfWidth());
202 fHy = dir.make<TH1F>(
"ypos",
"Y Position", 100, -tpc.HalfHeight(), tpc.HalfHeight());
203 fHz = dir.make<TH1F>(
"zpos",
"Z Position", 100, 0., tpc.Length());
204 fHAmpU = dir.make<TH1F>(
"ampU",
"U Hit Amplitude", 50, 0., 50.);
205 fHAmpV = dir.make<TH1F>(
"ampV",
"V Hit Amplitude", 50, 0., 50.);
206 fHAmpW = dir.make<TH1F>(
"ampW",
"W Hit Amplitude", 50, 0., 50.);
207 fHAreaU = dir.make<TH1F>(
"areaU",
"U Hit Area", 100, 0., 500.);
208 fHAreaV = dir.make<TH1F>(
"areaV",
"V Hit Area", 100, 0., 500.);
209 fHAreaW = dir.make<TH1F>(
"areaW",
"W Hit Area", 100, 0., 500.);
210 fHSumU = dir.make<TH1F>(
"sumU",
"U Hit Sum ADC", 100, 0., 500.);
211 fHSumV = dir.make<TH1F>(
"sumV",
"V Hit Sum ADC", 100, 0., 500.);
212 fHSumW = dir.make<TH1F>(
"sumW",
"W Hit Sum ADC", 100, 0., 500.);
214 fHMCdx = dir.make<TH1F>(
"MCdx",
"X MC Residual", 100, -1., 1.);
215 fHMCdy = dir.make<TH1F>(
"MCdy",
"Y MC Residual", 100, -1., 1.);
216 fHMCdz = dir.make<TH1F>(
"MCdz",
"Z MC Residual", 100, -1., 1.);
217 fHMCxpull = dir.make<TH1F>(
"MCxpull",
"X MC Pull", 100, -50., 50.);
218 fHMCypull = dir.make<TH1F>(
"MCypull",
"Y MC Pull", 100, -50., 50.);
219 fHMCzpull = dir.make<TH1F>(
"MCzpull",
"Z MC Pull", 100, -50., 50.);
252 int nclus = clusterh->size();
254 for (
int i = 0; i < nclus; ++i) {
256 std::vector<art::Ptr<recob::Hit>> clushits = fm.at(i);
257 int nhits = clushits.size();
261 ihit != clushits.end();
275 int nhits = hith->size();
278 for (
int i = 0; i < nhits; ++i)
295 for (
auto const& hitPtr : hits) {
304 std::vector<double> hitxyz = bt_serv->
HitToXYZ(clockData, hit);
305 tav = detProp.ConvertXToTicks(
313 fHDTUE->Fill(tpeak - tav);
317 fHDTVE->Fill(tpeak - tav);
321 fHDTWE->Fill(tpeak - tav);
330 std::vector<recob::SpacePoint> spts1;
331 std::vector<recob::SpacePoint> spts2;
332 std::vector<recob::SpacePoint> spts3;
346 <<
"Found " << spts1.size() <<
" space points using special time cut.";
361 <<
"Found " << spts2.size() <<
" space points using special seperation cut.";
373 MF_LOG_DEBUG(
"SpacePointAna") <<
"Found " << spts3.size()
374 <<
" space points using default cuts.";
380 for (
auto const& spt : spts1) {
381 if (spt.XYZ()[0] <
fMinX || spt.XYZ()[0] >
fMaxX || spt.XYZ()[1] <
fMinY ||
391 for (
auto const& hit1 : spthits | transform(
to_element)) {
393 unsigned int tpc1 = hit1WireID.
TPC;
394 unsigned int plane1 = hit1WireID.
Plane;
395 unsigned int wire1 = hit1WireID.
Wire;
400 for (
auto const& hit2 : spthits | transform(
to_element)) {
402 unsigned int tpc2 = hit2WireID.
TPC;
403 unsigned int plane2 = hit2WireID.
Plane;
404 unsigned int wire2 = hit2WireID.
Wire;
408 if (tpc1 == tpc2 && plane1 != plane2) {
416 fHDTUVU->Fill(
double(wire1), t1 - t2);
417 fHDTUVV->Fill(
double(wire2), t1 - t2);
421 fHDTWUW->Fill(
double(wire2), t2 - t1);
422 fHDTWUU->Fill(
double(wire1), t2 - t1);
428 fHDTVWV->Fill(
double(wire1), t1 - t2);
429 fHDTVWW->Fill(
double(wire2), t1 - t2);
433 fHDTUVU->Fill(
double(wire2), t2 - t1);
434 fHDTUVV->Fill(
double(wire1), t2 - t1);
440 fHDTWUW->Fill(
double(wire1), t1 - t2);
441 fHDTWUU->Fill(
double(wire2), t1 - t2);
445 fHDTVWV->Fill(
double(wire2), t2 - t1);
446 fHDTVWW->Fill(
double(wire1), t2 - t1);
456 for (
auto const& spt : spts2) {
457 if (spt.XYZ()[0] <
fMinX || spt.XYZ()[0] >
fMaxX || spt.XYZ()[1] <
fMinY ||
474 for (
auto const& spt : spts3) {
475 if (spt.XYZ()[0] <
fMinX || spt.XYZ()[0] >
fMaxX || spt.XYZ()[1] <
fMinY ||
480 fHx->Fill(spt.XYZ()[0]);
481 fHy->Fill(spt.XYZ()[1]);
482 fHz->Fill(spt.XYZ()[2]);
486 std::vector<art::Ptr<recob::Hit>> spthits;
488 for (
auto const& ptr : av_spthits) {
489 spthits.push_back(ptr);
494 for (
auto const& hitPtr : spthits) {
522 fHMCdx->Fill(spt.XYZ()[0] - mcxyz[0]);
523 fHMCdy->Fill(spt.XYZ()[1] - mcxyz[1]);
524 fHMCdz->Fill(spt.XYZ()[2] - mcxyz[2]);
525 if (spt.ErrXYZ()[0] > 0.)
526 fHMCxpull->Fill((spt.XYZ()[0] - mcxyz[0]) / std::sqrt(spt.ErrXYZ()[0]));
527 if (spt.ErrXYZ()[2] > 0.)
528 fHMCypull->Fill((spt.XYZ()[1] - mcxyz[1]) / std::sqrt(spt.ErrXYZ()[2]));
529 if (spt.ErrXYZ()[5] > 0.)
530 fHMCzpull->Fill((spt.XYZ()[2] - mcxyz[2]) / std::sqrt(spt.ErrXYZ()[5]));
void reserve(size_type n)
constexpr to_element_t to_element
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Declaration of signal hit object.
CryostatID_t Cryostat
Index of cryostat.
Planes which measure Z direction.
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
float Integral() const
Integral under the calibrated signal waveform of the hit, in tick x ADC units.
geo::View_t View() const
View for the plane of the hit.
WireID_t Wire
Index of the wire within its plane.
geo::WireID const & WireID() const
Initial tdc tick for hit.
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
EDAnalyzer(fhicl::ParameterSet const &pset)
const art::PtrVector< recob::Hit > & getAssociatedHits(const recob::SpacePoint &spt) const
const SpacePointAlg fSptalgSep
float PeakAmplitude() const
The estimated amplitude of the hit at its peak, in ADC units.
void makeMCTruthSpacePoints(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const art::PtrVector< recob::Hit > &hits, std::vector< recob::SpacePoint > &spts) const
double separation(const art::PtrVector< recob::Hit > &hits) const
bool isValid() const noexcept
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
#define DEFINE_ART_MODULE(klass)
std::string fHitModuleLabel
void push_back(Ptr< U > const &p)
void makeSpacePoints(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const art::PtrVector< recob::Hit > &hits, std::vector< recob::SpacePoint > &spts) const
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
void analyze(const art::Event &evt) override
bool merge() const noexcept
PlaneID_t Plane
Index of the plane within its TPC.
double correctedTime(detinfo::DetectorPropertiesData const &detProp, const recob::Hit &hit) const
Declaration of cluster object.
Detector simulation of raw signals on wires.
float ROISummedADC() const
The sum of calibrated ADC counts of the ROI (0. by default)
float PeakTime() const
Time of the signal peak, in tick units.
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
SpacePointAna(fhicl::ParameterSet const &pset)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Encapsulate the construction of a single detector plane .
const SpacePointAlg fSptalgTime
std::vector< double > SpacePointHitsToWeightedXYZ(detinfo::DetectorClocksData const &clockData, std::vector< art::Ptr< recob::Hit >> const &hits) const
void bookHistograms(bool mc)
const SpacePointAlg fSptalgDefault
constexpr WireID()=default
Default constructor: an invalid TPC ID.
float SigmaPeakTime() const
Uncertainty for the signal peak, in tick units.
2D representation of charge deposited in the TDC/wire plane
TPCID_t TPC
Index of the TPC within its cryostat.
TPCGeo const & TPC(TPCID const &tpcid=details::tpc_zero) const
Returns the specified TPC.
Algorithm for generating space points from hits.
std::string fClusterModuleLabel
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception
Encapsulate the construction of a single detector plane .