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
HcalRealisticZS Class Reference

#include <HcalRealisticZS.h>

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

Public Member Functions

 HcalRealisticZS (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~HcalRealisticZS ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::auto_ptr
< HcalZSAlgoRealistic
algo_
 
edm::InputTag inputLabel_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 22 of file HcalRealisticZS.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file HcalRealisticZS.cc.

References algo_, edm::ParameterSet::getParameter(), and tmp.

15  :
16  inputLabel_(conf.getParameter<edm::InputTag>("digiLabel"))
17 {
18  bool markAndPass=conf.getParameter<bool>("markAndPass");
19 
20 
21  std::vector<int> tmp = conf.getParameter<std::vector<int> >("HBregion");
22 
23  if(tmp[0]<0 || tmp[0]>9 || tmp[1]<0 || tmp[1]>9 || tmp[0]>tmp[1]) {
24  edm::LogError("HcalZeroSuppression") << "ZS(HB) region error: "
25  << tmp[0] << ":" <<tmp[1];
26  tmp[0]=0; tmp[1]=9;
27  }
28 
29  std::pair<int,int> HBsearchTS (tmp[0],tmp[1]);
30 
31  tmp = conf.getParameter<std::vector<int> >("HEregion");
32  if(tmp[0]<0 || tmp[0]>9 || tmp[1]<0 || tmp[1]>9 || tmp[0]>tmp[1]) {
33  edm::LogError("HcalZeroSuppression") << "ZS(HE) region error: "
34  << tmp[0] << ":" <<tmp[1];
35  tmp[0]=0; tmp[1]=9;
36  }
37  std::pair<int,int> HEsearchTS (tmp[0],tmp[1]);
38 
39  tmp = conf.getParameter<std::vector<int> >("HOregion");
40  if(tmp[0]<0 || tmp[0]>9 || tmp[1]<0 || tmp[1]>9 || tmp[0]>tmp[1]) {
41  edm::LogError("HcalZeroSuppression") << "ZS(HO) region error: "
42  << tmp[0] << ":" <<tmp[1];
43  tmp[0]=0; tmp[1]=9;
44  }
45  std::pair<int,int> HOsearchTS (tmp[0],tmp[1]);
46 
47  tmp = conf.getParameter<std::vector<int> >("HFregion");
48  if(tmp[0]<0 || tmp[0]>9 || tmp[1]<0 || tmp[1]>9 || tmp[0]>tmp[1]) {
49  edm::LogError("HcalZeroSuppression") << "ZS(HF) region error: "
50  << tmp[0] << ":" <<tmp[1];
51  tmp[0]=0; tmp[1]=9;
52  }
53  std::pair<int,int> HFsearchTS (tmp[0],tmp[1]);
54 
55 
56  //this constructor will be called if useConfigZSvalues is set to 1 in
57  //HcalZeroSuppressionProducers/python/hcalDigisRealistic_cfi.py
58  //which means that channel-by-channel ZS thresholds from DB will NOT be used
59  if ( conf.getParameter<int>("useConfigZSvalues") ) {
60 
61  algo_=std::auto_ptr<HcalZSAlgoRealistic>
62  (new HcalZSAlgoRealistic (markAndPass,
63  conf.getParameter<int>("HBlevel"),
64  conf.getParameter<int>("HElevel"),
65  conf.getParameter<int>("HOlevel"),
66  conf.getParameter<int>("HFlevel"),
67  HBsearchTS,
68  HEsearchTS,
69  HOsearchTS,
70  HFsearchTS
71  ));
72 
73  }
74  else {
75 
76  algo_=std::auto_ptr<HcalZSAlgoRealistic>
77  (new HcalZSAlgoRealistic(markAndPass,
78  HBsearchTS,
79  HEsearchTS,
80  HOsearchTS,
81  HFsearchTS));
82  }
83 
84  produces<HBHEDigiCollection>();
85  produces<HODigiCollection>();
86  produces<HFDigiCollection>();
87 
88 }
std::auto_ptr< HcalZSAlgoRealistic > algo_
edm::InputTag inputLabel_
tuple conf
Definition: dbtoconf.py:185
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
HcalRealisticZS::~HcalRealisticZS ( )
virtual

Definition at line 90 of file HcalRealisticZS.cc.

References algo_.

90  {
91  algo_->clearDbService();
92 }
std::auto_ptr< HcalZSAlgoRealistic > algo_

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 94 of file HcalRealisticZS.cc.

References algo_, edm::EventSetup::get(), edm::Event::getByLabel(), inputLabel_, edm::Handle< T >::product(), edm::ESHandle< class >::product(), and edm::Event::put().

95 {
96 
100 
101  edm::ESHandle<HcalDbService> conditions;
102  eventSetup.get<HcalDbRecord>().get(conditions);
103  algo_->setDbService(conditions.product());
104 
105  e.getByLabel(inputLabel_,hbhe);
106 
107  // create empty output
108  std::auto_ptr<HBHEDigiCollection> zs_hbhe(new HBHEDigiCollection);
109 
110  e.getByLabel(inputLabel_,ho);
111 
112  // create empty output
113  std::auto_ptr<HODigiCollection> zs_ho(new HODigiCollection);
114 
115  e.getByLabel(inputLabel_,hf);
116 
117  // create empty output
118  std::auto_ptr<HFDigiCollection> zs_hf(new HFDigiCollection);
119 
120  //run the algorithm
121 
122  algo_->suppress(*(hbhe.product()),*zs_hbhe);
123  algo_->suppress(*(ho.product()),*zs_ho);
124  algo_->suppress(*(hf.product()),*zs_hf);
125 
126 
127  edm::LogInfo("HcalZeroSuppression") << "Suppression (HBHE) input " << hbhe->size() << " digis, output " << zs_hbhe->size() << " digis"
128  << " (HO) input " << ho->size() << " digis, output " << zs_ho->size() << " digis"
129  << " (HF) input " << hf->size() << " digis, output " << zs_hf->size() << " digis";
130 
131 
132  // return result
133  e.put(zs_hbhe);
134  e.put(zs_ho);
135  e.put(zs_hf);
136 
137 }
std::auto_ptr< HcalZSAlgoRealistic > algo_
edm::InputTag inputLabel_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74

Member Data Documentation

std::auto_ptr<HcalZSAlgoRealistic> HcalRealisticZS::algo_
private

Definition at line 28 of file HcalRealisticZS.h.

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

edm::InputTag HcalRealisticZS::inputLabel_
private

Definition at line 29 of file HcalRealisticZS.h.

Referenced by produce().