BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
PreXtMdcCalib Class Reference

#include <PreXtMdcCalib.h>

Inheritance diagram for PreXtMdcCalib:

Public Member Functions

 PreXtMdcCalib ()
 ~PreXtMdcCalib ()
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 ()

Detailed Description

Definition at line 14 of file PreXtMdcCalib.h.

Constructor & Destructor Documentation

◆ PreXtMdcCalib()

PreXtMdcCalib::PreXtMdcCalib ( )

Definition at line 31 of file PreXtMdcCalib.cxx.

31{ m_fgIniTm = false; }

◆ ~PreXtMdcCalib()

PreXtMdcCalib::~PreXtMdcCalib ( )

Definition at line 33 of file PreXtMdcCalib.cxx.

33{}

Member Function Documentation

◆ clear()

void PreXtMdcCalib::clear ( )
virtual

Implements MdcCalib.

Definition at line 35 of file PreXtMdcCalib.cxx.

35 {
36 for ( int lay = 0; lay < MdcCalNLayer; lay++ )
37 {
38 delete m_grXt[lay];
39 delete m_htrec[lay];
40 }
41 delete m_haxis;
42 delete m_fdPreXt;
43}
const int MdcCalNLayer
Definition MdcCalParams.h:6

◆ fillHist()

int PreXtMdcCalib::fillHist ( MdcCalEvent * event)
virtual

Implements MdcCalib.

Definition at line 103 of file PreXtMdcCalib.cxx.

103 {
104 IMessageSvc* msgSvc;
105 Gaudi::svcLocator()->service( "MessageSvc", msgSvc );
106 MsgStream log( msgSvc, "PreXtMdcCalib" );
107 log << MSG::DEBUG << "PreXtMdcCalib::fillHist()" << endmsg;
108
109 int bin;
110 int lay;
111 int digiId;
112 unsigned fgOverFlow;
113 double tdc;
114 double adc;
115 double traw;
116 double trec;
117 Identifier id;
118
119 IDataProviderSvc* eventSvc = NULL;
120 Gaudi::svcLocator()->service( "EventDataSvc", eventSvc );
121
122 double xtpar[8];
123 if ( !m_fgIniTm )
124 {
125 for ( lay = 0; lay < MdcCalNLayer; lay++ )
126 {
127 m_t0[lay] = m_mdcFunSvc->getT0( lay, 0 );
128 m_mdcFunSvc->getXtpar( lay, 0, 0, xtpar );
129 m_tm[lay] = xtpar[6];
130 }
131 m_fgIniTm = true;
132 }
133
134 // get EsTimeCol
135 double tes = -9999.0;
136 int esTimeflag = -1;
137 SmartDataPtr<RecEsTimeCol> aevtimeCol( eventSvc, "/Event/Recon/RecEsTimeCol" );
138 if ( ( !aevtimeCol ) || ( aevtimeCol->size() == 0 ) )
139 {
140 tes = -9999.0;
141 esTimeflag = -1;
142 }
143 else
144 {
145 RecEsTimeCol::iterator iter_evt = aevtimeCol->begin();
146 for ( ; iter_evt != aevtimeCol->end(); iter_evt++ )
147 {
148 tes = ( *iter_evt )->getTest();
149 esTimeflag = ( *iter_evt )->getStat();
150 }
151 }
152 bool flagTes = false;
153 for ( int iEs = 0; iEs < m_param.nEsFlag; iEs++ )
154 {
155 if ( esTimeflag == m_param.esFlag[iEs] )
156 {
157 flagTes = true;
158 break;
159 }
160 }
161 if ( -1 == esTimeflag ) return -1;
162 // if( (!flagTes) || (tes < m_param.tesMin) || (tes > m_param.tesMax) ) return -1;
163 if ( ( m_param.esCut ) &&
164 ( ( !flagTes ) || ( tes < m_param.tesMin ) || ( tes > m_param.tesMax ) ) )
165 return -1;
166
167 // retrieve Mdc digi
168 SmartDataPtr<MdcDigiCol> mdcDigiCol( eventSvc, "/Event/Digi/MdcDigiCol" );
169 if ( !mdcDigiCol ) { log << MSG::FATAL << "Could not find event" << endmsg; }
170
171 MdcDigiCol::iterator iter = mdcDigiCol->begin();
172 digiId = 0;
173 for ( ; iter != mdcDigiCol->end(); iter++, digiId++ )
174 {
175 MdcDigi* aDigi = ( *iter );
176 id = ( aDigi )->identify();
177
178 lay = MdcID::layer( id );
179
180 tdc = ( aDigi )->getTimeChannel();
181 adc = ( aDigi )->getChargeChannel();
182 fgOverFlow = ( aDigi )->getOverflow();
183 traw = tdc * MdcCalTdcCnv;
184 trec = traw - tes - m_t0[lay];
185
186 // if ( !((fgOverFlow == 0)||(fgOverFlow ==12)) ||
187 // (aDigi->getTimeChannel() == 0x7FFFFFFF) ||
188 // (aDigi->getChargeChannel() == 0x7FFFFFFF) ) continue;
189 if ( ( ( fgOverFlow & 1 ) != 0 ) || ( ( fgOverFlow & 12 ) != 0 ) ||
190 ( aDigi->getTimeChannel() == 0x7FFFFFFF ) ||
191 ( aDigi->getChargeChannel() == 0x7FFFFFFF ) )
192 continue;
193
194 /* integrated time Spectrum for determination X-T */
195 if ( trec > 0 )
196 {
197 if ( trec < m_tm[lay] )
198 {
199 m_nTot[lay]++;
200 m_htrec[lay]->Fill( trec );
201 m_nhitTot->Fill( lay );
202 }
203 for ( bin = 0; bin < m_nXtBin; bin++ )
204 {
205 if ( trec < m_tbin[bin] )
206 {
207 m_nEntries[lay][bin]++;
208 m_nhitBin[lay]->Fill( m_tbin[bin] );
209 }
210 }
211 }
212 }
213 return 1;
214}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per bin
Definition FoamA.h:85
const double MdcCalTdcCnv
IMessageSvc * msgSvc()
static int layer(const Identifier &id)
Values of different levels (failure returns 0).
Definition MdcID.cxx:47
unsigned int getChargeChannel() const
Definition RawData.cxx:35
unsigned int getTimeChannel() const
Definition RawData.cxx:32

