drawdeE.C

Vitaliy Schetinin, 04/13/2018 01:06 PM

Download (5.27 KB)

 
1
{
2
        TFile* f = new TFile("sim_digi.root");
3
           TTree* t = (TTree*)f->Get("er");
4
           t->AddFriend("er","reco.root");
5

    
6
        TCanvas *c1 = new TCanvas("c1", "Telescope Coordinate reconstruction", 1400, 1000);
7
        
8
        TClonesArray* T1_DoubleSi_points = new TClonesArray("ERQTelescopeSiPoint",100);
9
        
10
        TClonesArray* T1_SingleSi_digi = new TClonesArray("ERQTelescopeSiDigi",100);
11
        TClonesArray* T1_DoubleSi_digiX = new TClonesArray("ERQTelescopeSiDigi",100);
12
        TClonesArray* T1_DoubleSi_digiY = new TClonesArray("ERQTelescopeSiDigi",100);
13
        TClonesArray* T1_CsI_digi = new TClonesArray("ERQTelescopeCsIDigi",100);
14

    
15
        TClonesArray* T2_DoubleSi_points = new TClonesArray("ERQTelescopeSiPoint",100);
16

    
17
        TClonesArray* T2_DoubleSi_digiX = new TClonesArray("ERQTelescopeSiDigi",100);
18
        TClonesArray* T2_DoubleSi_digiY = new TClonesArray("ERQTelescopeSiDigi",100);
19
        TClonesArray* T2_CsI_digi = new TClonesArray("ERQTelescopeCsIDigi",100);
20

    
21
        
22
        t->SetBranchAddress("ERQTelescopeSiPoint_T1_DoubleSi_SD2_XY_0_X",&T1_DoubleSi_points);
23

    
24
        t->SetBranchAddress("ERQTelescopeSiDigi_T1_SingleSi_1_X_0",&T1_SingleSi_digi);
25
        t->SetBranchAddress("ERQTelescopeSiDigi_T1_DoubleSi_SD2_XY_0_X",&T1_DoubleSi_digiX);
26
        t->SetBranchAddress("ERQTelescopeSiDigi_T1_DoubleSi_SD2_XY_0_Y",&T1_DoubleSi_digiY);
27
        t->SetBranchAddress("ERQTelescopeCsIDigi_T1_CsI_1_0",&T1_CsI_digi);
28

    
29
        t->SetBranchAddress("ERQTelescopeSiPoint_T2_DoubleSi_SD2_XY_1_X",&T2_DoubleSi_points);
30

    
31
        t->SetBranchAddress("ERQTelescopeSiDigi_T2_DoubleSi_SD2_XY_1_X",&T2_DoubleSi_digiX);
32
        t->SetBranchAddress("ERQTelescopeSiDigi_T2_DoubleSi_SD2_XY_1_Y",&T2_DoubleSi_digiY);
33
        t->SetBranchAddress("ERQTelescopeCsIDigi_T2_CsI_1_1",&T2_CsI_digi);
34

    
35
        TH2F* T1deEHe3 = new TH2F("T1deEHe3","T1 de vs E He3",1000,0,0.25,1000,0,0.0014);
36
        T1deEHe3->GetXaxis()->SetTitle("E");
37
        T1deEHe3->GetYaxis()->SetTitle("de");
38
        TH2F* T1deEH3 = new TH2F("T1deEH3","T1 deE H3",1000,0,0.25,1000,0,0.0014);
39
        TH2F* T1deEOther = new TH2F("T1deEOther","T1 deE Other",1000,0,0.25,1000,0,0.0014);
40

    
41
        TH2F* T2deEHe3 = new TH2F("T2deEHe3","T2 de vs E He3",1000,0,0.25,1000,0,0.04);
42
        T2deEHe3->GetXaxis()->SetTitle("E");
43
        T2deEHe3->GetYaxis()->SetTitle("de");
44
        TH2F* T2deEH3 = new TH2F("T2deEH3","T2 deE H3",1000,0,0.25,1000,0,0.04);
45
        TH2F* T2deEOther = new TH2F("T2deEOther","T2 deE Other",1000,0,0.25,1000,0,0.04);
46
        
47

    
48
        TCanvas *c2 = new TCanvas("c2", "Telescope de/E on digi info", 1400, 1000);
49
        c2->Divide(2,1);
50

    
51
        Long64_t nentries = t->GetEntriesFast();
52
        //Long64_t nentries = 100;
53
        for (Long64_t i=0; i<nentries; i++) {
54
          t->GetEntry(i);
55

    
56
          if (T1_DoubleSi_digiX->GetEntriesFast() != 1)
57
                  continue;
58

    
59
          if (T1_SingleSi_digi->GetEntriesFast() != 1)
60
                  continue;
61

    
62

    
63
          Double_t de = ((ERQTelescopeSiDigi*)T1_SingleSi_digi->At(0))->GetEdep();
64
          Double_t E = ((ERQTelescopeSiDigi*)T1_SingleSi_digi->At(0))->GetEdep() + 
65
                                  (((ERQTelescopeSiDigi*)T1_DoubleSi_digiX->At(0))->GetEdep()        +
66
                                   ((ERQTelescopeSiDigi*)T1_DoubleSi_digiY->At(0))->GetEdep())/2.;
67
          
68
          for (Int_t iDigi = 0; iDigi < T1_CsI_digi->GetEntriesFast(); iDigi++){
69
                  E+= ((ERQTelescopeCsIDigi*)T1_CsI_digi->At(iDigi))->Edep();
70
          }
71

    
72
          Bool_t he3 = kFALSE;
73
          Bool_t h3 = kFALSE;
74
        
75
          for (Int_t iPoint = 0; iPoint < T1_DoubleSi_points->GetEntriesFast(); iPoint++){
76
                  ERQTelescopeSiPoint* p = (ERQTelescopeSiPoint*)T1_DoubleSi_points->At(iPoint);
77
                  if (p->GetPDG() == 1000020030)
78
                          he3 = kTRUE;
79
                  if (p->GetPDG() == 1000010030)
80
                          h3 = kTRUE;
81
          }
82

    
83
          if (he3)
84
                  T1deEHe3->Fill(E,de);
85
          else if (h3)
86
                  T1deEH3->Fill(E,de);
87
          else
88
                  T1deEOther->Fill(E,de);
89
        }
90

    
91
        c2->cd(1);
92
        T1deEHe3->SetMarkerColor(kBlue);
93
        T1deEHe3->SetMarkerStyle(21);
94
        T1deEHe3->Draw();
95
        T1deEH3->SetMarkerColor(kRed);
96
        T1deEH3->SetMarkerStyle(21);
97
        T1deEH3->Draw("same");
98
        T1deEOther->SetMarkerColor(kGreen);
99
        T1deEOther->SetMarkerStyle(21);
100
        T1deEOther->Draw("same");
101

    
102
        auto legend = new TLegend(0.7,0.5,0.95,0.7);
103
        legend->SetHeader("Ions");
104
        legend->AddEntry(T1deEHe3,"He3","p");
105
        legend->AddEntry(T1deEH3,"H3","p");
106
        legend->AddEntry(T1deEOther,"Others","p");
107
        legend->Draw();
108

    
109
        for (Long64_t i=0; i<nentries; i++) {
110
          t->GetEntry(i);
111

    
112
          if (T2_DoubleSi_digiX->GetEntriesFast() != 1)
113
                  continue;
114

    
115
          Double_t de = (((ERQTelescopeSiDigi*)T2_DoubleSi_digiX->At(0))->GetEdep()        +
116
                                   ((ERQTelescopeSiDigi*)T2_DoubleSi_digiY->At(0))->GetEdep())/2.;
117
          Double_t E = de;
118
          
119
          for (Int_t iDigi = 0; iDigi < T2_CsI_digi->GetEntriesFast(); iDigi++){
120
                  E+= ((ERQTelescopeCsIDigi*)T2_CsI_digi->At(iDigi))->Edep();
121
          }
122

    
123
          Bool_t he3 = kFALSE;
124
          Bool_t h3 = kFALSE;
125
        
126
          for (Int_t iPoint = 0; iPoint < T2_DoubleSi_points->GetEntriesFast(); iPoint++){
127
                  ERQTelescopeSiPoint* p = (ERQTelescopeSiPoint*)T2_DoubleSi_points->At(iPoint);
128
                  if (p->GetPDG() == 1000020030)
129
                          he3 = kTRUE;
130
                  if (p->GetPDG() == 1000010030)
131
                          h3 = kTRUE;
132
          }
133

    
134
          if (he3)
135
                  T2deEHe3->Fill(E,de);
136
          else if (h3)
137
                  T2deEH3->Fill(E,de);
138
          else
139
                  T2deEOther->Fill(E,de);
140
        }
141

    
142
        c2->cd(2);
143
        T2deEHe3->SetMarkerColor(kBlue);
144
        T2deEHe3->SetMarkerStyle(21);
145
        T2deEHe3->Draw();
146
        T2deEH3->SetMarkerColor(kRed);
147
        T2deEH3->SetMarkerStyle(21);
148
        T2deEH3->Draw("same");
149
        T2deEOther->SetMarkerColor(kGreen);
150
        T2deEOther->SetMarkerStyle(21);
151
        T2deEOther->Draw("same");
152

    
153
        legend = new TLegend(0.7,0.5,0.95,0.7);
154
        legend->SetHeader("Ions");
155
        legend->AddEntry(T2deEHe3,"He3","p");
156
        legend->AddEntry(T2deEH3,"H3","p");
157
        legend->AddEntry(T2deEOther,"Others","p");
158
        legend->Draw();
159
}