showBananas2.cxx

Draw some interesting pictures - Vratislav Chudoba, 06/17/2018 09:52 PM

Download (9.69 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

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

    
13
void showBananas2(const Long64_t drawEntries = 100000) {
14

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

    
20

    
21
        TChain *trCal = new TChain("cal");
22
//        trCal->Add("~/data/exp1804/h5_11_0?_calib.root");
23
//        trCal->Add("~/data/exp1804/h5_14_0?_calib.root");
24
        trCal->Add("~/data/exp1804/h5_14_0?_calib.root");
25

    
26
        tr->AddFriend(trCal);
27

    
28
        TFile *fcal = new TFile("~/data/exp1804/calib/si_20_03_calib.root");
29
        TTree *tAlphaCal = (TTree*)fcal->Get("cal");
30
        tAlphaCal->SetMarkerColor(kRed);
31
        tAlphaCal->SetMarkerStyle(20);
32
        tAlphaCal->SetMarkerSize(.6);
33

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

    
43

    
44
//        const Int_t drawEntries = 6000000;
45
//        const Int_t drawEntries = tr->GetEntries();
46

    
47
        tr->GetListOfFiles()->Print();
48
        trCal->GetListOfFiles()->Print();
49

    
50
        cout << tr->GetEntries() << " events." << endl;
51
        cout << trCal->GetEntries() << " calibrated events." << endl;
52

    
53
        TString varName;
54
        TString condition;
55

    
56
        cout << drawEntries << " entries in input chain will be processed." << endl;
57

    
58
        const Int_t firstThinStrip = 5;
59

    
60
/////////////////////////////////////////////////////////////////////
61
//        c1
62

    
63

    
64
        /*TCanvas *c1 = new TCanvas("c1", "time issues", 1600, 800);
65
        c1->Divide(4,2);
66

67
        for (Int_t i = 0; i < 8; i++) {
68
                c1->cd(i+1);
69
//                varName.Form("SQ20E[%d]:SQLYEsum", i+firstThinStrip);
70
                varName.Form("SQ20E[%d]:SQ20E[%d]+SQLYEsum", i+firstThinStrip, i+firstThinStrip);
71
                condition.Form("SQ20E[%d]>0 && SQ20E[%d]<14 && SQLYEsum>0. && SQLYEsum<120. && SQLYE[0]<1. && SQLYE[15]<1.", i+firstThinStrip, i+firstThinStrip);
72

73
                varName.Form("SQX_L[%d]:tSQX_L[%d]", i+firstThinStrip, i+firstThinStrip);
74
                condition.Form("tSQX_L[%d]>0 && SQX_L[%d]>0", i+firstThinStrip, i+firstThinStrip);
75

76

77
                tr->SetMarkerColor(kBlack);
78
                tr->SetMarkerStyle(20);
79
                tr->SetMarkerSize(0.1);
80
                tr->Draw(varName, condition, "", drawEntries);
81
                c1->Update();
82
        }
83
        return;*/
84

    
85
/////////////////////////////////////////////////////////////////////
86
//        c2
87

    
88
        TCanvas *c2 = new TCanvas("c2", "1 mm Y: 8-15 zoomed", 1600, 800);
89
        c2->Divide(4,2);
90

    
91
        for (Int_t i = 0; i < 8; i++) {
92
                c2->cd(i+1);
93
                varName.Form("SQ20E[%d]:SQLYEsum", i+firstThinStrip);
94
                varName.Form("SQ20E[%d]:SQ20E[%d]+SQLYEsum", i+firstThinStrip, i+firstThinStrip);
95
                condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5 "
96
                                "&& SQLYEsum>1.1 && SQLYEsum<30 "
97
                                "&& SQLYE[0]<1. && SQLYE[15]<1."
98
                                "&& SQLYmult==1 && SQLXmult==1"
99
                                "&& trigger==3",
100
                                i+firstThinStrip, i+firstThinStrip);
101
                tr->SetMarkerColor(kBlack);
102
                tr->Draw(varName, condition, "col", drawEntries);
103
//                tr->Draw(varName, condition, "", drawEntries);
104

    
105
                tAlphaCal->Draw(varName, "", "same");
106

    
107
                c2->Update();
108
        }//for */
109

    
110

    
111

    
112
//        return;
113

    
114
/////////////////////////////////////////////////////////////////////
115
//        c3
116

    
117
        TCanvas *c3 = new TCanvas("c3", "dE-E corrected", 1600, 800);
118
        c3->Divide(4,2);
119

    
120
        for (Int_t i = 0; i < 8; i++) {
121
                c3->cd(i+1);
122
//                varName.Form("SQ20Ecorr[%d]:SQLYEsum", i+firstThinStrip);
123
                varName.Form("SQ20Ecorr[%d]:SQ20Ecorr[%d]+SQLYEsum", i+firstThinStrip, i+firstThinStrip);
124
                varName.Form("SQ20Ecorr[%d]:SQ20Ecorr[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip);
125
                condition.Form("SQ20Ecorr[%d]>1.2 && SQ20Ecorr[%d]<5 "
126
                                "&& SQLYEsum>1.1 && SQLYEsum<30 "
127
                                "&& SQLXEsum>1.1 && SQLXEsum<30 "
128
                                "&& SQLYE[0]<1. && SQLYE[15]<1. "
129
                                "&& SQLYmult==1 && SQLXmult==1"
130
                                "&& trigger==3",
131
                                i+firstThinStrip, i+firstThinStrip);
132
                tr->SetMarkerColor(kBlack);
133
                tr->Draw(varName, condition, "col", drawEntries);
134
//                tr->Draw(varName, condition, "", drawEntries);
135

    
136
                tAlphaCal->Draw(varName, "", "same");
137

    
138
                c3->Update();
139
        }
140

    
141
        return;
142

    
143
/////////////////////////////////////////////////////////////////////
144
//        c4
145

    
146
        TCanvas *c4 = new TCanvas("c5", "MWPC: different dE-E regions", 1000, 1000);
147
        c4->Divide(2,2);
148

    
149
        c4->cd(1);
150
        tr->Draw("y1p:x1p>>hXY1dr(32, -20., 20., 32, -20., 20.)",
151
                        "TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && y1p>-50 && x1p>-50",
152
                        "col", 1000000);
153
        c4->Update();
154

    
155
        tr->SetMarkerStyle(20);
156
        tr->SetMarkerSize(0.4);
157

    
158
        condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3  && yt>-50 && xt>-50 && c7MainAlpha");
159
        tr->SetMarkerColor(kGreen);
160
        tr->SetMarkerSize(1.);
161
        tr->Draw(varName, condition, "same", drawEntries);
162
        c4->Update();
163

    
164
        condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3  && yt>-50 && xt>-50 && c7UpperShadow");
165
        tr->SetMarkerColor(kRed);
166
        tr->SetMarkerStyle(3);
167
        tr->SetMarkerSize(1.7);
168
        tr->Draw(varName, condition, "same", drawEntries);
169
        c4->Update();
170

    
171
        condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3  && yt>-50 && xt>-50 && c7LowerShadow");
172
        tr->SetMarkerColor(kMagenta);
173
        tr->SetMarkerStyle(20);
174
        tr->SetMarkerSize(1.);
175
        tr->Draw(varName, condition, "same", drawEntries);
176
        c4->Update();
177

    
178
        c4->cd(2);
179
        tr->Draw("y2p:x2p>>hXY2dr(32, -20., 20., 32, -20., 20.)",
180
                        "TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && y2p>-50 && x2p>-50",
181
                        "col", 1000000);
182
        c4->Update();
183

    
184
        c4->cd(4);
185
        condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3  && yt>-50 && xt>-50");
186
        varName.Form("yt:xt>>hXYtDR(32, -40., 40., 32, -40., 40.)");
187
        tr->Draw(varName, condition, "col", 100000);
188
        TBox *targetBoarder = new TBox(-25., 20., 25., -20.);
189
        targetBoarder->SetFillStyle(0);
190
        targetBoarder->SetLineWidth(3);
191
        targetBoarder->SetLineColor(kRed);
192
        targetBoarder->Draw();
193
        c4->Update();
194

    
195
        tr->SetMarkerStyle(20);
196
        tr->SetMarkerSize(0.4);
197

    
198
        varName.Form("yt:xt");
199

    
200
        condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3  && yt>-50 && xt>-50 && c7MainAlpha");
201
        tr->SetMarkerColor(kGreen);
202
        tr->SetMarkerSize(1.);
203
        tr->Draw(varName, condition, "same", drawEntries);
204
        c4->Update();
205

    
206
        condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3  && yt>-50 && xt>-50 && c7UpperShadow");
207
        tr->SetMarkerColor(kRed);
208
        tr->SetMarkerStyle(3);
209
        tr->SetMarkerSize(1.7);
210
        tr->Draw(varName, condition, "same", drawEntries);
211
        c4->Update();
212

    
213
        condition.Form("TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3  && yt>-50 && xt>-50 && c7LowerShadow");
214
        tr->SetMarkerColor(kMagenta);
215
        tr->SetMarkerStyle(20);
216
        tr->SetMarkerSize(1.);
217
        tr->Draw(varName, condition, "same", drawEntries);
218
        c4->Update();
219

    
220
/////////////////////////////////////////////////////////////////////
221
//        c5
222

    
223
        TCanvas *c5 = new TCanvas("c4", "MWPC", 1000, 1000);
224
        c5->Divide(2,2);
225

    
226
        c5->cd(4);
227
        condition.Form("TOF<185 && TOF>165 && trigger==3  && yt>-50 && xt>-50");
228
        varName.Form("yt:xt>>hXYt(32, -40., 40., 32, -40., 40.)");
229
        tr->Draw(varName, condition, "col", drawEntries);
230
        targetBoarder->Draw();
231
        c5->Update();
232

    
233
        c5->cd(1);
234
        tr->Draw("y1p:x1p>>hXY1(32, -20., 20., 32, -20., 20.)",
235
                        "TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && y1p>-50 && x1p>-50", "col", 1000000);
236
        cBL->Draw("same");
237
        cBR->Draw("same");
238
        c5->Update();
239

    
240
        c5->cd(2);
241
        tr->Draw("y2p:x2p>>hXY2(32, -20., 20., 32, -20., 20.)",
242
                        "TOF<185 && TOF>165 && dEbeam>600 && dEbeam<1150 && trigger==3 && y2p>-50 && x2p>-50", "col", 1000000);
243
        c5->Update();
244

    
245
        c5->cd(3);
246
        tr->Draw("dEbeam:TOF>>IDplot(200,,,200,,)", "TOF<200 && TOF>100 && dEbeam < 2500 && trigger==1", "col", 1000000);
247
        TBox *beamBox = new TBox(165, 1150, 185, 600);
248
        beamBox->SetFillStyle(0);
249
        beamBox->SetLineWidth(3);
250
        beamBox->SetLineColor(kRed);
251
        beamBox->Draw();
252
        c5->Update();
253

    
254
/////////////////////////////////////////////////////////////////////
255
//        c6
256

    
257
        TCanvas *c6 = new TCanvas("c6", "1 mm Y: 8-15 - target locus", 1600, 800);
258
        c6->Divide(4,2);
259
        TString cTarget("xt>-10. && xt<10. && yt>-15. && yt<15.");
260

    
261
        c6->cd(1);
262
        tr->Draw("SQ20E[0]:SQ20E[0]+SQLYEsum>>(200,0,5,200,0,5)", "", "", 100);
263

    
264
        for (Int_t i = 0; i < 8; i++) {
265
                c6->cd(i+1);
266
                varName.Form("SQ20E[%d]:SQ20E[%d]+SQLYEsum", i+firstThinStrip, i+firstThinStrip);
267
                condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5.5 && SQLYEsum>1.1 && SQLYEsum<30 && SQLYE[0]<1. && SQLYE[15]<1.",
268
                                i+firstThinStrip, i+firstThinStrip);
269
                tr->Draw(varName, condition, "col", drawEntries);
270
                c6->Update();
271

    
272
                condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5.5 && SQLYEsum>1.1 && SQLYEsum<30 && SQLYE[0]<1. && SQLYE[15]<1. && %s",
273
                                i+firstThinStrip, i+firstThinStrip, cTarget.Data());
274
                tr->SetMarkerColor(kRed);
275
                tr->SetMarkerStyle(20);
276
                tr->SetMarkerSize(.5);
277
                tr->Draw(varName, condition, "same", drawEntries);
278
                c6->Update();
279
        }
