X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSsimulationSPD.cxx;h=c99a00cbcc7309ad2ad8d8407b98988a43988cbb;hb=6ddaaee3dbf90d0c9ab9400e28410018bb852f8a;hp=7c74648794b6890a4796eb87c010005ad52bf145;hpb=7143d86b737040285e23d4d91b0f9e148b4832c3;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSsimulationSPD.cxx b/ITS/AliITSsimulationSPD.cxx index 7c74648794b..c99a00cbcc7 100644 --- a/ITS/AliITSsimulationSPD.cxx +++ b/ITS/AliITSsimulationSPD.cxx @@ -19,14 +19,9 @@ $Id$ #include #include -#include -#include -#include #include #include "AliITS.h" -#include "AliITSMapA2.h" #include "AliITSdigitSPD.h" -#include "AliITSgeom.h" #include "AliITShit.h" #include "AliITSmodule.h" #include "AliITSpList.h" @@ -35,13 +30,16 @@ $Id$ #include "AliITSsimulationSPD.h" #include "AliLog.h" #include "AliRun.h" +#include "AliCDBEntry.h" +#include "AliCDBLocal.h" //#define DEBUG ClassImp(AliITSsimulationSPD) //////////////////////////////////////////////////////////////////////// // Version: 1 -// Modified by Bjorn S. Nilsen, G.E. Bruno, H. Tydesjo +// Modified by D. Elia, G.E. Bruno, H. Tydesjo +// Fast diffusion code by Bjorn S. Nilsen // March-April 2006 // // Version: 0 @@ -144,7 +142,10 @@ AliITSsimulationSPD::~AliITSsimulationSPD(){ //______________________________________________________________________ AliITSsimulationSPD::AliITSsimulationSPD(const AliITSsimulationSPD - &s) : AliITSsimulation(s){ + &s) : AliITSsimulation(s), +fHis(s.fHis), +fSPDname(s.fSPDname), +fCoupling(s.fCoupling){ // Copy Constructor // Inputs: // AliITSsimulationSPD &s The original class for which @@ -153,8 +154,6 @@ AliITSsimulationSPD::AliITSsimulationSPD(const // none. // Return: - *this = s; - return; } //______________________________________________________________________ AliITSsimulationSPD& AliITSsimulationSPD::operator=(const @@ -193,22 +192,37 @@ AliITSsimulation& AliITSsimulationSPD::operator=(const //______________________________________________________________________ void AliITSsimulationSPD::GetCalibrationObjects(Int_t RunNr) { + // Gets the calibration objects for each module (ladder) + // Inputs: + // RunNr: hard coded to RunNr=0 for now + // Outputs: + // none. + // Return: + // none. + AliCDBManager* man = AliCDBManager::Instance(); - if(!man->IsDefaultStorageSet()) { - man->SetDefaultStorage("local://$ALICE_ROOT"); - } - AliCDBEntry *entrySPD = man->Get("ITS/Calib/CalibSPD", RunNr); + + AliCDBEntry *entrySPD=0; + entrySPD = man->Get("ITS/Calib/CalibSPD", RunNr); + if(!entrySPD){ - AliWarning("Cannot find SPD calibration entry!"); - return; + AliWarning("Cannot find SPD calibration entry in default storage! Using local storage $ALICE_ROOT"); + AliCDBStorage *localStor = + AliCDBManager::Instance()->GetStorage("local://$ALICE_ROOT"); + entrySPD = localStor->Get("ITS/Calib/CalibSPD", RunNr); + if(!entrySPD){ + AliFatal("Cannot find SPD calibration entry!"); + return; + } } + TObjArray *respSPD = (TObjArray *)entrySPD->GetObject(); if ((! respSPD)) { - AliWarning("Cannot get data from SPD database entry!"); + AliFatal("Cannot get data from SPD database entry!"); return; } for (Int_t mod=0; mod<240; mod++) { - calObj[mod] = (AliITSCalibrationSPD*) respSPD->At(mod); + fCalObj[mod] = (AliITSCalibrationSPD*) respSPD->At(mod); } } @@ -254,6 +268,9 @@ void AliITSsimulationSPD::SDigitiseModule(AliITSmodule *mod,Int_t, SetEventNumber(event); // HitToSDigit(mod); HitToSDigitFast(mod); + RemoveDeadPixels(mod); +// cout << "After Remove in SDigitiseModule !!!!!" << endl; // dom +// cout << "Module " << mod->GetIndex() << " Event " << event << endl; // dom WriteSDigits(); ClearMap(); } @@ -270,9 +287,11 @@ void AliITSsimulationSPD::WriteSDigits(){ static AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS"); AliDebug(1,Form("Writing SDigits for module %d",GetModuleNumber())); +// cout << "WriteSDigits for module " << GetModuleNumber() << endl; // dom GetMap()->GetMaxMapIndex(niz, nix); for(iz=0; izGetSignalOnly(iz,ix)>0.0){ +// cout << " Signal gt 0 iz ix " << iz << ix << " Module " << GetModuleNumber() << endl; // dom aliITS->AddSumDigit(*(GetMap()->GetpListItem(iz,ix))); if(AliDebugLevel()>0) { AliDebug(1,Form("%d, %d",iz,ix)); @@ -293,7 +312,8 @@ void AliITSsimulationSPD::FinishSDigitiseModule(){ // none AliDebug(1,"()"); - pListToDigits(); // Charge To Signal both adds noise and +// cout << "FinishSDigitiseModule for module " << GetModuleNumber() << endl; // dom + FrompListToDigits(); // Charge To Signal both adds noise and ClearMap(); return; } @@ -316,7 +336,8 @@ void AliITSsimulationSPD::DigitiseModule(AliITSmodule *mod,Int_t, // HitToSDigit(mod); HitToSDigitFast(mod); RemoveDeadPixels(mod); - pListToDigits(); +// cout << "After Remove in DigitiseModule in module " << mod->GetIndex() << endl; // dom + FrompListToDigits(); ClearMap(); } //______________________________________________________________________ @@ -388,22 +409,18 @@ void AliITSsimulationSPD::HitToSDigit(AliITSmodule *mod){ default: break; case 1: //case 3: - // x is column and z is row (see AliITSsegmentationSPD::GetPadIxz) for(i=0;iGetEntries();i++) if(GetMap()->GetpListItem(i)==0) continue; else{ - GetMap()->GetMapIndex( - GetMap()->GetpListItem(i)->GetIndex(),iz,ix); + GetMap()->GetMapIndex(GetMap()->GetpListItem(i)->GetIndex(),iz,ix); SetCoupling(iz,ix,idtrack,h); } // end for i break; case 2: // case 4: - // x is column and z is row (see AliITSsegmentationSPD::GetPadIxz) for(i=0;iGetEntries();i++) if(GetMap()->GetpListItem(i)==0) continue; else{ - GetMap()->GetMapIndex( - GetMap()->GetpListItem(i)->GetIndex(),iz,ix); + GetMap()->GetMapIndex(GetMap()->GetpListItem(i)->GetIndex(),iz,ix); SetCouplingOld(iz,ix,idtrack,h); } // end for i break; @@ -420,12 +437,12 @@ void AliITSsimulationSPD::HitToSDigitFast(AliITSmodule *mod){ // Return: // none. const Double_t kmictocm = 1.0e-4; // convert microns to cm. - const Int_t n10=10; - const Double_t ti[n10]={7.443716945e-3,2.166976971e-1,3.397047841e-1, + const Int_t kn10=10; + const Double_t kti[kn10]={7.443716945e-3,2.166976971e-1,3.397047841e-1, 4.325316833e-1,4.869532643e-1,5.130467358e-1, 5.674683167e-1,6.602952159e-1,7.833023029e-1, 9.255628306e-1}; - const Double_t wi[n10]={1.477621124e-1,1.346333597e-1,1.095431813e-1, + const Double_t kwi[kn10]={1.477621124e-1,1.346333597e-1,1.095431813e-1, 7.472567455e-2,3.333567215e-2,3.333567215e-2, 7.472567455e-2,1.095431813e-1,1.346333597e-1, 1.477621124e-1}; @@ -451,17 +468,17 @@ void AliITSsimulationSPD::HitToSDigitFast(AliITSmodule *mod){ } // end if GetDebug if(!mod->LineSegmentL(h,x0,x1,y0,y1,z0,z1,de,idtrack)) continue; st = TMath::Sqrt(x1*x1+y1*y1+z1*z1); - if(st>0.0) for(i=0;i0.0) for(i=0;iLocalToDet(x,z,ix,iz))) continue; // outside // el = res->GeVToCharge((Double_t)(dt*de)); - // el = 1./n10*res->GeVToCharge((Double_t)de); - el = wi[i]*res->GeVToCharge((Double_t)de); + // el = 1./kn10*res->GeVToCharge((Double_t)de); + el = kwi[i]*res->GeVToCharge((Double_t)de); if(GetDebug(1)){ - if(el<=0.0) cout<<"el="<GetSignal(iz,ix); - if (TMath::Abs(aSignal)>2147483647.0) { - //PH 2147483647 is the max. integer - //PH This apparently is a problem which needs investigation - AliWarning(Form("Too big or too small signal value %f",aSignal)); - aSignal = TMath::Sign((Double_t)2147483647,aSignal); - } - dig.SetSignalSPD((Int_t)aSignal); - for(j=0;jGetSignal(iz,ix)); + Double_t aSignal = GetMap()->GetSignal(iz,ix); + if (TMath::Abs(aSignal)>2147483647.0) { + //PH 2147483647 is the max. integer + //PH This apparently is a problem which needs investigation + AliWarning(Form("Too big or too small signal value %f",aSignal)); + aSignal = TMath::Sign((Double_t)2147483647,aSignal); + } + dig.SetSignalSPD((Int_t)aSignal); + + for(j=0;jGetNEntries()) { dig.SetTrack(j,GetMap()->GetTrack(iz,ix,j)); dig.SetHit(j,GetMap()->GetHit(iz,ix,j)); @@ -799,7 +824,7 @@ void AliITSsimulationSPD::ResetHistograms(){ } //______________________________________________________________________ -void AliITSsimulationSPD::SetCoupling(Int_t row, Int_t col, Int_t ntrack, +void AliITSsimulationSPD::SetCoupling(Int_t col, Int_t row, Int_t ntrack, Int_t idhit) { // Take into account the coupling between adiacent pixels. // The parameters probcol and probrow are the probability of the @@ -819,8 +844,8 @@ void AliITSsimulationSPD::SetCoupling(Int_t row, Int_t col, Int_t ntrack, */ //End_Html // Inputs: - // Int_t row z cell index - // Int_t col x cell index + // Int_t col z cell index + // Int_t row x cell index // Int_t ntrack track incex number // Int_t idhit hit index number // Outputs: @@ -833,39 +858,35 @@ void AliITSsimulationSPD::SetCoupling(Int_t row, Int_t col, Int_t ntrack, Double_t xr=0.; GetCouplings(couplC,couplR); - if(GetDebug(3)) Info("SetCoupling","(row=%d,col=%d,ntrack=%d,idhit=%d) " - "Calling SetCoupling couplR=%e couplC=%e", - row,col,ntrack,idhit,couplR,couplC); - j1 = row; - j2 = col; - pulse1 = GetMap()->GetSignalOnly(row,col); + if(GetDebug(3)) Info("SetCoupling","(col=%d,row=%d,ntrack=%d,idhit=%d) " + "Calling SetCoupling couplC=%e couplR=%e", + col,row,ntrack,idhit,couplC,couplR); + j1 = col; + j2 = row; + pulse1 = GetMap()->GetSignalOnly(col,row); pulse2 = pulse1; - for (Int_t isign=-1;isign<=1;isign+=2){// loop in row direction + for (Int_t isign=-1;isign<=1;isign+=2){// loop in col direction do{ j1 += isign; - // pulse1 *= couplR; xr = gRandom->Rndm(); - //if ((j1<0)||(j1>GetNPixelsZ()-1)||(pulse1GetNPixelsZ()-1) || (xr>couplR)){ - j1 = row; + if ((j1<0) || (j1>GetNPixelsZ()-1) || (xr>couplC)){ + j1 = col; flag = 1; }else{ - UpdateMapSignal(col,j1,ntrack,idhit,pulse1); + UpdateMapSignal(row,j1,ntrack,idhit,pulse1); // flag = 0; flag = 1; // only first next!! } // end if } while(flag == 0); - // loop in column direction + // loop in row direction do{ j2 += isign; - // pulse2 *= couplC; xr = gRandom->Rndm(); - //if((j2<0)||j2>(GetNPixelsX()-1)||pulse2GetNPixelsX()-1) || (xr>couplC)){ - j2 = col; + if ((j2<0) || (j2>GetNPixelsX()-1) || (xr>couplR)){ + j2 = row; flag = 1; }else{ - UpdateMapSignal(j2,row,ntrack,idhit,pulse2); + UpdateMapSignal(j2,col,ntrack,idhit,pulse2); // flag = 0; flag = 1; // only first next!! } // end if @@ -873,7 +894,7 @@ void AliITSsimulationSPD::SetCoupling(Int_t row, Int_t col, Int_t ntrack, } // for isign } //______________________________________________________________________ -void AliITSsimulationSPD::SetCouplingOld(Int_t row, Int_t col, +void AliITSsimulationSPD::SetCouplingOld(Int_t col, Int_t row, Int_t ntrack,Int_t idhit) { // Take into account the coupling between adiacent pixels. // The parameters probcol and probrow are the fractions of the @@ -891,8 +912,8 @@ void AliITSsimulationSPD::SetCouplingOld(Int_t row, Int_t col, */ //End_Html // Inputs: - // Int_t row z cell index - // Int_t col x cell index + // Int_t col z cell index + // Int_t row x cell index // Int_t ntrack track incex number // Int_t idhit hit index number // Int_t module module number @@ -911,37 +932,37 @@ void AliITSsimulationSPD::SetCouplingOld(Int_t row, Int_t col, // cout << "Couplings --> " << couplC << " " << couplR << endl; //dom - if(GetDebug(3)) Info("SetCouplingOld","(row=%d,col=%d,ntrack=%d,idhit=%d) " - "Calling SetCoupling couplR=%e couplC=%e", - row,col,ntrack,idhit,couplR,couplC); - for (Int_t isign=-1;isign<=1;isign+=2){// loop in row direction - pulse1 = GetMap()->GetSignalOnly(row,col); + if(GetDebug(3)) Info("SetCouplingOld","(col=%d,row=%d,ntrack=%d,idhit=%d) " + "Calling SetCoupling couplC=%e couplR=%e", + col,row,ntrack,idhit,couplC,couplR); + for (Int_t isign=-1;isign<=1;isign+=2){// loop in col direction + pulse1 = GetMap()->GetSignalOnly(col,row); pulse2 = pulse1; - j1 = row; - j2 = col; + j1 = col; + j2 = row; do{ j1 += isign; - pulse1 *= couplR; + pulse1 *= couplC; if ((j1<0)||(j1>GetNPixelsZ()-1)||(pulse1GetSignalOnly(row,col); - j1 = row; + pulse1 = GetMap()->GetSignalOnly(col,row); + j1 = col; flag = 1; }else{ - UpdateMapSignal(col,j1,ntrack,idhit,pulse1); + UpdateMapSignal(row,j1,ntrack,idhit,pulse1); // flag = 0; flag = 1; // only first next !! } // end if } while(flag == 0); - // loop in column direction + // loop in row direction do{ j2 += isign; - pulse2 *= couplC; + pulse2 *= couplR; if((j2<0)||(j2>(GetNPixelsX()-1))||(pulse2GetSignalOnly(row,col); - j2 = col; + pulse2 = GetMap()->GetSignalOnly(col,row); + j2 = row; flag = 1; }else{ - UpdateMapSignal(j2,row,ntrack,idhit,pulse2); + UpdateMapSignal(j2,col,ntrack,idhit,pulse2); // flag = 0; flag = 1; // only first next!! } // end if