12 #include "art/Framework/Core/EDAnalyzer.h"
13 #include "art/Framework/Core/ModuleMacros.h"
14 #include "art/Framework/Principal/Event.h"
15 #include "fhiclcpp/ParameterSet.h"
16 #include "art/Framework/Principal/Handle.h"
17 #include "art/Framework/Services/Registry/ServiceHandle.h"
18 #include "art_root_io/TFileService.h"
19 #include "art_root_io/TFileDirectory.h"
38 void analyze (
const art::Event&);
65 art::ServiceHandle<art::TFileService>
tfs;
68 art::Handle< std::vector< optdata::FIFOChannel > > FIFOChannelHandle;
76 std::stringstream FolderName;
78 FolderName<<
"run"<<Run<<
"_evt"<<EID;
80 art::TFileDirectory evtfolder = tfs->mkdir(FolderName.str().c_str());
82 std::map<int, bool> ChanFolderMade;
83 std::map<uint32_t, int> ChanFolderIndex;
84 std::vector<art::TFileDirectory> ChanFolders;
87 for(
size_t i=0; i!=FIFOChannelHandle->size(); ++i)
89 uint32_t Frame = FIFOChannelHandle->at(i).Frame();
90 uint32_t TimeSlice = FIFOChannelHandle->at(i).TimeSlice();
91 uint32_t Channel = FIFOChannelHandle->at(i).ChannelNumber();
93 if(!ChanFolderMade[Channel])
95 std::stringstream ChannelLabel;
97 ChannelLabel<<
"chan"<<Channel;
98 ChanFolderIndex[Channel] = ChanFolders.size();
99 ChanFolders.push_back(evtfolder.mkdir(ChannelLabel.str().c_str()));
100 ChanFolderMade[Channel] =
true;
103 std::stringstream HistName;
105 HistName<<
"frm"<<Frame<<
"_"<<
"tsl"<<TimeSlice;
108 TH1D * ThisHist = ChanFolders[ChanFolderIndex[Channel] ].make<TH1D>(HistName.str().c_str(),HistName.str().c_str(),FIFOChannelHandle->at(i).size(), float(TimeSlice)-0.0001, float(FIFOChannelHandle->at(i).size())-0.0001+TimeSlice);
110 for(
size_t j=0; j!=FIFOChannelHandle->at(i).size(); ++j)
112 ThisHist->Fill(TimeSlice + j, FIFOChannelHandle->at(i).at(j));
123 DEFINE_ART_MODULE(FIFOHistogramAna)
void analyze(const art::Event &)
FIFOHistogramAna(const fhicl::ParameterSet &)
art::ServiceHandle< art::TFileService > tfs