X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSresponseSDD.cxx;h=6f3dc7b6f6fd3eb1d618b6be77f36decdc96f8f0;hb=5aa865deb2f46cf83e77e811340a302d3238b7bd;hp=149e9ea599f4d326549d85d71c67396139e57fcd;hpb=48058160c3a149752a66c0014cd03d2e7e64973f;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSresponseSDD.cxx b/ITS/AliITSresponseSDD.cxx index 149e9ea599f..6f3dc7b6f6f 100644 --- a/ITS/AliITSresponseSDD.cxx +++ b/ITS/AliITSresponseSDD.cxx @@ -12,236 +12,313 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Id$ -$Log$ -*/ -#include +/* $Id$ */ + +#include #include #include "AliITSresponseSDD.h" +////////////////////////////////////////////////// +// Response class for set:ITS // +// Specific subdetector implementation // +// for silicon drift detectors // +// // +// // +////////////////////////////////////////////////////// +const Int_t AliITSresponseSDD::fgkModules; +const Int_t AliITSresponseSDD::fgkChips; +const Int_t AliITSresponseSDD::fgkChannels; +const Int_t AliITSresponseSDD::fgkMaxAdcDefault = 1024; +const Float_t AliITSresponseSDD::fgkDynamicRangeDefault = 132.; +const Float_t AliITSresponseSDD::fgkfChargeLossDefault = 0; +const Float_t AliITSresponseSDD::fgkDiffCoeffDefault = 3.23; +const Float_t AliITSresponseSDD::fgkDiffCoeff1Default = 30.; +const Float_t AliITSresponseSDD::fgkTemperatureDefault = 296.; +const TString AliITSresponseSDD::fgkParam1Default = "same"; +const TString AliITSresponseSDD::fgkParam2Default = "same"; +const Float_t AliITSresponseSDD::fgkNoiseDefault = 10.; +const Float_t AliITSresponseSDD::fgkBaselineDefault = 20.; +const TString AliITSresponseSDD::fgkOptionDefault = "1D"; +const Float_t AliITSresponseSDD::fgkMinValDefault = 4; +const Float_t AliITSresponseSDD::fgkDriftSpeedDefault = 7.3; +const Float_t AliITSresponseSDD::fgkNsigmasDefault = 3.; +const Int_t AliITSresponseSDD::fgkNcompsDefault = 121; //______________________________________________________________________ ClassImp(AliITSresponseSDD) -AliITSresponseSDD::AliITSresponseSDD(){ + AliITSresponseSDD::AliITSresponseSDD(){ // default constructor - fGaus = 0; - SetDeadChannels(); - SetMaxAdc(); - SetDiffCoeff(); - SetDriftSpeed(); - SetNSigmaIntegration(); - SetNLookUp(); - // SetClock(); - SetNoiseParam(); - SetNoiseAfterElectronics(); - SetJitterError(); - SetElectronics(); - SetDynamicRange(); - SetChargeLoss(); - SetMinVal(); - SetParamOptions(); - SetTemperature(); - SetZeroSupp(); - SetDataType(); - SetFilenames(); - SetOutputOption(); - SetDo10to8(); - // set the default zero suppression parameters - fCPar[0]=0; - fCPar[1]=0; - 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; + fGaus = 0; + SetDeadChannels(); + SetMaxAdc(fgkMaxAdcDefault); + SetDiffCoeff(fgkDiffCoeffDefault,fgkDiffCoeff1Default); + SetDriftSpeed(fgkDriftSpeedDefault); + SetNSigmaIntegration(fgkNsigmasDefault); + SetNLookUp(fgkNcompsDefault); + // SetClock(); + SetNoiseParam(fgkNoiseDefault,fgkBaselineDefault); + SetNoiseAfterElectronics(); + SetJitterError(); + SetElectronics(); + SetDynamicRange(fgkDynamicRangeDefault); + SetChargeLoss(fgkfChargeLossDefault); + SetThresholds(fgkMinValDefault,0.); + SetParamOptions(fgkParam1Default.Data(),fgkParam2Default.Data()); + SetTemperature(fgkTemperatureDefault); + SetZeroSupp(fgkOptionDefault); + SetDataType(); + SetFilenames(); + SetOutputOption(); + SetDo10to8(); + // set the default zero suppression parameters + fCPar[0]=(Int_t) fBaseline; + fCPar[1]=(Int_t) fBaseline; + fCPar[2]=(Int_t)(2.*fNoiseAfterEl + 0.5); + fCPar[3]=(Int_t)(2.*fNoiseAfterEl + 0.5); + fCPar[4]=0; + fCPar[5]=0; + fCPar[6]=0; + fCPar[7]=0; } //______________________________________________________________________ AliITSresponseSDD::AliITSresponseSDD(const char *dataType){ // constructor - fGaus = 0; - SetDeadChannels(); - SetMaxAdc(); - SetDiffCoeff(); - SetDriftSpeed(); - SetNSigmaIntegration(); - SetNLookUp(); - // SetClock(); - SetNoiseParam(); - SetNoiseAfterElectronics(); - SetJitterError(); - SetElectronics(); - SetDynamicRange(); - SetChargeLoss(); - SetMinVal(); - SetParamOptions(); - SetTemperature(); - SetZeroSupp(); - SetDataType(dataType); - SetFilenames(); - SetOutputOption(); - SetDo10to8(); - // set the default zero suppression parameters - fCPar[0]=0; - fCPar[1]=0; - 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; + fGaus = 0; + SetDeadChannels(); + SetMaxAdc(fgkMaxAdcDefault); + SetDiffCoeff(fgkDiffCoeffDefault,fgkDiffCoeff1Default); + SetDriftSpeed(fgkDriftSpeedDefault); + SetNSigmaIntegration(fgkNsigmasDefault); + SetNLookUp(fgkNcompsDefault); + // SetClock(); + SetNoiseParam(fgkNoiseDefault,fgkBaselineDefault); + SetNoiseAfterElectronics(); + SetJitterError(); + SetElectronics(); + SetDynamicRange(fgkDynamicRangeDefault); + SetChargeLoss(fgkfChargeLossDefault); + SetThresholds(fgkMinValDefault,0.); + SetParamOptions(fgkParam1Default.Data(),fgkParam2Default.Data()); + SetTemperature(fgkTemperatureDefault); + SetZeroSupp(fgkOptionDefault); + SetDataType(dataType); + SetFilenames(); + SetOutputOption(); + SetDo10to8(); + // set the default zero suppression parameters + fCPar[0]=(Int_t) fBaseline; + fCPar[1]=(Int_t) fBaseline; + fCPar[2]=(Int_t)(2.*fNoiseAfterEl + 0.5); + fCPar[3]=(Int_t)(2.*fNoiseAfterEl + 0.5); + fCPar[4]=0; + fCPar[5]=0; + fCPar[6]=0; + fCPar[7]=0; +} +//______________________________________________________________________ +AliITSresponseSDD::AliITSresponseSDD(const AliITSresponseSDD &ob) : AliITSresponse(ob) { + // Copy constructor + // Copies are not allowed. The method is protected to avoid misuse. + Error("AliITSresponseSDD","Copy constructor not allowed\n"); +} + +//______________________________________________________________________ +AliITSresponseSDD& AliITSresponseSDD::operator=(const AliITSresponseSDD& /* ob */){ + // Assignment operator + // Assignment is not allowed. The method is protected to avoid misuse. + Error("= operator","Assignment operator not allowed\n"); + return *this; } + //______________________________________________________________________ AliITSresponseSDD::~AliITSresponseSDD() { if(fGaus) delete fGaus; } + +//______________________________________________________________________ +Int_t AliITSresponseSDD::Convert8to10(Int_t signal) const { + // Undo the lossive 10 to 8 bit compression. + // code from Davide C. and Albert W. + if(Do10to8()){ // kTRUE if the compression is active + if (signal < 0 || signal > 255) { + Warning("Convert8to10","out of range signal=%d",signal); + return 0; + } // end if signal <0 || signal >255 + + if (signal < 128) return signal; + if (signal < 192) { + if (TMath::Odd(signal)) return (128+((signal-128)<<1)); + else return (128+((signal-128)<<1)+1); + } // end if signal < 192 + if (signal < 224) { + if (TMath::Odd(signal)) return (256+((signal-192)<<3)+3); + 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)+8); + } + else { + return signal; + } +} + //______________________________________________________________________ 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]); - } // end for i + Int_t i; + for (i=0; i<8; i++) { + fCPar[i]=cp[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]) const { // give compression param - Int_t i; - for (i=0; i<8; i++) { - cp[i]=fCPar[i]; - } // end for i + Int_t i; + for (i=0; i<8; i++) { + cp[i]=fCPar[i]; + } // end for i +} +//______________________________________________________________________ +void AliITSresponseSDD::SetNLookUp(Int_t p1){ + // 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 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 + // Set fGain to zero to simulate a random distribution of + // dead modules, dead chips and single dead channels - for( Int_t m=0; m fModules ) + if( nmod < 0 || nmod > fgkModules ) { - cout << "Wrong number of dead modules: " << nmod << endl; - return; + cout << "Wrong number of dead modules: " << nmod << endl; + return; } - Int_t nmax = (fModules-nmod)*fChips; - if( nchip < 0 || nchip > nmax ) + Int_t nmax = (fgkModules-nmod)*fgkChips; + if( nchip < 0 || nchip > nmax ) { - cout << "Wrong number of dead chips: " << nchip << endl; - return; + cout << "Wrong number of dead chips: " << nchip << endl; + return; } - nmax = ((fModules - nmod)*fChips - nchip)*fChannels; - if( nchan < 0 || nchan > nmax ) + nmax = ((fgkModules - nmod)*fgkChips - nchip)*fgkChannels; + if( nchan < 0 || nchan > nmax ) { - cout << "Wrong number of dead channels: " << nchan << endl; - return; + cout << "Wrong number of dead channels: " << nchan << endl; + return; } - TRandom *gran = new TRandom(); + TRandom *gran = new TRandom(); - // cout << "modules" << endl; - Int_t * mod = new Int_t [nmod]; - Int_t i; //loop variable - for( i=0; iUniform()); - cout << i+1 << ": Dead module nr: " << mod[i] << endl; - for(Int_t n=0; nUniform()); + cout << i+1 << ": Dead module nr: " << mod[i] << endl; + for(Int_t n=0; nUniform() + 1.); - if( module <=0 || module > fModules ) - cout << "Wrong module: " << module << endl; - Int_t flag_mod = 0; - for( Int_t k=0; kUniform() + 1.); + if( module <=0 || module > fgkModules ) + cout << "Wrong module: " << module << endl; + Int_t flagMod = 0; + for( Int_t k=0; kUniform() + 1.); - if( chi <=0 || chi > fChips ) cout << "Wrong chip: " << chi << endl; - i++; - chip[i-1] = chi; - chip_mod[i-1] = module; - for( Int_t m=0; mUniform() + 1.); + if( chi <=0 || chi > fgkChips ) cout << "Wrong chip: " << chi << endl; + i++; + chip[i-1] = chi; + chipMod[i-1] = module; + for( Int_t m=0; mUniform() + 1.); - if( module <=0 || module > fModules ) - cout << "Wrong module: " << module << endl; - Int_t flag_mod = 0; - for( k=0; kUniform() + 1.); - if( chipp <=0 || chipp > fChips ) cout << "Wrong chip: "<< chipp<Uniform() + 1.); - if( channel[i-1] <=0 || channel[i-1] > fChannels ) - cout << "Wrong channel: " << channel[i-1] << endl; - 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; + Int_t k; //loop variable + Int_t module = (Int_t) (fgkModules*gran->Uniform() + 1.); + if( module <=0 || module > fgkModules ) + cout << "Wrong module: " << module << endl; + Int_t flagMod = 0; + for( k=0; kUniform() + 1.); + if( chipp <=0 || chipp > fgkChips ) cout << "Wrong chip: "<< chipp<Uniform() + 1.); + if( channel[i-1] <=0 || channel[i-1] > fgkChannels ) + cout << "Wrong channel: " << channel[i-1] << endl; + channelChip[i-1] = chipp; + channelMod[i-1] = module; + fGain[module-1][chipp-1][channel[i-1]-1] = 0.; + cout << i << ": Dead channel nr. " << channel[i-1] << " in chip nr. " + << channelChip[i-1] << " in module nr: " << channelMod[i-1] + << endl; } - delete [] mod; - delete [] chip; - delete [] chip_mod; - delete [] channel; - delete [] channel_mod; - delete [] channel_chip; + delete [] mod; + delete [] chip; + delete [] chipMod; + delete [] channel; + delete [] channelMod; + delete [] channelChip; } //______________________________________________________________________ void AliITSresponseSDD::PrintGains(){ - // + // if( GetDeadModules() == 0 && GetDeadChips() == 0 && GetDeadChannels() == 0 ) - return; + return; // Print Electronics Gains cout << "**************************************************" << endl; @@ -249,43 +326,43 @@ void AliITSresponseSDD::PrintGains(){ cout << "**************************************************" << endl; // Print SDD electronic gains - for(Int_t t=0; t