warning fix
[u/mrichter/AliRoot.git] / TOF / AliTOFDaConfigHandler.old.cxx
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 TOFda                            //\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 "AliTOFDaConfigHandler.h"\r
35 \r
36 ClassImp(AliTOFDaConfigHandler)\r
37 \r
38   \r
39 //_____________________________________________________________________________\r
40 AliTOFDaConfigHandler::AliTOFDaConfigHandler()\r
41         :TObject(),\r
42          fDebugFlag(0),\r
43          fT0Flag(0)\r
44 {\r
45         //\r
46         // AliTOFDaConfigHandler default constructor\r
47         //\r
48 }\r
49 \r
50 //_____________________________________________________________________________\r
51 AliTOFDaConfigHandler::AliTOFDaConfigHandler(const AliTOFDaConfigHandler &sh)\r
52         :TObject(sh),\r
53          fDebugFlag(sh.fDebugFlag),\r
54          fT0Flag(sh.fT0Flag)\r
55 {\r
56         //\r
57         // AliTOFDaConfigHandler copy constructor\r
58         //\r
59 }\r
60 \r
61 //_____________________________________________________________________________\r
62 AliTOFDaConfigHandler &AliTOFDaConfigHandler::operator=(const AliTOFDaConfigHandler &sh)\r
63 {\r
64         //\r
65         // Assignment operator\r
66         //\r
67         if (&sh == this) return *this;\r
68         \r
69         new (this) AliTOFDaConfigHandler(sh);\r
70         return *this;\r
71 }\r
72 \r
73 //_____________________________________________________________________________\r
74 AliTOFDaConfigHandler::~AliTOFDaConfigHandler()\r
75 {\r
76         //\r
77         // AliTOFDaConfigHandler destructor\r
78         //      \r
79 }\r
80 \r
81 //_____________________________________________________________________________\r
82 void AliTOFDaConfigHandler::OnStartDocument()\r
83 {\r
84         // if something should happen right at the beginning of the\r
85         // XML document, this must happen here\r
86         AliInfo("Reading XML file for TOF da Config");\r
87 }\r
88 \r
89 //_____________________________________________________________________________\r
90 void AliTOFDaConfigHandler::OnEndDocument()\r
91 {\r
92         // if something should happen at the end of the XML document\r
93         // this must be done here\r
94 }\r
95 \r
96 //_____________________________________________________________________________\r
97 void AliTOFDaConfigHandler::OnStartElement(const char *name, const TList *attributes)\r
98 {\r
99         // when a new XML element is found, it is processed here\r
100 \r
101         // set the current system if necessary\r
102         TString strName(name);\r
103         AliDebug(2,Form("name = %s",strName.Data()));\r
104         TXMLAttr* attr;\r
105         TIter next(attributes);\r
106         while ((attr = (TXMLAttr*) next())) {\r
107                 TString attrName = attr->GetName();\r
108                 AliDebug(2,Form("Name = %s",attrName.Data())); \r
109                 if (attrName == "DebugFlag"){\r
110                         fDebugFlag = ((TString)(attr->GetValue())).Atoi();\r
111                 }\r
112                 if (attrName == "t0Flag"){\r
113                         TString t0Flag = (TString)(attr->GetValue());\r
114                         if (t0Flag == "ON" || t0Flag == "On" || t0Flag == "on"){        \r
115                                 fT0Flag = 1;\r
116                         }\r
117                         else if (t0Flag == "OFF" || t0Flag == "Off"|| t0Flag == "off"){\r
118                                 fT0Flag = 0;\r
119                         }\r
120                         else {\r
121                                 AliWarning("Invalid T0 Flag. Keeping t0 off");\r
122                                 fT0Flag = 0;\r
123                         }\r
124                 }\r
125         }       \r
126         AliDebug(2,Form("Debug Flag = %i",fDebugFlag)); \r
127         AliDebug(2,Form("T0 Flag = %i",fT0Flag)); \r
128         return;\r
129 }\r
130 //_____________________________________________________________________________\r
131 void AliTOFDaConfigHandler::OnEndElement(const char *name)\r
132 {\r
133         // do everything that needs to be done when an end tag of an element is found\r
134         TString strName(name);\r
135         AliDebug(2,Form("name = %s",strName.Data()));\r
136 }\r
137 \r
138 //_____________________________________________________________________________\r
139 void AliTOFDaConfigHandler::OnCharacters(const char *characters)\r
140 {\r
141         // copy the text content of an XML element\r
142         //fContent = characters;\r
143         TString strCharacters(characters);\r
144         AliDebug(2,Form("characters = %s",strCharacters.Data()));\r
145 }\r
146 \r
147 //_____________________________________________________________________________\r
148 void AliTOFDaConfigHandler::OnComment(const char* /*text*/)\r
149 {\r
150         // comments within the XML file are ignored\r
151 }\r
152 \r
153 //_____________________________________________________________________________\r
154 void AliTOFDaConfigHandler::OnWarning(const char *text)\r
155 {\r
156         // process warnings here\r
157         AliInfo(Form("Warning: %s",text));\r
158 }\r
159 \r
160 //_____________________________________________________________________________\r
161 void AliTOFDaConfigHandler::OnError(const char *text)\r
162 {\r
163         // process errors here\r
164         AliError(Form("Error: %s",text));\r
165 }\r
166 \r
167 //_____________________________________________________________________________\r
168 void AliTOFDaConfigHandler::OnFatalError(const char *text)\r
169 {\r
170         // process fatal errors here\r
171         AliFatal(Form("Fatal error: %s",text));\r
172 }\r
173 \r
174 //_____________________________________________________________________________\r
175 void AliTOFDaConfigHandler::OnCdataBlock(const char* /*text*/, Int_t /*len*/)\r
176 {\r
177         // process character data blocks here\r
178         // not implemented and should not be used here\r
179 }\r
180 \r