CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
CastorSimpleReconstructor Class Reference

#include <CastorSimpleReconstructor.h>

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

Public Member Functions

virtual void beginRun (edm::Run &r, edm::EventSetup const &es)
 
 CastorSimpleReconstructor (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~CastorSimpleReconstructor ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

DetId::Detector det_
 
bool doSaturationCorr_
 
int firstSample_
 
edm::InputTag inputLabel_
 
int maxADCvalue_
 
CastorSimpleRecAlgo reco_
 
int samplesToAdd_
 
bool setSaturationFlag_
 
int subdet_
 
bool tsFromDB_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 13 of file CastorSimpleReconstructor.h.

Constructor & Destructor Documentation

CastorSimpleReconstructor::CastorSimpleReconstructor ( const edm::ParameterSet ps)
explicit

Definition at line 26 of file CastorSimpleReconstructor.cc.

References DetId::Calo, det_, edm::ParameterSet::getParameter(), subdet_, and HcalCastorDetId::SubdetectorId.

26  :
27 reco_(conf.getParameter<int>("firstSample"),conf.getParameter<int>("samplesToAdd"),conf.getParameter<bool>("correctForTimeslew"),
28  conf.getParameter<bool>("correctForPhaseContainment"),conf.getParameter<double>("correctionPhaseNS")),
30 inputLabel_(conf.getParameter<edm::InputTag>("digiLabel")),
31 firstSample_(conf.getParameter<int>("firstSample")),
32 samplesToAdd_(conf.getParameter<int>("samplesToAdd")),
33 tsFromDB_(conf.getParameter<bool>("tsFromDB")),
34 setSaturationFlag_(conf.getParameter<bool>("setSaturationFlag")),
35 maxADCvalue_(conf.getParameter<int>("maxADCvalue")),
36 doSaturationCorr_(conf.getParameter<bool>("doSaturationCorr"))
37 {
38  std::string subd=conf.getParameter<std::string>("Subdetector");
39  if (!strcasecmp(subd.c_str(),"CASTOR")) {
42  produces<CastorRecHitCollection>();
43  } else {
44  edm::LogWarning("CastorSimpleReconstructor") << "CastorSimpleReconstructor is not associated with CASTOR subdetector!" << std::endl;
45  }
46 
47 }
static const int SubdetectorId
tuple conf
Definition: dbtoconf.py:185
CastorSimpleReconstructor::~CastorSimpleReconstructor ( )
virtual

Definition at line 49 of file CastorSimpleReconstructor.cc.

49  {
50 }

Member Function Documentation

void CastorSimpleReconstructor::beginRun ( edm::Run r,
edm::EventSetup const &  es 
)
virtual

Reimplemented from edm::EDProducer.

Definition at line 52 of file CastorSimpleReconstructor.cc.

52  {
53 
54 
55 }
void CastorSimpleReconstructor::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 56 of file CastorSimpleReconstructor.cc.

References HcalCaloFlagLabels::ADCSaturationBit, DetId::Calo, CastorSimpleRecAlgo::checkADCSaturation(), det_, doSaturationCorr_, CastorRecoParam::firstSample(), edm::EventSetup::get(), edm::Event::getByLabel(), CastorSaturationCorr::getValue(), i, inputLabel_, edm::ESHandleBase::isValid(), maxADCvalue_, edm::Event::put(), DetId::rawId(), reco_, CastorSimpleRecAlgo::reconstruct(), CastorSimpleRecAlgo::recoverADCSaturation(), CastorSimpleRecAlgo::resetTimeSamples(), CastorRecoParam::samplesToAdd(), setSaturationFlag_, subdet_, HcalCastorDetId::SubdetectorId, and tsFromDB_.

57 {
58  // get conditions
60  eventSetup.get<CastorDbRecord>().get(conditions);
61  const CastorQIEShape* shape = conditions->getCastorShape (); // this one is generic
62 
63  CastorCalibrations calibrations;
64 
65  // try to get the TS windows from the db
67  if (tsFromDB_) {
68  eventSetup.get<CastorRecoParamsRcd>().get(recoparams);
69  if (!recoparams.isValid()) {
70  tsFromDB_ = false;
71  edm::LogWarning("CastorSimpleReconstructor") << "Could not handle the CastorRecoParamsRcd correctly, using parameters from cfg file from this event onwards... These parameters could be wrong for this run... please check" << std::endl;
72  }
73  }
74 
75  // try to get the saturation correction constants from the db
77  if (doSaturationCorr_) {
78  eventSetup.get<CastorSaturationCorrsRcd>().get(satcorr);
79  if (!satcorr.isValid()) {
80  doSaturationCorr_ = false;
81  edm::LogWarning("CastorSimpleReconstructor") << "Could not handle the CastorSaturationCorrsRcd correctly. We'll not try the saturation correction from this event onwards..." << std::endl;
82  }
83  }
84 
85 
88  e.getByLabel(inputLabel_,digi);
89 
90  // create empty output
91  std::auto_ptr<CastorRecHitCollection> rec(new CastorRecHitCollection);
92  // run the algorithm
94  for (i=digi->begin(); i!=digi->end(); i++) {
95  HcalCastorDetId cell = i->id();
96  DetId detcell=(DetId)cell;
97  const CastorCalibrations& calibrations=conditions->getCastorCalibrations(cell);
98 
99  if (tsFromDB_) {
100  const CastorRecoParam* param_ts = recoparams->getValues(detcell.rawId());
101  reco_.resetTimeSamples(param_ts->firstSample(),param_ts->samplesToAdd());
102  }
103  const CastorQIECoder* channelCoder = conditions->getCastorCoder (cell);
104  CastorCoderDb coder (*channelCoder, *shape);
105 
106  // reconstruct the rechit
107  rec->push_back(reco_.reconstruct(*i,coder,calibrations));
108 
109  // set the saturation flag if needed
110  if (setSaturationFlag_) {
111  reco_.checkADCSaturation(rec->back(),*i,maxADCvalue_);
112 
113  //++++ Saturation Correction +++++
114  if (doSaturationCorr_ && rec->back().flagField(HcalCaloFlagLabels::ADCSaturationBit)) {
115  // get saturation correction value
116  const CastorSaturationCorr* saturationCorr = satcorr->getValues(detcell.rawId());
117  double satCorrConst = 1.;
118  satCorrConst = saturationCorr->getValue();
119  reco_.recoverADCSaturation(rec->back(),coder,calibrations,*i,maxADCvalue_,satCorrConst);
120  }
121  }
122  }
123  // return result
124  e.put(rec);
125  }
126 }
int i
Definition: DBlmapReader.cc:9
void resetTimeSamples(int f, int t)
std::vector< T >::const_iterator const_iterator
CastorRecHit reconstruct(const CastorDataFrame &digi, const CastorCoder &coder, const CastorCalibrations &calibs) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
unsigned int samplesToAdd() const
static const int SubdetectorId
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
Definition: DetId.h:20
unsigned int firstSample() const
void recoverADCSaturation(CastorRecHit &rechit, const CastorCoder &coder, const CastorCalibrations &calibs, const CastorDataFrame &digi, const int &maxADCvalue, const double &satCorrConst) const
void checkADCSaturation(CastorRecHit &rechit, const CastorDataFrame &digi, const int &maxADCvalue) const
bool isValid() const
Definition: ESHandle.h:37

