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

#include <TofQElecSvc.h>

Inheritance diagram for TofQElecSvc:

Public Member Functions

 TofQElecSvc (const std::string &name, ISvcLocator *svcloc)
 ~TofQElecSvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
void handle (const Incident &)
const unsigned int Board (bool barrel, int id, bool eastEnd)
const unsigned int Crate (bool barrel, int id, bool eastEnd)
const unsigned int Fee (bool barrel, int id, bool eastEnd)
const unsigned int Channel (bool barrel, int id, bool eastEnd)
const double BQTC1 (int id, double q)
const double BQTC2 (int id, double q)
const double EQTC (int id, double q)
const double BQChannel1 (int id, double qtc)
const double BQChannel2 (int id, double qtc)
const double EQChannel (int id, double qtc)

Detailed Description

Definition at line 19 of file TofQElecSvc.h.

Constructor & Destructor Documentation

◆ TofQElecSvc()

TofQElecSvc::TofQElecSvc ( const std::string & name,
ISvcLocator * svcloc )

Definition at line 24 of file TofQElecSvc.cxx.

25 : base_class( name, svcloc ), m_data( nullptr ) {
26 declareProperty( "Run", m_run = 1 );
27}

Referenced by TofQElecSvc().

◆ ~TofQElecSvc()

TofQElecSvc::~TofQElecSvc ( )

Definition at line 66 of file TofQElecSvc.cxx.

66 {
67 if ( m_data ) delete m_data;
68 return;
69}

Member Function Documentation

◆ Board()

const unsigned int TofQElecSvc::Board ( bool barrel,
int id,
bool eastEnd )

Definition at line 140 of file TofQElecSvc.cxx.

140 {
141 MsgStream log( msgSvc(), name() );
142
143 if ( barrel )
144 {
145 if ( id < 0 || id > 175 )
146 {
147 log << MSG::WARNING << "Board : TofId is out of Range, tofid=" << id << endmsg;
148 return 1000;
149 }
150 }
151 else
152 {
153 if ( id < 0 || id > 95 )
154 {
155 log << MSG::WARNING << "Board : TofId is out of Range, tofid=" << id << endmsg;
156 return 1000;
157 }
158 }
159
160 unsigned int board;
161 if ( barrel )
162 {
163 if ( eastEnd ) { board = ( m_data->getBTof( id ) ).getNumEast( 0 ); }
164 else { board = ( m_data->getBTof( id ) ).getNumWest( 0 ); }
165 }
166 else { board = ( m_data->getETof( id ) ).getNum( 0 ); }
167
168 return board;
169}
IMessageSvc * msgSvc()

◆ BQChannel1()

const double TofQElecSvc::BQChannel1 ( int id,
double qtc )

Definition at line 339 of file TofQElecSvc.cxx.

339 {
340 double qChannel = -999.0;
341 MsgStream log( msgSvc(), name() );
342 if ( id < 0 || id > 175 )
343 {
344 log << MSG::ERROR << "BChannel1 : TofId is out of Range, tofid=" << id << endmsg;
345 return qChannel;
346 }
347
348 double ratio = ( m_data->getBTof( id ) ).getSimP1( 0 );
349 double p[10];
350 for ( unsigned int i = 0; i < 10; i++ )
351 { p[i] = ( m_data->getBTof( id ) ).getSimP1( i + 1 ); }
352 qChannel = ( p[0] + p[1] * qtc + p[2] * qtc * qtc + p[3] * qtc * qtc * qtc ) *
353 ( 1.0 - TMath::Erf( ( qtc - p[4] ) / p[5] ) ) +
354 ( p[6] + p[7] * qtc ) * ( 1.0 + TMath::Erf( ( qtc - p[8] ) / p[9] ) );
355 qChannel = ratio * qChannel;
356
357 // cout << "Sim East tofid=" << id << " ratio=" << ratio;
358 // for( unsigned int i=0; i<11; i++ ) { cout << " P" << i << "= " << p[i]; }
359 // cout << endl;
360
361 return qChannel;
362}

◆ BQChannel2()

const double TofQElecSvc::BQChannel2 ( int id,
double qtc )

Definition at line 364 of file TofQElecSvc.cxx.

