Changeset 1463
- Timestamp:
- 07/31/02 18:03:51 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1461 r1463 33 33 * manalysis/MImgCleanStd.cc: 34 34 - changed ispixused array size from max to max+1 35 36 * macros/MagicHillas.C: 37 - use the default binning of the histograms 38 39 * mhist/MH.[h,cc]: 40 - changed argument of SetBinning from TArrayD* to TArrayD& 41 - added ScaleArray 42 - added ScaleAxis 43 - proved that ScaleAxis is really working 44 - Added ApplyBinning 45 46 * mhist/MHHillas.[h,cc], mhist/MHHillasSrc.[h,cc]: 47 - corrected the default binning 48 - take use of MH::ApplyBinning 49 - don't stop execution if no binning was found (take default) 50 - made sure, that rescaling of the axis is working properly 35 51 36 52 -
trunk/MagicSoft/Mars/macros/MagicHillas.C
r1443 r1463 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)18 ! Author(s): Thomas Bretz et al, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 120 ! Copyright: MAGIC Software Development, 2000-2002 21 21 ! 22 22 ! … … 24 24 25 25 26 void MagicHillas(const char *filename="~/data/ gamma*.root")26 void MagicHillas(const char *filename="~/data/Gamma*.root") 27 27 { 28 28 // 29 29 // This is a demonstration program which calculates the Hillas 30 // parameter out of a Magic root file. 30 // parameter out of a Magic root file (raw data file). 31 // 31 32 32 33 // … … 43 44 // of MHillas 44 45 // 45 //MHillasExt hext; 46 //plist.AddToList(&hext); 46 /* 47 MHillasExt hext; 48 plist.AddToList(&hext); 49 */ 47 50 48 51 // … … 54 57 55 58 // 56 // Setup binning for your histograms. 59 // Use this if you want to change the binning of one of 60 // the histograms 57 61 // 58 MBinning binswidth("BinningWidth"); 59 binswidth.SetEdges(100, 0, 1); // 100 bins from 0 to 1 deg 62 /* 63 MBinning binswidth("BinningWidth"); 64 binswidth.SetEdges(100, 0, 0.1); // 100 bins from 0 to 1 deg 65 plist.AddToList(&binswidth); 60 66 61 MBinning binslength("BinningLength"); 62 binslength.SetEdges(100, 0, 1); // 100 bins from 0 to 1 deg 67 MBinning binslength("BinningLength"); 68 binslength.SetEdges(100, 0, 1); // 100 bins from 0 to 1 deg 69 plist.AddToList(&binslength); 63 70 64 MBinning binsalpha("BinningAlpha"); 65 binsalpha.SetEdges(90, 0, 90); // 90 bins from 0 to 90 deg 71 MBinning binsdist("BinningDist"); 72 binsdist.SetEdges(100, 0, 1.5); // 100 bins from 0 to 1 deg 73 plist.AddToList(&binsdist); 66 74 67 MBinning binsdist("BinningDist"); 68 binsdist.SetEdges(100, 0, 2); // 100 bins from 0 to 2 deg 75 MBinning binsht("BinningHeadTail"); 76 binsht.SetEdges(100, -1.5, 1.5); // 100 bins from 0 to 1 deg 77 plist.AddToList(&binsht); 69 78 70 plist.AddToList(&binswidth); 71 plist.AddToList(&binslength); 72 plist.AddToList(&binsalpha); 73 plist.AddToList(&binsdist); 79 MBinning binsalpha("BinningAlpha"); 80 binsalpha.SetEdges(90, 0, 90); // 90 bins from 0 to 90 deg 81 plist.AddToList(&binsalpha); 82 83 MBinning binscam("BinningCamera"); 84 binscam.SetEdges(50, -1.5, 1.5); // 20 bins from -2 to 2 deg 85 plist.AddToList(&binscam); 86 */ 74 87 75 88 // … … 101 114 MMcPedestalCopy pcopy; 102 115 MMcPedestalNSBAdd pnsb; 116 103 117 MCerPhotCalc ncalc; 104 105 // Alternative photon calculation: 106 // MCerPhotCalc2 ncalc; 107 // Example: use only 2nd to 6th FADC slices for photon calculation: 108 // const Float_t x[15]={0., 1., 1., 1., 1., 1., 0.,0.,0.,0.,0.,0.,0.,0.,0.}; 109 // TArrayF w(15,x); 110 // ncalc.SetWeights(w); 118 // 119 // Alternative photon calculation: 120 // Example: use only 2nd to 6th FADC slices for photon calculation: 121 // 122 // MCerPhotCalc2 ncalc; 123 // const Float_t x[15]={0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 124 // TArrayF w(15,x); 125 // ncalc.SetWeights(w); 126 // 111 127 112 128 MImgCleanStd clean; … … 121 137 MFillH hfill2a("HistAntiSrc [MHHillasSrc]", "HillasAntiSrc"); 122 138 139 MWriteRootFile write("hillas.root"); 140 write.AddContainer("MHillas", "Hillas"); 141 write.AddContainer("HillasSource", "Hillas"); 142 write.AddContainer("HillasAntiSrc", "Hillas"); 143 write.AddContainer("MHStarMap"); 144 write.AddContainer("MMcEvt","Hillas"); 145 123 146 /* 124 MWriteRootFile write("hillas.root");125 write.AddContainer("MHillas", "Hillas");126 write.AddContainer("HillasSource", "Hillas");127 write.AddContainer("HillasAntiSrc", "Hillas");128 write.AddContainer("MMcEvt", "Hillas");129 write.AddContainer("MHStarMap");130 131 147 MWriteAsciiFile write("hillas.txt"); 132 148 write.AddColumn("MHillas.fLength*MGeomCam.fConvMm2Deg"); … … 143 159 tlist.AddToList(&hcalc); 144 160 tlist.AddToList(&csrc1); 161 145 162 tlist.AddToList(&csrc2); 146 163 tlist.AddToList(&hfill); … … 148 165 tlist.AddToList(&hfill2s); 149 166 tlist.AddToList(&hfill2a); 167 tlist.AddToList(&write); 150 168 151 169 // … … 165 183 // 166 184 // After the analysis is finished we can display the histograms 167 185 // 186 plist.FindObject("HistSource")->DrawClone(); 168 187 plist.FindObject("MHHillas")->DrawClone(); 169 plist.FindObject("HistSource")->DrawClone();170 188 plist.FindObject("HistAntiSrc")->DrawClone(); 171 189 plist.FindObject("MHStarMap")->DrawClone(); 172 190 } 191 -
trunk/MagicSoft/Mars/mhist/MH.cc
r1449 r1463 56 56 57 57 #include "MLog.h" 58 #include "MLogManip.h" 59 60 #include "MParList.h" 61 #include "MParContainer.h" 58 62 59 63 #include "MBinning.h" … … 228 232 } 229 233 230 void MH::SetBinning(TH1 *h, const TArrayD *binsx)234 void MH::SetBinning(TH1 *h, const TArrayD &binsx) 231 235 { 232 236 MBinning bx; 233 bx.SetEdges( *binsx);237 bx.SetEdges(binsx); 234 238 SetBinning(h, &bx); 235 239 } 236 240 237 void MH::SetBinning(TH2 *h, const TArrayD *binsx, const TArrayD *binsy)241 void MH::SetBinning(TH2 *h, const TArrayD &binsx, const TArrayD &binsy) 238 242 { 239 243 MBinning bx; 240 244 MBinning by; 241 bx.SetEdges( *binsx);242 by.SetEdges( *binsy);245 bx.SetEdges(binsx); 246 by.SetEdges(binsy); 243 247 SetBinning(h, &bx, &by); 244 248 } 245 249 246 void MH::SetBinning(TH3 *h, const TArrayD *binsx, const TArrayD *binsy, const TArrayD *binsz)250 void MH::SetBinning(TH3 *h, const TArrayD &binsx, const TArrayD &binsy, const TArrayD &binsz) 247 251 { 248 252 MBinning bx; 249 253 MBinning by; 250 254 MBinning bz; 251 bx.SetEdges( *binsx);252 by.SetEdges( *binsy);253 bz.SetEdges( *binsz);255 bx.SetEdges(binsx); 256 by.SetEdges(binsy); 257 bz.SetEdges(binsz); 254 258 SetBinning(h, &bx, &by, &bz); 255 259 } … … 263 267 bx[nx] = binsx->GetXmax(); 264 268 265 SetBinning(h, &bx);269 SetBinning(h, bx); 266 270 } 267 271 … … 278 282 by[ny] = binsy->GetXmax(); 279 283 280 SetBinning(h, &bx, &by);284 SetBinning(h, bx, by); 281 285 } 282 286 … … 297 301 bz[nz] = binsz->GetXmax(); 298 302 299 SetBinning(h, &bx, &by, &bz);303 SetBinning(h, bx, by, bz); 300 304 } 301 305 … … 319 323 } 320 324 321 void MH::ScaleA xis(TArrayD &bins, Double_t f)325 void MH::ScaleArray(TArrayD &bins, Double_t f) 322 326 { 323 327 for (int i=0; i<bins.GetSize(); i++) … … 325 329 } 326 330 331 TArrayD MH::ScaleAxis(TAxis &axe, Double_t f) 332 { 333 TArrayD arr(axe.GetNbins()+1); 334 335 for (int i=1; i<=axe.GetNbins()+1; i++) 336 arr[i-1] = axe.GetBinLowEdge(i); 337 338 ScaleArray(arr, f); 339 340 return arr; 341 } 342 327 343 void MH::ScaleAxis(TH1 *h, Double_t fx, Double_t fy, Double_t fz) 328 344 { 329 345 if (h->InheritsFrom(TH3::Class())) 330 ScaleAxis(*((TH3*)h)->GetZaxis()->GetXbins(), fz); 346 { 347 SetBinning((TH3*)h, 348 ScaleAxis(*h->GetXaxis(), fx), 349 ScaleAxis(*h->GetYaxis(), fy), 350 ScaleAxis(*h->GetZaxis(), fz)); 351 return; 352 } 331 353 332 354 if (h->InheritsFrom(TH2::Class())) 333 ScaleAxis(*((TH2*)h)->GetYaxis()->GetXbins(), fy); 355 { 356 SetBinning((TH2*)h, 357 ScaleAxis(*h->GetXaxis(), fx), 358 ScaleAxis(*h->GetYaxis(), fy)); 359 return; 360 } 334 361 335 362 if (h->InheritsFrom(TH1::Class())) 336 ScaleAxis(*h->GetXaxis()->GetXbins(), fx); 363 SetBinning(h, ScaleAxis(*h->GetXaxis(), fx)); 364 } 365 366 Bool_t MH::ApplyBinning(const MParList &plist, TString name, TH1 *h) 367 { 368 const MBinning *bins = (MBinning*)plist.FindObject("Binning"+name); 369 if (!bins) 370 { 371 gLog << warn << "Object 'Binning" << name << "' [MBinning] not found... no binning applied." << endl; 372 return kFALSE; 373 } 374 375 SetBinning(h, bins); 376 return kTRUE; 337 377 } 338 378 -
trunk/MagicSoft/Mars/mhist/MH.h
r1449 r1463 34 34 static void SetBinning(TH3 *h, const MBinning *binsx, const MBinning *binsy, const MBinning *binsz); 35 35 36 static void SetBinning(TH1 *h, const TArrayD *binsx);37 static void SetBinning(TH2 *h, const TArrayD *binsx, const TArrayD *binsy);38 static void SetBinning(TH3 *h, const TArrayD *binsx, const TArrayD *binsy, const TArrayD *binsz);36 static void SetBinning(TH1 *h, const TArrayD &binsx); 37 static void SetBinning(TH2 *h, const TArrayD &binsx, const TArrayD &binsy); 38 static void SetBinning(TH3 *h, const TArrayD &binsx, const TArrayD &binsy, const TArrayD &binsz); 39 39 40 40 static void SetBinning(TH1 *h, const TAxis *binsx); … … 44 44 static void SetBinning(TH1 *h, TH1 *x); 45 45 46 static void ScaleAxis(TArrayD &bins, Double_t f); 47 static void ScaleAxis(TH1 *bins, Double_t fx=1, Double_t fy=1, Double_t fz=1); 46 static Bool_t ApplyBinning(const MParList &plist, TString name, TH1 *h); 47 48 static void ScaleArray(TArrayD &bins, Double_t f); 49 static TArrayD ScaleAxis(TAxis &axe, Double_t f); 50 static void ScaleAxis(TH1 *bins, Double_t fx=1, Double_t fy=1, Double_t fz=1); 48 51 49 52 static void FindGoodLimits(Int_t nbins, Int_t &newbins, Double_t &xmin, Double_t &xmax, Bool_t isInteger); -
trunk/MagicSoft/Mars/mhist/MHHillas.cc
r1441 r1463 59 59 // 60 60 MHHillas::MHHillas(const char *name, const char *title) 61 : fMm2Deg(1), fUseMmScale(k FALSE)61 : fMm2Deg(1), fUseMmScale(kTRUE) 62 62 { 63 63 // … … 67 67 fTitle = title ? title : "Source independent image parameters"; 68 68 69 fLength = new TH1F("Length", "Length of Ellipse", 100, 0, 300); 69 fLength = new TH1F("Length", "Length of Ellipse", 100, 0, 296.7); 70 fWidth = new TH1F("Width", "Width of Ellipse", 100, 0, 296.7); 71 fDistC = new TH1F("DistC", "Distance from center of camera", 100, 0, 445); 72 fDelta = new TH1F("Delta", "Angle (Main axis - x-axis)", 101, -90, 90); 73 70 74 fLength->SetDirectory(NULL); 75 fWidth->SetDirectory(NULL); 76 fDistC->SetDirectory(NULL); 77 fDelta->SetDirectory(NULL); 78 71 79 fLength->SetXTitle("Length [mm]"); 80 fWidth->SetXTitle("Width [mm]"); 81 fDistC->SetXTitle("Distance [mm]"); 82 fDelta->SetXTitle("Delta [\\circ]"); 83 72 84 fLength->SetYTitle("Counts"); 73 74 fWidth = new TH1F("Width", "Width of Ellipse", 100, 0, 300);75 fWidth->SetDirectory(NULL);76 fWidth->SetXTitle("Width [mm]");77 85 fWidth->SetYTitle("Counts"); 78 79 fDistC = new TH1F("DistC", "Distance from center of camera", 100, 0, 600);80 fDistC->SetDirectory(NULL);81 fDistC->SetXTitle("Distance [mm]");82 86 fDistC->SetYTitle("Counts"); 83 84 fDelta = new TH1F("Delta", "Angle (Main axis - x-axis)", 100, -90, 90);85 fDelta->SetDirectory(NULL);86 fDelta->SetXTitle("Delta [\\circ]");87 87 fDelta->SetYTitle("Counts"); 88 88 … … 101 101 MH::SetBinning(fSize, &bins); 102 102 103 fCenter = new TH2F("Center", "Center of Ellipse", 60, -600, 600, 60, -600, 600);103 fCenter = new TH2F("Center", "Center of Ellipse", 51, -445, 445, 51, -445, 445); 104 104 fCenter->SetDirectory(NULL); 105 105 fCenter->SetXTitle("x [mm]"); … … 136 136 Bool_t MHHillas::SetupFill(const MParList *plist) 137 137 { 138 const MBinning *binsw = (MBinning*)plist->FindObject("BinningWidth");139 const MBinning *binsl = (MBinning*)plist->FindObject("BinningLength");140 const MBinning *binsd = (MBinning*)plist->FindObject("BinningDist");141 const MBinning *binsc = (MBinning*)plist->FindObject("BinningCamera");142 143 if (!binsw || !binsl || !binsd || !binsc)144 {145 *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;146 return kFALSE;147 }148 149 SetBinning(fWidth, binsw);150 SetBinning(fLength, binsl);151 SetBinning(fDistC, binsd);152 SetBinning(fCenter, binsc, binsc);153 154 138 const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam"); 155 139 if (!geom) 156 {157 140 *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl; 158 return kTRUE; 159 } 160 161 fMm2Deg = geom->GetConvMm2Deg(); 162 fUseMmScale = kFALSE; 163 164 fLength->SetXTitle("Length [\\circ]"); 165 fWidth->SetXTitle("Width [\\circ]"); 166 fDistC->SetXTitle("Distance [\\circ]"); 167 fCenter->SetXTitle("x [\\circ]"); 168 fCenter->SetYTitle("y [\\circ]"); 141 else 142 { 143 fMm2Deg = geom->GetConvMm2Deg(); 144 SetMmScale(kFALSE); 145 } 146 147 ApplyBinning(*plist, "Width", fWidth); 148 ApplyBinning(*plist, "Length", fLength); 149 ApplyBinning(*plist, "Dist", fDistC); 150 ApplyBinning(*plist, "Camera", fCenter); 151 ApplyBinning(*plist, "Delta", fDelta); 152 ApplyBinning(*plist, "Size", fSize); 169 153 170 154 return kTRUE; … … 208 192 } 209 193 210 if (fUseMmScale) 211 { 212 MH::ScaleAxis(fLength, 1./fMm2Deg); 213 MH::ScaleAxis(fWidth, 1./fMm2Deg); 214 MH::ScaleAxis(fDistC, 1./fMm2Deg); 215 MH::ScaleAxis(fCenter, 1./fMm2Deg, 1./fMm2Deg); 216 194 const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg; 195 MH::ScaleAxis(fLength, scale); 196 MH::ScaleAxis(fWidth, scale); 197 MH::ScaleAxis(fDistC, scale); 198 MH::ScaleAxis(fCenter, scale, scale); 199 200 if (mmscale) 201 { 217 202 fLength->SetXTitle("Length [mm]"); 218 203 fWidth->SetXTitle("Width [mm]"); 204 fDistC->SetXTitle("Distance [mm]"); 219 205 fCenter->SetXTitle("x [mm]"); 220 206 fCenter->SetYTitle("y [mm]"); … … 222 208 else 223 209 { 224 MH::ScaleAxis(fLength, fMm2Deg);225 MH::ScaleAxis(fWidth, fMm2Deg);226 MH::ScaleAxis(fDistC, fMm2Deg);227 MH::ScaleAxis(fCenter, fMm2Deg, fMm2Deg);228 229 210 fLength->SetXTitle("Length [\\circ]"); 230 211 fWidth->SetXTitle("Width [\\circ]"); … … 247 228 248 229 const Double_t d = sqrt(h.GetMeanX()*h.GetMeanX() + h.GetMeanY()*h.GetMeanY()); 249 250 if (fUseMmScale) 251 { 252 fLength->Fill(h.GetLength()); 253 fWidth ->Fill(h.GetWidth()); 254 fDistC ->Fill(d); 255 fCenter->Fill(h.GetMeanX(), h.GetMeanY()); 256 } 257 else 258 { 259 fLength->Fill(fMm2Deg*h.GetLength()); 260 fWidth ->Fill(fMm2Deg*h.GetWidth()); 261 fDistC ->Fill(fMm2Deg*d); 262 fCenter->Fill(fMm2Deg*h.GetMeanX(), fMm2Deg*h.GetMeanY()); 263 } 264 265 fDelta->Fill(kRad2Deg*h.GetDelta()); 266 fSize->Fill(h.GetSize()); 230 const Double_t scale = fUseMmScale ? 1 : fMm2Deg; 231 232 fLength->Fill(scale*h.GetLength()); 233 fWidth ->Fill(scale*h.GetWidth()); 234 fDistC ->Fill(scale*d); 235 fCenter->Fill(scale*h.GetMeanX(), scale*h.GetMeanY()); 236 fDelta ->Fill(kRad2Deg*h.GetDelta()); 237 fSize ->Fill(h.GetSize()); 267 238 268 239 return kTRUE; … … 275 246 void MHHillas::SetColors() const 276 247 { 248 // FIXME: This must be redone each time the canvas is repainted.... 277 249 gStyle->SetPalette(51, NULL); 278 250 Int_t c[50]; … … 292 264 TObject *MHHillas::DrawClone(Option_t *opt) const 293 265 { 294 TCanvas *c = MakeDefCanvas("Hillas", fTitle, 7 00, 750);266 TCanvas *c = MakeDefCanvas("Hillas", fTitle, 720, 810); 295 267 c->Divide(2,3); 296 268 … … 332 304 { 333 305 if (!gPad) 334 MakeDefCanvas("Hillas", fTitle, 7 00, 750);306 MakeDefCanvas("Hillas", fTitle, 720, 810); 335 307 336 308 gPad->Divide(2,3); -
trunk/MagicSoft/Mars/mhist/MHHillas.h
r1441 r1463 14 14 private: 15 15 16 TH1F *fLength; 17 TH1F *fWidth; 16 TH1F *fLength; //-> 17 TH1F *fWidth; //-> 18 18 19 TH1F *fDistC; 20 TH1F *fDelta; 19 TH1F *fDistC; //-> 20 TH1F *fDelta; //-> 21 21 22 TH1F *fSize; 23 TH2F *fCenter; 22 TH1F *fSize; //-> 23 TH2F *fCenter; //-> 24 24 25 25 void SetColors() const; -
trunk/MagicSoft/Mars/mhist/MHHillasSrc.cc
r1442 r1463 68 68 // connect all the histogram with the container fHist 69 69 // 70 fAlpha = new TH1F("Alpha", "Alpha of Ellipse", 90, 0, 90);71 fDist = new TH1F("Dist", "Dist of Ellipse", 100, 0, 600);72 fHeadTail = new TH1F("HeadTail", "HeadTail of Ellipse", 45, 0, 90);73 fCosDA = new TH1F("CosDA", "cos(Delta,Alpha) of Ellipse", 10 0,-1, 1);70 fAlpha = new TH1F("Alpha", "Alpha of Ellipse", 90, 0, 90); 71 fDist = new TH1F("Dist", "Dist of Ellipse", 100, 0, 445); 72 fHeadTail = new TH1F("HeadTail", "HeadTail of Ellipse", 101, -445, 445); 73 fCosDA = new TH1F("CosDA", "cos(Delta,Alpha) of Ellipse", 101, -1, 1); 74 74 75 75 fAlpha->SetDirectory(NULL); … … 80 80 fAlpha->SetXTitle("\\alpha [\\circ]"); 81 81 fDist->SetXTitle("Dist [mm]"); 82 fHeadTail->SetXTitle("Head-Tail [ \\circ]");82 fHeadTail->SetXTitle("Head-Tail [mm]"); 83 83 fCosDA->SetXTitle("cos(\\delta,\\alpha) [mm]"); 84 84 … … 113 113 Bool_t MHHillasSrc::SetupFill(const MParList *plist) 114 114 { 115 const MBinning* binsa = (MBinning*)plist->FindObject("BinningAlpha");116 const MBinning* binsd = (MBinning*)plist->FindObject("BinningDist");117 if (!binsa || !binsd)118 {119 *fLog << err << dbginf << "At least one MBinning not found... aborting." << endl;120 return kFALSE;121 }122 123 SetBinning(fAlpha, binsa);124 SetBinning(fDist, binsd);125 126 115 const MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam"); 127 116 if (!geom) 128 {129 117 *fLog << warn << dbginf << "No Camera Geometry available. Using mm-scale for histograms." << endl; 130 return kTRUE; 131 } 132 133 fDist->SetXTitle("Dist [\\circ]"); 134 135 fMm2Deg = geom->GetConvMm2Deg(); 136 fUseMmScale = kFALSE; 118 else 119 { 120 fMm2Deg = geom->GetConvMm2Deg(); 121 SetMmScale(kFALSE); 122 } 123 124 ApplyBinning(*plist, "Alpha", fAlpha); 125 ApplyBinning(*plist, "Dist", fDist); 126 ApplyBinning(*plist, "HeadTail", fHeadTail); 137 127 138 128 return kTRUE; … … 150 140 fAlpha ->Fill(fabs(h.GetAlpha())); 151 141 fDist ->Fill(fUseMmScale ? h.GetDist() : fMm2Deg*h.GetDist()); 152 fHeadTail->Fill( h.GetHeadTail());142 fHeadTail->Fill(fUseMmScale ? h.GetHeadTail() : fMm2Deg*h.GetHeadTail()); 153 143 fCosDA ->Fill(h.GetCosDeltaAlpha()); 154 144 155 145 return kTRUE; 146 } 147 148 // -------------------------------------------------------------------------- 149 // 150 // Use this function to setup your own conversion factor between degrees 151 // and millimeters. The conversion factor should be the one calculated in 152 // MGeomCam. Use this function with Caution: You could create wrong values 153 // by setting up your own scale factor. 154 // 155 void MHHillasSrc::SetMm2Deg(Float_t mmdeg) 156 { 157 if (mmdeg<0) 158 { 159 *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl; 160 return; 161 } 162 163 if (fMm2Deg>=0) 164 *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl; 165 166 fMm2Deg = mmdeg; 167 } 168 169 // -------------------------------------------------------------------------- 170 // 171 // With this function you can convert the histogram ('on the fly') between 172 // degrees and millimeters. 173 // 174 void MHHillasSrc::SetMmScale(Bool_t mmscale) 175 { 176 if (fUseMmScale == mmscale) 177 return; 178 179 if (fMm2Deg<0) 180 { 181 *fLog << warn << dbginf << "Warning - Sorry, no conversion factor for conversion available." << endl; 182 return; 183 } 184 185 const Double_t scale = mmscale ? 1./fMm2Deg : fMm2Deg; 186 MH::ScaleAxis(fDist, scale); 187 MH::ScaleAxis(fHeadTail, scale); 188 189 if (mmscale) 190 { 191 fDist->SetXTitle("Dist [mm]"); 192 fHeadTail->SetXTitle("Head-Tail [mm]"); 193 } 194 else 195 { 196 fDist->SetXTitle("Dist [\\circ]"); 197 fHeadTail->SetXTitle("Head-Tail [\\circ]"); 198 } 199 200 fUseMmScale = mmscale; 156 201 } 157 202 … … 187 232 188 233 c->cd(4); 234 gPad->SetLogy(); 189 235 fCosDA->DrawCopy(); 190 236 … … 221 267 222 268 gPad->cd(2); 269 gPad->SetLogy(); 223 270 fCosDA->Draw(); 224 271 -
trunk/MagicSoft/Mars/mhist/MHHillasSrc.h
r1442 r1463 12 12 { 13 13 private: 14 TH1F *fAlpha; 15 TH1F *fDist; 16 TH1F *fHeadTail; 17 TH1F *fCosDA; 14 TH1F *fAlpha; //-> 15 TH1F *fDist; //-> 16 TH1F *fHeadTail; //-> 17 TH1F *fCosDA; //-> 18 18 19 19 Float_t fMm2Deg; … … 24 24 ~MHHillasSrc(); 25 25 26 void SetUseMmScale(Bool_t mmscale=kTRUE) { fUseMmScale = mmscale; } 26 void SetMmScale(Bool_t mmscale=kTRUE); 27 void SetMm2Deg(Float_t mmdeg); 27 28 28 29 Bool_t SetupFill(const MParList *pList);
Note:
See TracChangeset
for help on using the changeset viewer.