CMS 3D CMS Logo

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 public:
22 
24  CaloGeometryHelper(const edm::ParameterSet& fastCalo);
26 
27  // more user friendly getClosestCell
28  DetId getClosestCell(const XYZPoint& point, bool ecal, bool central) const;
29 
30  // more user friendly getWindow
31  void getWindow(const DetId& pivot, int s1, int s2, std::vector<DetId>&) const;
32 
33  double preshowerZPosition(int layer) const { return (layer == 1) ? psLayer1Z_ : psLayer2Z_; }
34 
35  // the Crystal constructor
36  void buildCrystal(const DetId& id, Crystal&) const;
37 
38  void initialize(double bField);
39 
40  // get the <=8 neighbours
41  typedef std::array<DetId, 8> NeiVect;
42  const NeiVect& getNeighbours(const DetId& det) const;
43 
44  inline double magneticField() const { return bfield_; }
45 
46  // temporary. Requires a missing geometry tool
47  bool borderCrossing(const DetId&, const DetId&) const;
48 
49  bool move(DetId& cell, const CaloDirection& dir, bool fast = true) const;
50 
51  inline bool preshowerPresent() const { return preshowerPresent_; };
52 
53 private:
54  void buildNeighbourArray();
55  void buildCrystalArray();
56  bool simplemove(DetId& cell, const CaloDirection& dir) const;
57  bool diagonalmove(DetId& cell, const CaloDirection& dir) const;
58 
59 private:
60  // Preshower layer positions
62 
63  // array of neighbours the hashed index is used for the first vector
64  std::vector<NeiVect> barrelNeighbours_;
65  std::vector<NeiVect> endcapNeighbours_;
66 
67  std::vector<BaseCrystal> barrelCrystals_;
68  std::vector<BaseCrystal> endcapCrystals_;
69 
71 
72  //mag field at 0,0,0
73  double bfield_;
75 };
76 #endif
bool preshowerPresent() const
void buildCrystal(const DetId &id, Crystal &) const
DetId getClosestCell(const XYZPoint &point, bool ecal, bool central) const
double preshowerZPosition(int layer) const
math::XYZVector XYZVector
void getWindow(const DetId &pivot, int s1, int s2, std::vector< DetId > &) const
std::vector< NeiVect > barrelNeighbours_
std::array< DetId, 8 > NeiVect
std::vector< NeiVect > endcapNeighbours_
bool simplemove(DetId &cell, const CaloDirection &dir) const
math::XYZVector XYZPoint
const NeiVect & getNeighbours(const DetId &det) const
std::vector< BaseCrystal > endcapCrystals_
bool move(DetId &cell, const CaloDirection &dir, bool fast=true) const
Definition: DetId.h:17
bool borderCrossing(const DetId &, const DetId &) const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
double magneticField() const
HLT enums.
bool diagonalmove(DetId &cell, const CaloDirection &dir) const
std::vector< BaseCrystal > barrelCrystals_
CaloDirection
Codes the local directions in the cell lattice.
Definition: CaloDirection.h:9
void initialize(double bField)
*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