CMS 3D CMS Logo

ClusterFillMap.cc
Go to the documentation of this file.
5 
7  int WindowY,
8  const std::map<int, int>& xtalReg,
9  double minE,
10  double maxE,
11  const std::map<int, int>& IndexReg,
12  EcalIntercalibConstantMap* barrelMap,
13  EcalIntercalibConstantMap* endcapMap)
14  : VFillMap(WindowX, WindowY, xtalReg, minE, maxE, IndexReg, barrelMap, endcapMap)
15 
16 {}
17 
19 
20 void ClusterFillMap::fillMap(const std::vector<std::pair<DetId, float> >& v1,
21  const DetId Max,
22  const EcalRecHitCollection* barrelHitsCollection,
23  const EcalRecHitCollection* endcapHitsCollection,
24  std::map<int, double>& xtlMap,
25  double& pSubtract) {
26  for (std::vector<std::pair<DetId, float> >::const_iterator idsIt = v1.begin(); idsIt != v1.end(); ++idsIt) {
27  int RegionNumber = m_xtalRegionId[Max.rawId()];
29  double dummy = 0.;
30  if (idsIt->first.subdetId() == EcalBarrel) {
31  itrechit = barrelHitsCollection->find(idsIt->first);
32  dummy = itrechit->energy();
33  dummy *= (*m_barrelMap)[idsIt->first];
34  }
35  if (idsIt->first.subdetId() == EcalEndcap) {
36  itrechit = endcapHitsCollection->find(idsIt->first);
37  dummy = itrechit->energy();
38  dummy *= (*m_endcapMap)[idsIt->first];
39  }
40  int ID = idsIt->first.rawId();
41  if (edm::isNotFinite(dummy)) {
42  dummy = 0;
43  }
44  if (dummy < m_minEnergyPerCrystal)
45  continue; //return 1;
46  if (dummy > m_maxEnergyPerCrystal) {
47  dummy = 0;
48  continue;
49  }
50  if (m_xtalRegionId[ID] == RegionNumber)
51  xtlMap[m_IndexInRegion[ID]] += dummy;
52  else
53  pSubtract += dummy;
54  }
55 }
double m_maxEnergyPerCrystal
Definition: VFillMap.h:38
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
uint32_t ID
Definition: Definitions.h:24
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
std::vector< EcalRecHit >::const_iterator const_iterator
ClusterFillMap(int, int, const std::map< int, int > &, double, double, const std::map< int, int > &, EcalIntercalibConstantMap *, EcalIntercalibConstantMap *)
ctor
std::map< int, int > m_IndexInRegion
Definition: VFillMap.h:39
double m_minEnergyPerCrystal
Definition: VFillMap.h:37
~ClusterFillMap() override
dtor
T Max(T a, T b)
Definition: MathUtil.h:44
Definition: DetId.h:17
iterator find(key_type k)
std::map< int, int > m_xtalRegionId
Definition: VFillMap.h:36
void fillMap(const std::vector< std::pair< DetId, float > > &, const DetId, const EcalRecHitCollection *, const EcalRecHitCollection *, std::map< int, double > &xtlMap, double &) override
Fills the map.