From 8ba39da91cc548b1300a6fffdca0a2199d0eb8ef Mon Sep 17 00:00:00 2001 From: masera Date: Mon, 21 Nov 2005 14:44:30 +0000 Subject: [PATCH] One instance of AliITSresponse per sensor - AliITSresponse objects read/stored from/to CDB --- ITS/AliITS.cxx | 2 - ITS/AliITSClusterFinder.cxx | 38 ++- ITS/AliITSClusterFinder.h | 46 ++-- ITS/AliITSClusterFinderSDD.cxx | 33 ++- ITS/AliITSClusterFinderSDD.h | 11 +- ITS/AliITSClusterFinderSPD.cxx | 9 +- ITS/AliITSClusterFinderSPD.h | 12 +- ITS/AliITSClusterFinderSSD.cxx | 13 +- ITS/AliITSClusterFinderSSD.h | 10 +- ITS/AliITSClusterFinderV2.cxx | 8 +- ITS/AliITSClusterFinderV2.h | 2 +- ITS/AliITSClusterFinderV2SDD.cxx | 2 +- ITS/AliITSClusterFinderV2SDD.h | 2 +- ITS/AliITSClusterFinderV2SPD.cxx | 7 +- ITS/AliITSClusterFinderV2SPD.h | 2 +- ITS/AliITSClusterFinderV2SSD.cxx | 7 +- ITS/AliITSClusterFinderV2SSD.h | 2 +- ITS/AliITSDetTypeRec.cxx | 155 ++++++++---- ITS/AliITSDetTypeRec.h | 20 +- ITS/AliITSDetTypeSim.cxx | 315 +++++++++++++++++++----- ITS/AliITSDetTypeSim.h | 33 ++- ITS/AliITSresponseSDD.cxx | 97 ++++---- ITS/AliITSresponseSDD.h | 55 +++-- ITS/AliITSsimulation.cxx | 24 +- ITS/AliITSsimulation.h | 27 +- ITS/AliITSsimulationFastPoints.h | 4 + ITS/AliITSsimulationSDD.cxx | 252 +++++++++---------- ITS/AliITSsimulationSDD.h | 29 +-- ITS/AliITSsimulationSPD.cxx | 59 ++--- ITS/AliITSsimulationSPD.h | 23 +- ITS/AliITSsimulationSPDdubna.cxx | 56 +++-- ITS/AliITSsimulationSPDdubna.h | 27 +- ITS/AliITSsimulationSSD.cxx | 65 ++--- ITS/AliITSsimulationSSD.h | 34 ++- ITS/AliITSvPPRasymmFMD.cxx | 43 ++-- ITS/AliITSvSDD03.cxx | 52 ++-- ITS/AliITSvSPD02.cxx | 18 +- ITS/AliITSvSSD03.cxx | 20 +- ITS/Calib/RespSDD/Run0_10000_v0_s0.root | Bin 0 -> 12052 bytes ITS/Calib/RespSPD/Run0_10000_v0_s0.root | Bin 0 -> 2338 bytes ITS/Calib/RespSSD/Run0_10000_v0_s0.root | Bin 0 -> 5233 bytes 41 files changed, 941 insertions(+), 673 deletions(-) create mode 100644 ITS/Calib/RespSDD/Run0_10000_v0_s0.root create mode 100644 ITS/Calib/RespSPD/Run0_10000_v0_s0.root create mode 100644 ITS/Calib/RespSSD/Run0_10000_v0_s0.root diff --git a/ITS/AliITS.cxx b/ITS/AliITS.cxx index 9f1bf6f7634..b505d465b9a 100644 --- a/ITS/AliITS.cxx +++ b/ITS/AliITS.cxx @@ -291,7 +291,6 @@ void AliITS::SetDefaultSimulation(){ // none. // Return: // none. - if(!fDetTypeSim) { Error("SetDefaultSimulation()","fDetTypeSim is 0!"); return; @@ -447,7 +446,6 @@ void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits){ // none. TClonesArray &lhits = *fHits; new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits); - } //______________________________________________________________________ diff --git a/ITS/AliITSClusterFinder.cxx b/ITS/AliITSClusterFinder.cxx index 4d5cfb55c3a..d7407c6dce7 100644 --- a/ITS/AliITSClusterFinder.cxx +++ b/ITS/AliITSClusterFinder.cxx @@ -24,7 +24,6 @@ #include "AliITSRecPoint.h" #include "AliITSdigit.h" #include "AliITSDetTypeRec.h" -#include "AliITSgeom.h" #include "AliITSMap.h" ClassImp(AliITSClusterFinder) @@ -36,8 +35,7 @@ fDebug(0), fModule(0), fDigits(0), fNdigits(0), -fResponse(0), -fSegmentation(0), +fDetTypeRec(0), fClusters(0), fNRawClusters(0), fMap(0), @@ -54,15 +52,12 @@ fNPeaks(-1){ // A default constructed AliITSCulsterFinder } //---------------------------------------------------------------------- -AliITSClusterFinder::AliITSClusterFinder(AliITSsegmentation *seg, - AliITSresponse *res): +AliITSClusterFinder::AliITSClusterFinder(AliITSDetTypeRec* dettyp): TObject(), fDebug(0), fModule(0), fDigits(0), fNdigits(0), -fResponse(res), -fSegmentation(seg), fClusters(0), fNRawClusters(0), fMap(0), @@ -82,18 +77,17 @@ fNPeaks(-1){ SetNperMax(); SetClusterSize(); SetDeclusterFlag(); + fDetTypeRec = dettyp; } //---------------------------------------------------------------------- -AliITSClusterFinder::AliITSClusterFinder(AliITSsegmentation *seg, - AliITSresponse *response, - TClonesArray *digits): +AliITSClusterFinder::AliITSClusterFinder(AliITSDetTypeRec* dettyp, + TClonesArray *digits): TObject(), fDebug(0), fModule(0), fDigits(digits), fNdigits(0), -fResponse(response), -fSegmentation(seg), +fDetTypeRec(dettyp), fClusters(0), fNRawClusters(0), fMap(0), @@ -143,8 +137,6 @@ AliITSClusterFinder::~AliITSClusterFinder(){ if(fMap) {delete fMap;} // Zero local pointers. Other classes own these pointers. - fSegmentation = 0; - fResponse = 0; fMap = 0; fDigits = 0; fNdigits = 0; @@ -153,9 +145,7 @@ AliITSClusterFinder::~AliITSClusterFinder(){ fDeclusterFlag= 0; fClusterSize = 0; fNPeaks = 0; - // fITS = 0; fDetTypeRec = 0; - fITSgeom = 0; } //__________________________________________________________________________ @@ -163,24 +153,24 @@ void AliITSClusterFinder::InitGeometry(){ //Initialisation of ITS geometry - if(!fITSgeom) { + if(!fDetTypeRec->GetITSgeom()) { Error("InitGeometry","ITS geom is null!"); return; } - Int_t mmax=fITSgeom->GetIndexMax(); + Int_t mmax=fDetTypeRec->GetITSgeom()->GetIndexMax(); if (mmax>2200) { Fatal("AliITSClusterFinder","Too many ITS subdetectors !"); } Int_t m; for (m=0; mGetModuleId(m,lay,lad,det); - Float_t x,y,z; fITSgeom->GetTrans(lay,lad,det,x,y,z); - Double_t rot[9]; fITSgeom->GetRotMatrix(lay,lad,det,rot); + Int_t lay,lad,det; fDetTypeRec->GetITSgeom()->GetModuleId(m,lay,lad,det); + Float_t x,y,z; fDetTypeRec->GetITSgeom()->GetTrans(lay,lad,det,x,y,z); + Double_t rot[9]; fDetTypeRec->GetITSgeom()->GetRotMatrix(lay,lad,det,rot); Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi(); Double_t ca=TMath::Cos(alpha), sa=TMath::Sin(alpha); fYshift[m] = x*ca + y*sa; fZshift[m] = (Double_t)z; - fNdet[m] = (lad-1)*fITSgeom->GetNdetectors(lay) + (det-1); + fNdet[m] = (lad-1)*fDetTypeRec->GetITSgeom()->GetNdetectors(lay) + (det-1); fNlayer[m] = lay-1; } } @@ -426,11 +416,11 @@ void AliITSClusterFinder::RecPoints2Clusters // Conversion AliITSRecPoint -> AliITSclusterV2 for the ITS // subdetector indexed by idx //------------------------------------------------------------ - if(!fITSgeom) { + if(!fDetTypeRec->GetITSgeom()) { Error("RecPoints2Clusters","ITS geom is null!"); return; } - Int_t lastSPD1=fITSgeom->GetModuleIndex(2,1,1)-1; + Int_t lastSPD1=fDetTypeRec->GetITSgeom()->GetModuleIndex(2,1,1)-1; TClonesArray &cl=*clusters; Int_t ncl=points->GetEntriesFast(); for (Int_t i=0; i=level;} - - void SetITSgeom(AliITSgeom* geom) {fITSgeom=geom;} - AliITSgeom* GetITSgeom() const {return fITSgeom;} - // - // Setters and Getters - // segmentation - virtual void SetSegmentation(AliITSsegmentation *segmentation) { - fSegmentation=segmentation;} - //Returns fSegmentation - virtual AliITSsegmentation* GetSegmentation()const{return fSegmentation;} // Digit virtual void SetDigits(TClonesArray *itsDigits) {// set digits fDigits=itsDigits;fNdigits = fDigits->GetEntriesFast();} @@ -60,11 +49,6 @@ class AliITSClusterFinder :public TObject{ return (AliITSdigit*) fDigits->UncheckedAt(i);} virtual TClonesArray* Digits(){return fDigits;}// Gets fDigits virtual Int_t NDigits() const {return fNdigits;}// Get Number of Digits - // Response - //Return Response - virtual AliITSresponse* GetResponse()const{return fResponse;} - virtual void SetResponse(AliITSresponse *response) {// set response - fResponse=response;} // clulsters // Set fClusters up virtual void SetClusters(TClonesArray *itsClusters){// set clusters @@ -86,7 +70,6 @@ class AliITSClusterFinder :public TObject{ virtual void FillCluster(AliITSRawCluster *cluster) {// fill cluster FillCluster(cluster,1);} - // virtual void SetModule(Int_t module){fModule = module;}// Set module number virtual Int_t GetModule()const{return fModule;}// Returns module number // @@ -134,17 +117,17 @@ class AliITSClusterFinder :public TObject{ // assignment operator AliITSClusterFinder& operator=(const AliITSClusterFinder &source); // data members - Int_t fDebug; //! Debug flag/level - Int_t fModule; //! Module number to be reconstuctted - TClonesArray *fDigits; //! digits - Int_t fNdigits; //! num of digits - AliITSresponse *fResponse; //! response - AliITSsegmentation *fSegmentation; //! segmentation - TClonesArray *fClusters; //! Array of clusters - Int_t fNRawClusters; //! in case we split the cluster - // and want to keep track of - // the cluster which was splitted + Int_t fDebug; //! Debug flag/level + Int_t fModule; //! Module number to be reconstuctted + TClonesArray *fDigits; //! digits + Int_t fNdigits; //! num of digits + + AliITSDetTypeRec* fDetTypeRec; //ITS object for reconstruction + TClonesArray *fClusters; //! Array of clusters + Int_t fNRawClusters; //! in case we split the cluster + // and want to keep track of + // the cluster which was splitted AliITSMap *fMap; //! map Int_t fNperMax; //! NperMax Int_t fDeclusterFlag; //! DeclusterFlag @@ -155,10 +138,9 @@ class AliITSClusterFinder :public TObject{ Float_t fZshift[2200]; // z-shifts of detector local coor. systems Int_t fNdet[2200]; // detector index Int_t fNlayer[2200]; // detector layer - AliITSDetTypeRec* fDetTypeRec; //ITS object for reconstruction - AliITSgeom* fITSgeom; //!ITS geometry - ClassDef(AliITSClusterFinder,5) //Class for clustering and reconstruction of space points + + ClassDef(AliITSClusterFinder,6) //Class for clustering and reconstruction of space points }; // Input and output functions for standard C++ input/output. ostream &operator<<(ostream &os,AliITSClusterFinder &source); diff --git a/ITS/AliITSClusterFinderSDD.cxx b/ITS/AliITSClusterFinderSDD.cxx index ad2b393781d..7494c78a702 100644 --- a/ITS/AliITSClusterFinderSDD.cxx +++ b/ITS/AliITSClusterFinderSDD.cxx @@ -49,11 +49,10 @@ fMaxNCells(0){ // default constructor } //______________________________________________________________________ -AliITSClusterFinderSDD::AliITSClusterFinderSDD(AliITSsegmentation *seg, - AliITSresponse *response, +AliITSClusterFinderSDD::AliITSClusterFinderSDD(AliITSDetTypeRec* dettyp, TClonesArray *digits, TClonesArray *recp): -AliITSClusterFinder(seg,response), +AliITSClusterFinder(dettyp), fNclusters(0), fDAnode(0.0), fDTime(0.0), @@ -67,10 +66,10 @@ fMaxNCells(0){ SetDigits(digits); SetClusters(recp); - SetCutAmplitude(); + SetCutAmplitude(fDetTypeRec->GetITSgeom()->GetStartSDD()); SetDAnode(); SetDTime(); - SetMinPeak((Int_t)(((AliITSresponseSDD*)GetResp())-> + SetMinPeak((Int_t)(((AliITSresponseSDD*)GetResp(fDetTypeRec->GetITSgeom()->GetStartSDD()))-> GetNoiseAfterElectronics()*5)); // SetMinPeak(); SetMinNCells(); @@ -80,12 +79,12 @@ fMaxNCells(0){ SetMap(new AliITSMapA1(GetSeg(),Digits(),fCutAmplitude)); } //______________________________________________________________________ -void AliITSClusterFinderSDD::SetCutAmplitude(Double_t nsigma){ +void AliITSClusterFinderSDD::SetCutAmplitude(Int_t mod,Double_t nsigma){ // set the signal threshold for cluster finder Double_t baseline,noise,noiseAfterEl; - GetResp()->GetNoiseParam(noise,baseline); - noiseAfterEl = ((AliITSresponseSDD*)GetResp())->GetNoiseAfterElectronics(); + GetResp(mod)->GetNoiseParam(noise,baseline); + noiseAfterEl = ((AliITSresponseSDD*)GetResp(mod))->GetNoiseAfterElectronics(); fCutAmplitude = (Int_t)((baseline + nsigma*noiseAfterEl)); } //______________________________________________________________________ @@ -99,7 +98,7 @@ void AliITSClusterFinderSDD::Find1DClusters(){ Int_t dummy = 0; Double_t fTimeStep = GetSeg()->Dpx(dummy); Double_t fSddLength = GetSeg()->Dx(); - Double_t fDriftSpeed = GetResp()->DriftSpeed(); + Double_t fDriftSpeed = GetResp(fModule)->DriftSpeed(); Double_t anodePitch = GetSeg()->Dpz(dummy); // map the signal @@ -109,7 +108,7 @@ void AliITSClusterFinderSDD::Find1DClusters(){ Double_t noise; Double_t baseline; - GetResp()->GetNoiseParam(noise,baseline); + GetResp(fModule)->GetNoiseParam(noise,baseline); Int_t nofFoundClusters = 0; Int_t i; @@ -188,7 +187,7 @@ void AliITSClusterFinderSDD::Find1DClusters(){ Double_t clusterPeakAmplitude = 0.; Int_t its,peakpos = -1; Double_t n, baseline; - GetResp()->GetNoiseParam(n,baseline); + GetResp(fModule)->GetNoiseParam(n,baseline); for(its=tstart; its<=tstop; its++) { fadc=(float)Map()->GetSignal(idx,its); if(fadc>baseline) fadc -= baseline; @@ -252,10 +251,10 @@ void AliITSClusterFinderSDD::Find1DClustersE(){ Int_t dummy=0; Double_t fTimeStep = GetSeg()->Dpx( dummy ); Double_t fSddLength = GetSeg()->Dx(); - Double_t fDriftSpeed = GetResp()->DriftSpeed(); + Double_t fDriftSpeed = GetResp(fModule)->DriftSpeed(); Double_t anodePitch = GetSeg()->Dpz( dummy ); Double_t n, baseline; - GetResp()->GetNoiseParam( n, baseline ); + GetResp(fModule)->GetNoiseParam( n, baseline ); // map the signal Map()->ClearMap(); Map()->SetThreshold( fCutAmplitude ); @@ -416,7 +415,7 @@ void AliITSClusterFinderSDD::PeakFunc( Int_t xdim, Int_t zdim, Double_t *par, // par[i+2] = zpos // par[i+3] = tau // par[i+4] = sigma. - Int_t electronics = GetResp()->Electronics(); // 1 = PASCAL, 2 = OLA + Int_t electronics = GetResp(fModule)->Electronics(); // 1 = PASCAL, 2 = OLA const Int_t knParam = 5; Int_t npeak = (Int_t)par[0]; @@ -695,11 +694,11 @@ void AliITSClusterFinderSDD::ResolveClusters(){ Int_t dummy=0; Double_t fTimeStep = GetSeg()->Dpx( dummy ); Double_t fSddLength = GetSeg()->Dx(); - Double_t fDriftSpeed = GetResp()->DriftSpeed(); + Double_t fDriftSpeed = GetResp(fModule)->DriftSpeed(); Double_t anodePitch = GetSeg()->Dpz( dummy ); Double_t n, baseline; - GetResp()->GetNoiseParam( n, baseline ); - Int_t electronics = GetResp()->Electronics(); // 1 = PASCAL, 2 = OLA + GetResp(fModule)->GetNoiseParam( n, baseline ); + Int_t electronics = GetResp(fModule)->Electronics(); // 1 = PASCAL, 2 = OLA for( Int_t j=0; jGetCalibrationModel(mod);}//Return Response //Returns fSegmentation virtual AliITSsegmentationSDD* GetSeg()const{ - return (AliITSsegmentationSDD*)GetSegmentation();} + return (AliITSsegmentationSDD*)fDetTypeRec->GetSegmentationModel(1);} AliITSClusterFinderSDD(const AliITSClusterFinderSDD &source); // copy ctor AliITSClusterFinderSDD& operator=(const AliITSClusterFinderSDD &source); private: diff --git a/ITS/AliITSClusterFinderSPD.cxx b/ITS/AliITSClusterFinderSPD.cxx index bcaf35d7a4d..a56bf3cd2cc 100644 --- a/ITS/AliITSClusterFinderSPD.cxx +++ b/ITS/AliITSClusterFinderSPD.cxx @@ -38,9 +38,8 @@ fMinNCells(0){ // constructor } //---------------------------------------------------------- -AliITSClusterFinderSPD::AliITSClusterFinderSPD(AliITSsegmentation *seg, - AliITSresponse *res): -AliITSClusterFinder(seg,res), +AliITSClusterFinderSPD::AliITSClusterFinderSPD(AliITSDetTypeRec* dettyp): +AliITSClusterFinder(dettyp), fDz(0.0), fDx(0.0), fMinNCells(0){ @@ -50,10 +49,10 @@ fMinNCells(0){ SetDz(); } //---------------------------------------------------------- -AliITSClusterFinderSPD::AliITSClusterFinderSPD(AliITSsegmentation *seg, +AliITSClusterFinderSPD::AliITSClusterFinderSPD(AliITSDetTypeRec* dettyp, TClonesArray *digits, TClonesArray *recp): -AliITSClusterFinder(seg,0), +AliITSClusterFinder(dettyp,digits), fDz(0.0), fDx(0.0), fMinNCells(0){ diff --git a/ITS/AliITSClusterFinderSPD.h b/ITS/AliITSClusterFinderSPD.h index 90715795abc..8a506825311 100644 --- a/ITS/AliITSClusterFinderSPD.h +++ b/ITS/AliITSClusterFinderSPD.h @@ -6,6 +6,7 @@ //////////////////////////////////////////////// #include "AliITSClusterFinder.h" +#include "AliITSDetTypeRec.h" class AliITSMapA1; class AliITSsegmentation; @@ -14,20 +15,17 @@ class AliITSresponse; class AliITSresponseSPD; class TClonesArray; + class AliITSClusterFinderSPD : public AliITSClusterFinder{ public: AliITSClusterFinderSPD(); - AliITSClusterFinderSPD(AliITSsegmentation *segmentation, - AliITSresponse *res); - AliITSClusterFinderSPD(AliITSsegmentation *segmentation, + AliITSClusterFinderSPD(AliITSDetTypeRec* dettyp); + AliITSClusterFinderSPD(AliITSDetTypeRec* dettyp, TClonesArray *digits,TClonesArray *recpoints); virtual ~AliITSClusterFinderSPD(){}// destructor - - virtual AliITSresponseSPD* GetResp()const{ - return (AliITSresponseSPD*) GetResponse();}//Return Response //Returns fSegmentation virtual AliITSsegmentationSPD* GetSeg()const{ - return (AliITSsegmentationSPD*)GetSegmentation();} + return (AliITSsegmentationSPD*)fDetTypeRec->GetSegmentationModel(0);} virtual void SetDx(Double_t dx=1.) {fDx=dx;}// set dx virtual void SetDz(Double_t dz=0.) {fDz=dz;}// set dz // Search for clusters diff --git a/ITS/AliITSClusterFinderSSD.cxx b/ITS/AliITSClusterFinderSSD.cxx index 70d59c0d388..c896b6954dd 100644 --- a/ITS/AliITSClusterFinderSSD.cxx +++ b/ITS/AliITSClusterFinderSSD.cxx @@ -63,9 +63,9 @@ fSFB(0){ //Default constructor } //______________________________________________________________________ -AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSsegmentation *seg, +AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSDetTypeRec* dettyp, TClonesArray *digits): -AliITSClusterFinder(seg,0), +AliITSClusterFinder(dettyp,digits), fClusterP(0), fNClusterP(0), fClusterN(0), @@ -100,9 +100,8 @@ fSFB(0){ fPNsignalRatio= 7./8.; // warning: hard-wired number } //______________________________________________________________________} -AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSsegmentation *seg, - AliITSresponse *res): -AliITSClusterFinder(seg,res), +AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSDetTypeRec* dettyp): +AliITSClusterFinder(dettyp), fClusterP(0), fNClusterP(0), fClusterN(0), @@ -189,13 +188,13 @@ void AliITSClusterFinderSSD::FindRawClusters(Int_t module){ // 4. Colculate the x and z coordinate - if(!fITSgeom) { + if(!fDetTypeRec->GetITSgeom()) { Error("FindRawClusters","ITS geom is null!"); return; } Int_t lay, lad, detect; SetModule(module); - fITSgeom->GetModuleId(GetModule(),lay, lad, detect); + fDetTypeRec->GetITSgeom()->GetModuleId(GetModule(),lay, lad, detect); if ( lay == 6 ) ((AliITSsegmentationSSD*)GetSeg())->SetLayer(6); if ( lay == 5 ) ((AliITSsegmentationSSD*)GetSeg())->SetLayer(5); diff --git a/ITS/AliITSClusterFinderSSD.h b/ITS/AliITSClusterFinderSSD.h index 1842223e1a6..9fbfe080ed3 100644 --- a/ITS/AliITSClusterFinderSSD.h +++ b/ITS/AliITSClusterFinderSSD.h @@ -10,6 +10,8 @@ #include "AliITSClusterFinder.h" //#include "AliITSsegmentationSSD.h" +#include "AliITSDetTypeRec.h" + class TArrayI; class AliITSclusterSSD; class AliITSpackageSSD; @@ -21,8 +23,8 @@ class AliITSresponseSSD; class AliITSClusterFinderSSD: public AliITSClusterFinder{ public: AliITSClusterFinderSSD(); - AliITSClusterFinderSSD(AliITSsegmentation *seg,AliITSresponse *resp); - AliITSClusterFinderSSD(AliITSsegmentation *seg, TClonesArray *digits); + AliITSClusterFinderSSD(AliITSDetTypeRec* dettyp); + AliITSClusterFinderSSD(AliITSDetTypeRec* dettyp, TClonesArray *digits); virtual ~AliITSClusterFinderSSD(); void FindRawClusters(Int_t module); @@ -31,11 +33,9 @@ class AliITSClusterFinderSSD: public AliITSClusterFinder{ AliITSClusterFinderSSD(const AliITSClusterFinderSSD &source); // assignment operator AliITSClusterFinderSSD& operator=(const AliITSClusterFinderSSD &source); - virtual AliITSresponseSSD* GetResp()const{ - return (AliITSresponseSSD*) GetResponse();}//Return Response //Returns fSegmentation virtual AliITSsegmentationSSD* GetSeg()const{ - return (AliITSsegmentationSSD*)GetSegmentation();} + return (AliITSsegmentationSSD*)fDetTypeRec->GetSegmentationModel(2);} void InitReconstruction(); Bool_t CreateNewRecPoint(Double_t P,Double_t dP,Double_t N,Double_t dN, Double_t Sig,Double_t dSig, diff --git a/ITS/AliITSClusterFinderV2.cxx b/ITS/AliITSClusterFinderV2.cxx index d1c0081dd23..2be96be3948 100644 --- a/ITS/AliITSClusterFinderV2.cxx +++ b/ITS/AliITSClusterFinderV2.cxx @@ -23,7 +23,8 @@ #include "AliRun.h" #include "AliITSClusterFinderV2.h" #include "AliITSclusterV2.h" -#include "AliITSgeom.h" +#include "AliITSDetTypeRec.h" +//#include "AliITSgeom.h" #include #include "AliMC.h" @@ -31,13 +32,12 @@ ClassImp(AliITSClusterFinderV2) extern AliRun *gAlice; -AliITSClusterFinderV2::AliITSClusterFinderV2(AliITSgeom* geom):AliITSClusterFinder(){ +AliITSClusterFinderV2::AliITSClusterFinderV2(AliITSDetTypeRec* dettyp):AliITSClusterFinder(dettyp){ //Default constructor fEvent = 0; fModule = 0; - fITSgeom = geom; - fNModules = fITSgeom->GetIndexMax(); + fNModules = dettyp->GetITSgeom()->GetIndexMax(); } //______________________________________________________________________ diff --git a/ITS/AliITSClusterFinderV2.h b/ITS/AliITSClusterFinderV2.h index 04602a9b5e8..482ed64ede6 100644 --- a/ITS/AliITSClusterFinderV2.h +++ b/ITS/AliITSClusterFinderV2.h @@ -15,7 +15,7 @@ class AliITSgeom; class AliITSClusterFinderV2 : public AliITSClusterFinder { public: - AliITSClusterFinderV2(AliITSgeom* geom); + AliITSClusterFinderV2(AliITSDetTypeRec* dettyp); virtual ~AliITSClusterFinderV2() {;} void SetEvent(Int_t event) { fEvent=event; } diff --git a/ITS/AliITSClusterFinderV2SDD.cxx b/ITS/AliITSClusterFinderV2SDD.cxx index 9bc7e4ea465..69451ef1a4d 100644 --- a/ITS/AliITSClusterFinderV2SDD.cxx +++ b/ITS/AliITSClusterFinderV2SDD.cxx @@ -34,7 +34,7 @@ ClassImp(AliITSClusterFinderV2SDD) extern AliRun *gAlice; -AliITSClusterFinderV2SDD::AliITSClusterFinderV2SDD(AliITSgeom* geom):AliITSClusterFinderV2(geom){ +AliITSClusterFinderV2SDD::AliITSClusterFinderV2SDD(AliITSDetTypeRec* dettyp):AliITSClusterFinderV2(dettyp){ //Default constructor diff --git a/ITS/AliITSClusterFinderV2SDD.h b/ITS/AliITSClusterFinderV2SDD.h index 405e83b9efd..2889590814e 100644 --- a/ITS/AliITSClusterFinderV2SDD.h +++ b/ITS/AliITSClusterFinderV2SDD.h @@ -17,7 +17,7 @@ class AliITSRawStream; class AliITSClusterFinderV2SDD : public AliITSClusterFinderV2 { public: - AliITSClusterFinderV2SDD(AliITSgeom* geom); + AliITSClusterFinderV2SDD(AliITSDetTypeRec* dettyp); virtual ~AliITSClusterFinderV2SDD(){;} virtual void FindRawClusters(Int_t mod); virtual void RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters); diff --git a/ITS/AliITSClusterFinderV2SPD.cxx b/ITS/AliITSClusterFinderV2SPD.cxx index cda2cda345c..55b232e1644 100644 --- a/ITS/AliITSClusterFinderV2SPD.cxx +++ b/ITS/AliITSClusterFinderV2SPD.cxx @@ -25,21 +25,18 @@ #include "AliITSDetTypeRec.h" #include "AliRawReader.h" #include "AliITSRawStreamSPD.h" - #include -#include "AliITSgeom.h" #include "AliITSdigitSPD.h" ClassImp(AliITSClusterFinderV2SPD) extern AliRun *gAlice; -AliITSClusterFinderV2SPD::AliITSClusterFinderV2SPD(AliITSgeom* geom):AliITSClusterFinderV2(geom){ +AliITSClusterFinderV2SPD::AliITSClusterFinderV2SPD(AliITSDetTypeRec* dettyp):AliITSClusterFinderV2(dettyp){ //Default constructor - fITSgeom = geom; - fLastSPD1=fITSgeom->GetModuleIndex(2,1,1)-1; + fLastSPD1=fDetTypeRec->GetITSgeom()->GetModuleIndex(2,1,1)-1; fNySPD=256; fNzSPD=160; fYpitchSPD=0.0050; diff --git a/ITS/AliITSClusterFinderV2SPD.h b/ITS/AliITSClusterFinderV2SPD.h index fb0083e13ef..a6be4554e69 100644 --- a/ITS/AliITSClusterFinderV2SPD.h +++ b/ITS/AliITSClusterFinderV2SPD.h @@ -18,7 +18,7 @@ class AliITSgeom; class AliITSClusterFinderV2SPD : public AliITSClusterFinderV2 { public: - AliITSClusterFinderV2SPD(AliITSgeom* geom); + AliITSClusterFinderV2SPD(AliITSDetTypeRec* dettyp); virtual ~AliITSClusterFinderV2SPD(){;} virtual void FindRawClusters(Int_t mod); virtual void RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters); diff --git a/ITS/AliITSClusterFinderV2SSD.cxx b/ITS/AliITSClusterFinderV2SSD.cxx index 44e54ee81a9..f9c121e3b20 100644 --- a/ITS/AliITSClusterFinderV2SSD.cxx +++ b/ITS/AliITSClusterFinderV2SSD.cxx @@ -25,20 +25,17 @@ #include "AliITSDetTypeRec.h" #include "AliRawReader.h" #include "AliITSRawStreamSSD.h" - #include -#include "AliITSgeom.h" #include "AliITSdigitSSD.h" ClassImp(AliITSClusterFinderV2SSD) -AliITSClusterFinderV2SSD::AliITSClusterFinderV2SSD(AliITSgeom* geom):AliITSClusterFinderV2(geom){ +AliITSClusterFinderV2SSD::AliITSClusterFinderV2SSD(AliITSDetTypeRec* dettyp):AliITSClusterFinderV2(dettyp){ //Default constructor - fITSgeom = geom; - fLastSSD1=fITSgeom->GetModuleIndex(6,1,1)-1; + fLastSSD1=fDetTypeRec->GetITSgeom()->GetModuleIndex(6,1,1)-1; fYpitchSSD=0.0095; fHwSSD=3.65; fHlSSD=2.00; diff --git a/ITS/AliITSClusterFinderV2SSD.h b/ITS/AliITSClusterFinderV2SSD.h index 670fbe42fdc..fcfc6676b63 100644 --- a/ITS/AliITSClusterFinderV2SSD.h +++ b/ITS/AliITSClusterFinderV2SSD.h @@ -17,7 +17,7 @@ class AliITSRawStream; class AliITSClusterFinderV2SSD : public AliITSClusterFinderV2 { public: - AliITSClusterFinderV2SSD(AliITSgeom* geom); + AliITSClusterFinderV2SSD(AliITSDetTypeRec* dettyp); virtual ~AliITSClusterFinderV2SSD(){;} virtual void FindRawClusters(Int_t mod); virtual void RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters); diff --git a/ITS/AliITSDetTypeRec.cxx b/ITS/AliITSDetTypeRec.cxx index d0271993696..d40c2359b35 100644 --- a/ITS/AliITSDetTypeRec.cxx +++ b/ITS/AliITSDetTypeRec.cxx @@ -25,6 +25,10 @@ #include "TObjArray.h" #include "TTree.h" +#include "AliCDBManager.h" +#include "AliCDBStorage.h" +#include "AliCDBEntry.h" + #include "AliITSClusterFinder.h" #include "AliITSClusterFinderV2.h" #include "AliITSClusterFinderV2SPD.h" @@ -41,15 +45,17 @@ #include "AliITSRawClusterSDD.h" #include "AliITSRawClusterSSD.h" #include "AliITSRecPoint.h" -#include "AliITSresponseSPD.h" #include "AliITSresponseSDD.h" -#include "AliITSresponseSSD.h" #include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSDD.h" #include "AliITSsegmentationSSD.h" const Int_t AliITSDetTypeRec::fgkNdettypes = 3; +const Int_t AliITSDetTypeRec::fgkDefaultNModulesSPD = 240; +const Int_t AliITSDetTypeRec::fgkDefaultNModulesSDD = 260; +const Int_t AliITSDetTypeRec::fgkDefaultNModulesSSD = 1698; + ClassImp(AliITSDetTypeRec) //________________________________________________________________ @@ -94,6 +100,12 @@ fRecPointClassName(){// String with RecPoint class name SelectVertexer(" "); fLoader = 0; + + fNMod[0] = fgkDefaultNModulesSPD; + fNMod[1] = fgkDefaultNModulesSDD; + fNMod[2] = fgkDefaultNModulesSSD; + + SetRunNumber(); } //______________________________________________________________________ AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec &/*rec*/):TObject(/*rec*/){ @@ -142,6 +154,7 @@ AliITSDetTypeRec::~AliITSDetTypeRec(){ fCtype = 0; } delete [] fNctype; + delete [] fNdtype; if(fLoader) delete fLoader; } @@ -188,25 +201,31 @@ AliITSsegmentation* AliITSDetTypeRec::GetSegmentationModel(Int_t dettype){ } //_______________________________________________________________________ -void AliITSDetTypeRec::SetCalibrationModel(Int_t dettype,AliITSresponse *resp){ +void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSresponse *cal){ + + //Set calibration (response) for the module iMod of type dettype + if (fCalibration==0) { + fCalibration = new TObjArray(fGeom->GetIndexMax()); + fCalibration->SetOwner(kTRUE); + fCalibration->Clear(); + } + + if (fCalibration->At(iMod) != 0) + delete (AliITSresponse*) fCalibration->At(iMod); + fCalibration->AddAt(cal,iMod); - - //Set segmentation model for module number - if(fCalibration==0) fCalibration = new TObjArray(fgkNdettypes); - if(fCalibration->At(dettype)!=0) delete fCalibration->At(dettype); - fCalibration->AddAt(resp,dettype); - } //_______________________________________________________________________ -AliITSresponse* AliITSDetTypeRec::GetCalibrationModel(Int_t dettype){ +AliITSresponse* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){ - //Get segmentation model for module number + //Get calibration model for module type if(fCalibration==0) { - Warning("GetalibrationModel","fResponse is 0!"); + Warning("GetalibrationModel","fCalibration is 0!"); return 0; } - return (AliITSresponse*)fCalibration->At(dettype); + + return (AliITSresponse*)fCalibration->At(iMod); } //______________________________________________________________________ @@ -282,30 +301,27 @@ void AliITSDetTypeRec::SetDefaults(){ //Set defaults for segmentation and response - if(fGeom==0){ Warning("SetDefaults","fGeom is 0!"); return; } AliITSsegmentation* seg; - AliITSresponse* res; + if(!GetCalibration()) {AliFatal("Exit");exit(0);} for(Int_t dettype=0;dettypeGetStartSDD()); seg = new AliITSsegmentationSDD(fGeom,res); SetSegmentationModel(dettype,seg); - SetCalibrationModel(dettype,new AliITSresponseSDD("simulated")); - const char *kopt = GetCalibrationModel(dettype)->ZeroSuppOption(); + const char *kopt = res->ZeroSuppOption(); if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) SetDigitClassName(dettype,"AliITSdigit"); else SetDigitClassName(dettype,"AliITSdigitSDD"); SetClusterClassName(dettype,"AliITSRawClusterSDD"); @@ -316,19 +332,74 @@ void AliITSDetTypeRec::SetDefaults(){ seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side. seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side. seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side. - SetSegmentationModel(dettype,seg2); - SetCalibrationModel(dettype,new AliITSresponseSSD("simulated")); SetDigitClassName(dettype,"AliITSdigitSSD"); SetClusterClassName(dettype,"AliITSRawClusterSSD"); - - } - } - } +//______________________________________________________________________ +Bool_t AliITSDetTypeRec::GetCalibration() { + // Get Default calibration if a storage is not defined. + + Bool_t deleteManager = kFALSE; + if(!AliCDBManager::Instance()->IsDefaultStorageSet()) { + AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); + deleteManager = kTRUE; + } + AliCDBStorage *storage = AliCDBManager::Instance()->GetDefaultStorage(); + + AliCDBEntry *entrySPD = storage->Get("ITS/Calib/RespSPD", fRunNumber); + TObjArray *respSPD = (TObjArray *)entrySPD->GetObject(); + entrySPD->SetObject(NULL); + entrySPD->SetOwner(kTRUE); + AliCDBEntry *entrySDD = storage->Get("ITS/Calib/RespSDD", fRunNumber); + TObjArray *respSDD = (TObjArray *)entrySDD->GetObject(); + entrySDD->SetObject(NULL); + entrySDD->SetOwner(kTRUE); + AliCDBEntry *entrySSD = storage->Get("ITS/Calib/RespSSD", fRunNumber); + TObjArray *respSSD = (TObjArray *)entrySSD->GetObject(); + entrySSD->SetObject(NULL); + entrySSD->SetOwner(kTRUE); + // DB entries are dleted. In this waymetadeta objects are deleted as well + delete entrySPD; + delete entrySDD; + delete entrySSD; + if(deleteManager){ + AliCDBManager::Instance()->Destroy(); + AliCDBManager::Instance()->RemoveDefaultStorage(); + storage = 0; // the storage is killed by AliCDBManager::Instance()->Destroy() + } + if ((! respSPD)||(! respSDD)||(! respSSD)) { + AliWarning("Can not get calibration from calibration database !"); + return kFALSE; + } + + fNMod[0] = respSPD->GetEntries(); + fNMod[1] = respSDD->GetEntries(); + fNMod[2] = respSSD->GetEntries(); + AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database", + fNMod[0], fNMod[1], fNMod[2])); + AliITSresponse* res; + for (Int_t i=0; iAt(i); + SetCalibrationModel(i, res); + } + for (Int_t i=0; iAt(i); + Int_t iMod = i + fNMod[0]; + SetCalibrationModel(iMod, res); + } + for (Int_t i=0; iAt(i); + Int_t iMod = i + fNMod[0] + fNMod[1]; + SetCalibrationModel(iMod, res); + } + + return kTRUE; +} + //________________________________________________________________ void AliITSDetTypeRec::SetDefaultClusterFinders(){ @@ -340,8 +411,6 @@ void AliITSDetTypeRec::SetDefaultClusterFinders(){ return; } - AliITSsegmentation* seg; - AliITSresponse* res; AliITSClusterFinder *clf; MakeTreeC(); @@ -350,21 +419,20 @@ void AliITSDetTypeRec::SetDefaultClusterFinders(){ //SPD if(dettype==0){ if(!GetReconstructionModel(dettype)){ - seg = (AliITSsegmentation*)GetSegmentationModel(dettype); TClonesArray *dig0 = DigitsAddress(0); TClonesArray *rec0 = ClustersAddress(0); - clf = new AliITSClusterFinderSPD(seg,dig0,rec0); + clf = new AliITSClusterFinderSPD(this,dig0,rec0); SetReconstructionModel(dettype,clf); + } } + //SDD if(dettype==1){ if(!GetReconstructionModel(dettype)){ - seg = (AliITSsegmentation*)GetSegmentationModel(dettype); - res = (AliITSresponse*)GetCalibrationModel(dettype); TClonesArray *dig1 = DigitsAddress(1); TClonesArray *rec1 = ClustersAddress(1); - clf = new AliITSClusterFinderSDD(seg,res,dig1,rec1); + clf = new AliITSClusterFinderSDD(this,dig1,rec1); SetReconstructionModel(dettype,clf); } @@ -372,10 +440,8 @@ void AliITSDetTypeRec::SetDefaultClusterFinders(){ //SSD if(dettype==2){ if(!GetReconstructionModel(dettype)){ - seg = (AliITSsegmentation*)GetSegmentationModel(dettype); TClonesArray* dig2 = DigitsAddress(2); - clf = new AliITSClusterFinderSSD(seg,dig2); - clf->SetITSgeom(fGeom); + clf = new AliITSClusterFinderSSD(this,dig2); SetReconstructionModel(dettype,clf); } } @@ -395,7 +461,6 @@ void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){ return; } - AliITSsegmentation* seg; AliITSClusterFinder *clf; MakeTreeC(); @@ -403,10 +468,8 @@ void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){ //SPD if(dettype==0){ if(!GetReconstructionModel(dettype)){ - seg = (AliITSsegmentation*)GetSegmentationModel(dettype); - clf = new AliITSClusterFinderV2SPD(fGeom); + clf = new AliITSClusterFinderV2SPD(this); clf->InitGeometry(); - clf->SetSegmentation(seg); if(!rawdata) clf->SetDigits(DigitsAddress(0)); SetReconstructionModel(dettype,clf); @@ -415,10 +478,8 @@ void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){ //SDD if(dettype==1){ if(!GetReconstructionModel(dettype)){ - seg = (AliITSsegmentation*)GetSegmentationModel(dettype); - clf = new AliITSClusterFinderV2SDD(fGeom); - clf->InitGeometry(); - clf->SetSegmentation(seg); + clf = new AliITSClusterFinderV2SDD(this); + clf->InitGeometry(); if(!rawdata) clf->SetDigits(DigitsAddress(1)); SetReconstructionModel(dettype,clf); } @@ -428,10 +489,8 @@ void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){ //SSD if(dettype==2){ if(!GetReconstructionModel(dettype)){ - seg = (AliITSsegmentation*)GetSegmentationModel(dettype); - clf = new AliITSClusterFinderV2SSD(fGeom); + clf = new AliITSClusterFinderV2SSD(this); clf->InitGeometry(); - clf->SetSegmentation(seg); if(!rawdata) clf->SetDigits(DigitsAddress(2)); SetReconstructionModel(dettype,clf); } @@ -774,7 +833,6 @@ void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t Int_t ndigits = itsDigits->GetEntriesFast(); if(ndigits>0){ rec->SetDetTypeRec(this); - rec->SetITSgeom(fGeom); rec->SetDigits(DigitsAddress(id)); rec->SetClusters(ClustersAddress(id)); rec->FindRawClusters(module); @@ -831,7 +889,7 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){ } for(id=0;id<3;id++){ rec = (AliITSClusterFinderV2*)GetReconstructionModel(id); - rec->SetITSgeom(fGeom); + rec->SetDetTypeRec(this); if (!rec) { Error("DigitsToRecPoints", "The reconstruction class was not instanciated"); @@ -859,3 +917,4 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){ } + diff --git a/ITS/AliITSDetTypeRec.h b/ITS/AliITSDetTypeRec.h index 8a3ddf9e53c..55f30b69743 100644 --- a/ITS/AliITSDetTypeRec.h +++ b/ITS/AliITSDetTypeRec.h @@ -27,6 +27,7 @@ class AliITSclusterV2; class AliRawReader; class AliITSgeom; + class AliITSDetTypeRec : public TObject { public: AliITSDetTypeRec(); // Default constructor @@ -47,10 +48,11 @@ class AliITSDetTypeRec : public TObject { virtual void SetTreeAddressD(TTree* treeD); virtual void SetSegmentationModel(Int_t dettype, AliITSsegmentation *seg); - virtual void SetCalibrationModel(Int_t dettype, AliITSresponse *cal); + virtual void SetCalibrationModel(Int_t iMod, AliITSresponse *cal); virtual void SetReconstructionModel(Int_t dettype, AliITSClusterFinder *rec); + virtual Bool_t GetCalibration(); virtual AliITSsegmentation* GetSegmentationModel(Int_t dettype); - virtual AliITSresponse* GetCalibrationModel(Int_t dettype); + virtual AliITSresponse* GetCalibrationModel(Int_t iMod); virtual AliITSClusterFinder* GetReconstructionModel(Int_t dettype); virtual void SetDigitClassName(Int_t i,Char_t *digit) @@ -103,9 +105,18 @@ class AliITSDetTypeRec : public TObject { void DigitsToRecPoints(Int_t evNumber,Int_t lastEntry,Option_t *det,Bool_t v2=kFALSE); void DigitsToRecPoints(AliRawReader* rawReader); + Bool_t GetCalibration(Int_t runNumber); + virtual void SetRunNumber(Int_t rn=0){fRunNumber = rn;} + virtual Int_t GetRunNumber() const {return fRunNumber;} + private: - static const Int_t fgkNdettypes; // number of det. types + 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[3]; // numbers of modules from different types + AliITSgeom *fGeom; // ITS geometry TObjArray *fReconstruction;//! [NDet] TObjArray *fSegmentation; //! [NDet] @@ -128,8 +139,9 @@ class AliITSDetTypeRec : public TObject { Int_t fNClustersV2; //Number of clusters v2 TString fSelectedVertexer; // Vertexer selected in CreateVertexer AliITSLoader* fLoader; // ITS loader + Int_t fRunNumber; //! run number (to access DB) - ClassDef(AliITSDetTypeRec,1) // ITS Reconstruction structure + ClassDef(AliITSDetTypeRec,3) // ITS Reconstruction structure }; #endif diff --git a/ITS/AliITSDetTypeSim.cxx b/ITS/AliITSDetTypeSim.cxx index d809e8f1ad6..c6575bcf031 100644 --- a/ITS/AliITSDetTypeSim.cxx +++ b/ITS/AliITSDetTypeSim.cxx @@ -28,6 +28,13 @@ #include "TTree.h" #include "AliRun.h" + +#include "AliCDBManager.h" +#include "AliCDBId.h" +#include "AliCDBStorage.h" +#include "AliCDBEntry.h" +#include "AliCDBMetaData.h" + #include "AliITSdigit.h" #include "AliITSdigitSPD.h" #include "AliITSdigitSDD.h" @@ -35,8 +42,6 @@ #include "AliITSDetTypeSim.h" #include "AliITSgeom.h" #include "AliITSpListItem.h" -#include "AliITSresponseSPD.h" -#include "AliITSresponseSDD.h" #include "AliITSresponseSSD.h" #include "AliITSsegmentationSPD.h" #include "AliITSsegmentationSDD.h" @@ -48,6 +53,9 @@ const Int_t AliITSDetTypeSim::fgkNdettypes = 3; +const Int_t AliITSDetTypeSim::fgkDefaultNModulesSPD = 240; +const Int_t AliITSDetTypeSim::fgkDefaultNModulesSDD = 260; +const Int_t AliITSDetTypeSim::fgkDefaultNModulesSSD = 1698; ClassImp(AliITSDetTypeSim) @@ -85,6 +93,11 @@ fDigClassName(){ // String with digit class name. fDigits = new TObjArray(fgkNdettypes); fNDigits = new Int_t[fgkNdettypes]; fLoader = 0; + fNMod[0] = fgkDefaultNModulesSPD; + fNMod[1] = fgkDefaultNModulesSDD; + fNMod[2] = fgkDefaultNModulesSSD; + SetRunNumber(); + } //---------------------------------------------------------------------- AliITSDetTypeSim::~AliITSDetTypeSim(){ @@ -110,6 +123,7 @@ AliITSDetTypeSim::~AliITSDetTypeSim(){ } if(fResponse){ + fResponse->Delete(); delete fResponse; fResponse = 0; @@ -132,7 +146,6 @@ AliITSDetTypeSim::~AliITSDetTypeSim(){ fLoader->GetModulesFolder()->Remove(this); } - if (fSDigits) { fSDigits->Delete(); delete fSDigits; @@ -227,22 +240,56 @@ AliITSsegmentation* AliITSDetTypeSim::GetSegmentationModelByModule(Int_t module) } //_______________________________________________________________________ -void AliITSDetTypeSim::SetResponseModel(Int_t dettype,AliITSresponse *resp){ +void AliITSDetTypeSim::CreateResponses() { + + //Create the container of response functions with correct size + if (fResponse) { + fResponse->Delete(); + delete fResponse; + } + + Int_t nModTot = 0; + for (Int_t i=0; iSetOwner(kTRUE); + fResponse->Clear(); + +} +//_______________________________________________________________________ +void AliITSDetTypeSim::SetResponseModel(Int_t iMod, AliITSresponse *resp){ + + //Set response model for modules + + if (fResponse==0) CreateResponses(); + + if (fResponse->At(iMod)!=0) + delete (AliITSresponse*) fResponse->At(iMod); + fResponse->AddAt(resp, iMod); + +} +/* +//_______________________________________________________________________ +void AliITSDetTypeSim::SetResponse(Int_t dettype, Int_t iMod, AliITSresponse *resp){ + + //Set response for the module iMod of type dettype + if (fResponse==0) CreateResponses(); + + Int_t nModBefore = 0; + for (Int_t i=0; iAt(nModBefore+iMod) != 0) + delete (AliITSresponse*) fResponse->At(nModBefore+iMod); + fResponse->AddAt(resp, nModBefore+iMod); - - //Set segmentation model for module number - if(fResponse==0) fResponse = new TObjArray(fgkNdettypes); - fResponse->AddAt(resp,dettype); } +*/ //______________________________________________________________________ void AliITSDetTypeSim::ResetResponse(){ //resets response array - if(fResponse){ - for(Int_t i=0;iGetEntries();i++){ - if(fResponse->At(i)) delete (AliITSresponse*)fResponse->At(i); - } - } + if(fResponse) + fResponse->Clear(); + } //______________________________________________________________________ void AliITSDetTypeSim::ResetSegmentation(){ @@ -250,39 +297,43 @@ void AliITSDetTypeSim::ResetSegmentation(){ //Resets segmentation array if(fSegmentation){ for(Int_t i=0;iAt(i)) delete (AliITSsegmentation*)fSegmentation->At(i); + if(fSegmentation->At(i)) + delete (AliITSsegmentation*)fSegmentation->At(i); } } } //_______________________________________________________________________ -AliITSresponse* AliITSDetTypeSim::GetResponseModel(Int_t dettype){ - - //Get segmentation model for module number - +AliITSresponse* AliITSDetTypeSim::GetResponseModel(Int_t iMod){ + //Get response model for module number iMod + if(fResponse==0) { - Warning("GetResponseModel","fResponse is 0!"); + AliError("fResponse is 0!"); return 0; - } - return (AliITSresponse*)(fResponse->At(dettype)); + } + + return (AliITSresponse*)(fResponse->At(iMod)); + } //_______________________________________________________________________ void AliITSDetTypeSim::SetDefaults(){ //Set defaults for segmentation and response - + if(fGeom==0){ Warning("SetDefaults","fGeom is 0!"); return; } - if(!fResponse) fResponse = new TObjArray(fgkNdettypes); + if (fResponse==0) CreateResponses(); AliITSsegmentation* seg; AliITSresponse* res; ResetResponse(); ResetSegmentation(); + + if(!GetCalibration()){AliFatal("Exit"); exit(0);} for(Int_t idet=0;idetDataType(); + const char *kData0=(GetResponseModel(fGeom->GetStartSPD()))->DataType(); if (strstr(kData0,"real")) { SetDigitClassName(idet,"AliITSdigit"); - } else SetDigitClassName(idet,"AliITSdigitSPD"); + } + else { + SetDigitClassName(idet,"AliITSdigitSPD"); + } } //SDD if(idet==1){ - if(!GetResponseModel(idet)){ - SetResponseModel(idet,new AliITSresponseSDD("simulated")); - } if(!GetSegmentationModel(idet)){ - res = GetResponseModel(idet); - seg = new AliITSsegmentationSDD(fGeom,res); + res = GetResponseModel(fGeom->GetStartSDD()); + seg = new AliITSsegmentationSDD(fGeom,res); SetSegmentationModel(idet,seg); } - const char *kopt = GetResponseModel(idet)->ZeroSuppOption(); - if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) SetDigitClassName(idet,"AliITSdigit"); - else SetDigitClassName(idet,"AliITSdigitSDD"); + const char *kopt = GetResponseModel(fGeom->GetStartSDD())->ZeroSuppOption(); + if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) { + SetDigitClassName(idet,"AliITSdigit"); + } + else { + SetDigitClassName(idet,"AliITSdigitSDD"); + } + } //SSD if(idet==2){ @@ -320,49 +372,112 @@ void AliITSDetTypeSim::SetDefaults(){ seg = new AliITSsegmentationSSD(fGeom); SetSegmentationModel(idet,seg); } - if(!GetResponseModel(idet)){ - SetResponseModel(idet,new AliITSresponseSSD("simulated")); - } - const char *kData2 = (GetResponseModel(idet))->DataType(); + const char *kData2 = (GetResponseModel(fGeom->GetStartSSD())->DataType()); if (strstr(kData2,"real")) { SetDigitClassName(idet,"AliITSdigit"); - } else SetDigitClassName(idet,"AliITSdigitSSD"); - + } + else { + SetDigitClassName(idet,"AliITSdigitSSD"); + } } + } + +} + +//______________________________________________________________________ +Bool_t AliITSDetTypeSim::GetCalibration() { + // Get Default calibration if a storage is not defined. + Bool_t deleteManager = kFALSE; + if(!AliCDBManager::Instance()->IsDefaultStorageSet()) { + AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); + deleteManager = kTRUE; + } + AliCDBStorage *storage = AliCDBManager::Instance()->GetDefaultStorage(); + + AliCDBEntry *entrySPD = storage->Get("ITS/Calib/RespSPD", fRunNumber); + TObjArray *respSPD = (TObjArray *)entrySPD->GetObject(); + entrySPD->SetObject(NULL); + entrySPD->SetOwner(kTRUE); + AliCDBEntry *entrySDD = storage->Get("ITS/Calib/RespSDD", fRunNumber); + TObjArray *respSDD = (TObjArray *)entrySDD->GetObject(); + entrySDD->SetObject(NULL); + entrySDD->SetOwner(kTRUE); + AliCDBEntry *entrySSD = storage->Get("ITS/Calib/RespSSD", fRunNumber); + TObjArray *respSSD = (TObjArray *)entrySSD->GetObject(); + entrySSD->SetObject(NULL); + entrySSD->SetOwner(kTRUE); + // DB entries are dleted. In this waymetadeta objects are deleted as well + delete entrySPD; + delete entrySDD; + delete entrySSD; + if(deleteManager){ + AliCDBManager::Instance()->Destroy(); + AliCDBManager::Instance()->RemoveDefaultStorage(); + storage = 0; // the storage is killed by AliCDBManager::Instance()->Destroy() } + if ((! respSPD)||(! respSDD)||(! respSSD)) { + AliWarning("Can not get calibration from calibration database !"); + return kFALSE; + } + fNMod[0] = respSPD->GetEntries(); + fNMod[1] = respSDD->GetEntries(); + fNMod[2] = respSSD->GetEntries(); + AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database", + fNMod[0], fNMod[1], fNMod[2])); + AliITSresponse* res; + for (Int_t i=0; iAt(i); + SetResponseModel(i, res); + } + for (Int_t i=0; iAt(i); + Int_t iMod = i + fNMod[0]; + SetResponseModel(iMod, res); + } + for (Int_t i=0; iAt(i); + Int_t iMod = i + fNMod[0] + fNMod[1]; + SetResponseModel(iMod, res); + } + + return kTRUE; } + + //_______________________________________________________________________ void AliITSDetTypeSim::SetDefaultSimulation(){ //Set default simulation for detector type - if(fGeom==0){ - Warning("SetDefaults","fGeom is 0!"); + Warning("SetDefaultSimulation","fGeom is 0!"); + return; + } + if(fResponse==0){ + Warning("SetDefaultSimulation","fResponse is 0!"); return; } - - if(!fResponse) fResponse = new TObjArray(fgkNdettypes); - AliITSsegmentation* seg; - AliITSresponse* res; AliITSsimulation* sim; for(Int_t idet=0;idetSetResponseModel(GetResponseModel(idet)); - sim->SetSegmentationModel((AliITSsegmentationSPD*)GetSegmentationModel(idet)); + // loop over all SPD modules + Int_t nSPD = fGeom->GetStartSDD()-fGeom->GetStartSPD(); + for(Int_t nsp=fGeom->GetStartSPD();nspSetResponseModel(nsp,GetResponseModel(nsp)); + } + sim->SetSegmentationModel(0,(AliITSsegmentationSPD*)GetSegmentationModel(idet)); sim->Init(); } } @@ -370,13 +485,15 @@ void AliITSDetTypeSim::SetDefaultSimulation(){ if(idet==1){ sim = GetSimulationModel(idet); if(!sim){ - seg = (AliITSsegmentationSDD*)GetSegmentationModel(idet); - res = (AliITSresponseSDD*)GetResponseModel(idet); - sim = new AliITSsimulationSDD(seg,res); + sim = new AliITSsimulationSDD(this); SetSimulationModel(idet,sim); } else { - sim->SetResponseModel((AliITSresponseSDD*)GetResponseModel(idet)); - sim->SetSegmentationModel((AliITSsegmentationSDD*)GetSegmentationModel(idet)); + Int_t nSDD = fGeom->GetStartSSD()-fGeom->GetStartSDD(); + for(Int_t nsd=fGeom->GetStartSDD();nsdSetResponseModel(nsd,GetResponseModel(nsd)); + } + + sim->SetSegmentationModel(1,(AliITSsegmentationSDD*)GetSegmentationModel(idet)); sim->Init(); } @@ -385,13 +502,20 @@ void AliITSDetTypeSim::SetDefaultSimulation(){ if(idet==2){ sim = GetSimulationModel(idet); if(!sim){ - seg = (AliITSsegmentationSSD*)GetSegmentationModel(idet); - res = (AliITSresponseSSD*)GetResponseModel(idet); - sim = new AliITSsimulationSSD(seg,res); + sim = new AliITSsimulationSSD(this); SetSimulationModel(idet,sim); + } else{ - sim->SetResponseModel((AliITSresponseSSD*)GetResponseModel(idet)); - sim->SetSegmentationModel((AliITSsegmentationSSD*)GetSegmentationModel(idet)); + + Int_t nSSD = fGeom->GetLastSSD()-fGeom->GetStartSSD()+1; + for(Int_t nss=fGeom->GetStartSSD();nssSetResponseModel(nss,GetResponseModel(nss)); + } + + sim->SetResponseModel(fGeom->GetStartSSD(),(AliITSresponseSSD*)GetResponseModel(fGeom->GetStartSSD())); + sim->SetSegmentationModel(2,(AliITSsegmentationSSD*)GetSegmentationModel(idet)); + + sim->Init(); } @@ -400,6 +524,9 @@ void AliITSDetTypeSim::SetDefaultSimulation(){ } } + + + //___________________________________________________________________ void AliITSDetTypeSim::SetTreeAddressS(TTree* treeS, Char_t* name){ // Set branch address for the ITS summable digits Trees. @@ -514,6 +641,7 @@ void AliITSDetTypeSim::SDigitsToDigits(Option_t* opt, Char_t* name){ id = fGeom->GetModuleType(module); if (!all && !det[id]) continue; sim = (AliITSsimulation*)GetSimulationModel(id); + printf("module=%d name=%s\n",module,sim->ClassName()); if(!sim){ Error("SDigit2Digits","The simulation class was not " "instanciated for module %d type %s!",module, @@ -566,7 +694,6 @@ void AliITSDetTypeSim::AddSimDigit(Int_t branch, AliITSdigit* d){ break; } - } //______________________________________________________________________ @@ -581,7 +708,7 @@ void AliITSDetTypeSim::AddSimDigit(Int_t branch,Float_t phys,Int_t *digits, new(ldigits[fNDigits[branch]++]) AliITSdigitSPD(digits,tracks,hits); break; case 1: - resp = (AliITSresponseSDD*)GetResponseModel(branch); + resp = (AliITSresponseSDD*)GetResponseModel(fGeom->GetStartSDD()); new(ldigits[fNDigits[branch]++]) AliITSdigitSDD(phys,digits,tracks, hits,charges,resp); break; @@ -590,3 +717,59 @@ void AliITSDetTypeSim::AddSimDigit(Int_t branch,Float_t phys,Int_t *digits, break; } } + + + +//______________________________________________________________________ +void AliITSDetTypeSim::StoreCalibration(Int_t firstRun, Int_t lastRun, AliCDBMetaData &md) { + + // Store calibration in the calibration database + + // The database must be created in an external piece of code (i.e. + // a configuration macro ) + + if(!AliCDBManager::Instance()->IsDefaultStorageSet()) { + //AliError("No storage set!"); + AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); + //return; + } + + if (!fResponse) { + AliError("AliITSresponse classes are not defined - nothing done"); + return; + } + AliCDBId idRespSPD("ITS/Calib/RespSPD",firstRun, lastRun); + AliCDBId idRespSDD("ITS/Calib/RespSDD",firstRun, lastRun); + AliCDBId idRespSSD("ITS/Calib/RespSSD",firstRun, lastRun); + + TObjArray respSPD(fNMod[0]); + TObjArray respSDD(fNMod[1]-fNMod[0]); + TObjArray respSSD(fNMod[2]-fNMod[1]); + respSPD.SetOwner(kFALSE); + respSSD.SetOwner(kFALSE); + respSSD.SetOwner(kFALSE); + + Int_t index[fgkNdettypes]; + for (Int_t i = 0; iAt(i)); + + for (Int_t i = index[0]; iAt(i)); + + for (Int_t i = index[1]; iAt(i)); + + AliCDBManager::Instance()->GetDefaultStorage()->Put(&respSPD, idRespSPD, &md); + + AliCDBManager::Instance()->GetDefaultStorage()->Put(&respSDD, idRespSDD, &md); + + AliCDBManager::Instance()->GetDefaultStorage()->Put(&respSSD, idRespSSD, &md); +} + + diff --git a/ITS/AliITSDetTypeSim.h b/ITS/AliITSDetTypeSim.h index cd182174165..c8800d339fb 100644 --- a/ITS/AliITSDetTypeSim.h +++ b/ITS/AliITSDetTypeSim.h @@ -16,6 +16,8 @@ $Id$ #include #include +class TTree; +class AliCDBMetaData; class AliITSdigit; class AliITSmodule; class AliITSpListItem; @@ -43,8 +45,9 @@ class AliITSDetTypeSim : public TObject { virtual AliITSsegmentation* GetSegmentationModel(Int_t dettype); virtual AliITSsegmentation* GetSegmentationModelByModule(Int_t module); - virtual void SetResponseModel(Int_t dettype,AliITSresponse *resp); - virtual AliITSresponse* GetResponseModel(Int_t dettype); + virtual void SetResponseModel(Int_t iMod,AliITSresponse *resp); + // virtual void SetResponse(Int_t dettype, Int_t iMod, AliITSresponse *resp); + virtual AliITSresponse* GetResponseModel(Int_t iMod); TObjArray* GetResponse() const {return fResponse;} TObjArray* GetSegmentation() const {return fSegmentation;} @@ -56,6 +59,8 @@ class AliITSDetTypeSim : public TObject { virtual void SetDefaults(); virtual void SetDefaultSimulation(); + virtual void SetRunNumber(Int_t rn=0){fRunNumber = rn;} + virtual Int_t GetRunNumber() const {return fRunNumber;} virtual void SetTreeAddressS(TTree* treeS, Char_t* name); virtual void SetTreeAddressD(TTree* treeD, Char_t* name); @@ -73,15 +78,28 @@ class AliITSDetTypeSim : public TObject { virtual void AddSumDigit(AliITSpListItem &sdig); virtual void AddRealDigit(Int_t branch, Int_t *digits); - virtual void AddSimDigit(Int_t branch, AliITSdigit *d); virtual void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits, - Int_t* tracks,Int_t *hits,Float_t* trkcharges); + virtual void AddSimDigit(Int_t branch, AliITSdigit *d); + virtual void AddSimDigit(Int_t branch,Float_t phys,Int_t* digits, + Int_t* tracks,Int_t *hits,Float_t* trkcharges); virtual void SetDigitClassName(Int_t i, Char_t* name) {fDigClassName[i]=name;} Char_t* GetDigitClassName(Int_t i) const {return fDigClassName[i];} + + void StoreCalibration(Int_t firstRun, Int_t lastRun, AliCDBMetaData &md); + + protected: + + virtual void CreateResponses(); + virtual Bool_t GetCalibration(); private: - - static const Int_t fgkNdettypes; // number of different det. types + + static const Int_t fgkNdettypes; // number of different 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[3]; // numbers of modules from different types + AliITSgeom *fGeom; // pointer to ITS geom TObjArray *fSimulation; //! [NDet] TObjArray *fSegmentation; //! [NDet] @@ -91,13 +109,14 @@ class AliITSDetTypeSim : public TObject { Int_t fNSDigits; //! number of SDigits TClonesArray *fSDigits; //! [NMod][NSDigits] Int_t* fNDigits; //! [NDet] number of Digits for det. + Int_t fRunNumber; //! run number (to access DB) TObjArray *fDigits; //! [NMod][NDigits] TString fHitClassName; //! String with Hit class name TString fSDigClassName;//! String with SDigit class name. Char_t* fDigClassName[3]; //! String with digit class name. AliLoader* fLoader; // loader - ClassDef(AliITSDetTypeSim,1) // ITS Simulation structure + ClassDef(AliITSDetTypeSim,2) // ITS Simulation structure }; diff --git a/ITS/AliITSresponseSDD.cxx b/ITS/AliITSresponseSDD.cxx index 3dffc378cf5..7f6d14a25ac 100644 --- a/ITS/AliITSresponseSDD.cxx +++ b/ITS/AliITSresponseSDD.cxx @@ -19,7 +19,6 @@ #include #include "AliITSresponseSDD.h" - ////////////////////////////////////////////////// // Response class for set:ITS // // Specific subdetector implementation // @@ -28,7 +27,7 @@ // // ////////////////////////////////////////////////////// -const Int_t AliITSresponseSDD::fgkModules; +const Int_t AliITSresponseSDD::fgkWings; const Int_t AliITSresponseSDD::fgkChips; const Int_t AliITSresponseSDD::fgkChannels; const Int_t AliITSresponseSDD::fgkMaxAdcDefault = 1024; @@ -59,6 +58,12 @@ ClassImp(AliITSresponseSDD) SetNSigmaIntegration(fgkNsigmasDefault); SetNLookUp(fgkNcompsDefault); // SetClock(); + for(Int_t i=0;i fgkModules ) - { - cout << "Wrong number of dead modules: " << nmod << endl; - return; - } - Int_t nmax = (fgkModules-nmod)*fgkChips; + if( nchip == 0 && nchan == 0 ) return; + // if( nmod < 0 || nmod > fgkModules ) + // { + // cout << "Wrong number of dead modules: " << nmod << endl; + // return; + // } + + Int_t nmax = fgkWings*fgkChips; if( nchip < 0 || nchip > nmax ) { cout << "Wrong number of dead chips: " << nchip << endl; return; } - nmax = ((fgkModules - nmod)*fgkChips - nchip)*fgkChannels; + nmax = (fgkWings*fgkChips - nchip)*fgkChannels; if( nchan < 0 || nchan > nmax ) { cout << "Wrong number of dead channels: " << nchan << endl; @@ -232,7 +245,7 @@ void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan){ } TRandom *gran = new TRandom(); - + /* // cout << "modules" << endl; Int_t * mod = new Int_t [nmod]; Int_t i; //loop variable @@ -244,79 +257,55 @@ void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan){ for(Int_t p=0; pUniform() + 1.); - if( module <=0 || module > fgkModules ) - cout << "Wrong module: " << module << endl; - Int_t flagMod = 0; - for( Int_t k=0; kUniform() + 1.); + if( wing <=0 || wing > fgkWings ) Error("SetDeadChannels","Wrong wing"); Int_t chi = (Int_t) (fgkChips*gran->Uniform() + 1.); - if( chi <=0 || chi > fgkChips ) cout << "Wrong chip: " << chi << endl; + if( chi <=0 || chi > fgkChips ) Error("SetDeadChannels","Wrong chip:%d\n",chi); i++; chip[i-1] = chi; - chipMod[i-1] = module; for( Int_t m=0; mUniform() + 1.); - if( module <=0 || module > fgkModules ) - cout << "Wrong module: " << module << endl; - Int_t flagMod = 0; - for( k=0; kUniform() + 1.); + if( wing <=0 || wing > fgkWings ) Error("SetDeadChannels","Wrong wing:%d\n",wing); Int_t chipp = (Int_t) (fgkChips*gran->Uniform() + 1.); - if( chipp <=0 || chipp > fgkChips ) cout << "Wrong chip: "<< chipp< fgkChips ) Error("SetDeadChannels","Wrong chip:%d",chipp); Int_t flagChip = 0; for( k=0; kUniform() + 1.); if( channel[i-1] <=0 || channel[i-1] > fgkChannels ) - cout << "Wrong channel: " << channel[i-1] << endl; + Error("SetDeadChannels","Wrong channel:%d\n",channel[i-1]); channelChip[i-1] = chipp; - channelMod[i-1] = module; - fGain[module-1][chipp-1][channel[i-1]-1] = 0.; - cout << i << ": Dead channel nr. " << channel[i-1] << " in chip nr. " - << channelChip[i-1] << " in module nr: " << channelMod[i-1] - << endl; + fGain[wing-1][chipp-1][channel[i-1]-1] = 0.; } - delete [] mod; delete [] chip; - delete [] chipMod; delete [] channel; - delete [] channelMod; delete [] channelChip; } //______________________________________________________________________ -void AliITSresponseSDD::PrintGains(){ +void AliITSresponseSDD::PrintGains() const{ // - if( GetDeadModules() == 0 && - GetDeadChips() == 0 && + if( GetDeadChips() == 0 && GetDeadChannels() == 0 ) return; @@ -326,12 +315,12 @@ void AliITSresponseSDD::PrintGains(){ cout << "**************************************************" << endl; // Print SDD electronic gains - for(Int_t t=0; tfResponse = s.fResponse; - this->fSegmentation = s.fSegmentation; this->fModule = s.fModule; this->fEvent = s.fEvent; this->fpList = s.fpList; diff --git a/ITS/AliITSsimulation.h b/ITS/AliITSsimulation.h index faebb47e0f0..85fd1da0be6 100644 --- a/ITS/AliITSsimulation.h +++ b/ITS/AliITSsimulation.h @@ -18,6 +18,7 @@ /* $Id$ */ #include +#include "AliITSDetTypeSim.h" #include "AliITSpList.h" class AliITSresponse; @@ -35,7 +36,7 @@ class AliITSsimulation : public TObject { public: AliITSsimulation(); // Default constructor // Standard constructor - AliITSsimulation(AliITSsegmentation *seg,AliITSresponse *res); + AliITSsimulation(AliITSDetTypeSim *dettyp); virtual ~AliITSsimulation(); // destructor // copy constructor. See detector specific implementation. AliITSsimulation(const AliITSsimulation &source); @@ -66,15 +67,14 @@ class AliITSsimulation : public TObject { // digitizes module using the "fast" detector simulator. virtual void CreateFastRecPoints(AliITSmodule *,Int_t, TRandom *,TClonesArray* /*recp*/) {;} - // Return pointer to Response model - virtual AliITSresponse* GetResponseModel(){return fResponse;} - // set pointer to Response model - virtual void SetResponseModel(AliITSresponse *res){fResponse = res;} - // Return pointer to Response model - virtual AliITSsegmentation* GetSegmentationModel(){return fSegmentation;} - // set pointer to Response model - virtual void SetSegmentationModel(AliITSsegmentation *seg){ - fSegmentation = seg;} + // Return pointer to Response model + virtual AliITSresponse* GetResponseModel(Int_t mod = 0){return fDetType->GetResponseModel(mod);} + // set pointer to Response model + virtual void SetResponseModel(Int_t mod, AliITSresponse *res){fDetType->SetResponseModel(mod,res);} + // Return pointer to Segmentation object + virtual AliITSsegmentation* GetSegmentationModel(Int_t dt) = 0; + // set pointer to Segmentation object + virtual void SetSegmentationModel(Int_t dt,AliITSsegmentation *seg) = 0; virtual AliITSpList* GetMap(){return fpList;} // Returns fpList, the map. virtual void SetMap(AliITSpList *p){fpList = p;} // Sets fpList, the map. virtual void ClearMap(){fpList->ClearMap();} // Clear fpList, map. @@ -90,14 +90,15 @@ class AliITSsimulation : public TObject { Bool_t GetDebug(Int_t level=1)const {return fDebug>=level;} protected: - AliITSresponse *fResponse; //! response - AliITSsegmentation *fSegmentation; //! segmentation + // AliITSresponse *fResponse; //! response + // AliITSsegmentation *fSegmentation; //! segmentation + AliITSDetTypeSim *fDetType; //! Access resp and segm via this obj AliITSpList *fpList; //! Int_t fModule; //! Int_t fEvent; //! Int_t fDebug; // debug flag - ClassDef(AliITSsimulation,3) // Simulation base class + ClassDef(AliITSsimulation,4) // Simulation base class }; diff --git a/ITS/AliITSsimulationFastPoints.h b/ITS/AliITSsimulationFastPoints.h index 7750692d965..890824a5dcb 100644 --- a/ITS/AliITSsimulationFastPoints.h +++ b/ITS/AliITSsimulationFastPoints.h @@ -19,6 +19,10 @@ public: void CreateFastRecPoints(AliITSmodule *mod,Int_t module,TRandom *rndm, TClonesArray* recp); void CreateFastRecPoints(Int_t module,TClonesArray* recp); + + virtual void SetSegmentationModel(Int_t dt, AliITSsegmentation *seg){fDetType->SetSegmentationModel(dt,seg);} + virtual AliITSsegmentation* GetSegmentationModel(Int_t dt){return fDetType->GetSegmentationModel(dt);} + private: diff --git a/ITS/AliITSsimulationSDD.cxx b/ITS/AliITSsimulationSDD.cxx index cfbecfd36df..223ce06c42a 100644 --- a/ITS/AliITSsimulationSDD.cxx +++ b/ITS/AliITSsimulationSDD.cxx @@ -20,33 +20,20 @@ #include #include -#include -#include -#include #include #include -#include #include #include -#include -#include -#include #include "AliITS.h" -#include "AliITSHuffman.h" -#include "AliITSMapA1.h" #include "AliITSMapA2.h" #include "AliITSRawData.h" -#include "AliITSdigitSDD.h" #include "AliITSdigitSPD.h" #include "AliITSetfSDD.h" #include "AliITSgeom.h" -#include "AliITShit.h" #include "AliITSmodule.h" #include "AliITSpList.h" -#include "AliITSresponse.h" #include "AliITSresponseSDD.h" -#include "AliITSsegmentation.h" #include "AliITSsegmentationSDD.h" #include "AliITSsimulationSDD.h" #include "AliLog.h" @@ -54,25 +41,14 @@ ClassImp(AliITSsimulationSDD) //////////////////////////////////////////////////////////////////////// -// Version: 0 -// Written by Piergiorgio Cerello -// November 23 1999 -// -// AliITSsimulationSDD is the simulation of SDDs. - // -//Begin_Html -/* - - -
- -

This show the relasionships between the ITS hit class and the - rest of Aliroot. - -

-*/
-//End_Html
- //______________________________________________________________________
+// Version: 0                                                         //
+// Written by Piergiorgio Cerello                                     //
+// November 23 1999                                                   //
+//                                                                    //
+// AliITSsimulationSDD is the simulation of SDDs.                     //
+////////////////////////////////////////////////////////////////////////
+
+//______________________________________________________________________
 Int_t power(Int_t b, Int_t e) {
     // compute b to the e power, where both b and e are Int_ts.
     Int_t power = 1,i;
@@ -204,9 +180,8 @@ AliITSsimulation& AliITSsimulationSDD::operator=(const AliITSsimulation &src){
 }
 
 //______________________________________________________________________
-AliITSsimulationSDD::AliITSsimulationSDD(AliITSsegmentation *seg,
-                                         AliITSresponse *resp):
-AliITSsimulation(seg,resp),
+AliITSsimulationSDD::AliITSsimulationSDD(AliITSDetTypeSim* dettyp):
+AliITSsimulation(dettyp),
 fITS(0),
 fHitMap2(0),
 fHitSigMap2(0),
@@ -247,23 +222,26 @@ void AliITSsimulationSDD::Init(){
     SetDoFFT();
     SetCheckNoise();
 
-    fpList = new AliITSpList( GetSeg()->Npz(),
-                              fScaleSize*GetSeg()->Npx() );
-    fHitSigMap2 = new AliITSMapA2(GetSeg(),fScaleSize,1);
-    fHitNoiMap2 = new AliITSMapA2(GetSeg(),fScaleSize,1);
+    AliITSsegmentationSDD* seg = (AliITSsegmentationSDD*)GetSegmentationModel(1);
+    
+    AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSDD());
+    fpList = new AliITSpList( seg->Npz(),
+                              fScaleSize*seg->Npx() );
+    fHitSigMap2 = new AliITSMapA2(seg,fScaleSize,1);
+    fHitNoiMap2 = new AliITSMapA2(seg,fScaleSize,1);
     fHitMap2 = fHitSigMap2;
 
-    fNofMaps = GetSeg()->Npz();
-    fMaxNofSamples = GetSeg()->Npx();
+    fNofMaps = seg->Npz();
+    fMaxNofSamples = seg->Npx();
     fAnodeFire = new Bool_t [fNofMaps];
     
-    Float_t sddLength = GetSeg()->Dx();
-    Float_t sddWidth  = GetSeg()->Dz();
+    Float_t sddLength = seg->Dx();
+    Float_t sddWidth  = seg->Dz();
 
     Int_t dummy        = 0;
-    Float_t anodePitch = GetSeg()->Dpz(dummy);
-    Double_t timeStep  = (Double_t)GetSeg()->Dpx(dummy);
-    Float_t driftSpeed = GetResp()->DriftSpeed();
+    Float_t anodePitch = seg->Dpz(dummy);
+    Double_t timeStep  = (Double_t)seg->Dpx(dummy);
+    Float_t driftSpeed = res->DriftSpeed();
 
     if(anodePitch*(fNofMaps/2) > sddWidth) {
         Warning("AliITSsimulationSDD",
@@ -278,10 +256,10 @@ void AliITSsimulationSDD::Init(){
     } // end if
 
     fElectronics = new AliITSetfSDD(timeStep/fScaleSize,
-                                    GetResp()->Electronics());
+                                    res->Electronics());
 
     char opt1[20], opt2[20];
-    GetResp()->ParamOptions(opt1,opt2);
+    res->ParamOptions(opt1,opt2);
     fParam = opt2;
     char *same = strstr(opt1,"same");
     if (same) {
@@ -292,7 +270,7 @@ void AliITSsimulationSDD::Init(){
         fBaseline.Set(fNofMaps);
     } // end if
 
-    const char *kopt=GetResp()->ZeroSuppOption();
+    const char *kopt=res->ZeroSuppOption();
     if (strstr(fParam.Data(),"file") ) {
         fD.Set(fNofMaps);
         fT1.Set(fNofMaps);
@@ -313,7 +291,7 @@ void AliITSsimulationSDD::Init(){
         SetCompressParam();
     } // end if else strstr
 
-    Bool_t write = GetResp()->OutputOption();
+    Bool_t write = res->OutputOption();
     if(write && strstr(kopt,"2D")) MakeTreeB();
 
     // call here if baseline does not change by module
@@ -377,9 +355,9 @@ void AliITSsimulationSDD::SDigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev){
 
     InitSimulationModule( md, ev );
     HitsToAnalogDigits( mod );
-    ChargeToSignal( kFALSE ); // - Process signal without add noise
+    ChargeToSignal( fModule,kFALSE ); // - Process signal without add noise
     fHitMap2 = fHitNoiMap2;   // - Swap to noise map
-    ChargeToSignal( kTRUE );  // - Process only noise
+    ChargeToSignal( fModule,kTRUE );  // - Process only noise
     fHitMap2 = fHitSigMap2;   // - Return to signal map
     WriteSDigits();
     ClearMaps();
@@ -388,8 +366,9 @@ void AliITSsimulationSDD::SDigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev){
 Bool_t AliITSsimulationSDD::AddSDigitsToModule(TClonesArray *pItemArray,
                                                Int_t mask ) {
     // Add Summable digits to module maps.
+  AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSDD());
     Int_t    nItems = pItemArray->GetEntries();
-    Double_t maxadc = GetResp()->MaxAdc();
+    Double_t maxadc = res->MaxAdc();
     Bool_t sig = kFALSE;
     
     // cout << "Adding "<< nItems <<" SDigits to module " << fModule << endl;
@@ -433,7 +412,7 @@ void AliITSsimulationSDD::DigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev){
     InitSimulationModule( md, ev );
 
     if( !nhits && fCheckNoise ) {
-        ChargeToSignal( kTRUE );  // process noise
+        ChargeToSignal( fModule,kTRUE );  // process noise
         GetNoise();
         ClearMaps();
         return;
@@ -441,7 +420,7 @@ void AliITSsimulationSDD::DigitiseModule(AliITSmodule *mod,Int_t md,Int_t ev){
         if( !nhits ) return;
         
     HitsToAnalogDigits( mod );
-    ChargeToSignal( kTRUE );  // process signal + noise
+    ChargeToSignal( fModule,kTRUE );  // process signal + noise
 
     for( Int_t i=0; iZeroSuppOption();
+    AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSDD());
+    const char *kopt = res->ZeroSuppOption();
     ZeroSuppression( kopt );
 }
 //______________________________________________________________________
 void AliITSsimulationSDD::HitsToAnalogDigits( AliITSmodule *mod ) {
     // create maps to build the lists of tracks for each digit
 
-    TObjArray *hits     = mod->GetHits();
+  AliITSsegmentationSDD* seg = (AliITSsegmentationSDD*)GetSegmentationModel(1);
+  AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSDD());
+  TObjArray *hits     = mod->GetHits();
     Int_t      nhits    = hits->GetEntriesFast();
+
     //    Int_t      arg[6]   = {0,0,0,0,0,0};
     Int_t    dummy      = 0;
     Int_t    nofAnodes  = fNofMaps/2;
-    Float_t  sddLength  = GetSeg()->Dx();
-    Float_t  sddWidth   = GetSeg()->Dz();
-    Float_t  anodePitch = GetSeg()->Dpz(dummy);
-    Float_t  timeStep   = GetSeg()->Dpx(dummy);
-    Float_t  driftSpeed = GetResp()->DriftSpeed();
-    Float_t  maxadc     = GetResp()->MaxAdc();    
-    Float_t  topValue   = GetResp()->DynamicRange();
-    Float_t  cHloss     = GetResp()->ChargeLoss();
+    Float_t  sddLength  = seg->Dx();
+    Float_t  sddWidth   = seg->Dz();
+    Float_t  anodePitch = seg->Dpz(dummy);
+    Float_t  timeStep   = seg->Dpx(dummy);
+    Float_t  driftSpeed = res->DriftSpeed();
+    Float_t  maxadc     = res->MaxAdc();    
+    Float_t  topValue   = res->DynamicRange();
+    Float_t  cHloss     = res->ChargeLoss();
     Float_t  norm       = maxadc/topValue;
-    Double_t dfCoeff, s1; GetResp()->DiffCoeff(dfCoeff,s1); // Signal 2d Shape
-    Double_t eVpairs    = GetResp()->GetGeVToCharge()*1.0E9; // 3.6 eV by def.
-    Float_t  nsigma     = GetResp()->NSigmaIntegration(); //
-    Int_t    nlookups   = GetResp()->GausNLookUp();       //
-    Float_t  jitter     = ((AliITSresponseSDD*)GetResp())->JitterError(); // 
+    Double_t dfCoeff, s1; res->DiffCoeff(dfCoeff,s1); // Signal 2d Shape
+    Double_t eVpairs    = res->GetGeVToCharge()*1.0E9; // 3.6 eV by def.
+    Float_t  nsigma     = res->NSigmaIntegration(); //
+    Int_t    nlookups   = res->GausNLookUp();       //
+    Float_t  jitter     = res->JitterError(); // 
 
     // Piergiorgio's part (apart for few variables which I made float
     // when i thought that can be done
@@ -686,7 +669,7 @@ void AliITSsimulationSDD::HitsToAnalogDigits( AliITSmodule *mod ) {
                 if(TMath::Abs(aExpo) > nsigma)  anodeAmplitude = 0.;
                 else {
                     dummy          = (Int_t) ((aExpo+nsigma)/width);
-                    anodeAmplitude = amplitude*GetResp()->GausLookUp(dummy);
+                    anodeAmplitude = amplitude*res->GausLookUp(dummy);
                 } // end if TMath::Abs(aEspo) > nsigma
                 // index starts from 0
                 index = ((detector+1)%2)*nofAnodes+ia-1;
@@ -703,7 +686,7 @@ void AliITSsimulationSDD::HitsToAnalogDigits( AliITSmodule *mod ) {
                     else {
                         dummy         = (Int_t) ((tExpo+nsigma)/width);
                         timeAmplitude = anodeAmplitude*
-                            GetResp()->GausLookUp(dummy);
+                            res->GausLookUp(dummy);
                     } // end if TMath::Abs(tExpo) > nsigma
                     // build the list of Sdigits for this module        
                     //                    arg[0]     = index;
@@ -865,11 +848,13 @@ void AliITSsimulationSDD::AddDigit( Int_t i, Int_t j, Int_t signal ) {
     delete [] charges;
 }
 //______________________________________________________________________
-void AliITSsimulationSDD::ChargeToSignal(Bool_t bAddNoise) {
+void AliITSsimulationSDD::ChargeToSignal(Int_t mod,Bool_t bAddNoise) {
     // add baseline, noise, electronics and ADC saturation effects
 
     char opt1[20], opt2[20];
-    GetResp()->ParamOptions(opt1,opt2);
+    AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(mod);
+
+    res->ParamOptions(opt1,opt2);
     char *read = strstr(opt1,"file");
     Double_t baseline, noise; 
 
@@ -878,11 +863,11 @@ void AliITSsimulationSDD::ChargeToSignal(Bool_t bAddNoise) {
         //read baseline and noise from file
         if (readfile) ReadBaseline();
         readfile=kFALSE;
-    } else GetResp()->GetNoiseParam(noise,baseline);
+    } else res->GetNoiseParam(noise,baseline);
 
     Float_t contrib=0;
     Int_t i,k,kk;
-    Float_t maxadc = GetResp()->MaxAdc();    
+    Float_t maxadc = res->MaxAdc();    
     if(!fDoFFT) {
         for (i=0;iGetDeadModules() == 0 && 
-        response->GetDeadChips() == 0 && 
-        response->GetDeadChannels() == 0 )
-        return;  
+    if( response->IsDead() ||   
+        ( response->GetDeadChips() == 0 &&
+	  response->GetDeadChannels() == 0 ) ) return;  
     
-    static AliITS *iTS = (AliITS*)gAlice->GetModule( "ITS" );
+    // static AliITS *iTS = (AliITS*)gAlice->GetModule( "ITS" );
 
-    Int_t fMaxNofSamples = GetSeg()->Npx();    
-    AliITSgeom *geom = iTS->GetITSgeom();
-    Int_t firstSDDMod = geom->GetStartDet( 1 );
+    Int_t fMaxNofSamples = seg->Npx();    
+    // AliITSgeom *geom = iTS->GetITSgeom();
+    // Int_t firstSDDMod = geom->GetStartDet( 1 );
     // loop over wings
     for( Int_t j=0; j<2; j++ ) {
-        Int_t mod = (fModule-firstSDDMod)*2 + j;
-        for( Int_t u=0; uChips(); u++ )
-            for( Int_t v=0; vChannels(); v++ ) {
-                Float_t Gain = response->Gain( mod, u, v );
-                for( Int_t k=0; kChips()*response->Channels() +
-                        u*response->Channels() + 
-                        v;
-                    Double_t signal =  Gain * fHitMap2->GetSignal( i, k );
-                    fHitMap2->SetHit( i, k, signal );  ///
-                }
-            }
-    }    
+      // Int_t mod = (fModule-firstSDDMod)*2 + j;
+      for( Int_t u=0; uChips(); u++ )
+	for( Int_t v=0; vChannels(); v++ ) {
+	  Float_t gain = response->Gain(j, u, v );
+	  for( Int_t k=0; kChips()*response->Channels() +
+	      u*response->Channels() + 
+	      v;
+	    Double_t signal =  gain * fHitMap2->GetSignal( i, k );
+	    fHitMap2->SetHit( i, k, signal );  ///
+	  }
+	}
+    } 
 }
 //______________________________________________________________________
-void AliITSsimulationSDD::ApplyCrosstalk() {
+void AliITSsimulationSDD::ApplyCrosstalk(Int_t mod) {
     // function add the crosstalk effect to signal
     // temporal function, should be checked...!!!
-
-    Int_t fNofMaps = GetSeg()->Npz();
-    Int_t fMaxNofSamples = GetSeg()->Npx();
+    AliITSsegmentationSDD* seg = (AliITSsegmentationSDD*)GetSegmentationModel(1);
+  
+    Int_t fNofMaps = seg->Npz();
+    Int_t fMaxNofSamples = seg->Npx();
 
     // create and inizialice crosstalk map
     Float_t* ctk = new Float_t[fNofMaps*fMaxNofSamples+1];
@@ -993,10 +978,10 @@ void AliITSsimulationSDD::ApplyCrosstalk() {
         return;
     }
     memset( ctk, 0, sizeof(Float_t)*(fNofMaps*fMaxNofSamples+1) );
+    AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(mod);
 
     Double_t noise, baseline;
-    GetResp()->GetNoiseParam( noise, baseline );
-
+    res->GetNoiseParam( noise, baseline );
     for( Int_t z=0; zGetITSgeom()->GetStartSDD());
 
-    GetResp()->GiveCompressParam(cp);
+    res->GiveCompressParam(cp);
     for (i=0; i<2; i++) {
         fD[i]   = cp[i];
         fT1[i]  = cp[i+2];
@@ -1130,8 +1116,8 @@ void AliITSsimulationSDD::ReadBaseline(){
     Float_t bl,n;
     char input[100], base[100], param[100];
     char *filtmp;
-
-    GetResp()->Filenames(input,base,param);
+    AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSDD());
+    res->Filenames(input,base,param);
     fFileName=base;
     //
     filtmp = gSystem->ExpandPathName(fFileName.Data());
@@ -1208,10 +1194,12 @@ void AliITSsimulationSDD::Init2D(){
     char input[100],basel[100],par[100];
     char *filtmp;
     Double_t tmp1,tmp2;
-    GetResp()->Thresholds(tmp1,tmp2);
+    AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSDD());
+
+    res->Thresholds(tmp1,tmp2);
     Int_t minval = static_cast(tmp1);
 
-    GetResp()->Filenames(input,basel,par);
+    res->Filenames(input,basel,par);
     fFileName = par;
     //
     filtmp = gSystem->ExpandPathName(fFileName.Data());
@@ -1254,10 +1242,12 @@ void AliITSsimulationSDD::Compress2D(){
 
     Int_t db,tl,th; 
     Double_t tmp1,tmp2;
-    GetResp()->Thresholds(tmp1,tmp2); 
+    AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSDD());
+
+    res->Thresholds(tmp1,tmp2); 
     Int_t minval   = static_cast(tmp1);
-    Bool_t write   = GetResp()->OutputOption();   
-    Bool_t do10to8 = GetResp()->Do10to8();
+    Bool_t write   = res->OutputOption();   
+    Bool_t do10to8 = res->Do10to8();
     Int_t nz, nl, nh, low, i, j; 
 
     for (i=0; iDo10to8();
+    AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSDD());
+    AliITSsegmentationSDD* seg = (AliITSsegmentationSDD*)GetSegmentationModel(1);
+  
+    Bool_t do10to8 = res->Do10to8();
     Bool_t high    = kFALSE;
 
     fHitMap2->FlagHit(i,j);
@@ -1308,7 +1301,7 @@ void  AliITSsimulationSDD::FindCluster(Int_t i,Int_t j,Int_t signal,
     Int_t nn;
     Int_t dbx,tlx,thx;  
     Int_t xList[kMaxNeighbours], yList[kMaxNeighbours];
-    GetSeg()->Neighbours(i,j,&nn,xList,yList);
+    seg->Neighbours(i,j,&nn,xList,yList);
     Int_t in,ix,iy,qns;
     for (in=0; inThresholds(tmp1,tmp2);
+    AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSDD());
+
+    res->Thresholds(tmp1,tmp2);
     Int_t minval = static_cast(tmp1);
 
-    GetResp()->Filenames(input,basel,par);
+    res->Filenames(input,basel,par);
     fFileName=par;
 
     //  set first the disable and tol param
@@ -1397,7 +1392,9 @@ void AliITSsimulationSDD::Compress1D(){
     Int_t    dis,tol,thres,decr,diff;
     UChar_t *str=fStream->Stream();
     Int_t    counter=0;
-    Bool_t   do10to8=GetResp()->Do10to8();
+    AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSDD());
+
+    Bool_t   do10to8=res->Do10to8();
     Int_t    last=0;
     Int_t    k,i,j;
 
@@ -1452,7 +1449,7 @@ void AliITSsimulationSDD::Compress1D(){
     // open file and write out the stream of diff's
     static Bool_t open=kTRUE;
     static TFile *outFile;
-    Bool_t write = GetResp()->OutputOption();
+    Bool_t write = res->OutputOption();
     TDirectory *savedir = gDirectory;
  
     if (write ) {
@@ -1475,7 +1472,9 @@ void AliITSsimulationSDD::Compress1D(){
 //______________________________________________________________________
 void AliITSsimulationSDD::StoreAllDigits(){
     // if non-zero-suppressed data
-    Bool_t do10to8 = GetResp()->Do10to8();
+    AliITSresponseSDD* res = (AliITSresponseSDD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSDD());
+
+    Bool_t do10to8 = res->Do10to8();
     Int_t i, j, digits[3];
 
     for (i=0; iGetITSgeom()->GetStartSDD());
 
-    GetResp()->ParamOptions(opt1,opt2);
+    res->ParamOptions(opt1,opt2);
     fParam=opt2;
     char *same = strstr(opt1,"same");
     Double_t noise,baseline;
     if (same) {
-        GetResp()->GetNoiseParam(noise,baseline);
+        res->GetNoiseParam(noise,baseline);
     } else {
         static Bool_t readfile=kTRUE;
         //read baseline and noise from file
diff --git a/ITS/AliITSsimulationSDD.h b/ITS/AliITSsimulationSDD.h
index 83d276a5108..8fde01e78d0 100644
--- a/ITS/AliITSsimulationSDD.h
+++ b/ITS/AliITSsimulationSDD.h
@@ -5,6 +5,10 @@
 
 /* $Id$ */
 
+////////////////////////////////////////////////////////////
+// Simulation class for SDD                               //
+////////////////////////////////////////////////////////////
+
 #include 
 #include 
 
@@ -30,7 +34,7 @@ class AliITSsimulationSDD : public AliITSsimulation {
   public:
     AliITSsimulationSDD(); // default constructor
     //Standard Constructor
-    AliITSsimulationSDD(AliITSsegmentation *seg, AliITSresponse *res);
+    AliITSsimulationSDD(AliITSDetTypeSim* dettyp);
     // Copy opporator
     AliITSsimulationSDD(AliITSsimulationSDD &source);
     virtual ~AliITSsimulationSDD(); // Destructor
@@ -40,14 +44,11 @@ class AliITSsimulationSDD : public AliITSsimulation {
     // Initilize variables for this simulation
     void Init();
 
-    // get the address of the array mapping the signal or pointers to arrays
-    //virtual AliITSMap*  HitMap(Int_t i);
+    // Get a pointer to the segmentation object
+    virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(1);}
+    // set pointer to segmentation object
+    virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(1,seg);}
 
-    // Return The Responce class
-    AliITSresponseSDD* GetResp(){return (AliITSresponseSDD*)fResponse;}
-    // Return The Segmentation class
-    AliITSsegmentationSDD* GetSeg(){
-        return (AliITSsegmentationSDD*)fSegmentation;}
     // set the scale size factor for the smples in FFT
     virtual void SetScaleFourier(Int_t scale=4) {fScaleSize=scale;}
     Int_t ScaleFourier() const {return fScaleSize;} // returns the scale factor
@@ -75,7 +76,7 @@ class AliITSsimulationSDD : public AliITSsimulation {
     virtual void StoreAllDigits(); // if No compresion run this.
     virtual void ReadBaseline();  // read baseline values from a file
     // returns baseline and noise for a given anode i.
-    virtual void GetAnodeBaseline(Int_t i,Double_t &baseline,Double_t &noise);
+    virtual void GetAnodeBaseline(Int_t i,Double_t &baseline,Double_t &noise) const;
     // local implementation of ITS->AddDigit. Specific for SDD
     virtual void AddDigit(Int_t i, Int_t j, Int_t signal);
     // Finds clulsters of signals. Use with regards to Compresion algorithms
@@ -84,17 +85,17 @@ class AliITSsimulationSDD : public AliITSsimulation {
 
     // get parameters for 1D - this could be changed when we get more
     // input from Torino after they have a look at the code 
-    virtual Int_t Tolerance(Int_t i) {return fTol[i];}//returns tolerance
-    virtual Int_t Disable(Int_t i)  {return fT2[i];}//high threshold  2D
+    virtual Int_t Tolerance(Int_t i) const {return fTol[i];}//returns tolerance
+    virtual Int_t Disable(Int_t i)  const {return fT2[i];}//high threshold  2D
     // Set the output file name - for 1D encoding 
     virtual void SetFileName(const char *filnam) {fFileName=filnam;}
 
     // add baseline, noise, electronics and ADC saturation effects
-    void ChargeToSignal(Bool_t bAddNoise=kFALSE);
+    void ChargeToSignal(Int_t mod,Bool_t bAddNoise=kFALSE);
     // add dead channels
-    void ApplyDeadChannels();
+    void ApplyDeadChannels(Int_t mod);
     // add crosstalk effect
-    void ApplyCrosstalk();
+    void ApplyCrosstalk(Int_t mod);
     
     // create maps to build the lists of tracks for each summable digit
     void InitSimulationModule( Int_t module, Int_t event );
diff --git a/ITS/AliITSsimulationSPD.cxx b/ITS/AliITSsimulationSPD.cxx
index 42855d9178a..2e6daa287c3 100644
--- a/ITS/AliITSsimulationSPD.cxx
+++ b/ITS/AliITSsimulationSPD.cxx
@@ -26,8 +26,6 @@
 #include "AliITSMapA2.h"
 #include "AliITSpList.h"
 #include "AliITSsimulationSPD.h"
-#include "AliITSsegmentation.h"
-#include "AliITSresponse.h"
 #include "AliLog.h"
 
 //#define DEBUG
@@ -54,9 +52,8 @@ fHis(0){
     //    A default constructed AliITSsimulationSPD class.
 }
 //______________________________________________________________________
-AliITSsimulationSPD::AliITSsimulationSPD(AliITSsegmentation *seg,
-                                         AliITSresponse *res):
-AliITSsimulation(seg,res),
+AliITSsimulationSPD::AliITSsimulationSPD(AliITSDetTypeSim *dettyp):
+AliITSsimulation(dettyp),
 fMapA2(0),
 fHis(0){
     // Standard constructor
@@ -82,10 +79,12 @@ void AliITSsimulationSPD::Init() {
 
     fHis = 0;
     if(fMapA2) delete fMapA2;
-    fMapA2  = new AliITSMapA2(fSegmentation);
+    AliITSsegmentationSPD* seg = (AliITSsegmentationSPD*)GetSegmentationModel(0);
+    fMapA2  = new AliITSMapA2(seg);
     if(fpList) delete fpList;
     fpList  = new AliITSpList(GetNPixelsZ()+1,GetNPixelsX()+1);
 }
+/*
 //______________________________________________________________________
 void AliITSsimulationSPD::Init(AliITSsegmentationSPD *seg,
                                AliITSresponseSPD *resp) {
@@ -105,13 +104,14 @@ void AliITSsimulationSPD::Init(AliITSsegmentationSPD *seg,
     fHis = 0;
     if(fResponse) delete fResponse;
     fResponse     = resp;
-    if(fSegmentation) delete fSegmentation;
-    fSegmentation = seg;
+    if(GetSegmentationModel(0)) delete GetSegmentationModel(0);
+    GetSegmentationModel(0) = seg;
     if(fMapA2) delete fMapA2;
-    fMapA2  = new AliITSMapA2(fSegmentation);
+    fMapA2  = new AliITSMapA2(GetSegmentationModel(0));
     if(fpList) delete fpList;
     fpList  = new AliITSpList(GetNPixelsZ()+1,GetNPixelsX()+1);
 }
+*/
 //______________________________________________________________________
 AliITSsimulationSPD::~AliITSsimulationSPD() { 
     // destructor
@@ -268,7 +268,7 @@ void AliITSsimulationSPD::DigitiseModule(AliITSmodule *mod, Int_t,Int_t) {
     HitsToAnalogDigits(mod,frowpixel,fcolpixel,fenepixel,fpList);
 
     // apply mask to SPD module
-    SetMask();
+    SetMask(fModule);
 
     CreateDigit(fModule,fpList);
 
@@ -303,7 +303,7 @@ void AliITSsimulationSPD::SDigitsToDigits(Int_t module,AliITSpList *pList) {
     FillMapFrompList(pList);
 
     // apply mask to SPD module
-    SetMask();
+    SetMask(fModule);
 
     CreateDigit(module,pList);
 
@@ -405,25 +405,25 @@ void AliITSsimulationSPD::HitToDigit(AliITSmodule *mod,Int_t hitpos,
 
     x2l += x1l; y2l += y1l; z2l += z1l; // Convert to ending coordinate.
     // positions shifted and converted in microns
-    x1l   = x1l*kconv + fSegmentation->Dx()/2.;
-    z1l   = z1l*kconv + fSegmentation->Dz()/2.;
+    x1l   = x1l*kconv + GetSegmentationModel(0)->Dx()/2.;
+    z1l   = z1l*kconv + GetSegmentationModel(0)->Dz()/2.;
     // positions  shifted and converted in microns
-    x2l   = x2l*kconv + fSegmentation->Dx()/2.;
-    z2l   = z2l*kconv + fSegmentation->Dz()/2.;
+    x2l   = x2l*kconv + GetSegmentationModel(0)->Dx()/2.;
+    z2l   = z2l*kconv + GetSegmentationModel(0)->Dz()/2.;
     etot *= kconv1; // convert from GeV to electrons equivalent.
     Int_t module = mod->GetIndex();
 
     // to account for the effective sensitive area
     // introduced in geometry 
-    if (z1l<0 || z1l>fSegmentation->Dz()) return;
-    if (z2l<0 || z2l>fSegmentation->Dz()) return;
-    if (x1l<0 || x1l>fSegmentation->Dx()) return;
-    if (x2l<0 || x2l>fSegmentation->Dx()) return;
+    if (z1l<0 || z1l>GetSegmentationModel(0)->Dz()) return;
+    if (z2l<0 || z2l>GetSegmentationModel(0)->Dz()) return;
+    if (x1l<0 || x1l>GetSegmentationModel(0)->Dx()) return;
+    if (x2l<0 || x2l>GetSegmentationModel(0)->Dx()) return;
 
     //Get the col and row number starting from 1
     // the x direction is not inverted for the second layer!!!
-    fSegmentation->GetPadIxz(x1l, z1l, c1, r1); 
-    fSegmentation->GetPadIxz(x2l, z2l, c2, r2);
+    GetSegmentationModel(0)->GetPadIxz(x1l, z1l, c1, r1); 
+    GetSegmentationModel(0)->GetPadIxz(x2l, z2l, c2, r2);
 
     // to account for unexpected equal entrance and 
     // exit coordinates
@@ -513,10 +513,10 @@ void AliITSsimulationSPD::ChargeSharing(Float_t x1l,Float_t z1l,Float_t x2l,
     // and the z coordinate of  the pixel in the next row
     Float_t xpos, zpos;
 
-    fSegmentation->GetPadCxz(c1, r1-1, xpos, zpos); 
+    GetSegmentationModel(0)->GetPadCxz(c1, r1-1, xpos, zpos); 
 
-    Float_t xsize = fSegmentation->Dpx(0);
-    Float_t zsize = fSegmentation->Dpz(r1-1);
+    Float_t xsize = GetSegmentationModel(0)->Dpx(0);
+    Float_t zsize = GetSegmentationModel(0)->Dpz(r1-1);
     
     if (dirx == 1) refr = xpos+xsize/2.;
     else refr = xpos-xsize/2.;
@@ -561,7 +561,7 @@ void AliITSsimulationSPD::ChargeSharing(Float_t x1l,Float_t z1l,Float_t x2l,
                 xb = x2l;
             } // end if
             // shift to the pixel in the next cell in row direction
-            Float_t zsizeNext = fSegmentation->Dpz(rb-1);
+            Float_t zsizeNext = GetSegmentationModel(0)->Dpz(rb-1);
             //to account for cell at the borders of the detector
             if(zsizeNext==0) zsizeNext = zsize;
             refn += zsizeNext*dirz;
@@ -580,7 +580,7 @@ void AliITSsimulationSPD::ChargeSharing(Float_t x1l,Float_t z1l,Float_t x2l,
             } // end ifaxb > ax2l
             
             // shift to the pixel in the next cell in column direction
-            Float_t xsizeNext = fSegmentation->Dpx(cb-1);
+            Float_t xsizeNext = GetSegmentationModel(0)->Dpx(cb-1);
             //to account for cell at the borders of the detector
             if(xsizeNext==0) xsizeNext = xsize;
             refr += xsizeNext*dirx;
@@ -848,8 +848,11 @@ void AliITSsimulationSPD::SetFluctuations(AliITSpList *pList,Int_t module) {
         } // end of loop on pixels
     } // end of loop on pixels
 }
+
+
+
 //______________________________________________________________________
-void AliITSsimulationSPD::SetMask() {
+void AliITSsimulationSPD::SetMask(Int_t mod) {
     //  Apply a mask to the SPD module. 1% of the pixel channels are
     //  masked. When the database will be ready, the masked pixels
     //  should be read from it.
@@ -862,7 +865,7 @@ void AliITSsimulationSPD::SetMask() {
     Double_t signal;
     Int_t iz,ix,im;
     Float_t totMask;
-    Float_t perc = ((AliITSresponseSPD*)fResponse)->GetFractionDead();
+    Float_t perc = ((AliITSresponseSPD*)GetResponseModel(mod))->GetFractionDead();
     // in this way we get the same set of random numbers for all runs.
     // This is a cluge for now.
     static TRandom *rnd = new TRandom();
diff --git a/ITS/AliITSsimulationSPD.h b/ITS/AliITSsimulationSPD.h
index 222384ace87..b7deb325e11 100644
--- a/ITS/AliITSsimulationSPD.h
+++ b/ITS/AliITSsimulationSPD.h
@@ -30,16 +30,20 @@ class AliITSsimulationSPD : public AliITSsimulation {
  public:        
     AliITSsimulationSPD(); // Default constructor
     // Standard constructor
-    AliITSsimulationSPD(AliITSsegmentation *seg, AliITSresponse *res);
+    AliITSsimulationSPD(AliITSDetTypeSim *dettyp);
     virtual ~AliITSsimulationSPD();// destructor
     AliITSsimulationSPD(const AliITSsimulationSPD &source); // copy constructo
     // assignment operator
     AliITSsimulationSPD& operator=(const AliITSsimulationSPD &source);
     virtual AliITSsimulation& operator=(const AliITSsimulation &source);
+    // Get a pointer to the segmentation object
+    virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(0);}
+    // set pointer to segmentation objec
+    virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(0,seg);}
     // Initilizes the variables
     void Init();
     // Initilizes the variables with replacement segmentation/response class
-    void Init(AliITSsegmentationSPD *seg, AliITSresponseSPD *resp);
+    //    void Init(AliITSsegmentationSPD *seg, AliITSresponseSPD *resp);
 
     // Sum digitize module
     // Create maps to build the lists of tracks for each summable digit
@@ -102,7 +106,7 @@ class AliITSsimulationSPD : public AliITSsimulation {
     //  Apply a mask to the SPD module. 1% of the pixel channels are
     //  masked. When the database will be ready, the masked pixels
     //  should be read from it.
-    void SetMask();
+    void SetMask(Int_t mod);
     // Create Histograms
     void CreateHistograms();
     // Reset histograms for this detector
@@ -118,17 +122,20 @@ class AliITSsimulationSPD : public AliITSsimulation {
     // Getters for data kept in fSegmentation and fResponse.
     // Returns the Threshold in electrons
     Double_t GetThreshold(){Double_t a=0.0,b=0.0;
-    ((AliITSresponseSPD*)fResponse)->Thresholds(a,b); return a;}
+    AliITSresponseSPD* res = (AliITSresponseSPD*)GetResponseModel(0);
+    res->Thresholds(a,b); return a;}
     // Returns the threshold and rms noise.
     void GetThresholds(Double_t &t,Double_t &s){
-    ((AliITSresponseSPD*)fResponse)->Thresholds(t,s);}
+      AliITSresponseSPD* res = (AliITSresponseSPD*)GetResponseModel(0);
+      res->Thresholds(t,s);}
     // Returns the couplings Columb and Row.
     void GetCouplings(Double_t &cc,Double_t &cr){
-	((AliITSresponseSPD*)fResponse)->GetCouplingParam(cc,cr);}
+      AliITSresponseSPD* res = (AliITSresponseSPD*)GetResponseModel(0);
+      res->GetCouplingParam(cc,cr);}
     // Returns the number of pixels in x
-    Int_t GetNPixelsX(){return ((AliITSsegmentationSPD*)fSegmentation)->Npx();}
+    Int_t GetNPixelsX(){AliITSsegmentationSPD* seg= (AliITSsegmentationSPD*)GetSegmentationModel(0);return seg->Npx();}
     // Returns the number of pixels in z
-    Int_t GetNPixelsZ(){return ((AliITSsegmentationSPD*)fSegmentation)->Npz();}
+    Int_t GetNPixelsZ(){AliITSsegmentationSPD* seg= (AliITSsegmentationSPD*)GetSegmentationModel(0);return seg->Npz();}
 
  private:
     AliITSMapA2  *fMapA2;   //! MapA2 for Local internal use only
diff --git a/ITS/AliITSsimulationSPDdubna.cxx b/ITS/AliITSsimulationSPDdubna.cxx
index f64c7d41931..1fbad9b1ca1 100644
--- a/ITS/AliITSsimulationSPDdubna.cxx
+++ b/ITS/AliITSsimulationSPDdubna.cxx
@@ -22,10 +22,10 @@ $Id$
 #include 
 #include 
 #include 
-
 #include "AliITS.h"
 #include "AliITSMapA2.h" 
 #include "AliITSdigitSPD.h"
+#include "AliITSgeom.h"
 #include "AliITShit.h"
 #include "AliITSmodule.h"
 #include "AliITSpList.h"
@@ -63,9 +63,8 @@ fCoupling(0){
     AliDebug(1,Form("Calling degault constructor"));
 }
 //______________________________________________________________________
-AliITSsimulationSPDdubna::AliITSsimulationSPDdubna(AliITSsegmentation *seg,
-						                 AliITSresponse *resp,Int_t cup):
-AliITSsimulation(seg,resp),
+AliITSsimulationSPDdubna::AliITSsimulationSPDdubna(AliITSDetTypeSim *dettyp, Int_t cup):
+AliITSsimulation(dettyp),
 fHis(0),
 fSPDname(),
 fCoupling(cup){
@@ -86,11 +85,12 @@ fCoupling(cup){
     //    A default constructed AliITSsimulationSPDdubna class.
 
     AliDebug(1,
-	     Form("Calling degault constructor seg=%p resp=%p cup=%d",seg,resp,cup));
+	     Form("Calling degault constructor cup=%d",cup));
     if(cup==1||cup==2){ // For the moment, remove defusion if Coupling is
         // set.
-        resp->SetTemperature(0.0);
-        resp->SetDistanceOverVoltage(0.0);
+      AliITSresponseSPD* res = (AliITSresponseSPD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSPD());
+      res->SetTemperature(0.0);
+      res->SetDistanceOverVoltage(0.0);
     } // end if
     Init();
 }
@@ -108,7 +108,9 @@ void AliITSsimulationSPDdubna::Init(){
     SetModuleNumber(0);
     SetEventNumber(0);
     SetMap(new AliITSpList(GetNPixelsZ(),GetNPixelsX()));
-    GetResp(0,0)->SetDistanceOverVoltage(kmictocm*GetSeg()->Dy(),50.0);
+    AliITSresponseSPD* res = (AliITSresponseSPD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSPD());
+    AliITSsegmentationSPD* seg = (AliITSsegmentationSPD*)GetSegmentationModel(0);
+    res->SetDistanceOverVoltage(kmictocm*seg->Dy(),50.0);
 }
 //______________________________________________________________________
 AliITSsimulationSPDdubna::~AliITSsimulationSPDdubna(){
@@ -294,7 +296,9 @@ void AliITSsimulationSPDdubna::HitToSDigit(AliITSmodule *mod){
     Int_t idtrack;
     Double_t x0=0.0,x1=0.0,y0=0.0,y1=0.0,z0=0.0,z1=0.0,de=0.0;
     Double_t x,y,z,t,tp,st,dt=0.2,el,sig;
-    Double_t thick = kmictocm*GetSeg()->Dy();
+    AliITSsegmentationSPD* seg = (AliITSsegmentationSPD*)GetSegmentationModel(0);
+    AliITSresponseSPD* res = (AliITSresponseSPD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSPD());
+    Double_t thick = kmictocm*seg->Dy();
 
     AliDebug(1,Form("(mod=%p) fCoupling=%d",mod,fCoupling));
     if(nhits<=0) return;
@@ -314,22 +318,22 @@ void AliITSsimulationSPDdubna::HitToSDigit(AliITSmodule *mod){
                 x   = x0+x1*tp;
                 y   = y0+y1*tp;
                 z   = z0+z1*tp;
-                if(!(GetSeg()->LocalToDet(x,z,ix,iz))) continue; // outside
-                el  = GetResp(ix,iz)->GeVToCharge((Double_t)(dt*de));
+                if(!(seg->LocalToDet(x,z,ix,iz))) continue; // outside
+                el  = res->GeVToCharge((Double_t)(dt*de));
                 if(GetDebug(1)){
                     if(el<=0.0) cout<<"el="<IsPixelDead(GetModuleNumber(),ix,iz)) continue;
-        electronics = GetResp(ix,iz)->ApplyBaselineAndNoise();
+        if(res->IsPixelDead(GetModuleNumber(),ix,iz)) continue;
+        electronics = res->ApplyBaselineAndNoise();
         UpdateMapNoise(ix,iz,electronics);
         //
         // Apply Threshold and write Digits.
diff --git a/ITS/AliITSsimulationSPDdubna.h b/ITS/AliITSsimulationSPDdubna.h
index b48f407c492..cb3e5719206 100644
--- a/ITS/AliITSsimulationSPDdubna.h
+++ b/ITS/AliITSsimulationSPDdubna.h
@@ -6,7 +6,6 @@
 
 #include "TH1F.h"
 #include "TObjArray.h"
-
 #include "AliITSsimulation.h"
 #include "AliITSresponseSPD.h"
 #include "AliITSsegmentationSPD.h"
@@ -18,8 +17,9 @@ class AliITSmodule;
 class AliITSsimulationSPDdubna : public AliITSsimulation {
  public:
     AliITSsimulationSPDdubna();
-    AliITSsimulationSPDdubna(AliITSsegmentation *seg,AliITSresponse *res,
-                             Int_t cup=1);
+    //    AliITSsimulationSPDdubna(AliITSsegmentation *seg,AliITSresponse *res,
+    //                         Int_t cup=1);
+    AliITSsimulationSPDdubna(AliITSDetTypeSim *dettyp,Int_t cup=1);
     virtual ~AliITSsimulationSPDdubna();
     // copy constructor
     AliITSsimulationSPDdubna(const AliITSsimulationSPDdubna &source); 
@@ -93,12 +93,11 @@ class AliITSsimulationSPDdubna : public AliITSsimulation {
         //    none.
         //  Return:
         //    none
-        GetMap()->AddNoise(iz,ix,GetModuleNumber(),noise);};
-    AliITSsegmentationSPD* GetSeg(){ // Return pointer to Segmentation class
-        return (AliITSsegmentationSPD*)fSegmentation;};
-    // Return pointer to Responce class
-    AliITSresponseSPD* GetResp(Int_t ix,Int_t iz){ // ix iz dummy for now
-        ix=iz; return (AliITSresponseSPD*)GetResponseModel();};
+        GetMap()->AddNoise(iz,ix,GetModuleNumber(),noise);}
+    // Get a pointer to the segmentation object
+    virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(0);}
+    // set pointer to segmentation objec
+    virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(0,seg);}
     // Bari-Salerno Coupling parameters
     // "New" coupling routine  Tiziano Virgili
     void SetCoupling(Int_t row,Int_t col,Int_t ntrack,Int_t idhit);
@@ -107,14 +106,16 @@ class AliITSsimulationSPDdubna : public AliITSsimulation {
     // Getters for data kept in fSegmentation and fResponse.
     // Returns the Threshold in electrons
     Double_t GetThreshold(Int_t ix,Int_t iz){
-        Double_t th,sig;GetResp(ix,iz)->Thresholds(th,sig);return th;};
+      Double_t th,sig;AliITSresponseSPD* res=(AliITSresponseSPD*)GetResponseModel(0); 
+	res->Thresholds(th,sig);return th;};
     // Returns the couplings Columb and Row.
     void GetCouplings(Double_t &cc,Double_t &cr){
-        ((AliITSresponseSPD*)GetResp(0,0))->GetCouplingParam(cc,cr);};
+      AliITSresponseSPD* res = (AliITSresponseSPD*)GetResponseModel(0);
+      res->GetCouplingParam(cc,cr);};
     // Returns the number of pixels in x
-    Int_t GetNPixelsX(){return GetSeg()->Npx();};
+    Int_t GetNPixelsX(){return GetSegmentationModel(0)->Npx();};
     // Returns the number of pixels in z
-    Int_t GetNPixelsZ(){return GetSeg()->Npz();};
+    Int_t GetNPixelsZ(){return GetSegmentationModel(0)->Npz();};
 
     TObjArray    *fHis;          //! just in case for histogramming
     TString       fSPDname;      //! Histogram name
diff --git a/ITS/AliITSsimulationSSD.cxx b/ITS/AliITSsimulationSSD.cxx
index aedbfe8537e..2882d2423b8 100644
--- a/ITS/AliITSsimulationSSD.cxx
+++ b/ITS/AliITSsimulationSSD.cxx
@@ -19,11 +19,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-
 #include "AliITSmodule.h"
 #include "AliITSMapA2.h"
 #include "AliITSpList.h"
@@ -40,11 +35,12 @@
 
 ClassImp(AliITSsimulationSSD)
 ////////////////////////////////////////////////////////////////////////
-// Version: 0
-// Written by Enrico Fragiacomo
-// July 2000
-//
-// AliITSsimulationSSD is the simulation of SSDs.
+// Version: 0                                                         //
+// Written by Enrico Fragiacomo                                       //
+// July 2000                                                          // 
+//                                                                    //
+// AliITSsimulationSSD is the simulation of SSDs.                     //
+////////////////////////////////////////////////////////////////////////
 
 //----------------------------------------------------------------------
 AliITSsimulationSSD::AliITSsimulationSSD():AliITSsimulation(),
@@ -62,9 +58,8 @@ fDriftVel(){
     //  A default construction AliITSsimulationSSD class
 }
 //----------------------------------------------------------------------
-AliITSsimulationSSD::AliITSsimulationSSD(AliITSsegmentation *seg,
-                                         AliITSresponse *res):
-AliITSsimulation(seg,res),
+AliITSsimulationSSD::AliITSsimulationSSD(AliITSDetTypeSim* dettyp):
+AliITSsimulation(dettyp),
 fDCS(0),
 fMapA2(0),
 fIonE(0.0),
@@ -91,17 +86,17 @@ void AliITSsimulationSSD::Init(){
     //   none.
     // Return
     //   none.
-
+  AliITSresponseSSD* res =(AliITSresponseSSD*)GetResponseModel(fDetType->GetITSgeom()->GetStartSSD());
+  AliITSsegmentationSSD* seg = (AliITSsegmentationSSD*)GetSegmentationModel(2);
     Double_t noise[2] = {0.,0.};
-    GetResp()->GetNoiseParam(noise[0],noise[1]); // retrieves noise parameters
-    fDCS = new AliITSdcsSSD((AliITSsegmentationSSD*)GetSegmentationModel(),
-                            (AliITSresponseSSD*)GetResponseModel()); 
+    res->GetNoiseParam(noise[0],noise[1]); // retrieves noise parameters
+    fDCS = new AliITSdcsSSD(seg,res); 
 
     SetDriftVelocity(); // use default values in .h file
     SetIonizeE();       // use default values in .h file
     SetDiffConst();     // use default values in .h file
     fpList           = new AliITSpList(2,GetNStrips());
-    fMapA2           = new AliITSMapA2(GetSegmentationModel());
+    fMapA2           = new AliITSMapA2(seg);
 }
 //______________________________________________________________________
 AliITSsimulationSSD& AliITSsimulationSSD::operator=(
@@ -203,7 +198,7 @@ void AliITSsimulationSSD::SDigitToDigit(Int_t module,AliITSpList *pList){
   ApplyNoise(pList,module);
   ApplyCoupling(pList,module);
 
-  ChargeToSignal(pList);
+  ChargeToSignal(module,pList);
 }
 //______________________________________________________________________
 void AliITSsimulationSSD::HitsToAnalogDigits(AliITSmodule *mod,
@@ -217,13 +212,15 @@ void AliITSsimulationSSD::HitsToAnalogDigits(AliITSmodule *mod,
     Double_t de=0.0;
     Int_t module = mod->GetIndex();
 
+    AliITSsegmentationSSD* seg = (AliITSsegmentationSSD*)GetSegmentationModel(2);
+
     TObjArray *hits = mod->GetHits();
     Int_t nhits     = hits->GetEntriesFast();
     if (nhits<=0) return;
     AliITSTableSSD * tav = new AliITSTableSSD(GetNStrips());
     module = mod->GetIndex();
-    if ( mod->GetLayer() == 6 ) GetSegmentation()->SetLayer(6);
-    if ( mod->GetLayer() == 5 ) GetSegmentation()->SetLayer(5);
+    if ( mod->GetLayer() == 6 ) seg->SetLayer(6);
+    if ( mod->GetLayer() == 5 ) seg->SetLayer(5);
     for(Int_t i=0; iAngles(tang[0], tang[1]);//stereo<<->tan(stereo)~=stereo
+    seg->Angles(tang[0], tang[1]);//stereo<<->tan(stereo)~=stereo
     Double_t x, y, z;
     Double_t dex=0.0, dey=0.0, dez=0.0; 
     Double_t pairs; // pair generation energy per step.
@@ -270,7 +271,7 @@ void AliITSsimulationSSD::HitToDigit(Int_t module, Double_t x0, Double_t y0,
     for(Int_t j=0; j (GetSegmentation()->Dy()/2+10)*1.0E-4 ) {
+        if ( y > (seg->Dy()/2+10)*1.0E-4 ) {
             // check if particle is within the detector
             Warning("HitToDigit",
                     "hit out of detector y0=%e,y=%e,dey=%e,j =%e module=%d",
@@ -282,8 +283,8 @@ void AliITSsimulationSSD::HitToDigit(Int_t module, Double_t x0, Double_t y0,
                             <Dy()*1.0E-4)/2)/GetDriftVelocity(0);
-        tdrift[1] = ((GetSegmentation()->Dy()*1.0E-4)/2-y)/GetDriftVelocity(1);
+        tdrift[0] = (y+(seg->Dy()*1.0E-4)/2)/GetDriftVelocity(0);
+        tdrift[1] = ((seg->Dy()*1.0E-4)/2-y)/GetDriftVelocity(1);
 
         for(Int_t k=0; k<2; k++) {   // both sides    remember: 0=Pside 1=Nside
 
@@ -302,7 +303,7 @@ void AliITSsimulationSSD::HitToDigit(Int_t module, Double_t x0, Double_t y0,
             */
             { // replacement block for the above.
                 Float_t xp=x*1.e+4,zp=z*1.e+4; // microns
-                GetSegmentation()->GetPadTxz(xp,zp);
+                seg->GetPadTxz(xp,zp);
                 if(k==0) w = xp; // P side strip number
                 else w = zp; // N side strip number
             } // end test block
@@ -341,8 +342,8 @@ void AliITSsimulationSSD::ApplyNoise(AliITSpList *pList,Int_t module){
     Double_t signal,noise;
     Double_t noiseP[2] = {0.,0.};
     Double_t a,b;
-
-    GetResp()->GetNoiseParam(a,b); // retrieves noise parameters
+    AliITSresponseSSD* res =(AliITSresponseSSD*)GetResponseModel(module);
+    res->GetNoiseParam(a,b); // retrieves noise parameters
     noiseP[0] = a; noiseP[1] = b;
     for(k=0;k<2;k++){                    // both sides (0=Pside, 1=Nside)
         for(ix=0;ixClear();
 }
 //----------------------------------------------------------------------
-void AliITSsimulationSSD::ChargeToSignal(AliITSpList *pList) {
+void AliITSsimulationSSD::ChargeToSignal(Int_t module,AliITSpList *pList) {
     // charge to signal
     static AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
     Float_t threshold = 0.;
@@ -531,8 +532,8 @@ void AliITSsimulationSSD::ChargeToSignal(AliITSpList *pList) {
     Float_t charges[3] = {0.0,0.0,0.0};
     Float_t signal;
     Double_t noise[2] = {0.,0.};
-
-    GetResp()->GetNoiseParam(noise[0],noise[1]);
+    AliITSresponseSSD* res =(AliITSresponseSSD*)GetResponseModel(module);
+    res->GetNoiseParam(noise[0],noise[1]);
 
     for(Int_t k=0;k<2;k++){         // both sides (0=Pside, 1=Nside)
         // Threshold for zero-suppression
@@ -544,7 +545,7 @@ void AliITSsimulationSSD::ChargeToSignal(AliITSpList *pList) {
         for(Int_t ix=0;ixGetSignal(k,ix) <= threshold)continue;
             // convert to ADC signal
-            signal = GetResp()->DEvToADC(
+            signal = res->DEvToADC(
                 fMapA2->GetSignal(k,ix));
             if(signal>1024.) signal = 1024.;//if exceeding, accumulate last one
             digits[0] = k;
diff --git a/ITS/AliITSsimulationSSD.h b/ITS/AliITSsimulationSSD.h
index 0e732830c33..73aafa44f83 100644
--- a/ITS/AliITSsimulationSSD.h
+++ b/ITS/AliITSsimulationSSD.h
@@ -5,6 +5,10 @@
 
 /* $Id$ */
 
+/////////////////////////////////////////////////////////////
+// Simulation class for SSD                                //
+/////////////////////////////////////////////////////////////
+
 #include "AliITSsimulation.h"
 #include "AliITSsegmentationSSD.h" // function used in inline functions
 
@@ -24,9 +28,13 @@ class AliITSsimulationSSD: public AliITSsimulation {
     AliITSsimulationSSD& operator=(const AliITSsimulationSSD &source);
     virtual AliITSsimulation& operator=(const AliITSsimulation &source);
     //Standard Constructor
-    AliITSsimulationSSD(AliITSsegmentation *seg,AliITSresponse *resp);
+    AliITSsimulationSSD(AliITSDetTypeSim* dettyp);
     //Destructor
     virtual ~AliITSsimulationSSD();
+    // Get a pointer to the segmentation object
+    virtual AliITSsegmentation* GetSegmentationModel(Int_t /*dt*/){return fDetType->GetSegmentationModel(2);}
+    // set pointer to segmentation objec
+    virtual void SetSegmentationModel(Int_t /*dt*/, AliITSsegmentation *seg){fDetType->SetSegmentationModel(2,seg);}
     // Initilize variables for this simulation
     void Init();
     // Initilize variables for this simulation
@@ -46,8 +54,9 @@ class AliITSsimulationSSD: public AliITSsimulation {
 		    Double_t x,Double_t y,Double_t z,Double_t de,
 		    AliITSTableSSD *tav);
     //returns a pointer to the SSD segmentation.
-    AliITSsegmentationSSD *GetSegmentation() {
+    /*AliITSsegmentationSSD *GetSegmentation() {
 	return (AliITSsegmentationSSD*) fSegmentation;}
+    */
     //Returns the ionization energy for Si in GeV.
     Double_t GetIonizeE() const {return fIonE;}
     //Sets the ionization energy for Si in GeV.
@@ -68,13 +77,17 @@ class AliITSsimulationSSD: public AliITSsimulation {
     void Read(istream *is);
     virtual void Print(Option_t *option="") const {TObject::Print(option);}
     virtual Int_t Read(const char *name) {return TObject::Read(name);}
+    // Data members
+ protected:
+
+    AliITSdcsSSD *fDCS;   // Class containing detector controle paramters
 
  private:
     // Return the Response class
-    AliITSresponseSSD* GetResp(){return (AliITSresponseSSD*)fResponse;}
+    //    AliITSresponseSSD* GetResp(){return (AliITSresponseSSD*)fResponse;}
     // Return the Segmentation class
-    AliITSsegmentationSSD* GetSeg(){
-        return (AliITSsegmentationSSD*)fSegmentation;}
+    //AliITSsegmentationSSD* GetSeg(){
+    //  return (AliITSsegmentationSSD*)fSegmentation;}
     // returns the number of steps needed to proplerly distribute the charge
     // in a step
     Int_t NumOfSteps(Double_t x,Double_t y,Double_t z,
@@ -83,7 +96,7 @@ class AliITSsimulationSSD: public AliITSsimulation {
     void GetList(Int_t trk,Int_t ht,Int_t mod,AliITSpList *pLt,
 		 AliITSTableSSD *tav);
     // sets thresholds and fills digits
-    void ChargeToSignal(AliITSpList *pList);
+    void ChargeToSignal(Int_t module,AliITSpList *pList);
     // Writes Summable Digits to a root file for later use.
     void WriteSDigits(AliITSpList *pList);
     // ReadSDigits and create Digits
@@ -101,15 +114,10 @@ class AliITSsimulationSSD: public AliITSsimulation {
     // Computes the integral of a gaussian using Error Function
     Float_t F(Float_t av, Float_t x, Float_t s);
     // returns, from the segmentation, the number of stips
-    Int_t GetNStrips() {return GetSegmentation()->Npx();}
+    Int_t GetNStrips() {AliITSsegmentationSSD* seg = (AliITSsegmentationSSD*)GetSegmentationModel(2);return seg->Npx();}
     // returns, from the segmentation, the strip pitch
-    Float_t GetStripPitch() {return GetSegmentation()->Dpx(0);}
+    Float_t GetStripPitch() {AliITSsegmentationSSD* seg = (AliITSsegmentationSSD*)GetSegmentationModel(2);return seg->Dpx(0);}
 
-    // Data members
- protected:
-    AliITSdcsSSD *fDCS;   // Class containing detector controle paramters
-
- private:
     AliITSMapA2 *fMapA2;      //! Map of ionization, used localy only
     Double_t    fIonE;        // ionization energy of Si in GeV
     Double_t    fDifConst[2]; // Diffusion constants [h,e] in cm**2/sec
diff --git a/ITS/AliITSvPPRasymmFMD.cxx b/ITS/AliITSvPPRasymmFMD.cxx
index cd64b78ee92..5de2cd69aa4 100644
--- a/ITS/AliITSvPPRasymmFMD.cxx
+++ b/ITS/AliITSvPPRasymmFMD.cxx
@@ -5166,11 +5166,11 @@ void AliITSvPPRasymmFMD::SetDefaults(){
     //   none.
 
     const Float_t kconv = 1.0e+04; // convert cm to microns
-
     AliInfo("Called");    
 
     if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
     fDetTypeSim->SetITSgeom(GetITSgeom());
+  
     AliITSgeomSPD  *s0;
     AliITSgeomSDD  *s1;
     AliITSgeomSSD  *s2;
@@ -5179,12 +5179,16 @@ void AliITSvPPRasymmFMD::SetDefaults(){
    
     fDetTypeSim->ResetResponse();
     fDetTypeSim->ResetSegmentation();
+    
+    fDetTypeSim->SetDefaults();
+    
     //SPD
     s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD);// Get shape info. Do it this way for now.
-    AliITSresponseSPD* resp0=new AliITSresponseSPD();
-    SetResponseModel(kSPD,resp0);
+    //AliITSresponseSPD* resp0=new AliITSresponseSPD();
+
+    //AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(GetITSgeom());
 
-    AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(GetITSgeom());
+    AliITSsegmentationSPD* seg0 = (AliITSsegmentationSPD*)fDetTypeSim->GetSegmentationModel(0);
     seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
 		     s0->GetDz()*2.*kconv, // for now.
 		     s0->GetDy()*2.*kconv); // x,z,y full width in microns.
@@ -5200,32 +5204,36 @@ void AliITSvPPRasymmFMD::SetDefaults(){
     seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
     SetSegmentationModel(kSPD,seg0);
     // set digit and raw cluster classes to be used
-    const char *kData0=(fDetTypeSim->GetResponseModel(kSPD))->DataType();
+    const char *kData0=(fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD()))->DataType();
     if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit");
     else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
-
     // SDD
     s1 = (AliITSgeomSDD*) GetITSgeom()->GetShape(kSDD);// Get shape info. Do it this way for now.
-    AliITSresponseSDD* resp1=new AliITSresponseSDD("simulated");
-    SetResponseModel(kSDD,resp1);
-   
-    AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(GetITSgeom(),resp1);
+
+    //AliITSresponseSDD* resp1=new AliITSresponseSDD("simulated");
+    
+    //AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(GetITSgeom(),resp1);    
+
+    AliITSsegmentationSDD* seg1 = (AliITSsegmentationSDD*)fDetTypeSim->GetSegmentationModel(1);
     seg1->SetDetSize(s1->GetDx()*kconv, // base this on AliITSgeomSDD
 		     s1->GetDz()*2.*kconv, // for now.
 		     s1->GetDy()*2.*kconv); // x,z,y full width in microns.
     seg1->SetNPads(256,256);// Use AliITSgeomSDD for now
     SetSegmentationModel(kSDD,seg1);
-    const char *kData1=(fDetTypeSim->GetResponseModel(kSDD))->DataType();
-    const char *kopt=fDetTypeSim->GetResponseModel(kSDD)->ZeroSuppOption();
+    const char *kData1=(fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()))->DataType();
+    const char *kopt=fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD())->ZeroSuppOption();
     if((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ){
 	fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigit");
     } else fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigitSDD");
     // SSD  Layer 5
 
     s2 = (AliITSgeomSSD*) GetITSgeom()->GetShape(kSSD);// Get shape info. Do it this way for now.
-    SetResponseModel(kSSD,new AliITSresponseSSD("simulated"));
+
+
+    //SetResponseModel(GetITSgeom()->GetStartSSD(),new AliITSresponseSSD("simulated"));
     
-    AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(GetITSgeom());
+    //AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(GetITSgeom());
+    AliITSsegmentationSSD* seg2 = (AliITSsegmentationSSD*)fDetTypeSim->GetSegmentationModel(2);
     seg2->SetDetSize(s2->GetDx()*2.*kconv, // base this on AliITSgeomSSD
 		     s2->GetDz()*2.*kconv, // for now.
 		     s2->GetDy()*2.*kconv); // x,z,y full width in microns.
@@ -5235,7 +5243,7 @@ void AliITSvPPRasymmFMD::SetDefaults(){
     seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
     seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
     SetSegmentationModel(kSSD,seg2); 
-    const char *kData2=(fDetTypeSim->GetResponseModel(kSSD))->DataType();
+        const char *kData2=(fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()))->DataType();
     if(strstr(kData2,"real") ) fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigit");
     else fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigitSSD");
     if(fgkNTYPES>3){
@@ -5243,6 +5251,7 @@ void AliITSvPPRasymmFMD::SetDefaults(){
 		"Only the four basic detector types are initialised!");
     }// end if
 
+    
     return;
 }
 //______________________________________________________________________
@@ -5312,6 +5321,7 @@ void AliITSvPPRasymmFMD::StepManager(){
     //   none.
     // Return:
     //   none.
+
     Int_t         copy, id;
     TLorentzVector position, momentum;
     static TLorentzVector position0;
@@ -5419,10 +5429,11 @@ void AliITSvPPRasymmFMD::StepManager(){
 	return;
     } // end if IsEntering
     // Fill hit structure with this new hit.
+    
     new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
 				   gMC->Edep(),gMC->TrackTime(),position,
 				   position0,momentum);
-    //
+
     position0 = position;
     stat0 = vol[3];
 
diff --git a/ITS/AliITSvSDD03.cxx b/ITS/AliITSvSDD03.cxx
index da825529efa..96675966cc0 100644
--- a/ITS/AliITSvSDD03.cxx
+++ b/ITS/AliITSvSDD03.cxx
@@ -718,7 +718,7 @@ void AliITSvSDD03::InitAliITSgeom(){
   Info("InitAliITSgeom","Reading geometry transformation directly from Geant 3");
   const Int_t knp=384;
   const Float_t kpitch=50.E-4;/*cm*/
-  Float_t box[3]={0.5*kpitch*(Float_t)knp,150.E-4,1.0},p[knp+2],n[knp+2];
+  Float_t box[3]={0.5*kpitch*(Float_t)knp,150.E-4,1.0},p[knp+1],n[knp+1];
   const Int_t kltypess = 2;
   const Int_t knlayers = 12;
   const Int_t kndeep = 6;
@@ -845,14 +845,14 @@ void AliITSvSDD03::SetDefaults(){
  
     AliITSgeomSDD *s1;
     AliITSgeomSSD *s2;
-    SetResponseModel(kSPD,new AliITSresponseSPD());
+    SetResponseModel(GetITSgeom()->GetStartSPD(),new AliITSresponseSPD());
     SetSegmentationModel(kSPD,new AliITSsegmentationSPD());
     fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
 
     // SDD
     s1 = (AliITSgeomSDD*) GetITSgeom()->GetShape(kSDD);// Get shape info. Do it this way for now.
     AliITSresponseSDD *resp1=new AliITSresponseSDD("simulated");
-    SetResponseModel(kSDD,resp1);
+    SetResponseModel(GetITSgeom()->GetStartSDD(),resp1);
 
     AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(GetITSgeom(),resp1);
     seg1->SetDetSize(s1->GetDx()*kconv, // base this on AliITSgeomSDD
@@ -861,8 +861,8 @@ void AliITSvSDD03::SetDefaults(){
 
     seg1->SetNPads(256,256);// Use AliITSgeomSDD for now
     SetSegmentationModel(kSDD,seg1);
-    const char *kData1=(fDetTypeSim->GetResponseModel(kSDD))->DataType();
-    const char *kopt=fDetTypeSim->GetResponseModel(kSDD)->ZeroSuppOption();
+    const char *kData1=(fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()))->DataType();
+    const char *kopt=fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD())->ZeroSuppOption();
     if((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ){
 	fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigit");
     } else fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigitSDD");
@@ -872,7 +872,7 @@ void AliITSvSDD03::SetDefaults(){
     s2 = (AliITSgeomSSD*) GetITSgeom()->GetShape(kSSD);// Get shape info. Do it this way for now.
    
     AliITSresponse *resp2= new AliITSresponseSSD("simulated");
-    SetResponseModel(kSSD,resp2);
+    SetResponseModel(GetITSgeom()->GetStartSSD(),resp2);
 
     AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(GetITSgeom());
     seg2->SetDetSize(s2->GetDx()*2.*kconv, // base this on AliITSgeomSSD
@@ -886,7 +886,7 @@ void AliITSvSDD03::SetDefaults(){
     seg2->SetAnglesLay6(0.,0.); // strip angles rad P and N side.
 
     SetSegmentationModel(kSSD,seg2); 
-    const char *kData2=(fDetTypeSim->GetResponseModel(kSSD))->DataType();
+    const char *kData2=(fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()))->DataType();
     if(strstr(kData2,"real") ) fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigit");
     else fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigitSSD");
 
@@ -908,21 +908,21 @@ void AliITSvSDD03::SetDefaultSimulation(){
 
   if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
   AliITSsimulation *sim;
-  AliITSsegmentation *seg;
-  AliITSresponse *res;
+  //AliITSsegmentation *seg;
+  //AliITSresponse *res;
   //SPD
   if(fDetTypeSim){
     sim = fDetTypeSim->GetSimulationModel(kSPD);
     if (!sim) {
-      seg =(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
-      if(seg==0) seg = new AliITSsegmentationSPD();
-      res = (AliITSresponse*)fDetTypeSim->GetResponseModel(kSPD);
-      if(res==0) res = new AliITSresponseSPD();
-      sim = new AliITSsimulationSPDdubna(seg,res,0);
+      //seg =(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
+      //if(seg==0) seg = new AliITSsegmentationSPD();
+      //res = (AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD());
+      //if(res==0) res = new AliITSresponseSPD();
+      sim = new AliITSsimulationSPDdubna(fDetTypeSim);
       SetSimulationModel(kSPD,sim);
     }else{ // simulation exists, make sure it is set up properly.
-      sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
-      sim->SetResponseModel((AliITSresponse*)fDetTypeSim->GetResponseModel(kSPD));
+      sim->SetSegmentationModel(kSPD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
+      sim->SetResponseModel(GetITSgeom()->GetStartSPD(),(AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD()));
       sim->Init();
     } // end if
   } // end if iDetType
@@ -930,13 +930,13 @@ void AliITSvSDD03::SetDefaultSimulation(){
   if(fDetTypeSim){
     sim = fDetTypeSim->GetSimulationModel(kSDD);
     if (!sim) {
-      seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
-      res = (AliITSresponse*)fDetTypeSim->GetResponseModel(kSDD);
-      sim = new AliITSsimulationSDD(seg,res);
+      //      seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
+      //res = (AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
+      sim = new AliITSsimulationSDD(fDetTypeSim);
       SetSimulationModel(kSDD,sim);
     }else{ // simulation exists, make sure it is set up properly.
-      sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
-      sim->SetResponseModel((AliITSresponse*)fDetTypeSim->GetResponseModel(kSDD));
+      sim->SetSegmentationModel(kSDD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
+      sim->SetResponseModel(GetITSgeom()->GetStartSDD(),(AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()));
       
       sim->Init();
     } //end if
@@ -945,13 +945,13 @@ void AliITSvSDD03::SetDefaultSimulation(){
   if(fDetTypeSim){
     sim = fDetTypeSim->GetSimulationModel(kSSD);
     if (!sim) {
-      seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
-      res = (AliITSresponse*)fDetTypeSim->GetResponseModel(kSSD);
-      sim = new AliITSsimulationSSD(seg,res);
+      //      seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
+      // res = (AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
+      sim = new AliITSsimulationSSD(fDetTypeSim);
       SetSimulationModel(kSSD,sim);
     }else{ // simulation exists, make sure it is set up properly.
-      sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
-      sim->SetResponseModel((AliITSresponse*)fDetTypeSim->GetResponseModel(kSSD));
+      sim->SetSegmentationModel(kSSD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
+      sim->SetResponseModel(GetITSgeom()->GetStartSSD(),(AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()));
       sim->Init();
     } // end if
   } // end if iDetType
diff --git a/ITS/AliITSvSPD02.cxx b/ITS/AliITSvSPD02.cxx
index 5453dedffed..b62b29b87ee 100644
--- a/ITS/AliITSvSPD02.cxx
+++ b/ITS/AliITSvSPD02.cxx
@@ -712,7 +712,7 @@ void AliITSvSPD02::SetDefaults(){
     AliITSresponse *resp0=new AliITSresponseSPD();
     resp0->SetTemperature();
     resp0->SetDistanceOverVoltage();
-    SetResponseModel(kSPD,resp0);
+    SetResponseModel(0,resp0); 
 	
     AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(GetITSgeom());
     seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
@@ -730,7 +730,7 @@ void AliITSvSPD02::SetDefaults(){
     seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
     SetSegmentationModel(kSPD,seg0);
     // set digit and raw cluster classes to be used
-    const char *kData0=(fDetTypeSim->GetResponseModel(kSPD))->DataType();
+    const char *kData0=(fDetTypeSim->GetResponseModel(0))->DataType();
     if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit");
     else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
 //    SetSimulationModel(kSPD,new AliITSsimulationSPDdubna(seg0,resp0));
@@ -768,18 +768,18 @@ void AliITSvSPD02::SetDefaultSimulation(){
 
   if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
   AliITSsimulation *sim;
-  AliITSsegmentation *seg;
-  AliITSresponse *res;
+  //AliITSsegmentation *seg;
+  //AliITSresponse *res;
   if(fDetTypeSim){
     sim = fDetTypeSim->GetSimulationModel(kSPD);
     if (!sim) {
-      seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
-      res = (AliITSresponse*)fDetTypeSim->GetResponseModel(kSPD);
-      sim = new AliITSsimulationSPDdubna(seg,res,0);
+      //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
+      //res = (AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD());
+      sim = new AliITSsimulationSPDdubna(fDetTypeSim);
       SetSimulationModel(kSPD,sim);
     }else{ // simulation exists, make sure it is set up properly.
-      sim->SetResponseModel((AliITSresponse*)fDetTypeSim->GetResponseModel(kSPD));
-      sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
+      sim->SetResponseModel(GetITSgeom()->GetStartSPD(),(AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD()));
+      sim->SetSegmentationModel(kSPD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
       sim->Init();
     } // end if
   } // end if iDetType
diff --git a/ITS/AliITSvSSD03.cxx b/ITS/AliITSvSSD03.cxx
index e117daf6d75..a8a7bad875f 100644
--- a/ITS/AliITSvSSD03.cxx
+++ b/ITS/AliITSvSSD03.cxx
@@ -624,7 +624,7 @@ void AliITSvSSD03::Init(){
 }
 //______________________________________________________________________
 void AliITSvSSD03::SetDefaults(){
-    // sets the default segmentation, response, digit and raw cluster classes
+    // sets the default segmentation, rerponse, digit and raw cluster classes
     // Inputs:
     //    none.
     // Outputs:
@@ -646,7 +646,7 @@ void AliITSvSSD03::SetDefaults(){
     // Get shape info. Do it this way for now.
     s0 = (AliITSgeomSSD*) GetITSgeom()->GetShape(kSSD);
     AliITSresponse *resp0=new AliITSresponseSSD("simulated");
-    SetResponseModel(kSSD,resp0);	
+    SetResponseModel(GetITSgeom()->GetStartSSD(),resp0);	
 
     AliITSsegmentationSSD *seg0=new AliITSsegmentationSSD(GetITSgeom());
     seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSSD
@@ -657,7 +657,7 @@ void AliITSvSSD03::SetDefaults(){
     SetSegmentationModel(kSSD,seg0);
 
     // set digit and raw cluster classes to be used
-    const char *kData0=(fDetTypeSim->GetResponseModel(kSSD))->DataType();
+    const char *kData0=(fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()))->DataType();
     if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigit");
     else fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigitSSD");
 //    SetSimulationModel(kSSD,new AliITSsimulationSSD(seg0,resp0));
@@ -693,8 +693,8 @@ void AliITSvSSD03::SetDefaultSimulation(){
   if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
 
   AliITSsimulation *sim;
-  AliITSsegmentation *seg;
-  AliITSresponse *res;
+  //  AliITSsegmentation *seg;
+  // AliITSresponse *res;
   /*
   //SPD
   if(fDetTypeSim){
@@ -739,13 +739,13 @@ void AliITSvSSD03::SetDefaultSimulation(){
   if(fDetTypeSim){
     sim = fDetTypeSim->GetSimulationModel(kSSD);
     if (!sim) {
-      seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
-      res = (AliITSresponse*)fDetTypeSim->GetResponseModel(kSSD);
-      sim = new AliITSsimulationSSD(seg,res);
+      //  seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
+      // res = (AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
+      sim = new AliITSsimulationSSD(fDetTypeSim);
       SetSimulationModel(kSSD,sim);
     }else{ // simulation exists, make sure it is set up properly.
-      sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
-      sim->SetResponseModel((AliITSresponse*)fDetTypeSim->GetResponseModel(kSSD));
+      sim->SetSegmentationModel(kSSD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
+      sim->SetResponseModel(GetITSgeom()->GetStartSSD(),(AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()));
       ((AliITSsimulation*)sim)->Init();
       //        if(sim->GetResponseModel()==0) sim->SetResponseModel(
       //            (AliITSresponse*)iDetType->GetResponseModel());
diff --git a/ITS/Calib/RespSDD/Run0_10000_v0_s0.root b/ITS/Calib/RespSDD/Run0_10000_v0_s0.root
new file mode 100644
index 0000000000000000000000000000000000000000..ee0355f6cf16d913e15a1634dc593c4c5821a081
GIT binary patch
literal 12052
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
XPBU?$y66=Br!*7k1yVrjB?0~oC&h8F

literal 0
HcmV?d00001

diff --git a/ITS/Calib/RespSPD/Run0_10000_v0_s0.root b/ITS/Calib/RespSPD/Run0_10000_v0_s0.root
new file mode 100644
index 0000000000000000000000000000000000000000..cf4267352e02ea7d6e9743528162a43e645e9af4
GIT binary patch
literal 2338
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