CMS 3D CMS Logo

Public Member Functions | Private Attributes

ZdcHitReconstructor Class Reference

#include <ZdcHitReconstructor.h>

Inheritance diagram for ZdcHitReconstructor:
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)
 ZdcHitReconstructor (const edm::ParameterSet &ps)
virtual ~ZdcHitReconstructor ()

Private Attributes

std::vector< int > AuxTSvec_
bool correctTiming_
DetId::Detector det_
bool dropZSmarkedPassed_
HBHEStatusBitSetterhbheFlagSetter_
HBHETimeProfileStatusBitSetterhbheHSCPFlagSetter_
HBHETimingShapedFlagSetterhbheTimingShapedFlagSetter_
HcalHFStatusBitFromDigishfdigibit_
HcalHFStatusBitFromRecHitshfrechitbit_
HFTimingTrustFlagHFTimingTrustFlagSetter_
edm::InputTag inputLabel_
double lowGainFrac_
int lowGainOffset_
HcalLongRecoParamsmyobject
ZdcSimpleRecAlgo reco_
HcalADCSaturationFlagsaturationFlagSetter_
bool setHSCPFlags_
bool setNoiseFlags_
bool setSaturationFlags_
bool setTimingTrustFlags_
int subdet_
HcalOtherSubdetector subdetOther_

Detailed Description

Date:
2011/11/10 10:16:20
Revision:
1.5
Author:
E. Garcia - CSU Based on HcalSimpleReconstructor.h by J. Mans

Definition at line 33 of file ZdcHitReconstructor.h.


Constructor & Destructor Documentation

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

Definition at line 20 of file ZdcHitReconstructor.cc.

References AuxTSvec_, DetId::Calo, gather_cfg::cout, det_, edm::ParameterSet::getParameter(), HcalCalibration, HcalOther, saturationFlagSetter_, setSaturationFlags_, python::multivaluedict::sort(), 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")),
  correctTiming_(conf.getParameter<bool>("correctTiming")),
  setNoiseFlags_(conf.getParameter<bool>("setNoiseFlags")),
  setHSCPFlags_(conf.getParameter<bool>("setHSCPFlags")),
  setSaturationFlags_(conf.getParameter<bool>("setSaturationFlags")),
  setTimingTrustFlags_(conf.getParameter<bool>("setTimingTrustFlags")),
  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
  AuxTSvec_(conf.getParameter<std::vector<int> >("AuxTSvec"))
  
{ 
  std::sort(AuxTSvec_.begin(),AuxTSvec_.end()); // sort vector in ascending TS order
  std::string subd=conf.getParameter<std::string>("Subdetector");
 
 if (setSaturationFlags_)
    {
      const edm::ParameterSet& pssat      = conf.getParameter<edm::ParameterSet>("saturationParameters");
      saturationFlagSetter_ = new HcalADCSaturationFlag(pssat.getParameter<int>("maxADCvalue"));
    }
  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 << "ZdcHitReconstructor is not associated with a specific subdetector!" << std::endl;
  }       
  
}
ZdcHitReconstructor::~ZdcHitReconstructor ( ) [virtual]

