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 TOFda //
\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 "AliTOFDaConfigHandler.h"
\r
36 ClassImp(AliTOFDaConfigHandler)
\r
39 //_____________________________________________________________________________
\r
40 AliTOFDaConfigHandler::AliTOFDaConfigHandler()
\r
46 // AliTOFDaConfigHandler default constructor
\r
50 //_____________________________________________________________________________
\r
51 AliTOFDaConfigHandler::AliTOFDaConfigHandler(const AliTOFDaConfigHandler &sh)
\r
53 fDebugFlag(sh.fDebugFlag),
\r
57 // AliTOFDaConfigHandler copy constructor
\r
61 //_____________________________________________________________________________
\r
62 AliTOFDaConfigHandler &AliTOFDaConfigHandler::operator=(const AliTOFDaConfigHandler &sh)
\r
65 // Assignment operator
\r
67 if (&sh == this) return *this;
\r
69 new (this) AliTOFDaConfigHandler(sh);
\r
73 //_____________________________________________________________________________
\r
74 AliTOFDaConfigHandler::~AliTOFDaConfigHandler()
\r
77 // AliTOFDaConfigHandler destructor
\r
81 //_____________________________________________________________________________
\r
82 void AliTOFDaConfigHandler::OnStartDocument()
\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
89 //_____________________________________________________________________________
\r
90 void AliTOFDaConfigHandler::OnEndDocument()
\r
92 // if something should happen at the end of the XML document
\r
93 // this must be done here
\r
96 //_____________________________________________________________________________
\r
97 void AliTOFDaConfigHandler::OnStartElement(const char *name, const TList *attributes)
\r
99 // when a new XML element is found, it is processed here
\r
101 // set the current system if necessary
\r
102 TString strName(name);
\r
103 AliDebug(2,Form("name = %s",strName.Data()));
\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
112 if (attrName == "t0Flag"){
\r
113 TString t0Flag = (TString)(attr->GetValue());
\r
114 if (t0Flag == "ON" || t0Flag == "On" || t0Flag == "on"){
\r
117 else if (t0Flag == "OFF" || t0Flag == "Off"|| t0Flag == "off"){
\r
121 AliWarning("Invalid T0 Flag. Keeping t0 off");
\r
126 AliDebug(2,Form("Debug Flag = %i",fDebugFlag));
\r
127 AliDebug(2,Form("T0 Flag = %i",fT0Flag));
\r
130 //_____________________________________________________________________________
\r
131 void AliTOFDaConfigHandler::OnEndElement(const char *name)
\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
138 //_____________________________________________________________________________
\r
139 void AliTOFDaConfigHandler::OnCharacters(const char *characters)
\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
147 //_____________________________________________________________________________
\r
148 void AliTOFDaConfigHandler::OnComment(const char* /*text*/)
\r
150 // comments within the XML file are ignored
\r
153 //_____________________________________________________________________________
\r
154 void AliTOFDaConfigHandler::OnWarning(const char *text)
\r
156 // process warnings here
\r
157 AliInfo(Form("Warning: %s",text));
\r
160 //_____________________________________________________________________________
\r
161 void AliTOFDaConfigHandler::OnError(const char *text)
\r
163 // process errors here
\r
164 AliError(Form("Error: %s",text));
\r
167 //_____________________________________________________________________________
\r
168 void AliTOFDaConfigHandler::OnFatalError(const char *text)
\r
170 // process fatal errors here
\r
171 AliFatal(Form("Fatal error: %s",text));
\r
174 //_____________________________________________________________________________
\r
175 void AliTOFDaConfigHandler::OnCdataBlock(const char* /*text*/, Int_t /*len*/)
\r
177 // process character data blocks here
\r
178 // not implemented and should not be used here
\r