20 #include "art_root_io/TFileService.h" 23 #include "nurandom/RandomUtils/NuRandomService.h" 28 #include "nugen/EventGeneratorBase/evgenbase.h" 93 ,
fbuffbox{pset.get<std::vector<double>>(
"BufferBox",{0.0, 0.0, 0.0, 0.0, 0.0, 0.0})}
101 produces< std::vector<simb::MCTruth> >();
102 produces< sumdata::RunData, art::InRun >();
110 fPhotonAngles = tfs->make<TH2F>(
"fPhotonAngles",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
111 fPhotonAnglesLo = tfs->make<TH2F>(
"fPhotonAnglesLo",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
112 fPhotonAnglesMi = tfs->make<TH2F>(
"fPhotonAnglesMi",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
113 fPhotonAnglesHi = tfs->make<TH2F>(
"fPhotonAnglesHi",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
114 fPhotonCosQ = tfs->make<TH1F>(
"fPhotonCosQ",
";cos#theta;tracks", 50,-1.0,1.0);
115 fPhotonEnergy = tfs->make<TH1F>(
"fPhotonEnergy",
";E (GeV)", 5000,0.0,1000.0);
116 fPhotonsPerSample = tfs->make<TH1F>(
"fPhotonsPerSample",
";Number Photons;Samples", 100, 0, 1000);
117 fPhotonsInCStat = tfs->make<TH1F>(
"fPhotonsInCryostat",
";Number Photons;Samples", 100, 0, 1000);
118 fPhotonsInTPC = tfs->make<TH1F>(
"fPhotonsInTPC",
";Number Photons;Samples", 100, 0, 1000);
120 fElectronAngles = tfs->make<TH2F>(
"fElectronAngles",
";#phi;cos#theta",36,-180.0,180.0,50,-1.0,1.0);
121 fElectronAnglesLo = tfs->make<TH2F>(
"fElectronAnglesLo",
";#phi;cos#theta",36,-180.0,180.0,50,-1.0,1.0);
122 fElectronAnglesMi = tfs->make<TH2F>(
"fElectronAnglesMi",
";#phi;cos#theta",36,-180.0,180.0,50,-1.0,1.0);
123 fElectronAnglesHi = tfs->make<TH2F>(
"fElectronAnglesHi",
";#phi;cos#theta",36,-180.0,180.0,50,-1.0,1.0);
124 fElectronCosQ = tfs->make<TH1F>(
"fElectronCosQ",
";cos#theta;tracks",50,-1.0,1.0);
125 fElectronEnergy = tfs->make<TH1F>(
"fElectronEnergy",
";E (GeV)", 5000,0.0,1000.0);
126 fElectronsPerSample = tfs->make<TH1F>(
"fElectronsPerSample",
";Number Electrons;Samples", 100, 0, 1000);
127 fElectronsInCStat = tfs->make<TH1F>(
"fElectronsInCryotat",
";Number Electrons;Samples", 100, 0, 1000);
128 fElectronsInTPC = tfs->make<TH1F>(
"fElectronsInTPC",
";Number Electrons;Samples", 100, 0, 1000);
130 fMuonAngles = tfs->make<TH2F>(
"fMuonAngles",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
131 fMuonAnglesLo = tfs->make<TH2F>(
"fMuonAnglesLo",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
132 fMuonAnglesMi = tfs->make<TH2F>(
"fMuonAnglesMi",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
133 fMuonAnglesHi = tfs->make<TH2F>(
"fMuonAnglesHi",
";#phi;cos#theta", 36,-180.0,180.0,50,-1.0,1.0);
134 fMuonCosQ = tfs->make<TH1F>(
"fMuonCosQ",
";cos#theta;tracks",50,-1.0,1.0);
135 fMuonEnergy = tfs->make<TH1F>(
"fMuonEnergy",
";E (GeV)", 5000,0.0,1000.0);
136 fMuonsPerSample = tfs->make<TH1F>(
"fMuonsPerSample",
";Number Muons;Samples", 100, 0, 1000);
137 fMuonsInCStat = tfs->make<TH1F>(
"fMuonsInCryostat",
";Number Muons;Samples", 100, 0, 1000);
138 fMuonsInTPC = tfs->make<TH1F>(
"fMuonsInTPC",
";Number Muons;Samples", 100, 0, 1000);
151 std::unique_ptr< std::vector<simb::MCTruth> > truthcol(
new std::vector<simb::MCTruth>);
156 int nCrossCryostat = 0;
160 while(nCrossCryostat < 1){
170 int numElectrons = 0;
173 int allElectrons = 0;
177 for(
int i = 0; i < pretruth.
NParticles(); ++i){
179 const TLorentzVector& v4 = particle.
Position();
180 const TLorentzVector& p4 = particle.
Momentum();
181 double x0[3] = {v4.X(), v4.Y(), v4.Z() };
182 double dx[3] = {p4.Px(), p4.Py(), p4.Pz()};
230 for (
unsigned int cb=0; cb<6; cb++)
231 bounds[cb] = bounds[cb]+
fbuffbox[cb];
234 bool intersects_cryo =
false;
235 for (
int bnd=0; bnd!=6; ++bnd) {
237 double p2[3] = {bounds[bnd], x0[1] + (dx[1]/dx[0])*(bounds[bnd] - x0[0]), x0[2] + (dx[2]/dx[0])*(bounds[bnd] - x0[0])};
238 if ( p2[1] >= bounds[2] && p2[1] <= bounds[3] &&
239 p2[2] >= bounds[4] && p2[2] <= bounds[5] ) {
240 intersects_cryo =
true;
244 else if (bnd>=2 && bnd<4) {
245 double p2[3] = {x0[0] + (dx[0]/dx[1])*(bounds[bnd] - x0[1]), bounds[bnd], x0[2] + (dx[2]/dx[1])*(bounds[bnd] - x0[1])};
246 if ( p2[0] >= bounds[0] && p2[0] <= bounds[1] &&
247 p2[2] >= bounds[4] && p2[2] <= bounds[5] ) {
248 intersects_cryo =
true;
253 double p2[3] = {x0[0] + (dx[0]/dx[2])*(bounds[bnd] - x0[2]), x0[1] + (dx[1]/dx[2])*(bounds[bnd] - x0[2]), bounds[bnd]};
254 if ( p2[0] >= bounds[0] && p2[0] <= bounds[1] &&
255 p2[1] >= bounds[2] && p2[1] <= bounds[3] ) {
256 intersects_cryo =
true;
263 if (intersects_cryo) {
286 double cosq = -p4.Py()/p4.P();
287 double phi = std::atan2(p4.Pz(),p4.Px());
290 hAngles->Fill(phi,cosq);
291 if (p4.E()<1.0) hAnglesLo->Fill(phi,cosq);
292 else if (p4.E()<10.0) hAnglesMi->Fill(phi,cosq);
293 else hAnglesHi->Fill(phi,cosq);
294 hEnergy->Fill(p4.E());
317 truthcol->push_back(truth);
TH2F * fElectronAnglesHi
Electron rate vs angle, high momenta.
Interface to the CRY cosmic-ray generator.
const TLorentzVector & Position(const int i=0) const
TH2F * fPhotonAngles
Photon rate vs angle.
TH2F * fMuonAnglesHi
Muon rate vs angle, high momenta.
TH1F * fElectronEnergy
Electron energy (GeV)
TH2F * fElectronAnglesLo
Electron rate vs angle, low momenta.
TH2F * fElectronAngles
Electron rate vs angle.
TH1F * fElectronCosQ
Electron rate vs cos(Q)
void SetOrigin(simb::Origin_t origin)
TH2F * fMuonAngles
Muon rate vs angle.
EDProducer(fhicl::ParameterSet const &pset)
TH2F * fMuonAnglesLo
Muon rate vs angle, low momenta.
TH1F * fPhotonEnergy
Photon energy (GeV)
const std::string GetWorldVolumeName() const
Return the name of the world volume (needed by Geant4 simulation)
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
TH2F * fElectronAnglesMi
Electron rate vs angle, middle momenta.
void produce(art::Event &evt) override
TH1F * fMuonCosQ
Muon rate vs cos(Q)
TH1F * fElectronsPerSample
number of electrons in the sampled time window
void CryostatBoundaries(double *boundaries, geo::CryostatID const &cid) const
Returns the boundaries of the specified cryostat.
art framework interface to geometry description
CosmicsGen(fhicl::ParameterSet const &pset)
TH1F * fPhotonsPerSample
number of photons in the sampled time window
double Sample(simb::MCTruth &mctruth, double const &surfaceY, double const &detectorLength, double *w, double rantime=0)
#define DEFINE_ART_MODULE(klass)
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
Interface to the CRY cosmic ray generator.
TH1F * fPhotonCosQ
Photon rate vs cos(Q)
CLHEP::HepRandomEngine & fEngine
art-managed random-number engine
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
void beginRun(art::Run &run) override
geo::Length_t SurfaceY() const
The position of the detector respect to earth surface.
evgb::CRYHelper fCRYHelp
CRY generator object.
BoundingBox bounds(int x, int y, int w, int h)
TH2F * fMuonAnglesMi
Muon rate vs angle, middle momenta.
std::vector< double > fbuffbox
const simb::MCParticle & GetParticle(int i) const
TH2F * fPhotonAnglesMi
Photon rate vs angle, middle momenta.
TH2F * fPhotonAnglesLo
Photon rate vs angle, low momenta.
void Add(simb::MCParticle const &part)
const TLorentzVector & Momentum(const int i=0) const
TH2F * fPhotonAnglesHi
Photon rate vs angle, high momenta.
A module to check the results from the Monte Carlo generator.
Event generator information.
TH1F * fMuonsPerSample
number of muons in the sampled time window
LArSoft geometry interface.
TH1F * fMuonEnergy
Muon energy (GeV)
Event Generation using GENIE, cosmics or single particles.