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

Public Member Functions

 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 &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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(), AlCaHLTBitMon_QueryRunRegistry::string, 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 maxADCvalue_(conf.getParameter<int>("maxADCvalue")),
34 tsFromDB_(conf.getParameter<bool>("tsFromDB")),
35 setSaturationFlag_(conf.getParameter<bool>("setSaturationFlag")),
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::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 52 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_.

53 {
54  // get conditions
56  eventSetup.get<CastorDbRecord>().get(conditions);
57  const CastorQIEShape* shape = conditions->getCastorShape (); // this one is generic
58 
59  CastorCalibrations calibrations;
60 
61  // try to get the TS windows from the db
63  if (tsFromDB_) {
64  eventSetup.get<CastorRecoParamsRcd>().get(recoparams);
65  if (!recoparams.isValid()) {
66  tsFromDB_ = false;
67  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;
68  }
69  }
70 
71  // try to get the saturation correction constants from the db
73  if (doSaturationCorr_) {
74  eventSetup.get<CastorSaturationCorrsRcd>().get(satcorr);
75  if (!satcorr.isValid()) {
76  doSaturationCorr_ = false;
77  edm::LogWarning("CastorSimpleReconstructor") << "Could not handle the CastorSaturationCorrsRcd correctly. We'll not try the saturation correction from this event onwards..." << std::endl;
78  }
79  }
80 
81 
84  e.getByLabel(inputLabel_,digi);
85 
86  // create empty output
87  std::auto_ptr<CastorRecHitCollection> rec(new CastorRecHitCollection);
88  // run the algorithm
90  for (i=digi->begin(); i!=digi->end(); i++) {
91  HcalCastorDetId cell = i->id();
92  DetId detcell=(DetId)cell;
93  const CastorCalibrations& calibrations=conditions->getCastorCalibrations(cell);
94 
95  if (tsFromDB_) {
96  const CastorRecoParam* param_ts = recoparams->getValues(detcell.rawId());
97  reco_.resetTimeSamples(param_ts->firstSample(),param_ts->samplesToAdd());
98  }
99  const CastorQIECoder* channelCoder = conditions->getCastorCoder (cell);
100  CastorCoderDb coder (*channelCoder, *shape);
101 
102  // reconstruct the rechit
103  rec->push_back(reco_.reconstruct(*i,coder,calibrations));
104 
105  // set the saturation flag if needed
106  if (setSaturationFlag_) {
107  reco_.checkADCSaturation(rec->back(),*i,maxADCvalue_);
108 
109  //++++ Saturation Correction +++++
110  if (doSaturationCorr_ && rec->back().flagField(HcalCaloFlagLabels::ADCSaturationBit)) {
111  // get saturation correction value
112  const CastorSaturationCorr* saturationCorr = satcorr->getValues(detcell.rawId());
113  double satCorrConst = 1.;
114  satCorrConst = saturationCorr->getValue();
115  reco_.recoverADCSaturation(rec->back(),coder,calibrations,*i,maxADCvalue_,satCorrConst);
116  }
117  }
118  }
119  // return result
120  e.put(rec);
121  }
122 }
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:94
unsigned int samplesToAdd() const
static const int SubdetectorId
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
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 20 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

bool CastorSimpleReconstructor::doSaturationCorr_
private

Definition at line 30 of file CastorSimpleReconstructor.h.

Referenced by produce().

int CastorSimpleReconstructor::firstSample_
private

Definition at line 25 of file CastorSimpleReconstructor.h.

edm::InputTag CastorSimpleReconstructor::inputLabel_
private

Definition at line 23 of file CastorSimpleReconstructor.h.

Referenced by produce().

int CastorSimpleReconstructor::maxADCvalue_
private

Definition at line 27 of file CastorSimpleReconstructor.h.

Referenced by produce().

CastorSimpleRecAlgo CastorSimpleReconstructor::reco_
private

Definition at line 19 of file CastorSimpleReconstructor.h.

Referenced by produce().

int CastorSimpleReconstructor::samplesToAdd_
private

Definition at line 26 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 21 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

bool CastorSimpleReconstructor::tsFromDB_
private

Definition at line 28 of file CastorSimpleReconstructor.h.

Referenced by produce().