GHepRecord.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2020, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7  University of Liverpool & STFC Rutherford Appleton Laboratory
8 */
9 //____________________________________________________________________________
10 
11 #include <cassert>
12 #include <algorithm>
13 #include <iomanip>
14 
15 #include <TLorentzVector.h>
16 #include <TVector3.h>
17 #include <TSystem.h>
18 #include <TRootIOCtor.h>
19 
20 #include "Framework/Conventions/GBuild.h"
31 
32 using std::endl;
33 using std::setw;
34 using std::setprecision;
35 using std::setfill;
36 using std::ios;
37 
38 using namespace genie;
39 
41 
42 int GHepRecord::fPrintLevel = 3;
43 
44 //___________________________________________________________________________
45 namespace genie {
46  ostream & operator << (ostream & stream, const GHepRecord & rec)
47  {
48  rec.Print(stream);
49  return stream;
50  }
51 }
52 //___________________________________________________________________________
54 TClonesArray("genie::GHepParticle")
55 {
56  this->InitRecord();
57 }
58 //___________________________________________________________________________
60 TClonesArray("genie::GHepParticle", size)
61 {
62  this->InitRecord();
63 }
64 //___________________________________________________________________________
66 TClonesArray("genie::GHepParticle", record.GetEntries())
67 {
68  this->InitRecord();
69  this->Copy(record);
70 }
71 //___________________________________________________________________________
72 GHepRecord::GHepRecord(TRootIOCtor*) :
73 TClonesArray("genie::GHepParticle"),
74 fInteraction(0),
75 fVtx(0),
76 fEventFlags(0),
77 fEventMask(0),
78 fWeight(0.),
79 fProb(0.),
80 fXSec(0.),
81 fDiffXSec(0.)
82 {
83 
84 }
85 //___________________________________________________________________________
87 {
88  this->CleanRecord();
89 }
90 //___________________________________________________________________________
92 {
93  if(!fInteraction) {
94  LOG("GHEP", pWARN) << "Returning NULL interaction";
95  }
96  return fInteraction;
97 }
98 //___________________________________________________________________________
100 {
102 }
103 //___________________________________________________________________________
105 {
106 // Returns the GHepParticle from the specified position of the event record.
107 
108  if( position >=0 && position < this->GetEntries() ) {
109  GHepParticle * particle = (GHepParticle *) (*this)[position];
110  if(particle) return particle;
111  }
112  LOG("GHEP", pINFO)
113  << "No particle found with: (pos = " << position << ")";
114 
115  return 0;
116 }
117 //___________________________________________________________________________
119  int pdg, GHepStatus_t status, int start) const
120 {
121 // Returns the first GHepParticle with the input pdg-code and status
122 // starting from the specified position of the event record.
123 
124  int nentries = this->GetEntries();
125  for(int i = start; i < nentries; i++) {
126  GHepParticle * p = (GHepParticle *) (*this)[i];
127  if(p->Status() == status && p->Pdg() == pdg) return p;
128  }
129 
130  LOG("GHEP", pINFO)
131  << "No particle found with: (pos >= " << start
132  << ", pdg = " << pdg << ", ist = " << status << ")";
133 
134  return 0;
135 }
136 //___________________________________________________________________________
138  int pdg, GHepStatus_t status, int start) const
139 {
140 // Returns the position of the first GHepParticle with the input pdg-code
141 // and status starting from the specified position of the event record.
142 
143  int nentries = this->GetEntries();
144  for(int i = start; i < nentries; i++) {
145  GHepParticle * p = (GHepParticle *) (*this)[i];
146  if(p->Status() == status && p->Pdg() == pdg) return i;
147  }
148 
149  LOG("GHEP", pINFO)
150  << "No particle found with: (pos >= " << start
151  << ", pdg = " << pdg << ", ist = " << status << ")";
152 
153  return -1;
154 }
155 //___________________________________________________________________________
156 int GHepRecord::ParticlePosition(GHepParticle * particle, int start) const
157 {
158 // Returns the position of the first match with the specified GHepParticle
159 // starting from the specified position of the event record.
160 
161  int nentries = this->GetEntries();
162  for(int i = start; i < nentries; i++) {
163  GHepParticle * p = (GHepParticle *) (*this)[i];
164  if( p->Compare(particle) ) return i;
165  }
166 
167  LOG("GHEP", pINFO)
168  << "No particle found with pos >= " << start
169  << " matching particle: " << *particle;
170 
171  return -1;
172 }
173 //___________________________________________________________________________
175 {
176 // Returns a list of all stable descendants of the GHEP entry in the input
177 // slot. The user adopts the output vector.
178 
179  // return null if particle index is out of range
180  int nentries = this->GetEntries();
181  if(position<0 || position>=nentries) return 0;
182 
183  vector<int> * descendants = new vector<int>;
184 
185  // return itself if it is a stable final state particle
186  if(this->Particle(position)->Status() == kIStStableFinalState) {
187  descendants->push_back(position);
188  return descendants;
189  }
190 
191  for(int i = 0; i < nentries; i++) {
192  if(i==position) continue;
193  GHepParticle * p = (GHepParticle *) (*this)[i];
194  if(p->Status() != kIStStableFinalState) continue;
195  bool is_descendant=false;
196  int mom = p->FirstMother();
197  while(mom>-1) {
198  if(mom==position) is_descendant=true;
199  if(is_descendant) {
200  descendants->push_back(i);
201  break;
202  }
203  mom = this->Particle(mom)->FirstMother();
204  }
205  }
206  return descendants;
207 }
208 //___________________________________________________________________________
210 {
211  GHepParticle * p0 = this->Particle(0);
212  if(!p0) return kGMdUnknown;
213  GHepParticle * p1 = this->Particle(1);
214  if(!p1) return kGMdUnknown;
215 
216  int p0pdg = p0->Pdg();
217  GHepStatus_t p0st = p0->Status();
218  int p1pdg = p1->Pdg();
219  GHepStatus_t p1st = p1->Status();
220 
221  // In lepton+nucleon/nucleus mode, the 1st entry in the event record
222  // is a charged or neutral lepton with status code = kIStInitialState
223  if( pdg::IsLepton(p0pdg) && p0st == kIStInitialState )
224  {
225  return kGMdLeptonNucleus;
226  }
227 
228  // In dark matter mode, the 1st entry in the event record is a dark
229  // matter particle
230  if( (pdg::IsDarkMatter(p0pdg) || pdg::IsAntiDarkMatter(p0pdg)) && p0st == kIStInitialState )
231  {
232  return kGMdDarkMatterNucleus;
233  }
234 
235  // In hadron+nucleon/nucleus mode, the 1st entry in the event record
236  // is a hadron with status code = kIStInitialState and the 2nd entry
237  // is a nucleon or nucleus with status code = kIStInitialState
238  if( pdg::IsHadron(p0pdg) && p0st == kIStInitialState )
239  {
240  if( (pdg::IsIon(p1pdg) || pdg::IsNucleon(p1pdg)) && p1st == kIStInitialState)
241  {
242  return kGMdHadronNucleus;
243  }
244  }
245 
246  // As above, with a photon as a probe
247  if( p0pdg == kPdgGamma && p0st == kIStInitialState )
248  {
249  if( (pdg::IsIon(p1pdg) || pdg::IsNucleon(p1pdg)) && p1st == kIStInitialState)
250  {
251  return kGMdPhotonNucleus;
252  }
253  }
254 
255  // In nucleon decay mode,
256  // - [if the decayed nucleon was a bound one] the 1st entry in the event
257  // record is a nucleus with status code = kIStInitialState and the
258  // 2nd entry is a nucleon with code = kIStDecayedState
259  // - [if the decayed nucleon was a free one] the first entry in the event
260  // record is a nucleon with status code = kIStInitialState and it has a
261  // single daughter which is a nucleon with status code = kIStDecayedState.
262 
263  if( pdg::IsIon(p0pdg) && p0st == kIStInitialState &&
264  pdg::IsNucleon(p1pdg) && p1st == kIStDecayedState)
265  {
266  return kGMdNucleonDecay;
267  }
268  if( pdg::IsNucleon(p0pdg) && p0st == kIStInitialState &&
269  pdg::IsNucleon(p1pdg) && p1st == kIStDecayedState)
270  {
271  return kGMdNucleonDecay;
272  }
273 
274  return kGMdUnknown;
275 }
276 //___________________________________________________________________________
278 {
279 // Returns the GHepParticle representing the probe (neutrino, e,...).
280 
281  int ipos = this->ProbePosition();
282  if(ipos>-1) return this->Particle(ipos);
283  return 0;
284 }
285 //___________________________________________________________________________
287 {
288 // Returns the GHepParticle representing the target / initial state nucleus,
289 // or 0 if it does not exist.
290 
291  int ipos = this->TargetNucleusPosition();
292  if(ipos>-1) return this->Particle(ipos);
293  return 0;
294 }
295 //___________________________________________________________________________
297 {
298 // Returns the GHepParticle representing the remnant nucleus,
299 // or 0 if it does not exist.
300 
301  int ipos = this->RemnantNucleusPosition();
302  if(ipos>-1) return this->Particle(ipos);
303  return 0;
304 }
305 //___________________________________________________________________________
307 {
308 // Returns the GHepParticle representing the struck nucleon, or 0 if it does
309 // not exist.
310 
311  int ipos = this->HitNucleonPosition();
312  if(ipos>-1) return this->Particle(ipos);
313  return 0;
314 }
315 //___________________________________________________________________________
317 {
318 // Returns the GHepParticle representing the struck electron, or 0 if it does
319 // not exist.
320 
321  int ipos = this->HitElectronPosition();
322  if(ipos>-1) return this->Particle(ipos);
323  return 0;
324 }
325 //___________________________________________________________________________
327 {
328 // Returns the GHepParticle representing the final state primary lepton.
329 
330  int ipos = this->FinalStatePrimaryLeptonPosition();
331  if(ipos>-1) return this->Particle(ipos);
332  return 0;
333 }
334 //___________________________________________________________________________
336 {
337 // Returns the GHepParticle representing the sum of the DIS pre-fragm f/s
338 // hadronic system, or 0 if it does not exist.
339 
340  int ipos = this->FinalStateHadronicSystemPosition();
341  if(ipos>-1) return this->Particle(ipos);
342  return 0;
343 }
344 //___________________________________________________________________________
346 {
347 // Returns the GHEP position of the GHepParticle representing the probe
348 // (neutrino, e,...).
349 
350  // The probe is *always* at slot 0.
351  GEvGenMode_t mode = this->EventGenerationMode();
352  if(mode == kGMdLeptonNucleus ||
353  mode == kGMdDarkMatterNucleus ||
354  mode == kGMdHadronNucleus ||
355  mode == kGMdPhotonNucleus)
356  {
357  return 0;
358  }
359  return -1;
360 }
361 //___________________________________________________________________________
363 {
364 // Returns the GHEP position of the GHepParticle representing the target
365 // nucleus - or -1 if the interaction takes place at a free nucleon.
366 
367  GEvGenMode_t mode = this->EventGenerationMode();
368 
369  if(mode == kGMdLeptonNucleus ||
370  mode == kGMdDarkMatterNucleus ||
371  mode == kGMdHadronNucleus ||
372  mode == kGMdPhotonNucleus)
373  {
374  GHepParticle * p = this->Particle(1); // If exists, it will be at slot 1
375  if(!p) return -1;
376  int pdgc = p->Pdg();
377  if(pdg::IsIon(pdgc) && p->Status()==kIStInitialState) return 1;
378  }
379  if(mode == kGMdNucleonDecay) {
380  GHepParticle * p = this->Particle(0); // If exists, it will be at slot 0
381  if(!p) return -1;
382  int pdgc = p->Pdg();
383  if(pdg::IsIon(pdgc) && p->Status()==kIStInitialState) return 0;
384  }
385 
386  return -1;
387 }
388 //___________________________________________________________________________
390 {
391 // Returns the GHEP position of the GHepParticle representing the remnant
392 // nucleus - or -1 if the interaction takes place at a free nucleon.
393 
394  GHepParticle * p = this->TargetNucleus();
395  if(!p) return -1;
396 
397  int dau1 = p->FirstDaughter();
398  int dau2 = p->LastDaughter();
399 
400  if(dau1==-1 && dau2==-1) return -1;
401 
402  for(int i=dau1; i<=dau2; i++) {
403  GHepParticle * dp = this->Particle(i);
404  int dpdgc = dp->Pdg();
405  if(pdg::IsIon(dpdgc) && dp->Status()==kIStStableFinalState) return i;
406  }
407  return -1;
408 }
409 //___________________________________________________________________________
411 {
412 // Returns the GHEP position of the GHepParticle representing the hit nucleon.
413 // If a struck nucleon is set it will be at slot 2 (for scattering off nuclear
414 // targets) or at slot 1 (for free nucleon scattering).
415 // If the struck nucleon is not set (eg coherent scattering, ve- scattering)
416 // it returns 0.
417 
418  GHepParticle * nucleus = this->TargetNucleus();
419 
420  int ipos = (nucleus) ? 2 : 1;
421  GHepStatus_t ist = (nucleus) ? kIStNucleonTarget : kIStInitialState;
422 
423  GHepParticle * p = this->Particle(ipos);
424  if(!p) return -1;
425 
426 // bool isN = pdg::IsNeutronOrProton(p->Pdg());
427  bool isN = pdg::IsNucleon(p->Pdg()) || pdg::Is2NucleonCluster(p->Pdg());
428  if(isN && p->Status()==ist) return ipos;
429 
430  return -1;
431 }
432 //___________________________________________________________________________
434 {
435 // Returns the GHEP position of the GHepParticle representing a hit electron.
436 // Same as above..
437 
438  GHepParticle * nucleus = this->TargetNucleus();
439 
440  int ipos = (nucleus) ? 2 : 1;
441 
442  GHepParticle * p = this->Particle(ipos);
443  if(!p) return -1;
444 
445  bool ise = pdg::IsElectron(p->Pdg());
446  if(ise && p->Status()==kIStInitialState) return ipos;
447 
448  return -1;
449 }
450 //___________________________________________________________________________
452 {
453 // Returns the GHEP position GHepParticle representing the final state
454 // primary lepton.
455 
456  GHepParticle * probe = this->Probe();
457  if(!probe) return -1;
458 
459  int ifsl = probe->FirstDaughter();
460  return ifsl;
461 }
462 //___________________________________________________________________________
464 {
465  return this->ParticlePosition(
467 }
468 //___________________________________________________________________________
469 unsigned int GHepRecord::NEntries(int pdg, GHepStatus_t ist, int start) const
470 {
471  unsigned int nentries = 0;
472 
473  for(int i = start; i < this->GetEntries(); i++) {
474  GHepParticle * p = (GHepParticle *) (*this)[i];
475  if(p->Pdg()==pdg && p->Status()==ist) nentries++;
476  }
477  return nentries;
478 }
479 //___________________________________________________________________________
480 unsigned int GHepRecord::NEntries(int pdg, int start) const
481 {
482  unsigned int nentries = 0;
483 
484  for(int i = start; i < this->GetEntries(); i++) {
485  GHepParticle * p = (GHepParticle *) (*this)[i];
486  if(p->Pdg()==pdg) nentries++;
487  }
488  return nentries;
489 }
490 //___________________________________________________________________________
492 {
493 // Provides a simplified method for inserting entries in the TClonesArray
494 
495  unsigned int pos = this->GetEntries();
496 
497 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
498  LOG("GHEP", pINFO)
499  << "Adding particle with pdgc = " << p.Pdg() << " at slot = " << pos;
500 #endif
501  new ((*this)[pos]) GHepParticle(p);
502 
503  // Update the mother's daughter list. If the newly inserted particle broke
504  // compactification, then run CompactifyDaughterLists()
505  this->UpdateDaughterLists();
506 }
507 //___________________________________________________________________________
509  int pdg, GHepStatus_t status, int mom1, int mom2, int dau1, int dau2,
510  const TLorentzVector & p, const TLorentzVector & v)
511 {
512 // Provides a 'simplified' method for inserting entries in the TClonesArray
513 
514  unsigned int pos = this->GetEntries();
515 
516 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
517  LOG("GHEP", pINFO)
518  << "Adding particle with pdgc = " << pdg << " at slot = " << pos;
519 #endif
520  new ((*this)[pos]) GHepParticle(pdg,status, mom1,mom2,dau1,dau2, p, v);
521 
522  // Update the mother's daughter list. If the newly inserted particle broke
523  // compactification, then run CompactifyDaughterLists()
524  this->UpdateDaughterLists();
525 }
526 //___________________________________________________________________________
528  int pdg, GHepStatus_t status, int mom1, int mom2, int dau1, int dau2,
529  double px, double py, double pz, double E,
530  double x, double y, double z, double t)
531 {
532 // Provides a 'simplified' method for inserting entries in the TClonesArray
533 
534  unsigned int pos = this->GetEntries();
535 
536 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
537  LOG("GHEP", pINFO)
538  << "Adding particle with pdgc = " << pdg << " at slot = " << pos;
539 #endif
540  new ( (*this)[pos] ) GHepParticle (
541  pdg, status, mom1, mom2, dau1, dau2, px, py, pz, E, x, y, z, t);
542 
543  // Update the mother's daughter list. If the newly inserted particle broke
544  // compactification, then run CompactifyDaughterLists()
545  this->UpdateDaughterLists();
546 }
547 //___________________________________________________________________________
549 {
550  int pos = this->GetEntries() - 1; // position of last entry
551 
552 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
553  LOG("GHEP", pINFO)
554  << "Updating the daughter-list for the mother of particle at: " << pos;
555 #endif
556 
557  GHepParticle * p = this->Particle(pos);
558  assert(p);
559 
560  int mom_pos = p->FirstMother();
561 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
562  LOG("GHEP", pINFO) << "Mother particle is at slot: " << mom_pos;
563 #endif
564  if(mom_pos==-1) return; // may not have mom (eg init state)
565  GHepParticle * mom = this->Particle(mom_pos);
566  if(!mom) return; // may not have mom (eg init state)
567 
568  int dau1 = mom->FirstDaughter();
569  int dau2 = mom->LastDaughter();
570 
571  // handles the case where the daughter list was initially empty
572  if(dau1 == -1) {
573  mom->SetFirstDaughter(pos);
574  mom->SetLastDaughter(pos);
575  #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
576  LOG("GHEP", pINFO)
577  << "Done! Daughter-list is compact: [" << pos << ", " << pos << "]";
578  #endif
579  return;
580  }
581  // handles the case where the new daughter is added at the slot just before
582  // an already compact daughter list
583  if(pos == dau1-1) {
584  mom->SetFirstDaughter(pos);
585  #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
586  LOG("GHEP", pINFO)
587  << "Done! Daughter-list is compact: [" << pos << ", " << dau2 << "]";
588  #endif
589  return;
590  }
591  // handles the case where the new daughter is added at the slot just after
592  // an already compact daughter list
593  if(pos == dau2+1) {
594  mom->SetLastDaughter(pos);
595  #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
596  LOG("GHEP", pINFO)
597  << "Done! Daughter-list is compact: [" << dau1 << ", " << pos << "]";
598  #endif
599  return;
600  }
601 
602  // If you are here, then the last particle insertion broke the daughter
603  // list compactification - Run the compactifier
604  LOG("GHEP", pNOTICE)
605  << "Daughter-list is not compact - Running compactifier";
606  this->CompactifyDaughterLists();
607 }
608 //___________________________________________________________________________
610 {
611  LOG("GHEP", pNOTICE) << "Removing all intermediate particles from GHEP";
612  this->Compress();
613 
614  int i=0;
615  GHepParticle * p = 0;
616 
617  TIter iter(this);
618  while( (p = (GHepParticle *)iter.Next()) ) {
619 
620  if(!p) continue;
621  GHepStatus_t ist = p->Status();
622 
623  bool keep = (ist==kIStInitialState) ||
624  (ist==kIStStableFinalState) || (ist==kIStNucleonTarget);
625  if(keep) {
626  p->SetFirstDaughter(-1);
627  p->SetLastDaughter(-1);
628  p->SetFirstMother(-1);
629  p->SetLastMother(-1);
630  } else {
631  LOG("GHEP", pNOTICE)
632  << "Removing: " << p->Name() << " from slot: " << i;
633  this->RemoveAt(i);
634  }
635  i++;
636  }
637 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
638  LOG("GHEP", pDEBUG) << "Compressing GHEP record to remove empty slots";
639 #endif
640  this->Compress();
641 }
642 //___________________________________________________________________________
644 {
645  int n = this->GetEntries();
646  if(n<1) return;
647 
648  int i = this->Particle(n-1)->FirstMother();
649  if(i<0) return;
650 
651  // for(int i=0; i<n; i++) {
652  bool compact = this->HasCompactDaughterList(i);
653 
654 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
655  LOG("GHEP", pNOTICE)
656  << "Particle's " << i << " daughter list is "
657  << ((compact) ? "compact" : "__not__ compact");
658 #endif
659 
660  if(!compact) {
661  GHepParticle * p = this->Particle(i);
662 
663  int dau1 = p->FirstDaughter();
664  int dau2 = p->LastDaughter();
665  int ndau = dau2-dau1+1;
666  int ndp = dau2+1;
667  if(dau1==-1) {ndau=0;}
668 
669  int curr_pos = n-1;
670  while (curr_pos > ndp) {
671  this->SwapParticles(curr_pos,curr_pos-1);
672  curr_pos--;
673  }
674  if(ndau>0) {
675  this->Particle(i)->SetFirstDaughter(dau1);
676  this->Particle(i)->SetLastDaughter(dau2+1);
677  } else {
678  this->Particle(i)->SetFirstDaughter(-1);
679  this->Particle(i)->SetLastDaughter(-1);
680  }
681  this->FinalizeDaughterLists();
682 
683  } //!compact
684 
685 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
686  LOG("GHEP", pINFO)
687  << "Done ompactifying daughter-list for particle at slot: " << i;
688 #endif
689  // }
690 }
691 //___________________________________________________________________________
693 {
694 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
695  LOG("GHEP", pDEBUG) << "Examining daughter-list of particle at: " << pos;
696 #endif
697  vector<int> daughters;
698  GHepParticle * p = 0;
699  TIter iter(this);
700  int i=0;
701  while( (p = (GHepParticle *)iter.Next()) ) {
702  if(p->FirstMother() == pos) {
703 
704 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
705  LOG("GHEP", pDEBUG) << "Particle at: " << i << " is a daughter";
706 #endif
707  daughters.push_back(i);
708  }
709  i++;
710  }
711 
712  bool is_compact = true;
713  if(daughters.size()>1) {
714  sort(daughters.begin(), daughters.end());
715  vector<int>::iterator diter = daughters.begin();
716  int prev = *diter;
717  for(; diter != daughters.end(); ++diter) {
718  int curr = *diter;
719  is_compact = is_compact && (TMath::Abs(prev-curr)<=1);
720  prev = curr;
721  }
722  }
723 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
724  LOG("GHEP", pINFO)
725  << "Daughter-list of particle at: " << pos << " is "
726  << (is_compact ? "" : "not") << " compact";
727 #endif
728  return is_compact;
729 }
730 //___________________________________________________________________________
732 {
733  GHepParticle * p = 0;
734  TIter iter(this);
735  int pos = 0;
736  while( (p = (GHepParticle *)iter.Next()) ) {
737  int ist = p->Status();
738  if(ist != kIStInitialState && ist != kIStNucleonTarget) return pos;
739  pos++;
740  }
741  return pos;
742 }
743 //___________________________________________________________________________
744 void GHepRecord::SwapParticles(int i, int j)
745 {
746 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
747  LOG("GHEP", pINFO) << "Swapping GHepParticles : " << i << " <--> " << j;
748 #endif
749  int n = this->GetEntries();
750  assert(i>=0 && j>=0 && i<n && j<n);
751 
752  if(i==j) return;
753 
754  GHepParticle * pi = this->Particle(i);
755  GHepParticle * pj = this->Particle(j);
756  GHepParticle * tmp = new GHepParticle(*pi);
757 
758  pi->Copy(*pj);
759  pj->Copy(*tmp);
760 
761  delete tmp;
762 
763  // tell their daughters
764  if(pi->HasDaughters()) {
765 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
766  LOG("GHEP", pINFO)
767  << pi->Name() << "(previously at pos: " << j
768  << ") is now at pos: " << i << " -> Notify daughters";
769 #endif
770  for(int k=0; k<n; k++) {
771  if(this->Particle(k)->FirstMother()==j) {
772  this->Particle(k)->SetFirstMother(i);
773  }
774  }
775  }
776 
777  if(pj->HasDaughters()) {
778 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
779  LOG("GHEP", pINFO)
780  << pj->Name() << "(previously at pos: " << i
781  << ") is now at pos: " << j << " -> Notify daughters";
782 #endif
783  for(int k=0; k<n; k++) {
784  if(this->Particle(k)->FirstMother()==i) {
785  this->Particle(k)->SetFirstMother(j);
786  }
787  }
788  }
789 }
790 //___________________________________________________________________________
792 {
793 // Update all daughter-lists based on particle 'first mother' field.
794 // To work correctly, the daughter-lists must have been compactified first.
795 
796  GHepParticle * p1 = 0;
797  TIter iter1(this);
798  int i1=0;
799  while( (p1 = (GHepParticle *)iter1.Next()) ) {
800  int dau1 = -1;
801  int dau2 = -1;
802  GHepParticle * p2 = 0;
803  TIter iter2(this);
804  int i2=0;
805  while( (p2 = (GHepParticle *)iter2.Next()) ) {
806 
807  if(p2->FirstMother() == i1) {
808  dau1 = (dau1<0) ? i2 : TMath::Min(dau1,i2);
809  dau2 = (dau2<0) ? i2 : TMath::Max(dau2,i2);
810  }
811  i2++;
812  }
813  i1++;
814  p1 -> SetFirstDaughter (dau1);
815  p1 -> SetLastDaughter (dau2);
816  }
817 }
818 //___________________________________________________________________________
819 void GHepRecord::SetVertex(double x, double y, double z, double t)
820 {
821  fVtx->SetXYZT(x,y,z,t);
822 }
823 //___________________________________________________________________________
824 void GHepRecord::SetVertex(const TLorentzVector & vtx)
825 {
826  fVtx->SetXYZT(vtx.X(),vtx.Y(),vtx.Z(),vtx.T());
827 }
828 //___________________________________________________________________________
830 {
831 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
832  LOG("GHEP", pDEBUG) << "Initializing GHepRecord";
833 #endif
834  fInteraction = 0;
835  fWeight = 1.;
836  fProb = 1.;
837  fXSec = 0.;
838  fDiffXSec = 0.;
840  fVtx = new TLorentzVector(0,0,0,0);
841 
842  fEventFlags = new TBits(GHepFlags::NFlags());
843  fEventFlags -> ResetAllBits(false);
844 
845  fEventMask = new TBits(GHepFlags::NFlags());
846 //fEventMask -> ResetAllBits(true);
847  for(unsigned int i = 0; i < GHepFlags::NFlags(); i++) {
848  fEventMask->SetBitNumber(i, true);
849  }
850 
851  LOG("GHEP", pINFO)
852  << "Initialised unphysical event mask (bits: " << GHepFlags::NFlags() - 1
853  << " -> 0) : " << *fEventMask;
854 
855  this->SetOwner(true);
856 }
857 //___________________________________________________________________________
859 {
860 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
861  LOG("GHEP", pDEBUG) << "Cleaning up GHepRecord";
862 #endif
863  this->Clear("C");
864 }
865 //___________________________________________________________________________
867 {
868 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
869  LOG("GHEP", pDEBUG) << "Reseting GHepRecord";
870 #endif
871  this->CleanRecord();
872  this->InitRecord();
873 }
874 //___________________________________________________________________________
875 void GHepRecord::Clear(Option_t * opt)
876 {
877  if (fInteraction) delete fInteraction;
878  fInteraction=0;
879 
880  if (fVtx) delete fVtx;
881  fVtx=0;
882 
883  if(fEventFlags) delete fEventFlags;
884  fEventFlags=0;
885 
886  if(fEventMask) delete fEventMask;
887  fEventMask=0;
888 
889  TClonesArray::Clear(opt);
890 
891 // if (fInteraction) delete fInteraction;
892 // delete fVtx;
893 //
894 // delete fEventFlags;
895 //
896 // TClonesArray::Clear(opt);
897 }
898 //___________________________________________________________________________
899 void GHepRecord::Copy(const GHepRecord & record)
900 {
901  // clean up
902  this->ResetRecord();
903 
904  // copy event record entries
905  unsigned int ientry = 0;
906  GHepParticle * p = 0;
907  TIter ghepiter(&record);
908  while ( (p = (GHepParticle *) ghepiter.Next()) )
909  new ( (*this)[ientry++] ) GHepParticle(*p);
910 
911  // copy summary
912  fInteraction = new Interaction( *record.fInteraction );
913 
914  // copy flags & mask
915  *fEventFlags = *(record.EventFlags());
916  *fEventMask = *(record.EventMask());
917 
918  // copy vtx position
919  TLorentzVector * v = record.Vertex();
920  fVtx->SetXYZT(v->X(),v->Y(),v->Z(),v->T());
921 
922  // copy weights & xsecs
923  fWeight = record.fWeight;
924  fProb = record.fProb;
925  fXSec = record.fXSec;
926  fDiffXSec = record.fDiffXSec;
927  fDiffXSecPhSp = record.fDiffXSecPhSp;
928 }
929 //___________________________________________________________________________
931 {
932  *fEventMask = mask;
933 
934  LOG("GHEP", pINFO)
935  << "Setting unphysical event mask (bits: " << GHepFlags::NFlags() - 1
936  << " -> 0) : " << *fEventMask;
937 }
938 //___________________________________________________________________________
939 bool GHepRecord::Accept(void) const
940 {
941  TBits flags = *fEventFlags;
942  TBits mask = *fEventMask;
943  TBits bitwiseand = flags & mask;
944  bool accept = (bitwiseand.CountBits() == 0);
945  return accept;
946 }
947 //___________________________________________________________________________
948 void GHepRecord::SetPrintLevel(int print_level)
949 {
950  fPrintLevel = print_level;
951 }
953 {
954  return fPrintLevel;
955 }
956 //___________________________________________________________________________
957 void GHepRecord::Print(ostream & stream) const
958 {
959  // Print levels:
960  // 0 -> prints particle list
961  // 1 -> prints particle list + event flags
962  // 2 -> prints particle list + event flags + wght/xsec
963  // 3 -> prints particle list + event flags + wght/xsec + summary
964  // 10 -> as in level 0 but showing particle positions too
965  // 11 -> as in level 1 but showing particle positions too
966  // 12 -> as in level 2 but showing particle positions too
967  // 13 -> as in level 3 but showing particle positions too
968 
969  bool accept_input_print_level =
970  (fPrintLevel >= 0 && fPrintLevel <= 3) ||
971  (fPrintLevel >=10 && fPrintLevel <=13);
972 
973  int printlevel = (accept_input_print_level) ? fPrintLevel : 3;
974  int printlevel_orig = printlevel;
975 
976  bool showpos = false;
977  if(printlevel >= 10) {
978  printlevel-=10;
979  showpos=true;
980  }
981 
982  stream << "\n\n|";
983  stream << setfill('-') << setw(115) << "|";
984 
985  stream << "\n|GENIE GHEP Event Record [print level: "
986  << setfill(' ') << setw(3) << printlevel_orig << "]"
987  << setfill(' ') << setw(73) << "|";
988 
989  stream << "\n|";
990  stream << setfill('-') << setw(115) << "|";
991 
992  stream << "\n| ";
993  stream << setfill(' ') << setw(6) << "Idx | "
994  << setfill(' ') << setw(16) << "Name | "
995  << setfill(' ') << setw(6) << "Ist | "
996  << setfill(' ') << setw(13) << "PDG | "
997  << setfill(' ') << setw(12) << "Mother | "
998  << setfill(' ') << setw(12) << "Daughter | "
999  << setfill(' ') << setw(10) << ((showpos) ? "Px(x) |" : "Px | ")
1000  << setfill(' ') << setw(10) << ((showpos) ? "Py(y) |" : "Py | ")
1001  << setfill(' ') << setw(10) << ((showpos) ? "Pz(z) |" : "Pz | ")
1002  << setfill(' ') << setw(10) << ((showpos) ? "E(t) |" : "E | ")
1003  << setfill(' ') << setw(10) << "m | ";
1004 
1005  stream << "\n|";
1006  stream << setfill('-') << setw(115) << "|";
1007 
1008  GHepParticle * p = 0;
1009  TObjArrayIter piter(this);
1010  TVector3 polarization(0,0,0);
1011 
1012  unsigned int idx = 0;
1013 
1014  double sum_E = 0;
1015  double sum_px = 0;
1016  double sum_py = 0;
1017  double sum_pz = 0;
1018 
1019  while( (p = (GHepParticle *) piter.Next()) ) {
1020 
1021  stream << "\n| ";
1022  stream << setfill(' ') << setw(3) << idx++ << " | ";
1023  stream << setfill(' ') << setw(13) << p->Name() << " | ";
1024  stream << setfill(' ') << setw(3) << p->Status() << " | ";
1025  stream << setfill(' ') << setw(10) << p->Pdg() << " | ";
1026  stream << setfill(' ') << setw(3) << p->FirstMother() << " | ";
1027  stream << setfill(' ') << setw(3) << p->LastMother() << " | ";
1028  stream << setfill(' ') << setw(3) << p->FirstDaughter() << " | ";
1029  stream << setfill(' ') << setw(3) << p->LastDaughter() << " | ";
1030  stream << std::fixed << setprecision(3);
1031  stream << setfill(' ') << setw(7) << p->Px() << " | ";
1032  stream << setfill(' ') << setw(7) << p->Py() << " | ";
1033  stream << setfill(' ') << setw(7) << p->Pz() << " | ";
1034  stream << setfill(' ') << setw(7) << p->E() << " | ";
1035 
1036  if (p->IsOnMassShell())
1037  stream << setfill(' ') << setw(7) << p->Mass() << " | ";
1038  else
1039  stream << setfill('*') << setw(7) << p->Mass() << " | M = "
1040  << p->P4()->M() << " ";
1041 
1042  if (p->PolzIsSet()) {
1043  p->GetPolarization(polarization);
1044  stream << "P = (" << polarization.x() << "," << polarization.y()
1045  << "," << polarization.z() << ")";
1046  }
1047 
1048  if (p->RescatterCode() != -1) {
1049  stream << "FSI = " << p->RescatterCode();
1050  }
1051 
1052  // plot particle position if requested
1053  if(showpos) {
1054  stream << "\n| ";
1055  stream << setfill(' ') << setw(6) << " | ";
1056  stream << setfill(' ') << setw(16) << " | ";
1057  stream << setfill(' ') << setw(6) << " | ";
1058  stream << setfill(' ') << setw(13) << " | ";
1059  stream << setfill(' ') << setw(6) << " | ";
1060  stream << setfill(' ') << setw(6) << " | ";
1061  stream << setfill(' ') << setw(6) << " | ";
1062  stream << setfill(' ') << setw(6) << " | ";
1063  stream << std::fixed << setprecision(3);
1064  stream << setfill(' ') << setw(7) << p->Vx() << " | ";
1065  stream << setfill(' ') << setw(7) << p->Vy() << " | ";
1066  stream << setfill(' ') << setw(7) << p->Vz() << " | ";
1067  stream << setfill(' ') << setw(7) << p->Vt() << " | ";
1068  stream << setfill(' ') << setw(10) << " | ";
1069  }
1070 
1071  // compute P4_{final} - P4_{nitial}
1072 
1073  if(p->Status() == kIStStableFinalState ||
1075 
1076  sum_E += p->E();
1077  sum_px += p->Px();
1078  sum_py += p->Py();
1079  sum_pz += p->Pz();
1080  } else
1081  if(p->Status() == kIStInitialState) {
1082  /*
1083  if(p->Status() == kIStInitialState || p->Status() == kIStNucleonTarget) {
1084  */
1085  sum_E -= p->E();
1086  sum_px -= p->Px();
1087  sum_py -= p->Py();
1088  sum_pz -= p->Pz();
1089  }
1090 
1091  } // loop over particles
1092 
1093  stream << "\n|";
1094  stream << setfill('-') << setw(115) << "|";
1095 
1096  // Print SUMS
1097  stream << "\n| ";
1098  stream << setfill(' ') << setw(17) << "Fin-Init: "
1099  << setfill(' ') << setw(6) << " "
1100  << setfill(' ') << setw(18) << " "
1101  << setfill(' ') << setw(12) << " "
1102  << setfill(' ') << setw(12) << " | ";
1103  stream << std::fixed << setprecision(3);
1104  stream << setfill(' ') << setw(7) << sum_px << " | ";
1105  stream << setfill(' ') << setw(7) << sum_py << " | ";
1106  stream << setfill(' ') << setw(7) << sum_pz << " | ";
1107  stream << setfill(' ') << setw(7) << sum_E << " | ";
1108  stream << setfill(' ') << setw(10) << " | ";
1109 
1110  stream << "\n|";
1111  stream << setfill('-') << setw(115) << "|";
1112 
1113  // Print vertex
1114 
1115  GHepParticle * probe = this->Probe();
1116  if(probe){
1117  stream << "\n| ";
1118  stream << setfill(' ') << setw(17) << "Vertex: ";
1119  stream << setfill(' ') << setw(11)
1120  << ((probe) ? probe->Name() : "unknown probe") << " @ (";
1121 
1122  stream << std::fixed << setprecision(5);
1123  stream << "x = " << setfill(' ') << setw(11) << this->Vertex()->X() << " m, ";
1124  stream << "y = " << setfill(' ') << setw(11) << this->Vertex()->Y() << " m, ";
1125  stream << "z = " << setfill(' ') << setw(11) << this->Vertex()->Z() << " m, ";
1126  stream << std::scientific << setprecision(6);
1127  stream << "t = " << setfill(' ') << setw(15) << this->Vertex()->T() << " s) ";
1128  stream << std::fixed << setprecision(3);
1129  stream << setfill(' ') << setw(2) << "|";
1130 
1131  stream << "\n|";
1132  stream << setfill('-') << setw(115) << "|";
1133  }
1134 
1135  // Print FLAGS
1136 
1137  if(printlevel>=1) {
1138  stream << "\n| ";
1139  stream << "Err flag [bits:" << fEventFlags->GetNbits()-1 << "->0] : "
1140  << *fEventFlags << " | "
1141  << "1st set: " << setfill(' ') << setw(56)
1142  << ( this->IsUnphysical() ?
1143  GHepFlags::Describe(GHepFlag_t(fEventFlags->FirstSetBit())) :
1144  "none") << " | ";
1145  stream << "\n| ";
1146  stream << "Err mask [bits:" << fEventMask->GetNbits()-1 << "->0] : "
1147  << *fEventMask << " | "
1148  << "Is unphysical: " << setfill(' ') << setw(5)
1149  << utils::print::BoolAsYNString(this->IsUnphysical()) << " | "
1150  << "Accepted: " << setfill(' ') << setw(5)
1152  << " |";
1153  stream << "\n|";
1154  stream << setfill('-') << setw(115) << "|";
1155  }
1156 
1157  if(printlevel>=2) {
1158  stream << "\n| ";
1159  stream << std::scientific << setprecision(5);
1160 
1161  stream << "sig(Ev) = "
1162  << setfill(' ') << setw(17) << fXSec/units::cm2
1163  << " cm^2 |";
1164 
1165  switch(fDiffXSecPhSp) {
1166  case ( kPSyfE ) :
1167  stream << " dsig(y;E)/dy = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2 |";
1168  break;
1169  case ( kPSxyfE ) :
1170  stream << " d2sig(x,y;E)/dxdy = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2 |";
1171  break;
1172  case ( kPSxytfE ) :
1173  stream << " d3sig(x,y,t;E)/dxdydt = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2/GeV^2 |";
1174  break;
1175  case ( kPSQ2fE ) :
1176  stream << " dsig(Q2;E)/dQ2 = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2/GeV^2 |";
1177  break;
1178  case ( kPSQ2vfE ) :
1179  stream << " dsig(Q2,v;E)/dQ2dv = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2/GeV^3 |";
1180  break;
1181  case ( kPSWQ2fE ) :
1182  stream << " d2sig(W,Q2;E)/dWdQ2 = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2/GeV^3 |";
1183  break;
1184  default :
1185  stream << " dsig(Ev;{K_s})/dK = " << setfill(' ') << setw(13) << fDiffXSec/units::cm2 << " cm^2/{K} |";
1186  }
1187  stream << " Weight = "
1188  << setfill(' ') << setw(16)
1189  << std::fixed << setprecision(5)
1190  << fWeight
1191  << " |";
1192 
1193  stream << "\n|";
1194  stream << setfill('-') << setw(115) << "|";
1195  }
1196 
1197  stream << "\n";
1198  stream << setfill(' ');
1199 
1200  if(printlevel==3) {
1201  if(fInteraction) stream << *fInteraction;
1202  else stream << "NULL Interaction!" << endl;
1203  }
1204  stream << "\n";
1205 }
1206 //___________________________________________________________________________
intermediate_table::iterator iterator
static void SetPrintLevel(int print_level)
Definition: GHepRecord.cxx:948
void SetFirstMother(int m)
Definition: GHepParticle.h:132
int RescatterCode(void) const
Definition: GHepParticle.h:65
virtual GHepParticle * Particle(int position) const
Definition: GHepRecord.cxx:104
virtual int ParticlePosition(int pdg, GHepStatus_t i, int start=0) const
Definition: GHepRecord.cxx:137
rec
Definition: tracks.py:88
virtual void Copy(const GHepRecord &record)
Definition: GHepRecord.cxx:899
virtual void UpdateDaughterLists(void)
Definition: GHepRecord.cxx:548
double fProb
event probability (for given flux neutrino and density-weighted path-length for target element) ...
Definition: GHepRecord.h:179
void Print(ostream &stream) const
Definition: GHepRecord.cxx:957
bool IsOnMassShell(void) const
virtual void SwapParticles(int i, int j)
Definition: GHepRecord.cxx:744
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
double E(void) const
Get energy.
Definition: GHepParticle.h:91
virtual GHepParticle * HitElectron(void) const
Definition: GHepRecord.cxx:316
virtual Interaction * Summary(void) const
Definition: GHepRecord.cxx:91
virtual GHepParticle * FindParticle(int pdg, GHepStatus_t ist, int start) const
Definition: GHepRecord.cxx:118
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:78
int FirstDaughter(void) const
Definition: GHepParticle.h:68
bool IsNucleon(int pdgc)
Definition: PDGUtils.cxx:343
virtual int RemnantNucleusPosition(void) const
Definition: GHepRecord.cxx:389
string BoolAsYNString(bool b)
Definition: PrintUtils.cxx:108
enum genie::EGHepFlag GHepFlag_t
opt
Definition: train.py:196
virtual void RemoveIntermediateParticles(void)
Definition: GHepRecord.cxx:609
void InitRecord(void)
Definition: GHepRecord.cxx:829
virtual void FinalizeDaughterLists(void)
Definition: GHepRecord.cxx:791
TLorentzVector * fVtx
vertex in the detector coordinate system
Definition: GHepRecord.h:171
virtual int HitNucleonPosition(void) const
Definition: GHepRecord.cxx:410
bool IsDarkMatter(int pdgc)
Definition: PDGUtils.cxx:124
TBits * fEventMask
an input bit-field mask allowing one to ignore bits set in fEventFlags
Definition: GHepRecord.h:175
virtual unsigned int NEntries(int pdg, GHepStatus_t ist, int start=0) const
Definition: GHepRecord.cxx:469
double Mass(void) const
Mass that corresponds to the PDG code.
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
static const char * Describe(GHepFlag_t flag)
Definition: GHepFlags.h:42
GHepStatus_t Status(void) const
Definition: GHepParticle.h:64
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
virtual void AttachSummary(Interaction *interaction)
Definition: GHepRecord.cxx:99
virtual ~GHepRecord()
Definition: GHepRecord.cxx:86
virtual TLorentzVector * Vertex(void) const
Definition: GHepRecord.h:140
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
bool Compare(const GHepParticle *p) const
virtual GHepParticle * Probe(void) const
Definition: GHepRecord.cxx:277
int LastMother(void) const
Definition: GHepParticle.h:67
double Vt(void) const
Get production time.
Definition: GHepParticle.h:97
int Pdg(void) const
Definition: GHepParticle.h:63
int FirstMother(void) const
Definition: GHepParticle.h:66
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
string Name(void) const
Name that corresponds to the PDG code.
bool IsHadron(int pdgc)
Definition: PDGUtils.cxx:389
Enumeration of GENIE event generation modes.
double fXSec
cross section for selected event
Definition: GHepRecord.h:180
Summary information for an interaction.
Definition: Interaction.h:56
Interaction * fInteraction
attached summary information
Definition: GHepRecord.h:168
int LastDaughter(void) const
Definition: GHepParticle.h:69
TBits * fEventFlags
event flags indicating various pathologies or an unphysical event
Definition: GHepRecord.h:174
static unsigned int NFlags(void)
Definition: GHepFlags.h:76
virtual bool Accept(void) const
Definition: GHepRecord.cxx:939
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
void SetLastDaughter(int d)
Definition: GHepParticle.h:135
bool IsAntiDarkMatter(int pdgc)
Definition: PDGUtils.cxx:130
static constexpr double cm2
Definition: Units.h:69
bool HasDaughters(void) const
Definition: GHepParticle.h:70
std::void_t< T > n
virtual bool HasCompactDaughterList(int pos)
Definition: GHepRecord.cxx:692
void Copy(const GHepParticle &particle)
const int kPdgGamma
Definition: PDGCodes.h:189
virtual int FirstNonInitStateEntry(void)
Definition: GHepRecord.cxx:731
virtual GHepParticle * FinalStatePrimaryLepton(void) const
Definition: GHepRecord.cxx:326
size_t size
Definition: lodepng.cpp:55
GEvGenMode_t EventGenerationMode(void) const
Definition: GHepRecord.cxx:209
static int GetPrintLevel()
Definition: GHepRecord.cxx:952
p
Definition: test.py:223
virtual GHepParticle * TargetNucleus(void) const
Definition: GHepRecord.cxx:286
virtual vector< int > * GetStableDescendants(int position) const
Definition: GHepRecord.cxx:174
#define pINFO
Definition: Messenger.h:62
string tmp
Definition: languages.py:63
virtual void ResetRecord(void)
Definition: GHepRecord.cxx:866
virtual int HitElectronPosition(void) const
Definition: GHepRecord.cxx:433
virtual GHepParticle * FinalStateHadronicSystem(void) const
Definition: GHepRecord.cxx:335
bool PolzIsSet(void) const
#define pWARN
Definition: Messenger.h:60
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
void GetPolarization(TVector3 &polz)
bool Is2NucleonCluster(int pdgc)
Definition: PDGUtils.cxx:399
virtual void CompactifyDaughterLists(void)
Definition: GHepRecord.cxx:643
ClassImp(EDep::TEventChangeManager) namespace
virtual TBits * EventFlags(void) const
Definition: GHepRecord.h:117
void SetLastMother(int m)
Definition: GHepParticle.h:133
bool IsIon(int pdgc)
Definition: PDGUtils.cxx:39
virtual bool IsUnphysical(void) const
Definition: GHepRecord.h:119
double Vz(void) const
Get production z.
Definition: GHepParticle.h:96
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
virtual void Clear(Option_t *opt="")
Definition: GHepRecord.cxx:875
virtual GHepParticle * HitNucleon(void) const
Definition: GHepRecord.cxx:306
virtual void SetVertex(double x, double y, double z, double t)
Definition: GHepRecord.cxx:819
KinePhaseSpace_t fDiffXSecPhSp
specifies which differential cross-section (dsig/dQ2, dsig/dQ2dW, dsig/dxdy,...)
Definition: GHepRecord.h:182
virtual GHepParticle * RemnantNucleus(void) const
Definition: GHepRecord.cxx:296
virtual void AddParticle(const GHepParticle &p)
Definition: GHepRecord.cxx:491
list x
Definition: train.py:276
float pi
Definition: units.py:11
double Vy(void) const
Get production y.
Definition: GHepParticle.h:95
#define pNOTICE
Definition: Messenger.h:61
double fWeight
event weight
Definition: GHepRecord.h:178
virtual int ProbePosition(void) const
Definition: GHepRecord.cxx:345
void SetFirstDaughter(int d)
Definition: GHepParticle.h:134
void Compress(gar::raw::ADCvector_t &adc, gar::raw::Compress_t compress)
In-place compression of raw data buffer.
Definition: raw.cxx:23
const int kPdgHadronicSyst
Definition: PDGCodes.h:210
void SetUnphysEventMask(const TBits &mask)
Definition: GHepRecord.cxx:930
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:45
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
Q_EXPORT QTSManip setfill(int f)
Definition: qtextstream.h:337
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
virtual int FinalStateHadronicSystemPosition(void) const
Definition: GHepRecord.cxx:463
double fDiffXSec
differential cross section for selected event kinematics
Definition: GHepRecord.h:181
bool IsLepton(int pdgc)
Definition: PDGUtils.cxx:83
virtual int FinalStatePrimaryLeptonPosition(void) const
Definition: GHepRecord.cxx:451
virtual int TargetNucleusPosition(void) const
Definition: GHepRecord.cxx:362
static int fPrintLevel
Definition: GHepRecord.h:196
bool IsElectron(int pdgc)
Definition: PDGUtils.cxx:185
QTextStream & endl(QTextStream &s)
enum genie::EGHepStatus GHepStatus_t
virtual TBits * EventMask(void) const
Definition: GHepRecord.h:118
double Vx(void) const
Get production x.
Definition: GHepParticle.h:94
#define pDEBUG
Definition: Messenger.h:63
void CleanRecord(void)
Definition: GHepRecord.cxx:858
double Py(void) const
Get Py.
Definition: GHepParticle.h:89