showTritium.cxx

Vratislav Chudoba, 07/11/2018 10:54 AM

Download (7.29 KB)

 
1
#include "TSystem.h"
2
#include "TFile.h"
3
#include "TTree.h"
4
#include "TChain.h"
5
#include "TCanvas.h"
6
#include "TBox.h"
7
#include "TCut.h"
8
#include "TCutG.h"
9
#include "TROOT.h"
10

    
11
using std::cout;
12
using std::endl;
13

    
14
void showTritium(const Long64_t drawEntries = 100000)
15
{
16
//        const Long64_t drawEntries = 100000;
17

    
18
//        TFile *fr = new TFile("~/data/exp1804/h5_11_00.root");
19
        TChain *tr = new TChain("AnalysisxTree");
20
        tr->Add("~/data/exp1804/h5_14_0?.root");
21
//        tr->Add("~/data/exp1804/be10_0?_?0.root");
22

    
23

    
24
        TChain *trCal = new TChain("cal");
25
//        trCal->Add("~/data/exp1804/h5_11_0?_calib.root");
26
        trCal->Add("~/data/exp1804/h5_14_0?_calib.root");
27
//        trCal->Add("~/data/exp1804/be10_0?_?0_calib.root");
28

    
29
        tr->AddFriend(trCal);
30

    
31
        TFile *fc = new TFile("cutsIdentification.root", "READ");
32
        TCutG *cUS = (TCutG*)fc->Get("c7UpperShadow");
33
        TCutG *cLS = (TCutG*)fc->Get("c7LowerShadow");
34
        cLS->SetLineColor(kMagenta);
35
        TCutG *cMA = (TCutG*)fc->Get("c7MainAlpha");
36
        TCutG *cA = (TCutG*)fc->Get("c7All");
37
        TCutG *cBL = (TCutG*)fc->Get("cBeamLeft");
38
        TCutG *cBR = (TCutG*)fc->Get("cBeamRight");
39

    
40

    
41
        tr->GetListOfFiles()->Print();
42
        trCal->GetListOfFiles()->Print();
43

    
44
        cout << tr->GetEntries() << " events." << endl;
45
        cout << trCal->GetEntries() << " calibrated events." << endl;
46

    
47
        TString varName;
48
        TString condition;
49

    
50
        cout << drawEntries << " entries in input chain will be processed." << endl;
51

    
52
        const Int_t firstThinStrip = 5;
53

    
54
        TFile *fCutsTime = new TFile("cutsTimeCsI.root");
55
        TFile *fCutsTritium = new TFile("cutsDeltaEtritium.root");
56
        TCutG *currCut;
57
        TString cutName;
58

    
59
        TString timeSiCondition;
60
        timeSiCondition.Form("0.3*tSQX_R[0]-0.125*tF5[0]<100");
61
        //        TString auxCon;
62
        for (Int_t j = 1; j<32; j++) {
63
                condition.Form(" && 0.3*tSQX_R[%d]-0.125*tF5[0]<100", j);
64
                timeSiCondition.Append(condition);
65
        }
66
        cout << timeSiCondition << endl;
67

    
68
/////////////////////////////////////////////////////////////////////
69
//        c1
70

    
71

    
72
        TCanvas *c1 = new TCanvas("c1", "tritium raw", 1600, 800);
73
        c1->Divide(4,2);
74

    
75
        for (Int_t i = 0; i < 8; i++) {
76
                c1->cd(i+1);
77

    
78
                varName.Form("SQRXE:NeEvent.CsI_R[%d]", i+firstThinStrip);
79
                condition.Form("NeEvent.CsI_R[%d]<4000 "
80
                                "&& SQRXEsum<40 && SQRXmult==1 && SQRXE[0]<1 "
81
                                "&& trigger==3",
82
                                i+firstThinStrip);
83

    
84

    
85
                tr->SetMarkerColor(kBlack);
86
                tr->SetMarkerStyle(20);
87
                tr->SetMarkerSize(0.1);
88
                tr->Draw(varName, condition, "", drawEntries);
89
                c1->Update();
90
        }//*/
91
//        return;
92

    
93
/////////////////////////////////////////////////////////////////////
94
//        c2
95

    
96
        TCanvas *c2 = new TCanvas("c2", "time from right Si", 1600, 800);
97
        c2->Divide(4,2);
98

    
99
        for (Int_t i = 0; i < 8; i++) {
100
                c2->cd(i+1);
101
//                varName.Form("SQ20E[%d]:SQLYEsum", i+firstThinStrip);
102
                varName.Form("SQRXE[%d]:0.3*tSQX_R[%d]-0.125*tF5[0]", i+firstThinStrip, i+firstThinStrip);
103
                condition.Form("tSQX_R[%d]>0"
104
//                                "&& SQLYEsum>1.1 && SQLYEsum<30 "
105
//                                "&& SQLYE[0]<1. && SQLYE[15]<1."
106
//                                "&& SQLYmult==1 && SQLXmult==1"
107
                                "&& trigger==3",
108
                                i+firstThinStrip);
109
                tr->SetMarkerColor(kBlack);
110
                tr->Draw(varName, condition, "", drawEntries);
111
//                tr->Draw(varName, condition, "", drawEntries);
112

    
113

    
114
                condition.Form(
115
//                                "tSQX_R[%d]>0"
116
//                                "&& 0.3*tSQX_R-0.125*tF5[0] <100 "
117
                                //                                "&& SQLYE[0]<1. && SQLYE[15]<1."
118
                                //                                "&& SQLYmult==1 && SQLXmult==1"
119
                                "trigger==3 && %s",
120
//                                i+firstThinStrip,
121
                                timeSiCondition.Data());
122

    
123
                tr->SetMarkerColor(kRed);
124
                tr->Draw(varName, condition, "same", drawEntries);
125

    
126
                c2->Update();
127
        }//for */
128

    
129

    
130

    
131
//        return;
132

    
133
/////////////////////////////////////////////////////////////////////
134
//        c3
135

    
136
        TCanvas *c3 = new TCanvas("c3", "time from CsI", 1000, 900);
137
        c3->Divide(4,4);
138

    
139
//        gROOT->ProcessLine(".x cutPokus.cxx");
140

    
141

    
142

    
143
        for (Int_t i = 0; i < 16; i++) {
144
                c3->cd(i+1);
145
//                varName.Form("SQRXE[%d]:0.3*tSQX_R[%d]-0.125*tF5[]", i+firstThinStrip, i+firstThinStrip);
146
//                condition.Form("SQRXE[%d]>3 && trigger==3",
147
//                                i+firstThinStrip);
148
                cutName.Form("cTime%d", i);
149
                currCut = (TCutG*)fCutsTime->Get(cutName);
150

    
151
                varName.Form("CsI_R[%d]:0.125*tCsI_R[%d]-0.125*tF5[0]", i, i);
152
                condition.Form("CsI_R[%d]>3 && trigger==3"
153
                                "&& 0.125*tCsI_R[%d]-0.125*tF5[0] > -80"
154
                                "&& 0.125*tCsI_R[%d]-0.125*tF5[0] < 0"
155
                                "&& CsI_R[%d] < 4500",
156
                                i, i, i, i);
157

    
158
                tr->SetMarkerColor(kBlack);
159
                tr->Draw(varName, condition, "", drawEntries);
160
//                tr->Draw(varName, condition, "", drawEntries);
161

    
162
                currCut->Draw("same");
163

    
164
                c3->Update();
165
        }//*/
166

    
167

    
168

    
169
//        return;
170

    
171
/////////////////////////////////////////////////////////////////////
172
        //        c4
173

    
174
        TCanvas *c4 = new TCanvas("c4", "PID plot from CsI filtered for time", 1600, 800);
175
        c4->Divide(4,2);
176

    
177

    
178
        for (Int_t i = 0; i < 8; i++) {
179
                c4->cd(i+1);
180

    
181
                cutName.Form("cTime%d", i+firstThinStrip);
182
                currCut = (TCutG*)fCutsTime->Get(cutName);
183

    
184
                varName.Form("SQRXE:NeEvent.CsI_R[%d]", i+firstThinStrip);
185
                condition.Form("NeEvent.CsI_R[%d]<3500"
186
                                "&& SQRXEsum<25 && SQRXEsum>1 && SQRXmult==1"
187
                                "&& trigger==3 && %s && %s",
188
                                i+firstThinStrip, cutName.Data(), timeSiCondition.Data());
189
                tr->SetMarkerColor(kBlack);
190
                tr->Draw(varName, condition, "", drawEntries);
191
//                tr->Draw(varName, "", "", drawEntries);
192
                //                tr->Draw(varName, condition, "", drawEntries);
193

    
194
//                tAlphaCal->Draw(varName, "", "same");
195

    
196
                cutName.Form("cutEnergy%d", i+firstThinStrip);
197
                currCut = (TCutG*)fCutsTritium->Get(cutName);
198

    
199
                currCut->Draw("same");
200

    
201
                c4->Update();
202
        }//*/
203

    
204
//        return;
205

    
206
/////////////////////////////////////////////////////////////////////
207
//        c5
208

    
209
        TCanvas *c5 = new TCanvas("c5", "PID plot from CsI filtered for time", 1000, 1000);
210
        c5->Divide(4,4);
211

    
212
        TCutG *currCutTritium;
213
        TString cutNameTritium;
214

    
215
        TString cutHe("(cutHe0");
216
        TString cutNameHe;
217
        TFile *fCutsHelium = new TFile("cutsDeltaEhelium.root");
218
        TCutG *cutsHe[14];
219
        for (Int_t i = 0; i<14; i++) {
220
                cutNameHe.Form("cutHe%d", i);
221
                cutsHe[i] = (TCutG*)fCutsHelium->Get(cutNameHe);
222
                cutName.Form(" || %s", cutNameHe.Data());
223
                if (i>0) cutHe.Append(cutName);
224
        }
225
        cutHe.Append(")");
226

    
227
        cout << endl << endl << cutHe << endl;
228

    
229
        Int_t numberOfHe[16];
230

    
231
        for (Int_t i = 0; i < 16; i++) {
232
                c5->cd(i+1);
233

    
234
                cutName.Form("cTime%d", i);
235
                currCut = (TCutG*)fCutsTime->Get(cutName);
236

    
237
                cutNameTritium.Form("cutEnergy%d", i);
238
                currCutTritium = (TCutG*)fCutsTritium->Get(cutNameTritium);
239

    
240
                varName.Form("SQRXE:NeEvent.CsI_R[%d]", i);
241
                condition.Form("NeEvent.CsI_R[%d]<3500"
242
                                "&& SQRXEsum<25 && SQRXEsum>1 && SQRXmult==1"
243
                                "&& trigger==3 && %s && %s",
244
                                i,
245
                                cutName.Data(), timeSiCondition.Data());
246
                tr->SetMarkerColor(kBlack);
247
                tr->SetMarkerStyle(20);
248
                tr->SetMarkerSize(.4);
249
                tr->Draw(varName, condition, "", drawEntries/100);
250
                //                tr->Draw(varName, "", "", drawEntries);
251
                //                tr->Draw(varName, condition, "", drawEntries);
252

    
253
                //                tAlphaCal->Draw(varName, "", "same");
254

    
255
//                cutName.Form("cutEnergy%d", i);
256
//                currCut = (TCutG*)fCutsTritium->Get(cutName);
257

    
258
                currCutTritium->Draw("same");
259
                c5->Update();
260

    
261
                condition.Form("NeEvent.CsI_R[%d]<3500"
262
                                "&& SQRXEsum<25 && SQRXEsum>1 && SQRXmult==1"
263
                                "&& trigger==3 && %s && %s && %s && %s",
264
                                i,
265
                                cutName.Data(), timeSiCondition.Data(), cutNameTritium.Data(), cutHe.Data());
266
                tr->SetMarkerColor(kRed);
267
                tr->SetMarkerStyle(20);
268
                tr->SetMarkerSize(1);
269
                numberOfHe[i] = tr->Draw(varName, condition, "same", drawEntries);
270
                cout << "CsI number " << i << ": " << numberOfHe[i] << " events" << endl;
271

    
272
                c5->Update();
273
        }
274

    
275
        cout << endl << endl;
276

    
277
        for (Int_t i = 0; i < 16; i++) {
278
                cout << "CsI number " << i << ": " << numberOfHe[i] << " events" << endl;
279
        }
280

    
281

    
282
        return;
283

    
284
}