CMS 3D CMS Logo

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

#include <HcalTrigPrimDigiProducer.h>

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

Public Member Functions

 HcalTrigPrimDigiProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~HcalTrigPrimDigiProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

bool HFEMB_
 
std::vector< edm::InputTaginputLabel_
 input tags for HCAL digis More...
 
edm::InputTag inputTagFEDRaw_
 input tag for FEDRawDataCollection More...
 
std::vector< edm::InputTaginputUpgradeLabel_
 
bool legacy_
 
edm::ParameterSet LongShortCut_
 
double LongShortOffset_
 
double LongShortSlope_
 
double MinLongEnergy_
 
double MinShortEnergy_
 
bool runFrontEndFormatError_
 
bool runZS_
 
HcalTriggerPrimitiveAlgo theAlgo_
 
edm::EDGetTokenT< HBHEDigiCollectiontok_hbhe_
 
edm::EDGetTokenT< QIE11DigiCollectiontok_hbhe_up_
 
edm::EDGetTokenT< HFDigiCollectiontok_hf_
 
edm::EDGetTokenT< QIE10DigiCollectiontok_hf_up_
 
edm::EDGetTokenT< FEDRawDataCollectiontok_raw_
 
bool upgrade_
 

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 12 of file HcalTrigPrimDigiProducer.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file HcalTrigPrimDigiProducer.cc.

References a, begin, end, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HFEMB_, inputLabel_, inputTagFEDRaw_, inputUpgradeLabel_, legacy_, LongShortCut_, LongShortOffset_, LongShortSlope_, MinLongEnergy_, MinShortEnergy_, HcalTriggerPrimitiveAlgo::overrideParameters(), muonDTDigis_cfi::pset, runFrontEndFormatError_, HcalTriggerPrimitiveAlgo::setNCTScaleShift(), HcalTriggerPrimitiveAlgo::setPeakFinderAlgorithm(), HcalTriggerPrimitiveAlgo::setRCTScaleShift(), HcalTriggerPrimitiveAlgo::setUpgradeFlags(), theAlgo_, tok_hbhe_, tok_hbhe_up_, tok_hf_, tok_hf_up_, tok_raw_, and upgrade_.

