test
CMS 3D CMS Logo

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

#include <HcalTrigPrimDigiProducer.h>

Inheritance diagram for HcalTrigPrimDigiProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HcalTrigPrimDigiProducer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~HcalTrigPrimDigiProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool HFEMB_
 
std::vector< edm::InputTaginputLabel_
 input tags for HCAL digis More...
 
edm::InputTag inputTagFEDRaw_
 input tag for FEDRawDataCollection More...
 
edm::ParameterSet LongShortCut_
 
double LongShortOffset_
 
double LongShortSlope_
 
double MinLongEnergy_
 
double MinShortEnergy_
 
bool runFrontEndFormatError_
 
bool runZS_
 
HcalTriggerPrimitiveAlgo theAlgo_
 
edm::EDGetTokenT
< HBHEDigiCollection
tok_hbhe_
 
edm::EDGetTokenT
< HFDigiCollection
tok_hf_
 
edm::EDGetTokenT
< FEDRawDataCollection
tok_raw_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HFEMB_, inputLabel_, inputTagFEDRaw_, LongShortCut_, LongShortOffset_, LongShortSlope_, MinLongEnergy_, MinShortEnergy_, runFrontEndFormatError_, HcalTriggerPrimitiveAlgo::setNCTScaleShift(), HcalTriggerPrimitiveAlgo::setPeakFinderAlgorithm(), HcalTriggerPrimitiveAlgo::setRCTScaleShift(), theAlgo_, tok_hbhe_, tok_hf_, and tok_raw_.

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  inputTagFEDRaw_(ps.getParameter<edm::InputTag> ("InputTagFEDRaw")),
45  runZS_(ps.getParameter<bool>("RunZS")),
46  runFrontEndFormatError_(ps.getParameter<bool>("FrontEndFormatError"))
47 {
48  HFEMB_ = false;
49  if(ps.exists("LSConfig"))
50  {
52  HFEMB_ = LongShortCut_.getParameter<bool>("HcalFeatureHFEMBit");
53  MinLongEnergy_ = LongShortCut_.getParameter<double>("Min_Long_Energy"); //minimum long energy
54  MinShortEnergy_ = LongShortCut_.getParameter<double>("Min_Short_Energy"); //minimum short energy
55  LongShortSlope_ = LongShortCut_.getParameter<double>("Long_vrs_Short_Slope"); //slope of the line that cuts are based on
56  LongShortOffset_ = LongShortCut_.getParameter<double>("Long_Short_Offset"); //offset of line
57  }
58  // register for data access
60  tok_raw_ = consumes<FEDRawDataCollection>(inputTagFEDRaw_);
61  }
62  tok_hbhe_ = consumes<HBHEDigiCollection>(inputLabel_[0]);
63  tok_hf_ = consumes<HFDigiCollection>(inputLabel_[1]);
64 
65  produces<HcalTrigPrimDigiCollection>();
66  theAlgo_.setPeakFinderAlgorithm(ps.getParameter<int>("PeakFinderAlgorithm"));
67 
68  edm::ParameterSet hfSS=ps.getParameter<edm::ParameterSet>("HFTPScaleShift");
69 
70  theAlgo_.setNCTScaleShift(hfSS.getParameter<int>("NCT"));
71  theAlgo_.setRCTScaleShift(hfSS.getParameter<int>("RCT"));
72 }
T getParameter(std::string const &) const
edm::InputTag inputTagFEDRaw_
input tag for FEDRawDataCollection
T getUntrackedParameter(std::string const &, T const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
HcalTriggerPrimitiveAlgo theAlgo_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
std::vector< edm::InputTag > inputLabel_
input tags for HCAL digis
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
virtual HcalTrigPrimDigiProducer::~HcalTrigPrimDigiProducer ( )
inlinevirtual

Definition at line 17 of file HcalTrigPrimDigiProducer.h.

17 {}

Member Function Documentation

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

Produces the EDM products,

Implements edm::EDProducer.

Definition at line 75 of file HcalTrigPrimDigiProducer.cc.

References edm::EventSetup::get(), edm::Event::getByToken(), HFEMB_, inputLabel_, inputTagFEDRaw_, edm::HandleBase::isValid(), LongShortOffset_, LongShortSlope_, MinLongEnergy_, MinShortEnergy_, edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), mps_fire::result, HcalTriggerPrimitiveAlgo::run(), HcalTriggerPrimitiveAlgo::runFEFormatError(), runFrontEndFormatError_, HcalTriggerPrimitiveAlgo::runZS(), runZS_, theAlgo_, tok_hbhe_, tok_hf_, and tok_raw_.

