20 #include "art_root_io/TFileService.h" 82 CLHEP::HepRandomEngine&
fEngine;
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>();
111 tfs->make<TH2F>(
"fPhotonAngles",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
113 tfs->make<TH2F>(
"fPhotonAnglesLo",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
115 tfs->make<TH2F>(
"fPhotonAnglesMi",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
117 tfs->make<TH2F>(
"fPhotonAnglesHi",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
118 fPhotonCosQ = tfs->make<TH1F>(
"fPhotonCosQ",
";cos#theta;tracks", 50, -1.0, 1.0);
119 fPhotonEnergy = tfs->make<TH1F>(
"fPhotonEnergy",
";E (GeV)", 5000, 0.0, 1000.0);
121 tfs->make<TH1F>(
"fPhotonsPerSample",
";Number Photons;Samples", 100, 0, 1000);
123 tfs->make<TH1F>(
"fPhotonsInCryostat",
";Number Photons;Samples", 100, 0, 1000);
124 fPhotonsInTPC = tfs->make<TH1F>(
"fPhotonsInTPC",
";Number Photons;Samples", 100, 0, 1000);
127 tfs->make<TH2F>(
"fElectronAngles",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
129 tfs->make<TH2F>(
"fElectronAnglesLo",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
131 tfs->make<TH2F>(
"fElectronAnglesMi",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
133 tfs->make<TH2F>(
"fElectronAnglesHi",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
134 fElectronCosQ = tfs->make<TH1F>(
"fElectronCosQ",
";cos#theta;tracks", 50, -1.0, 1.0);
135 fElectronEnergy = tfs->make<TH1F>(
"fElectronEnergy",
";E (GeV)", 5000, 0.0, 1000.0);
137 tfs->make<TH1F>(
"fElectronsPerSample",
";Number Electrons;Samples", 100, 0, 1000);
139 tfs->make<TH1F>(
"fElectronsInCryotat",
";Number Electrons;Samples", 100, 0, 1000);
140 fElectronsInTPC = tfs->make<TH1F>(
"fElectronsInTPC",
";Number Electrons;Samples", 100, 0, 1000);
143 tfs->make<TH2F>(
"fMuonAngles",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
145 tfs->make<TH2F>(
"fMuonAnglesLo",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
147 tfs->make<TH2F>(
"fMuonAnglesMi",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
149 tfs->make<TH2F>(
"fMuonAnglesHi",
";#phi;cos#theta", 36, -180.0, 180.0, 50, -1.0, 1.0);
150 fMuonCosQ = tfs->make<TH1F>(
"fMuonCosQ",
";cos#theta;tracks", 50, -1.0, 1.0);
151 fMuonEnergy = tfs->make<TH1F>(
"fMuonEnergy",
";E (GeV)", 5000, 0.0, 1000.0);
152 fMuonsPerSample = tfs->make<TH1F>(
"fMuonsPerSample",
";Number Muons;Samples", 100, 0, 1000);
153 fMuonsInCStat = tfs->make<TH1F>(
"fMuonsInCryostat",
";Number Muons;Samples", 100, 0, 1000);
154 fMuonsInTPC = tfs->make<TH1F>(
"fMuonsInTPC",
";Number Muons;Samples", 100, 0, 1000);
167 std::unique_ptr<std::vector<simb::MCTruth>> truthcol(
new std::vector<simb::MCTruth>);
172 int nCrossCryostat = 0;
176 while (nCrossCryostat < 1) {
183 int numElectrons = 0;
186 int allElectrons = 0;
190 for (
int i = 0; i < pretruth.
NParticles(); ++i) {
192 const TLorentzVector& v4 = particle.
Position();
193 const TLorentzVector& p4 = particle.
Momentum();
194 double x0[3] = {v4.X(), v4.Y(), v4.Z()};
195 double dx[3] = {p4.Px(), p4.Py(), p4.Pz()};
204 TH1F* hCosQ =
nullptr;
205 TH2F* hAngles =
nullptr;
206 TH2F* hAnglesLo =
nullptr;
207 TH2F* hAnglesMi =
nullptr;
208 TH2F* hAnglesHi =
nullptr;
209 TH1F* hEnergy =
nullptr;
239 double bounds[6] = {0.};
240 cryostat.Boundaries(bounds);
246 for (
unsigned int cb = 0; cb < 6; cb++)
247 bounds[cb] = bounds[cb] +
fbuffbox[cb];
250 bool intersects_cryo =
false;
251 for (
int bnd = 0; bnd != 6; ++bnd) {
253 double p2[3] = {bounds[bnd],
254 x0[1] + (dx[1] / dx[0]) * (bounds[bnd] - x0[0]),
255 x0[2] + (dx[2] / dx[0]) * (bounds[bnd] - x0[0])};
256 if (p2[1] >= bounds[2] && p2[1] <= bounds[3] && p2[2] >= bounds[4] &&
257 p2[2] <= bounds[5]) {
258 intersects_cryo =
true;
262 else if (bnd >= 2 && bnd < 4) {
263 double p2[3] = {x0[0] + (dx[0] / dx[1]) * (bounds[bnd] - x0[1]),
265 x0[2] + (dx[2] / dx[1]) * (bounds[bnd] - x0[1])};
266 if (p2[0] >= bounds[0] && p2[0] <= bounds[1] && p2[2] >= bounds[4] &&
267 p2[2] <= bounds[5]) {
268 intersects_cryo =
true;
273 double p2[3] = {x0[0] + (dx[0] / dx[2]) * (bounds[bnd] - x0[2]),
274 x0[1] + (dx[1] / dx[2]) * (bounds[bnd] - x0[2]),
276 if (p2[0] >= bounds[0] && p2[0] <= bounds[1] && p2[1] >= bounds[2] &&
277 p2[1] <= bounds[3]) {
278 intersects_cryo =
true;
284 if (intersects_cryo) {
295 double cosq = -p4.Py() / p4.P();
296 double phi = std::atan2(p4.Pz(), p4.Px());
299 hAngles->Fill(phi, cosq);
301 hAnglesLo->Fill(phi, cosq);
302 else if (p4.E() < 10.0)
303 hAnglesMi->Fill(phi, cosq);
305 hAnglesHi->Fill(phi, cosq);
306 hEnergy->Fill(p4.E());
325 truthcol->push_back(truth);
326 evt.
put(std::move(truthcol));
TH2F * fElectronAnglesHi
Electron rate vs angle, high momenta.
details::range_type< T > Iterate() const
Initializes the specified ID with the ID of the first cryostat.
base_engine_t & createEngine(seed_t seed)
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)
constexpr auto abs(T v)
Returns the absolute value of the argument.
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Geometry information for a single cryostat.
TH2F * fElectronAnglesMi
Electron rate vs angle, middle momenta.
void produce(art::Event &evt) override
TH1F * fMuonCosQ
Muon rate vs cos(Q)
Length_t DetLength(TPCID const &tpcid=tpc_zero) const
Returns the length of the active volume of the specified TPC.
Length_t SurfaceY() const
The position of the detector respect to earth surface.
TH1F * fElectronsPerSample
number of electrons in the sampled time window
CosmicsGen(fhicl::ParameterSet const &pset)
TH1F * fPhotonsPerSample
number of photons in the sampled time window
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
double Sample(simb::MCTruth &mctruth, double const &surfaceY, double const &detectorLength, double *w, double rantime=0)
#define DEFINE_ART_MODULE(klass)
Interface to the CRY cosmic ray generator.
TH1F * fPhotonCosQ
Photon rate vs cos(Q)
CLHEP::HepRandomEngine & fEngine
art-managed random-number engine
void beginRun(art::Run &run) override
evgb::CRYHelper fCRYHelp
CRY generator object.
An art service to assist in the distribution of guaranteed unique seeds to all engines within an art ...
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.
std::string const & DetectorName() const
Returns a string with the name of the detector, as configured.
Event generator information.
TH1F * fMuonsPerSample
number of muons in the sampled time window
Namespace collecting geometry-related classes utilities.
TH1F * fMuonEnergy
Muon energy (GeV)
Event Generation using GENIE, cosmics or single particles.
art framework interface to geometry description