///////////////////////////////////////////////////////////////////////////////
#include <TFile.h>
+#include <TObjString.h>
+#include <TObjArray.h>
#include "AliRunLoader.h"
#include "AliRawReader.h"
ClassImp(AliTRDReconstructor)
+
//_____________________________________________________________________________
-AliTRDReconstructor::~AliTRDReconstructor() {
+AliTRDReconstructor::AliTRDReconstructor()
+ :AliReconstructor()
+ ,fSteerParam(0x00000007)
+{
+ memset(fStreamLevel, 0, 5*sizeof(UChar_t));
+ // Xe tail cancellation parameters
+ fTCParams[0] = 1.156; // r1
+ fTCParams[1] = 0.130; // r2
+ fTCParams[2] = 0.114; // c1
+ fTCParams[3] = 0.624; // c2
+ // Ar tail cancellation parameters
+ fTCParams[4] = 1.156; // r1
+ fTCParams[5] = 0.130; // r2
+ fTCParams[6] = 0.114; // c1
+ fTCParams[7] = 0.624; // c2
}
+//_____________________________________________________________________________
+AliTRDReconstructor::AliTRDReconstructor(const AliTRDReconstructor &r)
+ :AliReconstructor(r)
+ ,fSteerParam(0x00000007)
+{
+ memcpy(fStreamLevel, r.fStreamLevel, 5*sizeof(UChar_t));
+ memcpy(fTCParams, r.fTCParams, 8*sizeof(Double_t));
+}
//_____________________________________________________________________________
// New (fast) cluster finder
AliTRDclusterizer clusterer("clusterer","TRD clusterizer");
+ clusterer.SetReconstructor(this);
clusterer.OpenOutput(clusterTree);
clusterer.SetAddLabels(kFALSE);
clusterer.Raw2ClustersChamber(rawReader);
AliInfo("Reconstruct TRD clusters from Digits [Digit TTree -> Cluster TTree]");
AliTRDclusterizer clusterer("clusterer","TRD clusterizer");
+ clusterer.SetReconstructor(this);
clusterer.OpenOutput(clusterTree);
clusterer.ReadDigits(digitsTree);
clusterer.MakeClusters();
//
//return new AliTRDtracker(NULL);
-
- return new AliTRDtrackerV1();
+ AliTRDtrackerV1 *tracker = new AliTRDtrackerV1();
+ tracker->SetReconstructor(this);
+ return tracker;
}
//
}
+
+
+//_____________________________________________________________________________
+void AliTRDReconstructor::SetOption(Option_t *opt)
+{
+// Read option string into the steer param.
+//
+// Default steer param values
+//
+// write clusters [cw] = true
+// track seeding (stand alone tracking) [sa] = true
+// PID method in reconstruction (NN) [nn] = true
+// write online tracklets [tw] = false
+// drift gas [ar] = false
+//
+ fSteerParam = 0x00000007;
+
+ TString s(opt);
+ TObjArray *opar = s.Tokenize(",");
+ for(Int_t ipar=0; ipar<opar->GetEntriesFast(); ipar++){
+ TString sopt(((TObjString*)(*opar)[ipar])->String());
+ if(sopt.Contains("!cw")){
+ fSteerParam &= ~kWriteClusters;
+ continue;
+ } else if(sopt.Contains("!sa")){
+ fSteerParam &= ~kSeeding;
+ continue;
+ } else if(sopt.Contains("!nn")){
+ fSteerParam &= ~kSteerPID;
+ continue;
+ } else if(sopt.Contains("tw")){
+ fSteerParam |= kWriteTracklets;
+ continue;
+ } else if(sopt.Contains("ar")){
+ fSteerParam |= kDriftGas;
+ continue;
+ }
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
#include "AliReconstructor.h"
-
-class AliRawReader;
-
#include "AliDetectorRecoParam.h"
#include "AliTRDrecoParam.h"
+class AliRawReader;
class AliTRDReconstructor: public AliReconstructor
{
+public:
+ enum AliTRDsteerParam {
+ kWriteClusters = BIT(0)
+ ,kSeeding = BIT(1)
+ ,kSteerPID = BIT(2)
+ ,kWriteTracklets = BIT(3)
+ ,kDriftGas = BIT(4)
+ };
+ enum AliTRDReconstructorTask {
+ kClusterizer = 0
+ ,kTracker = 1
+ ,kPID = 2
+ };
+ enum AliTRDpidMethod {
+ kLQPID = 0,
+ kNNPID = 1
+ };
+ enum AliTRDdriftGas {
+ kXe = 0,
+ kAr = 1
+ };
- public:
+ AliTRDReconstructor();
+ AliTRDReconstructor(const AliTRDReconstructor &r);
+ virtual ~AliTRDReconstructor() {;}
+ AliTRDReconstructor& operator = (const AliTRDReconstructor&) { return *this;}
- AliTRDReconstructor():AliReconstructor() { };
- AliTRDReconstructor(const AliTRDReconstructor &r):AliReconstructor(r) { };
- virtual ~AliTRDReconstructor();
- AliTRDReconstructor& operator = (const AliTRDReconstructor& /*r*/)
- { return *this; };
+ virtual void ConvertDigits(AliRawReader *rawReader, TTree *digitsTree) const;
+ virtual AliTracker* CreateTracker() const;
- virtual Bool_t HasDigitConversion() const { return kFALSE; };
- virtual void ConvertDigits(AliRawReader *rawReader, TTree *digitsTree) const;
+ virtual void FillESD(AliRawReader *, TTree *clusterTree, AliESDEvent *esd) const { FillESD((TTree * )NULL, clusterTree, esd); }
+ virtual void FillESD(TTree *digitsTree, TTree *clusterTree, AliESDEvent *esd) const;
+ Int_t GetNdEdxSlices() const { return GetPIDMethod() == kNNPID ? kNNslices : kLQslices;}
+ AliTRDdriftGas GetDriftGas() const { return fSteerParam&kDriftGas ? kAr : kXe;}
+ AliTRDpidMethod GetPIDMethod() const { return fSteerParam&kSteerPID ? kNNPID : kLQPID;}
+ static const AliTRDrecoParam* GetRecoParam() { return dynamic_cast<const AliTRDrecoParam*>(AliReconstructor::GetRecoParam(2)); }
+ Int_t GetStreamLevel(AliTRDReconstructorTask task) const { return fStreamLevel[task];}
+ inline void GetTCParams(Double_t *par) const;
+ virtual Bool_t HasDigitConversion() const { return kFALSE; };
+ Bool_t IsWritingClusters() const { return fSteerParam&kWriteClusters;}
+ Bool_t IsWritingTracklets() const { return fSteerParam&kWriteTracklets;}
+ Bool_t IsSeeding() const { return fSteerParam&kSeeding;}
- virtual void Reconstruct(AliRawReader *rawReader, TTree *clusterTree) const;
- virtual void Reconstruct(TTree *digitsTree, TTree *clusterTree) const;
- virtual AliTracker *CreateTracker() const;
+ virtual void Reconstruct(AliRawReader *rawReader, TTree *clusterTree) const;
+ virtual void Reconstruct(TTree *digitsTree, TTree *clusterTree) const;
- virtual void FillESD(AliRawReader */*rawReader*/, TTree *clusterTree, AliESDEvent *esd) const
- { FillESD((TTree * )NULL
- , clusterTree
- , esd); }
- virtual void FillESD(TTree *digitsTree, TTree *clusterTree, AliESDEvent *esd) const;
+ void SetOption(Option_t *opt);
+ inline void SetTCParams(Double_t *par);
+ void SetStreamLevel(Int_t level, AliTRDReconstructorTask task= kTracker) {fStreamLevel[(Int_t)task] = level;}
- static const AliTRDrecoParam* GetRecoParam() { return dynamic_cast<const AliTRDrecoParam*>(AliReconstructor::GetRecoParam(2)); }
+private:
+ enum{
+ kNNslices = 8
+ ,kLQslices = 3
+ };
+ UChar_t fStreamLevel[5]; // stream level for each reconstruction task
+ UInt_t fSteerParam; // steering flags
+ Double_t fTCParams[8]; // Tail Cancellation parameters for drift gases
+
- ClassDef(AliTRDReconstructor,0) // Class for the TRD reconstruction
+ ClassDef(AliTRDReconstructor, 1) // Class for the TRD reconstruction
};
+//___________________________________________________
+inline void AliTRDReconstructor::GetTCParams(Double_t *par) const
+{
+ if(!par) return;
+ if(GetDriftGas()==kAr) memcpy(par, &fTCParams[4], 4*sizeof(Double_t));
+ else memcpy(par, &fTCParams[0], 4*sizeof(Double_t));
+}
+
+//___________________________________________________
+inline void AliTRDReconstructor::SetTCParams(Double_t *par)
+{
+ if(!par) return;
+ memcpy(fTCParams, par, 8*sizeof(Double_t));
+}
+
#endif
}
//_____________________________________________________________________________
-const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDrecoParam::AliTRDpidMethod method)
+const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDReconstructor::AliTRDpidMethod method)
{
//
// Returns the object storing the distributions for PID with likelihood
//
switch(method) {
- case AliTRDrecoParam::kLQPID:
+ case AliTRDReconstructor::kLQPID:
return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDLQ));
- case AliTRDrecoParam::kNNPID:
+ case AliTRDReconstructor::kNNPID:
return dynamic_cast<const AliTRDCalPID *>(GetCachedCDBObject(kIDPIDNN));
}
#include "TObject.h"
#endif
-#ifndef ALITRDRECOPARAM_H
-#include "AliTRDrecoParam.h"
+#ifndef ALITRDRECONSTRUCTOR_H
+#include "AliTRDReconstructor.h"
#endif
class AliCDBEntry;
class AliTRDCalROC;
class AliTRDCalDet;
class AliTRDCalSingleChamberStatus;
-
class AliTRDcalibDB : public TObject {
public:
Bool_t IsChamberMasked(Int_t det);
const AliTRDCalMonitoring *GetMonitoringObject();
- const AliTRDCalPID *GetPIDObject(AliTRDrecoParam::AliTRDpidMethod method);
+ const AliTRDCalPID *GetPIDObject(AliTRDReconstructor::AliTRDpidMethod method);
// Related functions, these depend on calibration data
static Float_t GetOmegaTau(Float_t vdrift, Float_t bz);
/**************************************************************************\r
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * *\r
- * Author: The ALICE Off-line Project. *\r
- * Contributors are mentioned in the code where appropriate. *\r
- * *\r
- * Permission to use, copy, modify and distribute this software and its *\r
- * documentation strictly for non-commercial purposes is hereby granted *\r
- * without fee, provided that the above copyright notice appears in all *\r
- * copies and that both the copyright notice and this permission notice *\r
- * appear in the supporting documentation. The authors make no claims *\r
- * about the suitability of this software for any purpose. It is *\r
- * provided "as is" without express or implied warranty. *\r
- **************************************************************************/\r
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
+* *\r
+* Author: The ALICE Off-line Project. *\r
+* Contributors are mentioned in the code where appropriate. *\r
+* *\r
+* Permission to use, copy, modify and distribute this software and its *\r
+* documentation strictly for non-commercial purposes is hereby granted *\r
+* without fee, provided that the above copyright notice appears in all *\r
+* copies and that both the copyright notice and this permission notice *\r
+* appear in the supporting documentation. The authors make no claims *\r
+* about the suitability of this software for any purpose. It is *\r
+* provided "as is" without express or implied warranty. *\r
+**************************************************************************/\r
\r
/* $Id: AliTRDchamberTimeBin.cxx 23313 2008-01-11 14:56:43Z cblume $ */\r
\r
//_____________________________________________________________________________\r
AliTRDchamberTimeBin::AliTRDchamberTimeBin(Int_t plane, Int_t stack, Int_t sector, Double_t z0, Double_t zLength)\r
:TObject()\r
+ ,fReconstructor(0x0)\r
,fOwner(kFALSE)\r
,fPlane(plane)\r
,fStack(stack)\r
// Default constructor (Only provided to use AliTRDchamberTimeBin with arrays)\r
//\r
\r
- for(int i=0; i<kMaxRows; i++) fPositions[i] = 0xff;\r
- for(int ic=0; ic<kMaxClustersLayer; ic++){\r
- fClusters[ic] = 0x0;\r
- fIndex[ic] = 0xffff;\r
- }\r
+ for(int i=0; i<kMaxRows; i++) fPositions[i] = 0xff;\r
+ for(int ic=0; ic<kMaxClustersLayer; ic++){\r
+ fClusters[ic] = 0x0;\r
+ fIndex[ic] = 0xffff;\r
+ }\r
}\r
\r
// //_____________________________________________________________________________\r
\r
//_____________________________________________________________________________\r
AliTRDchamberTimeBin::AliTRDchamberTimeBin(const AliTRDchamberTimeBin &layer):\r
- TObject()\r
- ,fOwner(layer.fOwner)\r
+ TObject()\r
+ ,fReconstructor(layer.fReconstructor)\r
+ ,fOwner(layer.fOwner)\r
,fPlane(layer.fPlane)\r
,fStack(layer.fStack)\r
,fSector(layer.fSector)\r
- ,fNRows(layer.fNRows)\r
+ ,fNRows(layer.fNRows)\r
,fN(layer.fN)\r
,fX(layer.fX)\r
- ,fZ0(layer.fZ0)\r
- ,fZLength(layer.fZLength)\r
+ ,fZ0(layer.fZ0)\r
+ ,fZLength(layer.fZLength)\r
{\r
// Copy Constructor (performs a deep copy)\r
- \r
- SetT0(layer.IsT0());\r
- for(int i=0; i<kMaxRows; i++) fPositions[i] = layer.fPositions[i];\r
- memcpy(&fClusters[0], &layer.fClusters[0], kMaxClustersLayer*sizeof(UChar_t));\r
- memcpy(&fIndex[0], &layer.fIndex[0], kMaxClustersLayer*sizeof(UInt_t));\r
+ \r
+ SetT0(layer.IsT0());\r
+ for(int i=0; i<kMaxRows; i++) fPositions[i] = layer.fPositions[i];\r
+ memcpy(&fClusters[0], &layer.fClusters[0], kMaxClustersLayer*sizeof(UChar_t));\r
+ memcpy(&fIndex[0], &layer.fIndex[0], kMaxClustersLayer*sizeof(UInt_t));\r
\r
\r
// BuildIndices();\r
{\r
// Assignment operator\r
\r
- if (this != &layer) layer.Copy(*this);\r
+ if (this != &layer) layer.Copy(*this);\r
return *this;\r
}\r
\r
//_____________________________________________________________________________\r
void AliTRDchamberTimeBin::Clear(const Option_t *) \r
{ \r
- for (Int_t i = 0; i < fN; i++){ \r
+ for (Int_t i = 0; i < fN; i++){ \r
if(!fClusters[i]) continue;\r
if(fOwner) delete fClusters[i];\r
fClusters[i] = NULL;\r
}\r
- fN = 0; \r
+ fN = 0; \r
}\r
\r
//_____________________________________________________________________________\r
void AliTRDchamberTimeBin::Copy(TObject &o) const\r
{\r
// Copy method. Performs a deep copy of all data from this object to object o.\r
- \r
- AliTRDchamberTimeBin &layer = (AliTRDchamberTimeBin &)o;\r
- layer.fOwner = kFALSE;\r
- layer.fPlane = fPlane;\r
- layer.fStack = fStack;\r
- layer.fSector = fSector;\r
- layer.fNRows = fNRows;\r
- layer.fN = fN;\r
- layer.fX = fX;\r
- layer.fZ0 = fZ0;\r
- layer.fZLength = fZLength;\r
- layer.SetT0(IsT0());\r
- \r
- for(int i = 0; i < kMaxRows; i++) layer.fPositions[i] = 0;\r
- \r
- for(int i=0; i<kMaxRows; i++) layer.fPositions[i] = fPositions[i];\r
- memcpy(&layer.fClusters[0], &fClusters[0], kMaxClustersLayer*sizeof(UChar_t));\r
- memcpy(&layer.fIndex[0], &fIndex[0], kMaxClustersLayer*sizeof(UInt_t));\r
- \r
- TObject::Copy(layer); // copies everything into layer\r
- \r
+ \r
+ AliTRDchamberTimeBin &layer = (AliTRDchamberTimeBin &)o;\r
+ layer.fReconstructor = fReconstructor;\r
+ layer.fOwner = kFALSE;\r
+ layer.fPlane = fPlane;\r
+ layer.fStack = fStack;\r
+ layer.fSector = fSector;\r
+ layer.fNRows = fNRows;\r
+ layer.fN = fN;\r
+ layer.fX = fX;\r
+ layer.fZ0 = fZ0;\r
+ layer.fZLength = fZLength;\r
+ layer.SetT0(IsT0());\r
+ \r
+ for(int i = 0; i < kMaxRows; i++) layer.fPositions[i] = 0;\r
+ \r
+ for(int i=0; i<kMaxRows; i++) layer.fPositions[i] = fPositions[i];\r
+ memcpy(&layer.fClusters[0], &fClusters[0], kMaxClustersLayer*sizeof(UChar_t));\r
+ memcpy(&layer.fIndex[0], &fIndex[0], kMaxClustersLayer*sizeof(UInt_t));\r
+ \r
+ TObject::Copy(layer); // copies everything into layer\r
+ \r
// layer.BuildIndices();\r
}\r
\r
AliTRDchamberTimeBin::~AliTRDchamberTimeBin()\r
{\r
// Destructor\r
- if(fOwner) for(int ic=0; ic<fN; ic++) delete fClusters[ic];\r
+ if(fOwner) for(int ic=0; ic<fN; ic++) delete fClusters[ic];\r
}\r
\r
//_____________________________________________________________________________\r
// z0 : starting position of layer in the z direction\r
// zLength : length of layer in the z direction \r
\r
- fZ0 = (z0 <= z0 + zLength) ? z0 : z0 + zLength;\r
- fZLength = TMath::Abs(zLength);\r
+ fZ0 = (z0 <= z0 + zLength) ? z0 : z0 + zLength;\r
+ fZLength = TMath::Abs(zLength);\r
}\r
\r
//_____________________________________________________________________________\r
// Sorting algorithm: TreeSearch\r
//\r
\r
- if(!fN) return;\r
-\r
- // Select clusters that belong to the Stack\r
- Int_t nClStack = 0; // Internal counter\r
- for(Int_t i = 0; i < fN; i++){\r
- if(fClusters[i]->IsUsed()){\r
- fClusters[i] = 0x0;\r
- fIndex[i] = 0xffff;\r
- } else nClStack++;\r
- }\r
- if(nClStack > kMaxClustersLayer) AliWarning(Form("Number of clusters in stack %d exceed buffer size %d. Truncating.", nClStack, kMaxClustersLayer));\r
- \r
- // Nothing in this time bin. Reset indexes \r
- if(!nClStack){\r
- fN = 0;\r
- memset(&fPositions[0], 0xff, sizeof(UChar_t) * kMaxRows);\r
- memset(&fClusters[0], 0x0, sizeof(AliTRDcluster*) * kMaxClustersLayer);\r
- memset(&fIndex[0], 0xffff, sizeof(UInt_t) * kMaxClustersLayer);\r
- return;\r
- }\r
- \r
- // Make a copy\r
- AliTRDcluster *helpCL[kMaxClustersLayer];\r
- Int_t helpInd[kMaxClustersLayer];\r
- nClStack = 0;\r
- for(Int_t i = 0; i < TMath::Min(fN, kMaxClustersLayer); i++){\r
- if(!fClusters[i]) continue;\r
- helpCL[nClStack] = fClusters[i];\r
- helpInd[nClStack] = fIndex[i];\r
- fClusters[i] = 0x0;\r
- fIndex[i] = 0xffff;\r
- nClStack++;\r
- }\r
- \r
- // do clusters arrangement\r
- fX = 0.;\r
- fN = nClStack;\r
- nClStack = 0;\r
- // Reset Positions array\r
- memset(fPositions, 0, sizeof(UChar_t)*kMaxRows);\r
- for(Int_t i = 0; i < fN; i++){\r
- // boundary check\r
- AliTRDcluster *cl = helpCL[i];\r
- UChar_t rowIndex = cl->GetPadRow();\r
- // Insert Leaf\r
- Int_t pos = FindYPosition(cl->GetY(), rowIndex, i);\r
- if(pos == -1){ // zbin is empty;\r
- Int_t upper = (rowIndex == fNRows - 1) ? nClStack : fPositions[rowIndex + 1];\r
- memmove(fClusters + upper + 1, fClusters + upper, (sizeof(AliTRDcluster *))*(nClStack-upper));\r
- memmove(fIndex + upper + 1, fIndex + upper, (sizeof(UInt_t))*(nClStack-upper));\r
- fClusters[upper] = cl;\r
- fIndex[upper] = helpInd[i]; \r
- // Move All pointer one position back\r
- for(UChar_t j = rowIndex + 1; j < fNRows; j++) fPositions[j]++;\r
- nClStack++;\r
- } else { // zbin not empty\r
- memmove(fClusters + pos + 2, fClusters + pos+1, (sizeof(AliTRDcluster *))*(nClStack-(pos+1)));\r
- memmove(fIndex + pos + 2, fIndex + pos+1, (sizeof(UInt_t))*(nClStack-(pos+1)));\r
- fClusters[pos + 1] = cl; //fIndex[i];\r
- fIndex[pos + 1] = helpInd[i];\r
- // Move All pointer one position back\r
- for(UChar_t j = rowIndex + 1; j < fNRows; j++) fPositions[j]++; \r
- nClStack++;\r
- }\r
-\r
- // calculate mean x\r
- fX += cl->GetX(); \r
- \r
- // Debug Streaming\r
- if(AliTRDtrackerV1::DebugStreamer() && AliTRDReconstructor::GetRecoParam()->GetStreamLevel() >= 3){\r
- TTreeSRedirector &cstream = *AliTRDtrackerV1::DebugStreamer();\r
- cstream << "BuildIndices"\r
- << "Plane=" << fPlane\r
- << "Stack=" << fStack\r
- << "Sector=" << fSector\r
- << "Iter=" << iter\r
- << "C.=" << cl\r
- << "rowIndex=" << rowIndex\r
- << "\n";\r
- }\r
- }\r
+ if(!fN) return;\r
+\r
+ // Select clusters that belong to the Stack\r
+ Int_t nClStack = 0; // Internal counter\r
+ for(Int_t i = 0; i < fN; i++){\r
+ if(fClusters[i]->IsUsed()){\r
+ fClusters[i] = 0x0;\r
+ fIndex[i] = 0xffff;\r
+ } else nClStack++;\r
+ }\r
+ if(nClStack > kMaxClustersLayer) AliWarning(Form("Number of clusters in stack %d exceed buffer size %d. Truncating.", nClStack, kMaxClustersLayer));\r
+ \r
+ // Nothing in this time bin. Reset indexes \r
+ if(!nClStack){\r
+ fN = 0;\r
+ memset(&fPositions[0], 0xff, sizeof(UChar_t) * kMaxRows);\r
+ memset(&fClusters[0], 0x0, sizeof(AliTRDcluster*) * kMaxClustersLayer);\r
+ memset(&fIndex[0], 0xffff, sizeof(UInt_t) * kMaxClustersLayer);\r
+ return;\r
+ }\r
+ \r
+ // Make a copy\r
+ AliTRDcluster *helpCL[kMaxClustersLayer];\r
+ Int_t helpInd[kMaxClustersLayer];\r
+ nClStack = 0;\r
+ for(Int_t i = 0; i < TMath::Min(fN, kMaxClustersLayer); i++){\r
+ if(!fClusters[i]) continue;\r
+ helpCL[nClStack] = fClusters[i];\r
+ helpInd[nClStack] = fIndex[i];\r
+ fClusters[i] = 0x0;\r
+ fIndex[i] = 0xffff;\r
+ nClStack++;\r
+ }\r
+ \r
+ // do clusters arrangement\r
+ fX = 0.;\r
+ fN = nClStack;\r
+ nClStack = 0;\r
+ // Reset Positions array\r
+ memset(fPositions, 0, sizeof(UChar_t)*kMaxRows);\r
+ for(Int_t i = 0; i < fN; i++){\r
+ // boundary check\r
+ AliTRDcluster *cl = helpCL[i];\r
+ UChar_t rowIndex = cl->GetPadRow();\r
+ // Insert Leaf\r
+ Int_t pos = FindYPosition(cl->GetY(), rowIndex, i);\r
+ if(pos == -1){ // zbin is empty;\r
+ Int_t upper = (rowIndex == fNRows - 1) ? nClStack : fPositions[rowIndex + 1];\r
+ memmove(fClusters + upper + 1, fClusters + upper, (sizeof(AliTRDcluster *))*(nClStack-upper));\r
+ memmove(fIndex + upper + 1, fIndex + upper, (sizeof(UInt_t))*(nClStack-upper));\r
+ fClusters[upper] = cl;\r
+ fIndex[upper] = helpInd[i]; \r
+ // Move All pointer one position back\r
+ for(UChar_t j = rowIndex + 1; j < fNRows; j++) fPositions[j]++;\r
+ nClStack++;\r
+ } else { // zbin not empty\r
+ memmove(fClusters + pos + 2, fClusters + pos+1, (sizeof(AliTRDcluster *))*(nClStack-(pos+1)));\r
+ memmove(fIndex + pos + 2, fIndex + pos+1, (sizeof(UInt_t))*(nClStack-(pos+1)));\r
+ fClusters[pos + 1] = cl; //fIndex[i];\r
+ fIndex[pos + 1] = helpInd[i];\r
+ // Move All pointer one position back\r
+ for(UChar_t j = rowIndex + 1; j < fNRows; j++) fPositions[j]++; \r
+ nClStack++;\r
+ }\r
+\r
+ // calculate mean x\r
+ fX += cl->GetX(); \r
+ \r
+ // Debug Streaming\r
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) >= 3){\r
+ TTreeSRedirector &cstream = *AliTRDtrackerV1::DebugStreamer();\r
+ cstream << "BuildIndices"\r
+ << "Plane=" << fPlane\r
+ << "Stack=" << fStack\r
+ << "Sector=" << fSector\r
+ << "Iter=" << iter\r
+ << "C.=" << cl\r
+ << "rowIndex=" << rowIndex\r
+ << "\n";\r
+ }\r
+ }\r
\r
// AliInfo("Positions");\r
// for(int ir=0; ir<fNRows; ir++) printf("pos[%d] %d\n", ir, fPositions[ir]);\r
\r
- fX /= fN;\r
+ fX /= fN;\r
}\r
\r
//_____________________________________________________________________________\r
// Index of the nearest left cluster in the StackLayer indexing (-1 if no clusters are found)\r
//\r
\r
- Int_t start = fPositions[z]; // starting Position of the bin\r
- Int_t upper = (Int_t)((z != fNRows - 1) ? fPositions[z+1] : nClusters); // ending Position of the bin \r
- Int_t end = upper - 1; // ending Position of the bin \r
- if(end < start) return -1; // Bin is empty\r
- Int_t middle = static_cast<Int_t>((start + end)/2);\r
- // 1st Part: climb down the tree: get the next cluster BEFORE ypos\r
- while(start + 1 < end){\r
- if(y >= fClusters[middle]->GetY()) start = middle;\r
- else end = middle;\r
- middle = static_cast<Int_t>((start + end)/2);\r
- }\r
- if(y > fClusters[end]->GetY()) return end;\r
- return start;\r
+ Int_t start = fPositions[z]; // starting Position of the bin\r
+ Int_t upper = (Int_t)((z != fNRows - 1) ? fPositions[z+1] : nClusters); // ending Position of the bin \r
+ Int_t end = upper - 1; // ending Position of the bin \r
+ if(end < start) return -1; // Bin is empty\r
+ Int_t middle = static_cast<Int_t>((start + end)/2);\r
+ // 1st Part: climb down the tree: get the next cluster BEFORE ypos\r
+ while(start + 1 < end){\r
+ if(y >= fClusters[middle]->GetY()) start = middle;\r
+ else end = middle;\r
+ middle = static_cast<Int_t>((start + end)/2);\r
+ }\r
+ if(y > fClusters[end]->GetY()) return end;\r
+ return start;\r
}\r
\r
//_____________________________________________________________________________\r
// Index of the nearest cluster in the StackLayer indexing (-1 if no clusters are found)\r
//\r
\r
- Int_t position = FindYPosition(y, z, fN);\r
- if(position == -1) return position; // bin empty\r
- // FindYPosition always returns the left Neighbor. We don't know if the left or the right Neighbor is nearest\r
- // to the Reference y-position, so test both\r
- Int_t upper = (Int_t)((z < fNRows-1) ? fPositions[z+1] : fN); // ending Position of the bin\r
- if((position + 1) < (upper)){\r
- if(TMath::Abs(y - fClusters[position + 1]->GetY()) < TMath::Abs(y - fClusters[position]->GetY())) return position + 1;\r
- else return position;\r
- }\r
- return position;\r
+ Int_t position = FindYPosition(y, z, fN);\r
+ if(position == -1) return position; // bin empty\r
+ // FindYPosition always returns the left Neighbor. We don't know if the left or the right Neighbor is nearest\r
+ // to the Reference y-position, so test both\r
+ Int_t upper = (Int_t)((z < fNRows-1) ? fPositions[z+1] : fN); // ending Position of the bin\r
+ if((position + 1) < (upper)){\r
+ if(TMath::Abs(y - fClusters[position + 1]->GetY()) < TMath::Abs(y - fClusters[position]->GetY())) return position + 1;\r
+ else return position;\r
+ }\r
+ return position;\r
}\r
\r
//_____________________________________________________________________________\r
// 2. For each z bin find nearest y cluster.\r
// 3. Select best candidate\r
//\r
- Int_t index = -1;\r
- // initial minimal distance will be represented as ellipse: semi-major = z-direction\r
- // later 2-Norm will be used \r
+ Int_t index = -1;\r
+ // initial minimal distance will be represented as ellipse: semi-major = z-direction\r
+ // later 2-Norm will be used \r
// Float_t nExcentricity = TMath::Sqrt(maxroadz*maxroadz - maxroad*maxroad)/maxroadz;\r
- Float_t mindist = maxroadz;\r
- \r
- // not very nice but unfortunately neccessarry: we have ho check the neighbors in both directions (+ and -) too. How \r
- // much neighbors depends on the Quotient maxroadz/fZLength \r
- UChar_t maxRows = 3;\r
- UChar_t zpos[kMaxRows];\r
+ Float_t mindist = maxroadz;\r
+ \r
+ // not very nice but unfortunately neccessarry: we have ho check the neighbors in both directions (+ and -) too. How \r
+ // much neighbors depends on the Quotient maxroadz/fZLength \r
+ UChar_t maxRows = 3;\r
+ UChar_t zpos[kMaxRows];\r
// Float_t mindist = TMath::Sqrt(maxroad*maxroad + maxroadz*maxroadz);\r
// UChar_t myZbin = FindTreePosition(z, fZ0 + fZLength/2, fZLength/4, 8, 8, kFALSE);\r
- UChar_t myZbin = fNRows - 1 - (UChar_t)(TMath::Abs(fZ0 - z)/fZLength * fNRows);\r
- if(z < fZ0) myZbin = fNRows - 1;\r
- if(z > fZ0 + fZLength) myZbin = 0;\r
- //printf("\n%f < %f < %f [%d]\n", fZ0, z, fZ0 + fZLength, myZbin);\r
- //for(int ic=0; ic<fN; ic++) printf("%d z = %f row %d\n", ic, fClusters[ic]->GetZ(), fClusters[ic]->GetPadRow());\r
-\r
- UChar_t nNeighbors = 0;\r
- for(UChar_t i = 0; i < maxRows; i++){\r
- if((myZbin - 1 + i) < 0) continue;\r
- if((myZbin - 1 + i) > fNRows - 1) break;\r
- zpos[nNeighbors] = myZbin - 1 + i;\r
- nNeighbors++;\r
- }\r
- Float_t ycl = 0, zcl = 0;\r
- for(UChar_t neighbor = 0; neighbor < nNeighbors; neighbor++){ // Always test the neighbors too\r
- Int_t pos = FindNearestYCluster(y, zpos[neighbor]);\r
- if(pos == -1) continue; // No cluster in bin\r
- AliTRDcluster *c = (AliTRDcluster *) (fClusters[pos]);\r
- if(c->IsUsed()) continue; // we are only interested in unused clusters\r
- ycl = c->GetY();\r
- // Too far away in y-direction (Prearrangement)\r
- if (TMath::Abs(ycl - y) > maxroady){ \r
- //printf("y[%f] ycl[%f] roady[%f]\n", y, ycl, maxroady);\r
- continue;\r
- }\r
- zcl = c->GetZ();\r
- // Too far away in z-Direction\r
- // (Prearrangement since we have not so many bins to test)\r
- if (TMath::Abs(zcl - z) > maxroadz) continue;\r
- \r
- Float_t dist; // distance defined as 2-Norm \r
- // if we havent found a Particle that is in the ellipse around (y,z) with maxroad as semi-minor and\r
- // maxroadz as semi-major, we take the radius of the ellipse concerning the cluster as mindist, later we \r
- // take the 2-Norm when we found a cluster inside the ellipse (The value 10000 is taken because it is surely\r
- // large enough to be usable as an indicator whether we have found a nearer cluster or not)\r
+ UChar_t myZbin = fNRows - 1 - (UChar_t)(TMath::Abs(fZ0 - z)/fZLength * fNRows);\r
+ if(z < fZ0) myZbin = fNRows - 1;\r
+ if(z > fZ0 + fZLength) myZbin = 0;\r
+ //printf("\n%f < %f < %f [%d]\n", fZ0, z, fZ0 + fZLength, myZbin);\r
+ //for(int ic=0; ic<fN; ic++) printf("%d z = %f row %d\n", ic, fClusters[ic]->GetZ(), fClusters[ic]->GetPadRow());\r
+\r
+ UChar_t nNeighbors = 0;\r
+ for(UChar_t i = 0; i < maxRows; i++){\r
+ if((myZbin - 1 + i) < 0) continue;\r
+ if((myZbin - 1 + i) > fNRows - 1) break;\r
+ zpos[nNeighbors] = myZbin - 1 + i;\r
+ nNeighbors++;\r
+ }\r
+ Float_t ycl = 0, zcl = 0;\r
+ for(UChar_t neighbor = 0; neighbor < nNeighbors; neighbor++){ // Always test the neighbors too\r
+ Int_t pos = FindNearestYCluster(y, zpos[neighbor]);\r
+ if(pos == -1) continue; // No cluster in bin\r
+ AliTRDcluster *c = (AliTRDcluster *) (fClusters[pos]);\r
+ if(c->IsUsed()) continue; // we are only interested in unused clusters\r
+ ycl = c->GetY();\r
+ // Too far away in y-direction (Prearrangement)\r
+ if (TMath::Abs(ycl - y) > maxroady){ \r
+ //printf("y[%f] ycl[%f] roady[%f]\n", y, ycl, maxroady);\r
+ continue;\r
+ }\r
+ zcl = c->GetZ();\r
+ // Too far away in z-Direction\r
+ // (Prearrangement since we have not so many bins to test)\r
+ if (TMath::Abs(zcl - z) > maxroadz) continue;\r
+ \r
+ Float_t dist; // distance defined as 2-Norm \r
+ // if we havent found a Particle that is in the ellipse around (y,z) with maxroad as semi-minor and\r
+ // maxroadz as semi-major, we take the radius of the ellipse concerning the cluster as mindist, later we \r
+ // take the 2-Norm when we found a cluster inside the ellipse (The value 10000 is taken because it is surely\r
+ // large enough to be usable as an indicator whether we have found a nearer cluster or not)\r
// if(mindist > 10000.){\r
// Float_t phi = ((zcl - z) == 0) ? TMath::Pi()/2 : TMath::ATan((ycl - y)/(zcl - z));\r
// mindist = maxroad/TMath::Sqrt(1 - nExcentricity*nExcentricity * (TMath::Cos(phi))*(TMath::Cos(phi)));\r
// }\r
- dist = TMath::Max(TMath::Abs(y-ycl),TMath::Abs(z-zcl)); // infinity Norm\r
+ dist = TMath::Max(TMath::Abs(y-ycl),TMath::Abs(z-zcl)); // infinity Norm\r
// dist = TMath::Sqrt((ycl - y)*(ycl - y) + (zcl - z)*(zcl - z));\r
- if((Int_t)(dist * 100000) < (Int_t)(mindist * 100000)){\r
- //if((dist = TMath::Sqrt((ycl - y)*(ycl - y) + (zcl - z)*(zcl - z))) < mindist){\r
- mindist = dist;\r
- index = pos;\r
- } \r
- }\r
- // This is the Array Position in fIndex2D of the Nearest cluster: if a\r
- // cluster is called, then the function has to retrieve the Information\r
- // which is Stored in the Array called, the function\r
- return index;\r
+ if((Int_t)(dist * 100000) < (Int_t)(mindist * 100000)){\r
+ //if((dist = TMath::Sqrt((ycl - y)*(ycl - y) + (zcl - z)*(zcl - z))) < mindist){\r
+ mindist = dist;\r
+ index = pos;\r
+ } \r
+ }\r
+ // This is the Array Position in fIndex2D of the Nearest cluster: if a\r
+ // cluster is called, then the function has to retrieve the Information\r
+ // which is Stored in the Array called, the function\r
+ return index;\r
}\r
\r
//_____________________________________________________________________________\r
//End_Html\r
//\r
\r
- if(!AliTRDReconstructor::GetRecoParam()){\r
- AliError("Reconstruction parameters not initialized.");\r
- return;\r
- }\r
- \r
- if(Layer == 0){\r
- cond[0] = cl->GetY(); // center: y-Direction\r
- cond[1] = cl->GetZ(); // center: z-Direction\r
- cond[2] = AliTRDReconstructor::GetRecoParam()->GetMaxPhi() * (cl->GetX() - GetX()) + 1.0; // deviation: y-Direction\r
- cond[3] = AliTRDReconstructor::GetRecoParam()->GetMaxTheta() * (cl->GetX() - GetX()) + 1.0; // deviation: z-Direction\r
- } else {\r
- cond[0] = cl->GetY() + phi * (GetX() - cl->GetX()); \r
- cond[1] = cl->GetZ() + theta * (GetX() - cl->GetX());\r
- cond[2] = AliTRDReconstructor::GetRecoParam()->GetRoad0y() + phi;\r
- cond[3] = AliTRDReconstructor::GetRecoParam()->GetRoad0z();\r
- }\r
+ if(!fReconstructor){\r
+ AliError("Reconstructor not set.");\r
+ return;\r
+ }\r
+ \r
+ if(Layer == 0){\r
+ cond[0] = cl->GetY(); // center: y-Direction\r
+ cond[1] = cl->GetZ(); // center: z-Direction\r
+ cond[2] = fReconstructor->GetRecoParam()->GetMaxPhi() * (cl->GetX() - GetX()) + 1.0; // deviation: y-Direction\r
+ cond[3] = fReconstructor->GetRecoParam()->GetMaxTheta() * (cl->GetX() - GetX()) + 1.0; // deviation: z-Direction\r
+ } else {\r
+ cond[0] = cl->GetY() + phi * (GetX() - cl->GetX()); \r
+ cond[1] = cl->GetZ() + theta * (GetX() - cl->GetX());\r
+ cond[2] = fReconstructor->GetRecoParam()->GetRoad0y() + phi;\r
+ cond[3] = fReconstructor->GetRecoParam()->GetRoad0z();\r
+ }\r
}\r
\r
//_____________________________________________________________________________\r
// Function returs an array containing the indices in the stacklayer of\r
// the clusters found an the number of found clusters in the stacklayer\r
\r
- ncl = 0;\r
- memset(index, 0, BufferSize*sizeof(Int_t));\r
- if(fN == 0) return;\r
- \r
- //Boundary checks\r
- Double_t zvals[2];\r
- if(((cond[1] - cond[3]) >= (fZ0 + fZLength)) || (cond[1] + cond[3]) <= fZ0) return; // We are outside of the chamvber\r
- zvals[0] = ((cond[1] - cond[3]) < fZ0) ? fZ0 : (cond[1] - cond[3]);\r
- zvals[1] = ((cond[1] + cond[3]) < fZ0 + fZLength) ? (cond[1] + cond[3]) : fZ0 + fZLength - 1.E-3;\r
+ ncl = 0;\r
+ memset(index, 0, BufferSize*sizeof(Int_t));\r
+ if(fN == 0) return;\r
+ \r
+ //Boundary checks\r
+ Double_t zvals[2];\r
+ if(((cond[1] - cond[3]) >= (fZ0 + fZLength)) || (cond[1] + cond[3]) <= fZ0) return; // We are outside of the chamvber\r
+ zvals[0] = ((cond[1] - cond[3]) < fZ0) ? fZ0 : (cond[1] - cond[3]);\r
+ zvals[1] = ((cond[1] + cond[3]) < fZ0 + fZLength) ? (cond[1] + cond[3]) : fZ0 + fZLength - 1.E-3;\r
\r
- UChar_t zhi = fNRows - 1 - (UChar_t)(TMath::Abs(fZ0 - zvals[0])/fZLength * fNRows);\r
- UChar_t zlo = fNRows - 1 - (UChar_t)(TMath::Abs(fZ0 - zvals[1])/fZLength * fNRows);\r
+ UChar_t zhi = fNRows - 1 - (UChar_t)(TMath::Abs(fZ0 - zvals[0])/fZLength * fNRows);\r
+ UChar_t zlo = fNRows - 1 - (UChar_t)(TMath::Abs(fZ0 - zvals[1])/fZLength * fNRows);\r
\r
/* AliInfo(Form("yc[%f] zc[%f] dy[%f] dz[%f]", cond[0], cond[1], cond[2], cond[3]));\r
- PrintClusters();\r
- AliInfo(Form("zlo[%f] zhi[%f]", zvals[0], zvals[1]));\r
- AliInfo(Form("zlo[%d] zhi[%d]", zlo, zhi));*/\r
- \r
- //Preordering in Direction z saves a lot of loops (boundary checked)\r
- for(UChar_t z = zlo; z <= zhi; z++){\r
- UInt_t upper = (z < fNRows-1) ? fPositions[z+1] : fN;\r
- //AliInfo(Form("z[%d] y [%d %d]", z, fPositions[z], upper));\r
- for(Int_t y = fPositions[z]; y < (Int_t)upper; y++){\r
- if(ncl == BufferSize){\r
- AliWarning("Buffer size riched. Some clusters may be lost.");\r
- return; //Buffer filled\r
- }\r
- \r
- if(fClusters[y]->GetY() > (cond[0] + cond[2])) break; // Abbortion conditions!!!\r
- if(fClusters[y]->GetY() < (cond[0] - cond[2])) continue; // Too small\r
- if(((Int_t)((fClusters[y]->GetZ())*1000) < (Int_t)(zvals[0]*1000)) || ((Int_t)((fClusters[y]->GetZ())*1000) > (Int_t)(zvals[1]*1000))){/*printf("exit z\n"); TODO*/ continue;}\r
- index[ncl] = y;\r
- ncl++;\r
- }\r
- }\r
- if(ncl>fN) AliError(Form("Clusters found %d > %d (clusters in layer)", ncl, fN));\r
+ PrintClusters();\r
+ AliInfo(Form("zlo[%f] zhi[%f]", zvals[0], zvals[1]));\r
+ AliInfo(Form("zlo[%d] zhi[%d]", zlo, zhi));*/\r
+ \r
+ //Preordering in Direction z saves a lot of loops (boundary checked)\r
+ for(UChar_t z = zlo; z <= zhi; z++){\r
+ UInt_t upper = (z < fNRows-1) ? fPositions[z+1] : fN;\r
+ //AliInfo(Form("z[%d] y [%d %d]", z, fPositions[z], upper));\r
+ for(Int_t y = fPositions[z]; y < (Int_t)upper; y++){\r
+ if(ncl == BufferSize){\r
+ AliWarning("Buffer size riched. Some clusters may be lost.");\r
+ return; //Buffer filled\r
+ }\r
+ \r
+ if(fClusters[y]->GetY() > (cond[0] + cond[2])) break; // Abbortion conditions!!!\r
+ if(fClusters[y]->GetY() < (cond[0] - cond[2])) continue; // Too small\r
+ if(((Int_t)((fClusters[y]->GetZ())*1000) < (Int_t)(zvals[0]*1000)) || ((Int_t)((fClusters[y]->GetZ())*1000) > (Int_t)(zvals[1]*1000))){/*printf("exit z\n"); TODO*/ continue;}\r
+ index[ncl] = y;\r
+ ncl++;\r
+ }\r
+ }\r
+ if(ncl>fN) AliError(Form("Clusters found %d > %d (clusters in layer)", ncl, fN));\r
}\r
\r
//_____________________________________________________________________________\r
//\r
// returns a pointer to the nearest cluster (nullpointer if not\r
// successfull) by the help of the method FindNearestCluster\r
- \r
- \r
- Double_t maxroad = AliTRDReconstructor::GetRecoParam()->GetRoad2y();\r
- Double_t maxroadz = AliTRDReconstructor::GetRecoParam()->GetRoad2z();\r
- \r
- Int_t index = SearchNearestCluster(cond[0],cond[1],maxroad,maxroadz);\r
- AliTRDcluster *returnCluster = 0x0;\r
- if(index != -1) returnCluster = (AliTRDcluster *) fClusters[index];\r
- return returnCluster;\r
+ \r
+ \r
+ Double_t maxroad = fReconstructor->GetRecoParam()->GetRoad2y();\r
+ Double_t maxroadz = fReconstructor->GetRecoParam()->GetRoad2z();\r
+ \r
+ Int_t index = SearchNearestCluster(cond[0],cond[1],maxroad,maxroadz);\r
+ AliTRDcluster *returnCluster = 0x0;\r
+ if(index != -1) returnCluster = (AliTRDcluster *) fClusters[index];\r
+ return returnCluster;\r
}\r
\r
//_____________________________________________________________________________\r
{\r
// Prints the position of each cluster in the stacklayer on the stdout\r
//\r
- printf("\nnRows = %d\n", fNRows);\r
- printf("Z0 = %f\n", fZ0);\r
- printf("Z1 = %f\n", fZ0+fZLength);\r
- printf("clusters in AliTRDchamberTimeBin %d\n", fN);\r
- for(Int_t i = 0; i < fN; i++){\r
- printf("AliTRDchamberTimeBin: index=%i, Cluster: X = %3.3f [%d] Y = %3.3f [%d] Z = %3.3f [%d]\n", i, fClusters[i]->GetX(), fClusters[i]->GetLocalTimeBin(), fClusters[i]->GetY(), fClusters[i]->GetPadCol(), fClusters[i]->GetZ(), fClusters[i]->GetPadRow());\r
- if(fClusters[i]->IsUsed()) printf("cluster allready used. rejected in search algorithm\n");\r
- }\r
+ printf("\nnRows = %d\n", fNRows);\r
+ printf("Z0 = %f\n", fZ0);\r
+ printf("Z1 = %f\n", fZ0+fZLength);\r
+ printf("clusters in AliTRDchamberTimeBin %d\n", fN);\r
+ for(Int_t i = 0; i < fN; i++){\r
+ printf("AliTRDchamberTimeBin: index=%i, Cluster: X = %3.3f [%d] Y = %3.3f [%d] Z = %3.3f [%d]\n", i, fClusters[i]->GetX(), fClusters[i]->GetLocalTimeBin(), fClusters[i]->GetY(), fClusters[i]->GetPadCol(), fClusters[i]->GetZ(), fClusters[i]->GetPadRow());\r
+ if(fClusters[i]->IsUsed()) printf("cluster allready used. rejected in search algorithm\n");\r
+ }\r
}\r
#define ALITRDCHAMBERTIMEBIN_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
+* See cxx source for full Copyright notice */
/* $Id: AliTRDchamberTimeBin.h 22646 2007-11-29 18:13:40Z cblume $ */
#include "AliTRDcluster.h"
#endif
+class AliTRDReconstructor;
class AliTRDchamberTimeBin : public TObject
{
public:
- enum{
- kMaxClustersLayer = 150
- ,kMaxRows = 16
- };
+ enum{
+ kMaxClustersLayer = 150
+ ,kMaxRows = 16
+ };
- AliTRDchamberTimeBin(Int_t plane=-1, Int_t stack=-1, Int_t sector=-1, Double_t z0=-1., Double_t zLength=-1.);
- //AliTRDchamberTimeBin(const AliTRDpropagationLayer &layer, Double_t z0, Double_t zLength, UChar_t stackNr);
- //AliTRDchamberTimeBin(const AliTRDpropagationLayer &layer);
- AliTRDchamberTimeBin(const AliTRDchamberTimeBin &layer);
- ~AliTRDchamberTimeBin();
- //AliTRDchamberTimeBin &operator=(const AliTRDpropagationLayer &myLayer);
+ AliTRDchamberTimeBin(Int_t plane=-1, Int_t stack=-1, Int_t sector=-1, Double_t z0=-1., Double_t zLength=-1.);
+ //AliTRDchamberTimeBin(const AliTRDpropagationLayer &layer, Double_t z0, Double_t zLength, UChar_t stackNr);
+ //AliTRDchamberTimeBin(const AliTRDpropagationLayer &layer);
+ AliTRDchamberTimeBin(const AliTRDchamberTimeBin &layer);
+ ~AliTRDchamberTimeBin();
+ //AliTRDchamberTimeBin &operator=(const AliTRDpropagationLayer &myLayer);
operator Int_t() const { return fN; }
- AliTRDchamberTimeBin &operator=(const AliTRDchamberTimeBin &myLayer);
- AliTRDcluster *operator[](const Int_t i) const {
- return ((i < fN) && (i >= 0)) ? fClusters[i] : 0x0;
- }
+ AliTRDchamberTimeBin &operator=(const AliTRDchamberTimeBin &myLayer);
+ AliTRDcluster *operator[](const Int_t i) const {
+ return ((i < fN) && (i >= 0)) ? fClusters[i] : 0x0;
+ }
- void BuildIndices(Int_t iter = 0);
- void BuildCond(AliTRDcluster *cl, Double_t *cond, UChar_t Layer, Double_t theta=0., Double_t phi=0.);
+ void BuildIndices(Int_t iter = 0);
+ void BuildCond(AliTRDcluster *cl, Double_t *cond, UChar_t Layer, Double_t theta=0., Double_t phi=0.);
void Clear(const Option_t *opt = 0x0);
AliTRDcluster* GetCluster(Int_t index) const {return index < fN && index >= 0 ? fClusters[index] : 0x0;}
- Int_t GetGlobalIndex(const Int_t index) const {return ((index < fN) && (index >= 0)) ? fIndex[index] : 0; }
- void GetClusters(Double_t *cond, Int_t *index, Int_t& ncl, Int_t BufferSize = kMaxClustersLayer);
- AliTRDcluster* GetNearestCluster(Double_t *cond);
- Double_t GetX() const {
- return fX; }
- Double_t GetZ0() const { return fZ0; }
- Double_t GetDZ0() const { return fZLength;}
- Int_t GetNClusters() const { return fN; }
- Int_t GetPlane() const { return fPlane; }
- Int_t GetStack() const { return fStack; }
- Int_t GetSector() const { return fSector; }
- void InsertCluster(AliTRDcluster *c, UInt_t index);
+ Int_t GetGlobalIndex(const Int_t index) const {return ((index < fN) && (index >= 0)) ? fIndex[index] : 0; }
+ void GetClusters(Double_t *cond, Int_t *index, Int_t& ncl, Int_t BufferSize = kMaxClustersLayer);
+ AliTRDcluster* GetNearestCluster(Double_t *cond);
+ Double_t GetX() const {
+ return fX; }
+ Double_t GetZ0() const { return fZ0; }
+ Double_t GetDZ0() const { return fZLength;}
+ Int_t GetNClusters() const { return fN; }
+ Int_t GetPlane() const { return fPlane; }
+ Int_t GetStack() const { return fStack; }
+ Int_t GetSector() const { return fSector; }
+ void InsertCluster(AliTRDcluster *c, UInt_t index);
- Bool_t IsT0() const {return TestBit(1);}
-
- void PrintClusters() const;
- Int_t SearchNearestCluster(const Double_t y, const Double_t z, const Double_t Roady, const Double_t Roadz) const;
- void SetRange(Float_t z0, Float_t zLength);
- void SetNRows(const Int_t nRows){ fNRows = nRows; }
- void SetPlane(Int_t plane){ fPlane = plane; }
- void SetStack(Int_t stack){ fStack = stack; }
- void SetSector(Int_t sector){ fSector = sector; }
- void SetOwner(Bool_t own = kTRUE) {fOwner = own;}
- void SetT0(Bool_t set=kTRUE) {SetBit(1, set);}
- void SetX(Double_t x) {fX = x;}
+ Bool_t IsT0() const {return TestBit(1);}
+
+ void PrintClusters() const;
+ Int_t SearchNearestCluster(const Double_t y, const Double_t z, const Double_t Roady, const Double_t Roadz) const;
+ void SetRange(Float_t z0, Float_t zLength);
+ void SetNRows(const Int_t nRows){ fNRows = nRows; }
+ void SetPlane(Int_t plane){ fPlane = plane; }
+ void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
+ void SetStack(Int_t stack){ fStack = stack; }
+ void SetSector(Int_t sector){ fSector = sector; }
+ void SetOwner(Bool_t own = kTRUE) {fOwner = own;}
+ void SetT0(Bool_t set=kTRUE) {SetBit(1, set);}
+ void SetX(Double_t x) {fX = x;}
private:
- void Copy(TObject &o) const;
- Int_t Find(Float_t y) const;
- Int_t FindYPosition(Double_t y, UChar_t z, Int_t nClusters) const;
- Int_t FindNearestYCluster(Double_t y, UChar_t z) const;
+ void Copy(TObject &o) const;
+ Int_t Find(Float_t y) const;
+ Int_t FindYPosition(Double_t y, UChar_t z, Int_t nClusters) const;
+ Int_t FindNearestYCluster(Double_t y, UChar_t z) const;
private:
- Bool_t fOwner; // owner of the clusters
- Char_t fPlane; // Plane number
- Char_t fStack; // stack number in supermodule
- Char_t fSector; // Sector mumber
- Char_t fNRows; // number of pad rows in the chamber
- UChar_t fPositions[kMaxRows]; // starting index of clusters in pad row
- Int_t fN; // number of clusters
- AliTRDcluster *fClusters[kMaxClustersLayer]; //Array of pointers to clusters
- UInt_t fIndex[kMaxClustersLayer]; //Array of cluster indexes
- Double_t fX; // radial position of tb
-
- // obsolete !!
- Double_t fZ0; // starting position of the layer in Z direction
- Double_t fZLength; // length of the layer in Z direction
-
- ClassDef(AliTRDchamberTimeBin, 2) // tracking propagation layer for one time bin in chamber
+ const AliTRDReconstructor *fReconstructor; //
+ Bool_t fOwner; // owner of the clusters
+ Char_t fPlane; // Plane number
+ Char_t fStack; // stack number in supermodule
+ Char_t fSector; // Sector mumber
+ Char_t fNRows; // number of pad rows in the chamber
+ UChar_t fPositions[kMaxRows]; // starting index of clusters in pad row
+ Int_t fN; // number of clusters
+ AliTRDcluster *fClusters[kMaxClustersLayer]; //Array of pointers to clusters
+ UInt_t fIndex[kMaxClustersLayer]; //Array of cluster indexes
+ Double_t fX; // radial position of tb
+
+ // obsolete !!
+ Double_t fZ0; // starting position of the layer in Z direction
+ Double_t fZLength; // length of the layer in Z direction
+
+ ClassDef(AliTRDchamberTimeBin, 2) // tracking propagation layer for one time bin in chamber
};
ClassImp(AliTRDclusterizer)
//_____________________________________________________________________________
-AliTRDclusterizer::AliTRDclusterizer()
+AliTRDclusterizer::AliTRDclusterizer(AliTRDReconstructor *rec)
:TNamed()
+ ,fReconstructor(rec)
,fRunLoader(NULL)
,fClusterTree(NULL)
,fRecPoints(NULL)
fRawVersion = AliTRDfeeParam::Instance()->GetRAWversion();
-
+ // Initialize debug stream
+ if(fReconstructor){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kClusterizer) > 1){
+ TDirectory *savedir = gDirectory;
+ //fgDebugStreamer = new TTreeSRedirector("TRD.ClusterizerDebug.root");
+ savedir->cd();
+ }
+ }
}
//_____________________________________________________________________________
-AliTRDclusterizer::AliTRDclusterizer(const Text_t *name, const Text_t *title)
+AliTRDclusterizer::AliTRDclusterizer(const Text_t *name, const Text_t *title, AliTRDReconstructor *rec)
:TNamed(name,title)
+ ,fReconstructor(rec)
,fRunLoader(NULL)
,fClusterTree(NULL)
,fRecPoints(NULL)
AliFatal("Could not get calibration object");
}
+ // Initialize debug stream
+ if(fReconstructor){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kClusterizer) > 1){
+ TDirectory *savedir = gDirectory;
+ //fgDebugStreamer = new TTreeSRedirector("TRD.ClusterizerDebug.root");
+ savedir->cd();
+ }
+ }
+
fDigitsManager->CreateArrays();
fRawVersion = AliTRDfeeParam::Instance()->GetRAWversion();
//_____________________________________________________________________________
AliTRDclusterizer::AliTRDclusterizer(const AliTRDclusterizer &c)
:TNamed(c)
+ ,fReconstructor(c.fReconstructor)
,fRunLoader(NULL)
,fClusterTree(NULL)
,fRecPoints(NULL)
// tracklet writing
- if (AliTRDReconstructor::GetRecoParam()->IsTrackletWriteEnabled()){
+ if (fReconstructor->IsWritingTracklets()){
TString evfoldname = AliConfig::GetDefaultEventFolderName();
fRunLoader = AliRunLoader::GetRunLoader(evfoldname);
fDigitsManager->SetUseDictionaries(fAddLabels);
// tracklet container for raw tracklet writing
- if (!fTrackletContainer && AliTRDReconstructor::GetRecoParam()->IsTrackletWriteEnabled())
+ if (!fTrackletContainer && fReconstructor->IsWritingTracklets())
{
fTrackletContainer = new UInt_t *[2];
for (Int_t i=0; i<2 ;i++){
fDigitsManager->RemoveDictionaries(det);
fDigitsManager->ClearIndexes(det);
- if (!AliTRDReconstructor::GetRecoParam()-> IsTrackletWriteEnabled()) continue;
+ if (!fReconstructor->IsWritingTracklets()) continue;
if (*(fTrackletContainer[0]) > 0 || *(fTrackletContainer[1]) > 0) WriteTracklets(det); // if there is tracklet words in this det
}
- if (AliTRDReconstructor::GetRecoParam()->IsTrackletWriteEnabled()){
+ if (fReconstructor->IsWritingTracklets()){
delete [] fTrackletContainer;
fTrackletContainer = NULL;
}
// There is no ADC threshold anymore, and simParam should not be used in clusterizer. KO
Float_t adcThreshold = 0;
- if (!AliTRDReconstructor::GetRecoParam())
- {
- AliError("RecoParam does not exist\n");
- return kFALSE;
- }
+ if (!fReconstructor){
+ AliError("Reconstructor not set\n");
+ return kFALSE;
+ }
// Threshold value for the maximum
- Float_t maxThresh = AliTRDReconstructor::GetRecoParam()->GetClusMaxThresh();
+ Float_t maxThresh = fReconstructor->GetRecoParam() ->GetClusMaxThresh();
// Threshold value for the digit signal
- Float_t sigThresh = AliTRDReconstructor::GetRecoParam()->GetClusSigThresh();
+ Float_t sigThresh = fReconstructor->GetRecoParam() ->GetClusSigThresh();
// Threshold value for the maximum ( cut noise)
- Float_t minMaxCutSigma = AliTRDReconstructor::GetRecoParam()->GetMinMaxCutSigma();
+ Float_t minMaxCutSigma = fReconstructor->GetRecoParam() ->GetMinMaxCutSigma();
// Threshold value for the sum pad ( cut noise)
- Float_t minLeftRightCutSigma = AliTRDReconstructor::GetRecoParam()->GetMinLeftRightCutSigma();
+ Float_t minLeftRightCutSigma = fReconstructor->GetRecoParam() ->GetMinLeftRightCutSigma();
// Iteration limit for unfolding procedure
const Float_t kEpsilon = 0.01;
// The position of the cluster in COL direction relative to the center pad (pad units)
Double_t clusterPosCol = 0.0;
- if (AliTRDReconstructor::GetRecoParam()->IsLUT()) {
+ if (fReconstructor->GetRecoParam() ->IsLUT()) {
// Calculate the position of the cluster by using the
// lookup table method
clusterPosCol = LUTposition(ilayer,clusterSignal[2]
{
// Apply the tail cancelation via the digital filter
// (only for non-coorupted pads)
- if (AliTRDReconstructor::GetRecoParam()->IsTailCancelation())
+ if (fReconstructor->GetRecoParam() ->IsTailCancelation())
{
- DeConvExp(inADC,outADC,nTimeTotal,AliTRDReconstructor::GetRecoParam()->GetTCnexp());
+ DeConvExp(inADC,outADC,nTimeTotal,fReconstructor->GetRecoParam() ->GetTCnexp());
}
}
class AliTRDSignalIndex;
class AliTRDtransform;
class AliTRDCalROC;
-
-class AliTRDclusterizer : public TNamed {
-
- public:
-
- AliTRDclusterizer();
- AliTRDclusterizer(const Text_t* name, const Text_t* title);
+class AliTRDReconstructor;
+class AliTRDclusterizer : public TNamed
+{
+public:
+ AliTRDclusterizer(AliTRDReconstructor *rec = 0x0);
+ AliTRDclusterizer(const Text_t* name, const Text_t* title, AliTRDReconstructor *rec = 0x0);
AliTRDclusterizer(const AliTRDclusterizer &c);
virtual ~AliTRDclusterizer();
AliTRDclusterizer &operator=(const AliTRDclusterizer &c);
virtual Bool_t AddLabels(Int_t idet, Int_t firstClusterROC, Int_t nClusterROC);
virtual Bool_t SetAddLabels(Bool_t kset) { fAddLabels = kset;
- return fAddLabels; } // should we assign labels to clusters
+ return fAddLabels; } // should we assign labels to clusters
virtual void SetRawVersion(Int_t iver) { fRawVersion = iver; } // set the expected raw data version
-
- static UChar_t GetStatus(Short_t &signal);
-
- protected:
-
- void DeConvExp(Double_t *source, Double_t *target
- , Int_t nTimeTotal, Int_t nexp);
- void TailCancelation(AliTRDdataArrayDigits *digitsIn
- , AliTRDdataArrayF *digitsOut
- , AliTRDSignalIndex *indexesIn
- , AliTRDSignalIndex *indexesOut
- , Int_t nTimeTotal
- , Float_t ADCthreshold
- , AliTRDCalROC *calGainFactorROC
- , Float_t calGainFactorDetValue);
+ void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
+ static UChar_t GetStatus(Short_t &signal);
+
+protected:
+ void DeConvExp(Double_t *source, Double_t *target
+ , Int_t nTimeTotal, Int_t nexp);
+ void TailCancelation(AliTRDdataArrayDigits *digitsIn
+ , AliTRDdataArrayF *digitsOut
+ , AliTRDSignalIndex *indexesIn
+ , AliTRDSignalIndex *indexesOut
+ , Int_t nTimeTotal
+ , Float_t ADCthreshold
+ , AliTRDCalROC *calGainFactorROC
+ , Float_t calGainFactorDetValue);
virtual Double_t Unfold(Double_t eps, Int_t layer, Double_t *padSignal);
- Double_t GetCOG(Double_t signal[5]) const;
- void FillLUT();
- Double_t LUTposition(Int_t ilayer, Double_t ampL, Double_t ampC, Double_t ampR) const;
-
+ Double_t GetCOG(Double_t signal[5]) const;
+ void FillLUT();
+ Double_t LUTposition(Int_t ilayer, Double_t ampL, Double_t ampC, Double_t ampR) const;
virtual void ResetHelperIndexes(AliTRDSignalIndex *indexesIn);
+protected:
+ const AliTRDReconstructor *fReconstructor; //! reconstructor
AliRunLoader *fRunLoader; //! Run Loader
TTree *fClusterTree; //! Tree with the cluster
TObjArray *fRecPoints; //! Array of clusters
return -1;
}
- const AliTRDrecoParam *rec = AliTRDReconstructor::GetRecoParam();
- if (!rec) {
- AliErrorGeneral("AliTRDpidESD::MakePID()", "No TRD reco param.");
- return 0x0;
- }
+// AliTRDrecoParam *rec = AliTRDReconstructor::RecoParam();
+// if (!rec) {
+// AliErrorGeneral("AliTRDpidESD::MakePID()", "No TRD reco param.");
+// return 0x0;
+// }
// Retrieve the CDB container class with the probability distributions
- const AliTRDCalPID *pd = calibration->GetPIDObject(rec->GetPIDMethod());
+ const AliTRDCalPID *pd = calibration->GetPIDObject(AliTRDReconstructor::kLQPID/*rec->GetPIDMethod()*/);
if (!pd) {
AliErrorGeneral("AliTRDpidESD::MakePID()"
,"No access to AliTRDCalPID");
#/**************************************************************************
- * 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. *
- **************************************************************************/
+* 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$ */
if (fRawReader)
{
if (Init() == kFALSE)
- {
- AliWarning("Unable to Init. Try setting up the reader with SetReader or buffer with Init(void *, UInt_t )");
- }
+ {
+ AliWarning("Unable to Init. Try setting up the reader with SetReader or buffer with Init(void *, UInt_t )");
+ }
}
else
{
fpPos = fpBegin;
UInt_t iutmp = 0;
while (fpPos < fpEnd)
- {
- fpPos += 1;
- iutmp = (((*fpPos & 0x000000ffU) << 24) | ((*fpPos & 0x0000ff00U) << 8) |
- ((*fpPos & 0x00ff0000U) >> 8) | ((*fpPos & 0xff000000U) >> 24));
- // here we override the value in the buffer!
- *fpPos = iutmp;
- }
+ {
+ fpPos += 1;
+ iutmp = (((*fpPos & 0x000000ffU) << 24) | ((*fpPos & 0x0000ff00U) << 8) |
+ ((*fpPos & 0x00ff0000U) >> 8) | ((*fpPos & 0xff000000U) >> 24));
+ // here we override the value in the buffer!
+ *fpPos = iutmp;
+ }
fpPos = fpBegin;
}
}
for (UInt_t i = 0; i < iw; i++)
{
if (px + iw >= fpEnd)
- return kFALSE;
+ return kFALSE;
if (i % 8 == 0)
- tsreturn += "\n ";
+ tsreturn += "\n ";
if (marker != 0 && marker == px[i])
- tsreturn += Form(" *>0x%08x<* ", px[i]);
+ tsreturn += Form(" *>0x%08x<* ", px[i]);
else
- tsreturn += Form("0x%08x ", px[i]);
+ tsreturn += Form("0x%08x ", px[i]);
}
tsreturn += "\n";
{
fRawReader = reader;
if (fRawReader)
- {
- return Init();
- }
+ {
+ return Init();
+ }
else
- {
- AliWarning("Unable to setup reader.");
- return kFALSE;
- }
+ {
+ AliWarning("Unable to setup reader.");
+ return kFALSE;
+ }
}
else
{
UInt_t length = 0;
Bool_t kBufferSet = fRawReader->ReadNextData(buffer);
if (kBufferSet == kTRUE)
- {
- if (fgDebugFlag) AliDebug(9, "Buffer is set.");
- length = fRawReader->GetDataSize();
- if (fgExtraSkip == kTRUE)
- {
- buffer += EXTRA_LEAD_WORDS * WORD_SIZE;
- length -= EXTRA_LEAD_WORDS * WORD_SIZE;
- }
-
- if (fgSkipCDH == kTRUE)
- {
- buffer += CDH_WORDS * WORD_SIZE;
- length -= CDH_WORDS * WORD_SIZE;
- }
-
- if (length > 0)
- {
- if (fgDebugFlag) AliDebug(9, Form("Buffer length : %d", length));
+ {
+ if (fgDebugFlag) AliDebug(9, "Buffer is set.");
+ length = fRawReader->GetDataSize();
+ if (fgExtraSkip == kTRUE)
+ {
+ buffer += EXTRA_LEAD_WORDS * WORD_SIZE;
+ length -= EXTRA_LEAD_WORDS * WORD_SIZE;
+ }
+
+ if (fgSkipCDH == kTRUE)
+ {
+ buffer += CDH_WORDS * WORD_SIZE;
+ length -= CDH_WORDS * WORD_SIZE;
+ }
+
+ if (length > 0)
+ {
+ if (fgDebugFlag) AliDebug(9, Form("Buffer length : %d", length));
if (fgEnableMemoryReset) ResetMemory(); //[mj]
- if (DecodeSM((void*)buffer, length) == kTRUE)
- return 1;
- else
- return 0;
- }
- }
+ if (DecodeSM((void*)buffer, length) == kTRUE)
+ return 1;
+ else
+ return 0;
+ }
+ }
else
- {
- return -1;
- }
+ {
+ return -1;
+ }
}
return -1;
fSM.fClean = kTRUE;
fSM.fPos = NULL;
for (Int_t i=0; i<5; i++){
- fSM.fStackActive[i] = kFALSE;
+ fSM.fStackActive[i] = kFALSE;
}
}
fStack->fActiveLinks = 0;
fStack->fPos = NULL;
for (Int_t i=0; i<12; i++){
- fStack->fLinksActive[i] = kFALSE;
- fStack->fLinksDataType[i] = 0;
- fStack->fLinksMonitor[i] = 0;
- fStack->fLinkMonitorError[i] = 0;
+ fStack->fLinksActive[i] = kFALSE;
+ fStack->fLinksDataType[i] = 0;
+ fStack->fLinksMonitor[i] = 0;
+ fStack->fLinkMonitorError[i] = 0;
}
}
fMCM->fADCcounter = 0;
for (Int_t i=0; i<21; i++){
- fMCM->fADCchannel[i] = 0;
+ fMCM->fADCchannel[i] = 0;
}
}
fADC->fCorrupted = 0;
for (Int_t i=0; i<30; i++){
- fADC->fSignals[i] = 0;
+ fADC->fSignals[i] = 0;
}
}
//
ResetPerSM();
for (Int_t istack=0; istack<5; istack++){
- fStack = &fSM.fStacks[istack];
- ResetPerStack();
- for (Int_t ilink=0; ilink<12; ilink++){
+ fStack = &fSM.fStacks[istack];
+ ResetPerStack();
+ for (Int_t ilink=0; ilink<12; ilink++){
fHC = &fStack->fHalfChambers[ilink];
ResetPerHC();
for (Int_t imcm=0; imcm<12; imcm++){
- fMCM = &fHC->fMCMs[imcm];
- ResetPerMCM();
- for (Int_t iadc=0; iadc<12; iadc++){
+ fMCM = &fHC->fMCMs[imcm];
+ ResetPerMCM();
+ for (Int_t iadc=0; iadc<12; iadc++){
fADC = &fMCM->fADCs[iadc];
ResetPerADC();
- }
+ }
}
- }
+ }
}
}
// returns with true on next adc read
// returns false on errors and end of buffer
//
- if (fBufferRead)
- {
+if (fBufferRead)
+ {
while (fStackNumber < 5 && fSM.fActiveStacks > 0)
{
if(fSM.fStackActive[fStackNumber] == kTRUE)
- {
- fStack = &fSM.fStacks[fStackNumber];
- while (fStackLinkNumber < 12)
- {
- if (fStack->fLinksActive[fStackLinkNumber] == kTRUE && fStack->fLinksMonitor[fStackLinkNumber] == 0)
- {
- fHC = &fStack->fHalfChambers[fStackLinkNumber];
- if (!fHC)
- {
- AliError(Form("HC missing at stack %d link %d", fStackNumber, fStackLinkNumber));
- return kFALSE;
- }
- if (fHC->fCorrupted == 0 && (fHC->fH0Corrupted == 0 && fHC->fH1Corrupted == 0)) // if HC data corrupted(in any case), we don't read data at all from this HC
- {
- while (fhcMCMcounter < fHC->fMCMmax)
- {
- fMCM = &fHC->fMCMs[fhcMCMcounter];
- if (!fMCM)
- {
- AliError(Form("HC missing at stack %d link %d atMCMslot %d",
- fStackNumber, fStackLinkNumber, fhcMCMcounter));
- return kFALSE;
- }
- while(fmcmADCcounter < fMCM->fADCmax)
- {
- fADC = &fMCM->fADCs[fmcmADCcounter];
- if (!fADC)
- {
- AliError(Form("ADC missing at stack %d link %d MCMslot %d ADCslot %d",
- fStackNumber, fStackLinkNumber, fhcMCMcounter, fmcmADCcounter));
- return kFALSE;
- }
- fmcmADCcounter++;
- if (fSharedPadsOn)
- {
- return kTRUE;
- }
- else
- {
- if (fADC->fIsShared == kFALSE)
- return kTRUE;
- }
- } //while adc in MCM
- fhcMCMcounter++;
- // next MCM should go through all active ADCs
- fmcmADCcounter = 0;
- } // while mcm
- } // if HC OK
- }// if link active
- fStackLinkNumber++;
- // next stack link (HC) should go through all active MCMs
- fhcMCMcounter = 0;
- }// while links
- }// if stack active
+ {
+ fStack = &fSM.fStacks[fStackNumber];
+ while (fStackLinkNumber < 12)
+ {
+ if (fStack->fLinksActive[fStackLinkNumber] == kTRUE && fStack->fLinksMonitor[fStackLinkNumber] == 0)
+ {
+ fHC = &fStack->fHalfChambers[fStackLinkNumber];
+ if (!fHC)
+ {
+ AliError(Form("HC missing at stack %d link %d", fStackNumber, fStackLinkNumber));
+ return kFALSE;
+ }
+ if (fHC->fCorrupted == 0 && (fHC->fH0Corrupted == 0 && fHC->fH1Corrupted == 0)) // if HC data corrupted(in any case), we don't read data at all from this HC
+ {
+ while (fhcMCMcounter < fHC->fMCMmax)
+ {
+ fMCM = &fHC->fMCMs[fhcMCMcounter];
+ if (!fMCM)
+ {
+ AliError(Form("HC missing at stack %d link %d atMCMslot %d",
+ fStackNumber, fStackLinkNumber, fhcMCMcounter));
+ return kFALSE;
+ }
+ while(fmcmADCcounter < fMCM->fADCmax)
+ {
+ fADC = &fMCM->fADCs[fmcmADCcounter];
+ if (!fADC)
+ {
+ AliError(Form("ADC missing at stack %d link %d MCMslot %d ADCslot %d",
+ fStackNumber, fStackLinkNumber, fhcMCMcounter, fmcmADCcounter));
+ return kFALSE;
+ }
+ fmcmADCcounter++;
+ if (fSharedPadsOn)
+ {
+ return kTRUE;
+ }
+ else
+ {
+ if (fADC->fIsShared == kFALSE)
+ return kTRUE;
+ }
+ } //while adc in MCM
+ fhcMCMcounter++;
+ // next MCM should go through all active ADCs
+ fmcmADCcounter = 0;
+ } // while mcm
+ } // if HC OK
+ }// if link active
+ fStackLinkNumber++;
+ // next stack link (HC) should go through all active MCMs
+ fhcMCMcounter = 0;
+ }// while links
+ }// if stack active
fStackNumber++;
// next stack should go through all links - start from 0
fStackLinkNumber = 0;
}
- } // fBufferRead
-
- // in case rawreader manages the mem buffers, go for the next buffer
- if (fRawReader)
- {
- Int_t nextBuff = NextBuffer();
- while (nextBuff != -1)
- {
- if (nextBuff > 0)
+ } // fBufferRead
+
+ // in case rawreader manages the mem buffers, go for the next buffer
+ if (fRawReader)
+ {
+ Int_t nextBuff = NextBuffer();
+ while (nextBuff != -1)
+ {
+ if (nextBuff > 0)
{
fBufferRead = kTRUE;
- return Next();
+ return Next();
}
- nextBuff = NextBuffer();
- }
- }
+ nextBuff = NextBuffer();
+ }
+ }
return kFALSE;
}
AliTRDdataArrayI *track2 = 0;
AliTRDSignalIndex *indexes = 0;
- // Get the ADC baseline
- Int_t adcBaseline = 0;
- // if (!AliTRDReconstructor::RecoParam())
- // {
- // AliError("RecoParam does not exist\n");
- // return 0;
- // }
- // else
- // {
- // adcBaseline = ((Int_t) AliTRDReconstructor::RecoParam()->GetADCbaseline());
- // }
-
- static AliTRDrecoParam * par = AliTRDrecoParam::GetLowFluxParam();
- adcBaseline = par->GetADCbaseline();
// Loop through the digits
Int_t lastdet = -1;
Int_t det = -1;
if (trackletContainer){
for (Int_t i = 0; i < 2; i++)
- for (Int_t j = 0; j < MAX_TRACKLETS_PERHC; j++)
+ for (Int_t j = 0; j < MAX_TRACKLETS_PERHC; j++)
trackletContainer[i][j] = 0;
}
if (trackletContainer)
{
- if ((det + side*AliTRDgeometry::kNdet) != (lastdet + lastside*AliTRDgeometry::kNdet))
- {
- if (det != lastdet)
- {
+ if ((det + side*AliTRDgeometry::kNdet) != (lastdet + lastside*AliTRDgeometry::kNdet))
+ {
+ if (det != lastdet)
+ {
if (lastdet != -1)
{
- return lastdet;
+ return lastdet;
}
- }
- ntracklets = GetNTracklets();
- if(ntracklets > 0) memcpy(trackletContainer[side], GetTrackletWords(), sizeof(UInt_t) * ntracklets); //copy tracklet words to trackletContainer array
- lastside = side;
+ }
+ ntracklets = GetNTracklets();
+ if(ntracklets > 0) memcpy(trackletContainer[side], GetTrackletWords(), sizeof(UInt_t) * ntracklets); //copy tracklet words to trackletContainer array
+ lastside = side;
}
}
if (det != lastdet)
- {
- // If new detector found
- if (lastdet == -1)
- {
- lastdet = det;
- }
- else
- {
- return lastdet;
- }
-
- if (det < 0 || det >= AliTRDgeometry::kNdet)
- {
- if (fSM.fClean == kTRUE)
- {
- AliError(Form("Strange Det Number %d BUT event buffer seems to be clean.", det));
- }
- else
- {
- AliError(Form("Strange Det Number %d. Event buffer marked NOT clean!", det));
- }
- continue;
- }
-
- // Add a container for the digits of this detector
- digits = (AliTRDdataArrayDigits *) digitsManager->GetDigits(det);
+ {
+ // If new detector found
+ if (lastdet == -1)
+ {
+ lastdet = det;
+ }
+ else
+ {
+ return lastdet;
+ }
+
+ if (det < 0 || det >= AliTRDgeometry::kNdet)
+ {
+ if (fSM.fClean == kTRUE)
+ {
+ AliError(Form("Strange Det Number %d BUT event buffer seems to be clean.", det));
+ }
+ else
+ {
+ AliError(Form("Strange Det Number %d. Event buffer marked NOT clean!", det));
+ }
+ continue;
+ }
+
+ // Add a container for the digits of this detector
+ digits = (AliTRDdataArrayDigits *) digitsManager->GetDigits(det);
if (digitsManager->UsesDictionaries())
{
- track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
- track1 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,1);
- track2 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,2);
- }
-
- if (!digits)
- {
- if (fSM.fClean == kTRUE)
- {
- AliError(Form("Unable to get digits for det %d BUT event buffer seems to be clean.", det));
- }
- else
- {
- AliError(Form("Unable to get digits for det %d. Event buffer is NOT clean!", det));
- }
- return -1;
- }
-
- Int_t rowMax = GetRowMax();
- Int_t colMax = GetColMax();
- Int_t ntbins = GetNumberOfTimeBins();
-
- // Allocate memory space for the digits buffer
- if (digits->GetNtime() == 0)
- {
- digits->Allocate(rowMax, colMax, ntbins);
+ track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
+ track1 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,1);
+ track2 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,2);
+ }
+
+ if (!digits)
+ {
+ if (fSM.fClean == kTRUE)
+ {
+ AliError(Form("Unable to get digits for det %d BUT event buffer seems to be clean.", det));
+ }
+ else
+ {
+ AliError(Form("Unable to get digits for det %d. Event buffer is NOT clean!", det));
+ }
+ return -1;
+ }
+
+ Int_t rowMax = GetRowMax();
+ Int_t colMax = GetColMax();
+ Int_t ntbins = GetNumberOfTimeBins();
+
+ // Allocate memory space for the digits buffer
+ if (digits->GetNtime() == 0)
+ {
+ digits->Allocate(rowMax, colMax, ntbins);
if (digitsManager->UsesDictionaries())
{
- track0->Allocate(rowMax, colMax, ntbins);
- track1->Allocate(rowMax, colMax, ntbins);
- track2->Allocate(rowMax, colMax, ntbins);
- }
- }
-
- indexes = digitsManager->GetIndexes(det);
- indexes->SetSM(GetSM());
- indexes->SetStack(GetStack());
- indexes->SetLayer(GetLayer());
- indexes->SetDetNumber(det);
- if (indexes->IsAllocated() == kFALSE)
- indexes->Allocate(rowMax, colMax, ntbins);
- }
+ track0->Allocate(rowMax, colMax, ntbins);
+ track1->Allocate(rowMax, colMax, ntbins);
+ track2->Allocate(rowMax, colMax, ntbins);
+ }
+ }
+
+ indexes = digitsManager->GetIndexes(det);
+ indexes->SetSM(GetSM());
+ indexes->SetStack(GetStack());
+ indexes->SetLayer(GetLayer());
+ indexes->SetDetNumber(det);
+ if (indexes->IsAllocated() == kFALSE)
+ indexes->Allocate(rowMax, colMax, ntbins);
+ }
Char_t padStatus = cal->GetPadStatus(det, GetCol(), GetRow());
// ntimebins data are ready to read
for (it = 0; it < GetNumberOfTimeBins(); it++)
- {
- if ((GetSignals()[it] - adcBaseline) > 0)
- {
- digits->SetDataUnchecked(GetRow(), GetCol(), it, GetSignals()[it] - adcBaseline);
- if(padStatus)
- digits->SetPadStatus(GetRow(), GetCol(), it, padStatus);
-
- indexes->AddIndexTBin(GetRow(), GetCol(), it);
+ {
+ if (GetSignals()[it] > 0)
+ {
+ digits->SetDataUnchecked(GetRow(), GetCol(), it, GetSignals()[it]);
+ if(padStatus)
+ digits->SetPadStatus(GetRow(), GetCol(), it, padStatus);
+
+ indexes->AddIndexTBin(GetRow(), GetCol(), it);
if (digitsManager->UsesDictionaries())
{
- track0->SetDataUnchecked(GetRow(), GetCol(), it, 0);
- track1->SetDataUnchecked(GetRow(), GetCol(), it, 0);
- track2->SetDataUnchecked(GetRow(), GetCol(), it, 0);
- }
- }
- } // tbins
+ track0->SetDataUnchecked(GetRow(), GetCol(), it, 0);
+ track1->SetDataUnchecked(GetRow(), GetCol(), it, 0);
+ track2->SetDataUnchecked(GetRow(), GetCol(), it, 0);
+ }
+ }
+ } // tbins
}// while Next()
return det;
{
AliInfo(Form("---------- Dumping %u words from the beginnig of the buffer ----------",fgDumpHead));
if (DumpWords(fpBegin, fgDumpHead) == kFALSE)
- {
- AliError("Dump failed. Not enough data.");
- }
+ {
+ AliError("Dump failed. Not enough data.");
+ }
AliInfo(Form("---------- Dumping ended ----------------------------------------------"));
}
// fSM.fHeaderSize represent additional Supermodule header size which contains additional information regarding hardware design.
// For the moment, we skip decoding these words
if (SkipWords(fSM.fHeaderSize) == kTRUE)
- {
- for (Int_t istack = 0; istack < 5; istack++)
- {
- if (fSM.fStackActive[istack] == kFALSE)
- continue;
+ {
+ for (Int_t istack = 0; istack < 5; istack++)
+ {
+ if (fSM.fStackActive[istack] == kFALSE)
+ continue;
- fStack = &fSM.fStacks[istack];
+ fStack = &fSM.fStacks[istack];
// Decode Stack Index Word of given stack
- DecodeStackInfo(fpPos, fStack);
- fpPos++;
-
- fSM.fNexpectedHalfChambers += fStack->fActiveLinks;
-
- if (fgDebugFlag) AliDebug(5, DumpStackInfo(fStack));
-
- if (SkipWords(fStack->fHeaderSize-6) == kFALSE) // 6 is the 6 stack header words for 12 links
- {
- if (fRawReader) fRawReader->AddMajorErrorLog(kDecodeStackInfo, "Stack header words missing");
- return kFALSE;
- }
+ DecodeStackInfo(fpPos, fStack);
+ fpPos++;
+
+ fSM.fNexpectedHalfChambers += fStack->fActiveLinks;
+
+ if (fgDebugFlag) AliDebug(5, DumpStackInfo(fStack));
+
+ if (SkipWords(fStack->fHeaderSize-6) == kFALSE) // 6 is the 6 stack header words for 12 links
+ {
+ if (fRawReader) fRawReader->AddMajorErrorLog(kDecodeStackInfo, "Stack header words missing");
+ return kFALSE;
+ }
for (Int_t iword=0; iword<6; iword++) // decode 6 stack header words
- {
- // Decode Stack Header Word of given stack
- DecodeStackHeader(fpPos, fStack, iword);
- fpPos++;
- }
- }
- }
+ {
+ // Decode Stack Header Word of given stack
+ DecodeStackHeader(fpPos, fStack, iword);
+ fpPos++;
+ }
+ }
+ }
else
- {
- return kFALSE;
- }
+ {
+ return kFALSE;
+ }
}
else
{
{
fStackNumber = istack;
if (fSM.fStackActive[istack] == kFALSE)
- continue;
+ continue;
fStack = &fSM.fStacks[istack];
fgLastHC = -1; // to check rob number odering
for (Int_t ilink = 0; ilink < 12; ilink++)
- {
- fStackLinkNumber = ilink;
- if (fStack->fLinksActive[ilink] == kFALSE)
- continue;
+ {
+ fStackLinkNumber = ilink;
+ if (fStack->fLinksActive[ilink] == kFALSE)
+ continue;
// check GTU link monitor
if (!(fStack->fLinksDataType[ilink] == 0 && fStack->fLinksMonitor[ilink] == 0))
continue;
}
- if (fpPos >= fpEnd)
- {
- if (fRawReader) fRawReader->AddMajorErrorLog(kLinkDataMissing, "Link data missing");
+ if (fpPos >= fpEnd)
+ {
+ if (fRawReader) fRawReader->AddMajorErrorLog(kLinkDataMissing, "Link data missing");
if (fgWarnError) AliError("Link data missing.");
- fSM.fClean = kFALSE;
- break;
- }
+ fSM.fClean = kFALSE;
+ break;
+ }
- fHC = &fStack->fHalfChambers[ilink];
+ fHC = &fStack->fHalfChambers[ilink];
ResetPerHC();
- if (fSM.fTrackletEnable == kTRUE)
- {
- if (DecodeTracklets() == kFALSE)
- {
-
- fSM.fClean = kFALSE;
- SeekEndOfData();
-
- if (fgWarnError)
- {
- AliError(Form("Tracklet decoding failed stack %d link %d", fStackNumber, fStackLinkNumber));
- }
- continue;
- }
- }
-
- if (fpPos >= fpEnd)
- {
- if (fRawReader) fRawReader->AddMajorErrorLog(kHCdataMissing, "HC data missing");
+ if (fSM.fTrackletEnable == kTRUE)
+ {
+ if (DecodeTracklets() == kFALSE)
+ {
+
+ fSM.fClean = kFALSE;
+ SeekEndOfData();
+
+ if (fgWarnError)
+ {
+ AliError(Form("Tracklet decoding failed stack %d link %d", fStackNumber, fStackLinkNumber));
+ }
+ continue;
+ }
+ }
+
+ if (fpPos >= fpEnd)
+ {
+ if (fRawReader) fRawReader->AddMajorErrorLog(kHCdataMissing, "HC data missing");
if (fgWarnError) AliError("HC data missing.");
- fSM.fClean = kFALSE;
- break;
- }
-
+ fSM.fClean = kFALSE;
+ break;
+ }
+
fgLastROB = -1; // to check mcm number odering
fgLastIndex = -1 ; // to check mcm number odering
- if (DecodeHC() == kFALSE)
- {
- fSM.fClean = kFALSE;
+ if (DecodeHC() == kFALSE)
+ {
+ fSM.fClean = kFALSE;
if (fHC->fCorrupted < 16) SeekEndOfData(); // In case that we meet END_OF_TRACKLET_MARKERNEW
// during ADC data decoding or MCM header decoding
// we don't seek ENDOFRAWDATAMARKER
- if (fgWarnError)
- {
- AliError(Form("Failed HC : %s", DumpHCinfoH0(fHC)));
- AliError(Form("Failed HC : %s", DumpHCinfoH1(fHC)));
- }
-
- continue;
- }
- else
- {
- SeekEndOfData(); // make sure that finish off with the end of data markers
- }
-
- } // ilink
+ if (fgWarnError)
+ {
+ AliError(Form("Failed HC : %s", DumpHCinfoH0(fHC)));
+ AliError(Form("Failed HC : %s", DumpHCinfoH1(fHC)));
+ }
+
+ continue;
+ }
+ else
+ {
+ SeekEndOfData(); // make sure that finish off with the end of data markers
+ }
+
+ } // ilink
} // istack
ResetIterators(); // need to do it again for Next() function
if (fgCleanDataOnly && (fSM.fClean == kFALSE))
{
if (fgWarnError)
- {
- AliWarning("Buffer with errors. Returning FALSE.");
- AliWarning(Form("--- Failed SM : %s ---", DumpSMInfo(&fSM)));
- }
+ {
+ AliWarning("Buffer with errors. Returning FALSE.");
+ AliWarning(Form("--- Failed SM : %s ---", DumpSMInfo(&fSM)));
+ }
fSM.fActiveStacks = 0; // Next() will not give data
return kFALSE;
}
{
Int_t nextBuff = NextBuffer();
while (nextBuff != -1)
- {
- if (nextBuff > 0)
- return nextBuff;
- nextBuff = NextBuffer();
- }
+ {
+ if (nextBuff > 0)
+ return nextBuff;
+ nextBuff = NextBuffer();
+ }
return -1;
}
else
while ( *fpPos != ENDOFRAWDATAMARKER && fpPos < fpEnd )
{
if (MCM_HEADER_MASK_ERR(*fpPos) == 0 && MCM_HEADER_MASK_ERR(*(fpPos+1)) == 0)
- {
- if (fgDebugFlag) AliDebug(11,Form("^^^ Found : Pos 0x%08x : Val 0x%08x", fpPos, *fpPos));
- return kTRUE;
- }
+ {
+ if (fgDebugFlag) AliDebug(11,Form("^^^ Found : Pos 0x%08x : Val 0x%08x", fpPos, *fpPos));
+ return kTRUE;
+ }
if ( *fpPos == END_OF_TRACKLET_MARKERNEW)
{
fMCM->fCorrupted += 16;
fLinkTrackletCounter++;
if (fLinkTrackletCounter > MAX_TRACKLETS_PERHC)
- {
- if (fgDebugFlag) AliDebug(11,Form("Max number of tracklets exceeded %d > %d.",
- fLinkTrackletCounter, MAX_TRACKLETS_PERHC));
- if (fRawReader) fRawReader->AddMajorErrorLog(kTrackletOverflow,"Too many tracklets");
+ {
+ if (fgDebugFlag) AliDebug(11,Form("Max number of tracklets exceeded %d > %d.",
+ fLinkTrackletCounter, MAX_TRACKLETS_PERHC));
+ if (fRawReader) fRawReader->AddMajorErrorLog(kTrackletOverflow,"Too many tracklets");
fHC->fTrackletError = 1;
- return kFALSE;
- }
+ return kFALSE;
+ }
fHC->fTrackletWords[fLinkTrackletCounter-1] = UInt_t(*fpPos); //store tracklet words into array
fHC->fNTracklets = fLinkTrackletCounter;
AliTRDrawStreamTB::IsRowValid()
{
if ( (fHC->fStack == 2 && fMCM->fROW >= fGeometry->RowmaxC0()) ||
- (fHC->fStack != 2 && fMCM->fROW >= fGeometry->RowmaxC1()) || fMCM->fROW < 0 )
+ (fHC->fStack != 2 && fMCM->fROW >= fGeometry->RowmaxC1()) || fMCM->fROW < 0 )
{
if (fgDebugFlag) AliDebug(11,Form("SM%d L%dS%d: Wrong Padrow (%d) fROB=%d, fSIDE=%d, fMCM=%02d"
- , fHC->fSM, fHC->fLayer, fHC->fStack, fMCM->fROW, fMCM->fROB, fHC->fSide, fMCM->fMCM ));
+ , fHC->fSM, fHC->fLayer, fHC->fStack, fMCM->fROW, fMCM->fROB, fHC->fSide, fMCM->fMCM ));
return kFALSE;
}
return kTRUE;
{
Int_t matchingcounter = 0;
for (Int_t i=fgLastIndex+1; i<16; i++)
- {
- if ( fMCM->fMCM == fgMCMordering[i] )
- {
- fgLastIndex = i;
- matchingcounter++;
- break;
- }
- }
+ {
+ if ( fMCM->fMCM == fgMCMordering[i] )
+ {
+ fgLastIndex = i;
+ matchingcounter++;
+ break;
+ }
+ }
if (matchingcounter == 0)
{
fMCM->fMCMhdCorrupted += 2;
{
if ( fMCM->fROB < (fMCM-1)->fROB )
{
- fMCM->fMCMhdCorrupted += 2;
- AliDebug(11,Form("ROB number from last MCM is larger: ROB # from last MCM %d, ROB # from current MCM %d \n",(fMCM-1)->fROB, fMCM->fROB));
+ fMCM->fMCMhdCorrupted += 2;
+ AliDebug(11,Form("ROB number from last MCM is larger: ROB # from last MCM %d, ROB # from current MCM %d \n",(fMCM-1)->fROB, fMCM->fROB));
}
else fgLastROB = fMCM->fROB;
}
-
+
fgLastHC = fHC->fLayer*2 + fHC->fSide;
-
+
/*
// this check will come back later again when we have "patched MCM map"
int expectedROB = -1;
{
fpPos++;
if ( fpPos < fpEnd )
- {
- DecodeMask(fpPos, fMCM);
+ {
+ DecodeMask(fpPos, fMCM);
if (fHC->fCorrupted >= 16)
{
fpPos--;
return kFALSE;
}
- MCMADCwordsWithTbins(fHC->fTimeBins, fMCM);
- fMCM->fAdcDataPos = fpPos + 1;
- }
+ MCMADCwordsWithTbins(fHC->fTimeBins, fMCM);
+ fMCM->fAdcDataPos = fpPos + 1;
+ }
else
- {
- if (fgDebugFlag) AliDebug(11,"Expected ADC mask word. Fail due to buffer END.");
- if (fRawReader) fRawReader->AddMajorErrorLog(kMCMADCMaskMissing,"Missing");
+ {
+ if (fgDebugFlag) AliDebug(11,"Expected ADC mask word. Fail due to buffer END.");
+ if (fRawReader) fRawReader->AddMajorErrorLog(kMCMADCMaskMissing,"Missing");
fHC->fCorrupted += 32;
- return kFALSE;
- }
+ return kFALSE;
+ }
}
else
{
if (IsMCMheaderOK() == kFALSE)
return kFALSE;
-
+
return kTRUE;
}
if (fgStackNumberChecker)
{
- if (fHC->fStack != fStackNumber)
- {
+ if (fHC->fStack != fStackNumber)
+ {
if (fgDebugFlag) AliDebug(11,Form("Missmatch: Stack number between HC header %d and GTU link mask %d",
- fHC->fStack, fStackNumber));
+ fHC->fStack, fStackNumber));
fStackNumber = -1;
return kFALSE;
- }
+ }
}
if (fgStackLinkNumberChecker)
{
- //if (fHC->fLayer * 2 + fHC->fSide != fStackLinkNumber)
- // let it make flexible to consider known fiber swapping
- if ((fHC->fLayer * 2 != fStackLinkNumber) && (fHC->fLayer * 2 != fStackLinkNumber - 1))
- {
+ //if (fHC->fLayer * 2 + fHC->fSide != fStackLinkNumber)
+ // let it make flexible to consider known fiber swapping
+ if ((fHC->fLayer * 2 != fStackLinkNumber) && (fHC->fLayer * 2 != fStackLinkNumber - 1))
+ {
if (fgDebugFlag) AliDebug(11,Form("Missmatch: Layer number between HC header %d and GTU link mask %d | %s",
- fHC->fLayer, fStackLinkNumber, DumpStackInfo(fStack)));
+ fHC->fLayer, fStackLinkNumber, DumpStackInfo(fStack)));
fStackLinkNumber = -1;
return kFALSE;
- }
+ }
}
// SLOW GEOM : consistancy check with geometry
|| fHC->fSM <0 || fHC->fSM >= AliTRDgeometry::kNsector)
{
if (fgDebugFlag) AliDebug(11,Form("Wrong SM(sector) %d (Geometry says: %d) Stack=%d Layer=%d Det=%d",
- fHC->fSM, fGeometry->GetSector(fHC->fDET),
- fHC->fStack, fHC->fLayer, fHC->fDET));
+ fHC->fSM, fGeometry->GetSector(fHC->fDET),
+ fHC->fStack, fHC->fLayer, fHC->fDET));
if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongSM, "Wrong SM");
return kFALSE;
}
{
fpPos++;
if (fpPos < fpEnd)
- {
- if (DecodeHCwordH1(fpPos, fHC) == kFALSE)
+ {
+ if (DecodeHCwordH1(fpPos, fHC) == kFALSE)
return kFALSE;
- }
+ }
else
- {
- if (fgDebugFlag) AliDebug(11,"Expected HC header word 1. Fail due to buffer END.");
- if (fRawReader) fRawReader->AddMajorErrorLog(kHCWordMissing,"Next HC word 1 (count from 0) missing");
- return kFALSE;
- }
+ {
+ if (fgDebugFlag) AliDebug(11,"Expected HC header word 1. Fail due to buffer END.");
+ if (fRawReader) fRawReader->AddMajorErrorLog(kHCWordMissing,"Next HC word 1 (count from 0) missing");
+ return kFALSE;
+ }
}
if (fgDebugFlag) AliDebug(5, DumpHCinfoH0(fHC));
{
fpPos++;
if (fpPos >= fpEnd)
- {
+ {
fHC->fCorrupted += 1;
- if (fgDebugFlag) AliDebug(11,"No MCM data? Not enough data in the buffer.");
- if (fRawReader) fRawReader->AddMajorErrorLog(kMCMdataMissing, "MCM data missing");
- return kFALSE;
- }
+ if (fgDebugFlag) AliDebug(11,"No MCM data? Not enough data in the buffer.");
+ if (fRawReader) fRawReader->AddMajorErrorLog(kMCMdataMissing, "MCM data missing");
+ return kFALSE;
+ }
}
fHC->fMCMmax = 0;
while (*fpPos != ENDOFRAWDATAMARKER && fpPos < fpEnd)
{
if (fHC->fMCMmax > TRD_MAX_MCM)
- {
+ {
fHC->fCorrupted += 2;
- if (fgDebugFlag) AliDebug(11,"More mcm data than expected!");
- if (fRawReader) fRawReader->AddMajorErrorLog(kMCMoverflow, "Too many mcms found!");
- return kFALSE;
- }
+ if (fgDebugFlag) AliDebug(11,"More mcm data than expected!");
+ if (fRawReader) fRawReader->AddMajorErrorLog(kMCMoverflow, "Too many mcms found!");
+ return kFALSE;
+ }
fMCM = &fHC->fMCMs[fHC->fMCMmax];
if (DecodeMCMheader() == kFALSE)
- {
+ {
if (fHC->fCorrupted < 4) fHC->fCorrupted += 4; // benchmark hc data corruption as 4
-
- if (fgSkipData == kTRUE || fHC->fCorrupted >= 16)
+
+ if (fgSkipData == kTRUE || fHC->fCorrupted >= 16)
return kFALSE; // stop HC data reading
fHC->fMCMmax++; // increase mcm counter to match with expected rob/mcm number
if (fMCM->fADCmaskCorrupted < 2)
{
if (SkipMCMdata(fMCM->fADCcount*fMCM->fSingleADCwords) == kFALSE)
- return kFALSE;
+ return kFALSE;
continue;
}
else
{
if (SeekNextMCMheader() == kFALSE)
- return kFALSE;
+ return kFALSE;
continue;
}
- }
+ }
fHC->fMCMmax++;
-
+
if (fMCM->fADCmax > 0)
- {
- fpPos++;
- if (fpPos >= fpEnd)
- {
+ {
+ fpPos++;
+ if (fpPos >= fpEnd)
+ {
fMCM->fCorrupted += 1;
if (fHC->fCorrupted < 4) fHC->fCorrupted += 4; // benchmark hc data corruption as 4
- if (fgDebugFlag) AliDebug(9, Form("Buffer short of data. ADC data expected."));
- return kFALSE;
- }
+ if (fgDebugFlag) AliDebug(9, Form("Buffer short of data. ADC data expected."));
+ return kFALSE;
+ }
- for (Int_t iadc = 0; iadc < fMCM->fADCmax; iadc++)
- {
- fADC = &fMCM->fADCs[iadc];
- fADC->fADCnumber = fMCM->fADCchannel[iadc];
+ for (Int_t iadc = 0; iadc < fMCM->fADCmax; iadc++)
+ {
+ fADC = &fMCM->fADCs[iadc];
+ fADC->fADCnumber = fMCM->fADCchannel[iadc];
- if (fgDebugFlag) AliDebug(9, Form("This is ADC %d of %d. ADC number is %d.",
- iadc+1, fMCM->fADCmax, fMCM->fADCchannel[iadc]));
+ if (fgDebugFlag) AliDebug(9, Form("This is ADC %d of %d. ADC number is %d.",
+ iadc+1, fMCM->fADCmax, fMCM->fADCchannel[iadc]));
- if (fpPos + fMCM->fSingleADCwords >= fpEnd)
- {
-
+ if (fpPos + fMCM->fSingleADCwords >= fpEnd)
+ {
+
fMCM->fCorrupted += 2;
if (fHC->fCorrupted < 4) fHC->fCorrupted += 4; // benchmark hc data corruption as 4
- if (fgDebugFlag) AliDebug(11,"ADC (10 words) expected. Not enough data in the buffer.");
- return kFALSE;
- }
+ if (fgDebugFlag) AliDebug(11,"ADC (10 words) expected. Not enough data in the buffer.");
+ return kFALSE;
+ }
if (fHC->fRawVMajor < 64) // normal(real) ADC data
{
- if (DecodeADC() == kFALSE)
- {
+ if (DecodeADC() == kFALSE)
+ {
if (fMCM->fCorrupted < 4) fMCM->fCorrupted += 4; // benchmark mcm data corruption as 4
if (fHC->fCorrupted < 4) fHC->fCorrupted += 4; // benchmark hc data corruption as 4
- if (fADC->fIsShared && fADC->fCorrupted == 16) // check if we are out of the det when the pad is shared
- {
- fADC->fCOL = -1;
- fpPos = fADC->fPos + fMCM->fSingleADCwords;
- }
- else
- {
- if (fgDebugFlag) AliDebug(11,Form("ADC decode failed."));
- if (fgSkipData == kTRUE || fHC->fCorrupted >= 16)
- return kFALSE; // stop HC data reading
- }
- }
+ if (fADC->fIsShared && fADC->fCorrupted == 16) // check if we are out of the det when the pad is shared
+ {
+ fADC->fCOL = -1;
+ fpPos = fADC->fPos + fMCM->fSingleADCwords;
+ }
+ else
+ {
+ if (fgDebugFlag) AliDebug(11,Form("ADC decode failed."));
+ if (fgSkipData == kTRUE || fHC->fCorrupted >= 16)
+ return kFALSE; // stop HC data reading
+ }
+ }
}
else // test pattern data
{
if (fgWarnError) AliError("These are test pattern data. You need other reader"); // will be served in other class
}
- }
- }
+ }
+ }
else
- {
- fpPos++;
- }
+ {
+ fpPos++;
+ }
}//while eof data
if (fpPos >= fpEnd)
if (HC_HEADER_MASK_ERR(*fpPos) == 0 || *fpPos == END_OF_TRACKLET_MARKERNEW)
{
if (fgWarnError) AliError(Form("There should be ADC data. We meet HC header or END_OF_TRACKLET_MARKER 0x%08x",*fpPos));
- fADC->fCorrupted += 16;
+ fADC->fCorrupted += 16;
fHC->fCorrupted += 16;
fpPos--;
return kFALSE;
}
if (fMaskADCword != ADC_WORD_MASK(*fpPos))
- {
- fADC->fCorrupted += 1;
+ {
+ fADC->fCorrupted += 1;
if (fgDebugFlag) AliDebug(11,Form("Wrong ADC data mask! ADC channel number: %02d [Expected mask: 0x%08x Current mask: 0x%08x] MCM= %s Error : %d",
- fADC->fADCnumber, fMaskADCword, ADC_WORD_MASK(*fpPos),DumpMCMinfo(fMCM),fADC->fCorrupted));
+ fADC->fADCnumber, fMaskADCword, ADC_WORD_MASK(*fpPos),DumpMCMinfo(fMCM),fADC->fCorrupted));
fpPos++;
- continue;
- }
+ continue;
+ }
// here we subtract the baseline ( == common additive)
fADC->fSignals[fTbinADC + 0] = ((*fpPos & 0x00000ffc) >> 2) - fgCommonAdditive;
if (fADC->fCOL >= fHC->fColMax || fADC->fCOL < 0)
{
if (fADC->fIsShared == kFALSE)
- {
- fADC->fCorrupted += 32;
- if (fgDebugFlag) AliDebug(11,Form("Wrong column! ADCnumber %d MaxIs %d Col %d MaxIs %d MCM= %s",
- fADC->fADCnumber, fMaxADCgeom, fADC->fCOL, fHC->fColMax, DumpMCMinfo(fMCM)));
- }
+ {
+ fADC->fCorrupted += 32;
+ if (fgDebugFlag) AliDebug(11,Form("Wrong column! ADCnumber %d MaxIs %d Col %d MaxIs %d MCM= %s",
+ fADC->fADCnumber, fMaxADCgeom, fADC->fCOL, fHC->fColMax, DumpMCMinfo(fMCM)));
+ }
//else
- //{
- // we are out of the det when the pad is shared
- //if (fgDebugFlag) AliDebug(11, Form("Column out of the detector! ADCnumber %d MaxIs %d Col %d MaxIs %d MCM= %s",
- // fADC->fADCnumber, fMaxADCgeom, fADC->fCOL, fHC->fColMax, DumpMCMinfo(fMCM)));
- //fADC->fCorrupted += 32;
- //}
+ //{
+ // we are out of the det when the pad is shared
+ //if (fgDebugFlag) AliDebug(11, Form("Column out of the detector! ADCnumber %d MaxIs %d Col %d MaxIs %d MCM= %s",
+ // fADC->fADCnumber, fMaxADCgeom, fADC->fCOL, fHC->fColMax, DumpMCMinfo(fMCM)));
+ //fADC->fCorrupted += 32;
+ //}
}
if (fADC->fCorrupted > 0)
for (Int_t i = 0; i < 5; i++)
{
if (IS_BIT_SET(stackMask,i) > 0)
- {
- sm->fStackActive[i] = kTRUE;
- sm->fActiveStacks++;
- }
+ {
+ sm->fStackActive[i] = kTRUE;
+ sm->fActiveStacks++;
+ }
else
- {
- sm->fStackActive[i] = kFALSE;
- }
+ {
+ sm->fStackActive[i] = kFALSE;
+ }
}
}
// Get SM structure into a const char
//
return Form("[ SM Info 0x%08x] : Hsize %d TrackletEnable %d Stacks %d %d %d %d %d",
- *sm->fPos,
- sm->fHeaderSize, sm->fTrackletEnable,
- sm->fStackActive[0], sm->fStackActive[1], sm->fStackActive[2],
- sm->fStackActive[3], sm->fStackActive[4]);
+ *sm->fPos,
+ sm->fHeaderSize, sm->fTrackletEnable,
+ sm->fStackActive[0], sm->fStackActive[1], sm->fStackActive[2],
+ sm->fStackActive[3], sm->fStackActive[4]);
}
//--------------------------------------------------------
for (Int_t i = 0; i < 12; i++)
{
if (IS_BIT_SET(linkMask,i) > 0)
- {
- st->fLinksActive[i] = kTRUE;
- st->fActiveLinks++;
- }
+ {
+ st->fLinksActive[i] = kTRUE;
+ st->fActiveLinks++;
+ }
else
- {
- st->fLinksActive[i] = kFALSE;
- }
+ {
+ st->fLinksActive[i] = kFALSE;
+ }
}
}
//
return Form("[ Stack Info 0x%08x ] : Hsize %d Links Active %d %d %d %d %d %d %d %d %d %d %d %d",
- *st->fPos,
- st->fHeaderSize,
- st->fLinksActive[0], st->fLinksActive[1], st->fLinksActive[2], st->fLinksActive[3],
- st->fLinksActive[4], st->fLinksActive[5], st->fLinksActive[6], st->fLinksActive[7],
- st->fLinksActive[8], st->fLinksActive[9], st->fLinksActive[10], st->fLinksActive[11]);
+ *st->fPos,
+ st->fHeaderSize,
+ st->fLinksActive[0], st->fLinksActive[1], st->fLinksActive[2], st->fLinksActive[3],
+ st->fLinksActive[4], st->fLinksActive[5], st->fLinksActive[6], st->fLinksActive[7],
+ st->fLinksActive[8], st->fLinksActive[9], st->fLinksActive[10], st->fLinksActive[11]);
}
hc->fH0Corrupted = HC_HEADER_MASK_ERR(vword);
if (hc->fH0Corrupted > 0)
{
- if (fgDebugFlag) AliDebug(11,Form("H0 Header Mask Error. Word 0x%08x", *fHC->fPos));
- return kFALSE;
+ if (fgDebugFlag) AliDebug(11,Form("H0 Header Mask Error. Word 0x%08x", *fHC->fPos));
+ return kFALSE;
}
hc->fSpecialRawV = HC_SPECIAL_RAW_VERSION(vword);
hc->fH1Corrupted = HC_HEADER_MASK_ERR(vword);
if (hc->fH1Corrupted > 0)
{
- if (fgDebugFlag) AliDebug(11,Form("H1 Header Mask Error. Word 0x%08x", *fHC->fPos));
- return kFALSE;
+ if (fgDebugFlag) AliDebug(11,Form("H1 Header Mask Error. Word 0x%08x", *fHC->fPos));
+ return kFALSE;
}
hc->fTimeBins = HC_NTIMEBINS(vword);
return Form("Unable to dump. Null received as parameter!?!");
else
return Form("[ HC[0] at 0x%08x ] : 0x%08x Info is : RawV %d SM %d Stack %d Layer %d Side %d DCSboard %d",
- hc->fPos[0], *(hc->fPos[0]), hc->fRawVMajor, hc->fSM, hc->fStack, hc->fLayer, hc->fSide, hc->fDCSboard);
+ hc->fPos[0], *(hc->fPos[0]), hc->fRawVMajor, hc->fSM, hc->fStack, hc->fLayer, hc->fSide, hc->fDCSboard);
}
//--------------------------------------------------------
return Form("Unable to dump. Null received as parameter!?!");
else
return Form("[ HC[1] at 0x%08x ] : 0x%08x Info is : TBins %d BCcount %d PreTrigCount %d PreTrigPhase %d",
- hc->fPos[1], *(hc->fPos[1]), hc->fTimeBins, hc->fBunchCrossCounter, hc->fPreTriggerCounter, hc->fPreTriggerPhase);
+ hc->fPos[1], *(hc->fPos[1]), hc->fTimeBins, hc->fBunchCrossCounter, hc->fPreTriggerCounter, hc->fPreTriggerPhase);
}
//--------------------------------------------------------
if (mcm->fADCMask > 0)
{
for (Int_t i = 0; i < TRD_MAX_ADC; i++)
- {
- mcm->fADCchannel[mcm->fADCmax] = 0;
- if( IS_BIT_SET(mcm->fADCMask,i) )
- {
- mcm->fADCchannel[mcm->fADCmax] = i;
- mcm->fADCmax++;
- }
- }
+ {
+ mcm->fADCchannel[mcm->fADCmax] = 0;
+ if( IS_BIT_SET(mcm->fADCMask,i) )
+ {
+ mcm->fADCchannel[mcm->fADCmax] = i;
+ mcm->fADCmax++;
+ }
+ }
}
if (mcm->fADCcount != mcm->fADCmax && fHC->fRawVMajor >= 32) // backward compatibility
{
//______________________________________________________________
AliTRDrecoParam::AliTRDrecoParam()
:AliDetectorRecoParam()
- ,fkPIDMethod(kLQPID) // LQ PID
,fkMaxTheta(1.0)
,fkMaxPhi(2.0)
,fkRoad0y(6.0)
,fkChi2Z(30./*14.*//*12.5*/)
,fkChi2Y(.25)
,fkTrackLikelihood(-15.)
- ,fkStreamLevel(0)
,fMinMaxCutSigma(4.)
,fMinLeftRightCutSigma(8.)
,fClusMaxThresh(4.5)
,fClusSigThresh(3.5)
,fTCnexp(1)
- ,fADCbaseline(0)
,fNumberOfPresamples(0)
,fNumberOfPostsamples(0)
{
// Default constructor
//
SetClusterSharing(kFALSE);
- SetSeeding(kFALSE);
SetVertexConstrained();
SetLUT();
SetTailCancelation();
- SetTrackletWriteEnabled();
-
+
fSysCovMatrix[0] = 1.; // y direction (1 cm)
fSysCovMatrix[1] = 1.; // z direction (1 cm)
fSysCovMatrix[2] = 0.; // snp
//______________________________________________________________
AliTRDrecoParam::AliTRDrecoParam(const AliTRDrecoParam &ref)
:AliDetectorRecoParam(ref)
- ,fkPIDMethod(ref.fkPIDMethod)
,fkMaxTheta(ref.fkMaxTheta)
,fkMaxPhi(ref.fkMaxPhi)
,fkRoad0y(ref.fkRoad0y)
,fkChi2Z(ref.fkChi2Z)
,fkChi2Y(ref.fkChi2Y)
,fkTrackLikelihood(ref.fkTrackLikelihood)
- ,fkStreamLevel(ref.fkStreamLevel)
,fMinMaxCutSigma(ref.fMinMaxCutSigma)
,fMinLeftRightCutSigma(ref.fMinLeftRightCutSigma)
,fClusMaxThresh(ref.fClusMaxThresh)
,fClusSigThresh(ref.fClusSigThresh)
,fTCnexp(ref.fTCnexp)
- ,fADCbaseline(ref.fADCbaseline)
,fNumberOfPresamples(ref.fNumberOfPresamples)
,fNumberOfPostsamples(ref.fNumberOfPostsamples)
{
// Copy constructor
//
SetClusterSharing(ref.IsClusterSharing());
- SetSeeding(ref.IsSeeding());
SetVertexConstrained(ref.IsVertexConstrained());
SetLUT(ref.IsLUT());
SetTailCancelation(ref.IsTailCancelation());
- SetTrackletWriteEnabled(ref.IsTrackletWriteEnabled());
memcpy(fSysCovMatrix, ref.fSysCovMatrix, 5*sizeof(Double_t));
}
AliTRDrawStreamBase::SetRawStreamVersion("TB");
AliTRDrecoParam *par = new AliTRDrecoParam();
- par->SetADCbaseline(10);
- par->SetSeeding();
par->SetVertexConstrained();
return par;
class AliTRDrecoParam : public AliDetectorRecoParam
{
public:
- enum AliTRDpidMethod{
- kLQPID = 0,
- kNNPID = 1
- };
-
AliTRDrecoParam();
AliTRDrecoParam(const AliTRDrecoParam &rec);
~AliTRDrecoParam() { }
- Int_t GetADCbaseline() const { return fADCbaseline; };
Double_t GetChi2Y() const { return fkChi2Y; }
Double_t GetChi2Z() const { return fkChi2Z; }
Double_t GetFindableClusters() const { return fkFindable; }
Double_t GetMaxTheta() const { return fkMaxTheta; }
Double_t GetMaxPhi() const { return fkMaxPhi; }
- Int_t GetNdEdxSlices() const { return fkPIDMethod == kNNPID ? kNNslices : kLQslices;}
- AliTRDpidMethod GetPIDMethod() const { return fkPIDMethod;}
Double_t GetPlaneQualityThreshold() const { return fkPlaneQualityThreshold; }
Double_t GetRoad0y() const { return fkRoad0y; }
Double_t GetRoad0z() const { return fkRoad0z; }
Double_t GetRoad2y() const { return fkRoad2y; }
Double_t GetRoad2z() const { return fkRoad2z; }
Double_t GetTrackLikelihood() const { return fkTrackLikelihood; }
- Int_t GetStreamLevel() const { return fkStreamLevel; }
inline void GetSysCovMatrix(Double_t *sys) const;
Double_t GetMinMaxCutSigma() const { return fMinMaxCutSigma; };
Double_t GetMinLeftRightCutSigma() const { return fMinLeftRightCutSigma; };
Bool_t IsClusterSharing() const { return TestBit(kClusterSharing);}
Bool_t IsLUT() const { return TestBit(kLUT);}
- Bool_t IsSeeding() const { return TestBit(kSeeding); }
Bool_t IsTailCancelation() const { return TestBit(kTC);}
Bool_t IsVertexConstrained() const { return TestBit(kVertexConstrained); }
- Bool_t IsTrackletWriteEnabled() const { return TestBit(kTrackletWriting); };
-
void SetFindableClusters(Double_t r) {fkFindable = r;}
void SetClusterSharing(Bool_t share = kTRUE) { SetBit(kClusterSharing, share); };
- void SetPIDMethod(AliTRDpidMethod pid) { fkPIDMethod = pid; };
- void SetSeeding(Bool_t so = kTRUE) { SetBit(kSeeding, so); }
void SetVertexConstrained(Bool_t vc = kTRUE) { SetBit(kVertexConstrained, vc); }
- void SetStreamLevel(Int_t streamLevel= 1) { fkStreamLevel = streamLevel; }
void SetLUT(Bool_t lut = kTRUE) { SetBit(kLUT, lut);};
void SetMinMaxCutSigma(Float_t minMaxCutSigma) { fMinMaxCutSigma = minMaxCutSigma; };
void SetMinLeftRightCutSigma(Float_t minLeftRightCutSigma) { fMinLeftRightCutSigma = minLeftRightCutSigma; };
void SetClusSigThresh(Float_t thresh) { fClusSigThresh = thresh; };
void SetTailCancelation(Bool_t tc = kTRUE) { SetBit(kTC, tc); };
void SetNexponential(Int_t nexp) { fTCnexp = nexp; };
- void SetADCbaseline(Int_t base) { fADCbaseline = base; };
inline void SetSysCovMatrix(Double_t *sys);
void SetNumberOfPresamples(Int_t n) {fNumberOfPresamples = n;}
void SetNumberOfPostsamples(Int_t n) {fNumberOfPostsamples = n;}
- void SetTrackletWriteEnabled(Bool_t enablewritetracklet = kFALSE) { SetBit(kTrackletWriting, enablewritetracklet); };
-
private:
- enum{
- kNNslices = 8
- ,kLQslices = 3
- };
-
enum{
kClusterSharing = 1 // Toggle cluster sharing
- ,kSeeding = 2 // Do stand alone tracking in the TRD
- ,kVertexConstrained = 3 // Perform vertex constrained fit
- ,kLUT = 4 //
- ,kTC = 5 // tail cancelation
- ,kTrackletWriting = 6
+ ,kVertexConstrained = 2 // Perform vertex constrained fit
+ ,kLUT = 3 //
+ ,kTC = 4 // tail cancelation
};
- AliTRDpidMethod fkPIDMethod; // PID method selector 0(LQ) 1(NN)
Double_t fkMaxTheta; // Maximum theta
Double_t fkMaxPhi; // Maximum phi
Double_t fkChi2Z; // Max chi2 on the z direction for seeding clusters fit
Double_t fkChi2Y; // Max chi2 on the y direction for seeding clusters Rieman fit
Double_t fkTrackLikelihood; // Track likelihood for tracklets Rieman fit
- Int_t fkStreamLevel; // Streaming Level in TRD Reconstruction
Double_t fSysCovMatrix[5]; // Systematic uncertainty from calibration and alignment for each tracklet
Int_t fTCnexp; // Number of exponentials, digital filter
// ADC parameter
- Int_t fADCbaseline; // ADC baseline to be subtracted
Int_t fNumberOfPresamples; // number of presamples
Int_t fNumberOfPostsamples; // number of postsamples
- ClassDef(AliTRDrecoParam, 5) // Reconstruction parameters for TRD detector
+ ClassDef(AliTRDrecoParam, 4) // Reconstruction parameters for TRD detector
};
//____________________________________________________________________
AliTRDseedV1::AliTRDseedV1(Int_t plane)
:AliTRDseed()
+ ,fReconstructor(0x0)
,fPlane(plane)
,fMom(0.)
,fSnp(0.)
//____________________________________________________________________
AliTRDseedV1::AliTRDseedV1(const AliTRDseedV1 &ref)
:AliTRDseed((AliTRDseed&)ref)
+ ,fReconstructor(0x0)
,fPlane(ref.fPlane)
,fMom(ref.fMom)
,fSnp(ref.fSnp)
nclusters[slice]++;
} // End of loop over clusters
- if(AliTRDReconstructor::GetRecoParam()->GetPIDMethod() == AliTRDrecoParam::kLQPID){
+ if(fReconstructor->GetPIDMethod() == AliTRDReconstructor::kLQPID){
// calculate mean charge per slice (only LQ PID)
for(int is=0; is<nslices; is++){
if(nclusters[is]) fdEdx[is] /= nclusters[is];
return 0x0;
}
- const AliTRDrecoParam *rec = AliTRDReconstructor::GetRecoParam();
- if (!rec) {
- AliError("No TRD reco param.");
+ if (!fReconstructor) {
+ AliError("Reconstructor not set.");
return 0x0;
}
// Retrieve the CDB container class with the parametric detector response
- const AliTRDCalPID *pd = calibration->GetPIDObject(rec->GetPIDMethod());
+ const AliTRDCalPID *pd = calibration->GetPIDObject(fReconstructor->GetPIDMethod());
if (!pd) {
AliError("No access to AliTRDCalPID object");
return 0x0;
}
- //AliInfo(Form("Method[%d] : %s", AliTRDReconstructor::GetRecoParam()->GetPIDMethod(), pd->IsA()->GetName()));
+ //AliInfo(Form("Method[%d] : %s", fReconstructor->GetRecoParam() ->GetPIDMethod(), pd->IsA()->GetName()));
// calculate tracklet length TO DO
Float_t length = (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick());
/// TMath::Sqrt((1.0 - fSnp[iPlane]*fSnp[iPlane]) / (1.0 + fTgl[iPlane]*fTgl[iPlane]));
//calculate dE/dx
- CookdEdx(rec->GetNdEdxSlices());
+ CookdEdx(fReconstructor->GetNdEdxSlices());
// Sets the a priori probabilities
for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
cov[0] = sy2;
cov[1] = fTilt*(sy2-sz2);
cov[2] = sz2;
+
+ // insert systematic uncertainties calibration and misalignment
+ Double_t sys[15];
+ fReconstructor->GetRecoParam()->GetSysCovMatrix(sys);
+ cov[0] += (sys[0]*sys[0]);
+ cov[2] += (sys[1]*sys[1]);
}
// debug level 7
//
- if(!AliTRDReconstructor::GetRecoParam()){
+ if(!fReconstructor->GetRecoParam() ){
AliError("Seed can not be used without a valid RecoParam.");
return kFALSE;
}
AliTRDchamberTimeBin *layer = 0x0;
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel()>=7 && c){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker)>=7 && c){
TClonesArray clusters("AliTRDcluster", 24);
clusters.SetOwner(kTRUE);
AliTRDcluster *cc = 0x0;
}
Float_t tquality;
- Double_t kroady = AliTRDReconstructor::GetRecoParam()->GetRoad1y();
+ Double_t kroady = fReconstructor->GetRecoParam() ->GetRoad1y();
Double_t kroadz = fPadLength * .5 + 1.;
// initialize configuration parameters
fZ[iTime] = cl->GetZ();
ncl++;
}
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel()>=7) AliInfo(Form("iter = %d ncl [%d] = %d", iter, fPlane, ncl));
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker)>=7) AliInfo(Form("iter = %d ncl [%d] = %d", iter, fPlane, ncl));
if(ncl>1){
// calculate length of the time bin (calibration aware)
AliTRDseed::Update();
}
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel()>=7) AliInfo(Form("iter = %d nclFit [%d] = %d", iter, fPlane, fN2));
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker)>=7) AliInfo(Form("iter = %d nclFit [%d] = %d", iter, fPlane, fN2));
if(IsOK()){
tquality = GetQuality(kZcorr);
// 6. fit tracklet
//
- if(!AliTRDReconstructor::GetRecoParam()){
+ if(!fReconstructor->GetRecoParam() ){
AliError("Seed can not be used without a valid RecoParam.");
return kFALSE;
}
const Int_t kClusterCandidates = 2 * knTimebins;
//define roads
- Double_t kroady = AliTRDReconstructor::GetRecoParam()->GetRoad1y();
+ Double_t kroady = fReconstructor->GetRecoParam() ->GetRoad1y();
Double_t kroadz = fPadLength * 1.5 + 1.;
// correction to y for the tilting angle
Float_t zcorr = kZcorr ? fTilt * (fZProb - fZref[0]) : 0.;
}
// number of minimum numbers of clusters expected for the tracklet
- Int_t kClmin = Int_t(AliTRDReconstructor::GetRecoParam()->GetFindableClusters()*AliTRDtrackerV1::GetNTimeBins());
+ Int_t kClmin = Int_t(fReconstructor->GetRecoParam() ->GetFindableClusters()*AliTRDtrackerV1::GetNTimeBins());
if (fN2 < kClmin){
AliWarning(Form("Not enough clusters to fit the tracklet %d [%d].", fN2, kClmin));
fN2 = 0;
class AliTRDtrackingChamber;
class AliTRDcluster;
class AliTRDtrackV1;
+class AliTRDReconstructor;
class AliTRDseedV1 : public AliTRDseed
{
void SetPlane(Int_t p) { fPlane = p; }
void SetSnp(Double_t snp) {fSnp = snp;}
void SetTgl(Double_t tgl) {fTgl = tgl;}
-
+ void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
protected:
void Copy(TObject &ref) const;
private:
-
+ const AliTRDReconstructor *fReconstructor;
Int_t fPlane; // TRD plane
Float_t fMom; // Momentum estimate for tracklet [GeV/c]
Float_t fSnp; // sin of track with respect to x direction in XY plane
}
// Retrieve the CDB container class with the probability distributions
- const AliTRDCalPID *pd = calibration->GetPIDObject(fPIDmethod == kNN ? AliTRDrecoParam::kNNPID : AliTRDrecoParam::kLQPID);
+ const AliTRDCalPID *pd = calibration->GetPIDObject(AliTRDReconstructor::kLQPID);
if (!pd) {
AliError("No access to AliTRDCalPID");
return kFALSE;
Double_t cov[3];
trklt->GetCovAt(x, cov);
- // insert systematic uncertainties calibration and misalignment
- Double_t sys[15];
- AliTRDReconstructor::GetRecoParam()->GetSysCovMatrix(sys);
- cov[0] += (sys[0]*sys[0]);
- cov[2] += (sys[1]*sys[1]);
-
if(!AliExternalTrackParam::Update(p, cov)) return kFALSE;
AliTRDcluster *c = 0x0;
const Double_t AliTRDtracker::fgkMaxStep = 2.0; // Maximal step size in propagation
//_____________________________________________________________________________
-AliTRDtracker::AliTRDtracker()
+AliTRDtracker::AliTRDtracker(AliTRDReconstructor *rec)
:AliTracker()
+ ,fReconstructor(rec)
,fGeom(0)
,fNclusters(0)
,fClusters(0)
//_____________________________________________________________________________
AliTRDtracker::AliTRDtracker(const AliTRDtracker &t)
:AliTracker(t)
+ ,fReconstructor(t.fReconstructor)
,fGeom(0)
,fNclusters(0)
,fClusters(0)
}
//_____________________________________________________________________________
-AliTRDtracker::AliTRDtracker(const TFile */*geomfile*/)
+AliTRDtracker::AliTRDtracker(const TFile */*geomfile*/, AliTRDReconstructor *rec)
:AliTracker()
+ ,fReconstructor(rec)
,fGeom(0)
,fNclusters(0)
,fClusters(new TObjArray(2000))
Int_t nSeed = event->GetNumberOfTracks();
if(!nSeed){
// run stand alone tracking
- if (AliTRDReconstructor::GetRecoParam()->IsSeeding()) Clusters2Tracks(event);
+ if (fReconstructor->IsSeeding()) Clusters2Tracks(event);
return 0;
}
// Debug part of tracking
TTreeSRedirector &cstream = *fDebugStreamer;
Int_t eventNrInFile = event->GetEventNumberInFile(); // This is most likely NOT the event number you'd like to use. It has nothing to do with the 'real' event number.
- if (AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 0) {
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0) {
if (track->GetBackupTrack()) {
cstream << "Tracks"
<< "EventNrInFile=" << eventNrInFile
// Add TRD track to ESDfriendTrack - maybe this tracks are
// not useful for post-processing - TODO make decision
- if (AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 0) {
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0) {
seed->AddCalibObject(new AliTRDtrack(*pt2/*, kTRUE*/));
}
delete pt2;
}
// Add TRD track to ESDfriendTrack
- if (AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 0) {
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0) {
seed->AddCalibObject(new AliTRDtrack(*pt/*, kTRUE*/));
}
delete pt;
isFake = kTRUE;
}
- if (AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 0) {
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0) {
if ((!isFake) || ((icl3%10) == 0)) { // Debugging print
TTreeSRedirector &cstream = *fDebugStreamer;
cstream << "Seeds0"
if (1 || (!isFake)) {
Float_t zvertex = GetZ();
TTreeSRedirector &cstream = *fDebugStreamer;
- if (AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 0) {
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0) {
cstream << "Seeds1"
<< "isFake=" << isFake
<< "Vertex=" << zvertex
esdtrack.UpdateTrackParams(track,AliESDtrack::kTRDout);
esdtrack.SetLabel(label);
esd->AddTrack(&esdtrack);
- if (AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 0) {
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0) {
cstream << "Tracks"
<< "EventNrInFile=" << eventNrInFile
<< "ESD.=" << &esdtrack
}
}
- if (AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 0) {
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0) {
cstream << "Seeds2"
<< "Iter=" << jter
<< "Track.=" << track
TGraph graphy(t1-t0,x,yt);
TGraph graphz(t1-t0,x,zt);
- if (AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 0) {
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0) {
cstream << "tracklet"
<< "track.=" << track // Track parameters
<< "tany=" << tany // Tangent of the local track angle
class AliTRDseed;
class AliESDEvent;
class AliTRDpropagationLayer;
+class AliTRDReconstructor;
///////////////////////////////////////////////////////////////////////////////
// //
, kMaxTimeBinIndex = 216
, kTrackingSectors = 18 };
- AliTRDtracker();
+ AliTRDtracker(AliTRDReconstructor *rec = 0x0);
AliTRDtracker(const AliTRDtracker &t);
- AliTRDtracker(const TFile *in);
+ AliTRDtracker(const TFile *in, AliTRDReconstructor *rec = 0x0);
virtual ~AliTRDtracker();
AliTRDtracker &operator=(const AliTRDtracker &/*t*/) { return *this; }
+ void SetReconstructor(AliTRDReconstructor *rec) {fReconstructor = rec;}
void SetAddTRDseeds() { fAddTRDseeds = kTRUE; }
void SetNoTilt() { fNoTilt = kTRUE; }
};
protected:
-
+ AliTRDReconstructor *fReconstructor;
AliTRDgeometry *fGeom; // Pointer to TRD geometry
AliTRDtrackingSector *fTrSec[kTrackingSectors]; // Array of tracking sectors;
Int_t fNclusters; // Number of clusters in TRD
TLinearFitter* AliTRDtrackerV1::fgTiltedRiemanConstrained = 0x0;
//____________________________________________________________________
-AliTRDtrackerV1::AliTRDtrackerV1()
+AliTRDtrackerV1::AliTRDtrackerV1(AliTRDReconstructor *rec)
:AliTracker()
+ ,fReconstructor(rec)
,fGeom(new AliTRDgeometry())
,fClusters(0x0)
,fTracklets(0x0)
if(!fgNTimeBins) fgNTimeBins = trd->GetNumberOfTimeBins();
for (Int_t isector = 0; isector < AliTRDgeometry::kNsector; isector++) new(&fTrSec[isector]) AliTRDtrackingSector(fGeom, isector);
-
+
for(Int_t isl =0; isl<kNSeedPlanes; isl++) fSeedTB[isl] = 0x0;
- TDirectory *savedir = gDirectory;
- fgDebugStreamer = new TTreeSRedirector("TRD.TrackerDebug.root");
- savedir->cd();
+ // Initialize debug stream
+ if(fReconstructor){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){
+ TDirectory *savedir = gDirectory;
+ fgDebugStreamer = new TTreeSRedirector("TRD.TrackerDebug.root");
+ savedir->cd();
+ }
+ }
}
//____________________________________________________________________
// See AliTRDtrackerV1::Clusters2TracksSM() for details.
//
- if(!AliTRDReconstructor::GetRecoParam()){
- AliError("Reconstruction configuration not initialized.");
+ if(!fReconstructor->GetRecoParam() ){
+ AliError("Reconstruction configuration not initialized. Call first AliTRDReconstructor::SetRecoParam().");
return 0;
}
track.UpdateESDtrack(seed);
// Add TRD track to ESDfriendTrack
- if (AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 0 /*&& quality TODO*/){
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0 /*&& quality TODO*/){
AliTRDtrackV1 *calibTrack = new AliTRDtrackV1(track);
calibTrack->SetOwner();
seed->AddCalibObject(calibTrack);
AliInfo(Form("Number of back propagated TRD tracks: %d", found));
// run stand alone tracking
- if (AliTRDReconstructor::GetRecoParam()->IsSeeding()) Clusters2Tracks(event);
+ if (fReconstructor->IsSeeding()) Clusters2Tracks(event);
return 0;
}
return 0;
}
-
//____________________________________________________________________
Int_t AliTRDtrackerV1::FollowProlongation(AliTRDtrackV1 &t)
{
}
}
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 1){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){
Int_t index;
for(int iplane=0; iplane<6; iplane++){
AliTRDseedV1 *tracklet = GetTracklet(&t, iplane, index);
if(!(chamber = fTrSec[sector].GetChamber(stack, ilayer))) continue;
- if(chamber->GetNClusters() < fgNTimeBins*AliTRDReconstructor::GetRecoParam()->GetFindableClusters()) continue;
+ if(chamber->GetNClusters() < fgNTimeBins*fReconstructor->GetRecoParam() ->GetFindableClusters()) continue;
x = chamber->GetX();
if(!tracklet.AttachClustersIter(chamber, 1000.)) continue;
tracklet.Init(&t);
- if(tracklet.GetN() < fgNTimeBins * AliTRDReconstructor::GetRecoParam()->GetFindableClusters()) continue;
+ if(tracklet.GetN() < fgNTimeBins*fReconstructor->GetRecoParam() ->GetFindableClusters()) continue;
break;
}
} // end layers loop
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 1){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){
TTreeSRedirector &cstreamer = *fgDebugStreamer;
Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
//AliTRDtrackV1 *debugTrack = new AliTRDtrackV1(t);
for(Int_t ip = 0; ip < AliTRDtrackerV1::kNPlanes; ip++)
tracklets[ip].SetCC(curvature);
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() >= 5){
+/* if(fReconstructor->GetStreamLevel() >= 5){
//Linear Model on z-direction
Double_t xref = CalculateReferenceX(tracklets); // Relative to the middle of the stack
Double_t slope = fitter->GetParameter(2);
<< "Chi2Z=" << chi2Z
<< "zref=" << zref
<< "\n";
- }
+ }*/
return chi2track;
}
tracklets[iLayer].SetChi2(chi2track);
}
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() >=5){
+/* if(fReconstructor->GetStreamLevel() >=5){
TTreeSRedirector &cstreamer = *fgDebugStreamer;
Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
Int_t candidateNumber = AliTRDtrackerDebug::GetCandidateNumber();
<< "xref=" << xref
<< "Chi2Z=" << chi2z
<< "\n";
- }
+ }*/
return chi2track;
}
}
}
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() >=5){
+/* if(fReconstructor->GetStreamLevel() >=5){
TTreeSRedirector &cstreamer = *fgDebugStreamer;
Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
Int_t candidateNumber = AliTRDtrackerDebug::GetCandidateNumber();
<< "xref=" << xref
<< "Chi2Z=" << chi2z
<< "\n";
- }
+ }*/
return chi2;
}
for(int isector =0; isector<AliTRDgeometry::kNsector; isector++){
if(!fTrSec[isector].GetNChambers()) continue;
- fTrSec[isector].Init();
+ fTrSec[isector].Init(fReconstructor);
}
return 0;
nChambers = 0;
for(int ilayer=0; ilayer<AliTRDgeometry::kNlayer; ilayer++){
if(!(chamber = stack[ilayer])) continue;
- if(chamber->GetNClusters() < fgNTimeBins * AliTRDReconstructor::GetRecoParam()->GetFindableClusters()) continue;
+ if(chamber->GetNClusters() < fgNTimeBins * fReconstructor->GetRecoParam() ->GetFindableClusters()) continue;
nChambers++;
//AliInfo(Form("sector %d stack %d layer %d clusters %d", sector, istack, ilayer, chamber->GetNClusters()));
}
// Build initial seeding configurations
Double_t quality = BuildSeedingConfigs(stack, configs);
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 1){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){
AliInfo(Form("Plane config %d %d %d Quality %f"
, configs[0], configs[1], configs[2], quality));
}
ntracks = MakeSeeds(stack, &sseed[6*ntracks], pars);
if(ntracks == kMaxTracksStack) break;
}
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 1) AliInfo(Form("Candidate TRD tracks %d in iteration %d.", ntracks, fSieveSeeding));
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1) AliInfo(Form("Candidate TRD tracks %d in iteration %d.", ntracks, fSieveSeeding));
if(!ntracks) break;
Int_t ich = 0; while(!(chamber = stack[ich])) ich++;
trackParams[6] = fGeom->GetSector(chamber->GetDetector());/* *alpha+shift; // Supermodule*/
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 1){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){
AliInfo(Form("Track %d [%d] nlayers %d trackQuality = %e nused %d, yref = %3.3f", itrack, trackIndex, nlayers, fTrackQuality[trackIndex], nused, trackParams[1]));
Int_t nclusters = 0;
esdTrack.SetLabel(track->GetLabel());
track->UpdateESDtrack(&esdTrack);
// write ESD-friends if neccessary
- if (AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 0){
+ if (fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 0){
AliTRDtrackV1 *calibTrack = new AliTRDtrackV1(*track);
calibTrack->SetOwner();
esdTrack.AddCalibObject(calibTrack);
// Rebuild plane configurations and indices taking only unused clusters into account
quality = BuildSeedingConfigs(stack, configs);
- if(quality < 1.E-7) break; //AliTRDReconstructor::GetRecoParam()->GetPlaneQualityThreshold()) break;
+ if(quality < 1.E-7) break; //fReconstructor->GetRecoParam() ->GetPlaneQualityThreshold()) break;
for(Int_t ip = 0; ip < kNPlanes; ip++){
if(!(chamber = stack[ip])) continue;
chamber->Build(fGeom);//Indices(fSieveSeeding);
}
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 1){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){
AliInfo(Form("Sieve level %d Plane config %d %d %d Quality %f", fSieveSeeding, configs[0], configs[1], configs[2], quality));
}
} while(fSieveSeeding<10); // end stack clusters sieve
padlength[iplane] = pp->GetLengthIPad();
}
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() > 1){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) > 1){
AliInfo(Form("Making seeds Stack[%d] Config[%d] Tracks[%d]...", istack, config, ntracks));
}
Int_t nlayers = 0;
for(int isl=0; isl<kNSeedPlanes; isl++){
if(!(chamber = stack[planes[isl]])) continue;
- if(!chamber->GetSeedingLayer(fSeedTB[isl], fGeom)) continue;
+ if(!chamber->GetSeedingLayer(fSeedTB[isl], fGeom, fReconstructor)) continue;
nlayers++;
}
if(nlayers < 4) return 0;
FitRieman(c, chi2);
AliTRDseedV1 *tseed = 0x0;
- for(int iLayer=0; iLayer<kNSeedPlanes; iLayer++){
+ for(int iLayer=0; iLayer<kNPlanes; iLayer++){
Int_t jLayer = planes[iLayer];
tseed = &cseed[jLayer];
tseed->SetPlane(jLayer);
tseed->SetTilt(hL[jLayer]);
tseed->SetPadLength(padlength[jLayer]);
- tseed->SetX0(stack[jLayer]->GetX());
+ if(stack[jLayer])tseed->SetX0(stack[jLayer]->GetX());
+ tseed->SetReconstructor(fReconstructor);
tseed->Init(GetRiemanFitter());
}
Bool_t isFake = kFALSE;
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() >= 2){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) >= 2){
if (c[0]->GetLabel(0) != c[3]->GetLabel(0)) isFake = kTRUE;
if (c[1]->GetLabel(0) != c[3]->GetLabel(0)) isFake = kTRUE;
if (c[2]->GetLabel(0) != c[3]->GetLabel(0)) isFake = kTRUE;
<<"\n";
}
- if(chi2[0] > AliTRDReconstructor::GetRecoParam()->GetChi2Z()/*7./(3. - sLayer)*//*iter*/){
+ if(chi2[0] > fReconstructor->GetRecoParam() ->GetChi2Z()/*7./(3. - sLayer)*//*iter*/){
//AliInfo(Form("Failed chi2 filter on chi2Z [%f].", chi2[0]));
AliTRDtrackerDebug::SetCandidateNumber(AliTRDtrackerDebug::GetCandidateNumber() + 1);
continue;
}
- if(chi2[1] > AliTRDReconstructor::GetRecoParam()->GetChi2Y()/*1./(3. - sLayer)*//*iter*/){
+ if(chi2[1] > fReconstructor->GetRecoParam() ->GetChi2Y()/*1./(3. - sLayer)*//*iter*/){
//AliInfo(Form("Failed chi2 filter on chi2Y [%f].", chi2[1]));
AliTRDtrackerDebug::SetCandidateNumber(AliTRDtrackerDebug::GetCandidateNumber() + 1);
continue;
//chi2[1] = GetChi2ZTest(&cseed[0]);
Double_t like = CookLikelihood(&cseed[0], planes, chi2); // to be checked
- if (TMath::Log(1.E-9 + like) < AliTRDReconstructor::GetRecoParam()->GetTrackLikelihood()){
+ if (TMath::Log(1.E-9 + like) < fReconstructor->GetRecoParam() ->GetTrackLikelihood()){
//AliInfo(Form("Failed likelihood %f[%e].", TMath::Log(1.E-9 + like), like));
AliTRDtrackerDebug::SetCandidateNumber(AliTRDtrackerDebug::GetCandidateNumber() + 1);
continue;
for(int iLayer=0; iLayer<2; iLayer++){
Int_t jLayer = lextrap[iLayer];
if(!(chamber = stack[jLayer])) continue;
-
- // prepare extrapolated seed
- cseed[jLayer].Reset();
- cseed[jLayer].SetPlane(jLayer);
- cseed[jLayer].SetTilt(hL[jLayer]);
- cseed[jLayer].SetX0(chamber->GetX());
- cseed[jLayer].SetPadLength(padlength[jLayer]);
// fit extrapolated seed
if ((jLayer == 0) && !(cseed[1].IsOK())) continue;
// AliInfo("Extrapolation done.");
// Debug Stream containing all the 6 tracklets
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() >= 2){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) >= 2){
TTreeSRedirector &cstreamer = *fgDebugStreamer;
TLinearFitter *tiltedRieman = GetTiltedRiemanFitter();
Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
// do the final track fitting (Once with vertex constraint and once without vertex constraint)
Double_t chi2Vals[3];
chi2Vals[0] = FitTiltedRieman(&cseed[0], kFALSE);
- if(AliTRDReconstructor::GetRecoParam()->IsVertexConstrained())
+ if(fReconstructor->GetRecoParam() ->IsVertexConstrained())
chi2Vals[1] = FitTiltedRiemanConstraint(&cseed[0], GetZ()); // Do Vertex Constrained fit if desired
else
chi2Vals[1] = 1.;
cseed[iLayer].SetChi2Z(chi2[1]);
}
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() >= 2){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) >= 2){
TTreeSRedirector &cstreamer = *fgDebugStreamer;
Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
Int_t candidateNumber = AliTRDtrackerDebug::GetCandidateNumber();
Int_t sortindexes[6];
for (Int_t jLayer = 0; jLayer < 6; jLayer++) {
- squality[jLayer] = bseed[jLayer].IsOK() ? bseed[jLayer].GetQuality(kTRUE) : -1.;
+ squality[jLayer] = bseed[jLayer].IsOK() ? bseed[jLayer].GetQuality(kTRUE) : 1000.;
sumquality += squality[jLayer];
}
if ((sumquality >= lastquality) || (chi2 > lastchi2)) break;
}
chi2 = FitTiltedRieman(bseed, kTRUE);
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() >= 7){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) >= 7){
Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
Int_t candidateNumber = AliTRDtrackerDebug::GetCandidateNumber();
TLinearFitter *tiltedRieman = GetTiltedRiemanFitter();
sumdaf /= Float_t (nLayers - 2.0);
Double_t likeChi2Z = TMath::Exp(-chi2[2] * 0.14); // Chi2Z
- Double_t likeChi2TC = (AliTRDReconstructor::GetRecoParam()->IsVertexConstrained()) ?
+ Double_t likeChi2TC = (fReconstructor->GetRecoParam() ->IsVertexConstrained()) ?
TMath::Exp(-chi2[1] * 0.677) : 1; // Constrained Tilted Riemann
Double_t likeChi2TR = TMath::Exp(-chi2[0] * 0.78); // Non-constrained Tilted Riemann
Double_t likeAF = TMath::Exp(-sumdaf * 3.23);
Double_t trackLikelihood = likeChi2Z * likeChi2TR * likeAF;
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() >= 2){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) >= 2){
Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
Int_t candidateNumber = AliTRDtrackerDebug::GetCandidateNumber();
TTreeSRedirector &cstreamer = *fgDebugStreamer;
//
// ratio of the total number of clusters/track which are expected to be found by the tracker.
- Float_t fgFindable = AliTRDReconstructor::GetRecoParam()->GetFindableClusters();
+ Float_t fgFindable = fReconstructor->GetRecoParam() ->GetFindableClusters();
Int_t nclusters = 0;
Double_t like = likea * likechi2y * likechi2z * likeN;
// AliInfo(Form("sumda(%f) chi2[0](%f) chi2[1](%f) likea(%f) likechi2y(%f) likechi2z(%f) nclusters(%d) likeN(%f)", sumda, chi2[0], chi2[1], likea, likechi2y, likechi2z, nclusters, likeN));
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() >= 2){
+ if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) >= 2){
Int_t eventNumber = AliTRDtrackerDebug::GetEventNumber();
Int_t candidateNumber = AliTRDtrackerDebug::GetCandidateNumber();
// The Debug Stream contains the seed
class AliRieman;
class AliESDEvent;
class AliCluster;
+class AliTrackPoint;
class AliTRDcluster;
class AliTRDseedV1;
class AliTRDchamberTimeBin;
class AliTRDtrackerFitter;
class AliTRDtrackV1;
-class AliTrackPoint;
+class AliTRDReconstructor;
class AliTRDtrackerV1 : public AliTracker
{
public:
, kMaxTracksStack = 100
, kNConfigs = 15
};
- AliTRDtrackerV1();
+ AliTRDtrackerV1(AliTRDReconstructor *rec = 0x0);
virtual ~AliTRDtrackerV1();
//temporary
Int_t ReadClusters(TClonesArray* &array, TTree *in) const;
Int_t RefitInward(AliESDEvent *event);
static void SetNTimeBins(Int_t nTimeBins){fgNTimeBins = nTimeBins; }
+ void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;}
void UnloadClusters();
static Int_t Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down); // to be removed
AliTRDseedV1* SetTracklet(AliTRDseedV1 *tracklet);
private:
- AliTRDtrackerV1(const AliTRDtrackerV1 &tracker);
- AliTRDtrackerV1 &operator=(const AliTRDtrackerV1 &tracker);
- Double_t CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4], Double_t *chi2);
- Double_t CalculateTrackLikelihood(AliTRDseedV1 *tracklets, Double_t *chi2);
- Int_t ImproveSeedQuality(AliTRDtrackingChamber **stack, AliTRDseedV1 *tracklet);
- static Float_t CalculateReferenceX(AliTRDseedV1 *tracklets);
- void ResetSeedTB();
- Float_t GetChi2Y(AliTRDseedV1 *tracklets) const;
- Float_t GetChi2Z(AliTRDseedV1 *tracklets) const;
+ AliTRDtrackerV1(const AliTRDtrackerV1 &tracker);
+ AliTRDtrackerV1 &operator=(const AliTRDtrackerV1 &tracker);
+ Double_t CookLikelihood(AliTRDseedV1 *cseed, Int_t planes[4], Double_t *chi2);
+ Double_t CalculateTrackLikelihood(AliTRDseedV1 *tracklets, Double_t *chi2);
+ Int_t ImproveSeedQuality(AliTRDtrackingChamber **stack, AliTRDseedV1 *tracklet);
+ static Float_t CalculateReferenceX(AliTRDseedV1 *tracklets);
+ void ResetSeedTB();
+ Float_t GetChi2Y(AliTRDseedV1 *tracklets) const;
+ Float_t GetChi2Z(AliTRDseedV1 *tracklets) const;
private:
- AliTRDgeometry *fGeom; // Pointer to TRD geometry
- AliTRDtrackingSector fTrSec[kTrackingSectors]; // Array of tracking sectors;
+ const AliTRDReconstructor *fReconstructor; // reconstructor manager
+ AliTRDgeometry *fGeom; // Pointer to TRD geometry
+ AliTRDtrackingSector fTrSec[kTrackingSectors]; // Array of tracking sectors;
TClonesArray *fClusters; // List of clusters
TClonesArray *fTracklets; // List of tracklets
//_______________________________________________________\r
void AliTRDtrackingChamber::InsertCluster(AliTRDcluster *c, Int_t index)\r
{\r
- fTB[c->GetLocalTimeBin()].InsertCluster(c, index);\r
+ fTB[c->GetPadTime()].InsertCluster(c, index);\r
}\r
\r
//_______________________________________________________\r
\r
\r
//_______________________________________________________\r
-Bool_t AliTRDtrackingChamber::GetSeedingLayer(AliTRDchamberTimeBin *&fakeLayer, AliTRDgeometry *geo)\r
+Bool_t AliTRDtrackingChamber::GetSeedingLayer(AliTRDchamberTimeBin *&fakeLayer, AliTRDgeometry *geo, const AliTRDReconstructor *rec)\r
{\r
//\r
// Creates a seeding layer\r
const Int_t kMaxRows = 16;\r
const Int_t kMaxCols = 144;\r
const Int_t kMaxPads = 2304;\r
- Int_t timeBinMin = AliTRDReconstructor::GetRecoParam()->GetNumberOfPresamples();\r
- Int_t timeBinMax = AliTRDReconstructor::GetRecoParam()->GetNumberOfPostsamples();\r
+ Int_t timeBinMin = rec->GetRecoParam()->GetNumberOfPresamples();\r
+ Int_t timeBinMax = rec->GetRecoParam()->GetNumberOfPostsamples();\r
\r
// Get the geometrical data of the chamber\r
Int_t layer = geo->GetLayer(fDetector);\r
TMath::Sort(nPads, hvals, indices); // bins storing a 0 should not matter\r
// Set Threshold\r
Int_t maximum = hvals[indices[0]]; // best\r
- Int_t threshold = Int_t(maximum * AliTRDReconstructor::GetRecoParam()->GetFindableClusters());\r
+ Int_t threshold = Int_t(maximum * rec->GetRecoParam()->GetFindableClusters());\r
Int_t col, row, lower, lower1, upper, upper1;\r
for(Int_t ib = 0; ib < nPads; ib++){\r
if(nCandidates >= AliTRDtrackerV1::kMaxTracksStack){\r
fakeLayer->BuildIndices();\r
//fakeLayer->PrintClusters();\r
\r
- if(AliTRDReconstructor::GetRecoParam()->GetStreamLevel() >= 3){\r
+ if(rec->GetStreamLevel(AliTRDReconstructor::kTracker) >= 3){\r
//TMatrixD hist(nRows, nCols);\r
//for(Int_t i = 0; i < nRows; i++)\r
// for(Int_t j = 0; j < nCols; j++)\r
#endif
class AliTRDgeometry;
-
+class AliTRDReconstructor;
class AliTRDtrackingChamber
{
Int_t GetDetector() const {return fDetector;}
Int_t GetNClusters() const;
Double_t GetQuality();
- Bool_t GetSeedingLayer(AliTRDchamberTimeBin *&layer, AliTRDgeometry *geo);
+ Bool_t GetSeedingLayer(AliTRDchamberTimeBin *&layer, AliTRDgeometry *geo, const AliTRDReconstructor *rec);
Float_t GetX() const {return fX0;}
AliTRDchamberTimeBin* GetTB(int tb) {return tb >= 0 && tb < kNTimeBins ? &fTB[tb] : 0x0;}
void InsertCluster(AliTRDcluster *c, Int_t index);
/**************************************************************************
- * 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. *
- **************************************************************************/
+* 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: AliTRDtrackingSector.cxx 23810 2008-02-08 09:00:27Z hristov $ */
,fN(0)
,fGeom(0x0)
{
- // Default constructor
-
- for(int ic=0; ic<kNChambersSector; ic++){
- fChamber[ic] = 0x0;
- fIndex[ic] = -1;
- }
- for(int il=0; il<AliTRDgeometry::kNlayer; il++) fX0[il] = 0.;
+ // Default constructor
+
+ for(int ic=0; ic<kNChambersSector; ic++){
+ fChamber[ic] = 0x0;
+ fIndex[ic] = -1;
+ }
+ for(int il=0; il<AliTRDgeometry::kNlayer; il++) fX0[il] = 0.;
}
//_____________________________________________________________________________
// AliTRDtrackingSector Constructor
//
- for(int ic=0; ic<kNChambersSector; ic++){
- fChamber[ic] = 0x0;
- fIndex[ic] = -1;
- }
- for(int il=0; il<AliTRDgeometry::kNlayer; il++) fX0[il] = 0.;
+ for(int ic=0; ic<kNChambersSector; ic++){
+ fChamber[ic] = 0x0;
+ fIndex[ic] = -1;
+ }
+ for(int il=0; il<AliTRDgeometry::kNlayer; il++) fX0[il] = 0.;
}
//_____________________________________________________________________________
//
}
-
+
//_____________________________________________________________________________
-void AliTRDtrackingSector::Init()
+void AliTRDtrackingSector::Init(const AliTRDReconstructor *rec)
{
// Steer building of tracking chambers and build tracking sector.
// Propagate radial position information (calibration/alignment aware) from chambers to sector level
//
-
- AliTRDtrackingChamber *tc = 0x0; int ic = 0;
- while((ic<kNChambersSector) && (tc = fChamber[ic++])) tc->Build(fGeom);
-
- Int_t nl;
- for(int il=0; il<AliTRDgeometry::kNlayer; il++){
- fX0[il] = 0.; nl = 0;
- for(int is=0; is<AliTRDgeometry::kNstack; is++){
- Int_t idx = is*AliTRDgeometry::kNlayer + il;
- if(fIndex[idx]<0) continue;
- tc = GetChamber(fIndex[idx]);
- fX0[il] += tc->GetX(); nl++;
- }
- if(!nl){
- //printf("Could not estimate radial position of plane %d in sector %d.\n", ip, fSector);
- continue;
- }
- fX0[il] /= Float_t(nl);
- }
+
+ AliTRDchamberTimeBin *tb = 0x0;
+ AliTRDtrackingChamber *tc = 0x0; int ic = 0;
+ while((ic<kNChambersSector) && (tc = fChamber[ic++])) tc->Build(fGeom);
+
+ Int_t nl;
+ for(int il=0; il<AliTRDgeometry::kNlayer; il++){
+ fX0[il] = 0.; nl = 0;
+ for(int is=0; is<AliTRDgeometry::kNstack; is++){
+ Int_t idx = is*AliTRDgeometry::kNlayer + il;
+ if(fIndex[idx]<0) continue;
+ tc = GetChamber(fIndex[idx]);
+ fX0[il] += tc->GetX(); nl++;
+ for(Int_t itb=0; itb<AliTRDtrackingChamber::kNTimeBins; itb++){
+ if(!(tb = tc->GetTB(itb))) continue;
+ tb->SetReconstructor(rec);
+ }
+ }
+ if(!nl){
+ //printf("Could not estimate radial position of plane %d in sector %d.\n", ip, fSector);
+ continue;
+ }
+ fX0[il] /= Float_t(nl);
+ }
}
+
+
+
//_____________________________________________________________________________
void AliTRDtrackingSector::Clear(const Option_t *opt)
{
// Reset counters and steer chamber clear
- for(Int_t ich=0; ich<fN; ich++){
- fChamber[ich]->Clear(opt);
- delete fChamber[ich]; fChamber[ich] = 0x0; // I would avoid
- }
- for(Int_t ich=0; ich<kNChambersSector; ich++) fIndex[ich] = -1;
- fN = 0;
+ for(Int_t ich=0; ich<fN; ich++){
+ fChamber[ich]->Clear(opt);
+ delete fChamber[ich]; fChamber[ich] = 0x0; // I would avoid
+ }
+ for(Int_t ich=0; ich<kNChambersSector; ich++) fIndex[ich] = -1;
+ fN = 0;
}
//_____________________________________________________________________________
{
// Return chamber at position (stack, plane) in current
// sector or build a new one if it is not already created
-
- Int_t ch = stack*AliTRDgeometry::kNlayer + layer;
- if(fIndex[ch] >= 0) return fChamber[Int_t(fIndex[ch])];
- else if(!build) return 0x0;
-
- // CHAMBER HAS TO BE BUILD
- Int_t rch = ch;do rch--; while(rch>=0 && fIndex[rch]<0);
- fIndex[ch] = rch >=0 ? fIndex[rch]+1 : 0;
- fN++;
-
- memmove(&fChamber[Int_t(fIndex[ch])+1], &fChamber[Int_t(fIndex[ch])], (kNChambersSector-fIndex[ch]-1)*sizeof(void*));
- for(Int_t ic = ch+1; ic<kNChambersSector; ic++) fIndex[ic] += fIndex[ic] >= 0 ? 1 : 0;
-
- return fChamber[Int_t(fIndex[ch])] = new AliTRDtrackingChamber(AliTRDgeometry::GetDetector(layer, stack, fSector));
+
+ Int_t ch = stack*AliTRDgeometry::kNlayer + layer;
+ if(fIndex[ch] >= 0) return fChamber[Int_t(fIndex[ch])];
+ else if(!build) return 0x0;
+
+ // CHAMBER HAS TO BE BUILD
+ Int_t rch = ch;do rch--; while(rch>=0 && fIndex[rch]<0);
+ fIndex[ch] = rch >=0 ? fIndex[rch]+1 : 0;
+ fN++;
+
+ memmove(&fChamber[Int_t(fIndex[ch])+1], &fChamber[Int_t(fIndex[ch])], (kNChambersSector-fIndex[ch]-1)*sizeof(void*));
+ for(Int_t ic = ch+1; ic<kNChambersSector; ic++) fIndex[ic] += fIndex[ic] >= 0 ? 1 : 0;
+
+ return fChamber[Int_t(fIndex[ch])] = new AliTRDtrackingChamber(AliTRDgeometry::GetDetector(layer, stack, fSector));
}
//_____________________________________________________________________________
{
// Return chamber at position (stack, plane) in current
// sector or build a new one if it is not already created
-
- if(stack<0 || stack>=AliTRDgeometry::kNstack) return 0x0;
-
- Int_t ich, n = 0;
- for(int il=0; il<AliTRDgeometry::kNlayer; il++){
- ich = stack*AliTRDgeometry::kNlayer + il;
- if(fIndex[ich] < 0) fStack[il] = 0x0;
- else{
- fStack[il] = fChamber[Int_t(fIndex[ich])];
- n++;
- }
- }
-
- return n ? &fStack[0] : 0x0;
+
+ if(stack<0 || stack>=AliTRDgeometry::kNstack) return 0x0;
+
+ Int_t ich, n = 0;
+ for(int il=0; il<AliTRDgeometry::kNlayer; il++){
+ ich = stack*AliTRDgeometry::kNlayer + il;
+ if(fIndex[ich] < 0) fStack[il] = 0x0;
+ else{
+ fStack[il] = fChamber[Int_t(fIndex[ich])];
+ n++;
+ }
+ }
+
+ return n ? &fStack[0] : 0x0;
}
//_____________________________________________________________________________
// Dump info about this tracking sector and the tracking chamber within
//
- printf("\tSector %2d\n", fSector);
- for(int il=0; il<6; il++){
- for(int is =0; is<5; is++){
- Int_t ch = is*AliTRDgeometry::kNlayer + il;
- printf("%2d[%2d] ", fIndex[ch], fIndex[ch]>=0 ? fChamber[Int_t(fIndex[ch])]->GetNClusters() : 0);
- }
- printf("\n");
- }
+ printf("\tSector %2d\n", fSector);
+ for(int il=0; il<6; il++){
+ for(int is =0; is<5; is++){
+ Int_t ch = is*AliTRDgeometry::kNlayer + il;
+ printf("%2d[%2d] ", fIndex[ch], fIndex[ch]>=0 ? fChamber[Int_t(fIndex[ch])]->GetNClusters() : 0);
+ }
+ printf("\n");
+ }
}
class AliTRDtrackingChamber;
class AliTRDgeometry;
-
+class AliTRDReconstructor;
class AliTRDtrackingSector
{
AliTRDtrackingChamber** GetStack(Int_t stack);
Int_t GetSector() const {return fSector;}
- void Init();
+ void Init(const AliTRDReconstructor *rec);
void Print(Option_t *opt = 0x0);
void SetGeometry(AliTRDgeometry *geo) {fGeom = geo;}