1 /**************************************************************************
2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////
20 // Implementation of the class with array of AliITSDriftSpeedSDD //
21 // Origin: F.Prino, Torino, prino@to.infn.it //
23 ///////////////////////////////////////////////////////////////////
25 #include "AliITSDriftSpeedArraySDD.h"
26 #include "AliITSDriftSpeedSDD.h"
29 ClassImp(AliITSDriftSpeedArraySDD)
30 //______________________________________________________________________
31 AliITSDriftSpeedArraySDD::AliITSDriftSpeedArraySDD():
35 // default constructor
36 fDriftSpeedSDD.Expand(10);
38 //______________________________________________________________________
39 AliITSDriftSpeedArraySDD::AliITSDriftSpeedArraySDD(Int_t numEv):
43 // standard constructor
44 fDriftSpeedSDD.Expand(numEv);
46 //______________________________________________________________________
47 void AliITSDriftSpeedArraySDD::AddDriftSpeed(AliITSDriftSpeedSDD* drSpeed){
48 // adds an AliITSDriftSpeedSDD object in the array
49 fDriftSpeedSDD.AddLast(drSpeed);
52 //______________________________________________________________________
53 void AliITSDriftSpeedArraySDD::PrintAll() const{
54 // print drift speed parameters for all elements in the array
55 printf("Array Size=%d\n",fDriftSpeedSDD.GetSize());
56 printf("Array Elements =%d\n",fNEvents);
57 for(Int_t i=0;i<fNEvents; i++){
58 printf(" ====== Array el. #%d ======\n",i);
59 AliITSDriftSpeedSDD *d=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(i);
60 if(d) d->PrintDriftSpeedParameters();
63 //______________________________________________________________________
64 Double_t AliITSDriftSpeedArraySDD::GetDriftSpeed(Int_t iEvent, Double_t iAnode){
65 // returns drift speed for given event number and anode
66 if(!fDriftSpeedSDD.IsSorted()) fDriftSpeedSDD.Sort();
68 AliITSDriftSpeedSDD *d=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(0);
69 return d->GetDriftSpeedAtAnode(iAnode);
73 AliITSDriftSpeedSDD *d1=NULL;
74 AliITSDriftSpeedSDD *d2=NULL;
75 for(Int_t i=0;i<fNEvents; i++){
77 d2=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(i);
80 nInjEv2=d2->GetEventNumber();
82 if(i==0) d1=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(i+1);
83 nInjEv1=d1->GetEventNumber();
88 if(nInjEv1>=0 && nInjEv2>=0 && nInjEv1!=nInjEv2){
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;
95 AliWarning("Vdrift interpolation error\n");