29 :
30  theAlgo_(ps.getParameter<bool>("peakFilter"),
31  ps.getParameter<std::vector<double> >("weights"),
32  ps.getParameter<int>("latency"),
33  ps.getParameter<uint32_t>("FG_threshold"),
34  ps.getParameter<std::vector<uint32_t> >("FG_HF_thresholds"),
35  ps.getParameter<uint32_t>("ZS_threshold"),
36  ps.getParameter<int>("numberOfSamples"),
37  ps.getParameter<int>("numberOfPresamples"),
38  ps.getParameter<int>("numberOfSamplesHF"),
39  ps.getParameter<int>("numberOfPresamplesHF"),
40  ps.getParameter<bool>("useTDCInMinBiasBits"),
41  ps.getParameter<uint32_t>("MinSignalThreshold"),
42  ps.getParameter<uint32_t>("PMTNoiseThreshold")
43  ),
44  inputLabel_(ps.getParameter<std::vector<edm::InputTag> >("inputLabel")),
45  inputUpgradeLabel_(ps.getParameter<std::vector<edm::InputTag> >("inputUpgradeLabel")),
46  inputTagFEDRaw_(ps.getParameter<edm::InputTag> ("InputTagFEDRaw")),
47  runZS_(ps.getParameter<bool>("RunZS")),
48  runFrontEndFormatError_(ps.getParameter<bool>("FrontEndFormatError"))
49 {
50  std::vector<bool> upgrades = {ps.getParameter<bool>("upgradeHB"), ps.getParameter<bool>("upgradeHE"), ps.getParameter<bool>("upgradeHF")};
51  upgrade_ = std::any_of(std::begin(upgrades), std::end(upgrades), [](bool a) { return a; });
52  legacy_ = std::any_of(std::begin(upgrades), std::end(upgrades), [](bool a) { return !a; });
53 
54  if (ps.exists("parameters")) {
55  auto pset = ps.getUntrackedParameter<edm::ParameterSet>("parameters");
57  }
58  theAlgo_.setUpgradeFlags(upgrades[0], upgrades[1], upgrades[2]);
59 
60  HFEMB_ = false;
61  if(ps.exists("LSConfig"))
62  {
64  HFEMB_ = LongShortCut_.getParameter<bool>("HcalFeatureHFEMBit");
65  MinLongEnergy_ = LongShortCut_.getParameter<double>("Min_Long_Energy"); //minimum long energy
66  MinShortEnergy_ = LongShortCut_.getParameter<double>("Min_Short_Energy"); //minimum short energy
67  LongShortSlope_ = LongShortCut_.getParameter<double>("Long_vrs_Short_Slope"); //slope of the line that cuts are based on
68  LongShortOffset_ = LongShortCut_.getParameter<double>("Long_Short_Offset"); //offset of line
69  }
70  // register for data access
72  tok_raw_ = consumes<FEDRawDataCollection>(inputTagFEDRaw_);
73  }
74 
75  if (legacy_) {
76  tok_hbhe_ = consumes<HBHEDigiCollection>(inputLabel_[0]);
77  tok_hf_ = consumes<HFDigiCollection>(inputLabel_[1]);
78  }
79 
80  if (upgrade_) {
81  tok_hbhe_up_ = consumes<QIE11DigiCollection>(inputUpgradeLabel_[0]);
82  tok_hf_up_ = consumes<QIE10DigiCollection>(inputUpgradeLabel_[1]);
83  }
84 
85  produces<HcalTrigPrimDigiCollection>();
86  theAlgo_.setPeakFinderAlgorithm(ps.getParameter<int>("PeakFinderAlgorithm"));
87 
88  edm::ParameterSet hfSS=ps.getParameter<edm::ParameterSet>("tpScales").getParameter<edm::ParameterSet>("HF");
89 
90  theAlgo_.setNCTScaleShift(hfSS.getParameter<int>("NCTShift"));
91  theAlgo_.setRCTScaleShift(hfSS.getParameter<int>("RCTShift"));
92 }
T getParameter(std::string const &) const
edm::InputTag inputTagFEDRaw_
input tag for FEDRawDataCollection
T getUntrackedParameter(std::string const &, T const &) const
std::vector< edm::InputTag > inputUpgradeLabel_
bool exists(std::string const &parameterName) const
checks if a parameter exists
HcalTriggerPrimitiveAlgo theAlgo_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
#define end
Definition: vmac.h:39
edm::EDGetTokenT< QIE10DigiCollection > tok_hf_up_
edm::EDGetTokenT< QIE11DigiCollection > tok_hbhe_up_
#define begin
Definition: vmac.h:32
double a
Definition: hdecay.h:121
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
std::vector< edm::InputTag > inputLabel_
input tags for HCAL digis
void setUpgradeFlags(bool hb, bool he, bool hf)
void overrideParameters(const edm::ParameterSet &ps)
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
HcalTrigPrimDigiProducer::~HcalTrigPrimDigiProducer ( )
inlineoverride

Definition at line 17 of file HcalTrigPrimDigiProducer.h.

References EnergyCorrector::c, MillePedeFileConverter_cfg::e, and produce().

17 {}

Member Function Documentation

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

Produces the EDM products,

Definition at line 95 of file HcalTrigPrimDigiProducer.cc.

References edm::EventSetup::get(), edm::Event::getByToken(), CaloTPGTranscoder::getHcalCompressor(), HcalDbService::getHcalMapping(), HcalLutMetadata::getRctLsb(), hcaltpdigi_cfi::HcalFeatureHFEMBit, HFEMB_, inputLabel_, inputTagFEDRaw_, inputUpgradeLabel_, edm::HandleBase::isValid(), legacy_, LongShortOffset_, LongShortSlope_, MinLongEnergy_, MinShortEnergy_, eostools::move(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), edm::Event::put(), mps_fire::result, HcalTriggerPrimitiveAlgo::run(), HcalTriggerPrimitiveAlgo::runFEFormatError(), runFrontEndFormatError_, HcalTriggerPrimitiveAlgo::runZS(), runZS_, theAlgo_, tok_hbhe_, tok_hbhe_up_, tok_hf_, tok_hf_up_, tok_raw_, and upgrade_.

Referenced by ~HcalTrigPrimDigiProducer().

