46 #include "CLHEP/Units/GlobalSystemOfUnits.h" 75 template<
class T1,
class T2>
90 std::vector<MonitorElement*>
ADC_;
100 verbosity_(iConfig.getUntrackedParameter<
int>(
"Verbosity",0)),
114 <<
"HGCal DetectorName given as " <<
nameDetector_ <<
" must be: " 115 <<
"\"HGCalHESiliconSensitive\", \"HGCalHESiliconSensitive\", " 116 <<
"\"HGCalHEScintillatorSensitive\", or \"HCal\"!";
124 desc.
add<
bool>(
"ifHCAL",
false);
127 descriptions.
add(
"hgcalDigiValidationEE",desc);
141 edm::LogWarning(
"HGCalValidation") <<
"Cannot get valid HGCalGeometry " 148 edm::LogWarning(
"HGCalValidation") <<
"Cannot get valid HGCalGeometry " 153 unsigned int ntot(0), nused(0);
158 if (theHGCEEDigiContainers.
isValid()) {
161 << theHGCEEDigiContainers->
size()
164 for (
const auto & it: *(theHGCEEDigiContainers.
product())) {
167 int layer = detId.
layer();
169 uint16_t
gain = hgcSample.
toa();
170 uint16_t
adc = hgcSample.
data();
176 edm::LogWarning(
"HGCalValidation") <<
"DigiCollection handle does not " 177 <<
"exist for HGCEE!!!";
184 if (theHGCHEDigiContainers.
isValid()) {
187 << theHGCHEDigiContainers->
size()
190 for (
const auto & it: *(theHGCHEDigiContainers.
product())) {
193 int layer = detId.
layer();
195 uint16_t
gain = hgcSample.
toa();
196 uint16_t
adc = hgcSample.
data();
202 edm::LogWarning(
"HGCalValidation") <<
"DigiCollection handle does not " 203 <<
"exist for HGCFH!!!";
209 if (theHGCBHDigiContainers.
isValid()) {
212 << theHGCBHDigiContainers->
size()
215 for (
const auto & it: *(theHGCBHDigiContainers.
product())) {
218 int layer = detId.
depth();
220 uint16_t
gain = hgcSample.
toa();
221 uint16_t
adc = hgcSample.
data();
227 edm::LogWarning(
"HGCalValidation") <<
"DigiCollection handle does not " 228 <<
"exist for HGCBH!!!";
234 if (theHEDigiContainers.
isValid()) {
237 << theHEDigiContainers->
size()
242 for (
const auto & it: *(theHEDigiContainers.
product())) {
254 int layer = detId.
depth();
263 edm::LogWarning(
"HGCalValidation") <<
"DigiCollection handle does not " 264 <<
"exist for HGCBH!!!";
271 <<
" with " << ntot <<
" total and " 272 << nused <<
" used digis";
275 template<
class T1,
class T2>
277 int layer, uint16_t
adc,
double charge) {
281 const GlobalPoint& global1 = geom->getPosition(id1);
285 <<
" charge = " <<
charge;
288 hinfo.
x = global1.x();
289 hinfo.
y = global1.y();
290 hinfo.
z = global1.z();
297 <<
" gy = " << hinfo.
y 298 <<
" gz = " << hinfo.
z;
308 if (OccupancyMap.find(layer) != OccupancyMap.end()) OccupancyMap[layer] ++;
309 else OccupancyMap[layer] = 1;
313 int ilayer = hinfo.
layer -1;
316 ADC_.at(ilayer)->Fill(hinfo.
adc);
321 int layer = itr.first;
322 int occupancy = itr.second;
326 int layer = itr.first;
327 int occupancy = itr.second;
358 std::ostringstream histoname;
359 for (
int ilayer = 0; ilayer <
layers_; ilayer++ ) {
360 histoname.str(
""); histoname <<
"charge_"<<
"layer_" << ilayer;
361 charge_.push_back(iB.
book1D(histoname.str().c_str(),
"charge_",100,-25,25));
363 histoname.str(
""); histoname <<
"ADC_" <<
"layer_" << ilayer;
364 ADC_.push_back(iB.
book1D(histoname.str().c_str(),
"DigiOccupancy",200,0,1000));
366 histoname.str(
""); histoname <<
"DigiOccupancy_XY_" <<
"layer_" << ilayer;
367 DigiOccupancy_XY_.push_back(iB.
book2D(histoname.str().c_str(),
"DigiOccupancy", 50, -500, 500, 50, -500, 500));
369 histoname.str(
""); histoname <<
"DigiOccupancy_Plus_" <<
"layer_" << ilayer;
371 histoname.str(
""); histoname <<
"DigiOccupancy_Minus_" <<
"layer_" << ilayer;
375 histoname.str(
""); histoname <<
"SUMOfDigiOccupancy_Plus";
377 histoname.str(
""); histoname <<
"SUMOfRecDigiOccupancy_Minus";
int adc(sample_type sample)
get the ADC sample (12 bits)
T getParameter(std::string const &) const
EventNumber_t event() const
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< MonitorElement * > charge_
HcalSubdetector subdet() const
get the subdetector
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< MonitorElement * > DigiOccupancy_XY_
double pedestal(int fCapId) const
get pedestal for capid=0..3
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const override
int depth() const
get the tower depth
unsigned int layers(bool reco) const
MonitorElement * book1D(Args &&...args)
edm::DataFrame::id_type id() const
HGCalDigiValidation(const edm::ParameterSet &)
~HGCalDigiValidation() override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< MonitorElement * > DigiOccupancy_Minus_
void digiValidation(const T1 &detId, const T2 *geom, int, uint16_t, double)
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * book2D(Args &&...args)
int getMaxDepth(const int &type) const
MonitorElement * MeanDigiOccupancy_Minus_
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetToken digiSource_
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
std::map< int, int > OccupancyMap_minus_
std::map< int, int > OccupancyMap_plus_
std::string nameDetector_
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
std::vector< MonitorElement * > ADC_
MonitorElement * MeanDigiOccupancy_Plus_
T const * product() const
void fillOccupancyMap(std::map< int, int > &OccupancyMap, int layer)
int layer() const
get the layer #
std::vector< MonitorElement * > DigiOccupancy_Plus_