Changeset 2744 for trunk/MagicSoft/Mars
- Timestamp:
- 12/22/03 20:35:39 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2743 r2744 20 20 * mfilter/MFEventSelector2.[h,cc]: 21 21 - added some comments 22 23 * macros/dohtml.C, macros/rootlogon.C: 24 - added mcalib 25 - added mhbase 26 27 * macros/estfit.C: 28 - get chisq from MParameterD 29 30 * manalysis/MEventRateCalc.cc: 31 - added comments 32 33 * mbase/MParContainer.h: 34 - added a comment 35 36 * mhist/MHCamera.h: 37 - added default argument for DrawClone 38 39 * mmontecarlo/MMcEnergyEst.cc: 40 - use an MParameterD instead of accessing MChisqEval 41 42 * mtools/MChisqEval.[h,cc]: 43 - write result to an MParameterD 44 45 * mtools/MTFillMatrix.[h,cc]: 46 - some more features 22 47 23 48 -
trunk/MagicSoft/Mars/macros/dohtml.C
r2503 r2744 38 38 sourcedir += "manalysis:"; 39 39 sourcedir += "mbase:"; 40 sourcedir += "mcalib:"; 40 41 sourcedir += "mdata:"; 41 42 sourcedir += "mfileio:"; … … 43 44 sourcedir += "mgeom:"; 44 45 sourcedir += "mgui:"; 46 sourcedir += "mhbase:"; 45 47 sourcedir += "mhist:"; 46 48 sourcedir += "mhistmc:"; -
trunk/MagicSoft/Mars/macros/estfit.C
r2124 r2744 10 10 #include "MChisqEval.h" 11 11 #include "MMatrixLoop.h" 12 #include "MParameterD.h" 12 13 #include "MDataMember.h" 13 14 #include "MDataElement.h" … … 20 21 MEvtLoop *evtloop = (MEvtLoop*)gMinuit->GetObjectFit(); 21 22 22 MTaskList *tlist = (MTaskList*)evtloop->GetParList()->FindObject("MTaskList"); //GetTaskList(); 23 24 MChisqEval *eval = (MChisqEval*) tlist->FindObject("MChisqEval"); 23 MParList *plist = evtloop->GetParList(); 24 MTaskList *tlist = evtloop->GetTaskList(); 25 26 MChisqEval *eval = (MChisqEval*) plist->FindObject("MFitResult", "MParameterD"); 25 27 MEnergyEstParam *eest = (MEnergyEstParam*)tlist->FindObject("MEnergyEstParam"); 26 28 … … 29 31 evtloop->Eventloop(); 30 32 31 f = eval->Get Chisq();33 f = eval->GetVal(); 32 34 } 33 35 -
trunk/MagicSoft/Mars/macros/rootlogon.C
r2558 r2744 100 100 gInterpreter->AddIncludePath(dir+"manalysis"); 101 101 gInterpreter->AddIncludePath(dir+"mbase"); 102 gInterpreter->AddIncludePath(dir+"mcalib"); 102 103 gInterpreter->AddIncludePath(dir+"mdata"); 103 104 gInterpreter->AddIncludePath(dir+"mfileio"); … … 105 106 gInterpreter->AddIncludePath(dir+"mgeom"); 106 107 gInterpreter->AddIncludePath(dir+"mgui"); 108 gInterpreter->AddIncludePath(dir+"mhbase"); 107 109 gInterpreter->AddIncludePath(dir+"mhist"); 108 110 gInterpreter->AddIncludePath(dir+"mhistmc"); -
trunk/MagicSoft/Mars/manalysis/MEventRateCalc.cc
r2678 r2744 29 29 // This task calculates the event rates from the event times and numbers. 30 30 // 31 // It is under construction: More information comming soon.... 32 // 31 // The algorithm is explained in Process() 33 32 // 34 33 // Input Containers: … … 38 37 // MEventRate 39 38 // MTimeRate [MTime] (missing) 39 // 40 // FIXME: For convinience we could implement a mode which always takes 41 // n events to calculate the event rate and sets the corresponding 42 // time. This mode could be used to UPADTE files with the event 43 // rate. 40 44 // 41 45 ////////////////////////////////////////////////////////////////////////////// … … 68 72 // 69 73 // The PreProcess searches for the following input containers: 70 // ... 74 // MTime 75 // 76 // The PreProcess searches for the following input containers: 77 // MEventRate 78 // 79 // Reset all times in the buffer 71 80 // 72 81 Int_t MEventRateCalc::PreProcess(MParList *pList) … … 90 99 // -------------------------------------------------------------------------- 91 100 // 101 // Calculate the events rate as (t1-t0)/n while t1 is the n-th event after 102 // t0. If there are not yet enough events in the buffer n is the number 103 // of available events. Otherwise the number setup in SetNumEvents. 92 104 // 93 105 Int_t MEventRateCalc::Process() … … 109 121 fRate->SetReadyToSave(); 110 122 111 // *fLog << inf << " --- Event Rate [Hz]: " << rate << " (" << cnt << ")" << endl;112 113 123 return kTRUE; 114 124 } -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r2490 r2744 52 52 Bool_t fReadyToSave; // should be set to true if the contents of the container is changed somehow 53 53 54 // FIXME: Change to ostream! 54 55 virtual void StreamPrimitive(ofstream &out) const; 55 56 -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r2698 r2744 159 159 void Paint(Option_t *option=""); 160 160 void Draw(Option_t *option=""); 161 TObject *DrawClone(Option_t *option ) const;161 TObject *DrawClone(Option_t *option="") const; 162 162 void SavePrimitive(ofstream &out, Option_t *); 163 163 Int_t DistancetoPrimitive(Int_t px, Int_t py); -
trunk/MagicSoft/Mars/mmontecarlo/MMcEnergyEst.cc
r2728 r2744 60 60 #include "MLog.h" 61 61 #include "MLogManip.h" 62 #include "MParameters.h" 62 63 63 64 ClassImp(MMcEnergyEst); … … 71 72 static void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag) 72 73 { 73 MEvtLoop *evtloop = (MEvtLoop*)gMinuit->GetObjectFit(); 74 75 MTaskList *tlist = (MTaskList*)evtloop->GetParList()->FindObject("MTaskList"); // GetTaskList(); 76 77 MChisqEval *eval = (MChisqEval*) tlist->FindObject("MChisqEval"); 78 MEnergyEstParam *eest = (MEnergyEstParam*)tlist->FindObject("MEnergyEstParam"); 79 80 eest->SetCoeff(TArrayD(eest->GetNumCoeff(), par)); 81 82 evtloop->Eventloop(); 83 84 f = eval->GetChisq(); 74 MEvtLoop *evtloop = (MEvtLoop*)gMinuit->GetObjectFit(); 75 76 MParList *plist = evtloop->GetParList(); 77 MTaskList *tlist = evtloop->GetTaskList(); 78 79 MParameterD *eval = (MParameterD*) plist->FindObject("MFitResult", "MParameterD"); 80 MEnergyEstParam *eest = (MEnergyEstParam*)tlist->FindObject("MEnergyEstParam"); 81 82 eest->SetCoeff(TArrayD(eest->GetNumCoeff(), par)); 83 84 evtloop->Eventloop(); 85 86 f = eval->GetVal(); 85 87 } 86 88 … … 340 342 341 343 } 342 343 -
trunk/MagicSoft/Mars/mtools/MChisqEval.cc
r2208 r2744 32 32 33 33 #include "MDataChain.h" 34 #include "MParameters.h" // MParameterD 35 36 #include "MParList.h" 34 37 35 38 ClassImp(MChisqEval); … … 120 123 return kFALSE; 121 124 125 fResult = (MParameterD*)plist->FindCreateObj("MParameterD", "MFitResult"); 126 if (!fResult) 127 return kFALSE; 128 122 129 return kTRUE; 123 130 } … … 138 145 { 139 146 fChisq /= GetNumExecutions(); 147 148 fResult->SetVal(fChisq); 149 140 150 return kTRUE; 141 151 } -
trunk/MagicSoft/Mars/mtools/MChisqEval.h
r2208 r2744 7 7 8 8 class MData; 9 class MParameterD; 9 10 10 11 class MChisqEval : public MTask … … 14 15 static const TString gsDefTitle; 15 16 16 Double_t fChisq; //! Evaluated chi square 17 Double_t fChisq; //! Evaluated chi square 18 MParameterD *fResult; //! Storage for result 17 19 18 20 MData *fData0; // Data Member one (monte carlo data or chisq function) -
trunk/MagicSoft/Mars/mtools/MTFillMatrix.cc
r2711 r2744 35 35 // reference histogram. 36 36 // 37 // If no reference histogram is available the number of events are 38 // randomly choosen from the sample with a probability which fits 39 // the total destination number of events. 37 40 // 38 41 // Here is an example of how to choose 1000 events somehow distributed in … … 49 52 // read.DisableAutoScheme(); // make sure everything is read 50 53 // 51 // MTFillMatrix fill( ref);// setup MTFillMatrix54 // MTFillMatrix fill(&ref); // setup MTFillMatrix 52 55 // fill.SetNumDestEvents1(1000); // setup number of events to select 53 56 // fill.SetDestMatrix1(&matrix1); // setup destination matrix … … 91 94 #include "MContinue.h" 92 95 #include "MFilterList.h" 93 #include "MF RandomSplit.h"96 #include "MFEventSelector.h" 94 97 #include "MFEventSelector2.h" 95 98 … … 151 154 // at MFEventSelector2 which is used to select the events. 152 155 // 153 // FIXME: Make a copy of ref. 154 // 155 MTFillMatrix::MTFillMatrix(const MH3 &ref) 156 : fReference(ref), fReader(0), fDestMatrix1(0), 157 fDestMatrix2(0), fNumDestEvents1(0), fNumDestEvents2(0), 158 fWriteFile1(0), fWriteFile2(0) 156 // If no MH3 *ref is given the events are randomly selected from the 157 // total sample - this may result in samples which don't have exactly 158 // the predefined size, but it is much faster. 159 // 160 MTFillMatrix::MTFillMatrix(const MH3 *ref) 161 : fReference(0), fReader(0), fDestMatrix1(0), fDestMatrix2(0), 162 fNumDestEvents1(0), fNumDestEvents2(0), fWriteFile1(0), fWriteFile2(0) 159 163 { 160 164 fName = "MFillMatrix"; 161 165 fTitle = "Tool to fill MHMatrix from file"; 166 167 if (ref) 168 fReference = (MH3*)ref->Clone(); 169 } 170 171 MTFillMatrix::~MTFillMatrix() 172 { 173 if (fReference) 174 delete fReference; 162 175 } 163 176 … … 178 191 *fLog << "Fill " << fDestMatrix1->GetDescriptor() << " with " << fNumDestEvents1 << endl; 179 192 *fLog << "Fill " << fDestMatrix2->GetDescriptor() << " with " << fNumDestEvents2 << endl; 180 181 if (fReference .GetHist().GetEntries()>0)182 *fLog << "from " << fReference .GetDescriptor();193 *fLog << "Distribution choosen "; 194 if (fReference && fReference->GetHist().GetEntries()>0) 195 *fLog << "from " << fReference->GetDescriptor(); 183 196 else 184 197 *fLog << "randomly"; … … 195 208 // A selector to select a given number of events from a sample 196 209 // 197 MFEventSelector2 selector(fReference); 198 selector.SetNumMax(fNumDestEvents1+fNumDestEvents2); 199 selector.SetInverted(); 210 // FIXME: Merge MFEventSelector and MFEventSelector2 211 MFilter *selector=0; 212 if (fReference) 213 { 214 // Case of a reference/nominal distribution 215 // The events must be read before selection 216 MFEventSelector2 *sel = new MFEventSelector2(*fReference); 217 sel->SetNumMax(fNumDestEvents1+fNumDestEvents2); 218 sel->SetInverted(); 219 220 selector = sel; 221 } 222 else 223 { 224 // Case of a random distribution 225 // The events can be selected before reading 226 MFEventSelector *sel = new MFEventSelector; 227 sel->SetNumSelectEvts(fNumDestEvents1+fNumDestEvents2); 228 fReader->SetSelector(sel); 229 230 selector = sel; 231 } 200 232 201 233 // … … 203 235 // selected by the 'selector' 204 236 // 205 MContinue cont( &selector);237 MContinue cont(selector); 206 238 207 239 // … … 209 241 // 210 242 const Double_t prob = (Double_t)fNumDestEvents1/(fNumDestEvents1+fNumDestEvents2); 211 MFRandomSplit split(prob); 243 MFEventSelector split; 244 split.SetSelectionRatio(prob); 212 245 213 246 // … … 227 260 228 261 // entries in MTaskList 229 tlist.AddToList(fReader); // Read events 230 tlist.AddToList(&cont); // select a sample of events 231 tlist.AddToList(&invsplit); // process invsplit (which implicitly processes split) 262 tlist.AddToList(fReader); // Read events 263 if (fReference) 264 tlist.AddToList(&cont); // select a sample of events 265 tlist.AddToList(&invsplit); // process invsplit (which implicitly processes split) 232 266 if (fDestMatrix1 && fNumDestEvents1>0) 233 tlist.AddToList(&fill1); // fill matrix 1267 tlist.AddToList(&fill1); // fill matrix 1 234 268 if (fDestMatrix2 && fNumDestEvents2>0) 235 tlist.AddToList(&fill2); // fill matrix 2269 tlist.AddToList(&fill2); // fill matrix 2 236 270 if (fWriteFile1) 237 271 { … … 252 286 evtloop.SetDisplay(fDisplay); 253 287 evtloop.SetLogStream(fLog); 254 if (!evtloop.Eventloop()) 288 289 const Bool_t rc = evtloop.Eventloop(); 290 291 // Print execution statistics of the tasklist 292 if (rc) 293 tlist.PrintStatistics(); 294 295 delete selector; 296 297 if (!rc) 255 298 { 256 299 *fLog << err << GetDescriptor() << ": Failed." << endl; 257 300 return kFALSE; 258 301 } 259 260 // Print execution statistics of the tasklist261 tlist.PrintStatistics();262 302 263 303 // Check the result of filling... -
trunk/MagicSoft/Mars/mtools/MTFillMatrix.h
r2712 r2744 13 13 { 14 14 private: 15 MH3 15 MH3 *fReference; 16 16 MRead *fReader; 17 17 MHMatrix *fDestMatrix1; … … 26 26 27 27 public: 28 MTFillMatrix(const MH3 &ref); 28 MTFillMatrix(const MH3 *ref=NULL); 29 ~MTFillMatrix(); 29 30 30 31 void SetDestMatrix1(MHMatrix *matrix, UInt_t num=0)
Note:
See TracChangeset
for help on using the changeset viewer.