CMS 3D CMS Logo

Public Member Functions | Private Attributes

CaloRecHitCandidateProducer Class Reference

#include <CaloRecHitCandidateProducer.h>

Inheritance diagram for CaloRecHitCandidateProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 CaloRecHitCandidateProducer (const edm::ParameterSet &)
double cellTresholdAndWeight (const CaloRecHit &, const HcalTopology &) const
void produce (edm::Event &, const edm::EventSetup &)
 ~CaloRecHitCandidateProducer ()

Private Attributes

bool mAllowMissingInputs
double mEBthreshold
double mEBweight
std::vector< edm::InputTagmEcalLabels
double mEEthreshold
double mEEweight
edm::InputTag mHBHELabel
 source collection tag
double mHBthreshold
double mHBweight
double mHEDthreshold
double mHEDweight
double mHESthreshold
double mHESweight
double mHF1threshold
double mHF1weight
double mHF2threshold
double mHF2weight
edm::InputTag mHFLabel
edm::InputTag mHOLabel
double mHOthreshold
double mHOweight
bool mUseHO

Detailed Description

Definition at line 13 of file CaloRecHitCandidateProducer.h.


Constructor & Destructor Documentation

CaloRecHitCandidateProducer::CaloRecHitCandidateProducer ( const edm::ParameterSet fConfig)

Definition at line 67 of file CaloRecHitCandidateProducer.cc.

  :  mHBHELabel (fConfig.getParameter<edm::InputTag>("hbheInput")),
     mHOLabel (fConfig.getParameter<edm::InputTag>("hoInput")),
     mHFLabel (fConfig.getParameter<edm::InputTag>("hfInput")),
     mEcalLabels (fConfig.getParameter<std::vector<edm::InputTag> >("ecalInputs")),
     mAllowMissingInputs (fConfig.getUntrackedParameter<bool>("AllowMissingInputs",false)),
     mUseHO (fConfig.getParameter<bool>("UseHO")),

     mEBthreshold (fConfig.getParameter<double>("EBThreshold")),
     mEEthreshold  (fConfig.getParameter<double>("EEThreshold")),
     mHBthreshold  (fConfig.getParameter<double>("HBThreshold")),
     mHESthreshold  (fConfig.getParameter<double>("HESThreshold")),
     mHEDthreshold  (fConfig.getParameter<double>("HEDThreshold")),
     mHOthreshold (fConfig.getParameter<double>("HOThreshold")),
     mHF1threshold (fConfig.getParameter<double>("HF1Threshold")),
     mHF2threshold (fConfig.getParameter<double>("HF2Threshold")),
     mEBweight (fConfig.getParameter<double>("EBWeight")),
     mEEweight (fConfig.getParameter<double>("EEWeight")),
     mHBweight (fConfig.getParameter<double>("HBWeight")),
     mHESweight (fConfig.getParameter<double>("HESWeight")),
     mHEDweight (fConfig.getParameter<double>("HEDWeight")),
     mHOweight (fConfig.getParameter<double>("HOWeight")),
     mHF1weight (fConfig.getParameter<double>("HF1Weight")),
     mHF2weight (fConfig.getParameter<double>("HF2Weight"))
{
  produces<CandidateCollection>();
}
CaloRecHitCandidateProducer::~CaloRecHitCandidateProducer ( ) [inline]

Definition at line 16 of file CaloRecHitCandidateProducer.h.

{ }

Member Function Documentation

double CaloRecHitCandidateProducer::cellTresholdAndWeight ( const CaloRecHit fHit,
const HcalTopology fTopology 
) const

Definition at line 158 of file CaloRecHitCandidateProducer.cc.

