1 /*************************************************************************
\r
2 * * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
\r
4 * * Author: The ALICE Off-line Project. *
\r
5 * * Contributors are mentioned in the code where appropriate. *
\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
16 ////////////////////////////////////////////////////////////////////////////
\r
18 // The SAX XML file handler used in the TOFnoiseda //
\r
21 // Chiara Zampolli (Chiara.Zampolli@cern.ch) //
\r
23 ////////////////////////////////////////////////////////////////////////////
\r
26 #include <Riostream.h>
\r
29 #include <TObject.h>
\r
30 #include <TXMLAttr.h>
\r
31 #include <TSAXParser.h>
\r
34 #include "AliTOFNoiseConfigHandler.h"
\r
36 ClassImp(AliTOFNoiseConfigHandler)
\r
39 //_____________________________________________________________________________
\r
40 AliTOFNoiseConfigHandler::AliTOFNoiseConfigHandler()
\r
45 // AliTOFNoiseConfigHandler default constructor
\r
49 //_____________________________________________________________________________
\r
50 AliTOFNoiseConfigHandler::AliTOFNoiseConfigHandler(const AliTOFNoiseConfigHandler &sh)
\r
52 fDebugFlag(sh.fDebugFlag)
\r
55 // AliTOFNoiseConfigHandler copy constructor
\r
59 //_____________________________________________________________________________
\r
60 AliTOFNoiseConfigHandler &AliTOFNoiseConfigHandler::operator=(const AliTOFNoiseConfigHandler &sh)
\r
63 // Assignment operator
\r
65 if (&sh == this) return *this;
\r
67 new (this) AliTOFNoiseConfigHandler(sh);
\r
71 //_____________________________________________________________________________
\r
72 AliTOFNoiseConfigHandler::~AliTOFNoiseConfigHandler()
\r
75 // AliTOFNoiseConfigHandler destructor
\r
79 //_____________________________________________________________________________
\r
80 void AliTOFNoiseConfigHandler::OnStartDocument()
\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
87 //_____________________________________________________________________________
\r
88 void AliTOFNoiseConfigHandler::OnEndDocument()
\r
90 // if something should happen at the end of the XML document
\r
91 // this must be done here
\r
94 //_____________________________________________________________________________
\r
95 void AliTOFNoiseConfigHandler::OnStartElement(const char *name, const TList *attributes)
\r
97 // when a new XML element is found, it is processed here
\r
99 // set the current system if necessary
\r
100 TString strName(name);
\r
101 AliDebug(2,Form("name = %s",strName.Data()));
\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
112 else if (debugFlag == "OFF" || debugFlag == "Off"|| debugFlag == "off"){
\r
116 AliWarning("Invalid Debug Flag. Keeping debug off");
\r
121 AliDebug(2,Form("Debug Flag = %i",fDebugFlag));
\r
124 //_____________________________________________________________________________
\r
125 void AliTOFNoiseConfigHandler::OnEndElement(const char *name)
\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
132 //_____________________________________________________________________________
\r
133 void AliTOFNoiseConfigHandler::OnCharacters(const char *characters)
\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
141 //_____________________________________________________________________________
\r
142 void AliTOFNoiseConfigHandler::OnComment(const char* /*text*/)
\r
144 // comments within the XML file are ignored
\r
147 //_____________________________________________________________________________
\r
148 void AliTOFNoiseConfigHandler::OnWarning(const char *text)
\r
150 // process warnings here
\r
151 AliInfo(Form("Warning: %s",text));
\r
154 //_____________________________________________________________________________
\r
155 void AliTOFNoiseConfigHandler::OnError(const char *text)
\r
157 // process errors here
\r
158 AliError(Form("Error: %s",text));
\r
161 //_____________________________________________________________________________
\r
162 void AliTOFNoiseConfigHandler::OnFatalError(const char *text)
\r
164 // process fatal errors here
\r
165 AliFatal(Form("Fatal error: %s",text));
\r
168 //_____________________________________________________________________________
\r
169 void AliTOFNoiseConfigHandler::OnCdataBlock(const char* /*text*/, Int_t /*len*/)
\r
171 // process character data blocks here
\r
172 // not implemented and should not be used here
\r