Changeset 3237 for trunk/MagicSoft
- Timestamp:
- 02/19/04 10:30:23 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3236 r3237 4 4 5 5 -*-*- END OF LINE -*-*- 6 2004/01/19: Thomas Bretz 7 8 * manalysis/MCerPhotEvt.h: 9 - added operator= to MCerPhotEvtIter -- is this correct? 10 11 * mhist/MHCamera.[h,cc]: 12 - added member function to calculate minimum content and 13 maximum content for a single sector 14 - Added possibility to get a projection for a single sector. 15 - GetMinimum/GetMaximum now only takes used pixels into account 16 (you can request all pixels using a different member function) 17 - fixed projection (projection only took pixels with contents!=0 18 instead of 'used' pixels 19 - Don't call Sumw2() anymore for projection 20 21 * mjobs/MJExtractSignal.cc: 22 - added MPedestalCam to output again - MPedestalCam was fixed 23 yesterday 24 - Added Histograms for the two camera halves 25 26 6 27 7 28 2004/01/18: Markus Gaug … … 15 36 * mcalib/MCalibrationPix.h 16 37 - move CalcFFactorMethod to public 17 38 39 18 40 19 41 2004/01/18: Abelardo Moralejo -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r3148 r3237 96 96 MCerPhotEvtIter(const MCerPhotEvt *evt, Bool_t usedonly=kTRUE, Bool_t dir=kIterForward) : TObjArrayIter(evt->fPixels, dir), fUsedOnly(usedonly) { } 97 97 TObject *Next(); 98 TIterator &operator=(const TIterator &) { return *this; } 98 99 ClassDef(MCerPhotEvtIter, 0) 99 100 }; -
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r3143 r3237 162 162 // ------------------------------------------------------------------------ 163 163 // 164 // Return kTRUE for sector<0. Otherwise return kTRUE only if the specified 165 // sector idx matches the sector of the pixel with index idx. 166 // 167 Bool_t MHCamera::MatchSector(Int_t idx, Int_t sector) const 168 { 169 return sector<0 ? kTRUE : (*fGeomCam)[idx].GetSector()==(UInt_t)sector; 170 } 171 172 // ------------------------------------------------------------------------ 173 // 164 174 // Taken from TH1D::Fill(). Uses the argument directly as bin index. 165 175 // Doesn't increment the number of entries. … … 255 265 } 256 266 257 Stat_t MHCamera::GetMean(Int_t axis) const 267 // ------------------------------------------------------------------------ 268 // 269 // Return the mean value of all entries which are used if all=kFALSE and 270 // of all entries if all=kTRUE if sector<0. If sector>=0 only 271 // entries with match the given sector are taken into account. 272 // 273 Stat_t MHCamera::GetMeanSector(Int_t sector, Bool_t all) const 258 274 { 259 275 if (fNcells<=1) 260 276 return 0; 261 277 278 Int_t n=0; 279 262 280 Stat_t mean = 0; 263 for (int i=1; i<fNcells-1; i++) 264 mean += fArray[i]; 265 266 return Profile(mean/(fNcells-2)); 267 } 268 269 Stat_t MHCamera::GetRMS(Int_t axis) const 281 for (int i=0; i<fNcells-2; i++) 282 { 283 if ((all || IsUsed(i)) && MatchSector(i, sector)) 284 { 285 mean += fArray[i+1]; 286 n++; 287 } 288 } 289 290 return Profile(mean/n); 291 } 292 293 // ------------------------------------------------------------------------ 294 // 295 // Return the rms value of all entries which are used if all=kFALSE and 296 // of all entries if all=kTRUE if sector<0. If sector>=0 only 297 // entries with match the given sector are taken into account. 298 // 299 Stat_t MHCamera::GetRmsSector(Int_t sector, Bool_t all) const 270 300 { 271 301 if (fNcells<=1) 272 302 return -1; 273 303 274 const Int_t n = fNcells-2;304 Int_t n=0; 275 305 276 306 Stat_t sum = 0; 277 307 Stat_t sq = 0; 278 for (int i=1; i<n+1; i++) 279 { 280 sum += fArray[i]; 281 sq += fArray[i]*fArray[i]; 308 for (int i=0; i<fNcells-2; i++) 309 { 310 if ((all || IsUsed(i)) && MatchSector(i, sector)) 311 { 312 sum += fArray[i+1]; 313 sq += fArray[i+1]*fArray[i+1]; 314 n++; 315 } 282 316 } 283 317 … … 291 325 // 292 326 // Return the minimum contents of all pixels (if all is set, otherwise 293 // only of all 'used' pixels), fMinimum if fMinimum set 294 // 295 Double_t MHCamera::GetMinimum(Bool_t all) const 327 // only of all 'used' pixels), fMinimum if fMinimum set. If sector>=0 328 // only pixels with matching sector number are taken into account. 329 // 330 Double_t MHCamera::GetMinimumSector(Int_t sector, Bool_t all) const 296 331 { 297 332 if (fMinimum != -1111) … … 303 338 Double_t minimum=FLT_MAX; 304 339 305 if (all) 306 { 307 for (Int_t idx=0; idx<fNcells-2; idx++) 308 if (fArray[idx+1] < minimum) 309 minimum = fArray[idx+1]; 310 } 311 else 312 { 313 for (Int_t idx=0; idx<fNcells-2; idx++) 314 if (IsUsed(idx) && fArray[idx+1] < minimum) 315 minimum = fArray[idx+1]; 316 } 340 for (Int_t idx=0; idx<fNcells-2; idx++) 341 if (MatchSector(idx, sector) && (all || IsUsed(idx)) && fArray[idx+1]<minimum) 342 minimum = fArray[idx+1]; 343 317 344 return Profile(minimum); 318 345 } … … 321 348 // 322 349 // Return the maximum contents of all pixels (if all is set, otherwise 323 // only of all 'used' pixels), fMaximum if fMaximum set 324 // 325 Double_t MHCamera::GetMaximum(Bool_t all) const 350 // only of all 'used' pixels), fMaximum if fMaximum set. If sector>=0 351 // only pixels with matching sector number are taken into account. 352 // 353 Double_t MHCamera::GetMaximumSector(Int_t sector, Bool_t all) const 326 354 { 327 355 if (fMaximum!=-1111) … … 332 360 333 361 Double_t maximum=-FLT_MAX; 334 if (all) 335 { 336 for (Int_t idx=0; idx<fNcells-2; idx++) 337 if (fArray[idx+1] > maximum) 338 maximum = fArray[idx+1]; 339 } 340 else 341 { 342 for (Int_t idx=0; idx<fNcells-2; idx++) 343 if (IsUsed(idx) && fArray[idx+1] > maximum) 344 maximum = fArray[idx+1]; 345 } 362 for (Int_t idx=0; idx<fNcells-2; idx++) 363 if (MatchSector(idx, sector) && (all || IsUsed(idx)) && fArray[idx+1]>maximum) 364 maximum = fArray[idx+1]; 365 346 366 return Profile(maximum); 347 367 } … … 474 494 // is more or less the same than to TH2-projections. 475 495 // 476 TH1D *MHCamera::Projection(const char *name) const 496 // If sector>=0 only entries with matching sector index are taken 497 // into account. 498 // 499 TH1D *MHCamera::ProjectionS(Int_t sector, const char *name) const 477 500 { 478 501 Int_t nbins = 50; … … 481 504 TString pname(name); 482 505 if (name=="_py") 506 { 483 507 pname.Prepend(GetName()); 508 if (sector>=0) 509 pname += sector; 510 } 484 511 485 512 TH1D *h1=0; … … 494 521 if (!h1) 495 522 { 496 Double_t min = GetMinimum ();497 Double_t max = GetMaximum ();523 Double_t min = GetMinimumSector(sector); 524 Double_t max = GetMaximumSector(sector); 498 525 499 526 Int_t newbins=0; … … 505 532 h1->SetXTitle(GetYaxis()->GetTitle()); 506 533 h1->SetYTitle("Counts"); 507 h1->Sumw2();534 //h1->Sumw2(); 508 535 } 509 536 510 537 // Fill the projected histogram 511 for (Int_t binx =0;binx<=GetNbinsX()+1;binx++) { 512 const Double_t cont = GetBinContent(binx); 513 if (cont!=0) 514 h1->Fill(cont); 515 } 516 517 h1->SetEntries(GetXaxis()->GetNbins()); 538 for (Int_t idx=0; idx<fNcells-2; idx++) 539 if (IsUsed(idx) && MatchSector(idx, sector)) 540 h1->Fill(GetBinContent(idx+1)); 518 541 519 542 return h1; -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r3142 r3237 78 78 void ResetUsed(Int_t idx) { CLRBIT(fUsed[idx], kIsUsed); } 79 79 80 Bool_t MatchSector(Int_t idx, Int_t sector) const; 81 80 82 // This is a trick to remove TH1 entries from the context menu 81 83 TH1 *Rebin(Int_t ngroup=2, const char*newname="") { return this; } … … 138 140 Stat_t GetBinError(Int_t binx, Int_t biny, Int_t binz) const { return GetBinError(binx); } 139 141 140 Double_t GetMinimum(Bool_t all) const; 141 Double_t GetMaximum(Bool_t all) const; 142 143 Double_t GetMinimum() const { return GetMinimum(0/*kTRUE*/); } 144 Double_t GetMaximum() const { return GetMaximum(0/*kTRUE*/); } 142 Double_t GetMinimum(Bool_t all) const { return GetMinimumSector(-1, all); } 143 Double_t GetMaximum(Bool_t all) const { return GetMaximumSector(-1, all); } 144 145 Double_t GetMinimum() const { return GetMinimumSector(-1, kFALSE); } 146 Double_t GetMaximum() const { return GetMaximumSector(-1, kFALSE); } 147 148 Double_t GetMinimumSector(Int_t sector, Bool_t all=kFALSE) const; 149 Double_t GetMaximumSector(Int_t sector, Bool_t all=kFALSE) const; 145 150 146 151 void SetLevels(const TArrayF &arr); … … 181 186 void AddNotify(TObject *event); 182 187 183 Stat_t GetMean(Int_t axis=-1) const; 184 Stat_t GetRMS(Int_t axis=-1) const; 188 Stat_t GetMean(Bool_t all) const { return GetMeanSector(-1, all); } 189 Stat_t GetRMS(Bool_t all) const { return GetRmsSector(-1, all); } 190 191 Stat_t GetMean(Int_t sector=-1) const { return GetMeanSector(-1, kFALSE); } 192 Stat_t GetRMS(Int_t sector=-1) const { return GetRmsSector(-1, kFALSE); } 193 194 Stat_t GetMeanSector(Int_t sector, Bool_t all=kFALSE) const; 195 Stat_t GetRmsSector(Int_t sector, Bool_t all=kFALSE) const; 185 196 186 197 UInt_t GetNumPixels() const; 187 198 188 TH1D *Projection(const char *name="_py") const; 199 TH1D *Projection(const char *name="_py") const { return ProjectionS(-1, name); } 200 TH1D *ProjectionS(Int_t sector, const char *name="_py") const; 189 201 190 202 const MGeomCam &GetGeomCam() const { return *fGeomCam; } -
trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc
r3199 r3237 328 328 write.AddContainer("MExtractedSignalCam", "Events"); 329 329 write.AddContainer("MTime", "Events"); 330 // FIXME: CRAHSES!write.AddContainer("MPedestalCam", "RunHeaders");330 write.AddContainer("MPedestalCam", "RunHeaders"); 331 331 write.AddContainer("MRawRunHeader", "RunHeaders"); 332 332 write.AddContainer("MBadPixelsCam", "RunHeaders");
Note:
See TracChangeset
for help on using the changeset viewer.