8 #include "art/Framework/Core/EDAnalyzer.h"
9 #include "art/Framework/Core/ModuleMacros.h"
10 #include "art/Framework/Principal/Event.h"
11 #include "art/Framework/Principal/Handle.h"
12 #include "art/Framework/Services/Registry/ServiceHandle.h"
13 #include "art_root_io/TFileService.h"
14 #include "canvas/Persistency/Common/Ptr.h"
15 #include "fhiclcpp/ParameterSet.h"
25 #include "nusimdata/SimulationBase/MCTruth.h"
26 #include "nusimdata/SimulationBase/MCParticle.h"
38 void analyze (
const art::Event&);
78 DEFINE_ART_MODULE(OpFlashMCTruthAna)
98 art::ServiceHandle<art::TFileService const>
tfs;
100 fPerEventTree = tfs->make<TTree>(
"PerEventTree",
"PerEventTree");
118 fAnalysisTree = tfs->make<TTree>(
"AnalysisTree",
"AnalysisTree");
159 art::Handle< std::vector< recob::OpFlash > > FlashHandle;
160 art::Handle< std::vector< simb::MCTruth > > TruthHandle;
168 fNTruths = TruthHandle->at(0).NParticles();
171 std::cout<<
"Size of truth collection : " << TruthHandle->size()<<std::endl;
175 for(
int iPart=0; iPart!=
fNTruths; ++iPart)
177 const simb::MCParticle ThisPart = TruthHandle->at(0).GetParticle(iPart);
186 fCenterX = (ThisPart.Vx(0) + ThisPart.EndX())/2.;
187 fCenterY = (ThisPart.Vy(0) + ThisPart.EndY())/2.;
188 fCenterZ = (ThisPart.Vz(0) + ThisPart.EndZ())/2.;
191 for(
unsigned int i = 0; i < FlashHandle->size(); ++i)
195 art::Ptr< recob::OpFlash > TheFlashPtr(FlashHandle, i);
201 fFlashY = TheFlashPtr->YCenter();
202 fFlashZ = TheFlashPtr->ZCenter();
203 fFlashU = TheFlashPtr->WireCenters().at(0);
204 fFlashV = TheFlashPtr->WireCenters().at(1);
std::string fFlashInputModule
Float_t fDistFlashVertexNorm
void analyze(const art::Event &)
Float_t fFlashFastToTotal
Float_t fDistFlashCenterNorm
OpFlashMCTruthAna(const fhicl::ParameterSet &)
art::ServiceHandle< art::TFileService > tfs
std::string fTruthInputModule
BEGIN_PROLOG could also be cout