CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
CrystalWindowMap Class Reference

#include <CrystalWindowMap.h>

Public Member Functions

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

7  :
9 {
10  size_=cw.size();
11  if(size_==0) return;
12 
13  // Loop over the crystals in the grid and stores the index number of the 8 neighbours
14  myNeighbours_.resize(size_);
15 
16  for(unsigned ic=0; ic<size_; ++ic)
17  {
18  const std::vector<DetId>& neighbours=myCalorimeter_->getNeighbours(cw[ic].getDetId());
19  myNeighbours_[ic].reserve(8);
20  for(unsigned in=0; in<8;++in)
21  {
22  // Check that the crystal is in the grid
23 
24  Crystal::crystalEqual myCrystal(neighbours[in]);
25  std::vector<Crystal>::const_iterator itcheck;
26  itcheck=find_if(cw.begin(),cw.end(),myCrystal);
27  // The neighbour might not be in the grid
28  if(itcheck==cw.end())
29  {
30 // std::cout << " Ouh la " << std::endl;
31 // for(unsigned ic=0;ic<size_;++ic)
32 // {
33 // std::cout << cw[ic].getDetId().rawId()<< " " ;
34 // }
35 // std::cout << std::endl ;
36 // std::cout << " We are looking for " << neighbours[in].rawId() << std::endl;
37 // edm::LogWarning("CrystalWindowMap") << " Inconsistency in the CellWindow " << std::endl;
38  }
39  else
40  {
41  myNeighbours_[ic].push_back(itcheck-cw.begin());
42  // std::cout << " index " << itcheck-cw.begin() << std::endl;
43  }
44  }
45  }
46 }
const std::vector< DetId > & getNeighbours(const DetId &det) const
const std::vector< Crystal > & originalVector_
std::vector< std::vector< unsigned > > myNeighbours_
const CaloGeometryHelper * myCalorimeter_
CrystalWindowMap::~CrystalWindowMap ( )
inline

Definition at line 28 of file CrystalWindowMap.h.

28 {;};

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().

50 {
51  if(iq<size_) // iq >= 0, since iq is unsigned
52  {
53  cw=myNeighbours_[iq];
54  return true;
55  }
56  else
57  return false;
58 }
std::vector< std::vector< unsigned > > myNeighbours_
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_.

62 {
63 
64  if(iq<size_) // iq >= 0, since iq is unsigned
65  {
66  cw=&myNeighbours_[iq];
67  return true;
68  }
69  else
70  return false;
71  // std::map<CrystalID,CrystalWindow>::const_iterator itcheck=myMap.find(cell);
72 }
std::vector< std::vector< unsigned > > myNeighbours_
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_.

76 {
77  return myNeighbours_[iq];
78 }
std::vector< std::vector< unsigned > > myNeighbours_
unsigned CrystalWindowMap::size ( void  ) const
inline

Definition at line 36 of file CrystalWindowMap.h.

References size_.

36 {return size_;}

Member Data Documentation

const CaloGeometryHelper* CrystalWindowMap::myCalorimeter_
private

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().