ATLAS Offline Software
Loading...
Searching...
No Matches
PixelChargeInterpolationCalibration.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef PixelChargeInterpolationCalibration_cxx
6#define PixelChargeInterpolationCalibration_cxx
7
8
9
10#include <TDirectory.h>
11
16#include <fstream>
17
18namespace PixelCalib{
19
30
32
40
42
44
45 TDirectory *current = gDirectory;
46 TDirectory *globaldir = gDirectory;
47 if(histofile != 0) globaldir = histofile;
48
49 globaldir->cd("ChargeInterpolation");
51 m_AnalogCalibration->Read();
52
53 current->cd();
54}
55
57
59
60 TDirectory *current = gDirectory;
61 TDirectory *globaldir = gDirectory;
62 if(writedir != 0) globaldir = writedir;
63
64 globaldir->mkdir("ChargeInterpolation")->cd();
65 m_DigitalCalibration->Write();
66 m_AnalogCalibration->Write();
67 m_plots->Write();
68
69 current->cd();
70
71}
72
74
76 Double_t alpha, Double_t DeltaRow, Double_t digresphi,
77 Double_t resphi, Double_t OmegaPhi,
78 Double_t TrkEta, Double_t DeltaCol, Double_t digreseta,
79 Double_t reseta, Double_t OmegaEta){
80
81 // hack to uniform constants for all layers and for all disks
82 int modifier = 0;
83 int totlayers = 3;
84 if(DetType == 0) totlayers = 1;
85 else if(DetType < 4) modifier = 1;
86 else modifier = 4;
87 // fill with the same values for the relevant layers
88 for(int iLayer = 0; iLayer < totlayers; iLayer++){
89 DetType = iLayer + modifier;
90 m_DigitalCalibration->Fill(DetType, GeVTrkPt,
91 TrkEta, DeltaCol, digreseta, OmegaEta,
92 alpha, DeltaRow, digresphi, OmegaPhi);
93 m_AnalogCalibration->Fill(DetType, GeVTrkPt,
94 TrkEta, DeltaCol, reseta, OmegaEta,
95 alpha, DeltaRow, resphi, OmegaPhi);
96 }
97
98}
99
101
102int PixelChargeInterpolationCalibration::Analyze( const std::string& output,
103 std::vector<std::string> &reference_names){
104
105 PixelChargeInterpolationParameters *DigitalParameters = 0;
106 PixelChargeInterpolationParameters *AnalogParameters = 0;
107
108 std::ofstream logfile;
109 logfile.open((output + ".log").c_str());
110 logfile << "Log file for the pixel calibration fits." << std::endl;
111
112 DigitalParameters = m_DigitalCalibration->Analyze(logfile);
113 AnalogParameters = m_AnalogCalibration->Analyze(logfile);
114
115 logfile.close();
116
117 std::string name = "PixelChargeInterpolationData-" + output;
118 size_t pos = output.find("PixelOfflineReco");
119 if(pos != std::string::npos){
120 name = "PixelChargeInterpolationData"
121 + output.substr(pos+16,std::string::npos);
122 }
123 DigitalParameters->Print(name);
124 name = "Analog-" + name;
125 AnalogParameters->Print(name);
126
127 m_plots = new PixelChargeInterpolationPlot(*DigitalParameters);
128 m_plots->AddReference(*AnalogParameters,
129 std::string("Fit on analog residual (should give 0)").c_str(),3,std::string("P"));
130 for(unsigned int i = 0 ; i < reference_names.size() ; i++ ){
131 std::ifstream fin((reference_names[i]).c_str());
132 if(!fin.fail()){
133 fin.close();
136 RefParameters->Load(reference_names[i]);
137 int color = 4+i;
138 if(color == 5) color = 1;
139 m_plots->AddReference(*RefParameters,reference_names[i],color,std::string("P"));
140 delete RefParameters;
141 }
142 }
143 m_plots->Plot(output);
144
145
146 return 0;
147}
148
149
150} // end of namespace PixelCalib
151
152#endif
int Analyze(const std::string &output, std::vector< std::string > &reference_names)
PixelChargeInterpolationCalibration(const std::string &tag, PixelChargeInterpolationParameters &parametersModel)
void Fill(int DetType, double GeVTrkPt, double alpha, double DeltaRow, double digresphi, double resphi, double OmegaPhi, double TrkEta, double DeltaCol, double digreseta, double reseta, double OmegaEta)