#include "hmdcdigitizer.h"

HMdcDigitizer


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

class HMdcDigitizer : public HReconstructor

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

    protected:
Float_t calcWireOffset(Float_t, Float_t, Float_t) Bool_t evalWireStat(Int_t, Int_t, Int_t, Int_t) virtual Int_t execute() void fillArrays(Int_t, Int_t, Int_t, HMdcGeantCell*) void fillArraysReal(Int_t i) void fillNoise(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Int_t) void fillNoiseLists(HMdcCal1Sim* cal1, Int_t, Int_t) void fillNoiseToGeantCells(Int_t, HMdcCal1Sim* p) void fillNTuple(Int_t, Int_t, Int_t, Int_t, Int_t, HMdcGeantCell*, TNtuple*) void fillNTuple(Int_t, Int_t, Int_t, Int_t, Float_t, Float_t, Int_t) Float_t fillTime1Noise(Int_t) Float_t fillTime2Noise(Int_t) void fillTrackList(HMdcCal1Sim*) virtual Bool_t finalize() void findFirstValidHit() void findSecondValidHit() Float_t getAngle(Int_t i) void getCal1Real() Float_t getCellEffLevel(Int_t i) Bool_t getCutEdge(Int_t i) Float_t getDTime1(Int_t i) Float_t getDTime1Err(Int_t i) Float_t getDTime2(Int_t i) Float_t getDTime2Err(Int_t i) Int_t getEndList1() Int_t getFirstHit() Float_t getFirstTime2() Float_t getFractionOfmaxCharge(Int_t i) void getMdcSetup() Float_t getMinimumDist(Int_t i) Int_t getNHitsReal() Float_t getNoiseLevel(Int_t i) Int_t getNoiseRangeHi(Int_t i) Int_t getNoiseRangeLo(Int_t i) Float_t getOffset(Int_t i) Int_t getSecondHit() Int_t getStatus(Int_t i) Float_t getTime1Noise() Float_t getTime1Real() Float_t getTime2Noise() Float_t getTime2Real() Float_t getTof(Int_t i) Int_t getTrackN(Int_t i) Float_t getWireOffset(Int_t i) void handleOverFlow(Int_t, Int_t, Int_t, Int_t) virtual Bool_t init() void initArrays() void initVariables() virtual Bool_t reinit() void resetCal1Real() void resetListVariables() void select(Int_t) void setAngle(Int_t i, Float_t a) void setCutEdge(Int_t i, Bool_t cut) void setDTime1(Int_t i, Float_t time) void setDTime1Err(Int_t i, Float_t timeErr) void setDTime2(Int_t i, Float_t time) void setDTime2Err(Int_t i, Float_t timeErr) void setEfficiencyFlags(Int_t, Int_t, Int_t, Int_t) void setEndList1(Int_t end) void setFirstHit(Int_t hit1) void setFirstTime2(Float_t time2) void setFractionOfmaxCharge(Int_t i, Float_t f) void setLoopVariables(Int_t, Int_t, Int_t, Int_t, Bool_t check = kFALSE) void setMinimumDist(Int_t i, Float_t dist) void setNHitsReal(Int_t i) void setNTuples() void setParContainers() void setSecondHit(Int_t hit2) void setStatus(Int_t i, Int_t stat) void setTime1Noise(Float_t time) void setTime1Real(Float_t t1) void setTime2Noise(Float_t time) void setTime2Real(Float_t t2) void setTof(Int_t i, Float_t tof) void setTrackN(Int_t i, Int_t number) void setWireOffset(Int_t i, Float_t off) void storeCell(Float_t, Float_t, Float_t, Int_t, Bool_t, Float_t) Bool_t testMdcSetup(Int_t s, Int_t m) Bool_t transform(Float_t, Float_t, Float_t, Float_t, Float_t, Int_t) public:
HMdcDigitizer() HMdcDigitizer(Text_t* name, Text_t* title) HMdcDigitizer(Text_t* name, Text_t* title, Int_t, Bool_t) ~HMdcDigitizer() static TClass* Class() Bool_t getCellEffUse() Bool_t getCreateOffsets() Bool_t getDeDxUse() Int_t getEmbeddingMode() Bool_t getErrorUse() Float_t getNoiseBandWidth() Int_t getNoiseMode() Bool_t getNoiseUse() Float_t getNoiseWhiteRatio() Float_t getNoiseWhiteWidth() Bool_t getNTuple() Bool_t getOffsetsUse() Float_t getScaleTime() Float_t getSigmaOffsets() Float_t getSignalSpeed() Int_t getTdcMode() Bool_t getTofUse() Bool_t getWireOffsetUse() Bool_t getWireStatUse() void initOffsets(TString filename) virtual TClass* IsA() const void printStatus() void setCellEffUse(Bool_t use) void setCreateOffsets(Bool_t create = kTRUE) void setDeDxUse(Bool_t use) void setEffLevel(Float_t eff0, Float_t eff1, Float_t eff2, Float_t eff3, Int_t on_off = 1) void setEmbeddingMode(Int_t mode) void setErrorUse(Bool_t use) void setNoiseBandWidth(Float_t w) void setNoiseLevel(Float_t noise0, Float_t noise1, Float_t noise2, Float_t noise3, Int_t on_off = 1) void setNoiseMode(Int_t mode) void setNoiseRange(Int_t rangeLo0, Int_t rangeLo1, Int_t rangeLo2, Int_t rangeLo3, Int_t rangeHi0, Int_t rangeHi1, Int_t rangeHi2, Int_t rangeHi3) void setNoiseUse(Bool_t use) void setNoiseWhiteRatio(Float_t w) void setNoiseWhiteWidth(Float_t w) void setNTuple(Bool_t ntuple) void setOffsets(Float_t off0, Float_t off1, Float_t off2, Float_t off3, Int_t on_off = 1) void setOffsetsUse(Bool_t use) void setScalerTime1Err(Float_t m0 = 0, Float_t m1 = 0, Float_t m2 = 0, Float_t m3 = 0) void setScaleTime(Float_t scale) void setSigmaOffsets(Float_t sig) void setSignalSpeed(Float_t speed) void setTdcMode(Int_t mode) void setTofUse(Bool_t use) void setWireOffsetUse(Bool_t use) void setWireStatUse(Bool_t use) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members

    private:
