CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HGCalRecHitValidation Class Reference
Inheritance diagram for HGCalRecHitValidation:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Classes

struct  energysum
 
struct  HitsInfo
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
 HGCalRecHitValidation (const edm::ParameterSet &)
 
 ~HGCalRecHitValidation () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void fillHitsInfo ()
 
void fillHitsInfo (HitsInfo &hits)
 
void fillOccupancyMap (std::map< int, int > &OccupancyMap, int layer)
 
template<class T1 , class T2 >
void recHitValidation (DetId &detId, int layer, const T1 *geom, T2 it)
 

Private Attributes

std::vector< MonitorElement * > energy_
 
std::vector< MonitorElement * > EtaPhi_Minus_
 
std::vector< MonitorElement * > EtaPhi_Plus_
 
int firstLayer_
 
std::vector< MonitorElement * > HitOccupancy_Minus_
 
std::vector< MonitorElement * > HitOccupancy_Plus_
 
bool ifHCAL_
 
unsigned int layers_
 
MonitorElementMeanHitOccupancy_Minus_
 
MonitorElementMeanHitOccupancy_Plus_
 
std::string nameDetector_
 
std::map< int, int > OccupancyMap_minus
 
std::map< int, int > OccupancyMap_plus
 
edm::EDGetToken recHitSource_
 
int verbosity_
 

Detailed Description

Definition at line 41 of file HGCalRecHitValidation.cc.

Constructor & Destructor Documentation

HGCalRecHitValidation::HGCalRecHitValidation ( const edm::ParameterSet iConfig)
explicit

Definition at line 93 of file HGCalRecHitValidation.cc.

References Exception, edm::ParameterSet::getParameter(), ifHCAL_, nameDetector_, recHitSource_, and groupFilesInBlocks::temp.

