]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliCalorimeter.cxx
Coding rule violations corrected.
[u/mrichter/AliRoot.git] / RALICE / AliCalorimeter.cxx
index cab2e10d0e13a19f736cf0090a39fd2c63672153..6548be65071e96e5c501a3c9aa72796095d0ed03 100644 (file)
@@ -62,7 +62,7 @@
 
 ClassImp(AliCalorimeter) // Class implementation to enable ROOT I/O
  
-AliCalorimeter::AliCalorimeter() : TObject()
+AliCalorimeter::AliCalorimeter() : TNamed()
 {
 // Default constructor, all parameters set to 0.
 // Create a calorimeter module matrix with fixed row and column size.
@@ -80,7 +80,7 @@ AliCalorimeter::AliCalorimeter() : TObject()
  fVetos=0;
  fAttributes=0;
  fPositions=0;
fName="Unspecified AliCalorimeter";
SetName("Unspecified");
 }
 ///////////////////////////////////////////////////////////////////////////
 AliCalorimeter::~AliCalorimeter()
@@ -123,7 +123,7 @@ AliCalorimeter::~AliCalorimeter()
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-AliCalorimeter::AliCalorimeter(Int_t nrow,Int_t ncol) : TObject()
+AliCalorimeter::AliCalorimeter(Int_t nrow,Int_t ncol) : TNamed()
 {
 // Create a calorimeter module matrix with fixed row and column size.
 // The modules at the edges are automatically marked as "edge modules".
@@ -162,10 +162,10 @@ AliCalorimeter::AliCalorimeter(Int_t nrow,Int_t ncol) : TObject()
 
  fVetos=0;
 
fName="Unspecified AliCalorimeter";
SetName("Unspecified");
 }
 ///////////////////////////////////////////////////////////////////////////
-AliCalorimeter::AliCalorimeter(AliCalorimeter& c) : TObject(c)
+AliCalorimeter::AliCalorimeter(AliCalorimeter& c) : TNamed(c)
 {
 // Copy constructor
  fClusters=0;
@@ -181,7 +181,6 @@ AliCalorimeter::AliCalorimeter(AliCalorimeter& c) : TObject(c)
 
  fNrows=c.fNrows;
  fNcolumns=c.fNcolumns;
- fName=c.fName;
 
  fSwap=c.fSwap;
 
@@ -200,23 +199,19 @@ AliCalorimeter::AliCalorimeter(AliCalorimeter& c) : TObject(c)
  }
 
  Int_t size=0;
- Int_t n=0;
- if (c.fAttributes)
- {
-  size=c.fAttributes->GetSize();
-  n=c.fAttributes->GetEntries();
- }
+ if (c.fAttributes) size=c.fAttributes->GetSize();
  if (size)
  {
   fAttributes=new TObjArray(size);
   fAttributes->SetOwner();
-  for (Int_t ia=0; ia<n; ia++)
+  for (Int_t ia=0; ia<size; ia++)
   {
    AliAttribObj* a=(AliAttribObj*)(c.fAttributes->At(ia));
-   if (a) fAttributes->Add(new AliAttribObj(*a));
+   if (a) fAttributes->AddAt(new AliAttribObj(*a),ia);
   }
  }
 
+ Int_t n=0;
  n=c.GetNclusters();
  if (n)
  {
@@ -290,6 +285,8 @@ void AliCalorimeter::SetSignal(Int_t row,Int_t col,Float_t sig)
  if (!m) // initialise for a new module
  {
   m=new AliCalmodule();
+  m->SetRow(row);
+  m->SetColumn(col);
   AliPosition* r=0;
   if (fPositions) r=(AliPositionObj*)fPositions->GetObject(row,col);
   if (r) m->SetPosition(*r);
@@ -308,7 +305,7 @@ void AliCalorimeter::SetSignal(Int_t row,Int_t col,Float_t sig)
   fMatrix->EnterObject(row,col,m);
  }
 
- m->SetSignal(row,col,sig);
+ m->SetSignal(sig);
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliCalorimeter::AddSignal(Int_t row, Int_t col, Float_t sig)
@@ -331,7 +328,7 @@ void AliCalorimeter::AddSignal(Int_t row, Int_t col, Float_t sig)
   }
   else
   {
-   m->AddSignal(row,col,sig);
+   m->AddSignal(sig);
   }
 }
 ///////////////////////////////////////////////////////////////////////////
