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