33 #include "TDatabasePDG.h" 48 namespace simb {
class MCTruth; }
116 : fEventNumberOffset(pset.get< int >(
"EventNumberOffset"))
117 , fPDG (pset.get<
std::
vector<int> >(
"PDG") )
118 , fXYZ_Off (pset.get<
std::
vector<double> >(
"InitialXYZOffsets"))
119 , fFileName (pset.get<
std::string >(
"FileName") )
120 , fMuonsFileType (pset.get<
std::string >(
"MuonsFileType") )
121 , fTreeName (pset.get<
std::string >(
"TreeName") )
122 , fBranchNames (pset.get<
std::
vector<
std::string> >(
"BranchNames") )
125 produces< std::vector<simb::MCTruth> >();
126 produces< sumdata::RunData, art::InRun >();
138 std::cout <<
"FileMuons: Not yet equipped to walk through muons with TFS mojo."<< std::endl;
142 std::cout <<
"FileMuons: You have chosen to read muons from Root File " <<
fFileName << std::endl;
146 std::cout <<
"FileMuons: You have chosen to read muons from " <<
fFileName <<
"." << std::endl;
150 std::cout <<
"FileMuons: You must specify one of source/text/root file to read for muons."<< std::endl;
160 std::cout <<
"FileMuons: " <<
fFileName <<
" size is: " << (end-
begin) <<
" bytes.\n";
163 for (
unsigned int header=0; header<3 &&
fMuonFile->good(); ++header)
170 std::cout <<
"FileMuons: Problem reading muon file header."<< std::endl;
178 TNtuple->SetBranchAddress(
"x", &
xtmp, &
b_x);
179 TNtuple->SetBranchAddress(
"y", &
ytmp, &
b_y);
180 TNtuple->SetBranchAddress(
"z", &
ztmp, &
b_z);
181 TNtuple->SetBranchAddress(
"E", &
E, &
b_E);
183 TNtuple->SetBranchAddress(
"phi", &
phi, &
b_phi);
184 TNtuple->SetBranchAddress(
"xdet", &
xdet, &
b_xdet);
185 TNtuple->SetBranchAddress(
"ydet", &
ydet, &
b_ydet);
186 TNtuple->SetBranchAddress(
"zdet", &
zdet, &
b_zdet);
187 TNtuple->SetBranchAddress(
"px", &
pxtmp, &
b_px);
188 TNtuple->SetBranchAddress(
"py", &
pytmp, &
b_py);
189 TNtuple->SetBranchAddress(
"pz", &
pztmp, &
b_pz);
213 run.
put(std::move(runcol));
228 std::unique_ptr< std::vector<simb::MCTruth> > truthcol(
new std::vector<simb::MCTruth>);
235 truthcol->push_back(truth);
238 evt.
put(std::move(truthcol));
250 for (
unsigned int i=0; i<
fPDG.size(); ++i) {
268 std::cout <<
"FileMuons: Problem reading muon file line ...."<<
countFile <<
". Perhaps you've exhausted the events in " <<
fFileName << std::endl; exit(0);
280 cstr =
new char [line.size()+1];
281 strcpy (cstr, line.c_str());
283 ptok=strtok (cstr,
"*");
284 unsigned int fieldCount = 0;
285 unsigned int posIndex = 0;
286 unsigned int pIndex = 0;
290 ptok=strtok(NULL,
"*");
291 if (fieldCount==9 || fieldCount==10 || fieldCount==11)
293 p[pIndex] = atof(ptok); pIndex++;
296 if (fieldCount==6 || fieldCount==7 || fieldCount==8)
298 x[posIndex] = atof(ptok);
300 if (posIndex==2) {x[posIndex] = -1.0*x[posIndex];}
336 static TDatabasePDG pdgt;
337 pdgLocal = -q*
fPDG[i];
339 TParticlePDG* pdgp = pdgt.GetParticle(pdgLocal);
340 if (pdgp) m = pdgp->Mass();
346 const double cryoGap = 15.0;
361 TLorentzVector pos(x[0]*100.0, x[1]*100.0, x[2]*100.0, 0.0);
362 TLorentzVector pvec(p[0]*1000.0,p[1]*1000.0,p[2]*1000.0,std::sqrt(p.Mag2()*1000.0*1000.0+m*m));
363 std::cout <<
"x[m] and p [TeV] are " << std::endl;
367 int trackid = -1*(i+1);
368 std::string primary(
"primary");
std::vector< double > fXYZ_Off
geo::Length_t CryostatHalfHeight(geo::CryostatID const &cid) const
Returns the height of the cryostat (y direction)
void AddTrajectoryPoint(TLorentzVector const &position, TLorentzVector const &momentum)
void SetOrigin(simb::Origin_t origin)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::string fMuonsFileType
void ReadEvents(simb::MCTruth &mct)
void beginRun(art::Run &run)
art::ProductID put(std::unique_ptr< PROD > &&)
std::ifstream * fMuonFile
void Add(simb::MCParticle &part)
std::vector< std::string > fBranchNames
ProductID put(std::unique_ptr< PROD > &&product)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
#define DEFINE_ART_MODULE(klass)
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
single particles thrown at the detector
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
module to produce single or multiple specified particles in the detector
geo::Length_t CryostatHalfWidth(geo::CryostatID const &cid) const
Returns the half width of the cryostat (x direction)
geo::Length_t CryostatLength(geo::CryostatID const &cid) const
Returns the length of the cryostat (z direction)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
Event generator information.
Namespace collecting geometry-related classes utilities.
Event Generation using GENIE, cosmics or single particles.
art framework interface to geometry description
void produce(art::Event &evt)