From 6cae184e0a28e9a5727fa419f59cb6923c03ddb2 Mon Sep 17 00:00:00 2001 From: hristov Date: Tue, 7 Aug 2007 11:43:46 +0000 Subject: [PATCH] Implementation of single event reconstruction. Removal of the run loaders from the ITS reconstruction (Cvetan) --- ITS/AliITSClusterFinderSDD.cxx | 1 + ITS/AliITSClusterFinderSDD.h | 2 + ITS/AliITSClusterFinderSPD.cxx | 1 + ITS/AliITSClusterFinderSSD.cxx | 2 +- ITS/AliITSDetTypeRec.cxx | 295 ++++++--------------------------- ITS/AliITSDetTypeRec.h | 43 ++--- ITS/AliITSNeuralTracker.h | 4 +- ITS/AliITSReconstructor.cxx | 110 +++--------- ITS/AliITSReconstructor.h | 27 +-- ITS/AliITSVertexer3D.h | 2 +- ITS/AliITSVertexerIons.cxx | 1 + ITS/AliITSVertexerZ.cxx | 1 + ITS/AliITSreconstruction.cxx | 16 +- ITS/AliITSreconstruction.h | 1 + STEER/AliReconstruction.cxx | 4 + 15 files changed, 124 insertions(+), 386 deletions(-) diff --git a/ITS/AliITSClusterFinderSDD.cxx b/ITS/AliITSClusterFinderSDD.cxx index 41115ba683c..d6820112aed 100644 --- a/ITS/AliITSClusterFinderSDD.cxx +++ b/ITS/AliITSClusterFinderSDD.cxx @@ -30,6 +30,7 @@ #include "AliITSDetTypeRec.h" #include "AliITSCalibrationSDD.h" #include "AliITSsegmentationSDD.h" +#include "AliITSgeom.h" #include "AliLog.h" ClassImp(AliITSClusterFinderSDD) diff --git a/ITS/AliITSClusterFinderSDD.h b/ITS/AliITSClusterFinderSDD.h index 6612bcf9d73..6da4ccde851 100644 --- a/ITS/AliITSClusterFinderSDD.h +++ b/ITS/AliITSClusterFinderSDD.h @@ -8,6 +8,8 @@ $Id$ */ +#include + #include "AliITSClusterFinder.h" #include "AliITSDetTypeRec.h" diff --git a/ITS/AliITSClusterFinderSPD.cxx b/ITS/AliITSClusterFinderSPD.cxx index 9d6ab86fd37..16a580589f8 100644 --- a/ITS/AliITSClusterFinderSPD.cxx +++ b/ITS/AliITSClusterFinderSPD.cxx @@ -24,6 +24,7 @@ #include "AliITSRecPoint.h" #include "AliITSdigitSPD.h" #include "AliITSsegmentationSPD.h" +#include "AliITSgeom.h" #include "AliLog.h" //#define DEBUG diff --git a/ITS/AliITSClusterFinderSSD.cxx b/ITS/AliITSClusterFinderSSD.cxx index f7224f82a08..b818d81f62b 100644 --- a/ITS/AliITSClusterFinderSSD.cxx +++ b/ITS/AliITSClusterFinderSSD.cxx @@ -32,7 +32,7 @@ #include "AliITSclusterSSD.h" #include "AliITSpackageSSD.h" #include "AliITSsegmentationSSD.h" -//#include "AliITSgeom.h" +#include "AliITSgeom.h" #include "AliITSCalibrationSSD.h" #include "AliLog.h" diff --git a/ITS/AliITSDetTypeRec.cxx b/ITS/AliITSDetTypeRec.cxx index 345dba92a9d..0239d6f0cc8 100644 --- a/ITS/AliITSDetTypeRec.cxx +++ b/ITS/AliITSDetTypeRec.cxx @@ -37,6 +37,7 @@ #include "AliITSClusterFinderSDD.h" #include "AliITSClusterFinderSSD.h" #include "AliITSDetTypeRec.h" +#include "AliITSgeom.h" #include "AliITSRawCluster.h" #include "AliITSRawClusterSPD.h" #include "AliITSRawClusterSDD.h" @@ -59,6 +60,7 @@ ClassImp(AliITSDetTypeRec) //________________________________________________________________ AliITSDetTypeRec::AliITSDetTypeRec(): TObject(), fNMod(0), +fITSgeom(0), fReconstruction(0), fSegmentation(0), fCalibration(0), @@ -71,44 +73,6 @@ fNctype(0), fRecPoints(0), fNRecPoints(0), fSelectedVertexer(), -fLoader(0), -fRunNumber(0), -fFirstcall(kTRUE){ - // Default Constructor - // Inputs: - // none. - // Outputs: - // none. - // Return: - // A properly zero-ed AliITSDetTypeRec class. - - for(Int_t i=0; i<3; i++){ - fClusterClassName[i]=0; - fDigClassName[i]=0; - fRecPointClassName[i]=0; - } - - SelectVertexer(" "); - - -} -//________________________________________________________________ -AliITSDetTypeRec::AliITSDetTypeRec(AliITSLoader *loader): TObject(), -fNMod(0), -fReconstruction(0), -fSegmentation(0), -fCalibration(0), -fPreProcess(0), -fPostProcess(0), -fDigits(0), -fNdtype(0), -fCtype(0), -fNctype(0), -fRecPoints(0), -fNRecPoints(0), -fSelectedVertexer(), -fLoader(loader), -fRunNumber(0), fFirstcall(kTRUE){ // Standard Constructor // Inputs: @@ -141,12 +105,12 @@ fFirstcall(kTRUE){ } SelectVertexer(" "); - SetRunNumber(); } //______________________________________________________________________ AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec & rec):TObject(rec), fNMod(rec.fNMod), +fITSgeom(rec.fITSgeom), fReconstruction(rec.fReconstruction), fSegmentation(rec.fSegmentation), fCalibration(rec.fCalibration), @@ -159,8 +123,6 @@ fNctype(rec.fNctype), fRecPoints(rec.fRecPoints), fNRecPoints(rec.fNRecPoints), fSelectedVertexer(rec.fSelectedVertexer), -fLoader(rec.fLoader), -fRunNumber(rec.fRunNumber), fFirstcall(rec.fFirstcall) { @@ -179,7 +141,7 @@ AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& source){ //_____________________________________________________________________ AliITSDetTypeRec::~AliITSDetTypeRec(){ //Destructor - + if(fReconstruction){ fReconstruction->Delete(); delete fReconstruction; @@ -190,7 +152,7 @@ AliITSDetTypeRec::~AliITSDetTypeRec(){ delete fSegmentation; fSegmentation = 0; } - if(fCalibration && fRunNumber<0){ + if(fCalibration){ AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD()))->GetResponse(); AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSDD()))->GetResponse(); AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD()))->GetResponse(); @@ -222,8 +184,9 @@ AliITSDetTypeRec::~AliITSDetTypeRec(){ delete [] fNctype; delete [] fNdtype; delete [] fNMod; - //if(fLoader) delete fLoader; // MvL: Loader is not owned by this class; do not delete + if (fITSgeom) delete fITSgeom; + } //___________________________________________________________________ @@ -296,16 +259,6 @@ AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){ return (AliITSCalibration*)fCalibration->At(iMod); } -//______________________________________________________________________ -void AliITSDetTypeRec::SetTreeAddress(){ - // Set branch address for the Trees. - - TTree *treeR = fLoader->TreeR(); - TTree *treeD = fLoader->TreeD(); - - SetTreeAddressD(treeD); - SetTreeAddressR(treeR); -} //______________________________________________________________________ void AliITSDetTypeRec::SetTreeAddressD(TTree *treeD){ // Set branch address for the tree of digits. @@ -338,7 +291,7 @@ void AliITSDetTypeRec::SetTreeAddressD(TTree *treeD){ TBranch* AliITSDetTypeRec::MakeBranchInTree(TTree *tree, const char* name, const char *classname, void* address,Int_t size, - Int_t splitlevel, const char */*file*/) + Int_t splitlevel) { // // Makes branch in given tree and diverts them to a separate file @@ -419,26 +372,22 @@ Bool_t AliITSDetTypeRec::GetCalibration() { fFirstcall = kFALSE; } - SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun()); - Int_t run=GetRunNumber(); + // SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun()); + // Int_t run=GetRunNumber(); - Bool_t origCacheStatus = AliCDBManager::Instance()->GetCacheFlag(); - Bool_t isCacheActive = kTRUE; - if(GetRunNumber()<0)isCacheActive=kFALSE; + Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag(); if (fCalibration==0) { fCalibration = new TObjArray(GetITSgeom()->GetIndexMax()); - fCalibration->SetOwner(isCacheActive); + fCalibration->SetOwner(!cacheStatus); fCalibration->Clear(); } - AliCDBManager::Instance()->SetCacheFlag(isCacheActive); - - AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", run); - AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", run); - AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", run); - AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", run); - AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", run); - AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", run); + AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD"); + AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD"); + AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD"); + AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD"); + AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD"); + AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD"); if(!entrySPD || !entrySDD || !entrySSD || !entry2SPD || !entry2SDD || !entry2SSD){ AliFatal("Calibration object retrieval failed! "); @@ -446,31 +395,31 @@ Bool_t AliITSDetTypeRec::GetCalibration() { } TObjArray *calSPD = (TObjArray *)entrySPD->GetObject(); - if(!isCacheActive)entrySPD->SetObject(NULL); + if(!cacheStatus)entrySPD->SetObject(NULL); entrySPD->SetOwner(kTRUE); AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject(); - if(!isCacheActive)entry2SPD->SetObject(NULL); + if(!cacheStatus)entry2SPD->SetObject(NULL); entry2SPD->SetOwner(kTRUE); TObjArray *calSDD = (TObjArray *)entrySDD->GetObject(); - if(!isCacheActive)entrySDD->SetObject(NULL); + if(!cacheStatus)entrySDD->SetObject(NULL); entrySDD->SetOwner(kTRUE); AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject(); - if(!isCacheActive)entry2SDD->SetObject(NULL); + if(!cacheStatus)entry2SDD->SetObject(NULL); entry2SDD->SetOwner(kTRUE); TObjArray *calSSD = (TObjArray *)entrySSD->GetObject(); - if(!isCacheActive)entrySSD->SetObject(NULL); + if(!cacheStatus)entrySSD->SetObject(NULL); entrySSD->SetOwner(kTRUE); AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject(); - if(!isCacheActive)entry2SSD->SetObject(NULL); + if(!cacheStatus)entry2SSD->SetObject(NULL); entry2SSD->SetOwner(kTRUE); // DB entries are deleted. In this way metadeta objects are deleted as well - if(!isCacheActive){ + if(!cacheStatus){ delete entrySPD; delete entrySDD; delete entrySSD; @@ -479,8 +428,6 @@ Bool_t AliITSDetTypeRec::GetCalibration() { delete entry2SSD; } - AliCDBManager::Instance()->SetCacheFlag(origCacheStatus); - if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!calSSD)) { AliWarning("Can not get calibration from calibration database !"); return kFALSE; @@ -526,9 +473,7 @@ void AliITSDetTypeRec::SetDefaultClusterFinders(){ AliITSClusterFinder *clf; - MakeTreeC(); - - for(Int_t dettype=0;dettypeTreeC()== 0x0) fLoader->MakeTree("C"); - MakeBranchC(); -} - -//______________________________________________________________ -void AliITSDetTypeRec::MakeBranchC(){ - - //Make branches in the tree of clusters - - if(!fLoader){ - Warning("MakeBranchC","ITS loader is null!"); - return; - } - TTree* lTC = fLoader->TreeC(); - if(lTC==0x0){ - Error("MakeTreeC","Can not get TreeC from loader"); - return; - } - - Int_t buffersize = 4000; - Char_t branchname[30]; - Char_t* cluclass; - const char *det[4]={"SPD","SDD","SSD","ITS"}; - - for(Int_t i=0;iAddAt(new TClonesArray(cluclass,1000),i); - } - if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]); - else sprintf(branchname,"%sClusters%d",det[3],i+1); - if(fCtype && lTC){ - if(lTC->GetBranch(branchname)){ - Warning("MakeBranchC","Branch %s already exists in TreeC",branchname); - } else{ - Info("MakeBranchC","Creating branch %s in TreeC",branchname); - lTC->Branch(branchname,&((*fCtype)[i]),buffersize); - } - } - - } - -} - -//_______________________________________________________________ -void AliITSDetTypeRec::GetTreeC(Int_t event){ - - //Get the clusters tree for this event and - //sets the branch address - - - if(!fLoader){ - Warning("GetTreeC","ITS loader is null!"); - return; - } - - Char_t branchname[30]; - const char *det[4] = {"SPD","SDD","SSD","ITS"}; - TTree* lTC = fLoader->TreeC(); - - ResetClusters(); - if(lTC) fLoader->CleanRawClusters(); - - TBranch* branch; - if(lTC){ - Char_t* cluclass; - for(Int_t i=0;iAt(i)) fCtype->AddAt(new TClonesArray(cluclass,1000),i); - if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]); - else sprintf(branchname,"%sClusters%d",det[3],i+1); - if(fCtype){ - branch = lTC->GetBranch(branchname); - if(branch) branch->SetAddress(&((*fCtype)[i])); - } - } - } else{ - Error("GetTreeC","cannot find clusters Tree for vent %d",event); - } + if(cR) MakeBranchR(tree); + if(cRF) MakeBranchRF(tree); } @@ -771,7 +623,7 @@ void AliITSDetTypeRec::ResetClusters(Int_t i){ if (fNctype) fNctype[i]=0; } //__________________________________________________________________ -void AliITSDetTypeRec::MakeBranchR(const char *file, Option_t *opt){ +void AliITSDetTypeRec::MakeBranchR(TTree *treeR, Option_t *opt){ //Creates tree branches for recpoints // Inputs: @@ -779,11 +631,6 @@ void AliITSDetTypeRec::MakeBranchR(const char *file, Option_t *opt){ // to. If blank it write the SDigits to the same // file in which the Hits were found. - if(!fLoader){ - Warning("MakeBranchR","ITS loader is null!"); - return; - } - Int_t buffsz = 4000; char branchname[30]; @@ -800,13 +647,8 @@ void AliITSDetTypeRec::MakeBranchR(const char *file, Option_t *opt){ } if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000); - if (fLoader->TreeR()) { - if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint", - 1000); - MakeBranchInTree(fLoader->TreeR(),branchname,0,&fRecPoints,buffsz,99,file); - } // end if - - + if (treeR) + MakeBranchInTree(treeR,branchname,0,&fRecPoints,buffsz,99); } //______________________________________________________________________ void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){ @@ -852,28 +694,20 @@ void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){ } //______________________________________________________________________ -void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt, Bool_t v2){ +void AliITSDetTypeRec::DigitsToRecPoints(TTree *treeD,TTree *treeR,Int_t lastentry,Option_t *opt, Bool_t v2){ // cluster finding and reconstruction of space points // the condition below will disappear when the geom class will be // initialized for all versions - for the moment it is only for v5 ! // 7 is the SDD beam test version // Inputs: - // Int_t evNumber Event number to be processed. + // TTree *treeD Digits tree + // TTree *treeR Clusters tree // Int_t lastentry Offset for module when not all of the modules // are processed. // Option_t *opt String indicating which ITS sub-detectors should // be processed. If ="All" then all of the ITS // sub detectors are processed. - if(!GetITSgeom()){ - Warning("DigitsToRecPoints","Null pointer to AliITSgeom !"); - return; - } - if(!fLoader){ - Warning("DigitsToRecPoints","ITS loader is null!"); - return; - } - const char *all = strstr(opt,"All"); const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"), strstr(opt,"SSD")}; @@ -886,10 +720,6 @@ void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t AliInfo("V2 cluster finder has been selected \n"); } - TTree *treeC=fLoader->TreeC(); - if(!treeC){ - MakeTreeC(); - } AliITSClusterFinder *rec = 0; Int_t id,module,first=0; for(module=0;moduleGetIndexMax();module++){ @@ -898,70 +728,44 @@ void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t if(det[id]) first = GetITSgeom()->GetStartDet(id); rec = (AliITSClusterFinder*)GetReconstructionModel(id); TClonesArray *itsDigits = DigitsAddress(id); - if (!rec) { - Error("DigitsToRecPoints", - "The reconstruction class was not instanciated! event=%d", - evNumber); - exit(1); - } + if (!rec) + AliFatal("The reconstruction class was not instanciated!"); ResetDigits(); // MvL: Not sure we neeed this when rereading anyways - TTree *lTD = fLoader->TreeD(); if (all) { - lTD->GetEvent(lastentry+module); + treeD->GetEvent(lastentry+module); }else { - lTD->GetEvent(lastentry+(module-first)); + treeD->GetEvent(lastentry+(module-first)); } Int_t ndigits = itsDigits->GetEntriesFast(); if(ndigits>0){ rec->SetDetTypeRec(this); rec->SetDigits(DigitsAddress(id)); - rec->SetClusters(ClustersAddress(id)); + // rec->SetClusters(ClustersAddress(id)); rec->FindRawClusters(module); } // end if - fLoader->TreeR()->Fill(); + treeR->Fill(); ResetRecPoints(); - treeC->Fill(); ResetClusters(); } - - fLoader->WriteRecPoints("OVERWRITE"); - fLoader->WriteRawClusters("OVERWRITE"); - fLoader->CleanRawClusters(); } //______________________________________________________________________ -void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){ +void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR){ // cluster finding and reconstruction of space points // the condition below will disappear when the geom class will be // initialized for all versions - for the moment it is only for v5 ! // 7 is the SDD beam test version // Inputs: - // Int_t evNumber Event number to be processed. - // Int_t lastentry Offset for module when not all of the modules - // are processed. - // Option_t *opt String indicating which ITS sub-detectors should - // be processed. If ="All" then all of the ITS - // sub detectors are processed. + // AliRawReader *rawReader Pointer to the raw-data reader + // TTree *treeR Clusters tree // Outputs: // none. // Return: // none. - if(!GetITSgeom()){ - Warning("DigitsToRecPoints","Null pointer to AliITSgeom !"); - return; - } - if(!fLoader){ - Warning("DigitsToRecPoints","ITS loader is null!"); - return; - } - - AliITSClusterFinderV2 *rec = 0; Int_t id=0; - if(!fLoader->TreeR()) fLoader->MakeTree("R"); - TTree* cTree = fLoader->TreeR(); TClonesArray *array=new TClonesArray("AliITSRecPoint",1000); - cTree->Branch("ITSRecPoints",&array); + TBranch *branch = treeR->Branch("ITSRecPoints",&array); delete array; TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()]; @@ -970,10 +774,9 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){ } for(id=0;id<3;id++){ rec = (AliITSClusterFinderV2*)GetReconstructionModel(id); - rec->SetDetTypeRec(this); if (!rec) AliFatal("The reconstruction class was not instanciated"); - + rec->SetDetTypeRec(this); rec->RawdataToClusters(rawReader,clusters); } Int_t nClusters =0; @@ -984,8 +787,8 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){ AliDebug(1,Form("data for module %d missing!",iModule)); array = emptyArray; } - cTree->SetBranchAddress("ITSRecPoints",&array); - cTree->Fill(); + branch->SetAddress(&array); + treeR->Fill(); nClusters+=array->GetEntriesFast(); if (array != emptyArray) { @@ -995,8 +798,6 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){ } delete emptyArray; - fLoader->WriteRecPoints("OVERWRITE"); - delete[] clusters; Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n", nClusters); diff --git a/ITS/AliITSDetTypeRec.h b/ITS/AliITSDetTypeRec.h index 074aba50d11..d95a7a0cebb 100644 --- a/ITS/AliITSDetTypeRec.h +++ b/ITS/AliITSDetTypeRec.h @@ -15,8 +15,11 @@ $Id$ #include #include -#include "AliITSLoader.h" -#include "AliRunLoader.h" +class TTree; +class TBranch; + +//#include "AliITSLoader.h" +//#include "AliRunLoader.h" class AliITSsegmentation; class AliITSCalibration; @@ -30,17 +33,15 @@ class AliITSgeom; class AliITSDetTypeRec : public TObject { public: AliITSDetTypeRec(); // Default constructor - AliITSDetTypeRec(AliITSLoader *loader); // Standard constructor virtual ~AliITSDetTypeRec(); // Proper Destructor - AliITSgeom* GetITSgeom()const{return GetLoader()->GetITSgeom();} - AliITSLoader* GetLoader() const {return fLoader;} + virtual AliITSgeom* GetITSgeom() const { return fITSgeom; } + virtual void SetITSgeom(AliITSgeom *geom) { fITSgeom = geom; } virtual void SetDefaults(); virtual void SetDefaultClusterFinders(); virtual void SetDefaultClusterFindersV2(Bool_t rawdata=kFALSE); - virtual void MakeBranch(Option_t *opt); - virtual void SetTreeAddress(); + virtual void MakeBranch(TTree *tree,Option_t *opt); virtual void SetTreeAddressD(TTree* treeD); virtual void SetSegmentationModel(Int_t dettype, AliITSsegmentation *seg); @@ -67,13 +68,10 @@ class AliITSDetTypeRec : public TObject { TClonesArray *DigitsAddress(Int_t id) const {return ((TClonesArray*)(*fDigits)[id]);} virtual void SelectVertexer(TString sel=" "){fSelectedVertexer = sel;} // - virtual void MakeTreeC(); - virtual void GetTreeC(Int_t event); virtual void AddCluster(Int_t branch, AliITSRawCluster *c); virtual void ResetClusters(); virtual void ResetClusters(Int_t branch); - virtual void MakeBranchC(); - TBranch* MakeBranchInTree(TTree *tree, const char* name, const char *classname, void* address,Int_t size, Int_t splitlevel, const char */*file*/); + TBranch* MakeBranchInTree(TTree *tree, const char* name, const char *classname, void* address,Int_t size, Int_t splitlevel); TObjArray *Ctype() {return fCtype;} Int_t *Nctype() {return fNctype;} @@ -81,35 +79,30 @@ class AliITSDetTypeRec : public TObject { virtual void ResetDigits(); virtual void ResetDigits(Int_t branch); - void MakeBranchR(const char *file, Option_t *opt=" "); + void MakeBranchR(TTree *treeR,Option_t *opt=" "); void SetTreeAddressR(TTree *treeR); void AddRecPoint(const AliITSRecPoint &p); void ResetRecPoints(){if(fRecPoints) fRecPoints->Clear();fNRecPoints = 0;}; // Return pointer to rec points TClonesArray *RecPoints() {return fRecPoints;} - void MakeBranchRF(const char *file){MakeBranchR(file,"Fast");} - // void HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size, - // Option_t *add, Option_t *det, const char *filename); - void Digits2Reco(){ - DigitsToRecPoints(fLoader->GetRunLoader()->GetEventNumber(),0,"All");} - void DigitsToRecPoints(Int_t evNumber,Int_t lastEntry,Option_t *det,Bool_t v2=kFALSE); - void DigitsToRecPoints(AliRawReader* rawReader); - - virtual void SetRunNumber(Int_t rn=0){fRunNumber = rn;} - virtual Int_t GetRunNumber() const {return fRunNumber;} + void MakeBranchRF(TTree *treeR){MakeBranchR(treeR,"Fast");} + void DigitsToRecPoints(TTree *treeD,TTree *treeR,Int_t lastEntry,Option_t *det,Bool_t v2=kFALSE); + void DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR); private: // private methods AliITSDetTypeRec(const AliITSDetTypeRec& rec); AliITSDetTypeRec& operator=(const AliITSDetTypeRec &source); - virtual void SetLoader(AliITSLoader* loader) {fLoader=loader;} + // virtual void SetLoader(AliITSLoader* loader) {fLoader=loader;} static const Int_t fgkNdettypes; // number of det. types static const Int_t fgkDefaultNModulesSPD; // Total numbers of SPD modules by default static const Int_t fgkDefaultNModulesSDD; // Total numbers of SDD modules by default static const Int_t fgkDefaultNModulesSSD; // Total numbers of SSD modules by default Int_t *fNMod; // numbers of modules from different types + AliITSgeom *fITSgeom; //! ITS geometry + TObjArray *fReconstruction;//! [NDet] TObjArray *fSegmentation; //! [NDet] TObjArray *fCalibration; //! [NMod] @@ -128,11 +121,9 @@ class AliITSDetTypeRec : public TObject { Int_t fNRecPoints; // Number of rec points TString fSelectedVertexer; // Vertexer selected in CreateVertexer - AliITSLoader* fLoader; //! ITS loader - Int_t fRunNumber; //! run number (to access DB) Bool_t fFirstcall; //! flag - ClassDef(AliITSDetTypeRec,6) // ITS Reconstruction structure + ClassDef(AliITSDetTypeRec,7) // ITS Reconstruction structure }; #endif diff --git a/ITS/AliITSNeuralTracker.h b/ITS/AliITSNeuralTracker.h index 6bb9f5aae30..1ea82428b18 100644 --- a/ITS/AliITSNeuralTracker.h +++ b/ITS/AliITSNeuralTracker.h @@ -15,6 +15,8 @@ class TObjArray; class TCanvas; +#include + #include "AliITSNeuralPoint.h" class AliITSNeuralTracker : public TObject { @@ -179,7 +181,7 @@ public: Bool_t Update(); // an updating cycle void CleanNetwork(); // removes deactivated units and resolves competitions Int_t Save(Int_t sectoridx); // save found tracks for # sector - TTree* GetChains() {return fChains;} + TTree* GetChains() const {return fChains;} void WriteChains() {fChains->Write();} private: diff --git a/ITS/AliITSReconstructor.cxx b/ITS/AliITSReconstructor.cxx index b16f7e354fa..ede20b82ba7 100644 --- a/ITS/AliITSReconstructor.cxx +++ b/ITS/AliITSReconstructor.cxx @@ -27,6 +27,7 @@ #include "AliRunLoader.h" #include "AliRawReader.h" #include "AliITSDetTypeRec.h" +#include "AliITSgeom.h" #include "AliITSLoader.h" #include "AliITStrackerMI.h" #include "AliITStrackerV2.h" @@ -49,7 +50,8 @@ AliITSRecoParam *AliITSReconstructor::fgkRecoParam =0; // reconstruction parame //___________________________________________________________________________ AliITSReconstructor::AliITSReconstructor() : AliReconstructor(), -fItsPID(0) +fItsPID(0), +fDetTypeRec(0) { // Default constructor if (!fgkRecoParam) { @@ -62,10 +64,13 @@ AliITSReconstructor::~AliITSReconstructor(){ // destructor delete fItsPID; if(fgkRecoParam) delete fgkRecoParam; + if(fDetTypeRec) delete fDetTypeRec; } //______________________________________________________________________ AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob), - fItsPID(ob.fItsPID) + fItsPID(ob.fItsPID), + fDetTypeRec(ob.fDetTypeRec) + { // Copy constructor } @@ -77,8 +82,9 @@ AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& new(this) AliITSReconstructor(ob); return *this; } + //______________________________________________________________________ -void AliITSReconstructor::Init(AliRunLoader *runLoader) const{ +void AliITSReconstructor::Init(AliRunLoader */*runLoader*/) { // Initalize this constructor bet getting/creating the objects // nesseary for a proper ITS reconstruction. // Inputs: @@ -93,83 +99,36 @@ void AliITSReconstructor::Init(AliRunLoader *runLoader) const{ AliITSInitGeometry initgeom; AliITSgeom *geom = initgeom.CreateAliITSgeom(); AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data())); - AliITSLoader* loader = static_cast - (runLoader->GetLoader("ITSLoader")); - if (!loader) { - Error("Init", "ITS loader not found"); - return; - } - loader->SetITSgeom(geom); + + fDetTypeRec = new AliITSDetTypeRec(); + fDetTypeRec->SetITSgeom(geom); + fDetTypeRec->SetDefaults(); + return; } + //_____________________________________________________________________________ -void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const +void AliITSReconstructor::Reconstruct(TTree *digitsTree, TTree *clustersTree) const { // reconstruct clusters - - AliITSLoader* loader = static_cast(runLoader->GetLoader("ITSLoader")); - if (!loader) { - Error("Reconstruct", "ITS loader not found"); - return; - } - AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader); - rec->SetDefaults(); - - loader->LoadRecPoints("recreate"); - loader->LoadDigits("read"); - runLoader->LoadKinematics(); TString option = GetOption(); Bool_t clusfinder=kTRUE; // Default: V2 cluster finder if(option.Contains("OrigCF"))clusfinder=kFALSE; - Int_t nEvents = runLoader->GetNumberOfEvents(); - - for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) { - runLoader->GetEvent(iEvent); - if(loader->TreeR()==0x0) loader->MakeTree("R"); - rec->MakeBranch("R"); - rec->SetTreeAddress(); - rec->DigitsToRecPoints(iEvent,0,"All",clusfinder); - } - - loader->UnloadRecPoints(); - loader->UnloadDigits(); - loader->UnloadRawClusters(); - runLoader->UnloadKinematics(); - delete rec; + fDetTypeRec->SetTreeAddressD(digitsTree); + fDetTypeRec->MakeBranch(clustersTree,"R"); + fDetTypeRec->SetTreeAddressR(clustersTree); + fDetTypeRec->DigitsToRecPoints(digitsTree,clustersTree,0,"All",clusfinder); } //_________________________________________________________________ -void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader, - AliRawReader* rawReader) const +void AliITSReconstructor::Reconstruct(AliRawReader* rawReader, TTree *clustersTree) const { -// reconstruct clusters - + // reconstruct clusters from raw data - AliITSLoader* loader = static_cast(runLoader->GetLoader("ITSLoader")); - if (!loader) { - Error("Reconstruct", "ITS loader not found"); - return; - } - - AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader); - rec->SetDefaults(); - rec->SetDefaultClusterFindersV2(kTRUE); - - loader->LoadRecPoints("recreate"); - - Int_t iEvent = 0; - - while(rawReader->NextEvent()) { - runLoader->GetEvent(iEvent++); - if(loader->TreeR()==0x0) loader->MakeTree("R"); - rec->DigitsToRecPoints(rawReader); - } - - loader->UnloadRecPoints(); - loader->UnloadRawClusters(); - delete rec; + fDetTypeRec->SetDefaultClusterFindersV2(kTRUE); + fDetTypeRec->DigitsToRecPoints(rawReader,clustersTree); } //_____________________________________________________________________________ @@ -262,24 +221,3 @@ void AliITSReconstructor::FillESD(AliRunLoader* runLoader, Error("FillESD","!! cannot do the PID !!\n"); } } - - -//_____________________________________________________________________________ -AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const -{ -// get the ITS geometry - - if (!runLoader->GetAliRun()) runLoader->LoadgAlice(); - if (!runLoader->GetAliRun()) { - Error("GetITSgeom", "couldn't get AliRun object"); - return NULL; - } - AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader"); - AliITSgeom* geom = (AliITSgeom*)loader->GetITSgeom(); - if(!geom){ - Error("GetITSgeom","no ITS geometry available"); - return NULL; - } - - return geom; -} diff --git a/ITS/AliITSReconstructor.h b/ITS/AliITSReconstructor.h index 4f1bce757b2..99ab8ed3c02 100644 --- a/ITS/AliITSReconstructor.h +++ b/ITS/AliITSReconstructor.h @@ -14,10 +14,10 @@ #include "AliITSRecoParam.h" class AliITSgeom; -class AliLoader; class AliTracker; class AliITStrackerMI; class AliITSpidESD; +class AliITSDetTypeRec; class AliITSReconstructor: public AliReconstructor { public: @@ -25,15 +25,17 @@ public: virtual ~AliITSReconstructor(); AliITSReconstructor(const AliITSReconstructor &ob); // copy constructor AliITSReconstructor& operator=(const AliITSReconstructor & ob); // ass. op. - virtual void Init(AliRunLoader* runLoader) const; + virtual void Init(AliRunLoader* runLoader); - virtual void Reconstruct(AliRunLoader* runLoader) const; + virtual Bool_t HasLocalReconstruction() const {return kTRUE;}; + + virtual void Reconstruct(AliRunLoader* runLoader) const + {AliReconstructor::Reconstruct(runLoader);} virtual void Reconstruct(AliRunLoader* runLoader, - AliRawReader* rawReader) const; - virtual void Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const - {AliReconstructor::Reconstruct(rawReader,clustersTree);} - virtual void Reconstruct(TTree* digitsTree, TTree* clustersTree) const - {AliReconstructor::Reconstruct(digitsTree, clustersTree);} + AliRawReader* rawReader) const + {AliReconstructor::Reconstruct(runLoader,rawReader);} + virtual void Reconstruct(AliRawReader* rawReader, TTree* clustersTree) const; + virtual void Reconstruct(TTree* digitsTree, TTree* clustersTree) const; virtual AliTracker* CreateTracker(AliRunLoader* runLoader) const; virtual AliVertexer* CreateVertexer(AliRunLoader* runLoader) const; @@ -53,12 +55,11 @@ public: static const AliITSRecoParam* GetRecoParam(){ return fgkRecoParam;} private: - // methods - AliITSgeom* GetITSgeom(AliRunLoader* runLoader) const; //data - static AliITSRecoParam * fgkRecoParam; // reconstruction parameters - AliITSpidESD *fItsPID; //Pid for ITS - ClassDef(AliITSReconstructor, 1) // class for the ITS reconstruction + static AliITSRecoParam *fgkRecoParam; // reconstruction parameters + AliITSpidESD *fItsPID; // Pid for ITS + AliITSDetTypeRec *fDetTypeRec; // reconstructor + ClassDef(AliITSReconstructor, 2) // class for the ITS reconstruction }; #endif diff --git a/ITS/AliITSVertexer3D.h b/ITS/AliITSVertexer3D.h index 8aa4b5c0e24..4539c6049b2 100644 --- a/ITS/AliITSVertexer3D.h +++ b/ITS/AliITSVertexer3D.h @@ -9,7 +9,7 @@ // // /////////////////////////////////////////////////////////////////// -class AliVertex; +#include "AliVertex.h" class TClonesArray; class AliITSVertexer3D : public AliITSVertexer { diff --git a/ITS/AliITSVertexerIons.cxx b/ITS/AliITSVertexerIons.cxx index dfd8176af57..eef9f19ac0a 100644 --- a/ITS/AliITSVertexerIons.cxx +++ b/ITS/AliITSVertexerIons.cxx @@ -1,3 +1,4 @@ +#include "AliRunLoader.h" #include "AliITSDetTypeRec.h" #include "AliITSVertexerIons.h" #include "AliITSVertexerZ.h" diff --git a/ITS/AliITSVertexerZ.cxx b/ITS/AliITSVertexerZ.cxx index c15db2bfa0c..d0e17532d20 100644 --- a/ITS/AliITSVertexerZ.cxx +++ b/ITS/AliITSVertexerZ.cxx @@ -18,6 +18,7 @@ #include #include #include +#include "AliRunLoader.h" #include "AliITSLoader.h" #include "AliITSgeomTGeo.h" #include "AliITSDetTypeRec.h" diff --git a/ITS/AliITSreconstruction.cxx b/ITS/AliITSreconstruction.cxx index 15d833aa99a..79b69e71c4a 100644 --- a/ITS/AliITSreconstruction.cxx +++ b/ITS/AliITSreconstruction.cxx @@ -161,7 +161,8 @@ Bool_t AliITSreconstruction::Init(){ //fRunLoader->CdGAFile(); fITSgeom = fLoader->GetITSgeom(); - fDetTypeRec = new AliITSDetTypeRec(fLoader); + fDetTypeRec = new AliITSDetTypeRec(); + fDetTypeRec->SetITSgeom(fITSgeom); fDetTypeRec->SetDefaults(); fDet[0] = fDet[1] = fDet[2] = kTRUE; fEnt0 = 0; @@ -171,13 +172,10 @@ Bool_t AliITSreconstruction::Init(){ fLoader->LoadDigits("read"); fLoader->LoadRecPoints("recreate"); - fLoader->LoadRawClusters("recreate"); if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R"); - if (fLoader->TreeC() == 0x0) fLoader->MakeTree("C"); - fDetTypeRec->MakeBranchR(0); - fDetTypeRec->MakeBranchC(); - fDetTypeRec->SetTreeAddress(); + fDetTypeRec->SetTreeAddressD(fLoader->TreeD()); + fDetTypeRec->MakeBranchR(fLoader->TreeR()); fDetTypeRec->SetTreeAddressR(fLoader->TreeR()); fInit = InitRec(); @@ -278,13 +276,9 @@ void AliITSreconstruction::Exec(const Option_t *opt){ fRunLoader->GetEvent(evnt); if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R"); fDetTypeRec->MakeBranchR(0); - if (fLoader->TreeC() == 0x0){ - fDetTypeRec->MakeTreeC(); - fDetTypeRec->MakeBranchC(); - } fDetTypeRec->SetTreeAddressR(fLoader->TreeR()); fDetTypeRec->SetTreeAddressD(fLoader->TreeD()); - fDetTypeRec->DigitsToRecPoints(evnt,0,lopt); + fDetTypeRec->DigitsToRecPoints(fLoader->TreeD(),fLoader->TreeR(),0,lopt); } // end for evnt } //______________________________________________________________________ diff --git a/ITS/AliITSreconstruction.h b/ITS/AliITSreconstruction.h index d1d53a8efee..e61e718a181 100644 --- a/ITS/AliITSreconstruction.h +++ b/ITS/AliITSreconstruction.h @@ -15,6 +15,7 @@ #include class AliRunLoader; +class AliITSLoader; class TString; class AliITSreconstruction : public TTask{ diff --git a/STEER/AliReconstruction.cxx b/STEER/AliReconstruction.cxx index 8d5b59e898d..f0d810bb18a 100644 --- a/STEER/AliReconstruction.cxx +++ b/STEER/AliReconstruction.cxx @@ -1482,6 +1482,10 @@ Bool_t AliReconstruction::InitRunLoader() return kFALSE; } + //PH This is a temporary fix to give access to the kinematics + //PH that is needed for the labels of ITS clusters + fRunLoader->LoadKinematics(); + } else { // galice.root does not exist if (!fRawReader) { AliError(Form("the file %s does not exist", fGAliceFileName.Data())); -- 2.43.0