Changeset 1205 for trunk/MagicSoft
- Timestamp:
- 01/21/02 21:57:10 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1204 r1205 11 11 * mgui/MGeomPix.h: 12 12 - implemented first version of GetA 13 14 * mhist/MBinning.h: 15 - small changes to formulas 16 17 * mhist/MH.[h,cc]: 18 - implemented SetBinnign functions 19 13 20 14 21 … … 263 270 264 271 272 >>>>>>> 1.148 265 273 2001/12/18: Oscar Blanch 266 274 … … 290 298 - fix bug of Pedestal and Pedestal fluctuaions correspondence. 291 299 292 293 300 <<<<<<< Changelog 301 302 ======= 303 >>>>>>> 1.148 304 294 305 2001/12/18: Thomas Bretz 295 306 -
trunk/MagicSoft/Mars/mhist/MBinning.h
r1188 r1205 36 36 void SetEdgesLog(const Int_t nbins, const Axis_t lo, Axis_t up) 37 37 { 38 const Double_t binsize = (log10(up)-log10(lo))/nbins; 38 // if (lo==0) ... 39 40 const Double_t binsize = log10(up/lo)/nbins; 39 41 fEdges.Set(nbins+1); 40 42 for (int i=0; i<=nbins; i++) … … 42 44 } 43 45 44 // ROOT workaround: "operator[] const" missing46 // FIXME: ROOT workaround: "operator[] const" missing 45 47 Double_t GetEdgeLo() const { return (*(TArrayD*)(&fEdges))[0]; } 46 48 Double_t GetEdgeHi() const { return (*(TArrayD*)(&fEdges))[fEdges.GetSize()-1]; } -
trunk/MagicSoft/Mars/mhist/MH.cc
r1082 r1205 28 28 // // 29 29 // This is a base tasks for mars histograms. It defines a common interface // 30 // for filling the histograms with data (MH::Fill) which is used by a // 31 // common 'filler' (s. MFillH) // 30 // for filling the histograms with events (MH::Fill) which is used by a // 31 // common 'filler' And a SetupFill member function which may be used // 32 // by MFillH. The idea is: // 33 // 1) If your Histogram can become filled by one single container // 34 // (like MHHillas) you overload MH::Fill and it gets called with // 35 // a pointer to the container with which it should be filled. // 36 // // 37 // 2) You histogram needs several containers to get filled. Than you // 38 // have to overload MH::SetupFill and get the necessary objects from // 39 // the parameter list. Use this objects in Fill to fill your // 40 // histogram. // 32 41 // // 33 42 // If you want to create your own histogram class the new class must be // … … 40 49 #include "MH.h" 41 50 51 #include <TH1.h> 42 52 #include <TCanvas.h> 53 54 #include "MBinning.h" 43 55 44 56 ClassImp(MH); … … 101 113 return MakeDefCanvas(obj->GetName(), obj->GetTitle(), w, h); 102 114 } 115 116 void MH::SetBinning(TH1 *h, const MBinning *binsx) 117 { 118 // 119 // This is a necessary workaround if one wants to set 120 // non-equidistant bins after the initialization 121 // TH1D::fNcells must be set correctly. 122 // 123 h->SetBins(binsx->GetNumBins(), 0, 1); 124 125 // 126 // Set the binning of the current histogram to the binning 127 // in one of the two given histograms 128 // 129 h->GetXaxis()->Set(binsx->GetNumBins(), binsx->GetEdges()); 130 } 131 132 void MH::SetBinning(TH1 *h, const MBinning *binsx, const MBinning *binsy) 133 { 134 // 135 // This is a necessary workaround if one wants to set 136 // non-equidistant bins after the initialization 137 // TH1D::fNcells must be set correctly. 138 // 139 h->SetBins(binsx->GetNumBins(), 0, 1, 140 binsy->GetNumBins(), 0, 1); 141 142 // 143 // Set the binning of the current histogram to the binning 144 // in one of the two given histograms 145 // 146 h->GetXaxis()->Set(binsx->GetNumBins(), binsx->GetEdges()); 147 h->GetYaxis()->Set(binsy->GetNumBins(), binsy->GetEdges()); 148 } 149 150 void MH::SetBinning(TH1 *h, const MBinning *binsx, const MBinning *binsy, const MBinning *binsz) 151 { 152 // 153 // This is a necessary workaround if one wants to set 154 // non-equidistant bins after the initialization 155 // TH1D::fNcells must be set correctly. 156 // 157 h->SetBins(binsx->GetNumBins(), 0, 1, 158 binsy->GetNumBins(), 0, 1, 159 binsz->GetNumBins(), 0, 1); 160 161 // 162 // Set the binning of the current histogram to the binning 163 // in one of the two given histograms 164 // 165 h->GetXaxis()->Set(binsx->GetNumBins(), binsx->GetEdges()); 166 h->GetYaxis()->Set(binsy->GetNumBins(), binsy->GetEdges()); 167 h->GetZaxis()->Set(binsz->GetNumBins(), binsz->GetEdges()); 168 } 169 170 void MH::SetBinning(TH1 *h, const TArrayD *binsx) 171 { 172 MBinning bx; 173 bx.SetEdges(*binsx); 174 SetBinning(h, &bx); 175 } 176 177 void MH::SetBinning(TH1 *h, const TArrayD *binsx, const TArrayD *binsy) 178 { 179 MBinning bx; 180 MBinning by; 181 bx.SetEdges(*binsx); 182 by.SetEdges(*binsy); 183 SetBinning(h, &bx, &by); 184 } 185 186 void MH::SetBinning(TH1 *h, const TArrayD *binsx, const TArrayD *binsy, const TArrayD *binsz) 187 { 188 MBinning bx; 189 MBinning by; 190 MBinning bz; 191 bx.SetEdges(*binsx); 192 by.SetEdges(*binsy); 193 bz.SetEdges(*binsz); 194 SetBinning(h, &bx, &by, &bz); 195 } 196 197 void MH::SetBinning(TH1 *h, const TAxis *binsx) 198 { 199 MBinning bx; 200 bx.SetEdges(*((TAxis*)binsx)->GetXbins()); // FIXME: Root! 201 SetBinning(h, &bx); 202 } 203 204 void MH::SetBinning(TH1 *h, const TAxis *binsx, const TAxis *binsy) 205 { 206 MBinning bx; 207 MBinning by; 208 bx.SetEdges(*((TAxis*)binsx)->GetXbins()); // FIXME: Root! 209 by.SetEdges(*((TAxis*)binsy)->GetXbins()); // FIXME: Root! 210 SetBinning(h, &bx, &by); 211 } 212 213 void MH::SetBinning(TH1 *h, const TAxis *binsx, const TAxis *binsy, const TAxis *binsz) 214 { 215 MBinning bx; 216 MBinning by; 217 MBinning bz; 218 bx.SetEdges(*((TAxis*)binsx)->GetXbins()); // FIXME: Root! 219 by.SetEdges(*((TAxis*)binsy)->GetXbins()); // FIXME: Root! 220 bz.SetEdges(*((TAxis*)binsz)->GetXbins()); // FIXME: Root! 221 SetBinning(h, &bx, &by, &bz); 222 } 223 -
trunk/MagicSoft/Mars/mhist/MH.h
r1015 r1205 5 5 #include "MParContainer.h" 6 6 #endif 7 8 class TH1; 9 class MBinning; 10 class MParList; 11 class TArrayD; 12 class TAxis; 7 13 8 14 class TCanvas; … … 13 19 MH(const char *name=NULL, const char *title=NULL); 14 20 15 virtual void Fill(const MParContainer *par) = 0; 21 virtual Bool_t SetupFill(const MParList *pList) { return kTRUE; } 22 virtual Bool_t Fill(const MParContainer *par) = 0; 16 23 17 24 static TCanvas *MakeDefCanvas(const char *name=NULL, const char *title="", … … 20 27 const UInt_t w=700, const UInt_t h=500); 21 28 29 static void SetBinning(TH1 *h, const MBinning *binsx); 30 static void SetBinning(TH1 *h, const MBinning *binsx, const MBinning *binsy); 31 static void SetBinning(TH1 *h, const MBinning *binsx, const MBinning *binsy, const MBinning *binsz); 32 33 static void SetBinning(TH1 *h, const TArrayD *binsx); 34 static void SetBinning(TH1 *h, const TArrayD *binsx, const TArrayD *binsy); 35 static void SetBinning(TH1 *h, const TArrayD *binsx, const TArrayD *binsy, const TArrayD *binsz); 36 37 static void SetBinning(TH1 *h, const TAxis *binsx); 38 static void SetBinning(TH1 *h, const TAxis *binsx, const TAxis *binsy); 39 static void SetBinning(TH1 *h, const TAxis *binsx, const TAxis *binsy, const TAxis *binsz); 40 22 41 ClassDef(MH, 1) //A histogram base class for Mars histograms 23 42 }; -
trunk/MagicSoft/Mars/mhist/MHHillas.cc
r1203 r1205 1 <<<<<<< MHHillas.cc 1 2 /* ======================================================================== *\ 2 3 ! … … 45 46 // -------------------------------------------------------------------------- 46 47 // 47 // Setup four histograms for Width, Length48 // Setup four histograms for Alpha, Width, Length and Dist 48 49 // 49 50 MHHillas::MHHillas (const char *name, const char *title) … … 60 61 // connect all the histogram with the container fHist 61 62 // 63 fAlpha = new TH1F("Alpha [deg]", "Alpha of Hillas", 90, 0, 90); 62 64 fWidth = new TH1F("Width [mm]", "Width of Hillas", 100, 0, 300); 63 65 fLength = new TH1F("Length [mm]", "Length of Hillas", 100, 0, 300); 66 fDist = new TH1F("Dist [mm]", "Dist of Hillas", 100, 0, 300); 64 67 68 fAlpha->SetDirectory(NULL); 65 69 fLength->SetDirectory(NULL); 70 fDist->SetDirectory(NULL); 66 71 fWidth->SetDirectory(NULL); 67 72 73 fAlpha->GetXaxis()->SetTitle("\\alpha [\\circ]"); 68 74 fLength->GetXaxis()->SetTitle("Length [mm]"); 75 fDist->GetXaxis()->SetTitle("Dist [mm]"); 69 76 fWidth->GetXaxis()->SetTitle("Width [mm]"); 70 77 78 fAlpha->GetYaxis()->SetTitle("Counts"); 71 79 fLength->GetYaxis()->SetTitle("Counts"); 80 fDist->GetYaxis()->SetTitle("Counts"); 72 81 fWidth->GetYaxis()->SetTitle("Counts"); 73 82 } … … 79 88 MHHillas::~MHHillas() 80 89 { 90 delete fAlpha; 81 91 delete fWidth; 82 92 delete fLength; 93 delete fDist; 83 94 } 84 95 … … 88 99 // Be careful: Only call this with an object of type MHillas 89 100 // 90 voidMHHillas::Fill(const MParContainer *par)101 Bool_t MHHillas::Fill(const MParContainer *par) 91 102 { 92 103 const MHillas &h = *(MHillas*)par; 93 104 105 fAlpha ->Fill(fabs(h.GetAlpha())); 94 106 fWidth ->Fill(h.GetWidth()); 95 107 fLength->Fill(h.GetLength()); 108 fDist ->Fill(h.GetDist()); 109 110 return kTRUE; 96 111 } 97 112 … … 106 121 TObject *MHHillas::DrawClone(Option_t *opt) const 107 122 { 108 TCanvas *c = MakeDefCanvas("Hillas", "Histograms of Hillas Parameters", 109 350, 500); 110 c->Divide(1, 2); 123 TCanvas *c = MakeDefCanvas("Hillas", "Histograms of Hillas Parameters"); 124 c->Divide(2, 2); 111 125 112 126 gROOT->SetSelectedPad(NULL); … … 116 130 // 117 131 c->cd(1); 132 fAlpha->DrawCopy(); 133 134 c->cd(2); 118 135 fLength->DrawCopy(); 119 136 120 c->cd(2); 137 c->cd(3); 138 fDist->DrawCopy(); 139 140 c->cd(4); 121 141 fWidth->DrawCopy(); 122 142 … … 136 156 { 137 157 if (!gPad) 138 MakeDefCanvas("Hillas", "Histograms of Hillas Parameters" , 350, 500);158 MakeDefCanvas("Hillas", "Histograms of Hillas Parameters"); 139 159 140 gPad->Divide( 1,2);160 gPad->Divide(2,2); 141 161 142 162 gPad->cd(1); 163 fAlpha->Draw(); 164 165 gPad->cd(2); 143 166 fLength->Draw(); 144 167 145 gPad->cd(2); 168 gPad->cd(3); 169 fDist->Draw(); 170 171 gPad->cd(4); 146 172 fWidth->Draw(); 147 173 -
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r1203 r1205 1 <<<<<<< MHStarMap.cc 1 2 /* ======================================================================== *\ 2 3 ! … … 47 48 // Create the star map histogram 48 49 // 49 MHStarMap::MHStarMap (const char *name, const char *title)50 MHStarMap::MHStarMap (const char *name, const char *title) 50 51 { 51 52 // … … 72 73 fStarMap->SetDirectory(NULL); 73 74 74 fStarMap->SetXTitle("x [mm]");75 fStarMap->SetYTitle("y [mm]");75 fStarMap->SetXTitle("x/mm"); 76 fStarMap->SetYTitle("y/mm"); 76 77 fStarMap->SetZTitle("Counts"); 77 78 } … … 91 92 // Be careful: Only call this with an object of type MHillas 92 93 // 93 voidMHStarMap::Fill(const MParContainer *par)94 Bool_t MHStarMap::Fill(const MParContainer *par) 94 95 { 95 96 const MHillas &h = *(MHillas*)par; 96 97 97 const float delta = h.GetDelta(); 98 99 const float m = tan(delta); 100 const float t = m*h.GetMeanX()-h.GetMeanY(); 98 const float dist = h.GetDist(); 99 const float theta = h.GetTheta(); 100 const float alpha = h.GetAlpha()/kRad2Deg; 101 102 const float m = tan(theta+alpha-kPI); 103 const float t = dist*(sin(theta)-cos(theta)*m); 101 104 102 105 if (m>-1 && m<1) … … 114 117 fStarMap->Fill(x, y); 115 118 } 119 120 return kTRUE; 116 121 } 117 122 … … 209 214 gPad->Update(); 210 215 } 216 -
trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.h
r1016 r1205 1 #ifndef MARS_M TriggerRateCalc2 #define MARS_M TriggerRateCalc1 #ifndef MARS_MMcTriggerRateCalc 2 #define MARS_MMcTriggerRateCalc 3 3 4 4 #ifndef ROOT_TObjArray
Note:
See TracChangeset
for help on using the changeset viewer.