Public Member Functions | Private Member Functions | Private Attributes | List of all members
hit::GausHitFinderAna Class Reference

Base class for creation of raw signals on wires. More...

Inheritance diagram for hit::GausHitFinderAna:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 GausHitFinderAna (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void analyze (const art::Event &evt) override
 
void beginJob () override
 

Private Attributes

std::string fHitFinderModuleLabel
 
std::string fLArG4ModuleLabel
 
std::string fCalDataModuleLabel
 
TH1F * fHitResidualAll
 
TH1F * fHitResidualAllAlt
 
TH1F * fNumberOfHitsPerEvent
 
TH2F * fPeakTimeVsWire
 
TTree * fHTree
 
Int_t fRun
 
Int_t fEvt
 
Float_t fWireTotalCharge
 
Int_t fnHits
 
Int_t fWire [kMaxHits]
 
Float_t fStartTime [kMaxHits]
 
Float_t fEndTime [kMaxHits]
 
Float_t fPeakTime [kMaxHits]
 
Float_t fPeakTimeUncert [kMaxHits]
 
Float_t fCharge [kMaxHits]
 
Float_t fChargeUncert [kMaxHits]
 
Int_t fMultiplicity [kMaxHits]
 
Float_t fGOF [kMaxHits]
 
Float_t fTotalHitChargePerEvent
 
Float_t fTruePeakPos [kMaxHits]
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Base class for creation of raw signals on wires.

Definition at line 46 of file GausHitFinderAna_module.cc.

Constructor & Destructor Documentation

hit::GausHitFinderAna::GausHitFinderAna ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 94 of file GausHitFinderAna_module.cc.

94  : EDAnalyzer(pset)
95  {
96  fHitFinderModuleLabel = pset.get<std::string>("HitsModuleLabel");
97  fLArG4ModuleLabel = pset.get<std::string>("LArGeantModuleLabel");
98  fCalDataModuleLabel = pset.get<std::string>("CalDataModuleLabel");
99  }
std::string string
Definition: nybbler.cc:12
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25

Member Function Documentation

void hit::GausHitFinderAna::analyze ( const art::Event evt)
overrideprivate

Definition at line 139 of file GausHitFinderAna_module.cc.

140  {
141  // ### TTree Run/Event ###
142  fEvt = evt.id().event();
143  fRun = evt.run();
144 
146  auto const clock_data =
148  auto const det_prop =
150 
152  evt.getByLabel(fCalDataModuleLabel, wireVecHandle);
153 
154  // Charge directly from wire info
155  float TotWireCharge = 0;
156 
157  for (size_t wireIter = 0; wireIter < wireVecHandle->size(); wireIter++) {
158  art::Ptr<recob::Wire> wire(wireVecHandle, wireIter);
159  std::vector<float> signal(wire->Signal());
160 
161  for (auto timeIter = signal.begin(); timeIter + 2 < signal.end(); timeIter++) {
162 
163  if (*timeIter < 2) { continue; }
164 
165  TotWireCharge += *timeIter;
166  }
167  }
168 
169  fWireTotalCharge = TotWireCharge;
170 
171  // Reconstructed hit information
173  evt.getByLabel(fHitFinderModuleLabel, hitHandle);
174 
175  std::vector<art::Ptr<recob::Hit>> hits;
176  art::fill_ptr_vector(hits, hitHandle);
177 
178  float TotCharge = 0;
179  int hitCount = 0;
180  fnHits = hitHandle->size();
181  fNumberOfHitsPerEvent->Fill(hitHandle->size());
182 
183  for (size_t numHit = 0; numHit < hitHandle->size(); ++numHit) {
184  // === Finding Channel associated with the hit ===
185  art::Ptr<recob::Hit> hit(hitHandle, numHit);
186 
187  fWire[hitCount] = hit->WireID().Wire;
188  fStartTime[hitCount] = hit->PeakTimeMinusRMS();
189  fEndTime[hitCount] = hit->PeakTimePlusRMS();
190  fPeakTime[hitCount] = hit->PeakTime();
191  fPeakTimeUncert[hitCount] = hit->SigmaPeakTime();
192  fCharge[hitCount] = hit->Integral();
193  fChargeUncert[hitCount] = hit->SigmaIntegral();
194  fMultiplicity[hitCount] = hit->Multiplicity();
195  fGOF[hitCount] = hit->GoodnessOfFit();
196 
197  hitCount++;
198  TotCharge += hit->Integral();
199 
200  fPeakTimeVsWire->Fill(hit->WireID().Wire, hit->PeakTime());
201  } //<---End numHit
202  fTotalHitChargePerEvent = TotCharge;
203 
204  // Truth hit info from BackTracker
205 
206  unsigned int plane = 0;
207  Float_t TruthHitTime = 0, TruthHitCalculated = 0;
208  int count = 0;
209 
210  double time_tick = sampling_rate(clock_data) / 1000.;
211  double drift_velocity = det_prop.DriftVelocity(det_prop.Efield(), det_prop.Temperature());
212 
213  for (size_t nh = 0; nh < hitHandle->size(); nh++) {
214  // === Finding Channel associated with the hit ===
215  art::Ptr<recob::Hit> hitPoint(hitHandle, nh);
216  plane = hitPoint->WireID().Plane;
217 
218  // ===================================================================
219  // Using Track IDE's to locate the XYZ location from truth information
220  // ===================================================================
221  std::vector<sim::TrackIDE> trackides;
222  std::vector<double> xyz;
223  try {
225  trackides = bt_serv->HitToTrackIDEs(clock_data, hitPoint);
226  xyz = bt_serv->HitToXYZ(clock_data, hitPoint);
227  }
228  catch (cet::exception const&) {
229  mf::LogWarning("GausHitFinderAna") << "BackTrackerService Failed";
230  continue;
231  }
232 
233  // ==============================================================
234  // Calculating the truth tick position of the hit using 2 methods
235  // Method 1: ConvertXtoTicks from the detector properties package
236  // Method 2: Actually do the calculation myself to double check things
237  // ==============================================================
238 
239  // ### Method 1 ###
240  TruthHitTime = det_prop.ConvertXToTicks(
241  xyz[0], plane, hitPoint->WireID().TPC, hitPoint->WireID().Cryostat);
242 
243  // ### Method 2 ###
244  // ================================================
245  // Establishing the x-position of the current plane
246  // ================================================
247  const double origin[3] = {0.};
248  double pos[3];
249  geom->Plane(plane).LocalToWorld(origin, pos);
250  double planePos_timeCorr = (pos[0] / drift_velocity) * (1. / time_tick) + 60;
251  //<---x position of plane / drift velocity + 60 (Trigger offset)
252 
253  TruthHitCalculated = ((xyz[0]) / (drift_velocity * time_tick)) + planePos_timeCorr;
254 
255  fTruePeakPos[count] = TruthHitTime;
256  count++;
257  double hitresid = ((TruthHitTime - hitPoint->PeakTime()) / hitPoint->SigmaPeakTime());
258  fHitResidualAll->Fill(hitresid);
259 
260  double hitresidAlt =
261  ((TruthHitCalculated - hitPoint->PeakTime()) / hitPoint->SigmaPeakTime());
262  fHitResidualAllAlt->Fill(hitresidAlt);
263 
264  } //<---End nh loop
265 
266  fHTree->Fill();
267  } // end analyze method
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
Float_t fPeakTimeUncert[kMaxHits]
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
RunNumber_t run() const
Definition: DataViewImpl.cc:71
Detector simulation of raw signals on wires.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
EventNumber_t event() const
Definition: EventID.h:116
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
void LocalToWorld(const double *plane, double *world) const
Transform point from local plane frame to world frame.
Definition: PlaneGeo.h:1343
EventID id() const
Definition: Event.cc:34
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:227
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void hit::GausHitFinderAna::beginJob ( )
overrideprivatevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 103 of file GausHitFinderAna_module.cc.

104  {
106  fHitResidualAll = tfs->make<TH1F>("fHitResidualAll", "Hit Residual All", 1600, -400, 400);
107  fHitResidualAllAlt = tfs->make<TH1F>("fHitResidualAllAlt", "Hit Residual All", 1600, -400, 400);
109  tfs->make<TH1F>("fNumberOfHitsPerEvent", "Number of Hits in Each Event", 10000, 0, 10000);
111  tfs->make<TH2F>("fPeakTimeVsWire", "Peak Time vs Wire Number", 3200, 0, 3200, 9500, 0, 9500);
112 
113  fHTree = tfs->make<TTree>("HTree", "HTree");
114  fHTree->Branch("Evt", &fEvt, "Evt/I");
115  fHTree->Branch("Run", &fRun, "Run/I");
116  fHTree->Branch("WireTotalCharge", &fWireTotalCharge, "WireTotalCharge/F");
117 
118  // === Hit Info ===
119  fHTree->Branch("nHits", &fnHits, "nHits/I");
120  fHTree->Branch("Wire", &fWire, "Wire[nHits]/I");
121  fHTree->Branch("StartTime", &fStartTime, "fStartTime[nHits]/F");
122  fHTree->Branch("EndTime", &fEndTime, "fEndTime[nHits]/F");
123  fHTree->Branch("PeakTime", &fPeakTime, "fPeakTime[nHits]/F");
124  fHTree->Branch("PeakTimeUncert", &fPeakTimeUncert, "fPeakTimeUncert[nHits]/F");
125  fHTree->Branch("Charge", &fCharge, "fCharge[nHits]/F");
126  fHTree->Branch("ChargeUncert", &fChargeUncert, "fChargeUncert[nHits]/F");
127  fHTree->Branch("Multiplicity", &fMultiplicity, "fMultiplicity[nHits]/I");
128  fHTree->Branch("GOF", &fGOF, "fGOF[nHits]/F");
129 
130  // === Total Hit Information ===
131  fHTree->Branch("TotalHitChargePerEvent", &fTotalHitChargePerEvent, "TotalHitChargePerEvent/F");
132 
133  // === Truth Hit Information from BackTrackerService ===
134  fHTree->Branch("TruePeakPos", &fTruePeakPos, "fTruePeakPos[nHits]/F");
135  }
Float_t fPeakTimeUncert[kMaxHits]

Member Data Documentation

std::string hit::GausHitFinderAna::fCalDataModuleLabel
private

Definition at line 56 of file GausHitFinderAna_module.cc.

Float_t hit::GausHitFinderAna::fCharge[kMaxHits]
private

Definition at line 80 of file GausHitFinderAna_module.cc.

Float_t hit::GausHitFinderAna::fChargeUncert[kMaxHits]
private

Definition at line 81 of file GausHitFinderAna_module.cc.

Float_t hit::GausHitFinderAna::fEndTime[kMaxHits]
private

Definition at line 77 of file GausHitFinderAna_module.cc.

Int_t hit::GausHitFinderAna::fEvt
private

Definition at line 68 of file GausHitFinderAna_module.cc.

Float_t hit::GausHitFinderAna::fGOF[kMaxHits]
private

Definition at line 83 of file GausHitFinderAna_module.cc.

std::string hit::GausHitFinderAna::fHitFinderModuleLabel
private

Definition at line 54 of file GausHitFinderAna_module.cc.

TH1F* hit::GausHitFinderAna::fHitResidualAll
private

Definition at line 58 of file GausHitFinderAna_module.cc.

TH1F* hit::GausHitFinderAna::fHitResidualAllAlt
private

Definition at line 59 of file GausHitFinderAna_module.cc.

TTree* hit::GausHitFinderAna::fHTree
private

Definition at line 64 of file GausHitFinderAna_module.cc.

std::string hit::GausHitFinderAna::fLArG4ModuleLabel
private

Definition at line 55 of file GausHitFinderAna_module.cc.

Int_t hit::GausHitFinderAna::fMultiplicity[kMaxHits]
private

Definition at line 82 of file GausHitFinderAna_module.cc.

Int_t hit::GausHitFinderAna::fnHits
private

Definition at line 74 of file GausHitFinderAna_module.cc.

TH1F* hit::GausHitFinderAna::fNumberOfHitsPerEvent
private

Definition at line 60 of file GausHitFinderAna_module.cc.

Float_t hit::GausHitFinderAna::fPeakTime[kMaxHits]
private

Definition at line 78 of file GausHitFinderAna_module.cc.

Float_t hit::GausHitFinderAna::fPeakTimeUncert[kMaxHits]
private

Definition at line 79 of file GausHitFinderAna_module.cc.

TH2F* hit::GausHitFinderAna::fPeakTimeVsWire
private

Definition at line 61 of file GausHitFinderAna_module.cc.

Int_t hit::GausHitFinderAna::fRun
private

Definition at line 67 of file GausHitFinderAna_module.cc.

Float_t hit::GausHitFinderAna::fStartTime[kMaxHits]
private

Definition at line 76 of file GausHitFinderAna_module.cc.

Float_t hit::GausHitFinderAna::fTotalHitChargePerEvent
private

Definition at line 86 of file GausHitFinderAna_module.cc.

Float_t hit::GausHitFinderAna::fTruePeakPos[kMaxHits]
private

Definition at line 89 of file GausHitFinderAna_module.cc.

Int_t hit::GausHitFinderAna::fWire[kMaxHits]
private

Definition at line 75 of file GausHitFinderAna_module.cc.

Float_t hit::GausHitFinderAna::fWireTotalCharge
private

Definition at line 71 of file GausHitFinderAna_module.cc.


The documentation for this class was generated from the following file: