]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliMultiplicity.cxx
Adding ruleckecher files into the distribbution
[u/mrichter/AliRoot.git] / STEER / AliMultiplicity.cxx
index 43c366b0d11e70b5c1b11dc9601bf4c907c98674..c47bd1744b1d9c131d5cf0a5c8f010a8c7f8a239 100644 (file)
@@ -1,6 +1,7 @@
 #include <string.h>
 #include "AliMultiplicity.h"
 #include "AliLog.h"
+#include "AliRefArray.h"
 
 ClassImp(AliMultiplicity)
 
@@ -9,9 +10,15 @@ AliMultiplicity::AliMultiplicity():
   TObject(),
   fNtracks(0),
   fNsingle(0),
+//
+  fDPhiWindow2(0.08*0.08),  
+  fDThetaWindow2(0.025*0.025),
+  fDPhiShift(0.0045),
+  fNStdDev(1.0),
+//
   fLabels(0),
   fLabelsL2(0),
-  fUsedClusS(0),
+  fUsedClusS(0), 
   fUsedClusT(0),
   fTh(0),
   fPhi(0),
@@ -26,6 +33,7 @@ AliMultiplicity::AliMultiplicity():
   // Default Constructor
   fFiredChips[0] = 0;
   fFiredChips[1] = 0;
+  for (int il=2;il--;) fSCl2Tracks[il] = fTCl2Tracks[il][0] = fTCl2Tracks[il][1] = 0;
   for(Int_t ilayer = 0; ilayer < 6; ilayer++)fITSClusters[ilayer] = 0;
 }
 
