From b0a48c4d0c3a8411792e5741b83f97456a66d277 Mon Sep 17 00:00:00 2001 From: abercuci Date: Thu, 18 Sep 2008 15:00:12 +0000 Subject: [PATCH] speed up for HLT (Konstantin Markus Alex Raphaelle) --- TRD/AliTRDtrackerV1.cxx | 8 +- TRD/AliTRDtrackingChamber.cxx | 731 +++++++++--------- TRD/AliTRDtrackingChamber.h | 3 +- TRD/AliTRDtrackingSector.cxx | 4 +- TRD/AliTRDtrackingSector.h | 5 +- .../AliTRDtrackingEfficiencyCombined.cxx | 3 +- 6 files changed, 391 insertions(+), 363 deletions(-) diff --git a/TRD/AliTRDtrackerV1.cxx b/TRD/AliTRDtrackerV1.cxx index e544a0f0226..7ba6ec7d01a 100644 --- a/TRD/AliTRDtrackerV1.cxx +++ b/TRD/AliTRDtrackerV1.cxx @@ -1636,10 +1636,11 @@ Int_t AliTRDtrackerV1::BuildTrackingContainers() fTrSec[sector].GetChamber(stack, layer, kTRUE)->InsertCluster(c, icl); } - + + const AliTRDCalDet *cal = AliTRDcalibDB::Instance()->GetT0Det(); for(int isector =0; isectorGetT0Det(); AliTRDtrackingChamber *chamber = 0x0; AliTRDseedV1 sseed[kMaxTracksStack*6]; // to be initialized Int_t pars[4]; // MakeSeeds parameters @@ -2127,7 +2129,7 @@ Int_t AliTRDtrackerV1::Clusters2TracksStack(AliTRDtrackingChamber **stack, TClon for(Int_t ip = 0; ip < kNPlanes; ip++){ if(!(chamber = stack[ip])) continue; - chamber->Build(fGeom);//Indices(fSieveSeeding); + chamber->Build(fGeom, cal);//Indices(fSieveSeeding); } if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){ diff --git a/TRD/AliTRDtrackingChamber.cxx b/TRD/AliTRDtrackingChamber.cxx index 6503f783ab0..5de3712b7b0 100644 --- a/TRD/AliTRDtrackingChamber.cxx +++ b/TRD/AliTRDtrackingChamber.cxx @@ -1,354 +1,377 @@ -/************************************************************************** - * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * - * * - * Author: The ALICE Off-line Project. * - * Contributors are mentioned in the code where appropriate. * - * * - * Permission to use, copy, modify and distribute this software and its * - * documentation strictly for non-commercial purposes is hereby granted * - * without fee, provided that the above copyright notice appears in all * - * copies and that both the copyright notice and this permission notice * - * appear in the supporting documentation. The authors make no claims * - * about the suitability of this software for any purpose. It is * - * provided "as is" without express or implied warranty. * - **************************************************************************/ - -/* $Id: AliTRDtrackingChamber.cxx 23810 2008-02-08 09:00:27Z hristov $ */ - -//////////////////////////////////////////////////////////////////////////// -// // -// Tracking in one chamber // -// // -// Authors: // -// Alex Bercuci // -// Markus Fasel // -// // -//////////////////////////////////////////////////////////////////////////// - -#include "AliTRDtrackingChamber.h" - -#include "TMath.h" -#include "TMatrixTBase.h" -#include - -#include "AliTRDReconstructor.h" -#include "AliTRDrecoParam.h" -#include "AliTRDtrackerV1.h" -#include "AliTRDgeometry.h" -#include "AliTRDpadPlane.h" -#include "AliTRDcalibDB.h" - -ClassImp(AliTRDtrackingChamber) - -//_______________________________________________________ -AliTRDtrackingChamber::AliTRDtrackingChamber(Int_t det) : - fDetector(det) - ,fX0(0.) -{} - -//_______________________________________________________ -void AliTRDtrackingChamber::Clear(const Option_t *opt) -{ - for(Int_t itb=0; itbGetPadTime()].InsertCluster(c, index); -} - -//_______________________________________________________ -Bool_t AliTRDtrackingChamber::Build(AliTRDgeometry *geo) -{ -// Init chamber and all time bins (AliTRDchamberTimeBin) -// Calculates radial position of the chamber based on -// radial positions of the time bins (calibration/alignment aware) -// - Int_t stack = geo->GetStack(fDetector); - Int_t layer = geo->GetLayer(fDetector); - AliTRDpadPlane *pp = geo->GetPadPlane(layer, stack); - Double_t zl = pp->GetRow0ROC() - pp->GetRowEndROC(); - Double_t z0 = geo->GetRow0(layer, stack, 0) - zl; - Int_t nrows = pp->GetNrows(); - - Int_t index[50], jtb = 0; - for(Int_t itb=0; itbGetT0Average(fDetector)); - return kTRUE; -} - -//_______________________________________________________ -Int_t AliTRDtrackingChamber::GetNClusters() const -{ -// Returns number of clusters in chamber -// - Int_t n = 0; - for(Int_t itb=0; itbIsUsed()) nused++; - } - } - - // calculate the deviation of the mean number of clusters from the - // closest integer values - Float_t nclMed = float(ncl-nused)/AliTRDtrackerV1::GetNTimeBins(); - Int_t ncli = Int_t(nclMed); - Float_t nclDev = TMath::Abs(nclMed - TMath::Max(ncli, 1)); - nclDev -= (nclDev>.5) && ncli ? 1. : 0.; - return TMath::Exp(-5.*TMath::Abs(nclDev)); - -// // get slope of the derivative -// if(!fitter.Eval()) return quality; -// fitter.PrintResults(3); -// Double_t a = fitter.GetParameter(1); -// -// printf("ncl_dev(%f) a(%f)\n", ncl_dev, a); -// return quality*TMath::Exp(-a); - -} - - -//_______________________________________________________ -Bool_t AliTRDtrackingChamber::GetSeedingLayer(AliTRDchamberTimeBin *&fakeLayer, AliTRDgeometry *geo, const AliTRDReconstructor *rec) -{ - // - // Creates a seeding layer - // - - // constants - const Int_t kMaxRows = 16; - const Int_t kMaxCols = 144; - const Int_t kMaxPads = 2304; - Int_t timeBinMin = rec->GetRecoParam()->GetNumberOfPresamples(); - Int_t timeBinMax = rec->GetRecoParam()->GetNumberOfPostsamples(); - - // Get the geometrical data of the chamber - Int_t layer = geo->GetLayer(fDetector); - Int_t stack = geo->GetStack(fDetector); - Int_t sector= geo->GetSector(fDetector); - AliTRDpadPlane *pp = geo->GetPadPlane(layer, stack); - Int_t nCols = pp->GetNcols(); - Float_t ymin = TMath::Min(pp->GetCol0(), pp->GetColEnd()); - Float_t ymax = TMath::Max(pp->GetCol0(), pp->GetColEnd()); - Float_t zmin = TMath::Min(pp->GetRow0(), pp->GetRowEnd()); - Float_t zmax = TMath::Max(pp->GetRow0(), pp->GetRowEnd()); - Float_t z0 = -1., zl = -1.; - Int_t nRows = pp->GetNrows(); - Float_t binlength = (ymax - ymin)/nCols; - //AliInfo(Form("ymin(%f) ymax(%f) zmin(%f) zmax(%f) nRows(%d) binlength(%f)", ymin, ymax, zmin, zmax, nRows, binlength)); - - // Fill the histogram - Int_t nClusters; - Int_t *histogram[kMaxRows]; // 2D-Histogram - Int_t hvals[kMaxPads]; memset(hvals, 0, sizeof(Int_t)*kMaxPads); - Float_t *sigmas[kMaxRows]; - Float_t svals[kMaxPads]; memset(svals, 0, sizeof(Float_t)*kMaxPads); - AliTRDcluster *c = 0x0; - for(Int_t irs = 0; irs < kMaxRows; irs++){ - histogram[irs] = &hvals[irs*kMaxCols]; - sigmas[irs] = &svals[irs*kMaxCols]; - } - for(Int_t iTime = timeBinMin; iTime < kNTimeBins-timeBinMax; iTime++){ - if(!(nClusters = fTB[iTime].GetNClusters())) continue; - z0 = fTB[iTime].GetZ0(); - zl = fTB[iTime].GetDZ0(); - for(Int_t incl = 0; incl < nClusters; incl++){ - c = fTB[iTime].GetCluster(incl); - histogram[c->GetPadRow()][c->GetPadCol()]++; - sigmas[c->GetPadRow()][c->GetPadCol()] += c->GetSigmaZ2(); - } - } - -// Now I have everything in the histogram, do the selection - //Int_t nPads = nCols * nRows; - // This is what we are interested in: The center of gravity of the best candidates - Float_t cogyvals[kMaxPads]; memset(cogyvals, 0, sizeof(Float_t)*kMaxPads); - Float_t cogzvals[kMaxPads]; memset(cogzvals, 0, sizeof(Float_t)*kMaxPads); - Float_t *cogy[kMaxRows]; - Float_t *cogz[kMaxRows]; - - // Lookup-Table storing coordinates according to the bins - Float_t yLengths[kMaxCols]; - Float_t zLengths[kMaxRows]; - for(Int_t icnt = 0; icnt < nCols; icnt++){ - yLengths[icnt] = pp->GetColPos(nCols - 1 - icnt) + binlength/2; - } - for(Int_t icnt = 0; icnt < nRows; icnt++){ - zLengths[icnt] = pp->GetRowPos(icnt) - pp->GetRowSize(icnt)/2; - } - - // A bitfield is used to mask the pads as usable - Short_t mask[kMaxCols]; memset(mask, 0 ,sizeof(Short_t) * kMaxCols);//bool mvals[kMaxPads]; - for(UChar_t icount = 0; icount < nRows; icount++){ - cogy[icount] = &cogyvals[icount*kMaxCols]; - cogz[icount] = &cogzvals[icount*kMaxCols]; - } - // In this array the array position of the best candidates will be stored - Int_t cand[AliTRDtrackerV1::kMaxTracksStack]; - Float_t sigcands[AliTRDtrackerV1::kMaxTracksStack]; - - // helper variables - Int_t indices[kMaxPads]; memset(indices, -1, sizeof(Int_t)*kMaxPads); - Int_t nCandidates = 0; - Float_t norm, cogv; - // histogram filled -> Select best bins - Int_t nPads = nCols * nRows; - TMath::Sort(nPads, hvals, indices); // bins storing a 0 should not matter - // Set Threshold - Int_t maximum = hvals[indices[0]]; // best - Int_t threshold = Int_t(maximum * rec->GetRecoParam()->GetFindableClusters()); - Int_t col, row, lower, lower1, upper, upper1; - for(Int_t ib = 0; ib < nPads; ib++){ - if(nCandidates >= AliTRDtrackerV1::kMaxTracksStack){ - printf("Number of seed candidates %d exceeded maximum allowed per stack %d", nCandidates, AliTRDtrackerV1::kMaxTracksStack); - break; - } - // Positions - row = indices[ib]/nCols; - col = indices[ib]%nCols; - // here will be the threshold condition: - if((mask[col] & (1 << row)) != 0) continue; // Pad is masked: continue - if(histogram[row][col] < TMath::Max(threshold, 1)){ // of course at least one cluster is needed - break; // number of clusters below threshold: break; - } - // passing: Mark the neighbors - lower = TMath::Max(col - 1, 0); upper = TMath::Min(col + 2, nCols); - lower1 = TMath::Max(row - 1, 0); upper1 = TMath::Min(row + 2, nCols); - for(Int_t ic = lower; ic < upper; ++ic) - for(Int_t ir = lower1; ir < upper1; ++ir){ - if(ic == col && ir == row) continue; - mask[ic] |= (1 << ir); - } - // Storing the position in an array - // testing for neigboring - cogv = 0; - norm = 0; - lower = TMath::Max(col - 1, 0); - upper = TMath::Min(col + 2, nCols); - for(Int_t inb = lower; inb < upper; ++inb){ - cogv += yLengths[inb] * histogram[row][inb]; - norm += histogram[row][inb]; - } - cogy[row][col] = cogv / norm; - cogv = 0; norm = 0; - lower = TMath::Max(row - 1, 0); - upper = TMath::Min(row + 2, nRows); - for(Int_t inb = lower; inb < upper; ++inb){ - cogv += zLengths[inb] * histogram[inb][col]; - norm += histogram[inb][col]; - } - cogz[row][col] = Float_t(cogv) / norm; - // passed the filter - cand[nCandidates] = row*nCols + col; // store the position of a passig candidate into an Array - sigcands[nCandidates] = sigmas[row][col] / histogram[row][col]; // never be a floating point exeption - // Analysis output - nCandidates++; - } - if(!nCandidates) return kFALSE; - - Float_t pos[3], sig[2]; - Short_t signal[7]; memset(&signal[0], 0, 7*sizeof(Short_t)); - - new(fakeLayer) AliTRDchamberTimeBin(layer, stack, sector, z0, zl); - fakeLayer->SetReconstructor(rec); - AliTRDcluster *cluster = 0x0; - if(nCandidates){ - UInt_t fakeIndex = 0; - for(Int_t ican = 0; ican < nCandidates; ican++){ - row = cand[ican] / nCols; - col = cand[ican] % nCols; - //temporary - Int_t n = 0; Double_t x = 0., y = 0., z = 0.; - for(int itb=0; itbGetPadRow() != row) continue; - if(TMath::Abs(c->GetPadCol() - col) > 2) continue; - x += c->GetX(); - y += c->GetY(); - z += c->GetZ(); - n++; - } - } - pos[0] = x/n; - pos[1] = y/n; - pos[2] = z/n; - sig[0] = .02; - sig[1] = sigcands[ican]; - cluster = new AliTRDcluster(fDetector, 0., pos, sig, 0x0, 3, signal, col, row, 0, 0, 0., 0); - fakeLayer->InsertCluster(cluster, fakeIndex++); - } - } - fakeLayer->SetNRows(nRows); - fakeLayer->SetOwner(); - fakeLayer->BuildIndices(); - //fakeLayer->PrintClusters(); - - if(rec->GetStreamLevel(AliTRDReconstructor::kTracker) >= 3){ - //TMatrixD hist(nRows, nCols); - //for(Int_t i = 0; i < nRows; i++) - // for(Int_t j = 0; j < nCols; j++) - // hist(i,j) = histogram[i][j]; - TTreeSRedirector &cstreamer = *AliTRDtrackerV1::DebugStreamer(); - cstreamer << "GetSeedingLayer" - << "layer=" << layer - << "ymin=" << ymin - << "ymax=" << ymax - << "zmin=" << zmin - << "zmax=" << zmax - << "L.=" << fakeLayer - //<< "Histogram.=" << &hist - << "\n"; - } - - return kTRUE; -} - +/************************************************************************** +* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * +* * +* Author: The ALICE Off-line Project. * +* Contributors are mentioned in the code where appropriate. * +* * +* Permission to use, copy, modify and distribute this software and its * +* documentation strictly for non-commercial purposes is hereby granted * +* without fee, provided that the above copyright notice appears in all * +* copies and that both the copyright notice and this permission notice * +* appear in the supporting documentation. The authors make no claims * +* about the suitability of this software for any purpose. It is * +* provided "as is" without express or implied warranty. * +**************************************************************************/ + +/* $Id: AliTRDtrackingChamber.cxx 23810 2008-02-08 09:00:27Z hristov $ */ + +//////////////////////////////////////////////////////////////////////////// +// // +// Tracking in one chamber // +// // +// Authors: // +// Alex Bercuci // +// Markus Fasel // +// // +//////////////////////////////////////////////////////////////////////////// + +#include "AliTRDtrackingChamber.h" + +#include "TMath.h" +#include "TMatrixTBase.h" +#include + +#include "AliTRDReconstructor.h" +#include "AliTRDrecoParam.h" +#include "AliTRDtrackerV1.h" +#include "AliTRDgeometry.h" +#include "AliTRDpadPlane.h" +#include "AliTRDcalibDB.h" +#include "Cal/AliTRDCalDet.h" +#include "Cal/AliTRDCalROC.h" + +ClassImp(AliTRDtrackingChamber) + +//_______________________________________________________ +AliTRDtrackingChamber::AliTRDtrackingChamber(Int_t det) : + fDetector(det) + ,fX0(0.) +{} + +//_______________________________________________________ +void AliTRDtrackingChamber::Clear(const Option_t *opt) +{ + for(Int_t itb=0; itbGetPadTime()].InsertCluster(c, index); +} + +//_______________________________________________________ +Bool_t AliTRDtrackingChamber::Build(AliTRDgeometry *geo, const AliTRDCalDet *cal, Bool_t hlt) +{ +// Init chamber and all time bins (AliTRDchamberTimeBin) +// Calculates radial position of the chamber based on +// radial positions of the time bins (calibration/alignment aware) +// + Int_t stack = geo->GetStack(fDetector); + Int_t layer = geo->GetLayer(fDetector); + AliTRDpadPlane *pp = geo->GetPadPlane(layer, stack); + Double_t zl = pp->GetRow0ROC() - pp->GetRowEndROC(); + Double_t z0 = geo->GetRow0(layer, stack, 0) - zl; + Int_t nrows = pp->GetNrows(); + + Int_t index[50], jtb = 0; + for(Int_t itb=0; itbGetValue(fDetector); + if(!hlt){ + Double_t mean = 0.0; + AliTRDCalROC *roc = AliTRDcalibDB::Instance()->GetT0ROC(fDetector); + for(Int_t k = 0; kGetNchannels(); k++) mean += roc->GetValue(k); + mean /= roc->GetNchannels(); + t0 = (Int_t)(cal->GetValue(fDetector) + mean); + } + + fX0 = x0 + dx*(index[0] - t0); + return kTRUE; +} + +//_______________________________________________________ +Int_t AliTRDtrackingChamber::GetNClusters() const +{ +// Returns number of clusters in chamber +// + Int_t n = 0; + for(Int_t itb=0; itbIsUsed()) nused++; + } + } + + // calculate the deviation of the mean number of clusters from the + // closest integer values + Float_t nclMed = float(ncl-nused)/AliTRDtrackerV1::GetNTimeBins(); + Int_t ncli = Int_t(nclMed); + Float_t nclDev = TMath::Abs(nclMed - TMath::Max(ncli, 1)); + nclDev -= (nclDev>.5) && ncli ? 1. : 0.; + return TMath::Exp(-5.*TMath::Abs(nclDev)); + +// // get slope of the derivative +// if(!fitter.Eval()) return quality; +// fitter.PrintResults(3); +// Double_t a = fitter.GetParameter(1); +// +// printf("ncl_dev(%f) a(%f)\n", ncl_dev, a); +// return quality*TMath::Exp(-a); + +} + + +//_______________________________________________________ +Bool_t AliTRDtrackingChamber::GetSeedingLayer(AliTRDchamberTimeBin *&fakeLayer, AliTRDgeometry *geo, const AliTRDReconstructor *rec) +{ + // + // Creates a seeding layer + // + + // constants + const Int_t kMaxRows = 16; + const Int_t kMaxCols = 144; + const Int_t kMaxPads = 2304; + Int_t timeBinMin = rec->GetRecoParam()->GetNumberOfPresamples(); + Int_t timeBinMax = rec->GetRecoParam()->GetNumberOfPostsamples(); + + // Get the geometrical data of the chamber + Int_t layer = geo->GetLayer(fDetector); + Int_t stack = geo->GetStack(fDetector); + Int_t sector= geo->GetSector(fDetector); + AliTRDpadPlane *pp = geo->GetPadPlane(layer, stack); + Int_t nCols = pp->GetNcols(); + Float_t ymin = TMath::Min(pp->GetCol0(), pp->GetColEnd()); + Float_t ymax = TMath::Max(pp->GetCol0(), pp->GetColEnd()); + Float_t zmin = TMath::Min(pp->GetRow0(), pp->GetRowEnd()); + Float_t zmax = TMath::Max(pp->GetRow0(), pp->GetRowEnd()); + Float_t z0 = -1., zl = -1.; + Int_t nRows = pp->GetNrows(); + Float_t binlength = (ymax - ymin)/nCols; + //AliInfo(Form("ymin(%f) ymax(%f) zmin(%f) zmax(%f) nRows(%d) binlength(%f)", ymin, ymax, zmin, zmax, nRows, binlength)); + + // Fill the histogram + Int_t nClusters; + Int_t *histogram[kMaxRows]; // 2D-Histogram + Int_t hvals[kMaxPads + 1]; memset(hvals, 0, sizeof(Int_t)*kMaxPads); // one entry in addition for termination flag + Float_t *sigmas[kMaxRows]; + Float_t svals[kMaxPads]; memset(svals, 0, sizeof(Float_t)*kMaxPads); + AliTRDcluster *c = 0x0; + for(Int_t irs = 0; irs < kMaxRows; irs++){ + histogram[irs] = &hvals[irs*kMaxCols]; + sigmas[irs] = &svals[irs*kMaxCols]; + } + for(Int_t iTime = timeBinMin; iTime < kNTimeBins-timeBinMax; iTime++){ + if(!(nClusters = fTB[iTime].GetNClusters())) continue; + z0 = fTB[iTime].GetZ0(); + zl = fTB[iTime].GetDZ0(); + for(Int_t incl = 0; incl < nClusters; incl++){ + c = fTB[iTime].GetCluster(incl); + histogram[c->GetPadRow()][c->GetPadCol()]++; + sigmas[c->GetPadRow()][c->GetPadCol()] += c->GetSigmaZ2(); + } + } + +// Now I have everything in the histogram, do the selection + //Int_t nPads = nCols * nRows; + // This is what we are interested in: The center of gravity of the best candidates + Float_t cogyvals[kMaxPads]; memset(cogyvals, 0, sizeof(Float_t)*kMaxPads); + Float_t cogzvals[kMaxPads]; memset(cogzvals, 0, sizeof(Float_t)*kMaxPads); + Float_t *cogy[kMaxRows]; + Float_t *cogz[kMaxRows]; + + // Lookup-Table storing coordinates according to the bins + Float_t yLengths[kMaxCols]; + Float_t zLengths[kMaxRows]; + for(Int_t icnt = 0; icnt < nCols; icnt++){ + yLengths[icnt] = pp->GetColPos(nCols - 1 - icnt) + binlength/2; + } + for(Int_t icnt = 0; icnt < nRows; icnt++){ + zLengths[icnt] = pp->GetRowPos(icnt) - pp->GetRowSize(icnt)/2; + } + + // A bitfield is used to mask the pads as usable + Short_t mask[kMaxCols]; memset(mask, 0 ,sizeof(Short_t) * kMaxCols);//bool mvals[kMaxPads]; + for(UChar_t icount = 0; icount < nRows; icount++){ + cogy[icount] = &cogyvals[icount*kMaxCols]; + cogz[icount] = &cogzvals[icount*kMaxCols]; + } + // In this array the array position of the best candidates will be stored + Int_t cand[AliTRDtrackerV1::kMaxTracksStack]; + Float_t sigcands[AliTRDtrackerV1::kMaxTracksStack]; + + // helper variables + Int_t indices[kMaxPads]; memset(indices, -1, sizeof(Int_t)*kMaxPads); + Int_t nCandidates = 0; + Float_t norm, cogv; + // histogram filled -> Select best bins + Int_t nPads = nCols * nRows; + // take out all the bins which have less than 3 entries (faster sorting) + Int_t content[kMaxPads], dictionary[kMaxPads], nCont = 0, padnumber = 0; + Int_t *iter = &hvals[0], *citer = &content[0], *diter = &dictionary[0]; // iterators for preselection + const Int_t threshold = 2; + hvals[nPads] = -1; // termination for iterator + do{ + if(*iter > threshold){ + *(citer++) = *iter; + *(diter++) = padnumber; + nCont++; + } + padnumber++; + }while(*(++iter) != -1); + TMath::Sort(nCont, content, indices); + + Int_t col, row, lower, lower1, upper, upper1; + for(Int_t ib = 0; ib < nCont; ib++){ + if(nCandidates >= AliTRDtrackerV1::kMaxTracksStack){ + printf("Number of seed candidates %d exceeded maximum allowed per stack %d", nCandidates, AliTRDtrackerV1::kMaxTracksStack); + break; + } + // Positions + row = dictionary[indices[ib]]/nCols; + col = dictionary[indices[ib]]%nCols; + // here will be the threshold condition: + if((mask[col] & (1 << row)) != 0) continue; // Pad is masked: continue + // if(histogram[row][col] < TMath::Max(threshold, 1)){ // of course at least one cluster is needed + // break; // number of clusters below threshold: break; + // } + // passing: Mark the neighbors + lower = TMath::Max(col - 1, 0); upper = TMath::Min(col + 2, nCols); + lower1 = TMath::Max(row - 1, 0); upper1 = TMath::Min(row + 2, nCols); + for(Int_t ic = lower; ic < upper; ++ic) + for(Int_t ir = lower1; ir < upper1; ++ir){ + if(ic == col && ir == row) continue; + mask[ic] |= (1 << ir); + } + // Storing the position in an array + // testing for neigboring + cogv = 0; + norm = 0; + lower = TMath::Max(col - 1, 0); + upper = TMath::Min(col + 2, nCols); + for(Int_t inb = lower; inb < upper; ++inb){ + cogv += yLengths[inb] * histogram[row][inb]; + norm += histogram[row][inb]; + } + cogy[row][col] = cogv / norm; + cogv = 0; norm = 0; + lower = TMath::Max(row - 1, 0); + upper = TMath::Min(row + 2, nRows); + for(Int_t inb = lower; inb < upper; ++inb){ + cogv += zLengths[inb] * histogram[inb][col]; + norm += histogram[inb][col]; + } + cogz[row][col] = Float_t(cogv) / norm; + // passed the filter + cand[nCandidates] = row*nCols + col; // store the position of a passig candidate into an Array + sigcands[nCandidates] = sigmas[row][col] / histogram[row][col]; // never be a floating point exeption + // Analysis output + nCandidates++; + } + if(!nCandidates) return kFALSE; + + Float_t pos[3], sig[2]; + Short_t signal[7]; memset(&signal[0], 0, 7*sizeof(Short_t)); + + new(fakeLayer) AliTRDchamberTimeBin(layer, stack, sector, z0, zl); + fakeLayer->SetReconstructor(rec); + AliTRDcluster *cluster = 0x0; + if(nCandidates){ + UInt_t fakeIndex = 0; + for(Int_t ican = 0; ican < nCandidates; ican++){ + row = cand[ican] / nCols; + col = cand[ican] % nCols; + //temporary + Int_t n = 0; Double_t x = 0., y = 0., z = 0.; + for(int itb=0; itbGetPadRow() != row) continue; + if(TMath::Abs(c->GetPadCol() - col) > 2) continue; + x += c->GetX(); + y += c->GetY(); + z += c->GetZ(); + n++; + } + } + pos[0] = x/n; + pos[1] = y/n; + pos[2] = z/n; + sig[0] = .02; + sig[1] = sigcands[ican]; + cluster = new AliTRDcluster(fDetector, 0., pos, sig, 0x0, 3, signal, col, row, 0, 0, 0., 0); + fakeLayer->InsertCluster(cluster, fakeIndex++); + } + } + fakeLayer->SetNRows(nRows); + fakeLayer->SetOwner(); + fakeLayer->BuildIndices(); + //fakeLayer->PrintClusters(); + + if(rec->GetStreamLevel(AliTRDReconstructor::kTracker) >= 3){ + //TMatrixD hist(nRows, nCols); + //for(Int_t i = 0; i < nRows; i++) + // for(Int_t j = 0; j < nCols; j++) + // hist(i,j) = histogram[i][j]; + TTreeSRedirector &cstreamer = *AliTRDtrackerV1::DebugStreamer(); + cstreamer << "GetSeedingLayer" + << "layer=" << layer + << "ymin=" << ymin + << "ymax=" << ymax + << "zmin=" << zmin + << "zmax=" << zmax + << "L.=" << fakeLayer + //<< "Histogram.=" << &hist + << "\n"; + } + + return kTRUE; +} + diff --git a/TRD/AliTRDtrackingChamber.h b/TRD/AliTRDtrackingChamber.h index d357cd5627f..9ea06db5647 100644 --- a/TRD/AliTRDtrackingChamber.h +++ b/TRD/AliTRDtrackingChamber.h @@ -20,6 +20,7 @@ #include "AliTRDchamberTimeBin.h" #endif +class AliTRDCalDet; class AliTRDgeometry; class AliTRDReconstructor; class AliTRDtrackingChamber @@ -32,7 +33,7 @@ public: AliTRDtrackingChamber(Int_t det); virtual ~AliTRDtrackingChamber(){} - Bool_t Build(AliTRDgeometry *geo); + Bool_t Build(AliTRDgeometry *geo, const AliTRDCalDet *cal, Bool_t hlt = kFALSE); void Clear(const Option_t *opt = 0x0); Int_t GetDetector() const {return fDetector;} Int_t GetNClusters() const; diff --git a/TRD/AliTRDtrackingSector.cxx b/TRD/AliTRDtrackingSector.cxx index 2e1b5d95248..74d95f61f2b 100644 --- a/TRD/AliTRDtrackingSector.cxx +++ b/TRD/AliTRDtrackingSector.cxx @@ -88,7 +88,7 @@ AliTRDtrackingSector::~AliTRDtrackingSector() } //_____________________________________________________________________________ -void AliTRDtrackingSector::Init(const AliTRDReconstructor *rec) +void AliTRDtrackingSector::Init(const AliTRDReconstructor *rec, const AliTRDCalDet *cal) { // Steer building of tracking chambers and build tracking sector. // Propagate radial position information (calibration/alignment aware) from chambers to sector level @@ -101,7 +101,7 @@ void AliTRDtrackingSector::Init(const AliTRDReconstructor *rec) if(!(tb = tc->GetTB(itb))) continue; tb->SetReconstructor(rec); } - tc->Build(fGeom); + tc->Build(fGeom, cal, rec->IsHLT()); } Int_t nl; diff --git a/TRD/AliTRDtrackingSector.h b/TRD/AliTRDtrackingSector.h index 20d4b7bb94e..cb3ac4a83f8 100644 --- a/TRD/AliTRDtrackingSector.h +++ b/TRD/AliTRDtrackingSector.h @@ -21,9 +21,10 @@ #include "Rtypes.h" #endif -class AliTRDtrackingChamber; +class AliTRDCalDet; class AliTRDgeometry; class AliTRDReconstructor; +class AliTRDtrackingChamber; class AliTRDtrackingSector { @@ -49,7 +50,7 @@ public: AliTRDtrackingChamber** GetStack(Int_t stack); Int_t GetSector() const {return fSector;} - void Init(const AliTRDReconstructor *rec); + void Init(const AliTRDReconstructor *rec, const AliTRDCalDet *cal); void Print(Option_t *opt = 0x0); void SetGeometry(AliTRDgeometry *geo) {fGeom = geo;} diff --git a/TRD/qaRec/AliTRDtrackingEfficiencyCombined.cxx b/TRD/qaRec/AliTRDtrackingEfficiencyCombined.cxx index c466e3ee162..51815de6c7d 100644 --- a/TRD/qaRec/AliTRDtrackingEfficiencyCombined.cxx +++ b/TRD/qaRec/AliTRDtrackingEfficiencyCombined.cxx @@ -109,7 +109,8 @@ void AliTRDtrackingEfficiencyCombined::Exec(Option_t *){ while(!(trackRef = trkInf->GetTrackRef(iref++))); } if(!trackRef) printf("Error: Track Reference missing for Track %d\n", trkInf->GetLabel()); - mom = trackRef ? trackRef->P() : TRDtrack->P(); + mom = trackRef ? trackRef->P() : trkInf->GetOuterParam()->P(); + // Accept track if(fDebugLevel > 3)printf("Accept track\n"); momacc[naccepted] = mom; -- 2.39.3