ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/tschum/FWlite_Analysis/PlotTool.cc
(Generate patch)

Comparing UserCode/tschum/FWlite_Analysis/PlotTool.cc (file contents):
Revision 1.8 by tschum, Wed Dec 2 15:57:44 2009 UTC vs.
Revision 1.9 by tschum, Thu Dec 3 11:24:14 2009 UTC

# Line 89 | Line 89 | int PlotTool::init(string fileName, stri
89                    if (b != string::npos) {
90                      size_t c = s.find("_", b+1);
91                      if (c != string::npos) {
92 +                      string _prod     =s.substr(0,a);
93                        string _label    =s.substr(a+1, b-a-1);
94                        string _instance =s.substr(b+1, c-b-1);
95                        branch_alias = _label;
96                        if(_instance.length() > 0 )  {
97                          branch_alias += "_";
98                          branch_alias += _instance;
99 +                        ((TChain*) this->At(currChain))->SetAlias(_instance.c_str(),
100 +                                                                  branch_name.c_str());
101                        }
102 +                      string branch_alias_full = _prod + "_" + branch_alias;
103 +                      ((TChain*) this->At(currChain))->SetAlias(branch_alias_full.c_str(),
104 +                                branch_name.c_str());
105                      }
106                    }
107                  }
# Line 240 | Line 246 | int PlotTool::plot(int chainIndex, strin
246  
247          if ( !pads_[currPadName.str()] || !gROOT->GetListOfCanvases()->FindObject(currPadName.str().c_str()) ) {
248                  pads_[currPadName.str()] = new TCanvas(currPadName.str().c_str(), currPadName.str().c_str());
249 <                if (logY)
250 <                        pads_[currPadName.str()]->SetLogy(1);
249 >                //              if (logY)
250 >                //                      pads_[currPadName.str()]->SetLogy(1);
251          } else {
252                  pads_[currPadName.str()]->cd();
253                  currOpt += "SAMES";
# Line 275 | Line 281 | int PlotTool::plot(int chainIndex, strin
281  
282          // Update for 2D histograms
283          if( pads_[currPadName.str()]->GetPrimitive(currHistName.str().c_str())->InheritsFrom("TH2") ) {
278
284                          pads_[currPadName.str()]->Draw();
285                          setCanvas( pads_[currPadName.str()] );
286          }
# Line 652 | Line 657 | void PlotTool::createColors() {
657  
658   //------------------------------------------------------------------
659  
660 < int PlotTool::saveCanvases(string type, string path) {
660 > int PlotTool::saveCanvases(string name, string path) {
661  
662          TSystemDirectory d("", path.c_str());
663          if (!d.GetListOfFiles())
664                  return -1;
660        if (type.find(".") == string::npos)
661                return -1;
665  
666 <        int savedFiles =0;
666 >        string namePs = path +"/" + name;
667 >        string nameRt = path +"/" + name;
668 >
669 >        if (name.find(".ps") == string::npos)
670 >                namePs += ".ps";
671 >
672 >        if (name.find(".root") == string::npos)
673 >                nameRt += ".root";
674 >
675 >        int savedCanvs =0;
676 >
677 >        TPostScript ps(namePs.c_str(),112);
678 >        TFile rt(nameRt.c_str(),"recreate");
679  
680          TIter next(gROOT->GetListOfCanvases());
681          TCanvas* canv;
682          while ((canv=(TCanvas*)next())) {
683 <
684 <                string s = "";
685 <                s += path;
686 <                s += canv->GetName();
687 <                s += type;
673 <
674 <                canv->SaveAs(s.c_str());
675 <                ++savedFiles;
683 >          ps.NewPage();
684 >          (*canv).Draw();
685 >          (*canv).Update();
686 >          (*canv).Write();
687 >          ++savedCanvs;
688  
689          }
690  
691 <        return savedFiles;
691 >        ps.Close();
692 >        rt.Close();
693 >
694 >        return savedCanvs;
695  
696   }
697   //------------------------------------------------------------------

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines