240 def writeCes(self, tag="", Simulation=True, MBTSflag="7TeV", dCellWeight=1.2, eCellWeight=1.5, since=(MINRUN,MINLBK), until=(MAXRUN, MAXLBK), mode=
'DEFAULT'):
242 Write default drawer/mod=0/0 only for LBA and LBC.
243 EBA & EBC setup is messy and so each drawer is stored individually.
244 These values with dCellWeight = 1.0 correspond to real M7 ones.
245 These values with dCellWeight = 1.2 correspond to real M8 ones.
246 Mode = 'DEFAULT' means standard settings, any other mode means put 1 everywhere
247 and ignore weight for D-sampling.
250 self.log().
info(
"*** Writing Ces with tag %s", tag )
256 for ros
in range(1,3):
257 for mod
in range(64):
258 special[(ros,mod, 0)] = dCellWeight
259 special[(ros,mod,13)] = dCellWeight
260 special[(ros,mod,14)] = dCellWeight
261 special[(ros,mod,24)] = dCellWeight
262 special[(ros,mod,25)] = dCellWeight
263 special[(ros,mod,41)] = dCellWeight
264 special[(ros,mod,44)] = dCellWeight
266 for ros
in range(3,5):
267 for mod
in range(64):
268 special[(ros,mod, 2)] = dCellWeight
269 special[(ros,mod, 3)] = dCellWeight
270 special[(ros,mod, 4)] = dCellWeight
271 special[(ros,mod, 5)] = dCellWeight
273 for ros
in range(3,5):
274 for mod
in range(64):
275 special[(ros,mod, 0)] = eCellWeight
276 special[(ros,mod, 1)] = eCellWeight
277 special[(ros,mod,12)] = eCellWeight
278 special[(ros,mod,13)] = eCellWeight
279 special[(ros,mod,18)] = 1.0
280 special[(ros,mod,19)] = 1.0
284 special[(3,14, 0)] = 1.0
285 special[(3,14, 1)] = 1.0
286 special[(3,14, 2)] = 1.0
287 special[(3,14, 3)] = 1.0
288 special[(4,17, 0)] = 1.0
289 special[(4,17, 1)] = 1.0
290 special[(4,17, 2)] = 1.0
291 special[(4,17, 3)] = 1.0
293 special[(3,14,16)] = 1.0
294 special[(3,14,17)] = 1.0
295 special[(4,17,16)] = 1.0
296 special[(4,17,17)] = 1.0
298 special[(3,14,18)] = eCellWeight
299 special[(3,14,19)] = eCellWeight
300 special[(4,17,18)] = eCellWeight
301 special[(4,17,19)] = eCellWeight
305 mbts_inner = [38,39,40,41,54,55,56,57]
306 mbts_outer = [ 7,23,42,53]
310 eba_mbts_inner = [ 3,12,23,30,35,43,52,60]
311 eba_mbts_outer = [ 2,11,22,29,34,44,53,59]
312 ebc_mbts_inner = [ 4,12,19,27,36,44,54,61]
313 ebc_mbts_outer = [ 3,11,18,26,35,43,53,60]
319 nomHV_EBA_inner = [ 694., 692.3, 697., 698., 695., 697., 696., 695.3 ]
320 beta_EBA_inner = [ 7.099, 7., 7.188, 6.995, 6.917, 7.217, 6.863, 6.97 ]
322 nomHV_EBA_outer = [ 687., 695., 697.7, 692., 695., 696., 694., 696. ]
323 beta_EBA_outer = [ 6.903, 7.01, betaMean, betaMean, 6.918, betaMean, 7.072, betaMean ]
325 nomHV_EBC_inner = [ 696., 697., 696., 693., 694., 698., 695., 690. ]
326 beta_EBC_inner = [ betaMean, 7.26, 7.281, 6.98, 7.002, 6.845, 6.955, 7.167 ]
328 nomHV_EBC_outer = [ 697., 695., 695., 696., 696., 695., 696., 697. ]
329 beta_EBC_outer = [ 7.209, 7.084, 7.272, 7.093, 7.207, 7.02, 7.298, betaMean ]
336 mev2pcb = 1.050/1000.
337 ces_mbts_inner = 2.5751/mev2pcb * corrFactor
338 ces_mbts_outer = 1.8438/mev2pcb * corrFactor
346 mbtsMipInnerC.append(0.155 * 8.2/5.9)
347 mbtsMipInnerA.append(0.155 * 8.2/5.9)
350 mbtsMipOuterC = [ 0.16, 0.14, 0.155, 0.165, 0.14, 0.15, 0.185, 0.145 ]
351 mbtsMipOuterA = [ 0.15, 0.165, 0.135, 0.155, 0.13, 0.155, 0.165, 0.18 ]
359 newCesMbtsOuterC.append( mbtsMipOuterC[i]/(10. * 5.9/8.2) * ces_mbts_outer )
360 newCesMbtsOuterA.append( mbtsMipOuterA[i]/(10. * 5.9/8.2) * ces_mbts_outer )
361 newCesMbtsInnerC.append( mbtsMipInnerC[i]/10. * ces_mbts_inner )
362 newCesMbtsInnerA.append( mbtsMipInnerA[i]/10. * ces_mbts_inner )
365 newCesMbtsOuterC[0] *= 1.15
367 if not MBTSflag==
"13TeV" and not MBTSflag==
"8TeV" and not MBTSflag==
"7TeV" and not MBTSflag==
"900GeV":
368 print (
"MBTS flag",MBTSflag,
"is not recognized, assuming 7TeV")
371 print (
"setting MBTS weights for",MBTSflag)
373 if MBTSflag==
"13TeV" :
375 print (
"RUN2 configuration for MC")
378 ces_mbts_inner = 157.5/1.05
379 ces_mbts_outer = 157.5/1.05
380 chan_mbts_inner = 5-1
381 chan_mbts_outer = 13-1
385 for i,mod
in enumerate(mbts_inner):
386 special[(3,mod,chan_mbts_inner)] = ces_mbts_inner
387 print (
"EBA",mod+1,
"ch",chan_mbts_inner,
" inner MBTS = ",special[(3,mod,chan_mbts_inner)] )
389 for i,mod
in enumerate(mbts_outer):
390 special[(3,mod,chan_mbts_outer)] = ces_mbts_outer
391 print (
"EBA",mod+1,
"ch",chan_mbts_outer,
" outer MBTS = ",special[(3,mod,chan_mbts_outer)] )
393 for i,mod
in enumerate(mbts_inner):
394 special[(4,mod,chan_mbts_inner)] = ces_mbts_inner
395 print (
"EBC",mod+1,
"ch",chan_mbts_inner,
" inner MBTS = ",special[(4,mod,chan_mbts_inner)] )
397 for i,mod
in enumerate(mbts_outer):
398 special[(4,mod,chan_mbts_outer)] = ces_mbts_outer
399 print (
"EBC",mod+1,
"ch",chan_mbts_outer,
" outer MBTS = ",special[(4,mod,chan_mbts_outer)] )
403 print (
"RUN1 configuration for MC")
406 if MBTSflag==
"7TeV" or MBTSflag==
"8TeV" :
411 newCesMbtsOuterC[i] *=
pow( newHV/nomHV_EBC_outer[i], beta_EBC_outer[i] )
412 newCesMbtsOuterA[i] *=
pow( newHV/nomHV_EBA_outer[i], beta_EBA_outer[i] )
413 newCesMbtsInnerC[i] *=
pow( newHV/nomHV_EBC_inner[i], beta_EBC_inner[i] )
414 newCesMbtsInnerA[i] *=
pow( newHV/nomHV_EBA_inner[i], beta_EBA_inner[i] )
418 newCesMbtsOuterA[i] *=
pow( 820./newHV, beta_EBA_outer[i] )
421 if MBTSflag==
"7TeV" :
422 newCesMbtsInnerC[0] = 1.0e-20
427 for i,mod
in enumerate(eba_mbts_inner):
428 special[(3,mod,0)] = newCesMbtsInnerA[i]
429 print (
"EBA",mod+1,
" inner MBTS = ",special[(3,mod,0)] )
431 for i,mod
in enumerate(eba_mbts_outer):
432 special[(3,mod,0)] = newCesMbtsOuterA[i]
433 print (
"EBA",mod+1,
" outer MBTS = ",special[(3,mod,0)] )
435 for i,mod
in enumerate(ebc_mbts_inner):
436 special[(4,mod,0)] = newCesMbtsInnerC[i]
437 print (
"EBC",mod+1,
" inner MBTS = ",special[(4,mod,0)] )
439 for i,mod
in enumerate(ebc_mbts_outer):
440 special[(4,mod,0)] = newCesMbtsOuterC[i]
441 print (
"EBC",mod+1,
" outer MBTS = ",special[(4,mod,0)] )
445 if MBTSflag==
"13TeV" :
447 print (
"RUN2 configuration for DATA")
450 ces_mbts_inner = (1.036 * 0.987)/1.05
451 ces_mbts_outer = 1.0/1.05
452 chan_mbts_inner = 5-1
453 chan_mbts_outer = 13-1
456 for i,mod
in enumerate(mbts_inner):
457 special[(3,mod,chan_mbts_inner)] = ces_mbts_inner
458 print (
"EBA",mod+1,
"ch",chan_mbts_inner,
" inner MBTS = ",special[(3,mod,chan_mbts_inner)] )
460 for i,mod
in enumerate(mbts_outer):
461 special[(3,mod,chan_mbts_outer)] = ces_mbts_outer
462 print (
"EBA",mod+1,
"ch",chan_mbts_outer,
" outer MBTS = ",special[(3,mod,chan_mbts_outer)] )
464 for i,mod
in enumerate(mbts_inner):
465 special[(4,mod,chan_mbts_inner)] = ces_mbts_inner
466 print (
"EBC",mod+1,
"ch",chan_mbts_inner,
" inner MBTS = ",special[(4,mod,chan_mbts_inner)] )
468 for i,mod
in enumerate(mbts_outer):
469 special[(4,mod,chan_mbts_outer)] = ces_mbts_outer
470 print (
"EBC",mod+1,
"ch",chan_mbts_outer,
" outer MBTS = ",special[(4,mod,chan_mbts_outer)] )
474 print (
"RUN1 configuration for DATA")
477 ces_mbts_inner = 1.0/1.05
478 ces_mbts_outer = 1.0/1.05
481 for mod
in eba_mbts_inner:
482 special[(3,mod,0)] = ces_mbts_inner
483 print (
"EBA",mod+1,
" inner MBTS = ",special[(3,mod,0)] )
485 for mod
in eba_mbts_outer:
486 special[(3,mod,0)] = ces_mbts_outer
487 print (
"EBA",mod+1,
" outer MBTS = ",special[(3,mod,0)] )
489 for mod
in ebc_mbts_inner:
490 special[(4,mod,0)] = ces_mbts_inner
491 print (
"EBC",mod+1,
" inner MBTS = ",special[(4,mod,0)] )
493 for mod
in ebc_mbts_outer:
494 special[(4,mod,0)] = ces_mbts_outer
495 print (
"EBC",mod+1,
" outer MBTS = ",special[(4,mod,0)] )
498 default = cppyy.gbl.std.vector(
'float')()
500 default.push_back( 1.)
501 default.push_back( 1.)
502 default.push_back(700.)
503 default.push_back( 20.)
505 default.push_back( 1.)
506 default.push_back( -1.)
507 default.push_back( 0.)
508 default.push_back( 20.)
509 defVec = cppyy.gbl.std.vector(
'std::vector<float>')()
510 defVec.push_back(default)
513 folders = [self.__tilePrefixOfl+
"CALIB/CES",
514 self.__tilePrefixOnl+
"CALIB/CES"]
516 for folder
in folders:
517 multiVers=(
'OFL' in folder)
518 blobWriter = TileCalibTools.TileBlobWriter(self.__db,folder,
'Flt',multiVers)
521 util = cppyy.gbl.TileCalibUtils()
522 for ros
in range(util.max_ros()):
523 for drawer
in range(util.getMaxDrawer(ros)):
524 flt = blobWriter.zeroBlob(ros,drawer)
527 det = blobWriter.getDrawer(0,0)
528 det.init(defVec,48,1)
532 self.log().
info(
"*** Writing Ces defaults with dCellWeight = %.1f eCellWeight = %.1f", dCellWeight,eCellWeight )
534 lba = blobWriter.getDrawer(0,4)
535 lba.init(defVec,48,1)
536 lbc = blobWriter.getDrawer(0,8)
537 lbc.init(defVec,48,1)
538 for chan
in range(48):
540 ces = special.get(key,1.)
541 lba.setData(chan,0,0,ces)
542 lbc.setData(chan,0,0,ces)
545 eba = blobWriter.getDrawer(0,12)
546 eba.init(defVec,48,1)
547 ebc = blobWriter.getDrawer(0,16)
548 ebc.init(defVec,48,1)
549 for chan
in range(48):
551 ces = special.get(key,1.)
552 eba.setData(chan,0,0,ces)
553 ebc.setData(chan,0,0,ces)
557 for ros
in range(3,5):
558 for mod
in range(64):
559 flt = blobWriter.getDrawer(ros,mod)
560 flt.init(defVec,48,1)
561 for chan
in range(48):
563 ces = special.get(key,1.)
564 flt.setData(chan,0,0,ces)
567 blobWriter.setComment(self.__author,
"default cesium constants for Run %d and %s MBTS weights for %s" % (RUN,NEW,MBTSflag))
571 self.log().
info(
"*** Writing Ces = 1 everywhere" )
573 blobWriter.setComment(self.__author,
"cesium constants = 1 everywhere")
577 blobWriter.register(since,until,folderTag)