StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StStrangeTagsMaker.cxx
1 /***************************************************************************
2  *
3  * $Id: StStrangeTagsMaker.cxx,v 1.20 2007/04/28 17:57:02 perev Exp $
4  *
5  * Author: Gene Van Buren, Feb 1999
6  ***************************************************************************
7  *
8  * Description: Maker to fill the Strangeness Tags
9  *
10  ***************************************************************************
11  *
12  * $Log: StStrangeTagsMaker.cxx,v $
13  * Revision 1.20 2007/04/28 17:57:02 perev
14  * Redundant StChain.h removed
15  *
16  * Revision 1.19 2004/07/27 12:02:00 lbarnby
17  * Filling of NKink and MaxPtKink tags added.
18  *
19  * Revision 1.18 2004/07/26 16:02:32 lbarnby
20  * Added Xibar, Omega(bar). Introduce max pt tags.
21  *
22  * Revision 1.17 2003/10/07 03:10:27 perev
23  * Leak of struct on mTagTable fixed
24  *
25  * Revision 1.16 2003/09/02 17:59:05 perev
26  * gcc 3.2 updates + WarnOff
27  *
28  * Revision 1.15 2003/01/22 23:37:18 genevb
29  * Change function for abs()
30  *
31  * Revision 1.14 2000/01/27 19:29:50 fisyak
32  * Put StrangeTag to .data
33  *
34  * Revision 1.13 1999/12/07 23:23:56 genevb
35  * Fixed linux warnings
36  *
37  * Revision 1.12 1999/11/16 19:20:44 genevb
38  * Modified for StEvent 2.0
39  *
40  * Revision 1.11 1999/09/24 01:23:26 fisyak
41  * Reduced Include Path
42  *
43  * Revision 1.10 1999/07/15 13:57:28 perev
44  * cleanup
45  *
46  * Revision 1.9 1999/06/27 22:45:31 fisyak
47  * Merge StRootEvent and StEvent
48  *
49  * Revision 1.8 1999/04/14 22:05:11 genevb
50  * Comply with momentumOfV0 call
51  *
52  * Revision 1.7 1999/03/20 22:07:43 perev
53  * new maker schema
54  *
55  * Revision 1.6 1999/03/15 01:18:36 genevb
56  * Fixed Xi vertex typo
57  *
58  * Revision 1.5 1999/02/24 15:38:49 genevb
59  * Fixed a typo
60  *
61  * Revision 1.4 1999/02/24 15:34:00 genevb
62  * Fixed a typo
63  *
64  * Revision 1.3 1999/02/24 02:03:38 genevb
65  * Add Xi vertices
66  *
67  * Revision 1.2 1999/02/22 16:44:16 genevb
68  * Switched to PhysicalConstants.h
69  *
70  * Revision 1.1 1999/02/21 23:35:11 genevb
71  * Strangeness Tags Maker
72  *
73  **************************************************************************/
74 #include "StStrangeTagsMaker.h"
75 #include "StEvent.h"
76 #include "StV0Vertex.h"
77 #include "StXiVertex.h"
78 #include "StEventTypes.h"
79 #include "StTrack.h"
80 #include "TMath.h"
81 #include "PhysicalConstants.h"
82 #include "phys_constants.h"
83 
84 ClassImp(StStrangeTagsMaker)
85 
86 StStrangeTagsMaker::StStrangeTagsMaker(const char *name, const char *title)
87  : StMaker(name, title)
88 {
89  mEvent = 0;
90  mTagTable = 0; // init pointer to tag table
91 }
92 
93 StStrangeTagsMaker::~StStrangeTagsMaker()
94 {
95  mTagTable = 0; // clean up
96 }
97 
98 Int_t StStrangeTagsMaker::Init()
99 {
100  mRange = 0.025;
101  m2Range = 2*mRange;
102  mMasspi2 = pion_plus_mass_c2 * pion_plus_mass_c2;
103  mMasspr2 = proton_mass_c2 * proton_mass_c2;
104  mMassla2 = lambda_mass_c2 * lambda_mass_c2;
105  mMasska2 = M_KAON_MINUS * M_KAON_MINUS; // defined in phys_constants.h
106 
107  return StMaker::Init();
108 }
109 
111 {
112  mTagTable = new StrangeTag_st;
113  mEvent = (StEvent *) GetInputDS("StEvent");
114  if (!mEvent) return kStOK; // If no event, we're done
115 
116  fillTag();
117  St_StrangeTag *StrangeTag = new St_StrangeTag("StrangeTag",1);
118  AddData(StrangeTag);
119  StrangeTag->AddAt(mTagTable,0);
120  delete mTagTable; mTagTable=0;
121  return kStOK;
122 }
123 
124 
125 StrangeTag_st* StStrangeTagsMaker::tag()
126 {
127  return mTagTable;
128 }
129 
130 void StStrangeTagsMaker::fillTag()
131 {
132  StSPtrVecV0Vertex& v0Vertices = mEvent->v0Vertices();
133  size_t v0tot = v0Vertices.size();
134  StSPtrVecXiVertex& xiVertices = mEvent->xiVertices();
135  size_t castot = xiVertices.size();
136 
137  Int_t nbelowK0 = 0;
138  Int_t nK0 = 0;
139  Int_t naboveK0 = 0;
140  Int_t nbelowLa = 0;
141  Int_t nLa = 0;
142  Int_t naboveLa = 0;
143  Int_t nbelowLb = 0;
144  Int_t nLb = 0;
145  Int_t naboveLb = 0;
146  Int_t nbelowXi = 0;
147  Int_t nXi = 0;
148  Int_t naboveXi = 0;
149  Int_t nbelowXibar = 0;
150  Int_t nXibar = 0;
151  Int_t naboveXibar = 0;
152  Int_t nbelowOm = 0;
153  Int_t nOm = 0;
154  Int_t naboveOm = 0;
155  Int_t nbelowOmbar = 0;
156  Int_t nOmbar = 0;
157  Int_t naboveOmbar = 0;
158  Int_t nKinkPos = 0;
159  Int_t nKinkNeg = 0;
160 
161  Float_t perc;
162 
163  size_t i;
164 
165  //max Pt temporary variables
166  Float_t maxPtK0=0.0;
167  Float_t maxPtLa=0.0;
168  Float_t maxPtLb=0.0;
169  Float_t maxPtXi=0.0;
170  Float_t maxPtXibar=0.0;
171  Float_t maxPtOm=0.0;
172  Float_t maxPtOmbar=0.0;
173  Float_t maxPtKinkPos=0.0;
174  Float_t maxPtKinkNeg=0.0;
175 
176  // v0s
177 
178  for (i=0; i<v0tot; i++) {
179  StV0Vertex *vertex = v0Vertices[i];
180  const StThreeVectorF& nMom = vertex->momentumOfDaughter(negative);
181  const StThreeVectorF& pMom = vertex->momentumOfDaughter(positive);
182  StThreeVectorF vMom = nMom + pMom;
183  Float_t pN2 = nMom.mag2();
184  Float_t pP2 = pMom.mag2();
185  Float_t pV2 = vMom.mag2();
186  Float_t eNpi = ::sqrt(pN2 + mMasspi2);
187  Float_t eNpr = ::sqrt(pN2 + mMasspr2);
188  Float_t ePpi = ::sqrt(pP2 + mMasspi2);
189  Float_t ePpr = ::sqrt(pP2 + mMasspr2);
190  Float_t eK0 = eNpi + ePpi;
191  Float_t eLa = eNpi + ePpr;
192  Float_t eLb = eNpr + ePpi;
193  Float_t maK0 = ::sqrt(eK0*eK0 - pV2);
194  Float_t maLa = ::sqrt(eLa*eLa - pV2);
195  Float_t maLb = ::sqrt(eLb*eLb - pV2);
196 
197 
198  Float_t ptV0 = TMath::Sqrt((vMom.x()*vMom.x())+(vMom.y()*vMom.y()));
199 
200 
201  perc = (maK0/kaon_0_short_mass_c2) - 1.;
202  if (TMath::Abs(perc) < (2.0*mRange)) // mRange too narrow for highPt K0s
203  {
204  nK0++;
205  if(ptV0>maxPtK0) maxPtK0=ptV0;
206  }
207  else if (TMath::Abs(perc + (2.0*m2Range)) < (2.0*mRange)) nbelowK0++;
208  else if (TMath::Abs(perc - (2.0*m2Range)) < (2.0*mRange)) naboveK0++;
209 
210  perc = (maLa/lambda_mass_c2) - 1.;
211  if (TMath::Abs(perc) < (0.5*mRange)) // mRange too wide for La, Lb.
212  {
213  nLa++;
214  if(ptV0>maxPtLa) maxPtLa=ptV0;
215  }
216  else if (TMath::Abs(perc + (0.5*m2Range)) < (0.5*mRange)) nbelowLa++;
217  else if (TMath::Abs(perc - (0.5*m2Range)) < (0.5*mRange)) naboveLa++;
218 
219  perc = (maLb/antilambda_mass_c2) - 1.;
220  if (TMath::Abs(perc) < (0.5*mRange))
221  {
222  nLb++;
223  if(ptV0>maxPtLb) maxPtLb=ptV0;
224  }
225  else if (TMath::Abs(perc + (0.5*m2Range)) < (0.5*mRange)) nbelowLb++;
226  else if (TMath::Abs(perc - (0.5*m2Range)) < (0.5*mRange)) naboveLb++;
227 
228  } //End V0 loop
229 
230  // Cascades
231 
232  for (i=0; i<castot; i++) {
233  StXiVertex *vertex = xiVertices[i];
234  const StThreeVectorF& bMom = vertex->momentumOfBachelor();
235  double pcharge = vertex->chargeOfBachelor();
236  StThreeVectorF lMom = vertex->momentumOfV0();
237  StThreeVectorF cMom = lMom + bMom;
238  Float_t pB2 = bMom.mag2();
239  Float_t pL2 = lMom.mag2();
240  Float_t pC2 = cMom.mag2();
241  Float_t epi = ::sqrt(pB2 + mMasspi2);
242  Float_t eka = ::sqrt(pB2 + mMasska2);
243  Float_t ela = ::sqrt(pL2 + mMassla2);
244  Float_t eXi = ela + epi;
245  Float_t maXi = ::sqrt(eXi*eXi - pC2);
246  Float_t eOm = ela + eka;
247  Float_t maOm = ::sqrt(eOm*eOm - pC2);
248 
249  Float_t ptCas = TMath::Sqrt((cMom.x()*cMom.x())+(cMom.y()*cMom.y()));
250  perc = (maXi/xi_minus_mass_c2) - 1.;
251  // Xi minus, Xi-bar plus
252  if(pcharge<0)
253  {
254  if (TMath::Abs(perc) < mRange)
255  {
256  nXi++;
257  if(ptCas>maxPtXi) maxPtXi=ptCas;
258  }
259  else if (TMath::Abs(perc + m2Range) < mRange) nbelowXi++;
260  else if (TMath::Abs(perc - m2Range) < mRange) naboveXi++;
261  }
262  else
263  {
264  if (TMath::Abs(perc) < mRange)
265  {
266  nXibar++;
267  if(ptCas>maxPtXibar) maxPtXibar=ptCas;
268  }
269  else if (TMath::Abs(perc + m2Range) < mRange) nbelowXibar++;
270  else if (TMath::Abs(perc - m2Range) < mRange) naboveXibar++;
271  }
272 
273  // Omega minus, Omega-bar plus
274  perc = (maOm/M_OMEGA_MINUS) - 1.;
275  if(pcharge<0)
276  {
277  if (TMath::Abs(perc) < mRange)
278  {
279  nOm++;
280  if(ptCas>maxPtOm) maxPtOm=ptCas;
281  }
282  else if (TMath::Abs(perc + m2Range) < mRange) nbelowOm++;
283  else if (TMath::Abs(perc - m2Range) < mRange) naboveOm++;
284  }
285  else
286  {
287  if (TMath::Abs(perc) < mRange)
288  {
289  nOmbar++;
290  if(ptCas>maxPtOmbar) maxPtOmbar=ptCas;
291  }
292  else if (TMath::Abs(perc + m2Range) < mRange) nbelowOmbar++;
293  else if (TMath::Abs(perc - m2Range) < mRange) naboveOmbar++;
294  }
295 
296 
297  } // End Cascade loop
298 
299  // Kinks
300  StSPtrVecKinkVertex& kinkVertices = mEvent->kinkVertices();
301  for(StSPtrVecKinkVertexIterator i=kinkVertices.begin();i != kinkVertices.end();i++){
302  StTrack* parentTrack=(*i)->parent();
303  Int_t charge = parentTrack->geometry()->charge();
304  Float_t ptKink = parentTrack->geometry()->momentum().perp();
305  if(charge > 0){
306  nKinkPos++;
307  if(ptKink > maxPtKinkPos) maxPtKinkPos = ptKink;
308  }
309  else if (charge < 0){
310  nKinkNeg++;
311  if(ptKink > maxPtKinkNeg) maxPtKinkNeg = ptKink;
312  }
313  }
314 
315  mTagTable->NV0 = v0tot;
316  mTagTable->NbelowK0 = nbelowK0;
317  mTagTable->NK0 = nK0;
318  mTagTable->NaboveK0 = naboveK0;
319  mTagTable->NbelowLa = nbelowLa;
320  mTagTable->NLa = nLa;
321  mTagTable->NaboveLa = naboveLa;
322  mTagTable->NbelowLb = nbelowLb;
323  mTagTable->NLb = nLb;
324  mTagTable->NaboveLb = naboveLb;
325  mTagTable->NbelowXi = nbelowXi;
326  mTagTable->NXi = nXi;
327  mTagTable->NaboveXi = naboveXi;
328  mTagTable->NbelowXibar = nbelowXibar;
329  mTagTable->NXibar = nXibar;
330  mTagTable->NaboveXibar = naboveXibar;
331  mTagTable->NbelowOm = nbelowOm;
332  mTagTable->NOm = nOm;
333  mTagTable->NaboveOm = naboveOm;
334  mTagTable->NbelowOmbar = nbelowOmbar;
335  mTagTable->NOmbar = nOmbar;
336  mTagTable->NaboveOmbar = naboveOmbar;
337 
338  mTagTable->MaxPtK0 = maxPtK0;
339  mTagTable->MaxPtLa = maxPtLa;
340  mTagTable->MaxPtLb = maxPtLb;
341  mTagTable->MaxPtXi = maxPtXi;
342  mTagTable->MaxPtXibar = maxPtXibar;
343  mTagTable->MaxPtOm = maxPtOm;
344  mTagTable->MaxPtOmbar = maxPtOmbar;
345 
346  mTagTable->range = mRange;
347 
348  mTagTable->NKinkPos = nKinkPos;
349  mTagTable->NKinkNeg = nKinkNeg;
350  mTagTable->MaxPtKinkPos = maxPtKinkPos;
351  mTagTable->MaxPtKinkNeg = maxPtKinkNeg;
352 
353 }
354 
355 void StStrangeTagsMaker::printTag(ostream& os)
356 {
357  os << "--- Strangeness Tag Table ---" << endl;
358  if (!mTagTable)
359  os << "(empty)" << endl;
360  else {
361  os << "Range used: +/-" << mTagTable->range << " * M" << endl;
362  os << "No. V0's: " << mTagTable->NV0 << endl;
363  os << "No. K0's: " << mTagTable->NK0 << endl;
364  os << "No. La's: " << mTagTable->NLa << endl;
365  os << "No. Lb's: " << mTagTable->NLb << endl;
366  os << "No. Xi's: " << mTagTable->NXi << endl;
367  os << "No. Xibar's: " << mTagTable->NXi << endl;
368  os << "No. Om's: " << mTagTable->NOm << endl;
369  os << "No. Ombar's: " << mTagTable->NOmbar << endl;
370  os << "Backgrounds: (same bin size)" << endl;
371  os << "No. below K0's: " << mTagTable->NbelowK0 << endl;
372  os << "No. above K0's: " << mTagTable->NaboveK0 << endl;
373  os << "No. below La's: " << mTagTable->NbelowLa << endl;
374  os << "No. above La's: " << mTagTable->NaboveLa << endl;
375  os << "No. below Lb's: " << mTagTable->NbelowLb << endl;
376  os << "No. above Lb's: " << mTagTable->NaboveLb << endl;
377  os << "No. below Xi's: " << mTagTable->NbelowXi << endl;
378  os << "No. above Xi's: " << mTagTable->NaboveXi << endl;
379  os << "No. below Xibar's: " << mTagTable->NbelowXibar << endl;
380  os << "No. above Xibar's: " << mTagTable->NaboveXibar << endl;
381  os << "No. below Om's: " << mTagTable->NbelowOm << endl;
382  os << "No. above Om's: " << mTagTable->NaboveOm << endl;
383  os << "No. below Ombar's: " << mTagTable->NbelowOmbar << endl;
384  os << "No. above Ombar's: " << mTagTable->NaboveOmbar << endl;
385  os << "Rare probe tags: (same ranges)" << endl;
386  os << "max Pt K0: " << mTagTable->MaxPtK0 << endl;
387  os << "max Pt La: " << mTagTable->MaxPtLa << endl;
388  os << "max Pt Lb: " << mTagTable->MaxPtLb << endl;
389  os << "max Pt Xi: " << mTagTable->MaxPtXi << endl;
390  os << "max Pt Xibar: " << mTagTable->MaxPtXibar << endl;
391  os << "max Pt Om: " << mTagTable->MaxPtOm << endl;
392  os << "max Pt Ombar: " << mTagTable->MaxPtOmbar << endl;
393  }
394 }
virtual void AddData(TDataSet *data, const char *dir=".data")
User methods.
Definition: StMaker.cxx:332
A maker to fill the strangeness tags.
Definition: Stypes.h:40