]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCParamSR.cxx
Chnges in the pad geometry - 3 pad lengths introduced.
[u/mrichter/AliRoot.git] / TPC / AliTPCParamSR.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 /*
17 $Log$
18 Revision 1.6  2002/02/25 11:02:56  kowal2
19 Changes towards speeding up the code. Thanks to Marian Ivanov.
20
21 Revision 1.5  2001/12/06 07:49:30  kowal2
22 corrected number of pads calculation
23
24 Revision 1.4  2000/11/02 07:33:15  kowal2
25 Improvements of the code.
26
27 Revision 1.3  2000/06/30 12:07:50  kowal2
28 Updated from the TPC-PreRelease branch
29
30 Revision 1.2.4.2  2000/06/14 16:48:24  kowal2
31 Parameter setting improved. Removed compiler warnings
32
33 Revision 1.2.4.1  2000/06/09 07:55:39  kowal2
34
35 Updated defaults
36
37 Revision 1.2  2000/04/17 09:37:33  kowal2
38 removed obsolete AliTPCDigitsDisplay.C
39
40 Revision 1.1.4.2  2000/04/10 11:36:13  kowal2
41
42 New Detector parameters handling class
43
44 */
45
46 ///////////////////////////////////////////////////////////////////////
47 //  Manager and of geomety  classes for set: TPC                     //
48 //                                                                   //
49 //  !sectors are numbered from  0                                     //
50 //  !pad rows are numbered from 0                                     //
51 //  
52 //  27.7.   - AliTPCPaaramSr object for TPC 
53 //            TPC with straight pad rows 
54 //  Origin:  Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk // 
55 //                                                                   //  
56 ///////////////////////////////////////////////////////////////////////
57
58
59 #include <iostream.h>
60 #include <TMath.h>
61 #include <TObject.h>
62 #include <AliTPCParamSR.h>
63 #include "AliTPCPRF2D.h"
64 #include "AliTPCRF1D.h"
65 #include "TH1.h"
66
67
68 ClassImp(AliTPCParamSR)
69 const static  Int_t kMaxRows=600;
70 const static  Float_t  kEdgeSectorSpace = 2.5;
71 const static Float_t kFacSigmaPadRow=3.;
72 const static Float_t kFacSigmaPad=3.;
73 const static Float_t kFacSigmaTime=3.;
74
75
76 AliTPCParamSR::AliTPCParamSR()
77 {   
78   //
79   //constructor set the default parameters
80   fInnerPRF=0;
81   fOuter1PRF=0;
82   fOuter2PRF=0;
83   fTimeRF = 0;
84   fFacSigmaPadRow = Float_t(kFacSigmaPadRow);
85   fFacSigmaPad = Float_t(kFacSigmaPad);
86   fFacSigmaTime = Float_t(kFacSigmaTime);
87   SetDefault();
88   Update();
89 }
90
91 AliTPCParamSR::~AliTPCParamSR()
92 {
93   //
94   //destructor destroy some dynmicaly alocated variables
95   if (fInnerPRF != 0) delete fInnerPRF;
96   if (fOuter1PRF != 0) delete fOuter1PRF;
97   if (fOuter2PRF != 0) delete fOuter2PRF;
98   if (fTimeRF != 0) delete fTimeRF;
99 }
100
101 void AliTPCParamSR::SetDefault()
102 {
103   //set default TPC param   
104   fbStatus = kFALSE;
105   AliTPCParam::SetDefault();  
106 }  
107
108 Int_t  AliTPCParamSR::CalcResponse(Float_t* xyz, Int_t * index, Int_t row)
109 {
110   //
111   //calculate bin response as function of the input position -x 
112   //return number of valid response bin
113   //
114   //we suppose that coordinate is expressed in float digits 
115   // it's mean coordinate system 8
116   //xyz[0] - float padrow xyz[1] is float pad  (center pad is number 0) and xyz[2] is float time bin
117   if ( (fInnerPRF==0)||(fOuter1PRF==0)||(fOuter2PRF==0) ||(fTimeRF==0) ){ 
118     Error("AliTPCParamSR", "response function was not adjusted");
119     return -1;
120   }
121   
122   Float_t sfpadrow;   // sigma of response function
123   Float_t sfpad;      // sigma  of 
124   Float_t sftime= fFacSigmaTime*fTimeRF->GetSigma()/fZWidth;     //3 sigma of time response
125   if (index[1]<fNInnerSector){
126     sfpadrow =fFacSigmaPadRow*fInnerPRF->GetSigmaY()/fInnerPadPitchLength;
127     sfpad    =fFacSigmaPad*fInnerPRF->GetSigmaX()/fInnerPadPitchWidth;
128   }
129   else{
130   if(row<fNRowUp1){
131     sfpadrow =fFacSigmaPadRow*fOuter1PRF->GetSigmaY()/fOuter1PadPitchLength;
132     sfpad    =fFacSigmaPad*fOuter1PRF->GetSigmaX()/fOuterPadPitchWidth;}
133     else{
134       sfpadrow =fFacSigmaPadRow*fOuter2PRF->GetSigmaY()/fOuter2PadPitchLength;
135       sfpad    =fFacSigmaPad*fOuter2PRF->GetSigmaX()/fOuterPadPitchWidth;
136     }   
137   }
138
139   Int_t fpadrow = TMath::Max(TMath::Nint(index[2]+xyz[0]-sfpadrow),0);  //"first" padrow
140   Int_t fpad    = TMath::Nint(xyz[1]-sfpad);     //first pad
141   Int_t ftime   = TMath::Max(TMath::Nint(xyz[2]+GetZOffset()/GetZWidth()-sftime),0);  // first time
142   Int_t lpadrow = TMath::Min(TMath::Nint(index[2]+xyz[0]+sfpadrow),fpadrow+19);  //"last" padrow
143   lpadrow       = TMath::Min(GetNRow(index[1])-1,lpadrow);
144   Int_t lpad    = TMath::Min(TMath::Nint(xyz[1]+sfpad),fpad+19);     //last pad
145   Int_t ltime   = TMath::Min(TMath::Nint(xyz[2]+GetZOffset()/GetZWidth()+sftime),ftime+19);    // last time
146   ltime         = TMath::Min(ltime,GetMaxTBin()-1); 
147   // 
148   Int_t npads = GetNPads(index[1],row);
149   if (fpad<-npads/2) 
150     fpad = -npads/2;
151   if (lpad>npads/2) 
152     lpad= npads/2;
153   if (ftime<0) ftime=0;
154   // 
155   if (row>=0) { //if we are interesting about given pad row
156     if (fpadrow<=row) fpadrow =row;
157     else 
158       return 0;
159     if (lpadrow>=row) lpadrow = row;
160     else 
161       return 0;
162   }
163
164  
165   Float_t  padres[20][20];  //I don't expect bigger number of bins
166   Float_t  timeres[20];     
167   Int_t cindex3=0;
168   Int_t cindex=0;
169   Float_t cweight = 0;
170   if (fpadrow>=0) {
171   //calculate padresponse function    
172   Int_t padrow, pad;
173   for (padrow = fpadrow;padrow<=lpadrow;padrow++)
174     for (pad = fpad;pad<=lpad;pad++){
175       Float_t dy = (xyz[0]+Float_t(index[2]-padrow));
176       Float_t dx = (xyz[1]+Float_t(pad));
177       if (index[1]<fNInnerSector)
178         padres[padrow-fpadrow][pad-fpad]=fInnerPRF->GetPRF(dx*fInnerPadPitchWidth,dy*fInnerPadPitchLength);
179       else{
180         if(row<fNRowUp1){
181         padres[padrow-fpadrow][pad-fpad]=fOuter1PRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuter1PadPitchLength);}
182         else{
183           padres[padrow-fpadrow][pad-fpad]=fOuter2PRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuter2PadPitchLength);}}}
184   //calculate time response function
185   Int_t time;
186   for (time = ftime;time<=ltime;time++) 
187     timeres[time-ftime]= fTimeRF->GetRF((-xyz[2]+Float_t(time))*fZWidth);     
188   //write over threshold values to stack
189   for (padrow = fpadrow;padrow<=lpadrow;padrow++)
190     for (pad = fpad;pad<=lpad;pad++)
191       for (time = ftime;time<=ltime;time++){
192         cweight = timeres[time-ftime]*padres[padrow-fpadrow][pad-fpad];
193         if (cweight>fResponseThreshold) {
194           fResponseBin[cindex3]=padrow;
195           fResponseBin[cindex3+1]=pad;
196           fResponseBin[cindex3+2]=time;
197           cindex3+=3;  
198           fResponseWeight[cindex]=cweight;
199           cindex++;
200         }
201       }
202   }
203   fCurrentMax=cindex;   
204   return fCurrentMax;
205 }
206
207 void AliTPCParamSR::TransformTo8(Float_t *xyz, Int_t *index) const
208 {
209   //
210   // transformate point to digit coordinate
211   //
212   if (index[0]==0) Transform0to1(xyz,index);
213   if (index[0]==1) Transform1to2(xyz,index);
214   if (index[0]==2) Transform2to3(xyz,index);
215   if (index[0]==3) Transform3to4(xyz,index);
216   if (index[0]==4) Transform4to8(xyz,index);
217 }
218
219 void AliTPCParamSR::TransformTo2(Float_t *xyz, Int_t *index) const
220 {
221   //
222   //transformate point to rotated coordinate
223   //
224   //we suppose that   
225   if (index[0]==0) Transform0to1(xyz,index);
226   if (index[0]==1) Transform1to2(xyz,index);
227   if (index[0]==4) Transform4to3(xyz,index);
228   if (index[0]==8) {  //if we are in digit coordinate system transform to global
229     Transform8to4(xyz,index);
230     Transform4to3(xyz,index);  
231   }
232 }
233
234 void AliTPCParamSR::CRXYZtoXYZ(Float_t *xyz,
235                const Int_t &sector, const Int_t & padrow, Int_t option) const  
236 {  
237   //transform relative coordinates to absolute
238   Bool_t rel = ( (option&2)!=0);
239   Int_t index[2]={sector,padrow};
240   if (rel==kTRUE)      Transform4to3(xyz,index);//if the position is relative to pad row  
241   Transform2to1(xyz,index);
242 }
243
244 void AliTPCParamSR::XYZtoCRXYZ(Float_t *xyz,
245                              Int_t &sector, Int_t & padrow, Int_t option) const
246 {
247    //transform global position to the position relative to the sector padrow
248   //if option=0  X calculate absolute            calculate sector
249   //if option=1  X           absolute            use input sector
250   //if option=2  X           relative to pad row calculate sector
251   //if option=3  X           relative            use input sector
252   //!!!!!!!!! WE start to calculate rows from row = 0
253   Int_t index[2];
254   Bool_t rel = ( (option&2)!=0);  
255
256   //option 0 and 2  means that we don't have information about sector
257   if ((option&1)==0)   Transform0to1(xyz,index);  //we calculate sector number 
258   else
259     index[0]=sector;
260   Transform1to2(xyz,index);
261   Transform2to3(xyz,index);
262   //if we store relative position calculate position relative to pad row
263   if (rel==kTRUE) Transform3to4(xyz,index);
264   sector = index[0];
265   padrow = index[1];
266 }
267
268 Float_t AliTPCParamSR::GetPrimaryLoss(Float_t *x, Int_t *index, Float_t *angle)
269 {
270   //
271   //
272   Float_t padlength=GetPadPitchLength(index[1]);
273   Float_t a1=TMath::Sin(angle[0]);
274   a1*=a1;
275   Float_t a2=TMath::Sin(angle[1]);
276   a2*=a2;
277   Float_t length =padlength*TMath::Sqrt(1+a1+a2);
278   return length*fNPrimLoss;
279 }
280
281 Float_t AliTPCParamSR::GetTotalLoss(Float_t *x, Int_t *index, Float_t *angle)
282 {
283   //
284   //
285   Float_t padlength=GetPadPitchLength(index[1]);
286   Float_t a1=TMath::Sin(angle[0]);
287   a1*=a1;
288   Float_t a2=TMath::Sin(angle[1]);
289   a2*=a2;
290   Float_t length =padlength*TMath::Sqrt(1+a1+a2);
291   return length*fNTotalLoss;
292   
293 }
294
295
296 void AliTPCParamSR::GetClusterSize(Float_t *x, Int_t *index, Float_t *angle, Int_t mode, Float_t *sigma)
297 {
298   //
299   //return cluster sigma2 (x,y) for particle at position x
300   // in this case x coordinata is in drift direction
301   //and y in pad row direction
302   //we suppose that input coordinate system is digit system
303    
304   Float_t  xx;
305   Float_t lx[3] = {x[0],x[1],x[2]};
306   Int_t   li[3] = {index[0],index[1],index[2]};
307   TransformTo2(lx,li);
308   //  Float_t  sigmadiff;
309   sigma[0]=0;
310   sigma[1]=0;
311   
312   xx = lx[2];  //calculate drift length in cm
313   if (xx>0) {
314     sigma[0]+= xx*GetDiffL()*GetDiffL();
315     sigma[1]+= xx*GetDiffT()*GetDiffT(); 
316   }
317
318
319   //sigma[0]=sigma[1]=0;
320   if (GetTimeRF()!=0) sigma[0]+=GetTimeRF()->GetSigma()*GetTimeRF()->GetSigma();
321   if ( (index[1]<fNInnerSector) &&(GetInnerPRF()!=0))   
322     sigma[1]+=GetInnerPRF()->GetSigmaX()*GetInnerPRF()->GetSigmaX();
323   if ( (index[1]>=fNInnerSector) &&(index[2]<fNRowUp1) && (GetOuter1PRF()!=0))
324     sigma[1]+=GetOuter1PRF()->GetSigmaX()*GetOuter1PRF()->GetSigmaX();
325   if( (index[1]>=fNInnerSector) &&(index[2]>=fNRowUp1) && (GetOuter2PRF()!=0))
326     sigma[1]+=GetOuter2PRF()->GetSigmaX()*GetOuter2PRF()->GetSigmaX();
327
328
329   sigma[0]/= GetZWidth()*GetZWidth();
330   sigma[1]/=GetPadPitchWidth(index[0])*GetPadPitchWidth(index[0]);
331 }
332
333
334
335
336 void AliTPCParamSR::GetSpaceResolution(Float_t *x, Int_t *index, Float_t *angle, 
337                                        Float_t amplitude, Int_t mode, Float_t *sigma)
338 {
339   //
340   //
341   //
342   
343 }
344 Float_t  AliTPCParamSR::GetAmp(Float_t *x, Int_t *index, Float_t *angle)
345 {
346   //
347   //
348   //
349   return 0;
350 }
351
352 Float_t * AliTPCParamSR::GetAnglesAccMomentum(Float_t *x, Int_t * index, Float_t* momentum, Float_t *angle)
353 {
354   //
355   //calculate angle of track to padrow at given position
356   // for given magnetic field and momentum of the particle
357   //
358
359   TransformTo2(x,index);
360   AliDetectorParam::GetAnglesAccMomentum(x,index,momentum,angle);    
361   Float_t addangle = TMath::ASin(x[1]/GetPadRowRadii(index[1],index[2]));
362   angle[1] +=addangle;
363   return angle;                          
364 }
365
366          
367 Bool_t AliTPCParamSR::Update()
368 {
369   Int_t i;
370   if (AliTPCParam::Update()==kFALSE) return kFALSE;
371   fbStatus = kFALSE;
372
373  Float_t firstrow = fInnerRadiusLow + 2.225 ;   
374  for( i= 0;i<fNRowLow;i++)
375    {
376      Float_t x = firstrow + fInnerPadPitchLength*(Float_t)i;  
377      fPadRowLow[i]=x;
378      // number of pads per row
379      Float_t y = (x-0.5*fInnerPadPitchLength)*tan(fInnerAngle/2.)-fInnerWireMount-
380        fInnerPadPitchWidth/2.;
381      fYInner[i]  = x*tan(fInnerAngle/2.)-fInnerWireMount;
382      fNPadsLow[i] = 1+2*(Int_t)(y/fInnerPadPitchWidth) ;
383    }
384  firstrow = fOuterRadiusLow + 1.6;
385  for(i=0;i<fNRowUp;i++)
386    {
387      if(i<fNRowUp1){
388        Float_t x = firstrow + fOuter1PadPitchLength*(Float_t)i; 
389        fPadRowUp[i]=x;
390     Float_t y =(x-0.5*fOuter1PadPitchLength)*tan(fOuterAngle/2.)-fOuterWireMount-
391           fOuterPadPitchWidth/2.;
392      fYOuter[i]= x*tan(fOuterAngle/2.)-fOuterWireMount;
393      fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ;
394      if(i==fNRowUp1-1) {
395        fLastWireUp1=fPadRowUp[i] +0.375;
396        firstrow = fPadRowUp[i] + 0.5*(fOuter1PadPitchLength+fOuter2PadPitchLength);
397      }
398      }
399      else
400        {
401          Float_t x = firstrow + fOuter2PadPitchLength*(Float_t)(i-64);
402          fPadRowUp[i]=x;
403 Float_t y =(x-0.5*fOuter2PadPitchLength)*tan(fOuterAngle/2.)-fOuterWireMount-
404            fOuterPadPitchWidth/2.;
405          fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ; 
406        }
407      fYOuter[i]  = fPadRowUp[i]*tan(fOuterAngle/2.)-fOuterWireMount;
408    }
409  fNtRows = fNInnerSector*fNRowLow+fNOuterSector*fNRowUp;
410  fbStatus = kTRUE;
411  return kTRUE;
412 }
413 Float_t AliTPCParamSR::GetYInner(Int_t irow) const
414 {
415   return fYInner[irow];
416 }
417 Float_t AliTPCParamSR::GetYOuter(Int_t irow) const
418 {
419   return fYOuter[irow];
420 }
421
422 void AliTPCParamSR::Streamer(TBuffer &R__b)
423 {
424    // Stream an object of class AliTPC.
425
426    if (R__b.IsReading()) {
427       Version_t R__v = R__b.ReadVersion(); if (R__v) { }
428       //      TObject::Streamer(R__b);
429       AliTPCParam::Streamer(R__b);
430       //      if (R__v < 2) return;
431        Update();
432    } else {
433       R__b.WriteVersion(AliTPCParamSR::IsA());
434       //TObject::Streamer(R__b);  
435       AliTPCParam::Streamer(R__b);    
436    }
437 }
438 Int_t  AliTPCParamSR::CalcResponseFast(Float_t* xyz, Int_t * index, Int_t row)
439 {
440   //
441   //calculate bin response as function of the input position -x 
442   //return number of valid response bin
443   //
444   //we suppose that coordinate is expressed in float digits 
445   // it's mean coordinate system 8
446   //xyz[0] - float padrow xyz[1] is float pad  (center pad is number 0) and xyz[2] is float time bin
447   if ( (fInnerPRF==0)||(fOuter1PRF==0)||(fOuter2PRF==0) ||(fTimeRF==0) ){ 
448     Error("AliTPCParamSR", "response function was not adjusted");
449     return -1;
450   }
451   
452   const Int_t padn =  500;
453   const Float_t fpadn =  500.;
454   const Int_t timen = 500;
455   const Float_t ftimen = 500.;
456   const Int_t padrn = 500;
457   const Float_t fpadrn = 500.;
458
459  
460
461   static Float_t prfinner[2*padrn][5*padn];  //pad divided by 50
462   static Float_t prfouter1[2*padrn][5*padn];  //prfouter division
463   static Float_t prfouter2[2*padrn][5*padn];
464
465   static Float_t rftime[5*timen];         //time division
466   static Int_t blabla=0;
467   static Float_t zoffset=0;
468   static Float_t zwidth=0;
469   static Float_t zoffset2=0;
470   static TH1F * hdiff=0;
471   static TH1F * hdiff1=0;
472   static TH1F * hdiff2=0;
473   
474   if (blabla==0) {  //calculate Response function - only at the begginning
475     hdiff =new TH1F("prf_diff","prf_diff",10000,-1,1);
476     hdiff1 =new TH1F("no_repsonse1","no_response1",10000,-1,1);
477     hdiff2 =new TH1F("no_response2","no_response2",10000,-1,1);
478     
479     blabla=1;
480     zoffset = GetZOffset();
481     zwidth  = fZWidth;
482     zoffset2 = zoffset/zwidth;
483     for (Int_t i=0;i<5*timen;i++){
484       rftime[i] = fTimeRF->GetRF(((i-2.5*ftimen)/ftimen)*zwidth+zoffset);
485     }
486     for (Int_t i=0;i<5*padn;i++){    
487       for (Int_t j=0;j<2*padrn;j++){
488         prfinner[j][i] =
489           fInnerPRF->GetPRF((i-2.5*fpadn)/fpadn
490                             *fInnerPadPitchWidth,(j-fpadrn)/fpadrn*fInnerPadPitchLength);
491         prfouter1[j][i] =
492           fOuter1PRF->GetPRF((i-2.5*fpadn)/fpadn
493                             *fOuterPadPitchWidth,(j-fpadrn)/fpadrn*fOuter1PadPitchLength);
494
495         //
496         prfouter2[j][i] =
497           fOuter2PRF->GetPRF((i-2.5*fpadn)/fpadn
498                             *fOuterPadPitchWidth,(j-fpadrn)/fpadrn*fOuter2PadPitchLength);
499       }
500     }      
501   } // the above is calculated only once
502
503   // calculate central padrow, pad, time
504   Int_t npads = GetNPads(index[1],index[3]);
505   Int_t cpadrow = index[2]; // electrons are here
506   Int_t cpad    = TMath::Nint(xyz[1]);
507   Int_t ctime   = TMath::Nint(xyz[2]+zoffset2);
508   //calulate deviation
509   Float_t dpadrow = xyz[0];
510   Float_t dpad    = xyz[1]-cpad;
511   Float_t dtime   = xyz[2]+zoffset2-ctime;
512   Int_t cindex =0;
513   Int_t cindex3 =0;
514   Int_t maxt =GetMaxTBin();
515
516   Int_t fpadrow;
517   Int_t lpadrow;
518
519   if (row>=0) { //if we are interesting about given pad row
520     fpadrow = row-cpadrow;
521     lpadrow = row-cpadrow;
522   }else{
523     fpadrow = (index[2]>1) ? -1 :0;
524     lpadrow = (index[2]<GetNRow(index[1])-1) ? 1:0;
525   }
526   Int_t fpad =  (cpad > -npads/2+1) ? -2: -npads/2-cpad;
527   Int_t lpad =  (cpad < npads/2-1)  ?  2: npads/2-cpad;
528   Int_t ftime =  (ctime>1) ? -2: -ctime;
529   Int_t ltime =  (ctime<maxt-2) ? 2: maxt-ctime-1;
530
531   // cross talk from long pad to short one
532   if(row==fNRowUp1-1 && fpadrow==-1) {
533     dpadrow *= fOuter2PadPitchLength;
534     dpadrow += fOuterWWPitch;
535     dpadrow /= fOuter1PadPitchLength;
536   }    
537   // cross talk from short pad to long one
538   if(row==fNRowUp1 && fpadrow==1){ 
539     dpadrow *= fOuter1PadPitchLength;
540     if(dpadrow < -0.) dpadrow = -1.; //protection against 3rd wire
541     dpadrow += fOuterWWPitch;
542     dpadrow /= fOuter2PadPitchLength;
543     
544   }
545   // "normal"
546   Int_t apadrow = TMath::Nint((dpadrow-fpadrow)*fpadrn+fpadrn);
547   for (Int_t ipadrow = fpadrow; ipadrow<=lpadrow;ipadrow++){
548     if ( (apadrow<0) || (apadrow>=2*padrn)) 
549       continue;
550     Int_t apad= TMath::Nint((dpad-fpad)*fpadn+2.5*fpadn);
551     for (Int_t ipad = fpad; ipad<=lpad;ipad++){
552         Float_t cweight;
553         if (index[1]<fNInnerSector)
554           cweight=prfinner[apadrow][apad];
555         else{
556           if(row < fNRowUp1)
557             cweight=prfouter1[apadrow][apad];
558           else cweight=prfouter2[apadrow][apad];
559         }
560
561         //      if (cweight<fResponseThreshold) continue;
562         Int_t atime = TMath::Nint((dtime-ftime)*ftimen+2.5*ftimen);
563         for (Int_t itime = ftime;itime<=ltime;itime++){ 
564           Float_t cweight2 = cweight*rftime[atime];
565           if (cweight2>fResponseThreshold) {
566             fResponseBin[cindex3++]=cpadrow+ipadrow;
567             fResponseBin[cindex3++]=cpad+ipad;
568             fResponseBin[cindex3++]=ctime+itime;
569             fResponseWeight[cindex++]=cweight2;
570             
571             if (cweight2>100) 
572               {
573                 printf("Pici pici %d %f %d\n",ipad,dpad,apad);
574               }
575             
576           }
577           atime-=timen;
578         }
579         apad-= padn;    
580     }
581     apadrow-=padrn;
582   }
583   fCurrentMax=cindex;   
584   return fCurrentMax;    
585   
586 }
587
588
589
590
591
592
593