◆ initialize()

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

Implements MdcCalib.

Definition at line 45 of file PreXtMdcCalib.cxx.

46 {
47 IMessageSvc* msgSvc;
48 Gaudi::svcLocator()->service( "MessageSvc", msgSvc );
49 MsgStream log( msgSvc, "PreXtMdcCalib" );
50 log << MSG::INFO << "PreXtMdcCalib::initialize()" << endmsg;
51
52 m_hlist = hlist;
53 m_mdcGeomSvc = mdcGeomSvc;
54 m_mdcFunSvc = mdcFunSvc;
55 m_mdcUtilitySvc = mdcUtilitySvc;
56
57 int lay;
58
59 m_nWire = m_mdcGeomSvc->getWireSize();
60 m_nLayer = m_mdcGeomSvc->getLayerSize();
61
62 m_fdPreXt = new TFolder( "PreXt", "PreXt" );
63 m_hlist->Add( m_fdPreXt );
64
65 m_fdNhit = new TFolder( "XtNhit", "XtNhit" );
66 m_hlist->Add( m_fdNhit );
67
68 m_haxis = new TH2F( "axis", "", 50, 0, 300, 50, 0, 9 );
69 m_haxis->SetStats( 0 );
70 m_fdPreXt->Add( m_haxis );
71
72 char hname[200];
73 for ( lay = 0; lay < MdcCalNLayer; lay++ )
74 {
75 sprintf( hname, "trec%02d", lay );
76 m_htrec[lay] = new TH1F( hname, "", 310, -20, 600 );
77 m_fdPreXt->Add( m_htrec[lay] );
78 }
79
80 m_nhitTot = new TH1F( "nhitTot", "", 43, -0.5, 42.5 );
81 m_fdNhit->Add( m_nhitTot );
82
83 for ( lay = 0; lay < MdcCalNLayer; lay++ )
84 {
85 sprintf( hname, "nhitBin%02d", lay );
86 m_nhitBin[lay] = new TH1F( hname, "", 40, 5.0, 405.0 );
87 m_fdNhit->Add( m_nhitBin[lay] );
88 }
89
90 /* integrated time Spectrum for determination X-T */
91 int bin;
92 m_nXtBin = 40;
93 double twid = 10.0; // ns
94 for ( bin = 0; bin < m_nXtBin; bin++ ) m_tbin[bin] = (double)( bin + 1 ) * twid;
95
96 for ( lay = 0; lay < MdcCalNLayer; lay++ )
97 {
98 m_nTot[lay] = 0;
99 for ( bin = 0; bin < m_nXtBin; bin++ ) { m_nEntries[lay][bin] = 0; }
100 }
101}
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)

