Changeset 4358 for trunk/MagicSoft
- Timestamp:
- 06/28/04 16:34:45 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/starfield.C
r4343 r4358 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): Thomas Bretz 5/2004 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2004 21 ! 22 ! 23 \* ======================================================================== */ 24 25 /////////////////////////////////////////////////////////////////////////// 26 // 27 // starfield.C 28 // =========== 29 // 30 // This is a macro demonstrating how to use Mars to display a starfield. 31 // It also is a tutorial for MAstroCatalog and MAstroCamera. 32 // 33 // For more details on this classes see the class-reference. 34 // 35 // If you want to display stars in a camera you need the camera geometry 36 // and the mirror definition. You can get this either from a Monte Carlo 37 // file containing both or create your MGeomCam object manually and 38 // read a magic.def file which you will find in the camera simulation 39 // program. 40 // 41 /////////////////////////////////////////////////////////////////////////// 42 1 43 void ReadSetup(TString fname, MAstroCamera &cam) 2 44 { … … 13 55 cam.SetMirrors(*config->GetMirrors()); 14 56 cam.SetGeom(*geom); 57 58 /* Alternative: 59 60 MGeomCamMagic geom; 61 cam.SetGeom(geom); 62 cam.SetMirrors("magic.def"); 63 */ 15 64 } 16 65 -
trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc
r4213 r4358 30 30 // THIS IMPLEMENTATION IS PRELIMINARY AND WILL BE MERGED WITH 31 31 // SOME PARTS OF THE DRIVE SOFTWARE SOON! 32 // 33 // 34 // Catalogs: 35 // --------- 36 // 37 // To be able to use this class you need a catalog file suppored by 38 // MAstroCatalog. 39 // Catalog files can be found at 40 // http://magic.astro.uni-wuerzburg.de/mars/catalogs.html 41 // You must copy the file into the directory from which you start your macro 42 // or give an abolute path loading the catalog. 32 43 // 33 44 // … … 106 117 // - a derived class is missing which supports all astrometrical 107 118 // correction (base on slalib and useable in Cosy) 119 // - Implement a general loader for heasarc catlogs, see 120 // http://heasarc.gsfc.nasa.gov/W3Browse/star-catalog/ 108 121 // 109 122 ////////////////////////////////////////////////////////////////////////////// … … 517 530 // to a file outname. This files will contain an apropriate compressed 518 531 // file format. You can read such files again using ReadCompressed. 532 // 533 // FIXME: A General loader for heasarc catlogs is missing, see 534 // http://heasarc.gsfc.nasa.gov/W3Browse/star-catalog/ 519 535 // 520 536 Int_t MAstroCatalog::ReadHeasarcPPM(TString catalog, TString outname) -
trunk/MagicSoft/Mars/mbase/MTime.cc
r3969 r4358 77 77 78 78 #include "MLog.h" 79 #include "MLogManip.h" 80 79 81 #include "MAstro.h" 80 82 … … 504 506 GetTime(h, m, s, ms); 505 507 506 *fLog << GetDescriptor() << ": ";508 *fLog << all << GetDescriptor() << ": "; 507 509 *fLog << GetString() << Form(" (+%dns)", fNanoSec) << endl; 508 510 } -
trunk/MagicSoft/Mars/mfit/MTFitLoop.cc
r3582 r4358 47 47 #include "MTFitLoop.h" 48 48 49 #include <TArrayD.h> 49 50 #include <TMinuit.h> 50 51 #include <TStopwatch.h> 51 52 52 53 #include "MParList.h" 54 #include "MTaskList.h" 55 #include "MEvtLoop.h" 56 57 #include "MParameters.h" 58 53 59 #include "MRead.h" 54 #include "MEvtLoop.h"55 60 56 61 #include "MLog.h" 57 62 #include "MLogManip.h" 63 64 ClassImp(MTFitLoop); 65 66 using namespace std; 58 67 59 68 //------------------------------------------------------------------------ … … 74 83 MParList *plist = fEvtLoop->GetParList(); 75 84 76 MParameterD *eval = (MParameterD*) plist->FindCreateObj("MParameterD", fFitParameter);77 MParContainer *pars = plist->FindObject(fParametersName);85 MParameterD *eval = (MParameterD*) plist->FindCreateObj("MParameterD", fFitParameter); 86 MParContainer *pars = (MParContainer*)plist->FindObject(fParametersName); 78 87 79 88 MRead *read = (MRead*)plist->FindObject("MTaskList")->FindObject("MRead"); … … 104 113 if (fDebug>=0) 105 114 { 106 *fLog << inf << "Set : ";107 for (Int_t i=0; i< 7; i++)115 *fLog << inf << "Set(" << gMinuit->fMaxpar << "): "; 116 for (Int_t i=0; i<gMinuit->fMaxpar; i++) 108 117 *fLog << par[i] << " "; 109 118 *fLog << endl; … … 129 138 } 130 139 131 MTFitLoop::MTFitLoop( )140 MTFitLoop::MTFitLoop(Int_t num) : fNum(num), fMaxIterations(1000) 132 141 { 133 142 fDebug = -1; … … 135 144 } 136 145 137 void MTFitLoop::Optimize(MEvtLoop &loop )146 void MTFitLoop::Optimize(MEvtLoop &loop, TArrayD &pars) 138 147 { 139 148 *fLog << inf << "Event loop was setup" << endl; 140 MParList *parlist = loop ->GetParList();149 MParList *parlist = loop.GetParList(); 141 150 if (!parlist) 142 151 return; 143 152 144 MParContainer *pars = plist->FindObject(fParametersName);145 if (!pars)146 return;147 148 fEvtLoop = evtloop;149 150 MParContainer ¶meters = *pars;153 // MParContainer *pars = (MParContainer*)parlist->FindObject(fParametersName); 154 // if (!pars) 155 // return; 156 157 fEvtLoop = &loop; 158 159 // MParContainer ¶meters = *pars; 151 160 152 161 TMinuit *minsave = gMinuit; 153 162 154 gMinuit = new TMinuit(par ameters.GetSize());163 gMinuit = new TMinuit(pars.GetSize()); 155 164 gMinuit->SetPrintLevel(-1); 165 gMinuit->SetMaxIterations(fMaxIterations); 156 166 157 167 gMinuit->SetFCN(fcn); … … 164 174 // less than 0.001*[tolerance]*UP (see [SET ERRordef])."); 165 175 // 166 if (gMinuit->SetErrorDef(1 000))176 if (gMinuit->SetErrorDef(1)) 167 177 { 168 178 *fLog << err << dbginf << "SetErrorDef failed." << endl; … … 173 183 // Set starting values and step sizes for parameters 174 184 // 175 for (Int_t i=0; i<par ameters.GetSize(); i++)185 for (Int_t i=0; i<pars.GetSize(); i++) 176 186 { 177 187 TString name = "par["; 178 188 name += i; 179 189 name += "]"; 180 Double_t vinit = par ameters[i];181 Double_t step = fabs(par ameters[i]/3);190 Double_t vinit = pars[i]; 191 Double_t step = fabs(pars[i]/3); 182 192 183 193 Double_t limlo = 0; // limlo=limup=0: no limits … … 192 202 } 193 203 194 for (int i=0; i<par ameters.GetSize(); i++)195 if ( i<fFixParams.GetSize() && fFixParams[i]!=0)204 for (int i=0; i<pars.GetSize() && i<fFixedParams.GetSize(); i++) 205 if (fFixedParams[i]!=0) 196 206 gMinuit->FixParameter(i); 197 else198 gMinuit->Release(i);199 207 200 208 // Now ready for minimization step: … … 217 225 // Update values of fA, fB: 218 226 // 219 for (Int_t i=0; i<par ameters.GetSize(); i++)227 for (Int_t i=0; i<pars.GetSize(); i++) 220 228 { 221 229 Double_t x1, x2; 222 230 gMinuit->GetParameter(i,x1,x2); 223 par ameters[i] = x1;224 cout << i << ": " << par ameters[i] << endl;225 } 226 227 list.SetVariables(parameters);231 pars[i] = x1; 232 cout << i << ": " << pars[i] << endl; 233 } 234 235 //list.SetVariables(pars); 228 236 229 237 gMinuit = minsave; -
trunk/MagicSoft/Mars/mfit/MTFitLoop.h
r3582 r4358 28 28 TArrayC fFixedParams; 29 29 30 Int_t fNum; 31 Int_t fMaxIterations; 32 30 33 public: 31 MTFitLoop( );34 MTFitLoop(const Int_t num=0); 32 35 33 void Optimize(MEvtLoop &loop );36 void Optimize(MEvtLoop &loop, TArrayD &pars); 34 37 35 38 void SetNameParameters(const char *parm) { fParametersName = parm; } … … 37 40 38 41 void SetFixedParameters(const TArrayC &c) { fFixedParams = c; } 42 void SetMaxIterations(Int_t maxiter=500) {fMaxIterations = maxiter;} // for debugging 39 43 40 44 void SetDebug(Int_t n) { fDebug = n; } -
trunk/MagicSoft/Mars/mhist/MHFalseSource.cc
r3788 r4358 233 233 { 234 234 return MMath::SignificanceLiMaSigned(s, b); 235 /*236 const Double_t lima = MMath::SignificanceLiMa(s, b);237 return lima<0 ? 0 : lima;238 */239 235 } 240 236 -
trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
r4022 r4358 525 525 // -------------------------------------------------------------------------- 526 526 // 527 // Make sure, that you skip the whole event. This function only skips a part 528 // of the event - see MRawRead::SkipEvent 529 // 530 void MRawEvtData::SkipEvt(istream &fin) 527 // Return the size in bytes of one event data block 528 // 529 Int_t MRawEvtData::GetNumBytes() const 531 530 { 532 531 const UShort_t nlo = fRunHeader->GetNumSamplesLoGain(); … … 534 533 const UShort_t npic = fRunHeader->GetNumPixInCrate(); 535 534 536 fin.seekg((nhi+nlo)*npic, ios::cur); 535 return (nhi+nlo)*npic; 536 } 537 538 // -------------------------------------------------------------------------- 539 // 540 // Make sure, that you skip the whole event. This function only skips a part 541 // of the event - see MRawRead::SkipEvent 542 // 543 void MRawEvtData::SkipEvt(istream &fin) 544 { 545 fin.seekg(GetNumBytes(), ios::cur); 537 546 } 538 547 -
trunk/MagicSoft/Mars/mraw/MRawEvtData.h
r3800 r4358 43 43 void InitArrays(Bool_t flag=kFALSE); 44 44 void DeleteArrays(); 45 46 Int_t GetNumBytes() const; 45 47 46 48 public:
Note:
See TracChangeset
for help on using the changeset viewer.