LCOV - code coverage report
Current view: top level - T0/T0base - AliT0Trigger.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 44 49 89.8 %
Date: 2016-06-14 17:26:59 Functions: 5 5 100.0 %

          Line data    Source code
       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             : /* $Id$ */
      17             : /***************************************************************
      18             :  * T0 trigger class for T0 trigger signals:
      19             :  *  - T0A
      20             :  *  - T0C
      21             :  *  - T0vertex
      22             :  *  - T0 semi central event for ions
      23             :  *  - T0 central            for ions
      24             :  ****************************************************************/
      25             : 
      26             : 
      27             : #include "AliLog.h"
      28             : #include "AliRun.h"
      29             : #include "AliLoader.h"
      30             : #include "AliRunLoader.h"
      31             : #include "AliTriggerInput.h"
      32             : #include "AliT0Parameters.h"
      33             : #include "AliT0TriggerParameters.h"
      34             : #include <AliCDBManager.h>        
      35             : #include <AliCDBEntry.h>          
      36             : #include <AliCDBStorage.h>  
      37             : 
      38             : #include "AliT0.h"
      39             : #include "AliT0digit.h"
      40             : #include "AliT0Trigger.h"
      41             : 
      42             : #include "Riostream.h"
      43             : 
      44             : //----------------------------------------------------------------------
      45          20 : ClassImp(AliT0Trigger)
      46             : 
      47             : //----------------------------------------------------------------------
      48             : AliT0Trigger::AliT0Trigger()
      49           4 :   : AliTriggerDetector(),
      50           4 :     fT0(0x0),
      51           4 :   fDigits(0x0),
      52           4 :   fTrigPar(0x0) 
      53          20 : {
      54           4 :    SetName("T0");
      55           4 :    CreateInputs();
      56           4 :    AliCDBManager *stor =AliCDBManager::Instance();
      57             :    //time equalizing
      58          12 :    AliCDBEntry* fCalibentry  = stor->Get("T0/Calib/TriggerParam");
      59           4 :    if (fCalibentry)
      60           4 :      fTrigPar  = (AliT0TriggerParameters*)fCalibentry->GetObject();
      61             :    else {
      62           0 :          AliWarning(" No trigger parameters  in CDB , use default"); 
      63             :    }
      64             : 
      65           8 : }
      66             : 
      67             : //----------------------------------------------------------------------
      68             : void AliT0Trigger::CreateInputs()
      69             : {
      70             :    // inputs 
      71             :  
      72             :    // Do not create inputs again!!
      73           8 :    if( fInputs.GetEntriesFast() > 0 ) return;
      74             :    
      75          20 :    fInputs.AddLast( new AliTriggerInput( "T0_A_L0", "T0",  0 ) );
      76          20 :    fInputs.AddLast( new AliTriggerInput( "T0_C_L0", "T0", 0 ) );
      77          20 :    fInputs.AddLast( new AliTriggerInput( "T0_Vertex_L0", "T0", 0 ) );
      78          20 :    fInputs.AddLast( new AliTriggerInput( "T0_Centr_L0", "T0",  0 ) );
      79          20 :    fInputs.AddLast( new AliTriggerInput( "T0_SemiCentral_L0", "T0",  0 ) );
      80             : 
      81           8 : }
      82             : 
      83             : //----------------------------------------------------------------------
      84             : void AliT0Trigger::Trigger()
      85             : {
      86             :   // trigger input
      87             : 
      88           8 :    AliRunLoader* runLoader = AliRunLoader::Instance();
      89           4 :    AliLoader * fT0Loader = runLoader->GetLoader("T0Loader");
      90             :    //   AliT0digit *fDigits; 
      91           4 :    fT0Loader->LoadDigits("READ");
      92             :    // Creating T0 data container
      93             : 
      94           4 :    TTree* treeD = fT0Loader->TreeD();
      95           4 :   if (!treeD) {
      96           0 :     AliError("no digits tree");
      97           0 :     return;
      98             :   }
      99           8 :   fDigits = new AliT0digit();
     100             : 
     101           4 :   TBranch *brDigits = treeD->GetBranch("T0");
     102           4 :   if (brDigits) {
     103           4 :     brDigits->SetAddress(&fDigits);
     104             :   }else{
     105           0 :     AliError("Branch T0 DIGIT not found");
     106           0 :     return;
     107             :   } 
     108           4 :   brDigits->GetEntry(0);
     109           4 :   Int_t   besttimeA = fDigits->BestTimeA();
     110           4 :   Int_t   besttimeC = fDigits->BestTimeC();
     111           4 :   Int_t   timeDiff = fDigits->TimeDiff();
     112           4 :   Int_t    sumMult=   fDigits->SumMult();
     113             : 
     114             :   //trigger parameteres
     115             : 
     116           4 :   Float_t timeWindowLow = fTrigPar->GetTimeWindowLow(); 
     117           4 :   Float_t timeWindowHigh = fTrigPar->GetTimeWindowHigh(); 
     118           4 :   Int_t ampCentr = fTrigPar->GetAmpCentr(); 
     119           4 :   Int_t ampSemiCentr =  fTrigPar->GetAmpSemiCentr();
     120             : 
     121           7 :   if (besttimeA > 0 && besttimeA <99999)  SetInput("T0_A_L0");
     122           5 :   if (besttimeC > 0  && besttimeC<99999)   SetInput("T0_C_L0"); 
     123             :   //6093 corrsponds to vertex -20cm, 6202 vertex +20 with delay 150nc eqalized on the TVDC unit 
     124           9 :   if (timeDiff >timeWindowLow && timeDiff < timeWindowHigh) SetInput("T0_Vertex_L0");
     125           4 :   if (sumMult > ampCentr)  SetInput("T0_Centr_L0");
     126           4 :   if (sumMult> ampSemiCentr && sumMult <= ampCentr) SetInput("T0_SemiCentral_L0");;
     127             : 
     128             :    
     129           8 : }

Generated by: LCOV version 1.11