33 #include "CLHEP/Units/GlobalSystemOfUnits.h"
62 template <
class T1,
class T2>
78 std::vector<MonitorElement*>
TOA_;
80 std::vector<MonitorElement*>
ADC_;
81 std::vector<MonitorElement*>
TOT_;
89 : nameDetector_(iConfig.getParameter<std::
string>(
"DetectorName")),
90 ifNose_(iConfig.getParameter<bool>(
"ifNose")),
91 verbosity_(iConfig.getUntrackedParameter<int>(
"Verbosity", 0)),
92 SampleIndx_(iConfig.getUntrackedParameter<int>(
"SampleIndx", 0)),
95 tok_hgcalg_(esConsumes<HGCalGeometry, IdealGeometryRecord>(
edm::ESInputTag{
"", nameDetector_})),
98 if ((nameDetector_ ==
"HGCalEESensitive") || (nameDetector_ ==
"HGCalHESiliconSensitive") ||
99 (nameDetector_ ==
"HGCalHEScintillatorSensitive") || (nameDetector_ ==
"HGCalHFNoseSensitive")) {
100 digiSource_ = consumes<HGCalDigiCollection>(
temp);
102 throw cms::Exception(
"BadHGCDigiSource") <<
"HGCal DetectorName given as " << nameDetector_ <<
" must be: "
103 <<
"\"HGCalEESensitive\", \"HGCalHESiliconSensitive\", or "
104 <<
"\"HGCalHEScintillatorSensitive\", \"HGCalHFNoseSensitive\"!";
112 desc.
add<
bool>(
"ifNose",
false);
115 descriptions.
add(
"hgcalDigiValidationEEDefault", desc);
131 unsigned int ntot(0), nused(0);
136 if (theHGCEEDigiContainers.
isValid()) {
139 <<
nameDetector_ <<
" with " << theHGCEEDigiContainers->size() <<
" element(s)";
140 for (
const auto& it : *(theHGCEEDigiContainers.
product())) {
143 DetId detId = it.id();
148 uint16_t gain = hgcSample.
toa();
149 uint16_t
adc = hgcSample.
data();
151 bool totmode = hgcSample.
mode();
152 bool zerothreshold = hgcSample.
threshold();
153 digiValidation(detId, geom0, layer, adc, charge, totmode, zerothreshold);
164 if (theHGCHEDigiContainers.
isValid()) {
167 <<
nameDetector_ <<
" with " << theHGCHEDigiContainers->size() <<
" element(s)";
168 for (
const auto& it : *(theHGCHEDigiContainers.
product())) {
171 DetId detId = it.id();
172 int layer = ((geomType == 0)
176 uint16_t gain = hgcSample.
toa();
177 uint16_t
adc = hgcSample.
data();
179 bool totmode = hgcSample.
mode();
180 bool zerothreshold = hgcSample.
threshold();
181 digiValidation(detId, geom0, layer, adc, charge, totmode, zerothreshold);
196 template <
class T1,
class T2>
202 const GlobalPoint& global1 = geom->getPosition(id1);
208 hinfo.
x = global1.x();
209 hinfo.
y = global1.y();
210 hinfo.
z = global1.z();
218 edm::LogVerbatim(
"HGCalValidation") <<
"gx = " << hinfo.
x <<
" gy = " << hinfo.
y <<
" gz = " << hinfo.
z;
220 if (global1.eta() > 0)
229 if (OccupancyMap.find(layer) != OccupancyMap.end())
230 OccupancyMap[layer]++;
232 OccupancyMap[
layer] = 1;
236 int ilayer = hinfo.
layer;
240 TOT_.at(ilayer)->Fill(hinfo.
adc);
244 ADC_.at(ilayer)->Fill(hinfo.
adc);
251 int layer = itr.first;
252 int occupancy = itr.second;
256 int layer = itr.first;
257 int occupancy = itr.second;
276 std::ostringstream histoname;
277 for (
int il = 0; il <
layers_; ++il) {
280 while (istr1.size() < 2) {
281 istr1.insert(0,
"0");
285 <<
"layer_" << istr1;
286 TOA_.push_back(iB.
book1D(histoname.str().c_str(),
"toa_", 1024, 0, 1024));
290 <<
"layer_" << istr1;
291 ADC_.push_back(iB.
book1D(histoname.str().c_str(),
"ADCDigiOccupancy", 1024, 0, 1024));
295 <<
"layer_" << istr1;
296 TOT_.push_back(iB.
book1D(histoname.str().c_str(),
"TOTDigiOccupancy", 4096, 0, 4096));
299 histoname <<
"DigiOccupancy_XY_"
300 <<
"layer_" << istr1;
301 DigiOccupancy_XY_.push_back(iB.
book2D(histoname.str().c_str(),
"DigiOccupancy", 50, -500, 500, 50, -500, 500));
304 histoname <<
"DigiOccupancy_Plus_"
305 <<
"layer_" << istr1;
308 histoname <<
"DigiOccupancy_Minus_"
309 <<
"layer_" << istr1;
314 histoname <<
"SUMOfDigiOccupancy_Plus";
317 histoname <<
"SUMOfRecDigiOccupancy_Minus";
319 iB.
book1D(histoname.str().c_str(),
"SUMOfDigiOccupancy_Minus",
layers_, -0.5, layers_ - 0.5);
Log< level::Info, true > LogVerbatim
EventNumber_t event() const
void analyze(const edm::Event &, const edm::EventSetup &) override
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
const edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > tok_hgcalg_
virtual void setCurrentFolder(std::string const &fullpath)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool tileTrapezoid() const
#define DEFINE_FWK_MODULE(type)
std::vector< MonitorElement * > TOA_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< MonitorElement * > DigiOccupancy_XY_
std::vector< MonitorElement * > TOT_
std::string to_string(const V &value)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr std::array< uint8_t, layerIndexSize > layer
bool getData(T &iHolder) const
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
unsigned int layers(bool reco) const
int layer() const
get the layer #
int layer() const
get the layer #
const HGCalTopology & topology() const
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tok_hgcalc_
HGCalDigiValidation(const edm::ParameterSet &)
~HGCalDigiValidation() override
const std::string nameDetector_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< MonitorElement * > DigiOccupancy_Minus_
T const * product() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * MeanDigiOccupancy_Minus_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void digiValidation(const T1 &detId, const T2 *geom, int layer, uint16_t adc, double charge, bool mode, bool threshold)
edm::EDGetToken digiSource_
std::map< int, int > OccupancyMap_minus_
int layer() const
get the layer #
std::map< int, int > OccupancyMap_plus_
bool waferHexagon8() const
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::vector< MonitorElement * > ADC_
MonitorElement * MeanDigiOccupancy_Plus_
void fillOccupancyMap(std::map< int, int > &OccupancyMap, int layer)
int layer() const
get the layer #
std::vector< MonitorElement * > DigiOccupancy_Plus_
uint16_t *__restrict__ uint16_t const *__restrict__ adc