5 #ifndef PixelChargeInterpolationValidation_C
6 #define PixelChargeInterpolationValidation_C
13 #include <TDirectory.h>
24 static const int NLAYERS = 4;
25 static const int NCLUSSIZES = 10;
52 std::vector<float> *
layers = getLayersBins();
53 std::vector<float> clustersizeEta =
model.getClusterSizeYBins();
54 clustersizeEta.insert(clustersizeEta.begin(),0.5);
55 clustersizeEta.push_back(100);
56 std::vector<float> clustersizePhi =
model.getClusterSizeXBins();
57 clustersizePhi.insert(clustersizePhi.begin(),0.5);
58 clustersizePhi.push_back(100);
60 std::vector<float> phibins_Layer;
61 for(
int i = -60;
i <= 60;
i+=2) phibins_Layer.push_back(
i);
62 std::vector<float> etabins_Layer;
63 for(
float i = -2.5;
i <= 2.5;
i+=0.125) etabins_Layer.push_back(
i);
64 std::vector<float> ptbins_Layer;
68 ptbins_Layer.reserve(ntot+1);
69 for(
int i = 0;
i < ntot+1;
i++){
75 std::vector<std::string> binsnames(3);
76 std::vector<std::vector <float> > binsvectors(3);
87 std::string(
"Local y residuals - Analog position"),
88 500,100,binsvectors,binsnames);
91 std::string(
"Local y residuals - Center position"),
92 500,100,binsvectors,binsnames);
95 std::string(
"Local y pulls - Analog position"),
96 10.,100,binsvectors,binsnames);
99 std::string(
"Local y errors - Cluster uncertainty"),
100 1000,250,binsvectors,binsnames);
103 std::string(
"Local x residuals - Analog position"),
104 150, 100, binsvectors,binsnames);
107 std::string(
"Local x residuals - Center position"),
108 150, 100, binsvectors,binsnames);
111 std::string(
"Local x pulls - Analog position"),
112 10.,100,binsvectors,binsnames);
115 std::string(
"Local x errors - Cluster uncertainty"),
116 100,100,binsvectors,binsnames);
119 std::string(
"Charge"),
120 600000,600,binsvectors,binsnames);
128 std::string(
"Local x residuals - Analog position"),
129 150, 100, binsvectors,binsnames);
132 std::string(
"Local x residuals - Center position"),
133 150, 100, binsvectors,binsnames);
136 std::string(
"Local x pulls - Analog position"),
137 10.,100,binsvectors,binsnames);
140 std::string(
"Local x errors - Cluster uncertainty"),
141 100,100,binsvectors,binsnames);
144 std::string(
"Local y residuals - Analog position"),
145 500,100,binsvectors,binsnames);
148 std::string(
"Local y residuals - Center position"),
149 500,100,binsvectors,binsnames);
152 std::string(
"Local y pulls - Analog position"),
153 10.,100,binsvectors,binsnames);
156 std::string(
"Local y errors - Cluster uncertainty"),
157 1000,250,binsvectors,binsnames);
160 std::string(
"Charge"),
161 600000,600,binsvectors,binsnames);
163 std::vector<std::string> binsnames_Layer(2);
164 std::vector<std::vector <float> > binsvectors_Layer(2);
166 binsnames_Layer[0] =
"p_{T} [GeV]";
167 binsnames_Layer[1] =
"#eta_{i}";
169 binsvectors_Layer[0] = std::move(ptbins_Layer);
170 binsvectors_Layer[1] = etabins_Layer;
172 for(
int i = 0 ;
i < NLAYERS;
i++){
174 std::cout <<
"layers " << NLAYERS <<
" " <<
i << std::endl;
176 std::ostringstream
name;
177 std::ostringstream
title;
178 name <<
"ResEta_Layer" <<
i;
179 title <<
"Local y resolution - Layer " <<
i ;
182 (
title.str() +
" - Analog position").c_str(),
183 500, 100, binsvectors_Layer, binsnames_Layer)
187 (
title.str() +
" - Center position").c_str(),
188 500, 100, binsvectors_Layer, binsnames_Layer)
192 (
title.str() +
" - Pulls").c_str(),
193 10., 100, binsvectors_Layer, binsnames_Layer)
198 binsnames_Layer[1] =
"#phi_{i} [#circ]";
199 binsvectors_Layer[1] = phibins_Layer;
201 for(
int i = 0 ;
i < NLAYERS;
i++){
202 std::ostringstream
name;
203 std::ostringstream
title;
204 name <<
"ResPhi_Layer" <<
i;
205 title <<
"Local x resolution - Layer " <<
i ;
208 (
title.str() +
" - Analog position").c_str(),
209 150, 100, binsvectors_Layer, binsnames_Layer)
213 (
title.str() +
" - Center position").c_str(),
214 150, 100, binsvectors_Layer, binsnames_Layer)
218 (
title.str() +
" - Pulls").c_str(),
219 10., 100, binsvectors_Layer, binsnames_Layer)
223 std::vector<std::string> binsnames_Clustersize(1);
224 std::vector<std::vector <float> > binsvectors_Clustersize(1);
226 binsnames_Clustersize[0] =
"#eta_{i}";
227 binsvectors_Clustersize[0] = etabins_Layer;
229 for(
int i = 0 ;
i < NCLUSSIZES;
i++){
230 std::ostringstream
name;
231 std::ostringstream
title;
232 name <<
"ResEta_Clustersize" <<
i+1;
233 title <<
"Local y resolution - Clustersize " <<
i+1;
236 (
title.str() +
" - Analog position").c_str(),
237 400, 100, binsvectors_Clustersize, binsnames_Clustersize)
241 (
title.str() +
" - Center position").c_str(),
242 400, 100, binsvectors_Clustersize, binsnames_Clustersize)
246 (
title.str() +
" - Cluster uncertainty").c_str(),
247 1000, 250, binsvectors_Clustersize, binsnames_Clustersize)
251 (
title.str() +
" - Pull").c_str(),
252 10., 100., binsvectors_Clustersize, binsnames_Clustersize)
254 std::ostringstream namecs;
255 std::ostringstream titlecs;
256 namecs <<
"Eta_Clustersize" <<
i+1;
257 titlecs <<
"#eta_{i} distribution - Clustersize " <<
i+1 ;
259 new TH1F(namecs.str().c_str(), titlecs.str().c_str(),
260 etabins_Layer.size(), etabins_Layer[0],
261 etabins_Layer[etabins_Layer.size()-1])
266 binsnames_Clustersize[0] =
"#phi_{i} [#circ]";
267 binsvectors_Clustersize[0] = std::move(phibins_Layer);
269 for(
int i = 0 ;
i < NCLUSSIZES;
i++){
270 std::ostringstream
name;
271 std::ostringstream
title;
272 name <<
"ResPhi_Clustersize" <<
i+1;
273 title <<
"Local x resolution - Clustersize " <<
i+1;
276 (
title.str() +
" - Analog position").c_str(),
277 150, 100, binsvectors_Clustersize, binsnames_Clustersize)
281 (
title.str() +
" - Center position").c_str(),
282 150, 100, binsvectors_Clustersize, binsnames_Clustersize)
286 (
title.str() +
" - Cluster uncertainty").c_str(),
287 100, 100, binsvectors_Clustersize, binsnames_Clustersize)
291 (
title.str() +
" - Pull").c_str(),
292 10., 100., binsvectors_Clustersize, binsnames_Clustersize)
294 std::ostringstream namecs;
295 std::ostringstream titlecs;
296 namecs <<
"Phi_Clustersize" <<
i+1;
297 titlecs <<
"#phi_{i} distribution - Clustersize " <<
i+1 ;
299 new TH1F(namecs.str().c_str(), titlecs.str().c_str(),
305 "#phi_{i} #eta_{i} correlation", 100, -100,100, 100, -2.5, 2.5);
311 "#Deltarow #Deltacolumn correlation", 10, 0,10, 10, 0, 10);
317 double ptbins_Layerpointer[101];
321 for(
int i = 0;
i < ntot2+1;
i++){
322 ptbins_Layerpointer[
i] = start2 *
pow( end2/start2,
double(
i)/
double(ntot2) );
325 "Local y residuals vs p_{T}",
326 100, ptbins_Layerpointer, 100, -1000, 1000);
328 100, ptbins_Layerpointer, 100, -400, 400);
377 for(
int i = 0 ;
i < NLAYERS;
i++){
393 for(
int i = 0 ;
i < NCLUSSIZES;
i++){
430 TDirectory *globaldir = (TDirectory *)
gDirectory->Get(
"Validation");
451 for(
int i = 0 ;
i < NLAYERS;
i++){
459 for(
int i = 0 ;
i < NCLUSSIZES;
i++){
483 TDirectory *globaldir;
484 if(writedir != 0) writedir->cd();
487 int writtenhistos = 0;
507 for(
int i = 0 ;
i < NLAYERS;
i++){
515 for(
int i = 0 ;
i < NCLUSSIZES;
i++){
534 return writtenhistos;
551 int neta = etaModel->GetNbinsX();
552 int nalpha = phiModel->GetNbinsX();
553 int ntotbins = ncsx + ncsy + neta + nalpha;
555 std::vector<float>
values;
558 for (
int i=0;
i<ncsx && globalindex<ntotbins;
i++, globalindex++) {
561 for (
int i=0;
i<ncsy && globalindex<ntotbins;
i++, globalindex++) {
565 for (
int i=1;
i<neta && globalindex<ntotbins;
i++, globalindex++) {
566 values.push_back(etaModel->GetBinLowEdge(
i+1));
569 for (
int i=1;
i<nalpha && globalindex<ntotbins;
i++, globalindex++) {
570 values.push_back(phiModel->GetBinLowEdge(
i+1));
574 int ntotyconstnx = ncsx * nalpha;
576 for(
int i = 0;
i < nalpha && globalindex < ntotyconstnx;
i++)
577 for(
int j = 0; j < ncsx && globalindex < ntotyconstnx; j++, globalindex++){
579 if (
value == 0)
value = (j+1)*50/sqrt(12)/1000;
582 int ntotyconstny = ncsx * ncsy * neta;
584 for(
int i = 0;
i < neta && globalindex < ntotyconstny;
i++)
585 for(
int j = 0; j < ncsx && globalindex < ntotyconstny; j++)
586 for(
int k = 0;
k < ncsy && globalindex < ntotyconstny;
k++, globalindex++){
599 double Phi,
double CSphi,
double digResPhi,
double ResPhi,
double ErrPhi, Double_t PullPhi,
600 double Eta,
double CSeta,
double digResEta,
double ResEta,
double ErrEta, Double_t PullEta,
double Charge){
628 if(
Layer < NLAYERS){
629 std::vector< float >parameters_Layer(2);
630 if(GeVTrkPt < 10E10) parameters_Layer[0] = GeVTrkPt;
631 else parameters_Layer[0] = 1.;
633 parameters_Layer[1] =
Eta;
638 parameters_Layer[1] =
Phi;
644 std::vector< float >parameters_Clustersize(1);
646 if(
int(CSeta)-1 < NCLUSSIZES){
647 parameters_Clustersize[0] =
Eta;
654 if(
int(CSphi)-1 < NCLUSSIZES){
655 parameters_Clustersize[0] =
Phi;
676 if(ref_file == 0)
return;
797 #endif // #ifdef PixelChargeInterpolationValidation_C