CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

CalibrationCluster Class Reference

#include <CalibrationCluster.h>

List of all members.

Public Types

typedef std::map< EBDetId,
unsigned int > 
CalibMap
typedef CalibMap::value_type pippo

Public Member Functions

 CalibrationCluster ()
std::vector< EBDetIdget3x3Id (EBDetId const &)
std::vector< EBDetIdget5x5Id (EBDetId const &)
std::vector< float > getEnergyVector (const EBRecHitCollection *, CalibMap &, std::vector< EBDetId > &, float &, int &)
CalibMap getMap (int, int, int, int)
 ~CalibrationCluster ()

Private Attributes

CalibMap calibRegion
std::vector< float > energyVector
std::vector< EBDetIdXtals3x3
std::vector< EBDetIdXtals5x5

Detailed Description

Definition at line 13 of file CalibrationCluster.h.


Member Typedef Documentation

typedef std::map<EBDetId,unsigned int> CalibrationCluster::CalibMap

Definition at line 16 of file CalibrationCluster.h.

typedef CalibMap::value_type CalibrationCluster::pippo

Definition at line 17 of file CalibrationCluster.h.


Constructor & Destructor Documentation

CalibrationCluster::CalibrationCluster ( )

Definition at line 7 of file CalibrationCluster.cc.

                                      {

}
CalibrationCluster::~CalibrationCluster ( )

Definition at line 11 of file CalibrationCluster.cc.

                                       {
}

Member Function Documentation

std::vector< EBDetId > CalibrationCluster::get3x3Id ( EBDetId const &  maxHitId)

Definition at line 53 of file CalibrationCluster.cc.

References gather_cfg::cout, EBDetId::ETAPHIMODE, EBDetId::ieta(), and EBDetId::iphi().

                                                                       {

    Xtals3x3.clear();

    for (unsigned int icry=0;icry<9;icry++)
     {
       unsigned int row = icry / 3;
       unsigned int column= icry %3;
       
       
       try
         {
         Xtals3x3.push_back(EBDetId(maxHitId.ieta()+column-1,maxHitId.iphi()+row-1,EBDetId::ETAPHIMODE));
         }
       catch ( ... )
         {
           std::cout << "Cannot construct 3x3 matrix around EBDetId " << maxHitId << std::endl;
         }
     }

   return Xtals3x3;
}
std::vector< EBDetId > CalibrationCluster::get5x5Id ( EBDetId const &  maxHitId)

Definition at line 16 of file CalibrationCluster.cc.

References gather_cfg::cout, EBDetId::ETAPHIMODE, EBDetId::ieta(), and EBDetId::iphi().

Referenced by ElectronCalibration::analyze().

                                                                       {


   Xtals5x5.clear();
   
   
//   std::cout << "get5x5Id: max Containment crystal " << maxHitId.ic() << " eta " << maxHitId.ieta() << " phi " << maxHitId.iphi() << std::endl;

   for (unsigned int icry=0;icry<25;icry++)
     {
       unsigned int row = icry / 5;
       unsigned int column= icry %5;
//       std::cout << "CalibrationCluster::icry = " << icry << std::endl;
       
       int curr_eta=maxHitId.ieta() + column - (5/2);
       int curr_phi=maxHitId.iphi() + row - (5/2);
              
       if (curr_eta * maxHitId.ieta() <= 0) {if (maxHitId.ieta() > 0) curr_eta--; else curr_eta++; }  // JUMP over 0
       if (curr_phi < 1) curr_phi += 360;
       if (curr_phi > 360) curr_phi -= 360;
      
       try
         {
//         Xtals5x5.push_back(EBDetId(maxHitId.ieta()+column-2,maxHitId.iphi()+row-2,EBDetId::ETAPHIMODE));
         Xtals5x5.push_back(EBDetId(curr_eta,curr_phi,EBDetId::ETAPHIMODE));
         }
       catch ( ... )
         {
           std::cout << "Cannot construct 5x5 matrix around EBDetId " << maxHitId << std::endl;
         }
     }

   return Xtals5x5;
}
std::vector< float > CalibrationCluster::getEnergyVector ( const EBRecHitCollection hits,
CalibMap ReducedMap,
std::vector< EBDetId > &  XstalsNxN,
float &  outBoundEnergy,
int &  nXtalsOut 
)

Definition at line 110 of file CalibrationCluster.cc.

References relval_parameters_module::energy, and edm::SortedCollection< T, SORT >::find().

                                                                                                     {

 energyVector.clear();
 std::vector<EBDetId>::iterator it;

// std::cout << "Reduced Map Size =" << ReducedMap.size() << std::endl;
// std::cout << "XstalsNxN Size =" << XstalsNxN.size() << std::endl;
 energyVector.resize(ReducedMap.size(),0.);

   outBoundEnergy=0.;   
   nXtalsOut=0;
   for(it=XstalsNxN.begin();it!=XstalsNxN.end();++it)
   {
       if(ReducedMap.find(*it) != ReducedMap.end()){
       CalibMap::iterator  it2 = ReducedMap.find(*it);
   
       int icry = it2->second;
   
       energyVector[icry]=(hits->find(*it))->energy();
       
       } else {
       
//       std::cout << " Cell out of Reduced map: did you subtracted the cell energy from P ???" << std::endl;
       outBoundEnergy+=(hits->find(*it))->energy();
       nXtalsOut++;
       }
    }



return energyVector;

}
CalibrationCluster::CalibMap CalibrationCluster::getMap ( int  minEta,
int  maxEta,
int  minPhi,
int  maxPhi 
)

Definition at line 79 of file CalibrationCluster.cc.

References gather_cfg::cout, eta(), EBDetId::ETAPHIMODE, and phi.

Referenced by ElectronCalibration::beginJob().

                                                                                                   {
   
   calibRegion.clear();
   int rowSize=maxEta-minEta+1;
   int columnSize=maxPhi-minPhi+1;
   int reducedSize=rowSize*columnSize;
   

   for (int icry=0;icry<reducedSize;icry++)
     {
       unsigned int eta = minEta + icry/columnSize;
       unsigned int phi = minPhi + icry%columnSize;

       
       try
         {
         calibRegion.insert(pippo(EBDetId(eta,phi,EBDetId::ETAPHIMODE),icry));
         }
       catch ( ... )
         {
           std::cout << "Cannot construct full matrix !!! " << std::endl;
         }
     }

   return calibRegion;

}

Member Data Documentation

Definition at line 34 of file CalibrationCluster.h.

std::vector<float> CalibrationCluster::energyVector [private]

Definition at line 33 of file CalibrationCluster.h.

std::vector<EBDetId> CalibrationCluster::Xtals3x3 [private]

Definition at line 32 of file CalibrationCluster.h.

std::vector<EBDetId> CalibrationCluster::Xtals5x5 [private]

Definition at line 31 of file CalibrationCluster.h.