本文整理汇总了C++中TFile类的典型用法代码示例。如果您正苦于以下问题:C++ TFile类的具体用法?C++ TFile怎么用?C++ TFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getResV
void getResV(){
//------------------------Deal with the number and get the output stored in txt files and root files
string SumorProd = getenv("SUMORPROD");
double Vmax[nbin], eps[nbin];
for(int ibin=0; ibin<nbin ;ibin++){
Vmax[ibin]=0.12*(trkbin[ibin]+50);
eps[ibin]=0.00045*(trkbin[ibin]+50);
}
ofstream fstrV;
double theta[ntheta];
TVectorD Gmod2[nbin][ntheta];
TVectorD sigma2[nbin],deltaV[nbin];
TVectorD r[nbin];
TVectorD r0[nbin], r01[nbin], V[nbin], chi[nbin];
TVectorD GRe[nbin][ntheta]; TVectorD* GRe_t[nbin][ntheta];
TVectorD GIm[nbin][ntheta]; TVectorD* GIm_t[nbin][ntheta];
TComplex G[nbin][ntheta][nstepr];
if(SumorProd=="Sum") fstrV.open("V_Sum.txt");
else fstrV.open("V_Prod.txt");
TFile *f[nFileAll];
for(int ibin=0; ibin<nbin; ibin++){
r[ibin].ResizeTo(nstepr);
for(int ir=0; ir<nstepr; ir++){
if(isSimple==0) r[ibin][ir]=j01/(Vmax[ibin]-eps[ibin]*ir);
else r[ibin][ir]=0.00025*20*(ir+1);
}
}
TVectorD Nevent; Nevent.ResizeTo(nbin); Nevent.Zero();
TVectorD totmultall; totmultall.ResizeTo(nbin); totmultall.Zero();
TVectorD avgmultall; avgmultall.ResizeTo(nbin); avgmultall.Zero();
TVectorD tottrk; tottrk.ResizeTo(nbin); tottrk.Zero();
TVectorD totptall; totptall.ResizeTo(nbin); totptall.Zero();
TVectorD totetaall; totetaall.ResizeTo(nbin); totetaall.Zero();
TVectorD avgtrk; avgtrk.ResizeTo(nbin); avgtrk.Zero();
TVectorD avgmult; avgmult.ResizeTo(nbin);
TVectorD deltaVmean; deltaVmean.ResizeTo(nbin);
TVectorD Vmean; Vmean.ResizeTo(nbin);
TVectorD avgpt; avgpt.ResizeTo(nbin);
TVectorD avgeta; avgeta.ResizeTo(nbin);
TVectorD Qx1; Qx1.ResizeTo(nbin); Qx1.Zero();
TVectorD Qy1; Qy1.ResizeTo(nbin); Qy1.Zero();
TVectorD Q2; Q2.ResizeTo(nbin); Q2.Zero();
TVectorD sigma2_; sigma2_.ResizeTo(nbin); sigma2_.Zero();
TVectorD chi_; chi_.ResizeTo(nbin); chi_.Zero();
for(int itheta=0;itheta<ntheta;itheta++)
theta[itheta]=itheta*TMath::Pi()/ntheta/nn;
for(int ibin=0;ibin<nbin;ibin++){
r0[ibin].ResizeTo(ntheta);
r01[ibin].ResizeTo(ntheta);
sigma2[ibin].ResizeTo(ntheta);
V[ibin].ResizeTo(ntheta);
deltaV[ibin].ResizeTo(ntheta);
chi[ibin].ResizeTo(ntheta);
for(int itheta=0;itheta<ntheta;itheta++){
Gmod2[ibin][itheta].ResizeTo(nstepr);
GRe[ibin][itheta].ResizeTo(nstepr);
GRe[ibin][itheta].Zero();
GIm[ibin][itheta].ResizeTo(nstepr);
GIm[ibin][itheta].Zero();
}
}
for(int ifile=0; ifile<nFileAll; ifile++){
if(SumorProd=="Sum") f[ifile] = TFile::Open(Form("/scratch/xuq7/flow/pbsjoboutput/PbPb2011MB/trackzvtxs/AnaV_Sum_%d.root",ifile));
else f[ifile] = TFile::Open(Form("/scratch/xuq7/flow/pbsjoboutput/PbPb2011MB/trackzvtxs/AnaV_Prod_%d.root",ifile));
TVectorD* Nevent_t = (TVectorD*)f[ifile]->Get(Form("Nevent"));
TVectorD* totmultall_t = (TVectorD*)f[ifile]->Get(Form("totmultall"));
TVectorD* tottrk_t = (TVectorD*)f[ifile]->Get(Form("tottrk"));
TVectorD* totptall_t = (TVectorD*)f[ifile]->Get(Form("totptall"));
TVectorD* totetaall_t = (TVectorD*)f[ifile]->Get(Form("totetaall"));
TVectorD* Qx1_t = (TVectorD*)f[ifile]->Get(Form("Qx1"));
TVectorD* Qy1_t = (TVectorD*)f[ifile]->Get(Form("Qy1"));
TVectorD* Q2_t = (TVectorD*)f[ifile]->Get(Form("Q2"));
for(int ibin=0;ibin<nbin;ibin++){
for(int itheta=0;itheta<ntheta;itheta++){
GRe_t[ibin][itheta] = (TVectorD*)f[ifile]->Get(Form("GRe_%d_%d",ibin,itheta));
GIm_t[ibin][itheta] = (TVectorD*)f[ifile]->Get(Form("GIm_%d_%d",ibin,itheta));
for(ir=0; ir<nstepr; ir++){
GRe[ibin][itheta][ir] += (*GRe_t[ibin][itheta])[ir];
GIm[ibin][itheta][ir] += (*GIm_t[ibin][itheta])[ir];
}
}
Qx1[ibin] += (*Qx1_t)[ibin];
Qy1[ibin] += (*Qy1_t)[ibin];
Q2[ibin] += (*Q2_t)[ibin];
totptall[ibin] += (*totptall_t)[ibin];
totetaall[ibin] += (*totetaall_t)[ibin];
Nevent[ibin] += (*Nevent_t)[ibin];
totmultall[ibin] += (*totmultall_t)[ibin];
tottrk[ibin] += (*tottrk_t)[ibin];
}
f[ifile]->Close();
}
//.........这里部分代码省略.........
开发者ID:XuQiao,项目名称:HI,代码行数:101,代码来源:getResV.C
示例2: CompareVz
//.........这里部分代码省略.........
histodata->SetName(Form("%sData",coll.Data()));
histo1->Rebin(5);
histo2->Rebin(5);
histodata->Rebin(5);
//histo1=(TH1F*)histo1->Rebin(Nbin_vz,"histo1",binbound_vz);
//histo2=(TH1F*)histo2->Rebin(Nbin_vz,"histo2",binbound_vz);
histo1->Scale(1/histo1->Integral());
histo2->Scale(1/histo2->Integral());
histodata->Scale(1/histodata->Integral());
histo1->SetMarkerStyle(24);
histo1->SetMarkerSize(1.2);
histo1->SetMarkerColor(4);
histo1->SetLineColor(4);
histo2->SetMarkerStyle(0);
histo2->SetMarkerColor(0);
histo2->SetMarkerSize(0);
histo2->SetFillStyle(3004);
histo2->SetFillColor(2);
histo2->SetLineColor(2);
//histo2->SetMarkerColor(0);
//histo2->SetMarkerColor(4);
histodata->SetMarkerStyle(20);
histodata->SetMarkerSize(1.2);
histodata->SetMarkerColor(1);
histodata->SetLineColor(1);
TCanvas* c1 = new TCanvas("c1"," ",500,500);
TCanvas* c2 = new TCanvas("c2"," ",500,500);
makeMultiPanelCanvas(c1,1,1,-0.16,0,0.16,0.14,0.03);
makeMultiPanelCanvas(c2,1,1,-0.16,0,0.16,0.14,0.03);
TH1F* hFrame=new TH1F("","",400,-20,20);
fixedFontHist(hFrame,1.1,1.7);
hFrame->SetTitle("");
hFrame->GetXaxis()->SetTitleSize(0.05);
hFrame->GetYaxis()->SetTitleSize(0.05);
hFrame->GetXaxis()->SetTitle("Vz (cm)");
hFrame->GetYaxis()->SetTitle("Event Fraction");
hFrame->GetXaxis()->SetLimits(-15,15);
//hFrame->GetXaxis()->SetLimits(-3,3);
hFrame->GetYaxis()->SetRangeUser(0,5e-2);
c1->cd(1);
hFrame->DrawCopy();
histodata->Draw("same");
histo1->Draw("same");
histo2->Draw("HIST same");
TLegend *leg1=new TLegend(0.30,0.80,0.85,0.92);
TLegend *leg2=new TLegend(0.30,0.85,0.85,0.95);
leg1->SetBorderSize(0);
leg2->SetBorderSize(0);
leg1->SetFillColor(0);
leg2->SetFillColor(0);
leg1->SetTextSize(0.04);
leg2->SetTextSize(0.04);
leg1->AddEntry(histo1,"Before Vz weighting","lp");
leg1->AddEntry(histo2,"After Vz weighting","lpf");
//leg1->AddEntry(histo2,"New MC Before Vz weighting","lp");
leg1->AddEntry(histodata,data,"lp");
leg1->Draw("same");
TLatex *T1=new TLatex(0.25,0.92,"");
T1->SetNDC();
T1->SetTextAlign(12);
T1->SetTextSize(0.05);
T1->SetTextColor(1);
T1->SetTextFont(42);
T1->Draw("same");
c2->cd(1);
hFrame->GetYaxis()->SetTitle("Data/MC");
hFrame->GetXaxis()->SetLimits(-15,15);
hFrame->GetYaxis()->SetRangeUser(0,2);
hFrame->DrawCopy();
TH1F* ratio = (TH1F*)histodata->Clone(Form("%sratio",coll.Data()));
//ratio->SetName("ratio");
ratio->Divide(histo1);
/*ratio->Fit(fCen);
cout<<fCen->GetNDF()<<endl;
cout<<fCen->GetChisquare()<<endl;
for(int icent=0;icent<=6;icent++)
cout<<fCen->GetParameter(icent)<<",";
cout<<endl;*/
ratio->DrawCopy("same");
fVz->SetLineColor(2);
fVz->Draw("same");
leg2->AddEntry(ratio,data,"lp");
leg2->AddEntry(fVz,"reweighting function","lp");
leg2->Draw("same");
if(Save){
TFile *fout = new TFile("VzandcentCompare.root","Update");
fout->cd();
ratio->Write("",TObject::kOverwrite);
histo1->Write("",TObject::kOverwrite);
histo2->Write("",TObject::kOverwrite);
histodata->Write("",TObject::kOverwrite);
fout->Close();
c2->Print(Form("ratio_Vz_%s.png",coll.Data()));
c1->Print(Form("VzCompare_Data%s.gif",coll.Data()));
c1->Print(Form("VzCompare_Data%s.pdf",coll.Data()));
}
}
开发者ID:XuQiao,项目名称:HI,代码行数:101,代码来源:CompareVz.C
示例3: TFile
void Loop::myLoop()
{
// Correction factors:
double cA[8] = {0.8567,0.8567,0.8700,0.8610,0.8567,0.8550,0.8630,0.8567};
double cOff[8] = {0.034,0.049,0.049,0.037,0.045,0.049,0.057,0.057};
// Dummy correction factors:
// double cA[8] = {1,1,1,1,1,1,1,1};
// double cOff[8] = {0,0,0,0,0,0,0,0};
TFile *outfile = new TFile("output.root","recreate");
TTree *nt = new TTree("data","ADC readout data");
adcCorrectedData myData;
myData.nch=8;
nt->Branch("nch",&myData.nch,"nch/I");
nt->Branch("run",&myData.run,"run/I");
nt->Branch("evt",&myData.evt,"evt/I");
nt->Branch("evtSecond",&myData.evtSecond,"evtSecond/I");
nt->Branch("evtTime",&myData.evtTime,"evtTime/I");
nt->Branch("pedestal",myData.pedestal,"nch/I");
nt->SetMarkerStyle(20);
for (int i=0;i<8;i++){
nt->Branch(Form("dSize%d",i),&myData.dataSize[i],Form("dSize%d/I",i));
nt->Branch(Form("data%d",i),myData.data[i],Form("data%d[dSize%d]/F",i,i));
nt->Branch(Form("time%d",i),myData.time[i],Form("time%d[dSize%d]/F",i,i));
}
nt->Branch("min",myData.min,"min[8]/F");
nt->Branch("mintime",myData.mintime,"mintime[8]/F");
nt->Branch("mintime08",myData.mintime08,"mintime08[8]/F");
nt->Branch("mintime02",myData.mintime02,"mintime02[8]/F");
nt->Branch("mintime04",myData.mintime04,"mintime04[8]/F");
nt->Branch("mintime0802",myData.mintime0802,"mintime0802[8]/F");
nt->Branch("mintime0804",myData.mintime0804,"mintime0804[8]/F");
//nt->Branch("minSB",myData.minSB,"minSB[8]/F");
//nt->Branch("minSBtime",myData.minSBtime,"minSBtime[8]/F");
char ch;
unsigned long dSize, dummy, trgTime;
unsigned long nbr=0, evt=0;
Long64_t nentries = fChain->GetEntriesFast();
Long64_t nbytes = 0, nb = 0;
for (Long64_t jentry=0; jentry<nentries;jentry++) {
if (jentry % 1000 == 0 ) cout <<jentry<<" / "<<nentries<<" "<<setprecision(2)<<(double)jentry/nentries*100<<"% \r";
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;
Float_t min[8];
Float_t mintime[8];
Float_t minSB[8];
Float_t minSBtime[8];
for (int i=0;i<8;i++) {
myData.min[i]=10e-10;
// myData.minSB[i]=10e-10;
myData.mintime[i]=-100;
// myData.minSBtime[i]=-100;
myData.dataSize[i]=0;
}
nbr=0;
int flag=0;
int minIt[8];
for (int i=0;i<8;i++) {
myData.dataSize[i] = 0;
myData.pedestal[i] = pedestal[i];
minIt[i]=-1;
for (int j=0;j<data[i].size();j++)
{
double pulseHeight = data[i][j]-pedestal[i]; //(((double)data[i][j])/255.-0.5 - cOff[i])/cA[i];
double mytime = time[i][j];
myData.data[i][myData.dataSize[i]] = pulseHeight;
myData.time[i][myData.dataSize[i]] = mytime;
myData.dataSize[i]++;
// fill signal region
if (pulseHeight<myData.min[i]) {
myData.min[i]=pulseHeight;
myData.mintime[i]=mytime;
minIt[i]=myData.dataSize[i]-1;
}
/*
// fill sideband region
if (pulseHeight<myData.minSB[i]) {
if (i!=0) {
if (fabs(mytime-myData.minSBtime[0])>400&&fabs(mytime-myData.minSBtime[0])<500){
myData.minSB[i]=pulseHeight;
//.........这里部分代码省略.........
开发者ID:yenjie,项目名称:usercode,代码行数:101,代码来源:Loop.C
示例4: mutauAfterFit_novbf
// examples macro
void
mutauAfterFit_novbf(bool scaled = true, bool log = true)
{
// defining the common canvas, axes pad styles
SetStyle();
// open example histogram file
TFile* exampleFile = new TFile("root/muTau_sm.root");
//load example histograms
TH1F* data = (TH1F*)exampleFile->Get("muTau_SM0/data_obs");
if(data) {InitHist(data, "#bf{m_{vis} [GeV]}", "#bf{Events}"); InitData(data);} else{std::cout << "can't find hitogram " << "muTau_SM0/data_obs" << std::endl;}
TH1F* Fakes = refill((TH1F*)exampleFile->Get("muTau_SM0/QCD")) ; InitHist(Fakes, "", "", kMagenta-10, 1001);
TH1F* EWK1 = refill((TH1F*)exampleFile->Get("muTau_SM0/W" )) ; InitHist(EWK1 , "", "", kRed + 2, 1001);
TH1F* EWK2 = refill((TH1F*)exampleFile->Get("muTau_SM0/ZJ" )) ; InitHist(EWK2 , "", "", kRed + 2, 1001);
TH1F* EWK3 = refill((TH1F*)exampleFile->Get("muTau_SM0/ZL" )) ; InitHist(EWK3 , "", "", kRed + 2, 1001);
TH1F* EWK = refill((TH1F*)exampleFile->Get("muTau_SM0/VV" )) ; InitHist(EWK , "", "", kRed + 2, 1001);
TH1F* ttbar = refill((TH1F*)exampleFile->Get("muTau_SM0/TT" )) ; InitHist(ttbar, "", "", kBlue - 8, 1001);
TH1F* Ztt = refill((TH1F*)exampleFile->Get("muTau_SM0/ZTT")) ; InitHist(Ztt , "", "", kOrange - 4, 1001);
TH1F* ggH = refill((TH1F*)exampleFile->Get("muTau_SM0/SM120" )) ; InitSignal(ggH); ggH ->Scale(10*1);
TH1F* qqH = refill((TH1F*)exampleFile->Get("muTau_SM0/VBF120")) ; InitSignal(qqH); qqH ->Scale(10*1);
if(scaled){
rescale(Fakes, 2);
rescale(EWK1 , 3);
rescale(EWK2 , 4);
rescale(EWK3 , 5);
rescale(EWK , 7);
rescale(ttbar, 6);
rescale(Ztt , 1);
rescale(ggH , 8);
rescale(qqH , 9);
}
if(log){
qqH ->Add(ggH );
Fakes->Add(qqH );
EWK1 ->Add(Fakes);
EWK2 ->Add(EWK1 );
EWK3 ->Add(EWK2 );
EWK ->Add(EWK3 );
ttbar->Add(EWK );
Ztt ->Add(ttbar);
}
else{
EWK1 ->Add(Fakes);
EWK2 ->Add(EWK1 );
EWK3 ->Add(EWK2 );
EWK ->Add(EWK3 );
ttbar->Add(EWK );
Ztt ->Add(ttbar);
ggH ->Add(Ztt );
qqH ->Add(ggH );
}
// define canvas
TCanvas *canv = MakeCanvas("canv", "histograms", 600, 600);
canv->cd();
if(log){
canv->SetLogy(1);
data->SetMinimum(5.0);
data->SetMaximum(10000000.);
}
else{
data->SetMaximum(14000.);
}
data->SetNdivisions(505);
data->Draw("e");
if(log){
Ztt->Draw("same");
ttbar->Draw("same");
EWK->Draw("same");
Fakes->Draw("same");
qqH->Draw("same");
}
else{
qqH->Draw("same");
Ztt->Draw("same");
ttbar->Draw("same");
EWK->Draw("same");
Fakes->Draw("same");
}
data->Draw("esame");
canv->RedrawAxis();
CMSPrelim("#tau_{#mu}#tau_{h}", 0.45, 0.75);
TLegend* leg = new TLegend(0.45, 0.45, 0.9, 0.75);
SetLegendStyle(leg);
leg->AddEntry(qqH , "(10x) H#rightarrow#tau#tau" , "L" );
leg->AddEntry(data , "Observed" , "LP");
leg->AddEntry(Ztt , "Z#rightarrow#tau#tau" , "F" );
leg->AddEntry(ttbar, "t#bar{t}" , "F" );
leg->AddEntry(EWK , "Electroweak" , "F" );
leg->AddEntry(Fakes, "QCD" , "F" );
leg->Draw();
TPaveText* mssm = new TPaveText(0.78, 0.70, 0.90, 0.74, "NDC");
//.........这里部分代码省略.........
开发者ID:arapyan,项目名称:MitHtt,代码行数:101,代码来源:mutauAfterFit_novbf.C
示例5: calibraPlastico
void calibraPlastico(char* filename, int channel=4) {
FILE *outfile[2];
outfile[0] = fopen("Chi2_511","w");
outfile[1] = fopen("Chi2_1275","w");
Int_t number_of_loop=0;
Int_t i, j, k, i_sm, rsen[2];
Float_t r, alpha, energia;
Int_t b_altezza;
// energies
Float_t E_peak[NUMENERGIES];
Float_t E_compton[NUMENERGIES];
E_peak[0] = 511.;
E_peak[1] = 1275.;
for (i=0; i<NUMENERGIES; i++) {
E_compton[i] = 2*E_peak[i]*E_peak[i]/(511+2*E_peak[i]);
printf("E_compton[%d] = %f;\n",i,E_compton[i]);
}
TTimer *timer = new TTimer("gSystem->ProcessEvents();", 50, kFALSE);
TCanvas *c0 = new TCanvas("c0");
c0->cd();
h_ideal = new TH1F("h_ideal","Compton ideale",NBINS,0,MAXHISTONRG);
// check file existance
f_smearings = new TFile("smearings.root","UPDATE");
// check smearing samples existance
for(i=0; i<NUMENERGIES; i++) {
sprintf(smoothName,"smooth_%.1f_%d;1",E_peak[i],NSMEARINGS-2);
if (!f_smearings->Get(smoothName)) {
cout << smoothName << " " << f_smearings->FindObject(smoothName) << endl;
// smearing for that energy do not exist
printf("Non esistono.\n");
// ideal compton histogram
for (j=0; j<NBINS; j++) {
if (j>h_ideal->FindBin(50) && j<h_ideal->FindBin(E_compton[i])) {
r = h_ideal->GetBinCenter(j)/E_peak[i];
alpha = E_peak[i]/511.0;
energia = KN_NORM * (2+r*r/(alpha*alpha*(1-r)*(1-r))+r/(1-r) * (r-2/alpha));
h_ideal->SetBinContent(j,energia);
} else { h_ideal->SetBinContent(j,0); }
}
h_ideal->Draw();
c0->Update();
timer->TurnOn();
timer->Reset();
timer->TurnOff();
// creazione spettri smussati
for (i_sm=1; i_sm<NSMEARINGS; i_sm++) {
sprintf(smoothName,"smooth_%.1f_%d",E_peak[i],i_sm);
printf("Creo '%s': ",smoothName);
h_smooth = new TH1F(smoothName,"Smooth",NBINS,0,MAXHISTONRG); // istogramma in energia
for (j=1; j<h_ideal->FindBin(E_compton[i]); j++) {
b_altezza = h_ideal->GetBinContent(j);
for (k=1; k<b_altezza; k++){ h_smooth->Fill(gRandom->Gaus(h_ideal->GetBinCenter(j),i_sm)); } printf(".");
} printf("\n");
h_smooth->Write();
}
}
}
// ok, we've got the smearings!
f_smearings->Close();
f_smearings = new TFile("smearings.root","READ");
// ----------------------------------
// retrieving "raw" histogram
// ----------------------------------
TFile *infile = new TFile(filename);
TTree *tree= (TTree*)infile->Get("acq_tree_0");
TBranch *branch = tree->GetBranch(Form("acq_ch%d",channel));
branch->SetAddress(&inc_data.timetag);
TH1F *h_raw = new TH1F("h_raw","Acquisizione",NBINS,0,MAXHISTOCHN);
UInt_t toentry=branch->GetEntries();
printf("getHistoFromFile: There are %d entries in the branch\n",toentry);
for(i=0; i<toentry; i++) {
branch->GetEntry(i);
h_raw->Fill(inc_data.qlong);
}
h_raw->Draw();
TSpectrum *s = new TSpectrum(10);
Int_t e, nPeaks, bTemp, bFirstPeak = 9999;
Float_t *xPeaks;
// trovo il primo picco
nPeaks = s->Search(h_raw->Rebin(2, "h_raw_rebinned"));
if (nPeaks>0) {
xPeaks = s->GetPositionX();
// loop sui picchi per trovare il primo
for (i=0;i<nPeaks;i++) {
bTemp = h_raw->GetXaxis()->FindBin(xPeaks[i]);
if (bTemp<bFirstPeak) { bFirstPeak = bTemp; }
}
//.........这里部分代码省略.........
开发者ID:Clostry,项目名称:analisi,代码行数:101,代码来源:calibraPlastico.C
示例6: drawPlanaconCellPlots
void drawPlanaconCellPlots()
{
TFile* inFile = TFile::Open("plots/plots_studyPlanaconCells_test.root","READ");
TCanvas* c1;
TLatex* latex;
gStyle -> SetPadRightMargin(0.15);
c1 = new TCanvas("c_beamPosition_TDC","c_beamPosition_TDC");
TH2F* h2_beamPosition_TDC = (TH2F*)( inFile->Get("h2_beamPosition_TDC") );
h2_beamPosition_TDC -> Draw("COLZ");
h2_beamPosition_TDC -> SetTitle(";beam x_{TDC} (mm);beam y_{TDC} (mm)");
h2_beamPosition_TDC -> GetZaxis() -> SetRangeUser(0.,100.);
latex = new TLatex(0.13,0.96,Form("eff: %.1f%%",100.*h2_beamPosition_TDC->Integral()/h2_beamPosition_TDC->GetEntries()));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> Draw("same");
c1 -> Print("c_beamPosition_TDC.png","png");
c1 = new TCanvas("c_beamPosition_hodo12","c_beamPosition_hodo12");
TH2F* h2_beamPosition_hodo12 = (TH2F*)( inFile->Get("h2_beamPosition_hodo12") );
h2_beamPosition_hodo12 -> Draw("COLZ");
h2_beamPosition_hodo12 -> SetTitle(";beam x_{hodo1} (mm);beam y_{hodo2} (mm)");
h2_beamPosition_hodo12 -> GetZaxis() -> SetRangeUser(0.,30.);
latex = new TLatex(0.13,0.96,Form("eff: %.1f%%",100.*h2_beamPosition_hodo12->Integral()/h2_beamPosition_TDC->GetEntries()));
latex -> SetNDC();
latex -> SetTextFont(42);
latex -> SetTextSize(0.04);
latex -> Draw("same");
c1 -> Print("c_beamPosition_hodo12.png","png");
c1 = new TCanvas("c_cellPosition_TDC","c_cellPosition_TDC");
TProfile2D* p2_cellPosition_TDC = (TProfile2D*)( inFile->Get("p2_cellPosition_TDC") );
p2_cellPosition_TDC -> Draw("COLZ");
p2_cellPosition_TDC -> SetTitle(";beam x_{TDC} (mm);beam y_{TDC} (mm)");
p2_cellPosition_TDC -> GetZaxis() -> SetRangeUser(0.,30.);
p2_cellPosition_TDC -> GetYaxis() -> SetRangeUser(-145.,-55.);
c1 -> Print("c_cellPosition_TDC.png","png");
c1 = new TCanvas("c_cellPosition_hodo12","c_cellPosition_hodo12");
TProfile2D* p2_cellPosition_hodo12 = (TProfile2D*)( inFile->Get("p2_cellPosition_hodo12") );
p2_cellPosition_hodo12 -> Draw("COLZ");
p2_cellPosition_hodo12 -> SetTitle(";beam x_{hodo1} (mm);beam y_{hodo2} (mm)");
p2_cellPosition_hodo12 -> GetZaxis() -> SetRangeUser(0.,30.);
c1 -> Print("c_cellPosition_hodo12.png","png");
c1 = new TCanvas("c_cellProfileX_hodo12","c_cellProfileX_hodo12");
TProfile* p_cell16ProfileX_hodo12 = (TProfile*)( inFile->Get("p_cell16ProfileX_hodo12") );
p_cell16ProfileX_hodo12 -> SetMarkerColor(kBlack);
p_cell16ProfileX_hodo12 -> SetLineColor(kBlack);
p_cell16ProfileX_hodo12 -> GetYaxis() -> SetRangeUser(0.,400.);
p_cell16ProfileX_hodo12 -> Draw();
p_cell16ProfileX_hodo12 -> Draw("hist,same");
p_cell16ProfileX_hodo12 -> SetTitle(";beam x_{hodo1} (mm);");
TProfile* p_cell17ProfileX_hodo12 = (TProfile*)( inFile->Get("p_cell17ProfileX_hodo12") );
p_cell17ProfileX_hodo12 -> SetMarkerColor(kRed+3);
p_cell17ProfileX_hodo12 -> SetLineColor(kRed+3);
p_cell17ProfileX_hodo12 -> Draw("same");
p_cell17ProfileX_hodo12 -> Draw("hist,same");
TProfile* p_cell18ProfileX_hodo12 = (TProfile*)( inFile->Get("p_cell18ProfileX_hodo12") );
p_cell18ProfileX_hodo12 -> SetMarkerColor(kRed+2);
p_cell18ProfileX_hodo12 -> SetLineColor(kRed+2);
p_cell18ProfileX_hodo12 -> Draw("same");
p_cell18ProfileX_hodo12 -> Draw("hist,same");
TProfile* p_cell19ProfileX_hodo12 = (TProfile*)( inFile->Get("p_cell19ProfileX_hodo12") );
p_cell19ProfileX_hodo12 -> SetMarkerColor(kRed+1);
p_cell19ProfileX_hodo12 -> SetLineColor(kRed+1);
p_cell19ProfileX_hodo12 -> Draw("same");
p_cell19ProfileX_hodo12 -> Draw("hist,same");
TProfile* p_cell20ProfileX_hodo12 = (TProfile*)( inFile->Get("p_cell20ProfileX_hodo12") );
p_cell20ProfileX_hodo12 -> SetMarkerColor(kRed);
p_cell20ProfileX_hodo12 -> SetLineColor(kRed);
p_cell20ProfileX_hodo12 -> Draw("same");
p_cell20ProfileX_hodo12 -> Draw("hist,same");
TProfile* p_cell21ProfileX_hodo12 = (TProfile*)( inFile->Get("p_cell21ProfileX_hodo12") );
p_cell21ProfileX_hodo12 -> SetMarkerColor(kRed-7);
p_cell21ProfileX_hodo12 -> SetLineColor(kRed-7);
p_cell21ProfileX_hodo12 -> Draw("same");
p_cell21ProfileX_hodo12 -> Draw("hist,same");
//.........这里部分代码省略.........
开发者ID:abenagli,项目名称:TBatH4Nov2014,代码行数:101,代码来源:drawPlanaconCellPlots.C
示例7: process
int process(TString nameChain, TString file, int iFile, int nEntries, TString dirOut,
TString dirIn, ofstream& outlog, int iJson, TString RunPhase, bool debug) {
// OUTPUT FILE //
ostringstream ossi("");
ossi << iFile ;
TString name = dirIn;
name +="elepairs_";
name +=ossi.str();
name +=".root";
//TString name=(TString)(dirIn+"elepairs_"+ossi.str()+".root");
TFile *outfile = new TFile(name,"RECREATE");
ossi.str("");
// INPUT TREE //
TChain * myChain = new TChain(nameChain);
myChain->Add(file);
cout<<"test1"<<endl;
int nEvent, nRun, nLumi ;
// Vertices //
int _vtx_N;
double _vtx_x[200], _vtx_y[200], _vtx_z[200];
double _vtx_normalizedChi2[200], _vtx_ndof[200], _vtx_nTracks[200], _vtx_d0[200];
// Trigger Paths //
int trig_hltInfo[250];
int _trig_isEleHLTpath;
int trig_HLT_path[4]; // unbias, EG5, EG8, EG12
char trig_fired_names[5000];
//
vector<string> m_HLT_pathsV;
vector<string> m_HLT_triggered;
vector<int> m_HLT_pathsV_check;
// m_HLT_pathsV.clear();
// m_HLT_pathsV_check.clear();
// for(int iP=0 ; iP<(int)HLT_paths_.size() ; iP++) {
// m_HLT_pathsV.push_back( HLT_paths_[iP]);
// m_HLT_pathsV_check.push_back(0);
// }
// Electrons
TClonesArray * electrons = new TClonesArray ("TLorentzVector");
int ele_N, sc_hybrid_N;
int ele_outOfTimeSeed[10],ele_severityLevelSeed[10];
double ele_he[10], ele_sigmaietaieta[10];
double ele_hcalDepth1TowerSumEt_dr03[10], ele_hcalDepth2TowerSumEt_dr03[10];
double ele_ecalRecHitSumEt_dr03[10], ele_tkSumPt_dr03[10];
double ele_sclEta[10], ele_sclEt[10];
//double ecalIsoRel03,hcalIsoRel03,trackIsoRel03;
double ele_deltaphiin[10], ele_deltaetain[10];
double ele_conv_dist[10], ele_conv_dcot[10];
double ele_fbrem[10];
int ele_expected_inner_hits[10];
//int ele_ambiguousGsfTracks[10];
int ele_isConversion[10];
int ele_echarge[10];
//
int ele_RCTeta[10], ele_RCTphi[10], ele_RCTL1iso[10], ele_RCTL1noniso[10], ele_RCTL1iso_M[10], ele_RCTL1noniso_M[10];
int ele_TTetaVect[10][50], ele_TTphiVect[10][50];
double ele_TTetVect[10][50];
int ele_RCTetaVect[10][10], ele_RCTphiVect[10][10], ele_RCTL1isoVect[10][10],
ele_RCTL1nonisoVect[10][10],ele_RCTL1isoVect_M[10][10], ele_RCTL1nonisoVect_M[10][10];
double ele_RCTetVect[10][10];
// TP info
const int nTow = 4032;
int trig_tower_N,trig_tower_ieta[nTow],trig_tower_iphi[nTow],trig_tower_adc[nTow],trig_tower_sFGVB[nTow];
int trig_tower_N_M,trig_tower_ieta_M[nTow],trig_tower_iphi_M[nTow],trig_tower_adc_M[nTow],trig_tower_sFGVB_M[nTow];
int trig_tower_N_E,trig_tower_ieta_E[nTow],trig_tower_iphi_E[nTow],trig_tower_adc_E[nTow][5],trig_tower_sFGVB_E[nTow][5];
// HCAL TP
int trig_tower_hcal_N, trig_tower_hcal_ieta[4032], trig_tower_hcal_iphi[4032], trig_tower_hcal_FG[4032],trig_tower_hcal_et[4032];
int trig_L1emIso_N, trig_L1emNonIso_N, trig_L1emIso_N_M, trig_L1emNonIso_N_M;
// L1 candidates info
int trig_L1emIso_ieta[4], trig_L1emIso_iphi[4], trig_L1emIso_rank[4];
int trig_L1emNonIso_ieta[4], trig_L1emNonIso_iphi[4], trig_L1emNonIso_rank[4];
int trig_L1emIso_ieta_M[4], trig_L1emIso_iphi_M[4], trig_L1emIso_rank_M[4];
int trig_L1emNonIso_ieta_M[4], trig_L1emNonIso_iphi_M[4], trig_L1emNonIso_rank_M[4];
// L1 prefiring
int trig_preL1emIso_N;
int trig_preL1emNonIso_N;
int trig_preL1emIso_ieta[4], trig_preL1emIso_iphi[4], trig_preL1emIso_rank[4];
int trig_preL1emNonIso_ieta[4], trig_preL1emNonIso_iphi[4],trig_preL1emNonIso_rank[4];
// L1 postfiring
int trig_postL1emIso_N;
int trig_postL1emNonIso_N;
int trig_postL1emIso_ieta[4], trig_postL1emIso_iphi[4], trig_postL1emIso_rank[4];
int trig_postL1emNonIso_ieta[4], trig_postL1emNonIso_iphi[4],trig_postL1emNonIso_rank[4];
// Masking
int trig_nMaskedRCT, trig_nMaskedCh;
int trig_iMaskedRCTeta[100], trig_iMaskedRCTphi[100], trig_iMaskedRCTcrate[100], trig_iMaskedTTeta[100], trig_iMaskedTTphi[100];
int trig_strip_mask_N;
int trig_strip_mask_TTieta[1000], trig_strip_mask_TTiphi[1000], trig_strip_mask_status[1000],
//.........这里部分代码省略.........
开发者ID:fanbomeng,项目名称:Ecal_Turnon_2012_data,代码行数:101,代码来源:makePairs52X.1.3.2.C
示例8: listMismatchedEvents
void listMismatchedEvents(TString inputFile = "L1UnpackedPureEmulator.root", testObject type = Jets)
{
TFile *inFile = TFile::Open(inputFile);
TTree *emulatorResults = (TTree*)inFile->Get("EmulatorResults/L1UpgradeTree");
TTree *unpackerResults = (TTree*)inFile->Get("UnpackerResults/L1UpgradeTree");
int event, run, lumi;
emulatorResults->SetBranchAddress("event",&event);
emulatorResults->SetBranchAddress("run",&run);
emulatorResults->SetBranchAddress("lumi",&lumi);
std::vector<int> *e_hwPt =0;
std::vector<int> *e_hwEta =0;
std::vector<int> *e_hwPhi =0;
std::vector<int> *e_bx =0;
int e_N;
std::vector<int> *u_hwPt =0;
std::vector<int> *u_hwEta =0;
std::vector<int> *u_hwPhi =0;
std::vector<int> *u_bx =0;
int u_N;
TString prefix;
TString nPrefix;
switch(type) {
case Jets:
prefix = "jet";
nPrefix = "Jet";
break;
case EGammas:
prefix = "egamma";
nPrefix = "Egamma";
break;
case Taus:
prefix = "tau";
nPrefix = "Tau";
break;
case Centrality:
prefix = "hfring";
nPrefix = "Hfring";
break;
default:
prefix = "jet";
nPrefix = "Jet";
break;
}
emulatorResults->SetBranchAddress(prefix + "_hwPt",&e_hwPt);
emulatorResults->SetBranchAddress(prefix + "_hwEta",&e_hwEta);
emulatorResults->SetBranchAddress(prefix + "_hwPhi",&e_hwPhi);
emulatorResults->SetBranchAddress(prefix + "_bx",&e_bx);
emulatorResults->SetBranchAddress("n"+nPrefix,&e_N);
unpackerResults->SetBranchAddress(prefix + "_hwPt",&u_hwPt);
unpackerResults->SetBranchAddress(prefix + "_hwEta",&u_hwEta);
unpackerResults->SetBranchAddress(prefix + "_hwPhi",&u_hwPhi);
unpackerResults->SetBranchAddress(prefix + "_bx",&u_bx);
unpackerResults->SetBranchAddress("n"+nPrefix,&u_N);
long misses = 0;
long entries = emulatorResults->GetEntries();
for(long i = 0; i < entries; i++)
{
emulatorResults->GetEntry(i);
unpackerResults->GetEntry(i);
int e_offset = 0;
int u_offset = 0;
// e_offset will always be 0, but make sure that we are not one of the
// 1/100 events with multiple RCT BX.
// there are 4 taus per event, 8 jets, 8 egammas, and 1 centrality
if(e_N == 4)
{
e_offset = 0;
}
else if (e_N == 8)
{
e_offset = 0;
}
else if (e_N == 1)
{
e_offset = 0;
}
else
{
// there are multiple BX here and I don't know the alignment
// skip the event
continue;
}
// there are 20 taus per events, 40 jets, 40 egammas, and 5 centralities because of extra BX
if (u_N == 5)
{
u_offset = 2;
}
else if (u_N == 20)
{
u_offset = 8;
}
//.........这里部分代码省略.........
开发者ID:richard-cms,项目名称:L1UpgradeAnalyzer,代码行数:101,代码来源:listMismatchedEvents.C
示例9: main
int main(int argc, char** argv)
{
// Input parameters
std::cout << "\n*******************************************************************************************************************" << std::endl;
std::cout << "arcg: " << argc << std::endl;
//Check if all nedeed arguments to parse are there
if(argc != 2)
{
std::cerr << ">>>>> Analyses::usage: " << argv[0] << " configFileName " << std::endl ;
return 1;
}
/// Parse the config file
parseConfigFile (argv[1]) ;
std::string inputDir = gConfigParser -> readStringOption("Input::inputDir");
std::string outputName = gConfigParser -> readStringOption("Output::outputName");
system(("ls "+inputDir+" | grep root | awk '{print}' > inputFileAdd.dat").c_str() );
std::map<int, TFile*> Files;
std::map<int, std::map<int, TH2F*> > Histos;
std::map<int, TH2F* > FinalHistos;
std::map<int,std::string> FileName;
std::map<int,std::string> HistoName;
char file[1000];
FILE *f_file;
f_file = fopen("inputFileAdd.dat","r");
int file_pos = 0;
int file_tot = 0;
int histo_tot = 0;
while(fscanf(f_file,"%s \n", file) !=EOF ){
std::string FILE = std::string(file);
if(FILE.find("#") != std::string::npos) continue;
std::cout << "\nReading File: " << file << std::endl;
Files[file_pos] = TFile::Open((inputDir+"/"+file).c_str());
file_pos++;
}
file_tot = file_pos;
HistoName[0] = std::string("h2_BTaggingEff_Denom_b_L");
HistoName[1] = std::string("h2_BTaggingEff_Num_b_L");
HistoName[2] = std::string("h2_BTaggingEff_Denom_b_M");
HistoName[3] = std::string("h2_BTaggingEff_Num_b_M");
HistoName[4] = std::string("h2_BTaggingEff_Denom_b_T");
HistoName[5] = std::string("h2_BTaggingEff_Num_b_T");
HistoName[6] = std::string("h2_BTaggingEff_Denom_c_L");
HistoName[7] = std::string("h2_BTaggingEff_Num_c_L");
HistoName[8] = std::string("h2_BTaggingEff_Denom_c_M");
HistoName[9] = std::string("h2_BTaggingEff_Num_c_M");
HistoName[10] = std::string("h2_BTaggingEff_Denom_c_T");
HistoName[11] = std::string("h2_BTaggingEff_Num_c_T");
HistoName[12] = std::string("h2_BTaggingEff_Denom_udsg_L");
HistoName[13] = std::string("h2_BTaggingEff_Num_udsg_L");
HistoName[14] = std::string("h2_BTaggingEff_Denom_udsg_M");
HistoName[15] = std::string("h2_BTaggingEff_Num_udsg_M");
HistoName[16] = std::string("h2_BTaggingEff_Denom_udsg_T");
HistoName[17] = std::string("h2_BTaggingEff_Num_udsg_T");
histo_tot = 18;
float ptmin[21] = {20., 30., 40., 50., 60., 70., 80., 100., 120., 160., 210., 260., 320., 400., 500., 600., 800.,900.,1000.,1200.,1500.};
float etamin[8] = {0.,0.5,1.,1.5,2.,2.5,3.,3.5};
TH2F* h2_BTaggingEff_b_L = new TH2F("h2_BTaggingEff_b_L","h2_BTaggingEff_b_L",20, ptmin, 7,etamin);
TH2F* h2_BTaggingEff_b_M = new TH2F("h2_BTaggingEff_b_M","h2_BTaggingEff_b_M",20, ptmin, 7,etamin);
TH2F* h2_BTaggingEff_b_T = new TH2F("h2_BTaggingEff_b_T","h2_BTaggingEff_b_T",20, ptmin, 7,etamin);
TH2F* h2_BTaggingEff_c_L = new TH2F("h2_BTaggingEff_c_L","h2_BTaggingEff_c_L",20, ptmin, 7,etamin);
TH2F* h2_BTaggingEff_c_M = new TH2F("h2_BTaggingEff_c_M","h2_BTaggingEff_c_M",20, ptmin, 7,etamin);
TH2F* h2_BTaggingEff_c_T = new TH2F("h2_BTaggingEff_c_T","h2_BTaggingEff_c_T",20, ptmin, 7,etamin);
TH2F* h2_BTaggingEff_udsg_L = new TH2F("h2_BTaggingEff_udsg_L","h2_BTaggingEff_udsg_L",20, ptmin, 7,etamin);
TH2F* h2_BTaggingEff_udsg_M = new TH2F("h2_BTaggingEff_udsg_M","h2_BTaggingEff_udsg_M",20, ptmin, 7,etamin);
TH2F* h2_BTaggingEff_udsg_T = new TH2F("h2_BTaggingEff_udsg_T","h2_BTaggingEff_udsg_T",20, ptmin, 7,etamin);
if (file_tot == 0 )
{
std::cout << "Error: give at least one file!" << std::endl;
return -1;
}
for(int ii = 0; ii < file_tot; ii++)
for(int jj = 0; jj < histo_tot; jj++)
Histos[ii][jj] = (TH2F*)Files[ii]->Get(HistoName[jj].c_str());
for(int jj = 0; jj < histo_tot; jj++){
FinalHistos[jj] = (TH2F*)Histos[0][jj]->Clone((HistoName[jj]).c_str());
//FinalHistos[jj]->Sumw2();
//.........这里部分代码省略.........
开发者ID:ResonantHbbHgg,项目名称:BtagCodes,代码行数:101,代码来源:AddHistos2D.cpp
示例10: Wpt_ZmassCompEtaBins_Gaus
void Wpt_ZmassCompEtaBins_Gaus(const TString Mode,//Channel - Muon or Electron
const TString corrName,
const TString outputDir
)
{
TString plotTitle;
TString mu_etaRange[6];
mu_etaRange[0] = "-2.1 #geq eta < -1.4";
mu_etaRange[1] = "-1.4 #geq eta < -0.7";
mu_etaRange[2] = "-0.7 #geq eta < 0";
mu_etaRange[3] = "0 #geq eta < 0.7";
mu_etaRange[4] = "0.7 #geq eta < 1.4";
mu_etaRange[5] = "1.4 #geq eta < 2.1";
TH1D* makeDiffHist(TH1D* h1, TH1D* h2, const TString name);
const TString format("png");
Int_t ratioColor = kGray+2;
TFile *fname_MC;
TFile *fname_RD;
gSystem->mkdir(outputDir,kTRUE);
CPlot::sOutDir = outputDir;
fname_MC = new TFile("Muon2012LoPU/Muon_DYToMuMu_S8.root");
fname_RD = new TFile("Muon2012LoPU/Muon_RD_LowPU.root");
if(Mode=="Electron")
{
fname_MC = new TFile("Electron2012LoPU/Ele_DYToEE_S8.root");
fname_RD = new TFile("Electron2012LoPU/Ele_RD_LowPU.root");
}
CPlot *plotMllEtaBinP;
CPlot *plotMllEtaBinM;
CPlot *plotMllEtameanP;
CPlot *plotMllEtameanM;
CPlot *plotMllEtawidthP;
CPlot *plotMllEtawidthM;
TH1D *hMCetaBinP[ScaleBins];
TH1D *hRDetaBinP[ScaleBins];
TH1D *hMCetaBinM[ScaleBins];
TH1D *hRDetaBinM[ScaleBins];
RooDataHist *h1_MCetaBinP;
RooDataHist *h1_RDetaBinP;
RooDataHist *h1_MCetaBinM;
RooDataHist *h1_RDetaBinM;
TH1D *hMCmeanp = new TH1D("hMCmeanp","hMCmeanp",ScaleBins,-2.1,2.1);hMCmeanp->Sumw2();
TH1D *hRDmeanp = new TH1D("hRDmeanp","hRDmeanp",ScaleBins,-2.1,2.1);hRDmeanp->Sumw2();
TH1D *hMCmeanm = new TH1D("hMCmeanm","hMCmeanm",ScaleBins,-2.1,2.1);hMCmeanm->Sumw2();
TH1D *hRDmeanm = new TH1D("hRDmeanm","hRDmeanm",ScaleBins,-2.1,2.1);hRDmeanm->Sumw2();
TH1D *hMCwidthp = new TH1D("hMCwidthp","hMCwidthp",ScaleBins,-2.1,2.1);hMCwidthp->Sumw2();
TH1D *hRDwidthp = new TH1D("hRDwidthp","hRDwidthp",ScaleBins,-2.1,2.1);hRDwidthp->Sumw2();
TH1D *hMCwidthm = new TH1D("hMCwidthm","hMCwidthm",ScaleBins,-2.1,2.1);hMCwidthm->Sumw2();
TH1D *hRDwidthm = new TH1D("hRDwidthm","hRDwidthm",ScaleBins,-2.1,2.1);hRDwidthm->Sumw2();
char histName[50];
char tmpName[50];
TCanvas *myCan;
myCan = MakeCanvas("myCan","myCan",800,600);
myCan->SetPad(0,0,1.0,1.0);
myCan->SetTopMargin(0.11);
myCan->SetBottomMargin(0.15);
myCan->SetLeftMargin(0.15);
myCan->SetRightMargin(0.05);
myCan->SetTickx(1);
myCan->SetTicky(1);
//=============================
//Read Zmass histograms for each pt bin
//=============================
for(int i(0);i<ScaleBins;i++){
sprintf(tmpName,"h1_Zmass_muEtaP_%d",i);
if(corrName=="CorrTotalRegion")
sprintf(tmpName,"h1_ZmassCorr_muEtaP_%d",i);
if(outputDir=="Wpt_ZmassPlotsEtaBins_noOverLap_Gaus")
{
sprintf(tmpName,"h1_Zmass_noOverLap_muEtaP_%d",i);
if(corrName=="CorrTotalRegion")
sprintf(tmpName,"h1_ZmassCorr_noOverLap_muEtaP_%d",i);
}
if(outputDir=="Wpt_ZmassPlotsEtaBins_LeadingLept_noOverLap_Gaus")
{
sprintf(tmpName,"h1_Zmass_LeadingLept_noOverLap_muEtaP_%d",i);
if(corrName=="CorrTotalRegion")
sprintf(tmpName,"h1_ZmassCorr_LeadingLept_noOverLap_muEtaP_%d",i);
}
if(outputDir=="Wpt_ZmassPlotsEtaBins_LeadingLept_Gaus")
{
sprintf(tmpName,"h1_Zmass_LeadingLept_muEtaP_%d",i);
if(corrName=="CorrTotalRegion")
//.........这里部分代码省略.........
开发者ID:d4space,项目名称:TerraNova,代码行数:101,代码来源:Wpt_ZmassCompEtaBins_Gaus.C
示例11: comp_RpPb_rap_Overlay
void comp_RpPb_rap_Overlay(bool isPoint=true, bool isSmoothened=false)
{
gROOT->Macro("./tdrstyle_kyo.C");
int isPA = 10; // 0:pp, 1:pPb, 10 : pp & pPb together for RpPb plot
int iPos=33;
bool isPrompt=true;
const Double_t pp_lumi_relerr = 0.023; // 2.3 %
const Double_t pPb_lumi_relerr = 0.035; // 3.5 %
const Double_t glb_err = TMath::Sqrt(pp_lumi_relerr*pp_lumi_relerr+pPb_lumi_relerr*pPb_lumi_relerr);
//cout << "glb_err = " << glb_err << endl;
///////////////////////////////////////////////////
const int nRap = 8;
const int nRapTmp = nRap + 1;
const int nRapRpPb = 7;
const int nRapRpPbTheory = 6; //Ramona..
//const int nPtRpPb = 49;
const int nPtRpPb = 2;
Double_t theory_px[nPtRpPb][nRapRpPbTheory];
Double_t theory_py[nPtRpPb][nRapRpPbTheory];
//Double_t theory_exlow_tmp[nPtRpPb][nRapRpPbTheory];
//Double_t theory_exhigh_tmp[nPtRpPb][nRapRpPbTheory];
Double_t theory_exlow[nPtRpPb][nRapRpPbTheory];
Double_t theory_exhigh[nPtRpPb][nRapRpPbTheory];
Double_t theory_eylow_tmp[nPtRpPb][nRapRpPbTheory];
Double_t theory_eyhigh_tmp[nPtRpPb][nRapRpPbTheory];
Double_t theory_eylow[nPtRpPb][nRapRpPbTheory];
Double_t theory_eyhigh[nPtRpPb][nRapRpPbTheory];
//// 1) y_CM array (from forward to backward)
Double_t rapArrNumFB[nRapTmp] = {1.93, 1.5, 0.9, 0., -0.9, -1.5, -1.93, -2.4, -2.87};// for pt dist.
//Double_t rapArrNumBF[nRapTmp] = {-2.87, -2.4, -1.93, -1.5, -0.9, 0., 0.9, 1.5, 1.93};// for rap dist.
//// array string
TString rapArr[nRap];
for (Int_t iy=0; iy<nRap; iy++) {
formRapArr(rapArrNumFB[iy+1], rapArrNumFB[iy], &rapArr[iy]);
cout << iy <<"th rapArr = " << rapArr[iy] << endl;
}
///////////////////////////////////////////////////
//////// experimental points
TFile *inFile = new TFile("../DrawFinalPlot/plot_RpPb/RpPb_rap_isPrompt1.root");
TGraphAsymmErrors* g_RpPb_sys[nRapRpPb];
TGraphAsymmErrors* g_RpPb_sys_line[nRapRpPb];
TGraphAsymmErrors* g_RpPb[nRapRpPb];
g_RpPb_sys[0] = (TGraphAsymmErrors*)inFile->Get("g_RpPb_sys_lowpt");
g_RpPb_sys_line[0] = (TGraphAsymmErrors*)inFile->Get("g_RpPb_sys_lowpt_line");
g_RpPb[0] = (TGraphAsymmErrors*)inFile->Get("g_RpPb_lowpt");
g_RpPb_sys[1] = (TGraphAsymmErrors*)inFile->Get("g_RpPb_sys_highpt");
g_RpPb_sys_line[1] = (TGraphAsymmErrors*)inFile->Get("g_RpPb_sys_highpt_line");
g_RpPb[1] = (TGraphAsymmErrors*)inFile->Get("g_RpPb_highpt");
g_RpPb_sys[0]->SetName("g_RpPb_sys_lowpt");
g_RpPb_sys_line[0]->SetName("g_RpPb_sys_lowpt_line");
g_RpPb_sys[1]->SetName("g_RpPb_sys_highpt");
g_RpPb_sys_line[1]->SetName("g_RpPb_sys_highpt_line");
//g_RpPb_sys[0]->SetFillColorAlpha(kRed-10,0.5);
//g_RpPb_sys_line[0]->SetFillColorAlpha(kRed-10,0.);
//g_RpPb_sys_line[0]->SetLineColor(kPink-6);
//g_RpPb_sys[1]->SetFillColorAlpha(kGreen-10,0.5);
//g_RpPb_sys_line[1]->SetFillColorAlpha(kGreen-10,0.);
//g_RpPb_sys_line[1]->SetLineColor(kGreen+3);
g_RpPb_sys_line[0]->SetFillColorAlpha(kRed-10,0.);
g_RpPb_sys_line[1]->SetFillColorAlpha(kRed-10,0.);
for (int ipt = 0 ; ipt < nPtRpPb; ipt ++ ) {
if (isPoint) {
g_RpPb_sys[ipt]->SetFillColorAlpha(kRed-10,0.5);
g_RpPb_sys[ipt]->SetLineColor(kPink-6);
} else {
g_RpPb_sys[ipt]->SetFillColor(kWhite);
g_RpPb_sys[ipt]->SetLineColor(kWhite);
}
g_RpPb[ipt]->SetMarkerColor(kPink-6);
g_RpPb[ipt]->SetLineColor(kPink-6);
g_RpPb[ipt]->SetMarkerStyle(kFullCircle);
g_RpPb[ipt]->SetMarkerSize(1.4);
}
///////////////////////////////////////////////////
//////// theory curves
// const int nTheory = 4;
const int nTheory = 3;
TFile *inFileTh[nTheory];
inFileTh[0]= new TFile("./plot_theory/comp_RpPb_rap_isSmoothened0_Vogt.root","READ");
inFileTh[1]= new TFile("./plot_theory/comp_RpPb_rap_isSmoothened0_Lansberg_EPS09NLO.root","READ");
inFileTh[2]= new TFile("./plot_theory/comp_RpPb_rap_isSmoothened0_Lansberg_nCTEQ15.root","READ");
TGraphAsymmErrors* g_RpPb_theory[nTheory][nPtRpPb];
TGraphAsymmErrors* g_RpPb_theory_line[nTheory][nPtRpPb];
for (int ith = 0 ; ith < nTheory; ith ++ ) {
for (int ipt = 0 ; ipt < nPtRpPb; ipt ++ ) {
g_RpPb_theory[ith][ipt] = (TGraphAsymmErrors*)inFileTh[ith]->Get(Form("g_RpPb_theory_%d",ipt));
g_RpPb_theory[ith][ipt]->SetName(Form("g_RpPb_theory_%d_%d",ith,ipt));
g_RpPb_theory_line[ith][ipt] = (TGraphAsymmErrors*)inFileTh[ith]->Get(Form("g_RpPb_theory_%d",ipt));
g_RpPb_theory_line[ith][ipt]->SetName(Form("g_RpPb_theory_line_%d_%d",ith,ipt));
}
}
//.........这里部分代码省略.........
开发者ID:CmsHI,项目名称:pPbJPsiAnalysis,代码行数:101,代码来源:comp_RpPb_rap_Overlay.C
示例12: draw_1D_RFB_ETHF_tworange
//.........这里部分代码省略.........
Double_t rapBinW[nRap];
for (Int_t iy=0; iy<nRap; iy++) {
rapBinW[iy] = rapArrNumFB[iy]-rapArrNumFB[iy+1];
cout << iy <<"th rapBinW = " << rapBinW[iy] <<endl;
}
//pt array
Double_t ptArrNum[nPtTmp] = {5.0, 6.5, 10., 30.}; //6rap3pt
Double_t ptBinW[nPt];
for (Int_t ipt=0; ipt<nPt; ipt++) {
ptBinW[ipt] = ptArrNum[ipt+1]-ptArrNum[ipt];
cout << ipt <<"th ptBinW = " << ptBinW[ipt] <<endl;
}
//ethf array
Double_t etArrNum[nEtTmp] = {0.0, 20.0, 30.0, 120.0};
// array string
string rapArr[nRap];
for (Int_t iy=0; iy<nRap; iy++) {
formRapArr(rapArrNumFB[iy+1], rapArrNumFB[iy], &rapArr[iy]);
cout << iy <<"th rapArr = " << rapArr[iy] &l
|
请发表评论