]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Definition of labels for SDigits from Raw Data. They will be used for embedding purpo...
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 1 Aug 2011 15:37:54 +0000 (15:37 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 1 Aug 2011 15:37:54 +0000 (15:37 +0000)
ITS/AliITS.cxx
ITS/AliITS.h
ITS/AliITSClusterFinder.cxx
ITS/AliITSClusterFinder.h
ITS/AliITSClusterFinderV2SDD.cxx
ITS/AliITSClusterFinderV2SPD.cxx
ITS/AliITSClusterFinderV2SSD.cxx
ITS/AliITSClusterFinderV2SSD.h

index b109d66eb00f8da389a04042cebc0e49f1f2e59c..78407b11d71aadb600fedcd97a9113b834381a23 100644 (file)
@@ -72,6 +72,7 @@ the AliITS class.
 #include <TString.h>
 #include <TTree.h>
 #include <TVirtualMC.h>
+#include <TArrayI.h>
 #include "AliDetector.h"
 #include "AliITS.h"
 #include "AliITSDetTypeSim.h"
@@ -125,6 +126,7 @@ fpSDigits(0)
   
 //    SetDetectors(); // default to fOpt="All". This variable not written out.
 //PH    SetMarkerColor(kRed);
+  for (int i=fgkNTYPES;i--;) fRawID2ClusID[i] = 0;
 }
 //______________________________________________________________________
 AliITS::AliITS(const Char_t *title):
@@ -165,6 +167,7 @@ AliITS::AliITS(const Char_t *title):
     //PH  SetMarkerColor(kRed);
     if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName());
     fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
+    for (int i=fgkNTYPES;i--;) fRawID2ClusID[i] = 0;
 }
 //______________________________________________________________________
 AliITS::AliITS(const char *name, const char *title):
@@ -201,7 +204,7 @@ AliITS::AliITS(const char *name, const char *title):
   //PH  SetMarkerColor(kRed);
   if(!fLoader) MakeLoader(AliConfig::GetDefaultEventFolderName());
   fDetTypeSim->SetLoader((AliITSLoader*)fLoader);
-
+  for (int i=fgkNTYPES;i--;) fRawID2ClusID[i] = 0;
 }
 //______________________________________________________________________
 AliITS::~AliITS(){
@@ -1246,12 +1249,15 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
   }
   npx = segSPD->Npx();
   Double_t thr, sigma; 
-    
+
+  Int_t countRW = -1; // RS counter for raw -> cluster ID's (used in embedding)
+  const TArrayI* rawID2clusID = fRawID2ClusID[kSPD];
   AliITSRawStreamSPD inputSPD(rawReader);
   while(1){
     Bool_t next  = inputSPD.Next();
     if (!next) break;
 
+    countRW++; // RS
     Int_t module = inputSPD.GetModuleID();
     Int_t column = inputSPD.GetColumn();
     Int_t row    = inputSPD.GetRow();
@@ -1263,7 +1269,12 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
     TClonesArray& dum = *fModA[module];
     fDetTypeSim->GetSimuParam()->SPDThresholds(module,thr,sigma);
     thr += 1.;
-    new (dum[last]) AliITSpListItem(-1, -1, module, index, thr);
+    int label = -1;
+    if (rawID2clusID) { // RS If the raw->cluster ID is set (filled by cluster finder) store cluster ID's in SDigits
+      if (rawID2clusID->GetSize()<=countRW) {AliError(Form("The buffer of rawSPD to clusSPD ID's is shorter than current rawSPD ID=%d",countRW));}
+      else label = (*rawID2clusID)[countRW];
+    }
+    new (dum[last]) AliITSpListItem(label, -1, module, index, thr);
   }
   rawReader->Reset();
 
@@ -1275,7 +1286,9 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
   Int_t scalef=AliITSsimulationSDD::ScaleFourier(segSDD);
   Int_t firstSDD=AliITSgeomTGeo::GetModuleIndex(3,1,1);
   Int_t firstSSD=AliITSgeomTGeo::GetModuleIndex(5,1,1);
