ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/RootMacros/plotHistogramsTogether.C
(Generate patch)

Comparing UserCode/RootMacros/plotHistogramsTogether.C (file contents):
Revision 1.3 by anderson, Wed Jan 28 22:36:58 2009 UTC vs.
Revision 1.6 by anderson, Thu Jul 2 19:44:38 2009 UTC

# Line 141 | Line 141 | void plot2Histograms(TH1* htemp1, TH1* h
141    //TString title = htemp1->GetName();
142    TString title = htemp1->GetTitle();
143  
144 +  // Make sure histograms exist
145 +  if ( !htemp2 ) {
146 +    cout << "Histogram missing from 2nd file: " << htemp1->GetName() << endl;
147 +    return;
148 +  }
149 +
150    // Scale by given factor.
151    // If given factor is negative, area normalize
152    if (scale1 > 0.0) {
# Line 169 | Line 175 | void plot2Histograms(TH1* htemp1, TH1* h
175  
176    // Create TStack but we will draw without stacking
177    THStack *tempStack = new THStack();
178 <  tempStack->Add(htemp1,"same");
179 <  tempStack->Add(htemp2,"same");
178 >  tempStack->Add(htemp1,"sames");
179 >  tempStack->Add(htemp2,"sames");
180  
181    // Draw the histogram and titles
182    tempStack->Draw("hist nostack");
183    tempStack->SetTitle(title);
184 <  //tempStack->GetXaxis()->SetTitle(titleX);
184 >  tempStack->GetXaxis()->SetTitle(htemp1->GetXaxis()->GetTitle());
185  
186    // Draw the legend
187    TLegend *infoBox = new TLegend(0.75, 0.83, 0.99, 0.99, "");
188    infoBox->AddEntry(htemp1,label1,"L");
189    infoBox->AddEntry(htemp2,label2,"L");
190 +  infoBox->SetShadowColor(0);  // 0 = transparent
191 +  infoBox->SetFillColor(kWhite);
192    infoBox->Draw();
193  
194    // Place the stats boxes to be non-overlapping

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines