Go to the documentation of this file.00001
00002 #include "FastSimulation/CaloGeometryTools/interface/CrystalWindowMap.h"
00003 #include "FastSimulation/CaloGeometryTools/interface/CaloGeometryHelper.h"
00004
00005 #include <algorithm>
00006
00007 CrystalWindowMap::CrystalWindowMap(const CaloGeometryHelper *calo,const std::vector<Crystal> & cw):
00008 myCalorimeter_(calo),originalVector_(cw)
00009 {
00010 size_=cw.size();
00011 if(size_==0) return;
00012
00013
00014 myNeighbours_.resize(size_);
00015
00016 for(unsigned ic=0; ic<size_; ++ic)
00017 {
00018 const std::vector<DetId>& neighbours=myCalorimeter_->getNeighbours(cw[ic].getDetId());
00019 myNeighbours_[ic].reserve(8);
00020 for(unsigned in=0; in<8;++in)
00021 {
00022
00023
00024 Crystal::crystalEqual myCrystal(neighbours[in]);
00025 std::vector<Crystal>::const_iterator itcheck;
00026 itcheck=find_if(cw.begin(),cw.end(),myCrystal);
00027
00028 if(itcheck==cw.end())
00029 {
00030
00031
00032
00033
00034
00035
00036
00037
00038 }
00039 else
00040 {
00041 myNeighbours_[ic].push_back(itcheck-cw.begin());
00042
00043 }
00044 }
00045 }
00046 }
00047
00048 bool
00049 CrystalWindowMap::getCrystalWindow(unsigned iq,std::vector<unsigned>& cw ) const
00050 {
00051 if(iq<size_)
00052 {
00053 cw=myNeighbours_[iq];
00054 return true;
00055 }
00056 else
00057 return false;
00058 }
00059
00060 bool
00061 CrystalWindowMap::getCrystalWindow(unsigned iq,const std::vector<unsigned>* cw) const
00062 {
00063
00064 if(iq<size_)
00065 {
00066 cw=&myNeighbours_[iq];
00067 return true;
00068 }
00069 else
00070 return false;
00071
00072 }
00073
00074 const std::vector<unsigned>&
00075 CrystalWindowMap::getCrystalWindow(unsigned iq, bool& status) const
00076 {
00077 return myNeighbours_[iq];
00078 }
00079