Changeset 4966
- Timestamp:
- 09/13/04 08:57:58 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4963 r4966 20 20 -*-*- END OF LINE -*-*- 21 21 22 2004/09/13: Thomas Bretz 23 24 * merpp.cc: 25 - added MTrigger* containers to output 26 27 * mastro/MAstro.[h,cc]: 28 - added member function GetDistOnPlain 29 30 * mbase/MDirIter.[h,cc]: 31 - renamed Check to CheckEntry 32 33 * mbase/MMath.[h,c]: 34 - added functions for parabolic interpolation 35 36 * mbase/MStatusArray.[h,cc]: 37 - added functions to access contents 38 39 * mhbase/MBinning.[h,cc]: 40 - added RemoveFirstEdge 41 - added RemoveLastEdge 42 - removed some obsolete const-casts 43 44 * mhbase/MH.[h,cc]: 45 - added RemoveFirstBin 46 47 * mhist/MHEffectiveOnTime.[h,cc]: 48 - fixed number of bins 49 - remove first edge when finalizing 50 51 * mjobs/MJStar.cc: 52 - removed a duplicate line 53 54 * mpointing/MPointing.[h,cc]: 55 - added support for TVector3 56 - added ClassDef and ClassImp for AltAz 57 - added ClassDef and ClassImp for ZdAz 58 59 * mpointing/MSrcPosFromModel.[h,cc]: 60 - changed to directly calculate the source position 61 from a pointing model 62 63 * mpointing/PointingLinkDef.h: 64 - added AltAz 65 - added ZdAz 66 67 * mreport/MReportTrigger.[h,cc]: 68 - removed '!' from data members 69 - increased ClassDef to 2 70 71 * mstarcam/MStarCamTrans.cc: 72 - added a single line of comment 73 74 * mtrigger/MTrigger*.[h,cc]: 75 - updated class description and title 76 77 78 22 79 2004/09/11: Markus Gaug 23 80 … … 58 115 * mbadpixels/BadPixelsLinkDef.h 59 116 - new class for the intensity calibration 117 60 118 61 119 … … 81 139 * mhcalib/MHCalibrationTestTimePix.[h,cc] 82 140 - removed 141 83 142 84 143 -
trunk/MagicSoft/Mars/mastro/MAstro.cc
r4566 r4966 36 36 37 37 #include "MTime.h" // MTime::GetGmst 38 39 #include "MAstroCatalog.h" // FIXME: replace by MVector3! 38 40 39 41 using namespace std; … … 540 542 return (Int_t)TMath::Floor(period)-284; 541 543 } 544 545 // -------------------------------------------------------------------------- 546 // 547 // Returns the distance in x,y between two polar-vectors (eg. Alt/Az, Ra/Dec) 548 // projected on aplain in a distance dist. For Magic this this the distance 549 // of the camera plain (1700mm) dist also determins the unit in which 550 // the TVector2 is returned. 551 // 552 // v0 is the reference vector (eg. the vector to the center of the camera) 553 // v1 is the vector to which we determin the distance on the plain 554 // 555 // (see also MStarCamTrans::Loc0LocToCam()) 556 // 557 TVector2 MAstro::GetDistOnPlain(const TVector3 &v0, TVector3 v1, Double_t dist) 558 { 559 v1.RotateZ(-v0.Phi()); 560 v1.RotateY(-v0.Theta()); 561 v1.RotateZ(-TMath::Pi()/2); // exchange x and y 562 v1 *= dist/v1.Z(); 563 564 return v1.XYvector(); //TVector2(v1.Y(), -v1.X());//v1.XYvector(); 565 } -
trunk/MagicSoft/Mars/mastro/MAstro.h
r4566 r4966 5 5 #include <TROOT.h> 6 6 #endif 7 #ifndef ROOT_TVector2 8 #include <TVector2.h> 9 #endif 10 11 class TVector3; 7 12 8 13 class MAstro … … 60 65 static Int_t GetMagicPeriod(Double_t mjd); 61 66 67 static TVector2 GetDistOnPlain(const TVector3 &v0, TVector3 v1, Double_t dist=1); 68 62 69 ClassDef(MAstro, 0) 63 70 }; -
trunk/MagicSoft/Mars/mbase/MDirIter.cc
r4817 r4966 244 244 // - have read permission 245 245 // 246 Bool_t MDirIter::Check (const TString n) const246 Bool_t MDirIter::CheckEntry(const TString n) const 247 247 { 248 248 // Check . and .. … … 298 298 const char *n = gSystem->GetDirEntry(fDirPtr); 299 299 if (n) 300 return nocheck || Check (n) ? ConcatFileName(fCurrentPath->GetName(), n) : Next();300 return nocheck || CheckEntry(n) ? ConcatFileName(fCurrentPath->GetName(), n) : Next(); 301 301 302 302 // Otherwise close directory and try to get next entry -
trunk/MagicSoft/Mars/mbase/MDirIter.h
r4722 r4966 18 18 void *Open(); 19 19 void Close(); 20 Bool_t Check (const TString n) const;20 Bool_t CheckEntry(const TString n) const; 21 21 Int_t IsDir(const char *dir) const; 22 22 Bool_t MatchFilter(const TString &name, const TString &filter) const; -
trunk/MagicSoft/Mars/mbase/MMath.cc
r4736 r4966 117 117 } 118 118 119 // ------------------------------------------------------------------------- 120 // 121 // Quadratic interpolation 122 // 123 // calculate the parameters of a parabula such that 124 // y(i) = a + b*x(i) + c*x(i)^2 125 // 126 // If the determinant==0 an empty TVector3 is returned. 127 // 128 TVector3 MMath::GetParab(const TVector3 &x, const TVector3 &y) 129 { 130 const TVector3 sq(x(0)*x(0), x(1)*x(1), x(2)*x(2)); 131 132 const TVector3 ai2 = sq.Cross(sq); 133 134 const Double_t det = x.Dot(ai2); 135 if (det==0) 136 return TVector3(); 137 138 const TVector3 ai1 = x.Cross(sq); 139 const TVector3 ai3 = x.Cross(x); 140 141 TVector3 res(y.Dot(ai1), y.Dot(ai2), y.Dot(ai3)); 142 res *= 1./det; 143 144 return res; 145 } 146 147 Double_t MMath::InterpolParabLin(const TVector3 &vx, const TVector3 &vy, Double_t x) 148 { 149 const TVector3 c = GetParab(vx, vy); 150 return c(0) + c(1)*x + c(2)*x*x; 151 } 152 153 Double_t MMath::InterpolParabLog(const TVector3 &vx, const TVector3 &vy, Double_t x) 154 { 155 const Double_t l0 = TMath::Log10(vx(0)); 156 const Double_t l1 = TMath::Log10(vx(1)); 157 const Double_t l2 = TMath::Log10(vx(2)); 158 159 const TVector3 vx0(l0, l1, l2); 160 return pow(10, InterpolParabLin(vx0, vy, TMath::Log10(x))); 161 } 162 163 Double_t MMath::InterpolParabCos(const TVector3 &vx, const TVector3 &vy, Double_t x) 164 { 165 const Double_t l0 = TMath::Cos(vx(0)); 166 const Double_t l1 = TMath::Cos(vx(1)); 167 const Double_t l2 = TMath::Cos(vx(2)); 168 169 const TVector3 vx0(l0, l1, l2); 170 return TMath::ACos(InterpolParabLin(vx0, vy, TMath::Cos(x))); 171 } -
trunk/MagicSoft/Mars/mbase/MMath.h
r4716 r4966 4 4 #ifndef ROOT_TMath 5 5 #include <TMath.h> 6 #endif 7 #ifndef ROOT_TVector3 8 #include <TVector3.h> 6 9 #endif 7 10 … … 16 19 static Double_t SignificanceLiMaSigned(Double_t s, Double_t b, Double_t alpha=1); 17 20 21 static TVector3 GetParab(const TVector3 &x, const TVector3 &y); 22 static Double_t InterpolParabLin(const TVector3 &vx, const TVector3 &vy, Double_t x); 23 static Double_t InterpolParabLog(const TVector3 &vx, const TVector3 &vy, Double_t x); 24 static Double_t InterpolParabCos(const TVector3 &vx, const TVector3 &vy, Double_t x); 25 18 26 ClassDef(MMath, 0) 19 27 }; -
trunk/MagicSoft/Mars/mbase/MStatusArray.cc
r3504 r4966 32 32 #include "MStatusArray.h" 33 33 34 #include <TClass.h> 35 #include <TCanvas.h> 36 37 #include "MLog.h" 38 #include "MLogManip.h" 39 34 40 #include "MStatusDisplay.h" 35 41 … … 56 62 return 0; 57 63 } 64 65 TCanvas *MStatusArray::FindCanvas(const char *name) const 66 { 67 TObject *o = TObjArray::FindObject(name); 68 return o->InheritsFrom(TCanvas::Class()) ? (TCanvas*)o : 0; 69 } 70 71 TObject *MStatusArray::FindObjectInPad(TVirtualPad *pad, const char *object, TClass *cls) const 72 { 73 TObject *o = pad->FindObject(object); 74 if (o && o->InheritsFrom(cls)) 75 return o; 76 77 TIter Next(pad->GetListOfPrimitives()); 78 while ((o=Next())) 79 { 80 if (o==pad || !o->InheritsFrom(TVirtualPad::Class())) 81 continue; 82 83 if ((o = FindObjectInPad((TVirtualPad*)o, object, cls))) 84 if (o->InheritsFrom(cls)) 85 return o; 86 } 87 return 0; 88 } 89 90 // FIXME: Move to a general class MMARS (TROOT) and unify with MParContainer 91 TClass *MStatusArray::GetClass(const char *name) const 92 { 93 TClass *cls = gROOT->GetClass(name); 94 Int_t rc = 0; 95 if (!cls) 96 rc =1; 97 else 98 { 99 if (!cls->Property()) 100 rc = 5; 101 if (!cls->Size()) 102 rc = 4; 103 if (!cls->IsLoaded()) 104 rc = 3; 105 if (!cls->HasDefaultConstructor()) 106 rc = 2; 107 } 108 109 if (rc==0) 110 return cls; 111 112 gLog << err << dbginf << "Class '" << name << "' not in dictionary: "; 113 switch (rc) 114 { 115 case 1: 116 gLog << "gROOT->GetClass() returned NULL." << endl; 117 return NULL; 118 case 2: 119 gLog << "no default constructor." << endl; 120 return NULL; 121 case 3: 122 gLog << "not loaded." << endl; 123 return NULL; 124 case 4: 125 gLog << "zero size." << endl; 126 return NULL; 127 case 5: 128 gLog << "no property." << endl; 129 return NULL; 130 } 131 132 gLog << "THIS SHOULD NEVER HAPPEN!" << endl; 133 134 return 0; 135 } 136 137 TObject *MStatusArray::FindObjectInCanvas(const char *object, const char *base, const char *canvas) const 138 { 139 TClass *cls = GetClass(base); 140 if (!cls) 141 return 0; 142 143 TCanvas *c = canvas ? FindCanvas(canvas) : 0; 144 if (canvas) 145 { 146 if (!c) 147 return 0; 148 149 TObject *o = FindObjectInPad(c, object, cls); 150 if (!o) 151 return 0; 152 153 return o->InheritsFrom(cls) ? o : 0; 154 } 155 156 TObject *o=0; 157 TIter Next(this); 158 while ((o=Next())) 159 { 160 if (!o->InheritsFrom(TVirtualPad::Class())) 161 continue; 162 163 if ((o=FindObjectInPad((TVirtualPad*)c, object, cls))) 164 return o; 165 } 166 167 return NULL; 168 } 169 170 TObject *MStatusArray::FindObjectInCanvas(const char *object, const char *canvas) const 171 { 172 return FindObjectInCanvas(object, object, canvas); 173 } 174 175 TObject *MStatusArray::FindObject(const char *object, const char *base) const 176 { 177 return FindObjectInCanvas(object, base, 0); 178 } 179 180 TObject *MStatusArray::FindObject(const char *object) const 181 { 182 return FindObjectInCanvas(object, object, 0); 183 } -
trunk/MagicSoft/Mars/mbase/MStatusArray.h
r3512 r4966 6 6 #endif 7 7 8 class TClass; 9 class TCanvas; 10 class TVirtualPad; 11 8 12 class MStatusArray : public TObjArray 9 13 { 14 private: 15 TObject *FindObjectInPad(TVirtualPad *pad, const char *object, TClass *base) const; 16 TClass *GetClass(const char *name) const; 17 10 18 public: 11 19 TObject *DisplayIn(Option_t *o=0) const; // *MENU* 12 20 TObject *Display() const { return DisplayIn(); } // *MENU* 21 22 TCanvas *FindCanvas(const char *name) const; 23 24 TObject *FindObjectInCanvas(const char *object, const char *base, const char *canvas) const; 25 TObject *FindObjectInCanvas(const char *object, const char *canvas) const; 26 27 TObject *FindObject(const char *object, const char *base) const; 28 TObject *FindObject(const char *object) const; 29 TObject *FindObject(const TObject *o) const { return 0; } 13 30 14 31 ClassDef(MStatusArray, 0) // Helper class for status display -
trunk/MagicSoft/Mars/merpp.cc
r4875 r4966 330 330 w->AddContainer("MReportTrigger", "Trigger"); 331 331 w->AddContainer("MTimeTrigger", "Trigger"); 332 w->AddContainer("MTriggerBit", "Trigger"); 333 w->AddContainer("MTriggerIPR", "Trigger"); 334 w->AddContainer("MTriggerCell", "Trigger"); 335 w->AddContainer("MTriggerPrescFact", "Trigger"); 336 w->AddContainer("MTriggerLiveTime", "Trigger"); 332 337 w->AddContainer("MReportDrive", "Drive"); 333 338 w->AddContainer("MTimeDrive", "Drive"); -
trunk/MagicSoft/Mars/mhbase/MBinning.cc
r4920 r4966 18 18 ! Author(s): Thomas Bretz, 01/2002 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 24 24 25 25 ////////////////////////////////////////////////////////////////////////////// 26 // // 27 // MBinning // 28 // // 26 // 27 // MBinning 28 // 29 // This is a MParCOntainer storing a binning for a histogram. Doing this 30 // you are able to distribute a single binning to several histograms 31 // in your parameter list. 32 // 33 // In some classes the title of the container is used to set the 34 // axis-title of the corresponding axis in your histogram. 35 // 36 // For all the features supported see the function descriptions in 37 // MBinning and MH 38 // 29 39 ////////////////////////////////////////////////////////////////////////////// 30 40 #include "MBinning.h" … … 64 74 } 65 75 76 // -------------------------------------------------------------------------- 77 // 78 // Instantiate MBinning with nbins number of bins between lo (lower edge) 79 // and hi (upper edge), name name and title title. 80 // 66 81 MBinning::MBinning(Int_t nbins, Axis_t lo, Axis_t hi, const char *name, const char *opt, const char *title) 67 82 { … … 70 85 71 86 SetEdges(nbins, lo, hi, opt); 72 73 } 74 87 } 88 89 // -------------------------------------------------------------------------- 90 // 91 // Setup the edges stored in MBinning from the TAxis axe 92 // 75 93 void MBinning::SetEdges(const TAxis &axe) 76 94 { … … 85 103 } 86 104 105 // -------------------------------------------------------------------------- 106 // 107 // Add a new upper edge to the edges stored in MBinning. The new upper 108 // edge must be greater than the current greatest. Using this you can 109 // enhance a histogram bin-by-bin, eg: 110 // TH1F h("", "", 2, 0, 1); 111 // MBinning b; 112 // b.SetEdges(h); 113 // b.AddEdge(2); 114 // b.Apply(h); 115 // b.AddEdge(3); 116 // b.Apply(h); 117 // [...] 118 // 87 119 void MBinning::AddEdge(Axis_t up) 88 120 { … … 101 133 } 102 134 135 void MBinning::RemoveFirstEdge() 136 { 137 const Int_t n = fEdges.GetSize(); 138 for (int i=0; i<n-1; i++) 139 fEdges[i] = fEdges[i+1]; 140 fEdges.Set(n-1); 141 } 142 143 void MBinning::RemoveLastEdge() 144 { 145 fEdges.Set(fEdges.GetSize()-1); 146 } 147 148 // -------------------------------------------------------------------------- 149 // 150 // Set the edges in MBinning from a histogram-axis. Which axis is 151 // specified by axis ('x', 'y', 'z') 152 // 103 153 void MBinning::SetEdges(const TH1 &h, const Char_t axis) 104 154 { 105 TH1 &hist = (TH1&)h; // get rid of const qualifier106 155 switch (tolower(axis)) 107 156 { 108 157 case 'x': 109 SetEdges(*h ist.GetXaxis());158 SetEdges(*h.GetXaxis()); 110 159 return; 111 160 case 'y': 112 SetEdges(*h ist.GetYaxis());161 SetEdges(*h.GetYaxis()); 113 162 return; 114 163 case 'z': 115 SetEdges(*h ist.GetZaxis());164 SetEdges(*h.GetZaxis()); 116 165 return; 117 166 default: 118 167 *fLog << warn << "MBinning::SetEdges: Axis '" << axis << "' unknown... using x." << endl; 119 SetEdges(*h ist.GetXaxis());168 SetEdges(*h.GetXaxis()); 120 169 } 121 170 } -
trunk/MagicSoft/Mars/mhbase/MBinning.h
r4920 r4966 46 46 47 47 void SetEdges(const TAxis &axe); 48 void SetEdges(const MBinning &bins) { SetEdges(fEdges); } 48 49 void SetEdges(const TH1 &h, const Char_t axis='x'); 49 50 void SetEdges(const Int_t nbins, const Axis_t lo, Axis_t up); … … 59 60 for (int i=1; i<fEdges.GetSize(); i++) 60 61 { 61 if ( ((TArrayD)fEdges)[i] >= val)62 if (fEdges[i] >= val) 62 63 return i-1; 63 64 } … … 70 71 } 71 72 72 // FIXME: ROOT workaround: "operator[] const" missing 73 Double_t GetEdgeLo() const { return ((TArrayD)fEdges)[0]; } 74 Double_t GetEdgeHi() const { return ((TArrayD)fEdges)[fEdges.GetSize()-1]; } 73 Double_t GetEdgeLo() const { return fEdges[0]; } 74 Double_t GetEdgeHi() const { return fEdges[fEdges.GetSize()-1]; } 75 75 76 Int_t GetNumEdges() const { return fEdges.GetSize(); }77 Int_t GetNumBins() const { return fEdges.GetSize()-1; }76 Int_t GetNumEdges() const { return fEdges.GetSize(); } 77 Int_t GetNumBins() const { return fEdges.GetSize()-1; } 78 78 79 79 Double_t *GetEdges() const { return (Double_t*)fEdges.GetArray(); } 80 const TArrayD &GetEdgesD() const { return fEdges; } 80 81 81 82 void AddEdge(Axis_t up); 83 void RemoveFirstEdge(); 84 void RemoveLastEdge(); 82 85 83 Bool_t IsLinear() const { return fType==kIsLinear; }86 Bool_t IsLinear() const { return fType==kIsLinear; } 84 87 Bool_t IsLogarithmic() const { return fType==kIsLogarithmic; } 85 Bool_t IsCosinic() const { return fType==kIsCosinic; }86 Bool_t IsDefault() const { return fType==kIsDefault; }87 Bool_t IsUserArray() const { return fType==kIsUserArray; }88 Bool_t IsCosinic() const { return fType==kIsCosinic; } 89 Bool_t IsDefault() const { return fType==kIsDefault; } 90 Bool_t IsUserArray() const { return fType==kIsUserArray; } 88 91 89 Bool_t HasTitle() const { return gsDefTitle!=fTitle; }92 Bool_t HasTitle() const { return gsDefTitle!=fTitle; } 90 93 91 94 void Apply(TH1 &) const; … … 95 98 96 99 #endif 97 -
trunk/MagicSoft/Mars/mhbase/MH.cc
r4956 r4966 478 478 } 479 479 480 void MH::RemoveFirstBin(TH1 &h) 481 { 482 if (h.InheritsFrom(TH2::Class()) || h.InheritsFrom(TH3::Class())) 483 return; 484 485 const Int_t n0 = h.GetNbinsX(); 486 if (n0<2) 487 return; 488 489 TArrayD val(n0-1); 490 TArrayD err(n0-1); 491 for (int i=1; i<n0; i++) 492 { 493 val[i-1] = h.GetBinContent(i+1); 494 err[i-1] = h.GetBinError(i+1); 495 } 496 497 MBinning bins; 498 bins.SetEdges(h, 'x'); 499 bins.RemoveFirstEdge(); 500 bins.Apply(h); 501 502 h.Reset(); 503 504 for (int i=1; i<n0; i++) 505 { 506 h.SetBinContent(i, val[i-1]); 507 h.SetBinError(i, err[i-1]); 508 } 509 } 510 480 511 // -------------------------------------------------------------------------- 481 512 // -
trunk/MagicSoft/Mars/mhbase/MH.h
r4956 r4966 69 69 static void SetBinning(TH1 *h, const TH1 *x); 70 70 71 static void RemoveFirstBin(TH1 &h); 72 71 73 static Bool_t ApplyBinning(const MParList &plist, TString name, TH1 *h); 72 74 -
trunk/MagicSoft/Mars/mhist/MHEffectiveOnTime.cc
r4927 r4966 208 208 // setup binning 209 209 MBinning btheta("BinningTheta"); 210 btheta.SetEdgesCos(10 1, 0, 60);210 btheta.SetEdgesCos(100, 0, 60); 211 211 212 212 MBinning btime("BinningDeltaT"); … … 448 448 // 449 449 450 // Get x-axis451 TAxis &x = *fHEffOnTime.GetXaxis();452 453 450 // Get number of bins 454 const Int_t n = x.GetNbins();451 const Int_t n = fHEffOnTime.GetNbinsX(); 455 452 456 453 // Enhance binning 457 454 MBinning bins; 458 bins.SetEdges( x);455 bins.SetEdges(fHEffOnTime, 'x'); 459 456 bins.AddEdge(fLastTime.GetAxisTime()); 460 457 bins.Apply(fHEffOnTime); … … 502 499 { 503 500 MBinning bins; 504 bins.SetEdges( 2, time->GetAxisTime()-fNumEvents/200, time->GetAxisTime());501 bins.SetEdges(1, time->GetAxisTime()-fNumEvents/200, time->GetAxisTime()); 505 502 bins.Apply(fHEffOnTime); 506 503 bins.Apply(fHProbTime); … … 543 540 FitThetaBins(); 544 541 FitTimeBin(); 542 MH::RemoveFirstBin(fHEffOnTime); 543 MH::RemoveFirstBin(fHProbTime); 545 544 546 545 fIsFinalized = kTRUE; … … 579 578 { 580 579 TVirtualPad *p=gPad->GetPad(x+1)->GetPad(y+1); 581 if ( (st = (TPaveStats*)p->GetPrimitive("stats")))582 {583 if (st->GetOptStat()==11) 584 continue;585 586 const Double_t y1 = st->GetY1NDC(); 587 const Double_t y2 = st->GetY2NDC();588 const Double_t x1 = st->GetX1NDC();589 const Double_t x2 = st->GetX2NDC();590 591 st->SetY1NDC((y2-y1)/3+y1); 592 st->SetX1NDC((x2-x1)/3+x1);593 st->SetOptStat(11);594 }580 if (!(st = (TPaveStats*)p->GetPrimitive("stats"))) 581 continue; 582 583 if (st->GetOptStat()==11) 584 continue; 585 586 const Double_t y1 = st->GetY1NDC(); 587 const Double_t y2 = st->GetY2NDC(); 588 const Double_t x1 = st->GetX1NDC(); 589 const Double_t x2 = st->GetX2NDC(); 590 591 st->SetY1NDC((y2-y1)/3+y1); 592 st->SetX1NDC((x2-x1)/3+x1); 593 st->SetOptStat(11); 595 594 } 596 595 -
trunk/MagicSoft/Mars/mjobs/MJStar.cc
r4920 r4966 203 203 fill8.SetNameTab("EvtRate"); 204 204 fill9.SetNameTab("EffOnTime"); 205 fill9.SetNameTab("EffOnVsTime");206 205 207 206 // ------------------ Setup write task ---------------- -
trunk/MagicSoft/Mars/mpointing/MPointing.cc
r4804 r4966 80 80 #include "MTime.h" 81 81 82 ClassImp(AltAz); 83 ClassImp(ZdAz); 82 84 ClassImp(MPointing); 83 85 … … 602 604 } 603 605 606 TVector3 MPointing::Correct(const TVector3 &v) const 607 { 608 // Correct [rad] 609 // zdaz [rad] 610 AltAz p(TMath::Pi()/2-v.Theta(), v.Phi()); 611 AltAz c = Correct(p); 612 TVector3 rc; 613 rc.SetMagThetaPhi(1, TMath::Pi()/2-c.Alt(), c.Az()); 614 return rc; 615 } 616 604 617 ZdAz MPointing::CorrectBack(const ZdAz &zdaz) const 605 618 { … … 611 624 } 612 625 626 TVector3 MPointing::CorrectBack(const TVector3 &v) const 627 { 628 // Correct [rad] 629 // zdaz [rad] 630 AltAz p(TMath::Pi()/2-v.Theta(), v.Phi()); 631 AltAz c = CorrectBack(p); 632 TVector3 rc; 633 rc.SetMagThetaPhi(1, TMath::Pi()/2-c.Alt(), c.Az()); 634 return rc; 635 } 636 613 637 void MPointing::SetParameters(const Double_t *par, Int_t n) 614 638 { -
trunk/MagicSoft/Mars/mpointing/MPointing.h
r4804 r4966 4 4 #ifndef ROOT_TArrayD 5 5 #include <TArrayD.h> 6 #endif 7 8 #ifndef ROOT_TVector3 9 #include <TVector3.h> 6 10 #endif 7 11 … … 24 28 Double_t Alt() const { return fX; } 25 29 Double_t Az() const { return fY; } 30 ClassDef(AltAz, 1) 26 31 }; 27 32 … … 34 39 Double_t Zd() const { return fX; } 35 40 Double_t Az() const { return fY; } 41 ClassDef(ZdAz, 1) 36 42 }; 37 43 #endif … … 95 101 void Reset(); 96 102 97 ZdAz Correct(const ZdAz &zdaz) const; 98 AltAz Correct(const AltAz &aaz) const; 99 100 ZdAz CorrectBack(const ZdAz &zdaz) const; 101 AltAz CorrectBack(const AltAz &aaz) const; 102 103 ZdAz operator()(const ZdAz &zdaz) const { return Correct(zdaz); } 104 AltAz operator()(const AltAz &aaz) const { return Correct(aaz); } 103 ZdAz Correct(const ZdAz &zdaz) const; 104 AltAz Correct(const AltAz &aaz) const; 105 TVector3 Correct(const TVector3 &v) const; 106 107 ZdAz CorrectBack(const ZdAz &zdaz) const; 108 AltAz CorrectBack(const AltAz &aaz) const; 109 TVector3 CorrectBack(const TVector3 &v) const; 110 111 ZdAz operator()(const ZdAz &zdaz) const { return Correct(zdaz); } 112 AltAz operator()(const AltAz &aaz) const { return Correct(aaz); } 113 TVector3 operator()(const TVector3 &v) const { return Correct(v); } 105 114 106 115 ZdAz operator()(const ZdAz &zdaz, void (*fcn)(ZdAz &zdaz, Double_t *par)) const … … 122 131 } 123 132 133 TVector3 operator()(const TVector3 &aaz, void (*fcn)(TVector3 &aaz, Double_t *par)) const 134 { 135 Double_t par[fNumPar]; 136 GetParameters(par); 137 TVector3 v = aaz; 138 fcn(v, par); 139 return v; 140 } 141 124 142 AltAz AddOffsets(const AltAz &aa) const; 125 143 ZdAz AddOffsets(const ZdAz &zdaz) const … … 129 147 return ZdAz(TMath::Pi()/2-c.Alt(), c.Az()); 130 148 } 149 TVector3 AddOffsets(const TVector3 &v) const 150 { 151 AltAz p(TMath::Pi()/2-v.Theta(), v.Phi()); 152 AltAz c = AddOffsets(p); 153 TVector3 rc; 154 rc.SetMagThetaPhi(1, TMath::Pi()/2-c.Alt(), c.Az()); 155 return rc; 156 } 131 157 132 158 AltAz SubtractOffsets(const AltAz &aa) const; … … 136 162 AltAz c = SubtractOffsets(p); 137 163 return ZdAz(TMath::Pi()/2-c.Alt(), c.Az()); 164 } 165 TVector3 SubtractOffsets(const TVector3 &v) const 166 { 167 AltAz p(TMath::Pi()/2-v.Theta(), v.Phi()); 168 AltAz c = SubtractOffsets(p); 169 TVector3 rc; 170 rc.SetMagThetaPhi(1, TMath::Pi()/2-c.Alt(), c.Az()); 171 return rc; 138 172 } 139 173 -
trunk/MagicSoft/Mars/mpointing/MSrcPosFromModel.cc
r4844 r4966 39 39 #include "MPointing.h" 40 40 #include "MSrcPosCam.h" 41 #include "MAstro.h" 42 #include "MAstroCatalog.h" // MVector3 41 43 #include "MAstroSky2Local.h" 42 44 #include "MPointingPos.h" … … 57 59 fTitle = title ? title : ""; 58 60 59 fPoint0401 = new MPointing("bending 0401.txt");61 fPoint0401 = new MPointing("bending-fit.txt"); 60 62 fPoint0405 = new MPointing("bending0405.txt"); 61 fPointOld = new MPointing("bending-old.txt");62 fPointNew = new MPointing("bending0408.txt");63 63 } 64 64 … … 67 67 delete fPoint0401; 68 68 delete fPoint0405; 69 delete fPointOld;70 delete fPointNew;71 69 } 72 70 … … 97 95 return kFALSE; 98 96 } 99 /*100 fReport = (MReportDrive*)pList->FindObject("MReportDrive");101 if (!fReport)102 {103 *fLog << err << "MReportDrive not found... aborting." << endl;104 return kFALSE;105 }106 97 107 98 fObservatory = (MObservatory*)pList->FindObject("MObservatory"); … … 119 110 } 120 111 121 fTime2 = (MTime*)pList->FindObject("MTimeDrive", "MTime");122 if (!fTime2)123 {124 *fLog << err << "MTimeDrive not found... aborting." << endl;125 return kFALSE;126 }127 */128 112 fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam"); 129 113 if (!fSrcPos) … … 132 116 return kTRUE; 133 117 } 134 /*135 TVector2 MSrcPosFromModel::CalcXYinCamera(const ZdAz &pos0, const ZdAz &pos1) const136 {137 MVector3 p0, p1;138 p0.SetZdAz(pos0.X(), pos0.Y());139 p1.SetZdAz(pos1.X(), pos1.Y());140 118 141 return CalcXYinCamera(p0, p1);142 }143 144 // --------------------------------------------------------------------------145 //146 // Loc0LocToCam147 //148 // Input : (theta0, phi0) direction for the position (0,0) in the camera149 // ( theta, phi) some other direction150 //151 // Output : (X, Y) position in the camera corresponding to (theta, phi)152 //153 TVector2 MSrcPosFromModel::CalcXYinCamera(const MVector3 &pos0, const MVector3 &pos) const154 {155 const Double_t theta0 = pos0.Theta();156 const Double_t phi0 = pos0.Phi();157 158 const Double_t theta = pos.Theta();159 const Double_t phi = pos.Phi();160 161 //--------------------------------------------162 163 // pos0[3] = TMath::Cos(theta0)164 165 const Double_t YC0 = TMath::Cos(theta0)*TMath::Tan(theta)*TMath::Cos(phi-phi0) - TMath::Sin(theta0);166 const Double_t YC1 = TMath::Cos(theta0) + TMath::Sin(theta0)*TMath::Tan(theta);167 const Double_t YC = YC0 / YC1;168 169 //--------------------------------------------170 171 const Double_t XC0 = TMath::Cos(theta0) - YC*TMath::Sin(theta0);172 const Double_t XC = -TMath::Sin(phi-phi0) * TMath::Tan(theta) * XC0;173 174 //--------------------------------------------175 return TVector2(XC, -YC);176 }177 */178 119 // -------------------------------------------------------------------------- 179 120 // … … 182 123 Int_t MSrcPosFromModel::Process() 183 124 { 184 MPointing *conv1 = 0; 185 MPointing *conv2 = 0; 125 MPointing *conv = 0; 186 126 187 if (!conv1 && fRun->GetRunNumber()<26237) 188 { 189 conv1 = fPoint0401; 190 conv2 = fPointOld; 191 } 192 if (!conv1 && fRun->GetRunNumber()<31684) 193 { 194 conv1 = fPoint0405; 195 conv2 = fPointOld; 196 } 197 /* 198 MVector3 sky; 199 sky.SetRaDec(fPointPos->GetRaRad(), fPointPos->GetDecRad()); 200 MVector3 loc = MAstroSky2Local(*fTime2, *fObservatory)*sky; 201 ZdAz za(loc.Theta(), loc.Phi()); 202 */ 127 if (!conv && fRun->GetRunNumber()<26237) 128 conv = fPoint0401; 129 if (!conv && fRun->GetRunNumber()<31684) 130 conv = fPoint0405; 203 131 204 // Get current pointing position from Drive system 205 ZdAz za(fPointPos->GetZd(), fPointPos->GetAz()); 206 za *= TMath::DegToRad(); 132 MVector3 sky; 133 sky.SetRaDec(fPointPos->GetRaRad(), fPointPos->GetDecRad()); 207 134 208 // Get c orresponding Shaftencoder positions for 'Used-Mode'209 const ZdAz za2 = conv1->Correct(za); // [deg] --> [se]210 // Get corre sponding Shaftencoder positions for 'Correct-Mode'211 const ZdAz za1 = conv2->Correct(za); // [deg] --> [se]135 // Get current star position (off center) 136 MVector3 vl2 = MAstroSky2Local(*fTime, *fObservatory)*sky; 137 // Get corrected position camera center) 138 TVector3 vl1 = conv->Correct(vl2); 212 139 213 // The difference of the shaftencoder positions for both model 214 // correspond in a first order approximation to the misspointing 215 TVector2 v0 = TVector2(za2.Y()-za1.Y(), za2.X()-za1.X()); 216 217 // Convert misspointing to millimeters 218 v0 *= TMath::RadToDeg()/fGeom->GetConvMm2Deg(); 140 // Calculate x,y of za2 141 TVector2 d = MAstro::GetDistOnPlain(vl1, vl2, fGeom->GetCameraDist()*1000); 219 142 220 143 // Set Source position 221 fSrcPos->SetXY(v0); 222 223 /* 224 TVector2 v0 = CalcXYinCamera(za1, za0)*fGeom->GetCameraDist()*(-1000); 225 TVector2 v1 = CalcXYinCamera(za0, za1)*fGeom->GetCameraDist()*(+1000); 226 227 fSrcPos->SetXY(TVector2(0,0)); // v1 228 229 za0 *= TMath::RadToDeg(); 230 za1 *= TMath::RadToDeg(); 231 232 *fLog << warn << endl; 233 *fLog << "-1-> " << za0.X() << " " << za0.Y() << " " << v0.X() << " " << v0.Y() << " " << v0.X()*fGeom->GetConvMm2Deg() << " " << v0.Y()*fGeom->GetConvMm2Deg() << endl; 234 *fLog << "-2-> " << za1.X() << " " << za1.Y() << " " << v1.X() << " " << v1.Y() << " " << v1.X()*fGeom->GetConvMm2Deg() << " " << v1.Y()*fGeom->GetConvMm2Deg() << endl; 235 236 Double_t rho = fPointPos->RotationAngle(*fObservatory, *fTime2); 237 *fLog << "-3-> " << rho*TMath::RadToDeg() << endl; 238 239 v1=v1.Rotate(-rho); 240 *fLog << "-4-> " << " " << " " << " " << " " << v1.X() << " " << v1.Y() << " " << v1.X()*fGeom->GetConvMm2Deg() << " " << v1.Y()*fGeom->GetConvMm2Deg() << endl; 241 242 */ 243 /* 244 *fLog << dbg << endl; 245 *fLog << "Time: " << setprecision(12) << fTime2->GetMjd() << " " << *fTime2 << endl; 246 *fLog << setprecision(6); 247 */ 144 fSrcPos->SetXY(d); 248 145 249 146 return kTRUE; -
trunk/MagicSoft/Mars/mpointing/MSrcPosFromModel.h
r4825 r4966 10 10 #endif 11 11 12 //class MVector3;13 12 class MPointingPos; 14 13 class MSrcPosCam; … … 16 15 class MPointing; 17 16 class MRawRunHeader; 18 //class MTime; 19 //class MObservatory; 20 //class MReportDrive; 21 //class ZdAz; 17 class MTime; 18 class MObservatory; 22 19 23 20 class MSrcPosFromModel : public MTask … … 28 25 MGeomCam *fGeom; //! Camera geometry 29 26 MRawRunHeader *fRun; //! Run Header storing the run-number 30 //MTime *fTime; 31 //MTime *fTime2; 32 //MReportDrive *fReport; 33 //MObservatory *fObservatory; 27 MTime *fTime; 28 MObservatory *fObservatory; 34 29 35 30 MPointing *fPoint0401; //! Pointing Model used since 1/2004 36 31 MPointing *fPoint0405; //! Pointing Model used since 5/2004 37 38 MPointing *fPointOld; //! Pointing Model valid until 8/200439 MPointing *fPointNew; //! Pointing Model valid since 8/200440 32 41 33 Int_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/mpointing/PointingLinkDef.h
r4826 r4966 14 14 #pragma link C++ class MSrcPosFromModel+; 15 15 16 #pragma link C++ class AltAz+; 17 #pragma link C++ class ZdAz+; 18 16 19 #endif -
trunk/MagicSoft/Mars/mreport/MReportTrigger.cc
r4926 r4966 17 17 ! 18 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 19 ! Author(s): Antonio Stamerra, 05/2004 <mailto:antonio.stamerra@pi.infn.it> 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 321 ! Copyright: MAGIC Software Development, 2000-2004 22 22 ! 23 23 ! … … 113 113 if (!fLiveTime) 114 114 return kFALSE; 115 116 115 117 116 return MReport::SetupReading(plist); -
trunk/MagicSoft/Mars/mreport/MReportTrigger.h
r4921 r4966 20 20 private: 21 21 22 Float_t fL2BeforePrescaler; //!L2 trigger rate before prescaler23 Float_t fL2AfterPrescaler; //!L2 trigger rate after prescaler22 Float_t fL2BeforePrescaler; // L2 trigger rate before prescaler 23 Float_t fL2AfterPrescaler; // L2 trigger rate after prescaler 24 24 25 MTriggerBit *fBit; //! container of the L2 prescaler rates26 MTriggerIPR *fIPR; //! container of the IPR27 MTriggerCell *fCell; //! container of the L1 cell trigger rates25 MTriggerBit *fBit; //! container of the L2 prescaler rates 26 MTriggerIPR *fIPR; //! container of the IPR 27 MTriggerCell *fCell; //! container of the L1 cell trigger rates 28 28 MTriggerPrescFact *fPrescFactor; //! container of the L2 prescaling factors 29 MTriggerLiveTime *fLiveTime; //! container of the scaler live-deadtime29 MTriggerLiveTime *fLiveTime; //! container of the scaler live-deadtime 30 30 31 31 Bool_t SetupReading(MParList &plist); … … 49 49 Float_t GetL2AfterPrescaler() const { return fL2AfterPrescaler; } 50 50 51 ClassDef(MReportTrigger, 1) // Class for TRIGGER-REPORT information51 ClassDef(MReportTrigger, 2) // Class for TRIGGER-REPORT information 52 52 }; 53 53 -
trunk/MagicSoft/Mars/mstarcam/MStarCamTrans.cc
r4741 r4966 155 155 fSLat = obs.GetSinPhi(); 156 156 157 gLog << "MStarCamTrans::TransCelLocCam; fDistCam, fCLat, fSLat = "158 << fDistCam << ", " << fCLat << ", " << fSLat << endl;159 160 157 if (fDistCam*fCLat*fSLat == 0.0) 161 158 { … … 233 230 // 234 231 // Output : (X, Y) position in the camera corresponding to (theta, phi) 232 // 233 // (see also MAstro::GetDistOnPlain()) 235 234 // 236 235 Bool_t MStarCamTrans::Loc0LocToCam(Double_t theta0deg, Double_t phi0deg, -
trunk/MagicSoft/Mars/mtrigger/MTriggerBit.cc
r4264 r4966 17 17 ! 18 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! Antonio Stamerra, 05/2004 <mailto:antonio.stamerra@pi.infn.it>19 ! Author(s): Antonio Stamerra, 05/2004 <mailto:antonio.stamerra@pi.infn.it> 20 20 ! 21 21 ! Copyright: MAGIC Software Development, 2000-2004 … … 27 27 // 28 28 // MTriggerBit 29 // 29 30 // This class stores the information about the L2 output Bit rates 30 //31 31 // 32 32 ///////////////////////////////////////////////////////////////////////////// -
trunk/MagicSoft/Mars/mtrigger/MTriggerBit.h
r4264 r4966 18 18 19 19 private: 20 21 20 static const Int_t gsNBits=20; // number of output bits 22 21 … … 27 26 { 28 27 fName = "MTriggerBit"; 29 fTitle = " Container for the L2 output bits rates";28 fTitle = "Trigger-Container for the L2 output bits rates"; 30 29 } 31 30 … … 52 51 } 53 52 54 ClassDef(MTriggerBit, 1) // Container for the L2 output bits rates53 ClassDef(MTriggerBit, 1) // Trigger-Container for the L2 output bits rates 55 54 }; 56 55 -
trunk/MagicSoft/Mars/mtrigger/MTriggerCell.cc
r4264 r4966 17 17 ! 18 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! Antonio Stamerra, 05/2004 <mailto:antonio.stamerra@pi.infn.it>19 ! Author(s): Antonio Stamerra, 05/2004 <mailto:antonio.stamerra@pi.infn.it> 20 20 ! 21 21 ! Copyright: MAGIC Software Development, 2000-2004 … … 27 27 // 28 28 // MTriggerCell 29 // 29 30 // This class stores the information about the Trigger Cell Rates 30 //31 31 // 32 32 ///////////////////////////////////////////////////////////////////////////// -
trunk/MagicSoft/Mars/mtrigger/MTriggerCell.h
r4264 r4966 16 16 { 17 17 friend class MReportTrigger; 18 18 19 private: 19 static const Int_t gsNCells=32; //Number of fields with cell rates 20 // 19 cells and 12 dummy 20 static const Int_t gsNCells=32; //Number of fields with cell rates 19 cells and 12 dummy 21 21 22 TArrayF fCellRate; // Array of the measured L1 cell rates22 TArrayF fCellRate; // Array of the measured L1 cell rates 23 23 24 24 public: … … 26 26 { 27 27 fName = "MTriggerCell"; 28 fTitle = " Container for the measured cell rates";28 fTitle = "Trigger-Container for the measured cell rates"; 29 29 } 30 30 … … 52 52 } 53 53 54 ClassDef(MTriggerCell, 1) // Container for the triggercell rates54 ClassDef(MTriggerCell, 1) // Trigger-Container for the measured cell rates 55 55 }; 56 56 -
trunk/MagicSoft/Mars/mtrigger/MTriggerIPR.cc
r4264 r4966 17 17 ! 18 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! Antonio Stamerra, 05/2004 <mailto:antonio.stamerra@pi.infn.it>19 ! Author(s): Antonio Stamerra, 05/2004 <mailto:antonio.stamerra@pi.infn.it> 20 20 ! 21 21 ! Copyright: MAGIC Software Development, 2000-2004 … … 27 27 // 28 28 // MTriggerIPR 29 // 29 30 // This class stores the information about the Individual Pixel Rates 30 //31 31 // 32 32 ///////////////////////////////////////////////////////////////////////////// -
trunk/MagicSoft/Mars/mtrigger/MTriggerIPR.h
r4264 r4966 16 16 { 17 17 friend class MReportTrigger; 18 18 19 private: 19 TArrayL fIPR; // [Hz] IPR (Individual Pixel Rates)20 21 20 static const Int_t gsNTrigPix=397; // number of trigger pixels 21 22 TArrayL fIPR; // [Hz] IPR (Individual Pixel Rates) 22 23 23 24 public: … … 25 26 { 26 27 fName = "MTriggerIPR"; 27 fTitle = " Container for the Individual Pixel Rate (IPR)";28 fTitle = "Trigger-Container for the Individual Pixel Rate (IPR)"; 28 29 } 29 30 … … 51 52 } 52 53 53 ClassDef(MTriggerIPR, 1) // Container for the Individual Pixel Rate (IPR)54 ClassDef(MTriggerIPR, 1) // Trigger-Container for the Individual Pixel Rate (IPR) 54 55 }; 55 56 -
trunk/MagicSoft/Mars/mtrigger/MTriggerLiveTime.cc
r4264 r4966 17 17 ! 18 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! Antonio Stamerra, 05/2004 <mailto:antonio.stamerra@pi.infn.it>19 ! Author(s): Antonio Stamerra, 05/2004 <mailto:antonio.stamerra@pi.infn.it> 20 20 ! 21 21 ! Copyright: MAGIC Software Development, 2000-2004 … … 27 27 // 28 28 // MTriggerLiveTime 29 // 29 30 // This class stores the information about the livetime and deadtime 30 31 // measured by the scalers -
trunk/MagicSoft/Mars/mtrigger/MTriggerLiveTime.h
r4264 r4966 27 27 { 28 28 fName = "MTriggerLiveTime"; 29 fTitle = " Container for the Live-deadtime";29 fTitle = "Trigger-Container for the Live-deadtime"; 30 30 } 31 31 … … 52 52 } 53 53 54 ClassDef(MTriggerLiveTime, 1) // Container for the Live-Deadtime54 ClassDef(MTriggerLiveTime, 1) // Trigger-Container for the Live-Deadtime 55 55 }; 56 56 -
trunk/MagicSoft/Mars/mtrigger/MTriggerPrescFact.cc
r4264 r4966 17 17 ! 18 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! Antonio Stamerra, 05/2004 <mailto:antonio.stamerra@pi.infn.it>19 ! Author(s): Antonio Stamerra, 05/2004 <mailto:antonio.stamerra@pi.infn.it> 20 20 ! 21 21 ! Copyright: MAGIC Software Development, 2000-2004 … … 27 27 // 28 28 // MTriggerPrescFact 29 // 29 30 // This class stores the information about the L2 prescaling factors 30 //31 31 // 32 32 ///////////////////////////////////////////////////////////////////////////// -
trunk/MagicSoft/Mars/mtrigger/MTriggerPrescFact.h
r4264 r4966 27 27 { 28 28 fName = "MTriggerPrescFact"; 29 fTitle = " Container for the L2 Prescaling Factors";29 fTitle = "Trigger-Container for the L2 Prescaling Factors"; 30 30 } 31 31 … … 52 52 } 53 53 54 ClassDef(MTriggerPrescFact, 1) // Container for the L2 Prescaling Factors54 ClassDef(MTriggerPrescFact, 1) // Trigger-Container for the L2 Prescaling Factors 55 55 }; 56 56
Note:
See TracChangeset
for help on using the changeset viewer.