]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/Alieve/ITSModule.cxx
Comments.
[u/mrichter/AliRoot.git] / EVE / Alieve / ITSModule.cxx
index 2bdcbb07820112042f67480f81447e151fb1be4b..52ea4f25b9cf6b63184a4d0884bea3fe7552e517 100644 (file)
@@ -62,12 +62,12 @@ void ITSModule::InitStatics(ITSDigitsInfo* info)
 
   {
     Float_t dx = info->fSegSPD->Dx()*0.00005;
-    Float_t dz = 3.48
+    Float_t dz = 3.50
 
     fgSPDFrameBox = new FrameBox();
     fgSPDFrameBox->SetAAQuadXZ(-dx, 0, -dz, 2*dx, 2*dz);
     fgSPDFrameBox->SetFrameColor((Color_t) 31);
-    fgSPDPalette  = new RGBAPalette(0, 1, kFALSE);
+    fgSPDPalette  = new RGBAPalette(info->fSPDMinVal,info->fSPDMaxVal);
   }
 
   {
@@ -77,7 +77,8 @@ void ITSModule::InitStatics(ITSDigitsInfo* info)
     fgSDDFrameBox = new FrameBox();
     fgSDDFrameBox->SetAAQuadXZ(-dx, 0, -dz, 2*dx, 2*dz);
     fgSDDFrameBox->SetFrameColor((Color_t) 32);
-    fgSDDPalette  = new RGBAPalette(5, 80, kTRUE);
+    fgSDDPalette  = new RGBAPalette(info->fSDDMinVal,info->fSDDMaxVal);
+    fgSDDPalette->SetLimits(0, 512); // Set proper ADC range.
   }
 
   {
@@ -87,7 +88,8 @@ void ITSModule::InitStatics(ITSDigitsInfo* info)
     fgSSDFrameBox = new FrameBox();
     fgSSDFrameBox->SetAAQuadXZ(-dx, 0, -dz, 2*dx, 2*dz);
     fgSSDFrameBox->SetFrameColor((Color_t) 33);
-    fgSSDPalette  = new RGBAPalette(2, 100, kTRUE);
+    fgSSDPalette  = new RGBAPalette(info->fSSDMinVal,info->fSSDMaxVal);
+    fgSSDPalette->SetLimits(0, 1024); // Set proper ADC range.
   }
 
 }
@@ -104,7 +106,7 @@ void ITSModule::SetDigitsInfo(ITSDigitsInfo* info)
 
 /**************************************************************************/
 
-void ITSModule::SetID(Int_t gid)
+void ITSModule::SetID(Int_t gid, Bool_t trans)
 {
   static const Exc_t eH("ITSModule::SetID ");
 
@@ -113,11 +115,22 @@ void ITSModule::SetID(Int_t gid)
 
   if (gid < fInfo->fGeom->GetStartSPD() || gid > fInfo->fGeom->GetLastSSD())
     throw(eH + Form("%d is not valid. ID range from %d to %d", gid,
-                    fInfo->fGeom->GetStartSPD(), fInfo->fGeom->GetLastSSD()));
+                   fInfo->fGeom->GetStartSPD(), fInfo->fGeom->GetLastSSD()));
 
   fID = gid;
 
-  if (!fgStaticInitDone) InitStatics(fInfo);
+  if (!fgStaticInitDone) {
+    InitStatics(fInfo);
+    
+    fgSPDFrameBox->IncRefCount(this);
+    fgSPDPalette->IncRefCount();
+  
+    fgSDDFrameBox->IncRefCount(this);
+    fgSDDPalette->IncRefCount();
+
+    fgSSDFrameBox->IncRefCount(this);
+    fgSSDPalette->IncRefCount();
+  }
 
   fInfo->fGeom->GetModuleId(fID, fLayer, fLadder, fDet);
   TString strLadder = "Ladder";
@@ -152,7 +165,7 @@ void ITSModule::SetID(Int_t gid)
     SetName(symname);
     fDetID = 0;
     fDx = fInfo->fSegSPD->Dx()*0.00005;
-    fDz = 3.48
+    fDz = 3.50
     fDy = fInfo->fSegSPD->Dy()*0.00005;
 
   }
@@ -216,7 +229,8 @@ void ITSModule::SetID(Int_t gid)
 
   LoadQuads();  
   ComputeBBox();
-  SetTrans();
+  if (trans)
+    SetTrans();
 }
 
 void ITSModule::LoadQuads()
@@ -228,11 +242,11 @@ void ITSModule::LoadQuads()
 
   // printf("its module load quads \n");
 
-  TClonesArray *digits;
+  TClonesArray *digits  = fInfo->GetDigits(fID, fDetID);
+  Int_t         ndigits = digits ? digits->GetEntriesFast() : 0;
+
   Float_t       x, z, dpx, dpz; 
