/[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.2 by pam-fi, Fri Aug 14 10:30:49 2009 UTC revision 1.3 by pam-fi, Tue Sep 22 10:24:26 2009 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    int trkSeqNo;    static int trkSeqNo;
50    if(_standAlone)    if (_standAlone)
51      trkSeqNo = 0;      trkSeqNo = 0;
52    else    else {
53      trkSeqNo = event->GetTrack(0)->GetToFTrack()->trkseqno;      for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) {
54          if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo())
55            trkSeqNo = i;
56        }
57      }
58    
59    float beta = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo)->beta[12];    float beta = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo)->beta[12];
60    
61    //float beta = event->GetTrack(0)->GetToFTrack()->beta[12];    static unsigned int auxLayer;
62    //int trkSeqNo = event->GetTrack(0)->GetToFTrack()->trkseqno;    static float dEdx;
63    float dEdx = event->GetToFLevel2()->GetdEdx(trkSeqNo, 0, 100) + event->GetToFLevel2()->GetdEdx(trkSeqNo, 1, 100)    static unsigned int currLayer;
64        + event->GetToFLevel2()->GetdEdx(trkSeqNo, 2, 100) + event->GetToFLevel2()->GetdEdx(trkSeqNo, 3, 100);    static unsigned int nLayers;
65    dEdx /= 4;  
66      auxLayer = _layer;
67      dEdx = 0;
68      currLayer = 0;
69      nLayers = 0;
70      while (auxLayer > 0) {
71        if ((auxLayer & 0x1) == 1) {
72          //cout << auxLayer << "  " << currLayer << endl;
73          dEdx += event->GetToFLevel2()->GetdEdx(trkSeqNo, currLayer, 100);
74          nLayers++;
75        }
76        currLayer++;
77        auxLayer >>= 1;
78      }
79    
80    if (dEdx < 1 / (0.2 * (beta - 0.06)) - 2.)    dEdx /= nLayers;
     return 0;  
81    
82    if (dEdx > 1 / (0.25 * (beta - 0.12)))    if (dEdx < 1. / (_p[0] * pow(beta, _p[4]) + _p[1]) + _p[2] + _p[3] * beta)
83      return 1;      return 0;
84    
85    if (dEdx < 11. * beta - 7.7)    if (dEdx > 1. / (_p[5] * pow(beta, _p[9]) + _p[6]) + _p[7] + _p[8] * beta)
86      return 2;      return 0;
87    
88    return CUTOK;    return CUTOK;
89  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.23