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 **************************************************************************/
18 /////////////////////////////////////////////////////////////////////
20 // Class performing TOF Trigger
21 // Cosmic_Multi_muon: Cosmic Multi-Muonic Event Trigger (L0)
22 // ppMB: p-p Minimum Bias Event Trigger (L0)
23 // UltraPer_Coll: Ultra-Peripheral Collision Event Trigger (L0)
24 // High_Mult: High Multiplicity Event Trigger (L0)
25 // Jet: Events with Jet Topology Trigger (L1)
27 // A.Silenzi: added CTTM map,
28 // method to fill LTM matrix from raw data,
29 // method to retrieve the TOF pre-trigger for TRD detector
32 /////////////////////////////////////////////////////////////////////
34 #include <TClonesArray.h>
36 #include "AliLoader.h"
38 #include "AliRunLoader.h"
40 #include "AliTriggerInput.h"
41 #include "AliRawReader.h"
43 #include "AliTOFRawStream.h"
44 #include "AliTOFrawData.h"
45 #include "AliTOFdigit.h"
46 #include "AliTOFGeometry.h"
47 #include "AliTOFTrigger.h"
49 extern AliRun* gAlice;
51 //-------------------------------------------------------------------------
52 ClassImp(AliTOFTrigger)
54 //----------------------------------------------------------------------
55 AliTOFTrigger::AliTOFTrigger() :
68 for (Int_t i=0;i<kNLTM;i++){
69 for (Int_t j=0;j<kNLTMchannels;j++){
70 fLTMmatrix[i][j]=kFALSE;
73 for (Int_t j=0;j<kNCTTMchannels;j++){
74 fCTTMmatrixFront[i][j]=kFALSE;
75 fCTTMmatrixBack[i][j]=kFALSE;
83 //----------------------------------------------------------------------
85 AliTOFTrigger::AliTOFTrigger(Int_t HighMultTh, Int_t ppMBTh, Int_t MultiMuonTh, Int_t UPTh, Float_t deltaminpsi, Float_t deltamaxpsi, Float_t deltaminro, Float_t deltamaxro, Int_t stripWindow) :
87 fHighMultTh(HighMultTh),
89 fMultiMuonTh(MultiMuonTh),
91 fdeltaminpsi(deltaminpsi),
92 fdeltamaxpsi(deltamaxpsi),
93 fdeltaminro(deltaminro),
94 fdeltamaxro(deltamaxro),
95 fstripWindow(stripWindow)
98 //ctor with thresholds for triggers
99 for (Int_t i=0;i<kNLTM;i++){
100 for (Int_t j=0;j<kNLTMchannels;j++){
101 fLTMmatrix[i][j]=kFALSE;
104 for (Int_t j=0;j<kNCTTMchannels;j++){
105 fCTTMmatrixFront[i][j]=kFALSE;
106 fCTTMmatrixBack[i][j]=kFALSE;
114 //____________________________________________________________________________
116 AliTOFTrigger::AliTOFTrigger(const AliTOFTrigger & tr):
117 AliTriggerDetector(tr),
118 fHighMultTh(tr.fHighMultTh),
120 fMultiMuonTh(tr.fMultiMuonTh),
122 fdeltaminpsi(tr.fdeltaminpsi),
123 fdeltamaxpsi(tr.fdeltamaxpsi),
124 fdeltaminro(tr.fdeltaminro),
125 fdeltamaxro(tr.fdeltamaxro),
126 fstripWindow(tr.fstripWindow)
129 for (Int_t i=0;i<kNLTM;i++){
130 for (Int_t j=0;j<kNLTMchannels;j++){
131 fLTMmatrix[i][j]=tr.fLTMmatrix[i][j];
134 for (Int_t j=0;j<kNCTTMchannels;j++){
135 fCTTMmatrixFront[i][j]=tr.fCTTMmatrixFront[i][j];
136 fCTTMmatrixBack[i][j]=tr.fCTTMmatrixBack[i][j];
140 SetName(tr.GetName());
142 //fInputs=&(tr.GetInputs());
145 //----------------------------------------------------------------------
147 void AliTOFTrigger::CreateInputs()
150 // Do not create inputs again!!
151 if( fInputs.GetEntriesFast() > 0 ) return;
153 fInputs.AddLast(new AliTriggerInput("TOF_Cosmic_MultiMuon_L0","TOF",0));
154 fInputs.AddLast(new AliTriggerInput("0OIN","TOF",0)); // was "TOF_pp_MB_L0"
155 fInputs.AddLast(new AliTriggerInput("0OX1","TOF",0)); // was "TOF_UltraPer_Coll_L0"
157 fInputs.AddLast(new AliTriggerInput("0OHM","TOF",0)); // was "TOF_High_Mult_L0"
158 fInputs.AddLast(new AliTriggerInput("TOF_Jet_L1","TOF",0));
162 //----------------------------------------------------------------------
163 void AliTOFTrigger::Trigger() {
167 Int_t nchonFront = 0;
170 Int_t nchonFrontBack = 0;
171 Int_t nchonFront1 = 0;
172 Int_t nchonBack1 = 0;
173 Int_t nchonFrontBack1 = 0;
174 Int_t mindeltapsi = (Int_t)fdeltaminpsi/10;
175 Int_t maxdeltapsi = (Int_t)fdeltamaxpsi/10;
176 Int_t mindeltaro = (Int_t)fdeltaminro/10;
177 Int_t maxdeltaro = (Int_t)fdeltamaxro/10;
179 for (Int_t i=0;i<kNCTTM;i++){
180 for (Int_t j=0;j<kNCTTMchannels;j++){
181 if (fCTTMmatrixFront[i][j]) nchonFront++;
185 for (Int_t i=kNCTTM;i<(kNCTTM*2);i++){
186 for (Int_t j=0;j<kNCTTMchannels;j++){
187 if (fCTTMmatrixBack[i-kNCTTM][j]) nchonBack++;
191 nchonTot = nchonFront + nchonBack;
193 //pp Minimum Bias Trigger
194 if (nchonTot >= fppMBTh) {
198 //High Multiplicity Trigger
199 if (nchonTot >= fHighMultTh) {
209 Bool_t boolCTTMor = kFALSE;
211 for (Int_t i=0;i<(kNCTTM/2);i++){
212 Int_t iopp = i+kNCTTM/2;
213 for (Int_t j=0;j<kNCTTMchannels;j++){
214 if (fCTTMmatrixFront[i][j]){
215 Int_t minj = j-fstripWindow;
216 Int_t maxj = j+fstripWindow;
218 if (maxj>=kNCTTMchannels) maxj = kNCTTMchannels-1;
220 for (Int_t k = minj;k<=maxj;k++){
221 boolCTTMor |= fCTTMmatrixFront[iopp][k];
228 if (fCTTMmatrixBack[i][j]){
229 Int_t minj = j-fstripWindow;
230 Int_t maxj = j+fstripWindow;
232 if (maxj>=kNCTTMchannels) maxj =kNCTTMchannels-1;
234 for (Int_t k = minj;k<=maxj;k++){
235 boolCTTMor |= fCTTMmatrixBack[iopp][k];
244 nchonFrontBack = nchonFront+nchonBack;
251 for (Int_t i=0;i<(kNCTTM/2);i++){
252 Int_t i2max = (kNCTTM-1)-i+1;
253 Int_t i2min = (kNCTTM-1)-i-1;
254 if (i2max >=kNCTTM) i2max = kNCTTM-1;
255 if (i2min==i) i2min = kNCTTM-1-i;
256 for (Int_t j=0;j<kNCTTMchannels;j++){
257 Int_t j2min = j-fstripWindow;
258 Int_t j2max = j+fstripWindow;
259 if (j2min<0) j2min =0;
260 if (j2max>=kNCTTMchannels) j2max =kNCTTMchannels-1;
261 if (fCTTMmatrixFront[i][j]){
263 for (Int_t i2=i2min;i2<=i2max;i2++){
264 for (Int_t j2 = j2min;j2<=j2max;j2++){
265 boolCTTMor |= fCTTMmatrixFront[i2][j2];
272 if (fCTTMmatrixBack[i][j]){
274 for (Int_t i2=i2min;i2<=i2max;i2++){
275 for (Int_t j2 = j2min;j2<=j2max;j2++){
276 boolCTTMor |= fCTTMmatrixBack[i2][j2];
286 nchonFrontBack1 = nchonFront1+nchonBack1;
288 if (nchonFrontBack >= fMultiMuonTh || nchonFrontBack1 >= fMultiMuonTh) {
289 SetInput("TOF_Cosmic_MultiMuon_L0");
292 //Ultra-Peripheral collision Trigger
293 Bool_t boolpsi = kFALSE;
294 Bool_t boolro = kFALSE;
295 if (nchonTot == fUPTh){
296 for (Int_t i=0;i<kNCTTM;i++){
297 for (Int_t j=0;j<kNCTTMchannels;j++){
298 Int_t minipsi = i+mindeltapsi;
299 Int_t maxipsi = i+maxdeltapsi;
300 if (minipsi>=kNCTTM) minipsi = mindeltapsi-((kNCTTM-1)-i)-1;
301 if (maxipsi>=kNCTTM) maxipsi = maxdeltapsi-((kNCTTM-1)-i)-1;
302 Int_t miniro = i+mindeltaro;
303 Int_t maxiro = i+maxdeltaro;
304 if (miniro>=kNCTTM) miniro = mindeltaro-((kNCTTM-1)-i)-1;
305 if (maxiro>=kNCTTM) maxiro = maxdeltaro-((kNCTTM-1)-i)-1;
306 Int_t j2min = j-fstripWindow;
307 Int_t j2max = j+fstripWindow;
308 if (j2min<0) j2min =0;
309 if (j2max>=kNCTTMchannels) j2max =kNCTTMchannels-1;
310 if (fCTTMmatrixFront[i][j]){
311 for (Int_t i2=minipsi;i2<=maxipsi;i2++){
312 for (Int_t j2 = j2min;j2<=j2max;j2++){
313 if (fCTTMmatrixFront[i2][j2]) {
325 for (Int_t i2=miniro;i2<=maxiro;i2++){
326 for (Int_t j2 = j2min;j2<=j2max;j2++){
327 if (fCTTMmatrixFront[i2][j2]) {
341 else if (fCTTMmatrixBack[i][j]){
342 for (Int_t i2=minipsi;i2<=maxipsi;i2++){
343 for (Int_t j2 = j2min;j2<=j2max;j2++){
344 if (fCTTMmatrixBack[i2][j2]) {
356 for (Int_t i2=miniro;i2<=maxiro;i2++){
357 for (Int_t j2 = j2min;j2<=j2max;j2++){
358 if (fCTTMmatrixBack[i2][j2]) {
377 //-----------------------------------------------------------------------------
378 void AliTOFTrigger::CreateLTMMatrix() {
381 CreateLTMMatrixFromDigits();
384 //-------------------------------------------------------------------------
386 void AliTOFTrigger::CreateLTMMatrixFromDigits() {
388 // Create LTM matrix by TOF digits
392 for (Int_t i=0;i<kNLTM;i++){
393 for (Int_t j=0;j<kNLTMchannels;j++){
394 fLTMmatrix[i][j]=kFALSE;
398 rl = AliRunLoader::Instance();
400 Int_t ncurrevent = rl->GetEventNumber();
401 rl->GetEvent(ncurrevent);
403 AliLoader * tofLoader = rl->GetLoader("TOFLoader");
405 tofLoader->LoadDigits("read");
406 TTree *treeD = tofLoader->TreeD();
409 AliFatal("AliTOFTrigger: Can not get TreeD");
412 TBranch *branch = treeD->GetBranch("TOF");
414 AliError("can't get the branch with the TOF digits !");
417 TClonesArray *tofDigits =new TClonesArray("AliTOFdigit", 1000);
418 branch->SetAddress(&tofDigits);
420 Int_t ndigits = tofDigits->GetEntriesFast();
421 Int_t detind[5]; //detector indexes: 0 -> sector
427 for (Int_t i=0;i<ndigits;i++){
428 AliTOFdigit * digit = (AliTOFdigit*)tofDigits->UncheckedAt(i);
429 detind[0] = digit->GetSector();
430 detind[1] = digit->GetPlate();
431 detind[2] = digit->GetStrip();
432 detind[3] = digit->GetPadz();
433 detind[4] = digit->GetPadx();
435 Int_t indexLTM[2] = {-1,-1};
436 GetLTMIndex(detind,indexLTM);
438 fLTMmatrix[indexLTM[0]][indexLTM[1]] = kTRUE;
441 tofLoader->UnloadDigits();
442 // rl->UnloadgAlice();
447 //-----------------------------------------------------------------------------
449 void AliTOFTrigger::CreateLTMMatrixFromRaw(AliRawReader *fRawReader) {
451 // Create LTM matrix by TOF raw data
455 for (Int_t i=0;i<kNLTM;i++){
456 for (Int_t j=0;j<kNLTMchannels;j++){
457 fLTMmatrix[i][j]=kFALSE;
462 AliTOFRawStream * tofRawStream = new AliTOFRawStream();
466 //if(!GetLoader()->TreeS()) {MakeTree("S"); MakeBranch("S");}
469 tofRawStream->SetRawReader(fRawReader);
472 //if (fVerbose==2) ftxt.open("TOFsdigitsRead.txt",ios::app);
474 TClonesArray staticRawData("AliTOFrawData",10000);
475 staticRawData.Clear();
476 TClonesArray * clonesRawData = &staticRawData;
479 Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
486 AliTOFrawData *tofRawDatum = 0;
487 for (indexDDL=0; indexDDL<AliDAQ::NumberOfDdls("TOF"); indexDDL++) {
490 tofRawStream->LoadRawData(indexDDL);
492 clonesRawData = tofRawStream->GetRawData();
493 if (clonesRawData->GetEntriesFast()!=0) AliInfo(Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast()));
494 for (iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
496 tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
498 //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
499 if (tofRawDatum->GetTOF()==-1) continue;
501 SetBit(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
502 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel());
504 dummy = detectorIndex[3];
505 detectorIndex[3] = detectorIndex[4];//padz
506 detectorIndex[4] = dummy;//padx
508 digit[0] = tofRawDatum->GetTOF();
509 digit[1] = tofRawDatum->GetTOT();
511 dummy = detectorIndex[3];
512 detectorIndex[3] = detectorIndex[4];//padx
513 detectorIndex[4] = dummy;//padz
515 // Do not reconstruct anything in the holes
516 if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
517 if (detectorIndex[1]==2) { // plate with holes
526 clonesRawData->Clear();
530 //if (fVerbose==2) ftxt.close();
532 if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
538 //-----------------------------------------------------------------------------
539 void AliTOFTrigger::GetLTMIndex(const Int_t * const detind, Int_t *indexLTM) {
541 // getting LTMmatrix indexes for current digit
544 if (detind[1]==0 || detind[1]==1 || (detind[1]==2 && detind[2]<=7)) {
546 indexLTM[0] = detind[0]*2;
549 indexLTM[0] = detind[0]*2+1;
554 indexLTM[0] = detind[0]*2+36;
557 indexLTM[0] = (detind[0]*2+1)+36;
561 if (indexLTM[0]<36) {
563 indexLTM[1] = detind[2];
565 else if (detind[1] ==1){
566 indexLTM[1] = detind[2]+19;
568 else if (detind[1] ==2){
569 indexLTM[1] = detind[2]+19*2;
572 AliError("Smth Wrong!!!");
577 indexLTM[1] = detind[2]-8;
579 else if (detind[1] ==3){
580 indexLTM[1] = detind[2]+7;
582 else if (detind[1] ==4){
583 indexLTM[1] = detind[2]+26;
586 AliError("Smth Wrong!!!");
591 //-------------------------------------------------------------------------
593 // to be checked because of warning problems
594 void AliTOFTrigger::PrintMap()
600 for(Int_t i = 0; i<kNLTM;i++) {
602 printf("| %d | %d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |\n",
603 (fCTTMmatrixFront[i][0])?1:0,(fCTTMmatrixFront[i][1])?1:0,(fCTTMmatrixFront[i][2])?1:0, \
604 (fCTTMmatrixFront[i][3])?1:0,(fCTTMmatrixFront[i][4])?1:0,(fCTTMmatrixFront[i][5])?1:0, \
605 (fCTTMmatrixFront[i][6])?1:0,(fCTTMmatrixFront[i][7])?1:0,(fCTTMmatrixFront[i][8])?1:0, \
606 (fCTTMmatrixFront[i][9])?1:0,(fCTTMmatrixFront[i][10])?1:0,(fCTTMmatrixFront[i][11])?1:0, \
607 (fCTTMmatrixFront[i][12])?1:0,(fCTTMmatrixFront[i][13])?1:0,(fCTTMmatrixFront[i][14])?1:0, \
608 (fCTTMmatrixFront[i][15])?1:0,(fCTTMmatrixFront[i][16])?1:0,(fCTTMmatrixFront[i][17])?1:0, \
609 (fCTTMmatrixFront[i][18])?1:0,(fCTTMmatrixFront[i][19])?1:0,(fCTTMmatrixFront[i][20])?1:0, \
610 (fCTTMmatrixFront[i][21])?1:0,(fCTTMmatrixFront[i][22])?1:0,(fCTTMmatrixFront[i][23])?1:0);
612 printf("| %d | %d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |%d |\n",
613 (fCTTMmatrixBack[i][0])?1:0,(fCTTMmatrixBack[i][1])?1:0,(fCTTMmatrixBack[i][2])?1:0, \
614 (fCTTMmatrixBack[i][3])?1:0,(fCTTMmatrixBack[i][4])?1:0,(fCTTMmatrixBack[i][5])?1:0, \
615 (fCTTMmatrixBack[i][6])?1:0,(fCTTMmatrixBack[i][7])?1:0,(fCTTMmatrixBack[i][8])?1:0, \
616 (fCTTMmatrixBack[i][9])?1:0,(fCTTMmatrixBack[i][10])?1:0,(fCTTMmatrixBack[i][11])?1:0, \
617 (fCTTMmatrixBack[i][12])?1:0,(fCTTMmatrixBack[i][13])?1:0,(fCTTMmatrixBack[i][14])?1:0, \
618 (fCTTMmatrixBack[i][15])?1:0,(fCTTMmatrixBack[i][16])?1:0,(fCTTMmatrixBack[i][17])?1:0, \
619 (fCTTMmatrixBack[i][18])?1:0,(fCTTMmatrixBack[i][19])?1:0,(fCTTMmatrixBack[i][20])?1:0, \
620 (fCTTMmatrixBack[i][21])?1:0,(fCTTMmatrixBack[i][22])?1:0,(fCTTMmatrixBack[i][23])?1:0);
626 //-------------------------------------------------------------------------
628 void AliTOFTrigger::GetMap(Bool_t **map) const
634 for(Int_t i = 0; i<kNLTM;i++)
635 for(Int_t j = 0; j<kNCTTMchannels;j++)
636 map[i][j]=(i<36)?fCTTMmatrixFront[i][j]:fCTTMmatrixBack[i-36][j];
640 //-------------------------------------------------------------------------
641 void AliTOFTrigger::GetTRDmap(Bool_t **map) const
644 // Retriev the bit map sent to the TRD detector
647 for(int i = 0; i<kNLTM;i++)
648 for(int j = 0; j<kNLTMtoTRDchannels;j++)
651 for(int i = 0; i<kNLTM/2;i++)
652 for(int j = 0; j<AliTOFTrigger::kNCTTMchannels;j++){
654 if(fCTTMmatrixFront[i][j]) map[i][uTRDbit]=kTRUE;
656 for(int i = kNLTM/2; i<kNLTM;i++)
657 for(int j = 0; j<AliTOFTrigger::kNCTTMchannels;j++){
659 if(fCTTMmatrixBack[i - kNLTM/2][j]) map[i][uTRDbit]=kTRUE;
663 //-------------------------------------------------------------------------
664 void AliTOFTrigger::SetBit(Int_t *detind)
667 // Sets CTTM map element corresponding to detector element 'detind'
671 GetCTTMIndex(detind,index);
673 fCTTMmatrixFront[index[0]][index[1]]=kTRUE;
675 fCTTMmatrixBack[index[0]][index[1]]=kTRUE;
679 //-------------------------------------------------------------------------
680 void AliTOFTrigger::SetBit(Int_t nDDL, Int_t nTRM, Int_t iChain,
681 Int_t iTDC, Int_t iCH)
684 // Sets CTTM map element corresponding to equipment ID
685 // labelled by number nDDL, nTRM, iChain, iTDC, iCH
688 if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1){ // DDL number to LTM number mapping
690 Int_t iChannelIndex=-1;
691 switch(nDDL%AliTOFGeometry::NDDL()){
699 AliError("Call this function only if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) ");
702 iLTMindex+=2*(Int_t)(nDDL/AliTOFGeometry::NDDL());
703 if(iChain==0 && nDDL<36)
705 if(iChain==0 && nDDL>=36)
707 iChannelIndex=iCH+iTDC*AliTOFGeometry::NCh()-12*AliTOFGeometry::NCh();
708 Int_t index[2]={iLTMindex,iChannelIndex};
710 fCTTMmatrixFront[index[0]][index[1]]=kTRUE;
712 fCTTMmatrixBack[index[0]][index[1]]=kTRUE;
715 AliError("Call this function only if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) ");
718 //-------------------------------------------------------------------------
720 void AliTOFTrigger::ResetBit(Int_t *detind)
723 // Sets CTTM map element corresponding to detector element 'detind'
727 GetCTTMIndex(detind,index);
729 fCTTMmatrixFront[index[0]][index[1]]=kFALSE;
731 fCTTMmatrixBack[index[0]][index[1]]=kFALSE;
735 //-------------------------------------------------------------------------
736 void AliTOFTrigger::ResetBit(Int_t nDDL, Int_t nTRM, Int_t iChain,
737 Int_t iTDC, Int_t iCH)
740 // Sets CTTM map element corresponding to equipment ID
741 // labelled by number nDDL, nTRM, iChain, iTDC, iCH
744 if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1){ // DDL number to LTM number mapping
746 Int_t iChannelIndex=-1;
747 switch(nDDL%AliTOFGeometry::NDDL()){
755 AliError("Call this function only if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) ");
758 iLTMindex+=2*(Int_t)(nDDL/AliTOFGeometry::NDDL());
759 if(iChain==0 && nDDL<36)
761 if(iChain==0 && nDDL>=36)
763 iChannelIndex=iCH+iTDC*AliTOFGeometry::NCh()-12*AliTOFGeometry::NCh();
764 Int_t index[2]={iLTMindex,iChannelIndex};
766 fCTTMmatrixFront[index[0]][index[1]]=kFALSE;
768 fCTTMmatrixBack[index[0]][index[1]]=kFALSE;
771 AliError("Call this function only if(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) ");
774 //-------------------------------------------------------------------------
776 Bool_t AliTOFTrigger::GetBit(Int_t *detind)
779 // Returns CTTM map element corresponding to detector element 'detind'
783 GetCTTMIndex(detind,index);
784 return (index[0]<36)?fCTTMmatrixFront[index[0]][index[1]]:fCTTMmatrixBack[index[0]][index[1]];
788 //-------------------------------------------------------------------------
789 Bool_t AliTOFTrigger::GetBit(Int_t nDDL, Int_t nTRM, Int_t iChain,
790 Int_t iTDC, Int_t iCH)
793 // Returns CTTM map element corresponding to equipment ID
794 // labelled by number nDDL, nTRM, iChain, iTDC, iCH
797 if ( !(nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) ) {
798 AliWarning("Call this function only if(nTRM==3 && iTDC>12 && iTDC<14) ");
801 //if (nTRM==3 && iTDC>12 && iTDC<14 && nDDL%2==1) { // DDL number to LTM number mapping
804 UInt_t iChannelindex=0;
805 switch(nDDL%AliTOFGeometry::NDDL()) {
813 AliError("something wrong");
816 iLTMindex+=2*(Int_t)(nDDL/AliTOFGeometry::NDDL());
818 if (iChain==1) return kFALSE; // AdC
824 iChannelindex=iCH+iTDC*AliTOFGeometry::NCh()-12*AliTOFGeometry::NCh();
825 Int_t index[2]={iLTMindex,iChannelindex};
826 return (index[0]<36)?fCTTMmatrixFront[index[0]][index[1]]:fCTTMmatrixBack[index[0]][index[1]];
830 //-------------------------------------------------------------------------
832 void AliTOFTrigger::CreateCTTMMatrix() {
834 // Create CTTM bit map
837 for(Int_t i = 0; i<kNLTM;i++){
839 for(Int_t j = 0; j<kNCTTMchannels;j++)
840 fCTTMmatrixFront[i][j]=fLTMmatrix[i][2*j]||fLTMmatrix[i][2*j+1];
843 for(Int_t j = 0; j<kNCTTMchannels;j++)
844 fCTTMmatrixBack[i-kNCTTM][j]=fLTMmatrix[i][2*j]||fLTMmatrix[i][2*j+1];;
848 //-----------------------------------------------------------------------------
850 void AliTOFTrigger::GetCTTMIndex(Int_t *detind, Int_t *indexCTTM) {
852 // Returns CTTM index corresponding to the detector element detind
855 GetLTMIndex(detind,indexCTTM);