Line data Source code
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 :
37 26 : ClassImp(AliTOFDaConfigHandler)
38 :
39 :
40 : //_____________________________________________________________________________
41 : AliTOFDaConfigHandler::AliTOFDaConfigHandler()
42 0 : :TObject(),
43 0 : fMeanMultiplicity(0),
44 0 : fMaxHits(0)
45 0 : {
46 : //
47 : // AliTOFDaConfigHandler default constructor
48 : //
49 0 : }
50 :
51 : //_____________________________________________________________________________
52 : AliTOFDaConfigHandler::AliTOFDaConfigHandler(const AliTOFDaConfigHandler &sh)
53 0 : :TObject(sh),
54 0 : fMeanMultiplicity(sh.fMeanMultiplicity),
55 0 : fMaxHits(sh.fMaxHits)
56 0 : {
57 : //
58 : // AliTOFDaConfigHandler copy constructor
59 : //
60 0 : }
61 :
62 : //_____________________________________________________________________________
63 : AliTOFDaConfigHandler &AliTOFDaConfigHandler::operator=(const AliTOFDaConfigHandler &sh)
64 : {
65 : //
66 : // Assignment operator
67 : //
68 0 : if (&sh == this) return *this;
69 :
70 0 : new (this) AliTOFDaConfigHandler(sh);
71 0 : return *this;
72 0 : }
73 :
74 : //_____________________________________________________________________________
75 : AliTOFDaConfigHandler::~AliTOFDaConfigHandler()
76 0 : {
77 : //
78 : // AliTOFDaConfigHandler destructor
79 : //
80 0 : }
81 :
82 : //_____________________________________________________________________________
83 : void AliTOFDaConfigHandler::OnStartDocument()
84 : {
85 : // if something should happen right at the beginning of the
86 : // XML document, this must happen here
87 0 : AliInfo("Reading XML file for TOF da Config");
88 0 : }
89 :
90 : //_____________________________________________________________________________
91 : void AliTOFDaConfigHandler::OnEndDocument()
92 : {
93 : // if something should happen at the end of the XML document
94 : // this must be done here
95 0 : }
96 :
97 : //_____________________________________________________________________________
98 : void 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 0 : TString strName(name);
104 0 : AliDebug(2,Form("name = %s",strName.Data()));
105 : TXMLAttr* attr;
106 0 : TIter next(attributes);
107 0 : while ((attr = (TXMLAttr*) next())) {
108 0 : TString attrName = attr->GetName();
109 0 : AliDebug(2,Form("Name = %s",attrName.Data()));
110 0 : if (attrName == "MeanMultiplicity"){
111 0 : fMeanMultiplicity = ((TString)(attr->GetValue())).Atoi();
112 0 : }
113 0 : if (attrName == "MaxHits"){
114 0 : fMaxHits = ((TString)(attr->GetValue())).Atoi();
115 0 : }
116 0 : }
117 0 : AliDebug(2,Form("MeanMultiplicity = %d",fMeanMultiplicity));
118 0 : AliDebug(2,Form("MaxHits = %d",fMaxHits));
119 : return;
120 0 : }
121 : //_____________________________________________________________________________
122 : void AliTOFDaConfigHandler::OnEndElement(const char *name)
123 : {
124 : // do everything that needs to be done when an end tag of an element is found
125 0 : TString strName(name);
126 0 : AliDebug(2,Form("name = %s",strName.Data()));
127 0 : }
128 :
129 : //_____________________________________________________________________________
130 : void AliTOFDaConfigHandler::OnCharacters(const char *characters)
131 : {
132 : // copy the text content of an XML element
133 : //fContent = characters;
134 0 : TString strCharacters(characters);
135 0 : AliDebug(2,Form("characters = %s",strCharacters.Data()));
136 0 : }
137 :
138 : //_____________________________________________________________________________
139 : void AliTOFDaConfigHandler::OnComment(const char* /*text*/)
140 : {
141 : // comments within the XML file are ignored
142 0 : }
143 :
144 : //_____________________________________________________________________________
145 : void AliTOFDaConfigHandler::OnWarning(const char *text)
146 : {
147 : // process warnings here
148 0 : AliInfo(Form("Warning: %s",text));
149 0 : }
150 :
151 : //_____________________________________________________________________________
152 : void AliTOFDaConfigHandler::OnError(const char *text)
153 : {
154 : // process errors here
155 0 : AliError(Form("Error: %s",text));
156 0 : }
157 :
158 : //_____________________________________________________________________________
159 : void AliTOFDaConfigHandler::OnFatalError(const char *text)
160 : {
161 : // process fatal errors here
162 0 : AliFatal(Form("Fatal error: %s",text));
163 0 : }
164 :
165 : //_____________________________________________________________________________
166 : void 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 0 : }
171 :
|