9 #include "art/Framework/Core/EDAnalyzer.h"
10 #include "art/Framework/Core/ModuleMacros.h"
11 #include "art/Framework/Principal/Event.h"
12 #include "art/Framework/Principal/Handle.h"
13 #include "art/Framework/Services/Registry/ServiceHandle.h"
14 #include "art_root_io/TFileService.h"
15 #include "canvas/Persistency/Common/FindManyP.h"
16 #include "fhiclcpp/ParameterSet.h"
28 #include "nusimdata/SimulationBase/MCTruth.h"
33 #include "TProfile2D.h"
56 simb::MCParticle electron);
136 const double X0 = 14;
153 , fHitModuleLabel(pset.
get<
std::string>(
"HitModuleLabel",
"trajcluster"))
154 , fShowerModuleLabel(pset.
get<
std::string>(
"ShowerModuleLabel",
"tcshower"))
155 , fGenieGenModuleLabel(pset.
get<
std::string>(
"GenieGenModuleLabel",
"generator"))
156 , fDigitModuleLabel(pset.
get<
std::string>(
"DigitModuleLabel",
"largeant"))
157 , fCalorimetryAlg(pset.
get<fhicl::ParameterSet>(
"CalorimetryAlg"))
166 art::ServiceHandle<art::TFileService const>
tfs;
167 fShowerProfileSimLong =
168 tfs->make<TProfile>(
"fShowerProfileSimLong",
169 "longitudinal e- profile (true, simchannel);t;E (MeV)",
173 fShowerProfileHitLong = tfs->make<TProfile>(
174 "fShowerProfileHitLong",
"longitudinal e- profile (true, hit);t;E (MeV)", LBINS, LMIN, LMAX);
175 fShowerProfileRecoLong = tfs->make<TProfile>(
176 "fShowerProfileRecoLong",
"longitudinal e- profile (reco);t;Q", LBINS, LMIN, LMAX);
178 fShowerProfileSimLong2D = tfs->make<TProfile2D>(
179 "fShowerProfileSimLong2D",
180 "longitudinal e- profile (true, simchannel);t;electron energy (MeV);E (MeV)",
187 fShowerProfileHitLong2D =
188 tfs->make<TProfile2D>(
"fShowerProfileHitLong2D",
189 "longitudinal e- profile (true, hit);t;electron energy (MeV);E (MeV)",
196 fShowerProfileRecoLong2D =
197 tfs->make<TProfile2D>(
"fShowerProfileRecoLong2D",
198 "longitudinal e- profile (reco);t;electron energy (MeV);Q",
206 fShowerProfileSimTrans =
207 tfs->make<TProfile>(
"fShowerProfileSimTrans",
208 "transverse e- profile (true, simchannel);dist (cm);E (MeV)",
212 fShowerProfileHitTrans =
213 tfs->make<TProfile>(
"fShowerProfileHitTrans",
214 "transverse e- profile (true, hit);dist (cm);E (MeV)",
218 fShowerProfileRecoTrans = tfs->make<TProfile>(
219 "fShowerProfileRecoTrans",
"transverse e- profile (reco);dist (cm);Q", TBINS, TMIN, TMAX);
221 fShowerProfileSimTrans2D = tfs->make<TProfile2D>(
222 "fShowerProfileSimTrans2D",
223 "transverse e- profile (true, simchannel);t;electron energy (MeV);E (MeV)",
230 fShowerProfileHitTrans2D =
231 tfs->make<TProfile2D>(
"fShowerProfileHitTrans2D",
232 "transverse e- profile (true, hit);t;electron energy (MeV);E (MeV)",
239 fShowerProfileRecoTrans2D =
240 tfs->make<TProfile2D>(
"fShowerProfileRecoTrans2D",
241 "transverse e- profile (reco);t;electron energy (MeV);Q",
249 fShowerProfileSimTrans2D_1 = tfs->make<TProfile2D>(
250 "fShowerProfileSimTrans2D_1",
251 "transverse e- profile [0 <= t < 1] (true, simchannel);t;electron energy (MeV);E (MeV)",
258 fShowerProfileHitTrans2D_1 = tfs->make<TProfile2D>(
259 "fShowerProfileHitTrans2D_1",
260 "transverse e- profile [0 <= t < 1] (true, hit);t;electron energy (MeV);E (MeV)",
267 fShowerProfileRecoTrans2D_1 =
268 tfs->make<TProfile2D>(
"fShowerProfileRecoTrans2D_1",
269 "transverse e- profile [0 <= t < 1] (reco);t;electron energy (MeV);Q",
277 fShowerProfileSimTrans2D_2 = tfs->make<TProfile2D>(
278 "fShowerProfileSimTrans2D_2",
279 "transverse e- profile [1 <= t < 2] (true, simchannel);t;electron energy (MeV);E (MeV)",
286 fShowerProfileHitTrans2D_2 = tfs->make<TProfile2D>(
287 "fShowerProfileHitTrans2D_2",
288 "transverse e- profile [1 <= t < 2] (true, hit);t;electron energy (MeV);E (MeV)",
295 fShowerProfileRecoTrans2D_2 =
296 tfs->make<TProfile2D>(
"fShowerProfileRecoTrans2D_2",
297 "transverse e- profile [1 <= t < 2] (reco);t;electron energy (MeV);Q",
305 fShowerProfileSimTrans2D_3 = tfs->make<TProfile2D>(
306 "fShowerProfileSimTrans2D_3",
307 "transverse e- profile [2 <= t < 3] (true, simchannel);t;electron energy (MeV);E (MeV)",
314 fShowerProfileHitTrans2D_3 = tfs->make<TProfile2D>(
315 "fShowerProfileHitTrans2D_3",
316 "transverse e- profile [2 <= t < 3] (true, hit);t;electron energy (MeV);E (MeV)",
323 fShowerProfileRecoTrans2D_3 =
324 tfs->make<TProfile2D>(
"fShowerProfileRecoTrans2D_3",
325 "transverse e- profile [2 <= t < 3] (reco);t;electron energy (MeV);Q",
333 fShowerProfileSimTrans2D_4 = tfs->make<TProfile2D>(
334 "fShowerProfileSimTrans2D_4",
335 "transverse e- profile [3 <= t < 4] (true, simchannel);t;electron energy (MeV);E (MeV)",
342 fShowerProfileHitTrans2D_4 = tfs->make<TProfile2D>(
343 "fShowerProfileHitTrans2D_4",
344 "transverse e- profile [3 <= t < 4] (true, hit);t;electron energy (MeV);E (MeV)",
351 fShowerProfileRecoTrans2D_4 =
352 tfs->make<TProfile2D>(
"fShowerProfileRecoTrans2D_4",
353 "transverse e- profile [3 <= t < 4] (reco);t;electron energy (MeV);Q",
361 fShowerProfileSimTrans2D_5 = tfs->make<TProfile2D>(
362 "fShowerProfileSimTrans2D_5",
363 "transverse e- profile [4 <= t < 5] (true, simchannel);t;electron energy (MeV);E (MeV)",
370 fShowerProfileHitTrans2D_5 = tfs->make<TProfile2D>(
371 "fShowerProfileHitTrans2D_5",
372 "transverse e- profile [4 <= t < 5] (true, hit);t;electron energy (MeV);E (MeV)",
379 fShowerProfileRecoTrans2D_5 =
380 tfs->make<TProfile2D>(
"fShowerProfileRecoTrans2D_5",
381 "transverse e- profile [4 <= t < 5] (reco);t;electron energy (MeV);Q",
389 fLongitudinal = tfs->make<TH3F>(
"fLongitudinal",
390 "longitudinal e- profile;t;electron energy (MeV);Q",
400 fTransverse = tfs->make<TH3F>(
"fTransverse",
401 "transverse e- profile;dist (cm);electron energy (MeV);Q",
412 tfs->make<TH3F>(
"fTransverse_1",
413 "transverse e- profile [0 <= t < 1];dist (cm);electron energy (MeV);Q",
424 tfs->make<TH3F>(
"fTransverse_2",
425 "transverse e- profile [1 <= t < 2];dist (cm);electron energy (MeV);Q",
436 tfs->make<TH3F>(
"fTransverse_3",
437 "transverse e- profile [2 <= t < 3];dist (cm);electron energy (MeV);Q",
448 tfs->make<TH3F>(
"fTransverse_4",
449 "transverse e- profile [3 <= t < 4];dist (cm);electron energy (MeV);Q",
460 tfs->make<TH3F>(
"fTransverse_5",
461 "transverse e- profile [4 <= t < 5];dist (cm);electron energy (MeV);Q",
473 fLongitudinal_electron = tfs->make<TProfile>(
474 "fLongitudinal_electron",
"longitudinal e- profile (reco);t;Q", LBINS, LMIN, LMAX);
475 fTransverse1_electron =
476 tfs->make<TProfile>(
"fTransverse1_electron",
477 "transverse e- profile [0 <= t < 1] (reco);dist (cm);Q",
481 fTransverse2_electron =
482 tfs->make<TProfile>(
"fTransverse2_electron",
483 "transverse e- profile [1 <= t < 2] (reco);dist (cm);Q",
487 fTransverse3_electron =
488 tfs->make<TProfile>(
"fTransverse3_electron",
489 "transverse e- profile [2 <= t < 3] (reco);dist (cm);Q",
493 fTransverse4_electron =
494 tfs->make<TProfile>(
"fTransverse4_electron",
495 "transverse e- profile [3 <= t < 4] (reco);dist (cm);Q",
499 fTransverse5_electron =
500 tfs->make<TProfile>(
"fTransverse5_electron",
501 "transverse e- profile [4 <= t < 5] (reco);dist (cm);Q",
507 fLongitudinal_photon = tfs->make<TProfile>(
508 "fLongitudinal_photon",
"longitudinal photon profile (reco);t;Q", LBINS, LMIN, LMAX);
509 fTransverse1_photon =
510 tfs->make<TProfile>(
"fTransverse1_photon",
511 "transverse photon profile [0 <= t < 1] (reco);dist (cm);Q",
515 fTransverse2_photon =
516 tfs->make<TProfile>(
"fTransverse2_photon",
517 "transverse photon profile [1 <= t < 2] (reco);dist (cm);Q",
521 fTransverse3_photon =
522 tfs->make<TProfile>(
"fTransverse3_photon",
523 "transverse photon profile [2 <= t < 3] (reco);dist (cm);Q",
527 fTransverse4_photon =
528 tfs->make<TProfile>(
"fTransverse4_photon",
529 "transverse photon profile [3 <= t < 4] (reco);dist (cm);Q",
533 fTransverse5_photon =
534 tfs->make<TProfile>(
"fTransverse5_photon",
535 "transverse photon profile [4 <= t < 5] (reco);dist (cm);Q",
541 fLongitudinal_other = tfs->make<TProfile>(
542 "fLongitudinal_other",
"longitudinal other profile (reco);t;Q", LBINS, LMIN, LMAX);
544 tfs->make<TProfile>(
"fTransverse1_other",
545 "transverse other profile [0 <= t < 1] (reco);dist (cm);Q",
550 tfs->make<TProfile>(
"fTransverse2_other",
551 "transverse other profile [1 <= t < 2] (reco);dist (cm);Q",
556 tfs->make<TProfile>(
"fTransverse3_other",
557 "transverse other profile [2 <= t < 3] (reco);dist (cm);Q",
562 tfs->make<TProfile>(
"fTransverse4_other",
563 "transverse other profile [3 <= t < 4] (reco);dist (cm);Q",
568 tfs->make<TProfile>(
"fTransverse5_other",
569 "transverse other profile [4 <= t < 5] (reco);dist (cm);Q",
582 art::Handle<std::vector<recob::Hit>> hitListHandle;
583 std::vector<art::Ptr<recob::Hit>> hitlist;
584 if (evt.getByLabel(fHitModuleLabel, hitListHandle)) art::fill_ptr_vector(hitlist, hitListHandle);
586 art::Handle<std::vector<sim::SimChannel>> scListHandle;
587 std::vector<art::Ptr<sim::SimChannel>> simchanlist;
588 if (evt.getByLabel(fDigitModuleLabel, scListHandle))
589 art::fill_ptr_vector(simchanlist, scListHandle);
591 art::Handle<std::vector<recob::Shower>> showerListHandle;
592 std::vector<art::Ptr<recob::Shower>> showerlist;
593 if (evt.getByLabel(fShowerModuleLabel, showerListHandle))
594 art::fill_ptr_vector(showerlist, showerListHandle);
596 art::Handle<std::vector<simb::MCTruth>> mctruthListHandle;
597 std::vector<art::Ptr<simb::MCTruth>> mclist;
598 if (evt.getByLabel(fGenieGenModuleLabel, mctruthListHandle))
599 art::fill_ptr_vector(mclist, mctruthListHandle);
601 art::FindManyP<recob::Hit> shwfm(showerListHandle, evt, fShowerModuleLabel);
603 if (
empty(mclist))
return;
605 auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
606 auto const det_prop =
607 art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(evt, clock_data);
609 art::Ptr<simb::MCTruth> mctruth = mclist[0];
610 if (mctruth->NeutrinoSet()) {
611 if (
std::abs(mctruth->GetNeutrino().Nu().PdgCode()) == 12 &&
612 mctruth->GetNeutrino().CCNC() == 0) {
613 double elep = mctruth->GetNeutrino().Lepton().E();
614 if (showerlist.size()) {
615 std::vector<art::Ptr<recob::Hit>> showerhits = shwfm.at(0);
616 showerProfile(clock_data,
619 showerlist[0]->ShowerStart(),
620 showerlist[0]->Direction(),
623 showerProfileTrue(clock_data, det_prop, hitlist, elep);
624 showerProfileTrue(simchanlist, mctruth->GetNeutrino().Lepton());
639 art::ServiceHandle<geo::Geometry const> geom;
643 double shwVtxTime = detProp.
ConvertXToTicks(shwvtx[0], collectionPlane);
644 double shwVtxWire = geom->WireCoordinate(shwvtx[1], shwvtx[2], collectionPlane);
646 double shwTwoTime = detProp.
ConvertXToTicks(shwvtx[0] + shwdir[0], collectionPlane);
648 geom->WireCoordinate(shwvtx[1] + shwdir[1], shwvtx[2] + shwdir[2], collectionPlane);
650 TH1F* ltemp =
new TH1F(
"ltemp",
"ltemp", LBINS, LMIN, LMAX);
651 TH1F* ttemp =
new TH1F(
"ttemp",
"ttemp", TBINS, TMIN, TMAX);
653 TH1F* ttemp_1 =
new TH1F(
"ttemp_1",
"ttemp_1", TBINS, TMIN, TMAX);
654 TH1F* ttemp_2 =
new TH1F(
"ttemp_2",
"ttemp_2", TBINS, TMIN, TMAX);
655 TH1F* ttemp_3 =
new TH1F(
"ttemp_3",
"ttemp_3", TBINS, TMIN, TMAX);
656 TH1F* ttemp_4 =
new TH1F(
"ttemp_4",
"ttemp_4", TBINS, TMIN, TMAX);
657 TH1F* ttemp_5 =
new TH1F(
"ttemp_5",
"ttemp_5", TBINS, TMIN, TMAX);
659 for (
size_t i = 0; i < showerhits.size(); ++i) {
660 if (showerhits[i]->
WireID().Plane != collectionPlane.Plane)
continue;
662 double wirePitch = geom->WirePitch(showerhits[i]->
WireID());
666 double xvtx = shwVtxTime * tickToDist;
667 double yvtx = shwVtxWire * wirePitch;
669 double xtwo = shwTwoTime * tickToDist;
670 double ytwo = shwTwoWire * wirePitch;
672 double xtwoorth = (ytwo - yvtx) + xvtx;
673 double ytwoorth = -(xtwo - xvtx) + yvtx;
675 double xhit = showerhits[i]->PeakTime() * tickToDist;
676 double yhit = showerhits[i]->WireID().Wire * wirePitch;
678 double ldist =
std::abs((ytwoorth - yvtx) * xhit - (xtwoorth - xvtx) * yhit + xtwoorth * yvtx -
680 std::hypot(ytwoorth - yvtx, xtwoorth - xvtx);
681 double tdist = ((ytwo - yvtx) * xhit - (xtwo - xvtx) * yhit + xtwo * yvtx - ytwo * xvtx) /
682 std::hypot(ytwo - yvtx, xtwo - xvtx);
684 double to3D = 1. / std::hypot(xvtx - xtwo,
688 double t = ldist /
X0;
690 double Q = showerhits[i]->Integral() *
691 fCalorimetryAlg.LifetimeCorrection(clockData, detProp, showerhits[i]->PeakTime());
694 ttemp->Fill(tdist, Q);
697 ttemp_1->Fill(tdist, Q);
699 ttemp_2->Fill(tdist, Q);
701 ttemp_3->Fill(tdist, Q);
703 ttemp_4->Fill(tdist, Q);
705 ttemp_5->Fill(tdist, Q);
709 for (
int i = 0; i < LBINS; ++i) {
710 if (ltemp->GetBinContent(i + 1) == 0)
continue;
711 fShowerProfileRecoLong->Fill(ltemp->GetBinCenter(i + 1), ltemp->GetBinContent(i + 1));
712 fShowerProfileRecoLong2D->Fill(ltemp->GetBinCenter(i + 1), elep, ltemp->GetBinContent(i + 1));
713 fLongitudinal->Fill(ltemp->GetBinCenter(i + 1), elep, ltemp->GetBinContent(i + 1));
716 for (
int i = 0; i < TBINS; ++i) {
717 if (ttemp->GetBinContent(i + 1) == 0)
continue;
718 fShowerProfileRecoTrans->Fill(ttemp->GetBinCenter(i + 1), ttemp->GetBinContent(i + 1));
719 fShowerProfileRecoTrans2D->Fill(ttemp->GetBinCenter(i + 1), elep, ttemp->GetBinContent(i + 1));
720 fTransverse->Fill(ttemp->GetBinCenter(i + 1), elep, ttemp->GetBinContent(i + 1));
722 fShowerProfileRecoTrans2D_1->Fill(
723 ttemp_1->GetBinCenter(i + 1), elep, ttemp_1->GetBinContent(i + 1));
724 fShowerProfileRecoTrans2D_2->Fill(
725 ttemp_2->GetBinCenter(i + 1), elep, ttemp_2->GetBinContent(i + 1));
726 fShowerProfileRecoTrans2D_3->Fill(
727 ttemp_3->GetBinCenter(i + 1), elep, ttemp_3->GetBinContent(i + 1));
728 fShowerProfileRecoTrans2D_4->Fill(
729 ttemp_4->GetBinCenter(i + 1), elep, ttemp_4->GetBinContent(i + 1));
730 fShowerProfileRecoTrans2D_5->Fill(
731 ttemp_5->GetBinCenter(i + 1), elep, ttemp_5->GetBinContent(i + 1));
733 fTransverse_1->Fill(ttemp_1->GetBinCenter(i + 1), elep, ttemp_1->GetBinContent(i + 1));
734 fTransverse_2->Fill(ttemp_2->GetBinCenter(i + 1), elep, ttemp_2->GetBinContent(i + 1));
735 fTransverse_3->Fill(ttemp_3->GetBinCenter(i + 1), elep, ttemp_3->GetBinContent(i + 1));
736 fTransverse_4->Fill(ttemp_4->GetBinCenter(i + 1), elep, ttemp_4->GetBinContent(i + 1));
737 fTransverse_5->Fill(ttemp_5->GetBinCenter(i + 1), elep, ttemp_5->GetBinContent(i + 1));
749 art::ServiceHandle<geo::Geometry const> geom;
751 art::ServiceHandle<cheat::BackTrackerService const> btserv;
752 art::ServiceHandle<cheat::ParticleInventoryService const> piserv;
753 std::map<int, double> trkID_E;
755 TH1F* ltemp =
new TH1F(
"ltemp",
"ltemp", LBINS, LMIN, LMAX);
756 TH1F* ttemp =
new TH1F(
"ttemp",
"ttemp", TBINS, TMIN, TMAX);
758 TH1F* ttemp_1 =
new TH1F(
"ttemp_1",
"ttemp_1", TBINS, TMIN, TMAX);
759 TH1F* ttemp_2 =
new TH1F(
"ttemp_2",
"ttemp_2", TBINS, TMIN, TMAX);
760 TH1F* ttemp_3 =
new TH1F(
"ttemp_3",
"ttemp_3", TBINS, TMIN, TMAX);
761 TH1F* ttemp_4 =
new TH1F(
"ttemp_4",
"ttemp_4", TBINS, TMIN, TMAX);
762 TH1F* ttemp_5 =
new TH1F(
"ttemp_5",
"ttemp_5", TBINS, TMIN, TMAX);
770 double shwvtxT = -999;
771 double shwvtxW = -999;
772 double shwtwoT = -999;
773 double shwtwoW = -999;
775 double shwvtxx = -999;
776 double shwvtxy = -999;
777 double shwtwox = -999;
778 double shwtwoy = -999;
779 double xtwoorth = -999;
780 double ytwoorth = -999;
782 double wirePitch = -999;
783 double tickToDist = -999;
785 bool foundParent =
false;
787 for (
auto const&
hit : allhits) {
788 if (
hit->WireID().Plane != collectionPlane.Plane)
continue;
791 std::vector<sim::TrackIDE> trackIDs = btserv->HitToEveTrackIDEs(clockData,
hit);
793 for (
size_t j = 0; j < trackIDs.size(); ++j) {
795 if (
std::abs((piserv->TrackIdToParticle_P(trackIDs[j].trackID))->PdgCode()) != 11)
continue;
796 if (
std::abs((piserv->TrackIdToParticle_P(trackIDs[j].trackID))->Mother()) != 0)
continue;
799 xvtx = (piserv->TrackIdToParticle_P(trackIDs[j].trackID))->Vx();
800 yvtx = (piserv->TrackIdToParticle_P(trackIDs[j].trackID))->Vy();
801 zvtx = (piserv->TrackIdToParticle_P(trackIDs[j].trackID))->Vz();
803 xtwo = xvtx + (piserv->TrackIdToParticle_P(trackIDs[j].trackID))->Px();
804 ytwo = yvtx + (piserv->TrackIdToParticle_P(trackIDs[j].trackID))->Py();
805 ztwo = zvtx + (piserv->TrackIdToParticle_P(trackIDs[j].trackID))->Pz();
808 shwvtxW = geom->WireCoordinate(yvtx, zvtx, collectionPlane);
811 shwtwoW = geom->WireCoordinate(ytwo, ztwo, collectionPlane);
813 wirePitch = geom->WirePitch(
hit->WireID());
817 shwvtxx = shwvtxT * tickToDist;
818 shwvtxy = shwvtxW * wirePitch;
820 shwtwox = shwtwoT * tickToDist;
821 shwtwoy = shwtwoW * wirePitch;
823 xtwoorth = (shwtwoy - shwvtxy) + shwvtxx;
824 ytwoorth = -(shwtwox - shwvtxx) + shwvtxy;
828 double xhit =
hit->PeakTime() * tickToDist;
829 double yhit =
hit->WireID().Wire * wirePitch;
831 double ldist =
abs((ytwoorth - shwvtxy) * xhit - (xtwoorth - shwvtxx) * yhit +
832 xtwoorth * shwvtxy - ytwoorth * shwvtxx) /
833 std::hypot(ytwoorth - shwvtxy, xtwoorth - shwvtxx);
834 double tdist = ((shwtwoy - shwvtxy) * xhit - (shwtwox - shwvtxx) * yhit + shwtwox * shwvtxy -
836 std::hypot(shwtwoy - shwvtxy, shwtwox - shwvtxx);
838 double to3D = std::hypot(xvtx - xtwo, yvtx - ytwo, zvtx - ztwo) /
839 std::hypot(shwvtxx - shwtwox,
843 double t = ldist /
X0;
845 double energy = trackIDs[j].energy;
847 ltemp->Fill(t, energy);
848 ttemp->Fill(tdist, energy);
851 ttemp_1->Fill(tdist, energy);
853 ttemp_2->Fill(tdist, energy);
855 ttemp_3->Fill(tdist, energy);
857 ttemp_4->Fill(tdist, energy);
859 ttemp_5->Fill(tdist, energy);
865 for (
int i = 0; i < LBINS; ++i) {
866 if (ltemp->GetBinContent(i + 1) == 0)
continue;
867 fShowerProfileHitLong->Fill(ltemp->GetBinCenter(i + 1), ltemp->GetBinContent(i + 1));
868 fShowerProfileHitLong2D->Fill(ltemp->GetBinCenter(i + 1), elep, ltemp->GetBinContent(i + 1));
871 for (
int i = 0; i < TBINS; ++i) {
872 if (ttemp->GetBinContent(i + 1) == 0)
continue;
873 fShowerProfileHitTrans->Fill(ttemp->GetBinCenter(i + 1), ttemp->GetBinContent(i + 1));
874 fShowerProfileHitTrans2D->Fill(ttemp->GetBinCenter(i + 1), elep, ttemp->GetBinContent(i + 1));
876 fShowerProfileHitTrans2D_1->Fill(
877 ttemp_1->GetBinCenter(i + 1), elep, ttemp_1->GetBinContent(i + 1));
878 fShowerProfileHitTrans2D_2->Fill(
879 ttemp_2->GetBinCenter(i + 1), elep, ttemp_2->GetBinContent(i + 1));
880 fShowerProfileHitTrans2D_3->Fill(
881 ttemp_3->GetBinCenter(i + 1), elep, ttemp_3->GetBinContent(i + 1));
882 fShowerProfileHitTrans2D_4->Fill(
883 ttemp_4->GetBinCenter(i + 1), elep, ttemp_4->GetBinContent(i + 1));
884 fShowerProfileHitTrans2D_5->Fill(
885 ttemp_5->GetBinCenter(i + 1), elep, ttemp_5->GetBinContent(i + 1));
893 simb::MCParticle electron)
895 art::ServiceHandle<cheat::ParticleInventoryService const> piserv;
896 art::ServiceHandle<geo::Geometry const> geom;
898 std::vector<sim::MCEnDep> alledep;
900 TH1F* ltemp =
new TH1F(
"ltemp",
"ltemp", LBINS, LMIN, LMAX);
901 TH1F* ttemp =
new TH1F(
"ttemp",
"ttemp", TBINS, TMIN, TMAX);
903 TH1F* ttemp_1 =
new TH1F(
"ttemp_1",
"ttemp_1", TBINS, TMIN, TMAX);
904 TH1F* ttemp_2 =
new TH1F(
"ttemp_2",
"ttemp_2", TBINS, TMIN, TMAX);
905 TH1F* ttemp_3 =
new TH1F(
"ttemp_3",
"ttemp_3", TBINS, TMIN, TMAX);
906 TH1F* ttemp_4 =
new TH1F(
"ttemp_4",
"ttemp_4", TBINS, TMIN, TMAX);
907 TH1F* ttemp_5 =
new TH1F(
"ttemp_5",
"ttemp_5", TBINS, TMIN, TMAX);
910 for (
size_t i = 0; i < allchan.size(); ++i) {
911 art::Ptr<sim::SimChannel> simchan = allchan[i];
912 if (geom->View(simchan->Channel()) !=
geo::kV)
continue;
913 auto tdc_ide_map = simchan->TDCIDEMap();
915 for (
auto const& tdc_ide_pair : tdc_ide_map) {
916 for (
auto const& ide : tdc_ide_pair.second) {
917 if (piserv->TrackIdToMotherParticle_P(ide.trackID) == NULL)
continue;
918 if (
std::abs(piserv->TrackIdToMotherParticle_P(ide.trackID)->PdgCode()) != 11)
continue;
925 alledep.push_back(edep);
932 double x0 = electron.Vx();
933 double y0 = electron.Vy();
934 double z0 = electron.Vz();
936 double x2 = electron.Px();
937 double y2 = electron.Py();
938 double z2 = electron.Pz();
940 TVector3 v0(x2, y2, z2);
943 for (
size_t i = 0; i < alledep.size(); ++i) {
944 double x = (double)alledep[i].Vertex()[0];
945 double y = (double)alledep[i].Vertex()[1];
946 double z = (double)alledep[i].Vertex()[2];
948 TVector3 v1(x - x0, y - y0, z - z0);
950 double ldist = v0.Dot(v1);
951 double t = ldist /
X0;
952 double tdist = (v0.Orthogonal()).Dot(v1);
954 double energy = alledep[i].Energy();
956 ltemp->Fill(t, energy);
957 ttemp->Fill(tdist, energy);
960 ttemp_1->Fill(tdist, energy);
962 ttemp_2->Fill(tdist, energy);
964 ttemp_3->Fill(tdist, energy);
966 ttemp_4->Fill(tdist, energy);
968 ttemp_5->Fill(tdist, energy);
971 for (
int i = 0; i < LBINS; ++i) {
972 if (ltemp->GetBinContent(i + 1) == 0)
continue;
973 fShowerProfileSimLong->Fill(ltemp->GetBinCenter(i + 1), ltemp->GetBinContent(i + 1));
974 fShowerProfileSimLong2D->Fill(
975 ltemp->GetBinCenter(i + 1), electron.E(), ltemp->GetBinContent(i + 1));
978 for (
int i = 0; i < TBINS; ++i) {
979 if (ttemp->GetBinContent(i + 1) == 0)
continue;
980 fShowerProfileSimTrans->Fill(ttemp->GetBinCenter(i + 1), ttemp->GetBinContent(i + 1));
981 fShowerProfileSimTrans2D->Fill(
982 ttemp->GetBinCenter(i + 1), electron.E(), ttemp->GetBinContent(i + 1));
984 fShowerProfileSimTrans2D_1->Fill(
985 ttemp_1->GetBinCenter(i + 1), electron.E(), ttemp_1->GetBinContent(i + 1));
986 fShowerProfileSimTrans2D_2->Fill(
987 ttemp_2->GetBinCenter(i + 1), electron.E(), ttemp_2->GetBinContent(i + 1));
988 fShowerProfileSimTrans2D_3->Fill(
989 ttemp_3->GetBinCenter(i + 1), electron.E(), ttemp_3->GetBinContent(i + 1));
990 fShowerProfileSimTrans2D_4->Fill(
991 ttemp_4->GetBinCenter(i + 1), electron.E(), ttemp_4->GetBinContent(i + 1));
992 fShowerProfileSimTrans2D_5->Fill(
993 ttemp_5->GetBinCenter(i + 1), electron.E(), ttemp_5->GetBinContent(i + 1));
process_name opflash particleana ie ie ie z
TProfile * fTransverse4_photon
TCShowerTemplateMaker(fhicl::ParameterSet const &pset)
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
void analyze(const art::Event &evt) override
TProfile2D * fShowerProfileSimTrans2D_5
process_name opflash particleana ie x
TProfile * fTransverse3_photon
TProfile * fLongitudinal_photon
TProfile2D * fShowerProfileSimTrans2D_2
Declaration of signal hit object.
TProfile * fShowerProfileRecoTrans
std::string fHitModuleLabel
double Temperature() const
In kelvin.
std::string fShowerModuleLabel
TProfile * fLongitudinal_electron
TProfile2D * fShowerProfileHitTrans2D_2
void SetTrackId(unsigned int id)
TProfile * fTransverse4_electron
void showerProfile(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> showerhits, TVector3 shwvtx, TVector3 shwdir, double elep)
TProfile2D * fShowerProfileSimTrans2D_1
TProfile * fTransverse2_photon
TProfile2D * fShowerProfileHitTrans2D_4
TProfile * fShowerProfileSimLong
TProfile2D * fShowerProfileHitTrans2D_1
double Efield(unsigned int planegap=0) const
kV/cm
TProfile * fShowerProfileSimTrans
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
TProfile * fTransverse1_photon
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
TProfile2D * fShowerProfileRecoTrans2D_4
void showerProfileTrue(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< recob::Hit >> allhits, double elep)
standard_singlep gaussian distribution X0
process_name opflash particleana ie ie y
IDparameter< geo::WireID > WireID
Member type of validated geo::WireID parameter.
TProfile * fTransverse1_other
std::string fDigitModuleLabel
TProfile2D * fShowerProfileRecoTrans2D_5
void SetVertex(float x, float y, float z)
double ConvertXToTicks(double X, int p, int t, int c) const
TProfile * fTransverse5_other
double DriftVelocity(double efield=0., double temperature=0.) const
cm/us
TProfile * fLongitudinal_other
TProfile2D * fShowerProfileHitTrans2D_3
TProfile * fShowerProfileRecoLong
TProfile2D * fShowerProfileRecoTrans2D_2
TProfile2D * fShowerProfileSimLong2D
TProfile * fTransverse5_electron
TProfile2D * fShowerProfileSimTrans2D
TProfile * fShowerProfileHitTrans
TProfile * fTransverse3_electron
Contains all timing reference information for the detector.
TProfile * fShowerProfileHitLong
TProfile2D * fShowerProfileRecoTrans2D_3
TProfile2D * fShowerProfileHitTrans2D
object containing MC truth information necessary for making RawDigits and doing back tracking ...
TProfile2D * fShowerProfileSimTrans2D_4
art::ServiceHandle< art::TFileService > tfs
TProfile * fTransverse4_other
calo::CalorimetryAlg fCalorimetryAlg
TProfile2D * fShowerProfileHitLong2D
TProfile * fTransverse5_photon
TProfile2D * fShowerProfileRecoLong2D
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
bool empty(FixedBins< T, C > const &) noexcept
TProfile2D * fShowerProfileRecoTrans2D_1
TProfile * fTransverse3_other
TProfile2D * fShowerProfileRecoTrans2D
TProfile * fTransverse2_electron
TProfile2D * fShowerProfileHitTrans2D_5
art framework interface to geometry description
TProfile2D * fShowerProfileSimTrans2D_3
TProfile * fTransverse1_electron
std::string fGenieGenModuleLabel
TProfile * fTransverse2_other