]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/EveDet/AliEveEMCALSModule.cxx
Fix compilation warning.
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveEMCALSModule.cxx
index 4335cb24ff792d2c7fc2a80c5cb41d9b68e649b0..7f2b39dd8eed855ebcbb9792bec960e8e53b9c25 100644 (file)
@@ -1,49 +1,48 @@
-//*************************************************************************
 // EMCAL event display
 // Visualization of an EMCAL super module.
 //
 //  Author: Magali Estienne (magali.estienne@cern.ch)
 //  June 30 2008
-//*************************************************************************
 
-#include <Riostream.h>
-#include <vector>
+#include "AliEveEMCALSModule.h"
+
+//#include <vector>
 
-#include <TEveTrans.h>
-#include <TEveElement.h>
 #include <TEveFrameBox.h>
 #include <TEveQuadSet.h>
 #include <TEvePointSet.h>
-#include <TClonesArray.h>
-#include <TVectorT.h>
-#include <TStyle.h>
-#include <TBuffer3DTypes.h>
-#include <TBuffer3D.h>
-#include <TVirtualPad.h>
-#include <TVirtualViewer3D.h>
 #include <TEveRGBAPalette.h>
 
-#include "AliEveEMCALData.h"
-#include "AliEveEMCALSModule.h"
-#include "AliEveEMCALSModuleData.h"
-#include "AliEMCALHit.h"
-#include "AliEMCALDigit.h"
 
+class Riostream;
+//class vector;
+class TEveTrans;
+class TEveElement;
+class TClonesArray;
+class TStyle;
+class TBuffer3DTypes;
+class TBuffer3D;
+class TVirtualPad;
+class TVirtualViewer3D;
+class AliEveEMCALData;
+class AliEMCALHit;
+class AliEMCALDigit;
+class AliEveEMCALSModuleData;
 
 ClassImp(AliEveEMCALSModule)
 
-Bool_t AliEveEMCALSModule::fStaticInit = kFALSE;
-
-TEveFrameBox*    AliEveEMCALSModule::fFrameBigBox = 0;
-TEveFrameBox*    AliEveEMCALSModule::fFrameSmallBox = 0;
-TEveRGBAPalette* AliEveEMCALSModule::fFrameDigPalette = 0;
-TEveRGBAPalette* AliEveEMCALSModule::fFrameCluPalette = 0;
+Bool_t           AliEveEMCALSModule::fgStaticInit = kFALSE;
+Float_t          AliEveEMCALSModule::fgSMBigBBox[3];
+Float_t          AliEveEMCALSModule::fgSMSmallBBox[3];
+TEveFrameBox*    AliEveEMCALSModule::fgFrameBigBox = 0;
+TEveFrameBox*    AliEveEMCALSModule::fgFrameSmallBox = 0;
+TEveRGBAPalette* AliEveEMCALSModule::fgFrameDigPalette = 0;
+TEveRGBAPalette* AliEveEMCALSModule::fgFrameCluPalette = 0;
 
 AliEveEMCALSModule::AliEveEMCALSModule(Int_t smid, const Text_t* n, const Text_t* t) :
   TEveElement(fFrameColor),
   TNamed(n,t),
   TAtt3D(),
-  TAttBBox(),
   fEMCALData(0),
   fEMCALSModuleData(0),
   fFrameColor((Color_t)10),
