CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HcalSimpleReconstructor Class Reference

#include <HcalSimpleReconstructor.h>

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

List of all members.

Public Member Functions

virtual void beginRun (edm::Run &r, edm::EventSetup const &es)
virtual void endRun (edm::Run &r, edm::EventSetup const &es)
 HcalSimpleReconstructor (const edm::ParameterSet &ps)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~HcalSimpleReconstructor ()

Private Member Functions

template<class DIGICOLL , class RECHITCOLL >
void process (edm::Event &e, const edm::EventSetup &c)

Private Attributes

DetId::Detector det_
bool dropZSmarkedPassed_
int firstSample_
edm::InputTag inputLabel_
HcalRecoParamsparamTS
HcalSimpleRecAlgo reco_
int samplesToAdd_
int subdet_
HcalOtherSubdetector subdetOther_
bool tsFromDB_

Detailed Description

Date:
2011/09/02 22:54:20
Revision:
1.7
Author:
J. Mans - Minnesota
Date:
2011/05/20 17:17:30
Revision:
1.3
Author:
E. Garcia - CSU Based on HcalSimpleReconstructor.h by J. Mans

Definition at line 22 of file HcalSimpleReconstructor.h.


Constructor & Destructor Documentation

HcalSimpleReconstructor::HcalSimpleReconstructor ( const edm::ParameterSet ps) [explicit]

Definition at line 16 of file HcalSimpleReconstructor.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), HcalBarrel, HcalForward, HcalOuter, and subdet_.

                                                                           :
  reco_(conf.getParameter<bool>("correctForTimeslew"),
        conf.getParameter<bool>("correctForPhaseContainment"),conf.getParameter<double>("correctionPhaseNS")),
  det_(DetId::Hcal),
  inputLabel_(conf.getParameter<edm::InputTag>("digiLabel")),
  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
  firstSample_(conf.getParameter<int>("firstSample")),
  samplesToAdd_(conf.getParameter<int>("samplesToAdd")),
  tsFromDB_(conf.getParameter<bool>("tsFromDB"))
{

  std::string subd=conf.getParameter<std::string>("Subdetector");
  if (!strcasecmp(subd.c_str(),"HBHE")) {
    subdet_=HcalBarrel;
    produces<HBHERecHitCollection>();
  } else if (!strcasecmp(subd.c_str(),"HO")) {
    subdet_=HcalOuter;
    produces<HORecHitCollection>();
  } else if (!strcasecmp(subd.c_str(),"HF")) {
    subdet_=HcalForward;
    produces<HFRecHitCollection>();
  } else {
    std::cout << "HcalSimpleReconstructor is not associated with a specific subdetector!" << std::endl;
  }       
  
}
HcalSimpleReconstructor::~HcalSimpleReconstructor ( ) [virtual]

Definition at line 43 of file HcalSimpleReconstructor.cc.

{ }

Member Function Documentation

void HcalSimpleReconstructor::beginRun ( edm::Run r,
edm::EventSetup const &  es 
) [virtual]
void HcalSimpleReconstructor::endRun ( edm::Run r,
edm::EventSetup const &  es 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 54 of file HcalSimpleReconstructor.cc.

References HcalSimpleRecAlgo::endRun(), paramTS, reco_, and tsFromDB_.

                                                                      {
  if(tsFromDB_ && paramTS) {
    delete paramTS;
    paramTS = 0;
    reco_.endRun();
  }
}
template<class DIGICOLL , class RECHITCOLL >
void HcalSimpleReconstructor::process ( edm::Event e,
const edm::EventSetup c 
) [private]

Definition at line 64 of file HcalSimpleReconstructor.cc.

References dropZSmarkedPassed_, first, HcalRecoParam::firstSample(), firstSample_, edm::EventSetup::get(), edm::Event::getByLabel(), HcalCondObjectContainer< Item >::getValues(), i, inputLabel_, edm::EventBase::isRealData(), paramTS, edm::Event::put(), DetId::rawId(), reco_, HcalSimpleRecAlgo::reconstruct(), HcalRecoParam::samplesToAdd(), samplesToAdd_, HcalSimpleRecAlgo::setForData(), and tsFromDB_.

{
  // get conditions
  edm::ESHandle<HcalDbService> conditions;
  eventSetup.get<HcalDbRecord>().get(conditions);
  const HcalQIEShape* shape = conditions->getHcalShape (); // this one is generic

  // HACK related to HB- corrections
  if(e.isRealData()) reco_.setForData();

  edm::Handle<DIGICOLL> digi;

  e.getByLabel(inputLabel_,digi);

  // create empty output
  std::auto_ptr<RECHITCOLL> rec(new RECHITCOLL);
  rec->reserve(digi->size());
  // run the algorithm
  int first = firstSample_;
  int toadd = samplesToAdd_;
  typename DIGICOLL::const_iterator i;
  for (i=digi->begin(); i!=digi->end(); i++) {
    HcalDetId cell = i->id();
    DetId detcell=(DetId)cell;
    // rof 27.03.09: drop ZS marked and passed digis:
    if (dropZSmarkedPassed_)
      if (i->zsMarkAndPass()) continue;

    const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
    const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
    HcalCoderDb coder (*channelCoder, *shape);

    //>>> firstSample & samplesToAdd
    if(tsFromDB_) {
      const HcalRecoParam* param_ts = paramTS->getValues(detcell.rawId());
      first = param_ts->firstSample();
      toadd = param_ts->samplesToAdd();
    }
    rec->push_back(reco_.reconstruct(*i,first,toadd,coder,calibrations));

  }
  // return result
  e.put(rec);
}
void HcalSimpleReconstructor::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 110 of file HcalSimpleReconstructor.cc.

References det_, alignCSCRings::e, DetId::Hcal, HcalBarrel, HcalCalibration, HcalEndcap, HcalForward, HcalOther, HcalOuter, edm::EventBase::isRealData(), reco_, HcalSimpleRecAlgo::setForData(), subdet_, and subdetOther_.

{
  // HACK related to HB- corrections
  if(e.isRealData()) reco_.setForData();
 
  
  if (det_==DetId::Hcal) {
    if (subdet_==HcalBarrel || subdet_==HcalEndcap) {
      process<HBHEDigiCollection, HBHERecHitCollection>(e, eventSetup);
    } else if (subdet_==HcalForward) {
      process<HFDigiCollection, HFRecHitCollection>(e, eventSetup);
    } else if (subdet_==HcalOuter) {
      process<HODigiCollection, HORecHitCollection>(e, eventSetup);
    } else if (subdet_==HcalOther && subdetOther_==HcalCalibration) {
      process<HcalCalibDigiCollection, HcalCalibRecHitCollection>(e, eventSetup);
    }
  } 
}

Member Data Documentation

Definition at line 32 of file HcalSimpleReconstructor.h.

Referenced by produce().

Definition at line 37 of file HcalSimpleReconstructor.h.

Referenced by process().

Definition at line 41 of file HcalSimpleReconstructor.h.

Referenced by process().

Definition at line 35 of file HcalSimpleReconstructor.h.

Referenced by process().

Definition at line 45 of file HcalSimpleReconstructor.h.

Referenced by beginRun(), endRun(), and process().

Definition at line 31 of file HcalSimpleReconstructor.h.

Referenced by beginRun(), endRun(), process(), and produce().

Definition at line 42 of file HcalSimpleReconstructor.h.

Referenced by process().

Definition at line 33 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

Definition at line 34 of file HcalSimpleReconstructor.h.

Referenced by produce().

Definition at line 43 of file HcalSimpleReconstructor.h.

Referenced by beginRun(), endRun(), and process().