ATLAS Offline Software
Loading...
Searching...
No Matches
PixelCalib::PixelChargeInterpolationHistograms Class Reference

#include <PixelChargeInterpolationHistograms.h>

Collaboration diagram for PixelCalib::PixelChargeInterpolationHistograms:

Public Member Functions

 PixelChargeInterpolationHistograms (const std::string &tag, const PixelChargeInterpolationParameters &model)
virtual ~PixelChargeInterpolationHistograms ()
 PixelChargeInterpolationHistograms (const PixelChargeInterpolationHistograms &)=delete
PixelChargeInterpolationHistogramsoperator= (const PixelChargeInterpolationHistograms &)=delete
int Fill (int DetType, double GeVTrkPt, double TrkEta, double DeltaCol, double reseta, double OmegaEta, double alpha, double DeltaRow, double resphi, double OmegaPhi)
PixelChargeInterpolationParametersAnalyze (std::ofstream &logfile)
int Write ()
int Read ()

Private Types

enum  Indexes { LayerIndex = 0 , AngleIndex = 1 , ClustersizeIndex = 2 }

Private Member Functions

bool Fit (TProfile *swap, double *value, double *error)

Private Attributes

std::string m_tag
PixelChargeInterpolationParametersm_parameters
MultiHisto< TProfile > * m_etaProfile
MultiHisto< TProfile > * m_phiProfile
MultiHisto< TH2F > * m_etaH
MultiHisto< TH2F > * m_phiH
MultiHisto< TH1F > * m_OmegaPhih
MultiHisto< TH1F > * m_OmegaEtah
TH1F * m_OmegaEtah_model
TH1F * m_OmegaPhih_model

Detailed Description

Definition at line 20 of file PixelChargeInterpolationHistograms.h.

Member Enumeration Documentation

◆ Indexes

Constructor & Destructor Documentation

◆ PixelChargeInterpolationHistograms() [1/2]

PixelCalib::PixelChargeInterpolationHistograms::PixelChargeInterpolationHistograms ( const std::string & tag,
const PixelChargeInterpolationParameters & model )

Definition at line 30 of file PixelChargeInterpolationHistograms.cxx.

