00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00058
00059 #include <iostream>
00060 #include <stdio.h>
00061
00062 #include "TrackToJetIndex.h"
00063 #include "StJet.h"
00064
00065 ClassImp(StJet);
00066
00067 StJet::StJet()
00068 : TLorentzVector(0,0,0,0)
00069 , nCell(0)
00070 , charge(0)
00071 , nTracks(0)
00072 , nBtowers(0)
00073 , nEtowers(0)
00074 , tpcEtSum(0.0)
00075 , btowEtSum(0.0)
00076 , etowEtSum(0.0)
00077 , jetEt(0.0)
00078 , jetPt(0.0)
00079 , jetEta(0.0)
00080 , jetPhi(0.0)
00081 , zVertex(-999)
00082 {
00083 }
00084
00085 StJet::StJet(double lE, double lpx, double lpy, double lpz, Int_t size, int c)
00086 : TLorentzVector(lpx, lpy, lpz, lE)
00087 , nCell(size)
00088 , charge(c)
00089 , nTracks(0)
00090 , nBtowers(0)
00091 , nEtowers(0)
00092 , tpcEtSum(0.0)
00093 , btowEtSum(0.0)
00094 , etowEtSum(0.0)
00095 , zVertex(-999)
00096 {
00097 jetEt = Et();
00098 jetPt = Pt();
00099 jetEta = Eta();
00100 jetPhi = Phi();
00101 }
00102
00103 TrackToJetIndex* StJet::leadingChargedParticle() const
00104 {
00105 TrackToJetIndex* lcp = 0;
00106 for (int iTrack = 0; iTrack < numberOfTracks(); ++iTrack) {
00107 TrackToJetIndex* t = track(iTrack);
00108 if (!lcp || t->Pt() > lcp->Pt()) lcp = t;
00109 }
00110 return lcp;
00111 }
00112
00113 Float_t StJet::detEta() const {
00114 if (zVertex > -998) return detEta(zVertex);
00115 return -999;
00116 }
00117
00118 Float_t StJet::detEta(float vz, float r) const {
00119 float hold(0.),denom(0.);
00120 if (Theta()==TMath::PiOver2()) {
00121 if (vz==0) {hold = TMath::PiOver2();}
00122 else {hold = atan2(r,vz);}
00123 }
00124 else
00125 {
00126 denom = (r/tan(Theta()))+vz;
00127 if (denom==0.) {hold = TMath::PiOver2();}
00128 if (denom!=0.) {hold = atan2(r,denom);}
00129 }
00130 return -TMath::Log(TMath::Tan(hold/2));
00131 }
00132
00133 void StJet::addGeomTrigger(int trigId) {
00134
00135 for(unsigned int i=0; i<mGeomTriggers.size(); i++) {
00136 if (mGeomTriggers[i] == trigId) return;
00137 }
00138 mGeomTriggers.push_back(trigId);
00139 }
00140
00141 bool StJet::geomTrigger(int trigId) const {
00142 for(unsigned int i=0; i<mGeomTriggers.size(); i++) {
00143 if (mGeomTriggers[i] == trigId) return true;
00144 }
00145 return false;
00146 }
00147
00148 bool StJet::getJetPatchEtaPhi(int jetPatch, float& eta, float& phi)
00149 {
00150
00151
00152
00153
00154
00155
00156
00157 if (jetPatch < 0 || jetPatch >= 12) return false;
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187 eta = (jetPatch < 6) ? 0.5 : -0.5;
00188 phi = 150 - (jetPatch % 6) * 60;
00189
00190
00191 phi *= TMath::DegToRad();
00192
00193
00194 phi = TVector2::Phi_mpi_pi(phi);
00195
00196 return true;
00197 }
00198
00199 bool StJet::getJetPatchId(float eta, float phi, int& id)
00200 {
00201
00202
00203
00204
00205
00206
00207
00208 id = -1;
00209
00210
00211 if (eta < -1 || eta > 1) return false;
00212
00213
00214 if (phi < -M_PI || phi > M_PI) phi = TVector2::Phi_mpi_pi(phi);
00215
00216
00217 static const double PI_OVER_3 = M_PI/3;
00218
00219 if (0 <= eta && eta <= 1) {
00220 if ( 2*PI_OVER_3 <= phi && phi < M_PI) id = 0;
00221 if ( PI_OVER_3 <= phi && phi < 2*PI_OVER_3) id = 1;
00222 if ( 0 <= phi && phi < PI_OVER_3) id = 2;
00223 if ( -PI_OVER_3 <= phi && phi < 0) id = 3;
00224 if (-2*PI_OVER_3 <= phi && phi < -PI_OVER_3) id = 4;
00225 if ( -M_PI <= phi && phi < -2*PI_OVER_3) id = 5;
00226 }
00227
00228 if (-1 <= eta && eta < 0) {
00229 if ( 2*PI_OVER_3 <= phi && phi < M_PI) id = 6;
00230 if ( PI_OVER_3 <= phi && phi < 2*PI_OVER_3) id = 7;
00231 if ( 0 <= phi && phi < PI_OVER_3) id = 8;
00232 if ( -PI_OVER_3 <= phi && phi < 0) id = 9;
00233 if (-2*PI_OVER_3 <= phi && phi < -PI_OVER_3) id = 10;
00234 if ( -M_PI <= phi && phi < -2*PI_OVER_3) id = 11;
00235 }
00236
00237 return (0 <= id && id < 12);
00238 }