Changeset 3400 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 03/04/04 15:46:17 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r3324 r3400 164 164 // sector idx matches the sector of the pixel with index idx. 165 165 // 166 Bool_t MHCamera::MatchSector(Int_t idx, Int_t sector) const 167 { 168 return sector<0 ? kTRUE : (*fGeomCam)[idx].GetSector()==(UInt_t)sector; 166 Bool_t MHCamera::MatchSector(Int_t idx, const TArrayI §or, const TArrayI &aidx) const 167 { 168 const MGeomPix &pix = (*fGeomCam)[idx]; 169 return FindVal(sector, pix.GetSector()) && FindVal(aidx, pix.GetAidx()); 169 170 } 170 171 … … 270 271 // entries with match the given sector are taken into account. 271 272 // 272 Stat_t MHCamera::GetMeanSector (Int_t sector, Bool_t all) const273 Stat_t MHCamera::GetMeanSectors(const TArrayI §or, const TArrayI &aidx, Bool_t all) const 273 274 { 274 275 if (fNcells<=1) … … 280 281 for (int i=0; i<fNcells-2; i++) 281 282 { 282 if ((all || IsUsed(i)) && MatchSector(i, sector ))283 if ((all || IsUsed(i)) && MatchSector(i, sector, aidx)) 283 284 { 284 285 mean += fArray[i+1]; … … 296 297 // entries with match the given sector are taken into account. 297 298 // 298 Stat_t MHCamera::GetRmsSector (Int_t sector, Bool_t all) const299 Stat_t MHCamera::GetRmsSectors(const TArrayI §or, const TArrayI &aidx, Bool_t all) const 299 300 { 300 301 if (fNcells<=1) … … 307 308 for (int i=0; i<fNcells-2; i++) 308 309 { 309 if ((all || IsUsed(i)) && MatchSector(i, sector ))310 if ((all || IsUsed(i)) && MatchSector(i, sector, aidx)) 310 311 { 311 312 sum += fArray[i+1]; … … 327 328 // only pixels with matching sector number are taken into account. 328 329 // 329 Double_t MHCamera::GetMinimumSector (Int_t sector, Bool_t all) const330 Double_t MHCamera::GetMinimumSectors(const TArrayI §or, const TArrayI &aidx, Bool_t all) const 330 331 { 331 332 if (fMinimum != -1111) … … 338 339 339 340 for (Int_t idx=0; idx<fNcells-2; idx++) 340 if (MatchSector(idx, sector ) && (all || IsUsed(idx)) && fArray[idx+1]<minimum)341 if (MatchSector(idx, sector, aidx) && (all || IsUsed(idx)) && fArray[idx+1]<minimum) 341 342 minimum = fArray[idx+1]; 342 343 … … 350 351 // only pixels with matching sector number are taken into account. 351 352 // 352 Double_t MHCamera::GetMaximumSector (Int_t sector, Bool_t all) const353 Double_t MHCamera::GetMaximumSectors(const TArrayI §or, const TArrayI &aidx, Bool_t all) const 353 354 { 354 355 if (fMaximum!=-1111) … … 360 361 Double_t maximum=-FLT_MAX; 361 362 for (Int_t idx=0; idx<fNcells-2; idx++) 362 if (MatchSector(idx, sector ) && (all || IsUsed(idx)) && fArray[idx+1]>maximum)363 if (MatchSector(idx, sector, aidx) && (all || IsUsed(idx)) && fArray[idx+1]>maximum) 363 364 maximum = fArray[idx+1]; 364 365 … … 496 497 // into account. 497 498 // 498 TH1D *MHCamera::ProjectionS( Int_t sector, const char *name) const499 TH1D *MHCamera::ProjectionS(const TArrayI §or, const TArrayI &aidx, const char *name) const 499 500 { 500 501 Int_t nbins = 50; … … 505 506 { 506 507 pname.Prepend(GetName()); 507 if (sector>=0) 508 pname += sector; 508 if (sector.GetSize()>0) 509 { 510 pname += ";"; 511 for (int i=0; i<sector.GetSize(); i++) 512 pname += sector[i]; 513 } 514 if (aidx.GetSize()>0) 515 { 516 pname += ";"; 517 for (int i=0; i<aidx.GetSize(); i++) 518 pname += aidx[i]; 519 } 509 520 } 510 521 … … 520 531 if (!h1) 521 532 { 522 Double_t min = GetMinimumSector (sector);523 Double_t max = GetMaximumSector (sector);533 Double_t min = GetMinimumSectors(sector, aidx); 534 Double_t max = GetMaximumSectors(sector, aidx); 524 535 525 536 Int_t newbins=0; … … 536 547 // Fill the projected histogram 537 548 for (Int_t idx=0; idx<fNcells-2; idx++) 538 if (IsUsed(idx) && MatchSector(idx, sector ))549 if (IsUsed(idx) && MatchSector(idx, sector, aidx)) 539 550 h1->Fill(GetBinContent(idx+1)); 540 551 -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r3237 r3400 78 78 void ResetUsed(Int_t idx) { CLRBIT(fUsed[idx], kIsUsed); } 79 79 80 Bool_t MatchSector(Int_t idx, Int_t sector) const; 80 Bool_t FindVal(const TArrayI &arr, Int_t val) const 81 { 82 const Int_t n = arr.GetSize(); 83 if (n==0) 84 return kTRUE; 85 86 const Int_t *p = arr.GetArray(); 87 const Int_t *end = p+n; 88 while (p<end) 89 if (val==*p++) 90 return kTRUE; 91 92 return kFALSE; 93 } 94 Bool_t MatchSector(Int_t idx, const TArrayI §or, const TArrayI &aidx) const; 81 95 82 96 // This is a trick to remove TH1 entries from the context menu … … 140 154 Stat_t GetBinError(Int_t binx, Int_t biny, Int_t binz) const { return GetBinError(binx); } 141 155 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; 156 Double_t GetMinimum(Bool_t all) const { return GetMinimumSectors(TArrayI(), TArrayI(), all); } 157 Double_t GetMaximum(Bool_t all) const { return GetMaximumSectors(TArrayI(), TArrayI(), all); } 158 159 Double_t GetMinimum() const { return GetMinimumSectors(TArrayI(), TArrayI(), kFALSE); } 160 Double_t GetMaximum() const { return GetMaximumSectors(TArrayI(), TArrayI(), kFALSE); } 161 162 Double_t GetMinimumSector(Int_t sector, Int_t aidx, Bool_t all=kFALSE) const 163 { 164 return GetMinimumSectors(TArrayI(1, §or), TArrayI(1, &aidx), all); 165 } 166 Double_t GetMaximumSector(Int_t sector, Int_t aidx, Bool_t all=kFALSE) const 167 { 168 return GetMaximumSectors(TArrayI(1, §or), TArrayI(1, &aidx), all); 169 } 170 Double_t GetMinimumSectors(const TArrayI §or, const TArrayI &aidx, Bool_t all=kFALSE) const; 171 Double_t GetMaximumSectors(const TArrayI §or, const TArrayI &aidx, Bool_t all=kFALSE) const; 150 172 151 173 void SetLevels(const TArrayF &arr); … … 186 208 void AddNotify(TObject *event); 187 209 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; 210 Stat_t GetMean(Bool_t all) const { return GetMeanSectors(TArrayI(), TArrayI(), all); } 211 Stat_t GetRMS(Bool_t all) const { return GetRmsSectors(TArrayI(), TArrayI(), all); } 212 213 Stat_t GetMean(Int_t=0) const { return GetMeanSectors(TArrayI(), TArrayI(), kFALSE); } 214 Stat_t GetRMS(Int_t=0) const { return GetRmsSectors(TArrayI(), TArrayI(), kFALSE); } 215 216 Stat_t GetMeanSector(Int_t sector, Int_t aidx, Bool_t all=kFALSE) const 217 { 218 return GetMeanSectors(TArrayI(1, §or), TArrayI(1, &aidx), all); 219 } 220 Stat_t GetRmsSector(Int_t sector, Int_t aidx, Bool_t all=kFALSE) const 221 { 222 return GetRmsSectors(TArrayI(1, §or), TArrayI(1, &aidx), all); 223 } 224 225 Stat_t GetMeanSectors(const TArrayI §or, const TArrayI &aidx, Bool_t all=kFALSE) const; 226 Stat_t GetRmsSectors(const TArrayI §or, const TArrayI &aidx, Bool_t all=kFALSE) const; 196 227 197 228 UInt_t GetNumPixels() const; 198 229 199 TH1D *Projection(const char *name="_py") const { return ProjectionS(-1, name); } 200 TH1D *ProjectionS(Int_t sector, const char *name="_py") const; 230 TH1D *Projection(const char *name="_py") const { return ProjectionS(TArrayI(), TArrayI(), name); } 231 TH1D *ProjectionS(Int_t sector, Int_t aidx, const char *name="_py") const 232 { 233 return ProjectionS(TArrayI(1, §or), TArrayI(1, &aidx), name); 234 } 235 TH1D *ProjectionS(const TArrayI §or, const TArrayI &aidx, const char *name="_py") const; 201 236 202 237 const MGeomCam &GetGeomCam() const { return *fGeomCam; } -
trunk/MagicSoft/Mars/mhist/MHEvent.cc
r3325 r3400 238 238 239 239 txt += fMcEvt->GetParticleName(); 240 txt += " "; 240 241 241 242 s.Insert(0, txt);
Note:
See TracChangeset
for help on using the changeset viewer.