Commit 407aa98c authored by Norbert Herrmann's avatar Norbert Herrmann
Browse files

still formatting ....

parent 6d62bfa7
void pl_all_Track2D(Int_t iOpt=1, Int_t iNSt=2)
{
void pl_all_Track2D(Int_t iOpt = 1, Int_t iNSt = 2) {
// TCanvas *can = new TCanvas("can22","can22");
// can->Divide(2,2);
// can->Divide(2,2);
// TCanvas *can = new TCanvas("can","can",48,55,700,900);
TCanvas *can = new TCanvas("can","can",48,56,900,900);
can->Divide(5,6,0.01,0.01);
// can->Divide(2,2,0,0);
Float_t lsize=0.07;
TCanvas* can = new TCanvas("can", "can", 48, 56, 900, 900);
can->Divide(5, 6, 0.01, 0.01);
// can->Divide(2,2,0,0);
Float_t lsize = 0.07;
gPad->SetFillColor(0);
gStyle->SetPalette(1);
gStyle->SetLabelSize(lsize);
gPad->SetFillColor(0);
gStyle->SetPalette(1);
gStyle->SetLabelSize(lsize);
//gStyle->SetOptStat(kTRUE);
//gROOT->cd();
//gROOT->SetDirLevel(2);
//gStyle->SetOptStat(kTRUE);
//gROOT->cd();
//gROOT->SetDirLevel(2);
TH2 *h;
TH2 *h2;
const Int_t iType[6]={0,9,5,5,7,8};
const Int_t iSmNum[6]={5,1,1,1,1,1};
const Int_t iRpcNum[6]={5,1,1,1,1,8};
TString cOpt;
TH2* h;
TH2* h2;
const Int_t iType[6] = {0, 9, 5, 5, 7, 8};
const Int_t iSmNum[6] = {5, 1, 1, 1, 1, 1};
const Int_t iRpcNum[6] = {5, 1, 1, 1, 1, 8};
TString cOpt;
switch(iOpt){
case 0:
cOpt="Size";
break;
case 1:
cOpt="Pos";
break;
case 2:
cOpt="TOff";
break;
case 3:
cOpt="Tot";
break;
case 4:
cOpt="Walk";
break;
case 5:
cOpt="Walk";
break;
case 6:
cOpt="Mul";
break;
case 7:
cOpt="Trms";
break;
case 8:
cOpt="DelPos";
break;
case 9:
cOpt="DelTOff";
break;
case 10:
cOpt="DelMatPos";
break;
case 11:
cOpt="DelMatTOff";
break;
default:
;
}
switch (iOpt) {
case 0: cOpt = "Size"; break;
case 1: cOpt = "Pos"; break;
case 2: cOpt = "TOff"; break;
case 3: cOpt = "Tot"; break;
case 4: cOpt = "Walk"; break;
case 5: cOpt = "Walk"; break;
case 6: cOpt = "Mul"; break;
case 7: cOpt = "Trms"; break;
case 8: cOpt = "DelPos"; break;
case 9: cOpt = "DelTOff"; break;
case 10: cOpt = "DelMatPos"; break;
case 11: cOpt = "DelMatTOff"; break;
default:;
}
Int_t iDet=0;
Double_t dAvMean=0.;
Double_t dAvRMS=0.;
Int_t iCanv=0;
Int_t iDet = 0;
Double_t dAvMean = 0.;
Double_t dAvRMS = 0.;
Int_t iCanv = 0;
for(Int_t iSt=0; iSt<iNSt; iSt++){
// cout << "plot station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
for(Int_t iSm=0; iSm<iSmNum[iSt];iSm++){
//cout << "plot module at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
for(Int_t iRp=0; iRp<iRpcNum[iSt];iRp++){
//cout << "plot rpc at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
can->cd(iCanv+1); iCanv++;
gROOT->cd();
TString hname="";
Int_t iCol=1;
switch(iOpt) {
case 4:
for (Int_t iSide=0; iSide<2; iSide++)
for (Int_t iCh=0; iCh<32; iCh++) {
hname=Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",iType[iSt],iSm,iRp,iCh,iSide,cOpt.Data());
h=(TH2 *)gROOT->FindObjectAny(hname);
if (h!=NULL) {
TProfile *hProf=h->ProfileX(Form("%s_pfx%d%d",hname.Data(),iCh,iSide));
hProf->SetLineColor(iCol);
hProf->SetLineStyle(1);
hProf->SetMarkerColor(iCol);
hProf->SetMarkerStyle(24+iSide);
iCol++;
if(iCh==0) iCol=1;
if(iCh==0 && iSide==0) {
hProf->SetMaximum(0.4);
hProf->SetMinimum(-0.4);
hProf->GetXaxis()->SetRangeUser(0.,10.);
hProf->Draw("LP");
} else {
hProf->Draw("LPsame");
}
}
}
break;
default:
hname=Form("cal_SmT%01d_sm%03d_rpc%03d_%s",iType[iSt],iSm,iRp,cOpt.Data());
h=(TH2 *)gROOT->FindObjectAny(hname);
if (h!=NULL) {
if (iOpt == 2 || iOpt==2 ) {
gPad->SetLogz();
}
h->Draw("colz");
h->ProfileX()->Draw("same");
iDet++;
dAvMean += h->ProfileX()->GetMean(2);
dAvRMS += h->ProfileX()->GetRMS(2);
cout << "TrackQA " << cOpt.Data() <<" for TSR " << iType[iSt] << iSm << iRp << ": Off "<< h->ProfileX()->GetMean(2)
<< ", RMS "<< h->ProfileX()->GetRMS(2) << endl;
}
}
}
for (Int_t iSt = 0; iSt < iNSt; iSt++) {
// cout << "plot station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
for (Int_t iSm = 0; iSm < iSmNum[iSt]; iSm++) {
//cout << "plot module at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
for (Int_t iRp = 0; iRp < iRpcNum[iSt]; iRp++) {
//cout << "plot rpc at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl;
can->cd(iCanv + 1);
iCanv++;
gROOT->cd();
TString hname = "";
Int_t iCol = 1;
switch (iOpt) {
case 4:
for (Int_t iSide = 0; iSide < 2; iSide++)
for (Int_t iCh = 0; iCh < 32; iCh++) {
hname = Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",
iType[iSt],
iSm,
iRp,
iCh,
iSide,
cOpt.Data());
h = (TH2*) gROOT->FindObjectAny(hname);
if (h != NULL) {
TProfile* hProf =
h->ProfileX(Form("%s_pfx%d%d", hname.Data(), iCh, iSide));
hProf->SetLineColor(iCol);
hProf->SetLineStyle(1);
hProf->SetMarkerColor(iCol);
hProf->SetMarkerStyle(24 + iSide);
iCol++;
if (iCh == 0) iCol = 1;
if (iCh == 0 && iSide == 0) {
hProf->SetMaximum(0.4);
hProf->SetMinimum(-0.4);
hProf->GetXaxis()->SetRangeUser(0., 10.);
hProf->Draw("LP");
} else {
hProf->Draw("LPsame");
}
}
}
break;
default:
hname = Form("cal_SmT%01d_sm%03d_rpc%03d_%s",
iType[iSt],
iSm,
iRp,
cOpt.Data());
h = (TH2*) gROOT->FindObjectAny(hname);
if (h != NULL) {
if (iOpt == 2 || iOpt == 2) { gPad->SetLogz(); }
h->Draw("colz");
h->ProfileX()->Draw("same");
iDet++;
dAvMean += h->ProfileX()->GetMean(2);
dAvRMS += h->ProfileX()->GetRMS(2);
cout << "TrackQA " << cOpt.Data() << " for TSR " << iType[iSt]
<< iSm << iRp << ": Off " << h->ProfileX()->GetMean(2)
<< ", RMS " << h->ProfileX()->GetRMS(2) << endl;
}
}
}
}
}
}
dAvMean /= (Double_t)iDet;
dAvRMS /= (Double_t)iDet;
cout << "TrackQA " << cOpt.Data() <<": AvOff "<< dAvMean << ", AvRMS "<< dAvRMS << endl;
dAvMean=TMath::Abs(dAvMean);
gROOT->ProcessLine(Form(".! echo %d > %sAvOff.res", (Int_t)(dAvMean*1.E4),cOpt.Data()));
gROOT->ProcessLine(Form(".! echo %d > %sAvRMS.res", (Int_t)(dAvRMS*1.E4),cOpt.Data()));
can->SaveAs(Form("pl_all_Track_%s.pdf",cOpt.Data()));
dAvMean /= (Double_t) iDet;
dAvRMS /= (Double_t) iDet;
cout << "TrackQA " << cOpt.Data() << ": AvOff " << dAvMean << ", AvRMS "
<< dAvRMS << endl;
dAvMean = TMath::Abs(dAvMean);
gROOT->ProcessLine(
Form(".! echo %d > %sAvOff.res", (Int_t)(dAvMean * 1.E4), cOpt.Data()));
gROOT->ProcessLine(
Form(".! echo %d > %sAvRMS.res", (Int_t)(dAvRMS * 1.E4), cOpt.Data()));
}
can->SaveAs(Form("pl_all_Track_%s.pdf", cOpt.Data()));
}
......@@ -208,13 +208,13 @@ void pl_over_trk(Int_t NSt = 4) {
if (h1 != NULL) {
h1->Draw("");
gPad->SetLogy();
hname = Form("hCalDY0");
TH1 *h1y = (TH1*) gROOT->FindObjectAny(hname);
hname = Form("hCalDY0");
TH1* h1y = (TH1*) gROOT->FindObjectAny(hname);
h1y->SetLineColor(2);
h1y->Draw("same");
} else {
cout << hname << " not found" << endl;
}
}
can->cd(14);
gROOT->cd();
......
void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0, Int_t iDrop=-1) {
void pl_pull_trk(Int_t NSt = 8,
Int_t iVar = 0,
Int_t iFit = 0,
Int_t iDrop = -1) {
// TCanvas *can = new TCanvas("can22","can22");
// can->Divide(2,2);
TCanvas* can = new TCanvas("can", "can", 50, 0, 800, 800);
......@@ -31,8 +34,8 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0, Int_t iDrop=-1)
Double_t vSigErr[MSt];
Double_t vResErr[MSt];
// if (h!=NULL) h->Delete();
Int_t iCan = 1;
Int_t iIndSt=0;
Int_t iCan = 1;
Int_t iIndSt = 0;
TString var;
Double_t Nall;
......@@ -54,18 +57,18 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0, Int_t iDrop=-1)
gPad->SetLogy();
gPad->SetGridx();
if (iFit > 0) {
Double_t dFMean = h1->GetMean();
Double_t dFLim = 3.0 * h1->GetRMS();
Double_t dFMean = h1->GetMean();
Double_t dFLim = 3.0 * h1->GetRMS();
Double_t dBinSize = h1->GetBinWidth(1);
dFLim=TMath::Max(dFLim,5.*dBinSize);
dFLim = TMath::Max(dFLim, 5. * dBinSize);
TFitResultPtr fRes =
h1->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim);
//cout << " fRes = "<< fRes <<endl;
if (-1 == fRes) continue;
if ( iDrop == iSt ) { // drop station from deconvolution
continue;
}
cout << "Add " << iSt << " as station index " << iIndSt << endl;
if (iDrop == iSt) { // drop station from deconvolution
continue;
}
cout << "Add " << iSt << " as station index " << iIndSt << endl;
vSt[iIndSt] = iSt;
vMean[iIndSt] = fRes->Parameter(1);
vSig[iIndSt] = fRes->Parameter(2);
......
void pl_trk_Walk(Int_t iId=900, Int_t iOpt=1, Double_t dMax=0.)
{
void pl_trk_Walk(Int_t iId = 900, Int_t iOpt = 1, Double_t dMax = 0.) {
// TCanvas *can = new TCanvas("can22","can22");
// can->Divide(2,2);
// can->Divide(2,2);
// TCanvas *can = new TCanvas("can","can",48,55,700,900);
TCanvas *can = new TCanvas("can","can",48,56,1400,900);
// can->Divide(2,2,0,0);
Float_t lsize=0.07;
TCanvas* can = new TCanvas("can", "can", 48, 56, 1400, 900);
// can->Divide(2,2,0,0);
Float_t lsize = 0.07;
gPad->SetFillColor(0);
gStyle->SetPalette(1);
gStyle->SetLabelSize(lsize);
gPad->SetFillColor(0);
gStyle->SetPalette(1);
gStyle->SetLabelSize(lsize);
//gStyle->SetOptStat(kTRUE);
//gROOT->cd();
//gROOT->SetDirLevel(2);
//gStyle->SetOptStat(kTRUE);
//gROOT->cd();
//gROOT->SetDirLevel(2);
TH2 *h;
TH2 *h2;
Int_t iRp=iId%10;
Int_t iSm=((iId-iRp)/10 )%10;
Int_t iTy=(iId-iSm*10-iRp)/100;
TH2* h;
TH2* h2;
Int_t iRp = iId % 10;
Int_t iSm = ((iId - iRp) / 10) % 10;
Int_t iTy = (iId - iSm * 10 - iRp) / 100;
TString cOpt="Walk";
TString cOpt = "Walk";
Int_t iDet=0;
Int_t iCanv=0;
Int_t iDet = 0;
Int_t iCanv = 0;
gROOT->cd();
TString hname="";
Int_t iCol=1;
switch(iOpt) {
case 0:;
break;
case 1:
{
can->Divide(4,8,0.01,0.01);
for (Int_t iCh=0; iCh<32; iCh++) {
can->cd(iCanv+1); iCanv++;
for (Int_t iSide=0; iSide<2; iSide++) {
hname=Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",iTy,iSm,iRp,iCh,iSide,cOpt.Data());
h=(TH2 *)gROOT->FindObjectAny(hname);
if (h!=NULL) {
TProfile *hProf=h->ProfileX(Form("%s_pfx%d%d",hname.Data(),iCh,iSide));
iCol=iSide+2;
gROOT->cd();
TString hname = "";
Int_t iCol = 1;
switch (iOpt) {
case 0:; break;
case 1: {
can->Divide(4, 8, 0.01, 0.01);
for (Int_t iCh = 0; iCh < 32; iCh++) {
can->cd(iCanv + 1);
iCanv++;
for (Int_t iSide = 0; iSide < 2; iSide++) {
hname = Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",
iTy,
iSm,
iRp,
iCh,
iSide,
cOpt.Data());
h = (TH2*) gROOT->FindObjectAny(hname);
if (h != NULL) {
TProfile* hProf =
h->ProfileX(Form("%s_pfx%d%d", hname.Data(), iCh, iSide));
iCol = iSide + 2;
hProf->SetLineColor(iCol);
hProf->SetMarkerColor(iCol);
hProf->SetMarkerStyle(20+iSide);
if(iSide==0) {
if(dMax>0.) {
hProf->SetMaximum(dMax);
hProf->SetMinimum(-dMax);
}
hProf->Draw();
} else {
hProf->Draw("same");
}
}
}
}
break;
case 20:
{
can->Divide(4,8,0.01,0.01);
for (Int_t iCh=0; iCh<32; iCh++) {
can->cd(iCanv+1); iCanv++;
Int_t iSide=0;
hname=Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",iTy,iSm,iRp,iCh,iSide,cOpt.Data());
h=(TH2 *)gROOT->FindObjectAny(hname);
if (h!=NULL) {
if(dMax>0.) {
// h->GetYAxis()->SetMaximum(dMax);
// h->GetYAxis()->SetMinimum(-dMax);
}
h->Draw("colz");
}
}
}
break;
case 21:
{
can->Divide(4,8,0.01,0.01);
for (Int_t iCh=0; iCh<32; iCh++) {
can->cd(iCanv+1); iCanv++;
Int_t iSide=1;
hname=Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",iTy,iSm,iRp,iCh,iSide,cOpt.Data());
h=(TH2 *)gROOT->FindObjectAny(hname);
if (h!=NULL) {
h->Draw("colz");
}
}
}
break;
case 200:
{
can->Divide(4,8,0.01,0.01);
for (Int_t iCh=0; iCh<32; iCh++) {
can->cd(iCanv+1); iCanv++;
Int_t iSide=0;
hname=Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",iTy,iSm,iRp,iCh,iSide,cOpt.Data());
h=(TH2 *)gROOT->FindObjectAny(hname);
if (h!=NULL) {
h->Draw("colz");
}
}
}
break;
case 201:
{
can->Divide(4,8,0.01,0.01);
for (Int_t iCh=0; iCh<32; iCh++) {
can->cd(iCanv+1); iCanv++;
Int_t iSide=1;
hname=Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",iTy,iSm,iRp,iCh,iSide,cOpt.Data());
h=(TH2 *)gROOT->FindObjectAny(hname);
if (h!=NULL) {
h->Draw("colz");
}
}
}
break;
default:
;
}
}
can->SaveAs(Form("pl_trk_Walk_%d.pdf",iId));
}
hProf->SetMarkerStyle(20 + iSide);
if (iSide == 0) {
if (dMax > 0.) {
hProf->SetMaximum(dMax);
hProf->SetMinimum(-dMax);
}
hProf->Draw();
} else {
hProf->Draw("same");
}
}
}
}
break;
case 20: {
can->Divide(4, 8, 0.01, 0.01);
for (Int_t iCh = 0; iCh < 32; iCh++) {
can->cd(iCanv + 1);
iCanv++;
Int_t iSide = 0;
hname = Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",
iTy,
iSm,
iRp,
iCh,
iSide,
cOpt.Data());
h = (TH2*) gROOT->FindObjectAny(hname);
if (h != NULL) {
if (dMax > 0.) {
// h->GetYAxis()->SetMaximum(dMax);
// h->GetYAxis()->SetMinimum(-dMax);
}
h->Draw("colz");
}
}
} break;
case 21: {
can->Divide(4, 8, 0.01, 0.01);
for (Int_t iCh = 0; iCh < 32; iCh++) {
can->cd(iCanv + 1);
iCanv++;
Int_t iSide = 1;
hname = Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",
iTy,
iSm,
iRp,
iCh,
iSide,
cOpt.Data());
h = (TH2*) gROOT->FindObjectAny(hname);
if (h != NULL) { h->Draw("colz"); }
}
} break;
case 200: {
can->Divide(4, 8, 0.01, 0.01);
for (Int_t iCh = 0; iCh < 32; iCh++) {
can->cd(iCanv + 1);
iCanv++;
Int_t iSide = 0;
hname = Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",
iTy,
iSm,
iRp,
iCh,
iSide,
cOpt.Data());
h = (TH2*) gROOT->FindObjectAny(hname);
if (h != NULL) { h->Draw("colz"); }
}
} break;
case 201: {
can->Divide(4, 8, 0.01, 0.01);
for (Int_t iCh = 0; iCh < 32; iCh++) {
can->cd(iCanv + 1);
iCanv++;
Int_t iSide = 1;
hname = Form("cl_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",
iTy,
iSm,
iRp,
iCh,
iSide,
cOpt.Data());
h = (TH2*) gROOT->FindObjectAny(hname);
if (h != NULL) { h->Draw("colz"); }
}
} break;
default:;
}
}
can->SaveAs(Form("pl_trk_Walk_%d.pdf", iId));
}