]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/macros/transformFCFtoSCF.C
.so cleanup: removed from gSystem->Load()
[u/mrichter/AliRoot.git] / HLT / TPCLib / macros / transformFCFtoSCF.C
1 // $Id$
2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project        *
4 //* ALICE Experiment at CERN, All rights reserved.                         *
5 //*                                                                        *
6 //* Primary Authors Kalliopi Kanaki <Kalliopi.Kanaki@ift.uib.no>           *
7 //*                  for The ALICE HLT Project.                            *
8 //*                                                                        *
9 //* Permission to use, copy, modify and distribute this software and its   *
10 //* documentation strictly for non-commercial purposes is hereby granted   *
11 //* without fee, provided that the above copyright notice appears in all   *
12 //* copies and that both the copyright notice and this permission notice   *
13 //* appear in the supporting documentation. The authors make no claims     *
14 //* about the suitability of this software for any purpose. It is          *
15 //* provided "as is" without express or implied warranty.                  *
16 //**************************************************************************
17
18 /**
19  * @file   transformFCFtoSFC.C
20  * @author Kalliopi.Kanaki@ift.uib.no
21  * @date
22  * @brief  Test macro for the AliHLTTPCHWClusterTransformComponent.cxx
23  *
24  *
25  * This macro tests the component that does the tranformation from the HW
26  * cluster format to the software cluster structure.
27  * For the macro to work, the user needs to use the FilePublisher component
28  * to make the input files available. The data specification has to be given
29  * and the input files have to be present.
30  *
31  * In order for the reconstruction to work properly at the absence of raw/ folders,
32  * a directory has to be specified as the input argument of the function
33  * and an empty raw0 folder will be created if not present.
34  *
35  * The macro looks for a folder called FCFFiles by default, where the produced FCF files
36  * should be (format TPC_ddlnumber.fcf or .bin). Argument number 2 can be set to look in a different
37  * folder if wanted.
38  *
39  * In addition, since the $ALICE_ROOT/OCDB/GRP/GRP/Data entry has been removed as obsolete,
40  * the user needs to produce 1 simulated event, in order to create a proper GRP entry in the
41  * local folder, which will be used by the line
42  *
43  * rec.SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd()));
44  *
45  * The component runs without arguments, except for the case when we want to differentiate
46  * between the FCF and the SFC output. Then the argument -change-dataId will change the
47  * data Id of the FCF output.
48  *
49  */
50 void transformFCFtoSCF(const char* input="./",const char* dirName="./"){
51   
52   gSystem->Exec("rm galice.root");  
53   
54   if(!gSystem->AccessPathName("galice.root")){
55     cerr << "Please delete file galice.root or run at a different place." << endl;
56     return;
57   }
58
59   if (!input) {
60     cerr << "please specify input or run without arguments" << endl;
61     return;
62   }
63   
64   TString inputStr;
65   inputStr.Form("%s",input);
66   //  if(inputStr.)
67
68   if(inputStr.CompareTo("./") == 0){
69     if(gSystem->AccessPathName("./raw0")){
70       cout<<"No raw folder found, making dummy raw0 directory...."<<endl;
71       gSystem->Exec("mkdir raw0");
72     }
73     inputStr.Form("%s/",gSystem->pwd());
74   }
75
76   if(!inputStr.EndsWith("/")){
77     inputStr+="/";
78   }
79
80   TString dir;
81   dir.Form("%s%s/raw0",inputStr.Data(),dirName);
82
83   if(!dir.EndsWith("/")){
84     dir+="/";
85   }
86
87   if(gSystem->AccessPathName(dir)){
88     cerr << "Input directory does not exist: "<<dir.Data() << endl;
89     return;
90   }
91   
92
93   /////////////////////////////////////////////////////////////////////////////////////////////////
94   // 
95   // init the HLT system in order to define the analysis chain below
96   //
97   gSystem->Load("libHLTrec");
98   AliHLTSystem *gHLT = AliHLTReconstructorBase::GetInstance();
99
100   ///////////////////////////////////////////////////////////////////////////////////////////////////
101   //
102   // define the analysis chain to be run
103   //
104     
105   int iMinSlice =  0; 
106   int iMaxSlice = 35;
107   int iMinPart  =  0;
108   int iMaxPart  =  5;
109
110   TString dumpOutput;
111   TString FCFInput;
112   TString mergerInput;
113   TString allclusters;
114
115   for(int slice=iMinSlice; slice<=iMaxSlice; slice++){ 
116       
117       TString trackerInput;
118       for(int part=iMinPart; part<=iMaxPart; part++){
119
120           int ddlno=768;
121           if (part>1) ddlno+=72+4*slice+(part-2);
122           else ddlno+=2*slice+part;
123
124           TString file;
125           file.Form("raw0/TPC_%d.bin",ddlno);
126           
127           if(gSystem->AccessPathName(file)){
128             cerr << "Input file does not exist: "<< file.Data() << endl;
129             continue;
130           }
131                   
132           TString publisher, fcf, dumpout;
133           publisher.Form("DP_%02d_%d", slice, part);
134           TString argument;
135           argument.Form("-datatype 'HWCLUST1' 'TPC '  -datafile %s -dataspec 0x%02x%02x%02x%02x", file.Data(), slice, slice, part, part);
136                 
137           AliHLTConfiguration pubconf(publisher.Data(), "FilePublisher", NULL, argument.Data());
138           fcf.Form("FCF_%02d_%d", slice, part);
139                         
140           AliHLTConfiguration hwconf(fcf.Data(), "TPCHWClusterTransform", publisher.Data(), "");
141           
142           if(trackerInput.Length()>0) trackerInput+=" ";
143           trackerInput+=fcf;
144           if(allclusters.Length()>0) allclusters+=" ";
145           allclusters+=fcf;
146           
147           dumpout.Form("DUMP_%02d_%d", slice, part);
148           
149           TString argDump, dFile;
150           dFile.Form("FCF_%d.dump",ddlno);
151           argDump.Form("-directory FCFClusterDump -subdir=raw -datafile %s -specfmt= -blcknofmt= -idfmt= -skip-datatype", dFile.Data());
152           
153           AliHLTConfiguration clusDumpconf(dumpout.Data(), "TPCClusterDump", fcf.Data(), argDump.Data());               
154          
155           if(dumpOutput.Length()>0) dumpOutput+=",";
156           dumpOutput+=dumpout;
157       }
158       
159       TString tracker;
160       tracker.Form("TR_%02d", slice);
161       AliHLTConfiguration trackerconf(tracker.Data(), "TPCCATracker", trackerInput.Data(), "");
162       
163       if(mergerInput.Length()>0) mergerInput+=" ";
164       mergerInput+=tracker;
165   }
166   
167   AliHLTConfiguration mergerconf("globalmerger","TPCCAGlobalMerger",mergerInput.Data(),"");
168   AliHLTConfiguration esdconf("ESD","GlobalEsdConverter","globalmerger","");
169   AliHLTConfiguration sink("esdfile", "EsdCollector", "ESD", "-directory FCF-hlt-tpc-esd"); 
170
171   TString histoInput; 
172   if(histoInput.Length()>0) histoInput+=" ";
173   histoInput+=allclusters;
174   histoInput+=" ";
175   histoInput+="globalmerger";
176   
177   AliHLTConfiguration histconf("histo","TPCTrackHisto",histoInput.Data(),"");
178   
179   AliHLTConfiguration cfcompconf("comparison","TPCCFComparison",allclusters.Data(),"");
180   
181   AliHLTConfiguration rfwconf("RFW","ROOTFileWriter","histo","-datafile FCF_trackhisto -overwrite -concatenate-events");
182
183   
184   ///////////////////////////////////////////////////////////////////////////////////////////////////
185   //
186   // Init and run the reconstruction
187   // All but HLT reconstruction is switched off
188
189   AliReconstruction rec;
190   rec.SetInput(input);
191   rec.SetRunVertexFinder(kFALSE);
192   rec.SetRunReconstruction("HLT");
193   rec.SetRunTracking("");
194   rec.SetLoadAlignFromCDB(0);
195   rec.SetRunQA(":");
196   rec.SetDefaultStorage("local://$ALICE_ROOT/OCDB");  
197   rec.SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd()));
198   TString option;
199   option.Form("libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so libAliHLTGlobal.so loglevel=0x7c chains=comparison,RFW,esdfile,%s",dumpOutput.Data());
200   rec.SetOption("HLT", option);
201   rec.Run();
202
203
204 }