]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTrigger.cxx
ESD file is added to the list of proof output files. It is then automatically merged...
[u/mrichter/AliRoot.git] / MUON / AliMUONTrigger.cxx
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 "AliMUONTrigger.h"
19
20 #include "AliLog.h"
21 #include "AliMUONGlobalTrigger.h"
22 #include "AliMUONVTriggerStore.h"
23 #include "AliRun.h"
24 #include "AliRunLoader.h"
25 #include "AliTriggerInput.h"
26
27
28 //-----------------------------------------------------------------------------
29 /// \class AliMUONTrigger
30 ///
31 /// Implementation of AliTriggerDetector for MUON detector
32 ///
33 /// So far, the inputs are taken from AliMUONTriggerDecision object
34 /// April 06, E.L.T.
35 /// May 06, taken info from Global Trigger branch (Ch.F)
36 ///
37 /// \author E. Lopez Torres
38 //-----------------------------------------------------------------------------
39
40 //----------------------------------------------------------------------
41 /// \cond CLASSIMP
42 ClassImp(AliMUONTrigger)
43 /// \endcond
44
45 //----------------------------------------------------------------------
46 AliMUONTrigger::AliMUONTrigger()
47   : AliTriggerDetector(), fTriggerStore(0x0)
48 {
49 /// Default constructor
50
51    SetName("MUON");
52    CreateInputs();
53 }
54
55 //----------------------------------------------------------------------
56 AliMUONTrigger::~AliMUONTrigger()
57 {
58   /// Destructor
59   delete fTriggerStore;
60 }
61
62 //----------------------------------------------------------------------
63 void AliMUONTrigger::CreateInputs()
64 {
65    /// inputs 
66    
67    // Do not create inputs again!!
68    if( fInputs.GetEntriesFast() > 0 ) return;
69    
70    fInputs.AddLast( new AliTriggerInput( "MUON_Single_LPt_L0", "MUONTRG",  0 ) );
71    fInputs.AddLast( new AliTriggerInput( "MUON_Single_HPt_L0", "MUONTRG", 0 ) );
72
73    fInputs.AddLast( new AliTriggerInput( "MUON_Unlike_LPt_L0", "MUONTRG",  0 ) );
74    fInputs.AddLast( new AliTriggerInput( "MUON_Unlike_HPt_L0", "MUONTRG", 0 ) );
75
76    fInputs.AddLast( new AliTriggerInput( "MUON_Like_LPt_L0", "MUONTRG",  0 ) );
77    fInputs.AddLast( new AliTriggerInput( "MUON_Like_HPt_L0", "MUONTRG", 0 ) );
78 }
79
80 //----------------------------------------------------------------------
81 void AliMUONTrigger::Trigger()
82 {
83   /// sets the trigger inputs
84
85    AliRunLoader* runLoader = gAlice->GetRunLoader();
86   
87    AliLoader * muonLoader = runLoader->GetDetectorLoader("MUON");
88    muonLoader->LoadDigits("READ");
89
90    TTree* treeD = muonLoader->TreeD();
91    
92    if (!treeD)
93    {
94      AliError("No TreeD available. Cannot make trigger");
95      return;
96    }
97    
98    if (!fTriggerStore) 
99    {  
100      fTriggerStore = AliMUONVTriggerStore::Create(*treeD);
101      if (!fTriggerStore)
102      {
103        AliError("Could not create triggerStore from treeD");
104        return;
105      }     
106    }
107
108    Bool_t ok = fTriggerStore->Connect(*treeD,kTRUE);
109
110    if (!ok)
111    {
112      AliError("Could not read trigger from TreeD !");
113      return;
114    }
115    
116    treeD->GetEvent(0);
117    
118    AliMUONGlobalTrigger* globalTrigger = fTriggerStore->Global();
119    if (globalTrigger == 0x0) 
120    { 
121      AliWarning("No Global Trigger available");
122    }
123    else
124    {
125      // set CTP
126      if (globalTrigger->SingleLpt())      SetInput("MUON_Single_LPt_L0");
127      if (globalTrigger->SingleHpt())      SetInput("MUON_Single_HPt_L0");
128      
129      if (globalTrigger->PairUnlikeLpt())  SetInput("MUON_Unlike_LPt_L0");
130      if (globalTrigger->PairUnlikeHpt())  SetInput("MUON_Unlike_HPt_L0");
131      
132      if (globalTrigger->PairLikeLpt())    SetInput("MUON_Like_LPt_L0");
133      if (globalTrigger->PairLikeHpt())    SetInput("MUON_Like_HPt_L0");
134    }
135    muonLoader->UnloadDigits();
136    fTriggerStore->Clear();
137 }