CMS 3D CMS Logo

EcalTBHodoscopeRecInfoProducer.cc
Go to the documentation of this file.
8 
10 
12  : rawInfoProducerToken_(consumes(ps.getParameter<std::string>("rawInfoProducer"))),
13  rawInfoCollection_(ps.getParameter<std::string>("rawInfoCollection")),
14  recInfoCollection_(ps.getParameter<std::string>("recInfoCollection")),
15  fitMethod_(ps.getParameter<int>("fitMethod")),
16  algo_(fitMethod_,
17  ps.getParameter<std::vector<double> >("planeShift"),
18  ps.getParameter<std::vector<double> >("zPosition")) {
19  // std::vector<double> planeShift_def;
20  // planeShift_def.push_back( -0.333 );
21  // planeShift_def.push_back( -0.333 );
22  // planeShift_def.push_back( -0.333 );
23  // planeShift_def.push_back( -0.333 );
24 
25  // std::vector<double> zPosition_def;
26  // zPosition_def.push_back( -0.333 );
27  // zPosition_def.push_back( -0.333 );
28  // zPosition_def.push_back( -0.333 );
29  // zPosition_def.push_back( -0.333 );
30 
31  produces<EcalTBHodoscopeRecInfo>(recInfoCollection_);
32 }
33 
35  // Get input
36  edm::Handle<EcalTBHodoscopeRawInfo> ecalRawHodoscope = e.getHandle(rawInfoProducerToken_);
37  const EcalTBHodoscopeRawInfo* ecalHodoRawInfo = nullptr;
38  if (ecalRawHodoscope.isValid()) {
39  ecalHodoRawInfo = ecalRawHodoscope.product();
40  }
41 
42  if (!ecalHodoRawInfo) {
43  edm::LogError("EcalTBHodoscopeRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str();
44  return;
45  }
46 
47  if ((*ecalHodoRawInfo).planes() != 4) {
48  edm::LogError("EcalTBHodoscopeRecInfoError")
49  << "Number of planes different from expected " << rawInfoCollection_.c_str();
50  return;
51  }
52 
53  // Create empty output
54 
55  e.put(std::make_unique<EcalTBHodoscopeRecInfo>(algo_.reconstruct(*ecalRawHodoscope)), recInfoCollection_);
56 }
EcalTBHodoscopeRecInfoProducer(const edm::ParameterSet &ps)
void produce(edm::StreamID, edm::Event &e, const edm::EventSetup &es) const override
EcalTBHodoscopeRecInfo reconstruct(const EcalTBHodoscopeRawInfo &hodoscopeRawInfo) const
T const * product() const
Definition: Handle.h:70
Log< level::Error, false > LogError
edm::EDGetTokenT< EcalTBHodoscopeRawInfo > rawInfoProducerToken_
bool isValid() const
Definition: HandleBase.h:70