Renaming AliHLTReconstructorBase to AliHLTPluginBase to reflect the
[u/mrichter/AliRoot.git] / HLT / MUON / macros / HLToutputTodHLTRootObjects.C
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        *
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Authors:                                                       *
6  *   Artur Szostak <artursz@iafrica.com>                                  *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          *
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 // $Id: $
18
19 #if !defined(__CINT__) || defined(__MAKECINT__)
20 #include "AliHLTPluginBase.h"
21 #include "AliHLTConfiguration.h"
22 #include "AliReconstruction.h"
23 #include <iostream>
24 using std::cerr;
25 using std::endl;
26 #endif
27
28 /**
29  * @file HLToutputTodHLTRootObjects.C
30  * @brief Macro for converting dHLT output in HLTOUT into ROOT objects or dumping to file.
31  *
32  * This macro converts dHLT output data blocks in HLTOUT to dHLT ROOT
33  * objects which can be used for dHLT specific analysis or debugging.
34  * Alternatively the dHLT data blocks are dumped to file in raw binary format.
35  *
36  * @note The macro must be run in the directory with the raw0, raw1 etc
37  * directories. Also no reconstructed ROOT files should be in this directory
38  * either. Backup any reconstructed AliESDs.root files if you want, and then
39  * delete all root files in the directory where you will run this macro.
40  *
41  * @param dataSource  Indicates where to find the raw data. If this is a path
42  *      then the raw data is expected to be in DDL file format stored in directories
43  *      called raw0, raw1 and so on.
44  *      If a file name is given instead then it is assumed to be a DATE file unless
45  *      it ends in ".root", in which case it is assumed to be rootified raw data.
46  * @param dumpBinary  Indicates if the data should be dumped in raw binary format
47  *      to files with the file name prefix "output-". If set to false then the
48  *      output is rootified and written to a ROOT file "output.root".
49  *
50  * @author Artur Szostak <artursz@iafrica.com>
51  * @ingroup alihlt_dimuon_macros
52  */
53 void HLToutputTodHLTRootObjects(const char* dataSource = "./", bool dumpBinary = false)
54 {
55         // setup of the HLT system
56         gSystem->Load("libHLTrec.so");
57         AliHLTSystem* sys = AliHLTPluginBase::GetInstance();
58         if (sys == NULL)
59         {
60                 cerr << "FATAL ERROR: Cannot get HLT system instance." << endl;
61                 return;
62         }
63
64         // Configure the chain.
65         AliHLTConfiguration pub("Pub", "AliHLTOUTPublisher" , NULL, "-origin 'MUON'");
66         TString sources = "Pub";
67         if (dumpBinary)
68         {
69                 AliHLTConfiguration sink("dhlt-output-dump", "FileWriter", sources, "-datafile output.dat -specfmt");
70         }
71         else
72         {
73                 AliHLTConfiguration convert("convert", "MUONRootifier", sources, "");
74                 AliHLTConfiguration sink("dhlt-output-dump", "ROOTFileWriter", "convert", "-concatenate-events -datafile output.root -specfmt");
75         }
76         
77         // Setup the reconstruction and run.
78         AliReconstruction rec;
79         rec.SetInput(dataSource);
80         rec.SetLoadAlignData("");
81         rec.SetRunLocalReconstruction("HLT");
82         rec.SetRunTracking("");
83         rec.SetFillESD("");
84         rec.SetRunQA(":");
85         rec.SetFillTriggerESD(kFALSE);
86         rec.SetRunVertexFinder(kFALSE);
87         rec.SetOption("HLT", "libAliHLTMUON.so loglevel=0x78 chains=dhlt-output-dump");
88         rec.Run();
89 }