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