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 Types | Private Member Functions | Private Attributes
edm::CFWriter Class Reference

#include <CFWriter.h>

Inheritance diagram for edm::CFWriter:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
 CFWriter (const edm::ParameterSet &conf)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual void put (edm::Event &e)
 
virtual ~CFWriter ()
 
- 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 Types

typedef std::vector
< edm::HepMCProduct
HepMCProductContainer
 

Private Member Functions

virtual void branchesActivate (const std::string &friendlyName, std::string subdet, InputTag &tag, std::string &label)
 
PCrossingFrame< SimTrackfctTest (const PCrossingFrame< SimTrack > &p)
 

Private Attributes

bool flagHepMCProduct_
 
bool flagPCaloHit_
 
bool flagPSimHit_
 
bool flagSimTrack_
 
bool flagSimVertex_
 
std::vector< std::string > labCaloHit
 
std::vector< std::string > labSimHit
 
bool useCurrentProcessOnly_
 
std::vector< std::string > wantedBranches_
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 31 of file CFWriter.h.

Member Typedef Documentation

Definition at line 56 of file CFWriter.h.

Constructor & Destructor Documentation

CFWriter::CFWriter ( const edm::ParameterSet conf)
explicit

Definition at line 36 of file CFWriter.cc.

References branchesActivate(), edm::InputTag::encode(), edm::ParameterSet::exists(), flagHepMCProduct_, flagPCaloHit_, flagPSimHit_, flagSimTrack_, flagSimVertex_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), cuy::ii, labCaloHit, diffTwoXMLs::label, labSimHit, cscdqm::h::names, TrackValidation_cff::pset, AlCaHLTBitMon_QueryRunRegistry::string, subdets, GlobalPosition_Frontier_DevDB_cff::tag, and o2o::tags.

37 : flagSimTrack_(false),
38  flagSimVertex_(false),
39  flagHepMCProduct_(false),
40  flagPCaloHit_(false),
41  flagPSimHit_(false)
42 {
43 
44  //register your products
45  ParameterSet ps=iConfig.getParameter<ParameterSet>("mixObjects");
46  std::vector<std::string> names = ps.getParameterNames();
47  for (std::vector<std::string>::iterator it=names.begin();it!= names.end();++it)
48  {
49  ParameterSet pset=ps.getParameter<ParameterSet>((*it));
50  if (!pset.exists("type")) continue; //to allow replacement by empty pset
51 
52  std::string object = pset.getParameter<std::string>("type");
53  std::vector<InputTag> tags=pset.getParameter<std::vector<InputTag> >("input");
54 
55  //SimTracks
56  if (object=="SimTrack") {
57  flagSimTrack_ = true;
58 
59  InputTag tag;
60  if (tags.size()>0) tag=tags[0];
62  branchesActivate(TypeID(typeid(std::vector<SimTrack>)).friendlyClassName(),std::string(""),tag,label);
63  produces<PCrossingFrame<SimTrack> >(label);
64  consumes<std::vector<SimTrack>>(tag);
65  LogInfo("MixingModule") <<"Add PCrossingFrame<SimTrack> "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
66 
67  }
68  //SimVertices
69  else if (object=="SimVertex") {
70  flagSimVertex_ = true;
71 
72  InputTag tag;
73  if (tags.size()>0) tag=tags[0];
75  branchesActivate(TypeID(typeid(std::vector<SimVertex>)).friendlyClassName(),std::string(""),tag,label);
76  produces<PCrossingFrame<SimVertex> >(label);
77  consumes<std::vector<SimVertex>>(tag);
78  LogInfo("MixingModule") <<"Add SimVertexContainer "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
79 
80  }
81  // PCaloHit
82  else if (object=="PCaloHit"){
83  flagPCaloHit_ = true;
84 
85  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
86  for (unsigned int ii=0;ii<subdets.size();ii++) {
87  InputTag tag;
88  if (tags.size()==1) tag=tags[0];
89  else if(tags.size()>1) tag=tags[ii];
91 
92  branchesActivate(TypeID(typeid(std::vector<PCaloHit>)).friendlyClassName(),subdets[ii],tag,label);
93  produces<PCrossingFrame<PCaloHit> >(label);
94  consumes<std::vector<PCaloHit>>(tag);
95  LogInfo("MixingModule") <<"Add PCrossingFrame<PCaloHit> "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
96 
97  // fill table with labels
98  labCaloHit.push_back(label);
99  }
100  }
101 
102  // PSimHit
103  else if (object=="PSimHit"){
104  flagPSimHit_ = true;
105 
106  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
107  for (unsigned int ii=0;ii<subdets.size();ii++) {
108  InputTag tag;
109  if (tags.size()==1) tag=tags[0];
110 
111  else if(tags.size()>1) tag=tags[ii];
113 
114  branchesActivate(TypeID(typeid(std::vector<PSimHit>)).friendlyClassName(),subdets[ii],tag,label);
115  produces<PCrossingFrame<PSimHit> >(label);
116  consumes<std::vector<PSimHit>>(tag);
117  LogInfo("MixingModule") <<"Add PSimHitContainer "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
118 
119  // fill table with labels
120  labSimHit.push_back(label);
121  } //end for
122  }
123 
124  // HepMCProduct
125  else if (object=="HepMCProduct"){
126  flagHepMCProduct_ = true;
127 
128  InputTag tag;
129  if (tags.size()>0) tag=tags[0];
131 
132  branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),tag,label);
133  produces<PCrossingFrame<edm::HepMCProduct> >(label);
134  consumes<HepMCProduct>(tag);
135  LogInfo("MixingModule") <<"Add HepMCProduct "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
136  }
137  else LogWarning("MixingModule") <<"You did not mix a type of object("<<object<<").";
138 
139  }//end for
140 }
static const HistoName names[]
std::vector< std::string > labCaloHit
Definition: CFWriter.h:58
bool flagSimVertex_
Definition: CFWriter.h:51
bool flagPSimHit_
Definition: CFWriter.h:54
int ii
Definition: cuy.py:588
std::vector< std::string > labSimHit
Definition: CFWriter.h:57
bool flagPCaloHit_
Definition: CFWriter.h:53
char const * subdets[11]
virtual void branchesActivate(const std::string &friendlyName, std::string subdet, InputTag &tag, std::string &label)
Definition: CFWriter.cc:244
tuple tags
Definition: o2o.py:248
bool flagHepMCProduct_
Definition: CFWriter.h:52
bool flagSimTrack_
Definition: CFWriter.h:50
CFWriter::~CFWriter ( )
virtual

