#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "TMath.h" #include #include #include #include #include #include #include #include "TSystem.h" #include #include #include #include #include #include #include #include "TVirtualFFT.h" #define SizeOfArray(a) (sizeof(a)/sizeof(a[0])) using std::ios; using std::cout; using std::cin; using std::endl; using std::istringstream; using std::ostringstream; std::ifstream indata; TLatex *myLatex; TGClient *TC; double ym; TTree *BeamHVtree; int timeStamp[6];// year,month,day,hours,minutes,secons double BeamHVlocal[4]; double GADCcalibr; // tracks/GADC double CherIntegrals[8]; // Static, StaticTail, StaticFilled, StaticFilledTail // Dynamic, DynamicTail, DynamicFilled, DynamicFilledTail double specGADC[440]; double specGADCped[440]; TTree *IHEPtree; union mix_t {double D; unsigned short sc[4]; unsigned int ic[2]; unsigned char c[8];} mix; int spill; int burst; int burstBeam; int spillBC; int scalers[8]; int calib; int xSEC[16]; int ySEC[16]; int xSECt=0; int ySECt=0; int rateHeader[7]; int rateRecord[640]; double ionChamber; TTree *HODOtree; // fill for S123 runs only, so separate file int hodoX[16]; int hodoY[16]; char postscriptDirectorry[200]; char version_in[100]; char version_out[100]; char postScriptName[300]; char fileBEAMname[300]; char fileIHEPname[300]; char fileHODOname[300]; //----------------------------------------- void Summary20141219_spill_data() { //----------------------------------------- int iqq; bool hodoscopeIN; //TFile *treeFileIHEP; // IHEP intensity data //TFile *treeFileBeamHV;// BeamHV data: Cherenkov, S123 //TFile *treeFileHodo; // file with hodoscope data int myLocation=0; int displayWidth; int displayHeight; int canvasWidth=600; int canvasHeight=1000; int eventToCatch=-1; double hodoXcorr[16]; // efficiency correction stuff double hodoYcorr[16]; double hodoXcorr0[16]; double hodoYcorr0[16]; double hodoXcorr1[16]; double hodoYcorr1[16]; double hodoXcorr2[16]; double hodoYcorr2[16]; double hodoXcorr3[16]; double hodoYcorr3[16]; double hodoXmean, hodoXpeak, hodoXmean3, hodoXsum; double hodoYmean, hodoYpeak, hodoYmean3, hodoYsum; sprintf(version_in, "2012v2_12_12"); sprintf(version_out, "2015_01_04_1092"); iqq=1; TC = new TGClient(); displayWidth = TC->GetDisplayWidth(); displayHeight = TC->GetDisplayHeight(); if (canvasWidth>displayWidth/6-10) canvasWidth=displayWidth/6-10; if (canvasHeight>displayHeight-50) canvasHeight=displayHeight-50; if (canvasWidth<600) canvasWidth=600; printf("w=%d h=%d\n", displayWidth, displayHeight); myLatex = new TLatex(); myLatex->SetTextAlign(22); myLatex->SetTextSize(0.02); TLine *myLine = new TLine(); myLocation=-1; indata.open("location.dat", ios::in); if(!indata.is_open()) { printf("[HiLumRead2014] location.dat, bye\n"); } indata>>myLocation; indata.close(); indata.clear(); if (myLocation==1) { printf("Running on the Sasha's laptop\n"); sprintf(postscriptDirectorry, "plots2014_05/"); } else if (myLocation==0) { sprintf(postscriptDirectorry, "/raid04/HiLum/analysis2012/reports/Rate/plots/"); printf("Running on the Sasha's desktop\n"); } else { printf("Running at unknown location#%d\n", myLocation); sprintf(postscriptDirectorry, "/rate/"); } //------------------------------------------- TH1D *h1 = new TH1D(); TH1D *h1ped = new TH1D(); TH1D *h2 = new TH1D(); //------------------------------------------- TH1D* IonChamberLow = new TH1D("IonLow", "Ion Chamber Low", 101, -50.5, 50.5); IonChamberLow->GetXaxis()->SetTitle("Ion Chamber, a.u."); IonChamberLow->GetYaxis()->SetTitle("Spills"); TH1D* spectrumGADC = new TH1D("GADC spectrum", "GADC spectrum", 440, -300., 4100.); TH1D* spectrumGADCped = new TH1D("GADC pedestal", "GADC pedestal", 440, -300., 4100.); TH1D* rateDummyGADC = new TH1D("GADC Rate dummy", "GADC Rate", 1500, -0.5, 499.5); TH1D* rateDummyIonC = new TH1D("IonC Rate dummy", "IonChamber Rate", 1500, -0.5, 499.5); TH1D* rateDummyRatio = new TH1D("p(GADC)/IonC Rate", "p(GADC)/IonChamber Ratio", 1500, -0.5, 499.5); TH1D* rateDummySEC = new TH1D("SEC Rate dummy", "SEC Rate", 1500, -0.5, 499.5); TH1D* rateDummyRatioS = new TH1D("p(GADC)/SEC Rate", "p(GADC)/SEC Ratio", 1500, -0.5, 499.5); TH1D* spillDummy = new TH1D("SpillDummy", "IHEP Spill", 640, -0.5, 639.5); TGaxis *myAxis = new TGaxis(); TH1D* gr1x = new TH1D("gr1x", "Rate vs X", 128, -6.4, 6.4); TH1D* gr2x = new TH1D("gr2x", "Rate vs X", 128, -6.4, 6.4); TH1D* gr3x = new TH1D("gr3x", "Rate vs X", 128, -6.4, 6.4); TH1D* gr1y = new TH1D("gr1y", "Rate vs Y", 1024, -6.4, 6.4); TH1D* gr2y = new TH1D("gr2y", "Rate vs Y", 1024, -6.4, 6.4); TH1D* gr3y = new TH1D("gr3y", "Rate vs Y", 1024, -6.4, 6.4); gr1x->SetLineColor(kBlack); gr1y->SetLineColor(kBlack); gr2x->SetLineColor(kRed); gr2y->SetLineColor(kRed); gr3x->SetLineColor(kBlue); gr3y->SetLineColor(kBlue); gr1x->SetLineWidth(2); gr1y->SetLineWidth(2); gr2x->SetLineWidth(2); gr2y->SetLineWidth(2); gr3x->SetLineWidth(2); gr3y->SetLineWidth(2); gr1x->SetStats(0); gr1y->SetStats(0); gr2x->SetStats(0); gr2y->SetStats(0); gr3x->SetStats(0); gr3y->SetStats(0); gr1x->GetXaxis()->SetTitle("X_{HODO}, cm"); gr2x->GetXaxis()->SetTitle("X_{HODO}, cm"); gr3x->GetXaxis()->SetTitle("X_{HODO}, cm"); gr1y->GetXaxis()->SetTitle("Y_{HODO}, cm"); gr2y->GetXaxis()->SetTitle("Y_{HODO}, cm"); gr3y->GetXaxis()->SetTitle("Y_{HODO}, cm"); gr1x->GetYaxis()->SetTitle("Spills"); gr1y->GetYaxis()->SetTitle("Spills"); gr2x->GetYaxis()->SetTitle("Spills"); gr2y->GetYaxis()->SetTitle("Spills"); gr3x->GetYaxis()->SetTitle("Spills"); gr3y->GetYaxis()->SetTitle("Spills"); TProfile* gr1prof = new TProfile("gr1prof", "GADC vs IonC", 100, -20., 2180.); TProfile* gr2prof = new TProfile("gr2prof", "GADC vs IonC", 100, -20., 380.); TProfile* gr3prof = new TProfile("gr3prof", "GADC vs IonC", 100, -20., 80.); gr1prof->SetMarkerColor(kBlack); gr2prof->SetMarkerColor(kRed); gr3prof->SetMarkerColor(kBlue); gr1prof->SetLineColor(kBlack); gr2prof->SetLineColor(kRed); gr3prof->SetLineColor(kBlue); gr1prof->SetLineWidth(4); gr2prof->SetLineWidth(4); gr3prof->SetLineWidth(4); TProfile* gr1ionX = new TProfile("gr1ionX", "IonC vs X", 128, -6.4, 6.4); TProfile* gr2ionX = new TProfile("gr2ionX", "IonC vs X", 128, -6.4, 6.4); TProfile* gr3ionX = new TProfile("gr3ionX", "IonC vs X", 128, -6.4, 6.4); gr1ionX->SetMarkerColor(kBlack); gr2ionX->SetMarkerColor(kRed); gr3ionX->SetMarkerColor(kBlue); gr1ionX->SetLineColor(kBlack); gr2ionX->SetLineColor(kRed); gr3ionX->SetLineColor(kBlue); gr1ionX->SetLineWidth(4); gr2ionX->SetLineWidth(4); gr3ionX->SetLineWidth(4); gr1ionX->SetStats(0); gr2ionX->SetStats(0); gr3ionX->SetStats(0); TProfile* gr1ionY = new TProfile("gr1ionY", "IonC vs Y", 512, -6.4, 6.4); TProfile* gr2ionY = new TProfile("gr2ionY", "IonC vs Y", 512, -6.4, 6.4); TProfile* gr3ionY = new TProfile("gr3ionY", "IonC vs Y", 512, -6.4, 6.4); gr1ionY->SetMarkerColor(kBlack); gr2ionY->SetMarkerColor(kRed); gr3ionY->SetMarkerColor(kBlue); gr1ionY->SetLineColor(kBlack); gr2ionY->SetLineColor(kRed); gr3ionY->SetLineColor(kBlue); gr1ionY->SetLineWidth(4); gr2ionY->SetLineWidth(4); gr3ionY->SetLineWidth(4); gr1ionY->SetStats(0); gr2ionY->SetStats(0); gr3ionY->SetStats(0); TProfile* gr1gadcX = new TProfile("gr1gadcX", "GADC vs X", 128, -6.4, 6.4); TProfile* gr2gadcX = new TProfile("gr2gadcX", "GADC vs X", 128, -6.4, 6.4); TProfile* gr3gadcX = new TProfile("gr3gadcX", "GADC vs X", 128, -6.4, 6.4); gr1gadcX->SetMarkerColor(kBlack); gr2gadcX->SetMarkerColor(kRed); gr3gadcX->SetMarkerColor(kBlue); gr1gadcX->SetLineColor(kBlack); gr2gadcX->SetLineColor(kRed); gr3gadcX->SetLineColor(kBlue); gr1gadcX->SetLineWidth(4); gr2gadcX->SetLineWidth(4); gr3gadcX->SetLineWidth(4); gr1gadcX->SetStats(0); gr2gadcX->SetStats(0); gr3gadcX->SetStats(0); TProfile* gr1gadcY = new TProfile("gr1gadcY", "GADC vs Y", 512, -6.4, 6.4); TProfile* gr2gadcY = new TProfile("gr2gadcY", "GADC vs Y", 512, -6.4, 6.4); TProfile* gr3gadcY = new TProfile("gr3gadcY", "GADC vs Y", 512, -6.4, 6.4); gr1gadcY->SetMarkerColor(kBlack); gr2gadcY->SetMarkerColor(kRed); gr3gadcY->SetMarkerColor(kBlue); gr1gadcY->SetLineColor(kBlack); gr2gadcY->SetLineColor(kRed); gr3gadcY->SetLineColor(kBlue); gr1gadcY->SetLineWidth(4); gr2gadcY->SetLineWidth(4); gr3gadcY->SetLineWidth(4); gr1gadcY->SetStats(0); gr2gadcY->SetStats(0); gr3gadcY->SetStats(0); TProfile* gr1rat = new TProfile("gr1rat", "GADC/IonC vs IonC", 100, -20., 2180.); TProfile* gr2rat = new TProfile("gr2rat", "GADC/IonC vs IonC", 100, -20., 380.); TProfile* gr3rat = new TProfile("gr3rat", "GADC/IonC vs IonC", 100, -20., 80.); gr1rat->SetMarkerColor(kBlack); gr2rat->SetMarkerColor(kRed); gr3rat->SetMarkerColor(kBlue); gr1rat->SetLineColor(kBlack); gr2rat->SetLineColor(kRed); gr3rat->SetLineColor(kBlue); gr1rat->SetLineWidth(4); gr2rat->SetLineWidth(4); gr3rat->SetLineWidth(4); TProfile* gr1ratX = new TProfile("gr1ratX", "GADC/IonC vs X", 128, -6.4, 6.4); TProfile* gr2ratX = new TProfile("gr2ratX", "GADC/IonC vs X", 128, -6.4, 6.4); TProfile* gr3ratX = new TProfile("gr3ratX", "GADC/IonC vs X", 128, -6.4, 6.4); gr1ratX->SetMarkerColor(kBlack); gr2ratX->SetMarkerColor(kRed); gr3ratX->SetMarkerColor(kBlue); gr1ratX->SetLineColor(kBlack); gr2ratX->SetLineColor(kRed); gr3ratX->SetLineColor(kBlue); gr1ratX->SetLineWidth(4); gr2ratX->SetLineWidth(4); gr3ratX->SetLineWidth(4); TProfile* gr1ratY = new TProfile("gr1ratY", "GADC/IonC vs Y", 512, -6.4, 6.4); TProfile* gr2ratY = new TProfile("gr2ratY", "GADC/IonC vs Y", 512, -6.4, 6.4); TProfile* gr3ratY = new TProfile("gr3ratY", "GADC/IonC vs Y", 512, -6.4, 6.4); gr1ratY->SetMarkerColor(kBlack); gr2ratY->SetMarkerColor(kRed); gr3ratY->SetMarkerColor(kBlue); gr1ratY->SetLineColor(kBlack); gr2ratY->SetLineColor(kRed); gr3ratY->SetLineColor(kBlue); gr1ratY->SetLineWidth(4); gr2ratY->SetLineWidth(4); gr3ratY->SetLineWidth(4); spectrumGADC ->SetStats(0); spectrumGADCped->SetStats(0); rateDummyGADC ->SetStats(0); rateDummyIonC ->SetStats(0); rateDummyRatio ->SetStats(0); rateDummySEC ->SetStats(0); rateDummyRatioS->SetStats(0); spillDummy ->SetStats(0); spectrumGADC ->GetXaxis()->SetTitle("GADC units"); spectrumGADCped->GetXaxis()->SetTitle("GADC units"); rateDummyGADC ->GetXaxis()->SetTitle("Spill#"); rateDummyIonC ->GetXaxis()->SetTitle("Spill#"); rateDummyRatio ->GetXaxis()->SetTitle("Spill#"); rateDummySEC ->GetXaxis()->SetTitle("Spill#"); rateDummyRatioS->GetXaxis()->SetTitle("Spill#"); spillDummy ->GetXaxis()->SetTitle("IHEP Spill Sample"); spectrumGADC ->GetYaxis()->SetTitle("Filled bunches"); spectrumGADCped->GetYaxis()->SetTitle("Empty bunches"); rateDummyGADC ->GetYaxis()->SetTitle("Intergal, GADC"); rateDummyIonC ->GetYaxis()->SetTitle("Ion Chamber, a.u."); rateDummyRatio ->GetYaxis()->SetTitle("GADC/Ion"); rateDummySEC ->GetYaxis()->SetTitle("IHEP SEC"); rateDummyRatioS->GetYaxis()->SetTitle("GADC/SEC"); spillDummy ->GetXaxis()->SetTitle("IHEP Rate"); TH1D* globalIon = new TH1D("globalIon", "GADC vs IonC", 20000, 0., 1.0e6); TH1D* globalIonRat = new TH1D("globalIonRat", "GADC/IonC vs IonC", 20000, 0., 1.0e6); TH1D* globalSEC = new TH1D("globalSEC", "SEC vs GADC", 200000, 0., 1.0e12); TH1D* globalSECRat = new TH1D("globalIonSEC", "GADC/SEC vs GADC", 200000, 0., 1.0e12); globalIon ->SetStats(0); globalIonRat->SetStats(0); globalSEC ->SetStats(0); globalSECRat->SetStats(0); globalIon ->GetXaxis()->SetTitle("Ion Chamber, a.u."); globalIon ->GetYaxis()->SetTitle("GADC spill, protons"); globalIonRat->GetXaxis()->SetTitle("Ion Chamber, a.u."); globalIonRat->GetYaxis()->SetTitle("GADC/Ion, proton/a.u."); globalSEC ->GetYaxis()->SetTitle("GADC spill, protons"); globalSEC ->GetXaxis()->SetTitle("SEC IHEP, a.u."); globalSECRat->GetXaxis()->SetTitle("GADC spill, protons"); globalSECRat->GetYaxis()->SetTitle("GADC/SEC, proton/a.u."); TH1D* hodoProfileX = new TH1D("hodoProfileX", "Hodoscope X", 16, -6.4, 6.4); TH1D* hodoProfileY = new TH1D("hodoProfileY", "Hodoscope Y", 16, -6.4, 6.4); TH1D* hodoProfX = new TH1D("hodoProfX", "temp X", 16, -6.4, 6.4); TH1D* hodoProfY = new TH1D("hodoProfY", "temp Y", 16, -6.4, 6.4); hodoProfileX->GetXaxis()->SetTitle("X, cm"); hodoProfileY->GetXaxis()->SetTitle("Y, cm"); hodoProfileX->GetYaxis()->SetTitle("Rate"); hodoProfileY->GetYaxis()->SetTitle("Rate"); hodoProfileX->SetStats(0); hodoProfileY->SetStats(0); TH1D* hodoDummyX = new TH1D("hodoDummyX", "GADC/IonC vs X", 128, -6.4, 6.4); TH1D* hodoDummyY = new TH1D("hodoDummyY", "GADC/IonC vs Y", 800, -6.4, 6.4); hodoDummyX->GetXaxis()->SetTitle("X_{HODO}, cm"); hodoDummyY->GetXaxis()->SetTitle("Y_{HODO}, cm"); hodoDummyX->GetYaxis()->SetTitle("p(GADC)/IonC"); hodoDummyY->GetYaxis()->SetTitle("p(GADC)/IonC"); hodoDummyX->SetStats(0); hodoDummyY->SetStats(0); TH1D* hodoDummyXion = new TH1D("hodoDummyXion", "Ion vs X", 128, -6.4, 6.4); TH1D* hodoDummyYion = new TH1D("hodoDummyYion", "Ion vs Y", 512, -6.4, 6.4); hodoDummyXion->GetXaxis()->SetTitle("X_{HODO}, cm"); hodoDummyYion->GetXaxis()->SetTitle("Y_{HODO}, cm"); hodoDummyXion->GetYaxis()->SetTitle("IonC, a.u"); hodoDummyYion->GetYaxis()->SetTitle("IonC, a.u"); hodoDummyXion->SetStats(0); hodoDummyYion->SetStats(0); TH1D* hodoDummyXgadc = new TH1D("hodoDummyXgadc", "GADC vs X", 128, -6.4, 6.4); TH1D* hodoDummyYgadc = new TH1D("hodoDummyYgadc", "GADC vs Y", 512, -6.4, 6.4); hodoDummyXgadc->GetXaxis()->SetTitle(", cm"); hodoDummyYgadc->GetXaxis()->SetTitle(", cm"); hodoDummyXgadc->GetYaxis()->SetTitle("GADC, tracks"); hodoDummyYgadc->GetYaxis()->SetTitle("GADC, tracks"); hodoDummyXgadc->SetStats(0); hodoDummyYgadc->SetStats(0); for (int i=0; i<16; i++) { hodoXcorr[i]=1.0; hodoYcorr[i]=1.0; hodoXcorr0[i]=0.0; hodoYcorr0[i]=0.0; hodoXcorr1[i]=0.0; hodoYcorr1[i]=0.0; hodoXcorr2[i]=0.0; hodoYcorr2[i]=0.0; hodoXcorr3[i]=0.0; hodoYcorr2[i]=0.0; } hodoXcorr[ 0]=1./1.157; hodoYcorr[ 0]=1./2.270/1.120; hodoXcorr[ 1]=1./1.146/1.256; hodoYcorr[ 1]=1./0.590/1.211; hodoXcorr[ 2]=1./0.976/1.293; hodoYcorr[ 2]=1./2.270/1.362; hodoXcorr[ 3]=1./1.552/1.233; hodoYcorr[ 3]=1./1.301/1.308; hodoXcorr[ 4]=1./1.536/1.261; hodoYcorr[ 4]=1./1.270/1.277; hodoXcorr[ 5]=1./1.472/1.293; hodoYcorr[ 5]=1./1.260/1.267; hodoXcorr[ 6]=1./1.099/1.249; hodoYcorr[ 6]=1./1.340/1.333; hodoXcorr[ 7]=1./1.431/1.325; hodoYcorr[ 7]=1./1.226/1.239; hodoXcorr[ 8]=1./0.949/1.236; hodoYcorr[ 8]=1./1.291/1.218; hodoXcorr[ 9]=1./1.157/1.172; hodoYcorr[ 9]=1./1.494/1.268; hodoXcorr[10]=1./1.757/1.292; hodoYcorr[10]=1./1.176/1.213; hodoXcorr[11]=1./1.660/1.313; hodoYcorr[11]=1./0.696/1.267; hodoXcorr[12]=1./1.050/1.374; hodoYcorr[12]=1./2.121/1.446; hodoXcorr[13]=1./0.930/1.274; hodoYcorr[13]=1./2.136/1.434; hodoXcorr[14]=1./1.746/1.280; hodoYcorr[14]=1./4.014/1.425; hodoXcorr[15]=1./1.627/1.172; hodoYcorr[15]=1./4.088/1.465; TCanvas* GADCcanvas = new TCanvas("GADCcanvas", "GADC spectrum", 0, 0, canvasWidth, canvasHeight); TCanvas* RateCanvas = new TCanvas("RateCanvas", "Rate", canvasWidth, 0, canvasWidth, canvasHeight); TCanvas* RateCanvasS = new TCanvas("RateCanvaS", "Rate SEC", 2*canvasWidth, 0, canvasWidth, canvasHeight); TCanvas* SpillCanvas = new TCanvas("SpillCanva", "Spill", 3*canvasWidth, 0, canvasWidth, canvasWidth); TCanvas* GlobalCanvasIon = new TCanvas("GlobalCanvasIon", "GlobalCanvasIon", 4*canvasWidth, 0, canvasWidth, canvasHeight); TCanvas* GlobalCanvasSEC = new TCanvas("GlobalCanvasSEC", "GlobalCanvasSEC", 5*canvasWidth, 0, canvasWidth, canvasHeight); TCanvas* GlobalCanvasHod = new TCanvas("GlobalCanvasHOD", "GlobalCanvasHOD", 8*canvasWidth, 0, canvasWidth, canvasHeight); TCanvas* GlobalCanvasHod0 = new TCanvas("GlobalCanvasHOD0", "Hodoscope rate", int(2.5*canvasWidth), 0, canvasWidth, canvasHeight); TCanvas* GlobalCanvasHod1 = new TCanvas("GlobalCanvasHOD1", "Hodoscope IonC", int(3.5*canvasWidth), 0, canvasWidth, canvasHeight); TCanvas* GlobalCanvasHod2 = new TCanvas("GlobalCanvasHOD2", "Hodoscope GADC", int(4.5*canvasWidth), 0, canvasWidth, canvasHeight); TCanvas* IonChamberCanvas = new TCanvas("IonChamberCanvas", "IonChamberCanvas", 6*canvasWidth, 0, canvasWidth, canvasWidth); TCanvas* HodoscopeCanvas = new TCanvas("HodoscopeCanvas", "HodoscopeCanvas", 7*canvasWidth, 0, canvasWidth, canvasHeight); myLine->SetLineStyle(2); HodoscopeCanvas->Divide(1,2); HodoscopeCanvas->cd(1)->SetGrid(1); hodoDummyX->Draw(); HodoscopeCanvas->cd(2)->SetGrid(1); hodoDummyY->Draw(); GlobalCanvasHod0->Divide(1,2); GlobalCanvasHod1->Divide(1,2); GlobalCanvasHod2->Divide(1,2); GlobalCanvasHod->Divide(1,2); GlobalCanvasHod->cd(1)->SetGrid(1); hodoDummyX->Draw(); //myLine->DrawLine(-6., 5.e4, 6., 5.e4); GlobalCanvasHod->cd(2)->SetGrid(1); hodoDummyY->Draw(); //myLine->DrawLine(-6., 5.e4, 6., 5.e4); GlobalCanvasIon->Divide(1,2); GlobalCanvasIon->cd(1)->SetGrid(1); globalIon ->Draw(); //myLine->DrawLine(0., 0., globalIon->GetXaxis()->GetXmax(), globalIon->GetXaxis()->GetXmax()*5.e4); GlobalCanvasIon->cd(2)->SetGrid(1); globalIonRat ->Draw(); //myLine->DrawLine(0., 5.e4, globalIon->GetXaxis()->GetXmax(), 5.e4); GlobalCanvasSEC->Divide(1,2); GlobalCanvasSEC->cd(1)->SetGrid(1); globalSEC ->Draw(); GlobalCanvasSEC->cd(2)->SetGrid(1); globalSECRat ->Draw(); myLine->SetLineStyle(1); int myRun0=860; int myRun1=1194; char myChar[20]; //myRun0=1070; //myRun1=1169; myRun0=1117; myRun1=1117; //myRun0=1091; //myRun1=1106; myRun0=1094; //myRun1=1099; myRun1=1117; myRun0=1092; myRun1=1092; double maxRateX=0.; double maxRateY=0.; double xPosMin=16.; double xPosMax=-16.; double yPosMin=16.; double yPosMax=-16.; double posMax, posMin; double w; TF1 *f1x = new TF1("f1x", "gaus", -20., 20.); TF1 *f1y = new TF1("f1y", "gaus", -20., 20.); f1x->SetLineWidth(1); f1y->SetLineWidth(1); f1x->SetLineColor(kRed); f1y->SetLineColor(kRed); double globalIonMax=0.; double globalIHEPSECmax=0.; double globalIonMaxRat=0.; double globalIHEPSECmaxRat=0.; double globalGADCmax=0.; int iColRun=1; int ibm=0; int myRun=0; //======================================================================================= //int nHodo=2; //int myRunList[2]={1117, 1130}; //int nHodo=3; //int myRunList[3]={1098, 1099, 1117}; //int nHodo=10; //int myRunList[10]={1094, 1095, 1097, 1098, // 1099, 1101, 1102, 1104, // 1112, 1117}; int nHodo=1; int myRunList[4]={1092, 1098, 1099, 1117}; nHodo=SizeOfArray(myRunList); //int nHodo=8; //int myRunList[8]={1094, 1095, 1097, 1098, 1099, 1101, 1116, 1117}; for (int iRun=0; iRun1093 && myRun<1099) {runGroup=0; sprintf(myChar, "#nabla");} else if (myRun>1098 && myRun<1102) {runGroup=1; sprintf(myChar, "o");} maxRateX=0.; maxRateY=0.; double GADCmax=0.; double IonCmax=0.; double SECmax=0.; double RatioCmax=0.; double RatioCmaxP=0.; double RatioSmax=0.; int lastBunch=0; HodoscopeCanvas->Clear(); HodoscopeCanvas->Divide(1,2); HodoscopeCanvas->cd(1)->SetGrid(1); hodoProfileX->GetYaxis()->SetRangeUser(0.,1.05); hodoProfileX->Draw(); HodoscopeCanvas->cd(2)->SetGrid(1); hodoProfileY->GetYaxis()->SetRangeUser(0.,1.05); hodoProfileY->Draw(); GADCcanvas->Clear(); GADCcanvas->Divide(1,2); RateCanvas->Clear(); RateCanvas->Divide(1,3); RateCanvas->cd(1)->SetGrid(1); rateDummyGADC->Draw(); RateCanvas->cd(2)->SetGrid(1); rateDummyIonC->Draw(); RateCanvas->cd(3)->SetGrid(1); rateDummyRatio->Draw(); RateCanvasS->Clear(); RateCanvasS->Divide(1,3); RateCanvasS->cd(1)->SetGrid(1); rateDummyGADC->Draw(); RateCanvasS->cd(2)->SetGrid(1); rateDummySEC->Draw(); RateCanvasS->cd(3)->SetGrid(1); rateDummyRatioS->Draw(); // trying to open ROOT file with data trees if (myLocation==1) { sprintf(fileIHEPname, "reports/ntuples/v2/run%04d_spill_IHEP_v2.root", myRun); sprintf(fileBEAMname, "reports/ntuples/v2/run%04d_spill_BeamHV_v2.root", myRun); sprintf(fileHODOname, "reports/ntuples/v2/run%04d_spill_HODO_v2.root", myRun); } else if (myLocation==0) { sprintf(fileIHEPname, "/raid04/HiLum/analysis2012/reports/ntuples/v2/run%04d_spill_IHEP_v2.root", myRun); sprintf(fileBEAMname, "/raid04/HiLum/analysis2012/reports/ntuples/v2/run%04d_spill_BeamHV_v2.root", myRun); sprintf(fileHODOname, "/raid04/HiLum/analysis2012/reports/ntuples/v2/run%04d_spill_HODO_v2.root", myRun); } else { sprintf(fileIHEPname, "run%04d_spill_IHEP_v2.root", myRun); sprintf(fileBEAMname, "run%04d_spill_BeamHV_v2.root", myRun); sprintf(fileHODOname, "run%04d_spill_HODO_v2.root", myRun); } printf("trying file %s\n", fileIHEPname); TFile *treeFileIHEP = new TFile(fileIHEPname, "READONLY"); if (!treeFileIHEP->IsOpen()) continue; if (treeFileIHEP->IsZombie()) continue; printf("trying file %s\n", fileBEAMname); TFile *treeFileBeamHV = new TFile(fileBEAMname,"READONLY"); if (!treeFileBeamHV->IsOpen()) continue; if (treeFileBeamHV->IsZombie()) continue; printf("trying file %s\n", fileHODOname); TFile *treeFileHODO = new TFile(fileHODOname, "READONLY"); hodoscopeIN=(treeFileHODO->IsOpen() && !treeFileHODO->IsZombie()); printf("hodoscopeIN=%d\n", hodoscopeIN); //================================================================ sprintf(fileIHEPname, "IHEP_run%04d", myRun); IHEPtree = (TTree*)treeFileIHEP ->Get(fileIHEPname); IHEPtree -> SetBranchAddress("SpillMPI", &burst); // from MPI event record IHEPtree -> SetBranchAddress("SpillIHEP", &spill); // from IHEP data record IHEPtree -> SetBranchAddress("SpillBC", &spillBC); // ? just in case IHEPtree -> SetBranchAddress("Scalers", &scalers[0]); // IHEP scalers IHEPtree -> SetBranchAddress("xSEC", &xSEC[0]); // IHEP SEC, X IHEPtree -> SetBranchAddress("ySEC", &ySEC[0]); // IHEP SEC, Y IHEPtree -> SetBranchAddress("rateHeader", &rateHeader[0]); // rate header: gate start, end, bin etc. Ask Kozelov. IHEPtree -> SetBranchAddress("rateRecord", &rateRecord[0]); // rate record, one on the IHEP beam monitor; ask Kozelov IHEPtree -> SetBranchAddress("IonChamber", &ionChamber); // IHEP ionization chamber integral sprintf(fileBEAMname, "BeamHV_run%04d", myRun); // this may be available not for every spill! Some are skipped by GADC DAQ, // some dropped by me - for being empty, for example. BeamHVtree = (TTree*)treeFileBeamHV->Get(fileBEAMname); BeamHVtree -> SetBranchAddress("SpillMPI", &burstBeam); // from MPI event record BeamHVtree -> SetBranchAddress("timeStamp", &timeStamp[0]); // time stamp for found GADC file: year, month, ... seconds; BeamHVtree -> SetBranchAddress("HVcorrected", &BeamHVlocal[0]); // HV for beam counters: 1,2,3 -> S1, S2, S3 // 4 -> Cherenkov corrected from LabJack to LogBook BeamHVtree -> SetBranchAddress("GADCcalibr", &GADCcalibr); // calibration tracks/GADC BeamHVtree -> SetBranchAddress("CherIntegrals", &CherIntegrals[0]);// GADC integrals (in GADC units) BeamHVtree -> SetBranchAddress("specGADC", &specGADC[0]); // GADC filled spectrum, for case #7 BeamHVtree -> SetBranchAddress("specGADCped", &specGADCped[0]); // GADC pedestal spectrum, for case #7 Int_t HODOentries=0; if (hodoscopeIN) { sprintf(fileHODOname, "HODO_run%04d", myRun); HODOtree = (TTree*)treeFileHODO ->Get(fileHODOname); HODOtree -> SetBranchAddress("hodoX", &hodoX[0]); HODOtree -> SetBranchAddress("hodoY", &hodoY[0]); HODOentries = (Int_t)HODOtree->GetEntries(); printf("%d entries for hodoscope\n", HODOentries); } Int_t IHEPentries = (Int_t)IHEPtree->GetEntries(); Int_t BEAMentries = (Int_t)BeamHVtree->GetEntries(); printf("%d entries in IHEP, %d entries in BeamHV\n", IHEPentries, BEAMentries); int ih=0; //iqq=2; bool plotsReady=false; double max1=0., max1ped=0., max2=0.; for (int ib=0; ibGetEntry(ib); burst=-1; // must do it in a tricky way because there are missing GADC and/or intensity records; int offset=1; while (burstGetEntry(ih); printf(" IHEP#%d loaded\n", ih); int iho=ih; if (hodoscopeIN) { HODOtree->GetEntry(ih); printf(" HODO#%d loaded\n", ih); } if (burst>burstBeam+offset) break; ih++; if (ih>=IHEPentries) break; } if (ih>=IHEPentries) break; if (burst>burstBeam+offset) continue; printf(" IHEP#%3d: burstBEAM=%3d burstIHEP=%3d burst=%3d burstBC=%d\n", ih, burstBeam, spill, burst, spillBC); // for (int i=0; i<7; i++) printf(" %4d", rateHeader[i]); // printf("\n"); // for (int i=0; i<640; i++) printf(" %3d rate=%4d\n", i, rateRecord[i]); //============================================================================ //============================================================================ spectrumGADC->Reset(); spectrumGADCped->Reset(); spillDummy->Reset(); for (int i=0; i<440; i++) spectrumGADC -> SetBinContent(i, specGADC[i]); for (int i=0; i<440; i++) spectrumGADCped-> SetBinContent(i, specGADCped[i]); for (int i=0; i<640; i++) spillDummy -> SetBinContent(i, rateRecord[i]); // spillDummy->GetXaxis()->SetRangeUser(0., 400.); spillDummy ->SetLineColor(kBlack); spectrumGADC->SetLineColor(kBlack); spectrumGADCped->SetLineColor(kBlack); if (burst>146 && myRun==1157) { spillDummy ->SetLineColor(kRed); spectrumGADC->SetLineColor(kRed); spectrumGADCped->SetLineColor(kRed); } if (plotsReady) { GADCcanvas->cd(1); if (max1GetMaximum()) { max1=spectrumGADC->GetMaximum(); h1->GetYaxis()->SetRangeUser(0.1, 1.05*max1); } spectrumGADC->DrawCopy("same"); GADCcanvas->cd(2); if (max1pedGetMaximum()) { max1ped=spectrumGADCped->GetMaximum(); h1ped->GetYaxis()->SetRangeUser(0.1, 1.05*max1ped); } spectrumGADCped->DrawCopy("same"); SpillCanvas->cd(0); if (max2GetMaximum()) { max2=spillDummy->GetMaximum(); h2->GetYaxis()->SetRangeUser(0., 1.05*max2); } spillDummy->DrawCopy("same"); } else { plotsReady=true; h1 ->SetLineColor(kBlack); h1ped ->SetLineColor(kBlack); h2 ->SetLineColor(kBlack); if (burst>146 && myRun==1157) { h1 ->SetLineColor(kRed); h1ped ->SetLineColor(kRed); h2 ->SetLineColor(kRed); } GADCcanvas->cd(1); gPad->SetLogy(1); h1 = (TH1D*) spectrumGADC->Clone("GADC filled"); h1->Draw(); GADCcanvas->cd(2); gPad->SetLogy(1); h1ped = (TH1D*) spectrumGADCped->Clone("GADC pedestal"); h1ped->Draw(); SpillCanvas->Clear(); SpillCanvas->cd(0); gPad->SetLogy(0); h2 = (TH1D*) spillDummy->Clone("Spill profile"); h2->Draw(); } // h1->Delete(); // h2->Delete(); GADCcanvas->Update(); SpillCanvas->Update(); //============================================================================ // ionization chamber // double rateGADC=CherIntegrals[7]*GADCcalibr; double ratio=0., ratioS=0.; printf(" rateGADC=%.1e protons, IonC=%.1f\n", rateGADC, ionChamber); if (ionChamber>10.) { ratio=rateGADC/ionChamber; // p/ion if (ratio>8.e4) ratio=8.e4; if (RatioCmax GADC Rate=%.1e IonC=%.1f ratio=%.1f p/ion\n", GADCmax, IonCmax, RatioCmax); rateDummyGADC ->GetYaxis()->SetRangeUser(0., 1.05*GADCmax); rateDummyIonC ->GetYaxis()->SetRangeUser(0., 1.05*IonCmax); rateDummyRatio->GetYaxis()->SetRangeUser(0., 1.05*RatioCmax); rateDummyGADC ->GetXaxis()->SetRangeUser(-0.5, burstBeam+5.5); rateDummyIonC ->GetXaxis()->SetRangeUser(-0.5, burstBeam+5.5); rateDummyRatio->GetXaxis()->SetRangeUser(-0.5, burstBeam+5.5); lastBunch=burstBeam; IonChamberLow->Fill(ionChamber); myLatex->SetTextColor(kBlack); if (burstBeam>146 && myRun==1157) {myLatex->SetTextColor(kRed);} if (globalGADCmax10.) { if (globalIonMaxcd(3); myLatex->DrawLatex(double(burstBeam), ratio, myChar); } // if (globalIonMaxRat>6.0e-5) globalIonMaxRat=6.0e-5; RateCanvas->cd(1); myLatex->DrawLatex(double(burstBeam), rateGADC, myChar); RateCanvas->cd(2); myLatex->DrawLatex(double(burstBeam), ionChamber, myChar); RateCanvas->Update(); if (ionChamber>250. && runGroup==0) { gr1prof->Fill(ionChamber, rateGADC); gr1rat ->Fill(ionChamber, ratio); } else if (ionChamber>50. && runGroup==1) { gr2prof->Fill(ionChamber, rateGADC); gr2rat ->Fill(ionChamber, ratio); } else if (ionChamber>5. && runGroup==2) { gr3prof->Fill(ionChamber, rateGADC); gr3rat ->Fill(ionChamber, ratio); } //============================================================================ double SECx0=0.; double SECy0=0.; double SECx=0.; double SECy=0.; double SECpedX=0.5*(xSEC[0]+xSEC[15]); double SECpedY=0.5*(ySEC[0]+ySEC[15]); double ratioC=0.; if (rateGADC>5.0e9) { for (int i=1; i<15; i++) { SECx0+=(xSEC[i]-SECpedX); SECx+=(i-7.5)*(xSEC[i]-SECpedX); SECy0+=(ySEC[i]-SECpedY); SECy+=(i-7.5)*(ySEC[i]-SECpedY); } SECx/=SECx0; SECy/=SECy0; if (SECmaxGetYaxis()->SetRangeUser(0., 1.05*SECmax); rateDummyRatioS->GetYaxis()->SetRangeUser(0.,1.05*RatioSmax); rateDummySEC ->GetXaxis()->SetRangeUser(-0.5, burstBeam+5.5); rateDummyRatioS->GetXaxis()->SetRangeUser(-0.5, burstBeam+5.5); RateCanvasS->cd(1); myLatex->DrawLatex(double(burstBeam), rateGADC, myChar); RateCanvasS->cd(2); myLatex->DrawLatex(double(burstBeam), SECx0, "x"); myLatex->DrawLatex(double(burstBeam), SECy0, "y"); RateCanvasS->cd(3); myLatex->DrawLatex(double(burstBeam), ratioC, myChar); RateCanvasS->Update(); if (globalIHEPSECmaxRatSetTextColor(iColRun); //============================================================================ // Hodoscope display if (hodoscopeIN) { hodoProfX->Reset(); hodoProfY->Reset(); for (int i=0; i<16; i++) { hodoProfX->SetBinContent(i+1, double(hodoX[i])*hodoXcorr[i]); hodoProfY->SetBinContent(i+1, double(hodoY[i])*hodoYcorr[i]); } if (maxRateXGetMaximum()) maxRateX=hodoProfX->GetMaximum(); if (maxRateYGetMaximum()) maxRateY=hodoProfY->GetMaximum(); hodoProfileX->GetYaxis()->SetRangeUser(0., 1.05*maxRateX); hodoProfileY->GetYaxis()->SetRangeUser(0., 1.05*maxRateY); // hodoProfX->Scale(1./hodoProfX->GetMaximum()); // hodoProfY->Scale(1./hodoProfY->GetMaximum()); // hodoProfX->Fit("f1x", "Q0R"); // fit quietly // hodoProfY->Fit("f1y", "Q0R"); hodoProfX->Fit("f1x", "QNIR"); // fit by bin integral! hodoProfY->Fit("f1y", "QNIR"); for (int i=0; i<16; i++) { Int_t ibinX=hodoProfX->GetBin(i+1); Int_t ibinY=hodoProfY->GetBin(i+1); double x0=hodoProfX->GetBinLowEdge(ibinX); double y0=hodoProfY->GetBinLowEdge(ibinY); double x1=x0+hodoProfX->GetBinWidth(ibinX); double y1=y0+hodoProfY->GetBinWidth(ibinY); double sx=f1x->Integral(x0, x1); double sy=f1y->Integral(y0, y1); hodoXcorr0[i]+=1.; hodoYcorr0[i]+=1.; hodoXcorr1[i]+=sx; hodoYcorr1[i]+=sy; hodoXcorr2[i]+=hodoX[i]*hodoXcorr[i]; hodoYcorr2[i]+=hodoY[i]*hodoYcorr[i]; hodoXcorr3[i]+=hodoX[i]*hodoXcorr[i]/sx; hodoYcorr3[i]+=hodoY[i]*hodoYcorr[i]/sy; } HodoscopeCanvas->cd(1); hodoProfX->DrawCopy("same L"); HodoscopeCanvas->cd(2); hodoProfY->DrawCopy("same L"); HodoscopeCanvas->Update(); double xPos=hodoProfX->GetMean(); double xWid=hodoProfX->GetRMS(); double yPos=hodoProfY->GetMean(); double yWid=hodoProfY->GetRMS(); ibm=hodoProfX->GetMaximumBin(); xPos=0.; w=0.; int i0=ibm-7; if (i0<0) i0=0; int i1=ibm+8; if (i1>16) i1=16; for (int i=i0; iGetBinContent(i); xPos+=hodoProfX->GetBinContent(i)*hodoProfX->GetBinCenter(i); } xPos/=w; ibm=hodoProfY->GetMaximumBin(); yPos=0.; w=0.; i0=ibm-7; if (i0<0) i0=0; i1=ibm+8; if (i1>16) i1=16; for (int i=i0; iGetBinContent(i); yPos+=hodoProfY->GetBinContent(i)*hodoProfY->GetBinCenter(i); } yPos/=w; xPos=f1x->GetParameter(1); yPos=f1y->GetParameter(1); if (xPos>xPosMax) xPosMax=xPos; if (yPos>yPosMax) yPosMax=yPos; if (xPosxPosMax) posMax=yPosMax; else posMax=xPosMax; if (yPosMin>xPosMin) posMin=xPosMin; else posMin=xPosMin; double dd=0.015*(posMax-posMin); double ddx=0.015*(xPosMax-xPosMin); double ddy=0.015*(yPosMax-yPosMin); if (ionChamber>10.) { GlobalCanvasHod->cd(1); hodoDummyX->GetYaxis()->SetRangeUser(0., 1.05*globalIonMaxRat); hodoDummyX->GetXaxis()->SetRangeUser(xPosMin-ddx, xPosMax+ddx); myLatex->DrawLatex(xPos, ratio, myChar); GlobalCanvasHod->cd(2); hodoDummyY->GetYaxis()->SetRangeUser(0., 1.05*globalIonMaxRat); hodoDummyY->GetXaxis()->SetRangeUser(yPosMin-ddy, yPosMax+ddy); myLatex->DrawLatex(yPos, ratio, myChar); if (runGroup==0) { gr1x->Fill(xPos, 1.); gr1y->Fill(yPos, 1.); gr1ratX->Fill(xPos, ratio); gr1ratY->Fill(yPos, ratio); gr1ionX->Fill(xPos, ionChamber); gr1ionY->Fill(yPos, ionChamber); gr1gadcX->Fill(xPos, rateGADC); gr1gadcY->Fill(yPos, rateGADC); } else if (runGroup==1) { gr2x->Fill(xPos, 1.); gr2y->Fill(yPos, 1.); gr2ratX->Fill(xPos, ratio); gr2ratY->Fill(yPos, ratio); gr2ionX->Fill(xPos, ionChamber); gr2ionY->Fill(yPos, ionChamber); gr2gadcX->Fill(xPos, rateGADC); gr2gadcY->Fill(yPos, rateGADC); } else if (runGroup==2) { gr3x->Fill(xPos, 1.); gr3y->Fill(yPos, 1.); gr3ratX->Fill(xPos, ratio); gr3ratY->Fill(yPos, ratio); gr3ionX->Fill(xPos, ionChamber); gr3ionY->Fill(yPos, ionChamber); gr3gadcX->Fill(xPos, rateGADC); gr3gadcY->Fill(yPos, rateGADC); } } } if ((ionChamber>5. && runGroup==2) || (ionChamber>50. && runGroup==1) || (ionChamber>250. && runGroup==0) ) { GlobalCanvasIon->cd(1); globalIon->GetXaxis()->SetRangeUser(0., 1.05*globalIonMax); globalIon->GetYaxis()->SetRangeUser(0., 1.05*globalGADCmax); myLatex->DrawLatex(ionChamber, rateGADC, myChar); GlobalCanvasIon->cd(2); globalIonRat->GetXaxis()->SetRangeUser(0., 1.05*globalIonMax); globalIonRat->GetYaxis()->SetRangeUser(0., 1.05*globalIonMaxRat); myLatex->DrawLatex(ionChamber, ratio, myChar); } if (rateGADC>5.0e9) { GlobalCanvasSEC->cd(1); globalSEC->GetYaxis()->SetRangeUser(0., 1.05*globalGADCmax); globalSEC->GetXaxis()->SetRangeUser(0., 1.05*globalIHEPSECmax); myLatex->DrawLatex(SECx0+SECy0, rateGADC, myChar); GlobalCanvasSEC->cd(2); globalSECRat->GetXaxis()->SetRangeUser(0., 1.05*globalGADCmax); globalSECRat->GetYaxis()->SetRangeUser(0., 1.05*globalIHEPSECmaxRat); myLatex->DrawLatex(rateGADC, ratioC, myChar); } GlobalCanvasIon->Update(); GlobalCanvasSEC->Update(); GlobalCanvasHod->Update(); //============================================================================ printf(" match found!\n"); if (iqq==1) { printf("push->"); cin >> iqq; if (iqq==0) exit(-1); } } // end of spills loop IonChamberCanvas->cd(0); IonChamberLow->Draw(); iColRun++; if (iColRun==5) iColRun++; //if (iColRun==4) iColRun++; if (iColRun==8) iColRun=1; /* double pMax=GADCmax*GADCcalibr; double rMax=RatioCmax/GADCcalibr; RateCanvas->cd(1); myAxis->SetTitle("protons/spill"); myAxis->DrawAxis(lastBunch+5.5, 0., lastBunch+5.5, 1.05*GADCmax, 0., 1.05*GADCmax*GADCcalibr, 510, "+L"); RateCanvas->cd(3); myAxis->SetTitle("IonChamber/proton"); myAxis->DrawAxis(lastBunch+5.5, 0., lastBunch+5.5, 1.05*RatioCmax, 0., 1.05*RatioCmax/GADCcalibr, 510, "+L"); RateCanvas->Update(); */ sprintf(postScriptName, "%srun%04d_20141216.ps(", postscriptDirectorry, myRun); RateCanvas ->Print(postScriptName); sprintf(postScriptName, "%srun%04d_20141216.ps", postscriptDirectorry, myRun); RateCanvasS ->Print(postScriptName); GADCcanvas ->Print(postScriptName); HodoscopeCanvas->Print(postScriptName); sprintf(postScriptName, "%srun%04d_20141216.ps)", postscriptDirectorry, myRun); SpillCanvas ->Print(postScriptName); printf(" match found!\n"); if (iqq==2) { printf("push->"); cin >> iqq; if (iqq==0) exit(-1); } treeFileBeamHV->Close(); treeFileIHEP ->Close(); if (hodoscopeIN) treeFileHODO ->Close(); } // end of runs loop GlobalCanvasIon->cd(1); gr1prof->Draw("same"); gr2prof->Draw("same"); gr3prof->Draw("same"); ym=globalIonMax; myLatex->SetTextAlign(11); myLatex->SetTextSize(0.05); myLatex->SetTextColor(kBlack); myLatex->DrawLatex(100., 0.95*ym, "1094...1098"); myLatex->SetTextColor(kRed); myLatex->DrawLatex(100., 0.85*ym, "1099...1101"); myLatex->SetTextColor(kBlue); myLatex->DrawLatex(100., 0.75*ym, "1102...1117"); GlobalCanvasIon->cd(2); gr1rat->Draw("same"); gr2rat->Draw("same"); gr3rat->Draw("same"); GlobalCanvasIon->Update(); GlobalCanvasHod->cd(1); gr1ratX->Draw("same"); gr2ratX->Draw("same"); gr3ratX->Draw("same"); ym=globalIonMaxRat; myLatex->SetTextColor(kBlack); myLatex->DrawLatex(-2.5, 0.95*ym, "1094...1098"); myLatex->SetTextColor(kRed); myLatex->DrawLatex(-2.5, 0.85*ym, "1099...1101"); myLatex->SetTextColor(kBlue); myLatex->DrawLatex(-2.5, 0.75*ym, "1102...1117"); GlobalCanvasHod->cd(2); gr1ratY->Draw("same"); gr2ratY->Draw("same"); gr3ratY->Draw("same"); GlobalCanvasHod->Update(); double ddx=0.015*(xPosMax-xPosMin); double ddy=0.015*(yPosMax-yPosMin); GlobalCanvasHod0->cd(1)->SetGrid(1); gr1x->GetXaxis()->SetRangeUser(xPosMin-ddx, xPosMax+ddx); gr2x->Scale(gr1x->GetMaximum()/gr2x->GetMaximum()); gr3x->Scale(gr1x->GetMaximum()/gr3x->GetMaximum()); ym=gr1x->GetMaximum(); gr1x->Draw(); gr2x->Draw("same"); gr3x->Draw("same"); myLatex->SetTextColor(kBlack); myLatex->DrawLatex(-1.5, 0.95*ym, "1094...1098"); myLatex->SetTextColor(kRed); myLatex->DrawLatex(-1.5, 0.85*ym, "1099...1101"); myLatex->SetTextColor(kBlue); myLatex->DrawLatex(-1.5, 0.75*ym, "1102...1117"); GlobalCanvasHod0->cd(2)->SetGrid(1); gr1y->GetXaxis()->SetRangeUser(yPosMin-ddx, yPosMax+ddx); gr2y->Scale(gr1y->GetMaximum()/gr2y->GetMaximum()); gr3y->Scale(gr1y->GetMaximum()/gr3y->GetMaximum()); gr1y->Draw(); gr2y->Draw("same"); gr3y->Draw("same"); GlobalCanvasHod0->Update(); GlobalCanvasHod1->cd(1)->SetGrid(1); gr1ionX->GetXaxis()->SetRangeUser(xPosMin-ddx, xPosMax+ddx); gr1ionX->Draw(); gr2ionX->Draw("same"); gr3ionX->Draw("same"); ym=gr1ionX->GetMaximum(); myLatex->SetTextColor(kBlack); myLatex->DrawLatex(-1., 0.95*ym, "1094...1098"); myLatex->SetTextColor(kRed); myLatex->DrawLatex(-1., 0.85*ym, "1099...1101"); myLatex->SetTextColor(kBlue); myLatex->DrawLatex(-1., 0.75*ym, "1102...1117"); GlobalCanvasHod1->cd(2)->SetGrid(1); gr1ionY->GetXaxis()->SetRangeUser(yPosMin-ddx, yPosMax+ddx); gr1ionY->Draw(); gr2ionY->Draw("same"); gr3ionY->Draw("same"); GlobalCanvasHod1->Update(); //============================================== GlobalCanvasHod2->cd(1)->SetGrid(1); gr1gadcX->GetXaxis()->SetRangeUser(xPosMin-ddx, xPosMax+ddx); gr1gadcX->Draw(); gr2gadcX->Draw("same"); gr3gadcX->Draw("same"); ym=gr1gadcX->GetMaximum(); myLatex->SetTextColor(kBlack); myLatex->DrawLatex(-1., 0.95*ym, "1094...1098"); myLatex->SetTextColor(kRed); myLatex->DrawLatex(-1., 0.85*ym, "1099...1101"); myLatex->SetTextColor(kBlue); myLatex->DrawLatex(-1., 0.75*ym, "1102...1117"); GlobalCanvasHod2->cd(2)->SetGrid(1); gr1gadcY->GetXaxis()->SetRangeUser(yPosMin-ddx, yPosMax+ddx); gr1gadcY->Draw(); gr2gadcY->Draw("same"); gr3gadcY->Draw("same"); GlobalCanvasHod2->Update(); GlobalCanvasHod0->Print("Summary20141219_spill_data.ps("); GlobalCanvasHod1->Print("Summary20141219_spill_data.ps"); GlobalCanvasHod2->Print("Summary20141219_spill_data.ps"); GlobalCanvasHod ->Print("Summary20141219_spill_data.ps"); GlobalCanvasIon ->Print("Summary20141219_spill_data.ps)"); printf ("HODO efficiency correction Rate/Fit-->\n"); for (int i=0; i<16; i++) { if (hodoXcorr0[i]==0.) continue; if (hodoYcorr0[i]==0.) continue; printf(" X-corr=(%6.3f, %6.3f) Y-corr=(%6.3f. %6.3f) \n", hodoXcorr3[i]/hodoXcorr0[i], hodoXcorr2[i]/hodoXcorr1[i], hodoYcorr3[i]/hodoYcorr0[i], hodoYcorr2[i]/hodoYcorr1[i]); } }