Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:35:04

0001 #ifndef EcalRingCalibrationTools_h
0002 #define EcalRingCalibrationTools_h
0003 
0004 /****************************************
0005  *
0006  *   25/09/2007 P. Meridiani (CERN)
0007  *   Description:
0008  *   Tools to ease the hanling of indices  
0009  *   for ECAL ring intercalibration
0010  *
0011  ***************************************/
0012 
0013 #include <vector>
0014 #include <mutex>
0015 #include <atomic>
0016 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0017 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0018 #include "FWCore/Utilities/interface/thread_safety_macros.h"
0019 
0020 class DetId;
0021 class CaloGeometry;
0022 
0023 class EcalRingCalibrationTools {
0024 public:
0025   EcalRingCalibrationTools() {}
0026   ~EcalRingCalibrationTools() {}
0027 
0028   /// Retrieve the phi-ring index corresponding to a DetId
0029   static short getRingIndex(DetId aDetId);
0030 
0031   static short getModuleIndex(DetId aDetId);
0032 
0033   /// Retrieve the DetIds in a phi-ring
0034   static std::vector<DetId> getDetIdsInRing(short aRingIndex);
0035   static std::vector<DetId> getDetIdsInModule(short int);
0036   static std::vector<DetId> getDetIdsInECAL();
0037 
0038   static constexpr short N_RING_TOTAL = 248;
0039   static constexpr short N_RING_BARREL = 170;
0040   static constexpr short N_RING_ENDCAP = 78;
0041 
0042   static constexpr short N_MODULES_BARREL = 144;
0043 
0044   static void setCaloGeometry(const CaloGeometry* geometry);
0045 
0046 private:
0047   static void initializeFromGeometry(CaloGeometry const* geometry);  // needed only for the endcap
0048 
0049   static std::atomic<bool> isInitializedFromGeometry_;
0050 
0051   CMS_THREAD_GUARD(isInitializedFromGeometry_)
0052   static short endcapRingIndex_[EEDetId::IX_MAX][EEDetId::IY_MAX];  // array needed only for the endcaps
0053 
0054   static std::once_flag once_;
0055 };
0056 #endif