noise values).
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
+/*
+ $Id$
+ $Log$
+ */
+
#include <iostream.h>
#include <TFile.h>
#include <TMath.h>
fCutAmplitude = 0;
SetDAnode();
SetDTime();
- SetMinPeak();
+ SetMinPeak((Int_t)(((AliITSresponseSDD*)fResponse)->GetNoiseAfterElectronics()*5));
SetMinNCells();
SetMaxNCells();
SetTimeCorr();
Int_t i,j;
// search peaks
for( Int_t z=1; z<zdim-1; z++ ){
- for( Int_t x=2; x<xdim-3; x++ ){
+ for( Int_t x=1; x<xdim-2; x++ ){
Float_t sxz = spect[x*zdim+z];
Float_t sxz1 = spect[(x+1)*zdim+z];
Float_t sxz2 = spect[(x-1)*zdim+z];
// clusterJ->PrintInfo();
Float_t *par = new Float_t[npeak*5+1];
par[0] = (Float_t)npeak;
- // Initial paramiters in cell dimentions
+ // Initial parameters in cell dimentions
Int_t k1 = 1;
for( i=0; i<npeak; i++ ){
par[k1] = peakAmp1[i];
newiTimef *= fTimeStep;
if( newiTimef > fTimeCorr ) newiTimef -= fTimeCorr;
if( electronics == 1 ){
- newiTimef *= 0.999438; // PASCAL
- newiTimef += (6./fDriftSpeed - newiTimef/3000.);
+ // newiTimef *= 0.999438; // PASCAL
+ // newiTimef += (6./fDriftSpeed - newiTimef/3000.);
}else if( electronics == 2 )
newiTimef *= 0.99714; // OLA
Float_t driftPath = fSddLength - newiTimef * fDriftSpeed;
clusterI.SetAsigma( sigma[i]*anodePitch );
clusterI.SetTsigma( tau[i]*fTimeStep );
clusterI.SetQ( integral[i] );
- // clusterI.PrintInfo();
+ // clusterI.PrintInfo();
iTS->AddCluster( 1, &clusterI );
} // end for i
fClusters->RemoveAt( j );
delete [] par;
- } else {
+ } else { // something odd
+ cout << " --- Peak not found!!!! minpeak=" << fMinPeak<<
+ " cluster peak=" << clusterJ->PeakAmpl() <<
+ " module=" << fModule << endl;
clusterJ->PrintInfo();
- cout <<" --- Peak not found!!!! minpeak=" << fMinPeak<<
- " cluster peak=" << clusterJ->PeakAmpl() <<
- " npeak=" << npeak << endl << "xdim=" << xdim-2 << " zdim="
- << zdim-2 << endl << endl;
+ cout << " xdim=" << xdim-2 << " zdim=" << zdim-2 << endl << endl;
}
delete [] sp;
} // cluster loop
////////////////////////////////////////////////
// ITS Cluster Finder Class //
////////////////////////////////////////////////
-
+/*
+ $Id$
+*/
#include "AliITSClusterFinder.h"
class AliITSClusterFinderSDD : public AliITSClusterFinder{
public:
-
- AliITSClusterFinderSDD(AliITSsegmentation *seg,AliITSresponse *response,
- TClonesArray *digits,TClonesArray *recpoints);
+ AliITSClusterFinderSDD
+ (AliITSsegmentation *seg,AliITSresponse *response,
+ TClonesArray *digits,TClonesArray *recpoints);
AliITSClusterFinderSDD();
virtual ~AliITSClusterFinderSDD();
fMaxNCells=maxc;}
virtual Int_t MaxNCells() {// get MaxNCells
return fMaxNCells;}
- virtual void SetTimeCorr(Float_t timec=23.) {// setNCells
+ virtual void SetTimeCorr(Float_t timec=19.3) {// setNCells
fTimeCorr=timec;}
virtual Float_t TimeCorr() {// get Time Correction (ns)
return fTimeCorr;}
void GroupClusters();
void SelectClusters();
void GetRecPoints();
- void ResolveClusters(); // Boris........
- void ResolveClustersE(); // Ernesto
- Int_t SearchPeak(Float_t *spect,Int_t xdim,Int_t zdim,Int_t *peakX, Int_t
- *peakZ, Float_t *peakAmp, Float_t minpeak ); // Ernesto
- Int_t NoLinearFit(Int_t xdim,Int_t zdim,Float_t *param,Float_t *spe,
- Int_t *niter, Float_t *chir );
- void Minim( Int_t xdim, Int_t zdim, Float_t *param, Float_t *prm0,
- Float_t *steprm,Float_t *chisqr,Float_t *spe,Float_t *speFit );
+ void ResolveClusters(); // Boris........
+ void ResolveClustersE(); // Ernesto
+ Int_t SearchPeak(Float_t *spect,Int_t xdim,Int_t zdim,Int_t *peakX,
+ Int_t *peakZ,Float_t *peakAmp,Float_t minpeak); // Ernesto
+ Int_t NoLinearFit( Int_t xdim, Int_t zdim, Float_t *param, Float_t *spe,
+ Int_t *niter, Float_t *chir );
+ void Minim( Int_t xdim, Int_t zdim, Float_t *param, Float_t *prm0,
+ Float_t *steprm, Float_t *chisqr,Float_t *spe,Float_t *speFit);
Float_t ChiSqr( Int_t xdim, Int_t zdim, Float_t *spe, Float_t *speFit );
- void PeakFunc( Int_t xdim, Int_t zdim, Float_t *par, Float_t *spe, Float_t
- *Integral=0 );
- void Print();
+ void PeakFunc( Int_t xdim, Int_t zdim, Float_t *par, Float_t *spe,
+ Float_t *Integral=0 );
+ void Print();
private:
AliITSClusterFinderSDD(const AliITSClusterFinderSDD &source); // copy ctor
AliITSClusterFinderSDD& operator=(const AliITSClusterFinderSDD &source);
-
private:
Int_t fModule; //! ITS current module
TClonesArray *fClusters; //! clusters
Int_t fMaxNCells; //! max num of cells
ClassDef(AliITSClusterFinderSDD,1) // SDD clustering - Piergiorgio C. algo
-
-};
+ };
#endif
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
-
+
+/*
+$Log$
+*/
#include <iostream.h>
#include <TMath.h>
#include <TString.h>
fT0 = 0.;
fDf = ppower(10,9)/(kMaxNofSamples*fSamplingTime);
- fA0 = 16500.; // AL: 16500.; // TB: 24000.; // 26000.; // 24000.; // 18000.;
- if(amplif == 2) fA0 = 24000.;
-// cout << "fA0: " << fA0 << endl;
-// cout << "fTimeDelay: " << fTimeDelay << endl;
Int_t i,j;
for(i=0; i<kMaxNofPoles; i++) {
fZeroM[i] = 0.;
}
// Alice
- fPoleM[0] = 1.;
- fPoleR[0] = -4140000.; // AL: -4140000.; // TB: -3000000.; // -3750000.; // -3500000; // -3000000.;
- fPoleI[0] = 0.; // AL: 0.; // TB: 4000000.; // 3750000.; // 3500000.; // 3000000.;
- if(amplif == 2) {
+ // PASCAL amplif
+ fA0 = 5.53269815e+11;
+ fPoleM[0] = 3.;
+ fPoleR[0] = -8280000.;
+ fPoleI[0] = 0.;
+
+ if(amplif == 2) { // OLA amplif.
+ fA0 = 24000.;
+ fPoleM[0] = 1.;
fPoleR[0] = -3000000.;
fPoleI[0] = 4000000.;
+ fPoleM[1] = 1.;
+ fPoleR[1] = fPoleR[0];
+ fPoleI[1] = -fPoleI[0];
}
- fPoleM[1] = 1.;
- fPoleR[1] = fPoleR[0];
- fPoleI[1] = -fPoleI[0];
+ if( amplif == 3 ) { // old PASCAL
+ fA0 = 16500.; // AL: 16500.; // TB: 24000.; // 26000.; // 24000.; // 18000.;
+ fPoleM[0] = 1.;
+ fPoleR[0] = -4140000.; // AL: -4140000.; // TB: -3000000.; // -3750000.; // -3500000; // -3000000.;
+ fPoleI[0] = 0.; // AL: 0.; // TB: 4000000.; // 3750000.; // 3500000.; // 3000000.;
+ fPoleM[1] = 1.;
+ fPoleR[1] = fPoleR[0];
+ fPoleI[1] = -fPoleI[0];
+ }
+
+ //cout << "fA0: " << fA0 << endl;
+ //cout << "fTimeDelay: " << fTimeDelay << endl;
+
// Compute Transfer Function
Double_t PI = acos(-1.);
#define ITSETFSDD_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-
+/*
+$Log$
+*/
#include <TObject.h>
static const Int_t kMaxNofPoles = 5;
Float_t GetTimeDelay() { return fTimeDelay; }
void PrintElectronics(); // Print Electronics parameters
- private:
+ protected:
Float_t fTimeDelay; // Time delay caused by the amplifier shaping
Double_t fSamplingTime; //
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
+/*
+$Id$
+$Log$
+*/
#include <TString.h>
#include <TRandom.h>
#include "AliITSresponseSDD.h"
-//___________________________________________
-ClassImp(AliITSresponseSDD)
+//______________________________________________________________________
+ClassImp(AliITSresponseSDD)
-AliITSresponseSDD::AliITSresponseSDD()
-{
+AliITSresponseSDD::AliITSresponseSDD(){
// default constructor
fGaus = 0;
SetDeadChannels();
// SetClock();
SetNoiseParam();
SetNoiseAfterElectronics();
+ SetJitterError();
SetElectronics();
SetDynamicRange();
SetChargeLoss();
// set the default zero suppression parameters
fCPar[0]=0;
fCPar[1]=0;
- fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.2);
- fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.2);
+ fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
+ fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
fCPar[4]=0;
fCPar[5]=0;
fCPar[6]=0;
fCPar[7]=0;
}
-
-AliITSresponseSDD::AliITSresponseSDD(const char *dataType)
-{
+//______________________________________________________________________
+AliITSresponseSDD::AliITSresponseSDD(const char *dataType){
// constructor
fGaus = 0;
SetDeadChannels();
// SetClock();
SetNoiseParam();
SetNoiseAfterElectronics();
+ SetJitterError();
SetElectronics();
SetDynamicRange();
SetChargeLoss();
// set the default zero suppression parameters
fCPar[0]=0;
fCPar[1]=0;
- fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.2);
- fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.2);
+ fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
+ fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.5);
fCPar[4]=0;
fCPar[5]=0;
fCPar[6]=0;
fCPar[7]=0;
}
-
+//______________________________________________________________________
AliITSresponseSDD::~AliITSresponseSDD() {
if(fGaus) delete fGaus;
-
}
-
-void AliITSresponseSDD::SetCompressParam(Int_t cp[8])
-{
+//______________________________________________________________________
+void AliITSresponseSDD::SetCompressParam(Int_t cp[8]){
// set compression param
Int_t i;
for (i=0; i<8; i++) {
fCPar[i]=cp[i];
- //printf("\n CompressPar %d %d \n",i,fCPar[i]);
-
- }
+ //printf("\n CompressPar %d %d \n",i,fCPar[i]);
+ } // end for i
}
-
-void AliITSresponseSDD::GiveCompressParam(Int_t cp[8])
-{
+//______________________________________________________________________
+void AliITSresponseSDD::GiveCompressParam(Int_t cp[8]){
// give compression param
Int_t i;
for (i=0; i<8; i++) {
cp[i]=fCPar[i];
- }
+ } // end for i
}
-
-void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan)
-{
+//______________________________________________________________________
+void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan){
// Set fGain to zero to simulate a random distribution of
// dead modules, dead chips and single dead channels
chip_mod[i-1] = module;
for( Int_t m=0; m<fChannels; m++ )
fGain[module-1][chi-1][m] = 0.;
- cout << i << ": Dead chip nr. " << chip[i-1] << " in module nr: " << chip_mod[i-1] << endl;
+ cout << i << ": Dead chip nr. " << chip[i-1] << " in module nr: "
+ << chip_mod[i-1] << endl;
}
// cout << "channels" << endl;
if( module == mod[k] ) { flag_mod = 1; break; }
if( flag_mod == 1 ) continue;
Int_t chipp = (Int_t) (fChips*gran->Uniform() + 1.);
- if( chipp <=0 || chipp > fChips ) cout << "Wrong chip: " << chipp << endl;
+ if( chipp <=0 || chipp > fChips ) cout << "Wrong chip: "<< chipp<<endl;
Int_t flag_chip = 0;
for( k=0; k<nchip; k++)
- if( chipp == chip[k] && module == chip_mod[k] ) { flag_chip = 1; break; }
+ if( chipp == chip[k] && module == chip_mod[k] ) {
+ flag_chip = 1; break; }
if( flag_chip == 1 ) continue;
i++;
channel[i-1] = (Int_t) (fChannels*gran->Uniform() + 1.);
channel_chip[i-1] = chipp;
channel_mod[i-1] = module;
fGain[module-1][chipp-1][channel[i-1]-1] = 0.;
- cout << i << ": Dead channel nr. " << channel[i-1] << " in chip nr. " << channel_chip[i-1] << " in module nr: " << channel_mod[i-1] << endl;
+ cout << i << ": Dead channel nr. " << channel[i-1] << " in chip nr. "
+ << channel_chip[i-1] << " in module nr: " << channel_mod[i-1]
+ << endl;
}
delete [] mod;
delete [] channel_mod;
delete [] channel_chip;
}
+//______________________________________________________________________
+void AliITSresponseSDD::PrintGains(){
+ //
-void AliITSresponseSDD::PrintGains()
-{
- // Print Electronics Gains
+ if( GetDeadModules() == 0 &&
+ GetDeadChips() == 0 &&
+ GetDeadChannels() == 0 )
+ return;
+
+ // Print Electronics Gains
cout << "**************************************************" << endl;
cout << " Print Electronics Gains " << endl;
cout << "**************************************************" << endl;
-// FILE *f = fopen( "gains.txt", "w" );
-// fprintf( f, " Module Chip Channel Gain\n" );
-
// Print SDD electronic gains
for(Int_t t=0; t<fModules;t++)
for(Int_t u=0; u<fChips;u++)
for(Int_t v=0; v<fChannels;v++)
{
- cout << "Gain for Module: " << t+1 << ", Chip " << u+1 << ", Channel " << v+1 << " = " << fGain[t][u][v] << endl;
-// if( fGain[t][u][v] != 1.0 )
-// fprintf( f, " %8d %8d %8d %f\n", t+1, u+1, v+1, fGain[t][u][v] );
+ if( fGain[t][u][v] != 1.0 )
+ cout << "Gain for Module: " << t+1 << ", Chip " << u+1 <<
+ ", Channel " << v+1 << " = " << fGain[t][u][v] << endl;
}
-// fclose( f );
}
-
-void AliITSresponseSDD::Print()
-{
+//______________________________________________________________________
+void AliITSresponseSDD::Print(){
// Print SDD response Parameters
cout << "**************************************************" << endl;
cout << " Silicon Drift Detector Response Parameters " << endl;
cout << "**************************************************" << endl;
- cout << "Diffusion Coefficients: " << fDiffCoeff << ", " << fDiffCoeff1 << endl;
+ cout << "Diffusion Coefficients: "<< fDiffCoeff<< ", "<<fDiffCoeff1 << endl;
cout << "Hardware compression parameters: " << endl;
- for(Int_t i=0; i<8; i++) cout << "fCPar[" << i << "] = " << fCPar[i] << endl;
+ for(Int_t i=0; i<8; i++) cout << "fCPar[" << i << "] = " << fCPar[i] <<endl;
cout << "Noise before electronics (arbitrary units): " << fNoise << endl;
cout << "Baseline (ADC units): " << fBaseline << endl;
cout << "Noise after electronics (ADC units): " << fNoiseAfterEl << endl;
#ifndef ALIITSRESPONSESDD_H
#define ALIITSRESPONSESDD_H
-
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/*
+ $Id$
+*/
#include "TArrayF.h"
#include <TString.h>
#include <iostream.h>
// response for SDD
-class AliITSresponseSDD :
- public AliITSresponse {
-public:
+class AliITSresponseSDD : public AliITSresponse {
+ public:
//
// Configuration methods
//
- AliITSresponseSDD();
- AliITSresponseSDD(const char *dataType);
-
- virtual ~AliITSresponseSDD();
+ AliITSresponseSDD();
+ AliITSresponseSDD(const char *dataType);
+ virtual ~AliITSresponseSDD();
- void SetElectronics(Int_t p1=1) {
- // Electronics: Pascal (1) or OLA (2)
- fElectronics=p1;
- }
-
- Int_t Electronics() {
- // Electronics: 1 = Pascal; 2 = OLA
- return fElectronics;
- }
-
- void SetMaxAdc(Float_t p1=1024.) {
- // Adc-count saturation value
- fMaxAdc=p1;
- }
- Float_t MaxAdc() {
- // Get maximum Adc-count value
- return fMaxAdc;
- }
-
- void SetChargeLoss(Float_t p1=0.0) {
- // Set Linear Charge Loss Steepness // 0.01 for 20%
- fChargeLoss=p1;
- }
- Float_t ChargeLoss() {
- // Get Charge Loss Coefficient
- return fChargeLoss;
- }
-
- void SetDynamicRange(Float_t p1=132.) {
- // Set Dynamic Range
- fDynamicRange=p1;
- }
- Float_t DynamicRange() {
- // Get Dynamic Range
- return fDynamicRange;
- }
-
- void SetDiffCoeff(Float_t p1=3.23,Float_t p2=30.) {
- // Diffusion coefficients
- fDiffCoeff=p1;
- fDiffCoeff1=p2;
- }
- void DiffCoeff(Float_t&diff,Float_t&diff1) {
- // Get diffusion coefficients
- diff = fDiffCoeff;
- diff1 = fDiffCoeff1;
- }
-
- void SetDriftSpeed(Float_t p1=7.3) {
- // Drift velocity
- fDriftSpeed=p1;
- }
- Float_t DriftSpeed() {
- // drift speed
- return fDriftSpeed;
- }
-
- void SetTemperature(Float_t p1=23.) {
- // Temperature
- fTemperature=p1;
- }
- Float_t Temperature() {
- // Get temperature
- return fTemperature;
- }
-
- void SetDataType(const char *data="simulated") {
- // Type of data - real or simulated
- fDataType=data;
- }
- const char *DataType() const {
- // Get data type
- return fDataType.Data();
- }
-
- void SetParamOptions(const char *opt1="same",const char *opt2="same"){
- // Parameters: "same" or read from "file"
- fParam1=opt1; fParam2=opt2;
- }
- void ParamOptions(char *opt1,char *opt2) {
- // options
- strcpy(opt1,fParam1.Data()); strcpy(opt2,fParam2.Data());
- }
-
- void SetNoiseParam(Float_t n=0., Float_t b=20.){
- // Noise and baseline // 8.3 for ALICE with beam test measurements
- fNoise=n; fBaseline=b;
- }
- void SetNoiseAfterElectronics(Float_t n=0.){
- // Noise after electronics (ADC units) // 1.6 for ALICE from beam test measurements
- fNoiseAfterEl=n;
- }
- void GetNoiseParam(Float_t &n, Float_t &b) {
- // get noise param
- n=fNoise; b=fBaseline;
- }
- Float_t GetNoiseAfterElectronics(){
- // Noise after electronics (ADC units)
- return fNoiseAfterEl;
- }
-
- void SetDo10to8(Bool_t bitcomp=kTRUE) {
- // set the option for 10 to 8 bit compression
- fBitComp = bitcomp;
- }
-
- Bool_t Do10to8() {
- // get 10 to 8 compression option
- return fBitComp;
- }
-
- void SetZeroSupp (const char *opt="1D") {
- // Zero-suppression option - could be 1D, 2D or non-ZS
- fOption=opt;
- }
- const char *ZeroSuppOption() const {
- // Get zero-suppression option
- return fOption.Data();
- }
- void SetMinVal(Int_t mv=4) {
- // Min value used in 2D - could be used as a threshold setting
- fMinVal = mv;
- }
- Int_t MinVal() {
- // min val
- return fMinVal;
- }
-
- void SetFilenames(const char *f1="",const char *f2="",const char *f3="") {
- // Set filenames - input, output, parameters ....
- fFileName1=f1; fFileName2=f2; fFileName3=f3;
- }
- void Filenames(char *input,char *baseline,char *param) {
- // Filenames
- strcpy(input,fFileName1.Data()); strcpy(baseline,fFileName2.Data());
- strcpy(param,fFileName3.Data());
- }
-
-
- void SetOutputOption(Bool_t write=kFALSE) {
- // set output option
- fWrite = write;
- }
- Bool_t OutputOption() {
- // output option
- return fWrite;
- }
- //
- // Compression parameters
- void SetCompressParam(Int_t cp[8]);
- void GiveCompressParam(Int_t *x);
-
- //
- // Detector type response methods
- void SetNSigmaIntegration(Float_t p1=3.) {
- // Set number of sigmas over which cluster disintegration is performed
- fNsigmas=p1;
- }
- Float_t NSigmaIntegration() {
- // Get number of sigmas over which cluster disintegration is performed
- return fNsigmas;
- }
- void SetNLookUp(Int_t p1=121) {
- // Set number of sigmas over which cluster disintegration is performed
- fNcomps=p1;
- fGaus = new TArrayF(fNcomps+1);
- for(Int_t i=0; i<=fNcomps; i++) {
- Float_t x = -fNsigmas + (2.*i*fNsigmas)/(fNcomps-1);
- (*fGaus)[i] = exp(-((x*x)/2));
- // cout << "fGaus[" << i << "]: " << fGaus->At(i) << endl;
+ void SetElectronics(Int_t p1=1) {// Electronics: Pascal (1) or OLA (2)
+ fElectronics=p1;}
+ Int_t Electronics() {// Electronics: 1 = Pascal; 2 = OLA
+ return fElectronics;}
+ void SetMaxAdc(Float_t p1=1024.) {// Adc-count saturation value
+ fMaxAdc=p1;}
+ Float_t MaxAdc() {// Get maximum Adc-count value
+ return fMaxAdc;}
+ void SetChargeLoss(Float_t p1=0.0) {
+ // Set Linear Charge Loss Steepness // 0.01 for 20%
+ fChargeLoss=p1;}
+ Float_t ChargeLoss(){// Get Charge Loss Coefficient
+ return fChargeLoss;}
+ void SetDynamicRange(Float_t p1=132.) {// Set Dynamic Range
+ fDynamicRange=p1;}
+ Float_t DynamicRange(){// Get Dynamic Range
+ return fDynamicRange;}
+ void SetDiffCoeff(Float_t p1=3.23,Float_t p2=30.) {
+ // Diffusion coefficients
+ fDiffCoeff=p1;fDiffCoeff1=p2;}
+ void DiffCoeff(Float_t&diff,Float_t&diff1) {// Get diffusion coefficients
+ diff = fDiffCoeff;diff1 = fDiffCoeff1;}
+ void SetDriftSpeed(Float_t p1=7.3) {// Drift velocity
+ fDriftSpeed=p1;}
+ Float_t DriftSpeed() {// drift speed
+ return fDriftSpeed;}
+ void SetTemperature(Float_t p1=23.) {// Temperature
+ fTemperature=p1;}
+ Float_t Temperature() {// Get temperature
+ return fTemperature;}
+ void SetDataType(const char *data="simulated") {
+ // Type of data - real or simulated
+ fDataType=data;}
+ const char *DataType() const {// Get data type
+ return fDataType.Data();}
+ void SetParamOptions(const char *opt1="same",const char *opt2="same"){
+ // Parameters: "same" or read from "file"
+ fParam1=opt1; fParam2=opt2;}
+ void ParamOptions(char *opt1,char *opt2) {// options
+ strcpy(opt1,fParam1.Data()); strcpy(opt2,fParam2.Data());}
+ void SetNoiseParam(Float_t n=10., Float_t b=20.){
+ // Noise and baseline // 10 for ALICE with beam test measurements 2001
+ fNoise=n; fBaseline=b;}
+ void SetNoiseAfterElectronics(Float_t n=2.38){
+ // Noise after electronics (ADC units)
+ // 2.36 for ALICE from beam test measurements 2001
+ fNoiseAfterEl=n;}
+ void GetNoiseParam(Float_t &n, Float_t &b) {// get noise param
+ n=fNoise; b=fBaseline;}
+ Float_t GetNoiseAfterElectronics(){
+ // Noise after electronics (ADC units)
+ return fNoiseAfterEl;}
+ void SetJitterError(Float_t jitter=20) {
+ // set Jitter error (20 um for ALICE from beam test measurements 2001)
+ fJitterError=jitter;}
+ Float_t JitterError() {// set Jitter error
+ return fJitterError;}
+ void SetDo10to8(Bool_t bitcomp=kTRUE) {
+ // set the option for 10 to 8 bit compression
+ fBitComp = bitcomp;}
+ Bool_t Do10to8() {// get 10 to 8 compression option
+ return fBitComp;}
+ void SetZeroSupp (const char *opt="1D") {
+ // Zero-suppression option - could be 1D, 2D or non-ZS
+ fOption=opt;}
+ const char *ZeroSuppOption() const {// Get zero-suppression option
+ return fOption.Data();}
+ void SetMinVal(Int_t mv=4) {
+ // Min value used in 2D - could be used as a threshold setting
+ fMinVal = mv;}
+ Int_t MinVal() {// min val
+ return fMinVal;}
+ void SetFilenames(const char *f1="",const char *f2="",const char *f3=""){
+ // Set filenames - input, output, parameters ....
+ fFileName1=f1; fFileName2=f2; fFileName3=f3;}
+ void Filenames(char *input,char *baseline,char *param) {// Filenames
+ strcpy(input,fFileName1.Data()); strcpy(baseline,fFileName2.Data());
+ strcpy(param,fFileName3.Data());}
+ void SetOutputOption(Bool_t write=kFALSE) {// set output option
+ fWrite = write;}
+ Bool_t OutputOption() {// output option
+ return fWrite;}
+ //
+ // Compression parameters
+ void SetCompressParam(Int_t cp[8]);
+ void GiveCompressParam(Int_t *x);
+ //
+ // Detector type response methods
+ void SetNSigmaIntegration(Float_t p1=3.) {
+ // Set number of sigmas over which cluster disintegration is performed
+ fNsigmas=p1;}
+ Float_t NSigmaIntegration() {
+ // Get number of sigmas over which cluster disintegration is performed
+ return fNsigmas;}
+ void SetNLookUp(Int_t p1=121) {
+ // Set number of sigmas over which cluster disintegration is performed
+ fNcomps=p1;
+ fGaus = new TArrayF(fNcomps+1);
+ for(Int_t i=0; i<=fNcomps; i++) {
+ Float_t x = -fNsigmas + (2.*i*fNsigmas)/(fNcomps-1);
+ (*fGaus)[i] = exp(-((x*x)/2));
+ // cout << "fGaus[" << i << "]: " << fGaus->At(i) << endl;
+ }
}
- }
// Get number of intervals in which the gaussian lookup table is divided
- Int_t GausNLookUp() {return fNcomps;}
-
- Float_t IntPH(Float_t eloss) {
- // Pulse height from scored quantity (eloss)
- return 0.;
- }
- Float_t IntXZ(AliITSsegmentation *) {
- // Charge disintegration
- return 0.;
- }
- Float_t GausLookUp(Int_t i) {
- if(i<0 || i>=fNcomps) return 0.;
- return fGaus->At(i);
- }
- void SetDeadChannels(Int_t nmodules=0, Int_t nchips=0, Int_t nchannels=0);
-
- Int_t GetDeadModules() { return fDeadModules; }
- Int_t GetDeadChips() { return fDeadChips; }
- Int_t GetDeadChannels() { return fDeadChannels; }
- Float_t Gain( Int_t mod, Int_t chip, Int_t ch)
- { return fGain[mod][chip][ch]; }
-
- // these functions should be move to AliITSsegmentationSDD
- const Int_t Modules() const { return fModules; } // Total number of SDD modules
- const Int_t Chips() const { return fChips; } // Number of chips/module
- const Int_t Channels() const { return fChannels; } // Number of channels/chip
- //********
-
- void PrintGains();
- void Print();
-
-
-private:
+ Int_t GausNLookUp() {return fNcomps;}
+ Float_t IntPH(Float_t eloss) {// Pulse height from scored quantity (eloss)
+ return 0.;}
+ Float_t IntXZ(AliITSsegmentation *) {// Charge disintegration
+ return 0.;}
+ Float_t GausLookUp(Int_t i) {
+ if(i<0 || i>=fNcomps) return 0.;return fGaus->At(i);}
+ void SetDeadChannels(Int_t nmodules=0, Int_t nchips=0, Int_t nchannels=0);
+ Int_t GetDeadModules() { return fDeadModules; }
+ Int_t GetDeadChips() { return fDeadChips; }
+ Int_t GetDeadChannels() { return fDeadChannels; }
+ Float_t Gain(Int_t mod,Int_t chip,Int_t ch){return fGain[mod][chip][ch]; }
+ // these functions should be move to AliITSsegmentationSDD
+ const Int_t Modules() const{return fModules;}// Total number of SDD modules
+ const Int_t Chips() const{return fChips;} // Number of chips/module
+ const Int_t Channels() const { return fChannels;}// Number of channels/chip
+ //********
+ void PrintGains();
+ void Print();
- AliITSresponseSDD(const AliITSresponseSDD &source); // copy constructor
- AliITSresponseSDD& operator=(const AliITSresponseSDD &source); // ass. op.
-
-protected:
- // these statis const should be move to AliITSsegmentationSDD
- static const Int_t fModules = 520; // Total number of SDD modules
- static const Int_t fChips = 4; // Number of chips/module
- static const Int_t fChannels = 64; // Number of channels/chip
- //*******
-
- Int_t fDeadModules; // Total number of dead SDD modules
- Int_t fDeadChips; // Number of dead chips
- Int_t fDeadChannels; // Number of dead channels
- Float_t fGain[fModules][fChips][fChannels]; // Array for channel gains
+ private:
+ AliITSresponseSDD(const AliITSresponseSDD &source); // copy constructor
+ AliITSresponseSDD& operator=(const AliITSresponseSDD &source); // ass. op.
- Int_t fCPar[8]; // Hardware compression parameters
- Float_t fNoise; // Noise
- Float_t fBaseline; // Baseline
- Float_t fNoiseAfterEl; // Noise after electronics
- Float_t fDynamicRange; // Set Dynamic Range
- Float_t fChargeLoss; // Set Linear Coefficient for Charge Loss
- Float_t fTemperature; // Temperature
- Float_t fDriftSpeed; // Drift velocity
- Int_t fElectronics; // Electronics
-
- Float_t fMaxAdc; // Adc saturation value
- Float_t fDiffCoeff; // Diffusion Coefficient (scaling the time)
- Float_t fDiffCoeff1; // Diffusion Coefficient (constant term)
- Float_t fNsigmas; // Number of sigmas over which charge disintegration
- // is performed
- TArrayF *fGaus; // Gaussian lookup table for signal generation
- Int_t fNcomps; // Number of samplings along the gaussian
-
- Int_t fMinVal; // Min value used in 2D zero-suppression algo
-
- Bool_t fWrite; // Write option for the compression algorithms
- Bool_t fBitComp; // 10 to 8 bit compression option
+ protected:
+ // these statis const should be move to AliITSsegmentationSDD
+ static const Int_t fModules = 520; // Total number of SDD modules
+ static const Int_t fChips = 4; // Number of chips/module
+ static const Int_t fChannels = 64; // Number of channels/chip
+ //*******
+ Int_t fDeadModules; // Total number of dead SDD modules
+ Int_t fDeadChips; // Number of dead chips
+ Int_t fDeadChannels; // Number of dead channels
+ Float_t fGain[fModules][fChips][fChannels]; // Array for channel gains
+ Int_t fCPar[8]; // Hardware compression parameters
+ Float_t fNoise; // Noise
+ Float_t fBaseline; // Baseline
+ Float_t fNoiseAfterEl; // Noise after electronics
+ Float_t fJitterError; // jitter error
+ Float_t fDynamicRange; // Set Dynamic Range
+ Float_t fChargeLoss; // Set Linear Coefficient for Charge Loss
+ Float_t fTemperature; // Temperature
+ Float_t fDriftSpeed; // Drift velocity
+ Int_t fElectronics; // Electronics
+ Float_t fMaxAdc; // Adc saturation value
+ Float_t fDiffCoeff; // Diffusion Coefficient (scaling the time)
+ Float_t fDiffCoeff1; // Diffusion Coefficient (constant term)
+ Float_t fNsigmas; // Number of sigmas over which charge disintegration
+ // is performed
+ TArrayF *fGaus; // Gaussian lookup table for signal generation
+ Int_t fNcomps; // Number of samplings along the gaussian
+ Int_t fMinVal; // Min value used in 2D zero-suppression algo
+ Bool_t fWrite; // Write option for the compression algorithms
+ Bool_t fBitComp; // 10 to 8 bit compression option
+ TString fOption; // Zero-suppresion option (1D, 2D or none)
+ TString fParam1; // Read baselines from file option
+ TString fParam2; // Read compression algo thresholds from file
+ TString fDataType; // data type - real or simulated
+ TString fFileName1; // input keys : run, module #
+ TString fFileName2; // baseline & noise val or output code
+ // signal or monitored bgr.
+ TString fFileName3; // param values or output coded signal
- TString fOption; // Zero-suppresion option (1D, 2D or none)
- TString fParam1; // Read baselines from file option
- TString fParam2; // Read compression algo thresholds from file
-
- TString fDataType; // data type - real or simulated
- TString fFileName1; // input keys : run, module #
- TString fFileName2; // baseline & noise val or output coded // signal or monitored bgr.
- TString fFileName3; // param values or output coded signal
-
- ClassDef(AliITSresponseSDD,3) // SDD response
+ ClassDef(AliITSresponseSDD,2) // SDD response
};
#endif
-
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
+/*
+ $Id$
+ $Log$
+ */
#include <iostream.h>
#include <stdlib.h>
fHis = 0;
// fpList = 0;
fHitMap2 = 0;
+ fHitSigMap2 = 0;
+ fHitNoiMap2 = 0;
fElectronics = 0;
fStream = 0;
fInZR = 0;
fHis = 0;
// fpList = 0;
fHitMap2 = 0;
+ fHitSigMap2 = 0;
+ fHitNoiMap2 = 0;
fElectronics = 0;
fStream = 0;
fInZR = 0;
fpList = new AliITSpList( fSegmentation->Npz(),
fScaleSize*fSegmentation->Npx() );
- fHitMap2 = new AliITSMapA2(fSegmentation,fScaleSize,1);
+ fHitSigMap2 = new AliITSMapA2(fSegmentation,fScaleSize,1);
+ fHitNoiMap2 = new AliITSMapA2(fSegmentation,fScaleSize,1);
+ fHitMap2 = fHitSigMap2;
fNofMaps = fSegmentation->Npz();
fMaxNofSamples = fSegmentation->Npx();
// destructor
// delete fpList;
- delete fHitMap2;
+ delete fHitSigMap2;
+ delete fHitNoiMap2;
delete fStream;
delete fElectronics;
void AliITSsimulationSDD::ClearMaps() {
// clear maps
fpList->ClearMap();
- fHitMap2->ClearMap();
+ fHitSigMap2->ClearMap();
+ fHitNoiMap2->ClearMap();
}
//______________________________________________________________________
void AliITSsimulationSDD::SDigitiseModule( AliITSmodule *mod, Int_t md, Int_t ev){
InitSimulationModule( md, ev );
HitsToAnalogDigits( mod );
+ ChargeToSignal( kFALSE ); // - Process signal without add noise
+ fHitMap2 = fHitNoiMap2; // - Swap to noise map
+ ChargeToSignal( kTRUE ); // - Process only noise
+ fHitMap2 = fHitSigMap2; // - Return to signal map
WriteSDigits();
ClearMaps();
}
//______________________________________________________________________
-/*void AliITSsimulationSDD::AddSDigitsToModule( TClonesArray *pItemArray, Int_t mask ) {
+Bool_t AliITSsimulationSDD::AddSDigitsToModule( TClonesArray *pItemArray, Int_t mask ) {
// Add Summable digits to module maps.
- Int_t nItems = pItemArray->GetEntries();
-
+ Int_t nItems = pItemArray->GetEntries();
+ Double_t maxadc = fResponse->MaxAdc();
+ Bool_t sig = kFALSE;
+
// cout << "Adding "<< nItems <<" SDigits to module " << fModule << endl;
for( Int_t i=0; i<nItems; i++ ) {
AliITSpListItem * pItem = (AliITSpListItem *)(pItemArray->At( i ));
Error( "AliITSsimulationSDD",
"Error reading, SDigits module %d != current module %d: exit\n",
pItem->GetModule(), fModule );
- return;
+ return sig;
} // end if
-
- fpList->AddItemTo( mask, pItem );
+
+ if(pItem->GetSignal()>0.0 ) sig = kTRUE;
+ fpList->AddItemTo( mask, pItem ); // Add SignalAfterElect + noise
+ AliITSpListItem * pItem2 = fpList->GetpListItem( pItem->GetIndex() );
+ Double_t sigAE = pItem2->GetSignalAfterElect();
+ if( sigAE >= maxadc ) sigAE = maxadc-1; // avoid overflow signal
+ Int_t ia;
+ Int_t it;
+ fpList->GetMapIndex( pItem->GetIndex(), ia, it );
+ fHitMap2->SetHit( ia, it, sigAE );
}
-}*/
+ return sig;
+}
//______________________________________________________________________
void AliITSsimulationSDD::FinishSDigitiseModule() {
// digitize module using the "slow" detector simulator from
InitSimulationModule( md, ev );
if( !nhits && fCheckNoise ) {
- ChargeToSignal();
+ ChargeToSignal( kTRUE ); // process noise
GetNoise();
ClearMaps();
return;
} else
if( !nhits ) return;
+
HitsToAnalogDigits( mod );
+ ChargeToSignal( kTRUE ); // process signal + noise
+
+ for( Int_t i=0; i<fNofMaps; i++ ) {
+ for( Int_t j=0; j<fMaxNofSamples; j++ ) {
+ Int_t jdx = j*fScaleSize;
+ Int_t index = fpList->GetHitIndex( i, j );
+ AliITSpListItem pItemTmp2( fModule, index, 0. );
+ // put the fScaleSize analog digits in only one
+ for( Int_t ik=0; ik<fScaleSize; ik++ ) {
+ AliITSpListItem *pItemTmp = fpList->GetpListItem( i, jdx+ik );
+ if( pItemTmp == 0 ) continue;
+ pItemTmp2.Add( pItemTmp );
+ }
+ fpList->DeleteHit( i, j );
+ fpList->AddItemTo( 0, &pItemTmp2 );
+ }
+ }
+
FinishDigits();
ClearMaps();
}
void AliITSsimulationSDD::FinishDigits() {
// introduce the electronics effects and do zero-suppression if required
- // Fill maps from fpList.
- Int_t maxIndex = fpList->GetEntries();
- for(Int_t i=0;i<maxIndex;i++) fHitMap2->SetHit(i,fpList->GetSignal(i));
-
- ChargeToSignal();
ApplyDeadChannels();
if( fCrosstalkFlag ) ApplyCrosstalk();
Double_t eVpairs = 3.6; // electron pair energy eV.
Float_t nsigma = fResponse->NSigmaIntegration(); //
Int_t nlookups = fResponse->GausNLookUp(); //
+ Float_t jitter = ((AliITSresponseSDD*)fResponse)->JitterError(); //
// Piergiorgio's part (apart for few variables which I made float
// when i thought that can be done
for(ii=0; ii<nhits; ii++) {
if(!mod->LineSegmentL(ii,xL[0],dxL[0],xL[1],dxL[1],xL[2],dxL[2],
depEnergy,itrack)) continue;
+ xL[0] += 0.0001*gRandom->Gaus( 0, jitter ); //
depEnergy *= kconv;
hitDetector = mod->GetDet();
//tof = 1.E+09*(mod->GetHit(ii)->GetTOF()); // tof in ns.
timeAmplitude *= norm;
timeAmplitude *= 10;
// ListOfFiredCells(arg,timeAmplitude,alst,padr);
+ Double_t charge = timeAmplitude;
+ charge += fHitMap2->GetSignal(index,it-1);
+ fHitMap2->SetHit(index, it-1, charge);
fpList->AddSignal(index,it-1,itrack,ii-1,
mod->GetIndex(),timeAmplitude);
} // end if anodeAmplitude and loop over time in window
digits[1] = j;
digits[2] = signal;
- Int_t jdx = j*fScaleSize;
- AliITSpListItem pItem;
-
- // put the fScaleSize analog digits in only one
- for( Int_t ik=0; ik<fScaleSize; ik++ ) {
- AliITSpListItem* pItemTmp = fpList->GetpListItem( i, jdx+ik );
- if( pItemTmp == 0 ) continue;
- Double_t sig = 0.0;
- for( Int_t l=0; l<pItemTmp->GetNsignals(); l++ ) {
- Double_t signalT = pItemTmp->GetSignal( l );
- // if( signalT <= 0.0 ) break; // no more signals
- sig += signalT;
- Int_t track = pItemTmp->GetTrack( l );
- Int_t hit = pItemTmp->GetHit( l );
- pItem.AddSignal( track, hit, -1, -1, signalT );
+ AliITSpListItem *pItem = fpList->GetpListItem( i, j );
+ if( pItem == 0 ) {
+ phys = 0.0;
+ for( Int_t l=0; l<3; l++ ) {
+ tracks[l] = 0;
+ hits[l] = 0;
+ charges[l] = 0.0;
+ }
+ } else {
+ Int_t idtrack = pItem->GetTrack( 0 );
+ if( idtrack >= 0 ) phys = pItem->GetSignal();
+ else phys = 0.0;
+
+ for( Int_t l=0; l<3; l++ ) {
+ tracks[l] = pItem->GetTrack( l );
+ hits[l] = pItem->GetHit( l );
+ charges[l] = pItem->GetSignal( l );
}
- // add to noise : total signal - sum of signal tracks
- pItem.AddNoise( -1, -1, pItemTmp->GetSignal() - sig );
- }
-
- Int_t idtrack = pItem.GetTrack( 0 );
- if( idtrack >= 0 ) phys = pItem.GetSumSignal();
- else phys = 0;
-
- for( Int_t l=0; l<3; l++ ) {
- tracks[l] = pItem.GetTrack( l );
- hits[l] = pItem.GetHit( l );
- charges[l] = pItem.GetSignal( l );
}
fITS->AddSimDigit( 1, phys, digits, tracks, hits, charges );
}
*/
//______________________________________________________________________
-void AliITSsimulationSDD::ChargeToSignal() {
+void AliITSsimulationSDD::ChargeToSignal(Bool_t bAddNoise) {
// add baseline, noise, electronics and ADC saturation effects
char opt1[20], opt2[20];
if (read && i<fNofMaps) GetAnodeBaseline(i,baseline,noise);
for(k=0; k<fScaleSize*fMaxNofSamples; k++) {
fInZR[k] = fHitMap2->GetSignal(i,k);
- contrib = (baseline + noise*gRandom->Gaus());
- fInZR[k] += contrib;
+ if( bAddNoise ) {
+ contrib = (baseline + noise*gRandom->Gaus());
+ fInZR[k] += contrib;
+ }
} // end for k
for(k=0; k<fMaxNofSamples; k++) {
Double_t newcont = 0.;
if (read && i<fNofMaps) GetAnodeBaseline(i,baseline,noise);
for(k=0; k<fScaleSize*fMaxNofSamples; k++) {
fInZR[k] = fHitMap2->GetSignal(i,k);
- contrib = (baseline + noise*gRandom->Gaus());
- fInZR[k] += contrib;
+ if( bAddNoise ) {
+ contrib = (baseline + noise*gRandom->Gaus());
+ fInZR[k] += contrib;
+ }
fInZI[k] = 0.;
} // end for k
FastFourierTransform(fElectronics,&fInZR[0],&fInZI[0],1);
else return (256+((signal-192)<<3)+4);
} // end if signal < 224
if (TMath::Odd(signal)) return (512+((signal-224)<<4)+7);
- return (512+((signal-224)<<4)+7);
+ return (512+((signal-224)<<4)+8);
}
/*
//______________________________________________________________________
void AliITSsimulationSDD::WriteSDigits(){
// Fills the Summable digits Tree
- Int_t i,ni,j,nj;
static AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
- fpList->GetMaxMapIndex( ni, nj );
- for( i=0; i<ni; i++ )
- for( j=0; j<nj; j++ ) {
-// if( fpList->GetSignalOnly( i, j ) > 0.5*fT1[0] ) {
- if( fpList->GetpListItem( i, j ) != 0 )
- // above small threshold.
- aliITS->AddSumDigit( *(fpList->GetpListItem( i, j ) ) );
-// cout << "pListSDD: " << *(pList->GetpListItem(i,j)) << endl;
-// } // end if
- } // end for i,j
+ for( Int_t i=0; i<fNofMaps; i++ ) {
+ for( Int_t j=0; j<fMaxNofSamples; j++ ) {
+ Double_t sig = fHitMap2->GetSignal( i, j );
+ if( sig > 0.2 ) {
+ Int_t jdx = j*fScaleSize;
+ Int_t index = fpList->GetHitIndex( i, j );
+ AliITSpListItem pItemTmp2( fModule, index, 0. );
+ // put the fScaleSize analog digits in only one
+ for( Int_t ik=0; ik<fScaleSize; ik++ ) {
+ AliITSpListItem *pItemTmp = fpList->GetpListItem( i, jdx+ik );
+ if( pItemTmp == 0 ) continue;
+ pItemTmp2.Add( pItemTmp );
+ }
+ pItemTmp2.AddSignalAfterElect( fModule, index, sig );
+ pItemTmp2.AddNoise( fModule, index, fHitNoiMap2->GetSignal( i, j ) );
+ aliITS->AddSumDigit( pItemTmp2 );
+ } // end if (sig > 0.2)
+ }
+ }
return;
}
//______________________________________________________________________
virtual void SetFileName(const char *filnam) {fFileName=filnam;}
// add baseline, noise, electronics and ADC saturation effects
- void ChargeToSignal();
+ void ChargeToSignal(Bool_t bAddNoise=kFALSE);
// add dead channels
void ApplyDeadChannels();
// add crosstalk effect
void ClearMaps();
// Summable Digitses a SDD module
void SDigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev);
-// // Add Summable digits to module maps.
-// void AddSDigitsToModule( TClonesArray *pItemArray, Int_t mask );
+ // Add Summable digits to module maps.
+ Bool_t AddSDigitsToModule( TClonesArray *pItemArray, Int_t mask );
// digitize module from the sum of summable digits.
void FinishSDigitiseModule();
// Writes summable digits
AliITS *fITS; //! local pointer to ITS
// AliITSMapA1 *fHitMap1; //! local pointer to map of digits
AliITSMapA2 *fHitMap2; //! local pointer to map of signals
+ AliITSMapA2 *fHitSigMap2; //! local pointer to map of signals
+ AliITSMapA2 *fHitNoiMap2; //! local pointer to map of signals
// AliITSpList *fpList; //!
// TObjArray *falist; //
// TClonesArray *fpadr; //