/[PAMELA software]/gp2root/pPdetMgr.cpp
ViewVC logotype

Contents of /gp2root/pPdetMgr.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Apr 19 23:35:58 2006 UTC (18 years, 7 months ago) by pamela
Branch: MAIN
Branch point for: v1r0
Initial revision

1 #include <string>
2 #include <iostream>
3 #include "pUtils.h"
4 #include "pPdetMgr.h"
5 #include "pCal.h"
6 #include "pTof.h"
7 #include "pCas.h"
8 #include "pCat.h"
9
10 // Just a counter 012345678901234567890123456789012345678901234567890123456789
11 #define DETECTOR_NAMES "cat cal cali tof cas card s4 nd trd spe "
12 #define CATPOS 0
13 #define CALPOS 5
14 #define CALIPOS 10
15 #define TOFPOS 15
16 #define CASPOS 20
17 #define CARDPOS 25
18 #define S4POS 30
19 #define NDPOS 35
20 #define TRDPOS 40
21 #define SPEPOS 45
22
23 using std::string;
24 using std::cout;
25 using std::endl;
26 using pUtils::ToLower;
27
28 pPdetMgr * pPdetMgr::_pdetmgr = 0;
29
30 pPdetMgr * pPdetMgr::Get(){
31 if(_pdetmgr==0) {
32 _pdetmgr = new pPdetMgr();
33 }
34 return _pdetmgr;
35 }
36
37 pDetector* pPdetMgr::GetpDet(const string &s)
38 {
39 string temp=DETECTOR_NAMES;
40 string::size_type spos=temp.find(ToLower(s));
41
42 switch(spos){
43 case CATPOS:
44 return new pCat();
45 case CALPOS:
46 return new pCal();
47 case CALIPOS:
48 return 0;
49 case TOFPOS:
50 return new pTof();
51 case CASPOS:
52 return new pCas();
53 case CARDPOS:
54 return 0;
55 case S4POS:
56 return 0;
57 case NDPOS:
58 return 0;
59 case TRDPOS:
60 return 0;
61 case SPEPOS:
62 return 0;
63 case string::npos:
64 cout << " pPdetMgr : Detector = " << s << " not found ";
65 return 0;
66
67 }
68 }

  ViewVC Help
Powered by ViewVC 1.1.23