test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HGCalRecHitWorkerSimple.cc
Go to the documentation of this file.
10 
13  rechitMaker_.reset( new HGCalRecHitSimpleAlgo() );
14  constexpr float keV2GeV = 1e-6;
15  // HGCee constants
16  HGCEE_keV2DIGI_ = ps.getParameter<double>("HGCEE_keV2DIGI");
17  HGCEE_fCPerMIP_ = ps.getParameter<std::vector<double> >("HGCEE_fCPerMIP");
18  HGCEE_isSiFE_ = ps.getParameter<bool>("HGCEE_isSiFE");
20 
21  // HGChef constants
22  HGCHEF_keV2DIGI_ = ps.getParameter<double>("HGCHEF_keV2DIGI");
23  HGCHEF_fCPerMIP_ = ps.getParameter<std::vector<double> >("HGCHEF_fCPerMIP");
24  HGCHEF_isSiFE_ = ps.getParameter<bool>("HGCHEF_isSiFE");
26 
27  // HGCheb constants
28  HGCHEB_keV2DIGI_ = ps.getParameter<double>("HGCHEB_keV2DIGI");
29  HGCHEB_isSiFE_ = ps.getParameter<bool>("HGCHEB_isSiFE");
31 
32  // layer weights (from Valeri/Arabella)
33  std::vector<float> weights;
34  const auto& dweights = ps.getParameter<std::vector<double> >("layerWeights");
35  for( auto weight : dweights ) {
36  weights.push_back(weight);
37  }
38  rechitMaker_->setLayerWeights(weights);
39 
40  // residual correction for cell thickness
41  const auto& rcorr = ps.getParameter<std::vector<double> >("thicknessCorrection");
42  rcorr_.clear();
43  rcorr_.push_back(1.f);
44  for( auto corr : rcorr ) {
45  rcorr_.push_back(1.0/corr);
46  }
47 
48 }
49 
51  if (HGCEE_isSiFE_) {
52  edm::ESHandle<HGCalGeometry> hgceeGeoHandle;
53  es.get<IdealGeometryRecord>().get("HGCalEESensitive",hgceeGeoHandle);
54  ddds_[0] = &(hgceeGeoHandle->topology().dddConstants());
55  } else {
56  ddds_[0] = nullptr;
57  }
58  if (HGCHEF_isSiFE_) {
59  edm::ESHandle<HGCalGeometry> hgchefGeoHandle;
60  es.get<IdealGeometryRecord>().get("HGCalHESiliconSensitive",hgchefGeoHandle);
61  ddds_[1] = &(hgchefGeoHandle->topology().dddConstants());
62  } else {
63  ddds_[1] = nullptr;
64  }
65  ddds_[2] = nullptr;
66 }
67 
68 
69 bool
71  const HGCUncalibratedRecHit& uncalibRH,
73  DetId detid=uncalibRH.id();
74  uint32_t recoFlag = 0;
75  //const std::vector<double>* fCPerMIP = nullptr;
76 
77  switch( detid.subdetId() ) {
78  case HGCEE:
79  rechitMaker_->setADCToGeVConstant(float(hgceeUncalib2GeV_) );
80  //fCPerMIP = &HGCEE_fCPerMIP_;
81  break;
82  case HGCHEF:
83  rechitMaker_->setADCToGeVConstant(float(hgchefUncalib2GeV_) );
84  //fCPerMIP = &HGCHEF_fCPerMIP_;
85  break;
86  case HcalEndcap:
87  case HGCHEB:
88  rechitMaker_->setADCToGeVConstant(float(hgchebUncalib2GeV_) );
89  break;
90  default:
91  throw cms::Exception("NonHGCRecHit")
92  << "Rechit with detid = " << detid.rawId() << " is not HGC!";
93  }
94 
95  // make the rechit and put in the output collection
96  if (recoFlag == 0) {
97  HGCRecHit myrechit( rechitMaker_->makeRecHit(uncalibRH, 0) );
98  int thk = -1;
99  if( detid.subdetId() != HcalEndcap ) {
100  HGCalDetId hid(detid);
101  thk = ddds_[hid.subdetId()-3]->waferTypeL(hid.wafer());
102  // units out of rechit maker are MIP * (GeV/fC)
103  // so multiple
104  }
105  const double new_E = myrechit.energy()*(thk == -1 ? 1.0 : rcorr_[thk]);
106  myrechit.setEnergy(new_E);
107  result.push_back(myrechit);
108  }
109 
110  return true;
111 }
112 
114 }
115 
116 
T getParameter(std::string const &) const
bool run(const edm::Event &evt, const HGCUncalibratedRecHit &uncalibRH, HGCRecHitCollection &result)
std::array< const HGCalDDDConstants *, 3 > ddds_
void push_back(T const &t)
#define constexpr
tuple result
Definition: mps_fire.py:84
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
double f[11][100]
int wafer() const
get the wafer #
Definition: HGCalDetId.h:42
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
JetCorrectorParameters corr
Definition: classes.h:5
void set(const edm::EventSetup &es)
Definition: DetId.h:18
HGCalRecHitWorkerSimple(const edm::ParameterSet &)
const T & get() const
Definition: EventSetup.h:56
std::vector< double > HGCHEF_fCPerMIP_
#define DEFINE_EDM_PLUGIN(factory, type, name)
int weight
Definition: histoStyle.py:50
std::vector< double > HGCEE_fCPerMIP_
std::unique_ptr< HGCalRecHitSimpleAlgo > rechitMaker_