- Timestamp:
- 07/06/03 21:02:56 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2264 r2265 30 30 * macros/pixsatrate.C: 31 31 - added 32 33 * Makefile.conf.general: 34 - added -lHistPainter 35 36 * NEWS: 37 - updated 38 39 * macros/pixsatrate.C: 40 - added Saturation rate of lo gains 41 42 * macros/sumevents.C, macros/sumeventserr.C, 43 macros/sumpedestalrms.C, macros/sumpedestals.C: 44 - fixed axis titles 45 - use new SetOptStat 46 47 * manalysis/MCerPhotAnal2.[h,cc]: 48 - count and print number of skipped events 49 50 * meventdisp/MGCamDisplay.cc: 51 - fixed a 'division by zero' 52 53 * mhist/MHCamEvent.cc, mhist/MHTriggerLvl0.cc: 54 - take name from MHCamEvent if fNameEvt not available 55 56 * mhist/MHCamera.[h,cc]: 57 - use THistPainter to Draw title and statistics box 58 - added fOptStat 59 - added GetMean 60 - added GetRMS 61 - some modification for a better layout 62 63 * mraw/MRawEvtHeader.cc: 64 - calculate time from clock ticks 32 65 33 66 -
trunk/MagicSoft/Mars/Makefile.conf.general
r2054 r2265 4 4 5 5 ROOTVER = `root-config --version` 6 ROOTLIBS = `root-config --libs` -lMinuit 7 ROOTGLIBS = `root-config --glibs` -lMinuit 6 ROOTLIBS = `root-config --libs` -lMinuit -lHistPainter 7 ROOTGLIBS = `root-config --glibs` -lMinuit -lHistPainter 8 8 ROOTCFLAGS = `root-config --cflags` 9 9 -
trunk/MagicSoft/Mars/NEWS
r2176 r2265 78 78 79 79 - logarithmic scale in camera 80 81 - added class to iterate through directory contents (MDirIter) 80 82 81 83 -
trunk/MagicSoft/Mars/macros/pixsatrate.C
r2264 r2265 76 76 tlist.AddToList(&read); 77 77 78 MHTriggerLvl0 trigmap(254, "Saturation", "Saturation"); 79 trigmap.SetType(1); 78 MHTriggerLvl0 trighi(254, "SaturationHi", "Saturation Rate of Hi Gains"); 79 MHTriggerLvl0 triglo(254, "SaturationLo", "Saturation Rate of Lo Gains"); 80 trighi.SetType(1); 81 triglo.SetType(2); 80 82 81 MFillH fillh(trigmap, "MRawEvtData"); 82 plist.AddToList(&trigmap); 83 tlist.AddToList(&fillh); 83 MFillH fillhi(&trighi, "MRawEvtData"); 84 MFillH filllo(&triglo, "MRawEvtData"); 85 tlist.AddToList(&fillhi); 86 tlist.AddToList(&filllo); 84 87 85 88 MEvtLoop evtloop; -
trunk/MagicSoft/Mars/macros/sumevents.C
r2244 r2265 86 86 disp3->SetCamContent(*disp0, 2); 87 87 88 disp2->SetStats(kFALSE); 89 disp3->SetStats(kFALSE); 88 disp1->SetYTitle("S [au]"); 89 disp2->SetYTitle("\\sigma_{S} [au]"); 90 disp3->SetYTitle("\\sigma_{S} [%]"); 90 91 91 disp1->SetYTitle("a.u."); 92 disp2->SetYTitle("err"); 93 disp3->SetYTitle("rel.err [%]"); 92 disp1->SetOptStat(1111); 93 disp2->SetOptStat(1101); 94 disp3->SetOptStat(1101); 95 96 c->cd(1); 97 disp1->Draw("hist"); 98 99 c->cd(2); 100 gPad->SetLogy(); 101 disp2->Draw("hist"); 102 103 c->cd(3); 104 gPad->SetLogy(); 105 disp3->Draw("hist"); 94 106 95 107 c->cd(4); … … 114 126 disp3->Draw(); 115 127 116 c->cd(1);117 disp1->Draw("hist");118 119 c->cd(2);120 gPad->SetLogy();121 disp2->Draw("hist");122 123 c->cd(3);124 gPad->SetLogy();125 disp3->Draw("hist");126 127 128 c->SaveAs(fname(0, fname.Last('.')+1) + "ps"); 128 129 //c->SaveAs(fname(0, fname.Last('.')+1) + "root"); … … 138 139 { 139 140 MDirIter Next; 140 Next.AddDirectory(dirname, " raw*.root", -1);141 Next.AddDirectory(dirname, "*1947*.root", -1); 141 142 142 143 TString fname; -
trunk/MagicSoft/Mars/macros/sumeventserr.C
r2252 r2265 48 48 read.DisableAutoScheme(); 49 49 50 MPedestalSum ncalc;50 //MPedestalSum ncalc; 51 51 //MCerPhotCalc ncalc; 52 52 //MCerPhotAnal ncalc; 53 //MCerPhotAnal2 ncalc;53 MCerPhotAnal2 ncalc; 54 54 55 55 tlist.AddToList(&read); … … 89 89 disp3->SetCamContent(*disp0, 2); 90 90 91 disp2->SetStats(kFALSE); 92 disp3->SetStats(kFALSE); 91 disp1->SetYTitle("S_{err} [au]"); 92 disp2->SetYTitle("\\sigma_{S_{err}} [au]"); 93 disp3->SetYTitle("\\sigma_{S_{err}} [%]"); 93 94 94 disp1->Set YTitle("a.u.");95 disp2->Set YTitle("err");96 disp3->Set YTitle("rel.err [%]");95 disp1->SetOptStat(1111); 96 disp2->SetOptStat(1101); 97 disp3->SetOptStat(1101); 97 98 98 99 c->cd(4); … … 138 139 // This macro shows how to fill and display a histogram using Mars 139 140 // 140 void sumevents (const char *dirname=".")141 void sumeventserr(const char *dirname=".") 141 142 { 142 143 MDirIter Next; 143 Next.AddDirectory(dirname, "* ped*.root", -1);144 Next.AddDirectory(dirname, "*1947*.root", -1); 144 145 145 146 TString fname; -
trunk/MagicSoft/Mars/macros/sumpedestalrms.C
r2252 r2265 90 90 disp3->SetCamContent(*disp0, 2); 91 91 92 disp2->SetStats(kFALSE); 93 disp3->SetStats(kFALSE); 92 disp1->SetYTitle("P_{rms} [au]"); 93 disp2->SetYTitle("\\sigma_{P_{rms}} [au]"); 94 disp3->SetYTitle("\\sigma_{P_{rms}} [%]"); 94 95 95 disp1->Set XTitle("a.u.");96 disp2->Set XTitle("err");97 disp3->Set XTitle("rel.err [%]");96 disp1->SetOptStat(1111); 97 disp2->SetOptStat(1101); 98 disp3->SetOptStat(1101); 98 99 100 c->cd(1); 101 disp1->Draw("hist"); 102 103 c->cd(2); 104 disp2->Draw("hist"); 105 106 c->cd(3); 107 disp3->Draw("hist"); 108 99 109 c->cd(4); 100 110 gPad->SetBorderMode(0); … … 118 128 disp3->Draw(); 119 129 120 c->cd(1);121 disp1->Draw("hist");122 123 c->cd(2);124 disp2->Draw("hist");125 126 c->cd(3);127 disp3->Draw("hist");128 129 130 c->SaveAs(fname(0, fname.Last('.')+1) + "ps"); 130 131 //c->SaveAs(fname(0, fname.Last('.')+1) + "root"); … … 140 141 { 141 142 MDirIter Next; 142 Next.AddDirectory(dirname, " raw*.root", -1);143 Next.AddDirectory(dirname, "*1947*.root", -1); 143 144 144 145 TString fname; -
trunk/MagicSoft/Mars/macros/sumpedestals.C
r2244 r2265 86 86 disp3->SetCamContent(*disp0, 2); 87 87 88 disp2->SetStats(kFALSE); 89 disp3->SetStats(kFALSE); 88 disp1->SetYTitle("P [au]"); 89 disp2->SetYTitle("\\sigma_{P} [au]"); 90 disp3->SetYTitle("\\sigma_{P} [%]"); 90 91 91 disp1->SetXTitle("a.u."); 92 disp2->SetXTitle("err"); 93 disp3->SetXTitle("rel.err [%]"); 92 disp1->SetOptStat(1111); 93 disp2->SetOptStat(1101); 94 disp3->SetOptStat(1101); 95 96 c->cd(1); 97 disp1->Draw("hist"); 98 99 c->cd(2); 100 disp2->Draw("hist"); 101 102 c->cd(3); 103 disp3->Draw("hist"); 94 104 95 105 c->cd(4); … … 114 124 disp3->Draw(); 115 125 116 c->cd(1);117 disp1->Draw("hist");118 119 c->cd(2);120 disp2->Draw("hist");121 122 c->cd(3);123 disp3->Draw("hist");124 125 126 c->SaveAs(fname(0, fname.Last('.')+1) + "ps"); 126 127 //c->SaveAs(fname(0, fname.Last('.')+1) + "root"); … … 136 137 { 137 138 MDirIter Next; 138 Next.AddDirectory(dirname, " raw*.root", -1);139 Next.AddDirectory(dirname, "*1947*.root", -1); 139 140 140 141 TString fname; -
trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.cc
r2259 r2265 86 86 Int_t MCerPhotAnal2::PreProcess(MParList *pList) 87 87 { 88 fSkip = 0; 89 88 90 fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader"); 89 91 if (!fRunHeader) … … 149 151 if (ptr[i]==255) 150 152 sat++; 153 151 154 //if (sat>1) 152 155 // continue; … … 184 187 { 185 188 if (ptr[i]>250) 189 { 190 fSkip++; 186 191 return kCONTINUE; 192 } 187 193 if (i<max-fBefore || i>max+fAfter) 188 194 { … … 237 243 } 238 244 245 Int_t MCerPhotAnal2::PostProcess() 246 { 247 if (GetNumExecutions()==0 || fSkip==0) 248 return kTRUE; 249 250 *fLog << inf << endl; 251 *fLog << GetDescriptor() << " execution statistics:" << endl; 252 *fLog << dec << setfill(' '); 253 *fLog << " " << setw(7) << fSkip << " (" << setw(3) << (int)(fSkip*100/GetNumExecutions()) << "%) Evts skipped due to: lo gain saturated." << endl; 254 255 return kTRUE; 256 } -
trunk/MagicSoft/Mars/manalysis/MCerPhotAnal2.h
r2251 r2265 22 22 class MCerPhotAnal2 : public MTask 23 23 { 24 private: 24 25 MPedestalCam *fPedestals; // Pedestals of all pixels in the camera 25 26 MRawEvtData *fRawEvt; // raw event data (time slices) … … 30 31 Byte_t fAfter; 31 32 32 public: 33 MCerPhotAnal2(Byte_t b=2, Byte_t a=5, const char *name=NULL, const char *title=NULL); 33 Int_t fSkip; //! 34 34 35 35 Int_t PreProcess(MParList *pList); 36 36 Int_t Process(); 37 Int_t PostProcess(); 38 39 public: 40 MCerPhotAnal2(Byte_t b=2, Byte_t a=5, const char *name=NULL, const char *title=NULL); 37 41 38 42 ClassDef(MCerPhotAnal2, 0) // Task to calculate cerenkov photons from raw data -
trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
r2237 r2265 259 259 continue; 260 260 MPedestalPix &ppix = (*ped)[i]; 261 if (ppix.GetPedestalRms()< 0)261 if (ppix.GetPedestalRms()<=0) 262 262 continue; 263 263 val[i] = pix->GetNumPhotons()/ppix.GetPedestalRms(); -
trunk/MagicSoft/Mars/mhist/MHCamEvent.cc
r2244 r2265 99 99 if (fSum) 100 100 delete (fSum); 101 fSum = new MHCamera(*cam, fNameEvt+";avg", fTitle); 101 102 const TString name = fNameEvt.IsNull() ? fName : fNameEvt; 103 104 fSum = new MHCamera(*cam, name+";avg", fTitle); 102 105 fSum->SetYTitle("a.u."); 103 106 -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r2264 r2265 47 47 #include <TRandom.h> 48 48 #include <TPaveText.h> 49 #include <TPaveStats.h> 49 50 #include <TClonesArray.h> 51 #include <THistPainter.h> 52 53 #include "MLog.h" 54 #include "MLogManip.h" 50 55 51 56 #include "MH.h" … … 76 81 // Default Constructor. To be used by the root system ONLY. 77 82 // 78 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend) 83 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend), fOptStat(-1) 79 84 { 80 85 SetDirectory(NULL); … … 215 220 fTsumwx2 += z*x*x; 216 221 return bin; 222 } 223 224 Stat_t MHCamera::GetMean(Int_t axis) const 225 { 226 Stat_t mean = 0; 227 for (int i=1; i<fNcells-1; i++) 228 mean += fArray[i]; 229 230 return mean/(fNcells-2); 231 } 232 233 Stat_t MHCamera::GetRMS(Int_t axis) const 234 { 235 const Int_t n = fNcells-2; 236 237 Stat_t sum = 0; 238 Stat_t sq = 0; 239 for (int i=1; i<n+1; i++) 240 { 241 sum += fArray[i]; 242 sq += fArray[i]*fArray[i]; 243 } 244 245 sum /= n; 246 sq /= n; 247 248 return sqrt(sq-sum*sum); 217 249 } 218 250 … … 314 346 void MHCamera::SetRange() 315 347 { 316 const Float_t range = fGeomCam->GetMaxRadius() ;348 const Float_t range = fGeomCam->GetMaxRadius()*1.05; 317 349 318 350 // … … 373 405 { 374 406 if (IsUsed(i) && iscol) 407 { 408 if (TMath::IsNaN(fArray[i+1])) 409 gLog << warn << "MHCamera::Update: " << GetName() << " <" << GetTitle() << "> - Pixel Index #" << i << " contents is NaN (Not a Number)..." << endl; 410 375 411 hex.SetFillColor(GetColor(fArray[i+1], min, max, islog)); 412 } 376 413 else 377 414 hex.SetFillColor(10); … … 381 418 hex.PaintHexagon(pix.GetX(), pix.GetY(), pix.GetD()); 382 419 else 383 if (IsUsed(i) )420 if (IsUsed(i) && !TMath::IsNaN(fArray[i+1])) 384 421 { 385 422 Float_t size = pix.GetD()*(fArray[i+1]-min)/(max-min); … … 413 450 void MHCamera::PaintAxisTitle() 414 451 { 415 Float_t fRange = fGeomCam->GetMaxRadius(); 416 417 TLatex *ptitle = new TLatex(1.2*fRange, .97*fRange, GetYaxis()->GetTitle()); 418 419 ptitle->SetTextSize(0.03); 420 ptitle->SetTextAlign(33); 452 const Float_t range = fGeomCam->GetMaxRadius()*1.05; 453 const Float_t w = (1 + 1.5/sqrt((float)(fNcells-2)))*range; 454 455 TLatex *ptitle = new TLatex(w, -.90*range, GetYaxis()->GetTitle()); 456 457 ptitle->SetTextSize(0.05); 458 ptitle->SetTextAlign(21); 421 459 422 460 // box with the histogram title … … 430 468 // ------------------------------------------------------------------------ 431 469 // 432 // Paint the histogram title433 //434 void MHCamera::PaintTitle()435 {436 // *-*-*-*-*-*-*-*-*-*Draw the histogram title*-*-*-*-*-*-*-*-*-*-*-*-*437 // ========================438 //if (Hoption.Same) return;439 #if ROOT_VERSION_CODE > ROOT_VERSION(3,05,00)440 if (TestBit(kNoTitle))441 return;442 #endif443 444 const Int_t nt = strlen(GetTitle());445 446 TPaveText *title = (TPaveText*)gPad->FindObject("title");447 if (nt == 0 || gStyle->GetOptTitle() <= 0)448 {449 if (title)450 delete title;451 return;452 }453 454 Double_t ht = gStyle->GetTitleH();455 Double_t wt = gStyle->GetTitleW();456 457 if (ht <= 0)458 ht = 0.05;459 if (wt <= 0)460 {461 TLatex l;462 l.SetTextSize(ht);463 l.SetTitle(GetTitle());464 Double_t wndc = l.GetXsize()/(gPad->GetX2() - gPad->GetX1());465 wt = TMath::Min(0.7, 0.02+wndc);466 }467 if (title)468 {469 TText *t0 = (TText*)title->GetLine(0);470 if (t0)471 {472 if (!strcmp(t0->GetTitle(), GetTitle()))473 return;474 475 t0->SetTitle(GetTitle());476 if (wt > 0)477 title->SetX2NDC(title->GetX1NDC()+wt);478 }479 return;480 }481 482 TPaveText *ptitle = new TPaveText(483 gStyle->GetTitleX(),484 gStyle->GetTitleY()-ht,485 gStyle->GetTitleX()+wt,486 gStyle->GetTitleY(),"blNDC");487 488 // box with the histogram title489 #if ROOT_VERSION_CODE > ROOT_VERSION(3,05,01)490 ptitle->SetFillColor(gStyle->GetTitleFillColor());491 ptitle->SetTextFont(gStyle->GetTitleFont(""));492 if (gStyle->GetTitleFont("")%10 > 2)493 ptitle->SetTextSize(gStyle->GetTitleFontSize());494 #endif495 ptitle->SetFillStyle(gStyle->GetTitleStyle());496 ptitle->SetName("title");497 ptitle->SetBorderSize(gStyle->GetTitleBorderSize());498 ptitle->SetTextColor(gStyle->GetTitleTextColor());499 ptitle->AddText(GetTitle());500 ptitle->SetBit(kCanDelete);501 ptitle->Draw();502 ptitle->Paint();503 }504 505 // ------------------------------------------------------------------------506 //507 470 // Paints the camera. 508 471 // … … 515 478 { 516 479 opt.ReplaceAll("hist", ""); 517 518 480 Int_t mode = gStyle->GetOptStat(); 519 481 TVirtualPad *save = gPad; 520 482 gPad=NULL; 521 gStyle->SetOptStat( 1000011);483 gStyle->SetOptStat(fOptStat<0 ? mode : fOptStat); 522 484 gPad=save; 523 485 TH1D::Paint(o); … … 534 496 Bool_t iscol = isbox ? !opt.Contains("nocol") : 1; 535 497 498 THistPainter paint; 499 if (!TestBit(TH1::kNoStats)) 500 { 501 paint.SetHistogram(this); 502 paint.PaintStat(fOptStat<0?gStyle->GetOptStat():fOptStat, NULL); 503 } 504 536 505 // Update Contents of the pixels and paint legend 537 506 Update(gPad->GetLogy(), isbox, iscol); 538 507 539 508 // Paint primitives (pixels, color legend, photons, ...) 540 PaintTitle();509 paint.PaintTitle(); 541 510 PaintAxisTitle(); 542 511 } … … 619 588 const MGeomPix &h = (*fGeomCam)[i]; 620 589 TText *nt = txt.DrawText(h.GetX(), h.GetY(), num); 621 nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius() );590 nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05); 622 591 } 623 592 } … … 642 611 const MGeomPix &h = (*fGeomCam)[i]; 643 612 TText *nt = txt.DrawText(h.GetX(), h.GetY(), num); 644 nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius() );613 nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05); 645 614 } 646 615 } … … 848 817 { 849 818 if (TMath::IsNaN(val)) // FIXME: gLog! 850 { 851 cout << "MHCamera::GetColor: " << GetName() << " <" << GetTitle() << "> - Color for val=NaN (Not a Number) requested... set val=min." << endl; 852 val = min; 853 } 819 return 10; 854 820 855 821 // … … 877 843 } 878 844 845 TPaveStats *MHCamera::GetStats() 846 { 847 TObject *obj = 0; 848 849 TIter Next(fFunctions); 850 while ((obj = Next())) 851 if (obj->InheritsFrom(TPaveStats::Class())) 852 return static_cast<TPaveStats*>(obj); 853 854 return NULL; 855 } 856 879 857 // ------------------------------------------------------------------------ 880 858 // … … 883 861 void MHCamera::UpdateLegend(Float_t min, Float_t max, Bool_t islog) 884 862 { 885 const Float_t range = fGeomCam->GetMaxRadius(); 886 887 const Float_t H = 0.9*range; 863 TPaveStats *stats = GetStats(); 864 865 const Float_t hndc = 0.92 - (stats ? stats->GetY1NDC() : 1); 866 const Float_t range = fGeomCam->GetMaxRadius()*1.05; 867 const Float_t H = (0.75-hndc)*range; 868 const Float_t offset = hndc*range; 869 888 870 const Float_t h = 2./kItemsLegend; 889 const Float_t offset = 0.04*range;890 891 871 const Float_t w = range/sqrt((float)(fNcells-2)); 892 872 893 873 TBox newbox; 894 874 TText newtxt; 895 newtxt.SetTextSize(0.0 25);875 newtxt.SetTextSize(0.03); 896 876 newtxt.SetTextAlign(12); 897 877 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r2251 r2265 17 17 #include <TH1.h> 18 18 #endif 19 20 class TPaveStats; 19 21 20 22 class MGeomCam; … … 33 35 TList *fNotify; //! 34 36 37 Int_t fOptStat; 38 35 39 //TGStatusBar *fStatusBar; 36 40 … … 41 45 void SetRange(); 42 46 47 TPaveStats *GetStats(); 48 43 49 Int_t GetPixelIndex(Int_t px, Int_t py) const; 44 50 45 void PaintTitle();46 51 void PaintAxisTitle(); 47 52 … … 130 135 131 136 void SetAutoScale(); // *MENU* 137 void SetOptStat(Int_t os=-1); // *MENU* 132 138 133 139 void SetPix(const Int_t pixnum, const Int_t color, Float_t min, Float_t max); // New function added by M.Lopez in 31-01-03 134 140 135 141 void AddNotify(const MCamEvent &event) { fNotify->Add((TObject*)(&event)); } 142 143 Stat_t GetMean(Int_t axis) const; 144 Stat_t GetRMS(Int_t axis) const; 136 145 137 146 //void SetStatusBar(TGStatusBar *bar) { fStatusBar = bar; } … … 141 150 142 151 inline void MHCamera::SetAutoScale() { fMinimum = fMaximum = -1111; } 152 inline void MHCamera::SetOptStat(Int_t os) { fOptStat = os; } 143 153 144 154 #endif -
trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.cc
r2229 r2265 104 104 if (fSum) 105 105 delete (fSum); 106 fSum = new MHCamera(*cam, fNameEvt+";avg", fTitle); 106 107 const TString name = fNameEvt.IsNull() ? fName : fNameEvt; 108 109 fSum = new MHCamera(*cam, name+";avg", fTitle); 107 110 fSum->SetYTitle("%"); 108 111 -
trunk/MagicSoft/Mars/mraw/MRawEvtHeader.cc
r2173 r2265 245 245 // store the time of the event in the corresponding container 246 246 // 247 const Double_t mhz = 9.375; // [1e6 ticks/s] 248 const Double_t t = (Double_t)fAbsTime[0]/mhz*1e-3; // [ns] 249 const Double_t ns = (UShort_t)fmod(t, 1e9); 250 const Double_t s = (Byte_t)fmod(t/1e9, 60); 251 const Double_t m = (Byte_t)fmod(t/60e9, 60); 252 const Double_t h = (Byte_t)(t/3600e9); 253 254 fTime->SetTime(h, m, s, ns); 247 255 fTime->SetTime(fAbsTime[0], fAbsTime[1]); 248 256
Note:
See TracChangeset
for help on using the changeset viewer.