93  :
94  nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
95  ifHCAL_(iConfig.getParameter<bool>("ifHCAL")),
96  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity",0)),
97  firstLayer_(1) {
98 
99  auto temp = iConfig.getParameter<edm::InputTag>("RecHitSource");
100  if (nameDetector_ == "HGCalEESensitive" ||
101  nameDetector_ == "HGCalHESiliconSensitive" ||
102  nameDetector_ == "HGCalHEScintillatorSensitive") {
103  recHitSource_ = consumes<HGCRecHitCollection>(temp);
104  } else if (nameDetector_ == "HCal") {
105  if (ifHCAL_) recHitSource_ = consumes<HBHERecHitCollection>(temp);
106  else recHitSource_ = consumes<HGChebRecHitCollection>(temp);
107  } else {
108  throw cms::Exception("BadHGCRecHitSource")
109  << "HGCal DetectorName given as " << nameDetector_ << " must be: "
110  << "\"HGCalHESiliconSensitive\", \"HGCalHESiliconSensitive\", "
111  << "\"HGCalHEScintillatorSensitive\", or \"HCal\"!";
112  }
113 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
HGCalRecHitValidation::~HGCalRecHitValidation ( )
inlineoverride

Member Function Documentation

void HGCalRecHitValidation::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 125 of file HGCalRecHitValidation.cc.

References HcalDetId::depth(), edm::EventID::event(), fillHitsInfo(), relativeConstraints::geom, motionPolicyChamber::geom0, HGCalTopology::geomMode(), edm::EventSetup::get(), edm::Event::getByToken(), HcalEndcap, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, edm::EventBase::id(), ifHCAL_, edm::ESHandleBase::isValid(), edm::HandleBase::isValid(), HGCScintillatorDetId::layer(), HGCalDetId::layer(), HGCSiliconDetId::layer(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, nameDetector_, OccupancyMap_minus, OccupancyMap_plus, convertSQLiteXML::ok, edm::Handle< T >::product(), edm::ESHandle< T >::product(), recHitSource_, recHitValidation(), edm::SortedCollection< T, SORT >::size(), DetId::subdetId(), HGCalGeometry::topology(), HGCalGeometryMode::Trapezoid, and verbosity_.

Referenced by ~HGCalRecHitValidation().

126  {
127  OccupancyMap_plus.clear();
128  OccupancyMap_minus.clear();
129 
130  bool ok(true);
131  unsigned int ntot(0), nused(0);
132  if (nameDetector_ == "HCal") {
134  iSetup.get<CaloGeometryRecord>().get(geom);
135  if (!geom.isValid()) {
136  edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry "
137  << "Object for " << nameDetector_;
138  } else {
139  const CaloGeometry* geom0 = geom.product();
140  if (ifHCAL_) {
142  iEvent.getByToken(recHitSource_, hbhecoll);
143  if (hbhecoll.isValid()) {
144  if (verbosity_>0)
145  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
146  << hbhecoll->size()
147  << " element(s)";
148  for (const auto & it : *(hbhecoll.product())) {
149  DetId detId = it.id();
150  ntot++;
151  if (detId.subdetId() == HcalEndcap) {
152  nused++;
153  int layer = HcalDetId(detId).depth();
154  recHitValidation(detId, layer, geom0, &it);
155  }
156  }
157  } else {
158  ok = false;
159  edm::LogVerbatim("HGCalValidation") << "HBHERecHitCollection Handle "
160  << "does not exist !!!";
161  }
162  } else {
164  iEvent.getByToken(recHitSource_, hbhecoll);
165  if (hbhecoll.isValid()) {
166  if (verbosity_>0)
167  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
168  << hbhecoll->size()
169  << " element(s)";
170  for (const auto & it : *(hbhecoll.product())) {
171  DetId detId = it.id();
172  ntot++; nused++;
173  int layer = HcalDetId(detId).depth();
174  recHitValidation(detId, layer, geom0, &it);
175  }
176  } else {
177  ok = false;
178  edm::LogVerbatim("HGCalValidation") << "HGChebRecHitCollection "
179  << "Handle does not exist !!!";
180  }
181  }
182  }
183  } else {
185  iSetup.get<IdealGeometryRecord>().get(nameDetector_, geom);
186  if (!geom.isValid()) {
187  edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry "
188  << "Object for " << nameDetector_;
189  } else {
190  const HGCalGeometry* geom0 = geom.product();
192  int geomType = (((mode == HGCalGeometryMode::Hexagon8) ||
193  (mode == HGCalGeometryMode::Hexagon8Full)) ? 1 :
194  ((mode == HGCalGeometryMode::Trapezoid) ? 2 : 0));
195 
196  edm::Handle<HGCRecHitCollection> theRecHitContainers;
197  iEvent.getByToken(recHitSource_, theRecHitContainers);
198  if (theRecHitContainers.isValid()) {
199  if (verbosity_>0)
200  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
201  << theRecHitContainers->size()
202  << " element(s)";
203  for (const auto & it : *(theRecHitContainers.product())) {
204  ntot++; nused++;
205  DetId detId = it.id();
206  int layer = ((geomType == 0) ? HGCalDetId(detId).layer() :
207  ((geomType == 1) ? HGCSiliconDetId(detId).layer() :
208  HGCScintillatorDetId(detId).layer()));
209  recHitValidation(detId, layer, geom0, &it);
210  }
211  } else {
212  ok = false;
213  edm::LogVerbatim("HGCalValidation") << "HGCRecHitCollection Handle "
214  << "does not exist !!!";
215  }
216  }
217  }
218  if (ok) fillHitsInfo();
219  edm::LogVerbatim("HGCalValidation") << "Event " << iEvent.id().event()
220  << " with " << ntot << " total and "
221  << nused << " used recHits";
222 }
HGCalGeometryMode::GeometryMode geomMode() const
Geometry mode.
Definition: HGCalTopology.h:88
EventNumber_t event() const
Definition: EventID.h:41
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
int depth() const
get the tower depth
Definition: HcalDetId.h:166
std::map< int, int > OccupancyMap_minus
int layer() const
get the layer #
const HGCalTopology & topology() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
bool isValid() const
Definition: HandleBase.h:74
Definition: DetId.h:18
T const * product() const
Definition: Handle.h:81
int layer() const
get the layer #
std::map< int, int > OccupancyMap_plus
edm::EventID id() const
Definition: EventBase.h:60
size_type size() const
T get() const
Definition: EventSetup.h:68
bool isValid() const
Definition: ESHandle.h:45
T const * product() const
Definition: ESHandle.h:84
void recHitValidation(DetId &detId, int layer, const T1 *geom, T2 it)
int layer() const
get the layer #
Definition: HGCalDetId.h:48
void HGCalRecHitValidation::bookHistograms ( DQMStore::IBooker iB,
edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 307 of file HGCalRecHitValidation.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), DEFINE_FWK_MODULE, energy_, EtaPhi_Minus_, EtaPhi_Plus_, firstLayer_, HitOccupancy_Minus_, HitOccupancy_Plus_, createfilelist::int, layers_, MeanHitOccupancy_Minus_, MeanHitOccupancy_Plus_, nameDetector_, pi, and DQMStore::IBooker::setCurrentFolder().

Referenced by ~HGCalRecHitValidation().

309  {
310 
311  iB.setCurrentFolder("HGCAL/HGCalRecHitsV/"+nameDetector_);
312  std::ostringstream histoname;
313  for (unsigned int il=0; il<layers_; ++il) {
314  int ilayer = firstLayer_ + (int)(il);
315  histoname.str(""); histoname << "HitOccupancy_Plus_layer_" << ilayer;
316  HitOccupancy_Plus_.push_back(iB.book1D( histoname.str().c_str(), "RecHitOccupancy_Plus", 100, 0, 10000));
317  histoname.str(""); histoname << "HitOccupancy_Minus_layer_" << ilayer;
318  HitOccupancy_Minus_.push_back(iB.book1D( histoname.str().c_str(), "RecHitOccupancy_Minus", 100, 0, 10000));
319 
320  histoname.str(""); histoname << "EtaPhi_Plus_" << "layer_" << ilayer;
321  EtaPhi_Plus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, 1.45, 3.0, 72, -CLHEP::pi, CLHEP::pi));
322  histoname.str(""); histoname << "EtaPhi_Minus_" << "layer_" << ilayer;
323  EtaPhi_Minus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, -3.0, -1.45, 72, -CLHEP::pi, CLHEP::pi));
324 
325  histoname.str(""); histoname << "energy_layer_" << ilayer;
326  energy_.push_back(iB.book1D(histoname.str().c_str(),"energy_",100,0,0.002));
327  }//loop over layers ends here
328 
329  histoname.str(""); histoname << "SUMOfRecHitOccupancy_Plus";
330  MeanHitOccupancy_Plus_= iB.book1D( histoname.str().c_str(), "SUMOfRecHitOccupancy_Plus", layers_, -0.5, layers_-0.5);
331  histoname.str(""); histoname << "SUMOfRecHitOccupancy_Minus";
332  MeanHitOccupancy_Minus_ = iB.book1D( histoname.str().c_str(), "SUMOfRecHitOccupancy_Minus", layers_, -0.5,layers_-0.5);
333 }
std::vector< MonitorElement * > EtaPhi_Minus_
std::vector< MonitorElement * > EtaPhi_Plus_
std::vector< MonitorElement * > HitOccupancy_Minus_
const Double_t pi
MonitorElement * MeanHitOccupancy_Plus_
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * MeanHitOccupancy_Minus_
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
std::vector< MonitorElement * > HitOccupancy_Plus_
std::vector< MonitorElement * > energy_
void HGCalRecHitValidation::dqmBeginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
override

