]>
Commit | Line | Data |
---|---|---|
4c039060 | 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 | **************************************************************************/ | |
15 | ||
88cb7938 | 16 | /* $Id$ */ |
4c039060 | 17 | |
fe4da5cc | 18 | /////////////////////////////////////////////////////////////////////////////// |
19 | // // | |
359cdddc | 20 | // Zero Degree Calorimeter // |
21 | // This class contains the basic functions for the ZDCs; // | |
22 | // functions specific to one particular geometry are // | |
23 | // contained in the derived classes // | |
fe4da5cc | 24 | // // |
fe4da5cc | 25 | /////////////////////////////////////////////////////////////////////////////// |
26 | ||
f901045b | 27 | // --- ROOT system |
7ca4655f | 28 | #include <TClonesArray.h> |
88cb7938 | 29 | #include <TTree.h> |
232b622f | 30 | #include <TFile.h> |
8af17dba | 31 | #include <TSystem.h> |
90001c80 | 32 | #include <TRandom.h> |
ae3870e6 | 33 | #include <TParticle.h> |
fe4da5cc | 34 | |
f901045b | 35 | // --- AliRoot header files |
88cb7938 | 36 | #include "AliDetector.h" |
f7ee745b | 37 | #include "AliRawDataHeaderSim.h" |
90001c80 | 38 | #include "AliRawReader.h" |
39 | #include "AliLoader.h" | |
40 | #include "AliRun.h" | |
41 | #include "AliMC.h" | |
42 | #include "AliLog.h" | |
43 | #include "AliDAQ.h" | |
fe4da5cc | 44 | #include "AliZDC.h" |
f901045b | 45 | #include "AliZDCHit.h" |
6de91202 | 46 | #include "AliZDCSDigit.h" |
47 | #include "AliZDCDigit.h" | |
48 | #include "AliZDCDigitizer.h" | |
49 | #include "AliZDCRawStream.h" | |
6024ec85 | 50 | #include "AliZDCPedestals.h" |
73bc3a3f | 51 | #include "AliZDCEnCalib.h" |
52 | #include "AliZDCTowerCalib.h" | |
08f92f14 | 53 | #include "AliFstream.h" |
88cb7938 | 54 | |
fe4da5cc | 55 | |
56 | ClassImp(AliZDC) | |
8af17dba | 57 | |
fe4da5cc | 58 | //_____________________________________________________________________________ |
cc2abffd | 59 | AliZDC::AliZDC() : |
60 | AliDetector(), | |
a718c993 | 61 | fNoShower(0), |
6024ec85 | 62 | fPedCalib(0), |
73bc3a3f | 63 | fEnCalibData(0), |
64 | fTowCalibData(0), | |
a18a0543 | 65 | fZDCCalibFName(""), |
f2e2aa97 | 66 | fSpectatorTracked(1), |
5d24ec95 | 67 | fBeamEnergy(0.), |
68 | fIspASystem(kFALSE), | |
183673e3 | 69 | fIsRELDISgen(kFALSE), |
70 | fOnlyZEM(kFALSE) | |
fe4da5cc | 71 | { |
72 | // | |
73 | // Default constructor for the Zero Degree Calorimeter base class | |
74 | // | |
2e6fc82a | 75 | |
cc2abffd | 76 | fIshunt = 1; |
77 | fNhits = 0; | |
78 | fHits = 0; | |
79 | fDigits = 0; | |
80 | fNdigits = 0; | |
d16dd065 | 81 | |
fe4da5cc | 82 | } |
83 | ||
84 | //_____________________________________________________________________________ | |
cc2abffd | 85 | AliZDC::AliZDC(const char *name, const char *title) : |
86 | AliDetector(name,title), | |
183673e3 | 87 | fNoShower(0), |
6024ec85 | 88 | fPedCalib(0), |
73bc3a3f | 89 | fEnCalibData(0), |
90 | fTowCalibData(0), | |
a18a0543 | 91 | fZDCCalibFName(""), |
f2e2aa97 | 92 | fSpectatorTracked(1), |
5d24ec95 | 93 | fBeamEnergy(0.), |
94 | fIspASystem(kFALSE), | |
183673e3 | 95 | fIsRELDISgen(kFALSE), |
96 | fOnlyZEM(kFALSE) | |
fe4da5cc | 97 | { |
98 | // | |
99 | // Standard constructor for the Zero Degree Calorimeter base class | |
100 | // | |
cc2abffd | 101 | |
102 | fIshunt = 1; | |
103 | fNhits = 0; | |
104 | fDigits = 0; | |
105 | fNdigits = 0; | |
106 | ||
107 | fHits = new TClonesArray("AliZDCHit",1000); | |
5d12ce38 | 108 | gAlice->GetMCApp()->AddHitList(fHits); |
8af17dba | 109 | |
83534754 | 110 | SetName("ZDC"); SetTitle("ZDC"); |
f901045b | 111 | |
866ab5a2 | 112 | } |
cc2abffd | 113 | |
866ab5a2 | 114 | //____________________________________________________________________________ |
115 | AliZDC::~AliZDC() | |
116 | { | |
117 | // | |
118 | // ZDC destructor | |
119 | // | |
120 | ||
cc2abffd | 121 | fIshunt = 0; |
73bc3a3f | 122 | if(fPedCalib) delete fPedCalib; |
123 | if(fEnCalibData) delete fEnCalibData; | |
124 | if(fEnCalibData) delete fEnCalibData; | |
d16dd065 | 125 | |
fe4da5cc | 126 | } |
cc2abffd | 127 | |
128 | //_____________________________________________________________________________ | |
129 | AliZDC::AliZDC(const AliZDC& ZDC) : | |
a718c993 | 130 | AliDetector("ZDC","ZDC"), |
131 | fNoShower(ZDC.fNoShower), | |
132 | fPedCalib(ZDC.fPedCalib), | |
73bc3a3f | 133 | fEnCalibData(ZDC.fEnCalibData), |
134 | fTowCalibData(ZDC.fTowCalibData), | |
a18a0543 | 135 | fZDCCalibFName(ZDC.fZDCCalibFName), |
f2e2aa97 | 136 | fSpectatorTracked(ZDC.fSpectatorTracked), |
5d24ec95 | 137 | fBeamEnergy(ZDC.fBeamEnergy), |
138 | fIspASystem(ZDC.fIspASystem), | |
183673e3 | 139 | fIsRELDISgen(ZDC.fIsRELDISgen), |
140 | fOnlyZEM(ZDC.fOnlyZEM) | |
cc2abffd | 141 | { |
142 | // copy constructor | |
cc2abffd | 143 | } |
144 | ||
145 | //_____________________________________________________________________________ | |
146 | AliZDC& AliZDC::operator=(const AliZDC& ZDC) | |
147 | { | |
148 | // assignement operator | |
149 | if(this!=&ZDC){ | |
150 | fNoShower = ZDC.fNoShower; | |
6024ec85 | 151 | fPedCalib = ZDC.fPedCalib; |
73bc3a3f | 152 | fEnCalibData = ZDC.fEnCalibData; |
153 | fTowCalibData = ZDC.fTowCalibData; | |
cc2abffd | 154 | fZDCCalibFName = ZDC.fZDCCalibFName; |
5d24ec95 | 155 | fBeamEnergy = ZDC.fBeamEnergy; |
f2e2aa97 | 156 | fIspASystem = ZDC.fIspASystem; |
183673e3 | 157 | fIsRELDISgen = ZDC.fIsRELDISgen; |
158 | fOnlyZEM = ZDC.fOnlyZEM; | |
cc2abffd | 159 | } return *this; |
160 | } | |
161 | ||
fe4da5cc | 162 | //_____________________________________________________________________________ |
163 | void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits) | |
164 | { | |
165 | // | |
f901045b | 166 | // Add a ZDC hit to the hit list. |
f901045b | 167 | |
949a5a55 | 168 | static Float_t trackTime=0., trackEta=0., primKinEn=0., xImpact=0., yImpact=0., sFlag=0.; |
183673e3 | 169 | static Int_t pcPDGcode=0, motPDGcode=0; |
68ca986e | 170 | |
43f34e8b | 171 | AliZDCHit *newquad, *curprimquad; |
f901045b | 172 | newquad = new AliZDCHit(fIshunt, track, vol, hits); |
65d4f2be | 173 | TClonesArray &lhits = *fHits; |
cefa66cb | 174 | |
175 | if(fNhits==0){ | |
176 | // First hit -> setting flag for primary or secondary particle | |
183673e3 | 177 | /*TParticle * p = gAlice->GetMCApp()->Particle(track); |
ae3870e6 | 178 | Int_t imo = p->GetFirstMother(); |
47709f57 | 179 | // |
ae3870e6 | 180 | if(track != imo){ |
3ff116f2 | 181 | newquad->SetSFlag(1); // SECONDARY particle entering the ZDC |
cefa66cb | 182 | } |
ae3870e6 | 183 | else if(track == imo){ |
3ff116f2 | 184 | newquad->SetSFlag(0); // PRIMARY particle entering the ZDC |
183673e3 | 185 | }*/ |
ae3870e6 | 186 | // |
187 | sFlag = newquad->GetSFlag(); | |
188 | primKinEn = newquad->GetPrimKinEn(); | |
189 | xImpact = newquad->GetXImpact(); | |
190 | yImpact = newquad->GetYImpact(); | |
191 | pcPDGcode = newquad->GetPDGCode(); | |
192 | motPDGcode = newquad->GetMotherPDGCode(); | |
193 | trackTime = newquad->GetTrackTOF(); | |
949a5a55 | 194 | trackEta = newquad->GetTrackEta(); |
cefa66cb | 195 | } |
196 | else{ | |
3ff116f2 | 197 | newquad->SetPrimKinEn(primKinEn); |
198 | newquad->SetXImpact(xImpact); | |
199 | newquad->SetYImpact(yImpact); | |
200 | newquad->SetSFlag(sFlag); | |
47709f57 | 201 | newquad->SetPDGCode(pcPDGcode); |
ae3870e6 | 202 | newquad->SetMotherPDGCode(motPDGcode); |
f7f9e40c | 203 | newquad->SetTrackTOF(trackTime); |
949a5a55 | 204 | newquad->SetTrackEta(trackEta); |
cefa66cb | 205 | } |
206 | ||
43f34e8b | 207 | Int_t j; |
f901045b | 208 | for(j=0; j<fNhits; j++){ |
2e6fc82a | 209 | // If hits are equal (same track, same volume), sum them. |
f901045b | 210 | curprimquad = (AliZDCHit*) lhits[j]; |
211 | if(*curprimquad == *newquad){ | |
212 | *curprimquad = *curprimquad+*newquad; | |
a85b769a | 213 | // Ch. debug |
214 | //printf("\n\t Summing hits **************** \n", fNhits); | |
215 | //curprimquad->Print(""); | |
cc2abffd | 216 | // |
f901045b | 217 | delete newquad; |
68ca986e | 218 | return; |
f901045b | 219 | } |
220 | } | |
f901045b | 221 | |
222 | //Otherwise create a new hit | |
cc2abffd | 223 | new(lhits[fNhits]) AliZDCHit(*newquad); |
f901045b | 224 | fNhits++; |
a85b769a | 225 | // Ch. debug |
226 | //printf("\n\t New ZDC hit added! fNhits = %d\n", fNhits); | |
227 | //newquad->Print(""); | |
228 | ||
866ab5a2 | 229 | delete newquad; |
cefa66cb | 230 | } |
231 | ||
359cdddc | 232 | //____________________________________________________________________________ |
233 | Float_t AliZDC::ZMin(void) const | |
234 | { | |
235 | // Minimum dimension of the ZDC module in z | |
6de91202 | 236 | return -11600.; |
359cdddc | 237 | } |
238 | ||
239 | //____________________________________________________________________________ | |
240 | Float_t AliZDC::ZMax(void) const | |
241 | { | |
242 | // Maximum dimension of the ZDC module in z | |
382e174b | 243 | return 11750.; |
359cdddc | 244 | } |
245 | ||
246 | ||
fe4da5cc | 247 | //_____________________________________________________________________________ |
5bc762ca | 248 | void AliZDC::MakeBranch(Option_t *opt) |
fe4da5cc | 249 | { |
250 | // | |
359cdddc | 251 | // Create Tree branches for the ZDC |
fe4da5cc | 252 | // |
359cdddc | 253 | |
254 | char branchname[10]; | |
83534754 | 255 | snprintf(branchname, 10, "%s", GetName()); |
88cb7938 | 256 | |
257 | const char *cH = strstr(opt,"H"); | |
258 | ||
382e174b | 259 | if(cH && fLoader->TreeH()) { |
260 | if (fHits) { | |
261 | fHits->Clear(); | |
262 | fNhits = 0; | |
263 | } | |
264 | else { | |
265 | fHits = new TClonesArray("AliZDCHit",1000); | |
266 | if (gAlice && gAlice->GetMCApp()) | |
267 | gAlice->GetMCApp()->AddHitList(fHits); | |
268 | } | |
269 | } | |
359cdddc | 270 | |
271 | AliDetector::MakeBranch(opt); | |
1450a7cd | 272 | } |
1450a7cd | 273 | |
b6d27557 | 274 | //_____________________________________________________________________________ |
275 | void AliZDC::Hits2SDigits() | |
276 | { | |
6de91202 | 277 | // Create summable digits from hits |
278 | ||
9f4f3539 | 279 | AliDebug(1,"\n AliZDC::Hits2SDigits() "); |
b6d27557 | 280 | |
85a5290f | 281 | fLoader->LoadHits("read"); |
282 | fLoader->LoadSDigits("recreate"); | |
6de91202 | 283 | AliRunLoader* runLoader = fLoader->GetRunLoader(); |
284 | AliZDCSDigit sdigit; | |
285 | AliZDCSDigit* psdigit = &sdigit; | |
85a5290f | 286 | |
6de91202 | 287 | // Event loop |
90001c80 | 288 | for(Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) { |
ce1f03da | 289 | Float_t pmZNC[5], pmZPC[5], pmZNA[5], pmZPA[5], pmZEM1=0., pmZEM2=0.; |
3eb4fd1c | 290 | for(Int_t i=0; i<5; i++) pmZNC[i] = pmZPC[i] = pmZNA[i] = pmZPA[i] = 0; |
85a5290f | 291 | |
6de91202 | 292 | runLoader->GetEvent(iEvent); |
293 | TTree* treeH = fLoader->TreeH(); | |
359cdddc | 294 | Int_t ntracks = (Int_t) treeH->GetEntries(); |
6de91202 | 295 | ResetHits(); |
296 | ||
359cdddc | 297 | // Tracks loop |
d9ec113e | 298 | Int_t sector[2]; Float_t trackTime = 0.; |
90001c80 | 299 | for(Int_t itrack = 0; itrack < ntracks; itrack++) { |
6de91202 | 300 | treeH->GetEntry(itrack); |
90001c80 | 301 | for(AliZDCHit* zdcHit = (AliZDCHit*)FirstHit(-1); zdcHit; |
ce1f03da | 302 | zdcHit = (AliZDCHit*)NextHit()) { |
b6d27557 | 303 | |
6de91202 | 304 | sector[0] = zdcHit->GetVolume(0); |
305 | sector[1] = zdcHit->GetVolume(1); | |
ce1f03da | 306 | if((sector[1] < 1) || (sector[1]>5)) { |
307 | Error("Hits2SDigits", "sector[0] = %d, sector[1] = %d", sector[0], sector[1]); | |
6de91202 | 308 | continue; |
309 | } | |
310 | Float_t lightQ = zdcHit->GetLightPMQ(); | |
311 | Float_t lightC = zdcHit->GetLightPMC(); | |
9f4f3539 | 312 | trackTime = zdcHit->GetTrackTOF(); |
fd9afd60 | 313 | // Signals from ZEM are delayed to arrive in time with ZDC signals |
314 | if(sector[0] == 3) trackTime += 320; | |
ce1f03da | 315 | // Ch. debug |
316 | //printf("\t det %d vol %d trackTOF %f lightQ %1.0f lightC %1.0f\n", | |
317 | // sector[0], sector[1], trackTime, lightQ, lightC); | |
6de91202 | 318 | |
80e87581 | 319 | if(sector[0] == 1) { //ZNC |
ce1f03da | 320 | pmZNC[0] += lightC; |
321 | pmZNC[sector[1]] += lightQ; | |
80e87581 | 322 | } |
323 | else if(sector[0] == 2) { //ZPC | |
ce1f03da | 324 | pmZPC[0] += lightC; |
325 | pmZPC[sector[1]] += lightQ; | |
80e87581 | 326 | } |
327 | else if(sector[0] == 3) { //ZEM | |
90001c80 | 328 | if(sector[1] == 1) pmZEM1 += lightC; |
80e87581 | 329 | else pmZEM2 += lightQ; |
6de91202 | 330 | } |
80e87581 | 331 | if(sector[0] == 4) { //ZNA |
ce1f03da | 332 | pmZNA[0] += lightC; |
333 | pmZNA[sector[1]] += lightQ; | |
80e87581 | 334 | } |
335 | else if(sector[0] == 5) { //ZPA | |
ce1f03da | 336 | pmZPA[0] += lightC; |
337 | pmZPA[sector[1]] += lightQ; | |
80e87581 | 338 | } |
6de91202 | 339 | }//Hits loop |
ce1f03da | 340 | }//Tracks loop |
6de91202 | 341 | |
342 | // create the output tree | |
343 | fLoader->MakeTree("S"); | |
344 | TTree* treeS = fLoader->TreeS(); | |
345 | const Int_t kBufferSize = 4000; | |
346 | treeS->Branch(GetName(), "AliZDCSDigit", &psdigit, kBufferSize); | |
347 | ||
80e87581 | 348 | // Create sdigits for ZNC |
349 | sector[0] = 1; // Detector = ZNC | |
ce1f03da | 350 | for(Int_t j = 0; j < 5; j++) { |
351 | sector[1] = j; | |
352 | if(pmZNC[j]>0){ | |
353 | new(psdigit) AliZDCSDigit(sector, pmZNC[j], trackTime); | |
354 | treeS->Fill(); | |
355 | // Ch. debug | |
356 | //printf("\t SDigit created: det %d quad %d pmZNC[%d] %1.0f trackTOF %f\n", | |
357 | // sector[0], sector[1], j, pmZNC[j], trackTime); | |
358 | } | |
b6d27557 | 359 | } |
359cdddc | 360 | |
80e87581 | 361 | // Create sdigits for ZPC |
362 | sector[0] = 2; // Detector = ZPC | |
ce1f03da | 363 | for(Int_t j = 0; j < 5; j++) { |
364 | sector[1] = j; // Towers PM ADCs | |
365 | if(pmZPC[j]>0){ | |
366 | new(psdigit) AliZDCSDigit(sector, pmZPC[j], trackTime); | |
367 | treeS->Fill(); | |
368 | // Ch. debug | |
369 | //printf("\t SDigit created: det %d quad %d pmZPC[%d] %1.0f trackTOF %f\n", | |
370 | // sector[0], sector[1], j, pmZPC[j], trackTime); | |
371 | } | |
6de91202 | 372 | } |
373 | ||
374 | // Create sdigits for ZEM | |
375 | sector[0] = 3; | |
376 | sector[1] = 1; // Detector = ZEM1 | |
ce1f03da | 377 | if(pmZEM1>0){ |
378 | new(psdigit) AliZDCSDigit(sector, pmZEM1, trackTime); | |
379 | treeS->Fill(); | |
380 | // Ch. debug | |
381 | //printf("\t SDigit created: det %d quad %d pmZEM1 %1.0f trackTOF %f\n", | |
382 | // sector[0], sector[1], pmZEM1, trackTime); | |
383 | } | |
6de91202 | 384 | sector[1] = 2; // Detector = ZEM2 |
ce1f03da | 385 | if(pmZEM2>0){ |
386 | new(psdigit) AliZDCSDigit(sector, pmZEM2, trackTime); | |
387 | treeS->Fill(); | |
388 | // Ch. debug | |
389 | //printf("\t SDigit created: det %d quad %d pmZEM2 %1.0f trackTOF %f\n", | |
390 | // sector[0], sector[1], pmZEM2, trackTime); | |
391 | } | |
6de91202 | 392 | |
80e87581 | 393 | // Create sdigits for ZNA |
394 | sector[0] = 4; // Detector = ZNA | |
ce1f03da | 395 | for(Int_t j = 0; j < 5; j++) { |
396 | sector[1] = j; // Towers PM ADCs | |
397 | if(pmZNA[j]>0){ | |
398 | new(psdigit) AliZDCSDigit(sector, pmZNA[j], trackTime); | |
399 | treeS->Fill(); | |
400 | // Ch. debug | |
401 | //printf("\t SDigit created: det %d quad %d pmZNA[%d] %1.0f trackTOF %f\n", | |
402 | // sector[0], sector[1], j, pmZNA[j], trackTime); | |
403 | } | |
80e87581 | 404 | } |
405 | ||
406 | // Create sdigits for ZPA | |
407 | sector[0] = 5; // Detector = ZPA | |
408 | sector[1] = 0; // Common PM ADC | |
ce1f03da | 409 | for(Int_t j = 0; j < 5; j++) { |
410 | sector[1] = j; // Towers PM ADCs | |
411 | if(pmZPA[j]>0){ | |
412 | new(psdigit) AliZDCSDigit(sector, pmZPA[j], trackTime); | |
413 | treeS->Fill(); | |
414 | // Ch. debug | |
415 | //printf("\t SDigit created: det %d quad %d pmZPA[%d] %1.0f trackTOF %f\n", | |
416 | // sector[0], sector[1], j, pmZPA[j], trackTime); | |
417 | } | |
80e87581 | 418 | } |
419 | ||
6de91202 | 420 | // write the output tree |
421 | fLoader->WriteSDigits("OVERWRITE"); | |
85a5290f | 422 | } |
423 | ||
424 | fLoader->UnloadHits(); | |
425 | fLoader->UnloadSDigits(); | |
359cdddc | 426 | } |
427 | ||
428 | //_____________________________________________________________________________ | |
f2e2aa97 | 429 | AliDigitizer* AliZDC::CreateDigitizer(AliDigitizationInput* digInput) const{ |
6de91202 | 430 | // Create the digitizer for ZDC |
f21fc003 | 431 | AliZDCDigitizer *zdcDigitizer = new AliZDCDigitizer(digInput); |
70ecaffe | 432 | if(fSpectatorTracked==0) zdcDigitizer->SetSpectators2Track(); |
5d24ec95 | 433 | if(fBeamEnergy>0.01) zdcDigitizer->SetBeamEnergy(fBeamEnergy); |
f2e2aa97 | 434 | if(fIspASystem==kTRUE) zdcDigitizer->SetpAsystem(); |
5d24ec95 | 435 | if(fIsRELDISgen==kTRUE) zdcDigitizer->SetRELDISGenerator(); |
f2e2aa97 | 436 | //if(fIspASystem==kTRUE) printf("\n **** ZDC digitizer initialized for p-A collisions\n\n"); |
70ecaffe | 437 | return zdcDigitizer; |
359cdddc | 438 | } |
439 | ||
440 | //_____________________________________________________________________________ | |
6de91202 | 441 | void AliZDC::Digits2Raw() |
359cdddc | 442 | { |
6de91202 | 443 | // Convert ZDC digits to raw data |
444 | ||
83347831 | 445 | // Format: 24 int values -> ZN1(C+Q1-4), ZP1(C+Q1-4), ZEM1, ZEM2, ZN(C+Q1-4), ZP2(C+Q1-4), 2 Ref PMs |
446 | // + 24 int values for the corresponding out of time channels | |
d79f8d50 | 447 | // For the CAEN module V965 we have an Header, the Data Words and an End Of Block |
448 | // 12 channels x 2 gain chains read from 1st ADC module | |
83347831 | 449 | // 12 channels x 2 gain chains read from 2nd ADC module |
d79f8d50 | 450 | // 12 channels x 2 gain chains read from 3rd ADC module (o.o.t.) |
83347831 | 451 | // 12 channels x 2 gain chains read from 4rth ADC module (o.o.t.) |
d79f8d50 | 452 | // |
1acbcff0 | 453 | const int knADCData1=12, knADCData2=12; |
454 | const int knADCData3=12, knADCData4=12; | |
f5c01244 | 455 | // |
7f73eb6b | 456 | UInt_t lADCHeader1; |
7f73eb6b | 457 | UInt_t lADCHeader2; |
1acbcff0 | 458 | UInt_t lADCHeader3; |
459 | UInt_t lADCHeader4; | |
f5c01244 | 460 | // |
1acbcff0 | 461 | UInt_t lADCData1[2*knADCData1]; |
462 | UInt_t lADCData2[2*knADCData2]; | |
463 | UInt_t lADCData3[2*knADCData3]; | |
464 | UInt_t lADCData4[2*knADCData4]; | |
d79f8d50 | 465 | // |
232b622f | 466 | UInt_t lADCEndBlock; |
6de91202 | 467 | |
468 | // load the digits | |
469 | fLoader->LoadDigits("read"); | |
470 | AliZDCDigit digit; | |
471 | AliZDCDigit* pdigit = &digit; | |
472 | TTree* treeD = fLoader->TreeD(); | |
90001c80 | 473 | if(!treeD) return; |
6de91202 | 474 | treeD->SetBranchAddress("ZDC", &pdigit); |
83347831 | 475 | //printf("\t AliZDC::Digits2Raw -> TreeD has %d entries\n",(Int_t) treeD->GetEntries()); |
6de91202 | 476 | |
1acbcff0 | 477 | // Reading channel map |
f5c01244 | 478 | //printf("\n\t Reading ADC mapping from OCDB\n"); |
1acbcff0 | 479 | AliZDCChMap * chMap = GetChMap(); |
480 | const int nCh = knADCData1+knADCData2+knADCData3+knADCData4; | |
481 | Int_t mapADC[nCh][4]; | |
482 | for(Int_t i=0; i<nCh; i++){ | |
483 | mapADC[i][0] = chMap->GetADCModule(i); | |
484 | mapADC[i][1] = chMap->GetADCChannel(i); | |
485 | mapADC[i][2] = chMap->GetDetector(i); | |
486 | mapADC[i][3] = chMap->GetSector(i); | |
f5c01244 | 487 | // Ch. debug |
488 | //printf(" mapADC[%d] = (%d %d %d %d)\n", i, | |
489 | // mapADC[i][0],mapADC[i][1],mapADC[i][2],mapADC[i][3]); | |
1acbcff0 | 490 | } |
491 | ||
492 | // *** Fill data array | |
493 | // ** ADC header | |
494 | UInt_t lADCHeaderGEO1 = 0; | |
495 | UInt_t lADCHeaderGEO2 = 1; | |
496 | UInt_t lADCHeaderGEO3 = 2; | |
497 | UInt_t lADCHeaderGEO4 = 3; | |
232b622f | 498 | UInt_t lADCHeaderCRATE = 0; |
8a2624cc | 499 | UInt_t lADCHeaderCNT1 = knADCData1; |
500 | UInt_t lADCHeaderCNT2 = knADCData2; | |
1acbcff0 | 501 | UInt_t lADCHeaderCNT3 = knADCData3; |
502 | UInt_t lADCHeaderCNT4 = knADCData4; | |
1450a7cd | 503 | |
1acbcff0 | 504 | lADCHeader1 = lADCHeaderGEO1 << 27 | 0x1 << 25 | lADCHeaderCRATE << 16 | |
7f73eb6b | 505 | lADCHeaderCNT1 << 8 ; |
1acbcff0 | 506 | lADCHeader2 = lADCHeaderGEO2 << 27 | 0x1 << 25 | lADCHeaderCRATE << 16 | |
7f73eb6b | 507 | lADCHeaderCNT2 << 8 ; |
1acbcff0 | 508 | lADCHeader3 = lADCHeaderGEO3 << 27 | 0x1 << 25 | lADCHeaderCRATE << 16 | |
509 | lADCHeaderCNT3 << 8 ; | |
510 | lADCHeader4 = lADCHeaderGEO4 << 27 | 0x1 << 25 | lADCHeaderCRATE << 16 | | |
511 | lADCHeaderCNT4 << 8 ; | |
6de91202 | 512 | |
1acbcff0 | 513 | // ** ADC data word |
514 | UInt_t lADCDataGEO = 0; | |
83347831 | 515 | // |
1acbcff0 | 516 | UInt_t lADCDataValue1[2*knADCData1]; |
517 | UInt_t lADCDataValue2[2*knADCData2]; | |
518 | UInt_t lADCDataValue3[2*knADCData3]; | |
519 | UInt_t lADCDataValue4[2*knADCData4]; | |
83347831 | 520 | // |
1acbcff0 | 521 | UInt_t lADCDataOvFlwHG = 0; |
522 | UInt_t lADCDataOvFlwLG = 0; | |
83347831 | 523 | // |
f5c01244 | 524 | for(Int_t i=0; i<2*knADCData1 ; i++) lADCDataValue1[i] = 0; |
525 | for(Int_t i=0; i<2*knADCData2 ; i++) lADCDataValue2[i] = 0; | |
526 | for(Int_t i=0; i<2*knADCData3 ; i++) lADCDataValue3[i] = 0; | |
527 | for(Int_t i=0; i<2*knADCData4 ; i++) lADCDataValue4[i] = 0; | |
83347831 | 528 | // |
232b622f | 529 | UInt_t lADCDataChannel = 0; |
6de91202 | 530 | |
83534754 | 531 | Int_t indADC0=0, indADC1=0, indADC2=0, indADC3=0; |
532 | ||
6de91202 | 533 | // loop over digits |
83534754 | 534 | for(Int_t iDigit=0; iDigit<(Int_t) (treeD->GetEntries()); iDigit++){ |
6de91202 | 535 | treeD->GetEntry(iDigit); |
d79f8d50 | 536 | if(!pdigit) continue; |
a5d5ab4c | 537 | //digit.Print(""); |
f5c01244 | 538 | |
d79f8d50 | 539 | // *** ADC data |
1acbcff0 | 540 | // Scan of the map to assign the correct ADC module-channel |
541 | for(Int_t k=0; k<nCh; k++){ | |
5fef9693 | 542 | if(iDigit<knADCData1+knADCData2){ |
1acbcff0 | 543 | if(digit.GetSector(0)==mapADC[k][2] && digit.GetSector(1)==mapADC[k][3]){ |
f5c01244 | 544 | lADCDataGEO = (UInt_t) mapADC[k][0]; |
545 | lADCDataChannel = (UInt_t) mapADC[k][1]; | |
1acbcff0 | 546 | break; |
547 | } | |
5fef9693 | 548 | } |
7fe9b721 | 549 | else{ |
5fef9693 | 550 | if(digit.GetSector(0)==mapADC[k][2] && digit.GetSector(1)==mapADC[k][3]){ |
551 | lADCDataGEO = (UInt_t) mapADC[k][0]; | |
552 | lADCDataChannel = (UInt_t) mapADC[k][1]; | |
553 | if(k>knADCData1+knADCData2) break; | |
554 | } | |
555 | } | |
6de91202 | 556 | } |
f5c01244 | 557 | // Ch. debug |
7fe9b721 | 558 | //printf("iDigit %d det %d sec %d -> lADCDataGEO %d lADCDataChannel %d\n", |
559 | // iDigit,digit.GetSector(0),digit.GetSector(1),lADCDataGEO,lADCDataChannel); | |
f5c01244 | 560 | |
561 | if(lADCDataGEO==0){ | |
f8a0f802 | 562 | if(indADC0>=knADCData1){ |
183673e3 | 563 | AliWarning(Form(" Problem with digit index %d for ADC0\n", indADC0)); |
130a6809 | 564 | return; |
565 | } | |
83534754 | 566 | Int_t indLG = indADC0+knADCData1; |
5fef9693 | 567 | // High gain ADC ch. |
568 | if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1; | |
83534754 | 569 | lADCDataValue1[indADC0] = digit.GetADCValue(0); |
570 | lADCData1[indADC0] = lADCDataGEO << 27 | lADCDataChannel << 17 | | |
571 | lADCDataOvFlwHG << 12 | (lADCDataValue1[indADC0] & 0xfff); | |
5fef9693 | 572 | // Low gain ADC ch. |
573 | if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1; | |
7fe9b721 | 574 | lADCDataValue1[indLG] = digit.GetADCValue(1); |
5fef9693 | 575 | lADCData1[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 | |
576 | lADCDataOvFlwLG << 12 | (lADCDataValue1[indLG] & 0xfff); | |
7fe9b721 | 577 | // Ch. debug |
578 | //printf(" lADCDataGEO %d ADCdataHG[%d] %d ADCdataLG[%d] %d\n", | |
579 | // lADCDataGEO,indADC0,lADCDataValue1[indADC0],indLG,lADCDataValue1[indLG]); | |
83534754 | 580 | |
581 | indADC0++; | |
5fef9693 | 582 | } |
583 | else if(lADCDataGEO==1){ | |
f8a0f802 | 584 | if(indADC1>=knADCData2){ |
183673e3 | 585 | AliWarning(Form(" Problem with digit index %d for ADC1\n", indADC1)); |
130a6809 | 586 | return; |
587 | } | |
83534754 | 588 | Int_t indLG = indADC1+knADCData2; |
589 | // High gain ADC ch. | |
590 | if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1; | |
591 | lADCDataValue2[indADC1] = digit.GetADCValue(0); | |
592 | lADCData2[indADC1] = lADCDataGEO << 27 | lADCDataChannel << 17 | | |
593 | lADCDataOvFlwHG << 12 | (lADCDataValue2[indADC1] & 0xfff); | |
594 | // Low gain ADC ch. | |
595 | if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1; | |
596 | lADCDataValue2[indLG] = digit.GetADCValue(1); | |
597 | lADCData2[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 | | |
598 | lADCDataOvFlwLG << 12 | (lADCDataValue2[indLG] & 0xfff); | |
7fe9b721 | 599 | // Ch. debug |
600 | //printf(" lADCDataGEO %d ADCdataHG[%d] %d ADCdataLG[%d] %d\n", | |
601 | // lADCDataGEO,indADC1,lADCDataValue2[indADC1],indLG,lADCDataValue2[indLG]); | |
83534754 | 602 | |
603 | indADC1++; | |
5fef9693 | 604 | } |
605 | else if(lADCDataGEO==2){ | |
f8a0f802 | 606 | if(indADC2>=knADCData3){ |
183673e3 | 607 | AliWarning(Form(" Problem with digit index %d for ADC2\n", indADC2)); |
130a6809 | 608 | return; |
609 | } | |
83534754 | 610 | Int_t indLG = indADC2+knADCData3; |
611 | // High gain ADC ch. | |
612 | if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1; | |
613 | lADCDataValue3[indADC1] = digit.GetADCValue(0); | |
614 | lADCData3[indADC1] = lADCDataGEO << 27 | lADCDataChannel << 17 | | |
615 | lADCDataOvFlwHG << 12 | (lADCDataValue3[indADC2] & 0xfff); | |
616 | // Low gain ADC ch. | |
617 | if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1; | |
618 | lADCDataValue3[indLG] = digit.GetADCValue(1); | |
619 | lADCData3[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 | | |
620 | lADCDataOvFlwLG << 12 | (lADCDataValue3[indLG] & 0xfff); | |
7fe9b721 | 621 | // Ch. debug |
622 | //printf(" lADCDataGEO %d ADCdataHG[%d] %d ADCdataLG[%d] %d\n", | |
623 | // lADCDataGEO,indADC2,lADCDataValue3[indADC2],indLG,lADCDataValue3[indLG]); | |
83534754 | 624 | |
625 | indADC2++; | |
1acbcff0 | 626 | } |
5fef9693 | 627 | else if(lADCDataGEO==3){ |
f8a0f802 | 628 | if(indADC3>=knADCData4){ |
183673e3 | 629 | AliWarning(Form(" Problem with digit index %d for ADC2\n", indADC3)); |
130a6809 | 630 | return; |
631 | } | |
83534754 | 632 | Int_t indLG = indADC3+knADCData4; |
633 | // High gain ADC ch. | |
634 | if(digit.GetADCValue(0) > 2047) lADCDataOvFlwHG = 1; | |
635 | lADCDataValue4[indADC3] = digit.GetADCValue(0); | |
636 | lADCData4[indADC3] = lADCDataGEO << 27 | lADCDataChannel << 17 | | |
637 | lADCDataOvFlwHG << 12 | (lADCDataValue4[indADC3] & 0xfff); | |
638 | // Low gain ADC ch. | |
639 | if(digit.GetADCValue(1) > 2047) lADCDataOvFlwLG = 1; | |
640 | lADCDataValue4[indLG] = digit.GetADCValue(1); | |
641 | lADCData4[indLG] = lADCDataGEO << 27 | lADCDataChannel << 17 | 0x1 << 16 | | |
642 | lADCDataOvFlwLG << 12 | (lADCDataValue4[indLG] & 0xfff); | |
7fe9b721 | 643 | // Ch. debug |
644 | //printf(" lADCDataGEO %d ADCdataHG[%d] %d ADCdataLG[%d] %d\n", | |
645 | // lADCDataGEO,indADC3,lADCDataValue4[indADC3],indLG,lADCDataValue4[indLG]); | |
83534754 | 646 | |
647 | indADC3++; | |
1acbcff0 | 648 | } |
f5c01244 | 649 | |
1450a7cd | 650 | } |
83347831 | 651 | // |
f5c01244 | 652 | /*for(Int_t i=0;i<2*knADCData1;i++) printf("\t ADCData1[%d] = %x\n",i,lADCData1[i]); |
653 | for(Int_t i=0;i<2*knADCData2;i++) printf("\t ADCData2[%d] = %x\n",i,lADCData2[i]); | |
654 | for(Int_t i=0;i<2*knADCData3;i++) printf("\t ADCData3[%d] = %x\n",i,lADCData3[i]); | |
655 | for(Int_t i=0;i<2*knADCData4;i++) printf("\t ADCData4[%d] = %x\n",i,lADCData4[i]);*/ | |
656 | ||
6de91202 | 657 | // End of Block |
f5c01244 | 658 | UInt_t lADCEndBlockGEO = 0; |
73bc3a3f | 659 | // Event counter in ADC EOB -> getting no. of events in run from AliRunLoader |
660 | // get run loader | |
661 | AliRunLoader* runLoader = fLoader->GetRunLoader(); | |
662 | UInt_t lADCEndBlockEvCount = runLoader->GetEventNumber(); | |
83347831 | 663 | // |
232b622f | 664 | lADCEndBlock = lADCEndBlockGEO << 27 | 0x1 << 26 | lADCEndBlockEvCount; |
256c2b16 | 665 | //printf("\t AliZDC::Digits2Raw -> ADCEndBlock = %d\n",lADCEndBlock); |
6de91202 | 666 | |
6de91202 | 667 | // open the output file |
83534754 | 668 | TString fileName; |
669 | fileName.Form("%s",AliDAQ::DdlFileName("ZDC",0)); | |
08f92f14 | 670 | |
83534754 | 671 | AliFstream* file = new AliFstream(fileName.Data()); |
6de91202 | 672 | |
673 | // write the DDL data header | |
f7ee745b | 674 | AliRawDataHeaderSim header; |
d79f8d50 | 675 | header.fSize = sizeof(header) + |
676 | sizeof(lADCHeader1) + sizeof(lADCData1) + sizeof(lADCEndBlock) + | |
677 | sizeof(lADCHeader2) + sizeof(lADCData2) + sizeof(lADCEndBlock) + | |
1acbcff0 | 678 | sizeof(lADCHeader3) + sizeof(lADCData3) + sizeof(lADCEndBlock) + |
679 | sizeof(lADCHeader4) + sizeof(lADCData4) + sizeof(lADCEndBlock); | |
83347831 | 680 | // |
5fef9693 | 681 | /*printf("sizeof header = %d, ADCHeader1 = %d, ADCData1 = %d, ADCEndBlock = %d\n", |
abf60186 | 682 | sizeof(header),sizeof(lADCHeader1),sizeof(lADCData1),sizeof(lADCEndBlock)); |
683 | printf("sizeof header = %d, ADCHeader2 = %d, ADCData2 = %d, ADCEndBlock = %d\n", | |
83347831 | 684 | sizeof(header),sizeof(lADCHeader2),sizeof(lADCData2),sizeof(lADCEndBlock)); |
f5c01244 | 685 | printf("sizeof header = %d, ADCHeader3 = %d, ADCData3 = %d, ADCEndBlock = %d\n", |
686 | sizeof(header),sizeof(lADCHeader1),sizeof(lADCData1),sizeof(lADCEndBlock)); | |
687 | printf("sizeof header = %d, ADCHeader4 = %d, ADCData4 = %d, ADCEndBlock = %d\n", | |
5fef9693 | 688 | sizeof(header),sizeof(lADCHeader2),sizeof(lADCData2),sizeof(lADCEndBlock));*/ |
f5c01244 | 689 | |
6de91202 | 690 | header.SetAttribute(0); // valid data |
08f92f14 | 691 | file->WriteBuffer((char*)(&header), sizeof(header)); |
6de91202 | 692 | // write the raw data and close the file |
f5c01244 | 693 | file->WriteBuffer((char*) &lADCHeader1, sizeof (lADCHeader1)); |
1e319f71 | 694 | file->WriteBuffer((char*) &lADCData1, sizeof(lADCData1)); |
08f92f14 | 695 | file->WriteBuffer((char*) &lADCEndBlock, sizeof(lADCEndBlock)); |
f5c01244 | 696 | file->WriteBuffer((char*) &lADCHeader2, sizeof (lADCHeader2)); |
1e319f71 | 697 | file->WriteBuffer((char*) (lADCData2), sizeof(lADCData2)); |
08f92f14 | 698 | file->WriteBuffer((char*) &lADCEndBlock, sizeof(lADCEndBlock)); |
f5c01244 | 699 | file->WriteBuffer((char*) &lADCHeader3, sizeof (lADCHeader3)); |
1e319f71 | 700 | file->WriteBuffer((char*) (lADCData3), sizeof(lADCData3)); |
08f92f14 | 701 | file->WriteBuffer((char*) &lADCEndBlock, sizeof(lADCEndBlock)); |
f5c01244 | 702 | file->WriteBuffer((char*) &lADCHeader4, sizeof (lADCHeader4)); |
1e319f71 | 703 | file->WriteBuffer((char*) (lADCData4), sizeof(lADCData4)); |
08f92f14 | 704 | file->WriteBuffer((char*) &lADCEndBlock, sizeof(lADCEndBlock)); |
705 | delete file; | |
6de91202 | 706 | |
707 | // unload the digits | |
708 | fLoader->UnloadDigits(); | |
359cdddc | 709 | } |
710 | ||
90001c80 | 711 | //_____________________________________________________________________________ |
712 | Bool_t AliZDC::Raw2SDigits(AliRawReader* rawReader) | |
713 | { | |
714 | // Convert ZDC raw data to Sdigits | |
f5c01244 | 715 | const int kNch = 48; |
33c3c91a | 716 | AliLoader* loader = (AliRunLoader::Instance())->GetLoader("ZDCLoader"); |
36f43fdf | 717 | if(!loader) { |
718 | AliError("no ZDC loader found"); | |
719 | return kFALSE; | |
720 | } | |
721 | ||
4df5e18f | 722 | // Create the output digit tree |
723 | TTree* treeS = loader->TreeS(); | |
724 | if(!treeS){ | |
725 | loader->MakeTree("S"); | |
726 | treeS = loader->TreeS(); | |
727 | } | |
728 | // | |
729 | AliZDCSDigit sdigit; | |
730 | AliZDCSDigit* psdigit = &sdigit; | |
731 | const Int_t kBufferSize = 4000; | |
732 | treeS->Branch("ZDC", "AliZDCSDigit", &psdigit, kBufferSize); | |
733 | // | |
734 | AliZDCRawStream rawStream(rawReader); | |
735 | Int_t sector[2], resADC, rawADC, corrADC, nPheVal; | |
736 | Int_t jcount = 0; | |
737 | while(rawStream.Next()){ | |
738 | if(rawStream.IsADCDataWord()){ | |
739 | //For the moment only in-time SDigits are foreseen (1st 48 raw values) | |
740 | if(jcount < kNch){ | |
741 | for(Int_t j=0; j<2; j++) sector[j] = rawStream.GetSector(j); | |
742 | rawADC = rawStream.GetADCValue(); | |
743 | resADC = rawStream.GetADCGain(); | |
744 | //printf("\t RAw2SDigits raw%d -> RawADC[%d, %d, %d] read\n", | |
745 | // jcount, sector[0], sector[1], rawADC); | |
746 | // | |
747 | corrADC = rawADC - Pedestal(sector[0], sector[1], resADC); | |
748 | if(corrADC<0) corrADC=0; | |
749 | nPheVal = ADCch2Phe(sector[0], sector[1], corrADC, resADC); | |
750 | // | |
751 | //printf("\t \t -> SDigit[%d, %d, %d] created\n", | |
752 | // sector[0], sector[1], nPheVal); | |
753 | // | |
754 | new(psdigit) AliZDCSDigit(sector, (Float_t) nPheVal, 0.); | |
755 | treeS->Fill(); | |
756 | jcount++; | |
757 | } | |
758 | }//IsADCDataWord | |
759 | }//rawStream.Next | |
760 | // write the output tree | |
761 | fLoader->WriteSDigits("OVERWRITE"); | |
762 | fLoader->UnloadSDigits(); | |
90001c80 | 763 | |
764 | return kTRUE; | |
765 | } | |
766 | ||
767 | //_____________________________________________________________________________ | |
768 | Int_t AliZDC::Pedestal(Int_t Det, Int_t Quad, Int_t Res) const | |
769 | { | |
770 | // Returns a pedestal for detector det, PM quad, channel with res. | |
771 | // | |
36f43fdf | 772 | // Getting calibration object for ZDC set |
773 | AliCDBManager *man = AliCDBManager::Instance(); | |
84dda325 | 774 | AliCDBEntry *entry = man->Get("ZDC/Calib/Pedestals"); |
83534754 | 775 | if(!entry) AliFatal("No calibration data loaded!"); |
6024ec85 | 776 | AliZDCPedestals *calibPed = (AliZDCPedestals*) entry->GetObject(); |
36f43fdf | 777 | // |
6024ec85 | 778 | if(!calibPed){ |
36f43fdf | 779 | printf("\t No calibration object found for ZDC!"); |
780 | return -1; | |
781 | } | |
782 | // | |
c35ed519 | 783 | Int_t index=0, kNch=24; |
784 | if(Quad!=5){ | |
785 | if(Det==1) index = Quad+kNch*Res; // ZN1 | |
786 | else if(Det==2) index = Quad+5+kNch*Res; // ZP1 | |
787 | else if(Det==3) index = Quad+9+kNch*Res; // ZEM | |
788 | else if(Det==4) index = Quad+12+kNch*Res; // ZN2 | |
789 | else if(Det==5) index = Quad+17+kNch*Res; // ZP2 | |
790 | } | |
791 | else index = (Det-1)/3+22+kNch*Res; // Reference PMs | |
36f43fdf | 792 | // |
793 | // | |
c35ed519 | 794 | Float_t meanPed = calibPed->GetMeanPed(index); |
795 | Float_t pedWidth = calibPed->GetMeanPedWidth(index); | |
796 | Float_t pedValue = gRandom->Gaus(meanPed,pedWidth); | |
90001c80 | 797 | // |
6310fd85 | 798 | //printf("\t AliZDC::Pedestal - det(%d, %d) - Ped[%d] = %d\n",Det, Quad, index,(Int_t) pedValue); // Chiara debugging! |
36f43fdf | 799 | |
90001c80 | 800 | |
801 | ||
6310fd85 | 802 | return (Int_t) pedValue; |
90001c80 | 803 | } |
804 | ||
805 | ||
806 | //_____________________________________________________________________________ | |
36f43fdf | 807 | Int_t AliZDC::ADCch2Phe(Int_t Det, Int_t Quad, Int_t ADCVal, Int_t Res) const |
90001c80 | 808 | { |
809 | // Evaluation of the no. of phe produced | |
6310fd85 | 810 | Float_t pmGain[6][5]; |
811 | Float_t resADC[2]; | |
90001c80 | 812 | for(Int_t j = 0; j < 5; j++){ |
6310fd85 | 813 | pmGain[0][j] = 50000.; |
814 | pmGain[1][j] = 100000.; | |
815 | pmGain[2][j] = 100000.; | |
816 | pmGain[3][j] = 50000.; | |
817 | pmGain[4][j] = 100000.; | |
818 | pmGain[5][j] = 100000.; | |
90001c80 | 819 | } |
820 | // ADC Caen V965 | |
6310fd85 | 821 | resADC[0] = 0.0000008; // ADC Resolution high gain: 200 fC/adcCh |
822 | resADC[1] = 0.0000064; // ADC Resolution low gain: 25 fC/adcCh | |
90001c80 | 823 | // |
9428ab68 | 824 | Int_t nPhe = (Int_t) (ADCVal / (pmGain[Det-1][Quad] * resADC[Res])); |
36f43fdf | 825 | // |
826 | //printf("\t AliZDC::ADCch2Phe -> det(%d, %d) - ADC %d phe %d\n",Det,Quad,ADCVal,nPhe); | |
90001c80 | 827 | |
828 | return nPhe; | |
829 | } | |
830 | ||
b81c9821 | 831 | //______________________________________________________________________ |
832 | void AliZDC::SetTreeAddress(){ | |
90001c80 | 833 | |
b81c9821 | 834 | // Set branch address for the Trees. |
90001c80 | 835 | if(fLoader->TreeH() && (fHits == 0x0)) |
b81c9821 | 836 | fHits = new TClonesArray("AliZDCHit",1000); |
837 | ||
b81c9821 | 838 | AliDetector::SetTreeAddress(); |
839 | } | |
1acbcff0 | 840 | |
841 | //_____________________________________________________________________________ | |
ad729eb7 | 842 | AliZDCChMap* AliZDC::GetChMap() const |
1acbcff0 | 843 | { |
844 | ||
845 | // Getting calibration object for ZDC | |
846 | ||
847 | AliCDBEntry *entry = AliCDBManager::Instance()->Get("ZDC/Calib/ChMap"); | |
848 | if(!entry) AliFatal("No calibration data loaded!"); | |
849 | ||
850 | AliZDCChMap *calibdata = dynamic_cast<AliZDCChMap*> (entry->GetObject()); | |
851 | if(!calibdata) AliFatal("Wrong calibration object in calibration file!"); | |
852 | ||
853 | return calibdata; | |
854 | } |