LCOV - code coverage report
Current view: top level - MUON/MUONsim - AliMUONTrigger.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 39 47 83.0 %
Date: 2016-06-14 17:26:59 Functions: 8 8 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             : #include <TTree.h>
      19             : #include "AliMUONTrigger.h"
      20             : 
      21             : #include "AliLog.h"
      22             : #include "AliMUONGlobalTrigger.h"
      23             : #include "AliMUONVTriggerStore.h"
      24             : #include "AliRun.h"
      25             : #include "AliRunLoader.h"
      26             : #include "AliLoader.h"
      27             : #include "AliTriggerInput.h"
      28             : 
      29             : 
      30             : //-----------------------------------------------------------------------------
      31             : /// \class AliMUONTrigger
      32             : ///
      33             : /// Implementation of AliTriggerDetector for MUON detector
      34             : ///
      35             : /// So far, the inputs are taken from AliMUONTriggerDecision object
      36             : /// April 06, E.L.T.
      37             : /// May 06, taken info from Global Trigger branch (Ch.F)
      38             : ///
      39             : /// \author E. Lopez Torres
      40             : //-----------------------------------------------------------------------------
      41             : 
      42             : //----------------------------------------------------------------------
      43             : /// \cond CLASSIMP
      44          16 : ClassImp(AliMUONTrigger)
      45             : /// \endcond
      46             : 
      47             : //----------------------------------------------------------------------
      48             : AliMUONTrigger::AliMUONTrigger()
      49           8 :   : AliTriggerDetector(), fTriggerStore(0x0)
      50          20 : {
      51             : /// Default constructor
      52             : 
      53           4 :    SetName("MUON");
      54           4 :    CreateInputs();
      55           8 : }
      56             : 
      57             : //----------------------------------------------------------------------
      58             : AliMUONTrigger::~AliMUONTrigger()
      59          24 : {
      60             :   /// Destructor
      61           8 :   delete fTriggerStore;
      62          12 : }
      63             : 
      64             : //----------------------------------------------------------------------
      65             : void AliMUONTrigger::CreateInputs()
      66             : {
      67             :    /// inputs 
      68             :    
      69             :    // Do not create inputs again!!
      70           8 :    if( fInputs.GetEntriesFast() > 0 ) return;
      71             :    
      72          20 :    fInputs.AddLast( new AliTriggerInput( "0MSL", "MUONTRG",  0 ) );
      73          20 :    fInputs.AddLast( new AliTriggerInput( "0MSH", "MUONTRG", 0 ) );
      74             : 
      75          20 :    fInputs.AddLast( new AliTriggerInput( "0MUL", "MUONTRG",  0 ) );
      76          20 :    fInputs.AddLast( new AliTriggerInput( "0MUH", "MUONTRG", 0 ) );
      77             : 
      78          20 :    fInputs.AddLast( new AliTriggerInput( "0MLL", "MUONTRG",  0 ) );
      79          20 :    fInputs.AddLast( new AliTriggerInput( "0MLH", "MUONTRG", 0 ) );
      80           8 : }
      81             : 
      82             : //----------------------------------------------------------------------
      83             : void AliMUONTrigger::Trigger()
      84             : {
      85             :   /// sets the trigger inputs
      86             : 
      87           8 :    AliRunLoader* runLoader = AliRunLoader::Instance();
      88             :   
      89           4 :    AliLoader * muonLoader = runLoader->GetDetectorLoader("MUON");
      90           4 :    muonLoader->LoadDigits("READ");
      91             : 
      92           4 :    TTree* treeD = muonLoader->TreeD();
      93             :    
      94           4 :    if (!treeD)
      95             :    {
      96           0 :      AliError("No TreeD available. Cannot make trigger");
      97           0 :      return;
      98             :    }
      99             :    
     100           4 :    if (!fTriggerStore) 
     101             :    {  
     102           4 :      fTriggerStore = AliMUONVTriggerStore::Create(*treeD);
     103           4 :      if (!fTriggerStore)
     104             :      {
     105           0 :        AliError("Could not create triggerStore from treeD");
     106           0 :        return;
     107             :      }     
     108             :    }
     109             : 
     110           4 :    Bool_t ok = fTriggerStore->Connect(*treeD,kTRUE);
     111             : 
     112           4 :    if (!ok)
     113             :    {
     114           0 :      AliError("Could not read trigger from TreeD !");
     115           0 :      return;
     116             :    }
     117             :    
     118           4 :    treeD->GetEvent(0);
     119             :    
     120           4 :    AliMUONGlobalTrigger* globalTrigger = fTriggerStore->Global();
     121           4 :    if (globalTrigger == 0x0) 
     122             :    { 
     123           0 :      AliWarning("No Global Trigger available");
     124           0 :    }
     125             :    else
     126             :    {
     127             :      // set CTP
     128           8 :      if (globalTrigger->SingleLpt())      SetInput("0MSL");
     129           8 :      if (globalTrigger->SingleHpt())      SetInput("0MSH");
     130             :      
     131           6 :      if (globalTrigger->PairUnlikeLpt())  SetInput("0MUL");
     132           6 :      if (globalTrigger->PairUnlikeHpt())  SetInput("0MUH");
     133             :      
     134           5 :      if (globalTrigger->PairLikeLpt())    SetInput("0MLL");
     135           5 :      if (globalTrigger->PairLikeHpt())    SetInput("0MLH");
     136             :    }
     137           4 :    muonLoader->UnloadDigits();
     138           4 :    fTriggerStore->Clear();
     139           8 : }

Generated by: LCOV version 1.11