CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

HcalQLPlotHistoMgr Class Reference

#include <HcalQLPlotHistoMgr.h>

List of all members.

Public Types

enum  EventType {
  UNKNOWN = 0, PEDESTAL = 1, LED = 2, LASER = 3,
  BEAM = 4
}
enum  HistType { ENERGY = 0, TIME = 1, PULSE = 2, ADC = 3 }

Public Member Functions

TH1 * GetAHistogram (const HcalDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
TH1 * GetAHistogram (const HcalCalibDetId &id, const HcalElectronicsId &eid, HistType ht, EventType et)
 HcalQLPlotHistoMgr (TDirectory *parent, const edm::ParameterSet &histoParams)

Static Public Member Functions

static std::string nameForEvent (EventType et)
static std::string nameForFlavor (HistType ht)

Private Member Functions

TH1 * GetAHistogramImpl (const char *name, HistType ht, EventType et)

Private Attributes

TDirectory * beamHistDir
TDirectory * ctrHistDir
edm::ParameterSet histoParams_
TDirectory * laserHistDir
TDirectory * ledHistDir
TDirectory * otherHistDir
TDirectory * pedHistDir

Detailed Description

Definition at line 12 of file HcalQLPlotHistoMgr.h.


Member Enumeration Documentation

Enumerator:
UNKNOWN 
PEDESTAL 
LED 
LASER 
BEAM 

Definition at line 15 of file HcalQLPlotHistoMgr.h.

{ UNKNOWN=0, PEDESTAL=1, LED=2, LASER=3, BEAM=4 };
Enumerator:
ENERGY 
TIME 
PULSE 
ADC 

Definition at line 14 of file HcalQLPlotHistoMgr.h.

{ ENERGY=0, TIME=1, PULSE=2, ADC=3 };

Constructor & Destructor Documentation

HcalQLPlotHistoMgr::HcalQLPlotHistoMgr ( TDirectory *  parent,
const edm::ParameterSet histoParams 
)

Definition at line 15 of file HcalQLPlotHistoMgr.cc.

References beamHistDir, histoParams_, laserHistDir, ledHistDir, otherHistDir, and pedHistDir.

                                                                           {
  pedHistDir=parent->mkdir("PEDESTAL");
  ledHistDir=parent->mkdir("LED");
  laserHistDir=parent->mkdir("LASER");
  beamHistDir=parent->mkdir("BEAM");
  otherHistDir=parent->mkdir("OTHER");
  histoParams_ = histoParams;
}

Member Function Documentation

TH1 * HcalQLPlotHistoMgr::GetAHistogram ( const HcalDetId id,
const HcalElectronicsId eid,
HistType  ht,
EventType  et 
)

Definition at line 45 of file HcalQLPlotHistoMgr.cc.

References HcalElectronicsId::dccid(), HcalElectronicsId::fiberChanId(), HcalElectronicsId::fiberIndex(), GetAHistogramImpl(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalElectronicsId::htrSlot(), HcalElectronicsId::htrTopBottom(), mergeVDriftHistosByStation::name, nameForFlavor(), HcalElectronicsId::readoutVMECrateId(), HcalElectronicsId::spigot(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HcalQLPlotAnalAlgos::processDigi(), and HcalQLPlotAnalAlgos::processRH().

{
  std::string flavor=nameForFlavor(ht);

  char name[120];

  std::string subdetStr;
  switch (id.subdet()) {
  case (HcalBarrel)  : subdetStr="HB"; break;
  case (HcalEndcap)  : subdetStr="HE"; break;
  case (HcalOuter)   : subdetStr="HO"; break;
  case (HcalForward) : subdetStr="HF"; break;
  default: subdetStr="Other"; break;
  }

  sprintf(name,"%s_%s_%d_%d_%d_eid=%d_%d_%d_%d_HTR_%d:%d%c",
          flavor.c_str(),subdetStr.c_str(),id.ieta(),id.iphi(),id.depth(),
          eid.dccid(),eid.spigot(), eid.fiberIndex(), eid.fiberChanId(),
          eid.readoutVMECrateId(), eid.htrSlot(),(eid.htrTopBottom()==1)?('t'):('b') );

  return GetAHistogramImpl(name,ht,et);
}
TH1 * HcalQLPlotHistoMgr::GetAHistogram ( const HcalCalibDetId id,
const HcalElectronicsId eid,
HistType  ht,
EventType  et 
)

Definition at line 70 of file HcalQLPlotHistoMgr.cc.

References HcalElectronicsId::dccid(), HcalElectronicsId::fiberChanId(), HcalElectronicsId::fiberIndex(), GetAHistogramImpl(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalElectronicsId::htrSlot(), HcalElectronicsId::htrTopBottom(), mergeVDriftHistosByStation::name, nameForFlavor(), HcalElectronicsId::readoutVMECrateId(), HcalElectronicsId::spigot(), and AlCaHLTBitMon_QueryRunRegistry::string.

{
  std::string flavor=nameForFlavor(ht);

  char name[120];

  std::string subdetStr;
  switch (id.hcalSubdet()) {
  case (HcalBarrel)  : subdetStr="HB"; break;
  case (HcalEndcap)  : subdetStr="HE"; break;
  case (HcalOuter)   : subdetStr="HO"; break;
  case (HcalForward) : subdetStr="HF"; break;
  default: subdetStr="Other"; break;
  }

  std::string chanstring = id.cboxChannelString();
  if (!chanstring.size()) {
    chanstring = "Unknown";
    edm::LogInfo("HcalQLPlotHistoMgr::GetAHistogram") << "Unknown calibration channel " << id.cboxChannel();
  }

  sprintf(name,"%s_CALIB_%s_%d_%d_chan=%s_eid=%d_%d_%d_%d_HTR_%d:%d%c",
          flavor.c_str(),subdetStr.c_str(),id.ieta(),id.iphi(),chanstring.c_str(),
          eid.dccid(),eid.spigot(), eid.fiberIndex(), eid.fiberChanId(),
          eid.readoutVMECrateId(), eid.htrSlot(),(eid.htrTopBottom()==1)?('t'):('b') );

  return GetAHistogramImpl(name,ht,et);
}
TH1 * HcalQLPlotHistoMgr::GetAHistogramImpl ( const char *  name,
HistType  ht,
EventType  et 
) [private]

Definition at line 101 of file HcalQLPlotHistoMgr.cc.

References BEAM, BEAM_BINS, beamHistDir, alignCSCRings::e, ENERGY, exception, edm::ParameterSet::getParameter(), histoParams_, LASER, LASER_BINS, laserHistDir, LED, LED_BINS, ledHistDir, OTHER_BINS, otherHistDir, PED_BINS, PEDESTAL, pedHistDir, PULSE, PULSE_BINS, TIME, TIME_BINS, and UNKNOWN.

Referenced by GetAHistogram().

{
  TDirectory* td;

  switch (et) {
  case(PEDESTAL): td=pedHistDir; break;
  case(LED): td=ledHistDir; break;
  case(LASER): td=laserHistDir; break;
  case(BEAM): td=beamHistDir; break;
  case(UNKNOWN): td=otherHistDir; break;
  default: td=0; break;
  }

  if (td==0) {
    printf("Unknown %d !\n", et);
    return 0;
  }

  TH1* retval=0;

  retval=(TH1*)td->Get(name);
  int bins=0; double lo=0, hi=0;

  // If the histogram doesn't exist and we are authorized,
  // create it!
  //
  if (retval==0) {
    td->cd();
    switch (ht) {
    case(ENERGY): {
      switch (et) {
      case(PEDESTAL):
        bins=PED_BINS;
        try {
          lo=histoParams_.getParameter<double>("pedGeVlo");
          hi=histoParams_.getParameter<double>("pedGeVhi");
        } catch (std::exception& e) { // can't find it!
          edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) pedGeVlo/hi not found.";
          throw e;
        }
        break;
      case(LED):
        bins=LED_BINS;
        try {
          lo=histoParams_.getParameter<double>("ledGeVlo");
          hi=histoParams_.getParameter<double>("ledGeVhi");
        } catch (std::exception& e) { // can't find it!
          edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) ledGeVlo/hi not found.";
          throw e;
        }
        break;
      case(LASER):
        bins=LASER_BINS;
        try {
          lo=histoParams_.getParameter<double>("laserGeVlo");
          hi=histoParams_.getParameter<double>("laserGeVhi");
        } catch (std::exception& e) { // can't find it!
          edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) laserGeVlo/hi not found.";
          throw e;
        }
        break;
      case(BEAM):
        bins=BEAM_BINS;
        try {
          lo=histoParams_.getParameter<double>("beamGeVlo");
          hi=histoParams_.getParameter<double>("beamGeVhi");
        } catch (std::exception& e) { // can't find it!
          edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) beamGeVlo/hi not found.";
          throw e;
        }
        break;
      case(UNKNOWN):
        bins=OTHER_BINS;
        try {
          lo=histoParams_.getParameter<double>("otherGeVlo");
          hi=histoParams_.getParameter<double>("otherGeVhi");
        } catch (std::exception& e) { // can't find it!
          edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) otherGeVlo/hi not found.";
          throw e;
        }
        break;
      default: break;
      };
    }
      break;
    case(TIME):
      bins=TIME_BINS;
      try {
        lo=histoParams_.getParameter<double>("timeNSlo");
        hi=histoParams_.getParameter<double>("timeNShi");
      } catch (std::exception& e) { // can't find it!
        edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) timeNSlo/hi not found.";
        throw e;
      }
      break;
    case(PULSE):
      bins=PULSE_BINS;
      lo=-0.5;
      hi=PULSE_BINS-0.5;
      break;
    case(ADC):
      bins=PED_BINS;
      try {
        lo=histoParams_.getParameter<double>("pedADClo");
        hi=histoParams_.getParameter<double>("pedADChi");
      } catch (std::exception& e) { // can't find it!
        edm::LogError("HcalQLPlotHistoMgr::GetAHistogram") << "Parameter(s) pedADClo/hi not found.";
        throw e;
      }
      break;
    }
   
    if (bins>0){
      if (ht==PULSE){
        retval=new TProfile(name,name,bins,lo,hi);
        retval->GetXaxis()->SetTitle("TimeSlice(25ns)");
        retval->GetYaxis()->SetTitle("fC");
      }   
      else if (ht==TIME){
        retval=new TH1F(name,name,bins,lo,hi);
        retval->GetXaxis()->SetTitle("Timing(ns)");
      }
      else if (ht==ENERGY){
        retval=new TH1F(name,name,bins,lo,hi);
        retval->GetXaxis()->SetTitle("Energy(GeV)");
      }
      else if (ht==ADC){
        retval=new TH1F(name,name,bins,lo,hi);
        retval->GetXaxis()->SetTitle("ADC Counts");
      }
    } 
  }

  return retval;
}
std::string HcalQLPlotHistoMgr::nameForEvent ( EventType  et) [static]

