test
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 Attributes
cms::ReconstructerFP420 Class Reference

#include <ReconstructerFP420.h>

Inheritance diagram for cms::ReconstructerFP420:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
 ReconstructerFP420 (const edm::ParameterSet &conf)
 
virtual ~ReconstructerFP420 ()
 
- 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< std::string > vstring
 

Private Attributes

edm::ParameterSet conf_
 
std::string m_genReadoutName
 
FP420RecoMainsFP420RecoMain_
 
vstring trackerContainers
 
int verbosity
 
int VtxFlag
 

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 26 of file ReconstructerFP420.h.

Member Typedef Documentation

typedef std::vector<std::string> cms::ReconstructerFP420::vstring
private

Definition at line 41 of file ReconstructerFP420.h.

Constructor & Destructor Documentation

cms::ReconstructerFP420::ReconstructerFP420 ( const edm::ParameterSet conf)
explicit

Definition at line 30 of file ReconstructerFP420.cc.

References HLT_25ns14e33_v1_cff::alias, conf_, gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_genReadoutName, sFP420RecoMain_, AlCaHLTBitMon_QueryRunRegistry::string, trackerContainers, verbosity, and VtxFlag.

30  :conf_(conf) {
31 
32  edm::LogInfo ("ReconstructerFP420 ") <<"Enter the FP420 Reco constructer";
33 
34 
35  verbosity = conf_.getUntrackedParameter<int>("VerbosityLevel");
36  if (verbosity > 0) {
37  std::cout << "Constructor of ReconstructerFP420" << std::endl;
38  }
39 
40 
41  std::string alias ( conf.getParameter<std::string>("@module_label") );
42 
43  produces<RecoCollectionFP420>().setBranchAlias( alias );
44 
45  trackerContainers.clear();
46  trackerContainers = conf.getParameter<std::vector<std::string> >("ROUList");
47  VtxFlag = conf.getParameter<int>("VtxFlagGenRec");
48  m_genReadoutName = conf.getParameter<string>("genReadoutName");
49 
50 
51  // Initialization:
53 
54  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
FP420RecoMain * sFP420RecoMain_
tuple cout
Definition: gather_cfg.py:121
cms::ReconstructerFP420::~ReconstructerFP420 ( )
virtual

Definition at line 57 of file ReconstructerFP420.cc.

References gather_cfg::cout, sFP420RecoMain_, and verbosity.

57  {
58  if (verbosity > 0) {
59  std::cout << "ReconstructerFP420:delete FP420RecoMain" << std::endl;
60  }
61  delete sFP420RecoMain_;
62  }
FP420RecoMain * sFP420RecoMain_
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

void cms::ReconstructerFP420::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 65 of file ReconstructerFP420.cc.

References gather_cfg::cout, and verbosity.

65  {
66  if (verbosity > 0) {
67  std::cout << "ReconstructerFP420:BeginJob method " << std::endl;
68  }
69  }
tuple cout
Definition: gather_cfg.py:121
void cms::ReconstructerFP420::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 72 of file ReconstructerFP420.cc.

References gather_cfg::cout, edm::Event::getByLabel(), input, estimatePileup::inputRange, edm::Event::put(), FP420RecoMain::run(), sFP420RecoMain_, trackerContainers, verbosity, and VtxFlag.

73  {
74  // beginJob;
75  // be lazy and include the appropriate namespaces
76  using namespace edm;
77  using namespace std;
78 
79  // Get input
80 
81  // Vtx info:
82 
83  // define GEN Vtx of Signal
84  double vtxGenX = 0.;
85  double vtxGenY = 0.;
86  double vtxGenZ = 0.;
87 
88  /*
89  if(VtxFlag == 1) {
90 
91  Handle<HepMCProduct> EvtHandle;
92  try{
93  iEvent.getByLabel(m_genReadoutName,EvtHandle);
94  }catch(const Exception&){
95  if(verbosity>0){
96  std::cout << "no HepMCProduct found"<< std::endl;
97  }
98  }
99 
100  const HepMC::GenEvent* evt = EvtHandle->GetEvent() ;
101  HepMC::GenParticle* proton1 = 0;
102  HepMC::GenParticle* proton2 = 0;
103  double partmomcut=4000.;
104  double pz1max = 0.;
105  double pz2min = 0.;
106  for ( HepMC::GenEvent::particle_const_iterator p = evt->particles_begin(); p != evt->particles_end(); ++p ) {
108  double pz = (*p)->momentum().pz();
109  // if (((*p)->pdg_id() == ipdgproton)&&((*p)->status() == 1)&&(pz > partmomcut)){
110  if( pz > partmomcut){
111  if(pz > pz1max){
112  proton1 = *p;pz1max=pz;
113  }
114  }
115  // else if(( (*p)->pdg_id() == ipdgproton)&&((*p)->status() == 1)&&(pz < -1.*partmomcut)) {
116  else if(pz < -1.*partmomcut) {
117  if(pz < pz2min){
118  proton2 = *p;pz2min=pz;
119  }
120  }
121 
122  }// for
123  if(proton1 && !proton2){
124  vtxGenX = (proton1)->production_vertex()->position().x();
125  vtxGenY = (proton1)->production_vertex()->position().y();
126  vtxGenZ = (proton1)->production_vertex()->position().z();
127  }
128  else if(proton2 && !proton1){
129  vtxGenX = (proton2)->production_vertex()->position().x();
130  vtxGenY = (proton2)->production_vertex()->position().y();
131  vtxGenZ = (proton2)->production_vertex()->position().z();
132  }
133  else if(proton1 && proton2){
134  if(abs((proton1)->momentum().pz()) >= abs((proton2)->momentum().pz()) ) {
135  vtxGenX = (proton1)->production_vertex()->position().x();
136  vtxGenY = (proton1)->production_vertex()->position().y();
137  vtxGenZ = (proton1)->production_vertex()->position().z();
138  }
139  else {
140  vtxGenX = (proton2)->production_vertex()->position().x();
141  vtxGenY = (proton2)->production_vertex()->position().y();
142  vtxGenZ = (proton2)->production_vertex()->position().z();
143  }
144  }
145  }// if(VtxFlag == 1
146 
147 */
148 
149  double VtxX = 0.;
150  double VtxY = 0.;
151  double VtxZ = 0.;
152  if(VtxFlag == 1) {
153  VtxX = vtxGenX;// mm
154  VtxY = vtxGenY;// mm
155  VtxZ = vtxGenZ;// mm
156  }
157 
158 
159 
160 
161  // track collection:
162  //A
163  // edm::Handle<ClusterCollectionFP420> icf_simhit;
164  /*
165  Handle<ClusterCollectionFP420> cf_simhit;
166  std::vector<const ClusterCollectionFP420 *> cf_simhitvec;
167  for(uint32_t i = 0; i< trackerContainers.size();i++){
168  iEvent.getByLabel( trackerContainers[i], cf_simhit);
169  cf_simhitvec.push_back(cf_simhit.product()); }
170  std::auto_ptr<ClusterCollectionFP420 > input(new DigiCollectionFP420(cf_simhitvec));
171  */
172 
173  //B
174 
176  iEvent.getByLabel( trackerContainers[0] , input);
177 
178 
179 
180 
181  // Step C: create empty output collection
182  std::auto_ptr<RecoCollectionFP420> toutput(new RecoCollectionFP420);
183 
184 
185 
186  // put zero to container info from the beginning (important! because not any detID is updated with coming of new event !!!!!!
187  // clean info of container from previous event
188 
189  std::vector<RecoFP420> collector;
190  collector.clear();
192  inputRange.first = collector.begin();
193  inputRange.second = collector.end();
194 
195  unsigned int detID = 0;
196  toutput->putclear(inputRange,detID);
197 
198  unsigned int StID = 1;
199  toutput->putclear(inputRange,StID);
200  StID = 2;
201  toutput->putclear(inputRange,StID);
202 
203 
204  // !!!!!!
205  // if we want to keep Reco container/Collection for one event ---> uncomment the line below and vice versa
206  toutput->clear(); //container_.clear() --> start from the beginning of the container
207 
208  // RUN now: !!!!!!
209  // startFP420RecoMain_.run(input, toutput);
210  sFP420RecoMain_->run(input, toutput, VtxX, VtxY, VtxZ);
211  // std::cout <<"======= ReconstructerFP420: end of produce " << endl;
212 
213  // Step D: write output to file
214  if (verbosity > 0) {
215  std::cout << "ReconstructerFP420: iEvent.put(toutput)" << std::endl;
216  }
217  iEvent.put(toutput);
218  if (verbosity > 0) {
219  std::cout << "ReconstructerFP420: iEvent.put(toutput) DONE" << std::endl;
220  }
221  }//produce
inputRange
Get input source.
std::pair< ContainerIterator, ContainerIterator > Range
static std::string const input
Definition: EdmProvDump.cc:43
int iEvent
Definition: GenABIO.cc:230
FP420RecoMain * sFP420RecoMain_
void run(edm::Handle< TrackCollectionFP420 > &input, std::auto_ptr< RecoCollectionFP420 > &toutput, double VtxX, double VtxY, double VtxZ)
Runs the algorithm.
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

edm::ParameterSet cms::ReconstructerFP420::conf_
private

Definition at line 42 of file ReconstructerFP420.h.

Referenced by ReconstructerFP420().

std::string cms::ReconstructerFP420::m_genReadoutName
private

Definition at line 48 of file ReconstructerFP420.h.

Referenced by ReconstructerFP420().

FP420RecoMain* cms::ReconstructerFP420::sFP420RecoMain_
private

Definition at line 45 of file ReconstructerFP420.h.

Referenced by produce(), ReconstructerFP420(), and ~ReconstructerFP420().

vstring cms::ReconstructerFP420::trackerContainers
private

Definition at line 43 of file ReconstructerFP420.h.

Referenced by produce(), and ReconstructerFP420().

int cms::ReconstructerFP420::verbosity
private

Definition at line 46 of file ReconstructerFP420.h.

Referenced by beginJob(), produce(), ReconstructerFP420(), and ~ReconstructerFP420().

int cms::ReconstructerFP420::VtxFlag
private

Definition at line 47 of file ReconstructerFP420.h.

Referenced by produce(), and ReconstructerFP420().