31 :
32 m_tag(tag),
33 m_parameters(0),
34 m_etaProfile(0),
35 m_phiProfile(0),
36 m_etaH(0),
37 m_phiH(0),
38 m_OmegaPhih(0),
39 m_OmegaEtah(0){
40
41 std::vector<float> *layers = getLayersBins();
42 std::vector<float> etabins = model.getEtaBins();
43 std::vector<float> phibins = model.getAngleBins();
44 std::vector<float> clustersizeEta = model.getClusterSizeYBins();
45 std::vector<float> clustersizePhi = model.getClusterSizeXBins();
46
47 unsigned int Neta = etabins.size()-1;
48 unsigned int Nphi = phibins.size()-1;
49 unsigned int NCSeta = clustersizeEta.size()-1;
50 unsigned int NCSphi = clustersizePhi.size()-1;
51
52 unsigned int ntotbins = Nphi + NCSphi + Neta + NCSeta + 4;
53
54 std::vector<float> bins;
55 bins.reserve(ntotbins);
56 for (unsigned int i=0; i<clustersizePhi.size(); i++) {
57 bins.push_back(clustersizePhi[i]);
58 }
59 for (unsigned int i=0; i<clustersizeEta.size(); i++) {
60 bins.push_back(clustersizeEta[i]);
61 }
62 for (unsigned int i=0; i<etabins.size(); i++) {
63 bins.push_back(etabins[i]);
64 }
65 for (unsigned int i=0; i<phibins.size(); i++) {
66 bins.push_back(phibins[i]);
67 }
68
69 m_parameters = new PixelChargeInterpolationParameters();
70 m_parameters->setParameters(NCSphi, NCSeta, Neta, Nphi, 0, std::move(bins));
71 m_parameters->setVersion(-1);
72
73 // eta direction
74 TProfile *Profmodel = new TProfile(("etaResVsOmega"+ tag).c_str(),
75 "#eta residual vs charge sharing", 30, 0., 1.);
76
77 TH2F *THmodel = new TH2F(("etaResVsOmegaH"+ tag).c_str(),
78 "#eta residual vs charge sharing",
79 50, 0., 1.,50,-1000,1000);
80
81 std::vector<std::string> binsnames(3);
82 std::vector<std::vector <float> > binsvectors(3);
83
84 binsnames[LayerIndex] = "Layer";
85 binsnames[AngleIndex] = "#eta";
86 binsnames[ClustersizeIndex] = "ClusterSize";
87
88 binsvectors[LayerIndex] = *layers;
89 binsvectors[AngleIndex] = std::move(etabins);
90 binsvectors[ClustersizeIndex] = std::move(clustersizeEta);
91
92 m_etaProfile = new MultiHisto<TProfile>(*Profmodel,binsnames,binsvectors);
93 m_etaH = new MultiHisto<TH2F>(*THmodel,binsnames,binsvectors);
94 m_OmegaEtah_model = new TH1F(("m_OmegaEtah"+ tag).c_str(), "#Omega_{y} distribution",125,0,1);
95 m_OmegaEtah = new MultiHisto<TH1F>(*m_OmegaEtah_model,binsnames,binsvectors);
96
97 // phi direction
98 Profmodel->SetName(("phiResVsOmega"+ tag).c_str());
99 Profmodel->SetTitle("#phi residual vs charge sharing");
100
101 TH2F *THmodel1 = new TH2F(("phiResVsOmegaH"+ tag).c_str(),
102 "#phi residual vs charge balancing",
103 50, 0., 1.,50,-200,200);
104
105 binsnames[AngleIndex] = "#phi";
106
107 binsvectors[AngleIndex] = std::move(phibins);
108 binsvectors[ClustersizeIndex] = std::move(clustersizePhi);
109
110 m_phiProfile = new MultiHisto<TProfile>(*Profmodel,binsnames,binsvectors);
111 m_phiH = new MultiHisto<TH2F>(*THmodel1,binsnames,binsvectors);
112
113 m_OmegaPhih_model = new TH1F(("m_OmegaPhih"+ tag).c_str(), "#Omega_{x} distribution",125,0,1);
114 m_OmegaPhih = new MultiHisto<TH1F>(*m_OmegaPhih_model,binsnames,binsvectors);
115
116 delete Profmodel;
117 delete THmodel;
118 delete THmodel1;
119 delete layers;
120 Profmodel = 0;
121 THmodel = 0;
122 THmodel1 = 0;
123
124}
static const std::vector< std::string > bins
layers(flags, cells_name, *args, **kw)
Here we define wrapper functions to set up all of the standard corrections.
TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)

◆ ~PixelChargeInterpolationHistograms()

PixelCalib::PixelChargeInterpolationHistograms::~PixelChargeInterpolationHistograms ( )
virtual

Definition at line 128 of file PixelChargeInterpolationHistograms.cxx.

128 {
129
130 delete m_etaProfile;
131 delete m_phiProfile;
132 delete m_etaH;
133 delete m_phiH;
134 delete m_parameters;
135 m_etaProfile = 0;
136 m_phiProfile = 0;
137 m_etaH = 0;
138 m_phiH = 0;
139 m_parameters = 0;
140
141 delete m_OmegaPhih; m_OmegaPhih = 0;
142 delete m_OmegaEtah; m_OmegaEtah = 0;
145}

◆ PixelChargeInterpolationHistograms() [2/2]

PixelCalib::PixelChargeInterpolationHistograms::PixelChargeInterpolationHistograms ( const PixelChargeInterpolationHistograms & )
delete

Member Function Documentation

◆ Analyze()

PixelChargeInterpolationParameters * PixelCalib::PixelChargeInterpolationHistograms::Analyze ( std::ofstream & logfile)

Definition at line 232 of file PixelChargeInterpolationHistograms.cxx.

