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