10 #include <TLorentzVector.h>
15 #include "BCAL/DHDDMBCALHit.h"
32 #define FCAL_Z_OFFSET 640.0-65.0 // I don't know what this value is ???
40 TDirectory *
dir =
new TDirectoryFile(
"BCAL",
"BCAL");
43 two_gamma_mass =
new TH1F(
"two_gamma_mass",
"two_gamma_mass",100, 0.0, 0.300);
44 two_gamma_mass_corr =
new TH1F(
"two_gamma_mass_corr",
"two_gamma_mass_corr",100, 0.0, 0.300);
45 two_gamma_mass_cut =
new TH1F(
"two_gamma_mass_cut",
"two_gamma_mass_cut",100, 0.0, 0.300);
48 xy_shower =
new TH2F(
"xy_shower",
"xy_shower",100, -100.0, 100., 100 , -100.0, 100.0);
49 z_shower =
new TH1F(
"z_shower",
"z_shower",450, -50.0, 400);
50 E_shower =
new TH1F(
"E_shower",
"E_shower", 200, 0.0, 6.0);
52 Erec_over_Ethrown_vs_z =
new TH2F(
"Erec_over_Ethrown_vs_z",
"Erec_over_Ethrown_vs_z", 200, -50.0, 600.0, 200, 0.0, 2.0);
53 Ecorr_over_Erec_vs_z =
new TH2F(
"Ecorr_over_Erec_vs_z",
"Ecorr_over_Erec_vs_z", 200, -50.0, 600.0, 200, 0.0, 4.0);
54 Ereconstructed_vs_Ethrown =
new TH2F(
"Ereconstructed_vs_Ethrown",
"BCAL total reconstructed E to total thrown E", 200, 0.0, 6.0, 200, 0.0, 6.0);
56 Etot_truth =
new TH1F(
"Etot_truth",
"Sum of all truth showers (GeV)", 200, 0.0, 6.0);
57 Etot_hits =
new TH1F(
"Etot_hits",
"Sum of all hits (GeV)", 200, 0.0, 6.0);
58 Etruth_over_Ethrown_vs_z =
new TH2F(
"Etruth_over_Ethrown_vs_z",
"Etruth_over_Ethrown_vs_z", 200, -50.0, 600.0, 200, 0.0, 2.0);
81 vector<const DBCALShower*> showers;
82 vector<const DFCALCluster*> fcal_showers;
83 vector<const DBCALTruthShower*> truthshowers;
84 vector<const DMCThrown*> mcthrowns;
85 vector<const DHDDMBCALHit*> bcalhits;
86 loop->Get(showers,
"KLOE" );
88 loop->Get(truthshowers);
95 double Etot_reconstructed = 0.0;
96 for(
unsigned int i=0; i<showers.size(); i++){
101 Etot_reconstructed += s->Ecorr;
105 for(
unsigned int i=0; i<showers.size(); i++){
109 double dz = s1->
z - 65.0;
110 double R =
sqrt(dx*dx + dy*dy + dz*dz);
111 double E = s1->Ecorr;
112 double Edave = s1->Ecorr*(1.106+(dz+65.0-208.4)*(dz+65.0-208.4)*6.851E-6);
113 TLorentzVector
p1(E*dx/R, E*dy/R, E*dz/R, E);
114 TLorentzVector p1dave(Edave*dx/R, Edave*dy/R, Edave*dz/R, Edave);
116 for(
unsigned int j=i+1; j<showers.size(); j++){
121 R =
sqrt(dx*dx + dy*dy + dz*dz);
122 double E = s2->Ecorr;
123 double Edave = s2->Ecorr*(1.106+(dz+65.0-208.4)*(dz+65.0-208.4)*6.851E-6);
124 TLorentzVector
p2(E*dx/R, E*dy/R, E*dz/R, E);
125 TLorentzVector p2dave(Edave*dx/R, Edave*dy/R, Edave*dz/R, Edave);
127 TLorentzVector ptot = p1+
p2;
129 TLorentzVector ptotdave = p1dave+p2dave;
135 for(
unsigned int j=0; j<fcal_showers.size(); j++){
140 R =
sqrt(dx*dx + dy*dy + dz*dz);
142 TLorentzVector
p2(E*dx/R, E*dy/R, E*dz/R, E);
144 TLorentzVector ptot = p1dave+
p2;
147 if(showers.size()==1 && fcal_showers.size()==1){
155 double Ehit_tot = 0.0;
156 for(
unsigned int i=0; i<bcalhits.size(); i++){
157 Ehit_tot += bcalhits[i]->E;
162 double Etruth_tot = 0.0;
163 double z_truth = 0.0;
164 for(
unsigned int i=0; i<truthshowers.size(); i++){
165 Etruth_tot += truthshowers[i]->E;
166 z_truth += truthshowers[i]->E*truthshowers[i]->z;
172 double Etot_thrown=0.0;
173 for(
unsigned int i=0; i<mcthrowns.size(); i++){
174 Etot_thrown += mcthrowns[i]->energy();
175 for(
unsigned int j=0; j<showers.size(); j++){
176 double z = showers[j]->z;
179 double Ecorr = showers[j]->Ecorr*(1.106+(z-208.4)*(z-208.4)*6.851E-6);
188 if(mcthrowns.size()==1){
189 const DMCThrown* mcthrown = mcthrowns[0];
190 if(mcthrown->
momentum().Theta()>0.0001){
191 double z = mcthrown->
position().Z() + 65.0/tan(mcthrown->
momentum().Theta());
192 double Ethrown = 1.0;
DVector3 getCentroid() const
jerror_t init(void)
Called once at program start.
TH2F * Edeposited_over_Ethrown_vs_z
TH1F * bcal_fcal_two_gamma_mass
jerror_t brun(JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
const DVector3 & position(void) const
jerror_t evnt(JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
TH1F * bcal_fcal_two_gamma_mass_cut
jerror_t fini(void)
Called after last event of last event source has been processed.
TH2F * Ereconstructed_vs_Ethrown
const DVector3 & momentum(void) const
TH2F * Etruth_over_Ethrown_vs_z
TH2F * Erec_over_Ethrown_vs_z
TH1F * two_gamma_mass_cut
TH2F * Ecorr_over_Erec_vs_z
TH1F * two_gamma_mass_corr