Changeset 7191 for trunk/MagicSoft/Mars/mfilter
- Timestamp:
- 07/14/05 17:13:40 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mfilter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfilter/MFMagicCuts.cc
r7173 r7191 27 27 // MFMagicCuts 28 28 // 29 // Predefinitions: 30 // --------------- 31 // 32 // m3long = MHillasExt.fM3Long*sign(MHillasSrc.fCosDeltaAlpha)*fMM2Deg 33 // antim3long = MHillasExt.fM3Long*sign(MHillasSrcAnti.fCosDeltaAlpha)*fMM2Deg 34 // 35 // Coefficients/Cuts: 36 // ------------------ 37 // 38 // c[0], c[5], c[6], c[7]: 39 // xi = c[0]+c[6]*pow(Leakage1, c[7]); 40 // p = xi*(1-width/length); 41 // disp = TMath::Sign(disp, m3long-c[5]) 42 // antidisp = TMath::Sign(disp, antim3long-c[5]) 43 // thetasq = disp^2 + dist^2 - 2*disp*dist*alpha 44 // antithetasq = antidisp^2 + dist^2 - 2*antidisp*dist*alpha 45 // 46 // c[1]: 47 // thetasq < c[1]*c[1] 48 // 49 // c[2], c[3], c[4]: 50 // A = c[2]*(1 - c[4]*(lgsize-c[3])*(lgsize-c[3])) 51 // area < A 52 // 53 // 54 // Options: 55 // -------- 56 // 57 // HadronnessCut: 58 // - none/nocut: No area cut 59 // - area: Area cut 60 // - all: same as area 61 // 62 // ThetaCut: 63 // - none/nocut: no theta cut 64 // - on: cut in theta only 65 // - off: anti-cut in anti-theta only 66 // - wobble: same as on|off (both) 67 // 68 // 69 // Input Container: 70 // ------ 71 // MGeomCam 72 // MHillas 73 // MHillasExt 74 // MNewImagePar 75 // MHillasSrc 76 // [MHillasSrcAnti [MHillasSrc]] 77 // 78 // Output: 79 // ------- 80 // ThetaSquared [MParameterD] // stores thetasq 81 // Disp [MParameterD] // stores -p*sign(MHillasSrc.fCosDeltaAlpha) 82 // ThetaSquaredCut [MParameterD] // stores c[1]*c[1] 83 // 29 84 ///////////////////////////////////////////////////////////////////////////// 30 85 #include "MFMagicCuts.h" … … 36 91 #include "MLog.h" 37 92 #include "MLogManip.h" 93 94 #include "MMath.h" 38 95 39 96 #include "MParList.h" … … 42 99 #include "MHillasSrc.h" 43 100 #include "MHillasExt.h" 101 #include "MNewImagePar.h" 44 102 #include "MParameters.h" 45 #include "MPointingPos.h"46 103 47 104 ClassImp(MFMagicCuts); … … 54 111 // 55 112 MFMagicCuts::MFMagicCuts(const char *name, const char *title) 56 : fHil(0), fHilSrc(0), fHilAnti(0), fHilExt(0), f ThetaSq(0),57 f Disp(0), fPointing(0), fMatrix(0), fVariables(30), fThetaCut(kNone),113 : fHil(0), fHilSrc(0), fHilAnti(0), fHilExt(0), fNewImgPar(0), 114 fThetaSq(0), fDisp(0), fMatrix(0), fVariables(30), fThetaCut(kNone), 58 115 fHadronnessCut(kAll) 59 116 { … … 68 125 AddToBranchList("MHillasSrc.fAlpha"); 69 126 AddToBranchList("MHillasSrcAnti.fAlpha"); 70 AddToBranchList("MPointingPos.fZd");71 127 AddToBranchList("MHillasExt.fMaxDist"); 72 128 AddToBranchList("MHillasExt.fM3Long"); 129 AddToBranchList("MNewImagePar.fLeakage1"); 73 130 74 131 fVariables[0] = 1.42547; // Xi … … 110 167 return kFALSE; 111 168 thetacut->SetVal(GetThetaSqCut()); 112 //thetacut->SetReadyToSave();113 114 MParameterD *m3lcut = (MParameterD*)pList->FindCreateObj("MParameterD", "M3lCut");115 if (!m3lcut)116 return kFALSE;117 m3lcut->SetVal(fVariables[5]);118 119 MParameterD *dispxi = (MParameterD*)pList->FindCreateObj("MParameterD", "DispXi");120 if (!dispxi)121 return kFALSE;122 dispxi->SetVal(fVariables[0]);123 124 dispxi = (MParameterD*)pList->FindCreateObj("MParameterD", "DispXiTheta");125 if (!dispxi)126 return kFALSE;127 dispxi->SetVal(fVariables[6]);128 169 129 170 Print(); … … 148 189 } 149 190 150 f Pointing = (MPointingPos*)pList->FindObject("MPointingPos");151 if (!f Pointing)152 { 153 *fLog << err << "M PointingPosnot found... aborting." << endl;191 fNewImgPar = (MNewImagePar*)pList->FindObject("MNewImagePar"); 192 if (!fNewImgPar) 193 { 194 *fLog << err << "MNewImagePar not found... aborting." << endl; 154 195 return kFALSE; 155 196 } … … 200 241 fMatrix = mat; 201 242 202 fMap[kESize] = fMatrix->AddColumn("log10(MHillas.fSize)"); 203 fMap[kEArea] = fMatrix->AddColumn("MHillas.GetArea*MGeomCam.fConvMm2Deg*MGeomCam.fConvMm2Deg"); 204 fMap[kEM3Long] = fMatrix->AddColumn("MHillasExt.fM3Long*sign(MHillasSrc.fCosDeltaAlpha)*MGeomCam.fConvMm2Deg"); 205 fMap[kEWdivL] = fMatrix->AddColumn("MHillas.fWidth/MHillas.fLength"); 206 fMap[kEZd] = fMatrix->AddColumn("MPointingPos.GetZdRad"); 207 208 fMap[kEAlpha] = fMatrix->AddColumn("MHillasSrc.fAlpha"); 209 fMap[kEDist] = fMatrix->AddColumn("MHillasSrc.fDist*MGeomCam.fConvMm2Deg"); 210 //fMap[kDCA] = fMatrix->AddColumn("MHillasSrc.fDCA*MGeomCam.fConvMm2Deg"); 243 fMap[kESize] = fMatrix->AddColumn("log10(MHillas.fSize)"); 244 fMap[kEArea] = fMatrix->AddColumn("MHillas.GetArea*MGeomCam.fConvMm2Deg*MGeomCam.fConvMm2Deg"); 245 fMap[kEM3Trans] = fMatrix->AddColumn("abs(MHillasExt.fM3Trans)*MGeomCam.fConvMm2Deg"); 246 fMap[kEM3Long] = fMatrix->AddColumn("MHillasExt.fM3Long*sign(MHillasSrc.fCosDeltaAlpha)*MGeomCam.fConvMm2Deg"); 247 fMap[kESrcSign] = fMatrix->AddColumn("sign(MHillasSrc.fCosDeltaAlpha)"); 248 fMap[kEWdivL] = fMatrix->AddColumn("MHillas.fWidth/MHillas.fLength"); 249 250 fMap[kEAlpha] = fMatrix->AddColumn("MHillasSrc.fAlpha"); 251 fMap[kEDist] = fMatrix->AddColumn("MHillasSrc.fDist*MGeomCam.fConvMm2Deg"); 252 fMap[kELeakage] = fMatrix->AddColumn("log10(MNewImagePar.fLeakage1+1)"); 253 211 254 if (fThetaCut&kOff) 212 255 { 213 256 fMap[kEAlphaAnti] = fMatrix->AddColumn("MHillasSrcAnti.fAlpha"); 214 257 fMap[kEDistAnti] = fMatrix->AddColumn("MHillasSrcAnti.fDist*MGeomCam.fConvMm2Deg"); 215 fMap[kEM3LongAnti] = fMatrix->AddColumn("MHillasExt.fM3Long*sign(MHillasSrcAnti.fCosDeltaAlpha)*MGeomCam.fConvMm2Deg"); 216 //fMap[kDCAAnti] = fMatrix->AddColumn("MHillasSrcAnti.fDCA*MGeomCam.fConvMm2Deg"); 217 } 218 219 //fMap[kLength] = fMatrix->AddColumn("MHillas.fLength*MGeomCam.fConvMm2Deg"); 220 //fMap[kWidth] = fMatrix->AddColumn("MHillas.fWidth*MGeomCam.fConvMm2Deg"); 258 } 221 259 } 222 260 … … 229 267 // If par!=NULL p is stored in this MParameterD 230 268 // 231 Double_t MFMagicCuts::GetThetaSq(Double_t c, Double_t wl, Double_t d, Double_t a, MParameterD *par) const269 Double_t MFMagicCuts::GetThetaSq(Double_t p, Double_t wl, Double_t d, Double_t a) const 232 270 { 233 271 // wl = width/l [1] 234 272 // d = dist [deg] 235 273 // a = alpha [deg] 236 const Double_t p = c*(1-wl); 237 if (par) 238 par->SetVal(p); 239 return d*d + p*p - 2*d*p*cos(a*TMath::DegToRad()); 274 return d*d + p*p - 2*d*p*TMath::Cos(a*TMath::DegToRad()); 240 275 } 241 276 … … 256 291 { 257 292 // Get some variables 258 const Double_t wdivl = fMatrix ? GetVal(kEWdivL) : fHil->GetWidth()/fHil->GetLength(); 259 const Double_t lgsize = fMatrix ? GetVal(kESize) : TMath::Log10(fHil->GetSize()); 260 const Double_t zd = fMatrix ? GetVal(kEZd) : fPointing->GetZdRad(); 293 const Double_t wdivl = fMatrix ? GetVal(kEWdivL) : fHil->GetWidth()/fHil->GetLength(); 294 const Double_t lgsize = fMatrix ? GetVal(kESize) : TMath::Log10(fHil->GetSize()); 295 //const Double_t zd = fMatrix ? GetVal(kEZd) : fPointing->GetZdRad(); 296 const Double_t leak = fMatrix ? GetVal(kELeakage) : TMath::Log10(fNewImgPar->GetLeakage1()+1); 261 297 262 298 // For simplicity 263 299 const Double_t *c = fVariables.GetArray(); 264 300 265 // Value for Theta cut 266 const Double_t cut = GetThetaSqCut(); //c[1]*c[1]; 267 const Double_t xi = (c[0]+c[8]*(lgsize-c[7])*(lgsize-c[7])) - c[6]*zd*zd; 301 // Value for Theta cut (Disp parametrization) 302 const Double_t cut = GetThetaSqCut(); 303 const Double_t xi = c[0]+c[6]*pow(leak, c[7]); 304 const Double_t disp = xi*(1-wdivl); 268 305 269 306 // Default if we return before the end … … 272 309 // ------------------- Most efficient cut ----------------------- 273 310 // ---------------------- Theta cut ON -------------------------- 274 const Double_t dist = fMatrix ? GetVal(kEDist) : fHilSrc->GetDist()*fMm2Deg; 275 const Double_t alpha = fMatrix ? GetVal(kEAlpha) : fHilSrc->GetAlpha(); 276 277 const Double_t thetasq = GetThetaSq(xi, wdivl, dist, alpha, fDisp); 278 311 const Double_t dist = fMatrix ? GetVal(kEDist) : fHilSrc->GetDist()*fMm2Deg; 312 const Double_t alpha = fMatrix ? GetVal(kEAlpha) : fHilSrc->GetAlpha(); 313 const Double_t m3long = fMatrix ? GetVal(kEM3Long) : fHilExt->GetM3Long()*TMath::Sign(fMm2Deg, fHilSrc->GetCosDeltaAlpha()); 314 const Double_t sign = fMatrix ? GetVal(kESrcSign) : MMath::Sgn(fHilSrc->GetCosDeltaAlpha()); 315 316 // Align disp along source direction depending on third moment 317 const Double_t p = TMath::Sign(disp, m3long-c[5]); 318 319 // Align sign of disp along shower axis like m3long 320 fDisp->SetVal(-p*sign); 321 322 // Calculate corresponding Theta^2 323 const Double_t thetasq = GetThetaSq(p, wdivl, dist, alpha); 279 324 fThetaSq->SetVal(thetasq); 280 325 326 // Perform theta cut 281 327 if (fThetaCut&kOn && thetasq >= cut) 282 328 return kTRUE; … … 290 336 if (area>=A) 291 337 return kTRUE; 292 } 293 if (fHadronnessCut&kM3Long) 294 { 295 const Double_t m3long = fMatrix ? GetVal(kEM3Long) : fHilExt->GetM3Long()*TMath::Sign(fMm2Deg, fHilSrc->GetCosDeltaAlpha()); 296 if (m3long<=c[5]) 297 return kTRUE; 338 339 //const Double_t m3t = fMatrix ? GetVal(kEM3Trans) : TMath::Abs(fHilExt->GetM3Trans())*fMm2Deg; 340 //if (m3t>c[8]) 341 // return kTRUE; 298 342 } 299 343 300 344 // ------------------- Least efficient cut ----------------------- 301 345 // ---------------------- Theta cut OFF -------------------------- 346 302 347 if (fThetaCut&kOff) 303 348 { 304 349 const Double_t distanti = fMatrix ? GetVal(kEDistAnti) : fHilAnti->GetDist()*fMm2Deg; 305 350 const Double_t alphaanti = fMatrix ? GetVal(kEAlphaAnti) : fHilAnti->GetAlpha(); 306 const Double_t thetasqanti = GetThetaSq(xi, wdivl, distanti, alphaanti);307 351 const Double_t m3lanti = fMatrix ? GetVal(kEM3LongAnti) : fHilExt->GetM3Long()*TMath::Sign(fMm2Deg, fHilAnti->GetCosDeltaAlpha()); 308 352 309 if (thetasqanti<cut && (fHadronnessCut&kM3Long || m3lanti>c[5])) 353 const Double_t panti = TMath::Sign(disp, m3lanti-c[5]); 354 const Double_t thetasqanti = GetThetaSq(panti, wdivl, distanti, alphaanti); 355 356 if (thetasqanti<cut) 310 357 return kTRUE; 358 359 // This cut throws away gamma-like events which would be assigned to the 360 // anti-source. It is not necessary but it offers the possibility to 361 // fill the MHDisp plot in one run (Having a hole instead of eg. Crab 362 // the data can be rotated and subtracted) 311 363 } 312 364 … … 355 407 *fLog << "none" << endl; 356 408 break; 357 case kArea: 358 *fLog << "area" << endl; 359 break; 360 case kM3Long: 361 *fLog << "m3long" << endl; 362 break; 409 //case kArea: 410 // *fLog << "area" << endl; 411 // break; 363 412 case kAll: 364 413 *fLog << "all" << endl; … … 449 498 if (str==(TString)"area") 450 499 fHadronnessCut = kArea; 451 if (str==(TString)"m3long")452 fHadronnessCut = kM3Long;453 500 if (str==(TString)"all") 454 501 fHadronnessCut = kAll; -
trunk/MagicSoft/Mars/mfilter/MFMagicCuts.h
r7173 r7191 15 15 class MHillasSrc; 16 16 class MHillasExt; 17 class MNewImagePar; 17 18 class MParameterD; 18 19 class MPointingPos; … … 33 34 kNoCut =BIT(0), 34 35 kArea =BIT(1), 35 kM3Long=BIT(2), 36 kAll =kArea|kM3Long 36 kAll =kArea 37 37 }; 38 38 … … 41 41 // the last on in the list. It is used as counter for fMap. 42 42 enum { 43 kESize, kEAlpha, kEAlphaAnti, kEArea, kEDist, 44 kEM3Long, kEM3LongAnti, kEDistAnti, kEWdivL, kEZd, 43 kESize, kEAlpha, kEAlphaAnti, kEArea, kEDist, kEM3Long, 44 kEM3LongAnti, kEM3Trans, kEDistAnti, kEWdivL, //kEZd, 45 kELeakage, kESrcSign, //kEDelta, //kEMeanX, kEMeanY, kEDelta, 45 46 kLastElement 46 47 }; 47 48 48 MHillas *fHil; //! Pointer to MHillas container49 MHillasSrc *fHilSrc; //! Pointer to MHillasSrc container50 MHillasSrc *fHilAnti; //! Pointer to MHillasSrc container called MHillasSrcAnti51 MHillasExt *fHilExt; //! Pointer to MHillasExt container52 M ParameterD *fThetaSq; //! Pointer to MParameterD container called ThetaSq53 MParameterD *f Disp; //! Pointer to MParameterD container called Disp54 MP ointingPos *fPointing; //! Pointer to MPointingPos container49 MHillas *fHil; //! Pointer to MHillas container 50 MHillasSrc *fHilSrc; //! Pointer to MHillasSrc container 51 MHillasSrc *fHilAnti; //! Pointer to MHillasSrc container called MHillasSrcAnti 52 MHillasExt *fHilExt; //! Pointer to MHillasExt container 53 MNewImagePar *fNewImgPar; //! Pointer to MHillasExt container 54 MParameterD *fThetaSq; //! Pointer to MParameterD container called ThetaSq 55 MParameterD *fDisp; //! Pointer to MParameterD container called Disp 55 56 56 57 Float_t fMm2Deg; //! Conversion factor from mm to deg, from MGeomCam … … 75 76 Double_t GetVal(Int_t i) const; 76 77 TString GetParam(Int_t i) const; 77 Double_t GetThetaSq(Double_t c, Double_t wl, Double_t d, Double_t a, MParameterD *par=0) const;78 Double_t GetThetaSq(Double_t p, Double_t wl, Double_t d, Double_t a) const; 78 79 79 80 public:
Note:
See TracChangeset
for help on using the changeset viewer.