233 {
234
235 logfile << "Fitting!" << std::endl;
236
238 TCanvas *c1 = new TCanvas();
239 c1->UseCurrentStyle();
240
241 //char *currpath = getcwd(nullptr,0);
242 //mkdir(m_etaProfile->GetName(),S_IRWXU | S_IRWXG | S_IRWXO);
243 //chdir(m_etaProfile->GetName());
244
245 for(unsigned int i = 0; i < m_etaProfile->GetNhistos(); i++){
246 TProfile *swap = m_etaProfile->GetHisto(i);
247 swap->UseCurrentStyle();
248 double value = 0, error = 0;
249 if(Fit(swap, &value, &error) ){
250 logfile << swap->GetTitle() << " --> "
251 << value << " +/- " << error << std::endl;
252 }else logfile << swap->GetTitle()
253 << " --> Failing fit!" << std::endl;
254 std::vector<int> indexes = m_etaProfile->GetDivisionsIndexes(i);
255 m_parameters->setDeltaY(indexes[AngleIndex],
256 indexes[ClustersizeIndex],
257 indexes[LayerIndex],
258 value/1000);
259 m_parameters->setErrDeltaY(indexes[AngleIndex],
260 indexes[ClustersizeIndex],
261 indexes[LayerIndex],
262 error/1000);
263 if(swap->GetEntries() < 100) continue;
264 std::string name = std::string(swap->GetName()) + std::string(".pdf");
265 //c1->Print(name.c_str());
266 TH2F *swap1 = m_etaH->GetHisto(i);
267 swap1->UseCurrentStyle();
268 swap1->SetMarkerSize(0.2);
269 swap1->GetXaxis()->SetTitle("Charge sharing");
270 swap1->GetYaxis()->SetTitle("Cluster center residuals (#mum)");
271 swap1->GetYaxis()->SetTitleOffset(1.2);
272 swap1->GetXaxis()->SetTitleOffset(1.25);
273 swap1->DrawCopy();
274 DrawTitleLatex(swap1->GetTitle(), 0.6,0.85);
275 std::string name1 = std::string(swap1->GetName()) + std::string(".pdf");
276 //c1->Print(name1.c_str());
277 }
278
279 //chdir(currpath);
280 //mkdir(m_phiProfile->GetName(),S_IRWXU | S_IRWXG | S_IRWXO);
281 //chdir(m_phiProfile->GetName());
282 for(unsigned int i = 0; i < m_phiProfile->GetNhistos(); i++){
283 TProfile *swap = m_phiProfile->GetHisto(i);
284 swap->UseCurrentStyle();
285 double value = 0, error = 0;
286 if(Fit(swap, &value, &error) ){
287 logfile << swap->GetTitle() << " --> "
288 << value << " +/- " << error << std::endl;
289 }else logfile << swap->GetTitle()
290 << " --> Failing fit!" << std::endl;
291 std::vector<int> indexes = m_phiProfile->GetDivisionsIndexes(i);
292 m_parameters->setDeltaX(indexes[AngleIndex],
293 indexes[ClustersizeIndex],
294 indexes[LayerIndex],
295 value/1000);
296 m_parameters->setErrDeltaX(indexes[AngleIndex],
297 indexes[ClustersizeIndex],
298 indexes[LayerIndex],
299 error/1000);
300 if(swap->GetEntries() < 100) continue;
301 std::string name = std::string(swap->GetName()) + std::string(".pdf");
302 //c1->Print(name.c_str());
303 TH2 *swap1 = m_phiH->GetHisto(i);
304 swap1->UseCurrentStyle();
305 swap1->SetMarkerSize(0.2);
306 swap1->GetXaxis()->SetTitle("Charge sharing");
307 swap1->GetYaxis()->SetTitle("Residuals from center of the cluster (#mum)");
308 swap1->GetYaxis()->SetTitleOffset(1.2);
309 swap1->GetXaxis()->SetTitleOffset(1.25);
310 swap1->DrawCopy();
311 DrawTitleLatex(swap1->GetTitle(), 0.6,0.85);
312 std::string name1 = std::string(swap1->GetName()) + std::string(".pdf");
313 //c1->Print(name1.c_str());
314 }
315
316 //chdir(currpath);
317 //delete currpath;
318 delete c1;
319 c1 = 0;
320 //currpath = 0;
321
322 return m_parameters;
323}
void swap(DataVector< T > &a, DataVector< T > &b)
See DataVector<T, BASE>::swap().
void DrawTitleLatex(const char *chartitle, float x, float y, int color=1, float textsize=0.04)
bool Fit(TProfile *swap, double *value, double *error)

