]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MONITOR/alipro_main.cxx
Initial version of the Alice Prompt Reconstruction Online (AliPRO) program
[u/mrichter/AliRoot.git] / MONITOR / alipro_main.cxx
CommitLineData
011d6b25 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16///////////////////////////////////////////////////////////////////////////////
17// //
18// This the source code of AliPRO (ALICE Prompt Reconstruction Online) //
19// //
20// //
21///////////////////////////////////////////////////////////////////////////////
22
23#include <stdio.h>
24#include <stdlib.h>
25
26#ifdef ALI_DATE
27#include "event.h"
28#include "monitor.h"
29#include "TROOT.h"
30#include "TSystem.h"
31#include "TGeoManager.h"
32#include "TGrid.h"
33#include "AliRun.h"
34#include "AliCDBManager.h"
35#include "AliLog.h"
36#include "AliITSRecoParam.h"
37#include "AliITSReconstructor.h"
38#include "AliTPCRecoParam.h"
39#include "AliTPCReconstructor.h"
40#include "AliMUONRecoParam.h"
41#include "AliMUONReconstructor.h"
42#include "AliPHOSRecoParam.h"
43#include "AliPHOSReconstructor.h"
44#include "AliMagFMaps.h"
45#include "AliTracker.h"
46#include "AliRecoParam.h"
47#include "AliReconstruction.h"
48#include "AliExternalTrackParam.h"
49#endif
50
51/* Main routine
52 Arguments:
53 1- monitoring data source
54*/
55#ifdef ALI_DATE
56int main(int argc, char **argv) {
57
58 int status;
59
60 if (argc!=2) {
61 printf("Wrong number of arguments\n");
62 return -1;
63 }
64
65
66 /* open result file */
67 FILE *fp=NULL;
68 fp=fopen("./result.txt","a");
69 if (fp==NULL) {
70 printf("Failed to open file\n");
71 return -1;
72 }
73
74
75 /* define data source : this is argument 1 */
76 status=monitorSetDataSource( argv[1] );
77 if (status!=0) {
78 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
79 return -1;
80 }
81
82
83 /* declare monitoring program */
84 status=monitorDeclareMp( __FILE__ );
85 if (status!=0) {
86 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
87 return -1;
88 }
89
90
91 /* define wait event timeout - 1s max */
92 monitorSetNowait();
93 monitorSetNoWaitNetworkTimeout(1000);
94
95
96 /* log start of process */
97 printf("AliPRO program started\n");
98
99
100 /* init some counters */
101 int nevents_physics=0;
102 int nevents_total=0;
103
104
105 /////////////////////////////////////////////////////////////////////////////////////////
106 //
107 // First version of the reconstruction
108 // script for the FDR'08
109 /////////////////////////////////////////////////////////////////////////////////////////
110
111 // Set the CDB storage location
112 AliCDBManager * man = AliCDBManager::Instance();
113 man->SetDefaultStorage("local://./LocalCDB");
114 // Get run number from environment / GRP-in-memory
115 man->SetRun(25984);
116
117 // ITS settings
118 AliITSRecoParam * itsRecoParam = AliITSRecoParam::GetCosmicTestParam();
119 itsRecoParam->SetClusterErrorsParam(2);
120 itsRecoParam->SetFindV0s(kFALSE);
121 itsRecoParam->SetAddVirtualClustersInDeadZone(kFALSE);
122 itsRecoParam->SetUseAmplitudeInfo(kFALSE);
123 // In case we want to switch off a layer
124 // itsRecoParam->SetLayerToSkip(<N>);
125 itsRecoParam->SetLayerToSkip(4);
126 itsRecoParam->SetLayerToSkip(5);
127 itsRecoParam->SetLayerToSkip(2);
128 itsRecoParam->SetLayerToSkip(3);
129 AliITSReconstructor::SetRecoParam(itsRecoParam);
130
131 // TPC settings
132 AliLog::SetClassDebugLevel("AliTPCclustererMI",2);
133 AliTPCRecoParam * tpcRecoParam = AliTPCRecoParam::GetCosmicTestParam(kTRUE);
134 tpcRecoParam->SetTimeInterval(60,940);
135 tpcRecoParam->Dump();
136 AliTPCReconstructor::SetRecoParam(tpcRecoParam);
137 AliTPCReconstructor::SetStreamLevel(1);
138
139 // PHOS settings
140 AliPHOSRecoParam* recEmc = new AliPHOSRecoParamEmc();
141 recEmc->SetSubtractPedestals(kTRUE);
142 recEmc->SetMinE(0.05);
143 recEmc->SetClusteringThreshold(0.10);
144 AliPHOSReconstructor::SetRecoParamEmc(recEmc);
145
146 // T0 settings
147 AliLog::SetModuleDebugLevel("T0", 10);
148
149 // MUON settings
150 AliLog::SetClassDebugLevel("AliMUONRawStreamTracker",3);
151 AliMUONRecoParam *muonRecoParam = AliMUONRecoParam::GetLowFluxParam();
152 muonRecoParam->CombineClusterTrackReco(kTRUE);
153 muonRecoParam->SetCalibrationMode("NOGAIN");
154 //muonRecoParam->SetClusteringMode("PEAKFIT");
155 //muonRecoParam->SetClusteringMode("PEAKCOG");
156 muonRecoParam->Print("FULL");
157 AliRecoParam::Instance()->RegisterRecoParam(muonRecoParam);
158
159 // Tracking settings
160 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 0., 10., 2);
161 AliTracker::SetFieldMap(field,1);
162 Double_t mostProbPt=0.35;
163 AliExternalTrackParam::SetMostProbablePt(mostProbPt);
164
165 // Instantiation of AliReconstruction
166 // AliReconstruction settings
167 AliReconstruction rec;
168
169 rec.SetUniformFieldTracking(kFALSE);
170 rec.SetWriteESDfriend(kTRUE);
171 rec.SetWriteAlignmentData();
172
173 rec.SetRunReconstruction("ALL");
174 rec.SetUseTrackingErrorsForAlignment("ITS");
175
176 // In case some detectors have to be switched off...
177 // rec.SetRunLocalReconstruction("ALL");
178 // rec.SetRunTracking("ALL");
179 // rec.SetFillESD("ALL");
180 // Disable vertex finder for the moment
181 rec.SetRunVertexFinder(kFALSE);
182
183 // To be enabled if some equipment IDs are not set correctly by DAQ
184 // rec.SetEquipmentIdMap("EquipmentIdMap.data");
185
186 // Detector options if any
187 rec.SetOption("ITS","cosmics,onlyITS");
188 rec.SetOption("MUON","SAVEDIGITS");
189 rec.SetOption("TPC","OldRCUFormat");
190 rec.SetOption("PHOS","OldRCUFormat");
191
192 // To be enabled when CTP readout starts
193 rec.SetFillTriggerESD(kFALSE);
194
195 // all events in one single file
196 rec.SetNumberOfEventsPerFile(-1);
197
198 // switch off cleanESD
199 rec.SetCleanESD(kFALSE);
200
201 rec.SetRunQA(kFALSE);
202
203 void* eventPtr = NULL;
204 rec.InitRun(NULL,&eventPtr);
205
206 /* main loop (infinite) */
207 for(;;) {
208 struct eventHeaderStruct *event;
209 eventTypeType eventT;
210
211 /* get next event (blocking call until timeout) */
212 status=monitorGetEventDynamic(&eventPtr);
213 event=(eventHeaderStruct*)eventPtr;
214 if (status==MON_ERR_EOF) {
215 printf ("End of File detected\n");
216 break; /* end of monitoring file has been reached */
217 }
218
219 if (status!=0) {
220 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
221 break;
222 }
223
224 /* retry if got no event */
225 if (event==NULL) {
226 continue;
227 }
228
229
230 /* use event - here, just write event id to result file */
231 eventT=event->eventType;
232
233 if (eventT==PHYSICS_EVENT) {
234 fprintf(fp,"Run #%lu, event size: %lu, BC:%u, Orbit:%u, Period:%u\n",
235 (unsigned long)event->eventRunNb,
236 (unsigned long)event->eventSize,
237 EVENT_ID_GET_BUNCH_CROSSING(event->eventId),
238 EVENT_ID_GET_ORBIT(event->eventId),
239 EVENT_ID_GET_PERIOD(event->eventId)
240 );
241 nevents_physics++;
242
243 AliLog::Flush();
244
245 rec.AddEventAndRun();
246
247 }
248 nevents_total++;
249
250 /* free resources */
251 free(event);
252
253 /* exit when last event received, no need to wait for TERM signal */
254 if (eventT==END_OF_RUN) {
255 printf("EOR event detected\n");
256 break;
257 }
258 }
259
260 rec.FinishRun();
261
262 /* write report */
263 fprintf(fp,"Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);
264
265 /* close result file */
266 fclose(fp);
267
268 return status;
269}
270#else
271int main(int /*argc*/, char** /*argv*/)
272{
273 printf("This program was compiled without DATE\n");
274
275 return 1;
276}
277#endif