Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-10 02:58:36

0001 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 8; -*-
0002 
0003 #ifndef ECALSRFLAG
0004 #define ECALSRFLAG
0005 
0006 #include "DataFormats/DetId/interface/DetId.h"
0007 
0008 /** Base class for Selective Readout Flag (SR flag or SRF).
0009 */
0010 class EcalSrFlag {
0011 public:
0012   /** SRP flag for suppression of every channel of the readout
0013    * unit.
0014    */
0015   static const int SRF_SUPPRESS = 0;
0016   /** SRP flag for zero suppression with level 1.
0017    */
0018   static const int SRF_ZS1 = 1;
0019   /** SRP flag for zero suppression with level 2.
0020    */
0021   static const int SRF_ZS2 = 2;
0022   /** SRP flag for full readout of the readout unit.
0023    */
0024   static const int SRF_FULL = 3;
0025   /** Mask for the 'forced' bit which is set when the decision was
0026    * forced by an error condition or by configuration.
0027    * <P>E.g., a force full readout flag has value SRF_FORCED_MASK|SRF_FULL
0028    */
0029   static const int SRF_FORCED_MASK = 0x4;
0030 
0031 public:
0032   /** Destructor
0033    */
0034   virtual ~EcalSrFlag() {}
0035 
0036   /** Gets the Det Id the flag is associated to.
0037    * @return the det id of the readout unit (a barrel TT or a SC).
0038    */
0039   virtual const DetId& id() const = 0;
0040 
0041   /** SR flag value. See SRF_XXX constants.
0042    * @return the flag value
0043    */
0044   int value() const { return flag_; }
0045 
0046   /** Set the SR flag value. See SRF_XXX constants.
0047    * @param flag new flag value. Must be between 0 and 7.
0048    */
0049   void setValue(const int& flag) { flag_ = (unsigned char)flag; }
0050 
0051   /** Cast to int: same as value().
0052    * @return the SR flag value
0053    */
0054   operator int() const { return flag_; }
0055 
0056   /** Return a human readable flag name from its integer value.
0057    * @param flag the flag value
0058    * @return the human readable string (which can contain space).
0059    */
0060   static std::string flagName(const int& flag) { return (flag == (flag & 0x7)) ? srfNames[flag] : "Invalid"; }
0061 
0062   /** Return a human readable flag name from the flag value.
0063    * @return the human readable string (which can contain space).
0064    */
0065   std::string flagName() const { return flagName(flag_); }
0066 
0067 protected:
0068   /** The SRP flag.
0069    */
0070   unsigned char flag_;
0071 
0072 private:
0073   /** Human readable flag value names
0074    */
0075   static const char* const srfNames[];
0076 };
0077 
0078 #endif  //ECALSRFLAG not defined