]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/EveDet/AliEveEMCALSModule.cxx
- use base class for multidimensional objects
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveEMCALSModule.cxx
index 5ffc7dcc3a0fee61a88e7c9a1ceca55e6dd89dc4..2d1c668bd7c1d307be070ec6192e68fa98bd46ee 100644 (file)
@@ -4,18 +4,18 @@
 //  Author: Magali Estienne (magali.estienne@cern.ch)
 //  June 30 2008
 
-#include "AliEveEMCALSModule.h"
-
-//#include <vector>
+#include <iostream>
+#include <vector>
 
+#include <TString.h>
 #include <TEveFrameBox.h>
 #include <TEveQuadSet.h>
 #include <TEvePointSet.h>
 #include <TEveRGBAPalette.h>
 
+#include "AliEveEMCALSModule.h"
 
 class Riostream;
-//class vector;
 class TEveTrans;
 class TEveElement;
 class TClonesArray;
@@ -57,9 +57,9 @@ 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);
 
@@ -93,9 +93,9 @@ 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);
 
@@ -222,9 +222,9 @@ void AliEveEMCALSModule::UpdateQuads()
   // Update hit/digit/cluster representation.
   //
 
-  vector< vector<Double_t> > bufferDigit;
-  vector< vector<Double_t> > bufferCluster;
-  vector< vector<Float_t> > bufferHit;
+  std::vector< std::vector<Double_t> > bufferDigit;
+  std::vector< std::vector<Double_t> > bufferCluster;
+  std::vector< std::vector<Float_t> > bufferHit;
   Int_t nDigits, nClusters, nHits, oldSize;
   Float_t hitX, hitY, hitZ;
   Int_t smId = fEMCALSModuleData->GetSmId();
@@ -248,16 +248,15 @@ void AliEveEMCALSModule::UpdateQuads()
   
   */
 
-  if (fEMCALSModuleData != 0) {
 
-    if (!fgStaticInit)
-      InitStatics(fEMCALSModuleData);
+  if (!fgStaticInit)
+    InitStatics(fEMCALSModuleData);
 
-    // digits ------------------------
+  // digits ------------------------
 
-    // Define TEveQuadSet for digits
-    fQuadSet->SetOwnIds(kTRUE);
-    fQuadSet->Reset(TEveQuadSet::kQT_RectangleYZFixedDimX, kFALSE, 32);
+   // 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());
@@ -271,7 +270,7 @@ void AliEveEMCALSModule::UpdateQuads()
     if(!bufferDigit.empty())
       {
        nDigits = fEMCALSModuleData->GetNDigits();
-       if(fDebug>1) cout << "nDigits: " << nDigits << endl;
+    if(fDebug>1) Info("AliEveEMCALSModule::UpdateQuads", "nDigits: %d", nDigits );
        // loop over digits
        for (Int_t id = 0; id < nDigits; id++) {
          //      Int_t iid = (Int_t)bufferDigit[id][0];
@@ -287,7 +286,7 @@ void AliEveEMCALSModule::UpdateQuads()
          fQuadSet->QuadValue(amp);
        } // end digits loop
       }
-    else { if (fDebug) printf("There is no digits in SM %d \n", smId); }
+    else { if (fDebug) Info("AliEveEMCALSModule::UpdateQuads", "There is no digits in SM %d \n", smId); }
 
     // hits --------------------------
     bufferHit = fEMCALSModuleData->GetHitBuffer();
@@ -295,7 +294,7 @@ void AliEveEMCALSModule::UpdateQuads()
       {
        char form[1000];
        nHits = fEMCALSModuleData->GetNHits();
-       if(fDebug>1) cout << "nHits: " << nHits << endl;
+    if(fDebug>1) Info("AliEveEMCALSModule::UpdateQuads", "nHits: %d", nHits);
        oldSize = fPointSet->GrowFor(nHits);
        // Loop over hits
        for (Int_t ih = 0; ih < nHits; ih++) {
@@ -303,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);
@@ -329,15 +328,15 @@ void AliEveEMCALSModule::UpdateQuads()
     if(!bufferCluster.empty())
       {
        nClusters = fEMCALSModuleData->GetNClusters();
-       if(fDebug>1) cout << "nClusters: " << nClusters << endl;
+    if(fDebug>1) Info("AliEveEMCALSModule::UpdateQuads", "nClusters: %d", nClusters );
        // loop over clusters
        for (Int_t id = 0; id < nClusters; id++) {
          if(fDebug>1) {
-           cout << "bufferCluster[" << id << "][0]: " << bufferCluster[id][0] << endl;
-           cout << "bufferCluster[" << id << "][1]: " << bufferCluster[id][1] << endl;
-           cout << "bufferCluster[" << id << "][2]: " << bufferCluster[id][2] << endl;
-           cout << "bufferCluster[" << id << "][3]: " << bufferCluster[id][3] << endl;
-           cout << "bufferCluster[" << id << "][4]: " << bufferCluster[id][4] << endl;
+        Info("AliEveEMCALSModule::UpdateQuads", "bufferCluster[%d][0]: %f", id, bufferCluster[id][0] );
+        Info("AliEveEMCALSModule::UpdateQuads", "bufferCluster[%d][1]: %f", id, bufferCluster[id][1] );
+        Info("AliEveEMCALSModule::UpdateQuads", "bufferCluster[%d][2]: %f", id, bufferCluster[id][2] );
+        Info("AliEveEMCALSModule::UpdateQuads", "bufferCluster[%d][3]: %f", id, bufferCluster[id][3] );
+        Info("AliEveEMCALSModule::UpdateQuads", "bufferCluster[%d][4]: %f", id, bufferCluster[id][4] );
          }
          //      Int_t isupMod = (Int_t)bufferCluster[id][0];
          Double_t iamp = bufferCluster[id][1];
@@ -353,9 +352,7 @@ void AliEveEMCALSModule::UpdateQuads()
 
        } // end clusters loop
       }
-    else { if (fDebug) printf("There is no clusters in SM %d \n", smId); }
-
-  } // end if (fEMCALSModuleData != 0)
+    else { if (fDebug) Info("AliEveEMCALSModule::UpdateQuads", "There is no clusters in SM %d \n", smId); }
 
 }