CMS 3D CMS Logo

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

#include <ZdcHitReconstructor.h>

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

Public Member Functions

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

Private Attributes

std::vector< int > AuxTSvec_
 
edm::ESGetToken< HcalDbService,
HcalDbRecord
conditionsToken_
 
bool correctTiming_
 
DetId::Detector det_
 
bool dropZSmarkedPassed_
 
edm::ESGetToken< HcalTopology,
HcalRecNumberingRecord
htopoToken_
 
std::unique_ptr
< HcalLongRecoParams
longRecoParams_
 
double lowGainFrac_
 
int lowGainOffset_
 
edm::ESGetToken
< HcalLongRecoParams,
HcalLongRecoParamsRcd
paramsToken_
 
edm::ESGetToken
< HcalChannelQuality,
HcalChannelQualityRcd
qualToken_
 
ZdcSimpleRecAlgo reco_
 
HcalADCSaturationFlagsaturationFlagSetter_
 
bool setHSCPFlags_
 
bool setNoiseFlags_
 
bool setSaturationFlags_
 
bool setTimingTrustFlags_
 
edm::ESGetToken
< HcalSeverityLevelComputer,
HcalSeverityLevelComputerRcd
sevToken_
 
int subdet_
 
HcalOtherSubdetector subdetOther_
 
edm::EDGetTokenT
< ZDCDigiCollection
tok_input_castor
 
edm::EDGetTokenT
< ZDCDigiCollection
tok_input_hcal
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Author
E. Garcia - CSU Based on HcalSimpleReconstructor.h by J. Mans

Definition at line 46 of file ZdcHitReconstructor.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file ZdcHitReconstructor.cc.

References AuxTSvec_, DetId::Calo, conditionsToken_, gather_cfg::cout, det_, edm::ParameterSet::getParameter(), HcalCalibration, HcalOther, htopoToken_, paramsToken_, qualToken_, saturationFlagSetter_, setSaturationFlags_, sevToken_, AlCaHLTBitMon_QueryRunRegistry::string, subdet_, HcalZDCDetId::SubdetectorId, subdetOther_, tok_input_castor, and tok_input_hcal.

18  : reco_(conf.getParameter<bool>("correctForTimeslew"),
19  conf.getParameter<bool>("correctForPhaseContainment"),
20  conf.getParameter<double>("correctionPhaseNS"),
21  conf.getParameter<int>("recoMethod"),
22  conf.getParameter<int>("lowGainOffset"),
23  conf.getParameter<double>("lowGainFrac")),
24  saturationFlagSetter_(nullptr),
26  correctTiming_(conf.getParameter<bool>("correctTiming")),
27  setNoiseFlags_(conf.getParameter<bool>("setNoiseFlags")),
28  setHSCPFlags_(conf.getParameter<bool>("setHSCPFlags")),
29  setSaturationFlags_(conf.getParameter<bool>("setSaturationFlags")),
30  setTimingTrustFlags_(conf.getParameter<bool>("setTimingTrustFlags")),
31  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
32  AuxTSvec_(conf.getParameter<std::vector<int> >("AuxTSvec")) {
33  tok_input_hcal = consumes<ZDCDigiCollection>(conf.getParameter<edm::InputTag>("digiLabelhcal"));
34  tok_input_castor = consumes<ZDCDigiCollection>(conf.getParameter<edm::InputTag>("digiLabelcastor"));
35 
36  std::sort(AuxTSvec_.begin(), AuxTSvec_.end()); // sort vector in ascending TS order
37  std::string subd = conf.getParameter<std::string>("Subdetector");
38 
39  if (setSaturationFlags_) {
40  const edm::ParameterSet& pssat = conf.getParameter<edm::ParameterSet>("saturationParameters");
41  saturationFlagSetter_ = new HcalADCSaturationFlag(pssat.getParameter<int>("maxADCvalue"));
42  }
43  if (!strcasecmp(subd.c_str(), "ZDC")) {
44  det_ = DetId::Calo;
46  produces<ZDCRecHitCollection>();
47  } else if (!strcasecmp(subd.c_str(), "CALIB")) {
50  produces<HcalCalibRecHitCollection>();
51  } else {
52  std::cout << "ZdcHitReconstructor is not associated with a specific subdetector!" << std::endl;
53  }
54 
55  // ES tokens
56  htopoToken_ = esConsumes<HcalTopology, HcalRecNumberingRecord, edm::Transition::BeginRun>();
57  paramsToken_ = esConsumes<HcalLongRecoParams, HcalLongRecoParamsRcd, edm::Transition::BeginRun>();
58  conditionsToken_ = esConsumes<HcalDbService, HcalDbRecord>();
59  qualToken_ = esConsumes<HcalChannelQuality, HcalChannelQualityRcd>(edm::ESInputTag("", "withTopo"));
60  sevToken_ = esConsumes<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd>();
61 }
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > sevToken_
edm::ESGetToken< HcalLongRecoParams, HcalLongRecoParamsRcd > paramsToken_
edm::EDGetTokenT< ZDCDigiCollection > tok_input_hcal
ZdcSimpleRecAlgo reco_
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > qualToken_
HcalOtherSubdetector subdetOther_
HcalADCSaturationFlag * saturationFlagSetter_
edm::EDGetTokenT< ZDCDigiCollection > tok_input_castor
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< int > AuxTSvec_
tuple cout
Definition: gather_cfg.py:144
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_
ZdcHitReconstructor::~ZdcHitReconstructor ( )
override

