#include "hmdcoffset.h"

HMdcOffset


class description - source file - inheritance tree (.pdf)

class HMdcOffset : public HReconstructor

Inheritance Chart:
TObject
<-
TNamed
<-
HTask
<-
HReconstructor
<-
HMdcOffset

    protected:
void createHist(TFile*, Int_t, Int_t, Int_t, Int_t) void createHist_2D(Int_t, Int_t) void deleteHist() void deleteHist_2D() Int_t executeClus() Int_t executeRaw() void fillArrays(TH1F*, Int_t, Int_t, Int_t, Int_t) void fillCalParRaw(TH1F*, Int_t, Int_t, Int_t, Int_t) void fillHist(Int_t, Int_t, Int_t, Int_t) void fillHist_2D(Int_t, Int_t, Int_t, Int_t) void fillNTuples(Int_t, Int_t, Int_t, Int_t) void findMultiplePeaks(Int_t, Int_t, Int_t, Int_t) Int_t fitHist(Int_t, Int_t, Int_t, Int_t) Float_t getstarttime() void initArrays() void initMemory() void initVariables() Bool_t isNaN(float f) TDirectory* Mkdir(TDirectory*, Char_t*, Int_t, Int_t p = 1) ofstream* openAsciiFile() void printStatus() void setDefault() Bool_t testTimeCuts(Int_t s, Int_t m, Float_t t1, Float_t t2) void writeAscii(ofstream&, Int_t, Int_t, Int_t, Int_t) void writeHist(TFile*) void writeHist_2D() public:
HMdcOffset() HMdcOffset(Text_t* name, Text_t* title) ~HMdcOffset() static TClass* Class() virtual Int_t execute() virtual Bool_t finalize() virtual Bool_t init() virtual TClass* IsA() const virtual Bool_t reinit() void setCounter(Int_t size) void setDebug() void setNoise(Int_t o, Int_t w) void setNoiseOffset(Int_t i) void setNoiseWidth(Int_t i) void setNotUseStart(Bool_t nouse) void setNSkipEvents(Int_t nskipevents) void setOutputAscii(Char_t*) void setOutputRoot(Char_t*) void setPulserFile() void setRangeGauss(Int_t i) void setSignalSpeed(Float_t speed) void setThreshold(Float_t min, Float_t max) void setThresholdMax(Float_t f) void setThresholdMin(Float_t f) void setUseClusters(Bool_t use) void setUseTimeCuts(Bool_t cut) void setUseTof(TString inp) void setUseWireOffset(Bool_t use) void setValidOffsetRange(Float_t range) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members


    protected:
