当前位置: 首页>>代码示例>>C++>>正文


C++ TPaletteAxis::GetBinColor方法代码示例

本文整理汇总了C++中TPaletteAxis::GetBinColor方法的典型用法代码示例。如果您正苦于以下问题:C++ TPaletteAxis::GetBinColor方法的具体用法?C++ TPaletteAxis::GetBinColor怎么用?C++ TPaletteAxis::GetBinColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TPaletteAxis的用法示例。


在下文中一共展示了TPaletteAxis::GetBinColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EventDisplayForBaby

void EventDisplayForBaby(bool sig=false, bool truth=true, bool fatjet=true, int event=-1)
{

    gInterpreter->ExecuteMacro("~/macros/rootlogon.C");
    
    // chain      
    TChain *ch        = new TChain("tree");
    if(!sig) ch->Add("babies/small_quick_cfA_746p1_nleps1_trig0ON.root");
    if(sig) ch->Add("~/scratch/plots/1d_2015d_13Jan2016/2d/48ipb/*.root");
    
    InitBaby(ch); 
   
    Int_t nentries = (Int_t)ch->GetEntries();
    for(int i = 0; i<nentries; i++)
    {
        ch->GetEntry(i); 

        // apply selections (event==-1 && mj_>xxx && ht_>yyy && ...)
        // or 
        // select an event (event!=-1 && event_=xxxxxx)
        // "event" is one of the arguments  
        
        if(event>0 && event_!=event) continue; 

        // 
        //  Event Display
        // 
        float start=0.62;
        float nextline = start;
        float increment = 0.04;
        float offset=0.02;
        int npert;
        int LSPcol[2] = {kCyan+1,kOrange-4};
        if(!sig) npert = 5;
        else npert=3;
        float xalign = 0.82;
        vector<TMarker> constituents, genpart;
        TEllipse *cone[fjets_pt_->size()]; 
        TH2F *h_fatjets = new TH2F("h_fatjets","h_fatjets", 230, -5.0, 5.0, 144, -3.141592, 3.141592); 
        cout << event_ << endl;
        for(int ifj = 0; ifj< (int)fjets_pt_->size(); ifj++)
        {   if(ifj==0) cout << "... Fatjets info(pT, eta, phi, mj)" << endl;
            h_fatjets->Fill(fjets_eta_->at(ifj),fjets_phi_->at(ifj), fjets_m_->at(ifj));
            cout << fjets_pt_->at(ifj) << " " << fjets_eta_->at(ifj) << " " 
                 <<  fjets_phi_->at(ifj) << " " << fjets_m_->at(ifj) << endl;
        }

        TString cname = Form("Event_%lli_",event_);
        TCanvas *c = new TCanvas(cname,cname,1640,760);
        gPad->SetRightMargin(0.35);
        h_fatjets->SetZTitle("m_{j} [GeV]");
        h_fatjets->GetZaxis()->SetTitleSize(0.05);
        h_fatjets->GetZaxis()->SetTitleOffset(0.55);
        h_fatjets->GetYaxis()->SetTitleOffset(0.6);
        h_fatjets->Draw("colz");
        h_fatjets->GetZaxis()->SetRangeUser(0,1.1*h_fatjets->GetMaximum());
        h_fatjets->Draw("colz");
        gPad->Update();

        TPaletteAxis *palette = (TPaletteAxis*)h_fatjets->GetListOfFunctions()->FindObject("palette");
        for(int ifj = 0; ifj< (int)fjets_pt_->size(); ifj++)
        {
            cone[ifj] = new TEllipse(fjets_eta_->at(ifj),fjets_phi_->at(ifj), 1.2, 1.2);
            //  cone[ifj]->SetFillStyle(3003);
            cone[ifj]->SetFillStyle(0);
            Int_t binx,biny,binz;
            h_fatjets->GetBinXYZ(h_fatjets->FindBin(fjets_eta_->at(ifj),fjets_phi_->at(ifj)),binx,biny,binz);
            //cout<<"bin x bin y "<<binx<<" "<<biny<<endl;
            //cout<<"content "<<h_fatjets->GetBinContent(binx,biny)<<endl;

            //cout<<palette<<endl;
            Int_t ci = palette->GetBinColor(binx,biny);
            if(ifj==0) ci = palette->GetBinColor(binx,biny);
            //cout<<"color"<<ci<<endl;
            cone[ifj]->SetFillColor(kGray);
            cone[ifj]->SetLineColor(ci);
        }


        float lepPt, lepEta, lepPhi; 
        if(nels_==1)  
        {
            for(int i=0; i<(int)els_pt_->size(); i++) 
            {
                if(els_miniso_->at(i)>0.1) continue;
                if(els_sigid_->at(i)!=1) continue;
                if(els_pt_->at(i)<20) continue; 
                lepPt   =els_pt_->at(i);
                lepEta  =els_eta_->at(i);
                lepPhi  =els_phi_->at(i); 
            }
        }
        if(nmus_==1)  
        {
            for(int i=0; i<(int)mus_pt_->size(); i++) 
            {
                if(mus_miniso_->at(i)>0.2) continue;
                if(mus_sigid_->at(i)!=1) continue;
                if(mus_pt_->at(i)<20) continue;
                lepPt   =mus_pt_->at(i);
//.........这里部分代码省略.........
开发者ID:jaehyeok,项目名称:MJ,代码行数:101,代码来源:EventDisplay.C


注:本文中的TPaletteAxis::GetBinColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。