ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/macros/doc/make_doc.C
Revision: 1.7
Committed: Mon Jul 20 13:49:27 2009 UTC (15 years, 9 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_010
Changes since 1.6: +25 -19 lines
Log Message:
best working version.

File Contents

# User Rev Content
1 loizides 1.7 // $Id: make_doc.C,v 1.6 2009/07/20 04:57:02 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 loizides 1.6 #include <TDocInfo.h>
22 loizides 1.1 #endif
23    
24     class MyHtml : public THtml
25     {
26     public:
27 loizides 1.5 class MyModDef: public TModuleDefinition {
28     public:
29     bool GetModule(TClass* cl, TString& out_modulename) const {
30     TString cn(cl->GetName());
31 loizides 1.6 if (!cn.BeginsWith("mithep") && !cn.BeginsWith("TAM")) {
32 loizides 1.7 return 0;
33     //return TModuleDefinition::GetModule(cl, out_modulename);
34 loizides 1.6 }
35 loizides 1.5 TString tmp(cl->GetDeclFileName());
36     Ssiz_t fst = tmp.Index("/Mit")+1;
37     Ssiz_t snd = tmp.Index("/",tmp.Index("/",fst)+1);
38     out_modulename = tmp(fst,snd-fst);
39     return 1;
40     }
41 loizides 1.6
42     ClassDef(MyModDef, 0) // MyModDef class for BAMBU module definition
43     };
44 loizides 1.5
45     MyHtml()
46     {
47     MyModDef m;
48     SetModuleDefinition(m);
49     }
50 loizides 1.1 void SetIncludePath(const char *p) { fPathInfo.fIncludePath=p; }
51 loizides 1.7 void GetModuleNameForClass(TString& module, TClass* /*cl*/) const
52 loizides 1.5 {
53 loizides 1.7 module = "NOTUSED";
54     return;
55 loizides 1.5 }
56 loizides 1.7 void Debug() const
57 loizides 1.6 {
58 loizides 1.7 TModuleDocInfo* module = 0;
59     TIter iterModule(GetListOfModules());
60    
61     while ((module = (TModuleDocInfo*)iterModule())) {
62     cout << module->GetName() << " " << module->IsSelected() << endl;
63     }
64     }
65    
66     void RunAll(Bool_t force, const char *filter)
67     {
68     CreateListOfClasses(filter);
69     TModuleDocInfo* module =
70     dynamic_cast<TModuleDocInfo*>(GetListOfModules()->FindObject("MitCommon"));
71     if (module)
72     module->SetSelected();
73     THtml::MakeAll(force,filter);
74 loizides 1.6 }
75 loizides 1.1
76 loizides 1.7 ClassDef(MyHtml, 0) // MyHtml class for BAMBU docu
77 loizides 1.1 };
78    
79     void load_libs(const char *ln)
80     {
81     TDirectory::TContext context(0); // automatically restore gDirectory
82     TRegexp re(Form("lib%s*.so", ln), true);
83     TString lpath(gSystem->ExpandPathName("$CMSSW_BASE/lib/$SCRAM_ARCH"));
84     void *dir = gSystem->OpenDirectory(lpath);
85     if(!dir) return;
86     while(const char *file = gSystem->GetDirEntry(dir)) {
87     TString s(file);
88     if (s.Index(re) == kNPOS)
89     continue;
90     ::Info("make_doc","Loading %s", file);
91     gSystem->Load(file);
92     }
93     gSystem->FreeDirectory(dir);
94     }
95    
96     void make_doc()
97     {
98     MyHtml h;
99     h.SetProductName("MitRoot");
100    
101     // load our libraries
102 loizides 1.2 load_libs("MitCommon");
103 loizides 1.1 load_libs("MitAna");
104 loizides 1.2 load_libs("MitPhysics");
105 loizides 1.1
106 loizides 1.3 TString cb(gSystem->ExpandPathName("$CMSSW_BASE"));
107 loizides 1.5 h.SetInputDir("$CMSSW_BASE/src:$ROOTSYS/include");
108     h.SetIncludePath(Form("%s/src/",cb.Data()));
109 loizides 1.1 h.SetClassDocTag("//------------------------------------------------------------");
110     h.SetViewCVS("http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/UserCode/");
111 loizides 1.6 h.SetRootURL("http://root.cern.ch/root/html522");
112 loizides 1.7 h.RunAll(0,"(mithep::|TAM)");
113 loizides 1.1 }