Ignore:
Timestamp:
12/01/03 18:58:01 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/manalysis
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h

    r2565 r2581  
    2020#pragma link C++ class MPedestalPix+;
    2121#pragma link C++ class MPedestalCam+;
     22#pragma link C++ class MPedCalcPedRun+;
    2223#pragma link C++ class MMcPedestalCopy+;
    2324#pragma link C++ class MMcPedestalNSBAdd+;
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc

    r2540 r2581  
    136136{
    137137
    138     fOverFlow = 0;
    139     fNrEvents = 0;
     138    fHistOverFlow = 0;
     139    fEvents       = 0;
     140    fCosmics      = 0;
    140141
    141142    fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
     
    235236{
    236237
    237     fNrEvents++;
     238    fEvents++;
     239
     240    Bool_t cosmic = kFALSE;
    238241
    239242    MCalibrationBlindPix &blindpixel = *(fCalibrations->GetBlindPixel());
     
    267270            mid = pixel.GetIdxMaxLoGainSample();
    268271
    269             sum = (max == gkSaturationLimit          // overflow of LoGain ??? -> GimmeABreak!!!
    270                    ? fOverFlow++, gkLoGainOverFlow   // OUCH (Florian was maybe right)
    271                    : sum*gkConversionHiLo    );      // OUFF (Florian was wrong) !!
     272            sum = (max == gkSaturationLimit              // overflow of LoGain ??? -> GimmeABreak!!!
     273                   ? fHistOverFlow++, gkLoGainOverFlow   // OUCH (Florian was maybe right)
     274                   : sum*gkConversionHiLo    );          // OUFF (Florian was wrong) !!
    272275
    273276            //            *fLog << warn << "Warning: Saturation of HiGain reached in slice " << (int)mid << " !!! " << endl;
    274277            //            *fLog << warn << "Max = " << max << endl;
    275278
    276             if (fOverFlow)
     279            if (fHistOverFlow)
    277280              *fLog << err << dbginf << "Warning: Saturation of LoGain reached! "
    278281                    << err << dbginf << "sum = " << sum << endl;
    279282
    280283          }
    281        
    282         //
    283         // sanity check (old MC files sometimes have pixids>577)
    284         //
    285         if (fPedestals && !fPedestals->CheckBounds(pixid))
    286           {
    287             *fLog << inf << "Pixel ID larger than camera... skipping event." << endl;
    288             return kCONTINUE;
    289               }
    290        
     284       
     285
    291286        MPedestalPix    &ped = (*fPedestals)[pixid];
    292287        MCalibrationPix &pix = (*fCalibrations)[pixid];
    293288       
    294         Float_t pedes = ped.GetPedestal();
     289        Float_t pedes  = ped.GetPedestal();
     290        Float_t pedrms = ped.GetPedestalRms();
    295291       
    296292        //
     
    298294        // Assume pedestals per time slice ==> multiply with number of slices
    299295        //
    300         pedes *= (sat ? fNumLoGainSamples : fNumHiGainSamples );
     296        pedes  *= (sat ? fNumLoGainSamples : fNumHiGainSamples );
     297        pedrms *= (sat ? fNumLoGainSamples : fNumHiGainSamples );
     298
     299        //
     300        // This is a very primitive check for the number of cosmics
     301        // The cut will be applied in the fit, but for the blind pixel,
     302        // we need to remove this event
     303        //
     304        // FIXME: In the future need a much more sophisticated one!!!
     305        //
     306
     307        if ((float)sum < pedes+5.*pedrms)
     308           cosmic = kTRUE;
    301309
    302310        Float_t rsum      = (float)sum - pedes;
     
    306314           
    307315          case gkCalibrationBlindPixelId:
    308             if (!blindpixel.FillQ(sum))
    309               *fLog << warn <<
    310                 "Overflow or Underflow occurred filling Blind Pixel means = " << sum << endl;
     316            //
     317            // FIXME: This works only when the blind pixel ID is much larger than
     318            //        the rest of the pixels (which is the case right now)
     319            //
     320//          if (!cosmic)
     321               if (!blindpixel.FillQ(sum))
     322                  *fLog << warn <<
     323                  "Overflow or Underflow occurred filling Blind Pixel sum = " << sum << endl;
     324
    311325            if (!blindpixel.FillT((int)mid))
    312326              *fLog << warn <<
    313327                "Overflow or Underflow occurred filling Blind Pixel time = " << (int)mid << endl;
    314             if (!blindpixel.FillRQvsT(rsum,fNrEvents))
     328
     329            if (!blindpixel.FillRQvsT(rsum,fEvents))
    315330              *fLog << warn <<
    316                 "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fNrEvents << endl;
     331                "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl;
    317332
    318333          case gkCalibrationPINDiodeId:
     
    323338              *fLog << warn <<
    324339                "Overflow or Underflow occurred filling HT: time = " << (int)mid << endl;
    325             if (!pindiode.FillRQvsT(rsum,fNrEvents))
     340            if (!pindiode.FillRQvsT(rsum,fEvents))
    326341              *fLog << warn <<
    327                 "Overflow or Underflow occurred filling HQvsN: eventnr = " << fNrEvents << endl;
     342                "Overflow or Underflow occurred filling HQvsN: eventnr = " << fEvents << endl;
    328343
    329344          default:
     
    336351            // Fill the reduced charge into the control histo for better visibility
    337352            //
    338             if (!pix.FillRQvsT(rsum,fNrEvents))
     353            if (!pix.FillRQvsT(rsum,fEvents))
    339354              *fLog << warn << "Could not fill red. Q vs. EvtNr of pixel: " << pixid
    340                     << " signal = " << rsum  << " event Nr: " << fNrEvents << endl;
     355                    << " signal = " << rsum  << " event Nr: " << fEvents << endl;
    341356
    342357
     
    348363
    349364      } /* while (pixel.Next()) */
     365
     366    if (cosmic)
     367        fCosmics++;
    350368
    351369    fCalibrations->SetReadyToSave();
     
    398416          MCalibrationPix &pix = (*fCalibrations)[pixid];
    399417
     418          const Float_t ped    = (*fPedestals)[pixid].GetPedestal() * fNumHiGainSamples;
     419          const Float_t prms   = (*fPedestals)[pixid].GetPedestalRms() * fNumHiGainSamples;
     420
     421          pix.SetPedestal(ped,prms);
    400422
    401423          if (TESTBIT(fFlags,kUseTFits))
     
    405427             continue;
    406428
    407           const Float_t ped    = (*fPedestals)[pixid].GetPedestal();
    408           const Float_t prms   = (*fPedestals)[pixid].GetPedestalRms();
    409           pix.SetPedestal(ped,prms);
    410429        }
    411430    }
     
    413432  fCalibrations->SetReadyToSave();
    414433 
    415   if (GetNumExecutions()==0 || fOverFlow==0)
     434  if (GetNumExecutions()==0)
    416435    return kTRUE;
    417436 
    418   *fLog << inf << endl;
    419   *fLog << GetDescriptor() << " execution statistics:" << endl;
    420   *fLog << dec << setfill(' ');
    421   *fLog << " " << setw(7) << fOverFlow << " (" << setw(3) << (int)(fOverFlow*100/GetNumExecutions()) << "%) Evts skipped due to: lo gain saturated." << endl;
    422  
     437  *fLog << endl;
     438  *fLog << dec << setfill(' ') << fCosmics << " Events presumably cosmics" << endl;
     439
    423440  return kTRUE;
    424441}
  • trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.h

    r2540 r2581  
    3535  MTime                    *fEvtTime;      // Time of the event
    3636
    37   Int_t fNrEvents;                         // Number of events 
    38   Int_t fOverFlow;                         // Number of events with saturated Low Gain
     37  Int_t fEvents;                           // Number of events 
     38  Int_t fHistOverFlow;                     // Number of events with saturated Low Gain
     39  Int_t fCosmics;                          // Number of events due to supposed cosmics
    3940
    4041  Byte_t fNumHiGainSamples;
  • trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc

    r2544 r2581  
    8383    return kTRUE;
    8484
     85  if (fPed && fPedRms)
     86    fHist->SetLowerFitRange(fPed + 3.5*fPedRms);
     87  else
     88    *fLog << warn << "Cannot set lower fit range to suppress cosmics: Pedestals not available" << endl;
     89
    8590  if(!fHist->FitQ())
    8691    {
  • trunk/MagicSoft/Mars/manalysis/Makefile

    r2565 r2581  
    3333SRCFILES = MPedestalPix.cc \
    3434           MPedestalCam.cc \
     35           MPedCalcPedRun.cc \
    3536           MMcPedestalCopy.cc \
    3637           MMcPedestalNSBAdd.cc \
Note: See TracChangeset for help on using the changeset viewer.