]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCDBHandler.cxx
Removed writing of jets_local.root
[u/mrichter/AliRoot.git] / STEER / AliCDBHandler.cxx
1 /*************************************************************************\r
2  * * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *\r
3  * *                                                                        *\r
4  * * Author: The ALICE Off-line Project.                                    *\r
5  * * Contributors are mentioned in the code where appropriate.              *\r
6  * *                                                                        *\r
7  * * Permission to use, copy, modify and distribute this software and its   *\r
8  * * documentation strictly for non-commercial purposes is hereby granted   *\r
9  * * without fee, provided that the above copyright notice appears in all   *\r
10  * * copies and that both the copyright notice and this permission notice   *\r
11  * * appear in the supporting documentation. The authors make no claims     *\r
12  * * about the suitability of this software for any purpose. It is          *\r
13  * * provided "as is" without express or implied warranty.                  *\r
14  * **************************************************************************/\r
15 \r
16 ////////////////////////////////////////////////////////////////////////////\r
17 //                                                                        //\r
18 //  The SAX XML file handler used in the CDBManager                       //\r
19 //                                                                        //\r
20 //  Author:                                                               //\r
21 //    Chiara Zampolli (Chiara.Zampolli@cern.ch)                           //\r
22 //                                                                        //\r
23 ////////////////////////////////////////////////////////////////////////////\r
24 \r
25 #include <cstdlib>\r
26 #include <Riostream.h>\r
27 \r
28 #include <TList.h>\r
29 #include <TObject.h>\r
30 #include <TXMLAttr.h>\r
31 #include <TSAXParser.h>\r
32 \r
33 #include "AliLog.h"\r
34 #include "AliCDBHandler.h"\r
35 \r
36 ClassImp(AliCDBHandler)\r
37 \r
38   \r
39 //_____________________________________________________________________________\r
40 AliCDBHandler::AliCDBHandler()\r
41         :TObject(),\r
42          fRun(-1),\r
43          fStartRunRange(-1),\r
44          fEndRunRange(-1),\r
45          fOCDBFolder("")\r
46 {\r
47         //\r
48         // AliCDBHandler default constructor\r
49         //\r
50 }\r
51 \r
52 //_____________________________________________________________________________\r
53 AliCDBHandler::AliCDBHandler(Int_t run)\r
54         :TObject(),\r
55          fRun(run),\r
56          fStartRunRange(-1),\r
57          fEndRunRange(-1),\r
58          fOCDBFolder("")\r
59 {\r
60         //\r
61         // AliCDBHandler constructor with requested run\r
62         //\r
63 }\r
64 \r
65 //_____________________________________________________________________________\r
66 AliCDBHandler::AliCDBHandler(const AliCDBHandler &sh)\r
67         :TObject(sh),\r
68          fRun(sh.fRun),\r
69          fStartRunRange(sh.fStartRunRange),\r
70          fEndRunRange(sh.fEndRunRange),\r
71          fOCDBFolder(sh.fOCDBFolder)\r
72 {\r
73         //\r
74         // AliCDBHandler copy constructor\r
75         //\r
76 }\r
77 \r
78 //_____________________________________________________________________________\r
79 AliCDBHandler &AliCDBHandler::operator=(const AliCDBHandler &sh)\r
80 {\r
81         //\r
82         // Assignment operator\r
83         //\r
84         if (&sh == this) return *this;\r
85         \r
86         new (this) AliCDBHandler(sh);\r
87         return *this;\r
88 }\r
89 \r
90 //_____________________________________________________________________________\r
91 AliCDBHandler::~AliCDBHandler()\r
92 {\r
93         //\r
94         // AliCDBHandler destructor\r
95         //      \r
96 }\r
97 \r
98 //_____________________________________________________________________________\r
99 void AliCDBHandler::OnStartDocument()\r
100 {\r
101         // if something should happen right at the beginning of the\r
102         // XML document, this must happen here\r
103         AliInfo("Reading XML file for LHCPerdiod <-> Run Range correspondance");\r
104 }\r
105 \r
106 //_____________________________________________________________________________\r
107 void AliCDBHandler::OnEndDocument()\r
108 {\r
109         // if something should happen at the end of the XML document\r
110         // this must be done here\r
111 }\r
112 \r
113 //_____________________________________________________________________________\r
114 void AliCDBHandler::OnStartElement(const char *name, const TList *attributes)\r
115 {\r
116         // when a new XML element is found, it is processed here\r
117 \r
118         // set the current system if necessary\r
119         TString strName(name);\r
120         AliDebug(2,Form("name = %s",strName.Data()));\r
121         Int_t startRun=-1;\r
122         Int_t endRun=-1;\r
123         TXMLAttr* attr;\r
124         TIter next(attributes);\r
125         while ((attr = (TXMLAttr*) next())) {\r
126                 TString attrName = attr->GetName();\r
127                 AliDebug(2,Form("Name = %s",attrName.Data())); \r
128                 if (attrName == "StartRunRange"){\r
129                         startRun = (Int_t)(((TString)(attr->GetValue())).Atoi());\r
130                         AliDebug(2,Form("startRun = %d",startRun));\r
131                 }\r
132                 if (attrName == "EndRunRange"){\r
133                         endRun = (Int_t)(((TString)(attr->GetValue())).Atoi());\r
134                         AliDebug(2,Form("endRun = %d",endRun));\r
135                 }                               \r
136                 if (attrName == "OCDBFolder"){\r
137                         if (fRun>=startRun && fRun<=endRun && startRun!=-1 && endRun!=-1){\r
138                                 fOCDBFolder = (TString)(attr->GetValue());\r
139                                 AliDebug(2,Form("OCDBFolder = %s",fOCDBFolder.Data()));\r
140                                 fStartRunRange = startRun;\r
141                                 fEndRunRange = endRun;\r
142                         }\r
143                 }\r
144         }       \r
145         return;\r
146 }\r
147 //_____________________________________________________________________________\r
148 void AliCDBHandler::OnEndElement(const char *name)\r
149 {\r
150         // do everything that needs to be done when an end tag of an element is found\r
151         TString strName(name);\r
152         AliDebug(2,Form("name = %s",strName.Data()));\r
153 }\r
154 \r
155 //_____________________________________________________________________________\r
156 void AliCDBHandler::OnCharacters(const char *characters)\r
157 {\r
158         // copy the text content of an XML element\r
159         //fContent = characters;\r
160         TString strCharacters(characters);\r
161         AliDebug(2,Form("characters = %s",strCharacters.Data()));\r
162 }\r
163 \r
164 //_____________________________________________________________________________\r
165 void AliCDBHandler::OnComment(const char* /*text*/)\r
166 {\r
167         // comments within the XML file are ignored\r
168 }\r
169 \r
170 //_____________________________________________________________________________\r
171 void AliCDBHandler::OnWarning(const char *text)\r
172 {\r
173         // process warnings here\r
174         AliInfo(Form("Warning: %s",text));\r
175 }\r
176 \r
177 //_____________________________________________________________________________\r
178 void AliCDBHandler::OnError(const char *text)\r
179 {\r
180         // process errors here\r
181         AliError(Form("Error: %s",text));\r
182 }\r
183 \r
184 //_____________________________________________________________________________\r
185 void AliCDBHandler::OnFatalError(const char *text)\r
186 {\r
187         // process fatal errors here\r
188         AliFatal(Form("Fatal error: %s",text));\r
189 }\r
190 \r
191 //_____________________________________________________________________________\r
192 void AliCDBHandler::OnCdataBlock(const char* /*text*/, Int_t /*len*/)\r
193 {\r
194         // process character data blocks here\r
195         // not implemented and should not be used here\r
196 }\r
197 \r