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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob ()
 
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::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 (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 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::EDProducer
typedef EDProducer 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::EDProducer
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 38 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, AlCaHLTBitMon_QueryRunRegistry::string, subdets, GlobalPosition_Frontier_DevDB_cff::tag, and o2o::tags.

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

Definition at line 150 of file CFWriter.cc.

150 {}

Member Function Documentation

void edm::CFWriter::beginJob ( void  )
inlinevirtual

Reimplemented from edm::EDProducer.

Definition at line 39 of file CFWriter.h.

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

Reimplemented from edm::EDProducer.

Definition at line 145 of file CFWriter.cc.

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

Definition at line 246 of file CFWriter.cc.

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

Referenced by CFWriter().

246  {
247 
248  label=tag.label()+tag.instance();
249  wantedBranches_.push_back(friendlyName + '_' +
250  tag.label() + '_' +
251  tag.instance());
252 
253  //if useCurrentProcessOnly, we have to change the input tag
256  tag = InputTag(tag.label(),tag.instance(),processName);
257  }
258 
259 }
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:121
void CFWriter::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 153 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().

154 {
155 
156  if (flagSimTrack_){
157  bool gotTracks;
159  gotTracks = iEvent.getByLabel("mix","g4SimHits",cf_simtrack);
160 
161  if (gotTracks){
162  PCrossingFrame<SimTrack> * PCFbis = new PCrossingFrame<SimTrack>(*cf_simtrack.product());
163  std::auto_ptr<PCrossingFrame<SimTrack> > pOutTrack(PCFbis);
164  iEvent.put(pOutTrack,"g4SimHits");
165  }
166  else{
167  LogInfo("MixingModule") << " Please, check if the object <SimTrack> has been mixed by the MixingModule!";
168  }
169  }//end if flagSimTrack_
170 
171  //SimVertex
172  if (flagSimVertex_){
173  bool gotSimVertex;
175  gotSimVertex=iEvent.getByLabel("mix","g4SimHits",cf_simvtx);
176 
177  if (gotSimVertex){
178  PCrossingFrame<SimVertex> * PCFvtx = new PCrossingFrame<SimVertex>(*cf_simvtx.product());
179  std::auto_ptr<PCrossingFrame<SimVertex> > pOutVertex(PCFvtx);
180  iEvent.put(pOutVertex,"g4SimHits");
181  }
182  else{
183  LogInfo("MixingModule") << " Please, check if the object <SimVertex> has been mixed by the MixingModule!";
184  }
185  }
186 
187  // PCaloHit
188  if (flagPCaloHit_){
189 
190  for (unsigned int ii=0;ii<labCaloHit.size();ii++){
191  bool gotPCaloHit;
193  gotPCaloHit=iEvent.getByLabel("mix",labCaloHit[ii],cf_calohit);
194 
195  if (gotPCaloHit){
196  PCrossingFrame<PCaloHit> * PCFPhCaloHit = new PCrossingFrame<PCaloHit>(*cf_calohit.product());
197  std::auto_ptr<PCrossingFrame<PCaloHit> > pOutHCalo(PCFPhCaloHit);
198  iEvent.put(pOutHCalo,labCaloHit[ii]);
199  }
200  else{
201  LogInfo("MixingModule") << " Please, check if the object <PCaloHit> " << labCaloHit[ii] << " has been mixed by the MixingModule!";
202  }
203  }
204 
205  }
206 
207  if (flagPSimHit_){
208 
209  for (unsigned int ii=0;ii<labSimHit.size();ii++) {
210  bool gotPSimHit;
212  gotPSimHit=iEvent.getByLabel("mix",labSimHit[ii],cf_simhit);
213 
214  if (gotPSimHit){
215  PCrossingFrame<PSimHit> * PCFSimHit = new PCrossingFrame<PSimHit>(*cf_simhit.product());
216  std::auto_ptr<PCrossingFrame<PSimHit> > pOutSimHit(PCFSimHit);
217  iEvent.put(pOutSimHit,labSimHit[ii]);
218  }
219  else{
220  LogInfo("MixingModule") << " Please, check if the object <PSimHit> " << labSimHit[ii] << " has been mixed by the MixingModule!";
221  }
222 
223  }
224  }
225 
226 
227  //HepMCProduct
228  if (flagHepMCProduct_){
229  bool gotHepMCProduct;
231  gotHepMCProduct=iEvent.getByLabel("mix","generator",cf_hepmc);
232  if (gotHepMCProduct){
234  std::auto_ptr<PCrossingFrame<edm::HepMCProduct> > pOuthepmcpr(PCFHepMC);
235  iEvent.put(pOuthepmcpr,"generator");
236  }
237  else{
238  LogInfo("MixingModule") << " Please, check if the object <HepMCProduct> has been mixed by the MixingModule!";
239  }
240 
241  }// end if flagHepMCProduct_
242 
243 }
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().