Changeset 14896 for trunk/Mars/mmuon
- Timestamp:
- 02/13/13 10:34:54 (12 years ago)
- Location:
- trunk/Mars/mmuon
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mmuon/MHSingleMuon.cc
r10166 r14896 211 211 for (Int_t i=0; i<entries; i++) 212 212 { 213 const MSignalPix &pix = (*fSignalCam)[i]; 214 const MGeom &gpix = (*fGeomCam)[i]; 213 const MSignalPix &pix = (*fSignalCam)[i]; 214 if (fUseCleanedSignal && !pix.IsPixelUsed()) 215 continue; 216 217 const MGeom &gpix = (*fGeomCam)[i]; 215 218 216 219 const Float_t dx = gpix.GetX() - cenx; … … 227 230 } 228 231 229 // use only the inner pix les. FIXME: This is geometry dependent232 // use only the inner pixels. FIXME: This is geometry dependent 230 233 if (gpix.GetAidx()>0) 231 234 continue; … … 234 237 } 235 238 236 // Setup the function and perform the fit 237 TF1 g1("g1", "gaus");//, -fHistTime.GetXmin(), fHistTime.GetXmax()); 238 239 // Choose starting values as accurate as possible 240 g1.SetParameter(0, fHistTime.GetMaximum()); 241 g1.SetParameter(1, 0); 242 g1.SetParameter(2, 0.7); // FIXME! GetRMS instead??? 243 244 // According to fMuonSearchPar->GetTimeRMS() identified muons 245 // do not have an arrival time rms>3 246 g1.SetParLimits(1, -1.7, 1.7); 247 g1.SetParLimits(2, 0, 3.4); 248 249 // options : N do not store the function, do not draw 250 // I use integral of function in bin rather than value at bin center 251 // R use the range specified in the function range 252 // Q quiet mode 253 if (fHistTime.Fit(&g1, "QNB")) 254 return kTRUE; 255 256 fRelTimeMean = g1.GetParameter(1); 257 fRelTimeSigma = g1.GetParameter(2); 239 if (!fUseCleanedSignal) 240 { 241 // Setup the function and perform the fit 242 TF1 g1("g1", "gaus");//, -fHistTime.GetXmin(), fHistTime.GetXmax()); 243 244 // Choose starting values as accurate as possible 245 g1.SetParameter(0, fHistTime.GetMaximum()); 246 g1.SetParameter(1, 0); 247 g1.SetParameter(2, 0.7); // FIXME! GetRMS instead??? 248 249 // According to fMuonSearchPar->GetTimeRMS() identified muons 250 // do not have an arrival time rms>3 251 g1.SetParLimits(1, -1.7, 1.7); 252 g1.SetParLimits(2, 0, 3.4); 253 254 // options : N do not store the function, do not draw 255 // I use integral of function in bin rather than value at bin center 256 // R use the range specified in the function range 257 // Q quiet mode 258 if (fHistTime.Fit(&g1, "QNB")) 259 return kTRUE; 260 261 fRelTimeMean = g1.GetParameter(1); 262 fRelTimeSigma = g1.GetParameter(2); 263 } 264 else 265 { 266 fRelTimeMean = fMuonSearchPar->GetTime(); 267 fRelTimeSigma = fMuonSearchPar->GetTimeRms(); 268 } 258 269 259 270 // The mean arrival time which was subtracted before will … … 264 275 { 265 276 const MSignalPix &pix = (*fSignalCam)[i]; 266 const MGeom &gpix = (*fGeomCam)[i]; 277 if (fUseCleanedSignal && !pix.IsPixelUsed()) 278 continue; 279 280 const MGeom &gpix = (*fGeomCam)[i]; 267 281 268 282 const Float_t dx = gpix.GetX() - cenx; … … 273 287 // if the signal is not near the estimated circle, it is ignored. 274 288 if (TMath::Abs(dist-fMuonSearchPar->GetRadius())<fMargin && 275 TMath::Abs(pix.GetArrivalTime()-tm0) < 2*fRelTimeSigma)289 (fUseCleanedSignal || TMath::Abs(pix.GetArrivalTime()-tm0) < 2*fRelTimeSigma)) 276 290 { 277 291 fHistPhi.Fill(TMath::ATan2(dx, dy)*TMath::RadToDeg(), pix.GetNumPhotons()); … … 393 407 { 394 408 Int_t first, last; 395 396 409 if (!FindRangeAboveThreshold(fHistWidth, thres, first, last)) 397 410 return kFALSE; -
trunk/Mars/mmuon/MHSingleMuon.h
r9153 r14896 23 23 24 24 Double_t fMargin; //! 25 Bool_t fUseCleanedSignal; //! 25 26 26 27 TProfile fHistPhi; // Histogram of photon distribution along the arc. … … 49 50 Double_t GetRelTimeSigma() const { return fRelTimeSigma; } 50 51 52 void SetUseCleanedSignal(Bool_t b=kTRUE) { fUseCleanedSignal = b; } 53 51 54 Float_t CalcSize() const; 52 55 -
trunk/Mars/mmuon/MMuonSearchPar.cc
r9376 r14896 295 295 296 296 //SetReadyToSave(); 297 } 297 } 298 299 Bool_t MMuonSearchPar::CalcFact(const MGeomCam &geom, const MSignalCam &evt) 300 { 301 // ===================== Reset cleaning ====================== 302 303 for (UInt_t idx=0; idx<evt.GetNumPixels(); idx++) 304 { 305 MSignalPix &pix = evt[idx]; 306 if (pix.IsPixelUnmapped()) 307 continue; 308 309 pix.SetPixelUnused(); 310 pix.SetPixelCore(kFALSE); 311 } 312 313 // ============ Do muon cleaning / calculate COG ============= 314 315 // The window must be large enough that the earliest and latest 316 // events do not get a biased timerms 317 double time_min = -19.5; 318 double time_max = -4.5; 319 double signal_min = 2.30; 320 double delta_t = 1.75; 321 322 Double_t sumx = 0.; 323 Double_t sumy = 0.; 324 Double_t sumw = 0.; 325 for (UInt_t i=0; i<evt.GetNumPixels(); i++) 326 { 327 MSignalPix &pix = evt[i]; 328 329 if (pix.GetNumPhotons()<signal_min) 330 continue; 331 if (pix.GetArrivalTime()>=time_max || pix.GetArrivalTime()<time_min) 332 continue; 333 if (pix.IsPixelUnmapped()) 334 continue; 335 336 const MGeom &gpix = geom[i]; 337 338 const double x = gpix.GetX(); 339 const double y = gpix.GetY(); 340 341 int counter = 0; 342 for (int j=0; j<gpix.GetNumNeighbors(); j++) 343 { 344 const int idx = gpix.GetNeighbor(j); 345 346 const MSignalPix &spix = evt[idx]; 347 348 if (spix.GetNumPhotons()<signal_min) 349 continue; 350 if (spix.GetArrivalTime()>=time_max || spix.GetArrivalTime()<time_min) 351 continue; 352 if (spix.IsPixelUnmapped()) 353 continue; 354 355 if (TMath::Abs(pix.GetArrivalTime()-spix.GetArrivalTime())>delta_t) 356 continue; 357 358 counter++; 359 } 360 361 if (counter==0) 362 continue; 363 364 sumx += pix.GetNumPhotons()*x; 365 sumy += pix.GetNumPhotons()*y; 366 sumw += pix.GetNumPhotons(); 367 368 pix.SetPixelUsed(); 369 pix.SetPixelCore(); 370 } 371 372 if (sumw==0) 373 return kFALSE; 374 375 sumx /= sumw; 376 sumy /= sumw; 377 378 // ============== Fit circle to resulting data =============== 379 380 Double_t sigma, rad; 381 CalcMinimumDeviation(geom, evt, sumx, sumy, sigma, rad); 382 383 fCenterX = sumx; 384 fCenterY = sumy; 385 fRadius = rad; 386 fDeviation = sigma; 387 388 return kTRUE; 389 } 298 390 299 391 void MMuonSearchPar::Print(Option_t *) const -
trunk/Mars/mmuon/MMuonSearchPar.h
r8911 r14896 52 52 void Calc(const MGeomCam &geom, const MSignalCam &evt, 53 53 const MHillas &hillas); 54 Bool_t CalcFact(const MGeomCam &geom, const MSignalCam &evt); 54 55 55 56 // TObject -
trunk/Mars/mmuon/MMuonSearchParCalc.cc
r7009 r14896 76 76 Int_t MMuonSearchParCalc::PreProcess(MParList *pList) 77 77 { 78 fHillas = (MHillas*)pList->FindObject("MHillas");79 if (!f Hillas)78 fHillas = 0; 79 if (!fUseFactAlgorithm) 80 80 { 81 *fLog << err << "MHillas not found... aborting." << endl; 82 return kFALSE; 81 fHillas = (MHillas*)pList->FindObject("MHillas"); 82 if (!fHillas) 83 { 84 *fLog << err << "MHillas not found... aborting." << endl; 85 return kFALSE; 86 } 83 87 } 84 88 … … 108 112 Int_t MMuonSearchParCalc::Process() 109 113 { 110 fMuonPar->Calc(*fGeomCam, *fSignalCam, *fHillas); 114 if (fUseFactAlgorithm) 115 fMuonPar->CalcFact(*fGeomCam, *fSignalCam); 116 else 117 fMuonPar->Calc(*fGeomCam, *fSignalCam, *fHillas); 118 111 119 return kTRUE; 112 120 } -
trunk/Mars/mmuon/MMuonSearchParCalc.h
r6979 r14896 19 19 MMuonSearchPar *fMuonPar; //! Pointer to the output container for the new image parameters 20 20 21 Bool_t fUseFactAlgorithm; 22 21 23 Int_t PreProcess(MParList *plist); 22 24 Int_t Process(); … … 25 27 MMuonSearchParCalc(const char *name=NULL, const char *title=NULL); 26 28 29 void SetUseFactAlgorithm(Bool_t b=kTRUE) { fUseFactAlgorithm = kTRUE; } 30 27 31 ClassDef(MMuonSearchParCalc, 0) // task to calculate muon parameters 28 32 };
Note:
See TracChangeset
for help on using the changeset viewer.