]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0Reconstructor.cxx
new pedestal treatment
[u/mrichter/AliRoot.git] / T0 / AliT0Reconstructor.cxx
index 3664505b7bd353e151b8713b197c705005192253..dd19241ead1a22a9570f00620562f44bcbbdec98 100644 (file)
@@ -122,7 +122,7 @@ ClassImp(AliT0Reconstructor)
   //here real Z position
   fdZonC = TMath::Abs(fParam->GetZPosition("T0/C/PMT1"));
   fdZonA = TMath::Abs(fParam->GetZPosition("T0/A/PMT15"));
-
+  //  printf(" !!!! fdZonC %f fdZonA %f \n", fdZonC/29.9792458, fdZonA/29.9792458);
   fCalib = new AliT0Calibrator();
   fESDTZEROfriend = new AliESDTZEROfriend();
   fESDTZERO  = new AliESDTZERO();
@@ -144,7 +144,7 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
  
   Float_t c = 29.9792458; // cm/ns
   Float_t channelWidth = fParam->GetChannelWidth() ;  
-  Double32_t vertex = 9999999, meanVertex = 9999999 ;
+  Double32_t vertex = 9999999, meanVertex = 0 ;
   Double32_t timeDiff=999999, meanTime=999999, timeclock=999999;
   
   
