Exemple #1
0
//--------------------------
// DrawPoly
//--------------------------
void DrawPoly(int N, double *z, double *r, int color)
{
	TPolyLine *pl = new TPolyLine(N, z, r);
	pl->SetLineColor(color);
	if (fill_detectors) { pl->SetFillColor(color); pl->SetFillStyle(1001); }
	pl->SetLineWidth(2);
	pl->Draw();
	
	 if (full) {
		for(int i=0; i<N; i++)r[i] = -r[i];
		pl = new TPolyLine(N, z, r);
		pl->SetLineColor(color);
		if (fill_detectors) { pl->SetFillColor(color); pl->SetFillStyle(1001); }
		pl->SetLineWidth(2);
		pl->Draw();
	 }
}
Exemple #2
0
void createPolyline(const Data& data){

  double x[data.points.size()],y[data.points.size()];
  for(size_t i=0;i<data.points.size()/2;i++){
    x[i]=data.points[2*i];
    y[i]=data.points[2*i+1];
  }
  TPolyLine*  pline = new TPolyLine(data.points.size()/2,y,x);
  vp.push_back(pline);
  pline->SetFillColor(colorList.getIndex(data));
  pline->SetLineWidth(0);
  pline->Draw("f");
}
Exemple #3
0
//--------------------------
// DrawStartCounterBoundaries
//--------------------------
void DrawStartCounterBoundaries(int color=start_counter_color)
{
  // Values from Richard's old spreadsheet "start_geom.xls"
  const int Npoints = 15;
  double r_hi[] = {8.675, 8.675, 8.675, 7.759, 7.354, 4.353, 3.134,
          2.290, 1.915, 5.593, 5.893, 6.907, 6.951, 6.951, 8.675};
  double r_lo[Npoints];
  for (Int_t i=0; i<Npoints; i++) r_lo[i] = -r_hi[i];
  
  double z[] = {   0.0, 51.383, 51.726, 53.938, 54.914, 57.915, 59.134,
          58.442, 58.290, 54.360, 54.238, 51.531, 51.488,    0.0, 0.0};
  
  // shift z to proper location in lab system
  for(int i=0; i<Npoints; i++)z[i] += 38.75;
  
  TPolyLine *pol = new TPolyLine(Npoints, z, r_hi);
  pol->SetLineWidth(2.0);
  if (fill_detectors) { pol->SetFillColor(color); pol->SetFillStyle(1001); }
  else pol->SetFillStyle(0);
  pol->SetLineColor(color);
  pol->Draw();

  TLatex *lab = new TLatex(z[6]+(z[6]-z[0])*0.1, 0, "start counter");
  if (full) lab->SetTextAlign(12); else lab->SetTextAlign(11);
  lab->SetTextSize(0.02);
  lab->SetTextColor(color);
  lab->Draw();

  if (full) {
    pol = new TPolyLine(Npoints, z, r_lo);
    pol->SetLineWidth(2.0);
    if (fill_detectors) { pol->SetFillColor(color); pol->SetFillStyle(1001); }
    else pol->SetFillStyle(0);
    pol->SetLineColor(color);
    pol->Draw();
  }
}
Exemple #4
0
void stairDraw(unsigned n, int x[], int y[],
               float xOffset = .5, float yOffset = .5, float scale  = 1.){
  Float_t* xx = new Float_t[2*n-1];
  Float_t* yy = new Float_t[2*n-1];
  
  for(unsigned i = 0; i < n-1; ++i){
    xx[2*i] = x[i]*scale + xOffset;
    yy[2*i] = y[i]*scale + yOffset;
    xx[2*i+1] = x[i+1]*scale + xOffset;
    yy[2*i+1] = y[i]*scale + yOffset; 
  }
  //  xx[2*n-2] = xx[0];
  // yy[2*n-2] = yy[0];
  
  TPolyLine* p = new TPolyLine(2*n-2, xx, yy);
  p->Draw();
}
Exemple #5
0
void triangles(Int_t ntriangles=50) {
  TCanvas *c1 = new TCanvas("c1","triangles",10,10,700,700);
  TRandom r;
  Double_t dx = 0.2; Double_t dy = 0.2;
  Int_t ncolors = gStyle->GetNumberOfColors();
  Double_t x[4],y[4];
  TColor *c;
  Int_t ci;
  for (Int_t i=0;i<ntriangles;i++) {
     x[0] = r.Uniform(.05,.95); y[0] = r.Uniform(.05,.95);
     x[1] = x[0] + dx*r.Rndm(); y[1] = y[0] + dy*r.Rndm();
     x[2] = x[1] - dx*r.Rndm(); y[2] = y[1] - dy*r.Rndm();
     x[3] = x[0];               y[3] = y[0];
     TPolyLine *pl = new TPolyLine(4,x,y);
     pl->SetUniqueID(i);
     ci = ncolors*r.Rndm();
     c  = gROOT->GetColor(TColor::GetColorPalette(ci));
     c->SetAlpha(r.Rndm());
     pl->SetFillColor(ci);
     pl->Draw("f");
  }
  c1->AddExec("ex","TriangleClicked()");
}
Exemple #6
0
void checkMonster(TTree * PixelTree, int source=0)
{
  // set come alisas
  aliases(PixelTree);
  TCut cutBeforeEds, evtSel;
  TString titleBeforeEds, titleLoose,outDir;
  if (source==0) {
    cutBeforeEds = "bscSelColBx&&vz[1]>-99";
    titleBeforeEds = "Run 132440 -- L1A124,BPTX_AND,noHalo,BSC_OR,vtx";
    outDir="plots/inspect/data_coll";
  } else if (source==1) {
    cutBeforeEds = "bscSelMc && vz[1]>-99";
    titleBeforeEds = "PythiaD6T -- noHalo,BSC_OR,vtx";
    outDir="plots/inspect/mc";
  } else if (source==2) {
    cutBeforeEds = "bscSelEmpBx && vz[1]>-99";
    titleBeforeEds = "Run 132422 (empty bx) -- L1A124,noHalo,BSC_OR,vtx";
    outDir="plots/inspect/data_emptyBx";
  }
  evtSel = cutBeforeEds && "edscut2";
  titleEvtSel = titleBeforeEds+",Ed's cut";

  // Printout some stat
  cout << "===== Sel Info =====" << endl;
  cout << "Total # of Events: " << PixelTree->GetEntries() << endl;
  cout << "Passing " << PixelTree->GetAlias("trigger") << ": " << PixelTree->GetEntries("trigger") << endl;
  cout << "Passing " << PixelTree->GetAlias("bscSelEmpBx") << ": " << PixelTree->GetEntries("bscSelEmpBx") << endl;
  cout << "Passing " << TString(cutBeforeEds) << ": " << PixelTree->GetEntries(cutBeforeEds) << endl;
  cout << "Passing " << TString(evtSel) << ": " << PixelTree->GetEntries(evtSel) << endl;

  // Draw
  PixelTree->Draw("vtxqual:npxhits>>hVtxQual(50,0,1500,50,0,10)",cutBeforeEds,"goff");
  hVtxQual->SetTitle(titleBeforeEds+"; # of pixel hits; cluster-vertex compatibility");
  hVtxQual->SetMinimum(1); hVtxQual->SetMaximum(1000);

  PixelTree->Draw("vtxqual:npxhits>>hVtxQualCut(50,0,1500,50,0,10)",evtSel,"goff");
  hVtxQualCut->SetTitle(titleEvtSel+"; # of pixel hits; cluster-vertex compatibility");
  hVtxQualCut->SetMinimum(1); hVtxQualCut->SetMaximum(1000);

  //---------------Monster Cut---------------------
  // Check cut
  Double_t x[3] = {150,150,1000};
  Double_t y[3] = {0,0.5+0.0045*150,0.5+0.0045*1000};
  TPolyLine *pline = new TPolyLine(3,x,y);
  pline->SetLineColor(2);
  pline->SetLineWidth(2);

  Double_t x2[4] = {150,150,2/0.0045,1000};
  Double_t y2[4] = {0,0.0045*150,2,2};
  TPolyLine *pline2 = new TPolyLine(4,x2,y2);
  pline2->SetLineColor(2);
  pline2->SetLineWidth(2);
  pline2->SetLineStyle(2);

  TCanvas *cBeforeEdsCut = new TCanvas("cBeforeEdsCut","cBeforeEdsCut",500,500);
  hVtxQual->Draw("colz");
  gPad->SetRightMargin(0.15);
  gPad->SetLogz();

  pline->Draw("same");
  pline2->Draw("same");
  gSystem->mkdir(outDir.Data(),kTRUE);
  cBeforeEdsCut->Print(Form("%s/checkMonster.gif",outDir.Data()));

  // Apply Cut
  TCanvas *cAfterEdsCut = new TCanvas("cAfterEdsCut","cAfterEdsCut",500,500);
  hVtxQualCut->Draw("colz");
  gPad->SetRightMargin(0.15);
  gPad->SetLogz();

  pline->Draw("same");
  pline2->Draw("same");
}
void ClusterDensityFromQA(const char* qaFile="")
{
    if ( TString(qaFile).BeginsWith("alien"))
    {
        TGrid::Connect("alien://");
    }

    TFile* f = TFile::Open(qaFile);


    std::vector<IntegrationRange> rangesLow;
    std::vector<IntegrationRange> rangesHigh;

    rangesLow.push_back(IntegrationRange{-10,10, 80, 85});
    rangesLow.push_back(IntegrationRange{-10,10, 80, 85});
    rangesLow.push_back(IntegrationRange{-10,10, 95,100});
    rangesLow.push_back(IntegrationRange{-10,10, 95,100});

    for ( int i = 0; i < 4; ++i )
    {
        IntegrationRange ref = rangesLow[i];

        TObjArray* a = static_cast<TObjArray*>(f->Get("MUON_QA/expert"));

        TH2* h = static_cast<TH2*>(a->FindObject(Form("hClusterHitMapInCh%d",i+1)));

        // derive other symetric ranges from that one
        
        std::vector<IntegrationRange> ranges;

        double ysize = ref.ymax - ref.ymin;
        double xsize = (ref.xmax - ref.xmin)/2.0;

        ranges.push_back(ref);
        ranges.push_back(IntegrationRange{ref.xmin,ref.xmax,-ref.ymax,-ref.ymin});
        ranges.push_back(IntegrationRange{ref.ymin+ysize/2.0,ref.ymax,ref.xmin,ref.xmax});

        TCanvas* c = new TCanvas(Form("Chamber%d",i+1),Form("Chamber%d",i+1));

        h->Draw("colz");

        std::cout << "CHAMBER " << i+1 << " LOW = ";

        for ( auto r : ranges )
        {
            double count = h->Integral(
                h->GetXaxis()->FindBin(r.xmin),
                h->GetXaxis()->FindBin(r.xmax),
                h->GetYaxis()->FindBin(r.ymin),
                h->GetYaxis()->FindBin(r.ymax)
                );

            std::cout << " " << count << "(" << r.Surface() << " cm^2)";
            std::vector<double> x = { r.xmin,r.xmax,r.xmax,r.xmin,r.xmin };
            std::vector<double> y = { r.ymax,r.ymax,r.ymin,r.ymin,r.ymax };

            TPolyLine* l = new TPolyLine(5,&x[0],&y[0]);
            l->SetLineColor(1);
            l->SetLineStyle(9);
            l->Draw();
        }

        std::cout << std::endl;

    }
}
void makePlots()
{
// **********************************************
// *            Input parameters                *
// **********************************************
// switch to include/exclude sytematics uncertainties
    bool systematics = true;

// array of signal efficiencies
    Double_t S_eff[5] = {0.36, 0.43, 0.54, 0.59, 0.66};
//  Double_t S_eff[10] = {0.36, 0.43, 0.54, 0.59, 0.66, 0.67, 0.68, 0.7, 0.7, 0.7};
    // array of relative uncertainties on the signal efficiencies
    Double_t Sigma_S_eff[5] = {0.18, 0.15, 0.12, 0.12, 0.10};

// array of N_background for 100 pb^-1
    Double_t N_bkg_100[5] = {10.35, 6.37, 2.83, 1.27, 1.27};
// array of relative uncertainties on N_background (0.1 = 10%)
    Double_t Sigma_N_bkg[5] = {0.19, 0.23, 0.33, 0.33, 0.33};

// arrays of leptoquark masses
    Double_t m[10] = {250, 300, 400, 500, 600, 650, 700, 800, 900, 1000};

// relative uncertainty on the integrated luminosity (0.1 = 10% uncertainty)
    Double_t Sigma_L = 0.1;

// array of theoretical cross-sections for different leptoquark masses
    Double_t xsTh[10] = {10.1, 3.8, 0.75, 0.197, 0.0617, 0.0362, 0.0218, 0.0085, 0.00351, 0.00153};

// filename for the final plot (NB: changing the name extension changes the file format)
    string fileName = "xs95CL_vs_m.eps";

// axes labels for the final plot
    string title = ";m (GeV/c^{2});#beta^{2}#times#sigma (pb)";

    TH2F *bg = new TH2F("bg",title.c_str(), 100, 200., 650., 100, 0.01, 50.);
    bg->SetStats(kFALSE);
    bg->SetTitleOffset(1.,"X");
    bg->SetTitleOffset(1.5,"Y");

// region excluded by Tevatron limits
    Double_t x_shaded[5] = {200,256,256,200,200};
    Double_t y_shaded[5] = {0.01,0.01,50,50,0.01};

// PDF uncertainty band
    Double_t x_pdf[12] = {250,300,400,500,600,650,650,600,500,400,300,250};
    Double_t y_pdf[12] = {9.64045,3.6081,0.691125,0.176217,0.0538333,0.0312225,0.0424445,0.071356,0.221527,0.819375,4.0147,10.5293};

// **********************************************
// *  Don't change anything below this point!   *
// **********************************************

    // turn on/off batch mode
    gROOT->SetBatch(kTRUE);
// set ROOT style
    style();

    TCanvas *c = new TCanvas("c","",800,800);
    c->cd();

    bg->Draw();

    TGraph *grshade = new TGraph(12,x_pdf,y_pdf);
    grshade->SetFillColor(kYellow);
    grshade->Draw("f");

    TPolyLine *pl = new TPolyLine(5,x_shaded,y_shaded,"F");
//  pl->SetFillStyle(3001);
    pl->SetFillColor(kGray+1);
    pl->Draw();

    gPad->RedrawAxis();

    Int_t size = sizeof(S_eff)/sizeof(*S_eff);

// array of 95% CL upper limits on the cross section
//  Double_t xsUp[size];
    Double_t xsUp[5] = {0.23722, 0.166074, 0.10131, 0.0748393, 0.0669023};
//  Double_t xsUp_sys[size]; // with systematics included
    Double_t xsUp_sys[5] = {0.302162, 0.198514, 0.114258, 0.0816143, 0.0718672}; // with systematics included

//  for(Int_t i = 0; i < size; i++){
//
//   xsUp[i] = CLA(100, 0, S_eff[i], 0, N_bkg_100[i], 0);
//   if(systematics) xsUp_sys[i] = CLA(100, 100*Sigma_L, S_eff[i], S_eff[i]*Sigma_S_eff[i], N_bkg_100[i], N_bkg_100[i]*Sigma_N_bkg[i]);
//  }

    TGraph *xsUp_vs_m = new TGraph(size, m, xsUp);
    xsUp_vs_m->SetLineWidth(2);
    xsUp_vs_m->SetLineStyle(7);
    xsUp_vs_m->SetLineColor(kBlue);
    xsUp_vs_m->SetMarkerSize(.9);
    xsUp_vs_m->SetMarkerStyle(22);
    xsUp_vs_m->SetMarkerColor(kBlue);
    xsUp_vs_m->Draw("CP");

    TGraph *xsUp_vs_m_sys = new TGraph(size, m, xsUp_sys);
    xsUp_vs_m_sys->SetLineWidth(2);
    xsUp_vs_m_sys->SetLineColor(kRed);
    xsUp_vs_m_sys->SetMarkerSize(.9);
    xsUp_vs_m_sys->SetMarkerStyle(21);
    xsUp_vs_m_sys->SetMarkerColor(kRed);
    if(systematics) xsUp_vs_m_sys->Draw("CP");

    TGraph *xsTh_vs_m = new TGraph(size+1, m, xsTh);
    xsTh_vs_m->SetLineWidth(2);
    xsTh_vs_m->SetLineColor(kGreen+2);
    xsTh_vs_m->SetFillColor(kYellow);
    xsTh_vs_m->SetMarkerSize(1.);
    xsTh_vs_m->SetMarkerStyle(22);
    xsTh_vs_m->SetMarkerColor(kGreen+2);
    xsTh_vs_m->Draw("C");

    TLegend *legend = new TLegend(.3,.69,.92,.86);
    legend->SetBorderSize(1);
    legend->SetFillColor(0);
//legend->SetFillStyle(0);
    legend->SetMargin(0.15);
    legend->SetHeader("LQ #rightarrow eq");
    legend->AddEntry(xsTh_vs_m,"#beta^{2}#times#sigma_{theory} with PDF unc. band, #beta=1","lf");
    if(systematics) legend->AddEntry(xsUp_vs_m_sys,"95% C.L. upper limit (with sys. unc.)","lp");
    legend->AddEntry(xsUp_vs_m,"95% C.L. upper limit (no sys. unc.)","lp");
    legend->Draw();

    TLatex l1;
    l1.SetTextAlign(12);
    l1.SetTextSize(0.04);
    l1.SetTextFont(62);
    l1.SetNDC();
    l1.DrawLatex(0.25,0.24,"CMS Preliminary");

    TLatex l2;
    l2.SetTextAlign(12);
    l2.SetTextSize(0.04);
    l2.SetTextFont(62);
    l2.SetNDC();
    l2.DrawLatex(0.25,0.15,"#intLdt=100 pb^{-1}");

    c->SetGridx();
    c->SetGridy();
//  c->SaveAs(fileName.c_str());

    string name, extension;
    size_t pos = fileName.find(".");

    name = fileName.substr(0,pos);
    extension = fileName.substr(pos);

    c->SetLogy();
    c->SaveAs((name + "_log" + extension).c_str());

    delete pl;
    delete xsTh_vs_m;
    delete xsUp_vs_m;
    delete xsUp_vs_m_sys;
    delete bg;
    delete c;
}
Exemple #9
0
void DrawBoth(){

  gSystem->Load("StEpdUtil");
  StBbcGeom* Bgeo = new StBbcGeom();
  StEpdGeom* geo = new StEpdGeom();


  TCanvas* cBoth = new TCanvas("BothCan","BothCan",1400,700);
  cBoth->Divide(2);
  cBoth->Draw();
  TPad* EastPad=cBoth->cd(1);
  TPad* WestPad=cBoth->cd(2);


  TH2D* hEastFrame = new TH2D("East","East",500,-100,100,500,-100,100);
  EastPad->cd();
  EastPad->SetGrid(0,0);
  hEastFrame->Draw();

  Short_t EW=-1;
  Double_t x[6];
  Double_t y[6];
  Int_t nCorners;
  for (Short_t PP=1; PP<=12; PP++){
    for (Short_t TT=1; TT<=31; TT++){

      geo->GetCorners(PP,TT,EW,&nCorners,x,y);

      x[nCorners]=x[0];    y[nCorners]=y[0];   // closes the polyline
      TPolyLine* pline = new TPolyLine(nCorners+1,x,y);
      pline->Draw();
      
      Double_t xcent = geo->TileCenter(PP,TT,EW).X();
      Double_t ycent = geo->TileCenter(PP,TT,EW).Y();
      TText* lab = new TText(xcent,ycent,Form("%d.%d",PP,TT));
      lab->SetTextAlign(22);  lab->SetTextSize(0.01);  lab->SetTextColor(1);
      lab->Draw();

    }
  }
  
  for (short tileId=-18; tileId<0; tileId++){     // NOTE negative tileId because East Bbc
    TVector3 cent = Bgeo->TileCenter(tileId);

    TText* txt = new TText(cent.X(),cent.Y(),Form("%d",tileId));
    txt->SetTextSize(.02);
    txt->SetTextAlign(22);
    txt->Draw();

    double xc[7];
    double yc[7];
    Bgeo->GetCorners(tileId,xc,yc);
    xc[6]=xc[0];    yc[6]=yc[0];
    TPolyLine* pline = new TPolyLine(7,xc,yc);
    pline->SetLineColor(4);
    pline->SetLineWidth(2);
    pline->Draw();


    unsigned short pmtNumber = Bgeo->PmtOfTile(abs(tileId));
    TText* Ptxt = new TText(cent.X(),cent.Y()-5.0,Form("%d",pmtNumber));
    Ptxt->SetTextSize(0.01);
    Ptxt->SetTextColor(2);
    Ptxt->Draw();

  }


  //-----------------------------

  TH2D* hWestFrame = new TH2D("West","West",500,-100,100,500,-100,100);
  WestPad->cd();
  WestPad->SetGrid(0,0);
  hWestFrame->Draw();

  Short_t EW=1;
  Double_t x[6];
  Double_t y[6];
  Int_t nCorners;
  for (Short_t PP=1; PP<=12; PP++){
    for (Short_t TT=1; TT<=31; TT++){

      geo->GetCorners(PP,TT,EW,&nCorners,x,y);

      x[nCorners]=x[0];    y[nCorners]=y[0];   // closes the polyline
      TPolyLine* pline = new TPolyLine(nCorners+1,x,y);
      pline->Draw();
      
      Double_t xcent = geo->TileCenter(PP,TT,EW).X();
      Double_t ycent = geo->TileCenter(PP,TT,EW).Y();
      TText* lab = new TText(xcent,ycent,Form("%d.%d",PP,TT));
      lab->SetTextAlign(22);  lab->SetTextSize(0.01);  lab->SetTextColor(1);
      lab->Draw();

    }
  }
  
  for (short tileId=1; tileId<19; tileId++){
    TVector3 cent = Bgeo->TileCenter(tileId);

    TText* txt = new TText(cent.X(),cent.Y(),Form("%d",tileId));
    txt->SetTextSize(.02);
    txt->SetTextAlign(22);
    txt->Draw();

    double xc[7];
    double yc[7];
    Bgeo->GetCorners(tileId,xc,yc);
    xc[6]=xc[0];    yc[6]=yc[0];
    TPolyLine* pline = new TPolyLine(7,xc,yc);
    pline->SetLineColor(4);
    pline->SetLineWidth(2);
    pline->Draw();


    unsigned short pmtNumber = Bgeo->PmtOfTile(abs(tileId));
    TText* Ptxt = new TText(cent.X(),cent.Y()-5.0,Form("%d",pmtNumber));
    Ptxt->SetTextSize(0.01);
    Ptxt->SetTextColor(2);
    Ptxt->Draw();

  }


  cBoth->SaveAs("Both.pdf");



}
void makePlots()
{
 // **********************************************
 // *            Input parameters                *
 // **********************************************
 // switch to include/exclude sytematics uncertainties
 bool systematics = true; // does nothing at the moment

 // total integrated luminosity (in pb-1)
 Double_t L_int = 33.2;
 // relative uncertainty on the integrated luminosity (0.1 = 10% uncertainty)
 Double_t Sigma_L_int = 0.11;

 // array of signal efficiencies
 Double_t S_eff[10] = {0.297, 0.380, 0.403, 0.430, 0.451, 0.469, 0.496, 0.522, 0.539, 0.565};
 // array of relative uncertainties on the signal efficiencies (0.1 = 10%)
 Double_t Sigma_S_eff[10] = {0.105, 0.105, 0.105, 0.105, 0.105, 0.105, 0.105, 0.105, 0.105, 0.105};

 // array of N_background for L_int
 Double_t N_bkg[10] = {4.9, 2.7, 1.7, 1.4, 1.2, 0.96, 0.80, 0.67, 0.42, 0.33};
 // to PRL in Dec 2010 Double_t N_bkg[10] = {4.5, 2.5, 1.5, 1.3, 1.1, 0.89, 0.75, 0.62, 0.41, 0.32};
 // array of relative uncertainties on N_background (0.1 = 10%)
 Double_t Sigma_N_bkg[10] = {0.28, 0.28, 0.28, 0.28, 0.28, 0.28, 0.28, 0.28, 0.28, 0.28};
 // to PRL in Dec 2010 Double_t Sigma_N_bkg[10] = {0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25};

 // array of N_observed for L_int
 Int_t N_obs[10] = {2, 1, 1, 1, 1, 1, 1, 1, 0, 0};

 // array of LQ masses for calculation of upXS
 Double_t mData[10] = {200, 250, 280, 300, 320, 340, 370, 400, 450, 500};

 // arrays of LQ masses for theoretical cross section
 Double_t mTh[10] = {100, 150, 200, 250, 300, 350, 400, 450, 500, 550};
 // array of theoretical cross-sections for different leptoquark masses
 Double_t xsTh[10] = {386, 53.3, 11.9, 3.47, 1.21, 0.477, 0.205, 0.0949, 0.0463, 0.0236};

 // filename for the final plot (NB: changing the name extension changes the file format)
 string fileName = "xs95CL_vs_m.eps";

 // axes labels for the final plot
 string title = ";M_{LQ} [GeV];#beta^{2}#times#sigma [pb]";

 // integrated luminosity
 string lint = "#intLdt=33.2 pb^{-1}";

 // region excluded by Tevatron limits
 Double_t x_shaded[5] = {200,299,299,200,200};
 Double_t y_shaded[5] = {0.01,0.01,100,100,0.01};

 // PDF uncertainty band
 Double_t x_pdf[20] = {100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 550, 500, 450, 400, 350, 300, 250, 200, 150, 100};
 Double_t y_pdf[20] = {445.5, 61.4, 13.7, 4.1, 1.43, 0.572, 0.249, 0.1167, 0.0581, 0.0300, 0.0169, 0.0340, 0.0719, 0.160, 0.379, 0.98, 2.9, 10.0, 45.2, 330.3};

  // turn on/off batch mode
 gROOT->SetBatch(kTRUE);

 Int_t size = sizeof(S_eff)/sizeof(*S_eff);

 // Upper limits can be entered manually when the calls to CL95(...) and CLA(...) are commented below.
 // However, CL95(...) and CLA(...) have to be called at least once to get the upper limits

//  Double_t xsUp_observed[size];
//  for(Int_t i = 0; i < size; i++){

//    xsUp_observed[i] = CL95(L_int, L_int*Sigma_L_int, S_eff[i], S_eff[i]*Sigma_S_eff[i], N_bkg[i], N_bkg[i]*Sigma_N_bkg[i], N_obs[i], kFALSE, 1);
//  }
//  cout<<endl<<Form("Double_t xsUp_observed[%i] = {", size);
//  for(Int_t i = 0; i < size; i++) {
//    cout<<xsUp_observed[i];
//    if(i<(size-1)) cout<<", ";
//  }
//  cout<<"};"<<endl<<endl;
 // Array of the observed 95% CL upper limits on the cross section
 Double_t xsUp_observed[10] = {0.440918, 0.308594, 0.30542,  0.291992, 0.282715, 0.277588, 0.266846, 0.257324, 0.174243, 0.166113};
 //to PRL in Dec. 2010 Double_t xsUp_observed[10] = {0.444824, 0.310547, 0.309082, 0.293945, 0.284668, 0.279297, 0.268066, 0.258789, 0.174243, 0.166113};

//  Double_t xsUp_expected[size];
//  for(Int_t i = 0; i < size; i++){
//
//    xsUp_expected[i] = CLA(L_int, L_int*Sigma_L_int, S_eff[i], S_eff[i]*Sigma_S_eff[i], N_bkg[i], N_bkg[i]*Sigma_N_bkg[i], kFALSE, 1);
//  }
//  cout<<endl<<Form("Double_t xsUp_expected[%i] = {", size);
//  for(Int_t i = 0; i < size; i++) {
//    cout<<xsUp_expected[i];
//    if(i<(size-1)) cout<<", ";
//  }
//  cout<<"};"<<endl<<endl;
 // Array of the expected 95% CL upper limits on the cross section
 Double_t xsUp_expected[10] = {0.719781, 0.454356, 0.373334, 0.332432, 0.30521, 0.278996, 0.254081, 0.233398, 0.209577, 0.193584};
 //to PRL in Dec. 2010 Double_t xsUp_expected[10] = {0.692479, 0.442443, 0.360792, 0.326146, 0.298866, 0.274453, 0.250794, 0.230144, 0.208843, 0.192884};

 // set ROOT style
//  myStyle();
 setTDRStyle();
 gStyle->SetPadLeftMargin(0.14);
 gROOT->ForceStyle();

 TCanvas *c = new TCanvas("c","",800,800);
 c->cd();

 TH2F *bg = new TH2F("bg",title.c_str(), 100, 200., 500., 100, 0.01, 100.);
 bg->SetStats(kFALSE);
 bg->SetTitleOffset(1.,"X");
 bg->SetTitleOffset(1.13,"Y");
//  bg->GetXaxis()->SetNdivisions(505);

 bg->Draw();

 TPolyLine *pl = new TPolyLine(5,x_shaded,y_shaded,"F");
//  pl->SetFillStyle(3001);
 pl->SetLineColor(0);
 pl->SetFillColor(kGray);
 pl->Draw();

 TGraph *grshade = new TGraph(20,x_pdf,y_pdf);
 grshade->SetFillColor(kGreen);
 grshade->Draw("f");

 gPad->RedrawAxis();

 // set ROOT style
//  myStyle();
 setTDRStyle();
 gStyle->SetPadLeftMargin(0.14);
 gROOT->ForceStyle();

 TGraph *xsTh_vs_m = new TGraph(10, mTh, xsTh);
 xsTh_vs_m->SetLineWidth(2);
 xsTh_vs_m->SetLineColor(kRed);
 xsTh_vs_m->SetFillColor(kGreen);
 xsTh_vs_m->SetMarkerSize(1.);
 xsTh_vs_m->SetMarkerStyle(22);
 xsTh_vs_m->SetMarkerColor(kRed);
 xsTh_vs_m->Draw("C");

 TGraph *xsData_vs_m_expected = new TGraph(size, mData, xsUp_expected);
 xsData_vs_m_expected->SetMarkerStyle(23);
 xsData_vs_m_expected->SetMarkerColor(kBlue);
 xsData_vs_m_expected->SetLineColor(kBlue);
 xsData_vs_m_expected->SetLineWidth(2);
 xsData_vs_m_expected->SetLineStyle(2);
 xsData_vs_m_expected->SetMarkerSize(1.5);
 xsData_vs_m_expected->Draw("CP");

 TGraph *xsData_vs_m_observed = new TGraph(size, mData, xsUp_observed);
 xsData_vs_m_observed->SetMarkerStyle(22);
 xsData_vs_m_observed->SetMarkerColor(kBlack);
 xsData_vs_m_observed->SetLineColor(kBlack);
 xsData_vs_m_observed->SetLineWidth(2);
 xsData_vs_m_observed->SetLineStyle(1);
 xsData_vs_m_observed->SetMarkerSize(1.5);
 xsData_vs_m_observed->Draw("CP");

 TLegend *legend = new TLegend(.36,.65,.91,.92);
 legend->SetBorderSize(1);
 legend->SetFillColor(0);
 //legend->SetFillStyle(0);
 legend->SetTextFont(42);
 legend->SetMargin(0.15);
 legend->SetHeader("LQ #rightarrow eq");
 legend->AddEntry(pl,"D#oslash exclusion (1 fb^{-1}, #beta=1)","f");
 legend->AddEntry(xsTh_vs_m,"#beta^{2}#times#sigma_{theory} with theory uncertainty, #beta=1","lf");
 legend->AddEntry(xsData_vs_m_expected, "Expected 95% C.L. upper limit","lp");
 legend->AddEntry(xsData_vs_m_observed, "Observed 95% C.L. upper limit","lp");
 legend->Draw();

 TLatex l1;
 l1.SetTextAlign(12);
 l1.SetTextFont(42);
 l1.SetNDC();
 l1.SetTextSize(0.06);
 l1.DrawLatex(0.42,0.31,"CMS");
 l1.SetTextSize(0.05);
 l1.DrawLatex(0.42,0.20,lint.c_str());

 c->SetGridx();
 c->SetGridy();

 string name, extension;
 size_t pos = fileName.find(".");

 name = fileName.substr(0,pos);
 extension = fileName.substr(pos);

 c->SetLogy();
 c->SaveAs((name + "_log" + extension).c_str());

 delete pl;
 delete xsTh_vs_m;
 delete bg;
 delete c;
}
Exemple #11
0
//---------------------------------------------------------------
double *treat(TString fileData, double lumi, TString decay, vector<double> mtop, vector<double> xlim, int binned, TString date, TString version) 
//---------------------------------------------------------------
{
  //TString indir = date+"/v"+version+"/";
  TString indir = date+"/"+version+"/";
  TString outdir = indir;
  TString channel = " + Jets channel";
  if (fileData.Contains("ElectronHad")) {
    outdir += "CalibEl/";
    indir += "MyAnaEl/";
    if (decay.Contains("semi", TString::kIgnoreCase))
      channel = "e"+channel;
    if (decay.Contains("di", TString::kIgnoreCase))
      channel = "ee/e#mu"+channel;
    if (decay.Contains("all", TString::kIgnoreCase))
      channel = "e/ee/e#mu"+channel;
  }
  if (fileData.Contains("MuHad")) {
    outdir += "CalibMu/";
    indir += "MyAnaMu/";
    if (decay.Contains("semi", TString::kIgnoreCase))
      channel = "#mu"+channel;
    if (decay.Contains("di", TString::kIgnoreCase))
      channel = "#mu#mu/#mue"+channel;
    if (decay.Contains("all", TString::kIgnoreCase))
      channel = "#mu/#mu#mu/#mue"+channel;
  }
  if (fileData.Contains("Run2012")) {
    outdir += "CalibAll/";
    indir += "MyAnaAll/";
    if (decay.Contains("semi", TString::kIgnoreCase))
      channel = "e/#mu"+channel;
    if (decay.Contains("di", TString::kIgnoreCase))
      channel = "ee/#mu#mu/e#mu"+channel;
    if (decay.Contains("all", TString::kIgnoreCase))
      channel = "e/#mu/ee/#mu#mu/e#mu"+channel;
  }
  gROOT->ProcessLine(".! mkdir "+outdir);
  TLatex* channel_tex = new TLatex(0.22, 0.9, channel);
  channel_tex->SetNDC(true);
  channel_tex->SetTextFont(43);
  channel_tex->SetTextSize(TITLE_FONTSIZE - 6);

  const unsigned int numberOfPoints = mtop.size(); 
  double x[numberOfPoints], ex[numberOfPoints];
  double y[numberOfPoints], ey[numberOfPoints];

  for (unsigned int itop = 0; itop < numberOfPoints; itop++) {
    TString fileMC = TString::Format("All_%d_5.root", (int)mtop[itop]);
    //TString fileMC = TString::Format("TTJets_MSDecays_JpsiFilter_%d_5.root", (int)mtop[itop]);
    double *mean_err = new double[2];
    if (binned < 2)
      mean_err = unbinnedFit(indir+fileMC, xlim, mtop[itop], channel_tex, outdir, lumi);
    if (binned == 2)
      mean_err = binnedFit(indir+fileMC, xlim, mtop[itop], channel_tex, outdir, lumi);
    y[itop] = mean_err[0];
    ey[itop] = mean_err[1];
    x[itop] = mtop[itop]+0.5;
    ex[itop] = 0.;
  }

  TGraphErrors *gr = new TGraphErrors(numberOfPoints, x, y, ex, ey);

  TFitResultPtr fitptr = gr->Fit("pol1", "FSQ", "");
  TF1 *fit = gr->GetFunction("pol1");
  double yinte = fitptr->Parameter(0);
  double errYinte = fitptr->ParError(0);
  double slope = fitptr->Parameter(1);
  double errSlope = fitptr->ParError(1);
  double chi2 = fitptr->Chi2();
  double ndf = fitptr->Ndf();

  double err_up[numberOfPoints];
  double err_down[numberOfPoints];
  double err_val[numberOfPoints];
  fitptr->GetConfidenceIntervals(numberOfPoints, 1, 1, x, err_val, 0.68);
  for(unsigned int itop = 0; itop < numberOfPoints; itop++) {
    double error = err_val[itop];
    err_up[itop] = fit->Eval(x[itop]) + error;
    err_down[itop] = fit->Eval(x[itop]) - error;
  }

  TGraph *gr_up = new TGraph(numberOfPoints,x,err_up);
  gr_up->Fit("pol2","FQ","");
  TF1 *fit_up = gr_up->GetFunction("pol2");
  TGraph *gr_down = new TGraph(numberOfPoints,x,err_down);
  gr_down->Fit("pol2","FQ","");
  TF1 *fit_down = gr_down->GetFunction("pol2");  

  TLegend *leg_calib = new TLegend(0.2,0.75,0.65,0.83,NULL,"brNDC");
  leg_calib->SetTextSize(0.04);
  leg_calib->AddEntry(gr,TString::Format("Slope of %.2f #pm %.2f", slope, errSlope),"lp");
  leg_calib->SetHeader("Calibration curve");

  // Blinded analysis 
  
  TCanvas *cn_calib = new TCanvas("cn_calib", "cn_calib", 800, 800);
  cn_calib->cd();
  grapherrors_myStyle(gr,"gr",2,30,1,30,1001,-1111,-1111,510,510,21,36,1.,"M_{t} (GeV)","M_{J/#psi+l} (GeV)");
  gr->Draw("AP");
  cn_calib->Update();
  fit->SetLineColor(30);
  fit_up->SetLineColor(29); fit_up->SetLineStyle(2); fit_up->SetLineWidth(2);
  fit_up->Draw("same");
  fit_down->SetLineColor(29); fit_down->SetLineStyle(2); fit_down->SetLineWidth(2);
  fit_down->Draw("same");
  leg_myStyle(leg_calib);
  leg_calib->SetTextAlign(22);
  leg_calib->Draw();  
  channel_tex->Draw("same");
  cms_myStyle(lumi, false);
  TString outBlind = outdir;
  if (binned < 2)
    outBlind += "BlindedUnbinnedCalibration";
  if (binned == 2)
    outBlind += "BlindedBinnedCalibration";
  cn_calib->SaveAs(outBlind+".pdf");
  cn_calib->SaveAs(outBlind+".C");
  cn_calib->SaveAs(outBlind+".jpg");
  cn_calib->SaveAs(outBlind+".eps");

  // Unblinded analysis
  double *data_fit = new double[2];
  if (binned == 0)
    data_fit = unbinnedFit(indir+fileData, xlim, 0., channel_tex, outdir, lumi);
  if (binned > 0)
    data_fit = binnedFit(indir+fileData, xlim, 0., channel_tex, outdir, lumi);
  double mean_gaus = data_fit[0];
  double err_gaus = data_fit[1];
  TString mjpsil_res = TString::Format("M_{J/#psi+l} = (%3.1f #pm %3.1f) GeV", mean_gaus, err_gaus);

  double x_horiz[4]={gr->GetXaxis()->GetXmin(),fit->GetX(mean_gaus+err_gaus,0,250),fit->GetX(mean_gaus-err_gaus,0,250),gr->GetXaxis()->GetXmin()};
  double y_horiz[4]={mean_gaus+err_gaus,mean_gaus+err_gaus,mean_gaus-err_gaus,mean_gaus-err_gaus};
  TPolyLine *horiz = new TPolyLine(4,x_horiz,y_horiz);
  TLine *horiz_sup = new TLine(x_horiz[0], y_horiz[0], x_horiz[1], y_horiz[1]);
  TLine *horiz_med = new TLine(gr->GetXaxis()->GetXmin(), mean_gaus, fit->GetX(mean_gaus,0,250), mean_gaus);
  TLine *horiz_inf = new TLine(x_horiz[2], y_horiz[2], x_horiz[3], y_horiz[3]);
  double x_vert_min[4]={fit_up->GetX(mean_gaus-err_gaus,0,250),fit_up->GetX(mean_gaus-err_gaus,0,250),x_horiz[2],x_horiz[2]};
  double y_vert_min[4]={gr->GetYaxis()->GetXmin(),mean_gaus-err_gaus,mean_gaus-err_gaus,gr->GetYaxis()->GetXmin()};
  TPolyLine *vert_min = new TPolyLine(4,x_vert_min,y_vert_min);
  double x_vert_mean[4]={x_horiz[2],x_horiz[2],x_horiz[1],x_horiz[1]};
  double y_vert_mean[4]={gr->GetYaxis()->GetXmin(),y_horiz[2],y_horiz[1],gr->GetYaxis()->GetXmin()};
  TPolyLine *vert_mean = new TPolyLine(4,x_vert_mean,y_vert_mean);
  double x_vert_max[4]={x_horiz[1],x_horiz[1],fit_down->GetX(mean_gaus+err_gaus,0,250),fit_down->GetX(mean_gaus+err_gaus,0,250)};
  double y_vert_max[4]={gr->GetYaxis()->GetXmin(),mean_gaus+err_gaus,mean_gaus+err_gaus,gr->GetYaxis()->GetXmin()};
  TPolyLine *vert_max = new TPolyLine(4,x_vert_max,y_vert_max);
  TLine *vert1 = new TLine(x_vert_min[0],y_vert_min[0],x_vert_min[1],y_vert_min[1]);
  TLine *vert2 = new TLine(x_vert_mean[0],y_vert_mean[0],x_vert_mean[1],y_vert_mean[1]);
  TLine *vert3 = new TLine(fit->GetX(mean_gaus,0,250),y_vert_mean[0],fit->GetX(mean_gaus,0,250),mean_gaus);
  TLine *vert4 = new TLine(x_vert_mean[3],y_vert_mean[3],x_vert_mean[2],y_vert_mean[2]);
  TLine *vert5 = new TLine(x_vert_max[3],y_vert_max[3],x_vert_max[2],y_vert_max[2]);
  TString mt_res; 
  double pm_fit = (x_vert_mean[3]-x_vert_mean[0])/2.;
  double p_fit = x_vert_max[3]-x_vert_mean[3];
  double m_fit = x_vert_mean[0]-x_vert_min[0];
  if (fabs(p_fit-m_fit)<0.1) 
    mt_res= TString::Format("M_{t} = (%0.1f #pm %0.1f #pm %0.1f) GeV", fit->GetX(mean_gaus,0,250), pm_fit, fabs(m_fit));
  else 
    mt_res= TString::Format("M_{t} = (%0.1f #pm %0.1f #splitline{_{+ %0.1f}}{_{- %0.1f}}) GeV", fit->GetX(mean_gaus,0,250),pm_fit, fabs(p_fit), fabs(m_fit));
  double *mtop_res = new double[2];
  mtop_res[0] = fit->GetX(mean_gaus,0,250);
  mtop_res[1] = pm_fit + max(fabs(p_fit), fabs(m_fit));

  TLegend *leg_res = new TLegend(0.2,0.75,0.65,0.87,NULL,"brNDC");
  leg_res->SetTextSize(0.04);
  leg_res->AddEntry(gr,TString::Format("Slope of %.2f #pm %.2f", slope, errSlope),"lp");
  leg_res->AddEntry((TObject*)0, mjpsil_res, "");
  leg_res->AddEntry((TObject*)0, mt_res, "");

  TCanvas *cn_res = new TCanvas("cn_res", "cn_res", 800, 800);
  cn_res->cd();
  grapherrors_myStyle(gr,"gr",2,30,1,30,1001,-1111,-1111,510,510,21,36,1.,"M_{t} (GeV)","M_{J/#psi+l} (GeV)");
  gr->Draw("AP");
  cn_res->Update();
  fit->SetLineColor(30);
  fit_up->SetLineColor(29); fit_up->SetLineStyle(2); fit_up->SetLineWidth(2);
  fit_up->Draw("same");
  fit_down->SetLineColor(29); fit_down->SetLineStyle(2); fit_down->SetLineWidth(2);
  fit_down->Draw("same");
  poly_myStyle(horiz,0,30,1,9,3002);
  horiz->Draw("f");
  horiz->Draw("same");
  line_myStyle(horiz_sup,2,9,2);
  horiz_sup->Draw("same");
  line_myStyle(horiz_med,2,4,1);
  horiz_med->Draw("same");
  line_myStyle(horiz_inf,2,9,2);
  horiz_inf->Draw("same");
  poly_myStyle(vert_min,0,9,2,38,3003);
  vert_min->Draw("f");
  vert_min->Draw("same");
  poly_myStyle(vert_mean,0,30,1,9,3002);
  vert_mean->Draw("f");
  vert_mean->Draw("same");
  poly_myStyle(vert_max,2,38,2,38,3003);
  vert_max->Draw("f");
  vert_max->Draw("same");
  line_myStyle(vert1,2,38,2);
  vert1->Draw("same");
  line_myStyle(vert2,2,9,2);
  vert2->Draw("same");
  line_myStyle(vert3,2,4,1);
  vert3->Draw("same");
  line_myStyle(vert4,2,9,2);
  vert4->Draw("same");
  line_myStyle(vert5,2,38,2);
  vert5->Draw("same");
  leg_myStyle(leg_res);
  leg_res->SetTextAlign(22);
  leg_res->Draw();  
  channel_tex->Draw("same");
  cms_myStyle(lumi, true);
  TString outUnblind = outdir;
  if (binned == 0)
    outUnblind += "UnblindedUnbinnedCalibration";
  if (binned == 1)
    outUnblind += "UnblindedMixedCalibration";
  if (binned == 2)
    outUnblind += "UnblindedBinnedCalibration";
  cn_res->SaveAs(outUnblind+".pdf");
  cn_res->SaveAs(outUnblind+".C");
  cn_res->SaveAs(outUnblind+".jpg");
  cn_res->SaveAs(outUnblind+".eps");

  cout << "\n=============== " << channel <<" =================\n" <<endl;
  for (unsigned int itop = 0; itop < numberOfPoints; itop++)
    cout << "M_{top} = "<< x[itop] << " GeV, #tilde{M}_{J/#psi+l} = (" << y[itop] << " +/- "<< ey[itop] << ") GeV" << endl;
  cout << "\nCalibration:" << endl;
  cout << "#chi^{2}/Ndof = " << chi2/ndf << endl;
  cout << "slope = " << slope << " +/- " << errSlope << endl;
  cout << "y-intercept = " << yinte << " +/- " << errYinte << endl;
  if (binned == 0)
    cout << "\nUnbinned fit:" << endl;
  if (binned == 1)
    cout << "\nMixed fit:" << endl;
  if (binned == 2)
    cout << "\nBinned fit:" << endl;
  cout << mjpsil_res << endl;
  cout << mt_res << endl;
  cout << "\nFigures saved in " << outdir << endl;

  return mtop_res;
}
Exemple #12
0
void bambuAliases(Int_t type=0){

  TChain *ev = new TChain("Events");

  //data
  //ev->Add("/home/edwenger/123596-merged-emptytarget.root");
  //ev->Add("/home/edwenger/123596-merged-targettarget.root");
  //if(type==0) ev->Add("/home/edwenger/123596-mergetestv4.root");
  //if(type==0) ev->Add("/home/edwenger/123596v5-targettarget.root");
  //if(type==0) ev->Add("/home/edwenger/124120-merged.root");
  if(type==0) ev->Add("/d100/data/ZeroBias-rereco/124022a3a4_v2_1/bambu*.root");
  if(type==1) ev->Add("/home/edwenger/123596v5-emptytarget.root");

  //mc
  //ev->Add("/home/loizides/bambu-summer09-MinBias-GEN-SIM-RAW-STARTUP3X_V8I_900GeV-v2.root");
  //ev->Add("/d101/yetkin/mc/CMSSW_3_3_5/BSC_Tuned_v1/Pythia_MinBias_D6T_900GeV_d20091210/bambu/0024CE3C-56E5-DE11-ABDD-002618943930.root");
  if(type==2) ev->Add("/home/edwenger/merge_BSC_Tuned_v1_Pythia_MinBias_D6T_900GeV_d20091210.root");
  if(type==3) ev->Add("/home/edwenger/merge_BSC_Tuned_v1_Pythia_MinBias_ATLAS_900GeV_d20091208.root");

  // event-wide aliases
  ev->SetAlias("run","EventHeader.fRunNum");
  ev->SetAlias("evtno","EventHeader.fEvtNum");
  ev->SetAlias("bunch","EventHeader.fBunchCrossing");
  ev->SetAlias("npix","PixelHits.Entries()");
  ev->SetAlias("pxl","PixelHits.fArray");
  ev->SetAlias("npix1","Sum$(pxl.fType==1)");
  ev->SetAlias("npix2","Sum$(pxl.fType==2)");
  ev->SetAlias("npix3","Sum$(pxl.fType==3)");
  ev->SetAlias("bpix","Sum$(abs(pxl.fType)<10)");
  ev->SetAlias("fpix","Sum$(abs(pxl.fType)>10)");
  ev->SetAlias("nvtx","PrimaryVertexes.Entries()");
  ev->SetAlias("vtx","PrimaryVertexes.fArray");
  ev->SetAlias("avtx","Pixel3Vertexes.fArray");
  ev->SetAlias("tvtx","TrackletVertexes.fArray");
  ev->SetAlias("ntrk","Tracks.Entries()");
  ev->SetAlias("ngoodtrk","Sum$(Tracks.fArray.NHits()>9)");
  //ev->SetAlias("ngoodtrk","Sum$(Tracks.fArray.NHits()>3 && abs(Tracks.fArray.D0())<0.5)");

  ev->SetAlias("parasite","((bunch>=1830 && bunch<=1833) || bunch==3170)");
  ev->SetAlias("collision","(bunch==51 || bunch==2724)");

  // HLT bits
  ev->SetAlias("hlt","HLTBits.fMask");
  ev->SetAlias("hltBSC","hlt.TestBit(66)");     //HLT_MinBiasBSC
  ev->SetAlias("hltBSC_OR","hlt.TestBit(67)");  //HLT_MinBiasBSC_OR
  ev->SetAlias("hltBakBSC","hlt.TestBit(78)");  //HLT_BackwardBSC
  ev->SetAlias("hltForBSC","hlt.TestBit(79)");  //HLT_ForwardBSC
  ev->SetAlias("hltCSCHalo","hlt.TestBit(74)"); //HLT_CSCBeamHalo
  ev->SetAlias("hltPix1","hlt.TestBit(71)");    //HLT_MinBiasPixel_SingleTrack
  ev->SetAlias("hltPix2","hlt.TestBit(72)");    //HLT_MinBiasPixel_DoubleTrack
  ev->SetAlias("hltEG1","hlt.TestBit(64)");

  // l1 technical bits:  https://twiki.cern.ch/twiki/bin/viewauth/CMS/GlobalTriggerMenu_L1Menu_Commissioning2009_v8
  ev->SetAlias("l1t","L1TechBitsBeforeMask.fMask");
  ev->SetAlias("l1t32","l1t.TestBit(32)"); // th1 (inner)
  ev->SetAlias("l1t34","l1t.TestBit(34)"); // OR
  ev->SetAlias("l1t40","l1t.TestBit(40)"); // th1 (all)
  ev->SetAlias("l1t41","l1t.TestBit(41)"); // th2
  ev->SetAlias("l1t36","l1t.TestBit(36)"); // halo bits 36-39
  ev->SetAlias("l1t37","l1t.TestBit(37)"); // 
  ev->SetAlias("l1t38","l1t.TestBit(38)"); // 
  ev->SetAlias("l1t39","l1t.TestBit(39)"); // 
  ev->SetAlias("l1t35","l1t.TestBit(35)"); // high mult
  ev->SetAlias("l1t0","l1t.TestBit(0)");   // BPTX AND
  ev->SetAlias("l1t4","l1t.TestBit(4)");   // BPTX AND (instance 1)
  ev->SetAlias("l1a","L1AlgoBitsBeforeMask.fMask");
  ev->SetAlias("l1a45","l1a.TestBit(45)");

  ev->SetAlias("noHalo","(!l1t36 && !l1t37 && !l1t38 && !l1t39)");

  // bx info
  ev->SetAlias("bx","L1TechBitsBxs.fArray.fBx");
  ev->SetAlias("l1tbx","L1TechBitsBxs.fArray.fMask");
  ev->SetAlias("l1t0bx","l1tbx.TestBit(0)");   // BPTX AND
  ev->SetAlias("l1t4bx","l1tbx.TestBit(4)");   // prescaled (12x) BPTX AND
  ev->SetAlias("l1t34bx","l1tbx.TestBit(34)"); // BSC OR
  ev->SetAlias("l1t40bx","l1tbx.TestBit(40)"); // BSC coincidence threshold 1
  ev->SetAlias("l1t42bx","l1tbx.TestBit(42)"); // BSC splash beam 1
  ev->SetAlias("l1t43bx","l1tbx.TestBit(43)"); // BSC splash beam 2
  ev->SetAlias("l1t32bx","l1tbx.TestBit(32)"); // BSC coincidence inner threshold 1

  // krisztian's 28 events with good agglomerative pixel vertex
  ev->SetAlias("kk1","Entry$==4 || Entry$==5 || Entry$==12 || Entry$==25 || Entry$==28 || Entry$==46 || Entry$==55 || Entry$==77 || Entry$==86 || Entry$==102");
  ev->SetAlias("kk2","Entry$==116 || Entry$==126 || Entry$==138 || Entry$==144 || Entry$==168 || Entry$==187 || Entry$==188 || Entry$==189 || Entry$==195 || Entry$==199");
  ev->SetAlias("kk3","Entry$==200 || Entry$==226 || Entry$==230 || Entry$==244 || Entry$==247 || Entry$==254 || Entry$==258 || Entry$==261");

  // events that are 75ns apart
  ev->SetAlias("ev1","evtno==2265620 || evtno==2265621");
  ev->SetAlias("ev2","evtno==2991369 || evtno==2991370");

  // pixel hit positions
  ev->SetAlias("layer","pxl.fType");
  ev->SetAlias("x","pxl.X()");
  ev->SetAlias("y","pxl.Y()");
  ev->SetAlias("z","pxl.Z()");
  ev->SetAlias("phi","atan(y/x)");
  ev->SetAlias("rho","sqrt(x*x+y*y)*sign(y)");
  ev->SetAlias("fpixPLUS","Sum$(pxl.fType>10 )");
  ev->SetAlias("fpixMINUS","Sum$(pxl.fType<-10)");

  // CaloTowers
  ev->SetAlias("ct","CaloTowers.fArray");
  ev->SetAlias("cr","1100*abs(tan(ct.Theta()))");
  ev->SetAlias("cx","cr*cos(ct.Phi())");
  ev->SetAlias("cy","cr*sin(ct.Phi())");
  ev->SetAlias("HFneg","Sum$(ct.E()*(ct.Eta()<-3))");
  ev->SetAlias("HFpos","Sum$(ct.E()*(ct.Eta()>3))");
  ev->SetAlias("Eneg","Sum$(ct.E()*(ct.Eta()<0))");
  ev->SetAlias("Epos","Sum$(ct.E()*(ct.Eta()>0))");
  ev->SetAlias("HfPos","ct.Eta()>3 && ct.E()>3");
  ev->SetAlias("HfNeg","ct.Eta()<3 && ct.E()>3");
  ev->SetAlias("HfAll","abs(ct.Eta())>3 && ct.E()>3");
  
  // diffrative vars
  ev->SetAlias("ctEp","ct.E()*cos(ct.Theta())");
  ev->SetAlias("ctEsubEp","ct.E()-ctEp");
  ev->SetAlias("ctEaddEp","ct.E()+ctEp");
  ev->SetAlias("ctSumEsubEp","Sum$(ctEsubEp)");
  ev->SetAlias("ctSumEaddEp","Sum$(ctEsubEp)");
  // Christof's tips
  ev->SetAlias("Epzn","Sum$((ct.E()-ct.Mom().Pz())*(ct.E()>3&&ct.Eta()<-3))");
  ev->SetAlias("Epzp","Sum$((ct.E()+ct.Mom().Pz())*(ct.E()>3&&ct.Eta()>3))");
  ev->SetAlias("hltHF3","hlt.TestBit(106)");
  ev->SetAlias("hltTrk1","hlt.TestBit(73)");
  ev.Draw("ct.E()-ct.Mom().Pz()","hltTrk1&&l1t34");
  ev.Draw("Epzn:Epzp","hltTrk1&&l1t34","box");

  // MC event info
  ev->SetAlias("pid","MCEventInfo.fProcessId");
  ev->SetAlias("ND","pid==11 || pid==12 || pid==13 || pid==28 || pid==53 || pid==68 || pid==95");
  ev->SetAlias("SD","pid==92 || pid==93");
  ev->SetAlias("DD","pid==94");
  ev->SetAlias("NSD","pid!=92 && pid!=93");
  ev->SetAlias("inelastic","ND || DD || SD");
  ev->SetAlias("elastic","!(inelastic)");

  // Event selection
  ev->SetAlias("qual","EvtSelData.fClusVtxQual");
  ev->SetAlias("qualDiff","EvtSelData.fClusVtxDiff");
  ev->SetAlias("tHFpos","EvtSelData.fHfPosTime");
  ev->SetAlias("tHFneg","EvtSelData.fHfNegTime");
  ev->SetAlias("eHFpos","EvtSelData.fHfPos");
  ev->SetAlias("eHFneg","EvtSelData.fHfNeg");

  // beamspot------------------
  //ev->Draw("vtx.Y():vtx.X()>>h(50,-0.5,0.5,50,-0.5,0.5)","l1t40 && vtx.fZErr<3 && run==123592","colz");
  //ev->Draw("vtx.Z()>>h(50,-20,20)","l1t40 && vtx.fZErr<3 && run==123592");
  

  // print events-------------------------------------
  //ev->Scan("evtno:npix:hltBSC:hltBakBSC:hltForBSC","(kk1 || kk2 || kk3)");
  //ev->Scan("evtno:l1t40:l1t41","l1t40");
  //ev->Scan("evtno:bunch:bx:l1t0bx:l1t40bx:l1t43bx:l1t32bx","evtno==2265620 || evtno==2265621 || evtno==2991369 || evtno==2991370");
  //ev->Scan("EventHeader.fTimeStamp-54100060637e8","ev1");
  //ev->Scan("EventHeader.fBunchCrossing","ev1");


  //ev->Scan("evtno:ct.Eta():ct.Phi():ct.E():ct.Theta():cy:cx","abs(ct.Eta())>3 && evtno==1903639 && ct.E()>3");

  // draw hits throughout detector in a single event --------------------------------------
  // big events in run 123151: 2529237, 3177667, 1903639, 2449816, 1259548
  
  /*

  Int_t run=123592;
  Int_t evt=532528; //1712524, 105574, 532528, 632862

  TCanvas *c1 = new TCanvas("c1","c1",1200,300);
  c1->Divide(5,1);
  c1->cd(1);
  TH2F *dum1 = new TH2F("dum1",Form("Run %d Event %d HF-;x [cm]; y [cm]",run,evt),10,-150,150,10,-150,150);
  dum1->Draw();
  ev->Draw("cy:cx>>h1(20,-150,150,20,-150,150)",Form("ct.Eta()<3 && evtno==%d && ct.E()>1 && abs(cx)<100 && abs(cy)<100",evt),"goff");
  h1->Draw("same colz");
  c1->cd(2);
  TH2F *dum2 = new TH2F("dum2",Form("Run %d Event %d PXF-;x [cm]; y [cm]",run,evt),30,-15,15,30,-15,15);
  dum2->Draw();
  ev->Draw("y:x>>h2a(1000,-10,10,1000,-10,10)",Form("layer==-11 && evtno==%d",evt),"goff");
  h2a->SetMarkerColor(2); h2a->SetMarkerStyle(6);
  h2a->Draw("same");
  ev->Draw("y:x>>h2b(1000,-10,10,1000,-10,10)",Form("layer==-12 && evtno==%d",evt),"goff");
  h2b->SetMarkerColor(4); h2b->SetMarkerStyle(6);
  h2b->Draw("same");
  c1->cd(3);
  TH2F *dum3 = new TH2F("dum3",Form("Run %d Event %d PXB;x [cm]; y [cm]",run,evt),30,-15,15,30,-15,15);
  dum3->Draw();
  ev->Draw("y:x>>h3(1000,-10,10,1000,-10,10)",Form("abs(layer)<10 && evtno==%d",evt),"goff");
  h3->SetMarkerColor(4); h3->SetMarkerStyle(6);
  h3->Draw("same");
  c1->cd(4);
  TH2F *dum4 = new TH2F("dum4",Form("Run %d Event %d PXF+;x [cm]; y [cm]",run,evt),30,-15,15,30,-15,15);
  dum4->Draw();
  ev->Draw("y:x>>h4a(1000,-10,10,1000,-10,10)",Form("layer==11 && evtno==%d",evt),"goff");
  h4a->SetMarkerColor(2); h4a->SetMarkerStyle(6);
  h4a->Draw("same");
  ev->Draw("y:x>>h4b(1000,-10,10,1000,-10,10)",Form("layer==12 && evtno==%d",evt),"goff");
  h4b->SetMarkerColor(4); h4b->SetMarkerStyle(6);
  h4b->Draw("same");
  c1->cd(5);
  TH2F *dum5 = new TH2F("dum5",Form("Run %d Event %d HF+;x [cm]; y [cm]",run,evt),10,-150,150,10,-150,150);
  dum5->Draw();
  ev->Draw("cy:cx>>h5(20,-150,150,20,-150,150)","ct.Eta()>3 && evtno==1903639 && ct.E()>1 && abs(cx)<100 && abs(cy)<100","goff");
  h5->Draw("same colz");
  
  */
  
  Double_t x[5] = {130,25,25,95,200};
  Double_t y[5] = {200,95,25,25,130};
  TPolyLine *pline = new TPolyLine(5,x,y);
  pline->SetLineColor(2);
  pline->SetLineWidth(2);

  //ev->SetAlias("cuts","Eneg>25 && Epos>25 && abs(Epos-Eneg)<70");
  //ev->SetAlias("cuts","npix>0");
  //ev->SetAlias("cuts","noHalo && !parasite");
  
  /*
  TCanvas *c1 = new TCanvas("c1","c1",800,800);
  c1->Divide(2,2);
  c1->cd(1);
  ev->Draw("Eneg/Epos:npix>>hHF1(25,0,600,25,0,6)","SD","goff");
  hHF1->Draw("colz");
  //pline->Draw("same");
  c1->cd(2);
  ev->Draw("Eneg/Epos:npix>>hHF2(25,0,600,25,0,6)","DD","goff");
  hHF2->Draw("colz"); 
  //pline->Draw("same"); 
  c1->cd(3);
  ev->Draw("Eneg/Epos:npix>>hHF3(25,0,600,25,0,6)","ND","goff");
  hHF3->Draw("colz"); 
  //pline->Draw("same"); 
  c1->cd(4);
  ev->Draw("Eneg/Epos:npix>>hHF4(25,0,600,25,0,6)","NSD","goff");
  hHF4->Draw("colz");
  //pline->Draw("same");
  */

  //ev->Draw("Eneg/Epos:npix>>h(25,0,600,25,0,6)","l1t40 && l1t0 && noHalo && !parasite","colz");

  //ev->Scan("Eneg:Epos:evtno:npix:bunch:parasite:noHalo:l1t0","abs(Epos-Eneg)>250 && npix>100 && !parasite");
  //ev->Draw("Eneg:Epos>>hHF(25,0,400,25,0,400)","l1t40 && run==123592 && noHalo","colz");

  //ev->Draw("(Epos-Eneg)/(Epos+Eneg):npix","collision && noHalo && l1t0 && l1t40","colz");

  
  //ev->Draw("l1t34>>h(2,-0.5,1.5)","l1a45 && run==123592");
  //ev->Draw("l1a45>>h2(2,-0.5,1.5)","l1t34 && run==123592","l text");


  //ev->Draw("(noHalo && l1t0):parasite>>hEvtSel(2,-0.5,1.5,2,-0.5,1.5)","run==123592 && l1t40","goff");
  //hEvtSel->SetTitle(";parasitic bunch crossings;BPTX coincidence AND NOT BSC halo");
  //hEvtSel->Draw("colz text");

  //pline->Draw("same");


  //------L1

  //ev->Draw("l1t40:l1t0","","colz text");
   
  //ev->Draw("qual:bpix>>h(50,0,2000,50,0,10)","qual<10  && l1t34","colz");
  //ev->Draw("tHFpos:tHFneg>>h2(50,-20,60,50,-20,60","l1t34 && min(eHFpos,eHFneg)>25","colz");
  //ev->Draw("log10(eHFpos):log10(eHFneg)>>h3(50,-1,3,50,-1,3)","l1t34 && eHFpos!=0 && eHFneg!=0 && abs(tHFpos-21)<10 && abs(tHFneg-21)<10","colz");
  //ev->Draw("min(tHFneg,tHFpos):min(eHFneg,eHFpos)>>h4(100,-20,100,100,-400,200)","l1t34 && (bpix/200*(qual-1))>1 && abs(tHFpos-21)<10 && abs(tHFneg-21)<10 && min(eHFpos,eHFneg)>0");



  //-------BSC efficiency (Johannes-style)
  /*
  //ev->Draw("qual:npix>>h(50,0,2000,50,0,10)","vtx.fNTracks>=5 && vtx.fZErr<3 && abs(vtx.Z())<10 && abs(vtx.X())<0.5 && abs(vtx.Y())<0.5 && l1t34","goff");
  ev->Draw("qual:npix>>h(50,0,2000,50,0,10)","vtx.fNTracks>=5 && vtx.fZErr<3 && abs(vtx.Z())<10 && abs(vtx.X())<0.5 && abs(vtx.Y())<0.5 && l1t41 && inelastic","goff");
  //h->SetTitle("Run 123596: Cluster shape compatibility with primary vertex; # of pixel hits; vertex uniqueness");
  h->SetTitle("PYTHIA inelastic: Cluster shape compatibility with primary vertex; # of pixel hits; vertex uniqueness");
  h->Draw("colz");
  */


  //------BSC efficiency (Ferenc-style)

  ev->SetAlias("edscut","(qual>(0.5+0.0045*npix) || npix<150)");
  
  /*
  ev->Draw("ngoodtrk>>h34(10,0,40)","l1t34 && Pixel3Vertexes.GetEntries()>0 && edscut","goff");
  TH1F *h34 = gDirectory->Get("h34");
  h34->Sumw2();
  ev->Draw("ngoodtrk>>h40(10,0,40)","l1t40 && Pixel3Vertexes.GetEntries()>0 && edscut","goff");
  TH1F *h40 = gDirectory->Get("h40");
  h40->Sumw2();
  ev->Draw("ngoodtrk>>h41(10,0,40)","l1t41 && Pixel3Vertexes.GetEntries()>0 && edscut","goff");
  TH1F *h41 = gDirectory->Get("h41");
  h41->Sumw2();
  
  TFile *f;
  if(type==0) f = new TFile("coll.root","RECREATE");
  else if(type==1) f = new TFile("empty.root","RECREATE");
  else if(type==2) f = new TFile("d6t.root","RECREATE");
  else if(type==3) f = new TFile("atlas.root","RECREATE");
  f->cd();
  h34->Write();
  h40->Write();
  h41->Write();
  f->ls();
  f->Close();
  */

  //---------------Monster Cut---------------------
  
  Double_t x[3] = {150,150,1000};
  Double_t y[3] = {0,0.5+0.0045*150,0.5+0.0045*1000};
  TPolyLine *pline = new TPolyLine(3,x,y);
  pline->SetLineColor(2);
  pline->SetLineWidth(2);
  
  if(type==0) { 
    ev->Draw("qual:EvtSelData.Npix()>>h0(50,0,1000,50,0,10)","l1t40","goff");
    h0->SetTitle("Run 123596 -- bit 34; # of pixel hits; cluster-vertex compatibility");
    h0->Draw("colz");
  }

  if(type==1) { 
    ev->Draw("qual:EvtSelData.Npix()>>h1(50,0,1000,50,0,10)","l1t34","goff");
    h1->SetTitle("Run 123596 (empty bunches)  -- bit 34; # of pixel hits; cluster-vertex compatibility");
    h1->Draw("colz");
  }

  if(type==2) { 
    ev->Draw("qual:EvtSelData.Npix()>>h2(50,0,1000,50,0,10)","l1t34 && NSD","goff");
    h2->SetTitle("PYTHIA D6T tune  -- bit 34; # of pixel hits; cluster-vertex compatibility");
    h2->Draw("colz");
  }

  if(type==3) { 
    ev->Draw("qual:EvtSelData.Npix()>>h3(50,0,1000,50,0,10)","l1t34 && NSD","goff");
    h3->SetTitle("PYTHIA ATLAS tune  -- bit 34; # of pixel hits; cluster-vertex compatibility");
    h3->Draw("colz");
  }
  
  pline->Draw("same");
  


  //ev->Draw("qualDiff:npix","l1t34 && npix<200","colz");
  //ev->Scan("qualDiff:npix:avtx.Z()","l1t40 && qual==0");
  //ev->Draw("qualDiff:npix>>h","l1t40 && Pixel3Vertexes.GetEntries()","goff");
  //h->Draw("colz");


  //ev->Draw("npix","l1t34 && Pixel3Vertexes.Entries()");

  //ev->Scan("evtno:avtx.fNTracks:avtx.Z()","l1t40");


  //ev->Draw("tHFpos:tHFneg","l1t34 && min(eHFpos,eHFneg)>25","colz");
  //ev->Draw("log10(eHFpos):log10(eHFneg)>>HF(50,-1,3,50,-1,3)","l1t34","colz");
  //ev->Draw("min(tHFneg,tHFpos):min(eHFneg,eHFpos)","l1t34");
  //ev->Draw("qual:bpix","qual<10 && bpix<1000 && l1t34");
  
  //ev->Scan("evtno","l1t41 && SD");

  //ev->Draw("Pixel3Vertexes.fNTracks>>h(80,-0.5,79.5)","l1t40 && Pixel3Vertexes.Entries()>0");
}
void TestH8500adapter()
{
	Th8500* pm = new Th8500(); //pm->Print();
	TConnectH8500	conn85;	 //conn85.Print(1,0,0);
	
	//TRANSLATION? NO
	//ROTATION? NO
	//pm->Rotate(180.0);
	
	
	Float_t Xcoordinates[64];
	Float_t Ycoordinates[64];
	
	int i;
	for (i=0; i<64; i++) {
		Xcoordinates[i]=0;
		Ycoordinates[i]=0;
	}
	
	for (i=0; i<64; i++) {
		Xcoordinates[i]=pm->GetX(i+1);
		Ycoordinates[i]=pm->GetY(i+1);
		//printf("anode %d : (%3.2lf,%3.2lf)\n",i+1,Xcoordinates[i],Ycoordinates[i]);
	}
	
	
	// Graphics
	
	Float_t A= 26.0*1.5; // mm
	Int_t D = 368; // size of the window in pixel
	Float_t B= .80;

	/* CANVAS 1 OUTLINE OF THE PM*/
	TCanvas*  mycanv = new TCanvas("mycanv","Outline of H8500",SCREEN_PIXX-D,0,D,D); 		
	mycanv->Range(-A,-A,A,A);
	
	TGaxis *axis1 = new TGaxis(-B*A,-B*A,-B*A,B*A,-A,A,510,"");
	axis1->SetName("axis1");
	axis1->Draw();
	axis1->SetTitle("[mm]");
	
	TGaxis *axis2 = new TGaxis(-B*A,-B*A,B*A,-B*A,-A,A,510,"");
	axis2->SetName("axis2");
	axis2->Draw();
	axis2->SetTitle("[mm]");
	

	Double_t x[5] = {pm->GetXVertex(0),pm->GetXVertex(1),pm->GetXVertex(2),pm->GetXVertex(3),pm->GetXVertex(0)};
	Double_t y[5] = {pm->GetYVertex(0),pm->GetYVertex(1),pm->GetYVertex(2),pm->GetYVertex(3),pm->GetYVertex(0)};
	
	Int_t linewidth	= 2;
	Int_t mycolor	= 2;

	TPolyLine *pline = new TPolyLine(5,x,y);
	pline->SetFillColor(38);
	pline->SetLineColor(mycolor);
	pline->SetLineWidth(linewidth);
	pline->Draw("");	
	
	Int_t anode1mark= 8;
	Int_t anodemark = 6;
	
	for (int k=1; k<65; k++) {// loop on anodes
		if (k==1) {
			mark1 = new TMarker((double)pm->GetX(k),(double)pm->GetY(k),anode1mark);
		}
		else {
			mark1 = new TMarker((double)pm->GetX(k),(double)pm->GetY(k),anodemark);
		}
		mark1->Draw("SAME");
	}
	
	
	/* CANVAS 2 - ANODES*/
	TCanvas*  mycanv2 = new TCanvas("mycanv2","ANODES",SCREEN_PIXX-D,D+20,D,D);
	mycanv2->Range(-A,-A,A,A);
	TH2F *h2 = new TH2F("h2","Hamamatsu View",100,-32,32,100,-32,32);
	for (i=0; i<64; i++) {//LOOP ON ANODES		
		// Hamamatsu View
		h2->Fill(Xcoordinates[i],Ycoordinates[i],i+1);
		//printf("%d: %d,%d \n",i,Xcoordinates[i],Ycoordinates[i]);
	}
	h2->Draw("text");
	h2->SetMarkerSize(2.2);
	h2->SetStats(0);
	
	TPolyLine *pline = new TPolyLine(5,x,y);
	pline->SetFillColor(38);
	pline->SetLineColor(mycolor);
	pline->SetLineWidth(linewidth);
	pline->Draw("same");

	
	
	
	//CANVAS 3 - MAROC
	TCanvas*  mycanv3 = new TCanvas("mycanv3","MAROC CHANNEL",SCREEN_PIXX-2*D,D+20,D,D);
	mycanv3->Range(-A,-A,A,A);
	TH2F *h3 = new TH2F("h3","Maroc View",100,-32,32,100,-32,32);
	for (i=0; i<64; i++) {//LOOP ON ANODES		
		// Maroc View 
		h3->Fill(Xcoordinates[i],Ycoordinates[i],conn85.GetMaroc(i+1));
		//printf("%d: %d,%d \n",i,Xcoordinates[i],Ycoordinates[i]);
	}
	h3->Draw("text"); // DO NOT PRINT ZERO!!! WHY?	
	h3->SetMarkerSize(2.2);
	h3->SetStats(0);
	
	TPolyLine *pline = new TPolyLine(5,x,y);
	pline->SetFillColor(38);
	pline->SetLineColor(mycolor);
	pline->SetLineWidth(linewidth);
	pline->Draw("same");

	
	//CANVAS 4 - PIN of the Adapter Board
	TCanvas*  mycanv4 = new TCanvas("mycanv4","Adapter PIN",SCREEN_PIXX-2*D,0,D,D);
	mycanv4->Range(-A,-A,A,A);
	TH2F *h4 = new TH2F("h3","Samtec View",100,-32,32,100,-32,32);
	for (i=0; i<64; i++) {//LOOP ON ANODES		
		// Samtec View
		h4->Fill(Xcoordinates[i],Ycoordinates[i],conn85.GetPinfromAnode(i+1));
	}
	h4->Draw("text"); // DO NOT PRINT ZERO!!! WHY?	
	h4->SetMarkerSize(2.2);
	h4->SetStats(0);
	
	TPolyLine *pline = new TPolyLine(5,x,y);
	pline->SetFillColor(38);
	pline->SetLineColor(mycolor);
	pline->SetLineWidth(linewidth);
	pline->Draw("same");
	
	//h2->Print();
	
	
		

	delete pm;
}