// //
///////////////////////////////////////////////////////////////////////////////
+#include "AliTRDReconstructor.h"
#include "AliTRDtrackingSector.h"
-#include "AliTRDcalibDB.h"
-#include "AliTRDCommonParam.h"
-#include "AliTRDgeometry.h"
-#include "AliTRDpadPlane.h"
#include "AliTRDtrackingChamber.h"
+
ClassImp(AliTRDtrackingSector)
//_____________________________________________________________________________
AliTRDtrackingSector::AliTRDtrackingSector()
:fSector(-1)
,fN(0)
- ,fGeom(0x0)
+ ,fGeom(NULL)
{
// 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.;
+ memset(fChamber, 0, AliTRDgeometry::kNdets*sizeof(AliTRDtrackingChamber*));
+ memset(fStack, 0, AliTRDgeometry::kNlayer*sizeof(AliTRDtrackingChamber*));
+ memset(fIndex, -1, AliTRDgeometry::kNdets*sizeof(Char_t));
+ memset(fX0, 0, AliTRDgeometry::kNlayer*sizeof(Float_t));
}
//_____________________________________________________________________________
// 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.;
+ memset(fChamber, 0, AliTRDgeometry::kNdets*sizeof(AliTRDtrackingChamber*));
+ memset(fStack, 0, AliTRDgeometry::kNlayer*sizeof(AliTRDtrackingChamber*));
+ memset(fIndex, -1, AliTRDgeometry::kNdets*sizeof(Char_t));
+ memset(fX0, 0, AliTRDgeometry::kNlayer*sizeof(Float_t));
}
-//_____________________________________________________________________________
-AliTRDtrackingSector::AliTRDtrackingSector(const AliTRDtrackingSector &/*t*/)
- :fSector(-1)
- ,fN(0)
- ,fGeom(0x0)
-{
- //
- // Copy constructor
- //
-
-}
-
-//_____________________________________________________________________________
-AliTRDtrackingSector::~AliTRDtrackingSector()
-{
- //
- // Destructor
- //
-
-}
//_____________________________________________________________________________
void AliTRDtrackingSector::Init(const AliTRDReconstructor *rec)
// Propagate radial position information (calibration/alignment aware) from chambers to sector level
//
- AliTRDchamberTimeBin *tb = 0x0;
- AliTRDtrackingChamber *tc = 0x0; int ic = 0;
- while((ic<kNChambersSector) && (tc = fChamber[ic++])) tc->Build(fGeom);
+ AliTRDchamberTimeBin *tb = NULL;
+ AliTRDtrackingChamber **tc = &fChamber[0];
+ for(Int_t ic = 0; (ic<AliTRDgeometry::kNdets) && (*tc); ic++, tc++){
+ for(Int_t itb=0; itb<AliTRDseedV1::kNtb; itb++){
+ if(!(tb = (*tc)->GetTB(itb))) continue;
+ tb->SetReconstructor(rec);
+ }
+ (*tc)->Build(fGeom, rec->IsHLT());
+ }
Int_t nl;
for(int il=0; il<AliTRDgeometry::kNlayer; il++){
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);
- }
+ fX0[il] += GetChamber(fIndex[idx])->GetX();
+ nl++;
}
if(!nl){
//printf("Could not estimate radial position of plane %d in sector %d.\n", ip, fSector);
{
// 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
+ AliTRDtrackingChamber **tc = &fChamber[0];
+ for(Int_t ich=0; ich<fN; ich++, tc++){
+ (*tc)->Clear(opt);
+ delete (*tc); (*tc) = NULL; // I would avoid
}
- for(Int_t ich=0; ich<kNChambersSector; ich++) fIndex[ich] = -1;
+ memset(fIndex, -1, AliTRDgeometry::kNdets*sizeof(Char_t));
fN = 0;
}
Int_t ch = stack*AliTRDgeometry::kNlayer + layer;
if(fIndex[ch] >= 0) return fChamber[Int_t(fIndex[ch])];
- else if(!build) return 0x0;
+ else if(!build) return NULL;
// 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;
+ memmove(&fChamber[Int_t(fIndex[ch])+1], &fChamber[Int_t(fIndex[ch])], (AliTRDgeometry::kNdets-fIndex[ch]-1)*sizeof(void*));
+ for(Int_t ic = ch+1; ic<AliTRDgeometry::kNdets; ic++) fIndex[ic] += fIndex[ic] >= 0 ? 1 : 0;
- return fChamber[Int_t(fIndex[ch])] = new AliTRDtrackingChamber(AliTRDgeometry::GetDetector(layer, stack, fSector));
+ AliTRDtrackingChamber *chmb = fChamber[Int_t(fIndex[ch])] = new AliTRDtrackingChamber();
+ chmb->SetDetector(AliTRDgeometry::GetDetector(layer, stack, fSector));
+ return chmb;
}
//_____________________________________________________________________________
// 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;
+ if(stack<0 || stack>=AliTRDgeometry::kNstack) return NULL;
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;
+ if(fIndex[ich] < 0) fStack[il] = NULL;
else{
fStack[il] = fChamber[Int_t(fIndex[ich])];
n++;
}
}
- return n ? &fStack[0] : 0x0;
+ return n ? &fStack[0] : NULL;
}
//_____________________________________________________________________________
-void AliTRDtrackingSector::Print(Option_t *)
+void AliTRDtrackingSector::Print(Option_t *opt) const
{
// 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++){
+ printf("\n\tSector[%2d]\n", fSector);
+ for(int il=0; il<AliTRDgeometry::kNlayer; il++){
+ for(int is =0; is<AliTRDgeometry::kNstack; is++){
Int_t ch = is*AliTRDgeometry::kNlayer + il;
- printf("%2d[%2d] ", fIndex[ch], fIndex[ch]>=0 ? fChamber[Int_t(fIndex[ch])]->GetNClusters() : 0);
+ if(opt) fChamber[Int_t(fIndex[ch])]->Print(opt);
+ else printf("%2d[%2d] ", fIndex[ch], fIndex[ch]>=0 ? fChamber[Int_t(fIndex[ch])]->GetNClusters() : 0);
}
- printf("\n");
+ if(!opt) printf("\n");
}
}