CMS 3D CMS Logo

Classes | Functions | Variables

/data/refman/pasoursint/CMSSW_5_3_6/src/DQM/HcalMonitorTasks/interface/HcalEtaPhiHists.h File Reference

#include "TH1F.h"
#include "TH2F.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/MonitorElement.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include <iostream>

Go to the source code of this file.

Classes

class  EtaPhiHists

Functions

int CalcEtaBin (int subdet, int ieta, int depth)
int CalcIeta (int subdet, int eta, int depth)
int CalcIeta (int eta, int depth)
void FillUnphysicalHEHFBins (MonitorElement *hh)
void FillUnphysicalHEHFBins (EtaPhiHists &hh)
std::vector< std::string > HcalEtaPhiHistNames ()
bool isHB (int etabin, int depth)
bool isHE (int etabin, int depth)
bool isHF (int etabin, int depth)
bool isHO (int etabin, int depth)
bool isSiPM (int ieta, int iphi, int depth)
void SetEtaPhiLabels (MonitorElement *h)
bool validDetId (HcalSubdetector sd, int ies, int ip, int dp)

Variables

const int binmapd2 []
const int binmapd3 [] = {-28,-27,-9999,-16,-9999,16,-9999,27,28}

Function Documentation

int CalcEtaBin ( int  subdet,
int  ieta,
int  depth 
) [inline]

Definition at line 202 of file HcalEtaPhiHists.h.

References abs, HcalEndcap, HcalForward, and HcalOuter.

Referenced by HcalDetDiagPedestalMonitor::CheckStatus(), HcalDetDiagLEDMonitor::fill_channel_status(), HcalDetDiagLEDMonitor::fill_energy(), HcalCoarsePedestalMonitor::fill_Nevents(), HcalDigiMonitor::fill_Nevents(), HcalDetDiagLaserMonitor::fillProblems(), HcalDetDiagLEDClient::get_channel_status(), HcalDetDiagLEDMonitor::get_energy(), HcalDetDiagLEDClient::get_energy(), HcalBaseMonitor::hideKnownBadCells(), HcalRawDataClient::mapChannproblem(), HcalRawDataMonitor::mapChannproblem(), HcalRawDataMonitor::mapDCCproblem(), HcalRawDataClient::mapDCCproblem(), HcalRawDataMonitor::mapHTRproblem(), HcalRawDataClient::mapHTRproblem(), HcalDigiMonitor::process_Digi(), HcalDeadCellMonitor::process_Digi(), HcalDeadCellMonitor::process_RecHit(), HcalDigiMonitor::processEvent(), HcalCoarsePedestalMonitor::processEvent(), HcalRecHitMonitor::processEvent_rechit(), HcalHotCellMonitor::processEvent_rechitenergy(), and HcalHotCellMonitor::processHit_rechitNeighbors().

{
  // This takes the eta value from a subdetector and return an eta counter value as used by eta-phi array
  // (ieta=-41 corresponds to bin 0, +41 to bin 85 -- there are two offsets to deal with the overlap at |ieta|=29).
  // For HO, ieta = -15 corresponds to bin 0, and ieta=15 is bin 30
  // For HE depth 3, things are more complicated, but feeding the ieta value will give back the corresponding counter eta value
  
  // The CalcEtaBin value is the value as used within our array counters, and thus starts at 0.
  // If you are using it with getBinContent or setBinContent, you will need to add +1 to the result of this function
  
  int etabin=-9999; // default invalid value

  if (depth==1)
    {
      // Depth 1 is fairly straightforward -- just shift HF-, HF+ by -/+1
      etabin=ieta+42;
      if (subdet==HcalForward)
        {
          ieta < 0 ? etabin-- : etabin++;
        }
    }

  else if (depth==2)
    {
      // Depth 2 is more complicated, given that there are no cells in the range |ieta|<15
      if (ieta<-14)
        {
          etabin=ieta+42;
          if (subdet==HcalForward) etabin--;
        }
      else if (ieta>14)
        {
          etabin=ieta+14;
          if (subdet==HcalForward) etabin++;
        }
      
    }
  // HO is also straightforward; a simple offset to the ieta value is applied
  else if (subdet==HcalOuter && abs(ieta)<16)
    etabin=ieta+15;
  else if (subdet==HcalEndcap)
    {
      // HE depth 3 has spotty coverage; hard-code the bin response
      if (depth==3)
        {
          if (ieta==-28) etabin=0;
          else if (ieta==-27) etabin=1;
          else if (ieta==-16) etabin=3;
          else if (ieta==16)  etabin=5;
          else if (ieta==27)  etabin=7;
          else if (ieta==28)  etabin=8;
        }
    }
  return etabin;
}
int CalcIeta ( int  subdet,
int  eta,
int  depth 
) [inline]

