BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
T0MdcCalib Class Reference

#include <T0MdcCalib.h>

+ Inheritance diagram for T0MdcCalib:

Public Member Functions

 T0MdcCalib ()
 
 ~T0MdcCalib ()
 
void initialize (TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)
 
void setParam (MdcCalParams &param)
 
int fillHist (MdcCalEvent *event)
 
int updateConst (MdcCalibConst *calconst)
 
void printCut () const
 
void clear ()
 
- Public Member Functions inherited from MdcCalib
 MdcCalib ()
 
virtual ~MdcCalib ()
 
virtual void initialize (TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)=0
 
virtual void setParam (MdcCalParams &param)=0
 
virtual int fillHist (MdcCalEvent *event)=0
 
virtual int updateConst (MdcCalibConst *calconst)=0
 
virtual void printCut () const =0
 
virtual void clear ()=0
 

Detailed Description

Definition at line 6 of file T0MdcCalib.h.

Constructor & Destructor Documentation

◆ T0MdcCalib()

T0MdcCalib::T0MdcCalib ( )

Definition at line 13 of file T0MdcCalib.cxx.

13 {
14 for(int lay=0; lay<MdcCalNLayer; lay++){
15 if(lay < 8){
16 m_docaMin[lay] = 1.2; // mm
17 m_docaMax[lay] = 4.8; // mm
18 } else{
19 m_docaMin[lay] = 1.6; // mm
20 m_docaMax[lay] = 6.4; // mm
21 }
22 }
23}
const int MdcCalNLayer
Definition: MdcCalParams.h:6

◆ ~T0MdcCalib()

T0MdcCalib::~T0MdcCalib ( )

Definition at line 25 of file T0MdcCalib.cxx.

25 {
26}

Member Function Documentation

◆ clear()

void T0MdcCalib::clear ( )
virtual

Implements MdcCalib.

Definition at line 28 of file T0MdcCalib.cxx.

28 {
29 for(int i=0; i<MdcCalTotCell; i++){
30 delete m_hleft[i];
31 delete m_hright[i];
32 }
33 delete m_hLrResiSum;
34 delete m_hLrResiSub;
35 delete m_fdT0;
36 delete m_fdResiWire;
37
39}
const int MdcCalTotCell
Definition: MdcCalParams.h:9
virtual void clear()=0
Definition: MdcCalib.cxx:80

◆ fillHist()

int T0MdcCalib::fillHist ( MdcCalEvent event)
virtual

Implements MdcCalib.

Definition at line 90 of file T0MdcCalib.cxx.