75  {
76 
77  // Step A: get the conditions, for the decoding
78  edm::ESHandle<HcalTPGCoder> inputCoder;
79  eventSetup.get<HcalTPGRecord>().get(inputCoder);
80 
82  eventSetup.get<CaloTPGRecord>().get(outTranscoder);
83 
85  eventSetup.get<HcalLutMetadataRcd>().get(lutMetadata);
86  float rctlsb = lutMetadata->getRctLsb();
87 
89  eventSetup.get<CaloGeometryRecord>().get(pG);
90 
91  // Step B: Create empty output
92  std::auto_ptr<HcalTrigPrimDigiCollection> result(new HcalTrigPrimDigiCollection());
93 
96 
97  iEvent.getByToken(tok_hbhe_,hbheDigis);
98  iEvent.getByToken(tok_hf_,hfDigis);
99 
100  // protect here against missing input collections
101  // there is no protection in HcalTriggerPrimitiveAlgo
102 
103  if (!hbheDigis.isValid()) {
104  edm::LogInfo("HcalTrigPrimDigiProducer")
105  << "\nWarning: HBHEDigiCollection with input tag "
106  << inputLabel_[0]
107  << "\nrequested in configuration, but not found in the event."
108  << "\nQuit returning empty product." << std::endl;
109 
110  // put empty HcalTrigPrimDigiCollection in the event
111  iEvent.put(result);
112 
113  return;
114  }
115 
116  if (!hfDigis.isValid()) {
117  edm::LogInfo("HcalTrigPrimDigiProducer")
118  << "\nWarning: HFDigiCollection with input tag "
119  << inputLabel_[1]
120  << "\nrequested in configuration, but not found in the event."
121  << "\nQuit returning empty product." << std::endl;
122 
123  // put empty HcalTrigPrimDigiCollection in the event
124  iEvent.put(result);
125 
126  return;
127  }
128 
129 
131  eventSetup.get<HcalDbRecord> ().get(pSetup);
132 
133  HcalFeatureBit* hfembit = 0;
134 
135  if(HFEMB_)
136  {
137  hfembit = new HcalFeatureHFEMBit(MinShortEnergy_, MinLongEnergy_, LongShortSlope_, LongShortOffset_, *pSetup); //inputs values that cut will be based on
138  theAlgo_.run(inputCoder.product(), outTranscoder->getHcalCompressor().get(),
139  *hbheDigis, *hfDigis, *result, &(*pG), rctlsb, hfembit);
140 
141  }// Step C: Invoke the algorithm, passing in inputs and getting back outputs.
142  else
143  {
144  theAlgo_.run(inputCoder.product(), outTranscoder->getHcalCompressor().get(),
145  *hbheDigis, *hfDigis, *result, &(*pG), rctlsb);
146  }
147 
148  // Step C: Invoke the algorithm, passing in inputs and getting back outputs.
149 
150 
151  // Step C.1: Run FE Format Error / ZS for real data.
153 
154 
155  const HcalElectronicsMap *emap = pSetup->getHcalMapping();
156 
158  iEvent.getByToken(tok_raw_, fedHandle);
159 
160  if (fedHandle.isValid() && emap != 0) {
161  theAlgo_.runFEFormatError(fedHandle.product(), emap, *result);
162  } else {
163  edm::LogInfo("HcalTrigPrimDigiProducer")
164  << "\nWarning: FEDRawDataCollection with input tag "
165  << inputTagFEDRaw_
166  << "\nrequested in configuration, but not found in the event."
167  << "\nQuit returning empty product." << std::endl;
168 
169  // produce empty HcalTrigPrimDigiCollection and put it in the event
170  std::auto_ptr < HcalTrigPrimDigiCollection > emptyResult(
172 
173  iEvent.put(emptyResult);
174 
175  return;
176  }
177 
178  }
179 
180  if (runZS_) theAlgo_.runZS(*result);
181 
182  // edm::LogInfo("HcalTrigPrimDigiProducer") << "HcalTrigPrims: " << result->size();
183 
184  // Step D: Put outputs into event
185  iEvent.put(result);
186 }
edm::InputTag inputTagFEDRaw_
input tag for FEDRawDataCollection
void runFEFormatError(const FEDRawDataCollection *rawraw, const HcalElectronicsMap *emap, HcalTrigPrimDigiCollection &result)
edm::SortedCollection< HcalTriggerPrimitiveDigi > HcalTrigPrimDigiCollection
HcalTriggerPrimitiveAlgo theAlgo_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
tuple result
Definition: mps_fire.py:84
int iEvent
Definition: GenABIO.cc:230
bool isValid() const
Definition: HandleBase.h:75
void runZS(HcalTrigPrimDigiCollection &tp)
T const * product() const
Definition: Handle.h:81
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
std::vector< edm::InputTag > inputLabel_
input tags for HCAL digis
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
void run(const HcalTPGCoder *incoder, const HcalTPGCompressor *outcoder, const HBHEDigiCollection &hbheDigis, const HFDigiCollection &hfDigis, HcalTrigPrimDigiCollection &result, const HcalTrigTowerGeometry *trigTowerGeometry, float rctlsb, const HcalFeatureBit *LongvrsShortCut=0)

Member Data Documentation

bool HcalTrigPrimDigiProducer::HFEMB_
private

Definition at line 41 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 33 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

edm::ParameterSet HcalTrigPrimDigiProducer::LongShortCut_
private

Definition at line 42 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer().

double HcalTrigPrimDigiProducer::LongShortOffset_
private

Definition at line 35 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

double HcalTrigPrimDigiProducer::LongShortSlope_
private

Definition at line 35 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

double HcalTrigPrimDigiProducer::MinLongEnergy_
private

Definition at line 35 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

double HcalTrigPrimDigiProducer::MinShortEnergy_
private

Definition at line 35 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

bool HcalTrigPrimDigiProducer::runFrontEndFormatError_
private

Definition at line 39 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

bool HcalTrigPrimDigiProducer::runZS_
private

Definition at line 37 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 29 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

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

Definition at line 30 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().

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

Definition at line 34 of file HcalTrigPrimDigiProducer.h.

Referenced by HcalTrigPrimDigiProducer(), and produce().