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

CalPulserFits.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CalPulserFits.cxx,v 1.4 2006/03/29 12:41:38 cpw1 Exp $
00003 //
00004 // CalPulserFits
00005 //
00006 // Dbi object for results of linear fits to pulser gain data.
00007 //
00008 // Author: Pat Ward 13/09/2005
00009 //
00010 // $Log: CalPulserFits.cxx,v $
00011 // Revision 1.4  2006/03/29 12:41:38  cpw1
00012 // Mods for 60-point gain curve
00013 //
00014 // Revision 1.3  2006/01/25 12:47:03  cpw1
00015 // New definition of database table with more columns
00016 //
00017 // Revision 1.2  2005/10/27 09:21:43  cpw1
00018 // Add number of fit points
00019 //
00020 // Revision 1.1  2005/09/28 09:33:11  cpw1
00021 // Replacement for PulserXScale
00022 //
00023 //
00025 
00026 #include "MessageService/MsgService.h"
00027 #include "Calibrator/CalPulserFits.h"
00028 
00029 ClassImp(CalPulserFits)
00030 
00031 CVSID("$Id: CalPulserFits.cxx,v 1.4 2006/03/29 12:41:38 cpw1 Exp $\n  \
00032       CVSID_DBIRESULTPTR ");
00033 
00034 #include "DatabaseInterface/DbiResultPtr.tpl"
00035   template class DbiResultPtr<CalPulserFits>;
00036 #include "DatabaseInterface/DbiWriter.tpl"
00037   template class DbiWriter<CalPulserFits>;
00038 
00039 // Default constructor and destructor
00040 CalPulserFits::CalPulserFits() {}
00041 CalPulserFits::~CalPulserFits() {}
00042 
00043 // Old constructor which fills row with values
00044 CalPulserFits::CalPulserFits(Int_t aggNo, Int_t seid, Int_t npfit, Double_t slope, Double_t slopeerr, Double_t xoffset, Double_t chisq) : 
00045   fAggregateNo(aggNo),
00046   fStripEnd(seid),
00047   fNPFit(npfit),
00048   fSlope(slope),
00049   fSlopeErr(slopeerr), 
00050   fXOffset(xoffset),
00051   fChisq(chisq) 
00052 
00053 {
00054   // Zero variables not used with this constructor
00055   fFitType = 0;
00056   fPar1 = 0;
00057   fPar2 = 0;
00058   fPar3 = 0;
00059   fPar4 = 0;
00060   fMeanRes = 0;
00061   fMaxRes = 0;
00062   fAdcMax = 0;
00063   fXtra1 = 0;
00064   fXtra2 = 0;
00065 }
00066 
00067 // New constructor which fills row with values
00068 CalPulserFits::CalPulserFits(Int_t aggNo, Int_t seid, Int_t ftype, TF1* fit, Double_t meanres, Double_t maxres, Double_t adcmax) : 
00069   fAggregateNo(aggNo),
00070   fStripEnd(seid),
00071   fFitType(ftype), 
00072   fMeanRes(meanres), 
00073   fMaxRes(maxres),
00074   fAdcMax(adcmax)
00075 
00076 {
00077   // No fit
00078   if(ftype < -25 || fit == 0) {
00079     fNPFit = 0;
00080     fSlope = 0;
00081     fSlopeErr = 0;
00082     fXOffset = 0;
00083     fPar1 = 0;
00084     fPar2 = 0;
00085     fPar3 = 0;
00086     fPar4 = 0;
00087     fChisq = 0;
00088   }
00089 
00090   // Line fit only
00091   if(abs(ftype) == 1) {
00092     fNPFit = fit->GetNumberFitPoints();
00093     fSlope = fit->GetParameter(0);
00094     fSlopeErr = fit->GetParError(0);
00095     fXOffset = fit->GetParameter(1);
00096     fPar1 = 0;
00097     fPar2 = 0;
00098     fPar3 = 0;
00099     fPar4 = 0;
00100     fChisq = fit->GetChisquare();
00101   }
00102 
00103   if(abs(ftype) == 5 || abs(ftype) == 25) {
00104     fNPFit = fit->GetNumberFitPoints();
00105     fSlope = fit->GetParameter(7);
00106     fSlopeErr = fit->GetParError(7);
00107     if(fSlope != 0) {
00108       fSlope = 1/fSlope;
00109       fSlopeErr = fSlope*fSlope*fSlopeErr;
00110     }
00111     fXOffset = fit->GetParameter(6);
00112     fPar1 = fit->GetParameter(1);
00113     fPar2 = fit->GetParameter(2);
00114     if(abs(ftype) == 25) {
00115       fPar3 = fit->GetParameter(3);
00116       fPar4 = fit->GetParameter(4);
00117     }
00118     else {
00119       fPar3 = 0;
00120       fPar4 = 0;
00121     }
00122     fChisq = fit->GetChisquare();
00123   }
00124 
00125   fXtra1 = 0;
00126   fXtra2 = 0;
00127 }
00128 
00129 void CalPulserFits::Fill(DbiResultSet& rs,
00130                           const DbiValidityRec* /* vrec */)
00131 {
00132   rs >> fAggregateNo 
00133      >> fStripEnd 
00134      >> fFitType
00135      >> fNPFit
00136      >> fSlope 
00137      >> fSlopeErr 
00138      >> fXOffset 
00139      >> fPar1
00140      >> fPar2
00141      >> fPar3
00142      >> fPar4
00143      >> fChisq
00144      >> fMeanRes
00145      >> fMaxRes
00146      >> fAdcMax
00147      >> fXtra1 
00148      >> fXtra2;
00149 
00150 } 
00151 
00152 void CalPulserFits::Store(DbiOutRowStream& ors,
00153                           const DbiValidityRec* /* vrec */) const
00154 {
00155     ors << fAggregateNo 
00156         << fStripEnd
00157         << fFitType
00158         << fNPFit
00159         << fSlope  
00160         << fSlopeErr 
00161         << fXOffset 
00162         << fPar1
00163         << fPar2
00164         << fPar3
00165         << fPar4
00166         << fChisq
00167         << fMeanRes
00168         << fMaxRes
00169         << fAdcMax
00170         << fXtra1 
00171         << fXtra2;
00172 }
00173 

Generated on Mon Feb 15 11:06:27 2010 for loon by  doxygen 1.3.9.1