Fork me on GitHub

Changeset 23 in svn for trunk/routines


Ignore:
Timestamp:
Nov 7, 2008, 6:37:38 PM (16 years ago)
Author:
severine ovyn
Message:

Working on the resolution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/routines/resolutions.C

    r9 r23  
    99#include "interface/FuncDef.h"
    1010
    11 void Plot()
     11void JetResol(TTree *Analyze)
    1212{
    13 
    14   setTDRStyle();
    15   gROOT->Reset();
    16 
    17   TFile *f1 = new TFile("Smearing.root","read");
    18   TTree *Analyze = (TTree*)f1->Get("Analysis");
    19 
    20 
    21 //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    22 //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    23 
    24    TCanvas *c1 = new TCanvas("c1","gerrors2",100,100,600,450);
     13   TCanvas *c1 = new TCanvas("c1","JET resol",100,100,600,450);
    2514   c1->cd();
    2615 
    27    const Int_t numBin=5;
    28 //   double bins[numBin]={5,10,25,55,85,115,205,400};
    29    double bins[5]={10,30,50,80,120};
    30    TProfile *ETSoverET = new TProfile("ETSoverET","Resolution des electrons",(numBin-1),bins,-10,10);
     16   const Int_t numBin=7;
     17   double bins[numBin]={0,20,60,100,220,420,860};
     18   TProfile *ETSoverET = new TProfile("ETSoverET","Jet resolution: E_{T}^{rec}/E_{T}^{mc}",(numBin-1),bins,-10,10);
    3119   Analyze->Draw("JetPTResol.SmearePT:JetPTResol.NonSmearePT>>ETSoverET","JetPTResol.NonSmearePT>1");
    3220
    3321   double rms[numBin];
    3422   double mean[numBin];
    35    //TF1 *Gauss = new TF1("Gauss","gaus",0,4);
    3623
    37    TCanvas *c2 = new TCanvas("c2","gerrors2",0,0,1000,650);
     24   TCanvas *c2 = new TCanvas("c2","JET resol",0,0,1000,650);
    3825   c2->cd(); int frame=0;
    3926   c2->Divide(6,2);
    40 //   c2->Divide(6,2);
    4127
    42    float x[numBin];
    43    float y[numBin];
     28   float x[numBin-1];
     29   float y[numBin-1];
    4430   float finval=0;//valeur a remplir puis a fitter
    4531
    46    for ( int i=0; i<numBin; i++)  // premiÚre bin : i ==1 et pas i == 0
     32   for ( int i=0; i<(numBin-1); i++)  // premiÚre bin : i ==1 et pas i == 0
    4733      {
    4834        TAxis *xaxis = ETSoverET->GetXaxis();
     
    6450        GaussValues(Analyze,tempName,rms[i],mean[i],mystringMin,mystringMax);
    6551        x[i]=binCenter;
    66         mean[i]=ETSoverET->GetBinContent(i+1);
    67    //     rms[i]=ETSoverET->GetBinError(i+1);
    6852        finval=rms[i]/mean[i];
    69         y[i]=finval;
     53        y[i]=(finval*2);
    7054        cout<<"finval "<<finval<<" mean val "<<mean[i]<<" rms value "<<rms[i]<<endl;
    7155
    7256      }
    7357
    74 y[0]=0.2;
    75 
    76    TCanvas *c3 = new TCanvas("c3","gerrors2",100,100,600,450);
     58   TCanvas *c3 = new TCanvas("c3","JET resol",100,100,600,450);
    7759   c3->cd();
    7860
    79    TF1 *fitfun = new TF1("user","sqrt(pow([0],2)+pow([1]/sqrt(x),2)+pow([2]/x,2))",10,500);
     61   TF1 *fitfun = new TF1("user","sqrt(pow([0],2)+pow([1]/sqrt(x),2)+pow([2]/x,2))",1,3000);
    8062
    81    TGraph *gr11 = new TGraph((numBin),x,y);
     63   TGraph *gr11 = new TGraph((numBin-1),x,y);
    8264   gr11->Draw("AP");
    8365   gr11->GetXaxis()->SetTitle("E_{T}^{MC} [GeV]");
     
    9678// delete Gauss;
    9779}
     80
     81
     82void ETmisResol(TTree *Analyze)
     83{
     84
     85   TCanvas *c4 = new TCanvas("c4","ETmis resol",100,100,600,450);
     86   c4->cd();
     87 
     88   const Int_t numBin=10;
     89   double bins[numBin]={0,10,20,40,80,160,320,640,1080,2160};
     90   TProfile *ETSoverET = new TProfile("ETSoverET","ETmis resol",(numBin-1),bins,-10,10);
     91   Analyze->Draw("(ETmisResol.EtSmeare-ETmisResol.Et):(ETmisResol.Et)>>ETSoverET","(ETmisResol.Et)>1");
     92
     93   double rms[numBin];
     94   double mean[numBin];
     95
     96   TCanvas *c5 = new TCanvas("c5","gerrors2",0,0,1000,650);
     97   c5->cd(); int frame=0;
     98   c5->Divide(6,2);
     99
     100   float x[numBin-1];
     101   float y[numBin-1];
     102
     103   for ( int i=0; i<(numBin-1); i++)  // premiÚre bin : i ==1 et pas i == 0
     104      {
     105        TAxis *xaxis = ETSoverET->GetXaxis();
     106        float binCenter = xaxis->GetBinCenter(i+1);
     107        int binMin = (int)xaxis->GetBinLowEdge(i+1);
     108        int binMax = (int)xaxis->GetBinUpEdge(i+1);
     109        cout<<"binMin "<<binMin<<" binMax "<<binMax<<" bin center "<<binCenter<<endl;
     110        char tempMin[500];
     111        sprintf(tempMin,"(ETmisResol.Et)>%d",binMin);
     112        string mystringMin(tempMin);
     113        char tempMax[500];
     114        sprintf(tempMax,"(ETmisResol.Et)<%d",binMax);
     115        string mystringMax(tempMax);
     116        char tempName[500];
     117        sprintf(tempName,"(ETmisResol.EtSmeare-ETmisResol.Et)>>hETSoverET%d",i);
     118        string mystringName(tempName);
     119
     120        c5->cd(++frame);
     121        GaussValues(Analyze,tempName,rms[i],mean[i],mystringMin,mystringMax);
     122        x[i]=binCenter;
     123        mean[i]=ETSoverET->GetBinContent(i+1);
     124        y[i]=rms[i];
     125        cout<<" mean val "<<mean[i]<<" rms value "<<rms[i]<<endl;
     126
     127      }
     128
     129   TCanvas *c6 = new TCanvas("c6","ETmis resolution",100,100,600,450);
     130   c6->cd();
     131
     132   TF1 *fitfun = new TF1("user","sqrt(pow([0],2)+pow([1]/sqrt(x),2)+pow([2]/x,2))",1,3000);
     133
     134   TGraph *gr11 = new TGraph((numBin-1),x,y);
     135   gr11->Draw("AP");
     136   gr11->GetXaxis()->SetTitle("E_{T}^{MC} [GeV]");
     137   gr11->GetYaxis()->SetTitle("#sigma(E_{T}^{rec}>");
     138
     139   //fitfun->FixParameter(0,0.0541930);
     140   //fitfun->FixParameter(1,0.634908);
     141   gr11->Fit("user","RQ");
     142   gr11->Fit("user","RQ");
     143   gr11->Fit("user","RQ");
     144   gr11->Fit("user","R");
     145
     146
     147
     148 delete fitfun;
     149// delete Gauss;
     150}
     151
     152void General()
     153{
     154  setTDRStyle();
     155  gROOT->Reset();
     156
     157  TFile *f1 = new TFile("Smearing.root","read");
     158  TTree *Analyze = (TTree*)f1->Get("Analysis");
     159  JetResol(Analyze);
     160
     161}
Note: See TracChangeset for help on using the changeset viewer.