/[PAMELA software]/calo/flight/FCaloREPROC/src/CaloREPROC.cpp
ViewVC logotype

Contents of /calo/flight/FCaloREPROC/src/CaloREPROC.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Dec 4 08:51:11 2007 UTC (17 years ago) by mocchiut
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
Bugs fixed

1 #include <stdlib.h>
2 #include <iostream>
3
4 #include <TTree.h>
5 #include <TChain.h>
6 #include <TFile.h>
7 #include <TList.h>
8 #include <TROOT.h>
9 #include <TString.h>
10 #include <TBenchmark.h>
11 #include <TFriendElement.h>
12 #include <TObjectTable.h>
13
14 #include <PamLevel2.h>
15 #include <CaloREPCore.h>
16
17 using namespace std;
18
19
20 //===================================
21 // global variables
22 //===================================
23 Bool_t DEBUG;
24 TString DIR;
25 TString LIST;
26 TString OPTIONS;
27 TString OUTFILE;
28
29 void usage(){
30
31 cout << "------------------------------------------------------------"<<endl;
32 cout << "USAGE:"<<endl;
33 cout << "-processDir DIR - Level2 data directory \n";
34 cout << "-processList LIST - list of files (.txt) or single file (.root) to be analysed \n";
35 cout << "-outputFile PATH - path and name (no .root!) of the output file \n";
36 cout << "--debug, -g - debug mode \n";
37 cout << "--help, -h - print this help \n";
38 cout << "-options [ options ] - options: \n";
39 cout << " +(-)ALL --> inlcude(exclude) all trees and branches \n " ;
40 cout << " +(-)TRK1 +(-)TRK2 +(-)CAL1 +(-)CAL2 +(-)TOF +(-)TRG +(-)ND +(-)S4 +(-)ORB --> inlcude(exclude) trees and branches \n" ;
41 cout << "------------------------------------------------------------"<<endl;
42 }
43 //
44 int HandleInputPar(int argc, char **argv){
45
46 if(argc>1){
47
48 if(!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") ){
49 usage();
50 return(1);
51 };
52 // -----------------------
53 // Read input parameters
54 // -----------------------
55 DEBUG = false;
56 DIR = gSystem->WorkingDirectory();
57 LIST = "";
58 OUTFILE = "";
59 OPTIONS = "-ALL +TRK2 +TOF +TRG +AC +ND +S4 +ORB";
60 // MAXEV = 0;
61
62
63 for (int i = 1; i < argc; i++){
64 // -----------------------------------------------------//
65 if (!strcmp(argv[i], "-processDir")){
66 if (++i >= argc) throw -1;
67 DIR = argv[i];
68 cout << "processDir "<<DIR<<endl;
69 continue;
70 }
71 // -----------------------------------------------------//
72 else if (!strcmp(argv[i], "-processList")){
73 if (++i >= argc) throw -1;
74 LIST = argv[i];
75 cout << "processList "<<LIST<<endl;
76 continue;
77 }
78 // -----------------------------------------------------//
79 else if (!strcmp(argv[i], "-outputFile")){
80 if (++i >= argc) throw -1;
81 OUTFILE = argv[i];
82 cout << "outputFile "<<OUTFILE<<endl;
83 continue;
84 }
85 // -----------------------------------------------------//
86 else if (!strcmp(argv[i], "-options")){
87 if (++i >= argc) throw -1;
88 OPTIONS = argv[i];
89 if( OPTIONS.Contains("[") ){
90 do{
91 if (++i >= argc) throw -1;
92 OPTIONS.Append(argv[i]);
93 }while(!OPTIONS.Contains("]"));
94 }else cout << "wrong option format --> ignoring " << endl;
95 }
96 // -----------------------------------------------------//
97 else if (!strcmp(argv[i], "--debug") || !strcmp(argv[i], "-g")){
98 DEBUG = true;
99 continue;
100 }
101 // -----------------------------------------------------//
102 else{
103 cout << "Unidentified input parameter. Ignored."<< endl;
104 };
105 };
106 }else{
107 usage();
108 return(1);
109 };
110 // -----------------------
111 // Check input parameters
112 // -----------------------
113 //
114 return(0);
115
116 };
117 //
118
119 int main(int argc, char **argv)
120 {
121
122 if( HandleInputPar(argc,argv) )return(1);
123
124 printf(" Options: %s \n",OPTIONS.Data());
125
126 CaloREPCore(DIR,LIST,OPTIONS,OUTFILE);
127
128 printf("Finished, exiting...\n");
129
130 return 0;
131
132 };
133

  ViewVC Help
Powered by ViewVC 1.1.23