HCategory* fGeantMdcCat ! MDC HGeant input data HCategory* fGeantKineCat ! HGeantKine input data HLocation loc ! Location for new object HLocation locnoise ! Location for new object HCategory* fGeantCellCat ! Pointer to sim data category HCategory* fCalCat ! Pointer to cal data category HMdcGeantCell* hit ! Pointer to HMdcGeantCell hit HMdcGeantCell* hitReal ! Pointer to HMdcGeantCell hit HMdcLayerGeomPar* fDigitGeomPar ! Digitisation "geom" parameters HMdcDigitPar* fDigitPar ! Digitisation "phys" parameters HMdcCal2ParSim* fCal2ParSim ! pointer to cal2 parameter container HMdcCellEff* fCellEff ! pointer to cell efficiency parameter container HMdcWireStat* fWireStat ! pointer to wire status parameter container HMdcSizesCells* fsizescells ! pointer to hmdcsizescells parameter container HMdcDeDx2* fdEdX ! pointer to MdcDeDx2 parameter container HMdcGeomStruct* geomstruct ! pointer to hmdcgeomstruct parameter container HMdcCal1Sim* fCal ! pointer to data HMdcCal1Sim* fCalnoise ! pointer to noise data HMdcGeantCell* fCell ! pointer to Container for HMdcGeantCell HIterator* iterin ! Iterator over input category HIterator* itercell ! Iterator over cell category HIterator* itercal1 ! Iterator over cal1 category Int_t fEventId ! Number of current event Float_t yDist ! Distance to the sence wire Float_t pi ! Il y quatre pis a une vache Int_t modetdc 2 leading edges or leading and trailing edge of the signal Int_t setup[6][4] setup of Mdc (sec,mod) Float_t time1 ! drift time1 calculated by HMdcCal2ParSim Float_t time1Error ! drift time1 error calculated by HMdcCal2ParSim Float_t time2 ! drift time2 calculated by HMdcCal2ParSim Float_t time2Error ! drift time2 error calculated by HMdcCal2ParSim Float_t myalpha ! impact angle of the track in coordinate system of HMdcCal2ParSim Bool_t useError flag for use/don't use error in time1/time2 in output Bool_t useWireOffset flag for use/don't use error in time1/time2 in output Bool_t useDeDx2 flag for use/don't use MdcDeDx2 container for t2-t1 simulation TFile* myoutput ! file pointer for NTuple TNtuple* distance_time ! nTuple for internal information of the digitizer Bool_t fntuple switch for use/not use NTuple Bool_t useTof switch for use/not use of tof in output Float_t offsets[4] offsets are used to substract min tof Bool_t useOffsets switch for use/not use offset substraction in output Float_t effLevel[4] level of requiered maximum charge to create a signal (for example 20 (=20%)) Bool_t useCellEff switch for use/not use cell efficiency cut Bool_t useWireStat switch for use/not use wire stat container Bool_t hasPrinted flag is set , if printStatus() is called Float_t noiseLevel[4] level of randon noise for each module type Bool_t useNoise switch for use/not use of noise generator Int_t arrayNoise[5] temp array for status of noise Int_t noiseRangeLo[4] lower range of noise for each mdc type Int_t noiseRangeHi[4] upper range of noise for each mdc type Float_t time1noise ! time1 generated by the noise generator Float_t time2noise ! time2 generated by the noise generator Int_t noisemode switch for different noise modes Int_t firstHit ! number of first valid hit Int_t secondHit ! number of second valid hit Float_t firstTime2 ! time2 of first valid hit Int_t endList1 ! end of the list of hits belonging to the first valid hit Int_t firstsec Int_t firstmod Int_t firstlay Int_t firstcell Float_t noisebandwidth width of t2-t1 band in noise Float_t noisewhitewidth width of t2-t1 large region in noise Float_t noisewhiteratio ration between large region and band in noise static Float_t dTime[15] ! drift time1 + tof static Float_t dTime2[15] ! drift time2 + tof static Float_t dTimeErr[15] ! error of drift time1 static Float_t dTime2Err[15] ! error of drift time2 static Float_t minimumdist[15] ! minimum distance to wire static Int_t track[15] ! track numbers static Float_t timeOfFlight[15] ! tof static Float_t angle[15] ! impact angle in coordinate system of the cell static Int_t statusflag[15] ! flag for efficiency static Float_t fractionOfmaxCharge[15] ! value for fraction of maximum charge static Bool_t cutEdge[15] ! flag for minimum distance point out of cell static Float_t wireOffset[15] ! time for signal propagation on the wire Float_t time1Real ! drift time1 from real data Float_t time2Real ! drift time2 from real data Int_t nHitsReal ! number of hists from real data Int_t embeddingmode switch for keeping geant hits / realistic embedding Float_t signalSpeed speed of signal on the wire Float_t scaleError[4] ! scaler for error of time per module type Float_t rndmoffsets[6][4][6][220] ! random offsets to simulate calibrated offsets Float_t sigmaoffsets ! sigma of the gausian random offset distribution Bool_t createoffsets ! switch kTRUE: create offsets,kFALSE: read from file Float_t scaletime ! simple scaler for manipulating drift times (as done by tdc slopes)

