00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "StHbtMaker/Cut/franksV0Cut.h"
00024 #include "StarClassLibrary/SystemOfUnits.h"
00025 #include <cstdio>
00026
00027 #ifdef __ROOT__
00028 ClassImp(franksV0Cut)
00029 #endif
00030
00031
00032 franksV0Cut::franksV0Cut() : mNV0sPassed(0), mNV0sFailed(0) {
00033
00034 }
00035
00036
00037
00038
00039
00040
00041 void franksV0Cut::EventBegin(const StHbtEvent* ev) {
00042 mPrimaryVertex = ev->PrimVertPos();
00043 }
00044
00045
00046
00047 bool franksV0Cut::Pass(const StHbtV0* V0){
00048 double degree=3.1415927/180.;
00049 int inMassRange;
00050
00051 #ifdef STHBTDEBUG
00052 cout << endl;
00053 cout << " v0 " << V0 << endl;
00054 cout << " * dcaV0Daughters " << V0->dcaV0Daughters();
00055 cout << " * dcaV0ToPrimVertex " << V0->dcaV0ToPrimVertex();
00056 cout << " * pV0ToPrimVertexAngle " << V0->pV0ToPrimVertexAngle();
00057 cout << " * decayLengthV0 " << V0->decayLengthV0();
00058 cout << " * tpcHitsPos " << V0->tpcHitsPos();
00059 cout << " * tpcHitsNeg " << V0->tpcHitsNeg();
00060 cout << " * dcaPosToPrimVertex " << V0->dcaPosToPrimVertex();
00061 cout << " * dcaNegToPrimVertex " << V0->dcaNegToPrimVertex();
00062 cout << " * ptArmV0 " << V0->ptArmV0();
00063 cout << " * alphaV0 " << V0->alphaV0();
00064 #endif
00065
00066
00067 inMassRange=0;
00068
00069
00070 if( strstr(V0Type,"k") || strstr(V0Type,"K")){
00071 if( V0->massK0Short() < (mMass+mV0MassRange[1]) &&
00072 V0->massK0Short() > (mMass+mV0MassRange[0]) ) inMassRange=1;
00073 }
00074 else if( (strstr(V0Type,"anti") || strstr(V0Type,"ANTI"))){
00075 if( V0->massAntiLambda() < (mMass+mV0MassRange[1]) &&
00076 V0->massAntiLambda() > (mMass+mV0MassRange[0]) ) inMassRange=1;
00077 }
00078 else if( (strstr(V0Type,"ambda") || strstr(V0Type,"AMBDA"))){
00079 if( V0->massLambda() < (mMass+mV0MassRange[1]) &&
00080 V0->massLambda() > (mMass+mV0MassRange[0]) ) inMassRange=1;
00081 }
00082
00083 #ifdef STHBTDEBUG
00084 cout << " inMassRange " << inMassRange << endl;
00085 #endif
00086
00087 double angle = (V0->decayVertexV0() - mPrimaryVertex).angle(V0->momV0()) / degree;
00088 #ifdef STHBTDEBUG
00089 cout << " decayVertexV0 " << V0->decayVertexV0() << endl;
00090 cout << " mPrimaryVertex " << mPrimaryVertex << endl;
00091 cout << " angle " << angle << endl;
00092 #endif
00093
00094 bool goodPID = ( inMassRange &&
00095 (V0->dcaV0Daughters() > mdcaV0daughters[0]) &&
00096 (V0->dcaV0Daughters() < mdcaV0daughters[1]) &&
00097 (V0->dcaV0ToPrimVertex() > mdcaV0ToPrimVertex[0]) &&
00098 (V0->dcaV0ToPrimVertex() < mdcaV0ToPrimVertex[1]) &&
00099 (angle > mpV0ToPrimVertexAngle[0]) &&
00100 (angle < mpV0ToPrimVertexAngle[1]) &&
00101 (V0->decayLengthV0() > mdecayLengthV0[0]) &&
00102 (V0->decayLengthV0() < mdecayLengthV0[1]) &&
00103 (V0->tpcHitsPos() > mtpcHitsPos[0]) &&
00104 (V0->tpcHitsPos() < mtpcHitsPos[1]) &&
00105 (V0->tpcHitsNeg() > mtpcHitsNeg[0]) &&
00106 (V0->tpcHitsNeg() < mtpcHitsNeg[1]) &&
00107 (V0->dcaPosToPrimVertex() > mdcaPosToPrimVertex[0]) &&
00108 (V0->dcaPosToPrimVertex() < mdcaPosToPrimVertex[1]) &&
00109 (V0->dcaNegToPrimVertex() > mdcaNegToPrimVertex[0]) &&
00110 (V0->dcaNegToPrimVertex() < mdcaNegToPrimVertex[1]) &&
00111 (V0->ptArmV0() > mptArmV0[0]) &&
00112 (V0->ptArmV0() < mptArmV0[1]) &&
00113 (V0->alphaV0() > malphaV0[0]) &&
00114 (V0->alphaV0() < malphaV0[1]));
00115
00116
00117 #ifdef STHBTDEBUG
00118 cout << " goodPID " << goodPID << endl;
00119 #endif
00120
00121 if (goodPID){
00122 #ifdef STHBTDEBUG
00123 cout << "now calculate rapidity" << endl;
00124 #endif
00125 float TEnergy = ::sqrt((V0->ptotV0())*(V0->ptotV0())+mMass*mMass);
00126 float TRapidity = 0.5*::log((TEnergy+V0->momV0().z())/
00127 (TEnergy-V0->momV0().z()));
00128 float Pt = V0->ptV0();
00129
00130
00131
00132 #ifdef STHBTDEBUG
00133 cout << " * Pt " << Pt;
00134 cout << " * mPt[0] " << mPt[0];
00135 cout << " * mPt[1] " << mPt[1];
00136 cout << " * TRapidity " << TRapidity;
00137 cout << " * mRapidity[0] " << mRapidity[0];
00138 cout << " * mRapidity[1] " << mRapidity[1];
00139 cout << " * Pt " << (Pt > mPt[0]) && (Pt < mPt[1]);
00140 cout << " * y " << (TRapidity > mRapidity[0]) && (TRapidity < mRapidity[1]);
00141 cout << endl;
00142 #endif
00143
00144 bool goodV0=
00145 ((Pt > mPt[0]) &&
00146 (Pt < mPt[1]) &&
00147 (TRapidity > mRapidity[0]) &&
00148 (TRapidity < mRapidity[1]));
00149
00150 goodV0 ? mNV0sPassed++ : mNV0sFailed++;
00151 return (goodV0);
00152 }
00153 else{
00154 mNV0sFailed++;
00155 return (goodPID);
00156 }
00157 }
00158
00159 StHbtString franksV0Cut::Report(){
00160 string Stemp;
00161 char Ctemp[100];
00162 sprintf(Ctemp,"--franksV0Cut--\n Particle mass:\t%E\n",this->Mass());
00163 Stemp=Ctemp;
00164 sprintf(Ctemp,"dcaV0daughters:\t%E - %E\n",mdcaV0daughters[0],
00165 mdcaV0daughters[1]);
00166 Stemp+=Ctemp;
00167 sprintf(Ctemp,"dcaV0ToPrimVertex:\t%E - %E\n",mdcaV0ToPrimVertex[0],
00168 mdcaV0ToPrimVertex[1]);
00169 Stemp+=Ctemp;
00170 sprintf(Ctemp,"pV0ToPrimVertexAngle:\t%E - %E\n",mpV0ToPrimVertexAngle[0],mpV0ToPrimVertexAngle[1]);
00171 Stemp+=Ctemp;
00172 sprintf(Ctemp,"decayLengthV0:\t%E - %E\n",mdecayLengthV0[0],
00173 mdecayLengthV0[1]);
00174 Stemp+=Ctemp;
00175 sprintf(Ctemp,"tpcHitsPos:\t%d - %d\n",mtpcHitsPos[0],mtpcHitsPos[1]);
00176 Stemp+=Ctemp;
00177 sprintf(Ctemp,"tpcHitsNeg:\t%d - %d\n",mtpcHitsNeg[0],mtpcHitsNeg[1]);
00178 Stemp+=Ctemp;
00179 sprintf(Ctemp,"dcaPosToPrimVertex:\t%E - %E\n",mdcaPosToPrimVertex[0],
00180 mdcaPosToPrimVertex[1]);
00181 Stemp+=Ctemp;
00182 sprintf(Ctemp,"dcaNegToPrimVertex:\t%E - %E\n",mdcaNegToPrimVertex[0],
00183 mdcaNegToPrimVertex[1]);
00184 Stemp+=Ctemp;
00185 sprintf(Ctemp,"ptArmV0:\t%E - %E\n",mptArmV0[0],mptArmV0[1]);
00186 Stemp+=Ctemp;
00187 sprintf(Ctemp,"alphaV0:\t%E - %E\n",malphaV0[0],malphaV0[1]);
00188 Stemp+=Ctemp;
00189 sprintf(Ctemp,"Particle pT:\t%E - %E\n",mPt[0],mPt[1]);
00190 Stemp+=Ctemp;
00191 sprintf(Ctemp,"Particle rapidity:\t%E - %E\n",mRapidity[0],mRapidity[1]);
00192 Stemp+=Ctemp;
00193 sprintf(Ctemp,"Number of V0s which passed:\t%ld Number which failed:\t%ld\n",mNV0sPassed,mNV0sFailed);
00194 Stemp += Ctemp;
00195 StHbtString returnThis = Stemp;
00196 return returnThis;
00197 }