BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
slope.cxx
Go to the documentation of this file.
1// simply add a slope to the calibrations constants to solve the positive/negative
2// unsymmetry problem
3//1=0.0; 2=-0.05; 3=-0.1; 4=-0.15
4// high and low corresponding to momentum
5//const double k_high = 0.07;
6//const double k_low = 0.07;
7const double k_high = 0.0;
8const double k_low = 0.0;
9const double b= 1.0;
10const bool b_trunc = true;
11
12void slope()
13{
14 TFile *f=new TFile("eangle.root");
15 ostringstream strout;
16 strout<<"ddgcalib";
17 TTree *tree = f->Get(strout.str().c_str());
18 double dedx[100],eangle[100], fitmean[100], fitmeanerr[100];
19 double pos_fitmean[100], pos_fitmeanerr[100], neg_fitmean[100], neg_fitmeanerr[100];
20 // tree->SetBranchAddress("gain",dedx);
21 if(b_trunc) tree->SetBranchAddress("truncgain",dedx);
22 else tree->SetBranchAddress("gain",dedx);
23 tree->SetBranchAddress("eangle",eangle);
24 tree->SetBranchAddress("fitmean",fitmean);
25 tree->SetBranchAddress("fitmeanerr",fitmeanerr);
26 tree->SetBranchAddress("pos_fitmean",pos_fitmean);
27 tree->SetBranchAddress("pos_fitmeanerr",pos_fitmeanerr);
28 tree->SetBranchAddress("neg_fitmean",neg_fitmean);
29 tree->SetBranchAddress("neg_fitmeanerr",neg_fitmeanerr);
30
31 cout<<"Entries: "<<tree->GetEntries()<<endl;
32 tree->GetEntry(0);
33
34 int entry[1] = {100};
35 double denangle[100];
36 // for(int i=0; i<100; i++) denangle[i] = (dedx[i])*(k*(eangle[i])+b); // correct by a slope
37 // next we try sub-region correction with a slope
38 for(int i=0; i<100; i++){
39 if(fabs(eangle[i])<=0.04) denangle[i] = (dedx[i])*(k_high*(eangle[i])+b);
40 // cout << "eangle: " << eangle[i] << endl;
41 else denangle[i] = (dedx[i])*(k_low*(eangle[i])+b); // correct by a slope
42 }
43 TFile *f_save = new TFile("eangle_new.root","recreate");
44 TTree* entra = new TTree("entracalib", "entracalib");
45 entra->Branch("1denangle_entry", entry, "entry[1]/I");
46 entra->Branch("1denangle", denangle, "denangle[100]/D");
47 entra->Fill();
48 entra->Write();
49 f_save->Close();
50 f->Close();
51}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
const bool b_trunc
Definition: slope.cxx:10
void slope()
Definition: slope.cxx:12
const double k_high
Definition: slope.cxx:7
const double b
Definition: slope.cxx:9
const double k_low
Definition: slope.cxx:8