Fix Coverity defects
[u/mrichter/AliRoot.git] / TRD / AliTRDSaxHandler.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 /* $Id: AliTRDSaxHandler.cxx 26327 2008-06-02 15:36:18Z cblume $ */\r
17 \r
18 ////////////////////////////////////////////////////////////////////////////\r
19 //                                                                        //\r
20 //  The SAX XML file handler used in the TRD preprocessor                 //\r
21 //                                                                        //\r
22 //  Authors:                                                              //\r
23 //    Frederick Kramer (kramer@ikf.uni-frankfurt.de)                      //\r
24 //    Thomas Bird      (thomas@thomasbird.com)                            //\r
25 //                                                                        //\r
26 ////////////////////////////////////////////////////////////////////////////\r
27 \r
28 \r
29 #include <TList.h>\r
30 #include <TMath.h>\r
31 #include "AliLog.h"\r
32 #include "Cal/AliTRDCalDCSGTUTgu.h"\r
33 #include "Cal/AliTRDCalDCSPTR.h"\r
34 \r
35 #include <TXMLAttr.h>\r
36 #include <TObjArray.h>\r
37 #include "AliTRDSaxHandler.h"\r
38 #include "AliTRDgeometry.h"\r
39 #include "Cal/AliTRDCalDCS.h"\r
40 #include "Cal/AliTRDCalDCSFEE.h"\r
41 #include "Cal/AliTRDCalDCSGTU.h"\r
42 \r
43 ClassImp(AliTRDSaxHandler)\r
44   \r
45 //_____________________________________________________________________________\r
46 AliTRDSaxHandler::AliTRDSaxHandler()\r
47   :TObject()\r
48   ,fHandlerStatus(0)\r
49   ,fNDCSPTR(0)\r
50   ,fNDCSGTU(0)\r
51   ,fFEEArr(new TObjArray(540))\r
52   ,fPTRArr(new TObjArray(6))\r
53   ,fSystem(0)\r
54   ,fInsideRstate(0)\r
55   ,fCurrentSM(0)\r
56   ,fCurrentStack(0)\r
57   ,fCurrentROB(-1)\r
58   ,fCurrentMCM(-1)\r
59   ,fCurrentADC(-1)\r
60   ,fContent(0)\r
61   ,fDCSFEEObj(0)\r
62   ,fDCSPTRObj(0)\r
63   ,fDCSGTUObj(0)\r
64   ,fCalDCSObj(new AliTRDCalDCS())\r
65   ,fLevel1Tag(-2)\r
66   ,fLevel2Tag(-2)\r
67   ,fInsideBoardInfo(false)\r
68   ,fTmu(0)\r
69   ,fCtpOpc(0)\r
70   ,fSegment(0)\r
71   ,fBoardInfo(0)\r
72 {\r
73   // AliTRDSaxHandler default constructor\r
74   fFEEArr->SetOwner();\r
75   fPTRArr->SetOwner();\r
76 }\r
77 \r
78 //_____________________________________________________________________________\r
79 AliTRDSaxHandler::AliTRDSaxHandler(const AliTRDSaxHandler &sh)\r
80   :TObject(sh)\r
81   ,fHandlerStatus(0)\r
82   ,fNDCSPTR(0)\r
83   ,fNDCSGTU(0)\r
84   ,fFEEArr(0)\r
85   ,fPTRArr(0)\r
86   ,fSystem(0)\r
87   ,fInsideRstate(0)\r
88   ,fCurrentSM(0)\r
89   ,fCurrentStack(0)\r
90   ,fCurrentROB(-1)\r
91   ,fCurrentMCM(-1)\r
92   ,fCurrentADC(-1)\r
93   ,fContent(0)\r
94   ,fDCSFEEObj(0)\r
95   ,fDCSPTRObj(0)\r
96   ,fDCSGTUObj(0)\r
97   ,fCalDCSObj(0)\r
98   ,fLevel1Tag(-2)\r
99   ,fLevel2Tag(-2)\r
100   ,fInsideBoardInfo(false)\r
101   ,fTmu(0)\r
102   ,fCtpOpc(0)\r
103   ,fSegment(0)\r
104   ,fBoardInfo(0)\r
105 {\r
106   // AliTRDSaxHandler copy constructor\r
107 }\r
108 \r
109 //_____________________________________________________________________________\r
110 AliTRDSaxHandler &AliTRDSaxHandler::operator=(const AliTRDSaxHandler &sh)\r
111 {\r
112   // Assignment operator\r
113   if (&sh == this) return *this;\r
114   new (this) AliTRDSaxHandler(sh);\r
115   return *this;\r
116 }\r
117 \r
118 //_____________________________________________________________________________\r
119 AliTRDSaxHandler::~AliTRDSaxHandler()\r
120 {\r
121   // AliTRDSaxHandler destructor\r
122   if (fFEEArr) {\r
123     delete fFEEArr;\r
124     fFEEArr    = 0x0;\r
125   }\r
126   if (fPTRArr) {\r
127     delete fPTRArr;\r
128     fPTRArr    = 0x0;\r
129   }\r
130   if (fDCSGTUObj) {\r
131     delete fDCSGTUObj;\r
132     fDCSGTUObj    = 0x0;\r
133   }\r
134   if (fCalDCSObj) {\r
135     delete fCalDCSObj;\r
136     fCalDCSObj = 0x0;\r
137   }\r
138 }\r
139 \r
140 //_____________________________________________________________________________\r
141 AliTRDCalDCS* AliTRDSaxHandler::GetCalDCSObj()\r
142 {\r
143   // put the arrays in the global calibration object and return this\r
144   fCalDCSObj->SetFEEArr(fFEEArr);\r
145   fCalDCSObj->SetPTRArr(fPTRArr);\r
146   fCalDCSObj->SetGTUObj(fDCSGTUObj);\r
147   return fCalDCSObj;\r
148 }\r
149 \r
150 //_____________________________________________________________________________\r
151 void AliTRDSaxHandler::OnStartDocument() const\r
152 {\r
153   // if something should happen right at the beginning of the\r
154   // XML document, this must happen here\r
155 }\r
156 \r
157 //_____________________________________________________________________________\r
158 void AliTRDSaxHandler::OnEndDocument() const\r
159 {\r
160   // if something should happen at the end of the XML document\r
161   // this must be done here\r
162 }\r
163 \r
164 //_____________________________________________________________________________\r
165 bool AliTRDSaxHandler::CompareString(TString str, const char *str2)\r
166 {\r
167   // compre strings, ignoring case\r
168   // returns true if they are the same, else false\r
169   return !(bool)str.CompareTo(str2,str.kIgnoreCase);\r
170 }\r
171 \r
172 \r
173 //_____________________________________________________________________________\r
174 void AliTRDSaxHandler::OnStartElement(const char *name, const TList *attributes)\r
175 {\r
176   // when a new XML element is found, it is processed here\r
177   fContent    = ""; // Technically <p> This <em>is</em> ok but would be a problem here</p>\r
178   Int_t dcsId = 0;\r
179   TString tagName  = name;\r
180   TString dcsTitle = "";\r
181 \r
182   // set the current system if necessary\r
183   if (CompareString(tagName, "FEE")) fSystem = kInsideFEE;\r
184   if (CompareString(tagName, "PTR")) fSystem = kInsidePTR;\r
185   if (CompareString(tagName, "GTU")) {\r
186     fSystem = kInsideGTU;\r
187     fDCSGTUObj = new AliTRDCalDCSGTU(tagName,tagName);\r
188   }\r
189 \r
190   if (fSystem == kInsideGTU) {\r
191     if (CompareString(tagName, "tgu")) fLevel1Tag = kInsideTgu;\r
192     if (CompareString(tagName, "board_info")) {\r
193       fInsideBoardInfo = true;\r
194       fBoardInfo = new AliTRDCalDCSGTUBoardInfo(tagName,tagName);\r
195     }\r
196     if (CompareString(tagName(0,tagName.Length()-3), "segment")) { \r
197       fSegment = new AliTRDCalDCSGTUSegment(tagName,tagName);\r
198       fSegment->SetId(TString(tagName(8,2)).Atoi());\r
199       fLevel1Tag = kInsideSegment;\r
200     }\r
201     if (fLevel1Tag == kInsideTgu) {\r
202       if (CompareString(tagName, "ctp_opc"))   fCtpOpc = new AliTRDCalDCSGTUCtpOpc(tagName,tagName);\r
203     } else if (fLevel1Tag == kInsideSegment) {\r
204       if (CompareString(tagName, "smu")) {\r
205         fLevel2Tag = kInsideSmu;\r
206       }\r
207       if (CompareString(tagName(0,3), "tmu")) {\r
208         fTmu = new AliTRDCalDCSGTUTmu(tagName,tagName);\r
209         fTmu->SetId(TString(tagName(4,2)).Atoi());\r
210         fLevel2Tag = kInsideTmu;\r
211       }\r
212     }\r
213   } else if (fSystem == kInsideFEE) {\r
214     if (CompareString(tagName, "gaintbl")) fLevel1Tag = kInsideGainTable;\r
215   }\r
216 \r
217   // set if we are inside rstate \r
218   // (in principle not necessary - just to be more safe against stupid tags)\r
219   if (CompareString(tagName, "rstate")) fInsideRstate = 1;\r
220 \r
221   // get the attributes of the element\r
222   TXMLAttr *attr;\r
223   TIter next(attributes);\r
224   while ((attr = (TXMLAttr*) next())) {\r
225     TString attribName = attr->GetName();\r
226     TString attribValue = attr->GetValue();\r
227     if (fSystem == kInsideFEE && fLevel1Tag == kInsideNone) {\r
228       if (CompareString(attribName, "id") && CompareString(tagName, "DCS")) {\r
229         dcsTitle = name;\r
230         dcsId = atoi(attr->GetValue());\r
231       }\r
232       if (CompareString(attribName, "roc") && CompareString(tagName, "ack")) {\r
233         if (attribValue.Atoi() != fDCSFEEObj->GetDCSid())\r
234           fDCSFEEObj->SetStatusBit(4); // consistency check\r
235       }\r
236       if (CompareString(attribName, "rob") && CompareString(tagName, "ro-board") && (fInsideRstate == 1)) {\r
237         fCurrentROB = attribValue.Atoi();\r
238       }\r
239       if (CompareString(attribName, "mcm") && CompareString(tagName, "m") && (fInsideRstate == 1)) {\r
240         fCurrentMCM = attribValue.Atoi();\r
241       }\r
242       if (CompareString(attribName, "sm") && CompareString(tagName, "DCS")) {\r
243         fCurrentSM = attribValue.Atoi(); // only for GTU/PTR\r
244       }\r
245       if (CompareString(attribName, "id") && CompareString(tagName, "STACK")) {// hmmmm not exist?\r
246         fCurrentStack = attribValue.Atoi(); // only for GTU/PTR\r
247       }\r
248     } else if (fSystem == kInsideFEE && fLevel1Tag == kInsideGainTable) {\r
249       if (CompareString(tagName, "roc") && CompareString(attribName, "type"))    fDCSFEEObj->SetGainTableRocType(attribValue);\r
250       if (CompareString(tagName, "roc") && CompareString(attribName, "serial"))  fDCSFEEObj->SetGainTableRocSerial(attribValue.Atoi());\r
251       if (CompareString(tagName, "mcm") && CompareString(attribName, "rob"))     fCurrentROB = attribValue.Atoi();\r
252       if (CompareString(tagName, "mcm") && CompareString(attribName, "pos"))     fCurrentMCM = attribValue.Atoi();\r
253       if (CompareString(tagName, "adc") && CompareString(attribName, "id"))      fCurrentADC = attribValue.Atoi();\r
254       \r
255     } else if (fSystem == kInsideGTU && fLevel1Tag == kInsideNone) {\r
256       if (CompareString(tagName, "publisher")) {\r
257         if (CompareString(attribName, "at"))         fDCSGTUObj->SetSORFlag(attribValue.Atoi());\r
258         if (CompareString(attribName, "serial"))     fDCSGTUObj->SetSerial(attribValue.Atoi());\r
259         if (CompareString(attribName, "runnr"))      fDCSGTUObj->SetRunNumber(attribValue.Atoi());\r
260       }\r
261     } else if (fSystem == kInsideGTU && fLevel1Tag == kInsideTgu) {\r
262       if (CompareString(tagName, "from")) {\r
263         if (CompareString(attribName, "at"))         fDCSGTUObj->GetTgu()->SetFromSORFlag(attribValue.Atoi());\r
264         if (CompareString(attribName, "runnr"))      fDCSGTUObj->GetTgu()->SetFromRunNumber(attribValue.Atoi());\r
265         if (CompareString(attribName, "child"))      fDCSGTUObj->GetTgu()->SetFromChild(attribValue.Atoi());\r
266       }\r
267       if (CompareString(tagName, "segmentmask") && CompareString(attribName, "value"))  fDCSGTUObj->GetTgu()->SetSegmentMask(attribValue);\r
268       if (CompareString(tagName, "busymask") && CompareString(attribName, "value"))     fDCSGTUObj->GetTgu()->SetBusyMask(attribValue);\r
269       if (CompareString(tagName, "contribmask") && CompareString(attribName, "value"))  fDCSGTUObj->GetTgu()->SetContribMask(attribValue);\r
270       \r
271       if (CompareString(tagName, "ctp_opc") && CompareString(attribName, "id"))         fCtpOpc->SetId(attribValue.Atoi());\r
272       if (CompareString(tagName, "ctp_opc") && CompareString(attribName, "opcode"))     fCtpOpc->SetOpcode(attribValue.Atoi());\r
273       if (CompareString(tagName, "ctp_opc") && CompareString(attribName, "direction"))  fCtpOpc->SetDirection(attribValue.Atoi());\r
274       if (CompareString(tagName, "ctp_opc") && CompareString(attribName, "inverted"))   fCtpOpc->SetInverted(attribValue.Atoi());\r
275       if (CompareString(tagName, "ctp_opc") && CompareString(attribName, "delay"))      fCtpOpc->SetDelay(attribValue.Atoi());\r
276       if (CompareString(tagName, "ctp_opc") && CompareString(attribName, "connected"))  fCtpOpc->SetConnected(attribValue.Atoi());\r
277       \r
278     } else if (fSystem == kInsideGTU && fLevel1Tag == kInsideSegment) {\r
279       if (CompareString(tagName, "from")) {\r
280         if (CompareString(attribName, "at"))         fSegment->SetFromSORFlag(attribValue.Atoi());\r
281         if (CompareString(attribName, "runnr"))      fSegment->SetFromRunNumber(attribValue.Atoi());\r
282         if (CompareString(attribName, "child"))      fSegment->SetFromChild(attribValue.Atoi());\r
283       }\r
284       if (fLevel2Tag == kInsideSmu) {\r
285         if (CompareString(tagName, "stackmask") && CompareString(attribName, "value"))     fSegment->SetSmuStackMask(attribValue);\r
286         if (CompareString(tagName, "tracklets") && CompareString(attribName, "send"))      fSegment->SetSmuTracklets(attribValue.Atoi());\r
287         if (CompareString(tagName, "tracks") && CompareString(attribName, "send"))         fSegment->SetSmuTracks(attribValue.Atoi());\r
288         if (CompareString(tagName, "idelay") && CompareString(attribName, "value"))        fSegment->SetSmuIdelay(attribValue.Atoi());\r
289         if (CompareString(tagName, "ttc_emulator") && CompareString(attribName, "enable")) fSegment->SetSmuTtcEmulatorEnable(attribValue.Atoi());\r
290         \r
291         if (CompareString(tagName, "trigger_window") && CompareString(attribName, "l1_low"))  \r
292           fSegment->SetSmuTriggerWindowL1Low(attribValue.Atoi());\r
293         if (CompareString(tagName, "trigger_window") && CompareString(attribName, "l1_high"))  \r
294           fSegment->SetSmuTriggerWindowL1High(attribValue.Atoi());\r
295         if (CompareString(tagName, "trigger_window") && CompareString(attribName, "l2_low"))  \r
296           fSegment->SetSmuTriggerWindowL2Low(attribValue.Atoi());\r
297         if (CompareString(tagName, "trigger_window") && CompareString(attribName, "l2_high"))  \r
298           fSegment->SetSmuTriggerWindowL2High(attribValue.Atoi());\r
299         \r
300       } else if (fLevel2Tag == kInsideTmu) {\r
301         if (CompareString(tagName, "linkmask") && CompareString(attribName, "value"))      fTmu->SetLinkMask(attribValue);\r
302         if (CompareString(tagName, "pattern_generator") && CompareString(attribName, "enable")) \r
303           fTmu->SetPatternGeneratorEnable(attribValue.Atoi());\r
304         if (CompareString(tagName, "pattern_generator") && CompareString(attribName, "datawords")) \r
305           fTmu->SetPatternGeneratorDataWords(attribValue.Atoi());\r
306         if (CompareString(tagName, "pattern_generator") && CompareString(attribName, "trackletwords")) \r
307           fTmu->SetPatternGeneratorTrackletWords(attribValue.Atoi());\r
308       }\r
309     }\r
310     \r
311     if (fInsideBoardInfo) {\r
312       if (CompareString(tagName, "board_info") && CompareString(attribName, "board_id"))    fBoardInfo->SetId(attribValue);\r
313       if (CompareString(tagName, "board_info") && CompareString(attribName, "design_type")) fBoardInfo->SetType(attribValue.Atoi());\r
314       if (CompareString(tagName, "board_info") && CompareString(attribName, "pci_ga"))      fBoardInfo->SetPciGa(attribValue.Atoi());\r
315       if (CompareString(tagName, "hardware") && CompareString(attribName, "date"))          fBoardInfo->SetHwDate(attribValue);\r
316       if (CompareString(tagName, "hardware") && CompareString(attribName, "rev"))           fBoardInfo->SetHwRev(attribValue.Atoi());\r
317       if (CompareString(tagName, "hardware") && CompareString(attribName, "clean"))         fBoardInfo->SetHwClean(attribValue.Atoi());\r
318       if (CompareString(tagName, "software") && CompareString(attribName, "date"))          fBoardInfo->SetSwDate(attribValue);\r
319       if (CompareString(tagName, "software") && CompareString(attribName, "rev"))           fBoardInfo->SetSwRev(attribValue.Atoi());\r
320       if (CompareString(tagName, "software") && CompareString(attribName, "clean"))         fBoardInfo->SetSwClean(attribValue.Atoi());\r
321     }\r
322   }\r
323 \r
324   // if there is a new DCS element put it in the correct array\r
325   if (CompareString(tagName, "DCS")) {\r
326     if (fSystem == kInsideFEE) {\r
327       fDCSFEEObj = new AliTRDCalDCSFEE(name,dcsTitle);\r
328       fDCSFEEObj->SetDCSid(dcsId);\r
329     }\r
330     if (fSystem == kInsidePTR) {\r
331 //       fDCSPTRObj = new AliTRDCalDCSPTR(name,dcsTitle);\r
332 //       fDCSPTRObj->SetDCSid(dcsId);\r
333     }\r
334     if (fSystem == kInsideGTU) {\r
335 //       fDCSGTUObj = new AliTRDCalDCSGTU(name,dcsTitle);\r
336 //       fDCSGTUObj->SetDCSid(dcsId);\r
337     }\r
338   }\r
339 }\r
340 \r
341 //_____________________________________________________________________________\r
342 void AliTRDSaxHandler::OnEndElement(const char *name)\r
343 {\r
344   // do everything that needs to be done when an end tag of an element is found\r
345   TString tagName = name;\r
346   \r
347   // if done with this DCS board, put it in the correct array\r
348   // no check for </ack> necessary since this check is done during XML validation\r
349   if (CompareString(tagName, "DCS")) {\r
350     if (fSystem == kInsideFEE) {\r
351       Int_t detID = 0;\r
352       if (fDCSFEEObj->GetStatusBit() == 0) {\r
353         // if there were no errors (StatusBit==0) the following should match\r
354         detID = fDCSFEEObj->GetDCSid();\r
355         AliTRDgeometry aliGeo;\r
356         Int_t calDetID = aliGeo.GetDetector(fDCSFEEObj->GetLayer(),\r
357                                             fDCSFEEObj->GetStack(),\r
358                                             fDCSFEEObj->GetSM());\r
359         if (detID != calDetID) fDCSFEEObj->SetStatusBit(4);\r
360       } else {\r
361         // if the dcs board didn't properly respond, don't compare\r
362         detID = fDCSFEEObj->GetDCSid();\r
363       }\r
364       fFEEArr->AddAt(fDCSFEEObj,detID);\r
365     }\r
366     if (fSystem == kInsidePTR) {\r
367       fPTRArr->AddAt(fDCSPTRObj,fNDCSPTR);\r
368       fNDCSPTR++;\r
369     }\r
370 //     if (fSystem == kInsideGTU) {\r
371 //       fGTUArr->AddAt(fDCSGTUObj,fNDCSGTU);\r
372 //       fNDCSGTU++;\r
373 //     }\r
374     fCurrentSM = 99; // 99 for no SM set\r
375     fDCSFEEObj = 0;  // just to be sure\r
376     return;\r
377   }\r
378 \r
379   // done with this stack? \r
380   if (CompareString(tagName, "STACK")) {// TODO: errrrm ???? always 99?\r
381     fCurrentStack = 99; // 99 for no stack set\r
382   }\r
383 \r
384   // outside of rstate again?\r
385   if (CompareString(tagName, "rstate")) {\r
386     fInsideRstate = 0;\r
387     fCurrentROB   = -1;\r
388     fCurrentMCM   = -1;\r
389   }\r
390   if (CompareString(tagName, "ro-board")) fCurrentROB = -1;\r
391   \r
392   // store informations of the FEE DCS-Board\r
393   if (fSystem == kInsideFEE) {\r
394     if (CompareString(tagName, "DNR"))            fDCSFEEObj->SetStatusBit(fContent.Atoi());\r
395     if (CompareString(tagName, "CFGNME"))         fDCSFEEObj->SetConfigName(fContent);\r
396     if (CompareString(tagName, "CFGTAG"))         fDCSFEEObj->SetConfigTag(fContent.Atoi());\r
397     if (CompareString(tagName, "CFGVRSN"))        fDCSFEEObj->SetConfigVersion(fContent);\r
398     if (CompareString(tagName, "NTB"))            fDCSFEEObj->SetNumberOfTimeBins(fContent.Atoi());\r
399     if (CompareString(tagName, "SM-ID"))          fDCSFEEObj->SetSM(fContent.Atoi());\r
400     if (CompareString(tagName, "STACK-ID"))       fDCSFEEObj->SetStack(fContent.Atoi());\r
401     if (CompareString(tagName, "LAYER-ID"))       fDCSFEEObj->SetLayer(fContent.Atoi());\r
402     if (CompareString(tagName, "SINGLEHITTHRES")) fDCSFEEObj->SetSingleHitThres(fContent.Atoi());\r
403     if (CompareString(tagName, "THRPADCLSTHRS"))  fDCSFEEObj->SetThreePadClustThres(fContent.Atoi());\r
404     if (CompareString(tagName, "SELNOZS"))        fDCSFEEObj->SetSelectiveNoZS(fContent.Atoi());\r
405     if (CompareString(tagName, "FASTSTATNOISE"))  fDCSFEEObj->SetFastStatNoise(fContent.Atoi());\r
406     if (CompareString(tagName, "FILTWEIGHT"))     fDCSFEEObj->SetTCFilterWeight(fContent.Atoi());\r
407     if (CompareString(tagName, "FILTSHRTDCYPRM")) fDCSFEEObj->SetTCFilterShortDecPar(fContent.Atoi());\r
408     if (CompareString(tagName, "FILTLNGDCYPRM"))  fDCSFEEObj->SetTCFilterLongDecPar(fContent.Atoi());\r
409     if (CompareString(tagName, "FLTR"))           fDCSFEEObj->SetFilterType(fContent);\r
410     if (CompareString(tagName, "READOUTPAR"))     fDCSFEEObj->SetReadoutParam(fContent);\r
411     if (CompareString(tagName, "TESTPATTERN"))    fDCSFEEObj->SetTestPattern(fContent);\r
412     if (CompareString(tagName, "TRCKLTMODE"))     fDCSFEEObj->SetTrackletMode(fContent);\r
413     if (CompareString(tagName, "TRCKLTDEF"))      fDCSFEEObj->SetTrackletDef(fContent);\r
414     if (CompareString(tagName, "TRIGGERSETUP"))   fDCSFEEObj->SetTriggerSetup(fContent);\r
415     if (CompareString(tagName, "ADDOPTIONS"))     fDCSFEEObj->SetAddOptions(fContent);\r
416     if (CompareString(tagName, "gaintbl")) {\r
417       fLevel1Tag = kInsideNone;\r
418       fCurrentROB = -1;\r
419       fCurrentMCM = -1;\r
420       fCurrentADC = -1;\r
421     }\r
422     if (fLevel1Tag == kInsideGainTable) {\r
423       if (CompareString(tagName, "name"))   fDCSFEEObj->SetGainTableName(fContent);\r
424       if (CompareString(tagName, "desc"))   fDCSFEEObj->SetGainTableDesc(fContent);\r
425       if (fCurrentROB>=0 && fCurrentMCM>=0) {\r
426         if (CompareString(tagName, "adcdac")) fDCSFEEObj->SetGainTableAdcdac(fCurrentROB, fCurrentMCM, fContent.Atoi());\r
427         if (fCurrentADC>=0) {\r
428           if (CompareString(tagName, "fgfn"))   fDCSFEEObj->SetGainTableFgfn(fCurrentROB, fCurrentMCM, fCurrentADC, fContent.Atoi());\r
429           if (CompareString(tagName, "fgan"))   fDCSFEEObj->SetGainTableFgan(fCurrentROB, fCurrentMCM, fCurrentADC, fContent.Atoi());\r
430         }\r
431       }\r
432     }\r
433     if (fInsideRstate == 1) {\r
434       if (fCurrentROB>=0 && fCurrentMCM>=0) {\r
435         if (CompareString(tagName, "gsm")) fDCSFEEObj->SetMCMGlobalState(fCurrentROB, fCurrentMCM, fContent.Atoi());\r
436         if (CompareString(tagName, "ni")) fDCSFEEObj->SetMCMStateNI(fCurrentROB, fCurrentMCM, fContent.Atoi());\r
437         if (CompareString(tagName, "ev")) fDCSFEEObj->SetMCMEventCnt(fCurrentROB, fCurrentMCM, fContent.Atoi());\r
438         if (CompareString(tagName, "ptrg")) fDCSFEEObj->SetMCMPtCnt(fCurrentROB, fCurrentMCM, fContent.Atoi());\r
439       }\r
440     }\r
441   }\r
442 \r
443   if (fSystem == kInsideGTU) {\r
444 //     if (CompareString(tagName, "run")) { \r
445 //       fDCSGTUObj->SetSORFlag(TString(fContent(fContent.Length()-1,1)).Atoi());\r
446 //       fDCSGTUObj->SetRunNumber(TString(fContent(0,fContent.Length()-2)).Atoi());\r
447 //     }\r
448 //     if (CompareString(tagName, "serial"))         fDCSGTUObj->SetSerial(fContent.Atoi());\r
449     if (CompareString(tagName, "board_info")) {\r
450       fInsideBoardInfo = false;\r
451       if (fLevel1Tag == kInsideTgu)                                  fDCSGTUObj->GetTgu()->SetBoardInfo(fBoardInfo);\r
452       if (fLevel1Tag == kInsideSegment && fLevel2Tag == kInsideSmu)  fSegment->SetSmuBoardInfo(fBoardInfo);\r
453       if (fLevel1Tag == kInsideSegment && fLevel2Tag == kInsideTmu)  fTmu->SetBoardInfo(fBoardInfo);\r
454     }\r
455     if (CompareString(tagName, "dnr"))            fDCSGTUObj->SetDNR(fContent.Atoi());\r
456     if (CompareString(tagName, "tgu"))            fLevel1Tag = kInsideNone;\r
457     if (CompareString(tagName(0,tagName.Length()-3), "segment")) { \r
458       fDCSGTUObj->GetSegmentArray()->Add(fSegment);\r
459       fLevel1Tag = kInsideNone;\r
460     }\r
461     if (fLevel1Tag == kInsideTgu) {\r
462       if (CompareString(tagName, "ctp_opc"))        fDCSGTUObj->GetTgu()->GetCtpOpcArray()->Add(fCtpOpc);\r
463     } else if (fLevel1Tag == kInsideSegment) {\r
464       if (CompareString(tagName, "smu"))          fLevel2Tag = kInsideNone;\r
465       if (CompareString(tagName(0,3), "tmu")) {\r
466         fSegment->GetTmuArray()->Add(fTmu);\r
467         fLevel2Tag = kInsideNone;\r
468       }\r
469     }\r
470   }\r
471 \r
472   \r
473   // store pretrigger informations\r
474   if (fSystem == kInsidePTR) {\r
475     // no informations available yet\r
476   }\r
477 //   // store GTU informations\r
478 //   if (fSystem == kInsideGTU) {\r
479 //     if (CompareString(tagName, "SMMASK"))\r
480 //       fHandlerStatus = fDCSGTUObj->SetSMMask(fContent);\r
481 //     if (CompareString(tagName, "LINKMASK")) \r
482 //       fHandlerStatus = fDCSGTUObj->SetLinkMask(fCurrentSM, fCurrentStack, fContent);\r
483 //     if (CompareString(tagName, "STMASK"))\r
484 //       fDCSGTUObj->SetStackMaskBit(fCurrentSM, fCurrentStack, fContent.Atoi());\r
485 //   }\r
486 }\r
487 \r
488 //_____________________________________________________________________________\r
489 void AliTRDSaxHandler::OnCharacters(const char *characters)\r
490 {\r
491   // copy the the text content of an XML element\r
492   fContent = characters;\r
493 }\r
494 \r
495 //_____________________________________________________________________________\r
496 void AliTRDSaxHandler::OnComment(const char* /*text*/) const\r
497 {\r
498   // comments within the XML file are ignored\r
499 }\r
500 \r
501 //_____________________________________________________________________________\r
502 void AliTRDSaxHandler::OnWarning(const char *text)\r
503 {\r
504   // process warnings here\r
505   AliInfo(Form("Warning: %s",text));\r
506 }\r
507 \r
508 //_____________________________________________________________________________\r
509 void AliTRDSaxHandler::OnError(const char *text)\r
510 {\r
511   // process errors here\r
512   AliError(Form("Error: %s",text));\r
513 }\r
514 \r
515 //_____________________________________________________________________________\r
516 void AliTRDSaxHandler::OnFatalError(const char *text)\r
517 {\r
518   // process fatal errors here\r
519   AliError(Form("Fatal error: %s",text)); // use AliFatal?\r
520 }\r
521 \r
522 //_____________________________________________________________________________\r
523 void AliTRDSaxHandler::OnCdataBlock(const char* /*text*/, Int_t /*len*/) const\r
524 {\r
525   // process character data blocks here\r
526   // not implemented and should not be used here\r
527 }\r
528 \r