Changeset 2128 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 05/21/03 12:21:58 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc
r2070 r2128 86 86 #include "MPedestalCam.h" 87 87 #include "MPedestalPix.h" 88 #include "MBlindPixels.h" 88 89 89 90 ClassImp(MPadSchweizer); … … 101 102 fHSigmaPixTheta = NULL; 102 103 fHDiffPixTheta = NULL; 104 fHBlindPixIdTheta = NULL; 105 fHBlindPixNTheta = NULL; 103 106 104 107 fHSigmaPedestal = NULL; … … 125 128 // fHSigmaPixTheta 3D-hiostogram (Theta, pixel, sigma) 126 129 // fHDiffPixTheta 3D-histogram (Theta, pixel, sigma^2-sigmabar^2) 127 // 128 // 129 void MPadSchweizer::SetHistograms(TH2D *hist2, TH3D *hist3, TH3D *hist3Diff) 130 // fHBlindPixIdTheta 2D-histogram (Theta, blind pixel Id) 131 // fHBlindPixNTheta 2D-histogram (Theta, no.of blind pixels ) 132 // 133 // 134 void MPadSchweizer::SetHistograms(TH2D *hist2, TH3D *hist3, TH3D *hist3Diff, 135 TH2D *hist2Pix, TH2D *hist2PixN) 130 136 { 131 137 fHSigmaTheta = hist2; 132 138 fHSigmaPixTheta = hist3; 133 139 fHDiffPixTheta = hist3Diff; 140 fHBlindPixIdTheta = hist2Pix; 141 fHBlindPixNTheta = hist2PixN; 134 142 135 143 fHSigmaTheta->SetDirectory(NULL); 136 144 fHSigmaPixTheta->SetDirectory(NULL); 137 145 fHDiffPixTheta->SetDirectory(NULL); 146 fHBlindPixIdTheta->SetDirectory(NULL); 147 fHBlindPixNTheta->SetDirectory(NULL); 138 148 139 149 Print(); … … 171 181 Bool_t MPadSchweizer::PreProcess(MParList *pList) 172 182 { 173 if ( !fHSigmaTheta || !fHSigmaPixTheta || !fHDiffPixTheta) 183 if ( !fHSigmaTheta || !fHSigmaPixTheta || !fHDiffPixTheta || 184 !fHBlindPixIdTheta || !fHBlindPixNTheta) 174 185 { 175 186 *fLog << err << "At least one of the histograms needed for the padding is not defined ... aborting." << endl; … … 190 201 return kFALSE; 191 202 } 192 203 193 204 fCam = (MGeomCam*)pList->FindObject("MGeomCam"); 194 205 if (!fCam) … … 211 222 return kFALSE; 212 223 } 224 225 fBlinds = (MBlindPixels*)pList->FindCreateObj("MBlindPixels"); 226 if (!fBlinds) 227 { 228 *fLog << err << "MBlindPixels not found... aborting." << endl; 229 return kFALSE; 230 } 213 231 214 232 … … 296 314 //------------------------------------------- 297 315 // for the current theta, 316 // generate blind pixels according to the histograms 317 // fHBlindPixNTheta and fHBlindPixIDTheta 318 // 319 320 321 Int_t binPix = fHBlindPixNTheta->GetXaxis()->FindBin(theta); 322 323 if ( binPix < 1 || binPix > fHBlindPixNTheta->GetNbinsX() ) 324 { 325 //*fLog << "MPadSchweizer::Process(); binNumber out of range : theta, binPix = " 326 // << theta << ", " << binPix << "; Skip event " << endl; 327 // event cannot be padded; skip event 328 329 rc = 2; 330 fErrors[rc]++; 331 return kCONTINUE; 332 } 333 334 // numBlind is the number of blind pixels in this event 335 TH1D *nblind; 336 UInt_t numBlind; 337 338 nblind = fHBlindPixNTheta->ProjectionY("", binPix, binPix, ""); 339 if ( nblind->GetEntries() == 0.0 ) 340 { 341 *fLog << "MPadSchweizer::Process(); projection for Theta bin " 342 << binPix << " has no entries; Skip event " << endl; 343 // event cannot be padded; skip event 344 delete nblind; 345 346 rc = 7; 347 fErrors[rc]++; 348 return kCONTINUE; 349 } 350 else 351 { 352 numBlind = (Int_t) (nblind->GetRandom()+0.5); 353 354 //*fLog << "numBlind = " << numBlind << endl; 355 } 356 delete nblind; 357 358 359 // throw the Id of numBlind different pixels in this event 360 TH1D *hblind; 361 UInt_t idBlind; 362 UInt_t listId[npix]; 363 UInt_t nlist = 0; 364 Bool_t equal; 365 366 hblind = fHBlindPixIdTheta->ProjectionY("", binPix, binPix, ""); 367 if ( hblind->GetEntries() > 0.0 ) 368 for (UInt_t i=0; i<numBlind; i++) 369 { 370 while(1) 371 { 372 idBlind = (Int_t) (hblind->GetRandom()+0.5); 373 equal = kFALSE; 374 for (UInt_t j=0; j<nlist; j++) 375 if (idBlind == listId[j]) 376 { 377 equal = kTRUE; 378 break; 379 } 380 if (!equal) break; 381 } 382 listId[nlist] = idBlind; 383 nlist++; 384 385 fBlinds->SetPixelBlind(idBlind); 386 //*fLog << "idBlind = " << idBlind << endl; 387 } 388 delete hblind; 389 390 391 //------------------------------------------- 392 // for the current theta, 298 393 // generate a sigmabar according to the histogram fHSigmaTheta 299 394 // … … 301 396 Int_t binNumber = fHSigmaTheta->GetXaxis()->FindBin(theta); 302 397 398 if (binPix != binNumber) 399 { 400 cout << "The binnings of the 2 histograms are not identical; aborting" 401 << endl; 402 return kERROR; 403 } 404 303 405 TH1D *hsigma; 304 406 305 if ( binNumber < 1 || binNumber > fHSigmaTheta->GetNbinsX() ) 407 hsigma = fHSigmaTheta->ProjectionY("", binNumber, binNumber, ""); 408 if ( hsigma->GetEntries() == 0.0 ) 306 409 { 307 //*fLog << "MPadSchweizer::Process(); binNumber out of range : theta, binNumber = "308 // << theta << ", " << binNumber << ";Skip event " << endl;410 *fLog << "MPadSchweizer::Process(); projection for Theta bin " 411 << binNumber << " has no entries; Skip event " << endl; 309 412 // event cannot be padded; skip event 310 311 rc = 2; 413 delete hsigma; 414 415 rc = 3; 312 416 fErrors[rc]++; 313 417 return kCONTINUE; … … 315 419 else 316 420 { 317 hsigma = fHSigmaTheta->ProjectionY("", binNumber, binNumber, ""); 318 if ( hsigma->GetEntries() == 0.0 ) 319 { 320 *fLog << "MPadSchweizer::Process(); projection for Theta bin " 321 << binNumber << " has no entries; Skip event " << endl; 322 // event cannot be padded; skip event 323 delete hsigma; 324 325 rc = 3; 326 fErrors[rc]++; 327 return kCONTINUE; 328 } 329 else 330 { 331 sigmabar = hsigma->GetRandom(); 332 333 //*fLog << "Theta, bin number = " << theta << ", " << binNumber 334 // << ", sigmabar = " << sigmabar << endl; 335 } 336 delete hsigma; 337 } 421 sigmabar = hsigma->GetRandom(); 422 //*fLog << "Theta, bin number = " << theta << ", " << binNumber // << ", sigmabar = " << sigmabar << endl 423 } 424 delete hsigma; 425 338 426 const Double_t sigmabar2 = sigmabar*sigmabar; 339 427 … … 644 732 << "%) Evts skipped due to: No data for generating Sigma" << endl; 645 733 734 *fLog << " " << setw(7) << fErrors[7] << " (" << setw(3) 735 << (int)(fErrors[7]*100/GetNumExecutions()) 736 << "%) Evts skipped due to: No data for generating Blind pixels" << endl; 737 646 738 *fLog << " " << fErrors[0] << " (" 647 739 << (int)(fErrors[0]*100/GetNumExecutions()) -
trunk/MagicSoft/Mars/manalysis/MPadSchweizer.h
r2021 r2128 20 20 class MSigmabar; 21 21 class MParList; 22 class MBlindPixels; 22 23 23 24 class MPadSchweizer : public MTask … … 29 30 MMcEvt *fMcEvt; 30 31 MPedestalCam *fPed; 32 MBlindPixels *fBlinds; 31 33 32 34 Int_t fPadFlag; … … 34 36 Int_t fGroup; 35 37 36 Int_t fErrors[ 7];38 Int_t fErrors[8]; 37 39 38 40 // plots used for the padding 41 TH2D *fHBlindPixIdTheta; // 2D-histogram (blind pixel Id vs. Theta) 42 TH2D *fHBlindPixNTheta; // 2D-histogram (no.of blind pixels vs. Theta) 39 43 TH2D *fHSigmaTheta; // 2D-histogram (sigmabar vs. Theta) 40 44 TH3D *fHSigmaPixTheta; // 3D-histogram (Theta, pixel, sigma) … … 53 57 ~MPadSchweizer(); 54 58 55 void SetHistograms(TH2D *hist2, TH3D *hist3, TH3D *hist3Diff); 59 void SetHistograms(TH2D *hist2, TH3D *hist3, TH3D *hist3Diff, 60 TH2D *hist2Pix, TH2D *hist2PixN); 56 61 57 62 Bool_t PreProcess(MParList *pList);
Note:
See TracChangeset
for help on using the changeset viewer.