New version compatible with the current HEAD
authorbarbera <barbera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 May 2001 16:57:18 +0000 (16:57 +0000)
committerbarbera <barbera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 May 2001 16:57:18 +0000 (16:57 +0000)
ITS/AliITSClusterFinderSPDbari.cxx
ITS/AliITSClusterFinderSPDbari.h
ITS/AliITSFindClustersBari.C
ITS/AliITSsimulationSPDbari.cxx
ITS/AliITSsimulationSPDbari.h
ITS/ITSDigitsToClustersBari.C
ITS/ITSHitsToDigitsBari.C

index c7cd04d3b9f7db095a24ce76db0e49539bb313f7..efbb5d79910321503630d39989d716da5a1a449b 100644 (file)
@@ -84,15 +84,16 @@ void AliITSClusterFinderSPDbari::FindRawClusters(){
    
     // input of Cluster Finder  
     Int_t digitcount=0;
-    Int_t numberd=10000;
+    Int_t numberd=100000;
     Int_t   *digx       = new Int_t[numberd];
     Int_t   *digz       = new Int_t[numberd];
     Int_t   *digtr1     = new Int_t[numberd];
     Int_t   *digtr2     = new Int_t[numberd];
     Int_t   *digtr3     = new Int_t[numberd];
+    Int_t   *digtr4     = new Int_t[numberd];
     
     //  output of Cluster Finder    
-    Int_t numberc=1000;
+    Int_t numberc=10000;
     Float_t *xcenterl   = new Float_t[numberc];
     Float_t *zcenterl   = new Float_t[numberc];
     Float_t *errxcenter = new Float_t[numberc];
@@ -122,37 +123,39 @@ void AliITSClusterFinderSPDbari::FindRawClusters(){
          digtr1[digitcount] = dig1->fTracks[0];
          digtr2[digitcount] = dig1->fTracks[1];
          digtr3[digitcount] = dig1->fTracks[2];
+         digtr4[digitcount] = dig1->fSignal;
 
          digitcount++;
     }
 
 
-        ClusterFinder(digitcount,digx,digz,digtr1,digtr2,digtr3,
+    ClusterFinder(digitcount,digx,digz,digtr1,digtr2,digtr3,digtr4,
               nclus,xcenterl,zcenterl,errxcenter,errzcenter,
               tr1clus, tr2clus, tr3clus);
  
-        DigitToPoint(nclus,xcenterl,zcenterl,errxcenter,errzcenter,
+    DigitToPoint(nclus,xcenterl,zcenterl,errxcenter,errzcenter,
               tr1clus, tr2clus, tr3clus);
 
 
-  delete[] digx       ;
-  delete[] digz       ;
-  delete[] digtr1     ;
-  delete[] digtr2     ;
-  delete[] digtr3     ;
-  delete[] xcenterl   ;
-  delete[] zcenterl   ;
-  delete[] errxcenter ;
-  delete[] errzcenter ;
-  delete[] tr1clus    ;
-  delete[] tr2clus    ;
-  delete[] tr3clus    ;
-  
+    delete[] digx       ;
+    delete[] digz       ;
+    delete[] digtr1     ;
+    delete[] digtr2     ;
+    delete[] digtr3     ;
+    delete[] digtr4     ;
+    delete[] xcenterl   ;
+    delete[] zcenterl   ;
+    delete[] errxcenter ;
+    delete[] errzcenter ;
+    delete[] tr1clus    ;
+    delete[] tr2clus    ;
+    delete[] tr3clus    ;
+
 }
 //-----------------------------------------------------------------
 void AliITSClusterFinderSPDbari::ClusterFinder(Int_t ndigits,
                     Int_t digx[],Int_t digz[],
-                    Int_t digtr1[],Int_t digtr2[],Int_t digtr3[],
+                    Int_t digtr1[],Int_t digtr2[],Int_t digtr3[],Int_t digtr4[],
                     Int_t &nclus, Float_t xcenter[],Float_t zcenter[],
                                    Float_t errxcenter[],Float_t errzcenter[],
                     Int_t tr1clus[], Int_t tr2clus[], Int_t tr3clus[]) {
@@ -170,11 +173,14 @@ void AliITSClusterFinderSPDbari::ClusterFinder(Int_t ndigits,
 //
 
   Int_t if1, min, max, nd;
-  Int_t x1, z1, t1, t2, t3;
+  Int_t x1, z1, t1, t2, t3, t4;
   Int_t ndx, ndz, ndxmin, ndxmax, ndzmin, ndzmax;
   Float_t dx, dz; 
   Int_t i,k,ipos=0;
   Float_t xdum, zdum;      
+  Int_t kmax, sigmax;
+  Float_t deltax, deltaz;
+  Float_t ndig;
 
   Int_t numberd=10000;
   Int_t *ifpad = new Int_t[numberd];
@@ -183,31 +189,29 @@ void AliITSClusterFinderSPDbari::ClusterFinder(Int_t ndigits,
   Int_t *tr1pad  = new Int_t[numberd];
   Int_t *tr2pad  = new Int_t[numberd];
   Int_t *tr3pad  = new Int_t[numberd];
+  Int_t *tr4pad  = new Int_t[numberd];
   Int_t *iclus   = new Int_t[numberd];
 
   nclus=1;
-  for (i=0; i < ndigits ; i++) ifpad[i] = -1;
+  for (i=0; i < ndigits ; i++){
+    ifpad[i] = -1;
+    iclus[i] = 0;
+  }
 
   ifpad[0]=0;
-  for (i=0; i < ndigits-1 ; i++) 
-  {
-    if ( ifpad[i] == -1 ) 
-    { 
+  for (i=0; i < ndigits-1 ; i++) {
+    if ( ifpad[i] == -1 ) { 
                nclus++;
                ipos++;
        ifpad[i]=nclus-1;
     }
-    for (Int_t j=i+1 ; j < ndigits ; j++)  
-    {  
-      if (ifpad[j]== -1 )
-      {
+    for (Int_t j=i+1 ; j < ndigits ; j++)  {  
+      if (ifpad[j]== -1 ) {
             dx = TMath::Abs(digx[i]-digx[j]);
             dz = TMath::Abs(digz[i]-digz[j]);
 
-//          if ( ( dx+dz )==1 )  //  clusters are not diagonal
-            if ( ( dx+dz )==1 || (dx==1 && dz==1) )  //  diagonal clusters allowed
-            {
+//          if ( ( dx+dz )==1 )  //clusters are not diagonal
+            if ( ( dx+dz )==1 || (dx==1 && dz==1) ) { //diagonal clusters allowed
                    ipos++;
                    ifpad[j]=ifpad[i];
 
@@ -221,12 +225,15 @@ void AliITSClusterFinderSPDbari::ClusterFinder(Int_t ndigits,
                    t1=digtr1[j];
                    t2=digtr2[j];
                    t3=digtr3[j];
+                   t4=digtr4[j];
                    digtr1[j]=digtr1[ipos];
                    digtr2[j]=digtr2[ipos];
                    digtr3[j]=digtr3[ipos];
+                   digtr4[j]=digtr4[ipos];
                    digtr1[ipos]=t1;
                    digtr2[ipos]=t2;
                    digtr3[ipos]=t3;
+                   digtr4[ipos]=t4;
 
                    if1=ifpad[j];
                    ifpad[j]=ifpad[ipos];
@@ -234,28 +241,28 @@ void AliITSClusterFinderSPDbari::ClusterFinder(Int_t ndigits,
             }
       }
     }
-   }   
-   if ( ifpad[ndigits-1] == -1 )
-   {
+  }//end loop on digits   
+
+  if ( ifpad[ndigits-1] == -1 ) {
          nclus++;
          ifpad[ndigits-1]=nclus-1;
-   }
-   for (i=0 ; i < ndigits ; i++) iclus[ifpad[i]]++;
+  }
 
-   min=0;
-   max=0;
+  for (i=0 ; i < ndigits ; i++) iclus[ifpad[i]]++;
 
-   // loop on found clusters 
-
-   for (i=0 ; i < nclus ; i++)  
-   {
-      min = max;
-      max += iclus[i];
-      Float_t deltax = fSegmentation->Dpx(0);
-      if (iclus[i]!=1) 
-      {
+  min=0;
+  max=0;
+  // loop on found clusters 
+  for (i=0 ; i < nclus ; i++)  
+  {
+     min = max;
+     max += iclus[i];
+     deltax = fSegmentation->Dpx(0);
+     if (iclus[i]!=1) 
+     {
         //cluster with more than one digit
         nd=iclus[i];
+        ndig=(Float_t) nd;
            Int_t count=0;
         for (k=min;k<min+nd;k++)
         {
@@ -265,6 +272,7 @@ void AliITSClusterFinderSPDbari::ClusterFinder(Int_t ndigits,
               tr1pad[count] = digtr1[k];          
               tr2pad[count] = digtr2[k];          
               tr3pad[count] = digtr3[k];          
+              tr4pad[count] = digtr4[k];          
 
               count++; 
         }
@@ -275,31 +283,31 @@ void AliITSClusterFinderSPDbari::ClusterFinder(Int_t ndigits,
         ndx = ndxmax - ndxmin+1;
         ndz = ndzmax - ndzmin+1;
 
+
         // calculate x and z coordinates of the center of the cluster
         fSegmentation->GetPadCxz(digx[min],digz[min]-1,xdum, zdum);
 
-
-       if (ndx == 1) {     
-           xcenter[i] = xdum;
-       }    
-       else{ 
-           xcenter[i] = 0.;
-          for (k=0;k<nd;k++) {
-             fSegmentation->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
-            xcenter[i] += (xdum / nd);
-          }                   
-       }
-
-       if (ndz == 1) {
-           zcenter[i] = zdum;
-       }   
-       else {
-          zcenter[i] = 0.;
-          for (k=0;k<nd;k++) {       
-             fSegmentation->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
-            zcenter[i] += (zdum / nd);
-          }
-       }
+           if (ndx == 1) {         
+                xcenter[i] = xdum;
+           }    
+           else{ 
+             xcenter[i] = 0.;
+                for (k=0;k<nd;k++) {
+                fSegmentation->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
+                   xcenter[i] += (xdum / nd);
+                }                     
+           }
+
+           if (ndz == 1) {
+                zcenter[i] = zdum;
+           }   
+           else {
+                zcenter[i] = 0.;
+                for (k=0;k<nd;k++) {         
+               fSegmentation->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
+                  zcenter[i] += (zdum / nd);
+                }
+           }
 
         // error on points in x and z directions
 
@@ -312,36 +320,47 @@ void AliITSClusterFinderSPDbari::ClusterFinder(Int_t ndigits,
                fSegmentation->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
                errxcenter[i] += ((xdum-xcenter[i])*(xdum-xcenter[i]))/(nd*(nd-1)); 
              }   
-            errxcenter[i] = TMath::Sqrt(errxcenter[i]);
+                errxcenter[i] = TMath::Sqrt(errxcenter[i]);
         }
        
-       if (ndz == 1) {
-            Float_t deltaz = fSegmentation->Dpz(digz[min]);                  
-           errzcenter[i] = deltaz / TMath::Sqrt(12.);
+           if (ndz == 1) {
+            deltaz = fSegmentation->Dpz(digz[min]);                  
+               errzcenter[i] = deltaz / TMath::Sqrt(12.);
         }
-       else {
-            errzcenter[i] = 0.;
-            for (k=0;k<nd;k++){ 
+           else {
+               errzcenter[i] = 0.;
+               for (k=0;k<nd;k++){ 
                fSegmentation->GetPadCxz(xpad[k],zpad[k]-1,xdum,zdum);
-              errzcenter[i] += ((zdum-zcenter[i])*(zdum-zcenter[i]))/(nd*(nd-1));
-            }
-            errzcenter[i] = TMath::Sqrt(errzcenter[i]);
-       }    
-
+                  errzcenter[i] += ((zdum-zcenter[i])*(zdum-zcenter[i]))/(nd*(nd-1));
+               }
+               errzcenter[i] = TMath::Sqrt(errzcenter[i]);
+           }    
         // take three track numbers for the cluster
+        // choose the track numbers of the digit with higher signal 
+        kmax = 0;
+        sigmax = 0;
         for (k=0;k<nd;k++){
-          if(tr1pad[k] != -2) tr1clus[i]=tr1pad[k];
-          if(tr2pad[k] != -2) tr2clus[i]=tr2pad[k];
-          if(tr3pad[k] != -2) tr3clus[i]=tr3pad[k];
+          if(tr4pad[k] > sigmax){
+            sigmax = tr4pad[k];
+            kmax   = k;
+          }
         }
-        if(tr1clus[i] == 0) tr1clus[i]= -2;
-        if(tr2clus[i] == 0) tr2clus[i]= -2;
-        if(tr3clus[i] == 0) tr3clus[i]= -2;
-      }
-      else  {
+        if(sigmax != 0) {
+            tr1clus[i]= tr1pad[kmax];
+            tr2clus[i]= tr2pad[kmax];
+            tr3clus[i]= tr3pad[kmax];
+         }
+         else {
+            tr1clus[i]= -2;
+            tr2clus[i]= -2;
+            tr3clus[i]= -2;
+        }
+     }
+     else  {
       
         // cluster with single digit
-       ndx = 1;
+        ndig= 1.;
+           ndx = 1;
         ndz = 1;
         fSegmentation->GetPadCxz(digx[min],digz[min]-1,xdum,zdum);
         xcenter[i] = xdum;
@@ -349,7 +368,7 @@ void AliITSClusterFinderSPDbari::ClusterFinder(Int_t ndigits,
         tr1clus[i]=digtr1[min];
         tr2clus[i]=digtr2[min];
         tr3clus[i]=digtr3[min];
-           Float_t deltaz = fSegmentation->Dpz(digz[min]);
+           deltaz = fSegmentation->Dpz(digz[min]);
            errxcenter[i] = deltax / TMath::Sqrt(12.);
            errzcenter[i] = deltaz / TMath::Sqrt(12.);
      }
@@ -362,17 +381,19 @@ void AliITSClusterFinderSPDbari::ClusterFinder(Int_t ndigits,
      xcenter[i] = xcenter[i] - fSegmentation->Dx()/2.; 
      zcenter[i] = zcenter[i] - fSegmentation->Dz()/2.;
 
-     AliITSRawClusterSPD *clust = new AliITSRawClusterSPD(zcenter[i],xcenter[i],1.,ndz,ndx,0.,0.,0.,0.,0.,0.,0.);
+
+     AliITSRawClusterSPD *clust = new AliITSRawClusterSPD(zcenter[i],xcenter[i],ndig,ndz,ndx,0.,0.,0.,0.,0.,0.,0.);
      iTS->AddCluster(0,clust);
      delete clust;
-   }     
-   delete[] ifpad;
-   delete[] xpad ;
-   delete[] zpad ;
-   delete[] iclus;
-   delete [] tr1pad;
-   delete [] tr2pad;
-   delete [] tr3pad;
+  }//end loop on clusters   
+  delete[] ifpad;
+  delete[] xpad ;
+  delete[] zpad ;
+  delete[] iclus;
+  delete[] tr1pad;
+  delete[] tr2pad;
+  delete[] tr3pad;
+  delete[] tr4pad;
 }
 //______________________________________________________
 void AliITSClusterFinderSPDbari::DigitToPoint(Int_t nclus,
@@ -414,7 +435,4 @@ void AliITSClusterFinderSPDbari::DigitToPoint(Int_t nclus,
         rnew.fTracks[2]=tr3clus[i];
         iTS->AddRecPoint(rnew); 
      }
-
-
-
 }
index 33379023b331a7f4aed8b7ce0e81b911317cfb98..99929437b4d1bd0d9b4759cc570518e2f12a1345 100644 (file)
@@ -40,7 +40,7 @@ public:
                   Float_t *errxcenter,Float_t *errzcenter,
                  Int_t *tr1clus, Int_t *tr2clus, Int_t *tr3clus);
   void  ClusterFinder(Int_t ndigits,Int_t digx[],Int_t digz[],
-                     Int_t digtr1[],Int_t digtr2[],Int_t digtr3[],
+                     Int_t digtr1[],Int_t digtr2[],Int_t digtr3[],Int_t digtr4[],
                      Int_t &nclus,
                      Float_t xcenter[],Float_t zcenter[],
                      Float_t errxcenter[],Float_t errzcenter[],  
index 76d56707084d31abc35d63f9076bda8793c36037..7bbd301b8bf6d6daa53cc0e08bda6c85bb01e428 100644 (file)
@@ -23,6 +23,7 @@ Int_t AliITSFindClustersBari() {
    Int_t ver = ITS->IsVersion(); 
    cerr<<"ITS version "<<ver<<" has been found !\n";
 
+    ITS->MakeTreeC();
 // Set the models for cluster finding
    AliITSgeom *geom = ITS->GetITSgeom();
 
@@ -39,25 +40,21 @@ Int_t AliITSFindClustersBari() {
 
 
    // SDD
-   Float_t baseline = 10.;
-   Float_t noise = 1.67;
-   Float_t thres = baseline+3.*noise;
-
    AliITSDetType *iDetType=ITS->DetType(1);
    AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
    if (!seg1) seg1 = new AliITSsegmentationSDD(geom);
    AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
    if (!res1) res1=new AliITSresponseSDD();
-   res1->SetMagicValue(900.);
-   Float_t magic = res1->MagicValue();
-   Float_t top = res1->MaxAdc();
-   thres *= top/magic;
-   res1->SetNoiseParam(noise,baseline);
+   Float_t baseline,noise;
+   res1->GetNoiseParam(noise,baseline);
+   Float_t noise_after_el = res1->GetNoiseAfterElectronics();
+   Float_t thres = baseline;
+   thres += (4.*noise_after_el);  // TB // (4.*noise_after_el);
+   printf("thres %f\n",thres);
+   res1->Print();
    TClonesArray *dig1  = ITS->DigitsAddress(1);
    TClonesArray *recp1  = ITS->ClustersAddress(1);
    AliITSClusterFinderSDD *rec1=new AliITSClusterFinderSDD(seg1,res1,dig1,recp1);
-   rec1->SetMinNCells(6);
-   rec1->SetTimeCorr(70.);
    rec1->SetCutAmplitude((int)thres);
    ITS->SetReconstructionModel(1,rec1);
 
@@ -66,8 +63,7 @@ Int_t AliITSFindClustersBari() {
    AliITSDetType *iDetType=ITS->DetType(2);
    AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
    TClonesArray *dig2  = ITS->DigitsAddress(2);
-   TClonesArray *recp2  = ITS->ClustersAddress(2);
-   AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2,recp2);
+   AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2);
    ITS->SetReconstructionModel(2,rec2);
    // test
    printf("SSD dimensions %f %f \n",seg2->Dx(),seg2->Dz());
@@ -75,6 +71,9 @@ Int_t AliITSFindClustersBari() {
 
 
 
+   if(!gAlice->TreeR()) gAlice->MakeTree("R");
+   //make branch
+   ITS->MakeBranch("R");
 
    TStopwatch timer;
 
@@ -83,7 +82,7 @@ Int_t AliITSFindClustersBari() {
       cerr<<"Looking for clusters...\n";
       {
        timer.Start();
-       ITS->DigitsToRecPoints(0,1,"All");
+       ITS->DigitsToRecPoints(0,0,"All");
       }
       break;
    default:
index 71517c434b84b53a400216b14ed5ead2bef33552..e102b777620ddcb9a9ef67deead7ec5db0963dcc 100644 (file)
@@ -130,16 +130,14 @@ void AliITSsimulationSPDbari::DigitiseModule(AliITSmodule *mod, Int_t module,
   SetFluctuations(pList);
 
 
+
   // loop over hits in the module
   Int_t hitpos;
-      for (hitpos=0;hitpos<nhits;hitpos++) {  
+  for (hitpos=0;hitpos<nhits;hitpos++) {  
      HitToDigit(mod,hitpos,module,frowpixel,fcolpixel,fenepixel,pList);
-
-
   }// end loop over digits
 
-     CreateDigit(nhits,module,pList);
+  CreateDigit(nhits,module,pList);
 
   // clean memory
   delete[] frowpixel;
@@ -176,7 +174,7 @@ void AliITSsimulationSPDbari::HitToDigit(AliITSmodule *mod, Int_t hitpos, Int_t
    static Float_t x1l,y1l,z1l;
    Float_t x2l,y2l,z2l,etot;
    Int_t layer,r1,r2,c1,c2,row,col,npixel = 0;
-   Int_t ntrack;
+   Int_t ntrack,idhit;
    Double_t ene;
    const Float_t kconv = 10000.;     // cm -> microns
 
@@ -185,6 +183,14 @@ void AliITSsimulationSPDbari::HitToDigit(AliITSmodule *mod, Int_t hitpos, Int_t
    layer = hit->GetLayer();
    etot=hit->GetIonization();
    ntrack=hit->GetTrack();
+   idhit=mod->GetHitHitIndex(hitpos);     
+
+   /* //debug
+     printf("layer,etot,ntrack,status %d %f %d %d\n",layer,etot,ntrack,hit->GetTrackStatus()); //debug
+    Int_t idtrack; //debug
+    mod->GetHitTrackAndHitIndex(hitpos,idtrack,idhit);     
+    printf("idtrack,idhit %d %d\n",idtrack,idhit); //debug
+    */
 
 
         if (hit->GetTrackStatus()==66) {
@@ -248,9 +254,9 @@ void AliITSsimulationSPDbari::HitToDigit(AliITSmodule *mod, Int_t hitpos, Int_t
                   col = fcolpixel[npix];
                   ene = fenepixel[npix];
                   UpdateMap(row,col,ene);                   
-                  GetList(ntrack,pList,row,col); 
+                  GetList(ntrack,idhit,pList,row,col); 
                   // Starting capacitive coupling effect
-                  SetCoupling(row,col,ntrack,pList); 
+                  SetCoupling(row,col,ntrack,idhit,pList); 
              }
            x1l=x2l;
            y1l=y2l;
@@ -413,7 +419,7 @@ void AliITSsimulationSPDbari::ChargeSharing(Float_t x1l,Float_t z1l,Float_t x2l,
 }
 //___________________________________________________________________________
 void AliITSsimulationSPDbari::SetCoupling(Int_t row, Int_t col, Int_t ntrack,
-                                          Float_t **pList) {
+                                          Int_t idhit, Float_t **pList) {
    //
    //  Take into account the coupling between adiacent pixels.
    //  The parameters probcol and probrow are the fractions of the
@@ -461,7 +467,7 @@ void AliITSsimulationSPDbari::SetCoupling(Int_t row, Int_t col, Int_t ntrack,
          }
           else{                
                   UpdateMap(j1,col,pulse1);                   
-                  GetList(ntrack,pList,j1,col); 
+                  GetList(ntrack,idhit,pList,j1,col); 
            flag = 0;
             }
         
@@ -483,7 +489,7 @@ void AliITSsimulationSPDbari::SetCoupling(Int_t row, Int_t col, Int_t ntrack,
          }
           else{                
                   UpdateMap(row,j2,pulse2);                   
-                  GetList(ntrack,pList,row,j2); 
+                  GetList(ntrack,idhit,pList,row,j2); 
            flag = 0;
             }
         
@@ -510,7 +516,6 @@ void AliITSsimulationSPDbari::CreateDigit(Int_t nhits, Int_t module, Float_t
    Float_t charges[3]; 
    Int_t gi,j1;
    
-
    if (nhits > 0) {
     
      for (Int_t r=1;r<=fNPixelsZ;r++) {
@@ -521,12 +526,20 @@ void AliITSsimulationSPDbari::CreateDigit(Int_t nhits, Int_t module, Float_t
            if ( signal > fThresh) {
                  digits[0] = r-1;  // digits starts from 0
               digits[1] = c-1;  // digits starts from 0
-              digits[2] = 1;  
+              //digits[2] = 1;  
+              signal = signal*1.0e9;  //signal in eV
+              digits[2] =  (Int_t) signal;  // the signal is stored in eV
                  gi =r*fNPixelsX+c; // global index
                  for(j1=0;j1<3;j1++){
                  tracks[j1] = (Int_t)(*(pList[gi]+j1));
+                 hits[j1] = (Int_t)(*(pList[gi]+j1+6));
                  charges[j1] = 0;
               }
+              /* debug
+              printf("digits %d %d %d\n",digits[0],digits[1],digits[2]); //debug
+              printf("tracks %d %d %d\n",tracks[0],tracks[1],tracks[2]); //debug
+              printf("hits %d %d %d\n",hits[0],hits[1],hits[2]); //debug
+              */
               Float_t phys = 0;        
                  aliITS->AddSimDigit(0,phys,digits,tracks,hits,charges);
                  if(pList[gi]) delete [] pList[gi];
@@ -538,7 +551,7 @@ void AliITSsimulationSPDbari::CreateDigit(Int_t nhits, Int_t module, Float_t
 }
 //_____________________________________________________________________________
 
-void AliITSsimulationSPDbari::GetList(Int_t label,Float_t **pList,
+void AliITSsimulationSPDbari::GetList(Int_t label,Int_t idhit, Float_t **pList,
                                       Int_t row, Int_t col) {
   // loop over nonzero digits
 
@@ -557,22 +570,26 @@ void AliITSsimulationSPDbari::GetList(Int_t label,Float_t **pList,
   if(!pList[globalIndex])
   {
      // 
-     // Create new list (6 elements - 3 signals and 3 tracks + total sig)
+     // Create new list (9 elements - 3 signals and 3 tracks + 3 hits)
      //
 
-     pList[globalIndex] = new Float_t [6];
+     pList[globalIndex] = new Float_t [9];
 
 
-     // set list to -2 
-     *(pList[globalIndex]) = -2.;
-     *(pList[globalIndex]+1) = -2.;
-     *(pList[globalIndex]+2) = -2.;
+     // set list to -3 
+     *(pList[globalIndex]) = -3.;
+     *(pList[globalIndex]+1) = -3.;
+     *(pList[globalIndex]+2) = -3.;
      *(pList[globalIndex]+3) =  0.;
      *(pList[globalIndex]+4) =  0.;
      *(pList[globalIndex]+5) =  0.;
+     *(pList[globalIndex]+6) = -1.;
+     *(pList[globalIndex]+7) = -1.;
+     *(pList[globalIndex]+8) = -1.;
 
      *pList[globalIndex] = (float)label;
      *(pList[globalIndex]+3) = signal;
+     *(pList[globalIndex]+6) = (float)idhit;
   }
   else{
 
@@ -593,6 +610,9 @@ void AliITSsimulationSPDbari::GetList(Int_t label,Float_t **pList,
 
       if (signal>highest)
       {
+         *(pList[globalIndex]+8) = *(pList[globalIndex]+7);
+         *(pList[globalIndex]+7) = *(pList[globalIndex]+6);
+         *(pList[globalIndex]+6) = idhit;
          *(pList[globalIndex]+5) = middle;
          *(pList[globalIndex]+4) = highest;
          *(pList[globalIndex]+3) = signal;
@@ -602,6 +622,8 @@ void AliITSsimulationSPDbari::GetList(Int_t label,Float_t **pList,
          }
         else if (signal>middle)
       {
+         *(pList[globalIndex]+8) = *(pList[globalIndex]+7);
+         *(pList[globalIndex]+7) = idhit;
          *(pList[globalIndex]+5) = middle;
          *(pList[globalIndex]+4) = signal;
          *(pList[globalIndex]+2) = *(pList[globalIndex]+1);
@@ -609,6 +631,7 @@ void AliITSsimulationSPDbari::GetList(Int_t label,Float_t **pList,
          }
         else
       {
+         *(pList[globalIndex]+8) = idhit;
          *(pList[globalIndex]+5) = signal;
          *(pList[globalIndex]+2) = label;
          }
@@ -644,16 +667,19 @@ void AliITSsimulationSPDbari::SetFluctuations(Float_t **pList) {
       signal = fSigma*random.Gaus(); 
       fMapA2->SetHit(iz,ix,signal);
 
-      // insert in the label-signal list the pixels fired only by noise
+      // insert in the label-signal-hit list the pixels fired only by noise
       if ( signal > fThresh) {
         Int_t globalIndex = iz*fNPixelsX+ix; 
-        pList[globalIndex] = new Float_t [6];
+        pList[globalIndex] = new Float_t [9];
         *(pList[globalIndex]) = -2.;
         *(pList[globalIndex]+1) = -2.;
         *(pList[globalIndex]+2) = -2.;
         *(pList[globalIndex]+3) =  signal;
         *(pList[globalIndex]+4) =  0.;
         *(pList[globalIndex]+5) =  0.;
+        *(pList[globalIndex]+6) =  -1.;
+        *(pList[globalIndex]+7) =  -1.;
+        *(pList[globalIndex]+8) =  -1.;
       }
     } // end of loop on pixels
   } // end of loop on pixels
index e3371afa61e42a4b6bb9f2d70d4f3f6333bb30c8..d36873a0c0298143fc94bc42351782b7430944f1 100644 (file)
@@ -33,9 +33,9 @@ public:
                                    Int_t &npixel,Int_t *frowpixel,
                                    Int_t *fcolpixel,Double_t *fenepixel);
   
-  void SetCoupling(Int_t row, Int_t col, Int_t ntrack, Float_t **pList);
+  void SetCoupling(Int_t row, Int_t col, Int_t ntrack, Int_t idhit, Float_t **pList);
   void CreateDigit(Int_t nhits, Int_t module, Float_t **pList);
-  void GetList(Int_t track, Float_t **pList, Int_t row, Int_t col);
+  void GetList(Int_t track,Int_t idhit, Float_t **pList, Int_t row, Int_t col);
 
   void CreateHistograms();
   void ResetHistograms();
@@ -62,5 +62,3 @@ private:
 
 #endif 
 
-
-
index be90132885c8ef361ff6c6e30c0f35886c18256a..971358650f8aaed183e2bb1360bba56a164a4778 100644 (file)
@@ -50,13 +50,18 @@ void ITSDigitsToClustersBari (Int_t evNumber1=0,Int_t evNumber2=0)
    // simulation but in cluster finder as well, please set them via your
    // local Config.C - the streamer will take care of writing the correct
    // info and you'll no longer be obliged to set them again for your cluster
-   // finder as it's done in this macro 
+   // finder as it's done in this macro (ugly and impractical, no? )
+
 
 
    // Set the models for cluster finding
 
    // SPD
 
+   ITS->MakeTreeC();
+   Int_t nparticles=gAlice->GetEvent(0);
+
+
    AliITSDetType *iDetType=ITS->DetType(0);
    AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
    TClonesArray *dig0  = ITS->DigitsAddress(0);
@@ -93,12 +98,10 @@ void ITSDigitsToClustersBari (Int_t evNumber1=0,Int_t evNumber2=0)
    ITS->SetReconstructionModel(1,rec1);
    rec1->Print();
 
-
    // SSD
 
    AliITSDetType *iDetType=ITS->DetType(2);
    AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
-   seg2->SetDetSize(72960.,40000.,303.);
    TClonesArray *dig2  = ITS->DigitsAddress(2);
    AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2);
    ITS->SetReconstructionModel(2,rec2);
@@ -107,6 +110,7 @@ void ITSDigitsToClustersBari (Int_t evNumber1=0,Int_t evNumber2=0)
    //printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx());
 
 
+
 //
 // Event Loop
 //
@@ -121,10 +125,10 @@ void ITSDigitsToClustersBari (Int_t evNumber1=0,Int_t evNumber2=0)
 
    for (int nev=evNumber1; nev<= evNumber2; nev++) {
        if(nev>0) {
-        nparticles = gAlice->GetEvent(nev);
-        gAlice->SetEvent(nev);
-        if(!gAlice->TreeR()) gAlice-> MakeTree("R");
-        ITS->MakeBranch("R");
+            nparticles = gAlice->GetEvent(nev);
+            gAlice->SetEvent(nev);
+            if(!gAlice->TreeR()) gAlice-> MakeTree("R");
+            ITS->MakeBranch("R");
        }     
        cout << "nev         " <<nev<<endl;
        cout << "nparticles  " <<nparticles<<endl;
@@ -134,6 +138,7 @@ void ITSDigitsToClustersBari (Int_t evNumber1=0,Int_t evNumber2=0)
        Int_t last_entry=0;
        timer.Start();
        ITS->DigitsToRecPoints(nev,last_entry,"All");
+       //ITS->DigitsToRecPoints(nev,last_entry,"SPD");
        timer.Stop(); timer.Print(); 
    } // event loop 
 
@@ -143,17 +148,3 @@ void ITSDigitsToClustersBari (Int_t evNumber1=0,Int_t evNumber2=0)
 
    file->Close();
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
index 5f5afefe476cb0c54082e263d741f785c01c856a..ee01aed9b86fd3d733bc01ede5ab1897f6575a37 100644 (file)
@@ -49,7 +49,6 @@ void ITSHitsToDigitsBari (Int_t evNumber1=0,Int_t evNumber2=0,Int_t nsignal  =25
 
    // SDD
    // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance
-
                 
    AliITSDetType *iDetType=ITS->DetType(1);
    AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
@@ -58,12 +57,13 @@ void ITSHitsToDigitsBari (Int_t evNumber1=0,Int_t evNumber2=0,Int_t nsignal  =25
          ITS->SetResponseModel(1,res1);
    }
 
+
    //res1->SetChargeLoss(0.);
    Float_t baseline;
    Float_t noise;
    res1->GetNoiseParam(noise,baseline);
    Float_t noise_after_el = res1->GetNoiseAfterElectronics();
-   cout << "noise_after_el: " << noise_after_el << endl; 
+   cout << "noise_after_el: " << noise_after_el << endl;
    Float_t fCutAmp;
    fCutAmp = baseline;
    fCutAmp += (2.*noise_after_el);  // noise
@@ -87,33 +87,42 @@ void ITSHitsToDigitsBari (Int_t evNumber1=0,Int_t evNumber2=0,Int_t nsignal  =25
    AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
    ITS->SetSimulationModel(1,sim1);
    sim1->Print();
-   
-      
+
 
    // SPD
 
    AliITSDetType *iDetType=ITS->DetType(0);
    AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
-   AliITSresponseSPDbari *res0 = (AliITSresponseSPDbari*)iDetType->GetResponseModel();
+   //AliITSresponseSPDbari *res0 = (AliITSresponseSPDbari*)iDetType->GetResponseModel();
+   AliITSresponseSPDbari *res0= new AliITSresponseSPDbari();
+   ITS->SetResponseModel(0,res0);
+
+// to change the  parameters
+   //res0->SetThresholds(7.2e-6, 1.e-6);
+   //res0->SetNoiseParam(0., 0.);
+   //res0->SetNoiseParam(0.04, 0.08);
+
+// to monitor the  parameters
+   Float_t thresh, sigma;
+   res0->Thresholds(thresh, sigma);
+   printf("SPDbari: threshold %e sigma  %e\n",thresh, sigma);
+   Float_t col, row;
+   res0->GetNoiseParam(col, row);
+   printf("SPDbari: Coupling by column %e Coupling by row %e\n",col, row);
+
    AliITSsimulationSPDbari *sim0=new AliITSsimulationSPDbari(seg0,res0);
    ITS->SetSimulationModel(0,sim0);
-   // test
-   //printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
-   //printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
-   //printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
-   // end test
-
 
    // SSD
 
    AliITSDetType *iDetType=ITS->DetType(2);
    AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
-   seg2->SetDetSize(72960.,40000.,303.);
    AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
    res2->SetSigmaSpread(3.,2.);
    AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
    ITS->SetSimulationModel(2,sim2);
 
+
 //
 // Event Loop
 //
@@ -136,10 +145,10 @@ void ITSHitsToDigitsBari (Int_t evNumber1=0,Int_t evNumber2=0,Int_t nsignal  =25
    for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
        cout << "nev         " <<nev<<endl;
        if(nev>0) {
-        nparticles = gAlice->GetEvent(nev);
-        gAlice->SetEvent(nev);
-        if(!gAlice->TreeD()) gAlice-> MakeTree("D");
-        ITS->MakeBranch("D");
+             nparticles = gAlice->GetEvent(nev);
+             gAlice->SetEvent(nev);
+             if(!gAlice->TreeD()) gAlice-> MakeTree("D");
+             ITS->MakeBranch("D");
        }
        cout << "nparticles  " <<nparticles<<endl;
        if (nev < evNumber1) continue;
@@ -149,27 +158,13 @@ void ITSHitsToDigitsBari (Int_t evNumber1=0,Int_t evNumber2=0,Int_t nsignal  =25
        if(nsignal) nbgr_ev=Int_t(nev/nsignal);
        timer.Start();
        ITS->HitsToDigits(nev,nbgr_ev,size," ","All"," ");
+       //ITS->HitsToDigits(nev,nbgr_ev,size," ","SPD"," ");
        timer.Stop(); timer.Print();
    } // event loop 
 
-   delete sim0;
+//   delete sim0;
    delete sim1;
    delete sim2;
 
-
    file->Close();
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-