/[PAMELA software]/PamCut/CollectionActions/ChargeHistosAction/ChargeHistosAction.cpp
ViewVC logotype

Annotation of /PamCut/CollectionActions/ChargeHistosAction/ChargeHistosAction.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Mon Jun 8 10:37:22 2009 UTC (15 years, 6 months ago) by pam-fi
Branch: MAIN
CVS Tags: Root_V8, MergedToHEAD_1, nuclei_reproc, MergedFromV8_1, BeforeMergingFromV8_1, V9, HEAD
Branch point for: V8
Changes since 1.1: +3 -3 lines
Added support for append mode for output file.

1 pam-fi 1.1 /*
2     * ChargeHistosAction.cpp
3     *
4     * Created on: 17-mag-2009
5     * Author: Nicola Mori
6     */
7    
8     /*! @file ChargeHistosAction.cpp The ChargeHistosAction class implementation file */
9    
10     #include "ChargeHistosAction.h"
11    
12 pam-fi 1.2 ChargeHistosAction::ChargeHistosAction(const char *actionName, TString outFileName, TString mode) :
13 pam-fi 1.1 CollectionAction(actionName),
14     #ifndef NO_TOFNUCLEI
15     _tofNuclei(NULL),
16     _chargeS11("chargeS11", "Charge S11", 100, 0., 4.),
17     _chargeS12("chargeS12", "Charge S12", 100, 0., 4.),
18     _chargeS21("chargeS21", "Charge S21", 100, 0., 4.),
19     _chargeS22("chargeS22", "Charge S22", 100, 0., 4.),
20     _chargeS31("chargeS31", "Charge S31", 100, 0., 4.),
21     _chargeS32("chargeS32", "Charge S32", 100, 0., 4.),
22     _chCorrS11S12("chCorrS11S12", "Z(S11) vs Z(s12)", 100, 0., 4., 100, 0., 4.),
23     _chCorrS11S21("chCorrS11S21", "Z(S11) vs Z(s21)", 100, 0., 4., 100, 0., 4.),
24     _chCorrS11S22("chCorrS11S22", "Z(S11) vs Z(s22)", 100, 0., 4., 100, 0., 4.),
25     _chCorrS11S31("chCorrS11S31", "Z(S11) vs Z(s31)", 100, 0., 4., 100, 0., 4.),
26     _chCorrS11S32("chCorrS11S32", "Z(S11) vs Z(s32)", 100, 0., 4., 100, 0., 4.),
27     _chCorrS12S21("chCorrS12S21", "Z(S12) vs Z(s21)", 100, 0., 4., 100, 0., 4.),
28     _chCorrS12S22("chCorrS12S22", "Z(S12) vs Z(s22)", 100, 0., 4., 100, 0., 4.),
29     _chCorrS12S31("chCorrS12S31", "Z(S12) vs Z(s31)", 100, 0., 4., 100, 0., 4.),
30     _chCorrS12S32("chCorrS12S32", "Z(S12) vs Z(s32)", 100, 0., 4., 100, 0., 4.),
31     _chCorrS21S22("chCorrS21S22", "Z(S21) vs Z(s22)", 100, 0., 4., 100, 0., 4.),
32     _chCorrS21S31("chCorrS21S31", "Z(S21) vs Z(s31)", 100, 0., 4., 100, 0., 4.),
33     _chCorrS21S32("chCorr212S32", "Z(S21) vs Z(s32)", 100, 0., 4., 100, 0., 4.),
34     _chCorrS22S31("chCorrS22S31", "Z(S22) vs Z(s31)", 100, 0., 4., 100, 0., 4.),
35     _chCorrS22S32("chCorrS22S32", "Z(S22) vs Z(s32)", 100, 0., 4., 100, 0., 4.),
36     _chCorrS31S32("chCorrS31S32", "Z(S31) vs Z(s32)", 100, 0., 4., 100, 0., 4.),
37     #endif
38     #ifndef NO_CALONUCLEI
39     _caloNuclei(NULL),
40     _chargeCalo("chargeCalo", "Charge Calo", 100, 0., 4.),
41     #endif
42     #ifndef NO_TRKNUCLEI
43     _trkNuclei(NULL),
44     _chargeTrk("chargeTrk", "Charge Trk", 100, 0., 4.),
45     #endif
46 pam-fi 1.2 _outFileName(outFileName), _mode(mode) {
47 pam-fi 1.1 }
48    
49    
50     ChargeHistosAction::~ChargeHistosAction(){
51     #ifndef NO_TOFNUCLEI
52     delete _tofNuclei;
53     _tofNuclei = NULL;
54     #endif
55    
56     #ifndef NO_CALONUCLEI
57     delete _caloNuclei;
58     _caloNuclei = NULL;
59     #endif
60    
61     #ifndef NO_TRKNUCLEI
62     delete _trkNuclei;
63     _trkNuclei = NULL;
64     #endif
65     }
66    
67    
68    
69     void ChargeHistosAction::OnGood(PamLevel2 *event) {
70    
71     #ifndef NO_TOFNUCLEI
72     if (_tofNuclei == NULL)
73     _tofNuclei = new ToFNuclei(event);
74    
75     Float_t *charge = _tofNuclei->Get_Charge_ToF_std_layer();
76    
77     _chargeS11.Fill(charge[0]);
78     _chargeS12.Fill(charge[1]);
79     _chargeS21.Fill(charge[2]);
80     _chargeS22.Fill(charge[3]);
81     _chargeS31.Fill(charge[4]);
82     _chargeS32.Fill(charge[5]);
83    
84     _chCorrS11S12.Fill(charge[1], charge[0]);
85     _chCorrS11S21.Fill(charge[2], charge[0]);
86     _chCorrS11S22.Fill(charge[3], charge[0]);
87     _chCorrS11S31.Fill(charge[4], charge[0]);
88     _chCorrS11S32.Fill(charge[5], charge[0]);
89     _chCorrS12S21.Fill(charge[2], charge[1]);
90     _chCorrS12S22.Fill(charge[3], charge[1]);
91     _chCorrS12S31.Fill(charge[4], charge[1]);
92     _chCorrS12S32.Fill(charge[5], charge[1]);
93     _chCorrS21S22.Fill(charge[3], charge[2]);
94     _chCorrS21S31.Fill(charge[4], charge[2]);
95     _chCorrS21S32.Fill(charge[5], charge[2]);
96     _chCorrS22S31.Fill(charge[4], charge[3]);
97     _chCorrS22S32.Fill(charge[5], charge[3]);
98     _chCorrS31S32.Fill(charge[5], charge[4]);
99     #endif
100    
101     #ifndef NO_CALONUCLEI
102     if (_caloNuclei == NULL)
103     _caloNuclei = new CaloNuclei(event);
104     _chargeCalo.Fill(_caloNuclei->Get_charge_siegen1());
105     #endif
106    
107     #ifndef NO_TRKNUCLEI
108     if (_trkNuclei == NULL)
109     _trkNuclei = new TrkNuclei();
110     _trkNuclei->Set(event->GetTrack(0)->GetTrkTrack());
111     _chargeTrk.Fill(_trkNuclei->GetZ_Rigidity());
112     #endif
113    
114     }
115    
116     void ChargeHistosAction::Finalize() {
117 pam-fi 1.2 TFile outFile(_outFileName, _mode);
118 pam-fi 1.1 outFile.cd();
119    
120     #ifndef NO_TOFNUCLEI
121     _chargeS11.Write();
122     _chargeS12.Write();
123     _chargeS21.Write();
124     _chargeS22.Write();
125     _chargeS31.Write();
126     _chargeS32.Write();
127    
128     _chCorrS11S12.Write();
129     _chCorrS11S21.Write();
130     _chCorrS11S22.Write();
131     _chCorrS11S31.Write();
132     _chCorrS11S32.Write();
133     _chCorrS12S21.Write();
134     _chCorrS12S22.Write();
135     _chCorrS12S31.Write();
136     _chCorrS12S32.Write();
137     _chCorrS21S22.Write();
138     _chCorrS21S31.Write();
139     _chCorrS21S32.Write();
140     _chCorrS22S31.Write();
141     _chCorrS22S32.Write();
142     _chCorrS31S32.Write();
143     #endif
144    
145     #ifndef NO_CALONUCLEI
146     _chargeCalo.Write();
147     #endif
148    
149     #ifndef NO_TRKNUCLEI
150     _chargeTrk.Write();
151     #endif
152    
153     outFile.Close();
154    
155     }

  ViewVC Help
Powered by ViewVC 1.1.23