CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloGeometryHelper.h
Go to the documentation of this file.
1 #ifndef FastSimulation_CaloGeometryTools_CaloGeometryHelper
2 #define FastSimulation_CaloGeometryTools_CaloGeometryHelper
3 
7 
8 #include <vector>
9 #include <array>
10 
11 class DetId;
12 class Crystal;
13 
14 namespace edm {
15  class ParameterSet;
16 }
17 
19 {
20 
21  public:
22 
25 
27  CaloGeometryHelper(const edm::ParameterSet& fastCalo);
29 
30 
31  // more user friendly getClosestCell
32  DetId getClosestCell(const XYZPoint& point, bool ecal, bool central) const;
33 
34  // more user friendly getWindow
35  void getWindow(const DetId& pivot,int s1,int s2,std::vector<DetId> &) const;
36 
37 
38  double preshowerZPosition(int layer) const
39  {
40  return (layer==1) ? psLayer1Z_: psLayer2Z_ ;
41  }
42 
43  // the Crystal constructor
44  void buildCrystal(const DetId& id,Crystal&) const;
45 
46  void initialize(double bField);
47 
48  // get the <=8 neighbours
49  typedef std::array<DetId,8> NeiVect;
50  const NeiVect& getNeighbours(const DetId& det) const ;
51 
52  inline double magneticField() const {return bfield_;}
53 
54  // temporary. Requires a missing geometry tool
55  bool borderCrossing(const DetId&, const DetId&) const ;
56 
57  bool move(DetId& cell, const CaloDirection& dir,bool fast=true) const;
58 
59  inline bool preshowerPresent() const {return preshowerPresent_;};
60 
61  private:
62  void buildNeighbourArray();
63  void buildCrystalArray();
64  bool simplemove(DetId& cell, const CaloDirection& dir) const;
65  bool diagonalmove(DetId& cell, const CaloDirection& dir) const;
66 
67  private:
68  // Preshower layer positions
70 
71  // array of neighbours the hashed index is used for the first vector
72  std::vector< NeiVect > barrelNeighbours_;
73  std::vector< NeiVect > endcapNeighbours_;
74 
75  std::vector<BaseCrystal> barrelCrystals_;
76  std::vector<BaseCrystal> endcapCrystals_;
77 
79 
80  //mag field at 0,0,0
81  double bfield_;
83 };
84 #endif
double preshowerZPosition(int layer) const
void buildCrystal(const DetId &id, Crystal &) const
math::XYZVector XYZVector
std::vector< NeiVect > endcapNeighbours_
bool borderCrossing(const DetId &, const DetId &) const
tuple s2
Definition: indexGen.py:106
math::XYZVector XYZPoint
std::vector< BaseCrystal > endcapCrystals_
double magneticField() const
std::vector< NeiVect > barrelNeighbours_
Definition: DetId.h:18
bool diagonalmove(DetId &cell, const CaloDirection &dir) const
std::array< DetId, 8 > NeiVect
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
void getWindow(const DetId &pivot, int s1, int s2, std::vector< DetId > &) const
bool preshowerPresent() const
std::vector< BaseCrystal > barrelCrystals_
dbl *** dir
Definition: mlp_gen.cc:35
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
void initialize(double bField)
bool simplemove(DetId &cell, const CaloDirection &dir) const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
const NeiVect & getNeighbours(const DetId &det) const
bool move(DetId &cell, const CaloDirection &dir, bool fast=true) const