-
+  //
+  countRW = -1; // RS
+  rawID2clusID = fRawID2ClusID[kSDD];
   AliITSRawStream* inputSDD=AliITSRawStreamSDD::CreateRawStreamSDD(rawReader);
   for(Int_t iMod=firstSDD; iMod<firstSSD; iMod++){
     AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)fDetTypeSim->GetCalibrationModel(iMod);
@@ -1290,6 +1303,7 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
   AliITSDDLModuleMapSDD* ddlmap=fDetTypeSim->GetDDLModuleMapSDD();
   inputSDD->SetDDLModuleMap(ddlmap);
   while(inputSDD->Next()){
+    countRW++; // RS
     if(inputSDD->IsCompletedModule()==kFALSE && 
        inputSDD->IsCompletedDDL()==kFALSE){
 
@@ -1302,7 +1316,12 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
       if (module >= size) continue;
       last = fModA[module]->GetEntries();
       TClonesArray& dum = *fModA[module];
-      new (dum[last]) AliITSpListItem(-1, -1, module, index, Double_t(signal10));
+      int label = -1;
+      if (rawID2clusID) { // RS If the raw->cluster ID is set (filled by cluster finder) store cluster ID's in SDigits
+       if (rawID2clusID->GetSize()<=countRW) {AliError(Form("The buffer of rawSDD to clusSDD ID's is shorter than current rawSDD ID=%d",countRW));}
+       else label = (*rawID2clusID)[countRW];
+      }
+      new (dum[last]) AliITSpListItem(label, -1, module, index, Double_t(signal10));
       ((AliITSpListItem*) dum.At(last))->AddSignalAfterElect(module, index, Double_t(signal10));
     }
   }
@@ -1315,10 +1334,12 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
   AliITSsegmentationSSD* segSSD = (AliITSsegmentationSSD*) fDetTypeSim->GetSegmentationModel(2);
   npx = segSSD->Npx();
   AliITSRawStreamSSD inputSSD(rawReader);
+  countRW = -1;
+  rawID2clusID = fRawID2ClusID[kSSD];
   while(1){
     Bool_t next  = inputSSD.Next();
     if (!next) break;
-
+    countRW++; // RS
     Int_t module  = inputSSD.GetModuleID();
     if(module<0)AliError(Form("Invalid SSD  module %d \n",module));
     if(module<0)continue;
@@ -1331,7 +1352,12 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
        
     last = fModA[module]->GetEntries();
     TClonesArray& dum = *fModA[module];
-    new (dum[last]) AliITSpListItem(-1, -1, module, index, Double_t(signal));
+    int label = -1;
+    if (rawID2clusID) { // RS If the raw->cluster ID is set (filled by cluster finder) store cluster ID's in SDigits
+      if (rawID2clusID->GetSize()<=countRW) {AliError(Form("The buffer of rawSSD to clusSSD ID's is shorter than current rawSSD ID=%d",countRW));}
+      else label = (*rawID2clusID)[countRW];
+    }    
+    new (dum[last]) AliITSpListItem(label, -1, module, index, Double_t(signal));
   }
   rawReader->Reset();
   AliITSpListItem* sdig = 0;
@@ -1349,7 +1375,7 @@ Bool_t AliITS::Raw2SDigits(AliRawReader* rawReader)
        sdig = (AliITSpListItem*) (fModA[mod]->At(ie));
        Double_t digsig = sdig->GetSignal();
        if(mod>=firstssd) digsig*=adcToEv; // for SSD: convert back charge from ADC to electron
