]>
Commit | Line | Data |
---|---|---|
7e0cf530 | 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 | **************************************************************************/ | |
d2416c53 | 8 | |
9 | #include "AliOnlineReconstruction.h" | |
7e0cf530 | 10 | |
11 | #include <TApplication.h> | |
cc94dac0 | 12 | #include <TSystem.h> |
d2416c53 | 13 | |
13a64a87 | 14 | #include <iostream> |
15 | #include <string.h> | |
cc94dac0 | 16 | #include <sstream> |
d2416c53 | 17 | #include <cstdlib> |
7e0cf530 | 18 | |
d2416c53 | 19 | bool isReconstructionRunning() |
7e0cf530 | 20 | { |
d2416c53 | 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(); | |
cc94dac0 | 24 | std::string pidOfAll(pid,pidSize); |
25 | std::stringstream pidStream(pidOfAll); | |
cc94dac0 | 26 | int word_count=0; |
27 | std::string word; | |
28 | while( pidStream >> word ) ++word_count; | |
d2416c53 | 29 | if(word_count != 1){return true;} |
30 | return false; | |
31 | } | |
cc94dac0 | 32 | |
d2416c53 | 33 | int main(int argc, char **argv) |
34 | { | |
35 | if(argc!=2) | |
cc94dac0 | 36 | { |
d2416c53 | 37 | std::cout<<"Start Online Reconstruction with run number as a parameter"<<std::endl; |
cc94dac0 | 38 | return 0; |
39 | } | |
d2416c53 | 40 | if(isReconstructionRunning()) |
13a64a87 | 41 | { |
d2416c53 | 42 | std::cout<<"There are other servers. Cannot start multiple servers on the same machine. Quitting..."<<std::endl; |
43 | return 0; | |
13a64a87 | 44 | } |
d2416c53 | 45 | if(atoi(argv[1])<=0) |
13a64a87 | 46 | { |
d2416c53 | 47 | std::cout<<"Incorrect run number"<<std::endl; |
48 | return 0; | |
13a64a87 | 49 | } |
50 | ||
d2416c53 | 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 | if(onlineReconstruction){delete onlineReconstruction;} | |
57 | ||
7e0cf530 | 58 | return 0; |
59 | } |