]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/macros/rec-hlt-tpc-offline.C
17f562894b51df13b0246d4f05c42105042f6eba
[u/mrichter/AliRoot.git] / HLT / TPCLib / macros / rec-hlt-tpc-offline.C
1 // $Id$
2 /**
3  * @file rec-hlt-tpc-offline.C
4  * @brief Test macro for the HLT TPC offline reco wrappers.
5  *
6  * The macro runs an HLT chain of TPC analysis, using the offline
7  * algorithms ans appropriate wrappers.
8  *
9  * Usage:
10  * <pre>
11  *   aliroot -b -q rec-hlt-tpc-offline.C | tee rec-hlt-tpc-offline.log
12  * </pre>
13  *
14  * The chain to be run is defined by the macro given to the parameter
15  * 'config='
16  *
17  * The macro asumes raw data to be available in the rawx folders, either
18  * simulated or real data. A different input can be specified as parameter
19  * <pre>
20  *   aliroot -b -q cal-hlt-tpc-offline.C'("input.root")'
21  * </pre>
22  *
23  * In the first section, an analysis chain is defined. The scale of the
24  * chain can be defined by choosing the range of sectors and partitions.
25  *
26  * The reconstruction is steered by the AliReconstruction object in the
27  * usual way.
28  *
29  * @ingroup alihlt_tpc
30  * @author Matthias.Richter@ift.uib.no
31  */
32 void rec_hlt_tpc_offline(const char* input="./")
33 {
34   if (!input) {
35     cerr << "please specify input or run without arguments" << endl;
36     return;
37   }
38   ///////////////////////////////////////////////////////////////////////////////////////////////////
39   //
40   // init the HLT system in order to define the analysis chain below
41   //
42   gSystem->Load("libHLTrec.so");
43   AliHLTSystem* gHLT=AliHLTReconstructorBase::GetInstance();
44
45   //gHLT.SwitchAliLog(0);
46
47   ///////////////////////////////////////////////////////////////////////////////////////////////////
48   //
49   // define the analysis chain to be run
50   //
51
52   bool sectorClusterer=true; // run clusterer on sector or DDL level
53   // check if the AliRawReaderMemory supports multiple buffers
54   TClass* info=TClass::GetClass("AliRawReaderMemory");
55   TList* methods=info->GetListOfAllPublicMethods();
56   if (sectorClusterer && !methods->FindObject("AddBuffer")) {
57     cerr << "warning: AliRawReaderMemory does not support multiple buffers, falling back to run clusterer on DDL level" << endl;
58     sectorClusterer=false;
59   }
60  
61   int iMinSlice=0;
62   int iMaxSlice=35;
63   int iMinPart=0;
64   int iMaxPart=5;
65
66   int DDLNoFromSlicePatch(int, int);
67
68   TString writerInput;
69   TString trackerInput;
70   for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
71     TString arg, clustererInput;
72     for (int part=iMinPart; part<=iMaxPart; part++) {
73       TString publisher, cf;
74
75       // raw data publisher components
76       int ddlno=DDLNoFromSlicePatch(slice, part);
77       arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC '  -dataspec 0x%02x%02x%02x%02x", ddlno, slice, slice, part, part);
78       publisher.Form("DP_%02d_%d", slice, part);
79       AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
80
81       if (!sectorClusterer) {
82       // cluster finder components
83       cf.Form("CF_%02d_%d", slice, part);
84       AliHLTConfiguration cfconf(cf.Data(), "TPCOfflineClusterer", publisher.Data(), "");
85
86       if (trackerInput.Length()>0) trackerInput+=" ";
87       trackerInput+=cf;
88       //if (writerInput.Length()>0) writerInput+=" ";
89       //writerInput+=cf;
90       } else {
91         if (clustererInput.Length()>0) clustererInput+=" ";
92         clustererInput+=publisher;
93       }
94     }
95     if (sectorClusterer) {
96       // cluster finder components
97       cf.Form("CF_%02d", slice);
98       AliHLTConfiguration cfconf(cf.Data(), "TPCOfflineClusterer", clustererInput.Data(), "");
99
100       if (trackerInput.Length()>0) trackerInput+=" ";
101       trackerInput+=cf;
102     }
103   }
104
105   // one global tracker component
106   TString tracker;
107   tracker.Form("Global_TR");
108   AliHLTConfiguration trackerconf(tracker.Data(), "TPCOfflineTracker", trackerInput.Data(), "");
109   if (writerInput.Length()>0) writerInput+=" ";
110   writerInput+=tracker;
111
112   // the writer configuration
113   AliHLTConfiguration esdwconf("sink1", "EsdCollector"   , writerInput.Data(), "-directory hlt-tpc-offline");
114
115   ///////////////////////////////////////////////////////////////////////////////////////////////////
116   //
117   // Init and run the reconstruction
118   // All but HLT reconstructio is switched off
119   //
120   AliReconstruction rec;
121   rec.SetInput(input);
122   rec.SetRunVertexFinder(kFALSE);
123   rec.SetRunLocalReconstruction("HLT");
124   rec.SetRunTracking("");
125   rec.SetLoadAlignFromCDB(0);
126   rec.SetFillESD("");
127   rec.SetRunQA(":");
128   rec.SetRunGlobalQA(kFALSE);
129   AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., AliMagFMaps::k5kG);
130   AliTracker::SetFieldMap(field,kFALSE);
131   rec.SetFillTriggerESD(kFALSE);
132   rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so loglevel=0x7c chains=sink1");
133   rec.Run();
134 }
135
136 int DDLNoFromSlicePatch(int slice, int part)
137 {
138   int ddlno=768;
139   if (part>1) ddlno+=72+4*slice+(part-2);
140   else ddlno+=2*slice+part;
141
142   return ddlno;
143 }