Changeset 1463 for trunk/MagicSoft/Mars/mhist/MHHillas.cc
- Timestamp:
- 07/31/02 18:03:51 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note:
See TracChangeset
for help on using the changeset viewer.