]>
Commit | Line | Data |
---|---|---|
fa2852b6 | 1 | /*************************************************************************\r |
2 | * * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *\r | |
3 | * * *\r | |
4 | * * Author: The ALICE Off-line Project. *\r | |
5 | * * Contributors are mentioned in the code where appropriate. *\r | |
6 | * * *\r | |
7 | * * Permission to use, copy, modify and distribute this software and its *\r | |
8 | * * documentation strictly for non-commercial purposes is hereby granted *\r | |
9 | * * without fee, provided that the above copyright notice appears in all *\r | |
10 | * * copies and that both the copyright notice and this permission notice *\r | |
11 | * * appear in the supporting documentation. The authors make no claims *\r | |
12 | * * about the suitability of this software for any purpose. It is *\r | |
13 | * * provided "as is" without express or implied warranty. *\r | |
14 | * **************************************************************************/\r | |
15 | \r | |
16 | ////////////////////////////////////////////////////////////////////////////\r | |
17 | // //\r | |
18 | // The SAX XML file handler used in the TOFnoiseda //\r | |
19 | // //\r | |
20 | // Author: //\r | |
21 | // Chiara Zampolli (Chiara.Zampolli@cern.ch) //\r | |
22 | // //\r | |
23 | ////////////////////////////////////////////////////////////////////////////\r | |
24 | \r | |
25 | #include <cstdlib>\r | |
26 | #include <Riostream.h>\r | |
27 | \r | |
28 | #include <TList.h>\r | |
29 | #include <TObject.h>\r | |
30 | #include <TXMLAttr.h>\r | |
31 | #include <TSAXParser.h>\r | |
32 | \r | |
33 | #include "AliLog.h"\r | |
34 | #include "AliTOFNoiseConfigHandler.h"\r | |
35 | \r | |
36 | ClassImp(AliTOFNoiseConfigHandler)\r | |
37 | \r | |
38 | \r | |
39 | //_____________________________________________________________________________\r | |
40 | AliTOFNoiseConfigHandler::AliTOFNoiseConfigHandler()\r | |
41 | :TObject(),\r | |
013ac2dd | 42 | fDebugFlag(0)\r |
fa2852b6 | 43 | {\r |
44 | //\r | |
45 | // AliTOFNoiseConfigHandler default constructor\r | |
46 | //\r | |
47 | }\r | |
48 | \r | |
49 | //_____________________________________________________________________________\r | |
50 | AliTOFNoiseConfigHandler::AliTOFNoiseConfigHandler(const AliTOFNoiseConfigHandler &sh)\r | |
51 | :TObject(sh),\r | |
013ac2dd | 52 | fDebugFlag(sh.fDebugFlag)\r |
fa2852b6 | 53 | {\r |
54 | //\r | |
55 | // AliTOFNoiseConfigHandler copy constructor\r | |
56 | //\r | |
57 | }\r | |
58 | \r | |
59 | //_____________________________________________________________________________\r | |
60 | AliTOFNoiseConfigHandler &AliTOFNoiseConfigHandler::operator=(const AliTOFNoiseConfigHandler &sh)\r | |
61 | {\r | |
62 | //\r | |
63 | // Assignment operator\r | |
64 | //\r | |
65 | if (&sh == this) return *this;\r | |
66 | \r | |
67 | new (this) AliTOFNoiseConfigHandler(sh);\r | |
68 | return *this;\r | |
69 | }\r | |
70 | \r | |
71 | //_____________________________________________________________________________\r | |
72 | AliTOFNoiseConfigHandler::~AliTOFNoiseConfigHandler()\r | |
73 | {\r | |
74 | //\r | |
75 | // AliTOFNoiseConfigHandler destructor\r | |
76 | // \r | |
77 | }\r | |
78 | \r | |
79 | //_____________________________________________________________________________\r | |
80 | void AliTOFNoiseConfigHandler::OnStartDocument()\r | |
81 | {\r | |
82 | // if something should happen right at the beginning of the\r | |
83 | // XML document, this must happen here\r | |
84 | AliInfo("Reading XML file for TOFnoiseda Config");\r | |
85 | }\r | |
86 | \r | |
87 | //_____________________________________________________________________________\r | |
88 | void AliTOFNoiseConfigHandler::OnEndDocument()\r | |
89 | {\r | |
90 | // if something should happen at the end of the XML document\r | |
91 | // this must be done here\r | |
92 | }\r | |
93 | \r | |
94 | //_____________________________________________________________________________\r | |
95 | void AliTOFNoiseConfigHandler::OnStartElement(const char *name, const TList *attributes)\r | |
96 | {\r | |
97 | // when a new XML element is found, it is processed here\r | |
98 | \r | |
99 | // set the current system if necessary\r | |
100 | TString strName(name);\r | |
101 | AliDebug(2,Form("name = %s",strName.Data()));\r | |
102 | TXMLAttr* attr;\r | |
103 | TIter next(attributes);\r | |
104 | while ((attr = (TXMLAttr*) next())) {\r | |
105 | TString attrName = attr->GetName();\r | |
106 | AliDebug(2,Form("Name = %s",attrName.Data())); \r | |
107 | if (attrName == "DebugFlag"){\r | |
108 | TString debugFlag = (TString)(attr->GetValue());\r | |
109 | if (debugFlag == "ON" || debugFlag == "On" || debugFlag == "on"){ \r | |
110 | fDebugFlag = 1;\r | |
111 | }\r | |
112 | else if (debugFlag == "OFF" || debugFlag == "Off"|| debugFlag == "off"){\r | |
113 | fDebugFlag = 0;\r | |
114 | }\r | |
115 | else {\r | |
116 | AliWarning("Invalid Debug Flag. Keeping debug off");\r | |
117 | fDebugFlag = 0;\r | |
118 | }\r | |
119 | }\r | |
fa2852b6 | 120 | } \r |
121 | AliDebug(2,Form("Debug Flag = %i",fDebugFlag)); \r | |
fa2852b6 | 122 | return;\r |
123 | }\r | |
124 | //_____________________________________________________________________________\r | |
125 | void AliTOFNoiseConfigHandler::OnEndElement(const char *name)\r | |
126 | {\r | |
127 | // do everything that needs to be done when an end tag of an element is found\r | |
128 | TString strName(name);\r | |
129 | AliDebug(2,Form("name = %s",strName.Data()));\r | |
130 | }\r | |
131 | \r | |
132 | //_____________________________________________________________________________\r | |
133 | void AliTOFNoiseConfigHandler::OnCharacters(const char *characters)\r | |
134 | {\r | |
135 | // copy the text content of an XML element\r | |
136 | //fContent = characters;\r | |
137 | TString strCharacters(characters);\r | |
138 | AliDebug(2,Form("characters = %s",strCharacters.Data()));\r | |
139 | }\r | |
140 | \r | |
141 | //_____________________________________________________________________________\r | |
142 | void AliTOFNoiseConfigHandler::OnComment(const char* /*text*/)\r | |
143 | {\r | |
144 | // comments within the XML file are ignored\r | |
145 | }\r | |
146 | \r | |
147 | //_____________________________________________________________________________\r | |
148 | void AliTOFNoiseConfigHandler::OnWarning(const char *text)\r | |
149 | {\r | |
150 | // process warnings here\r | |
151 | AliInfo(Form("Warning: %s",text));\r | |
152 | }\r | |
153 | \r | |
154 | //_____________________________________________________________________________\r | |
155 | void AliTOFNoiseConfigHandler::OnError(const char *text)\r | |
156 | {\r | |
157 | // process errors here\r | |
158 | AliError(Form("Error: %s",text));\r | |
159 | }\r | |
160 | \r | |
161 | //_____________________________________________________________________________\r | |
162 | void AliTOFNoiseConfigHandler::OnFatalError(const char *text)\r | |
163 | {\r | |
164 | // process fatal errors here\r | |
165 | AliFatal(Form("Fatal error: %s",text));\r | |
166 | }\r | |
167 | \r | |
168 | //_____________________________________________________________________________\r | |
169 | void AliTOFNoiseConfigHandler::OnCdataBlock(const char* /*text*/, Int_t /*len*/)\r | |
170 | {\r | |
171 | // process character data blocks here\r | |
172 | // not implemented and should not be used here\r | |
173 | }\r | |
174 | \r |