Definition at line 258 of file HcalEtaPhiHists.h.

References abs, binmapd2, binmapd3, eta(), HcalBarrel, HcalEndcap, HcalForward, and HcalOuter.

{
  // This function returns the 'true' ieta value given subdet, eta, and depth
  // Here 'eta' is the index from our arrays (it starts at 0);
  // remember that histogram bins start with bin 1, so there's an offset of 1
  // to consider if using getBinContent(eta,phi)

  // eta runs from 0...X  (X depends on depth)
  int ieta=-9999; // default value is nonsensical
  if (subdet==HcalBarrel)
    {
      if (depth==1) 
        {
          ieta=eta-42;
          if (ieta==0) return -9999;
          return ieta;
        }
      else if (depth==2)
        {
          ieta=binmapd2[eta];
          if (ieta==0) return -9999;
          if (ieta==17 || ieta == -17) 
            return -9999; // no depth 2 cells at |ieta| = 17
          return ieta;
        }
      else
        return -9999; // non-physical value
    }
  else if (subdet==HcalForward)
    {
      if (depth==1)
        {
          ieta=eta-42;
          if (eta<13) ieta++;
          else if (eta>71) ieta--;
          else return -9999; // if outside forward range, return dummy
          return ieta;
        }
      else if (depth==2)
        {
          ieta=binmapd2[eta]; // special map for depth 2
          if (ieta<=-30) ieta++;
          else if (ieta>=30) ieta--;
          else return -9999;
          return ieta;
        }
      else return -9999;
    }

  else if (subdet==HcalEndcap)
    {
      if (depth==1) 
        ieta=eta-42;
      else if (depth==2) 
        {
          ieta=binmapd2[eta];
          if (abs(ieta)>29 || abs(ieta)<18) return -9999; // outside HE
          if (ieta==0) return -9999;
          return ieta;
        }
      else if (depth==3)
        {
          if (eta<0 || eta>8) return -9999;
          else
            ieta=binmapd3[eta]; // special map for depth 3
          if (ieta==0) return -9999;
          return ieta;
        }
      else return -9999;
    } // HcalEndcap
  else if ( subdet==HcalOuter)
    {
      if (depth!=4)
        return -9999;
      else
        {
          ieta= eta-15;  // bin 0 is ieta=-15, all bins increment normally from there
          if (abs(ieta)>15) return -9999;
          if (ieta==0) return -9999;
          return ieta;
        }
    } // HcalOuter
  if (ieta==0) return -9999;
  return ieta;
}
int CalcIeta ( int  eta,
int  depth 
) [inline]

Definition at line 344 of file HcalEtaPhiHists.h.

References abs, binmapd2, binmapd3, and eta().

