]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
digitizer and calibration for pdc
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Apr 2008 14:39:24 +0000 (14:39 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 10 Apr 2008 14:39:24 +0000 (14:39 +0000)
T0/AliT0Calibrator.cxx
T0/AliT0Digitizer.cxx
T0/AliT0Digitizer.h
T0/AliT0Reconstructor.cxx

index 655a4aa2b58cc245039c664aa5624ae57ee4f53d..4c9edd4d8015bf846c9904632953a87512cc3728 100644 (file)
@@ -48,27 +48,31 @@ ClassImp(AliT0Calibrator)
    param->Init();
   
   fChannelWidth = param->GetChannelWidth() ;  
-  Double_t *grY ;
-  Double_t *grX ;
-  Int_t index[2500];
+  Double_t *grY ; //= new grY[2500] ;
+  // Double_t *grX ;
+  Int_t index[25000];
   Bool_t down=true;
   for (Int_t i=0; i<24; i++){
     fMaxValue[i]=0;
     fTimeDelayCFD[i] = Int_t (param->GetTimeDelayCFD(i));
        
-    //  TGraph* fu = param ->GetWalk(i);
-     TGraph* fu  = param ->GetAmpLEDRec(i);
-    if(fu) {
+     TGraph* fu = param ->GetWalk(i);
+     //    TGraph* fu  = param ->GetAmpLEDRec(i);
+       fWalk.AddAtAndExpand(fu,i);
+       
+  if(fu) {
       Int_t np=fu->GetN();
       if(np>0) {
        grY = fu->GetY();
-       grX = fu->GetX();
+       //      grX[i] = fu->GetX();
        TMath::Sort(np, grY, index,down);
        fMaxValue[i]=Int_t(grY[index[0]]);
-       fWalk.AddAtAndExpand(fu,i);
+
       }
     }
+       
   }
+
   //  delete [] grY;
   //  delete [] grX;
   
@@ -118,8 +122,8 @@ Int_t  AliT0Calibrator::WalkCorrection(Int_t ipmt, Int_t qt, Int_t time, TString
     walk=Int_t(fu1->Eval(Double_t(qt)));
   }
   if (option == "pdc") {
-    timeWalk = time + Int_t((fMaxValue[ipmt]-walk)/fChannelWidth) ;
-    timeEq= timeWalk - (fTimeDelayCFD[ipmt]-fTimeDelayCFD[0]);
+    timeWalk = time + Int_t(fMaxValue[ipmt]-walk) ;
+    timeEq= timeWalk - fTimeDelayCFD[ipmt];
      AliDebug(10,Form(" ipmt %i time before %i timeWalk %i ,  qt %i timeEq %i \n ",
                 ipmt, time,timeWalk, qt, timeEq ));
   }
index f6ec5d599f3f3e498b3ecbb8dfbab9550250cef1..5e1e2c3dea74b211cd397a673c03327ec13ff087 100644 (file)
@@ -88,6 +88,8 @@ AliT0Digitizer::AliT0Digitizer(AliRunDigitizer* manager)
   AliDebug(1,"processed");
   fParam = AliT0Parameters::Instance();
   fParam->Init();
+  Int_t index[25000];
+  Bool_t down=true;
 
   for (Int_t i=0; i<24; i++){
     TGraph* gr = fParam ->GetAmpLEDRec(i);
@@ -102,11 +104,19 @@ AliT0Digitizer::AliT0Digitizer(AliRunDigitizer* manager)
     }
     
     TGraph *grInverse = new TGraph(np,y1,x1);
-    delete [] x1;
-    delete [] y1;
     fAmpLED.AddAtAndExpand(grInverse,i);
+
+     TGraph* grw = fParam ->GetWalk(i);
+      Int_t npw = grw->GetN();
+     Double_t *yw = grw->GetY();
+    TMath::Sort(npw, yw, index,down);
+    fMaxValue[i]=Int_t(yw[index[0]]);
   }
+
+    //    delete [] x1;
+    //   delete [] y1;
 }
+
 //------------------------------------------------------------------------
 AliT0Digitizer::~AliT0Digitizer()
 {
@@ -286,7 +296,7 @@ void AliT0Digitizer::Exec(Option_t* /*option*/)
          qt= 50.*al/ph2Mip;  // 50mv/Mip amp in mV 
          //  fill TDC
          timeDelayCFD[i] = fParam->GetTimeDelayCFD(i);
-         trCFD = Int_t (timeGaus[i]/channelWidth + (timeDelayCFD[i]-timeDelayCFD[0])); 
+         trCFD = Int_t (timeGaus[i]/channelWidth + timeDelayCFD[i]); 
          TGraph* gr = ((TGraph*)fAmpLED.At(i));
          sl = gr->Eval(qt);
 
@@ -301,9 +311,8 @@ void AliT0Digitizer::Exec(Option_t* /*option*/)
          // put slewing 
          TGraph *fu=(TGraph*) fParam ->GetWalk(i) ;
          Float_t slew=fu->Eval(Float_t(qtCh));
-         hr=fu->GetHistogram();
-         Float_t maxValue=hr->GetMaximum(50);
-         trCFD=trCFD-Int_t((maxValue-slew)/channelWidth);
+
+         trCFD=trCFD-Int_t(fMaxValue[i]-slew);
          ftimeCFD->AddAt(Int_t (trCFD),i);
          AliDebug(10,Form("  pmt %i : time in ns %f time in channels %i   ",
                           i, timeGaus[i],trCFD ));
index 624367e86f297e4301b79bdac9bfa8aca3942026..f4a73f610d23a8716b5324f3a37fa0adf7ec5224 100644 (file)
@@ -44,6 +44,7 @@ private:
   TArrayI *fADC0;        //! array of QTC signals (main amplitude)
   Int_t fSumMult;        // multiplicity
   TObjArray fAmpLED;     // amplitude time (CFD-LED) dependence
+  Double_t fMaxValue[24];  //max amplitue-time LED
 
   AliT0Parameters  *fParam;           //pointer to T0 parameters class     
 
index dba814360b1f78cd4bf0039894da89c83092cde9..71afbc5d7e43b8977f18f46810a080ed3f6cd52e 100644 (file)
@@ -60,7 +60,8 @@ ClassImp(AliT0Reconstructor)
   
   fdZonC = TMath::Abs(fParam->GetZPositionShift("T0/C/PMT1"));
   fdZonA = TMath::Abs(fParam->GetZPositionShift("T0/A/PMT15"));
-  fCalib = new AliT0Calibrator(); 
+  fCalib = new AliT0Calibrator();
+
 }
 //____________________________________________________________________
 
@@ -112,7 +113,7 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
   //  Int_t mV2Mip = param->GetmV2Mip();     
   //mV2Mip = param->GetmV2Mip();     
   Float_t channelWidth = fParam->GetChannelWidth() ;  
-  Int_t meanT0 = fParam->GetMeanT0();
+  //  Int_t meanT0 = fParam->GetMeanT0();
   
   AliDebug(1,Form("Start DIGITS reconstruction "));
   
@@ -145,19 +146,22 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
   AliT0RecPoint* frecpoints= new AliT0RecPoint ();
   clustersTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1);
   
 Float_t time[24], adc[24];
