]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0Trigger.cxx
Bug fix in the order of the Ds cuts (Sadhana, Francesco)
[u/mrichter/AliRoot.git] / T0 / AliT0Trigger.cxx
index 4c30bdc3006621a753673c3cd761767815969110..8fd9a54685e367ae5d7f7e6890bfb67df7085358 100644 (file)
  **************************************************************************/
 
 /* $Id$ */
+/***************************************************************
+ * T0 trigger class for T0 trigger signals:
+ *  - T0A
+ *  - T0C
+ *  - T0vertex
+ *  - T0 semi central event for ions
+ *  - T0 central            for ions
+ ****************************************************************/
+
 
-#include <Riostream.h>
 #include "AliLog.h"
 #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 "AliT0Loader.h"
 #include "AliT0digit.h"
 #include "AliT0Trigger.h"
 
+#include "Riostream.h"
+
 //----------------------------------------------------------------------
 ClassImp(AliT0Trigger)
 
@@ -33,31 +47,44 @@ ClassImp(AliT0Trigger)
 AliT0Trigger::AliT0Trigger()
   : AliTriggerDetector(),
     fT0(0x0),
-    fDigits(0x0)
+  fDigits(0x0),
+  fTrigPar(0x0) 
 {
    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;
    
-   fInputs.AddLast( new AliTriggerInput( "START_A_L0", "Signal on T0-A",  0x0100 ) );
-   fInputs.AddLast( new AliTriggerInput( "START_C_L0", "Signal on T0-C", 0x0200 ) );
-   fInputs.AddLast( new AliTriggerInput( "START_Vertex_L0", " Vertex T0-C&T0-A ", 0x0400 ) );
-   fInputs.AddLast( new AliTriggerInput( "START_Centr_L0", "Centrality central",  0x0800 ) );
-   fInputs.AddLast( new AliTriggerInput( "START_SemiCentral_L0", "Centrality semicentral",  0x1000 ) );
+   fInputs.AddLast( new AliTriggerInput( "0T0A", "T0",  0 ) );
+   fInputs.AddLast( new AliTriggerInput( "0T0C", "T0", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "0TVX", "T0", 0 ) );
+   fInputs.AddLast( new AliTriggerInput( "T0_Centr_L0", "T0",  0 ) );
+   fInputs.AddLast( new AliTriggerInput( "T0_SemiCentral_L0", "T0",  0 ) );
+
 }
 
 //----------------------------------------------------------------------
 void AliT0Trigger::Trigger()
 {
-   AliRunLoader* runLoader = gAlice->GetRunLoader();
+  // trigger input
+
+   AliRunLoader* runLoader = AliRunLoader::Instance();
    AliLoader * fT0Loader = runLoader->GetLoader("T0Loader");
    //   AliT0digit *fDigits; 
    fT0Loader->LoadDigits("READ");
@@ -68,7 +95,7 @@ void AliT0Trigger::Trigger()
     AliError("no digits tree");
     return;
   }
-  AliT0digit *fDigits = new AliT0digit();
+  fDigits = new AliT0digit();
 
   TBranch *brDigits = treeD->GetBranch("T0");
   if (brDigits) {
@@ -83,12 +110,19 @@ void AliT0Trigger::Trigger()
   Int_t   timeDiff = fDigits->TimeDiff();
   Int_t    sumMult=   fDigits->SumMult();
 
-  if (besttimeA > 0 && besttimeA <99999  )  SetInput("START_A_L0");
-  if (besttimeC>0  && besttimeC<99999)   SetInput("START_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("0T0A");
+  if (besttimeC > 0  && besttimeC<99999)   SetInput("0T0C"); 
   //6093 corrsponds to vertex -20cm, 6202 vertex +20 with delay 150nc eqalized on the TVDC unit 
-  if (timeDiff >6090 && timeDiff < 6210)       SetInput("START_Vertex_L0");
-  if (sumMult > 175)                           SetInput("START_Centr_L0");
-  if (sumMult>155 && sumMult <= 175)           SetInput("START_SemiCentral_L0");;
+  if (timeDiff >timeWindowLow && timeDiff < timeWindowHigh) SetInput("0TVX");
+  if (sumMult > ampCentr)  SetInput("T0_Centr_L0");
+  if (sumMult> ampSemiCentr && sumMult <= ampCentr) SetInput("T0_SemiCentral_L0");;
 
    
 }