00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "EmcBhaCalib/EmcBhabhaEvent.h"
00019 #include "CLHEP/Vector/ThreeVector.h"
00020 #include "CLHEP/Vector/LorentzVector.h"
00021 #include "CLHEP/Vector/TwoVector.h"
00022 using CLHEP::Hep3Vector;
00023 using CLHEP::Hep2Vector;
00024 using CLHEP::HepLorentzVector;
00025
00026
00027
00028 #include <cassert>
00029
00030
00031
00032 #include <fstream>
00033
00034
00035
00036
00037
00038 bool EmcBhabhaEvent::m_initialized = true;
00039 int EmcBhabhaEvent::m_selectedMDCType = -1;
00040 int EmcBhabhaEvent::m_selectedEmcType = -1;
00041
00042
00043
00044
00045
00046
00047 EmcBhabhaEvent::EmcBhabhaEvent()
00048 {
00049 m_positron = new EmcBhabha();
00050 assert( 0 != m_positron );
00051 m_electron = new EmcBhabha();
00052 assert( 0 != m_electron );
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 initData();
00071 }
00072
00073
00074
00075
00076 EmcBhabhaEvent::~EmcBhabhaEvent() {
00077
00078 delete m_positron;
00079 delete m_electron;
00080
00081 }
00082
00083
00084 void
00085 EmcBhabhaEvent::initData()
00086 {
00087 m_initialized = true;
00088 }
00089
00090 void
00091 EmcBhabhaEvent::deleteData()
00092 {
00093 }
00094
00095
00096 void
00097 EmcBhabhaEvent::print() {
00098
00099 if ( positron()->found() )
00100 {
00101 cout << "Positron: " << endl;
00102 positron()->print( );
00103 }
00104 else
00105 {
00106 cout<<"routine "<< "No positron found ! " << endl;
00107 }
00108
00109 if ( electron()->found() )
00110 {
00111 cout << "Electron: " << endl;
00112 electron()->print( );
00113 }
00114 else
00115 {
00116 cout<<"routine "<< "No electron found ! " << endl;
00117 }
00118 }
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 double
00167 EmcBhabhaEvent::getDepoMCShowerEnergy(unsigned int thetaIndex,
00168 unsigned int phiIndex,
00169 double ePeak,
00170 double beamEnergy) const {
00171
00172 if ( ! m_initialized )
00173 {
00174 cout<<"error "<< " EmcBhabhaEvent not initialized ! " << endl
00175 << " Is EmcLoadBhabhaData included in the path ? "
00176 << endl;
00177 return 0;
00178 }
00179
00180
00181 double depoEne = 0.;
00182
00183 EmcStructure* theEmcStruc=new EmcStructure();
00184
00185
00186 if (theEmcStruc->isOutofAccep(thetaIndex, phiIndex ))
00187 {
00188 cout<<"warning "<< "EmcBhabhaEvent: Theta " << thetaIndex
00189 << " or phi " << phiIndex
00190 << " out of the calorimeter acceptance !"
00191 << "Return 0 !"
00192 << endl;
00193 delete theEmcStruc;
00194 return 0;
00195
00196 }
00197 else
00198 {
00199 depoEne =ePeak*beamEnergy;
00200
00201
00202 delete theEmcStruc;
00203 return depoEne;
00204
00205 }
00206
00207 }
00208
00209
00210 double
00211 EmcBhabhaEvent::getDepoMCShowerEnergy_lab(double theta,
00212 double phi,
00213 unsigned int thetaIndex,
00214 unsigned int phiIndex,
00215 double ePeak,
00216 double beamEnergy) const {
00217
00218 if ( ! m_initialized )
00219 {
00220 cout<<"error "<< " EmcBhabhaEvent not initialized ! " << endl
00221 << " Is EmcLoadBhabhaData included in the path ? "
00222 << endl;
00223 return 0;
00224 }
00225
00226
00227 double depoEne = 0.;
00228
00229 EmcStructure* theEmcStruc=new EmcStructure();
00230
00231
00232 if (theEmcStruc->isOutofAccep(thetaIndex, phiIndex ))
00233 {
00234 cout<<"warning "<< "EmcBhabhaEvent: Theta " << thetaIndex
00235 << " or phi " << phiIndex
00236 << " out of the calorimeter acceptance !"
00237 << "Return 0 !"
00238 << endl;
00239 delete theEmcStruc;
00240 return 0;
00241
00242 }
00243 else
00244 {
00245
00246 HepLorentzVector ptrk;
00247 ptrk.setPx(beamEnergy*sin(theta)*cos(phi));
00248 ptrk.setPy(beamEnergy*sin(theta)*sin(phi));
00249 ptrk.setPz(beamEnergy*cos(theta));
00250 ptrk.setE(beamEnergy);
00251
00252 ptrk=ptrk.boost(0.011,0,0);
00253
00254
00255 double depoEne_lab =ePeak*ptrk.e();
00256 delete theEmcStruc;
00257 return depoEne_lab;
00258
00259 }
00260
00261 }
00262
00263 double
00264 EmcBhabhaEvent::getErrorDepoMCShowerEnergy(unsigned int thetaIndex,
00265 unsigned int phiIndex,
00266 double eSigma) const {
00267
00268 if ( ! m_initialized )
00269 {
00270 cout<<"error "<< " EmcBhabhaEvent not initialized ! " << endl
00271 << " Is EmcLoadBhabhaData included in the path ? "
00272 << endl;
00273 return 0;
00274 }
00275
00276 double sig=0.;
00277 EmcStructure* theEmcStruc=new EmcStructure();
00278
00279 if (theEmcStruc->isOutofAccep(thetaIndex, phiIndex ))
00280 {
00281 cout<<"warning "<< "EmcBhabhaEvent: Theta " << thetaIndex
00282 << " or phi " << phiIndex
00283 << " out of the calorimeter acceptance !"
00284 << "Return 0 !"
00285 << endl;
00286
00287 delete theEmcStruc;
00288 return 0;
00289
00290 }
00291 else
00292 {
00293 sig=eSigma;
00294 delete theEmcStruc;
00295 return sig;
00296
00297 }
00298
00299 }
00300
00301 double
00302 EmcBhabhaEvent::enLeakageTheta(double theta)
00303 {
00304 return 1.0;
00305 }
00306
00307 double
00308 EmcBhabhaEvent::enLeakageThetaErr(double theta)
00309 {
00310 return 0.0;
00311 }
00312
00313 Hep3Vector
00314 EmcBhabhaEvent::showerVector( EmcShower theShower)
00315 {
00316 Hep3Vector theShowerVector(1,1,1);
00317 theShowerVector.setTheta(theShower.theta());
00318 theShowerVector.setPhi(theShower.phi());
00319 theShowerVector.setMag(theShower.energy());
00320
00321 return theShowerVector;
00322 }