#ifndef __S800ROOTGLOBALS_H
#define __S800ROOTGLOBALS_H 1
#endif
#ifndef __TS800_H
#define __TS800_H

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

#include <TMath.h>
#include <TObject.h>
#include <TRandom3.h>
#include <TString.h>
#include <TTree.h>

#include "TS800Scintillator.h"
#include "TS800Trigger.h"
#include "TS800Crdc.h"
#include "TS800Tppac.h"
#include "TS800FpTrack.h"
#include "TS800ImTrack.h"
#include "TS800Map.h"
#include "TS800IonChamber.h"
#include "TS800TimeOfFlight.h"

using namespace TMath;

class TS800Scintillator;
class TS800Trigger;
class TS800Crdc;
class TS800Tppac;
class TS800FpTrack;
class TS800ImTrack;
class TS800Map;
class TS800IonChamber;
class TS800TimeOfFlight;

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TS800                                                                //
//                                                                      //
// This class provides the structure for the S800 spectrometer at the   //
// NSCL.  The TS800 class contains other sub-classes that descibe the   //
// various components and device that makeup the S800.                  //
//////////////////////////////////////////////////////////////////////////


class TS800 : public TObject{
 private:
  TRandom3     fRandom;                        //! The class's random number generator.
  
 protected:
  TString      fName;                          //! Object identifier.
  TString      fTitle;                         //! Object title.

  Int_t        fAnalysisState;                 //! Current analysis state of fChain.

 public:
  Double_t     fEulerPhi;                      //! Phi Euler angle.
  Double_t     fEulerTheta;                    //! Theata Euler angle.
  Double_t     fEulerPsi;                      //! Psi Euler angle.

  UShort_t     fNwords;                        //  Number of words in an S800 event.


 public:
  TString             name;                    //! Object identifier.

  Bool_t              fAddRndm;                //! Add random number to convert from short data types to double.

  Double_t            kBrhoA;                  //! Analysis line brho value.
  Double_t            kBrho;                   //! Spectrometer brho value.
  
  TS800Scintillator   e1;                      //  Focal Plane E1 scintillator class.
  TS800Scintillator   e2;                      //  Focal Plane E2 scintillator class.
  TS800Scintillator   e3;                      //  Focal Plane E3 scintillator class.
  TS800Crdc           crdc1;                   //  CRDC1
  TS800Crdc           crdc2;                   //  CRDC2
  TS800FpTrack        fpTrack;                 //  Focal Plane tracking class.
  TS800ImTrack        imTrack;                 //  Intermediate Imagage tracking class.
  TS800Map            s800map;                 //  S800 inverse map class.
  TS800IonChamber     ic;                      //  Ion Chamber class.
  TS800Crdc           tcrdc1; 
  TS800Crdc           tcrdc2;
  TS800Tppac          tppac1;                  //  II tracking PPAC1 class.
  TS800Tppac          tppac2;                  //  II tracking PPAC2 class.
  TS800Trigger        trigger;                 //  Trigger class.
  TS800TimeOfFlight   tof;                     //  Time of Flight class.

  //  Double_t            fICShift;                //! Current PID ion chamber shift.
  //  Double_t            fToFShift;               //! Current PID ToF shift.
  TH1F                fHICShifts;              //! Histo of IC shifts as a function of run number.
  TH1F                fHToFShifts[2];          //! Histos of ToF shifts as a function of run number.
  TH1F                fHYtaShifts;             //! Histo of Yta shifts as a function of run number.
  
  Char_t              *crdc1CalPath;           //! CRDC1 calibration filename.
  Char_t              *crdc2CalPath;           //! CRDC2 calibration filename.

  TBranch             *b_fNwords;              //!
  TBranch             *b_e1;                   //!
  TBranch             *b_e2;                   //!
  TBranch             *b_e3;                   //!
  TBranch             *b_crdc1;                //!
  TBranch             *b_crdc2;                //!
  TBranch             *b_fpTrack;              //!
  TBranch             *b_imTrack;              //!
  TBranch             *b_s800map;              //!
  TBranch             *b_ic;                   //!
  TBranch             *b_tcrdc1;               //!
  TBranch             *b_tcrdc2;               //!
  TBranch             *b_tppac1;               //!
  TBranch             *b_tppac2;               //!
  TBranch             *b_trigger;              //!
  TBranch             *b_tof;                  //!

  TTree               *fChain;                 //! Pointer to current TTree or TChain
  Int_t                fCurrent;               //! Current Tree number in a TChain
  
 public:
  TS800() {fRandom.SetSeed(0);}
  virtual ~TS800() {}
  TS800(const TS800 &);                                         // The copy constructor.


  const Char_t *GetName() const { return fName; }               //
  const Char_t *GetTitle() const { return fTitle; }             //
  void          SetName(const Char_t *name);                    //
  void          SetNameTitle(const Char_t *name,    
			      const Char_t *title);             //
  void          SetTitle(const Char_t *title="");               //

  Bool_t        Calculate(Long64_t entry);                      // Calculate an entry.
  Int_t         Calculate(Option_t *prefix="",Option_t *path="",
			  Option_t *treeName="",
			  Bool_t calcTracking=kTRUE,
			  Option_t *option="RECREATE");         // Calibrate detector array.
  Int_t         Calibrate(Long64_t entry);                      // Calibrate an entry.
  Int_t         Calibrate(Option_t *prefix="",Option_t *path="",
			  Option_t *treeName="",
			  Option_t *option="RECREATE");         // Calibrate detector array.
  void          Clear(Option_t *option="");                     // 
  void          Copy(TObject &s800) const;                      // The copy method.
  Bool_t        GenPrime(Option_t *output="",
			 Option_t *treeName="",
			 Option_t *option="RECREATE");          // Generate primary data.
  Bool_t        LoadPIDShifts(const Char_t *fileName);          // Load the PID shift stablization.
  Bool_t        LoadYtaShifts(const Char_t *fileName);          // Load the yta shift stablization.
  void          SetPIDShifts(Int_t runNum);                     // Set the PID shifts for a given run number.
  void          SetFpTrackShifts(Int_t runNum);                 // Set the FP tracking shifts for a given run number.

  void     GetEntry(Int_t i);                        //
  void     InitClass();                              //
  void     InitTree(TTree *tree);                    //
  Int_t    Unpack(UShort_t *pEvent);                 //

  void     SetCrdcCalFile(Char_t *crdc1Path,
			  Char_t *crdc1Path);        //
  void     SetEuler(Double_t phi,Double_t theta, Double_t psi){fEulerPhi  =phi*DegToRad(); 
                                                               fEulerTheta=theta*DegToRad(); 
                                                               fEulerPsi  =psi*DegToRad();}



  ClassDef(TS800,6)     // S800 Spectrograph.
};

#endif


Last change: Sun Dec 21 12:38:53 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.