Member Data Documentation

DetId::Detector CastorSimpleReconstructor::det_
private

Definition at line 21 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

bool CastorSimpleReconstructor::doSaturationCorr_
private

Definition at line 31 of file CastorSimpleReconstructor.h.

Referenced by produce().

int CastorSimpleReconstructor::firstSample_
private

Definition at line 26 of file CastorSimpleReconstructor.h.

edm::InputTag CastorSimpleReconstructor::inputLabel_
private

Definition at line 24 of file CastorSimpleReconstructor.h.

Referenced by produce().

int CastorSimpleReconstructor::maxADCvalue_
private

Definition at line 30 of file CastorSimpleReconstructor.h.

Referenced by produce().

CastorSimpleRecAlgo CastorSimpleReconstructor::reco_
private

Definition at line 20 of file CastorSimpleReconstructor.h.

Referenced by produce().

int CastorSimpleReconstructor::samplesToAdd_
private

Definition at line 27 of file CastorSimpleReconstructor.h.

bool CastorSimpleReconstructor::setSaturationFlag_
private

Definition at line 29 of file CastorSimpleReconstructor.h.

Referenced by produce().

int CastorSimpleReconstructor::subdet_
private

Definition at line 22 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

bool CastorSimpleReconstructor::tsFromDB_
private

Definition at line 28 of file CastorSimpleReconstructor.h.

Referenced by produce().