StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StJet.cxx
1 //
3 // $Id: StJet.cxx,v 1.3 2009/09/05 22:15:16 pibero Exp $
4 // $Log: StJet.cxx,v $
5 // Revision 1.3 2009/09/05 22:15:16 pibero
6 // Add tracks and towers references to jet
7 //
8 // Revision 1.2 2009/09/05 18:18:05 pibero
9 // Add utility functions for trigger patches
10 //
11 // Revision 1.1 2008/06/01 03:41:44 tai
12 // moved StJet, StJets, and TrackToJetIndex to StSpinPool/StJets
13 //
14 // Revision 1.4 2008/03/27 02:25:04 tai
15 // moved the definitions of the construcors from .h to .cxx
16 // set jetEt and 3 other variables in a constructor
17 //
18 // Revision 1.3 2007/06/07 01:36:06 kocolosk
19 // fix minor AutoBuild warnings
20 //
21 // Revision 1.2 2007/06/05 21:56:13 kocolosk
22 // added data members for zVertex and geometric trigger associations, plus methods for detEta (barrel only)
23 //
24 // Revision 1.1 2004/07/08 15:41:03 mmiller
25 // First release of StJetMaker. Mike's commit of full clean of StJetFinder, StJetMaker, and StSpinMaker. builds and runs in dev.
26 //
27 // Revision 1.5 2003/09/11 18:14:18 thenry
28 // *** empty log message ***
29 //
30 // Revision 1.4 2003/09/02 17:59:01 perev
31 // gcc 3.2 updates + WarnOff
32 //
33 // Revision 1.3 2002/12/04 20:28:07 thenry
34 // StppuDstMaker was modified to allow multiple jet analysis modules to be
35 // run simultaneosly with various parameters while the Maker loads the events
36 // and analyses them. Four different jet analyzers exist:
37 //
38 // Konstanin's Analyzers:
39 // Kt type: StppKonstKtJetAnalyzer
40 // Cone type: StppKonstConeJetAnalyzer
41 //
42 // Mike's Analyzers:
43 // Kt type: StppMikeKtJetAnalyzer
44 // Cone type: StppMikeConeJetAnalyzer
45 //
46 // These modules all require the StJetFinder modules.
47 //
48 // Revision 1.2 2002/06/24 13:22:59 akio
49 // numerous bug fix & updates
50 //
51 // Revision 1.1 2002/02/11 20:30:48 akio
52 // Many updates, including very first version of jet finder.
53 //
54 //
55 // Revision 1.0 2001/06/14 Akio Ogawa
56 //
58 
59 #include <iostream>
60 #include <stdio.h>
61 
62 #include "TrackToJetIndex.h"
63 #include "StJet.h"
64 
65 ClassImp(StJet);
66 
67 StJet::StJet()
68  : TLorentzVector(0,0,0,0)
69  , nCell(0)
70  , charge(0)
71  , nTracks(0)
72  , nBtowers(0)
73  , nEtowers(0)
74  , tpcEtSum(0.0)
75  , btowEtSum(0.0)
76  , etowEtSum(0.0)
77  , jetEt(0.0)
78  , jetPt(0.0)
79  , jetEta(0.0)
80  , jetPhi(0.0)
81  , zVertex(-999)
82 {
83 }
84 
85 StJet::StJet(double lE, double lpx, double lpy, double lpz, Int_t size, int c)
86  : TLorentzVector(lpx, lpy, lpz, lE)
87  , nCell(size)
88  , charge(c)
89  , nTracks(0)
90  , nBtowers(0)
91  , nEtowers(0)
92  , tpcEtSum(0.0)
93  , btowEtSum(0.0)
94  , etowEtSum(0.0)
95  , zVertex(-999)
96 {
97  jetEt = Et();
98  jetPt = Pt();
99  jetEta = Eta();
100  jetPhi = Phi();
101 }
102 
103 TrackToJetIndex* StJet::leadingChargedParticle() const
104 {
105  TrackToJetIndex* lcp = 0;
106  for (int iTrack = 0; iTrack < numberOfTracks(); ++iTrack) {
107  TrackToJetIndex* t = track(iTrack);
108  if (!lcp || t->Pt() > lcp->Pt()) lcp = t;
109  }
110  return lcp;
111 }
112 
113 Float_t StJet::detEta() const {
114  if (zVertex > -998) return detEta(zVertex);
115  return -999;
116 }
117 
118 Float_t StJet::detEta(float vz, float r) const {
119  float hold(0.),denom(0.);
120  if (Theta()==TMath::PiOver2()) { // if Jet Theta = 90 then tan is undefined
121  if (vz==0) {hold = TMath::PiOver2();}
122  else {hold = atan2(r,vz);}
123  }
124  else
125  {
126  denom = (r/tan(Theta()))+vz;
127  if (denom==0.) {hold = TMath::PiOver2();}
128  if (denom!=0.) {hold = atan2(r,denom);}
129  }
130  return -TMath::Log(TMath::Tan(hold/2));
131 }
132 
133 void StJet::addGeomTrigger(int trigId) {
134  //check if the trigId is already in the vector -- not really necessary
135  for(unsigned int i=0; i<mGeomTriggers.size(); i++) {
136  if (mGeomTriggers[i] == trigId) return;
137  }
138  mGeomTriggers.push_back(trigId);
139 }
140 
141 bool StJet::geomTrigger(int trigId) const {
142  for(unsigned int i=0; i<mGeomTriggers.size(); i++) {
143  if (mGeomTriggers[i] == trigId) return true;
144  }
145  return false;
146 }
147 
148 bool StJet::getJetPatchEtaPhi(int jetPatch, float& eta, float& phi)
149 {
150  //
151  // Pibero Djawotho <pibero@tamu.edu>
152  // Texas A&M University
153  // 5 September 2009
154  //
155 
156  // Sanity check
157  if (jetPatch < 0 || jetPatch >= 12) return false;
158 
159  //
160  // The jet patches are numbered starting with JP0 centered at 150 degrees
161  // looking from the West into the IR (intersection region) and increasing
162  // clockwise, i.e. JP1 at 90 degrees, JP2 at 30 degrees, etc. On the East
163  // side the numbering picks up at JP6 centered again at 150 degrees and
164  // increasing clockwise (again as seen from the *West* into the IR). Thus
165  // JP0 and JP6 are in the same phi location in the STAR coordinate system.
166  // So are JP1 and JP7, etc.
167  //
168  // Jet Patch# Eta Phi Quadrant
169  //
170  // 0 0.5 150 10'
171  // 1 0.5 90 12'
172  // 2 0.5 30 2'
173  // 3 0.5 -30 4'
174  // 4 0.5 -90 6'
175  // 5 0.5 -150 8'
176  // 6 -0.5 150 10'
177  // 7 -0.5 90 12'
178  // 8 -0.5 30 2'
179  // 9 -0.5 -30 4'
180  // 10 -0.5 -90 6'
181  // 11 -0.5 -150 8'
182  //
183  // http://www.nikhef.nl/~ogrebeny/emc/files/Towers%20Layout.pdf
184  // http://www.nikhef.nl/~ogrebeny/emc/files/BEMC.pdf
185  // http://drupal.star.bnl.gov/STAR/system/files/BEMC_y2004.pdf
186  //
187  eta = (jetPatch < 6) ? 0.5 : -0.5;
188  phi = 150 - (jetPatch % 6) * 60; // Degrees
189 
190  // Degrees to radians
191  phi *= TMath::DegToRad();
192 
193  // Map phi into [-pi,pi]
194  phi = TVector2::Phi_mpi_pi(phi);
195 
196  return true;
197 }
198 
199 bool StJet::getJetPatchId(float eta, float phi, int& id)
200 {
201  //
202  // Pibero Djawotho <pibero@tamu.edu>
203  // Texas A&M University
204  // 5 September 2009
205  //
206 
207  // Jet patch id is left at -1 on failure
208  id = -1;
209 
210  // Check range of eta
211  if (eta < -1 || eta > 1) return false;
212 
213  // Map phi into [-pi,pi] if necessary
214  if (phi < -M_PI || phi > M_PI) phi = TVector2::Phi_mpi_pi(phi);
215 
216  // Get jet patch id
217  static const double PI_OVER_3 = M_PI/3;
218 
219  if (0 <= eta && eta <= 1) {
220  if ( 2*PI_OVER_3 <= phi && phi < M_PI) id = 0;
221  if ( PI_OVER_3 <= phi && phi < 2*PI_OVER_3) id = 1;
222  if ( 0 <= phi && phi < PI_OVER_3) id = 2;
223  if ( -PI_OVER_3 <= phi && phi < 0) id = 3;
224  if (-2*PI_OVER_3 <= phi && phi < -PI_OVER_3) id = 4;
225  if ( -M_PI <= phi && phi < -2*PI_OVER_3) id = 5;
226  }
227 
228  if (-1 <= eta && eta < 0) {
229  if ( 2*PI_OVER_3 <= phi && phi < M_PI) id = 6;
230  if ( PI_OVER_3 <= phi && phi < 2*PI_OVER_3) id = 7;
231  if ( 0 <= phi && phi < PI_OVER_3) id = 8;
232  if ( -PI_OVER_3 <= phi && phi < 0) id = 9;
233  if (-2*PI_OVER_3 <= phi && phi < -PI_OVER_3) id = 10;
234  if ( -M_PI <= phi && phi < -2*PI_OVER_3) id = 11;
235  }
236 
237  return (0 <= id && id < 12);
238 }
float zVertex
position of vertex used to reconstruct jet
Definition: StJet.h:134
Definition: StJet.h:91