364 {
365 double qChannel = -999.0;
366 MsgStream log( msgSvc(), name() );
367 if ( id < 0 || id > 175 )
368 {
369 log << MSG::ERROR << "BChannel2 : TofId is out of Range, tofid=" << id << endmsg;
370 return qChannel;
371 }
372
373 double ratio = ( m_data->getBTof( id ) ).getSimP2( 0 );
374 double p[10];
375 for ( unsigned int i = 0; i < 10; i++ )
376 { p[i] = ( m_data->getBTof( id ) ).getSimP2( i + 1 ); }
377 qChannel = ( p[0] + p[1] * qtc + p[2] * qtc * qtc + p[3] * qtc * qtc * qtc ) *
378 ( 1.0 - TMath::Erf( ( qtc - p[4] ) / p[5] ) ) +
379 ( p[6] + p[7] * qtc ) * ( 1.0 + TMath::Erf( ( qtc - p[8] ) / p[9] ) );
380 qChannel = ratio * qChannel;
381
382 // cout << "Sim West tofid=" << id << " ratio=" << ratio;
383 // for( unsigned int i=0; i<11; i++ ) { cout << " P" << i << "= " << p[i]; }
384 // cout << endl;
385
386 return qChannel;
387}

◆ BQTC1()

const double TofQElecSvc::BQTC1 ( int id,
double q )

Definition at line 264 of file TofQElecSvc.cxx.

264 {
265 double qtcNew = -999.0;
266 MsgStream log( msgSvc(), name() );
267 if ( id < 0 || id > 175 )
268 {
269 log << MSG::WARNING << "BQTC1 : TofId is out of Range, tofid=" << id << endmsg;
270 return qtcNew;
271 }
272 if ( fabs( q - 10000.0 ) < 1.0e-6 ) { return 10000.0; }
273 else if ( fabs( q + 999.0 ) < 1.0e-6 ) { return -999.0; }
274
275 double ratio = ( m_data->getBTof( id ) ).getP1( 0 );
276 double p[10];
277 for ( unsigned int i = 0; i < 10; i++ ) { p[i] = ( m_data->getBTof( id ) ).getP1( i + 1 ); }
278 q = q * ratio;
279 qtcNew = p[0] + p[1] * q + p[2] * q * q + p[3] * q * q * q + p[4] * q * q * q * q +
280 p[7] * exp( p[5] * ( q - p[6] ) );
281
282 // cout << "East tofid=" << id << " ratio=" << ratio;
283 // for( unsigned int i=0; i<8; i++ ) { cout << " P" << i << "= " << p[i]; }
284 // cout << endl;
285
286 return qtcNew;
287}
EvtComplex exp(const EvtComplex &c)
****INTEGER imax DOUBLE PRECISION m_pi *DOUBLE PRECISION m_amfin DOUBLE PRECISION m_Chfin DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_sinw2 DOUBLE PRECISION m_GFermi DOUBLE PRECISION m_MfinMin DOUBLE PRECISION m_ta2 INTEGER m_out INTEGER m_KeyFSR INTEGER m_KeyQCD *COMMON c_Semalib $ !copy of input $ !CMS energy $ !beam mass $ !final mass $ !beam charge $ !final charge $ !smallest final mass $ !Z mass $ !Z width $ !EW mixing angle $ !Gmu Fermi $ alphaQED at q
Definition KKsem.h:33

◆ BQTC2()

const double TofQElecSvc::BQTC2 ( int id,
double q )

Definition at line 289 of file TofQElecSvc.cxx.

289 {
290 double qtcNew = -999.0;
291 MsgStream log( msgSvc(), name() );
292 if ( id < 0 || id > 175 )
293 {
294 log << MSG::WARNING << "BQTC2 : TofId is out of Range, tofid=" << id << endmsg;
295 return qtcNew;
296 }
297 if ( fabs( q - 10000.0 ) < 1.0e-6 ) { return 10000.0; }
298 else if ( fabs( q + 999.0 ) < 1.0e-6 ) { return -999.0; }
299
300 double ratio = ( m_data->getBTof( id ) ).getP2( 0 );
301 double p[10];
302 for ( unsigned int i = 0; i < 10; i++ ) { p[i] = ( m_data->getBTof( id ) ).getP2( i + 1 ); }
303 q = q * ratio;
304 qtcNew = p[0] + p[1] * q + p[2] * q * q + p[3] * q * q * q + p[4] * q * q * q * q +
305 p[7] * exp( p[5] * ( q - p[6] ) );
306
307 // cout << "West tofid=" << id << " ratio=" << ratio;
308 // for( unsigned int i=0; i<8; i++ ) { cout << " P" << i << "= " << p[i]; }
309 // cout << endl;
310
311 return qtcNew;
312}

