10 #include "cetlib/search_path.h" 11 #include "cetlib/cpu_timer.h" 22 #include "larevt/CalibrationDBI/Interface/ChannelStatusService.h" 23 #include "larevt/CalibrationDBI/Interface/ChannelStatusProvider.h" 105 m_detector = lar::providerFrom<detinfo::DetectorPropertiesService>();
112 cet::cpu_timer theClockMakeHits;
124 if (!hitSpacePointAssnsHandle.
isValid())
return;
128 using SpacePointHitVecMap = std::map<const recob::SpacePoint*, std::vector<const recob::Hit*>>;
129 using RecobHitSet = std::set<const recob::Hit*>;
131 SpacePointHitVecMap spacePointHitVecMap;
132 RecobHitSet recobHitSet;
134 for(
auto& assnPair : *hitSpacePointAssnsHandle)
139 spacePointHitVecMap[spacePoint.
get()].push_back(recobHit.
get());
140 recobHitSet.insert(recobHit.
get());
141 recobHitToArtPtrMap[recobHit.
get()] = recobHit;
146 std::map<size_t, double> planeOffsetMap;
148 planeOffsetMap[0] = 0.;
153 using RecobHitTo2DHitMap = std::map<const recob::Hit*,const reco::ClusterHit2D*>;
155 RecobHitTo2DHitMap recobHitTo2DHitMap;
162 for(
auto& recobHit : recobHitSet)
166 double hitPeakTime(recobHit->PeakTime() - planeOffsetMap[hitWireID.Plane]);
175 for(
auto& pointPair : spacePointHitVecMap)
178 const std::vector<const recob::Hit*>& recobHitVec = pointPair.second;
180 if (recobHitVec.size() != 3)
182 std::cout <<
"************>>>>>> do not have 3 hits associated to space point! " << recobHitVec.size() <<
" ***************" << std::endl;
186 std::vector<const reco::ClusterHit2D*> hit2DVec(recobHitVec.size());
188 for(
const auto& recobHit : recobHitVec)
196 float avePeakTime(0.);
198 float sigmaPeakTime(0.);
200 for(
const auto& hit2D : hit2DVec)
202 float hitSigma = hit2D->getHit().RMS();
203 float weight = 1. / (hitSigma * hitSigma);
205 avePeakTime += weight * hit2D->getTimeTicks();
207 sigmaPeakTime += hitSigma * hitSigma;
210 avePeakTime /= weightSum;
211 sigmaPeakTime = std::sqrt(sigmaPeakTime);
214 float hitChiSquare(0.);
216 for(
const auto& hit2D : hit2DVec)
218 float hitSigma = hit2D->getHit().RMS();
220 hitChiSquare += (hit2D->getTimeTicks() - avePeakTime) / (hitSigma * hitSigma);
224 float position[] = { float(spacePoint->
XYZ()[0]),
float(spacePoint->
XYZ()[1]),
float(spacePoint->
XYZ()[2])};
225 float totalCharge = hit2DVec[0]->getHit().Integral() + hit2DVec[1]->getHit().Integral() + hit2DVec[2]->getHit().Integral();
229 hitVector.resize(3,NULL);
232 hitVector.at(hit2DVec[0]->getHit().WireID().
Plane) = hit2DVec[0];
233 hitVector.at(hit2DVec[1]->getHit().WireID().
Plane) = hit2DVec[1];
234 hitVector.at(hit2DVec[2]->getHit().WireID().
Plane) = hit2DVec[2];
237 std::vector<geo::WireID> wireIDVec = {
geo::WireID(0,0,
geo::kU,0),
geo::WireID(0,0,
geo::kV,0),
geo::WireID(0,0,
geo::kW,0)};
239 for(
const auto&
hit : hitVector)
241 wireIDVec[
hit->getHit().WireID().Plane] =
hit->getHit().WireID();
248 unsigned int statusBits(0x7);
251 std::vector<float> hitDelTSigVec = {0.,0.,0.};
253 hitDelTSigVec[0] = std::fabs(hitVector[0]->getTimeTicks() - 0.5 * (hitVector[1]->getTimeTicks() + hitVector[2]->getTimeTicks()));
254 hitDelTSigVec[1] = std::fabs(hitVector[1]->getTimeTicks() - 0.5 * (hitVector[2]->getTimeTicks() + hitVector[0]->getTimeTicks()));
255 hitDelTSigVec[2] = std::fabs(hitVector[2]->getTimeTicks() - 0.5 * (hitVector[0]->getTimeTicks() + hitVector[1]->getTimeTicks()));
257 float deltaPeakTime = *std::min_element(hitDelTSigVec.begin(),hitDelTSigVec.end());
277 theClockMakeHits.stop();
282 mf::LogDebug(
"Cluster3D") <<
">>>>> 3D hit building done, found " << hitPairList.size() <<
" 3D Hits" << std::endl;
const detinfo::DetectorProperties * m_detector
art::InputTag m_spacePointTag
Data members to follow.
std::vector< float > m_timeVector
geo::WireID WireID() const
Initial tdc tick for hit.
float getTimeToExecute(IHit3DBuilder::TimeValues index) const override
If monitoring, recover the time to execute a particular function.
Declaration of signal hit object.
std::vector< reco::ClusterHit2D > Hit2DVector
~SpacePointHit3DBuilder()
Destructor.
std::list< std::unique_ptr< reco::ClusterHit3D >> HitPairList
Hit2DVector m_clusterHit2DMasterVec
T get(std::string const &key) const
const recob::Hit & getHit() const
SpacePointHit3DBuilder class definiton.
TimeValues
enumerate the possible values for time checking if monitoring timing
std::map< const recob::Hit *, art::Ptr< recob::Hit >> RecobHitToPtrMap
Defines a structure mapping art representation to internal.
PlaneID_t Plane
Index of the plane within its TPC.
IHit3DBuilder interface class definiton.
Detector simulation of raw signals on wires.
This provides an art tool interface definition for tools which construct 3D hits used in 3D clusterin...
std::vector< const reco::ClusterHit2D * > ClusterHit2DVec
virtual double ConvertTicksToX(double ticks, int p, int t, int c) const =0
const double * XYZ() const
Utility object to perform functions of association.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
SpacePointHit3DBuilder(fhicl::ParameterSet const &pset)
Constructor.
void Hit3DBuilder(const art::Event &evt, reco::HitPairList &hitPairList, RecobHitToPtrMap &) const override
Given a set of recob hits, run DBscan to form 3D clusters.
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
Planes which measure W (third view for Bo, MicroBooNE, etc).
recob::tracking::Plane Plane
art framework interface to geometry description
void configure(const fhicl::ParameterSet &) override
Interface for configuring the particular algorithm tool.
virtual double GetXTicksOffset(int p, int t, int c) const =0