74 std::vector<MonitorElement*> hcalMEs;
78 std::vector<std::string> fullPathHLTFolders = igetter.
getSubdirs();
79 for(
unsigned int i=0;
i<fullPathHLTFolders.size();
i++) {
84 std::vector<std::string> fullSubPathHLTFolders = igetter.
getSubdirs();
85 for(
unsigned int j=0;j<fullSubPathHLTFolders.size();j++) {
89 if( strcmp(fullSubPathHLTFolders[j].c_str(),
"HcalRecHitsD/HcalRecHitTask") ==0 ){
90 hcalMEs = igetter.
getContents(fullSubPathHLTFolders[j]);
110 std::vector<MonitorElement*> emap_depths;
113 std::vector<MonitorElement*> occupancy_maps;
114 std::vector<std::string> occupancyID;
117 std::vector<MonitorElement*> emean_vs_ieta;
121 std::vector<MonitorElement*> occupancy_vs_ieta;
122 std::vector<std::string> occupancy_vs_ietaID;
126 std::vector<MonitorElement*> RecHit_StatusWord;
127 std::vector<float> RecHit_StatusWord_Channels;
128 std::vector<MonitorElement*> RecHit_Aux_StatusWord;
129 std::vector<float> RecHit_Aux_StatusWord_Channels;
131 for(
unsigned int ih=0; ih<hcalMEs.size(); ih++){
135 if( hcalMEs[ih]->getName() ==
"N_HF" ){
145 if( hcalMEs[ih]->getName().find(
"emap_depth") != std::string::npos ){
146 emap_depths.push_back(hcalMEs[ih]);
150 if( hcalMEs[ih]->getName().
find(
"occupancy_map_H") != std::string::npos ){
151 occupancy_maps.push_back(hcalMEs[ih]);
161 occupancyID.push_back( hcalMEs[ih]->getName().substr(prefix.size()) );
166 if( hcalMEs[ih]->getName().find(
"emean_vs_ieta_H") != std::string::npos ){
167 emean_vs_ieta.push_back(hcalMEs[ih]);
171 if( hcalMEs[ih]->getName().
find(
"occupancy_vs_ieta_H") != std::string::npos ){
172 occupancy_vs_ieta.push_back(hcalMEs[ih]);
182 occupancy_vs_ietaID.push_back( hcalMEs[ih]->getName().substr(prefix.size()) );
187 if( hcalMEs[ih]->getName().find(
"HcalRecHitTask_RecHit_StatusWord_H") != std::string::npos ){
188 RecHit_StatusWord.push_back(hcalMEs[ih]);
190 if(hcalMEs[ih]->getName().
find(
"HB") != std::string::npos ){
191 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[1]);
192 }
else if(hcalMEs[ih]->getName().
find(
"HE") != std::string::npos ){
193 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[2]);
194 }
else if(hcalMEs[ih]->getName().
find(
"H0") != std::string::npos ){
195 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[3]);
196 }
else if(hcalMEs[ih]->getName().
find(
"HF") != std::string::npos ){
197 RecHit_StatusWord_Channels.push_back((
float)
nChannels_[4]);
199 RecHit_StatusWord_Channels.push_back(1.);
205 if( hcalMEs[ih]->getName().
find(
"HcalRecHitTask_RecHit_Aux_StatusWord_H") != std::string::npos ){
206 RecHit_Aux_StatusWord.push_back(hcalMEs[ih]);
208 if(hcalMEs[ih]->getName().
find(
"HB") != std::string::npos ){
209 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[1]);
210 }
else if(hcalMEs[ih]->getName().
find(
"HE") != std::string::npos ){
211 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[2]);
212 }
else if(hcalMEs[ih]->getName().
find(
"H0") != std::string::npos ){
213 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[3]);
214 }
else if(hcalMEs[ih]->getName().
find(
"HF") != std::string::npos ){
215 RecHit_Aux_StatusWord_Channels.push_back((
float)
nChannels_[4]);
217 RecHit_Aux_StatusWord_Channels.push_back(1.);
232 float fev =
float (nevtot);
233 double scaleBynevtot = 1 / fev;
237 for(
unsigned int depthIdx = 0; depthIdx < emap_depths.size(); depthIdx++){
239 int nx = emap_depths[depthIdx]->getNbinsX();
240 int ny = emap_depths[depthIdx]->getNbinsY();
245 for (
int i = 1;
i <= nx;
i++) {
246 for (
int j = 1; j <= ny; j++) {
247 cnorm = emap_depths[depthIdx]->getBinContent(
i,j) * scaleBynevtot;
248 enorm = emap_depths[depthIdx]->getBinError(
i,j) * scaleBynevtot;
249 emap_depths[depthIdx]->setBinContent(
i,j,cnorm);
250 emap_depths[depthIdx]->setBinError(
i,j,enorm);
258 bool omatched =
false;
260 for(
unsigned int occupancyIdx = 0; occupancyIdx < occupancy_maps.size(); occupancyIdx++){
262 int nx = occupancy_maps[occupancyIdx]->getNbinsX();
263 int ny = occupancy_maps[occupancyIdx]->getNbinsY();
268 unsigned int vsIetaIdx = occupancy_vs_ieta.size();
271 for(vsIetaIdx = 0; vsIetaIdx < occupancy_vs_ieta.size(); vsIetaIdx++){
272 if(occupancyID[occupancyIdx] == occupancy_vs_ietaID[vsIetaIdx]){
278 for (
int i = 1;
i <= nx;
i++) {
279 for (
int j = 1; j <= ny; j++) {
280 cnorm = occupancy_maps[occupancyIdx]->getBinContent(
i,j) * scaleBynevtot;
281 enorm = occupancy_maps[occupancyIdx]->getBinError(
i,j) * scaleBynevtot;
282 occupancy_maps[occupancyIdx]->setBinContent(
i,j,cnorm);
283 occupancy_maps[occupancyIdx]->setBinError(
i,j,enorm);
293 for (
int ieta = -41; ieta <= 41; ieta++) {
294 float phi_factor = 1.;
298 if(ieta == 0)
continue;
303 for (
int iphi = 0; iphi <= 71; iphi++) {
304 int binIeta = occupancy_maps[occupancyIdx]->getTH2F()->GetXaxis()->FindBin(
float(ieta));
305 int binIphi = occupancy_maps[occupancyIdx]->getTH2F()->GetYaxis()->FindBin(
float(iphi));
307 float content = occupancy_maps[occupancyIdx]->getBinContent(binIeta,binIphi);
308 float econtent = occupancy_maps[occupancyIdx]->getBinError(binIeta,binIphi);
311 sumphie += econtent*econtent;
314 int ietabin = occupancy_vs_ieta[vsIetaIdx]->getTH1F()->GetXaxis()->FindBin(
float(ieta));
319 cnorm = sumphi / phi_factor;
320 enorm =
sqrt(sumphie) / phi_factor;
321 occupancy_vs_ieta[vsIetaIdx]->setBinContent(ietabin, cnorm);
322 occupancy_vs_ieta[vsIetaIdx]->setBinError(ietabin,enorm);
331 for(
unsigned int StatusWordIdx = 0; StatusWordIdx < RecHit_StatusWord.size(); StatusWordIdx++){
333 int nx = RecHit_StatusWord[StatusWordIdx]->getNbinsX();
338 for (
int i = 1;
i <= nx;
i++) {
339 cnorm = RecHit_StatusWord[StatusWordIdx]->getBinContent(
i) * scaleBynevtot / RecHit_StatusWord_Channels[StatusWordIdx];
340 enorm = RecHit_StatusWord[StatusWordIdx]->getBinError(
i) * scaleBynevtot / RecHit_StatusWord_Channels[StatusWordIdx];
341 RecHit_StatusWord[StatusWordIdx]->setBinContent(
i,cnorm);
342 RecHit_StatusWord[StatusWordIdx]->setBinError(
i,enorm);
348 for(
unsigned int AuxStatusWordIdx = 0; AuxStatusWordIdx < RecHit_Aux_StatusWord.size(); AuxStatusWordIdx++){
350 int nx = RecHit_Aux_StatusWord[AuxStatusWordIdx]->getNbinsX();
355 for (
int i = 1;
i <= nx;
i++) {
356 cnorm = RecHit_Aux_StatusWord[AuxStatusWordIdx]->getBinContent(
i) * scaleBynevtot / RecHit_Aux_StatusWord_Channels[AuxStatusWordIdx];
357 enorm = RecHit_Aux_StatusWord[AuxStatusWordIdx]->getBinError(
i) * scaleBynevtot / RecHit_Aux_StatusWord_Channels[AuxStatusWordIdx];
358 RecHit_Aux_StatusWord[AuxStatusWordIdx]->setBinContent(
i,cnorm);
359 RecHit_Aux_StatusWord[AuxStatusWordIdx]->setBinError(
i,enorm);
373 if(ieta >= -20 && ieta <= 20 ){
376 if(ieta >= 40 || ieta <= -40 ){
std::vector< MonitorElement * > getContents(Args &&...args)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
const HcalDDDRecConstants * hcons
double getEntries(void) const
get # of entries
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)
int HcalRecHitsEndjob(const std::vector< MonitorElement * > &hcalMEs)
int getMaxDepth(const int &type) const
HcalRecHitsDQMClient(const edm::ParameterSet &)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
std::vector< std::string > getSubdirs(void)
void setCurrentFolder(const std::string &fullpath)
ESHandle< TrackerGeometry > geometry
void beginRun(edm::Run const &, edm::EventSetup const &) override
~HcalRecHitsDQMClient() override