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<uint32_t>("FG_HF_threshold"),
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<uint32_t>("MinSignalThreshold"),
41  ps.getParameter<uint32_t>("PMTNoiseThreshold")
42  ),
43  inputLabel_(ps.getParameter<std::vector<edm::InputTag> >("inputLabel")),
44  inputUpgradeLabel_(ps.getParameter<std::vector<edm::InputTag> >("inputUpgradeLabel")),
45  inputTagFEDRaw_(ps.getParameter<edm::InputTag> ("InputTagFEDRaw")),
46  runZS_(ps.getParameter<bool>("RunZS")),
47  runFrontEndFormatError_(ps.getParameter<bool>("FrontEndFormatError"))
48 {
49  std::vector<bool> upgrades = {ps.getParameter<bool>("upgradeHB"), ps.getParameter<bool>("upgradeHE"), ps.getParameter<bool>("upgradeHF")};
50  upgrade_ = std::any_of(std::begin(upgrades), std::end(upgrades), [](bool a) { return a; });
51  legacy_ = std::any_of(std::begin(upgrades), std::end(upgrades), [](bool a) { return !a; });
52 
53  if (ps.exists("parameters")) {
54  auto pset = ps.getUntrackedParameter<edm::ParameterSet>("parameters");
56  }
57  theAlgo_.setUpgradeFlags(upgrades[0], upgrades[1], upgrades[2]);
58 
59  HFEMB_ = false;
60  if(ps.exists("LSConfig"))
61  {
63  HFEMB_ = LongShortCut_.getParameter<bool>("HcalFeatureHFEMBit");
64  MinLongEnergy_ = LongShortCut_.getParameter<double>("Min_Long_Energy"); //minimum long energy
65  MinShortEnergy_ = LongShortCut_.getParameter<double>("Min_Short_Energy"); //minimum short energy
66  LongShortSlope_ = LongShortCut_.getParameter<double>("Long_vrs_Short_Slope"); //slope of the line that cuts are based on
67  LongShortOffset_ = LongShortCut_.getParameter<double>("Long_Short_Offset"); //offset of line
68  }
69  // register for data access
71  tok_raw_ = consumes<FEDRawDataCollection>(inputTagFEDRaw_);
72  }
73 
74  if (legacy_) {
75  tok_hbhe_ = consumes<HBHEDigiCollection>(inputLabel_[0]);
76  tok_hf_ = consumes<HFDigiCollection>(inputLabel_[1]);
77  }
78 
79  if (upgrade_) {
80  tok_hbhe_up_ = consumes<QIE11DigiCollection>(inputUpgradeLabel_[0]);
81  tok_hf_up_ = consumes<QIE10DigiCollection>(inputUpgradeLabel_[1]);
82  }
83 
84  produces<HcalTrigPrimDigiCollection>();
85  theAlgo_.setPeakFinderAlgorithm(ps.getParameter<int>("PeakFinderAlgorithm"));
86 
87  edm::ParameterSet hfSS=ps.getParameter<edm::ParameterSet>("tpScales").getParameter<edm::ParameterSet>("HF");
88 
89  theAlgo_.setNCTScaleShift(hfSS.getParameter<int>("NCTShift"));
90  theAlgo_.setRCTScaleShift(hfSS.getParameter<int>("RCTShift"));
91 }
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 94 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().

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