CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  filter::HashFilter filter_FEDHF;
51  vhashFEDHF); // preserve only HF FEDs
54  bool tcdsshift = false;
55  filter::HashFilter filter_VME;
56  filter::HashFilter filter_uTCA;
57  std::vector<uint32_t> vhashVME,vhashuTCA;
58  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
60  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
61  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
63  vhashuTCA);
65  vhashVME);
66  std::vector<flag::Flag> vflags; vflags.resize(nRecoFlag);
67  vflags[fUniSlotHF]=flag::Flag("UniSlotHF");
68  vflags[fTCDS]=flag::Flag("TCDS");
69 
70 
71  // INITIALIZE
72  Container2D cOccupancy_depth, cOccupancyCut_depth;
73  ContainerSingle2D cSummary;
74  Container1D cTimingCut_HBHEPartition;
75  ContainerXXX<double> xUniHF, xUni;
78  cOccupancy_depth.initialize(_taskname, "Occupancy",
83  cOccupancyCut_depth.initialize(_taskname, "OccupancyCut",
88  cTimingCut_HBHEPartition.initialize(_taskname, "TimingCut",
92 
93  cSummary.initialize(_name, "Summary",
95  new quantity::FlagQuantity(vflags),
97 
98  // BOOK
99  xUniHF.book(_emap, filter_FEDHF);
100 
101 
102  // LOAD
103  cOccupancy_depth.load(ig, _emap, _subsystem);
104  cOccupancyCut_depth.load(ig, _emap, _subsystem);
105  cTimingCut_HBHEPartition.book(ib, _emap, _subsystem);
106  cSummary.book(ib, _subsystem);
107 
108  // iterate over all channels
109  std::vector<HcalGenericDetId> gids = _emap->allPrecisionId();
110  for (std::vector<HcalGenericDetId>::const_iterator it=gids.begin();
111  it!=gids.end(); ++it)
112  {
113  if (!it->isHcalDetId())
114  continue;
115 
116  HcalDetId did(it->rawId());
117  HcalElectronicsId eid = HcalElectronicsId(ehashmap.lookup(did));
118 
119  if (did.subdet()==HcalForward)
120  xUniHF.get(eid)+=cOccupancyCut_depth.getBinContent(did);
121  }
122 
123 
124  // iphi/slot HF non uniformity
125  for (doubleCompactMap::const_iterator it=xUniHF.begin();
126  it!=xUniHF.end(); ++it)
127  {
128  uint32_t hash1 = it->first;
129  HcalElectronicsId eid1(hash1);
130  double x1 = it->second;
131  for (doubleCompactMap::const_iterator jt=xUniHF.begin();
132  jt!=xUniHF.end(); ++jt)
133  {
134  if (jt==it)
135  continue;
136 
137  double x2 = jt->second;
138  if (x2==0)
139  continue;
140  if (x1/x2<_thresh_unihf)
141  xUni.get(eid1)++;
142  }
143  }
144 
145 
146  // TCDS shift
147  double a = cTimingCut_HBHEPartition.getMean(
148  HcalDetId(HcalBarrel,1,5,1));
149  double b = cTimingCut_HBHEPartition.getMean(
150  HcalDetId(HcalBarrel,1,30,1));
151  double c = cTimingCut_HBHEPartition.getMean(
152  HcalDetId(HcalBarrel,1,55,1));
153  double dab = fabs(a-b);
154  double dac = fabs(a-c);
155  double dbc = fabs(b-c);
156  if (dab>=_thresh_tcds || dac>=_thresh_tcds || dbc>=_thresh_tcds)
157  tcdsshift = true;
158 
159  // summary flags
160  std::vector<flag::Flag> sumflags;
161  int ifed=0;
162  for (std::vector<uint32_t>::const_iterator it=_vhashFEDs.begin();
163  it!=_vhashFEDs.end(); ++it)
164  {
165  flag::Flag fSum("RECO");
166  HcalElectronicsId eid(*it);
167 
168  std::vector<uint32_t>::const_iterator cit=std::find(
169  _vcdaqEids.begin(), _vcdaqEids.end(),*it);
170  if (cit==_vcdaqEids.end())
171  {
172  // not registered @cDAQ
173  sumflags.push_back(flag::Flag("RECO", flag::fNCDAQ));
174  ifed++;
175  continue;
176  }
177 
178  // registered @cDAQ
179  if (utilities::isFEDHBHE(eid))
180  {
181  if (tcdsshift)
182  vflags[fTCDS]._state = flag::fBAD;
183  else
184  vflags[fTCDS]._state = flag::fGOOD;
185  }
186  if (utilities::isFEDHF(eid))
187  {
188  if (xUni.get(eid)>0)
189  vflags[fUniSlotHF]._state = flag::fBAD;
190  else
191  vflags[fUniSlotHF]._state = flag::fGOOD;
192  }
193 
194  // combine
195  int iflag=0;
196  for (std::vector<flag::Flag>::iterator ft=vflags.begin();
197  ft!=vflags.end(); ++ft)
198  {
199  cSummary.setBinContent(eid, iflag, ft->_state);
200  fSum+=(*ft);
201  iflag++;
202  ft->reset();
203  }
204  sumflags.push_back(fSum);
205  ifed++;
206  }
207 
208  return sumflags;
209  }
210 }
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
int ib
Definition: cuy.py:660
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:69
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:71
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:84
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
bool isFEDHBHE(HcalElectronicsId const &)
Definition: Utilities.cc:124
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:93
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:243
double a
Definition: hdecay.h:121
std::string _subsystem
Definition: DQModule.h:64
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:85
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:146
int const SLOT_uTCA_MIN
Definition: Constants.h:72
Definition: Run.h:43
virtual double getBinContent(HcalDetId const &)
Definition: Container2D.cc:184