]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Various improvements and updates from B.S.Nilsen and T. Virgili
authorbarbera <barbera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Oct 2002 18:54:22 +0000 (18:54 +0000)
committerbarbera <barbera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Oct 2002 18:54:22 +0000 (18:54 +0000)
15 files changed:
ITS/AliITSClusterFinder.cxx
ITS/AliITSClusterFinder.h
ITS/AliITSClusterFinderSDD.cxx
ITS/AliITSClusterFinderSPD.cxx
ITS/AliITSDigitizer.cxx
ITS/AliITSMerge.C
ITS/AliITSRecPoint.h
ITS/AliITSclusterSSD.cxx
ITS/AliITSdigit.cxx
ITS/AliITSdigit.h
ITS/AliITSpList.cxx
ITS/AliITSpList.h
ITS/AliITSsegmentationSDD.cxx
ITS/AliITSsimulationSPD.cxx
ITS/AliITSsimulationSPD.h

index 0cf2af6715e0dcf1032e6c05845e95f96cc8439c..0402675cd0d44bbfc75ccbc4b68938b27fa5920c 100644 (file)
@@ -14,6 +14,7 @@
  **************************************************************************/
 
 #include "AliITSClusterFinder.h"
+#include "AliITSdigit.h"
 #include "AliRun.h"
 #include "AliITS.h"
 
@@ -121,3 +122,142 @@ void AliITSClusterFinder::AddCluster(Int_t branch, AliITSRawCluster *c,
     fNRawClusters++;
     iTS->AddRecPoint(rp); 
 }