References HcalDetId::depth(), DetId::det(), CaloRecHit::detid(), DetId::Ecal, EcalBarrel, EcalEndcap, CaloRecHit::energy(), HcalTopology::firstHEDoublePhiRing(), DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HcalDetId::ietaAbs(), mEBthreshold, mEBweight, mEEthreshold, mEEweight, mHBthreshold, mHBweight, mHEDthreshold, mHEDweight, mHESthreshold, mHESweight, mHF1threshold, mHF1weight, mHF2threshold, mHF2weight, mHOthreshold, mHOweight, HcalDetId::subdet(), DetId::subdetId(), and dtDQMClient_cfg::threshold.

                                                                                                                      {
  double weight = 0;
  double threshold = 0;
  DetId detId = fHit.detid ();
  DetId::Detector det = detId.det ();
  if(det == DetId::Ecal) {
    // may or may not be EB.  We'll find out.
    
    EcalSubdetector subdet = (EcalSubdetector)(detId.subdetId());
    if(subdet == EcalBarrel) {
      threshold = mEBthreshold;
      weight = mEBweight;
    }
    else if(subdet == EcalEndcap) {
      threshold = mEEthreshold;
      weight = mEEweight;
    }
  }
  else if(det == DetId::Hcal) {
    HcalDetId hcalDetId(detId);
    HcalSubdetector subdet = hcalDetId.subdet();
    
    if(subdet == HcalBarrel) {
      threshold = mHBthreshold;
      weight = mHBweight;
    }
    
    else if(subdet == HcalEndcap) {
      // check if it's single or double tower
      if(hcalDetId.ietaAbs() < fTopology.firstHEDoublePhiRing()) {
        threshold = mHESthreshold;
        weight = mHESweight;
      }
      else {
        threshold = mHEDthreshold;
        weight = mHEDweight;
      }
    } else if(subdet == HcalOuter) {
      threshold = mHOthreshold;
      weight = mHOweight;
    } else if(subdet == HcalForward) {
      if(hcalDetId.depth() == 1) {
        threshold = mHF1threshold;
        weight = mHF1weight;
      } else {
        threshold = mHF2threshold;
        weight = mHF2weight;
      }
    }
  }
  return fHit.energy () >= threshold ? weight : 0; 
}
void CaloRecHitCandidateProducer::produce ( edm::Event fEvent,
const edm::EventSetup fSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 95 of file CaloRecHitCandidateProducer.cc.

References geometry, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), edm::Event::getByLabel(), i, edm::HandleBase::isValid(), mAllowMissingInputs, mEcalLabels, mHBHELabel, mHFLabel, mHOLabel, mUseHO, convertSQLitetoXML_cfg::output, edm::Event::put(), and record.

                                                                                          {
  // get geometry
  //  const IdealGeometryRecord& record = fSetup.template get<IdealGeometryRecord>();
  const CaloGeometryRecord& caloRecord = fSetup.get<CaloGeometryRecord>();
  ESHandle<CaloGeometry> geometry;
  caloRecord.get (geometry);
  const IdealGeometryRecord& record = fSetup.get<IdealGeometryRecord>();
  ESHandle<HcalTopology> topology;
  record.get (topology);
  // set Output
  auto_ptr<CandidateCollection> output ( new CandidateCollection );
  // get and process Inputs
  edm::Handle<HBHERecHitCollection> hbhe;
  fEvent.getByLabel(mHBHELabel,hbhe);
  if (!hbhe.isValid()) {
    // can't find it!
    if (!mAllowMissingInputs) {
      *hbhe;  // will throw the proper exception
    }
  } else {
    processHits (hbhe, *this, *geometry, *topology, &*output);
  }

  if (mUseHO) {
    edm::Handle<HORecHitCollection> ho;
    fEvent.getByLabel(mHOLabel,ho);
    if (!ho.isValid()) {
      // can't find it!
      if (!mAllowMissingInputs) {
        *ho;  // will throw the proper exception        
      }
    } else {
      processHits (ho, *this, *geometry, *topology, &*output);
    }
  }

  edm::Handle<HFRecHitCollection> hf;
  fEvent.getByLabel(mHFLabel,hf);
  if (!hf.isValid()) {
    // can't find it!
    if (!mAllowMissingInputs) {
      *hf;  // will throw the proper exception
    }
  } else {
    processHits (hf, *this, *geometry, *topology, &*output);
  }

  std::vector<edm::InputTag>::const_iterator i;
  for (i=mEcalLabels.begin(); i!=mEcalLabels.end(); i++) {
    edm::Handle<EcalRecHitCollection> ec;
    fEvent.getByLabel(*i,ec);
    if (!ec.isValid()) {
      // can't find it!
      if (!mAllowMissingInputs) {
        *ec;  // will throw the proper exception
      }
    } else {
      processHits (ec, *this, *geometry, *topology, &*output);
    }
  }
  fEvent.put(output);
}

Member Data Documentation

Definition at line 24 of file CaloRecHitCandidateProducer.h.

Referenced by produce().

Definition at line 26 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 29 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 23 of file CaloRecHitCandidateProducer.h.

Referenced by produce().

Definition at line 26 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 29 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

source collection tag

Definition at line 22 of file CaloRecHitCandidateProducer.h.

Referenced by produce().

Definition at line 27 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 30 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 27 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 30 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 27 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 30 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 28 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 30 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 28 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 30 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 22 of file CaloRecHitCandidateProducer.h.

Referenced by produce().

Definition at line 22 of file CaloRecHitCandidateProducer.h.

Referenced by produce().

Definition at line 28 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 30 of file CaloRecHitCandidateProducer.h.

Referenced by cellTresholdAndWeight().

Definition at line 25 of file CaloRecHitCandidateProducer.h.

Referenced by produce().