| 22 |
#include <S4Core.h> |
#include <S4Core.h> |
| 23 |
#include <NDCore.h> |
#include <NDCore.h> |
| 24 |
#include <OrbitalInfoCore.h> |
#include <OrbitalInfoCore.h> |
| 25 |
|
#include <RunInfo.h> |
| 26 |
// |
// |
| 27 |
using namespace std; |
using namespace std; |
| 28 |
// |
// |
| 35 |
void usage(){ |
void usage(){ |
| 36 |
printf("\nUsage:\n"); |
printf("\nUsage:\n"); |
| 37 |
printf("\n DarthVader [-v | --verbose] [-h | --help] [--version] -idRun ID_RUN [-processFile filename]\n"); |
printf("\n DarthVader [-v | --verbose] [-h | --help] [--version] -idRun ID_RUN [-processFile filename]\n"); |
| 38 |
printf("\n [-host host] [-user username] [-psw password] [+-all] [+-detector [detector options] ]\n"); |
printf("\n [-host host] [-user username] [-psw password] [+-all] [+-detector [ detector options ] ]\n"); |
| 39 |
printf("\n --version print informations about compilation and exit\n"); |
printf("\n --version print informations about compilation and exit\n"); |
| 40 |
printf("\n -h | --help print this help and exit \n"); |
printf("\n -h | --help print this help and exit \n"); |
| 41 |
printf("\n -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
printf("\n -v | --verbose be verbose [default]\n"); |
| 42 |
|
printf("\n -s | --silent print nothing on STDOUT\n"); |
| 43 |
|
printf("\n -c | --clean remove file if exiting with errors\n"); |
| 44 |
printf("\n -idRun ID_RUN: ID number of the run to be processed \n"); |
printf("\n -idRun ID_RUN: ID number of the run to be processed \n"); |
| 45 |
printf("\n -processFile output filename [default ID_RUN.Level2.root]\n"); |
printf("\n -processFile output filename [default ID_RUN.Level2.root]\n"); |
| 46 |
printf("\n -processFolder folder for output data but the processFile [default \"calorimeterFolder\"]\n"); |
printf("\n -host name for the host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n"); |
| 47 |
printf("\n -host name for the host [default = mysql://localhost/pamelaprod]\n"); |
printf("\n -user username for the DB [default = $PAM_DBUSER or \"anonymous\"] \n"); |
| 48 |
printf("\n -user username for the DB [default = anonymous] \n"); |
printf("\n -psw password for the DB [default = $PAM_DBPSW or \"\"]\n"); |
| 49 |
printf("\n -psw password for the DB [default = \"\"]\n"); |
printf("\n +all | +ALL call all detectors software [default]\n"); |
| 50 |
printf("\n +all call all detectors software [default]\n"); |
printf("\n -all | -ALL call nothing\n"); |
|
printf("\n -all call nothing\n"); |
|
| 51 |
printf("\n +detector process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n"); |
printf("\n +detector process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n"); |
| 52 |
printf("\n -detector do not process detector (as above)\n"); |
printf("\n -detector do not process detector (as above)\n"); |
| 53 |
|
printf("\n detector options must be included in square parenthesis with spaces, for example:\n"); |
| 54 |
|
printf("\n +CAL [ --verbose -g ] +TRK [ -v --level1 ] \n"); |
| 55 |
|
|
| 56 |
printf("\nExamples: \n"); |
printf("\nExamples: \n"); |
| 57 |
printf("\nStandard call: DarthVader -idRun 1085 \n"); |
printf("\nStandard call: DarthVader -idRun 1085 \n"); |
| 58 |
printf("\nProcess only RunInfo and Tracker (be verbose for tracker): DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n"); |
printf("\nProcess only RunInfo and Tracker (be verbose for tracker): DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n"); |
| 78 |
Int_t ACSGN = 0; |
Int_t ACSGN = 0; |
| 79 |
Int_t S4SGN = 0; |
Int_t S4SGN = 0; |
| 80 |
Int_t NDSGN = 0; |
Int_t NDSGN = 0; |
| 81 |
|
Int_t DVSGN = 0; |
| 82 |
// |
// |
| 83 |
|
Bool_t remfile = false; |
| 84 |
Bool_t debug = false; |
Bool_t debug = false; |
| 85 |
Bool_t beverbose = false; |
Bool_t beverbose = true; |
| 86 |
Bool_t givenid = false; |
Bool_t givenid = false; |
| 87 |
Bool_t CAL = true; |
Bool_t CAL = true; |
| 88 |
Bool_t TRK = true; |
Bool_t TRK = true; |
| 115 |
// |
// |
| 116 |
// |
// |
| 117 |
// |
// |
| 118 |
ULong64_t run = 0; |
UInt_t run = 0; |
| 119 |
// |
// |
| 120 |
TString filename; |
TString filename; |
| 121 |
TString outDir = gSystem->WorkingDirectory(); |
TString outDir = gSystem->WorkingDirectory(); |
| 125 |
TString user = "anonymous"; |
TString user = "anonymous"; |
| 126 |
TString psw = ""; |
TString psw = ""; |
| 127 |
// |
// |
| 128 |
|
// |
| 129 |
|
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
| 130 |
|
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
| 131 |
|
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
| 132 |
|
if ( !pamdbhost ) pamdbhost = ""; |
| 133 |
|
if ( !pamdbuser ) pamdbuser = ""; |
| 134 |
|
if ( !pamdbpsw ) pamdbpsw = ""; |
| 135 |
|
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
| 136 |
|
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
| 137 |
|
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
| 138 |
|
// |
| 139 |
|
// |
| 140 |
TFile *processFile = 0; |
TFile *processFile = 0; |
| 141 |
// |
// |
| 142 |
// Checking input parameters |
// Checking input parameters |
| 145 |
try { |
try { |
| 146 |
if ( numinp > 1 ){ |
if ( numinp > 1 ){ |
| 147 |
while ( i < numinp ){ |
while ( i < numinp ){ |
| 148 |
|
Bool_t found = false; |
| 149 |
if ( !strcmp(inps[i],"--version") ){ |
if ( !strcmp(inps[i],"--version") ){ |
| 150 |
DarthVaderInfo(true); |
DarthVaderInfo(true); |
| 151 |
exit(0); |
exit(0); |
| 159 |
usage(); |
usage(); |
| 160 |
throw -3; |
throw -3; |
| 161 |
}; |
}; |
| 162 |
|
i++; |
| 163 |
|
found = true; |
| 164 |
givenid = true; |
givenid = true; |
| 165 |
char *pEnd; |
run = atoll(inps[i]); |
|
run = strtoull(inps[i+1],&pEnd,0); |
|
| 166 |
}; |
}; |
| 167 |
if ( !strcmp(inps[i],"-processFile") ) { |
if ( !strcmp(inps[i],"-processFile") ) { |
| 168 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
| 169 |
usage(); |
usage(); |
| 170 |
throw -3; |
throw -3; |
| 171 |
}; |
}; |
| 172 |
filename = (TString)inps[i+1]; |
i++; |
| 173 |
|
found = true; |
| 174 |
|
filename = (TString)inps[i]; |
| 175 |
}; |
}; |
| 176 |
if ( !strcmp(inps[i],"-outDir") ) { |
if ( !strcmp(inps[i],"-outDir") ) { |
| 177 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
| 178 |
usage(); |
usage(); |
| 179 |
throw -3; |
throw -3; |
| 180 |
}; |
}; |
| 181 |
outDir = (TString)inps[i+1]; |
i++; |
| 182 |
|
found = true; |
| 183 |
|
outDir = (TString)inps[i]; |
| 184 |
}; |
}; |
| 185 |
if ( !strcmp(inps[i],"-host") ) { |
if ( !strcmp(inps[i],"-host") ) { |
| 186 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
| 187 |
usage(); |
usage(); |
| 188 |
throw -3; |
throw -3; |
| 189 |
}; |
}; |
| 190 |
host = (TString)inps[i+1]; |
i++; |
| 191 |
|
found = true; |
| 192 |
|
host = (TString)inps[i]; |
| 193 |
}; |
}; |
| 194 |
if ( !strcmp(inps[i],"-user") ) { |
if ( !strcmp(inps[i],"-user") ) { |
| 195 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
| 196 |
usage(); |
usage(); |
| 197 |
throw -3; |
throw -3; |
| 198 |
}; |
}; |
| 199 |
user = (TString)inps[i+1]; |
i++; |
| 200 |
|
found = true; |
| 201 |
|
user = (TString)inps[i]; |
| 202 |
}; |
}; |
| 203 |
if ( !strcmp(inps[i],"-psw") ) { |
if ( !strcmp(inps[i],"-psw") ) { |
| 204 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
| 205 |
usage(); |
usage(); |
| 206 |
throw -3; |
throw -3; |
| 207 |
}; |
}; |
| 208 |
psw = (TString)inps[i+1]; |
i++; |
| 209 |
|
found = true; |
| 210 |
|
psw = (TString)inps[i]; |
| 211 |
|
}; |
| 212 |
|
if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ){ |
| 213 |
|
found = true; |
| 214 |
|
beverbose = true; |
| 215 |
|
}; |
| 216 |
|
if ( !strcmp(inps[i],"-c") || !strcmp(inps[i],"--clean")){ |
| 217 |
|
found = true; |
| 218 |
|
remfile = true; |
| 219 |
|
}; |
| 220 |
|
if ( !strcmp(inps[i],"-s") || !strcmp(inps[i],"--silent") ){ |
| 221 |
|
found = true; |
| 222 |
|
beverbose = false; |
| 223 |
}; |
}; |
|
if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true; |
|
| 224 |
// |
// |
| 225 |
if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ) debug = true; |
if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ){ |
| 226 |
|
debug = true; |
| 227 |
|
found = true; |
| 228 |
|
}; |
| 229 |
// |
// |
| 230 |
if ( !strcmp(inps[i],"-CAL") ) { |
if ( !strcmp(inps[i],"-CAL") ) { |
| 231 |
|
found = true; |
| 232 |
CAL = false; |
CAL = false; |
| 233 |
}; |
}; |
| 234 |
if ( !strcmp(inps[i],"-TRK") ) { |
if ( !strcmp(inps[i],"-TRK") ) { |
| 235 |
|
found = true; |
| 236 |
TRK = false; |
TRK = false; |
| 237 |
}; |
}; |
| 238 |
if ( !strcmp(inps[i],"-TOF") ) { |
if ( !strcmp(inps[i],"-TOF") ) { |
| 239 |
|
found = true; |
| 240 |
TOF = false; |
TOF = false; |
| 241 |
}; |
}; |
| 242 |
if ( !strcmp(inps[i],"-TRG") ) { |
if ( !strcmp(inps[i],"-TRG") ) { |
| 243 |
|
found = true; |
| 244 |
TRG = false; |
TRG = false; |
| 245 |
}; |
}; |
| 246 |
if ( !strcmp(inps[i],"-S4") ) { |
if ( !strcmp(inps[i],"-S4") ) { |
| 247 |
|
found = true; |
| 248 |
S4 = false; |
S4 = false; |
| 249 |
}; |
}; |
| 250 |
if ( !strcmp(inps[i],"-ND") ) { |
if ( !strcmp(inps[i],"-ND") ) { |
| 251 |
|
found = true; |
| 252 |
ND = false; |
ND = false; |
| 253 |
}; |
}; |
| 254 |
if ( !strcmp(inps[i],"-AC") ) { |
if ( !strcmp(inps[i],"-AC") ) { |
| 255 |
|
found = true; |
| 256 |
AC = false; |
AC = false; |
| 257 |
}; |
}; |
| 258 |
if ( !strcmp(inps[i],"-RUN") ) { |
if ( !strcmp(inps[i],"-RUN") ) { |
| 259 |
|
found = true; |
| 260 |
RUN = false; |
RUN = false; |
| 261 |
}; |
}; |
| 262 |
if ( !strcmp(inps[i],"-ORB") ) { |
if ( !strcmp(inps[i],"-ORB") ) { |
| 263 |
|
found = true; |
| 264 |
ORB = false; |
ORB = false; |
| 265 |
}; |
}; |
| 266 |
// |
// |
| 267 |
if ( !strcmp(inps[i],"-all") ) { |
if ( !strcmp(inps[i],"-all") || !strcmp(inps[i],"-ALL") ) { |
| 268 |
CAL = false; |
CAL = false; |
| 269 |
ORB = false; |
ORB = false; |
| 270 |
TRK = false; |
TRK = false; |
| 274 |
ND = false; |
ND = false; |
| 275 |
AC = false; |
AC = false; |
| 276 |
RUN = false; |
RUN = false; |
| 277 |
|
found = true; |
| 278 |
}; |
}; |
| 279 |
// |
// |
| 280 |
if ( !strcmp(inps[i],"+all") ) { |
if ( !strcmp(inps[i],"+all") || !strcmp(inps[i],"+ALL") ) { |
| 281 |
CAL = true; |
CAL = true; |
| 282 |
ORB = true; |
ORB = true; |
| 283 |
TRK = true; |
TRK = true; |
| 287 |
ND = true; |
ND = true; |
| 288 |
AC = true; |
AC = true; |
| 289 |
RUN = true; |
RUN = true; |
| 290 |
|
found = true; |
| 291 |
}; |
}; |
| 292 |
// |
// |
| 293 |
if ( !strcmp(inps[i],"+CAL") ) { |
if ( !strcmp(inps[i],"+CAL") ) { |
| 294 |
|
found = true; |
| 295 |
CAL = true; |
CAL = true; |
| 296 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
| 297 |
if ( numinp < i+2 ){ |
if ( numinp < i+2 ){ |
| 312 |
}; |
}; |
| 313 |
}; |
}; |
| 314 |
if ( !strcmp(inps[i],"+TRK") ) { |
if ( !strcmp(inps[i],"+TRK") ) { |
| 315 |
|
found = true; |
| 316 |
TRK = true; |
TRK = true; |
| 317 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
| 318 |
if ( numinp-1 < i+2 ){ |
if ( numinp-1 < i+2 ){ |
| 333 |
}; |
}; |
| 334 |
}; |
}; |
| 335 |
if ( !strcmp(inps[i],"+TOF") ) { |
if ( !strcmp(inps[i],"+TOF") ) { |
| 336 |
|
found = true; |
| 337 |
TOF = true; |
TOF = true; |
| 338 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
| 339 |
i += 2; |
i += 2; |
| 350 |
}; |
}; |
| 351 |
}; |
}; |
| 352 |
if ( !strcmp(inps[i],"+TRG") ) { |
if ( !strcmp(inps[i],"+TRG") ) { |
| 353 |
|
found = true; |
| 354 |
TRG = true; |
TRG = true; |
| 355 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
| 356 |
i += 2; |
i += 2; |
| 367 |
}; |
}; |
| 368 |
}; |
}; |
| 369 |
if ( !strcmp(inps[i],"+ORB") ) { |
if ( !strcmp(inps[i],"+ORB") ) { |
| 370 |
|
found = true; |
| 371 |
ORB = true; |
ORB = true; |
| 372 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
| 373 |
i += 2; |
i += 2; |
| 384 |
}; |
}; |
| 385 |
}; |
}; |
| 386 |
if ( !strcmp(inps[i],"+RUN") ) { |
if ( !strcmp(inps[i],"+RUN") ) { |
| 387 |
|
found = true; |
| 388 |
RUN = true; |
RUN = true; |
| 389 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
| 390 |
i += 2; |
i += 2; |
| 401 |
}; |
}; |
| 402 |
}; |
}; |
| 403 |
if ( !strcmp(inps[i],"+AC") ) { |
if ( !strcmp(inps[i],"+AC") ) { |
| 404 |
|
found = true; |
| 405 |
AC = true; |
AC = true; |
| 406 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
| 407 |
i += 2; |
i += 2; |
| 418 |
}; |
}; |
| 419 |
}; |
}; |
| 420 |
if ( !strcmp(inps[i],"+S4") ) { |
if ( !strcmp(inps[i],"+S4") ) { |
| 421 |
|
found = true; |
| 422 |
S4 = true; |
S4 = true; |
| 423 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
| 424 |
i += 2; |
i += 2; |
| 435 |
}; |
}; |
| 436 |
}; |
}; |
| 437 |
if ( !strcmp(inps[i],"+ND") ) { |
if ( !strcmp(inps[i],"+ND") ) { |
| 438 |
|
found = true; |
| 439 |
ND = true; |
ND = true; |
| 440 |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ |
| 441 |
i += 2; |
i += 2; |
| 452 |
}; |
}; |
| 453 |
}; |
}; |
| 454 |
// |
// |
| 455 |
|
if ( !found && i > 0 ){ |
| 456 |
|
usage(); |
| 457 |
|
printf(" Unknown input number %i, that is \"%s\" \n",i,inps[i]); |
| 458 |
|
throw -22; |
| 459 |
|
}; |
| 460 |
|
// |
| 461 |
i++; |
i++; |
| 462 |
}; |
}; |
| 463 |
// |
// |
| 480 |
// |
// |
| 481 |
if ( !givenid ) throw -1; |
if ( !givenid ) throw -1; |
| 482 |
// |
// |
| 483 |
char *version = DarthVaderInfo(false); |
TString version = DarthVaderInfo(false); |
| 484 |
// |
// |
| 485 |
// Start: |
// Start: |
| 486 |
// |
// |
| 487 |
printf("\n Welcome to the PAMELA LEVEL2 flight software, version %s \n\n",version); |
printf("\n Welcome to the PAMELA LEVEL2 flight software, version %s \n\n",version.Data()); |
| 488 |
// |
// |
| 489 |
// Connect to the DB |
// Connect to the DB |
| 490 |
// |
// |
| 499 |
// |
// |
| 500 |
if ( debug ) printf("...connected! \n\n"); |
if ( debug ) printf("...connected! \n\n"); |
| 501 |
// |
// |
| 502 |
|
// Use UTC in the DB |
| 503 |
|
// |
| 504 |
|
stringstream myquery; |
| 505 |
|
myquery.str(""); |
| 506 |
|
myquery << "SET time_zone='+0:00'"; |
| 507 |
|
dbc->Query(myquery.str().c_str()); |
| 508 |
|
// |
| 509 |
|
// |
| 510 |
// Create LEVEL2 filename and open it in update mode |
// Create LEVEL2 filename and open it in update mode |
| 511 |
// |
// |
| 512 |
if ( filename.IsNull() ){ |
if ( filename.IsNull() ){ |
| 513 |
stringstream strun; |
stringstream strun; |
| 514 |
strun.str(""); |
strun.str(""); |
| 515 |
strun << run; |
strun << run; |
| 516 |
|
filename += outDir; |
| 517 |
|
filename += "/"; |
| 518 |
filename += strun.str(); |
filename += strun.str(); |
| 519 |
filename += ".Level2.root"; |
filename += ".Level2.root"; |
| 520 |
}; |
}; |
|
filename = outDir + "/" + filename; |
|
| 521 |
processFile = new TFile(filename.Data(),"UPDATE"); |
processFile = new TFile(filename.Data(),"UPDATE"); |
| 522 |
if ( !processFile->IsOpen() ) throw -15; |
if ( !processFile->IsOpen() ) throw -15; |
| 523 |
// |
// |
| 524 |
// Run the core program, put any output error in the "error" variable |
// Run the core program, put any output error in the "error" variable |
| 525 |
// |
// |
| 526 |
|
printf("\n\n Pre-processing:\n\n"); |
| 527 |
|
// |
| 528 |
if ( RUN ) { |
if ( RUN ) { |
| 529 |
printf(" Calling RunInfo... "); |
printf(" Retrieve, if the case, the RUN informations from the DB...\n"); |
| 530 |
RUNSGN = RunInfoCore(run,processFile,dbc,runargc,runargv); |
printf(" RunInfo called\n"); |
| 531 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start RunInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 532 |
|
RUNSGN = RunInfoCore(run,processFile,dbc,version,runargc,runargv); |
| 533 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end RunInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 534 |
|
printf(" ...done\n"); |
| 535 |
|
}; |
| 536 |
|
// |
| 537 |
|
// From the Run Infos extract acq_var_info to determine if detectors are in the acquisition or not |
| 538 |
|
// |
| 539 |
|
printf(" Checking if requested detectors are in the acquisition\n"); |
| 540 |
|
ItoRunInfo *runinfo = new ItoRunInfo(processFile); |
| 541 |
|
Int_t sgnl = runinfo->Read(run); |
| 542 |
|
if ( sgnl != 0 ) throw -17; |
| 543 |
|
printf(" => ACQ_VAR_INFO = %i \n",runinfo->ACQ_VAR_INFO); |
| 544 |
|
if ( TRK && !(runinfo->ACQ_VAR_INFO & (1 << 4)) ) DVSGN += 1; |
| 545 |
|
if ( TOF && !(runinfo->ACQ_VAR_INFO & (1 << 0)) ) DVSGN += 2; |
| 546 |
|
if ( CAL && !(runinfo->ACQ_VAR_INFO & (1 << 3)) ) DVSGN += 4; |
| 547 |
|
if ( AC && (!(runinfo->ACQ_VAR_INFO & (1 << 1)) || !(runinfo->ACQ_VAR_INFO & (1 << 2))) ) DVSGN += 8; |
| 548 |
|
if ( S4 && !(runinfo->ACQ_VAR_INFO & (1 << 5)) ) DVSGN += 16; |
| 549 |
|
if ( ND && !(runinfo->ACQ_VAR_INFO & (1 << 9)) ) DVSGN += 32; |
| 550 |
|
// |
| 551 |
|
if ( !DVSGN ){ |
| 552 |
|
printf(" OK! Start processing detector's data. \n"); |
| 553 |
|
} else { |
| 554 |
|
printf(" WARNING! missing detector(s)! Start anyway processing detector's data. \n"); |
| 555 |
}; |
}; |
| 556 |
|
printf("\n End pre-processing \n\n"); |
| 557 |
|
// |
| 558 |
if ( TRK ) { |
if ( TRK ) { |
| 559 |
printf(" Calling TrackerLevel2... "); |
printf(" TrackerLevel2 called\n"); |
| 560 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrkCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 561 |
TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv); |
TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv); |
| 562 |
printf("done\n"); |
gSystem->Unlink("TrackerFolder"); //patch |
| 563 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end TrkCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 564 |
}; |
}; |
| 565 |
if ( TOF ) { |
if ( TOF ) { |
| 566 |
printf(" Calling ToFLevel2... "); |
printf(" ToFLevel2 called\n"); |
| 567 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 568 |
TOFSGN = ToFCore(run,processFile,dbc,tofargc,tofargv); |
TOFSGN = ToFCore(run,processFile,dbc,tofargc,tofargv); |
| 569 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 570 |
}; |
}; |
| 571 |
if ( CAL ) { |
if ( CAL ) { |
| 572 |
printf(" Calling CalorimeterLevel2... "); |
printf(" CalorimeterLevel2 called\n"); |
| 573 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start CaloCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 574 |
CALSGN = CaloCore(run,processFile,dbc,calargc,calargv); |
CALSGN = CaloCore(run,processFile,dbc,calargc,calargv); |
| 575 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end CaloCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 576 |
}; |
}; |
| 577 |
if ( TRG ) { |
if ( TRG ) { |
| 578 |
printf(" Calling TriggerLevel2... "); |
printf(" TriggerLevel2 called\n"); |
| 579 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrigCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 580 |
TRGSGN = TrigCore(run,processFile,dbc,trgargc,trgargv); |
TRGSGN = TrigCore(run,processFile,dbc,trgargc,trgargv); |
| 581 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end TrigCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 582 |
}; |
}; |
| 583 |
if ( AC ) { |
if ( AC ) { |
| 584 |
printf(" Calling AnticounterLevel2... "); |
printf(" AnticounterLevel2 called\n"); |
| 585 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start AcCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 586 |
ACSGN = AcCore(run,processFile,dbc,acargc,acargv); |
ACSGN = AcCore(run,processFile,dbc,acargc,acargv); |
| 587 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end AcCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 588 |
}; |
}; |
| 589 |
if ( S4 ) { |
if ( S4 ) { |
| 590 |
printf(" Calling S4Level2 ... "); |
printf(" S4Level2 called\n"); |
| 591 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start S4Core STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 592 |
S4SGN = S4Core(run,processFile,dbc,s4argc,s4argv); |
S4SGN = S4Core(run,processFile,dbc,s4argc,s4argv); |
| 593 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end S4Core STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 594 |
}; |
}; |
| 595 |
if ( ND ) { |
if ( ND ) { |
| 596 |
printf(" Calling NDLevel2... "); |
printf(" NDLevel2 called\n"); |
| 597 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start NDCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 598 |
NDSGN = NDCore(run,processFile,dbc,ndargc,ndargv); |
NDSGN = NDCore(run,processFile,dbc,ndargc,ndargv); |
| 599 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end NDCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 600 |
}; |
}; |
| 601 |
if ( ORB ) { |
if ( ORB ) { |
| 602 |
printf(" Calling OrbitalInfo... "); |
printf(" OrbitalInfo called\n"); |
| 603 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start OrbitalInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 604 |
ORBSGN = OrbitalInfoCore(run,processFile,dbc,orbargc,orbargv); |
ORBSGN = OrbitalInfoCore(run,processFile,dbc,orbargc,orbargv); |
| 605 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end OrbitalInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 606 |
}; |
}; |
| 607 |
// |
// |
| 608 |
} catch(Int_t signal) { |
} catch(Int_t signal) { |
| 618 |
case -8: message += " No Header branch in LEVEL0 Physics tree"; break; |
case -8: message += " No Header branch in LEVEL0 Physics tree"; break; |
| 619 |
case -9: message += " No Registry branch in LEVEL0 Physics tree"; break; |
case -9: message += " No Registry branch in LEVEL0 Physics tree"; break; |
| 620 |
case -11: message += " LEVEL0 Physics tree is empty"; break; |
case -11: message += " LEVEL0 Physics tree is empty"; break; |
| 621 |
case -12: message += " LEVEL2 output directory does not exists"; break; |
case -12: message += " Too few entries in the tree"; break; |
| 622 |
case -13: message += " Cannot create processFolder directory"; break; |
case -13: message += " Cannot create processFolder directory"; break; |
| 623 |
case -14: message += " Error querying the DB"; break; |
case -14: message += " Error querying the DB"; break; |
| 624 |
case -15: message += " Cannot open file for writing"; break; |
case -15: message += " Cannot open file for writing"; break; |
| 625 |
|
case -17: message += " Error during pre-processing"; break; |
| 626 |
|
case -22: message += " Unknown input or wrong syntax in input paramters!"; break; |
| 627 |
// |
// |
| 628 |
case -50: message += " GLTABLES - No entries matching GL_RUN query"; break; |
case -50: message += " GLTABLES - No entries matching GL_RUN query"; break; |
| 629 |
case -51: message += " GLTABLES - No entries matching GL_ROOT query"; break; |
case -51: message += " GLTABLES - No entries matching GL_ROOT query"; break; |
| 689 |
case -802: message += " RUNINFO - Cannot open file for writing"; break; |
case -802: message += " RUNINFO - Cannot open file for writing"; break; |
| 690 |
case -803: message += " RUNINFO - Updating but no RunInfo tree in Level2 file"; break; |
case -803: message += " RUNINFO - Updating but no RunInfo tree in Level2 file"; break; |
| 691 |
case -804: message += " RUNINFO - Unknown detector"; break; |
case -804: message += " RUNINFO - Unknown detector"; break; |
| 692 |
|
case -805: message += " RUNINFO - Reprocessing data but no RunInfo tree in Level2 file"; break; |
| 693 |
|
case -806: message += " RUNINFO - Can not handle more than 500 runs"; break; |
| 694 |
// |
// |
| 695 |
default: message += "Unidentified error or warning"; break; |
default: message += "Unidentified error or warning"; break; |
| 696 |
}; |
}; |
| 697 |
printf("\n"); |
printf("\n"); |
| 698 |
if ( signal < 0 ) cout << " ERROR ("<< signal << ") "<< message <<endl; |
if ( signal < 0 ) cout << " ERROR ("<< signal << ") "<< message <<endl; |
| 699 |
} |
} |
| 700 |
// switch(RUNSGN){ |
// |
| 701 |
// }; |
// Warnings from XCore routines and from DV: |
| 702 |
|
// |
| 703 |
|
if ( debug && DVSGN ) printf(" DVSGN = %i \n",DVSGN); |
| 704 |
|
if ( DVSGN ) printf("\n WARNING DarthVader: \n"); |
| 705 |
|
if ( DVSGN & (1 << 0) ) printf(" - No tracker in the acquisition\n"); |
| 706 |
|
if ( DVSGN & (1 << 1) ) printf(" - No ToF in the acquisition\n"); |
| 707 |
|
if ( DVSGN & (1 << 2) ) printf(" - No calorimeter in the acquisition\n"); |
| 708 |
|
if ( DVSGN & (1 << 3) ) printf(" - No anticounters in the acquisition\n"); |
| 709 |
|
if ( DVSGN & (1 << 4) ) printf(" - No S4 in the acquisition\n"); |
| 710 |
|
if ( DVSGN & (1 << 5) ) printf(" - No neutron detector in the acquisition\n"); |
| 711 |
|
// |
| 712 |
|
// CaloCore: |
| 713 |
|
// |
| 714 |
switch(CALSGN){ |
switch(CALSGN){ |
| 715 |
case 100: printf("\n WARNING CALORIMETER - Data with no associated calibration\n"); break; |
case 100: printf("\n WARNING CALORIMETER - Data with no associated calibration\n"); |
| 716 |
case 101: printf("\n WARNING CALORIMETER - No tracks or good events in this run\n"); break; |
case 101: printf("\n WARNING CALORIMETER - No tracks or good events in this run\n"); |
| 717 |
}; |
}; |
| 718 |
// |
// |
| 719 |
|
// no other at the moment |
| 720 |
|
// |
| 721 |
|
// |
| 722 |
// Close the DB connection |
// Close the DB connection |
| 723 |
// |
// |
| 724 |
if ( dbc ){ |
if ( dbc ){ |
| 732 |
}; |
}; |
| 733 |
// |
// |
| 734 |
if ( error != 0 ) printf("\n\n WARNING: exiting with signal %i \n\n",error); |
if ( error != 0 ) printf("\n\n WARNING: exiting with signal %i \n\n",error); |
| 735 |
printf("\n"); |
// |
| 736 |
|
// |
| 737 |
|
// |
| 738 |
|
if ( remfile && error < 0 ){ |
| 739 |
|
printf(" -c or --clean option used, deleting file %s \n\n",filename.Data()); |
| 740 |
|
gSystem->Unlink(filename.Data()); |
| 741 |
|
}; |
| 742 |
|
// |
| 743 |
|
printf("\n Finished, exiting...\n\n"); |
| 744 |
// |
// |
| 745 |
// Close redirection if the case. |
// Close redirection if the case. |
| 746 |
// |
// |