Changeset 5156 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 10/01/04 16:41:51 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHCamEvent.cc
r5143 r5156 30 30 // currents or enything else derived from MCamEvent 31 31 // 32 // Setup 33 // ===== 34 // 32 35 // To plot the variance instead of the rms use: 33 36 // MHCamEvent::SetBit(MHCamera::kVariance); 37 // or 38 // MHCamEvent::EnableVariance() 39 // 40 // To count how often a certain pixel is above or below a threshold do: 41 // MHCamEvent::SetThreshold(5.5); // Default=LowerBound 42 // MHCamEvent::SetThreshold(5.5, MHCamEvent::kIsUpperBound); 43 // 34 44 // 35 45 // Axis titles … … 47 57 // MHCamEvent myhist("Titele;;y [cm]"); 48 58 // 49 //50 59 ///////////////////////////////////////////////////////////////////////////// 51 60 #include "MHCamEvent.h" … … 88 97 // 89 98 MHCamEvent::MHCamEvent(const char *name, const char *title) 90 : fSum(NULL), fEvt(NULL), fType(0) 99 : fSum(NULL), fEvt(NULL), fType(0), fThreshold(0), fUseThreshold(0) 91 100 { 92 101 Init(name, title); … … 98 107 // 99 108 MHCamEvent::MHCamEvent(Int_t type, const char *name, const char *title) 100 : fSum(NULL), fEvt(NULL), fType(type) 109 : fSum(NULL), fEvt(NULL), fType(type), fThreshold(0), fUseThreshold(0) 101 110 { 102 111 Init(name, title); … … 111 120 if (fSum) 112 121 delete fSum; 122 } 123 124 // -------------------------------------------------------------------------- 125 // 126 // use this to display the variance instead of the rms. 127 // 128 void MHCamEvent::EnableVariance(Bool_t b) 129 { 130 b ? SetBit(MHCamera::kVariance) : ResetBit(MHCamera::kVariance); 113 131 } 114 132 … … 140 158 } 141 159 160 // Delete a posible old histogram from a previous loop 142 161 if (fSum) 143 162 delete (fSum); 144 163 164 // combine name 145 165 const TString name = fNameEvt.IsNull() ? fName : fNameEvt; 146 166 167 // create and setup MHCamera 147 168 fSum = new MHCamera(*cam, name+";avg"); 148 169 if (fTitle!=gsDefTitle) … … 169 190 return kFALSE; 170 191 } 171 fSum->AddCamContent(*evt, fType); 192 if (fUseThreshold) 193 fSum->CntCamContent(*evt, fThreshold, fType, fUseThreshold>0); 194 else 195 fSum->AddCamContent(*evt, fType); 172 196 return kTRUE; 173 197 } … … 274 298 MHCamera *cam = new MHCamera(*fSum->GetGeometry()); 275 299 cam->SetName(Form("Err_%p", this)); 276 cam->SetTitle( TestBit(MHCamera::kVariance)?"Variance":"Root Mean Squared (rms)");300 cam->SetTitle(fSum->TestBit(MHCamera::kVariance)?"Variance":"Root Mean Squared (rms)"); 277 301 cam->SetYTitle(fSum->GetYaxis()->GetTitle()); 278 302 cam->SetCamContent(*fSum, 1); … … 292 316 h->Draw(); 293 317 } 318 -
trunk/MagicSoft/Mars/mhist/MHCamEvent.h
r5143 r5156 15 15 static const TString gsDefTitle; 16 16 17 MHCamera *fSum; // storing the sum18 MCamEvent *fEvt; //! the current event17 MHCamera *fSum; // storing the sum 18 MCamEvent *fEvt; //! the current event 19 19 20 TString fNameEvt; 20 TString fNameEvt; // Nameof MCamEvent to fill into histogram 21 21 22 Int_t fType; 22 Int_t fType; // Type to used for calling GetPixelContent 23 24 Float_t fThreshold; // Count pixel above/below this threshold 25 Char_t fUseThreshold; // Use a threshold? Which direction has it? 23 26 24 27 void Init(const char *name, const char *title); … … 28 31 29 32 public: 33 enum { kIsLowerBound=1, kIsUpperBound=-1, kNoBound=0 }; 34 30 35 MHCamEvent(const char *name=NULL, const char *title=NULL); 31 36 MHCamEvent(Int_t type, const char *name=NULL, const char *title=NULL); … … 42 47 void PrintOutliers(Float_t s) const; 43 48 49 void SetThreshold(Float_t f, Char_t direction=kIsLowerBound) { fThreshold = f; fUseThreshold=direction; } 50 void EnableVariance(Bool_t b=kTRUE); 51 44 52 ClassDef(MHCamEvent, 1) // Histogram to sum camera events 45 53 }; -
trunk/MagicSoft/Mars/mhist/MHCamEventRot.cc
r3786 r5156 71 71 // 72 72 MHCamEventRot::MHCamEventRot(const char *name, const char *title) 73 : fTime(0), fPointPos(0), fObservatory(0), fType(0), fNameTime("MTime") 73 : fTime(0), fPointPos(0), fObservatory(0), fType(0), fNameTime("MTime"), 74 fThreshold(0), fUseThreshold(kNoBound) 74 75 { 75 76 // … … 192 193 193 194 // Fill histogram 194 fHist.Fill(cx[ix], cy[iy], val); 195 if (fUseThreshold!=kNoBound) 196 { 197 if (val>fThreshold && fUseThreshold==kIsLowerBound || 198 val<fThreshold && fUseThreshold==kIsUpperBound) 199 fHist.Fill(cx[ix], cy[iy]); 200 } 201 else 202 fHist.Fill(cx[ix], cy[iy], val); 195 203 } 196 204 } -
trunk/MagicSoft/Mars/mhist/MHCamEventRot.h
r3786 r5156 28 28 TH2D fHist; // Alpha vs. x and y 29 29 30 Int_t fType; 30 Int_t fType; // Type to used for calling GetPixelContent 31 31 32 32 Double_t fRa; … … 35 35 TString fNameTime; 36 36 37 Float_t fThreshold; // Count pixel above/below this threshold 38 Char_t fUseThreshold; // Use a threshold? Which direction has it? 39 37 40 TObject *GetCatalog(); 38 41 39 42 public: 43 enum { kIsLowerBound=1, kIsUpperBound=-1, kNoBound=0 }; 44 40 45 MHCamEventRot(const char *name=NULL, const char *title=NULL); 41 46 … … 49 54 void Draw(Option_t *option=""); 50 55 56 void SetThreshold(Float_t f, Char_t direction=kIsLowerBound) { fThreshold = f; fUseThreshold=direction; } 57 51 58 ClassDef(MHCamEventRot, 1) //2D-histogram in MCamEvent data (derotated) 52 59 }; -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r5143 r5156 1257 1257 // 1 is added to each pixel if the contents of MCamEvent<threshold (in case isabove is set to kFALSE) 1258 1258 // 1259 // in unused pixel is not counted if it didn't fullfill the condition. 1260 // 1259 1261 void MHCamera::CntCamContent(const MCamEvent &event, Double_t threshold, Int_t type, Bool_t isabove) 1260 1262 { … … 1267 1269 Double_t val=threshold; 1268 1270 if (event.GetPixelContent(val, idx, *fGeomCam, type)/* && !IsUsed(idx)*/) 1271 { 1269 1272 SetUsed(idx); 1270 1273 1271 if (val>threshold && isabove) 1272 Fill(idx); 1273 if (val<threshold && !isabove) 1274 Fill(idx); 1274 if (isabove && val>threshold) 1275 Fill(idx); 1276 if (!isabove && val<threshold) 1277 Fill(idx); 1278 } 1275 1279 } 1276 1280 fEntries++; … … 1283 1287 // 1 is added to each pixel if the contents of MCamEvent<threshold (in case isabove is set to kFALSE) 1284 1288 // 1289 // in unused pixel is not counted if it didn't fullfill the condition. 1290 // 1285 1291 void MHCamera::CntCamContent(const MCamEvent &event, TArrayD threshold, Int_t type, Bool_t isabove) 1286 1292 { … … 1293 1299 Double_t val=threshold[idx]; 1294 1300 if (event.GetPixelContent(val, idx, *fGeomCam, type)/* && !IsUsed(idx)*/) 1301 { 1295 1302 SetUsed(idx); 1296 1303 1297 if (val>threshold[idx] && isabove) 1298 Fill(idx); 1299 if (val<threshold[idx] && !isabove) 1300 Fill(idx); 1304 if (val>threshold[idx] && isabove) 1305 Fill(idx); 1306 if (val<threshold[idx] && !isabove) 1307 Fill(idx); 1308 } 1301 1309 } 1302 1310 fEntries++; … … 1315 1323 for (Int_t idx=0; idx<fNcells-2; idx++) 1316 1324 { 1317 if ( const_cast<TArrayD&>(event)[idx]>threshold)1325 if (event[idx]>threshold) 1318 1326 Fill(idx); 1319 1327
Note:
See TracChangeset
for help on using the changeset viewer.