00001 00003 // FitNdNonlinQuad.h 00004 // 00005 // Nathaniel Tagg, Feb 2006 00006 // tagg@minos.phy.tufts.edu 00007 // 00008 // Code to read the PulserGain and PulserGainPin tables, 00009 // perform a quadratic fit to the function, then convert it to 00010 // an ADC-centric model, create an ntuple for analysis, make 00011 // plots of each channel for validation, and store the 00012 // output in CalPulserFits tables. 00013 // 00014 // Creates: 00015 // A root file called ndlin_fits.root, with histograms and trees 00016 // Fills the ndfits/ directory with plots (if turned on) 00017 // Fills the CalPulserFits tables with task 44. 00018 // 00019 // Code is crude and badly documented, but it works. 00021 00022 #include "Validity/VldContext.h" 00023 #include "Plex/PlexStripEndId.h" 00024 #include "TClonesArray.h" 00025 00026 // The (prototype) of the call to actually do stuff. 00027 // To generate DB, "writeToDb" must be true. 00028 // Be default, low gain PINs are used 00029 // Drawing channel plots takes a lot of time 00030 void FitNdNonlinQuad( 00031 VldContext inputContext, 00032 const char* outputDirectory = "ndfits/", 00033 bool writeToDb = false, 00034 bool useHighGainPins = false, 00035 bool drawChannelPlots = false 00036 ); 00037 00038 00039 class NDQStripPulsePoint : public TObject 00040 { 00041 public: 00042 NDQStripPulsePoint() {}; 00043 00044 Int_t i; 00045 Float_t x; // pin 00046 Float_t dx; // pin err 00047 Float_t z; // pmt 00048 Float_t dz; // pmterrr 00049 Float_t zerocorr; // zero correction factor on the pmt 00050 Float_t f; 00051 Float_t y; 00052 Float_t dy; 00053 Float_t caly; 00054 Float_t dcaly; 00055 Float_t res; 00056 Float_t fres; 00057 Float_t xres; 00058 Float_t fxres; 00059 Float_t gain; 00060 Float_t pe; 00061 00062 Float_t ph; // pulse height setting, if available. 00063 Float_t philph; // Phil's measurement, if available. 00064 ClassDef(NDQStripPulsePoint,1); 00065 }; 00066 00067 class NDQStripfit : public TObject 00068 { 00069 public: 00070 NDQStripfit(int N=40) : data(0) { 00071 Reset(N); 00072 }; 00073 00074 void Reset(int N=40) { 00075 if(!data) data = new TClonesArray("NDQStripPulsePoint",N); 00076 data->Clear(); 00077 data->ExpandCreate(N); 00078 fndata = N; 00079 } 00080 00081 ~NDQStripfit() { delete data; }; 00082 00083 // Id. 00084 PlexStripEndId seid; 00085 Int_t plane; 00086 Int_t strip; 00087 Int_t end; 00088 Int_t pb; 00089 Int_t led; 00090 Int_t pin; 00091 Int_t pmt; 00092 00093 // Has data. 00094 Int_t ok; 00095 00096 // Fit. 00097 Float_t a; 00098 Float_t da; 00099 Float_t b; 00100 Float_t db; 00101 Float_t c; 00102 Float_t dc; 00103 Float_t d; 00104 Float_t dd; 00105 Float_t e; 00106 Float_t de; 00107 Float_t beta; 00108 Float_t dbeta; 00109 00110 // Data. 00111 Int_t n; // true number of points 00112 Int_t dof; // number used in fit. 00113 Int_t fndata; // size of data array (may be bigger) 00114 TClonesArray* data; 00115 00116 // Evaluation. 00117 Float_t chisq; 00118 00119 Float_t maxres; 00120 Float_t maxresf; 00121 Float_t maxres2500; 00122 Float_t maxresf2500; 00123 Float_t meanres2500; 00124 Float_t adcmax; 00125 00126 Int_t bad; 00127 ClassDef(NDQStripfit,1); 00128 }; 00129 00130 00131
1.3.9.1