CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorSimpleReconstructor.cc
Go to the documentation of this file.
1 using namespace std;
14 
16 #include <iostream>
17 
18 
20  reco_(conf.getParameter<int>("firstSample"),conf.getParameter<int>("samplesToAdd"),conf.getParameter<bool>("correctForTimeslew"),
21  conf.getParameter<bool>("correctForPhaseContainment"),conf.getParameter<double>("correctionPhaseNS")),
22  det_(DetId::Hcal),
23  inputLabel_(conf.getParameter<edm::InputTag>("digiLabel"))
24 {
25  std::string subd=conf.getParameter<std::string>("Subdetector");
26  if (!strcasecmp(subd.c_str(),"CASTOR")) {
29  produces<CastorRecHitCollection>();
30  } else {
31  edm::LogWarning("CastorSimpleReconstructor") << "CastorSimpleReconstructor is not associated with CASTOR subdetector!" << std::endl;
32  }
33 
34 }
35 
37 }
38 
40 {
41  // get conditions
43  eventSetup.get<CastorDbRecord>().get(conditions);
44  const CastorQIEShape* shape = conditions->getCastorShape (); // this one is generic
45 
46  // some hard coding for 2009 data
47  // get event number
48  int runNumber = e.run();
49  if (runNumber < 129456) { CastorSimpleRecAlgo usedRecAlgo2009(1,4,false,false,0.0); reco_ = usedRecAlgo2009;}
50 
51  CastorCalibrations calibrations;
52 
53 // if (det_==DetId::Hcal) {
56  e.getByLabel(inputLabel_,digi);
57 
58  // create empty output
59  std::auto_ptr<CastorRecHitCollection> rec(new CastorRecHitCollection);
60  // run the algorithm
62  for (i=digi->begin(); i!=digi->end(); i++) {
63  HcalCastorDetId cell = i->id();
64  const CastorCalibrations& calibrations=conditions->getCastorCalibrations(cell);
65 
66 
67 //conditions->makeCastorCalibration (cell, &calibrations);
68 
69  const CastorQIECoder* channelCoder = conditions->getCastorCoder (cell);
70  CastorCoderDb coder (*channelCoder, *shape);
71  rec->push_back(reco_.reconstruct(*i,coder,calibrations));
72  }
73  // return result
74  e.put(rec);
75 // }
76  }
77 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< T >::const_iterator const_iterator
virtual void produce(edm::Event &e, const edm::EventSetup &c)
CastorSimpleReconstructor(const edm::ParameterSet &ps)
CastorRecHit reconstruct(const CastorDataFrame &digi, const CastorCoder &coder, const CastorCalibrations &calibs) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
RunNumber_t run() const
Definition: Event.h:66
static const int SubdetectorId
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
tuple conf
Definition: dbtoconf.py:185
Definition: DetId.h:20
const T & get() const
Definition: EventSetup.h:55