]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/macros/activePadsTest.C
The present commit corresponds to an important change in the way the
[u/mrichter/AliRoot.git] / HLT / TPCLib / macros / activePadsTest.C
1
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 Kenneth Aamodt <kenneth.aamodt@cern.ch>                *
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   activePadsTest.C
20  * @author Kenneth.Aamodt@cern.ch
21  * @date   
22  * @brief  Test macro of the active pad selection
23  *
24  * The macro reads the simulated TPC digits from the RunLoader and
25  * prints the digit info to stout.
26  *
27  * The macro reads ddl data and apply zerosuppression on it. The zerosuppression
28  * component then ships out a list of pads in addition to the zerosuppressed data.
29  * This list of pads is here used in combination with the original raw data to
30  * remove all pads with no data surviving the zerosuppression with the altro 
31  * selection component. This is to study undershoot of signals etc. The output of
32  * altro selection component is the NON zerosuppressed data of all the pads which
33  * there should be a signal in. To test this the macro runs in several steps. 
34  * Point 3 and 4 has to be done in this way to avoid confusion in what ddl data is 
35  * read by the component. 
36  * 1. read the data.
37  * 2. dump it to file. (will be compared to the zerosuppressed data later)
38  * 3. apply zerosuppression producing activepads list
39  * 4. apply zerosuppression producing zerosuppressed data.
40  * 5. dump the data from 4. to file
41  * 6. send the active pad list together with the original data to the altro selection component
42  * 7. dump the reduced data to file
43  * 8. again apply zero suppression to this reduced data
44  * 9. dump the result from zero suppression from 8.(on the reduced data)
45  * 10. compare the outputs from 2 and 7 at see that they are different (if not; this is not a good test) (diff dump1/ev.... dump2/ev...)
46  * 11. compare the outputs from 5. and 9. to see that they are alike. (diff dump3/ev... dump4/ev..)
47  *
48  * NB: 10. and 11. must by now be done manually.... will change soon 
49  * aliroot -b -q activePadsTest.C
50  *
51  */
52
53 void activePadsTest(const char* input="./"){
54   
55   if (!input) {
56     cerr << "please specify input or run without arguments" << endl;
57     return;
58   }
59   
60   
61   /////////////////////////////////////////////////////////////////////////////////////////////////
62   // 
63   // init the HLT system in order to define the analysis chain below
64   //
65   gSystem->Load("libHLTrec.so");
66   AliHLTSystem* gHLT=AliHLTReconstructorBase::GetInstance();
67
68 //   AliCDBManager* pManager=AliCDBManager::Instance(NULL, 0);
69 //   pManager->SetRun(0);
70
71   ///////////////////////////////////////////////////////////////////////////////////////////////////
72   //
73   // define the analysis chain to be run
74   //
75     
76   int iMinSlice=8; 
77   int iMaxSlice=8;
78   int iMinPart=2;
79   int iMaxPart=2;
80   TString digitDumpInput_OriginalData;
81   TString digitDumpInput_AfterAPSelection;
82   TString digitDumpInput_ZeroSuppressedOriginalData;
83   TString digitDumpInput_ZerosuppressedAPSelectionData;
84   TString dumpHwAddressInput;
85
86   for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
87     for (int part=iMinPart; part<=iMaxPart; part++) {
88       TString arg, publisher, inputAltroSelection, zsactivepadlist, zsoriginaldata, altroChannelSelector, zsACSdata, zsACSdataOutput;
89       // digit publisher components
90       int ddlno=768;
91       if (part>1) ddlno+=72+4*slice+(part-2);
92       else ddlno+=2*slice+part;
93       arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC '  -dataspec 0x%02x%02x%02x%02x -verbose", ddlno, slice, slice, part, part);
94
95       publisher.Form("DP_%02d_%d", slice, part);
96       AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
97       if(digitDumpInput_OriginalData.Length() >0) digitDumpInput_OriginalData += " ";
98       digitDumpInput_OriginalData += publisher;
99       if(inputAltroSelection.Length() >0) inputAltroSelection += " ";
100       inputAltroSelection += publisher;
101
102       // zero suppression component (3.)
103       zsactivepadlist.Form("ZSAP_%02d_%d", slice, part);
104       AliHLTConfiguration cfconf(zsactivepadlist.Data(), "TPCZeroSuppression", publisher.Data(), "signal-threshold 2 start-timebin 70 end-timebin 900 -skip-sending-data -send-hw-list");
105       if (inputAltroSelection.Length()>0) inputAltroSelection+=" ";
106       inputAltroSelection+=zsactivepadlist;
107       if (dumpHwAddressInput.Length()>0) dumpHwAddressInput+=" ";
108       dumpHwAddressInput+=zsactivepadlist;
109     
110       // zero suppression component (4.)
111       zsoriginaldata.Form("ZSDDL_%02d_%d", slice, part);
112       AliHLTConfiguration cfconf(zsoriginaldata.Data(), "TPCZeroSuppression", publisher.Data(), "signal-threshold 2 start-timebin 70 end-timebin 900");
113       if(digitDumpInput_ZeroSuppressedOriginalData.Length() >0) digitDumpInput_ZeroSuppressedOriginalData += " ";
114       digitDumpInput_ZeroSuppressedOriginalData += zsoriginaldata;
115
116       //altro channel selector
117       altroChannelSelector.Form("ACS_%02d_%d", slice, part);
118       AliHLTConfiguration cfconf(altroChannelSelector.Data(), "AltroChannelSelector", inputAltroSelection.Data(), "");
119       if(zsACSdata.Length() >0) zsACSdata += " ";
120       zsACSdata+= altroChannelSelector;
121       if(digitDumpInput_AfterAPSelection.Length() >0) digitDumpInput_AfterAPSelection += " ";
122       digitDumpInput_AfterAPSelection += altroChannelSelector;
123
124       // zero suppression component (8.)
125       zsACSdataOutput.Form("ZSACS_%02d_%d", slice, part);
126       AliHLTConfiguration cfconf(zsACSdataOutput.Data(), "TPCZeroSuppression", zsACSdata.Data(), "signal-threshold 2 start-timebin 70 end-timebin 900");
127       if(digitDumpInput_ZerosuppressedAPSelectionData.Length() >0) digitDumpInput_ZerosuppressedAPSelectionData += " ";
128       digitDumpInput_ZerosuppressedAPSelectionData += zsACSdataOutput;
129       
130     }
131   }
132   //Dumping data (2.)
133   AliHLTConfiguration dump1("Dump1", "TPCDigitDump", digitDumpInput_OriginalData.Data() , "-digitreader decoder -directory dump1 -unsorted -concatenate-blocks");
134   //Dumping data (7.)
135   AliHLTConfiguration dump2("Dump2", "TPCDigitDump", digitDumpInput_AfterAPSelection.Data() , "-digitreader decoder -directory dump2 -unsorted -concatenate-blocks");
136   //Dumping data (5.)
137   AliHLTConfiguration dump3("Dump3", "TPCDigitDump", digitDumpInput_ZeroSuppressedOriginalData.Data() , "-digitreader decoder -directory dump3 -unsorted -concatenate-blocks");
138   //Dumping data (9.)
139   AliHLTConfiguration dump4("Dump4", "TPCDigitDump", digitDumpInput_ZerosuppressedAPSelectionData.Data() , "-digitreader decoder -directory dump4 -unsorted -concatenate-blocks");
140   //Dumping hw lists
141   AliHLTConfiguration dump5("Dump5", "FileWriter", dumpHwAddressInput.Data() , "-directory hwlists");
142
143
144   ///////////////////////////////////////////////////////////////////////////////////////////////////
145   //
146   // Init and run the reconstruction
147   // All but HLT reconstruction is switched off
148   //
149   AliReconstruction rec;
150   rec.SetInput(input);
151   rec.SetRunVertexFinder(kFALSE);
152   rec.SetRunLocalReconstruction("HLT");
153   rec.SetRunTracking("");
154   rec.SetLoadAlignFromCDB(0);
155   rec.SetRunQA(":");
156   //rec.SetFillESD("HLT");
157   rec.SetFillESD("");
158   rec.SetFillTriggerESD(false);
159   rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so loglevel=0x7c chains=Dump1,Dump2,Dump3,Dump4,Dump5");
160   rec.Run();
161 }