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