Changeset 410
- Timestamp:
- 07/04/00 15:16:24 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/include-MTrigger/MTrigger.cxx
r392 r410 293 293 294 294 for ( i = 0 ; i < 5 ; i++) { 295 SlicesFirst[i] = -50.0 ; 296 SlicesSecond[i] = -50.0 ; 295 SlicesFirst[i] = -50 ; 296 SlicesSecond[i] = -50 ; 297 PixelsFirst[i] = -1; 298 PixelsSecond[i] = -1; 299 } 300 cout << " end of MTrigger::MTrigger()" << endl ; 301 } 302 303 MTrigger::MTrigger(float gate, float ampl, float fwhm) { 304 // ============================================================ 305 // 306 // constructor 307 // 308 // The procedure is the following: 309 // 310 // 1. Allocation of some memory needed 311 // 2. some parameters of the trigger are set. 312 // 3. Then the all signals are set to zero 313 314 Int_t i, ii ; 315 316 Float_t threshold ; 317 318 // 319 // allocate the memory for the 2dim arrays (a_sig, d_sig ) 320 // 321 322 for( Int_t j=0; j<TRIGGER_PIXELS; j++ ) { 323 324 a_sig[j] = new Float_t[TRIGGER_TIME_SLICES] ; 325 326 d_sig[j] = new Float_t[TRIGGER_TIME_SLICES] ; 327 } 328 329 // 330 // set the values for the standard response pulse 331 // 332 333 fwhm_resp = fwhm ; 334 ampl_resp = ampl ; 335 336 threshold = CHANNEL_THRESHOLD ; 337 338 339 gate_leng = gate ; 340 trigger_multi = TRIGGER_MULTI ; 341 trigger_geometry = TRIGGER_GEOM ; 342 343 cout << endl 344 << "[MTrigger] Setting up the MTrigger with this values "<< endl ; 345 cout << "[MTrigger] Gate Length: " << gate_leng << " ns" 346 << endl ; 347 cout << "[MTrigger] Response FWHM: " << fwhm_resp << " ns" 348 << endl ; 349 cout << "[MTrigger] Response Amplitude: " << ampl_resp << " mV" 350 << endl ; 351 cout << endl ; 352 353 354 for (Int_t k=0; k<TRIGGER_PIXELS; k++ ) { 355 chan_thres[k] = threshold ; 356 } 357 358 359 // 360 // set up the response shape 361 // 362 363 Float_t sigma ; 364 Float_t x, x0 ; 365 366 sigma = fwhm_resp / 2.35 ; 367 x0 = 3*sigma ; 368 369 for (i=0; i< RESPONSE_SLICES ; i++ ) { 370 371 x = i * (1./((Float_t)SLICES_PER_NSEC)) 372 + (1./( 2 * (Float_t)SLICES_PER_NSEC )) ; 373 374 sing_resp[i] = 375 ampl_resp * expf(-0.5 * (x-x0)*(x-x0) / (sigma*sigma) ) ; 376 377 } 378 379 // 380 // look for the time between start of response function and the 381 // maximum value of the response function. This is needed by the 382 // member functions FillNSB() and FillStar() 383 // 384 385 Int_t imax = 0 ; 386 Float_t max = 0. ; 387 for (i=0; i< RESPONSE_SLICES ; i++ ) { 388 if ( sing_resp[i] > max ) { 389 imax = i ; 390 max = sing_resp[i] ; 391 } 392 } 393 394 peak_time = ( (Float_t) imax ) / ( (Float_t) SLICES_PER_NSEC ) ; 395 396 397 // 398 // the amplitude of one single photo electron is not a constant. 399 // There exists a measured distribution from Razmik. This distribution 400 // is used to simulate the noise of the amplitude. 401 // For this a histogramm (histPmt) is created and filled with the 402 // values. 403 // 404 405 histPmt = new TH1F ("histPmt","Noise of PMT", 40, 0., 40.) ; 406 407 Stat_t ValRazmik[41] = { 0., 2.14, 2.06, 2.05, 2.05, 2.06, 2.07, 2.08, 2.15, 408 2.27, 2.40, 2.48, 2.55, 2.50, 2.35, 2.20, 2.10, 409 1.90, 1.65, 1.40, 1.25, 1.00, 0.80, 0.65, 0.50, 410 0.35, 0.27, 0.20, 0.18, 0.16, 0.14, 0.12, 0.10, 411 0.08, 0.06, 0.04, 0.02, 0.01, 0.005,0.003, 0.001} ; 412 413 histMean = histPmt->GetMean() ; 414 415 histPmt->SetContent( ValRazmik) ; 416 417 histMean = histPmt->GetMean() ; 418 419 // 420 // create the random generator for the Electronic Noise 421 // 422 423 GenElec = new TRandom() ; 424 425 // 426 // Read in the lookup table for NN trigger 427 // 428 429 FILE *unit ; 430 int id ; 431 432 i = 0 ; 433 434 if ( (unit = fopen("../include-MTrigger/TABLE_NEXT_NEIGHBOUR", "r" )) == 0 ) { 435 cout << "ERROR: not able to read ../include-MTrigger/TABLE_NEXT_NEIGHBOUR" 436 << endl ; 437 exit(123) ; 438 } 439 else { 440 while ( i < TRIGGER_PIXELS ) 441 { 442 fscanf ( unit, " %d", &id ) ; 443 444 for ( Int_t k=0; k<6; k++ ) { 445 fscanf ( unit, "%d ", &NN[i][k] ) ; 446 } 447 i++ ; 448 } 449 450 fclose (unit) ; 451 } 452 453 454 // 455 // 456 // set all the booleans used to FALSE, indicating that the pixel is not 457 // used in this event. 458 // 459 460 for ( i =0 ; i <TRIGGER_PIXELS ; i++ ) { 461 used [i] = FALSE ; 462 dknt [i] = FALSE ; 463 464 nphotshow[i] = 0 ; 465 nphotnsb [i] = 0 ; 466 nphotstar[i] = 0 ; 467 468 baseline[i] = 0 ; 469 } 470 471 for ( ii=0 ; ii<TRIGGER_TIME_SLICES; ii++ ) { 472 sum_d_sig[ii] = 0. ; 473 } 474 475 // 476 // set the information about the Different Level Triggers to zero 477 // 478 479 nZero = nFirst = nSecond = 0 ; 480 481 for (ii=0 ; ii<TRIGGER_TIME_SLICES; ii++ ) { 482 SlicesZero[ii] = FALSE; 483 } 484 485 for ( i = 0 ; i < 5 ; i++) { 486 SlicesFirst[i] = -50 ; 487 SlicesSecond[i] = -50 ; 297 488 PixelsFirst[i] = -1; 298 489 PixelsSecond[i] = -1; … … 361 552 362 553 for ( i = 0 ; i < 5 ; i++) { 363 SlicesFirst[i] = -50 .0;554 SlicesFirst[i] = -50 ; 364 555 PixelsFirst[i] = -1; 365 556 }
Note:
See TracChangeset
for help on using the changeset viewer.