50 TDirectory *
dir =
new TDirectoryFile(
"DMC",
"DMC");
54 tree_thrown =
new TTree(
"thrown",
"tree for thrown events");
69 vector<const DBeamPhoton*> beam_photons;
70 vector<const DMCThrown*> mcthrowns;
71 vector<const DMCTrackHit*> mctrackhits;
72 vector<const DRichHit*> richhits;
73 vector<const DCereHit*> cerehits;
74 vector<const DRichTruthHit*> richtruthhits;
76 loop->Get(beam_photons);
78 loop->Get(mctrackhits);
81 loop->Get(richtruthhits);
83 TVector3 VertexGen = TVector3(mcthrowns[0]->position().
X(),
84 mcthrowns[0]->position().Y(), mcthrowns[0]->position().Z());
86 TLorentzVector beam_photon(0.0, 0.0, 9.0, 9.0);
87 if (beam_photons.size() > 0) {
89 beam_photon.SetPxPyPzE(lv.Px(), lv.Py(), lv.Pz(), lv.E());
93 TLorentzVector target(0.0, 0.0, 0.0, 0.93827);
119 map<int, int> cdchits;
120 map<int, int> fdchits;
121 map<int, int> bcalhits;
122 map<int, int> fcalhits;
123 map<int, int> upvhits;
124 map<int, int> tofhits;
126 map<int, int> richpoints;
127 map<int, int> cerepoints;
129 for (
unsigned int i = 0; i < mctrackhits.size(); i++) {
132 switch (mctrackhit->
system) {
135 cdchits[mctrackhit->
track]++;
139 fdchits[mctrackhit->
track]++;
142 bcalhits[mctrackhit->
track]++;
145 fcalhits[mctrackhit->
track]++;
148 upvhits[mctrackhit->
track]++;
151 tofhits[mctrackhit->
track]++;
154 richpoints[mctrackhit->
track]++;
157 cerepoints[mctrackhit->
track]++;
165 bool all_fiducial =
true;
167 for (
unsigned int j = 0; j < mcthrowns.size(); j++) {
171 if (cdchits.find(j + 1) != cdchits.end())
172 hits.
hits_cdc = cdchits.find(j + 1)->second;
175 if (fdchits.find(j + 1) != fdchits.end())
176 hits.
hits_fdc = fdchits.find(j + 1)->second;
179 if (bcalhits.find(j + 1) != bcalhits.end())
180 hits.
hits_bcal = bcalhits.find(j + 1)->second;
183 if (fcalhits.find(j + 1) != fcalhits.end())
184 hits.
hits_fcal = fcalhits.find(j + 1)->second;
187 if (upvhits.find(j + 1) != upvhits.end())
188 hits.
hits_upv = upvhits.find(j + 1)->second;
191 if (tofhits.find(j + 1) != tofhits.end())
192 hits.
hits_tof = tofhits.find(j + 1)->second;
195 if (richpoints.find(j + 1) != richpoints.end())
196 hits.
hits_rich = richpoints.find(j + 1)->second;
199 if (cerepoints.find(j + 1) != cerepoints.end())
200 hits.
hits_cere = cerepoints.find(j + 1)->second;
204 switch (mcthrowns[j]->type) {
265 for (
unsigned int j = 0; j < richhits.size(); j++)
268 for (
unsigned int j = 0; j < cerehits.size(); j++)
271 for (
unsigned int j = 0; j < richtruthhits.size(); j++)
276 japp->RootWriteLock();
310 hit.
x.SetXYZ(x, y, z);
331 const DRichTruthHit *rthit) {
336 double px = rthit->px;
337 double py = rthit->py;
338 double pz = rthit->pz;
340 hit.
x.SetXYZ(x, y, z);
341 hit.
p.SetXYZ(px, py, pz);
344 hit.
track = rthit->track;
346 hit.
ptype = rthit->ptype;
362 double theta = kd->
momentum().Theta();
364 double px = p *
sin(theta) * cos(phi);
365 double py = p *
sin(theta) *
sin(phi);
366 double pz = p * cos(theta);
367 double E =
sqrt(mass * mass + p * p);
373 part.
p.SetPxPyPzE(px, py, pz, E);
374 part.
x.SetXYZ(x, y, z);
397 vector<Particle> &neutron = pset.
neutrons;
398 vector<Particle> &pip = pset.
piplus;
399 vector<Particle> &pim = pset.
piminus;
400 vector<Particle> &Kp = pset.
Kplus;
401 vector<Particle> &Km = pset.
Kminus;
402 vector<Particle> &proton = pset.
protons;
403 vector<Particle> &electron = pset.
electrons;
404 vector<Particle> &positron = pset.
positrons;
405 vector<RichHit> &richhit = pset.
richhits;
406 vector<CereHit> &cerehit = pset.
cerehits;
421 for (
unsigned int i = 0; i < photon.size(); i++) {
422 TClonesArray &prts = *(evt->
photon);
428 for (
unsigned int i = 0; i < neutron.size(); i++) {
429 TClonesArray &prts = *(evt->
neutron);
435 for (
unsigned int i = 0; i < pip.size(); i++) {
436 TClonesArray &prts = *(evt->
pip);
442 for (
unsigned int i = 0; i < pim.size(); i++) {
443 TClonesArray &prts = *(evt->
pim);
449 for (
unsigned int i = 0; i < Kp.size(); i++) {
450 TClonesArray &prts = *(evt->
Kp);
456 for (
unsigned int i = 0; i < Km.size(); i++) {
457 TClonesArray &prts = *(evt->
Km);
463 for (
unsigned int i = 0; i < proton.size(); i++) {
464 TClonesArray &prts = *(evt->
proton);
470 for (
unsigned int i = 0; i < electron.size(); i++) {
471 TClonesArray &prts = *(evt->
electron);
477 for (
unsigned int i = 0; i < positron.size(); i++) {
478 TClonesArray &prts = *(evt->
positron);
486 for (
unsigned int i = 0; i < richhit.size(); i++) {
487 TClonesArray &hits = *(evt->
richhit);
494 for (
unsigned int i = 0; i < cerehit.size(); i++) {
495 TClonesArray &hits = *(evt->
cerehit);
502 for (
unsigned int i = 0; i < richtruthhit.size(); i++) {
505 *hit = richtruthhit[i];
508 for (
unsigned int i = 0; i < photon.size(); i++)
509 evt->
W += photon[i].p;
510 for (
unsigned int i = 0; i < neutron.size(); i++)
511 evt->
W += neutron[i].p;
512 for (
unsigned int i = 0; i < pip.size(); i++)
514 for (
unsigned int i = 0; i < pim.size(); i++)
516 for (
unsigned int i = 0; i < Kp.size(); i++)
518 for (
unsigned int i = 0; i < Km.size(); i++)
520 for (
unsigned int i = 0; i < electron.size(); i++)
521 evt->
W += electron[i].p;
522 for (
unsigned int i = 0; i < positron.size(); i++)
523 evt->
W += positron[i].p;
530 double theta_degrees = kd->
momentum().Theta() * TMath::RadToDeg();
533 if (kd->
charge() == 0.0) {
535 if (theta_degrees < 2.0 || theta_degrees > 110.0)
541 if (theta_degrees < 1.0 || theta_degrees > 120.0)
CereHit MakeCereHit(const DCereHit *chit)
vector< Particle > piplus
DEventProcessor_mc_tree()
vector< Particle > neutrons
RichTruthHit MakeRichTruthHit(const DRichTruthHit *rthit)
static bool CompareLorentzEnergy(const Particle &a, const Particle &b)
const DVector3 & position(void) const
vector< Particle > piminus
Particle MakeParticle(const DKinematicData *kd, double mass, hit_set hits)
vector< CereHit > cerehits
TLorentzVector DLorentzVector
jerror_t erun(void)
Invoked via DEventProcessor virtual method.
DetectorSystem_t system
particle type
vector< Particle > protons
vector< Particle > Kminus
jerror_t init(void)
Invoked via DEventProcessor virtual method.
void FillEvent(Event *evt, particle_set &pset)
RichHit MakeRichHit(const DRichHit *rhit)
~DEventProcessor_mc_tree()
double charge(void) const
bool IsFiducial(const DKinematicData *kd)
jerror_t evnt(JEventLoop *loop, uint64_t eventnumber)
Invoked via DEventProcessor virtual method.
TClonesArray * richtruthhit
static double ParticleMass(Particle_t p)
vector< RichHit > richhits
vector< RichTruthHit > richtruthhits
vector< Particle > positrons
int primary
primary track=1 not primary track=0
vector< Particle > electrons
const DVector3 & momentum(void) const
vector< Particle > photons
int primary
primary track=1 not primary track=0
for(auto locVertexInfo:dStepVertexInfos)
jerror_t fini(void)
Invoked via DEventProcessor virtual method.