Definition at line 148 of file CFWriter.cc.

148 {}

Member Function Documentation

void CFWriter::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 143 of file CFWriter.cc.

143  {
144 }
void CFWriter::branchesActivate ( const std::string &  friendlyName,
std::string  subdet,
InputTag tag,
std::string &  label 
)
privatevirtual

Definition at line 244 of file CFWriter.cc.

References EgammaHLTValidationUtils::getProcessName(), HLT_25ns10e33_v2_cff::InputTag, edm::InputTag::instance(), edm::InputTag::label(), FSQHLTOfflineSource_cfi::processName, AlCaHLTBitMon_QueryRunRegistry::string, useCurrentProcessOnly_, and wantedBranches_.

Referenced by CFWriter().

244  {
245 
246  label=tag.label()+tag.instance();
247  wantedBranches_.push_back(friendlyName + '_' +
248  tag.label() + '_' +
249  tag.instance());
250 
251  //if useCurrentProcessOnly, we have to change the input tag
254  tag = InputTag(tag.label(),tag.instance(),processName);
255  }
256 
257 }
bool useCurrentProcessOnly_
Definition: CFWriter.h:49
std::string friendlyName(std::string const &iFullName)
std::vector< std::string > wantedBranches_
Definition: CFWriter.h:48
PCrossingFrame<SimTrack> edm::CFWriter::fctTest ( const PCrossingFrame< SimTrack > &  p)
inlineprivate

Definition at line 45 of file CFWriter.h.

References gather_cfg::cout, and AlCaHLTBitMon_ParallelJobs::p.

45 { return p; std::cout << " call PCrossingFrame object" << std::endl;};
tuple cout
Definition: gather_cfg.py:145
void CFWriter::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 151 of file CFWriter.cc.

References flagHepMCProduct_, flagPCaloHit_, flagPSimHit_, flagSimTrack_, flagSimVertex_, edm::Event::getByLabel(), cuy::ii, labCaloHit, labSimHit, edm::Handle< T >::product(), and edm::Event::put().

