1
|
#include <string.h>
|
2
|
#include <iostream.h>
|
3
|
#include <fstream.h>
|
4
|
#include "TSystem.h"
|
5
|
#include "TFile.h"
|
6
|
#include "TTree.h"
|
7
|
|
8
|
|
9
|
using namespace std;
|
10
|
|
11
|
void fill1mm(){
|
12
|
|
13
|
string input_file_name_cs = "/media/users_NAS/Muzalevsky/exp1803/calSi/si_20_03_0002.root";
|
14
|
Int_t max_channel = 300;
|
15
|
|
16
|
TTree* t;
|
17
|
UShort_t NeEvent_SQ20[16];
|
18
|
UShort_t NeEvent_SQX_L[32];
|
19
|
TBranch *b_NeEvent_SQ20;
|
20
|
TBranch *b_NeEvent_SQX_L;
|
21
|
|
22
|
|
23
|
|
24
|
Float_t parSQ1[32], parSQ2[32],par201[16],par202[16];
|
25
|
TString line1;
|
26
|
ifstream myfile1;
|
27
|
Int_t count=0;
|
28
|
myfile1.open("/home/muzalevsky/AculUti/exp1803/cali1mm/calDL/SQX_L.cal");
|
29
|
while (! myfile1.eof() ){
|
30
|
line1.ReadLine(myfile1);
|
31
|
|
32
|
|
33
|
if(line1.IsNull()) break;
|
34
|
sscanf(line1.Data(),"%g %g", parSQ1+count,parSQ2+count);
|
35
|
count++;
|
36
|
}
|
37
|
cout << " pars for 1mm " << endl;
|
38
|
for(Int_t i=0;i<32;i++){
|
39
|
cout << parSQ1[i] << " " << parSQ2[i] << endl;
|
40
|
}
|
41
|
|
42
|
|
43
|
ifstream myfile2;
|
44
|
TString line2;
|
45
|
count=0;
|
46
|
myfile2.open("/home/muzalevsky/AculUti/macroexp18/si20cal/SQ20_58.cal");
|
47
|
while (! myfile2.eof() ){
|
48
|
line2.ReadLine(myfile2);
|
49
|
cout << line2.Data() << endl;
|
50
|
|
51
|
if(line2.IsNull()) break;
|
52
|
sscanf(line2.Data(),"%g %g", par201+count,par202+count);
|
53
|
count++;
|
54
|
}
|
55
|
cout << " pars for 20 mkm " << endl;
|
56
|
for(Int_t i=0;i<16;i++){
|
57
|
cout << par201[i] << " " << par202[i] << endl;
|
58
|
}
|
59
|
|
60
|
f = new TFile(input_file_name_cs.c_str());
|
61
|
f->GetObject("AnalysisxTree",t);
|
62
|
t->SetMakeClass(1);
|
63
|
t->SetBranchAddress("NeEvent.SQX_L[32]", NeEvent_SQX_L, &b_NeEvent_SQX_L);
|
64
|
t->SetBranchAddress("NeEvent.SQ20[16]", NeEvent_SQ20, &b_NeEvent_SQ20);
|
65
|
const Long64_t nentries1 = t->GetEntries();
|
66
|
cout << nentries1 << endl;
|
67
|
Float_t SQX_L[32],SQ20[16];
|
68
|
|
69
|
TFile *fw = new TFile("cal_20.root", "RECREATE");
|
70
|
TTree *tw = new TTree("cal", "20mk spec in energies");
|
71
|
tw->Branch("SQX_L",&SQX_L,"SQX_L[32]/F");
|
72
|
tw->Branch("SQ20",&SQ20,"SQ20[16]/F");
|
73
|
|
74
|
Int_t maxE = nentries1;
|
75
|
cout<<">>> filling TREE up to "<<maxE<< " event"<<endl;
|
76
|
for (Long64_t jentry=0; jentry<maxE;jentry++) {
|
77
|
t->GetEntry(jentry);
|
78
|
for(Int_t i=0; i<32; i++){
|
79
|
|
80
|
SQX_L[i]=0.;
|
81
|
if(i<16) {
|
82
|
SQ20[i]=0.;
|
83
|
}
|
84
|
|
85
|
if(NeEvent_SQX_L[i]>50.){
|
86
|
SQX_L[i] = NeEvent_SQX_L[i]*parSQ2[i] + parSQ1[i];
|
87
|
}
|
88
|
|
89
|
if(i<14){
|
90
|
if(NeEvent_SQ20[i]>200.) {
|
91
|
SQ20[i] = NeEvent_SQ20[i]*par202[i] + par201[i];
|
92
|
}
|
93
|
}
|
94
|
|
95
|
}
|
96
|
tw->Fill();
|
97
|
}
|
98
|
|
99
|
|
100
|
tw->Write();
|
101
|
fw->Close();
|
102
|
|
103
|
}
|