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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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 (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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 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  LogInfo("MixingModule") <<"Add PCrossingFrame<SimTrack> "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
67 
68  }
69  //SimVertices
70  else if (object=="SimVertex") {
71  flagSimVertex_ = true;
72 
73  InputTag tag;
74  if (tags.size()>0) tag=tags[0];
76  branchesActivate(TypeID(typeid(std::vector<SimVertex>)).friendlyClassName(),std::string(""),tag,label);
77  produces<PCrossingFrame<SimVertex> >(label);
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  LogInfo("MixingModule") <<"Add PCrossingFrame<PCaloHit> "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
95 
96  // fill table with labels
97  labCaloHit.push_back(label);
98  }
99  }
100 
101  // PSimHit
102  else if (object=="PSimHit"){
103  flagPSimHit_ = true;
104 
105  std::vector<std::string> subdets=pset.getParameter<std::vector<std::string> >("subdets");
106  for (unsigned int ii=0;ii<subdets.size();ii++) {
107  InputTag tag;
108  if (tags.size()==1) tag=tags[0];
109 
110  else if(tags.size()>1) tag=tags[ii];
112 
113  branchesActivate(TypeID(typeid(std::vector<PSimHit>)).friendlyClassName(),subdets[ii],tag,label);
114  produces<PCrossingFrame<PSimHit> >(label);
115  LogInfo("MixingModule") <<"Add PSimHitContainer "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
116 
117  // fill table with labels
118  labSimHit.push_back(label);
119  } //end for
120  }
121 
122  // HepMCProduct
123  else if (object=="HepMCProduct"){
124  flagHepMCProduct_ = true;
125 
126  InputTag tag;
127  if (tags.size()>0) tag=tags[0];
129 
130  branchesActivate(TypeID(typeid(HepMCProduct)).friendlyClassName(),std::string(""),tag,label);
131  produces<PCrossingFrame<edm::HepMCProduct> >(label);
132  LogInfo("MixingModule") <<"Add HepMCProduct "<<object<<"s with InputTag= "<<tag.encode()<<", label will be "<<label;
133  }
134  else LogWarning("MixingModule") <<"You did not mix a type of object("<<object<<").";
135 
136  }//end for
137 }
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
virtual void branchesActivate(const std::string &friendlyName, std::string subdet, InputTag &tag, std::string &label)
Definition: CFWriter.cc:241
tuple tags
Definition: o2o.py:248
constexpr char const * subdets[11]
bool flagHepMCProduct_
Definition: CFWriter.h:52
bool flagSimTrack_
Definition: CFWriter.h:50
CFWriter::~CFWriter ( )
virtual

Definition at line 145 of file CFWriter.cc.

145 {}

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 140 of file CFWriter.cc.

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

Definition at line 241 of file CFWriter.cc.

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

Referenced by CFWriter().

241  {
242 
243  label=tag.label()+tag.instance();
244  wantedBranches_.push_back(friendlyName + '_' +
245  tag.label() + '_' +
246  tag.instance());
247 
248  //if useCurrentProcessOnly, we have to change the input tag
251  tag = InputTag(tag.label(),tag.instance(),processName);
252  }
253 
254 }
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 ( 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 148 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().

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