14 hcalDDDRecConstantsToken_{esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>()},
15 caloGeometryRunToken_{esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>()} {
16 outputFile_ = iConfig.getUntrackedParameter<
std::string>(
"outputFile",
"myfile.root");
19 dirName_ = iConfig.getParameter<
std::string>(
"DQMDirName");
45 for (
unsigned i = 0;
i < 5; ++
i) {
68 std::vector<MonitorElement *> hcalMEs;
73 std::vector<std::string> fullPathHLTFolders = igetter.
getSubdirs();
74 for (
unsigned int i = 0;
i < fullPathHLTFolders.size();
i++) {
76 std::cout <<
"\nfullPath: " << fullPathHLTFolders[
i] << std::endl;
79 std::vector<std::string> fullSubPathHLTFolders = igetter.
getSubdirs();
80 for (
unsigned int j = 0;
j < fullSubPathHLTFolders.size();
j++) {
82 std::cout <<
"fullSub: " << fullSubPathHLTFolders[
j] << std::endl;
84 if (strcmp(fullSubPathHLTFolders[
j].c_str(),
"HcalRecHitsD/HcalRecHitTask") == 0) {
87 std::cout <<
"hltMES size : " << hcalMEs.size() << std::endl;
89 std::cout <<
"\nError in HcalRecHitsEndjob!" << std::endl << std::endl;
103 std::vector<MonitorElement *> emap_depths;
107 std::vector<MonitorElement *> occupancy_maps;
108 std::vector<std::string> occupancyID;
112 std::vector<MonitorElement *> emean_vs_ieta;
117 std::vector<MonitorElement *> occupancy_vs_ieta;
118 std::vector<std::string> occupancy_vs_ietaID;
122 std::vector<MonitorElement *> RecHit_StatusWord;
123 std::vector<float> RecHit_StatusWord_Channels;
124 std::vector<MonitorElement *> RecHit_Aux_StatusWord;
125 std::vector<float> RecHit_Aux_StatusWord_Channels;
127 for (
unsigned int ih = 0; ih < hcalMEs.size(); ih++) {
130 if (hcalMEs[ih]->
getName() ==
"N_HF") {
141 if (hcalMEs[ih]->
getName().find(
"emap_depth") != std::string::npos) {
142 emap_depths.push_back(hcalMEs[ih]);
146 if (hcalMEs[ih]->
getName().
find(
"occupancy_map_H") != std::string::npos) {
147 occupancy_maps.push_back(hcalMEs[ih]);
158 occupancyID.push_back(hcalMEs[ih]->
getName().substr(
prefix.size()));
163 if (hcalMEs[ih]->
getName().find(
"emean_vs_ieta_H") != std::string::npos) {
164 emean_vs_ieta.push_back(hcalMEs[ih]);
168 if (hcalMEs[ih]->
getName().
find(
"occupancy_vs_ieta_H") != std::string::npos) {
169 occupancy_vs_ieta.push_back(hcalMEs[ih]);
180 occupancy_vs_ietaID.push_back(hcalMEs[ih]->
getName().substr(
prefix.size()));
185 if (hcalMEs[ih]->
getName().find(
"HcalRecHitTask_RecHit_StatusWord_H") != std::string::npos) {
186 RecHit_StatusWord.push_back(hcalMEs[ih]);
188 if (hcalMEs[ih]->
getName().
find(
"HB") != std::string::npos) {
189 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[1]);
190 }
else if (hcalMEs[ih]->
getName().
find(
"HE") != std::string::npos) {
191 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[2]);
192 }
else if (hcalMEs[ih]->
getName().
find(
"H0") != std::string::npos) {
193 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[3]);
194 }
else if (hcalMEs[ih]->
getName().
find(
"HF") != std::string::npos) {
195 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[4]);
197 RecHit_StatusWord_Channels.push_back(1.);
203 if (hcalMEs[ih]->
getName().
find(
"HcalRecHitTask_RecHit_Aux_StatusWord_H") != std::string::npos) {
204 RecHit_Aux_StatusWord.push_back(hcalMEs[ih]);
206 if (hcalMEs[ih]->
getName().
find(
"HB") != std::string::npos) {
207 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[1]);
208 }
else if (hcalMEs[ih]->
getName().
find(
"HE") != std::string::npos) {
209 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[2]);
210 }
else if (hcalMEs[ih]->
getName().
find(
"H0") != std::string::npos) {
211 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[3]);
212 }
else if (hcalMEs[ih]->
getName().
find(
"HF") != std::string::npos) {
213 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[4]);
215 RecHit_Aux_StatusWord_Channels.push_back(1.);
228 std::cout <<
"nevtot : " << nevtot << std::endl;
231 float fev =
float(nevtot);
232 double scaleBynevtot = 1 / fev;
236 for (
unsigned int depthIdx = 0; depthIdx < emap_depths.size(); depthIdx++) {
237 int nx = emap_depths[depthIdx]->getNbinsX();
238 int ny = emap_depths[depthIdx]->getNbinsY();
243 for (
int i = 1;
i <= nx;
i++) {
244 for (
int j = 1;
j <= ny;
j++) {
245 cnorm = emap_depths[depthIdx]->getBinContent(
i,
j) * scaleBynevtot;
246 enorm = emap_depths[depthIdx]->getBinError(
i,
j) * scaleBynevtot;
247 emap_depths[depthIdx]->setBinContent(
i,
j, cnorm);
248 emap_depths[depthIdx]->setBinError(
i,
j, enorm);
255 bool omatched =
false;
257 for (
unsigned int occupancyIdx = 0; occupancyIdx < occupancy_maps.size(); occupancyIdx++) {
258 int nx = occupancy_maps[occupancyIdx]->getNbinsX();
259 int ny = occupancy_maps[occupancyIdx]->getNbinsY();
264 unsigned int vsIetaIdx = occupancy_vs_ieta.size();
267 for (vsIetaIdx = 0; vsIetaIdx < occupancy_vs_ieta.size(); vsIetaIdx++) {
268 if (occupancyID[occupancyIdx] == occupancy_vs_ietaID[vsIetaIdx]) {
274 for (
int i = 1;
i <= nx;
i++) {
275 for (
int j = 1;
j <= ny;
j++) {
276 cnorm = occupancy_maps[occupancyIdx]->getBinContent(
i,
j) * scaleBynevtot;
277 enorm = occupancy_maps[occupancyIdx]->getBinError(
i,
j) * scaleBynevtot;
278 occupancy_maps[occupancyIdx]->setBinContent(
i,
j, cnorm);
279 occupancy_maps[occupancyIdx]->setBinError(
i,
j, enorm);
288 float phi_factor = 1.;
299 int binIeta = occupancy_maps[occupancyIdx]->getTH2F()->GetXaxis()->FindBin(
float(
ieta));
300 int binIphi = occupancy_maps[occupancyIdx]->getTH2F()->GetYaxis()->FindBin(
float(
iphi));
302 float content = occupancy_maps[occupancyIdx]->getBinContent(binIeta, binIphi);
303 float econtent = occupancy_maps[occupancyIdx]->getBinError(binIeta, binIphi);
306 sumphie += econtent * econtent;
309 int ietabin = occupancy_vs_ieta[vsIetaIdx]->getTH1F()->GetXaxis()->FindBin(
float(
ieta));
312 cnorm = sumphi / phi_factor;
313 enorm =
sqrt(sumphie) / phi_factor;
314 occupancy_vs_ieta[vsIetaIdx]->setBinContent(ietabin, cnorm);
315 occupancy_vs_ieta[vsIetaIdx]->setBinError(ietabin, enorm);
325 for (
unsigned int StatusWordIdx = 0; StatusWordIdx < RecHit_StatusWord.size(); StatusWordIdx++) {
326 int nx = RecHit_StatusWord[StatusWordIdx]->getNbinsX();
331 for (
int i = 1;
i <= nx;
i++) {
332 cnorm = RecHit_StatusWord[StatusWordIdx]->getBinContent(
i) * scaleBynevtot /
333 RecHit_StatusWord_Channels[StatusWordIdx];
335 RecHit_StatusWord[StatusWordIdx]->getBinError(
i) * scaleBynevtot / RecHit_StatusWord_Channels[StatusWordIdx];
336 RecHit_StatusWord[StatusWordIdx]->setBinContent(
i, cnorm);
337 RecHit_StatusWord[StatusWordIdx]->setBinError(
i, enorm);
341 for (
unsigned int AuxStatusWordIdx = 0; AuxStatusWordIdx < RecHit_Aux_StatusWord.size(); AuxStatusWordIdx++) {
342 int nx = RecHit_Aux_StatusWord[AuxStatusWordIdx]->getNbinsX();
347 for (
int i = 1;
i <= nx;
i++) {
348 cnorm = RecHit_Aux_StatusWord[AuxStatusWordIdx]->getBinContent(
i) * scaleBynevtot /
349 RecHit_Aux_StatusWord_Channels[AuxStatusWordIdx];
350 enorm = RecHit_Aux_StatusWord[AuxStatusWordIdx]->getBinError(
i) * scaleBynevtot /
351 RecHit_Aux_StatusWord_Channels[AuxStatusWordIdx];
352 RecHit_Aux_StatusWord[AuxStatusWordIdx]->setBinContent(
i, cnorm);
353 RecHit_Aux_StatusWord[AuxStatusWordIdx]->setBinError(
i, enorm);
virtual void setCurrentFolder(std::string const &fullpath)
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryRunToken_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void beginJob(void) override
float phifactor(int ieta)
edm::ESGetToken< HcalDDDRecConstants, HcalRecNumberingRecord > hcalDDDRecConstantsToken_
#define DEFINE_FWK_MODULE(type)
virtual double getEntries() const
get # of entries
bool getData(T &iHolder) const
int getMaxDepth(const int &type) const
HcalRecHitsDQMClient(const edm::ParameterSet &)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void beginRun(edm::Run const &, edm::EventSetup const &) override
std::string getName(const G4String &)
virtual std::vector< dqm::harvesting::MonitorElement * > getContents(std::string const &path) const
~HcalRecHitsDQMClient() override
int HcalRecHitsEndjob(const std::vector< MonitorElement *> &hcalMEs)
virtual DQM_DEPRECATED std::vector< std::string > getSubdirs() const