Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eta_ntuple/Event.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: Event.cc
4 // Created: Tue Oct 13 09:55:12 EDT 2009
5 // Creator: davidl (on Darwin harriet.jlab.org 9.8.0 i386)
6 //
7 
8 #include <iostream>
9 using namespace std;
10 
11 #include <TVector2.h>
12 
13 #include "Event.h"
14 
15 #ifndef _DBG_
16 #define _DBG_ cerr<<__FILE__<<":"<<__LINE__<<" "
17 #define _DBG__ _DBG_<<endl
18 #endif
19 
20 //------------------
21 // Event (Constructor)
22 //------------------
24  fcal = new TClonesArray("fcal_t",100);
25  bcal = new TClonesArray("bcal_t",100);
26  sc = new TClonesArray("sc_t",100);
27 }
28 
29 //------------------
30 // Clear
31 //------------------
32 void Event::Clear(void)
33 {
34  beam.SetXYZT(0.0, 0.0, 0.0, 0.0);
35  proton_thrown.SetXYZT(0.0, 0.0, 0.0, 0.0);
36  eta_thrown.SetXYZT(0.0, 0.0, 0.0, 0.0);
37  eta_best.SetXYZT(0.0, 0.0, 0.0, 0.0);
38  vertex.SetXYZ(0.0, 0.0, 65.0);
39  prod_mech = 0;
40  decay_mode = 0;
41  fcal->Clear(); // delete entries in TClonesArray (without freeing memory)
42  Nfcal = 0;
43  t = -1000000.0;
44  Nstart = 0;
45  sc->Clear(); // delete entries in TClonesArray (without freeing memory)
46  E_bcal_tot = 0.0;
47  Nbcal = 0;
48  bcal->Clear(); // delete entries in TClonesArray (without freeing memory)
49 }
50 
51 //------------------
52 // AddFCAL
53 //------------------
54 void Event::AddFCAL(TLorentzVector &p, TVector3 &x)
55 {
56  TClonesArray &fcals = *this->fcal;
57  fcal_t *fcal = new(fcals[Nfcal++]) fcal_t();
58 
59  fcal->p = p;
60  fcal->x = x;
61 }
62 
63 //------------------
64 // AddBCAL
65 //------------------
66 void Event::AddBCAL(TLorentzVector &p)
67 {
68  TClonesArray &bcals = *this->bcal;
69  bcal_t *bcal = new(bcals[Nbcal++]) bcal_t();
70 
71  bcal->p = p;
72 }
73 
74 //------------------
75 // AddSC
76 //------------------
77 void Event::AddSC(int sector)
78 {
79  TClonesArray &scs = *this->sc;
80  sc_t *sc = new(scs[Nstart++]) sc_t();
81 
82  sc->phi_center = (float)(sector-1)*2.0*M_PI/40.0;
83 
84  // Phi angle difference
85  float phi_eta = eta_best.Phi();
86  TVector2 v1(cos(sc->phi_center), sin(sc->phi_center));
87  TVector2 v2(cos(phi_eta), sin(phi_eta));
88  sc->phi_diff = v1.DeltaPhi(v2);
89  if(sc->phi_diff<0.0)sc->phi_diff+=2.0*M_PI;
90 }
91 
float phi_diff
Definition: sc_t.h:25
Double_t x[NCHANNELS]
Definition: st_tw_resols.C:39
void Clear(void)
void AddSC(int sector)
Definition: sc_t.h:19
TLorentzVector p
Definition: fcal_t.h:24
Definition: fcal_t.h:19
Definition: bcal_t.h:19
double sin(double)
void AddBCAL(TLorentzVector &p)
TVector3 x
Definition: fcal_t.h:25
void AddFCAL(TLorentzVector &p, TVector3 &x)
float phi_center
Definition: sc_t.h:24
TLorentzVector p
Definition: bcal_t.h:24