Changeset 4286 for trunk/MagicSoft/Mars/mtemp/mifae
- Timestamp:
- 06/11/04 20:02:08 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mtemp/mifae
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/Changelog
r4263 r4286 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2004/05/27 Ester Aliu 22 * programs/makeHillas.cc 23 - add the possibility of using more than one algorithm to 24 calculate the islands and use different algorithms for counting 25 islands 26 27 * library/MIslands.[h,cc],MIslandCalc.cc 28 - add a new island cleaning which consists in removing all the 29 islands except the larger one 30 - add a new algorithm of counting islands consisting in consider 31 as the same islands those islands separated by 2 or less pixels 20 32 21 33 2004/06/02 Javier Rico -
trunk/MagicSoft/Mars/mtemp/mifae/library/MIslandCalc.cc
r4218 r4286 4 4 ! Author(s): Ester Aliu, 2/2004 <aliu@ifae.es> 5 5 ! 6 ! Last Update: 5/20046 ! Last Update: 6/2004 7 7 ! 8 8 \* ======================================================================== */ … … 124 124 Int_t MIslandCalc::Process() 125 125 { 126 126 127 if (fIslandAlgorithm == 1) 128 Calc1(); 129 130 if (fIslandAlgorithm == 2) 131 Calc2(); 132 return kTRUE; 133 134 } 135 136 137 Int_t MIslandCalc::Calc1(){ 138 139 140 ///////////////////////////// 141 // 142 // ALGORITHM # 1 143 // counts the number of algorithms as you can see in 144 // the event display after doing the std image cleaning 145 // 146 ///////////////////////////// 147 127 148 Float_t noise; 128 149 Float_t signal; … … 333 354 fIsl->SetReadyToSave(); 334 355 335 return 1; 336 356 return kTRUE; 337 357 } 338 358 339 359 360 Int_t MIslandCalc::Calc2(){ 361 362 363 ///////////////////////////// 364 // 365 // ALGORITHM # 2 366 // counts the number of islands considering as the same 367 // islands the ones separated for 2 or less pixels 368 // 369 ///////////////////////////// 370 371 Float_t noise; 372 Float_t signal; 373 374 Int_t npix = 577; 375 376 Int_t sflag; 377 Int_t control; 378 379 Int_t nvect = 0; 380 Int_t fIslNum = 0; 381 382 Int_t vect[50][577]; 383 384 Int_t zeros[50]; 385 386 Int_t kk[577]; 387 388 for(Int_t m = 0; m < 50 ; m++) 389 for(Int_t n = 0; n < npix ; n++) 390 vect[m][n] = 0; 391 392 for(Int_t n = 0; n < 50 ; n++) 393 zeros[n] = 0; 394 395 for(Int_t n = 0; n < 577 ; n++) 396 kk[n] = 0; 397 398 MCerPhotPix *pix; 399 400 //1st loop over all pixels 401 MCerPhotEvtIter Next0(fEvt, kFALSE); 402 403 while ((pix=static_cast<MCerPhotPix*>(Next0()))) 404 { 405 const Int_t idx = pix->GetPixId(); 406 407 const MGeomPix &gpix = (*fCam)[idx]; 408 const Int_t nnmax = gpix.GetNumNeighbors(); 409 410 if( fEvt->IsPixelUsed(idx)) 411 { 412 kk[idx] = 1 ; 413 for(Int_t j=0; j< nnmax; j++) 414 { 415 kk[gpix.GetNeighbor(j)] = 1; 416 } 417 } 418 419 } 420 421 //2nd loop over all pixels 422 MCerPhotEvtIter Next(fEvt, kFALSE); 423 424 while ((pix=static_cast<MCerPhotPix*>(Next()))) 425 { 426 const Int_t idx = pix->GetPixId(); 427 428 const MGeomPix &gpix = (*fCam)[idx]; 429 const Int_t nnmax = gpix.GetNumNeighbors(); 430 431 if ( kk[idx] > 0) 432 { 433 sflag = 0; 434 435 for(Int_t j=0; j < nnmax ; j++) 436 { 437 const Int_t idx2 = gpix.GetNeighbor(j); 438 439 if (idx2 < idx) 440 { 441 for(Int_t k = 1; k <= nvect; k++) 442 { 443 if (vect[k][idx2] == 1) 444 { 445 sflag = 1; 446 vect[k][idx] = 1; 447 } 448 } 449 } 450 } 451 452 if (sflag == 0) 453 { 454 nvect++; 455 vect[nvect][idx] = 1; 456 } 457 458 } 459 } 460 461 fIslNum = nvect; 462 463 464 // Repeated Chain Corrections 465 466 for(Int_t i = 1; i <= nvect; i++) 467 { 468 for(Int_t j = i+1; j <= nvect; j++) 469 { 470 control = 0; 471 for(Int_t k = 0; k < npix; k++) 472 { 473 474 if (vect[i][k] == 1 && vect[j][k] == 1) 475 { 476 control = 1; 477 break; 478 } 479 } 480 if (control == 1) 481 { 482 for(Int_t k = 0; k < npix; k++) 483 { 484 if(vect[j][k] == 1) 485 vect[i][k] = 1; 486 vect[j][k] = 0; 487 zeros[j] = 1; 488 } 489 fIslNum = fIslNum-1; 490 } 491 492 } 493 } 494 495 496 Int_t l = 1; 497 498 for(Int_t i = 1; i<= nvect ; i++) 499 { 500 if (zeros[i] == 0) 501 { 502 for(Int_t k = 0; k<npix; k++) 503 { 504 vect[l][k] = vect[i][k]; 505 } 506 l++; 507 } 508 } 509 510 511 //set the number of islands in one event 512 fIsl->SetIslNum(fIslNum); 513 514 //examine each island... 515 Int_t fPixNum[fIslNum]; 516 Float_t fSigToNoise[fIslNum]; 517 Float_t time[577]; 518 Float_t timeVariance[fIslNum]; 519 520 //reset the "sets" functions 521 if (fIslNum <1) 522 fIsl->SetIslNum(0); 523 524 for(Int_t i = 0; i<20 ;i++) 525 { 526 fIsl->SetPixNum(i,-1); 527 fIsl->SetSigToNoise(i,-1); 528 fIsl->SetTimeSpread(i,-1); 529 530 for(Int_t idx = 0; idx<npix; idx++) 531 { 532 fIsl->SetIslId(idx, -1); 533 fIsl->SetArrivalTime(i, idx, -1 ); 534 } 535 } 536 537 538 for(Int_t i = 1; i<=fIslNum ; i++) 539 { 540 Int_t n = 0; 541 Int_t ncore = 0; 542 543 Float_t MIN = 10000; 544 Float_t MAX = 0; 545 546 signal = 0; 547 noise = 0; 548 fPixNum[i-1] = 0; 549 timeVariance[i-1] = 0; 550 551 for(Int_t idx=0 ; idx<npix ; idx++) 552 { 553 554 MCerPhotPix *pix = fEvt->GetPixById(idx); 555 const MPedestalPix &ped = (*fPed)[idx]; 556 const MArrivalTimePix &timepix = (*fTime)[idx]; 557 558 if (pix == NULL) break; 559 560 if (vect[i][idx] ==1 && fEvt->IsPixelUsed(idx)){ 561 562 fPixNum[i-1]++; 563 signal += pix->GetNumPhotons() * (fCam->GetPixRatio(idx)); 564 noise += pow(ped.GetPedestalRms(),2); 565 566 time[n] = timepix.IsLoGainUsed() ? timepix.GetArrivalTimeLoGain() : timepix.GetArrivalTimeHiGain(); 567 568 569 if (fEvt->IsPixelCore(idx)){ 570 571 if (time[n] > MAX) 572 MAX = time[n]; 573 if (time[n] < MIN) 574 MIN = time[n]; 575 576 ncore++; 577 } 578 579 fIsl->SetIslId(idx, i-1); 580 fIsl->SetArrivalTime(i-1, idx, time[n]); 581 582 n++; 583 } 584 585 } 586 587 // Float_t mean = timeVariance[i-1]/ncore; 588 589 timeVariance[i-1] = 0; 590 591 timeVariance[i-1] = (MAX - MIN)/ncore; 592 timeVariance[i-1] = (MAX - MIN)/ncore; 593 594 fSigToNoise[i-1]= (Float_t)signal/(Float_t)sqrt(noise); 595 596 fIsl->SetPixNum(i-1,fPixNum[i-1]); 597 fIsl->SetSigToNoise(i-1,fSigToNoise[i-1]); 598 fIsl->SetTimeSpread(i-1, timeVariance[i-1]); 599 600 } 601 602 fIsl->SetReadyToSave(); 603 604 return 1; 605 } -
trunk/MagicSoft/Mars/mtemp/mifae/library/MIslandCalc.h
r3976 r4286 31 31 32 32 TString fIslName; // name of the 'MIslands' container 33 33 34 Int_t fIslandAlgorithm; 35 34 36 Int_t PreProcess(MParList *plist); 35 37 Int_t Process(); 38 Int_t Calc1(); // algorithm of counting islands #1 39 Int_t Calc2(); // algorithm of counting islands #2 36 40 37 41 public: … … 39 43 void SetOutputName(TString outname) { fIslName = outname; } 40 44 45 void SetAlgorithm(Int_t m) {fIslandAlgorithm = m;} 46 41 47 ClassDef(MIslandCalc, 0) // task doing the image cleaning 42 48 }; -
trunk/MagicSoft/Mars/mtemp/mifae/programs/makeHillas.cc
r4225 r4286 65 65 66 66 // initial and final time slices to be used in signal extraction 67 const Byte_t hifirst = 0;68 const Byte_t hilast = 1 3;67 const Byte_t hifirst = 1; 68 const Byte_t hilast = 14; 69 69 const Byte_t lofirst = 3; 70 const Byte_t lolast = 1 2;70 const Byte_t lolast = 14; 71 71 72 72 // declaration of variables read from datacards … … 86 86 Float_t lnew = 40; 87 87 Int_t kmethod = 1; 88 Int_t kalgorithm = 1; 88 89 Int_t nfiles = 0; 89 90 … … 238 239 isl2.SetName("MIslands2"); 239 240 240 if (islflag == 1 || islflag == 2) 241 MIslands isl3; 242 isl3.SetName("MIslands3"); 243 244 if (islflag == 1 || islflag == 2 || islflag == 3) 241 245 { 242 246 plist4.AddToList(&timecam); … … 247 251 { 248 252 plist4.AddToList(&isl2); 253 } 254 255 if (islflag == 3) 256 { 257 plist4.AddToList(&isl3); 249 258 } 250 259 … … 276 285 MIslandCalc island; 277 286 island.SetOutputName("MIslands1"); 287 island.SetAlgorithm(kalgorithm); 278 288 279 289 MBadPixelsTreat interpolatebadpixels; … … 286 296 MIslandCalc island2; 287 297 island2.SetOutputName("MIslands2"); 298 island2.SetAlgorithm(kalgorithm); 299 300 MIslandCalc island3; 301 island3.SetOutputName("MIslands3"); 288 302 289 303 … … 307 321 write->AddContainer("MSrcPosCam" , "Parameters"); 308 322 309 if (islflag == 1 || islflag == 2 )323 if (islflag == 1 || islflag == 2 || islflag == 3) 310 324 write->AddContainer("MIslands1" , "Parameters"); 311 325 if (islflag == 2) 312 326 write->AddContainer("MIslands2" , "Parameters"); 327 if (islflag == 3) 328 write->AddContainer("MIslands3" , "Parameters"); 329 313 330 314 331 if(display) … … 319 336 if (islflag == 2) 320 337 disphillas->SetIslandsName("MIslands2"); 338 if (islflag == 3) 339 disphillas->SetIslandsName("MIslands3"); 321 340 } 322 341 … … 329 348 tlist4.AddToList(&clean); 330 349 331 if (islflag == 1 || islflag == 2 )350 if (islflag == 1 || islflag == 2 || islflag == 3) 332 351 { 333 352 tlist4.AddToList(&timecalc); … … 340 359 tlist4.AddToList(&island2); 341 360 } 342 361 362 if (islflag == 3) 363 { 364 tlist4.AddToList(&islclean); 365 tlist4.AddToList(&island3); 366 } 367 368 343 369 //tlist4.AddToList(&blind2); 344 370 tlist4.AddToList(&hcalc); … … 475 501 { 476 502 ifun >> islflag; 503 504 // if (islflag == 1 || islflag == 2) 505 ifun >> kalgorithm; 477 506 } 478 507 … … 522 551 cout << "Cleaning level: ("<<lcore<<","<<ltail<<")" << endl; 523 552 if (islflag == 1 || islflag == 2) 524 cout << "Island calcultation..." << endl;553 cout << "Island calcultation..." << "using algorithm #" << kalgorithm <<endl; 525 554 if (islflag == 2) 526 555 {
Note:
See TracChangeset
for help on using the changeset viewer.