- Timestamp:
- 03/04/04 15:46:17 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3396 r3400 45 45 - changes such, that it doesn't crash if signal has no lo-gain 46 46 (This might still give wrong results!) 47 48 * macros/dohtml.C: 49 - added pixvstime.C 50 - added sectorvstime.C 51 52 * manalysis/MMcCalibrationUpdate.cc: 53 - some changes on file consistency check done by Abelardo, 54 he may comment on it 55 56 * mhist/MHCamera.[h,cc]: 57 - changed to support also dividing the camera in pixels area indices 58 59 * mhist/MHEvent.cc: 60 - minor change 61 62 * mjobs/MJPedestal.cc: 63 - adapted to changes in MHCamera 47 64 48 65 -
trunk/MagicSoft/Mars/macros/dohtml.C
r3394 r3400 102 102 html.Convert("pedvsevent.C", "MARS - Example to use MPedCalcPedRun"); 103 103 html.Convert("pedphotcalc.C", "MARS - Example to use MPedPhotCalc"); 104 html.Convert("pixvstime.C", "MARS - Example how to plot a pixel value versus time"); 105 html.Convert("sectorvstime.C", "MARS - Example how to plot mean value of a camera sector versus time"); 104 106 } -
trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc
r3374 r3400 62 62 63 63 #include "MRawRunHeader.h" 64 #include "MMcRunHeader.hxx" 64 65 #include "MMcFadcHeader.hxx" 65 66 … … 169 170 } 170 171 172 MMcRunHeader* mcrunh = (MMcRunHeader*) pList->FindObject("MMcRunHeader"); 173 171 174 // 172 175 // Initialize Fadc simulation parameters: … … 175 178 { 176 179 fAmplitude = fHeaderFadc->GetAmplitud(); 177 fAmplitudeOuter = fHeaderFadc->GetAmplitudOuter(); 178 fConversionHiLo = fHeaderFadc->GetLow2HighGain(); 180 if (mcrunh->GetCamVersion() > 60) 181 { 182 fAmplitudeOuter = fHeaderFadc->GetAmplitudOuter(); 183 fConversionHiLo = fHeaderFadc->GetLow2HighGain(); 184 } 185 else // old MC files, camera < v0.7 186 { 187 fAmplitudeOuter = fAmplitude; 188 fConversionHiLo = 1; // dummy value 189 } 190 179 191 } 180 192 else // Check that following files have all the same FADC parameters 181 193 { 182 if ( fabs(fHeaderFadc->GetAmplitud()-fAmplitude) > 1.e-6 || 183 fabs(fHeaderFadc->GetAmplitudOuter()-fAmplitudeOuter) > 1.e-6 || 184 fabs(fConversionHiLo-fHeaderFadc->GetLow2HighGain()) > 1.e-6 ) 185 { 186 *fLog << err << "Parameters of MMcFadcHeader are not the same for all files... aborting." << endl; 187 return kFALSE; 188 } 189 } 194 if ( fabs(fHeaderFadc->GetAmplitud()-fAmplitude) > 1.e-6 ) 195 { 196 *fLog << err << "Parameters of MMcFadcHeader are not the same for all files... aborting." << endl; 197 return kFALSE; 198 } 199 200 if (mcrunh->GetCamVersion() > 60) // old MC files, camera < v0.7 201 { 202 if( fabs(fHeaderFadc->GetAmplitudOuter()-fAmplitudeOuter) > 1.e-6 || 203 fabs(fConversionHiLo-fHeaderFadc->GetLow2HighGain()) > 1.e-6 ) 204 { 205 *fLog << err << "Parameters of MMcFadcHeader are not the same for all files... aborting." << endl; 206 return kFALSE; 207 } 208 } 209 } 210 211 190 212 191 213 // -
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); -
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r3387 r3400 119 119 if (obj1->GetGeomCam().InheritsFrom("MGeomCamMagic")) 120 120 { 121 TArrayI s0(3); 122 s0[0] = 6; 123 s0[1] = 1; 124 s0[2] = 2; 125 126 TArrayI s1(3); 127 s1[0] = 3; 128 s1[1] = 4; 129 s1[2] = 5; 130 131 TArrayI inner(1); 132 inner[0] = 0; 133 121 134 // Just to get the right (maximum) binning 122 135 TH1D *half[2]; 123 half[0] = obj1->Projection ("Sector 6-1-2");124 half[1] = obj1->Projection ("Sector 3-4-5");125 126 half[0]->Reset();127 half[1]->Reset();128 129 TH1D *dummy = obj1->Projection("Dummy");130 131 for (int i=1; i<7/*obj1->GetGeomCam().GetNumSectors()*/; i++)132 133 136 half[0] = obj1->ProjectionS(s0, inner, "Sector 6-1-2"); 137 half[1] = obj1->ProjectionS(s0, inner, "Sector 3-4-5"); 138 /* 139 half[0]->Reset(); 140 half[1]->Reset(); 141 142 TH1D *dummy = obj1->Projection("Dummy"); 143 144 for (int i=1; i<7; i++) 145 half[(i/3)%2]->Add(obj1->ProjectionS(i, "Dummy")); 146 */ 134 147 for (int i=0; i<2; i++) 135 148 { … … 140 153 } 141 154 142 delete dummy;155 //delete dummy; 143 156 } 144 157
Note:
See TracChangeset
for help on using the changeset viewer.