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

#include <CaloRecHitCopy.h>

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

Public Member Functions

 CaloRecHitCopy (edm::ParameterSet const &p)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual ~CaloRecHitCopy ()
 
- 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::vector< edm::InputTagtheInputRecHitCollections
 
std::vector< unsigned int > theInputRecHitCollectionTypes
 
std::vector< std::string > theOutputRecHitCollections
 
std::vector< bool > theOutputRecHitInstances
 

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 17 of file CaloRecHitCopy.h.

Constructor & Destructor Documentation

CaloRecHitCopy::CaloRecHitCopy ( edm::ParameterSet const &  p)
explicit

Definition at line 12 of file CaloRecHitCopy.cc.

References edm::ParameterSet::getParameter(), input, theInputRecHitCollections, theInputRecHitCollectionTypes, theOutputRecHitCollections, and theOutputRecHitInstances.

14 {
15 
16  theInputRecHitCollectionTypes = p.getParameter<std::vector<unsigned> >("InputRecHitCollectionTypes");
17  theInputRecHitCollections = p.getParameter<std::vector<edm::InputTag> >("InputRecHitCollections");
18  theOutputRecHitCollections = p.getParameter<std::vector<std::string> >("OutputRecHitCollections");
19 
21 
22  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
23 
25  theOutputRecHitCollections[input] == "none" ?
26  false : true;
27 
29 
30  case 1:
31  {
32  //Preshower
33  if ( !theOutputRecHitInstances[input] )
34  produces<ESRecHitCollection>();
35  else
36  produces<ESRecHitCollection>(theOutputRecHitCollections[input]);
37  }
38  break;
39 
40  case 2:
41  {
42  //Ecal Barrel
43  if ( !theOutputRecHitInstances[input] )
44  produces<EBRecHitCollection>();
45  else
46  produces<EBRecHitCollection>(theOutputRecHitCollections[input]);
47  }
48  break;
49 
50  case 3:
51  {
52  //EcalEndcap
53  if ( !theOutputRecHitInstances[input] )
54  produces<EERecHitCollection>();
55  else
56  produces<EERecHitCollection>(theOutputRecHitCollections[input]);
57  }
58  break;
59 
60  case 4:
61  {
62  //HCAL
63  if ( !theOutputRecHitInstances[input] )
64  produces<HBHERecHitCollection>();
65  else
66  produces<HBHERecHitCollection>(theOutputRecHitCollections[input]);
67  }
68  break;
69 
70  case 5:
71  {
72  //HO
73  if ( !theOutputRecHitInstances[input] )
74  produces<HORecHitCollection>();
75  else
76  produces<HORecHitCollection>(theOutputRecHitCollections[input]);
77  }
78  break;
79 
80  case 6:
81  {
82  //HF
83  if ( !theOutputRecHitInstances[input] )
84  produces<HFRecHitCollection>();
85  else
86  produces<HFRecHitCollection>(theOutputRecHitCollections[input]);
87  }
88  break;
89 
90  default:
91  // Should not happen
92  break;
93 
94  }
95 
96  }
97 
98 
99 }
std::vector< bool > theOutputRecHitInstances
static std::string const input
Definition: EdmProvDump.cc:44
std::vector< unsigned int > theInputRecHitCollectionTypes
std::vector< std::string > theOutputRecHitCollections
std::vector< edm::InputTag > theInputRecHitCollections
CaloRecHitCopy::~CaloRecHitCopy ( )
virtual

Definition at line 101 of file CaloRecHitCopy.cc.

101 { }

Member Function Documentation

void CaloRecHitCopy::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 104 of file CaloRecHitCopy.cc.

References egHLT::errCodes::EBRecHits, egHLT::errCodes::EERecHits, edm::Event::getByLabel(), egHLT::errCodes::HBHERecHits, egHLT::errCodes::HFRecHits, input, edm::Event::put(), theInputRecHitCollections, theInputRecHitCollectionTypes, theOutputRecHitCollections, and theOutputRecHitInstances.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

