/* * TofDedxHCut.cpp * * Created on: 5 apr 2011 * Author: Nicola Mori */ /*! @file TofDedxHCut.cpp The TofDedxHCut class implementation file. */ #include "TofDedxHCut.h" const float TofDedxHCut::_S11_SA_params[] = { 1.5, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 }; const float TofDedxHCut::_S12_SA_params[] = { 1.5, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 }; const float TofDedxHCut::_S21_SA_params[] = { 1.6, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 }; const float TofDedxHCut::_S22_SA_params[] = { 1.6, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 }; const float TofDedxHCut::_S31_SA_params[] = { 1.6, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 }; const float TofDedxHCut::_S32_SA_params[] = { 1.6, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 }; TofDedxHCut::TofDedxHCut(const char *cutName, unsigned int layer, bool standAlone) : PamCut(cutName), _layer(layer), _standAlone(standAlone), _p(NULL) { switch (_layer) { case S11: _p = _S11_SA_params; break; case S12: _p = _S12_SA_params; break; case S21: _p = _S21_SA_params; break; case S22: _p = _S22_SA_params; break; case S31: _p = _S31_SA_params; break; case S32: _p = _S32_SA_params; break; default: _p = _S21_SA_params; } } int TofDedxHCut::Check(PamLevel2 *event) { static int trkSeqNo; if (_standAlone) trkSeqNo = 0; else { for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) { if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo()) trkSeqNo = i; } } float beta = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo)->beta[12]; static unsigned int auxLayer; static float dEdx; static unsigned int currLayer; static unsigned int nLayers; auxLayer = _layer; dEdx = 0; currLayer = 0; nLayers = 0; while (auxLayer > 0) { if ((auxLayer & 0x1) == 1) { dEdx += event->GetToFLevel2()->GetdEdx(trkSeqNo, currLayer, 100); nLayers++; } currLayer++; auxLayer >>= 1; } dEdx /= nLayers; if (dEdx < 1 / (_p[0] * beta + _p[1]) + _p[2] + _p[3]*beta) return 0; if (dEdx > 1 / (_p[4] * beta + _p[5]) + _p[6] + _p[7]*beta) return 0; return CUTOK; }