Beispiel #1
0
void TH2TAPS::DrawShape(TH2DrawTool& c, bool isBaF2) {
    if(isBaF2) 
        c.Draw(TH2TAPS::baf2_shape);
    else 
        c.Draw(TH2TAPS::pbwo4_shape);
    c.FinishShape();
 
    // FinishShape adds the bin, so we get it here again
    TH2PolyBin* bin_obj = (TH2PolyBin*) fBins->Last();
    TGraph* polygon = (TGraph*)bin_obj->GetPolygon();
    if(isBaF2)
        polygon->SetNameTitle("", Form("Element %d (BaF2)",fBins->GetEntries()-1));
    else
        polygon->SetNameTitle("", Form("Element %d (PbWO4)",fBins->GetEntries()-1));
}
void TH2CB::MakeLevel(TH2DrawTool &c, const UInt_t n, set<Int_t>::const_iterator &nexthole, UInt_t& vbins)
{

    const vec& a(shape.at(1));
    const vec& b(shape.at(2));

    if(n>=4) {

        ++vbins;

        if( (nexthole == bins_in_holes.end()) || (*nexthole!=vbins)) {
            c.Draw(shape);
            c.FinishShape();
        } else
            if ( nexthole != bins_in_holes.end() ) {
                   ++nexthole;
        }

    } else {
        c.PushMatrix();
        c.Scale(1.0/n,1.0/n);
       for( UInt_t row=0; row<n; ++row){
            const UInt_t triganles = 2*row +1;
            c.PushMatrix();
            c.Translate( (n-row-1.0)* b );
            for( UInt_t t=0; t<triganles; ++t) {
                if(t%2==0) {
                    MakeLevel(c,n+1,nexthole,vbins);
                    c.Translate(a);}
                else {
                    c.Translate(b);
                    c.Scale(-1,-1);
                    MakeLevel(c,n+1,nexthole,vbins);
                    c.Translate(b);
                    c.Scale(-1,-1);
                }
            }
            c.PopMatrix();
        }
        c.PopMatrix();
    }

}