@@ -193,16 +193,18 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
   Float_t time[24], adc[24], adcmip[24];
   for (Int_t ipmt=0; ipmt<24; ipmt++) {
     if(timeCFD->At(ipmt)>0 ) {
+      Float_t timefull = 0.001*( timeCFD->At(ipmt) - 513 - timeDelayCFD[ipmt])  * channelWidth;
+      frecpoints.SetTimeFull(ipmt, 0 ,timefull) ;
       if(( chargeQT1->At(ipmt) - chargeQT0->At(ipmt))>0)  
        adc[ipmt] = chargeQT1->At(ipmt) - chargeQT0->At(ipmt);
       else
        adc[ipmt] = 0;
       
       time[ipmt] = fCalib-> WalkCorrection(refAmp, ipmt, Int_t(adc[ipmt]),  timeCFD->At(ipmt)) ;
-      
+      time[ipmt] =   time[ipmt] - 513;   
       Double_t sl = Double_t(timeLED->At(ipmt) - timeCFD->At(ipmt));
       //    time[ipmt] = fCalib-> WalkCorrection( refAmp,ipmt, Int_t(sl),  timeCFD->At(ipmt) ) ;
-      AliDebug(5,Form(" ipmt %i QTC %i , time in chann %i (led-cfd) %i ",
+      AliDebug(5,Form(" ipmt %i QTC  %i , time in chann %i (led-cfd) %i ",
                      ipmt, Int_t(adc[ipmt]) ,Int_t(time[ipmt]),Int_t( sl)));
       
       Double_t ampMip = 0;
@@ -219,7 +221,7 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
       
     }
     else {
-      time[ipmt] = 0;
+      time[ipmt] = -99999;
       adc[ipmt] = 0;
       adcmip[ipmt] = 0;
       
@@ -247,14 +249,14 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
     }
   
   if( besttimeA < 999999 && besttimeA!=0) {
-    frecpoints.SetTimeBestA((besttimeA_best * channelWidth  - fdZonA/c)  - 12500.);
-    frecpoints.SetTime1stA((besttimeA * channelWidth  - fdZonA/c)  - 12500.);
+    frecpoints.SetTimeBestA((besttimeA_best * channelWidth  - fdZonA/c)  );
+    frecpoints.SetTime1stA((besttimeA * channelWidth  - fdZonA/c ) );
     tr[1]=true;
   }
   
   if( besttimeC < 999999 && besttimeC!=0) {
-    frecpoints.SetTimeBestC((besttimeC_best * channelWidth  - fdZonC/c)  - 12500.);
-    frecpoints.SetTime1stC((besttimeC * channelWidth  - fdZonC/c)  - 12500.);
+    frecpoints.SetTimeBestC((besttimeC_best * channelWidth  - fdZonC/c) );
+    frecpoints.SetTime1stC((besttimeC * channelWidth  - fdZonC/c ) );
     tr[2]=true;
   }
   
@@ -267,18 +269,18 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
     timeDiff = (besttimeA - besttimeC)*channelWidth;
     meanTime = channelWidth * (besttimeA_best + besttimeC_best)/2. ; 
     timeclock = channelWidth * (besttimeA + besttimeC)/2. ;
-    vertex = meanVertex - c*(timeDiff)/2.;// + (fdZonA - fdZonC)/2;
+    vertex = meanVertex - 0.001* c*(timeDiff)/2.;// + (fdZonA - fdZonC)/2;
     tr[0]=true; 
   }
   frecpoints.SetVertex(vertex);
-  frecpoints.SetMeanTime(meanTime - 12500.);
-  frecpoints.SetT0clock(timeclock - 12500.);
+  frecpoints.SetMeanTime(meanTime );
+  frecpoints.SetT0clock(timeclock );
   frecpoints.SetT0Trig(tr);
   
- AliDebug(5,Form("fRecPoints:::  1stimeA %f , besttimeA %f 1sttimeC %f besttimeC %f shiftA %f shiftC %f ",
+ AliDebug(5,Form("fRecPoints:::  1stimeA %f , besttimeA %f 1sttimeC %f besttimeC %f vertex %f",
                  frecpoints.Get1stTimeA(),  frecpoints.GetBestTimeA(),
                  frecpoints.Get1stTimeC(),  frecpoints.GetBestTimeC(), 
-                 fTimeMeanShift[1],fTimeMeanShift[2] ) );
+                 vertex ) );
   
   AliDebug(5,Form("T0 triggers %d %d %d %d %d",tr[0],tr[1],tr[2],tr[3],tr[4]));
   
@@ -331,10 +333,13 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
   Double32_t vertex = 9999999;
   Int_t onlineMean=0;
   Float_t meanVertex = 0;
+  Int_t pedestal[24];
   for (Int_t i0=0; i0<24; i0++) {
-    low[i0] = Int_t(fTime0vertex[i0]) - 200;
-    high[i0] = Int_t(fTime0vertex[i0]) + 200;
-    time2zero[i0] = 99999;
+    low[i0] = Int_t(fTime0vertex[i0]) - 50;
+    high[i0] = Int_t(fTime0vertex[i0]) + 50;
+    time2zero[i0] = 999999;
+    pedestal[i0]=GetRecoParam()->GetLow(i0+100);
+    //   printf("pmt %i pedestal %i\n", i0,pedestal[i0]);
   }
   
   for (Int_t i0=0; i0<110; i0++)
@@ -342,7 +347,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
   
   Float_t lowAmpThreshold =  GetRecoParam()->GetAmpLowThreshold();  
   Float_t highAmpThreshold =  GetRecoParam()->GetAmpHighThreshold(); 
-  printf( "AliT0Reconstructor::Reconstruct::: RecoParam amplitude %f %f \n",lowAmpThreshold, highAmpThreshold);
+  //  printf( "AliT0Reconstructor::Reconstruct::: RecoParam amplitude %f %f \n",lowAmpThreshold, highAmpThreshold);
  
   Double32_t besttimeA=9999999;  Double32_t besttimeA_best=9999999;
   Double32_t besttimeC=9999999;  Double32_t besttimeC_best=9999999;
@@ -427,10 +432,9 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
        
        Double32_t time[24], adc[24], adcmip[24], noncalibtime[24];
        for (Int_t ipmt=0; ipmt<24; ipmt++) {
-         if(timeCFD[ipmt] >  0 /* && badpmt[ipmt]==0*/ ){
-          //for simulated data
+         if(timeCFD[ipmt] >  0 &&( chargeQT0[ipmt] - chargeQT1[ipmt])>pedestal[ipmt] /* && badpmt[ipmt]==0*/ ) {
             //for physics  data
-          if(( chargeQT0[ipmt] - chargeQT1[ipmt])>0)  {
+          if(( chargeQT0[ipmt] - chargeQT1[ipmt])>pedestal[ipmt])  {
             adc[ipmt] = chargeQT0[ipmt] - chargeQT1[ipmt];
           }
           else
@@ -456,10 +460,11 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
           else 
             frecpoints.SetTime(ipmt, Float_t(time[ipmt] + fTime0vertex[ipmt]) );
               // frecpoints.SetTime(ipmt, Float_t(time[ipmt] ) );
-            }
+            
           frecpoints.SetAmp(ipmt, Double32_t( qtMip)); 
           adcmip[ipmt]=qtMip;
-          frecpoints.SetAmpLED(ipmt, Double32_t(ampMip));           
+          frecpoints.SetAmpLED(ipmt, Double32_t(ampMip));
+            }       
           noncalibtime[ipmt]= Double32_t (timeCFD[ipmt]);
         }
         else {
@@ -485,7 +490,8 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
         {
           if(time[ipmt] != 0 &&  time[ipmt] > -9000 
              /* && badpmt[ipmt]==0*/ 
-             && adcmip[ipmt]>lowAmpThreshold && adcmip[ipmt]<highAmpThreshold)
+             && adcmip[ipmt]>lowAmpThreshold && adcmip[ipmt]<40)
+            //       && adcmip[ipmt]>lowAmpThreshold && adcmip[ipmt]<highAmpThreshold)
             {
               if(time[ipmt]<besttimeA) besttimeA=time[ipmt]; 
               if(TMath::Abs(time[ipmt] ) < TMath::Abs(besttimeA_best))