#include <TGeoVolume.h>
#include <TGeoTube.h>
#include <TGeoManager.h>
+#include <TTree.h>
#include "AliITSURecoDet.h"
#include "AliITSUGeomTGeo.h"
#include "AliITSsegmentation.h"
#include "AliITSUSegmentationPix.h"
+#include "AliITSUClusterPix.h"
#include "AliITSUReconstructor.h"
+
ClassImp(AliITSURecoDet)
,fNLayersActive(0)
,fRMax(-1)
,fRMin(-1)
+ ,fRITSTPCRef(-1)
,fLayers(0)
,fLayersActive(0)
,fGeom(geom)
//print
printf("Detector %s, %d layers, %d active layers\n",GetName(),GetNLayers(),GetNLayersActive());
TString opts = opt; opts.ToLower();
- if (opts.Contains("lr")) for (int i=0;i<GetNLayers();i++) GetLayer(i)->Print(opt);
+ if (opts.Contains("lr")) {
+ for (int i=0;i<GetNLayers();i++) GetLayer(i)->Print(opt);
+ printf("ITS-TPC matching reference R: %.3f\n",fRITSTPCRef);
+ }
}
//______________________________________________________
//
// build active ITS layers
for (int ilr=0;ilr<nlr;ilr++) {
- int lrTyp = fGeom->GetLayerDetTypeID(ilr);
+ int lrTyp = fGeom->GetLayerChipTypeID(ilr);
// name layer according its active id, detector type and segmentation tyoe
- AliITSURecoLayer* lra = new AliITSURecoLayer(Form("Lr%d%s%d",ilr,fGeom->GetDetTypeName(lrTyp),
- lrTyp%AliITSUGeomTGeo::kMaxSegmPerDetType),
+ AliITSURecoLayer* lra = new AliITSURecoLayer(Form("Lr%d%s%d",ilr,fGeom->GetChipTypeName(lrTyp),
+ lrTyp%AliITSUGeomTGeo::kMaxSegmPerChipType),
ilr,fGeom);
lra->SetPassive(kFALSE);
AddLayer(lra);
TGeoVolume *v = gGeoManager->GetVolume(fgkBeamPipeVolName);
AliITSURecoLayer* lrp = 0;
if (!v) AliWarning("No beam pipe found in geometry");
- {
+ else {
TGeoTube *t=(TGeoTube*)v->GetShape();
rMin = t->GetRmin();
rMax = t->GetRmax();
}
//
// TPC-ITS wall
- lrp = new AliITSURecoLayer("TPC-ITSwall");
- lrp->SetRMin(AliITSUReconstructor::GetRecoParam()->GetTPCITSWallRMin());
- lrp->SetRMax(AliITSUReconstructor::GetRecoParam()->GetTPCITSWallRMax());
- lrp->SetR(0.5*(lrp->GetRMin()+lrp->GetRMax()));
- lrp->SetZMin(-AliITSUReconstructor::GetRecoParam()->GetTPCITSWallZSpanH());
- lrp->SetZMax( AliITSUReconstructor::GetRecoParam()->GetTPCITSWallZSpanH());
- lrp->SetMaxStep( AliITSUReconstructor::GetRecoParam()->GetTPCITSWallMaxStep());
- lrp->SetPassive(kTRUE);
- AddLayer(lrp);
+ const AliITSURecoParam* recopar = AliITSUReconstructor::GetRecoParam();
+ if (recopar) {
+ lrp = new AliITSURecoLayer("TPC-ITSwall");
+ lrp->SetRMin(AliITSUReconstructor::GetRecoParam()->GetTPCITSWallRMin());
+ lrp->SetRMax(AliITSUReconstructor::GetRecoParam()->GetTPCITSWallRMax());
+ lrp->SetR(0.5*(lrp->GetRMin()+lrp->GetRMax()));
+ lrp->SetZMin(-AliITSUReconstructor::GetRecoParam()->GetTPCITSWallZSpanH());
+ lrp->SetZMax( AliITSUReconstructor::GetRecoParam()->GetTPCITSWallZSpanH());
+ lrp->SetMaxStep( AliITSUReconstructor::GetRecoParam()->GetTPCITSWallMaxStep());
+ lrp->SetPassive(kTRUE);
+ AddLayer(lrp);
+ }
+ else {
+ AliWarning("RecoParam is not available, TPC-ITS wall is not set");
+ }
//
IndexLayers();
Print("lr");
SetRMin(GetLayer(0)->GetRMin()-kRMargin);
SetRMax(GetLayer(fNLayers-1)->GetRMax()+kRMargin);
}
+ //
+ // define the reference R for ITS/TPC matching: outside of last layer but before TPC materials
+ const double kOffsLastActR = 5.; // offset of reference layer wrt last active R
+ int lastActive = GetLrIDActive(fNLayersActive-1);
+ AliITSURecoLayer* lrA = GetLayer(lastActive); // last active
+ double rref = lrA->GetRMax() + kOffsLastActR;
+ //
+ if (lastActive < fNLayers-1) { // there are material layers outside ...
+ AliITSURecoLayer* lrL = GetLayer(lastActive+1);
+ if (lrL->GetRMin()<=rref) rref = lrL->GetRMin();
+ if (rref - lrA->GetRMax()<kOffsLastActR) {
+ AliError(Form("The ITS-TPC matching reference R=%.2f is too close to last active R=%.3f",rref,lrA->GetRMax()));
+ }
+ }
+ SetRITSTPCRef(rref);
+ //
}
//______________________________________________________
}
//
}
+
+//______________________________________________________
+void AliITSURecoDet::CreateClusterArrays()
+{
+ // create cluster arrays for active layers
+ for (int ilr=0;ilr<fNLayersActive;ilr++) {
+ AliITSURecoLayer* lr = GetLayerActive(ilr);
+ lr->SetOwnsClusterArray(kTRUE);
+ int tpDet = fGeom->GetLayerChipTypeID(ilr)/AliITSUGeomTGeo::kMaxSegmPerChipType;
+ //
+ if (tpDet == AliITSUGeomTGeo::kChipTypePix) {
+ lr->SetClusters(new TClonesArray(AliITSUClusterPix::Class()));
+ }
+ else {
+ AliFatal(Form("Unknown detector type %d",tpDet));
+ }
+ //
+ }
+ //
+}
+
+//_____________________________________________________________________________
+Int_t AliITSURecoDet::LoadClusters(TTree* treeRP)
+{
+ // read clusters from the tree, if it is provided
+ if (!treeRP) return 0;
+ for (int ilr=fNLayersActive;ilr--;) {
+ TBranch* br = treeRP->GetBranch(Form("ITSRecPoints%d",ilr));
+ if (!br) AliFatal(Form("Provided cluster tree does not contain branch for layer %d",ilr));
+ br->SetAddress( GetLayerActive(ilr)->GetClustersAddress() );
+ }
+ return treeRP->GetEntry(0); // we are still in 1 ev/tree mode...
+}