]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TRD/macros/aliHLTTRDrun.cxx
update HLT of TRD macros (Ttheo)
[u/mrichter/AliRoot.git] / HLT / TRD / macros / aliHLTTRDrun.cxx
1 // This macro is used to profile the HLT::TRD code
2 // usage: aliroot aliHLTTRDrun.cxx("/data/sim/")            reconstruct raw ddls, /data/run/ must contain subfolders rawX
3
4 #if !defined (__CINT__) || defined (__MAKECINT__)
5
6 #include <iostream>
7 #include <stdlib.h>
8 #include <fstream>
9 #include <algorithm>
10
11 #include "TString.h"
12 #include "TMath.h"
13
14 #include "AliHLTSystem.h"
15 #include "AliLog.h"
16 #include "AliHLTDataTypes.h"
17 #include "AliHLTConfiguration.h"
18
19 #include <valgrind/callgrind.h>
20 #include <sys/time.h>
21 #endif
22
23 #include "initGRP.h"
24 #include "readCDBentry.h"
25
26 void aliHLTTRDrun(const TString inDir = gSystem->pwd());
27 int main(int argc, char** argv)
28 {
29   if(argc==2) aliHLTTRDrun(argv[1]);
30   else aliHLTTRDrun();
31 }
32
33 void aliHLTTRDrun(const TString inDir)
34 {   
35
36   // Is the TRD full?
37   Bool_t fullTRD=kFALSE;
38
39   // If not use these SMs:
40   Int_t TRDmodules[18] = {0,1,7,8,9,10,17,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
41
42   // Use custom arguments for components? i.e.: not reading OCDB arguments
43   Bool_t customArgs=kFALSE;
44
45   // Disable HLT flag?
46   Bool_t disableHLTflag=kFALSE;
47
48
49
50   /////////////////////////////////////
51
52   Int_t usedModules=0;
53   if(fullTRD){
54     usedModules = 18;
55     for(int i=0; i<18; i++)
56       TRDmodules[i]=i;
57   }else{
58 #if !defined (__CINT__) || defined (__MAKECINT__)
59     std::sort((UInt_t*)TRDmodules, ((UInt_t*)TRDmodules) + 18);
60 #endif
61     for(int i=0; i<18; i++)
62       if(TRDmodules[i]>-1)usedModules++;
63   }
64
65   AliHLTSystem gHLT;
66   AliLog::SetGlobalDebugLevel(1); 
67   //AliLog::SetClassDebugLevel("AliTRDrawStream", 11);
68   /* enum ETpye {kFatal=0, kError, kWarning, kInfo, kDebug, kMaxType}; */
69   gHLT.SetGlobalLoggingLevel((AliHLTComponentLogSeverity)0x7f); 
70   /*  enum AliHLTComponentLogSeverity {       
71       kHLTLogNone      = 0,
72       kHLTLogBenchmark = 0x1,
73       kHLTLogDebug     = 0x2,
74       kHLTLogInfo      = 0x4,
75       kHLTLogWarning   = 0x8,
76       kHLTLogError     = 0x10,
77       kHLTLogFatal     = 0x20,      
78       few important messages not to be filtered out.
79       redirected to kHLTLogInfo in AliRoot
80       kHLTLogImportant = 0x40,
81       special value to enable all messages 
82       kHLTLogAll       = 0x7f,
83       the default logging filter 
84       kHLTLogDefault   = 0x79
85       useful           = 0x45
86   */
87
88   gHLT.LoadComponentLibraries("libAliHLTUtil.so libAliHLTTRD.so libAliHLTMUON.so libAliHLTGlobal.so libAliHLTTrigger.so");
89
90   InitGRP("local://$ALICE_ROOT/OCDB","local:///software/data/ppbench"/*inDir.Data()*/);
91   //TString sGeomPath = " -geometry "+inDir+"/geometry.root";
92   TString inFolder = inDir+"/raw", inFile = "/TRD_", inExt = ".ddl";
93   TString sinput = " -datatype 'DDL_RAW ' 'TRD '";
94   TString temp1, temp2;
95   Int_t spec, startEvent=0, nEvents=240, ddl;  //KR: start=10, nEvents=30;
96   for(Int_t Event=startEvent; Event<(nEvents+startEvent); Event++){
97     temp1=inFolder;
98     temp1+=Event;
99     temp1+=inFile;
100     for(int module=0; module<usedModules; module++){
101       spec=TMath::Power(2,TRDmodules[module]);
102       ddl=TRDmodules[module]+1024;
103       temp2=temp1;
104       temp2+=ddl;
105       temp2+=inExt;
106       sinput+=" -dataspec ";
107       sinput+=spec;
108       sinput+=" -datafile ";
109       sinput+=temp2;
110     }
111     sinput+=" -nextevent";
112   }
113   printf("%s\n",sinput.Data());
114   TString sCFArgs = "";
115   TString sTrackerArgs = "";
116
117   if(customArgs || disableHLTflag){
118     sCFArgs = readCDBentry("HLT/ConfigTRD/ClusterizerComponent"); //output_percentage 100 -lowflux -experiment -tailcancellation -faststreamer -yPosMethod LUT
119     sTrackerArgs = readCDBentry("HLT/ConfigTRD/TrackerV1Component"); //"output_percentage 100 -lowflux -NTimeBins 24";
120     sCFArgs += ""; // -processTracklets
121     sTrackerArgs += ""; // -highLevelOutput yes -emulateHLToutput no
122     if(disableHLTflag){
123       sCFArgs +=" -HLTflag no";
124       sTrackerArgs +=" -HLTflag no";
125     }
126   }
127
128   // ======== Configuring chain
129   // Chain 1
130   AliHLTConfiguration Hsource("Hsource", "FilePublisher", 0, sinput);
131   AliHLTConfiguration HClusterizer("HClusterizer", "TRDClusterizer", "Hsource", sCFArgs);
132   AliHLTConfiguration HWriterCF("HWriterCF", "FileWriter", "HClusterizer", "-directory output/ -datafile cf.out");
133   AliHLTConfiguration HClustMultTrig("HClustMultTrig", "TrdClusterMultiplicityTrigger", "HClusterizer", "-MultiplicityThresh 400");
134
135   AliHLTConfiguration HTracker("HTracker", "TRDTrackerV1", "HClusterizer", sTrackerArgs);
136   AliHLTConfiguration HCalib("HCalib", "TRDCalibration", "HTracker", "-pushback-period=10 -TrgStr hi -rejectTrgStr");
137   AliHLTConfiguration HWriterCalib("HWriterCalib", "ROOTFileWriter", "HCalib", "-directory output/ -datafile calib.root -concatenate-events -concatenate-blocks -write-all-events");
138
139   AliHLTConfiguration HESDMaker("HESDMaker", "GlobalEsdConverter", "HTracker", "-notree");
140   AliHLTConfiguration HTrackMerger("HTrackMerger", "GlobalTrackMerger", "HTracker", "");
141
142   AliHLTConfiguration HClHisto("HClHisto", "TRDClusterHisto", "HClusterizer", "-pushback-period=10");
143   AliHLTConfiguration HClWriterHisto("HClWriterHisto", "ROOTFileWriter", "HClHisto", "-directory output/ -datafile clHisto.root -concatenate-events -concatenate-blocks");
144
145   AliHLTConfiguration HTrHisto("HTrHisto", "TRDTrackHisto", "HTracker", "-pushback-period=10");
146   AliHLTConfiguration HTrWriterHisto("HTrWriterHisto", "ROOTFileWriter", "HTrHisto", "-directory output/ -datafile trHisto.root -concatenate-events -concatenate-blocks");
147
148   AliHLTConfiguration writerOffConf("esdWriter", "TRDEsdWriter", "HTracker", "-datafile AliHLTTRDESDs.root -concatenate-events -concatenate-blocks");
149
150   gHLT.BuildTaskList(&HTracker); 
151   //gHLT.BuildTaskList(&HESDMaker);
152   //gHLT.BuildTaskList(&writerOffConf);
153   //gHLT.BuildTaskList(&HCalib);
154
155   gHLT.Run(nEvents);
156 }
157