Changeset 2339 for trunk/MagicSoft/Simulation/Detector/include-MFadc
- Timestamp:
- 09/15/03 11:53:33 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx
r2290 r2339 18 18 #include "MGFadcSignal.hxx" 19 19 20 MFadc::MFadc( Float_t ampl, Float_t fwhm, Float_t amplout, Float_t fwhmout) {20 MFadc::MFadc(Int_t pix, Float_t ampl, Float_t fwhm, Float_t amplout, Float_t fwhmout) { 21 21 // 22 22 // Constructor overloaded II … … 31 31 // this parameters of the trigger may be changed 32 32 // 3. Then the all signals are set to zero 33 numpix=pix; 33 34 34 35 fwhm_resp = fwhm; … … 136 137 // if this is the first use, reset all signal for that pixels 137 138 // 138 if ( iPix > CAMERA_PIXELS) {139 if ( iPix > numpix ) { 139 140 cout << " WARNING: MFadc::Fill() : iPix greater than CAMERA_PIXELS" 140 141 << endl ; … … 201 202 // if this is the first use, reset all signal for that pixels 202 203 // 203 if ( iPix > CAMERA_PIXELS) {204 if ( iPix > numpix ) { 204 205 cout << " WARNING: MFadc::FillOuter() : iPix greater than CAMERA_PIXELS" 205 206 << endl ; … … 264 265 // if this is the first use, reset all signal for that pixels 265 266 // 266 if ( iPix > CAMERA_PIXELS) {267 if ( iPix > numpix ) { 267 268 cout << " WARNING: MFadc::Fill() : iPix greater than CAMERA_PIXELS" 268 269 << endl ; … … 298 299 // if this is the first use, reset all signal for that pixels 299 300 // 300 if ( iPix > CAMERA_PIXELS) {301 if ( iPix > numpix ) { 301 302 cout << " WARNING: MFadc::Fill() : iPix greater than CAMERA_PIXELS" 302 303 << endl ; … … 323 324 Int_t i; 324 325 325 for(i=0;i< CAMERA_PIXELS;i++){326 for(i=0;i<numpix;i++){ 326 327 pedestal[i]= (Float_t)(ped* GenElec->Rndm()); 327 328 } 328 329 } 329 330 330 void MFadc::SetPedestals( Float_t ped[CAMERA_PIXELS]) {331 void MFadc::SetPedestals( Float_t *ped) { 331 332 // It sets pedestal for each pixel from ped array 332 333 333 334 Int_t i; 334 335 335 for(i=0;i< CAMERA_PIXELS;i++){336 for(i=0;i<numpix;i++){ 336 337 pedestal[i]= ped[i]; 337 338 } … … 346 347 Float_t baseline; 347 348 348 for(j=0;j< CAMERA_PIXELS;j++){349 for(j=0;j<numpix;j++){ 349 350 baseline=0.0; 350 351 for(i=0;i<(Int_t) SLICES_MFADC;i++){ … … 367 368 Int_t i, j; 368 369 369 for(i=0;i< CAMERA_PIXELS;i++)370 for(i=0;i<numpix;i++) 370 371 for(j=0;j<(Int_t)SLICES_MFADC;j++) 371 372 sig[i][j]+=pedestal[i]; … … 388 389 // It does not exist, so all pixels will have the same offset 389 390 390 for(i=0;i< CAMERA_PIXELS;i++){391 for(i=0;i<numpix;i++){ 391 392 if (used[i]){ 392 393 fdum=(10*GenOff->Rndm()); … … 411 412 // It does not exist, so all pixels will have the same offset 412 413 413 for(i=0;i< CAMERA_PIXELS;i++){414 for(i=0;i<numpix;i++){ 414 415 if (used[i]){ 415 416 for(j=0;j<(Int_t) SLICES_MFADC;j++) … … 433 434 UInt_t i; 434 435 435 cout<<"MFadc::SetElecNoise ... generating database for electroni noise."436 cout<<"MFadc::SetElecNoise ... generating database for electronic noise." 436 437 <<endl; 437 438 438 for (i=0;i< CAMERA_PIXELS*(Int_t) SLICES_MFADC*101;i++){439 for (i=0;i<UInt_t(SLICES_MFADC*1001);i++){ 439 440 noise[i]=GenElec->Gaus(0., value ); 440 441 } … … 452 453 UInt_t startslice; 453 454 454 startslice=GenElec->Integer(CAMERA_PIXELS*(Int_t) SLICES_MFADC*100); 455 456 for ( Int_t i = 0 ; i < CAMERA_PIXELS; i++) { 455 for ( Int_t i = 0 ; i < numpix; i++) { 457 456 // 458 457 // but at the beginning we must check if this pixel is 459 458 // hitted the first time 460 459 // 460 461 startslice=GenElec->Integer((Int_t) SLICES_MFADC*1000); 462 461 463 if ( used[i] == FALSE ) { 462 464 used [i] = TRUE ; 463 465 464 memcpy( (Float_t*)&sig[0][0],465 (Float_t*)&noise[startslice +i*(Int_t) SLICES_MFADC],466 memcpy( (Float_t*)&sig[i][0], 467 (Float_t*)&noise[startslice], 466 468 (Int_t) SLICES_MFADC*sizeof(Float_t)); 467 469 468 470 } 469 471 // … … 473 475 for ( Int_t is=0 ; is< (Int_t)SLICES_MFADC ; is++ ) { 474 476 475 sig[i][is] += noise[startslice+i *(Int_t) SLICES_MFADC+is] ;477 sig[i][is] += noise[startslice+is] ; 476 478 477 479 } 478 479 480 } 480 481 } … … 485 486 486 487 487 for ( Int_t ip=0; ip< CAMERA_PIXELS; ip++ ) {488 for ( Int_t ip=0; ip<numpix; ip++ ) { 488 489 489 490 if ( used[ip] == kTRUE ) { … … 531 532 iFirstSlice = (Int_t) ( t / WIDTH_FADC_TIMESLICE ) ; 532 533 533 for ( Int_t ip=0; ip< CAMERA_PIXELS; ip++ ) {534 for ( Int_t ip=0; ip<numpix; ip++ ) { 534 535 535 536 if ( used[ip] == kTRUE ) { … … 563 564 // puts the pedestal values into the array offset 564 565 565 for ( Int_t i=0; i< CAMERA_PIXELS; i++ ) {566 for ( Int_t i=0; i< numpix; i++ ) { 566 567 567 568 offset[i] = pedestal[i] ; … … 593 594 iFirstSlice = (Int_t) ( t / WIDTH_FADC_TIMESLICE ) ; 594 595 595 for ( Int_t ip=0; ip< CAMERA_PIXELS; ip++ ) {596 for ( Int_t ip=0; ip<numpix; ip++ ) { 596 597 597 598 if ( used[ip] == kTRUE ) { … … 600 601 if (is< (Int_t)SLICES_MFADC && sig[ip][is]>0.0) 601 602 { 602 output[ip][i++]=(sig[ip][is] > 255. ? 255 :(UChar_t) (sig[ip][is]+0.5)); 603 output_lowgain[ip][i++]= 604 (Int_t)(pedestal[ip]+(sig[ip][is]-pedestal[ip])/HIGH2LOWGAIN) > 255. ? 255 : 605 (UChar_t)(pedestal[ip]+(sig[ip][is]-pedestal[ip])/HIGH2LOWGAIN); 606 603 output[ip][i]=(sig[ip][is] > 255. ? 255 :(UChar_t) (sig[ip][is]+0.5)); 604 output_lowgain[ip][i]= 605 (Int_t)(pedestal[ip]+(sig[ip][is]-pedestal[ip])/HIGH2LOWGAIN) > 255. ? 255 : 606 (UChar_t)(pedestal[ip]+(sig[ip][is]-pedestal[ip])/HIGH2LOWGAIN); 607 i++; 608 } 609 else if(sig[ip][is]>0.0) 610 { 611 output[ip][i]= (UChar_t)(pedestal[ip]+0.5); 612 output_lowgain[ip][i]= (UChar_t)(pedestal[ip]+0.5); 613 i++; 607 614 } 608 615 else 609 616 { 610 617 output[ip][i]= 0; 611 output_lowgain[ip][i++]= 0; 618 output_lowgain[ip][i]= 0; 619 i++; 612 620 } 613 621 } … … 643 651 644 652 Int_t ic = 0 ; 645 for ( Int_t i=0 ; i < CAMERA_PIXELS; i++ ) {653 for ( Int_t i=0 ; i < numpix; i++ ) { 646 654 if ( used [i] == TRUE ) { 647 655 … … 706 714 return (output_lowgain[pixel][slice]); 707 715 } 708 709 710
Note:
See TracChangeset
for help on using the changeset viewer.