,fCalNoiseROC(NULL)
,fCalNoiseDetValue(0)
,fCalPadStatusROC(NULL)
- ,fCalOnGainROC(NULL)
+ ,fCalOnlGainROC(NULL)
,fClusterROC(0)
,firstClusterROC(0)
,fNoOfClusters(0)
,fCalNoiseROC(NULL)
,fCalNoiseDetValue(0)
,fCalPadStatusROC(NULL)
- ,fCalOnGainROC(NULL)
+ ,fCalOnlGainROC(NULL)
,fClusterROC(0)
,firstClusterROC(0)
,fNoOfClusters(0)
,fCalNoiseROC(NULL)
,fCalNoiseDetValue(0)
,fCalPadStatusROC(NULL)
- ,fCalOnGainROC(NULL)
+ ,fCalOnlGainROC(NULL)
,fClusterROC(0)
,firstClusterROC(0)
,fNoOfClusters(0)
// AliTRDclusterizer destructor
//
- if (fRecPoints/* && IsClustersOwner()*/){
- fRecPoints->Delete();
- delete fRecPoints;
- }
-
- if (fTracklets){
- fTracklets->Delete();
- delete fTracklets;
- }
-
- if (fTracks){
- fTracks->Delete();
- delete fTracks;
- }
-
if (fDigitsManager) {
delete fDigitsManager;
fDigitsManager = NULL;
delete fRawStream;
fRawStream = NULL;
}
-
}
//_____________________________________________________________________________
AliError(Form("Unexpected detector index %d.\n",det));
return kFALSE;
}
+ Int_t nRecPoints = RecPoints()->GetEntriesFast();
+ if(!nRecPoints) return kTRUE;
TObjArray *ioArray = new TObjArray(400);
TBranch *branch = fClusterTree->GetBranch("TRDcluster");
fClusterTree->Branch("TRDcluster","TObjArray",&ioArray,32000,0);
} else branch->SetAddress(&ioArray);
- Int_t nRecPoints = RecPoints()->GetEntriesFast();
+ AliTRDcluster *c(NULL);
if(det >= 0){
for (Int_t i = 0; i < nRecPoints; i++) {
- AliTRDcluster *c = (AliTRDcluster *) RecPoints()->UncheckedAt(i);
+ if(!(c = (AliTRDcluster *) RecPoints()->UncheckedAt(i))) continue;
if(det != c->GetDetector()) continue;
ioArray->AddLast(c);
}
fClusterTree->Fill();
ioArray->Clear();
} else {
- Int_t detOld = -1, nw(0);
- for (Int_t i = 0; i < nRecPoints; i++) {
- AliTRDcluster *c = (AliTRDcluster *) RecPoints()->UncheckedAt(i);
+ if(!(c = (AliTRDcluster*)RecPoints()->UncheckedAt(0))){
+ AliError("Missing first cluster.");
+ delete ioArray;
+ return kFALSE;
+ }
+ Int_t detOld(c->GetDetector()), nw(0);
+ ioArray->AddLast(c);
+ for (Int_t i(1); i<nRecPoints; i++) {
+ if(!(c = (AliTRDcluster *) RecPoints()->UncheckedAt(i))) continue;
if(c->GetDetector() != detOld){
nw += ioArray->GetEntriesFast();
+ // fill & clear previously detector set of clusters
fClusterTree->Fill();
ioArray->Clear();
detOld = c->GetDetector();
}
if(ioArray->GetEntriesFast()){
nw += ioArray->GetEntriesFast();
+ // fill & clear last detector set of clusters (if any)
fClusterTree->Fill();
ioArray->Clear();
}
AliDebug(2, Form("Clusters FOUND[%d] WRITTEN[%d] STATUS[%s]", nRecPoints, nw, nw==nRecPoints?"OK":"FAILED"));
+ if(nw!=nRecPoints) AliWarning(Form("Clusters FOUND[%d] WRITTEN[%d]", nRecPoints, nw));
}
delete ioArray;
trackletLoader->Load();
TTree *trackletTree = trackletLoader->Tree();
- if (trackletTree) {
- TBranch *trklbranch = trackletTree->GetBranch("mcmtrklbranch");
- TClonesArray *trklArray = TrackletsArray("AliTRDtrackletMCM");
- if (trklbranch && trklArray) {
- AliTRDtrackletMCM *trkl = 0x0;
- trklbranch->SetAddress(&trkl);
- for (Int_t iTracklet = 0; iTracklet < trklbranch->GetEntries(); iTracklet++) {
- trklbranch->GetEntry(iTracklet);
- new ((*trklArray)[trklArray->GetEntries()]) AliTRDtrackletMCM(*trkl);
- }
- return kTRUE;
- }
- }
- return kFALSE;
+ if (trackletTree) {
+ TBranch *trklbranch = trackletTree->GetBranch("mcmtrklbranch");
+ TClonesArray *trklArray = TrackletsArray("AliTRDtrackletMCM");
+ if (trklbranch && trklArray) {
+ AliTRDtrackletMCM *trkl = 0x0;
+ trklbranch->SetAddress(&trkl);
+ for (Int_t iTracklet = 0; iTracklet < trklbranch->GetEntries(); iTracklet++) {
+ trklbranch->GetEntry(iTracklet);
+ new ((*trklArray)[trklArray->GetEntries()]) AliTRDtrackletMCM(*trkl);
+ }
+ return kTRUE;
+ }
+ }
+ return kFALSE;
}
Bool_t AliTRDclusterizer::ReadTracks()
if(fReconstructor->IsWritingClusters()) WriteClusters(-1);
- AliInfo(Form("Number of found clusters : %d", RecPoints()->GetEntriesFast()));
+ AliInfo(Form("Found :: clusters[%d] tracklets[%d] tracks[%d]",
+ RecPoints()?RecPoints()->GetEntriesFast():0,
+ TrackletsArray()?TrackletsArray()->GetEntriesFast():0,
+ TracksArray()?TracksArray()->GetEntriesFast():0));
return fReturn;
fRawStream = NULL;
}
- AliInfo(Form("Number of found clusters : %d", fNoOfClusters));
+ AliInfo(Form("Found :: clusters[%d] tracklets[%d] tracks[%d]",
+ RecPoints()?RecPoints()->GetEntriesFast():0,
+ TrackletsArray()?TrackletsArray()->GetEntriesFast():0,
+ TracksArray()?TracksArray()->GetEntriesFast():0));
return kTRUE;
}
// Calibration object with the pad status
fCalPadStatusROC = calibration->GetPadStatusROC(fDet);
// Calibration object of the online gain
- fCalOnGainROC = calibration->GetOnlineGainTableROC(fDet);
+ fCalOnlGainROC = 0x0;
+ if (calibration->HasOnlineFilterGain()) {
+ fCalOnlGainROC = calibration->GetOnlineGainTableROC(fDet);
+ }
firstClusterROC = -1;
fClusterROC = 0;
//
Float_t gain = fCalGainFactorDetValue * fCalGainFactorROC->GetValue(Max.col,Max.row);
- Float_t ongain = fCalOnGainROC ? fCalOnGainROC->GetGainCorrectionFactor(Max.row,Max.col) : 1;
- Signals[1] = (fDigits->GetData(Max.row, Max.col, Max.time) - fBaseline) * ongain / gain + 0.5f;
+ Float_t onlcf = fCalOnlGainROC ? fCalOnlGainROC->GetGainCorrectionFactor(Max.row,Max.col) : 1;
+ Signals[1] = (fDigits->GetData(Max.row, Max.col, Max.time) - fBaseline) /(onlcf * gain) + 0.5f;
if(Signals[1] <= fMaxThresh) return kFALSE;
if(Max.col < 1 || Max.col + 1 >= fColMax) return kFALSE;
Float_t noiseMiddleThresh = fMinMaxCutSigma*fCalNoiseDetValue*fCalNoiseROC->GetValue(Max.col, Max.row);
if (Signals[1] <= noiseMiddleThresh) return kFALSE;
- UChar_t status[3]={
+ Char_t status[3]={
fCalPadStatusROC->GetStatus(Max.col-1, Max.row)
,fCalPadStatusROC->GetStatus(Max.col, Max.row)
,fCalPadStatusROC->GetStatus(Max.col+1, Max.row)
Short_t signal(0);
if((signal = fDigits->GetData(Max.row, Max.col-1, Max.time))){
gain = fCalGainFactorDetValue * fCalGainFactorROC->GetValue(Max.col-1,Max.row);
- ongain = fCalOnGainROC ? fCalOnGainROC->GetGainCorrectionFactor(Max.row,Max.col-1) : 1;
- Signals[0] = (signal - fBaseline) * ongain / gain + 0.5f;
+ onlcf = fCalOnlGainROC ? fCalOnlGainROC->GetGainCorrectionFactor(Max.row,Max.col-1) : 1;
+ Signals[0] = (signal - fBaseline) /( onlcf * gain) + 0.5f;
} else Signals[0] = 0.;
if((signal = fDigits->GetData(Max.row, Max.col+1, Max.time))){
gain = fCalGainFactorDetValue * fCalGainFactorROC->GetValue(Max.col+1,Max.row);
- ongain = fCalOnGainROC ? fCalOnGainROC->GetGainCorrectionFactor(Max.row,Max.col+1) : 1;
- Signals[2] = (signal - fBaseline) * ongain / gain + 0.5f;
+ onlcf = fCalOnlGainROC ? fCalOnlGainROC->GetGainCorrectionFactor(Max.row,Max.col+1) : 1;
+ Signals[2] = (signal - fBaseline) /( onlcf * gain) + 0.5f;
} else Signals[2] = 0.;
if(!(status[0] | status[1] | status[2])) {//all pads are good
if (ThisMax.col >= fColMax - 3) return kFALSE;
Float_t gain;
+ Float_t onlcf;
if (ThisMax.col < fColMax - 5){
gain = fCalGainFactorDetValue * fCalGainFactorROC->GetValue(ThisMax.col+4,ThisMax.row);
- if (fDigits->GetData(ThisMax.row, ThisMax.col+4, ThisMax.time) - fBaseline >= fSigThresh * gain)
+ onlcf = fCalOnlGainROC ? fCalOnlGainROC->GetGainCorrectionFactor(ThisMax.row,ThisMax.col+4) : 1;
+ if (fDigits->GetData(ThisMax.row, ThisMax.col+4, ThisMax.time) - fBaseline >= fSigThresh * gain * onlcf)
return kFALSE;
}
if (ThisMax.col > 1) {
gain = fCalGainFactorDetValue * fCalGainFactorROC->GetValue(ThisMax.col-2,ThisMax.row);
- if (fDigits->GetData(ThisMax.row, ThisMax.col-2, ThisMax.time) - fBaseline >= fSigThresh * gain)
+ onlcf = fCalOnlGainROC ? fCalOnlGainROC->GetGainCorrectionFactor(ThisMax.row,ThisMax.col-2) : 1;
+ if (fDigits->GetData(ThisMax.row, ThisMax.col-2, ThisMax.time) - fBaseline >= fSigThresh * gain * onlcf)
return kFALSE;
}
void AliTRDclusterizer::CreateCluster(const MaxStruct &Max)
{
//
- // Creates a cluster at the given position and saves it in fRecPoints
+ // Creates a cluster at the given position and saves it in RecPoints
//
Int_t nPadCount = 1;
// Store raw signals in cluster. This MUST be called after position reconstruction !
// Xianguo Lu and Alex Bercuci 19.03.2012
if(TestBit(kRawSignal) && fDigitsRaw){
- Short_t rawSignal[7] = {0, 0, 0, fDigitsRaw->GetData(Max.row, Max.col, Max.time), 0, 0, 0};
- for(Int_t ipad(1); ipad<=3; ipad++){
- rawSignal[3 - ipad] = fDigitsRaw->GetData(Max.row, Max.col-ipad, Max.time); // Look to the left
- rawSignal[3 + ipad] = fDigitsRaw->GetData(Max.row, Max.col+ipad, Max.time); // Look to the right
+ Float_t tmp(0.), kMaxShortVal(32767.); // protect against data overflow due to wrong gain calibration
+ Short_t rawSignal[7] = {0};
+ for(Int_t ipad(Max.col-3), iRawId(0); ipad<=Max.col+3; ipad++, iRawId++){
+ if(ipad<0 || ipad>=fColMax) continue;
+ if(!fCalOnlGainROC){
+ rawSignal[iRawId] = fDigitsRaw->GetData(Max.row, ipad, Max.time);
+ continue;
+ }
+ // Deconvolute online gain calibration when available
+ // Alex Bercuci 27.04.2012
+ tmp = (fDigitsRaw->GetData(Max.row, ipad, Max.time) - fBaseline)/fCalOnlGainROC->GetGainCorrectionFactor(Max.row, ipad) + 0.5f;
+ rawSignal[iRawId] = (Short_t)TMath::Min(tmp, kMaxShortVal);
}
cluster.SetSignals(rawSignal, kTRUE);
}
// ADC signals at position 0, 1, 5 and 6
Float_t tmp(0.), kMaxShortVal(32767.); // protect against data overflow due to wrong gain calibration
- Float_t gain(1.); Short_t signal(0);
+ Float_t gain(1.); Float_t onlcf(1.); Short_t signal(0);
// Store the amplitudes of the pads in the cluster for later analysis
// and check whether one of these pads is masked in the database
signals[3]=Max.signals[1];
while((jpad = Max.col-ipad)){
if(!(signal = fDigits->GetData(Max.row, jpad, Max.time))) break; // empty digit !
gain = fCalGainFactorDetValue * fCalGainFactorROC->GetValue(jpad, Max.row);
- tmp = (signal - fBaseline) / gain + 0.5f;
+ onlcf = fCalOnlGainROC ? fCalOnlGainROC->GetGainCorrectionFactor(Max.row,jpad) : 1;
+ tmp = (signal - fBaseline) / (onlcf * gain) + 0.5f;
signal = (Short_t)TMath::Min(tmp, kMaxShortVal);
if(signal<fSigThresh) break; // signal under threshold
nPadCount++;
while((jpad = Max.col+ipad)<fColMax){
if(!(signal = fDigits->GetData(Max.row, jpad, Max.time))) break; // empty digit !
gain = fCalGainFactorDetValue * fCalGainFactorROC->GetValue(jpad, Max.row);
- tmp = (signal - fBaseline) / gain + 0.5f;
+ onlcf = fCalOnlGainROC ? fCalOnlGainROC->GetGainCorrectionFactor(Max.row,jpad) : 1;
+ tmp = (signal - fBaseline) / (onlcf * gain) + 0.5f;
signal = (Short_t)TMath::Min(tmp, kMaxShortVal);
if(signal<fSigThresh) break; // signal under threshold
nPadCount++;
for (int k = 0; k < 2; k++) {
correction += reminder[k] = rates[k] * (reminder[k] + coefficients[k] * result);
}
-
- }
-
-}
-
-//_____________________________________________________________________________
-void AliTRDclusterizer::ResetRecPoints()
-{
- //
- // Resets the list of rec points
- //
-
- if (fRecPoints) {
- fRecPoints->Clear();
- fNoOfClusters = 0;
- // delete fRecPoints;
}
}
// Returns the list of rec points
//
- if (!fRecPoints) {
- if(!(fRecPoints = AliTRDReconstructor::GetClusters())){
- // determine number of clusters which has to be allocated
- Float_t nclusters = fReconstructor->GetRecoParam()->GetNClusters();
-
- fRecPoints = new TClonesArray("AliTRDcluster", Int_t(nclusters));
- }
- //SetClustersOwner(kTRUE);
- AliTRDReconstructor::SetClusters(0x0);
- }
+ fRecPoints = AliTRDReconstructor::GetClusters();
+ if (!fRecPoints) AliError("Missing cluster array");
return fRecPoints;
-
}
//_____________________________________________________________________________
//
// Returns the array of on-line tracklets
//
-
- if (trkltype.Length() != 0) {
- if (!fTracklets) {
- fTracklets = new TClonesArray(trkltype, 200);
- }
- else if (TClass::GetClass(trkltype.Data()) != fTracklets->GetClass()){
- fTracklets->Delete();
- delete fTracklets;
- fTracklets = new TClonesArray(trkltype, 200);
- }
- }
+ fTracklets = AliTRDReconstructor::GetTracklets(trkltype.Data());
+ if (!fTracklets) AliError("Missing online tracklets array");
return fTracklets;
}
{
// return array of GTU tracks (create TClonesArray if necessary)
- if (!fTracks) {
- fTracks = new TClonesArray("AliESDTrdTrack",100);
- }
+ fTracks = AliTRDReconstructor::GetTracks();
+ if (!fTracks) AliError("Missing online tracks array");
return fTracks;
}