CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalTBHodoscopeRecInfoProducer.cc
Go to the documentation of this file.
9 
11 
13 {
14  rawInfoCollection_ = ps.getParameter<std::string>("rawInfoCollection");
15  rawInfoProducer_ = ps.getParameter<std::string>("rawInfoProducer");
16  recInfoCollection_ = ps.getParameter<std::string>("recInfoCollection");
17  fitMethod_ = ps.getParameter<int>("fitMethod");
18 
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  std::vector<double> planeShift = ps.getParameter< std::vector<double> >("planeShift");
25 
26 // std::vector<double> zPosition_def;
27 // zPosition_def.push_back( -0.333 );
28 // zPosition_def.push_back( -0.333 );
29 // zPosition_def.push_back( -0.333 );
30 // zPosition_def.push_back( -0.333 );
31  std::vector<double> zPosition = ps.getParameter< std::vector<double> >("zPosition");
32 
33  produces<EcalTBHodoscopeRecInfo>(recInfoCollection_);
34 
35  algo_ = new EcalTBHodoscopeRecInfoAlgo(fitMethod_, planeShift, zPosition);
36 }
37 
39  delete algo_;
40 }
41 
43 {
44  // Get input
45  edm::Handle<EcalTBHodoscopeRawInfo> ecalRawHodoscope;
46  const EcalTBHodoscopeRawInfo* ecalHodoRawInfo = 0;
47  //evt.getByLabel( digiProducer_, digiCollection_, pDigis);
48  e.getByLabel( rawInfoProducer_, ecalRawHodoscope);
49  if (ecalRawHodoscope.isValid()) {
50  ecalHodoRawInfo = ecalRawHodoscope.product();
51  }
52 
53  if (! ecalHodoRawInfo )
54  {
55  edm::LogError("EcalTBHodoscopeRecInfoError") << "Error! can't get the product " << rawInfoCollection_.c_str() ;
56  return;
57  }
58 
59  if ( (*ecalHodoRawInfo).planes() != 4 )
60  {
61  edm::LogError("EcalTBHodoscopeRecInfoError") << "Number of planes different from expected " << rawInfoCollection_.c_str() ;
62  return;
63  }
64 
65  // Create empty output
66  std::auto_ptr<EcalTBHodoscopeRecInfo> recInfo(new EcalTBHodoscopeRecInfo(algo_->reconstruct(*ecalRawHodoscope)));
67 
68  e.put(recInfo,recInfoCollection_);
69 }
70 
71 
T getParameter(std::string const &) const
EcalTBHodoscopeRecInfoProducer(const edm::ParameterSet &ps)
EcalTBHodoscopeRecInfo reconstruct(const EcalTBHodoscopeRawInfo &hodoscopeRawInfo) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
virtual void produce(edm::Event &e, const edm::EventSetup &es)
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
T const * product() const
Definition: Handle.h:74