Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:30

0001 #ifndef CondCore_SiPhase2TrackerObjects_SiPhase2OuterTrackerLorentzAngle_h
0002 #define CondCore_SiPhase2TrackerObjects_SiPhase2OuterTrackerLorentzAngle_h
0003 
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0006 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0007 
0008 #include <vector>
0009 #include <map>
0010 #include <iostream>
0011 #include <cstdint>
0012 
0013 /**
0014  * Stores the Lorentz Angle value for all DetIds.
0015  * The values are saved internally in a std::unordered_map<detid, lorentzAngle>.
0016  * It can be filled either by the complete map (putLorentzAngles) or passing
0017  * a single detIds and lorentzAngles (putLorentzAngle).
0018  * In the same way getLorentzAngles returns the complete map, while getLorentzAngle
0019  * the value corresponding to a given DetId.
0020  * The three methods getLorentzAngles_PSP, getLorentzAngles_PSS and getLorentzAngles_2S
0021  * are provided to retrieve by reference the Lorentz Angle values map for the P- and S- sensors,
0022  * in the PS modules separately, as well as the values for the S-senors in the 2S modules.
0023  * The printDebug method prints LorentzAngles for all detIds.
0024  */
0025 
0026 class SiPhase2OuterTrackerLorentzAngle {
0027 public:
0028   SiPhase2OuterTrackerLorentzAngle(){};
0029   ~SiPhase2OuterTrackerLorentzAngle(){};
0030 
0031   inline void putLorentzAngles(std::unordered_map<unsigned int, float>& LA) { m_LA = LA; }
0032   inline const std::unordered_map<unsigned int, float>& getLorentzAngles() const { return m_LA; }
0033 
0034   void getLorentzAngles_PSP(const TrackerGeometry* geo, std::unordered_map<unsigned int, float>& out) const {
0035     getLorentzAnglesByModuleType(geo, TrackerGeometry::ModuleType::Ph2PSP, out);
0036   }
0037 
0038   void getLorentzAngles_PSS(const TrackerGeometry* geo, std::unordered_map<unsigned int, float>& out) const {
0039     getLorentzAnglesByModuleType(geo, TrackerGeometry::ModuleType::Ph2PSS, out);
0040   }
0041 
0042   void getLorentzAngles_2S(const TrackerGeometry* geo, std::unordered_map<unsigned int, float>& out) const {
0043     getLorentzAnglesByModuleType(geo, TrackerGeometry::ModuleType::Ph2SS, out);
0044   }
0045 
0046   bool putLorentzAngle(const uint32_t&, float);
0047   float getLorentzAngle(const uint32_t&) const;
0048 
0049   // Prints LorentzAngles for all detIds.
0050   void printDebug(std::stringstream& ss, const TrackerTopology* trackerTopo) const;
0051 
0052 private:
0053   void getLorentzAnglesByModuleType(const TrackerGeometry* trackerGeometry,
0054                                     const TrackerGeometry::ModuleType& theType,
0055                                     std::unordered_map<unsigned int, float>& out) const;
0056 
0057   std::unordered_map<unsigned int, float> m_LA;
0058 
0059   COND_SERIALIZABLE;
0060 };
0061 
0062 #endif