BOSS 8.0.0
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
4T0Calib::T0Calib() { cout << "Calibration type: T0Calib" << endl; }
5
7
8void T0Calib::init( TObjArray* hlist, MdcCosGeom* pGeom ) {
9 CalibBase::init( hlist, pGeom );
10
11 m_pGeom = pGeom;
12
13 m_fdT0 = new TFolder( "fdt0", "fdt0" );
14 hlist->Add( m_fdT0 );
15
16 m_fdResiWire = new TFolder( "resiWire", "resiWire" );
17 hlist->Add( m_fdResiWire );
18
19 char hname[200];
20 for ( int i = 0; i < NWIRE; i++ )
21 {
22 int lay = pGeom->getWire( i )->getLayerId();
23 int cel = pGeom->getWire( i )->getCellId();
24
25 sprintf( hname, "mResi%04d_Lay%02d_Cell%03d_L", i, lay, cel );
26 m_hleft[i] = new TH1F( hname, "", 400, -2.0, 2.0 );
27 m_fdT0->Add( m_hleft[i] );
28
29 sprintf( hname, "mResi%04d_Lay%02d_Cell%03d_R", i, lay, cel );
30 m_hright[i] = new TH1F( hname, "", 400, -2.0, 2.0 );
31 m_fdT0->Add( m_hright[i] );
32 }
33 m_hLrResiSum = new TH1F( "mLrResiSum", "", 200, -0.5, 0.5 );
34 m_fdResiWire->Add( m_hLrResiSum );
35
36 m_hLrResiSub = new TH1F( "mLrResiSub", "", 200, -0.5, 0.5 );
37 m_fdResiWire->Add( m_hLrResiSub );
38}
39
40void T0Calib::mergeHist( TFile* fhist ) {
41 CalibBase::mergeHist( fhist );
42
43 char hname[200];
44 TFolder* fd = (TFolder*)fhist->Get( "fdT0" );
45 for ( int i = 0; i < NWIRE; i++ )
46 {
47 int lay = m_pGeom->getWire( i )->getLayerId();
48 int cel = m_pGeom->getWire( i )->getCellId();
49
50 sprintf( hname, "Resi%04d_Lay%02d_Cell%03d_L", i, lay, cel );
51 TH1F* hl = (TH1F*)fd->FindObjectAny( hname );
52 m_hleft[i]->Add( hl );
53
54 sprintf( hname, "Resi%04d_Lay%02d_Cell%03d_R", i, lay, cel );
55 TH1F* hr = (TH1F*)fd->FindObjectAny( hname );
56 m_hright[i]->Add( hr );
57 }
58}
59
60void T0Calib::calib( MdcCalibConst* calconst, TObjArray* newXtList, TObjArray* r2tList ) {
61 CalibBase::calib( calconst, newXtList, r2tList );
62
63 double vdr = 0.03;
64 for ( int i = 0; i < NWIRE; i++ )
65 {
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 {
93 int lay = m_pGeom->getWire( i )->getLayerId();
94 int cel = m_pGeom->getWire( i )->getCellId();
95 sprintf( hname, "Resi%04d_Lay%02d_Cell%03d_L", i, lay, cel );
96 m_hleft[i]->SetName( hname );
97 sprintf( hname, "Resi%04d_Lay%02d_Cell%03d_R", i, lay, cel );
98 m_hright[i]->SetName( hname );
99 }
100
101 m_fdResiWire->SetName( "ResiWire" );
102 m_hLrResiSum->SetName( "LrResiSum" );
103 m_hLrResiSub->SetName( "LrResiSub" );
104}
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)
virtual void init(TObjArray *hlist, MdcCosGeom *pGeom)=0
Definition CalibBase.cpp:12
virtual void mergeHist(TFile *fhist)=0
virtual void calib(MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)=0
double getT0(int wireid) const
void resetDelT0(int wireid, double val)
void resetT0(int wireid, double val)
const MdcCosWire * getWire(int iwire) const
T0Calib()
Definition T0Calib.cpp:4
void init(TObjArray *hlist, MdcCosGeom *pGeom)
Definition T0Calib.cpp:8
void mergeHist(TFile *fhist)
Definition T0Calib.cpp:40
~T0Calib()
Definition T0Calib.cpp:6
void calib(MdcCalibConst *calconst, TObjArray *newXtList, TObjArray *r2tList)
Definition T0Calib.cpp:60