CMS 3D CMS Logo

RecoRunSummary.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm
4 {
6  std::string const& taskname, edm::ParameterSet const& ps) :
7  DQClient(name, taskname, ps)
8  {
9  _thresh_unihf = ps.getUntrackedParameter<double>("thresh_unihf",
10  0.2);
11  _thresh_tcds = ps.getUntrackedParameter<double>("thresh_tcds",
12  1.5);
13  }
14 
15  /* virtual */ void RecoRunSummary::beginRun(edm::Run const& r,
16  edm::EventSetup const& es)
17  {
18  DQClient::beginRun(r,es);
19  }
20 
21  /*
22  *
23  */
26  edm::EventSetup const& es)
27  {
28  DQClient::endLuminosityBlock(ib, ig, lb, es);
29  }
30 
31  /*
32  *
33  */
34  /* virtual */ std::vector<flag::Flag> RecoRunSummary::endJob(
36  {
37 
38  if (_ptype!=fOffline)
39  return std::vector<flag::Flag>();
40 
41  // FILTERS, some useful vectors, hash maps
42  std::vector<uint32_t> vhashFEDHF;
43  vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN,
44  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
45  vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN,
46  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
47  vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN,
48  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
49  vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN+6,
50  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
51  vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN+6,
52  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
53  vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN+6,
54  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
55  filter::HashFilter filter_FEDHF;
57  vhashFEDHF); // preserve only HF FEDs
60  bool tcdsshift = false;
61  filter::HashFilter filter_VME;
62  filter::HashFilter filter_uTCA;
63  std::vector<uint32_t> vhashVME,vhashuTCA;
64  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
66  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
67  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
69  vhashuTCA);
71  vhashVME);
72  std::vector<flag::Flag> vflags; vflags.resize(nRecoFlag);
73  vflags[fUniSlotHF]=flag::Flag("UniSlotHF");
74  vflags[fTCDS]=flag::Flag("TCDS");
75 
76 
77  // INITIALIZE
78  Container2D cOccupancy_depth, cOccupancyCut_depth;
79  ContainerSingle2D cSummary;
80  Container1D cTimingCut_HBHEPartition;
81  ContainerXXX<double> xUniHF, xUni;
84  cOccupancy_depth.initialize(_taskname, "Occupancy",
89  cOccupancyCut_depth.initialize(_taskname, "OccupancyCut",
94  cTimingCut_HBHEPartition.initialize(_taskname, "TimingCut",
98 
99  cSummary.initialize(_name, "Summary",
101  new quantity::FlagQuantity(vflags),
103 
104  // BOOK
105  xUniHF.book(_emap, filter_FEDHF);
106 
107 
108  // LOAD
109  cOccupancy_depth.load(ig, _emap, _subsystem);
110  cOccupancyCut_depth.load(ig, _emap, _subsystem);
111  cTimingCut_HBHEPartition.book(ib, _emap, _subsystem);
112  cSummary.book(ib, _subsystem);
113 
114  // iterate over all channels
115  std::vector<HcalGenericDetId> gids = _emap->allPrecisionId();
116  for (std::vector<HcalGenericDetId>::const_iterator it=gids.begin();
117  it!=gids.end(); ++it)
118  {
119  if (!it->isHcalDetId())
120  continue;
121 
122  HcalDetId did(it->rawId());
124 
125  if (did.subdet()==HcalForward)
126  xUniHF.get(eid)+=cOccupancyCut_depth.getBinContent(did);
127  }
128 
129 
130  // iphi/slot HF non uniformity
131  for (doubleCompactMap::const_iterator it=xUniHF.begin();
132  it!=xUniHF.end(); ++it)
133  {
134  uint32_t hash1 = it->first;
135  HcalElectronicsId eid1(hash1);
136  double x1 = it->second;
137  for (doubleCompactMap::const_iterator jt=xUniHF.begin();
138  jt!=xUniHF.end(); ++jt)
139  {
140  if (jt==it)
141  continue;
142 
143  double x2 = jt->second;
144  if (x2==0)
145  continue;
146  if (x1/x2<_thresh_unihf)
147  xUni.get(eid1)++;
148  }
149  }
150 
151 
152  // TCDS shift
153  double a = cTimingCut_HBHEPartition.getMean(
154  HcalDetId(HcalBarrel,1,5,1));
155  double b = cTimingCut_HBHEPartition.getMean(
156  HcalDetId(HcalBarrel,1,30,1));
157  double c = cTimingCut_HBHEPartition.getMean(
158  HcalDetId(HcalBarrel,1,55,1));
159  double dab = fabs(a-b);
160  double dac = fabs(a-c);
161  double dbc = fabs(b-c);
162  if (dab>=_thresh_tcds || dac>=_thresh_tcds || dbc>=_thresh_tcds)
163  tcdsshift = true;
164 
165  // summary flags
166  std::vector<flag::Flag> sumflags;
167  int ifed=0;
168  for (std::vector<uint32_t>::const_iterator it=_vhashFEDs.begin();
169  it!=_vhashFEDs.end(); ++it)
170  {
171  flag::Flag fSum("RECO");
172  HcalElectronicsId eid(*it);
173 
174  std::vector<uint32_t>::const_iterator cit=std::find(
175  _vcdaqEids.begin(), _vcdaqEids.end(),*it);
176  if (cit==_vcdaqEids.end())
177  {
178  // not registered @cDAQ
179  sumflags.push_back(flag::Flag("RECO", flag::fNCDAQ));
180  ifed++;
181  continue;
182  }
183 
184  // registered @cDAQ
185  if (utilities::isFEDHBHE(eid))
186  {
187  if (tcdsshift)
188  vflags[fTCDS]._state = flag::fBAD;
189  else
190  vflags[fTCDS]._state = flag::fGOOD;
191  }
192  if (utilities::isFEDHF(eid))
193  {
194  if (xUni.get(eid)>0)
195  vflags[fUniSlotHF]._state = flag::fBAD;
196  else
197  vflags[fUniSlotHF]._state = flag::fGOOD;
198  }
199 
200  // combine
201  int iflag=0;
202  for (std::vector<flag::Flag>::iterator ft=vflags.begin();
203  ft!=vflags.end(); ++ft)
204  {
205  cSummary.setBinContent(eid, iflag, ft->_state);
206  fSum+=(*ft);
207  iflag++;
208  ft->reset();
209  }
210  sumflags.push_back(fSum);
211  ifed++;
212  }
213 
214  return sumflags;
215  }
216 }
std::vector< uint32_t > _vcdaqEids
Definition: DQClient.h:64
T getUntrackedParameter(std::string const &, T const &) const
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *qy=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container1D.cc:40
int const CRATE_VME_MIN
Definition: Constants.h:60
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
std::vector< uint32_t > _vhashFEDs
Definition: DQClient.h:58
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQClient.cc:15
virtual CompactMap::const_iterator begin()
Definition: ContainerXXX.h:75
std::string _taskname
Definition: DQClient.h:47
virtual std::vector< flag::Flag > endJob(DQMStore::IBooker &, DQMStore::IGetter &)
int const SPIGOT_MIN
Definition: Constants.h:85
HcalElectronicsMap const * _emap
Definition: DQClient.h:54
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
int const FIBER_VME_MIN
Definition: Constants.h:90
RecoRunSummary(std::string const &, std::string const &, edm::ParameterSet const &)
int const FIBERCH_MIN
Definition: Constants.h:100
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
virtual CompactMap::const_iterator end()
Definition: ContainerXXX.h:77
ProcessingType _ptype
Definition: DQModule.h:59
void reset()
Definition: Flag.h:76
virtual void setBinContent(int, int, int)
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQClient.cc:105
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:32
int const FIBER_uTCA_MIN1
Definition: Constants.h:93
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
std::vector< HcalGenericDetId > allPrecisionId() const
std::string _name
Definition: DQModule.h:57
virtual double getMean(HcalDetId const &, int axis=1)
Definition: Container1D.cc:232
int const CRATE_uTCA_MIN
Definition: Constants.h:65
virtual double getBinContent(HcalDetId const &) override
Definition: Container2D.cc:184
bool isFEDHBHE(HcalElectronicsId const &)
Definition: Utilities.cc:131
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:99
virtual void initialize(std::string const &folder, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
std::vector< int > _vFEDs
Definition: DQClient.h:57
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:957
virtual void load(DQMStore *, HcalElectronicsMap const *, std::string const &subsystem="Hcal", std::string const &aux="", std::string const &prepend="", DQMStore::OpenRunDirs mode=DQMStore::StripRunDirs)
Definition: Container1D.cc:596
double b
Definition: hdecay.h:120
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:249
double a
Definition: hdecay.h:121
std::string _subsystem
Definition: DQModule.h:64
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:91
virtual void initialize(FilterType ftype, HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:26
Readout chain identification for Hcal.
bool isFEDHF(HcalElectronicsId const &)
Definition: Utilities.cc:153
int const SLOT_uTCA_MIN
Definition: Constants.h:72
Definition: Run.h:42
ib
Definition: cuy.py:660