{
  // This version of CalcIeta does the same as the function above,
  // but does not require that 'subdet' be specified.

  // returns ieta value give an eta counter.
  // eta runs from 0...X  (X depends on depth)
  int ieta=-9999;
  if (eta<0) return ieta;
  if (depth==1)
    {
      ieta=eta-42; // default shift: bin 0 corresponds to a histogram ieta of -42 (which is offset by 1 from true HF value of -41)
      if (eta<13) ieta++;
      else if (eta>71) ieta--;
      if (ieta==0) ieta=-9999;
      return ieta;
    }
  else if (depth==2)
    {
      if (eta>57) return -9999;
      else
        {
          ieta=binmapd2[eta];
          if (ieta==-9999) return ieta;
          if (ieta==0) return -9999;
          if (ieta==17 || ieta == -17) return -9999; // no depth 2 cells at |ieta| = 17
          else if (ieta<=-30) ieta++;
          else if (ieta>=30) ieta--;
          return ieta;
        }
    }
  else if (depth==3)
    {
      if (eta>8) return -9999;
      else
        ieta=binmapd3[eta];
      if (ieta==0) return -9999;
      return ieta;
    }
  else if (depth==4)
    {
      ieta= eta-15;  // bin 0 is ieta=-15, all bins increment normally from there
      if (abs(ieta)>15) return -9999;
      if (ieta==0) return -9999;
      return ieta;
    }
  return ieta; // avoids compilation warning
}
void FillUnphysicalHEHFBins ( MonitorElement hh) [inline]

Definition at line 624 of file HcalEtaPhiHists.h.

References abs, HcalObjRepresent::CalcIeta(), eta(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), phi, and MonitorElement::setBinContent().

{
  // Fills unphysical HE/HF bins for Summary Histogram
  // Summary Histogram is binned with the same binning as the Depth 1 EtaPhiHists
  if (hh==0) return; 
  int ieta=0;
  int iphi=0;
  int etabins = hh->getNbinsX();
  int phibins = hh->getNbinsY();
  float binval=0;
  for (int eta=0;eta<etabins;++eta) // loop over eta bins
    {
      ieta=CalcIeta(eta,1);
      if (ieta==-9999 || abs(ieta)<21) continue;  // ignore etas that don't exist, or that have 5 degree phi binning

      for (int phi=0;phi<phibins;++phi)
        {
          iphi=phi+1;
          if (iphi%2==1 && abs(ieta)<40 && iphi<73) // 10 degree phi binning condition
            {
              binval=hh->getBinContent(eta+1,iphi);
              hh->setBinContent(eta+1,iphi+1,binval);
            } // if (iphi%2==1...) 
          else if (abs(ieta)>39 && iphi%4==3 && iphi<73) // 20 degree phi binning condition
            {
              // Set last two eta strips where each cell spans 20 degrees in phi
              // Set next phi cell above iphi, and 2 cells below the actual cell 
              hh->setBinContent(eta+1, (iphi)%72+1, hh->getBinContent(eta+1,iphi));
              hh->setBinContent(eta+1, (iphi+1)%72+1, hh->getBinContent(eta+1,iphi));
              hh->setBinContent(eta+1, (iphi+2)%72+1, hh->getBinContent(eta+1,iphi));
            } // else if (abs(ieta)>39 ...)
        } // for (int phi=0;phi<72;++phi)

    } // for (int eta=0; eta< (etaBins_-2);++eta)

  return;
} // FillUnphysicalHEHFBins(std::vector<MonitorElement*> &hh)
void FillUnphysicalHEHFBins ( EtaPhiHists hh) [inline]

Definition at line 587 of file HcalEtaPhiHists.h.

References abs, HcalObjRepresent::CalcIeta(), EtaPhiHists::depth, eta(), and phi.

