Example #1
0
void Drawbbcntrk(){
	TFile *f = new TFile("merged.root");
	TCanvas *c1;
	TCanvas *c2;
	TLegend *leg = new TLegend(0.5,0.7,0.7,0.85);
	leg->SetBorderSize(0);
	leg->SetFillColor(0);
	leg->SetTextSize(0.048);
	TH2F* bbcsntrk = (TH2F*)f->Get(Form("bbcsntrk_0"));
	TH2F* bbcnntrk = (TH2F*)f->Get(Form("bbcnntrk_0"));
	for(int xcent=1; xcent < 6; xcent++){
		TH2F* bbcsntrkdis_t = (TH2F*)f->Get(Form("bbcsntrk_%d",xcent));
		bbcsntrk->Add(bbcsntrkdis_t);
		TH2F* bbcnntrkdis_t = (TH2F*)f->Get(Form("bbcnntrk_%d",xcent));
		bbcnntrk->Add(bbcnntrkdis_t);
	}
	c1= new TCanvas();
	c1->cd();
	c1->SetLogz();
	SetTitle(*bbcsntrk,"bbc charge south","N_{trk}","");
	SetRange(*bbcsntrk,0,0,100,15);
	bbcsntrk->Draw("colz");
	c1->Print(Form("bbcsntrk.png"));
	c2= new TCanvas();
	c2->cd();
	c2->SetLogz();
	SetTitle(*bbcnntrk,"bbc charge north","N_{trk}","");
	SetRange(*bbcnntrk,0,0,100,15);
	bbcnntrk->Draw("colz");
	c2->Print("bbcnntrk.png");
}
Example #2
0
void quickWorldModelTest() {
    gSystem->Load("lib/libPropagation.so");
//    BedmapTable *iceTable = new BedmapTable (RyansCons::kBathymetry);
    WorldModel *myWorld = new WorldModel();
    TH2F *iceHist = new TH2F("iceHist","Ice Thickness",1000,-3e6,3e6,1000,-3e6,3e6);
    TH2F *iceHist2 = new TH2F("iceHist2","Ice Thickness (Bedmap)",1000,-3e6,3e6,1000,-3e6,3e6);
    TH2F *surfaceHist = new TH2F("surfaceHist","Surface",1000,-3e6,3e6,1000,-3e6,3e6);
//    int goodFlag;
    for(int binx=1;binx<=iceHist->GetNbinsX();binx++) {
	Double_t x=iceHist->GetXaxis()->GetBinCenter(binx);
	for(int biny=1;biny<=iceHist->GetNbinsY();biny++) {
	    Double_t y=iceHist->GetYaxis()->GetBinCenter(biny);
	    Double_t value=myWorld->getCrust2Data(x,y,RyansCons::kThicknessOfIce);
	    iceHist->SetBinContent(binx,biny,value);
	    value=myWorld->getIceThickness(x,y);
	    iceHist2->SetBinContent(binx,biny,value);
	    value=myWorld->getSurface(x,y);
	    surfaceHist->SetBinContent(binx,biny,value/1e6);
	    if(value>1e7 || value<1e6) cout << x << "\t" << y << "\t" << value << endl;
	}
    }
    TCanvas *can = new TCanvas("can","can");
    can->Divide(1,2);
    can->cd(1);
    iceHist->Draw("colz");
    can->cd(2);
    iceHist2->Draw("colz");
	
    TCanvas *can2 = new TCanvas("can2","can2");
    surfaceHist->Draw("colz");
    
}
Example #3
0
void Apertures::PlotFrame(double xmin,double xmax,double ymin,double ymax)
{
  Int_t wtopx=500,wtopy=60; // hbu position on screen, a bit shifted to right
  // unsigned int kSizePt=700;
  unsigned int kSizePt=1000; // size in points   here used for both directions, to get square
  c2=new TCanvas("c2","PlotFrame",wtopx,wtopy,kSizePt,kSizePt); // kSizePt set in rootlogon.C

  Float_t xsize=20,ysize=20;	// standard 20 cm * 20 cm window
  c2->Size(xsize,ysize); // set size for Postscript

  gStyle->SetLabelSize(k12pt,"xyz");  // axis numbers text size

  // keep the frame boundaries for possible later use
  this->xmin=xmin;
  this->xmax=xmax;
  this->ymin=ymin;
  this->ymax=ymax;

  if(verbose>1) cout << "Apertures::Plot_tfs" << '\n';
  double xrange=500;
  TH2F* hpx = new TH2F("s","",10,xmin,xmax,10,ymin,ymax);
  hpx->SetStats(kFALSE); // no statistics
  hpx->GetXaxis()->SetTitleOffset(1.3); // more space between numbers and x-axis title
  hpx->GetYaxis()->SetTitleOffset(1.3); // more space between numbers and y-axis title
  hpx->GetXaxis()->SetTitle("z[m]");
  hpx->GetYaxis()->SetTitle("x,y[m]");  hpx->Draw(); // after this hpx not needed any more
  hpx->Draw();

  TLine* ZeroYLine=new TLine(-xrange,0,xrange,0); ZeroYLine->Draw(); // draw a horizontal line a y = 0
  TLine* ZeroXLine=new TLine(0,-0.01,0,0.01);     ZeroXLine->Draw(); // draw a vertical   line a x = 0
}
Example #4
0
File: Draw.C Project: XuQiao/HI
void Draw(){
    gStyle->SetOptStat(kFALSE);
    TFile *f = TFile::Open(Form("Anav3_merged.root"));
    int xbin=0;
    TH2F* hr = (TH2F*)f->Get(Form("D_%d/hr",xbin));
    TH2F* s = (TH2F*)f->Get(Form("D_%d/s",xbin));
    TH2F* b = (TH2F*)f->Get(Form("D_%d/b",xbin));
    TVectorD* vavgtrk = (TVectorD*)f->Get(Form("avgtrk"));
    hr->SetTitle("");
    hr->GetXaxis()->SetRangeUser(-4,4);
    hr->GetYaxis()->SetRangeUser(-1.5,4);
 //   hr->GetZaxis()->SetRangeUser(0,3e6);
    hr->GetXaxis()->SetTitle("#Delta#eta");
    hr->GetXaxis()->CenterTitle();
    hr->GetYaxis()->SetTitle("#Delta#phi");
    hr->GetYaxis()->CenterTitle();
    hr->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N^{pair}}{d#Delta#eta d#Delta#phi}");
    TCanvas *c1 = new TCanvas();
    hr->Draw("surf1");
    TLatex l;
    l.SetNDC();
    l.SetTextSize(0.04);
    l.DrawLatex(0.1,0.9,Form("%d < N_{trk}^{offline} <%d",trkbin[xbin],trkbin[xbin+1]));
    l.DrawLatex(0.5,0.9,Form("Average N_{trk}^{offline} = %.1f",(*vavgtrk)[xbin]));
    l.DrawLatex(0.1,0.85,Form("%.1f < p_{T}^{trig} < %.1f",pttrigmin,pttrigmax));
    l.DrawLatex(0.5,0.85,Form("%.1f < #eta^{trig} < %.1f",etatrigmin,etatrigmax));
    l.DrawLatex(0.1,0.80,Form("%.1f < p_{T}^{ass} < %.1f",ptassmin,ptassmax));
    l.DrawLatex(0.5,0.80,Form("%.1f < #eta^{ass} < %.1f",etaassmin,etaassmax));
    c1->Print("ridgev3.png");
    TCanvas *c2 = new TCanvas();
    s->SetTitle("");
    s->GetXaxis()->SetRangeUser(-4,4);
    s->GetYaxis()->SetRangeUser(-1.5,4);
  //  s->GetZaxis()->SetRangeUser(0,3e6);
    s->GetXaxis()->SetTitle("#Delta#eta");
    s->GetXaxis()->CenterTitle();
    s->GetYaxis()->SetTitle("#Delta#phi");
    s->GetYaxis()->CenterTitle();
    s->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N^{pair}}{d#Delta#eta d#Delta#phi}");
    s->Draw("surf1");
    l.DrawLatex(0.5,0.80,Form("signal"));
    c2->Print("signal_v3.png");
    TCanvas *c3 = new TCanvas();
    b->SetTitle("");
    b->GetXaxis()->SetRangeUser(-4,4);
    b->GetYaxis()->SetRangeUser(-1.5,4);
  //  b->GetZaxis()->SetRangeUser(0,3e9);
    b->GetXaxis()->SetTitle("#Delta#eta");
    b->GetXaxis()->CenterTitle();
    b->GetYaxis()->SetTitle("#Delta#phi");
    b->GetYaxis()->CenterTitle();
    b->GetZaxis()->SetTitle("#frac{1}{N_{trig}}#frac{d^{2}N^{pair}}{d#Delta#eta d#Delta#phi}");
    b->Draw("surf1");
    l.DrawLatex(0.5,0.80,Form("background"));
    c3->Print("background_v3.png");
}
void testMVATrainerAnalysis()
{
	using namespace PhysicsTools;

	setStyle();

	MVAComputer mva("testMVAComputerEvaluate.mva");

	Variable::Value values[3];
	values[0].setName("x");
	values[1].setName("y");

	TH2F *f = new TH2F("discr", "Discriminator", 200, -10, 10, 200, -10, 10);
	f->SetXTitle("x");
	f->SetYTitle("y");

	TH2F *g = new TH2F("dx", "dD/dx", 200, -10, 10, 200, -10, 10);
	g->SetXTitle("x");
	g->SetYTitle("y");

	TH2F *h = new TH2F("dy", "dD/dy", 200, -10, 10, 200, -10, 10);
	h->SetXTitle("x");
	h->SetYTitle("y");

	for(double x = -10 + 0.05; x < 10; x += 0.1)  {
		for(double y = -10 + 0.05; y < 10; y += 0.1) {
			values[0].setValue(x);
			values[1].setValue(y);
			double v = mva.deriv(values, values + 2);
			f->SetBinContent(f->FindBin(x, y), v);
			g->SetBinContent(g->FindBin(x, y), values[0].getValue());
			h->SetBinContent(h->FindBin(x, y), values[1].getValue());
		}
	}

	TCanvas *c1 = new TCanvas("c1");
	c1->Divide(2, 2);
	c1->cd(1);
	f->SetStats(0);
	f->SetContour(511);
	f->Draw("colz");
	c1->cd(3);
	g->SetStats(0);
	g->SetContour(511);
	g->Draw("colz");
	c1->cd(4);
	h->SetStats(0);
	h->SetContour(511);
	h->Draw("colz");
}
void display_magfield(){
    FILE *pFile = fopen("magfield.table", "r");
    // FILE *pFile = fopen(
    //     "../MUSIC-3D-filed-map/MUSIC-FILL-map1-X=+-2000-Y=0-1000-Z=-1000-5000.table", "r");
    
    TFile *outFile = new TFile("magfield.root", "RECREATE");
    TTree *outTree = new TTree("bfield", "bfield");
    
    bfield2d myfield;
    outTree->Branch("field", &myfield, "x/F:z:bx:bz");
    TH2F *bhist = new TH2F("Bfield", "Bfield", 200, -2000, 2000,
                                               300, -1000, 5000);
    
    float y, by, junk;
    char dat_format [] = "%f %f %f %e %e %e %e";
    char line [150];
    int linecount = 0;
    while (fgets(line, 150, pFile) != NULL)
    {
        ++ linecount;
        if (linecount < 10) continue;
        sscanf(line, dat_format, &myfield.x, &y, 
            &myfield.z, &myfield.bx, &by, &myfield.bz, &myfield.bmod);
        
        if (y < 5) continue; // take only the y = 0 slice
        outTree->Fill();
        bhist->Fill(myfield.x, myfield.z, myfield.bmod);
    }
    // bhist->Draw("SURF2");
    bhist->Draw("CONT1");
    
}
Example #7
0
void plotDeltaT()
{
  Double_t nTopOfIce=1.4;
  Double_t ant1[3]={8,-5,-25};
  Double_t ant2[3]={8,5,-30};
  Double_t rho1=TMath::Sqrt(ant1[0]*ant1[0]+ant1[1]*ant1[1]);
  Double_t rho2=TMath::Sqrt(ant2[0]*ant2[0]+ant2[1]*ant2[1]);
  Double_t phi1=TMath::ATan2(ant1[1],ant1[0]);
  Double_t phi2=TMath::ATan2(ant2[1],ant2[0]);
  std::cout << phi1*TMath::RadToDeg() << "\t" << phi2*TMath::RadToDeg() << "\n";
  TH2F *histDt = new TH2F("histDt","histDt",360,-180,180,180,-90,90);
  for(int binx=1;binx<=histDt->GetNbinsX();binx++) {
    Double_t phiWaveDeg=histDt->GetXaxis()->GetBinCenter(binx);
    for(int biny=1;biny<=histDt->GetNbinsY();biny++) {
      Double_t thetaWaveDeg=histDt->GetYaxis()->GetBinCenter(biny);
      Double_t phiWave=phiWaveDeg*TMath::DegToRad();
      Double_t thetaWave=thetaWaveDeg*TMath::DegToRad();
      
      Double_t d1=TMath::Cos(thetaWave)*(ant1[2]*TMath::Tan(thetaWave)+rho1*TMath::Cos(phi1-phiWave));
      Double_t d2=TMath::Cos(thetaWave)*(ant2[2]*TMath::Tan(thetaWave)+rho2*TMath::Cos(phi2-phiWave));
      Double_t t2t1=(d1-d2)*nTopOfIce/TMath::C();
      t2t1*=1e9;
      histDt->Fill(phiWaveDeg,thetaWaveDeg,t2t1);
    }
  }
  histDt->Draw("colz");

}
Example #8
0
void testContour()
{
  TFile *file = new TFile("T2tt___sigma_UL_bestexpected.root");
  TH2F  *h    = (TH2F*)file->Get("T2tt__expected_strength_UL");
  
  TGraph2D *tg2d = new TGraph2D(h); //Crea TGraph2D da TH2
  Double_t contours[1]; // Crea array con i valori dei contour che vuoi
  contours[0] = 1.0;
  tg2d->GetHistogram()->SetContour(1,contours);  //SetContour(numero contour,array contour)
  //tg2d->Draw("cont list"); //Dummy plotting, serve solo per creare la lista di contour
  TList *contLevel = tg2d->GetContourList(1.); // Prendi quello che ti interessa
  
  if(contLevel->GetSize()>0) doContour = true;
  cout<< doContour << endl;
  
  TCanvas *cSmoothed = new TCanvas("test","test",800,600); // Crea canvas
  cSmoothed->cd();
  //TH1F* hrl = cSmoothed->DrawFrame(0.1,0.,1.,0.5); // Commando fondamentale: ti setta il range del Pad, formato (x1,y1,x2,y2) dove (x1,y1) e (x2,y2) sono le coordinate estreme del tuo TH2
  
  h->Draw("colz same"); //prima fa il Draw() del TH2 (o TGraph2D)
  if (doContour){
    
    TIter next(contLevel);
    TObject *contour = 0;
    while (contour = next()){
      ((TGraph2D*)contour)->SetLineWidth(3);
      ((TGraph2D*)contour)->SetLineStyle(2);
      ((TGraph2D*)contour)->Draw("L"); // poi fa del TGraph del contour, ma senza l'opzione "A"
    }
  }
  //ROOT::gPad::RedrawAxis();
  cSmoothed->Update();                
  cSmoothed->SaveAs(".root");
}
void ECALEndcapCorrectionFactorCalculator()
{
    std::string detectorModel("90");
    std::string recoVar("71");

    TString rootFilesToCompare("/r04/lc/sg568/HCAL_Optimisation_Studies/Calibration/Detector_Model_" + detectorModel + "/Reco_Stage_" + recoVar + "/MuonCalibration/RootFiles/*Photon*.root");
    std::string resultsFileName("ECALEndcapCorrectionFactorCalculator_DetectorModel" + detectorModel + "_RecoStage" + recoVar + ".txt");

    std::ofstream resultsFile;
    resultsFile.open (resultsFileName.c_str());

    float ecalTotalCaloHitEnergy(-1.f);
    std::vector<float> *pPfoTargetCosTheta(NULL);

    TChain *pTChain = new TChain("PfoAnalysisTree");
    pTChain->Add(rootFilesToCompare);
    pTChain->SetBranchAddress("ECalTotalCaloHitEnergy",&ecalTotalCaloHitEnergy);
    pTChain->SetBranchAddress("pfoTargetCosTheta",&pPfoTargetCosTheta);

    TCanvas *pTCanvas = new TCanvas("PhotonDistPic", "PhotonDistPic");
    TH2F *pPhotonDist = new TH2F("PhotonDist","PhotonDist",100,0,1,150,0,15);
    pPhotonDist->GetXaxis()->SetTitle("abs( cos (#theta_{#gamma}) )");
    pPhotonDist->GetYaxis()->SetTitle("ECal Calo Hit Energy [GeV]");

    for (int entry = 0; entry < pTChain->GetEntries(); entry++)
    {
//        std::cout << "Reading entry " << entry << std::endl;
        pTChain->GetEvent(entry);

        if (!pPfoTargetCosTheta->empty())
        {
//            std::cout << "Target cos theta : " << pPfoTargetCosTheta.at(0) << std::endl;
            pPhotonDist->Fill(TMath::Abs(pPfoTargetCosTheta->at(0)),ecalTotalCaloHitEnergy);
        }
    }

    TF1 *barrelFit = new TF1("BarrelFit","[0]",0.1,0.7);
    barrelFit->SetLineColor(kGray);
    barrelFit->SetLineWidth(4);

    TF1 *endcapFit = new TF1("EndcapFit","[0]",0.85,0.95);
    endcapFit->SetLineColor(kGray);
    endcapFit->SetLineWidth(4);

    pTCanvas->cd();
    pPhotonDist->Draw("COLZ");

    pPhotonDist->Fit(barrelFit,"QR+");
    pPhotonDist->Fit(endcapFit,"QR+");

    resultsFile << "For the barrel the best fit is : " << barrelFit->GetParameter(0) << std::endl;
    resultsFile << "For the endcap the best fit is : " << endcapFit->GetParameter(0) << std::endl;
    resultsFile << "ECALEndcapCorrectionFactorCalculator -> " << (barrelFit->GetParameter(0))/(endcapFit->GetParameter(0)) << std::endl;
    resultsFile.close();

    TString picName = "ECALEndcapCorrectionFactorCalculator_DetectorModel" + detectorModel + "_RecoStage" + recoVar + ".pdf";
    pTCanvas->SaveAs(picName);   
}
Example #10
0
TCanvas *PlotDataMC2D(TChain *data, TChain *mc, TString branchname, TString binning, 
		      TCut selection, 
		      TString dataLabel, TString mcLabel, 
		      TString xLabel, TString yLabel, 
		      int type=2, TString opt="colz", bool usePU=true, bool smear=false, bool scale=false){
  //type == 0: data only
  //type == 1: MC only
  //type == 2: data/MC
   
  TCanvas *c = new TCanvas("c","");
  TString weightVar;
  if(branchname.Contains("map")){
    weightVar=branchname.ReplaceAll("_map","").ReplaceAll("map","");
    branchname="seedXSCEle:seedYSCEle";
    binning="(361,-0.5,360.5,171,-85.5,85.5)";
    yLabel="iEta";
    xLabel="iPhi";
    c->SetGridx();
  }
  if(weightVar!="") selection+="*"+weightVar;
  data->Draw(branchname+">>data_hist"+binning, selection,opt);
  if(usePU)  mc->Draw(branchname+">>mc_hist"+binning, selection *"puWeight",opt);
  else  mc->Draw(branchname+">>mc_hist"+binning, selection,opt);

  c->Clear();
  
  TH2F *d = (TH2F *) gROOT->FindObject("data_hist");
  TH2F *s = (TH2F *) gROOT->FindObject("mc_hist");

  if(type==0) d->Draw(opt);
  else if(type==1) s->Draw(opt);
  else if(type==3){
    s->Scale(d->Integral()/s->Integral());
    d->Divide(s);
    d->Draw(opt);
  }

  d->GetXaxis()->SetTitle(xLabel);
  s->GetXaxis()->SetTitle(xLabel);
  d->GetYaxis()->SetTitle(yLabel);
  s->GetYaxis()->SetTitle(yLabel);
  c->SetRightMargin(0.2);
  return c;
  
}
Example #11
0
TCanvas *earth(){
  //this tutorial illustrate the special contour options
  //    "AITOFF"     : Draw a contour via an AITOFF projection
  //    "MERCATOR"   : Draw a contour via an Mercator projection
  //    "SINUSOIDAL" : Draw a contour via an Sinusoidal projection
  //    "PARABOLIC"  : Draw a contour via an Parabolic projection
  //
  //Author: Olivier Couet (from an original macro sent by Ernst-Jan Buis)

   gStyle->SetPalette(57);
   gStyle->SetOptTitle(1);
   gStyle->SetOptStat(0);

   TCanvas *c1 = new TCanvas("c1","earth_projections",700,700);
   c1->Divide(2,2);

   TH2F *ha = new TH2F("ha","Aitoff",    180, -180, 180, 179, -89.5, 89.5);
   TH2F *hm = new TH2F("hm","Mercator",  180, -180, 180, 161, -80.5, 80.5);
   TH2F *hs = new TH2F("hs","Sinusoidal",180, -180, 180, 181, -90.5, 90.5);
   TH2F *hp = new TH2F("hp","Parabolic", 180, -180, 180, 181, -90.5, 90.5);

   TString dat = gSystem->UnixPathName(__FILE__);
   dat.ReplaceAll("C","dat");
   dat.ReplaceAll("/./","/");

   ifstream in;
   in.open(dat.Data());
   Float_t x,y;
   while (1) {
     in >> x >> y;
     if (!in.good()) break;
     ha->Fill(x,y, 1);
     hm->Fill(x,y, 1);
     hs->Fill(x,y, 1);
     hp->Fill(x,y, 1);
   }
   in.close();

   c1->cd(1); ha->Draw("aitoff");
   c1->cd(2); hm->Draw("mercator");
   c1->cd(3); hs->Draw("sinusoidal");
   c1->cd(4); hp->Draw("parabolic");

   return c1;
}
void display_magfield(){
    // FILE *pFile = fopen("../../PION-DIPOLE-bfield/Dipole fring Bmap_XZ_X-2000-0_Z0-2000.table", "r");
    // FILE *pFile = fopen("../../PION-DIPOLE-bfield/Dipole Bmap_XZ_X0-220_Z0-500.table", "r");
    // FILE *pFile = fopen("../input/Bfield_roi.table", "r");
    FILE *pFile = fopen("../output/vec_field_out.table", "r");
    // FILE *pFile = fopen(
    //     "../../MUSIC-3D-filed-map/MUSIC-FILL-map1-X=+-2000-Y=0-1000-Z=-1000-5000.table", "r");
    
    TFile *outFile = new TFile("magfield.root", "RECREATE");
    TTree *outTree = new TTree("bfield", "bfield");
    
    bfield2d myfield;
    outTree->Branch("field", &myfield, "x/F:z:bx:bz");
    // TH2F *bhist = new TH2F("Bfield", "Bfield", 200, -2000, 2000,
    //                                            300, -1000, 5000);
    // TH2F *bhist = new TH2F("Bfield", "Bfield", 55, 500, 1600,
    //                                        55, 3080, 4180);
    TH2F *bhist = new TH2F("Bfield", "Bfield", 54, -540, 540,
                                           54, -540, 540);
    // TH2F *bhist = new TH2F("Bfield", "Bfield", 55, 460, 1560,
    //                                         54, 3240, 4320);
    
    // TH2F *bhist = new TH2F("Bfield", "Bfield", 54, -540, 540,
    //                                        54, -540, 540);
    float y, by, junk;
    char dat_format [] = "%f %f %f %e %e %e %e";
    char line [150];
    int linecount = 0;
    float max_bfield = 0;
    int test =0;
    while (fgets(line, 150, pFile) != NULL)
    {
        ++ linecount;
        // if (linecount < 10) continue;
        sscanf(line, dat_format, &myfield.x, &y, 
            &myfield.z, &myfield.bx, &by, &myfield.bz, &myfield.bmod);
        if (myfield.bmod > max_bfield) max_bfield = myfield.bmod;
        if (y > 15) continue; // take only the y = 0 slice
        ++test;
        outTree->Fill();
        bhist->Fill(myfield.x, myfield.z, myfield.bmod);
    }
    outFile->Write();
    // bhist->Draw("SURF2");
    bhist->SetTitle("Magnetic dipole fringe field");
    // bhist->SetTitle("Magnetic field in simulated region");
    // bhist->
    // bhist->Draw("CONT1");
    bhist->Draw("COLZ");
    cout << "Max magnetic field: "<<max_bfield << endl;
    cout << "Number of lines read in: "<<test << endl;
    cout << "REMEMBER: if using an 'output' file from the simulation - uncomment the ignore lines code"<<endl;
    
}
Example #13
0
void AliITSLegoPlot(Float_t nchtheta, Float_t nchphi, const char *inFile = "galice.root") {
// macro to visualize the lego plots generated by gAlive->RunLego
   
   gROOT->Reset();
   TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
   if (!file->IsOpen()) {
       cerr<<"Can't open "<<inFile<<" !" << endl;
       return 1;
   } // end if !file
    

   Float_t theta = 10;
   Float_t phi   = 170;
   Int_t ncont   = 50;

   TCanvas *cradl = new TCanvas("cradl","radl",10,10,800,600);
   cradl->SetTheta(theta);
   cradl->SetPhi(phi);
   TH2F *hradl = (TH2F*)file->Get("hradl");
   hradl->SetStats(kFALSE);
   hradl->GetXaxis()->SetTitle("Phi (degrees)");
   hradl->GetYaxis()->SetTitle("Theta (degrees)");
   hradl->SetFillColor(2);
   hradl->SetContour(ncont);
   hradl->Draw("colz");


   TCanvas *cradlx = new TCanvas("cradl1","radl",50,50,800,600);
   hradl->ProjectionX();
   hradl_px->SetStats(kFALSE);
//   hradl_px->SetOptLogY();
//   hradl_px->SetMinimum(0.001);   
//   hradl_px->SetMaximum(1);
   hradl_px->Scale(1./nchtheta);   
   hradl_px->GetXaxis()->SetTitle("Phi (degrees)");
   hradl_px->GetYaxis()->SetTitle("X/X0");
   hradl_px->Draw();
//   cout << "Average over Phi: " << hradl_px->GetSumOfWeights()/nchphi << " X/X0" << endl;
   
   
   TCanvas *cradly = new TCanvas("cradl2","radl",100,100,800,600);
   hradl->ProjectionY();
   hradl_py->SetStats(kFALSE);
//   hradl_py->SetOptLogY();
//   hradl_py->SetMinimum(0.001);   
//   hradl_py->SetMaximum(1);   
   hradl_py->Scale(1./nchphi);
   hradl_py->GetXaxis()->SetTitle("Theta (degrees)");
   hradl_py->GetYaxis()->SetTitle("X/X0");
   hradl_py->Draw();   
//   cout << "Average over Theta: " << hradl_py->GetSumOfWeights()/nchtheta << " X/X0" << endl;  
   cout << "Average: " << hradl_py->GetSumOfWeights()/nchtheta << " X/X0" << endl;     
}   
Example #14
0
File: lego.C Project: alisw/AliRoot
void lego() {
// macro to visualize the lego plots generated by gAlive->RunLego
   
   gROOT->Reset();
   TFile *file = new TFile("galice.root");

   Float_t theta = 10;
   Float_t phi   = 170;
   Int_t ncont   = 50;

   TCanvas *cgcm2 = new TCanvas("cgcm2","gcm2",200,100,600,400);
   cgcm2->SetTheta(theta);
   cgcm2->SetPhi(phi);
   TH2F *hgcm2 = (TH2F*)file->Get("hgcm2");
   hgcm2->SetFillColor(2);
   hgcm2->SetMaximum(1);
   hgcm2->SetContour(ncont);
   hgcm2->SetMaximum(50);
   hgcm2->Draw("lego2sphe");

   TCanvas *cabso = new TCanvas("cabso","abso",100,50,600,400);
   cabso->SetTheta(theta);
   cabso->SetPhi(phi);
   TH2F *habso = (TH2F*)file->Get("habso");
   habso->SetFillColor(2);
   habso->SetMaximum(1);
   habso->SetContour(ncont);
   habso->SetMaximum(1);
   habso->Draw("lego2sphe");

   TCanvas *cradl = new TCanvas("cradl","radl",10,10,600,400);
   cradl->SetTheta(theta);
   cradl->SetPhi(phi);
   TH2F *hradl = (TH2F*)file->Get("hradl");
   hradl->SetFillColor(2);
   hradl->SetMaximum(1);
   hradl->SetContour(ncont);
   hradl->SetMaximum(5);
   hradl->Draw("lego2sphe");
}   
Example #15
0
void Drawbbc(){
	TFile *f = new TFile("merged.root");
	TH1D* hbbcs;
	TH1D* hbbcn;
	TCanvas *c1;
	TCanvas *c2;
	TLegend *leg = new TLegend(0.5,0.7,0.7,0.85);
	leg->SetBorderSize(0);
	leg->SetFillColor(0);
	leg->SetTextSize(0.048);
	TH2F* bbcsbbcn = (TH2F*)f->Get(Form("bbcsbbcn_0"));
	for(int xcent=1; xcent < 6; xcent++){
		TH1F* bbcsbbcndis_t = (TH1F*)f->Get(Form("bbcsbbcn_%d",xcent));
		bbcsbbcn->Add(bbcsbbcndis_t);
	}
	hbbcs = (TH1D*)bbcsbbcn->ProjectionX("bbcs",0,-1);
	hbbcn = (TH1D*)bbcsbbcn->ProjectionY("bbcn",0,-1);
	hbbcs->Rebin(4);
	hbbcn->Rebin(4);
	c1= new TCanvas();
	c1->cd();
	c1->SetLogy();
	SetTitle(*hbbcs,"bbc charge","# of events","");
	SetRange(*hbbcs,0,1e-1,100,hbbcn->GetMaximum()*5);
	SetStyle(*hbbcs,1.2,1,20,0,0);
	SetStyle(*hbbcn,1.2,2,24,0,0);
	hbbcs->Draw("P");
	hbbcn->Draw("Psame");
	leg->AddEntry(hbbcs,"bbc south");
	leg->AddEntry(hbbcn,"bbc north");
	leg->Draw("same");
	c1->Print(Form("bbcdis.png"));
	c2= new TCanvas();
	c2->cd();
	c2->SetLogy();
	hbbcs_norm = (TH1D*)hbbcs->Clone("hbbcs_norm");
	hbbcn_norm = (TH1D*)hbbcn->Clone("hbbcn_norm");
	hbbcs_norm->Scale(1./hbbcs_norm->Integral());
	hbbcn_norm->Scale(1./hbbcn_norm->Integral());
	SetRange(*hbbcs_norm,0,1e-9,100,1);
	hbbcs_norm->Draw("P");
	hbbcn_norm->Draw("Psame");
	leg->Draw("same");
	c2->Print(Form("bbcdis_norm.png"));	
	c3= new TCanvas();
	c3->cd();
	c3->SetLogz();
	SetTitle(*bbcsbbcn,"bbc charge south","bbc charge north","# of events");
	SetRange(*bbcsbbcn,0,0,100,100);
	bbcsbbcn->Draw("colz");
	c3->Print("bbcsbbcn.png");
}
TGraph* ContourGraph( TH2F* hist,double xmin=16, double xmax=90) {

    //temporary canvas
    TCanvas* MOO = new TCanvas( TString::Format("dummy_canvas_%s", hist->GetName()), "A scan of m_{0} versus m_{12}", 0, 0, 650,640);
    MOO->cd();

    TGraph* gr0 = new TGraph();
    TH2F* h = (TH2F*)hist->Clone();
    TGraph* gr = (TGraph*)gr0->Clone(TString::Format("gr_%s", h->GetName()));

    cout << "==> Will dumb histogram: " << h->GetName() << " into a graph" <<endl;

    h->SetContour( 1 );
    //h->GetXaxis()->SetRangeUser(250,1200);
    h->GetXaxis()->SetRangeUser(xmin, xmax);
    //h->GetYaxis()->SetRangeUser(2,50);

    double pval = CombinationGlob::cl_percent[1];
    std::cout << pval << std::endl; 
    double signif = TMath::NormQuantile(1-pval);
    h->SetContourLevel( 0, signif );
    h->Draw("CONT LIST");
    h->SetDirectory(0);
    gPad->Update();

    TObjArray *contours = (TObjArray*) gROOT->GetListOfSpecials()->FindObject("contours");
    Int_t ncontours     = contours->GetSize();
    cout << "Found " << ncontours << " contours " << endl;

    TList *list = (TList*)contours->At(0);
    contours->Print("v");
    if(!list) return NULL;

    gr = (TGraph*)list->First();
    if(!gr) return NULL;

    gr->SetName(TString::Format("gr_%s", hist->GetName()));
    //gr->SetName(hist->GetName());
    int N = gr->GetN();
    double x0, y0;
    for(int j=0; j<N; j++) {
        gr->GetPoint(j,x0,y0);
        cout << j << " : " << x0 << " : "<<y0 << endl;
    }
    //  //  gr->SetMarkerSize(2.0);    
    //gr->Draw("ALP");

    delete MOO;

    cout << "Generated graph " << gr << " with name " << gr->GetName() << endl;
    return gr;
}
Example #17
0
void plotTrk() {
  gStyle->SetOptStat(0);
  gStyle->SetOptTitle(1);
  char c[50];
  c1->Clear();  
  c1->Divide(2,3); 
  for(int hid=0; hid<6; hid++){
    TVirtualPad* pad = c1->cd(hid+1); 
    pad->SetLogy(lTrkHist[hid]);
    double xmin, xmax, ymin=0.0, ymax=0.0;
    if(lTrkHist[hid]==1) ymin=0.1;
    for(int quad=0; quad<kFgtNumQuads; quad++){
      sprintf(c,"Quad%1s-%s",cquad[quad],cTrkHist[hid]);
      //printf("Getting %s\n",c);
      TH1F *h = histTrk[quad][hid] = (TH1F*)file->Get(c);
      xmin=h->GetXaxis()->GetXmin();
      xmax=h->GetXaxis()->GetXmax();
      double m=h->GetMaximum();
      if(ymax<m) ymax=m;
      //printf("quad=%d max=%6.1f ymax=%6.1f xmin=%6.1f xmax=%6.1f\n",quad,m,ymax,xmin,xmax);
    }
    ymax*=1.2; if(lTrkHist[hid]==1){ymax*=20.0;}
    sprintf(c,"%s",cTrkHist[hid]);
    TH2F *frame = new TH2F(c,c,1,xmin,xmax,1,ymin,ymax); frame->SetStats(0); frame->Draw();
    for(int quad=0; quad<kFgtNumQuads; quad++){
      TH1F *h=histTrk[quad][hid];
      h->SetLineColor(colorQuad[quad]); h->SetLineWidth(3); 
      if(hid<5){
	h->Draw("SAME");  
	float mean=h->GetMean();
	if(hid==1 || hid==4) {sprintf(c,"%s mean=%6.4f",cquad[quad],mean);}
	else                 {sprintf(c,"%s mean=%6.2f",cquad[quad],mean);}
      }else{
	h->SetMarkerColor(colorQuad[quad]); h->SetMarkerStyle(20); h->SetMarkerSize(1);
	h->Draw("SAME PL");
	sprintf(c,"Quad%s",cquad[quad]);
      }
      TText *t1;
      float x1= 0.2, x2= 0.55;
      float y1=0.8 - 0.07*quad;
      float y2=0.8 - 0.07*(quad-2);
      if(quad<2) { t1 = new TText(x1,y1,c); }
      else       { t1 = new TText(x2,y2,c); }
      t1->SetNDC();
      t1->SetTextSize(0.06); 
      t1->SetTextColor(colorQuad[quad]); 
      t1->Draw();
    }
  }
  c1->Update();
  save("trk");
}
void Q_test() {
    TFile *file = TFile::Open("msugra_0_10_P_SREtight_fixSigXSecNominal__1_harvest_list.root");  
    //  TFile *file = TFile::Open("combined_msugra_Nominal_1_harvest_list.root");  
    TH2F* hist =(TH2F*) file->Get("sigp1expclsf");
    //  hist->Draw("colz");  
    TH2F* contour = FixAndSetBorders( *hist, "test", "test", 0 );
    //TCanvas canvas = TCanvas();
    TCanvas canvas;
    contour->Draw("colz"); 
    TLegend* leg = new TLegend();
    DrawContourLine95( leg, contour, "", 1, 1 ); 
    canvas.Print("toto.gif");
}
Example #19
0
TCanvas *earth(){

   gStyle->SetPalette(1);
   gStyle->SetOptTitle(1);
   gStyle->SetOptStat(0);

   TCanvas *c1 = new TCanvas("c1","earth_projections",700,700);
   c1->Divide(2,2);

   TH2F *ha = new TH2F("ha","Aitoff",    180, -180, 180, 179, -89.5, 89.5);
   TH2F *hm = new TH2F("hm","Mercator",  180, -180, 180, 161, -80.5, 80.5);
   TH2F *hs = new TH2F("hs","Sinusoidal",180, -180, 180, 181, -90.5, 90.5);
   TH2F *hp = new TH2F("hp","Parabolic", 180, -180, 180, 181, -90.5, 90.5);

   TString dat = gSystem->UnixPathName(__FILE__);
   dat.ReplaceAll(".C",".dat");
   dat.ReplaceAll("/./","/");

   ifstream in;
   in.open(dat.Data());
   Float_t x,y;
   while (1) {
     in >> x >> y;
     if (!in.good()) break;
     ha->Fill(x,y, 1);
     hm->Fill(x,y, 1);
     hs->Fill(x,y, 1);
     hp->Fill(x,y, 1);
   }
   in.close();

   c1->cd(1); ha->Draw("aitoff");
   c1->cd(2); hm->Draw("mercator");
   c1->cd(3); hs->Draw("sinusoidal");
   c1->cd(4); hp->Draw("parabolic");

   return c1;
}
Example #20
0
void overplot_dists(TString ifile)
{
	TFile *f1 = new TFile(ifile);
	TH2F *xypion = (TH2F*) f1->Get("pion_dist_xy");
	TH2F *xykaon = (TH2F*) f1->Get("kaon_dist_xy");

	xypion->SetTitle(ifile);

	int redc[3];
	int bluec[3];
	int redblue[2];
	redblue[0] = 2;
	redblue[1] = 9;

	redc[0] = 45;
	redc[1] = 46;
	redc[2] = 2;

	bluec[0] = 33;
	bluec[1] = 38;
	bluec[2] = 9;


	gStyle->SetPalette(3,bluec);
	
	xypion->Draw("COL");

	c1->SetWindowSize(1000,800);
	c1->Print("pion_col_xy.gif");

	
	gStyle->SetPalette(3,bluec);
	xykaon->Draw("col");
	c1->SetWindowSize(1000,800);
	c1->Print("kaon_col_xy.gif");
}
Example #21
0
void QAnalysis::PlotVelocityDistribution(int phi) {
  TTree* tree = ReadTree(file);
  
  int zbin = 60; int rbin = 19;
  TH2F*  hist = new TH2F("quenchv", "quenchv", zbin, 0, 60, rbin, 0, 19);
  
  for (int i=0; i<tree->GetEntries(); i++) {
    tree->GetEntry(i);
    if ( time==70. && posID[1]==phi )
	  hist->Fill(posID[0], posID[2], qchTime);
  }
  
  hist->SetTitle("; Z; R; Quenched Time [sec]");
  hist->Draw("colz");
}
Example #22
0
void
PlotYields(const std::string& name, std::map<double, double> yields, TLegend* legend) {
  static int pass = 0;
  int colors[] = {kBlue, kRed, kGreen, kOrange, kBlack};
  int lastColor = sizeof(colors)/sizeof(colors[0])-1;
  double miny = std::min_element(yields.begin(), yields.end(), [](std::pair<double, double> p, std::pair<double, double> q) { return p.second < q.second; })->second;
  double maxy = std::max_element(yields.begin(), yields.end(), [](std::pair<double, double> p, std::pair<double, double> q) { return p.second < q.second; })->second;

  std::string canvasName = "Yields " + name;
  //  TCanvas * c = new TCanvas(canvasName.c_str(), canvasName.c_str(), 900, 700);
  SetAtlasStyle();
  //c->SetLogy();

  TH2F* hist = new TH2F(canvasName.c_str(), canvasName.c_str(), 20, 200, 1100, 200, miny * 0.9, maxy * 1.1);
  hist->SetMarkerStyle(21+pass);
  hist->SetMarkerColor(pass > lastColor ? lastColor : colors[pass]);
  for (const std::pair<double, double>& p : yields) {
    // don't plot background yields
    if (p.first < 100) {
      continue;
    }
    
    hist->Fill(p.first, p.second);
  }
  
  if (pass == 0) {
    hist->Draw("p");
  } else {
    hist->Draw("same");
  }

  legend->AddEntry(hist, name.c_str(), "lp");

  //c->Print(outputFolder + "yields.pdf");
  ++pass;
}
Example #23
0
/*=========================================================*/
void d2d(Char_t *matn)
{
  TH2F *hist;
  Axis_t axmax=axmin+numchx;
  Axis_t aymax=aymin+numchy;

  setcanvas(1);
  gStyle->SetPalette(1);
  gPad->SetLogz(1);
  hist=(TH2F*)f1->Get(matn);
  hist->SetAxisRange(axmin,axmax,"X");
  hist->SetAxisRange(aymin,aymax,"Y");
  hist->Draw("COLZ");
  return;
}
Example #24
0
void t(){

  gStyle->SetOptStat(0);
  gStyle->SetPadLeftMargin(0.13);
  gStyle->SetPadBottomMargin(0.13);

  TFile *f_bef = TFile::Open("hists/sig_nofilt_noeff.root");
  TH2F *tb = (TH2F*) f_bef->Get("inv_p_t_pbar_pi0_lab_the_pi0");
  tb->SetTitle("#theta_{#pi^{0}} vs t;t[(GeV)^{2}];#theta_{#pi^{0}}[#circ]");
  set_style(tb->GetXaxis());
  set_style(tb->GetYaxis());


  TFile* f_aft = TFile::Open("hists/sig_noeff.root");
  TH1F *ta = (TH1F*) f_aft->Get("inv_p_t_pbar_pi0");
  //  tb->SetTitle(Form("#theta_{J/#psi} in #bar{p}p#rightarrow%s", rxn.c_str()));
  ta->SetTitle("t;t[(GeV)^{2}]");
  ta->GetXaxis()->SetRangeUser(-0.8,0.8);
  set_style(ta->GetXaxis());
  set_style(ta->GetYaxis());


  TCanvas *tc0 = new TCanvas("tc0","tc0",1100,500);
  tc0->Divide(2,1);
  tc0->cd(1);
  tb->Draw("colz");

  TLatex *tt = new TLatex();
  tt->SetTextSize(0.06);
  tt->SetNDC();
  tt->DrawLatex(0.5,0.5,"s=12.25 GeV^{2}");

  tc0->cd(2);
  ta->Draw();
  tt->DrawLatex(0.19,0.7,"s=12.25 GeV^{2}");
  tt->DrawLatex(0.19,0.6,"After MC rejection");

  tc0->Print("figs/t_vs_the_pi0.pdf");

  TCanvas *tc1 = new TCanvas("tc1","tc1",1400,1000);
  tc1->cd();
  ta->Draw();
  tt->DrawLatex(0.19,0.7,"s=12.25 GeV^{2}");
  tt->DrawLatex(0.19,0.6,"Forward Hemesphere in CM");
  //tt->DrawLatex(0.19,0.5,"After MC rejection");


}
Example #25
0
void fitTools::drawSingleGraph(TGraph* gr, const std::string& canvasName) {

  TH2F *h = new TH2F("h_ausialiario","", 10, 20., 1000., 10, 0.2, 1. );
  h->SetXTitle("p_{T}^{GEN} [GeV/c]" );
  h->SetYTitle( "p_{T}^{RECO}/p_{T}^{GEN}" );
  h->SetStats(0);

  TCanvas* c1 = new TCanvas("c1", "c1", 800, 600);
  c1->cd();
  h->Draw();
  gr->Draw("*same");
  c1->SaveAs(canvasName.c_str());

  delete c1;
  delete h;
}
Example #26
0
void QAnalysis::PlotTemperatureDistribution(double qtime, int numPhi, bool scale) {
  int zbin = 60;
  int rbin = 19;
  TH2F*  hist = new TH2F(Form("tempDis%.1f", qtime), Form("tempDis%.1f", qtime), zbin, 0, 60, rbin, 0, 19);
  TTree* tree = ReadTree(file);
  
  for (int i=0; i<tree->GetEntries(); i++) {
    tree->GetEntry(i);
	if ( time==qtime && posID[1]==numPhi ) 
      hist->Fill(posID[0], posID[2], temp);
  }
  
  if (scale==true) hist->GetZaxis()->SetRangeUser(0., GetMaximum("temp"));
  hist->SetTitle(Form("time = %.1f [sec]; Z; R; Temperature [K]", qtime));
  hist->Draw("colz");
}
Example #27
0
void drawRes(TString in="data/scan7/res_all.root"){

  glx_savepath = "data/drawRes";
  gStyle->SetOptStat(0);
  gStyle->SetPalette(55);
  gStyle->SetNumberContours(99);
   
  TChain ch("reco"); ch.Add(in);  
  Double_t sep,esep,spr,mom,theta,phi,nph;
  ch.SetBranchAddress("theta",&theta);
  ch.SetBranchAddress("phi",&phi);
  ch.SetBranchAddress("sep",&sep);
  ch.SetBranchAddress("esep",&esep);
  ch.SetBranchAddress("spr",&spr);
  ch.SetBranchAddress("mom",&mom);
  ch.SetBranchAddress("nph",&nph);

  TH2F *hSep_pol = new TH2F("hSep",";#theta [deg];#varphi [deg]",72,0,360,(11.4-1.2)/0.2+1+6,0,11.4);
  TH2F *hSep = new TH2F("hSep",";#theta [deg];#varphi [deg]",(11.4-1.2)/0.2+1,1.2,11.4,36,-170,10);
  
  for(Int_t i=0; i<ch.GetEntries(); i++){
    ch.GetEvent(i);
    hSep->Fill(theta,phi,sep);
    hSep_pol->Fill(180-phi,theta,sep);
  }

  // // interpolate emptiness
  // double pval;
  // for(int i=0; i<hSep_pol->GetNbinsX()*hSep_pol->GetNbinsX(); i++){
  //   double val = hSep_pol->GetBinContent(i);
  //   if(val<0.001 && )  hSep_pol->SetBinContent(i,pval);
  //   else pval=val;
  // }
  
  Int_t colors[]={1,kGreen+1,kRed+2,kRed,4,5,6,7,8,9,10};


  glx_canvasAdd("hSep_pol",800,800);
  gPad->SetTheta(90.);
  gPad->SetPhi(0.);
  hSep_pol->Draw("lego2 polz");

  glx_canvasAdd("hSep",800,500);
  hSep->Draw("colz");
  
  glx_canvasSave(0,0);
}
Example #28
0
void scatterPloteta(){
  gROOT->Reset();
  gStyle->SetOptStat(1);

  ifstream data;
  
  float valueX;
  float valueY;

  string name = "eta";
  data.open((name+".txt").c_str());
  
  TH2F * histo = new TH2F("histo",name.c_str(),1000,-2.4,2.4,100,-2.4,2.4); //eta
  TH1F * histo1D = new TH1F("histo1D",name.c_str(),1000,-2.4,2.4); //eta

//  float pi = 3.14159265;
//  TH2F * histo = new TH2F("histo",name.c_str(),1000,-1*pi,pi,1000,-1*pi,pi); //phi
//  TH1F * histo1D = new TH1F("histo1D",name.c_str(),1000,-1*pi,pi); //phi

  while(!data.eof()){
    data >>valueX>>valueY;
    cout<<valueX<<" "<<valueY<<endl;
    histo->Fill(valueX,valueY);
    histo1D->Fill(valueX-valueY);
  }
  
  TCanvas * Ca0 = new TCanvas("Ca0","Canvas",1200,800);
  histo->SetLineWidth(3);

  TFile * theFile = new TFile("eta.root","RECREATE");
  theFile->cd();

  histo->Draw();
  histo1D->DrawNormalized("same");
  histo->GetXaxis()->SetTitle(("RPC"+name).c_str());
  histo->GetYaxis()->SetTitle(("CSC"+name).c_str());
  Ca0->SaveAs((name+".png").c_str());

  histo1D->Write();
  histo->Write();

  theFile->Save();
  theFile->Close();

  
}
Example #29
0
void show_mass_dist()
{
    TFile *file_f = new TFile("particle_mass_dist.root");

    TH2F *hm = (TH2F *) file_f->Get("mass_dist");
    TProfile *pm = (TProfile *) file_f->Get("mass_dist_p");

    TCanvas *cm = new TCanvas("cm", "Mass", 1000, 500);
    cm->Divide(2, 1);

    pm->SetLineColor(4);

    cm->cd(1);
    hm->Draw();
    cm->cd(2)->SetBorderMode(0);
    pm->Draw();
}
void DrawContourLine3sigma( TLegend *leg, TH2F* hist, const TString& text="", Int_t linecolor=1, Int_t linestyle=2, Int_t linewidth=2 )
{
   // contour plot
   TH2F* h = new TH2F( *hist );
   h->SetContour( 1 );
   double pval = (1.-0.9973)*0.5; // one-sided
   double signif = TMath::NormQuantile(1-pval);
   //cout <<"DrawContourLine3sigma: pval="<<pval<<", "<<signif<<"sigma for "<<text<<endl;
   h->SetContourLevel( 0, signif );

   h->SetLineColor( linecolor );
   h->SetLineWidth( linewidth );
   h->SetLineStyle( linestyle );
   h->Draw( "samecont3" );

   if (!text.IsNull()) leg->AddEntry(h,text.Data(),"l");
}