@@ -58,16 +57,12 @@ AliEveEMCALSModule::AliEveEMCALSModule(Int_t smid, const Text_t* n, const Text_t
   // Constructor.
   Char_t name[256];
   if (smid < 10) {
-    sprintf(name,"Full Super Module %02d",smid);
+    snprintf(name,256,"Full Super Module %02d",smid);
   } else {
-    sprintf(name,"Half Super Module %02d",smid);
+    snprintf(name,256,"Half Super Module %02d",smid);
   }
   SetName(name);
 
-  for(Int_t i=0; i<3; i++) fSMBigBBox[i] = 0.;
-  for(Int_t i=0; i<3; i++) fSMSmallBBox[i] = 0.;
-  for(Int_t i=0; i<3; i++) fSMBBoxCenter[i] = 0.;
-
   // Hits
   fPointSet->IncDenyDestroy();
   AddElement(fPointSet);
@@ -84,7 +79,6 @@ AliEveEMCALSModule::AliEveEMCALSModule(const AliEveEMCALSModule &esm) :
   TEveElement(fFrameColor),
   TNamed(),
   TAtt3D(),
-  TAttBBox(),
   fEMCALData(esm.fEMCALData),
   fEMCALSModuleData(esm.fEMCALSModuleData),
   fFrameColor(esm.fFrameColor),
@@ -99,16 +93,12 @@ AliEveEMCALSModule::AliEveEMCALSModule(const AliEveEMCALSModule &esm) :
   // Copy constructor.
   Char_t name[256];
   if (fSModuleID < 10) {
-    sprintf(name,"Full Super Module %02d",fSModuleID);
+    snprintf(name,256,"Full Super Module %02d",fSModuleID);
   } else {
-    sprintf(name,"Half Super Module %02d",fSModuleID);
+    snprintf(name,256,"Half Super Module %02d",fSModuleID);
   }
   SetName(name);
 
-  for(Int_t i=0; i<3; i++) fSMBigBBox[i] = 0.;
-  for(Int_t i=0; i<3; i++) fSMSmallBBox[i] = 0.;
-  for(Int_t i=0; i<3; i++) fSMBBoxCenter[i] = 0.;
-
   // Hits
   fPointSet->IncDenyDestroy();
   AddElement(fPointSet);
@@ -132,21 +122,10 @@ AliEveEMCALSModule::~AliEveEMCALSModule()
   fQuadSet2->DecDenyDestroy();
 
   if(fEMCALData) fEMCALData->DecRefCount();
-  /*
-  // These are static so should not be deleted.
-  // Also, they are reference counted so DecRefCount() should be called.
-  // However, due to incomprehensible way of their initialization in ComputeBBox()
-  // it is better to just leave them.
-  // This should be cleaned up.
-  if(fFrameBigBox)   fFrameBigBox->Delete();
-  if(fFrameSmallBox) fFrameSmallBox->Delete();
-  if(fFrameDigPalette) fFrameDigPalette->Delete();
-  if(fFrameCluPalette) fFrameCluPalette->Delete();
-  */
 }
 
 //______________________________________________________________________________
-void AliEveEMCALSModule::DropData()
+void AliEveEMCALSModule::DropData() const
 {
   //
   // release the sm data
@@ -161,41 +140,33 @@ void AliEveEMCALSModule::DropData()
 }
 
 //______________________________________________________________________________
-void AliEveEMCALSModule::ComputeBBox()
+void AliEveEMCALSModule::InitStatics(AliEveEMCALSModuleData* md)
 {
   //
   // Bounding box, Framebox and Palette
   //
 
-  fEMCALSModuleData->GetSModuleBigBox(fSMBigBBox[0],fSMBigBBox[1], fSMBigBBox[2]);
-  fEMCALSModuleData->GetSModuleSmallBox(fSMSmallBBox[0],fSMSmallBBox[1], fSMSmallBBox[2]);
-
-  if (fStaticInit) return;
-  fStaticInit = kTRUE;
-
-  fFrameBigBox = new TEveFrameBox();
-  fFrameBigBox->SetAABoxCenterHalfSize(0, 0, 0, fSMBigBBox[0], fSMBigBBox[1], fSMBigBBox[2]);
-  fFrameBigBox->SetFrameColor((Color_t)10);
-  fFrameDigPalette = new TEveRGBAPalette(0,512);
-  fFrameDigPalette->SetLimits(0, 1024);
-  fFrameDigPalette->IncRefCount();
-
-  fFrameSmallBox = new TEveFrameBox();
-  fFrameSmallBox->SetAABoxCenterHalfSize(0, 0, 0, fSMSmallBBox[0], fSMSmallBBox[1], fSMSmallBBox[2]);
-  fFrameSmallBox->SetFrameColor((Color_t)10);
-  fFrameCluPalette  = new TEveRGBAPalette(0,512);
-  fFrameCluPalette->SetLimits(0, 1024);
-  fFrameCluPalette->IncRefCount();
-
-  BBoxInit();
-
-  fBBox[0] = - 2*fSMBigBBox[0];
-  fBBox[1] = + 2*fSMBigBBox[0];
-  fBBox[2] = - 2*fSMBigBBox[1];
-  fBBox[3] = + 2*fSMBigBBox[1];
-  fBBox[4] = - 2*fSMBigBBox[2];
-  fBBox[5] = + 2*fSMBigBBox[2];
-
+  if (fgStaticInit) return;
+  fgStaticInit = kTRUE;
+
+  md->GetSModuleBigBox(fgSMBigBBox[0],fgSMBigBBox[1], fgSMBigBBox[2]);
+  md->GetSModuleSmallBox(fgSMSmallBBox[0],fgSMSmallBBox[1], fgSMSmallBBox[2]);
+
+  fgFrameBigBox = new TEveFrameBox();
+  fgFrameBigBox->SetAABoxCenterHalfSize(0, 0, 0, fgSMBigBBox[0], fgSMBigBBox[1], fgSMBigBBox[2]);
+  fgFrameBigBox->SetFrameColor((Color_t)10);
+  fgFrameBigBox->IncRefCount();
+  fgFrameDigPalette = new TEveRGBAPalette(0,512);
+  fgFrameDigPalette->SetLimits(0, 1024);
+  fgFrameDigPalette->IncRefCount();
+
+  fgFrameSmallBox = new TEveFrameBox();
+  fgFrameSmallBox->SetAABoxCenterHalfSize(0, 0, 0, fgSMSmallBBox[0], fgSMSmallBBox[1], fgSMSmallBBox[2]);
+  fgFrameSmallBox->SetFrameColor((Color_t)10);
+  fgFrameSmallBox->IncRefCount();
+  fgFrameCluPalette  = new TEveRGBAPalette(0,512);
+  fgFrameCluPalette->SetLimits(0, 1024);
+  fgFrameCluPalette->IncRefCount();
 }
 
 //______________________________________________________________________________
