10 #ifndef EVGEN_COSMICSGEN_H 11 #define EVGEN_COSMICSGEN_H 26 #include "art_root_io/TFileService.h" 27 #include "art_root_io/TFileDirectory.h" 35 #include "nurandom/RandomUtils/NuRandomService.h" 40 #include "CoreUtils/ServiceUtil.h" 93 rndm::NuRandomService::seed_t
fSeed;
106 fbuffbox = pset.get< std::vector<double> >(
"BufferBox",{0.0, 0.0, 0.0, 0.0, 0.0, 0.0});
107 fSeed = pset.get< rndm::NuRandomService::seed_t >(
"Seed",0);
110 produces< std::vector<simb::MCTruth> >();
111 produces< gar::sumdata::RunData, ::art::InRun >();
130 auto geo = gar::providerFrom<gar::geo::GeometryGAr>();
142 fPhotonAngles = tfs->make<TH2F>(
"fPhotonAngles",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
143 fPhotonAnglesLo = tfs->make<TH2F>(
"fPhotonAnglesLo",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
144 fPhotonAnglesMi = tfs->make<TH2F>(
"fPhotonAnglesMi",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
145 fPhotonAnglesHi = tfs->make<TH2F>(
"fPhotonAnglesHi",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
146 fPhotonCosQ = tfs->make<TH1F>(
"fPhotonCosQ",
";cos#theta;tracks", 50,-1.0,1.0);
147 fPhotonEnergy = tfs->make<TH1F>(
"fPhotonEnergy",
";E (GeV)", 5000,0.0,1000.0);
148 fPhotonsPerSample = tfs->make<TH1F>(
"fPhotonsPerSample",
";Number Photons;Samples", 100, 0, 1000);
149 fPhotonsInTPC = tfs->make<TH1F>(
"fPhotonsInTPC",
";Number Photons;Samples", 100, 0, 1000);
151 fElectronAngles = tfs->make<TH2F>(
"fElectronAngles",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
152 fElectronAnglesLo = tfs->make<TH2F>(
"fElectronAnglesLo",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
153 fElectronAnglesMi = tfs->make<TH2F>(
"fElectronAnglesMi",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
154 fElectronAnglesHi = tfs->make<TH2F>(
"fElectronAnglesHi",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
155 fElectronCosQ = tfs->make<TH1F>(
"fElectronCosQ",
";cos#theta;tracks", 50,-1.0,1.0);
156 fElectronEnergy = tfs->make<TH1F>(
"fElectronEnergy",
";E (GeV)", 5000,0.0,1000.0);
157 fElectronsPerSample = tfs->make<TH1F>(
"fElectronsPerSample",
";Number Electrons;Samples", 100, 0, 1000);
158 fElectronsInTPC = tfs->make<TH1F>(
"fElectronsInTPC",
";Number Electrons;Samples", 100, 0, 1000);
160 fMuonAngles = tfs->make<TH2F>(
"fMuonAngles",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
161 fMuonAnglesLo = tfs->make<TH2F>(
"fMuonAnglesLo",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
162 fMuonAnglesMi = tfs->make<TH2F>(
"fMuonAnglesMi",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
163 fMuonAnglesHi = tfs->make<TH2F>(
"fMuonAnglesHi",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
164 fMuonCosQ = tfs->make<TH1F>(
"fMuonCosQ",
";cos#theta;tracks", 50,-1.0,1.0);
165 fMuonEnergy = tfs->make<TH1F>(
"fMuonEnergy",
";E (GeV)", 5000,0.0,1000.0);
166 fMuonsPerSample = tfs->make<TH1F>(
"fMuonsPerSample",
";Number Muons;Samples", 100, 0, 1000);
167 fMuonsInTPC = tfs->make<TH1F>(
"fMuonsInTPC",
";Number Muons;Samples", 100, 0, 1000);
175 auto geo = gar::providerFrom<geo::GeometryGAr>();
187 std::unique_ptr< std::vector<simb::MCTruth> > truthcol(
new std::vector<simb::MCTruth>);
190 auto geom = gar::providerFrom<geo::GeometryGAr>();
209 int numElectrons = 0;
212 int allElectrons = 0;
216 for(
int i = 0; i < pretruth.
NParticles(); ++i){
218 const TLorentzVector& p4 = particle.
Momentum();
265 double cosq = -p4.Py()/p4.P();
266 double phi = std::atan2(p4.Pz(),p4.Px());
269 hAngles->Fill(phi,cosq);
270 if (p4.E()<1.0) hAnglesLo->Fill(phi,cosq);
271 else if (p4.E()<10.0) hAnglesMi->Fill(phi,cosq);
272 else hAnglesHi->Fill(phi,cosq);
273 hEnergy->Fill(p4.E());
280 truthcol->push_back(truth);
296 #endif // EVGEN_COSMICSGEN_H rndm::NuRandomService::seed_t fSeed
override seed with a fcl parameter not equal to zero
base_engine_t & createEngine(seed_t seed)
TH2F * fMuonAngles
Muon rate vs angle.
Interface to the CRY cosmic-ray generator.
TH1F * fElectronsPerSample
number of electrons in the sampled time window
TH2F * fMuonAnglesHi
Muon rate vs angle, high momenta.
A module to check the results from the Monte Carlo generator.
TH1F * fPhotonCosQ
Photon rate vs cos(Q)
evgb::CRYHelper * fCRYHelp
CRY generator object.
void SetOrigin(simb::Origin_t origin)
TH2F * fElectronAnglesLo
Electron rate vs angle, low momenta.
TH1F * fPhotonsPerSample
number of photons in the sampled time window
EDProducer(fhicl::ParameterSet const &pset)
TH2F * fPhotonAngles
Photon rate vs angle.
TH1F * fElectronCosQ
Electron rate vs cos(Q)
TH2F * fElectronAnglesHi
Electron rate vs angle, high momenta.
TH2F * fMuonAnglesMi
Muon rate vs angle, middle momenta.
void beginRun(::art::Run &run)
double Sample(simb::MCTruth &mctruth, double const &surfaceY, double const &detectorLength, double *w, double rantime=0)
#define DEFINE_ART_MODULE(klass)
TH2F * fElectronAngles
Electron rate vs angle.
TH1F * fMuonCosQ
Muon rate vs cos(Q)
Interface to the CRY cosmic ray generator.
TH2F * fPhotonAnglesLo
Photon rate vs angle, low momenta.
TH2F * fMuonAnglesLo
Muon rate vs angle, low momenta.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void reconfigure(fhicl::ParameterSet const &p)
TH2F * fPhotonAnglesHi
Photon rate vs angle, high momenta.
const simb::MCParticle & GetParticle(int i) const
TH1F * fElectronEnergy
Electron energy (GeV)
General GArSoft Utilities.
TH1F * fPhotonEnergy
Photon energy (GeV)
TH2F * fPhotonAnglesMi
Photon rate vs angle, middle momenta.
std::vector< double > fbuffbox
const TLorentzVector & Momentum(const int i=0) const
void produce(::art::Event &evt)
TH1F * fMuonsPerSample
number of muons in the sampled time window
CosmicsGen(fhicl::ParameterSet const &pset)
TH2F * fElectronAnglesMi
Electron rate vs angle, middle momenta.
Event generator information.
LArSoft geometry interface.
art framework interface to geometry description
Event Generation using GENIE, cosmics or single particles.
TH1F * fMuonEnergy
Muon energy (GeV)