]>
Commit | Line | Data |
---|---|---|
6740ab97 | 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 | **************************************************************************/ | |
4c475d27 | 15 | |
88cb7938 | 16 | /* $Id$ */ |
ef0750c2 | 17 | |
88cb7938 | 18 | #include <Riostream.h> |
94de3818 | 19 | |
88cb7938 | 20 | #include <TDirectory.h> |
ef51244a | 21 | |
a8859328 | 22 | #include "AliRunLoader.h" |
23 | #include "AliRun.h" | |
affef71b | 24 | #include <AliESD.h> |
460b4363 | 25 | #include "AliLog.h" |
db173afc | 26 | #include <TClonesArray.h> |
27 | #include "AliSTARTRecPoint.h" | |
28 | #include "AliRawReader.h" | |
29 | #include "AliSTARTRawReader.h" | |
460b4363 | 30 | #include "AliSTARTLoader.h" |
31 | #include "AliSTARTdigit.h" | |
32 | #include "AliSTARTReconstructor.h" | |
33 | #include "AliSTARTParameters.h" | |
34 | #include "AliSTARTAlignData.h" | |
35 | #include "AliSTARTCalibData.h" | |
36 | #include "AliCDBLocal.h" | |
37 | #include "AliCDBStorage.h" | |
38 | #include "AliCDBManager.h" | |
39 | #include "AliCDBEntry.h" | |
40 | ||
41 | #include <TArrayI.h> | |
4c7da157 | 42 | #include <TGraph.h> |
460b4363 | 43 | |
121a60bd | 44 | ClassImp(AliSTARTReconstructor) |
460b4363 | 45 | AliSTARTAlignData* AliSTARTReconstructor::fgAlignData = 0; |
46 | AliSTARTCalibData* AliSTARTReconstructor::fgCalibData = 0; | |
6740ab97 | 47 | |
db173afc | 48 | void AliSTARTReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const |
121a60bd | 49 | { |
db173afc | 50 | //START raw data-> digits conversion |
51 | // reconstruct time information from raw data | |
52 | AliSTARTRawReader myrawreader(rawReader,digitsTree); | |
4c7da157 | 53 | // myrawreader.NextThing(); |
54 | myrawreader.Next(); | |
55 | cout<<" AliSTARTReconstructor::ConvertDigits "<< myrawreader.Next()<<endl; | |
121a60bd | 56 | } |
db173afc | 57 | void AliSTARTReconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const |
58 | { | |
59 | // START digits reconstruction | |
60 | // STARTRecPoint writing | |
61 | ||
460b4363 | 62 | //Q->T-> coefficients !!!! should be asked!!! |
63 | // Float_t ph2MIP=500; | |
64 | Float_t gain[24], timeDelayCFD[24], timeDelayLED[24]; | |
460b4363 | 65 | Float_t zdetA,zdetC; |
66 | TObjArray slewingLED; | |
67 | ||
68 | TArrayI * fADC = new TArrayI(24); | |
69 | TArrayI * fTimeCFD = new TArrayI(24); | |
70 | TArrayI * fADCLED = new TArrayI(24); | |
71 | TArrayI * fTimeLED = new TArrayI(24); | |
72 | ||
73 | AliSTARTParameters* param = AliSTARTParameters::Instance(); | |
b2214376 | 74 | param->Init(); |
4c7da157 | 75 | |
76 | Int_t mV2Mip = param->GetmV2Mip(); | |
460b4363 | 77 | Int_t channelWidth = param->GetChannelWidth() ; |
78 | ||
4c7da157 | 79 | for (Int_t i=0; i<24; i++){ |
80 | timeDelayCFD[i] = param->GetTimeDelayCFD(i); | |
81 | timeDelayLED[i] = param->GetTimeDelayLED(i); | |
82 | gain[i] = param->GetGain(i); | |
83 | slewingLED.AddAtAndExpand(param->GetSlew(i),i); | |
84 | } | |
85 | zdetC = param->GetZposition(0); | |
86 | zdetA = param->GetZposition(1); | |
87 | ||
db173afc | 88 | AliDebug(1,Form("Start DIGITS reconstruction ")); |
b2214376 | 89 | |
db173afc | 90 | TBranch *brDigits=digitsTree->GetBranch("START"); |
91 | AliSTARTdigit *fDigits = new AliSTARTdigit(); | |
92 | if (brDigits) { | |
93 | brDigits->SetAddress(&fDigits); | |
94 | }else{ | |
95 | cerr<<"EXEC Branch START digits not found"<<endl; | |
96 | return; | |
97 | } | |
98 | brDigits->GetEntry(0); | |
460b4363 | 99 | fDigits->GetTime(*fTimeCFD); |
460b4363 | 100 | fDigits->GetADC(*fADC); |
101 | fDigits->GetTimeAmp(*fTimeLED); | |
102 | fDigits->GetADCAmp(*fADCLED); | |
103 | ||
4c7da157 | 104 | Float_t besttimeright=999999; |
105 | Float_t besttimeleft=999999; | |
106 | Int_t pmtBestRight=99999; | |
107 | Int_t pmtBestLeft=99999; | |
108 | Float_t timeDiff=999999, meanTime=0; | |
109 | ||
110 | AliSTARTRecPoint* frecpoints= new AliSTARTRecPoint (); | |
111 | clustersTree->Branch( "START", "AliSTARTRecPoint" ,&frecpoints, 405,1); | |
112 | ||
460b4363 | 113 | Float_t time[24], adc[24]; |
114 | for (Int_t ipmt=0; ipmt<24; ipmt++) | |
115 | { | |
116 | ||
b2214376 | 117 | if(fTimeCFD->At(ipmt)>0 ){ |
118 | time[ipmt] = channelWidth *( fTimeCFD->At(ipmt)) - 1000*timeDelayCFD[ipmt]; | |
b2214376 | 119 | Float_t adc_digPs = channelWidth * Float_t (fADC->At(ipmt)) ; |
b2214376 | 120 | adc[ipmt] = TMath::Exp(adc_digPs/1000) /gain[ipmt]; |
4c7da157 | 121 | AliDebug(1,Form(" time %f ps, adc %f mv in MIP %i\n ", |
122 | time[ipmt], adc[ipmt], Int_t (adc[ipmt]/mV2Mip +0.5))); | |
123 | frecpoints->SetTime(ipmt,time[ipmt]); | |
124 | frecpoints->SetAmp(ipmt,adc[ipmt]); | |
125 | } | |
460b4363 | 126 | } |
4c7da157 | 127 | for (Int_t ipmt=0; ipmt<12; ipmt++){ |
128 | if(time[ipmt] > 1 ) { | |
129 | if(time[ipmt]<besttimeleft){ | |
130 | besttimeleft=time[ipmt]; //timeleft | |
131 | pmtBestLeft=ipmt; | |
132 | } | |
133 | } | |
db173afc | 134 | } |
4c7da157 | 135 | for ( Int_t ipmt=12; ipmt<24; ipmt++){ |
136 | if(time[ipmt] > 1) { | |
137 | if(time[ipmt]<besttimeright) { | |
138 | besttimeright=time[ipmt]; //timeright | |
139 | pmtBestRight=ipmt;} | |
140 | } | |
141 | } | |
142 | if(besttimeright !=999999) frecpoints->SetTimeBestRight(Int_t(besttimeright)); | |
143 | if( besttimeleft != 999999 ) frecpoints->SetTimeBestLeft(Int_t(besttimeleft)); | |
144 | AliDebug(1,Form(" besttimeright %f ps, besttimeleft %f ps",besttimeright, besttimeleft)); | |
145 | Float_t c = 0.0299792; // cm/ps | |
146 | Float_t vertex = 0; | |
147 | if(besttimeright !=999999 && besttimeleft != 999999 ){ | |
148 | timeDiff = besttimeright - besttimeleft; | |
149 | meanTime = (besttimeright + besttimeleft)/2.; | |
150 | vertex = c*(timeDiff); //-(lenr-lenl))/2; | |
151 | AliDebug(1,Form(" timeDiff %f ps, meanTime %f ps, vertex %f cm",timeDiff, meanTime,vertex )); | |
152 | frecpoints->SetVertex(vertex); | |
153 | frecpoints->SetMeanTime(Int_t(meanTime)); | |
154 | ||
155 | } | |
db173afc | 156 | clustersTree->Fill(); |
157 | } | |
158 | ||
159 | ||
160 | void AliSTARTReconstructor::FillESD(AliRunLoader* runLoader, AliESD *pESD) const | |
6740ab97 | 161 | { |
db173afc | 162 | |
f3ed336b | 163 | /*************************************************** |
164 | Resonstruct digits to vertex position | |
165 | ****************************************************/ | |
db173afc | 166 | |
db173afc | 167 | |
168 | if (!runLoader) { | |
169 | AliError("Reconstruct >> No run loader"); | |
6fc133d2 | 170 | return; |
171 | } | |
db173afc | 172 | |
173 | AliDebug(1,Form("Start FillESD START")); | |
affef71b | 174 | |
db173afc | 175 | AliSTARTLoader* pStartLoader = (AliSTARTLoader*) runLoader->GetLoader("STARTLoader"); |
6fc133d2 | 176 | |
db173afc | 177 | pStartLoader->LoadRecPoints("READ"); |
4c7da157 | 178 | |
179 | TTree *treeR = pStartLoader->TreeR(); | |
db173afc | 180 | |
181 | AliSTARTRecPoint* frecpoints= new AliSTARTRecPoint (); | |
182 | if (!frecpoints) { | |
183 | AliError("Reconstruct Fill ESD >> no recpoints found"); | |
6fc133d2 | 184 | return; |
185 | } | |
a8859328 | 186 | |
db173afc | 187 | AliDebug(1,Form("Start FillESD START")); |
4c7da157 | 188 | TBranch *brRec = treeR->GetBranch("START"); |
189 | if (brRec) { | |
190 | brRec->SetAddress(&frecpoints); | |
191 | }else{ | |
192 | cerr<<"EXEC Branch START rec not found"<<endl; | |
193 | // exit(111); | |
194 | return; | |
195 | } | |
196 | ||
db173afc | 197 | brRec->GetEntry(0); |
198 | Float_t Zposition=frecpoints->GetVertex(); | |
db173afc | 199 | pESD->SetT0zVertex(Zposition); |
4c7da157 | 200 | pESD->Dump(); |
db173afc | 201 | pStartLoader->UnloadRecPoints(); |
4c7da157 | 202 | |
db173afc | 203 | } // vertex in 3 sigma |
6740ab97 | 204 | |
205 | ||
206 | ||
207 | ||
7115262b | 208 | |
209 |