]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSDriftSpeedArraySDD.cxx
- Introduce fixed step size for material retrieval from TGeo, default is 1mm,
[u/mrichter/AliRoot.git] / ITS / AliITSDriftSpeedArraySDD.cxx
CommitLineData
18da6e54 1/**************************************************************************
2 * Copyright(c) 2007-2009, 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// //
20// Implementation of the class with array of AliITSDriftSpeedSDD //
21// Origin: F.Prino, Torino, prino@to.infn.it //
22// //
23///////////////////////////////////////////////////////////////////
24
18da6e54 25#include "AliITSDriftSpeedArraySDD.h"
26#include "AliITSDriftSpeedSDD.h"
27#include "AliLog.h"
28
29ClassImp(AliITSDriftSpeedArraySDD)
30//______________________________________________________________________
31AliITSDriftSpeedArraySDD::AliITSDriftSpeedArraySDD():
32TObject(),
33fNEvents(0),
4c1bcb5e 34fDriftSpeedSDD(){
18da6e54 35 // default constructor
4c1bcb5e 36 fDriftSpeedSDD.Expand(10);
18da6e54 37}
38//______________________________________________________________________
39AliITSDriftSpeedArraySDD::AliITSDriftSpeedArraySDD(Int_t numEv):
40TObject(),
41fNEvents(0),
4c1bcb5e 42fDriftSpeedSDD(){
18da6e54 43 // standard constructor
4c1bcb5e 44 fDriftSpeedSDD.Expand(numEv);
18da6e54 45}
46//______________________________________________________________________
47void AliITSDriftSpeedArraySDD::AddDriftSpeed(AliITSDriftSpeedSDD* drSpeed){
48 // adds an AliITSDriftSpeedSDD object in the array
4c1bcb5e 49 fDriftSpeedSDD.AddLast(drSpeed);
18da6e54 50 fNEvents++;
18da6e54 51}
52//______________________________________________________________________
53void AliITSDriftSpeedArraySDD::PrintAll() const{
54 // print drift speed parameters for all elements in the array
4c1bcb5e 55 printf("Array Size=%d\n",fDriftSpeedSDD.GetSize());
18da6e54 56 printf("Array Elements =%d\n",fNEvents);
57 for(Int_t i=0;i<fNEvents; i++){
58 printf(" ====== Array el. #%d ======\n",i);
4c1bcb5e 59 AliITSDriftSpeedSDD *d=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(i);
18da6e54 60 if(d) d->PrintDriftSpeedParameters();
61 }
62}
63//______________________________________________________________________
4c1bcb5e 64Double_t AliITSDriftSpeedArraySDD::GetDriftSpeed(Int_t iEvent, Double_t iAnode){
18da6e54 65 // returns drift speed for given event number and anode
4c1bcb5e 66 if(!fDriftSpeedSDD.IsSorted()) fDriftSpeedSDD.Sort();
18da6e54 67 if(fNEvents==1){
4c1bcb5e 68 AliITSDriftSpeedSDD *d=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(0);
18da6e54 69 return d->GetDriftSpeedAtAnode(iAnode);
70 }else{
71 Int_t nInjEv1=-1;
72 Int_t nInjEv2=-1;
73 AliITSDriftSpeedSDD *d1=NULL;
74 AliITSDriftSpeedSDD *d2=NULL;
75 for(Int_t i=0;i<fNEvents; i++){
76 d1=d2;
4c1bcb5e 77 d2=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(i);
18da6e54 78 nInjEv1=nInjEv2;
79 if(d2!=0){
80 nInjEv2=d2->GetEventNumber();
81 if(nInjEv2>=iEvent){
4c1bcb5e 82 if(i==0) d1=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(i+1);
18da6e54 83 nInjEv1=d1->GetEventNumber();
84 break;
85 }
86 }
87 }
88 if(nInjEv1>=0 && nInjEv2>=0 && nInjEv1!=nInjEv2){
4c1bcb5e 89 Double_t v1=d1->GetDriftSpeedAtAnode(iAnode);
90 Double_t v2=d2->GetDriftSpeedAtAnode(iAnode);
91 Double_t vdrift=(v2-v1)*(iEvent-nInjEv1)/(nInjEv2-nInjEv1)+v1;
18da6e54 92 return vdrift;
93 }
94 }
95 AliWarning("Vdrift interpolation error\n");
96 return -999.;
97}