| 129 |
Float_t winy = (float)hw*0.80; // 95 |
Float_t winy = (float)hw*0.80; // 95 |
| 130 |
Float_t winrap = winx/winy; |
Float_t winrap = winx/winy; |
| 131 |
// |
// |
| 132 |
|
// |
| 133 |
|
// |
| 134 |
|
TString plugindir = (TString)gSystem->ExpandPathName("$FEV_PLUGIN"); |
| 135 |
|
if ( strcmp(plugindir,"$FEV_PLUGIN") ){ |
| 136 |
|
TString wdir = gSystem->WorkingDirectory(); |
| 137 |
|
printf("\n\n Plugin directory is %s \n",plugindir.Data()); |
| 138 |
|
printf(" Loading plugins: \n"); |
| 139 |
|
// |
| 140 |
|
TSystemDirectory *datadir = new TSystemDirectory(gSystem->BaseName(plugindir),plugindir); |
| 141 |
|
TList *temp = datadir->GetListOfFiles(); |
| 142 |
|
TIter next(temp); |
| 143 |
|
TSystemFile *questo = 0; |
| 144 |
|
Int_t npl = 0; |
| 145 |
|
while ( (questo = (TSystemFile*) next()) ) { |
| 146 |
|
TString name = questo->GetName(); |
| 147 |
|
if( name.EndsWith(".so") || name.EndsWith(".o") ){ |
| 148 |
|
npl++; |
| 149 |
|
char *fullpath = gSystem->ConcatFileName(gSystem->DirName(plugindir),gSystem->BaseName(name)); |
| 150 |
|
gSystem->Load(fullpath); |
| 151 |
|
printf(" %i -> %s plugin loaded \n",npl,name.Data()); |
| 152 |
|
delete fullpath; |
| 153 |
|
}; |
| 154 |
|
} |
| 155 |
|
delete temp; |
| 156 |
|
delete datadir; |
| 157 |
|
}; |
| 158 |
|
// |
| 159 |
// book the canvas |
// book the canvas |
| 160 |
// |
// |
| 161 |
TCanvas *figure = new TCanvas("PAMELA event viewer", "PAMELA event viewer",(int)winx,(int)winy); |
TCanvas *figure = new TCanvas("PAMELA event viewer", "PAMELA event viewer",(int)winx,(int)winy); |
| 173 |
pamela->SetGUIPtr(*pamgui); |
pamela->SetGUIPtr(*pamgui); |
| 174 |
if ( outDir == "" ) outDir = startingdir; |
if ( outDir == "" ) outDir = startingdir; |
| 175 |
// |
// |
| 176 |
|
TTree *otr0 = 0; |
| 177 |
TTree *otr1 = 0; |
TTree *otr1 = 0; |
| 178 |
TTree *otr2 = 0; |
TTree *otr2 = 0; |
| 179 |
TTree *otr3 = 0; |
TTree *otr3 = 0; |
| 184 |
TTree *otr8 = 0; |
TTree *otr8 = 0; |
| 185 |
// |
// |
| 186 |
pamela->var.fl0 = false; |
pamela->var.fl0 = false; |
| 187 |
|
Int_t i = 0; |
| 188 |
|
Int_t isOK = 0; |
| 189 |
// |
// |
| 190 |
restart: |
restart: |
| 191 |
// |
// |
| 233 |
gStyle->SetNdivisions(1,"X"); |
gStyle->SetNdivisions(1,"X"); |
| 234 |
gStyle->SetNdivisions(1,"Y"); |
gStyle->SetNdivisions(1,"Y"); |
| 235 |
// |
// |
| 236 |
Int_t i = 0; |
if ( i < 0 ){ |
| 237 |
Int_t isOK = 0; |
i = -i; |
| 238 |
|
} else { |
| 239 |
|
i = 0; |
| 240 |
|
}; |
| 241 |
|
isOK = 0; |
| 242 |
// |
// |
| 243 |
// from here to refresh |
// from here to refresh |
| 244 |
// |
// |
| 245 |
refresh: |
refresh: |
| 246 |
// |
// |
| 247 |
|
// reset pointers |
| 248 |
|
// |
| 249 |
|
TFile *headerFile = 0; |
| 250 |
|
TChain *otr = 0; |
| 251 |
|
TTree *L0 = 0; |
| 252 |
|
// |
| 253 |
|
// gROOT->Reset(); |
| 254 |
|
// |
| 255 |
// set selection file variables |
// set selection file variables |
| 256 |
// |
// |
| 257 |
if ( pamela->var.refresh ){ |
if ( pamela->var.refresh ){ |
| 325 |
// |
// |
| 326 |
// load the structure header |
// load the structure header |
| 327 |
// |
// |
| 328 |
carica.str(""); |
carica.str(""); |
| 329 |
carica << paminc.str().c_str() << "/feventvstruct.h"; |
carica << paminc.str().c_str() << "/feventvstruct.h"; |
| 330 |
gROOT->LoadMacro(carica.str().c_str()); |
gROOT->LoadMacro(carica.str().c_str()); |
| 331 |
|
// carica.str(""); |
| 332 |
|
// carica << paminc.str().c_str() << "/CaloNuclei.h"; |
| 333 |
|
// gROOT->LoadMacro(carica.str().c_str()); |
| 334 |
// |
// |
| 335 |
// load the selection macro |
// load the selection macro |
| 336 |
// |
// |
| 371 |
// LOAD FILES |
// LOAD FILES |
| 372 |
// |
// |
| 373 |
// |
// |
| 374 |
TFile *headerFile = 0; |
// if ( headerFile ) headerFile->Close(); |
| 375 |
TTree *otr = 0; |
// if ( otr ) otr->Delete(); |
| 376 |
|
// if ( L0 ) L0->Delete(); |
| 377 |
|
|
| 378 |
// |
// |
| 379 |
// check if user has given as input a correct path |
// check if user has given as input a correct path |
| 380 |
// |
// |
| 396 |
// |
// |
| 397 |
// ok, open file and determine if it is a YODA or DARTHVADER file |
// ok, open file and determine if it is a YODA or DARTHVADER file |
| 398 |
// |
// |
| 399 |
|
|
| 400 |
headerFile=new TFile(filename.Data()); |
headerFile=new TFile(filename.Data()); |
| 401 |
if ( FORCELEV == 0 ){ |
if ( FORCELEV == 0 ){ |
| 402 |
pamela->level.file = 0; |
pamela->level.file = 0; |
| 403 |
otr = (TTree*)headerFile->Get("Physics"); |
L0 = (TTree*)headerFile->Get("Physics"); |
| 404 |
if ( !otr ){ |
if ( !L0 ){ |
| 405 |
printf("ERROR: no Physics tree...\n"); |
printf("ERROR: no Physics tree...\n"); |
| 406 |
pamgui->DIALOG(2,"No Physics tree in this file"); |
pamgui->DIALOG(2,"No Physics tree in this file"); |
| 407 |
pamela->var.waitforever = true; |
pamela->var.waitforever = true; |
| 409 |
} |
} |
| 410 |
} else { |
} else { |
| 411 |
pamela->level.file = 2; |
pamela->level.file = 2; |
| 412 |
otr = (TTree*)headerFile->Get("Trigger"); |
otr0 = (TTree*)headerFile->Get("Trigger"); |
| 413 |
otr1 = (TTree*)headerFile->Get("Calorimeter"); |
otr1 = (TTree*)headerFile->Get("Calorimeter"); |
| 414 |
otr2 = (TTree*)headerFile->Get("Tracker"); |
otr2 = (TTree*)headerFile->Get("Tracker"); |
| 415 |
otr3 = (TTree*)headerFile->Get("NeutronD"); |
otr3 = (TTree*)headerFile->Get("NeutronD"); |
| 418 |
otr6 = (TTree*)headerFile->Get("ToF"); |
otr6 = (TTree*)headerFile->Get("ToF"); |
| 419 |
otr7 = (TTree*)headerFile->Get("Run"); |
otr7 = (TTree*)headerFile->Get("Run"); |
| 420 |
otr8 = (TTree*)headerFile->Get("Anticounter"); |
otr8 = (TTree*)headerFile->Get("Anticounter"); |
| 421 |
if ( !otr && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8 ){ |
if ( !otr0 && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8 ){ |
| 422 |
otr = (TTree*)headerFile->Get("Physics"); |
L0 = (TTree*)headerFile->Get("Physics"); |
| 423 |
pamela->level.file = -1; |
pamela->level.file = -1; |
| 424 |
} else { |
} else { |
| 425 |
stringstream dddec; |
stringstream dddec; |
| 426 |
dddec.str(""); |
dddec.str(""); |
| 427 |
dddec << " +ALL +CAL1 -TRKh -TRK1 "; |
dddec << " +ALL +RUN +CAL1 -TRKh -TRK1 "; |
| 428 |
if ( !otr ){ |
if ( !otr0 ){ |
| 429 |
dddec << " -TRG "; |
dddec << " -TRG "; |
| 430 |
pamela->var.TRG = 0; |
pamela->var.TRG = 0; |
| 431 |
otr = otr1; |
otr0 = otr1; |
| 432 |
}; |
}; |
| 433 |
if ( !otr1 ){ |
if ( !otr1 ){ |
| 434 |
dddec << " -CAL "; |
dddec << " -CAL "; |
| 435 |
pamela->var.CALO = 0; |
pamela->var.CALO = 0; |
| 436 |
if ( !otr ) otr = otr2; |
if ( !otr0 ) otr0 = otr2; |
| 437 |
}; |
}; |
| 438 |
if ( !otr2 ){ |
if ( !otr2 ){ |
| 439 |
dddec << " -TRK2 -TRK "; |
dddec << " -TRK2 -TRK "; |
| 440 |
pamela->var.TRK = 0; |
pamela->var.TRK = 0; |
| 441 |
if ( !otr ) otr = otr3; |
if ( !otr0 ) otr0 = otr3; |
| 442 |
}; |
}; |
| 443 |
if ( !otr3 ){ |
if ( !otr3 ){ |
| 444 |
dddec << " -ND "; |
dddec << " -ND "; |
| 445 |
pamela->var.ND = 0; |
pamela->var.ND = 0; |
| 446 |
if ( !otr ) otr = otr4; |
if ( !otr0 ) otr0 = otr4; |
| 447 |
}; |
}; |
| 448 |
if ( !otr4 ){ |
if ( !otr4 ){ |
| 449 |
dddec << " -ORB "; |
dddec << " -ORB "; |
| 450 |
pamela->var.ORB = 0; |
pamela->var.ORB = 0; |
| 451 |
if ( !otr ) otr = otr5; |
if ( !otr0 ) otr0 = otr5; |
| 452 |
}; |
}; |
| 453 |
if ( !otr5 ){ |
if ( !otr5 ){ |
| 454 |
dddec << " -S4 "; |
dddec << " -S4 "; |
| 455 |
pamela->var.S4 = 0; |
pamela->var.S4 = 0; |
| 456 |
if ( !otr ) otr = otr6; |
if ( !otr0 ) otr0 = otr6; |
| 457 |
}; |
}; |
| 458 |
if ( !otr6 ){ |
if ( !otr6 ){ |
| 459 |
dddec << " -TOF "; |
dddec << " -TOF "; |
| 460 |
pamela->var.TOF = 0; |
pamela->var.TOF = 0; |
| 461 |
if ( !otr ) otr = otr8; |
if ( !otr0 ) otr0 = otr8; |
| 462 |
}; |
}; |
| 463 |
if ( !otr7 ){ |
if ( !otr7 ){ |
| 464 |
dddec << " -RUN "; |
dddec << " -RUN "; |
| 470 |
}; |
}; |
| 471 |
pamela->SetDDEC(dddec.str().c_str()); |
pamela->SetDDEC(dddec.str().c_str()); |
| 472 |
}; |
}; |
| 473 |
if ( !otr && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8){ |
if ( !otr0 && !otr1 && !otr2 && !otr3 && !otr4 && !otr5 && !otr6 && !otr7 && !otr8 && !L0 ){ |
| 474 |
pamela->level.file = -1; |
pamela->level.file = -1; |
| 475 |
printf("ERROR: nor Physics nor Run tree...\n"); |
printf("ERROR: nor Physics nor Run tree...\n"); |
| 476 |
pamgui->DIALOG(2,"Nor Physics nor Run tree in this file"); |
pamgui->DIALOG(2,"Nor Physics nor Run tree in this file"); |
| 478 |
goto refresh; |
goto refresh; |
| 479 |
}; |
}; |
| 480 |
}; |
}; |
| 481 |
|
headerFile->Close("R"); |
| 482 |
// |
// |
| 483 |
if ( pamela->level.file != 2 ){ |
if ( pamela->level.file != 2 ){ |
| 484 |
printf(" This is a YODA (level0) file \n"); |
printf(" This is a YODA (level0) file \n"); |
| 492 |
// |
// |
| 493 |
// Load the file |
// Load the file |
| 494 |
// |
// |
| 495 |
if ( otr ){ |
if ( otr0 || L0 ){ |
| 496 |
if ( !pamela->Load(*otr,*headerFile) ){ |
otr = pamela->Load(filename.Data()); |
| 497 |
|
if ( !otr ){ |
| 498 |
pamela->level.file = -1; |
pamela->level.file = -1; |
| 499 |
printf("ERROR: problems opening file...\n"); |
printf("ERROR: problems opening file...\n"); |
| 500 |
pamgui->DIALOG(2,"Problems opening file"); |
pamgui->DIALOG(2,"Problems opening file"); |
| 513 |
// |
// |
| 514 |
// get the number of entries |
// get the number of entries |
| 515 |
// |
// |
| 516 |
// otr->Print(); |
if ( !otr ) printf(" AGH! \n"); |
| 517 |
// |
// |
| 518 |
Long64_t nevents = otr->GetEntries(); |
Long64_t nevents = otr->GetEntries(); |
| 519 |
printf(" The file contains %i physics events \n",(int)nevents); |
printf(" The file contains %i physics events \n",(int)nevents); |
| 521 |
// check we have at least one event |
// check we have at least one event |
| 522 |
// |
// |
| 523 |
if (nevents<=0) { |
if (nevents<=0) { |
| 524 |
headerFile->Close(); |
// headerFile->Close(); |
| 525 |
printf("The file is empty, exiting...\n"); |
printf("The file is empty, exiting...\n"); |
| 526 |
pamgui->DIALOG(0," The file contains no physics data! "); |
pamgui->DIALOG(0," The file contains no physics data! "); |
| 527 |
pamela->var.waitforever = true; |
pamela->var.waitforever = true; |
| 654 |
// |
// |
| 655 |
pamela->var.goon = false; |
pamela->var.goon = false; |
| 656 |
if ( pamela->var.refresh || pamela->var.restart ){ |
if ( pamela->var.refresh || pamela->var.restart ){ |
| 657 |
headerFile->Close(); |
if ( pamela->GetL2() ) pamela->GetL2()->Reset(); |
| 658 |
|
if ( pamela->level.file != 2 ) pamela->GetChain()->Delete(); |
| 659 |
|
otr = NULL; |
| 660 |
|
// if ( headerFile ) headerFile->Close("R"); |
| 661 |
if ( pamela->var.refresh ) goto refresh; |
if ( pamela->var.refresh ) goto refresh; |
| 662 |
if ( pamela->var.restart ){ |
if ( pamela->var.restart ){ |
| 663 |
filename = pamela->var.thefilename.Data(); |
filename = pamela->var.thefilename.Data(); |