◆ printCut()

void PreXtMdcCalib::printCut ( ) const
virtual

Implements MdcCalib.

Definition at line 216 of file PreXtMdcCalib.cxx.

216{}

◆ setParam()

void PreXtMdcCalib::setParam ( MdcCalParams & param)
inlinevirtual

Implements MdcCalib.

Definition at line 59 of file PreXtMdcCalib.h.

59 {
60 MdcCalib::setParam( param );
61 m_param = param;
62}
virtual void setParam(MdcCalParams &param)=0
Definition MdcCalib.h:305

◆ updateConst()

int PreXtMdcCalib::updateConst ( MdcCalibConst * calconst)
virtual

Implements MdcCalib.

Definition at line 218 of file PreXtMdcCalib.cxx.

218 {
219 IMessageSvc* msgSvc;
220 Gaudi::svcLocator()->service( "MessageSvc", msgSvc );
221 MsgStream log( msgSvc, "PreXtMdcCalib" );
222 log << MSG::DEBUG << "PreXtMdcCalib::updateConst()" << endmsg;
223
224 int lay;
225 int bin;
226 int iLR;
227 int iEntr;
228 int ord;
229
230 double layRad;
231 double ncel;
232 double pi = 3.141592653;
233
234 double dm;
235 double dist[40];
236 double xtpar[6];
237 char hname[200];
238
239 TF1* funXt = new TF1( "funXt", xtfun, 0, 300, 6 );
240 funXt->FixParameter( 0, 0.0 );
241 funXt->SetParameter( 1, 0.03 );
242 funXt->SetParameter( 2, 0.0 );
243 funXt->SetParameter( 3, 0.0 );
244 funXt->SetParameter( 4, 0.0 );
245 funXt->SetParameter( 5, 0.0 );
246
247 ofstream fxtlog( "preXtpar.dat" );
248 for ( lay = 0; lay < MdcCalNLayer; lay++ )
249 {
250 sprintf( hname, "grPreXt%02d", lay );
251 m_grXt[lay] = new TGraph();
252 m_grXt[lay]->SetName( hname );
253 m_grXt[lay]->SetMarkerStyle( 20 );
254 m_fdPreXt->Add( m_grXt[lay] );
255
256 layRad = m_mdcGeomSvc->Layer( lay )->Radius();
257 ncel = m_mdcGeomSvc->Layer( lay )->NCell();
258 dm = pi * layRad / ncel;
259
260 fxtlog << "layer " << lay << endl;
261 for ( bin = 0; bin < m_nXtBin; bin++ )
262 {
263 dist[bin] = dm * m_nEntries[lay][bin] / m_nTot[lay];
264 m_grXt[lay]->SetPoint( bin, m_tbin[bin], dist[bin] );
265 fxtlog << setw( 4 ) << bin << setw( 15 ) << m_tbin[bin] << setw( 15 ) << dist[bin]
266 << setw( 15 ) << dm << setw( 10 ) << m_nEntries[lay][bin] << setw( 10 )
267 << m_nTot[lay] << endl;
268
269 if ( m_tbin[bin] >= m_tm[lay] ) break;
270 }
271
272 if ( 1 == m_param.fgCalib[lay] )
273 {
274 m_grXt[lay]->Fit( funXt, "Q", "", 0.0, m_tm[lay] );
275 for ( ord = 0; ord < 6; ord++ ) { xtpar[ord] = funXt->GetParameter( ord ); }
276
277 for ( iEntr = 0; iEntr < MdcCalNENTRXT; iEntr++ )
278 {
279 for ( iLR = 0; iLR < MdcCalLR; iLR++ )
280 {
281 for ( ord = 0; ord < 6; ord++ )
282 { calconst->resetXtpar( lay, iEntr, iLR, ord, xtpar[ord] ); }
283 }
284 }
285 }
286 else
287 {
288 for ( ord = 0; ord < 6; ord++ ) xtpar[ord] = calconst->getXtpar( lay, 0, 0, ord );
289 }
290
291 for ( ord = 0; ord < 6; ord++ ) fxtlog << setw( 14 ) << xtpar[ord];
292 fxtlog << setw( 10 ) << m_tm[lay] << " 0" << endl;
293 } // end of layer loop
294 fxtlog.close();
295 cout << "preXt.dat was written." << endl;
296
297 delete funXt;
298 return 1;
299}
double pi
const int MdcCalNENTRXT
const int MdcCalLR
void resetXtpar(int lay, int entr, int lr, int order, double val)
double getXtpar(int lay, int entr, int lr, int order)

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