30 #include "TDatabasePDG.h" 108 ,
fPDG (pset.get< std::vector<int> >(
"PDG") )
109 ,
fXYZ_Off (pset.get< std::vector<double> >(
"InitialXYZOffsets"))
113 ,
fBranchNames (pset.get< std::vector<std::string> >(
"BranchNames") )
116 produces< std::vector<simb::MCTruth> >();
117 produces< sumdata::RunData, art::InRun >();
129 std::cout <<
"FileMuons: Not yet equipped to walk through muons with TFS mojo."<<
std::endl;
133 std::cout <<
"FileMuons: You have chosen to read muons from Root File " <<
fFileName <<
std::endl;
137 std::cout <<
"FileMuons: You have chosen to read muons from " <<
fFileName <<
"." <<
std::endl;
141 std::cout <<
"FileMuons: You must specify one of source/text/root file to read for muons."<<
std::endl;
151 std::cout <<
"FileMuons: " <<
fFileName <<
" size is: " << (end-
begin) <<
" bytes.\n";
154 for (
unsigned int header=0; header<3 &&
fMuonFile->good(); ++header)
161 std::cout <<
"FileMuons: Problem reading muon file header."<<
std::endl;
169 TNtuple->SetBranchAddress(
"x", &
xtmp, &
b_x);
170 TNtuple->SetBranchAddress(
"y", &
ytmp, &
b_y);
171 TNtuple->SetBranchAddress(
"z", &
ztmp, &
b_z);
172 TNtuple->SetBranchAddress(
"E", &
E, &
b_E);
174 TNtuple->SetBranchAddress(
"phi", &
phi, &
b_phi);
175 TNtuple->SetBranchAddress(
"xdet", &
xdet, &
b_xdet);
176 TNtuple->SetBranchAddress(
"ydet", &
ydet, &
b_ydet);
177 TNtuple->SetBranchAddress(
"zdet", &
zdet, &
b_zdet);
178 TNtuple->SetBranchAddress(
"px", &
pxtmp, &
b_px);
179 TNtuple->SetBranchAddress(
"py", &
pytmp, &
b_py);
180 TNtuple->SetBranchAddress(
"pz", &
pztmp, &
b_pz);
208 std::unique_ptr< std::vector<simb::MCTruth> > truthcol(
new std::vector<simb::MCTruth>);
215 truthcol->push_back(truth);
230 for (
unsigned int i=0; i<
fPDG.size(); ++i) {
248 std::cout <<
"FileMuons: Problem reading muon file line ...."<<
countFile <<
". Perhaps you've exhausted the events in " <<
fFileName <<
std::endl; exit(0);
260 cstr =
new char [line.size()+1];
261 strcpy (cstr, line.c_str());
263 ptok=strtok (cstr,
"*");
264 unsigned int fieldCount = 0;
265 unsigned int posIndex = 0;
266 unsigned int pIndex = 0;
270 ptok=strtok(NULL,
"*");
271 if (fieldCount==9 || fieldCount==10 || fieldCount==11)
273 p[pIndex] = atof(ptok); pIndex++;
276 if (fieldCount==6 || fieldCount==7 || fieldCount==8)
278 x[posIndex] = atof(ptok);
280 if (posIndex==2) {x[posIndex] = -1.0*x[posIndex];}
316 static TDatabasePDG pdgt;
317 pdgLocal = -q*
fPDG[i];
319 TParticlePDG* pdgp = pdgt.GetParticle(pdgLocal);
320 if (pdgp) m = pdgp->Mass();
326 const double cryoGap = 15.0;
341 TLorentzVector
pos(x[0]*100.0, x[1]*100.0, x[2]*100.0, 0.0);
342 TLorentzVector pvec(p[0]*1000.0,p[1]*1000.0,p[2]*1000.0,std::sqrt(p.Mag2()*1000.0*1000.0+m*
m));
343 std::cout <<
"x[m] and p [TeV] are " <<
std::endl;
347 int trackid = -1*(i+1);
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
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
EDProducer(fhicl::ParameterSet const &pset)
std::string fMuonsFileType
void ReadEvents(simb::MCTruth &mct)
void beginRun(art::Run &run)
std::ifstream * fMuonFile
art framework interface to geometry description
std::vector< std::string > fBranchNames
#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
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
module to produce single or multiple specified particles in the detector
FileMuons(fhicl::ParameterSet const &pset)
void Add(simb::MCParticle const &part)
geo::Length_t CryostatHalfWidth(geo::CryostatID const &cid) const
Returns the half width of the cryostat (x direction)
void line(double t, double *p, double &x, double &y, double &z)
geo::Length_t CryostatLength(geo::CryostatID const &cid) const
Returns the length of the cryostat (z direction)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Event generator information.
LArSoft geometry interface.
Event Generation using GENIE, cosmics or single particles.
void produce(art::Event &evt)
QTextStream & endl(QTextStream &s)