1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 //////////////////////////////////////////////////////////////////////
21 // ITS SPD Trigger Detector Class
23 // Several Fast-OR Algoritm are implemented
25 // Ref: ALICE-INT-2005-025
26 // (J. Conrad, J. G. Contreras and C. E. Jorgensen)
28 //////////////////////////////////////////////////////////////////////
33 #include "AliRunLoader.h"
35 #include "AliITSTrigger.h"
37 //______________________________________________________________________
38 ClassImp(AliITSTrigger)
40 //______________________________________________________________________
41 AliITSTrigger::AliITSTrigger()
42 : AliTriggerDetector()
47 // FIX: should this be hardcoded?
48 fFODigistThreshold = 1;
49 fHighMultFODigistThreshold = 100;
52 //______________________________________________________________________
53 void AliITSTrigger::CreateInputs()
57 // Do not create inputs again!!
58 if( fInputs.GetEntriesFast() > 0 ) return;
60 fInputs.AddLast( new AliTriggerInput( "ITS_SPD_GFO_L0", "Global, Fast OR all detectors", 0x01 ) );
61 fInputs.AddLast( new AliTriggerInput( "ITS_SPD_HMULT_L0", "High Multiplicity", 0x600 ) );
65 //______________________________________________________________________
66 void AliITSTrigger::Trigger()
69 // ********** Get run loader for the current event **********
70 AliRunLoader* runLoader = gAlice->GetRunLoader();
72 AliITSLoader* loader = (AliITSLoader* )runLoader->GetLoader( "ITSLoader" );
73 AliITSgeom* geom = loader->GetITSgeom();
74 loader->LoadDigits("READ");
75 TTree *treeD = loader->TreeD();
77 TObjArray *digDet = 0;
78 digDet = new TObjArray(3);
81 // Cut on Signal In the Pixel Detector
82 TBranch* br = treeD->GetBranch( "ITSDigitsSPD" );
83 br->SetAddress( &((*digDet)[0]) );
84 ((TClonesArray*)(digDet->At(0)))->Clear();
86 MultiplicityTriggers(digDet, treeD, geom);
87 // GeometryTriggers(digDet, treeD, geom);
89 // Debug : FIX change to AliLog
90 cout << "=================================================" << endl;
91 cout << " Pixel Trigger Mask ( " << hex << "0x" << GetMask() << " )" << endl << endl;
92 cout << " Global Fast OR " << "0x" << GetInput( "ITS_SPD_GFO_L0" )->GetValue() << endl;
93 cout << "=================================================" << endl << endl;
97 //______________________________________________________________________
98 void AliITSTrigger::MultiplicityTriggers(TObjArray* digDet, TTree* treeD, AliITSgeom* geom)
100 // simple FO triggers that only cares about the multiplicity
102 // first and last module?
103 Int_t startSPD = geom->GetStartSPD();
104 Int_t lastSPD = geom->GetLastSPD();
106 Int_t totalNumberOfDigits = 0;
109 for (Int_t moduleIndex=startSPD; moduleIndex<lastSPD; moduleIndex++) {
110 treeD->GetEvent(moduleIndex);
111 TClonesArray* digits = (TClonesArray*) (digDet->At(0)); // SPD only.
113 // get number of digits in this module
114 Int_t numberOfDigitsInModule = digits->GetEntriesFast();
116 // sum of digits in all modules
117 totalNumberOfDigits = totalNumberOfDigits + numberOfDigitsInModule;
121 if (totalNumberOfDigits>=fFODigistThreshold)
122 SetInput( "ITS_SPD_GFO_L0" );
124 if (totalNumberOfDigits>=fHighMultFODigistThreshold)
125 SetInput( "ITS_SPD_HMULT_L0" );
131 //______________________________________________________________________
132 void AliITSTrigger::GeometryTriggers(TObjArray* digDet, TTree* treeD, AliITSgeom* geom)
137 // // const Int_t nlay = 2; // not used
138 // // const Int_t nlad = 240; // not used
139 // // const Int_t nstave = 40; // not used
140 // // const Int_t ndet = 4; // not used
141 // // const Int_t nchip = 5; // not used
142 // // const Int_t ntotal = 1200;
145 // Int_t iFOperlayer[2];
146 // Int_t iFOperladder[240];
147 // Int_t iFOperstave[40][2];
148 // // Int_t iFOperchip[ntotal]; // not used
149 // Int_t iFOperChipinStave[20][40][2];
151 // for (Int_t m=startSPD;m<lastSPD;m++) {
152 // iFOperladder[m] = 0;
155 // for (Int_t k = 0;k<2;k++){
156 // iFOperlayer[k] = 0;
157 // for (Int_t o=0; o<40; o++) {
158 // iFOperstave[o][k] = 0;
159 // for (Int_t ich=0; ich<20; ich++) {
160 // iFOperChipinStave[ich][o][k] = 0;
166 // Int_t mInStaveCounter = 0;
167 // Int_t checkStave = 0;
169 // // loop over modules
170 // for (Int_t moduleIndex=startSPD; moduleIndex<lastSPD; moduleIndex++) {
171 // treeD->GetEvent(moduleIndex);
172 // TClonesArray* digits = (TClonesArray*) (digDet->At(0)); // SPD only.
174 // Int_t lay, stav, det;
175 // geom->GetModuleId(moduleIndex,lay,stav,det);
177 // ndig = digits->GetEntriesFast();
179 // for( Int_t l=0; l<5; l++ ) {
182 // for( Int_t dig=0; dig<ndig; dig++) {
183 // AliITSdigitSPD* dp = (AliITSdigitSPD*) digits->At(dig);
184 // Int_t column = dp->GetCoord1();
185 // // Int_t row = dp->GetCoord2();
186 // Int_t chip = Int_t(column/32.);
190 // if (checkStave != stav) {
191 // mInStaveCounter = 0;
193 // mInStaveCounter += 1;
198 // // mInStave 0,..,3
199 // // chipInStave 0,..,19
201 // //cout << "m " << m << " stav " << stav << " mInStave " << mInStaveCounter << " " <<lay << endl;
203 // for (Int_t ichip=0; ichip<5; ichip++) {
204 // //Int_t seq = (m*5+ichip);
205 // Int_t chipInStave = (mInStaveCounter *5) + ichip;
207 // if (ndigA[ichip] >= 1) {
208 // iFOperladder[moduleIndex]++;
209 // iFOperlayer[lay-1]++;
210 // iFOperstave[stav-1][lay-1]++;
211 // //iFOperHstave[hstav-1][lay-1]++;
212 // iFOperChipinStave[chipInStave][stav-1][lay-1]++;
216 // // SIMPLE FO ---> ANY HIT TRIGGERS
218 // checkStave = stav;
219 // } // endl loop over SPD's
223 // if ( ndigfo >= singhitthreshold ) {
224 // // Set input GLOBAL FO
225 // SetInput( "ITS_SPD_GFO_L0" );
226 // // or SetInput( "0x01" );
227 // // or ((AliTriggerInput*)fInputs.At(0))->Set();
228 // // bit1 |= (1 << 1);