5 #ifndef PixelChargeInterpolationPlot_cxx
6 #define PixelChargeInterpolationPlot_cxx
30 m_histogramsX(0), m_histogramsY(0),
31 m_RefHistosX(0), m_RefHistosY(0),
32 m_etabins(0), m_phibins(0), m_netabins(0), m_nphibins(0),
33 m_referenceDrawOpt(0), m_oneconst(oneconst){
51 m_RefHistosX =
new std::vector < std::vector < TH1F* > >();
52 m_RefHistosY =
new std::vector < std::vector < TH1F* > >();
83 const std::string&
title,
int color,
const std::string& drawopt){
111 const std::string& direction,
int color,
const std::string&
title){
113 std::vector <TH1F*> *
histo =
new std::vector <TH1F*>();
114 std::vector<float> anglebins;
115 std::vector<float> csbins;
117 std::string xory, colorrow;
119 if(direction ==
"phi"){
146 int nangleBins = anglebins.size() - 1;
147 int nCsBins = csbins.size() - 1;
148 int nLayerBins = nConstants / (nangleBins * nCsBins);
150 int nhisto = nCsBins;
151 int nbinhisto = nLayerBins * nangleBins;
165 static std::atomic<int> pass = 0;
167 for(
int i = 0;
i < nhisto;
i++){
168 std::ostringstream NameString, TitleString;
169 NameString << csbins[
i] <<
"_" << direction <<
p
170 <<
"clustersize_ " << csbins[
i+1];
172 else TitleString <<
"Local " + xory +
" - "
173 << (csbins[
i] + csbins[
i+1]) /2 <<
"-" << colorrow <<
" clusters";
174 TH1F *currentPlot =
new TH1F(NameString.str().c_str(),
175 TitleString.str().c_str(),nbinhisto,0,nbinhisto);
176 currentPlot->UseCurrentStyle();
177 currentPlot->GetYaxis()->SetTitle(
"Charge sharing correction [#mum]");
179 currentPlot->SetLineColor(
color);
180 currentPlot->SetMarkerColor(
color);
181 for(
int j = 0; j < nangleBins; j++ ){
182 for(
int k = 0;
k < nLayerBins;
k++){
185 if(direction ==
"phi"){
192 int iBin = (nLayerBins*j)+
k+1;
193 currentPlot->SetBinContent(iBin,
constant*1000);
195 currentPlot->SetBinError(iBin,
error*1000);
203 histo->push_back(currentPlot);
212 const std::string& direction){
214 std::vector < std::vector < TH1F* > > *RefHistos = 0;
217 if(direction ==
"phi"){
225 unsigned int nhistos_all =
histograms->size();
226 unsigned int nhistos = 0;
229 for(
unsigned int i = 0;
i < nhistos_all;
i++){
236 for(
unsigned int i = 0;
i < nhistos;
i++){
237 TCanvas*
c1 =
new TCanvas();
239 float maximum = (*histograms)[
i]->GetMaximum();
240 for(
unsigned int j = 0; j < RefHistos->size(); j++){
241 float newmax = ((*RefHistos)[j])[
i]->GetMaximum();
242 if(maximum < newmax) maximum = newmax;
245 c1->SetBottomMargin(0.18);
249 size_t found =
title.find(
"PixelChargeInterpolationData");
257 unsigned int nreferences = RefHistos->size();
260 for(
unsigned int j = 0; j < nreferences; j++){
262 std::string
title = ((*RefHistos)[j])[
i]->GetTitle();
263 size_t found =
title.find(
"PixelChargeInterpolationData");
267 0.20, 0.83 - (j+1)*0.06,
268 ((*RefHistos)[j])[
i]->GetMarkerColor(),0.05);
270 0.15, 0.83 - (j+1)*0.05,
271 ((*RefHistos)[j])[
i]->GetMarkerColor());
278 for(
unsigned int i = 0;
i < nhistos;
i++){
279 std::ostringstream
name;
299 float ymaximum = 1.5 * maximum;
300 float yminimum = - 0.1 *
histo->GetMaximum();
301 histo->SetMaximum(ymaximum);
302 histo->SetMinimum(yminimum);
303 histo->GetXaxis()->SetLabelOffset(10);
304 histo->GetXaxis()->SetNdivisions(0);
307 int xmaximum =
histo->GetNbinsX();
328 histo->GetXaxis()->SetRange(xminimum,xmaximum);
329 histo->DrawCopy(
"AXIS");
331 DrawAxis(yminimum, ymaximum, xminimum, xmaximum, direction);
342 int startmarker = 21;
344 markers->SetMarkerStyle(startmarker+5*goodj);
347 for (
int j = 1; j <
markers->GetNbinsX(); j++){
352 for (
int j = 0; j <
markers->GetNbinsX(); j++){
355 markers->GetXaxis()->SetRange(j+1,j+1);
372 int startmarker = 21;
373 float textsize = 0.03;
376 std::vector<std::string>
names;
377 names.push_back(
"b-layer");
378 names.push_back(
"Layer 1");
379 names.push_back(
"Layer 2");
380 names.push_back(
"Disk 1");
381 names.push_back(
"Disk 2");
382 names.push_back(
"Disk 3");
386 xlegend, ylegend -
i*textsize,
397 float stdtextsize = 0.05;
401 int naxbins = lastbin - firstbin;
403 std::string axtitle =
"";
406 if(direction ==
"phi"){
408 axtitle =
"Track incident angle (#phi_{i}) [#circ]";
409 }
else if(direction ==
"eta"){
411 axtitle =
"Track incident pseudorapidity (#eta_{i})";
413 if (!axbins) {
return; }
417 TGaxis *
axis =
new TGaxis(
x1-1,
y1,
x2,
y1, axbins[firstbin], axbins[lastbin], naxbins);
418 axis->UseCurrentStyle();
419 axis->SetName(direction.c_str());
420 axis->SetTitle(axtitle.c_str());
421 axis->SetTitleFont(stdfont);
422 axis->SetTitleSize(stdtextsize);
424 if(naxbins > 20)
offset = 1.8;
426 std::string
opt =
"UNW+-";
429 axbins[firstbin], axbins[lastbin], naxbins,
opt.c_str());
431 axbins[firstbin], axbins[lastbin], naxbins,
"UN-");
434 label.SetTextSize(stdtextsize);
435 label.SetTextFont(stdfont);
436 label.SetTextAlign(23);
437 double pass = (
axis->GetX2()-
axis->GetX1() ) /
double( naxbins);
438 double ylabel =
y1 - 0.05 * (
y2 -
y1);
440 for(
int i = 0 ;
i <= naxbins;
i++){
441 std::ostringstream LabelString;
442 LabelString << axbins[firstbin+
i];
443 float ylabel2 = ylabel;
444 if(naxbins > 20) ylabel2 = ylabel +
i%2 *
distance;
445 label.DrawLatex(
axis->GetX1() +
i * pass, ylabel2,
446 LabelString.str().c_str());