Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:13

0001 #ifndef DataFormats_DTRangeMapAccessor_H
0002 #define DataFormats_DTRangeMapAccessor_H
0003 
0004 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0005 
0006 #include <utility>
0007 
0008 /** \class DTSuperLayerIdComparator
0009  *  Comparator to retrieve by SL objects written into a RangeMap by layer.
0010  *
0011  *  \author G. Cerminara - INFN Torino
0012  */
0013 
0014 class DTSuperLayerIdComparator {
0015 public:
0016   // Operations
0017   /// Compare two superLayerId
0018   bool operator()(DTSuperLayerId sl1, DTSuperLayerId sl2) const {
0019     if (sl1 == sl2)
0020       return false;
0021     return (sl1 < sl2);
0022   }
0023 
0024 private:
0025 };
0026 
0027 /** \class DTChamberIdComparator
0028  *  Comparator to retrieve  by chamber objects written into a RangeMap by layer or by SL.
0029  *
0030  *  \author G. Cerminara - INFN Torino
0031  */
0032 
0033 class DTChamberIdComparator {
0034 public:
0035   // Operations
0036   /// Compare two ChamberId
0037   bool operator()(DTChamberId ch1, DTChamberId ch2) const {
0038     if (ch1 == ch2)
0039       return false;
0040     return (ch1 < ch2);
0041   }
0042 
0043 private:
0044 };
0045 
0046 /** \class DTChamberIdDetLayerComparator
0047  *  Comparator to retrieve by chamber objects written into a RangeMap by DetLayer.
0048  *
0049  *  \author M. Sani 
0050  */
0051 
0052 class DTChamberIdDetLayerComparator {
0053 public:
0054   bool operator()(DTChamberId ch1, DTChamberId ch2) const {
0055     if (ch1.station() == ch2.station())
0056       return false;
0057 
0058     return (ch1.station() < ch2.station());
0059   }
0060 };
0061 
0062 /** \class DTRangeMapAccessor
0063  *  Utility class for access to objects in a RangeMap with needed granularity.
0064  *
0065  *  \author G. Cerminara - INFN Torino
0066  */
0067 
0068 class DTRangeMapAccessor {
0069 public:
0070   /// Constructor
0071   DTRangeMapAccessor();
0072 
0073   /// Destructor
0074   virtual ~DTRangeMapAccessor();
0075 
0076   // Operations
0077 
0078   /// Access by SL objects written into a RangeMap by layer.
0079   static std::pair<DTLayerId, DTSuperLayerIdComparator> layersBySuperLayer(DTSuperLayerId slId);
0080 
0081   /// Access by chamber objects written into a RangeMap by layer.
0082   static std::pair<DTLayerId, DTChamberIdComparator> layersByChamber(DTChamberId chamberId);
0083 
0084   /// Access by chamber objects written into a RangeMap by SL.
0085   static std::pair<DTSuperLayerId, DTChamberIdComparator> superLayersByChamber(DTChamberId chamberId);
0086 
0087   /// Access chambers in a RangeMap by DetLayer.
0088   static std::pair<DTChamberId, DTChamberIdDetLayerComparator> chambersByDetLayer(DTChamberId id);
0089 
0090 private:
0091 };
0092 
0093 #endif