Changeset 2229 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 06/24/03 15:01:48 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHCamEvent.cc
r2221 r2229 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 18 ! Author(s): Thomas Bretz, 12/2002 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 20 ! Copyright: MAGIC Software Development, 2000-2003 … … 26 26 // 27 27 // MHCamEvent 28 // 29 // A histogram to store the sum of camera events. This can be photons, 30 // currents or enything else derived from MCamEvent 28 31 // 29 32 ///////////////////////////////////////////////////////////////////////////// … … 131 134 } 132 135 136 // -------------------------------------------------------------------------- 137 // 138 // Return fSum. 139 // 133 140 TH1 *MHCamEvent::GetHistByName(const TString name) 134 141 { -
trunk/MagicSoft/Mars/mhist/MHCamEvent.h
r2209 r2229 12 12 { 13 13 private: 14 MHCamera *fSum;// storing the sum15 MCamEvent *fEvt;//! the current event14 MHCamera *fSum; // storing the sum 15 MCamEvent *fEvt; //! the current event 16 16 17 17 TString fNameEvt; -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r2222 r2229 28 28 // MHCamera 29 29 // 30 // Camera Display. The Pixels are displayed in 31 // contents/area [somthing/mm^2] 32 // 33 // To change the scale to a logarithmic scale SetLogz() of the Pad. 34 // 30 // Camera Display, based on a TH1D. Pleas be carefull using the 31 // underlaying TH1D. 32 // 33 // To change the scale to a logarithmic scale SetLogy() of the Pad. 35 34 // 36 35 //////////////////////////////////////////////////////////////////////////// … … 44 43 #include <TLatex.h> 45 44 #include <TStyle.h> 46 #include <TMarker.h>47 45 #include <TCanvas.h> 48 46 #include <TArrayF.h> … … 57 55 #include "MGeomCam.h" 58 56 59 #include "MRflEvtData.h"60 #include "MRflSinglePhoton.h"61 62 57 #include "MCerPhotPix.h" 63 58 #include "MCerPhotEvt.h" … … 85 80 SetDirectory(NULL); 86 81 87 fPhotons = NULL;88 82 fNotify = NULL; 89 83 … … 97 91 // ------------------------------------------------------------------------ 98 92 // 99 // Constructor. Makes a clone of MGeomCam. 93 // Constructor. Makes a clone of MGeomCam. Removed the TH1D from the 94 // current directory. Calls Sumw2(). Set the histogram line color 95 // (for error bars) to Green and the marker style to kFullDotMedium. 100 96 // 101 97 MHCamera::MHCamera(const MGeomCam &geom, const char *name, const char *title) … … 121 117 // register BIT(8) as kNoContextMenu. If an object has this bit set it will 122 118 // not get an automatic context menu when clicked with the right mouse button. 123 124 fPhotons = new TClonesArray("TMarker", 0);125 119 126 120 // … … 139 133 // ------------------------------------------------------------------------ 140 134 // 141 // Destructor. Deletes TClonesArrays for hexagons and legend elements.135 // Destructor. Deletes the cloned fGeomCam and the notification list. 142 136 // 143 137 MHCamera::~MHCamera() 144 138 { 145 if (fPhotons)146 {147 fPhotons->Delete();148 delete fPhotons;149 }150 139 if (fGeomCam) 151 140 delete fGeomCam; … … 154 143 } 155 144 156 Int_t MHCamera::Fill(Axis_t x) 157 { 145 // ------------------------------------------------------------------------ 146 // 147 // Taken from TH1D::Fill(). Uses the argument directly as bin index. 148 // Doesn't increment the number of entries. 149 // 158 150 // -*-*-*-*-*-*-*-*Increment bin with abscissa X by 1*-*-*-*-*-*-*-*-*-*-* 159 151 // ================================== … … 167 159 // 168 160 // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 161 Int_t MHCamera::Fill(Axis_t x) 162 { 169 163 170 164 #if ROOT_VERSION_CODE > ROOT_VERSION(3,05,00) … … 186 180 } 187 181 188 //______________________________________________________________________________ 189 Int_t MHCamera::Fill(Axis_t x, Stat_t w) 190 { 182 // ------------------------------------------------------------------------ 183 // 184 // Taken from TH1D::Fill(). Uses the argument directly as bin index. 185 // Doesn't increment the number of entries. 186 // 191 187 // -*-*-*-*-*-*Increment bin with abscissa X with a weight w*-*-*-*-*-*-*-* 192 188 // ============================================= … … 200 196 // 201 197 // -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* 202 198 Int_t MHCamera::Fill(Axis_t x, Stat_t w) 199 { 203 200 #if ROOT_VERSION_CODE > ROOT_VERSION(3,05,00) 204 201 if (fBuffer) return BufferFill(x,w); … … 310 307 } 311 308 312 309 // ------------------------------------------------------------------------ 310 // 311 // Resizes the current pad so that the camera is displayed in its 312 // correct aspect ratio 313 // 313 314 void MHCamera::SetRange() 314 315 { … … 349 350 } 350 351 352 // ------------------------------------------------------------------------ 353 // 354 // Updates the pixel colors and paints the pixels 355 // 351 356 void MHCamera::Update(Bool_t islog, Bool_t isbox, Bool_t iscol) 352 357 { … … 383 388 } 384 389 390 // ------------------------------------------------------------------------ 391 // 392 // Print minimum and maximum 393 // 385 394 void MHCamera::Print(Option_t *) const 386 395 { … … 395 404 } 396 405 406 // ------------------------------------------------------------------------ 407 // 408 // Paint the y-axis title 409 // 397 410 void MHCamera::PaintAxisTitle() 398 411 { … … 412 425 } 413 426 427 // ------------------------------------------------------------------------ 428 // 429 // Paint the histogram title 430 // 414 431 void MHCamera::PaintTitle() 415 432 { … … 485 502 // ------------------------------------------------------------------------ 486 503 // 487 // This is called at any time the canvas should get repainted. 488 // Here we maintain an aspect ratio of 1.15. This makes sure, 489 // that the camera image doesn't get distorted by resizing the canvas. 504 // Paints the camera. 490 505 // 491 506 void MHCamera::Paint(Option_t *o) … … 517 532 518 533 // Paint primitives (pixels, color legend, photons, ...) 519 { fPhotons->ForEach(TObject, Paint)(); }520 521 534 PaintTitle(); 522 535 PaintAxisTitle(); … … 525 538 // ------------------------------------------------------------------------ 526 539 // 527 // 540 // With this function you can change the color palette. For more 528 541 // information see TStyle::SetPalette. Only palettes with 50 colors 529 542 // are allowed. … … 580 593 } 581 594 582 void MHCamera::DrawPixel Numbers()595 void MHCamera::DrawPixelIndices() 583 596 { 584 597 for (int i=0; i<kItemsLegend; i++) … … 605 618 // ------------------------------------------------------------------------ 606 619 // 607 // Call this function to fill the currents 620 // Call this function to add a MCamEvent on top of the present contents. 621 // Only 'used' pixels are added. 608 622 // 609 623 void MHCamera::AddCamContent(const MCamEvent &event, Int_t type) … … 617 631 618 632 Fill(idx, val); // FIXME: Slow! 619 //fArray[idx+1]+=val;620 633 } 621 634 fEntries++; … … 624 637 // ------------------------------------------------------------------------ 625 638 // 626 // Call this function to fill the currents 639 // Call this function to add a MHCamera on top of the present contents. 640 // Only 'used' pixels are added. 641 // Type: 642 // 0) bin content 643 // 1) errors 644 // 2) rel. errors 627 645 // 628 646 void MHCamera::AddCamContent(const MHCamera &d, Int_t type) … … 657 675 // ------------------------------------------------------------------------ 658 676 // 659 // Call this function to fill the currents 677 // Call this function to add a TArrayD on top of the present contents. 678 // Only 'used' pixels are added. 660 679 // 661 680 void MHCamera::AddCamContent(const TArrayD &event, Bool_t ispos) 662 681 { 682 if (event.GetSize()!=fNcells-2) 683 return; 684 663 685 for (Int_t idx=0; idx<fNcells-2; idx++) 664 686 { 665 687 Fill(idx, const_cast<TArrayD&>(event)[idx]); // FIXME: Slow! 666 //fArray[idx+1]+=val;667 688 668 689 if (!ispos || fArray[idx+1]>0) … … 674 695 // ------------------------------------------------------------------------ 675 696 // 676 // Call this function to fill the currents 697 // Call this function to add a MCamEvent on top of the present contents. 698 // 1 is added to each pixel if the contents of MCamEvent>threshold 677 699 // 678 700 void MHCamera::CntCamContent(const MCamEvent &event, Double_t threshold, Int_t type) … … 693 715 // ------------------------------------------------------------------------ 694 716 // 695 // Call this function to fill the currents 717 // Call this function to add a TArrayD on top of the present contents. 718 // 1 is added to each pixel if the contents of MCamEvent>threshold 696 719 // 697 720 void MHCamera::CntCamContent(const TArrayD &event, Double_t threshold, Bool_t ispos) 698 721 { 722 if (event.GetSize()!=fNcells-2) 723 return; 724 699 725 for (Int_t idx=0; idx<fNcells-2; idx++) 700 726 { … … 708 734 } 709 735 736 // ------------------------------------------------------------------------ 737 // 738 // Fill the pixels with random contents. 739 // 710 740 void MHCamera::FillRandom() 711 741 { … … 752 782 { 753 783 FillLevels(event, clean.GetCleanLvl1(), clean.GetCleanLvl2()); 754 }755 756 // ------------------------------------------------------------------------757 //758 // Show a reflector event. EMarkerStyle is defined in root/include/Gtypes.h759 // To remove the photons from the display call FillRflEvent(NULL)760 //761 void MHCamera::ShowRflEvent(const MRflEvtData *event, EMarkerStyle ms)762 {763 const Int_t num = event ? event->GetNumPhotons() : 0;764 765 fPhotons->ExpandCreate(num);766 if (num < 1)767 return;768 769 Int_t i=num-1;770 do771 {772 const MRflSinglePhoton &ph = event->GetPhoton(i);773 TMarker &m = *static_cast<TMarker*>(fPhotons->UncheckedAt(i));774 m.SetX(ph.GetX());775 m.SetY(ph.GetY());776 m.SetMarkerStyle(ms);777 } while (i--);778 784 } 779 785 … … 917 923 // with the graphical primitive with the mouse!!! 918 924 // 919 // All calcutations are runningin pixel coordinates925 // All calcutations are done in pixel coordinates 920 926 // 921 927 Int_t MHCamera::DistancetoPrimitive(Int_t px, Int_t py) … … 939 945 // ------------------------------------------------------------------------ 940 946 // 941 // Execute a mouse event on the camera942 //943 /*944 void MHCamera::ExecuteEvent(Int_t event, Int_t px, Int_t py)945 {946 cout << "Execute Event Camera " << event << " @ " << px << " " << py << endl;947 }948 */949 950 951 // ------------------------------------------------------------------------952 //953 947 // Function introduced (31-01-03) WILL BE REMOVED IN THE FUTURE! DON'T 954 948 // USE IT! … … 960 954 } 961 955 956 // ------------------------------------------------------------------------ 957 // 958 // Function introduced (31-01-03) WILL BE REMOVED IN THE FUTURE! DON'T 959 // USE IT! 960 // 962 961 Int_t MHCamera::GetPixelIndex(Int_t px, Int_t py) const 963 962 { … … 1019 1018 cout << "Contents: " << fArray[idx+1] << " <"; 1020 1019 cout << (IsUsed(idx)?"on":"off"); 1021 cout << ">" << endl << endl;1020 cout << ">" << endl; 1022 1021 1023 1022 if (fNotify && fNotify->GetSize()>0) -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r2216 r2229 5 5 #include "MAGIC.h" 6 6 #endif 7 #ifndef ROOT_Gtypes8 #include <Gtypes.h>9 #endif10 7 #ifndef ROOT_TArrayC 11 8 #include <TArrayC.h> … … 21 18 #endif 22 19 23 #include "MGeomCam.h"24 #include "MGeomPix.h"25 class TBox;26 class TText;27 class TArrow;28 class TGStatusBar;29 30 20 class MGeomCam; 31 class MHexagon;32 class MCurrents;33 21 class MCamEvent; 34 22 class MRflEvtData; 35 23 class MCerPhotEvt; 36 class MCerPhotPix;37 24 class MImgCleanStd; 38 class MPedestalPix;39 class MPedestalCam;40 25 41 26 class MHCamera : public TH1D 42 27 { 43 28 private: 44 MGeomCam *fGeomCam; // pointer to camera geometry 45 46 TArrayC fUsed; 47 48 TClonesArray *fPhotons; // array of reflector photons 29 MGeomCam *fGeomCam; // pointer to camera geometry (y-axis) 30 TArrayC fUsed; // array containing flags 49 31 50 32 TArrayI fColors; //! Color conversion table … … 121 103 Double_t GetMaximum() const { return GetMaximum(0/*kTRUE*/); } 122 104 123 void ShowRflEvent(const MRflEvtData *event=NULL, EMarkerStyle m=kFullDotMedium);124 105 void FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2); 125 106 void FillLevels(const MCerPhotEvt &event, const MImgCleanStd &clean); … … 129 110 void FillRandom(); 130 111 131 void DrawPixel Numbers();112 void DrawPixelIndices(); 132 113 133 114 void PrintInfo() const { Print(""); } // *MENU* -
trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.cc
r2221 r2229 28 28 // MHTriggerLvl0 29 29 // 30 // This is intended to be a sort of "level 0 trigger display". What it really 31 // does is to store the number of events of a data file in which each pixel 32 // has gone above a given threshold (fPixelThreshold) which is chosen when 33 // calling the constructor. Displaying a camera view with these values can 34 // help identify noisy pixels. See the macro pixfixrate.C to see an example 35 // of its use. Many things are to be fixed. Only inner pixels are shown now 36 // (which are anyhow those involved in the trigger), and the camera geometry 37 // (number of pixels, and how many inner ones) is not yet read from the input 38 // file. 39 // The "pedestal" we are using is just the signal in the first ADC slice 40 // (seems reasonable from the inspection of the available test data files). 41 // 30 // This is intended to be a sort of "level 0 trigger display". What it 31 // really does is to store the number of events of a data file in which 32 // each pixel has gone above a given threshold (fPixelThreshold) which 33 // is chosen when calling the constructor. Displaying a camera view with 34 // these values can help identify noisy pixels. See the macro pixfixrate.C 35 // to see an example of its use. 42 36 // 43 37 ///////////////////////////////////////////////////////////////////////////// … … 118 112 // -------------------------------------------------------------------------- 119 113 // 120 // Fill the histograms with data from a MC erPhotEvt-Container.114 // Fill the histograms with data from a MCamEvent-Container. 121 115 // 122 116 Bool_t MHTriggerLvl0::Fill(const MParContainer *par, const Stat_t w) … … 136 130 // -------------------------------------------------------------------------- 137 131 // 138 // S et to Unused outer pixels.132 // Scale by the number of events 139 133 // 140 134 Bool_t MHTriggerLvl0::Finalize() -
trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.h
r2209 r2229 12 12 { 13 13 private: 14 MHCamera *fSum;// storing the sum15 MCamEvent *fEvt;//! the current event14 MHCamera *fSum; // storing the sum 15 MCamEvent *fEvt; //! the current event 16 16 17 17 TString fNameEvt; … … 36 36 void Draw(Option_t * =""); 37 37 38 ClassDef(MHTriggerLvl0, 1) // Histogram to sum level 0 triggers in all pixels38 ClassDef(MHTriggerLvl0, 1) // Histogram to count how often a pixel is above threshold 39 39 }; 40 40
Note:
See TracChangeset
for help on using the changeset viewer.