Changeset 392 for trunk/MagicSoft/Simulation
- Timestamp:
- 05/11/00 15:35:54 (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/include-MTrigger/MTrigger.cxx
r375 r392 28 28 FILE *unit_mtrig ; 29 29 Int_t endflag = 1 ; 30 Int_t bthresholdpixel = FALSE; 30 31 char datac[256] ; 31 32 char dummy[50] ; 32 33 char input_thres[50]; 34 Int_t i, ii ; 35 33 36 Float_t threshold ; 34 37 … … 93 96 sscanf (datac, "%s %i", dummy, &trigger_geometry ) ; 94 97 } 98 else if ( strncmp (datac, "threshold_file", 14 ) == 0 ) { 99 sscanf (datac, "%s %s", dummy, input_thres ) ; 100 bthresholdpixel=TRUE; 101 } 95 102 96 103 if ( feof(unit_mtrig) != 0 ) { … … 108 115 cout << endl 109 116 << "[MTrigger] Setting up the MTrigger with this values "<< endl ; 110 cout << endl 111 << "[MTrigger] ChannelThreshold: " << threshold << " mV" 112 << endl ; 113 117 if(bthresholdpixel){ 118 cout<<endl 119 << "[MTrigger] ChannelThreshold from file: "<<input_thres 120 <<endl; 121 } 122 else{ 123 cout << endl 124 << "[MTrigger] ChannelThreshold: " << threshold << " mV" 125 << endl ; 126 } 114 127 cout << "[MTrigger] Gate Length: " << gate_leng << " ns" 115 128 << endl ; … … 129 142 // we have introduced individual thresholds for all pixels 130 143 // 131 for (Int_t k=0; k<TRIGGER_PIXELS; k++ ) { 132 chan_thres[k] = threshold ; 133 } 144 FILE *unit_thres; 145 146 if (bthresholdpixel == TRUE) { 147 if ((unit_thres=fopen(input_thres, "r"))==0){ 148 cout<<"WARNING: not able to read ..."<<input_thres<<endl; 149 cout<<"Threshold will be set to "<<threshold<<" for all pixels"<<endl; 150 for (Int_t k=0; k<TRIGGER_PIXELS; k++ ) { 151 chan_thres[k] = threshold ; 152 } 153 } 154 else { 155 for (i=0;i<TRIGGER_PIXELS;i++){ 156 fscanf(unit_thres, "%f",&chan_thres[i]); 157 } 158 fclose (unit_thres); 159 } 160 } 161 else { 162 for (Int_t k=0; k<TRIGGER_PIXELS; k++ ) { 163 chan_thres[k] = threshold ; 164 } 165 } 166 134 167 135 168 // 136 169 // set up the response shape 137 170 // 138 Int_t i, ii ;139 171 140 172 Float_t sigma ; … … 151 183 sing_resp[i] = 152 184 ampl_resp * expf(-0.5 * (x-x0)*(x-x0) / (sigma*sigma) ) ; 153 154 // cout << i << " "155 // << x << " "156 // << sing_resp[i]157 // << endl ;158 159 185 160 186 } … … 267 293 268 294 for ( i = 0 ; i < 5 ; i++) { 269 SlicesFirst[i] = 0 ; 270 SlicesSecond[i] = 0 ; 295 SlicesFirst[i] = -50.0 ; 296 SlicesSecond[i] = -50.0 ; 297 PixelsFirst[i] = -1; 298 PixelsSecond[i] = -1; 271 299 } 272 300 cout << " end of MTrigger::MTrigger()" << endl ; … … 305 333 for ( ii=0 ; ii<TRIGGER_TIME_SLICES; ii++ ) { 306 334 sum_d_sig[ii] = 0. ; 307 } 308 309 // 310 // set the information about the Different Level Triggers to zero 311 // 312 313 nZero = nFirst = nSecond = 0 ; 335 } 336 } 337 338 void MTrigger::ClearZero() { 339 // 340 // set the information about the Zero Level Trigger to zero 341 // 342 343 Int_t i; 344 345 nZero = 0 ; 346 347 for (i=0 ; i<TRIGGER_TIME_SLICES; i++ ) { 348 SlicesZero[i] = FALSE; 349 } 350 351 } 352 353 void MTrigger::ClearFirst() { 354 // 355 // set the information about the First Level Trigger to zero 356 // 357 358 Int_t i; 359 360 nFirst = 0 ; 314 361 315 362 for ( i = 0 ; i < 5 ; i++) { 316 SlicesZero[i] = 0 ; 317 SlicesFirst[i] = 0 ; 318 SlicesSecond[i] = 0 ; 319 } 320 363 SlicesFirst[i] = -50.0 ; 364 PixelsFirst[i] = -1; 365 } 321 366 } 322 367 … … 496 541 for ( Int_t i=0 ; i < TRIGGER_PIXELS; i++ ) { 497 542 if ( used [i] == TRUE ) { 498 //cout << "Pixel " << i << " used" ;499 543 500 544 for ( Int_t ii=1 ; ii<TRIGGER_TIME_SLICES; ii++ ) { … … 505 549 } 506 550 } 551 } 552 553 void MTrigger::SetMultiplicity(Int_t multi){ 554 //============================================================= 555 // 556 // It sets the private member trigger_multi 557 558 trigger_multi=multi; 559 } 560 561 void MTrigger::SetTopology(Int_t topo){ 562 //============================================================= 563 // 564 // It sets the private member trigger_geometry 565 566 trigger_geometry=topo; 567 } 568 569 void MTrigger::SetThreshold(Float_t thres[]){ 570 //============================================================= 571 // 572 // It sets the private member chan_thres[TRIGGER_PIXELS] 573 574 Int_t i; 575 576 for(i=0;i<TRIGGER_PIXELS;i++){ 577 chan_thres[i]=thres[i]; 578 } 579 } 580 581 void MTrigger::ReadThreshold(char name[]){ 582 //============================================================= 583 // 584 // It reads values for threshold of each pixel from file name 585 586 FILE *unit; 587 Int_t i=0; 588 589 if ((unit=fopen(name, "r"))==0){ 590 cout<<"WARNING: not able to read ..."<<name<<endl; 591 } 592 else { 593 while (i<TRIGGER_PIXELS){ 594 fscanf(unit, "%f",&chan_thres[i++]); 595 } 596 fclose (unit); 597 } 598 507 599 } 508 600 … … 538 630 539 631 baseline[i] = baseline[i] / ( (Float_t ) TRIGGER_TIME_SLICES) ; 540 541 // cout << "Pixel " << i << " baseline " << baseline[i] <<endl ;542 632 543 633 // … … 763 853 764 854 Int_t iReturn = 0 ; // Return value for this function 765 766 if ( nZero > 1 ) { 767 cout << " INFORMATION: more than one Zero Level TRIGGER " << endl ; 768 } 769 855 770 856 // Definition of needed variables 771 857 Bool_t Muster[TRIGGER_PIXELS] ; … … 777 863 778 864 if (trigger_geometry==0 && trigger_multi>7) { 779 cout <<"You are lookin yfor a topology that needs more than six neighbours of the same pixel"<<endl;865 cout <<"You are looking for a topology that needs more than six neighbours of the same pixel"<<endl; 780 866 cout <<" Topology "<<trigger_geometry<<" Multiplicity "<<trigger_multi<<endl;; 781 867 return (kFALSE); … … 822 908 // 823 909 if ( d_sig [iPix][iSli] > 0. ) { 824 825 910 Muster[iPix] = kTRUE ; 826 911 } … … 871 956 // A NN-Trigger is detected at time Slice 872 957 // 958 PixelsFirst[nFirst] = j; // We save pixel that triggers 873 959 SlicesFirst[nFirst++] = iSli ; // We save time when it triggers 874 960 iReturn++ ; … … 899 985 // A NN-Trigger is detected at time Slice 900 986 // 987 PixelsFirst[nFirst] = j; // We save pixel that triggers 901 988 SlicesFirst[nFirst++] = iSli ; // We save when it triggers 902 989 iReturn++ ; … … 976 1063 } 977 1064 if (closed_pack){ 1065 PixelsFirst[nFirst] = j; // We save pixel that triggers 978 1066 SlicesFirst[nFirst++] = iSli ; // We save time when it triggers 979 1067 iReturn++ ; … … 1063 1151 return(return_val); 1064 1152 } 1153 1154 Float_t MTrigger::GetFirstLevelTime( Int_t il ){ 1155 1156 //============================================================= 1157 // 1158 // It gives the time for the il trigger at first level 1159 1160 return((Float_t) ((Float_t) SlicesFirst[il]/((Float_t) SLICES_PER_NSEC))); 1161 } 1162 1163 Int_t MTrigger::GetFirstLevelPixel( Int_t il ){ 1164 1165 //============================================================= 1166 // 1167 // It gives the pixel that triggers for the il trigger at first level 1168 return(PixelsFirst[il]); 1169 }
Note:
See TracChangeset
for help on using the changeset viewer.