-  Int_t         i, j, ndigits;
-  digits  = fInfo->GetDigits(fID, fDetID);
-  ndigits = digits->GetEntriesFast(); 
+  Int_t         i, j;
 
   switch(fDetID)
   {
@@ -240,11 +254,11 @@ void ITSModule::LoadQuads()
     case 0: { // SPD
       AliITSsegmentationSPD* seg =  fInfo->fSegSPD; 
 
-      Reset(QT_AxisAlignedFixedY, kFALSE, 32);
+      Reset(QT_RectangleXZFixedY, kFALSE, 32);
 
       for (Int_t k=0; k<ndigits; ++k)
       {
-       AliITSdigitSPD *d = (AliITSdigitSPD*) digits->UncheckedAt(k);
+       AliITSdigit *d = (AliITSdigit*) digits->UncheckedAt(k);
        j = d->GetCoord1();
        i = d->GetCoord2();
        x  = -0.5*seg->Dx() + i*seg->Dpx(0);
@@ -255,6 +269,7 @@ void ITSModule::LoadQuads()
 
        AddQuad(x, z, dpx, dpz);
        QuadValue(1); // In principle could have color based on number of neigbours
+       QuadId(d);
       }
       break;
     }
@@ -262,11 +277,11 @@ void ITSModule::LoadQuads()
     case 1: { // SDD
       AliITSsegmentationSDD *seg =  fInfo->fSegSDD; 
 
-      Reset(QT_AxisAlignedFixedY, kFALSE, 32);
+      Reset(QT_RectangleXZFixedY, kFALSE, 32);
 
       for (Int_t k=0; k<ndigits; ++k)
       {
-       AliITSdigitSDD* d = (AliITSdigitSDD*) digits->UncheckedAt(k);
+       AliITSdigit* d = (AliITSdigit*) digits->UncheckedAt(k);
 
        // if (d->GetSignal() > fgSDDThreshold)
        {
@@ -276,8 +291,9 @@ void ITSModule::LoadQuads()
          dpx = seg->Dpx(i)*0.0001;
          dpz = seg->Dpz(j)*0.0001;
 
-         AddQuad(x, z, dpx, dpz);
+         AddQuad(x-2*dpx, z - dpz*0.5, 4*dpx, dpz);
          QuadValue(d->GetSignal());
+         QuadId(d);
        }
       }
       break;
@@ -286,7 +302,7 @@ void ITSModule::LoadQuads()
     case 2: { // SSD
       AliITSsegmentationSSD* seg = fInfo->fSegSSD; 
 
-      Reset(QT_LineFixedY, kFALSE, 32);
+      Reset(QT_LineXZFixedY, kFALSE, 32);
 
       Float_t ap, an; // positive/negative angles -> offsets
       seg->Angles(ap, an);
@@ -295,7 +311,7 @@ void ITSModule::LoadQuads()
 
       for (Int_t k=0; k<ndigits; ++k)
       {
-       AliITSdigitSSD *d = (AliITSdigitSSD*) digits->UncheckedAt(k);
+       AliITSdigit *d = (AliITSdigit*) digits->UncheckedAt(k);
        // if(d->GetSignal() > fgSSDThreshold)
        {
          j = d->GetCoord1();
@@ -304,8 +320,9 @@ void ITSModule::LoadQuads()
 
          Float_t a = ( d->GetCoord1() == 1) ? ap : an;
 
-         AddQuad(x-a, -fDz, 2*a, 2*fDz);
+         AddLine(x-a, -fDz, 2*a, 2*fDz);
          QuadValue(d->GetSignal());
+         QuadId(d);
          // printf("%3d -> %3d -> %8x\n", d->GetSignal(), ci, fQuads.back().color);
        }
       }
@@ -321,10 +338,16 @@ void ITSModule::LoadQuads()
 
 void ITSModule::SetTrans()
 {
+  // Set transformation matrix based on module id (use geometry to
+  // retrieve this information).
+
   Double_t x[9];
   fHMTrans.UnitTrans();
 
-   // column major
+  // !!!! Here should use AliITSgeomTGeo ... but can i be sure
+  // the geometry has been loaded?
+
+  // column major
   fInfo->fGeom->GetRotMatrix(fID, x);
   fHMTrans.SetBaseVec(1, x[0], x[3], x[6]);
   fHMTrans.SetBaseVec(2, x[1], x[4], x[7]);
@@ -336,6 +359,24 @@ void ITSModule::SetTrans()
 
 /**************************************************************************/
 
+void ITSModule::QuadSelected(Int_t idx)
+{
+  // Override control-click from QuadSet
+
+  QuadBase* qb   = GetQuad(idx);
+  TObject* obj   = qb->fId.GetObject();
+  AliITSdigit* d = dynamic_cast<AliITSdigit*>(obj);
+  printf("ITSModule::QuadSelected "); Print();
+  printf("  idx=%d, value=%d, obj=0x%lx, digit=0x%lx\n",
+        idx, qb->fValue, (ULong_t)obj, (ULong_t)d);
+  if (d)
+    printf("  coord1=%3d coord2=%3d signal=%d\n",
+          d->GetCoord1(), d->GetCoord2(), d->GetSignal());
+
+}
+
+/**************************************************************************/
+
 void ITSModule::Print(Option_t* ) const
 {
   printf("ID %d, layer %d, ladder %d, det %d \n", fID, fLayer, fLadder, fDetID);