to use AliTRDmcmSim with ZS.
Plan is after we make sure it works stably, we delete AliTRDmcm which is obsolete.
-However it still take time because tarcklet part is not yet touched.
+However it still take time because tracklet part is not yet touched.
The default raw version is 2.
Ken Oyama
*/
#include <fstream>
+
#include <TMath.h>
+
#include "AliLog.h"
+
#include "AliTRDmcmSim.h"
#include "AliTRDfeeParam.h"
#include "AliTRDSimParam.h"
//_____________________________________________________________________________
AliTRDmcmSim::AliTRDmcmSim() :TObject()
,fInitialized(kFALSE)
+ ,fChaId(-1)
+ ,fSector(-1)
+ ,fStack(-1)
+ ,fLayer(-1)
+ ,fRobPos(-1)
+ ,fMcmPos(-1)
+ ,fNADC(-1)
+ ,fNTimeBin(-1)
+ ,fRow(-1)
+ ,fADCR(NULL)
+ ,fADCF(NULL)
+ ,fZSM(NULL)
+ ,fZSM1Dim(NULL)
,fFeeParam(NULL)
,fSimParam(NULL)
,fCal(NULL)
,fGeo(NULL)
+{
+ //
+ // AliTRDmcmSim default constructor
+ //
+
+ // By default, nothing is initialized.
+ // It is necessary to issue Init before use.
+}
+
+//_____________________________________________________________________________
+AliTRDmcmSim::AliTRDmcmSim(const AliTRDmcmSim &m)
+ :TObject(m)
+ ,fInitialized(kFALSE)
,fChaId(-1)
,fSector(-1)
,fStack(-1)
,fADCF(NULL)
,fZSM(NULL)
,fZSM1Dim(NULL)
+ ,fFeeParam(NULL)
+ ,fSimParam(NULL)
+ ,fCal(NULL)
+ ,fGeo(NULL)
{
//
- // AliTRDmcmSim default constructor
+ // AliTRDmcmSim copy constructor
//
// By default, nothing is initialized.
//
// AliTRDmcmSim destructor
//
+
if( fADCR != NULL ) {
for( Int_t iadc = 0 ; iadc < fNADC; iadc++ ) {
delete [] fADCR[iadc];
delete [] fZSM1Dim;
}
delete fGeo;
+
+}
+
+//_____________________________________________________________________________
+AliTRDmcmSim &AliTRDmcmSim::operator=(const AliTRDmcmSim &m)
+{
+ //
+ // Assignment operator
+ //
+
+ if (this != &m) {
+ ((AliTRDmcmSim &) m).Copy(*this);
+ }
+ return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDmcmSim::Copy(TObject &m) const
+{
+ //
+ // Copy function
+ //
+
+ ((AliTRDmcmSim &) m).fInitialized = 0;
+ ((AliTRDmcmSim &) m).fChaId = 0;
+ ((AliTRDmcmSim &) m).fSector = 0;
+ ((AliTRDmcmSim &) m).fStack = 0;
+ ((AliTRDmcmSim &) m).fLayer = 0;
+ ((AliTRDmcmSim &) m).fRobPos = 0;
+ ((AliTRDmcmSim &) m).fMcmPos = 0;
+ ((AliTRDmcmSim &) m).fNADC = 0;
+ ((AliTRDmcmSim &) m).fNTimeBin = 0;
+ ((AliTRDmcmSim &) m).fRow = 0;
+ ((AliTRDmcmSim &) m).fADCR = 0;
+ ((AliTRDmcmSim &) m).fADCF = 0;
+ ((AliTRDmcmSim &) m).fZSM = 0;
+ ((AliTRDmcmSim &) m).fZSM1Dim = 0;
+ ((AliTRDmcmSim &) m).fFeeParam = 0;
+ ((AliTRDmcmSim &) m).fSimParam = 0;
+ ((AliTRDmcmSim &) m).fCal = 0;
+ ((AliTRDmcmSim &) m).fGeo = 0;
+
}
//_____________________________________________________________________________
-void AliTRDmcmSim::Init( Int_t cha_id, Int_t rob_pos, Int_t mcm_pos )
+void AliTRDmcmSim::Init( Int_t chaId, Int_t robPos, Int_t mcmPos )
{
+ //
// Initialize the class with new geometry information
// fADC array will be reused with filled by zero
+ //
fFeeParam = AliTRDfeeParam::Instance();
fSimParam = AliTRDSimParam::Instance();
fCal = AliTRDcalibDB::Instance();
fGeo = new AliTRDgeometry();
- fChaId = cha_id;
+ fChaId = chaId;
fSector = fGeo->GetSector( fChaId );
fStack = fGeo->GetChamber( fChaId );
fLayer = fGeo->GetPlane( fChaId );
- fRobPos = rob_pos;
- fMcmPos = mcm_pos;
+ fRobPos = robPos;
+ fMcmPos = mcmPos;
fNADC = fFeeParam->GetNadcMcm();
fNTimeBin = fCal->GetNumberOfTimeBins();
fRow = fFeeParam->GetPadRowFromMCM( fRobPos, fMcmPos );
//_____________________________________________________________________________
Bool_t AliTRDmcmSim::CheckInitialized()
{
+ //
+ // Check whether object is initialized
+ //
+
if( ! fInitialized ) {
AliDebug(2, Form ("AliTRDmcmSim is not initialized but function other than Init() is called."));
}
//_____________________________________________________________________________
void AliTRDmcmSim::SetData( Int_t iadc, Int_t *adc )
{
+ //
// Store ADC data into array of raw data
+ //
if( !CheckInitialized() ) return;
//_____________________________________________________________________________
void AliTRDmcmSim::SetData( Int_t iadc, Int_t it, Int_t adc )
{
+ //
// Store ADC data into array of raw data
+ //
if( !CheckInitialized() ) return;
//_____________________________________________________________________________
void AliTRDmcmSim::SetDataPedestal( Int_t iadc )
{
+ //
// Store ADC data into array of raw data
+ //
if( !CheckInitialized() ) return;
//_____________________________________________________________________________
Int_t AliTRDmcmSim::GetCol( Int_t iadc )
{
+ //
// Return column id of the pad for the given ADC channel
+ //
+
if( !CheckInitialized() ) return -1;
return fFeeParam->GetPadColFromADC(fRobPos, fMcmPos, iadc);
}
-
-
-
//_____________________________________________________________________________
Int_t AliTRDmcmSim::ProduceRawStream( UInt_t *buf, Int_t maxSize )
{
+ //
// Produce raw data stream from this MCM and put in buf
- // Returns number of words filled, or negative value with -1 * number of overflowed words
+ // Returns number of words filled, or negative value
+ // with -1 * number of overflowed words
+ //
UInt_t x;
UInt_t iEv = 0;
if( of != 0 ) return -of; else return nw;
}
-
//_____________________________________________________________________________
void AliTRDmcmSim::Filter()
{
+ //
// Apply digital filter
+ //
if( !CheckInitialized() ) return;
//_____________________________________________________________________________
void AliTRDmcmSim::FilterPedestal()
{
+ //
// Apply pedestal filter
+ //
Int_t ap = fSimParam->GetADCbaseline(); // ADC instrinsic pedestal
Int_t ep = fFeeParam->GetPFeffectPedestal(); // effective pedestal
- Int_t tc = fFeeParam->GetPFtimeConstant(); // this makes no sense yet
+ //Int_t tc = fFeeParam->GetPFtimeConstant(); // this makes no sense yet
for( Int_t iadc = 0 ; iadc < fNADC; iadc++ ) {
for( Int_t it = 0 ; it < fNTimeBin ; it++ ) {
//_____________________________________________________________________________
void AliTRDmcmSim::FilterGain()
{
+ //
// Apply gain filter (not implemented)
// Later it will be implemented because gain digital filiter will
// increase noise level.
+ //
+
}
//_____________________________________________________________________________
void AliTRDmcmSim::FilterTail()
{
+ //
// Apply exponential tail filter (Bogdan's version)
+ //
Double_t *dtarg = new Double_t[fNTimeBin];
Int_t *itarg = new Int_t[fNTimeBin];
//_____________________________________________________________________________
void AliTRDmcmSim::ZSMapping()
{
+ //
// Zero Suppression Mapping implemented in TRAP chip
//
// See detail TRAP manual "Data Indication" section:
// http://www.kip.uni-heidelberg.de/ti/TRD/doc/trap/TRAP-UserManual.pdf
+ //
- Int_t EBIS = fFeeParam->GetEBsglIndThr(); // TRAP default = 0x4 (Tis=4)
- Int_t EBIT = fFeeParam->GetEBsumIndThr(); // TRAP default = 0x28 (Tit=40)
- Int_t EBIL = fFeeParam->GetEBindLUT(); // TRAP default = 0xf0 (lookup table accept (I2,I1,I0)=(111) or (110) or (101) or (100))
- Int_t EBIN = fFeeParam->GetEBignoreNeighbour(); // TRAP default = 1 (no neighbor sensitivity)
+ Int_t eBIS = fFeeParam->GetEBsglIndThr(); // TRAP default = 0x4 (Tis=4)
+ Int_t eBIT = fFeeParam->GetEBsumIndThr(); // TRAP default = 0x28 (Tit=40)
+ Int_t eBIL = fFeeParam->GetEBindLUT(); // TRAP default = 0xf0
+ // (lookup table accept (I2,I1,I0)=(111)
+ // or (110) or (101) or (100))
+ Int_t eBIN = fFeeParam->GetEBignoreNeighbour(); // TRAP default = 1 (no neighbor sensitivity)
Int_t ep = AliTRDfeeParam::GetPFeffectPedestal();
if( !CheckInitialized() ) return;
for( Int_t it = 0 ; it < fNTimeBin ; it++ ) {
// Get ADC data currently in filter buffer
- Int_t Ap = fADCF[iadc-1][it] - ep; // previous
- Int_t Ac = fADCF[iadc ][it] - ep; // current
- Int_t An = fADCF[iadc+1][it] - ep; // next
+ Int_t ap = fADCF[iadc-1][it] - ep; // previous
+ Int_t ac = fADCF[iadc ][it] - ep; // current
+ Int_t an = fADCF[iadc+1][it] - ep; // next
// evaluate three conditions
- Int_t I0 = ( Ac >= Ap && Ac >= An ) ? 0 : 1; // peak center detection
- Int_t I1 = ( Ap + Ac + An > EBIT ) ? 0 : 1; // cluster
- Int_t I2 = ( Ac > EBIS ) ? 0 : 1; // absolute large peak
-
- Int_t I = I2 * 4 + I1 * 2 + I0; // Bit position in lookup table
- Int_t D = (EBIL >> I) & 1; // Looking up (here D=0 means true and D=1 means false according to TRAP manual)
-
- fZSM[iadc][it] &= D;
- if( EBIN == 0 ) { // turn on neighboring ADCs
- fZSM[iadc-1][it] &= D;
- fZSM[iadc+1][it] &= D;
+ Int_t i0 = ( ac >= ap && ac >= an ) ? 0 : 1; // peak center detection
+ Int_t i1 = ( ap + ac + an > eBIT ) ? 0 : 1; // cluster
+ Int_t i2 = ( ac > eBIS ) ? 0 : 1; // absolute large peak
+
+ Int_t i = i2 * 4 + i1 * 2 + i0; // Bit position in lookup table
+ Int_t d = (eBIL >> i) & 1; // Looking up (here d=0 means true
+ // and d=1 means false according to TRAP manual)
+
+ fZSM[iadc][it] &= d;
+ if( eBIN == 0 ) { // turn on neighboring ADCs
+ fZSM[iadc-1][it] &= d;
+ fZSM[iadc+1][it] &= d;
}
+
}
}
fZSM1Dim[iadc] &= fZSM[iadc][it];
}
}
+
}
//_____________________________________________________________________________
void AliTRDmcmSim::DumpData( char *f, char *target )
{
+ //
// Dump data stored (for debugging).
// target should contain one or multiple of the following characters
// R for raw data
// Z for zero suppression map
// S Raw dat astream
// other characters are simply ignored
+ //
+
UInt_t tempbuf[1024];
if( !CheckInitialized() ) return;
}
//_____________________________________________________________________________
-void AliTRDmcmSim::FilterSimDeConvExpA(Int_t *source, Double_t *target, Int_t n, Int_t nexp)
+void AliTRDmcmSim::FilterSimDeConvExpA(Int_t *source, Double_t *target
+ , Int_t n, Int_t nexp)
{
//
// Exponential filter "analog"
}
//_____________________________________________________________________________
-void AliTRDmcmSim::FilterSimDeConvExpD(Int_t *source, Int_t *target, Int_t n, Int_t nexp)
+void AliTRDmcmSim::FilterSimDeConvExpD(Int_t *source, Int_t *target, Int_t n
+ , Int_t nexp)
{
//
// Exponential filter "digital"
}
}
+
}
//_____________________________________________________________________________
-void AliTRDmcmSim::FilterSimDeConvExpMI(Int_t *source, Double_t *target, Int_t n)
+void AliTRDmcmSim::FilterSimDeConvExpMI(Int_t *source, Double_t *target
+ , Int_t n)
{
//
// Exponential filter (M. Ivanov)
}
//______________________________________________________________________________
-void AliTRDmcmSim::FilterSimTailMakerSpline(Double_t *ampin, Double_t *ampout, Double_t lambda, Int_t n)
+void AliTRDmcmSim::FilterSimTailMakerSpline(Double_t *ampin, Double_t *ampout
+ , Double_t lambda, Int_t n)
{
//
// Special filter (M. Ivanov)
}
//______________________________________________________________________________
-void AliTRDmcmSim::FilterSimTailCancelationMI(Double_t *ampin, Double_t *ampout, Double_t norm, Double_t lambda, Int_t n)
+void AliTRDmcmSim::FilterSimTailCancelationMI(Double_t *ampin, Double_t *ampout
+ , Double_t norm, Double_t lambda
+ , Int_t n)
{
//
// Special filter (M. Ivanov)
}
}
-// EOF