CMS 3D CMS Logo

Public Member Functions | Private Attributes

ZdcSimpleReconstructor Class Reference

#include <ZdcSimpleReconstructor.h>

Inheritance diagram for ZdcSimpleReconstructor:
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)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 ZdcSimpleReconstructor (const edm::ParameterSet &ps)
virtual ~ZdcSimpleReconstructor ()

Private Attributes

DetId::Detector det_
bool dropZSmarkedPassed_
edm::InputTag inputLabel_
HcalLongRecoParamsmyobject
ZdcSimpleRecAlgo reco_
int subdet_
HcalOtherSubdetector subdetOther_

Detailed Description

Definition at line 21 of file ZdcSimpleReconstructor.h.


Constructor & Destructor Documentation

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

Definition at line 17 of file ZdcSimpleReconstructor.cc.

References DetId::Calo, gather_cfg::cout, det_, edm::ParameterSet::getParameter(), HcalCalibration, HcalOther, subdet_, HcalZDCDetId::SubdetectorId, and subdetOther_.

                                                                         :
  reco_(conf.getParameter<bool>("correctForTimeslew"),
        conf.getParameter<bool>("correctForPhaseContainment"),conf.getParameter<double>("correctionPhaseNS"),
        conf.getParameter<int>("recoMethod"),
        conf.getParameter<int>("lowGainOffset"),
        conf.getParameter<double>("lowGainFrac")),
  det_(DetId::Hcal),
  inputLabel_(conf.getParameter<edm::InputTag>("digiLabel")),
  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed"))
{
  std::string subd=conf.getParameter<std::string>("Subdetector");
  if (!strcasecmp(subd.c_str(),"ZDC")) {
    det_=DetId::Calo;
    subdet_=HcalZDCDetId::SubdetectorId;
    produces<ZDCRecHitCollection>();
  } else if (!strcasecmp(subd.c_str(),"CALIB")) {
    subdet_=HcalOther;
    subdetOther_=HcalCalibration;
    produces<HcalCalibRecHitCollection>();
  } else {
    std::cout << "ZdcSimpleReconstructor is not associated with a specific subdetector!" << std::endl;
  }       
  
}
ZdcSimpleReconstructor::~ZdcSimpleReconstructor ( ) [virtual]

Definition at line 42 of file ZdcSimpleReconstructor.cc.

                                                {
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 51 of file ZdcSimpleReconstructor.cc.

References myobject.

                                                                     {
  if (myobject) delete myobject;
}
void ZdcSimpleReconstructor::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 54 of file ZdcSimpleReconstructor.cc.

References DetId::Calo, det_, dropZSmarkedPassed_, edm::EventSetup::get(), edm::Event::getByLabel(), HcalCondObjectContainer< Item >::getValues(), i, ZdcSimpleRecAlgo::initPulseCorr(), inputLabel_, myobject, HcalLongRecoParam::noiseTS(), edm::Event::put(), reco_, ZdcSimpleRecAlgo::reconstruct(), HcalLongRecoParam::signalTS(), subdet_, and HcalZDCDetId::SubdetectorId.

{
  // get conditions
  edm::ESHandle<HcalDbService> conditions;
  eventSetup.get<HcalDbRecord>().get(conditions);
  const HcalQIEShape* shape = conditions->getHcalShape (); // this one is generic
  // define vectors to pass noiseTS and signalTS
  std::vector<unsigned int> mySignalTS;
  std::vector<unsigned int> myNoiseTS;
  
  if (det_==DetId::Calo && subdet_==HcalZDCDetId::SubdetectorId) {
    edm::Handle<ZDCDigiCollection> digi;
    e.getByLabel(inputLabel_,digi);
    
    // create empty output
    std::auto_ptr<ZDCRecHitCollection> rec(new ZDCRecHitCollection);
    rec->reserve(digi->size());
    // run the algorithm
    unsigned int toaddMem = 0;
    
    ZDCDigiCollection::const_iterator i;
    for (i=digi->begin(); i!=digi->end(); i++) {
      HcalZDCDetId cell = i->id();        
      DetId detcell=(DetId)cell;
        // rof 27.03.09: drop ZS marked and passed digis:
        if (dropZSmarkedPassed_)
          if (i->zsMarkAndPass()) continue;

// get db values for signalTSs and noiseTSs
      const HcalLongRecoParam* myParams = myobject->getValues(detcell);
      mySignalTS.clear();
      myNoiseTS.clear();
      mySignalTS = myParams->signalTS();
      myNoiseTS = myParams->noiseTS(); 
// warning: the PulseCorrection is not used by ZDC. If it gets a non-contingious set of 
// signal TS, it may not work properly. Assume contiguous here....
        unsigned int toadd = mySignalTS.size();    
        if(toaddMem != toadd) {
          reco_.initPulseCorr(toadd);
          toaddMem = toadd;
        }   
      const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
      const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
      HcalCoderDb coder (*channelCoder, *shape);
      rec->push_back(reco_.reconstruct(*i,myNoiseTS,mySignalTS,coder,calibrations));
    }
    // return result
    e.put(rec);     
  }
}

Member Data Documentation

Definition at line 30 of file ZdcSimpleReconstructor.h.

Referenced by produce(), and ZdcSimpleReconstructor().

Definition at line 35 of file ZdcSimpleReconstructor.h.

Referenced by produce().

Definition at line 33 of file ZdcSimpleReconstructor.h.

Referenced by produce().

Definition at line 37 of file ZdcSimpleReconstructor.h.

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

Definition at line 29 of file ZdcSimpleReconstructor.h.

Referenced by produce().

Definition at line 31 of file ZdcSimpleReconstructor.h.

Referenced by produce(), and ZdcSimpleReconstructor().

Definition at line 32 of file ZdcSimpleReconstructor.h.

Referenced by ZdcSimpleReconstructor().