1 // inserted you find the pixel routine: From a macro it is called like:
3 // Int_t spdTriggerBit = CalculateFOTrigger(itsLoader,geom,hDigits,nFO);
6 // spdTriggerBit is a bit array which can be queried like:
8 // if (spdTriggerBit & (1 << 1)) globalFO = kTRUE;
10 //The arguments hDigits and NFO are things that you don't need. The routine
11 //CalculateFOTrigger uses anouther subroutine RequireZ10cm() which
12 //calculates the VERTEX coincidence requirement.
14 //Don't hesitate to contact me in case of questions. My suggestion to you is
15 //that you first only implement a simple version of the trigger (for example
16 //the OR of all signals).
25 Int_t CalculateFOTrigger( AliITSLoader *itsl, AliITSgeom* geom, TH1F* hDigits, Float_t& nFO)
28 TObjArray *digDet = 0;
29 digDet = new TObjArray(3);
31 Int_t startSPD = geom->GetStartSPD();
32 Int_t lastSPD = geom->GetLastSPD();
34 // Cut on Signal In the Pixel Detector
35 treeD = itsl->TreeD();
36 br = treeD->GetBranch("ITSDigitsSPD");
37 br->SetAddress(&((*digDet)[0]));
38 ((TClonesArray*)(digDet->At(0)))->Clear();
43 Int_t singhitthreshold = 1; // single hit threshold
47 const Int_t nlad =240;
48 const Int_t nstave=40;
51 const Int_t ntotal = 1200;
55 Int_t FOperladder[240];
56 Int_t FOperstave[40][2];
57 Int_t FOperchip[ntotal];
58 Int_t FOperChipinStave[20][40][2];
60 for (Int_t m=startSPD;m<lastSPD;m++) {
64 for (Int_t k = 0;k<2;k++){
66 for (Int_t o=0;o<40;o++) {
68 for (Int_t ich=0;ich<20;ich++) {
69 FOperChipinStave[ich][o][k] = 0;
77 Int_t mInStaveCounter = 0.;
82 for (m=startSPD;m<lastSPD;m++) {
85 digits = (TClonesArray*) (digDet->At(0)); // SPD only.
88 Int_t lay,stav,det; geom->GetModuleId(m,lay,stav,det);
90 ndig = digits->GetEntriesFast();
92 for(Int_t l = 0;l<5;l++){
98 for(Int_t dig=0; dig<ndig; dig++){
99 dp = (AliITSdigitSPD*) digits->At(dig);
100 Int_t column = dp->GetCoord1();
101 // Int_t row = dp->GetCoord2();
102 Int_t chip = Int_t(column/32.);
106 if (checkStave !=stav){
109 mInStaveCounter += 1;
115 // chipInStave 0,..,19
117 //cout << "m " << m << " stav " << stav << " mInStave " <<
118 mInStaveCounter << " " <<lay << endl;
120 for (Int_t ichip=0;ichip<5;ichip++){
121 Int_t seq = (m*5+ichip);
122 Int_t chipInStave = (mInStaveCounter *5) + ichip;
124 if (ndigA[ichip] >= 1) {
127 FOperstave[stav-1][lay-1]++;
128 //FOperHstave[hstav-1][lay-1]++;
129 FOperChipinStave[chipInStave][stav-1][lay-1]++;
134 // SIMPLE FO ---> ANY HIT TRIGGERS
143 Int_t upper_cut = 120;
145 hDigits->Fill(ndigfo);
151 //cout << nFO << endl;
153 if ( ndigfo >= singhitthreshold) {bit1 |= (1 << 1);}
155 // if ( ndigfo <= upper_cut) {bit1 |= (1 << 10);}
159 if (FOperlayer[0] >= threshold && FOperlayer[1] >=threshold) {
161 if ( ndigfo <= upper_cut) {bit1 |= (1 << 10);}
165 // Sector coincidence
170 // staves layer 1 1-20
171 // staves layer 2: 0-39
176 for (Int_t istav=1;istav<21;istav++){
177 for (Int_t jstav = finstav; jstav<finstav+4;jstav++) {
178 if ((FOperstave[istav-1][0] >= threshold) &&
179 (FOperstave[jstav][1] >= threshold)) {
183 if (RequireZ10cm(FOperChipinStave,istav-1,jstav) == kTRUE) {
184 //cout << (RequireZ(FOperChipinStave,istav-1,probe_stav) <<
189 // cout << " " << istav << " " << jstav << " " << endl;
193 if (TMath::Even(istav)) {
200 // half sector coincidence
203 for (Int_t istav=1;istav<21;istav++){
204 for (Int_t jstav = finstav; jstav<finstav+2;jstav++)
206 if (FOperstave[istav-1][0] >= threshold && FOperstave[jstav][1] >=
211 if (RequireZ10cm(FOperChipinStave,istav-1,jstav) == kTRUE) {
227 for (Int_t istav=1;istav<21;istav++){
229 for (Int_t jstav = finstav-1; jstav<finstav+3;jstav++) {
231 Int_t probe_stav = jstav;
233 if (jstav == -1) probe_stav = 39;
234 if (jstav == 40) probe_stav = 0;
236 if (FOperstave[istav-1][0] >= threshold &&
237 FOperstave[probe_stav][1] >= threshold) {
250 // sliding window coincidence (symmetric): 1 (layer 1), 5 (layer 2)
254 for (Int_t istav=1;istav<21;istav++) {
255 for (Int_t jstav = finstav-2; jstav<finstav+3;jstav++) {
257 // cout << 7 << endl;
260 if (jstav == -2) probe_stav = 38;
261 if (jstav == -1) probe_stav = 39;
262 if (jstav == 40) probe_stav = 0;
263 if (jstav == 41) probe_stav = 1;
265 if ((FOperstave[istav-1][0] >= threshold) &&
266 (FOperstave[probe_stav][1] >= threshold)) {
268 if (RequireZ10cm(FOperChipinStave,istav-1,probe_stav) ==
285 Bool_t RequireZ10cm(Int_t FOperChipinStave[][40][2], Int_t stave1, Int_t
290 Bool_t zFlag = kFALSE;
299 for (Int_t ic=0;ic<=19;ic++) {
305 for (Int_t jc=0;jc<=ic-1;jc++) {
306 if (FOperChipinStave[ic][stave1][0] >=threshold) {
307 if (FOperChipinStave[jc][stave2][1] >= threshold){
314 if(ic >=6 && ic <=8){
315 for (jc=(2*start1-1);jc<=(2*start1-1)+5;jc++) {
316 if (FOperChipinStave[ic][stave1][0] >=threshold) {
317 if (FOperChipinStave[jc][stave2][1] >= threshold){
326 if(ic >=9 && ic <=11){
328 for (jc=(2*start2);jc<=(2*start2+5);jc++) {
329 if (FOperChipinStave[ic][stave1][0] >=threshold) {
330 if (FOperChipinStave[jc][stave2][1] >= threshold){
338 if(ic >=12 && ic <=13){
340 for (jc=(2*start3-1);jc<=(2*start3-1)+5;jc++) {
341 if (FOperChipinStave[ic][stave1][0] >=threshold) {
342 if (FOperChipinStave[jc][stave2][1] >= threshold){
352 for (jc=(2*start4);jc<=19;jc++) {
353 if (FOperChipinStave[ic][stave1][0] >=threshold) {
354 if (FOperChipinStave[jc][stave2][1] >= threshold){