Changeset 4994 for trunk/MagicSoft/Mars/mhbase
- Timestamp:
- 09/14/04 13:37:28 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhbase/MH.cc
r4991 r4994 1181 1181 const Int_t size = array.GetSize(); 1182 1182 1183 TH1I *h1=0;1184 1185 //check if histogram with identical name exist1186 TObject *h1obj = gROOT->FindObject(name);1187 if (h1obj && h1obj->InheritsFrom("TH1I"))1188 {1189 h1 = (TH1I*)h1obj;1190 h1->Reset();1191 }1192 1193 1183 Double_t min = size>0 ? array[0] : 0; 1194 1184 Double_t max = size>0 ? array[0] : 1; … … 1203 1193 Int_t newbins = 0; 1204 1194 FindGoodLimits(nbins, newbins, min, max, kFALSE); 1205 1206 if (!h1) 1207 { 1208 h1 = new TH1I(name, title, nbins, min, max); 1209 h1->SetXTitle(""); 1210 h1->SetYTitle("Counts"); 1211 h1->SetDirectory(gROOT); 1212 } 1195 1196 TH1I *h1 = new TH1I(name, title, nbins, min, max); 1197 h1->SetXTitle(""); 1198 h1->SetYTitle("Counts"); 1199 h1->SetDirectory(NULL); 1213 1200 1214 1201 // Second loop to fill the histogram … … 1226 1213 { 1227 1214 const Int_t size = array.GetSize(); 1228 TH1I *h1=0;1229 1230 //check if histogram with identical name exist1231 TObject *h1obj = gROOT->FindObject(name);1232 if (h1obj && h1obj->InheritsFrom("TH1I"))1233 {1234 h1 = (TH1I*)h1obj;1235 h1->Reset();1236 }1237 1215 1238 1216 Double_t min = size>0 ? array[0] : 0; … … 1249 1227 FindGoodLimits(nbins, newbins, min, max, kFALSE); 1250 1228 1251 if (!h1) 1252 { 1253 h1 = new TH1I(name, title, newbins, min, max); 1254 h1->SetXTitle(""); 1255 h1->SetYTitle("Counts"); 1256 h1->SetDirectory(gROOT); 1257 } 1229 TH1I *h1 = new TH1I(name, title, newbins, min, max); 1230 h1->SetXTitle(""); 1231 h1->SetYTitle("Counts"); 1232 h1->SetDirectory(NULL); 1258 1233 1259 1234 // Second loop to fill the histogram
Note:
See TracChangeset
for help on using the changeset viewer.