LCOV - code coverage report
Current view: top level - ITS/ITSsim - AliITSsimulationFastPoints.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 82 1.2 %
Date: 2016-06-14 17:26:59 Functions: 1 9 11.1 %

          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             : // implements fast simulation                           //
      19             : //                                                      //
      20             : //                                                      //
      21             : //////////////////////////////////////////////////////////
      22             : 
      23             : 
      24             : #include <TRandom.h>
      25             : 
      26             : #include "AliITS.h"
      27             : #include "AliITShit.h"
      28             : #include "AliITSRecPoint.h"
      29             : #include "AliITSmodule.h"
      30             : #include "AliITSgeom.h"
      31             : #include "AliRun.h"
      32             : #include "AliITSsimulationFastPoints.h"
      33             : 
      34             : 
      35         116 : ClassImp(AliITSsimulationFastPoints)
      36             : 
      37           0 : AliITSsimulationFastPoints::AliITSsimulationFastPoints()
      38           0 : {
      39             :   //constructor
      40           0 :   fSigmaRPhi[0] = fSigmaRPhi[1] = 12e-4;
      41           0 :   fSigmaRPhi[2] = fSigmaRPhi[3] = 38e-4;
      42           0 :   fSigmaRPhi[4] = fSigmaRPhi[5] = 20e-4;
      43           0 :   fSigmaZ[0] = fSigmaZ[1] = 120e-4;        // resolution for 425 micron pixels
      44           0 :   fSigmaZ[2] = fSigmaZ[3] = 28e-4;
      45           0 :   fSigmaZ[4] = fSigmaZ[5] = 830e-4;
      46           0 :   fSigmaDe[0] = fSigmaDe[1] = 0.72e-6;
      47           0 :   fSigmaDe[2] = fSigmaDe[3] = 0.90e-6;
      48           0 :   fSigmaDe[4] = fSigmaDe[5] =  5e-6;
      49           0 :   fThrDe[0] = fThrDe[1] = 7.2e-6;
      50           0 :   fThrDe[2] = fThrDe[3] = 2.70e-6;
      51           0 :   fThrDe[4] = fThrDe[5] = 10e-6;
      52           0 : }
      53             : 
      54             : //-------------------------------------------------------------
      55             : void AliITSsimulationFastPoints::CreateFastRecPoints(Int_t module, TClonesArray* recp){
      56             :     // Fast points simulator
      57           0 :     AliITS *aliITS  = (AliITS*)gAlice->GetModule("ITS");
      58             : 
      59           0 :     CreateFastRecPoints((AliITSmodule *)(aliITS->GetModule(module)),
      60           0 :                         module,gRandom,recp);
      61           0 : }
      62             : //-------------------------------------------------------------
      63             : void AliITSsimulationFastPoints::CreateFastRecPoints(AliITSmodule *mod,
      64             :                                                      Int_t module,
      65             :                                                      TRandom *random,
      66             :                                                      TClonesArray* recp) {
      67             :   // Fast points simulator 
      68             : 
      69             :   TClonesArray &pt=*recp;
      70           0 :   AliITS *aliITS  = (AliITS*)gAlice->GetModule("ITS");
      71           0 :   AliITSgeom *gm = aliITS->GetITSgeom();
      72             :   const Float_t kdEdXtoQ = 1.0e+6;  // GeV->KeV
      73             : 
      74           0 :   Int_t lay,lad,det;
      75           0 :   gm->GetModuleId(module,lay,lad,det);
      76           0 :   Int_t ind=(lad-1)*gm->GetNdetectors(lay)+(det-1);
      77           0 :   Int_t lyr=(lay-1);
      78             : 
      79             : 
      80           0 :   Int_t ihit,flag,numofhits;
      81           0 :   Float_t locals[3];
      82           0 :   Float_t globals[3];
      83             :   Double_t sigmarphi=0., sigmaz=0., sigmade=0., thrde=0.;
      84             :   Float_t deltaXl,deltaZl,deltaDe;
      85             : 
      86           0 :   Int_t hitlay, hitlad, hitdet, hitstatus;
      87           0 :   Float_t hitpx, hitpy, hitpz, hitdestep;
      88             : 
      89             :   Int_t   hitstatus1, hittrack1;
      90           0 :   Float_t hitx1, hity1, hitz1;
      91             :   Float_t hitdestep1;
      92           0 :   Float_t xMg,yMg,zMg;
      93             :   Int_t irecp=0;
      94           0 :   numofhits = mod->GetNhits();
      95             :   //printf("numofhits %d \n",numofhits);
      96           0 :   for(ihit=0;ihit<numofhits;ihit++){
      97           0 :     AliITShit *hit=mod->GetHit(ihit);
      98           0 :     hit->GetPositionG(hitx1,hity1,hitz1);
      99           0 :     hitstatus1 = hit->GetTrackStatus();
     100           0 :     hitdestep1 = hit->GetIonization();
     101           0 :     hittrack1 = hit->GetTrack();
     102             :     
     103           0 :     mod->MedianHit(module,hitx1,hity1,hitz1,hitstatus1,xMg,yMg,zMg,flag);
     104           0 :     if (flag!=1) {
     105           0 :       hitdestep = hit->GetIonization();
     106             :       
     107           0 :       if (hitdestep > 0) {
     108           0 :         hit->GetDetectorID(hitlay,hitlad,hitdet);
     109           0 :         hit->GetMomentumG(hitpx,hitpy,hitpz);            
     110             :         hitstatus = hitstatus1;
     111             :                 // Transform to the module local frame
     112           0 :         globals[0] = xMg; 
     113           0 :         globals[1] = yMg;
     114           0 :         globals[2] = zMg;
     115           0 :         gm->GtoL(hitlay,hitlad,hitdet,globals,locals);
     116             :         // Retrieve sigma values for position and energy, and energy
     117             :         // threshold
     118           0 :         sigmarphi = SigmaRPhi(hitlay);
     119           0 :         sigmaz = SigmaZ(hitlay);
     120           0 :         sigmade = SigmaDe(hitlay);
     121           0 :         thrde = ThrDe(hitlay);
     122           0 :         deltaXl = random->Gaus(0,sigmarphi);
     123           0 :         deltaZl = random->Gaus(0,sigmaz);
     124           0 :         deltaDe = random->Gaus(0,sigmade);
     125             :         
     126             :         // Apply energy threshold and trasform back to global reference
     127             :         // system
     128             :         
     129           0 :         if ( (hitdestep+deltaDe) > thrde ){
     130           0 :           locals[0] += deltaXl;
     131           0 :           locals[2] += deltaZl;
     132           0 :           Int_t lab[4] = {hit->GetTrack(),-3,-3,ind};
     133           0 :           Float_t q=kdEdXtoQ*(hitdestep+deltaDe);
     134           0 :           if(hitlay<3) q=1.; // SPD binary readout
     135           0 :           Float_t hitv[6] = {locals[0],locals[2],static_cast<Float_t>(sigmarphi*sigmarphi),static_cast<Float_t>(sigmaz*sigmaz),q,q};
     136           0 :           Int_t info[3] = {0,0,lyr};
     137           0 :           AliITSRecPoint rp(lab,hitv,info,kTRUE);
     138             : 
     139           0 :           new (pt[irecp]) AliITSRecPoint(rp);
     140           0 :           irecp++;
     141           0 :         } // end if ( (hitdestep+deltaDe)
     142             :       } // end if (hitdestep > 0)
     143             :     } // end if (flag!=1)
     144             :   } // end for ihit
     145           0 : }
     146             : //_______________________________________________________________________
     147             : void AliITSsimulationFastPoints::SetSigmaRPhi(Double_t  srphi[6])
     148             : {
     149             :   // set sigmas in rphi
     150             : 
     151             :     Int_t i;
     152           0 :     for (i=0; i<6; i++) {
     153           0 :         fSigmaRPhi[i]=srphi[i];
     154             :     }
     155           0 : }
     156             : //_______________________________________________________________________
     157             : void AliITSsimulationFastPoints::SetSigmaZ(Double_t  sz[6])
     158             : {
     159             :   // set sigmas in z
     160             : 
     161             :     Int_t i;
     162           0 :     for (i=0; i<6; i++) {
     163           0 :         fSigmaZ[i]=sz[i];
     164             :     }
     165           0 : }
     166             : //_______________________________________________________________________
     167             : void AliITSsimulationFastPoints::SetSigmaDe(Double_t  sde[6])
     168             : {
     169             :   // set sigmas in energy
     170             : 
     171             :     Int_t i;
     172           0 :     for (i=0; i<6; i++) {
     173           0 :         fSigmaDe[i]=sde[i];
     174             :     }
     175           0 : }
     176             : //_______________________________________________________________________
     177             : void AliITSsimulationFastPoints::SetThrDe(Double_t  thrde[6])
     178             : {
     179             :   // set energy thersholds
     180             : 
     181             :     Int_t i;
     182           0 :     for (i=0; i<6; i++) {
     183           0 :         fThrDe[i]=thrde[i];
     184             :     }
     185           0 : }
     186             : 

Generated by: LCOV version 1.11