]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/AliMUONTrigger.cxx
Corrections for synchronisation of TFluka and FLUKA particle info during transport:
[u/mrichter/AliRoot.git] / MUON / AliMUONTrigger.cxx
... / ...
CommitLineData
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 "AliLog.h"
19#include "AliRun.h"
20#include "AliRunLoader.h"
21#include "AliTriggerInput.h"
22
23#include "AliMUON.h"
24#include "AliMUONLoader.h"
25#include "AliMUONData.h"
26#include "AliMUONDigit.h"
27#include "AliMUONTriggerDecision.h"
28#include "AliMUONTrigger.h"
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///
37
38//----------------------------------------------------------------------
39ClassImp(AliMUONTrigger)
40
41//----------------------------------------------------------------------
42AliMUONTrigger::AliMUONTrigger()
43 : AliTriggerDetector()
44{
45 SetName("MUON");
46 CreateInputs();
47}
48
49//----------------------------------------------------------------------
50void AliMUONTrigger::CreateInputs()
51{
52 // inputs
53
54 // Do not create inputs again!!
55 if( fInputs.GetEntriesFast() > 0 ) return;
56
57 fInputs.AddLast( new AliTriggerInput( "MUON_SPlus_LPt_L0", "Single Plus Low Pt", 0x01 ) );
58 fInputs.AddLast( new AliTriggerInput( "MUON_SPlus_HPt_L0", "Single Plus High Pt", 0x02 ) );
59 fInputs.AddLast( new AliTriggerInput( "MUON_SPlus_All_L0", "Single Plus All", 0x04 ) );
60
61 fInputs.AddLast( new AliTriggerInput( "MUON_SMinus_LPt_L0", "Single Minus Low Pt", 0x08 ) );
62 fInputs.AddLast( new AliTriggerInput( "MUON_SMinus_HPt_L0", "Single Minus High Pt", 0x10 ) );
63 fInputs.AddLast( new AliTriggerInput( "MUON_SMinus_All_L0", "Single Minus All", 0x20 ) );
64
65 fInputs.AddLast( new AliTriggerInput( "MUON_SUndef_LPt_L0", "Single Undefined Low Pt", 0x40 ) );
66 fInputs.AddLast( new AliTriggerInput( "MUON_SUndef_HPt_L0", "Single Undefined High Pt", 0x80 ) );
67 fInputs.AddLast( new AliTriggerInput( "MUON_SUndef_All_L0", "Single Undefined All", 0x100 ) );
68
69 fInputs.AddLast( new AliTriggerInput( "MUON_Unlike_LPt_L0", "Single Unlike Sign pair Low Pt", 0x200 ) );
70 fInputs.AddLast( new AliTriggerInput( "MUON_Unlike_HPt_L0", "Single Unlike Sign pair High Pt", 0x400 ) );
71 fInputs.AddLast( new AliTriggerInput( "MUON_Unlike_All_L0", "Single Unlike Sign pair All", 0x800 ) );
72
73 fInputs.AddLast( new AliTriggerInput( "MUON_Like_LPt_L0", "Single Like Sign pair Low Pt", 0x1000 ) );
74 fInputs.AddLast( new AliTriggerInput( "MUON_Like_HPt_L0", "Single Like Sign pair High Pt", 0x2000 ) );
75 fInputs.AddLast( new AliTriggerInput( "MUON_Like_All_L0", "Single Like Sign pair All", 0x4000 ) );
76}
77
78//----------------------------------------------------------------------
79void AliMUONTrigger::Trigger()
80{
81 // sets the trigger inputs
82
83 AliRunLoader* runLoader = gAlice->GetRunLoader();
84
85 AliLoader * muonLoader = runLoader->GetLoader("MUONLoader");
86 muonLoader->LoadDigits("READ");
87 // Creating MUON data container
88 AliMUONData* muonData = new AliMUONData(muonLoader,"MUON","MUON");
89 muonData->SetTreeAddress("D");
90 muonData->GetDigits();
91 Int_t idebug = 1;
92 // Creating MUONTriggerDecision
93 AliMUONTriggerDecision* decision = new AliMUONTriggerDecision(muonLoader ,idebug,muonData);
94 AliMUONDigit * mDigit;
95 Int_t tracks[10];
96 Int_t charges[10];
97 Int_t digits[7];
98
99 for(Int_t ichamber=10; ichamber<14; ichamber++) {
100 Int_t idigit, ndigits;
101 ndigits = (Int_t) muonData->Digits(ichamber)->GetEntriesFast();
102// printf(">>> Chamber Cathode ndigits %d %d %d\n",ichamber,icathode,ndigits);
103 for(idigit=0; idigit<ndigits; idigit++) {
104 mDigit = static_cast<AliMUONDigit*>(muonData->Digits(ichamber)->At(idigit));
105 digits[0] = mDigit->PadX();
106 digits[1] = mDigit->PadY();
107 digits[2] = mDigit->Cathode();
108 digits[3] = mDigit->Signal();
109 digits[4] = mDigit->Physics();
110 digits[5] = mDigit->Hit();
111 digits[6] = mDigit->DetElemId();
112
113 Int_t digitindex = 0 ;
114 // printf("ichamber ix iy %d %d %d \n",ichamber,mDigit->PadX(),mDigit->PadY());
115
116 decision->AddDigit(ichamber, tracks, charges, digits, digitindex );
117 } // loop on digits
118 } // loop on chambers
119 muonData->ResetDigits();
120 decision->Trigger();
121 decision->ClearDigits();
122
123 // Set the trigger inputs = "global decision"
124 Int_t singlePlus[3]; // tot num of single plus
125 Int_t singleMinus[3]; // tot num of single minus
126 Int_t singleUndef[3]; // tot num of single undefined
127 Int_t pairUnlike[3]; // tot num of unlike-sign pairs
128 Int_t pairLike[3]; // tot num of like-sign pairs
129 decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
130
131 if( singlePlus[0] ) SetInput("MUON_SPlus_LPt_L0");
132 if( singlePlus[1] ) SetInput("MUON_SPlus_HPt_L0");
133 if( singlePlus[2] ) SetInput("MUON_SPlus_All_L0");
134
135 if( singleMinus[0] ) SetInput("MUON_SMinus_LPt_L0");
136 if( singleMinus[1] ) SetInput("MUON_SMinus_HPt_L0");
137 if( singleMinus[2] ) SetInput("MUON_SMinus_All_L0");
138
139 if( singleUndef[0] ) SetInput("MUON_SUndef_LPt_L0");
140 if( singleUndef[1] ) SetInput("MUON_SUndef_HPt_L0");
141 if( singleUndef[2] ) SetInput("MUON_SUndef_All_L0");
142
143 if( pairUnlike[0] ) SetInput("MUON_Unlike_LPt_L0");
144 if( pairUnlike[1] ) SetInput("MUON_Unlike_HPt_L0");
145 if( pairUnlike[2] ) SetInput("MUON_Unlike_All_L0");
146
147 if( pairLike[0] ) SetInput("MUON_Like_LPt_L0");
148 if( pairLike[1] ) SetInput("MUON_Like_HPt_L0");
149 if( pairLike[2] ) SetInput("MUON_Like_All_L0");
150}