RE: Superimposing without drawing

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Tue, 5 Sep 2006 16:04:58 +0200

 

With the example you sent earlier the data & the line were visible in the gif file. Can you send a small macro reproducing this *new* problem ? Also, "groff" is certainly NOT a drawing option you should pass to graph->Draw() or line->Draw(). The drawing option for these two objects must be something like:

graph1->Draw("AL");
line1->Draw();

 Cheers, O.Couet
-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Adam Roe Sent: Tuesday, September 05, 2006 3:42 PM To: Christophe Delaere; Stan Seibert
Cc: roottalk (Mailing list discussing all aspects of the ROOT system) Subject: RE: [ROOT] Superimposing without drawing

Hi All,
Thanks for the advice. I haven't quite gotten it all to work yet, though. In the setup like my previous example, gROOT->SetBatch() works perfectly. However, in my real setup where I loop over 6 graphs and put them in a single canvas, with lines superimposed, the data does not show up in the .gif files, only the two superimposed lines do. This section of code is at the bottoem. Any ideas?

Using Christophe's alternative method, I can't get the superimposition without graphics to work at all. the following draw options: graph1->Draw("groff");
line1->Draw("same");
line2->Draw("same");

OR using:

graph1->Draw("groff");
line1->Draw("groff");
line2->Draw("groff");

OR using:

graph1->Draw("groff");
line1->Draw();
line2->Draw();

I get the same effect: a graph to the screen with only the imposed lines, not the original data, and the same thing written to .gif.

So i have four different approaches with a similar effect... but none quite right.

the important pieces of the real code follows. the "..." means something i've left out, which is either asthetic or has to do with directory manipulation, or something to that effect. So in these terms, what is called "MEAN" works, and what is called "STRIP", the inner loop, does not.
Thanks again,
Adam

{
gROOT->SetBatch();
...

  //create rms canvas arrays
  TObjArray CANV_PEDRMS_STRIP_ARRAY(nCham*nDDU);   TObjArray CANV_PEDRMS_MEAN_ARRAY(nCham*nDDU);  

//create rms lines
TLine *horiz_low_pedrms = new TLine(0,0,80,0); TLine *horiz_high_pedrms = new TLine(0,10,80,10); TLine *vert_low_pedrms = new TLine(10, 0, 10, 200); TLine *vert_high_pedrms = new TLine(0, 0, 0, 200);

...

TH1F *cha[480];
 TH2F *lay[2880];
  for(int i=0; i<nDDU; ++i){
    for (int j=0; j<nCham; ++j){

      gStyle->SetMarkerStyle(20);
      gStyle->SetMarkerSize(1.0);
 

      //RMS mean Canvases
      TString CANV_PEDRMS_MEAN_NAME = Form("Chamber_%d_RMS_DDU_%d",j+1,
i+1);
      TCanvas* canv_rms1 ;
      canv_rms1 =  new

TCanvas(CANV_PEDRMS_MEAN_NAME,CANV_PEDRMS_MEAN_NAME, 200, 10, 1200, 800);

      CANV_PEDRMS_MEAN_ARRAY.Add(canv_rms1);  

      //RMS strip Canvases
      TString CANV_PEDRMS_STRIP_NAME =
Form("Chamber_%d_RMS_per_Strip_DDU_%d",j+1, i+1);
      TCanvas* canv_rms2;
      canv_rms2 = new

TCanvas(CANV_PEDRMS_STRIP_NAME,CANV_PEDRMS_STRIP_NAME, 200, 10, 1200, 800);
      canv_rms2->Divide(2,3);
      CANV_PEDRMS_STRIP_ARRAY.Add(canv_rms2);

    //create, fill and draw overall RMS graphs  

      int chamber_access_int =( (nCham*i)+ j);
      TString hist_name= Form("cha[%d]", chamber_access_int);
      cha[j] = new TH1F(hist_name, "rms mean plot", 100, -2, 12);
 

      TCanvas *thisCanv_mean =
CANV_PEDRMS_MEAN_ARRAY[chamber_access_int];
      thisCanv_mean->cd();
 

      const char val[7];
      sprintf(val, "cham==%d", j);
      const char *val_ = val;
 

      TString graph_name_TH1F = Form("pedRMS>>cha[%d]",j);
 

      TString new_title1 = Form("Chamber_%d_DDU_%d", j+1, i+1);
      cha[j]->SetTitle(new_title1);
 

      Calibration->UseCurrentStyle();
      Calibration->Draw(graph_name_TH1F,val_);
      vert_low_pedrms->Draw();
      vert_high_pedrms->Draw();
 

      TString canvName =
CANV_PEDRMS_MEAN_ARRAY[chamber_access_int]->GetName();
      TString dir_name = "pedRMSLayerMean/";
      TString CanvName = dir_name + canvName + ".gif";
      thisCanv_mean->Print(CanvName);

   for (int k=0; k<nLayer; ++k){
        int layer_access_int = ( (nCham*nLayer*i) + (nLayer*j) + k );
        //RMS: create, fill and draw strip graphs
        TString hist_name_= Form("lay[%d]",layer_access_int);
 

        lay[layer_access_int] = new TH2F(hist_name_,"RMS strip plot",
80, 0, 80, 10, -2, 12);  

        TCanvas *thisCanv_rms_strip =
CANV_PEDRMS_STRIP_ARRAY[chamber_access_int];

        thisCanv_rms_strip -> cd(k+1);  

        TString graph_name_TH2F = Form("pedRMS:strip>>lay[%d]" ,layer_access_int);  

        const char valu[17];
        sprintf(valu, "cham==%d&&layer==%d",j,k);
        const char *valu_ = valu;
 

        lay[layer_access_int]->SetMarkerStyle(20);
        TString new_title2 = Form("Layer_%d", k+1);
        lay[layer_access_int]->SetTitle(new_title2);
        Calibration->UseCurrentStyle();
        Calibration->Draw(graph_name_TH2F, valu_);
        horiz_low_pedrms->Draw();
        horiz_high_pedrms->Draw();
 

      }//layer loop
      TString canvName =
CANV_PEDRMS_STRIP_ARRAY[chamber_access_int]->GetName();
      TString dir_name = "pedRMSStrips/";
      TString CanvName = dir_name + canvName + ".gif";
      thisCanv_rms_strip->Print(CanvName);
 

    }//chamber loop
  }//DDU loop Received on Tue Sep 05 2006 - 16:05:07 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET