CMake: removing qpythia from the depedencies
[u/mrichter/AliRoot.git] / TOF / AliTOFDaConfigHandler.old.cxx
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 //                                                                        //
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 "AliTOFDaConfigHandler.h"
35
36 ClassImp(AliTOFDaConfigHandler)
37
38   
39 //_____________________________________________________________________________
40 AliTOFDaConfigHandler::AliTOFDaConfigHandler()
41         :TObject(),
42          fDebugFlag(0),
43          fT0Flag(0)
44 {
45         //
46         // AliTOFDaConfigHandler default constructor
47         //
48 }
49
50 //_____________________________________________________________________________
51 AliTOFDaConfigHandler::AliTOFDaConfigHandler(const AliTOFDaConfigHandler &sh)
52         :TObject(sh),
53          fDebugFlag(sh.fDebugFlag),
54          fT0Flag(sh.fT0Flag)
55 {
56         //
57         // AliTOFDaConfigHandler copy constructor
58         //
59 }
60
61 //_____________________________________________________________________________
62 AliTOFDaConfigHandler &AliTOFDaConfigHandler::operator=(const AliTOFDaConfigHandler &sh)
63 {
64         //
65         // Assignment operator
66         //
67         if (&sh == this) return *this;
68         
69         new (this) AliTOFDaConfigHandler(sh);
70         return *this;
71 }
72
73 //_____________________________________________________________________________
74 AliTOFDaConfigHandler::~AliTOFDaConfigHandler()
75 {
76         //
77         // AliTOFDaConfigHandler destructor
78         //      
79 }
80
81 //_____________________________________________________________________________
82 void AliTOFDaConfigHandler::OnStartDocument()
83 {
84         // if something should happen right at the beginning of the
85         // XML document, this must happen here
86         AliInfo("Reading XML file for TOF da Config");
87 }
88
89 //_____________________________________________________________________________
90 void AliTOFDaConfigHandler::OnEndDocument()
91 {
92         // if something should happen at the end of the XML document
93         // this must be done here
94 }
95
96 //_____________________________________________________________________________
97 void AliTOFDaConfigHandler::OnStartElement(const char *name, const TList *attributes)
98 {
99         // when a new XML element is found, it is processed here
100
101         // set the current system if necessary
102         TString strName(name);
103         AliDebug(2,Form("name = %s",strName.Data()));
104         TXMLAttr* attr;
105         TIter next(attributes);
106         while ((attr = (TXMLAttr*) next())) {
107                 TString attrName = attr->GetName();
108                 AliDebug(2,Form("Name = %s",attrName.Data())); 
109                 if (attrName == "DebugFlag"){
110                         fDebugFlag = ((TString)(attr->GetValue())).Atoi();
111                 }
112                 if (attrName == "t0Flag"){
113                         TString t0Flag = (TString)(attr->GetValue());
114                         if (t0Flag == "ON" || t0Flag == "On" || t0Flag == "on"){        
115                                 fT0Flag = 1;
116                         }
117                         else if (t0Flag == "OFF" || t0Flag == "Off"|| t0Flag == "off"){
118                                 fT0Flag = 0;
119                         }
120                         else {
121                                 AliWarning("Invalid T0 Flag. Keeping t0 off");
122                                 fT0Flag = 0;
123                         }
124                 }
125         }       
126         AliDebug(2,Form("Debug Flag = %i",fDebugFlag)); 
127         AliDebug(2,Form("T0 Flag = %i",fT0Flag)); 
128         return;
129 }
130 //_____________________________________________________________________________
131 void AliTOFDaConfigHandler::OnEndElement(const char *name)
132 {
133         // do everything that needs to be done when an end tag of an element is found
134         TString strName(name);
135         AliDebug(2,Form("name = %s",strName.Data()));
136 }
137
138 //_____________________________________________________________________________
139 void AliTOFDaConfigHandler::OnCharacters(const char *characters)
140 {
141         // copy the text content of an XML element
142         //fContent = characters;
143         TString strCharacters(characters);
144         AliDebug(2,Form("characters = %s",strCharacters.Data()));
145 }
146
147 //_____________________________________________________________________________
148 void AliTOFDaConfigHandler::OnComment(const char* /*text*/)
149 {
150         // comments within the XML file are ignored
151 }
152
153 //_____________________________________________________________________________
154 void AliTOFDaConfigHandler::OnWarning(const char *text)
155 {
156         // process warnings here
157         AliInfo(Form("Warning: %s",text));
158 }
159
160 //_____________________________________________________________________________
161 void AliTOFDaConfigHandler::OnError(const char *text)
162 {
163         // process errors here
164         AliError(Form("Error: %s",text));
165 }
166
167 //_____________________________________________________________________________
168 void AliTOFDaConfigHandler::OnFatalError(const char *text)
169 {
170         // process fatal errors here
171         AliFatal(Form("Fatal error: %s",text));
172 }
173
174 //_____________________________________________________________________________
175 void AliTOFDaConfigHandler::OnCdataBlock(const char* /*text*/, Int_t /*len*/)
176 {
177         // process character data blocks here
178         // not implemented and should not be used here
179 }
180