@@ -34,6 +42,12 @@ AliMultiplicity::AliMultiplicity(Int_t ntr, Float_t *th,  Float_t *ph, Float_t *
   TObject(),
   fNtracks(ntr),
   fNsingle(ns),
+  //
+  fDPhiWindow2(0.08*0.08),  
+  fDThetaWindow2(0.025*0.025),
+  fDPhiShift(0.0045),
+  fNStdDev(1.0),
+  //
   fLabels(0),
   fLabelsL2(0),
   fUsedClusS(0),
@@ -49,6 +63,7 @@ AliMultiplicity::AliMultiplicity(Int_t ntr, Float_t *th,  Float_t *ph, Float_t *
   fClusterFiredChips(1200)
 {
 // Standard constructor
+  for (int il=2;il--;) fSCl2Tracks[il] = fTCl2Tracks[il][0] = fTCl2Tracks[il][1] = 0;
   if(ntr>0){
     fLabels = new Int_t[ntr];
     fLabelsL2 = new Int_t[ntr];
@@ -86,6 +101,12 @@ AliMultiplicity::AliMultiplicity(Int_t ntr, Int_t ns, Short_t nfcL1, Short_t nfc
   TObject(),
   fNtracks(ntr),
   fNsingle(ns),
+  //
+  fDPhiWindow2(0.08*0.08),  
+  fDThetaWindow2(0.025*0.025),
+  fDPhiShift(0.0045),
+  fNStdDev(1.0),
+  //
   fLabels(0),
   fLabelsL2(0),
   fUsedClusS(0),
@@ -101,6 +122,7 @@ AliMultiplicity::AliMultiplicity(Int_t ntr, Int_t ns, Short_t nfcL1, Short_t nfc
   fClusterFiredChips(1200)
 {
   // Standard constructor to create the arrays w/o filling
+  for (int il=2;il--;) fSCl2Tracks[il] = fTCl2Tracks[il][0] = fTCl2Tracks[il][1] = 0;
   if(ntr>0){
     fLabels   = new Int_t[ntr];
     fLabelsL2 = new Int_t[ntr];
@@ -108,8 +130,6 @@ AliMultiplicity::AliMultiplicity(Int_t ntr, Int_t ns, Short_t nfcL1, Short_t nfc
     fPhi      = new Double_t [ntr];
     fDeltTh   = new Double_t [ntr];
     fDeltPhi  = new Double_t [ntr];
-    fUsedClusT = new ULong64_t[ntr];
-
     for(Int_t i=fNtracks;i--;){
       fTh[i]=fPhi[i]=fDeltTh[i]=fDeltPhi[i] = 0;
       fLabels[i] = fLabelsL2[i] = 0;
@@ -119,7 +139,6 @@ AliMultiplicity::AliMultiplicity(Int_t ntr, Int_t ns, Short_t nfcL1, Short_t nfc
     fThsingle  = new Double_t [ns];
     fPhisingle = new Double_t [ns];
     fLabelssingle = new Int_t [ns];
-    fUsedClusS = new UInt_t[ns];
     for(Int_t i=fNsingle;i--;) fThsingle[i] = fPhisingle[i] = fLabelssingle[i] = 0;
   }
   fFiredChips[0] = nfcL1;
@@ -133,6 +152,12 @@ AliMultiplicity::AliMultiplicity(const AliMultiplicity& m):
   TObject(m),
   fNtracks(m.fNtracks),
   fNsingle(m.fNsingle),
+  //
+  fDPhiWindow2(0.08*0.08),  
+  fDThetaWindow2(0.025*0.025),
+  fDPhiShift(0.0045),
+  fNStdDev(1.0),
+  //
   fLabels(0),
   fLabelsL2(0),
   fUsedClusS(0),
@@ -148,6 +173,7 @@ AliMultiplicity::AliMultiplicity(const AliMultiplicity& m):
   fClusterFiredChips(1200)
 {
   // copy constructor
+  for (int il=2;il--;) fSCl2Tracks[il] = fTCl2Tracks[il][0] = fTCl2Tracks[il][1] = 0;
   Duplicate(m);
 }
 
@@ -168,9 +194,13 @@ AliMultiplicity &AliMultiplicity::operator=(const AliMultiplicity& m){
   if(fLabelssingle)delete [] fLabelssingle;fLabelssingle = 0;
   if(fUsedClusS) delete[] fUsedClusS; fUsedClusS = 0;
   if(fUsedClusT) delete[] fUsedClusT; fUsedClusT = 0;
-
+  for (int il=2;il--;) {
+    if (fSCl2Tracks[il])    delete fSCl2Tracks[il];    fSCl2Tracks[il]    = 0;
+    if (fTCl2Tracks[il][0]) delete fTCl2Tracks[il][0]; fTCl2Tracks[il][0] = 0;
+    if (fTCl2Tracks[il][1]) delete fTCl2Tracks[il][1]; fTCl2Tracks[il][1] = 0;
+  }
   Duplicate(m);
-
+  //
   return *this;
 }
 
@@ -199,8 +229,15 @@ void AliMultiplicity::Duplicate(const AliMultiplicity& m){
     fDeltPhi = new Double_t[fNtracks];
     fLabels = new Int_t[fNtracks];
     fLabelsL2 = new Int_t[fNtracks];
-    if (m.fUsedClusT) fUsedClusT = new ULong64_t[fNtracks];
-    else fUsedClusT = 0;
+    if (m.fUsedClusT) fUsedClusT = new ULong64_t[fNtracks]; else fUsedClusT = 0;
+    if(m.fTh)memcpy(fTh,m.fTh,fNtracks*sizeof(Double_t));
+    if(m.fPhi)memcpy(fPhi,m.fPhi,fNtracks*sizeof(Double_t));
+    if(m.fDeltTh)memcpy(fDeltTh,m.fDeltTh,fNtracks*sizeof(Double_t));
+    if(m.fDeltPhi)memcpy(fDeltPhi,m.fDeltPhi,fNtracks*sizeof(Double_t));
+    if(m.fLabels)memcpy(fLabels,m.fLabels,fNtracks*sizeof(Int_t));
+    if(m.fLabelsL2)memcpy(fLabelsL2,m.fLabelsL2,fNtracks*sizeof(Int_t));
+    if(fUsedClusT) memcpy(fUsedClusT,m.fUsedClusT,fNtracks*sizeof(ULong64_t));
+    for (int i=2;i--;) for (int j=2;j--;) if (m.fTCl2Tracks[i][j]) fTCl2Tracks[i][j] = new AliRefArray(*m.fTCl2Tracks[i][j]);
   }
   else {
     fTh = 0;
@@ -217,29 +254,27 @@ void AliMultiplicity::Duplicate(const AliMultiplicity& m){
     fLabelssingle = new Int_t[fNsingle];
     if (m.fUsedClusS) fUsedClusS = new UInt_t[fNsingle];
     else fUsedClusS = 0;
+    if(m.fThsingle)memcpy(fThsingle,m.fThsingle,fNsingle*sizeof(Double_t));
+    if(m.fPhisingle)memcpy(fPhisingle,m.fPhisingle,fNsingle*sizeof(Double_t));
+    if(m.fLabelssingle)memcpy(fLabelssingle,m.fLabelssingle,fNsingle*sizeof(Int_t));
+    if(fUsedClusS) memcpy(fUsedClusS,m.fUsedClusS,fNsingle*sizeof(UInt_t));
+    for (int i=2;i--;) if (m.fSCl2Tracks[i]) fSCl2Tracks[i] = new AliRefArray(*m.fSCl2Tracks[i]);
   }
   else {
     fThsingle = 0;
     fPhisingle = 0;
     fLabelssingle = 0;
   }
-  if(m.fTh)memcpy(fTh,m.fTh,fNtracks*sizeof(Double_t));
-  if(m.fPhi)memcpy(fPhi,m.fPhi,fNtracks*sizeof(Double_t));
-  if(m.fDeltTh)memcpy(fDeltTh,m.fDeltTh,fNtracks*sizeof(Double_t));
-  if(m.fDeltPhi)memcpy(fDeltPhi,m.fDeltPhi,fNtracks*sizeof(Double_t));
-  if(m.fLabels)memcpy(fLabels,m.fLabels,fNtracks*sizeof(Int_t));
-  if(m.fLabelsL2)memcpy(fLabelsL2,m.fLabelsL2,fNtracks*sizeof(Int_t));
-  if(m.fThsingle)memcpy(fThsingle,m.fThsingle,fNsingle*sizeof(Double_t));
-  if(m.fPhisingle)memcpy(fPhisingle,m.fPhisingle,fNsingle*sizeof(Double_t));
-  if(m.fLabelssingle)memcpy(fLabelssingle,m.fLabelssingle,fNsingle*sizeof(Int_t));
-  if(fUsedClusS) memcpy(fUsedClusS,m.fUsedClusS,fNsingle*sizeof(UInt_t));
-  if(fUsedClusT) memcpy(fUsedClusT,m.fUsedClusT,fNtracks*sizeof(ULong64_t));
+
   fFiredChips[0] = m.fFiredChips[0];
   fFiredChips[1] = m.fFiredChips[1];
   for(Int_t ilayer = 0; ilayer < 6; ilayer++){
     fITSClusters[ilayer] = m.fITSClusters[ilayer];
   }
-  
+  fDPhiWindow2   = m.fDPhiWindow2;
+  fDThetaWindow2 = m.fDThetaWindow2;
+  fDPhiShift     = m.fDPhiShift;
+  fNStdDev       = m.fNStdDev;
   fFastOrFiredChips = m.fFastOrFiredChips;
   fClusterFiredChips = m.fClusterFiredChips;
 }
@@ -258,6 +293,11 @@ AliMultiplicity::~AliMultiplicity(){
   if(fLabelssingle)delete [] fLabelssingle;fLabelssingle = 0;
   if(fUsedClusS) delete[] fUsedClusS; fUsedClusS = 0;
   if(fUsedClusT) delete[] fUsedClusT; fUsedClusT = 0;
+  for (int il=2;il--;) {
+    if (fSCl2Tracks[il])    delete fSCl2Tracks[il];    fSCl2Tracks[il]    = 0;
+    if (fTCl2Tracks[il][0]) delete fTCl2Tracks[il][0]; fTCl2Tracks[il][0] = 0;
+    if (fTCl2Tracks[il][1]) delete fTCl2Tracks[il][1]; fTCl2Tracks[il][1] = 0;
+  }
 }
 
 //______________________________________________________________________
@@ -276,6 +316,11 @@ void AliMultiplicity::Clear(Option_t*)
   if(fLabelssingle)delete [] fLabelssingle;fLabelssingle = 0;
   if(fUsedClusS) delete[] fUsedClusS; fUsedClusS = 0;
   if(fUsedClusT) delete[] fUsedClusT; fUsedClusT = 0;
+  for (int il=2;il--;) {
+    if (fSCl2Tracks[il])    delete fSCl2Tracks[il];    fSCl2Tracks[il]    = 0;
+    if (fTCl2Tracks[il][0]) delete fTCl2Tracks[il][0]; fTCl2Tracks[il][0] = 0;
+    if (fTCl2Tracks[il][1]) delete fTCl2Tracks[il][1]; fTCl2Tracks[il][1] = 0;
+  }
   fNtracks = fNsingle = 0;
   for (int i=6;i--;) fITSClusters[0] = 0;
   fFiredChips[0] = fFiredChips[1] = 0;
@@ -346,8 +391,10 @@ void AliMultiplicity::SetTrackletData(Int_t id, const Float_t* tlet, UInt_t trSP
   fDeltTh[id]  = tlet[3];
   fLabels[id]   = Int_t(tlet[4]);
   fLabelsL2[id] = Int_t(tlet[5]);
-  fUsedClusT[id] = (((ULong64_t)trSPD2)<<32) + trSPD1;
-  //  printf("(%d %d)(%d %d)\n",trSPD1&0xffff,trSPD1>>16, trSPD2&0xffff, trSPD2>>16);
+  if (!GetMultTrackRefs()) {
+    if (!fUsedClusT) {fUsedClusT = new ULong64_t[fNtracks]; memset(fUsedClusT,0,fNtracks*sizeof(ULong64_t));}
+    fUsedClusT[id] = (((ULong64_t)trSPD2)<<32) + trSPD1;
+  }
   //
 }
 
@@ -359,7 +406,10 @@ void AliMultiplicity::SetSingleClusterData(Int_t id, const Float_t* scl, UInt_t
   fThsingle[id]  = scl[0];
   fPhisingle[id] = scl[1];
   fLabelssingle[id] = Int_t(scl[2]); 
-  fUsedClusS[id] = tr;
+  if (!GetMultTrackRefs()) {
+    if (!fUsedClusS) {fUsedClusS = new UInt_t[fNsingle]; memset(fUsedClusS,0,fNsingle*sizeof(UInt_t));}
+    fUsedClusS[id] = tr;
+  }
   //
 }
 
@@ -367,7 +417,13 @@ void AliMultiplicity::SetSingleClusterData(Int_t id, const Float_t* scl, UInt_t
 Bool_t AliMultiplicity::FreeClustersTracklet(Int_t i, Int_t mode) const
 {
   // return kTRUE if the tracklet was not used by the track (on any of layers) of type mode: 0=TPC/ITS or ITS_SA, 1=ITS_SA_Pure
-  if (!fUsedClusT || mode<0 || mode>1 || i<0 || i>fNtracks) return kFALSE;
+  if (mode<0 || mode>1 || i<0 || i>fNtracks) return kFALSE;
+  if (GetMultTrackRefs()) { // new format allows multiple references
+    return !((fTCl2Tracks[0][mode] && fTCl2Tracks[0][mode]->HasReference(i)) ||
+            (fTCl2Tracks[1][mode] && fTCl2Tracks[1][mode]->HasReference(i)));
+  }
+  //
+  if (!fUsedClusT) return kFALSE;
   const ULong64_t kMask0 = 0x0000ffff0000ffffLL;
   const ULong64_t kMask1 = 0xffff0000ffff0000LL;
   return (fUsedClusT[i]&(mode ? kMask1:kMask0)) == 0;
@@ -379,29 +435,81 @@ Bool_t AliMultiplicity::GetTrackletTrackIDs(Int_t i, Int_t mode, Int_t &spd1, In
   // set spd1 and spd2 to ID's of the tracks using the clusters of the tracklet (-1 if not used)
   // Mode: 0=TPC/ITS or ITS_SA, 1=ITS_SA_Pure tracks
   // return false if the neither of clusters is used
-  //
   // note: stored value:  [(idSAPureSPD2+1)<<16+(idTPCITS/SA_SPD2+1)]<<32 +  [(idSAPureSPD1+1)<<16+(idTPCITS/SA_SPD1+1)]
-  if (!fUsedClusT || mode<0 || mode>1 || i<0 || i>fNtracks) {spd1 = spd2 = -1; return kFALSE;}
-  spd1 = (fUsedClusT[i]&0xffffffffLL);
-  spd2 = (fUsedClusT[i]>>32);
-  if (mode) {
-    spd1 >>= 16;
-    spd2 >>= 16;
+  // Attention: new format allows references to multiple tracks, here only the 1st will be returned
+  spd1 = spd2 = -1;
+  if ( mode<0 || mode>1 || i<0 || i>fNtracks ) return kFALSE;
+  if (GetMultTrackRefs()) {
+    if (fTCl2Tracks[0][mode]) spd1 = fTCl2Tracks[0][mode]->GetReference(i,0);
+    if (fTCl2Tracks[1][mode]) spd2 = fTCl2Tracks[1][mode]->GetReference(i,0);
   }
   else {
-    spd1 &= 0xffff;
-    spd2 &= 0xffff;
+    if (!fUsedClusT) return kFALSE;
+    spd1 = (fUsedClusT[i]&0xffffffffLL);
+    spd2 = (fUsedClusT[i]>>32);
+    if (mode) { spd1 >>= 16;    spd2 >>= 16;}
+    else      { spd1 &= 0xffff; spd2 &= 0xffff;}
+    spd1--; // we are storing id+1
+    spd2--;
   }
-  spd1--; // we are storing id+1
-  spd2--;
   return !(spd1<0&&spd2<0);
 }
 
+//______________________________________________________________________
+Int_t AliMultiplicity::GetTrackletTrackIDsLay(Int_t lr,Int_t i, Int_t mode, UInt_t* refs, UInt_t maxRef) const
+{
+  // fill array refs with maximum maxRef references on tracks used by the cluster of layer lr of tracklet i.
+  // return number of filled references
+  // Mode: 0=TPC/ITS or ITS_SA, 1=ITS_SA_Pure tracks
+  //
+  int nrefs = 0;
+  if ( mode<0 || mode>1 || i<0 || i>fNtracks || lr<0||lr>1) return nrefs;
+  if (GetMultTrackRefs()) {
+    if (fTCl2Tracks[lr][mode]) nrefs = fTCl2Tracks[lr][mode]->GetReferences(i,refs, maxRef);
+  }
+  else {
+    if (!fUsedClusT || maxRef<1) return nrefs;
+    int tr = (fUsedClusT[i]&0xffffffffLL);
+    if (mode) { lr==0 ? tr >>= 16    : tr >>= 16;}
+    else      { lr==0 ? tr &= 0xffff : tr &= 0xffff;}
+    refs[0] = tr--; // we are storing id+1
+    nrefs = 1;
+  }
+  return nrefs;
+}
+
+//______________________________________________________________________
+Int_t AliMultiplicity::GetSingleClusterTrackIDs(Int_t i, Int_t mode, UInt_t* refs, UInt_t maxRef) const
+{
+  // fill array refs with maximum maxRef references on tracks used by the single cluster i of layer lr
+  // return number of filled references
+  // Mode: 0=TPC/ITS or ITS_SA, 1=ITS_SA_Pure tracks
+  //
+  int nrefs = 0;
+  if ( mode<0 || mode>1 || i<0 || i>fNtracks) return nrefs;
+  if (GetMultTrackRefs()) {
+    if (fSCl2Tracks[mode]) nrefs = fSCl2Tracks[mode]->GetReferences(i,refs, maxRef);
+  }
+  else {
+    if (!fUsedClusS || maxRef<1) return nrefs;
+    int tr = fUsedClusS[i];
+    if (mode) tr >>= 16;
+    else      tr &= 0xffff;
+    refs[0] = tr--; // we are storing id+1
+    nrefs = 1;
+  }
+  return nrefs;
+}
+
 //______________________________________________________________________
 Bool_t AliMultiplicity::FreeSingleCluster(Int_t i, Int_t mode) const
 {
   // return kTRUE if the cluster was not used by the track of type mode: 0=TPC/ITS or ITS_SA, 1=ITS_SA_Pure
-  if (!fUsedClusS || mode<0 || mode>1 || i<0 || i>fNsingle) return kFALSE;
+  if (mode<0 || mode>1 || i<0 || i>fNsingle) return kFALSE;
+  if (GetMultTrackRefs()) { // new format allows multiple references
+    return !(fSCl2Tracks[mode] && fSCl2Tracks[mode]->HasReference(i));
+  }
+  if (!fUsedClusS) return kFALSE;
   const UInt_t kMask0 = 0x0000ffff;
   const UInt_t kMask1 = 0xffff0000;
   return (fUsedClusS[i]&(mode ? kMask1:kMask0)) == 0;
@@ -414,12 +522,17 @@ Bool_t AliMultiplicity::GetSingleClusterTrackID(Int_t i, Int_t mode, Int_t &tr)
   // Mode: 0=TPC/ITS or ITS_SA, 1=ITS_SA_Pure tracks
   // return false if the cluster is not used
   //
-  // note: stored value:  [(idSAPure+1)<<16+(idTPCITS/SA+1)]
-  if (!fUsedClusS || mode<0 || mode>1 || i<0 || i>fNsingle) {tr = -1; return kFALSE;}
-  tr = fUsedClusS[i];
-  if (mode) tr >>= 16;
-  else      tr &= 0xffff;
-  return (--tr)>=0; // we are storing id+1
+  // Attention: new format allows references to multiple tracks, here only the 1st will be returned
+  tr = -1;
+  if (mode<0 || mode>1 || i<0 || i>fNsingle) return kFALSE;
+  if (GetMultTrackRefs()) { if (fSCl2Tracks[mode]) tr = fSCl2Tracks[mode]->GetReference(i,0);}
+  else {
+    if (!fUsedClusS) return kFALSE;
+    tr = fUsedClusS[i];
+    if (mode) tr >>= 16;  else tr &= 0xffff;
+    tr--;
+  }
+  return tr>=0;
 }
 
 //______________________________________________________________________
@@ -434,24 +547,49 @@ void AliMultiplicity::CompactBits()
 void AliMultiplicity::Print(Option_t *opt) const
 {
   // print
-  printf("N.tracklets: %4d N.singles: %4d\n",fNtracks,fNsingle);
+  printf("N.tracklets: %4d N.singles: %4d, Multiple cluster->track refs:%s\n"
+        "Used: DPhiShift: %.3e Sig^2: dPhi:%.3e dTht:%.3e NStdDev:%.2f ScaleDThtSin2T:%s\n",
+        fNtracks,fNsingle,GetMultTrackRefs() ? "ON":"OFF",
+        fDPhiShift,fDPhiWindow2,fDThetaWindow2,fNStdDev,GetScaleDThetaBySin2T() ? "ON":"OFF");
   TString opts = opt; opts.ToLower();
-  int t0spd1=-1,t1spd1=-1,t0spd2=-1,t1spd2=-1;
+  int t0spd1=-1,t1spd1=-1,t0spd2=-1,t1spd2=-1,nt[2][2]={{0}};
+  UInt_t t[2][2][10]={{{0}}};
   //
   if (opts.Contains("t")) {
     for (int i=0;i<fNtracks;i++) {
-      GetTrackletTrackIDs(i,0,t0spd1,t0spd2);
-      GetTrackletTrackIDs(i,1,t1spd1,t1spd2);
-      printf("T#%3d| Eta:%+5.2f Th:%+6.3f Phi:%+6.3f DTh:%+6.3f DPhi:%+6.3f L1:%4d L2:%4d U:L1[%5d/%5d] L2[%5d/%5d]\n",
-            i,GetEta(i),fTh[i],fPhi[i],fDeltTh[i],fDeltPhi[i],fLabels[i],fLabelsL2[i],t0spd1,t1spd1,t0spd2,t1spd2);
+      if (GetMultTrackRefs()) for (int il=2;il--;)for(int it=2;it--;) nt[il][it] = GetTrackletTrackIDsLay(il,i,it,t[il][it],10);
+      else {
+       GetTrackletTrackIDs(i,0,t0spd1,t0spd2);
+       GetTrackletTrackIDs(i,1,t1spd1,t1spd2);
+      }
+      printf("T#%3d| Eta:%+5.2f Th:%+6.3f Phi:%+6.3f DTh:%+6.3f DPhi:%+6.3f L1:%5d L2:%5d ",
+            i,GetEta(i),fTh[i],fPhi[i],fDeltTh[i],fDeltPhi[i],fLabels[i],fLabelsL2[i]);
+      if (!GetMultTrackRefs()) printf("U:L1[%4d/%4d] L2[%4d/%4d]\n",t0spd1,t1spd1,t0spd2,t1spd2);
+      else {
+       printf("U:L1[");
+       if (!nt[0][0]) printf("%4d ",-1); else for(int j=0;j<nt[0][0];j++) printf("%4d ",t[0][0][j]); printf("/");
+       if (!nt[0][1]) printf("%4d ",-1); else for(int j=0;j<nt[0][1];j++) printf("%4d ",t[0][1][j]); printf("]");
+       //
+       printf(" L2[");
+       if (!nt[1][0]) printf("%4d ",-1); else for(int j=0;j<nt[1][0];j++) printf("%4d ",t[1][0][j]); printf("/");
+       if (!nt[1][1]) printf("%4d ",-1); else for(int j=0;j<nt[1][1];j++) printf("%4d ",t[1][1][j]); printf("]\n");      
+      }      
     }
   }
   if (opts.Contains("s")) {
     for (int i=0;i<fNsingle;i++) {
-      GetSingleClusterTrackID(i,0,t0spd1);
-      GetSingleClusterTrackID(i,1,t1spd1);
-      printf("S#%3d| Th:%+6.3f Phi:%+6.3f L:%4d U:[%5d/%5d]\n",
-            i,fThsingle[i],fPhisingle[i],fLabelssingle[i], t0spd1,t1spd1);
+      if (GetMultTrackRefs()) for(int it=2;it--;) nt[0][it] = GetSingleClusterTrackIDs(i,it,t[0][it],10);
+      else {
+       GetSingleClusterTrackID(i,0,t0spd1);
+       GetSingleClusterTrackID(i,1,t1spd1);
+      }
+      printf("S#%3d| Th:%+6.3f Phi:%+6.3f L:%6d ",i,fThsingle[i],fPhisingle[i],fLabelssingle[i]);
+      if (!GetMultTrackRefs()) printf("U:[%4d/%4d]\n", t0spd1,t1spd1);
+      else {
+       printf("U:["); 
+       if (!nt[0][0]) printf("%4d ",-1); else for(int j=0;j<nt[0][0];j++) printf("%4d ",t[0][0][j]); printf("/");
+       if (!nt[0][1]) printf("%4d ",-1); else for(int j=0;j<nt[0][1];j++) printf("%4d ",t[0][1][j]); printf("]\n");    
+      }
     }
   }
   //