CMS 3D CMS Logo

Public Member Functions | Private Member Functions

MatrixFillMap Class Reference

#include <MatrixFillMap.h>

Inheritance diagram for MatrixFillMap:
VFillMap

List of all members.

Public Member Functions

void fillMap (const std::vector< std::pair< DetId, float > > &, const DetId, const EcalRecHitCollection *, const EcalRecHitCollection *, std::map< int, double > &xtlMap, double &)
 The Map filler.
 MatrixFillMap (int, int, std::map< int, int >, double, double, std::map< int, int >, EcalIntercalibConstantMap *, EcalIntercalibConstantMap *)
 ctor
 ~MatrixFillMap ()
 dtor

Private Member Functions

void fillEBMap (EBDetId, const EcalRecHitCollection *, std::map< int, double > &, int, double &)
 takes care of the Barrel
void fillEEMap (EEDetId, const EcalRecHitCollection *, std::map< int, double > &, int, double &)
 takes care of the Endcap

Detailed Description

Definition at line 7 of file MatrixFillMap.h.


Constructor & Destructor Documentation

MatrixFillMap::MatrixFillMap ( int  WindowX,
int  WindowY,
std::map< int, int >  xtalReg,
double  minE,
double  maxE,
std::map< int, int >  IndexReg,
EcalIntercalibConstantMap barrelMap,
EcalIntercalibConstantMap endcapMap 
)

ctor

Definition at line 6 of file MatrixFillMap.cc.

                                              : 

         VFillMap (WindowX,WindowY,xtalReg,minE,
                maxE, IndexReg,
                barrelMap,endcapMap)
        {
        }
MatrixFillMap::~MatrixFillMap ( )

dtor

Definition at line 21 of file MatrixFillMap.cc.

        {
        }

Member Function Documentation

void MatrixFillMap::fillEBMap ( EBDetId  EBmax,
const EcalRecHitCollection barrelHitsCollection,
std::map< int, double > &  EBRegionMap,
int  EBNumberOfRegion,
double &  pSubtract 
) [private]

takes care of the Barrel

Definition at line 49 of file MatrixFillMap.cc.

References abs, EBDetId::ETAPHIMODE, edm::SortedCollection< T, SORT >::find(), EBDetId::ieta(), cuy::ii, EBDetId::iphi(), edm::isNotFinite(), VFillMap::m_IndexInRegion, VFillMap::m_maxEnergyPerCrystal, VFillMap::m_minEnergyPerCrystal, VFillMap::m_recoWindowSidex, VFillMap::m_recoWindowSidey, VFillMap::m_xtalRegionId, DetId::rawId(), and EBDetId::validDetId().

Referenced by fillMap().

{
  int curr_eta;
  int curr_phi;
  //reads the hits in a recoWindowSide^2 wide region around the MOX
  for (int ii = 0 ; ii< m_recoWindowSidex ; ++ii)
   for (int ij =0 ; ij< m_recoWindowSidey ; ++ij) 
   {
    curr_eta=EBmax.ieta() + ii - (m_recoWindowSidex/2);
    curr_phi=EBmax.iphi() + ij - (m_recoWindowSidey/2);
    //skips if the xtals matrix falls over the border
    if (abs(curr_eta)>85) continue;
    //Couples with the zero gap in the barrel eta index
    if (curr_eta * EBmax.ieta() <= 0) {
            if (EBmax.ieta() > 0) curr_eta--; 
              else curr_eta++;
        } // JUMP over 0
    //The following 2 couples with the ciclicity of the phiIndex
    if (curr_phi < 1) curr_phi += 360;
    if (curr_phi >= 360) curr_phi -= 360;
    //checks if the detId is valid
    if(EBDetId::validDetId(curr_eta,curr_phi))
     {
      EBDetId det = EBDetId(curr_eta,curr_phi,EBDetId::ETAPHIMODE);
      int ID= det.rawId();
      //finds the hit corresponding to the cell
      EcalRecHitCollection::const_iterator curr_recHit = barrelHitsCollection->find(det) ;
      double dummy = 0;
      dummy = curr_recHit->energy () ;
      //checks if the reading of the xtal is in a sensible range
      if (edm::isNotFinite(dummy)){
          dummy=0;
       }        
      if ( dummy < m_minEnergyPerCrystal) continue; 
      if (dummy > m_maxEnergyPerCrystal)  continue;
     //corrects the energy with the calibration coeff of the ring
      dummy *= (*m_barrelMap)[det];
      //sums the energy of the xtal to the appropiate ring
      if (m_xtalRegionId[ID]==EBNumberOfRegion)
        EBRegionMap[m_IndexInRegion[ID]]+= dummy;
      //adds the reading to pSubtract when part of the matrix is outside the region
      else pSubtract +=dummy; 
     }
   }
}
void MatrixFillMap::fillEEMap ( EEDetId  EEmax,
const EcalRecHitCollection endcapHitsCollection,
std::map< int, double > &  EExtlMap,
int  EENumberOfRegion,
double &  pSubtract 
) [private]