90 {
91 IMessageSvc* msgSvc;
92 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
93 MsgStream log(msgSvc, "T0MdcCalib");
94 log << MSG::DEBUG << "T0MdcCalib::fillHist()" << endreq;
95
96 MdcCalib::fillHist(event);
97
98 // get EsTimeCol
99 bool esCutFg = event->getEsCutFlag();
100 if( ! esCutFg ) return -1;
101
102 int i;
103 int k;
104 int ntrk;
105 int nhit;
106 int stat;
107
108 int lay;
109 int cel;
110 int wir;
111 int lr;
112 double dmeas;
113 double doca;
114 double resi;
115
116 bool fgHitLay[MdcCalNLayer];
117
118 MdcCalRecTrk* rectrk;
119 MdcCalRecHit* rechit;
120
121 ntrk = event -> getNTrk();
122 if((ntrk < m_param.nTrkCut[0]) || (ntrk > m_param.nTrkCut[1])) return -1;
123
124 for(i=0; i<ntrk; i++){
125 rectrk = event -> getRecTrk(i);
126 nhit = rectrk -> getNHits();
127
128 // dr cut
129 double dr = rectrk->getDr();
130 if(fabs(dr) > m_param.drCut) continue;
131
132 // dz cut
133 double dz = rectrk->getDz();
134 if(fabs(dz) > m_param.dzCut) continue;
135
136 // momentum cut
137 double p = rectrk -> getP();
138 if((fabs(p) < m_param.pCut[0]) || (fabs(p) > m_param.pCut[1])) continue;
139
140 for(lay=0; lay<MdcCalNLayer; lay++) fgHitLay[lay] = false;
141 for(k=0; k<nhit; k++){
142 rechit = rectrk -> getRecHit(k);
143 lay = rechit -> getLayid();
144 fgHitLay[lay] = true;
145 }
146
147 int nhitlay = 0;
148 for(lay=0; lay<MdcCalNLayer; lay++) if(fgHitLay[lay]) nhitlay++;
149 if(nhitlay < m_param.nHitLayCut) continue;
150
151 bool fgNoise = rectrk->getFgNoiseRatio();
152 if(m_param.noiseCut && (!fgNoise)) continue;
153
154// log << MSG::DEBUG << "nhits: " << nhit << endreq;
155 for(k=0; k<nhit; k++){
156 rechit = rectrk -> getRecHit(k);
157 lay = rechit -> getLayid();
158 cel = rechit -> getCellid();
159 wir = m_mdcGeomSvc -> Wire(lay, cel) -> Id();
160 lr = rechit -> getLR();
161 doca = rechit -> getDocaExc();
162 dmeas = rechit -> getDmeas();
163 resi = rechit -> getResiExc();
164 stat = rechit -> getStat();
165
166 if(1 != stat) continue;
167
168 if( (fabs(doca) < m_docaMin[lay]) ||
169 (fabs(doca) > m_docaMax[lay]) ||
170 (fabs(resi) > m_param.resiCut[lay]) ){
171 continue;
172 }
173
174 if(0 == lay){
175 if( ! fgHitLay[1] ) continue;
176 } else if(42 == lay){
177 if( ! fgHitLay[41] ) continue;
178 } else{
179 if( (!fgHitLay[lay-1]) && (!fgHitLay[lay+1]) ) continue;
180 }
181
182 if(wir < (m_mdcGeomSvc->getWireSize()) ){
183 if( 0 == lr ){
184 m_hleft[wir] -> Fill(resi);
185 }else if( 1 == lr ){
186 m_hright[wir] -> Fill(resi);
187 }
188 }else{
189 std::cout << "wireid: " << wir << std::endl;
190 }
191 }
192 }
193 return 1;
194}
curve Fill()
IMessageSvc * msgSvc()
virtual const int getWireSize()=0
int nTrkCut[2]
Definition: MdcCalParams.h:65
double pCut[2]
Definition: MdcCalParams.h:75
double dzCut
Definition: MdcCalParams.h:74
double drCut
Definition: MdcCalParams.h:73
double resiCut[MdcCalNLayer]
Definition: MdcCalParams.h:84
double getDz() const
Definition: MdcCalRecTrk.h:33
bool getFgNoiseRatio() const
Definition: MdcCalRecTrk.h:46
double getDr() const
Definition: MdcCalRecTrk.h:30
virtual int fillHist(MdcCalEvent *event)=0
Definition: MdcCalib.cxx:730

◆ initialize()

void T0MdcCalib::initialize ( TObjArray *  hlist,
IMdcGeomSvc mdcGeomSvc,
IMdcCalibFunSvc mdcFunSvc,
IMdcUtilitySvc mdcUtilitySvc 
)
virtual

Implements MdcCalib.

Definition at line 41 of file T0MdcCalib.cxx.

42 {
43 IMessageSvc* msgSvc;
44 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
45 MsgStream log(msgSvc, "T0MdcCalib");
46 log << MSG::INFO << "T0MdcCalib::initialize()" << endreq;
47
48 m_hlist = hlist;
49 m_mdcGeomSvc = mdcGeomSvc;
50 m_mdcFunSvc = mdcFunSvc;
51 m_mdcUtilitySvc = mdcUtilitySvc;
52
53 m_vdr = 0.03;
54
55 MdcCalib::initialize(m_hlist, m_mdcGeomSvc, m_mdcFunSvc, m_mdcUtilitySvc);
56
57 int i;
58 int nwire;
59 int lay;
60 int cel;
61 char hname[200];
62
63 m_fdT0 = new TFolder("fdT0", "fdT0");
64 m_hlist -> Add(m_fdT0);
65
66 m_fdResiWire = new TFolder("ResiWire", "ResiWire");
67 m_hlist->Add(m_fdResiWire);
68
69 nwire = m_mdcGeomSvc -> getWireSize();
70 for(i=0; i<nwire; i++){
71 lay = m_mdcGeomSvc -> Wire(i) -> Layer();
72 cel = m_mdcGeomSvc -> Wire(i) -> Cell();
73
74 sprintf(hname, "Resi%04d_Lay%02d_Cell%03d_L", i, lay, cel);
75 m_hleft[i] = new TH1F(hname, "", 400, -2.0, 2.0);
76 m_fdT0 -> Add(m_hleft[i]);
77
78 sprintf(hname, "Resi%04d_Lay%02d_Cell%03d_R", i, lay, cel);
79 m_hright[i] = new TH1F(hname, "", 400, -2.0, 2.0);
80 m_fdT0 -> Add(m_hright[i]);
81 }
82
83 m_hLrResiSum = new TH1F("LrResiSum", "", 200, -0.5, 0.5);
84 m_fdResiWire->Add(m_hLrResiSum);
85
86 m_hLrResiSub = new TH1F("LrResiSub", "", 200, -0.5, 0.5);
87 m_fdResiWire->Add(m_hLrResiSub);
88}
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)
virtual void initialize(TObjArray *hlist, IMdcGeomSvc *mdcGeomSvc, IMdcCalibFunSvc *mdcFunSvc, IMdcUtilitySvc *mdcUtilitySvc)=0
Definition: MdcCalib.cxx:214

