]>
Commit | Line | Data |
---|---|---|
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 | ||
29 | ClassImp(AliITSDriftSpeedArraySDD) | |
30 | //______________________________________________________________________ | |
31 | AliITSDriftSpeedArraySDD::AliITSDriftSpeedArraySDD(): | |
32 | TObject(), | |
33 | fNEvents(0), | |
7b208ef4 | 34 | fDriftSpeedSDD(10){ |
18da6e54 | 35 | // default constructor |
18da6e54 | 36 | } |
37 | //______________________________________________________________________ | |
38 | AliITSDriftSpeedArraySDD::AliITSDriftSpeedArraySDD(Int_t numEv): | |
39 | TObject(), | |
40 | fNEvents(0), | |
7b208ef4 | 41 | fDriftSpeedSDD(numEv){ |
18da6e54 | 42 | // standard constructor |
18da6e54 | 43 | } |
44 | //______________________________________________________________________ | |
45 | void AliITSDriftSpeedArraySDD::AddDriftSpeed(AliITSDriftSpeedSDD* drSpeed){ | |
46 | // adds an AliITSDriftSpeedSDD object in the array | |
4c1bcb5e | 47 | fDriftSpeedSDD.AddLast(drSpeed); |
18da6e54 | 48 | fNEvents++; |
18da6e54 | 49 | } |
50 | //______________________________________________________________________ | |
51 | void AliITSDriftSpeedArraySDD::PrintAll() const{ | |
52 | // print drift speed parameters for all elements in the array | |
4c1bcb5e | 53 | printf("Array Size=%d\n",fDriftSpeedSDD.GetSize()); |
18da6e54 | 54 | printf("Array Elements =%d\n",fNEvents); |
55 | for(Int_t i=0;i<fNEvents; i++){ | |
56 | printf(" ====== Array el. #%d ======\n",i); | |
4c1bcb5e | 57 | AliITSDriftSpeedSDD *d=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(i); |
18da6e54 | 58 | if(d) d->PrintDriftSpeedParameters(); |
59 | } | |
60 | } | |
61 | //______________________________________________________________________ | |
5990cdfe | 62 | UInt_t AliITSDriftSpeedArraySDD::GetTimestamp(Int_t iElement){ |
63 | // returns time stamp | |
64 | if(!fDriftSpeedSDD.IsSorted()) fDriftSpeedSDD.Sort(); | |
65 | if(fNEvents<iElement) return 0; | |
66 | AliITSDriftSpeedSDD *d=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(iElement); | |
67 | return d->GetEventTimestamp(); | |
68 | } | |
69 | //______________________________________________________________________ | |
4c1bcb5e | 70 | Double_t AliITSDriftSpeedArraySDD::GetDriftSpeed(Int_t iEvent, Double_t iAnode){ |
18da6e54 | 71 | // returns drift speed for given event number and anode |
4c1bcb5e | 72 | if(!fDriftSpeedSDD.IsSorted()) fDriftSpeedSDD.Sort(); |
18da6e54 | 73 | if(fNEvents==1){ |
4c1bcb5e | 74 | AliITSDriftSpeedSDD *d=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(0); |
18da6e54 | 75 | return d->GetDriftSpeedAtAnode(iAnode); |
76 | }else{ | |
77 | Int_t nInjEv1=-1; | |
78 | Int_t nInjEv2=-1; | |
79 | AliITSDriftSpeedSDD *d1=NULL; | |
80 | AliITSDriftSpeedSDD *d2=NULL; | |
81 | for(Int_t i=0;i<fNEvents; i++){ | |
82 | d1=d2; | |
4c1bcb5e | 83 | d2=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(i); |
18da6e54 | 84 | nInjEv1=nInjEv2; |
85 | if(d2!=0){ | |
86 | nInjEv2=d2->GetEventNumber(); | |
87 | if(nInjEv2>=iEvent){ | |
4c1bcb5e | 88 | if(i==0) d1=(AliITSDriftSpeedSDD*)fDriftSpeedSDD.At(i+1); |
18da6e54 | 89 | nInjEv1=d1->GetEventNumber(); |
90 | break; | |
91 | } | |
92 | } | |
93 | } | |
94 | if(nInjEv1>=0 && nInjEv2>=0 && nInjEv1!=nInjEv2){ | |
4c1bcb5e | 95 | Double_t v1=d1->GetDriftSpeedAtAnode(iAnode); |
96 | Double_t v2=d2->GetDriftSpeedAtAnode(iAnode); | |
97 | Double_t vdrift=(v2-v1)*(iEvent-nInjEv1)/(nInjEv2-nInjEv1)+v1; | |
18da6e54 | 98 | return vdrift; |
99 | } | |
100 | } | |
101 | AliWarning("Vdrift interpolation error\n"); | |
102 | return -999.; | |
103 | } |