Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:32

0001 #ifndef FastSimulation_CaloGeometryTools_CaloGeometryHelper
0002 #define FastSimulation_CaloGeometryTools_CaloGeometryHelper
0003 
0004 #include "FastSimulation/CalorimeterProperties/interface/Calorimeter.h"
0005 #include "Geometry/CaloTopology/interface/CaloDirection.h"
0006 #include "FastSimulation/CaloGeometryTools/interface/BaseCrystal.h"
0007 
0008 #include <vector>
0009 #include <array>
0010 
0011 class DetId;
0012 class Crystal;
0013 
0014 namespace edm {
0015   class ParameterSet;
0016 }
0017 
0018 class CaloGeometryHelper : public Calorimeter {
0019 public:
0020   typedef math::XYZVector XYZVector;
0021   typedef math::XYZVector XYZPoint;
0022 
0023   CaloGeometryHelper();
0024   CaloGeometryHelper(const edm::ParameterSet& fastCalo);
0025   ~CaloGeometryHelper();
0026 
0027   // more user friendly getClosestCell
0028   DetId getClosestCell(const XYZPoint& point, bool ecal, bool central) const;
0029 
0030   // more user friendly getWindow
0031   void getWindow(const DetId& pivot, int s1, int s2, std::vector<DetId>&) const;
0032 
0033   double preshowerZPosition(int layer) const { return (layer == 1) ? psLayer1Z_ : psLayer2Z_; }
0034 
0035   // the Crystal constructor
0036   void buildCrystal(const DetId& id, Crystal&) const;
0037 
0038   void initialize(double bField);
0039 
0040   // get the <=8 neighbours
0041   typedef std::array<DetId, 8> NeiVect;
0042   const NeiVect& getNeighbours(const DetId& det) const;
0043 
0044   inline double magneticField() const { return bfield_; }
0045 
0046   // temporary. Requires a missing geometry tool
0047   bool borderCrossing(const DetId&, const DetId&) const;
0048 
0049   bool move(DetId& cell, const CaloDirection& dir, bool fast = true) const;
0050 
0051   inline bool preshowerPresent() const { return preshowerPresent_; };
0052 
0053 private:
0054   void buildNeighbourArray();
0055   void buildCrystalArray();
0056   bool simplemove(DetId& cell, const CaloDirection& dir) const;
0057   bool diagonalmove(DetId& cell, const CaloDirection& dir) const;
0058 
0059 private:
0060   // Preshower layer positions
0061   double psLayer1Z_, psLayer2Z_;
0062 
0063   // array of neighbours the hashed index is used for the first vector
0064   std::vector<NeiVect> barrelNeighbours_;
0065   std::vector<NeiVect> endcapNeighbours_;
0066 
0067   std::vector<BaseCrystal> barrelCrystals_;
0068   std::vector<BaseCrystal> endcapCrystals_;
0069 
0070   bool neighbourmapcalculated_;
0071 
0072   //mag field at 0,0,0
0073   double bfield_;
0074   bool preshowerPresent_;
0075 };
0076 #endif