◆ Fill()

int PixelCalib::PixelChargeInterpolationHistograms::Fill ( int DetType,
double GeVTrkPt,
double TrkEta,
double DeltaCol,
double reseta,
double OmegaEta,
double alpha,
double DeltaRow,
double resphi,
double OmegaPhi )

Definition at line 150 of file PixelChargeInterpolationHistograms.cxx.

152 {
153
154
155 std::vector<double> Pars(3);
156 if(GeVTrkPt == 0) return -1;
157
158 if( DeltaCol > 1){ // otherwise none to share with!
159
160 Pars[AngleIndex] = TrkEta;
161 Pars[LayerIndex] = DetType;
162 //std::cout << DetType << std::endl;
163 Pars[ClustersizeIndex] = DeltaCol;
164 m_OmegaEtah->Fill(OmegaEta,1,Pars);
165 m_OmegaEtah_model->Fill(OmegaEta);
166
167 if(OmegaEta > 0.1 && OmegaEta < 0.9){
168 m_etaProfile->Fill(OmegaEta,reseta,Pars);
169 m_etaH->Fill(OmegaEta,reseta,Pars);
170 }
171 }
172
173 if( DeltaRow > 1){// otherwise none to share with!
174
175 Pars[AngleIndex] = alpha;
176 Pars[LayerIndex] = DetType;
177 Pars[ClustersizeIndex] = DeltaRow;
178
179 m_OmegaPhih->Fill(OmegaPhi,1,Pars);
180 m_OmegaPhih_model->Fill(OmegaPhi);
181
182 if(OmegaPhi > 0.1 && OmegaPhi < 0.9){
183 m_phiProfile->Fill(OmegaPhi,resphi,Pars);
184 m_phiH->Fill(OmegaPhi,resphi,Pars);
185 }
186
187 }
188
189
190
191 return 0;
192
193}

◆ Fit()

bool PixelCalib::PixelChargeInterpolationHistograms::Fit ( TProfile * swap,
double * value,
double * error )
private

Definition at line 327 of file PixelChargeInterpolationHistograms.cxx.

327 {
328
329 // perform fits
330 if(swap->GetEntries() > 100){
331 TF1 *fitfunc = new TF1("fitfunc","[1] * x + [0]",0.15,0.85);
332 fitfunc->SetParameter(0,0);
333 fitfunc->SetParameter(1,0);
334 //fitfunc->SetParLimits(1,lowlim,hilim);
335 if(swap->Fit("fitfunc","QR") == 0 && fitfunc->GetProb() > 0.005){
336 *value = - fitfunc->GetParameter(1);
337 *error = fitfunc->GetParError(1);
338 if(fabs(*value) < 2*(*error) || *value < 0){
339 *value = 0;
340 *error = 0;
341 }
342 swap->GetXaxis()->SetTitle("Charge sharing");
343 swap->GetYaxis()->SetTitle("Residuals from the center of the cluster (#mum)");
344 swap->GetYaxis()->SetTitleOffset(1.2);
345 swap->GetXaxis()->SetTitleOffset(1.25);
346 swap->DrawCopy();
347
348 std::ostringstream FitString;
349 FitString.flags(std::ios::fixed);
350 FitString.precision(2);
351 FitString << "slope: " << *value << " #pm " << *error << " #mum";
352
353 DrawATLASLabel(0.2,0.4);
354 //DrawTitleLatex(FitString.str().c_str(), 0.2,0.3);
355 DrawTitleLatex(swap->GetTitle(), 0.6,0.85);
356
357 delete fitfunc;
358 fitfunc = 0;
359 return true;
360 }else{
361 std::cout << swap->GetTitle() << " " << swap->Fit("fitfunc","QR") << " " << fitfunc->GetProb() << std::endl;
362 *value = 0;
363 *error = 0;
364 return false;
365 }
366
367 }else return false;
368}
void DrawATLASLabel(float x, float y, bool pre=false, float textsize=0.05)

