StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtTriplet.cc
1 /***************************************************************************
2  *
3  * $Id: StHbtTriplet.cc,v 1.4 2003/09/02 17:58:32 perev Exp $
4  *
5  * Author: Robert Willson, Ohio State, willson@bnl.gov
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package.
9  * The triplet object is passed to the TripletCuts for verification, and
10  * then to the AddRealTriplet and AddMixedTriplet methods of the
11  * three-particle correlation functions.
12  *
13  ***************************************************************************
14  *
15  * $Log: StHbtTriplet.cc,v $
16  * Revision 1.4 2003/09/02 17:58:32 perev
17  * gcc 3.2 updates + WarnOff
18  *
19  * Revision 1.3 2001/06/05 00:59:29 willson
20  * Added entrance separation and quality methods
21  *
22  * Revision 1.2 2000/04/12 01:55:59 willson
23  * Qinv Correlation Functions corrected
24  *
25  *
26  ***************************************************************************/
27 
28 #include "StHbtMaker/Infrastructure/StHbtTriplet.hh"
29 
30 double Triplet_Quality_Calc(StHbtParticle* Track1, StHbtParticle* Track2) {
31  unsigned long mapMask0 = 0xFFFFFF00;
32  unsigned long mapMask1 = 0x1FFFFF;
33  unsigned long padRow1To24Track1 = Track1->TopologyMap(0) & mapMask0;
34  unsigned long padRow25To45Track1 = Track1->TopologyMap(1) & mapMask1;
35  unsigned long padRow1To24Track2 = Track2->TopologyMap(0) & mapMask0;
36  unsigned long padRow25To45Track2 = Track2->TopologyMap(1) & mapMask1;
37  // AND logic
38  unsigned long bothPads1To24 = padRow1To24Track1 & padRow1To24Track2;
39  unsigned long bothPads25To45 = padRow25To45Track1 & padRow25To45Track2;
40  // XOR logic
41  unsigned long onePad1To24 = padRow1To24Track1 ^ padRow1To24Track2;
42  unsigned long onePad25To45 = padRow25To45Track1 ^ padRow25To45Track2;
43  unsigned long bitI;
44  int ibits;
45  int Quality = 0;
46  double normQual = 0.0;
47  int MaxQuality = Track1->NumberOfHits() + Track2->NumberOfHits();
48  for (ibits=8;ibits<=31;ibits++) {
49  bitI = 0;
50  bitI |= 1UL<<(ibits);
51  if ( onePad1To24 & bitI ) {
52  Quality++;
53  continue;
54  }
55  else{
56  if ( bothPads1To24 & bitI ) Quality--;
57  }
58  }
59  for (ibits=0;ibits<=20;ibits++) {
60  bitI = 0;
61  bitI |= 1UL<<(ibits);
62  if ( onePad25To45 & bitI ) {
63  Quality++;
64  continue;
65  }
66  else{
67  if ( bothPads25To45 & bitI ) Quality--;
68  }
69  }
70  normQual = (double)Quality/( (double) MaxQuality );
71  return ( normQual );
72 
73 }
74 
75 StHbtTriplet::StHbtTriplet(){
76  mTrack1 = 0;
77  mTrack2 = 0;
78  mTrack3 = 0;
79 }
80 
81 StHbtTriplet::StHbtTriplet(StHbtParticle* a, StHbtParticle* b, StHbtParticle* c)
82  : mTrack1(a), mTrack2(b), mTrack3(c)
83 { }
84 
85 
86 StHbtTriplet::~StHbtTriplet() {/* no-op */}
87 
88 //StHbtTriplet::StHbtTriplet(const StHbtTriplet &a) {/* missing */}
89 
90 //StHbtTriplet& StHbtTriplet::operator=(const StHbtTriplet &a)
91 
92 //_________________
93 double StHbtTriplet::qInv() const
94 {
95  double dq = ::sqrt(fabs((mTrack1->FourMomentum() - mTrack2->FourMomentum()).m2()) +
96  fabs((mTrack2->FourMomentum() - mTrack3->FourMomentum()).m2()) +
97  fabs((mTrack3->FourMomentum() - mTrack1->FourMomentum()).m2()));
98  return (dq);
99 }
100 //_________________
101 double StHbtTriplet::qInv12() const
102 {
103  double dq = ::sqrt(fabs((mTrack1->FourMomentum() - mTrack2->FourMomentum()).m2()));
104  return (dq);
105 }
106 //_________________
107 double StHbtTriplet::qInv23() const
108 {
109  double dq = ::sqrt(fabs((mTrack2->FourMomentum() - mTrack3->FourMomentum()).m2()));
110  return (dq);
111 }
112 //_________________
113 double StHbtTriplet::qInv31() const
114 {
115  double dq = ::sqrt(fabs((mTrack3->FourMomentum() - mTrack1->FourMomentum()).m2()));
116  return (dq);
117 }
118 //_________________
119 double StHbtTriplet::mInv() const
120 {
121  double InvariantMass = abs(mTrack1->FourMomentum() + mTrack2->FourMomentum() + mTrack3->FourMomentum());
122  return (InvariantMass);
123 }
124 //_________________
125 double StHbtTriplet::kT() const
126 {
127 
128  double tmp =
129  (mTrack1->FourMomentum() + mTrack2->FourMomentum() + mTrack3->FourMomentum()).perp();
130  tmp /= 3.0;
131 
132  return (tmp);
133 }
134 //_________________
135 StHbtLorentzVector StHbtTriplet::fourMomentum() const
136 {
137  StHbtLorentzVector temp = mTrack1->FourMomentum()+mTrack2->FourMomentum()+mTrack3->FourMomentum();
138  return temp;
139 }
140 //_________________
141 double StHbtTriplet::quality() const {
142 
143  double Q1 = Triplet_Quality_Calc(mTrack1, mTrack2);
144  double Q2 = Triplet_Quality_Calc(mTrack2, mTrack3);
145  double Q3 = Triplet_Quality_Calc(mTrack3, mTrack1);
146 
147  if (Q1>Q2) {
148  if (Q1>Q3) return Q1;
149  else return Q3;
150  }
151  else
152  if (Q2>Q3) return Q2;
153  else return Q3;
154 
155 }
156 
157 double StHbtTriplet::NominalTpcExitSeparation() const {
158  StHbtThreeVector diff1 = mTrack1->NominalTpcExitPoint() - mTrack2->NominalTpcExitPoint();
159  StHbtThreeVector diff2 = mTrack2->NominalTpcExitPoint() - mTrack3->NominalTpcExitPoint();
160  StHbtThreeVector diff3 = mTrack3->NominalTpcExitPoint() - mTrack1->NominalTpcExitPoint();
161  if (diff1.mag()<diff2.mag()) {
162  if (diff1.mag()<diff3.mag()) return (diff1.mag());
163  else return (diff3.mag());
164  }
165  else if (diff2.mag()<diff3.mag()) return (diff2.mag());
166  else return (diff3.mag());
167 }
168 
169 double StHbtTriplet::NominalTpcEntranceSeparation() const {
170  StHbtThreeVector diff1 = mTrack1->NominalTpcEntrancePoint() - mTrack2->NominalTpcEntrancePoint();
171  StHbtThreeVector diff2 = mTrack2->NominalTpcEntrancePoint() - mTrack3->NominalTpcEntrancePoint();
172  StHbtThreeVector diff3 = mTrack3->NominalTpcEntrancePoint() - mTrack1->NominalTpcEntrancePoint();
173  if (diff1.mag()<diff2.mag()) {
174  if (diff1.mag()<diff3.mag()) return (diff1.mag());
175  else return (diff3.mag());
176  }
177  else if (diff2.mag()<diff3.mag()) return (diff2.mag());
178  else return (diff3.mag());
179 }
180 
181 double StHbtTriplet::NominalTpcAverageSeparation() const {
182  StHbtThreeVector diff1,diff2,diff3;
183  double AveSep1 = 0.0;
184  double AveSep2 = 0.0;
185  double AveSep3 = 0.0;
186  int ipt=0;
187  for (ipt=0; ipt<11; ipt++){
188  diff1 = mTrack1->mNominalPosSample[ipt] - mTrack2->mNominalPosSample[ipt];
189  AveSep1 += diff1.mag();
190  diff2 = mTrack2->mNominalPosSample[ipt] - mTrack3->mNominalPosSample[ipt];
191  AveSep2 += diff2.mag();
192  diff3 = mTrack3->mNominalPosSample[ipt] - mTrack1->mNominalPosSample[ipt];
193  AveSep3 += diff3.mag();
194  }
195  AveSep1 = AveSep1/11.0;
196  AveSep2 = AveSep1/11.0;
197  AveSep3 = AveSep1/11.0;
198  if (AveSep1<AveSep2) {
199  if (AveSep1<AveSep3) return (AveSep1);
200  else return (AveSep3);
201  }
202  else if (AveSep2<AveSep3) return (AveSep2);
203  else return (AveSep3);
204 }
205