Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Calibrator.h

Go to the documentation of this file.
00001 
00002 // $Id: Calibrator.h,v 1.6 2009/10/19 17:15:21 jpaley Exp $
00003 //
00004 // Singleton class that handles calibrations for a particular 
00005 // validity context (eg: detector+timestamp).
00006 //
00008 
00009 #ifndef CALIBRATOR_H
00010 #define CALIBRATOR_H
00011 
00012 #include "TObject.h"
00013 #include "TTimeStamp.h"
00014 #include "TH1D.h"
00015 #include <iostream>
00016 #include <vector>
00017 #include <map>
00018 #include <string>
00019 
00020 #include "Geometry/Geometry.h"
00021 #include "RawData/DAQHeader.h"
00022 #include "RawData/RawDigit.h"
00023 #include "RecoBase/CellHit.h"
00024 #include "RecoBase/RecoHit.h"
00025 
00026 using namespace rawdata;
00027 using namespace recobase;
00028 
00029 namespace calib {
00030 
00031   struct attlen {
00032     float a1, l1;
00033     float a2, l2;
00034     float a1sig, l1sig;
00035     float a2sig, l2sig;
00036   };
00037   
00038   class Calibrator {
00039 
00040   public:
00041     Calibrator(); 
00042 
00043     // Get a Calibrator instance here (or use EDMUtils::GetCalibrator())
00044     static Calibrator& Instance(TTimeStamp timestamp,
00045                                 rawdata::det_id_ detector,
00046                                 const geo::Geometry &geometry);
00047 
00048     // Get the timestamp or detector ID currently assumed by the Calibrator
00049     TTimeStamp       GetTimeStamp() const { return fCurrTimeStamp; }
00050     rawdata::det_id_ GetDetector () const { return fCurrDetector;  }
00051 
00052 
00053   private:
00054     // private methods and data members for Calibrator class
00055     void SetContext(TTimeStamp timestamp,
00056                     rawdata::det_id_ detector,
00057                     const geo::Geometry &geometry);    
00058     static Calibrator*   fInstance;
00059     TTimeStamp           fCurrTimeStamp;
00060     rawdata::det_id_     fCurrDetector;
00061     const geo::Geometry* fCurrGeo;
00062 
00063   //---------------------------------------------
00064   // RawDigit to CellHit methods
00065   //---------------------------------------------
00066   public:
00067     // Main thing you'll want:
00068     void  MakeCellHit    (const RawDigit *rawdigit, CellHit *cellhit); // Do everything
00069 
00070     float GetPE            (const RawDigit *rawdigit);
00071     float GetPECorrFactor  (const RawDigit *rawdigit);
00072     float GetTNS           (const RawDigit *rawdigit);
00073 
00074   //---------------------------------------------
00075   // CellHit to RecoHit methods
00076   //---------------------------------------------
00077   // (NOTE: w != dist_to_readout.  Those are
00078   // different arguments.)
00079   //---------------------------------------------
00080   public:
00081     // Main thing you'll want:
00082 
00083     // Do everything
00084     void  MakeRecoHit(const CellHit *cellhit, RecoHit *recohit, float w); 
00085 
00086     float GetT       (const CellHit *cellhit, float dist_to_readout);
00087     float GetPEAtt   (const CellHit *cellhit, float dist_to_readout);
00088     float GetMIPScale(const CellHit *cellhit); // for PEAtt-->MIP conversion
00089     float GetGeVScale(const CellHit *cellhit); // for MIP-->GeV conversion
00090     
00091     float                fPEACperMIP;
00092     float                fPEACperMIPErr;
00093     std::vector<float>   fMIPtoGeV;
00094     std::vector<float>   fMIPtoGeVErr;
00095     std::map<int,float>  fADCtoPE;
00096     std::map<int,float>  fPEtoSigCor;
00097     std::map<int,attlen> fSCtoPEAC;
00098     std::vector<float>   fFTDistNDX;
00099     std::vector<float>   fFTDistNDY;
00100     std::vector<float>   fFTDistFDX;
00101     std::vector<float>   fFTDistFDY;
00102 
00103   private:
00104     bool fLoadedFineTimeDistros;
00105 
00106     // Internal utilites for above method(s).  If you need this
00107     // functionality, look to Geometry, not Calibrator.
00108     void GetXYZD(const CellHit *cellhit, float w, double *xyzd);
00109 
00110     bool LoadADCtoPE();
00111     bool LoadPEtoSigCor();
00112     bool LoadSCtoPEAC();
00113     bool LoadPEACtoMIP();
00114     bool LoadMIPtoGeV();
00115     bool LoadFineTimeDistros();
00116 
00117   };
00118 }
00119 #endif
00120   

Generated on Mon Nov 23 04:45:24 2009 for NOvA Offline by  doxygen 1.3.9.1