ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/macros/doc/make_doc.C
Revision: 1.5
Committed: Fri Jul 17 10:47:04 2009 UTC (15 years, 9 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.4: +35 -5 lines
Log Message:
Best version working.

File Contents

# User Rev Content
1 loizides 1.5 // $Id: make_doc.C,v 1.4 2009/07/17 07:31:56 loizides Exp $
2 loizides 1.1
3     #if !defined(__CINT__) || defined(__MAKECINT__)
4     #include <iostream>
5     #include <fstream>
6     #include <TError.h>
7     #include <THashList.h>
8     #include <THtml.h>
9     #include <TList.h>
10     #include <TNamed.h>
11     #include <TRegexp.h>
12     #include <TROOT.h>
13     #include <TSystem.h>
14     #include <TDirectory.h>
15     #include <TString.h>
16     #include <TPRegexp.h>
17     #include <TObjArray.h>
18     #include <TObjString.h>
19     #include <TEnv.h>
20     #include <THtml.h>
21     #endif
22    
23     class MyHtml : public THtml
24     {
25     public:
26 loizides 1.5 class MyModDef: public TModuleDefinition {
27     public:
28     bool GetModule(TClass* cl, TString& out_modulename) const {
29     TString cn(cl->GetName());
30     if (!cn.BeginsWith("mithep") && !cn.BeginsWith("TAM"))
31     return TModuleDefinition::GetModule(cl, out_modulename);
32    
33     TString tmp(cl->GetDeclFileName());
34     Ssiz_t fst = tmp.Index("/Mit")+1;
35     Ssiz_t snd = tmp.Index("/",tmp.Index("/",fst)+1);
36     out_modulename = tmp(fst,snd-fst);
37     return 1;
38     }
39     ClassDef(MyModDef, 0);
40     };
41    
42     MyHtml()
43     {
44     MyModDef m;
45     SetModuleDefinition(m);
46     }
47 loizides 1.1 void SetIncludePath(const char *p) { fPathInfo.fIncludePath=p; }
48 loizides 1.5 void GetModuleNameForClass(TString& module, TClass* cl) const
49     {
50     TString cn(cl->GetName());
51     if (!cn.BeginsWith("mithep") && !cn.BeginsWith("TAM"))
52     return THtml::GetModuleNameForClass(module, cl);
53     TString tmp(cl->GetDeclFileName());
54     Ssiz_t fst = tmp.Index("/Mit")+1;
55     Ssiz_t snd = tmp.Index("/",tmp.Index("/",fst)+1);
56     module = tmp(fst,snd-fst);
57     }
58 loizides 1.1
59     ClassDef(MyHtml, 0);
60     };
61    
62     void load_libs(const char *ln)
63     {
64     TDirectory::TContext context(0); // automatically restore gDirectory
65     TRegexp re(Form("lib%s*.so", ln), true);
66     TString lpath(gSystem->ExpandPathName("$CMSSW_BASE/lib/$SCRAM_ARCH"));
67     void *dir = gSystem->OpenDirectory(lpath);
68     if(!dir) return;
69     while(const char *file = gSystem->GetDirEntry(dir)) {
70     TString s(file);
71     if (s.Index(re) == kNPOS)
72     continue;
73     ::Info("make_doc","Loading %s", file);
74     gSystem->Load(file);
75     }
76     gSystem->FreeDirectory(dir);
77     }
78    
79     void make_doc()
80     {
81     MyHtml h;
82     h.SetProductName("MitRoot");
83    
84     // load our libraries
85 loizides 1.2 load_libs("MitCommon");
86 loizides 1.1 load_libs("MitAna");
87 loizides 1.2 load_libs("MitPhysics");
88 loizides 1.1
89 loizides 1.3 TString cb(gSystem->ExpandPathName("$CMSSW_BASE"));
90 loizides 1.5 h.SetInputDir("$CMSSW_BASE/src:$ROOTSYS/include");
91     h.SetIncludePath(Form("%s/src/",cb.Data()));
92 loizides 1.1 h.SetClassDocTag("//------------------------------------------------------------");
93     h.SetViewCVS("http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/");
94 loizides 1.4 h.SetLibURL("$ROOTSYS/lib","http://root.cern.ch/root/html522");
95 loizides 1.5 h.MakeAll(0,"(mithep::|TAM)");
96 loizides 1.1 }