CMS 3D CMS Logo

EcalTBHodoscopeRecInfoProducer.cc
Go to the documentation of this file.
8 
10 
12 {
13  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
14  rawInfoProducer_ = ps.getParameter<std::string>("rawInfoProducer");
15  recInfoCollection_ = ps.getParameter<std::string>("recInfoCollection");
16  fitMethod_ = ps.getParameter<int>("fitMethod");
17 
18 // std::vector<double> planeShift_def;
19 // planeShift_def.push_back( -0.333 );
20 // planeShift_def.push_back( -0.333 );
21 // planeShift_def.push_back( -0.333 );
22 // planeShift_def.push_back( -0.333 );
23  std::vector<double> planeShift = ps.getParameter< std::vector<double> >("planeShift");
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  std::vector<double> zPosition = ps.getParameter< std::vector<double> >("zPosition");
31 
32  produces<EcalTBHodoscopeRecInfo>(recInfoCollection_);
33 
34  algo_ = new EcalTBHodoscopeRecInfoAlgo(fitMethod_, planeShift, zPosition);
35 }
36 
38  delete algo_;
39 }
40 
42 {
43  // Get input
44  edm::Handle<EcalTBHodoscopeRawInfo> ecalRawHodoscope;
45  const EcalTBHodoscopeRawInfo* ecalHodoRawInfo = 0;
46  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
47  e.getByLabel( rawInfoProducer_, ecalRawHodoscope);
48  if (ecalRawHodoscope.isValid()) {
49  ecalHodoRawInfo = ecalRawHodoscope.product();
50  }
51 
52  if (! ecalHodoRawInfo )
53  {
54  edm::LogError("EcalTBHodoscopeRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ;
55  return;
56  }
57 
58  if ( (*ecalHodoRawInfo).planes() != 4 )
59  {
60  edm::LogError("EcalTBHodoscopeRecInfoError") << "Number of planes different from expected " << rawInfoCollection_.c_str() ;
61  return;
62  }
63 
64  // Create empty output
65 
66  e.put(std::make_unique<EcalTBHodoscopeRecInfo>(algo_->reconstruct(*ecalRawHodoscope)),recInfoCollection_);
67 }
68 
69 
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:122
EcalTBHodoscopeRecInfo reconstruct(const EcalTBHodoscopeRawInfo &hodoscopeRawInfo) const
virtual void produce(edm::Event &e, const edm::EventSetup &es)
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:416
T const * product() const
Definition: Handle.h:81