/[PAMELA software]/PamCut/TofCuts/TofDedxHeCut/TofDedxHeCut.cpp
ViewVC logotype

Diff of /PamCut/TofCuts/TofDedxHeCut/TofDedxHeCut.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by pam-fi, Wed Aug 5 14:03:21 2009 UTC revision 1.4 by pam-fi, Tue Jan 3 08:57:21 2012 UTC
# Line 9  Line 9 
9    
10  #include "TofDedxHeCut.h"  #include "TofDedxHeCut.h"
11    
12    const float TofDedxHeCut::_S11_SA_params[] = { 0.27, 0.045, -4.9, 4.7, 2.6, 0.38, 0.045, 1.7, 2., 2.5 };
13    const float TofDedxHeCut::_S12_SA_params[] = { 0.27, 0.043, -4.9, 4.7, 2.6, 0.38, 0.042, 1.7, 2., 2.5 };
14    const float TofDedxHeCut::_S21_SA_params[] = { 0.29, 0.037, -4.52, 4.4, 2.4, 0.28, 0.031, 1., 2.2, 2. };
15    const float TofDedxHeCut::_S22_SA_params[] = { 0.31, 0.033, -4.52, 4.4, 2.4, 0.29, 0.02, 1., 2.4, 1.9 };
16    const float TofDedxHeCut::_S31_SA_params[] = { 0.44, 0.029, -2.4, 3.2, 2.5, 0.56, 0.008, 3.2, 1.2, 2.3 };
17    const float TofDedxHeCut::_S32_SA_params[] = { 0.48, 0.024, -2.4, 3.4, 2.5, 0.64, -0.0071, 3.2, 1.3, 2.3 };
18    
19    TofDedxHeCut::TofDedxHeCut(const char *cutName, unsigned int layer, bool standAlone) :
20        PamCut(cutName), _layer(layer), _standAlone(standAlone), _p(NULL) {
21    
22      switch (_layer) {
23      case S11:
24        _p = _S11_SA_params;
25        break;
26      case S12:
27        _p = _S12_SA_params;
28        break;
29      case S21:
30        _p = _S21_SA_params;
31        break;
32      case S22:
33        _p = _S22_SA_params;
34        break;
35      case S31:
36        _p = _S31_SA_params;
37        break;
38      case S32:
39        _p = _S32_SA_params;
40        break;
41      default:
42        _p = _S21_SA_params;
43      }
44    
45    }
46    
47  int TofDedxHeCut::Check(PamLevel2 *event) {  int TofDedxHeCut::Check(PamLevel2 *event) {
48    
49    float beta = event->GetTrack(0)->GetToFTrack()->beta[12];    static int trkSeqNo;
50    int trkSeqNo = event->GetTrack(0)->GetToFTrack()->trkseqno;    static int idx;
51    float dEdx = event->GetToFLevel2()->GetdEdx(trkSeqNo, 0, 100) + event->GetToFLevel2()->GetdEdx(trkSeqNo, 1, 100)    if (_standAlone)
52        + event->GetToFLevel2()->GetdEdx(trkSeqNo, 2, 100) + event->GetToFLevel2()->GetdEdx(trkSeqNo, 3, 100);      trkSeqNo = -1;
53    dEdx /= 4;    else
54        trkSeqNo = event->GetTrack(0)->GetTrkTrack()->GetSeqNo();
55    
56      for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) {
57        if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == trkSeqNo)
58          idx = i;
59      }
60    
61      float beta = event->GetToFLevel2()->GetToFTrkVar(idx)->beta[12];
62    
63      static unsigned int auxLayer;
64      static float dEdx;
65      static unsigned int currLayer;
66      static unsigned int nLayers;
67    
68      auxLayer = _layer;
69      dEdx = 0;
70      currLayer = 0;
71      nLayers = 0;
72      while (auxLayer > 0) {
73        if ((auxLayer & 0x1) == 1) {
74          //cout << auxLayer << "  " << currLayer << endl;
75          dEdx += event->GetToFLevel2()->GetdEdx(idx, currLayer, 100);
76          nLayers++;
77        }
78        currLayer++;
79        auxLayer >>= 1;
80      }
81    
82    if (dEdx < 1 / (0.2 * (beta - 0.05)) - 2.)    dEdx /= nLayers;
     return 0;  
83    
84    if (dEdx > 1 / (0.25 * (beta - 0.1)))    if (dEdx < 1. / (_p[0] * pow(beta, _p[4]) + _p[1]) + _p[2] + _p[3] * beta)
85      return 1;      return 0;
86    
87    if (dEdx < 11. * beta - 7.7)    if (dEdx > 1. / (_p[5] * pow(beta, _p[9]) + _p[6]) + _p[7] + _p[8] * beta)
88      return 2;      return 0;
89    
90    return CUTOK;    return CUTOK;
91  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.23