_HADES_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 and efficiency of single wires
(kFALSE) assume all wires working (default)
setTimeCutUse(kTRUE) take into account time cuts
(kFALSE) (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/efficiency 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
== -5 for cutted by time cut
== 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
== -5 for cutted by time cut
== 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
== -5 if cutted by time cut
== 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
== -5 for cutted by time cut
== 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
== -5 for cutted by time cut
== 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
== -5 if cutted by time cut
== 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!