From 0ac80088622a5955d8562bc9eefa61b3d97dde57 Mon Sep 17 00:00:00 2001 From: amastros Date: Thu, 10 Mar 2011 14:02:27 +0000 Subject: [PATCH] Major changes in the code to comply with the following modifications : - SECTOR segmentation (number of sectors is flexible). - Introduction of the AliITSUPixelModule container for clustering purposes. --- ITS/CMakelibITSUpgradeRec.pkg | 2 +- ITS/ITSUpgradeRecLinkDef.h | 1 + ITS/UPGRADE/AliITSDigitUpgrade.cxx | 8 +- ITS/UPGRADE/AliITSDigitUpgrade.h | 12 +- ITS/UPGRADE/AliITSRecPointU.cxx | 6 +- ITS/UPGRADE/AliITSRecPointU.h | 5 + ITS/UPGRADE/AliITSUPixelModule.cxx | 65 ++++++ ITS/UPGRADE/AliITSUPixelModule.h | 54 +++++ ITS/UPGRADE/AliITSUpgradeClusterFinder.cxx | 247 ++++++++++++--------- ITS/UPGRADE/AliITSUpgradeClusterFinder.h | 5 +- ITS/UPGRADE/AliITSsegmentationUpgrade.cxx | 162 +++++++++++++- ITS/UPGRADE/AliITSsegmentationUpgrade.h | 25 ++- ITS/UPGRADE/AliITStrackU.cxx | 8 +- ITS/UPGRADE/AliITStrackU.h | 10 +- ITS/UPGRADE/AliITStrackerUpgrade.cxx | 75 +++---- ITS/UPGRADE/AliITStrackerUpgrade.h | 26 +-- ITS/UPGRADE/AliITSupgrade.cxx | 111 +++++---- ITS/UPGRADE/AliITSupgrade.h | 8 +- ITS/UPGRADE/AliITSupgradeDigitizer.cxx | 11 +- 19 files changed, 595 insertions(+), 246 deletions(-) create mode 100644 ITS/UPGRADE/AliITSUPixelModule.cxx create mode 100644 ITS/UPGRADE/AliITSUPixelModule.h diff --git a/ITS/CMakelibITSUpgradeRec.pkg b/ITS/CMakelibITSUpgradeRec.pkg index e73ad012c06..ab4611273fe 100644 --- a/ITS/CMakelibITSUpgradeRec.pkg +++ b/ITS/CMakelibITSUpgradeRec.pkg @@ -25,7 +25,7 @@ # SHLIBS - Shared Libraries and objects for linking (Executables only) # #--------------------------------------------------------------------------------# -set ( SRCS UPGRADE/AliITSlayerUpgrade.cxx UPGRADE/AliITStrackerUpgrade.cxx UPGRADE/AliITStrackU.cxx UPGRADE/AliITStrackerU.cxx UPGRADE/AliITSUpgradeReconstructor.cxx UPGRADE/AliITSUpgradeClusterList.cxx UPGRADE/AliITSUpgradeClusterListNode.cxx UPGRADE/AliITSUpgradeClusterFinder.cxx) +set ( SRCS UPGRADE/AliITSlayerUpgrade.cxx UPGRADE/AliITStrackerUpgrade.cxx UPGRADE/AliITStrackU.cxx UPGRADE/AliITStrackerU.cxx UPGRADE/AliITSUpgradeReconstructor.cxx UPGRADE/AliITSUpgradeClusterList.cxx UPGRADE/AliITSUpgradeClusterListNode.cxx UPGRADE/AliITSUPixelModule.cxx UPGRADE/AliITSUpgradeClusterFinder.cxx) string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" ) diff --git a/ITS/ITSUpgradeRecLinkDef.h b/ITS/ITSUpgradeRecLinkDef.h index 4facc8160d6..7d80e84d534 100644 --- a/ITS/ITSUpgradeRecLinkDef.h +++ b/ITS/ITSUpgradeRecLinkDef.h @@ -20,6 +20,7 @@ #pragma link C++ class AliITSUpgradeReconstructor+; #pragma link C++ class AliITSUpgradeClusterList+; #pragma link C++ class AliITSUpgradeClusterListNode+; +#pragma link C++ class AliITSUPixelModule+; #pragma link C++ class AliITSUpgradeClusterFinder+; #endif diff --git a/ITS/UPGRADE/AliITSDigitUpgrade.cxx b/ITS/UPGRADE/AliITSDigitUpgrade.cxx index 8334cf737af..f1379662ce7 100644 --- a/ITS/UPGRADE/AliITSDigitUpgrade.cxx +++ b/ITS/UPGRADE/AliITSDigitUpgrade.cxx @@ -33,13 +33,15 @@ ClassImp(AliITSDigitUpgrade) fPixId(9999), fSignal(0), fNLayer(0), + fModule(0), fNelectrons(0) {for(Int_t i=0; i<3 ; i++) fSignalID[i]=-1;} //default creator //_______________________________________________________________________ AliITSDigitUpgrade::AliITSDigitUpgrade(Int_t *digits): AliDigit(digits), fPixId(9999), fSignal(0), - fNLayer(0), + fNLayer(0), + fModule(0), fNelectrons(0) {for(Int_t i=0; i<3 ; i++) fSignalID[i]=-1;} //standard creator digits only //____________________________________________________________________________________________________ @@ -47,6 +49,7 @@ AliITSDigitUpgrade::AliITSDigitUpgrade(ULong_t pixid, Float_t eloss): AliDigit() fPixId(pixid), fSignal(eloss), fNLayer(0), + fModule(0), fNelectrons(0) {for(Int_t i=0; i<3 ; i++) fSignalID[i]=-1;} //standard creator digits only //____________________________________________________________________________________________________ @@ -54,6 +57,7 @@ AliITSDigitUpgrade::AliITSDigitUpgrade(const AliITSDigitUpgrade &d):AliDigit(d), fPixId(d.fPixId), fSignal(d.fSignal), fNLayer(d.fNLayer), + fModule(d.fModule), fNelectrons(d.fNelectrons) {for(Int_t i=0; i<3 ; i++) fSignalID[i]=d.fSignalID[i];} //copy constructor //____________________________________________________________________________________________________ @@ -74,6 +78,8 @@ void AliITSDigitUpgrade::PrintInfo(){ GetPosition(fNLayer,GetxPixelNumber(),GetzPixelNumber(),xz[0],xz[1]); printf("pixid %10.0i (%6.3f,%6.3f) in layer %i \n",(Int_t)fPixId,xz[0],xz[1],fNLayer); + printf("pixid %u ",(UInt_t)fPixId); + printf(" (xloc, zloc)= (%6.3f, %6.3f) in layer %i and module %i \n",xz[0],xz[1],fNLayer, fModule); printf(" Eloss %f Nel %f track ID %i %i %i ", fSignal, fNelectrons,fTracks[0],fTracks[1],fTracks[2]); printf(" ElossID %f %f %f \n", fSignalID[0],fSignalID[1],fSignalID[2]); } diff --git a/ITS/UPGRADE/AliITSDigitUpgrade.h b/ITS/UPGRADE/AliITSDigitUpgrade.h index 00b11020b4d..5bbeb169d01 100644 --- a/ITS/UPGRADE/AliITSDigitUpgrade.h +++ b/ITS/UPGRADE/AliITSDigitUpgrade.h @@ -35,6 +35,7 @@ class AliITSDigitUpgrade: public AliDigit { void SetSignal(Float_t sig) {fSignal = sig;} void SetLayer(Int_t layer) {fNLayer = layer;} + void SetModule(Int_t module) {fModule = module ;} void SetNelectrons(Double_t nele) {fNelectrons = nele;} void SetTrackID(Int_t tid) {fTracks[0]=tid;} void SetPixId(ULong_t nx, ULong_t nz) {fPixId = 100000*nx + nz ;} @@ -46,6 +47,7 @@ class AliITSDigitUpgrade: public AliDigit { Float_t GetSignal() const {return fSignal;} Int_t GetLayer() const {return fNLayer;} + Int_t GetModule() const {return fModule;} Double_t GetNelectrons() const {return fNelectrons;} ULong_t GetPixId(){return fPixId;} Int_t GetxPixelNumber() const {return fPixId/100000;} @@ -63,6 +65,7 @@ class AliITSDigitUpgrade: public AliDigit { ULong_t fPixId; Float_t fSignal; // Signal as Eloss in the medium Int_t fNLayer; + Int_t fModule; Double_t fNelectrons; Float_t fSignalID[3]; @@ -75,8 +78,13 @@ Int_t AliITSDigitUpgrade::Compare(const TObject *pObj) const { // Arguments: pObj - pointer to object to compare with // Returns: -1 if AbsPad less then in pObj, 1 if more and 0 if they are the same - if (fPixId==((AliITSDigitUpgrade*)pObj)->GetPixId()) return 0; - else if(fPixId >((AliITSDigitUpgrade*)pObj)->GetPixId()) return 1; + + if (fModule>((AliITSDigitUpgrade*)pObj)->GetModule())return 1; + + else if(fModule==((AliITSDigitUpgrade*)pObj)->GetModule()){ + if (fPixId==((AliITSDigitUpgrade*)pObj)->GetPixId()) return 0; + else if(fPixId >((AliITSDigitUpgrade*)pObj)->GetPixId()) return 1; + } else return -1; } diff --git a/ITS/UPGRADE/AliITSRecPointU.cxx b/ITS/UPGRADE/AliITSRecPointU.cxx index f623f17218f..99550083a44 100644 --- a/ITS/UPGRADE/AliITSRecPointU.cxx +++ b/ITS/UPGRADE/AliITSRecPointU.cxx @@ -23,7 +23,8 @@ ClassImp(AliITSRecPointU) //_____________________________________________________________ AliITSRecPointU::AliITSRecPointU(): - AliITSRecPoint() + AliITSRecPoint(), + fModule(0) { // // Default constructor @@ -31,7 +32,8 @@ AliITSRecPointU::AliITSRecPointU(): } //_____________________________________________________________ AliITSRecPointU::AliITSRecPointU(const AliITSRecPointU& pt): - AliITSRecPoint(pt) + AliITSRecPoint(pt), + fModule(pt.fModule) { // // Copy constructor diff --git a/ITS/UPGRADE/AliITSRecPointU.h b/ITS/UPGRADE/AliITSRecPointU.h index 7438cddf470..dda5194d6c2 100644 --- a/ITS/UPGRADE/AliITSRecPointU.h +++ b/ITS/UPGRADE/AliITSRecPointU.h @@ -20,6 +20,11 @@ public : AliITSRecPointU& operator=(const AliITSRecPointU &source); void SetLocalCoord(Float_t x, Float_t z) {fXloc=x; fZloc=z;} + void SetModule(Int_t i){fModule=i;} + Int_t GetModule(){return fModule;} + + protected: + Int_t fModule; ClassDef(AliITSRecPointU,1) // AliITSRecPointU class diff --git a/ITS/UPGRADE/AliITSUPixelModule.cxx b/ITS/UPGRADE/AliITSUPixelModule.cxx new file mode 100644 index 00000000000..43246c9e408 --- /dev/null +++ b/ITS/UPGRADE/AliITSUPixelModule.cxx @@ -0,0 +1,65 @@ +/************************************************************************** + * 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. * + **************************************************************************/ +//////////////////////////////////////////////////////////////////////////// +// // +// Base Class used to find // +// the reconstructed points for ITS Upgrade // +// // +//////////////////////////////////////////////////////////////////////////// + + +#include "AliITSUPixelModule.h" + + +AliITSUPixelModule::AliITSUPixelModule(): + TObject(), + fCharge(0), + fModule(0), + fCol(0), + fRow(0) +{ + // + // Default constructor + // + for(Int_t i=0;i<3;i++)fLabels[i]=-1; +} +//_______________________________________________ +AliITSUPixelModule::AliITSUPixelModule( UShort_t mod, UInt_t col, UInt_t row, UInt_t charge, Int_t lab[3]): + TObject(), + fCharge(charge), + fModule(mod), + fCol(col), + fRow(row) +{ + // + // Constructor + // + for(Int_t i=0;i<3;i++)fLabels[i]=lab[i]; +} +//____________________________________________ +void AliITSUPixelModule::SetLabels(Int_t lab[3]){ + // Setter for cluster labels + for(Int_t i=0;i<3;i++)fLabels[i]=lab[i]; +} +//_______________________________________________ +void AliITSUPixelModule::PrintInfo(){ + // + // printout method for debugging + // + printf(" module %d col %i row %i charge %i label %i, %i, %i \n", fModule, fCol, fRow,fCharge, fLabels[0], fLabels[1], fLabels[2]); +} + + + diff --git a/ITS/UPGRADE/AliITSUPixelModule.h b/ITS/UPGRADE/AliITSUPixelModule.h new file mode 100644 index 00000000000..c35506f1625 --- /dev/null +++ b/ITS/UPGRADE/AliITSUPixelModule.h @@ -0,0 +1,54 @@ +#ifndef ALIITSUPIXELMODULE_H +#define ALIITSUPIXELMODULE_H + + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +//////////////////////////////////////////////// +// ITS Cluster Finder Module Container // +// Used in the ClusterFinder to keep // +// clusters in one module before storing // +// them in treeR // +//////////////////////////////////////////////// + +#include + +class AliITSUPixelModule :public TObject { + + public : + + AliITSUPixelModule(); + AliITSUPixelModule( UShort_t module, UInt_t col, UInt_t row, UInt_t charge, Int_t lab[3]); + + virtual ~AliITSUPixelModule(){;} + + void SetPixelCoord( UInt_t col, UInt_t row) {fCol = col ; fRow = row; } + void SetLabels(Int_t lab[3]); + void SetCharge(UInt_t charge) {fCharge = charge;} + + UShort_t GetModule() const {return fModule; } + UInt_t GetCol() const {return fCol; } + UInt_t GetRow() const {return fRow; } + UInt_t GetCharge() const {return fCharge;} + Int_t GetLabels(Int_t i) const {return fLabels[i];} + void PrintInfo(); + + protected: + UInt_t fCharge; + UShort_t fModule; + UInt_t fCol; + UInt_t fRow; + Int_t fLabels[3]; + + + AliITSUPixelModule(const AliITSUPixelModule &p); // copy constructor + AliITSUPixelModule& operator=(const AliITSUPixelModule &p); // assignment operator + + + ClassDef(AliITSUPixelModule,0) + + }; +#endif + diff --git a/ITS/UPGRADE/AliITSUpgradeClusterFinder.cxx b/ITS/UPGRADE/AliITSUpgradeClusterFinder.cxx index 11bbb34a536..27c1e80651a 100644 --- a/ITS/UPGRADE/AliITSUpgradeClusterFinder.cxx +++ b/ITS/UPGRADE/AliITSUpgradeClusterFinder.cxx @@ -27,6 +27,7 @@ #include "AliITSRecPointU.h" #include "AliITSDigitUpgrade.h" #include "AliITSRawStreamSPD.h" +#include "AliITSUPixelModule.h" #include "AliLog.h" #include #include @@ -48,17 +49,22 @@ AliITSUpgradeClusterFinder::AliITSUpgradeClusterFinder() : fClusterWidthMinCol(0), fClusterWidthMaxRow(0), fClusterWidthMinRow(0), + fClusterList(0x0), fChargeArray(0x0), fRecPoints(0x0), - fNlayers() + fNSectors() { // // Default constructor // AliITSsegmentationUpgrade *s = new AliITSsegmentationUpgrade(); - fNlayers = s->GetNLayers(); + fNSectors = s->GetNSectors(); delete s; - + fClusterList = new AliITSUpgradeClusterList*[fNSectors]; + for(Int_t imod =0; imod < fNSectors; imod++){ + fClusterList[imod] = new AliITSUpgradeClusterList(); +} + fChargeArray = new TObjArray(); fChargeArray->SetOwner(kTRUE); fRecPoints = new TClonesArray("AliITSRecPointU",3000); @@ -76,32 +82,37 @@ AliITSUpgradeClusterFinder::AliITSUpgradeClusterFinder() : AliITSUpgradeClusterFinder::~AliITSUpgradeClusterFinder() { if(fChargeArray) delete fChargeArray; if(fRecPoints) delete fRecPoints; + if(fClusterList)delete [] fClusterList; } //___________________________________________________________________________________ void AliITSUpgradeClusterFinder::StartEvent() { NewEvent(); } //___________________________________________________________________________________ -Int_t AliITSUpgradeClusterFinder::ProcessHit(Int_t layer , UInt_t col, UInt_t row, UShort_t charge, Int_t label[3]) { +Int_t AliITSUpgradeClusterFinder::ProcessHit(Int_t module , UInt_t col, UInt_t row, UShort_t charge, Int_t label[3]) { // // Adds one pixel to the cluster // - - if (layer>=fNlayers) { - printf("ERROR: UpgradeClusterFinder::ProcessHit: Out of bounds: layer ,col,row, charge, label(0,1,2)= %d,%d,%d,%d,(%d,%d,%d)\n",layer ,col,row,charge,label[0],label[1],label[2]); + AliDebug(2,Form("module,col,row,charge,label(0,1,2) = %d,%d,%d,%d,(%d,%d,%d)\n",module ,col,row,charge,label[0],label[1],label[2])); + if (module>=fNSectors) { + AliError(Form("Out of bounds: module ,col,row, charge, label(0,1,2)= %d,%d,%d,%d,(%d,%d,%d)\n",module ,col,row,charge,label[0],label[1],label[2])); return 1; } - // do we need to perform clustering on previous module? - if (fOldModule!=-1 && (Int_t)layer!=fOldModule) { - fChargeArray->AddLast(new TObjString(Form("%i %i %i %i %i %i",col,row,charge,label[0],label[1],label[2]))); + if (fOldModule!=-1 && (Int_t)module!=fOldModule) { + //fChargeArray->AddLast(new TObjString(Form("%i %i %i %i %i %i",col,row,charge,label[0],label[1],label[2]))); + AliITSUPixelModule *pix = new AliITSUPixelModule(module,col, row, charge, label); + fChargeArray->AddLast(pix); + DoModuleClustering(fOldModule,charge); NewModule(); } // add hit - fChargeArray->AddLast(new TObjString(Form("%i %i %i %i %i %i",col,row,charge,label[0],label[1],label[2]))); + AliITSUPixelModule *pix = new AliITSUPixelModule(module,col, row, charge, label); + fChargeArray->AddLast(pix); +// fChargeArray->AddLast(new TObjString(Form("%i %i %i %i %i %i",col,row,charge,label[0],label[1],label[2]))); - fOldModule=layer; + fOldModule=module; fHitCol[fNhitsLeft]=col; fHitRow[fNhitsLeft]=row; fHits[col][row]=kTRUE; @@ -118,84 +129,84 @@ void AliITSUpgradeClusterFinder::FinishEvent() { } } //___________________________________________________________________________________ -UInt_t AliITSUpgradeClusterFinder::GetClusterCount(Int_t layer) const { +UInt_t AliITSUpgradeClusterFinder::GetClusterCount(Int_t module) const { // - // number of clusters in the layer + // number of clusters in the module // - if (layer>=fNlayers ) { - printf("ERROR: UpgradeClusterFinder::GetClusterCount: Module out of bounds: layer = %d\n",layer); + if (module>fNSectors ) { + printf("ERROR: UpgradeClusterFinder::GetClusterCount: Module out of bounds: module = %d\n",module); return 0; } - return fClusterList[layer].GetNrEntries(); + return fClusterList[module]->GetNrEntries(); } //___________________________________________________________________________________ -Float_t AliITSUpgradeClusterFinder::GetClusterMeanCol(Int_t layer, UInt_t index) { +Float_t AliITSUpgradeClusterFinder::GetClusterMeanCol(Int_t module, UInt_t index) { // // cluster position in terms of colums : mean column ID // - if (layer>=fNlayers) { - printf("ERROR: UpgradeClusterFinder::GetClusterMeanCol: Module out of bounds: layer = %d\n",layer); + if (module>=fNSectors) { + printf("ERROR: UpgradeClusterFinder::GetClusterMeanCol: Module out of bounds: module = %d\n",module); return 0; } - return fClusterList[layer].GetColIndex(index); + return fClusterList[module]->GetColIndex(index); } //___________________________________________________________________________________ -Float_t AliITSUpgradeClusterFinder::GetClusterMeanRow(Int_t layer, UInt_t index) { +Float_t AliITSUpgradeClusterFinder::GetClusterMeanRow(Int_t module, UInt_t index) { // // cluster position in terms of rows : mean row ID // - if (layer>=fNlayers) { - printf("ERROR: UpgradeClusterFinder::GetClusterMeanRow: Module out of bounds: layer = %d\n",layer); + if (module>=fNSectors) { + printf("ERROR: UpgradeClusterFinder::GetClusterMeanRow: Module out of bounds: module = %d\n",module); return 0; } - return fClusterList[layer].GetRowIndex(index); + return fClusterList[module]->GetRowIndex(index); } //___________________________________________________________________________________ -UInt_t AliITSUpgradeClusterFinder::GetClusterSize(Int_t layer, UInt_t index) { +UInt_t AliITSUpgradeClusterFinder::GetClusterSize(Int_t module, UInt_t index) { // // total number of pixels of the cluster // - if (layer>=fNlayers) { - printf("ERROR: UpgradeClusterFinder::GetClusterSize: Module out of bounds: layer = %d\n",layer); + if (module>=fNSectors) { + printf("ERROR: UpgradeClusterFinder::GetClusterSize: Module out of bounds: module = %d\n",module); return 0; } - return fClusterList[layer].GetSizeIndex(index); + return fClusterList[module]->GetSizeIndex(index); } //___________________________________________________________________________________ -UInt_t AliITSUpgradeClusterFinder::GetClusterWidthZ(Int_t layer, UInt_t index) { +UInt_t AliITSUpgradeClusterFinder::GetClusterWidthZ(Int_t module, UInt_t index) { // // # pixels of the cluster in Z direction // - if (layer>=fNlayers) { - printf("ERROR: UpgradeClusterFinder::GetClusterWidthZ: Module out of bounds: layer = %d\n",layer); + if (module>=fNSectors) { + printf("ERROR: UpgradeClusterFinder::GetClusterWidthZ: Module out of bounds: module = %d\n",module); return 0; } - return fClusterList[layer].GetWidthZIndex(index); + return fClusterList[module]->GetWidthZIndex(index); } //___________________________________________________________________________________ -UInt_t AliITSUpgradeClusterFinder::GetClusterWidthPhi(Int_t layer, UInt_t index) { +UInt_t AliITSUpgradeClusterFinder::GetClusterWidthPhi(Int_t module, UInt_t index) { // // # pixels of the cluster in phi direction (XY plane) // - if (layer>=fNlayers) { - printf("ERROR: UpgradeClusterFinder::GetClusterWidthPhi: Module out of bounds: layer = %d\n",layer); + if (module>=fNSectors) { + printf("ERROR: UpgradeClusterFinder::GetClusterWidthPhi: Module out of bounds: module = %d\n",module); return 0; } - return fClusterList[layer].GetWidthPhiIndex(index); + return fClusterList[module]->GetWidthPhiIndex(index); } //___________________________________________________________________________________ -UInt_t AliITSUpgradeClusterFinder::GetClusterType(Int_t layer, UInt_t index) { +UInt_t AliITSUpgradeClusterFinder::GetClusterType(Int_t module, UInt_t index) { // // cluster shape // - if (layer>=fNlayers) { - printf("ERROR: UpgradeClusterFinder::GetClusterType: Module out of bounds: layer = %d\n",layer); + if (module>=fNSectors) { + printf("ERROR: UpgradeClusterFinder::GetClusterType: Module out of bounds: layer = %d\n",module); return 0; } - return fClusterList[layer].GetTypeIndex(index); + return fClusterList[module]->GetTypeIndex(index); } //___________________________________________________________________________________ void AliITSUpgradeClusterFinder::PrintAllClusters() { @@ -203,27 +214,27 @@ void AliITSUpgradeClusterFinder::PrintAllClusters() { // printout of the cluster information // - for (Int_t layer=0; layer=fNlayers) { - printf("ERROR: UpgradeClusterFinder::PrintClusters: Out of bounds: layer = %d\n",layer); + if (module>=fNSectors) { + printf("ERROR: UpgradeClusterFinder::PrintClusters: Out of bounds: layer = %d\n",module); return; } - if(fClusterList[layer].GetNrEntries()==0) { + if(fClusterList[module]->GetNrEntries()==0) { printf("no cluster list entries. Exiting... \n"); return; } - for (UInt_t c=0; cGetNrEntries(); c++) { + //printf("layer %d , z,y=%f,%f , size=%d , type=%d labels=%d %d %d (label printout to be implemented...)\n",layer,fClusterList[layer].GetColIndex(c),fClusterList[layer].GetRowIndex(c),fClusterList[layer].GetSizeIndex(c),fClusterList[layer].GetTypeIndex(c),999,999,999); + // } } //___________________________________________________________________________________ void AliITSUpgradeClusterFinder::NewEvent() { @@ -231,10 +242,10 @@ void AliITSUpgradeClusterFinder::NewEvent() { // Cleaning up and preparation for the clustering procedure // - for (Int_t i=0; iClear(); + } + //NewModule(); fOldModule = -1; } //___________________________________________________________________________________ @@ -247,7 +258,7 @@ void AliITSUpgradeClusterFinder::NewModule() { fChargeArray->Clear(); } //___________________________________________________________________________________ -Int_t AliITSUpgradeClusterFinder::DoModuleClustering(Int_t Layer, UShort_t charge) { +Int_t AliITSUpgradeClusterFinder::DoModuleClustering(Int_t module, UShort_t charge) { // // Clustering and cluster-list container filling // @@ -265,14 +276,14 @@ Int_t AliITSUpgradeClusterFinder::DoModuleClustering(Int_t Layer, UShort_t charg memset(fClusterTypeArea,0,kMAXCLUSTERTYPESIDEZ*kMAXCLUSTERTYPESIDEY*sizeof(Bool_t)); fColSum=0; fRowSum=0; - UInt_t size = FindClusterRecu(fClusterTypeOrigCol,fClusterTypeOrigRow,charge); + UInt_t size = FindClusterRecu(fClusterTypeOrigCol,fClusterTypeOrigRow,charge); if(size==1){ fCharge=GetPixelCharge(fColSum,fRowSum); AddLabelIndex(fColSum,fRowSum); } if (size>0) { if(size>1) AliDebug(2,Form("DoModuleClustering, size %i , labels : %i %i %i \n",size,fLabels[0],fLabels[1],fLabels[2])); - fClusterList[Layer].Insert((Float_t)fColSum/size, (Float_t)fRowSum/size, size, GetClusterWidthZ(), GetClusterWidthPhi(), GetClusterType(size), fCharge,fLabels); + fClusterList[module]->Insert((Float_t)fColSum/size, (Float_t)fRowSum/size, size, GetClusterWidthZ(), GetClusterWidthPhi(), GetClusterType(size), fCharge,fLabels); fCharge=0; for(Int_t i=0; i<10; i++) fLabels[i]=-5; } @@ -398,12 +409,12 @@ void AliITSUpgradeClusterFinder::ShiftClusterTypeArea(UInt_t direction) { } } //___________________________________________________________________________________ -UShort_t AliITSUpgradeClusterFinder::GetCharge(Int_t layer,UInt_t index ) { - return fClusterList[layer].GetCharge(index); +UShort_t AliITSUpgradeClusterFinder::GetCharge(Int_t module,UInt_t index ) { + return fClusterList[module]->GetCharge(index); } //___________________________________________________________________________________ -Int_t * AliITSUpgradeClusterFinder::GetLabels(Int_t layer,UInt_t index) { - return fClusterList[layer].GetLabels(index); +Int_t * AliITSUpgradeClusterFinder::GetLabels(Int_t module,UInt_t index) { + return fClusterList[module]->GetLabels(index); } //___________________________________________________________________________________ @@ -701,21 +712,34 @@ UInt_t AliITSUpgradeClusterFinder::GetPixelCharge(UInt_t col, UInt_t row){ //...self explaining // Int_t q=0; + //AliInfo(Form(" entrate charge array %i ", fChargeArray->GetEntries())); for(Int_t entry =0; entry < fChargeArray->GetEntries(); entry++){ - TObjString *s = (TObjString*)fChargeArray->At(entry); +/* TObjString *s = (TObjString*)fChargeArray->At(entry); TString name = s->GetString(); if(!name.Contains(Form("%i %i",col,row))) continue; + AliInfo(Form(" 1 entry %i ", entry)); TObjArray *array = name.Tokenize(" "); + array->SetOwner(kTRUE); + AliInfo(Form(" 2 entry %i ", entry)); TString charge = ((TObjString*)array->At(2))->String(); + TString rowS, colS; rowS = ((TObjString*)array->At(0))->String(); colS = ((TObjString*)array->At(1))->String(); + AliInfo(Form(" 3 prima del delete entry %i ", entry)); + array->Clear(); delete array; + AliInfo(Form(" 4 dopo il delete entry %i ", entry)); q=charge.Atoi(); - return q; +*/ + AliITSUPixelModule *pixMod = (AliITSUPixelModule*)fChargeArray->At(entry); + // pixMod->PrintInfo(); + if(col!=pixMod->GetCol())continue; + if(row!=pixMod->GetRow())continue; + q= pixMod->GetCharge(); - } + } return q; } //____________________________________________________ @@ -726,7 +750,7 @@ void AliITSUpgradeClusterFinder::AddLabelIndex(UInt_t col, UInt_t row){ // for(Int_t entry =0; entry < fChargeArray->GetEntries(); entry++){ - TObjString *s = (TObjString*)fChargeArray->At(entry); +/* TObjString *s = (TObjString*)fChargeArray->At(entry); TString name = s->GetString(); if(!name.Contains(Form("%i %i",col,row))) continue; @@ -738,8 +762,15 @@ void AliITSUpgradeClusterFinder::AddLabelIndex(UInt_t col, UInt_t row){ label[i]=index[i].Atoi(); } +*/ + AliITSUPixelModule *pix= (AliITSUPixelModule*)fChargeArray->At(entry); + if(col!=pix->GetCol())continue; + if(row!=pix->GetRow())continue; + Int_t label[3]={-1,-1,-1}; + for(Int_t i=0;i<3;i++){ + label[i] = pix->GetLabels(i); + } SetLabels(label); - delete array; } } //____________________________________________________ @@ -801,70 +832,66 @@ void AliITSUpgradeClusterFinder::DigitsToRecPoints(const TObjArray *digList) { AliITSRecPointU recpnt; Int_t nClusters =0; TClonesArray &lrecp = *fRecPoints; - - for(Int_t ilayer=0; ilayer < fNlayers ;ilayer ++){ + for(Int_t ilayer=0; ilayer < 6 ;ilayer ++){ + NewModule(); TClonesArray *pArrDig= (TClonesArray*)digList->At(ilayer); - StartEvent(); - AliDebug(1,Form("layer %i : # digits %i",ilayer,pArrDig->GetEntries())); + StartEvent(); + pArrDig->Sort(); + for(Int_t ientr =0; ientr < pArrDig->GetEntries() ; ientr++){ AliITSDigitUpgrade *dig = (AliITSDigitUpgrade*)pArrDig->At(ientr); Int_t colz=dig->GetzPixelNumber(); Int_t rowx=dig->GetxPixelNumber(); Double_t hitcharge= (dig->GetNelectrons()); - - ProcessHit(ilayer,colz, rowx,(Short_t)hitcharge,dig->GetTracks()); + ProcessHit(dig->GetModule(),colz, rowx,(Short_t)hitcharge,dig->GetTracks()); }//ientr FinishEvent(); - - for(UInt_t nClu = 0; nClu < GetClusterCount(ilayer); nClu++){ - UShort_t charge = GetCharge(ilayer, nClu); + for(Int_t module=0; moduleGetCellSizeX(ilayer))+0.5*(segmentation-> GetCellSizeX(ilayer)); - xzl2[1] = zPixC2*(segmentation->GetCellSizeZ(ilayer))+0.5*(segmentation->GetCellSizeZ(ilayer))-(segmentation->GetHalfLength(ilayer)); - check2 = segmentation->DetToGlobal(ilayer,xzl2[0], xzl2[1],xcheck2,ycheck2,zcheck2); - recpnt.SetType(GetClusterType(ilayer,nClu )); + xzl2[1] = zPixC2*(segmentation->GetCellSizeZ(ilayer))+0.5*(segmentation->GetCellSizeZ(ilayer))-(segmentation->GetHalfLength(ilayer)); + //cout << " vediamo che positione ha il recpoint !!!! zl = "<< xzl2[1] << endl; + //check2 = segmentation->DetToGlobal(ilayer,xzl2[0], xzl2[1],xcheck2,ycheck2,zcheck2); + recpnt.SetType(GetClusterType(module,nClu )); recpnt.SetLocalCoord(xzl2[0],xzl2[1]); //temporary solution (no LocalToTrack Matrix) //from global to tracking system coordinate // global coordinate -> local coordinate getting alpha angle of the recpoint - Float_t xclg = xcheck2;//upgrade clusters global coordinate ( ITS official: GetX tracking coordinate) - Float_t yclg = ycheck2; - Float_t zclg = zcheck2; - Double_t phiclu1rad, phiclu1deg; - phiclu1rad=TMath::ATan2(yclg,xclg);//cluster phi angle (rad) - if (phiclu1rad<0) phiclu1rad+=TMath::TwoPi();//from 0 to 360 - else if (phiclu1rad>=TMath::TwoPi()) phiclu1rad-=TMath::TwoPi();// - - phiclu1deg=180.*phiclu1rad/TMath::Pi();// in deg - Int_t ladder;// virtual segmentation starting from the cluster phi - - ladder=(Int_t)phiclu1deg/18;// in which ladder the cluster is - Double_t alpha= (ladder*18.+9.)*TMath::Pi()/180.;//angle at the center of the ladder (rad) - - //alpha rotation - Float_t xclu1Tr = xclg*TMath::Cos(alpha)-yclg*TMath::Sin(alpha); - Float_t yclu1 = yclg*TMath::Cos(alpha)+xclg*TMath::Sin(alpha); - Float_t xclu1 = TMath::Sqrt(xclu1Tr*xclu1Tr+yclu1*yclu1); - Float_t zclu1 = zclg; - Double_t phiTrk= (phiclu1rad-alpha);// cluster angle in the rotated system (rad) - - yclu1=xclu1*phiTrk; // tracking system coordinate: r*phi + ///// + Double_t yclu1 = 0.;//upgrade clusters global coordinate ( ITS official: GetX tracking coordinate) + Double_t zclu1 = 0.;//upgrade clusters global coordinate ( ITS official: GetX tracking coordinate) + // Float_t xclg = xcheck2;//upgrade clusters global coordinate ( ITS official: GetX tracking coordinate) + // Float_t yclg = ycheck2; + // Float_t zclg = zcheck2; + Bool_t detr=kFALSE; + detr = segmentation->DetToTrack(ilayer,module, xzl2[0],xzl2[1], yclu1, zclu1); +// printf( " det to track in clusterfinder il %i xl %f zl %f y track %f z track %f module %i \n", ilayer, xzl2[0] , xzl2[1] , yclu1, zclu1, module); + +////////////////////////// recpnt.SetX(0.); recpnt.SetY(yclu1); recpnt.SetZ(zclu1); - + + Double_t xsize, zsize; segmentation->GetSegmentation(ilayer,xsize, zsize); recpnt.SetSigmaY2(xsize/TMath::Sqrt(12)*xsize/TMath::Sqrt(12)); @@ -872,7 +899,9 @@ void AliITSUpgradeClusterFinder::DigitsToRecPoints(const TObjArray *digList) { new(lrecp[nClusters++]) AliITSRecPointU(recpnt); //Int_t idx = fRecPoints->GetEntries(); AliDebug(1,Form("recpoint : Nelectrons %f (entry %i)",recpnt.GetQ(),fRecPoints->GetEntries())); - }//cluster list entries + + }//cluster list entries + }//module }//ilayer if(segmentation) delete segmentation; } diff --git a/ITS/UPGRADE/AliITSUpgradeClusterFinder.h b/ITS/UPGRADE/AliITSUpgradeClusterFinder.h index e9f018a2dda..2469e38b41b 100644 --- a/ITS/UPGRADE/AliITSUpgradeClusterFinder.h +++ b/ITS/UPGRADE/AliITSUpgradeClusterFinder.h @@ -98,12 +98,11 @@ class AliITSUpgradeClusterFinder :public TObject{ UShort_t fClusterWidthMaxRow; //max row ID of the cluster UShort_t fClusterWidthMinRow; //min row ID of the cluster Bool_t fClusterTypeArea[kMAXCLUSTERTYPESIDEZ][kMAXCLUSTERTYPESIDEY];// same as above comments - AliITSUpgradeClusterList fClusterList[8]; // cluster container + AliITSUpgradeClusterList **fClusterList; //[fNSectors] cluster container TObjArray *fChargeArray; // charge identifier TClonesArray *fRecPoints; // used to fill treeR - Int_t fNlayers;//number of layer in ITSUpgrade - + Int_t fNSectors; AliITSUpgradeClusterFinder(const AliITSUpgradeClusterFinder &source); // copy constructor // assignment operator AliITSUpgradeClusterFinder& operator=(const AliITSUpgradeClusterFinder &source); diff --git a/ITS/UPGRADE/AliITSsegmentationUpgrade.cxx b/ITS/UPGRADE/AliITSsegmentationUpgrade.cxx index ed9e62bdf6e..9b993ff0ea1 100644 --- a/ITS/UPGRADE/AliITSsegmentationUpgrade.cxx +++ b/ITS/UPGRADE/AliITSsegmentationUpgrade.cxx @@ -34,9 +34,11 @@ ClassImp(AliITSsegmentationUpgrade) //_____________________________________________________________________________ - AliITSsegmentationUpgrade::AliITSsegmentationUpgrade(): TObject(), + AliITSsegmentationUpgrade::AliITSsegmentationUpgrade(): +TObject(), fCellSizeX(0), fCellSizeZ(0), + fNSectors(0), fMinRadius(0), fMaxRadius(0), fHalfLength(0) @@ -49,12 +51,15 @@ ClassImp(AliITSsegmentationUpgrade) TFile *f=TFile::Open("Segmentation.root"); TArrayD *x=0; TArrayD *z=0; + TArrayD *nS=0; + if(!f){ AliError("Segmentation not available"); return; }else { x=(TArrayD*)f->Get("CellSizeX"); z=(TArrayD*)f->Get("CellSizeZ"); + nS=(TArrayD*)f->Get("nSectors"); } f->Close(); @@ -65,12 +70,13 @@ ClassImp(AliITSsegmentationUpgrade) AliInfo(Form("the volume %s has not been found... exiting!",Form("LayerSilicon%i",i))); return; } + TGeoTube *shape = (TGeoTube*)vol->GetShape(); if(!shape) { AliInfo(Form("the volume %s has not shape defined... exiting!",vol->GetName())); return; } - + // AliInfo(Form(" volume index %i ", i)); // setting the geometry parameters (needed for trasformations Global-Local) fMaxRadius.Set(i+1); fMaxRadius.AddAt(shape->GetRmax(),i); fMinRadius.Set(i+1); fMinRadius.AddAt(shape->GetRmin(),i); @@ -81,11 +87,15 @@ ClassImp(AliITSsegmentationUpgrade) fCellSizeZ.AddAt(z->At(i),i); i++; } + fNSectors = (Int_t)(nS->At(0)); + } //_______________________________________________________________ -AliITSsegmentationUpgrade::AliITSsegmentationUpgrade(TArrayD radii, TArrayD widths, TArrayD Length): TObject(), +AliITSsegmentationUpgrade::AliITSsegmentationUpgrade(TArrayD radii, TArrayD widths, TArrayD Length): +TObject(), fCellSizeX(0), fCellSizeZ(0), + fNSectors(110), fMinRadius(0), fMaxRadius(0), fHalfLength(0) @@ -126,7 +136,7 @@ void AliITSsegmentationUpgrade::GetSegmentation(Int_t ilayer, Double_t &xsize, D zsize =fCellSizeZ.At(ilayer); } //_____________________________________________________________________________ -Bool_t AliITSsegmentationUpgrade::GlobalToDet(Int_t ilayer, Double_t x,Double_t y,Double_t z,Double_t &xl,Double_t &zl) { +Bool_t AliITSsegmentationUpgrade::GlobalToDet(Int_t ilayer, Double_t x,Double_t y,Double_t z,Double_t &xl,Double_t &zl) const{ if(TMath::Abs(z)>fHalfLength.At(ilayer)) return kFALSE; @@ -152,8 +162,6 @@ Bool_t AliITSsegmentationUpgrade::DetToGlobal(Int_t ilayer, Double_t xl,Double_t x = fMaxRadius.At(ilayer)*TMath::Cos(alpha); y = fMaxRadius.At(ilayer)*TMath::Sin(alpha); - Int_t layer=0; - layer=ilayer; return kTRUE; } //_______________________________________________________________________________ @@ -187,4 +195,146 @@ Int_t AliITSsegmentationUpgrade::GetNLayers(){ } +//__________________________________________________________________________________ +Bool_t AliITSsegmentationUpgrade::DetToGlobal(Int_t ilayer, Int_t module, Double_t xl,Double_t zl,Double_t &x,Double_t &y, Double_t &z) const { +if(module<0){ DetToGlobal(ilayer,xl,zl, x, y, z); +return kTRUE; +} + + if(TMath::Abs(z)>fHalfLength.At(ilayer)) return kFALSE; + z = zl; + Double_t alpha = (xl+module*(fMaxRadius.At(ilayer)*((TMath::Pi()*2)/fNSectors)))/fMaxRadius.At(ilayer); + + + x = fMaxRadius.At(ilayer)*TMath::Cos(alpha); + y = fMaxRadius.At(ilayer)*TMath::Sin(alpha); + +return kTRUE; +} +//_______________________________________________________________________________________________ +Bool_t AliITSsegmentationUpgrade::GlobalToDet(Int_t ilayer, Double_t x,Double_t y,Double_t z,Double_t &xl,Double_t &zl,Int_t &module) const { + if(module<0){ + GlobalToDet(ilayer,x,y,z, xl, zl); + return kTRUE; + } + + if(TMath::Abs(z)>fHalfLength.At(ilayer)) return kFALSE; + + zl = z; + + Double_t xyproj= TMath::Sqrt(x*x+y*y); + if(xyproj==0 || xyproj-0.001 > fMaxRadius.At(ilayer)){ +return kFALSE; + } + Double_t alpha= TMath::ATan2(y,x); + if(x>0 && y<0)alpha=alpha+2.*(TMath::Pi()); + if(x<0 && y<0)alpha=alpha+2.*(TMath::Pi()); + + module = (Int_t)(alpha*(fNSectors/(TMath::Pi()*2))); + Double_t alphaSect= module*((TMath::Pi()*2)/fNSectors); + xl = xyproj*(alpha-alphaSect);//with respect the module + //AliInfo(Form(" globtodet con modulo x,y,z = %f, %f, %f, alpha %f module %i alpha del modulo %f xlocal %f xlocal rispettp al modulo %f ", x,y,z,alpha,module, alphaSect, xyproj*alpha, xl)); + return kTRUE; +} +//____________________________________________________________________________________________________ +Bool_t AliITSsegmentationUpgrade::DetToPixID(Double_t xl, Double_t zl,Int_t layer, Int_t &nx, Int_t &nz) const { + + if(xl>fMaxRadius.At(layer)*(TMath::Pi()*2/fNSectors))return kFALSE; + if(TMath::Abs(zl)>fHalfLength.At(layer)) return kFALSE; + + nx=(Int_t)(xl/fCellSizeX.At(layer)); + //printf(" half %f \n ", fHalfLength.At(layer)); + nz=(Int_t)((zl+fHalfLength.At(layer))/fCellSizeZ.At(layer)); + return kTRUE; +} +//_________________________________________________________________________________________________________ +Bool_t AliITSsegmentationUpgrade::DetToTrack2(Int_t layer,Int_t module, Double_t xl,Double_t zl, Double_t &ytr, Double_t &ztr)const { + //sistema di tracciamento la x=0, y è la rphi rispetto al centro del modulo + //sistema locale è la y=0 x è rphi rispetto all'inizio del modulo + + //voglio andare dalle locali alle tracciamento + Double_t x=0.; + Double_t y=0.; + Double_t z=0.; +// printf( " det to track xl %f zl %f \n ", xl, zl); + ztr = zl; + Bool_t ch=kFALSE; + ch=DetToGlobal(layer,module,xl,zl,x,y,z); + Double_t radius =fMaxRadius.At(layer); + Double_t phiGrad; + phiGrad=TMath::ATan2(y,x);//cluster phi angle (rad) + if (phiGrad<0) phiGrad+=TMath::TwoPi();//from 0 to 360 + else if (phiGrad>=TMath::TwoPi()) phiGrad-=TMath::TwoPi();// + + Double_t alpha= (module*(((TMath::Pi()*2)/fNSectors))+(((TMath::Pi()*2)/fNSectors)/2));//angle at the center of the ladder (rad) + + Double_t phiTrk= (phiGrad-alpha);// cluster angle in the rotated system (rad) + + ytr=radius*phiTrk; // tracking system coordinate: r*phi + // AliInfo(Form( " det : x %f | track y %f, zeta %f ", xl, ytr,ztr)); + return kTRUE; +} +//__________________________________________ +Bool_t AliITSsegmentationUpgrade::DetToTrack(Int_t layer,Int_t module, Double_t xl,Double_t zl, Double_t &ytr, Double_t &ztr)const { + //sistema di tracciamento la x=0, y è la rphi rispetto al centro del modulo + //sistema locale è la y=0 x è rphi rispetto all'inizio del modulo + + //voglio andare dalle locali alle tracciamento + ztr = zl; + Double_t radius =fMaxRadius.At(layer); + Double_t alphaloc = module*(TMath::Pi()*2)/fNSectors; //alpha di riferimento per il modulo locale in rad + Double_t xlrif = alphaloc*radius;//xlocale di riferimento per questo modulo + + Double_t xlvera = xlrif + xl; // x locale vera rispetto a tutto il cilindro, per sapere a che angolo sto effettivamente + + Double_t alphaGlob = xlvera/radius; //in rad + +//da alpha vera posso ottenereinfo di tracciamento + + Double_t alpha_track= (module*(((TMath::Pi()*2)/fNSectors))+(((TMath::Pi()*2)/fNSectors)/2));//angle at the center of the ladder (rad) + + Double_t phiTrk= (alphaGlob-alpha_track);// cluster angle in the rotated system (rad) + + ytr=radius*phiTrk; // tracking system coordinate: r*phi +// AliInfo(Form( " det : x %f | track y %f, zeta %f ", xl, ytr,ztr)); + return kTRUE; +} +//_______________________ +Int_t AliITSsegmentationUpgrade::GetModule(Double_t x,Double_t y)const{ + + + Double_t alpha= TMath::ATan2(y,x); + if(x>0 && y<0)alpha=alpha+2.*(TMath::Pi()); + if(x<0 && y<0)alpha=alpha+2.*(TMath::Pi()); + +return GetModule(alpha); +} +//_______________________ +Int_t AliITSsegmentationUpgrade::GetModule(Double_t phi) const { +// +// sector corresponding to that phi [0,2Pi] +// + +Int_t module = -1; +if(phi<0 || phi > TMath::TwoPi()) { + AliError(Form("Phi is not within the acceptable range [0,2Pi] %f ",phi)); + } +else { + module = (Int_t) (phi*((Double_t)fNSectors/(TMath::TwoPi()))); + } + +return module; + +} +//_______________________ +Double_t AliITSsegmentationUpgrade::GetAlpha(Int_t module)const{ +// +// angle of the sector center +// +Double_t angle = TMath::DegToRad()*(360./fNSectors); +return module*angle+0.5*angle; + +} + + diff --git a/ITS/UPGRADE/AliITSsegmentationUpgrade.h b/ITS/UPGRADE/AliITSsegmentationUpgrade.h index 92b74595a29..881212beaef 100644 --- a/ITS/UPGRADE/AliITSsegmentationUpgrade.h +++ b/ITS/UPGRADE/AliITSsegmentationUpgrade.h @@ -28,29 +28,41 @@ class AliITSsegmentationUpgrade : public TObject { // Set Detector Segmentation Parameters virtual void SetSegmentation(Int_t ilayer, Double_t xsize, Double_t zsize); // x/z size in microns virtual void SetFullSegmentation(TArrayD xsize, TArrayD zsize); // x/z size in microns + virtual void SetNSectors(Int_t nSect) {fNSectors=nSect;} virtual void GetNpad(Int_t ilayer, Int_t &nx, Int_t &nz); // Transformation from Geant cm detector center local coordinates // to detector segmentation/cell coordiantes starting from (0,0). - Bool_t GlobalToDet(Int_t ilayer, Double_t x,Double_t y,Double_t z,Double_t &xl,Double_t &zl); + Bool_t GlobalToDet(Int_t ilayer, Double_t x,Double_t y,Double_t z,Double_t &xl,Double_t &zl) const; + Bool_t GlobalToDet(Int_t ilayer, Double_t x,Double_t y,Double_t z,Double_t &xl,Double_t &zl, Int_t &module) const; + // Transformation from detector segmentation/cell coordiantes starting // from (0,0) to Geant cm detector center local coordinates. Bool_t DetToGlobal(Int_t ilayer, Double_t xl,Double_t zl,Double_t &x,Double_t &y, Double_t &z) const; - - // + Bool_t DetToGlobal(Int_t ilayer, Int_t module, Double_t xl,Double_t zl,Double_t &x,Double_t &y, Double_t &z) const; + Bool_t DetToPixID(Double_t xl, Double_t zl,Int_t layer, Int_t &nx, Int_t &nz) const; + Bool_t DetToTrack(Int_t layer,Int_t module, Double_t xl, Double_t zl, Double_t &ytr, Double_t &ztr)const; + Bool_t DetToTrack2(Int_t layer,Int_t module, Double_t xl, Double_t zl, Double_t &ytr, Double_t &ztr)const; + // // Get Detector Segmentation Parameters // + Int_t GetIdIndex(Int_t layer, Int_t sector) const {return sector*100 + layer; } + Int_t GetLayerFromIdIndex(Int_t id)const {return id%100; } + Int_t GetModuleFromIdIndex(Int_t id)const {return id/100; } + Double_t GetCellSizeX(Int_t ilayer){return fCellSizeX.At(ilayer);} Double_t GetCellSizeZ(Int_t ilayer){return fCellSizeZ.At(ilayer);} Double_t GetHalfLength(Int_t ilayer){return fHalfLength.At(ilayer);} Double_t GetRadius(Int_t ilayer) {return fMinRadius.At(ilayer);} - + Double_t GetAlpha(Int_t module) const; + Int_t GetModule(Double_t phi)const; + Int_t GetModule(Double_t x, Double_t y)const; TArrayD GetFullCellSizeX() {return fCellSizeX;} TArrayD GetFullCellSizeZ() {return fCellSizeZ;} // Pixel size in x,z virtual void GetSegmentation(Int_t ilayer, Double_t &xsize, Double_t &zsize) const; - + Int_t GetNSectors() {return fNSectors;} // layer thickness virtual Float_t GetThickness(Int_t ilayer) const {if(ilayer > fMinRadius.GetSize() || ilayer < 0) return -1; else return fMaxRadius.At(ilayer) - fMinRadius.At(ilayer);} @@ -60,6 +72,7 @@ class AliITSsegmentationUpgrade : public TObject { TArrayD fCellSizeX; //Size for each pixel in x -microns TArrayD fCellSizeZ; //Size for each pixel in z -microns + Int_t fNSectors; TArrayD fMinRadius ; // layer inner radius TArrayD fMaxRadius ; // layer outer radius TArrayD fHalfLength ; // layer length @@ -67,7 +80,7 @@ class AliITSsegmentationUpgrade : public TObject { AliITSsegmentationUpgrade(const AliITSsegmentationUpgrade &source); AliITSsegmentationUpgrade& operator=(const AliITSsegmentationUpgrade &source); - ClassDef(AliITSsegmentationUpgrade,1) //Segmentation class for Upgrade + ClassDef(AliITSsegmentationUpgrade,2) //Segmentation class for Upgrade }; diff --git a/ITS/UPGRADE/AliITStrackU.cxx b/ITS/UPGRADE/AliITStrackU.cxx index d323bf9c78b..9da8728cf40 100755 --- a/ITS/UPGRADE/AliITStrackU.cxx +++ b/ITS/UPGRADE/AliITStrackU.cxx @@ -115,9 +115,9 @@ AliITStrackU::AliITStrackU(const AliITStrackU& t, Bool_t trackMI) : if(trackMI){ fLab = t.fLab; fFakeRatio = t.fFakeRatio; - for(Int_t i=0; i=TMath::TwoPi()) alpha-=TMath::TwoPi(); diff --git a/ITS/UPGRADE/AliITStrackU.h b/ITS/UPGRADE/AliITStrackU.h index 03e59063d95..d1126fe0e2b 100755 --- a/ITS/UPGRADE/AliITStrackU.h +++ b/ITS/UPGRADE/AliITStrackU.h @@ -84,11 +84,11 @@ class AliITStrackU : public AliITStrackV2 { Int_t fCluMark[fgMaxNLayer][kMaxNumberOfClustersL]; //indices for cluster used Int_t fNM[fgMaxNLayer]; //number of marked clusters - Float_t fDy[12]; //dy in layer - Float_t fDz[12]; //dz in layer - Float_t fSigmaY[12]; //sigma y - Float_t fSigmaZ[12]; //sigma z - Float_t fSigmaYZ[12]; //covariance of y and z + Float_t fDy[fgMaxNLayer]; //dy in layer + Float_t fDz[fgMaxNLayer]; //dz in layer + Float_t fSigmaY[fgMaxNLayer]; //sigma y + Float_t fSigmaZ[fgMaxNLayer]; //sigma z + Float_t fSigmaYZ[fgMaxNLayer]; //covariance of y and z Float_t fNy[fgMaxNLayer]; //expected size of cluster Float_t fNz[fgMaxNLayer]; //expected size of cluster diff --git a/ITS/UPGRADE/AliITStrackerUpgrade.cxx b/ITS/UPGRADE/AliITStrackerUpgrade.cxx index 59e6246c462..90e4aba9041 100644 --- a/ITS/UPGRADE/AliITStrackerUpgrade.cxx +++ b/ITS/UPGRADE/AliITStrackerUpgrade.cxx @@ -35,7 +35,7 @@ #include "AliESDtrack.h" #include "AliITSVertexer.h" #include "AliITSclusterTable.h" -#include "AliITSRecPoint.h" +#include "AliITSRecPointU.h" #include "AliITStrackU.h" #include "AliITStrackerMI.h" #include "AliITSlayerUpgrade.h" @@ -230,7 +230,7 @@ Int_t AliITStrackerUpgrade::LoadClusters(TTree *clusTree){ // Load clusters for tracking // - TClonesArray statITSCluster("AliITSRecPoint"); + TClonesArray statITSCluster("AliITSRecPointU"); TClonesArray *ITSCluster = &statITSCluster; TBranch* itsClusterBranch=clusTree->GetBranch("ITSRecPoints"); @@ -242,8 +242,8 @@ Int_t AliITStrackerUpgrade::LoadClusters(TTree *clusTree){ clusTree->GetEvent(0); Int_t nCluster = ITSCluster->GetEntriesFast(); for(Int_t i=0; iUncheckedAt(i); - fLayers[recp->GetLayer()]->InsertCluster(new AliITSRecPoint(*recp)); + AliITSRecPointU *recp = (AliITSRecPointU*)ITSCluster->UncheckedAt(i); + fLayers[recp->GetLayer()]->InsertCluster(new AliITSRecPointU(*recp)); }//loop clusters SetClusterTree(clusTree); @@ -288,7 +288,7 @@ Int_t AliITStrackerUpgrade::FindTracks(AliESDEvent* event,Bool_t useAllClusters) Int_t idx[12]; Int_t ncl = track->GetITSclusters(idx); for(Int_t k=0;kSetBit(kSAflag); } } @@ -300,7 +300,7 @@ Int_t AliITStrackerUpgrade::FindTracks(AliESDEvent* event,Bool_t useAllClusters) Int_t idx[12]; Int_t ncl = track->GetITSclusters(idx); for(Int_t k=0;kResetBit(kSAflag); } } @@ -330,7 +330,7 @@ Int_t AliITStrackerUpgrade::FindTracks(AliESDEvent* event,Bool_t useAllClusters) for(Int_t i=0;iGetNumberOfClusters();cli++){ - AliITSRecPoint* cls = (AliITSRecPoint*)fLayers[i]->GetCluster(cli); + AliITSRecPointU* cls = (AliITSRecPointU*)fLayers[i]->GetCluster(cli); if(cls->TestBit(kSAflag)==kTRUE) continue; //clusters used by TPC prol. if(cls->GetQ()==0) continue; //fake clusters dead zones if(i>1 && cls->GetQ()<=fMinQ) continue; // cut on SDD and SSD cluster charge @@ -339,7 +339,7 @@ Int_t AliITStrackerUpgrade::FindTracks(AliESDEvent* event,Bool_t useAllClusters) } dmar[i]=0; if(!fCluLayer[i]){ - fCluLayer[i] = new TClonesArray("AliITSRecPoint",nclusters[i]); + fCluLayer[i] = new TClonesArray("AliITSRecPointU",nclusters[i]); }else{ fCluLayer[i]->Delete(); fCluLayer[i]->Expand(nclusters[i]); @@ -357,7 +357,7 @@ Int_t AliITStrackerUpgrade::FindTracks(AliESDEvent* event,Bool_t useAllClusters) if (!ForceSkippingOfLayer(ilay)){ AliDebug(2,Form("number of clusters in layer %i : %i",ilay,fLayers[ilay]->GetNumberOfClusters())); for(Int_t cli=0;cliGetNumberOfClusters();cli++){ - AliITSRecPoint* cls = (AliITSRecPoint*)fLayers[ilay]->GetCluster(cli); + AliITSRecPointU* cls = (AliITSRecPointU*)fLayers[ilay]->GetCluster(cli); if(cls->TestBit(kSAflag)==kTRUE) continue; if(cls->GetQ()==0) continue; Double_t phi=0;Double_t lambda=0; @@ -483,7 +483,7 @@ AliITStrackV2* AliITStrackerUpgrade::FitTrack(AliITStrackU* tr,Double_t *primary static Int_t clind[fgMaxNLayer][kMaxClu]; static Int_t clmark[fgMaxNLayer][kMaxClu]; static Int_t end[fgMaxNLayer]; - static AliITSRecPoint *listlayer[fgMaxNLayer][kMaxClu]; + static AliITSRecPointU *listlayer[fgMaxNLayer][kMaxClu]; for(Int_t k=0;k> 28; //Int_t cli = index&0x0fffffff; //AliITSRecPoint* cl = (AliITSRecPoint*)fLayers[lay]->GetCluster(cli); - AliITSRecPoint* cl = (AliITSRecPoint*)GetCluster(index); + AliITSRecPointU* cl = (AliITSRecPointU*)GetCluster(index); if(cl->TestBit(kSAflag)==kTRUE) cl->ResetBit(kSAflag); inx[lay]=index; @@ -671,14 +671,13 @@ AliITStrackV2* AliITStrackerUpgrade::FitTrack(AliITStrackU* tr,Double_t *primary check2 = fSegmentation->DetToGlobal(layer,xz[0], xz[1],x,y,z); - Double_t phiclrad, phicldeg; + Double_t phiclrad; phiclrad=TMath::ATan2(y,x); if (phiclrad<0) phiclrad+=TMath::TwoPi(); else if (phiclrad>=TMath::TwoPi()) phiclrad-=TMath::TwoPi(); - phicldeg=180.*phiclrad/TMath::Pi(); - Int_t ladder=(Int_t)(phicldeg/18.);//virtual segmentation - Double_t alpha= (ladder*18.+9.)*TMath::Pi()/180.; + Double_t alpha = fSegmentation->GetAlpha(fSegmentation->GetModule(phiclrad)); + AliITStrackU trac(alpha,radius,yclu1,zclu1,phi2,tgl2,cv,1,fNLayers); if(cl7!=0){ trac.AddClusterV2(7,(clind[7][l7] & 0x0fffffff)>>0); @@ -823,7 +822,7 @@ Int_t AliITStrackerUpgrade::SearchClusters(Int_t layer,Double_t phiwindow,Double Int_t ncl = fCluLayer[layer]->GetEntries(); AliDebug(2,Form(" Number of clusters %i in layer %i.",ncl,layer)); for (Int_t index=0; indexAt(index); + AliITSRecPointU *c = (AliITSRecPointU*)fCluLayer[layer]->At(index); if (!c) continue; if (c->GetQ()<=0) continue; if(layer>1 && c->GetQ()<=fMinQ) continue; @@ -863,7 +862,7 @@ Int_t AliITStrackerUpgrade::SearchClusters(Int_t layer,Double_t phiwindow,Double Bool_t AliITStrackerUpgrade::SetFirstPoint(Int_t lay, Int_t clu, Double_t* primaryVertex){ // Sets the first point (seed) for tracking - AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[lay]->At(clu); + AliITSRecPointU* cl = (AliITSRecPointU*)fCluLayer[lay]->At(clu); if(!cl) return kFALSE; if (cl->GetQ()<=0) return kFALSE; if(lay>1 && cl->GetQ()<=fMinQ) return kFALSE; @@ -999,7 +998,7 @@ Int_t AliITStrackerUpgrade::FindLabel(AliITStrackV2* track) const { Int_t iNotLabel=0; for(Int_t i=0;iGetNumberOfClusters(); i++) { Int_t indexc = track->GetClusterIndex(i); - AliITSRecPoint* cl = (AliITSRecPoint*)GetCluster(indexc); + AliITSRecPointU* cl = (AliITSRecPointU*)GetCluster(indexc); AliDebug(2,Form(" cluster index %i ",indexc)); Int_t iLayer=cl->GetLayer(); for(Int_t k=0;k<3;k++){ @@ -1101,24 +1100,8 @@ void AliITStrackerUpgrade::SetFixedWindowSizes(Int_t n, Double_t *phi, Double_t } //_______________________________________________________________________ -void AliITStrackerUpgrade::GetCoorAngles(AliITSRecPoint* cl,Double_t &phi,Double_t &lambda, Double_t &x, Double_t &y,Double_t &z,Double_t* vertex){ +void AliITStrackerUpgrade::GetCoorAngles(AliITSRecPointU* cl,Double_t &phi,Double_t &lambda, Double_t &x, Double_t &y,Double_t &z,Double_t* vertex){ //Returns values of phi (azimuthal) and lambda angles for a given cluster - /* - Double_t rot[9]; fGeom->GetRotMatrix(module,rot); - Int_t lay,lad,det; fGeom->GetModuleId(module,lay,lad,det); - Float_t tx,ty,tz; fGeom->GetTrans(lay,lad,det,tx,ty,tz); - - Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi(); - Double_t phi1=TMath::Pi()/2+alpha; - if (lay==1) phi1+=TMath::Pi(); - - Float_t cp=TMath::Cos(phi1), sp=TMath::Sin(phi1); - Float_t r=tx*cp+ty*sp; - - xyz= r*cp - cl->GetY()*sp; - y= r*sp + cl->GetY()*cp; - z=cl->GetZ(); - */ Double_t xz[2]; xz[0]= cl->GetDetLocalX(); @@ -1134,7 +1117,7 @@ void AliITStrackerUpgrade::GetCoorAngles(AliITSRecPoint* cl,Double_t &phi,Double } //________________________________________________________________________ -void AliITStrackerUpgrade::GetCoorErrors(AliITSRecPoint* cl,Float_t &sx,Float_t &sy, Float_t &sz){ +void AliITStrackerUpgrade::GetCoorErrors(AliITSRecPointU* cl,Float_t &sx,Float_t &sy, Float_t &sz){ //returns sigmax, y, z of cluster in global coordinates /* @@ -1243,22 +1226,20 @@ Bool_t AliITStrackerUpgrade::RefitAtBase(Double_t xx,AliITStrackU *track, if (phi<0) phi+=TMath::TwoPi();//from 0 to 360 (rad) else if (phi>=TMath::TwoPi()) phi-=TMath::TwoPi();// - Double_t phideg=0.; - phideg=180.*phi/TMath::Pi();// in deg - Int_t ladder=(Int_t)(phideg/18.);// virtual segmentation - Double_t alpha= (ladder*18.+9.)*TMath::Pi()/180.; + + Double_t alpha = fSegmentation->GetAlpha(fSegmentation->GetModule(phi)); if (!track->Propagate(alpha,r)) { return kFALSE; } - const AliITSRecPoint *clAcc=0; + const AliITSRecPointU *clAcc=0; Double_t maxchi2=1000.*AliITSReconstructor::GetRecoParam()->GetMaxChi2(); Int_t idx=index[ilayer]; if (idx>=0) { // cluster in this layer Int_t cli = idx&0x0fffffff; - const AliITSRecPoint *cl=(AliITSRecPoint *)fLayers[ilayer]->GetCluster(cli); + const AliITSRecPointU *cl=(AliITSRecPointU *)fLayers[ilayer]->GetCluster(cli); if (cl) { Int_t cllayer = (idx & 0xf0000000) >> 28;; @@ -1296,7 +1277,7 @@ Bool_t AliITStrackerUpgrade::RefitAtBase(Double_t xx,AliITStrackU *track, } //_____________________________________________________________________ -Int_t AliITStrackerUpgrade::UpdateMI(AliITStrackU* track, const AliITSRecPoint* cl,Double_t chi2,Int_t index) const +Int_t AliITStrackerUpgrade::UpdateMI(AliITStrackU* track, const AliITSRecPointU* cl,Double_t chi2,Int_t index) const { // // Update ITS track @@ -1444,7 +1425,7 @@ Int_t AliITStrackerUpgrade::CorrectForLayerMaterial(AliITStrackU *t, //_____________________________________________________________________________ -Double_t AliITStrackerUpgrade::GetPredictedChi2MI(AliITStrackU* track, const AliITSRecPoint *cluster,Int_t layer) +Double_t AliITStrackerUpgrade::GetPredictedChi2MI(AliITStrackU* track, const AliITSRecPointU *cluster,Int_t layer) { // // Compute predicted chi2 @@ -1482,7 +1463,7 @@ Double_t AliITStrackerUpgrade::GetPredictedChi2MI(AliITStrackU* track, const Ali } //________________________________________________________________ Int_t AliITStrackerUpgrade::GetError(Int_t /*layer*/, - const AliITSRecPoint *cl, + const AliITSRecPointU *cl, Float_t /*tgl*/,Float_t /*tgphitr*/,Float_t /*expQ*/, Float_t &erry,Float_t &errz,Float_t &covyz, Bool_t /*addMisalErr*/) @@ -1501,7 +1482,7 @@ Int_t AliITStrackerUpgrade::GetError(Int_t /*layer*/, } //____________________________________________________________________- -Int_t AliITStrackerUpgrade::GetErrorOrigRecPoint(const AliITSRecPoint*cl, +Int_t AliITStrackerUpgrade::GetErrorOrigRecPoint(const AliITSRecPointU *cl, Float_t &erry,Float_t &errz,Float_t &covyz) { // @@ -1513,7 +1494,7 @@ Int_t AliITStrackerUpgrade::GetErrorOrigRecPoint(const AliITSRecPoint*cl, return 1; } //__________________________ -void AliITStrackerUpgrade::GetNTeor(Int_t layer,const AliITSRecPoint* /*cl*/, +void AliITStrackerUpgrade::GetNTeor(Int_t layer,const AliITSRecPointU* /*cl*/, Float_t tgl,Float_t tgphitr, Float_t &ny,Float_t &nz) { diff --git a/ITS/UPGRADE/AliITStrackerUpgrade.h b/ITS/UPGRADE/AliITStrackerUpgrade.h index 232b5a8a015..12d60f95c87 100644 --- a/ITS/UPGRADE/AliITStrackerUpgrade.h +++ b/ITS/UPGRADE/AliITStrackerUpgrade.h @@ -1,12 +1,6 @@ #ifndef ALIITSTRACKERUPGRADE_H #define ALIITSTRACKERUPGRADE_H - - -#include "AliITStrackerMI.h" -#include "AliITSlayerUpgrade.h" -#include "AliITStrackU.h" - /* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ @@ -19,7 +13,13 @@ // tracks are saved as AliITStrackV2 objects // //////////////////////////////////////////////////// + + #include +#include "AliITSRecPointU.h" +#include "AliITStrackerMI.h" +#include "AliITSlayerUpgrade.h" +#include "AliITStrackU.h" class AliITSclusterTable; class AliITStrackU; @@ -109,23 +109,23 @@ class AliITStrackerUpgrade : public AliITStrackerMI { Int_t SearchClusters(Int_t layer,Double_t phiwindow,Double_t lambdawindow, AliITStrackU* trs,Double_t zvertex,Int_t flagp); - void GetCoorAngles(AliITSRecPoint* cl,Double_t &phi,Double_t &lambda,Double_t &x,Double_t &y,Double_t &z,Double_t* vertex); - void GetCoorErrors(AliITSRecPoint* cl,Float_t &sx,Float_t &sy, Float_t &sz); + void GetCoorAngles(AliITSRecPointU* cl,Double_t &phi,Double_t &lambda,Double_t &x,Double_t &y,Double_t &z,Double_t* vertex); + void GetCoorErrors(AliITSRecPointU* cl,Float_t &sx,Float_t &sy, Float_t &sz); AliITSclusterTable* GetClusterCoord(Int_t layer,Int_t n) const {return (AliITSclusterTable*)fCluCoord[layer]->UncheckedAt(n);} void RemoveClusterCoord(Int_t layer, Int_t n) {fCluCoord[layer]->RemoveAt(n);fCluCoord[layer]->Compress();} Bool_t RefitAtBase(Double_t x, AliITStrackU *track, const Int_t *clusters); - Int_t UpdateMI(AliITStrackU* track, const AliITSRecPoint* cl,Double_t chi2,Int_t layer) const; + Int_t UpdateMI(AliITStrackU* track, const AliITSRecPointU* cl,Double_t chi2,Int_t layer) const; Int_t CorrectForLayerMaterial(AliITStrackU *t, Int_t layerindex, Double_t oldGlobXYZ[3], TString direction="inward"); - Double_t GetPredictedChi2MI(AliITStrackU* track, const AliITSRecPoint *cluster,Int_t layer); - static Int_t GetError(Int_t layer,const AliITSRecPoint*cl, + Double_t GetPredictedChi2MI(AliITStrackU* track, const AliITSRecPointU *cluster,Int_t layer); + static Int_t GetError(Int_t layer,const AliITSRecPointU *cl, Float_t tgl,Float_t tgphitr,Float_t expQ, Float_t &erry,Float_t &errz,Float_t &covyz, Bool_t addMisalErr=kTRUE); - static Int_t GetErrorOrigRecPoint(const AliITSRecPoint*cl, + static Int_t GetErrorOrigRecPoint(const AliITSRecPointU*cl, Float_t &erry,Float_t &errz,Float_t &covyz); - static void GetNTeor(Int_t layer,const AliITSRecPoint* cl, + static void GetNTeor(Int_t layer,const AliITSRecPointU* cl, Float_t tgl,Float_t tgphitr, Float_t &ny,Float_t &nz); static const Int_t fgMaxNLayer = 8; //max number of layers in ITSUpgrade diff --git a/ITS/UPGRADE/AliITSupgrade.cxx b/ITS/UPGRADE/AliITSupgrade.cxx index a352767bb67..f6e16c1ef29 100644 --- a/ITS/UPGRADE/AliITSupgrade.cxx +++ b/ITS/UPGRADE/AliITSupgrade.cxx @@ -17,8 +17,9 @@ #include //new constructor #include -#include //CreateGeometry() +#include #include //CreateGeometry() +#include #include //->gMC in StepManager #include //StepHistory #include @@ -39,6 +40,7 @@ ClassImp(AliITSupgrade) AliITS(), fWidths(0), fRadii(0), + fNSectors(20), fRadiiCu(0), fWidthsCu(0), fCopper(0), @@ -50,7 +52,6 @@ ClassImp(AliITSupgrade) fHalfLength(0), fSdigits(0), fDigits(0), - //fClusters(0), fSegmentation(0x0) { // @@ -63,6 +64,7 @@ AliITSupgrade::AliITSupgrade(const char *name,const char *title, Bool_t isBeamPi AliITS(name,title), fWidths(0), fRadii(0), + fNSectors(20), fRadiiCu(0), fWidthsCu(0), fCopper(0), @@ -132,13 +134,13 @@ AliITSupgrade::AliITSupgrade(const char *name,const char *title, Bool_t isBeamPi } SetFullSegmentation(xsizeSi,zsizeSi); - Init(); } //__________________________________________________________________________________________________ AliITSupgrade::AliITSupgrade(const char *name,const char *title, TArrayD widths, TArrayD radii,TArrayD halfLengths, TArrayD radiiCu, TArrayD widthsCu, TArrayS copper,Bool_t bp,Double_t radiusBP, Double_t widthBP, Double_t halfLengthBP): AliITS(name,title), fWidths(0), fRadii(0), + fNSectors(20), fRadiiCu(radiiCu), fWidthsCu(widthsCu), fCopper(copper), @@ -150,7 +152,6 @@ AliITSupgrade::AliITSupgrade(const char *name,const char *title, TArrayD widths, fHalfLength(halfLengths), fSdigits(0), fDigits(0), - //fClusters(0), fSegmentation(0x0) { @@ -256,15 +257,6 @@ void AliITSupgrade::CreateGeometry() PrintSummary(); } //__________________________________________________________________________________________________ -void AliITSupgrade::Init() -{ - // This method defines ID for sensitive volumes, i.e. such geometry volumes for which there are if(gMC->CurrentVolID()==XXX) - // statements in StepManager() - // Arguments: none - // Returns: none - AliDebug(1,"Init ITS upgrade preliminary version."); -} -//__________________________________________________________________________________________________ void AliITSupgrade::StepManager() { // Full Step Manager. @@ -272,10 +264,15 @@ void AliITSupgrade::StepManager() // Returns: none // StepHistory(); return; //uncomment to print tracks history // StepCount(); return; //uncomment to count photons + + if(!fSegmentation) AliFatal("No segmentation available"); + if(!(this->IsActive())) return; if(!(gMC->TrackCharge())) return; TString volumeName=gMC->CurrentVolName(); - if(gMC->IsTrackExiting() && !volumeName.Contains("Cu") && !volumeName.Contains("Be")) { + if(volumeName.Contains("Be")) return; + if(volumeName.Contains("Cu")) return; + if(gMC->IsTrackExiting()) { AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS); } // if Outer ITS mother Volume @@ -298,11 +295,11 @@ void AliITSupgrade::StepManager() // // Fill hit structure. // - TString volname = gMC->CurrentVolName(); - if(volname.Contains("Cu"))return; - if(volname.Contains("Be"))return; - volname.Remove(0,12); // remove letters to get the layer number - hit.SetModule(volname.Atoi()); // this will be the layer, not the module + Int_t copy=-1; + gMC->CurrentVolID(copy); + + volumeName.Remove(0,12); // remove letters to get the layer number + hit.SetModule(fSegmentation->GetIdIndex(volumeName.Atoi(),copy)); // layer and sector information are together in the IdIndex (if copy=0 the idIndex is the layer)); hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber()); gMC->TrackPosition(position); @@ -333,32 +330,68 @@ void AliITSupgrade::StepManager() //__________________________________________________________________________________________________ TGeoVolumeAssembly * AliITSupgrade::CreateVol() { - TGeoVolumeAssembly *vol = new TGeoVolumeAssembly("ITSupgrade"); + + TGeoVolumeAssembly *vol = new TGeoVolumeAssembly("ITSupgrade"); TGeoMedium *si =gGeoManager->GetMedium("ITS_UpgradeSi"); TGeoMedium *cu =gGeoManager->GetMedium("ITS_UpgradeCu"); TGeoMedium *be =gGeoManager->GetMedium("ITS_UpgradeBe"); for(Int_t ivol=0;ivolMakeTube(Form("LayerSilicon%i",ivol),si , fRadii.At(ivol) , fRadii.At(ivol)+fWidths.At(ivol) , fHalfLength.At(ivol)); //upgraded situation - - TGeoVolume *layerCu=gGeoManager->MakeTube(Form("LayerCu%i",ivol),cu , fRadiiCu.At(ivol) , fRadiiCu.At(ivol)+fWidthsCu.At(ivol) , fHalfLength.At(ivol) ); //upgraded situation - - vol ->AddNode(layer,ivol); - if(fCopper.At(ivol)){ - vol->AddNode(layerCu,ivol); + if(fNSectors<1){ + TGeoVolume *layer=gGeoManager->MakeTube(Form("LayerSilicon%i",ivol),si , fRadii.At(ivol) , fRadii.At(ivol)+fWidths.At(ivol) , fHalfLength.At(ivol)); //upgraded situation + + TGeoVolume *layerCu=gGeoManager->MakeTube(Form("LayerCu%i",ivol),cu , fRadiiCu.At(ivol) , fRadiiCu.At(ivol)+fWidthsCu.At(ivol) , fHalfLength.At(ivol) ); //upgraded situation + + vol ->AddNode(layer,ivol); + if(fCopper.At(ivol)){ + vol->AddNode(layerCu,ivol); + } + + }else{ + + TGeoVolume *layer = gGeoManager->MakeTubs(Form("LayerSilicon%i",ivol),si, fRadii.At(ivol), fRadii.At(ivol)+fWidths.At(ivol) ,fHalfLength.At(ivol),0,(360./fNSectors)); + TGeoVolume *layerCu = gGeoManager->MakeTubs(Form("LayerCu%i",ivol),cu , fRadiiCu.At(ivol) , fRadiiCu.At(ivol)+fWidthsCu.At(ivol) , fHalfLength.At(ivol) ,0,(360./fNSectors)); + + + for(Int_t i=0;iAddNode(layer,i,rot1); + if(fCopper.At(ivol)){ + vol->AddNode(layerCu,i,rot2); + } + } } } - TGeoVolume *beampipe=gGeoManager->MakeTube("BeamPipe", be , fRadiusBP , fRadiusBP+ fWidthBP , fHalfLengthBP ); //upgraded situation + + + if(fBeampipe) { + TGeoVolume *beampipe=gGeoManager->MakeTube("BeamPipe", be , fRadiusBP , fRadiusBP+ fWidthBP , fHalfLengthBP ); //upgraded situation + vol->AddNode(beampipe,0); + } + return vol; - if(fBeampipe) vol->AddNode(beampipe,0); - return vol; } //_________________________________________________________________________________________________ void AliITSupgrade::SetFullSegmentation(TArrayD xsize,TArrayD zsize){ + + Bool_t Check=kFALSE; + for(Int_t lay = 0; lay< xsize.GetSize(); lay++){ + Double_t arch = fRadii.At(lay)*(TMath::Pi()*2/fNSectors); + Int_t nPixRPhi = (Int_t)(arch/xsize.At(lay)); + Int_t nPixZed = (Int_t)((2*fHalfLength.At(lay))/zsize.At(lay)); + if(nPixRPhi>9999)Check=kTRUE; + if(nPixZed>99999)Check=kTRUE; + } + if(Check) AliFatal(" Segmentation is too small!! "); + if(fSegmentation) fSegmentation->SetNSectors(fNSectors); + TArrayD nSect(1); + nSect.AddAt(fNSectors,0); TFile *file= TFile::Open("Segmentation.root","recreate"); file->WriteObjectAny(&xsize,"TArrayD","CellSizeX"); - file->WriteObjectAny(&zsize,"TArrayD","CellSizeZ"); + file->WriteObjectAny(&zsize,"TArrayD","CellSizeZ"); + file->WriteObjectAny(&nSect,"TArrayD","nSectors"); file->Close(); } //_________________________________________________________________________________________________ @@ -473,24 +506,22 @@ void AliITSupgrade::Hit2SumDig(TClonesArray *hits,TObjArray *pSDig, Int_t *nSdig for(Int_t iHit=0;iHitGetEntries();iHit++){ //hits loop AliITShit *hit = (AliITShit*)hits->At(iHit); Double_t xz[2]; - if(!fSegmentation->GlobalToDet(hit->GetModule(),hit->GetXG(),hit->GetYG(),hit->GetZG(),xz[0],xz[1])) continue; + + Int_t module; + if(!fSegmentation->GlobalToDet(fSegmentation->GetLayerFromIdIndex(hit->GetModule()),hit->GetXG(),hit->GetYG(),hit->GetZG(),xz[0],xz[1],module)) continue; AliITSDigitUpgrade digit; digit.SetSignal(hit->GetIonization()); digit.SetNelectrons(hit->GetIonization()/(3.62*1e-09)); - digit.SetLayer(hit->GetModule()); + digit.SetLayer(fSegmentation->GetLayerFromIdIndex(hit->GetModule())); + digit.SetModule(fSegmentation->GetModuleFromIdIndex(hit->GetModule()));//set the module (=sector) of ITSupgrade digit.SetTrackID(hit->GetTrack()); Int_t xpix = 999; - if(fSegmentation->GetCellSizeX(hit->GetModule())!=0) xpix =(Int_t) (xz[0]/ fSegmentation->GetCellSizeX(hit->GetModule())); - Int_t zpix = 999; // shift at the next line to have zpix always positive. Such numbers are used to build the Pixel Id in the layer (> 0!) - if(fSegmentation->GetCellSizeZ(hit->GetModule())!=0){ - zpix =(Int_t)((xz[1]+fHalfLength.At(hit->GetModule())) / fSegmentation->GetCellSizeZ(hit->GetModule())); - } + fSegmentation->DetToPixID(xz[0], xz[1],fSegmentation->GetLayerFromIdIndex(hit->GetModule()), xpix, zpix); digit.SetPixId(xpix,zpix); - + new((*pSdigList[fSegmentation->GetLayerFromIdIndex(hit->GetModule())])[nSdigit[fSegmentation->GetLayerFromIdIndex(hit->GetModule())]++]) AliITSDigitUpgrade(digit); - new((*pSdigList[hit->GetModule()])[nSdigit[hit->GetModule()]++]) AliITSDigitUpgrade(digit); } AliDebug(1,"Stop Hit2SumDig."); diff --git a/ITS/UPGRADE/AliITSupgrade.h b/ITS/UPGRADE/AliITSupgrade.h index d6decf948dd..d52e0f44df3 100644 --- a/ITS/UPGRADE/AliITSupgrade.h +++ b/ITS/UPGRADE/AliITSupgrade.h @@ -26,7 +26,7 @@ #include "AliITSsegmentationUpgrade.h" #include "AliITSupgradeDigitizer.h" #include - + class TGeoVolume; class TGeoVolumeAssembly; class TArrayD; @@ -47,7 +47,6 @@ class AliITSupgrade : public AliITS //TObject-TNamed-AliModule-AliDetector-AliIT void AddAlignableVolumes() const; //from AliModule invoked from AliMC void CreateMaterials (); //from AliModule invoked from AliMC void CreateGeometry (); //from AliModule invoked from AliMC - void Init (); //from AliModule invoked from AliMC::InitGeometry() void StepManager (); //from AliModule invoked from AliMC::Stepping() void Hits2SDigits(); void MakeBranch (Option_t *opt=""); //from AliModule invokde from AliRun::Tree2Tree() to make requested ITSupgrade branch @@ -81,6 +80,8 @@ class AliITSupgrade : public AliITS //TObject-TNamed-AliModule-AliDetector-AliIT // Geometry/segmentation creation part TGeoVolumeAssembly * CreateVol(); + TGeoVolumeAssembly * CreateVol(Bool_t cil); + void SetFullSegmentation(TArrayD xsize, TArrayD zsize); void SetRadius(Double_t r, Int_t lay) {fRadii.AddAt(r,lay);} @@ -89,13 +90,14 @@ class AliITSupgrade : public AliITS //TObject-TNamed-AliModule-AliDetector-AliIT void SetWidthCu(Double_t wCu, Int_t lay) {fWidthsCu.AddAt(wCu,lay);} void SetSegmentationX(Double_t x, Int_t lay); void SetSegmentationZ(Double_t z, Int_t lay); - + void SetNSectors(Int_t nsect) {fNSectors=nsect;} void StepHistory(); void PrintSummary(); protected: TArrayD fWidths; TArrayD fRadii; + Int_t fNSectors; TArrayD fRadiiCu; TArrayD fWidthsCu; TArrayS fCopper; diff --git a/ITS/UPGRADE/AliITSupgradeDigitizer.cxx b/ITS/UPGRADE/AliITSupgradeDigitizer.cxx index 754ce1b618a..b346f9d0f6b 100644 --- a/ITS/UPGRADE/AliITSupgradeDigitizer.cxx +++ b/ITS/UPGRADE/AliITSupgradeDigitizer.cxx @@ -142,12 +142,12 @@ void AliITSupgradeDigitizer::Sdigits2Digits(TClonesArray *pSDigitList,TObjArray AliITSDigitUpgrade *tmpdig=0x0; pSDigitList[ilay].Sort(); - + Int_t module=999; Int_t iNdigPart=0; AliDebug(1,"starting loop over sdigits to create digits"); for(Int_t isdigentr=0; isdigentrGetPixId()==pixid) { + if(tmpdig->GetPixId()==pixid && tmpdig->GetModule()==module) { iNdigPart++; if(iNdigPart<=3) { tids[iNdigPart-1] = tmpdig->GetTrack(0); @@ -158,9 +158,10 @@ void AliITSupgradeDigitizer::Sdigits2Digits(TClonesArray *pSDigitList,TObjArray continue; } AliITSDigitUpgrade digit(pixid,eloss); - + digit.SetNelectrons(nele); digit.SetLayer(ilay); + digit.SetModule(module); digit.SetTids(tids); digit.SetSignalID(elossID); if(isdigentr!=0) new((*pLst[ilay])[iCnt[ilay]++]) AliITSDigitUpgrade(digit); @@ -170,7 +171,8 @@ void AliITSupgradeDigitizer::Sdigits2Digits(TClonesArray *pSDigitList,TObjArray tids[0]=tmpdig->GetTrack(0); tids[1]=tids[2]=-1; elossID[0]=tmpdig->GetSignal(); - elossID[1]=elossID[2]=-1; + elossID[1]=elossID[2]=-1; + module=tmpdig->GetModule(); } if(!tmpdig) AliDebug(1,"\n \n---------> tmpdig is null...break is expected ! \n"); @@ -183,6 +185,7 @@ void AliITSupgradeDigitizer::Sdigits2Digits(TClonesArray *pSDigitList,TObjArray tmpdig->SetSignalID(elossID); tmpdig->SetNelectrons(nele); tmpdig->SetLayer(ilay); + tmpdig->SetModule(module); //cout<<" tmpdigit : pixid "<< pixid<< " tids "<< tids << " nele " << nele << " ilay "<