Definition at line 63 of file ZdcHitReconstructor.cc.

References saturationFlagSetter_.

63 { delete saturationFlagSetter_; }
HcalADCSaturationFlag * saturationFlagSetter_

Member Function Documentation

void ZdcHitReconstructor::beginRun ( edm::Run const &  r,
edm::EventSetup const &  es 
)
final

Definition at line 65 of file ZdcHitReconstructor.cc.

References edm::EventSetup::getData(), htopoToken_, longRecoParams_, AlCaHLTBitMon_ParallelJobs::p, and paramsToken_.

65  {
66  const HcalTopology& htopo = es.getData(htopoToken_);
67  const HcalLongRecoParams& p = es.getData(paramsToken_);
68  longRecoParams_ = std::make_unique<HcalLongRecoParams>(p);
69  longRecoParams_->setTopo(&htopo);
70 }
edm::ESGetToken< HcalLongRecoParams, HcalLongRecoParamsRcd > paramsToken_
std::unique_ptr< HcalLongRecoParams > longRecoParams_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_
void ZdcHitReconstructor::endRun ( edm::Run const &  r,
edm::EventSetup const &  es 
)
final

Definition at line 72 of file ZdcHitReconstructor.cc.

72 {}
void ZdcHitReconstructor::produce ( edm::Event e,
const edm::EventSetup c 
)
final

Definition at line 74 of file ZdcHitReconstructor.cc.

References AuxTSvec_, DetId::Calo, submitPVValidationJobs::conditions, conditionsToken_, det_, HcalSeverityLevelComputer::dropChannel(), dropZSmarkedPassed_, edm::Event::getByToken(), edm::EventSetup::getData(), HcalDbService::getHcalCalibrations(), HcalDbService::getHcalCoder(), HcalDbService::getHcalShape(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), mps_fire::i, edm::HandleBase::isValid(), longRecoParams_, eostools::move(), HcalLongRecoParam::noiseTS(), edm::Event::put(), qualToken_, DetId::rawId(), reco_, ZdcSimpleRecAlgo::reconstruct(), saturationFlagSetter_, HcalADCSaturationFlag::setSaturationFlag(), setSaturationFlags_, sevToken_, HcalLongRecoParam::signalTS(), subdet_, HcalZDCDetId::SubdetectorId, tok_input_castor, and tok_input_hcal.

74  {
75  // get conditions
76  const HcalDbService* conditions = &eventSetup.getData(conditionsToken_);
77  const HcalChannelQuality* myqual = &eventSetup.getData(qualToken_);
78  const HcalSeverityLevelComputer* mySeverity = &eventSetup.getData(sevToken_);
79 
80  // define vectors to pass noiseTS and signalTS
81  std::vector<unsigned int> mySignalTS;
82  std::vector<unsigned int> myNoiseTS;
83 
86  e.getByToken(tok_input_hcal, digi);
87 
88  if (digi->empty()) {
90  e.getByToken(tok_input_castor, digi_castor);
91  if (!digi_castor.isValid() || digi_castor->empty())
92  edm::LogInfo("ZdcHitReconstructor") << "No ZDC info found in either castorDigis or hcalDigis." << std::endl;
93  if (digi_castor.isValid())
95  }
96 
97  // create empty output
98  auto rec = std::make_unique<ZDCRecHitCollection>();
99  rec->reserve(digi->size());
100  // run the algorithm
102  for (i = digi->begin(); i != digi->end(); i++) {
103  HcalZDCDetId cell = i->id();
104  DetId detcell = (DetId)cell;
105  // check on cells to be ignored and dropped: (rof,20.Feb.09)
106  const HcalChannelStatus* mydigistatus = myqual->getValues(detcell.rawId());
107  if (mySeverity->dropChannel(mydigistatus->getValue()))
108  continue;
110  if (i->zsMarkAndPass())
111  continue;
112  const HcalCalibrations& calibrations = conditions->getHcalCalibrations(cell);
113  const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
114  const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
115  HcalCoderDb coder(*channelCoder, *shape);
116 
117  // get db values for signalTSs and noiseTSs
118  const HcalLongRecoParam* myParams = longRecoParams_->getValues(detcell);
119  mySignalTS.clear();
120  myNoiseTS.clear();
121  mySignalTS = myParams->signalTS();
122  myNoiseTS = myParams->noiseTS();
123 
124  rec->push_back(reco_.reconstruct(*i, myNoiseTS, mySignalTS, coder, calibrations));
125  (rec->back()).setFlags(0);
127  saturationFlagSetter_->setSaturationFlag(rec->back(), *i);
128 
129  // Set auxiliary flag with subset of digi information
130  // ZDC aux flag can store non-contiguous set of values
131  int auxflag = 0;
132  for (unsigned int xx = 0; xx < AuxTSvec_.size() && xx < 4; ++xx) {
133  if (AuxTSvec_[xx] < 0 || AuxTSvec_[xx] > 9)
134  continue; // don't allow
135  auxflag += (i->sample(AuxTSvec_[xx]).adc())
136  << (7 * xx); // store the time slices in the first 28 bits of aux, a set of 4 7-bit a dc values
137  }
138  // bits 28 and 29 are reserved for capid of the first time slice saved in aux
139  if (!AuxTSvec_.empty())
140  auxflag += ((i->sample(AuxTSvec_[0]).capid()) << 28);
141  (rec->back()).setAux(auxflag);
142  }
143  // return result
144  e.put(std::move(rec));
145  } // else if (det_==DetId::Calo...)
146 
147 } // void HcalHitReconstructor::produce(...)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< unsigned int > signalTS() const
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > sevToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< T >::const_iterator const_iterator
const Item * getValues(DetId fId, bool throwOnFail=true) const
edm::EDGetTokenT< ZDCDigiCollection > tok_input_hcal
ZDCRecHit reconstruct(const ZDCDataFrame &digi, const std::vector< unsigned int > &myNoiseTS, const std::vector< unsigned int > &mySignalTS, const HcalCoder &coder, const HcalCalibrations &calibs) const
std::unique_ptr< HcalLongRecoParams > longRecoParams_
ZdcSimpleRecAlgo reco_
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > qualToken_
def move
Definition: eostools.py:511
bool dropChannel(const uint32_t &mystatus) const
void setSaturationFlag(HBHERecHit &rechit, const HBHEDataFrame &digi)
HcalADCSaturationFlag * saturationFlagSetter_
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< ZDCDigiCollection > tok_input_castor
Definition: DetId.h:17
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
std::vector< int > AuxTSvec_
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
std::vector< unsigned int > noiseTS() const
uint32_t getValue() const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const

