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::stream::EDProducer<> edm::stream::EDProducerBase 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::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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
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 (const std::string &iProcessName, std::vector< const char * > &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

edm::EDGetTokenT
< EBRecHitCollection
theEBRecHitCollectionToken
 
edm::EDGetTokenT
< EERecHitCollection
theEERecHitCollectionToken
 
edm::EDGetTokenT
< ESRecHitCollection
theESRecHitCollectionToken
 
edm::EDGetTokenT
< HBHERecHitCollection
theHBHERecHitCollectionToken
 
edm::EDGetTokenT
< HFRecHitCollection
theHFRecHitCollectionToken
 
edm::EDGetTokenT
< HORecHitCollection
theHORecHitCollectionToken
 
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::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
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 CaloRecHitCopy.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file CaloRecHitCopy.cc.

References edm::ParameterSet::getParameter(), input, theEBRecHitCollectionToken, theEERecHitCollectionToken, theESRecHitCollectionToken, theHBHERecHitCollectionToken, theHFRecHitCollectionToken, theHORecHitCollectionToken, theInputRecHitCollections, theInputRecHitCollectionTypes, theOutputRecHitCollections, and theOutputRecHitInstances.

12 {
13 
14  theInputRecHitCollectionTypes = p.getParameter<std::vector<unsigned> >("InputRecHitCollectionTypes");
15  theInputRecHitCollections = p.getParameter<std::vector<edm::InputTag> >("InputRecHitCollections");
16  theOutputRecHitCollections = p.getParameter<std::vector<std::string> >("OutputRecHitCollections");
17 
19 
20  for ( unsigned input=0; input<theInputRecHitCollectionTypes.size(); ++input ) {
21 
23  theOutputRecHitCollections[input] == "none" ?
24  false : true;
25 
27 
28  case 1:
29  {
30  //Preshower
31  theESRecHitCollectionToken = consumes<ESRecHitCollection>(theInputRecHitCollections[input]);
32  if ( !theOutputRecHitInstances[input] )
33  produces<ESRecHitCollection>();
34  else
35  produces<ESRecHitCollection>(theOutputRecHitCollections[input]);
36  }
37  break;
38 
39  case 2:
40  {
41  //Ecal Barrel
42  theEBRecHitCollectionToken = consumes<EBRecHitCollection>(theInputRecHitCollections[input]);
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  theEERecHitCollectionToken = consumes<EERecHitCollection>(theInputRecHitCollections[input]);
54  if ( !theOutputRecHitInstances[input] )
55  produces<EERecHitCollection>();
56  else
57  produces<EERecHitCollection>(theOutputRecHitCollections[input]);
58  }
59  break;
60 
61  case 4:
62  {
63  //HCAL
64  theHBHERecHitCollectionToken = consumes<HBHERecHitCollection>(theInputRecHitCollections[input]);
65  if ( !theOutputRecHitInstances[input] )
66  produces<HBHERecHitCollection>();
67  else
68  produces<HBHERecHitCollection>(theOutputRecHitCollections[input]);
69  }
70  break;
71 
72  case 5:
73  {
74  //HO
75  theHORecHitCollectionToken = consumes<HORecHitCollection>(theInputRecHitCollections[input]);
76  if ( !theOutputRecHitInstances[input] )
77  produces<HORecHitCollection>();
78  else
79  produces<HORecHitCollection>(theOutputRecHitCollections[input]);
80  }
81  break;
82 
83  case 6:
84  {
85  //HF
86  theHFRecHitCollectionToken = consumes<HFRecHitCollection>(theInputRecHitCollections[input]);
87  if ( !theOutputRecHitInstances[input] )
88  produces<HFRecHitCollection>();
89  else
90  produces<HFRecHitCollection>(theOutputRecHitCollections[input]);
91  }
92  break;
93 
94  default:
95  // Should not happen
96  break;
97 
98  }
99 
100  }
101 
102 
103 }
edm::EDGetTokenT< EERecHitCollection > theEERecHitCollectionToken
edm::EDGetTokenT< EBRecHitCollection > theEBRecHitCollectionToken
std::vector< bool > theOutputRecHitInstances
edm::EDGetTokenT< ESRecHitCollection > theESRecHitCollectionToken
edm::EDGetTokenT< HBHERecHitCollection > theHBHERecHitCollectionToken
static std::string const input
Definition: EdmProvDump.cc:43
edm::EDGetTokenT< HFRecHitCollection > theHFRecHitCollectionToken
std::vector< unsigned int > theInputRecHitCollectionTypes
std::vector< std::string > theOutputRecHitCollections
edm::EDGetTokenT< HORecHitCollection > theHORecHitCollectionToken
std::vector< edm::InputTag > theInputRecHitCollections
CaloRecHitCopy::~CaloRecHitCopy ( )
virtual

Definition at line 105 of file CaloRecHitCopy.cc.

105 { }

Member Function Documentation

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

Implements edm::stream::EDProducerBase.

Definition at line 108 of file CaloRecHitCopy.cc.

References egHLT::errCodes::EBRecHits, egHLT::errCodes::EERecHits, edm::Event::getByToken(), egHLT::errCodes::HBHERecHits, egHLT::errCodes::HFRecHits, input, edm::Event::put(), theEBRecHitCollectionToken, theEERecHitCollectionToken, theESRecHitCollectionToken, theHBHERecHitCollectionToken, theHFRecHitCollectionToken, theHORecHitCollectionToken, theInputRecHitCollectionTypes, theOutputRecHitCollections, and theOutputRecHitInstances.

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

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

Member Data Documentation

edm::EDGetTokenT<EBRecHitCollection> CaloRecHitCopy::theEBRecHitCollectionToken
private

Definition at line 36 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().

edm::EDGetTokenT<EERecHitCollection> CaloRecHitCopy::theEERecHitCollectionToken
private

Definition at line 37 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().

edm::EDGetTokenT<ESRecHitCollection> CaloRecHitCopy::theESRecHitCollectionToken
private

Definition at line 35 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().

edm::EDGetTokenT<HBHERecHitCollection> CaloRecHitCopy::theHBHERecHitCollectionToken
private

Definition at line 38 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().

edm::EDGetTokenT<HFRecHitCollection> CaloRecHitCopy::theHFRecHitCollectionToken
private

Definition at line 40 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().

edm::EDGetTokenT<HORecHitCollection> CaloRecHitCopy::theHORecHitCollectionToken
private

Definition at line 39 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().

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

Definition at line 31 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy().

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

Definition at line 33 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().

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

Definition at line 32 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().

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

Definition at line 34 of file CaloRecHitCopy.h.

Referenced by CaloRecHitCopy(), and produce().