Changeset 4418 for trunk/MagicSoft/Mars/mtemp
- Timestamp:
- 07/22/04 19:30:31 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mtemp/mifae
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/Changelog
r4413 r4418 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 22 2004/07/22 Ester Aliu 23 * library/MIslands.[h,cc],MIslandCalc.cc 24 - Add meanX, meanY and dist of each of the islands 25 - Now the island with id 0 is the larger one 20 26 21 27 2004/07/21 Javier Rico -
trunk/MagicSoft/Mars/mtemp/mifae/library/MIslandCalc.cc
r4286 r4418 17 17 // - fIslNum // number of islands 18 18 // - fIslId[577] // island Id 19 // - fPixNum[20] ;// number of pixels in the island20 // - fSigToNoise[20] ;// signal to noise of the island19 // - fPixNum[20] // number of pixels in the island 20 // - fSigToNoise[20] // signal to noise of the island 21 21 // - fTime[20][577] // mean of the arrival time 22 // - fTimeSpread[20]; // mean arrival time spread of the island 23 // 22 // - fTimeSpread[20] // mean arrival time spread of the island 23 // - fMeanX[20] // mean X position of the island 24 // - fMeanY[20] // mean Y position of the island 25 // - fDist[20] // dist between an island and the continent 24 26 // 25 27 // Input Containers: … … 141 143 // 142 144 // ALGORITHM # 1 143 // counts the number of algorithms as you can see in145 // counts the number of islands as you can see in 144 146 // the event display after doing the std image cleaning 145 147 // … … 215 217 216 218 // Repeated Chain Corrections 219 217 220 218 221 for(Int_t i = 1; i <= nvect; i++) … … 223 226 for(Int_t k = 0; k < npix; k++) 224 227 { 225 226 228 if (vect[i][k] == 1 && vect[j][k] == 1) 227 229 { … … 246 248 247 249 250 248 251 Int_t l = 1; 249 252 Int_t numpixels; 253 Int_t pixMAX = 0; 254 Int_t idMAX = 1; 255 250 256 for(Int_t i = 1; i<= nvect ; i++) 251 257 { 258 numpixels = 0; 259 252 260 if (zeros[i] == 0) 253 261 { … … 255 263 { 256 264 vect[l][k] = vect[i][k]; 265 if (vect[l][k] == 1) 266 numpixels++; 267 } 268 if (numpixels>pixMAX) 269 { 270 pixMAX = numpixels; 271 idMAX = l; 257 272 } 258 273 l++; … … 260 275 } 261 276 262 277 //the larger island will correspond to the 1st component of the vector 278 279 for(Int_t k = 0; k<npix; k++) 280 { 281 vect[nvect+1][k] = vect[1][k]; 282 vect[1][k] = vect[idMAX][k]; 283 vect[idMAX][k] = vect[nvect+1][k]; 284 } 285 286 263 287 //set the number of islands in one event 264 288 fIsl->SetIslNum(fIslNum); … … 269 293 Float_t time[577]; 270 294 Float_t timeVariance[fIslNum]; 271 295 Float_t size, meanX, meanY, dist; 296 272 297 //reset the "sets" functions 273 298 if (fIslNum <1) … … 287 312 } 288 313 314 315 Float_t X = 0; 316 Float_t Y = 0; 289 317 290 318 for(Int_t i = 1; i<=fIslNum ; i++) … … 298 326 signal = 0; 299 327 noise = 0; 328 329 size = 0; 330 meanX = 0; 331 meanY = 0; 332 dist = 0; 333 300 334 fPixNum[i-1] = 0; 301 335 timeVariance[i-1] = 0; … … 305 339 306 340 MCerPhotPix *pix = fEvt->GetPixById(idx); 341 const MGeomPix &gpix2 = (*fCam)[pix->GetPixId()]; 307 342 const MPedestalPix &ped = (*fPed)[idx]; 308 343 const MArrivalTimePix &timepix = (*fTime)[idx]; 344 const Float_t nphot = pix->GetNumPhotons(); 309 345 310 346 if (pix == NULL) break; … … 313 349 314 350 fPixNum[i-1]++; 315 signal += pix->GetNumPhotons()* (fCam->GetPixRatio(idx));351 signal += nphot * (fCam->GetPixRatio(idx)); 316 352 noise += pow(ped.GetPedestalRms(),2); 353 354 size += nphot; 355 meanX += nphot * gpix2.GetX(); 356 meanY += nphot * gpix2.GetY(); 317 357 318 358 time[n] = timepix.IsLoGainUsed() ? timepix.GetArrivalTimeLoGain() : timepix.GetArrivalTimeHiGain(); … … 337 377 } 338 378 339 // Float_t mean = timeVariance[i-1]/ncore; 340 341 timeVariance[i-1] = 0; 342 343 timeVariance[i-1] = (MAX - MIN)/ncore; 344 timeVariance[i-1] = (MAX - MIN)/ncore; 379 meanX /= size; 380 meanY /= size; 381 382 if (i ==1){ 383 X = meanX; 384 Y = meanY; 385 } 386 387 dist = TMath::Power(meanX-X,2) + TMath::Power(meanY-Y,2); 388 dist = TMath::Sqrt(dist); 389 390 timeVariance[i-1] = (MAX - MIN); 345 391 346 392 fSigToNoise[i-1]= (Float_t)signal/(Float_t)sqrt(noise); … … 349 395 fIsl->SetSigToNoise(i-1,fSigToNoise[i-1]); 350 396 fIsl->SetTimeSpread(i-1, timeVariance[i-1]); 351 352 } 397 fIsl->SetMeanX(i-1, meanX); 398 fIsl->SetMeanY(i-1, meanY); 399 fIsl->SetDist(i-1, dist); 400 401 } 353 402 354 403 fIsl->SetReadyToSave(); … … 493 542 } 494 543 495 544 496 545 Int_t l = 1; 497 546 Int_t numpixels; 547 Int_t pixMAX = 0; 548 Int_t idMAX = 1; 549 498 550 for(Int_t i = 1; i<= nvect ; i++) 499 551 { 552 numpixels = 0; 553 500 554 if (zeros[i] == 0) 501 555 { … … 503 557 { 504 558 vect[l][k] = vect[i][k]; 559 if (vect[l][k] == 1) 560 numpixels++; 561 } 562 if (numpixels>pixMAX) 563 { 564 pixMAX = numpixels; 565 idMAX = l; 505 566 } 506 567 l++; … … 509 570 510 571 572 //the larger island will correspond to the 1st component of the vector 573 574 for(Int_t k = 0; k<npix; k++) 575 { 576 vect[nvect+1][k] = vect[1][k]; 577 vect[1][k] = vect[idMAX][k]; 578 vect[idMAX][k] = vect[nvect+1][k]; 579 } 580 581 511 582 //set the number of islands in one event 512 583 fIsl->SetIslNum(fIslNum); … … 517 588 Float_t time[577]; 518 589 Float_t timeVariance[fIslNum]; 519 590 Float_t size, meanX, meanY, dist; 591 520 592 //reset the "sets" functions 521 593 if (fIslNum <1) … … 535 607 } 536 608 609 610 Float_t X = 0; 611 Float_t Y = 0; 537 612 538 613 for(Int_t i = 1; i<=fIslNum ; i++) … … 546 621 signal = 0; 547 622 noise = 0; 623 624 size = 0; 625 meanX = 0; 626 meanY = 0; 627 dist = 0; 628 548 629 fPixNum[i-1] = 0; 549 630 timeVariance[i-1] = 0; … … 553 634 554 635 MCerPhotPix *pix = fEvt->GetPixById(idx); 636 const MGeomPix &gpix2 = (*fCam)[pix->GetPixId()]; 555 637 const MPedestalPix &ped = (*fPed)[idx]; 556 638 const MArrivalTimePix &timepix = (*fTime)[idx]; 639 const Float_t nphot = pix->GetNumPhotons(); 557 640 558 641 if (pix == NULL) break; 559 642 560 if (vect[i][idx] ==1 && fEvt->IsPixelUsed(idx)){643 if (vect[i][idx]==1){ 561 644 562 645 fPixNum[i-1]++; 563 signal += pix->GetNumPhotons()* (fCam->GetPixRatio(idx));646 signal += nphot * (fCam->GetPixRatio(idx)); 564 647 noise += pow(ped.GetPedestalRms(),2); 648 649 size += nphot; 650 meanX += nphot * gpix2.GetX(); 651 meanY += nphot * gpix2.GetY(); 565 652 566 653 time[n] = timepix.IsLoGainUsed() ? timepix.GetArrivalTimeLoGain() : timepix.GetArrivalTimeHiGain(); … … 585 672 } 586 673 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; 674 meanX /= size; 675 meanY /= size; 676 677 if (i ==1){ 678 X = meanX; 679 Y = meanY; 680 } 681 682 dist = TMath::Power(meanX-X,2) + TMath::Power(meanY-Y,2); 683 dist = TMath::Sqrt(dist); 684 685 timeVariance[i-1] = (MAX - MIN); 593 686 594 687 fSigToNoise[i-1]= (Float_t)signal/(Float_t)sqrt(noise); … … 597 690 fIsl->SetSigToNoise(i-1,fSigToNoise[i-1]); 598 691 fIsl->SetTimeSpread(i-1, timeVariance[i-1]); 599 600 } 601 692 fIsl->SetMeanX(i-1, meanX); 693 fIsl->SetMeanY(i-1, meanY); 694 fIsl->SetDist(i-1, dist); 695 696 } 697 698 602 699 fIsl->SetReadyToSave(); 603 700 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MIslands.cc
r4328 r4418 47 47 *fLog << " + SigToNoise = " << fSigToNoise[i] << endl; 48 48 *fLog << " + TimeSpread = " << fTimeSpread[i] << endl; 49 *fLog << " + MeanX = " << fMeanX[i] << endl; 50 *fLog << " + MeanY = " << fMeanY[i] << endl; 51 *fLog << " + Dist = " << fDist[i] << endl; 49 52 } 50 53 } -
trunk/MagicSoft/Mars/mtemp/mifae/library/MIslands.h
r4218 r4418 25 25 Float_t fTime[20][577]; // mean of the arrival time 26 26 Float_t fTimeSpread[20]; // mean arrival time spread of the island 27 Float_t fMeanX[20]; // mean X position of the island 28 Float_t fMeanY[20]; // mean Y position of the island 29 Float_t fDist[20]; // dist between islands and continent(larger island) 27 30 28 31 public: … … 37 40 Float_t GetSigToNoise(Int_t isl) { return fSigToNoise[isl]; } 38 41 Float_t GetArrivalTime(Int_t isl, Int_t idx) { return fTime[isl][idx]; } 39 Float_t GetTimeSpread(Int_t isl) { return fTimeSpread[isl];} 42 Float_t GetTimeSpread(Int_t isl) { return fTimeSpread[isl];} 43 Float_t GetMeanX(Int_t isl) { return fMeanX[isl];} 44 Float_t GetMeanY(Int_t isl) { return fMeanY[isl];} 45 Float_t GetDist(Int_t isl) { return fDist[isl]; } 40 46 41 47 void SetIslNum(Int_t nisl) { fIslNum = nisl; } … … 46 52 47 53 void SetTimeSpread(Int_t isl, Float_t val) { fTimeSpread[isl] = val; } 48 54 void SetMeanX(Int_t isl, Float_t val) { fMeanX[isl]=val; } 55 void SetMeanY(Int_t isl, Float_t val) { fMeanY[isl]=val; } 56 void SetDist(Int_t isl, Float_t val) { fDist[isl]=val; } 57 58 49 59 ClassDef(MIslands, 1) // Storage Container for Island Parameters 50 60 };
Note:
See TracChangeset
for help on using the changeset viewer.