@@ -219,7 +190,7 @@ void AliEveEMCALSModule::SetHitSize(Int_t size)
 }
 
 //______________________________________________________________________________
-void AliEveEMCALSModule::SetDataSource(AliEveEMCALData* data)
+void AliEveEMCALSModule::SetDataSource(AliEveEMCALData* const data)
 {
   //
   // Set source of data.
@@ -277,20 +248,22 @@ void AliEveEMCALSModule::UpdateQuads()
   
   */
 
-  if (fEMCALSModuleData != 0) {
-    
-    // digits ------------------------
 
-    // Define TEveQuadSet for digits
-    fQuadSet->SetOwnIds(kTRUE);
-    fQuadSet->Reset(TEveQuadSet::kQT_RectangleYZFixedDimX, kFALSE, 32);
+  if (!fgStaticInit)
+    InitStatics(fEMCALSModuleData);
+
+  // digits ------------------------
+
+   // Define TEveQuadSet for digits
+   fQuadSet->SetOwnIds(kTRUE);
+  fQuadSet->Reset(TEveQuadSet::kQT_RectangleYZFixedDimX, kFALSE, 32);
     fQuadSet->SetDefWidth (fEMCALSModuleData->GetPhiTileSize());
     fQuadSet->SetDefHeight(fEMCALSModuleData->GetEtaTileSize());
     fQuadSet->RefMainTrans().SetFrom(*fEMCALSModuleData->GetSModuleMatrix());
-    fQuadSet->SetPalette(fFrameDigPalette);
+    fQuadSet->SetPalette(fgFrameDigPalette);
     if(smId<fEMCALSModuleData->GetNsmf()) 
-      fQuadSet->SetFrame(fFrameBigBox);
-    else fQuadSet->SetFrame(fFrameSmallBox);
+      fQuadSet->SetFrame(fgFrameBigBox);
+    else fQuadSet->SetFrame(fgFrameSmallBox);
 
     // Get the digit information from the buffer
     bufferDigit = fEMCALSModuleData->GetDigitBuffer();
@@ -329,7 +302,7 @@ void AliEveEMCALSModule::UpdateQuads()
          hitY = bufferHit[ih][4];
          hitZ = bufferHit[ih][5];
          fPointSet->SetPoint(ih,hitX,hitY,hitZ);
-         sprintf(form,"N=%d", fPointSet->Size());
+         snprintf(form,1000,"N=%d", fPointSet->Size());
          fPointSet->SetTitle(form);
          fPointSet->SetMarkerSize(.5);
          fPointSet->SetMarkerColor((Color_t)2);
@@ -345,10 +318,10 @@ void AliEveEMCALSModule::UpdateQuads()
     fQuadSet2->SetDefWidth (fEMCALSModuleData->GetPhiTileSize());
     fQuadSet2->SetDefHeight(fEMCALSModuleData->GetEtaTileSize());
     fQuadSet2->RefMainTrans().SetFrom(*fEMCALSModuleData->GetSModuleMatrix());
-    fQuadSet2->SetPalette(fFrameCluPalette);
+    fQuadSet2->SetPalette(fgFrameCluPalette);
     if(smId<fEMCALSModuleData->GetNsmf()) 
-      fQuadSet2->SetFrame(fFrameBigBox);
-    else fQuadSet2->SetFrame(fFrameSmallBox);
+      fQuadSet2->SetFrame(fgFrameBigBox);
+    else fQuadSet2->SetFrame(fgFrameSmallBox);
 
     // Get the cluster information from the buffer
     bufferCluster = fEMCALSModuleData->GetClusterBuffer();
@@ -381,8 +354,6 @@ void AliEveEMCALSModule::UpdateQuads()
       }
     else { if (fDebug) printf("There is no clusters in SM %d \n", smId); }
 
-  } // end if (fEMCALSModuleData != 0)
-
 }
 
 //______________________________________________________________________________