+ Float_t time[24], adc[24];
   for (Int_t ipmt=0; ipmt<24; ipmt++) {
     if(timeCFD->At(ipmt)>0 ){
       Double_t qt0 = Double_t(chargeQT0->At(ipmt));
       Double_t qt1 = Double_t(chargeQT1->At(ipmt));
-      if((qt1-qt0)>0)  adc[ipmt] = TMath::Exp( Double_t (channelWidth*(qt1-qt0)/1000));
+      if((qt1-qt0)>0)  adc[ipmt] = Int_t (TMath::Exp( Double_t (channelWidth*(qt1-qt0)/1000)));
+
       time[ipmt] = fCalib-> WalkCorrection( ipmt, Int_t(qt1) , timeCFD->At(ipmt), "pdc" ) ;
       
       //LED
       Double_t sl = (timeLED->At(ipmt) - time[ipmt])*channelWidth;
       Double_t qt=((TGraph*)fAmpLEDrec.At(ipmt))->Eval(sl/1000.);
-      frecpoints->SetTime(ipmt,time[ipmt]);
-      frecpoints->SetAmp(ipmt,adc[ipmt]);
+      AliDebug(1,Form(" ipmt %i QTC %i , time in chann %i (led-cfd) %i ",
+                      ipmt, Int_t(adc[ipmt]) ,Int_t(time[ipmt]),Int_t( sl)));
+      frecpoints->SetTime(ipmt,Int_t(time[ipmt]));
+      frecpoints->SetAmp(ipmt,Int_t (adc[ipmt]));
       frecpoints->SetAmpLED(ipmt,qt);
     }
     else {
@@ -183,12 +187,13 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
   }
   if(besttimeA !=999999)  frecpoints->SetTimeBestA(Int_t(besttimeA));
   if( besttimeC != 999999 ) frecpoints->SetTimeBestC(Int_t(besttimeC));
-  AliDebug(1,Form(" besttimeA %f ps,  besttimeC %f ps",besttimeA, besttimeC));
+  AliDebug(1,Form(" besttimeA %f ch,  besttimeC %f ch",besttimeA, besttimeC));
   Float_t c = 0.0299792; // cm/ps
   Float_t vertex = 0;
   if(besttimeA !=999999 && besttimeC != 999999 ){
-    timeDiff =(besttimeC - besttimeA)*channelWidth;
-    meanTime = (meanT0 - (besttimeA + besttimeC)/2) * channelWidth;
+    timeDiff = (besttimeC - besttimeA)*channelWidth;
+    meanTime = (Float_t((besttimeA + besttimeC)/2) * channelWidth); 
+    //    meanTime = (meanT0 - (besttimeA + besttimeC)/2) * channelWidth;
     vertex = c*(timeDiff)/2. + (fdZonA - fdZonC)/2; //-(lenr-lenl))/2;
     AliDebug(1,Form("  timeDiff %f ps,  meanTime %f ps, vertex %f cm",timeDiff, meanTime,vertex ));
     frecpoints->SetVertex(vertex);
@@ -199,7 +204,7 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
   for (Int_t ipmt=0; ipmt<24; ipmt++) {
     if(time[ipmt]>1) {
 //      time[ipmt] = (time[ipmt] - fTime0vertex[ipmt])*channelWidth;
-      time[ipmt] = time[ipmt] * channelWidth;
+      time[ipmt] =Int_t  ( Float_t(time[ipmt]) * channelWidth);
       frecpoints->SetTime(ipmt,time[ipmt]);
     }
   }
@@ -231,11 +236,11 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
        for (Int_t j0=0; j0<5; j0++) allData[i0][j0]=0;         
      }
    
-   Int_t besttimeA=9999999;
-   Int_t besttimeC=9999999;
+   Float_t besttimeA=9999999;
+   Float_t besttimeC=9999999;
    Int_t pmtBestA=99999;
    Int_t pmtBestC=99999;
-   Int_t timeDiff=9999999, meanTime=0;
+   Float_t timeDiff=9999999, meanTime=0;
    Double_t qt=0;
    
    AliT0RecPoint* frecpoints= new AliT0RecPoint ();
@@ -258,7 +263,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
        
        Float_t channelWidth = fParam->GetChannelWidth() ;  
        
-       Int_t meanT0 = fParam->GetMeanT0();
+       //       Int_t meanT0 = fParam->GetMeanT0();
        if(option == "pdc"){
         for (Int_t in=0; in<24; in++)  
           {
@@ -297,7 +302,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
         AliDebug(10, Form(" readed Raw %i %i %i %i %i", in, timeLED[in],timeCFD[in],chargeQT0[in],chargeQT1[in]));
        
        
-       Int_t time[24], adc[24];
+       Float_t time[24], adc[24];
        for (Int_t ipmt=0; ipmt<24; ipmt++) {
         if(timeCFD[ipmt]>0 && timeLED[ipmt]>0){
           
@@ -309,10 +314,10 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
             Double_t sl = (timeLED[ipmt] - time[ipmt])*channelWidth;
             if(fAmpLEDrec.At(ipmt)) 
               qt=((TGraph*)fAmpLEDrec.At(ipmt))->Eval(sl/1000.);
-            frecpoints->SetTime(ipmt,time[ipmt]);
-            frecpoints->SetAmp(ipmt,adc[ipmt]);
+            frecpoints->SetTime(ipmt,Int_t(time[ipmt]));
+            frecpoints->SetAmp(ipmt,Int_t(adc[ipmt]));
             frecpoints->SetAmpLED(ipmt,qt);
-            AliDebug(10,Form(" QTC %i mv,  time in chann %i ",adc[ipmt] ,time[ipmt]));
+            AliDebug(10,Form(" QTC %f mv,  time in chann %f ",adc[ipmt] ,time[ipmt]));
           }
           if(option == "cosmic") {
             //      if(ipmt == 15) continue; //skip crashed PMT
@@ -358,16 +363,18 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
        }
        if(besttimeA !=9999999)  frecpoints->SetTimeBestA(Int_t(besttimeA));
        if( besttimeC != 9999999 ) frecpoints->SetTimeBestC(Int_t(besttimeC));
-       AliDebug(1,Form(" besttimeA %i ps,  besttimeC %i ps",besttimeA, besttimeC));
+       AliDebug(1,Form(" besttimeA %f ps,  besttimeC %f ps",besttimeA, besttimeC));
        Float_t c = 0.0299792; // cm/ps
        Float_t vertex = 99999;
        if(besttimeA <9999999 && besttimeC < 9999999 ){
-        timeDiff =Int_t (( besttimeC - besttimeA) *channelWidth);
+        timeDiff = ( besttimeC - besttimeA) *channelWidth;
         if(option == "pdc") 
-          meanTime = Int_t((meanT0 - (besttimeA + besttimeC)/2) * channelWidth);
-        if(option == "cosmic")   meanTime =  (besttimeA + besttimeC)/2;  
-        vertex = c*(Float_t(timeDiff))/2.+ (fdZonA - fdZonC)/2; 
-        AliDebug(1,Form("  timeDiff %i ps,  meanTime %i ps, vertex %f cm",timeDiff, meanTime,vertex ));
+          //      meanTime = Int_t((meanT0 - (besttimeA + besttimeC)/2) * channelWidth);
+          meanTime = (besttimeA + besttimeC)/2 * channelWidth; 
+        if(option == "cosmic")
+          meanTime =  Float_t((besttimeA + besttimeC)/2);  
+        vertex = c*(timeDiff)/2.+ (fdZonA - fdZonC)/2; 
+        AliDebug(1,Form("  timeDiff %f ps,  meanTime %f ps, vertex %f cm",timeDiff, meanTime,vertex ));
         frecpoints->SetVertex(vertex);
         frecpoints->SetMeanTime(Int_t(meanTime));