11 #include "TDatabasePDG.h" 27 #include "art_root_io/TFileService.h" 28 #include "art_root_io/TFileDirectory.h" 32 #include "nurandom/RandomUtils/NuRandomService.h" 37 #include "nugen/EventGeneratorBase/evgenbase.h" 43 #include "CLHEP/Random/RandFlat.h" 44 #include "CLHEP/Random/RandPoissonQ.h" 118 double wrapvar(
const double var,
const double low,
const double high);
119 double wrapvarBoxNo(
const double var,
const double low,
const double high,
int& boxno);
132 fMuonList.push_back(particle);
return;
141 return fTriggerOffsetX;
145 return fTriggerOffsetY;
149 return fTriggerOffsetZ;
153 return fTriggerOffsetT;
177 return fTriggerMu.Momentum();
181 return fTriggerMu.Momentum().X();
185 return fTriggerMu.Momentum().Y();
189 return fTriggerMu.Momentum().Z();
193 return fTriggerMu.Momentum().T();
197 void MakeTrigger(CLHEP::HepRandomEngine& engine);
200 double GetPhi(
const double py,
const double pz );
201 void GetMatrix(
double theta,
double phi,
double (*p_R)[3][3] );
202 void DoRotation(
double urv[],
double dir[],
double theta,
double phi );
203 bool Intersect(
const double x0[],
const double dx[],
const double bounds[]);
205 const double indxyz[],
214 void GetTPCSize(
double tpc[]);
215 void GetCryoSize(
double cryo[]);
217 for(
int i=0; i<6; i++){ fCryoBuffer.assign( buffer.begin(), buffer.end() ); }
220 for(
int i=0; i<6; i++){ fTPCBuffer.assign( buffer.begin(), buffer.end() ); }
231 double fTriggerID = -999;
253 fToffset(
p.get<
double >(
"TimeOffset",0.)),
254 fBuffBox(
p.get< std::vector< double > >(
"BufferBox",{0.0, 0.0, 0.0, 0.0, 0.0, 0.0})),
263 ->
createEngine(*
this,
"HepJamesRandom",
"gen",
p, {
"Seed",
"SeedGenerator" })),
265 ->
createEngine(*
this,
"HepJamesRandom",
"pois",
p,
"SeedPoisson"))
269 throw cet::exception(
"Gen311") <<
"ShowerInputFiles and ShowerFluxConstants have different or invalid sizes!"<<
"\n";
283 produces< std::vector<simb::MCTruth> >();
284 produces< sumdata::RunData, art::InRun >();
289 sqlite3_close(
fdb[i]);
305 fTree = tfs->make<TTree>(
"entries",
"entries tree");
337 const char* ifdh_debug_env =
std::getenv(
"IFDH_DEBUG_LEVEL");
338 if ( ifdh_debug_env ) {
339 mf::LogInfo(
"CORSIKAGendp") <<
"IFDH_DEBUG_LEVEL: " << ifdh_debug_env<<
"\n";
340 fIFDH->set_debug(ifdh_debug_env);
346 const char* ifdh_debug_env =
std::getenv(
"IFDH_DEBUG_LEVEL");
347 if ( ifdh_debug_env ) {
348 mf::LogInfo(
"CORSIKAGendp") <<
"IFDH_DEBUG_LEVEL: " << ifdh_debug_env<<
"\n";
349 fIFDH->set_debug(ifdh_debug_env);
352 std::vector<std::pair<std::string,long>> selectedflist;
357 mf::LogInfo(
"Gen311") <<
"Selected"<<selectedflist.back().first<<
"\n";
360 std::vector<std::pair<std::string,long>>
flist;
366 flist =
fIFDH->findMatchingFiles(path,pattern);
369 auto wildcardPosition = pattern.find(
"*");
370 pattern = pattern.substr( 0, wildcardPosition );
375 if ((dir = opendir( path.c_str() )) != NULL) {
376 while ((ent = readdir (dir)) != NULL) {
378 std::pair<std::string,long>
name;
381 if( parsename.substr(0, wildcardPosition) ==
pattern ){
382 name.first= path+
"/"+parsename;
384 flist.push_back( name );
393 unsigned int selIndex=-1;
396 }
else if(flist.size()>1){
397 selIndex= (
unsigned int) (
flat()*(flist.size()-1)+0.5);
401 selectedflist.push_back(flist[selIndex]);
403 <<
"\nFound "<< flist.size() <<
" candidate files" 404 <<
"\nChoosing file number "<< selIndex <<
"\n" 405 <<
"\nSelected "<<selectedflist.back().first<<
"\n";
410 std::vector<std::string> locallist;
411 for(
unsigned int i=0; i<selectedflist.size(); i++){
413 <<
"Fetching: "<<selectedflist[i].first<<
" "<<selectedflist[i].second<<
"\n";
415 MF_LOG_DEBUG(
"Gen311") <<
"Fetched; local path: "<<fetchedfile;
416 locallist.push_back(fetchedfile);
419 for(
unsigned int i=0; i<locallist.size(); i++){
421 int res=sqlite3_open(locallist[i].c_str(),&
fdb[i]);
423 throw cet::exception(
"Gen311") <<
"Error opening db: (" <<locallist[i].c_str()<<
") ("<<res<<
"): " << sqlite3_errmsg(
fdb[i]) <<
"; memory used:<<"<<sqlite3_memory_used()<<
"/"<<sqlite3_memory_highwater(0)<<
"\n";
425 mf::LogInfo(
"Gen311")<<
"Attached db "<< locallist[i]<<
"\n";
508 const std::string kStatement(
"select min(t) from particles");
513 if ( sqlite3_prepare(
fdb[i], kStatement.c_str(), -1, &statement, 0 ) == SQLITE_OK ){
515 res = sqlite3_step(statement);
516 if ( res == SQLITE_ROW ){
517 t=sqlite3_column_double(statement,0);
518 mf::LogInfo(
"Gen311")<<
"For showers input "<< i<<
" found particles.min(t)="<<t<<
"\n";
521 throw cet::exception(
"Gen311") <<
"Unexpected sqlite3_step return value: (" <<res<<
"); "<<
"ERROR:"<<sqlite3_errmsg(
fdb[i])<<
"\n";
524 throw cet::exception(
"Gen311") <<
"Error preparing statement: (" <<kStatement<<
"); "<<
"ERROR:"<<sqlite3_errmsg(
fdb[i])<<
"\n";
545 for (
unsigned int bnd = 0; bnd<6; bnd++){
561 <<
"Area extended by : "<<fShowerAreaExtension
564 <<
"\nShowers to be distributed with random YZ shift: "<<
fRandomYZShift<<
" cm" 565 <<
"\nShowers to be distributed over area: "<<showersArea<<
" m^2" 566 <<
"\nShowers to be distributed over time: "<<
fSampleTime<<
" s" 567 <<
"\nShowers to be distributed with time offset: "<<
fToffset<<
" s" 568 <<
"\nShowers to be distributed at x: "<<
fShowerBounds[1]<<
" cm" 573 const std::string kStatement(
"select erange_high,erange_low,eslope,nshow from input");
574 double upperLimitOfEnergyRange=0.,lowerLimitOfEnergyRange=0.,energySlope=0.,oneMinusGamma=0.,EiToOneMinusGamma=0.,EfToOneMinusGamma=0.;
579 if ( sqlite3_prepare(
fdb[i], kStatement.c_str(), -1, &statement, 0 ) == SQLITE_OK ){
581 res = sqlite3_step(statement);
582 if ( res == SQLITE_ROW ){
583 upperLimitOfEnergyRange=sqlite3_column_double(statement,0);
584 lowerLimitOfEnergyRange=sqlite3_column_double(statement,1);
585 energySlope = sqlite3_column_double(statement,2);
586 fMaxShowers.push_back(sqlite3_column_int(statement,3));
587 oneMinusGamma = 1 + energySlope;
588 EiToOneMinusGamma =
pow(lowerLimitOfEnergyRange, oneMinusGamma);
589 EfToOneMinusGamma =
pow(upperLimitOfEnergyRange, oneMinusGamma);
590 mf::LogVerbatim(
"Gen311")<<
"For showers input "<< i<<
" found e_hi="<<upperLimitOfEnergyRange<<
", e_lo="<<lowerLimitOfEnergyRange<<
", slope="<<energySlope<<
", k="<<
fShowerFluxConstants[i]<<
"\n";
592 throw cet::exception(
"Gen311") <<
"Unexpected sqlite3_step return value: (" <<res<<
"); "<<
"ERROR:"<<sqlite3_errmsg(
fdb[i])<<
"\n";
595 throw cet::exception(
"Gen311") <<
"Error preparing statement: (" <<kStatement<<
"); "<<
"ERROR:"<<sqlite3_errmsg(
fdb[i])<<
"\n";
602 <<
" the number of showers per event is "<<(
int)NShowers<<
"\n";
608 return (var - (high - low) * floor(var/(high-low))) + low;
613 boxno=
int(floor(var/(high-low)));
614 return (var - (high - low) * floor(var/(high-low))) + low;
630 std::map< int, std::vector<simb::MCParticle> > ParticleMap;
631 std::map< int, int > ShowerTrkIDMap;
639 static TDatabasePDG* pdgt = TDatabasePDG::Instance();
643 const TString kStatement(
"select shower,pdg,px,py,pz,x,z,t,e from particles where shower in (select id from showers ORDER BY substr(id*%f,length(id)+2) limit %d) ORDER BY substr(shower*%f,length(shower)+2)");
657 double fBoxDelta=1.e-5;
678 while(nShowerCntr>0){
683 nShowerQry=nShowerCntr;
686 double thisrnd=
flat();
687 TString kthisStatement=
TString::Format(kStatement.Data(),thisrnd,nShowerQry,thisrnd);
689 if ( sqlite3_prepare(
fdb[i], kthisStatement.Data(), -1, &statement, 0 ) == SQLITE_OK ){
693 res = sqlite3_step(statement);
694 if ( res == SQLITE_ROW ){
695 shower=sqlite3_column_int(statement,0);
697 pdg=sqlite3_column_int(statement,1);
700 TParticlePDG* pdgp = pdgt->GetParticle(pdg);
701 if (pdgp) m = pdgp->Mass();
710 px = sqlite3_column_double(statement,3);
711 py = sqlite3_column_double(statement,4);
712 pz = sqlite3_column_double(statement,2);
713 etot=sqlite3_column_double(statement,8);
714 y = sqlite3_column_double(statement,6);
715 z = sqlite3_column_double(statement,5);
716 t = sqlite3_column_double(statement,7);
719 TLorentzVector mom(px,py,pz,etot);
729 ParticleMap[ shower ].push_back(p);
730 ShowerTrkIDMap[ ntotalCtr ] = shower;
733 }
else if ( res == SQLITE_DONE ){
736 throw cet::exception(
"Gen311") <<
"Unexpected sqlite3_step return value: (" <<res<<
"); "<<
"ERROR:"<<sqlite3_errmsg(
fdb[i])<<
"\n";
740 throw cet::exception(
"Gen311") <<
"Error preparing statement: (" <<kthisStatement<<
"); "<<
"ERROR:"<<sqlite3_errmsg(
fdb[i])<<
"\n";
742 nShowerCntr=nShowerCntr-nShowerQry;
748 double showerTime=0, showerTimey=0, showerTimez=0, showerYOffset=0, showerZOffset=0;
749 int boxnoY=0, boxnoZ=0;
751 for(
auto ParticleMapIt : ParticleMap ){
753 if( ParticleMapIt.first == ShowerTrkIDMap[ trg.
GetTriggerId() ] ){
773 for(
auto particleIt : ParticleMapIt.second ){
775 simb::MCParticle particle(particleIt.TrackId(),particleIt.PdgCode(),
"primary",-200,particleIt.Mass(),1);
795 z =
wrapvarBoxNo(particleIt.Position().Z()+showerZOffset,fShowerBounds[4],fShowerBounds[5],boxnoZ);
800 x0[0]= fShowerBounds[1];
803 dx[0]= particleIt.Momentum().X();
804 dx[1]= particleIt.Momentum().Y();
805 dx[2]= particleIt.Momentum().Z();
810 TLorentzVector
pos(xyzo[0],xyzo[1],xyzo[2], t);
811 TLorentzVector mom(dx[0],dx[1],dx[2], particleIt.Momentum().T() );
812 particle.AddTrajectoryPoint( pos, mom );
814 mctruth.
Add( particle );
832 return atan( py/pz );
834 else if( atan( py/pz ) < 0 ){
835 return atan( py/pz )+3.1415926;
838 return atan( py/pz )-3.1415926;
845 return -3.1415926/2.;
851 (*p_R)[0][0]= cos(phi)*cos(theta);
852 (*p_R)[0][1]= cos(phi)*sin(theta);
853 (*p_R)[0][2]= -sin(phi);
854 (*p_R)[1][0]= -sin(theta);
855 (*p_R)[1][1]= cos(theta);
857 (*p_R)[2][0]= sin(phi)*cos(theta);
858 (*p_R)[2][1]= sin(phi)*sin(theta);
859 (*p_R)[2][2]= cos(phi);
868 double (*p_R)[3][3]=&
R;
869 GetMatrix(theta, phi, p_R);
871 for(
int i=0; i<3; i++){
872 for(
int j=0; j<3; j++){
873 dir[i] += (*p_R)[i][j]*urv[j];
884 bool intersects_tpc =
false;
885 for (
int bnd=0; bnd!=6; ++bnd) {
887 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])};
888 if ( p2[1] >= bounds[2] && p2[1] <= bounds[3] &&
889 p2[2] >= bounds[4] && p2[2] <= bounds[5] ) {
890 intersects_tpc =
true;
894 else if (bnd>=2 && bnd<4) {
895 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])};
896 if ( p2[0] >= bounds[0] && p2[0] <= bounds[1] &&
897 p2[2] >= bounds[4] && p2[2] <= bounds[5] ) {
898 intersects_tpc =
true;
903 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]};
904 if ( p2[0] >= bounds[0] && p2[0] <= bounds[1] &&
905 p2[1] >= bounds[2] && p2[1] <= bounds[3] ) {
906 intersects_tpc =
true;
912 return intersects_tpc;
919 double minx=0, miny=0, minz=0;
920 double maxx=0, maxy=0, maxz=0;
923 for (
size_t t = 0;
t < cryostat.
NTPC();
t++){
925 if (tpcg.
MinX() < minx) minx = tpcg.
MinX();
926 if (tpcg.
MaxX() > maxx) maxx = tpcg.
MaxX();
927 if (tpcg.
MinY() < miny) miny = tpcg.
MinY();
928 if (tpcg.
MaxY() > maxy) maxy = tpcg.
MaxY();
929 if (tpcg.
MinZ() < minz) minz = tpcg.
MinZ();
930 if (tpcg.
MaxZ() > maxz) maxz = tpcg.
MaxZ();
948 double dummy[6] = {0};
953 for(
int i=0;i<6;i++){cryo[i] = dummy[i];}
959 const double indxyz[],
970 const double dxyz[3]={-indxyz[0],-indxyz[1],-indxyz[2]};
976 if (dxyz[0] > 0.0) { dx = (xhi-xyz[0])/dxyz[0]; }
977 else if (dxyz[0] < 0.0) { dx = (xlo-xyz[0])/dxyz[0]; }
978 if (dxyz[1] > 0.0) { dy = (yhi-xyz[1])/dxyz[1]; }
979 else if (dxyz[1] < 0.0) { dy = (ylo-xyz[1])/dxyz[1]; }
980 if (dxyz[2] > 0.0) { dz = (zhi-xyz[2])/dxyz[2]; }
981 else if (dxyz[2] < 0.0) { dz = (zlo-xyz[2])/dxyz[2]; }
986 if (dx < dy && dx < dz) d = dx;
987 else if (dy < dz && dy < dx) d = dy;
988 else if (dz < dx && dz < dy) d = dz;
991 for (
int i = 0; i < 3; ++i) {
992 xyzout[i] = xyz[i] + dxyz[i]*
d;
1000 double tpc[6] ={0.}; this->GetTPCSize(tpc);
1001 for(
int i=0; i<6; i++){ tpc[i] += fTPCBuffer[i]; }
1004 double cryo[6] ={0.}; this->GetCryoSize(cryo);
1005 for(
int i=0; i<6; i++){ cryo[i] += fCryoBuffer[i]; }
1007 CLHEP::RandFlat
flat(engine);
1010 if( fMuonList.size() == 0){
1011 mf::LogInfo(
"Gen311") <<
"Trigger muon not found! Only Background";
1015 fTriggerMu = fMuonList.at( (
int)
flat()*fMuonList.size() );
1018 double p=0, theta=0, phi=0;
1020 px = fTriggerMu.Momentum().X();
1021 py = fTriggerMu.Momentum().Y();
1022 pz = fTriggerMu.Momentum().Z();
1029 double xyz[3] ={0.};
1030 xyz[0]=(tpc[5]-tpc[4])/2-tpc[5];
1031 xyz[1]=(tpc[1]-tpc[0])/2-tpc[1];
1032 xyz[2]=(tpc[3]-tpc[2])/2-tpc[2];
1035 double cos_x=cos(theta);
1036 double cos_y=sin(phi)*sin(theta);
1037 double cos_z=cos(phi)*sin(theta);
1038 double dxyz[3] = { cos_z, cos_x, cos_y };
1041 double length[2]={0.};
1043 double rdm_start[3] ={0.};
1044 double xyzo[3]={0.};
1047 for(
int i=0; i<2; i++){
1048 for(
int j=2; j<4; j++){
1049 for(
int k=4;
k<6;
k++){
1052 double proj[3]={0.};
1053 double u=0;
double v=0;
1061 for(
int p=0; p<3; p++ ){ dot+=(corner[
p]-xyz[
p])*dxyz[p]; }
1062 for(
int p=0; p<3; p++ ){ proj[
p] = corner[
p]-(dot*dxyz[
p]); }
1064 proj[0] -= (tpc[5]-tpc[4])/2;
1068 double (*p_R)[3][3]=&
R;
1069 this->GetMatrix(theta, phi, p_R);
1072 for(
int p=0; p<3; p++ ){ u += (*p_R)[
p][0]*proj[
p]; }
1073 if(length[0] < u){ length[0] = u; }
1076 for(
int p=0; p<3; p++ ){ v += (*p_R)[
p][2]*proj[
p]; }
1077 if(length[1] < v){ length[1] = v; }
1083 bool is_inside=
false;
1086 while(!is_inside && iteration > 0){
1089 double u =
flat()*2*length[0]-length[0];
1090 double v =
flat()*2*length[1]-length[1];;
1093 double urv[3] ={ u, 0, v };
1094 double dir[3]={ 0., 0., 0. };
1095 this->DoRotation( urv, dir, theta, phi );
1098 rdm_start[0] = (double)dir[1];
1099 rdm_start[1] = (double)dir[2];
1100 rdm_start[2] = (double)dir[0]+(tpc[5]-tpc[4])/2;
1102 double dx[3]={
px,
py,pz};
1103 this->
ProjectToBoxEdge(rdm_start, dx, cryo[0], cryo[1], cryo[2], cryo[3], cryo[4], cryo[5], xyzo);
1105 if( this->Intersect(xyzo, dx, tpc) ){
1116 mf::LogInfo(
"Gen311") <<
"Trigger muon not found in 20 iterations. Only Background";
1128 fTriggerID = fTriggerMu.TrackId();
1129 fTriggerPosX = rdm_start[0];
1130 fTriggerPosY = rdm_start[1];
1131 fTriggerPosZ = rdm_start[2];
1133 fTriggerPos.SetXYZT(rdm_start[0],rdm_start[1],rdm_start[2],0);
1134 fTriggerOffsetX = rdm_start[0] - fTriggerMu.Position().X();
1135 fTriggerOffsetY = rdm_start[1] - fTriggerMu.Position().Y();
1136 fTriggerOffsetZ = rdm_start[2] - fTriggerMu.Position().Z();
1137 fTriggerOffsetT = 0 - fTriggerMu.Position().T();
1150 std::unique_ptr< std::vector<simb::MCTruth> > truthcol(
new std::vector<simb::MCTruth>);
1160 mf::LogInfo(
"CORSIKAGendp")<<
"GetSample number of particles returned: "<<pretruth.
NParticles()<<
"\n";
1166 for(
int i = 0; i < pretruth.
NParticles(); ++i){
1169 TLorentzVector v4 = particle.
Position();
1170 const TLorentzVector& p4 = particle.
Momentum();
1171 double x0[3] = {v4.X(), v4.Y(), v4.Z() };
1172 double dx[3] = {p4.Px(), p4.Py(), p4.Pz()};
1181 for (
unsigned int cb=0; cb<6; cb++){
1182 bounds[cb] = bounds[cb]+
fBuffBox[cb];
1186 bool intersects_cryo =
false;
1187 for (
int bnd=0; bnd!=6; ++bnd) {
1189 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])};
1190 if ( p2[1] >= bounds[2] && p2[1] <= bounds[3] &&
1191 p2[2] >= bounds[4] && p2[2] <= bounds[5] ) {
1192 intersects_cryo =
true;
1196 else if (bnd>=2 && bnd<4) {
1197 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])};
1198 if ( p2[0] >= bounds[0] && p2[0] <= bounds[1] &&
1199 p2[2] >= bounds[4] && p2[2] <= bounds[5] ) {
1200 intersects_cryo =
true;
1205 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]};
1206 if ( p2[0] >= bounds[0] && p2[0] <= bounds[1] &&
1207 p2[1] >= bounds[2] && p2[1] <= bounds[3] ) {
1208 intersects_cryo =
true;
1214 if (intersects_cryo){
1215 truth.
Add(particle);
1222 mf::LogInfo(
"Gen311")<<
"Number of particles from getsample crossing cryostat + bounding box: "<<truth.
NParticles()<<
"\n";
1224 truthcol->push_back(truth);
CLHEP::HepRandomEngine & fPoisEngine
base_engine_t & createEngine(seed_t seed)
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
void AddMuon(simb::MCParticle particle)
const TLorentzVector & Position(const int i=0) const
void DoRotation(double urv[], double dir[], double theta, double phi)
art::ServiceHandle< geo::Geometry > geom
void AddTrajectoryPoint(TLorentzVector const &position, TLorentzVector const &momentum)
double wrapvarBoxNo(const double var, const double low, const double high, int &boxno)
Encapsulate the construction of a single cyostat.
void produce(art::Event &e) override
Collect all the geometry header files together.
void SetOrigin(simb::Origin_t origin)
std::vector< double > fActiveVolumeCut
Active volume cut.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< double > fCryoBuffer
double fShowerBounds[6]
Boundaries of area over which showers are to be distributed.
void WorldBox(double *xlo, double *xhi, double *ylo, double *yhi, double *zlo, double *zhi) const
Fills the arguments with the boundaries of the world.
double wrapvar(const double var, const double low, const double high)
EDProducer(fhicl::ParameterSet const &pset)
double MinX() const
Returns the world x coordinate of the start of the box.
Geometry information for a single TPC.
std::vector< double > fShowerFluxConstants
Set of flux constants to be associated with each shower data file.
def GetPhi(pos, x0, pars)
struct sqlite3_stmt sqlite3_stmt
double fSampleTime
Duration of sample [s].
void SetTPCBuffer(std::vector< double > buffer)
double MaxX() const
Returns the world x coordinate of the end of the box.
double GetTriggerOffsetT()
void GetCryoSize(double cryo[])
Geometry information for a single cryostat.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
TLorentzVector fTriggerPos
void CryostatBoundaries(double *boundaries, geo::CryostatID const &cid) const
Returns the boundaries of the specified cryostat.
art framework interface to geometry description
void reconfigure(fhicl::ParameterSet const &p)
TLorentzVector GetTriggerPos()
void MakeTrigger(CLHEP::HepRandomEngine &engine)
double GetTriggerOffsetX()
bool InTPC(const simb::MCParticle particle)
void ProjectToBoxEdge(const double xyz[], const double indxyz[], const double xlo, const double xhi, const double ylo, const double yhi, const double zlo, const double zhi, double xyzout[])
ifdh_ns::ifdh * fIFDH
(optional) flux file handling
#define DEFINE_ART_MODULE(klass)
std::vector< double > fNShowersPerEvent
Number of showers to put in each event of duration fSampleTime; one per showerinput.
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
sqlite3 * fdb[5]
Pointers to sqlite3 database object, max of 5.
int fShowerInputs
Number of shower inputs to process from.
std::string getenv(std::string const &name)
void GetMatrix(double theta, double phi, double(*p_R)[3][3])
double fProjectToHeight
Height to which particles will be projected [cm].
double MinZ() const
Returns the world z coordinate of the start of the box.
CLHEP::HepRandomEngine & fGenEngine
std::vector< int > fMaxShowers
unsigned int NTPC() const
Number of TPCs in this cryostat.
std::vector< std::string > fShowerInputFiles
Set of CORSIKA shower data files to use.
void GetTPCSize(double tpc[])
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
double GetPhi(const double py, const double pz)
Gen311(fhicl::ParameterSet const &p)
double GetTriggerOffsetZ()
BoundingBox bounds(int x, int y, int w, int h)
double fToffset_corsika
Timing offset to account for propagation time through atmosphere, populated from db.
void GetSample(simb::MCTruth &)
double MaxY() const
Returns the world y coordinate of the end of the box.
const simb::MCParticle & GetParticle(int i) const
Gen311 & operator=(Gen311 const &)=delete
double GetTriggerOffsetY()
void beginRun(art::Run &run) override
double fRandomYZShift
Each shower will be shifted by a random amount in xz so that showers won't repeatedly sample the same...
void Add(simb::MCParticle const &part)
std::vector< double > fBuffBox
Buffer box extensions to cryostat in each direction (6 of them: x_lo,x_hi,y_lo,y_hi,z_lo,z_hi) [cm].
double fShowerAreaExtension
Extend distribution of corsika particles in x,z by this much (e.g. 1000 will extend 10 m in -x...
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
void SetCryoBuffer(std::vector< double > buffer)
double MaxZ() const
Returns the world z coordinate of the end of the box.
const TLorentzVector & Momentum(const int i=0) const
simb::MCParticle fTriggerMu
cet::LibraryManager dummy("noplugin")
EventNumber_t event() const
std::vector< double > fTPCBuffer
std::vector< simb::MCParticle > fMuonList
void ProjectToBoxEdge(const double xyz[], const double dxyz[], double xlo, double xhi, double ylo, double yhi, double zlo, double zhi, double xyzout[])
art::ServiceHandle< geo::Geometry > geom
Event generator information.
bool fUseIFDH
< List of pdg codes for particles that can be potentially used as triggers
LArSoft geometry interface.
double MinY() const
Returns the world y coordinate of the start of the box.
bool Intersect(const double x0[], const double dx[], const double bounds[])
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
TLorentzVector GetTriggerMom()
double fToffset
Time offset of sample, defaults to zero (no offset) [s].
std::vector< double > fLeadingParticlesList