* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.14 2001/11/23 13:04:07 barbera
-Some protection added in case of high multiplicity
-
-Revision 1.13 2001/11/13 11:13:24 barbera
-A protection against tracks with the same entrance and exit has been made more strict
+/* $Id$ */
-Revision 1.12 2001/10/04 22:44:31 nilsen
-Major changes in supppor of PreDigits (SDigits). Changes made with will make
-it easier to suppor expected changes in AliITSHit class. Added use of new
-class AliITSpList. Both SPD and SDD have added effects of Dead Channels. Both
-of these will require addtional work as data bases of detectors and the like
-are developed.
-
-*/
-#include <iostream.h>
+#include <Riostream.h>
#include <TRandom.h>
#include <TH1.h>
#include <TMath.h>
#include "AliITSsegmentationSPD.h"
#include "AliITSresponseSPD.h"
+//#define DEBUG
ClassImp(AliITSsimulationSPD)
////////////////////////////////////////////////////////////////////////
} // end if
}
//______________________________________________________________________
-AliITSsimulationSPD::AliITSsimulationSPD(const AliITSsimulationSPD &source){
+AliITSsimulationSPD::AliITSsimulationSPD(const AliITSsimulationSPD &source) :
+ AliITSsimulation(source){
// Copy Constructor
if(&source == this) return;
Int_t *fcolpixel = new Int_t[number];
Double_t *fenepixel = new Double_t[number];
+ dummy0 = dummy1; // remove unsued variable warning.
fModule = mod->GetIndex();
// Array of pointers to store the track index of the digits
Int_t *fcolpixel = new Int_t[number];
Double_t *fenepixel = new Double_t[number];
+ dummy0 = dummy1; // remove unsued variable warning.
// Array of pointers to store the track index of the digits
// leave +1, otherwise pList crashes when col=256, row=192
fModule = mod->GetIndex();
//______________________________________________________________________
void AliITSsimulationSPD::SDigitsToDigits(Int_t module,AliITSpList *pList) {
// sum digits to Digits.
-// cout << "Entering AliITSsimulatinSPD::SDigitsToDigits for module=";
-// cout << module << endl;
+
+#ifdef DEBUG
+ cout << "Entering AliITSsimulatinSPD::SDigitsToDigits for module=";
+ cout << module << endl;
+#endif
fModule = module;
// noise setting
<pre>
*/
//End_Html
- Float_t xa,za,xb,zb,dx,dz,dtot,dm,refr,refm,refc;
+ //Float_t dm;
+ Float_t xa,za,xb,zb,dx,dz,dtot,refr,refm,refc;
Float_t refn=0.;
Float_t arefm, arefr, arefn, arefc, azb, az2l, axb, ax2l;
Int_t dirx,dirz,rb,cb;
npixel = 0;
xa = x1l;
za = z1l;
- dx = TMath::Abs(x1l-x2l);
- if (dx == 0.) dx = 0.01;
- dz = TMath::Abs(z1l-z2l);
- if (dz == 0.) dz = 0.01;
+// dx = x1l-x2l;
+// dz = z1l-z2l;
+ dx = x2l-x1l;
+ dz = z2l-z1l;
dtot = TMath::Sqrt((dx*dx)+(dz*dz));
- dm = (x2l - x1l) / (z2l - z1l);
- if (dm == 0.) dm = 0.01;
- dirx = (Int_t) ((x2l - x1l) / dx);
- dirz = (Int_t) ((z2l - z1l) / dz);
+ if (dtot==0.0) dtot = 0.01;
+ dirx = (Int_t) TMath::Sign((Float_t)1,dx);
+ dirz = (Int_t) TMath::Sign((Float_t)1,dz);
// calculate the x coordinate of the pixel in the next column
// and the z coordinate of the pixel in the next row
do{
// calculate the x coordinate of the intersection with the pixel
// in the next cell in row direction
- refm = (refn - z1l)*dm + x1l;
+ if(dz!=0)
+ refm = dx*((refn - z1l)/dz) + x1l;
+ else
+ refm = refr+dirx*xsize;
// calculate the z coordinate of the intersection with the pixel
// in the next cell in column direction
- refc = (refr - x1l)/dm + z1l;
+ if (dx!=0)
+ refc = dz*((refr - x1l)/dx) + z1l;
+ else
+ refc = refn+dirz*zsize;
arefm = refm * dirx;
arefr = refr * dirx;
Int_t idhit,Int_t module,
AliITSpList *pList) {
// Take into account the coupling between adiacent pixels.
+ // The parameters probcol and probrow are the probability of the
+ // signal in one pixel shared in the two adjacent pixels along
+ // the column and row direction, respectively.
+ //
+ //Begin_Html
+ /*
+ <img src="picts/ITS/barimodel_3.gif">
+ </pre>
+ <br clear=left>
+ <font size=+2 color=red>
+ <a href="mailto:tiziano.virgili@cern.ch"></a>.
+ </font>
+ <pre>
+ */
+ //End_Html
+ Int_t j1,j2,flag=0;
+ Double_t pulse1,pulse2;
+ Float_t couplR=0.0,couplC=0.0;
+ Double_t xr=0.;
+
+ GetCouplings(couplR,couplC);
+ j1 = row;
+ j2 = col;
+ pulse1 = fMapA2->GetSignal(row,col);
+ pulse2 = pulse1;
+ for (Int_t isign=-1;isign<=1;isign+=2){// loop in row direction
+ do{
+ j1 += isign;
+ // pulse1 *= couplR;
+ xr = gRandom->Rndm();
+ // if ((j1<0) || (j1>GetNPixelsZ()-1) || (pulse1<GetThreshold())){
+ if ((j1<0) || (j1>GetNPixelsZ()-1) || (xr>couplR)){
+ j1 = row;
+ flag = 1;
+ }else{
+ UpdateMapSignal(j1,col,ntrack,idhit,module,pulse1,pList);
+ // flag = 0;
+ flag = 1; // only first next!!
+ } // end if
+ } while(flag == 0);
+ // loop in column direction
+ do{
+ j2 += isign;
+ // pulse2 *= couplC;
+ xr = gRandom->Rndm();
+ // if ((j2<0) || (j2>(GetNPixelsX()-1)) || (pulse2<GetThreshold())){
+ if ((j2<0) || (j2>GetNPixelsX()-1) || (xr>couplC)){
+ j2 = col;
+ flag = 1;
+ }else{
+ UpdateMapSignal(row,j2,ntrack,idhit,module,pulse2,pList);
+ // flag = 0;
+ flag = 1; // only first next!!
+ } // end if
+ } while(flag == 0);
+ } // for isign
+}
+//______________________________________________________________________
+void AliITSsimulationSPD::SetCouplingOld(Int_t row, Int_t col, Int_t ntrack,
+ Int_t idhit,Int_t module,
+ AliITSpList *pList) {
+ // Take into account the coupling between adiacent pixels.
// The parameters probcol and probrow are the fractions of the
// signal in one pixel shared in the two adjacent pixels along
// the column and row direction, respectively.
static AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
- Int_t digits[3];
- Int_t tracks[3];
- Int_t hits[3];
- Float_t charges[3];
+ Int_t size = AliITSdigitSPD::GetNTracks();
+ Int_t * digits = new Int_t[size];
+ Int_t * tracks = new Int_t[size];
+ Int_t * hits = new Int_t[size];
+ Float_t * charges = new Float_t[size];
Int_t j1;
+ module=0; // remove unused variable warning.
+ for(j1=0;j1<size;j1++){tracks[j1]=-3;hits[j1]=-1;charges[j1]=0.0;}
for (Int_t r=1;r<=GetNPixelsZ();r++) {
for (Int_t c=1;c<=GetNPixelsX();c++) {
// check if the deposited energy in a pixel is above the
//digits[2] = 1;
digits[2] = (Int_t) signal; // the signal is stored in
// electrons
- for(j1=0;j1<3;j1++){
- tracks[j1] = pList->GetTrack(r,c,j1);
- hits[j1] = pList->GetHit(r,c,j1);
- charges[j1] = 0;
+ for(j1=0;j1<size;j1++){
+ if(j1<pList->GetNEnteries()){
+ tracks[j1] = pList->GetTrack(r,c,j1);
+ hits[j1] = pList->GetHit(r,c,j1);
+ //}else{
+ //tracks[j1] = -3;
+ //hits[j1] = -1;
+ } // end if
+ //charges[j1] = 0;
} // end for j1
Float_t phys = 0;
aliITS->AddSimDigit(0,phys,digits,tracks,hits,charges);
-// cout << " CreateSPDDigit mod=" << fModule << " r,c=" << r;
-// cout <<","<<c<< " sig=" << fpList->GetSignalOnly(r,c);
-// cout << " noise=" << fpList->GetNoise(r,c);
-// cout << " Msig="<< signal << " Thres=" << GetThreshold()<<endl;
+#ifdef DEBUG
+ cout << " CreateSPDDigit mod=" << fModule << " r,c=" << r;
+ cout <<","<<c<< " sig=" << fpList->GetSignalOnly(r,c);
+ cout << " noise=" << fpList->GetNoise(r,c);
+ cout << " Msig="<< signal << " Thres=" << GetThreshold()<<endl;
+#endif
} // end if of threshold condition
} // for c
}// end do on pixels
+ delete [] digits;
+ delete [] tracks;
+ delete [] hits;
+ delete [] charges;
+
}
//______________________________________________________________________
void AliITSsimulationSPD::SetFluctuations(AliITSpList *pList,Int_t module) {
for(i=0;i<ni;i++)for(j=0;j<nj;j++){
if(pList->GetSignalOnly(i,j)>0.0){
aliITS->AddSumDigit(*(pList->GetpListItem(i,j)));
-// cout << "pListSPD: " << *(pList->GetpListItem(i,j)) << endl;
-// cout << " CreateSPDSDigit mod=" << fModule << " r,c=";
-// cout << i <<","<< j << " sig=" << fpList->GetSignalOnly(i,j);
-// cout << " noise=" << fpList->GetNoise(i,j) <<endl;
+#ifdef DEBUG
+ cout << "pListSPD: " << *(pList->GetpListItem(i,j)) << endl;
+ cout << " CreateSPDSDigit mod=" << fModule << " r,c=";
+ cout << i <<","<< j << " sig=" << fpList->GetSignalOnly(i,j);
+ cout << " noise=" << fpList->GetNoise(i,j) <<endl;
+#endif
} // end if
} // end for i,j
return;