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