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::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 &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 22 of file HcalRealisticZS.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file HcalRealisticZS.cc.

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

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

References algo_.

91  {
92  algo_->clearDbService();
93 }
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 95 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().

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