308
309 HVCutAverage = 1.05
310
311 HVCutLayers = 1.001
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
400
401
402
403
404
405
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
426
427 for ilayer in range(NLayers):
428
429
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
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
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
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
601
602
603 print ("Done!")
604
void print(char *figname, TCanvas *c1)