Changeset 5007
- Timestamp:
- 09/14/04 17:00:14 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r5003 r5007 32 32 33 33 2004/09/14: Markus Gaug 34 35 * mhcalib/MHGausEvents.cc 36 - some changes in Draw for the case that there is no histogram 34 37 35 38 * manalysis/MHPedestalPix.[h,cc] -
trunk/MagicSoft/Mars/mhbase/MH.cc
r5003 r5007 1181 1181 const Int_t size = array.GetSize(); 1182 1182 1183 TH1I *h1=0; 1184 1185 //check if histogram with identical name exist 1186 TObject *h1obj = gROOT->FindObject(name); 1187 if (h1obj && h1obj->InheritsFrom("TH1I")) 1188 { 1189 h1 = (TH1I*)h1obj; 1190 h1->Reset(); 1191 } 1192 1183 1193 Double_t min = size>0 ? array[0] : 0; 1184 1194 Double_t max = size>0 ? array[0] : 1; … … 1193 1203 Int_t newbins = 0; 1194 1204 FindGoodLimits(nbins, newbins, min, max, kFALSE); 1195 1196 TH1I *h1 = new TH1I(name, title, nbins, min, max); 1197 h1->SetXTitle(""); 1198 h1->SetYTitle("Counts"); 1199 h1->SetDirectory(NULL); 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 } 1200 1213 1201 1214 // Second loop to fill the histogram … … 1217 1230 Double_t max = size>0 ? array[0] : 1; 1218 1231 1232 TH1I *h1=0; 1233 1234 //check if histogram with identical name exist 1235 TObject *h1obj = gROOT->FindObject(name); 1236 if (h1obj && h1obj->InheritsFrom("TH1I")) 1237 { 1238 h1 = (TH1I*)h1obj; 1239 h1->Reset(); 1240 } 1241 1219 1242 // first loop over array to find the min and max 1220 1243 for (Int_t i=1; i<size;i++) … … 1227 1250 FindGoodLimits(nbins, newbins, min, max, kFALSE); 1228 1251 1229 TH1I *h1 = new TH1I(name, title, newbins, min, max); 1230 h1->SetXTitle(""); 1231 h1->SetYTitle("Counts"); 1232 h1->SetDirectory(NULL); 1233 1252 if (!h1) 1253 { 1254 h1 = new TH1I(name, title, newbins, min, max); 1255 h1->SetXTitle(""); 1256 h1->SetYTitle("Counts"); 1257 h1->SetDirectory(gROOT); 1258 } 1259 1234 1260 // Second loop to fill the histogram 1235 1261 for (Int_t i=0;i<size;i++) … … 1246 1272 const char* name, const char* title) 1247 1273 { 1248 const TArrayF arr(array.GetSize(), array.GetArray()); 1249 return ProjectArray(arr, nbins, name, title); 1274 return ProjectArray(TArrayF(array.GetSize(),array.GetArray()), nbins, name, title); 1250 1275 } 1251 1276 … … 1256 1281 TH1I* MH::ProjectArray(const MArrayD &array, Int_t nbins, const char* name, const char* title) 1257 1282 { 1258 const TArrayD arr(array.GetSize(), array.GetArray()); 1259 return ProjectArray(arr, nbins, name, title); 1283 return ProjectArray(TArrayD(array.GetSize(),array.GetArray()), nbins, name, title); 1260 1284 } 1261 1285 -
trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc
r4994 r5007 386 386 fPowerSpectrum = fourier.PowerSpectrumDensity(&fEvents); 387 387 fHPowerProbability = ProjectArray(*fPowerSpectrum, fPowerProbabilityBins, 388 Form("%s%s","PowerProb ability",GetName()),388 Form("%s%s","PowerProb",GetName()), 389 389 "Probability of Power occurrance"); 390 390 fHPowerProbability->SetXTitle("P(f)"); … … 521 521 522 522 if (option.Contains("events")) 523 { 524 option.ReplaceAll("events",""); 525 win += 1; 526 } 523 win += 1; 527 524 if (option.Contains("fourier")) 528 { 529 option.ReplaceAll("fourier",""); 530 win += 2; 531 } 532 525 win += 2; 526 if (IsEmpty()) 527 win--; 528 533 529 pad->SetBorderMode(0); 534 530 pad->Divide(1,win); 535 pad->cd(1); 536 537 if (!IsEmpty() && !IsOnlyOverflow() && !IsOnlyUnderflow()) 538 gPad->SetLogy(); 531 532 Int_t cwin = 1; 539 533 540 534 gPad->SetTicks(); 541 535 542 fHGausHist.Draw(option); 543 544 if (fFGausFit) 545 { 546 fFGausFit->SetLineColor(IsGausFitOK() ? kGreen : kRed); 547 fFGausFit->Draw("same"); 548 } 549 switch (win) 550 { 551 case 2: 552 pad->cd(2); 536 if (!IsEmpty()) 537 { 538 pad->cd(cwin++); 539 540 if (!IsOnlyOverflow() && !IsOnlyUnderflow()) 541 gPad->SetLogy(); 542 543 fHGausHist.Draw(option); 544 545 if (fFGausFit) 546 { 547 fFGausFit->SetLineColor(IsGausFitOK() ? kGreen : kRed); 548 fFGausFit->Draw("same"); 549 } 550 } 551 552 if (option.Contains("events")) 553 { 554 pad->cd(cwin++); 553 555 DrawEvents(); 554 break; 555 case 3: 556 pad->cd(2); 557 DrawPowerSpectrum(*pad,3); 558 break; 559 case 4: 560 pad->cd(2); 561 DrawEvents(); 562 pad->cd(3); 563 DrawPowerSpectrum(*pad,4); 564 break; 556 } 557 if (option.Contains("fourier")) 558 { 559 pad->cd(cwin++); 560 DrawPowerSpectrum(*pad,cwin); 565 561 } 566 562 }
Note:
See TracChangeset
for help on using the changeset viewer.