Parent Directory
|
Revision Log
Revision 1.1 - (view) (download) (as text)
1 : | efrank | 1.1 | //************************************************************************ |
2 : | // Play with exploring the e. coli reco in biosimscratch. | ||
3 : | // | ||
4 : | //************************************************************************ | ||
5 : | |||
6 : | #include <string> | ||
7 : | #include <vector> | ||
8 : | #include <iterator> | ||
9 : | |||
10 : | #include "RecoReadout/RecoElem.hh" | ||
11 : | #include "RecoReadout/Reaction.hh" | ||
12 : | |||
13 : | #include "RecoReadoutOracle/EFRecoElemImpl.hh" | ||
14 : | #include "RecoReadoutOracle/OracleMgr.hh" | ||
15 : | |||
16 : | int xduGen( RecoElem& r, std::string path ); | ||
17 : | void editName( std::string& s ); | ||
18 : | |||
19 : | //************************************************************************ | ||
20 : | int | ||
21 : | main(int argc, char* arg[] ) { | ||
22 : | //************************************************************************ | ||
23 : | |||
24 : | // Normally, we'd consult a Reco dictionary to find a reco we cared | ||
25 : | // about. But that's not built yet. So, I'm going to cook up | ||
26 : | // the top of a reconstruction I know is in the database. In real | ||
27 : | // life, you'd peruse the dictionary and just be handed a RecoElem | ||
28 : | // to mess with. | ||
29 : | |||
30 : | OracleMgr::mgr().startJob(); | ||
31 : | RecoElem recoTop( new EFRecoElemImpl( "Top of Everything", 20000 )); | ||
32 : | |||
33 : | // OK. Mess with it. Get its kids and print them out. | ||
34 : | |||
35 : | std::string path=""; | ||
36 : | xduGen( recoTop, path ); | ||
37 : | |||
38 : | return 0; | ||
39 : | } | ||
40 : | |||
41 : | //************************************************************************ | ||
42 : | int | ||
43 : | xduGen( RecoElem& r, std::string path ) { | ||
44 : | //************************************************************************ | ||
45 : | int result = 0; | ||
46 : | std::string s; | ||
47 : | |||
48 : | vector<RecoElem>& kids = r.getSubElements( ); | ||
49 : | int nKid = kids.size(); | ||
50 : | |||
51 : | s=r.getName(); // copy so we don't mod the orig | ||
52 : | editName( s ); // xdu has bugs. must mod the name a little | ||
53 : | if ( 0 == nKid ) { | ||
54 : | cout << "1 " << path << "/" << s << endl; | ||
55 : | return 1; | ||
56 : | } else { | ||
57 : | for (int i=0; i<nKid; i++ ) { | ||
58 : | result += xduGen( kids[i], path+"/"+s ); | ||
59 : | } | ||
60 : | cout << result << " " << path+"/"+s << endl; | ||
61 : | return result; | ||
62 : | } | ||
63 : | } | ||
64 : | |||
65 : | //************************************************************************ | ||
66 : | void | ||
67 : | editName( std::string& s ) { | ||
68 : | //************************************************************************ | ||
69 : | // xdu chokes on name with spaces in them. Replace them with | ||
70 : | // underscores. hack hack hack | ||
71 : | |||
72 : | int l=s.size(); | ||
73 : | for( int i=0; i<l; i++) { | ||
74 : | if ( s[i] == ' ' ) s[i] = '_'; | ||
75 : | } | ||
76 : | |||
77 : | return; | ||
78 : | } |
MCS Webmaster | ViewVC Help |
Powered by ViewVC 1.0.3 |