{
  int ieta=0;
  int iphi=0;
  // First 2 depths have 5-10-20 degree corrections
  for (unsigned int d=0;d<3;++d)
    {
      if (!hh.depth[d]) continue;
      for (int eta=0;eta<hh.depth[d]->getNbinsX();++eta)
        {
          ieta=CalcIeta(eta,d+1);
          if (ieta==-9999 || abs(ieta)<21) continue;
          for (int phi=0;phi<hh.depth[d]->getNbinsY();++phi)
            {
              iphi=phi+1;
              if (iphi%2==1 && abs(ieta)<40 && iphi<73)
                {
                  hh.depth[d]->setBinContent(eta+1,iphi+1,hh.depth[d]->getBinContent(eta+1,iphi));
                }
              // last two eta strips span 20 degrees in phi
              // Fill the phi cell above iphi, and the 2 below it
              else  if (abs(ieta)>39 && iphi%4==3 && iphi<73)
                {
                  //ieta=40, iphi=3 covers iphi 3,4,5,6
                  hh.depth[d]->setBinContent(eta+1,(iphi)%72+1, hh.depth[d]->getBinContent(eta+1,iphi));
                  hh.depth[d]->setBinContent(eta+1,(iphi+1)%72+1, hh.depth[d]->getBinContent(eta+1,iphi));
                  hh.depth[d]->setBinContent(eta+1,(iphi+2)%72+1, hh.depth[d]->getBinContent(eta+1,iphi));
                }
            } // for (int phi...)
        } // for (int eta...)
    } // for (int d=0;...)
  // no corrections needed for HO (depth 4)
  return;
} // FillUnphysicalHEHFBins(MonitorElement* hh)
std::vector<std::string> HcalEtaPhiHistNames ( ) [inline]
bool isHB ( int  etabin,
int  depth 
) [inline]
bool isHE ( int  etabin,
int  depth 
) [inline]

Definition at line 429 of file HcalEtaPhiHists.h.

References abs, and HcalObjRepresent::CalcIeta().

Referenced by HcalRecHitClient::analyze(), HcalSummaryClient::analyze(), HcalRawDataMonitor::analyze(), HcalDeadCellClient::calculateProblems(), HcalCoarsePedestalClient::calculateProblems(), HcalDetDiagPedestalClient::calculateProblems(), HcalDigiClient::calculateProblems(), HcalRecHitClient::calculateProblems(), HcalDetDiagNoiseMonitorClient::calculateProblems(), HcalDetDiagTimingClient::calculateProblems(), HcalNZSClient::calculateProblems(), HcalDetDiagLaserClient::calculateProblems(), HcalHotCellClient::calculateProblems(), HcalRawDataClient::calculateProblems(), HcalHotCellMonitor::fillNevents_problemCells(), ZDCMonitorClient::htmlOutput(), HcalDetDiagPedestalClient::htmlOutput(), HcalHotCellClient::updateChannelStatus(), and HcalDeadCellClient::updateChannelStatus().

{
  if (depth>3) return false;
  else if (depth<1) return false;
  else
    {
      int ieta=CalcIeta(etabin,depth);
      if (ieta==-9999) return false;
      if (depth==1)
        {
          if (abs(ieta)>=17 && abs(ieta)<=28 ) return true;
          if (ieta==-29 && etabin==13) return true; // HE -29
          if (ieta==29 && etabin == 71) return true; // HE +29
        }
      else if (depth==2)
        {
          if (abs(ieta)>=17 && abs(ieta)<=28 ) return true;
          if (ieta==-29 && etabin==13) return true; // HE -29
          if (ieta==29 && etabin == 43) return true; // HE +29
        }
      else if (depth==3)
        return true;
    }
  return false;
}
bool isHF ( int  etabin,
int  depth 
) [inline]
bool isHO ( int  etabin,
int  depth 
) [inline]
bool isSiPM ( int  ieta,
int  iphi,
int  depth 
) [inline]
void SetEtaPhiLabels ( MonitorElement h) [inline]

Definition at line 556 of file HcalEtaPhiHists.h.

References i, label, and MonitorElement::setBinLabel().

{
  std::stringstream label;
  for (int i=-41;i<=-29;i=i+2)
    {
      label<<i;
      h->setBinLabel(i+42,label.str().c_str());
      label.str("");
    }
  h->setBinLabel(14,"-29HE");
    
  // offset by one for HE
  for (int i=-27;i<=27;i=i+2)
    {
      label<<i;
      h->setBinLabel(i+43,label.str().c_str());
      label.str("");
    }
  h->setBinLabel(72,"29HE");
  for (int i=29;i<=41;i=i+2)
    {
      label<<i;
      h->setBinLabel(i+44,label.str().c_str());
      label.str("");
    }
  return;
}
bool validDetId ( HcalSubdetector  sd,
int  ies,
int  ip,
int  dp 
) [inline]

