ROOT logo
// $Id: $

/**************************************************************************
 * This file is property of and copyright by the ALICE HLT Project        *
 * ALICE Experiment at CERN, All rights reserved.                         *
 *                                                                        *
 * Primary Authors: Artur Szostak <artursz@iafrica.com>                   *
 *                  for The ALICE HLT Project.                            *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

/// @file   GenerateReadoutListFile.C
/// @author Artur Szostak <artursz@iafrica.com>
/// @date   25 June 2010
/// @brief  Macro for generating AliHLTReadoutList readout list objects for testing.
///
/// This macro generates AliHLTReadoutList objects and writes them to a ROOT file
/// directly as an object and also in a TTree to check the behaviour of the streamers.
/// The generated file should be used by testAliHLTEventDDLBackwardCompatibility.C
/// to test the backward compatibility of AliHLTReadoutList objects.
///
/// The macro can be run as follows:
/// \code
///   aliroot -b -q GenerateReadoutListFile.C\(\"myoutputfile.root\"\)
/// \endcode
/// This will generate the file myoutputfile.root in the current directory.
/// By omitting the file name the default file name "output.root" will be used.

#if !defined(__CINT__) || defined(__MAKECINT__)
#include "AliHLTReadoutList.h"
#include "TFile.h"
#include "TTree.h"
#include "Riostream.h"
#endif

void GenerateReadoutListFile(const char* filename = "output.root")
{
	/// Generates the test file with readout list objects.
	
	TFile* file = new TFile(filename, "RECREATE");
	if (file == NULL)
	{
		cerr << "ERROR: Could not create file: " << filename << endl;
		return;
	}
	
	AliHLTReadoutList* r = new AliHLTReadoutList();
	TTree* tree = new TTree("rltree","Tree containing readout list objects.");
	tree->Branch("readoutlist", "AliHLTReadoutList", &r);
	
	r->Enable(AliHLTReadoutList::kTRG);
	r->Write("readoutlist1", TObject::kOverwrite);
	tree->Fill();
	r->Enable(AliHLTReadoutList::kEMCAL);
	r->Write("readoutlist2", TObject::kOverwrite);
	tree->Fill();
	r->Enable(AliHLTReadoutList::kDAQTEST);
	r->Write("readoutlist3", TObject::kOverwrite);
	tree->Fill();
	r->Enable(AliHLTReadoutList::kHLT);
	r->Write("readoutlist4", TObject::kOverwrite);
	tree->Fill();
	r->Disable(AliHLTReadoutList::kEMCAL);
	r->Write("readoutlist5", TObject::kOverwrite);
	tree->Fill();
	
	tree->Write("rltree", TObject::kOverwrite);
	delete file;
}
 GenerateReadoutListFile.C:1
 GenerateReadoutListFile.C:2
 GenerateReadoutListFile.C:3
 GenerateReadoutListFile.C:4
 GenerateReadoutListFile.C:5
 GenerateReadoutListFile.C:6
 GenerateReadoutListFile.C:7
 GenerateReadoutListFile.C:8
 GenerateReadoutListFile.C:9
 GenerateReadoutListFile.C:10
 GenerateReadoutListFile.C:11
 GenerateReadoutListFile.C:12
 GenerateReadoutListFile.C:13
 GenerateReadoutListFile.C:14
 GenerateReadoutListFile.C:15
 GenerateReadoutListFile.C:16
 GenerateReadoutListFile.C:17
 GenerateReadoutListFile.C:18
 GenerateReadoutListFile.C:19
 GenerateReadoutListFile.C:20
 GenerateReadoutListFile.C:21
 GenerateReadoutListFile.C:22
 GenerateReadoutListFile.C:23
 GenerateReadoutListFile.C:24
 GenerateReadoutListFile.C:25
 GenerateReadoutListFile.C:26
 GenerateReadoutListFile.C:27
 GenerateReadoutListFile.C:28
 GenerateReadoutListFile.C:29
 GenerateReadoutListFile.C:30
 GenerateReadoutListFile.C:31
 GenerateReadoutListFile.C:32
 GenerateReadoutListFile.C:33
 GenerateReadoutListFile.C:34
 GenerateReadoutListFile.C:35
 GenerateReadoutListFile.C:36
 GenerateReadoutListFile.C:37
 GenerateReadoutListFile.C:38
 GenerateReadoutListFile.C:39
 GenerateReadoutListFile.C:40
 GenerateReadoutListFile.C:41
 GenerateReadoutListFile.C:42
 GenerateReadoutListFile.C:43
 GenerateReadoutListFile.C:44
 GenerateReadoutListFile.C:45
 GenerateReadoutListFile.C:46
 GenerateReadoutListFile.C:47
 GenerateReadoutListFile.C:48
 GenerateReadoutListFile.C:49
 GenerateReadoutListFile.C:50
 GenerateReadoutListFile.C:51
 GenerateReadoutListFile.C:52
 GenerateReadoutListFile.C:53
 GenerateReadoutListFile.C:54
 GenerateReadoutListFile.C:55
 GenerateReadoutListFile.C:56
 GenerateReadoutListFile.C:57
 GenerateReadoutListFile.C:58
 GenerateReadoutListFile.C:59
 GenerateReadoutListFile.C:60
 GenerateReadoutListFile.C:61
 GenerateReadoutListFile.C:62
 GenerateReadoutListFile.C:63
 GenerateReadoutListFile.C:64
 GenerateReadoutListFile.C:65
 GenerateReadoutListFile.C:66
 GenerateReadoutListFile.C:67
 GenerateReadoutListFile.C:68
 GenerateReadoutListFile.C:69
 GenerateReadoutListFile.C:70
 GenerateReadoutListFile.C:71
 GenerateReadoutListFile.C:72
 GenerateReadoutListFile.C:73
 GenerateReadoutListFile.C:74
 GenerateReadoutListFile.C:75
 GenerateReadoutListFile.C:76
 GenerateReadoutListFile.C:77