using reco and trigger parameters for T0
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Jun 2009 11:10:07 +0000 (11:10 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Jun 2009 11:10:07 +0000 (11:10 +0000)
T0/AliT0Calibrator.cxx
T0/AliT0Calibrator.h
T0/AliT0Reconstructor.cxx
T0/AliT0Reconstructor.h
T0/AliT0Trigger.cxx

index 2900d4b..e79d50e 100644 (file)
@@ -30,6 +30,8 @@
 #include "AliLog.h"
 #include "AliT0Parameters.h"
 #include "AliT0Calibrator.h"
+#include "AliT0Reconstructor.h"
+#include "AliT0RecoParam.h"
 #include <TGraph.h>
 #include <TH1F.h>
 #include <TMath.h>
@@ -44,18 +46,18 @@ ClassImp(AliT0Calibrator)
                                     
 {
   //constructor
-
    AliT0Parameters* param = AliT0Parameters::Instance();
    param->Init();
-  
+   //slewing correcion and equalizing channels
+
   fChannelWidth = param->GetChannelWidth() ;  
+   //   Double_t *grX ; 
   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);
-    fWalk.AddAtAndExpand(fu,i);        
+    fWalk.AddAtAndExpand(fu,i);
+     
   }
   
 }
@@ -88,16 +90,25 @@ AliT0Calibrator &AliT0Calibrator::operator=(const AliT0Calibrator &r)
 
 
 //____________________________________________________________________
