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