CMS 3D CMS Logo

RPCDCSSummary.cc
Go to the documentation of this file.
2 
7 
8 //#include "DQMServices/Core/interface/DQMStore.h"
9 //#include "DQMServices/Core/interface/MonitorElement.h"
10 
11 //CondFormats
14 
15 
17 
18  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
19 
20  FEDRange_.first = ps.getUntrackedParameter<unsigned int>("MinimumRPCFEDId", 790);
21  FEDRange_.second = ps.getUntrackedParameter<unsigned int>("MaximumRPCFEDId", 792);
22 
23  offlineDQM_ = ps.getUntrackedParameter<bool> ("OfflineDQM",true);
24 
25  NumberOfFeds_ =FEDRange_.second - FEDRange_.first +1;
26  init_=false;
27  defaultValue_ = 1.;
28 }
29 
31 
33 
35 
36  if(!init_){
37  this->checkDCSbit(setup);
38  if(!offlineDQM_ ){this->myBooker(ibooker);}
39  }
40 }
41 
42 
44 
45  if( offlineDQM_){this->myBooker(ibooker);}
46 }
47 
48 
49 
51 
52  defaultValue_ = 1.;
53 
54  if(auto runInfoRec = setup.tryToGet<RunInfoRcd>()) {
55  defaultValue_ = -1.;
56  //get fed summary information
58  runInfoRec->get(sumFED);
59  std::vector<int> FedsInIds= sumFED->m_fed_in;
60  unsigned int f = 0;
61  bool flag = false;
62  while(!flag && f < FedsInIds.size()) {
63  int fedID=FedsInIds[f];
64  //make sure fed id is in allowed range
65  if(fedID>=FEDRange_.first && fedID<=FEDRange_.second) {
66  defaultValue_ = 1.;
67  flag = true;
68  }
69  f++;
70  }
71  }
72  init_ = true;
73 }
74 
76 
77  ibooker.setCurrentFolder("RPC/EventInfo");
78  // global fraction
79  totalDCSFraction = ibooker.bookFloat("DCSSummary");
81 
82  DCSMap_ = ibooker.book2D( "DCSSummaryMap","RPC DCS Summary Map",15, -7.5, 7.5, 12, 0.5 ,12.5);
83 
84  //customize the 2d histo
85  std::stringstream BinLabel;
86  for (int i= 1 ; i<13; i++){
87  BinLabel.str("");
88  BinLabel<<"Sec"<<i;
89  DCSMap_->setBinLabel(i,BinLabel.str(),2);
90  }
91 
92  for(int i = -2; i<=2; i++){
93  BinLabel.str("");
94  BinLabel<<"Wheel"<<i;
95  DCSMap_->setBinLabel((i+8),BinLabel.str(),1);
96  }
97 
98  for(int i = 1; i<=numberOfDisks_; i++){
99  BinLabel.str("");
100  BinLabel<<"Disk"<<i;
101  DCSMap_->setBinLabel((i+11),BinLabel.str(),1);
102  BinLabel.str("");
103  BinLabel<<"Disk"<<-i;
104  DCSMap_->setBinLabel((-i+5),BinLabel.str(),1);
105  }
106 
107  //fill the histo with "1" --- just for the moment
108  for(int i=1; i<=15; i++){
109  for (int j=1; j<=12; j++ ){
110  if(i==5 || i==11 || (j>6 && (i<6 || i>10)))
111  DCSMap_->setBinContent(i,j,-1);//bins that not correspond to subdetector parts
112  else
114  }
115  }
116 
117 
118  if(numberOfDisks_ < 4){
119  for (int j=1; j<=12; j++ ){
120  DCSMap_->setBinContent(1,j,-1);//bins that not correspond to subdetector parts
121  DCSMap_->setBinContent(15,j,-1);
122  }
123  }
124 
125  // book the ME
126  ibooker.setCurrentFolder("RPC/EventInfo/DCSContents");
127 
128  int limit = numberOfDisks_;
129  if(numberOfDisks_ < 2) limit = 2;
130 
131 
132  for (int i = -1 * limit; i<= limit;i++ ){//loop on wheels and disks
133  if (i>-3 && i<3){//wheels
134  std::stringstream streams;
135  streams << "RPC_Wheel" << i;
136  dcsWheelFractions[i+2] = ibooker.bookFloat(streams.str());
138  }
139 
140  if (i == 0 || i > numberOfDisks_ || i< (-1 * numberOfDisks_))continue;
141 
142  int offset = numberOfDisks_;
143  if (i>0) offset --; //used to skip case equale to zero
144  std::stringstream streams;
145  streams << "RPC_Disk" << i;
146  dcsDiskFractions[i+2] = ibooker.bookFloat(streams.str());
148  }
149 }
T getUntrackedParameter(std::string const &, T const &) const
std::optional< T > tryToGet() const
Definition: EventSetup.h:87
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * DCSMap_
Definition: RPCDCSSummary.h:35
void myBooker(DQMStore::IBooker &)
RPCDCSSummary(const edm::ParameterSet &)
Constructor.
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
double defaultValue_
Definition: RPCDCSSummary.h:31
void beginJob() override
MonitorElement * totalDCSFraction
Definition: RPCDCSSummary.h:36
void Fill(long long x)
MonitorElement * dcsDiskFractions[10]
Definition: RPCDCSSummary.h:38
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::vector< int > m_fed_in
Definition: RunInfo.h:26
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
double f[11][100]
void checkDCSbit(edm::EventSetup const &)
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
~RPCDCSSummary() override
Destructor.
MonitorElement * dcsWheelFractions[5]
Definition: RPCDCSSummary.h:37
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:105
std::pair< int, int > FEDRange_
Definition: RPCDCSSummary.h:39