void testMom(char *file) { /* Author: G. Bonomi Date: 9 June 2005 This macro open a root file containing ntuple h127 and plot the mu+ momentum. Input: file (name of the file containing the h127 ntuple) Output: cmu.ps & cmu.gif (file with the plots) */ gStyle->SetOptStat(1001101); gStyle->SetOptFit(10001); gStyle->SetStatW(.24); gStyle->SetStatH(.40); // gStyle->SetStatFormat("3.2g"); char title[50],testo[40],cosa[40]; float shift,sigma,res; int nBin=75; f = new TFile(file); sprintf(cosa, "Write here version number"); /* Positive muon */ sprintf(title,"%s: p mu+",cosa); h111 = new TH1F("h111",title, 100, 0.15, 0.30); h112 = new TH1F("h112","p mu+ (zoom)", nBin, 0.2299, 0.2401); h113 = new TH1F("h113","p mu+ (forward<90)", nBin, 0.2299, 0.2401); h114 = new TH2F("h134","p mu+ vs lamplu",50,0.2299,0.2401,50,0.,40.); cmu = new TCanvas("cmu","mu+",800,800); cmu->Divide(2,2); cmu->cd(1); h127->Draw("Pmodplu>>h111","Extrplu==1"); cmu->cd(2); h127->Draw("Pmodplu>>h112","Extrplu==1"); cmu->cd(3); h127->Draw("Pmodplu>>h113","Extrplu==1&&Normplu<90"); cmu->cd(4); h127->Draw("abs(Lamplu):Pmodplu>>h134","Extrplu==1&&Normplu<90"); cmu->cd(3); float m = h113->GetBinCenter(h113->GetMaximumBin()); shift = 0.0008; g = new TF1("g","gaus",0.,1.); h113->Fit("g","","",m-shift,m+shift+0.0002); sigma = g->GetParameter(2); res = (sigma*2.35/0.235)*1000; sprintf(testo,"Res. %.2f (per mil)",res); t = new TText(0.23,h113->GetMaximum()*0.98,testo); t->Draw(); /* Negative pion */ /* sprintf(title,"%s: p pi-",cosa); h131 = new TH1F("h131",title, 100, 0.15, 0.32); h132 = new TH1F("h132","p pi- (zoom)", nBin, 0.2649, 0.2751); h133 = new TH1F("h133","p pi- (forward<90)", nBin, 0.2649, 0.2751); h134 = new TH2F("h134","p pi- vs lammin",50,0.2649,0.2751,50,0.,40.); cpi = new TCanvas("cpi","pi-",800,800); cpi->Divide(2,2); cpi->cd(1); h127->Draw("Pmodmin>>h131","Extrmin==1"); cpi->cd(2); h127->Draw("Pmodmin>>h132","Extrmin==1"); cpi->cd(3); h127->Draw("Pmodmin>>h133","Extrmin==1&&Normmin<90"); cpi->cd(4); h127->Draw("abs(Lammin):Pmodmin>>h134","Extrmin==1&&Normmin<90"); c = new TCanvas("c","pi- BIG",600,600); float m = h133->GetBinCenter(h133->GetMaximumBin()); g1 = new TF1("g1","gaus",0.,1.); h133->Fit("g1","","",m-shift,m+shift); sigma = g1->GetParameter(2); res = (sigma*2.35/0.270)*1000; sprintf(testo,"Res. %.2f (per mil)",res); t1 = new TText(0.265,h133->GetMaximum()*.98,testo); t1->SetTextSize(0.045); t1->Draw(); cpi->cd(3); t1->Draw(); */ char out[20]; sprintf(out,"cmu.ps"); cmu->Print(out,"ps"); sprintf(out,"cmu.gif"); cmu->Print(out,"gif"); /* sprintf(out,"cpi.ps"); cpi->Print(out,"ps"); sprintf(out,"cpi.gif"); cpi->Print(out,"gif"); sprintf(out,"cbig.ps"); c->Print(out,"ps"); sprintf(out,"cbig.gif"); c->Print(out,"gif"); */ }