本文整理汇总了C++中TProfile::SetMinimum方法的典型用法代码示例。如果您正苦于以下问题:C++ TProfile::SetMinimum方法的具体用法?C++ TProfile::SetMinimum怎么用?C++ TProfile::SetMinimum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TProfile
的用法示例。
在下文中一共展示了TProfile::SetMinimum方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flavor_ana
void flavor_ana(int doMC=1,
const char * JecType = "abs",
const char * inFile0Name="../outputs/jetSkimRelValQCD_Pt_80_120_sw354-JEC_Summer09_7TeV_ReReco332.root",
const char * inFile1Name="djtree_JEC_Summer09_7TeV_ReReco332.root")
{
// Define Inputs
cout << "======= Inputs: ========" << endl;
//cout << "Inclusive jets: " << inFile0Name << endl;
//cout << "Dijets: " << inFile1Name << endl;
//TFile * inFile0 = new TFile(inFile0Name);
//TFile * inFile1 = new TFile(inFile1Name);
TFile * inFile0 = new TFile("../outputs/jetSkimRelValQCD_Pt_80_120_sw354-JEC_Summer09_7TeV_ReReco332.root");
TFile * inFile1 = new TFile(Form("djtree_JEC_Summer09_7TeV_ReReco332_%s.root",JecType));
TTree * Events;
inFile0->GetObject("Events",Events);
TTree * djtree;
inFile1->GetObject("djtree",djtree);
aliases(Events);
// === Dijets ===
cout << endl << "================ dijets ==============" << endl;
Int_t numPreSelEvtl = djtree->GetEntries("vz>-99");
cout << "Events:" << endl;
cout << "- with none-fake vtx: " << numPreSelEvtl << endl;
// - selection -
TCut evtSelDj("nlpet>80 && nlpet<120 && alpet>80 && jdphi>2.8");
TCut evtSelDj2("nlpet>80 && nlpet<120 && alpet>80 && jdphi>3.0");
Int_t numSelEvt1 = djtree->GetEntries(evtSelDj);
cout << "- Passing sel: " << numSelEvt1 << endl;
Int_t numSelEvt2 = djtree->GetEntries(evtSelDj2);
cout << "- Passing diphi sel: " << numSelEvt2 << endl;
// === flavor studies ===
TProfile * hNrJFlav = new TProfile("hNrJFlav","flavor",10,85,110);
hNrJFlav->SetMarkerColor(kRed);
hNrJFlav->SetLineColor(kRed);
hNrJFlav->SetMarkerStyle(kOpenCircle);
hNrJFlav->SetMinimum(0.);
hNrJFlav->SetMaximum(0.7);
hNrJFlav->SetTitle(";p_{T}^{gen jet};q jet fraction");
TProfile * hAwJFlav = (TProfile*)hNrJFlav->Clone("hAwJFlav");
hAwJFlav->SetMarkerColor(kBlue);
hAwJFlav->SetLineColor(kBlue);
TCanvas * cJFlav = new TCanvas("cJFlav","cJFlav",500,500);
TCut matParton("nlpstat>-99&&alpstat>-99");
djtree->Draw("(abs(nlpid)<6):nlpet>>hNrJFlav",evtSelDj&&matParton,"prof");
djtree->Draw("(abs(alpid)<6):alpet>>hAwJFlav",evtSelDj&&matParton,"prof same");
TLegend *leg2 = new TLegend(0.605,0.216,0.905,0.369,NULL,"brNDC");
leg2->SetFillColor(0);
leg2->SetBorderSize(0);
leg2->SetTextSize(0.03);
leg2->AddEntry(hNrJFlav,"Di-Jets, Near Jet","p");
leg2->AddEntry(hAwJFlav,"Di-Jets, Away Jet","p");
leg2->Draw();
cJFlav->Print("plots/cDJFlavor.gif");
}
示例2: nmod
// ----------------------------------------------------------------------
void nmod(const int offset = 400) {
c0.Clear();
c0.Divide(2,8);
tl->SetTextSize(0.2);
tl->SetNDC(kTRUE);
tl->SetTextAngle(90);
gStyle->SetOptTitle(0);
gStyle->SetOptStat(0);
gROOT->ForceStyle();
double min(-1), max(-1);
if (offset == 600) {
min = 120;
max = 200;
}
TProfile *p;
for (int i = 0; i < 16; ++i) {
c0.cd(i+1);
p = (TProfile*)gFile->Get(Form("p%i", offset+i));
if (min > -1) {
p->SetMinimum(min);
p->SetMaximum(max);
}
p->Draw();
tl->DrawLatex(0.2, 0.11, Form("Chip %i", i));
}
if (offset == 400) c0.SaveAs("ped-nmod.ps");
if (offset == 500) c0.SaveAs("gain-nmod.ps");
if (offset == 600) c0.SaveAs("noise-nmod.ps");
if (offset == 700) c0.SaveAs("pedgain-nmod.ps");
}
示例3: fitBjetJES
void fitBjetJES(int ppPbPb=1, int cbinlo=12, int cbinhi=40){
if(!ppPbPb){
cbinlo=0;
cbinhi=40;
}
gStyle->SetOptTitle(0);
gStyle->SetOptStat(0);
TFile *fL;
if(!ppPbPb)fL=new TFile("histos/ppMC_hiReco_jetTrig_highPurity_JEC.root");
else fL=new TFile("histos/PbPbQCDMC_pt30by3_ipHICalibCentWeight.root");
// these are dummy files for pp
TFile *fB=new TFile("histos/PbPbBMC_pt30by3_ipHICalibCentWeight.root");
TFile *fC=new TFile("histos/PbPbCMC_pt30by3_ipHICalibCentWeight.root");
TNtuple *tL = (TNtuple*) fL->Get("nt");
TNtuple *tB = (TNtuple*) fB->Get("nt");
TNtuple *tC = (TNtuple*) fC->Get("nt");
float jtptL, refptL, jtetaL, weightL, refparton_flavorForBL, binL;
tL->SetBranchAddress("jtpt",&jtptL);
tL->SetBranchAddress("jteta",&jtetaL);
tL->SetBranchAddress("refpt",&refptL);
tL->SetBranchAddress("weight",&weightL);
if(ppPbPb)tL->SetBranchAddress("bin",&binL);
tL->SetBranchAddress("refparton_flavorForB",&refparton_flavorForBL);
float jtptB, refptB, jtetaB, weightB, refparton_flavorForBB, binB;
tB->SetBranchAddress("jtpt",&jtptB);
tB->SetBranchAddress("jteta",&jtetaB);
tB->SetBranchAddress("refpt",&refptB);
tB->SetBranchAddress("weight",&weightB);
if(ppPbPb)tB->SetBranchAddress("bin",&binB);
tB->SetBranchAddress("refparton_flavorForB",&refparton_flavorForBB);
float jtptC, refptC, jtetaC, weightC, refparton_flavorForBC, binC;
tC->SetBranchAddress("jtpt",&jtptC);
tC->SetBranchAddress("jteta",&jtetaC);
tC->SetBranchAddress("refpt",&refptC);
tC->SetBranchAddress("weight",&weightC);
if(ppPbPb)tC->SetBranchAddress("bin",&binC);
tC->SetBranchAddress("refparton_flavorForB",&refparton_flavorForBC);
TProfile *hL = new TProfile("hL","hL",250,50,300,0,10);
TProfile *hB = new TProfile("hB","hB",250,50,300,0,10);
TProfile *hC = new TProfile("hC","hC",250,50,300,0,10);
hL->Sumw2(),hB->Sumw2(),hC->Sumw2();
for(int i=0;i<tL->GetEntries();i++){
tL->GetEntry(i);
if(!ppPbPb) binL=39;
if(fabs(jtetaL)<2 && binL>=cbinlo && binL<cbinhi)
hL->Fill(refptL,jtptL/refptL,weightL);
if(!ppPbPb){
if(fabs(jtetaL)<2 && binL>=cbinlo && binL<cbinhi && abs(refparton_flavorForBL)==5)
hB->Fill(refptL,jtptL/refptL,weightL);
if(fabs(jtetaL)<2 && binL>=cbinlo && binL<cbinhi && abs(refparton_flavorForBL)==4)
hC->Fill(refptL,jtptL/refptL,weightL);
}
}
if(ppPbPb){
for(int i=0;i<tB->GetEntries();i++){
tB->GetEntry(i);
if(fabs(jtetaB)<2 && binB>=cbinlo && binB<cbinhi && abs(refparton_flavorForBB)==5)
hB->Fill(refptB,jtptB/refptB,weightB);
}
for(int i=0;i<tC->GetEntries();i++){
tC->GetEntry(i);
if(fabs(jtetaC)<2 && binC>=cbinlo && binC<cbinhi && abs(refparton_flavorForBC)==4)
hC->Fill(refptC,jtptC/refptC,weightC);
}
}
hL->SetMinimum(0.);
hL->SetLineColor(kBlue);
hB->SetLineColor(kRed);
hC->SetLineColor(kGreen);
hL->SetMarkerColor(kBlue);
hB->SetMarkerColor(kRed);
hC->SetMarkerColor(kGreen);
//hL->SetMarkerStyle(4);
//.........这里部分代码省略.........
示例4: makePlots
void makePlots (string configFilePath){
if (( nHistList % inputRootFile.size() == 0 ))
{
for (int i=0; i<numHistos; i++)
{
TCanvas *c = new TCanvas(theHistNameStrings.at(i).c_str(), "", 81,58,500,602);
TH1* h_mc; // histograms for MC
TH1* h_mc_clone; // histograms for MC
TH1* h_data; // histogram to store data points
TH1* h_data_clone;
TLegend *legend = new TLegend(0.2, 0.85-.035*inputLegend.size(), 0.5, 0.90,NULL,"brNDC");
int whichHisto = 0;
for (int j=1;j<inputRootFile.size();j++)
{
whichHisto=j*numHistos;
int a = 0;
bool foundHisto = false;
if (theHistNameStrings.at(i) == theHistNameStrings.at(i+whichHisto))
{
foundHisto=true;
a=i;
}
else
{
for (a = 0; a < numHistos; a++)
{
if (theHistNameStrings.at(i) == theHistNameStrings.at(a+whichHisto))
{
foundHisto = true;
break;
}
}
}
//-----------------------------------------------------------
string hist2name = listHistos->At(a+whichHisto)->GetName();
if (foundHisto == true)
{
h_data = (TH1*)listHistos->At(i);
h_data->SetMarkerStyle(inputMarkerStyle.at(0));
h_data = SetStyleh(h_data);
h_data->Sumw2();
int thelineStyle = inputSetLineStyle.at(j);
int thelineWidth = inputSetLineWidth.at(j);
int setcolor = inputColor.at(j);
int marker = inputMarkerStyle.at(j);
h_data->SetMarkerColor(inputColor.at(0));
h_data->SetLineColor(inputColor.at(0));
if (j == 1)
{
if ( h_data->IsA()->InheritsFrom( "TH2" ) ) {
//n.b. that ProfileX will do nothing if the
//name you choose is alreayd taken! so each
//profileX needs a unique name
TString profileName = TString::Format("%s_data_pfx",h_data->GetName());
TProfile *dataProf = ((TH2*)h_data)->ProfileX(profileName.Data());
dataProf->SetMinimum(h_data->GetMinimum()); //min/max values were stored in the original hist
dataProf->SetMaximum(h_data->GetMaximum());
dataProf->Draw("");
//profileX cretaes a clone, so no need to
//clone again here. Need to set the hist
//name so root doesn't complain
TString cloneName = TString::Format("%s_data_pfx_clone",h_data->GetName());
TString cloneName2 = TString::Format("%s_data_pfx_clone_px",h_data->GetName());
h_data_clone = ((TH2*)h_data)->ProfileX(cloneName.Data())->ProjectionX(cloneName2.Data());
}
else { //1d case
Float_t ymaxc = gPad->GetUymax();
//h_data->SetMaximum(ymaxc+0.15*ymaxc);
h_data->Draw("ep1");
h_data_clone = (TH1*)h_data->Clone();
}
//h_data->SetLineColor(1);
h_data->SetLineStyle(thelineStyle);
h_data->SetLineWidth(thelineWidth);
float rms_data = h_data->GetRMS();
float mean_data = h_data->GetMean();
std::stringstream legend_data;
legend_data.str("");
legend_data << inputLegend.at(0).c_str() << ": mean=" << setprecision(3)
<<mean_data <<", rms=" << setprecision(3) <<rms_data<< endl;
legend->AddEntry(h_data,legend_data.str().c_str(), "lep");
}
h_mc = (TH1*)listHistos->At(a+whichHisto);
h_mc = SetStyleh(h_mc);
h_mc->SetName(hist2name.c_str());
//cout<<"NAME "<<h_mc->GetName()<<endl;
// Style
string processlegend = (inputLegend.at(j)).c_str();
//.........这里部分代码省略.........
示例5: makePlot
void makePlot(char* canv)
{
t->SetBranchAddress("LM_PX1", &intree.LM_PX1);
t->SetBranchAddress("LM_PX2", &intree.LM_PX2);
t->SetBranchAddress("LM_PY1", &intree.LM_PY1);
t->SetBranchAddress("LM_PY2", &intree.LM_PY2);
t->SetBranchAddress("LM_P2_Integral", &intree.LM_P2_Integral);
t->SetBranchAddress("time", &intree.timeline);
t->Print();
if(entries<=0)
entries = t->GetEntries();
char title[100]=0;
sprintf(title,"%s runs 1100-1107",canv);
TProfile *prof = new TProfile(title,title,24,0,entries);
TProfile *prof1 = new TProfile(title,title,24,0,entries);
TProfile *prof2 = new TProfile(title,title,24,0,entries);
/**************************************
* read entries
**************************************
*/
Double_t *ratio = new Double_t[entries];
Double_t *parmean = new Double_t[entries];
Double_t *p1 = new Double_t[entries];
Double_t *p2 = new Double_t[entries];
for (int j = 0; j < entries; ++j){
gSystem->Sleep (sleep);
t->GetEntry(j);
ratio[j] = intree.LM_PY1/intree.LM_PY2;
p1[j] = intree.LM_PY1;
p2[j] = intree.LM_PY2;
//cout<<"entry "<<j<<" peak2 "<<intree.LM_PY2<<endl;
}
Double_t mean = TMath::Mean(entries,ratio);
Double_t mean1 = TMath::Mean(entries,p1);
Double_t mean2 = TMath::Mean(entries,p2);
for (int j = 0; j < entries; ++j){
prof->Fill(j,(ratio[j]/mean-1)*100);
prof1->Fill(j,(p1[j]/mean1-1)*100);
prof2->Fill(j,(p2[j]/mean2-1)*100);
}
TCanvas *c1 = new TCanvas(canv,"frascatirun",900,700);
c1->cd();
char axisXname[100];
sprintf(axisXname,"Time (Entries) (total: %i)",entries);
prof->SetXTitle(axisXname);
prof->SetYTitle("Variation (%)");
prof->SetMaximum(1);
prof->SetMinimum(-1);
prof->SetMarkerColor(4);
prof->SetMarkerSize(1);
prof->SetMarkerStyle(8);
prof->SetStats(kFALSE);
prof->Draw();
prof1->SetMarkerColor(5);
prof1->SetMarkerSize(1);
prof1->SetMarkerStyle(6);
prof1->Draw("same");
prof2->SetMarkerColor(1);
prof2->SetMarkerSize(1);
prof2->SetMarkerStyle(7);
prof2->Draw("same");
/* TLegend leg = new TLegend(0.1,0.7,0.48,0.9);
leg->SetHeader("The Legend Title");
leg->AddEntry(h1,"Histogram filled with random numbers","f");
leg->AddEntry("f1","Function abs(#frac{sin(x)}{x})","l");
leg->AddEntry("gr","Graph with error bars","lep");
leg->Draw("same");
*/
}