@@ -396,7 +393,7 @@ void AliCalorimeter::AddSignal(AliCalmodule* mod)
  }
  else
  {
-  m->AddSignal(row,col,sig);
+  m->AddSignal(sig);
  }
 }
 ///////////////////////////////////////////////////////////////////////////
@@ -590,7 +587,7 @@ void AliCalorimeter::SetEdgeOn(Int_t row,Int_t col)
  {
   a=new AliAttribObj();
   a->SetEdgeOn(col);
-  fAttributes->AddAt(a,col-1);
+  fAttributes->AddAt(a,row-1);
  } 
 
  AliCalmodule* m=GetModule(row,col);
@@ -787,7 +784,7 @@ void AliCalorimeter::SetGain(Int_t row,Int_t col,Float_t gain)
  {
   a=new AliAttribObj();
   a->SetGain(gain,col);
-  fAttributes->AddAt(a,col-1);
+  fAttributes->AddAt(a,row-1);
  } 
 
  AliCalmodule* m=GetModule(row,col);
@@ -827,7 +824,7 @@ void AliCalorimeter::SetOffset(Int_t row,Int_t col,Float_t offset)
  {
   a=new AliAttribObj();
   a->SetOffset(offset,col);
-  fAttributes->AddAt(a,col-1);
+  fAttributes->AddAt(a,row-1);
  } 
 
  AliCalmodule* m=GetModule(row,col);
@@ -1534,19 +1531,20 @@ TH2F* AliCalorimeter::DrawModules(Float_t thresh,Int_t mode)
  
  Int_t nmods=GetNsignals();
 
- Float_t row,col,signal;
+ Int_t row,col;
+ Float_t signal;
  Int_t dead;
  for (Int_t i=1; i<=nmods; i++)
  {
   AliCalmodule* m=(AliCalmodule*)fMatrix->GetObject(i);
   if (m)
   {
-   row=float(m->GetRow());
-   col=float(m->GetColumn());
+   row=m->GetRow();
+   col=m->GetColumn();
    dead=m->GetDeadValue();
    signal=0;
    if (!dead) signal=GetSignal(row,col,mode);
-   if (signal>thresh) fHmodules->Fill(col,row,signal);
+   if (signal>thresh) fHmodules->Fill(float(col),float(row),signal);
   }
  }
  
@@ -1582,16 +1580,17 @@ TH2F* AliCalorimeter::DrawClusters(Float_t thresh)
  }
  
  AliCalcluster* c;
- Float_t row,col,signal;
+ Int_t row,col;
+ Float_t signal;
  for (Int_t i=0; i<GetNclusters(); i++)
  {
   c=(AliCalcluster*)fClusters->At(i);
   if (c)
   {
-   row=float(c->GetRow());
-   col=float(c->GetColumn());
+   row=c->GetRow();
+   col=c->GetColumn();
    signal=c->GetSignal();
-   if (signal>thresh) fHclusters->Fill(col,row,signal);
+   if (signal>thresh) fHclusters->Fill(float(col),float(row),signal);
   }
  }
  
@@ -1658,18 +1657,6 @@ AliSignal* AliCalorimeter::GetVetoSignal(Int_t i)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliCalorimeter::SetName(TString name)
-{
-// Set the name of the calorimeter system.
- fName=name;
-}
-///////////////////////////////////////////////////////////////////////////
-TString AliCalorimeter::GetName()
-{
-// Provide the name of the calorimeter system.
- return fName;
-}
-///////////////////////////////////////////////////////////////////////////
 void AliCalorimeter::SetSwapMode(Int_t swap)
 {
 // Set the swap mode for the module and position matrices.
@@ -1692,3 +1679,19 @@ Int_t AliCalorimeter::GetSwapMode()
  return fSwap;
 }
 ///////////////////////////////////////////////////////////////////////////
+TObject* AliCalorimeter::Clone(char* name)
+{
+// Make a deep copy of the current object and provide the pointer to the copy.
+// This memberfunction enables automatic creation of new objects of the
+// correct type depending on the object type, a feature which may be very useful
+// for containers like AliEvent when adding objects in case the
+// container owns the objects.
+
+ AliCalorimeter* cal=new AliCalorimeter(*this);
+ if (name)
+ {
+  if (strlen(name)) cal->SetName(name);
+ } 
+ return cal;
+}
+///////////////////////////////////////////////////////////////////////////