Changeset 2107 for trunk/MagicSoft
- Timestamp:
- 05/09/03 19:58:55 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 1 added
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2106 r2107 1 1 -*-*- END OF LINE -*-*- 2 3 2003/05/09: Abelardo Moralejo 4 5 * mhistmc/MHMcEnergyMigration.[h,cc] 6 - Added histograms, changed Draw() to display them. Still 7 provisional, many changes in the whole part of the energy 8 estimator are needed. 9 10 * macros/CT1EEst.C, CT1EnergyEst.C 11 - Removed 12 13 * macros/CT1EgyEst.C 14 - Added example on how to use the energy estimation for CT1. 15 Very provisional! 2 16 3 17 2003/05/09: Wolfgang Wittek -
trunk/MagicSoft/Mars/mhistmc/MHMcEnergyMigration.cc
r2043 r2107 17 17 ! 18 18 ! Author(s): Wolfgang Wittek 4/2002 <mailto:wittek@mppmu.mpg.de> 19 ! Abelardo Moralejo 5/2003 <mailto:moralejo@pd.infn.it> 19 20 ! 20 21 ! Copyright: MAGIC Software Development, 2000-2002 … … 45 46 #include "MLog.h" 46 47 #include "MLogManip.h" 48 #include <TProfile.h> 47 49 48 50 ClassImp(MHMcEnergyMigration); … … 54 56 // 55 57 MHMcEnergyMigration::MHMcEnergyMigration(const char *name, const char *title) 56 : fHist()58 : fHist(), fHist2(), fHistImp() 57 59 { 58 60 // … … 63 65 64 66 fHist.SetDirectory(NULL); 65 66 fHist.SetTitle("3D-plot E-true E-est Theta"); 67 fHist.SetXTitle("E_{true} [GeV]"); 68 fHist.SetYTitle("E_{est} [GeV]"); 67 fHist.SetTitle("3D-plot E_{TRUE} E_{EST} \\Theta"); 68 fHist.SetXTitle("E_{TRUE} [GeV]"); 69 fHist.SetYTitle("E_{EST} [GeV]"); 69 70 fHist.SetZTitle("\\Theta [\\circ]"); 71 72 fHist2.SetDirectory(NULL); 73 fHist2.SetTitle("3D-plot \\Delta E / E vs E_{TRUE} E_{EST}"); 74 fHist2.SetXTitle("E_{TRUE} [GeV]"); 75 fHist2.SetYTitle("E_{EST} [GeV]"); 76 fHist2.SetZTitle("\\frac{E_{EST} - E_{TRUE}}{E_{TRUE}}"); 77 78 fHistImp.SetDirectory(NULL); 79 fHistImp.SetTitle("\\Delta E / E vs Impact parameter"); 80 fHistImp.SetXTitle("Impact parameter (m)"); 81 fHistImp.SetYTitle("\\frac{E_{EST} - E_{TRUE}}{E_{TRUE}}"); 82 70 83 } 71 84 … … 99 112 100 113 SetBinning(&fHist, binsenergy, binsenergy, binstheta); 101 102 114 fHist.Sumw2(); 115 116 const MBinning* binsde = (MBinning*)plist->FindObject("BinningDE"); 117 const MBinning* binsimpact = (MBinning*)plist->FindObject("BinningImpact"); 118 SetBinning(&fHistImp, binsimpact, binsde); 119 120 fHistImp.Sumw2(); 121 122 SetBinning(&fHist2, binsenergy, binsenergy, binsde); 123 fHist2.Sumw2(); 103 124 104 125 return kTRUE; … … 124 145 gPad->SetLogx(); 125 146 h = fHist.Project3D("ex_pro"); 126 h->SetTitle("Distribution of E_{ true}");127 h->SetXTitle("E_{ true} [GeV]");147 h->SetTitle("Distribution of E_{TRUE}"); 148 h->SetXTitle("E_{TRUE} [GeV]"); 128 149 h->SetBit(kCanDelete); 129 150 h->Draw(opt); 151 h->SetDirectory(NULL); 130 152 131 153 pad->cd(2); … … 133 155 gPad->SetLogx(); 134 156 h = fHist.Project3D("ey_pro"); 135 h->SetTitle("Distribution of E_{ est}");157 h->SetTitle("Distribution of E_{EST}"); 136 158 h->SetXTitle("E_{est} [GeV]"); 137 159 h->SetBit(kCanDelete); 138 160 h->Draw(opt); 161 Double_t minEest = h->GetXaxis()->GetXmin(); 162 h->SetDirectory(NULL); 139 163 140 164 pad->cd(3); 141 165 gPad->SetBorderMode(0); 142 h = fHist.Project3D(" ez_pro");166 h = fHist.Project3D("z_pro"); 143 167 h->SetTitle("Distribution of \\Theta"); 144 168 h->SetXTitle("\\Theta [\\circ]"); 145 169 h->SetBit(kCanDelete); 170 h->SetLineWidth(2); 146 171 h->Draw(opt); 172 h->SetDirectory(NULL); 147 173 148 174 pad->cd(4); 149 175 gPad->SetBorderMode(0); 150 fHist.Draw(opt); 176 TH1D* hpx; 177 hpx = fHistImp.ProjectionX("_px", 1, fHistImp.GetNbinsY(),"e"); 178 hpx->SetTitle("Distribution of Impact parameter"); 179 hpx->SetXTitle("Impact parameter (m)"); 180 hpx->SetBit(kCanDelete); 181 hpx->Draw(opt); 182 hpx->SetDirectory(NULL); 183 fHistImp.SetDirectory(NULL); 151 184 152 185 pad->Modified(); 153 186 pad->Update(); 187 188 TVirtualPad *pad2 = MakeDefCanvas((TString)GetName()+"2"); 189 pad2->SetBorderMode(0); 190 191 AppendPad(""); 192 193 pad2->Divide(2,2); 194 195 TH2D *h2; 196 197 pad2->cd(1); 198 gPad->SetBorderMode(0); 199 gPad->SetLogx(); 200 gPad->SetLogy(); 201 h2 = (TH2D*) fHist.Project3D("xy"); 202 203 TProfile* h2pfx; 204 h2pfx = h2->ProfileX("_pfx", 1, h2->GetNbinsY(),"S"); 205 h2pfx->SetXTitle("E_{TRUE} (GeV)"); 206 h2pfx->SetYTitle("E_{EST} (GeV)"); 207 h2pfx->SetTitle("E_{EST} vs E_{TRUE}"); 208 h2pfx->SetBit(kCanDelete); 209 h2pfx->SetFillColor(41); 210 h2pfx->SetMinimum(minEest); 211 h2pfx->SetStats(kFALSE); 212 h2pfx->Draw("E3"); 213 214 h2->SetBit(kCanDelete); 215 h2->SetFillColor(1); 216 h2->Draw("box,same"); 217 h2->SetDirectory(NULL); 218 219 h2pfx->SetLineColor(2); 220 h2pfx->SetLineWidth(2); 221 h2pfx->Draw("L,histo,same"); 222 h2pfx->SetDirectory(NULL); 223 224 pad2->cd(2); 225 gPad->SetBorderMode(0); 226 gPad->SetLogx(); 227 gPad->SetLeftMargin(0.15); 228 h2 = (TH2D*) fHist2.Project3D("zx"); 229 h2->SetBit(kCanDelete); 230 h2pfx = h2->ProfileX("_pfx", 1, h2->GetNbinsY(),"S"); 231 h2pfx->SetTitle("\\Delta E / E vs E_{TRUE}"); 232 h2pfx->SetXTitle("E_{TRUE} (GeV)"); 233 h2pfx->SetYTitle("\\frac{E_{EST} - E_{TRUE}}{E_{TRUE}}"); 234 h2pfx->SetBit(kCanDelete); 235 h2pfx->SetFillColor(41); 236 h2pfx->GetYaxis()->SetTitleOffset(1.4); 237 h2pfx->SetStats(kFALSE); 238 h2pfx->Draw("E3"); 239 h2->SetFillColor(1); 240 h2->Draw("same,box"); 241 h2->SetDirectory(NULL); 242 h2pfx->SetLineColor(2); 243 h2pfx->SetLineWidth(2); 244 h2pfx->Draw("L,histo,same"); 245 h2pfx->SetDirectory(NULL); 246 247 pad2->cd(3); 248 gPad->SetBorderMode(0); 249 gPad->SetLogx(); 250 gPad->SetLeftMargin(0.15); 251 h2 = (TH2D*) fHist2.Project3D("zy"); 252 h2->SetBit(kCanDelete); 253 h2pfx = h2->ProfileX("_pfx", 1, h2->GetNbinsY(),"S"); 254 h2pfx->SetTitle("\\Delta E / E vs E_{EST}"); 255 h2pfx->SetXTitle("E_{TRUE} (GeV)"); 256 h2pfx->SetYTitle("\\frac{E_{EST} - E_{TRUE}}{E_{TRUE}}"); 257 h2pfx->SetBit(kCanDelete); 258 h2pfx->SetFillColor(41); 259 h2pfx->GetYaxis()->SetTitleOffset(1.4); 260 h2pfx->SetStats(kFALSE); 261 h2pfx->SetMinimum(-1.); 262 h2pfx->SetMaximum(1.); 263 h2pfx->Draw("E3"); 264 265 h2->SetFillColor(1); 266 h2->Draw("same,box"); 267 h2->SetDirectory(NULL); 268 h2pfx->SetLineColor(2); 269 h2pfx->SetLineWidth(2); 270 h2pfx->Draw("L,histo,same"); 271 h2pfx->SetDirectory(NULL); 272 273 pad2->cd(4); 274 gPad->SetBorderMode(0); 275 h = fHist2.ProjectionZ("_pz",1,fHist2.GetNbinsX(),1,fHist2.GetNbinsY(),"e"); 276 h->SetBit(kCanDelete); 277 h->Draw(); 278 h->SetDirectory(NULL); 279 280 pad2->Modified(); 281 pad2->Update(); 282 283 fHist.SetDirectory(NULL); 284 fHist2.SetDirectory(NULL); 285 154 286 } 155 287 … … 160 292 Bool_t MHMcEnergyMigration::Fill(const MParContainer *par, const Stat_t w) 161 293 { 162 // MHillasSrc &hil = *(MHillasSrc*)par;163 // fHist.Fill(fMcEvt->GetEnergy(), hil.GetSize());164 165 294 // get E-true from fMcEvt and E-est from fEnergy 166 fHist.Fill(fMcEvt->GetEnergy(), fEnergy->GetEnergy(), fMcEvt->GetTheta()*kRad2Deg); 295 296 fHist.Fill(fMcEvt->GetEnergy(), fEnergy->GetEnergy(), fMcEvt->GetTelescopeTheta()*kRad2Deg, w); 297 298 fHist2.Fill(fMcEvt->GetEnergy(), fEnergy->GetEnergy(), (fEnergy->GetEnergy()-fMcEvt->GetEnergy())/fMcEvt->GetEnergy(), w); 299 300 fHistImp.Fill(fMcEvt->GetImpact()/100., (fEnergy->GetEnergy()-fMcEvt->GetEnergy())/fMcEvt->GetEnergy(), w); 167 301 168 302 return kTRUE; -
trunk/MagicSoft/Mars/mhistmc/MHMcEnergyMigration.h
r2043 r2107 8 8 #ifndef ROOT_TH3 9 9 #include <TH3.h> 10 #endif 11 12 #ifndef ROOT_TH2 13 #include <TH2.h> 10 14 #endif 11 15 … … 21 25 22 26 TH3D fHist; 27 TH3D fHist2; 28 TH2D fHistImp; 23 29 24 30 public: … … 30 36 const TH3D *GetHist() { return &fHist; } 31 37 const TH3D *GetHist() const { return &fHist; } 38 TH1 *GetHistByName(const TString name) { return &fHist; } 32 39 33 TH1 *GetHistByName(const TString name) { return &fHist; } 40 const TH3D *GetHist2() { return &fHist2; } 41 const TH2D *GetHistImp() { return &fHistImp; } 34 42 35 43 void Draw(Option_t *option=""); … … 40 48 41 49 #endif 42 43 44
Note:
See TracChangeset
for help on using the changeset viewer.