+//______________________________________________________________________
+void AliITSClusterFinder::FindRawClusters(Int_t module){
+    // Default Cluster finder.
+    // Input:
+    //   Int_t module   Module number for which culster are to be found.
+    // Output:
+    //   none.
+    // Return:
+    //   none.
+    const Int_t kelms = 10;
+    Int_t ndigits = fDigits->GetEntriesFast();
+    TObjArray *digs = new TObjArray(ndigits);
+    TObjArray *clusts = new TObjArray(ndigits); // max # cluster
+    TObjArray *clust0=0; // A spacific cluster of digits
+    TObjArray *clust1=0; // A spacific cluster of digits
+    AliITSdigit *dig=0; // locat pointer to a digit
+    Int_t i=0,nc=0,j[4],k,k2;
+
+    // Copy all digits for this module into a local TObjArray.
+    for(i=0;i<ndigits;i++) digs->AddAt(new AliITSdigit(*((AliITSdigit*)(fDigits->At(i)))),i);
+    digs->Sort();
+    // First digit is a cluster.
+    i  = 0;
+    nc = 0;
+    clusts->AddAt(new TObjArray(kelms),nc);
+    clust0 = (TObjArray*)(clusts->At(nc));
+    clust0->AddAtFree(digs->At(i)); // move owner ship from digs to clusts
+    nc++;
+    for(i=1;i<ndigits;i++){
+       if(IsNeighbor(digs,i,j)){
+           dig = (AliITSdigit*)(digs->At(j[0]));
+           // Add to existing cluster. Find which cluster this digis 
+           for(k=0;k<nc;k++){
+               clust0 = ((TObjArray*)(clusts->At(k)));
+               if(clust0->IndexOf(dig)>=0) break;
+           } // end for k
+           if(k>=nc){
+               Error("FindRawClusters","Digit not found as expected");
+               abort();
+           } // end if
+           if(j[1]>=0){
+               dig = (AliITSdigit*)(digs->At(j[1]));
+               // Add to existing cluster. Find which cluster this digis 
+               for(k2=0;k2<nc;k2++){
+                   clust1 = ((TObjArray*)(clusts->At(k2)));
+                   if(clust1->IndexOf(dig)>=0) break;
+               } // end for k2
+               if(k2>=nc){
+                   Error("FindRawClusters","Digit not found as expected");
+                   abort();
+               } // end if
+           } // end if j[1]>=0
+           // Found cluster with neighboring digits add this one to it.
+           if(clust0==clust1){ // same cluster
+               clust0->AddAtFree(digs->At(i));
+               clust0 = 0; // finished with cluster. zero for safty
+               clust1 = 0; // finished wit hcluster. zero for safty
+           }else{ // two different clusters which need to be merged.
+               clust0->AddAtFree(digs->At(i)); // Add digit to this cluster.
+               for(k=0;k<clust1->GetEntriesFast();k++){
+                   // move clust1 into clust0
+                   clust0->AddAtFree(clust1->At(k));//move digit to this cluster
+                   clust1->AddAt(0,k); // zero this one
+               } // end for k
+               delete clust1;
+               clusts->AddAt(0,k2); // zero array of clusters element clust1
+               clust0 = 0; // finished with cluster. zero for safty
+               clust1 = 0; // finished wit hcluster. zero for safty
+           } // end if clust0==clust1
+       }else{// New cluster
+           clusts->AddAt(new TObjArray(kelms),nc);
+           clust0 = ((TObjArray*)(clusts->At(nc)));
+           clust0->AddAtFree(digs->At(i));// move owner ship from digs to clusts
+           clust0 = 0; // finished with cluster. zero for safty
+           nc++;
+       } // End if IsNeighbor
+    } // end for i
+    // There are now nc clusters in clusts. Each element of clust is an
+    // array of digits which are clustered together.
+
+    // For each cluster call detector specific CreateRecPoints
+    for(i=0;i<nc;i++) CreateRecPoints((TObjArray*)(clusts->At(i)),module);
+
+    // clean up at the end.
+    for(i=0;i<nc;i++){ 
+       clust0 =(TObjArray*)(clusts->At(i));
+       // Digits deleted below, so zero this TObjArray
+       for(k=0;k<clust0->GetEntriesFast();k++) clust0->AddAt(0,k);
+       delete clust0; // Delete this TObjArray
+       clusts->AddAt(0,i); // Contents deleted above, so zero it.
+    } // end for i
+    delete clusts; // Delete this TObjArray/
+    // Delete the digits then the TObjArray which containted them.
+    for(i=0;i<ndigits;i++) delete ((AliITSdigit*)(digs->At(i)));
+    delete digs;
+}
+//______________________________________________________________________
+Bool_t AliITSClusterFinder::IsNeighbor(TObjArray *digs,Int_t i,Int_t n[]){
+    // Locagical function which checks to see if digit i has a neighbor.
+    // If so, then it returns kTRUE and its neighbor index j.
+    // This routine checks if the digits are side by side or one before the
+    // other. Requires that the array of digits be in proper order.
+    // Returns kTRUE in the following cases.
+    //                 ji   0j   if kdiagonal  j0    0i
+    //                 00   0i   if kdiagonal  0i    j0
+    // Inputs:
+    //    TObjArray *digs   Array to search for neighbors in
+    //    Int_t      i      Index of digit for which we are searching for
+    //                      a neighbor of.
+    // Output:
+    //    Int_t      j[4]   Index of one or more of the digits which is a
+    //                      neighbor of digit a index i.
+    // Return:
+    //    Bool_t            kTRUE if a neighbor was found kFALSE otherwise.
+    Int_t ix,jx,iz,jz,j;
+    const Bool_t kdiagonal=kFALSE;
+    Bool_t nei[4];
+
+    // No neighbors found if array empty.
+    if(digs->GetEntriesFast()<=0) return kFALSE;
+    // can not be a digit with first element or elements out or range
+    if(i<=0 || i>=digs->GetEntriesFast()) return kFALSE;
+
+    for(j=0;j<4;j++){n[j] = -1;nei[j]=kFALSE;}
+    ix = ((AliITSdigit*)(digs->At(i)))->GetCoord1();
+    iz = ((AliITSdigit*)(digs->At(i)))->GetCoord2();
+    for(j=0;j<i;j++){
+       jx = ((AliITSdigit*)(digs->At(j)))->GetCoord1();
+       jz = ((AliITSdigit*)(digs->At(j)))->GetCoord2();
+       if(jx+1==ix && jz  ==iz){n[0] = j;nei[0] = kTRUE;}
+       if(jx  ==ix && jz+1==iz){n[1] = j;nei[1] = kTRUE;}
+       if(jx+1==ix && jz+1==iz){n[2] = j;nei[2] = kTRUE;}
+       if(jx+1==ix && jz-1==iz){n[3] = j;nei[3] = kTRUE;}
+    } // end for k
+    if(nei[0]||nei[1]) return kTRUE;
+    if(kdiagonal&&(nei[2]||nei[3])) return kTRUE;
+    // no Neighbors found.
+    return kFALSE;
+}
index 9d515ab0f3ce6fdc73bbb8bfdc1509106b955604..d502e204e08dcaa79ff2019ac29453a805631ca0 100644 (file)
@@ -62,9 +62,12 @@ class AliITSClusterFinder :public TObject{
     virtual void AddCluster(Int_t branch, AliITSRawCluster *c);
     virtual void AddCluster(Int_t branch, AliITSRawCluster *c,
                            AliITSRecPoint &rp);
-    virtual void FindRawClusters(Int_t mod=0) {
-       // Search for raw clusters
-    }
+    virtual void FindRawClusters(Int_t mod=0); // Finds cluster of digits.
+    // Determins if digit i has a neighbor and if so that neighor index is j.
+    virtual Bool_t IsNeighbor(TObjArray *digs,Int_t i,Int_t j[]);
+    // Given a cluster of digits, creates the nessesary RecPoint. May also
+    // do some peak separation.
+    virtual void CreateRecPoints(TObjArray *cluster,Int_t mod){};
     virtual void FindCluster(Int_t i, Int_t j, AliITSRawCluster *c) {
        // find cluster
     }
index 948c8ace67175ea8e6fc7d3eea0513100a89257c..f8a2bd7c1121853641aca322b36ae6869b6277c9 100644 (file)
@@ -15,6 +15,9 @@
 /*
   $Id$
   $Log$
+  Revision 1.28  2002/10/22 14:45:29  alibrary
+  Introducing Riostream.h
+
   Revision 1.27  2002/10/14 14:57:00  hristov
   Merging the VirtualMC branch to the main development branch (HEAD)
 
@@ -1266,7 +1269,8 @@ void AliITSClusterFinderSDD::GetRecPoints(){
                  j<dig->GetNTracks()) j++;
            if(j<dig->GetNTracks()){
                rnew.fTracks[1] = dig->fTracks[j];
-               while(rnew.fTracks[1]==dig->fTracks[j] && 
+               while((rnew.fTracks[0]==dig->fTracks[j] || 
+                      rnew.fTracks[1]==dig->fTracks[j] )&& 
                      j<dig->GetNTracks()) j++;
                if(j<dig->GetNTracks()) rnew.fTracks[2] = dig->fTracks[j];
            } // end if
index 643eaf36e3b9bd61c74c4c0edd45f359eabb4481..75ecdcfa34344fd27367fa2c48dec9fffd68ad33 100644 (file)
@@ -103,6 +103,8 @@ void AliITSClusterFinderSPD::FindRawClusters(Int_t module){
 
     AliITSdigitSPD *dig;
     Int_t ndig,i;
+//    cout << "FindRawcluters"<<endl;
+//    scanf("%d",ndig);
     for(ndig=0; ndig<ndigits; ndig++) {
        dig= (AliITSdigitSPD*)fDigits->UncheckedAt(ndig);
        digx[digitcount] = dig->fCoord2+1;  //starts at 1
@@ -110,14 +112,23 @@ void AliITSClusterFinderSPD::FindRawClusters(Int_t module){
        digtr1[digitcount] = dig->fTracks[0];
        digtr2[digitcount] = -3;
        digtr3[digitcount] = -3;
+       //cout << "digtr1["<<digitcount <<"]="<<digtr1[digitcount];
+       //cout << " fTracks["<<0<<"]="<<dig->fTracks[0]<<": ";
        i=1;
        while(digtr1[digitcount]==dig->fTracks[i] && i<dig->GetNTracks()) i++;
+       //cout << " fTracks["<<i<<"]="<<dig->fTracks[i];
        if(i<dig->GetNTracks()){
            digtr2[digitcount] = dig->fTracks[i];
-           while(digtr1[digitcount]==dig->fTracks[i] && 
-                 i<dig->GetNTracks()) i++;
+           //cout << "digtr2["<<digitcount <<"]="<<digtr2[digitcount]<<": ";
+           while((digtr1[digitcount]==dig->fTracks[i] || 
+                  digtr2[digitcount]==dig->fTracks[i] )&&
+                 i<=dig->GetNTracks()) i++;
            if(i<dig->GetNTracks()) digtr3[digitcount] = dig->fTracks[i];
+           //cout << " fTracks["<<i<<"]=";
+           //if(i<dig->GetNTracks()) cout <<dig->fTracks[i];
+           //cout << "digtr3["<<digitcount <<"]="<<digtr3[digitcount];
        } // end if
+       //cout<<endl;
        digtr4[digitcount] = dig->fSignal;
        digitcount++;
     } // end for ndig
index 7407bb33c620348fae5feac1d5daf4f5c658f6b3..dbd798e413f2aa600143beff557a4b62b99274a9 100644 (file)
@@ -15,6 +15,9 @@
  
 /*
 $Log$
+Revision 1.6  2002/10/22 14:45:34  alibrary
+Introducing Riostream.h
+
 Revision 1.5  2002/10/14 14:57:00  hristov
 Merging the VirtualMC branch to the main development branch (HEAD)
 
@@ -125,8 +128,6 @@ Bool_t AliITSDigitizer::Init(){
     fInit = kTRUE; // Assume for now init will work.
     if(!gAlice) {
        fITS      = 0;
-       fActive   = 0;
-       fRoif     = -1;
        fRoiifile = 0;
        fInit     = kFALSE;
        Warning("Init","gAlice not found");
@@ -134,8 +135,6 @@ Bool_t AliITSDigitizer::Init(){
     } // end if
     fITS = (AliITS *)(gAlice->GetDetector("ITS"));
     if(!fITS){
-       fActive   = 0;
-       fRoif     = -1;
        fRoiifile = 0;
        fInit     = kFALSE;
        Warning("Init","ITS not found");
@@ -144,8 +143,6 @@ Bool_t AliITSDigitizer::Init(){
        //cout << "fRoif,fRoiifile="<<fRoif<<" "<<fRoiifile<<endl;
        fActive = new Bool_t[fITS->GetITSgeom()->GetIndexMax()];
     } else{
-       fActive   = 0;
-       fRoif     = -1;
        fRoiifile = 0;
        fInit     = kFALSE;
        Warning("Init","ITS geometry not found");
@@ -217,9 +214,14 @@ void AliITSDigitizer::Exec(Option_t* opt){
     
     // Digitize
     fITS->MakeBranchInTreeD(GetManager()->GetTreeD());
+    if(fRoif!=0) Info("AliITSDigitizer","Region of Interest digitization selected");
+    else Info("AliITSDigitizer","No Region of Interest selected. Digitizing everything");
+    //cout <<"fActive="<<fActive<<" fRoif="<<fRoif;
+    if(fActive==0) fRoif = 0; // fActive array must be define for RIO cuts.
+    //cout <<" fRoif="<<fRoif<<endl;
 
     for(module=0; module<size; module++ ){
-       if(fActive && fRoif!=0) if(!fActive[module]) continue;
+       if(fRoif!=0) if(!fActive[module]) continue;
         id = fITS->GetITSgeom()->GetModuleType(module);
         if(!all && !det[id]) continue;
         iDetType = fITS->DetType( id );
@@ -233,7 +235,7 @@ void AliITSDigitizer::Exec(Option_t* opt){
         sim->InitSimulationModule(module, event);
        //cout << "Module=" << module;
         for(ifiles=0; ifiles<nfiles; ifiles++ ){
-           if(fActive && fRoif!=0) if(!fActive[module]) continue;
+           if(fRoif!=0) if(!fActive[module]) continue;
            //cout <<" fl[ifiles=" << ifiles << "]=" << fl[ifiles];
             TTree *treeS = GetManager()->GetInputTreeS(fl[ifiles]);
             if( !(treeS && fITS->GetSDigits()) ) continue;   
@@ -322,6 +324,7 @@ void AliITSDigitizer::SetByRegionOfInterest(TTree *ts){
        //cout << fActive[m];
        //cout << endl;
     } // end for m
+    Info("AliITSDigitizer","Digitization by Region of Interest selected");
     sdig->Clear();
     delete sdig;
     return;
index fbb83d3a837e5928296ede6927936d5b0d198c09..f2cb899ff75e692f4a13ca4672c83f4310ce4156 100644 (file)
@@ -73,7 +73,13 @@ Int_t AliITSMerge(TString digFile="galiceMD.root",
     } // end if
 //    manager->SetCopyTreesFromInput(0);
     AliITSDigitizer *dITS = new AliITSDigitizer(manager);
-    if(opt.Contains("ROI")==0) dITS->SetByRegionOfInterestFlag(1);
+    if(opt.Contains("ROI")){
+       cout << "Region of Interest selected" << endl;
+       dITS->SetByRegionOfInterestFlag(1);
+    }else{
+       cout << "Digizing everthing" << endl;
+       dITS->SetByRegionOfInterestFlag(0);
+    } // end if
 
     TStopwatch timer;
     timer.Start();
index d5c9038361999268d25ec89729436c45881c4d11..d82b19fe321d6948114af8a26545fe65c00d841d 100644 (file)
@@ -21,6 +21,8 @@ class AliITSRecPoint : public TObject {
     virtual ~AliITSRecPoint() {}; // distructor
     Bool_t IsSortable() const {return kTRUE;} // allows for sorting
     Int_t   GetLabel(Int_t i) const {return fTracks[i];} // get track label
+    Int_t  *GetTracks(){return fTracks;}// Returns pointer to track array
+    Int_t   GetNTracks(){return 3;} // returns track array size
     Float_t GetX() const {return fX;} // gets fX
     Float_t GetZ() const {return fZ;} // gets fZ
     Float_t GetQ() const {return fQ;} // gets fQ
index b9c2deeee8f98fa83ad5f040744e3475822dff6a..e26c80e8d2c0d613ef28ecc6b3c756c4f5e4d9c0 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.10  2002/10/22 14:45:37  alibrary
+Introducing Riostream.h
+
 Revision 1.9  2002/10/14 14:57:00  hristov
 Merging the VirtualMC branch to the main development branch (HEAD)
 
@@ -255,6 +258,42 @@ void AliITSclusterSSD::DelCross(Int_t index){
 //______________________________________________________________________
 Int_t  *AliITSclusterSSD::GetTracks(Int_t &nt){
     // return the track number of the cluster
+    Int_t ntrk = GetDigit(0)->GetNTracks();
+    Int_t ndig = GetNumOfDigits();
+    Int_t *idig = new Int_t[ndig];
+    Int_t *sdig = new Int_t[ndig];
+    Int_t *itrk = new Int_t[ndig*ntrk];
+    Int_t i,j,k,l,trk;
+    Bool_t b;
+
+    for(i=0;i<ndig;i++){idig[i] = i;sdig[i] = GetDigit(i)->GetSignal();}
+    TMath::Sort(ndig,sdig,idig,kTRUE);
+    for(i=0;i<ndig*ntrk;i++) itrk[i] = -3;
+    j = k = l = 0;
+    for(i=0;i<ndig;i++){ // fill itrk with track numbers in order of digit size
+       j = idig[i];
+       for(k=0;k<ntrk;k++) if((trk = GetDigit(j)->GetTrack(k))>=0) {
+           itrk[l] = trk;
+           l++;
+       } // end for k/if
+    } // end for i
+    for(i=0;i<10;i++) fTrack[i] = -3;
+    fTrack[0] = itrk[0]; // first element
+    k = 1;
+    b = kTRUE;
+    for(i=1;i<l;i++){
+       for(j=0;j<k;j++) if(fTrack[j]==itrk[i]) b = kFALSE;
+       if(b){fTrack[k] = itrk[i]; k++;}
+       if(k>9) break;
+    } // end for i
+    nt = k;
+
+    delete[] idig;
+    delete[] sdig;
+    delete[] itrk;
+
+    return fTrack;
+/*
     Int_t *tidx=0;
     Int_t i, j,n;
     Int_t bit =0;
@@ -289,6 +328,7 @@ Int_t  *AliITSclusterSSD::GetTracks(Int_t &nt){
     SetNTracks(ntracks); 
     nt = ntracks;
     return &(fTrack[0]);
+*/
 }
 //______________________________________________________________________
 Double_t AliITSclusterSSD::GetPosition(){
index 4387f4bcec1064566dab62f3058315231cb9b5a4..e4e7189d61eb7fee1378c6b550814a23555fe5d2 100644 (file)
@@ -63,7 +63,7 @@ AliITSdigitSPD::AliITSdigitSPD():AliITSdigit(){
     Int_t i;
 
     for(i=0;i<fkSspd;i++) fTracks[i]  = -3;
-    for(i=0;i<fkSspd;i++) fHits[0]    = -1;
+    for(i=0;i<fkSspd;i++) fHits[i]    = -1;
 }
 //______________________________________________________________________
 AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits){
@@ -71,7 +71,7 @@ AliITSdigitSPD::AliITSdigitSPD(const Int_t *digits){
     Int_t i;
 
     for(i=0;i<fkSspd;i++) fTracks[i]  = -3;
-    for(i=0;i<fkSspd;i++) fHits[0]    = -1;
+    for(i=0;i<fkSspd;i++) fHits[i]    = -1;
     fCoord1       = digits[0];
     fCoord2       = digits[1];
     fSignal       = 1;
@@ -134,7 +134,7 @@ AliITSdigitSDD::AliITSdigitSDD():AliITSdigit(){
     Int_t i;
 
     for(i=0;i<fkSsdd;i++) fTracks[i] = -3;
-    for(i=0;i<fkSsdd;i++) fHits[1]   = -1;
+    for(i=0;i<fkSsdd;i++) fHits[i]   = -1;
     fPhysics = 0;
     for(i=0;i<fkSsdd;i++) fTcharges[i] = 0;
 }
index f119c68a64f7720a355f94abefca04e443487e68..e27efd80b563e3a7b180ff70c2343ed919b9076a 100644 (file)
@@ -71,12 +71,12 @@ class AliITSdigitSPD: public AliITSdigit {
     virtual Int_t GetTrack(Int_t i) const {return fTracks[i];}
     // returns hit number kept in the array element i of fHits 
     virtual Int_t GetHit(Int_t i) const {return fHits[i];}
-    //copy the array trks[3] into fTracks
+    //copy the array trks[fkSspd] into fTracks
     virtual void SetTracks(const Int_t *trks){
-       for(Int_t i=0;i<3;i++) fTracks[i]=trks[i];}
-    //copy the array hits[3] into fHits
+       for(Int_t i=0;i<fkSspd;i++) fTracks[i]=trks[i];}
+    //copy the array hits[fkSspd] into fHits
     virtual void SetHits(const Int_t *hits){
-       for(Int_t i=0;i<3;i++) fHits[i]=hits[i];}
+       for(Int_t i=0;i<fkSspd;i++) fHits[i]=hits[i];}
     //set array element i of fTracks to trk.
     virtual void SetTrack(Int_t i,Int_t trk){fTracks[i]=trk;}
     //set array element i of fHits to hit.
@@ -121,12 +121,12 @@ class AliITSdigitSDD: public AliITSdigit {
     virtual Int_t GetTrack(Int_t i) const {return fTracks[i];}
     // returns hit number kept in the array element i of fHits 
     virtual Int_t GetHit(Int_t i) const {return fHits[i];}
-    //copy the array trks[3] into fTracks
+    //copy the array trks[fkSsdd] into fTracks
     virtual void SetTracks(const Int_t *trks){
-       for(Int_t i=0;i<3;i++) fTracks[i]=trks[i];}
-    //copy the array hits[3] into fHits
+       for(Int_t i=0;i<fkSsdd;i++) fTracks[i]=trks[i];}
+    //copy the array hits[fkSsdd] into fHits
     virtual void SetHits(const Int_t *hits){
-       for(Int_t i=0;i<3;i++) fHits[i]=hits[i];}
+       for(Int_t i=0;i<fkSsdd;i++) fHits[i]=hits[i];}
     //set array element i of fTracks to trk.
     virtual void SetTrack(Int_t i,Int_t trk){fTracks[i]=trk;}
     //set array element i of fHits to hit.
