]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/test/GenerateReadoutListFile.C
Adding the new detector MFT (Antonio Uras)
[u/mrichter/AliRoot.git] / HLT / BASE / test / GenerateReadoutListFile.C
1 // $Id: $
2
3 /**************************************************************************
4  * This file is property of and copyright by the ALICE HLT Project        *
5  * ALICE Experiment at CERN, All rights reserved.                         *
6  *                                                                        *
7  * Primary Authors: Artur Szostak <artursz@iafrica.com>                   *
8  *                  for The ALICE HLT Project.                            *
9  *                                                                        *
10  * Permission to use, copy, modify and distribute this software and its   *
11  * documentation strictly for non-commercial purposes is hereby granted   *
12  * without fee, provided that the above copyright notice appears in all   *
13  * copies and that both the copyright notice and this permission notice   *
14  * appear in the supporting documentation. The authors make no claims     *
15  * about the suitability of this software for any purpose. It is          *
16  * provided "as is" without express or implied warranty.                  *
17  **************************************************************************/
18
19 /// @file   GenerateReadoutListFile.C
20 /// @author Artur Szostak <artursz@iafrica.com>
21 /// @date   25 June 2010
22 /// @brief  Macro for generating AliHLTReadoutList readout list objects for testing.
23 ///
24 /// This macro generates AliHLTReadoutList objects and writes them to a ROOT file
25 /// directly as an object and also in a TTree to check the behaviour of the streamers.
26 /// The generated file should be used by testAliHLTEventDDLBackwardCompatibility.C
27 /// to test the backward compatibility of AliHLTReadoutList objects.
28 ///
29 /// The macro can be run as follows:
30 /// \code
31 ///   aliroot -b -q GenerateReadoutListFile.C\(\"myoutputfile.root\"\)
32 /// \endcode
33 /// This will generate the file myoutputfile.root in the current directory.
34 /// By omitting the file name the default file name "output.root" will be used.
35
36 #if !defined(__CINT__) || defined(__MAKECINT__)
37 #include "AliHLTReadoutList.h"
38 #include "TFile.h"
39 #include "TTree.h"
40 #include "Riostream.h"
41 #endif
42
43 void GenerateReadoutListFile(const char* filename = "output.root")
44 {
45         /// Generates the test file with readout list objects.
46         
47         TFile* file = new TFile(filename, "RECREATE");
48         if (file == NULL)
49         {
50                 cerr << "ERROR: Could not create file: " << filename << endl;
51                 return;
52         }
53         
54         AliHLTReadoutList* r = new AliHLTReadoutList();
55         TTree* tree = new TTree("rltree","Tree containing readout list objects.");
56         tree->Branch("readoutlist", "AliHLTReadoutList", &r);
57         
58         r->Enable(AliHLTReadoutList::kTRG);
59         r->Write("readoutlist1", TObject::kOverwrite);
60         tree->Fill();
61         r->Enable(AliHLTReadoutList::kEMCAL);
62         r->Write("readoutlist2", TObject::kOverwrite);
63         tree->Fill();
64         r->Enable(AliHLTReadoutList::kDAQTEST);
65         r->Write("readoutlist3", TObject::kOverwrite);
66         tree->Fill();
67         r->Enable(AliHLTReadoutList::kHLT);
68         r->Write("readoutlist4", TObject::kOverwrite);
69         tree->Fill();
70         r->Disable(AliHLTReadoutList::kEMCAL);
71         r->Write("readoutlist5", TObject::kOverwrite);
72         tree->Fill();
73         
74         tree->Write("rltree", TObject::kOverwrite);
75         delete file;
76 }