ATLAS Offline Software
CBNTAA_TBInfo.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "CBNTAA_TBInfo.h"
6 
7 #include "GaudiKernel/IToolSvc.h"
8 
10 
15 
16 #include <cmath>
17 
18 
19 CBNTAA_TBInfo::CBNTAA_TBInfo(const std::string& name, ISvcLocator* pSvcLocator) :
20 CBNT_TBRecBase(name, pSvcLocator)
21 {
22  declareProperty("DBRead", m_DBRead=false);
23  declareProperty("BeamEnergy", m_beamener);
24  declareProperty("BeamType", m_beamtype);
25  declareProperty("ComputeBeamEnergy", m_computeBeamEnergy=false);
26  declareProperty("DumpBeamLine", m_dumpBeamLine=true);
27  m_quad_file = NULL;
28  m_quad_equip = NULL;
29  m_bend_file = NULL;
30  m_bend_equip = NULL;
31  m_trim_file = NULL;
32  m_trim_equip = NULL;
33  m_coll_file = NULL;
34  m_coll_equip = NULL;
35  m_B8_Bdl = 0;
36  m_energy = 0;
37  m_errAbsEnergy = 0;
38  m_errCollimators = 0;
39  m_errCurrents = 0;
40  m_errSycLoss = 0;
41  m_is_VLE = 0;
42  m_prevB3 = 0;
43  m_prevB4 = 0;
44  m_prevB8 = 0;
45  m_prevEnergy = 0;
49  m_preverrSycLoss = 0;
50  m_prevrunNum = 0;
51  m_prevsycLoss = 0;
52  m_runEnergy_nt = 0;
53  m_runEta_nt = 0;
55  m_sycLoss = 0;
56 }
57 
59 {
60  if(m_quad_file) delete m_quad_file;
61  if(m_quad_equip) delete m_quad_equip;
62  if(m_bend_file) delete m_bend_file;
63  if(m_bend_equip) delete m_bend_equip;
64  if(m_trim_file) delete m_trim_file;
65  if(m_trim_equip) delete m_trim_equip;
66  if(m_coll_file) delete m_coll_file;
67  if(m_coll_equip) delete m_coll_equip;
68 }
69 
71 
72  StatusCode sc;
73 
74  addBranch("EVENT_RunEta", m_runEta_nt,"RunEta/D");
75  addBranch("EVENT_RunPartType", m_runParticleType_nt,"RunPartType/l");
76  addBranch("EVENT_RunEnergy", m_runEnergy_nt,"RunEnergy/l");
77  addBranch("EVENT_Energy", m_energy,"Energy/f");
78 
79  if ( m_computeBeamEnergy ) {
80 
81  addBranch("EVENT_ErrAbsEnergy", m_errAbsEnergy,"ErrAbsEnergy/f");
82  addBranch("EVENT_ErrCollimators", m_errCollimators,"ErrCollimators/f");
83  addBranch("EVENT_ErrCurrents", m_errCurrents,"ErrCurrents/f");
84  addBranch("EVENT_SyncLoss", m_sycLoss,"SyncLoss/f");
85  addBranch("EVENT_ErrSyncLoss", m_errSycLoss,"ErrSyncLoss/f");
86 
87  if ( m_dumpBeamLine ) {
88 
89  addBranch("EVENT_Quad_file", m_quad_file);
90  addBranch("EVENT_Quad_equip", m_quad_equip);
91 
92  addBranch("EVENT_Bend_file", m_bend_file);
93  addBranch("EVENT_Bend_equip", m_bend_equip);
94 
95  addBranch("EVENT_Trim_file", m_trim_file);
96  addBranch("EVENT_Trim_equip", m_trim_equip);
97 
98  addBranch("EVENT_Coll_file", m_coll_file);
99  addBranch("EVENT_Coll_equip", m_coll_equip);
100  }
101 
102  }
103 
104  //VLE flag set to false
105  m_is_VLE=0;
106  //Bdl value of B8 magnet is also set to 0 - the case for HLE runs..
107  m_B8_Bdl=0.0;
108  //set a previous vars to -1
109  m_prevrunNum = -1;
110  m_prevEnergy = -1.0;
111  m_preverrAbsEnergy = -1.0;
112  m_preverrCollimators = -1.0;
113  m_preverrCurrents = -1.0;
114  m_prevsycLoss = -1.0;
115  m_preverrSycLoss = -1.0;
116  m_prevB3 = -1.0;
117  m_prevB4 = -1.0;
118  m_prevB8 = -1.0;
119 
120  return StatusCode::SUCCESS;
121 }
122 
123 
125 
126  const EventContext& ctx = Gaudi::Hive::currentContext();
127 
130 
131  if ( m_DBRead ) {
132 
133  int run = ctx.eventID().run_number();
134  uint64_t event = ctx.eventID().event_number();
135 
136  ATH_MSG_VERBOSE( "run " << run );
137 
138  if((event > 0) && (m_prevrunNum==-1))
139  m_prevrunNum=run;//initializing the prev run
140 
141  // This tool handles the conversion between local and ctb coordinates
142  ATH_CHECK( m_coord.retrieve() );
143  m_runEta_nt = m_coord->beam_local_eta();
144 
145  ATH_CHECK( m_runpar.retrieve() );
146 
147  if ( m_computeBeamEnergy ) {
148 
149  //below the calculation of all energies and their errors...
151 
152  ATH_MSG_DEBUG( "m_energy " << m_energy );
153  ATH_MSG_DEBUG( "m_errAbsEnergy " << m_errAbsEnergy );
154  ATH_MSG_DEBUG( "m_errCollimators " << m_errCollimators );
155  ATH_MSG_DEBUG( "m_errCurrents " << m_errCurrents );
156  ATH_MSG_DEBUG( "m_sycLoss " << m_sycLoss );
157  ATH_MSG_DEBUG( "m_errSycLoss " << m_errSycLoss );
158 
159  }
160 
161  }//end of if (m_DBRead)
162 
163  return StatusCode::SUCCESS;
164 }
165 
166 
167 
168 
169 float CBNTAA_TBInfo::GetEnergy(float currB3, float currB4)
170 {
171  float Bdltot = GetBdl3(currB3) + GetBdl4(currB4);
172 
173  float energy = (0.3/41.)*Bdltot * 1000;
174 
175  return energy;
176 }
177 
178 
179 
181 {
182  float Bend3_low[2] = {0.0079347, 0.021813};
183  float Bend3_high[4] = {0.437329, 0.0212849, 0.00000355516, -0.0000000147542};
184 
185  float Bdl3 = 0;
186 
187  current = fabs(current);
188 
189  if (current <= 824.12) Bdl3 = Bend3_low[0] + Bend3_low[1]*current;
190  else Bdl3 = Bend3_high[0] + Bend3_high[1]*current + Bend3_high[2]*(current-824.12)*(current-824.12) + Bend3_high[3]*(current-824.12)*(current-824.12)*(current-824.12);
191 
192  return Bdl3;
193 }
194 
195 
197 {
198  float Bend4_low[2] = {0.00786406, 0.021814};
199  float Bend4_high[4] = {0.434258, 0.0212899, 0.00000356113, -0.0000000147379};
200 
201  float Bdl4 = 0;
202 
203  current = fabs(current);
204 
205  if (current <= 824.12) Bdl4 = Bend4_low[0] + Bend4_low[1]*current;
206  else Bdl4 = Bend4_high[0] + Bend4_high[1]*current + Bend4_high[2]*(current-824.12)*(current-824.12) + Bend4_high[3]*(current-824.12)*(current-824.12)*(current-824.12);
207 
208  return Bdl4;
209 }
210 
211 
212 float CBNTAA_TBInfo::GetErrColl(float coll3_down, float coll3_up, float coll9_down, float coll9_up)
213 {
214  float coll3_opening = (fabs(coll3_down) + fabs(coll3_up))/2.0;
215  float coll9_opening = (fabs(coll9_down) + fabs(coll9_up))/2.0;
216 
217  float errcoll = sqrt(coll3_opening*coll3_opening + coll9_opening*coll9_opening)*(1./27);
218 
219  return errcoll;
220 }
221 
223 {
224  float fac = 25./energy;
225  float err_abs = sqrt(fac*fac + 0.5*0.5);
226 
227  return err_abs;
228 }
229 
230 
231 float CBNTAA_TBInfo::GetErrCurr(float currB3, float currB4)
232 {
233  float Bdl3 = GetBdl3(currB3);
234  float Bdl4 = GetBdl4(currB4);
235 
236  float Bdl_tot = Bdl3 + Bdl4;
237 
238  float errBdl3 = (GetBdl3(currB3 + 0.1) - GetBdl3(currB3 - 0.1))/2;
239  float errBdl4 = (GetBdl4(currB4 + 0.1) - GetBdl4(currB4 - 0.1))/2;
240  const float fac3 = errBdl3/Bdl3;
241  const float fac4 = errBdl4/Bdl4;
242  float errBdl = sqrt(fac3*fac3 + fac4*fac4)*Bdl_tot;
243 
244  float resField = sqrt(0.0010*0.0010 + 0.0010*0.0010);
245 
246  errBdl = sqrt(errBdl*errBdl + resField*resField + Bdl_tot*0.0003 * Bdl_tot*0.0003)/Bdl_tot*100;
247 
248  return errBdl;
249 }
250 
251 
252 
253 float CBNTAA_TBInfo::SyncLoss(float energy, float currB3, float currB4)
254 {
255  float Lmag = 5.127;
256 
257  float Bdl_B3 = GetBdl3(currB3);
258  float Bdl_B4 = GetBdl4(currB4);
259 
260  float B2dl_B3 = (Bdl_B3 * Bdl_B3)*(1./(Lmag*9));
261  float B2dl_B4 = (Bdl_B4 * Bdl_B4)*(1./(Lmag*9));
262  float B2dl_tot = B2dl_B3 + B2dl_B4;
263 
264  float B5suB34 = 0.19;
265  float B6suB34 = 0.22;
266  float B56lB34 = 0.25;
267 
268  float B2dl_B5 = (B2dl_B3 + B2dl_B4)*B5suB34*B5suB34*B56lB34;
269  float B2dl_B6 = (B2dl_B3 + B2dl_B4)*B6suB34*B6suB34*B56lB34;
270 
271  float loss = 0.00000127*energy*energy*(3*B2dl_tot/2 + B2dl_B5 + B2dl_B6);
272  return loss;
273 }
274 
275 
276 
277 float CBNTAA_TBInfo::SyncLossErr(float loss)
278 {
279  float errloss = loss * 0.02;
280  return errloss;
281 }
282 
283 
284 
286 
287  return StatusCode::SUCCESS;
288 }
289 
290 // Clear vectors
291 
293 {
294  if(m_quad_file) m_quad_file->clear();
295  if(m_quad_equip) m_quad_equip->clear();
296  if(m_bend_file) m_bend_file->clear();
297  if(m_bend_equip) m_bend_equip->clear();
298  if(m_trim_file) m_trim_file->clear();
299  if(m_trim_equip) m_trim_equip->clear();
300  if(m_coll_file) m_coll_file->clear();
301  if(m_coll_equip) m_coll_equip->clear();
302 
303 
304  return StatusCode::SUCCESS;
305 }
306 //new method which will clculate all energies and their errors using info provided by m_runpar variable
308 
309  int run = runNumber;
310  int event = eventNumber;
311 
312  ATH_MSG_VERBOSE( "run " << run );
313 
314  //check if the run is a VLE run then set the flag
315  if (((run < 2101225) && (run >= 2101022)) || ((run < 2102165) && (run >= 2102003)))
316  m_is_VLE=1;
317 
318  //starting from event=2 we dont have to recalculate the variables unless the run number changes
319  if (event > 1)
320  {
321  if (run == m_prevrunNum)
322  {
329 
330  return;
331  }
332  else
334  }
335 
336  m_runEnergy_nt= m_runpar->beam_energy();
337  m_runParticleType_nt = m_runpar->beam_type();
338 
339  float bend_equip[9];
340  float coll_equip[24];
341 
342  int nc_quad = 22;
343  int nc_bend = 9;
344  int nc_trim = 10;
345  int nc_coll = 24;
346 
347  const char* folder;
348  if (m_dumpBeamLine == true)
349  {
350 // const GenericDbTable* dcstbl_quad_file[22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
351 // const GenericDbTable* dcstbl_quad_equip[22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
352 // const GenericDbTable* dcstbl_bend_file[9] = {0,0,0,0,0,0,0,0,0};
353 // const GenericDbTable* dcstbl_bend_equip[9] = {0,0,0,0,0,0,0,0,0};
354 // const GenericDbTable* dcstbl_trim_file[10] = {0,0,0,0,0,0,0,0,0,0};
355 // const GenericDbTable* dcstbl_trim_equip[10] = {0,0,0,0,0,0,0,0,0,0};
356 // const GenericDbTable* dcstbl_coll_file[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
357 // const GenericDbTable* dcstbl_coll_equip[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
358 
359 // int ncol_quad_file[22], nrow_quad_file[22];
360 // int ncol_bend_file[9], nrow_bend_file[9];
361 // int ncol_trim_file[10], nrow_trim_file[10];
362 // int ncol_coll_file[24], nrow_coll_file[24];
363 // int ncol_quad_equip[22], nrow_quad_equip[22];
364 // int ncol_bend_equip[9], nrow_bend_equip[9];
365 // int ncol_trim_equip[10], nrow_trim_equip[10];
366 // int ncol_coll_equip[24], nrow_coll_equip[24];
367 
368 // std::vector<std::string> names_quad_file[22], rows_quad_file[22];
369 // std::vector<std::string> names_bend_file[9], rows_bend_file[9];
370 // std::vector<std::string> names_trim_file[10], rows_trim_file[10];
371 // std::vector<std::string> names_coll_file[24], rows_coll_file[24];
372 // std::vector<std::string> names_quad_equip[22], rows_quad_equip[22];
373 // std::vector<std::string> names_bend_equip[9], rows_bend_equip[9];
374 // std::vector<std::string> names_trim_equip[10], rows_trim_equip[10];
375 // std::vector<std::string> names_coll_equip[24], rows_coll_equip[24];
376 
377  float quad_file[22];
378  float bend_file[9];
379  float trim_file[10];
380  float coll_file[24];
381  float quad_equip[22];
382  float trim_equip[10];
383 
384  m_quad_file->reserve(nc_quad);
385  m_quad_equip->reserve(nc_quad);
386  for (int i=0; i<nc_quad; i++)
387  {
388  quad_file[i] = -1;
389  quad_equip[i] = -1;
390  unsigned int val1;
391  unsigned int val2;
392 
393 #if 0
394  if (run < 1000454)
395  {
396  folder = "/TILE/DCS/SYSTEM1/BEAM";
397  }
398  else
399 #endif
400  {
401  folder = "/TILE/DCS/SYSTEM1/BEAM";
402  }
403  val1 = i+6;
404  val2 = i+48;
405 
406  if (StatusCode::SUCCESS!=m_runpar->getVal(folder,val1,quad_file[i])) {
407  ATH_MSG_ERROR( "Cannot find val" << val1 );
408  }
409  if (StatusCode::SUCCESS!=m_runpar->getVal(folder,val2,quad_equip[i])){
410  ATH_MSG_ERROR( "Cannot find val" << val2 );
411  }
412 
413  (*m_quad_file)[i] = quad_file[i];
414  (*m_quad_equip)[i] = quad_equip[i];
415  }
416 
417 
418  m_bend_file->reserve(nc_bend);
419  m_bend_equip->reserve(nc_bend);
420  for (int i=0; i<nc_bend; i++)
421  {
422  bend_file[i] = -1;
423  bend_equip[i] = -1;
424  unsigned int val1;
425  unsigned int val2;
426 
427  if (run < 1000454)
428  {
429  folder = "/TILE/DCS/SYSTEM1/BEAM";
430  }
431  else
432  {
433  folder = "/TILE/DCS/TILE_LV_62/BEAM";
434  }
435  val1 = i+28;
436  val2 = i+70;
437 
438  if (StatusCode::SUCCESS!=m_runpar->getVal(folder,val1,bend_file[i])) {
439  ATH_MSG_ERROR( "Cannot find val" << val1 );
440  }
441  if (StatusCode::SUCCESS!=m_runpar->getVal(folder,val2,bend_equip[i])) {
442  ATH_MSG_ERROR( "Cannot find val" << val2 );
443  }
444 
445  (*m_bend_file)[i] = bend_file[i];
446  (*m_bend_equip)[i] = bend_equip[i];
447 
448  //added on 12.03.2006 by H.Hakobyan for caching purposes
449  if (!m_is_VLE)
450  {
451  //if the currents B3 and B4 are the same as in previous event then quit..
452  if((m_prevB3 == bend_equip[2]) && (m_prevB4 == bend_equip[3]))
453  return;
454  }
455  else
456  {
457  //if the current B8 is the same as in previous event then quit..
458  if(m_prevB8 == bend_equip[7])
459  return;
460  }
461 
462  }
463 
464  m_trim_file->reserve(nc_trim);
465  m_trim_equip->reserve(nc_trim);
466  for (int i=0; i<nc_trim; i++)
467  {
468  trim_file[i] = -1;
469  trim_equip[i] = -1;
470  unsigned int val1;
471  unsigned int val2;
472 
473  if (run < 1000454)
474  {
475  folder = "/TILE/DCS/SYSTEM1/BEAM";
476  }
477  else
478  {
479  folder = "/TILE/DCS/TILE_LV_62/BEAM";
480  }
481  val1 = i+37;
482  val2 = i+79;
483 
484  if (StatusCode::SUCCESS!=m_runpar->getVal(folder,val1,trim_file[i])) {
485  ATH_MSG_ERROR( "Cannot find val" << val1 );
486  }
487  if (StatusCode::SUCCESS!=m_runpar->getVal(folder,val2,trim_equip[i])) {
488  ATH_MSG_ERROR( "Cannot find val" << val2 );
489  }
490 
491  (*m_trim_file)[i] = trim_file[i];
492  (*m_trim_equip)[i] = trim_equip[i];
493  }
494 
495 
496  m_coll_file->reserve(nc_coll);
497  m_coll_equip->reserve(nc_coll);
498  for (int i=0; i<nc_coll; i++)
499  {
500  coll_file[i] = -1;
501  coll_equip[i] = -1;
502  unsigned int val1;
503  unsigned int val2;
504 
505 
506  if (run < 1000454)
507  {
508  folder = "/TILE/DCS/SYSTEM1/BEAM";
509  }
510  else
511  {
512  folder = "/TILE/DCS/TILE_LV_62/BEAM";
513  }
514  val1 = i+90;
515  val2 = i+115;
516 
517  if (StatusCode::SUCCESS!=m_runpar->getVal(folder,val1,coll_file[i])) {
518  ATH_MSG_ERROR( "Cannot find val" << val1 );
519  }
520  if (StatusCode::SUCCESS!=m_runpar->getVal(folder,val2,coll_equip[i])) {
521  ATH_MSG_ERROR( "Cannot find val" << val2 );
522  }
523 
524  (*m_coll_file)[i] = coll_file[i];
525  (*m_coll_equip)[i] = coll_equip[i];
526  }
527 
528 
529  for (int i=0; i<nc_quad; i++)
530  {
531  ATH_MSG_DEBUG( "Q" << i+1 << " from file " << (*m_quad_file)[i] );
532  }
533  for (int i=0; i<nc_bend; i++)
534  {
535  ATH_MSG_DEBUG( "B" << i+1 << " from file " << (*m_bend_file)[i] );
536  }
537  for (int i=0; i<nc_trim; i++)
538  {
539  ATH_MSG_DEBUG( "Trim" << i+1 << " from file " << (*m_trim_file)[i] );
540  }
541  for (int i=0; i<nc_coll; i++)
542  {
543  int j = i/2;
544  if (i == 2*j)
545  {
546  ATH_MSG_DEBUG( "Coll" << j+1 << " from file (up or right position) " << (*m_coll_file)[i] );
547  ATH_MSG_DEBUG( "Coll" << j+1 << " from file (down or left position) " << (*m_coll_file)[i+1] );
548  }
549  }
550 
551 
552  for (int i=0; i<nc_quad; i++)
553  {
554  ATH_MSG_DEBUG( "Q" << i+1 << " from equipement " << (*m_quad_equip)[i] );
555  }
556  for (int i=0; i<nc_bend; i++)
557  {
558  ATH_MSG_DEBUG( "B" << i+1 << " from equipement " << (*m_bend_equip)[i] );
559  }
560  for (int i=0; i<nc_trim; i++)
561  {
562  ATH_MSG_DEBUG( "Trim" << i+1 << " from equipement " << (*m_trim_equip)[i] );
563  }
564  for (int i=0; i<nc_coll; i++)
565  {
566  int j = i/2;
567  if (i == 2*j)
568  {
569  ATH_MSG_DEBUG( "Coll" << j+1 << " from equipement (up or right position) " << (*m_coll_equip)[i] );
570  ATH_MSG_DEBUG( "Coll" << j+1 << " from file (down or left position) " << (*m_coll_equip)[i+1] );
571  }
572  }//for
573  }//end of if (m_dumpBeamLine = true)
574  else // if(m_dumpBeamLine == false)
575  {
576 // const GenericDbTable* dcstbl_bend_equip[9] = {0,0,0,0,0,0,0,0,0};
577 // const GenericDbTable* dcstbl_coll_equip[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
578 // int ncol_bend_equip[9], nrow_bend_equip[9];
579 // int ncol_coll_equip[9], nrow_coll_equip[9];
580 // std::vector<std::string> names_bend_equip[9], rows_bend_equip[9];
581 // std::vector<std::string> names_coll_equip[9], rows_coll_equip[9];
582 
583  for (int i=0; i<nc_bend; i++)
584  {
585  bend_equip[i] = -1;
586  unsigned int val2;
587 
588  if (run < 1000454)
589  {
590  folder = "/TILE/DCS/SYSTEM1/BEAM";
591  }
592  else
593  {
594  folder = "/TILE/DCS/TILE_LV_62/BEAM";
595  }
596  val2 = i+70;
597  if (StatusCode::SUCCESS!=m_runpar->getVal(folder,val2,bend_equip[i])) {
598  ATH_MSG_ERROR( "Cannot find val" << val2 );
599  }
600  }
601 
602 
603  for (int i=0; i<nc_coll; i++)
604  {
605  coll_equip[i] = -1;
606  unsigned int val2;
607 
608  if (run < 1000454)
609  {
610  folder = "/TILE/DCS/SYSTEM1/BEAM";
611  }
612  else
613  {
614  folder = "/TILE/DCS/TILE_LV_62/BEAM";
615  }
616  val2 = i+115;
617  if (StatusCode::SUCCESS!=m_runpar->getVal(folder,val2,coll_equip[i])) {
618  ATH_MSG_ERROR( "Cannot find val" << val2 );
619  }
620  }
621 
622  }//end of if(m_dumpBeamLine = false)
623 
624  //check if the run is a VLE run then set the flag
625  //if (((run < 2101225) && (run >= 2101022)) || ((run < 2102165) && (run >= 2102003)))
626  // m_is_VLE=1;
627 
628  // --- modifying the code introducing two cases - for VLE and HLE, with different beam energy calculations ---
629  if(m_is_VLE)//run is a VLE run
630  {
631 
632  //ATH_MSG_INFO( "THIS is a VLE run..." );
633  //ATH_MSG_INFO( "B8 current=" << bend_equip[7] );
634 
635  //a polynomial function giving the values of Bdl for any given B8 current value...MIGRAD method for 4th order polynome ...:)
636  // m_B8_Bdl = 0.00525593*bend_equip[7] + 0.00000410442*bend_equip[7]*bend_equip[7] -
637  // 0.00000000906592*bend_equip[7]*bend_equip[7]*bend_equip[7]+
638  // 0.00000000000345019*bend_equip[7]*bend_equip[7]*bend_equip[7]*bend_equip[7];
639 
640  //a polynomial function giving the values of Bdl for any given B8 current value...MINOS method ...for 5th order polynome:)
641  m_B8_Bdl = 0.00530982*bend_equip[7] + 0.00000328502*bend_equip[7]*bend_equip[7] -
642  0.00000000532397*bend_equip[7]*bend_equip[7]*bend_equip[7]-
643  0.00000000000276483*bend_equip[7]*bend_equip[7]*bend_equip[7]*bend_equip[7]+
644  0.000000000000003368*bend_equip[7]*bend_equip[7]*bend_equip[7]*bend_equip[7]*bend_equip[7];
645 
646  //beam energy calculation basedon a famous formula..
647  m_energy = 2.49826 * m_B8_Bdl;
649 
650  ATH_MSG_DEBUG( "B8dl=" << m_B8_Bdl );
651  ATH_MSG_DEBUG( "m_energy=" << m_energy );
652 
653  //C12 opening calculations... C12 is the onlycollimator which is responsible for VLE runs
654  float coll12_opening = (fabs(coll_equip[11]) + fabs(coll_equip[23]))/2.0;
655  m_errCollimators = sqrt(coll12_opening*coll12_opening)*(1./27);
656 
657  //calculation of errors of magnet currents..
658  m_errCurrents = GetErrCurr(bend_equip[6], bend_equip[7]);
659  m_sycLoss = SyncLoss(m_energy, bend_equip[6], bend_equip[7]);
661 
662  //for caching purposes
663  m_prevB8 = bend_equip[7];
664  }
665  else//run is a HLE run
666  {
667  m_energy = GetEnergy(bend_equip[2], bend_equip[3]);
669  m_errCollimators = GetErrColl(coll_equip[4], coll_equip[5], coll_equip[16], coll_equip[17]);
670  m_errCurrents = GetErrCurr(bend_equip[2], bend_equip[3]);
671  m_sycLoss = SyncLoss(m_energy, bend_equip[2], bend_equip[3]);
673 
674  //for caching purposes
675  m_prevB3 = bend_equip[2];
676  m_prevB4 = bend_equip[3];
677  }
678 
679  //assigning the previous vars for caching..
686 
687 
688 }
689 
CBNTAA_TBInfo::m_quad_file
std::vector< float > * m_quad_file
Definition: CBNTAA_TBInfo.h:68
fillPileUpNoiseLumi.current
current
Definition: fillPileUpNoiseLumi.py:52
CBNTAA_TBInfo::m_errAbsEnergy
float m_errAbsEnergy
Definition: CBNTAA_TBInfo.h:81
CBNTAA_TBInfo::m_coll_file
std::vector< float > * m_coll_file
Definition: CBNTAA_TBInfo.h:77
CBNTAA_TBInfo::GetErrColl
float GetErrColl(float coll3_down, float coll3_up, float coll9_down, float coll9_up)
Definition: CBNTAA_TBInfo.cxx:212
CBNTAA_TBInfo::calculateAll
void calculateAll(int runNumber, int eventNumber)
Definition: CBNTAA_TBInfo.cxx:307
CBNTAA_TBInfo.h
CBNTAA_TBInfo::m_runpar
ToolHandle< TBCondRunParTool > m_runpar
Definition: CBNTAA_TBInfo.h:37
CBNTAA_TBInfo::m_runParticleType_nt
long m_runParticleType_nt
Definition: CBNTAA_TBInfo.h:65
CBNTAA_TBInfo::SyncLossErr
float SyncLossErr(float loss)
Definition: CBNTAA_TBInfo.cxx:277
CBNTAA_TBInfo::GetErrAbsE
float GetErrAbsE(float energy)
Definition: CBNTAA_TBInfo.cxx:222
CBNTAA_TBInfo::m_prevEnergy
float m_prevEnergy
Definition: CBNTAA_TBInfo.h:50
CBNTAA_TBInfo::m_energy
float m_energy
Definition: CBNTAA_TBInfo.h:80
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CBNTAA_TBInfo::GetErrCurr
float GetErrCurr(float currB3, float currB4)
Definition: CBNTAA_TBInfo.cxx:231
CBNTAA_TBInfo::m_preverrAbsEnergy
float m_preverrAbsEnergy
Definition: CBNTAA_TBInfo.h:51
CBNTAA_TBInfo::m_prevB8
float m_prevB8
Definition: CBNTAA_TBInfo.h:58
CBNTAA_TBInfo::m_trim_equip
std::vector< float > * m_trim_equip
Definition: CBNTAA_TBInfo.h:75
CBNTAA_TBInfo::CBNT_finalize
virtual StatusCode CBNT_finalize() override
Definition: CBNTAA_TBInfo.cxx:285
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
CBNTAA_TBInfo::m_bend_equip
std::vector< float > * m_bend_equip
Definition: CBNTAA_TBInfo.h:72
CBNTAA_TBInfo::m_B8_Bdl
float m_B8_Bdl
Definition: CBNTAA_TBInfo.h:45
CBNTAA_TBInfo::m_prevB4
float m_prevB4
Definition: CBNTAA_TBInfo.h:57
TBCaloCoordinate.h
CBNTAA_TBInfo::m_is_VLE
bool m_is_VLE
Definition: CBNTAA_TBInfo.h:46
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
CBNTAA_TBInfo::m_sycLoss
float m_sycLoss
Definition: CBNTAA_TBInfo.h:84
CBNTAA_TBInfo::m_errCollimators
float m_errCollimators
Definition: CBNTAA_TBInfo.h:82
CBNTAA_TBInfo::GetEnergy
float GetEnergy(float CurrB3, float CurrB4)
Definition: CBNTAA_TBInfo.cxx:169
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CBNTAA_TBInfo::m_prevB3
float m_prevB3
Definition: CBNTAA_TBInfo.h:56
CBNTAA_TBInfo::m_trim_file
std::vector< float > * m_trim_file
Definition: CBNTAA_TBInfo.h:74
CBNTAA_TBInfo::m_computeBeamEnergy
bool m_computeBeamEnergy
Definition: CBNTAA_TBInfo.h:41
CBNTAA_TBInfo::m_preverrSycLoss
float m_preverrSycLoss
Definition: CBNTAA_TBInfo.h:55
CBNTAA_TBInfo::GetBdl3
float GetBdl3(float current)
Definition: CBNTAA_TBInfo.cxx:180
CBNTAA_TBInfo::CBNTAA_TBInfo
CBNTAA_TBInfo(const std::string &name, ISvcLocator *pSvcLocator)
Definition: CBNTAA_TBInfo.cxx:19
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
CBNT_TBRecBase
Definition: CBNT_TBRecBase.h:21
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
lumiFormat.i
int i
Definition: lumiFormat.py:85
CBNTAA_TBInfo::m_beamener
int m_beamener
Definition: CBNTAA_TBInfo.h:39
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CBNTAA_TBInfo::SyncLoss
float SyncLoss(float energy, float currB3, float currB4)
Definition: CBNTAA_TBInfo.cxx:253
CBNTAA_TBInfo::m_prevsycLoss
float m_prevsycLoss
Definition: CBNTAA_TBInfo.h:54
CBNT_TBRecBase::addBranch
void addBranch(const std::string &branchname, T &obj, const std::string &leaflist)
Definition: CBNT_TBRecBase.h:44
CBNTAA_TBInfo::m_beamtype
int m_beamtype
Definition: CBNTAA_TBInfo.h:40
CaloPhiRange.h
CaloPhiRange class declaration.
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
run
Definition: run.py:1
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
CBNTAA_TBInfo::CBNT_execute
virtual StatusCode CBNT_execute() override
Definition: CBNTAA_TBInfo.cxx:124
GenericDbTable.h
CBNTAA_TBInfo::m_DBRead
bool m_DBRead
Definition: CBNTAA_TBInfo.h:38
CBNTAA_TBInfo::m_quad_equip
std::vector< float > * m_quad_equip
Definition: CBNTAA_TBInfo.h:69
CBNTAA_TBInfo::m_preverrCurrents
float m_preverrCurrents
Definition: CBNTAA_TBInfo.h:53
CBNTAA_TBInfo::GetBdl4
float GetBdl4(float current)
Definition: CBNTAA_TBInfo.cxx:196
CBNTAA_TBInfo::m_coord
ToolHandle< ICaloCoordinateTool > m_coord
Definition: CBNTAA_TBInfo.h:36
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
CBNTAA_TBInfo::~CBNTAA_TBInfo
virtual ~CBNTAA_TBInfo()
Definition: CBNTAA_TBInfo.cxx:58
CBNTAA_TBInfo::m_bend_file
std::vector< float > * m_bend_file
Definition: CBNTAA_TBInfo.h:71
CaloCondBlobAlgs_fillNoiseFromASCII.folder
folder
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:56
TBCondRunParTool.h
CBNTAA_TBInfo::CBNT_clear
virtual StatusCode CBNT_clear() override
Definition: CBNTAA_TBInfo.cxx:292
CBNTAA_TBInfo::CBNT_initialize
virtual StatusCode CBNT_initialize() override
Definition: CBNTAA_TBInfo.cxx:70
CBNTAA_TBInfo::m_preverrCollimators
float m_preverrCollimators
Definition: CBNTAA_TBInfo.h:52
StoreGateSvc.h
CBNTAA_TBInfo::m_runEta_nt
double m_runEta_nt
Definition: CBNTAA_TBInfo.h:64
CBNTAA_TBInfo::m_prevrunNum
int m_prevrunNum
Definition: CBNTAA_TBInfo.h:49
CBNTAA_TBInfo::m_errSycLoss
float m_errSycLoss
Definition: CBNTAA_TBInfo.h:85
CBNTAA_TBInfo::m_coll_equip
std::vector< float > * m_coll_equip
Definition: CBNTAA_TBInfo.h:78
CBNTAA_TBInfo::m_runEnergy_nt
long m_runEnergy_nt
Definition: CBNTAA_TBInfo.h:66
CBNTAA_TBInfo::m_errCurrents
float m_errCurrents
Definition: CBNTAA_TBInfo.h:83
CBNTAA_TBInfo::m_dumpBeamLine
bool m_dumpBeamLine
Definition: CBNTAA_TBInfo.h:42