95  {
96 
97  // Step A: get the conditions, for the decoding
98  edm::ESHandle<HcalTPGCoder> inputCoder;
99  eventSetup.get<HcalTPGRecord>().get(inputCoder);
100 
101  edm::ESHandle<CaloTPGTranscoder> outTranscoder;
102  eventSetup.get<CaloTPGRecord>().get(outTranscoder);
103 
104  edm::ESHandle<HcalLutMetadata> lutMetadata;
105  eventSetup.get<HcalLutMetadataRcd>().get(lutMetadata);
106  float rctlsb = lutMetadata->getRctLsb();
107 
109  eventSetup.get<CaloGeometryRecord>().get(pG);
110 
111  // Step B: Create empty output
112  std::unique_ptr<HcalTrigPrimDigiCollection> result(new HcalTrigPrimDigiCollection());
113 
116 
119 
120  if (legacy_) {
121  iEvent.getByToken(tok_hbhe_,hbheDigis);
122  iEvent.getByToken(tok_hf_,hfDigis);
123 
124  // protect here against missing input collections
125  // there is no protection in HcalTriggerPrimitiveAlgo
126 
127  if (!hbheDigis.isValid() and legacy_) {
128  edm::LogInfo("HcalTrigPrimDigiProducer")
129  << "\nWarning: HBHEDigiCollection with input tag "
130  << inputLabel_[0]
131  << "\nrequested in configuration, but not found in the event."
132  << "\nQuit returning empty product." << std::endl;
133 
134  // put empty HcalTrigPrimDigiCollection in the event
135  iEvent.put(std::move(result));
136 
137  return;
138  }
139 
140  if (!hfDigis.isValid() and legacy_) {
141  edm::LogInfo("HcalTrigPrimDigiProducer")
142  << "\nWarning: HFDigiCollection with input tag "
143  << inputLabel_[1]
144  << "\nrequested in configuration, but not found in the event."
145  << "\nQuit returning empty product." << std::endl;
146 
147  // put empty HcalTrigPrimDigiCollection in the event
148  iEvent.put(std::move(result));
149 
150  return;
151  }
152  }
153 
154  if (upgrade_) {
155  iEvent.getByToken(tok_hbhe_up_, hbheUpDigis);
156  iEvent.getByToken(tok_hf_up_, hfUpDigis);
157 
158  if (!hbheUpDigis.isValid() and upgrade_) {
159  edm::LogInfo("HcalTrigPrimDigiProducer")
160  << "\nWarning: Upgrade HBHEDigiCollection with input tag "
161  << inputUpgradeLabel_[0]
162  << "\nrequested in configuration, but not found in the event."
163  << "\nQuit returning empty product." << std::endl;
164 
165  // put empty HcalTrigPrimDigiCollection in the event
166  iEvent.put(std::move(result));
167 
168  return;
169  }
170 
171  if (!hfUpDigis.isValid() and upgrade_) {
172  edm::LogInfo("HcalTrigPrimDigiProducer")
173  << "\nWarning: HFDigiCollection with input tag "
174  << inputUpgradeLabel_[1]
175  << "\nrequested in configuration, but not found in the event."
176  << "\nQuit returning empty product." << std::endl;
177 
178  // put empty HcalTrigPrimDigiCollection in the event
179  iEvent.put(std::move(result));
180 
181  return;
182  }
183  }
184 
185 
187  eventSetup.get<HcalDbRecord> ().get(pSetup);
188 
189  HcalFeatureBit* hfembit = nullptr;
190 
191  if(HFEMB_)
192  {
193  hfembit = new HcalFeatureHFEMBit(MinShortEnergy_, MinLongEnergy_, LongShortSlope_, LongShortOffset_, *pSetup); //inputs values that cut will be based on
194  }
195 
196  // Step C: Invoke the algorithm, passing in inputs and getting back outputs.
197  if (legacy_ and not upgrade_) {
198  theAlgo_.run(inputCoder.product(), outTranscoder->getHcalCompressor().get(), pSetup.product(),
199  *result, &(*pG), rctlsb, hfembit, *hbheDigis, *hfDigis);
200  } else if (legacy_ and upgrade_) {
201  theAlgo_.run(inputCoder.product(), outTranscoder->getHcalCompressor().get(), pSetup.product(),
202  *result, &(*pG), rctlsb, hfembit, *hbheDigis, *hfDigis, *hbheUpDigis, *hfUpDigis);
203  } else {
204  theAlgo_.run(inputCoder.product(), outTranscoder->getHcalCompressor().get(), pSetup.product(),
205  *result, &(*pG), rctlsb, hfembit, *hbheUpDigis, *hfUpDigis);
206  }
207 
208 
209  // Step C.1: Run FE Format Error / ZS for real data.
211 
212 
213  const HcalElectronicsMap *emap = pSetup->getHcalMapping();
214 
216  iEvent.getByToken(tok_raw_, fedHandle);
217 
218  if (fedHandle.isValid() && emap != nullptr) {
219  theAlgo_.runFEFormatError(fedHandle.product(), emap, *result);
220  } else {
221  edm::LogInfo("HcalTrigPrimDigiProducer")
222  << "\nWarning: FEDRawDataCollection with input tag "
223  << inputTagFEDRaw_
224  << "\nrequested in configuration, but not found in the event."
225  << "\nQuit returning empty product." << std::endl;
226 
227  // produce empty HcalTrigPrimDigiCollection and put it in the event
228  std::unique_ptr < HcalTrigPrimDigiCollection > emptyResult(
230 
231  iEvent.put(std::move(emptyResult));
232 
233  return;
234  }
235 
236  }
237 
238  if (runZS_) theAlgo_.runZS(*result);
239 
240  // edm::LogInfo("HcalTrigPrimDigiProducer") << "HcalTrigPrims: " << result->size();
241 
242  // Step D: Put outputs into event
243  iEvent.put(std::move(result));
244 }
edm::InputTag inputTagFEDRaw_
input tag for FEDRawDataCollection
void runFEFormatError(const FEDRawDataCollection *rawraw, const HcalElectronicsMap *emap, HcalTrigPrimDigiCollection &result)
boost::shared_ptr< const HcalTPGCompressor > getHcalCompressor() const
edm::SortedCollection< HcalTriggerPrimitiveDigi > HcalTrigPrimDigiCollection
std::vector< edm::InputTag > inputUpgradeLabel_
HcalTriggerPrimitiveAlgo theAlgo_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
int iEvent
Definition: GenABIO.cc:224
void run(const HcalTPGCoder *incoder, const HcalTPGCompressor *outcoder, const HcalDbService *conditions, HcalTrigPrimDigiCollection &result, const HcalTrigTowerGeometry *trigTowerGeometry, float rctlsb, const HcalFeatureBit *LongvrsShortCut, const Digis &...digis)
bool isValid() const
Definition: HandleBase.h:74
void runZS(HcalTrigPrimDigiCollection &tp)
edm::EDGetTokenT< QIE10DigiCollection > tok_hf_up_
edm::EDGetTokenT< QIE11DigiCollection > tok_hbhe_up_
T const * product() const
Definition: Handle.h:74
float getRctLsb() const
const HcalElectronicsMap * getHcalMapping() const
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
std::vector< edm::InputTag > inputLabel_
input tags for HCAL digis
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_

