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