◆ Channel()

const unsigned int TofQElecSvc::Channel ( bool barrel,
int id,
bool eastEnd )

Definition at line 233 of file TofQElecSvc.cxx.

233 {
234 MsgStream log( msgSvc(), name() );
235
236 if ( barrel )
237 {
238 if ( id < 0 || id > 175 )
239 {
240 log << MSG::WARNING << "Channel : TofId is out of Range, tofid=" << id << endmsg;
241 return 1000;
242 }
243 }
244 else
245 {
246 if ( id < 0 || id > 95 )
247 {
248 log << MSG::WARNING << "Channel : TofId is out of Range, tofid=" << id << endmsg;
249 return 1000;
250 }
251 }
252
253 unsigned int channel;
254 if ( barrel )
255 {
256 if ( eastEnd ) { channel = ( m_data->getBTof( id ) ).getNumEast( 1 ); }
257 else { channel = ( m_data->getBTof( id ) ).getNumWest( 1 ); }
258 }
259 else { channel = ( m_data->getETof( id ) ).getNum( 1 ); }
260
261 return channel;
262}

◆ Crate()

const unsigned int TofQElecSvc::Crate ( bool barrel,
int id,
bool eastEnd )

Definition at line 171 of file TofQElecSvc.cxx.

171 {
172 MsgStream log( msgSvc(), name() );
173
174 if ( barrel )
175 {
176 if ( id < 0 || id > 175 )
177 {
178 log << MSG::WARNING << "Crate : TofId is out of Range, tofid=" << id << endmsg;
179 return 1000;
180 }
181 }
182 else
183 {
184 if ( id < 0 || id > 95 )
185 {
186 log << MSG::WARNING << "Crate : TofId is out of Range, tofid=" << id << endmsg;
187 return 1000;
188 }
189 }
190
191 unsigned int crate;
192 if ( barrel )
193 {
194 if ( eastEnd ) { crate = ( m_data->getBTof( id ) ).getNumEast( 2 ); }
195 else { crate = ( m_data->getBTof( id ) ).getNumWest( 2 ); }
196 }
197 else { crate = ( m_data->getETof( id ) ).getNum( 2 ); }
198
199 return crate;
200}

◆ EQChannel()

const double TofQElecSvc::EQChannel ( int id,
double qtc )

Definition at line 389 of file TofQElecSvc.cxx.

389 {
390 double qChannel = -999.0;
391 MsgStream log( msgSvc(), name() );
392 if ( id < 0 || id > 95 )
393 {
394 log << MSG::ERROR << "EQTC : TofId is out of Range, tofid=" << id << endmsg;
395 return qChannel;
396 }
397
398 double ratio = ( m_data->getETof( id ) ).getSimP( 0 );
399 double p[10];
400 for ( unsigned int i = 0; i < 10; i++ )
401 { p[i] = ( m_data->getETof( id ) ).getSimP( i + 1 ); }
402 qChannel = ( p[0] + p[1] * qtc + p[2] * qtc * qtc + p[3] * qtc * qtc * qtc ) *
403 ( 1.0 - TMath::Erf( ( qtc - p[4] ) / p[5] ) ) +
404 ( p[6] + p[7] * qtc ) * ( 1.0 + TMath::Erf( ( qtc - p[8] ) / p[9] ) );
405 qChannel = ratio * qChannel;
406
407 // cout << "Endcap tofid=" << id << " ratio=" << ratio;
408 // for( unsigned int i=0; i<11; i++ ) { cout << " P" << i << "= " << p[i]; }
409 // cout << endl;
410
411 return qChannel;
412}

◆ EQTC()

const double TofQElecSvc::EQTC ( int id,
double q )

Definition at line 314 of file TofQElecSvc.cxx.