105 {
106 
107 
108  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
109 
110  switch ( theInputRecHitCollectionTypes[input] ) {
111 
112  case 1:
113  {
114  //Preshower
115  std::auto_ptr< ESRecHitCollection > copiedESRecHitCollection( new ESRecHitCollection );
117  iEvent.getByLabel(theInputRecHitCollections[input],ESRecHits);
118  ESRecHitCollection::const_iterator itES = ESRecHits->begin();
119  ESRecHitCollection::const_iterator lastES = ESRecHits->end();
120  // saves a bit of CPU
121  copiedESRecHitCollection->reserve(ESRecHits->size());
122  for ( ; itES!=lastES; ++itES++ ) {
123  EcalRecHit aHit(*itES);
124  copiedESRecHitCollection->push_back(aHit);
125  }
126  if ( !theOutputRecHitInstances[input] )
127  iEvent.put(copiedESRecHitCollection);
128  else
129  iEvent.put(copiedESRecHitCollection,theOutputRecHitCollections[input]);
130  }
131  break;
132 
133  case 2:
134  {
135  //Ecal Barrel
136  std::auto_ptr< EBRecHitCollection > copiedEBRecHitCollection( new EBRecHitCollection );
138  iEvent.getByLabel(theInputRecHitCollections[input],EBRecHits);
139  EBRecHitCollection::const_iterator itEB = EBRecHits->begin();
140  EBRecHitCollection::const_iterator lastEB = EBRecHits->end();
141  //saves a bit of CPU
142  copiedEBRecHitCollection->reserve(EBRecHits->size());
143 
144  for ( ; itEB!=lastEB; ++itEB++ ) {
145  EcalRecHit aHit(*itEB);
146  copiedEBRecHitCollection->push_back(aHit);
147  }
148  if ( !theOutputRecHitInstances[input] )
149  iEvent.put(copiedEBRecHitCollection);
150  else
151  iEvent.put(copiedEBRecHitCollection,theOutputRecHitCollections[input]);
152  }
153  break;
154 
155  case 3:
156  {
157  //EcalEndcap
158  std::auto_ptr< EERecHitCollection > copiedEERecHitCollection( new EERecHitCollection );
160  iEvent.getByLabel(theInputRecHitCollections[input],EERecHits);
161  EERecHitCollection::const_iterator itEE = EERecHits->begin();
162  EERecHitCollection::const_iterator lastEE = EERecHits->end();
163  //saves a bit of CPU
164  copiedEERecHitCollection->reserve(EERecHits->size());
165 
166  for ( ; itEE!=lastEE; ++itEE++ ) {
167  EcalRecHit aHit(*itEE);
168  copiedEERecHitCollection->push_back(aHit);
169  }
170  if ( !theOutputRecHitInstances[input] )
171  iEvent.put(copiedEERecHitCollection);
172  else
173  iEvent.put(copiedEERecHitCollection,theOutputRecHitCollections[input]);
174  }
175  break;
176 
177  case 4:
178  {
179  //HCAL
180  std::auto_ptr< HBHERecHitCollection > copiedHBHERecHitCollection( new HBHERecHitCollection );
182  iEvent.getByLabel(theInputRecHitCollections[input],HBHERecHits);
183  HBHERecHitCollection::const_iterator itHBHE = HBHERecHits->begin();
184  HBHERecHitCollection::const_iterator lastHBHE = HBHERecHits->end();
185  //saves a bit of CPU
186  copiedHBHERecHitCollection->reserve(HBHERecHits->size());
187 
188  for ( ; itHBHE!=lastHBHE; ++itHBHE++ ) {
189  HBHERecHit aHit(*itHBHE);
190  copiedHBHERecHitCollection->push_back(aHit);
191  }
192  if ( !theOutputRecHitInstances[input] )
193  iEvent.put(copiedHBHERecHitCollection);
194  else
195  iEvent.put(copiedHBHERecHitCollection,theOutputRecHitCollections[input]);
196  }
197  break;
198 
199  case 5:
200  {
201  //HO
202  std::auto_ptr< HORecHitCollection > copiedHORecHitCollection( new HORecHitCollection );
204  iEvent.getByLabel(theInputRecHitCollections[input],HORecHits);
205  HORecHitCollection::const_iterator itHO = HORecHits->begin();
206  HORecHitCollection::const_iterator lastHO = HORecHits->end();
207  //saves a bit of CPU
208  copiedHORecHitCollection->reserve(HORecHits->size());
209 
210  for ( ; itHO!=lastHO; ++itHO++ ) {
211  HORecHit aHit(*itHO);
212  copiedHORecHitCollection->push_back(aHit);
213  }
214  if ( !theOutputRecHitInstances[input] )
215  iEvent.put(copiedHORecHitCollection);
216  else
217  iEvent.put(copiedHORecHitCollection,theOutputRecHitCollections[input]);
218  }
219  break;
220 
221  case 6:
222  {
223  //HF
224  std::auto_ptr< HFRecHitCollection > copiedHFRecHitCollection( new HFRecHitCollection );
226  iEvent.getByLabel(theInputRecHitCollections[input],HFRecHits);
227  HFRecHitCollection::const_iterator itHF = HFRecHits->begin();
228  HFRecHitCollection::const_iterator lastHF = HFRecHits->end();
229  //saves a bit of CPU
230  copiedHFRecHitCollection->reserve(HFRecHits->size());
231 
232  for ( ; itHF!=lastHF; ++itHF++ ) {
233  HFRecHit aHit(*itHF);
234  copiedHFRecHitCollection->push_back(aHit);
235  }
236  if ( !theOutputRecHitInstances[input] )
237  iEvent.put(copiedHFRecHitCollection);
238  else
239  iEvent.put(copiedHFRecHitCollection,theOutputRecHitCollections[input]);
240  }
241  break;
242 
243  default:
244  // Should not happen
245  break;
246 
247  }
248 
249  }
250 
251 }
std::vector< bool > theOutputRecHitInstances
std::vector< EcalRecHit >::const_iterator const_iterator
static std::string const input
Definition: EdmProvDump.cc:44
int iEvent
Definition: GenABIO.cc:243
std::vector< unsigned int > theInputRecHitCollectionTypes
std::vector< std::string > theOutputRecHitCollections
std::vector< edm::InputTag > theInputRecHitCollections

Member Data Documentation

std::vector<edm::InputTag> CaloRecHitCopy::theInputRecHitCollections
private

Definition at line 28 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().

std::vector<unsigned int> CaloRecHitCopy::theInputRecHitCollectionTypes
private

Definition at line 30 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().

std::vector<std::string> CaloRecHitCopy::theOutputRecHitCollections
private

Definition at line 29 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().

std::vector<bool> CaloRecHitCopy::theOutputRecHitInstances
private

Definition at line 31 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().