Changeset 1934 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 04/09/03 20:10:16 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.cc
r1920 r1934 16 16 ! 17 17 ! 18 ! Author(s): Nicola Galante 2003 <mailto:nicola.galante@pi.infn.it>19 ! !20 ! Copyright: MAGIC Software Development, 2000-200 218 ! Author(s): Nicola Galante, 2003 <mailto:nicola.galante@pi.infn.it> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2003 21 21 ! 22 22 ! … … 51 51 #include "MBinning.h" 52 52 53 /* 54 Please, DON'T USE IFDEFS IN SUCH A CONTEXT, Thomas. 55 -------------------------------------------------- 53 56 #ifndef COLOR_LINELPS 54 57 #define COLOR_LINELPS Int_t colorlps = 1 … … 65 68 COLOR_LINEPS; 66 69 #endif 70 */ 71 72 /* Use this insteadif you want to have some value which is the same for all 73 your instances of MHMcTriggerLvl2, if not define the values in the constructor 74 and remove the 'static' 75 */ 76 77 Int_t MHMcTriggerLvl2::fColorLps = 1; 78 Int_t MHMcTriggerLvl2::fColorSbc = 1; 79 Int_t MHMcTriggerLvl2::fColorPs = 1; 67 80 68 81 ClassImp(MHMcTriggerLvl2); … … 145 158 // This method is called by the DrawClone method. 146 159 // 147 TObject *MHMcTriggerLvl2::DrawHist(TH1 *hist, TH1 *histNorm, const char *canvasname, Int_t *colore) const 148 { 149 ++(*colore); 150 151 if((gROOT->FindObject(canvasname) != NULL)){ 152 hist->SetLineColor(*colore); 153 ((TCanvas *)gROOT->FindObject(canvasname))->cd(1); 154 hist->DrawCopy("same"); 155 156 ((TCanvas *)gROOT->FindObject(canvasname))->cd(2); 157 histNorm->SetLineColor(*colore); 158 histNorm->DrawCopy("same"); 159 ((TCanvas *)gROOT->FindObject(canvasname))->cd(2); 160 return gROOT->FindObject(canvasname); 161 } 162 else{ 163 TCanvas *c3 = MakeDefCanvas(canvasname,canvasname, 800, 610); 164 c3->Divide(2,1); 165 c3->cd(1); 166 hist->SetLineColor(*colore); 167 hist->DrawCopy(); 168 169 c3->cd(2); 170 histNorm->SetLineColor(*colore); 171 histNorm->DrawCopy(); 172 173 return c3; 174 } 175 } 176 160 TObject *MHMcTriggerLvl2::DrawHist(TH1 &hist, TH1 &histNorm, const TString &canvasname, Int_t &col) const 161 { 162 col++; 163 164 TCanvas *c = (TCanvas*)gROOT->FindObject(canvasname); 165 166 Bool_t same = kTRUE; 167 if (!c) 168 { 169 c = MakeDefCanvas(canvasname,canvasname, 800, 610); 170 c->Divide(2,1); 171 same = kFALSE; 172 } 173 174 c->cd(1); 175 hist.SetLineColor(col); 176 hist.DrawCopy(same?"same":""); 177 178 c->cd(2); 179 histNorm.SetLineColor(col); 180 histNorm.DrawCopy(same?"same":""); 181 182 return c; 183 } 184 177 185 178 186 // -------------------------------------------------------------------------- … … 191 199 TObject *MHMcTriggerLvl2::DrawClone(Option_t *opt) const 192 200 { 193 TString *def = new TString("ps"); 194 TString str(opt); 195 196 if(*opt == NULL) str = *def; // Default option 197 198 if (str.Contains("lps",TString::kIgnoreCase)) 199 return this->DrawHist(hfLutPseudoSize,this->NormalizeHist(hfLutPseudoSizeNorm,hfLutPseudoSize),"CanvasLPS",&colorlps); 200 else if (str.Contains("sbc",TString::kIgnoreCase)) 201 return this->DrawHist(hfSizeBiggerCell,this->NormalizeHist(hfSizeBiggerCellNorm,hfSizeBiggerCell),"CanvasSBC",&colorsbc); 202 else if (str.Contains("ps",TString::kIgnoreCase)) 203 return this->DrawHist(hfPseudoSize,this->NormalizeHist(hfPseudoSizeNorm,hfPseudoSize),"CanvasPS",&colorps); 204 else{ 205 *fLog << "ARGH!@! Possible options are \"lps\", \"sbc\", \"ps\" or NULL!" <<endl; 201 TString str(opt); 202 203 if (str.IsNull()) 204 str = "ps"; 205 206 if (!str.Contains("lps", TString::kIgnoreCase) && 207 !str.Contains("sbc", TString::kIgnoreCase) && 208 !str.Contains("ps", TString::kIgnoreCase)) 209 { 210 *fLog << "ARGH!@! Possible options are \"lps\", \"sbc\", \"ps\" or NULL!" <<endl; 211 return NULL; 212 } 213 214 TH1 *hist=NormalizeHist(hfLutPseudoSizeNorm, hfLutPseudoSize); 215 216 if (!hist) 217 return NULL; 218 219 if (str.Contains("lps",TString::kIgnoreCase)) 220 return DrawHist(*hfLutPseudoSize, *hist, "CanvasLPS", fColorLps); 221 222 if (str.Contains("sbc",TString::kIgnoreCase)) 223 return DrawHist(*hfSizeBiggerCell, *hist, "CanvasSBC", fColorSbc); 224 225 if (str.Contains("ps",TString::kIgnoreCase)) 226 return DrawHist(*hfPseudoSize, *hist, "CanvasPS", fColorPs); 227 206 228 return NULL; 207 }208 209 229 } 210 230 -
trunk/MagicSoft/Mars/mhist/MHMcTriggerLvl2.h
r1920 r1934 25 25 26 26 TF1* f1; // Function used to normalize histograms 27 28 static Int_t fColorLps; 29 static Int_t fColorSbc; 30 static Int_t fColorPs; 27 31 28 32 public: … … 50 54 private: 51 55 52 TObject *DrawHist(TH1 *hist, TH1 *histNorm, const char *canvasname, Int_t *colore) const;56 TObject *DrawHist(TH1 &hist, TH1 &histNorm, const TString &canvasname, Int_t &colore) const; 53 57 54 58 };
Note:
See TracChangeset
for help on using the changeset viewer.