CMS 3D CMS Logo

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, HcalDbRecordconditionsToken_
 
bool correctTiming_
 
DetId::Detector det_
 
bool dropZSmarkedPassed_
 
edm::ESGetToken< HcalTopology, HcalRecNumberingRecordhtopoToken_
 
std::unique_ptr< HcalLongRecoParamslongRecoParams_
 
double lowGainFrac_
 
int lowGainOffset_
 
edm::ESGetToken< HcalLongRecoParams, HcalLongRecoParamsRcdparamsToken_
 
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcdqualToken_
 
ZdcSimpleRecAlgo reco_
 
HcalADCSaturationFlagsaturationFlagSetter_
 
bool setHSCPFlags_
 
bool setNoiseFlags_
 
bool setSaturationFlags_
 
bool setTimingTrustFlags_
 
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcdsevToken_
 
int subdet_
 
HcalOtherSubdetector subdetOther_
 
edm::EDGetTokenT< ZDCDigiCollectiontok_input_castor
 
edm::EDGetTokenT< ZDCDigiCollectiontok_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::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_, jetUpdater_cfi::sort, 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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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_
std::vector< int > AuxTSvec_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_

◆ ~ZdcHitReconstructor()

ZdcHitReconstructor::~ZdcHitReconstructor ( )
override

Definition at line 63 of file ZdcHitReconstructor.cc.

References saturationFlagSetter_.

63 { delete saturationFlagSetter_; }
HcalADCSaturationFlag * saturationFlagSetter_

Member Function Documentation

◆ beginRun()

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_

◆ endRun()

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

Definition at line 72 of file ZdcHitReconstructor.cc.

72 {}

◆ produce()

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

Definition at line 74 of file ZdcHitReconstructor.cc.

References AuxTSvec_, edm::SortedCollection< T, SORT >::begin(), AlignmentProducer_cff::calibrations, DetId::Calo, submitPVValidationJobs::conditions, conditionsToken_, det_, HcalSeverityLevelComputer::dropChannel(), dropZSmarkedPassed_, MillePedeFileConverter_cfg::e, edm::SortedCollection< T, SORT >::empty(), edm::SortedCollection< T, SORT >::end(), options_cfi::eventSetup, HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), mps_fire::i, edm::HandleBase::isValid(), longRecoParams_, eostools::move(), HcalLongRecoParam::noiseTS(), qualToken_, DetId::rawId(), reco_, ZdcSimpleRecAlgo::reconstruct(), saturationFlagSetter_, HcalADCSaturationFlag::setSaturationFlag(), setSaturationFlags_, sevToken_, l1trig_cff::shape, HcalLongRecoParam::signalTS(), edm::SortedCollection< T, SORT >::size(), subdet_, HcalZDCDetId::SubdetectorId, tok_input_castor, tok_input_hcal, and geometryCSVtoXML::xx.

74  {
75  // get conditions
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())
94  e.getByToken(tok_input_castor, digi);
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(...)
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > sevToken_
size_type size() const
std::vector< T >::const_iterator const_iterator
edm::EDGetTokenT< ZDCDigiCollection > tok_input_hcal
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::unique_ptr< HcalLongRecoParams > longRecoParams_
ZdcSimpleRecAlgo reco_
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > qualToken_
const_iterator begin() const
ZDCRecHit reconstruct(const ZDCDataFrame &digi, const std::vector< unsigned int > &myNoiseTS, const std::vector< unsigned int > &mySignalTS, const HcalCoder &coder, const HcalCalibrations &calibs) const
void setSaturationFlag(HBHERecHit &rechit, const HBHEDataFrame &digi)
HcalADCSaturationFlag * saturationFlagSetter_
uint32_t getValue() const
edm::EDGetTokenT< ZDCDigiCollection > tok_input_castor
const_iterator end() const
Definition: DetId.h:17
static const int SubdetectorId
Definition: HcalZDCDetId.h:25
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
std::vector< unsigned int > signalTS() const
std::vector< int > AuxTSvec_
bool isValid() const
Definition: HandleBase.h:70
std::vector< unsigned int > noiseTS() const
def move(src, dest)
Definition: eostools.py:511
bool dropChannel(const uint32_t &mystatus) const

Member Data Documentation

◆ AuxTSvec_

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

Definition at line 71 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

◆ conditionsToken_

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

Definition at line 82 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

◆ correctTiming_

bool ZdcHitReconstructor::correctTiming_
private

Definition at line 64 of file ZdcHitReconstructor.h.

◆ det_

DetId::Detector ZdcHitReconstructor::det_
private

Definition at line 58 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

◆ dropZSmarkedPassed_

bool ZdcHitReconstructor::dropZSmarkedPassed_
private

Definition at line 70 of file ZdcHitReconstructor.h.

Referenced by produce().

◆ htopoToken_

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

Definition at line 80 of file ZdcHitReconstructor.h.

Referenced by beginRun(), and ZdcHitReconstructor().

◆ longRecoParams_

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

Definition at line 77 of file ZdcHitReconstructor.h.

Referenced by beginRun(), and produce().

◆ lowGainFrac_

double ZdcHitReconstructor::lowGainFrac_
private

Definition at line 75 of file ZdcHitReconstructor.h.

◆ lowGainOffset_

int ZdcHitReconstructor::lowGainOffset_
private

Definition at line 74 of file ZdcHitReconstructor.h.

◆ paramsToken_

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

Definition at line 81 of file ZdcHitReconstructor.h.

Referenced by beginRun(), and ZdcHitReconstructor().

◆ qualToken_

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

Definition at line 83 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

◆ reco_

ZdcSimpleRecAlgo ZdcHitReconstructor::reco_
private

Definition at line 55 of file ZdcHitReconstructor.h.

Referenced by produce().

◆ saturationFlagSetter_

HcalADCSaturationFlag* ZdcHitReconstructor::saturationFlagSetter_
private

Definition at line 56 of file ZdcHitReconstructor.h.

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

◆ setHSCPFlags_

bool ZdcHitReconstructor::setHSCPFlags_
private

Definition at line 66 of file ZdcHitReconstructor.h.

◆ setNoiseFlags_

bool ZdcHitReconstructor::setNoiseFlags_
private

Definition at line 65 of file ZdcHitReconstructor.h.

◆ setSaturationFlags_

bool ZdcHitReconstructor::setSaturationFlags_
private

Definition at line 67 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

◆ setTimingTrustFlags_

bool ZdcHitReconstructor::setTimingTrustFlags_
private

Definition at line 68 of file ZdcHitReconstructor.h.

◆ sevToken_

Definition at line 84 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

◆ subdet_

int ZdcHitReconstructor::subdet_
private

Definition at line 59 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

◆ subdetOther_

HcalOtherSubdetector ZdcHitReconstructor::subdetOther_
private

Definition at line 60 of file ZdcHitReconstructor.h.

Referenced by ZdcHitReconstructor().

◆ tok_input_castor

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

Definition at line 62 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().

◆ tok_input_hcal

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

Definition at line 61 of file ZdcHitReconstructor.h.

Referenced by produce(), and ZdcHitReconstructor().