29 #include "art_root_io/TFileService.h" 31 #include "cetlib_except/exception.h" 44 #include "TLorentzVector.h" 48 #include "CLHEP/Random/RandFlat.h" 49 #include "CLHEP/Random/RandGaussQ.h" 108 ,
fScan{pset.get<
bool>(
"Scan")}
109 ,
fPosDist{pset.get<
int>(
"PosDist")}
110 ,
fTDist{pset.get<
int>(
"TDist")}
111 ,
fPDist{pset.get<
int>(
"PDist")}
112 ,
fT{pset.get<
double>(
"T0")}
113 ,
fSigmaT{pset.get<
double>(
"SigmaT")}
114 ,
fP{pset.get<
double>(
"P")}
115 ,
fSigmaP{pset.get<
double>(
"SigmaP")}
116 ,
fN{pset.get<
int>(
"N")}
122 produces<sumdata::RunData, art::InRun>();
123 produces<std::vector<simb::MCTruth>>();
127 fPhotonGen = tfs->make<TTree>(
"PhGen",
"PhGen");
140 fPx = pset.get<
double>(
"X");
141 fPy = pset.get<
double>(
"Y");
142 fPz = pset.get<
double>(
"Z");
143 std::cout <<
"Will generate photons from 3 points." << std::endl;
147 fXmin = boundaries->get<
double>(
"Xmin");
148 fXmax = boundaries->get<
double>(
"Xmax");
149 fYmin = boundaries->get<
double>(
"Ymin");
150 fYmax = boundaries->get<
double>(
"Ymax");
151 fZmin = boundaries->get<
double>(
"Zmin");
152 fZmax = boundaries->get<
double>(
"Zmax");
155 std::cout <<
"\n\nPhoton Emission Region (user-defined) [cm]:" << std::endl;
156 std::cout <<
"Xmin: " <<
fXmin <<
" Xmax: " << fXmax <<
" Ymin: " << fYmin
157 <<
" Ymax: " << fYmax <<
" Zmin: " << fZmin <<
" Zmax: " << fZmax <<
"\n\n" 163 fXmin = CryoBounds.MinX();
164 fXmax = CryoBounds.MaxX();
165 fYmin = CryoBounds.MinY();
166 fYmax = CryoBounds.MaxY();
167 fZmin = CryoBounds.MinZ();
168 fZmax = CryoBounds.MaxZ();
170 std::cout <<
"\n\nPhoton Emission Region (default Cryo Boundaries) [cm]:" << std::endl;
171 std::cout <<
"Xmin: " <<
fXmin <<
" Xmax: " <<
fXmax <<
" Ymin: " <<
fYmin 172 <<
" Ymax: " <<
fYmax <<
" Zmin: " <<
fZmin <<
" Zmax: " <<
fZmax <<
"\n\n" 180 std::cout <<
"\n\nBegin Job\n\n" << std::endl;
183 std::cout <<
"Number of optical detector: " << int(geo1->
Cryostat().
NOpDet()) << std::endl;
192 rng.seed(std::random_device()());
193 std::uniform_real_distribution<double> distX(
fXmin,
fXmax);
194 std::uniform_real_distribution<double> distY(
fYmin,
fYmax);
195 std::uniform_real_distribution<double> distZ(
fZmin,
fZmax);
196 std::uniform_real_distribution<double> width(-2.0, 2.0);
198 std::unique_ptr<std::vector<simb::MCTruth>> truthcol(
new std::vector<simb::MCTruth>);
204 fY =
fPy + width(rng);
205 fZ =
fPz + width(rng);
216 truthcol->push_back(truth);
217 evt.
put(std::move(truthcol));
222 std::cout <<
"\n\nPhotons Shooting at the Position: " <<
fX <<
" " <<
fY <<
" " <<
fZ <<
"\n\n" 226 CLHEP::RandGaussQ gauss(
fEngine);
228 for (
int j = 0; j !=
fN; ++j) {
237 time =
fT +
fSigmaT * (2.0 * flat.fire() - 1.0);
239 fShotPos = TLorentzVector(pos[0], pos[1], pos[2], time);
245 p =
fP +
fSigmaP * (2.0 * flat.fire() - 1.0);
250 double costh = 2 * flat.fire() - 1;
251 double sinth = std::sqrt(1 - costh * costh);
252 double phi = 2 * M_PI * flat.fire();
255 fShotMom = TLorentzVector(p * sinth * cos(phi), p * sinth * sin(phi), p * costh, p);
base_engine_t & createEngine(seed_t seed)
PhotonGen(fhicl::ParameterSet const &pset)
void AddTrajectoryPoint(TLorentzVector const &position, TLorentzVector const &momentum)
void SetOrigin(simb::Origin_t origin)
void beginRun(art::Run &run)
EDProducer(fhicl::ParameterSet const &pset)
void Sample(simb::MCTruth &truth)
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
#define DEFINE_ART_MODULE(klass)
single particles thrown at the detector
CLHEP::HepRandomEngine & fEngine
An art service to assist in the distribution of guaranteed unique seeds to all engines within an art ...
CryostatGeo const & Cryostat(CryostatID const &cryoid=details::cryostat_zero) const
Returns the specified cryostat.
void Add(simb::MCParticle const &part)
unsigned int NOpDet() const
Number of optical detectors in this TPC.
BoxBoundedGeo const & Boundaries() const
Returns boundaries of the cryostat (in centimetres).
std::string const & DetectorName() const
Returns a string with the name of the detector, as configured.
Event generator information.
void produce(art::Event &evt)
Event Generation using GENIE, cosmics or single particles.
static ServiceHandle< RandomNumberGenerator > & rng()
art framework interface to geometry description