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

Contents of /PamCut/TofCuts/TofDedxS1Cut/TofDedxS1Cut.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Tue Jan 3 08:57:21 2012 UTC (12 years, 11 months ago) by pam-fi
Branch: MAIN
CVS Tags: V9, HEAD
Changes since 1.2: +5 -5 lines
Error occurred while calculating annotation data.
Fix in Tof track handling.

1 /*
2 * TofDedxS1Cut.cpp
3 *
4 * Created on: 13-mar-2009
5 * Author: Sergio Ricciarini, Nicola Mori
6 * Reworked on: 21-jul-2011
7 * Author: Nicola Mori, Valeria Di Felice
8 */
9
10 /*! @file TofDedxS1Cut.cpp The TofDedxS1Cut class implementation file */
11
12 #include "TofDedxS1Cut.h"
13
14 int TofDedxS1Cut::Check(PamLevel2 *event) {
15
16 int idx = 0;
17 for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) {
18 if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == event->GetTrack(0)->GetTrkTrack()->GetSeqNo())
19 idx = i;
20 }
21
22 float dEdx = 0;
23 int nLayers = 0;
24 float dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 0, 100);
25
26 // Patch to exclude S115b
27 ToFTrkVar *tofTrk = event->GetToFLevel2()->GetToFTrkVar(idx);
28 bool has8 = false, has9 = false;
29 float dedx9 = 0.;
30 for (Int_t ib = 0; ib < tofTrk->npmtadc; ib++) {
31 if (tofTrk->pmtadc[ib] == 8) {
32 has8 = true;
33 }
34 if (tofTrk->pmtadc[ib] == 9) {
35 has9 = true;
36 dedx9 = tofTrk->dedx[ib];
37 }
38 }
39
40 if (has9){
41 dEdxLayer -= (dedx9 / ((int) has8 + 1));
42 dEdxLayer *= 2.;
43 }
44 //End of patch
45
46 if (dEdxLayer > 0. && dEdxLayer < 4090) {
47 dEdx += dEdxLayer;
48 nLayers++;
49 }
50 dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 1, 100);
51 if (dEdxLayer > 0. && dEdxLayer < 4090) {
52 dEdx += dEdxLayer;
53 nLayers++;
54 }
55
56 if (nLayers > 0) {
57 dEdx /= nLayers;
58
59 float R = event->GetTrack(0)->GetTrkTrack()->GetRigidity();
60
61 if (dEdx >= (3.102 - 2.6 * TMath::Log(R)) * (R < 1.05) + 3. * (R >= 1.05))
62 return 0;
63
64 return CUTOK;
65 // if (dEdx < (3.102 - 2.6 * TMath::Log(R)) * (R < 1.05) + 3. * (R >= 1.05))
66 // return 0;
67 //
68 // return CUTOK;
69 }
70 else {
71 return 0;
72 }
73
74 }

  ViewVC Help
Powered by ViewVC 1.1.23