CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ReconstructerFP420 (const edm::ParameterSet &conf)
 
 ~ReconstructerFP420 () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 23 of file ReconstructerFP420.h.

Member Typedef Documentation

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

Definition at line 34 of file ReconstructerFP420.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file ReconstructerFP420.cc.

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

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

Definition at line 50 of file ReconstructerFP420.cc.

References gather_cfg::cout, sFP420RecoMain_, and verbosity.

50  {
51  if (verbosity > 0) {
52  std::cout << "ReconstructerFP420:delete FP420RecoMain" << std::endl;
53  }
54  delete sFP420RecoMain_;
55  }
FP420RecoMain * sFP420RecoMain_
tuple cout
Definition: gather_cfg.py:144

Member Function Documentation

void cms::ReconstructerFP420::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 57 of file ReconstructerFP420.cc.

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

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

Member Data Documentation

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

Definition at line 35 of file ReconstructerFP420.h.

Referenced by ReconstructerFP420().

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

Definition at line 41 of file ReconstructerFP420.h.

Referenced by ReconstructerFP420().

FP420RecoMain* cms::ReconstructerFP420::sFP420RecoMain_
private

Definition at line 38 of file ReconstructerFP420.h.

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

vstring cms::ReconstructerFP420::trackerContainers
private

Definition at line 36 of file ReconstructerFP420.h.

Referenced by produce(), and ReconstructerFP420().

int cms::ReconstructerFP420::verbosity
private

Definition at line 39 of file ReconstructerFP420.h.

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

int cms::ReconstructerFP420::VtxFlag
private

Definition at line 40 of file ReconstructerFP420.h.

Referenced by produce(), and ReconstructerFP420().