Class Description


  HMdcDigitizer digitizes data and puts output values into
  CAL1 category for simulated data
  OPTIONS:

  -----------------------                                ------------
  |     HMdcUnpacker     |                               | HGeantMdc |
  |   (embedding mode)   |                              ------------
  |                      |                                   ||
  -----------------------                                    || input to digitizer
                                                             
                          --------------    read real    ------------------
                          | HMdcCal1Sim | ------------>  |  HMdcDigitizer  |
                          --------------   <-----------  |                 |
                                            write output |                 |
                                                         ------------------

  HMdcDigitizer("","",option,flag)

  option=1   : TDC mode for two measured leading edges of two signals
  option=2   : TDC mode for  measured leading and trailing edge of one signal
  flag=kTRUE : NTuple with internal variables of the digitizer will be filled and written
               to the outputfile digitizer.root inside the working directory
  flag=kFALSE: No NTuple is filled
------------------------------------------------------------------------------------------------------
  setNTuple(kFALSE) no nTuple with internal data is filled and written out
           (kTRUE ) a NTuple with internal data is filled and written to digitizer.root
  setTdcMode(1) TDC mode for two measured leading edges of two signals
            (2) TDC mode for  measured leading and trailing edge of one signal
  setOffsets(1.5,2.5,4.5,5.5, 0 or 1)sets offsets for each type of module which will be
                                     substracted from the calculated time1 and time2, the
                                     last flag switches the use of offsets on/off (1=on(default)).
  setEffLevel(90.,90.,90.,90., 0 or 1) sets level of cell efficiency cut for each type of module, the
                                       last flag switches the use of efficiency on/off (1=on(default)).
  setOffsets(1.5,2.5,4.5,5.5, 0 or 1)  offsets (ns), which will be substracted from drif time + tof
  setTofUse(kFALSE) time of flight will not be added to drift times
           (kTRUE ) time of flight will be added to drift time
  setErrorUse(kTRUE)  apply smearing of drift times with errors
             (kFALSE) do not apply smearing of drift times with errors
  setWireStatUse(kTRUE)  take into account dead wires
                (kFALSE) assume all wires working (default)
  setDeDxUse(kTRUE)  calculate t2-t1 from energy loss of the particle (default)
            (kFALSE) calculate t2-t1 from GARFIELD tables
  setNoiseLevel(5.,5.,5.,5.) sets level of noise for each type of module
  setNoiseRange(low1,low2,low3,low4,hi1,hi2,hi3,hi4) sets the time window of the noise
                                                     for each module type
  setNoiseBandWidth(width)       (time-above threshold bump 0-width ns)
  setNoiseWhiteWidth(upperrange) (upper range in time-above threshold for white noise outside the bump)
  setNoiseWhiteRatio(ratio);     (ratio between bump/white noise
  setNoiseMode(1)(default)GEANT cells will be overwritten by noise (if timenoise<time)
              (2)         GEANT cells will not be touched
  setEmbeddingMode(Int_t) (default)1=realistic merging og REAL and GEANT data (default)
                                   2=keep Geant data
  setSignalSpeed(0.004) sets the speed of the signal on the wire used to calulate the time offset
                        by the signal propagation on the wire (ns/mm)
------------------------------------------------------------------------------------------------------
 SHORT INTRODUCTION to HMdcDigitizer:

 SCHEME OF DIGITAZATION:
 1. Reading input from HGeantMdc
 2. Evaluation of fired cells
 3. Calulation of drift times / wire offsets
 4. Storing in HMdcGeantCell category (not persistent)
 5. Filling arrays of all hits for one cell from HMdcGeantCell
 6. set efficiency flags to the hits (cell efficiency/layer efficiency/dead wires)
 7. Filling real data into arrays if digitizer runs in embedding mode
 8. sorting arrays with increasing arrival time of the signal (drift + error + tof + wireoffset)
 9. selecting 1. and 2. valid hit in cell
 10.filling output to HMdcCal1Sim
 11.generation of noise

 INPUT DATA TO THE DIGITIZER:
 The Digitizer retrieves the GEANT data from
 HGeantMdc (sector,module,layer, hit: xcoord,ycoord,tof,ptot, incidence:theta,phi,tracknumber).
 Evaluation of fired cells:
 HMdcDigitizer::transform(Float_t xcoord, Float_t ycoord, Float_t theta,
                          Float_t phi   , Float_t tof   , Int_t trkNum) calculates
 which cells have been hit by the track. The Information about the layer geometry
 (pitch, cathod distance, wire orientation, number of wires per layer and number of central wire)
 is taken from HMdcLayerGeomPar. Output of the calculation is the minimum distance from the wire
 and the impact angle in the coordinate system of the cell. All values are stored in the
 HMdcGeantCell for a maximum number of 15 hits per cell via
 HMdcDigitizer::storeCell(Float_t per, Float_t tof, Float_t myangle, Int_t trkNum,
			    Bool_t flagCutEdge,Floa_t wireOffset).

 CALCULATION OF DRIFT TIMES:
 For each cell the drift time1 and time2 are calculated by corresponding functions of
 the HMdcCal2ParSim container which holds the calibration parameters for the "distance->drift time"
 calculation:
 HMdcCal2ParSim::calcTimeDigitizer (sector,module,angle,minDist,&time1,&time1Error) and
 HMdcCal2ParSim::calcTime2Digitizer(sector,module,angle,minDist,&time2,&time2Error).
 If setDeDxUse(kTRUE) (default) is chosen , the time to is calculated via
 HMdcDeDx2::scaledTimeAboveThreshold() inverse by the energy loss - Time over Threshold
 relation ship to assure compatible ToT/DeDx values for experimnt and simulation. The
 parameters for this transformation are obtained from experimental data.

 CALCULATION OF WIRE OFFSET:
 calcWireOffset(xcoor,ycoor,wOrient) calulates the time the signal of a given cell would take
 to popagate from the hit point to the readout electronis. The speed of the signal is taken from
 HMdcDigitPar::getSignalSpeed()(ns/mm). Internal functions of HMdcSizesCells are called to calulate
 the path length of the signal.

 EFFICIENCY CUTS:
 For each cell the efficiency cuts are calculated by a function of
 HMdcCellEff::calcEfficiency(module,minDist,angle,Level) which holds
 the information for the efficiency cuts on cell level. The level of the cuts can be specified
 by  HMdcDigitizer::setEffLevel(90.,90.,90.,90.) per module. The cut is done on the basis of GARFIELD
 simulations which give information on the charge which is collected on the sense wire of
 each cell for all combinations of distance and impact angle. The numbers which have to be set
 are the percentage of maximum charge required to make a signal. Hits which are on the edge of
 the drift cell will not create a big amount of charge and therefore will be kicked out first.
 The second cut on the layer level is an overall layer efficiency (e.g. 0.98 for 98% Efficiency)
 and will reduce the overall number of fired cells. This value is taken from HMdcDigiPar container.

 SIMULATION OF DEAD WIRES:
 With setWireStatUse(kTRUE) the dead wires of the real data are correctly taken into account.
 This cut is handled in the same way as the effciency cuts and has the top priority
 (wire stat -> cell efficieny -> layer efficiency). In all cases the drift time will be set to -999.
 To get the correct result one has to analyze the status flags! The Information about the status
 of the wire is taken from HMdcWireStat.

 SELECTING 1. AND 2. VALID HIT:
 According to the the cuts a list of status flags for each recorded track is filled.
 After all calculations the list of Tracks is sorted by the arrival time (tof + drift time + wire offset) by
 HMdcDigitizer::select(Int_t nHits) because only the first track will create a signal.
 The first valid hit (status=1) inside the track list will be found by
 HMdcDigitizer::findFirstValidHit(Int_t* firsthit, Float_t* firsttime2, Int_t* endlist1)
 which returns the index number of the first valid hit and the the last hit which falls
 into the given time window defined by time2 of first valid hit.
 HMdcDigitizer::findSecondValidHit(Int_t endlist1,Int_t* secondhit)
 finds a second valid hit starting with the last entry of the list of the first valid hit.
 All variables will return -999 if no valid hits are found.

 FILLING OUTPUT:
 According to the two different TDC modes the HMdcCal1Sim category is filled.
 If HMdcDigitizer::setTofUse(kFALSE) is selected, the time of flight will be substracted and
 only the drift time is written to the output. With HMdcDigitizer::setOffsets(1.5,2.5,4.5,5.5, 0 or 1)
 a common minimum offset (fast particles) per module type can be set and will be subtracted
 from the calculated time to be closer to the real measurement situation.
 With setErrorUse(kFALSE) the digitizer can be forced to write the drift times without error smearing to the
 output.

 NOISE SIMULATION:
 Noise simulation should be used only in TDC mode 2 (leading + trailing edge)
 and not in embedding mode!
 The noise simulation is done after output data have been already filled to HMdcCal1 category.
 a loop over the category is performed and the noise is filled in 2 ways.
 1. a loop over all existing cells in the setup of Mdc is done and randomly picked cells
    are filled width noise and added to the category ("only noise" cells).
 2. For the existing cells filled with GEANT data a comparison between the randomly created noise
    time and the real time is done (if setNoiseMode(1)). The earlier of both is taken and if the noise wins
    the status flags are changed accordingly.
 With HMdcDigitizer::setNoiseLevel(5.,5.,5.,5.) the simulation of noise can be switched on.
 HMdcDigitizer::fillNoise() loops over all cells existing in the actual setup and will randomly
 pick cells according to the specified probability per module (5.==5%) and set the statusflag to 2.
 If a cell is selected for noise production a second random process generates the time in the
 range of the specified window set by HMdcDigitizer::setNoiseRange(low1,low2,low3,low4,hi1,hi2,hi3,hi4).
 The behaviour of the noise generation can be specified with
 1. setNoiseBandWidth(width)       (time-above threshold bump 0-width ns)
 2. setNoiseWhiteWidth(upperrange) (upper range in time-above threshold for white noise outside the bump)
 3. setNoiseWhiteRatio(ratio);     (ratio between bump/white noise
 With HMdcDigitizer::setNoiseMode(1)(default) a given time in one of the original GEANT cells
 will be overwritten by the the noise time, if timenoise < time.In this case the statusflag of
 the cell will be set to 2 (valid hit but noise).In the case of HMdcDigitizer::setNoiseMode(2) the
 original GEANT cells will not be touched.

 EVENT EMBEDDING:
 In the embedding case of GEANT data into REAL data, the digitizer looks to the HMdcCal1Sim and gets the
 data words filled with the REAL data by the HMdcCalibrater1 which would fall in the same Cells as the
 GEANT data. If the embedding mode is set to 1 (default) the digitizer will do a "realistic" merging,
 that means, the first hit from REAL or GEANT data will be accepted. In embedding mode 2 the GEANT data
 will be allways kept and the coresponding REAL data will be overwritten by GEANT data. The embedding
 mode can be switched by HMdcDigitizer::setEmbeddingMode(Int_t)(1=realistic,2=keep Geant data).
 The status flag of REAL data will be 0, where as in the listStatus[5] the status flag will be 3 for
 REAL data hits which are merged into GEANT cells. The track number of real data HMdcCalSim objects will
 be the common track number which can be retrieved via gHades->getEmbeddingRealTrackId().


 SPECIAL FEATURES:
-----------creating offsets to simulate calibrated offsets----------------------
 the impact of calibration of time offsets can be simulated too (by default this feature is not used).
 The offsets will be random generated from gRandom->Gaus(mean,sig).
  void    setSigmaOffsets(Float_t sig)      (default is 2ns)
  void    setCreateOffsets(Bool_t kTRUE)    (create new table of offsets)
  void    initOffsets(TString filename)     (if createoffsets=kTRUE a new table will be created and stored
                                             to file filename (if not "")
                                             if createoffsets=kFALSE and filename is provided the table
                                             will be read from ascii file)

-----------manipulate drift times (tdc slope time errors...)--------------------------------
  void    setScaleTime(Float_t scale)        drift times will be scaled by scale (defualt 1.0)
  void    setScalerTime1Err(Float_t m0=0,Float_t m1=0,Float_t m2=0,Float_t m3=0) (default 1.0)
                                             drift times errors (time1) will be scaled per module
------------------------------------------------------------------------------------------------------
 MODE 1 (two times LEADING EDGE of the TDC signal)
           nHits ==  -2 for 2 valid hits
                 ==  -1 for 1 valid hit
                 ==   0 for a not filled hit (e.g. 1 hit was kicked out by efficiency)
         status1 ==   1 for a valid first hit
                 ==   2 for a valid first hit caused by noise
                 ==  -3 for a not valid hit
                 ==   0 no hit
                 ==   3 for REAL data (embedding)
         status2 ==   1 for a valid second hit
                 ==   2 for a valid second hit caused by noise
                 ==  -3 for a not valid hit
                 ==   0 no hit
                 ==   3 for REAL data (embedding)
         angle1  ==   impact of track1 or -99 if not filled
         angle2  ==   impact of track2 or -99 if not filled
         minDist1==   minimum distance of track1 or -99 if not filled
         minDist2==   minimum distance of track2 or -99 if not filled
         error1  ==   error of time1
         error2  ==   error of time1 of the second valid hit or -99 if not filled
         tof1    ==   tof of time1
         tof2    ==   tof of time1 of the second valid hit or -99 if not filled
         wireOff1==   signal time on wire of track1 or -99 if not filled
         wireOff2==   signal time on wire of track2 or -99 if not filled
         nTrack1 ==   track number of the first valid hit
                 ==  -99 if not filled
         nTrack2 ==   track number of the second valid hit
                 ==  -99 if not filled
         time1   ==   drift time1 of the first valid hit
                 ==  -999 if not filled
         time2   ==   drift time1 of the second valid hit
                 ==  -999 if not filled
     listTrack[5] :   contains the track number of the first 5 hits per cell
                      == -99 if no hit was filled or noise
     listStatus[5]:   contains the status flags of the first 5 hits per cell
                      == -1 if hit was kicked out by cell efficiency cut
                      == -2 if hit was kicked out by layer efficiency cut
                      == -3 if hit was kicked out by wire stat
                      == -4 if hit was kicked out by noise
                      ==  1 if hit is valid
                      ==  2 if hit is noise
                      ==  3 if hit is real data (embedding)
                      ==  0 if no hit was filled
     both lists will be filled even if no vaild hit was found

 MODE 2 (LEADING AND TRAILING EDGE of the TDC signal)
           nHits ==  +2 for 2 valid hits
                 ==   0 for not filled hit (e.g. 1 hit was kicked out by efficiency)
         status1 ==   1 for a valid first hit
                 ==   2 for a valid first hit caused by noise
                 ==  -3 for a not valid hit
                 ==   0 or no hit
                 ==   3 REAL data (embedding)
         status2 ==   1 for a valid first hit
                 ==   2 for a valid first hit caused by noise
                 ==  -3 for a not valid hit
                 ==   no hit
                 ==   3 for REAL data (embedding)
         angle1  ==   impact of track1 or -99 if not filled
         angle2  ==   impact of track1 or -99 if not filled
         minDist1==   minimum distance of track1 or -99 if not filled
         minDist2==   minimum distance of track1 or -99 if not filled
         error1  ==   error of time1 or -99 if not filled
         error2  ==   error of time2 or -99 if not filled
         tof1    ==   tof of time1 or -99 if not filled
         tof2    ==   tof of time2 or -99 if not filled
         wireOff1==   signal time on wire of track1 or -99 if not filled
         wireOff2==   signal time on wire of track1 or -99 if not filled
         nTrack1 ==   track number of first valid hit
                 ==  -99 if not filled
         nTrack2 ==   track number of first valid hit
                 ==  -99 if not filled
         time1   ==   drift time1 of the first valid hit
                 ==  -999 if not filled
         time2   ==   drift time2 of the first valid hit
                 ==  -999 if not filled
     listTrack[5] :   contains the track number of the first 5 hits per cell
                      == -99 if no hit was filled or noise
     listStatus[5]:   contains the status flags of the first 5 hits per cell
                      == -1 if hit was kicked out by cell efficiency cut
                      == -2 if hit was kicked out by layer efficiency cut
                      == -3 if hit was kicked out by wire stat
                      == -4 if hit was kicked out by noise
                      ==  1 if hit is valid
                      ==  2 if hit is noise
                      ==  3 if hit is real data (embedding)
                      ==  0 if no hit was filled
     both lists will be filled even if no vaild hit was found
------------------------------------------------------------------------------------------------------
     EXAMPLES :
     In general: if nHits<0 ->TDC MODE=1
                 if nHits>0 ->TDC MODE=2
                 if status1/status2>0 -> valid hit (1: normal, 2: noise)
                 if status1/status2<0 -> no valid hit (-3)

     TDC MODE 1 (2 leading edges)
     no valid hit:  status1=status2=-3 rest will be filled like normal hits
     1 valid hit :  time1!=-999,time2=-999,status1=1,status2=-3,nHits=-1,nTrack1!=-99,nTrack2=-99
     2 valid hits:  time1!=-999,time2!=-999,status1=status2=1,nHits=-2,nTrack1!=-99,nTrack2!=-99
     noise hit   :  if GEANT hit was overwritten:status1/status2 =2 rest filled like normal hits
                    if a noise cell was added to GEANT cells:
                    time1!=-999,time2=-999,status1=2,status2=-3,nHits=-1,
                    nTrack1=nTrack2=-99

     TDC MODE 2 (leading and trailing edge)
     no valid hit:  status1=status2=-3 rest will be filled like normal hit
     1 valid hit :  time1!=-999,time2!=-999,status1=status2=1,nHits=2,nTrack1=nTrack2!=-99
     noise hit   :  if GEANT hit was overwritten:status1=status2=2 rest filled like normal hits
                    if a noise cell was added to GEANT cells:
                    time1!=-999,time2!=-999,status1=status2=2,nHits=2,
                    nTrack1=nTrack2=-99

    MODE1 and MODE2 :

    if status1/status2=-3 looking to the StatusList[5]: -1 cut on Cell efficiency
                                                        -2 cut on Layer efficiency
    The TrackList[5] will be filled with the GEANT track numbers no matter if the hit was
    valid or not or overwritten by noise!


HMdcDigitizer(void)

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

HMdcDigitizer(Text_t *name,Text_t *title,Int_t TDCMODE,Bool_t NTUPLE) : HReconstructor(name,title)
 TDCMODE sets the simulation mode to the two different
 possibilities of the TDC: 1 == to leading edges
                           2 == leading and trailing edge
 NTUPLE switches the NTuple with the internal information of
 the digitizer ON or OFF:   kFALSE == no NTuple filled
                            kTRUE  == NTuple filled.

~HMdcDigitizer(void)

void initVariables()
 sets all used variables to the initial values

void setParContainers()
 Get pointers to the needed containers.The containers are
 created and added to the runtime Database if the are not existing

void setNTuples(void)
 Creates an NTuple for the internal infomation of the digitizer
 which is stored in the file digitizer.root in the working directory.
 The NTuple contains
 sec,mod,lay,cell: the "software address" of a single cell
 dist,angle: minimum distance of the track to the wire
             and impact angle in coordinates of the cell
 time1, time1Err,time2,time2Err: values for the drift times
 tof: time of flight
 cutEdge: 0 if minimum distance smaler than cell bounderies, 1 if larger
 status: 1 if valid hit, 2 if noise, 3 for REAL data
        -1 if cut by cell efficiency
        -2 if cut by layer efficiency
 track: track number (-99 if no real track)
 eff:   efficiency value which would correspond to a cut on this minimum dist

Bool_t init(void)
 The parameter containers and the iterators over
 the categorys MdcGeanRaw, MdcGeantCell and MdcCal1Sim are created.
 The actual setup of the Mdc detector in the running analysis
 is retrieved.

Bool_t reinit(void)

void printStatus()
 Prints the Options, default settings and
 actual configuration of HMdcDigitizer.

Bool_t finalize(void)
 If NTuple exist it will be written to digitizer.root.

Int_t execute(void)
 GEANT data are retrieved from HGeantMdc.
 The GEANT hits will be transformed to the
 layer coordinate system of the Mdc to find
 the fired cells. For the fired cells the drift time
 calulation, noise generation and efficiency cuts will
 be performed according to the settings and the results
 will be stored in HMdcCal1Sim.

void fillArrays(Int_t ihit,Int_t sec,Int_t mod,HMdcGeantCell* fCell)
 All needed Arrays for the calculations are
 filled (minimumdist,angle,tracknumber,tof,time1,time2,time1err,time2err)

void fillArraysReal(Int_t i)
 All needed Arrays for the calculations are
 filled for the REAL hits (minimumdist,angle,tracknumber,tof,time1,time2,time1err,time2err)

void setEfficiencyFlags(Int_t ihit,Int_t sec,Int_t mod,Int_t lay)
 Cuts for cell efficiency layer efficiency and wire status are checked
 and the statusflag of the cells are set correspondingly
 Has to be done for sim tracks only!

Bool_t evalWireStat(Int_t sec,Int_t mod,Int_t lay,Int_t cell)
 gets the status of the wire from HMdcWireStat.
 returns kFALSE if wire is dead or not connected.

void fillNTuple(Int_t sec,Int_t mod,Int_t lay,Int_t cell,Int_t ihit, HMdcGeantCell* fCell, TNtuple* distance_time)
 The NTuple is filled with internal data of the digitizer

void fillNTuple(Int_t sec,Int_t mod,Int_t lay,Int_t cell, Float_t time, Float_t time2, Int_t status)
 The NTuple is filled with internal data of the digitizer
 in the case of noise generation

Float_t fillTime1Noise(Int_t mod)
 A random time in a specified time window
 for the noise simulation is calculated

Float_t fillTime2Noise(Int_t mod)
 A random time in a specified time window
 for the noise simulation is calculated

void fillNoiseLists(HMdcCal1Sim* cal1,Int_t statval,Int_t geant)

void fillNoiseToGeantCells(Int_t mod,HMdcCal1Sim* cal1)
 If timenoise < time of the first valid GEANT hit
 the time is replaced by timenoise and the
 statusflag is changed from 1 (valid) to 2 (valid but noise)

void setLoopVariables(Int_t s,Int_t m,Int_t l,Int_t c,Bool_t check)

void handleOverFlow(Int_t firsts, Int_t firstm, Int_t firstl, Int_t firstc)
 if last cell in Layer has been reached
 the next valid cell in setup has to be taken

void fillNoise(Int_t firsts, Int_t firstm, Int_t firstl, Int_t firstc, Int_t lastsec, Int_t lastmod, Int_t lastlay, Int_t lastcell)
 Fills the noise cells to Cal1Sim up to the next GEANT Cell
 and the rest of the noise cells after the last GEANT Cell (if
 input lastcell==999).

void fillTrackList( HMdcCal1Sim* fCal)
 fills track list and status list for hits in both tdc modes

void findFirstValidHit()
 Function to find the first valid hit (statusflag > 0) inside the
 array for both tdc modes. Returns the number of the element of the
 first valid hit and last hit inside the time  window to variables.

void findSecondValidHit()
 Function to find the second valid hit (statusflag > 0) inside the
 array for tdc mode1. Returns the number of the element of the second
 valid hit

void select(Int_t nHits)
 Puts the drift time values into increasing order.
 Orders the corresponding track number, time of flight, statusflag
 and impact angle etc accordingly

void getMdcSetup()
 Gets Mdc detector setup

Bool_t testMdcSetup(Int_t s, Int_t m)
 Tests the Mdc setup if the modules are present
 in the running analysis

Bool_t transform(Float_t xcoor,Float_t ycoor,Float_t theta, Float_t phi ,Float_t tof ,Int_t trkNum)
 Gets the x,y coordinates, theta and phi, time of flight and track number.
 From the coordinates and angles the hits in the cells are calculated.
 All needed parameters are taken from HMdcLayerGeomPar and HMdcDigitPar
 containers.

Float_t calcWireOffset(Float_t xcoor,Float_t ycoor,Float_t wOrient)
 calculate the time needed by the signal to propagate to the tdc

void storeCell(Float_t per,Float_t tof,Float_t myangle,Int_t trkNum ,Bool_t flagCutEdge,Float_t wireOffset)
 Puts the data (minimum distance, time of flight, impact angle,
 track number, flagCutEdge) to HMdcGeantCell Category

void initOffsets(TString filename)
 if createoffsets=kTRUE (setCreateOffsets()) a gausian distribution arround 0 with
 sigma = sigmaoffsets is created (setSigmaOffsets(Float_t sig)). The values are written
 to a ascii file "filename" for future use (if this file exists, it
 will be over written!).
 If createoffsets=kFALSE the offsets will not be recreated and instead the digitizer will
 read them from ascii file "filename".



Inline Functions


               void setOffsets(Float_t off0, Float_t off1, Float_t off2, Float_t off3, Int_t on_off = 1)
               void setEffLevel(Float_t eff0, Float_t eff1, Float_t eff2, Float_t eff3, Int_t on_off = 1)
               void setNoiseLevel(Float_t noise0, Float_t noise1, Float_t noise2, Float_t noise3, Int_t on_off = 1)
               void setNoiseRange(Int_t rangeLo0, Int_t rangeLo1, Int_t rangeLo2, Int_t rangeLo3, Int_t rangeHi0, Int_t rangeHi1, Int_t rangeHi2, Int_t rangeHi3)
               void setNoiseBandWidth(Float_t w)
               void setNoiseWhiteWidth(Float_t w)
               void setNoiseWhiteRatio(Float_t w)
            Float_t getNoiseBandWidth()
            Float_t getNoiseWhiteWidth()
            Float_t getNoiseWhiteRatio()
               void setErrorUse(Bool_t use)
             Bool_t getErrorUse()
               void setTofUse(Bool_t use)
             Bool_t getTofUse()
               void setWireOffsetUse(Bool_t use)
             Bool_t getWireOffsetUse()
               void setOffsetsUse(Bool_t use)
             Bool_t getOffsetsUse()
               void setCellEffUse(Bool_t use)
             Bool_t getCellEffUse()
               void setWireStatUse(Bool_t use)
             Bool_t getWireStatUse()
               void setNoiseUse(Bool_t use)
             Bool_t getNoiseUse()
               void setDeDxUse(Bool_t use)
             Bool_t getDeDxUse()
               void setNTuple(Bool_t ntuple)
             Bool_t getNTuple()
               void setTdcMode(Int_t mode)
              Int_t getTdcMode()
               void setNoiseMode(Int_t mode)
              Int_t getNoiseMode()
               void setEmbeddingMode(Int_t mode)
              Int_t getEmbeddingMode()
               void setSignalSpeed(Float_t speed)
            Float_t getSignalSpeed()
               void setScaleTime(Float_t scale)
            Float_t getScaleTime()
               void setScalerTime1Err(Float_t m0 = 0, Float_t m1 = 0, Float_t m2 = 0, Float_t m3 = 0)
               void setSigmaOffsets(Float_t sig)
            Float_t getSigmaOffsets()
             Bool_t getCreateOffsets()
               void setCreateOffsets(Bool_t create = kTRUE)
               void initArrays()
               void resetListVariables()
               void resetCal1Real()
               void setTime1Real(Float_t t1)
               void setTime2Real(Float_t t2)
               void setNHitsReal(Int_t i)
            Float_t getTime1Real()
            Float_t getTime2Real()
              Int_t getNHitsReal()
               void getCal1Real()
               void setTime1Noise(Float_t time)
               void setTime2Noise(Float_t time)
            Float_t getTime1Noise()
            Float_t getTime2Noise()
               void setFirstHit(Int_t hit1)
               void setSecondHit(Int_t hit2)
               void setFirstTime2(Float_t time2)
               void setEndList1(Int_t end)
              Int_t getFirstHit()
              Int_t getSecondHit()
            Float_t getFirstTime2()
              Int_t getEndList1()
               void setDTime1(Int_t i, Float_t time)
               void setDTime2(Int_t i, Float_t time)
               void setDTime1Err(Int_t i, Float_t timeErr)
               void setDTime2Err(Int_t i, Float_t timeErr)
               void setMinimumDist(Int_t i, Float_t dist)
               void setTrackN(Int_t i, Int_t number)
               void setTof(Int_t i, Float_t tof)
               void setAngle(Int_t i, Float_t a)
               void setStatus(Int_t i, Int_t stat)
               void setFractionOfmaxCharge(Int_t i, Float_t f)
               void setCutEdge(Int_t i, Bool_t cut)
               void setWireOffset(Int_t i, Float_t off)
            Float_t getDTime1(Int_t i)
            Float_t getDTime2(Int_t i)
            Float_t getDTime1Err(Int_t i)
            Float_t getDTime2Err(Int_t i)
            Float_t getMinimumDist(Int_t i)
              Int_t getTrackN(Int_t i)
            Float_t getTof(Int_t i)
            Float_t getAngle(Int_t i)
              Int_t getStatus(Int_t i)
            Float_t getFractionOfmaxCharge(Int_t i)
             Bool_t getCutEdge(Int_t i)
            Float_t getWireOffset(Int_t i)
            Float_t getCellEffLevel(Int_t i)
            Float_t getNoiseLevel(Int_t i)
            Float_t getOffset(Int_t i)
              Int_t getNoiseRangeHi(Int_t i)
              Int_t getNoiseRangeLo(Int_t i)
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
               void StreamerNVirtual(TBuffer& b)


Author: A.Nekhaev
Last update: Fri Jan 26 12:06:23 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.