/* $Id$ */
+
#include <Riostream.h>
#include <TMath.h>
-#include <TString.h>
#include "AliITSetfSDD.h"
////////////////////////////////////////////////////////////////////////
// Version: 0
// Written by Piergiorgio Cerello
// November 23 1999
-//
+// Revised to comply with coding conventions: Nov, 21 2003 m.m.
//_____________________________________________________________________________
ClassImp(AliITSetfSDD)
+const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofPoles = 5;
+const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofSamples = 1024;
+
Int_t ppower(Int_t b, Int_t e) {
Int_t power = 1;
for(Int_t i=0; i<e; i++) power *= b;
return power;
}
+AliITSetfSDD::AliITSetfSDD() {
+ // Default constructor
+ fTimeDelay = 0.;
+ fSamplingTime = 0.;
+ fT0 = 0.;
+ fDf = 0.;
+ fA0 = 0.;
+ fZeroM = 0;
+ fZeroR = 0;
+ fPoleM = 0;
+ fPoleR = 0;
+ fPoleI = 0;
+ fTfR = 0;
+ fTfI = 0;
+ fWR = 0;
+ fWI = 0;
+}
+
AliITSetfSDD::AliITSetfSDD(Double_t timestep, Int_t amplif)
{
- // sampling time in ns
+ // Standard constructor. sampling time in ns
+ /*
+ cout<<"Number of poles: "<<AliITSetfSDDparam::NumberOfPoles()<<endl;
+ cout<<"Number of samples: "<<AliITSetfSDDparam::NumberOfSamples()<<endl;
+ */
fTimeDelay = 53.5;
if(amplif == 2) fTimeDelay = 35.5;
fSamplingTime = timestep;
fT0 = 0.;
- fDf = ppower(10,9)/(kMaxNofSamples*fSamplingTime);
+ fDf = ppower(10,9)/(AliITSetfSDDparam::NumberOfSamples()*fSamplingTime);
Int_t i,j;
- for(i=0; i<kMaxNofPoles; i++) {
+ fZeroM = new Double_t[AliITSetfSDDparam::NumberOfPoles()];
+ fZeroR = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
+ fZeroI = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
+ fPoleM = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
+ fPoleR = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
+ fPoleI = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
+ fTfR = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
+ fTfI = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
+ fWR = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
+ fWI = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
+
+ for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) {
fZeroM[i] = 0.;
fZeroR[i] = 0.;
fZeroI[i] = 0.;
// Compute Transfer Function
- Double_t PI = acos(-1.);
- for(i=0; i<=kMaxNofSamples/2; i++) {
+ Double_t pigr = acos(-1.);
+ for(i=0; i<=AliITSetfSDDparam::NumberOfSamples()/2; i++) {
Double_t frequency = fDf*i;
- Double_t VM = fA0;
- Double_t VA = 0.;
- for(Int_t k=0; k<kMaxNofPoles; k++) {
+ Double_t vVM = fA0;
+ Double_t vVA = 0.;
+ for(Int_t k=0; k<AliITSetfSDDparam::NumberOfPoles(); k++) {
if(fZeroM[k]) {
- Double_t VZR = -fZeroR[k];
- Double_t VZI = frequency - fZeroI[k];
- Double_t VZM = TMath::Sqrt(VZR*VZR+VZI*VZI);
- Double_t VZA = TMath::ATan2(VZI,VZR);
- // cout << "VZM: " << VZM << ", VZA: " << VZA << endl;
- // cout << "VZR: " << VZR << ", VZI: " << VZI << endl;
+ Double_t vVZR = -fZeroR[k];
+ Double_t vVZI = frequency - fZeroI[k];
+ Double_t vVZM = TMath::Sqrt(vVZR*vVZR+vVZI*vVZI);
+ Double_t vVZA = TMath::ATan2(vVZI,vVZR);
+ // cout << "VZM: " << vVZM << ", VZA: " << vVZA << endl;
+ // cout << "VZR: " << vVZR << ", VZI: " << vVZI << endl;
for(j=1; j<= (Int_t) fZeroM[k]; j++) {
- VM *= VZM;
- VA += VZA;
- if(VA >= PI) VA -= (2.*PI);
- if(VA <= -PI) VA += (2.*PI);
- //cout << "VM: " << VM << ", VA: " << VA << endl;
+ vVM *= vVZM;
+ vVA += vVZA;
+ if(vVA >= pigr) vVA -= (2.*pigr);
+ if(vVA <= -pigr) vVA += (2.*pigr);
+ //cout << "vVM: " << vVM << ", VA: " << vVA << endl;
}
}
if(fPoleM[k]) {
- Double_t VPR = -fPoleR[k];
- Double_t VPI = frequency - fPoleI[k];
- Double_t VPM = TMath::Sqrt(VPR*VPR+VPI*VPI);
- Double_t VPA = TMath::ATan2(VPI,VPR);
- //cout << "VPM: " << VPM << ", VPA: " << VPA << endl;
- //cout << "VPR: " << VPR << ", VPI: " << VPI << endl;
+ Double_t vVPR = -fPoleR[k];
+ Double_t vVPI = frequency - fPoleI[k];
+ Double_t vVPM = TMath::Sqrt(vVPR*vVPR+vVPI*vVPI);
+ Double_t vVPA = TMath::ATan2(vVPI,vVPR);
+ //cout << "VPM: " << vVPM << ", VPA: " << vVPA << endl;
+ //cout << "VPR: " << vVPR << ", VPI: " << vVPI << endl;
for(j=1; j<= (Int_t) fPoleM[k]; j++) {
- VM /= VPM;
- VA -= VPA;
- if(VA >= PI) VA -= (2.*PI);
- if(VA <= -PI) VA += (2.*PI);
- //cout << "VM: " << VM << ", VA: " << VA << endl;
+ vVM /= vVPM;
+ vVA -= vVPA;
+ if(vVA >= pigr) vVA -= (2.*pigr);
+ if(vVA <= -pigr) vVA += (2.*pigr);
+ //cout << "VM: " << vVM << ", vVA: " << vVA << endl;
}
}
- Double_t VR = VM*cos(VA);
- Double_t VI = VM*sin(VA);
- //cout << "VM: " << VM << ", VA: " << VA << endl;
- //cout << "VR: " << VR << ", VI: " << VI << endl;
- fTfR[i] = VR*ppower(10,9);
- fTfI[i] = VI*ppower(10,9);
+ Double_t vVR = vVM*cos(vVA);
+ Double_t vVI = vVM*sin(vVA);
+ //cout << "VM: " << vVM << ", VA: " << vVA << endl;
+ //cout << "VR: " << vVR << ", VI: " << vVI << endl;
+ fTfR[i] = vVR*ppower(10,9);
+ fTfI[i] = vVI*ppower(10,9);
//cout << "fTfR[" << i << "] = " << fTfR[i] << endl;
//cout << "fTfI[" << i << "] = " << fTfI[i] << endl;
if(i) {
- fTfR[kMaxNofSamples-i] = fTfR[i];
- fTfI[kMaxNofSamples-i] = -fTfI[i];
+ fTfR[AliITSetfSDDparam::NumberOfSamples()-i] = fTfR[i];
+ fTfI[AliITSetfSDDparam::NumberOfSamples()-i] = -fTfI[i];
}
}
}
// Compute Fourier Weights
- for(i=0; i<=kMaxNofSamples/2; i++) {
- fWR[i] = cos(-2.*PI*i/kMaxNofSamples);
- fWI[i] = sin(-2.*PI*i/kMaxNofSamples);
+ for(i=0; i<=AliITSetfSDDparam::NumberOfSamples()/2; i++) {
+ fWR[i] = cos(-2.*pigr*i/AliITSetfSDDparam::NumberOfSamples());
+ fWI[i] = sin(-2.*pigr*i/AliITSetfSDDparam::NumberOfSamples());
if(i) {
- fWR[kMaxNofSamples-i] = fWR[i];
- fWI[kMaxNofSamples-i] = -fWI[i];
+ fWR[AliITSetfSDDparam::NumberOfSamples()-i] = fWR[i];
+ fWI[AliITSetfSDDparam::NumberOfSamples()-i] = -fWI[i];
}
}
}
-void AliITSetfSDD::PrintElectronics()
-{
+//______________________________________________________________________
+AliITSetfSDD::AliITSetfSDD(const AliITSetfSDD &obj) : TObject(obj) {
+ // Copy constructor
+ // Copies are not allowed. The method is protected to avoid misuse.
+ Error("AliITSetfSDD","Copy constructor not allowed\n");
+}
+
+//______________________________________________________________________
+AliITSetfSDD& AliITSetfSDD::operator=(const AliITSetfSDD& /* obj */){
+ // Assignment operator
+ // Assignment is not allowed. The method is protected to avoid misuse.
+ Error("= operator","Assignment operator not allowed\n");
+ return *this;
+}
+
+AliITSetfSDD::~AliITSetfSDD(){
+ // Destructor
+ if(fZeroM) delete []fZeroM;
+ if(fZeroR) delete []fZeroR;
+ if(fZeroI) delete []fZeroI;
+ if(fPoleM) delete []fPoleM;
+ if(fPoleR) delete []fPoleR;
+ if(fPoleI) delete []fPoleI;
+ if(fTfR) delete []fTfR;
+ if(fTfI) delete []fTfI;
+ if(fWR) delete []fWR;
+ if(fWI) delete []fWI;
+}
+
+void AliITSetfSDD::PrintElectronics() const {
+ // Printout of the parameters defining the f.e. electronics
+
cout << "Time Delay " << fTimeDelay << endl;
cout << "Sampling Time " << fSamplingTime << endl;
- cout << "Number of Time Samples " << kMaxNofSamples << endl;
+ cout << "Number of Time Samples " << AliITSetfSDDparam::NumberOfSamples() << endl;
cout << "fT0 " << fT0 << endl;
cout << "fDf " << fDf << endl;
cout << "fA0 " << fA0 << endl;
cout << "Zero's and Pole's" << endl;
cout << "fZeroM " << endl;
Int_t i;
- for(i=0; i<kMaxNofPoles; i++) cout << fZeroM[i] << endl;
+ for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroM[i] << endl;
cout << "fZero_R " << endl;
- for(i=0; i<kMaxNofPoles; i++) cout << fZeroR[i] << endl;
+ for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroR[i] << endl;
cout << "fZeroI " << endl;
- for(i=0; i<kMaxNofPoles; i++) cout << fZeroI[i] << endl;
+ for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroI[i] << endl;
cout << "fPoleM " << endl;
- for(i=0; i<kMaxNofPoles; i++) cout << fPoleM[i] << endl;
+ for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleM[i] << endl;
cout << "fPoleR " << endl;
- for(i=0; i<kMaxNofPoles; i++) cout << fPoleR[i] << endl;
+ for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleR[i] << endl;
cout << "fPoleI " << endl;
- for(i=0; i<kMaxNofPoles; i++) cout << fPoleI[i] << endl;
+ for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleI[i] << endl;
cout << "Transfer function" << endl;
cout << "Real Part" << endl;
- for(i=0; i<kMaxNofSamples; i++) cout << fTfR[i] << endl;
+ for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfR[i] << endl;
cout << "Imaginary Part " << endl;
- for(i=0; i<kMaxNofSamples; i++) cout << fTfI[i] << endl;
+ for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfI[i] << endl;
cout << "Fourier Weights" << endl;
cout << "Real Part" << endl;
- for(i=0; i<kMaxNofSamples; i++) cout << fWR[i] << endl;
+ for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWR[i] << endl;
cout << "Imaginary Part " << endl;
- for(i=0; i<kMaxNofSamples; i++) cout << fWI[i] << endl;
+ for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWI[i] << endl;
}
-#ifndef ITSETFSDD_H
-#define ITSETFSDD_H
+#ifndef ALIITSETFSDD_H
+#define ALIITSETFSDD_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
#include <TObject.h>
-static const Int_t kMaxNofPoles = 5;
-static const Int_t kMaxNofSamples = 1024;
class TString;
public:
- AliITSetfSDD() {}; // default constructor
- AliITSetfSDD(Double_t timestep, Int_t amplif);
- ~AliITSetfSDD() {;}
- Double_t GetWeightReal(Int_t n) { return fWR[n]; }
- Double_t GetWeightImag(Int_t n) { return fWI[n]; }
- Double_t GetTraFunReal(Int_t n) { return fTfR[n]; }
- Double_t GetTraFunImag(Int_t n) { return fTfI[n]; }
- Int_t GetSamples() { return kMaxNofSamples; }
- Float_t GetTimeDelay() { return fTimeDelay; }
- void PrintElectronics(); // Print Electronics parameters
-
+ AliITSetfSDD(); // default constructor
+ AliITSetfSDD(Double_t timestep, Int_t amplif);
+ virtual ~AliITSetfSDD();
+ Double_t GetWeightReal(Int_t n) const { return fWR[n]; }
+ Double_t GetWeightImag(Int_t n) const { return fWI[n]; }
+ Double_t GetTraFunReal(Int_t n) const { return fTfR[n]; }
+ Double_t GetTraFunImag(Int_t n) const { return fTfI[n]; }
+ Float_t GetTimeDelay() const { return fTimeDelay; }
+ void PrintElectronics() const; // Print Electronics parameters
+ class AliITSetfSDDparam {
+ public :
+ static Int_t NumberOfPoles() {return fgkMaxNofPoles;}
+ static Int_t NumberOfSamples(){return fgkMaxNofSamples;}
+ private:
+ static const Int_t fgkMaxNofPoles; // Set to 5 in impl. file
+ static const Int_t fgkMaxNofSamples; // Set to 1024 in impl. file
+ };
+ static Int_t GetSamples() { return AliITSetfSDDparam::NumberOfSamples(); }
protected:
+ // copy constructor (NO copy allowed: the constructor is protected
+ // to avoid misuse)
+ AliITSetfSDD(const AliITSetfSDD& obj);
+ // assignment operator (NO assignment allowed)
+ AliITSetfSDD& operator=(const AliITSetfSDD& /* obj */);
+
Float_t fTimeDelay; // Time delay caused by the amplifier shaping
- Double_t fSamplingTime; //
- Double_t fT0; //
- Double_t fDf; //
- Double_t fA0; //
- Double_t fZeroM[kMaxNofPoles]; //
- Double_t fZeroR[kMaxNofPoles]; //
- Double_t fZeroI[kMaxNofPoles]; //
- Double_t fPoleM[kMaxNofPoles]; //
- Double_t fPoleR[kMaxNofPoles]; //
- Double_t fPoleI[kMaxNofPoles]; //
- Double_t fTfR[kMaxNofSamples]; // Transfer function (real part)
- Double_t fTfI[kMaxNofSamples]; // Transfer function (imaginary part)
- Double_t fWR[kMaxNofSamples]; // Fourier Weights (real part)
- Double_t fWI[kMaxNofSamples]; // Fourier Weights (imaginary part)
+ Double_t fSamplingTime; // time step in ns
+ Double_t fT0; // T0
+ Double_t fDf; // Frequency
+ Double_t fA0; // A0
+ Double_t *fZeroM; // ZeroM
+ Double_t *fZeroR; // ZeroR
+ Double_t *fZeroI; // ZeroI
+ Double_t *fPoleM; // PoleM
+ Double_t *fPoleR; // PoleR
+ Double_t *fPoleI; // PoleI
+ Double_t *fTfR; // Transfer function (real part)
+ Double_t *fTfI; // Transfer function (imaginary part)
+ Double_t *fWR; // Fourier Weights (real part)
+ Double_t *fWI; // Fourier Weights (imaginary part)
ClassDef(AliITSetfSDD,1) // Class for SDD electornics
};