277 art::ServiceHandle<geo::Geometry const> geo;
278 auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(
e);
281 auto const& mchits_v = *
e.getValidHandle<std::vector<sim::MCHitCollection>>(
fMCHitModuleName);
291 std::vector<size_t> mchit_mult(geo->Nplanes(), 0);
292 for (
auto const& mchits : mchits_v) {
294 auto plane = geo->ChannelToWire(mchits.Channel()).at(0).Plane;
296 mchit_mult.at(plane) += mchits.size();
298 for (
auto const& mchit : mchits)
300 hMCHitQ_v.at(plane)->Fill(mchit.Charge(
true));
303 std::vector<size_t> recohit_mult(geo->Nplanes(), 0);
305 double search_time_sum = 0;
308 for (
size_t hit_index = 0; hit_index < recohits.size(); ++hit_index) {
310 auto const&
hit = recohits.at(hit_index);
312 auto const& wire_id =
hit.WireID();
316 recohit_mult.at(wire_id.Plane) += 1;
319 auto ch = geo->PlaneWireToChannel(wire_id.Plane, wire_id.Wire, wire_id.TPC, wire_id.Cryostat);
321 if (mchits_v.size() <= ch)
322 throw cet::exception(__PRETTY_FUNCTION__)
323 <<
"Channel " << ch <<
" not found in MCHit vector!" << std::endl;
326 auto const& mchits = mchits_v.at(ch);
328 if (ch != mchits.Channel())
329 throw cet::exception(__PRETTY_FUNCTION__)
330 <<
"MCHit channel & vector index mismatch: " << mchits.Channel() <<
" != " << ch
336 start_time.
SetTime(clock_data.TPCTick2TDC(
hit.PeakTimeMinusRMS()), 0);
337 peak_time.
SetTime(clock_data.TPCTick2TDC(
hit.PeakTime()), 0);
338 end_time.
SetTime(clock_data.TPCTick2TDC(
hit.PeakTimePlusRMS()), 0);
341 auto start_iter = std::lower_bound(mchits.begin(), mchits.end(),
start_time);
342 auto end_iter = std::upper_bound(mchits.begin(), mchits.end(),
end_time);
346 double reco_q =
hit.PeakAmplitude();
351 double abs_dt_min = 1e9;
354 while (start_iter != end_iter) {
355 mc_qsum += (*start_iter).Charge(
true);
357 double dt = (*start_iter).PeakTime() - peak_time.
PeakTime();
359 if (abs_dt < 0) abs_dt *= -1;
361 if (abs_dt < abs_dt_min) {
364 mc_q = (*start_iter).Charge(
true);
378 hCorrQ_v.at(wire_id.Plane)->Fill(mc_q, reco_q);
379 hCorrQSum_v.at(wire_id.Plane)->Fill(mc_qsum, reco_q);
381 hQRatio_v.at(wire_id.Plane)->Fill(reco_q / mc_q);
382 hDT_v.at(wire_id.Plane)->Fill(dt_min);
388 for (
unsigned char plane = 0; plane < geo->Nplanes(); ++plane) {
389 std::cout << mchit_mult.at(plane) << std::endl;
392 hCorrMult_v.at(plane)->Fill(mchit_mult.at(plane), recohit_mult.at(plane));
float PeakTime() const
Getter for start time.
TH1D * hMCHitSearchTimeSum
Time to search for corresponding MCHit per RecoHit summed over all RecoHits (per event) ...
void SetTime(const float peak, const float width)
Setter function for time.
std::vector< TH1D * > hQRatio_v
Histogram (per plane) for a ratio of RecoHit charge to the closest (in time) RecoHit charge...
std::vector< TH2D * > hCorrMult_v
Histogram (per plane) for # of MCHit vs. # of RecoHit.
TH1D * hMCHitReadTime
Time to read MCHit from disk.
std::vector< TH1D * > hDT_v
Histogram (per plane) for time-diff between one Reco hit and the closest (in time) RecoHit...
std::string fMCHitModuleName
Producer module for MCHit.
std::vector< TH1D * > hRecoHitMult_v
Histogram (per plane) for RecoHit multiplicity in each event.
then echo fcl sbnd_project sbnd_project sbnd_project sbnd_project production production end_time
std::vector< TH1D * > hRecoHitQ_v
Histogram (per plane) for RecoHit charge.
std::string fRecoHitModuleName
Producer module for recob::Hit.
std::vector< TH1D * > hQSumRatio_v
std::vector< TH1D * > hMCHitMultPerRecoHit_v
Histogram (per plane) for MCHit multiplicity within start=>end time region of RecoHit.
std::vector< TH2D * > hCorrQ_v
Histogram (per plane) for charge of one MCHit that is closest (in time) to one RecoHit.
then echo fcl sbnd_project sbnd_project sbnd_project sbnd_project production production start_time
TH1D * hMCHitSearchTime
Time to search for corresponding MCHit per RecoHit.
std::vector< TH1D * > hMCHitQ_v
Histogram (per plane) for all MCHit charge.
TH1D * hRecoHitReadTime
Time to read recob::Hit from disk.
std::vector< TH1D * > hMCHitMult_v
Histogram (per plane) for MCHit multiplicity in each event.
TH1D * hAnalysisTime
Time to run analyze() function.
BEGIN_PROLOG could also be cout
std::vector< TH2D * > hCorrQSum_v
Histogram (per plane) for charge sum of multiple MCHit found within start=>end time of one RecoHit...
std::vector< TH1D * > hVoidHitQ_v
Histogram (per plane) for charge of some RecoHit that has no corresponding MCHit. ...