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 TOFda //
21 // Chiara Zampolli (Chiara.Zampolli@cern.ch) //
23 ////////////////////////////////////////////////////////////////////////////
26 #include <Riostream.h>
31 #include <TSAXParser.h>
34 #include "AliTOFDaConfigHandler.h"
36 ClassImp(AliTOFDaConfigHandler)
39 //_____________________________________________________________________________
40 AliTOFDaConfigHandler::AliTOFDaConfigHandler()
46 // AliTOFDaConfigHandler default constructor
50 //_____________________________________________________________________________
51 AliTOFDaConfigHandler::AliTOFDaConfigHandler(const AliTOFDaConfigHandler &sh)
53 fDebugFlag(sh.fDebugFlag),
57 // AliTOFDaConfigHandler copy constructor
61 //_____________________________________________________________________________
62 AliTOFDaConfigHandler &AliTOFDaConfigHandler::operator=(const AliTOFDaConfigHandler &sh)
65 // Assignment operator
67 if (&sh == this) return *this;
69 new (this) AliTOFDaConfigHandler(sh);
73 //_____________________________________________________________________________
74 AliTOFDaConfigHandler::~AliTOFDaConfigHandler()
77 // AliTOFDaConfigHandler destructor
81 //_____________________________________________________________________________
82 void AliTOFDaConfigHandler::OnStartDocument()
84 // if something should happen right at the beginning of the
85 // XML document, this must happen here
86 AliInfo("Reading XML file for TOF da Config");
89 //_____________________________________________________________________________
90 void AliTOFDaConfigHandler::OnEndDocument()
92 // if something should happen at the end of the XML document
93 // this must be done here
96 //_____________________________________________________________________________
97 void AliTOFDaConfigHandler::OnStartElement(const char *name, const TList *attributes)
99 // when a new XML element is found, it is processed here
101 // set the current system if necessary
102 TString strName(name);
103 AliDebug(2,Form("name = %s",strName.Data()));
105 TIter next(attributes);
106 while ((attr = (TXMLAttr*) next())) {
107 TString attrName = attr->GetName();
108 AliDebug(2,Form("Name = %s",attrName.Data()));
109 if (attrName == "DebugFlag"){
110 fDebugFlag = ((TString)(attr->GetValue())).Atoi();
112 if (attrName == "t0Flag"){
113 TString t0Flag = (TString)(attr->GetValue());
114 if (t0Flag == "ON" || t0Flag == "On" || t0Flag == "on"){
117 else if (t0Flag == "OFF" || t0Flag == "Off"|| t0Flag == "off"){
121 AliWarning("Invalid T0 Flag. Keeping t0 off");
126 AliDebug(2,Form("Debug Flag = %i",fDebugFlag));
127 AliDebug(2,Form("T0 Flag = %i",fT0Flag));
130 //_____________________________________________________________________________
131 void AliTOFDaConfigHandler::OnEndElement(const char *name)
133 // do everything that needs to be done when an end tag of an element is found
134 TString strName(name);
135 AliDebug(2,Form("name = %s",strName.Data()));
138 //_____________________________________________________________________________
139 void AliTOFDaConfigHandler::OnCharacters(const char *characters)
141 // copy the text content of an XML element
142 //fContent = characters;
143 TString strCharacters(characters);
144 AliDebug(2,Form("characters = %s",strCharacters.Data()));
147 //_____________________________________________________________________________
148 void AliTOFDaConfigHandler::OnComment(const char* /*text*/)
150 // comments within the XML file are ignored
153 //_____________________________________________________________________________
154 void AliTOFDaConfigHandler::OnWarning(const char *text)
156 // process warnings here
157 AliInfo(Form("Warning: %s",text));
160 //_____________________________________________________________________________
161 void AliTOFDaConfigHandler::OnError(const char *text)
163 // process errors here
164 AliError(Form("Error: %s",text));
167 //_____________________________________________________________________________
168 void AliTOFDaConfigHandler::OnFatalError(const char *text)
170 // process fatal errors here
171 AliFatal(Form("Fatal error: %s",text));
174 //_____________________________________________________________________________
175 void AliTOFDaConfigHandler::OnCdataBlock(const char* /*text*/, Int_t /*len*/)
177 // process character data blocks here
178 // not implemented and should not be used here