Definition at line 35 of file HcalQLPlotHistoMgr.cc.

References BEAM, LASER, LED, and PEDESTAL.

                                                       {
  switch(et) {
  case(PEDESTAL): return "Pedestal"; break;
  case(LED): return "LED"; break;
  case(LASER): return "Laser"; break;
  case(BEAM): return "Beam"; break;
  default: return "Other"; break;
  }     
}
std::string HcalQLPlotHistoMgr::nameForFlavor ( HistType  ht) [static]

Definition at line 25 of file HcalQLPlotHistoMgr.cc.

References ENERGY, PULSE, and TIME.

Referenced by GetAHistogram().

                                                       {
  switch (ht) {
  case(ENERGY): return "Energy"; break;
  case(TIME):  return "Time"; break;
  case(PULSE):  return "Pulse"; break;
  case(ADC):  return "ADC"; break;
  default: return ""; break;
  }
}

Member Data Documentation

TDirectory* HcalQLPlotHistoMgr::beamHistDir [private]

Definition at line 34 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::ctrHistDir [private]

Definition at line 35 of file HcalQLPlotHistoMgr.h.

Definition at line 37 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::laserHistDir [private]

Definition at line 33 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::ledHistDir [private]

Definition at line 32 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::otherHistDir [private]

Definition at line 36 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().

TDirectory* HcalQLPlotHistoMgr::pedHistDir [private]

Definition at line 31 of file HcalQLPlotHistoMgr.h.

Referenced by GetAHistogramImpl(), and HcalQLPlotHistoMgr().