/[PAMELA software]/PamCut/CollectionActions/Histo2DActions/TofDedxVsBetaHistoAction/TofDedxVsBetaHistoAction.cpp
ViewVC logotype

Annotation of /PamCut/CollectionActions/Histo2DActions/TofDedxVsBetaHistoAction/TofDedxVsBetaHistoAction.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.2.2 - (hide annotations) (download)
Tue Jan 3 08:45:27 2012 UTC (13 years ago) by pam-fi
Branch: V8
Changes since 1.1.2.1: +15 -12 lines
Fix in Tof track handling.

1 pam-fi 1.1 /*
2     * TofDedxVsBetaHistoAction.cpp
3     *
4     * Created on: 25-giu-2009
5     * Author: Nicola Mori
6     */
7    
8     /*! @file TofDedxVsBetaHistoAction.cpp The TofDedxVsBetaHistoAction class implementation file. */
9    
10     #include "TofDedxVsBetaHistoAction.h"
11    
12     TofDedxVsBetaHistoAction::TofDedxVsBetaHistoAction(const char *actionName, unsigned int layers, bool standAlone,
13     TString outFileBase, TString mode, bool outRoot, bool outText, TString title) :
14 pam-fi 1.1.2.1 Histo2DAction<Int_t>(actionName, title, outFileBase, mode, outRoot, outText), _layers(layers), _nLayers(0), _badEvents(
15     0), _standAlone(standAlone) {
16 pam-fi 1.1
17 pam-fi 1.1.2.1 bool buildTitle = false;
18 pam-fi 1.1 if (title == "") {
19 pam-fi 1.1.2.1 buildTitle = true;
20 pam-fi 1.1 title = "TOF dE/dx (";
21 pam-fi 1.1.2.1 }
22     if ((_layers & S11) == S11) {
23     if (buildTitle)
24 pam-fi 1.1 title += "S11";
25 pam-fi 1.1.2.1 _nLayers++;
26     }
27     if ((_layers & S12) == S12) {
28     if (buildTitle) {
29 pam-fi 1.1 if (_nLayers > 0)
30     title += ",";
31     title += "S12";
32     }
33 pam-fi 1.1.2.1 _nLayers++;
34     }
35     if ((_layers & S21) == S21) {
36     if (buildTitle) {
37 pam-fi 1.1 if (_nLayers > 0)
38     title += ",";
39     title += "S21";
40     }
41 pam-fi 1.1.2.1 _nLayers++;
42     }
43     if ((_layers & S22) == S22) {
44     if (buildTitle) {
45 pam-fi 1.1 if (_nLayers > 0)
46     title += ",";
47     title += "S22";
48     }
49 pam-fi 1.1.2.1 _nLayers++;
50     }
51     if ((_layers & S31) == S31) {
52     if (buildTitle) {
53 pam-fi 1.1 if (_nLayers > 0)
54     title += ",";
55     title += "S31";
56     }
57 pam-fi 1.1.2.1 _nLayers++;
58     }
59     if ((_layers & S32) == S32) {
60     if (buildTitle) {
61 pam-fi 1.1 if (_nLayers > 0)
62     title += ",";
63     title += "S32";
64     }
65 pam-fi 1.1.2.1 _nLayers++;
66     }
67     if (buildTitle)
68 pam-fi 1.1 title += ") Vs Beta";
69    
70 pam-fi 1.1.2.1 SetTitle(title);
71 pam-fi 1.1
72     }
73    
74     void TofDedxVsBetaHistoAction::OnGood(PamLevel2 *event) {
75    
76     static float dEdx;
77     static float dEdxLayer;
78     static unsigned int badLayers;
79    
80     static int trkSeqNo;
81 pam-fi 1.1.2.2 static int idx;
82 pam-fi 1.1 if (_standAlone)
83 pam-fi 1.1.2.2 trkSeqNo = -1;
84 pam-fi 1.1 else
85 pam-fi 1.1.2.2 trkSeqNo = event->GetTrack(0)->GetTrkTrack()->GetSeqNo();
86    
87     for (int i = 0; i < event->GetToFLevel2()->ntrk(); i++) {
88     if (event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == trkSeqNo)
89     idx = i;
90     }
91 pam-fi 1.1
92     dEdx = 0.;
93     badLayers = 0;
94     if ((_layers & S11) == S11) {
95 pam-fi 1.1.2.2 dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 0, 100);
96 pam-fi 1.1 if (dEdxLayer > 0. && dEdxLayer < 4090)
97     dEdx += dEdxLayer;
98     else
99     badLayers++;
100     }
101     if ((_layers & S12) == S12) {
102 pam-fi 1.1.2.2 dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 1, 100);
103 pam-fi 1.1 if (dEdxLayer > 0. && dEdxLayer < 4090)
104     dEdx += dEdxLayer;
105     else
106     badLayers++;
107     }
108     if ((_layers & S21) == S21) {
109 pam-fi 1.1.2.2 dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 2, 100);
110 pam-fi 1.1 if (dEdxLayer > 0. && dEdxLayer < 4090)
111     dEdx += dEdxLayer;
112     else
113     badLayers++;
114     }
115     if ((_layers & S22) == S22) {
116 pam-fi 1.1.2.2 dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 3, 100);
117 pam-fi 1.1 if (dEdxLayer > 0. && dEdxLayer < 4090)
118     dEdx += dEdxLayer;
119     else
120     badLayers++;
121     }
122     if ((_layers & S31) == S31) {
123 pam-fi 1.1.2.2 dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 4, 100);
124 pam-fi 1.1 if (dEdxLayer > 0. && dEdxLayer < 4090)
125     dEdx += dEdxLayer;
126     else
127     badLayers++;
128     }
129     if ((_layers & S32) == S32) {
130 pam-fi 1.1.2.2 dEdxLayer = event->GetToFLevel2()->GetdEdx(idx, 5, 100);
131 pam-fi 1.1 if (dEdxLayer > 0. && dEdxLayer < 4090)
132     dEdx += dEdxLayer;
133     else
134     badLayers++;
135     }
136     if (badLayers == 0) {
137     dEdx /= _nLayers - badLayers;
138 pam-fi 1.1.2.2 Fill(event->GetToFLevel2()->GetToFTrkVar(idx)->beta[12], dEdx);
139 pam-fi 1.1 }
140     else
141     _badEvents++;
142     }
143    

  ViewVC Help
Powered by ViewVC 1.1.23