Skip to content
Snippets Groups Projects
THcScintillatorPlane.cxx 45.4 KiB
Newer Older
Stephen A. Wood's avatar
Stephen A. Wood committed
  fNPedestalEvents++;

  return(ihit);
}

//_____________________________________________________________________________
void THcScintillatorPlane::CalculatePedestals( )
{
Mark Jones's avatar
Mark Jones committed
 /*! \brief   Calculate pedestals from arrays made in THcScintillatorPlane::AccumulatePedestals
Mark Jones's avatar
Mark Jones committed
  * - Calculate pedestals from arrays made in THcScintillatorPlane::AccumulatePedestals
  * - In old fortran ENGINE code, a comparison was made between calculated pedestals and the pedestals read in by the FASTBUS modules for zero supression. This is not implemented.
Mark Jones's avatar
Mark Jones committed
  */
  for(UInt_t i=0; i<fNelem;i++) {
Stephen A. Wood's avatar
Stephen A. Wood committed
    // Positive tubes
    fPosPed[i] = ((Double_t) fPosPedSum[i]) / TMath::Max(1, fPosPedCount[i]);
    fPosThresh[i] = fPosPed[i] + 15;

    // Negative tubes
    fNegPed[i] = ((Double_t) fNegPedSum[i]) / TMath::Max(1, fNegPedCount[i]);
    fNegThresh[i] = fNegPed[i] + 15;

    //    cout <<"Pedestals "<< i+1 << " " << fPosPed[i] << " " << fNegPed[i] << endl;
Stephen A. Wood's avatar
Stephen A. Wood committed
  }
  //  cout << " " << endl;
Stephen A. Wood's avatar
Stephen A. Wood committed
}

//_____________________________________________________________________________
void THcScintillatorPlane::InitializePedestals( )
{
Mark Jones's avatar
Mark Jones committed
 /*! \brief   called by THcScintillatorPlane::ReadDatabase
Mark Jones's avatar
Mark Jones committed
  * - Initialize variables used in  THcScintillatorPlane::AccumulatePedestals and THcScintillatorPlane::CalculatePedestals
  * - Minimum number of pedestal events needed for calculation, fMinPeds, hadrcoded to 500
Mark Jones's avatar
Mark Jones committed
  */
Stephen A. Wood's avatar
Stephen A. Wood committed
  fNPedestalEvents = 0;
  fMinPeds = 500; 		// In engine, this is set in parameter file
  fPosPedSum = new Int_t [fNelem];
  fPosPedSum2 = new Int_t [fNelem];
  fPosPedLimit = new Int_t [fNelem];
  fPosPedCount = new Int_t [fNelem];
  fNegPedSum = new Int_t [fNelem];
  fNegPedSum2 = new Int_t [fNelem];
  fNegPedLimit = new Int_t [fNelem];
  fNegPedCount = new Int_t [fNelem];

  fPosPed = new Double_t [fNelem];
  fNegPed = new Double_t [fNelem];
  fPosThresh = new Double_t [fNelem];
  fNegThresh = new Double_t [fNelem];
  for(UInt_t i=0;i<fNelem;i++) {
Stephen A. Wood's avatar
Stephen A. Wood committed
    fPosPedSum[i] = 0;
    fPosPedSum2[i] = 0;
    fPosPedLimit[i] = 1000;	// In engine, this are set in parameter file
    fPosPedCount[i] = 0;
    fNegPedSum[i] = 0;
    fNegPedSum2[i] = 0;
    fNegPedLimit[i] = 1000;	// In engine, this are set in parameter file
    fNegPedCount[i] = 0;
  }
}
//____________________________________________________________________________
ClassImp(THcScintillatorPlane)
////////////////////////////////////////////////////////////////////////////////