Changeset 6869 for trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc
- Timestamp:
- 03/21/05 10:39:58 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mimage/MHNewImagePar.cc
r5142 r6869 56 56 // 57 57 MHNewImagePar::MHNewImagePar(const char *name, const char *title) 58 : fMm2Deg(1), fUseMmScale(kTRUE) 58 59 { 59 60 fName = name ? name : "MHNewImagePar"; … … 142 143 bins.Apply(fHistCorePix); 143 144 144 bins.SetEdges(75, 0, 0.249);145 bins.Apply(fHistUsedArea);146 bins.Apply(fHistCoreArea);145 //bins.SetEdges(75, 0, 0.249); 146 //bins.Apply(fHistUsedArea); 147 //bins.Apply(fHistCoreArea); 147 148 } 148 149 … … 154 155 Bool_t MHNewImagePar::SetupFill(const MParList *plist) 155 156 { 157 MGeomCam *geom = (MGeomCam*)plist->FindObject("MGeomCam"); 158 if (!geom) 159 *fLog << warn << GetDescriptor() << ": No Camera Geometry available. Using mm-scale for histograms." << endl; 160 else 161 { 162 fMm2Deg = geom->GetConvMm2Deg(); 163 SetMmScale(kFALSE); 164 } 165 166 const MBinning *bins = (MBinning*)plist->FindObject("BinningArea"); 167 if (!bins) 168 { 169 float r = geom ? 1.5 : 0.133; 170 171 MBinning b; 172 b.SetEdges(50, 0, r); 173 b.Apply(fHistUsedArea); 174 b.Apply(fHistCoreArea); 175 } 176 else 177 { 178 bins->Apply(fHistUsedArea); 179 bins->Apply(fHistCoreArea); 180 } 181 156 182 ApplyBinning(*plist, "Leakage", &fHistLeakage1); 157 183 ApplyBinning(*plist, "Leakage", &fHistLeakage2); … … 160 186 ApplyBinning(*plist, "Pixels", &fHistCorePix); 161 187 162 ApplyBinning(*plist, "Area", &fHistUsedArea);163 ApplyBinning(*plist, "Area", &fHistCoreArea);188 //ApplyBinning(*plist, "Area", &fHistUsedArea); 189 //ApplyBinning(*plist, "Area", &fHistCoreArea); 164 190 165 191 ApplyBinning(*plist, "Conc", &fHistConc); … … 182 208 } 183 209 210 const Double_t scale = fUseMmScale ? 1e-6 : fMm2Deg*fMm2Deg; 211 184 212 const MNewImagePar &h = *(MNewImagePar*)par; 185 213 … … 190 218 fHistCorePix.Fill(h.GetNumCorePixels(), w); 191 219 192 fHistUsedArea.Fill(h.GetUsedArea() /1000000, w);193 fHistCoreArea.Fill(h.GetCoreArea() /1000000, w);220 fHistUsedArea.Fill(h.GetUsedArea()*scale, w); 221 fHistCoreArea.Fill(h.GetCoreArea()*scale, w); 194 222 195 223 fHistConc.Fill(h.GetConc(), w); … … 197 225 198 226 return kTRUE; 227 } 228 229 // -------------------------------------------------------------------------- 230 // 231 // With this function you can convert the histogram ('on the fly') between 232 // degrees and millimeters. 233 // 234 void MHNewImagePar::SetMmScale(Bool_t mmscale) 235 { 236 if (fUseMmScale == mmscale) 237 return; 238 239 if (fMm2Deg<0) 240 { 241 *fLog << warn << dbginf << "Warning - Sorry, no conversion factor for conversion available." << endl; 242 return; 243 } 244 245 const Double_t scale = mmscale ? 1./(fMm2Deg*fMm2Deg) : (fMm2Deg*fMm2Deg); 246 MH::ScaleAxis(&fHistUsedArea, scale); 247 MH::ScaleAxis(&fHistCoreArea, scale); 248 249 if (mmscale) 250 { 251 fHistUsedArea.SetXTitle("A [m^{2}]"); 252 fHistCoreArea.SetXTitle("A [m^{2}]"); 253 } 254 else 255 { 256 fHistUsedArea.SetXTitle("A [deg^{2}]"); 257 fHistCoreArea.SetXTitle("A [deg^{2}]"); 258 } 259 260 fUseMmScale = mmscale; 261 } 262 263 // -------------------------------------------------------------------------- 264 // 265 // Use this function to setup your own conversion factor between degrees 266 // and millimeters. The conversion factor should be the one calculated in 267 // MGeomCam. Use this function with Caution: You could create wrong values 268 // by setting up your own scale factor. 269 // 270 void MHNewImagePar::SetMm2Deg(Float_t mmdeg) 271 { 272 if (mmdeg<0) 273 { 274 *fLog << warn << dbginf << "Warning - Conversion factor < 0 - nonsense. Ignored." << endl; 275 return; 276 } 277 278 if (fMm2Deg>=0) 279 *fLog << warn << dbginf << "Warning - Conversion factor already set. Overwriting" << endl; 280 281 fMm2Deg = mmdeg; 199 282 } 200 283
Note:
See TracChangeset
for help on using the changeset viewer.