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 ()
 
ModuleDescription const & moduleDescription () const
 
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 ()
 
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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::auto_ptr
< HcalZSAlgoRealistic
algo_
 
std::string inputLabel_
 
edm::EDGetTokenT
< HBHEDigiCollection
tok_hbhe_
 
edm::EDGetTokenT
< HBHEUpgradeDigiCollection
tok_hbheUpgrade_
 
edm::EDGetTokenT
< HFDigiCollection
tok_hf_
 
edm::EDGetTokenT
< HFUpgradeDigiCollection
tok_hfUpgrade_
 
edm::EDGetTokenT
< HODigiCollection
tok_ho_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::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 20 of file HcalRealisticZS.h.

Constructor & Destructor Documentation

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

Definition at line 12 of file HcalRealisticZS.cc.

References algo_, edm::ParameterSet::getParameter(), inputLabel_, tmp, tok_hbhe_, tok_hbheUpgrade_, tok_hf_, tok_hfUpgrade_, and tok_ho_.

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

Definition at line 95 of file HcalRealisticZS.cc.

References algo_.

95  {
96  algo_->clearDbService();
97 }
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 99 of file HcalRealisticZS.cc.

References algo_, edm::EventSetup::get(), edm::Event::getByToken(), edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), tok_hbhe_, tok_hbheUpgrade_, tok_hf_, tok_hfUpgrade_, and tok_ho_.

100 {
101 
107 
108  edm::ESHandle<HcalDbService> conditions;
109  eventSetup.get<HcalDbRecord>().get(conditions);
110  algo_->setDbService(conditions.product());
111 
112  e.getByToken(tok_hbhe_,hbhe);
113 
114  // create empty output
115  std::auto_ptr<HBHEDigiCollection> zs_hbhe(new HBHEDigiCollection);
116 
117  e.getByToken(tok_ho_,ho);
118 
119  // create empty output
120  std::auto_ptr<HODigiCollection> zs_ho(new HODigiCollection);
121 
122  e.getByToken(tok_hf_,hf);
123 
124  // create empty output
125  std::auto_ptr<HFDigiCollection> zs_hf(new HFDigiCollection);
126 
127  e.getByToken(tok_hbheUpgrade_,hbheUpgrade);
128  e.getByToken(tok_hfUpgrade_,hfUpgrade);
129 
130  // create empty output
131  std::auto_ptr<HBHEUpgradeDigiCollection> zs_hbheUpgrade(new HBHEUpgradeDigiCollection);
132  std::auto_ptr<HFUpgradeDigiCollection> zs_hfUpgrade(new HFUpgradeDigiCollection);
133 
134  //run the algorithm
135 
136  algo_->suppress(*(hbhe.product()),*zs_hbhe);
137  algo_->suppress(*(ho.product()),*zs_ho);
138  algo_->suppress(*(hf.product()),*zs_hf);
139  algo_->suppress(*(hbheUpgrade.product()),*zs_hbheUpgrade);
140  algo_->suppress(*(hfUpgrade.product()),*zs_hfUpgrade);
141 
142 
143  edm::LogInfo("HcalZeroSuppression") << "Suppression (HBHE) input " << hbhe->size() << " digis, output " << zs_hbhe->size() << " digis"
144  << " (HO) input " << ho->size() << " digis, output " << zs_ho->size() << " digis"
145  << " (HF) input " << hf->size() << " digis, output " << zs_hf->size() << " digis"
146  << " (HBHEUpgrade) input " << hbheUpgrade->size() << " digis, output " << zs_hbheUpgrade->size() << " digis"
147  << " (HFUpgrade) input " << hfUpgrade->size() << " digis, output " << zs_hfUpgrade->size() << " digis";
148 
149 
150  // return result
151  e.put(zs_hbhe);
152  e.put(zs_ho);
153  e.put(zs_hf);
154  e.put(zs_hbheUpgrade,"HBHEUpgradeDigiCollection");
155  e.put(zs_hfUpgrade,"HFUpgradeDigiCollection");
156 
157 }
edm::EDGetTokenT< HODigiCollection > tok_ho_
std::auto_ptr< HcalZSAlgoRealistic > algo_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
edm::EDGetTokenT< HFUpgradeDigiCollection > tok_hfUpgrade_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< HBHEUpgradeDigiCollection > tok_hbheUpgrade_
edm::EDGetTokenT< HFDigiCollection > tok_hf_
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:81

Member Data Documentation

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

Definition at line 26 of file HcalRealisticZS.h.

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

std::string HcalRealisticZS::inputLabel_
private

Definition at line 27 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS().

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

Definition at line 28 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS(), and produce().

edm::EDGetTokenT<HBHEUpgradeDigiCollection> HcalRealisticZS::tok_hbheUpgrade_
private

Definition at line 31 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS(), and produce().

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

Definition at line 30 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS(), and produce().

edm::EDGetTokenT<HFUpgradeDigiCollection> HcalRealisticZS::tok_hfUpgrade_
private

Definition at line 32 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS(), and produce().

edm::EDGetTokenT<HODigiCollection> HcalRealisticZS::tok_ho_
private

Definition at line 29 of file HcalRealisticZS.h.

Referenced by HcalRealisticZS(), and produce().