ATLAS Offline Software
Loading...
Searching...
No Matches
PlotCalibrationHV Namespace Reference

Classes

class  L1CaloHVReader

Functions

 isEmPresampler (layerName)
 isEmFront (layerName, isOverlap)
 isEmMiddle (layerName, isOverlap)
 isEmBack (layerName, isOverlap)
 isEmOverlapBack (layerName, isOverlap)
 isHadFirstLayer (layerName, TT_part)
 isHadSecondLayer (layerName, TT_part)
 isHadThirdLayer (layerName, TT_part)
 isHadFourthLayer (layerName, TT_part)
 PlotCalibrationHV (input_file_name=None)

Variables

 parser = OptionParser()
 action
 type
 dest
 help
 options
 args

Function Documentation

◆ isEmBack()

PlotCalibrationHV.isEmBack ( layerName,
isOverlap )

Definition at line 58 of file PlotCalibrationHV.py.

58def isEmBack(layerName,isOverlap):
59
60# layer number 3 in EMB and overlap, layer number 7 in EMEC, layer nr. 5 in overlap
61 isAccepted = False
62
63 if isOverlap:
64 if layerName == 5:
65 isAccepted = True
66 else:
67 if layerName == 3 or layerName == 7:
68 isAccepted = True
69
70 return isAccepted
71
72

◆ isEmFront()

PlotCalibrationHV.isEmFront ( layerName,
isOverlap )

Definition at line 27 of file PlotCalibrationHV.py.

27def isEmFront(layerName,isOverlap):
28
29# layer name 1 in EMB and overlap, name 5 in EMEC (name 5 in overlap goes with back layer)
30# EM overlap has layer names 0, 1, 2 (EMB) and 5,6 (EMEC)
31
32 isAccepted = False
33
34 if isOverlap:
35 if layerName == 1:
36 isAccepted = True
37 else:
38 if layerName == 1 or layerName == 5:
39 isAccepted = True
40
41 return isAccepted
42

◆ isEmMiddle()

PlotCalibrationHV.isEmMiddle ( layerName,
isOverlap )

Definition at line 43 of file PlotCalibrationHV.py.

43def isEmMiddle(layerName,isOverlap):
44
45# layer name 2 in EMB and overlap, name 6 in EMEC and 21 in FCAL0 (name 6 in overlap goes alone)
46 isAccepted = False
47
48 if isOverlap:
49 if layerName == 2:
50 isAccepted = True
51 else:
52 if layerName == 2 or layerName == 6 or layerName == 21:
53 isAccepted = True
54
55 return isAccepted
56
57

◆ isEmOverlapBack()

PlotCalibrationHV.isEmOverlapBack ( layerName,
isOverlap )

Definition at line 73 of file PlotCalibrationHV.py.

73def isEmOverlapBack(layerName,isOverlap):
74
75# layer number 6 in EM overlap, this one doesn't fit anywhere else...
76 isAccepted = False
77
78 if isOverlap and layerName == 6:
79 isAccepted = True
80
81 return isAccepted
82
83

◆ isEmPresampler()

PlotCalibrationHV.isEmPresampler ( layerName)

Definition at line 17 of file PlotCalibrationHV.py.

17def isEmPresampler(layerName):
18
19# layer name 0 in EMB and overlap, name 4 in EMEC
20
21 if layerName == 0 or layerName == 4:
22 return True
23 else:
24 return False
25
26

◆ isHadFirstLayer()

PlotCalibrationHV.isHadFirstLayer ( layerName,
TT_part )

Definition at line 84 of file PlotCalibrationHV.py.

84def isHadFirstLayer(layerName,TT_part):
85
86# layer number 8 in HEC, low eta part of 22 (FCAL2)
87 isAccepted = False
88 if layerName == 8 or (layerName == 22 and TT_part == 'EmecFcalLowEta'):
89 isAccepted = True
90
91 return isAccepted
92

◆ isHadFourthLayer()

PlotCalibrationHV.isHadFourthLayer ( layerName,
TT_part )

Definition at line 111 of file PlotCalibrationHV.py.

111def isHadFourthLayer(layerName,TT_part):
112
113# layer number 11 in HEC, high eta part of 23 (FCAL3)
114 isAccepted = False
115 if layerName == 11 or (layerName == 23 and TT_part == 'EmbFcalHighEta'):
116 isAccepted = True
117
118 return isAccepted
119

