- Timestamp:
- 04/06/04 13:41:56 (21 years ago)
- Location:
- trunk/MagicSoft
- Files:
-
- 2 added
- 46 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mastro/MAstro.cc
r3596 r3666 85 85 Double_t MAstro::Dms2Hor(Int_t deg, UInt_t min, Double_t sec, Char_t sgn) 86 86 { 87 return Hms2Sec(deg, min, sec, sgn)/ 15.;87 return Hms2Sec(deg, min, sec, sgn)/54000.; 88 88 } 89 89 -
trunk/MagicSoft/Mars/mastro/MAstroCamera.cc
r3568 r3666 148 148 149 149 // -------------------------------------------------------------------------- 150 void MAstroCamera::AddPrimitives(Option_t *o) 150 // 151 // Options: 152 // 153 // '*' Draw the mean of the reflections on all mirrors 154 // '.' Draw a dot for the reflection on each mirror 155 // 156 void MAstroCamera::AddPrimitives(TString o) 151 157 { 152 158 if (!fTime || !fObservatory || !fMirrors) … … 156 162 } 157 163 158 TString opt(o); 159 if (opt.IsNull()) 160 opt = "*."; 161 162 const Bool_t hashist = opt.Contains("h", TString::kIgnoreCase); 163 const Bool_t hasmean = opt.Contains("*", TString::kIgnoreCase); 164 const Bool_t hasdot = opt.Contains(".", TString::kIgnoreCase); 165 const Bool_t usecam = opt.Contains("c", TString::kIgnoreCase); 164 if (o.IsNull()) 165 o = "*."; 166 167 const Bool_t hashist = o.Contains("h", TString::kIgnoreCase); 168 const Bool_t hasmean = o.Contains("*", TString::kIgnoreCase); 169 const Bool_t hasdot = o.Contains(".", TString::kIgnoreCase); 170 const Bool_t usecam = o.Contains("c", TString::kIgnoreCase); 166 171 167 172 // Get camera -
trunk/MagicSoft/Mars/mastro/MAstroCamera.h
r3568 r3666 22 22 23 23 Int_t ConvertToPad(const TVector3 &w, TVector2 &v) const; 24 void AddPrimitives( Option_t *o);25 void SetRangePad( ) { }24 void AddPrimitives(TString o); 25 void SetRangePad(Option_t *o) { } 26 26 void ExecuteEvent(Int_t event, Int_t mp1, Int_t mp2); 27 27 -
trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc
r3571 r3666 147 147 MAstroCatalog::~MAstroCatalog() 148 148 { 149 if (fTime) 150 delete fTime; 151 if (fObservatory) 152 delete fObservatory; 153 154 fToolTip->Hide(); 155 delete fToolTip; 156 157 DeleteMap(); 158 149 // First disconnect the EventInfo... 159 150 // FIXME: There must be an easier way! 160 151 TIter Next(gROOT->GetListOfCanvases()); … … 164 155 "EventInfo(Int_t,Int_t,Int_t,TObject*)"); 165 156 157 // Now delete the data members 158 if (fTime) 159 delete fTime; 160 if (fObservatory) 161 delete fObservatory; 162 163 fToolTip->Hide(); 164 delete fToolTip; 165 166 DeleteMap(); 166 167 } 167 168 … … 438 439 void MAstroCatalog::Paint(Option_t *o) 439 440 { 440 SetRangePad( );441 SetRangePad(o); 441 442 442 443 if (TestBit(kHasChanged)) 443 444 DrawPrimitives(o); 445 446 PaintMap(); 444 447 } 445 448 … … 458 461 459 462 // draw star on the camera display 460 TMarker *tip=new TMarker(x, y, transparent ? kDot : kFullDot Large);;463 TMarker *tip=new TMarker(x, y, transparent ? kDot : kFullDotMedium);; 461 464 tip->SetMarkerColor(kBlack); 462 465 AddMap(tip, new TString(str)); … … 517 520 w *= 1./w(2); 518 521 519 w *= TMath::RadToDeg(); 520 v.Set(w(0), w(1)); 522 w *= TMath::RadToDeg(); // FIXME: *conversion factor? 523 v.Set(TestBit(kMirrorX) ? -w(0) : w(0), 524 TestBit(kMirrorY) ? -w(1) : w(1)); 521 525 522 526 if (w(2)<0) 523 527 return kERROR; 524 528 525 return w(0)>gPad->GetX1() && w(1)>gPad->GetY1() &&526 w(0)<gPad->GetX2() && w(1)<gPad->GetY2();529 return v.X()>gPad->GetX1() && v.Y()>gPad->GetY1() && 530 v.X()<gPad->GetX2() && v.Y()<gPad->GetY2(); 527 531 } 528 532 … … 610 614 dx[0] = d[0]+dirs[i][0]; 611 615 dy[0] = d[1]+dirs[i][1]; 612 613 //cout << dx[0] << " " << dy[0] << endl;614 616 615 617 // Draw corresponding line and iterate through grid … … 756 758 757 759 txt.Prepend("#splitline{"); 758 759 txt += Form(" \\theta=%.1fh ", fmod(zd+270,180)-90); 760 txt += Form("\\phi=%.1f\\circ ", fmod(az+720, 360)); 761 txt += Form(" / \\rho=%.1f\\circ", rho*TMath::RadToDeg()); 760 txt += Form(" \\theta=%.1f\\circ ", fmod(zd+270,180)-90); 761 txt += Form("\\phi=%.1f\\circ ", fmod(az+720, 360)); 762 txt += Form(" / \\rho=%.1f\\circ", rho*TMath::RadToDeg()); 762 763 txt += "}{<"; 763 764 txt += fTime->GetSqlDateTime(); … … 767 768 768 769 // -------------------------------------------------------------------------- 769 void MAstroCatalog::AddPrimitives(Option_t *o) 770 { 771 const Bool_t local = TString(o).Contains("local", TString::kIgnoreCase); 772 773 cout << "Opt: " << o << endl; 770 // 771 // To overlay the catalog make sure, that in any case you are using 772 // the 'same' option. 773 // 774 // If you want to overlay this on top of any picture which is created 775 // by derotation of the camera plain you have to use the 'mirror' option 776 // the compensate the mirroring of the image in the camera plain. 777 // 778 // If you have already compensated this by x=-x and y=-y when creating 779 // the histogram you can simply overlay the catalog. 780 // 781 // To overlay the catalog on a 2D histogram the histogram must have 782 // units of degrees (which are plain, like you directly convert the 783 // camera units by multiplication to degrees) 784 // 785 // To be 100% exact you must use the option 'plain' which assumes a plain 786 // screen. This is not necessary for the MAGIC-camera because the 787 // difference between both is less than 1e-3. 788 // 789 // You should always be aware of the fact, that the shown stars and the 790 // displayed grid is the ideal case, like a reflection on a virtual 791 // perfectly aligned central mirror. In reality the star-positions are 792 // smeared to the edge of the camera the more the distance to the center 793 // is, such that the center of gravity of the light distribution might 794 // be more far away from the center than the display shows. 795 // 796 // 797 void MAstroCatalog::AddPrimitives(TString o) 798 { 799 const Bool_t same = o.Contains("same", TString::kIgnoreCase); 800 const Bool_t local = o.Contains("local", TString::kIgnoreCase); 801 const Bool_t mirx = o.Contains("mirrorx", TString::kIgnoreCase); 802 const Bool_t miry = o.Contains("mirrory", TString::kIgnoreCase); 803 const Bool_t mirror = o.Contains("mirror", TString::kIgnoreCase) && !mirx && !miry; 804 805 // X is vice versa, because ra is defined anti-clockwise 806 mirx || mirror ? ResetBit(kMirrorX) : SetBit(kMirrorX); 807 miry || mirror ? SetBit(kMirrorY) : ResetBit(kMirrorY); 774 808 775 809 const TRotation rot(GetGrid(local)); … … 782 816 TVector2 s(v->Phi(), v->Theta()); 783 817 if (Convert(rot, s)==kTRUE) 784 DrawStar(s.X(), -(TMath::Pi()/2-s.Y()), *v, kFALSE); 785 } 786 787 TPaveText *pv = new TPaveText(0.01, 0.90, 0.63, 0.99, "brNDC"); 788 pv->AddText(GetPadTitle()); 789 AddMap(pv); 818 DrawStar(s.X(), s.Y(), *v, kFALSE); 819 } 820 821 if (!same) 822 { 823 TPaveText *pv = new TPaveText(0.01, 0.90, 0.63, 0.99, "brNDC"); 824 pv->AddText(GetPadTitle()); 825 AddMap(pv); 826 } 790 827 791 828 TMarker *mk=new TMarker(0, 0, kMultiply); … … 796 833 797 834 // -------------------------------------------------------------------------- 798 void MAstroCatalog::SetRangePad() 799 { 800 const Double_t edge = fRadiusFOV/TMath::Sqrt(2.); 801 gPad->Range(-edge, -edge, edge, edge); 802 803 const Float_t w = gPad->GetWw(); 804 const Float_t h = gPad->GetWh(); 805 806 if (w<h) 807 gPad->Range(-edge, -edge*h/w, edge, edge*h/w); 808 else 809 gPad->Range(-edge*w/h, -edge, edge*w/h, edge); 835 void MAstroCatalog::SetRangePad(Option_t *o) 836 { 837 if (TString(o).Contains("same", TString::kIgnoreCase)) 838 return; 839 840 const Double_t edge = fRadiusFOV/TMath::Sqrt(2.); 841 gPad->Range(-edge, -edge, edge, edge); 842 843 const Float_t w = gPad->GetWw(); 844 const Float_t h = gPad->GetWh(); 845 846 if (w<h) 847 gPad->Range(-edge, -edge*h/w, edge, edge*h/w); 848 else 849 gPad->Range(-edge*w/h, -edge, edge*w/h, edge); 810 850 } 811 851 … … 815 855 DeleteMap(); 816 856 817 SetRangePad( );857 SetRangePad(o); 818 858 819 859 TStopwatch clk; … … 827 867 AppendPad(o); 828 868 829 // Append all objects to pad830 DrawMap();831 832 869 ResetBit(kHasChanged); 833 870 } 834 871 835 872 // -------------------------------------------------------------------------- 836 void MAstroCatalog:: DrawMap()873 void MAstroCatalog::PaintMap() 837 874 { 838 875 Long_t key, val; 839 876 TExMapIter map(&fMapG); 840 877 while (map.Next(key, val)) 841 ((TObject*)key)-> Draw();878 ((TObject*)key)->Paint(); 842 879 } 843 880 … … 1016 1053 fToolTip->Show(x+4, y+4); 1017 1054 } 1055 /* 1056 void MAstroCatalog::RecursiveRemove(TObject *obj) 1057 { 1058 ULong_t hash; 1059 Long_t key, val; 1060 1061 TExMapIter map(&fMapG); 1062 while (map.Next(hash, key, val)) 1063 { 1064 if (key != (Long_t)obj) 1065 continue; 1066 1067 fMapG.Remove(hash, key); 1068 delete (TObject*)(key); 1069 if (val) 1070 delete (TString*)(val); 1071 break; 1072 } 1073 } 1074 */ -
trunk/MagicSoft/Mars/mastro/MAstroCatalog.h
r3568 r3666 94 94 95 95 virtual Int_t ConvertToPad(const TVector3 &w, TVector2 &v) const; 96 virtual void AddPrimitives( Option_t *o);97 virtual void SetRangePad( );96 virtual void AddPrimitives(TString o); 97 virtual void SetRangePad(Option_t *o); 98 98 99 99 Int_t Convert(const TRotation &rot, TVector2 &v) const; … … 105 105 void Paint(Option_t *o=""); 106 106 Int_t DistancetoPrimitive(Int_t px, Int_t py); 107 void DrawMap(); 107 //void RecursiveRemove(TObject *obj); 108 void PaintMap(); 108 109 void DeleteMap() 109 110 { … … 117 118 118 119 delete (TString*)(val); 119 /* 120 Long_t key2, val2; 121 TExMapIter map2(&fMapG); 122 while (map2.Next(key2, val2)) 123 if (val==val2) 124 { 125 delete (TObject*)key; 126 fMapG.Remove(key); 127 }*/ 120 /* 121 Long_t key2, val2; 122 TExMapIter map2(&fMapG); 123 while (map2.Next(key2, val2)) 124 if (val==val2) 125 { 126 delete (TObject*)key; 127 fMapG.Remove(key); 128 } 129 */ 128 130 } 129 131 fMapG.Delete(); … … 134 136 kHasChanged = BIT(15), 135 137 kGuiActive = BIT(16), 136 kPlainScreen = BIT(17) 138 kPlainScreen = BIT(17), 139 kMirrorX = BIT(18), 140 kMirrorY = BIT(19) 137 141 }; 138 142 … … 140 144 MVector3 fRaDec; // pointing position 141 145 142 MObservatory *fObservatory; // Possible obervator alocation146 MObservatory *fObservatory; // Possible obervatory location 143 147 MTime *fTime; // Possible observation time 144 148 … … 153 157 void AddMap(TObject *k, void *v=0) 154 158 { 155 k->SetBit(kCanDelete);156 k->SetBit(kCannotPick);159 //k->SetBit(kCanDelete); 160 //k->SetBit(kCannotPick); 157 161 fMapG.Add(fMapG.GetSize(), (Long_t)k, (Long_t)v); 158 162 } … … 164 168 void SetTime(const MTime &time); 165 169 void SetObservatory(const MObservatory &obs); 166 void SetLimMag(Double_t mag) { fLimMag=mag; 170 void SetLimMag(Double_t mag) { fLimMag=mag; Update(); } // *MENU* *ARGS={mag=>fLimMag} 167 171 void SetRadiusFOV(Double_t deg) 168 172 { -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r3568 r3666 333 333 334 334 // 335 // Update current speed each second336 // 337 if (fDisplay && t0-t2>(TTime)1 000)338 { 339 const Int_t speed = 1000*(num-start)/(long int)(t0-t2);335 // Update current speed each 1.5 second 336 // 337 if (fDisplay && t0-t2>(TTime)1500) 338 { 339 const Float_t speed = 1000.*(num-start)/(long int)(t0-t2); 340 340 TString txt = "Processing..."; 341 341 if (speed>0) 342 342 { 343 343 txt += " ("; 344 txt += speed;344 txt += (Int_t)speed; 345 345 txt += "Evts/s"; 346 346 if (fNumEvents>0) 347 347 { 348 348 txt += ", est: "; 349 txt += (int)(( long int)(t0-t2)*fNumEvents/(60000.*(num-start)));350 txt += "m ";349 txt += (int)((fNumEvents-num)/speed/60)+1; 350 txt += "min"; 351 351 } 352 352 //txt += (int)fmod(entries/(1000.*(num-start)/(long int)(t0-t2)), 60); … … 356 356 fDisplay->SetStatusLine1(txt); 357 357 start = num; 358 t2 = t 1;358 t2 = t0; 359 359 } 360 360 -
trunk/MagicSoft/Mars/mbase/MMath.cc
r3597 r3666 52 52 // -------------------------------------------------------------------------- 53 53 // 54 // Symmetrized significance - this is somehow analog to 55 // SignificanceLiMaSigned 56 // 57 // Returns Significance(s,b) if s>b otherwise -Significance(b, s); 58 // 59 Double_t MMath::SignificanceSym(Double_t s, Double_t b) 60 { 61 return s>b ? Significance(s, b) : -Significance(b, s); 62 } 63 64 // -------------------------------------------------------------------------- 65 // 54 66 // calculates the significance according to Li & Ma 55 67 // ApJ 272 (1983) 317, Formula 17 … … 58 70 // b // b: number of off events 59 71 // alpha = t_on/t_off; // t: observation time 72 // 73 // The significance has the same (positive!) value for s>b and b>s. 60 74 // 61 75 // Returns -1 if sum<0 or alpha<0 or the argument of sqrt<0 … … 77 91 return l+m<0 ? -1 : TMath::Sqrt((l+m)*2); 78 92 } 93 94 // -------------------------------------------------------------------------- 95 // 96 // Calculates MMath::SignificanceLiMa(s, b, alpha). Returns 0 if the 97 // calculation has failed. Otherwise the Li/Ma significance which was 98 // calculated. If s<b a negative value is returned. 99 // 100 Double_t MMath::SignificanceLiMaSigned(Double_t s, Double_t b, Double_t alpha) 101 { 102 const Double_t sig = SignificanceLiMa(s, b, alpha); 103 if (sig<=0) 104 return 0; 105 106 return TMath::Sign(sig, s-b); 107 } -
trunk/MagicSoft/Mars/mbase/MMath.h
r3582 r3666 10 10 public: 11 11 static Double_t Significance(Double_t s, Double_t b); 12 static Double_t SignificanceSym(Double_t s, Double_t b); 12 13 static Double_t SignificanceLiMa(Double_t s, Double_t b, Double_t alpha=1); 14 static Double_t SignificanceLiMaSigned(Double_t s, Double_t b, Double_t alpha=1); 13 15 14 16 ClassDef(MMath, 0) -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r3574 r3666 407 407 TMethodCall *MParContainer::GetterMethod(const char *name) const 408 408 { 409 TClass *cls = IsA()->GetBaseDataMember(name); 409 const TString n(name); 410 const Int_t pos1 = n.First('.'); 411 412 const TString part1 = pos1<0 ? n : n(0, pos1); 413 const TString part2 = pos1<0 ? TString("") : n(pos1+1, n.Length()); 414 415 TClass *cls = IsA()->GetBaseDataMember(part1); 410 416 if (cls) 411 417 { 412 TDataMember *member = cls->GetDataMember( name);418 TDataMember *member = cls->GetDataMember(part1); 413 419 if (!member) 414 420 { 415 *fLog << err << "Datamember '" << name<< "' not in " << GetDescriptor() << endl;421 *fLog << err << "Datamember '" << part1 << "' not in " << GetDescriptor() << endl; 416 422 return NULL; 423 } 424 425 // This handles returning references of contained objects, eg 426 // class X { TObject fO; TObject &GetO() { return fO; } }; 427 if (!member->IsBasic() && !part2.IsNull()) 428 { 429 cls = gROOT->GetClass(member->GetTypeName()); 430 if (!cls) 431 { 432 *fLog << err << "Datamember " << part1 << " ["; 433 *fLog << member->GetTypeName() << "] not in dictionary." << endl; 434 return NULL; 435 } 436 if (!cls->InheritsFrom(MParContainer::Class())) 437 { 438 *fLog << err << "Datamember " << part1 << " ["; 439 *fLog << member->GetTypeName() << "] does not inherit from "; 440 *fLog << "MParContainer." << endl; 441 return NULL; 442 } 443 444 const MParContainer *sub = (MParContainer*)((ULong_t)this+member->GetOffset()); 445 return sub->GetterMethod(part2); 446 } 447 448 if (member->IsaPointer()) 449 { 450 *fLog << warn << "Data-member " << part1 << " is a pointer..." << endl; 451 *fLog << dbginf << "Not yet implemented!" << endl; 452 //TClass *test = gROOT->GetClass(member->GetTypeName()); 453 return 0; 417 454 } 418 455 … … 422 459 } 423 460 424 *fLog << warn << "No standard access for '" << name<< "' in ";461 *fLog << warn << "No standard access for '" << part1 << "' in "; 425 462 *fLog << GetDescriptor() << " or one of its base classes." << endl; 426 463 … … 428 465 429 466 *fLog << warn << "Trying to find MethodCall '" << ClassName(); 430 *fLog << "::Get" << name<< "' instead <LEAKS MEMORY>" << endl;431 call = new TMethodCall(IsA(), (TString)"Get"+ name, "");467 *fLog << "::Get" << part1 << "' instead <LEAKS MEMORY>" << endl; 468 call = new TMethodCall(IsA(), (TString)"Get"+part1, ""); 432 469 if (call->GetMethod()) 433 470 return call; … … 436 473 437 474 *fLog << warn << "Trying to find MethodCall '" << ClassName(); 438 *fLog << "::" << name<< "' instead <LEAKS MEMORY>" << endl;439 call = new TMethodCall(IsA(), name, "");475 *fLog << "::" << part1 << "' instead <LEAKS MEMORY>" << endl; 476 call = new TMethodCall(IsA(), part1, ""); 440 477 if (call->GetMethod()) 441 478 return call; … … 443 480 delete call; 444 481 445 *fLog << err << "Sorry, no getter method found for " << name<< endl;482 *fLog << err << "Sorry, no getter method found for " << part1 << endl; 446 483 return NULL; 447 484 } -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r3512 r3666 1433 1433 // where (eg Eventloop) first! 1434 1434 1435 gLog << dbg << fName << " is on heap: " << (int)IsOnHeap() << endl;1435 //gLog << dbg << fName << " is on heap: " << (int)IsOnHeap() << endl; 1436 1436 1437 1437 if (TestBit(kExitLoopOnExit) || TestBit(kExitLoopOnClose)) … … 1443 1443 if (fIsLocked<=0 && IsOnHeap()) 1444 1444 { 1445 gLog << dbg << "delete " << fName << ";" << endl;1445 //gLog << dbg << "delete " << fName << ";" << endl; 1446 1446 delete this; 1447 1447 } 1448 1448 fStatus = kFileExit; 1449 gLog << dbg << fName << ".fStatus=kFileExit;" << endl;1449 //gLog << dbg << fName << ".fStatus=kFileExit;" << endl; 1450 1450 } 1451 1451 -
trunk/MagicSoft/Mars/mbase/MTask.cc
r3497 r3666 106 106 MTask::MTask(const char *name, const char *title) 107 107 : fFilter(NULL), fSerialNumber(0), fIsPreprocessed(kFALSE), 108 f NumExecutions(0), fStopwatch(0)108 fStopwatch(0) 109 109 { 110 110 fName = name ? name : "MTask"; … … 194 194 Int_t MTask::CallPreProcess(MParList *plist) 195 195 { 196 fNumExecutions = 0;197 196 fStopwatch->Reset(); 198 197 … … 240 239 return kTRUE; 241 240 242 fNumExecutions++;243 244 241 fStopwatch->Start(kFALSE); 245 242 const Int_t rc = Process(); … … 346 343 // -------------------------------------------------------------------------- 347 344 // 348 // Return total CPU execution time of task 345 // Return the total number of calls to Process(). If Process() was not 346 // called due to a set filter this is not counted. 347 // 348 UInt_t MTask::GetNumExecutions() const 349 { 350 return (UInt_t)fStopwatch->Counter(); 351 } 352 353 // -------------------------------------------------------------------------- 354 // 355 // Return total CPU execution time in seconds of calls to Process(). 356 // If Process() was not called due to a set filter this is not counted. 349 357 // 350 358 Double_t MTask::GetCpuTime() const … … 355 363 // -------------------------------------------------------------------------- 356 364 // 357 // Return total real execution time of task 365 // Return total real execution time in seconds of calls to Process(). 366 // If Process() was not called due to a set filter this is not counted. 358 367 // 359 368 Double_t MTask::GetRealTime() const … … 366 375 // Prints the relative time spent in Process() (relative means relative to 367 376 // its parent Tasklist) and the number of times Process() was executed. 377 // Don't wonder if the sum of the tasks in a tasklist is not 100%, 378 // because only the call to Process() of the task is measured. The 379 // time of the support structure is ignored. The faster your analysis is 380 // the more time is 'wasted' in the support structure. 381 // Only the CPU time is displayed. This means that exspecially task 382 // which have a huge part of file i/o will be underestimated in their 383 // relative wasted time. 368 384 // For convinience the lvl argument results in a number of spaces at the 369 385 // beginning of the line. So that the structur of a tasklist can be … … 379 395 380 396 *fLog << all << setfill(' ') << setw(lvl) << " "; 381 if (fStopwatch->CpuTime()>0 && time>0) 382 *fLog << setw(3) << (Int_t)(fStopwatch->CpuTime()/time*100+.5) << "% "; 397 398 if (GetCpuTime()>0 && time>0 && GetCpuTime()>=0.001*time) 399 *fLog << Form("%5.1f", GetCpuTime()/time*100) << "% "; 383 400 else 384 *fLog << " ";401 *fLog << " "; 385 402 *fLog << GetDescriptor() << "\t"; 386 *fLog << dec << fNumExecutions;403 *fLog << dec << GetNumExecutions(); 387 404 if (fFilter) 388 405 *fLog << " <" << fFilter->GetName() << ">"; -
trunk/MagicSoft/Mars/mbase/MTask.h
r3497 r3666 29 29 30 30 Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList) 31 UInt_t fNumExecutions; //! Number of Excutions32 31 33 TStopwatch *fStopwatch; //! 32 TStopwatch *fStopwatch; //! Count the execution time and number of executions 34 33 35 34 virtual Int_t PreProcess(MParList *pList); … … 74 73 // Filter functions 75 74 virtual void SetFilter(MFilter *filter) { fFilter=filter; } 76 const MFilter *GetFilter() const { return fFilter; }77 MFilter *GetFilter() { return fFilter; } // for MContinue only75 const MFilter *GetFilter() const { return fFilter; } 76 MFilter *GetFilter() { return fFilter; } // for MContinue only 78 77 79 78 // Display functions … … 86 85 TString AddSerialNumber(const TString &str) const { return AddSerialNumber(str, fSerialNumber); } 87 86 88 virtual void SetSerialNumber(Byte_t num) { fSerialNumber = num; }89 Byte_t GetSerialNumber() const{ return fSerialNumber; }87 virtual void SetSerialNumber(Byte_t num) { fSerialNumber = num; } 88 Byte_t GetSerialNumber() const { return fSerialNumber; } 90 89 91 90 const char *GetDescriptor() const; 92 91 93 92 // Task execution statistics 94 UInt_t GetNumExecutions() const { return fNumExecutions; }93 UInt_t GetNumExecutions() const; 95 94 Double_t GetCpuTime() const; 96 95 Double_t GetRealTime() const; -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r3497 r3666 635 635 if (title) 636 636 *fLog << "\t" << fTitle; 637 if (time>=0) 638 *fLog << Form(" %5.1f", GetCpuTime()/time*100) << "%"; 639 else 640 *fLog << " 100.0%"; 637 641 *fLog << endl; 638 642 } -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r3497 r3666 70 70 71 71 void Print(Option_t *opt = "") const; 72 void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE, Double_t time= 0) const;72 void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE, Double_t time=-1) const; 73 73 void SetOwner(Bool_t enable=kTRUE); 74 74 -
trunk/MagicSoft/Mars/mbase/MTime.cc
r3371 r3666 362 362 const Double_t sum = (r1+r2)/(24*3600); 363 363 364 return fmod(sum, 1)*TMath::TwoPi() +TMath::TwoPi();364 return fmod(sum, 1)*TMath::TwoPi();//+TMath::TwoPi(); 365 365 } 366 366 -
trunk/MagicSoft/Mars/mcamera/MCameraAUX.h
r2593 r3666 14 14 Bool_t fStatusCaosLEDs; // Monitored status: o=off, 1=on, Cam.CaOs.LED_state 15 15 Bool_t fStatusFansFADC; // Monitored status: o=off, 1=on, Cam.FADC.Fans_state 16 16 17 public: 17 18 MCameraAUX() … … 20 21 fTitle = "Container storing information about the Camera auxiliary system"; 21 22 } 23 24 Bool_t GetRequestCaosLEDs() const { return fRequestCaosLEDs; } 25 Bool_t GetRequestFansFADC() const { return fRequestFansFADC; } 26 Bool_t GetStatusCaosLEDs() const { return fStatusCaosLEDs; } 27 Bool_t GetStatusFansFADC() const { return fStatusFansFADC; } 28 22 29 ClassDef(MCameraAUX, 1) // Container storing information about the Camera auxiliary system 23 30 }; -
trunk/MagicSoft/Mars/mcamera/MCameraCalibration.h
r2864 r3666 31 31 Byte_t GetStatusIO() const { return fStatusIO; } 32 32 Byte_t GetStatusLoVoltage() const { return fStatusLoVoltage; } 33 33 34 Bool_t GetRequestHiVoltage() const { return fRequestHiVoltage; } 34 35 Bool_t GetRequestLoVoltage() const { return fRequestLoVoltage; } -
trunk/MagicSoft/Mars/mcamera/MCameraHV.h
r3216 r3666 28 28 TArrayS fHV; // [V] Measured high Voltages for all PMTs 29 29 30 Float_t fMean; // [V] Mean high voltage of the camera31 32 30 public: 33 31 MCameraHV() : fHV(577) … … 39 37 Byte_t GetStatus() const { return fStatus; } 40 38 Bool_t GetStatusRamping() const { return fStatusRamping; } 39 41 40 Short_t GetVoltageA() const { return fVoltageA; } 42 41 Short_t GetVoltageB() const { return fVoltageB; } 43 Byte_t GetCurrentA() const { return fCurrentA; }44 Byte_t GetCurrentB() const { return fCurrentB; }45 42 46 Float_t GetMean() { fMean = fHV.GetSum()/fHV.GetSize(); return fMean; } 43 Byte_t GetCurrentA() const { return fCurrentA; } 44 Byte_t GetCurrentB() const { return fCurrentB; } 45 46 Float_t GetMean() const { return fHV.GetSum()/fHV.GetSize(); } 47 47 48 48 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const 49 50 51 52 49 { 50 val = fHV[idx]; 51 return val>0; 52 } 53 53 void DrawPixelContent(Int_t num) const 54 55 54 { 55 } 56 56 57 57 ClassDef(MCameraHV, 1) // Container storing information about the Camera HV -
trunk/MagicSoft/Mars/mcamera/MCameraLV.h
r2895 r3666 14 14 friend class MReportCamera; 15 15 private: 16 Byte_t fStatus; 17 Bool_t fRequestPowerSupply; 16 Byte_t fStatus; // CaCo monitored LV PS status: , Cam.LV_state 17 Bool_t fRequestPowerSupply; // Requested status: o=off, 1=on, blv_ps_status 18 18 19 Float_t fTemp; 20 Byte_t fHumidity; 19 Float_t fTemp; // Measured status: o=off, 1=on, blv_temp 20 Byte_t fHumidity; // Measured status: o=off, 1=on, blv_RelativeHumidity 21 21 22 MCameraPowerSupply fPowerSupplyA; 23 MCameraPowerSupply fPowerSupplyB; 22 MCameraPowerSupply fPowerSupplyA; // power supply camera part A 23 MCameraPowerSupply fPowerSupplyB; // power supply camera part B 24 24 25 25 public: … … 32 32 Byte_t GetStatus() const { return fStatus; } 33 33 Bool_t GetRequestPowerSupply() const { return fRequestPowerSupply; } 34 34 35 Float_t GetTemp() const { return fTemp; } 35 36 Byte_t GetHumidity() const { return fHumidity; } 37 38 const MCameraPowerSupply &GetPowerSupplyA() const { return fPowerSupplyA; } 39 const MCameraPowerSupply &GetPowerSupplyB() const { return fPowerSupplyB; } 36 40 37 41 ClassDef(MCameraLV, 1) // Container storing information about the Camera LV -
trunk/MagicSoft/Mars/mcamera/MCameraLid.h
r2593 r3666 14 14 Bool_t fLimitOpen; // 0=not active, 1= active 15 15 Bool_t fLimitClose; // 0=not active, 1= active 16 16 17 Bool_t fSafetyLimitOpen; // 0=not active, 1= active 17 18 Bool_t fSafetyLimitClose; // 0=not active, 1= active 19 18 20 Byte_t fStatusLid; // 0=positioning, 1=open, 2=closed 19 21 Byte_t fStatusMotor; // 0=stopped, 1=opening, 2=closing 22 20 23 public: 21 24 MCameraLid() … … 24 27 fTitle = "Container storing information about a Camera lid"; 25 28 } 29 30 Bool_t GetLimitOpen() const { return fLimitOpen; } 31 Bool_t GetLimitClose() const { return fLimitClose; } 32 33 Bool_t GetSafetyLimitOpen() const { return fSafetyLimitOpen; } 34 Bool_t GetSafetyLimitClose() const { return fSafetyLimitClose; } 35 36 Byte_t GetStatusLid() const { return fStatusLid; } 37 Byte_t GetStatusMotor() const { return fStatusMotor; } 38 26 39 ClassDef(MCameraLid, 1) // Container storing information about a Camera lid 27 40 }; -
trunk/MagicSoft/Mars/mcamera/MCameraLids.h
r3066 r3666 27 27 Byte_t GetStatus() const { return fStatus; } 28 28 29 const MCameraLid &GetLidA() const { return fLidA; } 30 const MCameraLid &GetLidB() const { return fLidB; } 31 29 32 ClassDef(MCameraLids, 1) // Container storing information about the Camera lids 30 33 }; -
trunk/MagicSoft/Mars/mcamera/MCameraPowerSupply.h
r2593 r3666 10 10 friend class MReportCamera; 11 11 private: 12 13 14 15 12 Float_t fVoltagePos5V; // [V] voltage_pos5 (+5V) 13 Float_t fVoltagePos12V; // [V] voltage_pos12 (+12V) 14 Float_t fVoltageNeg12V; // [V] voltage_neg12 (-12V) 15 Float_t fVoltageOptLinkPos12V; // [V] volatge_opt_link_pos12 (+12V) 16 16 17 18 19 20 17 Float_t fCurrentPos5V; // [A] current_pos5 (+5V) 18 Float_t fCurrentPos12V; // [A] current_pos12 (+12V) 19 Float_t fCurrentNeg12V; // [A] current_neg12 (-12V) 20 Float_t fCurrentOptLinkPos12V; // [A] current_opt_link_pos12 (+12V) 21 21 22 22 public: … … 26 26 fTitle = "Container storing information about the Camera power supply"; 27 27 } 28 29 Float_t GetVoltagePos5V() const { return fVoltagePos5V; } 30 Float_t GetVoltagePos12V() const { return fVoltagePos12V; } 31 Float_t GetVoltageNeg12V() const { return fVoltageNeg12V; } 32 Float_t GetVoltageOptLinkPos12V() const { return fVoltageOptLinkPos12V; } 33 34 Float_t GetCurrentPos5V() const { return fCurrentPos5V; } 35 Float_t GetCurrentPos12V() const { return fCurrentPos12V; } 36 Float_t GetCurrentNeg12V() const { return fCurrentNeg12V; } 37 Float_t GetCurrentOptLinkPos12V() const { return fCurrentOptLinkPos12V; } 38 28 39 ClassDef(MCameraPowerSupply, 1) // Container storing information about the Camera power supply 29 40 }; -
trunk/MagicSoft/Mars/mdata/DataLinkDef.h
r1524 r3666 12 12 #pragma link C++ class MDataMember+; 13 13 #pragma link C++ class MDataChain+; 14 #pragma link C++ class MDataFormula+; 14 15 15 16 #endif -
trunk/MagicSoft/Mars/mdata/MDataChain.cc
r3572 r3666 25 25 ///////////////////////////////////////////////////////////////////////////// 26 26 // 27 // MDataChain 27 // MDataChain 28 // ========== 28 29 // 29 30 // With this chain you can concatenate simple mathematical operations on 30 31 // members of mars containers. 32 // 33 // 34 // Rules 35 // ----- 31 36 // 32 37 // In the constructor you can give rule, like … … 36 41 // in the containers. The result will be fDist divided by fLength. 37 42 // 43 // In case you want to access a data-member which is a data member object 44 // you can acces it with (Remark: it must derive from MParContainer): 45 // "MCameraLV.fPowerSupplyA.fVoltagePos5V" 46 // 38 47 // You can also use brackets: 39 48 // "HillasDource.fDist / (MHillas.fLength + MHillas.fWidth)" 40 49 // 41 // The allowed operations are: +, -, *, /, % 50 // 51 // Operators 52 // --------- 53 // 54 // The allowed operations are: +, -, *, /, %, ^ 42 55 // 43 56 // While a%b returns the floating point reminder of a/b. 57 // While a^b returns a to the power of b 44 58 // 45 59 // Warning: There is no priority rule build in. So better use brackets … … 98 112 // inf is the symbol for an infinite number. 99 113 // 114 // 115 // Constants 116 // --------- 117 // 100 118 // Constants are implemented in ParseDataMember, namely: 101 // kPi: TMath::Pi()102 // kRad2Deg: 180/kPi103 // kDeg2Rad: kPi/180119 // kPi: TMath::Pi() 120 // kRad2Deg: 180/kPi 121 // kDeg2Rad: kPi/180 104 122 // 105 123 // You can also defined constants which are defined in TMath by: 106 // kLn10 for static Double_t TMath::Ln10(); 107 // kLogE for static Double_t TMath::LogE(); 108 // kRadToDeg for static Double_t TMath::RadToDeg(); 109 // kDegToRad for static Double_t TMath::DegToRad(); 110 // 111 // Remark: In older root versions only Pi() and E() are implemented in 112 // TMath. 113 // 124 // kLn10 for static Double_t TMath::Ln10(); 125 // kLogE for static Double_t TMath::LogE(); 126 // kRadToDeg for static Double_t TMath::RadToDeg(); 127 // kDegToRad for static Double_t TMath::DegToRad(); 128 // ... 129 // 130 // Remark: 131 // In older root versions only Pi() and E() are implemented 132 // in TMath. 133 // 134 // 135 // Variable Parameters 136 // ------------------------ 114 137 // If you want to use variables, eg for fits you can use [0], [1], ... 115 138 // These values are initialized with 0 and set by calling 116 139 // SetVariables(). 117 140 // 141 // 142 // Multi-argument functions 143 // ------------------------ 144 // You can use multi-argument functions, too. The access is implemented 145 // via TFormula, which slows down thing a lot. If you can avoid usage 146 // of such expression you accelerate the access a lot. Example: 147 // "TMath::Hypot(MHillas.fMeanX, MHillas.MeanY)" 148 // "pow(MHillas.fMeanX*MHillas.MeanY, -1.2)" 149 // It should be possible to use all functions which are accessible 150 // via the root-dictionary. 151 // 152 // 118 153 // REMARK: 119 // - All the random functions are returning 0 if gRandom==0 120 // - You may get better results if you are using a TRandom3 121 // 122 // FIXME: The possibility to use other objects inheriting from MData 123 // is missing. 124 // Maybe we can use gInterpreter->Calc("") for this. 125 // gROOT->ProcessLineFast("line"); 154 // - All the random functions are returning 0 if gRandom==0 155 // - You may get better results if you are using a TRandom3 156 // 157 // To Do: 158 // - The possibility to use other objects inheriting from MData 159 // is missing. 160 // - By automatic pre-adding brackets to the rule it would be possible 161 // to implement priorities for operators. 126 162 // 127 163 ///////////////////////////////////////////////////////////////////////////// … … 141 177 #include "MDataValue.h" 142 178 #include "MDataMember.h" 179 #include "MDataFormula.h" 143 180 #include "MDataElement.h" 144 181 … … 222 259 for (int i=0; i<l; i++) 223 260 { 224 if (!isalnum(txt[i]) && txt[i]!='.' && txt[i]!=' ;' &&261 if (!isalnum(txt[i]) && txt[i]!='.' && txt[i]!=':' && txt[i]!=';' && 225 262 /*txt[i]!='['&&txt[i]!=']'&&*/ 226 263 ((txt[i]!='-' && txt[i]!='+') || i!=0)) … … 394 431 case '/': 395 432 case '%': 433 case '^': 396 434 if (member0) 397 435 { … … 507 545 508 546 OperatorType_t op = ParseOperator(text); 547 548 Int_t first = GetBracket(txt, '(', ')'); 549 TString sub = op==kENegative || op==kEPositive ? text.Remove(0,1) + txt : txt(1, first-1); 550 txt.Remove(0, first+1); 551 509 552 if (op==kENoop) 510 553 { 554 newmember = new MDataFormula(Form("%s(%s)", (const char*)text, (const char*)sub)); 555 if (newmember->IsValid()) 556 break; 557 511 558 *fLog << err << dbginf << "Syntax Error: Operator '" << text << "' unknown." << endl; 512 559 if (member0) … … 514 561 return NULL; 515 562 } 516 517 Int_t first = GetBracket(txt, '(', ')');518 TString sub = op==kENegative || op==kEPositive ? text.Remove(0,1) + txt : txt(1, first-1);519 txt.Remove(0, first+1);520 563 521 564 newmember = new MDataChain(sub, op); … … 604 647 return 0; 605 648 } 606 607 /*608 void MDataChain::Print(Option_t *opt) const609 {610 *fLog << GetRule() << flush;611 Bool_t bracket = fOperatorType!=kENoop && !fMember->InheritsFrom(MDataList::Class());612 613 switch (fOperatorType)614 {615 case kEAbs: *fLog << "abs" << flush; break;616 case kELog: *fLog << "log" << flush; break;617 case kELog10: *fLog << "log10" << flush; break;618 case kESin: *fLog << "sin" << flush; break;619 case kECos: *fLog << "cos" << flush; break;620 case kETan: *fLog << "tan" << flush; break;621 case kESinH: *fLog << "sinh" << flush; break;622 case kECosH: *fLog << "cosh" << flush; break;623 case kETanH: *fLog << "tanh" << flush; break;624 case kEASin: *fLog << "asin" << flush; break;625 case kEACos: *fLog << "acos" << flush; break;626 case kEATan: *fLog << "atan" << flush; break;627 case kESqrt: *fLog << "sqrt" << flush; break;628 case kEExp: *fLog << "exp" << flush; break;629 case kEPow10: *fLog << "pow10" << flush; break;630 case kESgn: *fLog << "sgn" << flush; break;631 case kENegative: *fLog << "-" << flush; break;632 case kEPositive: *fLog << "+" << flush; break;633 case kENoop:634 break;635 }636 637 if (bracket)638 *fLog << "(" << flush;639 640 fMember->Print();641 642 if (bracket)643 *fLog << ")" << flush;644 }645 */646 649 647 650 // -------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mdata/MDataChain.h
r3572 r3666 17 17 { 18 18 private: 19 MData *fMember; // Filter19 MData *fMember; // Filter 20 20 21 21 // PLEASE, always add new enums to the end of the enumeration, -
trunk/MagicSoft/Mars/mdata/MDataList.cc
r3572 r3666 79 79 fSign = kEModul; 80 80 return; 81 case '^': 82 fSign = kEPow; 83 return; 81 84 default: 82 85 fSign = kENone; … … 142 145 while ((member=(MData*)Next())) 143 146 { 144 Double_t d = member->GetValue();147 const Double_t d = member->GetValue(); 145 148 if (d==0) 146 149 { 147 *fLog << warn << "Warning: Division by zero (" << member->GetName() << ")"<< endl;150 *fLog << warn << "Warning: Division by zero: " << member->GetRule() << endl; 148 151 return 0; 149 152 } … … 155 158 while ((member=(MData*)Next())) 156 159 { 157 Double_t d = member->GetValue();160 const Double_t d = member->GetValue(); 158 161 if (d==0) 159 162 { 160 *fLog << warn << "Warning: Modulo division by zero (" << member->GetName() << ")"<< endl;163 *fLog << warn << "Warning: Modulo division by zero: " << member->GetRule() << endl; 161 164 return 0; 162 165 } … … 164 167 } 165 168 break; 169 case kEPow: 170 while ((member=(MData*)Next())) 171 val = pow(val, member->GetValue()); 172 break; 166 173 } 167 174 return val; … … 185 192 } 186 193 194 Bool_t MDataList::IsValid() const 195 { 196 TIter Next(&fMembers); 197 198 MData *data = NULL; 199 while ((data=(MData*)Next())) 200 if (!data->IsValid()) 201 return kFALSE; 202 203 return kTRUE; 204 } 205 187 206 // -------------------------------------------------------------------------- 188 207 // 189 208 // If you want to add a new member to the list call this function with the 190 // pointer to the member to be added. 209 // pointer to the member to be added. 191 210 // 192 211 Bool_t MDataList::AddToList(MData *member) … … 335 354 str += "%"; 336 355 break; 356 357 case kEPow: 358 str += "^"; 359 break; 337 360 } 338 361 -
trunk/MagicSoft/Mars/mdata/MDataList.h
r3572 r3666 23 23 TOrdCollection fMembers; // Container for the filters 24 24 25 typedef enum { kENone, kEPlus, kEMinus, kEMult, kEDiv, kEModul } SignType_t;25 typedef enum { kENone, kEPlus, kEMinus, kEMult, kEDiv, kEModul, kEPow } SignType_t; 26 26 SignType_t fSign; 27 27 … … 41 41 void SetOwner(Bool_t enable=kTRUE) { enable ? SetBit(kIsOwner) : ResetBit(kIsOwner); } 42 42 43 Bool_t IsValid() const { return fMembers.GetSize() ? kTRUE : kFALSE; }43 Bool_t IsValid() const;// { return fMembers.GetSize() ? kTRUE : kFALSE; } 44 44 Bool_t IsReadyToSave() const; 45 45 -
trunk/MagicSoft/Mars/mdata/Makefile
r2800 r3666 37 37 MDataValue.cc \ 38 38 MDataList.cc \ 39 MDataChain.cc 39 MDataChain.cc \ 40 MDataFormula.cc 40 41 41 42 SRCS = $(SRCFILES) -
trunk/MagicSoft/Mars/mfbase/MFilterList.cc
r3573 r3666 188 188 189 189 if (fFilters.FindObject(name)) 190 *fLog << warn<< "MFilterList::AddToList - '" << name << "' exists in List already..." << endl;190 *fLog << inf << "MFilterList::AddToList - '" << name << "' exists in List already..." << endl; 191 191 192 192 *fLog << inf << "Adding " << name << " to " << GetName() << "... " << flush; -
trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
r3547 r3666 53 53 54 54 #include <TClass.h> // IsA()->New() 55 #include <TVector2.h> // TVector2 55 56 56 57 #include "MLog.h" … … 92 93 93 94 for (UInt_t i=0; i<npix; i++) 94 fPixels[i] = new MGeomPix;95 fPixels[i] = new MGeomPix; 95 96 96 97 SetReadyToSave(); … … 195 196 void MGeomCam::CalcMaxRadius() 196 197 { 197 198 fMaxRadius.Set(fNumAreas+1); 199 fMinRadius.Set(fNumAreas+1); 200 201 for (Int_t i=0; i<fNumAreas+1; i++) 202 { 203 fMaxRadius[i] = 0.; 204 fMinRadius[i] = FLT_MAX; 205 } 206 207 for (UInt_t i=0; i<fNumPixels; i++) 208 { 209 210 const MGeomPix &pix = (*this)[i]; 211 212 const UInt_t s = pix.GetAidx(); 213 const Float_t x = pix.GetX(); 214 const Float_t y = pix.GetY(); 215 const Float_t d = pix.GetD(); 216 217 const Float_t r = TMath::Hypot(x, y); 218 219 const Float_t maxr = r + d; 220 const Float_t minr = r>d ? r-d : 0; 221 222 if (maxr>fMaxRadius[s+1]) 223 fMaxRadius[s+1] = maxr; 224 225 if (minr<fMinRadius[s+1]) 226 fMinRadius[s+1] = minr; 227 228 if (minr<fMinRadius[0]) 229 fMinRadius[0] = minr; 230 231 if (maxr>fMaxRadius[0]) 232 fMaxRadius[0] = maxr; 233 234 } 235 } 236 198 fMaxRadius.Set(fNumAreas+1); 199 fMinRadius.Set(fNumAreas+1); 200 201 for (Int_t i=0; i<fNumAreas+1; i++) 202 { 203 fMaxRadius[i] = 0.; 204 fMinRadius[i] = FLT_MAX; 205 } 206 207 for (UInt_t i=0; i<fNumPixels; i++) 208 { 209 const MGeomPix &pix = (*this)[i]; 210 211 const UInt_t s = pix.GetAidx(); 212 const Float_t x = pix.GetX(); 213 const Float_t y = pix.GetY(); 214 const Float_t d = pix.GetD(); 215 216 const Float_t r = TMath::Hypot(x, y); 217 218 const Float_t maxr = r + d; 219 const Float_t minr = r>d ? r-d : 0; 220 221 if (maxr>fMaxRadius[s+1]) 222 fMaxRadius[s+1] = maxr; 223 224 if (minr<fMinRadius[s+1]) 225 fMinRadius[s+1] = minr; 226 227 if (minr<fMinRadius[0]) 228 fMinRadius[0] = minr; 229 230 if (maxr>fMaxRadius[0]) 231 fMaxRadius[0] = maxr; 232 } 233 } 234 235 // -------------------------------------------------------------------------- 237 236 // 238 237 // Have to call the radii of the subcameras starting to count from 1 … … 240 239 Float_t MGeomCam::GetMaxRadius(const Int_t i) const 241 240 { 242 if (i==-1) return fMaxRadius[0];243 return i>fNumAreas ? -1 : fMaxRadius[i+1]; 244 } 245 241 return i<-1 || i>fNumAreas ? -1 : fMaxRadius[i+1]; 242 } 243 244 // -------------------------------------------------------------------------- 246 245 // 247 246 // Have to call the radii of the subcameras starting to count from 1 … … 249 248 Float_t MGeomCam::GetMinRadius(const Int_t i) const 250 249 { 251 if (i==-1) return fMinRadius[0]; 252 return i>fNumAreas ? -1 : fMinRadius[i+1]; 250 return i<-1 || i>fNumAreas ? -1 : fMinRadius[i+1]; 253 251 } 254 252 … … 302 300 return (TObject*)IsA()->New(); 303 301 } 302 303 // -------------------------------------------------------------------------- 304 // 305 // Return the pixel index corresponding to the coordinates given in x, y. 306 // The coordinates are given in pixel units (millimeters) 307 // If no pixel exists return -1; 308 // 309 Int_t MGeomCam::GetPixelIdxXY(Float_t x, Float_t y) const 310 { 311 for (unsigned int i=0; i<fNumPixels; i++) 312 if ((*this)[i].IsInside(x, y)) 313 return i; 314 315 return -1; 316 } 317 318 Int_t MGeomCam::GetPixelIdx(const TVector2 &v) const 319 { 320 return GetPixelIdxXY(v.X(), v.Y()); 321 } 322 323 Int_t MGeomCam::GetPixelIdxDeg(const TVector2 &v) const 324 { 325 return GetPixelIdxXYdeg(v.X(), v.Y()); 326 } 327 304 328 /* 305 329 void MGeomCam::Streamer(TBuffer &R__b) -
trunk/MagicSoft/Mars/mgeom/MGeomCam.h
r3547 r3666 12 12 #endif 13 13 14 class TVector2; 14 15 class MGeomPix; 15 16 … … 73 74 74 75 MGeomPix &operator[](Int_t i); 75 MGeomPix &operator[](Int_t i) const; 76 MGeomPix &operator[](Int_t i) const; 77 78 Int_t GetPixelIdx(const TVector2 &v) const; 79 Int_t GetPixelIdxDeg(const TVector2 &v) const; 80 Int_t GetPixelIdxXY(Float_t x, Float_t y) const; 81 Int_t GetPixelIdxXYdeg(Float_t x, Float_t y) const 82 { 83 return GetPixelIdxXY(x/fConvMm2Deg, y/fConvMm2Deg); 84 } 76 85 77 86 virtual void Print(Option_t *opt=NULL) const; -
trunk/MagicSoft/Mars/mgeom/MGeomPix.cc
r3392 r3666 133 133 *fLog << "d= " << fD << "mm A= " << fA << "mm²" << endl; 134 134 } 135 136 // ------------------------------------------------------------------------ 137 // 138 // compute the distance of a point (px,py) to the Hexagon center in 139 // MGeomPix coordinates. Return kTRUE if inside. 140 // 141 Bool_t MGeomPix::IsInside(Float_t px, Float_t py) const 142 { 143 // 144 // compute the distance of the Point to the center of the Hexagon 145 // 146 const Double_t dx = px-fX; 147 148 // 149 // Now check if point is outside of hexagon; just check x coordinate 150 // in three coordinate systems: the default one, in which two sides of 151 // the hexagon are paralel to the y axis (see camera displays) and two 152 // more, rotated with respect to that one by +- 60 degrees. 153 // 154 if (TMath::Abs(dx)*2>fD) 155 return kFALSE; 156 157 const Double_t dy = py-fY; 158 159 const static Double_t cos60 = TMath::Cos(60/kRad2Deg); 160 const static Double_t sin60 = TMath::Sin(60/kRad2Deg); 161 162 const Double_t dx2 = dx*cos60 + dy*sin60; 163 if (TMath::Abs(dx2)*2>fD) 164 return kFALSE; 165 166 const Double_t dx3 = dx*cos60 - dy*sin60; 167 if (TMath::Abs(dx3)*2>fD) 168 return kFALSE; 169 170 return kTRUE; 171 } -
trunk/MagicSoft/Mars/mgeom/MGeomPix.h
r3392 r3666 56 56 Bool_t IsInOuterRing() const { return TestBit(kIsInOuterRing); } 57 57 58 Bool_t IsInside(Float_t px, Float_t py) const; 59 58 60 /* 59 61 // -
trunk/MagicSoft/Mars/mhist/MHFalseSource.cc
r3597 r3666 99 99 // also different algorithms like (Li/Ma) 100 100 // - implement fit for best alpha distribution -- online (Paint) 101 // - currently a constant pointing position is assumed in Fill() 102 // - the center of rotation need not to be the camera center 101 103 // 102 104 ////////////////////////////////////////////////////////////////////////////// … … 117 119 #include "MObservatory.h" 118 120 #include "MPointingPos.h" 121 #include "MAstroCatalog.h" 119 122 #include "MAstroSky2Local.h" 120 123 #include "MStatusDisplay.h" … … 136 139 // 137 140 MHFalseSource::MHFalseSource(const char *name, const char *title) 138 : fMm2Deg(-1), fUseMmScale(kTRUE), fAlphaCut(12.5), fBgMean(55) 141 : fTime(0), fPointPos(0), fObservatory(0), fMm2Deg(-1), 142 fAlphaCut(12.5), fBgMean(55), fDistMin(-1), fDistMax(-1) 139 143 { 140 144 // … … 186 190 // -------------------------------------------------------------------------- 187 191 // 188 // Use this function to setup your own conversion factor between degrees189 // and millimeters. The conversion factor should be the one calculated in190 // MGeomCam. Use this function with Caution: You could create wrong values191 // by setting up your own scale factor.192 //193 void MHFalseSource::SetMm2Deg(Float_t mmdeg)194 {195 if (mmdeg<0)196 {197 *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl;198 return;199 }200 201 if (fMm2Deg>=0)202 *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl;203 204 fMm2Deg = mmdeg;205 }206 207 // --------------------------------------------------------------------------208 //209 // With this function you can convert the histogram ('on the fly') between210 // degrees and millimeters.211 //212 void MHFalseSource::SetMmScale(Bool_t mmscale)213 {214 if (fUseMmScale == mmscale)215 return;216 217 if (fMm2Deg<0)218 {219 *fLog << warn << dbginf << "Warning - Sorry, no conversion factor for conversion available." << endl;220 return;221 }222 223 if (fUseMmScale)224 {225 fHist.SetXTitle("x [mm]");226 fHist.SetYTitle("y [mm]");227 228 fHist.Scale(1./fMm2Deg);229 }230 else231 {232 fHist.SetXTitle("x [\\circ]");233 fHist.SetYTitle("y [\\circ]");234 235 fHist.Scale(1./fMm2Deg);236 }237 238 fUseMmScale = mmscale;239 }240 241 // --------------------------------------------------------------------------242 //243 192 // Calculate Significance as 244 193 // significance = (s-b)/sqrt(s+k*k*b) mit k=s/b … … 249 198 Double_t MHFalseSource::Significance(Double_t s, Double_t b) 250 199 { 251 return MMath::Significance (s, b);200 return MMath::SignificanceSym(s, b); 252 201 } 253 202 … … 263 212 Double_t MHFalseSource::SignificanceLiMa(Double_t s, Double_t b, Double_t alpha) 264 213 { 265 const Double_t lima = MMath::SignificanceLiMa(s, b); 266 return lima<0 ? 0 : lima; 214 return MMath::SignificanceLiMaSigned(s, b); 215 /* 216 const Double_t lima = MMath::SignificanceLiMa(s, b); 217 return lima<0 ? 0 : lima; 218 */ 267 219 } 268 220 … … 277 229 { 278 230 const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam"); 279 if ( geom)231 if (!geom) 280 232 { 281 fMm2Deg = geom->GetConvMm2Deg(); 282 fUseMmScale = kFALSE; 283 284 fHist.SetXTitle("x [\\circ]"); 285 fHist.SetYTitle("y [\\circ]"); 233 *fLog << err << "MGeomCam not found... aborting." << endl; 234 return kFALSE; 286 235 } 236 237 fMm2Deg = geom->GetConvMm2Deg(); 287 238 288 239 MBinning binsa; … … 292 243 if (!bins) 293 244 { 294 Float_t r = geom ? geom->GetMaxRadius() : 600; 295 r /= 3; 296 if (!fUseMmScale) 297 r *= fMm2Deg; 245 const Float_t r = (geom ? geom->GetMaxRadius()/3 : 200)*fMm2Deg; 298 246 299 247 MBinning b; … … 314 262 fObservatory = (MObservatory*)plist->FindObject(AddSerialNumber("MObservatory")); 315 263 if (!fObservatory) 316 *fLog << err << "MObservatory not found... no derotation." << endl; 317 264 *fLog << warn << "MObservatory not found... no derotation." << endl; 265 266 // FIXME: Because the pointing position could change we must check 267 // for the current pointing position and add a offset in the 268 // Fill function! 269 fRa = fPointPos->GetRa(); 270 fDec = fPointPos->GetDec(); 318 271 319 272 return kTRUE; … … 326 279 Bool_t MHFalseSource::Fill(const MParContainer *par, const Stat_t w) 327 280 { 328 MHillas *hil = (MHillas*)par; 329 281 const MHillas *hil = dynamic_cast<const MHillas*>(par); 282 if (!hil) 283 { 284 *fLog << err << "MHFalseSource::Fill: No container specified!" << endl; 285 return kFALSE; 286 } 287 288 // Get max radius... 330 289 const Double_t maxr = 0.98*TMath::Abs(fHist.GetBinCenter(1)); 331 290 … … 337 296 // rho = fPointPos->RotationAngle(*fObservatory); 338 297 298 // Create necessary containers for calculation 339 299 MSrcPosCam src; 340 300 MHillasSrc hsrc; 341 301 hsrc.SetSrcPos(&src); 342 302 303 // Get number of bins and bin-centers 343 304 const Int_t nx = fHist.GetNbinsX(); 344 305 const Int_t ny = fHist.GetNbinsY(); … … 352 313 for (int iy=0; iy<ny; iy++) 353 314 { 315 // check distance... to get a circle plot 354 316 if (TMath::Hypot(cx[ix], cy[iy])>maxr) 355 317 continue; 356 318 319 // rotate center of bin 320 // precalculation of sin/cos doesn't accelerate 357 321 TVector2 v(cx[ix], cy[iy]); 358 322 if (rho!=0) 359 323 v=v.Rotate(rho); 360 324 361 if (!fUseMmScale) 362 v *= 1./fMm2Deg; 363 325 // convert degrees to millimeters 326 v *= 1./fMm2Deg; 364 327 src.SetXY(v); 365 328 329 // Source dependant hillas parameters 366 330 if (!hsrc.Calc(hil)) 367 331 { … … 370 334 } 371 335 336 // FIXME: This should be replaced by an external MFilter 337 // and/or MTaskList 338 // Source dependant distance cut 339 if (fDistMin>0 && hsrc.GetDist()*fMm2Deg<fDistMin) 340 continue; 341 342 if (fDistMax>0 && hil->GetLength()>fDistMax*hsrc.GetDist()) 343 continue; 344 345 // Fill histogram 372 346 const Double_t alpha = hsrc.GetAlpha(); 373 374 347 fHist.Fill(cx[ix], cy[iy], TMath::Abs(alpha), w); 375 348 } … … 446 419 // -------------------------------------------------------------------------- 447 420 // 448 // Update the projections 421 // Create projection for all data, taking sum of bin contents of 422 // range (0, 90) - corresponding to the number of entries in this slice. 423 // 424 void MHFalseSource::ProjectAll(TH2D *h3) 425 { 426 h3->SetTitle("Number of entries"); 427 428 // Get projection for range 429 TH2D *p = (TH2D*)fHist.Project3D("yx_all"); 430 431 // Move contents from projection to h3 432 h3->Reset(); 433 h3->Add(p); 434 delete p; 435 436 // Set Minimum as minimum value Greater Than 0 437 h3->SetMinimum(GetMinimumGT(*h3)); 438 } 439 440 // -------------------------------------------------------------------------- 441 // 442 // Update the projections and paint them 449 443 // 450 444 void MHFalseSource::Paint(Option_t *opt) 451 445 { 452 // sigma = (s-b)/sqrt(s+k*k*b) mit k=s/b 453 446 // Set pretty color palette 454 447 gStyle->SetPalette(1, 0); 455 448 … … 457 450 458 451 TH1D* h1; 452 TH2D* h0; 459 453 TH2D* h2; 460 454 TH2D* h3; 461 455 TH2D* h4; 462 456 463 padsave->cd(3); 457 // Update projection of all-events 458 padsave->GetPad(1)->cd(3); 459 if ((h0 = (TH2D*)gPad->FindObject("Alpha_yx_all"))) 460 ProjectAll(h0); 461 462 // Update projection of off-events 463 padsave->GetPad(2)->cd(1); 464 if ((h2 = (TH2D*)gPad->FindObject("Alpha_yx_off"))) 465 ProjectOff(h2); 466 467 // Update projection of on-events 468 padsave->GetPad(2)->cd(2); 464 469 if ((h3 = (TH2D*)gPad->FindObject("Alpha_yx_on"))) 465 470 ProjectOn(h3); 466 471 467 padsave->cd(4); 468 if ((h2 = (TH2D*)gPad->FindObject("Alpha_yx_off"))) 469 ProjectOff(h2); 470 471 padsave->cd(2); 472 // Update projection of significance 473 padsave->GetPad(2)->cd(3); 472 474 if (h2 && h3 && (h4 = (TH2D*)gPad->FindObject("Alpha_yx_sig"))) 473 475 { 474 476 const Int_t nx = h4->GetXaxis()->GetNbins(); 475 477 const Int_t ny = h4->GetYaxis()->GetNbins(); 476 const Int_t nr = nx*nx + ny*ny;478 //const Int_t nr = nx*nx + ny*ny; 477 479 478 480 Int_t maxx=nx/2; … … 493 495 h4->SetBinContent(n, sig); 494 496 495 if (sig>h4->GetBinContent(max) && sig>0 && ix*ix+iy*iy<nr*nr/9)497 if (sig>h4->GetBinContent(max) && sig>0/* && (ix-nx/2)*(ix-nx/2)+(iy-ny/2)*(iy-ny/2)<nr*nr/9*/) 496 498 { 497 499 max = n; … … 501 503 } 502 504 503 padsave->cd(1); 505 // Update projection of 'the best alpha-plot' 506 padsave->GetPad(1)->cd(1); 504 507 if ((h1 = (TH1D*)gPad->FindObject("Alpha")) && max>0) 505 508 { … … 520 523 // -------------------------------------------------------------------------- 521 524 // 525 // Get the MAstroCatalog corresponding to fRa, fDec. The limiting magnitude 526 // is set to 9, while the fov is equal to the current fov of the false 527 // source plot. 528 // 529 TObject *MHFalseSource::GetCatalog() 530 { 531 const Double_t maxr = 0.98*TMath::Abs(fHist.GetBinCenter(1)); 532 533 // Create catalog... 534 MAstroCatalog stars; 535 stars.SetLimMag(9); 536 stars.SetGuiActive(kFALSE); 537 stars.SetRadiusFOV(maxr); 538 stars.SetRaDec(fRa*TMath::DegToRad()*15, fDec*TMath::DegToRad()); 539 stars.ReadBSC("bsc5.dat"); 540 541 TObject *o = (MAstroCatalog*)stars.Clone(); 542 o->SetBit(kCanDelete); 543 544 return o; 545 } 546 547 // -------------------------------------------------------------------------- 548 // 522 549 // Draw the histogram 523 550 // … … 529 556 AppendPad(""); 530 557 531 pad->Divide(2, 2); 558 pad->Divide(1, 2, 0, 0.03); 559 560 TObject *catalog = GetCatalog(); 532 561 533 562 // draw the 2D histogram Sigmabar versus Theta 534 563 pad->cd(1); 535 564 gPad->SetBorderMode(0); 565 gPad->Divide(3, 1); 566 delete pad->GetPad(1)->GetPad(2); 567 568 pad->GetPad(1)->cd(3); 569 gPad->SetBorderMode(0); 570 TH1 *h0 = fHist.Project3D("yx_all"); 571 h0->SetDirectory(NULL); 572 h0->SetXTitle(fHist.GetXaxis()->GetTitle()); 573 h0->SetYTitle(fHist.GetYaxis()->GetTitle()); 574 h0->Draw("colz"); 575 h0->SetBit(kCanDelete); 576 catalog->Draw("mirror same"); 577 578 pad->GetPad(1)->cd(1); 579 gPad->SetBorderMode(0); 580 536 581 TH1 *h1 = fHist.ProjectionZ("Alpha"); 537 582 h1->SetDirectory(NULL); … … 542 587 h1->SetBit(kCanDelete); 543 588 544 pad->cd(4); 589 pad->cd(2); 590 gPad->SetBorderMode(0); 591 gPad->Divide(3, 1); 592 593 pad = gPad; 594 595 pad->cd(1); 545 596 gPad->SetBorderMode(0); 546 597 fHist.GetZaxis()->SetRangeUser(fBgMean-fAlphaCut/2, fBgMean+fAlphaCut/2); … … 551 602 h2->Draw("colz"); 552 603 h2->SetBit(kCanDelete); 553 554 pad->cd(3); 604 catalog->Draw("mirror same"); 605 606 pad->cd(2); 555 607 gPad->SetBorderMode(0); 556 608 fHist.GetZaxis()->SetRangeUser(0,fAlphaCut); … … 562 614 h3->Draw("colz"); 563 615 h3->SetBit(kCanDelete); 564 565 pad->cd(2); 616 catalog->Draw("mirror same"); 617 618 pad->cd(3); 566 619 gPad->SetBorderMode(0); 567 620 fHist.GetZaxis()->SetRange(0,0); … … 574 627 h4->Draw("colz"); 575 628 h4->SetBit(kCanDelete); 629 catalog->Draw("mirror same"); 576 630 } 577 631 … … 596 650 TVirtualPad *padsave = gPad; 597 651 padsave->Modified(); 598 padsave-> cd(1);652 padsave->GetPad(1)->cd(1); 599 653 gPad->Modified(); 600 padsave-> cd(2);654 padsave->GetPad(1)->cd(3); 601 655 gPad->Modified(); 602 padsave-> cd(3);656 padsave->GetPad(2)->cd(1); 603 657 gPad->Modified(); 604 padsave->cd(4); 658 padsave->GetPad(2)->cd(2); 659 gPad->Modified(); 660 padsave->GetPad(2)->cd(3); 605 661 gPad->Modified(); 606 662 gPad->cd(); … … 639 695 void MHFalseSource::FitSignificance(Float_t sigint, Float_t sigmax, Float_t bgmin, Float_t bgmax, Byte_t polynom) 640 696 { 697 TObject *catalog = GetCatalog(); 698 641 699 TH1D h0a("A", "", 50, 0, 4000); 642 700 TH1D h4a("chisq1", "", 50, 0, 35); … … 686 744 // Implementing the function yourself is only about 5% faster 687 745 TF1 func("", Form("gaus(0) + pol%d(3)", polynom), 0, 90); 746 //TF1 func("", Form("[0]*(TMath::Gaus(x, [1], [2])+TMath::Gaus(x, -[1], [2]))+pol%d(3)", polynom), 0, 90); 688 747 TArrayD maxpar(func.GetNpar()); 689 748 690 /* 691 func.SetParName(0, "A"); 692 func.SetParName(1, "mu"); 693 func.SetParName(2, "sigma"); 694 func.SetParName(3, "a"); 695 func.SetParName(4, "b"); 696 func.SetParName(5, "c"); 749 /* func.SetParName(0, "A"); 750 * func.SetParName(1, "mu"); 751 * func.SetParName(2, "sigma"); 697 752 */ 698 753 … … 704 759 const Int_t nx = hist->GetXaxis()->GetNbins(); 705 760 const Int_t ny = hist->GetYaxis()->GetNbins(); 706 const Int_t nr = nx*nx+ny*ny;761 //const Int_t nr = nx*nx+ny*ny; 707 762 708 763 Double_t maxalpha0=0; … … 748 803 749 804 h->Fit(&func, "N0Q", "", bgmin, bgmax); 750 //*fLog << dbg << ix << "/" << iy << ": " << func.GetParameter(3) << " " << func.GetParameter(4) << endl;751 805 752 806 h4a.Fill(func.GetChisquare()); … … 774 828 775 829 h->Fit(&func, "N0Q", "", 0, sigmax); 776 //*fLog << dbg << " " << func.GetParameter(0) << " " << func.GetParameter(1) << " " << func.GetParameter(2) << endl;777 830 778 831 TArrayD p(func.GetNpar(), func.GetParameters()); … … 820 873 h6.Fill(sig); 821 874 822 if (sig>maxs && ix*ix+iy*iy<nr*nr/9)875 if (sig>maxs/* && (ix-nx/2)*(ix-nx/2)+(iy-ny/2)*(iy-ny/2)<nr*nr/9*/) 823 876 { 824 877 maxs = sig; … … 838 891 839 892 clk.Stop(); 840 clk.Print( );893 clk.Print("m"); 841 894 842 895 TCanvas *c=new TCanvas; … … 849 902 hists->Draw("colz"); 850 903 hists->SetBit(kCanDelete); 904 catalog->Draw("mirror same"); 851 905 c->cd(2); 852 906 gPad->SetBorderMode(0); 853 907 hist->Draw("colz"); 854 908 hist->SetBit(kCanDelete); 909 catalog->Draw("mirror same"); 855 910 c->cd(3); 856 911 gPad->SetBorderMode(0); 857 912 histb->Draw("colz"); 858 913 histb->SetBit(kCanDelete); 914 catalog->Draw("mirror same"); 859 915 c->cd(4); 860 916 gPad->Divide(1,3, 0, 0); … … 942 998 const Double_t b = f2.Integral(0, (float)i)/w; 943 999 944 const Double_t sig = Significance (s, b);1000 const Double_t sig = SignificanceLiMa(s, b); 945 1001 946 1002 g->SetPoint(g->GetN(), i, sig); -
trunk/MagicSoft/Mars/mhist/MHFalseSource.h
r3597 r3666 12 12 class TH2D; 13 13 14 class MHillasSrc;15 class MEnergyEst;16 14 class MParList; 17 15 class MTime; … … 22 20 { 23 21 private: 24 MTime *fTime; //! container to take the event time from25 MPointingPos *fPointPos; //! container to take pointing position from26 MObservatory *fObservatory; //! conteiner to take observatory location from22 MTime *fTime; //! container to take the event time from 23 MPointingPos *fPointPos; //! container to take pointing position from 24 MObservatory *fObservatory; //! conteiner to take observatory location from 27 25 28 Float_t fMm2Deg; // conversion factor for display in degrees 29 Bool_t fUseMmScale; // which scale to use? 26 Float_t fMm2Deg; // conversion factor for display in degrees 30 27 31 Float_t fAlphaCut; // Alpha cut32 Float_t fBgMean; // Background mean28 Float_t fAlphaCut; // Alpha cut 29 Float_t fBgMean; // Background mean 33 30 34 TH3D fHist; // Alpha vs. x and y 31 Float_t fDistMin; // Min dist 32 Float_t fDistMax; // Maximum distance in percent of dist 33 34 TH3D fHist; // Alpha vs. x and y 35 36 Double_t fRa; 37 Double_t fDec; 35 38 36 39 Int_t DistancetoPrimitive(Int_t px, Int_t py); … … 39 42 void ProjectOff(TH2D *h); 40 43 void ProjectOn(TH2D *h); 44 void ProjectAll(TH2D *h); 45 46 TObject *GetCatalog(); 41 47 42 48 public: … … 46 52 Bool_t Fill(const MParContainer *par, const Stat_t w=1); 47 53 48 void SetMmScale(Bool_t mmscale=kTRUE);49 void SetMm2Deg(Float_t mmdeg);50 51 54 TH1 *GetHistByName(const TString name) { return &fHist; } 52 55 53 56 void FitSignificance(Float_t sigint=15, Float_t sigmax=70, Float_t bgmin=40, Float_t bgmax=70, Byte_t polynom=1); //*MENU* 54 57 void FitSignificanceStd() { FitSignificance(); } //*MENU* 58 59 void SetDistMin(Float_t dist) { fDistMin = dist; } // Absolute minimum distance 60 void SetDistMax(Float_t ratio) { fDistMax = ratio; } // Maximum ratio between length/dist 55 61 56 62 void SetAlphaCut(Float_t alpha); //*MENU* -
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r3594 r3666 34 34 // For a given a shower, a series of points along its main axis are filled 35 35 // into the 2-dim histogram (x, y) of the camera plane. 36 // 36 // 37 37 // Before filling a point (x, y) into the histogram it is 38 38 // - shifted by (xSrc, ySrc) (the expected source position) 39 39 // - and rotated in order to compensate the rotation of the 40 40 // sky image in the camera 41 // 42 // 41 // 42 // To be done: 43 // - simplification of the algorithm, by doing all translation before 44 // calculation of the line 45 // - the center of rotation need not to be the camera center 46 // 43 47 ///////////////////////////////////////////////////////////////////////////// 44 48 #include "MHStarMap.h" -
trunk/MagicSoft/Mars/mimage/MHillasExt.cc
r2624 r3666 47 47 // fConc1 removed 48 48 // 49 // Version 3: 50 // ---------- 51 // fMaxDist added. Distance between center and most distant used pixel 52 // 49 53 // 50 54 // WARNING: Before you can use fAsym, fM3Long and fM3Trans you must … … 96 100 fM3Long = 0; 97 101 fM3Trans = 0; 102 103 fMaxDist = -1; 98 104 } 99 105 … … 109 115 *fLog << " - 3.Moment Long [mm] = " << fM3Long << endl; 110 116 *fLog << " - 3.Moment Trans [mm] = " << fM3Trans << endl; 117 *fLog << " - Max.Dist [mm] = " << fMaxDist << endl; 111 118 } 112 119 … … 123 130 *fLog << " - 3.Moment Long [deg] = " << fM3Long *geom.GetConvMm2Deg() << endl; 124 131 *fLog << " - 3.Moment Trans [deg] = " << fM3Trans*geom.GetConvMm2Deg() << endl; 132 *fLog << " - Max.Dist [deg] = " << fMaxDist*geom.GetConvMm2Deg() << endl; 125 133 } 126 134 … … 146 154 const UInt_t npixevt = evt.GetNumPixels(); 147 155 148 Int_t maxpixid = 0; 149 Float_t maxpix = 0; 156 Int_t maxpixid = 0; 157 Float_t maxpix = 0; 158 Float_t maxdist = 0; 150 159 151 160 for (UInt_t i=0; i<npixevt; i++) … … 160 169 const Double_t dx = gpix.GetX() - hil.GetMeanX(); // [mm] 161 170 const Double_t dy = gpix.GetY() - hil.GetMeanY(); // [mm] 171 172 const Double_t dist = dx*dx+dy*dy; 173 if (dist>maxdist) 174 maxdist=dist; // [mm^2] 162 175 163 176 Double_t nphot = pix.GetNumPhotons(); // [1] … … 197 210 fM3Trans = m3y<0 ? -pow(-m3y, 1./3) : pow(m3y, 1./3); // [mm] 198 211 212 fMaxDist = TMath::Sqrt(maxdist); // [mm] 213 199 214 SetReadyToSave(); 200 215 -
trunk/MagicSoft/Mars/mimage/MHillasExt.h
r2624 r3666 20 20 Float_t fM3Trans; // [mm] 3rd moment (e-weighted) along minor axis 21 21 22 Float_t fMaxDist; // Distance between center and most distant used pixel 23 22 24 public: 23 25 MHillasExt(const char *name=NULL, const char *title=NULL); … … 29 31 Float_t GetM3Trans() const { return fM3Trans; } 30 32 33 Float_t GetMaxDist() const { return fMaxDist; } 34 31 35 Int_t Calc(const MGeomCam &geom, const MCerPhotEvt &pix, const MHillas &hil); 32 36 … … 36 40 void Set(const TArrayF &arr); 37 41 38 ClassDef(MHillasExt, 2) // Storage Container for extended Hillas Parameter42 ClassDef(MHillasExt, 3) // Storage Container for extended Hillas Parameter 39 43 }; 40 44 #endif -
trunk/MagicSoft/Mars/mimage/MHillasSrcCalc.cc
r2470 r3666 114 114 Int_t MHillasSrcCalc::Process() 115 115 { 116 117 116 if (!fHillasSrc->Calc(fHillas)) 118 117 { -
trunk/MagicSoft/Mars/mimage/MNewImagePar.cc
r3574 r3666 44 44 // - added fInnerLeakage2 45 45 // - added fInnerSize 46 // - added fUsedArea 47 // - added fCoreArea 48 // 46 49 // 47 50 ///////////////////////////////////////////////////////////////////////////// … … 92 95 fNumCorePixels = -1; 93 96 97 fUsedArea = -1; 98 fCoreArea = -1; 99 94 100 fNumSaturatedPixels = -1; 95 101 fNumHGSaturatedPixels = -1; … … 105 111 fNumUsedPixels = 0; 106 112 fNumCorePixels = 0; 113 114 fUsedArea = 0; 115 fCoreArea = 0; 107 116 108 117 fNumSaturatedPixels = 0; … … 136 145 continue; 137 146 147 // Get geometry of pixel 148 const Int_t pixid = pix.GetPixId(); 149 const MGeomPix &gpix = geom[pixid]; 150 138 151 // count used and core pixels 139 152 if (pix.IsPixelCore()) 153 { 140 154 fNumCorePixels++; 155 fCoreArea += gpix.GetA(); 156 } 141 157 142 158 // count used pixels 143 159 fNumUsedPixels++; 144 145 const Int_t pixid = pix.GetPixId(); 146 147 const MGeomPix &gpix = geom[pixid]; 160 fUsedArea += gpix.GetA(); 148 161 149 162 Double_t nphot = pix.GetNumPhotons(); … … 165 178 // count inner pixels: To dependent on MAGIC Camera --> FIXME 166 179 167 168 169 170 171 172 173 174 180 if (pixid<397){ 181 fInnerSize += nphot; 182 if(pixid>270){ 183 edgepixin2 += nphot; 184 if(pixid>330) 185 edgepixin1 += nphot; 186 } 187 } 175 188 176 189 // Compute Concetration 1 -2 177 190 178 191 if (nphot>maxpix1) 179 192 { 180 193 maxpix2 = maxpix1; 181 194 maxpix1 = nphot; // [1] 182 195 continue; // [1] 183 184 196 } 197 185 198 if (nphot>maxpix2) 186 199 maxpix2 = nphot; // [1] 187 200 } 188 201 -
trunk/MagicSoft/Mars/mimage/MNewImagePar.h
r3574 r3666 13 13 { 14 14 private: 15 Float_t fLeakage1; // (photons in most outer ring of pixels) over fSize16 Float_t fLeakage2; // (photons in the 2 outer rings of pixels) over fSize17 Float_t fInnerLeakage1; // (photons in most outer rings of inner pixels) over fInnerSize18 Float_t fInnerLeakage2; // (photons in the 2 outer rings of inner pixels) over fInnerSize19 Float_t fInnerSize; //15 Float_t fLeakage1; // (photons in most outer ring of pixels) over fSize 16 Float_t fLeakage2; // (photons in the 2 outer rings of pixels) over fSize 17 Float_t fInnerLeakage1; // (photons in most outer rings of inner pixels) over fInnerSize 18 Float_t fInnerLeakage2; // (photons in the 2 outer rings of inner pixels) over fInnerSize 19 Float_t fInnerSize; // 20 20 21 Float_t fConc; // [ratio] concentration ratio: sum of the two highest pixels / fSize22 Float_t fConc1; // [ratio] concentration ratio: sum of the highest pixel / fSize21 Float_t fConc; // [ratio] concentration ratio: sum of the two highest pixels / fSize 22 Float_t fConc1; // [ratio] concentration ratio: sum of the highest pixel / fSize 23 23 24 Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning 25 Short_t fNumCorePixels; // number of core pixels 24 Float_t fUsedArea; // Area of pixels which survived the image cleaning 25 Float_t fCoreArea; // Area of core pixels 26 Short_t fNumUsedPixels; // Number of pixels which survived the image cleaning 27 Short_t fNumCorePixels; // number of core pixels 26 28 Short_t fNumHGSaturatedPixels; // number of pixels with saturating hi-gains 27 29 Short_t fNumSaturatedPixels; // number of pixels with saturating lo-gains … … 41 43 Short_t GetNumCorePixels() const { return fNumCorePixels; } 42 44 45 Float_t GetNumUsedArea() const { return fUsedArea; } 46 Float_t GetNumCoreArea() const { return fCoreArea; } 47 43 48 Short_t GetNumSaturatedPixels() const { return fNumSaturatedPixels; } 44 49 Short_t GetNumHGSaturatedPixels() const { return fNumHGSaturatedPixels; } -
trunk/MagicSoft/Mars/mpointing/MPointingPos.cc
r3568 r3666 73 73 Double_t MPointingPos::RotationAngle(const MObservatory &o, const MTime &t) const 74 74 { 75 return MAstroSky2Local(t, o).RotationAngle( fRa*TMath::DegToRad()*15, fDec*TMath::DegToRad());75 return MAstroSky2Local(t, o).RotationAngle(GetRaRad(), GetDecRad()); 76 76 } -
trunk/MagicSoft/Mars/mpointing/MPointingPos.h
r3568 r3666 15 15 Double_t fAz; // [deg] Azimuth 16 16 17 Double_t fRa; // [ rad]Right ascension18 Double_t fHa; // [ rad]Hour angle19 Double_t fDec; // [ rad] Declination17 Double_t fRa; // [h] Right ascension 18 Double_t fHa; // [h] Hour angle 19 Double_t fDec; // [deg] Declination 20 20 21 21 public: 22 MPointingPos( )22 MPointingPos(const char *name=0, const char *title=0) 23 23 { 24 fName = "MPointingPos";25 fTitle = "Container storing the (corrected) telescope pointing position";24 fName = name ? name : "MPointingPos"; 25 fTitle = title ? title : "Container storing the (corrected) telescope pointing position"; 26 26 } 27 27 … … 35 35 Double_t GetDec() const { return fDec; } 36 36 37 Double_t GetRaRad() const { return fRa*TMath::DegToRad()*15; } 38 Double_t GetDecRad() const { return fDec*TMath::DegToRad(); } 39 37 40 Double_t RotationAngle(const MObservatory &o) const; 38 41 Double_t RotationAngle(const MObservatory &o, const MTime &t) const; 42 Double_t RotationAngle(const MObservatory &o, const MTime *t) const 43 { 44 return t ? RotationAngle(o, *t) : RotationAngle(o); 45 } 39 46 40 47 ClassDef(MPointingPos, 1) //Container storing the (corrected) telescope pointing position -
trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc
r3592 r3666 46 46 // To be done: 47 47 // - wobble mode missing 48 // - a switch between using sky-coordinates and time or local-coordinates 49 // from MPointingPos for determin the rotation angle 50 // - the center of rotation need not to be the camera center 48 51 // 49 52 ////////////////////////////////////////////////////////////////////////////// … … 101 104 { 102 105 *fLog << err << "MObservatory not found... aborting." << endl; 106 return kFALSE; 107 } 108 109 fTime = (MTime*)pList->FindObject("MTime"); 110 if (!fTime) 111 { 112 *fLog << err << "MTime not found... aborting." << endl; 103 113 return kFALSE; 104 114 } … … 166 176 return kTRUE; 167 177 178 // rotate the source position by the current rotation angle 179 const Double_t rho = fPointPos->RotationAngle(*fObservatory, *fTime); 180 168 181 // Define source position in the camera plain 169 182 TVector2 v(fX, fY); 170 171 // rotate the source position by the current rotation angle 172 const Double_t rho = fPointPos->RotationAngle(*fObservatory); 173 v=v.Rotate(-rho); 183 v=v.Rotate(rho); 174 184 175 185 // Convert coordinates into camera plain (mm) -
trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.h
r3568 r3666 10 10 class MSrcPosCam; 11 11 class MGeomCam; 12 class MTime; 12 13 13 14 class MSrcPosCalc : public MTask … … 18 19 MSrcPosCam *fSrcPos; 19 20 MGeomCam *fGeom; 21 MTime *fTime; 20 22 21 23 Double_t fR; // Distance of source to a fitted star … … 32 34 MSrcPosCalc(const char *name=NULL, const char *title=NULL); 33 35 36 // Use is deprecated! 34 37 void SetOffset(Double_t r, Double_t drho) 35 38 { -
trunk/MagicSoft/include-Classes/MMcFormat/MMcConfigRunHeader.h
r3621 r3666 94 94 MGeomMirror &GetMirror(int i) const { return *(MGeomMirror*)(fMirrors->UncheckedAt(i)); } 95 95 96 TClonesArray *GetMirrors() { return fMirrors; } 97 96 98 MGeomPMT &GetPMT(int i) { return *(MGeomPMT*)(fPMTs->UncheckedAt(i)); } 97 99 MGeomPMT &GetPMT(int i) const { return *(MGeomPMT*)(fPMTs->UncheckedAt(i)); }
Note:
See TracChangeset
for help on using the changeset viewer.