LCOV - code coverage report
Current view: top level - ITS/ITSsim - AliITSetfSDD.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 90 163 55.2 %
Date: 2016-06-14 17:26:59 Functions: 6 9 66.7 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /* $Id$ */
      17             : 
      18             : 
      19             : #include <Riostream.h>
      20             : #include <TMath.h>
      21             : #include "AliITSetfSDD.h"
      22             : 
      23             : ////////////////////////////////////////////////////////////////////////
      24             : // Version: 0
      25             : // Written by Piergiorgio Cerello
      26             : // November 23 1999
      27             : // Revised to comply with coding conventions: Nov, 21 2003 m.m.
      28             : //_____________________________________________________________________________
      29             : 
      30             : using std::endl;
      31             : using std::cout;
      32         116 : ClassImp(AliITSetfSDD)
      33             : 
      34             : const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofPoles = 5;
      35             : const Int_t AliITSetfSDD::AliITSetfSDDparam::fgkMaxNofSamples = 1024;
      36             : 
      37           0 : AliITSetfSDD::AliITSetfSDD():
      38           0 : fTimeDelay(0),
      39           0 : fSamplingTime(0),
      40           0 : fT0(0),
      41           0 : fDf(0.),
      42           0 : fA0(0.) ,
      43           0 : fZeroM(0),
      44           0 : fZeroR(0),
      45           0 : fZeroI(0),
      46           0 : fPoleM(0),
      47           0 : fPoleR(0),
      48           0 : fPoleI(0),
      49           0 : fTfR(0),
      50           0 : fTfI(0),
      51           0 : fWR(0),
      52           0 : fWI(0){
      53             :   // Default constructor
      54           0 : }
      55             : 
      56           1 : AliITSetfSDD::AliITSetfSDD(Double_t timestep, Int_t amplif):
      57           1 : fTimeDelay(0),
      58           1 : fSamplingTime(0),
      59           1 : fT0(0),
      60           1 : fDf(0.),
      61           1 : fA0(0.) ,
      62           1 : fZeroM(0),
      63           1 : fZeroR(0),
      64           1 : fZeroI(0),
      65           1 : fPoleM(0),
      66           1 : fPoleR(0),
      67           1 : fPoleI(0),
      68           1 : fTfR(0),
      69           1 : fTfI(0),
      70           1 : fWR(0),
      71           1 : fWI(0)
      72           5 : {
      73             :   // Standard constructor. sampling time in ns
      74             : 
      75             :   /*
      76             :   cout<<"Number of poles: "<<AliITSetfSDDparam::NumberOfPoles()<<endl;
      77             :   cout<<"Number of samples: "<<AliITSetfSDDparam::NumberOfSamples()<<endl;
      78             :   */
      79           1 :   fTimeDelay = 53.5;
      80           1 :   if(amplif == 2) fTimeDelay = 35.5;
      81           1 :   fSamplingTime = timestep;
      82             :   Double_t xGiga=1.0E+9;
      83           1 :   fT0 = 0.;
      84           1 :   fDf = xGiga/(AliITSetfSDDparam::NumberOfSamples()*fSamplingTime);
      85             :   Int_t i,j;
      86           2 :   fZeroM = new Double_t[AliITSetfSDDparam::NumberOfPoles()];
      87           2 :   fZeroR = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
      88           2 :   fZeroI = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
      89           2 :   fPoleM = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
      90           2 :   fPoleR = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
      91           2 :   fPoleI = new Double_t [AliITSetfSDDparam::NumberOfPoles()];
      92           2 :   fTfR = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
      93           2 :   fTfI = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
      94           2 :   fWR = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
      95           2 :   fWI = new Double_t [AliITSetfSDDparam::NumberOfSamples()];
      96             : 
      97          12 :   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) {
      98           5 :     fZeroM[i] = 0.;
      99           5 :     fZeroR[i] = 0.;
     100           5 :     fZeroI[i] = 0.;
     101           5 :     fPoleM[i] = 0.;
     102           5 :     fPoleR[i] = 0.;
     103           5 :     fPoleI[i] = 0.;
     104             :   }
     105             :   // Alice
     106             : 
     107             :   // PASCAL amplif
     108           1 :   fA0 = 5.53269815e+11; 
     109           1 :   fPoleM[0] = 3.;
     110           1 :   fPoleR[0] = -8280000.; 
     111           1 :   fPoleI[0] = 0.; 
     112             : 
     113           1 :   if(amplif == 2) { // OLA amplif.
     114           0 :     fA0 = 24000.;
     115           0 :     fPoleM[0] = 1.;
     116           0 :     fPoleR[0] = -3000000.;
     117           0 :     fPoleI[0] = 4000000.;
     118           0 :     fPoleM[1] = 1.;
     119           0 :     fPoleR[1] = fPoleR[0];
     120           0 :     fPoleI[1] = -fPoleI[0]; 
     121           0 :   }
     122             : 
     123           1 :   if( amplif == 3 ) { // old PASCAL
     124           0 :     fA0 = 16500.; // AL: 16500.;  // TB: 24000.; // 26000.; // 24000.; // 18000.; 
     125           0 :     fPoleM[0] = 1.;
     126           0 :     fPoleR[0] = -4140000.; // AL: -4140000.; // TB: -3000000.; // -3750000.; // -3500000; // -3000000.; 
     127           0 :     fPoleI[0] = 0.; // AL: 0.; // TB: 4000000.; // 3750000.; // 3500000.; // 3000000.; 
     128           0 :     fPoleM[1] = 1.;
     129           0 :     fPoleR[1] = fPoleR[0];
     130           0 :     fPoleI[1] = -fPoleI[0]; 
     131           0 :   }
     132             : 
     133             :   //cout << "fA0: " << fA0 << endl;
     134             :   //cout << "fTimeDelay: " << fTimeDelay << endl;
     135             :   
     136             :   // Compute Transfer Function
     137             : 
     138             :   Double_t pigr = acos(-1.);
     139        1028 :   for(i=0; i<=AliITSetfSDDparam::NumberOfSamples()/2; i++) {
     140         513 :     Double_t frequency = fDf*i;
     141         513 :     Double_t vVM = fA0;
     142             :     Double_t vVA = 0.;
     143        6156 :     for(Int_t k=0; k<AliITSetfSDDparam::NumberOfPoles(); k++) {
     144        2565 :       if(fZeroM[k]) {
     145           0 :         Double_t vVZR = -fZeroR[k];
     146           0 :         Double_t vVZI = frequency - fZeroI[k];
     147           0 :         Double_t vVZM = TMath::Sqrt(vVZR*vVZR+vVZI*vVZI);
     148           0 :         Double_t vVZA = TMath::ATan2(vVZI,vVZR);
     149             :         //      cout << "VZM: " << vVZM << ", VZA: " << vVZA << endl;
     150             :         //      cout << "VZR: " << vVZR << ", VZI: " << vVZI << endl;
     151           0 :         for(j=1; j<= (Int_t) fZeroM[k]; j++) {
     152           0 :           vVM *= vVZM;
     153           0 :           vVA += vVZA;
     154           0 :           if(vVA >= pigr) vVA -= (2.*pigr);
     155           0 :           if(vVA <= -pigr) vVA += (2.*pigr);
     156             :           //cout << "vVM: " << vVM << ", VA: " << vVA << endl;
     157             :         }
     158           0 :       }
     159             : 
     160        2565 :       if(fPoleM[k]) {
     161         513 :         Double_t vVPR = -fPoleR[k];
     162         513 :         Double_t vVPI = frequency - fPoleI[k];
     163         513 :         Double_t vVPM = TMath::Sqrt(vVPR*vVPR+vVPI*vVPI);
     164         513 :         Double_t vVPA = TMath::ATan2(vVPI,vVPR);
     165             :         //cout << "VPM: " << vVPM << ", VPA: " << vVPA << endl;
     166             :         //cout << "VPR: " << vVPR << ", VPI: " << vVPI << endl;
     167        4104 :         for(j=1; j<= (Int_t) fPoleM[k]; j++) {
     168        1539 :           vVM /= vVPM;
     169        1539 :           vVA -= vVPA;
     170        1539 :           if(vVA >= pigr) vVA -= (2.*pigr);
     171        1960 :           if(vVA <= -pigr) vVA += (2.*pigr);
     172             :           //cout << "VM: " << vVM << ", vVA: " << vVA << endl;
     173             :         }
     174         513 :       }
     175        2565 :       Double_t vVR = vVM*cos(vVA);
     176        2565 :       Double_t vVI = vVM*sin(vVA);
     177             :       //cout << "VM: " << vVM << ", VA: " << vVA << endl;
     178             :       //cout << "VR: " << vVR << ", VI: " << vVI << endl;
     179        2565 :       fTfR[i] = vVR*xGiga;
     180        2565 :       fTfI[i] = vVI*xGiga;
     181             :       //cout << "fTfR[" << i << "] = " << fTfR[i] << endl;
     182             :       //cout << "fTfI[" << i << "] = " << fTfI[i] << endl;
     183        2565 :       if(i) {
     184        2560 :         fTfR[AliITSetfSDDparam::NumberOfSamples()-i] = fTfR[i];
     185        2560 :         fTfI[AliITSetfSDDparam::NumberOfSamples()-i] = -fTfI[i];
     186        2560 :       }
     187             :     }
     188             :   }
     189             :   
     190             :   // Compute Fourier Weights
     191             : 
     192        1028 :   for(i=0; i<=AliITSetfSDDparam::NumberOfSamples()/2; i++) {
     193         513 :     fWR[i] = cos(-2.*pigr*i/AliITSetfSDDparam::NumberOfSamples());
     194         513 :     fWI[i] = sin(-2.*pigr*i/AliITSetfSDDparam::NumberOfSamples());
     195         513 :     if(i) {
     196         512 :       fWR[AliITSetfSDDparam::NumberOfSamples()-i] = fWR[i];
     197         512 :       fWI[AliITSetfSDDparam::NumberOfSamples()-i] = -fWI[i];
     198         512 :     }
     199             :   }
     200             : 
     201           2 : }
     202             : 
     203             : 
     204           6 : AliITSetfSDD::~AliITSetfSDD(){
     205             :   // Destructor
     206           3 :   if(fZeroM) delete []fZeroM;
     207           3 :   if(fZeroR) delete []fZeroR;
     208           3 :   if(fZeroI) delete []fZeroI;
     209           3 :   if(fPoleM) delete []fPoleM;
     210           3 :   if(fPoleR) delete []fPoleR;
     211           3 :   if(fPoleI) delete []fPoleI;
     212           3 :   if(fTfR) delete []fTfR;
     213           3 :   if(fTfI) delete []fTfI;
     214           3 :   if(fWR) delete []fWR;
     215           3 :   if(fWI) delete []fWI;
     216           3 : }
     217             : 
     218             : void AliITSetfSDD::PrintElectronics() const {
     219             :   // Printout of the parameters defining the f.e. electronics
     220             : 
     221           0 :   cout << "Time Delay " << fTimeDelay << endl;
     222           0 :   cout << "Sampling Time " << fSamplingTime << endl;
     223           0 :   cout << "Number of Time Samples " << AliITSetfSDDparam::NumberOfSamples() << endl;
     224           0 :   cout << "fT0 " << fT0 << endl;
     225           0 :   cout << "fDf " << fDf << endl;
     226           0 :   cout << "fA0 " << fA0 << endl;
     227             : 
     228           0 :   cout << "Zero's and Pole's" << endl;
     229           0 :   cout << "fZeroM " << endl;
     230             :   Int_t i;
     231           0 :   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroM[i] << endl;
     232           0 :   cout << "fZero_R " << endl;
     233           0 :   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroR[i] << endl;
     234           0 :   cout << "fZeroI " << endl;
     235           0 :   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fZeroI[i] << endl;
     236           0 :   cout << "fPoleM " << endl;
     237           0 :   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleM[i] << endl;
     238           0 :   cout << "fPoleR " << endl;
     239           0 :   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleR[i] << endl;
     240           0 :   cout << "fPoleI " << endl;
     241           0 :   for(i=0; i<AliITSetfSDDparam::NumberOfPoles(); i++) cout << fPoleI[i] << endl;
     242             : 
     243           0 :   cout << "Transfer function" << endl;
     244           0 :   cout << "Real Part" << endl;
     245           0 :   for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfR[i] << endl;
     246           0 :   cout << "Imaginary Part " << endl;
     247           0 :   for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fTfI[i] << endl;
     248             : 
     249           0 :   cout << "Fourier Weights" << endl;
     250           0 :   cout << "Real Part" << endl;
     251           0 :   for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWR[i] << endl;
     252           0 :   cout << "Imaginary Part " << endl;
     253           0 :   for(i=0; i<AliITSetfSDDparam::NumberOfSamples(); i++) cout << fWI[i] << endl;
     254           0 : }
     255             : 
     256             : 
     257             : 
     258             : 
     259             : 
     260             : 
     261             : 
     262             : 

Generated by: LCOV version 1.11