Ejemplo n.º 1
0
/** redraw every node on the canvas from the buffer (without
 * necessarily reexamining the grid) */
void
Canvas::redraw ( void )
{
    DMESSAGE( "redrawing canvas" );

    if ( ! m.grid_drawn )
        draw();

    m.ruler_drawn = false;
    m.mapping_drawn = false;

    draw_mapping();
    draw_ruler();

    for ( int y = m.vp->h; y--; )
        for ( int x = m.vp->w; x--; )
        {
            cell_t c = m.previous[ x ][ y ];

            if ( c.shape > HEXAGON ) return;

            if ( m.vp->x + x == m.playhead )
                c.flags |= F_PLAYHEAD;

            gui_draw_shape( m.origin_x + m.margin_left + x * m.div_w, m.origin_y + m.margin_top + y * m.div_h, m.div_w, m.div_h, m.border_w,
                            c.shape, c.state, c.flags, c.color );
        }
}
Ejemplo n.º 2
0
/** draw ONLY those nodes necessary to bring the canvas up-to-date with the grid */
void
Canvas::draw ( void )
{
    DMESSAGE( "drawing canvas" );

    draw_mapping();
    draw_ruler();

    m.grid_drawn = true;

    m.grid->draw( this, m.vp->x, m.vp->y, m.vp->w, m.vp->h );
}
Ejemplo n.º 3
0
void draw(char *session1,
          char *dir1="/afs/cern.ch/user/o/onl/catch/fe-straws/data/",
          char *session2=NULL,
          char *dir2=NULL )
{
    vector<int> catches;
    catches.push_back(328);
    catches.push_back(329);
    catches.push_back(330);
    catches.push_back(331);
    catches.push_back(332);
    
    for( int i=0; i<catches.size(); i++ )
    {
        char buf[999];
        sprintf(buf,"%s/threshold_%d.dat_%s",dir1,catches[i],session1);
        
        TCanvas *c=NULL;
        TH1F *h[2]={NULL,NULL};
        
        h[0]=draw_catch(buf,catches[i],session1,c);
        
        if( session2!=NULL && dir2!=NULL )
        {
            sprintf(buf,"%s/threshold_%d.dat_%s",dir2,catches[i],session2);
            h[1]=draw_catch(buf,catches[i],session2,c);
        }

        if( h[0]!=NULL && h[1]!=NULL )
        {
            c->cd(4);
            gPad->SetGrid(0,1);

            char buf[99];
            sprintf(buf,"h_thr_diff_%d_%s_%s",catches[i],session1,session2);
            TH1F *h_thr_diff = new TH1F(buf,"Thresholds difference",1024,0,1024);
            h_thr_diff->SetStats(0);
            h_thr_diff->GetXaxis()->SetTitle(channel_axis_label);
            h_thr_diff->GetYaxis()->SetTitle("Thresholds difference, mV");
            //h_thr->SetDirectory(NULL);

            h_thr_diff->Add(h[0],h[1],1,-1);
            h_thr_diff->SetMinimum(-800);
            h_thr_diff->SetMaximum( 800);
            h_thr_diff->Draw();
            draw_mapping(h_thr_diff,catches[i]);
        }

        c->cd(0);
    }
    
    if(0)
    {
        new TCanvas("c4X");
        draw_detector("4X",card_channel);
        new TCanvas("c4U");
        draw_detector("4U",card_channel);
        new TCanvas("c4Y");
        draw_detector("4Y",card_channel);
        new TCanvas("c6X");
        draw_detector("6X",card_channel);
        new TCanvas("c6V");
        draw_detector("6V",card_channel);
        new TCanvas("c6Y");
        draw_detector("6Y",card_channel);
    }
}
Ejemplo n.º 4
0
TH1F* draw_catch(char *file,int catch_,char *session,TCanvas *&canvas)
{
    char buf[99];

    TNtuple nt("n","nn","port:ch:tr:rate");
    nt.ReadFile(file);
    
    if( strlen(file)<13 )
    {
        printf("Bad file name.\n");
        return NULL;
    }

    if( int(nt.GetEntries())!=1024 )
    {
        printf("Bad number of entries: %d\n",int(nt.GetEntries()));
        printf("In the file %s\n",file);
        return NULL;
    }

    const int rates_lim=30;
    
    sprintf(buf,"h_rate_%d_%s",catch_,session);
    TH1F *h_rate = new TH1F(buf,"Rates",1024,0,1024);
    h_rate->GetXaxis()->SetTitle(channel_axis_label);
    h_rate->GetYaxis()->SetTitle("Noise rate per channel, kHz");
    //h_rate->SetDirectory(NULL);
    h_rate->SetMinimum(0);
    h_rate->SetMaximum(rates_lim);
    h_rate->SetStats(0);

    sprintf(buf,"h_rate_prof_%d_%s",catch_,session);
    TH1F *h_rate_proj = new TH1F(buf,"Rates projection",100,0,rates_lim);
    //h_rate_proj->SetDirectory(NULL);
    h_rate_proj->GetXaxis()->SetTitle("Rate, kHz");
    h_rate_proj->GetYaxis()->SetTitle("Entries");

    sprintf(buf,"h_thr_%d_%s",catch_,session);
    TH1F *h_thr = new TH1F(buf,"Thresholds",1024,0,1024);
    h_thr->GetXaxis()->SetTitle(channel_axis_label);
    h_thr->GetYaxis()->SetTitle("Threshold, mV");
    //h_thr->SetDirectory(NULL);
    h_thr->SetMinimum(-2000);
    h_thr->SetMaximum(-300);
    h_thr->SetStats(0);

    for( int i=0; i<int(nt.GetEntries()); i++ )
    {
        if( !nt.GetEntry(i) )
        {
            printf("Can not read an entry??\n");
            return NULL;
        }
        
        int
            port = int(nt.GetArgs()[0]),
            ch   = int(nt.GetArgs()[1]),
            bin  = 1+ch+port*64;
        
        float
            rate = nt.GetArgs()[3],
            thr  = nt.GetArgs()[2];
        h_rate->SetBinContent(bin,rate);
        if( rate>0 )
            h_rate_proj->Fill(rate);
        h_thr ->SetBinContent(bin,(thr-128)*2040/128);
    }
    
    
    char opts[22]="";
    
    if( canvas==NULL )
    {
        sprintf(buf,"%d_%s",catch_,session);
        canvas = new TCanvas(buf,buf);
        canvas->Divide(2,2);
    }
    else
    {
        strcpy(opts,"SAME");
        h_rate      ->SetLineColor(kRed);
        h_thr       ->SetLineColor(kRed);
        h_rate_proj ->SetLineColor(kRed);
    }
    canvas->cd(1);
    //gPad->SetLogy();
    h_rate->Draw(opts);
    draw_mapping(h_rate,catch_,1);
    canvas->cd(2);
    h_rate_proj->Draw(opts);
    canvas->cd(3);
    gPad->SetGrid(0,1);
    h_thr->Draw(opts);
    draw_mapping(h_thr,catch_);
    canvas->cd(0);
    
    
    return h_thr;
}