]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSetfSDD.cxx
Separating well and badly reconstructed pileup vertices. Adding statistics of associa...
[u/mrichter/AliRoot.git] / ITS / AliITSetfSDD.cxx
index 865c62dd720f6f224c8cef952529ad79bff7c44f..40088b0bc69dc44898c26490b93ce28d32e921e5 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.1.2.2  2000/06/12 18:09:36  barbera
-fixed posible compilation errors on HP unix
+/* $Id$ */
 
-Revision 1.1.2.1  2000/01/12 20:21:30  nilsen
-missed AliITSetfSDD files ealier
 
-$Name$
-$Author$
-$Id$
-*/
-
-#include <iostream.h>
+#include <Riostream.h>
 #include <TMath.h>
 #include "AliITSetfSDD.h"
 
@@ -34,156 +24,233 @@ $Id$
 // Version: 0
 // Written by Piergiorgio Cerello
 // November 23 1999
-//
-// AliITSmapSDD is the map of SDDs.
-//
-//Begin_Html
-/*
-<img src="picts/ITS/AliITShit_Class_Diagram.gif">
-</pre>
-<br clear=left>
-<font size=+2 color=red>
-<p>This show the relasionships between the ITS hit class and the rest of Aliroot.
-</font>
-<pre>
-*/
-//End_Htm
-//extern Int_t power(Int_t b, Int_t e);
-
+// Revised to comply with coding conventions: Nov, 21 2003 m.m.
 //_____________________________________________________________________________
+
+using std::endl;
+using std::cout;
 ClassImp(AliITSetfSDD)
 
-Int_t ppower(Int_t b, Int_t e) {
-  Int_t power = 1,i;
-  for(i=0; i<e; i++) power *= b;
-  return power;
+const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofPoles = 5;
+const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofSamples = 1024;
+
+AliITSetfSDD::AliITSetfSDD():
+fTimeDelay(0),
+fSamplingTime(0),
+fT0(0),
+fDf(0.),
+fA0(0.) ,
+fZeroM(0),
+fZeroR(0),
+fZeroI(0),
+fPoleM(0),
+fPoleR(0),
+fPoleI(0),
+fTfR(0),
+fTfI(0),
+fWR(0),
+fWI(0){
+  // Default constructor
 }
 
-AliITSetfSDD::AliITSetfSDD(Double_t timeclock)
+AliITSetfSDD::AliITSetfSDD(Double_t timestep, Int_t amplif):
+fTimeDelay(0),
+fSamplingTime(0),
+fT0(0),
+fDf(0.),
+fA0(0.) ,
+fZeroM(0),
+fZeroR(0),
+fZeroI(0),
+fPoleM(0),
+fPoleR(0),
+fPoleI(0),
+fTfR(0),
+fTfI(0),
+fWR(0),
+fWI(0)
 {
-  // sampling time in ns
-  fSamplingTime = 1000./timeclock;
+  // 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;
+  Double_t xGiga=1.0E+9;
   fT0 = 0.;
-  fDf = ppower(10,9)/(fMaxNofSamples*fSamplingTime);
-  fA0 = 9000.;
-
-  Int_t i,j,k;
-  for(i=0; i<fMaxNofPoles; i++) {
-    fZero_M[i] = 0.;
-    fZero_R[i] = 0.;
-    fZero_I[i] = 0.;
-    fPole_M[i] = 0.;
-    fPole_R[i] = 0.;
-    fPole_I[i] = 0.;
+  fDf = xGiga/(AliITSetfSDDparam::NumberOfSamples()*fSamplingTime);
+  Int_t i,j;
+  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.;
+    fPoleM[i] = 0.;
+    fPoleR[i] = 0.;
+    fPoleI[i] = 0.;
   }
-  fPole_M[0] = 1.;
-  fPole_R[0] = -2100000.;
-  fPole_I[0] = fPole_R[0];
-  fPole_M[1] = 1.;
-  fPole_R[1] = -2100000.;
-  fPole_I[1] = -fPole_R[1];
+  // Alice
+
+  // PASCAL amplif
+  fA0 = 5.53269815e+11; 
+  fPoleM[0] = 3.;
+  fPoleR[0] = -8280000.; 
+  fPoleI[0] = 0.; 
 
-   // Compute Transfer Function
+  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]; 
+  }
+
+  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]; 
+  }
 
