Changeset 23 in svn for trunk/routines/resolutions.C
- Timestamp:
- Nov 7, 2008, 6:37:38 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/routines/resolutions.C
r9 r23 9 9 #include "interface/FuncDef.h" 10 10 11 void Plot()11 void JetResol(TTree *Analyze) 12 12 { 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); 25 14 c1->cd(); 26 15 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); 31 19 Analyze->Draw("JetPTResol.SmearePT:JetPTResol.NonSmearePT>>ETSoverET","JetPTResol.NonSmearePT>1"); 32 20 33 21 double rms[numBin]; 34 22 double mean[numBin]; 35 //TF1 *Gauss = new TF1("Gauss","gaus",0,4);36 23 37 TCanvas *c2 = new TCanvas("c2"," gerrors2",0,0,1000,650);24 TCanvas *c2 = new TCanvas("c2","JET resol",0,0,1000,650); 38 25 c2->cd(); int frame=0; 39 26 c2->Divide(6,2); 40 // c2->Divide(6,2);41 27 42 float x[numBin ];43 float y[numBin ];28 float x[numBin-1]; 29 float y[numBin-1]; 44 30 float finval=0;//valeur a remplir puis a fitter 45 31 46 for ( int i=0; i< numBin; i++) // premiÚre bin : i ==1 et pas i == 032 for ( int i=0; i<(numBin-1); i++) // premiÚre bin : i ==1 et pas i == 0 47 33 { 48 34 TAxis *xaxis = ETSoverET->GetXaxis(); … … 64 50 GaussValues(Analyze,tempName,rms[i],mean[i],mystringMin,mystringMax); 65 51 x[i]=binCenter; 66 mean[i]=ETSoverET->GetBinContent(i+1);67 // rms[i]=ETSoverET->GetBinError(i+1);68 52 finval=rms[i]/mean[i]; 69 y[i]= finval;53 y[i]=(finval*2); 70 54 cout<<"finval "<<finval<<" mean val "<<mean[i]<<" rms value "<<rms[i]<<endl; 71 55 72 56 } 73 57 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); 77 59 c3->cd(); 78 60 79 TF1 *fitfun = new TF1("user","sqrt(pow([0],2)+pow([1]/sqrt(x),2)+pow([2]/x,2))",1 0,500);61 TF1 *fitfun = new TF1("user","sqrt(pow([0],2)+pow([1]/sqrt(x),2)+pow([2]/x,2))",1,3000); 80 62 81 TGraph *gr11 = new TGraph((numBin ),x,y);63 TGraph *gr11 = new TGraph((numBin-1),x,y); 82 64 gr11->Draw("AP"); 83 65 gr11->GetXaxis()->SetTitle("E_{T}^{MC} [GeV]"); … … 96 78 // delete Gauss; 97 79 } 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 }
Note:
See TracChangeset
for help on using the changeset viewer.