45 bool inputFileDefined =
false;
46 bool outputFileDefined =
false;
47 bool convertClusters =
false;
48 bool filterTracks =
false;
49 bool inputRWD =
false;
50 bool inputRWC =
false;
51 bool skipCatalog =
false;
52 std::string inputFile;
53 std::string outputFile;
57 std::string exception;
63 for (
int argnum = 1; argnum < argc; argnum++)
65 std::string value = argv[argnum];
70 switch (s_mapStringValues[value.c_str()])
74 inputFileDefined =
true;
75 if (argnum + 1 >= argc)
76 throw "Missing Parameters to switch \"" + value +
"\"";
77 inputFile = argv[argnum + 1];
83 outputFileDefined =
true;
84 if (argnum + 1 >= argc)
85 throw "Missing Parameters to switch \"" + value +
"\"";
86 outputFile = argv[argnum + 1];
93 if (argnum + 1 >= argc)
94 throw "Missing Parameters to switch \"" + value +
"\"";
95 std::string
opt = argv[argnum +1];
97 convertClusters =
true;
104 if (argnum + 1 >= argc)
105 throw "Missing Parameters to switch \"" + value +
"\"";
106 std::string
opt = argv[argnum +1];
114 if (argnum + 1 >= argc)
115 throw "Missing Parameters to switch \"" + value +
"\"";
116 std::string
opt = argv[argnum +1];
128 exception =
"Unknown switch \"" + value +
"\".";
136 if (!inputFileDefined || !outputFileDefined)
138 exception =
"InputFile or OutputFile NOT defined!";
146 std::string::size_type rwc = inputFile.find(
".rwc", 0 );
147 std::string::size_type rwd = inputFile.find(
".rwd", 0 );
149 if( rwc != string::npos ) {
153 if( rwd != string::npos ) {
159 process.setCatalogName(inputFile);
160 process.setRootName(outputFile);
161 process.setClOption(convertClusters);
162 process.setFilterTrackOption(filterTracks);
163 unsigned int nFragments =0;
164 unsigned int failedFragments =0;
168 process.dumpCatalogInEdbStructure();
169 nFragments =
process.getFragmentsNumberFromCatalog();
174 char rwdname[256], temp[256];
175 for (
unsigned int f = 1;
f < nFragments+1;
f++)
177 sprintf(temp,
"%s",
process.getCatalogName());
178 sprintf(temp+strlen(temp)-1,
"d");
179 sprintf(rwdname,
"%s.%08X", temp,
f);
180 cout <<
"(tot. fragm.:"<<nFragments<<
") ";
181 process.setFragmentName(rwdname);
184 process.dumpFragmentInEdbStructure();
185 if (
process.getFilterTracksOption())
process.makeTracksPlot(
"outputPlots.root");
187 else failedFragments++;
188 if(failedFragments>5)
break;
193 process.setFragmentName(inputFile);
194 process.setRootName(outputFile);
195 process.setClOption(convertClusters);
196 process.setFilterTrackOption(filterTracks);
199 process.dumpFragmentInEdbStructure();
200 if (
process.getFilterTracksOption())
201 process.makeTracksPlot(
"outputPlots.root");
206 exception =
"input file has no .rwc extension nor .rwd extension";
213 catch (std::string str)
215 int strLengh =
static_cast<int>(str.size());
216 char *tab =
new char[strLengh];
217 for (
int i = 0; i < strLengh; i++)
221 std::cout << tab << std::endl;
222 std::cout << str << std::endl;
223 std::cout << tab << std::endl;
225 std::cout <<
"\nUsage: rwdToEdb.exe {parameters}" << std::endl;
226 std::cout <<
"/inputfile <p> - .rwc or .rwd input file." << std::endl;
227 std::cout <<
"/outputfile <p> - .root output file." << std::endl;
228 std::cout <<
"/clusters <p> - optional: on." << std::endl;
229 std::cout <<
"/filterTracks <p> - optional: on." << std::endl;
230 std::cout <<
"/skipcatalog <p> - optional: on." << std::endl;
231 std::cout <<
"/help - display the usage." << std::endl;
FILE * f
Definition: RecDispMC.C:150
Definition: ProcessRawData.h:31
bool process
Definition: emthickness.cpp:28
const char * opt
Definition: mc2raw.cxx:42
void Initialize()
Definition: rwcToEdb.cpp:28
void toLower(std::string &inputString)
Definition: rwcToEdb.cpp:6