StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
anglePairCut.cxx
1 /***************************************************************************
2  *
3  * $Id: anglePairCut.cxx,v 1.1 2001/11/05 16:14:16 rcwells Exp $
4  *
5  * Author: Randall Wells, Ohio State, rcwells@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  * cut on the angle of the pair relative to the reaction plane
10  *
11  ***************************************************************************
12  *
13  * $Log: anglePairCut.cxx,v $
14  * Revision 1.1 2001/11/05 16:14:16 rcwells
15  * Adding anglePairCut class to cut on pair emission angle
16  *
17  *
18  **************************************************************************/
19 
20 #include "StHbtMaker/Cut/anglePairCut.h"
21 #include <string>
22 #include <cstdio>
23 #include "StHbtMaker/Infrastructure/StHbtReactionPlaneAnalysis.h"
24 
25 #ifdef __ROOT__
26 ClassImp(anglePairCut)
27 #endif
28 
29 //__________________
30 anglePairCut::anglePairCut(){
31  mNPairsPassed = mNPairsFailed = 0;
32  mBetaT = 0;
33  mBetaL = 0;
34  mBetaT2 = 0;
35  mBetaL2 = 0;
36  mBetaTL = 0;
37 }
38 //__________________
39 anglePairCut::anglePairCut(char* title){
40  mNPairsPassed = mNPairsFailed = 0;
41  char TitT[100] = "betaT";
42  strcat(TitT,title);
43  mBetaT = new StHbt1DHisto(TitT,"Transverse Velocity",100,0,1);
44  char TitL[100] = "betaL";
45  strcat(TitL,title);
46  mBetaL = new StHbt1DHisto(TitL,"Longitudinal Velocity",100,0,1);
47  char TitT2[100] = "betaT2";
48  strcat(TitT2,title);
49  mBetaT2 = new StHbt1DHisto(TitT2,"Transverse Velocity Squared",100,0,1);
50  char TitL2[100] = "betaL2";
51  strcat(TitL2,title);
52  mBetaL2 = new StHbt1DHisto(TitL2,"Longitudinal Velocity Squared",100,0,1);
53  char TitTL[100] = "betaTL";
54  strcat(TitTL,title);
55  mBetaTL = new StHbt1DHisto(TitTL,"Transverse*Longitudinal Velocity",100,0,1);
56 }
57 //__________________
58 //anglePairCut::~anglePairCut(){
59 // /* no-op */
60 //}
61 //__________________
62 bool anglePairCut::Pass(const StHbtPair* pair){
63  if ( (mAngle1[0]<0.0)&&(mAngle2[0]<0.0) ) return true; // If both angles are <0.0 always return true
64  bool temp = false;
65  bool temp1 = false;
66  bool temp2 = false;
67  double pxTotal = pair->fourMomentumSum().x();
68  double pyTotal = pair->fourMomentumSum().y();
69  double angle = atan2(pyTotal,pxTotal)*180.0/pi;
70  //cout << "Angle: " << pxTotal << " " << pyTotal << " " << angle << endl;
71  if (angle<0.0) angle+=360.0;
72  //cout << "Angle:(2) " << angle << endl;
74  double RPangle = RPanal->ReactionPlane()*180.0/pi;
75  double angleDifference = angle-RPangle;
76  //cout << "Angle:(3) " << RPangle << " " << angleDifference << endl;
77  if (angleDifference<0.0) angleDifference+=360.0;
78  //cout << "Angle:(4) " << angleDifference << endl;
79  // Test without 2nd sector
80  if ( (mAngle2[0]>360.0) && (mAngle2[1]>360.0) ) {
81  if (mAngle1[0]<mAngle1[1]) {
82  temp1 = ( (mAngle1[0]<angleDifference) &&
83  (angleDifference<mAngle1[1]) );
84  }
85  else {
86  temp1 = ( (mAngle1[0]<angleDifference) ||
87  (angleDifference<mAngle1[1]) );
88  }
89  }
90  // End test without 2nd sector
91  // Test with 2nd sector
92  if ( (mAngle2[0]<360.0) || (mAngle2[1]<360.0) ) {
93  if (mAngle1[0]<mAngle1[1]) {
94  temp1 = ( (mAngle1[0]<angleDifference) &&
95  (angleDifference<mAngle1[1]) );
96  if (mAngle2[0]<mAngle2[1]) {
97  temp2 = ( (mAngle2[0]<angleDifference) &&
98  (angleDifference<mAngle2[1]) );
99  }
100  else {
101  temp2 = ( (mAngle2[0]<angleDifference) ||
102  (angleDifference<mAngle2[1]) );
103  }
104  }
105  else {
106  temp1 = ( (mAngle1[0]<angleDifference) ||
107  (angleDifference<mAngle1[1]) );
108  if (mAngle2[0]<mAngle2[1]) {
109  temp2 = ( (mAngle2[0]<angleDifference) &&
110  (angleDifference<mAngle2[1]) );
111  }
112  else {
113  temp2 = ( (mAngle2[0]<angleDifference) ||
114  (angleDifference<mAngle2[1]) );
115  }
116  }
117  }
118  // End test with 2nd sector
119  temp = temp1 || temp2;
120  if ( temp && mBetaT ) { // if passed cut and histos exist
121  double pT = pair->fourMomentumSum().perp();
122  double pZ = pair->fourMomentumSum().pz();
123  double e = pair->fourMomentumSum().e();
124  double e2 = e*e;
125  mBetaT->Fill(pT/e);
126  mBetaL->Fill(pZ/e);
127  mBetaT2->Fill( pT*pT/(e2) );
128  mBetaL2->Fill( pZ*pZ/(e2) );
129  mBetaTL->Fill( pT*pZ/(e2) );
130  }
131  temp ? mNPairsPassed++ : mNPairsFailed++;
132  return temp;
133 }
134 //__________________
135 StHbtString anglePairCut::Report(){
136  string Stemp = "Angle Pair Cut - total dummy-- always returns true\n";
137  char Ctemp[100];
138  sprintf(Ctemp,"Number of pairs which passed:\t%ld Number which failed:\t%ld\n",mNPairsPassed,mNPairsFailed);
139  Stemp += Ctemp;
140  StHbtString returnThis = Stemp;
141  return returnThis;
142 }
143 //__________________
144 double anglePairCut::EmissionAngle(const StHbtPair *pair) {
145  double pxTotal = pair->fourMomentumSum().x();
146  double pyTotal = pair->fourMomentumSum().y();
147  double angle = atan2(pyTotal,pxTotal)*180.0/pi;
148  if (angle<0.0) angle+=360.0;
150  double RPangle = RPanal->ReactionPlane()*180.0/pi;
151  double angleDifference = angle-RPangle;
152  if (angleDifference<0.0) angleDifference+=360.0;
153  return angleDifference;
154 }
155 
156 
157 
158 
159 
160 
161 
162 
163 
164