Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code to monitor tracker cluster occupancy in upgrade geometries #3235

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added new macro to plot fraction of on-track clusters
venturia committed Apr 7, 2014

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit ab690033aed86862cfca5bd683170d145978e2b5
Original file line number Diff line number Diff line change
@@ -27,4 +27,5 @@
#pragma link C++ function printSOF;
#pragma link C++ function AverageRunBadChannels;
#pragma link C++ function StripCompletePlot;
#pragma link C++ function PlotOnTrackOccupancyPhase2;;
#endif
214 changes: 214 additions & 0 deletions DPGAnalysis/SiStripTools/bin/OccupancyPlotMacros.cc
Original file line number Diff line number Diff line change
@@ -743,3 +743,217 @@ float combinedOccupancy(TFile* ff, const char* module, const int lowerbin, const
return cumoccu;

}

void PlotOnTrackOccupancyPhase2(TFile* ff, const char* module, const char* ontrkmod, const float mmin, const float mmax, const int color) {

if(color == 1) {
// A not-so-great color version
const Int_t NRGBs = 5;
const Int_t NCont = 255;
Double_t stops[NRGBs] = { 0.00, 0.25, 0.50, 0.75, 1.00 };
Double_t red[NRGBs] = { 0.00, 0.00, 0.40, 1.00, 1.00 };
Double_t green[NRGBs] = { 0.00, 0.40, 0.70, 0.60, 1.00 };
Double_t blue[NRGBs] = { 0.30, 0.60, 0.00, 0.00, 0.20 };
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
gStyle->SetNumberContours(NCont);
}
else if(color==2) {
// Gray scale
const Int_t NRGBs = 3;
const Int_t NCont = 255;
Double_t stops[NRGBs] = { 0.00, 0.50, 1.00 };
Double_t red[NRGBs] = { 0.90, 0.50, 0.00};
Double_t green[NRGBs] = { 0.90, 0.50, 0.00};
Double_t blue[NRGBs] = { 0.90, 0.50, 0.00};
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
gStyle->SetNumberContours(NCont);
}
else if(color==3) {
// used by Kevin in the TRK-11-001 paper
const Int_t NRGBs = 7;
const Int_t NCont = 255;
Double_t stops[NRGBs] = { 0.00, 0.15, 0.30, 0.45, 0.65, 0.85, 1.00 };
Double_t red[NRGBs] = { 0.60, 0.30, 0.00, 0.00, 0.60, 0.40, 0.00 };
Double_t green[NRGBs] = { 1.00, 0.90, 0.80, 0.75, 0.20, 0.00, 0.00 };
Double_t blue[NRGBs] = { 1.00, 1.00, 1.00, 0.30, 0.00, 0.00, 0.00 };
TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
gStyle->SetNumberContours(NCont);
}

int ncol = gStyle->GetNumberOfColors();
std::cout << "Number of colors " << ncol << std::endl;

gROOT->SetStyle("Plain");

TProfile* avemult=0;
TProfile* aveontrkmult=0;
TProfile* averadius =0;
TProfile* avez =0;

if(ff->cd(module)) {
avemult= (TProfile*)gDirectory->Get("avemult");
averadius = (TProfile*)gDirectory->Get("averadius");
avez = (TProfile*)gDirectory->Get("avez");
}
if(ff->cd(ontrkmod)) aveontrkmult= (TProfile*)gDirectory->Get("avemult");

std::cout << "pointers " << avemult << " " << aveontrkmult << " " << averadius << " " << avez << std::endl;

if( averadius && avez && avemult && aveontrkmult) {

TH1D* havemult = avemult->ProjectionX("havemult");
TH1D* haveontrkmult = aveontrkmult->ProjectionX("haveontrkmult");
havemult->SetDirectory(0);
haveontrkmult->SetDirectory(0);
haveontrkmult->Divide(havemult);

new TCanvas("ontrkmult","ontrkmult",1200,500);
gPad->SetLogy(1);
haveontrkmult->SetStats(0);
haveontrkmult->SetLineColor(kRed);
haveontrkmult->SetMarkerColor(kRed);
haveontrkmult->SetMarkerSize(.5);
haveontrkmult->SetMarkerStyle(20);
haveontrkmult->DrawCopy();
TLine* l1 = new TLine(1000,0,1000,haveontrkmult->GetMaximum()); l1->DrawClone();
TLine* l2 = new TLine(2000,0,2000,haveontrkmult->GetMaximum()); l2->DrawClone();
TLine* l3 = new TLine(3000,0,3000,haveontrkmult->GetMaximum()); l3->DrawClone();
TLine* l4 = new TLine(4000,0,4000,haveontrkmult->GetMaximum()); l4->DrawClone();
TLine* l5 = new TLine(5000,0,5000,haveontrkmult->GetMaximum()); l5->DrawClone();
TText* tpix = new TText(1500,haveontrkmult->GetMaximum(),"BPIX+FPIX"); tpix->SetTextAlign(22); tpix->DrawClone();
// TText* ttib = new TText(1500,haveontrkmult->GetMaximum(),"TIB"); ttib->SetTextAlign(22); ttib->DrawClone();
// TText* ttid = new TText(2500,haveontrkmult->GetMaximum(),"TID"); ttid->SetTextAlign(22); ttid->DrawClone();
TText* ttob = new TText(2500,haveontrkmult->GetMaximum(),"TOB"); ttob->SetTextAlign(22); ttob->DrawClone();
TText* ttecm = new TText(3500,haveontrkmult->GetMaximum(),"TEC-"); ttecm->SetTextAlign(22); ttecm->DrawClone();
TText* ttecp = new TText(4500,haveontrkmult->GetMaximum(),"TEC+"); ttecp->SetTextAlign(22); ttecp->DrawClone();

TCanvas * o2 = new TCanvas("ontrkmult2","ontrkmult2",1200,800);
o2->Divide(2,2);
printFrame(o2,haveontrkmult,tpix,1,1000,1090);
printFrame(o2,haveontrkmult,ttob,2,2000,2900);
printFrame(o2,haveontrkmult,ttecm,3,3100,3300);
printFrame(o2,haveontrkmult,ttecp,4,4100,4300);

// Loop on bins and creation of boxes

TList modulesmult;

for(int i=1;i<haveontrkmult->GetNbinsX();++i) {

if(i<1000) continue;

if(averadius->GetBinEntries(i)*avez->GetBinEntries(i)) {

double dz = 2.;
double dr = 1.;
// determine module size

if(i > 1000 && i < 1040) { dz=3.33;dr=0.4;}
if(i > 1040 && i < 1130) { dr=3.33;dz=0.4;}

if(i > 2000 && i < 2550) { dz=2.5;dr=0.1;}
if(i > 2550 && i < 3000) { dz=5.0;dr=0.1;}

if(i > 3000 && i < 5000) { dz=0.2;dr=5.0;}

if(i > 3100 && i < 3119) { dz=0.2;dr=2.5;}
if(i > 3140 && i < 3159) { dz=0.2;dr=2.5;}
if(i > 3180 && i < 3199) { dz=0.2;dr=2.5;}
if(i > 3220 && i < 3239) { dz=0.2;dr=2.5;}
if(i > 3260 && i < 3279) { dz=0.2;dr=2.5;}

if(i > 4100 && i < 4119) { dz=0.2;dr=2.5;}
if(i > 4140 && i < 4159) { dz=0.2;dr=2.5;}
if(i > 4180 && i < 4199) { dz=0.2;dr=2.5;}
if(i > 4220 && i < 4239) { dz=0.2;dr=2.5;}
if(i > 4260 && i < 4279) { dz=0.2;dr=2.5;}

{
TBox* modmult = new TBox(avez->GetBinContent(i)-dz,averadius->GetBinContent(i)-dr,avez->GetBinContent(i)+dz,averadius->GetBinContent(i)+dr);
modmult->SetFillStyle(1001);
int icol=int(ncol*(haveontrkmult->GetBinContent(i)-mmin)/(mmax-mmin));
if(icol < 0) icol=0;
if(icol > (ncol-1)) icol=(ncol-1);
std::cout << i << " " << icol << " " << haveontrkmult->GetBinContent(i) << std::endl;
modmult->SetFillColor(gStyle->GetColorPalette(icol));
modulesmult.Add(modmult);
}

}

}
// eta boundaries lines
TList etalines;
TList etalabels;
for(int i=0;i<8;++i) {
double eta = 3.0-i*0.2;
TLine* lin = new TLine(295,2*295/(exp(eta)-exp(-eta)),305,2*305/(exp(eta)-exp(-eta)));
etalines.Add(lin);
char lab[100];
sprintf(lab,"%3.1f",eta);
TText* label = new TText(285,2*285/(exp(eta)-exp(-eta)),lab);
label->SetTextSize(.03);
label->SetTextAlign(22);
etalabels.Add(label);
}
for(int i=0;i<8;++i) {
double eta = -3.0+i*0.2;
TLine* lin = new TLine(-295,-2*295/(exp(eta)-exp(-eta)),-305,-2*305/(exp(eta)-exp(-eta)));
etalines.Add(lin);
char lab[100];
sprintf(lab,"%3.1f",eta);
TText* label = new TText(-285,-2*285/(exp(eta)-exp(-eta)),lab);
label->SetTextSize(.03);
label->SetTextAlign(22);
etalabels.Add(label);
}
for(int i=0;i<15;++i) {
double eta = -1.4+i*0.2;
TLine* lin = new TLine(130.*(exp(eta)-exp(-eta))/2.,130,138.*(exp(eta)-exp(-eta))/2.,138);
etalines.Add(lin);
char lab[100];
sprintf(lab,"%3.1f",eta);
TText* label = new TText(125.*(exp(eta)-exp(-eta))/2.,125,lab);
label->SetTextSize(.03);
label->SetTextAlign(22);
etalabels.Add(label);
}


TGaxis *raxis = new TGaxis(-310,0,-310,140,0,140,10,"S");
TGaxis *zaxis = new TGaxis(-310,0,310,0,-310,310,10,"S");
raxis->SetTickSize(.01); zaxis->SetTickSize(.01);
raxis->SetTitle("R (cm)"); zaxis->SetTitle("Z (cm)");

TList mpalette;

for(int i = 0;i< ncol ; ++i) {
TBox* box= new TBox(315,0+140./ncol*i,330,0+140./ncol*(i+1));
box->SetFillStyle(1001);
box->SetFillColor(gStyle->GetColorPalette(i));
mpalette.Add(box);

}

TGaxis *mpaxis = new TGaxis(330,0,330,140,mmin,mmax,510,"SL+");
mpaxis->SetTickSize(.02);
mpaxis->SetLabelOffset(mpaxis->GetLabelOffset()*0.5);
mpalette.Add(mpaxis);

TCanvas* cc2 = new TCanvas("multmap","multmap",1000,500);
cc2->Range(-370.,-20.,390.,150.);
TFrame* fr2 = new TFrame(-310,0,310,140);
fr2->UseCurrentStyle();
fr2->Draw();
raxis->Draw(); zaxis->Draw();
std::cout << modulesmult.GetSize() << std::endl;
etalines.Draw();
etalabels.Draw();
mpalette.Draw();
modulesmult.Draw();

}

}


1 change: 1 addition & 0 deletions DPGAnalysis/SiStripTools/bin/OccupancyPlotMacros.h
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ void PlotOccupancyMap(TFile* ff, const char* module, const float min, const floa
void PlotOccupancyMapPhase2(TFile* ff, const char* module, const float min, const float max, const float mmin, const float mmax, const int color);
void printFrame(TCanvas* c, TH1D* h, TText* t, const int frame, const int min, const int max);
float combinedOccupancy(TFile* ff, const char* module, const int lowerbin, const int upperbin);
void PlotOnTrackOccupancyPhase2(TFile* ff, const char* module, const char* ontrkmod, const float mmin, const float mmax, const int color);

#endif // DPGAnalysis_SiStripTools_OccupancyPlotMacros_h