#include "AliITSUDigitPix.h"
#include "AliITSUClusterizer.h"
#include "AliITSUClusterPix.h"
+#include "AliMagF.h"
ClassImp(AliITSUReconstructor)
//___________________________________________________________________________
AliITSUReconstructor::AliITSUReconstructor()
: AliReconstructor()
- ,fGM(0)
+ ,fGeom(0)
,fClusterFinders(0)
- ,fRecPoints(0)
+ ,fClusters(0)
{
// Default constructor
{
// destructor
//
- if (!fGM) return; // was not initialized
+ if (!fGeom) return; // was not initialized
//
// same cluster finders and recpoint arrays might be attached to different layers
- for (int i=fGM->GetNLayers();i--;) {
+ for (int i=fGeom->GetNLayers();i--;) {
TObject* clFinder = fClusterFinders.At(i);
if (clFinder) {
while (fClusterFinders.Remove(clFinder)) {}
delete clFinder;
}
//
- TObject* arrRP = fRecPoints.At(i);
- if (arrRP) {
- while (fRecPoints.Remove(arrRP)) {}
- delete arrRP;
- }
+ delete[] fClusters;
}
//
- delete fGM;
+ delete fGeom;
}
//______________________________________________________________________
void AliITSUReconstructor::Init()
{
// Initalize this constructor
- if (fGM) AliFatal("was already done, something is wrong...");
+ AliInfo("Initializing");
+ if (fGeom) AliFatal("was already done, something is wrong...");
//
- fGM = new AliITSUGeomTGeo(kTRUE,kTRUE);
- AliITSUClusterPix::SetGeom(fGM);
+ fGeom = new AliITSUGeomTGeo(kTRUE,kTRUE);
+ AliITSUClusterPix::SetGeom(fGeom);
//
AliITSUClusterizer* clusPIX = 0;
- TClonesArray* rpArrayPix = 0;
+ fClusters = new TClonesArray*[fGeom->GetNLayers()];
//
- for (int ilr=fGM->GetNLayers();ilr--;) {
- int tpDet = fGM->GetLayerDetTypeID(ilr)/AliITSUGeomTGeo::kMaxSegmPerDetType;
+ for (int ilr=fGeom->GetNLayers();ilr--;) {
+ fClusters[ilr] = 0;
+ int tpDet = fGeom->GetLayerDetTypeID(ilr)/AliITSUGeomTGeo::kMaxSegmPerDetType;
if (tpDet == AliITSUGeomTGeo::kDetTypePix) {
if (!clusPIX) clusPIX = new AliITSUClusterizer();
- if (!rpArrayPix) rpArrayPix = new TClonesArray(AliITSUClusterPix::Class());
- //
fClusterFinders.AddAtAndExpand(clusPIX, ilr);
- fRecPoints.AddAtAndExpand(rpArrayPix, ilr);
+ fClusters[ilr] = new TClonesArray(AliITSUClusterPix::Class());
//
// to expand the buffers to max.size
- clusPIX->SetSegmentation((AliITSUSegmentationPix*)fGM->GetSegmentation(ilr));
+ clusPIX->SetSegmentation((AliITSUSegmentationPix*)fGeom->GetSegmentation(ilr));
continue;
}
else {
digitsTree->SetBranchAddress("ITSDigitsPix",&digArrPix);
//
// a new tree is created for each event: add each layer as separate branch
- TBranch *lrBranch[fGM->GetNLayers()];
- TClonesArray *rpClones[fGM->GetNLayers()];
+ TBranch *lrBranch[fGeom->GetNLayers()];
//
- for (int ilr=0;ilr<fGM->GetNLayers();ilr++) {
- rpClones[ilr] = (TClonesArray*)fRecPoints.At(ilr);
+ for (int ilr=0;ilr<fGeom->GetNLayers();ilr++) {
if (clustersTree) { // do we write clusters tree?
- int tp = fGM->GetLayerDetTypeID(ilr)/AliITSUGeomTGeo::kMaxSegmPerDetType;
+ int tp = fGeom->GetLayerDetTypeID(ilr)/AliITSUGeomTGeo::kMaxSegmPerDetType;
if (tp==AliITSUGeomTGeo::kDetTypePix) {
- lrBranch[ilr] = clustersTree->Bronch(Form("ITSRecPoints%d",ilr),"TClonesArray",&rpClones[ilr]);
+ lrBranch[ilr] = clustersTree->Bronch(Form("ITSRecPoints%d",ilr),"TClonesArray",&fClusters[ilr]);
}
else {
AliFatal(Form("Detector type %d is not defined",tp));
}
//
AliITSUClusterizer* clFinder = 0;
+ AliMagF* field = dynamic_cast<AliMagF*>(TGeoGlobalMagField::Instance()->GetField());
+ double bz = 0;
+ if (field == 0) AliError("Cannot get magnetic field from TGeoGlobalMagField");
+ else bz = field->SolenoidField();
//
- for (int ilr=0;ilr<fGM->GetNLayers();ilr++) {
+ for (int ilr=0;ilr<fGeom->GetNLayers();ilr++) {
//
- rpClones[ilr]->Clear();
+ fClusters[ilr]->Clear();
clFinder = (AliITSUClusterizer*)fClusterFinders[ilr];
- clFinder->SetSegmentation((AliITSUSegmentationPix*)fGM->GetSegmentation(ilr));
- clFinder->SetClusters(rpClones[ilr]);
+ clFinder->SetSegmentation((AliITSUSegmentationPix*)fGeom->GetSegmentation(ilr));
+ clFinder->SetLayerID(ilr);
+ clFinder->SetClusters(fClusters[ilr]);
clFinder->SetRecoParam(GetRecoParam()); // RS: Do we need to set it for every event?
+ clFinder->PrepareLorentzAngleCorrection(bz);
//
- int modF=fGM->GetFirstModIndex(ilr);
- int modL=fGM->GetLastModIndex(ilr)+1;
+ int modF=fGeom->GetFirstModIndex(ilr);
+ int modL=fGeom->GetLastModIndex(ilr)+1;
for (int imod=modF;imod<modL;imod++) {
digitsTree->GetEntry(imod);
int ndig = digArrPix->GetEntries();
}
//
AliITSUClusterPix::SetSortMode( AliITSUClusterPix::SortModeIdTrkYZ());
- rpClones[ilr]->Sort();
- AliDebug(1,Form(" -> Lr%d : %d Cluster",ilr,rpClones[ilr]->GetEntries()));
+ fClusters[ilr]->Sort();
+ AliDebug(1,Form(" -> Lr%d : %d Cluster",ilr,fClusters[ilr]->GetEntries()));
if (clustersTree) lrBranch[ilr]->Fill();
}
if (clustersTree) clustersTree->SetEntries();
}
+//_____________________________________________________________________________
+Int_t AliITSUReconstructor::LoadClusters(TTree* treeRP)
+{
+ // read clusters from the tree, if it is provided
+ if (!treeRP) return 0;
+ for (int ilr=fGeom->GetNLayers();ilr--;) {
+ if (!fClusters[ilr]) AliFatal(Form("Clusters array for layer %d is not defined",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(&fClusters[ilr]);
+ }
+ treeRP->GetEntry(0); // we are still in 1 ev/tree mode...
+ return 1;
+}
public:
AliITSUReconstructor();
virtual ~AliITSUReconstructor();
- virtual void Init();
- virtual void Reconstruct(TTree *digitsTree, TTree *clustersTree) const;
- virtual void Reconstruct(AliRawReader*, TTree*) const {};
-
- virtual AliTracker* CreateTracker() const;
- virtual AliVertexer* CreateVertexer() const;
+ virtual void Init();
+ virtual void Reconstruct(TTree *digitsTree, TTree *clustersTree) const;
+ virtual void Reconstruct(AliRawReader*, TTree*) const {};
+ //
+ virtual AliTracker* CreateTracker() const;
+ virtual AliVertexer* CreateVertexer() const;
virtual AliTrackleter* CreateMultFinder() const;
virtual AliTracker* CreateTrackleter() const;
-
+ //
virtual const char* GetDetectorName() const {return "ITS";}
+ //
+ TClonesArray* GetClusters(Int_t lrID) const {return fClusters ? fClusters[lrID] : 0;}
+ AliITSUGeomTGeo* GetGeom() const {return (AliITSUGeomTGeo*)fGeom;}
+ //
+ Int_t LoadClusters(TTree* treeRP);
+ //
static const AliITSURecoParam* GetRecoParam() {
return dynamic_cast<const AliITSURecoParam*>(AliReconstructor::GetRecoParam(0)); }
private:
AliITSUReconstructor(const AliITSUReconstructor &); //Not implemented
AliITSUReconstructor& operator=(const AliITSUReconstructor &); //Not implemented
-
- AliITSUGeomTGeo* fGM; // geometry wrapper
+ AliITSUGeomTGeo* fGeom; // geometry wrapper
TObjArray fClusterFinders; // array of clusterfinders per layer
- TObjArray fRecPoints; // container for recpoints TClonesArrays
+ TClonesArray** fClusters; // container for recpoints TClonesArrays
//
ClassDef(AliITSUReconstructor, 0) // class for the ITSU reconstruction
};