ATLAS Offline Software
TGCGoodMF.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "TrigT1TGC/TGCGoodMF.h"
8 
9 #include "GaudiKernel/ISvcLocator.h"
10 #include "GaudiKernel/Bootstrap.h"
11 #include "GaudiKernel/MsgStream.h"
12 #include "GaudiKernel/IMessageSvc.h"
13 
14 #include "TrigT1TGC/TGCArguments.h"
15 
16 #include <iostream>
17 #include <fstream>
18 #include <sstream>
19 #include <string>
20 
21 namespace LVL1TGC {
22 
24 : AthMessaging("LVL1TGC::TGCGoodMF"),
25  m_tgcArgs(tgcargs),
26  m_verName(version)
27 {
28  if (this->readBadMFList()) {
29  ATH_MSG_INFO("LVL1TGC Hot-ROI mask version of " << m_verName << " is selected");
30  } else {
31  ATH_MSG_INFO("LVL1TGC Hot-ROI mask NOT defined");
32  }
33 
34 }
35 
37 {
38  if(this != &right){
39  m_tgcArgs=right.m_tgcArgs;
40  m_verName=right.m_verName;
41  this->readBadMFList();
42  }
43 
44  return *this;
45 }
46 
48 {
49  //initialize
50  std::string buf;
51  std::string fullName, tag; char delimiter = '\n';
52  std::string fn = "/HotRoI/HotRoI."+m_verName+".db";
53 
54  fullName = PathResolver::FindCalibDirectory("dev")+"/TrigT1TGC"+fn;
55  int mod,maxssc;
56  std::ifstream file(fullName.c_str(),std::ios::in);
57  while(getline(file,buf,delimiter)) {
58  std::istringstream header(buf);
59  header>>tag;
60  if(tag == "#"){ // read header part.
61  header>>mod>>maxssc;
62 
63  // get BadMF list
64  getline(file,buf,delimiter);
65  std::istringstream cont(buf);
66  std::map<int,int>& mapssc = m_mapisgoodMF[mod]; // mapssc = <SSCId,badMFId>, m_mapisgoodMF = <ModuleId,<~>>
67  int badMFId;
68  for(int i=0; i<=maxssc; i++) {
69  cont>>badMFId;
70  if(badMFId < 0) continue;
71  mapssc[i] = badMFId;
72  }
73  }
74  }
75  return true;
76 }
77 
78 bool TGCGoodMF::test_GoodMF(int moduleId,int sscId,int RoI) const
79 {
80  std::map<int, std::map<int, int> >::const_iterator itModule=m_mapisgoodMF.find(moduleId);
81  if (itModule==m_mapisgoodMF.end()) return true;
82 
83  const std::map<int, int> &mapssc = itModule->second;
84  std::map<int, int>::const_iterator itSSC=mapssc.find(sscId);
85  if (itSSC==mapssc.end()) return true;
86 
87  int badMFId = itSSC->second;
88  if (badMFId==0){ return true; }
89 
90  std::bitset<kNRoiInSSC> bs(badMFId);
91 
92  int RoIId;
93  if(RoI % kNRoiInSSC >= 4){ RoIId = RoI % kNRoiInSSC - 4; }
94  else{ RoIId = RoI % kNRoiInSSC + 4; }
95 
96  return !bs[RoIId];
97 }
98 
99 
100 } //end of namespace bracket
LVL1TGC::TGCGoodMF::m_tgcArgs
LVL1TGCTrigger::TGCArguments * m_tgcArgs
Definition: TGCGoodMF.h:35
header
Definition: hcg.cxx:526
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LVL1TGC::TGCGoodMF::test_GoodMF
bool test_GoodMF(int moduleId, int sscId, int subsector) const
Definition: TGCGoodMF.cxx:78
WriteCellNoiseToCool.fullName
fullName
Definition: WriteCellNoiseToCool.py:461
PathResolver::FindCalibDirectory
static std::string FindCalibDirectory(const std::string &logical_file_name)
Definition: PathResolver.h:109
LVL1TGC::TGCGoodMF::readBadMFList
bool readBadMFList()
Definition: TGCGoodMF.cxx:47
python.AthDsoLogger.delimiter
delimiter
Definition: AthDsoLogger.py:71
python.getCurrentFolderTag.fn
fn
Definition: getCurrentFolderTag.py:65
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:85
LVL1TGC
Definition: BigWheelCoincidenceLUT.cxx:20
file
TFile * file
Definition: tile_monitor.h:29
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
LVL1TGC::TGCGoodMF::operator=
const TGCGoodMF & operator=(const TGCGoodMF &right)
Definition: TGCGoodMF.cxx:36
LVL1TGC::TGCGoodMF::TGCGoodMF
TGCGoodMF(LVL1TGCTrigger::TGCArguments *, const std::string &version)
Definition: TGCGoodMF.cxx:23
PathResolver.h
TGCNumbering.h
LVL1TGC::TGCGoodMF
Definition: TGCGoodMF.h:20
TGCGoodMF.h
LVL1TGCTrigger::TGCArguments
Definition: TGCArguments.h:12
get_generator_info.version
version
Definition: get_generator_info.py:33
LVL1TGC::TGCGoodMF::m_mapisgoodMF
std::map< int, std::map< int, int > > m_mapisgoodMF
Definition: TGCGoodMF.h:34
LVL1TGC::TGCGoodMF::m_verName
std::string m_verName
Definition: TGCGoodMF.h:36
TGCArguments.h
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
makeTOC.header
header
Definition: makeTOC.py:28