Changeset 6680 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 02/25/05 18:08:21 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityRelTimeCam.cc
r5812 r6680 83 83 } 84 84 85 TGraphErrors *MCalibrationIntensityRelTimeCam::GetTimeResVsCharge( const UInt_t pixid, const MCalibrationIntensityChargeCam &chargecam, 86 const MCalibrationCam::PulserColor_t col) 85 TGraphErrors *MCalibrationIntensityRelTimeCam::GetTimeResVsCharge( const UInt_t pixid, const MCalibrationIntensityChargeCam &chargecam, const MCalibrationCam::PulserColor_t col) 87 86 { 88 87 … … 178 177 return NULL; 179 178 } 179 180 if (col == MCalibrationCam::kBLUE) 181 size -= 5; 182 if (col == MCalibrationCam::kNONE) 183 size -= 5; 184 185 const Float_t sqrt2 = 1.414; 186 const Float_t fadc2ns = 3.333; 187 const Float_t norm = fadc2ns / sqrt2; 188 189 TArrayD res(size); 190 TArrayD reserr(size); 191 TArrayD sig(size); 192 TArrayD sigerr(size); 193 194 Int_t cnt = 0; 195 196 TH1D *h = 0; 197 198 for (Int_t i=0;i<GetSize();i++) 199 { 200 // 201 // Get the calibration cam from the intensity cam 202 // 203 MCalibrationRelTimeCam *relcam = (MCalibrationRelTimeCam*)GetCam(i); 204 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)chargecam.GetCam(i); 205 206 if (relcam->GetPulserColor() != col && col != MCalibrationCam::kNONE) 207 continue; 208 209 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(aidx); 210 const Double_t phe = (Double_t)apix.GetPheFFactorMethod(); 211 const Double_t pheerr = (Double_t)apix.GetPheFFactorMethodErr(); 212 213 if (relcam->GetPulserColor() == MCalibrationCam::kBLUE) 214 if (aidx == 0) 215 { 216 if (phe > 100. && phe < 190.) 217 continue; 218 } 219 else 220 { 221 if (phe > 200. && phe < 480.) 222 continue; 223 } 224 225 if (relcam->GetPulserColor() == MCalibrationCam::kUV) 226 *fLog << inf << "NUMBER: " << i << endl; 227 228 sig[cnt] = phe; 229 sigerr[cnt] = pheerr; 230 231 Double_t resol = 0.; 232 Double_t resol2 = 0.; 233 Double_t var = 0.; 234 Int_t num = 0; 235 236 MHCamera camres(geom,"CamRes","Time Resolution;Time Resolution [ns];channels"); 237 // 238 // Get the area calibration pix from the calibration cam 239 // 240 for (Int_t j=0; j<cam->GetSize(); j++) 241 { 242 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*cam)[j]; 243 const MCalibrationRelTimePix &relpix = (MCalibrationRelTimePix&)(*relcam)[j]; 244 // 245 // Don't use bad pixels 246 // 247 if (!pix.IsFFactorMethodValid()) 248 continue; 249 // 250 // 251 if (aidx != geom[j].GetAidx()) 252 continue; 253 254 const Double_t pres = (Double_t)relpix.GetTimePrecision(); 255 256 resol += pres; 257 resol2 += pres; 258 num++; 259 260 camres.Fill(j,pres); 261 camres.SetUsed(j); 262 } 263 264 if (num > 100) 265 { 266 resol /= num; 267 var = (resol2 - resol*resol*num) / (num-1); 268 269 res[cnt] = resol; 270 if (var > 0.) 271 reserr[cnt] = TMath::Sqrt(var); 272 else 273 reserr[cnt] = 0.; 274 275 // 276 // Make also a Gauss-fit to the distributions. The RMS can be determined by 277 // outlier, thus we look at the sigma and the RMS and take the smaller one, afterwards. 278 // 279 h = camres.ProjectionS(TArrayI(),TArrayI(1,&aidx),"_py",750); 280 h->SetDirectory(NULL); 281 h->Fit("gaus","QL"); 282 TF1 *fit = h->GetFunction("gaus"); 283 284 Double_t ci2 = fit->GetChisquare(); 285 Double_t sigma = fit->GetParameter(2); 286 287 if (ci2 > 500. || sigma > reserr[cnt]) 288 { 289 h->Fit("gaus","QLM"); 290 fit = h->GetFunction("gaus"); 291 292 ci2 = fit->GetChisquare(); 293 sigma = fit->GetParameter(2); 294 } 295 296 const Double_t mean = fit->GetParameter(1); 297 const Int_t ndf = fit->GetNDF(); 298 299 *fLog << inf << "Mean number photo-electrons: " << sig[cnt] << endl; 300 *fLog << inf << "Time Resolution area idx: " << aidx << " Results: " << endl; 301 *fLog << inf << "Mean: " << Form("%4.3f",mean) 302 << "+-" << Form("%4.3f",fit->GetParError(1)) 303 << " Sigma: " << Form("%4.3f",sigma) << "+-" << Form("%4.3f",fit->GetParError(2)) 304 << " Chisquare: " << Form("%4.3f",fit->GetChisquare()) << " NDF : " << ndf << endl; 305 306 delete h; 307 gROOT->GetListOfFunctions()->Remove(fit); 308 309 if ((sigma < reserr[cnt] || reserr[cnt]<0.001) && ndf > 2) 310 { 311 res [cnt] = mean; 312 reserr[cnt] = sigma; 313 } 314 else 315 *fLog << warn << "Do not take fit results, but Mean and RMS: " << Form("%4.3f",res[cnt]) << "+-" << Form("%4.3f",reserr[cnt]) << endl; 316 317 res[cnt] *= norm; 318 reserr[cnt] *= norm; 319 cnt++; 320 } 321 } 322 323 TGraphErrors *gr = new TGraphErrors(size, 324 sig.GetArray(),res.GetArray(), 325 sigerr.GetArray(),reserr.GetArray()); 326 gr->SetTitle(Form("%s%3i","Area Index ",aidx)); 327 gr->GetXaxis()->SetTitle("<phes> [1]"); 328 gr->GetYaxis()->SetTitle("Time Resolution [ns]"); 329 return gr; 330 } 331 332 TGraphErrors *MCalibrationIntensityRelTimeCam::GetTimeResVsSqrtPhePerArea( const Int_t aidx,const MCalibrationIntensityChargeCam &chargecam, const MGeomCam &geom, const MCalibrationCam::PulserColor_t col) 333 { 334 335 const Int_t size = CountNumEntries(col); 336 337 if (size == 0) 338 return NULL; 339 340 const Int_t asiz = chargecam.CountNumEntries(col); 341 342 if (size != asiz) 343 { 344 *fLog << err << GetDescriptor() << ": Size mismatch in colour between MCalibrationIntensityRelTimeCam " 345 << "and MCalibrationIntensityChargeCam. " << endl; 346 return NULL; 347 } 180 348 181 349 const Float_t sqrt2 = 1.414; … … 200 368 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)chargecam.GetCam(i); 201 369 202 if (relcam->GetPulserColor() != col )370 if (relcam->GetPulserColor() != col && col != MCalibrationCam::kNONE) 203 371 continue; 204 372 205 373 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(aidx); 206 374 const Float_t phe = apix.GetPheFFactorMethod(); 207 const Float_t pheerr = apix.GetPheFFactorMethodErr(); 208 209 sig[cnt] = phe; 210 sigerr[cnt] = pheerr; 375 const Float_t phesq = phe > 0. ? TMath::Sqrt(phe) : 0.; 376 const Float_t phesqerr = phe > 0. ? 0.5*apix.GetPheFFactorMethodErr()/phesq : 0.; 377 378 sig[cnt] = phesq; 379 sigerr[cnt] = phesqerr; 211 380 212 381 Double_t resol = 0.; … … 279 448 280 449 281 *fLog << inf << " Mean number photo-electrons: " << sig[cnt] << endl;450 *fLog << inf << "Sqrt Mean number photo-electrons: " << sig[cnt] << endl; 282 451 *fLog << inf << "Time Resolution area idx: " << aidx << " Results: " << endl; 283 452 *fLog << inf << "Mean: " << Form("%4.3f",mean) … … 310 479 sigerr.GetArray(),reserr.GetArray()); 311 480 gr->SetTitle(Form("%s%3i","Area Index ",aidx)); 312 gr->GetXaxis()->SetTitle(" <phes>[1]");481 gr->GetXaxis()->SetTitle("Sqrt(<phes>) [1]"); 313 482 gr->GetYaxis()->SetTitle("Time Resolution [ns]"); 314 483 return gr; -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityRelTimeCam.h
r5660 r6680 23 23 TGraphErrors *GetTimeResVsCharge( const UInt_t pixid, const MCalibrationIntensityChargeCam &chargecam, 24 24 const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE); 25 25 26 TGraphErrors *GetTimeResVsChargePerArea( const Int_t aidx, const MCalibrationIntensityChargeCam &chargecam, 27 const MGeomCam &geom, 28 const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE); 29 30 TGraphErrors *GetTimeResVsSqrtPhePerArea( const Int_t aidx, const MCalibrationIntensityChargeCam &chargecam, 26 31 const MGeomCam &geom, 27 32 const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE); -
trunk/MagicSoft/Mars/mcalib/MCalibrationPulseTimeCam.cc
r6599 r6680 144 144 145 145 *fLog << all 146 << Form("%s%4i%s%4.2f%s%4.2f%s%4.2f%s%4.2f","Pix ",pix->GetPixId(), 147 ": Mean Time: ",pix->GetMean()," +- ",pix->GetMeanErr(), 148 " Time Jitter: ",pix->GetSigma()," +- ",pix->GetSigmaErr()) 146 << Form("Pix %4i: Mean Time: %4.2f+-%4.2f Time Jitter: %4.2f+-%4.2f",pix->GetPixId(), 147 pix->GetMean(),pix->GetMeanErr(),pix->GetSigma(),pix->GetSigmaErr()) 149 148 << endl; 150 149 id++; … … 178 177 { 179 178 *fLog << all 180 << Form("%s%4i%s%4.2f%s%4.2f%s%4.2f%s%4.2f","Average Area ",pix->GetPixId(), 181 ": Mean Time: ",pix->GetMean()," +- ",pix->GetMeanErr(), 182 " Time Jitter: ",pix->GetSigma()," +- ",pix->GetSigmaErr()) 179 << Form("Pix %4i: Mean Time: %4.2f+-%4.2f Time Jitter: %4.2f+-%4.2f",pix->GetPixId(), 180 pix->GetMean(),pix->GetMeanErr(),pix->GetSigma(),pix->GetSigmaErr()) 183 181 << endl; 184 182 } … … 188 186 { 189 187 *fLog << all 190 << Form("%s%4i%s%4.2f%s%4.2f%s%4.2f%s%4.2f","Average Sector ",pix->GetPixId(), 191 ": Mean Time: ",pix->GetMean()," +- ",pix->GetMeanErr(), 192 " Time Jitter: ",pix->GetSigma()," +- ",pix->GetSigmaErr()) 188 << Form("Pix %4i: Mean Time: %4.2f+-%4.2f Time Jitter: %4.2f+-%4.2f",pix->GetPixId(), 189 pix->GetMean(),pix->GetMeanErr(),pix->GetSigma(),pix->GetSigmaErr()) 193 190 << endl; 194 191 } … … 231 228 if (pix.IsExcluded()) 232 229 return kFALSE; 233 val = pix.Get Mean();230 val = pix.GetHiGainMean(); 234 231 break; 235 232 case 1: 236 233 if (pix.IsExcluded()) 237 234 return kFALSE; 238 val = pix.Get MeanErr();235 val = pix.GetHiGainMeanErr(); 239 236 break; 240 237 case 2: 241 238 if (pix.IsExcluded()) 242 239 return kFALSE; 243 val = pix.Get Sigma();240 val = pix.GetHiGainSigma(); 244 241 break; 245 242 case 3: 246 243 if (pix.IsExcluded()) 247 244 return kFALSE; 248 val = pix.Get SigmaErr();245 val = pix.GetHiGainSigmaErr(); 249 246 break; 250 247 case 4:
Note:
See TracChangeset
for help on using the changeset viewer.