FairRoot/PandaRoot
Functions | Variables
photos_hepevt_example.cxx File Reference
#include "Photos/Photos.h"
#include "Photos/PhotosHEPEVTParticle.h"
#include "Photos/PhotosHEPEVTEvent.h"

Go to the source code of this file.

Functions

void checkMomentumConservationInEvent (PhotosHEPEVTEvent *evt)
 
PhotosHEPEVTEventmake_simple_tau_event ()
 
int main (void)
 

Variables

int NumberOfEvents = 1000
 
int EventsToCheck = 1000
 

Function Documentation

void checkMomentumConservationInEvent ( PhotosHEPEVTEvent evt)

Definition at line 19 of file photos_hepevt_example.cxx.

References Photospp::PhotosHEPEVTParticle::getE(), Photospp::PhotosHEPEVTEvent::getParticle(), Photospp::PhotosHEPEVTEvent::getParticleCount(), Photospp::PhotosHEPEVTParticle::getPx(), Photospp::PhotosHEPEVTParticle::getPy(), Photospp::PhotosHEPEVTParticle::getPz(), Photospp::PhotosHEPEVTParticle::getStatus(), i, n, p, and pz.

Referenced by main().

20 {
21  int n = evt->getParticleCount();
22  double px=0.0,py=0.0,pz=0.0,e=0.0;
23 
24  for(int i=0;i<n;i++)
25  {
27  if(p->getStatus() != 1) continue;
28 
29  px += p->getPx();
30  py += p->getPy();
31  pz += p->getPz();
32  e += p->getE();
33  }
34 
35  cout.precision(6);
36  cout.setf(ios_base::floatfield);
37  cout<<endl<<"Vector Sum: "<<px<<" "<<py<<" "<<pz<<" "<<e<<endl;
38 }
Int_t i
Definition: run_full.C:25
int n
PhotosHEPEVTParticle * getParticle(int i)
Double_t p
Definition: anasim.C:58
double pz[39]
Definition: pipisigmas.h:14
int main ( void  )

Example of using Photos to process event stored in HEPEVT event record

Definition at line 73 of file photos_hepevt_example.cxx.

References buf, checkMomentumConservationInEvent(), EventsToCheck, chigen::initialize(), make_simple_tau_event(), and NumberOfEvents.

73  {
74 
76 
77  int photonAdded=0,twoAdded=0,moreAdded=0,evtCount=0;
78 
79  // Begin event loop. Generate event.
80  for (int iEvent = 0; iEvent < NumberOfEvents; ++iEvent) {
81 
82  if(iEvent%10000==0) cout<<"Event: "<<iEvent<<"\t("<<iEvent*(100./NumberOfEvents)<<"%)"<<endl;
83 
84  // Create simple event
86 
87  int buf = -event->getParticleCount();
88 
89  //cout << "BEFORE:"<<endl;
90  //event->print();
91 
92  if(iEvent<EventsToCheck)
93  {
94  cout<<" "<<endl;
95  cout<<"Momentum conservation chceck BEFORE/AFTER Photos"<<endl;
97  }
98 
99  event->process();
100 
101  buf += event->getParticleCount();
102  if (buf==1) photonAdded++;
103  else if(buf==2) twoAdded++;
104  else if(buf>2) moreAdded++;
105 
106  if(iEvent<EventsToCheck)
107  {
109  }
110 
111  //cout << "AFTER:"<<endl;
112  //event->print();
113 
114  evtCount++;
115 
116  //clean up
117  delete event;
118  }
119 
120  // Print results
121  cout.precision(3);
122  cout.setf(ios::fixed);
123  cout<<endl;
124  cout<<"Summary of processing simple events: e+ e- -> Z -> tau+ tau-"<<endl;
125  cout<<evtCount <<"\tevents processed"<<endl;
126  cout<<photonAdded<<"\ttimes one photon added to the event \t("<<(photonAdded*100./evtCount)<<"%)"<<endl;
127  cout<<twoAdded <<"\ttimes two photons added to the event \t("<<(twoAdded*100./evtCount)<<"%)"<<endl;
128  cout<<moreAdded <<"\ttimes more than two photons added to the event\t("<<(moreAdded*100./evtCount)<<"%)"<<endl<<endl;
129  cout<<"(Contrary to results from MC-Tester, these values are technical and infrared unstable)"<<endl<<endl;
130 }
PhotosHEPEVTEvent * make_simple_tau_event()
int EventsToCheck
int NumberOfEvents
void initialize()
void checkMomentumConservationInEvent(PhotosHEPEVTEvent *evt)
return buf
PhotosHEPEVTEvent* make_simple_tau_event ( )

