Changeset 2178 for trunk/MagicSoft/Mars
- Timestamp:
- 06/16/03 13:45:01 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 added
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2177 r2178 5 5 * mhist/MHOnSubtraction.cc: 6 6 - worked around the non compiling source file 7 8 * merpp.cc: 9 - set compression level default = 1 10 11 * macros/readCT1.C, macros/readMagic.C, macros/readcurrents.C, 12 meventdisp/MGCamDisplay.cc 13 - adapted to new MCamDisplay and MCamEvent 14 15 * macros/sumcurrents.C: 16 - enhanced 17 18 * manalysis/MCerPhotCalc.[h, cc]: 19 - simplified algorithm 20 21 * manalysis/MCerPhotEvt.[h,cc], manalysis/MCurrents.[h,cc], 22 manalysis/MPedestalCam.[h,cc]: 23 - derived from MCamEvent 24 25 * manalysis/MMcPedestalNSBAdd.cc: 26 - minor change 27 28 * mbase/BaseLinkDef.h, mbase/Makefile: 29 - added MDirIter 30 31 * mbase/MDirIter.[h,cc]: 32 - added 33 34 * mbase/MParList.cc: 35 - enhnced some output 36 37 * mbase/MTaskInteractive.cc: 38 - fixed a bug 39 40 * mbase/MTaskList.cc: 41 - added handling of gui events for Pre- and PostProcess 42 43 * mgeom/MGeomPix.cc: 44 - added a comment 45 46 * mgui/MCamDisplay.[h,cc] - PRELIMINARY: 47 - added a notification list 48 - fixed SetRange if pad is not the main pad 49 - new Fill functions using MCamEvent, removed old ones 50 51 * mhist/MFillH.cc: 52 - check for the existance of the canvas 53 54 * mhist/MHCerPhotEvt.cc: 55 - take usage of MCamEvent 56 57 * mhist/MHCurrents.cc: 58 - take usage of MCamEvent 59 - added rms 60 61 * mmain/MStatusDisplay.[h,cc]: 62 - added "Reset" and "Remove Tab" to menu bar 63 64 * mraw/MRawEvtData.[h,cc]: 65 - draw hi- and logains 66 - derived from MCamEvent 67 68 * mraw/MRawEvtPixelIter.[h,cc]: 69 - added GetVarHiGainSamples 70 71 * mraw/Makefile: 72 - added -I../mgui - PRELIMINARY 7 73 8 74 -
trunk/MagicSoft/Mars/macros/readCT1.C
r2151 r2178 89 89 continue; 90 90 91 display.Fill PhotNum(*evt);91 display.Fill(*evt); 92 92 display.Update(); 93 93 … … 100 100 newimgpar.Print(); 101 101 102 display.Fill PhotNum(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));102 display.Fill(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt")); 103 103 display.Update(); 104 104 -
trunk/MagicSoft/Mars/macros/readMagic.C
r2173 r2178 104 104 cout << "Event #" << read.GetNumEntry() ":" << endl; 105 105 106 display.Fill PhotNum(*(MCerPhotEvt*)clone.GetClone());106 display.Fill(*(MCerPhotEvt*)clone.GetClone()); 107 107 gPad->Modified(); 108 108 gPad->Update(); … … 116 116 newimgpar.Print(); 117 117 118 display.Fill PhotNum(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));118 display.Fill(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt")); 119 119 gPad->Modified(); 120 120 gPad->Update(); -
trunk/MagicSoft/Mars/macros/readcurrents.C
r2153 r2178 45 45 } 46 46 47 void readcurrents(const char *fname="../currents/dcs_ vega.dat")47 void readcurrents(const char *fname="../currents/dcs_arcturus.dat") 48 48 { 49 49 MParList plist; … … 86 86 { 87 87 // cur.Print(); 88 display.Fill Currents(cur);88 display.Fill(cur); 89 89 gPad->Modified(); 90 90 gPad->Update(); -
trunk/MagicSoft/Mars/macros/sumcurrents.C
r2158 r2178 29 29 // This macro shows how to fill and display a histogram using Mars 30 30 // 31 void sumcurrents(const char *fname="../currents/ dcs_arcturus.dat")31 void sumcurrents(const char *fname="../currents/spica_center.txt") 32 32 { 33 33 // … … 83 83 MHCurrents &h = *(MHCurrents*)plist->FindObject("MHCurrents"); 84 84 85 MCamDisplay *disp = new MCamDisplay(&geom); 86 disp->FillCurrents(h.GetSum()); 87 disp->Draw(); 85 TCanvas *c = MH::MakeDefCanvas(); 86 c->Divide(3, 2); 87 88 MCamDisplay *disp1=new MCamDisplay(&geom); 89 MCamDisplay *disp2=new MCamDisplay(&geom); 90 MCamDisplay *disp3=new MCamDisplay(&geom); 91 disp1->Fill(h.GetSum()); 92 disp2->Fill(h.GetRms()); 93 94 TArrayF arr(577); 95 for (int i=0;i<577;i++) 96 { 97 TArrayF &r = h.GetRms(); 98 TArrayF &v = h.GetSum(); 99 arr[i] = (r[i]==0 ? 0 : v[i]/r[i]); 100 } 101 disp3->Fill(arr); 102 103 c->cd(1); 104 gPad->SetBorderMode(0); 105 gPad->Divide(1,1); 106 gPad->cd(1); 107 gPad->SetLogz(); 108 disp1->Draw(); 109 disp1->SetBit(kCanDelete); 110 c->cd(2); 111 gPad->SetBorderMode(0); 112 gPad->Divide(1,1); 113 gPad->cd(1); 114 gPad->SetLogz(); 115 disp2->Draw(); 116 disp2->SetBit(kCanDelete); 117 c->cd(3); 118 gPad->SetBorderMode(0); 119 gPad->Divide(1,1); 120 gPad->cd(1); 121 gPad->SetLogz(); 122 disp3->Draw(); 123 disp3->SetBit(kCanDelete); 124 c->cd(4); 125 gPad->SetBorderMode(0); 126 h.GetHist().DrawClone(); 127 c->cd(5); 128 gPad->SetBorderMode(0); 129 TH1F h1("currents;rms", "Currents Rms", 577, -0.5, 576.5); 130 for (int i=1;i<=577; i++) 131 h1.SetBinContent(i, h.GetHist().GetBinError(i)); 132 h1.DrawCopy(); 133 c->cd(6); 134 gPad->SetBorderMode(0); 135 TH1F h2("currents;relerr", "Currents rel. Error [%]", 577, -0.5, 576.5); 136 for (int i=1;i<=577; i++) 137 { 138 Float_t val = h.GetHist().GetBinContent(i); 139 Float_t rms = h.GetHist().GetBinError(i); 140 h2.SetBinContent(i, rms==0?0:val/rms); 141 } 142 h2.DrawCopy(); 143 144 c->SaveAs("spica_center-avg.ps"); 88 145 } -
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.cc
r2173 r2178 32 32 // the array fWeight (default: all slices added up with weight 1). 33 33 // 34 // The weights are rescaled, such that sum(weigths)=num slices 35 // 34 36 // Input Containers: 35 37 // MRawRunHeader, MRawEvtData, MPedestalCam … … 112 114 113 115 // Calculate quadratic sum of weights: 114 fSumQuadWeights = 0.; 115 for (Int_t i = 0; i < fWeight.GetSize(); i++) 116 fSumWeights = 0; 117 fSumQuadWeights = 0; 118 for (Int_t i=0; i<fWeight.GetSize(); i++) 119 { 120 fSumWeights += fWeight[i]; 116 121 fSumQuadWeights += fWeight[i]*fWeight[i]; 122 } 117 123 118 124 fSumQuadWeights = sqrt(fSumQuadWeights); … … 169 175 170 176 MRawEvtPixelIter pixel(fRawEvt); 171 172 TArrayF binsignal(fWeight.GetSize());173 177 174 178 while (pixel.Next()) … … 194 198 // Calculate pixel signal unless it has all FADC slices empty: 195 199 // 196 const Byte_t *ptr = pixel.GetHiGainSamples(); 197 198 Float_t nphot = 0; 199 Float_t nphoterr = 0; 200 201 if (pixel.GetSumHiGainSamples()>0) 202 { 203 for (Int_t i=0; i<fWeight.GetSize(); i++) 204 { 205 binsignal[i] = ptr[i] - mean; 206 nphot += binsignal[i] * fWeight[i]; 207 } 208 nphoterr = ped.GetSigma() * fSumQuadWeights; 209 } 200 Byte_t *ptr = pixel.GetHiGainSamples(); 201 202 Float_t nphot = 0; 203 for(Int_t i=0; i<fWeight.GetSize(); i++) 204 nphot += ptr[i]*fWeight[i]; 205 206 nphot -= mean*fSumWeights; 207 208 const Float_t nphoterr = ped.GetSigma()* fSumQuadWeights; 210 209 211 210 fCerPhotEvt->AddPixel(pixid, nphot, nphoterr); -
trunk/MagicSoft/Mars/manalysis/MCerPhotCalc.h
r1715 r2178 33 33 34 34 TArrayF fWeight; // Weights for adding up the ADC slices 35 Float_t fSumWeights; 35 36 Float_t fSumQuadWeights; 36 37 -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r2173 r2178 384 384 fNumPixels=fPixels->GetEntriesFast(); 385 385 } 386 387 Bool_t MCerPhotEvt::GetPixelContent(Float_t &val, Int_t idx, Float_t ratio, Int_t type) const 388 { 389 MCerPhotPix *pix = GetPixById(idx); 390 if (!pix || !pix->IsPixelUsed()) 391 return kFALSE; 392 393 switch (type) 394 { 395 case 1: 396 val = pix->GetErrorPhot()*TMath::Sqrt(ratio); 397 return kTRUE; 398 case 2: 399 if (pix->GetErrorPhot()<=0) 400 return kFALSE; 401 val = pix->GetNumPhotons()*TMath::Sqrt(ratio)/pix->GetErrorPhot(); 402 return kTRUE; 403 default: 404 val = pix->GetNumPhotons()*ratio; 405 return kTRUE; 406 } 407 return kTRUE; 408 } -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r2147 r2178 4 4 #ifndef ROOT_TClonesArray 5 5 #include <TClonesArray.h> 6 #endif 7 #ifndef MARS_MCamEvent 8 #include "MCamEvent.h" 6 9 #endif 7 10 #ifndef MARS_MCerPhotPix … … 12 15 class MCerPhotPix; 13 16 14 class MCerPhotEvt : public M ParContainer17 class MCerPhotEvt : public MCamEvent 15 18 { 16 19 private: … … 61 64 void Clear(Option_t *opt=NULL) { Reset(); } 62 65 66 Bool_t GetPixelContent(Float_t &val, Int_t idx, Float_t ratio=1, Int_t type=0) const; 67 void DrawPixelContent(Int_t num) const 68 { 69 } 70 63 71 ClassDef(MCerPhotEvt, 1) // class for an event containing cerenkov photons 64 72 }; -
trunk/MagicSoft/Mars/manalysis/MCurrents.h
r2173 r2178 2 2 #define MARS_MCurrents 3 3 4 #ifndef MARS_M ParContainer5 #include "M ParContainer.h"4 #ifndef MARS_MCamEvent 5 #include "MCamEvent.h" 6 6 #endif 7 7 … … 10 10 #endif 11 11 12 class MCurrents : public MParContainer 12 #include <iostream.h> 13 class MCurrents : public MCamEvent 13 14 { 14 15 private: … … 37 38 void Print(Option_t *opt=NULL) const; 38 39 40 Bool_t GetPixelContent(Float_t &val, Int_t idx, Float_t ratio=1, Int_t type=0) const 41 { 42 val = (*this)[idx]; 43 return val>0; 44 } 45 void DrawPixelContent(Int_t num) const 46 { 47 } 48 39 49 ClassDef(MCurrents, 1) // Storage Container for the Currents (PRELIMINARY) 40 50 }; -
trunk/MagicSoft/Mars/manalysis/MMcPedestalNSBAdd.cc
r2173 r2178 16 16 ! 17 17 ! 18 ! Author(s): Oscar Blanch 11/2001 <mailto:blanch@ifae.es>18 ! Author(s): Oscar Blanch, 11/2001 <mailto:blanch@ifae.es> 19 19 ! 20 20 ! Copyright: MAGIC Software Development, 2000-2001 -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
r2173 r2178 181 181 return maxval; 182 182 } 183 184 Bool_t MPedestalCam::GetPixelContent(Float_t &val, Int_t idx, Float_t ratio=1, Int_t type=0) const 185 { 186 val = (*this)[idx].GetMean()*ratio; 187 return kTRUE; 188 } -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.h
r1540 r2178 2 2 #define MARS_MPedestalCam 3 3 4 #ifndef MARS_M ParContainer5 #include "M ParContainer.h"4 #ifndef MARS_MCamEvent 5 #include "MCamEvent.h" 6 6 #endif 7 7 … … 11 11 class MPedestalPix; 12 12 13 class MPedestalCam : public M ParContainer13 class MPedestalCam : public MCamEvent 14 14 { 15 15 private: … … 35 35 void Print(Option_t *o="") const; 36 36 37 Bool_t GetPixelContent(Float_t &val, Int_t idx, Float_t ratio=1, Int_t type=0) const; 38 void DrawPixelContent(Int_t num) const 39 { 40 } 41 37 42 ClassDef(MPedestalCam, 1) // Storage Container for all pedestal information of the camera 38 43 }; -
trunk/MagicSoft/Mars/mbase/BaseLinkDef.h
r2173 r2178 16 16 17 17 #pragma link C++ class MIter+; 18 #pragma link C++ class MDirIter+; 18 19 19 20 #pragma link C++ class MTask+; -
trunk/MagicSoft/Mars/mbase/MParList.cc
r2173 r2178 472 472 if (!pcont) 473 473 { 474 *fLog << err << dbginf << "Cannot create new instance of class '" << cname << "' (Maybe no def. constructor)" << endl; 474 *fLog << err << dbginf << "Cannot create new instance of class '" << cname << "' Possible reasons:" << endl; 475 *fLog << " - Class has no default constructor." << endl; 476 *fLog << " - An abstract member functions of a base class is not overwritten." << endl; 475 477 return NULL; 476 478 } -
trunk/MagicSoft/Mars/mbase/MTaskInteractive.cc
r2173 r2178 26 26 // 27 27 // MTaskInteractive 28 // 29 // If you want to create a new task inside a macro you will have to compile 30 // your macro using macro.C++, because the root interpreter cannot use 31 // uncompiled classes. To workaround this problem you can write simple 32 // funcions (which can be handled by CINT) and use MTaskInteractive. 33 // 34 // This is a simple way to develop new code in a macro without need 35 // to compile it. 28 36 // 29 37 // Input Containers: … … 77 85 78 86 Long_t result; 79 fCall[no]->Execute(params, result); 87 fCall[no]->SetParamPtrs(params); 88 fCall[no]->Execute(result); 89 80 90 return result; 81 91 } -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r2173 r2178 60 60 61 61 #include <TClass.h> 62 #include <TSystem.h> // gSystem 62 63 #include <TOrdCollection.h> 63 64 … … 365 366 366 367 case kTRUE: 368 // Handle GUI events (display changes, mouse clicks) 369 if (fDisplay) 370 gSystem->ProcessEvents(); 367 371 continue; 368 372 … … 461 465 // 462 466 rc = kFALSE; 467 *fLog << inf << task->GetDescriptor() << " has stopped execution of " << GetDescriptor() << "." << endl; 463 468 break; 464 469 … … 531 536 if (!task->CallPostProcess()) 532 537 return kFALSE; 538 539 // Handle GUI events (display changes, mouse clicks) 540 if (fDisplay) 541 gSystem->ProcessEvents(); 533 542 } 534 543 -
trunk/MagicSoft/Mars/mbase/Makefile
r2156 r2178 43 43 MEvtLoop.cc \ 44 44 MIter.cc \ 45 MDirIter.cc \ 45 46 MGList.cc \ 46 47 MGTask.cc \ -
trunk/MagicSoft/Mars/merpp.cc
r2173 r2178 53 53 gLog << " input file: Magic DAQ binary file." << endl; 54 54 gLog << " ouput file: Merpped root file." << endl; 55 gLog << " compr. level: 1..9 [default= 9]" << endl << endl;55 gLog << " compr. level: 1..9 [default=1]" << endl << endl; 56 56 return -1; 57 57 } … … 67 67 const char *kNamein = argv[1]; 68 68 const char *kNameout = argv[2]; 69 const int kComprlvl = argc==4 ? atoi(argv[3]) : 9;69 const int kComprlvl = argc==4 ? atoi(argv[3]) : 1; 70 70 71 71 // -
trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
r2161 r2178 46 46 #include "MImgCleanStd.h" // MImgCleanStd 47 47 #include "MGeomCamMagic.h" // MGeomMagicCam 48 #include "MRawEvtData.h" // MRawEvtData 48 49 49 50 ClassImp(MGCamDisplay); … … 137 138 MGeomCamMagic *geom = new MGeomCamMagic; 138 139 MPedestalCam *pedest = new MPedestalCam; 140 MRawEvtData *event = new MRawEvtData; 139 141 140 142 plist->AddToList(geom); 141 143 plist->AddToList(pedest); 144 plist->AddToList(event); 142 145 143 146 return geom; … … 176 179 fDisplay[i] = new MCamDisplay(geom); 177 180 fDisplay[i]->Draw(); 181 fDisplay[i]->AddNotify(*(MCamEvent*)GetParList()->FindObject("MRawEvtData")); 178 182 fCanvas2[i]->Update(); 179 183 fList->Add(fDisplay[i]); … … 245 249 const MPedestalCam *ped = (MPedestalCam*)plist->FindObject("MPedestalCam"); 246 250 247 fDisplay[0]->Fill PhotNum(*evt);248 fDisplay[1]->Fill ErrorPhot(*evt);249 fDisplay[2]->Fill Ratio(*evt);251 fDisplay[0]->Fill((MCamEvent&)*evt, 0); 252 fDisplay[1]->Fill((MCamEvent&)*evt, 1); 253 fDisplay[2]->Fill((MCamEvent&)*evt, 2); 250 254 fDisplay[3]->FillLevels(*evt, *clean); 251 fDisplay[4]->Fill Pedestals(*ped);255 fDisplay[4]->Fill((MCamEvent&)*ped); 252 256 253 257 for (int i=0; i<5; i++) -
trunk/MagicSoft/Mars/mfileio/Makefile
r2147 r2178 21 21 22 22 INCLUDES = -I. -I../mbase -I../mraw -I../mmc -I../mdata -I../manalysis \ 23 -I../mgeom -I../mhist -I../mmain -I../mreflector 23 -I../mgeom -I../mhist -I../mmain -I../mreflector -I../mgui 24 24 25 25 # @code -
trunk/MagicSoft/Mars/mgeom/MGeomPix.cc
r2173 r2178 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 18 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! Author(s): Harald Kornmayer 1/2001 20 20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 221 ! Copyright: MAGIC Software Development, 2000-2003 22 22 ! 23 23 ! … … 35 35 // MGeomPix. 36 36 // 37 // FIXME: According to an agreement we have to change the name 'Id' 38 // to 'idx' 39 // 37 40 //////////////////////////////////////////////////////////////////////////// 38 39 41 #include "MGeomPix.h" 40 42 -
trunk/MagicSoft/Mars/mgui/GuiLinkDef.h
r1436 r2178 6 6 7 7 #pragma link C++ class MHexagon+; 8 #pragma link C++ class MCamEvent+; 8 9 #pragma link C++ class MCamDisplay+; 9 10 -
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r2173 r2178 63 63 64 64 #include "MCurrents.h" 65 #include "MCamEvent.h" 65 66 66 67 #include "MImgCleanStd.h" … … 91 92 fMinimum = 0; 92 93 fMaximum = 1; 94 95 fNotify = new TList; 93 96 } 94 97 … … 101 104 { 102 105 fGeomCam = (MGeomCam*)geom->Clone(); 106 107 fNotify = new TList; 103 108 104 109 // … … 211 216 212 217 delete fGeomCam; 218 219 delete fNotify; 213 220 } 214 221 … … 228 235 pad->SetBorderMode(0); 229 236 pad->SetFillColor(16); 230 237 //pad->Modified(); 238 /* 239 pad->Divide(1,1); 240 pad->cd(1); 241 gPad->SetBorderMode(0); 242 gPad->SetFillColor(16); 243 */ 231 244 AppendPad(""); 232 245 } … … 240 253 const float ratio = 1.15; 241 254 242 const float w = gPad->GetWw(); 243 const float h = gPad->GetWh()*ratio; 244 255 // 256 // Calculate width and height of the current pad in pixels 257 // 258 Float_t w = gPad->GetWw(); 259 Float_t h = gPad->GetWh()*ratio; 260 261 // 262 // This prevents the pad from resizing itself wrongly 263 // 264 if (gPad->GetMother() != gPad) 265 { 266 w *= gPad->GetMother()->GetAbsWNDC(); 267 h *= gPad->GetMother()->GetAbsHNDC(); 268 } 269 270 // 271 // Set Range (coordinate system) of pad 272 // 245 273 gPad->Range(-fRange, -fRange, (2*ratio-1)*fRange, fRange); 246 274 275 // 276 // Resize Pad to given ratio 277 // 247 278 if (h<w) 248 gPad->SetPad((1.-h/w)/2, 0, (h/w+1 )/2, 0.9999999);279 gPad->SetPad((1.-h/w)/2, 0, (h/w+1.)/2, 1); 249 280 else 250 gPad->SetPad(0, (1.-w/h)/2, 1, (w/h+1 )/2);281 gPad->SetPad(0, (1.-w/h)/2, 1, (w/h+1.)/2); 251 282 } 252 283 … … 271 302 } 272 303 304 if (fMinimum==FLT_MAX && fMaximum==-FLT_MAX) 305 fMinimum = fMaximum = 0; 273 306 if (fMinimum==fMaximum) 274 307 fMaximum = fMinimum + 1; … … 282 315 else 283 316 (*this)[i].SetFillColor(10); 284 285 317 } 286 318 } … … 314 346 315 347 // Paint primitives (pixels, color legend, photons, ...) 316 { fPixels->ForEach( TObject, Paint)(); }317 { fLegend->ForEach( TObject, Paint)(); }348 { fPixels->ForEach( TObject, Paint)(); } 349 { fLegend->ForEach( TObject, Paint)(); } 318 350 { fLegText->ForEach(TObject, Paint)(); } 319 351 { fPhotons->ForEach(TObject, Paint)(); } … … 445 477 // ------------------------------------------------------------------------ 446 478 // 447 // Call this function to fill the number of photo electron into the 448 // camera. 449 // 450 void MCamDisplay::FillPhotNum(const MCerPhotEvt &event) 479 // Call this function to fill the currents 480 // 481 void MCamDisplay::Fill(const MCamEvent &event, Int_t type) 451 482 { 452 483 Reset(); 453 484 454 const Int_t entries = event.GetNumPixels(); 455 456 for (Int_t i=0; i<entries; i++) 457 { 458 const MCerPhotPix &pix = event[i]; 459 if (!pix.IsPixelUsed()) 460 continue; 461 462 const Int_t id = pix.GetPixId(); 463 464 fData[id] = pix.GetNumPhotons()*fGeomCam->GetPixRatio(id); 465 (*this)[id].SetBit(kIsUsed); 466 } 467 } 468 469 // ------------------------------------------------------------------------ 470 // 471 // Call this function to fill the number of photo electron into the 472 // camera. 473 // 474 void MCamDisplay::FillPedestals(const MPedestalCam &event) 485 // FIXME: Security check missing! 486 for (UInt_t idx=0; idx<fNumPixels; idx++) 487 { 488 fData[idx] = 0; 489 if (event.GetPixelContent(fData[idx], idx, fGeomCam->GetPixRatio(idx), type)) 490 (*this)[idx].SetBit(kIsUsed); 491 } 492 } 493 494 // ------------------------------------------------------------------------ 495 // 496 // Call this function to fill the currents 497 // 498 void MCamDisplay::Fill(const TArrayF &event, Bool_t ispos) 475 499 { 476 500 Reset(); 477 501 478 const Int_t entries = event.GetSize(); 479 for (Int_t i=0; i<entries; i++) 480 { 481 fData[i] = event[i].GetMean()*fGeomCam->GetPixRatio(i); 482 (*this)[i].SetBit(kIsUsed); 483 } 484 } 485 486 // ------------------------------------------------------------------------ 487 // 488 // Call this function to fill the error of number of photo electron 489 // into the camera. 490 // 491 void MCamDisplay::FillErrorPhot(const MCerPhotEvt &event) 492 { 493 Reset(); 494 495 const Int_t entries = event.GetNumPixels(); 496 497 for (Int_t i=0; i<entries; i++) 498 { 499 const MCerPhotPix &pix = event[i]; 500 if (!pix.IsPixelUsed()) 501 continue; 502 503 const Int_t id = pix.GetPixId(); 504 505 fData[id] = pix.GetErrorPhot()*sqrt(fGeomCam->GetPixRatio(id)); 506 (*this)[id].SetBit(kIsUsed); 507 } 508 } 509 510 // ------------------------------------------------------------------------ 511 // 512 // Call this function to fill the ratio of the number of photons 513 // divided by its error 514 // 515 void MCamDisplay::FillRatio(const MCerPhotEvt &event) 516 { 517 Reset(); 518 519 const Int_t entries = event.GetNumPixels(); 520 521 for (Int_t i=0; i<entries; i++) 522 { 523 const MCerPhotPix &pix = event[i]; 524 525 if (!pix.IsPixelUsed()) 526 continue; 527 528 const Int_t id = pix.GetPixId(); 529 530 const Float_t entry = pix.GetNumPhotons(); 531 const Float_t noise = pix.GetErrorPhot(); 532 const Double_t ratio = TMath::Sqrt(fGeomCam->GetPixRatio(id)); 533 534 fData[id] = entry*ratio/noise; 535 (*this)[id].SetBit(kIsUsed); 536 } 537 } 538 539 // ------------------------------------------------------------------------ 540 // 541 // Call this function to fill the currents 542 // 543 void MCamDisplay::FillCurrents(const MCurrents &event) 544 { 545 Reset(); 546 547 // FIXME: Security check missing! 548 for (UInt_t i=0; i<fNumPixels; i++) 549 { 550 if (event[i]<=0) 551 continue; 552 553 (*this)[i].SetBit(kIsUsed); 554 fData[i] = event[i]; 555 } 502 fData = event; 503 504 for (UInt_t idx=0; idx<fNumPixels; idx++) 505 if (!ispos || fData[idx]>0) 506 (*this)[idx].SetBit(kIsUsed); 556 507 } 557 508 … … 562 513 void MCamDisplay::FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2) 563 514 { 564 Fill Ratio(event);515 Fill(event, 2); 565 516 566 517 for (UInt_t i=0; i<fNumPixels; i++) … … 793 744 } 794 745 746 Int_t MCamDisplay::GetPixelIndex(Int_t px, Int_t py) const 747 { 748 UInt_t i; 749 for (i=0; i<fNumPixels; i++) 750 { 751 if ((*fPixels)[i]->DistancetoPrimitive(px, py)>0) 752 continue; 753 754 return i; 755 } 756 return -1; 757 } 758 795 759 // ------------------------------------------------------------------------ 796 760 // … … 800 764 char *MCamDisplay::GetObjectInfo(Int_t px, Int_t py) const 801 765 { 802 static char info[64]; 803 804 UInt_t i; 805 for (i=0; i<fNumPixels; i++) 806 { 807 if ((*fPixels)[i]->DistancetoPrimitive(px, py)>0) 808 continue; 809 810 sprintf(info, "Pixel Id: %d", i); 811 return info; 812 } 813 return TObject::GetObjectInfo(px, py); 814 } 766 static char info[128]; 767 768 const Int_t idx=GetPixelIndex(px, py); 769 770 if (idx<0) 771 return TObject::GetObjectInfo(px, py); 772 773 sprintf(info, "Software Pixel Index: %d (Hardware Id=%d)", idx, idx+1); 774 return info; 775 } 776 777 // ------------------------------------------------------------------------ 778 // 779 // Execute a mouse event on the camera 780 // 781 void MCamDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py) 782 { 783 //if (event==kMouseMotion && fStatusBar) 784 // fStatusBar->SetText(GetObjectInfo(px, py), 0); 785 if (event!=kButton1Down) 786 return; 787 788 const Int_t idx = GetPixelIndex(px, py); 789 if (idx<0) 790 return; 791 792 cout << "Software Pixel Index: " << idx << endl; 793 cout << "Hardware Pixel Id: " << idx+1 << endl; 794 cout << "Contents: " << fData[idx] << endl; 795 796 //fNotify->Print(); 797 if (fNotify->GetSize()>0) 798 new TCanvas; 799 fNotify->ForEach(MCamEvent, DrawPixelContent)(idx); 800 } -
trunk/MagicSoft/Mars/mgui/MCamDisplay.h
r2171 r2178 22 22 class TText; 23 23 class TArrow; 24 class TGStatusBar; 24 25 25 26 class MGeomCam; 26 27 class MHexagon; 28 class MCurrents; 29 class MCamEvent; 27 30 class MRflEvtData; 28 class MCurrents;29 31 class MCerPhotEvt; 30 32 class MCerPhotPix; … … 60 62 Float_t fMaximum; 61 63 64 TList *fNotify; 65 66 //TGStatusBar *fStatusBar; 67 62 68 TBox *GetBox(Int_t i) { return (TBox*) fLegend->At(i); } 63 69 … … 71 77 void SetPalette(); 72 78 79 Int_t GetPixelIndex(Int_t px, Int_t py) const; 80 73 81 enum { 74 82 kIsUsed = BIT(14) … … 81 89 82 90 void SetAutoScale(Bool_t input=kTRUE); // *MENU* 83 void FillPhotNum(const MCerPhotEvt &event); 84 void FillRatio(const MCerPhotEvt &event); 91 92 void ShowRflEvent(const MRflEvtData *event=NULL, EMarkerStyle m=kFullDotMedium); 93 void FillRflEvent(const MRflEvtData &event); 85 94 void FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2); 86 void FillErrorPhot(const MCerPhotEvt &event);87 95 void FillLevels(const MCerPhotEvt &event, const MImgCleanStd &clean); 88 void FillPedestals(const MPedestalCam &event); 89 void FillRflEvent(const MRflEvtData &event); 90 void FillCurrents(const MCurrents &event); 91 void ShowRflEvent(const MRflEvtData *event=NULL, EMarkerStyle m=kFullDotMedium); 96 void Fill(const MCamEvent &event, Int_t type=0); 97 void Fill(const TArrayF &event, Bool_t ispos=kTRUE); 92 98 93 99 void DrawPixelNumbers(); … … 99 105 Int_t DistancetoPrimitive(Int_t px, Int_t py); 100 106 char *GetObjectInfo(Int_t px, Int_t py) const; 101 //virtualvoid ExecuteEvent(Int_t event, Int_t px, Int_t py);107 void ExecuteEvent(Int_t event, Int_t px, Int_t py); 102 108 103 109 void SetPalette(Int_t ncolors, Int_t *colors); … … 111 117 void SetMinimum(Float_t m); // *MENU* 112 118 void SetMaximum(Float_t m); // *MENU* 119 120 void AddNotify(const MCamEvent &event) { fNotify->Add((TObject*)(&event)); } 121 122 //void SetStatusBar(TGStatusBar *bar) { fStatusBar = bar; } 113 123 114 124 ClassDef(MCamDisplay, 0) // Displays the magic camera -
trunk/MagicSoft/Mars/mgui/Makefile
r2135 r2178 23 23 # 24 24 INCLUDES = -I. -I../mbase -I../mgeom -I../manalysis -I../mimage -I../mhist \ 25 -I../mreflector 25 -I../mreflector -I../mraw 26 26 27 27 #------------------------------------------------------------------------------ … … 30 30 31 31 SRCFILES = MHexagon.cc \ 32 MCamDisplay.cc 32 MCamEvent.cc \ 33 MCamDisplay.cc 33 34 34 35 SRCS = $(SRCFILES) -
trunk/MagicSoft/Mars/mhist/MFillH.cc
r2173 r2178 501 501 502 502 // 503 // Check whether fDisplay has previously been used (fCanvas) 504 // and fDisplay is still open. 505 // 506 if (fCanvas && fDisplay) 503 // Check whether fDisplay has previously been used (fCanvas), 504 // fDisplay is still open and the corresponding Canvas/Tab is 505 // still existing. 506 // 507 if (fDisplay && fDisplay->HasCanvas(fCanvas)) 507 508 { 508 509 fCanvas->cd(); -
trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc
r2173 r2178 127 127 const UInt_t n = evt->GetNumPixels(); 128 128 129 for (UInt_t i =0; i<n; i++)129 for (UInt_t idx=0; idx<n; idx++) 130 130 { 131 const MCerPhotPix &pix = (*evt)[i]; 131 Float_t val; 132 if (!evt->GetPixelContent(val, idx)) 133 continue; 132 134 133 const Int_t id = pix.GetPixId(); 134 135 fSum[id].SetPixelUsed(); 136 fSum[id].AddNumPhotons(pix.GetNumPhotons()); 135 fSum[idx].SetPixelUsed(); 136 fSum[idx].AddNumPhotons(val); 137 137 } 138 138 … … 148 148 Bool_t MHCerPhotEvt::Finalize() 149 149 { 150 fSum.Scale(fEntries); 150 if (fEntries<1) 151 *fLog << warn << "WARNING - " << GetDescriptor() << " doesn't contain entries." << endl; 152 else 153 fSum.Scale(fEntries); 151 154 return kTRUE; 152 155 } … … 185 188 fDispl = new MCamDisplay(fCam); 186 189 187 fDispl->Fill PhotNum(fSum);190 fDispl->Fill(fSum); 188 191 fDispl->Paint(); 189 192 } -
trunk/MagicSoft/Mars/mhist/MHCurrents.cc
r2173 r2178 36 36 37 37 #include "MParList.h" 38 #include "MBinning.h" 38 39 #include "MCurrents.h" 39 40 #include "MCamDisplay.h" … … 54 55 // FIXME: Implement a clear function with setmem 55 56 for (int i=0; i<577; i++) 57 { 56 58 fSum[i] = 0; 59 fRms[i] = 0; 60 } 57 61 58 62 fEntries = 0; … … 65 69 // 66 70 MHCurrents::MHCurrents(const char *name, const char *title) 67 : fSum(577), f Cam(NULL), fEvt(NULL), fDispl(NULL)71 : fSum(577), fRms(577), fCam(NULL), fEvt(NULL), fDispl(NULL) 68 72 { 69 73 // … … 74 78 75 79 Clear(); 80 81 fHist.SetName("currents"); 82 fHist.SetTitle("Avg.Currents [nA]"); 83 fHist.SetDirectory(NULL); 84 fHist.Sumw2(); 76 85 } 77 86 … … 105 114 Clear(); 106 115 116 MBinning bins; 117 bins.SetEdges(577, -0.5, 576.5); 118 bins.Apply(fHist); 119 107 120 return kTRUE; 108 121 } … … 121 134 } 122 135 136 for (UInt_t idx=0; idx<577; idx++) 137 { 138 Float_t val; 139 if (!evt->GetPixelContent(val, idx)) 140 continue; 141 142 fSum[idx] += val; 143 fRms[idx] += val*val; 144 } 145 146 fEntries++; 147 148 return kTRUE; 149 } 150 151 // -------------------------------------------------------------------------- 152 // 153 // Scale the sum container with the number of entries 154 // 155 Bool_t MHCurrents::Finalize() 156 { 157 if (fEntries<2) 158 { 159 *fLog << warn << "WARNING - " << GetDescriptor() << " doesn't contain enough entries." << endl; 160 return kTRUE; 161 } 162 123 163 for (UInt_t i=0; i<577; i++) 124 fSum[i] += (*evt)[i]; 125 126 fEntries++; 127 164 { 165 // calc sdev^2 for pixel index i 166 // var^2 = (sum[xi^2] - sum[xi]^2/n) / (n-1); 167 fRms[i] -= fSum[i]*fSum[i]/fEntries; 168 fRms[i] /= fEntries-1; 169 fRms[i] = TMath::Sqrt(fRms[i]); 170 171 // calc mean value for pixel index i 172 fSum[i] /= fEntries; 173 174 fHist.SetBinContent(i+1, fSum[i]); 175 fHist.SetBinError( i+1, fRms[i]); 176 } 128 177 return kTRUE; 129 178 } … … 131 180 // -------------------------------------------------------------------------- 132 181 // 133 // Scale the sum container with the number of entries134 //135 Bool_t MHCurrents::Finalize()136 {137 for (UInt_t i=0; i<577; i++)138 fSum[i] /= fEntries;139 140 return kTRUE;141 }142 143 // --------------------------------------------------------------------------144 //145 182 // Draw the present 'fill status' 146 183 // 147 void MHCurrents::Draw(Option_t * )184 void MHCurrents::Draw(Option_t *o) 148 185 { 149 186 if (!fCam) … … 156 193 pad->SetBorderMode(0); 157 194 195 SetDrawOption(o); 158 196 AppendPad(""); 159 197 } … … 174 212 fDispl = new MCamDisplay(fCam); 175 213 176 fDispl->FillCurrents(fSum); 214 TString opt(GetDrawOption()); 215 216 fDispl->Fill(opt.Contains("rms", TString::kIgnoreCase) ? fRms : fSum); 177 217 fDispl->Paint(); 178 218 } -
trunk/MagicSoft/Mars/mhist/MHCurrents.h
r2173 r2178 6 6 #endif 7 7 8 #ifndef MARS_MCurrents9 #include "MCurrents.h"8 #ifndef ROOT_TH1 9 #include <TH1.h> 10 10 #endif 11 11 12 class TH1D; 12 #ifndef ROOT_TArrayF 13 #include <TArrayF.h> 14 #endif 15 16 class MCurrents; 13 17 class MGeomCam; 14 18 class MCamDisplay; … … 17 21 { 18 22 private: 19 MCurrents fSum; // storing the sum 23 TArrayF fSum; // storing the sum 24 TArrayF fRms; // storing the rms 20 25 Int_t fEntries; // number of entries in the histogram 21 26 MGeomCam *fCam; // the present geometry 22 27 MCurrents *fEvt; //! the current event 23 28 MCamDisplay *fDispl; //! the camera display 29 30 TH1F fHist; 24 31 25 32 public: … … 35 42 TH1 *GetHistByName(const TString name) { return NULL; } 36 43 37 const MCurrents &GetSum() const { return fSum; } 44 const TArrayF &GetSum() const { return fSum; } 45 const TArrayF &GetRms() const { return fRms; } 46 47 const TH1F &GetHist() const { return fHist; } 38 48 39 49 void Draw(Option_t *opt=""); -
trunk/MagicSoft/Mars/mmain/MStatusDisplay.cc
r2173 r2178 181 181 filemenu->AddEntry("Save As status.&root", kFileSaveAsRoot); 182 182 filemenu->AddSeparator(); 183 filemenu->AddEntry("Re&set", kFileReset); 184 filemenu->AddSeparator(); 183 185 filemenu->AddEntry("Print with &lpr", kFilePrint); 184 186 //filemenu->AddEntry("Set printer &name", kFilePrinterName); … … 196 198 tabmenu->AddEntry("Save As tab-i.&C", kTabSaveAsC); 197 199 tabmenu->AddEntry("Save As tab-i.&root", kTabSaveAsRoot); 200 tabmenu->AddSeparator(); 201 tabmenu->AddEntry("Re&move", kTabRemove); 198 202 tabmenu->AddSeparator(); 199 203 tabmenu->AddEntry("Print with &lpr", kFilePrint); … … 560 564 // to the corresponding TCanvas. If it isn't found NULL is returned. 561 565 // 562 T Canvas *MStatusDisplay::GetCanvas(TGCompositeFrame *cf) const566 TRootEmbeddedCanvas *MStatusDisplay::GetEmbeddedCanvas(TGCompositeFrame *cf) const 563 567 { 564 568 TIter Next(cf->GetList()); … … 567 571 while ((f=(TGFrameElement*)Next())) 568 572 if (f->fFrame->InheritsFrom(TRootEmbeddedCanvas::Class())) 569 return ( (TRootEmbeddedCanvas*)f->fFrame)->GetCanvas();573 return (TRootEmbeddedCanvas*)f->fFrame; 570 574 571 575 return NULL; 576 } 577 578 // -------------------------------------------------------------------------- 579 // 580 // Takes a TGCompositeFrame as argument. Searches for the first 581 // TRootEmbeddedCanvas which is contained by it and returns a pointer 582 // to the corresponding TCanvas. If it isn't found NULL is returned. 583 // 584 TCanvas *MStatusDisplay::GetCanvas(TGCompositeFrame *cf) const 585 { 586 TRootEmbeddedCanvas *ec = GetEmbeddedCanvas(cf); 587 return ec ? ec->GetCanvas() : NULL; 572 588 } 573 589 … … 654 670 c.SetBorderMode(0); 655 671 656 // If kNoCont axtMenu set set kNoCOntextMenu of the canvas672 // If kNoContextMenu set set kNoContextMenu of the canvas 657 673 if (TestBit(kNoContextMenu)) 658 674 c.SetBit(kNoContextMenu); … … 738 754 739 755 return pages; 756 } 757 758 // -------------------------------------------------------------------------- 759 // 760 // Remove tab no i if this tab contains a TRootEmbeddedCanvas 761 // 762 void MStatusDisplay::RemoveTab(int i) 763 { 764 TGCompositeFrame *f = fTab->GetTabContainer(i); 765 if (!f) 766 return; 767 768 TRootEmbeddedCanvas *ec = GetEmbeddedCanvas(f); 769 if (!ec) 770 return; 771 772 TCanvas *c = ec->GetCanvas(); 773 if (!c) 774 return; 775 776 const TString name(c->GetName()); 777 778 f->RemoveFrame(ec); 779 delete fList->Remove(ec); 780 781 fTab->RemoveTab(i); 782 783 // layout and map new tab 784 #if ROOT_VERSION_CODE < ROOT_VERSION(3,03,00) 785 MapSubwindows(); 786 Layout(); 787 #else 788 Layout(); 789 MapSubwindows(); 790 #endif 791 792 // display new tab in the main frame 793 gClient->ProcessEventsFor(fTab); 794 795 *fLog << inf << "Removed Tab #" << i << " '" << name << "'" << endl; 796 } 797 798 // -------------------------------------------------------------------------- 799 // 800 // Use this to check whether the MStatusDisplay still contains the 801 // TCanvas c. It could be removed meanwhile by menu usage. 802 // 803 Bool_t MStatusDisplay::HasCanvas(const TCanvas *c) const 804 { 805 for (int i=1; i<fTab->GetNumberOfTabs(); i++) 806 if (c==GetCanvas(i)) 807 return kTRUE; 808 return kFALSE; 740 809 } 741 810 … … 773 842 return kTRUE; 774 843 844 case kFileReset: 845 for (int i=fTab->GetNumberOfTabs()-1; i>0; i--) 846 RemoveTab(i); 847 return kTRUE; 775 848 /* 776 849 case kFileSave: … … 828 901 case kTabPrevious: 829 902 fTab->SetTab(fTab->GetCurrent()-1); 903 return kTRUE; 904 905 case kTabRemove: 906 RemoveTab(fTab->GetCurrent()); 830 907 return kTRUE; 831 908 -
trunk/MagicSoft/Mars/mmain/MStatusDisplay.h
r2117 r2178 27 27 class TGProgressBar; 28 28 class TGHProgressBar; 29 class TRootEmbeddedCanvas; 29 30 30 31 class MStatusDisplay : public TGMainFrame … … 35 36 kFileBrowser, kFileCanvas, kFileSave, kFileSaveAs, kFileSaveAsPS, 36 37 kFileSaveAsRoot, kFileSaveAsGIF, kFileSaveAsC, kFilePrint, 37 kFilePrinterName, kFileExit, 38 kFilePrinterName, kFileExit, kFileReset, 38 39 // kLoop 39 40 kLoopNone, kLoopStop, 40 41 // kTab 41 42 kTabSave, kTabSaveAs, kTabSaveAsPS, kTabSaveAsRoot, kTabSaveAsGIF, 42 kTabSaveAsC, kTabPrint, kTabNext, kTabPrevious, 43 kTabSaveAsC, kTabPrint, kTabNext, kTabPrevious, kTabRemove, 43 44 // kSize 44 45 kSize640, kSize800, kSize960, kSize1024, kSize1280, … … 102 103 void UpdatePSHeader(const TString &name) const; 103 104 105 void Reset(); 106 void RemoveTab(int i); 107 108 TRootEmbeddedCanvas *GetEmbeddedCanvas(TGCompositeFrame *cf) const; 109 104 110 public: 105 111 MStatusDisplay(Long_t t=1000); … … 122 128 TCanvas &AddTab(const char *name); 123 129 130 Bool_t HasCanvas(const TCanvas *c) const; 124 131 TCanvas *GetCanvas(int i) const; 125 132 TCanvas *GetCanvas(const TString &name) const; -
trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
r2173 r2178 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@uni-sw.gwdg.de>19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 118 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2003 21 21 ! 22 22 ! … … 45 45 // -------------------------- 46 46 // see fHiGainFadcSaples 47 // 48 // 49 // Version 2: Derives from MCamEvent now 47 50 // 48 51 ///////////////////////////////////////////////////////////////////////////// … … 232 235 if (!pix.Jump(id)) 233 236 { 234 *fLog << warn << "Pixel Id #" << id << " doesn't exist!" << endl;237 *fLog << warn << "Pixel Idx #" << id << " doesn't exist!" << endl; 235 238 return; 236 239 } 237 240 238 241 const Byte_t *higains = pix.GetHiGainSamples(); 239 240 const Int_t n = GetNumHiGainSamples(); 241 242 TString name = "Pixel No."; 242 const Byte_t *logains = pix.GetLoGainSamples(); 243 244 const Int_t nh = GetNumHiGainSamples(); 245 const Int_t nl = GetNumLoGainSamples(); 246 247 TString name = "Pixel Idx."; 243 248 name += pix.GetPixelId(); 244 249 250 Bool_t same = str.Contains("same", TString::kIgnoreCase); 251 245 252 if (str.BeginsWith("GRAPH", TString::kIgnoreCase)) 246 253 { 247 *fLog << inf << "Drawing Graph: Pixel Id #" << pix.GetPixelId();254 *fLog << inf << "Drawing Graph: Pixel Idx #" << pix.GetPixelId(); 248 255 *fLog << " of " << (int)GetNumPixels() << "Pixels" << endl; 249 256 250 257 TGraph *graph = new TGraph; 251 258 252 for (int i=0; i<n ; i++)259 for (int i=0; i<nh; i++) 253 260 graph->SetPoint(graph->GetN(), i, higains[i]); 254 261 … … 257 264 258 265 graph->SetBit(kCanDelete); 259 graph->Draw( "AC*");266 graph->Draw(same ? "C*" : "AC*"); 260 267 261 268 TH1F *hist = graph->GetHistogram(); … … 269 276 if (str.BeginsWith("HIST", TString::kIgnoreCase)) 270 277 { 271 *fLog << "Drawing Histogram of Pixel with Id " << pix.GetPixelId() << endl; 272 273 TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n); 274 hist->SetXTitle("Time/FADC Slices"); 275 hist->SetYTitle("Signal/FADC Units"); 276 277 for (int i=0; i<n; i++) 278 hist->Fill(0.5+i, higains[i]); 279 280 hist->SetBit(kCanDelete); 281 hist->Draw(); 282 278 // FIXME: Add Legend 279 *fLog << "Drawing Histogram of Pixel with Idx " << pix.GetPixelId() << endl; 280 281 TH1F *histh = new TH1F(name, "FADC Samples", nh, -0.5, nh-.5); 282 histh->SetXTitle("Time [FADC Slices]"); 283 histh->SetYTitle("Signal [FADC Units]"); 284 histh->SetDirectory(NULL); 285 for (int i=0; i<nh; i++) 286 histh->Fill(i, higains[i]); 287 histh->SetBit(kCanDelete); 288 histh->Draw(same ? "same" : ""); 289 290 if (nh>0) 291 { 292 TH1F *histl = new TH1F(name+";2", "FADC Samples", nl, -0.5, nl-.5); 293 histl->SetLineColor(kBlue); 294 histl->SetDirectory(NULL); 295 for (int i=0; i<nl; i++) 296 histl->Fill(i, logains[i]); 297 histl->SetBit(kCanDelete); 298 histl->Draw("same"); 299 } 283 300 return; 284 301 } … … 447 464 } 448 465 466 Bool_t MRawEvtData::GetPixelContent(Float_t &val, Int_t idx, Float_t ratio, Int_t type) const 467 { 468 MRawEvtPixelIter Next(const_cast<MRawEvtData*>(this)); 469 if (!Next.Jump(idx)) 470 return kFALSE; 471 472 val = Next.GetSumHiGainSamples(); 473 return kTRUE; 474 } -
trunk/MagicSoft/Mars/mraw/MRawEvtData.h
r2173 r2178 2 2 #define MARS_MRawEvtData 3 3 4 #ifndef MARS_M ParContainer5 #include "M ParContainer.h"4 #ifndef MARS_MCamEvent 5 #include "MCamEvent.h" 6 6 #endif 7 7 … … 16 16 class MArrayB; 17 17 18 class MRawEvtData : public MParContainer 18 #include <iostream.h> 19 20 class MRawEvtData : public MCamEvent 19 21 { 20 22 friend class MRawEvtPixelIter; … … 63 65 void ReadEvt(istream &fin); 64 66 65 ClassDef(MRawEvtData, 1) //Container to store the raw Event Data 67 Bool_t GetPixelContent(Float_t &val, Int_t idx, Float_t ratio=1, Int_t type=0) const; 68 void DrawPixelContent(Int_t num) const 69 { 70 TString s("HIST"); 71 s += num; 72 const_cast<MRawEvtData*>(this)->Draw(s); 73 } 74 75 ClassDef(MRawEvtData, 2) //Container to store the raw Event Data 66 76 }; 67 77 -
trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc
r1548 r2178 187 187 } 188 188 189 Float_t MRawEvtPixelIter::GetVarHiGainSamples() const 190 { 191 Byte_t *ptr = fHiGainPos; 192 const Byte_t *end = ptr + fNumHiGainSamples; 193 194 ULong_t sum=0; 195 ULong_t sqsum=0; 196 197 do { 198 sum += *ptr; 199 sqsum += (*ptr)*(*ptr); 200 } while (++ptr != end); 201 202 return (sqsum-(Float_t)sum*sum/fNumHiGainSamples)/(fNumHiGainSamples-1); 203 } 204 189 205 // -------------------------------------------------------------------------- 190 206 // -
trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.h
r2123 r2178 79 79 ULong_t GetSumHiGainSamples() const; 80 80 ULong_t GetSumSqrHiGainSamples() const; 81 Float_t GetVarHiGainSamples() const; 81 82 82 83 Bool_t HasLoGain() const -
trunk/MagicSoft/Mars/mraw/Makefile
r1160 r2178 22 22 # connect the include files defined in the config.mk file 23 23 # 24 INCLUDES = -I. -I../mbase -I../MBase 24 INCLUDES = -I. -I../mbase -I../MBase -I../mgui 25 25 26 26 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.