ATLAS Offline Software
Loading...
Searching...
No Matches
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
8
9#include "GaudiKernel/ISvcLocator.h"
10#include "GaudiKernel/Bootstrap.h"
11#include "GaudiKernel/MsgStream.h"
12#include "GaudiKernel/IMessageSvc.h"
13
15
16#include <iostream>
17#include <fstream>
18#include <sstream>
19#include <string>
20
21namespace LVL1TGC {
22
23TGCGoodMF::TGCGoodMF(LVL1TGCTrigger::TGCArguments* tgcargs, const std::string& version)
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
78bool 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
#define ATH_MSG_INFO(x)
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
TGCGoodMF(LVL1TGCTrigger::TGCArguments *, const std::string &version)
Definition TGCGoodMF.cxx:23
std::map< int, std::map< int, int > > m_mapisgoodMF
Definition TGCGoodMF.h:34
const TGCGoodMF & operator=(const TGCGoodMF &right)
Definition TGCGoodMF.cxx:36
bool test_GoodMF(int moduleId, int sscId, int subsector) const
Definition TGCGoodMF.cxx:78
LVL1TGCTrigger::TGCArguments * m_tgcArgs
Definition TGCGoodMF.h:35
std::string m_verName
Definition TGCGoodMF.h:36
static std::string FindCalibDirectory(const std::string &logical_file_name)
static constexpr unsigned int kNRoiInSSC
The default number of ROIs in SSC.
TFile * file