- Timestamp:
- 03/18/03 11:06:49 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1823 r1824 1 1 -*-*- END OF LINE -*-*- 2 3 2003/03/18: Abelardo Moralejo 4 5 * mhist/MHMcCT1CollectionArea.[h,cc] 6 - Added arguments in constructor: number of bins and ranges of the 7 x-axis (energy) of the 2-d histograms. 8 9 * macros/CT1collarea.C 10 - The MHMcCT1CollectionArea object is now created and added to the 11 parlist so that we can choose the binning. 2 12 3 13 2003/03/13: Abelardo moralejo -
trunk/MagicSoft/Mars/mhist/MHMcCT1CollectionArea.cc
r1823 r1824 46 46 // - collection area (result) 47 47 // 48 MHMcCT1CollectionArea::MHMcCT1CollectionArea(const char *name, const char *title )48 MHMcCT1CollectionArea::MHMcCT1CollectionArea(const char *name, const char *title, Int_t nbins, Axis_t minEnergy, Axis_t maxEnergy) 49 49 { 50 // initialize the histogram for the distribution r vs E 51 // 52 // we set the energy range from 10 Gev to 30000 GeV (in log 4.5 orders 53 // of magnitude) and for each order we take 10 subdivision --> 45 xbins 54 // we set the theta range from 12.5 to 48 deg, with 6 bins. 55 // 56 fName = name ? name : "MHMcCT1CollectionArea"; 57 fTitle = title ? title : "Collection Area vs. Energy"; 58 59 MBinning binsx; 60 MBinning binsy; 61 62 binsx.SetEdgesLog(45, 10, 30000); 63 const Double_t yedge[7] = {12.5, 17.5, 23.5, 29.5, 35.5, 42., 48.}; 64 const TArrayD yed(7,yedge); 65 binsy.SetEdges(yed); 66 67 fHistAll = new TH2D; 68 fHistSel = new TH2D; 69 fHistCol = new TH2D; 70 71 MH::SetBinning(fHistAll, &binsx, &binsy); 72 MH::SetBinning(fHistSel, &binsx, &binsy); 73 MH::SetBinning(fHistCol, &binsx, &binsy); 74 75 76 fHistCol->SetName(fName); 77 fHistAll->SetName("AllEvents"); 78 fHistSel->SetName("SelectedEvents"); 79 80 fHistCol->SetTitle(fTitle); 81 fHistAll->SetTitle("All showers - Theta vs Energy distribution"); 82 fHistSel->SetTitle("Selected showers - Theta vs Energy distribution"); 83 84 fHistAll->SetDirectory(NULL); 85 fHistSel->SetDirectory(NULL); 86 fHistCol->SetDirectory(NULL); 87 88 fHistAll->SetXTitle("E [GeV]"); 89 fHistAll->SetYTitle("theta [deg]"); 90 fHistAll->SetZTitle("N"); 91 92 fHistSel->SetXTitle("E [GeV]"); 93 fHistSel->SetYTitle("theta [deg]"); 94 fHistSel->SetYTitle("N"); 95 96 fHistCol->SetXTitle("E [GeV]"); 97 fHistCol->SetYTitle("theta [deg]"); 98 fHistCol->SetZTitle("A [m^{2}]"); 99 } 50 // 51 // nbins, minEnergy, maxEnergy defaults: 52 // we set the energy range from 100 Gev to 30000 GeV (in log, 3.5 orders 53 // of magnitude) and for each order we take 10 subdivisions --> 35 xbins 54 // we set the theta range from 12.5 to 48 deg, with 6 bins (the latter 55 // choice has been done to make the bin centers as close as possible to 56 // the actual zenith angles in the CT1 MC sample). 57 // 58 59 fName = name ? name : "MHMcCT1CollectionArea"; 60 fTitle = title ? title : "Collection Area vs. Energy"; 61 62 fHistAll = new TH2D; 63 fHistSel = new TH2D; 64 fHistCol = new TH2D; 65 66 SetBins(nbins, minEnergy, maxEnergy); 67 68 fHistCol->SetName(fName); 69 fHistAll->SetName("AllEvents"); 70 fHistSel->SetName("SelectedEvents"); 71 72 fHistCol->SetTitle(fTitle); 73 fHistAll->SetTitle("All showers - Theta vs Energy distribution"); 74 fHistSel->SetTitle("Selected showers - Theta vs Energy distribution"); 75 76 fHistAll->SetDirectory(NULL); 77 fHistSel->SetDirectory(NULL); 78 fHistCol->SetDirectory(NULL); 79 80 fHistAll->SetXTitle("E [GeV]"); 81 fHistAll->SetYTitle("theta [deg]"); 82 fHistAll->SetZTitle("N"); 83 84 fHistSel->SetXTitle("E [GeV]"); 85 fHistSel->SetYTitle("theta [deg]"); 86 fHistSel->SetYTitle("N"); 87 88 fHistCol->SetXTitle("E [GeV]"); 89 fHistCol->SetYTitle("theta [deg]"); 90 fHistCol->SetZTitle("A [m^{2}]"); 91 } 92 93 // -------------------------------------------------------------------------- 94 // 95 // Set binning of histograms. Binning of energy axis can be changed, that 96 // of theta axis is always the same (to match the CT1 MC sample theta dist): 97 // 98 void MHMcCT1CollectionArea::SetBins(Int_t nbins, Axis_t minEnergy, Axis_t maxEnergy) 99 { 100 MBinning binsx; 101 binsx.SetEdgesLog(nbins, minEnergy, maxEnergy); 102 103 MBinning binsy; 104 const Double_t yedge[7] = {12.5, 17.5, 23.5, 29.5, 35.5, 42., 48.}; 105 const TArrayD yed(7,yedge); 106 binsy.SetEdges(yed); 107 108 MH::SetBinning(fHistAll, &binsx, &binsy); 109 MH::SetBinning(fHistSel, &binsx, &binsy); 110 MH::SetBinning(fHistCol, &binsx, &binsy); 111 } 112 100 113 101 114 // -------------------------------------------------------------------------- … … 105 118 MHMcCT1CollectionArea::~MHMcCT1CollectionArea() 106 119 { 107 108 109 120 delete fHistAll; 121 delete fHistSel; 122 delete fHistCol; 110 123 } 111 124 … … 116 129 void MHMcCT1CollectionArea::FillSel(Double_t energy, Double_t theta) 117 130 { 118 131 fHistSel->Fill(energy, theta); 119 132 } 120 133 … … 125 138 void MHMcCT1CollectionArea::DrawAll(Option_t* option) 126 139 { 127 128 129 130 131 132 133 134 135 140 if (!gPad) 141 MH::MakeDefCanvas(fHistAll); 142 143 fHistAll->Draw(option); 144 145 gPad->SetLogx(); 146 147 gPad->Modified(); 148 gPad->Update(); 136 149 } 137 150 … … 142 155 void MHMcCT1CollectionArea::DrawSel(Option_t* option) 143 156 { 144 145 146 147 148 149 150 151 152 157 if (!gPad) 158 MH::MakeDefCanvas(fHistSel); 159 160 fHistSel->Draw(option); 161 162 gPad->SetLogx(); 163 164 gPad->Modified(); 165 gPad->Update(); 153 166 } 154 167 … … 161 174 TObject *MHMcCT1CollectionArea::DrawClone(Option_t* option) const 162 175 { 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 176 TCanvas *c = MH::MakeDefCanvas(fHistCol); 177 178 // 179 // This is necessary to get the expected behaviour of DrawClone 180 // 181 gROOT->SetSelectedPad(NULL); 182 183 fHistCol->DrawCopy(option); 184 185 gPad->SetLogx(); 186 187 c->Modified(); 188 c->Update(); 189 190 return c; 178 191 } 179 192 180 193 void MHMcCT1CollectionArea::Draw(Option_t* option) 181 194 { 182 183 184 185 186 187 188 189 190 195 if (!gPad) 196 MH::MakeDefCanvas(fHistCol); 197 198 fHistCol->Draw(option); 199 200 gPad->SetLogx(); 201 202 gPad->Modified(); 203 gPad->Update(); 191 204 } 192 205 … … 344 357 } 345 358 346 SetReadyToSave(); 347 } 348 359 SetReadyToSave(); 360 } -
trunk/MagicSoft/Mars/mhist/MHMcCT1CollectionArea.h
r1823 r1824 6 6 #endif 7 7 8 class TH1D;9 8 class TH2D; 10 9 … … 16 15 TH2D *fHistSel; //! the selected showers 17 16 TH2D *fHistCol; // the collection area 17 void SetBins(Int_t nbins, Axis_t minEnergy, Axis_t maxEnergy); 18 18 19 19 public: 20 MHMcCT1CollectionArea(const char *name=NULL, const char *title=NULL );20 MHMcCT1CollectionArea(const char *name=NULL, const char *title=NULL, Int_t nbins=45, Axis_t minEnergy=100., Axis_t maxEnergy=30000.); 21 21 ~MHMcCT1CollectionArea(); 22 22 … … 39 39 40 40 41 42
Note:
See TracChangeset
for help on using the changeset viewer.