Changeset 5544 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
12/01/04 20:49:05 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5535 r5544  
    2222
    2323 2004/12/01: Markus Gaug
     24
     25   * MExtractTimeAndChargeSpline.[h,cc]:
     26     - introduced a random iterator for the "pedestal" calculation of
     27       the amplitude spline.
     28
    2429
    2530   * MExtractTimeAndChargeDigitalFilter.cc:
  • trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc

    r5477 r5544  
    487487 
    488488  Int_t win = 1;
     489  Int_t nofit = 0;
    489490
    490491  if (option.Contains("events"))
    491     win += 1;
     492    {
     493      option.ReplaceAll("events","");     
     494      win += 1;
     495    }
    492496  if (option.Contains("fourier"))
    493     win += 2;
     497    {
     498      option.ReplaceAll("fourier","");     
     499      win += 2;
     500    }
     501 
    494502  if (IsEmpty())
    495503    win--;
    496504
     505  if (option.Contains("nofit"))
     506    {
     507      option.ReplaceAll("nofit","");
     508      nofit++;
     509    }
     510 
    497511  pad->SetBorderMode(0);
    498512  pad->Divide(1,win);
     
    510524
    511525      fHGausHist.Draw(option);
    512      
    513       if (fFGausFit)
    514         {
    515           fFGausFit->SetLineColor(IsGausFitOK() ? kGreen : kRed);
    516           fFGausFit->Draw("same");
    517         }
     526
     527      if (!nofit)
     528        if (fFGausFit)
     529          {
     530            fFGausFit->SetLineColor(IsGausFitOK() ? kGreen : kRed);
     531            fFGausFit->Draw("same");
     532          }
    518533    }
    519534 
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc

    r5511 r5544  
    177177//
    178178MExtractTimeAndChargeSpline::MExtractTimeAndChargeSpline(const char *name, const char *title)
    179     : fAbMax(0.), fAbMaxPos(0.), fHalfMax(0.)
     179    : fAbMax(0.), fAbMaxPos(0.), fHalfMax(0.), fRandomIter(0)
    180180{
    181181
     
    251251// --------------------------------------------------------------------------
    252252//
    253 // ReInit
    254 //
    255 // Calls:
    256 // - MExtractTimeAndCharge::ReInit(pList);
    257 // - Deletes all arrays, if not NULL
    258 // - Creates new arrays according to the extraction range
    259 //
    260 Bool_t MExtractTimeAndChargeSpline::ReInit(MParList *pList)
     253// InitArrays
     254//
     255// Gets called in the ReInit() and initialized the arrays
     256//
     257Bool_t MExtractTimeAndChargeSpline::InitArrays()
    261258{
    262259
     260  Int_t range = fHiGainLast - fHiGainFirst + 1 + fHiLoLast;
     261
     262  fHiGainSignal     .Set(range);
     263  fHiGainFirstDeriv .Set(range);
     264  fHiGainSecondDeriv.Set(range);
     265
     266  range = fLoGainLast - fLoGainFirst + 1;
     267
     268  fLoGainSignal     .Set(range);
     269  fLoGainFirstDeriv .Set(range);
     270  fLoGainSecondDeriv.Set(range);
     271
     272  fHiGainSignal     .Reset();
     273  fHiGainFirstDeriv .Reset();
     274  fHiGainSecondDeriv.Reset();
     275
     276  fLoGainSignal     .Reset();
     277  fLoGainFirstDeriv .Reset();
     278  fLoGainSecondDeriv.Reset();
     279 
    263280  if (IsExtractionType(kAmplitude))
    264281    {
     
    280297      fWindowSizeLoGain  = (Int_t)(fRiseTime + fFallTime+1);
    281298    }
    282 
    283   if (!MExtractTimeAndCharge::ReInit(pList))
    284     return kFALSE;
    285 
    286   return kTRUE;
    287 }
    288 
    289 // --------------------------------------------------------------------------
    290 //
    291 // InitArrays
    292 //
    293 // Gets called in the ReInit() and initialized the arrays
    294 //
    295 Bool_t MExtractTimeAndChargeSpline::InitArrays()
    296 {
    297 
    298   Int_t range = fHiGainLast - fHiGainFirst + 1 + fHiLoLast;
    299 
    300   fHiGainSignal     .Set(range);
    301   fHiGainFirstDeriv .Set(range);
    302   fHiGainSecondDeriv.Set(range);
    303 
    304   range = fLoGainLast - fLoGainFirst + 1;
    305 
    306   fLoGainSignal     .Set(range);
    307   fLoGainFirstDeriv .Set(range);
    308   fLoGainSecondDeriv.Set(range);
    309 
    310   fHiGainSignal     .Reset();
    311   fHiGainFirstDeriv .Reset();
    312   fHiGainSecondDeriv.Reset();
    313 
    314   fLoGainSignal     .Reset();
    315   fLoGainFirstDeriv .Reset();
    316   fLoGainSecondDeriv.Reset();
    317299
    318300  return kTRUE;
     
    415397  if (IsNoiseCalculation() && IsExtractionType(kAmplitude))
    416398    {
    417       //
    418       // Take the spline value at the middle of the third slice (to avoid egde effects)
    419       //
    420       sum = 0.5*fHiGainSignal[2]
    421           + 0.5*fHiGainSignal[3]
    422           + (-0.375)*fHiGainSecondDeriv[2]
    423           + (-0.375)*fHiGainSecondDeriv[3];
     399      if (fRandomIter == (TMath::Floor(1./fResolution)))
     400        fRandomIter = 0;
     401
     402      const Float_t b = fRandomIter * fResolution;
     403      const Float_t a = 1. - b;
     404
     405      fRandomIter++;
     406
     407      sum = a*fHiGainSignal[1]
     408          + b*fHiGainSignal[2]
     409          + (a*a*a-a)*fHiGainSecondDeriv[1]
     410          + (b*b*b-b)*fHiGainSecondDeriv[2];
    424411      return;
    425412    }
     
    531518  // Try a better precision.
    532519  //
    533   const Float_t up = fAbMaxPos+step-0.035;
    534   const Float_t lo = fAbMaxPos-step+0.035;
     520  const Float_t up = fAbMaxPos+step - 1.5*fResolution;
     521  const Float_t lo = fAbMaxPos-step + 1.5*fResolution;
    535522  const Float_t maxpossave = fAbMaxPos;
    536523 
     
    539526  b     = x - lower;
    540527 
    541   step  = 0.025; // step size of 83 ps
     528  step  = fResolution; // step size of 83 ps
    542529 
    543530  while (x<up)
     
    562549
    563550  //
    564   // Second, try from time down to time-0.2 in steps of 0.025.
     551  // Second, try from time down to time-0.2 in steps of fResolution.
    565552  //
    566553  x     = maxpossave;
     
    571558  // which requires new setting of klocont and khicont
    572559  //
    573   if (x < klo + 0.02)
     560  if (x < klo + fResolution/2.)
    574561    {
    575562      klo--;
     
    605592    {
    606593      time = (Float_t)fHiGainFirst + fAbMaxPos;
    607       dtime = 0.025;
     594      dtime = fResolution;
    608595    }
    609596  else
     
    892879  // Try a better precision.
    893880  //
    894   const Float_t up = fAbMaxPos+step-0.035;
    895   const Float_t lo = fAbMaxPos-step+0.035;
     881  const Float_t up = fAbMaxPos+step - 1.5*fResolution;
     882  const Float_t lo = fAbMaxPos-step + 1.5*fResolution;
    896883  const Float_t maxpossave = fAbMaxPos;
    897884 
     
    900887  b     = x - lower;
    901888 
    902   step  = 0.025; // step size of 83 ps
     889  step  = fResolution; // step size of fResolution (33 ps )
    903890 
    904891  while (x<up)
     
    932919  // which requires new setting of klocont and khicont
    933920  //
    934   if (x < klo + 0.02)
     921  if (x < klo + fResolution/2.)
    935922    {
    936923      klo--;
     
    966953    {
    967954      time = (Float_t)fLoGainFirst + fAbMaxPos;
    968       dtime = 0.02;
     955      dtime = fResolution;
    969956    }
    970957  else
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.h

    r5511 r5544  
    3939  Float_t fFallTime;                     // The usual fall time of the pulse
    4040
     41  UInt_t  fRandomIter;                   // Counter used to randomize weights for noise calculation
     42 
    4143  Byte_t  fFlags;                        // Bit-field to hold the time extraction types
    42  
    43   Bool_t ReInit( MParList *pList );
    4444 
    4545  Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print);
Note: See TracChangeset for help on using the changeset viewer.