Changeset 1004 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 10/29/01 11:35:19 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MFillH.cc
r967 r1004 60 60 void MFillH::Init(const char *name, const char *title) 61 61 { 62 *fName = name ? name : "MFillH";63 *fTitle = title ? title : "Task to fill Mars histograms";62 fName = name ? name : "MFillH"; 63 fTitle = title ? title : "Task to fill Mars histograms"; 64 64 65 65 fH = NULL; … … 162 162 } 163 163 164 if (!fH->InheritsFrom("MH")) 165 { 166 *fLog << dbginf << fH->GetName() << " [" << fH->ClassName(); 167 *fLog << "] doesn't inherit from MH - cannot be used for MFillH... aborting." << endl; 168 return kFALSE; 169 } 170 164 171 return kTRUE; 165 172 } -
trunk/MagicSoft/Mars/mhist/MH.h
r961 r1004 10 10 #endif 11 11 12 class TCanvas; 13 12 14 class MH : public MParContainer 13 15 { 14 16 public: 15 17 MH(const char *name=NULL, const char *title=NULL); 16 18 17 19 virtual void Fill(const MParContainer *par) = 0; 20 21 static TCanvas *MakeDefCanvas(const char *name=NULL, const char *title="", 22 const UInt_t w=700, const UInt_t h=500); 23 static TCanvas *MakeDefCanvas(const TObject *obj, 24 const UInt_t w=700, const UInt_t h=500); 18 25 19 26 ClassDef(MH, 1) //A histogram base class for Mars histograms -
trunk/MagicSoft/Mars/mhist/MHFadcCam.cc
r887 r1004 34 34 #include "MHFadcCam.h" 35 35 36 #include <TH1.h>37 38 36 #include "MRawEvtData.h" 39 37 #include "MRawEvtPixelIter.h" … … 52 50 // 53 51 54 *fName = name ? name : "MHFadcCam" ;55 *fTitle = title ? title : "Container for ADC spectra histograms" ;52 fName = name ? name : "MHFadcCam" ; 53 fTitle = title ? title : "Container for ADC spectra histograms" ; 56 54 57 55 // … … 72 70 } 73 71 72 // -------------------------------------------------------------------------- 74 73 void MHFadcCam::Fill(const MParContainer *par) 75 74 { … … 113 112 // 114 113 115 fHistLo->Write() 116 fHistHi->Write() 114 fHistLo->Write(); 115 fHistHi->Write(); 117 116 } 118 117 -
trunk/MagicSoft/Mars/mhist/MHFadcCam.h
r887 r1004 17 17 #endif 18 18 19 class TH1F; 19 #ifndef ROOT_TH1 20 #include <TH1.h> 21 #endif 20 22 21 23 class MHFadcCam : public MH -
trunk/MagicSoft/Mars/mhist/MHFadcPix.cc
r959 r1004 35 35 #include "MHFadcPix.h" 36 36 37 #include <TH1.h> 37 38 #include <TPad.h> 39 40 #include "MH.h" 38 41 39 42 ClassImp(MHFadcPix); … … 43 46 // Creates the histograms for lo and hi gain of one pixel 44 47 // 45 MHFadcPix::MHFadcPix(UInt_t pixid) 48 MHFadcPix::MHFadcPix(UInt_t pixid) : fPixId(pixid) 46 49 { 47 // FIXME! Set the right axis titles and ... and ... 48 Char_t tmp1[40]; 49 Char_t tmp2[40]; 50 Char_t *name = StrDup(pixid ? Form("HiGain%03d", pixid) : "HiGain"); 51 Char_t *title = StrDup(pixid ? Form("Hi Gain Pixel #%d", pixid) : "Hi Gain Samples"); 50 52 51 // if (pixid) 52 // { 53 sprintf(tmp1, "HiGain%03d", pixid); 54 sprintf(tmp2, "Hi Gain Pixel #%d", pixid); 55 // } 56 fHistHi = new TH1F(tmp1, tmp2, 256, 0, 255); 53 fHistHi = new TH1F(name, title, 256, 0, 255); 57 54 58 // if (pixid) 59 // { 60 sprintf(tmp1, "LoGain%03d", pixid); 61 sprintf(tmp2, "Lo Gain Pixel #%d", pixid); 62 // } 63 fHistLo = new TH1F(tmp2, tmp2, 256, 0, 255); 55 fHistHi->SetDirectory(NULL); 56 fHistHi->SetXTitle("Time/Slices"); 57 fHistHi->SetYTitle("Signal"); 58 59 delete [] name; 60 delete [] title; 61 62 name = StrDup(pixid ? Form("LoGain%03d", pixid) : "LoGain"); 63 title = StrDup(pixid ? Form("Lo Gain Pixel #%d", pixid) : "Lo Gain Samples"); 64 65 fHistLo = new TH1F(name, title, 256, 0, 255); 66 67 fHistLo->SetDirectory(NULL); 68 fHistLo->SetXTitle("Time/Slices"); 69 fHistLo->SetYTitle("Signal"); 70 71 delete [] name; 72 delete [] title; 64 73 } 65 74 … … 72 81 73 82 // -------------------------------------------------------------------------- 83 inline void MHFadcPix::FillHi(Byte_t i) 84 { 85 fHistHi->Fill(i); 86 } 87 88 // -------------------------------------------------------------------------- 89 inline void MHFadcPix::FillLo(Byte_t i) 90 { 91 fHistLo->Fill(i); 92 } 93 94 // -------------------------------------------------------------------------- 95 inline void MHFadcPix::DrawHi() 96 { 97 fHistHi->Draw(); 98 } 99 100 // -------------------------------------------------------------------------- 101 inline void MHFadcPix::DrawLo() 102 { 103 fHistLo->Draw(); 104 } 105 106 // -------------------------------------------------------------------------- 74 107 void MHFadcPix::Draw(Option_t *) 75 108 { 76 109 if (!gPad) 77 110 { 78 if (!gROOT->GetMakeDefCanvas()) 79 return; 80 (gROOT->GetMakeDefCanvas())(); 111 const char *name = StrDup(fPixId ? Form("Pixel #%d", fPixId) : "Pixel"); 112 const char *title = StrDup(fPixId ? Form("%s FADC Samples", name) : "FADC Samples"); 113 MH::MakeDefCanvas(name, title); 114 delete [] name; 115 delete [] title; 81 116 } 82 117 83 118 gPad->Divide(1, 2); 84 119 85 gPad->cd( 0);120 gPad->cd(1); 86 121 fHistHi->Draw(); 87 122 88 gPad->cd( 1);123 gPad->cd(2); 89 124 fHistLo->Draw(); 90 125 } -
trunk/MagicSoft/Mars/mhist/MHFadcPix.h
r712 r1004 6 6 #endif 7 7 8 #ifndef ROOT_TH1 9 #include <TH1.h> 10 #endif 8 //#ifndef ROOT_TH1 9 //#include <TH1.h> 10 //#endif 11 12 class TH1F; 11 13 12 14 class MHFadcPix : public TObject … … 15 17 TH1F *fHistHi; 16 18 TH1F *fHistLo; 19 20 UInt_t fPixId; 17 21 18 22 public: … … 23 27 TH1F *GetHistLo() { return fHistLo; } 24 28 25 void FillHi(Byte_t i) { fHistHi->Fill(i); }26 void FillLo(Byte_t i) { fHistLo->Fill(i); }29 void FillHi(Byte_t i); 30 void FillLo(Byte_t i); 27 31 28 void DrawHi() { fHistHi->Draw(); }29 void DrawLo() { fHistLo->Draw(); }32 void DrawHi(); 33 void DrawLo(); 30 34 31 35 void Draw(Option_t *opt=NULL); -
trunk/MagicSoft/Mars/mhist/MHHillas.cc
r995 r1004 26 26 { 27 27 // 28 // default constructor29 // creates an a list of histograms for all pixels and both gain channels30 //31 32 //33 28 // set the name and title of this object 34 29 // 35 36 *fName = name ? name : "MHHillas" ; 37 *fTitle = title ? title : "Container for Hillas histograms" ; 30 fName = name ? name : "MHHillas" ; 31 fTitle = title ? title : "Container for Hillas histograms" ; 38 32 39 33 // … … 42 36 // connect all the histogram with the container fHist 43 37 // 44 // FIXME! Make the histograms looking that they can be used for45 // presentations (axis title, ...)46 //47 38 fAlpha = new TH1F("Alpha [deg]", "Alpha of Hillas", 90, 0, 90); 48 39 fWidth = new TH1F("Width [mm]", "Width of Hillas", 100, 0, 300); 49 40 fLength = new TH1F("Length [mm]", "Length of Hillas", 100, 0, 300); 50 41 fDist = new TH1F("Dist [mm]", "Dist of Hillas", 100, 0, 300); 42 43 fAlpha->SetDirectory(NULL); 44 fLength->SetDirectory(NULL); 45 fDist->SetDirectory(NULL); 46 fWidth->SetDirectory(NULL); 51 47 52 48 fAlpha->GetXaxis()->SetTitle("Alpha [deg]"); … … 98 94 TObject *MHHillas::DrawClone(Option_t *opt) const 99 95 { 100 TCanvas *c = new TCanvas("Hillas", "Histograms of Hillas Parameters");101 c->Divide(2, 2);96 TCanvas *c = MakeDefCanvas("Hillas", "Histograms of Hillas Parameters"); 97 c->Divide(2, 2); 102 98 103 99 gROOT->SetSelectedPad(NULL); … … 107 103 // 108 104 c->cd(1); 109 fAlpha->DrawC lone()->SetBit(kCanDelete);105 fAlpha->DrawCopy(); 110 106 111 107 c->cd(2); 112 fLength->DrawC lone()->SetBit(kCanDelete);108 fLength->DrawCopy(); 113 109 114 110 c->cd(3); 115 fDist->DrawC lone()->SetBit(kCanDelete);111 fDist->DrawCopy(); 116 112 117 113 c->cd(4); 118 fWidth->DrawC lone()->SetBit(kCanDelete);114 fWidth->DrawCopy(); 119 115 120 116 c->Modified(); … … 133 129 { 134 130 if (!gPad) 135 { 136 if (!gROOT->GetMakeDefCanvas()) 137 return; 138 (gROOT->GetMakeDefCanvas())(); 139 } 131 MakeDefCanvas("Hillas", "Histograms of Hillas Parameters"); 140 132 141 //TCanvas *c = new TCanvas("Hillas", "Histograms of Hillas Parameters");142 133 gPad->Divide(2,2); 143 134 -
trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.cc
r970 r1004 29 29 #include <TCanvas.h> 30 30 31 #include "MH.h" 32 31 33 ClassImp(MHMcCollectionArea); 32 34 … … 48 50 49 51 50 *fName = name ? name : "MHMcCollectionArea"; 51 *fTitle = title ? title : "Data to Calculate Coll-Area"; 52 53 54 fHistAll = new TH2D("AllEvents", "All showers - Radius vs log(E) distribution", 55 50, 0., 5., 56 50, 0., 500.); 57 58 fHistAll->SetXTitle("log(E/GeV)"); 59 fHistAll->SetYTitle("r/m"); 52 fName = name ? name : "MHMcCollectionArea"; 53 fTitle = title ? title : "Data to Calculate Collection Area"; 54 55 const Int_t nbins = 50; 56 const Float_t maxx = 5; 57 const Float_t maxy = 500; 58 59 Float_t *binsx = new Float_t[nbins+1]; 60 for (int i=0; i<nbins+1; i++) 61 binsx[i] = pow(10, maxx*i/nbins); 62 63 Float_t *binsy = new Float_t[nbins+1]; 64 for (int i=0; i<nbins+1; i++) 65 binsy[i] = maxy*i/nbins; 66 67 fHistAll = new TH2D("AllEvents", "All showers - Radius vs Energy distribution", 68 nbins, binsx, nbins, binsy); 69 fHistSel = new TH2D("SelectedEvents", "Selected showers - Radius vs Energy distribution", 70 nbins, binsx, nbins, binsy); 71 fHistCol = new TH1D("CollectionArea", "Collection Area vs. Energy", 72 nbins, binsx); 73 74 delete binsx; 75 delete binsy; 76 77 fHistAll->SetDirectory(NULL); 78 fHistSel->SetDirectory(NULL); 79 fHistCol->SetDirectory(NULL); 80 81 fHistAll->SetXTitle("E [GeV]"); 82 fHistAll->SetYTitle("r [m]"); 60 83 fHistAll->SetZTitle("N"); 61 84 62 fHistSel = new TH2D("SelectedEvents", "Selected showers - Radius vs log(E) distribution", 63 50, 0., 5., 64 50, 0., 500.); 65 66 fHistSel->SetXTitle("log(E/GeV)"); 67 fHistSel->SetYTitle("r/m"); 85 fHistSel->SetXTitle("E [GeV]"); 86 fHistSel->SetYTitle("r [m]"); 68 87 fHistSel->SetYTitle("N"); 69 88 70 fHistCol = new TH1D("CollectionArea", "Collection Area vs. log(E)", 71 50, 0., 5.); 72 73 fHistCol->SetXTitle("log(E/GeV)"); 74 fHistCol->SetYTitle("A/m^{2}"); 89 fHistCol->SetXTitle("E [GeV]"); 90 fHistCol->SetYTitle("A [m^{2}]"); 75 91 } 76 92 … … 90 106 // Fill data into the histogram which contains all showers 91 107 // 92 void MHMcCollectionArea::FillAll(Float_t log10E, Float_t radius)93 { 94 fHistAll->Fill( log10E, radius);108 void MHMcCollectionArea::FillAll(Float_t energy, Float_t radius) 109 { 110 fHistAll->Fill(energy, radius); 95 111 } 96 112 … … 99 115 // Fill data into the histogram which contains the selected showers 100 116 // 101 void MHMcCollectionArea::FillSel(Float_t log10E, Float_t radius)102 { 103 fHistSel->Fill( log10E, radius);117 void MHMcCollectionArea::FillSel(Float_t energy, Float_t radius) 118 { 119 fHistSel->Fill(energy, radius); 104 120 } 105 121 … … 111 127 { 112 128 if (!gPad) 113 { 114 if (!gROOT->GetMakeDefCanvas()) 115 return; 116 (gROOT->GetMakeDefCanvas())(); 117 } 118 119 //TCanvas *c=new TCanvas(fHistAll->GetName(), fHistAll->GetTitle()); 129 MH::MakeDefCanvas(fHistAll); 120 130 121 131 fHistAll->Draw(option); 132 133 gPad->SetLogx(); 122 134 123 135 gPad->Modified(); … … 132 144 { 133 145 if (!gPad) 134 { 135 if (!gROOT->GetMakeDefCanvas()) 136 return; 137 (gROOT->GetMakeDefCanvas())(); 138 } 139 140 //TCanvas *c=new TCanvas(fHistSel->GetName(), fHistSel->GetTitle()); 146 MH::MakeDefCanvas(fHistSel); 141 147 142 148 fHistSel->Draw(option); 149 150 gPad->SetLogx(); 143 151 144 152 gPad->Modified(); … … 154 162 TObject *MHMcCollectionArea::DrawClone(Option_t* option) const 155 163 { 156 TCanvas *c =new TCanvas(fHistCol->GetName(), fHistCol->GetTitle());164 TCanvas *c = MH::MakeDefCanvas(fHistCol); 157 165 158 166 // … … 161 169 gROOT->SetSelectedPad(NULL); 162 170 163 fHistCol->DrawClone(option); 171 fHistCol->DrawCopy(option); 172 173 gPad->SetLogx(); 164 174 165 175 c->Modified(); … … 172 182 { 173 183 if (!gPad) 174 { 175 if (!gROOT->GetMakeDefCanvas()) 176 return; 177 (gROOT->GetMakeDefCanvas())(); 178 } 179 // TCanvas *c=new TCanvas(fHistCol->GetName(), fHistCol->GetTitle()); 184 MH::MakeDefCanvas(fHistCol); 180 185 181 186 fHistCol->Draw(option); 187 188 gPad->SetLogx(); 182 189 183 190 gPad->Modified(); -
trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.h
r985 r1004 9 9 #endif 10 10 11 // 12 // because of some strange reason this cannot be put into MonteCarloIncl 13 // 14 #ifndef ROOT_TH1 15 #include <TH1.h> 16 #endif 17 11 class TH1D; 18 12 class TH2D; 19 13 … … 31 25 ~MHMcCollectionArea(); 32 26 33 void FillAll(Float_t log10E, Float_t radius);34 void FillSel(Float_t log10E, Float_t radius);27 void FillAll(Float_t energy, Float_t radius); 28 void FillSel(Float_t energy, Float_t radius); 35 29 36 30 void DrawAll(Option_t *option=""); -
trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc
r986 r1004 41 41 #include <TPaveLabel.h> 42 42 43 #include "MH.h" 44 43 45 ClassImp(MHMcEnergy); 44 46 … … 49 51 MHMcEnergy::MHMcEnergy(const char *name, const char *title) 50 52 { 51 *fTitle = title ? title : "Container for an energy distribution histogram";53 fTitle = title ? title : "Container for an energy distribution histogram"; 52 54 53 55 // - we initialize the histogram … … 55 57 // root don't allow us to have diferent histograms with the same name 56 58 57 fHist = new TH1F("", "", 40, 0.5, 4.5); 59 fHist = new TH1F("", "", 20, 0.5, 4.5); 60 61 fHist->SetDirectory(NULL); 58 62 fHist->SetXTitle("log(E/GeV)"); 59 63 fHist->SetYTitle("dN/dE"); … … 77 81 UInt_t idx = semicolon ? atoi(semicolon+1) : 0; 78 82 79 *fName = cname;83 fName = cname; 80 84 81 85 char text[256]; … … 86 90 87 91 char aux[256]; 88 strcpy(aux, " log(E)");92 strcpy(aux, "Threshold"); 89 93 90 94 if (idx>0) … … 163 167 { 164 168 if (!gPad) 165 { 166 if (!gROOT->GetMakeDefCanvas()) 167 return; 168 (gROOT->GetMakeDefCanvas())(); 169 } 170 //TCanvas *c=new TCanvas(fHist->GetName(), fHist->GetTitle()); 169 MH::MakeDefCanvas(fHist); 171 170 172 171 fHist->Draw(option); … … 180 179 TObject *MHMcEnergy::DrawClone(Option_t *option) const 181 180 { 182 TCanvas *c =new TCanvas(fHist->GetName(), fHist->GetTitle());181 TCanvas *c = MH::MakeDefCanvas(fHist); 183 182 184 183 // -
trunk/MagicSoft/Mars/mhist/MHMcRate.cc
r986 r1004 33 33 void MHMcRate::Init(const char *name, const char *title) 34 34 { 35 *fName = name ? name : "MMcTriggerRate";36 *fTitle = title ? title : "Task to calc the collection area ";35 fName = name ? name : "MMcTriggerRate"; 36 fTitle = title ? title : "Task to calc the collection area "; 37 37 38 38 fPartId=0; // Type of particle -
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r970 r1004 35 35 #include "MHStarMap.h" 36 36 37 #include <TH2.h> // TH2F38 37 #include <TStyle.h> // gStyle 39 38 #include <TColor.h> // SetRGB … … 59 58 // 60 59 61 *fName = name ? name : "MHStarMap" ;62 *fTitle = title ? title : "Container for a Star Map" ;60 fName = name ? name : "MHStarMap" ; 61 fTitle = title ? title : "Container for a Star Map" ; 63 62 64 63 // … … 67 66 // connect all the histogram with the container fHist 68 67 // 69 fStarMap = new TH2F("StarMap", " Counts",68 fStarMap = new TH2F("StarMap", "2D Hillas Star Map", 70 69 150, -300, 300, 71 70 150, -300, 300); 71 72 fStarMap->SetDirectory(NULL); 73 74 fStarMap->SetXTitle("x/mm"); 75 fStarMap->SetYTitle("y/mm"); 76 fStarMap->SetZTitle("Counts"); 72 77 } 73 78 … … 171 176 TObject *MHStarMap::DrawClone(Option_t *opt) const 172 177 { 173 TCanvas *c = new TCanvas("Star Map", "Star Map created from Hillas Parameters", 500, 500);178 TCanvas *c=MakeDefCanvas(fStarMap, 500, 500); 174 179 175 180 // … … 180 185 PrepareDrawing(); 181 186 182 fStarMap->DrawC lone("colz")->SetBit(kCanDelete);187 fStarMap->DrawCopy("colz"); 183 188 184 189 c->Modified(); … … 197 202 { 198 203 if (!gPad) 199 { 200 if (!gROOT->GetMakeDefCanvas()) 201 return; 202 (gROOT->GetMakeDefCanvas())(); 203 } 204 205 // TCanvas *c = new TCanvas("Star Map", "Star Map created from Hillas Parameters", 500, 500); 204 MakeDefCanvas(fStarMap, 500, 500); 206 205 207 206 PrepareDrawing(); -
trunk/MagicSoft/Mars/mhist/MHStarMap.h
r970 r1004 11 11 12 12 #ifndef ROOT_TH2 13 // what's the reason that we need this here? cint complains about it14 // if it is missing...15 13 #include <TH2.h> 16 14 #endif
Note:
See TracChangeset
for help on using the changeset viewer.