-Int_t  AliT0Calibrator::WalkCorrection(Int_t ipmt, Int_t qt, Int_t time) 
+
+Int_t  AliT0Calibrator::WalkCorrection(Int_t refAmp,  Int_t ipmt, Int_t qt, Int_t time) 
+
 {
-  //slewing correcion and equalizing channels
+  //
+  // referemce amplitude for walk correction now read from RecoParam
+
+  Double_t *grY ; 
 
   Int_t walk=0;
 
   Int_t timeEq=0, timeWalk=0;  
   TGraph *fu1=(TGraph*) fWalk.At(ipmt);
-  if(fu1 && fu1->GetN()>0) 
-    walk=Int_t(fu1->Eval(Double_t(qt)));
+  if(fu1 && fu1->GetN()>0) {
+    grY = fu1->GetY();
+    fMaxValue[ipmt]=grY[refAmp-1];
+    //    TGraph* fu  = param ->GetAmpLEDRec(i);
+    walk = Int_t (fMaxValue[ipmt]) + Int_t(fu1->Eval(Double_t(qt)));
+  }
   
   timeWalk = time + walk   ;
   timeEq= timeWalk - fTimeDelayCFD[ipmt];
index 201dc01..55c6159 100644 (file)
 
 
 #include "TNamed.h"
+//#include "AliT0RecoParam.h"
 
 class AliT0Calibrator: public TNamed
  {
  public:
 
-  AliT0Calibrator();
+   AliT0Calibrator();
   AliT0Calibrator( const AliT0Calibrator&r );
   AliT0Calibrator& operator=(const AliT0Calibrator&r); 
   virtual ~AliT0Calibrator() {};
-  
+  //  const AliT0RecoParam* fRecoParam;     // Pointer to T0 Recon. Pars
+  //   const AliT0RecoParam* GetRecoParam() const { return fRecoParam; }
 
-  Int_t WalkCorrection(Int_t ipmt, Int_t qt, Int_t time) ;
+
+  Int_t WalkCorrection(Int_t refAmp, Int_t ipmt, Int_t qt, Int_t time) ;
   //  Int_t EquivalizeChannel(Int_t ipmt)  ;
  protected:
 
   Int_t           fTimeDelayCFD[24];  //CFD[i]-CFD[0]
-  Int_t           fMaxValue[24];  //CFD[i]-CFD[0]
+  Float_t           fMaxValue[24];  //CFD[i]-CFD[0]
   Float_t         fChannelWidth  ;   //channel width
   TObjArray       fWalk;             //walk correction function
-  
+  // const AliT0RecoParam* fRecoParam; ///< reference to reco parameters
+   
   ClassDef(AliT0Calibrator, 1)   // class for the T0 reconstruction
 
 };
index 04823b6..3807017 100644 (file)
@@ -50,11 +50,8 @@ ClassImp(AliT0Reconstructor)
 {
   //constructor
 
- AliDebug(1,"Start reconstructor ");
-  
   fParam = AliT0Parameters::Instance();
   fParam->Init();
-   TString option = GetOption(); 
  
   for (Int_t i=0; i<24; i++){
         TGraph* gr = fParam ->GetAmpLEDRec(i);
@@ -62,12 +59,13 @@ ClassImp(AliT0Reconstructor)
          TGraph* gr1 = fParam ->GetAmpLED(i);
          if (gr1) fAmpLED.AddAtAndExpand(gr1,i) ; 
          TGraph* gr2 = fParam ->GetQTC(i);
-         if (gr2) fQTC.AddAtAndExpand(gr2,i) ; 
-       
+         if (gr2) fQTC.AddAtAndExpand(gr2,i) ;         
   }
+
   
   fdZonC = TMath::Abs(fParam->GetZPositionShift("T0/C/PMT1"));
   fdZonA = TMath::Abs(fParam->GetZPositionShift("T0/A/PMT15"));
+
   fCalib = new AliT0Calibrator();
 
 }
@@ -76,13 +74,13 @@ ClassImp(AliT0Reconstructor)
 AliT0Reconstructor::AliT0Reconstructor(const AliT0Reconstructor &r):
   AliReconstructor(r),
                                             fdZonA(0),
-                                            fdZonC(0),
+                                            fdZonC(0),
                                             fZposition(0),
                                             fParam(NULL),
-                                             fAmpLEDrec(),
+                                             fAmpLEDrec(0),
                                             fQTC(0),
                                             fAmpLED(0),
-                                            fCalib()
+                                            fCalib()
 
  {
   //
@@ -99,7 +97,6 @@ AliT0Reconstructor &AliT0Reconstructor::operator=(const AliT0Reconstructor &r)
   //
   // Assignment operator
   //
-
   if (this != &r) ((AliT0Reconstructor &) r).Copy(*this);
   return *this;
 
@@ -111,9 +108,9 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
   
 {
   // T0 digits reconstruction
-  // T0RecPoint writing 
-  
-  
+  Int_t refAmp = GetRecoParam()->GetRefAmp();
+  Int_t refPoint = GetRecoParam()->GetRefPoint();
   TArrayI * timeCFD = new TArrayI(24); 
   TArrayI * timeLED = new TArrayI(24); 
   TArrayI * chargeQT0 = new TArrayI(24); 
@@ -151,9 +148,6 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
   Int_t pmtBestC=99999;
   Float_t timeDiff=999999, meanTime=0;
   
-  //  Int_t mv2MIP = fParam-> GetmV2Mip();     
-
-
   AliT0RecPoint* frecpoints= new AliT0RecPoint ();
   clustersTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1);
   
@@ -165,7 +159,7 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
       else
        adc[ipmt] = 0;
       
-      time[ipmt] = fCalib-> WalkCorrection( ipmt, adc[ipmt], Float_t( timeCFD->At(ipmt))) ;
+      time[ipmt] = fCalib-> WalkCorrection(refAmp, ipmt, adc[ipmt],  timeCFD->At(ipmt)) ;
             
       Double_t sl = Double_t(timeLED->At(ipmt) - timeCFD->At(ipmt));
       //    time[ipmt] = fCalib-> WalkCorrection( ipmt, Int_t(sl), timeCFD[ipmt],"cosmic" ) ;
@@ -215,7 +209,7 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
     frecpoints->SetMeanTime(Int_t(meanTime));
     //online mean
     frecpoints->SetOnlineMean(Int_t(onlineMean));
-    AliDebug(10,Form("  timeDiff %f ps,  meanTime %f ps, vertex %f cm online mean %i ps",timeDiff, meanTime,vertex, Int_t(onlineMean)));
+    AliDebug(10,Form("  timeDiff %f #channel,  meanTime %f #channel, vertex %f cm online mean %i ps",timeDiff, meanTime,vertex, Int_t(onlineMean)));
     
   }
   
@@ -233,9 +227,13 @@ void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
 void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) const
 {
   // T0 raw ->
-  // T0RecPoint writing 
-  
-  //Q->T-> coefficients !!!! should be measured!!!
+  //
+  // reference amplitude and time ref. point from reco param
+
+ Int_t refAmp = GetRecoParam()->GetRefAmp();
+ Int_t refPoint = GetRecoParam()->GetRefPoint();
+
+
   Int_t allData[110][5];
   
   Int_t timeCFD[24], timeLED[24], chargeQT0[24], chargeQT1[24];
@@ -251,13 +249,11 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
   Int_t pmtBestC=99999;
   Float_t timeDiff=9999999, meanTime=0;
   Float_t meanVertex = fParam->GetMeanVertex();
-  printf("meanVertex %f \n",meanVertex);
    
   AliT0RecPoint* frecpoints= new AliT0RecPoint ();
   
   recTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1);
    
