CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CastorSimpleReconstructor Class Reference

#include <CastorSimpleReconstructor.h>

Inheritance diagram for CastorSimpleReconstructor:
edm::stream::EDProducer<>

Public Member Functions

 CastorSimpleReconstructor (const edm::ParameterSet &ps)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~CastorSimpleReconstructor () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

DetId::Detector det_
 
bool doSaturationCorr_
 
int firstSample_
 
int maxADCvalue_
 
CastorSimpleRecAlgo reco_
 
int samplesToAdd_
 
bool setSaturationFlag_
 
int subdet_
 
edm::ESGetToken< CastorDbService, CastorDbRecordtok_conditions_
 
edm::EDGetTokenT< CastorDigiCollectiontok_input_
 
edm::ESGetToken< CastorRecoParams, CastorRecoParamsRcdtok_recoParams_
 
edm::ESGetToken< CastorSaturationCorrs, CastorSaturationCorrsRcdtok_satCorr_
 
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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 21 of file CastorSimpleReconstructor.h.

Constructor & Destructor Documentation

◆ CastorSimpleReconstructor()

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

Definition at line 19 of file CastorSimpleReconstructor.cc.

20  : reco_(conf.getParameter<int>("firstSample"),
21  conf.getParameter<int>("samplesToAdd"),
22  conf.getParameter<bool>("correctForTimeslew"),
23  conf.getParameter<bool>("correctForPhaseContainment"),
24  conf.getParameter<double>("correctionPhaseNS")),
26  firstSample_(conf.getParameter<int>("firstSample")),
27  samplesToAdd_(conf.getParameter<int>("samplesToAdd")),
28  maxADCvalue_(conf.getParameter<int>("maxADCvalue")),
29  tsFromDB_(conf.getParameter<bool>("tsFromDB")),
30  setSaturationFlag_(conf.getParameter<bool>("setSaturationFlag")),
31  doSaturationCorr_(conf.getParameter<bool>("doSaturationCorr")) {
32  tok_input_ = consumes<CastorDigiCollection>(conf.getParameter<edm::InputTag>("digiLabel"));
33  tok_conditions_ = esConsumes<CastorDbService, CastorDbRecord>();
34 
35  std::string subd = conf.getParameter<std::string>("Subdetector");
36  if (!strcasecmp(subd.c_str(), "CASTOR")) {
37  det_ = DetId::Calo;
39  produces<CastorRecHitCollection>();
40  } else {
41  edm::LogWarning("CastorSimpleReconstructor")
42  << "CastorSimpleReconstructor is not associated with CASTOR subdetector!" << std::endl;
43  }
44  if (tsFromDB_) {
45  tok_recoParams_ = esConsumes<CastorRecoParams, CastorRecoParamsRcd>();
46  }
47  if (doSaturationCorr_) {
48  tok_satCorr_ = esConsumes<CastorSaturationCorrs, CastorSaturationCorrsRcd>();
49  }
50 }

References DetId::Calo, det_, doSaturationCorr_, edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, subdet_, HcalCastorDetId::SubdetectorId, tok_conditions_, tok_input_, tok_recoParams_, tok_satCorr_, and tsFromDB_.

◆ ~CastorSimpleReconstructor()

CastorSimpleReconstructor::~CastorSimpleReconstructor ( )
override

Definition at line 52 of file CastorSimpleReconstructor.cc.

52 {}

Member Function Documentation

◆ produce()

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

Definition at line 54 of file CastorSimpleReconstructor.cc.

54  {
55  // get conditions
57  const CastorQIEShape* shape = conditions->getCastorShape(); // this one is generic
58 
60 
61  // try to get the TS windows from the db
63  if (tsFromDB_) {
64  recoparams = eventSetup.getHandle(tok_recoParams_);
65  if (!recoparams.isValid()) {
66  tsFromDB_ = false;
67  edm::LogWarning("CastorSimpleReconstructor")
68  << "Could not handle the CastorRecoParamsRcd correctly, using parameters from cfg file from this event "
69  "onwards... These parameters could be wrong for this run... please check"
70  << std::endl;
71  }
72  }
73 
74  // try to get the saturation correction constants from the db
76  if (doSaturationCorr_) {
77  satcorr = eventSetup.getHandle(tok_satCorr_);
78  if (!satcorr.isValid()) {
79  doSaturationCorr_ = false;
80  edm::LogWarning("CastorSimpleReconstructor") << "Could not handle the CastorSaturationCorrsRcd correctly. We'll "
81  "not try the saturation correction from this event onwards..."
82  << std::endl;
83  }
84  }
85 
88  e.getByToken(tok_input_, digi);
89 
90  // create empty output
91  auto rec = std::make_unique<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(std::move(rec));
125  }
126 }