◆ operator=()

PixelChargeInterpolationHistograms & PixelCalib::PixelChargeInterpolationHistograms::operator= ( const PixelChargeInterpolationHistograms & )
delete

◆ Read()

int PixelCalib::PixelChargeInterpolationHistograms::Read ( )

Definition at line 197 of file PixelChargeInterpolationHistograms.cxx.

197 {
198
199 int readhistos = 0;
200 TDirectory *histodir = (TDirectory *)gDirectory->Get(m_etaProfile->GetName());
201 readhistos += m_etaProfile->FillFromFile(histodir);
202 histodir = (TDirectory *)gDirectory->Get(m_etaH->GetName());
203 readhistos += m_etaH->FillFromFile(histodir);
204 histodir = (TDirectory *)gDirectory->Get(m_phiProfile->GetName());
205 readhistos += m_phiProfile->FillFromFile(histodir);
206 histodir = (TDirectory *)gDirectory->Get(m_phiH->GetName());
207 readhistos += m_phiH->FillFromFile(histodir);
208
209 return readhistos;
210}

◆ Write()

int PixelCalib::PixelChargeInterpolationHistograms::Write ( )

Definition at line 214 of file PixelChargeInterpolationHistograms.cxx.

214 {
215
216 m_etaProfile->Write();
217 m_phiProfile->Write();
218 m_etaH->Write();
219 m_phiH->Write();
220
221 m_OmegaPhih->Write();
222 m_OmegaEtah->Write();
223 m_OmegaPhih_model->Write();
224 m_OmegaEtah_model->Write();
225
226 return m_etaProfile->GetNhistos() + m_phiProfile->GetNhistos()
227 + m_etaH->GetNhistos() + m_phiH->GetNhistos();
228}

Member Data Documentation

◆ m_etaH

MultiHisto<TH2F>* PixelCalib::PixelChargeInterpolationHistograms::m_etaH
private

Definition at line 47 of file PixelChargeInterpolationHistograms.h.

◆ m_etaProfile

MultiHisto<TProfile>* PixelCalib::PixelChargeInterpolationHistograms::m_etaProfile
private

Definition at line 45 of file PixelChargeInterpolationHistograms.h.

◆ m_OmegaEtah

MultiHisto<TH1F>* PixelCalib::PixelChargeInterpolationHistograms::m_OmegaEtah
private

Definition at line 50 of file PixelChargeInterpolationHistograms.h.

◆ m_OmegaEtah_model

TH1F* PixelCalib::PixelChargeInterpolationHistograms::m_OmegaEtah_model
private

Definition at line 51 of file PixelChargeInterpolationHistograms.h.

◆ m_OmegaPhih

MultiHisto<TH1F>* PixelCalib::PixelChargeInterpolationHistograms::m_OmegaPhih
private

Definition at line 49 of file PixelChargeInterpolationHistograms.h.

◆ m_OmegaPhih_model

TH1F* PixelCalib::PixelChargeInterpolationHistograms::m_OmegaPhih_model
private

Definition at line 52 of file PixelChargeInterpolationHistograms.h.

◆ m_parameters

PixelChargeInterpolationParameters* PixelCalib::PixelChargeInterpolationHistograms::m_parameters
private

Definition at line 44 of file PixelChargeInterpolationHistograms.h.

◆ m_phiH

MultiHisto<TH2F>* PixelCalib::PixelChargeInterpolationHistograms::m_phiH
private

Definition at line 48 of file PixelChargeInterpolationHistograms.h.

◆ m_phiProfile

MultiHisto<TProfile>* PixelCalib::PixelChargeInterpolationHistograms::m_phiProfile
private

Definition at line 46 of file PixelChargeInterpolationHistograms.h.

◆ m_tag

std::string PixelCalib::PixelChargeInterpolationHistograms::m_tag
private

Definition at line 42 of file PixelChargeInterpolationHistograms.h.


The documentation for this class was generated from the following files: