Changeset 1524 for trunk/MagicSoft
- Timestamp:
- 09/16/02 10:10:17 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/rootlogon.C
r1438 r1524 95 95 gInterpreter->AddIncludePath("mtools"); 96 96 97 if (TString("linux")==gSystem->GetBuildArch()) 98 { 99 TString options = " -O -pipe -Wall -Woverloaded-virtual -fno-rtti -fno-exceptions -fPIC "; 100 101 TString s = "cd $BuildDir ; "; 102 s += "g++ -c" + options + "-Iinclude -D_REENTRANT $IncludePath $SourceFiles ; "; 103 s += "g++ $ObjectFiles -shared -Wl,-soname,$LibName.so -O -o $SharedLib"; 104 gSystem->SetMakeSharedLib(s); 105 } 106 97 107 cout << "Welcome to the Mars Root environment." << endl; 98 108 -
trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
r1466 r1524 36 36 #pragma link C++ class MEnergyEst+; 37 37 #pragma link C++ class MEnergyEstimate+; 38 #pragma link C++ class MEnergyEstParam+; 39 40 #pragma link C++ class MMatrixLoop+; 38 41 39 42 #pragma link C++ class MPedCalcPedRun+; -
trunk/MagicSoft/Mars/manalysis/MEnergyEst.h
r1211 r1524 10 10 private: 11 11 Double_t fEnergy; // [GeV] Estimated Energy 12 Double_t fImpact; // [cm] Estimated Impact 12 13 13 14 public: … … 15 16 16 17 void SetEnergy(Double_t e) { fEnergy = e; } 18 void SetImpact(Double_t i) { fImpact = i; } 17 19 Double_t GetEnergy() const { return fEnergy; } 20 Double_t GetImpact() const { return fImpact; } 18 21 19 ClassDef(MEnergyEst, 1) // Storage Container for the estimated Energy 22 void Print(Option_t *o="") const; 23 24 ClassDef(MEnergyEst, 0) // Storage Container for the estimated Energy 20 25 }; 21 26 -
trunk/MagicSoft/Mars/manalysis/MHillas.cc
r1466 r1524 55 55 #include <fstream.h> 56 56 57 #include <TArrayF.h> 57 58 #include <TEllipse.h> 58 59 … … 78 79 79 80 Reset(); 80 // FIXME: (intelligent) initialization of values missing81 81 82 82 fEllipse = new TEllipse; … … 380 380 // -------------------------------------------------------------------------- 381 381 // 382 // This function is ment for special usage, please never try to set 383 // values via this function 384 // 385 void MHillas::Set(const TArrayF &arr) 386 { 387 if (arr.GetSize() != 8) 388 return; 389 390 fLength = arr.At(0); // [mm] major axis of ellipse 391 fWidth = arr.At(1); // [mm] minor axis of ellipse 392 fDelta = arr.At(2); // [rad] angle of major axis with x-axis 393 fSize = arr.At(3); // [#CerPhot] sum of content of all pixels (number of Cherenkov photons) 394 fMeanX = arr.At(4); // [mm] x-coordinate of center of ellipse 395 fMeanY = arr.At(5); // [mm] y-coordinate of center of ellipse 396 397 fNumUsedPixels = (Short_t)arr.At(6); // Number of pixels which survived the image cleaning 398 fNumCorePixels = (Short_t)arr.At(7); // number of core pixels 399 } 400 401 402 // -------------------------------------------------------------------------- 403 // 382 404 /* 383 405 void MHillas::AsciiRead(ifstream &fin) -
trunk/MagicSoft/Mars/manalysis/MHillas.h
r1465 r1524 6 6 #endif 7 7 8 class TArrayF; 8 9 class TEllipse; 9 10 … … 62 63 Int_t GetNumCorePixels() const { return fNumCorePixels; } 63 64 65 virtual void Set(const TArrayF &arr); 66 64 67 //virtual void AsciiRead(ifstream &fin); 65 68 //virtual void AsciiWrite(ofstream &fout) const; -
trunk/MagicSoft/Mars/manalysis/MHillasExt.cc
r1509 r1524 37 37 // fM3Long third moment along major axis 38 38 // fM3Trans third moment along minor axis 39 // fLeakage1 ratio : (photons in most outer ring of pixels) over fSize40 // fLeakage2 ratio : (photons in the 2 outer rings of pixels) over fSize41 39 // 42 40 // WARNING: Before you can use fAsym, fM3Long and fM3Trans you must … … 45 43 //////////////////////////////////////////////////////////////////////////// 46 44 /* 45 // fLeakage1 ratio : (photons in most outer ring of pixels) over fSize 46 // fLeakage2 ratio : (photons in the 2 outer rings of pixels) over fSize 47 // 47 48 // fAsymna d/(d na) of ( sum(x*q^na)/sum(q^na), sum(y*q^na)/sum(q^na) ) 48 49 // projected onto the major axis … … 52 53 53 54 #include <fstream.h> 55 #include <TArrayF.h> 54 56 55 57 #include "MGeomPix.h" … … 238 240 } 239 241 242 // -------------------------------------------------------------------------- 243 // 244 // This function is ment for special usage, please never try to set 245 // values via this function 246 // 247 void MHillasExt::Set(const TArrayF &arr) 248 { 249 if (arr.GetSize() != 13) 250 return; 251 252 fConc = arr.At(8); // [ratio] concentration ratio: sum of the two highest pixels / fSize 253 fConc1 = arr.At(9); // [ratio] concentration ratio: sum of the highest pixel / fSize 254 fAsym = arr.At(10); // [mm] fDist minus dist: center of ellipse, highest pixel 255 fM3Long = arr.At(11); // [mm] 3rd moment (e-weighted) along major axis 256 fM3Trans = arr.At(12); // [mm] 3rd moment (e-weighted) along minor axis 257 258 TArrayF n(arr); 259 n.Set(8); 260 MHillas::Set(n); 261 } 262 240 263 /* 241 264 // ------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/manalysis/MHillasExt.h
r1460 r1524 34 34 void Print(Option_t *opt=NULL) const; 35 35 36 void Set(const TArrayF &arr); 37 36 38 //void AsciiRead(ifstream &fin); 37 39 //void AsciiWrite(ofstream &fout) const; -
trunk/MagicSoft/Mars/manalysis/MHillasSrc.cc
r1489 r1524 54 54 55 55 #include <fstream.h> 56 #include <TArrayF.h> 56 57 57 58 #include "MLog.h" … … 141 142 *fLog << " - CosDeltaAlpha = " << fCosDeltaAlpha << endl; 142 143 } 144 // -------------------------------------------------------------------------- 145 // 146 // This function is ment for special usage, please never try to set 147 // values via this function 148 // 149 void MHillasSrc::Set(const TArrayF &arr) 150 { 151 if (arr.GetSize() != 4) 152 return; 153 154 fAlpha = arr.At(0); // [deg] angle of major axis with vector to src 155 fDist = arr.At(1); // [mm] distance between src and center of ellipse 156 fHeadTail = arr.At(2); // [mm] 157 fCosDeltaAlpha = arr.At(3); // [1] cosine of angle between d and a 158 } 143 159 144 160 // ----------------------------------------------------------------------- -
trunk/MagicSoft/Mars/manalysis/MHillasSrc.h
r1434 r1524 42 42 virtual Bool_t Calc(const MHillas *hillas); 43 43 44 void Set(const TArrayF &arr); 45 44 46 //virtual void AsciiRead(ifstream &fin); 45 47 //virtual void AsciiWrite(ofstream &fout) const; -
trunk/MagicSoft/Mars/manalysis/Makefile
r1466 r1524 36 36 MEnergyEst.cc \ 37 37 MEnergyEstimate.cc \ 38 MEnergyEstParam.cc \ 38 39 MSrcPosCam.cc \ 39 40 MCameraSmooth.cc \ 40 41 MHadroness.cc \ 42 MMatrixLoop.cc \ 41 43 MCompProbCalc.cc \ 42 44 MMultiDimDistCalc.cc \ -
trunk/MagicSoft/Mars/mbase/MFilter.cc
r1481 r1524 101 101 TString MFilter::GetRule() const 102 102 { 103 return "<GetRule n ot availablefor " + fName + ">";103 return "<GetRule n/a for " + fName + ">"; 104 104 } -
trunk/MagicSoft/Mars/mbase/MLog.cc
r1268 r1524 75 75 // which is used for the output (i) 76 76 // 77 MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), f GuiLineId(0), fout(NULL), fOutAllocated(kFALSE), fgui(NULL)77 MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fIsNull(kFALSE), fGuiLineId(0), fout(NULL), fOutAllocated(kFALSE), fgui(NULL) 78 78 { 79 79 Init(); … … 85 85 // ofstream as the default output device 86 86 // 87 MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), f GuiLineId(0), fout(&out), fOutAllocated(kFALSE), fgui(NULL)87 MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fGuiLineId(0), fout(&out), fOutAllocated(kFALSE), fgui(NULL) 88 88 { 89 89 Init(); … … 106 106 // or not. 107 107 // 108 MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), f GuiLineId(0), fgui(NULL)108 MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fGuiLineId(0), fgui(NULL) 109 109 { 110 110 Init(); … … 132 132 void MLog::WriteBuffer() 133 133 { 134 // 135 // restart writing to the buffer at its first char 136 // 134 137 const int len = fPPtr - fBase; 138 139 fPPtr = fBase; 140 141 if (fIsNull) 142 return; 135 143 136 144 if (fDevice&eStdout) … … 153 161 delete dummy; 154 162 } 155 156 //157 // restart writing to the buffer at its first char158 //159 fPPtr = fBase;160 163 } 161 164 -
trunk/MagicSoft/Mars/mbase/MLog.h
r1014 r1524 31 31 UInt_t fDebugLevel; //! Present global debug level 32 32 UInt_t fDevice; //! Flag to indicate the present streams 33 34 Bool_t fIsNull; //! Switch output completely off 33 35 34 36 Int_t fGuiLineId; … … 122 124 } 123 125 126 void SetNullOutput(Bool_t n=kTRUE) { fIsNull = n; } 127 124 128 ClassDef(MLog, 0) // This is what we call 'The logging system' 125 129 }; -
trunk/MagicSoft/Mars/mbase/MParList.cc
r1487 r1524 50 50 #include "MLogManip.h" 51 51 52 #include "MIter.h" 53 52 54 ClassImp(MParList); 53 55 … … 105 107 // automatically deleted. 106 108 // 107 TestBit(kIsOwner) ? fContainer->SetOwner() : fAutodelete->SetOwner(); 109 IsOwner() ? fContainer->SetOwner() : fAutodelete->SetOwner(); 110 111 // FIXME? If fContainer is owner do we have to remove the object 112 // from fAutodelete due to the acces when checking for a 113 // garbage collection? 108 114 109 115 delete fContainer; … … 236 242 { 237 243 *fLog << warn << "No object with the same name '"; 238 *fLog << cont->GetName() << "' in list... ignored." << endl;239 return kFALSE;244 *fLog << cont->GetName() << "' in list... adding." << endl; 245 return AddToList(cont); 240 246 } 241 247 242 248 fContainer->Remove(obj); 243 249 244 if ( TestBit(kIsOwner) && !fAutodelete->FindObject(obj))250 if (IsOwner() && !fAutodelete->FindObject(obj)) 245 251 delete obj; 246 252 247 *fLog << inf << "MParContainer '" << obj->GetName() << "' found and replaced..." << endl;253 *fLog << inf << "MParContainer '" << cont->GetName() << "' found and replaced..." << endl; 248 254 249 255 return AddToList(cont); 256 } 257 258 // -------------------------------------------------------------------------- 259 // 260 // Find an object with the same name in the list and remove it. 261 // If the kIsOwner flag is set and the object was not created 262 // automatically, the object is deleted. 263 // 264 void MParList::Remove(MParContainer *cont) 265 { 266 // 267 // check if the object (you want to add) exists 268 // 269 if (!cont) 270 return; 271 272 TObject *obj = fContainer->Remove(cont); 273 if (!obj) 274 { 275 *fLog << warn << "Object not found in list..." << endl; 276 return; 277 } 278 279 *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl; 280 281 if (IsOwner() && !fAutodelete->FindObject(obj)) 282 delete obj; 250 283 } 251 284 … … 470 503 TIter Next(fContainer); 471 504 while ((obj=(MParContainer*)Next())) 472 *fLog << " " << obj->GetDescriptor() << endl; 505 { 506 *fLog << " " << obj->GetDescriptor(); 507 if (fAutodelete->FindObject(obj)) 508 *fLog << " <autodel>"; 509 *fLog << endl; 510 } 473 511 *fLog << endl; 474 512 } … … 492 530 { 493 531 fContainer->ForEach(MParContainer, Reset)(); 494 }532 } 495 533 496 534 // -------------------------------------------------------------------------- … … 663 701 } 664 702 703 void MParList::SavePrimitive(ofstream &out, Option_t *o) 704 { 705 Bool_t saved = IsSavedAsPrimitive(); 706 707 MParContainer::SavePrimitive(out); 708 709 MIter Next(fContainer); 710 711 MParContainer *cont = NULL; 712 while ((cont=Next())) 713 { 714 // 715 // Because it was automatically created don't store its primitive 716 // I guess it will be automatically created again 717 // 718 if (fAutodelete->FindObject(cont) || cont->IsSavedAsPrimitive()) 719 continue; 720 721 cont->SavePrimitive(out, ""); 722 723 out << " " << GetUniqueName() << "."; 724 out << (cont->InheritsFrom("MTaskList") && saved ? "Replace" : "AddToList"); 725 out << "(&" << cont->GetUniqueName() << ");" << endl << endl; 726 } 727 } 728 665 729 // -------------------------------------------------------------------------- 666 730 // … … 680 744 } 681 745 out << ";" << endl << endl; 682 683 TIter Next(fContainer);684 685 MParContainer *cont = NULL;686 while ((cont=(MParContainer*)Next()))687 {688 cont->SavePrimitive(out, "");689 690 out << " " << GetUniqueName() << ".AddToList(&";691 out << cont->GetUniqueName() << ");" << endl << endl;692 }693 746 } 694 747 -
trunk/MagicSoft/Mars/mbase/MParList.h
r1477 r1524 36 36 37 37 public: 38 enum { kDoNotReset = BIT(15) }; 39 38 40 MParList(const char *name=NULL, const char *title=NULL); 39 41 MParList(MParList &ts); … … 45 47 46 48 Bool_t Replace(MParContainer *obj); 49 void Remove(MParContainer *obj); 47 50 48 51 void SetLogStream(MLog *log); … … 78 81 79 82 void SetOwner(Bool_t enable=kTRUE); 83 Bool_t IsOwner() const { return TestBit(kIsOwner); } 80 84 81 85 void Print(Option_t *t = NULL) const; … … 84 88 void SetNames(TObjArray &arr); 85 89 90 void SavePrimitive(ofstream &out, Option_t *o=""); 91 86 92 ClassDef(MParList, 1) // list of parameter containers (MParContainer) 87 93 }; -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r1501 r1524 372 372 // Reset all containers. 373 373 // 374 // FIXME: To run a tasklist as a single task in another tasklist we 375 // have to make sure, that the Parameter list isn't reset. 376 // 377 fParList->SetReadyToSave(kFALSE); 378 fParList->Reset(); 374 // Make sure, that the parameter list is not reset from a tasklist 375 // running as a task in another tasklist. 376 // 377 const Bool_t noreset = fParList->TestBit(MParList::kDoNotReset); 378 if (!noreset) 379 { 380 fParList->SetReadyToSave(); 381 fParList->Reset(); 382 fParList->SetBit(MParList::kDoNotReset); 383 } 379 384 380 385 // … … 428 433 } 429 434 435 if (!noreset) 436 fParList->ResetBit(MParList::kDoNotReset); 437 430 438 return kTRUE; 431 439 } -
trunk/MagicSoft/Mars/mdata/DataLinkDef.h
r1488 r1524 7 7 #pragma link C++ class MData+; 8 8 #pragma link C++ class MDataArray+; 9 #pragma link C++ class MDataElement+; 9 10 #pragma link C++ class MDataList+; 10 11 #pragma link C++ class MDataValue+; -
trunk/MagicSoft/Mars/mdata/MDataChain.cc
r1493 r1524 91 91 #include "MDataValue.h" 92 92 #include "MDataMember.h" 93 # 93 #include "MDataElement.h" 94 94 95 ClassImp(MDataChain); 95 96 … … 164 165 for (int i=0; i<l; i++) 165 166 { 166 if (!isalnum(txt[i]) && txt[i]!='.' && 167 if (!isalnum(txt[i]) && txt[i]!='.' && /*txt[i]!='['&&txt[i]!=']'&&*/ 167 168 ((txt[i]!='-' && txt[i]!='+') || i!=0)) 168 169 return i; … … 172 173 } 173 174 174 Int_t MDataChain::GetBracket(TString txt )175 Int_t MDataChain::GetBracket(TString txt, char open, char close) 175 176 { 176 177 Int_t first=1; 177 178 for (int cnt=0; first<txt.Length(); first++) 178 179 { 179 if (txt[first]== '(')180 if (txt[first]==open) 180 181 cnt++; 181 if (txt[first]== ')')182 if (txt[first]==close) 182 183 cnt--; 183 184 if (cnt==-1) … … 197 198 198 199 if (txt=="abs") return kEAbs; 200 if (txt=="fabs") return kEAbs; 199 201 if (txt=="log") return kELog; 200 202 if (txt=="log10") return kELog10; … … 238 240 // Search for the corresponding bracket 239 241 // 240 Int_t first=GetBracket(txt );242 Int_t first=GetBracket(txt, '(', ')'); 241 243 242 244 if (first==txt.Length()) … … 364 366 txt = txt.Strip(TString::kBoth); 365 367 368 if (!txt.IsNull() && txt[0]=='[') 369 { 370 Int_t first = GetBracket(txt, '[', ']'); 371 TString op = txt(1, first-1); 372 txt.Remove(0, first+1); 373 374 newmember = new MDataElement(text, atoi(op)); 375 break; 376 } 366 377 if ((txt.IsNull() || txt[0]!='(') && text[0]!='-' && text[0]!='+') 367 378 { … … 379 390 } 380 391 381 Int_t first = GetBracket(txt );392 Int_t first = GetBracket(txt, '(', ')'); 382 393 TString sub = op==kENegative || op==kEPositive ? text.Remove(0,1) + txt : txt(1, first-1); 383 394 txt.Remove(0, first+1); 384 395 385 396 newmember = new MDataChain(sub, op); 386 387 397 if (!newmember->IsValid()) 388 398 { -
trunk/MagicSoft/Mars/mdata/MDataChain.h
r1481 r1524 46 46 47 47 Int_t IsAlNum(TString txt); 48 Int_t GetBracket(TString txt );48 Int_t GetBracket(TString txt, char open, char close); 49 49 50 50 MData *ParseString(TString txt, Int_t level); -
trunk/MagicSoft/Mars/mdata/Makefile
r1488 r1524 20 20 # @endcode 21 21 22 INCLUDES = -I. -I../mbase 22 INCLUDES = -I. -I../mbase -I../mhist 23 23 24 24 # @code … … 33 33 SRCFILES = MData.cc \ 34 34 MDataArray.cc \ 35 MDataElement.cc \ 35 36 MDataMember.cc \ 36 37 MDataValue.cc \ -
trunk/MagicSoft/Mars/mhist/MH3.cc
r1483 r1524 62 62 #include <fstream.h> 63 63 64 #include <TPad.h> 65 #include <TStyle.h> 66 #include <TCanvas.h> 67 64 68 #include <TH2.h> 65 69 #include <TH3.h> 66 70 #include <TProfile.h> 67 71 #include <TProfile2D.h> 68 #include <TPad.h>69 #include <TCanvas.h>70 72 71 73 #include "MLog.h" … … 73 75 74 76 #include "MParList.h" 75 77 #include "MBinning.h" 76 78 #include "MDataChain.h" 77 79 … … 202 204 return kFALSE; 203 205 } 206 if (binsz->IsLogarithmic()) 207 fHist->SetBit(kIsLogz); 204 208 fHist->SetZTitle(fData[2]->GetTitle()); 205 209 if (!fData[2]->PreProcess(plist)) … … 212 216 return kFALSE; 213 217 } 218 if (binsy->IsLogarithmic()) 219 fHist->SetBit(kIsLogy); 214 220 fHist->SetYTitle(fData[1]->GetTitle()); 215 221 if (!fData[1]->PreProcess(plist)) … … 222 228 return kFALSE; 223 229 } 230 if (binsx->IsLogarithmic()) 231 fHist->SetBit(kIsLogx); 224 232 fHist->SetXTitle(fData[0]->GetTitle()); 225 233 if (!fData[0]->PreProcess(plist)) … … 306 314 return kFALSE; 307 315 } 316 /* 317 // -------------------------------------------------------------------------- 318 // 319 // Set the palette you wanna use: 320 // - you could set the root "Pretty Palette Violet->Red" by 321 // gStyle->SetPalette(1, 0), but in some cases this may look 322 // confusing 323 // - The maximum colors root allowes us to set by ourself 324 // is 50 (idx: 51-100). This colors are set to a grayscaled 325 // palette 326 // - the number of contours must be two less than the number 327 // of palette entries 328 // 329 void MHStarMap::PrepareDrawing() const 330 { 331 const Int_t numg = 32; // number of gray scaled colors 332 const Int_t numw = 32; // number of white 333 334 Int_t palette[numg+numw]; 335 336 // 337 // The first half of the colors are white. 338 // This is some kind of optical background supression 339 // 340 gROOT->GetColor(51)->SetRGB(1, 1, 1); 341 342 Int_t i; 343 for (i=0; i<numw; i++) 344 palette[i] = 51; 345 346 // 347 // now the (gray) scaled part is coming 348 // 349 for (;i<numw+numg; i++) 350 { 351 const Float_t gray = 1.0-(float)(i-numw)/(numg-1.0); 352 353 gROOT->GetColor(52+i)->SetRGB(gray, gray, gray); 354 palette[i] = 52+i; 355 } 356 357 // 358 // Set the palette and the number of contour levels 359 // 360 gStyle->SetPalette(numg+numw, palette); 361 fStarMap->SetContour(numg+numw-2); 362 } 363 */ 364 // -------------------------------------------------------------------------- 365 // 366 // Setup a inversed deep blue sea palette for the fCenter histogram. 367 // 368 void MH3::SetColors() const 369 { 370 // FIXME: This must be redone each time the canvas is repainted.... 371 gStyle->SetPalette(51, NULL); 372 Int_t c[50]; 373 for (int i=0; i<50; i++) 374 c[49-i] = gStyle->GetColorPalette(i); 375 gStyle->SetPalette(50, c); 376 } 308 377 309 378 // -------------------------------------------------------------------------- 310 379 // 311 380 // Draw clone of histogram. So that the object can be deleted 381 // 382 // Possible options are: 383 // PROFX: Draw a x-profile into the histogram (for 2D histograms only) 384 // PROFY: Draw a y-profile into the histogram (for 2D histograms only) 385 // ONLY: Draw the profile histogram only (for 2D histograms only) 386 // 387 // If the kIsLog?-Bit is set the axis is displayed lkogarithmically. 388 // eg this is set when applying a logarithmic MBinning 389 // 312 390 // and the histogram is still visible in the canvas. 313 391 // The cloned object are deleted together with the canvas if the canvas is … … 324 402 gROOT->SetSelectedPad(NULL); 325 403 326 fHist->DrawCopy(opt);327 328 404 TString str(opt); 405 406 if (str.Contains("COL", TString::kIgnoreCase)) 407 SetColors(); 408 409 Bool_t only = str.Contains("ONLY", TString::kIgnoreCase) && fDimension==2; 410 if (!only) 411 fHist->DrawCopy(opt); 412 329 413 if (str.Contains("PROFX", TString::kIgnoreCase) && fDimension==2) 330 414 { 331 415 TProfile *p = ((TH2*)fHist)->ProfileX(); 332 p->Draw( "same");416 p->Draw(only?"":"same"); 333 417 p->SetBit(kCanDelete); 334 418 p->SetDirectory(NULL); … … 337 421 { 338 422 TProfile *p = ((TH2*)fHist)->ProfileY(); 339 p->Draw( "same");423 p->Draw(only?"":"same"); 340 424 p->SetBit(kCanDelete); 341 425 p->SetDirectory(NULL); 342 426 } 343 427 428 if (fHist->TestBit(kIsLogx)) c.SetLogx(); 429 if (fHist->TestBit(kIsLogy)) c.SetLogy(); 430 if (fHist->TestBit(kIsLogz)) c.SetLogz(); 431 344 432 c.Modified(); 345 433 c.Update(); … … 351 439 // 352 440 // Creates a new canvas and draws the histogram into it. 441 // 442 // Possible options are: 443 // PROFX: Draw a x-profile into the histogram (for 2D histograms only) 444 // PROFY: Draw a y-profile into the histogram (for 2D histograms only) 445 // ONLY: Draw the profile histogram only (for 2D histograms only) 446 // 447 // If the kIsLog?-Bit is set the axis is displayed lkogarithmically. 448 // eg this is set when applying a logarithmic MBinning 449 // 353 450 // Be careful: The histogram belongs to this object and won't get deleted 354 451 // together with the canvas. … … 359 456 MH::MakeDefCanvas(fHist); 360 457 361 fHist->Draw(opt);362 363 458 TString str(opt); 459 460 if (str.Contains("COL", TString::kIgnoreCase)) 461 SetColors(); 462 463 Bool_t only = str.Contains("ONLY", TString::kIgnoreCase) && fDimension==2; 464 if (!only) 465 fHist->Draw(opt); 466 364 467 if (str.Contains("PROFX", TString::kIgnoreCase) && fDimension==2) 365 468 { 366 469 TProfile *p = ((TH2*)fHist)->ProfileX(); 367 p->Draw( "same");470 p->Draw(only?"":"same"); 368 471 p->SetBit(kCanDelete); 369 472 p->SetDirectory(NULL); … … 372 475 { 373 476 TProfile *p = ((TH2*)fHist)->ProfileY(); 374 p->Draw( "same");477 p->Draw(only?"":"same"); 375 478 p->SetBit(kCanDelete); 376 479 p->SetDirectory(NULL); 377 480 } 481 482 if (fHist->TestBit(kIsLogx)) gPad->SetLogx(); 483 if (fHist->TestBit(kIsLogy)) gPad->SetLogy(); 484 if (fHist->TestBit(kIsLogz)) gPad->SetLogz(); 378 485 379 486 gPad->Modified(); -
trunk/MagicSoft/Mars/mhist/MH3.h
r1481 r1524 26 26 void StreamPrimitive(ofstream &out) const; 27 27 28 enum { 29 kIsLogx = BIT(15), 30 kIsLogy = BIT(16), 31 kIsLogz = BIT(17) 32 }; 33 28 34 public: 29 35 MH3(); … … 48 54 const TH1 &GetHist() const { return *fHist; } 49 55 56 void SetColors() const; 50 57 void Draw(Option_t *opt=NULL); 51 58 TObject *DrawClone(Option_t *opt=NULL) const; -
trunk/MagicSoft/Mars/mhist/MHHillas.cc
r1504 r1524 170 170 const MBinning *bins = (MBinning*)plist->FindObject("BinningCamera"); 171 171 if (!bins) 172 *fLog << warn << "Object 'BinningCamera' [MBinning] not found... no binning applied." << endl; 172 { 173 float r = geom ? geom->GetMaxRadius() : 600; 174 r *= 0.9; 175 if (!fUseMmScale) 176 r *= fMm2Deg; 177 178 MBinning b; 179 b.SetEdges(61, -r, r); 180 SetBinning(fCenter, &b, &b); 181 } 173 182 else 174 183 SetBinning(fCenter, bins, bins); 184 175 185 176 186 return kTRUE; -
trunk/MagicSoft/Mars/mhist/MHMatrix.cc
r1511 r1524 56 56 #include "MLogManip.h" 57 57 58 #include "MFillH.h" 59 #include "MEvtLoop.h" 58 60 #include "MParList.h" 61 #include "MTaskList.h" 59 62 60 63 #include "MData.h" … … 63 66 ClassImp(MHMatrix); 64 67 65 static const TStringgsDefName = "MHMatrix";66 static const TStringgsDefTitle = "Multidimensional Matrix";68 const TString MHMatrix::gsDefName = "MHMatrix"; 69 const TString MHMatrix::gsDefTitle = "Multidimensional Matrix"; 67 70 68 71 // -------------------------------------------------------------------------- … … 105 108 // event (row) was filled into the matrix. For the syntax of the rule 106 109 // see MDataChain. 107 // 108 void MHMatrix::AddColumn(const char *rule) 110 // Returns the index of the new column, -1 in case of failure. 111 // (0, 1, 2, ... for the 1st, 2nd, 3rd, ...) 112 // 113 Int_t MHMatrix::AddColumn(const char *rule) 109 114 { 110 115 if (fM.IsValid()) 111 116 { 112 117 *fLog << warn << "Warning - matrix is already in use. Can't add a new column... skipped." << endl; 113 return; 118 return -1; 119 } 120 121 if (TestBit(kIsLocked)) 122 { 123 *fLog << warn << "Warning - matrix is locked. Can't add new column... skipped." << endl; 124 return -1; 114 125 } 115 126 … … 121 132 122 133 fData->AddEntry(rule); 134 return fData->GetNumEntries()-1; 123 135 } 124 136 … … 128 140 { 129 141 *fLog << warn << "Warning - matrix is already in use. Can't add new columns... skipped." << endl; 142 return; 143 } 144 145 if (TestBit(kIsLocked)) 146 { 147 *fLog << warn << "Warning - matrix is locked. Can't add new columns... skipped." << endl; 130 148 return; 131 149 } … … 519 537 fM = m; 520 538 } 539 540 Bool_t MHMatrix::Fill(MParList *plist, MTask *read) 541 { 542 // 543 // Read data into Matrix 544 // 545 const Bool_t is = plist->IsOwner(); 546 plist->SetOwner(kFALSE); 547 548 MTaskList tlist; 549 plist->Replace(&tlist); 550 551 MFillH fillh(this); 552 553 tlist.AddToList(read); 554 tlist.AddToList(&fillh); 555 556 MEvtLoop evtloop; 557 evtloop.SetParList(plist); 558 559 if (!evtloop.Eventloop()) 560 return kFALSE; 561 562 plist->Remove(&tlist); 563 plist->SetOwner(is); 564 565 return kTRUE; 566 } -
trunk/MagicSoft/Mars/mhist/MHMatrix.h
r1511 r1524 1 1 #ifndef MARS_MHMatrix 2 2 #define MARS_MHMatrix 3 4 #ifdef MARS_MLogManip 5 #error Please make ensure that MLogManip.h are included _after_ MHMatrix.h 6 #endif 3 7 4 8 #ifndef ROOT_TMatrix … … 10 14 11 15 class TArrayI; 16 17 class MTask; 18 class MParList; 12 19 class MDataArray; 13 20 14 21 class MHMatrix : public MH 15 22 { 16 protected: 23 private: 24 static const TString gsDefName; //! Default Name 25 static const TString gsDefTitle; //! Default Title 26 17 27 Int_t fNumRow; //! Number of dimensions of histogram 28 Int_t fRow; //! Present row 18 29 TMatrix fM; // Matrix to be filled 19 30 … … 23 34 24 35 enum { 25 kIsOwner = BIT(14) 36 kIsOwner = BIT(14), 37 kIsLocked = BIT(16) 26 38 }; 27 39 … … 39 51 ~MHMatrix(); 40 52 41 void AddColumn(const char *name); 53 void Lock() { SetBit(kIsLocked); } 54 void Unlock() { ResetBit(kIsLocked); } 55 56 Int_t AddColumn(const char *name); 42 57 void AddColumns(MDataArray *mat); 43 58 … … 45 60 46 61 const TMatrix &GetM() const { return fM; } 62 63 Bool_t IsValid() const { return fM.IsValid(); } 64 Int_t GetNumRows() const { return fNumRow; } 47 65 48 66 //void Draw(Option_t *opt=NULL); … … 56 74 Double_t CalcDist(const TVector &v, Int_t num = 25); 57 75 58 void Set IOwner(Bool_t b=kTRUE) { b ? SetBit(kIsOwner) : ResetBit(kIsOwner); }76 void SetOwner(Bool_t b=kTRUE) { b ? SetBit(kIsOwner) : ResetBit(kIsOwner); } 59 77 60 78 void Reassign(); … … 63 81 void SortMatrixByColumn(Int_t ncol=0, Bool_t desc=kTRUE); 64 82 83 Bool_t SetNumRow(Int_t row) { if (row>=fNumRow || row<0) return kFALSE; fRow = row; return kTRUE; } 84 Int_t GetNumRow() const { return fRow; }; 85 Double_t operator[](Int_t col) { return fM(fRow, col); } 86 87 Bool_t Fill(MParList *plist, MTask *read); 88 65 89 ClassDef(MHMatrix, 1) // Multidimensional Matrix to store events 66 90 }; -
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r1330 r1524 73 73 // connect all the histogram with the container fHist 74 74 // 75 fStarMap = new TH2F("StarMap", " 2D Hillas Star Map",75 fStarMap = new TH2F("StarMap", " 2D Hillas Star Map ", 76 76 150, -300, 300, 77 77 150, -300, 300); … … 96 96 // 97 97 // Setup the Binning for the histograms automatically if the correct 98 // instances of MBinning (with the names 'Binning Width' and 'BinningLength')98 // instances of MBinning (with the names 'BinningCamera') 99 99 // are found in the parameter list 100 100 // Use this function if you want to set the conversion factor which
Note:
See TracChangeset
for help on using the changeset viewer.