[9] | 1 | #include "TROOT.h"
|
---|
| 2 | #include "TFile.h"
|
---|
| 3 | #include "TTree.h"
|
---|
| 4 | #include "TCanvas.h"
|
---|
| 5 | #include "TProfile.h"
|
---|
| 6 | #include "TF1.h"
|
---|
| 7 | #include "TGraph.h"
|
---|
| 8 |
|
---|
| 9 | #include "interface/FuncDef.h"
|
---|
| 10 |
|
---|
[23] | 11 | void JetResol(TTree *Analyze)
|
---|
[9] | 12 | {
|
---|
[23] | 13 | TCanvas *c1 = new TCanvas("c1","JET resol",100,100,600,450);
|
---|
[9] | 14 | c1->cd();
|
---|
| 15 |
|
---|
[23] | 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);
|
---|
[9] | 19 | Analyze->Draw("JetPTResol.SmearePT:JetPTResol.NonSmearePT>>ETSoverET","JetPTResol.NonSmearePT>1");
|
---|
| 20 |
|
---|
| 21 | double rms[numBin];
|
---|
| 22 | double mean[numBin];
|
---|
| 23 |
|
---|
[23] | 24 | TCanvas *c2 = new TCanvas("c2","JET resol",0,0,1000,650);
|
---|
[9] | 25 | c2->cd(); int frame=0;
|
---|
| 26 | c2->Divide(6,2);
|
---|
| 27 |
|
---|
[23] | 28 | float x[numBin-1];
|
---|
| 29 | float y[numBin-1];
|
---|
[9] | 30 | float finval=0;//valeur a remplir puis a fitter
|
---|
| 31 |
|
---|
[23] | 32 | for ( int i=0; i<(numBin-1); i++) // premiÚre bin : i ==1 et pas i == 0
|
---|
[9] | 33 | {
|
---|
| 34 | TAxis *xaxis = ETSoverET->GetXaxis();
|
---|
| 35 | float binCenter = xaxis->GetBinCenter(i+1);
|
---|
| 36 | int binMin = (int)xaxis->GetBinLowEdge(i+1);
|
---|
| 37 | int binMax = (int)xaxis->GetBinUpEdge(i+1);
|
---|
| 38 | cout<<"binMin "<<binMin<<" binMax "<<binMax<<" bin center "<<binCenter<<endl;
|
---|
| 39 | char tempMin[500];
|
---|
| 40 | sprintf(tempMin,"JetPTResol.NonSmearePT>%d",binMin);
|
---|
| 41 | string mystringMin(tempMin);
|
---|
| 42 | char tempMax[500];
|
---|
| 43 | sprintf(tempMax,"JetPTResol.NonSmearePT<%d",binMax);
|
---|
| 44 | string mystringMax(tempMax);
|
---|
| 45 | char tempName[500];
|
---|
| 46 | sprintf(tempName,"JetPTResol.SmearePT>>hETSoverET%d",i);
|
---|
| 47 | string mystringName(tempName);
|
---|
| 48 |
|
---|
| 49 | c2->cd(++frame);
|
---|
| 50 | GaussValues(Analyze,tempName,rms[i],mean[i],mystringMin,mystringMax);
|
---|
| 51 | x[i]=binCenter;
|
---|
| 52 | finval=rms[i]/mean[i];
|
---|
[23] | 53 | y[i]=(finval*2);
|
---|
[9] | 54 | cout<<"finval "<<finval<<" mean val "<<mean[i]<<" rms value "<<rms[i]<<endl;
|
---|
| 55 |
|
---|
| 56 | }
|
---|
| 57 |
|
---|
[23] | 58 | TCanvas *c3 = new TCanvas("c3","JET resol",100,100,600,450);
|
---|
[9] | 59 | c3->cd();
|
---|
| 60 |
|
---|
[23] | 61 | TF1 *fitfun = new TF1("user","sqrt(pow([0],2)+pow([1]/sqrt(x),2)+pow([2]/x,2))",1,3000);
|
---|
[9] | 62 |
|
---|
[23] | 63 | TGraph *gr11 = new TGraph((numBin-1),x,y);
|
---|
[9] | 64 | gr11->Draw("AP");
|
---|
| 65 | gr11->GetXaxis()->SetTitle("E_{T}^{MC} [GeV]");
|
---|
| 66 | gr11->GetYaxis()->SetTitle("#sigma(E_{T}^{rec}/E_{T}^{MC})/<E_{T}^{rec}/E_{T}^{MC}>");
|
---|
| 67 |
|
---|
| 68 | //fitfun->FixParameter(0,0.0541930);
|
---|
| 69 | //fitfun->FixParameter(1,0.634908);
|
---|
| 70 | gr11->Fit("user","RQ");
|
---|
| 71 | gr11->Fit("user","RQ");
|
---|
| 72 | gr11->Fit("user","RQ");
|
---|
| 73 | gr11->Fit("user","R");
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | delete fitfun;
|
---|
| 78 | // delete Gauss;
|
---|
| 79 | }
|
---|
[23] | 80 |
|
---|
| 81 |
|
---|
| 82 | void 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 |
|
---|
| 152 | void 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 | }
|
---|