Changeset 2225 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 06/24/03 10:15:42 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc
r2206 r2225 33 33 #include <fstream> 34 34 35 #include "MLog.h"36 #include "MLogManip.h"37 38 35 #include "MParList.h" 39 36 #include "MHillasExt.h" … … 43 40 #include "MGeomCam.h" 44 41 #include "MHadronness.h" 42 #include "MHMatrix.h" 43 44 #include "MLog.h" 45 #include "MLogManip.h" 45 46 46 47 ClassImp(MCT1SupercutsCalc); … … 50 51 void MCT1SupercutsCalc::InitParams() 51 52 { 53 fLengthUp.Set(8); 54 fLengthLo.Set(8); 55 fWidthUp.Set(8); 56 fWidthLo.Set(8); 57 fDistUp.Set(8); 58 fDistLo.Set(8); 59 fAsymUp.Set(8); 60 fAsymLo.Set(8); 61 fAlphaUp.Set(8); 62 52 63 //--------------------------------- 53 64 // cut parameters … … 151 162 Int_t MCT1SupercutsCalc::PreProcess(MParList *pList) 152 163 { 164 MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam"); 165 if (!cam) 166 { 167 *fLog << err << "MGeomCam (Camera Geometry) not found... aborting." << endl; 168 return kFALSE; 169 } 170 171 fMm2Deg = cam->GetConvMm2Deg(); 172 173 fHadronness = (MHadronness*)pList->FindCreateObj("MHadronness", fHadronnessName); 174 if (!fHadronness) 175 { 176 *fLog << err << fHadronnessName << " [MHadronness] not found... aborting." << endl; 177 return kFALSE; 178 } 179 180 if (fMatrix) 181 return kTRUE; 182 153 183 fHil = (MHillas*)pList->FindObject(fHilName, "MHillas"); 154 184 if (!fHil) … … 172 202 } 173 203 174 MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam");175 if (!cam)176 {177 *fLog << err << "MGeomCam (Camera Geometry) not found... aborting." << endl;178 return kFALSE;179 }180 181 fMm2Deg = cam->GetConvMm2Deg();182 183 fHadronness = (MHadronness*)pList->FindCreateObj("MHadronness", fHadronnessName);184 if (!fHadronness)185 {186 *fLog << err << fHadronnessName << " [MHadronness] not found... aborting." << endl;187 return kFALSE;188 }189 190 191 204 return kTRUE; 192 205 } … … 196 209 // Calculation of upper and lower limits 197 210 // 198 Double_t MCT1SupercutsCalc::CtsMCut(Double_t *a, Double_t ls, Double_t ct, 211 Double_t MCT1SupercutsCalc::CtsMCut( 212 #if ROOT_VERSION_CODE > ROOT_VERSION(3,05,00) 213 const 214 #endif 215 TArrayD &a, Double_t ls, Double_t ct, 199 216 Double_t ls2, Double_t dd2) 200 217 { … … 209 226 // ct: Cos(ZA.) - dNOMCOSZA 210 227 // dd2: DIST^2 211 212 228 const Double_t limit = 213 229 a[0] + a[1] * dd2 + a[2] * ct + … … 225 241 226 242 return limit; 243 } 244 245 // -------------------------------------------------------------------------- 246 // 247 // Returns the mapped value from the Matrix 248 // 249 Double_t MCT1SupercutsCalc::GetVal(Int_t i) const 250 { 251 return (*fMatrix)[fMap[i]]; 252 } 253 254 // -------------------------------------------------------------------------- 255 // 256 // You can use this function if you want to use a MHMatrix instead of the 257 // given containers. This function adds all necessary columns to the 258 // given matrix. Afterward you should fill the matrix with the corresponding 259 // data (eg from a file by using MHMatrix::Fill). If you now loop 260 // through the matrix (eg using MMatrixLoop) MEnergyEstParam::Process 261 // will take the values from the matrix instead of the containers. 262 // 263 void MCT1SupercutsCalc::InitMapping(MHMatrix *mat) 264 { 265 if (fMatrix) 266 return; 267 268 fMatrix = mat; 269 270 fMap[0] = fMatrix->AddColumn("MMcEvt.fTelescopeTheta"); 271 fMap[1] = fMatrix->AddColumn("MHillas.fWidth"); 272 fMap[2] = fMatrix->AddColumn("MHillas.fLength"); 273 fMap[3] = fMatrix->AddColumn("MHillas.fSize"); 274 fMap[4] = fMatrix->AddColumn("MHillas.fMeanX"); 275 fMap[5] = fMatrix->AddColumn("MHillas.fMeanY"); 276 fMap[6] = fMatrix->AddColumn("MHillasSrc.fDist"); 227 277 } 228 278 … … 240 290 const Double_t kNomCosZA = 1.0; 241 291 242 const Double_t newdist = fHilSrc->GetDist() * fMm2Deg; 243 244 const Double_t xbar = fHil->GetMeanX(); 245 const Double_t ybar = fHil->GetMeanY(); 246 const Double_t dist = sqrt(xbar*xbar + ybar*ybar) * fMm2Deg; 247 const Double_t dd2 = dist * dist; 248 249 const Double_t dmls = log(fHil->GetSize()) - kNomLogSize; 292 const Double_t theta = fMatrix ? GetVal(0) : fMcEvt->GetTelescopeTheta(); 293 const Double_t width0 = fMatrix ? GetVal(1) : fHil->GetWidth(); 294 const Double_t length0 = fMatrix ? GetVal(2) : fHil->GetLength(); 295 const Double_t size = fMatrix ? GetVal(3) : fHil->GetSize(); 296 const Double_t meanx = fMatrix ? GetVal(4) : fHil->GetMeanX(); 297 const Double_t meany = fMatrix ? GetVal(5) : fHil->GetMeanY(); 298 const Double_t dist0 = fMatrix ? GetVal(6) : fHilSrc->GetDist(); 299 300 const Double_t newdist = dist0 * fMm2Deg; 301 302 const Double_t dist2 = meanx*meanx + meany*meany; 303 const Double_t dd2 = dist2*fMm2Deg; 304 const Double_t dist = sqrt(dist2) * fMm2Deg; 305 306 const Double_t dmls = log(size) - kNomLogSize; 250 307 const Double_t dmls2 = dmls * dmls; 251 308 252 const Double_t dmcza = cos(fMcEvt->GetTelescopeTheta()) - kNomCosZA; 253 254 const Double_t length = fHil->GetLength() * fMm2Deg; 255 const Double_t width = fHil->GetWidth() * fMm2Deg; 256 257 //*fLog << "MCT1SupercutsCalc::Process; dmls, dmcza, dmls2, dd2 = " 258 // << dmls << ", " << dmcza << ", " << dmls2 << ", " 259 // << dd2 << endl; 260 261 //*fLog << "MCT1SupercutsCalc::Process; newdist, dist, length, width = " 262 // << newdist << ", " << dist << ", " << length << ", " 263 // << width << endl; 309 const Double_t dmcza = cos(theta) - kNomCosZA; 310 311 const Double_t length = length0 * fMm2Deg; 312 const Double_t width = width0 * fMm2Deg; 264 313 265 314 if (newdist < 1.05 && -
trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.h
r2206 r2225 2 2 #define MARS_MCT1SupercutsCalc 3 3 4 /////////////////////////////////////////////////////////////////////////////5 // //6 // MCT1SupercutsCalc //7 // //8 /////////////////////////////////////////////////////////////////////////////9 10 4 #ifndef MARS_MFilter 11 5 #include "MFilter.h" 6 #endif 7 8 #ifndef ROOT_TArrayD 9 #include <TArrayD.h> 12 10 #endif 13 11 … … 19 17 class MGeomCam; 20 18 class MHadronness; 19 class MHMatrix; 21 20 22 21 … … 35 34 Double_t fMm2Deg; 36 35 36 Int_t fMap[7]; 37 MHMatrix *fMatrix; 38 37 39 //--------------------------------- 38 40 // cut parameters 39 Double_t fLengthUp[8];40 Double_t fWidthUp[8];41 Double_t fDistUp[8];42 Double_t fLengthLo[8];43 Double_t fWidthLo[8];44 Double_t fDistLo[8];45 Double_t fAsymUp[8];46 Double_t fAsymLo[8];47 Double_t fAlphaUp[8];41 TArrayD fLengthUp; 42 TArrayD fLengthLo; 43 TArrayD fWidthUp; 44 TArrayD fWidthLo; 45 TArrayD fDistUp; 46 TArrayD fDistLo; 47 TArrayD fAsymUp; 48 TArrayD fAsymLo; 49 TArrayD fAlphaUp; 48 50 //--------------------------------- 49 51 … … 53 55 Int_t Process(); 54 56 57 void Set(TArrayD &a, const TArrayD &b) { if (a.GetSize()==b.GetSize()) a=b; } 58 Double_t GetVal(Int_t i) const; 59 60 Double_t CtsMCut( 61 #if ROOT_VERSION_CODE > ROOT_VERSION(3,05,00) 62 const 63 #endif 64 TArrayD &a, Double_t ls, Double_t ct, 65 Double_t ls2, Double_t dd2); 66 55 67 public: 56 68 MCT1SupercutsCalc(const char *hilname="MHillas", … … 58 70 const char *name=NULL, const char *title=NULL); 59 71 60 Double_t CtsMCut(Double_t *a, Double_t ls, Double_t ct,61 Double_t ls2, Double_t dd2);62 63 72 void SetHadronnessName(const TString name) { fHadronnessName = name; } 64 73 TString GetHadronnessName() const { return fHadronnessName; } 74 75 void InitMapping(MHMatrix *mat); 76 void StopMapping() { InitMapping(NULL); } 77 78 void SetLengthUp(const TArrayD &d) { Set(fLengthUp, d); } 79 void SetLengthLo(const TArrayD &d) { Set(fLengthLo, d); } 80 void SetWidthUp (const TArrayD &d) { Set(fWidthUp, d); } 81 void SetWidthLo (const TArrayD &d) { Set(fWidthLo, d); } 82 void SetDistUp (const TArrayD &d) { Set(fDistUp, d); } 83 void SetDistLo (const TArrayD &d) { Set(fDistLo, d); } 84 void SetAsymUp (const TArrayD &d) { Set(fAsymUp, d); } 85 void SetAsymLo (const TArrayD &d) { Set(fAsymLo, d); } 86 void SetAlphaUp (const TArrayD &d) { Set(fAlphaUp, d); } 87 88 const TArrayD &GetLengthUp() const { return fLengthUp; } 89 const TArrayD &GetLengthLo() const { return fLengthLo; } 90 const TArrayD &GetWidthUp() const { return fWidthUp; } 91 const TArrayD &GetWithLo() const { return fWidthLo; } 92 const TArrayD &GetDistUp() const { return fDistUp; } 93 const TArrayD &GetDistLo() const { return fDistLo; } 94 const TArrayD &GetAsymUp() const { return fAsymUp; } 95 const TArrayD &GetAsymLo() const { return fAsymLo; } 96 const TArrayD &GetAlphaUp() const { return fAlphaUp; } 65 97 66 98 ClassDef(MCT1SupercutsCalc, 0) // A class to evaluate the Supercuts -
trunk/MagicSoft/Mars/manalysis/MEnergyEstParam.h
r2206 r2225 19 19 { 20 20 private: 21 Int_t fMap[100]; 21 Int_t fMap[100]; // FIXME! 22 22 23 23 MHMatrix *fMatrix;
Note:
See TracChangeset
for help on using the changeset viewer.