本文整理汇总了C++中TProfile::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ TProfile::Draw方法的具体用法?C++ TProfile::Draw怎么用?C++ TProfile::Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TProfile
的用法示例。
在下文中一共展示了TProfile::Draw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Plot2DHisto
void Plot2DHisto(TH2D* plothist, char xTitle[200], char yTitle[200], char savename[200], char tex[200]) {
TGaxis::SetMaxDigits(3);
TCanvas *c1 = new TCanvas("", "", 1200, 1000);
gStyle->SetPalette(1);
gStyle->SetOptStat(0);
gPad->SetFillColor(kWhite);
gPad->SetLeftMargin(0.15);
gPad->SetRightMargin(0.2);
gPad->SetTopMargin(0.1);
double yOffset=1.4;
plothist->GetYaxis()->SetTitleOffset(yOffset);
plothist->SetStats(0);
plothist->SetTitle(0);
plothist->GetYaxis()->SetTitle(yTitle);
plothist->GetXaxis()->SetTitle(xTitle);
plothist->SetMinimum(0.);
plothist->Draw("colz");
double left=0.25, top=0.935, textSize=0.04;
TLatex *latex=new TLatex();
latex->SetTextFont(42);
latex->SetNDC(kTRUE);
latex->SetTextSize(textSize);
latex->DrawLatex(left,top,tex);
char linlog_savename[200];
c1->SetLogz(false);
sprintf(linlog_savename,"%s_lin.pdf",savename);
c1->SaveAs(linlog_savename);
c1->SetLogz(true);
sprintf(linlog_savename,"%s_log.pdf",savename);
c1->SaveAs(linlog_savename);
TProfile* profileX = plothist->ProfileX("", 1, -1, "so");
TProfile* profileY = plothist->ProfileY("", 1, -1, "so");
profileX->Draw("same");
sprintf(linlog_savename,"%s_log_AddProfile.pdf",savename);
c1->SaveAs(linlog_savename);
profileX->Draw();
latex->DrawLatex(left,top,tex);
sprintf(linlog_savename,"%s_log_ProfileX.pdf",savename);
c1->SaveAs(linlog_savename);
profileY->Draw();
latex->DrawLatex(left,top,tex);
sprintf(linlog_savename,"%s_log_ProfileY.pdf",savename);
c1->SaveAs(linlog_savename);
delete c1;
delete latex;
}
示例2: explore_zmass_boost
void explore_zmass_boost()
{
// Tell root not to draw everything to the screen.
gROOT->SetBatch();
// TString dyfilename = TString("/home/acarnes/h2mumu/samples/stage1/monte_carlo/bg/stage_1_dy_jetsToLL_asympt50_ALL.root");
TString dyfilename = TString("/home/acarnes/h2mumu/samples/stage1/monte_carlo/bg/stage_1_dy_ZToMuMu_asympt50_ALL.root");
TString datafilename = TString("/home/acarnes/h2mumu/samples/stage1/data_from_json/Cert_246908-251883_13TeV_PromptReco_Collisions15_JSON_v2/stage_1_doubleMuon_RunBPrompt_MINIAOD.root");
TString savedir = TString("../png/dy_vs_data/run1cuts_v2_golden_json/dyzmumu/");
// Initialize the DiMuPlottingSystems for MC and data
DiMuPlottingSystem* dpsdata = new DiMuPlottingSystem(datafilename);
DiMuPlottingSystem* dpsdy = new DiMuPlottingSystem(dyfilename);
addDiMuMassPrimeBranch(dpsdata);
dpsdata->applyRun1Cuts();
dpsdy->applyRun1Cuts();
// Get the 2D histos
TH2F* hdataZPt = ZMassVsZPtHist2D("data_zpt", "recoCandMassPrime", "(14,0,60,30,87,95)", dpsdata);
TH2F* hdyZPt = ZMassVsZPtHist2D("dy_zpt", "recoCandMass", "(14,0,60,30,87,95)", dpsdy);
//overlayTProfiles(TH2F* hdata, TH2F* hdy, TString bininfo, TString savename)
TProfile* p = overlayTProfiles(hdataZPt, hdyZPt, 90, 92, savedir+"z_mass_vs_z_pt.png");
gStyle->SetOptFit(0011);
fitTProfileCustom(p);
TCanvas* c = new TCanvas();
c->cd();
p->Draw("hist c");
p->Draw("E0 X0 same");
dpsdata->arrangeStatBox(c);
c->Draw();
c->Print("blah2.png");
// Look at RMS
c->Clear();
c->cd();
c->SetGridx(kTRUE);
c->SetGridy(kTRUE);
c->cd();
TH1F* h = dpsdata->hist1D("recoCandMass", "(100,87,95)", "");
TH1F* h2 = dpsdata->hist1D("recoCandMassPrime", "(100,87,95)", "");
h2->SetLineColor(2);
h->Draw("");
h2->Draw("same");
std::cout << "mass rms: " << h->GetRMS() << std::endl;
std::cout << "mass' rms: " << h2->GetRMS() << std::endl;
std::cout << "mass mean: " << h->GetMean() << std::endl;
std::cout << "mass' mean: " << h2->GetMean() << std::endl;
std::cout << "mass num: " << h->Integral() << std::endl;
std::cout << "mass' num: " << h2->Integral() << std::endl;
DiMuPlottingSystem* dps = new DiMuPlottingSystem();
dps->arrangeStatBox(c);
c->Draw();
c->Print("newfit.png");
}
示例3: overlayTProfiles
TProfile* overlayTProfiles(TH2F* hdata, TH2F* hdy, float ymin, float ymax, TString savename)
{
// See how the mean of the dimumass changes vs some variable by making TProfiles of a 2D histogram with the Dimu mass as the y axis.
// Compare data to MC and save the results as png files.
TString dataname = TString("Golden_JSON_DoubleMuon_Data");
TString dyname = TString("Drell_Yan_Monte_Carlo_2015");
// Make TProfiles from them to see how the mean changes vs the x variable.
TProfile* pdata = hdata->ProfileX();
pdata->SetLineColor(1);
pdata->SetLineWidth(3);
pdata->SetTitle(hdata->GetTitle());
pdata->GetYaxis()->SetTitle(hdata->GetYaxis()->GetTitle());
TProfile* pdy = hdy->ProfileX();
pdy->SetLineColor(2);
pdy->SetLineWidth(3);
pdy->SetTitle(hdy->GetTitle());
pdy->GetYaxis()->SetTitle(hdy->GetYaxis()->GetTitle());
std::cout<< "hdata: " << hdata << std::endl;
std::cout<< "hdy: " << hdy << std::endl;
std::cout<< "pdata: " << pdata << std::endl;
std::cout<< "pdy: " << pdy << std::endl;
TCanvas* c = new TCanvas();
c->SetGridx(kTRUE);
c->SetGridy(kTRUE);
// Draw data and MC on the same plot
// Have to draw the same plots twice to get error bars and a curve through the error bars.
c->cd();
// hdata->Draw("colz");
pdata->SetAxisRange(ymin,ymax,"Y");
pdata->Draw("hist c");
pdata->Draw("E X0 same");
pdy->Draw("hist c same");
pdy->Draw("E X0 same");
// Stat box alignment
DiMuPlottingSystem* dps = new DiMuPlottingSystem();
dps->arrangeStatBox(c);
// Legend
TLegend* l = new TLegend(0.15, 0.15, 0.7, 0.25, "", "brNDC");
l->AddEntry(pdata, dataname, "l");
l->AddEntry(pdy, dyname, "l");
l->Draw("same");
c->Print(savename);
return pdata;
}
示例4: DrawRunQA
void DrawRunQA(){
TFile *f = TFile::Open("merged_Anappmb.root");
TH2F* hrunbbcs = (TH2F*)f->Get("hrunbbcs");
TH2F* hrunbbcn = (TH2F*)f->Get("hrunbbcn");
TH2F* hrunntrack[4];
TH2F* hrunntracktot;
TProfile* hQAntrack[4];
TProfile* hQAntracktot;
hrunntrack[0] = (TH2F*)f->Get(Form("hrunntrack_arm0_pos"));
hrunntrack[1] = (TH2F*)f->Get(Form("hrunntrack_arm0_neg"));
hrunntrack[2] = (TH2F*)f->Get(Form("hrunntrack_arm1_pos"));
hrunntrack[3] = (TH2F*)f->Get(Form("hrunntrack_arm1_neg"));
hrunntracktot = (TH2F*)hrunntrack[0]->Clone("hrunntrack_tot");
for(int i=0;i<4;i++){
hQAntrack[i] = (TProfile*)hrunntrack[i]->ProfileX(Form("hQAntrack_%d",i));
if(i!=0) hrunntracktot->Add(hrunntrack[i]);
}
hQAntracktot = (TProfile*)hrunntracktot->ProfileX(Form("hQAntracktot"));
TProfile* hQAbbcs = hrunbbcs->ProfileX("hQAbbcs");
TProfile* hQAbbcn = hrunbbcn->ProfileX("hQAbbcn");
TCanvas *c1 = new TCanvas();
SetTitle(*hQAbbcs,"run Number","bbc south charge average","");
SetYRange(*hQAbbcs,3,8);
SetStyle(*hQAbbcs,0.8,1,20,0,0);
hQAbbcs->Draw("P");
c1->Print("fig/RunQA/hrunbbcs.png");
TCanvas *c2 = new TCanvas();
SetTitle(*hQAbbcn,"run Number","bbc north charge average","");
SetYRange(*hQAbbcn,3,8);
SetStyle(*hQAbbcn,0.8,1,20,0,0);
hQAbbcn->Draw("P");
c2->Print("fig/RunQA/hrunbbcn.png");
TCanvas *c3 = new TCanvas();
TString title[4] = {"East arm positive","East arm negative","West arm positive","West arm negative"};
for(int i=0;i<4;i++){
SetTitle(*hQAntrack[i],"run Number","# of tracks average",title[i]);
SetYRange(*hQAntrack[i],0.45,0.60);
SetStyle(*hQAntrack[i],0.8,1,20,0,0);
hQAntrack[i]->Draw("P");
c3->Print(Form("fig/RunQA/hrunntrack_%d.png",i));
}
TCanvas *c4 = new TCanvas();
SetTitle(*hQAntracktot,"run Number","# of tracks average","track 0.2<p_{T}<5.0");
SetYRange(*hQAntracktot,0,5);
SetStyle(*hQAntracktot,0.8,1,20,0,0);
hQAntracktot->Draw("P");
c4->Print(Form("fig/RunQA/hrunntracktot.png"));
}
示例5: rotate2DN
void rotate2DN(const char* filename,int detNum){
TFile *f = new TFile(filename);
TCanvas* cnew= new TCanvas("cnew","",800.,500.);
cnew->cd();
stringstream sss;
sss<<"Transposed-"<<filename;
TFile f1(sss.str().c_str(),"RECREATE");
for (int i=0;i<detNum;i++){
stringstream orig ;
orig<<"hNc"<<i ;
TH2D* h1=(TH2D*)f->Get(orig.str().c_str());
string gname = h1->GetTitle();
stringstream hname ;
hname<<"hN"<<i;
TH2D* Hnew = new TH2D(hname.str().c_str(),gname.c_str(),1700.,0.,1700.,8000.,0.,8000.);
for (int x=0;x<8000;x++){
for (int y=0;y<1600;y++){
int bin = h1->GetBinContent(x,y);
Hnew->Fill(y,x,bin);
}
}
cout<<"Histogram Number "<<i<<" transpose completed"<<endl;
cnew->cd();
Hnew->SetMinimum(7);
Hnew->GetYaxis()->SetRangeUser(1300,1600);
Hnew->GetYaxis()->SetTitle("Energy (keV)");
Hnew->GetXaxis()->SetTitle("Cycle Number");
Hnew->Draw("COLZ");
TCutG *cutg = new TCutG("NaIcut1",5);
cutg->SetVarX("y");
cutg->SetVarY("x");
cutg->SetPoint(0,0,1350);
cutg->SetPoint(1,1500,1350);
cutg->SetPoint(2,1500,1500);
cutg->SetPoint(3,0,1500);
cutg->SetPoint(4,0,1350);
TProfile *profx = Hnew->ProfileX(Form("profx_%d",i),1,-1,"[NaIcut1]");
profx->SetLineColor(kRed);
profx->Draw("same");
cnew->Update();
gname = gname + ".pdf";
cnew->SaveAs(gname.c_str());
}
f1.Write();
}
示例6: QAoccupancy
void QAoccupancy(const Char_t *fdata, const Char_t *fmc)
{
style();
TFile *fdtin = TFile::Open(fdata);
TList *ldtin = (TList *)fdtin->Get("clist");
TH2 *hdtin = (TH2 *)ldtin->FindObject("NClustersSPD2");
TProfile *pdtin = hdtin->ProfileY("pdtin_clusters");
pdtin->SetMarkerStyle(20);
pdtin->SetMarkerSize(2);
pdtin->SetMarkerColor(kAzure-3);
TFile *fmcin = TFile::Open(fmc);
TList *lmcin = (TList *)fmcin->Get("clist");
TH2 *hmcin = (TH2 *)lmcin->FindObject("NClustersSPD2");
TProfile *pmcin = hmcin->ProfileY("pmcin_clusters");
pmcin->SetMarkerStyle(25);
pmcin->SetMarkerSize(2);
pmcin->SetMarkerColor(kRed+1);
TCanvas *c = new TCanvas("cOccupancy", "cOccupancy", 800, 800);
c->SetLogy();
TH1 * hfr = c->DrawFrame(-0.5, 2., 10.5, 500.);
DrawBinLabelsX(hfr, kTRUE);
hfr->SetTitle(";;#LT#it{N}_{clusters,SPD-1}#GT");
pdtin->DrawCopy("same");
pmcin->DrawCopy("same");
TLegend *legend = new TLegend(0.20, 0.18, 0.50, 0.30);
legend->SetFillColor(0);
legend->SetBorderSize(0);
legend->SetTextFont(42);
legend->SetTextSize(0.04);
legend->AddEntry(pdtin, "data", "pl");
legend->AddEntry(pmcin, "Monte Carlo", "pl");
legend->Draw("same");
c->SaveAs(canvasPrefix+"occupancy.pdf");
return;
TCanvas *cr = new TCanvas("cOccupancyr", "cOccupancyr", 800, 800);
// hfr = cr->DrawFrame(-0.5, 0.75, 10.5, 1.25);
// DrawBinLabelsX(hfr, kTRUE);
// hfr->SetTitle(";;#LT#it{N}_{clusters,SPD-1}#GT ratio");
pdtin->SetLineColor(kAzure-3);
pdtin->SetLineWidth(3);
pdtin->Divide(pmcin);
pdtin->Draw("same,histo");
legend = new TLegend(0.505025, 0.760673, 0.805276, 0.930142);
legend->SetFillColor(0);
legend->SetBorderSize(0);
legend->SetTextFont(42);
legend->SetTextSize(0.04);
legend->AddEntry(pdtin, "data / Monte Carlo", "l");
legend->Draw("same");
cr->SaveAs(canvasPrefix+"occupancyr.pdf");
}
示例7: profile
void profile()
{
TCanvas* c1 = new TCanvas("canvas","nhitac",1200,600);
c1->Divide(2,1);
c1->cd(1);
TFile *file1 = new TFile("test_nhitac_modified.root");
//TH1F *histo1 = new TH1F("nhitac1","nhitac1",60,0,300);
TProfile *profile1 = new TProfile("profile","nhitac profile",100,0,100,0,300);
TFile *file2 = new TFile("test_nhitac_unmodified.root");
//TH1F *histo2 = new TH1F("nhitac","nhitac",60,0,300);
TProfile *profile2 = new TProfile("profile2","nhitac profile2",100,0,100,0,300);
TProfile *ratio = new TProfile("ratio","nhitac ratio", 100,0,100,0,2);
//histo2->SetMarkerStyle(31);
TLegend *l1 = new TLegend(0.20, 0.60, 0.3, 0.7);
l1->SetBorderSize(0);
TTree* nhitac_modified = (TTree*)file1->Get("testnhitac");
TTree* nhitac_unmodified = (TTree*)file2->Get("testnhitac");
int testnhitac1, testnhitac2;
nhitac_modified->SetBranchAddress("nhitac",&testnhitac1);
nhitac_unmodified->SetBranchAddress("nhitac",&testnhitac2);
for(int i= 0; i < nhitac_modified->GetEntries(); i++)
{
nhitac_modified->GetEntry(i);
nhitac_unmodified->GetEntry(i);
profile1->Fill(i,testnhitac1);
profile2->Fill(i,testnhitac2);
double temp = testnhitac2;
ratio->Fill(i,testnhitac1/temp);
//histo1->Fill(testnhitac1);
//histo2->Fill(testnhitac2);
}
//histo1->SetMarkerColor(kRed);
//histo1->SetLineColor(kRed);
profile1->SetMarkerColor(kRed);
profile1->SetMarkerStyle(5);
profile2->SetMarkerColor(kBlue);
l1->AddEntry(profile1,"modified od bad channel","P");
l1->AddEntry(profile2,"old od bad channel","l");
l1->SetTextSize(0.04);
profile1->Draw("e1p");
profile1->GetXaxis()->SetTitle("event #");
profile1->GetYaxis()->SetTitle("nhitac");
profile2->Draw("same");
l1->Draw();
c1->cd(2);
ratio->GetXaxis()->SetTitle("event #");
ratio->GetYaxis()->SetTitle("new/old");
//ratio->SetMarkerStyle(5);
//ratio->SetMarkerColor(kRed);
ratio->Draw();
}
示例8: deviationBosonPtOld
void deviationBosonPtOld() {
TFile *lFile = new TFile("ZTPMC.root");
TTree *lTree = (TTree*) lFile->FindObjectAny("WNtupleIdEffNT");
//lTree->Print();
//lTree->Draw("mt");
std::string lZPt = "sqrt((abs(pt)*cos(phi)+abs(jetpt)*cos(jetphi))*(abs(pt)*cos(phi)+abs(jetpt)*cos(jetphi)) + (abs(pt)*sin(phi)+abs(jetpt)*sin(jetphi))*(abs(pt)*sin(phi)+abs(jetpt)*sin(jetphi)))";
TProfile *lPProf = new TProfile("A","A",8,0,40); lPProf->SetMarkerColor(kBlue); lPProf->SetMarkerStyle(21); lPProf->SetLineColor(kBlue);
TProfile *lMProf = new TProfile("B","B",8,0,40); lMProf->SetMarkerColor(kRed); lMProf->SetMarkerStyle(21); lMProf->SetLineColor(kRed);
lTree->Draw(std::string("mt:"+lZPt+">>A").c_str(),std::string("mt > 80 && charge > 0 ").c_str());
lTree->Draw(std::string("mt:"+lZPt+">>B").c_str(),std::string("mt > 80 && charge < 0 ").c_str());
//lTree->Draw(std::string("mt>>A").c_str(),"mt > 80 && charge > 0");
//lTree->Draw(std::string("mt>>B").c_str(),"mt > 80 && charge < 0");
TLegend *lL = new TLegend(0.6,0.6,0.9,0.9);
lL->SetFillColor(0);
lL->AddEntry(lPProf,"Plus","lp");
lL->AddEntry(lMProf,"Minus","lp");
lPProf->Draw();
lMProf->Draw("same");
lL->Draw();
}
示例9: plotTProfile
void ElectronSimulation::plotTProfile(TTree* treeData )
{
TProfile* hprof = new TProfile("hprof", "hprof", 7, -0.5, 9.5);
for (int i = 0; i < 7; ++i)
{
char chargeValueString[100];
snprintf(chargeValueString,100,"qChargeValues[%i]:%i",i,i);
treeData->Project("+hprof",chargeValueString);
}
hprof->Draw();
}
示例10: compareTPCTOF
void compareTPCTOF(Int_t icentr,Int_t spec,Int_t arm,Float_t pTh,Int_t addbin){
LoadLib();
Float_t ptMaxFit[8] = {20,0.7,0.55,1.2,2,2,2,2};
TProfile *pTPC = extractFlowVZEROsingle(icentr,spec,arm,0,pTh,addbin,"TPC",0,0,-1,-1+2*(spec!=3)); // TPC && !TOF (TPC PID)
TProfile *pTPC2 = extractFlowVZEROsingle(icentr,spec,arm,0,pTh,addbin,"TPCextra",2,2,-1,-1+2*(spec!=3)); //TPC && TOF (TPC PID)
TProfile *pTOF = extractFlowVZEROsingle(icentr,spec,arm,0,pTh,addbin,"TOF",1,1,-1,-1+2*(spec!=3)); //TPC && TOF (TPC&TOF PID)
if(spec > 0) pTPC->Add(pTPC2);
else pTPC->Add(pTOF);
char name[100];
snprintf(name,100,"NUO_%i",spec);
hNUO[spec] = pTPC->ProjectionX(name);
hNUO[spec]->Add(pTOF,-1);
if(spec && hNUO[0]) hNUO[spec]->Add(hNUO[0],-1);
if(! kCleanMemory){
new TCanvas();
pTPC->Draw();
pTOF->Draw("SAME");
new TCanvas();
pTPC->SetLineColor(1);
pTOF->SetLineColor(2);
}
hNUO[spec]->Draw();
if(kCleanMemory){
if(pTPC) delete pTPC;
if(pTPC2) delete pTPC2;
if(pTOF) delete pTOF;
}
}
示例11: drawPtEta
void drawPtEta(char *inf){
TFile a(inf);
a.cd("ana");
TProfile *h = new TProfile("h","",100,-3,3);
TCanvas *c = new TCanvas("c","",400,400);
hi->Draw("(pt):eta>>h","evtType!=92&&evtType!=93&&(abs(eta)<2.4&&chg!=0&&abs(pdg)!=11&&abs(pdg)!=13)","prof",10000);
double nevt = hi->GetEntries("evtType!=92&&evtType!=93");
h->Sumw2();
//h->Scale(2./nevt);
h->SetXTitle("#eta");
h->SetYTitle("Average P_{T}");
h->Draw();
c->SaveAs(Form("%s-PtEta-2.4.gif",inf));
c->SaveAs(Form("%s-PtEta-2.4.C",inf));
}
示例12: plotAndProfileX
void plotAndProfileX (TH2* h2, float min, float max, bool profile) {
setStyle(h2);
gPad->SetGrid(1,1);
gStyle->SetGridColor(15);
h2->GetYaxis()->SetRangeUser(min,max);
h2->Draw();
if (profile) {
TProfile* prof = h2->ProfileX();
prof->SetMarkerColor(2);
prof->SetLineColor(2);
prof->Draw("same");
}
TLine * l = new TLine(h2->GetXaxis()->GetXmin(),0,h2->GetXaxis()->GetXmax(),0);
l->SetLineColor(3);
l->Draw();
}
示例13: show_mass_dist
void show_mass_dist()
{
TFile *file_f = new TFile("particle_mass_dist.root");
TH2F *hm = (TH2F *) file_f->Get("mass_dist");
TProfile *pm = (TProfile *) file_f->Get("mass_dist_p");
TCanvas *cm = new TCanvas("cm", "Mass", 1000, 500);
cm->Divide(2, 1);
pm->SetLineColor(4);
cm->cd(1);
hm->Draw();
cm->cd(2)->SetBorderMode(0);
pm->Draw();
}
示例14: TCanvas
TCanvas *Plot2D_profileX_my(TChain *data, TString branchname, TString binning,TString selection,TString opt,TString xLabel, TString yLabel){
//type == 0: data only
//type == 1: MC only
//type == 2: data/MC
TCanvas *c = new TCanvas("c","");
data->Draw(branchname+">>data_hist"+binning,selection,opt);
TH2F *d = (TH2F *) gROOT->FindObject("data_hist");
TCanvas *c1 = new TCanvas("c1","");
TProfile *prof = d->ProfileX("prof",1,-1,"s");
prof->SetMarkerStyle(20);
prof->SetMarkerSize(1);
prof->Draw();
prof->GetYaxis()->SetTitle(yLabel);
prof->GetXaxis()->SetTitle(xLabel);
return c1;
}
示例15: Fake100PeVShower
void Fake100PeVShower(int opt)
{
// opt == 0 implies save to root file
// opt == 1 implies plot and save to canvas
TFile* file = NULL;
TCanvas* c = NULL;
if(opt == 0)
file = new TFile("fake100PeVShower.root","recreate");
if(opt == 1)
c = makeCanvas("c");
TString gaus = "1.5e7*TMath::Exp(-(pow(x-10,2)/9))";
TString bump = "5e6*TMath::Exp(-(pow(x-17,2)/20))";
TF1* f = new TF1("f",(gaus+"+"+bump).Data(),0,30);
int nbins = 3000;
float xmin = 0;
float xmax = 30;
TProfile* prof = new TProfile("prof","",nbins,xmin,xmax);
prof->SetStats(0);
prof->SetTitle("");
prof->GetYaxis()->SetTitle("Charge excess / 1e7");
prof->GetXaxis()->SetTitle("z [m]");
float step = xmax / nbins;
for(int i =0; i<nbins; ++i){
float x = step * i;
if(opt == 1 ) prof->Fill(x, f->Eval(x)/1e7);
else prof->Fill(x, f->Eval(x));
}
if(opt == 1){
prof->Draw();
c->SaveAs("JaimeCheck/FakeProfile100PeV.png");
}
if(opt == 0){
file->Write();
file->Close();
}
}