Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:04

0001 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 8; -*-
0002 
0003 #ifndef EBSRFLAG_H
0004 #define EBSRFLAG_H
0005 
0006 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
0007 #include "DataFormats/EcalDigi/interface/EcalSrFlag.h"
0008 #include "FWCore/Utilities/interface/Exception.h"
0009 
0010 /** This class holds a Selective Readout Flag (SRF) associated to an
0011  * ECAL barrel trigger tower.
0012  */
0013 class EBSrFlag : public EcalSrFlag {
0014 public:
0015   typedef EcalTrigTowerDetId key_type;  //key for edm::SortedCollection
0016 
0017 public:
0018   /** Default constructor.
0019    */
0020   EBSrFlag(){};
0021 
0022   /** Constructor
0023    * @param tt trigger tower det id.
0024    * @param flag the srp flag, an integer in [0,7]. See constants SRF_xxx in EcalSrFlags class.
0025    */
0026   EBSrFlag(const EcalTrigTowerDetId& tt, const int& flag) : ttId_(tt) {
0027     //SRP flag is coded on 3 bits:
0028     if (flag < 0 || flag > 0x7)
0029       throw cms::Exception("InvalidValue", "srp flag greater than 0x7 or negative.");
0030     flag_ = (unsigned char)flag;
0031   }
0032 
0033   /** For edm::SortedCollection.
0034    * @return det id of the trigger tower the flag is assigned to.
0035    */
0036   const EcalTrigTowerDetId& id() const override { return ttId_; }
0037 
0038 private:
0039   /** trigger tower id
0040    */
0041   EcalTrigTowerDetId ttId_;
0042 };
0043 
0044 std::ostream& operator<<(std::ostream& s, const EBSrFlag& digi);
0045 
0046 #endif  //EBSRFLAG_H not defined