10 #include "art/Framework/Core/ModuleMacros.h"
17 #include "art/Framework/Principal/Event.h"
18 #include "art/Framework/Principal/Handle.h"
19 #include "art/Framework/Services/Registry/ServiceHandle.h"
20 #include "art_root_io/TFileService.h"
21 #include "canvas/Persistency/Common/Ptr.h"
22 #include "fhiclcpp/ParameterSet.h"
23 #include "messagefacility/MessageLogger/MessageLogger.h"
31 #include "nug4/ParticleNavigation/ParticleList.h"
32 #include "nusimdata/SimulationBase/MCParticle.h"
36 #include "art/Framework/Core/EDAnalyzer.h"
110 art::ServiceHandle<art::TFileService const>
tfs;
115 fHTree = tfs->make<TTree>(
"HTree",
"HTree");
147 fHTree->Branch(
"Htp0", fTimep0,
"Htp0[HNp0]/F");
156 fHTree->Branch(
"HMCXYZp0",
fXYZp0,
"HMCXYZp0[HN3p0]/F");
157 fHTree->Branch(
"HMCXYZp1",
fXYZp1,
"HMCXYZp1[HN3p1]/F");
158 fHTree->Branch(
"HMCXYZp2",
fXYZp2,
"HMCXYZp2[HN3p2]/F");
177 if (evt.isRealData()) {
178 throw cet::exception(
"HitFinderAna: ") <<
"Not for use on Data yet...\n";
181 art::Handle<std::vector<recob::Hit>> hitHandle;
184 art::ServiceHandle<cheat::BackTrackerService const> bt_serv;
185 art::ServiceHandle<cheat::ParticleInventoryService const> pi_serv;
186 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
188 sim::ParticleList
const& _particleList = pi_serv->ParticleList();
190 MF_LOG_VERBATIM(
"HitFinderAna") << _particleList;
192 art::ServiceHandle<geo::Geometry const> geom;
194 std::map<geo::PlaneID, std::vector<art::Ptr<recob::Hit>>> planeIDToHits;
195 for (
size_t h = 0;
h < hitHandle->size(); ++
h)
196 planeIDToHits[hitHandle->at(
h).WireID().planeID()].push_back(
197 art::Ptr<recob::Hit>(hitHandle,
h));
199 for (
auto mapitr : planeIDToHits) {
208 auto itr = mapitr.second.begin();
209 while (itr != mapitr.second.end()) {
212 fEvt = evt.id().event();
214 std::vector<sim::TrackIDE> trackides = bt_serv->HitToTrackIDEs(clockData, *itr);
215 std::vector<sim::TrackIDE>::iterator idesitr = trackides.begin();
216 std::vector<double> xyz = bt_serv->HitToXYZ(clockData, *itr);
223 for (
unsigned int kk = 0; kk < 3; ++kk) {
227 while (idesitr != trackides.end()) {
229 if (_particleList.find((*idesitr).trackID) != _particleList.end()) {
230 const simb::MCParticle* particle = _particleList.at((*idesitr).trackID);
240 else if (pid.
Plane == 1 &&
fNp1 < 9000) {
245 for (
unsigned int kk = 0; kk < 3; ++kk) {
249 while (idesitr != trackides.end()) {
251 if (_particleList.find((*idesitr).trackID) != _particleList.end()) {
252 const simb::MCParticle* particle = _particleList.at((*idesitr).trackID);
261 else if (pid.
Plane == 2 &&
fNp2 < 9000) {
266 for (
unsigned int kk = 0; kk < 3; ++kk) {
270 while (idesitr != trackides.end()) {
272 if (_particleList.find((*idesitr).trackID) != _particleList.end()) {
273 const simb::MCParticle* particle = _particleList.at((*idesitr).trackID);
Declaration of signal hit object.
The data type to uniquely identify a Plane.
std::string fFFTHitFinderModuleLabel
std::string fLArG4ModuleLabel
HitFinderAna(fhicl::ParameterSet const &pset)
Base class for creation of raw signals on wires.
PlaneID_t Plane
Index of the plane within its TPC.
void analyze(const art::Event &evt)
read/write access to event
art::ServiceHandle< art::TFileService > tfs
art framework interface to geometry description