47 #include "gallery/Event.h"
48 #include "canvas/Utilities/InputTag.h"
49 #include "messagefacility/MessageLogger/MessageLogger.h"
50 #include "fhiclcpp/ParameterSet.h"
62 #if !defined(__CLING__)
87 auto const& analysisConfig = config.get<fhicl::ParameterSet>(
"analysis");
98 auto geom = lar::standalone::SetupGeometry<icarus::ICARUSChannelMapAlg>(config.get<fhicl::ParameterSet>(
"services.Geometry"));
101 auto larp = testing::setupProvider<detinfo::LArPropertiesStandard>(config.get<fhicl::ParameterSet>(
"services.LArPropertiesService"));
104 auto detclk = testing::setupProvider<detinfo::DetectorClocksStandard>(config.get<fhicl::ParameterSet>(
"services.DetectorClocksService"));
107 auto detp = testing::setupProvider<detinfo::DetectorPropertiesStandard>(config.get<fhicl::ParameterSet>(
"services.DetectorPropertiesService"),
118 std::vector<std::string>
const allInputFiles =
expandInputFiles(inputFiles);
123 art::InputTag trackTag = analysisConfig.get<art::InputTag>(
"tracks");
124 art::InputTag hitsTag = analysisConfig.get<art::InputTag>(
"hits");
129 std::unique_ptr<TFile> pHistFile;
130 if (analysisConfig.has_key(
"histogramFile"))
132 std::string
fileName = analysisConfig.get<std::string>(
"histogramFile");
133 std::cout <<
"Creating output file: '" << fileName <<
"'" << std::endl;
134 pHistFile = std::make_unique<TFile>(fileName.c_str(),
"RECREATE");
140 TrackAnalysis trackAnalysis(analysisConfig.get<fhicl::ParameterSet>(
"trackAnalysis"));
142 trackAnalysis.
setup(*geom, pHistFile.get());
147 hitAnalysisAlg.
setup(*geom, pHistFile.get());
149 MCAssociations mcAssociations(analysisConfig.get<fhicl::ParameterSet>(
"mcAssociations"));
150 auto const detProp = detp->DataFor(detclk->DataForJob());
159 for (gallery::Event event(allInputFiles); !
event.atEnd();
event.next())
165 mf::LogVerbatim(
"galleryAnalysis") <<
"This is event " <<
event.fileEntry() <<
"-" <<
event.eventEntry();
167 trackAnalysis.
processTracks(*(event.getValidHandle<std::vector<recob::Track>>(trackTag)));
169 hitAnalysisAlg.
fillHistograms(*(event.getValidHandle<std::vector<recob::Hit>>(hitsTag)));
184 hitAnalysisAlg.
endJob(numEvents);
192 {
return galleryAnalysis(configFile, std::vector<std::string>{ filename }); }
194 #if !defined(__CLING__)
195 int main(
int argc,
char** argv) {
197 char **pParam = argv + 1, **pend = argv + argc;
198 if (pParam == pend) {
199 std::cerr <<
"Usage: " << argv[0] <<
" configFile [inputFile ...]"
203 std::string
const configFile = *(pParam++);
204 std::vector<std::string> fileNames;
205 std::copy(pParam, pend, std::back_inserter(fileNames));
Channel mapping algorithms for ICARUS detector.
Utilities for one-line geometry initialization.
Service provider with utility LAr functions.
BEGIN_PROLOG could also be cerr
Helper functions for support of LArPropertiesService in LArSoft tests.
void endJob(int numEvents)
BEGIN_PROLOG could also be dds filename
Provider const * get() const
Returns the provider with the specified type.
Helper functions for support of DetectorClocksService in LArSoft tests.
Access the description of detector geometry.
void SetupMessageFacility(fhicl::ParameterSet const &pset, std::string applName="standalone")
Sets up the message facility service.
Collection of functions for quick setup of basic facilities.
void processTracks(std::vector< recob::Track > const &tracks)
Helpers for support of DetectorPropertiesService in LArSoft tests.
Provides recob::Track data product.
void doTrackHitMCAssociations(gallery::Event &)
int galleryAnalysis(std::string const &configFile, std::vector< std::string > const &inputFiles)
Runs the analysis macro.
services TFileService fileName
Container for a list of pointers to providers.
void fillHistograms(const TrackPlaneHitMap &) const
fhicl::ParameterSet ParseConfiguration(std::string configPath, cet::filepath_maker &lookupPolicy)
Parses a FHiCL configuration file.
int main(int argc, char **argv)
void setup(const geo::GeometryCore &, TDirectory *)
Begin job method.
void setup(geo::GeometryCore const &geom, TDirectory *outDir)
BEGIN_PROLOG could also be cout
void setup(const geo::GeometryCore &, const detinfo::DetectorPropertiesData &, TDirectory *)