152 {
153 
154  if (flagSimTrack_){
155  bool gotTracks;
157  gotTracks = iEvent.getByLabel("mix","g4SimHits",cf_simtrack);
158 
159  if (gotTracks){
160  PCrossingFrame<SimTrack> * PCFbis = new PCrossingFrame<SimTrack>(*cf_simtrack.product());
161  std::auto_ptr<PCrossingFrame<SimTrack> > pOutTrack(PCFbis);
162  iEvent.put(pOutTrack,"g4SimHits");
163  }
164  else{
165  LogInfo("MixingModule") << " Please, check if the object <SimTrack> has been mixed by the MixingModule!";
166  }
167  }//end if flagSimTrack_
168 
169  //SimVertex
170  if (flagSimVertex_){
171  bool gotSimVertex;
173  gotSimVertex=iEvent.getByLabel("mix","g4SimHits",cf_simvtx);
174 
175  if (gotSimVertex){
176  PCrossingFrame<SimVertex> * PCFvtx = new PCrossingFrame<SimVertex>(*cf_simvtx.product());
177  std::auto_ptr<PCrossingFrame<SimVertex> > pOutVertex(PCFvtx);
178  iEvent.put(pOutVertex,"g4SimHits");
179  }
180  else{
181  LogInfo("MixingModule") << " Please, check if the object <SimVertex> has been mixed by the MixingModule!";
182  }
183  }
184 
185  // PCaloHit
186  if (flagPCaloHit_){
187 
188  for (unsigned int ii=0;ii<labCaloHit.size();ii++){
189  bool gotPCaloHit;
191  gotPCaloHit=iEvent.getByLabel("mix",labCaloHit[ii],cf_calohit);
192 
193  if (gotPCaloHit){
194  PCrossingFrame<PCaloHit> * PCFPhCaloHit = new PCrossingFrame<PCaloHit>(*cf_calohit.product());
195  std::auto_ptr<PCrossingFrame<PCaloHit> > pOutHCalo(PCFPhCaloHit);
196  iEvent.put(pOutHCalo,labCaloHit[ii]);
197  }
198  else{
199  LogInfo("MixingModule") << " Please, check if the object <PCaloHit> " << labCaloHit[ii] << " has been mixed by the MixingModule!";
200  }
201  }
202 
203  }
204 
205  if (flagPSimHit_){
206 
207  for (unsigned int ii=0;ii<labSimHit.size();ii++) {
208  bool gotPSimHit;
210  gotPSimHit=iEvent.getByLabel("mix",labSimHit[ii],cf_simhit);
211 
212  if (gotPSimHit){
213  PCrossingFrame<PSimHit> * PCFSimHit = new PCrossingFrame<PSimHit>(*cf_simhit.product());
214  std::auto_ptr<PCrossingFrame<PSimHit> > pOutSimHit(PCFSimHit);
215  iEvent.put(pOutSimHit,labSimHit[ii]);
216  }
217  else{
218  LogInfo("MixingModule") << " Please, check if the object <PSimHit> " << labSimHit[ii] << " has been mixed by the MixingModule!";
219  }
220 
221  }
222  }
223 
224 
225  //HepMCProduct
226  if (flagHepMCProduct_){
227  bool gotHepMCProduct;
229  gotHepMCProduct=iEvent.getByLabel("mix","generatorSmeared",cf_hepmc);
230  if (gotHepMCProduct){
232  std::auto_ptr<PCrossingFrame<edm::HepMCProduct> > pOuthepmcpr(PCFHepMC);
233  iEvent.put(pOuthepmcpr,"generator");
234  }
235  else{
236  LogInfo("MixingModule") << " Please, check if the object <HepMCProduct> has been mixed by the MixingModule!";
237  }
238 
239  }// end if flagHepMCProduct_
240 
241 }
std::vector< std::string > labCaloHit
Definition: CFWriter.h:58
bool flagSimVertex_
Definition: CFWriter.h:51
bool flagPSimHit_
Definition: CFWriter.h:54
int ii
Definition: cuy.py:588
int iEvent
Definition: GenABIO.cc:230
std::vector< std::string > labSimHit
Definition: CFWriter.h:57
bool flagPCaloHit_
Definition: CFWriter.h:53
T const * product() const
Definition: Handle.h:81
bool flagHepMCProduct_
Definition: CFWriter.h:52
bool flagSimTrack_
Definition: CFWriter.h:50
virtual void edm::CFWriter::put ( edm::Event e)
inlinevirtual

Definition at line 42 of file CFWriter.h.

42 {;}

Member Data Documentation

bool edm::CFWriter::flagHepMCProduct_
private

Definition at line 52 of file CFWriter.h.

Referenced by CFWriter(), and produce().

bool edm::CFWriter::flagPCaloHit_
private

Definition at line 53 of file CFWriter.h.

Referenced by CFWriter(), and produce().

bool edm::CFWriter::flagPSimHit_
private

Definition at line 54 of file CFWriter.h.

Referenced by CFWriter(), and produce().

bool edm::CFWriter::flagSimTrack_
private

Definition at line 50 of file CFWriter.h.

Referenced by CFWriter(), and produce().

bool edm::CFWriter::flagSimVertex_
private

Definition at line 51 of file CFWriter.h.

Referenced by CFWriter(), and produce().

std::vector<std::string> edm::CFWriter::labCaloHit
private

Definition at line 58 of file CFWriter.h.

Referenced by CFWriter(), and produce().

std::vector<std::string> edm::CFWriter::labSimHit
private

Definition at line 57 of file CFWriter.h.

Referenced by CFWriter(), and produce().

bool edm::CFWriter::useCurrentProcessOnly_
private

Definition at line 49 of file CFWriter.h.

Referenced by branchesActivate().

std::vector<std::string> edm::CFWriter::wantedBranches_
private

Definition at line 48 of file CFWriter.h.

Referenced by branchesActivate().