Changeset 959
- Timestamp:
- 10/02/01 14:46:56 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 added
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r958 r959 1 1 -*-*- END -*-*- 2 3 2001/10/02: Thomas Bretz 4 5 * mbase/MClone.[h,cc], 6 meventdisp/MGCamDisplay.[h,cc], 7 meventdisp/MGEvtDisplay.[h,cc], 8 mmain/MCameraDisplay.[h,cc]: 9 - added 10 11 * macros/readMagic.C: 12 - fixed a "'->' and '.' mixed bug" 13 14 * manalysis/MCT1ReadAscii.cc: 15 - added initialisation of fIn 16 17 * manalysis/MCerPhotEvt.[h,cc]: 18 - made IsPixelExisting const 19 - made IsPixelCore const 20 - made IsPixelUsed const 21 - made GetNumPhotons[Min,Max] const 22 23 * mbase/BaseLinkDef.h, mbase/Makefile: 24 - added MClone 25 26 * mbase/MEvtLoop.[h,cc], mbase/MParList.[h,cc], mbase/MTaskList.[h,cc]: 27 - added SetOwner-support 28 29 * mdatacheck/DataCheckLinkDef.h, mdatacheck/Makefile: 30 - removed MShowSpect 31 - removed MViewAdcSpect 32 33 * mdatacheck/MDumpEvtHeader.cc: 34 - added missing descriptions 35 36 * mdatacheck/MGDisplayAdc.[h,cc]: 37 - small changes 38 39 * meventdisp/EvtDispLinkDef.h: 40 - added MGEvtDisplay 41 - added MGCamDisplay 42 43 * meventdisp/MGFadcDisp.[h,cc]: 44 - derived from MGEvtDisplay 45 - most of the code moved to MGEvtDisplay to support MGCamDisplay, too 46 47 * meventdisp/Makefile: 48 - added MGCamDisplay 49 50 * mgui/MCamDisplay.[h,cc]: 51 - cleaned 52 - reorganized 53 54 * mgui/MHexagon.cc: 55 - added missing descriptions 56 57 * mhist/MHFadcPix.cc: 58 - reorganized some code in the constructor which creates the 'names' 59 60 * mhist/MHHillas.cc, mhist/MHMcCollectionArea.cc, 61 mhist/MHMcEnergy.cc, mhist/MHStarMap.cc: 62 - Draw-function supports a default canvas now 63 64 * mmain/MDataCheck.cc: 65 - added/rorganized comments 66 - removed usage of MViewAdcSpectra 67 68 * mmain/MMars.[h,cc]: 69 - added new "Camera Display" Button 70 71 * mmain/MainLinkDef.h, mmain/Makefile: 72 - added MCameraDisplay 73 74 2 75 3 76 2001/09/28: Thomas Bretz -
trunk/MagicSoft/Mars/Makefile
r949 r959 36 36 # 37 37 SUBDIRS = mmain \ 38 mmc \ 38 39 mgui \ 39 40 manalysis \ … … 44 45 mhist \ 45 46 mfilter \ 46 mraw \ 47 mmc 47 mraw 48 48 49 49 LIBRARIES = $(SUBDIRS:=.a) -
trunk/MagicSoft/Mars/macros/readMagic.C
r948 r959 33 33 MTaskList tlist; 34 34 35 plist ->AddToList(&geomcam);36 plist ->AddToList(&pedest);37 plist ->AddToList(&hillas);38 plist ->AddToList(&tlist);35 plist.AddToList(&geomcam); 36 plist.AddToList(&pedest); 37 plist.AddToList(&hillas); 38 plist.AddToList(&tlist); 39 39 40 40 MReadTree read("Events", "oscar_protons.root"); … … 54 54 return; 55 55 56 MCerPhotEvt &phevt = *(MCerPhotEvt*)plist ->FindObject("MCerPhotEvt");56 MCerPhotEvt &phevt = *(MCerPhotEvt*)plist.FindObject("MCerPhotEvt"); 57 57 58 58 MCamDisplay display(&geomcam); -
trunk/MagicSoft/Mars/manalysis/MCT1ReadAscii.cc
r857 r959 62 62 MCT1ReadAscii::MCT1ReadAscii(const char *fname, 63 63 const char *name, 64 const char *title) 64 const char *title) 65 : fIn(NULL) 65 66 { 66 67 *fName = name ? name : "MCT1ReadAscii"; -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r857 r959 116 116 // Checks if in the pixel list is an entry with pixel id 117 117 // 118 Bool_t MCerPhotEvt::IsPixelExisting(Int_t id) 118 Bool_t MCerPhotEvt::IsPixelExisting(Int_t id) const 119 119 { 120 120 const Int_t entries = fPixels->GetEntries(); … … 123 123 { 124 124 if (id == (*this)[il].GetPixId()) 125 return kTRUE 126 } 127 128 return kFALSE 125 return kTRUE; 126 } 127 128 return kFALSE; 129 129 } 130 130 … … 133 133 // Checks if in the pixel list is an entry with pixel id 134 134 // 135 Bool_t MCerPhotEvt::IsPixelUsed(Int_t id) 136 { 137 const Int_t entries = fPixels->GetEntries(); 138 139 for (Int_t il=0; il<entries; il++ 135 Bool_t MCerPhotEvt::IsPixelUsed(Int_t id) const 136 { 137 const Int_t entries = fPixels->GetEntries(); 138 139 for (Int_t il=0; il<entries; il++) 140 140 { 141 141 MCerPhotPix &pix = (*this)[il]; 142 142 143 143 if (id == pix.GetPixId() && pix.IsPixelUsed()) 144 return kTRUE 145 } 146 147 return kFALSE 144 return kTRUE; 145 } 146 147 return kFALSE; 148 148 } 149 149 … … 152 152 // Checks if in the pixel list is an entry with pixel id 153 153 // 154 Bool_t MCerPhotEvt::IsPixelCore(Int_t id) 155 { 156 const Int_t entries = fPixels->GetEntries(); 157 158 for (Int_t il=0; il<entries; il++ 154 Bool_t MCerPhotEvt::IsPixelCore(Int_t id) const 155 { 156 const Int_t entries = fPixels->GetEntries(); 157 158 for (Int_t il=0; il<entries; il++) 159 159 { 160 160 MCerPhotPix &pix = (*this)[il]; 161 161 162 if ( 163 return kTRUE 162 if (id == pix.GetPixId() && pix.IsCorePixel()) 163 return kTRUE; 164 164 } 165 165 166 return kFALSE 166 return kFALSE; 167 167 } 168 168 … … 171 171 // get the minimum number of photons of all valid pixels in the list 172 172 // 173 Float_t MCerPhotEvt::GetNumPhotonsMin() 173 Float_t MCerPhotEvt::GetNumPhotonsMin() const 174 174 { 175 175 if (fNumPixels <= 0) 176 return -5. 176 return -5.; 177 177 178 178 Float_t minval = (*this)[0].GetNumPhotons(); 179 179 180 180 Float_t testval; 181 for (UInt_t i=1 ; i<fNumPixels; i++)181 for (UInt_t i=1; i<fNumPixels; i++) 182 182 { 183 183 testval = (*this)[i].GetNumPhotons(); … … 194 194 // get the maximum number of photons of all valid pixels in the list 195 195 // 196 Float_t MCerPhotEvt::GetNumPhotonsMax() 196 Float_t MCerPhotEvt::GetNumPhotonsMax() const 197 197 { 198 198 if (fNumPixels <= 0) -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r857 r959 33 33 void Print(Option_t *opt=NULL); 34 34 35 Bool_t IsPixelExisting( Int_t id );36 Bool_t IsPixelUsed ( Int_t id );37 Bool_t IsPixelCore ( Int_t id );35 Bool_t IsPixelExisting(Int_t id) const; 36 Bool_t IsPixelUsed (Int_t id) const; 37 Bool_t IsPixelCore (Int_t id) const; 38 38 39 Float_t GetNumPhotonsMin() ;40 Float_t GetNumPhotonsMax() ;39 Float_t GetNumPhotonsMin() const; 40 Float_t GetNumPhotonsMax() const; 41 41 42 42 MCerPhotPix &operator[](int i) { return *(MCerPhotPix*)(fPixels->At(i)); } -
trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
r858 r959 31 31 #pragma link C++ class MInputStreamID; 32 32 33 #pragma link C++ class MClone; 34 33 35 #pragma link C++ class MReadTree; 34 36 #pragma link C++ class MWriteFile; -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r887 r959 81 81 MEvtLoop::~MEvtLoop() 82 82 { 83 if (TestBit(kIsOwner) && fParList) 84 delete fParList; 85 } 86 87 // -------------------------------------------------------------------------- 88 // 89 // if you set the Eventloop as owner the destructor of the given parameter 90 // list is calles by the destructor of MEvtLoop, otherwise not. 91 // 92 inline void MEvtLoop::SetOwner(Bool_t enable=kTRUE) 93 { 94 enable ? SetBit(kIsOwner) : ResetBit(kIsOwner); 83 95 } 84 96 -
trunk/MagicSoft/Mars/mbase/MEvtLoop.h
r867 r959 27 27 MTaskList *fTaskList; 28 28 29 enum { kIsOwner = BIT(14) }; 30 29 31 public: 30 32 MEvtLoop(); 31 33 virtual ~MEvtLoop(); 32 34 33 void SetParList(MParList *p) { fParList = p; } 35 void SetParList(MParList *p) { fParList = p; } 36 MParList *GetParList() const { return fParList; } 37 38 void SetOwner(Bool_t enable=kTRUE); 34 39 35 40 Bool_t PreProcess(const char *tlist="MTaskList"); -
trunk/MagicSoft/Mars/mbase/MParList.cc
r905 r959 81 81 // -------------------------------------------------------------------------- 82 82 // 83 // If the 'IsOwner' bit is set (via SetOwner()) all containers are deleted 84 // by the destructor 85 // 86 MParList::~MParList() 87 { 88 if (TestBit(kIsOwner)) 89 fContainer.SetOwner(); 90 } 91 92 // -------------------------------------------------------------------------- 93 // 94 // If the 'IsOwner' bit is set (via SetOwner()) all containers are deleted 95 // by the destructor 96 // 97 inline void MParList::SetOwner(Bool_t enable=kTRUE) 98 { 99 enable ? SetBit(kIsOwner) : ResetBit(kIsOwner); 100 } 101 102 // -------------------------------------------------------------------------- 103 // 83 104 // Set the logging streamer of the parameter list and all contained 84 105 // parameter containers -
trunk/MagicSoft/Mars/mbase/MParList.h
r891 r959 32 32 static TString GetObjectName(const char *classname, const char *objname); 33 33 34 enum { kIsOwner = BIT(14) }; 35 34 36 public: 35 37 MParList(const char *name=NULL, const char *title=NULL); 36 38 MParList(MParList &ts); 37 39 38 ~MParList() 39 { 40 } 40 ~MParList(); 41 41 42 42 Bool_t AddToList(MParContainer *obj, MParContainer *where = NULL); … … 57 57 void SetReadyToSave(Bool_t flag=kTRUE); 58 58 59 void SetOwner(Bool_t enable=kTRUE); 60 59 61 void Print(Option_t *t = NULL); 60 62 -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r887 r959 80 80 // -------------------------------------------------------------------------- 81 81 // 82 // If the 'IsOwner' bit is set (via SetOwner()) all tasks are deleted 83 // by the destructor 84 // 85 MTaskList::~MTaskList() 86 { 87 if (TestBit(kIsOwner)) 88 fTasks.SetOwner(); 89 } 90 91 // -------------------------------------------------------------------------- 92 // 93 // If the 'IsOwner' bit is set (via SetOwner()) all containers are deleted 94 // by the destructor 95 // 96 inline void MTaskList::SetOwner(Bool_t enable=kTRUE) 97 { 98 enable ? SetBit(kIsOwner) : ResetBit(kIsOwner); 99 } 100 101 102 // -------------------------------------------------------------------------- 103 // 82 104 // Set the logging stream for the all tasks in the list and the tasklist 83 105 // itself. … … 169 191 // -------------------------------------------------------------------------- 170 192 // 193 // Find an object in the list. 194 // 'name' is the name of the object you are searching for. 195 // 196 TObject *MTaskList::FindObject(const char *name) const 197 { 198 return fTasks.FindObject(name); 199 } 200 201 // -------------------------------------------------------------------------- 202 // 203 // check if the object is in the list or not 204 // 205 TObject *MTaskList::FindObject(TObject *obj) const 206 { 207 return fTasks.FindObject(obj); 208 } 209 210 // -------------------------------------------------------------------------- 211 // 171 212 // do pre processing (before eventloop) of all tasks in the task-list 172 213 // … … 187 228 // loop over all tasks for preproccesing 188 229 // 189 while ( (task=(MTask*)Next()))230 while ((task=(MTask*)Next())) 190 231 { 191 232 *fLog << task->GetName() << "... " << flush; -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r860 r959 27 27 MParList *fParList; 28 28 29 enum { kIsOwner = BIT(14) }; 30 29 31 public: 30 32 MTaskList(const char *name=NULL, const char *title=NULL); 33 MTaskList(MTaskList &ts); 31 34 32 MTaskList(MTaskList &ts);35 ~MTaskList(); 33 36 34 37 void SetLogStream(MLog *log); 35 38 36 39 Bool_t AddToList(MTask *task, const char *tType="All", MTask *where = NULL); 40 41 TObject *FindObject(const char *name) const; 42 TObject *FindObject(TObject *obj) const; 37 43 38 44 Bool_t PreProcess(MParList *pList); … … 41 47 42 48 void Print(Option_t *opt = ""); 49 void SetOwner(Bool_t enable=kTRUE); 43 50 44 51 ClassDef(MTaskList, 0) //collection of tasks to be performed in the eventloop -
trunk/MagicSoft/Mars/mbase/Makefile
r858 r959 49 49 MLog.cc \ 50 50 MHtml.cc \ 51 MClone.cc \ 51 52 MLogManip.cc 52 53 -
trunk/MagicSoft/Mars/mdatacheck/DataCheckLinkDef.h
r938 r959 5 5 #pragma link off all functions; 6 6 7 #pragma link C++ class MShowSpect;8 #pragma link C++ class MViewAdcSpectra;7 //#pragma link C++ class MShowSpect; 8 //#pragma link C++ class MViewAdcSpectra; 9 9 #pragma link C++ class MDumpEvtHeader; 10 10 -
trunk/MagicSoft/Mars/mdatacheck/MDumpEvtHeader.cc
r956 r959 24 24 \* ======================================================================== */ 25 25 26 ////////////////////////////////////////////////////////////////////////////// 27 // 28 // MDumpEvtHeader 29 // 30 // Print out some event header information to the screen. This maybe useful 31 // if you are not sure what the events in the file conatins or you 32 // want to check for the contents. 33 // 34 // Input Containers: 35 // MRawEvtHeader, MRawEvtData 36 // 37 // Output Containers: 38 // -/- 39 // 40 ////////////////////////////////////////////////////////////////////////////// 41 26 42 #include "MDumpEvtHeader.h" 27 43 … … 33 49 #include "MRawEvtPixelIter.h" 34 50 35 ClassImp(MDumpEvtHeader) 51 ClassImp(MDumpEvtHeader); 36 52 53 // -------------------------------------------------------------------------- 54 // 55 // Preprocessing of class. Check for the two container which should 56 // get printed by the Process-function: MRawEvtHeader and MRawEvtData. 57 // If one of the two doesn't exist (input containers) stop processing of 58 // data. 59 // 37 60 Bool_t MDumpEvtHeader::PreProcess (MParList *pList) 38 61 { … … 54 77 } 55 78 79 // -------------------------------------------------------------------------- 80 // 81 // Print out information of the actual event (header) and print the 82 // pixel ID's of all pixels in this event. 83 // 56 84 Bool_t MDumpEvtHeader::Process() 57 85 { 58 fRawEvtHeader->Print();86 fRawEvtHeader->Print(); 59 87 60 MRawEvtPixelIter pixel(fRawEvtData);88 MRawEvtPixelIter pixel(fRawEvtData); 61 89 62 while (pixel.Next())63 *fLog << " " << pixel.GetPixelId();90 while (pixel.Next()) 91 *fLog << " " << pixel.GetPixelId(); 64 92 65 *fLog << endl;66 67 return kTRUE;68 } 93 *fLog << endl; 94 95 return kTRUE; 96 } -
trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc
r958 r959 66 66 fHistoList = new TGListBox (left, M_LIST_HISTO); 67 67 fHistoList->Associate(this); 68 fHistoList->Resize( 80, 405);68 fHistoList->Resize(100, 405); 69 69 70 70 fList->Add(fHistoList); … … 126 126 // --- 127 127 128 TGLayoutHints *laybut1 = new TGLayoutHints(kLHintsNormal, 10, 10, 0, 10); 129 TGLayoutHints *laybut2 = new TGLayoutHints(kLHintsNormal, 10, 10, 10, 5); 128 TGLayoutHints *laybut1 = new TGLayoutHints(kLHintsCenterX|kLHintsTop, 10, 10, 0, 10); 129 TGLayoutHints *laybut2 = new TGLayoutHints(kLHintsCenterX|kLHintsTop, 10, 10, 10, 5); 130 TGLayoutHints *layslid = new TGLayoutHints(kLHintsCenterX|kLHintsTop); 130 131 131 132 fList->Add(laybut1); 132 133 fList->Add(laybut2); 133 134 mid->AddFrame(prev, laybut1); 135 mid->AddFrame(fSlider); 136 mid->AddFrame(next, laybut2); 137 mid->AddFrame(group, laybut2); 134 fList->Add(layslid); 135 136 mid->AddFrame(prev, laybut1); 137 mid->AddFrame(fSlider, layslid); 138 mid->AddFrame(next, laybut2); 139 mid->AddFrame(group, laybut2); 138 140 139 141 // 140 142 // right part of top frame 141 143 // 142 TGVerticalFrame *right = new TGVerticalFrame(frame, 60, 60, kFitWidth);144 TGVerticalFrame *right = new TGVerticalFrame(frame, 100, 100, kFitWidth); 143 145 fList->Add(right); 144 146 145 TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas("fECanv", right, 800, 400);147 TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas("fECanv", right, 100, 100); 146 148 fList->Add(canvas); 147 149 … … 156 158 fList->Add(reset); 157 159 158 TGLayoutHints *layreset = new TGLayoutHints(kLHintsCenterX|kLHintsTop, 10, 10, 0, 10);160 TGLayoutHints *layreset = new TGLayoutHints(kLHintsCenterX|kLHintsTop, 10, 10, 0, 10); 159 161 fList->Add(layreset); 160 162 … … 211 213 UInt_t w, UInt_t h, 212 214 UInt_t options) 213 : TGTransientFrame(p, main, w, h, options), fHists(histos), fHistoType(M_RADIO_HI) 214 { 215 : TGTransientFrame(p?p:gClient->GetRoot(), main?main:gClient->GetRoot(), w, h, options), 216 fHistoType(M_RADIO_LH) 217 { 218 fHists = (MHFadcCam*)histos->Clone(); 219 215 220 fList = new TList; 216 221 fList->SetOwner(); … … 265 270 266 271 MapWindow(); 267 SetWMSizeHints( 550, 550, 1000, 1000, 1, 1);272 SetWMSizeHints(950, 500, 1000, 1000, 1, 1); 268 273 } 269 274 … … 271 276 { 272 277 delete fList; 278 delete fHists; 273 279 } 274 280 … … 277 283 void MGDisplayAdc::CloseWindow() 278 284 { 279 // Got close message for this MainFrame. Calls parent CloseWindow() 280 // (which destroys the window) and terminate the application. 285 // 281 286 // The close message is generated by the window manager when its close 282 287 // window menu item is selected. -
trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.h
r958 r959 41 41 42 42 MGDisplayAdc(MHFadcCam *fHists , 43 const TGWindow *p , const TGWindow *main,44 UInt_t w , UInt_t h,45 UInt_t options = kMainFrame | kVerticalFrame);43 const TGWindow *p=NULL, const TGWindow *main=NULL, 44 UInt_t w=800, UInt_t h=500, 45 UInt_t options = kMainFrame|kVerticalFrame); 46 46 47 47 ~MGDisplayAdc(); -
trunk/MagicSoft/Mars/mdatacheck/Makefile
r710 r959 29 29 30 30 SRCFILES = MDumpEvtHeader.cc \ 31 MGDisplayAdc.cc \ 32 MShowSpect.cc \ 33 MViewAdcSpectra.cc 31 MGDisplayAdc.cc 34 32 35 33 SRCS = $(SRCFILES) -
trunk/MagicSoft/Mars/meventdisp/EvtDispLinkDef.h
r586 r959 5 5 #pragma link off all functions; 6 6 7 #pragma link C++ class MGFadcDisp ; 7 #pragma link C++ class MGEvtDisplay; 8 9 #pragma link C++ class MGFadcDisp; 10 #pragma link C++ class MGCamDisplay; 8 11 9 12 #endif -
trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
r956 r959 1 /* 1 /*======================================================================== *\ 2 2 ! 3 3 ! * … … 16 16 ! 17 17 ! 18 ! Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de) 19 ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de) 18 ! Author(s): Thomas Bretz 10/2001 (tbretz@uni-sw.gwdg.de) 20 19 ! 21 20 ! Copyright: MAGIC Software Development, 2000-2001 … … 44 43 // use TGSplitter instead for root<3.00 45 44 #include "MParList.h" 45 #include "MTaskList.h" 46 46 #include "MReadTree.h" 47 #include "MEvtLoop.h" 47 48 #include "MRawEvtData.h" 48 49 #include "MRawEvtPixelIter.h" … … 52 53 enum MGFadcDispCommand 53 54 { 54 M_PIXELLIST = 4201, 55 M_PREVEVT, 56 M_NEXTEVT, 57 M_EVTNUMBER, 58 59 M_PREVPIXEL, 60 M_NEXTPIXEL, 61 62 M_PRINT, 63 M_CLOSE 64 }; 65 66 void MGFadcDisp::AddTopFramePart1(TGVerticalFrame *frame, 67 const char *filename, 68 const char *treename) 69 { 70 // 71 // --- the top1 part of the window --- 72 // 73 TGHorizontalFrame *top1 = new TGHorizontalFrame(frame, 300, 100); 74 fList->Add(top1); 75 76 // 77 // create gui elements 78 // 79 TGLabel *lfile = new TGLabel(top1, new TGString("File:")); 80 TGLabel *file = new TGLabel(top1, new TGString(filename)); 81 TGLabel *ltree = new TGLabel(top1, new TGString("Tree:")); 82 TGLabel *tree = new TGLabel(top1, new TGString(treename)); 83 84 fList->Add(lfile); 85 fList->Add(file); 86 fList->Add(ltree); 87 fList->Add(tree); 88 89 // 90 // layout and add gui elements in/to frame 91 // 92 TGLayoutHints *laystd = new TGLayoutHints(kLHintsLeft, 10, 10, 10, 10); 93 fList->Add(laystd); 94 95 top1->AddFrame(lfile, laystd); 96 top1->AddFrame(file, laystd); 97 top1->AddFrame(ltree, laystd); 98 top1->AddFrame(tree, laystd); 99 100 // 101 // layout and add frame 102 // 103 TGLayoutHints *laytop1 = new TGLayoutHints(kLHintsTop); 104 fList->Add(laytop1); 105 106 frame->AddFrame(top1, laytop1); 107 } 108 109 void MGFadcDisp::AddTopFramePart2(TGVerticalFrame *frame) 110 { 111 // 112 // --- the top2 part of the window --- 113 // 114 TGHorizontalFrame *top2 = new TGHorizontalFrame(frame, 300, 100); 115 fList->Add(top2); 116 117 // 118 // Create the gui elements 119 // 120 TGTextButton *prevevt = new TGTextButton(top2, "<< Previous Event", M_PREVEVT); 121 prevevt->Associate(this); 122 123 TGLabel *evtnr = new TGLabel(top2, new TGString("Event: ")); 124 125 fTxtEvtNr = new TGTextEntry(top2, new TGTextBuffer(100), M_EVTNUMBER); 126 fTxtEvtNr->Resize(60, fTxtEvtNr->GetDefaultHeight()); 127 fTxtEvtNr->Associate(this); 128 129 char wortdummy[100]; 130 sprintf(wortdummy, "out of %d Events", fReadTree->GetEntries()); 131 TGLabel *totnr = new TGLabel(top2, new TGString(wortdummy)); 132 133 TGTextButton *nextevt = new TGTextButton (top2, "Next Event >>", M_NEXTEVT); 134 nextevt->Associate(this); 135 136 // 137 // Add gui elements to 'atotodel' 138 // 139 fList->Add(prevevt); 140 fList->Add(evtnr); 141 fList->Add(fTxtEvtNr); 142 fList->Add(totnr); 143 fList->Add(nextevt); 144 145 // 146 // add the gui elements to the frame 147 // 148 TGLayoutHints *laystd = new TGLayoutHints(kLHintsLeft, 10, 10, 10, 10); 149 TGLayoutHints *laytentry = new TGLayoutHints(kLHintsNormal, 5, 5, 5, 5); 150 151 fList->Add(laystd); 152 fList->Add(laytentry); 153 154 top2->AddFrame(prevevt, laystd); 155 top2->AddFrame(evtnr, laystd); 156 top2->AddFrame(fTxtEvtNr, laytentry); 157 top2->AddFrame(totnr, laystd); 158 top2->AddFrame(nextevt, laystd); 159 160 frame->AddFrame(top2, new TGLayoutHints(kLHintsCenterX)); 161 } 162 163 void MGFadcDisp::AddMidFrame(TGHorizontalFrame *frame) 164 { 165 // 166 // create tab control 167 // 168 TGTab *tabs = new TGTab(frame, 300, 300); 169 170 // 171 // Create Tab1 172 // 173 TGCompositeFrame *tab1 = tabs->AddTab("PixelList"); 174 tab1->ChangeOptions(kHorizontalFrame); 55 M_PREVPIXEL = 0x1000, 56 M_NEXTPIXEL = 0x1001 57 }; 58 59 // -------------------------------------------------------------------------- 60 // 61 // Add the missing GUI elements: These are the pixel number controls 62 // 63 void MGFadcDisp::AddSetupElements() 64 { 65 fTab1->ChangeOptions(kHorizontalFrame); 175 66 176 67 // 177 68 // Create first gui element for tab1 178 69 // 179 fPixelList = new TGListBox( tab1, M_PIXELLIST);70 fPixelList = new TGListBox(fTab1, M_PIXELLIST); 180 71 fPixelList->Associate(this); 181 72 fPixelList->Resize(80, 230); 182 73 183 74 TGLayoutHints *layplist = new TGLayoutHints(kLHintsExpandY|kLHintsLeft, 5, 5, 5, 5); 184 tab1->AddFrame(fPixelList, layplist); 185 186 // 187 // Crete second gui elemet for tab1 (TGVertical Frame) 188 // 189 TGVerticalFrame *mid1 = new TGVerticalFrame(tab1, 300, 100); 75 fTab1->AddFrame(fPixelList, layplist); 76 77 TGVerticalFrame *fMidFrame = new TGVerticalFrame(fTab1, 300, 100); 78 fList->Add(fMidFrame); 79 80 TGLayoutHints *laytab = new TGLayoutHints(kLHintsRight|kLHintsExpandY, 5, 5, 5, 5); 81 fList->Add(laytab); 82 83 fTab1->AddFrame(fMidFrame, laytab); 190 84 191 85 // 192 86 // Create gui elements for vertical frame 193 87 // 194 TGTextButton *prevpix = new TGTextButton( mid1, "<< Prev Pixel", M_PREVPIXEL);195 TGTextButton *nextpix = new TGTextButton( mid1, "Next Pixel >>", M_NEXTPIXEL);88 TGTextButton *prevpix = new TGTextButton(fMidFrame, "<< Prev Pixel", M_PREVPIXEL); 89 TGTextButton *nextpix = new TGTextButton(fMidFrame, "Next Pixel >>", M_NEXTPIXEL); 196 90 prevpix->Associate(this); 197 91 nextpix->Associate(this); 198 92 199 TGVSlider *slider = new TGVSlider( mid1, 200, kSlider1|kScaleBoth);93 TGVSlider *slider = new TGVSlider(fMidFrame, 200, kSlider1|kScaleBoth); 200 94 slider->Associate(this); 201 95 slider->SetRange(0, 576); … … 207 101 TGLayoutHints *layslider = new TGLayoutHints(kLHintsCenterX|kLHintsExpandY); 208 102 209 mid1->AddFrame(prevpix, laybut); 210 mid1->AddFrame(slider, layslider); 211 mid1->AddFrame(nextpix, laybut); 212 213 TGLayoutHints *laytab = new TGLayoutHints(kLHintsRight|kLHintsExpandY, 5, 5, 5, 5); 214 tab1->AddFrame(mid1, laytab); 215 216 TGLayoutHints *laytabs = new TGLayoutHints(kLHintsNormal|kLHintsExpandY, 10, 10, 10, 10); 217 frame->AddFrame(tabs, laytabs); 218 219 // 220 // Create second part of frame 221 // 222 TGTab *tabdisp = new TGTab(frame, 300, 300); 223 224 TGCompositeFrame *tab2 = tabdisp->AddTab("Digital Scope"); 225 226 TRootEmbeddedCanvas *canvas = new TRootEmbeddedCanvas("Digi Scope", tab2, 400, 400); 227 228 TGLayoutHints *laycanvas = new TGLayoutHints(kLHintsCenterX|kLHintsCenterY|kLHintsExpandX|kLHintsExpandY); 229 tab2->AddFrame(canvas, laycanvas); 230 231 fCanvas = canvas->GetCanvas(); 232 233 // 234 // Add second part to frame 235 // 236 TGLayoutHints *laydisp = new TGLayoutHints(kLHintsNormal|kLHintsExpandY|kLHintsExpandX, 10, 10, 10, 10); 237 frame->AddFrame(tabdisp, laydisp); 238 239 // 240 // Now add all gui elements to 'autodel'-list 241 // 242 fList->Add(tabdisp); 243 fList->Add(canvas); 244 fList->Add(laycanvas); 245 fList->Add(laydisp); 246 fList->Add(fPixelList); 247 fList->Add(layplist); 248 fList->Add(mid1); 249 fList->Add(prevpix); 250 fList->Add(laybut); 251 fList->Add(slider); 252 fList->Add(layslider); 253 fList->Add(nextpix); 254 fList->Add(laytab); 255 fList->Add(laytabs); 256 257 } 258 259 void MGFadcDisp::AddLowFrame(TGHorizontalFrame *frame) 260 { 261 TGTextButton *but1 = new TGTextButton(frame, "Print", M_PRINT); 262 TGTextButton *but2 = new TGTextButton(frame, "Close", M_CLOSE); 263 264 but1->Associate(this); 265 but2->Associate(this); 266 267 fList->Add(but1); 268 fList->Add(but2); 269 270 TGLayoutHints *laybut = new TGLayoutHints(kLHintsLeft, 10, 10, 10, 10); 271 fList->Add(laybut); 272 273 frame->AddFrame(but1, laybut); 274 frame->AddFrame(but2, laybut); 275 } 276 277 void MGFadcDisp::CreateGui(const char *filename, const char *treename) 278 { 279 // 280 // Create the frame elements and add gui elements to it 281 // 282 TGVerticalFrame *frametop = new TGVerticalFrame(this, 300, 100); 283 AddTopFramePart1(frametop, filename, treename); 284 AddTopFramePart2(frametop); 285 286 TGHorizontal3DLine *line1 = new TGHorizontal3DLine(this); 287 288 TGHorizontalFrame *framemid = new TGHorizontalFrame(this, 300, 100); 289 AddMidFrame(framemid); 290 291 TGHorizontal3DLine *line2 = new TGHorizontal3DLine(this); 292 293 TGHorizontalFrame *framelow = new TGHorizontalFrame(this, 300, 100); 294 AddLowFrame(framelow); 295 296 // 297 // add frame elements to 'autodel' 298 // 299 fList->Add(frametop); 300 fList->Add(line1); 301 fList->Add(framemid); 302 fList->Add(line2); 303 fList->Add(framelow); 304 305 // 306 // Layout frame elements and add elements to frame 307 // 308 TGLayoutHints *laytop = new TGLayoutHints(kLHintsTop|kLHintsCenterX); 309 TGLayoutHints *layline = new TGLayoutHints(kLHintsTop|kLHintsExpandX); 310 TGLayoutHints *laymid = new TGLayoutHints(kLHintsExpandY|kLHintsExpandX); 311 TGLayoutHints *laylow = new TGLayoutHints(kLHintsTop); 312 313 fList->Add(laytop); 314 fList->Add(layline); 315 fList->Add(laymid); 316 fList->Add(laylow); 317 318 AddFrame(frametop, laytop); 319 AddFrame(line1, layline); 320 AddFrame(framemid, laymid); 321 AddFrame(line2, layline); 322 AddFrame(framelow, laylow); 323 } 324 325 void MGFadcDisp::SetupFileAccess(const char *filename, const char *treename) 326 { 327 // 328 // Create the file access elements 329 // 330 fEvtData = new MRawEvtData(); 331 332 pList = new MParList(); 333 pList->AddToList(fEvtData); 334 335 fReadTree = new MReadTree(treename, filename); 336 fReadTree->PreProcess(pList); 337 fReadTree->GetEvent(); 338 } 339 103 fMidFrame->AddFrame(prevpix, laybut); 104 fMidFrame->AddFrame(slider, layslider); 105 fMidFrame->AddFrame(nextpix, laybut); 106 } 107 108 // -------------------------------------------------------------------------- 109 // 110 // Constructor 111 // 340 112 MGFadcDisp::MGFadcDisp(char *filename, char *treename, 341 113 const TGWindow *p, const TGWindow *main, 342 114 UInt_t w, UInt_t h) 343 : TGTransientFrame(p, main, w, h) 344 { 345 346 // 347 // create an autodelete-list for the gui elements 348 // 349 fList = new TList; 350 fList->SetOwner(); 351 352 SetupFileAccess(filename, treename); 353 CreateGui(filename, treename); 115 : MGEvtDisplay(filename, treename, p, main, w, h) 116 { 117 // 118 // Add the missing GUI elements (pixellist, pixel number controls) 119 // 120 AddSetupElements(); 121 122 // 123 // preprocess eventloop and read in first event (process) 124 // 125 fEvtLoop->PreProcess(); 126 GetTaskList()->Process(); 354 127 355 128 // … … 362 135 Layout(); 363 136 364 SetWindowName("FadcDisplay"); 365 SetIconName("FadcDisp"); 137 SetWindowName("Fadc Event Display"); 138 SetIconName("Fadc"); 139 140 UpdateDisplay(); 141 UpdateNumOfEvts(); 142 UpdateEventCounter(); 366 143 367 144 MapWindow(); 368 145 369 CreatePixelList(); 370 UpdateEventCounter(); 371 } 372 373 374 MGFadcDisp::~MGFadcDisp() 375 { 376 // 377 // close the file 378 // 379 fReadTree->PostProcess(); 380 381 delete fEvtData; 382 delete pList; 383 384 delete fReadTree; 385 386 // 387 // destruct the graphical members 388 // 389 delete fList; 390 } 391 392 393 void MGFadcDisp::CloseWindow() 394 { 395 // Got close message for this MainFrame. Calls parent CloseWindow() 396 // (which destroys the window) and terminate the application. 397 // The close message is generated by the window manager when its close 398 // window menu item is selected. 399 400 delete this; 401 } 402 403 146 } 147 148 // -------------------------------------------------------------------------- 149 // 150 // return pointer to event data 151 // 152 MRawEvtData *MGFadcDisp::GetEvent() const 153 { 154 return (MRawEvtData*)GetParList()->FindObject("MRawEvtData"); 155 } 156 157 // -------------------------------------------------------------------------- 158 // 159 // after a new event is read in one has to update 160 // the list of pixels in the fPixelList (TGListBox) 161 // 404 162 void MGFadcDisp::CreatePixelList(Int_t lastsel) 405 163 { 406 // 407 // after a new event is read in one has to update 408 // the list of pixels in the fPixelList (TGListBox) 409 // 164 MRawEvtData *data = GetEvent(); 410 165 411 166 // 412 167 // put the selection of the last event in memory 413 168 // 414 MRawEvtPixelIter pixel( fEvtData);169 MRawEvtPixelIter pixel(data); 415 170 while (pixel.Next()) 416 171 { 417 char wortdummy[100];418 sprintf( wortdummy, "%d", pixel.GetPixelId());419 fPixelList->AddEntry( wortdummy, pixel.GetPixelId());172 char txt[100]; 173 sprintf(txt, "%d", pixel.GetPixelId()); 174 fPixelList->AddEntry(txt, pixel.GetPixelId()); 420 175 } 421 176 … … 433 188 pixel.Reset(); 434 189 lastsel=pixel.GetPixelId(); 435 436 190 } 437 191 438 char wortdummy[100];439 sprintf( wortdummy, "GRAPH%d", lastsel);440 fEvtData->Draw(wortdummy);192 char txt[100]; 193 sprintf(txt, "GRAPH%d", lastsel); 194 data->Draw(txt); 441 195 fPixelList->Select(lastsel, kTRUE); 442 196 … … 445 199 } 446 200 447 void MGFadcDisp::UpdateEventCounter() 448 { 449 // Update the event counter 450 451 char wortdummy[256]; 452 453 sprintf(wortdummy, "%d", fReadTree->GetEventNum()); 454 455 fTxtEvtNr->SetText(wortdummy); 456 } 457 458 void MGFadcDisp::ReadinEvent(UInt_t iEvt) 459 { 460 Int_t buttons = 4; 461 Int_t retval = 0; 462 463 // first check if the new event is in the range of possible events 464 465 if (iEvt >= fReadTree->GetEntries()) 466 { 467 new TGMsgBox(fClient->GetRoot(), this, 468 "WARNING!", 469 "The event number is out of range!!!", 470 kMBIconExclamation, buttons, &retval); 471 } 472 else 473 { 474 const Int_t lastsel = fPixelList->GetSelected(); 475 476 fPixelList->RemoveEntries(0, fEvtData->GetNumPixels()); 477 478 fReadTree->SetEventNum(iEvt); 479 fReadTree->GetEvent(); 480 481 CreatePixelList(lastsel); 482 } 483 484 UpdateEventCounter(); 485 } 486 201 // -------------------------------------------------------------------------- 202 // 203 // Update the contents of the canvas 204 // 205 void MGFadcDisp::UpdateDisplay() 206 { 207 const Int_t lastsel = fPixelList->GetSelected(); 208 209 fPixelList->RemoveEntries(0, GetEvent()->GetNumPixels()); 210 211 CreatePixelList(lastsel); 212 } 213 214 // -------------------------------------------------------------------------- 215 // 216 // Display another pixel 217 // 487 218 void MGFadcDisp::DisplayPix(UInt_t i) 488 219 { 489 char wortdummy[256]; 490 491 sprintf(wortdummy, "GRAPH%d", i); 220 MRawEvtData *data = GetEvent(); 492 221 493 222 fCanvas->Clear(); 494 223 fCanvas->cd(); 495 224 496 fEvtData->Draw(wortdummy); 225 char txt[256]; 226 sprintf(txt, "GRAPH%d", i); 227 data->Draw(txt); 497 228 498 229 fCanvas->Modified(); … … 502 233 // FIXME: too complicated! 503 234 // 504 fPixelList->RemoveEntries(0, fEvtData->GetNumPixels());235 fPixelList->RemoveEntries(0, data->GetNumPixels()); 505 236 CreatePixelList(i); 506 237 } 507 238 239 // -------------------------------------------------------------------------- 240 // 241 // ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) 242 // 243 // Processes information from all GUI items. 244 // Selecting an item usually generates an event with 4 parameters. 245 // The first two are packed into msg (first and second bytes). 246 // The other two are parm1 and parm2. 247 // 508 248 Bool_t MGFadcDisp::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) 509 249 { 510 //------------------------------------------------------------------511 //512 // ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)513 //514 // Processes information from all GUI items.515 // Selecting an item usually generates an event with 4 parameters.516 // The first two are packed into msg (first and second bytes).517 // The other two are parm1 and parm2.518 //519 //------------------------------------------------------------------520 521 250 switch(GET_MSG(msg)) 522 251 { … … 527 256 switch (parm1) 528 257 { 529 case M_PREVEVT:530 ReadinEvent(fReadTree->GetEventNum()-1);531 return kTRUE;532 533 case M_NEXTEVT:534 ReadinEvent(fReadTree->GetEventNum()+1);535 return kTRUE;536 537 258 case M_PREVPIXEL: 538 259 DisplayPix(fPixelList->GetSelected()-1); … … 542 263 DisplayPix(fPixelList->GetSelected()+1); 543 264 return kTRUE; 544 545 case M_PRINT:546 cout << "Sorry, not yet implemented!" << endl;547 return kTRUE;548 549 case M_CLOSE:550 CloseWindow();551 return kTRUE;552 265 } 553 return kTRUE;266 break; 554 267 555 268 case kCM_LISTBOX: 556 269 if (parm1 != M_PIXELLIST) 557 return kTRUE;270 break; 558 271 559 272 DisplayPix(fPixelList->GetSelected()); 560 273 return kTRUE; 561 274 } 562 return kTRUE; 563 564 case kC_TEXTENTRY: 565 if (GET_SUBMSG(msg) == kTE_ENTER) 566 ReadinEvent(atoi(fTxtEvtNr->GetText())); 567 568 return kTRUE; 275 break; 569 276 } 570 277 571 return kTRUE;572 } 278 return MGEvtDisplay::ProcessMessage(msg, parm1, parm2); 279 } -
trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.h
r957 r959 6 6 #endif 7 7 8 #ifndef ROOT_TGFrame9 #include <TGFrame.h>8 #ifndef MGEVTDISPLAY_H 9 #include "MGEvtDisplay.h" 10 10 #endif 11 11 12 class MParList; 13 class MReadTree; 12 class TGListBox; 14 13 class MRawEvtData; 15 14 16 class TList; 17 class TCanvas; 18 class TGListBox; 19 class TGTextEntry; 20 21 class MGFadcDisp : public TGTransientFrame 15 class MGFadcDisp : public MGEvtDisplay 22 16 { 23 17 private: 24 //25 // GUI stuff26 //27 TList *fList;28 29 TGTextEntry *fTxtEvtNr;30 18 TGListBox *fPixelList; 31 19 32 TCanvas *fCanvas; 20 void AddSetupElements(); 21 void DisplayPix(UInt_t i); 22 void UpdateDisplay(); 23 void CreatePixelList(Int_t lastsel=-1); 33 24 34 void AddTopFramePart1(TGVerticalFrame *frame, 35 const char *filename, 36 const char *treename); 37 void AddTopFramePart2(TGVerticalFrame *frame); 38 void AddMidFrame(TGHorizontalFrame *frame); 39 void AddLowFrame(TGHorizontalFrame *frame); 40 41 void CreateGui(const char *filename, const char *treename); 42 void SetupFileAccess(const char *filename, const char *treename); 43 44 // 45 // File Access stuff 46 // 47 MParList *pList; 48 MRawEvtData *fEvtData; 49 MReadTree *fReadTree; 50 51 void ReadinEvent(UInt_t iEvt); 52 void DisplayPix(UInt_t i); 25 MRawEvtData *GetEvent() const; 53 26 54 27 public: … … 56 29 MGFadcDisp(char *filename, char *treename, 57 30 const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h); 58 59 ~MGFadcDisp();60 61 void CloseWindow();62 63 void CreatePixelList(Int_t lastsel=-1);64 void UpdateEventCounter();65 31 66 32 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2); -
trunk/MagicSoft/Mars/meventdisp/Makefile
r665 r959 22 22 # connect the include files defined in the config.mk file 23 23 # 24 INCLUDES = -I. -I../mbase -I../mraw 24 INCLUDES = -I. -I../mbase -I../mraw -I../mgui -I../manalysis 25 25 26 26 #------------------------------------------------------------------------------ … … 28 28 .SUFFIXES: .c .cc .cxx .h .hxx .o 29 29 30 SRCFILES = MGFadcDisp.cc 30 SRCFILES = MGEvtDisplay.cc \ 31 MGFadcDisp.cc \ 32 MGCamDisplay.cc 31 33 32 34 SRCS = $(SRCFILES) -
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r859 r959 12 12 #include "MGeomCam.h" 13 13 14 #include "MCerPhotEvt.h" 14 #include "MCerPhotEvt.h" 15 15 16 16 #define kITEMS_LEGEND 25 17 17 18 ClassImp(MCamDisplay) 19 20 MCamDisplay::MCamDisplay (MGeomCam *geom) : fAutoScale(kTRUE) 21 { 22 // default constructor 23 18 ClassImp(MCamDisplay); 19 20 // ------------------------------------------------------------------------ 21 // 22 // default constructor 23 // 24 MCamDisplay::MCamDisplay(MGeomCam *geom) : fAutoScale(kTRUE) 25 { 24 26 // 25 27 // set the color palette 26 28 // 27 gStyle->SetPalette(1, 0);29 gStyle->SetPalette(1, 0); 28 30 29 31 // 30 32 // create the hexagons of the display 31 33 // 32 fNumPixels = geom->GetNumPixels() 33 fPixels = new TClonesArray("MHexagon", fNumPixels );34 35 for (UInt_t i=0; i< fNumPixels; i++)36 (*fPixels)[i] = new MHexagon((*geom)[i]) 34 fNumPixels = geom->GetNumPixels(); 35 fPixels = new TClonesArray("MHexagon", fNumPixels); 36 37 for (UInt_t i=0; i<fNumPixels; i++) 38 (*fPixels)[i] = new MHexagon((*geom)[i]); 37 39 38 40 // 39 41 // set the range to default 40 42 // 41 fMinPhe = -2.;42 fMaxPhe = 50.;43 fMinPhe = -2.; 44 fMaxPhe = 50.; 43 45 44 46 // 45 47 // set up the Legend 46 48 // 47 fLegend = new TClonesArray("TBox", kITEMS_LEGEND );48 fLegText = new TClonesArray("TText", kITEMS_LEGEND );49 50 char text[10] 51 for ( Int_t il = 0 ; il < kITEMS_LEGEND ; il++)49 fLegend = new TClonesArray("TBox", kITEMS_LEGEND); 50 fLegText = new TClonesArray("TText", kITEMS_LEGEND); 51 52 char text[10]; 53 for (Int_t il = 0; il<kITEMS_LEGEND; il++) 52 54 { 53 55 const Int_t y = il*40; 54 56 55 TBox *newbox = new TBox (650, y-500, 700, y-460 56 TText *newtxt = new TText(720, y-480, text 57 TBox *newbox = new TBox (650, y-500, 700, y-460); 58 TText *newtxt = new TText(720, y-480, text); 57 59 58 60 const Float_t lvl = 50. / kITEMS_LEGEND * il; 59 61 60 newbox->SetFillColor( GetColor(lvl));61 62 sprintf ( text, "%5.1f", lvl );63 64 newtxt->SetTextSize (0.025);65 newtxt->SetTextAlign(12) 62 newbox->SetFillColor(GetColor(lvl)); 63 64 sprintf(text, "%5.1f", lvl); 65 66 newtxt->SetTextSize(0.025); 67 newtxt->SetTextAlign(12); 66 68 67 69 (*fLegend) [il] = newbox; … … 70 72 } 71 73 72 MCamDisplay::~MCamDisplay() 73 { 74 delete fPixels ; 75 } 76 77 78 void MCamDisplay::Init() 79 { 80 // 81 // Set the right colors 82 83 gStyle->SetPalette(1, 0) ; 84 74 // ------------------------------------------------------------------------ 75 // 76 // 77 MCamDisplay::~MCamDisplay() 78 { 79 delete fPixels; 80 } 81 82 // ------------------------------------------------------------------------ 83 // 84 // 85 void MCamDisplay::Draw(Option_t *option) 86 { 85 87 // 86 88 // if no canvas is yet existing to draw into, create a new one 87 89 // 88 if (!gPad) new TCanvas("display", "MAGIC display", 0, 0, 650, 500); 89 90 // 91 // draw all pixels of the camera 90 if (!gPad) 91 new TCanvas("CamDisplay", "Magic Camera Display", 0, 0, 650, 500); 92 else 93 gPad->Clear(); 94 95 // 96 // Setup the correct environment 97 // 98 gStyle->SetPalette(1, 0); 99 100 gPad->Range(-600, -600, 900, 600); 101 gPad->SetFillColor(22); 102 103 // 104 // Draw all pixels of the camera 105 // (means apend all pixelobjects to the current pad) 92 106 // 93 107 for (UInt_t i=0; i<fNumPixels; i++) … … 102 116 GetText(i)->Draw(); 103 117 } 104 } 105 106 107 void MCamDisplay::Draw(Option_t *option ) 108 { 109 // 110 111 // 112 // check if there a pad exists, if not create one 113 // 114 if ( !gPad ) Init() ; 115 116 // 117 // set init values 118 // 119 gPad->Range (-600, -600, 900, 600) ; 120 gPad->SetFillColor(22) ; 121 122 // 123 // mark pad as modified and update screen 124 // 125 gPad->Modified() ; 126 gPad->Update() ; 127 } 128 129 void MCamDisplay::DrawPhotNum( MCerPhotEvt *event) 118 } 119 120 // ------------------------------------------------------------------------ 121 // 122 // 123 void MCamDisplay::DrawPhotNum(const MCerPhotEvt *event) 130 124 { 131 125 … … 134 128 // determine the Pixel Id and the content 135 129 // 136 Reset() 130 Reset(); 137 131 138 132 // … … 140 134 // each event 141 135 // 142 if ( fAutoScale)143 { 144 fMinPhe = event->GetNumPhotonsMin() 145 fMaxPhe = event->GetNumPhotonsMax() 136 if (fAutoScale) 137 { 138 fMinPhe = event->GetNumPhotonsMin(); 139 fMaxPhe = event->GetNumPhotonsMax(); 146 140 147 141 if (fMaxPhe < 20.) 148 fMaxPhe = 20. 149 150 UpdateLegend() 142 fMaxPhe = 20.; 143 144 UpdateLegend(); 151 145 } 152 146 … … 156 150 const Int_t entries = event->GetNumPixels(); 157 151 158 for (Int_t i=0 ; i<entries; i++)152 for (Int_t i=0; i<entries; i++) 159 153 { 160 154 MCerPhotPix &pix = (*event)[i]; … … 167 161 168 162 // 169 // update the picture 170 // 171 Draw() ; 172 } 173 174 void MCamDisplay::DrawPhotErr( MCerPhotEvt *event) 163 // Update display physically 164 // 165 gPad->Modified(); 166 gPad->Update(); 167 } 168 169 // ------------------------------------------------------------------------ 170 // 171 // 172 void MCamDisplay::DrawPhotErr(const MCerPhotEvt *event) 175 173 { 176 174 // 177 175 // reset the all pixel colors to a default value 178 176 // 179 Reset() 177 Reset(); 180 178 181 179 // … … 183 181 // determine the Pixel Id and the content 184 182 // 185 const Int_t entries = event->GetNumPixels() 186 187 for (Int_t i=0 ; i<entries; i++ 183 const Int_t entries = event->GetNumPixels(); 184 185 for (Int_t i=0 ; i<entries; i++) 188 186 { 189 187 MCerPhotPix &pix = (*event)[i]; … … 193 191 194 192 // 195 // update display 196 // 197 Draw() ; 198 } 199 200 201 void MCamDisplay::Reset() 202 { 203 // 204 // reset the all pixel colors to a default value 205 // 206 for ( UInt_t i=0 ; i< fNumPixels ; i++ ) 207 (*this)[i].SetFillColor(10) ; 193 // Update display physically 194 // 195 gPad->Modified(); 196 gPad->Update(); 197 } 198 199 200 // ------------------------------------------------------------------------ 201 // 202 // reset the all pixel colors to a default value 203 // 204 void MCamDisplay::Reset() 205 { 206 for (UInt_t i=0; i<fNumPixels; i++) 207 (*this)[i].SetFillColor(10); 208 208 } 209 209 210 // ------------------------------------------------------------------------ 211 // 212 // Here we calculate the color index for the current value. 213 // The color index is defined with the class TStyle and the 214 // Color palette inside. We use the command gStyle->SetPalette(1,0) 215 // for the display. So we have to convert the value "wert" into 216 // a color index that fits the color palette. 217 // The range of the color palette is defined by the values fMinPhe 218 // and fMaxRange. Between this values we have 50 color index, starting 219 // with 0 up to 49. 220 // 210 221 Int_t MCamDisplay::GetColor(Float_t val) 211 222 { 212 223 // 213 // Here we calculate the color index for the current value.214 // The color index is defined with the class TStyle and the215 // Color palette inside. We use the command gStyle->SetPalette(1,0)216 // for the display. So we have to convert the value "wert" into217 // a color index that fits the color palette.218 // The range of the color palette is defined by the values fMinPhe219 // and fMaxRange. Between this values we have 50 color index, starting220 // with 0 up to 49.221 //222 223 //224 224 // first treat the over- and under-flows 225 225 // 226 226 const Float_t maxcolidx = 49.0; 227 227 228 if (val >= fMaxPhe 228 if (val >= fMaxPhe) 229 229 return gStyle->GetColorPalette(maxcolidx); 230 230 231 if (val <= fMinPhe 232 return gStyle->GetColorPalette( 0);231 if (val <= fMinPhe) 232 return gStyle->GetColorPalette(0); 233 233 234 234 // … … 236 236 // 237 237 const Float_t ratio = (val-fMinPhe) / (fMaxPhe-fMinPhe); 238 const Int_t colidx = (Int_t)(maxcolidx*ratio + .5) 239 240 return gStyle->GetColorPalette(colidx) 241 } 242 243 void MCamDisplay::UpdateLegend() 244 { 245 // 246 // change the text on the legend according to the range of the 247 // Display 248 // 249 250 char text[10] 238 const Int_t colidx = (Int_t)(maxcolidx*ratio + .5); 239 240 return gStyle->GetColorPalette(colidx); 241 } 242 243 // ------------------------------------------------------------------------ 244 // 245 // change the text on the legend according to the range of the 246 // Display 247 // 248 void MCamDisplay::UpdateLegend() 249 { 250 char text[10]; 251 251 252 252 for (Int_t il=0; il < kITEMS_LEGEND; il++) … … 258 258 TText &txt = *GetText(il); 259 259 260 txt.SetText(txt.GetX(), txt.GetY(), text) 261 } 262 } 260 txt.SetText(txt.GetX(), txt.GetY(), text); 261 } 262 } -
trunk/MagicSoft/Mars/mgui/MCamDisplay.h
r715 r959 27 27 class MCamDisplay : public TObject 28 28 { 29 private: 30 29 private: 30 Bool_t fAutoScale; // indicating the autoscale function 31 31 32 33 TClonesArray *fPixels;32 UInt_t fNumPixels; 33 TClonesArray *fPixels; 34 34 35 36 35 Float_t fMinPhe; // The minimal number of Phe 36 Float_t fMaxPhe; // The maximum number of Phe 37 37 38 39 38 TClonesArray *fLegend; 39 TClonesArray *fLegText; 40 40 41 42 41 TBox *GetBox(Int_t i) { return (TBox*) fLegend->At(i); } 42 TText *GetText(Int_t i) { return (TText*)fLegText->At(i); } 43 43 44 45 46 47 44 void SetPixColor(MCerPhotPix &pix) 45 { 46 (*this)[pix.GetPixId()].SetFillColor( GetColor(pix.GetNumPhotons())); 47 } 48 48 49 49 public: … … 51 51 MCamDisplay (MGeomCam *geom); 52 52 53 ~MCamDisplay 53 ~MCamDisplay(); 54 54 55 void Init();55 void Draw(Option_t *option = ""); 56 56 57 void Draw(Option_t *option = "" ); 58 59 void DrawPhotNum( MCerPhotEvt *event); 60 void DrawPhotErr( MCerPhotEvt *event); 57 void DrawPhotNum(const MCerPhotEvt *event); 58 void DrawPhotErr(const MCerPhotEvt *event); 61 59 62 60 void Reset(); … … 64 62 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); } 65 63 66 Int_t GetColor( Float_t wert);64 Int_t GetColor(Float_t wert); 67 65 68 66 void UpdateLegend(); 69 67 70 void SetAutoScale (Bool_t input = kTRUE)68 void SetAutoScale(Bool_t input = kTRUE) 71 69 { 72 70 fAutoScale = input; -
trunk/MagicSoft/Mars/mgui/MHexagon.cc
r849 r959 30 30 #include "MHexagon.h" 31 31 32 #include <iostream.h> 33 32 34 #include <TVirtualPad.h> // gPad 33 35 34 36 #include "MGeomPix.h" // GetX 35 37 36 ClassImp(MHexagon) 37 38 MHexagon::MHexagon() 39 { 40 // default constructor for MHexagon 41 38 ClassImp(MHexagon); 39 40 // ------------------------------------------------------------------------ 41 // 42 // default constructor for MHexagon 43 // 44 MHexagon::MHexagon() 45 { 46 } 47 48 // ------------------------------------------------------------------------ 49 // 50 // normal constructor for MHexagon 51 // 52 MHexagon::MHexagon(Float_t x, Float_t y, Float_t d) 53 : TAttFill(0, 1001), fX(x), fY(y), fD(d) 54 { 55 } 56 57 // ------------------------------------------------------------------------ 58 // 59 // normal constructor for MHexagon 60 // 61 MHexagon::MHexagon(MGeomPix &pix) 62 : TAttFill(0, 1001) 63 { 64 fX = pix.GetX(); 65 fY = pix.GetY(); 66 fD = pix.GetR(); 67 } 68 69 // ------------------------------------------------------------------------ 70 // 71 // copy constructor for MHexagon 72 // 73 MHexagon::MHexagon(const MHexagon &hexagon) 74 { 75 ((MHexagon&) hexagon).Copy(*this); 42 76 } 43 77 44 MHexagon::MHexagon(Float_t x, Float_t y, Float_t d ) 45 : TAttFill(0, 1001), fX(x), fY(y), fD(d) 46 { 47 // normal constructor for MHexagon 48 } 49 50 MHexagon::MHexagon(MGeomPix &pix) 51 : TAttFill(0, 1001) 52 { 53 // normal constructor for MHexagon 54 fX = pix.GetX(); 55 fY = pix.GetY(); 56 fD = pix.GetR(); 57 } 58 59 MHexagon::MHexagon( const MHexagon &hexagon) 60 { 61 // copy constructor for MHexagon 62 ((MHexagon&) hexagon).Copy(*this) ; 63 } 64 78 // ------------------------------------------------------------------------ 79 // 80 // default destructor for MHexagon 81 // 65 82 MHexagon::~MHexagon() 66 { 67 // default destructor for MHexagon 68 } 69 70 void MHexagon::Copy( TObject &obj ) 71 { 72 // copy this hexagon to hexagon 83 { 84 } 85 86 // ------------------------------------------------------------------------ 87 // 88 // copy this hexagon to hexagon 89 // 90 void MHexagon::Copy(TObject &obj) 91 { 73 92 MHexagon &hex = (MHexagon&) obj; 74 93 … … 77 96 TAttFill::Copy(hex); 78 97 79 hex.fX = fX ; 80 hex.fY = fY ; 81 hex.fD = fD ; 82 } 83 Int_t MHexagon::DistancetoPrimitive( Int_t px, Int_t py ) 84 { 85 // compute the distance of a point (px,py) to the Hexagon 86 // this functions needed for graphical primitives, that 87 // means without this function you are not able to interact 88 // with the graphical primitive with the mouse!!! 89 // 90 // All calcutations are running in pixel coordinates 91 92 // compute the distance of the Point to the center of the Hexagon 93 94 const Int_t pxhex = gPad->XtoAbsPixel( fX ) ; 95 const Int_t pyhex = gPad->YtoAbsPixel( fY ) ; 96 97 const Double_t DistPointHexagon = TMath::Sqrt( Double_t ((pxhex-px)*(pxhex-px) + (pyhex-py)*(pyhex-py))) ; 98 const Double_t cosa = TMath::Abs(px-pxhex) / DistPointHexagon ; 99 const Double_t sina = TMath::Abs(py-pyhex) / DistPointHexagon ; 100 101 // comput the distance to pixel border 102 103 const Double_t dx = fD * cosa / 2 ; 104 const Double_t dy = fD * sina / 2 ; 105 106 const Double_t xborder = fX + dx ; 107 const Double_t yborder = fY + dy ; 108 109 const Int_t pxborder = gPad->XtoAbsPixel( xborder ) ; 110 const Int_t pyborder = gPad->YtoAbsPixel( yborder ) ; 111 112 const Double_t DistBorderHexagon = TMath::Sqrt( Double_t ((pxborder-pxhex)*(pxborder-pxhex)+(pyborder-pyhex)*(pyborder-pyhex))) ; 113 114 115 // compute the distance from the border of Pixel 116 // here in the first implementation is just circle inside 117 118 return DistBorderHexagon < DistPointHexagon ? 999999 : 0; 119 } 120 121 void MHexagon::DrawHexagon( Float_t x, Float_t y, Float_t d ) 98 hex.fX = fX; 99 hex.fY = fY; 100 hex.fD = fD; 101 } 102 103 // ------------------------------------------------------------------------ 104 // 105 // compute the distance of a point (px,py) to the Hexagon 106 // this functions needed for graphical primitives, that 107 // means without this function you are not able to interact 108 // with the graphical primitive with the mouse!!! 109 // 110 // All calcutations are running in pixel coordinates 111 // 112 Int_t MHexagon::DistancetoPrimitive(Int_t px, Int_t py) 113 { 114 // 115 // compute the distance of the Point to the center of the Hexagon 116 // 117 const Int_t pxhex = gPad->XtoAbsPixel(fX); 118 const Int_t pyhex = gPad->YtoAbsPixel(fY); 119 120 const Double_t disthex = TMath::Sqrt((Double_t)((pxhex-px)*(pxhex-px) + (pyhex-py)*(pyhex-py))); 121 122 const Double_t cosa = TMath::Abs(px-pxhex) / disthex; 123 const Double_t sina = TMath::Abs(py-pyhex) / disthex; 124 125 // 126 // comput the distance to pixel border 127 // 128 const Double_t dx = fD * cosa / 2; 129 const Double_t dy = fD * sina / 2; 130 131 const Double_t xborder = fX + dx; 132 const Double_t yborder = fY + dy; 133 134 const Int_t pxborder = gPad->XtoAbsPixel(xborder); 135 const Int_t pyborder = gPad->YtoAbsPixel(yborder); 136 137 const Double_t distborder = TMath::Sqrt((Double_t)((pxborder-pxhex)*(pxborder-pxhex)+(pyborder-pyhex)*(pyborder-pyhex))); 138 139 // 140 // compute the distance from the border of Pixel 141 // here in the first implementation is just circle inside 142 // 143 return distborder < disthex ? 999999 : 0; 144 } 145 146 // ------------------------------------------------------------------------ 147 // 148 // Draw this ellipse with new coordinate 149 // 150 void MHexagon::DrawHexagon(Float_t x, Float_t y, Float_t d) 122 151 { 123 // Draw this ellipse with new coordinate 124 125 MHexagon *newhexagon = new MHexagon(x, y, d ) ; 126 TAttLine::Copy(*newhexagon) ; 127 TAttFill::Copy(*newhexagon) ; 128 129 newhexagon->SetBit (kCanDelete) ; 130 newhexagon->AppendPad() ; 131 } 132 133 void MHexagon::ExecuteEvent(Int_t event, Int_t px, Int_t py ) { 134 // This is the first test of implementing a clickable interface 135 // for one pixel 136 137 switch ( event ) { 138 139 case kButton1Down: 140 141 printf ("\n kButton1Down \n" ) ; 142 SetFillColor(2) ; 143 gPad->Modified() ; 144 break; 145 146 case kButton1Double: 147 SetFillColor(0) ; 148 gPad->Modified() ; 149 break; 150 // case kMouseEnter: 151 // printf ("\n Mouse inside object \n" ) ; 152 // break; 153 } 154 155 } 156 157 158 159 void MHexagon::ls( Option_t *) 160 { 161 // list this hexagon with its attributes 162 TROOT::IndentLevel() ; 163 printf ("%s: X= %f Y= %f R= %f \n", GetName(), fX, fY, fD ) ; 164 } 165 166 void MHexagon::Paint(Option_t * ) 167 { 168 // paint this hexagon with its attribute 169 170 PaintHexagon(fX, fY, fD ) ; 171 } 172 173 174 void MHexagon::PaintHexagon (Float_t inX, Float_t inY, Float_t inD ) 152 MHexagon *newhexagon = new MHexagon(x, y, d); 153 154 TAttLine::Copy(*newhexagon); 155 TAttFill::Copy(*newhexagon); 156 157 newhexagon->SetBit(kCanDelete); 158 newhexagon->AppendPad(); 159 } 160 161 // ------------------------------------------------------------------------ 162 // 163 // This is the first test of implementing a clickable interface 164 // for one pixel 165 // 166 void MHexagon::ExecuteEvent(Int_t event, Int_t px, Int_t py) 167 { 168 169 switch (event) 170 { 171 case kButton1Down: 172 cout << endl << "kButton1Down" << endl; 173 SetFillColor(2); 174 gPad->Modified(); 175 break; 176 177 case kButton1Double: 178 SetFillColor(0); 179 gPad->Modified(); 180 break; 181 // case kMouseEnter: 182 // printf ("\n Mouse inside object \n" ) ; 183 // break; 184 } 185 } 186 187 // ------------------------------------------------------------------------ 188 // 189 // list this hexagon with its attributes 190 // 191 void MHexagon::ls(Option_t *) 192 { 193 TROOT::IndentLevel(); 194 Print(); 195 } 196 197 // ------------------------------------------------------------------------ 198 // 199 // paint this hexagon with its attribute 200 // 201 void MHexagon::Paint(Option_t *) 202 { 203 PaintHexagon(fX, fY, fD); 204 } 205 206 // ------------------------------------------------------------------------ 207 // 208 // draw this hexagon with the coordinates 209 // 210 void MHexagon::PaintHexagon(Float_t inX, Float_t inY, Float_t inD) 175 211 { 176 // draw this hexagon with the coordinates 177 178 const Int_t np = 6 ; 179 180 const Float_t dx[np+1] = { .5 , 0. , -.5 , -.5 , 0. , .5 , .5 } ; 181 const Float_t dy[np+1] = { .2886, .5772, .2886, -.2886, -.5772, -.2886, .2886 } ; 182 183 static Float_t x[np+1], y[np+1] ; 184 185 TAttLine::Modify() ; // Change line attributes only if neccessary 186 TAttFill::Modify() ; // Change fill attributes only if neccessary 187 188 // calculate the positions of the pixel corners 189 190 for ( Int_t i=0; i<=np; i++ ) { 191 x[i] = inX + dx[i]* inD ; 192 y[i] = inY + dy[i]* inD ; 193 } 194 195 // paint the pixel (hopefully) 196 197 if ( GetFillColor() ) gPad->PaintFillArea(np, x, y) ; 198 if ( GetLineStyle() ) gPad->PaintPolyLine(np+1, x, y) ; 199 200 } 201 202 void MHexagon::Print( Option_t * ) 203 { 204 // print/dump this hexagon with its attributes 205 printf ("Ellipse: X= %f Y= %f R= %f ", fX, fY, fD ) ; 206 207 if ( GetLineColor() != 1 ) printf (" Color=%d", GetLineColor() ) ; 208 if ( GetLineStyle() != 1 ) printf (" Color=%d", GetLineStyle() ) ; 209 if ( GetLineWidth() != 1 ) printf (" Color=%d", GetLineWidth() ) ; 210 211 if ( GetFillColor() != 0 ) printf (" FillColor=%d", GetFillColor() ) ; 212 213 printf ("\n") ; 214 } 215 216 217 218 219 220 212 213 const Int_t np = 6; 214 215 const Float_t dx[np+1] = { .5 , 0. , -.5 , -.5 , 0. , .5 , .5 }; 216 const Float_t dy[np+1] = { .2886, .5772, .2886, -.2886, -.5772, -.2886, .2886 }; 217 218 static Float_t x[np+1], y[np+1]; 219 220 TAttLine::Modify(); // Change line attributes only if neccessary 221 TAttFill::Modify(); // Change fill attributes only if neccessary 222 223 // calculate the positions of the pixel corners 224 225 for (Int_t i=0; i<=np; i++) 226 { 227 x[i] = inX + dx[i]* inD; 228 y[i] = inY + dy[i]* inD; 229 } 230 231 // paint the pixel (hopefully) 232 233 if (GetFillColor()) 234 gPad->PaintFillArea(np, x, y); 235 236 if (GetLineStyle()) 237 gPad->PaintPolyLine(np+1, x, y); 238 239 } 240 241 // ------------------------------------------------------------------------ 242 // 243 // print/dump this hexagon with its attributes 244 // 245 void MHexagon::Print(Option_t *) 246 { 247 cout << GetName() << ": X=" << fX << " Y=" << fY << "R=" << fD << endl; 248 249 cout << " Color=" << GetLineColor() << endl; 250 cout << " Style=" << GetLineStyle() << endl; 251 cout << " Width=" << GetLineWidth() << endl; 252 cout << " FillColor=" << GetFillColor() << endl; 253 } -
trunk/MagicSoft/Mars/mhist/MHFadcPix.cc
r859 r959 46 46 { 47 47 // FIXME! Set the right axis titles and ... and ... 48 Char_t tmp1[40] ="hi";49 Char_t tmp2[40] ="hi gain Pixel";48 Char_t tmp1[40]; 49 Char_t tmp2[40]; 50 50 51 if (pixid)52 {53 sprintf(tmp1, "%s%d", tmp1, pixid);54 sprintf(tmp2, "%s %d", tmp2, pixid);55 }51 // if (pixid) 52 // { 53 sprintf(tmp1, "HiGain%03d", pixid); 54 sprintf(tmp2, "Hi Gain Pixel #%d", pixid); 55 // } 56 56 fHistHi = new TH1F(tmp1, tmp2, 256, 0, 255); 57 57 58 59 Char_t tmp3[40]="lo"; 60 Char_t tmp4[40]="lo gain Pixel"; 61 62 if (pixid) 63 { 64 sprintf(tmp3, "%s%d", tmp3, pixid); 65 sprintf(tmp4, "%s %d", tmp4, pixid); 66 } 67 fHistLo = new TH1F(tmp3, tmp4, 256, 0, 255); 58 // if (pixid) 59 // { 60 sprintf(tmp1, "LoGain%03d", pixid); 61 sprintf(tmp2, "Lo Gain Pixel #%d", pixid); 62 // } 63 fHistLo = new TH1F(tmp2, tmp2, 256, 0, 255); 68 64 } 69 65 -
trunk/MagicSoft/Mars/mhist/MHHillas.cc
r957 r959 132 132 void MHHillas::Draw(Option_t *) 133 133 { 134 if (!gPad) 135 { 136 if (!gROOT->GetMakeDefCanvas()) 137 return; 138 (gROOT->GetMakeDefCanvas())(); 139 } 134 140 135 // 136 // Fixme! Check for an existing canvas. 137 // And create one if no canvas exists only! 138 // 139 TCanvas *c = new TCanvas("Hillas", "Histograms of Hillas Parameters"); 140 c->Divide(2,2); 141 //TCanvas *c = new TCanvas("Hillas", "Histograms of Hillas Parameters"); 142 gPad->Divide(2,2); 141 143 142 c->cd(1);144 gPad->cd(1); 143 145 fAlpha->Draw(); 144 146 145 c->cd(2);147 gPad->cd(2); 146 148 fLength->Draw(); 147 149 148 c->cd(3);150 gPad->cd(3); 149 151 fDist->Draw(); 150 152 151 c->cd(4);153 gPad->cd(4); 152 154 fWidth->Draw(); 153 155 154 c->Modified();155 c->Update();156 gPad->Modified(); 157 gPad->Update(); 156 158 } -
trunk/MagicSoft/Mars/mhist/MHMcCollectionArea.cc
r957 r959 110 110 void MHMcCollectionArea::DrawAll(Option_t* option) 111 111 { 112 TCanvas *c=new TCanvas(fHistAll->GetName(), fHistAll->GetTitle()); 112 if (!gPad) 113 { 114 if (!gROOT->GetMakeDefCanvas()) 115 return; 116 (gROOT->GetMakeDefCanvas())(); 117 } 118 119 //TCanvas *c=new TCanvas(fHistAll->GetName(), fHistAll->GetTitle()); 113 120 114 121 fHistAll->Draw(option); 115 122 116 c->Modified();117 c->Update();123 gPad->Modified(); 124 gPad->Update(); 118 125 } 119 126 … … 124 131 void MHMcCollectionArea::DrawSel(Option_t* option) 125 132 { 126 TCanvas *c=new TCanvas(fHistSel->GetName(), fHistSel->GetTitle()); 133 if (!gPad) 134 { 135 if (!gROOT->GetMakeDefCanvas()) 136 return; 137 (gROOT->GetMakeDefCanvas())(); 138 } 139 140 //TCanvas *c=new TCanvas(fHistSel->GetName(), fHistSel->GetTitle()); 127 141 128 142 fHistSel->Draw(option); 129 143 130 c->Modified();131 c->Update();144 gPad->Modified(); 145 gPad->Update(); 132 146 } 133 147 … … 157 171 void MHMcCollectionArea::Draw(Option_t* option) 158 172 { 159 TCanvas *c=new TCanvas(fHistCol->GetName(), fHistCol->GetTitle()); 173 if (!gPad) 174 { 175 if (!gROOT->GetMakeDefCanvas()) 176 return; 177 (gROOT->GetMakeDefCanvas())(); 178 } 179 // TCanvas *c=new TCanvas(fHistCol->GetName(), fHistCol->GetTitle()); 160 180 161 181 fHistCol->Draw(option); 162 182 163 c->Modified();164 c->Update();183 gPad->Modified(); 184 gPad->Update(); 165 185 } 166 186 -
trunk/MagicSoft/Mars/mhist/MHMcEnergy.cc
r954 r959 133 133 } 134 134 135 // ------------------------------------------------------------------------ 136 // 137 // Helper function for Draw() and DrawClone() which adds some useful 138 // information to the plot. 139 // 135 140 void MHMcEnergy::DrawLegend() const 136 141 { … … 157 162 void MHMcEnergy::Draw(Option_t *option) 158 163 { 159 TCanvas *c=new TCanvas(fHist->GetName(), fHist->GetTitle()); 164 if (!gPad) 165 { 166 if (!gROOT->GetMakeDefCanvas()) 167 return; 168 (gROOT->GetMakeDefCanvas())(); 169 } 170 //TCanvas *c=new TCanvas(fHist->GetName(), fHist->GetTitle()); 160 171 161 172 fHist->Draw(option); … … 163 174 DrawLegend(); 164 175 165 c->Modified();166 c->Update();176 gPad->Modified(); 177 gPad->Update(); 167 178 } 168 179 -
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r952 r959 196 196 void MHStarMap::Draw(Option_t *) 197 197 { 198 TCanvas *c = new TCanvas("Star Map", "Star Map created from Hillas Parameters", 500, 500); 198 if (!gPad) 199 { 200 if (!gROOT->GetMakeDefCanvas()) 201 return; 202 (gROOT->GetMakeDefCanvas())(); 203 } 204 205 // TCanvas *c = new TCanvas("Star Map", "Star Map created from Hillas Parameters", 500, 500); 199 206 200 207 PrepareDrawing(); … … 202 209 fStarMap->Draw("colz"); 203 210 204 c->Modified();205 c->Update();206 } 207 211 gPad->Modified(); 212 gPad->Update(); 213 } 214 -
trunk/MagicSoft/Mars/mmain/MDataCheck.cc
r947 r959 28 28 #include <TGButton.h> // TGTextButton 29 29 30 // --- 31 32 #include "MParList.h" 33 #include "MTaskList.h" 34 #include "MEvtLoop.h" 35 #include "MReadTree.h" 36 #include "MFillH.h" 37 #include "MGDisplayAdc.h" 38 39 // --- 40 30 41 ClassImp(MDataCheck) 31 42 … … 37 48 }; 38 49 50 // -------------------------------------------------------------------------- 51 // 52 // Create the 'Data Check' GUI Controls (Window) on the screen. To use it 53 // from within the interpreter you can call a Standard Version with 54 // 'new MDataCheck()' 55 // 39 56 MDataCheck::MDataCheck(const TGWindow *main, const TGWindow *p, 40 57 const UInt_t w, const UInt_t h) 41 58 : MBrowser(main, p, w, h) 42 59 { … … 75 92 } 76 93 77 // ====================================================================== 94 // -------------------------------------------------------------------------- 95 // 96 // Create the 'View Adc' GUI Controls (Window) on the screen. 97 // Therefor we have to process all data in a file and fill the corresponding 98 // histograms. 99 // 100 void MDataCheck::ViewAdcSpectra(Char_t *inputfile, Char_t *treeName) 101 { 102 // 103 // create a (empty) list of parameters which can be used by the tasks 104 // and an (empty) list of tasks which should be executed 105 // connect them in the required way. 106 // 78 107 108 // 109 // create the data containers for the raw data 110 // 111 MParList plist; 112 113 // 114 // set up the tasks for this job 115 // 116 MTaskList tasks; 117 plist.AddToList(&tasks); 118 119 MReadTree readin(treeName, inputfile); 120 tasks.AddToList(&readin); 121 122 MFillH fillspect("MRawEvtData", "MHFadcCam"); 123 tasks.AddToList(&fillspect); 124 125 // 126 // set up the loop for the processing 127 // 128 MEvtLoop magic; 129 magic.SetParList(&plist); 130 131 // 132 // start the loop running 133 // 134 if (!magic.Eventloop()) 135 return; 136 137 new MGDisplayAdc((MHFadcCam*)plist.FindObject("MHFadcCam")); 138 } 139 140 // -------------------------------------------------------------------------- 141 // 142 // Process the GUI control events (here: mainly button clicks) 143 // 79 144 Bool_t MDataCheck::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) 80 145 { … … 99 164 { 100 165 case M_BUTTON_PEDADC: 101 fViewAdc.AdcSpectra(fInputFile, "PedEvents");166 ViewAdcSpectra(fInputFile, "PedEvents"); 102 167 return kTRUE; 103 168 104 169 case M_BUTTON_CRADC: 105 fViewAdc.AdcSpectra(fInputFile, "Events");170 ViewAdcSpectra(fInputFile, "Events"); 106 171 return kTRUE; 107 172 -
trunk/MagicSoft/Mars/mmain/MDataCheck.h
r947 r959 10 10 #endif 11 11 12 #ifndef MVIEWADCSPECTRA_H13 #include "MViewAdcSpectra.h"14 #endif15 16 12 class MDataCheck : public MBrowser 17 13 { 18 14 private: 19 MViewAdcSpectra fViewAdc;15 void ViewAdcSpectra(Char_t *inputfile, Char_t *treeName); 20 16 21 17 public: -
trunk/MagicSoft/Mars/mmain/MMars.cc
r949 r959 34 34 #include <TG3DLine.h> // TGHorizontal3DLine 35 35 // use TGSplitter.h for root<3.00 36 37 36 #include "MEvtDisp.h" 38 37 #include "MAnalysis.h" 39 38 #include "MDataCheck.h" 40 39 #include "MMonteCarlo.h" 41 42 #include "MGPrototyp.h" 40 #include "MCameraDisplay.h" 43 41 44 42 ClassImp(MMars) 45 43 46 44 enum { 47 M_FILE_EXIT, 48 M_FILE_ABOUT, 49 50 M_PICTURE_MAGIC, 51 M_PICTURE_MARS, 52 53 M_BUTTON_EVTDISP, 54 M_BUTTON_DATACHECK, 55 M_BUTTON_ANALYSE, 56 M_BUTTON_MONTECARLO 45 M_FILE_EXIT, 46 M_FILE_ABOUT, 47 48 M_PICTURE_MAGIC, 49 M_PICTURE_MARS, 50 51 M_BUTTON_EVTDISP, 52 M_BUTTON_DATACHECK, 53 M_BUTTON_ANALYSE, 54 M_BUTTON_MONTECARLO, 55 M_BUTTON_CAMDISPLAY 57 56 }; 58 57 … … 97 96 mars->Associate(this); 98 97 99 TGLayoutHints *lay1 = new TGLayoutHints(kLHintsLeft, 10., 10., 20., 10.);100 TGLayoutHints *lay2 = new TGLayoutHints(kLHints Left, 10., 10., 10., 10.);98 TGLayoutHints *lay1 = new TGLayoutHints(kLHintsLeft, 10., 10., 20., 10.); 99 TGLayoutHints *lay2 = new TGLayoutHints(kLHintsRight, 10., 10., 10., 10.); 101 100 102 101 fList->Add(lay1); … … 105 104 top->AddFrame(magic, lay1); 106 105 top->AddFrame(mars, lay2); 106 } 107 108 void MMars::CreateTextButton(TGVerticalFrame *tab, const char *text, 109 const UInt_t id, TGLayoutHints *hints) const 110 { 111 // 112 // Create the button 113 // 114 TGTextButton *button = new TGTextButton(tab, text, id); 115 116 // 117 // Add button for 'auto-delete' 118 // 119 fList->Add(button); 120 121 // 122 // Send button events (meesages) to this object (s. ProcessMessage) 123 // 124 button->Associate(this); 125 126 // 127 // Add button with corresponding layout to containing frame 128 // 129 tab->AddFrame(button, hints); 107 130 } 108 131 … … 136 159 tf->AddFrame(tab2, laytabx); 137 160 138 TGTextButton *evtdisp = new TGTextButton(tab2, "EventDisplay", M_BUTTON_EVTDISP); 139 TGTextButton *datacheck = new TGTextButton(tab2, "Data Check", M_BUTTON_DATACHECK); 140 TGTextButton *analysis = new TGTextButton(tab2, "Analysis", M_BUTTON_ANALYSE); 141 TGTextButton *montecarlo = new TGTextButton(tab2, "MonteCarlo", M_BUTTON_MONTECARLO); 142 143 fList->Add(evtdisp); 144 fList->Add(datacheck); 145 fList->Add(analysis); 146 fList->Add(montecarlo); 147 148 evtdisp ->Associate(this); 149 datacheck ->Associate(this); 150 analysis ->Associate(this); 151 montecarlo->Associate(this); 152 153 TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsCenterX , 10, 10, 10, 10); 161 TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsCenterX, 10, 10, 10, 10); 154 162 fList->Add(laybut); 155 163 156 tab2->AddFrame(evtdisp, laybut); 157 tab2->AddFrame(datacheck, laybut); 158 tab2->AddFrame(analysis, laybut); 159 tab2->AddFrame(montecarlo, laybut); 164 CreateTextButton(tab2, "Event Display", M_BUTTON_EVTDISP, laybut); 165 CreateTextButton(tab2, "Data Check", M_BUTTON_DATACHECK, laybut); 166 CreateTextButton(tab2, "Analysis", M_BUTTON_ANALYSE, laybut); 167 CreateTextButton(tab2, "Monte Carlo", M_BUTTON_MONTECARLO, laybut); 168 CreateTextButton(tab2, "Camera Display", M_BUTTON_CAMDISPLAY, laybut); 160 169 } 161 170 162 171 MMars::MMars(/*const TGWindow *p,*/ UInt_t w, UInt_t h) 163 : TGMainFrame(gClient->GetRoot(), w, h) 172 : TGMainFrame(gClient->GetRoot(), w, h) 173 //: MBrowser (gClient->GetRoot(), gClient->GetRoot(), w, h) 164 174 { 165 175 // … … 196 206 AddFrame(low, layout); 197 207 208 // CreateTopFrame(fTop2); 209 // CreateBottomFrame(fTop3); 210 198 211 // 199 212 // Map the window, set up the layout, etc. 200 213 // 201 SetWMSizeHints(400, 380, 400, 380, 10, 10); // set the smallest and biggest size of the Main frame214 SetWMSizeHints(400, 410, 400, 410, 10, 10); // set the smallest and biggest size of the Main frame 202 215 203 216 MapSubwindows(); … … 271 284 return kTRUE; 272 285 286 case M_BUTTON_CAMDISPLAY: 287 new MCameraDisplay(this); 288 return kTRUE; 289 273 290 case M_PICTURE_MAGIC: 274 DisplWarning("Please open a Netscape to the MAGIC homepage"); 291 DisplWarning("Please open a Netscape to the MAGIC homepage\n" 292 "http://hegra1.mppmu.mpg.de/MAGICWeb/"); 275 293 return kTRUE; 276 294 277 295 case M_PICTURE_MARS: 278 DisplWarning("Please open a Netscape to the MARS homepage ");279 return kTRUE;280 296 DisplWarning("Please open a Netscape to the MARS homepage\n" 297 "http://magic.uni-sw.gwdg.de/mars/"); 298 return kTRUE; 281 299 } 282 300 -
trunk/MagicSoft/Mars/mmain/MMars.h
r946 r959 10 10 #endif 11 11 12 /* 13 #ifndef MBROWSER_H 14 #include <MBrowser.h> 15 #endif 16 */ 17 12 18 class TList; 19 class TGVerticalFrame; 20 class TGLayoutHints; 13 21 14 22 class MMars : public TGMainFrame … … 20 28 const TGPicture *fPic1; 21 29 const TGPicture *fPic2; 30 31 void CreateTextButton(TGVerticalFrame *tab, const char *text, 32 const UInt_t id, TGLayoutHints *hints) const; 22 33 23 34 void CreateMenuBar(); -
trunk/MagicSoft/Mars/mmain/MainLinkDef.h
r949 r959 12 12 #pragma link C++ class MDataCheck; 13 13 #pragma link C++ class MMonteCarlo; 14 #pragma link C++ class MCameraDisplay; 14 15 15 16 #endif -
trunk/MagicSoft/Mars/mmain/Makefile
r954 r959 34 34 MAnalysis.cc \ 35 35 MMonteCarlo.cc \ 36 MCameraDisplay.cc \ 36 37 MBrowser.cc 37 38
Note:
See TracChangeset
for help on using the changeset viewer.