314 {
315 double qtcNew = -999.0;
316 MsgStream log( msgSvc(), name() );
317 if ( id < 0 || id > 95 )
318 {
319 log << MSG::WARNING << "EQTC : TofId is out of Range, tofid=" << id << endmsg;
320 return qtcNew;
321 }
322 if ( fabs( q - 10000.0 ) < 1.0e-6 ) { return 10000.0; }
323 else if ( fabs( q + 999.0 ) < 1.0e-6 ) { return -999.0; }
324
325 double ratio = ( m_data->getETof( id ) ).getP( 0 );
326 double p[10];
327 for ( unsigned int i = 0; i < 10; i++ ) { p[i] = ( m_data->getETof( id ) ).getP( i + 1 ); }
328 q = q * ratio;
329 qtcNew = p[0] + p[1] * q + p[2] * q * q + p[3] * q * q * q + p[4] * q * q * q * q +
330 p[7] * exp( p[5] * ( q - p[6] ) );
331
332 // cout << "Endcap tofid=" << id << " ratio=" << ratio;
333 // for( unsigned int i=0; i<8; i++ ) { cout << " P" << i << "= " << p[i]; }
334 // cout << endl;
335
336 return qtcNew;
337}

◆ Fee()

const unsigned int TofQElecSvc::Fee ( bool barrel,
int id,
bool eastEnd )

Definition at line 202 of file TofQElecSvc.cxx.

202 {
203 MsgStream log( msgSvc(), name() );
204
205 if ( barrel )
206 {
207 if ( id < 0 || id > 175 )
208 {
209 log << MSG::WARNING << "Fee : TofId is out of Range, tofid=" << id << endmsg;
210 return 1000;
211 }
212 }
213 else
214 {
215 if ( id < 0 || id > 95 )
216 {
217 log << MSG::WARNING << "Fee : TofId is out of Range, tofid=" << id << endmsg;
218 return 1000;
219 }
220 }
221
222 unsigned int crate;
223 if ( barrel )
224 {
225 if ( eastEnd ) { crate = ( m_data->getBTof( id ) ).getNumEast( 3 ); }
226 else { crate = ( m_data->getBTof( id ) ).getNumWest( 3 ); }
227 }
228 else { crate = ( m_data->getETof( id ) ).getNum( 3 ); }
229
230 return crate;
231}

◆ finalize()

StatusCode TofQElecSvc::finalize ( )
virtual

Definition at line 60 of file TofQElecSvc.cxx.

60 {
61 MsgStream log( msgSvc(), name() );
62 log << MSG::INFO << name() << ": End of Run" << endmsg;
63 return StatusCode::SUCCESS;
64}

◆ handle()

void TofQElecSvc::handle ( const Incident & inc)

Definition at line 128 of file TofQElecSvc.cxx.

128 {
129 MsgStream log( msgSvc(), name() );
130 log << MSG::DEBUG << "handle: " << inc.type() << endmsg;
131
132 if ( inc.type() == "NewRun" )
133 {
134 log << MSG::DEBUG << "New Run" << endmsg;
135 StatusCode sc = FillfromDatabase();
136 }
137 return;
138}

◆ initialize()

StatusCode TofQElecSvc::initialize ( )
virtual

Definition at line 29 of file TofQElecSvc.cxx.

29 {
30 m_hasbeeninitialized = false;
31
32 MsgStream log( msgSvc(), name() );
33 log << MSG::INFO << name() << ": Start of run initialisation" << endmsg;
34
35 StatusCode sc = Service::initialize();
36 if ( sc.isFailure() ) return sc;
37
38 IIncidentSvc* incsvc;
39 sc = service( "IncidentSvc", incsvc );
40 int priority = 100;
41 if ( sc.isSuccess() ) { incsvc->addListener( this, "NewRun", priority ); }
42
43 StatusCode scc;
44
45 log << MSG::INFO << "setProperties()" << endmsg;
46 scc = service( "CalibDataSvc", m_pCalibDataSvc, true );
47 if ( !scc.isSuccess() )
48 {
49 log << MSG::ERROR << "Could not get IDataProviderSvc interface of QElecXmlCnvSvc"
50 << endmsg;
51 return scc;
52 }
53 else
54 { log << MSG::DEBUG << "Retrieved IDataProviderSvc interface of QElecXmlCnvSvc" << endmsg; }
55 // Get properties from the JobOptionsSvc
56 // scc = setProperties();
57 return sc;
58}

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