-  Double_t PI = acos(-1.);
-  for(i=0; i<=fMaxNofSamples/2; i++) {
+  //cout << "fA0: " << fA0 << endl;
+  //cout << "fTimeDelay: " << fTimeDelay << endl;
+  
+  // Compute Transfer Function
+
+  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(k=0; k<fMaxNofPoles; k++) {
-      if(fZero_M[k]) {
-        Double_t VZR = -fZero_R[k];
-        Double_t VZI = frequency - fZero_I[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;
-        for(j=1; j<= (Int_t) fZero_M[k]; j++) {
-          VM *= VZM;
-          VA += VZA;
-          if(VA >= PI) VA -= (2.*PI);
-          if(VA <= -PI) VA += (2.*PI);
-         //cout << "VM: " << VM << ", VA: " << VA << endl;
+    Double_t vVM = fA0;
+    Double_t vVA = 0.;
+    for(Int_t k=0; k<AliITSetfSDDparam::NumberOfPoles(); k++) {
+      if(fZeroM[k]) {
+        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++) {
+          vVM *= vVZM;
+          vVA += vVZA;
+          if(vVA >= pigr) vVA -= (2.*pigr);
+          if(vVA <= -pigr) vVA += (2.*pigr);
+         //cout << "vVM: " << vVM << ", VA: " << vVA << endl;
         }
       }
 
-      if(fPole_M[k]) {
-        Double_t VPR = -fPole_R[k];
-        Double_t VPI = frequency - fPole_I[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;
-        for(j=1; j<= (Int_t) fPole_M[k]; j++) {
-          VM /= VPM;
-          VA -= VPA;
-          if(VA >= PI) VA -= (2.*PI);
-          if(VA <= -PI) VA += (2.*PI);
-         //cout << "VM: " << VM << ", VA: " << VA << endl;
+      if(fPoleM[k]) {
+        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++) {
+          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;
-      fTf_R[i] = VR*ppower(10,9);
-      fTf_I[i] = VI*ppower(10,9);
-      //cout << "fTf_R[" << i << "] = " << fTf_R[i] << endl;
-      //cout << "fTf_I[" << i << "] = " << fTf_I[i] << endl;
+      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*xGiga;
+      fTfI[i] = vVI*xGiga;
+      //cout << "fTfR[" << i << "] = " << fTfR[i] << endl;
+      //cout << "fTfI[" << i << "] = " << fTfI[i] << endl;
       if(i) {
-        fTf_R[fMaxNofSamples-i] = fTf_R[i];
-        fTf_I[fMaxNofSamples-i] = -fTf_I[i];
+        fTfR[AliITSetfSDDparam::NumberOfSamples()-i] = fTfR[i];
+        fTfI[AliITSetfSDDparam::NumberOfSamples()-i] = -fTfI[i];
       }
     }
   }
   
   // Compute Fourier Weights
 
-  for(i=0; i<=fMaxNofSamples/2; i++) {
-    fW_R[i] = cos(-2.*PI*i/fMaxNofSamples);
-    fW_I[i] = sin(-2.*PI*i/fMaxNofSamples);
+  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) {
-      fW_R[fMaxNofSamples-i] = fW_R[i];
-      fW_I[fMaxNofSamples-i] = -fW_I[i];
+      fWR[AliITSetfSDDparam::NumberOfSamples()-i] = fWR[i];
+      fWI[AliITSetfSDDparam::NumberOfSamples()-i] = -fWI[i];
     }
   }
 
 }
 
-void AliITSetfSDD::Print()
-{
-  Int_t i;
+
+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 " << fMaxNofSamples << 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 << "fZero_M " << endl;
-  for(i=0; i<fMaxNofPoles; i++) cout << fZero_M[i] << endl;
+  cout << "fZeroM " << endl;
+  Int_t i;
+  for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroM[i] << endl;
   cout << "fZero_R " << endl;
-  for(i=0; i<fMaxNofPoles; i++) cout << fZero_R[i] << endl;
-  cout << "fZero_I " << endl;
-  for(i=0; i<fMaxNofPoles; i++) cout << fZero_I[i] << endl;
-  cout << "fPole_M " << endl;
-  for(i=0; i<fMaxNofPoles; i++) cout << fPole_M[i] << endl;
-  cout << "fPole_R " << endl;
-  for(i=0; i<fMaxNofPoles; i++) cout << fPole_R[i] << endl;
-  cout << "fPole_I " << endl;
-  for(i=0; i<fMaxNofPoles; i++) cout << fPole_I[i] << endl;
+  for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroR[i] << endl;
+  cout << "fZeroI " << endl;
+  for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroI[i] << endl;
+  cout << "fPoleM " << endl;
+  for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleM[i] << endl;
+  cout << "fPoleR " << endl;
+  for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleR[i] << endl;
+  cout << "fPoleI " << endl;
+  for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleI[i] << endl;
 
   cout << "Transfer function" << endl;
   cout << "Real Part" << endl;
-  for(i=0; i<fMaxNofSamples; i++) cout << fTf_R[i] << endl;
+  for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfR[i] << endl;
   cout << "Imaginary Part " << endl;
-  for(i=0; i<fMaxNofSamples; i++) cout << fTf_I[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<fMaxNofSamples; i++) cout << fW_R[i] << endl;
+  for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWR[i] << endl;
   cout << "Imaginary Part " << endl;
-  for(i=0; i<fMaxNofSamples; i++) cout << fW_I[i] << endl;
+  for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWI[i] << endl;
 }