◆ isHadSecondLayer()

PlotCalibrationHV.isHadSecondLayer ( layerName,
TT_part )

Definition at line 93 of file PlotCalibrationHV.py.

93def isHadSecondLayer(layerName,TT_part):
94
95# layer number 9 in HEC, high eta part of 22 (FCAL2)
96 isAccepted = False
97 if layerName == 9 or (layerName == 22 and TT_part == 'EmbFcalHighEta'):
98 isAccepted = True
99
100 return isAccepted
101

◆ isHadThirdLayer()

PlotCalibrationHV.isHadThirdLayer ( layerName,
TT_part )

Definition at line 102 of file PlotCalibrationHV.py.

102def isHadThirdLayer(layerName,TT_part):
103
104# layer number 10 in HEC, low eta part of 23 (FCAL3)
105 isAccepted = False
106 if layerName == 10 or (layerName == 23 and TT_part == 'EmecFcalLowEta'):
107 isAccepted = True
108
109 return isAccepted
110

◆ PlotCalibrationHV()

PlotCalibrationHV.PlotCalibrationHV ( input_file_name = None)

Definition at line 307 of file PlotCalibrationHV.py.

307def PlotCalibrationHV(input_file_name=None):
308
309 HVCutAverage = 1.05 # lower cut on TT-averaged HV corrections
310# HVCutAverage = 1.01 # lower cut on TT-averaged HV corrections
311 HVCutLayers = 1.001 # lower cut on layer-by-layer corrections
312
313 ROOT.gStyle.SetPalette(1)
314 ROOT.gStyle.SetOptStat(111111)
315 ROOT.gStyle.SetCanvasColor(10)
316
317 c1 = ROOT.TCanvas('c1','Example',200,10,700,500)
318
319 h_MeanCorrEmecFcalLowEta_em = L1CaloMap("Mean HV corrections for EM (EMEC in overlap) ","#eta bin","#phi bin")
320 h_MeanCorrEmecFcalLowEta_had = L1CaloMap("Mean HV corrections for HAD (FCAL low #eta)","#eta bin","#phi bin")
321
322 h_MeanCorrEmbFcalHighEta_em = L1CaloMap("Mean HV corrections for EM overlap (EMB)","#eta bin","#phi bin")
323 h_MeanCorrEmbFcalHighEta_had = L1CaloMap("Mean HV corrections for HAD FCAL (high #eta)","#eta bin","#phi bin")
324
325
326 h_LayerCorr_presampler = L1CaloMap("HV corrections for EM presampler ","#eta bin","#phi bin")
327 h_CellFraction_presampler = L1CaloMap("Fraction of HV affected cells in EM presampler","#eta bin","#phi bin")
328 h_LayerCorr_em_front = L1CaloMap("HV corrections for EM front layer ","#eta bin","#phi bin")
329 h_CellFraction_em_front = L1CaloMap("Fraction of HV affected cells in EM front layer","#eta bin","#phi bin")
330 h_LayerCorr_em_middle = L1CaloMap("HV corrections for EM middle layer ","#eta bin","#phi bin")
331 h_CellFraction_em_middle = L1CaloMap("Fraction of HV affected cells in EM middle layer","#eta bin","#phi bin")
332 h_LayerCorr_em_back = L1CaloMap("HV corrections for EM back layer","#eta bin","#phi bin")
333 h_CellFraction_em_back = L1CaloMap("Fraction of HV affected cells in EM back layer","#eta bin","#phi bin")
334
335 h_LayerCorr_em_overlap_back = L1CaloMap("HV corrections for EM overlap back layer","#eta bin","#phi bin")
336 h_CellFraction_em_overlap_back = L1CaloMap("Fraction of HV affected cells in EM overlap back layer","#eta bin","#phi bin")
337
338 h_LayerCorr_had_first = L1CaloMap("HV corrections for first HAD layer (low #eta FCAL2)","#eta bin","#phi bin")
339 h_CellFraction_had_first = L1CaloMap("Fraction of HV affected cells in first HAD layer (low #eta FCAL2)","#eta bin","#phi bin")
340 h_LayerCorr_had_second = L1CaloMap("HV corrections for second HAD layer (high #eta FCAL2)","#eta bin","#phi bin")
341 h_CellFraction_had_second = L1CaloMap("Fraction of HV affected cells in second HAD layer (high #eta FCAL2)","#eta bin","#phi bin")
342 h_LayerCorr_had_third = L1CaloMap("HV corrections for third HAD layer (low #eta FCAL3)","#eta bin","#phi bin")
343 h_CellFraction_had_third = L1CaloMap("Fraction of HV affected cells in third HAD layer (low #eta FCAL3)","#eta bin","#phi bin")
344 h_LayerCorr_had_fourth = L1CaloMap("HV corrections for fourth HAD layer (high #eta FCAL3)","#eta bin","#phi bin")
345 h_CellFraction_had_fourth = L1CaloMap("Fraction of HV affected cells in fourth HAD layer (high #eta FCAL3)","#eta bin","#phi bin")
346
347
348
349 geometry_convertor = L1CaloGeometryConvertor()
350 geometry_convertor.LoadReceiverPPMMap()
351
352
353 input_file = input_file_name
354 print(("Taking HV information from file",input_file ))
355
356 hv_status = L1CaloHVReader(input_file)
357
358 large_hv_file = open('large_hv_corr.txt','w')
359
360 for ReceiverId in list(hv_status.GetMeanCorections().keys()):
361
362 MeanHVCorrection = (hv_status.GetMeanCorections())[ReceiverId]
363 CorrLayers = [0,0,0,0]
364 CorrLayers[0] = (hv_status.GetCorLayer1())[ReceiverId]
365 CorrLayers[1] = (hv_status.GetCorLayer2())[ReceiverId]
366 CorrLayers[2] = (hv_status.GetCorLayer3())[ReceiverId]
367 CorrLayers[3] = (hv_status.GetCorLayer4())[ReceiverId]
368
369 NLayers = (hv_status.GetNLayers())[ReceiverId]
370
371 AffectedCells = [0,0,0,0]
372 AffectedCells[0] = (hv_status.GetAffectedCells1())[ReceiverId]
373 AffectedCells[1] = (hv_status.GetAffectedCells2())[ReceiverId]
374 AffectedCells[2] = (hv_status.GetAffectedCells3())[ReceiverId]
375 AffectedCells[3] = (hv_status.GetAffectedCells4())[ReceiverId]
376
377 NCells = [0,0,0,0]
378 NCells[0] = (hv_status.GetNCells1())[ReceiverId]
379 NCells[1] = (hv_status.GetNCells2())[ReceiverId]
380 NCells[2] = (hv_status.GetNCells3())[ReceiverId]
381 NCells[3] = (hv_status.GetNCells4())[ReceiverId]
382
383 LayerName = [0,0,0,0]
384 LayerName[0] = (hv_status.GetName1())[ReceiverId]
385 LayerName[1] = (hv_status.GetName2())[ReceiverId]
386 LayerName[2] = (hv_status.GetName3())[ReceiverId]
387 LayerName[3] = (hv_status.GetName4())[ReceiverId]
388
389 PPM_ID = geometry_convertor.getPPMfromReceiver(ReceiverId)
390 eta_bin = geometry_convertor.getEtaBin(PPM_ID)
391 phi_bin = geometry_convertor.getPhiBin(PPM_ID)
392
393 TT_part = 'EmecFcalLowEta'
394 if geometry_convertor.isPPMFCAL(PPM_ID) and geometry_convertor.getFCAL23RecEta(ReceiverId)=='HighEta':
395 TT_part = 'EmbFcalHighEta'
396 if geometry_convertor.isPPMOverlap(PPM_ID) and geometry_convertor.getOverlapLayer(ReceiverId)=='EMB':
397 TT_part = 'EmbFcalHighEta'
398
399# if geometry_convertor.isPPMOverlap(PPM_ID):
400# print ("Overlap tower COOL Id=%s Rx=%s layer=%s" % (PPM_ID,ReceiverId,geometry_convertor.getOverlapLayer(ReceiverId)))
401
402# if geometry_convertor.isPPMFCAL(PPM_ID):
403# print ("Overlap tower COOL Id=%s Rx=%s layer=%s" % (PPM_ID,ReceiverId,TT_part))
404
405# Mean corrections
406
407 if MeanHVCorrection > HVCutAverage and TT_part == 'EmecFcalLowEta':
408 if geometry_convertor.isCoolEm(PPM_ID):
409 h_MeanCorrEmecFcalLowEta_em.Fill(eta_bin,phi_bin,MeanHVCorrection)
410 large_hv_file.write("%3i %3i EM %12s Rx=%7s %.3f (%.3f %.3f %.3f %.3f) \n" % (eta_bin,phi_bin,PPM_ID,ReceiverId,MeanHVCorrection,CorrLayers[0],CorrLayers[1],CorrLayers[2],CorrLayers[3]))
411
412 if geometry_convertor.isCoolHad(PPM_ID):
413 h_MeanCorrEmecFcalLowEta_had.Fill(eta_bin,phi_bin,MeanHVCorrection)
414 large_hv_file.write("%3i %3i HAD %12s Rx=%7s %.3f (%.3f %.3f %.3f %.3f) \n" % (eta_bin,phi_bin,PPM_ID,ReceiverId,MeanHVCorrection,CorrLayers[0],CorrLayers[1],CorrLayers[2],CorrLayers[3]))
415
416 if MeanHVCorrection > HVCutAverage and TT_part == 'EmbFcalHighEta':
417 if geometry_convertor.isCoolEm(PPM_ID):
418 h_MeanCorrEmbFcalHighEta_em.Fill(eta_bin,phi_bin,MeanHVCorrection)
419 large_hv_file.write("%3i %3i EM %12s Rx=%7s %.3f (%.3f %.3f %.3f %.3f) \n" % (eta_bin,phi_bin,PPM_ID,ReceiverId,MeanHVCorrection,CorrLayers[0],CorrLayers[1],CorrLayers[2],CorrLayers[3]))
420
421 if geometry_convertor.isCoolHad(PPM_ID):
422 h_MeanCorrEmbFcalHighEta_had.Fill(eta_bin,phi_bin,MeanHVCorrection)
423 large_hv_file.write("%3i %3i HAD %12s Rx=%7s %.3f (%.3f %.3f %.3f %.3f) \n" % (eta_bin,phi_bin,PPM_ID,ReceiverId,MeanHVCorrection,CorrLayers[0],CorrLayers[1],CorrLayers[2],CorrLayers[3]))
424
425# Now go layer-by-layer
426
427 for ilayer in range(NLayers):
428
429# EM layers
430
431 if isEmPresampler(LayerName[ilayer]):
432 if CorrLayers[ilayer] > HVCutLayers:
433 h_LayerCorr_presampler.Fill(eta_bin,phi_bin,CorrLayers[ilayer])
434 h_CellFraction_presampler.Fill(eta_bin,phi_bin,float(AffectedCells[ilayer])/float(NCells[ilayer]))
435
436 if isEmFront(LayerName[ilayer],geometry_convertor.isPPMOverlap(PPM_ID)):
437 if CorrLayers[ilayer] > HVCutLayers:
438 h_LayerCorr_em_front.Fill(eta_bin,phi_bin,CorrLayers[ilayer])
439 h_CellFraction_em_front.Fill(eta_bin,phi_bin,float(AffectedCells[ilayer])/float(NCells[ilayer]))
440
441 if isEmMiddle(LayerName[ilayer],geometry_convertor.isPPMOverlap(PPM_ID)):
442 if CorrLayers[ilayer] > HVCutLayers:
443 h_LayerCorr_em_middle.Fill(eta_bin,phi_bin,CorrLayers[ilayer])
444 h_CellFraction_em_middle.Fill(eta_bin,phi_bin,float(AffectedCells[ilayer])/float(NCells[ilayer]))
445
446 if isEmBack(LayerName[ilayer],geometry_convertor.isPPMOverlap(PPM_ID)):
447 if CorrLayers[ilayer] > HVCutLayers:
448 h_LayerCorr_em_back.Fill(eta_bin,phi_bin,CorrLayers[ilayer])
449 h_CellFraction_em_back.Fill(eta_bin,phi_bin,float(AffectedCells[ilayer])/float(NCells[ilayer]))
450
451 if isEmOverlapBack(LayerName[ilayer],geometry_convertor.isPPMOverlap(PPM_ID)):
452 if CorrLayers[ilayer] > HVCutLayers:
453 h_LayerCorr_em_overlap_back.Fill(eta_bin,phi_bin,CorrLayers[ilayer])
454 h_CellFraction_em_overlap_back.Fill(eta_bin,phi_bin,float(AffectedCells[ilayer])/float(NCells[ilayer]))
455
456# HAD layers
457
458 if isHadFirstLayer(LayerName[ilayer],TT_part):
459 if CorrLayers[ilayer] > HVCutLayers:
460 h_LayerCorr_had_first.Fill(eta_bin,phi_bin,CorrLayers[ilayer])
461 h_CellFraction_had_first.Fill(eta_bin,phi_bin,float(AffectedCells[ilayer])/float(NCells[ilayer]))
462
463 if isHadSecondLayer(LayerName[ilayer],TT_part):
464 if CorrLayers[ilayer] > HVCutLayers:
465 h_LayerCorr_had_second.Fill(eta_bin,phi_bin,CorrLayers[ilayer])
466 h_CellFraction_had_second.Fill(eta_bin,phi_bin,float(AffectedCells[ilayer])/float(NCells[ilayer]))
467
468 if isHadThirdLayer(LayerName[ilayer],TT_part):
469 if CorrLayers[ilayer] > HVCutLayers:
470 h_LayerCorr_had_third.Fill(eta_bin,phi_bin,CorrLayers[ilayer])
471 h_CellFraction_had_third.Fill(eta_bin,phi_bin,float(AffectedCells[ilayer])/float(NCells[ilayer]))
472
473 if isHadFourthLayer(LayerName[ilayer],TT_part):
474 if CorrLayers[ilayer] > HVCutLayers:
475 h_LayerCorr_had_fourth.Fill(eta_bin,phi_bin,CorrLayers[ilayer])
476 h_CellFraction_had_fourth.Fill(eta_bin,phi_bin,float(AffectedCells[ilayer])/float(NCells[ilayer]))
477
478
479 large_hv_file.close()
480
481 # Draw mean corrections
482
483 h_MeanCorrEmecFcalLowEta_em.SetMinimum(1.)
484 h_MeanCorrEmecFcalLowEta_em.SetMaximum(2.1)
485 h_MeanCorrEmecFcalLowEta_em.Draw()
486 c1.Print("HVStatus.ps(")
487
488 h_MeanCorrEmecFcalLowEta_had.SetMinimum(1.)
489 h_MeanCorrEmecFcalLowEta_had.SetMaximum(2.1)
490 h_MeanCorrEmecFcalLowEta_had.Draw()
491 c1.Print("HVStatus.ps")
492
493
494 h_MeanCorrEmbFcalHighEta_em.SetMinimum(1.)
495 h_MeanCorrEmbFcalHighEta_em.SetMaximum(2.1)
496 h_MeanCorrEmbFcalHighEta_em.Draw()
497 c1.Print("HVStatus.ps")
498
499 h_MeanCorrEmbFcalHighEta_had.SetMinimum(1.)
500 h_MeanCorrEmbFcalHighEta_had.SetMaximum(2.1)
501 h_MeanCorrEmbFcalHighEta_had.Draw()
502 c1.Print("HVStatus.ps")
503
504
505 # Now EM layer-by-layer corrections
506
507 h_LayerCorr_presampler.SetMinimum(1.)
508 h_LayerCorr_presampler.SetMaximum(2.1)
509 h_LayerCorr_presampler.Draw()
510 c1.Print("HVStatus.ps")
511
512 h_CellFraction_presampler.SetMinimum(0.)
513 h_CellFraction_presampler.SetMaximum(1.1)
514 h_CellFraction_presampler .Draw()
515 c1.Print("HVStatus.ps")
516
517 h_LayerCorr_em_front.SetMinimum(1.)
518 h_LayerCorr_em_front.SetMaximum(2.1)
519 h_LayerCorr_em_front.Draw()
520 c1.Print("HVStatus.ps")
521
522 h_CellFraction_em_front.SetMinimum(0.)
523 h_CellFraction_em_front.SetMaximum(1.1)
524 h_CellFraction_em_front.Draw()
525 c1.Print("HVStatus.ps")
526
527 h_LayerCorr_em_middle.SetMinimum(1.)
528 h_LayerCorr_em_middle.SetMaximum(2.1)
529 h_LayerCorr_em_middle.Draw()
530 c1.Print("HVStatus.ps")
531
532 h_CellFraction_em_middle.SetMinimum(0.)
533 h_CellFraction_em_middle.SetMaximum(1.1)
534 h_CellFraction_em_middle.Draw()
535 c1.Print("HVStatus.ps")
536
537 h_LayerCorr_em_back.SetMinimum(1.)
538 h_LayerCorr_em_back.SetMaximum(2.1)
539 h_LayerCorr_em_back.Draw()
540 c1.Print("HVStatus.ps")
541
542 h_CellFraction_em_back.SetMinimum(0.)
543 h_CellFraction_em_back.SetMaximum(1.1)
544 h_CellFraction_em_back.Draw()
545 c1.Print("HVStatus.ps")
546
547 h_LayerCorr_em_overlap_back.SetMinimum(1.)
548 h_LayerCorr_em_overlap_back.SetMaximum(2.1)
549 h_LayerCorr_em_overlap_back.Draw()
550 c1.Print("HVStatus.ps")
551
552 h_CellFraction_em_overlap_back.SetMinimum(0.)
553 h_CellFraction_em_overlap_back.SetMaximum(1.1)
554 h_CellFraction_em_overlap_back.Draw()
555 c1.Print("HVStatus.ps")
556
557
558 h_LayerCorr_had_first.SetMinimum(1.)
559 h_LayerCorr_had_first.SetMaximum(2.1)
560 h_LayerCorr_had_first.Draw()
561 c1.Print("HVStatus.ps")
562
563 h_CellFraction_had_first.SetMinimum(0.)
564 h_CellFraction_had_first.SetMaximum(1.1)
565 h_CellFraction_had_first.Draw()
566 c1.Print("HVStatus.ps")
567
568 h_LayerCorr_had_second.SetMinimum(1.)
569 h_LayerCorr_had_second.SetMaximum(2.1)
570 h_LayerCorr_had_second.Draw()
571 c1.Print("HVStatus.ps")
572
573 h_CellFraction_had_second.SetMinimum(0.)
574 h_CellFraction_had_second.SetMaximum(1.1)
575 h_CellFraction_had_second.Draw()
576 c1.Print("HVStatus.ps")
577
578 h_LayerCorr_had_third.SetMinimum(1.)
579 h_LayerCorr_had_third.SetMaximum(2.1)
580 h_LayerCorr_had_third.Draw()
581 c1.Print("HVStatus.ps")
582
583 h_CellFraction_had_third.SetMinimum(0.)
584 h_CellFraction_had_third.SetMaximum(1.1)
585 h_CellFraction_had_third.Draw()
586 c1.Print("HVStatus.ps")
587
588 h_LayerCorr_had_fourth.SetMinimum(1.)
589 h_LayerCorr_had_fourth .SetMaximum(2.1)
590 h_LayerCorr_had_fourth.Draw()
591 c1.Print("HVStatus.ps")
592
593 h_CellFraction_had_fourth.SetMinimum(0.)
594 h_CellFraction_had_fourth.SetMaximum(1.1)
595 h_CellFraction_had_fourth.Draw()
596 c1.Print("HVStatus.ps)")
597
598
599 os.system("ps2pdf HVStatus.ps")
600 # os.system("cp HVStatus.pdf /home/jb/public_web/tmp ")
601
602
603 print ("Done!")
604
void print(char *figname, TCanvas *c1)

Variable Documentation

◆ action

PlotCalibrationHV.action

Definition at line 611 of file PlotCalibrationHV.py.

◆ args

PlotCalibrationHV.args

Definition at line 613 of file PlotCalibrationHV.py.

◆ dest

PlotCalibrationHV.dest

Definition at line 611 of file PlotCalibrationHV.py.

◆ help

PlotCalibrationHV.help

Definition at line 611 of file PlotCalibrationHV.py.

◆ options

PlotCalibrationHV.options

Definition at line 613 of file PlotCalibrationHV.py.

◆ parser

PlotCalibrationHV.parser = OptionParser()

Definition at line 609 of file PlotCalibrationHV.py.

◆ type

PlotCalibrationHV.type

Definition at line 611 of file PlotCalibrationHV.py.