end-of-line normalization
[u/mrichter/AliRoot.git] / TOF / AliTOFNoiseConfigHandler.cxx
CommitLineData
a65a7e70 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 TOFnoiseda //
19// //
20// Author: //
21// Chiara Zampolli (Chiara.Zampolli@cern.ch) //
22// //
23////////////////////////////////////////////////////////////////////////////
24
25#include <cstdlib>
26#include <Riostream.h>
27
28#include <TList.h>
29#include <TObject.h>
30#include <TXMLAttr.h>
31#include <TSAXParser.h>
32
33#include "AliLog.h"
34#include "AliTOFNoiseConfigHandler.h"
35
36ClassImp(AliTOFNoiseConfigHandler)
37
38
39//_____________________________________________________________________________
40AliTOFNoiseConfigHandler::AliTOFNoiseConfigHandler()
41 :TObject(),
42 fDebugFlag(0)
43{
44 //
45 // AliTOFNoiseConfigHandler default constructor
46 //
47}
48
49//_____________________________________________________________________________
50AliTOFNoiseConfigHandler::AliTOFNoiseConfigHandler(const AliTOFNoiseConfigHandler &sh)
51 :TObject(sh),
52 fDebugFlag(sh.fDebugFlag)
53{
54 //
55 // AliTOFNoiseConfigHandler copy constructor
56 //
57}
58
59//_____________________________________________________________________________
60AliTOFNoiseConfigHandler &AliTOFNoiseConfigHandler::operator=(const AliTOFNoiseConfigHandler &sh)
61{
62 //
63 // Assignment operator
64 //
65 if (&sh == this) return *this;
66
67 new (this) AliTOFNoiseConfigHandler(sh);
68 return *this;
69}
70
71//_____________________________________________________________________________
72AliTOFNoiseConfigHandler::~AliTOFNoiseConfigHandler()
73{
74 //
75 // AliTOFNoiseConfigHandler destructor
76 //
77}
78
79//_____________________________________________________________________________
80void AliTOFNoiseConfigHandler::OnStartDocument()
81{
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");
85}
86
87//_____________________________________________________________________________
88void AliTOFNoiseConfigHandler::OnEndDocument()
89{
90 // if something should happen at the end of the XML document
91 // this must be done here
92}
93
94//_____________________________________________________________________________
95void AliTOFNoiseConfigHandler::OnStartElement(const char *name, const TList *attributes)
96{
97 // when a new XML element is found, it is processed here
98
99 // set the current system if necessary
100 TString strName(name);
101 AliDebug(2,Form("name = %s",strName.Data()));
102 TXMLAttr* attr;
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"){
110 fDebugFlag = 1;
111 }
112 else if (debugFlag == "OFF" || debugFlag == "Off"|| debugFlag == "off"){
113 fDebugFlag = 0;
114 }
115 else {
116 AliWarning("Invalid Debug Flag. Keeping debug off");
117 fDebugFlag = 0;
118 }
119 }
120 }
121 AliDebug(2,Form("Debug Flag = %i",fDebugFlag));
122 return;
123}
124//_____________________________________________________________________________
125void AliTOFNoiseConfigHandler::OnEndElement(const char *name)
126{
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()));
130}
131
132//_____________________________________________________________________________
133void AliTOFNoiseConfigHandler::OnCharacters(const char *characters)
134{
135 // copy the text content of an XML element
136 //fContent = characters;
137 TString strCharacters(characters);
138 AliDebug(2,Form("characters = %s",strCharacters.Data()));
139}
140
141//_____________________________________________________________________________
142void AliTOFNoiseConfigHandler::OnComment(const char* /*text*/)
143{
144 // comments within the XML file are ignored
145}
146
147//_____________________________________________________________________________
148void AliTOFNoiseConfigHandler::OnWarning(const char *text)
149{
150 // process warnings here
151 AliInfo(Form("Warning: %s",text));
152}
153
154//_____________________________________________________________________________
155void AliTOFNoiseConfigHandler::OnError(const char *text)
156{
157 // process errors here
158 AliError(Form("Error: %s",text));
159}
160
161//_____________________________________________________________________________
162void AliTOFNoiseConfigHandler::OnFatalError(const char *text)
163{
164 // process fatal errors here
165 AliFatal(Form("Fatal error: %s",text));
166}
167
168//_____________________________________________________________________________
169void AliTOFNoiseConfigHandler::OnCdataBlock(const char* /*text*/, Int_t /*len*/)
170{
171 // process character data blocks here
172 // not implemented and should not be used here
173}
174