Changeset 2410
- Timestamp:
- 10/20/03 17:49:59 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r2409 r2410 351 351 // -------------------------------------------------------------------------- 352 352 // 353 // Return a pointer to the pixel with the requested id. NULL if it doesn't 354 // exist. 353 // Return a pointer to the pixel with the requested idx. NULL if it doesn't 354 // exist. The Look-up-table fLut is used. If its size is zero (according 355 // to Rene this will happen if an old class object is loaded) we still 356 // try to search in the array. 355 357 // 356 358 MCerPhotPix *MCerPhotEvt::GetPixById(int idx) const -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r2216 r2410 4 4 #ifndef ROOT_TClonesArray 5 5 #include <TClonesArray.h> 6 #endif 7 #ifndef ROOT_TArrayI 8 #include <TArrayI.h> 6 9 #endif 7 10 #ifndef MARS_MCamEvent … … 19 22 private: 20 23 UInt_t fNumPixels; 24 TArrayI fLut; // Lookup tabel to lookup pixel by index 21 25 TClonesArray *fPixels; //-> FIXME: Change TClonesArray away from a pointer? 22 26 … … 28 32 //void InitSize(UInt_t num) { fPixels->Expand(num); } 29 33 30 void AddPixel(Int_t id , Float_t nph, Float_t er)34 void AddPixel(Int_t idx, Float_t nph, Float_t er) 31 35 { 32 new ((*fPixels)[fNumPixels++]) MCerPhotPix(id, nph, er); 36 // 37 // If this is too slow or takes to much space we might use 38 // MGeomApply and an InitSize member function instead. 39 // 40 if (idx>=fLut.GetSize()) 41 fLut.Set(idx+1); 42 43 fLut[idx] = fNumPixels; 44 new ((*fPixels)[fNumPixels++]) MCerPhotPix(idx, nph, er); 33 45 } 34 46 35 47 void FixSize(); 36 37 //Bool_t AddEvent(const MCerPhotEvt &evt);38 48 39 49 Bool_t IsPixelExisting(Int_t id) const; … … 53 63 MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); } 54 64 55 void Scale(Double_t f) ;65 void Scale(Double_t f) { fPixels->ForEach(MCerPhotPix, Scale)(f); } 56 66 void RemoveUnusedPixels(); 57 67 58 MCerPhotPix *GetPixById(int id ) const;68 MCerPhotPix *GetPixById(int idx) const;// { return idx>=0 && idx<fLut.GetSize() ? (MCerPhotPix*)(fPixels->UncheckedAt(fLut[idx])) : 0; } // Return a pointer to the pixel with the requested id. NULL if it doesn't exist. 59 69 60 70 void Reset(); 61 71 62 void Draw(Option_t* option = "");63 72 void Print(Option_t *opt=NULL) const; 64 73 void Clear(Option_t *opt=NULL) { Reset(); } 65 74 66 75 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 67 void DrawPixelContent(Int_t num) const 68 { 69 } 76 void DrawPixelContent(Int_t num, TVirtualPad *pad=NULL) const; 70 77 71 ClassDef(MCerPhotEvt, 1) // class for an event containing cerenkov photons78 ClassDef(MCerPhotEvt, 2) // class for an event containing cerenkov photons 72 79 }; 73 80 74 81 #endif 75 -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.cc
r2377 r2410 92 92 MPedestalPix &MPedestalCam::operator[](Int_t i) 93 93 { 94 return * (MPedestalPix*)fArray->UncheckedAt(i);94 return *static_cast<MPedestalPix*>(fArray->UncheckedAt(i)); 95 95 } 96 96 … … 101 101 MPedestalPix &MPedestalCam::operator[](Int_t i) const 102 102 { 103 return * (MPedestalPix*)fArray->UncheckedAt(i);103 return *static_cast<MPedestalPix*>(fArray->UncheckedAt(i)); 104 104 } 105 105 … … 194 194 return val>=0; 195 195 } 196 197 void MPedestalCam::DrawPixelContent(Int_t num, TVirtualPad *pad) const 198 { 199 *fLog << warn << "MPedestalCam::DrawPixelContent - not available." << endl; 200 } -
trunk/MagicSoft/Mars/manalysis/MPedestalCam.h
r2237 r2410 36 36 37 37 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 38 void DrawPixelContent(Int_t num) const 39 { 40 } 38 void DrawPixelContent(Int_t num, TVirtualPad *pad=NULL) const; 41 39 42 40 ClassDef(MPedestalCam, 1) // Storage Container for all pedestal information of the camera -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r2219 r2410 114 114 TObject *MParContainer::Clone(const char *newname) const 115 115 { 116 117 116 MParContainer *named = (MParContainer*)TObject::Clone(); 118 117 if (newname && strlen(newname)) named->SetName(newname); … … 584 583 return ((TEnv&)env).GetValue(prefix, dflt); 585 584 } 585 586 void MParContainer::DrawTS(TObject *obj, TVirtualPad *pad, Option_t *option) 587 { 588 if (!obj) 589 { 590 gLog << warn << "MParContainer::DrawTS: obj==NULL" << endl; 591 return; 592 } 593 594 if (!pad) 595 pad = gPad; 596 597 // FIXME: Move MH to mbase 598 //if (!pad) 599 // pad = MakeDefCanvas(this); 600 601 if (!pad) 602 { 603 if (!gROOT->GetMakeDefCanvas()) 604 return; 605 (gROOT->GetMakeDefCanvas())(); 606 pad = gPad; 607 } 608 609 if (!pad->IsEditable()) 610 return; 611 612 obj->SetBit(kMustCleanup); 613 614 pad->GetListOfPrimitives()->Add(obj, option); 615 pad->Modified(kTRUE); 616 } 617 618 TObject *MParContainer::DrawCloneTS(const TObject *obj, TVirtualPad *pad, Option_t *option) 619 { 620 // Draw a clone of this object in the current pad 621 if (!obj) 622 return 0; 623 624 TObject *newobj = obj->Clone(); 625 if (!newobj) 626 return 0; 627 628 /* 629 gLog << dbg << "MParConatiner::DrawCloneTS - "; 630 gLog << (int)newobj->InheritsFrom(MParContainer::Class()) << " "; 631 gLog << pad << endl; 632 */ 633 if (newobj->InheritsFrom(MParContainer::Class())) 634 ((MParContainer*)newobj)->DrawTS(pad, strlen(option) ? option : obj->GetDrawOption()); 635 else 636 DrawTS(newobj, pad, strlen(option) ? option : obj->GetDrawOption()); 637 638 return newobj; 639 }
Note:
See TracChangeset
for help on using the changeset viewer.