-       new (aSDigits[ie]) AliITSpListItem(-1, -1, mod, sdig->GetIndex(), digsig);
+       new (aSDigits[ie]) AliITSpListItem(sdig->GetTrack(0), -1, mod, sdig->GetIndex(), digsig);
        Float_t sig = sdig->GetSignalAfterElect();
        if(mod>=firstssd) sig*=adcToEv;
        if (sig > 0.) {
index 76bdca5cabd2a99bb58373fb15d2ba5d08cc4f22..96990e455444f4373c627bb3f282de2295e0dbc8 100644 (file)
@@ -28,11 +28,12 @@ class AliITSgeom;
 class AliITSdigit;
 class AliITSmodule;
 class AliRunDigitizer;
-
+class TArrayI;
 
 class AliITS : public AliDetector {
 
  public:
+  enum {kSPD,kSDD,kSSD};
     //================= Standard Classes ===============================
     AliITS();  // Default creator.
     AliITS(const Char_t *title); // standard Creator
@@ -149,6 +150,8 @@ class AliITS : public AliDetector {
     //===================== FO signals ================================
     // Write FO signals in UserInfo of SDigits/Digits tree
     void WriteFOSignals();
+    void     SetRawID2ClusID(const TArrayI* arr, Int_t iDet) { if (iDet>-1&&iDet<fgkNTYPES) fRawID2ClusID[iDet] = arr;}
+    const TArrayI* GetRawID2ClusID(Int_t iDet) const {return (iDet>-1&&iDet<fgkNTYPES) ? fRawID2ClusID[iDet]:0;}
 
  protected:
     static const Int_t fgkNTYPES=3; //number of detector types
@@ -164,7 +167,7 @@ class AliITS : public AliDetector {
     AliITSSimuParam* fSimuParam; //simulation parameters
     TClonesArray** fModA;      //! Used by Raw2SDigits (one TC per module)
     TClonesArray* fpSDigits;   //! Branch address to build SD from raw data 
-
+    const TArrayI* fRawID2ClusID[fgkNTYPES]; //! optional array for SDigit->Cluster assingment in Raw2SDigit (for embedding)
  private:
     AliITS(const AliITS &source); // copy constructor. Not to be used!
     AliITS& operator=(const AliITS &source); // = operator. Not to be used!
index 838a66fd6e3ee69dfbfc2bdb3efbe3cd0e2dce1e..52bc25b816d8afdb0c3735ae5005b9199449bd2c 100644 (file)
@@ -28,6 +28,7 @@
 #include "AliITSMap.h"
 #include "AliITSgeomTGeo.h"
 #include <TParticle.h>
+#include <TArrayI.h>
 #include "AliMC.h"
 #include "AliLog.h"
 
@@ -50,7 +51,10 @@ fEvent(0),
 fZmin(0),
 fZmax(0),
 fXmin(0),
-fXmax(0){
+fXmax(0),
+fNClusters(0),
+fRawID2ClusID(0)
+{
     // default cluster finder
     // Input:
     //   none.
@@ -78,7 +82,10 @@ fEvent(0),
 fZmin(0),
 fZmax(0),
 fXmin(0),
-fXmax(0){
+fXmax(0),
+fNClusters(0),
+fRawID2ClusID(0)
+{
     // default cluster finder
     // Standard constructor for cluster finder
     // Input:
@@ -109,7 +116,10 @@ fEvent(0),
 fZmin(0),
 fZmax(0),
 fXmin(0),
-fXmax(0){
+fXmax(0),
+fNClusters(0),
+fRawID2ClusID(0)
+{
     // default cluster finder
     // Standard + cluster finder constructor
     // Input:
@@ -143,7 +153,9 @@ AliITSClusterFinder::AliITSClusterFinder(const AliITSClusterFinder &source) :
   fZmin(source.fZmin),
   fZmax(source.fZmax),
   fXmin(source.fXmin),
-  fXmax(source.fXmax) 
+  fXmax(source.fXmax),
+  fNClusters(source.fNClusters),
+  fRawID2ClusID(source.fRawID2ClusID) 
 {
   // Copy constructor
   // Copies are not allowed. The method is protected to avoid misuse.
@@ -473,7 +485,11 @@ MakeCluster(Int_t k,Int_t max,AliBin *bins,UInt_t m,AliITSRecPoint &c) {
   c.SetSigmaZ2(c.GetSigmaZ2()+j*j*q);
 
   bins[k].SetMask(0xFFFFFFFE);
-  
+  if (fRawID2ClusID) { // RS: Register cluster id in raw words list
+    int rwid = bins[k].GetRawID();
+    if (fRawID2ClusID->GetSize()<=rwid) fRawID2ClusID->Set( (rwid+10)<<1 );
+    (*fRawID2ClusID)[rwid] = fNClusters+1; // RS: store clID+1 as a reference to the cluster
+  }
   if (bins[k-max].GetMask() == m) MakeCluster(k-max,max,bins,m,c);
   if (bins[k-1  ].GetMask() == m) MakeCluster(k-1  ,max,bins,m,c);
   if (bins[k+max].GetMask() == m) MakeCluster(k+max,max,bins,m,c);
index db36088727cabb53af95c9707523865998454bca..9027e06fa9c29af5518d9b6bace1305f22913d01 100644 (file)
@@ -23,6 +23,7 @@ class AliITSdigit;
 class AliITSRecPoint;
 class AliITSDetTypeRec;
 class AliRawReader;
+class TArrayI;
 
 //----------------------------------------------------------------------
 class AliITSClusterFinder :public TObject{
@@ -78,7 +79,11 @@ class AliITSClusterFinder :public TObject{
     AliITSDetTypeRec* GetDetTypeRec() const {return fDetTypeRec;}
 
     void InitGeometry(); 
+    //
+    Int_t    GetNClusters()                               const {return fNClusters;}
+    void     SetRawID2ClusID(TArrayI *arr)                      {fRawID2ClusID = arr;} 
+    TArrayI* GetRawID2ClusID()                            const {return fRawID2ClusID;} 
+    // 
   protected:
   class Ali1Dcluster {
   public:
@@ -98,11 +103,12 @@ class AliITSClusterFinder :public TObject{
   };
   class AliBin {
   public:
-    AliBin():fIndex(0),fMask(0xFFFFFFFE),fQ(0){}
+  AliBin():fIndex(0),fMask(0xFFFFFFFE),fRawID(-1),fQ(0){}
     void SetIndex(UInt_t idx) {fIndex=idx;}
     void SetQ(UShort_t q)  {fQ=q;}
     void SetMask(UInt_t m) {fMask=m;}
-    void Reset() {fIndex=0; fMask=0xFFFFFFFE; fQ=0;}
+    void SetRawID(Int_t id) {fRawID=id;}
+    void Reset() {fIndex=0; fMask=0xFFFFFFFE; fQ=0; fRawID=-1;}
 
     void Use() {fMask&=0xFFFFFFFE;}
     Bool_t IsNotUsed() const {return (fMask&1);}
@@ -111,9 +117,11 @@ class AliITSClusterFinder :public TObject{
     UInt_t   GetIndex() const {return fIndex;}
     UShort_t GetQ()     const {return fQ;}
     UInt_t   GetMask()  const {return fMask;}
+    Int_t    GetRawID() const {return fRawID;}
   protected:
     UInt_t fIndex; //digit index
     UInt_t fMask; //peak mask
+    Int_t  fRawID; // ID of raw word (used for embedding)
     UShort_t fQ;  //signal
   };
   void MakeCluster(Int_t k,Int_t max,AliBin *bins,UInt_t m,AliITSRecPoint &c);
@@ -145,13 +153,17 @@ class AliITSClusterFinder :public TObject{
   Int_t fZmax;   // maximum channel in Zloc
   Int_t fXmin;   // minimum channel in Xloc
   Int_t fXmax;   // maximum channel in Xloc 
+  //
+  UInt_t fNClusters; // total number of clusters found
+  //
+  TArrayI* fRawID2ClusID;        //! optional array to store raw word ID -> ClusID for embedding (not owned)
   
   AliITSClusterFinder(const AliITSClusterFinder &source); // copy constructor
   // assignment operator
   AliITSClusterFinder& operator=(const AliITSClusterFinder &source);
   
 
-  ClassDef(AliITSClusterFinder,10) //Class for clustering and reconstruction of space points
+  ClassDef(AliITSClusterFinder,11) //Class for clustering and reconstruction of space points
 };
 // Input and output functions for standard C++ input/output.
 ostream &operator<<(ostream &os,AliITSClusterFinder &source);
index ea8d39494dc755d925f9dec32ca80e0497c497d6..02b91c594b27a34c5790b6d67d23113b5fd89e11 100644 (file)
@@ -250,6 +250,9 @@ FindClustersSDD(AliBin* bins[2], TBits* anodeFired[2],
                }
              }
            }
+         } 
+         else { // raw data
+           if (fRawID2ClusID) milab[0] = fNClusters+1; // RS: store clID+1 as a reference to the cluster
          }
          
 
@@ -309,6 +312,7 @@ FindClustersSDD(AliBin* bins[2], TBits* anodeFired[2],
          else {
            fDetTypeRec->AddRecPoint(cc);
          }
+         fNClusters++; // RS
          ncl++;
        }
       }
@@ -322,7 +326,7 @@ void AliITSClusterFinderV2SDD::RawdataToClusters(AliRawReader* rawReader){
     //------------------------------------------------------------
   // This function creates ITS clusters from raw data
   //------------------------------------------------------------
-
+  fNClusters = 0; //RS
   AliITSRawStream* inputSDD=AliITSRawStreamSDD::CreateRawStreamSDD(rawReader);
   AliDebug(1,Form("%s is used",inputSDD->ClassName()));
 
@@ -367,6 +371,9 @@ void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input)
   for(Int_t iMod=0; iMod<kModulesPerDDL; iMod++) vectModId[iMod]=-1;
 
   // read raw data input stream
+  int countRW = 0; //RS
+  if (fRawID2ClusID) fRawID2ClusID->Reset(); //RS if array was provided, we shall store the rawID -> ClusterID
+  //
   while (input->Next()) {
     Int_t iModule = input->GetModuleID();
     if(iModule<0){
@@ -438,6 +445,7 @@ void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input)
            fDDLBins[iHybrid][index].SetQ(q);
            fDDLBins[iHybrid][index].SetMask(1);
            fDDLBins[iHybrid][index].SetIndex(index);
+           fDDLBins[iHybrid][index].SetRawID(countRW); //RS register raw id
            ddlAnodeFired[iHybrid]->SetBitNumber(iz);
          }else{
            AliWarning(Form("Invalid SDD cell: Anode=%d   TimeBin=%d",iz,itb));   
@@ -445,6 +453,7 @@ void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input)
        }
       }
     }
+    countRW++; //RS
   }
   for(Int_t iHyb=0;iHyb<kHybridsPerDDL;iHyb++){ 
    delete ddlAnodeFired[iHyb];
index 85ecc659506530eec37b730c1e46cb698863e9b6..135e11574fcfbccea40911d2bfea591c887a2558 100644 (file)
@@ -82,6 +82,7 @@ void AliITSClusterFinderV2SPD::RawdataToClusters(AliRawReader* rawReader){
   // This function creates ITS clusters from raw data
   //------------------------------------------------------------
   rawReader->Reset();
+  fNClusters = 0; //RS
   AliITSRawStreamSPD inputSPD(rawReader);
   FindClustersSPD(&inputSPD);
 
@@ -232,7 +233,7 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T
       idy=ymax-ymin+1;
       idz=zmax-zmin+1;
     }
-    
+    //
     for(Int_t iiz=zmin; iiz<=zmax;iiz+=idz){
       for(Int_t iiy=ymin;iiy<=ymax;iiy+=idy){
 
@@ -256,7 +257,14 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T
          }
          ndigits++;
          Float_t qBin=0.;
-         if(rawdata) qBin = bins[idxBins[idx]].GetQ();
+         if(rawdata) {
+           qBin = bins[idxBins[idx]].GetQ();
+           if (fRawID2ClusID) { // RS: Register cluster id in raw words list
+             int rwid = bins[idxBins[idx]].GetRawID();
+             if (fRawID2ClusID->GetSize()<=rwid) fRawID2ClusID->Set( (rwid+10)<<1 );         
+             (*fRawID2ClusID)[rwid] = milab[0] = fNClusters+1; // RS: store clID+1 as a reference to the cluster
+           }
+         }
          if(!rawdata){
            AliITSdigitSPD* dig = (AliITSdigitSPD*)digits->UncheckedAt(idxBins[idx]);
            qBin = (Float_t)dig->GetSignal();
@@ -303,6 +311,7 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T
          AliITSRecPoint(cl);
        } 
        nclu++;
+       fNClusters++;
       }// for iiy
     }// for iiz
   }//end for iBin
@@ -327,6 +336,9 @@ void AliITSClusterFinderV2SPD::FindClustersSPD(AliITSRawStreamSPD* input)
   AliBin* bins = NULL;
 
   // read raw data input stream
+  int countRW = 0; //RS
+  if (fRawID2ClusID) fRawID2ClusID->Reset(); //RS if array was provided, we shall store the rawID -> ClusterID
+  //
   while (kTRUE) {
     Bool_t next = input->Next();
     if (!next || input->IsNewModule()) {
@@ -345,13 +357,15 @@ void AliITSClusterFinderV2SPD::FindClustersSPD(AliITSRawStreamSPD* input)
       memcpy(binsSPD,binsSPDInit,sizeof(AliBin)*kMaxBin);
     }
 
-    if (next && bins) {
+    if (next && bins) {      
       // fill the current digit into the bins array
       Int_t index = (input->GetCoord2()+1) * kNzBins + (input->GetCoord1()+1);
       bins[index].SetIndex(index);
       bins[index].SetQ(1);
       bins[index].SetMask(1);
+      bins[index].SetRawID(countRW); //RS register raw id
     }
+    countRW++; //RS
   }
 
   delete [] binsSPDInit;
index d52a99bd9f0d7486dcebd9b9628a036314c7c568..5f69cd4c97b3cfa42908ed02eaf821be70b3e92c 100644 (file)
@@ -412,6 +412,7 @@ void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader){
   //------------------------------------------------------------
   // This function creates ITS clusters from raw data
   //------------------------------------------------------------
+  fNClusters = 0;
   rawReader->Reset();
   AliITSRawStreamSSD inputSSD(rawReader);
   FindClustersSSD(&inputSSD);
@@ -434,11 +435,15 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input)
       AliWarning("Using default AliITSRecoParam class");
     }
   }
+  if (fRawID2ClusID) { // RS: reset references from 1D clusters to rawID's
+    fRawIDRef[0].Reset();
+    fRawIDRef[1].Reset();
+  }
   Int_t nClustersSSD = 0;
   const Int_t kNADC = 12;
   const Int_t kMaxADCClusters = 1000;
 
-  Int_t strips[kNADC][2][kMaxADCClusters][2]; // [ADC],[side],[istrip], [0]=istrip [1]=signal
+  Int_t strips[kNADC][2][kMaxADCClusters][3]; // [ADC],[side],[istrip], [0]=istrip [1]=signal [2]=rawID (for embedding, RS)
   Int_t nStrips[kNADC][2];
 
   for( int i=0; i<kNADC; i++ ){
@@ -452,7 +457,9 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input)
   //*
   //* Loop over modules DDL+AD
   //*
-  
+  int countRW = 0; //RS
+  if (fRawID2ClusID) fRawID2ClusID->Reset(); //RS if array was provided, we shall store the rawID -> ClusterID
+
   while (kTRUE) {
 
     bool next = input->Next();
@@ -545,13 +552,13 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input)
          for( int istr = 0; istr<n+1; istr++ ){
            
            bool stripOK = 1;
-           Int_t strip=0;
+           Int_t strip=0, rwID = 0;
            Float_t signal=0.0, noise=0.0, gain=0.0;
            
            if( istr<n ){
              strip = strips[adc][side][istr][0];
              signal = strips[adc][side][istr][1];
-             
+             rwID   = strips[adc][side][istr][2]; // RS
              //cout<<"strip "<<adc<<" / "<<side<<": "<<strip<<endl;
 
              if( cal ){
@@ -613,6 +620,7 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input)
              nDigits++;
              //nstat[side]++;
              ostrip = strip;
+             if (fRawID2ClusID) fRawIDRef[side].AddReference(nClusters1D[side],rwID);
 
            }
          } //* end loop over strips
@@ -693,11 +701,13 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input)
     }
     strips[adc][side][n][0] = strip;
     strips[adc][side][n][1] = signal;    
+    strips[adc][side][n][2] = countRW;    
     n++;
 
     //cout<<"SSD: "<<input->GetDDL()<<" "<<input->GetAD()<<" "
     //<<input->GetADC()<<" "<<input->GetSideFlag()<<" "<<((int)input->GetStrip())<<" "<<strip<<" : "<<input->GetSignal()<<endl;
-
+    //
+    countRW++; //RS
   } //* End main loop over the input
   
   AliDebug(1,Form("found clusters in ITS SSD: %d", nClustersSSD));
@@ -1507,6 +1517,26 @@ FindClustersSSD(const Ali1Dcluster* neg, Int_t nn,
            lp[5]=-4.32e-05;
          }
        }
+       // 
+       if (fRawID2ClusID) { // set rawID <-> clusterID correspondence for embedding
+         const int kMaxRefRW = 200;
+         UInt_t nrefsRW,refsRW[kMaxRefRW];
+         nrefsRW = fRawIDRef[0].GetReferences(j,refsRW,kMaxRefRW); // n-side
+         for (int ir=nrefsRW;ir--;) {
+           int rwid = (int)refsRW[ir];
+           if (fRawID2ClusID->GetSize()<=rwid) fRawID2ClusID->Set( (rwid+10)<<1 );
+           (*fRawID2ClusID)[rwid] = fNClusters+1; // RS: store clID+1 as a reference to the cluster
+         }
+         //
+         nrefsRW = fRawIDRef[1].GetReferences(ip,refsRW,kMaxRefRW); // p-side
+         for (int ir=nrefsRW;ir--;) {
+           int rwid = (int)refsRW[ir];
+           if (fRawID2ClusID->GetSize()<=rwid) fRawID2ClusID->Set( (rwid+10)<<1 );
+           (*fRawID2ClusID)[rwid] = fNClusters+1; // RS: store clID+1 as a reference to the cluster
+         }
+         //
+         milab[0] = fNClusters+1;  // RS: assign id as cluster label
+       }
 
        AliITSRecPoint * cl2;
          cl2 = new ((*clusters)[ncl]) AliITSRecPoint(milab,lp,info);
@@ -1520,7 +1550,8 @@ FindClustersSSD(const Ali1Dcluster* neg, Int_t nn,
          }
          cused1[ip]++;
          cused2[j]++;      
-       ncl++;
+         ncl++;
+         fNClusters++;
        
       } // manyXmany
     } // loop over Pside 1Dclusters
index 3087d149f9366571290a649d0ecdfa5da9abf06e..1991de870e0665830df2fb4eb64aeaf954990a65 100644 (file)
@@ -16,6 +16,7 @@
 //--------------------------------------------------------------
 #include "AliITSClusterFinder.h"
 #include "AliITSDetTypeRec.h"
+#include "AliRefArray.h"
 
 class TClonesArray;
 class AliRawReader;
@@ -44,6 +45,7 @@ public:
   Int_t fLastSSD1;        //index of the last SSD1 detector   
   Float_t  fLorentzShiftP; // Shift due to ExB on drift N-side @ actual B field, layer 5, units: strip width 
   Float_t  fLorentzShiftN; // Shift due to ExB on drift P-side @ actual B field, layer 5, units: strip width
+  AliRefArray fRawIDRef[2];   // storage for rawID -> ClusterID (used in embedding)
   static Short_t* fgPairs;       //array used to build positive-negative pairs
   static Int_t    fgPairsSize;    //actual size of pairs array
   static const Float_t fgkCosmic2008StripShifts[16][9]; // Shifts for 2007/2008 Cosmic data (timing problem)