| 1 | /* ======================================================================== *\
|
|---|
| 2 | !
|
|---|
| 3 | ! *
|
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 8 | ! *
|
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its
|
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee,
|
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and
|
|---|
| 12 | ! * that both that copyright notice and this permission notice appear
|
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express
|
|---|
| 14 | ! * or implied warranty.
|
|---|
| 15 | ! *
|
|---|
| 16 | !
|
|---|
| 17 | !
|
|---|
| 18 | ! Author(s): Wolfgang Wittek, 04/2003 <mailto:wittek@mppmu.mpg.de>
|
|---|
| 19 | ! Author(s): Marcos Lopez, 05/2004 <mailto:marcos@gae.ucm.es>
|
|---|
| 20 | !
|
|---|
| 21 | ! Copyright: MAGIC Software Development, 2000-2003
|
|---|
| 22 | !
|
|---|
| 23 | !
|
|---|
| 24 | \* ======================================================================== */
|
|---|
| 25 |
|
|---|
| 26 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 27 | // //
|
|---|
| 28 | // MMySuperCutsCalc //
|
|---|
| 29 | // //
|
|---|
| 30 | // this class calculates the hadronness for the supercuts //
|
|---|
| 31 | // the parameters of the supercuts are taken //
|
|---|
| 32 | // from the container MSupercuts //
|
|---|
| 33 | // //
|
|---|
| 34 | // //
|
|---|
| 35 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 36 | #include "MMySuperCutsCalc.h"
|
|---|
| 37 |
|
|---|
| 38 | #include <math.h>
|
|---|
| 39 | #include <fstream>
|
|---|
| 40 |
|
|---|
| 41 | #include "TFile.h"
|
|---|
| 42 | #include "TArrayD.h"
|
|---|
| 43 |
|
|---|
| 44 | #include "MParList.h"
|
|---|
| 45 | #include "MHillasExt.h"
|
|---|
| 46 | #include "MHillasSrc.h"
|
|---|
| 47 | #include "MNewImagePar.h"
|
|---|
| 48 | #include "MMcEvt.hxx"
|
|---|
| 49 | #include "MCerPhotEvt.h"
|
|---|
| 50 | #include "MGeomCam.h"
|
|---|
| 51 | #include "MHadronness.h"
|
|---|
| 52 | #include "MHMatrix.h"
|
|---|
| 53 | #include "MMySuperCuts.h"
|
|---|
| 54 | #include "MGeomCamMagic.h"
|
|---|
| 55 | #include "MPointingPos.h"
|
|---|
| 56 | #include "MNewImagePar.h"
|
|---|
| 57 | #include "MHillasExt.h"
|
|---|
| 58 |
|
|---|
| 59 | #include "MLog.h"
|
|---|
| 60 | #include "MLogManip.h"
|
|---|
| 61 |
|
|---|
| 62 | ClassImp(MMySuperCutsCalc);
|
|---|
| 63 |
|
|---|
| 64 | using namespace std;
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 | // --------------------------------------------------------------------------
|
|---|
| 68 | //
|
|---|
| 69 | // constructor
|
|---|
| 70 | //
|
|---|
| 71 | MMySuperCutsCalc::MMySuperCutsCalc(const char *hilname, const char *hilsrcname, const char *name, const char *title)
|
|---|
| 72 | : fHadronnessName("MHadronness"), fHilName(hilname), fHilSrcName(hilsrcname),
|
|---|
| 73 | fHilExtName("MHillasExt"), fNewParName("MNewImagePar"),
|
|---|
| 74 | fSuperName("MMySuperCuts") ,
|
|---|
| 75 | fNoDistCut(kFALSE) ,fSizeCutLow(2000),fSizeCutUp(10000000)
|
|---|
| 76 |
|
|---|
| 77 | {
|
|---|
| 78 | fName = name ? name : "MMySuperCutsCalc";
|
|---|
| 79 | fTitle = title ? title : "Class to evaluate the Supercuts";
|
|---|
| 80 |
|
|---|
| 81 | fMatrix = NULL;
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | // --------------------------------------------------------------------------
|
|---|
| 86 | //
|
|---|
| 87 | //
|
|---|
| 88 | Int_t MMySuperCutsCalc::PreProcess(MParList *pList)
|
|---|
| 89 | {
|
|---|
| 90 | MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam");
|
|---|
| 91 | if (!cam)
|
|---|
| 92 | {
|
|---|
| 93 | *fLog << err << "MGeomCam (Camera Geometry) not found... aborting." << endl;
|
|---|
| 94 | return kFALSE;
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | fMm2Deg = cam->GetConvMm2Deg();
|
|---|
| 98 |
|
|---|
| 99 | fHadronness = (MHadronness*)pList->FindCreateObj("MHadronness", fHadronnessName);
|
|---|
| 100 | if (!fHadronness)
|
|---|
| 101 | {
|
|---|
| 102 | *fLog << err << fHadronnessName << " [MHadronness] not found... aborting." << endl;
|
|---|
| 103 | return kFALSE;
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 | fSuper = (MMySuperCuts*)pList->FindObject(fSuperName, "MMySuperCuts");
|
|---|
| 107 | if (!fSuper)
|
|---|
| 108 | {
|
|---|
| 109 | *fLog << err << fSuperName << " [MMySuperCuts] not found... aborting." << endl;
|
|---|
| 110 | return kFALSE;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | if (fMatrix)
|
|---|
| 114 | return kTRUE;
|
|---|
| 115 |
|
|---|
| 116 | //-----------------------------------------------------------
|
|---|
| 117 | fHil = (MHillas*)pList->FindObject(fHilName, "MHillas");
|
|---|
| 118 | if (!fHil)
|
|---|
| 119 | {
|
|---|
| 120 | *fLog << err << fHilName << " [MHillas] not found... aborting." << endl;
|
|---|
| 121 | return kFALSE;
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | fHilExt = (MHillasExt*)pList->FindObject(fHilExtName, "MHillasExt");
|
|---|
| 125 | if (!fHilExt)
|
|---|
| 126 | {
|
|---|
| 127 | *fLog << err << fHilExtName << " [MHillasExt] not found... aborting." << endl;
|
|---|
| 128 | return kFALSE;
|
|---|
| 129 | }
|
|---|
| 130 |
|
|---|
| 131 | fHilSrc = (MHillasSrc*)pList->FindObject(fHilSrcName, "MHillasSrc");
|
|---|
| 132 | if (!fHilSrc)
|
|---|
| 133 | {
|
|---|
| 134 | *fLog << err << fHilSrcName << " [MHillasSrc] not found... aborting." << endl;
|
|---|
| 135 | return kFALSE;
|
|---|
| 136 | }
|
|---|
| 137 |
|
|---|
| 138 | fNewPar = (MNewImagePar*)pList->FindObject(fNewParName, "MNewImagePar");
|
|---|
| 139 | if (!fNewPar)
|
|---|
| 140 | {
|
|---|
| 141 | *fLog << err << fNewParName << " [MNewImagePar] not found... aborting." << endl;
|
|---|
| 142 | return kFALSE;
|
|---|
| 143 | }
|
|---|
| 144 |
|
|---|
| 145 | // fPointingPos = (MPointingPos*)pList->FindObject("MPointingPos");
|
|---|
| 146 | // if (!fPointingPos)
|
|---|
| 147 | // {
|
|---|
| 148 | // *fLog << err << " [MPointingPos] not found... aborting." << endl;
|
|---|
| 149 | // // return kFALSE;
|
|---|
| 150 | // }
|
|---|
| 151 | fNewImagePar = (MNewImagePar*)pList->FindObject("MNewImagePar");
|
|---|
| 152 | if (!fNewImagePar)
|
|---|
| 153 | {
|
|---|
| 154 | *fLog << err << " [MNewImagePar] not found... aborting." << endl;
|
|---|
| 155 | return kFALSE;
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | fHillasExt = (MHillasExt*)pList->FindObject("MHillasExt");
|
|---|
| 159 | if (!fHillasExt)
|
|---|
| 160 | {
|
|---|
| 161 | *fLog << err << " [MHillasExt] not found... aborting." << endl;
|
|---|
| 162 | return kFALSE;
|
|---|
| 163 | }
|
|---|
| 164 |
|
|---|
| 165 | // fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
|
|---|
| 166 | // if (!fMcEvt)
|
|---|
| 167 | // {
|
|---|
| 168 | // *fLog << err << "MMcEvt not found... aborting." << endl;
|
|---|
| 169 | // return kFALSE;
|
|---|
| 170 | // }
|
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 | return kTRUE;
|
|---|
| 174 | }
|
|---|
| 175 |
|
|---|
| 176 | // --------------------------------------------------------------------------
|
|---|
| 177 | //
|
|---|
| 178 | // Calculation of upper and lower limits
|
|---|
| 179 | //
|
|---|
| 180 | Double_t MMySuperCutsCalc::CtsMCut(const Double_t* a, Double_t ls, Double_t ls2, Double_t ct, Double_t dd2) const
|
|---|
| 181 | {
|
|---|
| 182 | // define cut-function
|
|---|
| 183 | //
|
|---|
| 184 | // dNOMLOGSIZE = 5.0 (=log(150.0)
|
|---|
| 185 | // dNOMCOSZA = 1.0
|
|---|
| 186 | //
|
|---|
| 187 | // a: array of cut parameters
|
|---|
| 188 | // ls: log(SIZE) - dNOMLOGSIZE
|
|---|
| 189 | // ls2: ls^2
|
|---|
| 190 | // ct: Cos(ZA.) - dNOMCOSZA
|
|---|
| 191 | // dd2: DIST^2
|
|---|
| 192 |
|
|---|
| 193 | // const Double_t limit =
|
|---|
| 194 | // a[0] + a[1] * dd2 + a[2] * ct +
|
|---|
| 195 | // ls * (a[3] + a[4] * dd2 + a[5] * ct) +
|
|---|
| 196 | // ls2 * (a[6] + a[7] * dd2);
|
|---|
| 197 |
|
|---|
| 198 | // const Double_t limit = a[0] + ls*a[1] + ls2*a[2] + ct*a[3];
|
|---|
| 199 | const Double_t limit = a[0] + ls*a[1] + ls2*a[2] + dd2*a[3];
|
|---|
| 200 |
|
|---|
| 201 | //*fLog << "MMySuperCutsCalc::CtsMCut; *a = "
|
|---|
| 202 | // << *a << ", " << *(a+1) << ", " << *(a+2) << ", "
|
|---|
| 203 | // << *(a+3) << ", " << *(a+4) << ", " << *(a+5) << ", "
|
|---|
| 204 | // << *(a+6) << ", " << *(a+7) << endl;
|
|---|
| 205 |
|
|---|
| 206 | //*fLog << "MMySuperCutsCalc::CtsMCut; ls, ls2, ct, dd2, limit = " << ls
|
|---|
| 207 | // << ", " << ls2 << ", " << ct << ", " << dd2 << ", "
|
|---|
| 208 | // << limit << endl;
|
|---|
| 209 |
|
|---|
| 210 | return limit;
|
|---|
| 211 | }
|
|---|
| 212 |
|
|---|
| 213 | // --------------------------------------------------------------------------
|
|---|
| 214 | //
|
|---|
| 215 | // Returns the mapped value from the Matrix
|
|---|
| 216 | //
|
|---|
| 217 | Double_t MMySuperCutsCalc::GetVal(Int_t i) const
|
|---|
| 218 | {
|
|---|
| 219 |
|
|---|
| 220 | Double_t val = (*fMatrix)[fMap[i]];
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 | //*fLog << "MMySuperCutsCalc::GetVal; i, fMatrix, fMap, val = "
|
|---|
| 224 | // << i << ", " << fMatrix << ", " << fMap[i] << ", " << val << endl;
|
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 | return val;
|
|---|
| 228 | }
|
|---|
| 229 |
|
|---|
| 230 | // --------------------------------------------------------------------------
|
|---|
| 231 | //
|
|---|
| 232 | // You can use this function if you want to use a MHMatrix instead of the
|
|---|
| 233 | // given containers. This function adds all necessary columns to the
|
|---|
| 234 | // given matrix. Afterward you should fill the matrix with the corresponding
|
|---|
| 235 | // data (eg from a file by using MHMatrix::Fill). If you now loop
|
|---|
| 236 | // through the matrix (eg using MMatrixLoop) MEnergyEstParam::Process
|
|---|
| 237 | // will take the values from the matrix instead of the containers.
|
|---|
| 238 | //
|
|---|
| 239 | void MMySuperCutsCalc::InitMapping(MHMatrix *mat)
|
|---|
| 240 | {
|
|---|
| 241 | if (fMatrix)
|
|---|
| 242 | return;
|
|---|
| 243 |
|
|---|
| 244 | fMatrix = mat;
|
|---|
| 245 |
|
|---|
| 246 | // //fMap[0] = fMatrix->AddColumn("MMcEvt.fTelescopeTheta");
|
|---|
| 247 | // fMap[0] = fMatrix->AddColumn("MHillas.fWidth");
|
|---|
| 248 | // fMap[1] = fMatrix->AddColumn("MHillas.fLength");
|
|---|
| 249 | // fMap[2] = fMatrix->AddColumn("MHillas.fSize");
|
|---|
| 250 | // fMap[3] = fMatrix->AddColumn("MHillas.fMeanX");
|
|---|
| 251 | // fMap[4] = fMatrix->AddColumn("MHillas.fMeanY");
|
|---|
| 252 | // fMap[5] = fMatrix->AddColumn("MHillasSrc.fDist");
|
|---|
| 253 | // fMap[6] = fMatrix->AddColumn("fabs(MHillasSrc.fAlpha)");
|
|---|
| 254 | // //fMap[7] = fMatrix->AddColumn("MPointingPos.fZd");
|
|---|
| 255 | // fMap[7] = fMatrix->AddColumn("fabs(MHillasSrc.fAlpha)");
|
|---|
| 256 | // fMap[8] = fMatrix->AddColumn("MNewImagePar.fConc");
|
|---|
| 257 | // fMap[9] = fMatrix->AddColumn("MHillasExt.fAsym");
|
|---|
| 258 | // fMap[10]= fMatrix->AddColumn("MNewImagePar.fLeakage1");
|
|---|
| 259 |
|
|---|
| 260 | fMap[0] = fMatrix->AddColumn("MHillas.fWidth");
|
|---|
| 261 | fMap[1] = fMatrix->AddColumn("MHillas.fLength");
|
|---|
| 262 | fMap[2] = fMatrix->AddColumn("MHillas.fSize");
|
|---|
| 263 | fMap[3] = fMatrix->AddColumn("MHillas.fMeanX");
|
|---|
| 264 | fMap[4] = fMatrix->AddColumn("MHillas.fMeanY");
|
|---|
| 265 | fMap[5] = fMatrix->AddColumn("MHillasSrc.fDist");
|
|---|
| 266 | fMap[6] = fMatrix->AddColumn("fabs(MHillasSrc.fAlpha)");
|
|---|
| 267 | fMap[7] = fMatrix->AddColumn("MNewImagePar.fConc");
|
|---|
| 268 | fMap[8] = fMatrix->AddColumn("MHillasExt.fAsym");
|
|---|
| 269 | fMap[9] = fMatrix->AddColumn("MNewImagePar.fLeakage1");
|
|---|
| 270 |
|
|---|
| 271 | //fMap[8] = fMatrix->AddColumn("sgn(MHillasSrc.fCosDeltaAlpha)*(MHillasExt.fM3Long)");
|
|---|
| 272 | //fMap[9] = fMatrix->AddColumn("MNewImagePar.fConc");
|
|---|
| 273 | //fMap[10]= fMatrix->AddColumn("MNewImagePar.fLeakage1");
|
|---|
| 274 | }
|
|---|
| 275 |
|
|---|
| 276 | // ---------------------------------------------------------------------------
|
|---|
| 277 | //
|
|---|
| 278 | // Evaluate dynamical supercuts
|
|---|
| 279 | //
|
|---|
| 280 | // set hadronness to 0.25 if cuts are fullfilled
|
|---|
| 281 | // 0.75 otherwise
|
|---|
| 282 | //
|
|---|
| 283 | Int_t MMySuperCutsCalc::Process()
|
|---|
| 284 | {
|
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 | //const Double_t kNomLogSize = 7.6;//=log(2000) 4.1;
|
|---|
| 288 | const Double_t kNomLogSize = log(fSizeCutLow);
|
|---|
| 289 |
|
|---|
| 290 | const Double_t kNomCosZA = 1.0;
|
|---|
| 291 |
|
|---|
| 292 | //const Double_t theta = fMatrix ? GetVal(0) : fMcEvt->GetTelescopeTheta();
|
|---|
| 293 |
|
|---|
| 294 | // const Double_t width0 = fMatrix ? GetVal(0) : fHil->GetWidth();
|
|---|
| 295 | // const Double_t length0 = fMatrix ? GetVal(1) : fHil->GetLength();
|
|---|
| 296 | // const Double_t size = fMatrix ? GetVal(2) : fHil->GetSize();
|
|---|
| 297 | // const Double_t meanx = fMatrix ? GetVal(3) : fHil->GetMeanX();
|
|---|
| 298 | // const Double_t meany = fMatrix ? GetVal(4) : fHil->GetMeanY();
|
|---|
| 299 | // const Double_t dist0 = fMatrix ? GetVal(5) : fHilSrc->GetDist();
|
|---|
| 300 | // // const Double_t theta = fMatrix ? GetVal(7) : fPointingPos->GetZd();
|
|---|
| 301 | // const Double_t conc = fMatrix ? GetVal(8) : fNewImagePar->GetConc();
|
|---|
| 302 | // Double_t asym = fMatrix ? GetVal(9) : fHillasExt->GetAsym();
|
|---|
| 303 | // const Double_t leakage = fMatrix ? GetVal(10): fNewImagePar->GetLeakage1();
|
|---|
| 304 |
|
|---|
| 305 | // const Double_t theta =0;
|
|---|
| 306 |
|
|---|
| 307 | const Double_t width0 = fMatrix ? GetVal(0) : fHil->GetWidth();
|
|---|
| 308 | const Double_t length0 = fMatrix ? GetVal(1) : fHil->GetLength();
|
|---|
| 309 | const Double_t size = fMatrix ? GetVal(2) : fHil->GetSize();
|
|---|
| 310 | const Double_t meanx = fMatrix ? GetVal(3) : fHil->GetMeanX();
|
|---|
| 311 | const Double_t meany = fMatrix ? GetVal(4) : fHil->GetMeanY();
|
|---|
| 312 | const Double_t dist0 = fMatrix ? GetVal(5) : fHilSrc->GetDist();
|
|---|
| 313 | const Double_t conc = fMatrix ? GetVal(7) : fNewImagePar->GetConc();
|
|---|
| 314 | Double_t asym = fMatrix ? GetVal(8) : fHillasExt->GetAsym();
|
|---|
| 315 | const Double_t leakage = fMatrix ? GetVal(9): fNewImagePar->GetLeakage1();
|
|---|
| 316 |
|
|---|
| 317 |
|
|---|
| 318 | Double_t help;
|
|---|
| 319 | if (!fMatrix)
|
|---|
| 320 | help = TMath::Sign(fHilExt->GetM3Long(), fHilSrc->GetCosDeltaAlpha());
|
|---|
| 321 |
|
|---|
| 322 | // const Double_t asym0 = fMatrix ? GetVal(8) : help;
|
|---|
| 323 | // const Double_t conc = fMatrix ? GetVal(9) : fNewPar->GetConc();
|
|---|
| 324 | // const Double_t leakage = fMatrix ? GetVal(10): fNewPar->GetLeakage1();
|
|---|
| 325 |
|
|---|
| 326 | const Double_t newdist = dist0 * fMm2Deg;
|
|---|
| 327 |
|
|---|
| 328 | const Double_t dist2 = meanx*meanx + meany*meany;
|
|---|
| 329 | const Double_t dist = sqrt(dist2) * fMm2Deg;
|
|---|
| 330 | const Double_t dd2 = dist*dist;
|
|---|
| 331 |
|
|---|
| 332 | const Double_t dmls = log(size) - kNomLogSize;
|
|---|
| 333 | Double_t dmls2 = dmls * dmls;
|
|---|
| 334 |
|
|---|
| 335 | //const Double_t dmcza = cos(theta/kRad2Deg) - kNomCosZA;
|
|---|
| 336 |
|
|---|
| 337 | const Double_t length = length0 * fMm2Deg;
|
|---|
| 338 | const Double_t width = width0 * fMm2Deg;
|
|---|
| 339 | //const Double_t asym = asym0 * fMm2Deg;
|
|---|
| 340 |
|
|---|
| 341 | // *fLog << "Using SizeCut = " << fSizeCut << endl;
|
|---|
| 342 | /*
|
|---|
| 343 | *fLog << "newdist, length, width, asym, dist, conc, leakage = "
|
|---|
| 344 | << newdist << ", " << length << ", " << width << ", "
|
|---|
| 345 | << asym << ", " << dist << ", " << conc << ", " << leakage
|
|---|
| 346 | << endl;
|
|---|
| 347 |
|
|---|
| 348 | *fLog << "upper cuts in newdist, length, width, asym, dist, conc, leakage = "
|
|---|
| 349 | << CtsMCut (fSuper->GetDistUp(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 350 | << CtsMCut (fSuper->GetDistLo(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 351 |
|
|---|
| 352 | << CtsMCut (fSuper->GetLengthUp(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 353 | << CtsMCut (fSuper->GetLengthLo(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 354 |
|
|---|
| 355 | << CtsMCut (fSuper->GetWidthUp(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 356 | << CtsMCut (fSuper->GetWidthLo(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 357 |
|
|---|
| 358 | << CtsMCut (fSuper->GetAsymUp(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 359 | << CtsMCut (fSuper->GetAsymLo(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 360 |
|
|---|
| 361 | << CtsMCut (fSuper->GetDistUp(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 362 | << CtsMCut (fSuper->GetDistLo(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 363 | fHadronness = hadronness;
|
|---|
| 364 |
|
|---|
| 365 | << CtsMCut (fSuper->GetConcUp(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 366 | << CtsMCut (fSuper->GetConcLo(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 367 |
|
|---|
| 368 | << CtsMCut (fSuper->GetLeakage1Up(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 369 | << CtsMCut (fSuper->GetLeakage1Lo(), dmls, dmcza, dmls2, dd2) << ", "
|
|---|
| 370 | << endl;
|
|---|
| 371 | */
|
|---|
| 372 |
|
|---|
| 373 | double dmcza = 0;
|
|---|
| 374 |
|
|---|
| 375 | // cout << fSizeCutLow << " " << fSizeCutUp << endl;
|
|---|
| 376 |
|
|---|
| 377 | if(fNoDistCut)
|
|---|
| 378 | {
|
|---|
| 379 | if ( size > fSizeCutLow && size < fSizeCutUp &&
|
|---|
| 380 |
|
|---|
| 381 | //newdist < CtsMCut (fSuper->GetDistUp(), dmls, dmls2) &&
|
|---|
| 382 | //newdist > CtsMCut (fSuper->GetDistLo(), dmls, dmls2) &&
|
|---|
| 383 |
|
|---|
| 384 | length< CtsMCut (fSuper->GetLengthUp(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 385 | length> CtsMCut (fSuper->GetLengthLo(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 386 |
|
|---|
| 387 | width< CtsMCut (fSuper->GetWidthUp(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 388 | width > CtsMCut (fSuper->GetWidthLo(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 389 |
|
|---|
| 390 | conc< CtsMCut (fSuper->GetConcUp(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 391 | conc > CtsMCut (fSuper->GetConcLo(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 392 |
|
|---|
| 393 | asym< CtsMCut (fSuper->GetAsymUp(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 394 | asym > CtsMCut (fSuper->GetAsymLo(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 395 |
|
|---|
| 396 | leakage < CtsMCut (fSuper->GetLeakage1Up(),dmls,dmls2, dmcza, dd2) &&
|
|---|
| 397 | leakage > CtsMCut (fSuper->GetLeakage1Lo(),dmls, dmls2, dmcza, dd2)
|
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 | )
|
|---|
| 401 |
|
|---|
| 402 | fHadronness->SetHadronness(0.25);
|
|---|
| 403 | else
|
|---|
| 404 | fHadronness->SetHadronness(0.75);
|
|---|
| 405 |
|
|---|
| 406 | }
|
|---|
| 407 | else
|
|---|
| 408 | {
|
|---|
| 409 | //cout << asym << endl;
|
|---|
| 410 | if (size > fSizeCutLow && size < fSizeCutUp &&
|
|---|
| 411 |
|
|---|
| 412 | newdist < CtsMCut (fSuper->GetDistUp(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 413 | newdist > CtsMCut (fSuper->GetDistLo(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 414 |
|
|---|
| 415 | length < CtsMCut (fSuper->GetLengthUp(),dmls, dmls2, dmcza, dd2) &&
|
|---|
| 416 | length > CtsMCut (fSuper->GetLengthLo(),dmls, dmls2, dmcza, dd2) &&
|
|---|
| 417 |
|
|---|
| 418 | width < CtsMCut (fSuper->GetWidthUp(),dmls, dmls2, dmcza, dd2) &&
|
|---|
| 419 | width > CtsMCut (fSuper->GetWidthLo(),dmls, dmls2, dmcza, dd2) &&
|
|---|
| 420 |
|
|---|
| 421 | asym< CtsMCut (fSuper->GetAsymUp(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 422 | asym > CtsMCut (fSuper->GetAsymLo(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 423 |
|
|---|
| 424 | conc< CtsMCut (fSuper->GetConcUp(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 425 | conc > CtsMCut (fSuper->GetConcLo(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 426 |
|
|---|
| 427 | leakage < CtsMCut (fSuper->GetLeakage1Up(),dmls,dmls2, dmcza, dd2) &&
|
|---|
| 428 | leakage > CtsMCut (fSuper->GetLeakage1Lo(),dmls, dmls2, dmcza, dd2)
|
|---|
| 429 |
|
|---|
| 430 | )
|
|---|
| 431 |
|
|---|
| 432 | fHadronness->SetHadronness(0.25);
|
|---|
| 433 | else
|
|---|
| 434 | fHadronness->SetHadronness(0.75);
|
|---|
| 435 | }
|
|---|
| 436 |
|
|---|
| 437 |
|
|---|
| 438 |
|
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 | //*fLog << "SChadroness = " << fHadronness->GetHadronness() << endl;
|
|---|
| 444 |
|
|---|
| 445 | fHadronness->SetReadyToSave();
|
|---|
| 446 |
|
|---|
| 447 | return kTRUE;
|
|---|
| 448 | }
|
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 |
|
|---|
| 453 |
|
|---|
| 454 | // ---------------------------------------------------------------------------
|
|---|
| 455 | //
|
|---|
| 456 | // Return kTRUE if the event pass the dist cut, ie., if it is a gamma-like
|
|---|
| 457 | // event.
|
|---|
| 458 | //
|
|---|
| 459 | Bool_t MMySuperCutsCalc::CalcDistCut(MHillasSrc* hillasSrc)
|
|---|
| 460 | {
|
|---|
| 461 |
|
|---|
| 462 |
|
|---|
| 463 |
|
|---|
| 464 | //const Double_t kNomLogSize = 7.6;//=log(2000) 4.1;
|
|---|
| 465 | const Double_t kNomLogSize = log(fSizeCutLow);
|
|---|
| 466 |
|
|---|
| 467 | const Double_t kNomCosZA = 1.0;
|
|---|
| 468 |
|
|---|
| 469 | //const Double_t theta = fMatrix ? GetVal(0) : fMcEvt->GetTelescopeTheta();
|
|---|
| 470 |
|
|---|
| 471 | // const Double_t width0 = fMatrix ? GetVal(0) : fHil->GetWidth();
|
|---|
| 472 | // const Double_t length0 = fMatrix ? GetVal(1) : fHil->GetLength();
|
|---|
| 473 | // const Double_t size = fMatrix ? GetVal(2) : fHil->GetSize();
|
|---|
| 474 | // const Double_t meanx = fMatrix ? GetVal(3) : fHil->GetMeanX();
|
|---|
| 475 | // const Double_t meany = fMatrix ? GetVal(4) : fHil->GetMeanY();
|
|---|
| 476 | // const Double_t dist0 = fMatrix ? GetVal(5) : fHilSrc->GetDist();
|
|---|
| 477 | // // const Double_t theta = fMatrix ? GetVal(7) : fPointingPos->GetZd();
|
|---|
| 478 | // const Double_t conc = fMatrix ? GetVal(8) : fNewImagePar->GetConc();
|
|---|
| 479 | // Double_t asym = fMatrix ? GetVal(9) : fHillasExt->GetAsym();
|
|---|
| 480 | // const Double_t leakage = fMatrix ? GetVal(10): fNewImagePar->GetLeakage1();
|
|---|
| 481 |
|
|---|
| 482 | // const Double_t theta =0;
|
|---|
| 483 |
|
|---|
| 484 | const Double_t width0 = fMatrix ? GetVal(0) : fHil->GetWidth();
|
|---|
| 485 | const Double_t length0 = fMatrix ? GetVal(1) : fHil->GetLength();
|
|---|
| 486 | const Double_t size = fMatrix ? GetVal(2) : fHil->GetSize();
|
|---|
| 487 | const Double_t meanx = fMatrix ? GetVal(3) : fHil->GetMeanX();
|
|---|
| 488 | const Double_t meany = fMatrix ? GetVal(4) : fHil->GetMeanY();
|
|---|
| 489 | const Double_t dist0 = fMatrix ? GetVal(5) : fHilSrc->GetDist();
|
|---|
| 490 | const Double_t conc = fMatrix ? GetVal(7) : fNewImagePar->GetConc();
|
|---|
| 491 | Double_t asym = fMatrix ? GetVal(8) : fHillasExt->GetAsym();
|
|---|
| 492 | const Double_t leakage = fMatrix ? GetVal(9): fNewImagePar->GetLeakage1();
|
|---|
| 493 |
|
|---|
| 494 |
|
|---|
| 495 | Double_t help;
|
|---|
| 496 | if (!fMatrix)
|
|---|
| 497 | help = TMath::Sign(fHilExt->GetM3Long(), fHilSrc->GetCosDeltaAlpha());
|
|---|
| 498 |
|
|---|
| 499 | // const Double_t asym0 = fMatrix ? GetVal(8) : help;
|
|---|
| 500 | // const Double_t conc = fMatrix ? GetVal(9) : fNewPar->GetConc();
|
|---|
| 501 | // const Double_t leakage = fMatrix ? GetVal(10): fNewPar->GetLeakage1();
|
|---|
| 502 |
|
|---|
| 503 | const Double_t newdist = dist0 * fMm2Deg;
|
|---|
| 504 |
|
|---|
| 505 | const Double_t dist2 = meanx*meanx + meany*meany;
|
|---|
| 506 | const Double_t dist = sqrt(dist2) * fMm2Deg;
|
|---|
| 507 | const Double_t dd2 = dist*dist;
|
|---|
| 508 |
|
|---|
| 509 | const Double_t dmls = log(size) - kNomLogSize;
|
|---|
| 510 | Double_t dmls2 = dmls * dmls;
|
|---|
| 511 |
|
|---|
| 512 | //const Double_t dmcza = cos(theta/kRad2Deg) - kNomCosZA;
|
|---|
| 513 |
|
|---|
| 514 | const Double_t length = length0 * fMm2Deg;
|
|---|
| 515 | const Double_t width = width0 * fMm2Deg;
|
|---|
| 516 | //const Double_t asym = asym0 * fMm2Deg;
|
|---|
| 517 |
|
|---|
| 518 |
|
|---|
| 519 | double dmcza = 0;
|
|---|
| 520 |
|
|---|
| 521 | if (
|
|---|
| 522 | newdist < CtsMCut (fSuper->GetDistUp(), dmls, dmls2, dmcza, dd2) &&
|
|---|
| 523 | newdist > CtsMCut (fSuper->GetDistLo(), dmls, dmls2, dmcza, dd2)
|
|---|
| 524 | )
|
|---|
| 525 | return kTRUE;
|
|---|
| 526 |
|
|---|
| 527 |
|
|---|
| 528 | return kFALSE;
|
|---|
| 529 | }
|
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 | // // ---------------------------------------------------------------------------
|
|---|
| 533 | // //
|
|---|
| 534 | // //
|
|---|
| 535 | // //
|
|---|
| 536 | // Double_t MMySuperCutsCalc::Calc(MMySuperCuts* super, MHillas* hillas, MHillasSrc* hillasSrc, MHadronness* hadronness)
|
|---|
| 537 | // {
|
|---|
| 538 |
|
|---|
| 539 | // MGeomCamMagic cam;
|
|---|
| 540 | // fMm2Deg = cam.GetConvMm2Deg();
|
|---|
| 541 |
|
|---|
| 542 | // fSuper = super; // Container with the optimazed cuts
|
|---|
| 543 | // fHil = hillas;
|
|---|
| 544 | // fHilSrc = hillasSrc;
|
|---|
| 545 | // fHadronness = hadronness;
|
|---|
| 546 |
|
|---|
| 547 | // Process();
|
|---|
| 548 |
|
|---|
| 549 | // return fHadronness->GetHadronness();
|
|---|
| 550 | // }
|
|---|
| 551 |
|
|---|