- Timestamp:
- 07/07/03 16:22:51 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2267 r2268 1 1 -*-*- END OF LINE -*-*- 2 3 2003/07/06: Abelardo Moralejo 4 5 * mhistmc/MHMcCT1CollectionArea.[h,cc] 6 - Added possibility of using a logarithmic or linear scale in 7 energy. The function MHMcCT1CollectionArea::SetEaxis sets 8 what should be filled in the energy axis (either the energy 9 or its decimal logarithm). 10 11 * macros/CT1collarea.C 12 - Added example on how to use the new function 13 MHMcCT1CollectionArea::SetEaxis 2 14 3 15 2003/07/06: Thomas Bretz -
trunk/MagicSoft/Mars/macros/CT1collarea.C
r2261 r2268 24 24 \* ======================================================================== */ 25 25 26 #include "/home/magic/Mars/mhistmc/MHMcCT1CollectionArea.h" 26 27 27 28 void CT1collarea(TString filename="MC_SC4.root", TString outname="") 28 29 { 30 29 31 // 30 32 // first we have to create our empty lists … … 47 49 MBinning binsx("BinningE"); 48 50 49 // binsx.SetEdges(30,2.,5.); 50 // Double_t xedge[10] = 51 // {2.50515, 2.69897, 2.89763, 3.09691, 3.30103, 3.49969, 3.69984, 3.89982, 4.10003, 4.29994}; 52 53 51 /* 54 52 Double_t xedge[15] = {2.47712, 2.64345, 2.82607, 3., 3.17609, 3.35218, 3.52892, 3.70415, 3.88024, 4.05652, 4.23274, 4.40875, 4.58478, 4.76080, 4.90309}; 55 56 53 const TArrayD xed; 57 54 xed.Set(15,xedge); 58 55 binsx.SetEdges(xed); 56 collarea->SetEaxis(kLog10Energy); 57 */ 58 59 // 60 // SetEaxis tells MHMcCT1CollectionArea whether the variable to histogram 61 // is the Energy (argument is kEnergy) or its decimal logarithm 62 // (kLog10Energy). Of course this depends on how the energy binning is 63 // defined via the object binsx. 64 // 65 binsx.SetEdgesLog(14,300,1.e5); 66 collarea->SetEaxis(kEnergy); 67 59 68 60 69 MBinning binsy("BinningTheta"); -
trunk/MagicSoft/Mars/mhistmc/MHMcCT1CollectionArea.cc
r2261 r2268 66 66 fTitle = title ? title : "Collection Area vs. log10 Energy"; 67 67 68 fEaxis = kLog10Energy; 69 68 70 fHistAll = new TH2D; 69 71 fHistSel = new TH2D; … … 93 95 fHistCol->SetYTitle("theta [deg]"); 94 96 fHistCol->SetZTitle("A [m^{2}]"); 97 95 98 } 96 99 … … 130 133 fHistCol->Sumw2(); 131 134 135 if (fEaxis == kEnergy) 136 { 137 fTitle = "Collection Area vs. Energy"; 138 fHistCol->SetTitle(fTitle); 139 fHistAll->SetTitle("All showers - Theta vs Energy distribution"); 140 fHistSel->SetTitle("Selected showers - Theta vs Energy distribution"); 141 fHistCol->SetXTitle("E [GeV]"); 142 fHistAll->SetXTitle("E [GeV]"); 143 fHistSel->SetXTitle("E [GeV]"); 144 } 145 132 146 return kTRUE; 133 147 } … … 142 156 MMcEvt &mcevt = *(MMcEvt*)par; 143 157 144 fHistSel->Fill(log10(mcevt.GetEnergy()), kRad2Deg*mcevt.GetTelescopeTheta(), w); 158 if (fEaxis == kLog10Energy) 159 fHistSel->Fill(log10(mcevt.GetEnergy()), kRad2Deg*mcevt.GetTelescopeTheta(), w); 160 else 161 fHistSel->Fill(mcevt.GetEnergy(), kRad2Deg*mcevt.GetTelescopeTheta(), w); 162 145 163 return kTRUE; 146 164 } … … 193 211 194 212 c.cd(1); 213 if (fEaxis == kEnergy) 214 gPad->SetLogx(); 195 215 fHistCol->SetDirectory(NULL); 196 216 fHistCol->DrawCopy(option); 197 217 198 218 c.cd(2); 219 if (fEaxis == kEnergy) 220 gPad->SetLogx(); 199 221 fHistSel->SetDirectory(NULL); 200 222 fHistSel->DrawCopy(option); 201 223 202 224 c.cd(3); 225 if (fEaxis == kEnergy) 226 gPad->SetLogx(); 203 227 fHistAll->SetDirectory(NULL); 204 228 fHistAll->DrawCopy(option); … … 435 459 for (Int_t i=1; i <= fHistAll->GetNbinsX(); i++) 436 460 { 437 Float_t e1 = pow(10.,fHistAll->GetXaxis()->GetBinLowEdge(i)); 438 Float_t e2 = pow(10.,fHistAll->GetXaxis()->GetBinLowEdge(i+1)); 461 Float_t e1; 462 Float_t e2; 463 464 if (fEaxis == kLog10Energy) 465 { 466 e1 = pow(10.,fHistAll->GetXaxis()->GetBinLowEdge(i)); 467 e2 = pow(10.,fHistAll->GetXaxis()->GetBinLowEdge(i+1)); 468 } 469 else 470 { 471 e1 = fHistAll->GetXaxis()->GetBinLowEdge(i); 472 e2 = fHistAll->GetXaxis()->GetBinLowEdge(i+1); 473 } 439 474 440 475 Float_t events = 0.; -
trunk/MagicSoft/Mars/mhistmc/MHMcCT1CollectionArea.h
r2043 r2268 5 5 #include "MH.h" 6 6 #endif 7 8 enum { 9 kLog10Energy, 10 kEnergy 11 }; 7 12 8 13 class TH2D; … … 15 20 TH2D *fHistCol; // the collection area 16 21 22 Byte_t fEaxis; 23 17 24 public: 18 25 MHMcCT1CollectionArea(const char *name=NULL, const char *title=NULL); … … 24 31 void DrawAll(Option_t *option=""); 25 32 void DrawSel(Option_t *option=""); 33 34 void SetEaxis(Byte_t x) { fEaxis = x; } 26 35 27 36 const TH2D *GetHist() const { return fHistCol; }
Note:
See TracChangeset
for help on using the changeset viewer.