takes care of the Endcap

Definition at line 98 of file MatrixFillMap.cc.

References edm::SortedCollection< T, SORT >::find(), cuy::ii, edm::isNotFinite(), EEDetId::ix(), EEDetId::iy(), VFillMap::m_IndexInRegion, VFillMap::m_maxEnergyPerCrystal, VFillMap::m_minEnergyPerCrystal, VFillMap::m_recoWindowSidex, VFillMap::m_recoWindowSidey, VFillMap::m_xtalRegionId, DetId::rawId(), EEDetId::validDetId(), EEDetId::XYMODE, and EEDetId::zside().

Referenced by fillMap().

{
 int curr_x;
 int curr_y;
 for (int ii = 0 ; ii< m_recoWindowSidex ; ++ii)
  for (int ij =0 ; ij< m_recoWindowSidey ; ++ij) 
 {
  //Works as fillEBMap
  curr_x = EEmax.ix() - m_recoWindowSidex/2 +ii;
  curr_y = EEmax.iy() - m_recoWindowSidey /2 +ij;
  if(EEDetId::validDetId(curr_x,curr_y,EEmax.zside()))
  {
   EEDetId det = EEDetId(curr_x,curr_y,EEmax.zside(),EEDetId::XYMODE);
   int ID=det.rawId();
   EcalRecHitCollection::const_iterator curr_recHit = endcapHitsCollection->find(det) ;
   double dummy = curr_recHit->energy () ;
   if (edm::isNotFinite(dummy)) {
     dummy=0;
   }
   if ( dummy < m_minEnergyPerCrystal ) continue; 
   if ( dummy > m_maxEnergyPerCrystal ) {
        dummy=0;
        continue;
   }
   dummy *= (*m_endcapMap)[det];
   if (m_xtalRegionId[ID]==EENumberOfRegion)
      EExtlMap[m_IndexInRegion[ID]] += dummy;
   else pSubtract +=dummy; 
  }
 }
}
void MatrixFillMap::fillMap ( const std::vector< std::pair< DetId, float > > &  ,
const DetId  ,
const EcalRecHitCollection ,
const EcalRecHitCollection ,
std::map< int, double > &  xtlMap,
double &   
) [virtual]

The Map filler.

Implements VFillMap.

Definition at line 27 of file MatrixFillMap.cc.

References EcalBarrel, EcalEndcap, fillEBMap(), fillEEMap(), VFillMap::m_xtalRegionId, siStripFEDMonitor_P5_cff::Max, DetId::rawId(), and DetId::subdetId().

{
        if (Max.subdetId() == EcalBarrel ){
                EBDetId EBMax = Max;
                fillEBMap (EBMax, barrelHitsCollection, xtlMap,
                     m_xtalRegionId[Max.rawId()], pSubtract ) ;
         }
        else if (Max.subdetId()== EcalEndcap){
               EEDetId EEMax = Max;
               fillEEMap (EEMax, endcapHitsCollection, xtlMap,
                     m_xtalRegionId[Max.rawId()],pSubtract ) ;
        }
}