2 #define SBND_NUANA value
5 #include "art/Framework/Core/EDAnalyzer.h"
6 #include "art/Framework/Core/ModuleMacros.h"
7 #include "art/Framework/Principal/Event.h"
8 #include "art/Framework/Principal/Handle.h"
9 #include "art/Framework/Principal/SubRun.h"
10 #include "art/Framework/Services/Registry/ServiceHandle.h"
11 #include "art_root_io/TFileService.h"
12 #include "fhiclcpp/ParameterSet.h"
18 #include "nusimdata/SimulationBase/MCFlux.h"
19 #include "nusimdata/SimulationBase/MCNeutrino.h"
20 #include "nusimdata/SimulationBase/MCTruth.h"
21 #include "nusimdata/SimulationBase/GTruth.h"
22 #include "nusimdata/SimulationBase/MCParticle.h"
31 #include "TLorentzVector.h"
50 class NuAna :
public art::EDAnalyzer {
52 explicit NuAna(fhicl::ParameterSet
const& pset);
184 , fFullOscTrue (pset.
get<
bool > (
"FullOsc"))
185 , fGenieModuleLabel (pset.
get<
std::string > (
"GenieModuleLabel"))
186 , fLarg4ModuleLabel (pset.
get<
std::string > (
"LArG4ModuleLabel"))
187 , fFluxReweight (pset.
get<
bool > (
"FluxReweight"))
188 , fXSecReweight (pset.
get<
bool > (
"XSecReweight"))
190 , fRandSeed (pset.
get< unsigned int > (
"RandSeed"))
191 , fNWeights (pset.
get< int > (
"NWeights"))
196 art::ServiceHandle<art::TFileService>
tfs;
200 std::ofstream libraryFile;
201 libraryFile.open(
"loadLibs.C");
202 libraryFile <<
"#include <vector>\n";
203 libraryFile <<
"#ifdef __MAKECINT__\n";
204 libraryFile <<
"#pragma link C++ class std::vector<std::vector<float> >+;\n";
205 libraryFile <<
"#pragma link C++ class std::vector<std::vector<std::vector<float> > >+;\n";
206 libraryFile <<
"#endif\n";
208 gROOT -> ProcessLine(
".L loadLibs.C+");
210 fTreeTot = tfs->make<TTree>(
"EventsTot",
"Event info for ALL types");
245 fTreeTot->Branch(
"leptonPos",
"std::vector< std::vector<float> > ", &
leptonPos, 32000, 0);
246 fTreeTot->Branch(
"leptonMom",
"std::vector< std::vector<float> > ", &
leptonMom, 32000, 0);
256 fTreeTot->Branch(
"PionPos",
"std::vector< std::vector<float> >", &
pionPos, 32000, 0);
257 fTreeTot->Branch(
"PionMom",
"std::vector< std::vector<float> >", &
pionMom, 32000, 0);
258 fTreeTot->Branch(
"ChargedPionPos",
"std::vector<std::vector< std::vector<float> > >",&
chargedPionPos, 32000,0);
259 fTreeTot->Branch(
"ChargedPionMom",
"std::vector<std::vector< std::vector<float> > >",&
chargedPionMom, 32000,0);
279 else std::cout <<
"not fullosc" << std::endl;
280 std::cout <<
"The baseline for this detector is "
281 <<
fBaseline <<
"m." << std::endl << std::endl;
286 art::ServiceHandle<geo::Geometry> geom;
291 std::vector<reweight> reweights;
305 art::Handle< sumdata::POTSummary > potHandle;
385 art::Handle< std::vector<simb::MCTruth> > mclistGENIE;
386 art::Handle< std::vector<simb::MCParticle> > mclistLARG4;
387 art::Handle< std::vector<simb::MCFlux> > mcflux;
388 art::Handle< std::vector<simb::GTruth> > mcgtruth;
404 art::Ptr<simb::MCTruth> mc(mclistGENIE,0);
407 art::Ptr<simb::MCFlux > flux(mcflux,0);
410 art::Ptr<simb::GTruth > gtruth(mcgtruth,0);
415 simb::MCNeutrino neutrino = mc -> GetNeutrino();
525 DEFINE_ART_MODULE(
NuAna)
std::string fLarg4ModuleLabel
void analyze(const art::Event &evt)
std::vector< std::vector< float > > p1PhotonConversionMom
std::vector< std::string > GenieProc
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
std::vector< float > ParentVertex
std::vector< std::vector< float > > GenieMomentum
NuAna(fhicl::ParameterSet const &pset)
std::vector< float > nuParentMomTargetExit
std::vector< float > vertex
std::vector< std::vector< float > > p2PhotonConversionMom
void beginSubRun(const art::SubRun &subrun)
unsigned int FinalRandSeed
std::vector< std::vector< float > > miscPhotonConversionPos
std::string fGenieModuleLabel
std::vector< std::vector< std::vector< float > > > chargedPionPos
std::vector< std::vector< float > > reweightingSigmas
void packFluxWeight(art::Ptr< simb::MCFlux > flux, std::vector< std::vector< float >> &)
std::vector< float > nuParentMomAtProd
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
std::vector< std::string > fWeights
std::vector< std::vector< float > > eventWeights
std::vector< std::vector< std::vector< float > > > chargedPionMom
std::vector< std::vector< float > > genieReweights
void configureReWeight(const std::vector< reweight > &, const std::vector< std::vector< float >> &)
void packGenieInfo(art::Ptr< simb::MCTruth > truth, std::vector< int > &GeniePDG, std::vector< std::vector< float >> &GenieMomentum, std::vector< std::string > &GenieProc, int &NPi0FinalState, int &NGamma, int &NChargedPions)
A module to extract the info from the Monte Carlo generator GENIE.
void packFluxInfo(art::Ptr< simb::MCFlux > flux, int &ptype, int &tptype, int &ndecay, std::vector< float > &neutVertexInWindow, std::vector< float > &ParentVertex, std::vector< float > &nuParentMomAtDecay, std::vector< float > &nuParentMomAtProd, std::vector< float > &nuParentMomTargetExit)
std::vector< std::vector< float > > pionPos
std::vector< int > chargedPionSign
std::vector< std::vector< float > > pionMom
std::vector< float > fWeightRangeSigma
std::vector< float > neutMom
void packLarg4Info(art::Handle< std::vector< simb::MCParticle > > mclarg4, int, int, int, int, std::vector< std::vector< float > > &leptonPos, std::vector< std::vector< float > > &leptonMom, std::vector< std::vector< float > > &p1PhotonConversionPos, std::vector< std::vector< float > > &p1PhotonConversionMom, std::vector< std::vector< float > > &p2PhotonConversionPos, std::vector< std::vector< float > > &p2PhotonConversionMom, std::vector< std::vector< float > > &miscPhotonConversionPos, std::vector< std::vector< float > > &miscPhotonConversionMom, std::vector< std::vector< float > > &pionPos, std::vector< std::vector< float > > &pionMom, std::vector< std::vector< std::vector< float > > > &chargedPionPos, std::vector< std::vector< std::vector< float > > > &chargedPionMom, std::vector< int > &chargePionSign)
std::vector< int > GeniePDG
std::vector< std::vector< float > > leptonMom
std::vector< std::vector< float > > leptonPos
std::vector< std::vector< float > > p1PhotonConversionPos
std::vector< std::vector< float > > p2PhotonConversionPos
void configureGeometry(art::ServiceHandle< geo::Geometry >)
void parseWeights(const std::vector< std::string > &, std::vector< reweight > &)
stream1 can override from command line with o or output services user sbnd
unsigned int prepareSigmas(int, unsigned int, std::vector< std::vector< float > > &)
art::ServiceHandle< art::TFileService > tfs
void packNeutrinoInfo(simb::MCNeutrino *neutrino, int &nuchan, int &inno, double &enugen, int &isCC, int &mode, double &thetaLep, double &phiLep, double &Elep, std::vector< float > &neutMom, std::vector< float > &vertex)
std::vector< float > nuParentMomAtDecay
void calcWeight(art::Ptr< simb::MCTruth >, art::Ptr< simb::GTruth >, std::vector< std::vector< float >> &)
std::vector< std::vector< float > > miscPhotonConversionMom
art framework interface to geometry description
BEGIN_PROLOG could also be cout
std::vector< float > neutVertexInWindow