]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliXMLCollection.cxx
Adding the turl in the collection - essential for the splitting of the job: the optim...
[u/mrichter/AliRoot.git] / STEER / AliXMLCollection.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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 /* $Id$ */
17
18 //-----------------------------------------------------------------
19 //           Implementation of the AliXMLCollection class
20 //   This is the class that creates XML collections after querying the tags
21 //   Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22 //-----------------------------------------------------------------
23
24 //ROOT
25 #include <Riostream.h>
26 #include <TString.h>
27 #include <TEventList.h>
28
29 #include "AliXMLCollection.h"
30
31 ClassImp(AliXMLCollection)
32
33 //___________________________________________________________________________
34   AliXMLCollection::AliXMLCollection() :
35     TObject(),
36     fCollectionName(),
37     fout()
38 {
39   //Default constructor
40 }
41
42 //___________________________________________________________________________
43 AliXMLCollection::~AliXMLCollection() {
44   //Destructor
45 }
46
47 //___________________________________________________________________________
48 Bool_t AliXMLCollection::WriteHeader() {
49   //Creates the xml output file
50
51   TString xmlName = fCollectionName;
52   xmlName += ".xml";
53
54   TString collectionHeader = "<collection name=";
55   collectionHeader += "\"";
56   collectionHeader += fCollectionName;
57   collectionHeader += "\"";
58   collectionHeader += ">";
59   
60   // Open the output stream
61   fout.open(xmlName);
62   fout<<"<?xml version=\"1.0\"?>\n";
63   fout<<"<tags>\n";
64   fout<<"  "<<collectionHeader<<"\n";  
65
66   return kTRUE;
67 }
68
69 //___________________________________________________________________________
70 Bool_t AliXMLCollection::WriteBody(Int_t counter, const char* guid, const char* turl, TEventList *list) {
71   //Writes the body of the xml collection
72   TString listline;
73   for(Int_t i = 0; i < list->GetN(); i++) {
74     listline += list->GetEntry(i);
75     listline += ",";
76   }  
77   listline = listline(0,listline.Length()-1);
78
79   TString line0 = "<event name=\"";
80   line0 += counter;
81   line0 += "\">";
82   
83   TString line1 = "<file name=\"AliESDs.root\" ";
84   line1 += "guid=\"";
85   line1 += guid;
86   line1 += "\" ";
87   line1 += "turl=\"";
88   line1 += turl;
89   line1 += "\" ";
90   line1 += "evlist=\"";
91   line1 += listline;
92   line1 += "\"";
93   line1 += " />";
94   
95   fout<<"    "<<line0<<"\n";
96   fout<<"      "<<line1<<"\n";
97   fout<<"    </event>\n";
98   
99   return kTRUE;
100 }
101
102 //___________________________________________________________________________
103 Bool_t AliXMLCollection::Export() {
104   //Closes the stream
105   fout<<"  "<<"</collection>\n";
106   fout<<"</tags>\n";
107
108   fout.close();
109
110   return kTRUE;
111 }