]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZERODigitizer.cxx
Corrected parameterization of the error. Overlooked in the previous commit.
[u/mrichter/AliRoot.git] / VZERO / AliVZERODigitizer.cxx
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  
16 /* $Id$ */
17
18 ///_________________________________________________________________________
19 ///
20 /// This class constructs Digits out of Hits
21 ///
22 ///
23
24 // --- Standard library ---
25
26 // --- ROOT system ---
27 #include <TMath.h>
28 #include <TTree.h>
29 #include <TMap.h>
30 #include <TGeoManager.h>
31 #include <TGeoPhysicalNode.h>
32 #include <AliGeomManager.h>
33 #include <TRandom.h>
34 #include <TF1.h>
35 #include <TH1F.h>
36
37 // --- AliRoot header files ---
38 #include "AliRun.h"
39 #include "AliVZERO.h"
40 #include "AliVZEROhit.h"
41 #include "AliRunLoader.h"
42 #include "AliLoader.h"
43 #include "AliGRPObject.h"
44 #include "AliRunDigitizer.h"
45 #include "AliCDBManager.h"
46 #include "AliCDBStorage.h"
47 #include "AliCDBEntry.h"
48 #include "AliVZEROCalibData.h"
49 #include "AliCTPTimeParams.h"
50 #include "AliVZEROdigit.h"
51 #include "AliVZERODigitizer.h"
52
53 ClassImp(AliVZERODigitizer)
54
55  AliVZERODigitizer::AliVZERODigitizer()
56                    :AliDigitizer(),
57                     fCalibData(GetCalibData()),
58                     fPhotoCathodeEfficiency(0.18),
59                     fNdigits(0),
60                     fDigits(0),
61                     fSignalShape(NULL),
62                     fPMResponse(NULL),
63                     fSinglePhESpectrum(NULL)
64    
65 {
66   // default constructor
67
68 //    fNdigits = 0;
69 //    fDigits  = 0;
70 //   
71 //    fPhotoCathodeEfficiency =   0.18;
72 //    fPMVoltage              =  768.0;
73 //    fPMGain = TMath::Power((fPMVoltage / 112.5) ,7.04277); 
74    
75 //   fCalibData = GetCalibData();
76
77   fSignalShape = new TF1("VZEROSignalShape",this,&AliVZERODigitizer::SignalShape,0,200,6,"AliVZERODigitizer","SignalShape");
78   //  fSignalShape->SetParameters(0,1.57345e1,-4.25603e-1,2.9,6.40982,3.69339e-01);
79   //  fSignalShape->SetParameters(1.34330e+00,1.13007e+02,-4.95705e-01,
80   //                          3.68911e+00,1.01040e+00, 3.94675e-01);
81   fSignalShape->SetParameters(-1.07335e+00,2.16002e+01,-1.26133e-01,
82                               1.41619e+00,5.50334e-01,3.86111e-01);
83
84   fPMResponse = new TF1("VZEROPMResponse",this,&AliVZERODigitizer::PMResponse,-kPMRespTime,2.*kPMRespTime,0,"AliVZERODigitizer","PMResponse");
85   fSinglePhESpectrum = new TF1("VZEROSinglePhESpectrum",this,&AliVZERODigitizer::SinglePhESpectrum,0,20,0,"AliVZERODigitizer","SinglePhESpectrum");
86
87   // Now get the CTP L0->L1 delay
88   AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
89   if (!entry) AliFatal("CTP timing parameters are not found in OCDB !");
90   AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
91   Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
92
93   AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeDelays");
94   if (!entry2) AliFatal("VZERO time delays are not found in OCDB !");
95   TH1F *delays = (TH1F*)entry2->GetObject();
96
97   for(Int_t i = 0 ; i < 64; ++i) {
98
99     for(Int_t j = 0; j < kNClocks; ++j) fAdc[i][j] = 0;
100     fLeadingTime[i] = fTimeWidth[i] = 0;
101
102     fPmGain[i] = fCalibData->GetGain(i);
103
104     fAdcPedestal[i][0] = fCalibData->GetPedestal(i);
105     fAdcSigma[i][0]    = fCalibData->GetSigma(i); 
106     fAdcPedestal[i][1] = fCalibData->GetPedestal(i+64);
107     fAdcSigma[i][1]    = fCalibData->GetSigma(i+64); 
108
109     Int_t board = AliVZEROCalibData::GetBoardNumber(i);
110     fNBins[i] = TMath::Nint(((Float_t)(fCalibData->GetMatchWindow(board)+1)*25.0+
111                              (Float_t)kMaxTDCWidth*fCalibData->GetWidthResolution(board))/
112                             fCalibData->GetTimeResolution(board));
113     fNBinsLT[i] = TMath::Nint(((Float_t)(fCalibData->GetMatchWindow(board)+1)*25.0)/
114                               fCalibData->GetTimeResolution(board));
115     fBinSize[i] = fCalibData->GetTimeResolution(board);
116     fHptdcOffset[i] = (((Float_t)fCalibData->GetTriggerCountOffset(board)-
117                         (Float_t)fCalibData->GetRollOver(board))*25.0+
118                        fCalibData->GetTimeOffset(i)+
119                        l1Delay+
120                        delays->GetBinContent(i+1)+
121                        kV0Offset);
122
123     fTime[i] = new Float_t[fNBins[i]];
124     memset(fTime[i],0,fNBins[i]*sizeof(Float_t));
125   }
126
127 }
128
129 //____________________________________________________________________________ 
130   AliVZERODigitizer::AliVZERODigitizer(AliRunDigitizer* manager)
131                     :AliDigitizer(manager),
132                      fCalibData(GetCalibData()),
133                      fPhotoCathodeEfficiency(0.18),
134                      fNdigits(0),
135                      fDigits(0),
136                      fSignalShape(NULL),
137                      fPMResponse(NULL),
138                      fSinglePhESpectrum(NULL)
139                                         
140 {
141   // constructor
142   // Initialize OCDB and containers used in the digitization
143   
144   fSignalShape = new TF1("VZEROSignalShape",this,&AliVZERODigitizer::SignalShape,0,200,6,"AliVZERODigitizer","SignalShape");
145   //  fSignalShape->SetParameters(0,1.57345e1,-4.25603e-1,2.9,6.40982,3.69339e-01);
146   //  fSignalShape->SetParameters(1.34330e+00,1.13007e+02,-4.95705e-01,
147   //                          3.68911e+00,1.01040e+00, 3.94675e-01);
148   fSignalShape->SetParameters(-1.07335e+00,2.16002e+01,-1.26133e-01,
149                               1.41619e+00,5.50334e-01,3.86111e-01);
150   fPMResponse = new TF1("VZEROPMResponse",this,&AliVZERODigitizer::PMResponse,-kPMRespTime,2.*kPMRespTime,0,"AliVZERODigitizer","PMResponse");
151   fSinglePhESpectrum = new TF1("VZEROSinglePhESpectrum",this,&AliVZERODigitizer::SinglePhESpectrum,0,20,0,"AliVZERODigitizer","SinglePhESpectrum");
152   
153   // Now get the CTP L0->L1 delay
154   AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
155   if (!entry) AliFatal("CTP timing parameters are not found in OCDB !");
156   AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
157   Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
158
159   AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeDelays");
160   if (!entry2) AliFatal("VZERO time delays are not found in OCDB !");
161   TH1F *delays = (TH1F*)entry2->GetObject();
162
163   for(Int_t i = 0 ; i < 64; ++i) {
164
165     for(Int_t j = 0; j < kNClocks; ++j) fAdc[i][j] = 0;
166     fLeadingTime[i] = fTimeWidth[i] = 0;
167
168     fPmGain[i] = fCalibData->GetGain(i);
169
170     fAdcPedestal[i][0] = fCalibData->GetPedestal(i);
171     fAdcSigma[i][0]    = fCalibData->GetSigma(i); 
172     fAdcPedestal[i][1] = fCalibData->GetPedestal(i+64);
173     fAdcSigma[i][1]    = fCalibData->GetSigma(i+64); 
174
175     Int_t board = AliVZEROCalibData::GetBoardNumber(i);
176     fNBins[i] = TMath::Nint(((Float_t)(fCalibData->GetMatchWindow(board)+1)*25.0+
177                              (Float_t)kMaxTDCWidth*fCalibData->GetWidthResolution(board))/
178                             fCalibData->GetTimeResolution(board));
179     fNBinsLT[i] = TMath::Nint(((Float_t)(fCalibData->GetMatchWindow(board)+1)*25.0)/
180                               fCalibData->GetTimeResolution(board));
181     fBinSize[i] = fCalibData->GetTimeResolution(board);
182     fHptdcOffset[i] = (((Float_t)fCalibData->GetTriggerCountOffset(board)-
183                         (Float_t)fCalibData->GetRollOver(board))*25.0+
184                        fCalibData->GetTimeOffset(i)+
185                        l1Delay+
186                        delays->GetBinContent(i+1)+
187                        kV0Offset);
188
189     fTime[i] = new Float_t[fNBins[i]];
190     memset(fTime[i],0,fNBins[i]*sizeof(Float_t));
191   }
192 }
193            
194 //____________________________________________________________________________ 
195   AliVZERODigitizer::~AliVZERODigitizer()
196 {
197   // destructor
198   
199   if (fDigits) {
200     fDigits->Delete();
201     delete fDigits;
202     fDigits=0; 
203   }
204
205   if (fSignalShape) {
206     delete fSignalShape;
207     fSignalShape = NULL;
208   }
209   if (fPMResponse) {
210     delete fPMResponse;
211     fPMResponse = NULL;
212   }
213   if (fSinglePhESpectrum) {
214     delete fSinglePhESpectrum;
215     fSinglePhESpectrum = NULL;
216   }
217
218   for(Int_t i = 0 ; i < 64; ++i) {
219     if (fTime[i]) delete [] fTime[i];
220   }
221 }
222
223 //_____________________________________________________________________________
224 Bool_t AliVZERODigitizer::Init()
225 {
226   // Initialises the digitizer
227
228   // Initialises the Digit array
229   fDigits = new TClonesArray ("AliVZEROdigit", 1000);
230   
231   return kTRUE;
232 }
233
234 //____________________________________________________________________________
235 void AliVZERODigitizer::Exec(Option_t* /*option*/) 
236 {   
237   // Creates digits from hits
238   fNdigits     =    0;  
239
240   for(Int_t i = 0 ; i < 64; ++i) {
241     memset(fTime[i],0,fNBins[i]*sizeof(Float_t));
242     for(Int_t j = 0; j < kNClocks; ++j) fAdc[i][j] = 0;
243     fLeadingTime[i] = fTimeWidth[i] = 0;
244   }
245   Float_t integral = fPMResponse->Integral(-kPMRespTime,2.*kPMRespTime);
246   Float_t meansPhE = fSinglePhESpectrum->Mean(0,20);
247
248   AliRunLoader* outRunLoader =  AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());    
249   if (!outRunLoader) {
250     Error("Exec", "Can not get output Run Loader");
251     return;
252   }
253     
254   AliLoader* outLoader = outRunLoader->GetLoader("VZEROLoader");
255
256   if (!outLoader) {
257     Error("Exec", "Can not get output VZERO Loader");
258     return;
259   }
260
261   const char* mode = "update";
262   if(outRunLoader->GetEventNumber() == 0) mode = "recreate";
263   outLoader->LoadDigits(mode);
264
265   if (!outLoader->TreeD()) outLoader->MakeTree("D");
266   outLoader->MakeDigitsContainer();
267   TTree* treeD  = outLoader->TreeD();
268   Int_t bufsize = 16000;
269   treeD->Branch("VZERODigit", &fDigits, bufsize); 
270   
271   for (Int_t iInput = 0; iInput < fManager->GetNinputs(); iInput++) {
272      AliRunLoader* runLoader = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(iInput));
273      AliLoader* loader = runLoader->GetLoader("VZEROLoader");
274      if (!loader) {
275        Error("Exec", "Can not get VZERO Loader for input %d", iInput);
276        continue;
277          }
278       
279      if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
280
281      AliVZERO* vzero = (AliVZERO*) runLoader->GetAliRun()->GetDetector("VZERO");
282      if (!vzero) {
283        Error("Exec", "No VZERO detector for input %d", iInput);
284        continue;
285          }
286       
287      loader->LoadHits();
288      TTree* treeH = loader->TreeH();
289      if (!treeH) {
290        Error("Exec", "Cannot get TreeH for input %d", iInput);
291        continue; 
292          }
293        
294      TClonesArray* hits = vzero->Hits();
295
296      //     Float_t lightYieldCorr[64] = {0.00707,0.00517,0.00520,0.00537,0.00735,0.00537,0.00733,0.00605,0.00778,0.00749,0.00701,0.00755,0.00732,0.00617,0.00669,0.00525,0.00752,0.00820,0.00797,0.01107,0.01080,0.00889,0.00880,0.01712,0.00866,0.00701,0.00811,0.00602,0.00879,0.00821,0.00861,0.01433,0.00061,0.00032,0.00099,0.00061,0.00034,0.00046,0.00031,0.00122,0.00155,0.00091,0.00032,0.00096,0.00120,0.00067,0.00113,0.00060,0.00158,0.00136,0.00340,0.00066,0.00076,0.00119,0.00129,0.00147,0.00137,0.00117,0.00088,0.00164,0.00128,0.00081,0.00121,0.00250};
297      Float_t lightYieldCorr[64] = {0.01173,0.00874,0.00878,0.00886,0.01151,0.00925,0.01167,0.00983,0.01181,0.01243,0.01115,0.01220,0.01228,0.01053,0.01021,0.00930,0.01270,0.01411,0.01316,0.01894,0.01923,0.01860,0.01738,0.00305,0.01584,0.01251,0.01344,0.00310,0.01302,0.01266,0.01407,0.00338,0.00089,0.00100,0.00130,0.00081,0.00052,0.01230,0.00059,0.02452,0.02980,0.00137,0.01421,0.00116,0.00141,0.00092,0.02480,0.00096,0.00182,0.00174,0.00218,0.00106,0.00116,0.00160,0.00162,0.03097,0.00194,0.00171,0.00132,0.00239,0.00173,0.00118,0.00163,0.00262};
298 //  Now makes Digits from hits
299      Int_t nTracks = (Int_t) treeH->GetEntries();
300      for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) {
301          vzero->ResetHits();
302          treeH->GetEvent(iTrack);
303          Int_t nHits = hits->GetEntriesFast();
304          for (Int_t iHit = 0; iHit < nHits; iHit++) {
305            AliVZEROhit* hit = (AliVZEROhit *)hits->UncheckedAt(iHit);
306            Int_t nPhot = hit->Nphot();
307            Int_t cell  = hit->Cell();                          
308            Int_t pmt = Cell2Pmt(cell);
309            Float_t dt_scintillator = gRandom->Gaus(0,kIntTimeRes);
310            Float_t t = dt_scintillator + 1e9*hit->Tof();
311            if (pmt < 32) t += kV0CDelayCables;
312            t += fHptdcOffset[pmt];
313            Int_t nPhE;
314            Float_t prob = lightYieldCorr[pmt]*fPhotoCathodeEfficiency; // Optical losses included!
315            if (nPhot > 100)
316              nPhE =gRandom->Gaus(prob*Float_t(nPhot)+0.5,
317                                  sqrt(Float_t(nPhot)*prob*(1.-prob)));
318            else
319              nPhE = gRandom->Binomial(nPhot,prob);
320            Float_t charge = TMath::Qe()*fPmGain[pmt]*fBinSize[pmt]/integral;
321            for (Int_t iPhE = 0; iPhE < nPhE; ++iPhE) {
322              Float_t tPhE = t + fSignalShape->GetRandom(0,fBinSize[pmt]*Float_t(fNBins[pmt]));
323              Float_t gainVar = fSinglePhESpectrum->GetRandom(0,20)/meansPhE;
324              Int_t firstBin = TMath::Max(0,(Int_t)((tPhE-kPMRespTime)/fBinSize[pmt]));
325              Int_t lastBin = TMath::Min(fNBins[pmt]-1,(Int_t)((tPhE+2.*kPMRespTime)/fBinSize[pmt]));
326              for(Int_t iBin = firstBin; iBin <= lastBin; ++iBin) {
327                Float_t tempT = fBinSize[pmt]*(0.5+iBin)-tPhE;
328                fTime[pmt][iBin] += gainVar*charge*fPMResponse->Eval(tempT);
329              }
330            }         // ph.e. loop
331          }           // hit loop
332      }               // track loop
333      loader->UnloadHits();
334   }                  // input loop
335
336   Float_t maximum = 0.9*fSignalShape->GetMaximum(0,200); // Not exact, one needs to do this on the convoluted
337   Float_t integral2 = fSignalShape->Integral(0,200); // function. Anyway the effect is small <10% on the 2.5 ADC thr
338   for (Int_t ipmt = 0; ipmt < 64; ++ipmt) {
339     Float_t thr = fCalibData->GetDiscriThr(ipmt)*kChargePerADC*maximum*fBinSize[ipmt]/integral2;
340     Bool_t ltFound = kFALSE, ttFound = kFALSE;
341     for (Int_t iBin = 0; iBin < fNBins[ipmt]; ++iBin) {
342       Float_t t = fBinSize[ipmt]*Float_t(iBin+0.5);
343       if (fTime[ipmt][iBin] > thr) {
344         if (!ltFound && (iBin < fNBinsLT[ipmt])) {
345           ltFound = kTRUE;
346           fLeadingTime[ipmt] = t;
347         }
348       }
349       else {
350         if (ltFound) {
351           if (!ttFound) {
352             ttFound = kTRUE;
353             fTimeWidth[ipmt] = t - fLeadingTime[ipmt];
354           }
355         }
356       }
357       Float_t tadc = t - kADCTimeOffset;
358       Int_t clock = kNClocks - Int_t(tadc/25.0) - 1;
359       if (clock >= 0 && clock < kNClocks)
360         fAdc[ipmt][clock] += fTime[ipmt][iBin]/kChargePerADC;
361     }
362     Int_t board = AliVZEROCalibData::GetBoardNumber(ipmt);
363     if (ltFound && ttFound) {
364       fTimeWidth[ipmt] = fCalibData->GetWidthResolution(board)*
365         Float_t(Int_t(fTimeWidth[ipmt]/fCalibData->GetWidthResolution(board)));
366       if (fTimeWidth[ipmt] < Float_t(kMinTDCWidth)*fCalibData->GetWidthResolution(board))
367         fTimeWidth[ipmt] = Float_t(kMinTDCWidth)*fCalibData->GetWidthResolution(board);
368       if (fTimeWidth[ipmt] > Float_t(kMaxTDCWidth)*fCalibData->GetWidthResolution(board))
369         fTimeWidth[ipmt] = Float_t(kMaxTDCWidth)*fCalibData->GetWidthResolution(board);
370     }
371   }
372
373   Int_t evenOrOdd = gRandom->Integer(2);
374   for (Int_t j=0; j<64; ++j){
375     for (Int_t iClock = 0; iClock < kNClocks; ++iClock) {
376       Int_t integrator = (iClock + evenOrOdd) % 2;
377       fAdc[j][iClock]  += gRandom->Gaus(fAdcPedestal[j][integrator], fAdcSigma[j][integrator]);
378     }
379   }
380         
381   // Now add digits to the digit Tree 
382
383   for (Int_t i=0; i<64; i++) {      
384     //    printf(" cell %d adc ",i);
385     //    for (Int_t j = 0; j < kNClocks; ++j)
386     //      printf("%d ", Int_t(fAdc[i][j]));
387     //    printf("\n");
388     Float_t totADC = 0;
389     for (Int_t j = 8; j <= 11; ++j) {
390       Int_t tempadc = Int_t(fAdc[i][j]);
391       if (tempadc > 1023) tempadc = 1023;
392       Int_t integrator = (j + evenOrOdd) % 2;
393       if ((Float_t(tempadc) - fAdcPedestal[i][integrator]) > (2.*fAdcSigma[i][integrator]))
394         totADC += (Float_t(tempadc) - fAdcPedestal[i][integrator]);
395     }
396     totADC += fAdcPedestal[i][(10+evenOrOdd)%2];
397     AddDigit(i, totADC, fLeadingTime[i], fTimeWidth[i], Bool_t((10+evenOrOdd)%2));
398   }
399
400   treeD->Fill();
401   outLoader->WriteDigits("OVERWRITE");  
402   outLoader->UnloadDigits();     
403   ResetDigit();
404 }
405
406 //____________________________________________________________________________
407 void AliVZERODigitizer::AddDigit(Int_t PMnumber, Float_t adc, Float_t time, Float_t width, Bool_t integrator) 
408  { 
409  
410 // Adds Digit 
411  
412   TClonesArray &ldigits = *fDigits;  
413          
414   new(ldigits[fNdigits++]) AliVZEROdigit(PMnumber,adc,time,width,kFALSE,kFALSE,integrator);
415          
416 }
417 //____________________________________________________________________________
418 void AliVZERODigitizer::ResetDigit()
419 {
420
421 // Clears Digits
422
423   fNdigits = 0;
424   if (fDigits) fDigits->Delete();
425 }
426
427 //____________________________________________________________________________
428 AliVZEROCalibData* AliVZERODigitizer::GetCalibData() const
429
430 {
431   AliCDBManager *man = AliCDBManager::Instance();
432
433   AliCDBEntry *entry=0;
434
435   entry = man->Get("VZERO/Calib/Data");
436
437 //   if(!entry){
438 //     AliWarning("Load of calibration data from default storage failed!");
439 //     AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
440 //     Int_t runNumber = man->GetRun();
441 //     entry = man->GetStorage("local://$ALICE_ROOT/OCDB")
442 //       ->Get("VZERO/Calib/Data",runNumber);
443 //      
444 //   }
445
446   // Retrieval of data in directory VZERO/Calib/Data:
447
448
449   AliVZEROCalibData *calibdata = 0;
450
451   if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject();
452   if (!calibdata)  AliFatal("No calibration data from calibration database !");
453
454   return calibdata;
455
456 }
457
458 double AliVZERODigitizer::SignalShape(double *x, double *par)
459 {
460   // this function simulates the time
461   // of arrival of the photons at the
462   // photocathode
463   Double_t xx = x[0];
464   if (xx <= par[0]) return 0;
465   Double_t a = 1./TMath::Power((xx-par[0])/par[1],1./par[2]);
466   if (xx <= par[3]) return a;
467   Double_t b = 1./TMath::Power((xx-par[3])/par[4],1./par[5]);
468   Double_t f = a*b/(a+b);
469   AliDebug(100,Form("x=%f func=%f",xx,f));
470   return f;
471 }
472
473 double AliVZERODigitizer::PMResponse(double *x, double * /* par */)
474 {
475   // this function describes the
476   // PM time response to a single
477   // photoelectron
478   Double_t xx = x[0]+kPMRespTime;
479   return xx*xx*TMath::Exp(-xx*xx/(kPMRespTime*kPMRespTime));
480 }
481
482 double AliVZERODigitizer::SinglePhESpectrum(double *x, double * /* par */)
483 {
484   // this function describes the
485   // PM amplitude response to a single
486   // photoelectron
487   Double_t xx = x[0];
488   if (xx < 0) return 0;
489   return (TMath::Poisson(xx,kPMNbOfSecElec)+kPMTransparency*TMath::Poisson(xx,1.0));
490 }
491
492 Int_t AliVZERODigitizer::Cell2Pmt(Int_t cell) const
493 {
494   // The method maps the scintillator
495   // indexes to the PM ones
496   if (cell < 0 || cell >= 80) {
497     AliError(Form("Wrong VZERO cell index %d",cell));
498     return -1;
499   }
500   if (cell < 16) return cell;
501   if (cell < 48) return 8 + cell/2;
502   return cell - 16;
503 }