CMS 3D CMS Logo

Public Member Functions | Private Attributes

CrystalWindowMap Class Reference

#include <CrystalWindowMap.h>

List of all members.

Public Member Functions

 CrystalWindowMap (const CaloGeometryHelper *, const std::vector< Crystal > &cw)
 Constructor from vector of Crystal.
bool getCrystalWindow (unsigned iq, const std::vector< unsigned > *cw) const
 same thing but with a different interface
const std::vector< unsigned > & getCrystalWindow (unsigned, bool &status) const
 same thing but with a different interface
bool getCrystalWindow (unsigned, std::vector< unsigned > &) const
 get the ordered list of the crystals around the crystal given as a first argument
unsigned size () const
 ~CrystalWindowMap ()

Private Attributes

const CaloGeometryHelpermyCalorimeter_
std::vector< std::vector
< unsigned > > 
myNeighbours_
const std::vector< Crystal > & originalVector_
unsigned size_

Detailed Description

Definition at line 23 of file CrystalWindowMap.h.


Constructor & Destructor Documentation

CrystalWindowMap::CrystalWindowMap ( const CaloGeometryHelper calo,
const std::vector< Crystal > &  cw 
)

Constructor from vector of Crystal.

Definition at line 7 of file CrystalWindowMap.cc.

References CaloGeometryHelper::getNeighbours(), recoMuon::in, myCalorimeter_, myNeighbours_, and size_.

                                                                                              :
  myCalorimeter_(calo),originalVector_(cw)
{
  size_=cw.size();
  if(size_==0) return;
  
  // Loop over the crystals in the grid and stores the index number of the 8 neighbours
  myNeighbours_.resize(size_);

  for(unsigned ic=0; ic<size_; ++ic)
    {
      const std::vector<DetId>& neighbours=myCalorimeter_->getNeighbours(cw[ic].getDetId());
      myNeighbours_[ic].reserve(8);
      for(unsigned in=0; in<8;++in)
        {
          // Check that the crystal is in the grid

          Crystal::crystalEqual myCrystal(neighbours[in]);
          std::vector<Crystal>::const_iterator itcheck;
          itcheck=find_if(cw.begin(),cw.end(),myCrystal);
          // The neighbour might not be in the grid
          if(itcheck==cw.end())
            {
//            std::cout << " Ouh la " << std::endl;
//            for(unsigned ic=0;ic<size_;++ic)
//              {
//                std::cout << cw[ic].getDetId().rawId()<<  " " ;
//              }
//            std::cout << std::endl ; 
//            std::cout << " We are looking for " << neighbours[in].rawId() << std::endl;
//            edm::LogWarning("CrystalWindowMap") << " Inconsistency in the CellWindow " << std::endl;      
            }
          else
            {
              myNeighbours_[ic].push_back(itcheck-cw.begin());
              //              std::cout << " index " << itcheck-cw.begin() << std::endl;
            }
        }
    }
}
CrystalWindowMap::~CrystalWindowMap ( ) [inline]

Definition at line 28 of file CrystalWindowMap.h.

{;};

Member Function Documentation

bool CrystalWindowMap::getCrystalWindow ( unsigned  iq,
std::vector< unsigned > &  cw 
) const

get the ordered list of the crystals around the crystal given as a first argument

Definition at line 49 of file CrystalWindowMap.cc.

References myNeighbours_, and size_.

Referenced by EcalHitMaker::fastInsideCell().

{
  if(iq<size_) // iq >= 0, since iq is unsigned
    {
      cw=myNeighbours_[iq];
      return true;
    }
  else
    return false;
}
bool CrystalWindowMap::getCrystalWindow ( unsigned  iq,
const std::vector< unsigned > *  cw 
) const

same thing but with a different interface

Definition at line 61 of file CrystalWindowMap.cc.

References myNeighbours_, and size_.

{
  
  if(iq<size_) // iq >= 0, since iq is unsigned
    {
      cw=&myNeighbours_[iq];
      return true;
    }
  else
    return false;
    //  std::map<CrystalID,CrystalWindow>::const_iterator itcheck=myMap.find(cell);
}
const std::vector< unsigned > & CrystalWindowMap::getCrystalWindow ( unsigned  iq,
bool &  status 
) const

same thing but with a different interface

Definition at line 75 of file CrystalWindowMap.cc.

References myNeighbours_.

{
  return myNeighbours_[iq];
}
unsigned CrystalWindowMap::size ( void  ) const [inline]

Definition at line 36 of file CrystalWindowMap.h.

References size_.

{return size_;}

Member Data Documentation

Definition at line 39 of file CrystalWindowMap.h.

Referenced by CrystalWindowMap().

std::vector< std::vector<unsigned> > CrystalWindowMap::myNeighbours_ [private]

Definition at line 44 of file CrystalWindowMap.h.

Referenced by CrystalWindowMap(), and getCrystalWindow().

const std::vector<Crystal>& CrystalWindowMap::originalVector_ [private]

Definition at line 42 of file CrystalWindowMap.h.

unsigned CrystalWindowMap::size_ [private]

Definition at line 41 of file CrystalWindowMap.h.

Referenced by CrystalWindowMap(), getCrystalWindow(), and size().