static const Int_t nbin Number of bins ih the histogramms static const Int_t nbinm1 nbin - 1 static const Int_t nbinp1 nbin + 1 static const Int_t nSubEvents The max. number of objects per event HCategory* rawCat pointer to the raw data HCategory* hitStartCat pointer to the cal data HCategory* clusCat pointer to the cluster data HIterator* iter iterator on raw data HIterator* iter_start iterator on start cal data. HIterator* iter_clus iterator on clus data. HLocation locraw HMdcCalParRaw* calparraw pointer to HMdcCalParRaw container HMdcTimeCut* timecut pointer to HMdcTimeCut container HMdcLookupGeom* lookupgeom pointer to HMdcLookupGeom container HMdcLookupRaw* lookupraw pointer to HMdcLookupRaw container HMdcSizesCells* sizescells pointer to HMdcSizesCells container Float_t signalspeed ! speed of the signal on the wire [ns/mm] Int_t eventcounter Int_t skipcounter Int_t nSkipEvents number of skipped events per file Int_t nStep step size for print events Float_t validRange allowed interval arround mean of offsets Bool_t isPulserFile flag for a external calibration file (pulser) Bool_t noStart flag if starttime should not be used Bool_t useTimeCuts switch on/off time cuts usage Bool_t useClusters switch on/off clusters/raw Bool_t useWireOffset switch on/off substraction of signal time on wire Bool_t useTof switch on/off substraction of minimum tof Char_t* fNameAsciiOffset file name of ascii output file Char_t* fNameRootOffset file name of root output file FILE* ferrorlog File pointer to errorlog TNtuple* offsetTuple pointer to NTuple for offset TNtuple* offsetPulserTuple pointer to NTuple for multiple peaks of pulser files Float_t minfitthreshold minimum threshold for linear fit (y-range) Float_t maxfitthreshold maximum threshold for linear fit (y-range) Int_t offsetfitNoise offset of the fit range for the subtraction of the noise (start at yequalzero going to the left) Int_t widthfitNoise width of the fit range Int_t rangeGauss fit range of the gaussian fit around calculated offset int* hreverse[6][4][16][96][2048] array for the drift-time (Time1) to be filled in eventloop TH1F* hinv drift-time histograms to hold collected data TH1F* hint integrated drift-time histograms TH1F* htime1temp temp drift-time histogram TH2F* htime1_mbo[16] 2-D hist time1 vers tdc TH2F* htime1_lay[6] 2-D hist time1 vers cell TH2F* htime1_lay_inv_norm[6] 2-D hist time1 vers cell normalized to counts TH2F* htime1_lay_int[6] 2-D hist integrated time1 vers cell TH2F* htime1_lay_int_norm[6] 2-D hist integrated time1 vers cell normalized to counts TF1* toffunc[4][6] TF1 fits for minimum tof float yequalzero intersection point of the first fit and the x-axis float crosspointX x-value of the intersection point of the two linear fits->offset float fitpar0 first fit parameter of the first linear fit float fitpar0error error of the first fit parameter of the first linear fit float fitpar1 second fit parameter of the first linear fit float fitpar1error error of the second fit parameter of the first linear fit float fitparNoise0 first fit parameter of the second linear fit float fitparNoise0error error of the first fit parameter of the second linear fit float fitparNoise1 second fit parameter of the second linear fit float fitparNoise1error error of the second fit parameter of the second linear fit float totalsigma sigma of the offset calculated from the sigmas of the two linear fits float fitGaussMean mean of the gaussian fit float fitGaussSigma sigma of the gaussian fit Float_t meanhOffset Float_t offsets[6][4][16][96] Float_t offsetErr[6][4][16][96] Float_t offset1[6][4][16][96] Int_t integral[6][4][16][96] Float_t fitslope1[6][4][16][96] Float_t fitslope2[6][4][16][96] Float_t offsetpulser[6][4][16][96][5] Float_t myoffset Float_t myerror Bool_t debug ! debug flag

Class Description


 HMdcOffset

 Defines the offset  parameter for MDC calibration. Uses HMdcCalParRaw container
 as  input/output for calibration data



HMdcOffset(void)

HMdcOffset(Text_t* name,Text_t* title) : HReconstructor(name,title)

~HMdcOffset(void)
 Destructor.

void initVariables()
 pointer to iterators and categories

void setDefault()
 Sets the the default values for the fits.

void setOutputAscii(Char_t *c)
 Sets ascii output of HMdcOffset for debugging output.

void setOutputRoot(Char_t *c)
 Sets rootfile output of HMdcOffset where all created histograms were written.


void setUseTof(TString filename)
 Retrieves TF1's for min tof substraction from root file
 and switches the usesage of tof substraction kTRUE.

void printStatus()

Bool_t init(void)
  Inits HMdcOffset and the needed HMdcCalParRaw, if this container does not exists

Bool_t reinit(void)

void createHist(TFile* file,Int_t s, Int_t m, Int_t l, Int_t c)
 Histograms for inverted Time1 and integrated Time1 per Tdc-Channel are created
 in a subdirectory structure.

void createHist_2D(Int_t s, Int_t m)
 Histograms for inverted Time1 and integrated Time1 per Tdc-Channel are created
 in a subdirectory structure.

void deleteHist()
 Created histograms are deleted

void deleteHist_2D()
 Created histograms are deleted

void fillHist(Int_t s, Int_t m, Int_t l, Int_t c)
 Histograms for inverted Time1 and integrated Time1 per Tdc-Channel are filled

void fillHist_2D(Int_t s, Int_t m, Int_t l, Int_t c)
 Histograms for Time1 vers Tdc-Channel and cell are filled

Int_t fitHist(Int_t s, Int_t m, Int_t l, Int_t c)
 The offset is calculated from two linear fits. Some pictures of the fitted histograms
 can be found on 
MDC calibration page
 .
 The first linear fit (red) is done to find the rising edge of the integrated spectra.
 The second linear fit (blue) is done to substract the noise.
 The ranges for both fits can be set through the functions setNoise()(x-range) for the
 second fit (default values: 100,50) and setThreshold()(y-range) for the first fit
 (default values :0.15,0.50). The y-range is calculated by the percentage of the maximum
 height of the spectra.
 The offset ist calculated from the intersection point of both linear fits.
 The sigma of the offset is calculated from the sigmas of the two linear fits.

 If the analyzed file is a pulser file for external calibration a gaussian fit is done.
 To set this fit the function setPulserFile() has to be used in the macro. The range of
 the fit is set through the function setRangeGauss()(default value: 50) around the maximum.
 The mean and sigma of the fit is written to the ascii debugging output.
 The hist is checked for multiple peaks.The peaks which have been found are written to an array.

