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.10 by tschum, Thu Dec 3 22:29:16 2009 UTC vs.
Revision 1.11 by tschum, Mon Dec 7 14:02:01 2009 UTC

# Line 14 | Line 14 | PlotTool::PlotTool() {
14  
15          showLegend = false;
16          logY = true;
17 <        addTrackJets = true;
17 >        addTrackJets = false;
18          verbose = true;
19  
20   }
# Line 217 | Line 217 | int PlotTool::plot(int chainIndex, strin
217                  return -1;
218  
219          TStopwatch timer;
220 <        timer.Start();
220 >        if(verbose) {
221 >          cout<<"Plot: "<<histName<<" "<<cutName<<" from chain "<<this->At(chainIndex)->GetName()<<endl;
222 >          timer.Start();
223 >        }
224  
225          int currN = nEntries;
226          if (nEntries < 0)
# Line 305 | Line 308 | int PlotTool::plot(int chainIndex, strin
308                          setCanvas( pads_[currPadName.str()] );
309          }
310  
311 <        timer.Stop();
311 >
312          if(verbose) {
313 <          cout<<"Done: "<<currN<<" events in "<<histName<<" "<<cutName<<" from chain "<<this->At(chainIndex)->GetName()<<endl;
313 >          timer.Stop();
314 >          cout<<"Done: "<<currN<<" events."<<endl;
315            timer.Print();
316          }
317          return draw_err;
# Line 715 | Line 719 | int PlotTool::saveCanvases(string name,
719  
720   }
721   //------------------------------------------------------------------
722 < void PlotTool::showChainInfo()
722 >
723 > int PlotTool::clearCanvases()
724   {
725  
726 +  while(gROOT->GetListOfCanvases()->GetEntries()) ((TCanvas*) gROOT->GetListOfCanvases()->At(0))->Close();
727 +  pads_.clear();
728 +  autoVars.clear();
729 +  return pads_.size() + gROOT->GetListOfCanvases()->GetEntries();
730 +
731 + }
732 + //------------------------------------------------------------------
733 + int PlotTool::setVariables(string label)
734 + {
735  
736    cout<<endl;
737    cout<<"****** Show Chain Information:"<<endl;
# Line 728 | Line 742 | void PlotTool::showChainInfo()
742    cout<<endl;
743    cout<<"We have "<<this->GetEntries()<<" TChains with following aliases set:"<<endl;
744          for (int i=0; i< this->GetEntries(); ++i) {
745 <          cout<<endl;
745 >          cout<<"--------------------------------"<<endl;
746            cout<<((TChain*) this->At(i))->GetName()<<endl;
747 <          ((TChain*) this->At(i))->GetListOfAliases()->ls();
747 >          cout<<"------------"<<endl;
748  
749 <        }
749 >          TList* leaves = (TList*) ((TChain*) this->At(i))->GetListOfLeaves();
750 >          for (int j=0; j< leaves->GetEntries(); ++j) {
751 >            TString leafName ( leaves->At(j)->GetName() );
752 >            if(! leafName.EndsWith(".") ) continue;
753 >            if(! leafName.Contains(label.c_str() ) ) continue;
754 >
755 >            TClass cl( ( (TLeafElement*) leaves->At(j) )->GetTypeName() );
756 >            cout<<"++++++"<<endl;
757 >            cout<< leafName.Data() <<endl;
758 >            for(int k=0;k<cl.GetListOfAllPublicMethods()->GetEntries();++k) {
759 >              string typeName ( ((TMethod*) cl.GetListOfAllPublicMethods()->At(k))->GetReturnTypeName() );
760 >              string methName ( cl.GetListOfAllPublicMethods()->At(k)->GetName() );
761 >              if( methName != "product") continue;
762 >                cout<< typeName <<endl;
763 >                string _type;
764 >                TString testString( typeName.c_str() );
765 >                if( testString.BeginsWith("vector<") ) {
766 >                  _type = typeName.substr(typeName.find("<")+1,typeName.find(">")-typeName.find("<")-1);
767 >                  string _varSize = leafName.Data();
768 >                  _varSize += "obj@.size()";
769 >                  autoVars.push_back( _varSize );
770 >                  }
771 >                else _type = typeName.substr(0,typeName.find("*"));
772 >                  TClass _cl( _type.c_str() );
773 >                  for(int l=0;l<_cl.GetListOfAllPublicMethods()->GetEntries();++l) {
774 >                    string _typeName ( ((TMethod*) _cl.GetListOfAllPublicMethods()->At(l))->GetReturnTypeName() );
775 >                    string _methName ( _cl.GetListOfAllPublicMethods()->At(l)->GetName() );
776 >                    //              if(_typeName.find("void") != string::npos ) continue;
777 >                    //              cout<<"   "<<_typeName<<"  "<<_methName<<endl;
778 >
779 >                    cout<<" "<<_typeName<<"  "<<_methName<<endl;
780 >                    if(_methName.find("operator")==string::npos&&(_typeName=="float"||_typeName=="double"||_typeName=="int"||_typeName=="unsigned int"||_typeName=="bool"||_typeName=="unsigned short"||_typeName=="unsigned long"||_typeName=="unsigned long long")) {
781 >
782 >                      cout<<"-->   "<<_typeName<<"  "<<_methName<<endl;
783 >
784 >                      string  _varName = leafName.Data();
785 >                      _varName += "obj.";
786 >                      _varName += _methName;
787 >                      _varName += "()";
788 >                      autoVars.push_back( _varName );
789 >                    }
790 >                  }
791 >                  
792 >              
793 >            }
794 >
795 >          }
796  
797 +        }
798  
799 +        return autoVars.size();
800  
801   }
802   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines