BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
T0Calib.cpp
Go to the documentation of this file.
1#include "include/T0Calib.h"
2#include "include/fun.h"
3
5 cout << "Calibration type: T0Calib" << endl;
6}
7
9}
10
11void T0Calib::init(TObjArray* hlist, MdcCosGeom* pGeom){
12 CalibBase::init(hlist, pGeom);
13
14 m_pGeom = pGeom;
15
16 m_fdT0 = new TFolder("fdt0","fdt0");
17 hlist->Add(m_fdT0);
18
19 m_fdResiWire = new TFolder("resiWire", "resiWire");
20 hlist->Add(m_fdResiWire);
21
22 char hname[200];
23 for(int i=0; i<NWIRE; i++){
24 int lay = pGeom -> getWire(i) -> getLayerId();
25 int cel = pGeom -> getWire(i) -> getCellId();
26
27 sprintf(hname, "mResi%04d_Lay%02d_Cell%03d_L", i, lay, cel);
28 m_hleft[i] = new TH1F(hname, "", 400, -2.0, 2.0);
29 m_fdT0 -> Add(m_hleft[i]);
30
31 sprintf(hname, "mResi%04d_Lay%02d_Cell%03d_R", i, lay, cel);
32 m_hright[i] = new TH1F(hname, "", 400, -2.0, 2.0);
33 m_fdT0 -> Add(m_hright[i]);
34 }
35 m_hLrResiSum = new TH1F("mLrResiSum", "", 200, -0.5, 0.5);
36 m_fdResiWire->Add(m_hLrResiSum);
37
38 m_hLrResiSub = new TH1F("mLrResiSub", "", 200, -0.5, 0.5);
39 m_fdResiWire->Add(m_hLrResiSub);
40}
41
42void T0Calib::mergeHist(TFile* fhist){
44
45 char hname[200];
46 TFolder* fd = (TFolder*)fhist->Get("fdT0");
47 for(int i=0; i<NWIRE; i++){
48 int lay = m_pGeom -> getWire(i) -> getLayerId();
49 int cel = m_pGeom -> getWire(i) -> getCellId();
50
51 sprintf(hname, "Resi%04d_Lay%02d_Cell%03d_L", i, lay, cel);
52 TH1F* hl = (TH1F*)fd->FindObjectAny(hname);
53 m_hleft[i]->Add(hl);
54
55 sprintf(hname, "Resi%04d_Lay%02d_Cell%03d_R", i, lay, cel);
56 TH1F* hr = (TH1F*)fd->FindObjectAny(hname);
57 m_hright[i]->Add(hr);
58 }
59}
60
61void T0Calib::calib(MdcCalibConst* calconst, TObjArray* newXtList, TObjArray* r2tList){
62 CalibBase::calib(calconst, newXtList, r2tList);
63
64 double vdr = 0.03;
65 for(int i=0; i<NWIRE; i++){
66 Stat_t entry_l = m_hleft[i] -> GetEntries();
67 double mean_l = m_hleft[i] -> GetMean();
68 if(entry_l < 50) mean_l = 0.0;
69
70 Stat_t entry_r = m_hright[i] -> GetEntries();
71 double mean_r = m_hright[i] -> GetMean();
72 if(entry_r < 50) mean_r = 0.0;
73
74 double delt0 = 0.5 * (mean_l + mean_r) / vdr;
75 double resiLrSum = 0.5 * (mean_l + mean_r);
76 double resiLrSub = 0.5 * (mean_l - mean_r);
77 m_hLrResiSum->Fill(resiLrSum);
78 m_hLrResiSub->Fill(resiLrSub);
79
80 double t0 = calconst->getT0(i);
81 t0 += delt0;
82 calconst->resetT0(i, t0);
83 calconst->resetDelT0(i, delt0);
84 }
85 renameHist();
86}
87
88void T0Calib::renameHist(){
89 char hname[200];
90 m_fdT0->SetName("fdT0");
91 for(int i=0; i<NWIRE; i++){
92 int lay = m_pGeom -> getWire(i) -> getLayerId();
93 int cel = m_pGeom -> getWire(i) -> getCellId();
94 sprintf(hname, "Resi%04d_Lay%02d_Cell%03d_L", i, lay, cel);
95 m_hleft[i]->SetName(hname);
96 sprintf(hname, "Resi%04d_Lay%02d_Cell%03d_R", i, lay, cel);
97 m_hright[i]->SetName(hname);
98 }
99
100 m_fdResiWire->SetName("ResiWire");
101 m_hLrResiSum->SetName("LrResiSum");
102 m_hLrResiSub->SetName("LrResiSub");
103}
virtual void init(TObjArray *hlist, MdcCosGeom *pGeom)=0
Definition: CalibBase.cpp:14
virtual void mergeHist(TFile *fhist)=0
Definition: CalibBase.cpp:365
virtual void calib(MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)=0
Definition: CalibBase.cpp:711
double getT0(int wireid) const
void resetDelT0(int wireid, double val)
void resetT0(int wireid, double val)
T0Calib()
Definition: T0Calib.cpp:4
void init(TObjArray *hlist, MdcCosGeom *pGeom)
Definition: T0Calib.cpp:11
void mergeHist(TFile *fhist)
Definition: T0Calib.cpp:42
~T0Calib()
Definition: T0Calib.cpp:8
void calib(MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)
Definition: T0Calib.cpp:61
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
mg Add(gr3)