CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  } else if (idsIt->first.subdetId() == EcalEndcap) {
35  itrechit = endcapHitsCollection->find(idsIt->first);
36  dummy = itrechit->energy();
37  dummy *= (*m_endcapMap)[idsIt->first];
38  }
39  if (edm::isNotFinite(dummy)) {
40  dummy = 0;
41  }
42  if (dummy < m_minEnergyPerCrystal)
43  continue; //return 1;
44  if (dummy > m_maxEnergyPerCrystal) {
45  continue;
46  }
47  int ID = idsIt->first.rawId();
48  if (m_xtalRegionId[ID] == RegionNumber)
49  xtlMap[m_IndexInRegion[ID]] += dummy;
50  else
51  pSubtract += dummy;
52  }
53 }
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.