CMS 3D CMS Logo

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::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_.

9  size_ = cw.size();
10  if (size_ == 0)
11  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  const CaloGeometryHelper::NeiVect& neighbours = myCalorimeter_->getNeighbours(cw[ic].getDetId());
18  myNeighbours_[ic].reserve(8);
19  for (unsigned in = 0; in < 8; ++in) {
20  // Check that the crystal is in the grid
21 
22  Crystal::crystalEqual myCrystal(neighbours[in]);
23  std::vector<Crystal>::const_iterator itcheck;
24  itcheck = find_if(cw.begin(), cw.end(), myCrystal);
25  // The neighbour might not be in the grid
26  if (itcheck == cw.end()) {
27  // std::cout << " Ouh la " << std::endl;
28  // for(unsigned ic=0;ic<size_;++ic)
29  // {
30  // std::cout << cw[ic].getDetId().rawId()<< " " ;
31  // }
32  // std::cout << std::endl ;
33  // std::cout << " We are looking for " << neighbours[in].rawId() << std::endl;
34  // edm::LogWarning("CrystalWindowMap") << " Inconsistency in the CellWindow " << std::endl;
35  } else {
36  myNeighbours_[ic].push_back(itcheck - cw.begin());
37  // std::cout << " index " << itcheck-cw.begin() << std::endl;
38  }
39  }
40  }
41 }
const std::vector< Crystal > & originalVector_
std::array< DetId, 8 > NeiVect
std::vector< std::vector< unsigned > > myNeighbours_
const NeiVect & getNeighbours(const DetId &det) const
Definition: Common.h:9
const CaloGeometryHelper * myCalorimeter_

◆ ~CrystalWindowMap()

CrystalWindowMap::~CrystalWindowMap ( )
inline

Definition at line 27 of file CrystalWindowMap.h.

27 { ; };

Member Function Documentation

◆ getCrystalWindow() [1/3]

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 43 of file CrystalWindowMap.cc.

References myNeighbours_, and size_.

Referenced by EcalHitMaker::fastInsideCell().

43  {
44  if (iq < size_) // iq >= 0, since iq is unsigned
45  {
46  cw = myNeighbours_[iq];
47  return true;
48  } else
49  return false;
50 }
std::vector< std::vector< unsigned > > myNeighbours_

◆ getCrystalWindow() [2/3]

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

same thing but with a different interface

Definition at line 52 of file CrystalWindowMap.cc.

References myNeighbours_, and size_.

52  {
53  if (iq < size_) // iq >= 0, since iq is unsigned
54  {
55  cw = &myNeighbours_[iq];
56  return true;
57  } else
58  return false;
59  // std::map<CrystalID,CrystalWindow>::const_iterator itcheck=myMap.find(cell);
60 }
std::vector< std::vector< unsigned > > myNeighbours_

◆ getCrystalWindow() [3/3]

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

same thing but with a different interface

Definition at line 62 of file CrystalWindowMap.cc.

References myNeighbours_.

62  {
63  return myNeighbours_[iq];
64 }
std::vector< std::vector< unsigned > > myNeighbours_

◆ size()

unsigned CrystalWindowMap::size ( void  ) const
inline

Definition at line 35 of file CrystalWindowMap.h.

References size_.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

35 { return size_; }

Member Data Documentation

◆ myCalorimeter_

const CaloGeometryHelper* CrystalWindowMap::myCalorimeter_
private

Definition at line 38 of file CrystalWindowMap.h.

Referenced by CrystalWindowMap().

◆ myNeighbours_

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

Definition at line 43 of file CrystalWindowMap.h.

Referenced by CrystalWindowMap(), and getCrystalWindow().

◆ originalVector_

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

Definition at line 41 of file CrystalWindowMap.h.

◆ size_

unsigned CrystalWindowMap::size_
private

Definition at line 40 of file CrystalWindowMap.h.

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