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