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::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Member Functions

template<class DIGICOLL , class RECHITCOLL >
void process (edm::Event &e, const edm::EventSetup &c)
void processUpgrade (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_
HcalTopologytheTopology
bool tsFromDB_
bool upgradeHBHE_
bool upgradeHF_

Detailed Description

Date:
2013/04/26 15:50:15
Revision:
1.10
Author:
J. Mans - Minnesota
Date:
2013/02/28 08:28:56
Revision:
1.4
Author:
E. Garcia - CSU Based on HcalSimpleReconstructor.h by J. Mans

Definition at line 24 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, AlCaHLTBitMon_QueryRunRegistry::string, subdet_, upgradeHBHE_, and upgradeHF_.

                                                                           :
  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")),
  upgradeHBHE_(false),
  upgradeHF_(false),
  paramTS(0),
  theTopology(0)
{

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

Definition at line 62 of file HcalSimpleReconstructor.cc.

References paramTS, and theTopology.

                                                  { 
  delete paramTS;
  delete theTopology;
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 82 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 92 of file HcalSimpleReconstructor.cc.

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

{
  // get conditions
  edm::ESHandle<HcalDbService> conditions;
  eventSetup.get<HcalDbRecord>().get(conditions);

  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);
    const HcalQIEShape* shape = conditions->getHcalShape (channelCoder); 
    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::processUpgrade ( edm::Event e,
const edm::EventSetup c 
) [private]

Definition at line 133 of file HcalSimpleReconstructor.cc.

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

Referenced by produce().

{
  // get conditions
  edm::ESHandle<HcalDbService> conditions;
  eventSetup.get<HcalDbRecord>().get(conditions);

  if(upgradeHBHE_){
   
    edm::Handle<HBHEUpgradeDigiCollection> digi;
    e.getByLabel(inputLabel_, digi);

    // create empty output
    std::auto_ptr<HBHERecHitCollection> rec(new HBHERecHitCollection);
    rec->reserve(digi->size()); 

    // run the algorithm
    int first = firstSample_;
    int toadd = samplesToAdd_;
    HBHEUpgradeDigiCollection::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);
      const HcalQIEShape* shape = conditions->getHcalShape (channelCoder); 
      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_.reconstructHBHEUpgrade(*i,first,toadd,coder,calibrations));

    }

    e.put(rec); // put results
  }// End of upgradeHBHE

  if(upgradeHF_){

    edm::Handle<HFUpgradeDigiCollection> digi;
    e.getByLabel(inputLabel_, digi);

    // create empty output
    std::auto_ptr<HFRecHitCollection> rec(new HFRecHitCollection);
    rec->reserve(digi->size()); 

    // run the algorithm
    int first = firstSample_;
    int toadd = samplesToAdd_;
    HFUpgradeDigiCollection::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);
      const HcalQIEShape* shape = conditions->getHcalShape (channelCoder); 
      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_.reconstructHFUpgrade(*i,first,toadd,coder,calibrations));

    }  
    e.put(rec); // put results
  }// End of upgradeHF

}
void HcalSimpleReconstructor::produce ( edm::Event e,
const edm::EventSetup c 
) [override, virtual]

Implements edm::EDProducer.

Definition at line 218 of file HcalSimpleReconstructor.cc.

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

{
  // HACK related to HB- corrections
  if(e.isRealData()) reco_.setForData();
 
  // What to produce, better to avoid the same subdet Upgrade and regular 
  // rechits "clashes"
  if(upgradeHBHE_ || upgradeHF_) {
      processUpgrade(e, eventSetup);
  } else if (det_==DetId::Hcal) {
    if ((subdet_==HcalBarrel || subdet_==HcalEndcap) && !upgradeHBHE_) {
      process<HBHEDigiCollection, HBHERecHitCollection>(e, eventSetup);
    } else if (subdet_==HcalForward && !upgradeHF_) {
      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 35 of file HcalSimpleReconstructor.h.

Referenced by produce().

Definition at line 40 of file HcalSimpleReconstructor.h.

Referenced by process(), and processUpgrade().

Definition at line 44 of file HcalSimpleReconstructor.h.

Referenced by process(), and processUpgrade().

Definition at line 38 of file HcalSimpleReconstructor.h.

Referenced by process(), and processUpgrade().

Definition at line 34 of file HcalSimpleReconstructor.h.

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

Definition at line 45 of file HcalSimpleReconstructor.h.

Referenced by process(), and processUpgrade().

Definition at line 36 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), and produce().

Definition at line 37 of file HcalSimpleReconstructor.h.

Referenced by produce().

Definition at line 51 of file HcalSimpleReconstructor.h.

Referenced by beginRun(), and ~HcalSimpleReconstructor().

Definition at line 46 of file HcalSimpleReconstructor.h.

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

Definition at line 47 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), processUpgrade(), and produce().

Definition at line 48 of file HcalSimpleReconstructor.h.

Referenced by HcalSimpleReconstructor(), processUpgrade(), and produce().