References HcalCaloFlagLabels::ADCSaturationBit, edm::SortedCollection< T, SORT >::begin(), AlignmentProducer_cff::calibrations, DetId::Calo, CastorSimpleRecAlgo::checkADCSaturation(), submitPVValidationJobs::conditions, det_, doSaturationCorr_, MillePedeFileConverter_cfg::e, edm::SortedCollection< T, SORT >::end(), CastorRecoParam::firstSample(), edm::EventSetup::getHandle(), CastorSaturationCorr::getValue(), CastorCondObjectContainer< Item >::getValues(), mps_fire::i, edm::ESHandleBase::isValid(), maxADCvalue_, eostools::move(), DetId::rawId(), reco_, CastorSimpleRecAlgo::reconstruct(), CastorSimpleRecAlgo::recoverADCSaturation(), CastorSimpleRecAlgo::resetTimeSamples(), CastorRecoParam::samplesToAdd(), setSaturationFlag_, subdet_, HcalCastorDetId::SubdetectorId, tok_conditions_, tok_input_, tok_recoParams_, tok_satCorr_, and tsFromDB_.

Member Data Documentation

◆ det_

DetId::Detector CastorSimpleReconstructor::det_
private

Definition at line 29 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

◆ doSaturationCorr_

bool CastorSimpleReconstructor::doSaturationCorr_
private

Definition at line 42 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

◆ firstSample_

int CastorSimpleReconstructor::firstSample_
private

Definition at line 37 of file CastorSimpleReconstructor.h.

◆ maxADCvalue_

int CastorSimpleReconstructor::maxADCvalue_
private

Definition at line 39 of file CastorSimpleReconstructor.h.

Referenced by produce().

◆ reco_

CastorSimpleRecAlgo CastorSimpleReconstructor::reco_
private

Definition at line 28 of file CastorSimpleReconstructor.h.

Referenced by produce().

◆ samplesToAdd_

int CastorSimpleReconstructor::samplesToAdd_
private

Definition at line 38 of file CastorSimpleReconstructor.h.

◆ setSaturationFlag_

bool CastorSimpleReconstructor::setSaturationFlag_
private

Definition at line 41 of file CastorSimpleReconstructor.h.

Referenced by produce().

◆ subdet_

int CastorSimpleReconstructor::subdet_
private

Definition at line 30 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

◆ tok_conditions_

edm::ESGetToken<CastorDbService, CastorDbRecord> CastorSimpleReconstructor::tok_conditions_
private

Definition at line 33 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

◆ tok_input_

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

Definition at line 32 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

◆ tok_recoParams_

edm::ESGetToken<CastorRecoParams, CastorRecoParamsRcd> CastorSimpleReconstructor::tok_recoParams_
private

Definition at line 34 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

◆ tok_satCorr_

edm::ESGetToken<CastorSaturationCorrs, CastorSaturationCorrsRcd> CastorSimpleReconstructor::tok_satCorr_
private

Definition at line 35 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

◆ tsFromDB_

bool CastorSimpleReconstructor::tsFromDB_
private

Definition at line 40 of file CastorSimpleReconstructor.h.

Referenced by CastorSimpleReconstructor(), and produce().

