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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Thu Jul 28 13:27:46 2011 UTC (13 years, 4 months ago) by pam-fi
Branch: MAIN
Branch point for: V8
Added to repository.

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

  ViewVC Help
Powered by ViewVC 1.1.23