- Timestamp:
- 11/18/04 15:35:43 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r5428 r5429 26 26 - fixed a bug in the handling of kUsePed which caused the MTaskEnv 27 27 to be set incorrectly 28 29 * mfbase/MFEventSelector2.[h,cc]: 30 - added possibility to set a propability distribution 31 32 * mgeom/MGeomCam.[h,cc]: 33 - enhanced the Print function 34 - fixed the Clone function for the class being MGeomCam 35 - made InitGeometry public to support unsupported geometries 36 37 * mgeom/MGeomPix.h: 38 - added Copy function 39 40 * mhbase/MH3.[h,cc]: 41 - added a constructor taking a TH1 as argument 28 42 29 43 -
trunk/MagicSoft/Mars/mfbase/MFEventSelector2.cc
r5366 r5429 150 150 // variable(s) of interest and the binnings) 151 151 // 152 153 152 MFEventSelector2::MFEventSelector2(MH3 &hist, const char *name, const char *title) 154 153 : fHistOrig(NULL), fHistNom(&hist), fHistRes(NULL), 155 154 fDataX(hist.GetRule('x')), fDataY(hist.GetRule('y')), 156 fDataZ(hist.GetRule('z')), fNumMax(-1) 155 fDataZ(hist.GetRule('z')), fNumMax(-1), fHistIsProbability(kFALSE) 157 156 { 158 157 fName = name ? (TString)name : gsDefName; … … 384 383 } 385 384 386 MRead *read = (MRead*)tasklist->FindObject("MRead");387 if (!read)388 {389 *fLog << err << "MRead not found... abort." << endl;390 return kFALSE;391 }392 393 385 if (!PreProcessData(parlist)) 394 386 return kFALSE; 387 388 fHistNom->SetTitle(fHistIsProbability ? "ProbabilityDistribution" : "Users Nominal Distribution"); 389 390 if (fHistIsProbability) 391 return kTRUE; 395 392 396 393 InitHistogram(fHistOrig); 397 394 InitHistogram(fHistRes); 398 395 399 fHistNom->SetTitle("Users Nominal Distribution");400 396 fHistOrig->SetTitle("Primary Distribution"); 401 397 fHistRes->SetTitle("Resulting Distribution"); … … 407 403 408 404 // Generate primary distribution 405 MRead *read = (MRead*)tasklist->FindObject("MRead"); 406 if (!read) 407 { 408 *fLog << err << "MRead not found... abort." << endl; 409 return kFALSE; 410 } 411 409 412 if (!ReadDistribution(*read)) 410 413 return kFALSE; … … 445 448 446 449 return rc; 450 } 451 452 Bool_t MFEventSelector2::SelectProb(Int_t ibin) const 453 { 454 // 455 // If value is outside histogram range, accept event 456 // 457 return ibin<0 ? kTRUE : fHistNom->GetHist().GetBinContent(ibin) > gRandom->Uniform(); 447 458 } 448 459 … … 462 473 const Double_t valz=fDataZ.GetValue(); 463 474 475 const Int_t ibin = fHistNom->FindFixBin(valx, valy, valz)-1; 476 464 477 // Get corresponding bin number and check 465 478 // whether a selection should be made 466 fResult = Select(fHistNom->FindFixBin(valx, valy, valz)-1);479 fResult = fHistIsProbability ? Select(ibin) : SelectProb(ibin); 467 480 468 481 fCounter[fResult ? 1 : 0]++; … … 481 494 if (GetNumExecutions()>0) 482 495 { 483 *fLog << inf << endl;484 *fLog << GetDescriptor() << " execution statistics:" << endl;485 *fLog << dec << setfill(' ');486 *fLog << " " << setw(7) << fCounter[1] << " (" << setw(3)487 << (int)(fCounter[0]*100/GetNumExecutions())488 << "%) Events not selected" << endl;489 490 *fLog << " " << fCounter[0] << " ("491 << (int)(fCounter[1]*100/GetNumExecutions())492 << "%) Events selected" << endl;493 *fLog << endl;496 *fLog << inf << endl; 497 *fLog << GetDescriptor() << " execution statistics:" << endl; 498 *fLog << dec << setfill(' '); 499 *fLog << " " << setw(7) << fCounter[1] << " (" << setw(3) 500 << (int)(fCounter[0]*100/GetNumExecutions()) 501 << "%) Events not selected" << endl; 502 503 *fLog << " " << fCounter[0] << " (" 504 << (int)(fCounter[1]*100/GetNumExecutions()) 505 << "%) Events selected" << endl; 506 *fLog << endl; 494 507 } 495 508 -
trunk/MagicSoft/Mars/mfbase/MFEventSelector2.h
r3330 r5429 42 42 43 43 Bool_t fResult; 44 Bool_t fHistIsProbability; 44 45 Int_t fCounter[2]; 45 46 … … 49 50 Bool_t PreProcessData(MParList *parlist); 50 51 Bool_t Select(Int_t bin); 52 Bool_t SelectProb(Int_t bin) const; 51 53 52 54 Int_t PreProcess(MParList *parlist); … … 61 63 62 64 void SetNumMax(Long_t max=-1) { fNumMax = max; } 65 void SetHistIsProbability(Bool_t b=kTRUE) { fHistIsProbability=b; } 63 66 Bool_t IsExpressionTrue() const { return fResult; } 64 67 -
trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
r5144 r5429 285 285 // 286 286 *fLog << all << " Number of Pixels (" << GetTitle() << "): " << fNumPixels << endl; 287 *fLog << " Number of Sectors: " << GetNumSectors() << " Area-Indices: " << GetNumAreas() << endl; 288 *fLog << " Min.Radius: " << GetMinRadius() << " Max.Radius: " << GetMaxRadius() << endl; 287 289 288 290 fPixels.Print(); … … 296 298 TObject *MGeomCam::Clone(const char *newname) const 297 299 { 300 if (IsA()==MGeomCam::Class()) 301 { 302 MGeomCam *cam = new MGeomCam(fNumPixels, fCamDist); 303 for (UInt_t i=0; i<fNumPixels; i++) 304 (*this)[i].Copy((*cam)[i]); 305 cam->InitGeometry(); 306 return cam; 307 } 308 298 309 return (TObject*)IsA()->New(); 299 310 } -
trunk/MagicSoft/Mars/mgeom/MGeomCam.h
r3777 r5429 39 39 void CalcNumAreas(); 40 40 void InitOuterRing(); 41 void InitGeometry()42 {43 CalcNumSectors();44 CalcNumAreas();45 CalcMaxRadius();46 CalcPixRatio();47 InitOuterRing();48 }49 41 50 42 … … 59 51 // the use of some camera files from the 0.7 beta version in which the 60 52 // array containing pixel ratios is not initialized. 53 void InitGeometry() 54 { 55 CalcNumSectors(); 56 CalcNumAreas(); 57 CalcMaxRadius(); 58 CalcPixRatio(); 59 InitOuterRing(); 60 } 61 61 62 62 Float_t GetCameraDist() const { return fCamDist; } -
trunk/MagicSoft/Mars/mgeom/MGeomPix.h
r4826 r5429 33 33 public: 34 34 MGeomPix(Float_t x=0, Float_t y=0, Float_t d=0, UInt_t s=0, UInt_t aidx=0); 35 36 void Copy(TObject &obj) const 37 { 38 MGeomPix &pix = (MGeomPix&)obj; 39 pix.fX = fX; 40 pix.fY = fY; 41 pix.fD = fD; 42 pix.fA = fA; 43 pix.fNumNeighbors = fNumNeighbors; 44 pix.fSector = fSector; 45 pix.fAidx = fAidx; 46 for (int i=0; i<6; i++) 47 pix.fNeighbors[i] = fNeighbors[i]; 48 } 35 49 36 50 void Print(Option_t *opt=NULL) const; -
trunk/MagicSoft/Mars/mhbase/MH3.cc
r5300 r5429 166 166 } 167 167 168 MH3::MH3(const TH1 &h1) : fDimension(1) 169 { 170 if (h1.InheritsFrom(TH3::Class())) 171 fDimension = 3; 172 if (h1.InheritsFrom(TH2::Class())) 173 fDimension = 2; 174 175 fData[0] = NULL; 176 fData[1] = NULL; 177 fData[2] = NULL; 178 179 switch (fDimension) 180 { 181 case 3: 182 fData[2] = new MDataChain(h1.GetZaxis()->GetTitle()); 183 case 2: 184 fData[1] = new MDataChain(h1.GetYaxis()->GetTitle()); 185 case 1: 186 fData[0] = new MDataChain(h1.GetXaxis()->GetTitle()); 187 } 188 189 fName = gsDefName; 190 fTitle = gsDefTitle; 191 192 fHist = (TH1*)h1.Clone(); 193 fHist->SetDirectory(NULL); 194 195 fScale[0] = 1; 196 fScale[1] = 1; 197 fScale[2] = 1; 198 } 199 168 200 // -------------------------------------------------------------------------- 169 201 // -
trunk/MagicSoft/Mars/mhbase/MH3.h
r4933 r5429 39 39 public: 40 40 MH3(const unsigned int dim=0); 41 MH3(const TH1 &h1); 41 42 MH3(const char *memberx); 42 43 MH3(const char *memberx, const char *membery);
Note:
See TracChangeset
for help on using the changeset viewer.