Member Data Documentation

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

Definition at line 71 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

edm::ESGetToken<HcalDbService, HcalDbRecord> ZdcHitReconstructor::conditionsToken_
private

Definition at line 82 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

bool ZdcHitReconstructor::correctTiming_
private

Definition at line 64 of file ZdcHitReconstructor.h.

DetId::Detector ZdcHitReconstructor::det_
private

Definition at line 58 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

bool ZdcHitReconstructor::dropZSmarkedPassed_
private

Definition at line 70 of file ZdcHitReconstructor.h.

Referenced by produce().

edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> ZdcHitReconstructor::htopoToken_
private

Definition at line 80 of file ZdcHitReconstructor.h.

Referenced by beginRun(), and ZdcHitReconstructor().

std::unique_ptr<HcalLongRecoParams> ZdcHitReconstructor::longRecoParams_
private

Definition at line 77 of file ZdcHitReconstructor.h.

Referenced by beginRun(), and produce().

double ZdcHitReconstructor::lowGainFrac_
private

Definition at line 75 of file ZdcHitReconstructor.h.

int ZdcHitReconstructor::lowGainOffset_
private

Definition at line 74 of file ZdcHitReconstructor.h.

edm::ESGetToken<HcalLongRecoParams, HcalLongRecoParamsRcd> ZdcHitReconstructor::paramsToken_
private

Definition at line 81 of file ZdcHitReconstructor.h.

Referenced by beginRun(), and ZdcHitReconstructor().

edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> ZdcHitReconstructor::qualToken_
private

Definition at line 83 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

ZdcSimpleRecAlgo ZdcHitReconstructor::reco_
private

Definition at line 55 of file ZdcHitReconstructor.h.

Referenced by produce().

HcalADCSaturationFlag* ZdcHitReconstructor::saturationFlagSetter_
private

Definition at line 56 of file ZdcHitReconstructor.h.

Referenced by produce(), ZdcHitReconstructor(), and ~ZdcHitReconstructor().

bool ZdcHitReconstructor::setHSCPFlags_
private

Definition at line 66 of file ZdcHitReconstructor.h.

bool ZdcHitReconstructor::setNoiseFlags_
private

Definition at line 65 of file ZdcHitReconstructor.h.

bool ZdcHitReconstructor::setSaturationFlags_
private

Definition at line 67 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

bool ZdcHitReconstructor::setTimingTrustFlags_
private

Definition at line 68 of file ZdcHitReconstructor.h.

Definition at line 84 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

int ZdcHitReconstructor::subdet_
private

Definition at line 59 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

HcalOtherSubdetector ZdcHitReconstructor::subdetOther_
private

Definition at line 60 of file ZdcHitReconstructor.h.

Referenced by ZdcHitReconstructor().

edm::EDGetTokenT<ZDCDigiCollection> ZdcHitReconstructor::tok_input_castor
private

Definition at line 62 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

edm::EDGetTokenT<ZDCDigiCollection> ZdcHitReconstructor::tok_input_hcal
private

Definition at line 61 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().