#include "AliLoader.h"
#include "AliRawReader.h"
#include "AliLog.h"
+#include "AliAlignObj.h"
#include "AliTRDclusterizerV1.h"
#include "AliTRDgeometry.h"
#include "AliTRDcalibDB.h"
#include "AliTRDSimParam.h"
#include "AliTRDRecParam.h"
-#include "AliTRDCommonParam.h"
#include "AliTRDcluster.h"
#include "Cal/AliTRDCalROC.h"
}
+//_____________________________________________________________________________
+Bool_t AliTRDclusterizerV1::ReadDigits(TTree *digitsTree)
+{
+ //
+ // Reads the digits arrays from the input tree
+ //
+
+ // Read in the digit arrays
+ return (fDigitsManager->ReadDigits(digitsTree));
+
+}
+
//_____________________________________________________________________________
Bool_t AliTRDclusterizerV1::ReadDigits(AliRawReader *rawReader)
{
AliTRDdataArrayI *digitsIn;
AliTRDdataArrayI *tracksIn;
- // Get the geometry
- AliTRDgeometry *geo = AliTRDgeometry::GetGeometry(fRunLoader);
- if (!geo) {
- AliWarning("Loading default TRD geometry!");
- geo = new AliTRDgeometry();
- }
+ AliTRDgeometry geo;
AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
if (!calibration) {
AliError("No AliTRDRecParam instance available\n");
return kFALSE;
}
-
- AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
- if (!commonParam) {
- AliError("Could not get common parameters\n");
- return kFALSE;
- }
- // ADC threshols
+ // ADC thresholds
Float_t ADCthreshold = simParam->GetADCthreshold();
// Threshold value for the maximum
Float_t maxThresh = recParam->GetClusMaxThresh();
Float_t sigThresh = recParam->GetClusSigThresh();
// Detector wise calibration object for t0
- const AliTRDCalDet *calT0Det = calibration->GetT0Det();
+ const AliTRDCalDet *calT0Det = calibration->GetT0Det();
+ // Detector wise calibration object for the gain factors
+ const AliTRDCalDet *calGainFactorDet = calibration->GetGainFactorDet();
// Iteration limit for unfolding procedure
const Float_t kEpsilon = 0.01;
const Int_t kNdict = AliTRDdigitsManager::kNDict;
const Int_t kNtrack = kNdict * kNclus;
- Int_t iType = 0;
Int_t iUnfold = 0;
Double_t ratioLeft = 1.0;
Double_t ratioRight = 1.0;
Int_t sectEnd = AliTRDgeometry::Nsect();
Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
- Int_t dummy[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
AliDebug(1,Form("Number of Time Bins = %d.\n",nTimeTotal));
// Start clustering in every chamber
for (iplan = planBeg; iplan < planEnd; iplan++) {
for (isect = sectBeg; isect < sectEnd; isect++) {
- Int_t idet = geo->GetDetector(iplan,icham,isect);
+ Int_t idet = geo.GetDetector(iplan,icham,isect);
+ Int_t ilayer = AliGeomManager::kTRD1 + iplan;
+ Int_t imodule = icham + chamEnd * isect;
+ UShort_t volid = AliGeomManager::LayerToVolUID(ilayer,imodule);
// Get the digits
digitsIn = fDigitsManager->GetDigits(idet);
AliTRDdataArrayI *tracksTmp = fDigitsManager->GetDictionary(idet,0);
tracksTmp->Expand();
- Int_t nRowMax = commonParam->GetRowMax(iplan,icham,isect);
- Int_t nColMax = commonParam->GetColMax(iplan);
+ Int_t nRowMax = geo.GetRowMax(iplan,icham,isect);
+ Int_t nColMax = geo.GetColMax(iplan);
- AliTRDpadPlane *padPlane = commonParam->GetPadPlane(iplan,icham);
+ AliTRDpadPlane *padPlane = geo.GetPadPlane(iplan,icham);
// Calibration object with pad wise values for t0
- AliTRDCalROC *calT0ROC = calibration->GetT0ROC(idet);
+ AliTRDCalROC *calT0ROC = calibration->GetT0ROC(idet);
+ // Calibration object with pad wise values for the gain factors
+ AliTRDCalROC *calGainFactorROC = calibration->GetGainFactorROC(idet);
// Calibration value for chamber wise t0
- Float_t calT0DetValue = calT0Det->GetValue(idet);
+ Float_t calT0DetValue = calT0Det->GetValue(idet);
+ // Calibration value for chamber wise gain factor
+ Float_t calGainFactorDetValue = calGainFactorDet->GetValue(idet);
Int_t nClusters = 0;
- Int_t nClusters2pad = 0;
- Int_t nClusters3pad = 0;
- Int_t nClusters4pad = 0;
- Int_t nClusters5pad = 0;
- Int_t nClustersLarge = 0;
// Apply the gain and the tail cancelation via digital filter
AliTRDdataArrayF *digitsOut = new AliTRDdataArrayF(digitsIn->GetNrow()
,digitsIn->GetNcol()
- ,digitsIn->GetNtime());
- Transform(digitsIn,digitsOut,idet,nRowMax,nColMax,nTimeTotal,ADCthreshold);
+ ,digitsIn->GetNtime());
+ Transform(digitsIn
+ ,digitsOut
+ ,nRowMax,nColMax,nTimeTotal
+ ,ADCthreshold
+ ,calGainFactorROC
+ ,calGainFactorDetValue);
// Input digits are not needed any more
digitsIn->Compress(1,0);
if (col+ii+1 >= nColMax) break;
}
nClusters++;
- switch (nPadCount) {
- case 2:
- iType = 0;
- nClusters2pad++;
- break;
- case 3:
- iType = 1;
- nClusters3pad++;
- break;
- case 4:
- iType = 2;
- nClusters4pad++;
- break;
- case 5:
- iType = 3;
- nClusters5pad++;
- break;
- default:
- iType = 4;
- nClustersLarge++;
- break;
- };
// Look for 5 pad cluster with minimum in the middle
Bool_t fivePadCluster = kFALSE;
// of the cluster which remains from a previous unfolding
if (iUnfold) {
clusterSignal[0] *= ratioLeft;
- iType = 5;
iUnfold = 0;
}
ratioRight = Unfold(kEpsilon,iplan,padSignal);
ratioLeft = 1.0 - ratioRight;
clusterSignal[2] *= ratioRight;
- iType = 5;
iUnfold = 1;
}
// Correct for t0 (sum of chamber and pad wise values !!!)
Float_t calT0ROCValue = calT0ROC->GetValue(col,row);
- Int_t clusterTimeBin = TMath::Nint(time - (calT0DetValue + calT0ROCValue));
+ Char_t clusterTimeBin = ((Char_t) TMath::Nint(time - (calT0DetValue + calT0ROCValue)));
Double_t colSize = padPlane->GetColSize(col);
Double_t rowSize = padPlane->GetRowSize(row);
- Double_t clusterPos[3];
+ Float_t clusterPos[3];
clusterPos[0] = padPlane->GetColPos(col) - (clusterPads[1] + 0.5) * colSize;
clusterPos[1] = padPlane->GetRowPos(row) - 0.5 * rowSize;
clusterPos[2] = CalcXposFromTimebin(clusterPads[2],idet,col,row);
- Double_t clusterSig[2];
+ Float_t clusterSig[2];
clusterSig[0] = (clusterSigmaY2 + 1.0/12.0) * colSize*colSize;
clusterSig[1] = rowSize * rowSize / 12.0;
-
- // Add the cluster to the output array
- // The track indices will be stored later
- AliTRDcluster *cluster = AddCluster(clusterPos
- ,clusterTimeBin
- ,idet
- ,clusterCharge
- ,dummy
- ,clusterSig
- ,iType
- ,clusterPads[1]);
-
+
// Store the amplitudes of the pads in the cluster for later analysis
Short_t signals[7] = { 0, 0, 0, 0, 0, 0, 0 };
for (Int_t jPad = col-3; jPad <= col+3; jPad++) {
}
signals[jPad-col+3] = TMath::Nint(TMath::Abs(digitsOut->GetDataUnchecked(row,jPad,time)));
}
- cluster->SetSignals(signals);
+ // Add the cluster to the output array
+ // The track indices will be stored later
+ AliTRDcluster *cluster = new AliTRDcluster(idet
+ ,clusterCharge
+ ,clusterPos
+ ,clusterSig
+ ,0x0
+ ,((Char_t) nPadCount)
+ ,signals
+ ,((UChar_t) col)
+ ,clusterTimeBin
+ ,clusterPads[1]
+ ,volid);
// Temporarily store the row, column and time bin of the center pad
// Used to later on assign the track indices
cluster->SetLabel( row,0);
cluster->SetLabel( col,1);
cluster->SetLabel(time,2);
+ RecPoints()->Add(cluster);
// Store the index of the first cluster in the current ROC
if (firstClusterROC < 0) {
//_____________________________________________________________________________
void AliTRDclusterizerV1::Transform(AliTRDdataArrayI *digitsIn
, AliTRDdataArrayF *digitsOut
- , Int_t idet, Int_t nRowMax
- , Int_t nColMax, Int_t nTimeTotal
- , Float_t ADCthreshold)
+ , Int_t nRowMax, Int_t nColMax, Int_t nTimeTotal
+ , Float_t ADCthreshold
+ , AliTRDCalROC *calGainFactorROC
+ , Float_t calGainFactorDetValue)
{
//
// Apply gain factor
AliError("No AliTRDRecParam instance available\n");
return;
}
- AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
- if (!calibration) {
- AliError("No AliTRDcalibDB instance available\n");
- return;
- }
Double_t *inADC = new Double_t[nTimeTotal]; // ADC data before tail cancellation
Double_t *outADC = new Double_t[nTimeTotal]; // ADC data after tail cancellation
- AliDebug(1,Form("Tail cancellation (nExp = %d) for detector %d.\n"
- ,recParam->GetTCnexp(),idet));
-
- // Calibration object with chamber wise values for the gain factor
- const AliTRDCalDet *calGainFactorDet = calibration->GetGainFactorDet();
- // Calibration object with pad wise values for the gain factor
- AliTRDCalROC *calGainFactorROC = calibration->GetGainFactorROC(idet);
- // Calibration value for chamber wise gain factors
- Float_t calGainFactorDetValue = calGainFactorDet->GetValue(idet);
-
for (iRow = 0; iRow < nRowMax; iRow++ ) {
for (iCol = 0; iCol < nColMax; iCol++ ) {