280

    
281
/////////////////////////////////////////////////////////////////////
282
//        c7
283

    
284
        TCanvas *c7 = new TCanvas("c7", "1 mm Y: 8-15", 1600, 800);
285
        c7->Divide(4,2);
286
        TString cStripsLow("SQLXE[0]<1. && SQLXE[1]<1. && SQLXE[2]<1. && SQLXE[3]<1. && SQLXE[4]<1. && SQLXE[5]<1. && SQLXE[6]<1. && SQLXE[7]<1. && SQLXE[8]<1. && SQLXE[9]<1. && SQLXE[10]<1.");
287
        TString cStripsHigh("SQLXE[31]<1. && SQLXE[30]<1. && SQLXE[29]<1. && SQLXE[28]<1. && SQLXE[27]<1. && SQLXE[26]<1. && SQLXE[25]<1. && SQLXE[24]<1. && SQLXE[23]<1. && SQLXE[22]<1. && SQLXE[21]<1. && SQLXE[20]<1.");
288

    
289
        for (Int_t i = 0; i < 8; i++) {
290
                c7->cd(i+1);
291
                varName.Form("SQ20E[%d]:SQ20E[%d]+SQLXEsum", i+firstThinStrip, i+firstThinStrip);
292
                condition.Form("SQ20E[%d]>1.2 && SQ20E[%d]<5.5 "
293
                                "&& SQLXEsum>1.1 && SQLXEsum<30 "
294
                                "&& %s && %s"
295
                                , i+firstThinStrip, i+firstThinStrip, cStripsLow.Data(), cStripsHigh.Data());
296
                tr->Draw(varName, condition, "col", drawEntries);
297
                c7->Update();
298
        }
299

    
300
        return;
301

    
302
}