Member Data Documentation

bool HcalTrigPrimDigiProducer::HFEMB_
private

Definition at line 48 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

std::vector<edm::InputTag> HcalTrigPrimDigiProducer::inputLabel_
private

input tags for HCAL digis

Definition at line 27 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

edm::InputTag HcalTrigPrimDigiProducer::inputTagFEDRaw_
private

input tag for FEDRawDataCollection

Definition at line 37 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

std::vector<edm::InputTag> HcalTrigPrimDigiProducer::inputUpgradeLabel_
private

Definition at line 28 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

bool HcalTrigPrimDigiProducer::legacy_
private

Definition at line 46 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

edm::ParameterSet HcalTrigPrimDigiProducer::LongShortCut_
private

Definition at line 49 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer().

double HcalTrigPrimDigiProducer::LongShortOffset_
private

Definition at line 39 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

double HcalTrigPrimDigiProducer::LongShortSlope_
private

Definition at line 39 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

double HcalTrigPrimDigiProducer::MinLongEnergy_
private

Definition at line 39 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

double HcalTrigPrimDigiProducer::MinShortEnergy_
private

Definition at line 39 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

bool HcalTrigPrimDigiProducer::runFrontEndFormatError_
private

Definition at line 43 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

bool HcalTrigPrimDigiProducer::runZS_
private

Definition at line 41 of file HcalTrigPrimDigiProducer.h.

Referenced by produce().

HcalTriggerPrimitiveAlgo HcalTrigPrimDigiProducer::theAlgo_
private

Definition at line 24 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

edm::EDGetTokenT<HBHEDigiCollection> HcalTrigPrimDigiProducer::tok_hbhe_
private

Definition at line 33 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

edm::EDGetTokenT<QIE11DigiCollection> HcalTrigPrimDigiProducer::tok_hbhe_up_
private

Definition at line 30 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

edm::EDGetTokenT<HFDigiCollection> HcalTrigPrimDigiProducer::tok_hf_
private

Definition at line 34 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

edm::EDGetTokenT<QIE10DigiCollection> HcalTrigPrimDigiProducer::tok_hf_up_
private

Definition at line 31 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

edm::EDGetTokenT<FEDRawDataCollection> HcalTrigPrimDigiProducer::tok_raw_
private

Definition at line 38 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

bool HcalTrigPrimDigiProducer::upgrade_
private

Definition at line 45 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().