Changeset 1066 for trunk/MagicSoft
- Timestamp:
- 11/13/01 17:01:06 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx
r692 r1066 1 //////////////////////////////////////////////////////////////// /1 //////////////////////////////////////////////////////////////// 2 2 // 3 3 // MFadc … … 18 18 #include "MGFadcSignal.hxx" 19 19 20 MFadc::MFadc() { 21 // 22 // default constructor 23 // 24 // The procedure is the following: 25 // 1. some parameters of the trigger are set to default. 26 // this parameters of the trigger may be changed 27 // 3. Then the all signals are set to zero 28 29 fwhm_resp = MFADC_RESPONSE_FWHM ; 30 ampl_resp = MFADC_RESPONSE_AMPLITUDE ; 31 32 // 33 // set up the response shape 34 // 35 Int_t i,j ; 36 37 Float_t sigma ; 38 Float_t x, x0 ; 39 40 sigma = fwhm_resp / 2.35 ; 41 x0 = 3*sigma ; 42 43 Float_t dX, dX2 ; 44 45 dX = WIDTH_FADC_TIMESLICE / SUBBINS ; 46 dX2 = dX/2. ; 47 48 for (i=0; i< RESPONSE_SLICES_MFADC ; i++ ) { 49 50 x = i * dX + dX2 ; 51 52 // 53 // the value 0.125 was introduced to normalize the things 54 // 55 sing_resp[i] = 0.125 * 56 ampl_resp * expf(-0.5 * (x-x0)*(x-x0) / (sigma*sigma) ) ; 57 58 } 59 60 // 61 // init the Random Generator for Electonic Noise 62 // 63 64 GenElec = new TRandom () ; 65 66 // 67 // set all the booleans used to FALSE, indicating that the pixel is not 68 // used in this event. 69 // 70 71 for ( i =0 ; i <CAMERA_PIXELS ; i++ ) { 72 used [i] = FALSE ; 73 } 74 75 // 76 // set all pedestals to 0 77 // 78 79 for ( i =0 ; i <CAMERA_PIXELS ; i++ ) { 80 pedestal[i] = 0.0 ; 81 } 82 83 // 84 // set tha values of FADC slices that would be read after trigger to zero 85 // 86 87 for (i=0; i <CAMERA_PIXELS; i++){ 88 for (j=0; j<FADC_SLICES;j++){ 89 output[i][j]=0; 90 } 91 } 92 93 } 94 95 MFadc::MFadc(Float_t ampl, Float_t fwhm) { 20 MFadc::MFadc(Float_t ampl, Float_t fwhm) { 96 21 // 97 22 // Constructor overloaded II … … 108 33 // set up the response shape 109 34 // 110 Int_t i ,j ;35 Int_t i ; 111 36 112 37 Float_t sigma ; … … 139 64 GenElec = new TRandom () ; 140 65 141 // 142 // set all the booleans used to FALSE, indicating that the pixel is not 143 // used in this event. 144 // 145 146 for ( i =0 ; i <CAMERA_PIXELS ; i++ ) { 147 used [i] = FALSE ; 148 } 66 Reset(); 149 67 150 68 // … … 155 73 pedestal[i] = 0.0 ; 156 74 } 157 158 //159 // set tha values of FADC slices that would be read after trigger to zero160 //161 162 for (i=0; i <CAMERA_PIXELS; i++){163 for (j=0; j<FADC_SLICES;j++){164 output[i][j]=0;165 }166 }167 168 75 } 169 76 170 77 void MFadc::Reset() { 171 // 172 // set all values of the signals to zero 173 // 174 Int_t i,j ; 175 176 for ( i =0 ; i <CAMERA_PIXELS ; i++ ) { 177 used [i] = FALSE ; 178 } 179 // 180 // set tha values of FADC slices that would be read after trigger to zero 181 // 182 183 for (i=0; i <CAMERA_PIXELS; i++){ 184 for (j=0; j<FADC_SLICES;j++){ 185 output[i][j]=0; 186 } 187 } 78 // 79 // set all values of the signals to zero 80 // set tha values of FADC slices that would be read after trigger to zero 81 // 82 memset(used, 0, CAMERA_PIXELS*sizeof(Bool_t)); 83 memset(output, 0, CAMERA_PIXELS*FADC_SLICES*sizeof(UChar_t)); 188 84 } 189 85 … … 213 109 used [iPix] = TRUE ; 214 110 215 for (i=0; i < SLICES_MFADC; i++ ) {111 for (i=0; i < (Int_t) SLICES_MFADC; i++ ) { 216 112 sig[iPix][i] = 0. ; 217 113 } … … 240 136 for ( i = 0 ; i<RESPONSE_SLICES; i++ ) { 241 137 ichanfadc = (Int_t) ((ichan+i)/SUBBINS) ; 242 if ( (ichanfadc) < SLICES_MFADC ) {138 if ( (ichanfadc) < (Int_t)SLICES_MFADC ) { 243 139 sig[iPix][ichanfadc] += (amplitude * sing_resp[i] ) ; 244 140 } … … 276 172 used [iPix] = TRUE ; 277 173 278 for (i=0; i < SLICES_MFADC; i++ ) {174 for (i=0; i < (Int_t)SLICES_MFADC; i++ ) { 279 175 sig[iPix][i] = 0. ; 280 176 } 281 177 } 282 for ( i = 0 ; i< SLICES_MFADC; i++ ) {178 for ( i = 0 ; i<(Int_t)SLICES_MFADC; i++ ) { 283 179 sig[iPix][i] = resp[i] ; 284 180 } … … 310 206 used [iPix] = TRUE ; 311 207 312 for (i=0; i < SLICES_MFADC; i++ ) {208 for (i=0; i < (Int_t)SLICES_MFADC; i++ ) { 313 209 sig[iPix][i] = 0. ; 314 210 } 315 211 } 316 for ( i = 0 ; i< SLICES_MFADC; i++ ) {212 for ( i = 0 ; i<(Int_t)SLICES_MFADC; i++ ) { 317 213 sig[iPix][i] += resp[i] ; 318 214 } … … 371 267 372 268 for(i=0;i<CAMERA_PIXELS;i++) 373 for(j=0;j< SLICES_MFADC;j++)269 for(j=0;j<(Int_t)SLICES_MFADC;j++) 374 270 sig[i][j]+=pedestal[i]; 375 271 } … … 429 325 } 430 326 } 327 delete GenOff; 431 328 } 432 329 … … 438 335 for ( Int_t i = 0 ; i < CAMERA_PIXELS; i++) { 439 336 if ( used [i] == TRUE ) { 440 for ( Int_t is=0 ; is< SLICES_MFADC ; is++ ) {337 for ( Int_t is=0 ; is< (Int_t)SLICES_MFADC ; is++ ) { 441 338 442 339 sig[i][is] += GenElec->Gaus(0., 2.) ; … … 458 355 printf ("Pid %3d", ip ) ; 459 356 460 for ( Int_t is=0 ; is < SLICES_MFADC; is++ ) {357 for ( Int_t is=0 ; is < (Int_t)SLICES_MFADC; is++ ) { 461 358 462 359 if ( sig[ip][is] > 0. ) { … … 565 462 i=0; 566 463 for ( Int_t is=iFirstSlice ; is < (iFirstSlice+FADC_SLICES) ; is++ ) { 567 if (is< SLICES_MFADC && sig[ip][is]>0.0)464 if (is< (Int_t)SLICES_MFADC && sig[ip][is]>0.0) 568 465 output[ip][i++]=(UChar_t) sig[ip][is]; 569 466 else … … 612 509 // 613 510 614 for (Int_t ibin=1; ibin <= SLICES_MFADC; ibin++) {511 for (Int_t ibin=1; ibin <=(Int_t)SLICES_MFADC; ibin++) { 615 512 hist->SetBinContent (ibin, sig[i][ibin-1]) ; 616 513 }
Note:
See TracChangeset
for help on using the changeset viewer.