Changeset 4218 for trunk/MagicSoft/Mars/mtemp/mifae/library/MIslandCalc.cc
- Timestamp:
- 05/27/04 16:38:48 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/library/MIslandCalc.cc
r3976 r4218 3 3 ! 4 4 ! Author(s): Ester Aliu, 2/2004 <aliu@ifae.es> 5 ! 5 ! 6 ! Last Update: 5/2004 6 7 ! 7 8 \* ======================================================================== */ … … 18 19 // - fPixNum[20]; // number of pixels in the island 19 20 // - fSigToNoise[20]; // signal to noise of the island 20 // - fTimeHi[20][577] // mean of the arrival time in the hi gain 21 // - fTimeLo[20][577] // mean of the arrival time in the lo gain 22 // - fTimeSpreadHi[20]; // mean arrival time spread of the island 23 // - fTimeSpreadLo[20]; // mean arrival time spread of the island 21 // - fTime[20][577] // mean of the arrival time 22 // - fTimeSpread[20]; // mean arrival time spread of the island 24 23 // 25 24 // … … 30 29 // MArrivalTimeCam 31 30 // 32 // 31 // Output Containers: 33 32 // MIslands 34 33 // … … 109 108 { 110 109 fIsl = (MIslands*)pList->FindCreateObj("MIslands", AddSerialNumber(fIslName)); 111 cout << "kk1" << endl;110 //cout << "kk1" << endl; 112 111 } 113 112 else 114 113 { 115 114 fIsl = (MIslands*)pList->FindCreateObj(AddSerialNumber("MIslands")); 116 cout << "kk2" << endl;115 //cout << "kk2" << endl; 117 116 } 118 117 if (!fIsl) … … 130 129 131 130 Int_t npix = 577; 131 132 132 Int_t sflag; 133 133 Int_t control; … … 148 148 149 149 150 MCerPhotPix *pix; 151 150 152 //loop over all pixels 151 for(Int_t idx=0 ; idx<npix ; idx++) 152 { 153 MCerPhotEvtIter Next(fEvt, kFALSE); 154 155 while ((pix=static_cast<MCerPhotPix*>(Next()))) 156 { 157 const Int_t idx = pix->GetPixId(); 158 153 159 const MGeomPix &gpix = (*fCam)[idx]; 154 160 const Int_t nnmax = gpix.GetNumNeighbors(); 155 156 if(idx<0 || idx==npix) 157 { 158 cout << "Pixel (software) index out of range [0-576]. Available number of pixels=" << npix << endl; 159 return 1; 160 } 161 162 161 163 162 if( fEvt->IsPixelUsed(idx)) 164 163 { … … 193 192 fIslNum = nvect; 194 193 195 194 196 195 // Repeated Chain Corrections 197 196 198 197 for(Int_t i = 1; i <= nvect; i++) 199 198 { … … 203 202 for(Int_t k = 0; k < npix; k++) 204 203 { 205 204 206 205 if (vect[i][k] == 1 && vect[j][k] == 1) 207 206 { … … 225 224 } 226 225 227 226 228 227 Int_t l = 1; 229 228 230 229 for(Int_t i = 1; i<= nvect ; i++) 231 230 { … … 239 238 } 240 239 } 241 240 242 241 243 242 //set the number of islands in one event … … 249 248 Float_t time[577]; 250 249 Float_t timeVariance[fIslNum]; 251 //Float_t timeHi[577], timeLo[577]; 252 //Float_t timeVarianceHi[fIslNum]; 253 //Float_t timeVarianceLo[fIslNum]; 254 250 255 251 //reset the "sets" functions 256 252 if (fIslNum <1) … … 262 258 fIsl->SetSigToNoise(i,-1); 263 259 fIsl->SetTimeSpread(i,-1); 264 // fIsl->SetTimeSpreadHi(i,-1); 265 // fIsl->SetTimeSpreadLo(i,-1); 266 260 267 261 for(Int_t idx = 0; idx<npix; idx++) 268 262 { 269 263 fIsl->SetIslId(idx, -1); 270 264 fIsl->SetArrivalTime(i, idx, -1 ); 271 // fIsl->SetArrivalTimeHiGain(i, idx, -1 );272 // fIsl->SetArrivalTimeLoGain(i, idx, -1);273 265 } 274 266 } 275 267 276 277 for(Int_t i = 1; i<=fIslNum ; i++)268 269 for(Int_t i = 1; i<=fIslNum ; i++) 278 270 { 279 271 Int_t n = 0; 280 272 Int_t ncore = 0; 281 282 Float_t MINhi = 10000; 283 Float_t MINlo = 10000; 284 Float_t MAXhi = 0; 285 Float_t MAXlo = 0; 273 286 274 Float_t MIN = 10000; 287 275 Float_t MAX = 0; 288 289 //cout << "Isl #" << i << endl;290 276 291 277 signal = 0; … … 293 279 fPixNum[i-1] = 0; 294 280 timeVariance[i-1] = 0; 295 // timeVarianceHi[i-1] = 0; 296 // timeVarianceLo[i-1] = 0; 297 281 298 282 for(Int_t idx=0 ; idx<npix ; idx++) 299 283 { 300 const MCerPhotPix &pix = (*fEvt)[idx]; 284 285 MCerPhotPix *pix = fEvt->GetPixById(idx); 301 286 const MPedestalPix &ped = (*fPed)[idx]; 302 287 const MArrivalTimePix &timepix = (*fTime)[idx]; 303 288 289 if (pix == NULL) break; 290 304 291 if (vect[i][idx]==1){ 305 292 306 293 fPixNum[i-1]++; 307 signal += pix .GetNumPhotons() * (fCam->GetPixRatio(idx));294 signal += pix->GetNumPhotons() * (fCam->GetPixRatio(idx)); 308 295 noise += pow(ped.GetPedestalRms(),2); 309 296 310 297 time[n] = timepix.IsLoGainUsed() ? timepix.GetArrivalTimeLoGain() : timepix.GetArrivalTimeHiGain(); 311 312 // timeHi[n] = timepix.GetArrivalTimeHiGain(); 313 // cout << "timeHi" << timeHi[n] << endl; 314 315 //timeLo[n] = timepix.GetArrivalTimeLoGain(); 316 //cout << "timeHi" << timeLo[n] << endl; 317 298 299 318 300 if (fEvt->IsPixelCore(idx)){ 319 301 320 /* if (timeHi[n] < MINhi)321 MINhi = timeHi[n];322 if (timeLo[n] < MINlo)323 MINlo = timeLo[n];324 325 if (timeHi[n] > MAXhi)326 MAXhi = timeHi[n];327 if (timeLo[n] > MAXlo)328 MAXlo = timeLo[n];329 330 */331 332 302 if (time[n] > MAX) 333 303 MAX = time[n]; … … 335 305 MIN = time[n]; 336 306 337 //control2[n] = 1;338 //timeVarianceHi[i-1] += timeHi[n];339 //timeVarianceLo[i-1] += timeLo[n];340 307 ncore++; 341 308 } 342 309 343 310 fIsl->SetIslId(idx, i-1); 344 311 fIsl->SetArrivalTime(i-1, idx, time[n]); 345 // fIsl->SetArrivalTimeHiGain(i-1, idx, timeHi[n]); 346 // fIsl->SetArrivalTimeLoGain(i-1, idx, timeLo[n]); 347 312 348 313 n++; 349 314 } … … 351 316 } 352 317 353 Float_t mean = timeVariance[i-1]/ncore; 354 // Float_t meanHi = timeVarianceHi[i-1]/ncore; 355 // Float_t meanLo = timeVarianceLo[i-1]/ncore; 356 318 // Float_t mean = timeVariance[i-1]/ncore; 319 357 320 timeVariance[i-1] = 0; 358 //timeVarianceHi[i-1] = 0; 359 //timeVarianceLo[i-1] = 0; 360 361 /* 362 //old 363 for (Int_t k = 0; k <n ; k++) 364 { 365 if (control2[k] == 1){ 366 367 timeVarianceHi[i-1] += pow(timeHi[k]- meanHi,2); 368 timeVarianceLo[i-1] += pow(timeLo[k]- meanLo,2); 369 } 370 } 371 timeVarianceHi[i-1] = sqrt(timeVarianceHi[i-1]/(ncore-1)); 372 timeVarianceLo[i-1] = sqrt(timeVarianceLo[i-1]/(ncore-1)); */ 373 374 //timeVarianceHi[i-1] = (MAXhi - MINhi)/ncore; 375 //timeVarianceLo[i-1] = (MAXlo - MINlo)/ncore; 376 321 377 322 timeVariance[i-1] = (MAX - MIN)/ncore; 378 323 timeVariance[i-1] = (MAX - MIN)/ncore; … … 383 328 fIsl->SetSigToNoise(i-1,fSigToNoise[i-1]); 384 329 fIsl->SetTimeSpread(i-1, timeVariance[i-1]); 385 //fIsl->SetTimeSpreadHi(i-1, timeVarianceHi[i-1]);386 //fIsl->SetTimeSpreadLo(i-1, timeVarianceLo[i-1]);387 388 //cout << " TimeHi Spread: " << timeVarianceHi[i-1] << endl;389 //cout << " # core pixels: " << ncore << endl;390 //cout << " # used pixels: " << n << endl;391 //cout << " SigToNoise: " << fSigToNoise[i-1] << endl << endl;392 330 393 331 }
Note:
See TracChangeset
for help on using the changeset viewer.