void findMultiplePeaks(Int_t s,Int_t m,Int_t l,Int_t c)

void writeAscii(ofstream &fout, Int_t s, Int_t m, Int_t l, Int_t c)
 The adresses of the channel(sector,module,mbo,tdc),offset, two fitparameters for the
 two linear fits, the sigma of the offset ,offset and the integral(number of entries for this channel)
 are written to the ascii debugging output.In the case of an pulser file (external calibration)
 the mean and the sigma of the gaussian fit are also written to the output.

void writeHist(TFile* file)
 All created histograms are written to a rootfile.The file is structured for sector,module,mbo.

void writeHist_2D()
 All created histograms are written to a rootfile.

ofstream* openAsciiFile()
 Opens the ascii debugging output and writes the headerline.

void fillNTuples(Int_t s,Int_t mo,Int_t mb,Int_t t)
 fill NTuples for offsets and multiple peaks

void fillArrays(TH1F *hOffset, Int_t s,Int_t mo,Int_t mb,Int_t t)

void fillCalParRaw(TH1F *hOffsetcorr, Int_t s,Int_t mo,Int_t mb,Int_t t)
 fills CalParRaw with offsets, offseterrors and Methods
 Checks if offset is in valid range arround mean value of offsets.
 If it is out of range the value is replaced by the mean value.
 Not connected channels are marked with -7.

Bool_t finalize(void)
 This function is called after the execute function is finished. At this point
 the arrays for the drift-time are filled. Froms this arrays the histograms for
 the drift-time and the integrated drift-time are filled. The fits for the calcutation
 of the offsets are done and the offsets and the sigma of the offsets are
 calculated .All histograms are written to a rootfile output and the information
 of the fits to an ascii debugging output. The offset and the sigma of the offset
 are filled into the container (HMdcCalParRaw) for the calibration parameters.
 To characterize the method of calculation of the offsets the function setOffsetMethod()
 of HMdcCalParRaw is used. As default value for the method 2 is used for  automatic
 calibration. If no calibration is done this value is set to 0.

TDirectory* Mkdir(TDirectory *dirOld, Char_t *c, Int_t i, Int_t p) //! Makes new Dir, changes to Dir, returns pointer to new Dir
 Function to create subdirectories

Float_t getstarttime()
 Need some work for multiple hists in start detector
 Better select multiplicity 1 in start.

Int_t execute()

Int_t executeClus()
 Fired cells are take from the list of Cells inside one HMdcClus.
 Raw data of Time1  multiplied by the slope of the channel taken from the
 container of the calibration parameters are filled into the array for the
 drift-time . This array contains 2048 (corresponding to the resulution of
 the tdc chip) entries for each tdc channel.

Int_t executeRaw()
 Raw data of Time1  multiplied by the slope of the channel taken from the
 container of the calibration parameters are filled into the array for the
 drift-time . This array contains 2048 (corresponding to the resulution of
 the tdc chip) entries for each tdc channel.



Inline Functions


               void setSignalSpeed(Float_t speed)
               void setCounter(Int_t size)
               void setPulserFile()
               void setNotUseStart(Bool_t nouse)
               void setUseClusters(Bool_t use)
               void setUseWireOffset(Bool_t use)
               void setNSkipEvents(Int_t nskipevents)
               void setValidOffsetRange(Float_t range)
               void setUseTimeCuts(Bool_t cut)
               void setNoiseOffset(Int_t i)
               void setNoiseWidth(Int_t i)
               void setThresholdMin(Float_t f)
               void setThresholdMax(Float_t f)
               void setNoise(Int_t o, Int_t w)
               void setThreshold(Float_t min, Float_t max)
               void setRangeGauss(Int_t i)
               void setDebug()
             Bool_t isNaN(float f)
               void initMemory()
               void initArrays()
             Bool_t testTimeCuts(Int_t s, Int_t m, Float_t t1, Float_t t2)
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
               void StreamerNVirtual(TBuffer& b)


Last update: Fri Jan 26 12:13:06 2007


ROOT page - Class index - Class Hierarchy - Top of the page

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.