Definition at line 502 of file HcalEtaPhiHists.h.

References abs, HcalBarrel, HcalEndcap, HcalForward, and HcalOuter.

Referenced by HcalRecHitClient::analyze(), HcalCoarsePedestalMonitor::fill_Nevents(), HcalDigiMonitor::fill_Nevents(), HcalHotCellMonitor::fillNevents_energy(), HcalHotCellMonitor::fillNevents_neighbor(), HcalHotCellMonitor::fillNevents_persistentenergy(), HcalDeadCellMonitor::fillNevents_problemCells(), HcalDeadCellMonitor::fillNevents_recentdigis(), HcalDeadCellMonitor::fillNevents_recentrechits(), HcalTTPDigiProducer::HcalTTPDigiProducer(), PhotonFixCMS::initialise(), HcalMonitorClient::PlotPedestalValues(), HcalHotCellClient::updateChannelStatus(), HcalDeadCellClient::updateChannelStatus(), and CastorTopology::validRaw().

{
  // inputs are (subdetector, ieta, iphi, depth)
  // stolen from latest version of DataFormats/HcalDetId/src/HcalDetId.cc (not yet available in CMSSW_2_1_9)

  const int ie ( abs( ies ) ) ;

  return ( ( ip >=  1         ) &&
           ( ip <= 72         ) &&
           ( dp >=  1         ) &&
           ( ie >=  1         ) &&
           ( ( ( sd == HcalBarrel ) &&
               ( ( ( ie <= 14         ) &&
                   ( dp ==  1         )    ) ||
                 ( ( ( ie == 15 ) || ( ie == 16 ) ) && 
                   ( dp <= 2          )                ) ) ) ||
             (  ( sd == HcalEndcap ) &&
                ( ( ( ie == 16 ) &&
                    ( dp ==  3 )          ) ||
                  ( ( ie == 17 ) &&
                    ( dp ==  1 )          ) ||
                  ( ( ie >= 18 ) &&
                    ( ie <= 20 ) &&
                    ( dp <=  2 )          ) ||
                  ( ( ie >= 21 ) &&
                    ( ie <= 26 ) &&
                    ( dp <=  2 ) &&
                    ( ip%2 == 1 )         ) ||
                  ( ( ie >= 27 ) &&
                    ( ie <= 28 ) &&
                    ( dp <=  3 ) &&
                    ( ip%2 == 1 )         ) ||
                  ( ( ie == 29 ) &&
                    ( dp <=  2 ) &&
                    ( ip%2 == 1 )         )          )      ) ||
             (  ( sd == HcalOuter ) &&
                ( ie <= 15 ) &&
                ( dp ==  4 )           ) ||
             (  ( sd == HcalForward ) &&
                ( dp <=  2 )          &&
                ( ( ( ie >= 29 ) &&
                    ( ie <= 39 ) &&
                    ( ip%2 == 1 )    ) ||
                  ( ( ie >= 40 ) &&
                    ( ie <= 41 ) &&
                    ( ip%4 == 3 )         )  ) ) ) ) ;



} // bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)

Variable Documentation

const int binmapd2[]
Initial value:
{-42,-41,-40,-39,-38,-37,-36,-35,-34,-33,-32,-31,-30,
                                       -29,-28,-27,-26,-25,-24,-23,-22,-21,-20,-19,-18,-17,
                                       -16,-15,-9999, 15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,
                                       30,31,32,33,34,35,36,37,38,39,40,41,42}

Definition at line 193 of file HcalEtaPhiHists.h.

Referenced by CalcIeta(), and HcalDeadCellMonitor::processEvent().

const int binmapd3[] = {-28,-27,-9999,-16,-9999,16,-9999,27,28}

Definition at line 200 of file HcalEtaPhiHists.h.

Referenced by CalcIeta().