CastorCondObjectContainer::getValues
const Item * getValues(DetId fId, bool throwOnFail=true) const
Definition: CastorCondObjectContainer.h:65
mps_fire.i
i
Definition: mps_fire.py:428
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
CastorSaturationCorr::getValue
float getValue() const
Definition: CastorSaturationCorr.h:21
DetId::Hcal
Definition: DetId.h:28
CastorSimpleRecAlgo::reconstruct
CastorRecHit reconstruct(const CastorDataFrame &digi, const CastorCoder &coder, const CastorCalibrations &calibs) const
Definition: CastorSimpleRecAlgo.cc:163
AlignmentProducer_cff.calibrations
calibrations
Definition: AlignmentProducer_cff.py:59
HcalCastorDetId::SubdetectorId
static const int SubdetectorId
Definition: HcalCastorDetId.h:28
CastorCoderDb
Definition: CastorCoderDb.h:16
edm::Handle
Definition: AssociativeIterator.h:50
DetId::Calo
Definition: DetId.h:29
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
CastorRecoParam
Definition: CastorRecoParam.h:13
HcalCaloFlagLabels::ADCSaturationBit
Definition: HcalCaloFlagLabels.h:53
DetId
Definition: DetId.h:17
CastorCalibrations
Definition: CastorCalibrations.h:9
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
edm::ESHandle
Definition: DTSurvey.h:22
CastorSimpleReconstructor::tok_input_
edm::EDGetTokenT< CastorDigiCollection > tok_input_
Definition: CastorSimpleReconstructor.h:32
CastorSimpleReconstructor::maxADCvalue_
int maxADCvalue_
Definition: CastorSimpleReconstructor.h:39
CastorSimpleRecAlgo::recoverADCSaturation
void recoverADCSaturation(CastorRecHit &rechit, const CastorCoder &coder, const CastorCalibrations &calibs, const CastorDataFrame &digi, const int &maxADCvalue, const double &satCorrConst) const
Definition: CastorSimpleRecAlgo.cc:178
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalCastorDetId
Definition: HcalCastorDetId.h:23
CastorSimpleReconstructor::setSaturationFlag_
bool setSaturationFlag_
Definition: CastorSimpleReconstructor.h:41
CastorSimpleReconstructor::firstSample_
int firstSample_
Definition: CastorSimpleReconstructor.h:37
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
CastorSimpleReconstructor::tok_satCorr_
edm::ESGetToken< CastorSaturationCorrs, CastorSaturationCorrsRcd > tok_satCorr_
Definition: CastorSimpleReconstructor.h:35
CastorSimpleReconstructor::doSaturationCorr_
bool doSaturationCorr_
Definition: CastorSimpleReconstructor.h:42
CastorSimpleReconstructor::tsFromDB_
bool tsFromDB_
Definition: CastorSimpleReconstructor.h:40
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
CastorSimpleReconstructor::reco_
CastorSimpleRecAlgo reco_
Definition: CastorSimpleReconstructor.h:28
CastorSimpleRecAlgo::resetTimeSamples
void resetTimeSamples(int f, int t)
Definition: CastorSimpleRecAlgo.h:46
CastorSimpleReconstructor::tok_recoParams_
edm::ESGetToken< CastorRecoParams, CastorRecoParamsRcd > tok_recoParams_
Definition: CastorSimpleReconstructor.h:34
submitPVValidationJobs.conditions
list conditions
Definition: submitPVValidationJobs.py:674
eostools.move
def move(src, dest)
Definition: eostools.py:511
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
CastorSimpleReconstructor::tok_conditions_
edm::ESGetToken< CastorDbService, CastorDbRecord > tok_conditions_
Definition: CastorSimpleReconstructor.h:33
CastorSaturationCorr
Definition: CastorSaturationCorr.h:13
CastorQIECoder
Definition: CastorQIECoder.h:21
CastorRecoParam::firstSample
unsigned int firstSample() const
Definition: CastorRecoParam.h:22
CastorSimpleRecAlgo::checkADCSaturation
void checkADCSaturation(CastorRecHit &rechit, const CastorDataFrame &digi, const int &maxADCvalue) const
Definition: CastorSimpleRecAlgo.cc:170
CastorSimpleReconstructor::subdet_
int subdet_
Definition: CastorSimpleReconstructor.h:30
edm::InputTag
Definition: InputTag.h:15
CastorSimpleReconstructor::samplesToAdd_
int samplesToAdd_
Definition: CastorSimpleReconstructor.h:38
CastorQIEShape
Definition: CastorQIEShape.h:14
CastorSimpleReconstructor::det_
DetId::Detector det_
Definition: CastorSimpleReconstructor.h:29
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
CastorRecoParam::samplesToAdd
unsigned int samplesToAdd() const
Definition: CastorRecoParam.h:23