CMS 3D CMS Logo

EcalTBHodoscopeRecInfoProducer.cc
Go to the documentation of this file.
8 
10 
12  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
13  rawInfoProducer_ = ps.getParameter<std::string>("rawInfoProducer");
14  recInfoCollection_ = ps.getParameter<std::string>("recInfoCollection");
15  fitMethod_ = ps.getParameter<int>("fitMethod");
16 
17  // std::vector<double> planeShift_def;
18  // planeShift_def.push_back( -0.333 );
19  // planeShift_def.push_back( -0.333 );
20  // planeShift_def.push_back( -0.333 );
21  // planeShift_def.push_back( -0.333 );
22  std::vector<double> planeShift = ps.getParameter<std::vector<double> >("planeShift");
23 
24  // std::vector<double> zPosition_def;
25  // zPosition_def.push_back( -0.333 );
26  // zPosition_def.push_back( -0.333 );
27  // zPosition_def.push_back( -0.333 );
28  // zPosition_def.push_back( -0.333 );
29  std::vector<double> zPosition = ps.getParameter<std::vector<double> >("zPosition");
30 
31  produces<EcalTBHodoscopeRecInfo>(recInfoCollection_);
32 
33  algo_ = new EcalTBHodoscopeRecInfoAlgo(fitMethod_, planeShift, zPosition);
34 }
35 
37 
39  // Get input
40  edm::Handle<EcalTBHodoscopeRawInfo> ecalRawHodoscope;
41  const EcalTBHodoscopeRawInfo* ecalHodoRawInfo = nullptr;
42  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
43  e.getByLabel(rawInfoProducer_, ecalRawHodoscope);
44  if (ecalRawHodoscope.isValid()) {
45  ecalHodoRawInfo = ecalRawHodoscope.product();
46  }
47 
48  if (!ecalHodoRawInfo) {
49  edm::LogError("EcalTBHodoscopeRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str();
50  return;
51  }
52 
53  if ((*ecalHodoRawInfo).planes() != 4) {
54  edm::LogError("EcalTBHodoscopeRecInfoError")
55  << "Number of planes different from expected " << rawInfoCollection_.c_str();
56  return;
57  }
58 
59  // Create empty output
60 
61  e.put(std::make_unique<EcalTBHodoscopeRecInfo>(algo_->reconstruct(*ecalRawHodoscope)), recInfoCollection_);
62 }
T getParameter(std::string const &) const
EcalTBHodoscopeRecInfoProducer(const edm::ParameterSet &ps)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
EcalTBHodoscopeRecInfo reconstruct(const EcalTBHodoscopeRawInfo &hodoscopeRawInfo) const
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
T const * product() const
Definition: Handle.h:69
void produce(edm::Event &e, const edm::EventSetup &es) override