ATLAS Offline Software
SCT_CalibUtilities.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
12 #include "SCT_CalibUtilities.h"
13 
14 //gaudi
15 #include "InDetIdentifier/SCT_ID.h"
16 #include "Identifier/Identifier.h"
17 #include <algorithm> //std::unique
18 
19 namespace SCT_CalibAlgs {
20  std::string
21  normalizeList(std::string s) {
22  auto binaryPredicate=[](char s0, char s1){
23  return (s0==' ' and s0==s1);
24  };
25  auto normalised= std::unique(s.begin(), s.end(), binaryPredicate);
26  s.erase(normalised,s.end());
27  size_t first=0;
28  size_t last=s.size()-1;
29  if (s[first] == ' ') first =1;
30  if (s[last] == ' ') last-=1;
31  return s.substr(first,last);
32 }
33 
34 
35 std::string
36 formatPosition(const Identifier& waferId, const SCT_ID* helper, const std::string& delimiter, const bool includeSide) {
37  using std::string;
38  string result{std::to_string(helper->barrel_ec(waferId))+delimiter};
39  result += std::to_string(helper->layer_disk(waferId))+delimiter;
40  result += std::to_string(helper->phi_module(waferId))+delimiter;
41  result += std::to_string(helper->eta_module(waferId));
42  if (includeSide) result += (delimiter+std::to_string(helper->side(waferId)));
43  return result;
44 }//function end
45 
46 std::string
47 chipList2LinkList(const std::string& chipList) {
48  if (chipList == "0-5 6-11") {
49  return "0 1";
50  } else if (chipList == "0-5") {
51  return "0";
52  } else if (chipList == "6-11") {
53  return "1";
54  } else {
55  return "";
56  }
57 }
58 
59 unsigned int
60 bec2Index(const int bec) {
61  return static_cast<unsigned int>((bec/2) + 1);
62 }
63 
64 std::string
66  return "</channel>";
67 }
68 } //end of namespace
SCT_CalibAlgs::chipList2LinkList
std::string chipList2LinkList(const std::string &chipList)
Definition: SCT_CalibUtilities.cxx:47
SCT_CalibAlgs::bec2Index
unsigned int bec2Index(const int bec)
Definition: SCT_CalibUtilities.cxx:60
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
get_generator_info.result
result
Definition: get_generator_info.py:21
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
SCT_CalibAlgs
Definition: IElementStreamer.cxx:13
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
python.AthDsoLogger.delimiter
delimiter
Definition: AthDsoLogger.py:71
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
SCT_CalibAlgs::formatPosition
std::string formatPosition(const Identifier &waferId, const SCT_ID *helper, const std::string &delimiter, const bool includeSide)
Definition: SCT_CalibUtilities.cxx:36
SCT_CalibAlgs::xmlCloseChannel
std::string xmlCloseChannel()
Definition: SCT_CalibUtilities.cxx:65
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
SCT_CalibAlgs::normalizeList
std::string normalizeList(std::string s)
Definition: SCT_CalibUtilities.cxx:21
SCT_ID
Definition: SCT_ID.h:68
DeMoScan.first
bool first
Definition: DeMoScan.py:534
SCT_CalibUtilities.h