34 #include "CLHEP/Units/GlobalSystemOfUnits.h"
63 template <
class T1,
class T2>
79 std::vector<MonitorElement*>
TOA_;
81 std::vector<MonitorElement*>
ADC_;
82 std::vector<MonitorElement*>
TOT_;
90 : nameDetector_(iConfig.getParameter<std::
string>(
"DetectorName")),
91 ifNose_(iConfig.getParameter<bool>(
"ifNose")),
92 verbosity_(iConfig.getUntrackedParameter<int>(
"Verbosity", 0)),
93 SampleIndx_(iConfig.getUntrackedParameter<int>(
"SampleIndx", 0)),
96 tok_hgcalg_(esConsumes<HGCalGeometry, IdealGeometryRecord>(
edm::ESInputTag{
"", nameDetector_})),
99 if ((nameDetector_ ==
"HGCalEESensitive") || (nameDetector_ ==
"HGCalHESiliconSensitive") ||
100 (nameDetector_ ==
"HGCalHEScintillatorSensitive") || (nameDetector_ ==
"HGCalHFNoseSensitive")) {
101 digiSource_ = consumes<HGCalDigiCollection>(
temp);
103 throw cms::Exception(
"BadHGCDigiSource") <<
"HGCal DetectorName given as " << nameDetector_ <<
" must be: "
104 <<
"\"HGCalEESensitive\", \"HGCalHESiliconSensitive\", or "
105 <<
"\"HGCalHEScintillatorSensitive\", \"HGCalHFNoseSensitive\"!";
113 desc.
add<
bool>(
"ifNose",
false);
116 descriptions.
add(
"hgcalDigiValidationEEDefault", desc);
132 unsigned int ntot(0), nused(0);
137 if (theHGCEEDigiContainers.
isValid()) {
140 <<
nameDetector_ <<
" with " << theHGCEEDigiContainers->size() <<
" element(s)";
141 for (
const auto& it : *(theHGCEEDigiContainers.
product())) {
144 DetId detId = it.id();
149 uint16_t gain = hgcSample.
toa();
150 uint16_t
adc = hgcSample.
data();
152 bool totmode = hgcSample.
mode();
153 bool zerothreshold = hgcSample.
threshold();
154 digiValidation(detId, geom0, layer, adc, charge, totmode, zerothreshold);
165 if (theHGCHEDigiContainers.
isValid()) {
168 <<
nameDetector_ <<
" with " << theHGCHEDigiContainers->size() <<
" element(s)";
169 for (
const auto& it : *(theHGCHEDigiContainers.
product())) {
172 DetId detId = it.id();
173 int layer = ((geomType == 0)
177 uint16_t gain = hgcSample.
toa();
178 uint16_t
adc = hgcSample.
data();
180 bool totmode = hgcSample.
mode();
181 bool zerothreshold = hgcSample.
threshold();
182 digiValidation(detId, geom0, layer, adc, charge, totmode, zerothreshold);
197 template <
class T1,
class T2>
203 const GlobalPoint& global1 = geom->getPosition(id1);
209 hinfo.
x = global1.x();
210 hinfo.
y = global1.y();
211 hinfo.
z = global1.z();
219 edm::LogVerbatim(
"HGCalValidation") <<
"gx = " << hinfo.
x <<
" gy = " << hinfo.
y <<
" gz = " << hinfo.
z;
221 if (global1.eta() > 0)
230 if (OccupancyMap.find(layer) != OccupancyMap.end())
231 OccupancyMap[layer]++;
233 OccupancyMap[
layer] = 1;
237 int ilayer = hinfo.
layer;
241 TOT_.at(ilayer)->Fill(hinfo.
adc);
245 ADC_.at(ilayer)->Fill(hinfo.
adc);
252 int layer = itr.first;
253 int occupancy = itr.second;
257 int layer = itr.first;
258 int occupancy = itr.second;
277 std::ostringstream histoname;
278 for (
int il = 0; il <
layers_; ++il) {
280 auto istr1 = std::to_string(ilayer);
281 while (istr1.size() < 2) {
282 istr1.insert(0,
"0");
286 <<
"layer_" << istr1;
287 TOA_.push_back(iB.
book1D(histoname.str().c_str(),
"toa_", 1024, 0, 1024));
291 <<
"layer_" << istr1;
292 ADC_.push_back(iB.
book1D(histoname.str().c_str(),
"ADCDigiOccupancy", 1024, 0, 1024));
296 <<
"layer_" << istr1;
297 TOT_.push_back(iB.
book1D(histoname.str().c_str(),
"TOTDigiOccupancy", 4096, 0, 4096));
300 histoname <<
"DigiOccupancy_XY_"
301 <<
"layer_" << istr1;
302 DigiOccupancy_XY_.push_back(iB.
book2D(histoname.str().c_str(),
"DigiOccupancy", 50, -500, 500, 50, -500, 500));
305 histoname <<
"DigiOccupancy_Plus_"
306 <<
"layer_" << istr1;
309 histoname <<
"DigiOccupancy_Minus_"
310 <<
"layer_" << istr1;
315 histoname <<
"SUMOfDigiOccupancy_Plus";
318 histoname <<
"SUMOfRecDigiOccupancy_Minus";
320 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_
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