Definition at line 290 of file HGCalRecHitValidation.cc.

References HGCalDDDConstants::firstLayer(), firstLayer_, edm::EventSetup::get(), HcalDDDRecConstants::getMaxDepth(), HGCalDDDConstants::layers(), layers_, and nameDetector_.

Referenced by ~HGCalRecHitValidation().

291  {
292 
293  if (nameDetector_ == "HCal") {
295  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
296  const HcalDDDRecConstants *hcons = &(*pHRNDC);
297  layers_ = hcons->getMaxDepth(1);
298  } else {
300  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
301  const HGCalDDDConstants & hgcons_ = (*pHGDC);
302  layers_ = hgcons_.layers(true);
303  firstLayer_ = hgcons_.firstLayer();
304  }
305 }
unsigned int layers(bool reco) const
int getMaxDepth(const int &type) const
T get() const
Definition: EventSetup.h:68
int firstLayer() const
void HGCalRecHitValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 116 of file HGCalRecHitValidation.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~HGCalRecHitValidation().

116  {
118  desc.add<std::string>("DetectorName","HGCalEESensitive");
119  desc.add<edm::InputTag>("RecHitSource",edm::InputTag("HGCalRecHit","HGCEERecHits"));
120  desc.add<bool>("ifHCAL",false);
121  desc.addUntracked<int>("Verbosity",0);
122  descriptions.add("hgcalRecHitValidationEE",desc);
123 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HGCalRecHitValidation::fillHitsInfo ( )
private

Definition at line 264 of file HGCalRecHitValidation.cc.

References HitOccupancy_Minus_, HitOccupancy_Plus_, OccupancyMap_minus, and OccupancyMap_plus.

Referenced by analyze(), recHitValidation(), and ~HGCalRecHitValidation().

264  {
265 
266  for (auto const& itr : OccupancyMap_plus) {
267  int layer = itr.first;
268  int occupancy = itr.second;
269  HitOccupancy_Plus_.at(layer)->Fill(occupancy);
270  }
271 
272  for (auto const & itr : OccupancyMap_minus) {
273  int layer = itr.first;
274  int occupancy = itr.second;
275  HitOccupancy_Minus_.at(layer)->Fill(occupancy);
276  }
277 
278 }
std::vector< MonitorElement * > HitOccupancy_Minus_
std::map< int, int > OccupancyMap_minus
std::map< int, int > OccupancyMap_plus
std::vector< MonitorElement * > HitOccupancy_Plus_
void HGCalRecHitValidation::fillHitsInfo ( HitsInfo hits)
private

Definition at line 280 of file HGCalRecHitValidation.cc.

References HGCalRecHitValidation::HitsInfo::energy, energy_, HGCalRecHitValidation::HitsInfo::eta, EtaPhi_Minus_, EtaPhi_Plus_, HGCalRecHitValidation::HitsInfo::layer, and HGCalRecHitValidation::HitsInfo::phi.

280  {
281 
282  unsigned int ilayer = hits.layer;
283  energy_.at(ilayer)->Fill(hits.energy);
284 
285  EtaPhi_Plus_.at(ilayer)->Fill(hits.eta , hits.phi);
286  EtaPhi_Minus_.at(ilayer)->Fill(hits.eta, hits.phi);
287 
288 }
std::vector< MonitorElement * > EtaPhi_Minus_
std::vector< MonitorElement * > EtaPhi_Plus_
std::vector< MonitorElement * > energy_
void HGCalRecHitValidation::fillOccupancyMap ( std::map< int, int > &  OccupancyMap,
int  layer 
)
private

Definition at line 258 of file HGCalRecHitValidation.cc.

Referenced by recHitValidation(), and ~HGCalRecHitValidation().

259  {
260  if (OccupancyMap.find(layer) != OccupancyMap.end()) OccupancyMap[layer]++;
261  else OccupancyMap[layer] = 1;
262 }
template<class T1 , class T2 >
void HGCalRecHitValidation::recHitValidation ( DetId detId,
int  layer,
const T1 *  geom,
T2  it 
)
private

Definition at line 225 of file HGCalRecHitValidation.cc.

References HGCalRecHitValidation::HitsInfo::energy, HGCalRecHitValidation::HitsInfo::eta, PV3DBase< T, PVType, FrameType >::eta(), fillHitsInfo(), fillOccupancyMap(), firstLayer_, HGCalRecHitValidation::HitsInfo::layer, OccupancyMap_minus, OccupancyMap_plus, HGCalRecHitValidation::HitsInfo::phi, PV3DBase< T, PVType, FrameType >::phi(), verbosity_, HGCalRecHitValidation::HitsInfo::x, PV3DBase< T, PVType, FrameType >::x(), HGCalRecHitValidation::HitsInfo::y, PV3DBase< T, PVType, FrameType >::y(), HGCalRecHitValidation::HitsInfo::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze(), and ~HGCalRecHitValidation().

226  {
227 
228  const GlobalPoint& global = geom->getPosition(detId);
229  double energy = it->energy();
230 
231  float globalx = global.x();
232  float globaly = global.y();
233  float globalz = global.z();
234 
235  HitsInfo hinfo;
236  hinfo.energy = energy;
237  hinfo.x = globalx;
238  hinfo.y = globaly;
239  hinfo.z = globalz;
240  hinfo.layer = layer-firstLayer_;
241  hinfo.phi = global.phi();
242  hinfo.eta = global.eta();
243 
244  if (verbosity_>1)
245  edm::LogVerbatim("HGCalValidation") << "-------------------------- gx = "
246  << globalx << " gy = " << globaly
247  << " gz = " << globalz << " phi = "
248  << hinfo.phi << " eta = " << hinfo.eta
249  << " lay = " << hinfo.layer;
250 
251  fillHitsInfo(hinfo);
252 
253  if (hinfo.eta > 0) fillOccupancyMap(OccupancyMap_plus, hinfo.layer);
254  else fillOccupancyMap(OccupancyMap_minus, hinfo.layer);
255 
256 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
std::map< int, int > OccupancyMap_minus
T z() const
Definition: PV3DBase.h:64
void fillOccupancyMap(std::map< int, int > &OccupancyMap, int layer)
T eta() const
Definition: PV3DBase.h:76
std::map< int, int > OccupancyMap_plus
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

std::vector<MonitorElement*> HGCalRecHitValidation::energy_
private

Definition at line 86 of file HGCalRecHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

std::vector<MonitorElement*> HGCalRecHitValidation::EtaPhi_Minus_
private

Definition at line 85 of file HGCalRecHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

std::vector<MonitorElement*> HGCalRecHitValidation::EtaPhi_Plus_
private

Definition at line 84 of file HGCalRecHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

int HGCalRecHitValidation::firstLayer_
private

Definition at line 80 of file HGCalRecHitValidation.cc.

Referenced by bookHistograms(), dqmBeginRun(), and recHitValidation().

std::vector<MonitorElement*> HGCalRecHitValidation::HitOccupancy_Minus_
private

Definition at line 88 of file HGCalRecHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

std::vector<MonitorElement*> HGCalRecHitValidation::HitOccupancy_Plus_
private

Definition at line 87 of file HGCalRecHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

bool HGCalRecHitValidation::ifHCAL_
private

Definition at line 77 of file HGCalRecHitValidation.cc.

Referenced by analyze(), and HGCalRecHitValidation().

unsigned int HGCalRecHitValidation::layers_
private

Definition at line 79 of file HGCalRecHitValidation.cc.

Referenced by bookHistograms(), and dqmBeginRun().

MonitorElement* HGCalRecHitValidation::MeanHitOccupancy_Minus_
private

Definition at line 90 of file HGCalRecHitValidation.cc.

Referenced by bookHistograms().

MonitorElement* HGCalRecHitValidation::MeanHitOccupancy_Plus_
private

Definition at line 89 of file HGCalRecHitValidation.cc.

Referenced by bookHistograms().

std::string HGCalRecHitValidation::nameDetector_
private
std::map<int, int> HGCalRecHitValidation::OccupancyMap_minus
private

Definition at line 82 of file HGCalRecHitValidation.cc.

Referenced by analyze(), fillHitsInfo(), and recHitValidation().

std::map<int, int> HGCalRecHitValidation::OccupancyMap_plus
private

Definition at line 81 of file HGCalRecHitValidation.cc.

Referenced by analyze(), fillHitsInfo(), and recHitValidation().

edm::EDGetToken HGCalRecHitValidation::recHitSource_
private

Definition at line 76 of file HGCalRecHitValidation.cc.

Referenced by analyze(), and HGCalRecHitValidation().

int HGCalRecHitValidation::verbosity_
private

Definition at line 78 of file HGCalRecHitValidation.cc.

Referenced by analyze(), and recHitValidation().