#ifndef __S800ROOTGLOBALS_H
#define __S800ROOTGLOBALS_H 1
#endif
#ifndef __TS800CRDC_H
#define __TS800CRDC_H

#ifndef __S800PACKETS_H
#include "S800Packets.h"
#define __S8000PACKETS_H
#endif
#ifndef __S800DEFINE_H
#include "S800define.h"
#define __S800DEFINE_H
#endif

#include <TH1F.h>
#include <TH2F.h>
#include <TObject.h>
#include <TRandom3.h>
#include <TSpline.h>

#include "TS800CrdcPads.h"
#include "TS800CrdcCalc.h"

using namespace std;

// Forward class declarations
class TS800;
class TS800CrdcPads;
class TS800CrdcCalc;


class TS800Crdc : public TNamed{
 private:
  TRandom3     fRandom;                  //! The class's random number generator.
  TSpline3    *fTACSpline;               //! TAC correcting cubic spline.
  TSpline3    *fAnodeSpline;             //! Anode correcting cubic spline.
  TSpline3    *fYSpline;                 //! Y correcting cubic spline.

 public:
  TS800       *parent;                   //! S800 parent.
  TS800Crdc*   fCon;                     //! Convsersion class.
  
  Bool_t       fTACSplineCorr;           //! Use TAC correcting spline.
  Bool_t       fAnodeSplineCorr;         //! Use Anode correcting spline.
  Bool_t       fYSplineCorr;             //! Use Y correcting spline.

  Short_t      channels;                 //! 
  Short_t      tag;                      //!
  Short_t      maxwidth;                 //!
  Short_t      threshold;                //!
  Short_t      sampleBegin;              //!
  Short_t      sampleWidth;              //!
  Bool_t       debug;                    //!
  Int_t        filled;                   // 
  Short_t      *data;                    //[filled]
  Short_t      *sample;                  //[filled]
  Short_t      *channel;                 //[filled]
  Short_t      rData[224];               //!
  Short_t      rSample[224];             //!
  Short_t      rChannel[224];            //!

 public:
  TS800CrdcPads pad;                     //  CRDC pads.
  TS800CrdcCalc calc;                    //  CRDC calculation class.
  
  Double_t      x;                       //  Calibrated x-position (dispersive).
  Double_t      y;                       //  Calibrated y-position (non-dispersive).
  UShort_t      anode;                   //  Anode signal.
  UShort_t      tac;                     //  TAC signal.
  Double_t      fAnodeSplineLevel;       //! 
  Double_t      fAnodeCorrSlope;         //!
  Double_t      fAnodeCorrOffset;        //!
  Double_t      fTACSplineLevel;         //! 
  Char_t       *fYSplineMatchPnt;        //!
  //  Double_t      fYSplineLinOffset;       //!
  //  Double_t      fYSplineLinSlope;        //!
  Double_t      x_offset[2];             //! Used to align CRDC mask with center.
  Double_t      x_slope[2];              //! X-position set by the fixed pad size.  Typically this is a constant.
  Double_t      y_offset[2];             //! Drift offset.
  Double_t      y_slope[2];              //! Drift slope.
  Double_t      fXShift;                 //! Current CRDC X (dispersive) shift.
  Double_t      fYShift;                 //! Current CRDC Y (non-dispersive) shift.
  Double_t      fYGainShift;             //! Current CRDC Y (non-dispersive) gain shift.
  TH1F          fHYShifts;               //! Histo of Y shifts as a function of run number.
  TH1F          fHYGainShifts;           //! Histo of Y gain shifts as a function of run number.
  
  //  TString       fName;                    //!
  
  TBranch      *b_data;                  //!
  TBranch      *b_sample;                //!
  TBranch      *b_channel;               //!
  TBranch      *b_filled;                //!
  TBranch      *b_x;                     //!
  TBranch      *b_y;                     //!
  TBranch      *b_anode;                 //!
  TBranch      *b_tac;                   //!
  TBranch      *b_pad;                   //!
  TBranch      *b_calc;                  //!

  TTree        *fChain;                  //! 
  Int_t        fCurrent;                 //!
  

 public:
  TS800Crdc() {fRandom.SetSeed(0);}
  ~TS800Crdc() {}//{if(fTACSpline) fTACSpline->Delete(); if(fAnodeSpline) fAnodeSpline->Delete();}
  TS800Crdc(const TS800Crdc &);                  // The copy constructor.

  Int_t     Calculate(Long64_t entry);

  void      InitClass(TString iname,TS800 *theParent);              //
  void      InitFix();                                              //
  void      InitTree(TTree *tree);                                  //
  void      Clear(Option_t *option="");                             // Clear data members.
  void      Copy(TObject &) const;                                  // The copy method.
  void      GetEntry(Int_t i);                                      //
  Bool_t    LoadYShifts(Char_t *yShiftFile);                        // Load the run dependant Y shift file.
  Bool_t    LoadYGainShifts(Char_t *yGainShiftFile);                // Load the run dependant Y shift file.
  Bool_t    LoadSpline(Char_t *splineFile,Int_t crdcID,Int_t type); // Load TAC correcting cubic splines.
  void      settag(Short_t atag) {tag = atag;}                      //
  void      setchannels(Short_t achannels) {channels = achannels;}  //
  void      setdebug(Bool_t condition) {debug = condition;}         //
  void      SetYShift(Int_t runNum);                                // Set the Y shift for a given run number.
  void      SetYGainShift(Int_t runNum);                            // Set the Y gain shift for a given run number.
  UShort_t* Unpack(UShort_t *p);                                    // Unpack event data.
  UShort_t* Unpackrawdata(UShort_t *p);                             //
  void      Snapshot1D(TH1F* histogram, Int_t entry);               //
  void      Snapshot2D(TH2F* histogram, Int_t entry);               //

  
  ClassDef(TS800Crdc,13)     // S800 FP CRDC.
};

#endif

Last change: Sun Dec 21 12:38:54 2008
Last generated: 2008-12-21 12:38

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.