3 #include "fhiclcpp/ParameterSet.h"
4 #include "art/Utilities/ToolMacros.h"
5 #include "art/Framework/Services/Registry/ServiceHandle.h"
6 #include "art_root_io/TFileService.h"
7 #include "art/Framework/Core/ModuleMacros.h"
8 #include "art_root_io/TFileDirectory.h"
9 #include "canvas/Utilities/InputTag.h"
10 #include "messagefacility/MessageLogger/MessageLogger.h"
11 #include "canvas/Persistency/Common/FindManyP.h"
21 #include "TProfile2D.h"
46 using HitPtrVec = std::vector<art::Ptr<recob::Hit>>;
66 void configure(fhicl::ParameterSet
const & pset)
override;
74 void initializeHists(art::ServiceHandle<art::TFileService>&,
const std::string&)
override;
81 void endJob(
int numEvents)
override;
112 fGeometry = lar::providerFrom<geo::Geometry>();
117 mf::LogInfo(
"BasicTrackAnalysis") <<
"BasicTrackAnalysis configured\n";
122 BasicTrackAnalysis::~BasicTrackAnalysis()
132 void BasicTrackAnalysis::configure(fhicl::ParameterSet
const & pset)
134 fTrackProducerLabelVec = pset.get<std::vector<art::InputTag>>(
"TrackProducerLabel", std::vector<art::InputTag>()={
""});
135 fLocalDirName = pset.get<std::string >(
"LocalDirName", std::string(
"wow"));
140 void BasicTrackAnalysis::initializeHists(art::ServiceHandle<art::TFileService>&
tfs,
const std::string& dirName)
143 art::TFileDirectory
dir = tfs->mkdir(dirName.c_str());
149 fPulseHVsWidth[0] = dir.make<TH2D>(
"PHVsWidth0",
";PH;Width", 100, 0., 100., 100, 0., 20.);
150 fPulseHVsWidth[1] = dir.make<TH2D>(
"PHVsWidth1",
";PH;Width", 100, 0., 100., 100, 0., 20.);
151 fPulseHVsWidth[2] = dir.make<TH2D>(
"PHVsWidth2",
";PH;Width", 100, 0., 100., 100, 0., 20.);
153 fPulseHVsHitNo[0] = dir.make<TProfile>(
"PHVsNo0",
";Hit #;PH", 1000, 0., 1000., 0., 100.);
154 fPulseHVsHitNo[1] = dir.make<TProfile>(
"PHVsNo1",
";Hit #;PH", 1000, 0., 1000., 0., 100.);
155 fPulseHVsHitNo[2] = dir.make<TProfile>(
"PHVsNo2",
";Hit #;PH", 1000, 0., 1000., 0., 100.);
160 void BasicTrackAnalysis::fillHistograms(
const art::Event& event)
const
166 art::Handle<std::vector<recob::Track> > trackHandle;
167 event.getByLabel(trackLabel, trackHandle);
169 if (trackHandle.isValid())
172 art::FindManyP<recob::Hit> trackHitAssns(trackHandle, event, trackLabel);
174 for(
size_t trackIdx = 0; trackIdx < trackHandle->size(); trackIdx++)
176 art::Ptr<recob::Track>
track(trackHandle,trackIdx);
186 void BasicTrackAnalysis::endJob(
int numEvents)
189 double normFactor(1./numEvents);
void configure(fhicl::ParameterSet const &pset) override
Utilities related to art service access.
Declaration of signal hit object.
process_name use argoneut_mc_hitfinder track
Scale(size_t pos, T factor) -> Scale< T >
void endJob(int numEvents) override
Interface for method to executve at the end of run processing.
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
BasicTrackAnalysis(fhicl::ParameterSet const &pset)
Constructor.
std::string fLocalDirName
Directory name for histograms.
std::map< size_t, HitPtrVec > ViewHitMap
void initializeHists(art::ServiceHandle< art::TFileService > &, const std::string &) override
Interface for initializing the histograms to be filled.
std::vector< art::InputTag > fTrackProducerLabelVec
tag for finding the tracks
std::map< int, ViewHitMap > TrackViewHitMap
Description of geometry of one entire detector.
~BasicTrackAnalysis()
Destructor.
std::vector< art::Ptr< recob::Hit >> HitPtrVec
void fillHistograms(const art::Event &) const override
Interface for filling histograms.
art::ServiceHandle< art::TFileService > tfs
TProfile * fPulseHVsHitNo[3]
art framework interface to geometry description
const geo::GeometryCore * fGeometry
pointer to Geometry service