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.13 by tschum, Wed Dec 9 13:02:16 2009 UTC

# Line 14 | Line 14 | PlotTool::PlotTool() {
14  
15          showLegend = false;
16          logY = true;
17 <        addTrackJets = true;
17 >        addTrackJets = false;
18 >        addEventInfo = false;
19          verbose = true;
20  
21 +        globalCuts="";
22 +
23   }
24  
25   //------------------------------------------------------------------
26   //Fill object PlotTool with Chains constructed from files from given source
27  
28   int PlotTool::init(string fileName, string dirPath, string treeName,
29 <                string fileLabel) {
30 <        this->New(this->GetEntries() );
31 <        int currChain = this->GetEntries() - 1;
29 >                   string fileLabel) {
30 >  this->New(this->GetEntries() );
31 >  int currChain = this->GetEntries() - 1;
32 >
33 >  if (currChain < 0)
34 >    return currChain;
35 >
36 >  TStopwatch timer;
37 >  timer.Start();
38 >
39 >
40 >  fileNames.clear();
41 >
42 >  //check if alternative label is different from default(searchString)
43 >  if (fileLabel=="") {
44 >    fileLabel=fileName;
45 >  }
46 >  ((TChain*) this->At(currChain))->SetName(fileLabel.c_str());
47 >
48 >  TList *files = new TList();
49 >  TSystemFile* sysFile = 0;
50 >  if(fileName.find(".") != string::npos) {
51 >    ifstream f(fileName.c_str());
52 >    if( ! f.is_open() ) return -1;
53 >    string line;
54 >
55 >    while (!f.eof()) {
56 >      getline(f,line);
57 >      sysFile = new TSystemFile(line.c_str(),dirPath.c_str());
58 >      files->Add(sysFile);
59 >    }
60 >
61 >
62 >  } else {
63 >    TSystemDirectory dir("sourceDir", dirPath.c_str());
64 >    files = dir.GetListOfFiles();
65 >  }
66 >  if (files->GetEntries()>0) {
67 >    TIter next(files);
68 >    TSystemFile *file;
69 >    TString fname;
70 >    string filePath;
71 >
72 >    if(verbose && fileName.find(".") == string::npos )  cout<<"Open"<<dirPath.c_str()<<" Search for .root files that contain: "
73 >                                                            <<fileName.c_str()<<endl;
74 >    if(verbose && fileName.find(".") != string::npos )  cout<<"Open"<<dirPath.c_str()<<" Search lines with .root in: "
75 >                                                            <<fileName.c_str()<<endl;
76 >
77 >
78 >    while ((file=(TSystemFile*)next())) {
79 >      fname = file->GetName();
80 >      if (!fname.EndsWith(".root"))
81 >        continue;
82 >      if (!fname.Contains(fileName.c_str()) && fileName.find(".") == string::npos )
83 >        continue;
84 >
85 >      filePath = dirPath;
86 >      filePath += fname.Data();
87 >      //fwlite::ChainEvent to lop over events, jets, etc
88 >      fileNames.push_back(filePath.c_str());
89 >
90 >      if (((TChain*) this->At(currChain))->AddFile(filePath.c_str(), -1,
91 >                                                   treeName.c_str()) )
92 >        if(verbose)     cout<<"Chained "<<((TChain*) this->At(currChain))->GetNtrees()<<" file(s) with "<<((TChain*) this->At(currChain))->GetEntries()<<" events."<<endl;
93 >        else
94 >          return -1;
95  
96 <        if (currChain < 0)
97 <                return currChain;
96 >    }
97 >  } else
98 >    return -1;
99 >
100 >  for (int i=0; i<((TChain*) this->At(currChain))->GetListOfBranches()->GetEntries(); ++i) {
101 >
102 >    string s(((TChain*) this->At(currChain))->GetListOfBranches()->At(i)->GetName());
103 >
104 >    string branch_alias = s;
105 >    string branch_name = s;
106 >    if (s.find(".", s.size()-1) != string::npos)
107 >      branch_name += "obj";
108 >
109 >    size_t a = s.find("_");
110 >    if (a != string::npos) {
111 >      size_t b = s.find("_", a+1);
112 >      if (b != string::npos) {
113 >        size_t c = s.find("_", b+1);
114 >        if (c != string::npos) {
115 >          string _prod     =s.substr(0,a);
116 >          string _label    =s.substr(a+1, b-a-1);
117 >          string _instance =s.substr(b+1, c-b-1);
118 >          branch_alias = _label;
119 >          if(_instance.length() > 0 )  {
120 >            branch_alias += "_";
121 >            branch_alias += _instance;
122 >            ((TChain*) this->At(currChain))->SetAlias(_instance.c_str(),
123 >                                                      branch_name.c_str());
124 >          }
125 >          string branch_alias_full = _prod + "_" + branch_alias;
126 >          ((TChain*) this->At(currChain))->SetAlias(branch_alias_full.c_str(),
127 >                                                    branch_name.c_str());
128 >        }
129 >      }
130 >    }
131  
132 <        TStopwatch timer;
133 <        timer.Start();
132 >    ((TChain*) this->At(currChain))->SetAlias(branch_alias.c_str(),
133 >                                              branch_name.c_str());
134  
135 +  }
136  
137 <        fileNames.clear();
137 >  if( addEventInfo || addTrackJets) {
138  
139 <        //check if alternative label is different from default(searchString)
40 <        if (fileLabel=="") {
41 <                fileLabel=fileName;
42 <        }
43 <        ((TChain*) this->At(currChain))->SetName(fileLabel.c_str());
44 <        TSystemDirectory dir("sourceDir", dirPath.c_str());
45 <        TList *files = dir.GetListOfFiles();
46 <        if (files) {
47 <                TIter next(files);
48 <                TSystemFile *file;
49 <                TString fname;
50 <                string filePath;
51 <
52 <                if(verbose)     cout<<"Open"<<dirPath.c_str()<<" Search for .root files that contain: "
53 <                                <<fileName.c_str()<<endl;
54 <
55 <                while ((file=(TSystemFile*)next())) {
56 <                        fname = file->GetName();
57 <                        if (!fname.EndsWith(".root"))
58 <                                continue;
59 <                        if (!fname.Contains(fileName.c_str()))
60 <                                continue;
139 >    if(verbose)   cout<<"calculating additional variables..."<<endl;
140  
141 <                        filePath = dirPath;
142 <                        filePath += fname.Data();
143 <                        //fwlite::ChainEvent to lop over events, jets, etc
144 <                        fileNames.push_back(filePath.c_str());
145 <
146 <                        if (((TChain*) this->At(currChain))->AddFile(filePath.c_str(), -1,
147 <                                        treeName.c_str()) )
69 <                if(verbose)     cout<<"Chained "<<((TChain*) this->At(currChain))->GetNtrees()<<" file(s) with "<<((TChain*) this->At(currChain))->GetEntries()<<" events."<<endl;
70 <                        else
71 <                                return -1;
141 >    //make file for tree friends (adding additional, computed branches)
142 >    string friendFileName("/scratch/hh/current/cms/user/");
143 >    friendFileName += gSystem->GetUserInfo()->fUser;
144 >    friendFileName += "/temp/",
145 >      friendFileName += fileName;
146 >    friendFileName += ".root";
147 >    TFile *f = new TFile(friendFileName.c_str(),"recreate");
148  
149 <                }
74 <        } else
75 <                return -1;
149 >    if( f->IsZombie() ) return -1;
150  
151 <        for (int i=0; i<((TChain*) this->At(currChain))->GetListOfBranches()->GetEntries(); ++i) {
151 >    string friendTreeName("friendTree");
152 >    //char number = currChain;
153 >    //friendTreeName += number;
154 >    //TTree *friendTree = new TTree("friendTree","friendTree");
155 >    TTree *friendTree = new TTree(friendTreeName.c_str(),friendTreeName.c_str());
156 >    fwlite::ChainEvent ev(fileNames);
157 >     int _event, _run, _lumi;
158 >     int nJetsKT;
159 >     TrackJetKT = new float [100];
160  
161 <                string s(((TChain*) this->At(currChain))->GetListOfBranches()->At(i)->GetName());
161 >    if( addEventInfo ) {
162 >
163  
164 <                string branch_alias = s;
165 <                string branch_name = s;
166 <                if (s.find(".", s.size()-1) != string::npos)
84 <                        branch_name += "obj";
85 <
86 <                size_t a = s.find("_");
87 <                if (a != string::npos) {
88 <                  size_t b = s.find("_", a+1);
89 <                  if (b != string::npos) {
90 <                    size_t c = s.find("_", b+1);
91 <                    if (c != string::npos) {
92 <                      string _label    =s.substr(a+1, b-a-1);
93 <                      string _instance =s.substr(b+1, c-b-1);
94 <                      branch_alias = _label;
95 <                      if(_instance.length() > 0 )  {
96 <                        branch_alias += "_";
97 <                        branch_alias += _instance;
98 <                      }
99 <                    }
100 <                  }
101 <                }
164 >      friendTree->Branch("event", &_event, "event/I");
165 >      friendTree->Branch("run", &_run, "run/I");
166 >      friendTree->Branch("lumi", &_lumi, "lumi/I");
167  
168 <                ((TChain*) this->At(currChain))->SetAlias(branch_alias.c_str(),
104 <                                branch_name.c_str());
168 >    }
169  
170 <        }
170 >    if( addTrackJets ) {
171  
108        // add branch with track  Jets
172  
173 <        if( addTrackJets ) {
173 >      friendTree->Branch("nJetsKT", &nJetsKT, "nJetsKT/I");
174 >      friendTree->Branch("TrackJetKT", TrackJetKT, "TrackJetKT[nJetsKT]/F");
175 >    }
176  
112          //make file for tree friends (adding additional, computed branches)
113          string friendFileName("/scratch/hh/current/cms/user/");
114          friendFileName += gSystem->GetUserInfo()->fUser;
115          friendFileName += "/temp/",
116          friendFileName += fileName;
117          friendFileName += ".root";
118          TFile *f = new TFile(friendFileName.c_str(),"recreate");
119
120          if( f->IsZombie() ) return -1;
121
122          string friendTreeName("friendTree");
123          //char number = currChain;
124          //friendTreeName += number;
125          //TTree *friendTree = new TTree("friendTree","friendTree");
126          TTree *friendTree = new TTree(friendTreeName.c_str(),friendTreeName.c_str());
127
128          int nJetsKT;
129          TrackJetKT = new float [100];
130          fwlite::ChainEvent ev(fileNames);
131
132          friendTree->Branch("nJetsKT", &nJetsKT, "nJetsKT/I");
133          friendTree->Branch("TrackJetKT", TrackJetKT, "TrackJetKT[nJetsKT]/F");
134
135          if(verbose)   cout<<"calculating additional variables..."<<endl;
136          
137          
138
139          int tenth = ev.size() / 10;
140          int eventNum =0;
141          for (ev.toBegin(); !ev.atEnd(); ++ev, ++eventNum) {
142
143            fwlite::Handle<reco::CaloJetCollection> jets;
144            jets.getByLabel(ev, "antikt5CaloJets");
145
146            fwlite::Handle<reco::TrackCollection> tracks;
147            tracks.getByLabel(ev, "generalTracks");
148
149            if (!jets.isValid())
150              continue;
151            if (!tracks.isValid())
152              continue;
153            double trackSum;
154            nJetsKT = 0;
155            for (reco::CaloJetCollection::const_iterator jet = jets->begin(); jet
156                   !=jets->end(); jet++) {
157              trackSum = 0;
158              for (reco::TrackCollection::const_iterator track = tracks->begin(); track
159                     !=tracks->end(); track++) {
160                if (deltaR(jet->eta(), jet->phi(), track->eta(), track->phi())
161                    < 0.5)
162                  trackSum += track->pt();
163              }
164              TrackJetKT[nJetsKT] = trackSum;
165              nJetsKT++;
166            }
167            friendTree->Fill();
177  
178 <            if( eventNum != 0 && eventNum%tenth == 0) cout<<"Processed "<<eventNum <<" of "<<ev.size()<<" events. "<<endl;
178 >    int tenth = ev.size() / 10;
179 >    int eventNum =0;
180 >    for (ev.toBegin(); !ev.atEnd(); ++ev, ++eventNum) {
181 >
182 >
183 >      if( addEventInfo ) {
184 >
185 >        _event = ev.id().event();
186 >        _run   = ev.id().run();
187 >        _lumi = ev.luminosityBlock();
188  
189 +      }
190 +
191 +      if( addTrackJets ) {
192 +
193 +        fwlite::Handle<reco::CaloJetCollection> jets;
194 +        jets.getByLabel(ev, "antikt5CaloJets");
195 +
196 +        fwlite::Handle<reco::TrackCollection> tracks;
197 +        tracks.getByLabel(ev, "generalTracks");
198 +
199 +        if (!jets.isValid())
200 +          continue;
201 +        if (!tracks.isValid())
202 +          continue;
203 +        double trackSum;
204 +        nJetsKT = 0;
205 +        for (reco::CaloJetCollection::const_iterator jet = jets->begin(); jet
206 +               !=jets->end(); jet++) {
207 +          trackSum = 0;
208 +          for (reco::TrackCollection::const_iterator track = tracks->begin(); track
209 +                 !=tracks->end(); track++) {
210 +            if (deltaR(jet->eta(), jet->phi(), track->eta(), track->phi())
211 +                < 0.5)
212 +              trackSum += track->pt();
213            }
214 <          f->cd();
215 <          friendTree->Write();
174 <          f->Close();
175 <          ((TChain*) this->At(currChain))->AddFriend(friendTreeName.c_str(),
176 <                                                     friendFileName.c_str());
214 >          TrackJetKT[nJetsKT] = trackSum;
215 >          nJetsKT++;
216          }
217 +      }
218 +      friendTree->Fill();
219 +
220 +      if( eventNum != 0 && eventNum%tenth == 0) cout<<"Processed "<<eventNum <<" of "<<ev.size()<<" events. "<<endl;
221 +
222 +    }
223 +    f->cd();
224 +    friendTree->Write();
225 +    f->Close();
226 +    ((TChain*) this->At(currChain))->AddFriend(friendTreeName.c_str(),
227 +                                               friendFileName.c_str());
228 +
229 +
230 +
231 +  }
232  
233 <        timer.Stop();
234 <        if(verbose) timer.Print();
233 >
234 >  timer.Stop();
235 >  if(verbose) timer.Print();
236        
237 <        return this->GetEntries();
237 >  return this->GetEntries();
238  
239   }
240   //------------------------------------------------------------------
# Line 191 | Line 246 | int PlotTool::plot(int chainIndex, strin
246                  return -1;
247  
248          TStopwatch timer;
249 <        timer.Start();
249 >        if(verbose) {
250 >          cout<<"Plot: "<<histName<<" "<<cutName<<" from chain "<<this->At(chainIndex)->GetName()<<endl;
251 >          timer.Start();
252 >        }
253  
254          int currN = nEntries;
255          if (nEntries < 0)
# Line 240 | Line 298 | int PlotTool::plot(int chainIndex, strin
298  
299          if ( !pads_[currPadName.str()] || !gROOT->GetListOfCanvases()->FindObject(currPadName.str().c_str()) ) {
300                  pads_[currPadName.str()] = new TCanvas(currPadName.str().c_str(), currPadName.str().c_str());
301 <                if (logY)
302 <                        pads_[currPadName.str()]->SetLogy(1);
301 >                //              if (logY)
302 >                //                      pads_[currPadName.str()]->SetLogy(1);
303          } else {
304                  pads_[currPadName.str()]->cd();
305                  currOpt += "SAMES";
# Line 252 | Line 310 | int PlotTool::plot(int chainIndex, strin
310  
311  
312          //Draw histogram:
313 <        int draw_err = ((TChain*) this->At(chainIndex))->Draw(histName.c_str(), cutName.c_str(),
313 >        string cutNameWithGlobal = cutName;
314 >        if(cutName!="" && globalCuts!="")    cutNameWithGlobal += "&&";
315 >        if(globalCuts!="")                   cutNameWithGlobal += globalCuts;
316 >
317 >        int draw_err = ((TChain*) this->At(chainIndex))->Draw(histName.c_str(), cutNameWithGlobal.c_str(),
318                          currOpt.c_str(), currN);
319          if (draw_err < 0)
320                  return draw_err;
# Line 275 | Line 337 | int PlotTool::plot(int chainIndex, strin
337  
338          // Update for 2D histograms
339          if( pads_[currPadName.str()]->GetPrimitive(currHistName.str().c_str())->InheritsFrom("TH2") ) {
278
340                          pads_[currPadName.str()]->Draw();
341                          setCanvas( pads_[currPadName.str()] );
342          }
343  
344 <        timer.Stop();
345 <        if(verbose) {
346 <          cout<<"Done: "<<currN<<" events in "<<histName<<" "<<cutName<<" from chain "<<this->At(chainIndex)->GetName()<<endl;
344 >
345 >        if(verbose && draw_err > 0) {
346 >          timer.Stop();
347 >          cout<<"Done: Selected "<<draw_err<<" objects in "<< currN <<" processed events."<<endl;
348            timer.Print();
349          }
350          return draw_err;
# Line 515 | Line 577 | void PlotTool::setMathLabels(TH1* thisHi
577          string x = thisHist->GetXaxis()->GetTitle();
578          string y = thisHist->GetYaxis()->GetTitle();
579  
580 <        if (t.find(".phi()") != string::npos)
581 <                t.replace(t.find(".phi()"), 6, " #phi");
580 > //      if (x.find("__") != string::npos)
581 > //        x = x.substr(0,x.find("__"));
582 > //      if (y.find("__") != string::npos)
583 > //        y = y.substr(0,y.find("__"));
584 >
585          if (x.find(".phi()") != string::npos)
586                  x.replace(x.find(".phi()"), 6, " #phi");
587          if (y.find(".phi()") != string::npos)
588                  y.replace(y.find(".phi()"), 6, " #phi");
589  
525        if (t.find(".eta()") != string::npos)
526                t.replace(t.find(".eta()"), 6, " #eta");
590          if (x.find(".eta()") != string::npos)
591                  x.replace(x.find(".eta()"), 6, " #eta");
592          if (y.find(".eta()") != string::npos)
593                  y.replace(y.find(".eta()"), 6, " #eta");
594  
595 <        if (t.find(".pt()") != string::npos)
596 <                t.replace(t.find(".pt()"), 5, " p_{T}");
595 >        if (x.find(".theta()") != string::npos)
596 >                x.replace(x.find(".theta()"), 6, " #theta");
597 >        if (y.find(".theta()") != string::npos)
598 >                y.replace(y.find(".theta()"), 6, " #theta");
599 >
600 >        if (x.find(".chi2()") != string::npos)
601 >                x.replace(x.find(".chi2()"), 7, " #chi^{2}");
602 >        if (y.find(".chi2()") != string::npos)
603 >                y.replace(y.find(".chi2()"), 7, " #chi^{2}");
604 >
605          if (x.find(".pt()") != string::npos)
606 <                x.replace(x.find(".pt()"), 5, " p_{T}");
606 >                x.replace(x.find(".pt()"), 5, " p_{T} [GeV]");
607          if (y.find(".pt()") != string::npos)
608 <                y.replace(y.find(".pt()"), 5, " p_{T}");
608 >                y.replace(y.find(".pt()"), 5, " p_{T} [GeV]");
609 >
610 >        if (x.find(".et()") != string::npos)
611 >                x.replace(x.find(".et()"), 5, " E_{T} [GeV]");
612 >        if (y.find(".et()") != string::npos)
613 >                y.replace(y.find(".et()"), 5, " E_{T} [GeV]");
614 >
615 >        //splitlines for many cuts
616 >        string test1= "{" + globalCuts + "}";
617 >        string test2= "&&" + globalCuts;
618 >
619 >        if(t.find(test1) != string::npos) t.replace(t.find(test1),test1.length(),"");
620 >        if(t.find(test2) != string::npos) t.replace(t.find(test2),test2.length(),"");
621 >
622 >        if (t.find("{") != string::npos && t.find("#splitline") == string::npos) {
623 >          t.replace(t.find_last_of("{"), 1, "}{");
624 >          string t_old = t;
625 >          t = "#splitline{";
626 >          t +=  t_old;
627 >        }
628  
629          thisHist ->SetTitle(t.c_str());
630          thisHist->GetXaxis()->SetTitle(x.c_str());
# Line 652 | Line 742 | void PlotTool::createColors() {
742  
743   //------------------------------------------------------------------
744  
745 < int PlotTool::saveCanvases(string type, string path) {
745 > int PlotTool::saveCanvases(string name, string path) {
746  
747          TSystemDirectory d("", path.c_str());
748          if (!d.GetListOfFiles())
749                  return -1;
660        if (type.find(".") == string::npos)
661                return -1;
750  
751 <        int savedFiles =0;
751 >        string namePs = path +"/" + name;
752 >        string nameRt = path +"/" + name;
753 >
754 >        if (name.find(".ps") == string::npos)
755 >                namePs += ".ps";
756 >
757 >        if (name.find(".root") == string::npos)
758 >                nameRt += ".root";
759 >
760 >        int savedCanvs =0;
761 >
762  
763          TIter next(gROOT->GetListOfCanvases());
764          TCanvas* canv;
765          while ((canv=(TCanvas*)next())) {
766 +          string modName = (*canv).GetName();
767 +          if(modName.find("{") != string::npos) modName = modName.substr(0,modName.find("{"));
768 +          (*canv).SetTitle( modName.c_str() );
769  
770 <                string s = "";
670 <                s += path;
671 <                s += canv->GetName();
672 <                s += type;
770 >        }
771  
772 <                canv->SaveAs(s.c_str());
773 <                ++savedFiles;
772 >
773 >        TPostScript ps(namePs.c_str(),112);
774 >        TFile rt(nameRt.c_str(),"recreate");
775 >
776 >        next.Reset();
777 >        while ((canv=(TCanvas*)next())) {
778 >          ps.NewPage();
779 >
780 >
781 >          (*canv).Write();
782 >          (*canv).Draw();
783 >          (*canv).Update();
784 >
785 >
786 >          ++savedCanvs;
787  
788          }
789  
790 <        return savedFiles;
790 >        ps.Close();
791 >        rt.Close();
792 >
793  
794 +        if(verbose && savedCanvs) {
795 +          cout<<"Saved file "<<rt.GetName()<<" with "<<savedCanvs<<" canvases."<<endl;
796 +          cout<<"Saved file "<<ps.GetName()<<" with "<<savedCanvs<<" pages."<<endl;
797   }
798 < //------------------------------------------------------------------
683 < void PlotTool::showChainInfo()
684 < {
798 >        return savedCanvs;
799  
800 + }
801 + //------------------------------------------------------------------
802  
803 <  cout<<endl;
804 <  cout<<"****** Show Chain Information:"<<endl;
803 > int PlotTool::clearCanvases()
804 > {
805  
806 +  while(gROOT->GetListOfCanvases()->GetEntries()) ((TCanvas*) gROOT->GetListOfCanvases()->At(0))->Close();
807 +  pads_.clear();
808 +  autoVars.clear();
809 +  return pads_.size() + gROOT->GetListOfCanvases()->GetEntries();
810  
811 <  this->ls();
811 > }
812 > //------------------------------------------------------------------
813 > int PlotTool::setVariables(string label)
814 > {
815  
693  cout<<endl;
694  cout<<"We have "<<this->GetEntries()<<" TChains with following aliases set:"<<endl;
816          for (int i=0; i< this->GetEntries(); ++i) {
817 <          cout<<endl;
817 >          cout<<"--------------------------------"<<endl;
818            cout<<((TChain*) this->At(i))->GetName()<<endl;
819 <          ((TChain*) this->At(i))->GetListOfAliases()->ls();
819 >          cout<<"------------"<<endl;
820  
821 <        }
821 >          TList* leaves = (TList*) ((TChain*) this->At(i))->GetListOfLeaves();
822 >          for (int j=0; j< leaves->GetEntries(); ++j) {
823 >            TString leafName ( leaves->At(j)->GetName() );
824 >            if(! leafName.EndsWith(".") ) continue;
825 >            if(! leafName.Contains(label.c_str() ) ) continue;
826 >
827 >            TClass cl( ( (TLeafElement*) leaves->At(j) )->GetTypeName() );
828 >            cout<<"++++++"<<endl;
829 >            cout<< leafName.Data() <<endl;
830 >            for(int k=0;k<cl.GetListOfAllPublicMethods()->GetEntries();++k) {
831 >              string typeName ( ((TMethod*) cl.GetListOfAllPublicMethods()->At(k))->GetReturnTypeName() );
832 >              string methName ( cl.GetListOfAllPublicMethods()->At(k)->GetName() );
833 >              if( methName != "product") continue;
834 >                cout<< typeName <<endl;
835 >                string _type;
836 >                TString testString( typeName.c_str() );
837 >                if( testString.BeginsWith("vector<") ) {
838 >                  _type = typeName.substr(typeName.find("<")+1,typeName.find(">")-typeName.find("<")-1);
839 >                  string _varSize = leafName.Data();
840 >                  _varSize += "obj@.size()";
841 >                  autoVars.push_back( _varSize );
842 >                  }
843 >                else _type = typeName.substr(0,typeName.find("*"));
844 >                  TClass _cl( _type.c_str() );
845 >                  for(int l=0;l<_cl.GetListOfAllPublicMethods()->GetEntries();++l) {
846 >                    string _typeName ( ((TMethod*) _cl.GetListOfAllPublicMethods()->At(l))->GetReturnTypeName() );
847 >                    string _methName ( _cl.GetListOfAllPublicMethods()->At(l)->GetName() );
848 >                    //              if(_typeName.find("void") != string::npos ) continue;
849 >                    //              cout<<"   "<<_typeName<<"  "<<_methName<<endl;
850 >
851 >                    cout<<" "<<_typeName<<"  "<<_methName<<endl;
852 >                    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")) {
853 >
854 >                      cout<<"-->   "<<_typeName<<"  "<<_methName<<endl;
855 >
856 >                      string  _varName = leafName.Data();
857 >                      _varName += "obj.";
858 >                      _varName += _methName;
859 >                      _varName += "()";
860 >                      autoVars.push_back( _varName );
861 >                    }
862 >                  }
863 >                  
864 >              
865 >            }
866 >
867 >          }
868  
869 +        }
870  
871 +        return autoVars.size();
872  
873   }
874   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines