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) //
22 // Roberto Preghenella (R+) (preghenella@bo.infn.it) //
24 ////////////////////////////////////////////////////////////////////////////
27 #include <Riostream.h>
32 #include <TSAXParser.h>
35 #include "AliTOFDaConfigHandler.h"
37 ClassImp(AliTOFDaConfigHandler)
40 //_____________________________________________________________________________
41 AliTOFDaConfigHandler::AliTOFDaConfigHandler()
47 // AliTOFDaConfigHandler default constructor
51 //_____________________________________________________________________________
52 AliTOFDaConfigHandler::AliTOFDaConfigHandler(const AliTOFDaConfigHandler &sh)
54 fMeanMultiplicity(sh.fMeanMultiplicity),
58 // AliTOFDaConfigHandler copy constructor
62 //_____________________________________________________________________________
63 AliTOFDaConfigHandler &AliTOFDaConfigHandler::operator=(const AliTOFDaConfigHandler &sh)
66 // Assignment operator
68 if (&sh == this) return *this;
70 new (this) AliTOFDaConfigHandler(sh);
74 //_____________________________________________________________________________
75 AliTOFDaConfigHandler::~AliTOFDaConfigHandler()
78 // AliTOFDaConfigHandler destructor
82 //_____________________________________________________________________________
83 void AliTOFDaConfigHandler::OnStartDocument()
85 // if something should happen right at the beginning of the
86 // XML document, this must happen here
87 AliInfo("Reading XML file for TOF da Config");
90 //_____________________________________________________________________________
91 void AliTOFDaConfigHandler::OnEndDocument()
93 // if something should happen at the end of the XML document
94 // this must be done here
97 //_____________________________________________________________________________
98 void AliTOFDaConfigHandler::OnStartElement(const char *name, const TList *attributes)
100 // when a new XML element is found, it is processed here
102 // set the current system if necessary
103 TString strName(name);
104 AliDebug(2,Form("name = %s",strName.Data()));
106 TIter next(attributes);
107 while ((attr = (TXMLAttr*) next())) {
108 TString attrName = attr->GetName();
109 AliDebug(2,Form("Name = %s",attrName.Data()));
110 if (attrName == "MeanMultiplicity"){
111 fMeanMultiplicity = ((TString)(attr->GetValue())).Atoi();
113 if (attrName == "MaxHits"){
114 fMaxHits = ((TString)(attr->GetValue())).Atoi();
117 AliDebug(2,Form("MeanMultiplicity = %d",fMeanMultiplicity));
118 AliDebug(2,Form("MaxHits = %d",fMaxHits));
121 //_____________________________________________________________________________
122 void AliTOFDaConfigHandler::OnEndElement(const char *name)
124 // do everything that needs to be done when an end tag of an element is found
125 TString strName(name);
126 AliDebug(2,Form("name = %s",strName.Data()));
129 //_____________________________________________________________________________
130 void AliTOFDaConfigHandler::OnCharacters(const char *characters)
132 // copy the text content of an XML element
133 //fContent = characters;
134 TString strCharacters(characters);
135 AliDebug(2,Form("characters = %s",strCharacters.Data()));
138 //_____________________________________________________________________________
139 void AliTOFDaConfigHandler::OnComment(const char* /*text*/)
141 // comments within the XML file are ignored
144 //_____________________________________________________________________________
145 void AliTOFDaConfigHandler::OnWarning(const char *text)
147 // process warnings here
148 AliInfo(Form("Warning: %s",text));
151 //_____________________________________________________________________________
152 void AliTOFDaConfigHandler::OnError(const char *text)
154 // process errors here
155 AliError(Form("Error: %s",text));
158 //_____________________________________________________________________________
159 void AliTOFDaConfigHandler::OnFatalError(const char *text)
161 // process fatal errors here
162 AliFatal(Form("Fatal error: %s",text));
165 //_____________________________________________________________________________
166 void AliTOFDaConfigHandler::OnCdataBlock(const char* /*text*/, Int_t /*len*/)
168 // process character data blocks here
169 // not implemented and should not be used here