ATLAS Offline Software
CalibInitializer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <cmath>
8 #include <stdexcept>
9 
10 namespace MCP {
11  namespace CalibInitializer {
12 
13  std::map<SagittaCorrection, std::shared_ptr<CalibContainer>> createSagittaCorrMap(DataYear dataYear, TrackType type, const std::string& recommendationPath, const std::string& correctionType)
14  {
15  std::map<SagittaCorrection, std::shared_ptr<CalibContainer>> calibMap;
16 
17  std::string path = "MuonMomentumCorrections/" + recommendationPath + "/sagittaBias/" + MCP::toString(dataYear) + "/";
18 
19  std::string trackType = MCP::toString(type);
20 
21  if(correctionType == "data")
22  {
23  path += trackType + "_data.root";
24  calibMap[SagittaCorrection::Nominal] = std::make_shared<CalibContainer>(path, "p" + trackType + "_0");
25  calibMap[SagittaCorrection::Datastat__1up] = std::make_shared<CalibContainer>(path, "p" + trackType + "_statError");
26  calibMap[SagittaCorrection::Residual__1up] = std::make_shared<CalibContainer>(path, "p" + trackType + "_1");
27  }
28  else if(correctionType == "mc")
29  {
30  path += trackType + "_mc.root";
31  calibMap[SagittaCorrection::Nominal] = std::make_shared<CalibContainer>(path, "p" + trackType + "_0");
32  }
33  else
34  {
35  throw std::invalid_argument("Cannot recognize saggita correction type: " + correctionType);
36  }
37 
38  return calibMap;
39  }
40  std::map<ScaleResCorrection, std::shared_ptr<CalibContainer>> createScaleResCorrMap(DataYear dataYear, TrackType type, const std::string& recommendationPath, ScaleSmearParam param)
41  {
42  std::map<ScaleResCorrection, std::shared_ptr<CalibContainer>> calibMap;
43 
44 
45  std::string path = "MuonMomentumCorrections/" + recommendationPath + "/ScaleAndSmear/" + MCP::toString(dataYear) + "/";
46 
47  std::string trackType = MCP::toString(type);
48  path += trackType + ".root";
49 
50  std::string correctionType = MCP::toString(param);
51 
52  calibMap[ScaleResCorrection::Nominal] = std::make_shared<CalibContainer>(path, correctionType + "_nom");
53  calibMap[ScaleResCorrection::SystErr__1up] = std::make_shared<CalibContainer>(path, correctionType + "_upErr");
54  calibMap[ScaleResCorrection::SystErr__1down] = std::make_shared<CalibContainer>(path, correctionType + "_downErr");
55 
56  return calibMap;
57  }
58 
59  std::map<MST_Categories, std::shared_ptr<CalibContainer>> createHighpTCorrMap(DataYear dataYear, const std::string& type, const std::string& recommendationPath, const std::string& param)
60  {
61  std::map<MST_Categories, std::shared_ptr<CalibContainer>> calibMap;
62  std::string path = "MuonMomentumCorrections/" + recommendationPath + "/ScaleAndSmear/" + MCP::toString(dataYear) + "/ExtraHighPt_"+type+"_muons.root";
63 
64  calibMap[MST_Categories::Zero] = std::make_shared<CalibContainer>(path, param + "_cat0");
65  calibMap[MST_Categories::One] = std::make_shared<CalibContainer>(path, param + "-cat1");
66  calibMap[MST_Categories::Two] = std::make_shared<CalibContainer>(path, param + "-cat2");
67  calibMap[MST_Categories::Three] = std::make_shared<CalibContainer>(path, param + "-cat3");
68  calibMap[MST_Categories::Four] = std::make_shared<CalibContainer>(path, param + "-cat4");
69 
70  return calibMap;
71  }
72 
73  std::map<ExpectedResParam, std::shared_ptr<CalibContainer>> createExpectedResMap(DataYear dataYear, TrackType type, const std::string& recommendationPath)
74  {
75  std::map<ExpectedResParam, std::shared_ptr<CalibContainer>> calibMap;
76  std::string path = "MuonMomentumCorrections/" + recommendationPath + "/ScaleAndSmear/" + MCP::toString(dataYear) + "/MC_values_muons.root";
77 
78  if(type == TrackType::ID)
79  {
80  calibMap[ExpectedResParam::r1] = std::make_shared<CalibContainer>(path, "r1_ID_MC");
81  calibMap[ExpectedResParam::r2] = std::make_shared<CalibContainer>(path, "r2_ID_MC");
82  calibMap[ExpectedResParam::r2tan2] = std::make_shared<CalibContainer>(path, "r2_ID_TAN2_MC");
83  }
84  else if(type == TrackType::ME)
85  {
86  calibMap[ExpectedResParam::r0] = std::make_shared<CalibContainer>(path, "r0_MS_MC");
87  calibMap[ExpectedResParam::r1] = std::make_shared<CalibContainer>(path, "r1_MS_MC");
88  calibMap[ExpectedResParam::r2] = std::make_shared<CalibContainer>(path, "r2_MS_MC");
89  }
90 
91  return calibMap;
92  }
93 
94 
95 
96 
97  }
98 }
MCP::MST_Categories::Three
@ Three
MCP::SagittaCorrection::Residual__1up
@ Residual__1up
MCP::ScaleResCorrection::Nominal
@ Nominal
MCP::CalibInitializer::createExpectedResMap
std::map< ExpectedResParam, std::shared_ptr< CalibContainer > > createExpectedResMap(DataYear dataYear, TrackType type, const std::string &recommendationPath)
Definition: CalibInitializer.cxx:73
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:126
MCP::MST_Categories::Two
@ Two
CalibInitializer.h
MCP::CalibInitializer::createHighpTCorrMap
std::map< MST_Categories, std::shared_ptr< CalibContainer > > createHighpTCorrMap(DataYear dataYear, const std::string &type, const std::string &recommendationPath, const std::string &param)
Definition: CalibInitializer.cxx:59
MCP::ExpectedResParam::r1
@ r1
MCP::SagittaCorrection::Datastat__1up
@ Datastat__1up
MCP::ExpectedResParam::r0
@ r0
MCP::ExpectedResParam::r2
@ r2
MCP::toString
std::string toString(TrackType trkType)
Definition: EnumDef.h:39
MCP::MST_Categories::Four
@ Four
MCP::ScaleResCorrection::SystErr__1down
@ SystErr__1down
MCP::MST_Categories::One
@ One
MCP::ScaleResCorrection::SystErr__1up
@ SystErr__1up
MCP::CalibInitializer::createScaleResCorrMap
std::map< ScaleResCorrection, std::shared_ptr< CalibContainer > > createScaleResCorrMap(DataYear dataYear, TrackType type, const std::string &recommendationPath, ScaleSmearParam param)
Definition: CalibInitializer.cxx:40
MCP::MST_Categories::Zero
@ Zero
MCP::ExpectedResParam::r2tan2
@ r2tan2
MCP
Definition: CalibContainer.h:18
MCP::SagittaCorrection::Nominal
@ Nominal
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MCP::ScaleSmearParam
ScaleSmearParam
Definition: EnumDef.h:22
MCP::DataYear
DataYear
Definition: EnumDef.h:28
MCP::CalibInitializer::createSagittaCorrMap
std::map< SagittaCorrection, std::shared_ptr< CalibContainer > > createSagittaCorrMap(DataYear dataYear, TrackType type, const std::string &recommendationPath, const std::string &correctionType)
Definition: CalibInitializer.cxx:13
MCP::TrackType::ME
@ ME
TrackType
Definition: TrackTypes.h:10
MCP::TrackType::ID
@ ID