StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcIUMixEvent.cxx
1 #include "TMath.h"
2 #include "StEEmcIUMixEvent.h"
3 
4 ClassImp(StEEmcIUMixEvent);
5 ClassImp(StEEmcIUMixEventHead);
6 ClassImp(StEEmcIUMixEventClust);
7 
8 // ----------------------------------------------------------------------------
9 StEEmcIUMixEvent::StEEmcIUMixEvent()
10 {
11  for ( Int_t ii=0;ii<90;ii++ )
12  {
13  pedEEmcDSM_HT[ii]=1;
14  pedEEmcDSM_TP[ii]=1;
15  }
16 
17  for ( Int_t ii=0;ii<10;ii++ )
18  {
19  pedEEmcDSM_TP[ii+00] = (ii%2)? 3 : 5;
20  pedEEmcDSM_TP[ii+20] = (ii%2)? 3 : 5;
21  pedEEmcDSM_TP[ii+30] = (ii%2)? 3 : 5;
22  pedEEmcDSM_TP[ii+50] = (ii%2)? 3 : 5;
23  pedEEmcDSM_TP[ii+60] = (ii%2)? 3 : 5;
24  pedEEmcDSM_TP[ii+80] = (ii%2)? 3 : 5;
25  }
26  Clear();
27 }
28 
29 // ----------------------------------------------------------------------------
30 void StEEmcIUMixEvent::setEvent( StMuEvent *event )
31 {
32 
33  mEventId = event->eventId();
34  mEventNumber = event->eventNumber();
35  mRunId = event->runId();
36  mRunNumber = event->runNumber();
37  mEventInfo = event->eventInfo();
38  mRunInfo = event->runInfo();
39  mL0trigger = event->l0Trigger();
40  mMuTriggerIdCollection = event->triggerIdCollection();
41  mMagneticField = event->magneticField();
42  mBbcTrigger = event->bbcTriggerDetector();
43  mEmcTrigger = event->emcTriggerDetector();
44 
45  mPrimaryVertex = event->primaryVertexPosition();
46 
47 }
48 
49 void StEEmcIUMixEventHead::setEvent( StMuEvent *event )
50 {
51 
52  mEventId = event->eventId();
53  mEventNumber = event->eventNumber();
54  mRunId = event->runId();
55  mRunNumber = event->runNumber();
56 
57  mNumberOfCandidates = 0;
58 
59 }
60 
61 // ----------------------------------------------------------------------------
62 void StEEmcIUMixEvent::Clear(Option_t *o)
63 {
64  nPairs=0;
65  for ( Int_t i=0;i<MAX_PAIRS;i++ )
66  {
67  mMass[i]=0.;
68  mPT[i]=0.;
69  mEta[i]=-10.;
70  mPhi[i]=-10.;
71  mEEmcEta[i]=-10.;
72  mZgg[i]=0.;
73  mPhigg[i]=0.;
74  mEnergy[i]=0.;
75  mEpre1[i]=0.;
76  mEpre2[i]=0.;
77  mEpost[i]=0.;
78  mEsmdu[i]=0.;
79  mEsmdv[i]=0.;
80  mZvertex[i]=0.;
81 
82  mTower1[i]=0;
83  mTower2[i]=0;
84  mEnergy1[i]=0.;
85  mEnergy2[i]=0.;
86 
87  mEnergyRatio[i]=0.;
88 
89  mNumberT[i]=0;
90  mNumberR[i]=0;
91  mNumberU[i]=0;
92  mNumberV[i]=0;
93  }
94  for ( Int_t ii=0;ii<720;ii++ ) {
95  mADC[ii]=0.;
96  mStat[ii]=0;
97  }
98 
99 
100 
101  mTotalEnergyT=0.;
102  mTotalEnergyP=0.;
103  mTotalEnergyQ=0.;
104  mTotalEnergyR=0.;
105  mTotalEnergyU=0.;
106  mTotalEnergyV=0.;
107 
108 }
109 
110 // ----------------------------------------------------------------------------
111 void StEEmcIUMixEvent::addPair ( StEEmcIUPair p ) {
112 
113  if ( nPairs >= MAX_PAIRS ) return;
114  mMass[nPairs] = p.mass();
115  mPT[nPairs] = p.pt();
116  mEta[nPairs] = p.momentum().Eta();
117  mPhi[nPairs] = p.momentum().Phi();
118  mZgg[nPairs] = p.zgg();
119  mPhigg[nPairs] = p.phigg();
120  mEnergy[nPairs] = p.energy();
121  //calculate detector Eta
122  float Rxy=TMath::Sqrt(p.vertex().x()*p.vertex().x()+p.vertex().y()*p.vertex().y());
123  float hHeight=p.pt()*(270.0-p.vertex().Z())/p.pz()+Rxy;
124  float etatheta=TMath::ATan(hHeight/270.0);
125  //printf("accept pz=%f\n",pair.pz());
126  float mideta=tan(etatheta/2.0);
127  float eemceta=-log(mideta);
128  mEEmcEta[nPairs]=eemceta;
129  Float_t esmdu=0.;
130  Float_t esmdv=0.;
131  esmdu += p.point(0).cluster(0).energy();
132  esmdu += p.point(1).cluster(0).energy();
133  esmdv += p.point(0).cluster(1).energy();
134  esmdv += p.point(1).cluster(1).energy();
135  Float_t epre1 = 0.;
136  epre1 += p.point(0).energy(1);
137  epre1 += p.point(1).energy(1);
138  Float_t epre2 = 0.;
139  epre2 += p.point(0).energy(2);
140  epre2 += p.point(1).energy(2);
141  Float_t epost = 0.;
142  epost += p.point(0).energy(3);
143  epost += p.point(1).energy(3);
144 
145  mEpre1[nPairs]=epre1;
146  mEpre2[nPairs]=epre2;
147  mEpost[nPairs]=epost;
148  mEsmdu[nPairs]=esmdu;
149  mEsmdv[nPairs]=esmdv;
150 
151  mZvertex[nPairs]=p.vertex().Z();
152 
153  mTower1[nPairs] = p.point(0).tower(0).index();
154  mEnergy1[nPairs]= p.point(0).energy();
155 
156  mTower2[nPairs] = p.point(1).tower(0).index();
157  mEnergy2[nPairs] = p.point(1).energy();
158 
159 
160  nPairs++;
161 
162 }
163 
164 // ----------------------------------------------------------------------------
165 Float_t StEEmcIUMixEvent::sum3x3(Int_t index)
166 {
167  Float_t sum=this->mADC[index];
168  Int_t ieta = index%12;
169  Int_t iphi = index/12;
171  for ( Int_t jeta=ieta-1;jeta<=ieta+1;jeta++ ) {
172  if ( jeta<0||jeta>11 ) continue;
173  for ( Int_t jphi=iphi-1;jphi<=iphi+1;jphi++ ) {
174  Int_t myeta=jeta;
175  Int_t myphi=(jphi+60)%60;
176  if ( myeta==ieta&&myphi==iphi ) continue;
177  Float_t myEt=this->mADC[ myeta + 12*myphi ];
178  sum += myEt;
179  }
180  }
181  return sum;
182 }
183 Float_t StEEmcIUMixEvent::sum3x3()
184 {
185  Float_t max=0.;
186  Int_t index = 0;
187  for ( Int_t ii=0;ii<720;ii++ )
188  if ( this->mADC[ii] > max ) {
189  index=ii;
190  max=this->mADC[ii];
191  }
192  return sum3x3(index);
193 }
194 Float_t StEEmcIUMixEvent::htdsm()
195 {
196  Float_t max=0.;
197  for ( Int_t ii=0;ii<90;ii++ ) {
198  Float_t dsm=mEmcTrigger.highTowerEndcap(ii);
199  dsm-=pedEEmcDSM_HT[ii];
200  if ( dsm>max ) max=dsm;
201  }
202  return max;
203 }
204 Float_t StEEmcIUMixEvent::tpdsm()
205 {
206  Float_t max=0.;
207  for ( Int_t ii=0;ii<90;ii++ ) {
208  Float_t dsm=mEmcTrigger.patchEndcap(ii);
209  dsm-=pedEEmcDSM_TP[ii];
210  if ( dsm>max ) max=dsm;
211  }
212  return max;
213 }
214 Int_t StEEmcIUMixEvent::npi0()
215 {
216  Int_t count=0;
217  for ( Int_t ii=0;ii<TMath::Min(5,nPairs);ii++ )
218  {
219  if ( mMass[ii]>0.08 && mMass[ii]<0.18 ) count++;
220  }
221  return count;
222 }
223 Int_t StEEmcIUMixEvent::deta(Int_t id)
224 {
225  if ( id<0||id>=nPairs)
226  return -1;
227  Int_t del = ( mTower1[id]%12 - mTower2[id]%12 );
228  return TMath::Abs(del);
229 }
230 Int_t StEEmcIUMixEvent::dphi(Int_t id)
231 {
232  if ( id<0||id>=nPairs)
233  return -1;
234  Int_t del = ( mTower1[id]/12 - mTower2[id]/12 + 60 ) % 60;
235  return TMath::Abs(del);
236 }
237 
238 
239 // ----------------------------------------------------------------------------
240 void StEEmcIUMixEventHead::Clear(Option_t *opts)
241 {
242  mEventId=0;
243  mEventNumber=0;
244  mRunId=0;
245  mRunNumber=0;
246  mNumberOfCandidates=0;
247 }
248 
249 // ----------------------------------------------------------------------------
250 void StEEmcIUMixEventClust::Clear(Option_t *opts)
251 {
252  index=-1;
253  eTower=0.;
254  ePre1=0.;
255  ePre2=0.;
256  ePost=0.;
257  eSmd=0.;
258  etaTower=0.;
259  etaPre1=0.;
260  etaPre2=0.;
261  etaPost=0.;
262  etaSmd=0.;
263  nTower=0;
264  nPre1=0;
265  nPre2=0;
266  nPost=0;
267 }
Float_t phigg()
Returns opening-angle of pair.
Definition: StEEmcIUPair.h:77
Float_t sum3x3(Int_t index)
Float_t pt()
Returns pt of pair.
Definition: StEEmcIUPair.h:78
TVector3 vertex()
Returns vertex of pair.
Definition: StEEmcIUPair.h:81
void energy(Float_t e, Int_t layer=0)
Set the energy of this point.
Definition: StEEmcIUPoint.h:25
Int_t mEventId
Items to be copied from StMuEvent.
Int_t nPairs
From EEMC point-maker.
void cluster(StEEmcIUSmdCluster c, Int_t plane)
Add an smd cluster to this point.
Definition: StEEmcIUPoint.h:31
Float_t mass()
Returns invariant mass of pair.
Definition: StEEmcIUPair.h:74
Float_t energy()
Returns energy of pair.
Definition: StEEmcIUPair.h:75
StEEmcIUPoint point(Int_t index)
Definition: StEEmcIUPair.h:30
void tower(StEEmcTower t, Float_t w=1.)
Add a tower with specified weight to the point.
Definition: StEEmcIUPoint.h:29
TVector3 momentum()
Returns momentum of pair.
Definition: StEEmcIUPair.h:80
Float_t zgg()
Returns energy-sharing of pair.
Definition: StEEmcIUPair.h:76