Changeset 891 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 07/20/01 16:44:11 (24 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc
r867 r891 33 33 #include "MHMcEnergy.h" 34 34 35 #include <stdlib.h> 35 36 #include <iostream.h> 36 37 … … 46 47 // Default Constructor. 47 48 // 48 MHMcEnergy::MHMcEnergy(const UInt_t idx, constchar *name, const char *title)49 MHMcEnergy::MHMcEnergy(const char *name, const char *title) 49 50 { 50 char aux[15]="MHMcEnergy"; 51 52 if (idx>0) 53 sprintf(aux+strlen(aux), ";%i", idx); 54 55 *fName = name ? name : aux; 56 *fTitle = title ? title : "Container for an energy distribution histogram" ; 51 *fTitle = title ? title : "Container for an energy distribution histogram"; 57 52 58 53 // - we initialize the histogram … … 60 55 // root don't allow us to have diferent histograms with the same name 61 56 57 fHist = new TH1F("", "", 40, 0.5, 4.5); 58 fHist->SetXTitle("log(E/GeV)"); 59 fHist->SetYTitle("dN/dE"); 60 61 SetName(name ? name : "MHMcEnergy"); 62 } 63 64 // ------------------------------------------------------------------------- 65 // 66 // This doesn't only set the name. It tries to get the number from the 67 // name and creates also name and title of the histogram. 68 // 69 // This is necessary for example if a list of such MHMcEnergy histograms 70 // is created (s. MParList::CreateObjList) 71 // 72 void MHMcEnergy::SetName(const char *name) 73 { 74 TString cname(name); 75 const char *semicolon = strrchr(cname, ';'); 76 77 UInt_t idx = semicolon ? atoi(semicolon+1) : 0; 78 79 *fName = cname; 80 62 81 char text[256]; 63 sprintf(text, "Energy Distribution for trigger condition #%i", idx); 64 82 if (idx>0) 83 sprintf(text, "Energy Distribution for trigger condition #%i", idx); 84 else 85 sprintf(text, "Energy Distribution"); 86 87 char aux[256]; 65 88 strcpy(aux, "log(E)"); 89 66 90 if (idx>0) 67 91 sprintf(aux+strlen(aux), " #%i", idx); 68 fHist = new TH1F(aux, text, 40, 0.5, 4.5); 69 fHist->Set XTitle("log(E/GeV)");70 fHist->Set YTitle("dN/dE");92 93 fHist->SetName(aux); 94 fHist->SetTitle(text); 71 95 } 72 96 -
trunk/MagicSoft/Mars/mhist/MHMcEnergy.h
r867 r891 31 31 public: 32 32 33 MHMcEnergy(const UInt_t idx=0, constchar *name=NULL, const char *title=NULL);33 MHMcEnergy(const char *name=NULL, const char *title=NULL); 34 34 ~MHMcEnergy(); 35 36 void SetName(const char *name); 35 37 36 38 Float_t GetThreshold() const { return fThreshold; }
Note:
See TracChangeset
for help on using the changeset viewer.