-   
   AliDebug(10," before read data ");
   AliT0RawReader myrawreader(rawReader);
   if (!myrawreader.Next())
@@ -315,10 +311,11 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
           else
             adc[ipmt] = 0;
           
-          time[ipmt] = fCalib-> WalkCorrection( ipmt, adc[ipmt], timeCFD[ipmt]) ;
+
+          time[ipmt] = fCalib-> WalkCorrection(refAmp, ipmt, adc[ipmt], timeCFD[ipmt] ) ;
           
           Double_t sl = timeLED[ipmt] - timeCFD[ipmt];
-            //    time[ipmt] = fCalib-> WalkCorrection( ipmt, Int_t(sl), timeCFD[ipmt],"cosmic" ) ;
+            //    time[ipmt] = fCalib-> WalkCorrection( ipmt, Int_t(sl), timeCFD[ipmt] ) ;
           AliDebug(10,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 =( (TGraph*)fAmpLED.At(ipmt))->Eval(sl);
@@ -353,7 +350,7 @@ 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(5,Form(" pmtA %i besttimeA %f ps, pmtC %i besttimeC %f ps",
+       AliDebug(5,Form(" pmtA %i besttimeA %f ps, pmtC %i besttimeC %f #channel",
                       pmtBestA,besttimeA, pmtBestC,  besttimeC));
        Float_t c = 0.0299792458; // cm/ps
        Float_t vertex = 99999;
@@ -365,7 +362,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
         frecpoints->SetVertex(vertex);
         frecpoints->SetMeanTime(Int_t(meanTime));
         frecpoints->SetOnlineMean(Int_t(onlineMean));
-        AliDebug(5,Form("  timeDiff %f ps,  meanTime %f ps, vertex %f cm meanVertex %f online mean %i ",timeDiff, meanTime,vertex,meanVertex, onlineMean));
+        AliDebug(5,Form("  timeDiff %f #channel,  meanTime %f #channel, vertex %f cm meanVertex %f online mean %i ",timeDiff, meanTime,vertex,meanVertex, onlineMean));
         
        }
     } // if (else )raw data
index a8728eb..de6499e 100644 (file)
@@ -13,6 +13,7 @@
 #include "AliReconstructor.h"
 #include "AliT0Parameters.h"
 #include "AliT0Calibrator.h"
+#include "AliT0RecoParam.h"
 
 class AliT0Reconstructor: public AliReconstructor {
  public:
@@ -30,7 +31,10 @@ class AliT0Reconstructor: public AliReconstructor {
   virtual void     FillESD( TTree* digitsTree,  TTree*clustersTree, AliESDEvent*esd ) const;
 
   virtual Bool_t   HasDigitConversion() const {return kFALSE;}
+  static const AliT0RecoParam* GetRecoParam()
+    { return dynamic_cast<const AliT0RecoParam*>(AliReconstructor::GetRecoParam(11)); } // getting RecoParam obj
    
  protected:
   Float_t             fdZonA;             // Zideal - Zreal side A 
   Float_t             fdZonC;             // Zideal - Zreal side C
index 4360a30..47ab1c9 100644 (file)
 #include "AliRun.h"
 #include "AliRunLoader.h"
 #include "AliTriggerInput.h"
+#include "AliT0Parameters.h"
+#include "AliT0TriggerParameters.h"
+#include <AliCDBManager.h>        
+#include <AliCDBEntry.h>          
+#include <AliCDBStorage.h>  
 
 #include "AliT0.h"
 #include "AliT0digit.h"
 #include "AliT0Trigger.h"
 
+#include "Riostream.h"
+
 //----------------------------------------------------------------------
 ClassImp(AliT0Trigger)
 
@@ -44,13 +51,22 @@ AliT0Trigger::AliT0Trigger()
 {
    SetName("T0");
    CreateInputs();
+   AliCDBManager *stor =AliCDBManager::Instance();
+   //time equalizing
+   AliCDBEntry* fCalibentry  = stor->Get("T0/Calib/TriggerParam");
+   if (fCalibentry)
+     fTrigPar  = (AliT0TriggerParameters*)fCalibentry->GetObject();
+   else {
+         AliWarning(" No trigger parameters  in CDB , use default"); 
+   }
+
 }
 
 //----------------------------------------------------------------------
 void AliT0Trigger::CreateInputs()
 {
    // inputs 
-   
    // Do not create inputs again!!
    if( fInputs.GetEntriesFast() > 0 ) return;
    
@@ -59,6 +75,7 @@ void AliT0Trigger::CreateInputs()
    fInputs.AddLast( new AliTriggerInput( "T0_Vertex_L0", "T0", 0 ) );
    fInputs.AddLast( new AliTriggerInput( "T0_Centr_L0", "T0",  0 ) );
    fInputs.AddLast( new AliTriggerInput( "T0_SemiCentral_L0", "T0",  0 ) );
+
 }
 
 //----------------------------------------------------------------------
@@ -92,12 +109,19 @@ void AliT0Trigger::Trigger()
   Int_t   timeDiff = fDigits->TimeDiff();
   Int_t    sumMult=   fDigits->SumMult();
 
-  if (besttimeA > 0 && besttimeA <99999  )  SetInput("T0_A_L0");
-  if (besttimeC>0  && besttimeC<99999)   SetInput("T0_C_L0"); 
+  //trigger parameteres
+
+  Float_t timeWindowLow = fTrigPar->GetTimeWindowLow(); 
+  Float_t timeWindowHigh = fTrigPar->GetTimeWindowHigh(); 
+  Int_t ampCentr = fTrigPar->GetAmpCentr(); 
+  Int_t ampSemiCentr =  fTrigPar->GetAmpSemiCentr();
+
+  if (besttimeA > 0 && besttimeA <99999)  SetInput("T0_A_L0");
+  if (besttimeC > 0  && besttimeC<99999)   SetInput("T0_C_L0"); 
   //6093 corrsponds to vertex -20cm, 6202 vertex +20 with delay 150nc eqalized on the TVDC unit 
-  if (timeDiff >6090 && timeDiff < 6210)       SetInput("T0_Vertex_L0");
-  if (sumMult > 175)                           SetInput("T0_Centr_L0");
-  if (sumMult>155 && sumMult <= 175)           SetInput("T0_SemiCentral_L0");;
+  if (timeDiff >timeWindowLow && timeDiff < timeWindowHigh) SetInput("T0_Vertex_L0");
+  if (sumMult > ampCentr)  SetInput("T0_Centr_L0");
+  if (sumMult> ampSemiCentr && sumMult <= ampCentr) SetInput("T0_SemiCentral_L0");;
 
    
 }