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

Diff of /PamCut/TofCuts/TofDedxHCut/TofDedxHCut.cpp

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

revision 1.2 by pam-fi, Wed Apr 6 15:43:12 2011 UTC revision 1.5 by pam-fi, Tue Jan 3 08:57:21 2012 UTC
# Line 16  const float TofDedxHCut::_S22_SA_params[ Line 16  const float TofDedxHCut::_S22_SA_params[
16  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::_S31_SA_params[] = { 1.6, 1.2, -0.15, -2., 0.8, 1.6, 1.2, -0.2, 0., 0.8 };
17  const float TofDedxHCut::_S32_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 };
18    
19  TofDedxHCut::TofDedxHCut(const char *cutName, unsigned int layer, bool standAlone) :  const float TofDedxHCut::_S11_SA_params_strict[] = { 1.5, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
20    PamCut(cutName), _layer(layer), _standAlone(standAlone), _p(NULL) {  const float TofDedxHCut::_S12_SA_params_strict[] = { 1.5, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
21    const float TofDedxHCut::_S21_SA_params_strict[] = { 1.6, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
22    switch (_layer) {  const float TofDedxHCut::_S22_SA_params_strict[] = { 1.6, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
23    case S11:  const float TofDedxHCut::_S31_SA_params_strict[] = { 1.6, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
24      _p = _S11_SA_params;  const float TofDedxHCut::_S32_SA_params_strict[] = { 1.6, 1.2, -0.15, -1.7, 0.8, 1.6, 1.2, -0.2, -0.8, 0.8 };
25      break;  
26    case S12:  TofDedxHCut::TofDedxHCut(const char *cutName, unsigned int layer, bool standAlone, bool strict) :
27      _p = _S12_SA_params;      PamCut(cutName), _layer(layer), _standAlone(standAlone), _p(NULL) {
28      break;  
29    case S21:    if (strict) {
30      _p = _S21_SA_params;      switch (_layer) {
31      break;      case S11:
32    case S22:        _p = _S11_SA_params_strict;
33      _p = _S22_SA_params;        break;
34      break;      case S12:
35    case S31:        _p = _S12_SA_params_strict;
36      _p = _S31_SA_params;        break;
37      break;      case S21:
38    case S32:        _p = _S21_SA_params_strict;
39      _p = _S32_SA_params;        break;
40      break;      case S22:
41    default:        _p = _S22_SA_params_strict;
42      _p = _S21_SA_params;        break;
43        case S31:
44          _p = _S31_SA_params_strict;
45          break;
46        case S32:
47          _p = _S32_SA_params_strict;
48          break;
49        default:
50          _p = _S21_SA_params_strict;
51        }
52      }
53      else {
54        switch (_layer) {
55        case S11:
56          _p = _S11_SA_params;
57          break;
58        case S12:
59          _p = _S12_SA_params;
60          break;
61        case S21:
62          _p = _S21_SA_params;
63          break;
64        case S22:
65          _p = _S22_SA_params;
66          break;
67        case S31:
68          _p = _S31_SA_params;
69          break;
70        case S32:
71          _p = _S32_SA_params;
72          break;
73        default:
74          _p = _S21_SA_params;
75        }
76    }    }
   
77  }  }
78    
79  int TofDedxHCut::Check(PamLevel2 *event) {  int TofDedxHCut::Check(PamLevel2 *event) {
80    
81    static int trkSeqNo;    static int trkSeqNo;
82      static int idx;
83    if (_standAlone)    if (_standAlone)
84      trkSeqNo = 0;      trkSeqNo = -1;
85    else {    else
86      for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) {      trkSeqNo = event->GetTrack(0)->GetTrkTrack()->GetSeqNo();
87        if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo())  
88          trkSeqNo = i;    for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) {
89      }      if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == trkSeqNo)
90          idx = i;
91    }    }
92    
93    float beta = event->GetToFLevel2()->GetToFTrkVar(trkSeqNo)->beta[12];    float beta = event->GetToFLevel2()->GetToFTrkVar(idx)->beta[12];
94    
95    static unsigned int auxLayer;    static unsigned int auxLayer;
96    static float dEdx;    static float dEdx;
# Line 69  int TofDedxHCut::Check(PamLevel2 *event) Line 103  int TofDedxHCut::Check(PamLevel2 *event)
103    nLayers = 0;    nLayers = 0;
104    while (auxLayer > 0) {    while (auxLayer > 0) {
105      if ((auxLayer & 0x1) == 1) {      if ((auxLayer & 0x1) == 1) {
106        dEdx += event->GetToFLevel2()->GetdEdx(trkSeqNo, currLayer, 100);        dEdx += event->GetToFLevel2()->GetdEdx(idx, currLayer, 100);
107        nLayers++;        nLayers++;
108          // Patch to exclude S115b
109          if (currLayer == 0) {
110            ToFTrkVar *tofTrk = event->GetToFLevel2()->GetToFTrkVar(idx);
111            bool has8 = false, has9 = false;
112            float dedx9 = 0.;
113            for (Int_t ib = 0; ib < tofTrk->npmtadc; ib++) {
114              if (tofTrk->pmtadc[ib] == 8) {
115                has8 = true;
116              }
117              if (tofTrk->pmtadc[ib] == 9) {
118                has9 = true;
119                dedx9 = tofTrk->dedx[ib];
120              }
121            }
122    
123            if (has9) {
124              dEdx -= (dedx9 / ((int) has8 + 1));
125              dEdx *= 2.;
126            }
127          }
128          //End of patch
129      }      }
130      currLayer++;      currLayer++;
131      auxLayer >>= 1;      auxLayer >>= 1;
# Line 78  int TofDedxHCut::Check(PamLevel2 *event) Line 133  int TofDedxHCut::Check(PamLevel2 *event)
133    
134    dEdx /= nLayers;    dEdx /= nLayers;
135    
136    if (dEdx < _p[0]/ (_p[1] * beta + _p[2]) +  _p[3] + _p[4] * beta)    if (dEdx < _p[0] / (_p[1] * beta + _p[2]) + _p[3] + _p[4] * beta)
137      return 0;      return 0;
138    
139    if (dEdx > _p[5] / (_p[6] * beta + _p[7]) + _p[8] + _p[9] * beta)    if (dEdx > _p[5] / (_p[6] * beta + _p[7]) + _p[8] + _p[9] * beta)

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

  ViewVC Help
Powered by ViewVC 1.1.23