+//-------------------------------------------------------------------------
+UShort_t AliTOFClusterFinder::GetClusterVolIndex(const Int_t * const ind) const {
+
+ //First of all get the volume ID to retrieve the l2t transformation...
+ //
+ // Detector numbering scheme
+ Int_t nSector = 18;
+ Int_t nPlate = 5;
+ Int_t nStripA = 15;
+ Int_t nStripB = 19;
+ Int_t nStripC = 19;
+
+ Int_t isector =ind[0];
+ if (isector >= nSector)
+ AliError(Form("Wrong sector number in TOF (%d) !",isector));
+ Int_t iplate = ind[1];
+ if (iplate >= nPlate)
+ AliError(Form("Wrong plate number in TOF (%d) !",iplate));
+ Int_t istrip = ind[2];
+
+ Int_t stripOffset = 0;
+ switch (iplate) {
+ case 0:
+ stripOffset = 0;
+ break;
+ case 1:
+ stripOffset = nStripC;
+ break;
+ case 2:
+ stripOffset = nStripC+nStripB;
+ break;
+ case 3:
+ stripOffset = nStripC+nStripB+nStripA;
+ break;
+ case 4:
+ stripOffset = nStripC+nStripB+nStripA+nStripB;
+ break;
+ default:
+ AliError(Form("Wrong plate number in TOF (%d) !",iplate));
+ break;
+ };
+
+ Int_t index= (2*(nStripC+nStripB)+nStripA)*isector +
+ stripOffset +
+ istrip;
+
+ UShort_t volIndex = AliGeomManager::LayerToVolUID(AliGeomManager::kTOF,index);
+ return volIndex;
+}
+//
+//-------------------------------------------------------------------------
+void AliTOFClusterFinder::GetClusterPars(Int_t *ind, Double_t* pos,Double_t* cov) const {
+
+ //First of all get the volume ID to retrieve the l2t transformation...
+ //
+ UShort_t volIndex = GetClusterVolIndex(ind);
+ //
+ //
+ //we now go in the system of the strip: determine the local coordinates
+ //
+ //
+ // 47---------------------------------------------------0 ^ z
+ // | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 |
+ // ----------------------------------------------------- | y going outwards
+ // | | | | | | | | | | | | | | | | | | | | | | | | | | | 0 | par[0]=0;
+
+ // ----------------------------------------------------- |
+ // x <-----------------------------------------------------
+
+ /*
+ Float_t localX = (ind[4]-23.5)*AliTOFGeometry::XPad();
+ Float_t localY = 0;
+ Float_t localZ = (ind[3]- 0.5)*AliTOFGeometry::ZPad();
+ */
+ Float_t localX = (ind[4]-AliTOFGeometry::NpadX()/2)*AliTOFGeometry::XPad()+AliTOFGeometry::XPad()/2.;
+ Float_t localY = 0;
+ Float_t localZ = (ind[3]-AliTOFGeometry::NpadZ()/2)*AliTOFGeometry::ZPad()+AliTOFGeometry::ZPad()/2.;
+ //move to the tracking ref system
+
+ Double_t lpos[3];
+ lpos[0] = localX;
+ lpos[1] = localY;
+ lpos[2] = localZ;
+
+ const TGeoHMatrix *l2t= AliGeomManager::GetTracking2LocalMatrix(volIndex);
+ // Get The position in the track ref system
+ Double_t tpos[3];
+ l2t->MasterToLocal(lpos,tpos);
+ pos[0] = tpos[0];
+ pos[1] = tpos[1];
+ pos[2] = tpos[2];
+
+ //Get The cluster covariance in the track ref system
+ Double_t lcov[9];
+
+ //cluster covariance in the local system:
+ // sx2 0 0
+ // 0 0 0
+ // 0 0 sz2
+
+ lcov[0] = AliTOFGeometry::XPad()*AliTOFGeometry::XPad()/12.;
+ lcov[1] = 0;
+ lcov[2] = 0;
+ lcov[3] = 0;
+ lcov[4] = 0;
+ lcov[5] = 0;
+ lcov[6] = 0;
+ lcov[7] = 0;
+ lcov[8] = AliTOFGeometry::ZPad()*AliTOFGeometry::ZPad()/12.;
+
+ //cluster covariance in the tracking system:
+ TGeoHMatrix m;
+ m.SetRotation(lcov);
+ m.Multiply(l2t);
+ m.MultiplyLeft(&l2t->Inverse());
+ Double_t *tcov = m.GetRotationMatrix();
+ cov[0] = tcov[0]; cov[1] = tcov[1]; cov[2] = tcov[2];
+ cov[3] = tcov[4]; cov[4] = tcov[5];
+ cov[5] = tcov[8];
+
+ return;
+
+}
+//-------------------------------------------------------------------------
+void AliTOFClusterFinder::FillTOFtriggerMap(Int_t iDDL, AliTOFrawData *tofRawDatum)
+{
+
+ /* get cluster info */
+ //Int_t trm = tofRawDatum->GetTRM();
+ // Int_t tdc = tofRawDatum->GetTDC();
+// Int_t tdc_ch = tofRawDatum->GetTDCchannel();
+ Int_t chain = tofRawDatum->GetTRMchain();
+ Int_t l0l1 = tofRawDatum->GetL0L1Latency();
+ Double_t corr = l0l1 * AliTOFGeometry::BunchCrossingBinWidth();
+ AliTOFCTPLatency *ctpLatencyObj = fTOFcalib->GetCTPLatency();
+ Float_t ctpLatency = ctpLatencyObj->GetCTPLatency();
+ corr += ctpLatency;
+
+ Double_t timeTOF=tofRawDatum->GetTOF()*AliTOFGeometry::TdcBinWidth();
+ timeTOF-=corr;
+ //Int_t timeRaw_bc = Int_t(timeTOF/1000/24.4); // per ora non usata
+
+ //Int_t timeRaw_bc = Int_t((tofRawDatum->GetTOF()*AliTOFGeometry::TdcBinWidth())/1000/24.4); // per ora non usata
+
+ /*
+ const Int_t crate_CTTM[72] = { 0, 1, 37, 36, 2, 3, 39, 38, 4, 5,
+ 41, 40, 6, 7, 43, 42, 8, 9, 45, 44,
+ 10, 11, 47, 46, 12, 13, 49, 48, 14, 15,
+ 51, 50, 16, 17, 53, 52, 18, 19, 55, 54,
+ 20, 21, 57, 56, 22, 23, 59, 58, 24, 25,
+ 61, 60, 26, 27, 63, 62, 28, 29, 65, 64,
+ 30, 31, 67, 66, 32, 33, 69, 68, 34, 35,
+ 71, 70};
+ */
+
+ Int_t cttmCrate=-1;
+// Int_t cttmBit = tdc_ch + (tdc-12)*AliTOFGeometry::NCh();
+ switch(iDDL%AliTOFGeometry::NDDL()){
+ case 1:
+ cttmCrate=1;
+ break;
+ case 3:
+ cttmCrate=36;
+ break;
+ default:
+ break;
+ }
+ cttmCrate+=2*(Int_t)(iDDL/AliTOFGeometry::NDDL());
+ if(chain==0) {
+ if (iDDL<36) cttmCrate--;
+ else cttmCrate++;
+ }
+
+
+
+
+}
+