CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GctChannelMaskOnlineProd.cc
Go to the documentation of this file.
4 
5 class L1GctChannelMaskOnlineProd : public L1ConfigOnlineProdBase< L1GctChannelMaskRcd, L1GctChannelMask > {
6  public:
10 
11  virtual boost::shared_ptr< L1GctChannelMask > newObject( const std::string& objectKey ) override ;
12  private:
13 };
14 
15 boost::shared_ptr< L1GctChannelMask >
17 {
18  // get EM mask data
19  l1t::OMDSReader::QueryResults emMaskResults =
21  "GCT_EM_MASK",
22  "CMS_GCT",
23  "GCT_MASKS",
24  "GCT_MASKS.CONFIG_KEY",
25  m_omdsReader.singleAttribute( objectKey ) ) ;
26 
27  if( emMaskResults.queryFailed() ) { // check if query was successful
28  edm::LogError( "L1-O2O" ) << "Problem with L1GctChannelMask EM mask for key " << objectKey;
29  return boost::shared_ptr< L1GctChannelMask >() ;
30  }
31 
32  int emMask = -1;
33  emMaskResults.fillVariable( emMask ) ;
34 
35  // get region masks
36  l1t::OMDSReader::QueryResults rgnMaskKeyResults =
38  "GCT_RGN_MASK_KEY",
39  "CMS_GCT",
40  "GCT_MASKS",
41  "GCT_MASKS.CONFIG_KEY",
42  m_omdsReader.singleAttribute( objectKey ) ) ;
43 
44  if( rgnMaskKeyResults.queryFailed() ) { // check if query was successful
45  edm::LogError( "L1-O2O" ) << "Problem with L1GctChannelMask region mask for key " << objectKey;
46  return boost::shared_ptr< L1GctChannelMask >() ;
47  }
48 
49  std::string rgnKey;
50  rgnMaskKeyResults.fillVariable( rgnKey );
51 
52  std::vector< std::string > rgnMaskCols;
53  rgnMaskCols.push_back("RCT_CRATE_0_RGN_MASK");
54  rgnMaskCols.push_back("RCT_CRATE_1_RGN_MASK");
55  rgnMaskCols.push_back("RCT_CRATE_2_RGN_MASK");
56  rgnMaskCols.push_back("RCT_CRATE_3_RGN_MASK");
57  rgnMaskCols.push_back("RCT_CRATE_4_RGN_MASK");
58  rgnMaskCols.push_back("RCT_CRATE_5_RGN_MASK");
59  rgnMaskCols.push_back("RCT_CRATE_6_RGN_MASK");
60  rgnMaskCols.push_back("RCT_CRATE_7_RGN_MASK");
61  rgnMaskCols.push_back("RCT_CRATE_8_RGN_MASK");
62  rgnMaskCols.push_back("RCT_CRATE_9_RGN_MASK");
63  rgnMaskCols.push_back("RCT_CRATE_10_RGN_MASK");
64  rgnMaskCols.push_back("RCT_CRATE_11_RGN_MASK");
65  rgnMaskCols.push_back("RCT_CRATE_12_RGN_MASK");
66  rgnMaskCols.push_back("RCT_CRATE_13_RGN_MASK");
67  rgnMaskCols.push_back("RCT_CRATE_14_RGN_MASK");
68  rgnMaskCols.push_back("RCT_CRATE_15_RGN_MASK");
69  rgnMaskCols.push_back("RCT_CRATE_16_RGN_MASK");
70  rgnMaskCols.push_back("RCT_CRATE_17_RGN_MASK");
71 
72  l1t::OMDSReader::QueryResults rgnMaskResults =
74  rgnMaskCols,
75  "CMS_GCT",
76  "GCT_RGN_MASKS",
77  "GCT_RGN_MASKS.CONFIG_KEY",
78  m_omdsReader.singleAttribute( rgnKey ) ) ;
79 
80 
81  // get energy sum masks
82  l1t::OMDSReader::QueryResults esumMaskKeyResults =
84  "GCT_ESUM_MASK_KEY",
85  "CMS_GCT",
86  "GCT_MASKS",
87  "GCT_MASKS.CONFIG_KEY",
88  m_omdsReader.singleAttribute( objectKey ) ) ;
89 
90  if( esumMaskKeyResults.queryFailed() ) { // check if query was successful
91  edm::LogError( "L1-O2O" ) << "Problem with L1GctChannelMask energy sum mask for key " << objectKey;
92  return boost::shared_ptr< L1GctChannelMask >() ;
93  }
94 
95  std::string esumKey;
96  esumMaskKeyResults.fillVariable( esumKey );
97 
98  std::vector< std::string > esumMaskCols;
99  esumMaskCols.push_back("GCT_TET_MASK");
100  esumMaskCols.push_back("GCT_MET_MASK");
101  esumMaskCols.push_back("GCT_HT_MASK");
102  esumMaskCols.push_back("GCT_MHT_MASK");
103 
104  l1t::OMDSReader::QueryResults esumMaskResults =
106  esumMaskCols,
107  "CMS_GCT",
108  "GCT_ESUM_MASKS",
109  "GCT_ESUM_MASKS.CONFIG_KEY",
110  m_omdsReader.singleAttribute( esumKey ) ) ;
111 
112 
113  // create masks object
114  boost::shared_ptr< L1GctChannelMask > masks( new L1GctChannelMask() );
115 
116  // set EM masks
117  for (int i=0; i<18; i++) {
118  if ((emMask & (1<<i)) != 0) masks->maskEmCrate(i); // mask crate if emMask bit i is set
119  }
120 
121  // set region masks
122  for (unsigned irct=0; irct<18; irct++) {
123  std::stringstream rgnCol;
124  rgnCol << "RCT_CRATE_" << std::dec << irct << "_RGN_MASK";
125  int mask;
126  rgnMaskResults.fillVariable( rgnCol.str(), mask );
127  if (mask != 0) {
128  for (unsigned irgn=0; irgn<22; ++irgn) {
129  if ((mask & (1<<irgn)) != 0) {
130  edm::LogError( "L1-O2O" ) << "Masked region, but no O2O code!";
131  }
132  }
133  }
134  }
135 
136  // set esum masks
137  int tetMask, metMask, htMask, mhtMask ;
138  esumMaskResults.fillVariable( "GCT_TET_MASK", tetMask ) ;
139  esumMaskResults.fillVariable( "GCT_MET_MASK", metMask ) ;
140  esumMaskResults.fillVariable( "GCT_HT_MASK", htMask ) ;
141  esumMaskResults.fillVariable( "GCT_MHT_MASK", mhtMask ) ;
142 
143  for (int ieta=0; ieta<22; ieta++) {
144  if ((tetMask & (1<<ieta)) != 0) masks->maskTotalEt(ieta);
145  if ((metMask & (1<<ieta)) != 0) masks->maskMissingEt(ieta);
146  if ((htMask & (1<<ieta)) != 0) masks->maskTotalHt(ieta);
147  if ((mhtMask & (1<<ieta)) != 0) masks->maskMissingHt(ieta);
148  }
149 
150  return masks;
151 
152 }
153 
int i
Definition: DBlmapReader.cc:9
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:311
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:295
virtual boost::shared_ptr< L1GctChannelMask > newObject(const std::string &objectKey) override
L1GctChannelMaskOnlineProd(const edm::ParameterSet &iConfig)
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="") const
Definition: OMDSReader.cc:87
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
static const uint32_t masks[]
Definition: CaloRecHit.cc:12