Create a simple e+ + e- -> Z -> tau+ tau- HEPEVT event

Definition at line 41 of file photos_hepevt_example.cxx.

References Photospp::PhotosHEPEVTEvent::addParticle(), and evt.

Referenced by main().

41  {
42 
44 
45  const double amell = 0.0005111;
46 
47  // Make PhotosParticles for boosting
48  PhotosHEPEVTParticle *first_e = new PhotosHEPEVTParticle( 11, 6, 1.7763568394002505e-15, -3.5565894425761324e-15, 4.5521681043409913e+01, 4.5521681043409934e+01, amell, -1, -1, 2, 2);
49  PhotosHEPEVTParticle *second_e = new PhotosHEPEVTParticle( -11, 6, -1.7763568394002505e-15, 3.5488352204797800e-15, -4.5584999071936601e+01, 4.5584999071936622e+01, amell, -1, -1, 2, 2);
50  PhotosHEPEVTParticle *intermediate = new PhotosHEPEVTParticle( 23, 5, 0, 0, -6.3318028526687442e-02, 9.1106680115346506e+01, 9.1106658112716090e+01, 0, 1, 3, 4);
51  PhotosHEPEVTParticle *first_tau = new PhotosHEPEVTParticle( 15, 2, -2.3191595992562256e+01, -2.6310500920665142e+01, -2.9046412466624929e+01, 4.5573504956498098e+01, 1.7769900000002097e+00, 2, -1, 5, 6);
52  PhotosHEPEVTParticle *second_tau = new PhotosHEPEVTParticle( -15, 2, 2.3191595992562256e+01, 2.6310500920665142e+01, 2.8983094438098242e+01, 4.5533175158848429e+01, 1.7769900000000818e+00, 2, -1, 7, 8);
53  PhotosHEPEVTParticle *t1d1 = new PhotosHEPEVTParticle( 16, 1, -1.2566536214715378e+00, -1.7970251138317268e+00, -1.3801323581022720e+00, 2.5910119010468553e+00, 9.9872238934040070e-03, 3, -1, -1, -1);
54  PhotosHEPEVTParticle *t1d2 = new PhotosHEPEVTParticle(-211, 1, -2.1935073012334062e+01, -2.4513624017269400e+01, -2.7666443730700312e+01, 4.2982749776866747e+01, 1.3956783711910248e-01, 3, -1, -1, -1);
55  PhotosHEPEVTParticle *t2d1 = new PhotosHEPEVTParticle( -16, 1, 8.4364531743909055e+00, 8.3202830831667836e+00, 9.6202800273055971e+00, 1.5262723881157640e+01, 9.9829332903027534e-03, 4, -1, -1, -1);
56  PhotosHEPEVTParticle *t2d2 = new PhotosHEPEVTParticle( 211, 1, 1.4755273459419701e+01, 1.7990366047940022e+01, 1.9362977676297948e+01, 3.0270707771933196e+01, 1.3956753909587860e-01, 4, -1, -1, -1);
57 
58  // Order matters!
59  evt->addParticle(first_e );
60  evt->addParticle(second_e );
61  evt->addParticle(intermediate);
62  evt->addParticle(first_tau );
63  evt->addParticle(second_tau );
64  evt->addParticle(t1d1 );
65  evt->addParticle(t1d2 );
66  evt->addParticle(t2d1 );
67  evt->addParticle(t2d2 );
68 
69  return evt;
70 }
int evt
Definition: checkhelixhit.C:36
void addParticle(PhotosHEPEVTParticle *p)

Variable Documentation

int EventsToCheck = 1000

Definition at line 17 of file photos_hepevt_example.cxx.

Referenced by main().

int NumberOfEvents = 1000

Definition at line 16 of file photos_hepevt_example.cxx.

Referenced by main().