Ignore:
Timestamp:
03/08/03 14:00:30 (22 years ago)
Author:
wittek
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc

    r1772 r1809  
    1 
    21/* ======================================================================== *\
    32!
     
    102101  fHDiffPixTheta  = fHist3Diff;
    103102
     103  fHSigmaTheta->SetDirectory(NULL);
     104  fHSigmaPixTheta->SetDirectory(NULL);
     105  fHDiffPixTheta->SetDirectory(NULL);
     106
    104107  Print();
    105108}
     
    239242   fHDiffPixTh->SetZTitle("Sigma^2-Sigmabar^2");
    240243
     244   //--------------------------------------------------------------------
     245
     246   memset(fErrors, 0, sizeof(fErrors));
     247
    241248   return kTRUE;
    242249}
     
    251258  //*fLog << "Entry MPadSchweizer::Process();" << endl;
    252259
     260  Int_t rc;
     261
    253262  const UInt_t npix = fEvt->GetNumPixels();
     263
     264  Double_t SigbarOld;
     265
     266  //*fLog << "before padding : " << endl;
     267  //SigbarOld = fSigmabar->Calc(*fCam, *fPed, *fEvt);
     268  //fSigmabar->Print("");
     269
    254270
    255271  //$$$$$$$$$$$$$$$$$$$$$$$$$$
    256272  // to simulate the situation that before the padding the NSB and
    257273  // electronic noise are zero : set Sigma = 0 for all pixels
    258   for (UInt_t i=0; i<npix; i++)
    259   {   
    260     MCerPhotPix &pix = fEvt->operator[](i);     
    261     Int_t j = pix.GetPixId();
    262 
    263     MPedestalPix &ppix = fPed->operator[](j);
    264     ppix.SetMeanRms(0.0);
    265   }
     274  //for (UInt_t i=0; i<npix; i++)
     275  //{   
     276  //  MCerPhotPix &pix = fEvt->operator[](i);     
     277  //  Int_t j = pix.GetPixId();
     278
     279  //  MPedestalPix &ppix = fPed->operator[](j);
     280  //  ppix.SetMeanRms(0.0);
     281  //}
    266282  //$$$$$$$$$$$$$$$$$$$$$$$$$$
    267283
     
    269285  // Calculate average sigma of the event
    270286  //
    271   Double_t SigbarOld = fSigmabar->Calc(*fCam, *fPed, *fEvt);
     287  SigbarOld = fSigmabar->Calc(*fCam, *fPed, *fEvt);
    272288  //fSigmabar->Print("");
    273289
    274   //if (SigbarOld > 0.0)
    275   //{
     290  if (SigbarOld > 0.0)
     291  {
    276292    //*fLog << "MPadSchweizer::Process(); Sigmabar of event to be padded is > 0 : "
    277293    //      << SigbarOld << ". Stop event loop " << endl;
    278294    // input data should have Sigmabar = 0; stop event loop
    279     // return kFALSE;
    280   //}
     295 
     296    rc = 1;
     297    fErrors[rc]++;
     298    return kCONTINUE;
     299  }
    281300
    282301  Double_t Theta  = kRad2Deg*fMcEvt->GetTelescopeTheta();
     
    296315          << Theta << ",  " << binNumber << ";  Skip event " << endl;
    297316    // event cannot be padded; skip event
     317
     318    rc = 2;
     319    fErrors[rc]++;
    298320    return kCONTINUE;
    299321  }
     
    308330      // event cannot be padded; skip event
    309331      delete fHSigma;
     332
     333      rc = 3;
     334      fErrors[rc]++;
    310335      return kCONTINUE;
    311336    }
     
    331356    *fLog << "MPadSchweizer::Process(); target Sigmabar is less than SigbarOld : "
    332357          << Sigmabar << ",  " << SigbarOld << ",   Skip event" << endl;
     358
     359    rc = 4;
     360    fErrors[rc]++;
    333361    return kCONTINUE;     
    334362  }
     
    426454              << binTheta << "  and pixel bin " << binPixel 
    427455              << " has no entries;  aborting " << endl;
    428         return kERROR;
     456
     457        rc = 5;
     458        fErrors[rc]++;
     459        return kCONTINUE;     
    429460      }
    430461
     
    465496              << binTheta << "  and pixel bin " << binPixel 
    466497              << " has no entries;  aborting " << endl;
    467         return kERROR;
     498
     499        rc = 6;
     500        fErrors[rc]++;
     501        return kCONTINUE;     
    468502      }
    469503
     
    553587
    554588  // Calculate Sigmabar again and crosscheck
     589
    555590  Double_t SigbarNew = fSigmabar->Calc(*fCam, *fPed, *fEvt);
     591  //*fLog << "after padding : " << endl;
    556592  //fSigmabar->Print("");
    557593
     
    585621  //*fLog << "Exit MPadSchweizer::Process();" << endl;
    586622
     623  rc = 0;
     624  fErrors[rc]++;
     625
    587626  return kTRUE;
    588627
     
    594633Bool_t MPadSchweizer::PostProcess()
    595634{
     635    if (GetNumExecutions() != 0)
     636    {
     637
     638    *fLog << inf << endl;
     639    *fLog << GetDescriptor() << " execution statistics:" << endl;
     640    *fLog << dec << setfill(' ');
     641    *fLog << " " << setw(7) << fErrors[1] << " (" << setw(3)
     642          << (int)(fErrors[1]*100/GetNumExecutions())
     643          << "%) Evts skipped due to: Sigmabar_old > 0" << endl;
     644
     645    *fLog << " " << setw(7) << fErrors[2] << " (" << setw(3)
     646          << (int)(fErrors[2]*100/GetNumExecutions())
     647          << "%) Evts skipped due to: Zenith angle out of range" << endl;
     648
     649    *fLog << " " << setw(7) << fErrors[3] << " (" << setw(3)
     650          << (int)(fErrors[3]*100/GetNumExecutions())
     651          << "%) Evts skipped due to: No data for generating Sigmabar" << endl;
     652
     653    *fLog << " " << setw(7) << fErrors[4] << " (" << setw(3)
     654          << (int)(fErrors[4]*100/GetNumExecutions())
     655          << "%) Evts skipped due to: Target sigma <= Sigmabar_old" << endl;
     656
     657    *fLog << " " << setw(7) << fErrors[5] << " (" << setw(3)
     658          << (int)(fErrors[5]*100/GetNumExecutions())
     659          << "%) Evts skipped due to: No data for generating Sigma^2-Sigmabar^2" << endl;
     660
     661    *fLog << " " << setw(7) << fErrors[6] << " (" << setw(3)
     662          << (int)(fErrors[6]*100/GetNumExecutions())
     663          << "%) Evts skipped due to: No data for generating Sigma" << endl;
     664
     665    *fLog << " " << fErrors[0] << " ("
     666          << (int)(fErrors[0]*100/GetNumExecutions())
     667          << "%) Evts survived the padding!" << endl;
     668    *fLog << endl;
     669
     670    }
     671
     672    //---------------------------------------------------------------
    596673    TCanvas &c = *(MH::MakeDefCanvas("PadSchweizer", "", 900, 1200));
    597674    c.Divide(3, 4);
     
    600677
    601678    c.cd(1);
     679    fHSigmaTheta->SetDirectory(NULL);
    602680    fHSigmaTheta->SetTitle("2D : Sigmabar, \\Theta (reference sample)");
    603     fHSigmaTheta->DrawClone();     
     681    fHSigmaTheta->DrawCopy();     
    604682    fHSigmaTheta->SetBit(kCanDelete);     
    605683
    606684      //c.cd(1);
    607       //fHSigmaPixTheta->DrawClone();     
     685      //fHSigmaPixTheta->DrawCopy();     
    608686      //fHSigmaPixTheta->SetBit(kCanDelete);     
    609687
    610688    c.cd(4);
    611     fHSigbarTheta->DrawClone();     
     689    fHSigbarTheta->SetDirectory(NULL);
     690    fHSigbarTheta->DrawCopy();     
    612691    fHSigbarTheta->SetBit(kCanDelete);     
    613692
    614693
    615694    c.cd(7);
    616     fHNSB->DrawClone();
     695    fHNSB->SetDirectory(NULL);
     696    fHNSB->DrawCopy();
    617697    fHNSB->SetBit(kCanDelete);   
    618698
     
    625705    c.cd(2);
    626706    l = (TH2D*) ((TH3*)fHDiffPixTh)->Project3D("zx");
    627 
     707    l->SetDirectory(NULL);
    628708    l->SetTitle("Sigma^2-Sigmabar^2 vs. \\Theta (all pixels)");
    629709    l->SetXTitle("\\Theta [\\circ]");
    630710    l->SetYTitle("Sigma^2-Sigmabar^2");
    631711
    632     *fLog << "before box" << endl;
    633 
    634     l->Draw("box");
     712    l->DrawCopy("box");
    635713    l->SetBit(kCanDelete);;
    636714
    637715    c.cd(5);
    638716    l = (TH2D*) ((TH3*)fHDiffPixTh)->Project3D("zy");
     717    l->SetDirectory(NULL);
    639718    l->SetTitle("Sigma^2-Sigmabar^2 vs. pixel number (all \\Theta)");
    640719    l->SetXTitle("pixel");
    641720    l->SetYTitle("Sigma^2-Sigmabar^2");
    642721
    643     l->Draw("box");
     722    l->DrawCopy("box");
    644723    l->SetBit(kCanDelete);;
    645724
     
    655734    c.cd(3);
    656735    k = (TH2D*) ((TH3*)fHSigPixTh)->Project3D("zx");
     736    k->SetDirectory(NULL);
    657737    k->SetTitle("Sigma vs. \\Theta (all pixels)");
    658738    k->SetXTitle("\\Theta [\\circ]");
    659739    k->SetYTitle("Sigma");
    660740
    661     k->Draw("box");
     741    k->DrawCopy("box");
    662742    k->SetBit(kCanDelete);
    663743
    664744    c.cd(6);
    665745    k = (TH2D*) ((TH3*)fHSigPixTh)->Project3D("zy");
     746    k->SetDirectory(NULL);
    666747    k->SetTitle("Sigma vs. pixel number (all \\Theta)");
    667748    k->SetXTitle("pixel");
    668749    k->SetYTitle("Sigma");
    669750
    670     k->Draw("box");
     751    k->DrawCopy("box");
    671752    k->SetBit(kCanDelete);;
    672753
     
    677758
    678759    c.cd(10);
    679     fHSigmaPedestal->DrawClone();
     760    fHSigmaPedestal->SetDirectory(NULL);
     761    fHSigmaPedestal->DrawCopy();
    680762    fHSigmaPedestal->SetBit(kCanDelete);   
    681763
    682764    c.cd(11);
    683     fHPhotons->DrawClone();
     765    fHPhotons->SetDirectory(NULL);
     766    fHPhotons->DrawCopy();
    684767    fHPhotons->SetBit(kCanDelete);   
    685768
Note: See TracChangeset for help on using the changeset viewer.