Definition at line 60 of file ZdcHitReconstructor.cc.

                                          {;
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 69 of file ZdcHitReconstructor.cc.

References myobject.

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

Implements edm::EDProducer.

Definition at line 72 of file ZdcHitReconstructor.cc.

References AuxTSvec_, DetId::Calo, det_, HcalSeverityLevelComputer::dropChannel(), dropZSmarkedPassed_, edm::EventSetup::get(), edm::Event::getByLabel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), i, inputLabel_, myobject, HcalLongRecoParam::noiseTS(), AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), edm::Event::put(), DetId::rawId(), reco_, ZdcSimpleRecAlgo::reconstruct(), saturationFlagSetter_, HcalADCSaturationFlag::setSaturationFlag(), setSaturationFlags_, 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
  
  edm::ESHandle<HcalChannelQuality> p;
  eventSetup.get<HcalChannelQualityRcd>().get(p);
  HcalChannelQuality* myqual = new HcalChannelQuality(*p.product());

  edm::ESHandle<HcalSeverityLevelComputer> mycomputer;
  eventSetup.get<HcalSeverityLevelComputerRcd>().get(mycomputer);
  const HcalSeverityLevelComputer* mySeverity = mycomputer.product();
  
  // 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
     ZDCDigiCollection::const_iterator i;
     for (i=digi->begin(); i!=digi->end(); i++) {
       HcalZDCDetId cell = i->id();
      DetId detcell=(DetId)cell;
      // check on cells to be ignored and dropped: (rof,20.Feb.09)
      const HcalChannelStatus* mydigistatus=myqual->getValues(detcell.rawId());
      if (mySeverity->dropChannel(mydigistatus->getValue() ) ) continue;
        if (dropZSmarkedPassed_)
          if (i->zsMarkAndPass()) continue;
        const HcalCalibrations& calibrations=conditions->getHcalCalibrations(cell);
        const HcalQIECoder* channelCoder = conditions->getHcalCoder (cell);
        HcalCoderDb coder (*channelCoder, *shape);

// get db values for signalTSs and noiseTSs
   const HcalLongRecoParam* myParams = myobject->getValues(detcell);
   mySignalTS.clear();
   myNoiseTS.clear();
   mySignalTS = myParams->signalTS();
   myNoiseTS = myParams->noiseTS(); 

        rec->push_back(reco_.reconstruct(*i,myNoiseTS,mySignalTS,coder,calibrations));
        (rec->back()).setFlags(0);
        if (setSaturationFlags_)
          saturationFlagSetter_->setSaturationFlag(rec->back(),*i);     

        // Set auxiliary flag with subset of digi information
        // ZDC aux flag can store non-contiguous set of values
        int auxflag=0;
        for (unsigned int xx=0; xx<AuxTSvec_.size() && xx<4;++xx)
          {
            if (AuxTSvec_[xx]<0 || AuxTSvec_[xx]>9) continue; // don't allow 
            auxflag+=(i->sample(AuxTSvec_[xx]).adc())<<(7*xx); // store the time slices in the first 28 bits of aux, a set of 4 7-bit a dc values
          }
        // bits 28 and 29 are reserved for capid of the first time slice saved in aux
        if (AuxTSvec_.size()>0)
          auxflag+=((i->sample(AuxTSvec_[0]).capid())<<28);
        (rec->back()).setAux(auxflag);
     }
     // return result
     e.put(rec);     
   } // else if (det_==DetId::Calo...)

   delete myqual;
} // void HcalHitReconstructor::produce(...)

Member Data Documentation

std::vector<int> ZdcHitReconstructor::AuxTSvec_ [private]

Definition at line 62 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

Definition at line 55 of file ZdcHitReconstructor.h.

Definition at line 50 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

Definition at line 61 of file ZdcHitReconstructor.h.

Referenced by produce().

Definition at line 44 of file ZdcHitReconstructor.h.

Definition at line 45 of file ZdcHitReconstructor.h.

Definition at line 46 of file ZdcHitReconstructor.h.

Definition at line 48 of file ZdcHitReconstructor.h.

Definition at line 47 of file ZdcHitReconstructor.h.

Definition at line 43 of file ZdcHitReconstructor.h.

Definition at line 53 of file ZdcHitReconstructor.h.

Referenced by produce().

Definition at line 65 of file ZdcHitReconstructor.h.

Definition at line 64 of file ZdcHitReconstructor.h.

Definition at line 67 of file ZdcHitReconstructor.h.

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

Definition at line 41 of file ZdcHitReconstructor.h.

Referenced by produce().

Definition at line 42 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

Definition at line 57 of file ZdcHitReconstructor.h.

Definition at line 56 of file ZdcHitReconstructor.h.

Definition at line 58 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

Definition at line 59 of file ZdcHitReconstructor.h.

Definition at line 51 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

Definition at line 52 of file ZdcHitReconstructor.h.

Referenced by ZdcHitReconstructor().