Updates
[u/mrichter/AliRoot.git] / TOF / AliTOFDaConfigHandler.cxx
CommitLineData
104ba366 1/*************************************************************************
2 * * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
3 * * *
4 * * Author: The ALICE Off-line Project. *
5 * * Contributors are mentioned in the code where appropriate. *
6 * * *
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 * **************************************************************************/
15
16////////////////////////////////////////////////////////////////////////////
17// //
18// The SAX XML file handler used in the TOFda //
19// //
20// Author: //
21// Chiara Zampolli (Chiara.Zampolli@cern.ch) //
22// Roberto Preghenella (R+) (preghenella@bo.infn.it) //
23// //
24////////////////////////////////////////////////////////////////////////////
25
26#include <cstdlib>
27#include <Riostream.h>
28
29#include <TList.h>
30#include <TObject.h>
31#include <TXMLAttr.h>
32#include <TSAXParser.h>
33
34#include "AliLog.h"
35#include "AliTOFDaConfigHandler.h"
36
37ClassImp(AliTOFDaConfigHandler)
38
39
40//_____________________________________________________________________________
41AliTOFDaConfigHandler::AliTOFDaConfigHandler()
42:TObject(),
43 fMeanMultiplicity(0),
44 fMaxHits(0)
45{
46 //
47 // AliTOFDaConfigHandler default constructor
48 //
49}
50
51//_____________________________________________________________________________
52AliTOFDaConfigHandler::AliTOFDaConfigHandler(const AliTOFDaConfigHandler &sh)
53 :TObject(sh),
54 fMeanMultiplicity(sh.fMeanMultiplicity),
55 fMaxHits(sh.fMaxHits)
56{
57 //
58 // AliTOFDaConfigHandler copy constructor
59 //
60}
61
62//_____________________________________________________________________________
63AliTOFDaConfigHandler &AliTOFDaConfigHandler::operator=(const AliTOFDaConfigHandler &sh)
64{
65 //
66 // Assignment operator
67 //
68 if (&sh == this) return *this;
69
70 new (this) AliTOFDaConfigHandler(sh);
71 return *this;
72}
73
74//_____________________________________________________________________________
75AliTOFDaConfigHandler::~AliTOFDaConfigHandler()
76{
77 //
78 // AliTOFDaConfigHandler destructor
79 //
80}
81
82//_____________________________________________________________________________
83void AliTOFDaConfigHandler::OnStartDocument()
84{
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");
88}
89
90//_____________________________________________________________________________
91void AliTOFDaConfigHandler::OnEndDocument()
92{
93 // if something should happen at the end of the XML document
94 // this must be done here
95}
96
97//_____________________________________________________________________________
98void AliTOFDaConfigHandler::OnStartElement(const char *name, const TList *attributes)
99{
100 // when a new XML element is found, it is processed here
101
102 // set the current system if necessary
103 TString strName(name);
104 AliDebug(2,Form("name = %s",strName.Data()));
105 TXMLAttr* attr;
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();
112 }
113 if (attrName == "MaxHits"){
114 fMaxHits = ((TString)(attr->GetValue())).Atoi();
115 }
116 }
117 AliDebug(2,Form("MeanMultiplicity = %d",fMeanMultiplicity));
118 AliDebug(2,Form("MaxHits = %d",fMaxHits));
119 return;
120}
121//_____________________________________________________________________________
122void AliTOFDaConfigHandler::OnEndElement(const char *name)
123{
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()));
127}
128
129//_____________________________________________________________________________
130void AliTOFDaConfigHandler::OnCharacters(const char *characters)
131{
132 // copy the text content of an XML element
133 //fContent = characters;
134 TString strCharacters(characters);
135 AliDebug(2,Form("characters = %s",strCharacters.Data()));
136}
137
138//_____________________________________________________________________________
139void AliTOFDaConfigHandler::OnComment(const char* /*text*/)
140{
141 // comments within the XML file are ignored
142}
143
144//_____________________________________________________________________________
145void AliTOFDaConfigHandler::OnWarning(const char *text)
146{
147 // process warnings here
148 AliInfo(Form("Warning: %s",text));
149}
150
151//_____________________________________________________________________________
152void AliTOFDaConfigHandler::OnError(const char *text)
153{
154 // process errors here
155 AliError(Form("Error: %s",text));
156}
157
158//_____________________________________________________________________________
159void AliTOFDaConfigHandler::OnFatalError(const char *text)
160{
161 // process fatal errors here
162 AliFatal(Form("Fatal error: %s",text));
163}
164
165//_____________________________________________________________________________
166void AliTOFDaConfigHandler::OnCdataBlock(const char* /*text*/, Int_t /*len*/)
167{
168 // process character data blocks here
169 // not implemented and should not be used here
170}
171