Changeset 2206 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 06/23/03 11:01:53 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MFillH.cc
r2178 r2206 360 360 // with the same type as the given object name. 361 361 // 362 Bool_t MFillH::PreProcess(MParList *pList)362 Int_t MFillH::PreProcess(MParList *pList) 363 363 { 364 364 if (fIndex) … … 467 467 // Fills the data from the parameter conatiner into the histogram container 468 468 // 469 Bool_t MFillH::Process()469 Int_t MFillH::Process() 470 470 { 471 471 if (fIndex) … … 485 485 // has been filled into the histogram. 486 486 // 487 Bool_t MFillH::PostProcess()487 Int_t MFillH::PostProcess() 488 488 { 489 489 // -
trunk/MagicSoft/Mars/mhist/MFillH.h
r2117 r2206 59 59 void SetWeight(const char *name) { fWeightName = name; } 60 60 61 Bool_t PreProcess(MParList *pList);62 Bool_t Process();63 Bool_t PostProcess();61 Int_t PreProcess(MParList *pList); 62 Int_t Process(); 63 Int_t PostProcess(); 64 64 65 65 ClassDef(MFillH, 2) // Task to fill a histogram with data from a parameter container -
trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.cc
r2178 r2206 36 36 37 37 #include "MParList.h" 38 #include "MC erPhotEvt.h"38 #include "MCamEvent.h" 39 39 #include "MCamDisplay.h" 40 40 … … 48 48 // -------------------------------------------------------------------------- 49 49 // 50 // Reset all pixels to 0 and reset fEntries to 0.51 //52 void MHCerPhotEvt::Clear(const Option_t *)53 {54 fSum.Reset();55 // fSum.InitSize(577);56 for (int i=0; i<577; i++)57 {58 fSum.AddPixel(i, 0, 0);59 fSum[i].SetPixelUnused();60 }61 fSum.FixSize();62 fEntries = 0;63 }64 65 // --------------------------------------------------------------------------66 //67 50 // Initialize the name and title of the task. 68 51 // Resets the sum histogram 69 52 // 70 53 MHCerPhotEvt::MHCerPhotEvt(const char *name, const char *title) 71 : f Cam(NULL), fEvt(NULL), fDispl(NULL)54 : fSum(NULL), fEvt(NULL) 72 55 { 73 56 // … … 76 59 fName = name ? name : "MHCerPhotEvt"; 77 60 fTitle = title ? title : "Average of MCerPhotEvts"; 78 79 Clear();80 61 } 81 62 … … 86 67 MHCerPhotEvt::~MHCerPhotEvt() 87 68 { 88 if (f Displ)89 delete f Displ;69 if (fSum) 70 delete fSum; 90 71 } 91 72 … … 99 80 Bool_t MHCerPhotEvt::SetupFill(const MParList *plist) 100 81 { 101 fEvt = (MC erPhotEvt*)plist->FindObject("MCerPhotEvt");82 fEvt = (MCamEvent*)plist->FindObject(fNameEvt, "MCamEvent"); 102 83 if (!fEvt) 103 84 *fLog << warn << GetDescriptor() << ": No MCerPhotEvt available..." << endl; 104 85 105 fCam = (MGeomCam*)plist->FindObject("MGeomCam");106 if (! fCam)86 MGeomCam *cam = (MGeomCam*)plist->FindObject("MGeomCam"); 87 if (!cam) 107 88 *fLog << warn << GetDescriptor() << ": No MGeomCam found." << endl; 108 89 109 Clear(); 90 if (fSum) 91 delete (fSum); 92 fSum = new MCamDisplay(*cam, fNameEvt+";avg", fNameEvt+" Avarage"); 110 93 111 94 return kTRUE; … … 118 101 Bool_t MHCerPhotEvt::Fill(const MParContainer *par, const Stat_t w) 119 102 { 120 const MC erPhotEvt *evt = par ? (MCerPhotEvt*)par: fEvt;103 const MCamEvent *evt = par ? dynamic_cast<const MCamEvent*>(par) : fEvt; 121 104 if (!evt) 122 105 { … … 124 107 return kFALSE; 125 108 } 126 127 const UInt_t n = evt->GetNumPixels(); 128 129 for (UInt_t idx=0; idx<n; idx++) 130 { 131 Float_t val; 132 if (!evt->GetPixelContent(val, idx)) 133 continue; 134 135 fSum[idx].SetPixelUsed(); 136 fSum[idx].AddNumPhotons(val); 137 } 138 139 fEntries++; 109 fSum->AddCamContent(*evt); 140 110 141 111 return kTRUE; … … 148 118 Bool_t MHCerPhotEvt::Finalize() 149 119 { 150 if (fEntries<1) 151 *fLog << warn << "WARNING - " << GetDescriptor() << " doesn't contain entries." << endl; 152 else 153 fSum.Scale(fEntries); 120 if (fSum->GetEntries()>0) 121 fSum->Scale(1./fSum->GetEntries()); 154 122 return kTRUE; 155 123 } 156 124 /* 157 125 // -------------------------------------------------------------------------- 158 126 // … … 161 129 void MHCerPhotEvt::Draw(Option_t *) 162 130 { 163 if (!f Cam)131 if (!fSum) 164 132 { 165 133 *fLog << warn << "WARNING - Cannot draw " << GetDescriptor() << ": No Camera Geometry available." << endl; … … 169 137 TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this, 750, 600); 170 138 pad->SetBorderMode(0); 139 //pad->Divide(1,1); 140 //gPad->SetBorderMode(0); 171 141 172 142 AppendPad(""); … … 179 149 void MHCerPhotEvt::Paint(Option_t *option) 180 150 { 181 if (!fCam) 182 { 183 *fLog << warn << "WARNING - Cannot paint " << GetDescriptor() << ": No Camera Geometry available." << endl; 151 if (!fSum) 184 152 return; 185 }186 153 187 if (!fDispl) 188 fDispl = new MCamDisplay(fCam); 154 fSum->Paint(); 155 } 156 */ 189 157 190 fDispl->Fill(fSum); 191 fDispl->Paint(); 158 TH1 *MHCerPhotEvt::GetHistByName(const TString name) 159 { 160 return fSum; 192 161 } -
trunk/MagicSoft/Mars/mhist/MHCerPhotEvt.h
r2173 r2206 6 6 #endif 7 7 8 #ifndef MARS_MCerPhotEvt9 #include "MCerPhotEvt.h"10 #endif11 12 class TH1D;13 8 class MCamDisplay; 9 class MCamEvent; 14 10 15 11 class MHCerPhotEvt : public MH 16 12 { 17 13 private: 18 MCerPhotEvt fSum; // storing the sum 19 Int_t fEntries; // number of entries in the histogram 20 MGeomCam *fCam; // the present geometry 21 MCerPhotEvt *fEvt; //! the current event 22 MCamDisplay *fDispl; //! the camera display 14 MCamDisplay *fSum; // storing the sum 15 MCamEvent *fEvt; //! the current event 16 17 TString fNameEvt; 18 19 Bool_t SetupFill(const MParList *pList); 20 Bool_t Fill(const MParContainer *par, const Stat_t w=1); 21 Bool_t Finalize(); 23 22 24 23 public: … … 26 25 ~MHCerPhotEvt(); 27 26 28 void Clear(const Option_t *o="");27 void SetNameEvt(const TString name) { fNameEvt = name; } 29 28 30 Bool_t SetupFill(const MParList *pList); 31 Bool_t Fill(const MParContainer *par, const Stat_t w=1); 32 Bool_t Finalize(); 33 34 TH1 *GetHistByName(const TString name) { return NULL; } 35 36 const MCerPhotEvt &GetSum() const { return fSum; } 37 38 void Draw(Option_t *opt=""); 39 void Paint(Option_t *option=""); 29 TH1 *GetHistByName(const TString name=""); 40 30 41 31 ClassDef(MHCerPhotEvt, 1) // Histogram to sum camera events
Note:
See TracChangeset
for help on using the changeset viewer.