Changeset 7178 for trunk/MagicSoft
- Timestamp:
- 07/08/05 18:14:35 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7177 r7178 52 52 * mimage/MHillasCalc.cc: 53 53 - skipped printing the removed case 4 from MHillas::Calc 54 55 * mbase/MStatusDisplay.cc: 56 - fixed wrong "save as" in "open" dialog 57 58 * mbase/MTaskInteractive.[h,cc]: 59 - added ReInit 60 61 * mhflux/MAlphaFitter.cc: 62 - fixed the standard polynom order (0 instead of 1) for 63 difference histogram 64 - changed default start velue for gauss sigma in case of kThetaSq 65 66 * mhflux/MHAlpha.cc, mhflux/MHCollectionArea.cc, 67 mhflux/MHEffectiveOnTime.cc, mhflux/MHThetaSq.cc, 68 mjobs/MJCut.cc: 69 - enhanced zenith angle range 70 71 * mhflux/MHFalseSource.h: 72 - made GetCatalog protected 73 - made SetOffData virtual 74 75 * mhflux/MHThreshold.cc: 76 - enabled Sumw2 77 78 * mjobs/MJCut.cc: 79 - removed BinningEnergyEst 80 81 * mpointing/MPointingPos.h: 82 - added copy constructor 83 84 * mpointing/MSrcPosCorrect.cc: 85 - added a comment 86 87 * mranforest/MRFEnergyEst.[h,cc]: 88 - now stores the mean energy of the bins in the forest 89 - implemented several interpolation methods 54 90 55 91 -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r7092 r7178 2896 2896 fi.fIniDir = StrDup(dir); 2897 2897 2898 new TGFileDialog(fClient->GetRoot(), this, kFD Save, &fi);2898 new TGFileDialog(fClient->GetRoot(), this, kFDOpen, &fi); 2899 2899 2900 2900 if (!fi.fFilename) -
trunk/MagicSoft/Mars/mbase/MTaskInteractive.cc
r4513 r7178 83 83 fCall[1] = 0; 84 84 fCall[2] = 0; 85 fCall[3] = 0; 85 86 } 86 87 … … 94 95 Free(1); 95 96 Free(2); 97 Free(3); 96 98 } 97 99 … … 141 143 { 142 144 case 0: 143 gLog << "Pre"; 145 gLog << "PreProcess"; 146 break; 147 case 1: 148 gLog << "Process"; 144 149 break; 145 150 case 2: 146 gLog << "Post"; 151 gLog << "PostProcess"; 152 break; 153 case 3: 154 gLog << "ReInit"; 147 155 break; 148 156 149 157 } 150 gLog << " Process-function." << endl;158 gLog << "-function." << endl; 151 159 152 160 return kTRUE; -
trunk/MagicSoft/Mars/mbase/MTaskInteractive.h
r4452 r7178 12 12 { 13 13 private: 14 TMethodCall *fCall[ 3];14 TMethodCall *fCall[4]; 15 15 16 Int_t (*fPreProcess)(MParList *list); 17 Int_t (*fProcess)(); 18 Int_t (*fPostProcess)(); 16 Int_t (*fPreProcess)(MParList *list); 17 Int_t (*fProcess)(); 18 Int_t (*fPostProcess)(); 19 Bool_t (*fReInit)(MParList *list); 19 20 20 Int_t PreProcess(MParList *list) { if (fCall[0]) return Return(0, &list); return fPreProcess ? (*fPreProcess)(list) : kTRUE; } 21 Int_t Process() { if (fCall[1]) return Return(1); return fProcess ? (*fProcess)() : kTRUE; } 22 Int_t PostProcess() { if (fCall[2]) return Return(2); return fPostProcess ? (*fPostProcess)() : kTRUE; } 21 Int_t PreProcess(MParList *list) { if (fCall[0]) return Return(0, &list); return fPreProcess ? (*fPreProcess)(list) : kTRUE; } 22 Int_t Process() { if (fCall[1]) return Return(1); return fProcess ? (*fProcess)() : kTRUE; } 23 Int_t PostProcess() { if (fCall[2]) return Return(2); return fPostProcess ? (*fPostProcess)() : kTRUE; } 24 Bool_t ReInit(MParList *list) { if (fCall[3]) return Return(3, &list); return fPostProcess ? (*fPostProcess)() : kTRUE; } 23 25 24 26 Int_t Return(Int_t no, void *param=NULL); … … 32 34 // This is to be used in compiled code 33 35 void SetPreProcess(Int_t (*func)(MParList *list)) { fPreProcess = func; Free(0); } 34 void SetProcess(Int_t (*func)()) { fProcess = func; Free(1); } 35 void SetPostProcess(Int_t (*func)()) { fPostProcess = func; Free(2); } 36 void SetProcess(Int_t (*func)()) { fProcess = func; Free(1); } 37 void SetPostProcess(Int_t (*func)()) { fPostProcess = func; Free(2); } 38 void SetReInit(Bool_t (*func)(MParList *list)) { fReInit = func; Free(3); } 36 39 37 40 // This is for usage in CINT … … 39 42 void SetProcess(void *fcn) { Set(fcn, 1, ""); fProcess =0; } 40 43 void SetPostProcess(void *fcn) { Set(fcn, 2, ""); fPostProcess=0; } 44 void SetReInit(void *fcn) { Set(fcn, 3, "MParList*"); fReInit =0; } 41 45 42 46 ClassDef(MTaskInteractive, 0) // Interactive task -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
r7169 r7178 178 178 // Now fit a gaus in the on region on top of the polynom 179 179 fFunc->SetParameter(0, A); 180 fFunc->SetParameter(2, sigmax*0.75);180 fFunc->SetParameter(2, fSignalFunc==kGauss ? sigmax*0.75 : sigmax); 181 181 182 182 // options : N do not store the function, do not draw … … 231 231 232 232 MAlphaFitter fit(*this); 233 fit.SetPolynomOrder( 1);233 fit.SetPolynomOrder(0); 234 234 235 235 if (alpha<=0 || !fit.Fit(h, paint)) -
trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
r7151 r7178 139 139 binsa.SetEdges(18, 0, 90); 140 140 binse.SetEdgesLog(15, 10, 100000); 141 binst.SetEdgesASin( 51, -0.005, 0.505);141 binst.SetEdgesASin(67, -0.005, 0.665); 142 142 binse.Apply(fHEnergy); 143 143 binst.Apply(fHTheta); -
trunk/MagicSoft/Mars/mhflux/MHCollectionArea.cc
r7170 r7178 94 94 MBinning binsa, binse, binst; 95 95 binse.SetEdgesLog(15, 10, 1000000); 96 binst.SetEdgesASin( 51, -0.005, 0.505);96 binst.SetEdgesASin(67, -0.005, 0.665); 97 97 98 98 binse.Apply(fHEnergy); -
trunk/MagicSoft/Mars/mhflux/MHEffectiveOnTime.cc
r7142 r7178 410 410 // setup binning 411 411 MBinning btheta("BinningTheta"); 412 btheta.SetEdgesASin( 51, -0.005, 0.505);412 btheta.SetEdgesASin(67, -0.005, 0.665); 413 413 414 414 MBinning btime("BinningDeltaT"); -
trunk/MagicSoft/Mars/mhflux/MHFalseSource.h
r7109 r7178 46 46 Double_t fDec; 47 47 48 TObject *GetCatalog(); 49 48 50 private: 49 51 Int_t DistancetoPrimitive(Int_t px, Int_t py); … … 54 56 void ProjectOn(const TH3D &src, TH2D *h, TH2D *all); 55 57 void ProjectOnOff(TH2D *h, TH2D *all); 56 57 TObject *GetCatalog();58 58 59 59 void MakeSymmetric(TH1 *h); … … 78 78 void SetBgMeanMinus5() { SetBgMean(fBgMean-5); } //*MENU* 79 79 80 v oid SetOffData(const MHFalseSource &fs) {80 virtual void SetOffData(const MHFalseSource &fs) { 81 81 fHistOff = &fs.fHist; 82 82 fMinDist = fs.fMinDist; -
trunk/MagicSoft/Mars/mhflux/MHThetaSq.cc
r7147 r7178 92 92 //binsa.SetEdges(arr); 93 93 binse.SetEdgesLog(15, 10, 100000); 94 binst.SetEdges Cos(50, 0, 60);94 binst.SetEdgesASin(67, -0.005, 0.665); 95 95 binsa.Apply(fHistTime); 96 96 -
trunk/MagicSoft/Mars/mhflux/MHThreshold.cc
r7170 r7178 74 74 fHEnergy.SetDirectory(NULL); 75 75 fHEnergy.UseCurrentStyle(); 76 fHEnergy.Sumw2(); 76 77 77 78 MBinning binse(80, 10, 1000000, "", "log"); -
trunk/MagicSoft/Mars/mjobs/MJCut.cc
r7169 r7178 445 445 446 446 // Initialize default binnings 447 MBinning bins1(18, 0, 90, "BinningAlpha", 448 MBinning bins2(15, 10, 1e6 , "Binning EnergyEst","log");449 MBinning bins3( 51, -0.005, 0.505, "BinningTheta","asin");447 MBinning bins1(18, 0, 90, "BinningAlpha", "lin"); 448 MBinning bins2(15, 10, 1e6 , "BinningSize", "log"); 449 MBinning bins3(67, -0.005, 0.665, "BinningTheta", "asin"); 450 450 MBinning bins4("BinningFalseSource"); 451 451 MBinning bins5("BinningWidth"); … … 465 465 plist.AddToList(&bins9); 466 466 plist.AddToList(&bins0); 467 //plist.AddToList(&binsa); 467 468 468 469 // -------------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mpointing/MPointingPos.h
r5117 r7178 30 30 fTitle = title ? title : "Container storing the (corrected) telescope pointing position"; 31 31 } 32 MPointingPos(const MPointingPos &p) : MParContainer(p), 33 fZd(p.fZd), fAz(p.fAz), fRa(p.fRa), fHa(p.fHa), fDec(p.fDec) 34 { 35 } 32 36 33 37 void SetLocalPosition(Double_t zd, Double_t az) { fZd=zd; fAz=az; } -
trunk/MagicSoft/Mars/mpointing/MSrcPosCorrect.cc
r7143 r7178 135 135 if (fRunNumber<56161 && fRunNumber>53832) 136 136 { 137 // dx=-0.05deg, dy=0.03deg, d=0.06deg 137 138 static const TVector2 dxy(-14.24, -9.495); 138 139 fSrcPosCam->Add(dxy); -
trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.cc
r7169 r7178 69 69 // 70 70 MRFEnergyEst::MRFEnergyEst(const char *name, const char *title) 71 : fNumTrees(-1), fNumTry(-1), fNdSize(-1), fDebug(kFALSE), 72 fData(0), fEnergyEst(0), fTestMatrix(0), fEstimationMode(kMean) 71 : fDebug(kFALSE), fData(0), fEnergyEst(0), 72 fNumTrees(-1), fNumTry(-1), fNdSize(-1), 73 fTestMatrix(0), fEstimationMode(kMean) 73 74 { 74 75 fName = name ? name : gsDefName.Data(); 75 76 fTitle = title ? title : gsDefTitle.Data(); 77 } 78 79 MRFEnergyEst::~MRFEnergyEst() 80 { 81 fEForests.Delete(); 76 82 } 77 83 … … 163 169 MHMatrix matrix1(mat1, "MatrixHadrons"); 164 170 MHMatrix matrix0(mat0, "MatrixGammas"); 165 166 //matrix1.AddColumns(&usedrules);167 //matrix0.AddColumns(&usedrules);168 171 169 172 // training of RF … … 191 194 gLog.SetNullOutput(kFALSE); 192 195 193 const Double_t E = (log10(grid[ie])+log10(grid[ie+1]))/2; 196 // Calculate bin center 197 const Double_t E = (TMath::Log10(grid[ie])+TMath::Log10(grid[ie+1]))/2; 194 198 195 199 // save whole forest 196 200 MRanForest *forest=(MRanForest*)plist.FindObject("MRanForest"); 197 const TString title = Form("%.10f", E); 198 forest->SetTitle(title); 199 forest->Write(title); 201 forest->SetUserVal(E); 202 forest->Write(Form("%.10f", E)); 200 203 } 201 204 … … 203 206 usedrules.Write("rules"); 204 207 205 fileRF.Close();206 207 208 return kTRUE; 208 209 } … … 210 211 Int_t MRFEnergyEst::ReadForests(MParList &plist) 211 212 { 212 TFile fileRF(fFileName, "read");213 TFile fileRF(fFileName, "read"); 213 214 if (!fileRF.IsOpen()) 214 215 { … … 218 219 219 220 fEForests.Delete(); 220 221 Int_t i=0;222 221 223 222 TIter Next(fileRF.GetListOfKeys()); … … 230 229 continue; 231 230 232 forest->SetTitle(o->GetTitle()); 233 forest->SetBit(kCanDelete); 234 235 fBinning.Set(i+1); 236 fBinning[i++] = atof(o->GetTitle()); 231 forest->SetUserVal(atof(o->GetName())); 237 232 238 233 fEForests.Add(forest); … … 283 278 // 284 279 // 280 #include <TGraph.h> 281 #include <TF1.h> 285 282 Int_t MRFEnergyEst::Process() 286 283 { 284 static TF1 f1("f1", "gaus"); 285 287 286 TVector event; 288 287 if (fTestMatrix) … … 291 290 *fData >> event; 292 291 293 Double_t eest= 0;294 Double_t hsum= 0;292 Double_t sume = 0; 293 Double_t sumh = 0; 295 294 Double_t maxh = 0; 296 295 Double_t maxe = 0; 297 296 298 Int_t i=0; 297 Double_t max = -1e10; 298 Double_t min = 1e10; 299 300 //TH1C h("", "", fEForests.GetSize(), 0, 1); 299 301 300 302 TIter Next(&fEForests); 301 303 MRanForest *rf = 0; 304 305 TGraph g; 302 306 while ((rf=(MRanForest*)Next())) 303 307 { 304 308 const Double_t h = rf->CalcHadroness(event); 305 const Double_t e = fBinning[i++];306 307 hsum +=h;308 eest += e*h;309 const Double_t e = rf->GetUserVal(); 310 g.SetPoint(g.GetN(), e, h); 311 sume += e*h; 312 sumh += h; 309 313 if (h>maxh) 310 314 { … … 312 316 maxe = e; 313 317 } 318 if (e>max) 319 max = e; 320 if (e<min) 321 min = e; 314 322 } 315 323 … … 317 325 { 318 326 case kMean: 319 fEnergyEst->SetVal(pow(10, eest/hsum));327 fEnergyEst->SetVal(pow(10, sume/sumh)); 320 328 break; 321 329 case kMaximum: 322 330 fEnergyEst->SetVal(pow(10, maxe)); 323 331 break; 332 case kFit: 333 f1.SetParameter(0, maxh); 334 f1.SetParameter(1, maxe); 335 f1.SetParameter(2, 0.125); 336 g.Fit(&f1, "Q0N"); 337 fEnergyEst->SetVal(pow(10, f1.GetParameter(1))); 338 break; 339 324 340 } 325 341 fEnergyEst->SetReadyToSave(); … … 353 369 if (txt==(TString)"maximum") 354 370 fEstimationMode = kMaximum; 371 if (txt==(TString)"fit") 372 fEstimationMode = kFit; 355 373 rc = kTRUE; 356 374 } -
trunk/MagicSoft/Mars/mranforest/MRFEnergyEst.h
r7169 r7178 23 23 { 24 24 kMean, 25 kMaximum 25 kMaximum, 26 kFit 26 27 }; 27 28 private: 28 Int_t fNumTrees; // Training parameters 29 Int_t fNumTry; // Training parameters 30 Int_t fNdSize; // Training parameters 29 Bool_t fDebug; // Debugging of eventloop while training on/off 31 30 32 Bool_t fDebug; // Debugging of eventloop while training on/off 33 34 TString fFileName; 35 TObjArray fEForests; 31 TString fFileName; // File name to forest 32 TObjArray fEForests; // List of forests 36 33 37 34 MDataArray *fData; //! Used to store the MDataChains to get the event values 38 35 MParameterD *fEnergyEst; //! Used to storeestimated energy 39 36 40 MHMatrix *fTestMatrix; 37 Int_t fNumTrees; //! Training parameters 38 Int_t fNumTry; //! Training parameters 39 Int_t fNdSize; //! Training parameters 41 40 42 TArrayD fBinning;41 MHMatrix *fTestMatrix; //! Test Matrix 43 42 44 43 EstimationMode_t fEstimationMode; 45 44 45 // MRFEnergyEst 46 Int_t ReadForests(MParList &plist); 47 48 // MTask 46 49 Int_t PreProcess(MParList *plist); 47 50 Int_t Process(); 48 51 49 Int_t ReadForests(MParList &plist); 50 52 // MParContainer 51 53 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 52 54 53 55 public: 54 56 MRFEnergyEst(const char *name=NULL, const char *title=NULL); 57 ~MRFEnergyEst(); 55 58 59 // Setter for estimation 56 60 void SetFileName(TString str) { fFileName = str; } 61 void SetEstimationMode(EstimationMode_t op) { fEstimationMode = op; } 57 62 63 // Setter for training 58 64 void SetNumTrees(Int_t n=-1) { fNumTrees = n; } 59 65 void SetNdSize(Int_t n=-1) { fNdSize = n; } 60 66 void SetNumTry(Int_t n=-1) { fNumTry = n; } 67 void SetDebug(Bool_t b=kTRUE) { fDebug = b; } 61 68 69 // Train Interface 70 Int_t Train(const MHMatrix &n, const TArrayD &grid); 71 72 // Test Interface 62 73 void SetTestMatrix(MHMatrix *m=0) { fTestMatrix=m; } 63 74 void InitMapping(MHMatrix *m=0) { fTestMatrix=m; } 64 65 void SetDebug(Bool_t b=kTRUE) { fDebug = b; }66 67 void SetEstimationMode(EstimationMode_t op) { fEstimationMode = op; }68 69 Int_t Train(const MHMatrix &n, const TArrayD &grid);70 75 71 76 ClassDef(MRFEnergyEst, 0) // Task
Note:
See TracChangeset
for help on using the changeset viewer.