]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/ITS/macros/rec-its-cluster.C
adding macro for ITS data replay
[u/mrichter/AliRoot.git] / HLT / ITS / macros / rec-its-cluster.C
1 // $Id$
2 /*
3  * Example macro to run the Offline ITS Cluster Finding in HLT.
4  * The reconstruction is done from the ITS raw data.
5  *
6  * Usage:
7  * <pre>
8  *   aliroot -b -q rec-its-cluster.C | tee rec-its-cluster.log
9  *   aliroot -b -q rec-its-cluster.C'("./","spd")' | tee rec-its-cluster.log
10  * </pre>
11  *
12  * The macro asumes raw data to be available in the rawx folders, either
13  * simulated or real data. A different input can be specified as parameter
14  * <pre>
15  *   aliroot -b -q rec-its-cluster.C'("input.root")'
16  * </pre>
17  *
18  * In the second parameter you can change the clusterfinders to run only
19  * SPD, SDD, SSD or All:
20  *    - SPD runs only Silicon Pixels
21  *    - SDD runs only Silicon Drift
22  *    - SSD runs only Silicon Stips
23  *    - All will run the full ITS
24  *
25  * All is default. The chain ends in a histogram component. 
26  *
27  * The reconstruction is steered by the AliReconstruction object in the
28  * usual way.
29  *
30  * @ingroup alihlt_its
31  * @author st05886@ift.uib.no
32  */
33
34 void rec_its_cluster(const char* input="./", char* opt="All")
35 {
36
37   if(!gSystem->AccessPathName("galice.root")){
38     cerr << "please delete the galice.root or run at different place." << endl;
39     return;
40   }
41   
42   if (!input) {
43     cerr << "please specify input or run without arguments" << endl;
44     return;
45   }
46
47   ///////////////////////////////////////////////////////////////////////////////////////////////////
48   //
49   // init the HLT system in order to define the analysis chain below
50   //
51   AliHLTSystem* gHLT=AliHLTPluginBase::GetInstance();
52   int verbosity=1; // 1 higher verbosity, 0 reduced output
53  
54   ///////////////////////////////////////////////////////////////////////////////////////////////////
55   //
56   // Setting up which output to give
57   //
58   TString option;
59   option+="libAliHLTUtil.so libAliHLTRCU.so libAliHLTITS.so libAliHLTSample.so ";
60   option+="loglevel=";
61   option+=verbosity>0?"0x7c":"0x79";
62   option+=" chains=";
63   Bool_t runspd=kFALSE, runsdd=kFALSE, runssd=kFALSE;
64   TString allArgs=opt;
65   TString argument;
66   TObjArray* pTokens=allArgs.Tokenize(" ");
67   if (pTokens) {
68     for (int i=0; i<pTokens->GetEntries(); i++) {
69       argument=((TObjString*)pTokens->At(i))->GetString();
70       if (argument.IsNull()) continue;
71  
72       if (argument.CompareTo("spd", TString::kIgnoreCase)==0) {
73         runspd=kTRUE;
74         continue;
75       } 
76       if (argument.CompareTo("sdd", TString::kIgnoreCase)==0) {
77         runsdd=kTRUE;
78         continue;
79       }
80       if (argument.CompareTo("ssd",TString::kIgnoreCase)==0) {
81         runssd=kTRUE;
82         continue;
83       }
84       if (argument.CompareTo("all",TString::kIgnoreCase)==0) {
85         runspd=kTRUE;
86         runsdd=kTRUE;
87         runssd=kTRUE;
88         continue;
89       }
90       else {
91         break;
92       }
93     }
94   }
95   
96   ///////////////////////////////////////////////////////////////////////////////////////////////////
97   //
98   // define the analysis chain to be run
99   //
100     
101   //The spec starts from 0x1 in SPD, SDD and SSD. So 0x1 is ddl 0 for SPD, 0x10 is ddl 1, and so on
102   //in SDD 0x1 is ddl 256, 0x10 is ddl 257, and so on. This means that the spec has to be set to 0x1 
103   //before the loops over the clusterfinder
104
105   int minddl=0;          //min ddl number for SPD
106   int maxddl=19;         //max ddl number for SPD
107   int spec=0x1;          //spec for ddl's
108   int ddlno=0;
109   TString dummyInput="";
110
111   if(runspd){
112     for(ddlno=minddl;ddlno<=maxddl;ddlno++){  
113       TString arg, publisher, cf;
114       
115       arg.Form("-minid %d -datatype 'DDL_RAW ' 'ISPD ' -dataspec 0x%08x %s",ddlno, spec, (verbosity>0?" -verbose":""));
116       publisher.Form("DP_%d", ddlno);
117       AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
118       
119       cf.Form("CF_%d",ddlno);
120       AliHLTConfiguration cfconf(cf.Data(), "ITSClusterFinderSPD", publisher.Data(), "");
121       
122       if (dummyInput.Length()>0) dummyInput+=" ";
123       dummyInput+=cf;
124       
125       spec=spec<<1;
126     }
127   }
128   
129   if(runsdd){
130     minddl=256;        //min ddl number for SDD    
131     maxddl=279;        //max ddl number for SDD
132     spec=0x1;          //spec for ddl's
133     
134     for(ddlno=minddl;ddlno<=maxddl;ddlno++){  
135       TString arg, publisher, cf;
136       
137       arg.Form("-minid %d -datatype 'DDL_RAW ' 'ISDD ' -dataspec 0x%08x %s",ddlno, spec, (verbosity>0?" -verbose":"")); 
138       publisher.Form("DP_%d", ddlno);
139       AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
140       
141       cf.Form("CF_%d",ddlno);
142       AliHLTConfiguration cfconf(cf.Data(), "ITSClusterFinderSDD", publisher.Data(), "");
143       
144       if (dummyInput.Length()>0) dummyInput+=" ";
145       dummyInput+=cf;
146       
147       spec=spec<<1;
148     }
149   }
150
151   if(runssd){
152     minddl=512;      //min ddl number for SSD     
153     maxddl=527;      //max ddl number for SSD
154     spec=0x1;        //spec for ddl's
155     
156     for(ddlno=minddl;ddlno<=maxddl;ddlno++){  
157       TString arg, publisher, cf;
158       
159       arg.Form("-minid %d -datatype 'DDL_RAW ' 'ISSD ' -dataspec 0x%08x %s",ddlno, spec, (verbosity>0?" -verbose":""));
160       publisher.Form("DP_%d", ddlno);
161       AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
162       
163       cf.Form("CF_%d",ddlno);
164       AliHLTConfiguration cfconf(cf.Data(), "ITSClusterFinderSSD", publisher.Data(), "");
165       
166       if (dummyInput.Length()>0) dummyInput+=" ";
167       dummyInput+=cf;
168       
169       spec=spec<<1;
170     }
171   }
172
173   AliHLTConfiguration cfconf("clusterHisto","ITSClusterHisto",dummyInput.Data(),"-pushback-period=10");
174   AliHLTConfiguration fwconf("histFile","ROOTFileWriter", "clusterHisto","-datafile ClusterHisto -concatenate-events -overwrite");
175
176   option+="histFile";
177
178   ///////////////////////////////////////////////////////////////////////////////////////////////////
179   //
180   // Init and run the reconstruction
181   // All but HLT reconstructio is switched off
182   //
183   AliReconstruction rec;
184   rec.SetInput(input);
185   rec.SetRunVertexFinder(kFALSE);
186   rec.SetRunLocalReconstruction("HLT");
187   rec.SetRunTracking("");
188   rec.SetLoadAlignFromCDB(0);
189   rec.SetRunQA(":");
190
191   // NOTE: FillESD is a step in the AliReconstruction sequence and has
192   // nothing to do with the fact that this macro writes ESD output
193   // HLT processes the HLTOUT during FillESD and extracts data which
194   // has already been prepared. This step is currently not necessary for
195   // this macro
196   rec.SetFillESD("");
197   rec.SetOption("HLT", option);
198   rec.Run();
199 }
200
201
202