SetOutputOption();
SetDo10to8();
}
+AliITSresponseSDD::~AliITSresponseSDD() {
-//__________________________________________________________________________
-AliITSresponseSDD::AliITSresponseSDD(const AliITSresponseSDD &source){
- // Copy Constructor
- if(&source == this) return;
- Int_t i;
- for(i=0;i<8;i++){this->fCPar[i] = source.fCPar[i];}
- this->fNoise = source.fNoise;
- this->fBaseline = source.fBaseline;
- this->fNoiseAfterEl = source.fNoiseAfterEl;
- this->fDynamicRange = source.fDynamicRange;
- this->fChargeLoss = source.fChargeLoss;
- this->fTemperature = source.fTemperature;
- this->fDriftSpeed = source.fDriftSpeed;
- this->fNsigmas = source.fNsigmas;
- this->fMaxAdc = source.fMaxAdc;
- this->fDiffCoeff = source.fDiffCoeff;
- this->fDiffCoeff1 = source.fDiffCoeff1;
- this->fZeroSuppFlag = source.fZeroSuppFlag;
- this->fMinVal = source.fMinVal;
- this->fWrite = source.fWrite;
- this->fBitComp = source.fBitComp;
- this->fOption = source.fOption;
- this->fParam1 = source.fParam1;
- return;
-}
+ if(fGaus) delete fGaus;
-//_________________________________________________________________________
-AliITSresponseSDD&
- AliITSresponseSDD::operator=(const AliITSresponseSDD &source) {
- // Assignment operator
- if(&source == this) return *this;
- Int_t i;
- for(i=0;i<8;i++){this->fCPar[i] = source.fCPar[i];}
- this->fNoise = source.fNoise;
- this->fBaseline = source.fBaseline;
- this->fNoiseAfterEl = source.fNoiseAfterEl;
- this->fDynamicRange = source.fDynamicRange;
- this->fChargeLoss = source.fChargeLoss;
- this->fTemperature = source.fTemperature;
- this->fDriftSpeed = source.fDriftSpeed;
- this->fNsigmas = source.fNsigmas;
- this->fMaxAdc = source.fMaxAdc;
- this->fDiffCoeff = source.fDiffCoeff;
- this->fDiffCoeff1 = source.fDiffCoeff1;
- this->fZeroSuppFlag = source.fZeroSuppFlag;
- this->fMinVal = source.fMinVal;
- this->fWrite = source.fWrite;
- this->fBitComp = source.fBitComp;
- this->fOption = source.fOption;
- this->fParam1 = source.fParam1;
- return *this;
}
void AliITSresponseSDD::SetCompressParam(Int_t cp[8])
cout << "Max. ADC Value: " << fMaxAdc << endl;
cout << "Min. Value: " << fMinVal << endl;
- cout << "Zero suppression flag: " << fZeroSuppFlag << endl;
cout << "**************************************************" << endl;
//
AliITSresponseSDD();
- virtual ~AliITSresponseSDD() {
- // destructor
- }
- AliITSresponseSDD(const AliITSresponseSDD &source); // copy constructor
- AliITSresponseSDD& operator=(const AliITSresponseSDD &source); // ass. op.
+ virtual ~AliITSresponseSDD();
- virtual void SetElectronics(Int_t p1=1) {
+ void SetElectronics(Int_t p1=1) {
// Electronics: Pascal or OLA
fElectronics=p1;
}
- virtual Int_t Electronics() {
+ Int_t Electronics() {
// Electronics: 1 = Pascal; 2 = OLA
return fElectronics;
}
- virtual void SetMaxAdc(Float_t p1=1024.) {
+ void SetMaxAdc(Float_t p1=1024.) {
// Adc-count saturation value
fMaxAdc=p1;
}
- virtual Float_t MaxAdc() {
+ Float_t MaxAdc() {
// Get maximum Adc-count value
return fMaxAdc;
}
- virtual void SetChargeLoss(Float_t p1=0.01) {
+ void SetChargeLoss(Float_t p1=0.01) {
// Set Linear Charge Loss Steepness
fChargeLoss=p1;
}
- virtual Float_t ChargeLoss() {
+ Float_t ChargeLoss() {
// Get Charge Loss Coefficient
return fChargeLoss;
}
- virtual void SetDynamicRange(Float_t p1=132.) {
+ void SetDynamicRange(Float_t p1=132.) {
// Set Dynamic Range
fDynamicRange=p1;
}
- virtual Float_t DynamicRange() {
+ Float_t DynamicRange() {
// Get Dynamic Range
return fDynamicRange;
}
- virtual void SetDiffCoeff(Float_t p1=3.23,Float_t p2=30.) {
+ void SetDiffCoeff(Float_t p1=3.23,Float_t p2=30.) {
// Diffusion coefficients
fDiffCoeff=p1;
fDiffCoeff1=p2;
}
- virtual void DiffCoeff(Float_t&diff,Float_t&diff1) {
+ void DiffCoeff(Float_t&diff,Float_t&diff1) {
// Get diffusion coefficients
diff = fDiffCoeff;
diff1 = fDiffCoeff1;
}
- virtual void SetDriftSpeed(Float_t p1=7.3) {
+ void SetDriftSpeed(Float_t p1=7.3) {
// Drift velocity
fDriftSpeed=p1;
}
- virtual Float_t DriftSpeed() {
+ Float_t DriftSpeed() {
// drift speed
return fDriftSpeed;
}
- virtual void SetTemperature(Float_t p1=23.) {
+ void SetTemperature(Float_t p1=23.) {
// Temperature
fTemperature=p1;
}
- virtual Float_t Temperature() {
+ Float_t Temperature() {
// Get temperature
return fTemperature;
}
- virtual void SetDataType(const char *data="simulated") {
+ void SetDataType(const char *data="simulated") {
// Type of data - real or simulated
fDataType=data;
}
- virtual const char *DataType() const {
+ const char *DataType() const {
// Get data type
return fDataType.Data();
}
- virtual void SetParamOptions(const char *opt1="same",const char *opt2="same"){
+ void SetParamOptions(const char *opt1="same",const char *opt2="same"){
// Parameters: "same" or read from "file"
fParam1=opt1; fParam2=opt2;
}
- virtual void ParamOptions(char *opt1,char *opt2) {
+ void ParamOptions(char *opt1,char *opt2) {
// options
strcpy(opt1,fParam1.Data()); strcpy(opt2,fParam2.Data());
}
- virtual void SetNoiseParam(Float_t n=8.3, Float_t b=20.){
+ void SetNoiseParam(Float_t n=8.3, Float_t b=20.){
// Noise and baseline
fNoise=n; fBaseline=b;
}
- virtual void SetNoiseAfterElectronics(Float_t n=1.6){
+ void SetNoiseAfterElectronics(Float_t n=1.6){
// Noise after electronics (ADC units)
fNoiseAfterEl=n;
}
- virtual void GetNoiseParam(Float_t &n, Float_t &b) {
+ void GetNoiseParam(Float_t &n, Float_t &b) {
// get noise param
n=fNoise; b=fBaseline;
}
- virtual Float_t GetNoiseAfterElectronics(){
+ Float_t GetNoiseAfterElectronics(){
// Noise after electronics (ADC units)
return fNoiseAfterEl;
}
- virtual void SetDo10to8(Bool_t bitcomp=kTRUE) {
+ void SetDo10to8(Bool_t bitcomp=kTRUE) {
// set the option for 10 to 8 bit compression
fBitComp = bitcomp;
}
return fBitComp;
}
- virtual void SetZeroSupp (const char *opt="1D") {
+ void SetZeroSupp (const char *opt="1D") {
// Zero-suppression option - could be 1D, 2D or non-ZS
fOption=opt;
}
- virtual const char *ZeroSuppOption() const {
+ const char *ZeroSuppOption() const {
// Get zero-suppression option
return fOption.Data();
}
- virtual void SetMinVal(Int_t mv=4) {
+ void SetMinVal(Int_t mv=4) {
// Min value used in 2D - could be used as a threshold setting
fMinVal = mv;
}
- virtual Int_t MinVal() {
+ Int_t MinVal() {
// min val
return fMinVal;
}
- virtual void SetFilenames(const char *f1="",const char *f2="",const char *f3="") {
+ void SetFilenames(const char *f1="",const char *f2="",const char *f3="") {
// Set filenames - input, output, parameters ....
fFileName1=f1; fFileName2=f2; fFileName3=f3;
}
- virtual void Filenames(char *input,char *baseline,char *param) {
+ void Filenames(char *input,char *baseline,char *param) {
// Filenames
strcpy(input,fFileName1.Data()); strcpy(baseline,fFileName2.Data());
strcpy(param,fFileName3.Data());
}
- virtual void SetOutputOption(Bool_t write=kFALSE) {
+ void SetOutputOption(Bool_t write=kFALSE) {
// set output option
fWrite = write;
}
}
//
// Compression parameters
- virtual void SetCompressParam(Int_t cp[8]);
+ void SetCompressParam(Int_t cp[8]);
void GiveCompressParam(Int_t *x);
//
// Detector type response methods
- virtual void SetNSigmaIntegration(Float_t p1=3.) {
+ void SetNSigmaIntegration(Float_t p1=3.) {
// Set number of sigmas over which cluster disintegration is performed
fNsigmas=p1;
}
- virtual Float_t NSigmaIntegration() {
+ Float_t NSigmaIntegration() {
// Get number of sigmas over which cluster disintegration is performed
return fNsigmas;
}
- virtual void SetNLookUp(Int_t p1=121) {
+ void SetNLookUp(Int_t p1=121) {
// Set number of sigmas over which cluster disintegration is performed
fNcomps=p1;
fGaus = new TArrayF(fNcomps+1);
// cout << "fGaus[" << i << "]: " << fGaus->At(i) << endl;
}
}
- virtual Int_t GausNLookUp() {
// Get number of intervals in which the gaussian lookup table is divided
- return fNcomps;
- }
- virtual void SetSigmaSpread(Float_t p1, Float_t p2) {
- // Set sigmas of the charge spread function
- }
- virtual void SigmaSpread(Float_t &s1, Float_t &s2) {
- // Get sigmas for the charge spread
- }
+ Int_t GausNLookUp() {return fNcomps;}
- virtual Float_t IntPH(Float_t eloss) {
+ Float_t IntPH(Float_t eloss) {
// Pulse height from scored quantity (eloss)
return 0.;
}
- virtual Float_t IntXZ(AliITSsegmentation *) {
+ Float_t IntXZ(AliITSsegmentation *) {
// Charge disintegration
return 0.;
}
- virtual Float_t GausLookUp(Int_t i) {
+ Float_t GausLookUp(Int_t i) {
if(i<0 || i>=fNcomps) return 0.;
return fGaus->At(i);
}
- virtual void Print();
+ void Print();
+
+
+private:
+
+ AliITSresponseSDD(const AliITSresponseSDD &source); // copy constructor
+ AliITSresponseSDD& operator=(const AliITSresponseSDD &source); // ass. op.
protected:
TArrayF *fGaus; // Gaussian lookup table for signal generation
Int_t fNcomps; // Number of samplings along the gaussian
- Int_t fZeroSuppFlag; // Zero-suppression flag
Int_t fMinVal; // Min value used in 2D zero-suppression algo
Bool_t fWrite; // Write option for the compression algorithms
TString fFileName2; // baseline & noise val or output coded // signal or monitored bgr.
TString fFileName3; // param values or output coded signal
- ClassDef(AliITSresponseSDD,1) // SDD response
+ ClassDef(AliITSresponseSDD,2) // SDD response
};
#endif
AliITSresponse *resp){
// constructor
fGeom=geom;
- fResponse=resp;
+ fDriftSpeed=resp->DriftSpeed();
fCorr=0;
SetDetSize();
SetPadSize();
AliITSsegmentationSDD::AliITSsegmentationSDD(){
// standard constructor
fGeom=0;
- fResponse=0;
+ fDriftSpeed=0;
fCorr=0;
SetDetSize();
SetPadSize();
SetNPads();
}
-//______________________________________________________________________
-AliITSsegmentationSDD& AliITSsegmentationSDD::operator=(AliITSsegmentationSDD
- &source){
- // Operator =
- if(this==&source) return *this;
- this->fNsamples = source.fNsamples;
- this->fNanodes = source.fNanodes;
- this->fPitch = source.fPitch;
- this->fTimeStep = source.fTimeStep;
- this->fDx = source.fDx;
- this->fDz = source.fDz;
- this->fDy = source.fDy;
- this->fCorr = new TF1(*(source.fCorr));
- this->fGeom = source.fGeom; // Just copy the pointer
- this->fResponse = source.fResponse; //Just copy the pointer
- return *this;
-}
-//______________________________________________________________________
-AliITSsegmentationSDD::AliITSsegmentationSDD(AliITSsegmentationSDD &source){
- // Copy constructor
- *this = source;
-}
//----------------------------------------------------------------------
void AliITSsegmentationSDD::Init(){
// Standard initilisation routine
//----------------------------------------------------------------------
void AliITSsegmentationSDD::GetPadIxz(Float_t x,Float_t z,
Int_t &timebin,Int_t &anode){
-// Returns cell coordinates (time sample,anode) for given real local
-// coordinates (x,z)
+// Returns cell coordinates (time sample,anode) incremented by 1 !!!!!
+// for given real local coordinates (x,z)
// expects x, z in cm
const Float_t kconv=10000; // cm->um
- Float_t speed=fResponse->DriftSpeed();
Int_t na = fNanodes/2;
Float_t driftpath=fDx-TMath::Abs(kconv*x);
- timebin=(Int_t)(driftpath/speed/fTimeStep);
- anode=(Int_t)(kconv*z/fPitch) + na/2;
+ timebin=(Int_t)(driftpath/fDriftSpeed/fTimeStep);
+ anode=(Int_t)(kconv*(z/fPitch + na/2));
if (x > 0) anode += na;
timebin+=1;
// Transform from cell to real local coordinates
// returns x, z in cm
+ // the +0.5 means that an # and time bin # should start from 0 !!!
const Float_t kconv=10000; // um->cm
+ // the +0.5 means that an # and time bin # should start from 0 !!!
- Float_t speed=fResponse->DriftSpeed();
Int_t na = fNanodes/2;
- Float_t driftpath=(timebin+1)*fTimeStep*speed;
+ Float_t driftpath=(timebin+0.5)*fTimeStep*fDriftSpeed;
if (anode >= na) x=(fDx-driftpath)/kconv;
else x = -(fDx-driftpath)/kconv;
if (anode >= na) anode-=na;
- z=((anode+1)*fPitch-fDz/2)/kconv;
+ z=((anode+0.5)*fPitch-fDz/2)/kconv;
}
//----------------------------------------------------------------------
const Float_t kconv=10000; // cm->um
Float_t x0=x;
- Float_t speed=fResponse->DriftSpeed();
Int_t na = fNanodes/2;
Float_t driftpath=fDx-TMath::Abs(kconv*x);
- x=driftpath/speed/fTimeStep;
+ x=driftpath/fDriftSpeed/fTimeStep;
z=kconv*z/fPitch + (float)na/2;
if (x0 < 0) x = -x;
dz = -0.5*kconv*Dz(); // lower left edge in cm.
if(x<dx || x>-dx) return; // outside of defined volume.
if(z<dz || z>-dz) return; // outside of defined volume.
- tb = fResponse->DriftSpeed()*fTimeStep*kconv; // compute size of time bin.
+ tb = fDriftSpeed*fTimeStep*kconv; // compute size of time bin.
if(x>0) dx = -(dx + x)/tb; // distance from + side in time bin units
else dx = (x - dx)/tb; // distance from - side in time bin units
dz = (z - dz)/(kconv*fPitch); // distance in z in anode pitch units
z = -0.5*kconv*Dz(); // default value.
if(ix<0 || ix>=Npx()) return; // outside of detector
if(iz<0 || iz>=Npz()) return; // outside of detctor
- tb = fResponse->DriftSpeed()*fTimeStep*kconv; // compute size of time bin.
+ tb = fDriftSpeed*fTimeStep*kconv; // compute size of time bin.
if(iz>=Npz()/2) tb *= -1.0; // for +x side decrement frmo Dx().
for(i=0;i<ix;i++) x += tb; // sum up to cell ix-1
x += 0.5*tb; // add 1/2 of cell ix for center location.
AliITSsegmentationSDD();
AliITSsegmentationSDD(AliITSgeom *gm, AliITSresponse *resp);
- AliITSsegmentationSDD(AliITSsegmentationSDD &source);
virtual ~AliITSsegmentationSDD(){}
- AliITSsegmentationSDD& operator=(AliITSsegmentationSDD &source);
// Set Detector Segmentation Parameters
//
// Detector size : x,z,y
- virtual void SetDetSize
- (Float_t p1=35000., Float_t p2=75264., Float_t p3= 300.)
+ virtual void SetDetSize
+ (Float_t p1=35085., Float_t p2=75264., Float_t p3= 300.)
{fDx=p1; fDz=p2; fDy=p3;}
// Cell size dz*dx
// Get member data
//
// Detector type geometry
- virtual AliITSgeom* Geometry() {return fGeom;}
+ AliITSgeom* Geometry() {return fGeom;}
// Detector length
virtual Float_t Dx() {return fDx;}
// Detector drift distance or detector active area half width
// Print Parameters
virtual void Print();
+ private:
+
+ AliITSsegmentationSDD(AliITSsegmentationSDD &source);
+ AliITSsegmentationSDD& operator=(AliITSsegmentationSDD &source);
+
protected:
Int_t fNsamples; // Number of time samples in x
Float_t fDx; // Drift distance of the 1/2detector (x axis)-microns
Float_t fDz; // Length of half-detector (z axis) - microns
Float_t fDy; // Full thickness of the detector (y axis) - microns
+ Float_t fDriftSpeed; // Drift speed
AliITSgeom *fGeom; //! pointer to the geometry class
- AliITSresponse *fResponse; // pointer to the response class
-
TF1* fCorr; // correction function
- ClassDef(AliITSsegmentationSDD,1) // SDD segmentation
+ ClassDef(AliITSsegmentationSDD,2) // SDD segmentation
};
#endif
Float_t contrib=0;
- TRandom random;
Int_t i,k,kk;
Float_t maxadc = fResponse->MaxAdc();
if (read && i<fNofMaps) GetAnodeBaseline(i,baseline,noise);
for(k=0; k<fScaleSize*fMaxNofSamples; k++) {
fInZR[k] = fHitMap2->GetSignal(i,k);
- contrib = (baseline + noise*random.Gaus());
+ contrib = (baseline + noise*gRandom->Gaus());
fInZR[k] += contrib;
}
for(k=0; k<fMaxNofSamples; k++) {
if (read && i<fNofMaps) GetAnodeBaseline(i,baseline,noise);
for(k=0; k<fScaleSize*fMaxNofSamples; k++) {
fInZR[k] = fHitMap2->GetSignal(i,k);
- contrib = (baseline + noise*random.Gaus());
+ contrib = (baseline + noise*gRandom->Gaus());
fInZR[k] += contrib;
fInZI[k] = 0.;
}
Int_t lasttrack=-2;
Int_t hit, iZi, jz, jx;
//cout<<"SPD: module,nhits ="<<module<<","<<nhits<<endl;
+ Int_t idhit=-1;
for (hit=0;hit<nhits;hit++) {
AliITShit *iHit = (AliITShit*) fHits->At(hit);
Int_t layer = iHit->GetLayer();
Float_t yPix0 = -73;
if(layer == 1) yPix0 = -77;
- // work with the idtrack=entry number in the TreeH
- Int_t idhit,idtrack;
- mod->GetHitTrackAndHitIndex(hit,idtrack,idhit);
- //Int_t idtrack=mod->GetHitTrackIndex(hit);
- // or store straight away the particle position in the array
- // of particles :
-
- //b.b. if(iHit->StatusEntering()) idhit=hit;
+ if(iHit->StatusEntering()) idhit=hit;
Int_t itrack = iHit->GetTrack();
Int_t dray = 0;
AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
- TRandom *random = new TRandom();
Float_t threshold = (float)fResponse->MinVal();
Int_t digits[3], tracks[3], hits[3],gi,j1;
Float_t signal,phys;
for(Int_t iz=0;iz<fNPixelsZ;iz++){
for(Int_t ix=0;ix<fNPixelsX;ix++){
- electronics = fBaseline + fNoise*random->Gaus();
+ electronics = fBaseline + fNoise*gRandom->Gaus();
signal = (float)fMapA2->GetSignal(iz,ix);
signal += electronics;
gi =iz*fNPixelsX+ix; // global index
printf("SPD - create histograms\n");
fHis=new TObjArray(fNPixelsZ);
- TString spdName("spd_");
for (Int_t i=0;i<fNPixelsZ;i++) {
+ TString spdName("spd_");
Char_t pixelz[4];
sprintf(pixelz,"%d",i+1);
spdName.Append(pixelz);
//
fNPixelsZ=fSegmentation->Npz();
fNPixelsX=fSegmentation->Npx();
-
+ fHis=0;
}
//_____________________________________________________________________________
if (!nhits) return;
- printf("Module %d (%d hits) \n",module+1,nhits);
+ //printf("Module %d (%d hits) \n",module+1,nhits);
Int_t number=10000;
// check if the deposited energy in a pixel is above the threshold
Float_t signal = (Float_t) fMapA2->GetSignal(r,c);
+ gi =r*fNPixelsX+c; // global index
if ( signal > fThresh) {
digits[0] = r-1; // digits starts from 0
- digits[1] = c-1; // digits starts from 0
- //digits[2] = 1;
- signal = signal*1.0e9; //signal in eV
- digits[2] = (Int_t) signal; // the signal is stored in eV
- gi =r*fNPixelsX+c; // global index
+ digits[1] = c-1; // digits starts from 0
+ //digits[2] = 1;
+ signal = signal*1.0e9; //signal in eV
+ digits[2] = (Int_t) signal; // the signal is stored in eV
for(j1=0;j1<3;j1++){
- tracks[j1] = (Int_t)(*(pList[gi]+j1));
- hits[j1] = (Int_t)(*(pList[gi]+j1+6));
- charges[j1] = 0;
- }
+ tracks[j1] = (Int_t)(*(pList[gi]+j1));
+ hits[j1] = (Int_t)(*(pList[gi]+j1+6));
+ charges[j1] = 0;
+ }
/* debug
printf("digits %d %d %d\n",digits[0],digits[1],digits[2]); //debug
printf("tracks %d %d %d\n",tracks[0],tracks[1],tracks[2]); //debug
printf("hits %d %d %d\n",hits[0],hits[1],hits[2]); //debug
*/
Float_t phys = 0;
- aliITS->AddSimDigit(0,phys,digits,tracks,hits,charges);
- if(pList[gi]) delete [] pList[gi];
- }//endif of threshold condition
+ aliITS->AddSimDigit(0,phys,digits,tracks,hits,charges);
+ }//endif of threshold condition
+ if(pList[gi]) delete [] pList[gi];
}
}// enddo on pixels
}
//End_Html
- TRandom random;
Double_t signal;
Int_t iz,ix;
for(iz=1;iz<=fNPixelsZ;iz++){
for(ix=1;ix<=fNPixelsX;ix++){
- signal = fSigma*random.Gaus();
+ signal = fSigma*gRandom->Gaus();
fMapA2->SetHit(iz,ix,signal);
// insert in the label-signal-hit list the pixels fired only by noise
// CreateHistograms
Int_t i;
+ fHis=new TObjArray(fNPixelsZ);
for(i=0;i<fNPixelsZ;i++) {
TString spdname("spd_");
Char_t candnum[4];