]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MONITOR/alionlinereco/onlinereco.cxx
new option for tests in alifakedisplay
[u/mrichter/AliRoot.git] / MONITOR / alionlinereco / onlinereco.cxx
1 // Author: Mihai Niculescu 2013
2
3 /**************************************************************************
4  * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
5  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
6  * full copyright notice.                                                 *
7  **************************************************************************/
8
9 #include "AliOnlineReconstruction.h"
10  
11 #include <TApplication.h>
12 #include <TSystem.h>
13
14 #include <iostream>
15 #include <string.h>
16 #include <sstream>
17 #include <cstdlib>
18
19 bool isReconstructionRunning()
20 {
21  // check if there is events server already running
22   const char *pid = gSystem->GetFromPipe("pidof alionlinereco").Data();
23   int pidSize = gSystem->GetFromPipe("pidof alionlinereco").Sizeof();
24   std::string pidOfAll(pid,pidSize);
25   std::stringstream pidStream(pidOfAll);
26   int word_count=0; 
27   std::string word;
28   while( pidStream >> word ) ++word_count;
29   if(word_count != 1){return true;}
30   return false;
31 }
32
33 int main(int argc, char **argv)
34 {
35   if(argc!=2)
36     {
37       std::cout<<"Start Online Reconstruction with run number as a parameter"<<std::endl;
38       return 0;
39     }
40   if(isReconstructionRunning())
41     {
42       std::cout<<"There are other servers. Cannot start multiple servers on the same machine. Quitting..."<<std::endl;
43       return 0;
44     }
45   if(atoi(argv[1])<=0)
46     {
47       std::cout<<"Incorrect run number"<<std::endl;
48       return 0;
49     }
50
51   //TApplication app("AliOnlineReconstruction", &argc, argv);
52
53   std::cout<<"Starting Online Reconstruction for run:"<<atoi(argv[1])<<std::endl;
54   AliOnlineReconstruction *onlineReconstruction = new AliOnlineReconstruction(atoi(argv[1]));
55   //app.Run(kTRUE);
56   std::cout<<"after run"<<std::endl;
57   if(onlineReconstruction){delete onlineReconstruction;}
58   std::cout<<"deleted"<<std::endl;
59   return 0;
60 }