@@ -206,12 +206,12 @@ class AliITSdigitSSD: public AliITSdigit {
     virtual Int_t GetTrack(Int_t i) const {return fTracks[i];}
     // returns hit number kept in the array element i of fHits 
     virtual Int_t GetHit(Int_t i) const {return fHits[i];}
-    //copy the array trks[3] into fTracks
+    //copy the array trks[fkSssd] into fTracks
     virtual void SetTracks(const Int_t *trks){
-       for(Int_t i=0;i<3;i++) fTracks[i]=trks[i];}
-    //copy the array hits[3] into fHits
+       for(Int_t i=0;i<fkSssd;i++) fTracks[i]=trks[i];}
+    //copy the array hits[fkSssd] into fHits
     virtual void SetHits(const Int_t *hits){
-       for(Int_t i=0;i<3;i++) fHits[i]=hits[i];}
+       for(Int_t i=0;i<fkSssd;i++) fHits[i]=hits[i];}
     //set array element i of fTracks to trk.
     virtual void SetTrack(Int_t i,Int_t trk){fTracks[i]=trk;}
     //set array element i of fHits to hit.
index 28217d643c7b1bd664e6cd7f0db0d47e669ccade..536ae09144834ff7d287ca6692e58edcc8627b63 100644 (file)
@@ -314,12 +314,13 @@ AliITSpListItem& AliITSpListItem::operator=(const AliITSpListItem &source){
     //    none.
     // Return:
     //    A copied AliITSpListItem object
+    Int_t i;
 
     if(this == &source) return *this;
 
     this->fmodule = source.fmodule;
     this->findex  = source.findex;
-    for(Int_t i=0;i<this->fkSize;i++){
+    for(i=0;i<this->fkSize;i++){
         this->fTrack[i]  = source.fTrack[i];
         this->fSignal[i] = source.fSignal[i];
         this->fHits[i]   = source.fHits[i];
@@ -327,7 +328,22 @@ AliITSpListItem& AliITSpListItem::operator=(const AliITSpListItem &source){
     this->fTsignal = source.fTsignal;
     this->fNoise   = source.fNoise;
     this->fSignalAfterElect   = source.fSignalAfterElect;
-
+    /*
+    cout <<"this fTrack[0-9]=";
+    for(i=0;i<this->fkSize;i++) cout <<this->fTrack[i]<<",";
+    cout <<" fHits[0-9]=";
+    for(i=0;i<this->fkSize;i++) cout <<this->fHits[i]<<",";
+    cout <<" fSignal[0-9]=";
+    for(i=0;i<this->fkSize;i++) cout <<this->fSignal[i]<<",";
+    cout << endl;
+    cout <<"source fTrack[0-9]=";
+    for(i=0;i<this->fkSize;i++) cout <<source.fTrack[i]<<",";
+    cout <<" fHits[0-9]=";
+    for(i=0;i<this->fkSize;i++) cout <<source.fHits[i]<<",";
+    cout <<" fSignal[0-9]=";
+    for(i=0;i<this->fkSize;i++) cout <<source.fSignal[i]<<",";
+    cout << endl;
+    */
     return *this;
 }
 //______________________________________________________________________
@@ -369,6 +385,7 @@ void AliITSpListItem::AddSignal(Int_t track,Int_t hit,Int_t module,
         fSignal[i] += signal;
         flg = kTRUE;
     } // end for i & if.
+    //cout << "track="<<track<<endl;
     if(flg){ // resort arrays.  
         for(i=1;i<fkSize;i++){
             j = i;
@@ -382,6 +399,8 @@ void AliITSpListItem::AddSignal(Int_t track,Int_t hit,Int_t module,
                 fTrack[j]  = trk;
                 fHits[j]   = hts;
                 fSignal[j] = sig;
+               //cout << "#fTrack["<<j-1<<"]="<<fTrack[j-1]<< " fTrack["<<
+               // j<<"]="<<fTrack[j]<<endl;
                 j--;
             } // end while
         } // end if i
@@ -402,11 +421,17 @@ void AliITSpListItem::AddSignal(Int_t track,Int_t hit,Int_t module,
             fHits[i+1]   = hit;
             return; // put it in the right place, now exit.
         } //  end if
+       //cout << "$fTrack["<<i+1<<"]="<<fTrack[i+1]<< " fTrack["<<i<<"]="
+       //<<fTrack[i]<< " fHits["<<i+1<<"]="<<fHits[i+1]<< " fHits["<<i<<"]="
+       //<<fHits[i]<< " fSignal["<<i+1<<"]="<<fSignal[i+1]<< " fSignal["<<i
+       //<<"]="<<fSignal[i]<<endl;
     } // end if; end for i
     // Still haven't found the right place. Must be at top of list.
     fSignal[0] = signal;
     fTrack[0]  = track;
     fHits[0]   = hit;
+    //cout << "$fTrack["<<0<<"]="<<fTrack[0]<<" fHits["<<0<<"]="<<fHits[0]
+    //<<" fSignal["<<0<<"]="<<fSignal[0]<<endl;
     return;
 }
 //______________________________________________________________________
index 10d0e5e23b8d08de6f121663d9d9b16a22cde005..214acb43c44b29fa6e721c5520c3ca13e16c6d6d 100644 (file)
@@ -24,7 +24,7 @@ class AliITSpListItem: public TObject {
     virtual AliITSpListItem& operator=(const AliITSpListItem &source);
     // Returns the signal value in the list of signals
     virtual Double_t GetSignal(Int_t i){
-                           return ( (i>=0&&i<fkSize-1) ? fSignal[i] : 0.0);}
+                           return ( (i>=0&&i<fkSize) ? fSignal[i] : 0.0);}
     virtual Double_t GetSignal(){
                            return fTsignal;}
     virtual Double_t GetSignalAfterElect(){
@@ -44,10 +44,10 @@ class AliITSpListItem: public TObject {
     virtual void AddNoise(Int_t module,Int_t index,Double_t noise);
     // Returns track number.
     virtual Int_t GetTrack(Int_t i){
-                           return ((i>=0&&i<fkSize-1) ? fTrack[i] : 0);}
+                           return ((i>=0&&i<fkSize) ? fTrack[i] : 0);}
     // Returns hit number.
     virtual Int_t GetHit(Int_t i){
-                           return ((i>=0&&i<fkSize-1) ? fHits[i] : 0);}
+                           return ((i>=0&&i<fkSize) ? fHits[i] : 0);}
     // Returns module number.
     virtual Int_t GetModule(){
                            return fmodule;}
index 105560b31d22afcb588e9c620902b7a38735c1d4..73a450b9eb8b5668daea470fb2c5079a775096fc 100644 (file)
@@ -92,10 +92,12 @@ void AliITSsegmentationSDD::GetPadIxz(Float_t x,Float_t z,
 
     const Float_t kconv=10000;  // cm->um
 
+    x *= kconv; // Convert to microns
+    z *= kconv; // Convert to microns
     Int_t na = fNanodes/2;
-    Float_t driftpath=fDx-TMath::Abs(kconv*x);
+    Float_t driftpath=fDx-TMath::Abs(x);
     timebin=(Int_t)(driftpath/fDriftSpeed/fTimeStep);
-    anode=(Int_t)(kconv*z/fPitch + na/2);
+    anode=(Int_t)(z/fPitch + na/2);
     if (x > 0) anode += na;
 
     timebin+=1;
index 47415ca094530145a96b500bcb2d1d024f3faac1..e923559021f75dcfb1f363005f1fea59b3d99a12 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.22  2002/10/22 14:45:44  alibrary
+Introducing Riostream.h
+
 Revision 1.21  2002/10/14 14:57:08  hristov
 Merging the VirtualMC branch to the main development branch (HEAD)
 
@@ -534,6 +537,68 @@ void AliITSsimulationSPD::SetCoupling(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 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.
@@ -602,6 +667,7 @@ void AliITSsimulationSPD::CreateDigit(Int_t module,AliITSpList *pList) {
     Float_t * charges = new Float_t[size]; 
     Int_t j1;
 
+    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
@@ -617,11 +683,11 @@ void AliITSsimulationSPD::CreateDigit(Int_t module,AliITSpList *pList) {
                    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;
+                       //}else{
+                       //tracks[j1] = -3;
+                       //hits[j1]   = -1;
                    } // end if
-                   charges[j1] = 0;
+                   //charges[j1] = 0;
                } // end for j1
                Float_t phys = 0;
                aliITS->AddSimDigit(0,phys,digits,tracks,hits,charges);
index 7d6bae204709c14de92a63d48cce8b17641d4849..38c2853fb15c73b048764c6867f938991ae86c93 100644 (file)
@@ -67,9 +67,16 @@ class AliITSsimulationSPD : public AliITSsimulation {
     //  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.
+    //  the column and row direction, respectively. Now done in a statistical
+    //  way and not "mechanical" as in the Old version.
     void SetCoupling(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.
+    void SetCouplingOld(Int_t row,Int_t col,Int_t ntrack,Int_t idhit,
+                       Int_t module,AliITSpList *pList);
     // The pixels are fired if the energy deposited inside them is above
     // the threshold parameter ethr. Fired pixed are interpreted as digits
     // and stored in the file digitfilename. One also needs to write out
@@ -104,7 +111,7 @@ class AliITSsimulationSPD : public AliITSsimulation {
     void GetThresholds(Float_t &t,Float_t &s){
     ((AliITSresponseSPD*)fResponse)->Thresholds(t,s);}
     // Returns the couplings Columb and Row.
-    void GetCouplings(Float_t &cc,Float_t cr){
+    void GetCouplings(Float_t &cc,Float_t &cr){
        ((AliITSresponseSPD*)fResponse)->GetNoiseParam(cc,cr);}
     // Returns the number of pixels in x
     Int_t GetNPixelsX(){return ((AliITSsegmentationSPD*)fSegmentation)->Npx();}