5 #ifndef PixelChargeInterpolationHistograms_C
6 #define PixelChargeInterpolationHistograms_C
14 #include <sys/types.h>
41 std::vector<float> *
layers = getLayersBins();
42 std::vector<float> etabins =
model.getEtaBins();
44 std::vector<float> clustersizeEta =
model.getClusterSizeYBins();
45 std::vector<float> clustersizePhi =
model.getClusterSizeXBins();
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;
52 unsigned int ntotbins = Nphi + NCSphi + Neta + NCSeta + 4;
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]);
59 for (
unsigned int i=0;
i<clustersizeEta.size();
i++) {
60 bins.push_back(clustersizeEta[
i]);
62 for (
unsigned int i=0;
i<etabins.size();
i++) {
63 bins.push_back(etabins[
i]);
65 for (
unsigned int i=0;
i<
phibins.size();
i++) {
75 "#eta residual vs charge sharing", 30, 0., 1.);
77 TH2F *THmodel =
new TH2F((
"etaResVsOmegaH"+
tag).c_str(),
78 "#eta residual vs charge sharing",
79 50, 0., 1.,50,-1000,1000);
81 std::vector<std::string> binsnames(3);
82 std::vector<std::vector <float> > binsvectors(3);
98 Profmodel->SetName((
"phiResVsOmega"+
tag).c_str());
99 Profmodel->SetTitle(
"#phi residual vs charge sharing");
101 TH2F *THmodel1 =
new TH2F((
"phiResVsOmegaH"+
tag).c_str(),
102 "#phi residual vs charge balancing",
103 50, 0., 1.,50,-200,200);
151 double TrkEta,
double DeltaCol,
double reseta,
double OmegaEta,
152 double alpha,
double DeltaRow,
double resphi,
double OmegaPhi){
155 std::vector<double> Pars(3);
156 if(GeVTrkPt == 0)
return -1;
167 if(OmegaEta > 0.1 && OmegaEta < 0.9){
182 if(OmegaPhi > 0.1 && OmegaPhi < 0.9){
235 logfile <<
"Fitting!" << std::endl;
238 TCanvas *
c1 =
new TCanvas();
239 c1->UseCurrentStyle();
247 swap->UseCurrentStyle();
253 <<
" --> Failing fit!" << std::endl;
263 if(
swap->GetEntries() < 100)
continue;
264 std::string
name = std::string(
swap->GetName()) + std::string(
".pdf");
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);
275 std::string
name1 = std::string(swap1->GetName()) + std::string(
".pdf");
284 swap->UseCurrentStyle();
290 <<
" --> Failing fit!" << std::endl;
300 if(
swap->GetEntries() < 100)
continue;
301 std::string
name = std::string(
swap->GetName()) + std::string(
".pdf");
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);
312 std::string
name1 = std::string(swap1->GetName()) + std::string(
".pdf");
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);
335 if(
swap->Fit(
"fitfunc",
"QR") == 0 && fitfunc->GetProb() > 0.005){
336 *
value = - fitfunc->GetParameter(1);
337 *
error = fitfunc->GetParError(1);
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);
348 std::ostringstream FitString;
349 FitString.flags(std::ios::fixed);
350 FitString.precision(2);
351 FitString <<
"slope: " << *
value <<
" #pm " << *
error <<
" #mum";
361 std::cout <<
swap->GetTitle() <<
" " <<
swap->Fit(
"fitfunc",
"QR") <<
" " << fitfunc->GetProb() << std::endl;
372 #endif // #ifdef PixelChargeInterpolationHistograms_C