◆ printCut()

void T0MdcCalib::printCut ( ) const
virtual

Implements MdcCalib.

Definition at line 196 of file T0MdcCalib.cxx.

196 {
198}
virtual void printCut() const =0
Definition: MdcCalib.cxx:1407

◆ setParam()

void T0MdcCalib::setParam ( MdcCalParams param)
inlinevirtual

Implements MdcCalib.

Definition at line 41 of file T0MdcCalib.h.

41 {
42 MdcCalib::setParam(param);
43 m_param = param;
44}
virtual void setParam(MdcCalParams &param)=0
Definition: MdcCalib.h:306

◆ updateConst()

int T0MdcCalib::updateConst ( MdcCalibConst calconst)
virtual

Implements MdcCalib.

Definition at line 200 of file T0MdcCalib.cxx.

200 {
201 IMessageSvc* msgSvc;
202 Gaudi::svcLocator() -> service("MessageSvc", msgSvc);
203 MsgStream log(msgSvc, "T0MdcCalib");
204 log << MSG::INFO << "T0MdcCalib::updateConst()" << endreq;
205
206 MdcCalib::updateConst(calconst);
207
208 int i;
209 int lay;
210 int nwire;
211 double t0;
212 double delt0;
213 double resiLrSum;
214 double resiLrSub;
215
216 Stat_t entry_l;
217 double mean_l;
218// double gmean_l; // mean of fit with the gaussian distribution
219// double sigma_l;
220// double rms_l;
221
222 Stat_t entry_r;
223 double mean_r;
224// double gmean_r;
225// double sigma_r;
226// double rms_r;
227
228 nwire = m_mdcGeomSvc -> getWireSize();
229 std::cout << "totwire: " << nwire << std::endl;
230 for(i=0; i<nwire; i++){
231 lay = m_mdcGeomSvc -> Wire(i) -> Layer();
232
233 if(1 == m_param.fgCalib[lay]){
234 entry_l = m_hleft[i] -> GetEntries();
235 mean_l = m_hleft[i] -> GetMean();
236// m_hleft[i] -> Fit("gaus", "Q");
237// gmean_l = m_hleft[i] -> GetFunction("gaus") -> GetParameter(1);
238
239 entry_r = m_hright[i] -> GetEntries();
240 mean_r = m_hright[i] -> GetMean();
241// m_hright[i] -> Fit("gaus", "Q");
242// gmean_r = m_hright[i] -> GetFunction("gaus") -> GetParameter(1);
243
244 delt0 = 0.5 * (mean_l + mean_r) / m_vdr;
245 } else{
246 delt0 = 0.0;
247 }
248 if(0 == m_param.fgWireCal[i]) delt0 = 0.0;
249
250 resiLrSum = 0.5 * (mean_l + mean_r);
251 resiLrSub = 0.5 * (mean_l - mean_r);
252 m_hLrResiSum->Fill(resiLrSum);
253 m_hLrResiSub->Fill(resiLrSub);
254
255 t0 = calconst -> getT0(i);
256 t0 += delt0;
257
258 calconst -> resetT0(i, t0);
259 calconst -> resetDelT0(i, delt0);
260 }
261 return 1;
262}
int fgCalib[MdcCalNLayer]
Definition: MdcCalParams.h:80
int fgWireCal[MdcCalTotCell]
Definition: MdcCalParams.h:88
virtual int updateConst(MdcCalibConst *calconst)=0
Definition: MdcCalib.cxx:1417

The documentation for this class was generated from the following files: