CMS 3D CMS Logo

RunInfoPayloadInspectoHelper.h
Go to the documentation of this file.
1 #ifndef CONDCORE_RUNINFOPLUGINS_RUNINFOPAYLOADINSPECTORHELPER_H
2 #define CONDCORE_RUNINFOPLUGINS_RUNINFOPAYLOADINSPECTORHELPER_H
3 
4 #include <vector>
5 #include <string>
6 #include "TH1.h"
7 #include "TH2.h"
8 #include "TStyle.h"
9 #include "TPaveText.h"
10 #include "TStyle.h"
12 
13 namespace RunInfoPI {
14 
15  // values are taken from https://github.com/cms-sw/cmssw/blob/master/MagneticField/GeomBuilder/plugins/VolumeBasedMagneticFieldESProducerFromDB.cc#L74-L75
16  constexpr std::array<int, 7> nominalCurrents{{-1, 0, 9558, 14416, 16819, 18268, 19262}};
17  constexpr std::array<float, 7> nominalFields{{3.8, 0., 2., 3., 3.5, 3.8, 4.}};
18 
19  // all parameter than can be displayed
20  enum parameters {
21  m_run, // int
22  m_start_time_ll, // long long;
23  m_stop_time_ll, // long long
24  m_start_current, // float
25  m_stop_current, // float
26  m_avg_current, // float
27  m_max_current, // float
28  m_min_current, // float
30  m_fedIN, // unsigned int
31  m_BField, // float
33  };
34 
35  /************************************************/
36  float theBField(const float current) {
37  // logic is taken from https://github.com/cms-sw/cmssw/blob/master/MagneticField/GeomBuilder/plugins/VolumeBasedMagneticFieldESProducerFromDB.cc#L156
38 
39  int i = 0;
40  for (; i < (int)nominalFields.size() - 1; i++) {
41  if (2 * current < nominalCurrents[i] + nominalCurrents[i + 1]) {
42  return nominalFields[i];
43  }
44  }
45  return nominalFields[i];
46  }
47 
48  /************************************************/
50  switch (parameter) {
51  case m_run:
52  return "run number";
53  case m_start_time_ll:
54  return "start time";
55  case m_stop_time_ll:
56  return "stop time";
57  case m_start_current:
58  return "start current [A]";
59  case m_stop_current:
60  return "stop current [A]";
61  case m_avg_current:
62  return "average current [A]";
63  case m_max_current:
64  return "max current [A]";
65  case m_min_current:
66  return "min current [A]";
68  return "run duration [#mus]";
69  case m_fedIN:
70  return "n. FEDs";
71  case m_BField:
72  return "B-field intensity [T]";
73  default:
74  return "should never be here";
75  }
76  }
77 
78  /************************************************/
80  static int pcol[20];
81 
82  float rgb[20][3];
83 
84  for (int i = 0; i < 20; i++) {
85  if (i < 17) {
86  rgb[i][0] = 0.80 + 0.01 * i;
87  rgb[i][1] = 0.00 + 0.03 * i;
88  rgb[i][2] = 0.00;
89  } else if (i < 19) {
90  rgb[i][0] = 0.80 + 0.01 * i;
91  rgb[i][1] = 0.00 + 0.03 * i + 0.15 + 0.10 * (i - 17);
92  rgb[i][2] = 0.00;
93  } else if (i == 19) {
94  rgb[i][0] = 0.00;
95  rgb[i][1] = 0.80;
96  rgb[i][2] = 0.00;
97  }
98  pcol[i] = TColor::GetColor(rgb[i][0], rgb[i][1], rgb[i][2]);
99  }
100 
101  gStyle->SetPalette(20, pcol);
102 
103  if (obj) {
104  obj->SetMinimum(-1.e-15);
105  obj->SetMaximum(+1.0);
106  obj->SetOption("colz");
107  }
108  }
109 
110 }; // namespace RunInfoPI
111 #endif
RunInfoPI::m_min_current
Definition: RunInfoPayloadInspectoHelper.h:28
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
RunInfoPI::nominalCurrents
constexpr std::array< int, 7 > nominalCurrents
Definition: RunInfoPayloadInspectoHelper.h:16
RunInfoPI::nominalFields
constexpr std::array< float, 7 > nominalFields
Definition: RunInfoPayloadInspectoHelper.h:17
RunInfoPI::m_stop_current
Definition: RunInfoPayloadInspectoHelper.h:25
RunInfoPI::m_start_current
Definition: RunInfoPayloadInspectoHelper.h:24
parameter
Definition: vlib.h:168
RunInfoPI::m_run
Definition: RunInfoPayloadInspectoHelper.h:21
RunInfoPI::m_run_intervall_micros
Definition: RunInfoPayloadInspectoHelper.h:29
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RunInfoPI::END_OF_TYPES
Definition: RunInfoPayloadInspectoHelper.h:32
RunInfoPI::m_BField
Definition: RunInfoPayloadInspectoHelper.h:31
createfilelist.int
int
Definition: createfilelist.py:10
RunInfoPI::theBField
float theBField(const float current)
Definition: RunInfoPayloadInspectoHelper.h:36
RunInfoPI::reportSummaryMapPalette
void reportSummaryMapPalette(TH2 *obj)
Definition: RunInfoPayloadInspectoHelper.h:79
RunInfoPI::parameters
parameters
Definition: RunInfoPayloadInspectoHelper.h:20
RunInfoPI
Definition: RunInfoPayloadInspectoHelper.h:13
RunInfoPI::m_max_current
Definition: RunInfoPayloadInspectoHelper.h:27
RunInfoPI::m_avg_current
Definition: RunInfoPayloadInspectoHelper.h:26
RunInfoPI::m_fedIN
Definition: RunInfoPayloadInspectoHelper.h:30
RunInfoPI::m_start_time_ll
Definition: RunInfoPayloadInspectoHelper.h:22
svgfig.rgb
def rgb(r, g, b, maximum=1.)
Definition: svgfig.py:40
RunInfoPI::m_stop_time_ll
Definition: RunInfoPayloadInspectoHelper.h:23
RunInfoPI::getStringFromTypeEnum
std::string getStringFromTypeEnum(const parameters &parameter)
Definition: RunInfoPayloadInspectoHelper.h:49
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37