22 #include "art/Framework/Core/EDAnalyzer.h"
23 #include "art/Framework/Core/ModuleMacros.h"
24 #include "art/Framework/Principal/Event.h"
25 #include "art/Framework/Principal/Handle.h"
26 #include "art/Framework/Services/Registry/ServiceHandle.h"
27 #include "art_root_io/TFileService.h"
28 #include "canvas/Persistency/Common/FindManyP.h"
29 #include "canvas/Persistency/Common/Ptr.h"
30 #include "fhiclcpp/ParameterSet.h"
40 void analyze(
const art::Event&);
133 auto const clock_data =
134 art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
135 fTimeBegin = clock_data.OpticalClock().Time();
136 fTimeEnd = clock_data.OpticalClock().FramePeriod();
137 fSampleFreq = clock_data.OpticalClock().Frequency();
139 fYMin = pset.get<
float>(
"YMin");
140 fYMax = pset.get<
float>(
"YMax");
141 fZMin = pset.get<
float>(
"ZMin");
142 fZMax = pset.get<
float>(
"ZMax");
157 art::ServiceHandle<art::TFileService const>
tfs;
159 if (fMakeFlashBreakdownTree) {
177 if (fMakePerOpHitTree) {
178 fPerOpHitTree = tfs->make<TTree>(
"PerOpHitTree",
"PerOpHitTree");
192 if (fMakePerFlashTree) {
193 fPerFlashTree = tfs->make<TTree>(
"PerFlashTree",
"PerFlashTree");
208 if (fMakePerEventFlashTree) {
229 if (fMakeFlashHitMatchTree) {
254 art::Handle<std::vector<recob::OpFlash>> FlashHandle;
267 art::ServiceHandle<art::TFileService const>
tfs;
269 std::vector<TH1D*> FlashHist;
273 sprintf(HistName,
"Event %d Flash Times", evt.id().event());
274 TH1D* FlashTimes =
nullptr;
276 FlashTimes = tfs->make<TH1D>(HistName,
283 TH2D* FlashPositions =
nullptr;
285 sprintf(HistName,
"Event %d All Flashes YZ", evt.id().event());
291 art::ServiceHandle<geo::Geometry const> geom;
292 unsigned int NOpChannels = geom->NOpChannels();
300 for (
unsigned int i = 0; i < FlashHandle->size(); ++i) {
303 art::Ptr<recob::OpFlash> TheFlashPtr(FlashHandle, i);
309 TH2D* ThisFlashPosition =
nullptr;
311 sprintf(HistName,
"Event %d t = %f", evt.id().event(),
fFlashTime);
313 tfs->make<TH1D>(HistName,
";OpChannel;PE", NOpChannels, 0, NOpChannels));
315 sprintf(HistName,
"Event %d Flash %f YZ", evt.id().event(),
fFlashTime);
344 for (
unsigned int j = 0; j != NOpChannels; ++j) {
359 ThisFlashPosition->Fill(ThisY,
364 FlashPositions->Fill(ThisY,
377 std::vector<art::Ptr<recob::OpHit>> matchedHits = Assns.at(i);
378 for (
auto ophit : matchedHits) {
395 art::Handle<std::vector<recob::OpHit>> OpHitHandle;
398 for (
size_t i = 0; i != OpHitHandle->size(); ++i) {
401 fPeakTime = OpHitHandle->at(i).PeakTime();
402 fFrame = OpHitHandle->at(i).Frame();
403 fWidth = OpHitHandle->at(i).Width();
404 fArea = OpHitHandle->at(i).Area();
406 fPE = OpHitHandle->at(i).PE();
433 DEFINE_ART_MODULE(OpFlashAna)
process_name opflash particleana ie ie ie z
std::vector< int > fOnBeamTimeVector
std::string fOpHitModuleLabel
OpFlashAna(const fhicl::ParameterSet &)
std::vector< float > fZCenterVector
std::vector< int > fFlashIDVector
double PE(unsigned int i) const
std::vector< bool > fInBeamFrameVector
TTree * fFlashHitMatchTree
std::vector< double > fFlashTimeVector
process_name opflash particleana ie ie y
void analyze(const art::Event &)
unsigned int Frame() const
std::vector< int > fFlashFrameVector
bool fMakePerEventFlashTree
bool fMakeFlashHitMatchTree
std::vector< float > fTotalPEVector
bool fMakeFlashBreakdownTree
std::vector< double > fAbsTimeVector
BEGIN_PROLOG opflashCryoW opflashCryoW triggerfilterBNB triggerfilterNuMI triggerfilterOffbeamBNB triggerfilterOffbeamNuMI triggerfilterUnknown roifinder roifinder2d gaushitTPCEE gaushitTPCWE purityana1 ophit
std::vector< float > fPEsPerFlashPerChannelVector
std::vector< float > fYWidthVector
std::vector< float > fZWidthVector
art::ServiceHandle< art::TFileService > tfs
TTree * fFlashBreakdownTree
std::vector< float > fYCenterVector
art framework interface to geometry description
TTree * fPerEventFlashTree
std::string fOpFlashModuleLabel