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::stream::EDProducer<> edm::stream::EDProducerBase 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::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

DetId::Detector det_
 
bool doSaturationCorr_
 
int firstSample_
 
int maxADCvalue_
 
CastorSimpleRecAlgo reco_
 
int samplesToAdd_
 
bool setSaturationFlag_
 
int subdet_
 
edm::EDGetTokenT
< CastorDigiCollection
tok_input_
 
bool tsFromDB_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 14 of file CastorSimpleReconstructor.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file CastorSimpleReconstructor.cc.

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

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

Definition at line 50 of file CastorSimpleReconstructor.cc.

50  {
51 }

Member Function Documentation

void CastorSimpleReconstructor::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 53 of file CastorSimpleReconstructor.cc.

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

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

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.

int CastorSimpleReconstructor::maxADCvalue_
private

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

Referenced by produce().

int CastorSimpleReconstructor::subdet_
private

Definition at line 22 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

edm::EDGetTokenT<CastorDigiCollection> CastorSimpleReconstructor::tok_input_
private

Definition at line 24 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

bool CastorSimpleReconstructor::tsFromDB_
private

Definition at line 29 of file CastorSimpleReconstructor.h.

Referenced by produce().