]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSTrigger.cxx
Remove AliTRDv2
[u/mrichter/AliRoot.git] / ITS / AliITSTrigger.cxx
CommitLineData
e628c711 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
e628c711 16
0ca510a1 17/* $Id$ */
e628c711 18
19
20#include "AliLog.h"
21#include "AliRun.h"
22#include "AliRunLoader.h"
2db4dcdc 23#include "AliTriggerInput.h"
e628c711 24
e628c711 25#include "AliITSTrigger.h"
2db4dcdc 26#include "AliITSdigitSPD.h"
27#include "AliITSgeom.h"
28#include "AliITSLoader.h"
e628c711 29
30//______________________________________________________________________
31ClassImp(AliITSTrigger)
0ca510a1 32////////////////////////////////////////////////////////////////////////
33//
34// Version 1
35// Modified by D. Elia, C. Jorgensen
36// March 2006
37//
38// Version 0
39// Written by J. Conrad, E. Lopez Torres
40// October 2005
41//
42// AliITSTrigger: implementation of the SPD Fast-OR based triggers.
43//
44////////////////////////////////////////////////////////////////////////
e628c711 45
46//______________________________________________________________________
47AliITSTrigger::AliITSTrigger()
48 : AliTriggerDetector()
49{
50 SetName("ITS");
51 CreateInputs();
8e50d897 52
0ca510a1 53 // set parameters to define trigger condition thresholds
54 fGlobalFOThreshold = 1;
2ca17abd 55 fHighMultFOThreshold = 150;
e628c711 56}
57
58//______________________________________________________________________
59void AliITSTrigger::CreateInputs()
60{
61 // inputs
62
63 // Do not create inputs again!!
64 if( fInputs.GetEntriesFast() > 0 ) return;
65
66 fInputs.AddLast( new AliTriggerInput( "ITS_SPD_GFO_L0", "Global, Fast OR all detectors", 0x01 ) );
0ca510a1 67 fInputs.AddLast( new AliTriggerInput( "ITS_SPD_HMULT_L0", "High Multiplicity", 0x02 ) );
e628c711 68
69}
70
71//______________________________________________________________________
72void AliITSTrigger::Trigger()
73{
74
8e50d897 75 // ********** Get run loader for the current event **********
76 AliRunLoader* runLoader = gAlice->GetRunLoader();
77
78 AliITSLoader* loader = (AliITSLoader* )runLoader->GetLoader( "ITSLoader" );
79 AliITSgeom* geom = loader->GetITSgeom();
80 loader->LoadDigits("READ");
81 TTree *treeD = loader->TreeD();
698b2e52 82 if (!treeD) return;
8e50d897 83
84 TObjArray *digDet = 0;
85 digDet = new TObjArray(3);
86
87
88 // Cut on Signal In the Pixel Detector
89 TBranch* br = treeD->GetBranch( "ITSDigitsSPD" );
90 br->SetAddress( &((*digDet)[0]) );
91 ((TClonesArray*)(digDet->At(0)))->Clear();
92
93 MultiplicityTriggers(digDet, treeD, geom);
94 // GeometryTriggers(digDet, treeD, geom);
95
96 // Debug : FIX change to AliLog
0ca510a1 97// cout << "=================================================" << endl;
98// cout << " Pixel Trigger Mask ( " << hex << "0x" << GetMask() << " )" << endl << endl;
99// cout << " Global Fast OR " << "0x" << GetInput( "ITS_SPD_GFO_L0" )->GetValue() << endl;
100// cout << " High Multiplicity " << "0x" << GetInput( "ITS_SPD_HMULT_L0" )->GetValue() << endl;
101// cout << "=================================================" << endl << endl;
e628c711 102
103}
104
8e50d897 105//______________________________________________________________________
106void AliITSTrigger::MultiplicityTriggers(TObjArray* digDet, TTree* treeD, AliITSgeom* geom)
107{
108 // simple FO triggers that only cares about the multiplicity
109
8e50d897 110 Int_t startSPD = geom->GetStartSPD();
111 Int_t lastSPD = geom->GetLastSPD();
112
0ca510a1 113 Int_t totalNumberOfFO = 0;
114 Int_t ndigitsInChip[5];
e628c711 115
0ca510a1 116 // loop over modules (ladders)
2ca17abd 117 for (Int_t moduleIndex=startSPD; moduleIndex<lastSPD+1; moduleIndex++) {
8e50d897 118 treeD->GetEvent(moduleIndex);
119 TClonesArray* digits = (TClonesArray*) (digDet->At(0)); // SPD only.
120
121 // get number of digits in this module
0ca510a1 122 Int_t ndigitsInModule = digits->GetEntriesFast();
123
124 // get number of digits in each chip of the module
125 for( Int_t iChip=0; iChip<5; iChip++ ) {
126 ndigitsInChip[iChip]=0;
127 }
128 for( Int_t iDig=0; iDig<ndigitsInModule; iDig++ ) {
129 AliITSdigitSPD* dp = (AliITSdigitSPD*) digits->At(iDig);
130 Int_t column = dp->GetCoord1();
131 Int_t isChip = Int_t(column/32.);
132 ndigitsInChip[isChip]++;
133 }
134 // get number of FOs in the module
135 for( Int_t ifChip=0; ifChip<5; ifChip++ ) {
136 if( ndigitsInChip[ifChip] >= 1 ) {
137 totalNumberOfFO++;
138 }
139 }
140 // end of loop over modules
8e50d897 141 }
142
0ca510a1 143 // produce input trigger condition
144 if (totalNumberOfFO>=fGlobalFOThreshold)
8e50d897 145 SetInput( "ITS_SPD_GFO_L0" );
146
0ca510a1 147 if (totalNumberOfFO>=fHighMultFOThreshold)
8e50d897 148 SetInput( "ITS_SPD_HMULT_L0" );
149
150 return;
151
152}
e628c711 153
154//______________________________________________________________________
0ca510a1 155// void AliITSTrigger::GeometryTriggers(TObjArray* digDet, TTree* treeD, AliITSgeom* geom)
156void AliITSTrigger::GeometryTriggers()
e628c711 157{
8e50d897 158
8e50d897 159// // const Int_t nlay = 2; // not used
160// // const Int_t nlad = 240; // not used
161// // const Int_t nstave = 40; // not used
162// // const Int_t ndet = 4; // not used
163// // const Int_t nchip = 5; // not used
164// // const Int_t ntotal = 1200;
165
166// Int_t ndigA[5];
167// Int_t iFOperlayer[2];
168// Int_t iFOperladder[240];
169// Int_t iFOperstave[40][2];
170// // Int_t iFOperchip[ntotal]; // not used
171// Int_t iFOperChipinStave[20][40][2];
172
2ca17abd 173// for (Int_t m=startSPD;m<lastSPD+1;m++) {
8e50d897 174// iFOperladder[m] = 0;
175// }
176
177// for (Int_t k = 0;k<2;k++){
178// iFOperlayer[k] = 0;
179// for (Int_t o=0; o<40; o++) {
180// iFOperstave[o][k] = 0;
181// for (Int_t ich=0; ich<20; ich++) {
182// iFOperChipinStave[ich][o][k] = 0;
183// }
184// }
185// }
186
187// // nFO = 0.0;
188// Int_t mInStaveCounter = 0;
189// Int_t checkStave = 0;
190
191// // loop over modules
2ca17abd 192// for (Int_t moduleIndex=startSPD; moduleIndex<lastSPD+1; moduleIndex++) {
8e50d897 193// treeD->GetEvent(moduleIndex);
194// TClonesArray* digits = (TClonesArray*) (digDet->At(0)); // SPD only.
195
196// Int_t lay, stav, det;
197// geom->GetModuleId(moduleIndex,lay,stav,det);
198
199// ndig = digits->GetEntriesFast();
200
201// for( Int_t l=0; l<5; l++ ) {
202// ndigA[l] = 0 ;
203// }
204// for( Int_t dig=0; dig<ndig; dig++) {
205// AliITSdigitSPD* dp = (AliITSdigitSPD*) digits->At(dig);
206// Int_t column = dp->GetCoord1();
207// // Int_t row = dp->GetCoord2();
208// Int_t chip = Int_t(column/32.);
209// ndigA[chip]++;
210// }
211
212// if (checkStave != stav) {
213// mInStaveCounter = 0;
214// } else {
215// mInStaveCounter += 1;
216// }
217
218// // m 0,.., 239
219// // stav 1,..,40
220// // mInStave 0,..,3
221// // chipInStave 0,..,19
222
223// //cout << "m " << m << " stav " << stav << " mInStave " << mInStaveCounter << " " <<lay << endl;
224
225// for (Int_t ichip=0; ichip<5; ichip++) {
226// //Int_t seq = (m*5+ichip);
227// Int_t chipInStave = (mInStaveCounter *5) + ichip;
228
229// if (ndigA[ichip] >= 1) {
230// iFOperladder[moduleIndex]++;
231// iFOperlayer[lay-1]++;
232// iFOperstave[stav-1][lay-1]++;
233// //iFOperHstave[hstav-1][lay-1]++;
234// iFOperChipinStave[chipInStave][stav-1][lay-1]++;
235// // nFO++;
236// }
237// }
238// // SIMPLE FO ---> ANY HIT TRIGGERS
239// ndigfo += ndig;
240// checkStave = stav;
241// } // endl loop over SPD's
242
243
244
245// if ( ndigfo >= singhitthreshold ) {
246// // Set input GLOBAL FO
247// SetInput( "ITS_SPD_GFO_L0" );
248// // or SetInput( "0x01" );
249// // or ((AliTriggerInput*)fInputs.At(0))->Set();
250// // bit1 |= (1 << 1);
251// }
252
253 // return bit1;
e628c711 254}