]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSMapA1.cxx
Savannah bug 59091 (A. Dainese)
[u/mrichter/AliRoot.git] / ITS / AliITSMapA1.cxx
index 787d5759646ac2f5a670ae41dd66dfcf430b2130..a1e94bd3a3b93d107a0831e67bbec5306b12b34f 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 #include <TObjArray.h>
-#include <TMath.h>
-
 #include "AliITSMapA1.h"
 #include "AliITSsegmentation.h"
-#include "AliITSresponse.h"
 #include "AliITSdigit.h"
 
 ////////////////////////////////////////////////////////////////////////
 
 ClassImp(AliITSMapA1)
 //______________________________________________________________________
-AliITSMapA1::AliITSMapA1(){
+AliITSMapA1::AliITSMapA1():
+fSegmentation(0),
+fNpx(0),
+fNpz(0),
+fObjects(0),
+fNobjects(0),
+fMaxIndex(0),
+fMapThresholdArr(0),
+fHitMap(0),
+fMapThreshold(0){
     // default constructor
 
-    fSegmentation = 0;
-    fNpz          = 0;
-    fNpx          = 0;
-    fMaxIndex     = 0;
-    fHitMap       = 0;
-    fObjects      = 0;
-    fNobjects     = 0;
-    fMapThreshold = 0;
 }
 //______________________________________________________________________
-AliITSMapA1::AliITSMapA1(AliITSsegmentation *seg){
+AliITSMapA1::AliITSMapA1(AliITSsegmentation *seg):
+fSegmentation(seg),
+fNpx(0),
+fNpz(0),
+fObjects(0),
+fNobjects(0),
+fMaxIndex(0),
+fMapThresholdArr(0),
+fHitMap(0),
+fMapThreshold(0){
     //constructor
 
-    fSegmentation = seg;
     fNpz          = fSegmentation->Npz();
     fNpx          = fSegmentation->Npx();
     fMaxIndex     = fNpz*fNpx+fNpx;             // 2 halves of detector
     fHitMap       = new Int_t[fMaxIndex];
-    fObjects      = 0;
-    fNobjects     = 0;
-    fMapThreshold = 0;
     ClearMap();
 }
 //______________________________________________________________________
-AliITSMapA1::AliITSMapA1(AliITSsegmentation *seg, TObjArray *obj){
+AliITSMapA1::AliITSMapA1(AliITSsegmentation *seg, TObjArray *obj):
+fSegmentation(seg),
+fNpx(0),
+fNpz(0),
+fObjects(obj),
+fNobjects(0),
+fMaxIndex(0),
+fMapThresholdArr(0),
+fHitMap(0),
+fMapThreshold(0){
     //constructor
 
-    fNobjects     = 0;
-    fSegmentation = seg;
-    fNpz          = fSegmentation->Npz();
-    fNpx          = fSegmentation->Npx();
-    fMaxIndex     = fNpz*fNpx+fNpx;             // 2 halves of detector
-    fHitMap       = new Int_t[fMaxIndex];
-    fObjects      =  obj;
-    if(fObjects) fNobjects = fObjects->GetEntriesFast();
-    fMapThreshold = 0;
-    ClearMap();
+  fNpz          = fSegmentation->Npz();
+  fNpx          = fSegmentation->Npx();
+  fMaxIndex     = fNpz*fNpx+fNpx;             // 2 halves of detector
+  fHitMap       = new Int_t[fMaxIndex];
+  if(fObjects) fNobjects = fObjects->GetEntriesFast();
+  ClearMap();
 }
 //______________________________________________________________________
-AliITSMapA1::AliITSMapA1(AliITSsegmentation *seg, TObjArray *obj, Int_t thr){
+AliITSMapA1::AliITSMapA1(AliITSsegmentation *seg, TObjArray *obj, Int_t thr):
+fSegmentation(seg),
+fNpx(0),
+fNpz(0),
+fObjects(obj),
+fNobjects(0),
+fMaxIndex(0),
+fMapThresholdArr(0),
+fHitMap(0),
+fMapThreshold(thr){
     //constructor
 
-    fNobjects     = 0;
-    fSegmentation = seg;
-    fNpz          = fSegmentation->Npz();
-    fNpx          = fSegmentation->Npx();
-    fMaxIndex     = fNpz*fNpx+fNpx;             // 2 halves of detector
-    fHitMap       = new Int_t[fMaxIndex];
-    fObjects      =  obj;
-    if(fObjects) fNobjects = fObjects->GetEntriesFast();
-    fMapThreshold = thr;
-    ClearMap();
+  fNpz          = fSegmentation->Npz();
+  fNpx          = fSegmentation->Npx();
+  fMaxIndex     = fNpz*fNpx+fNpx;             // 2 halves of detector
+  fHitMap       = new Int_t[fMaxIndex];
+  if(fObjects) fNobjects = fObjects->GetEntriesFast();
+  ClearMap();
+}
+//______________________________________________________________________
+AliITSMapA1::AliITSMapA1(AliITSsegmentation *seg, TObjArray *obj, TArrayI thr):
+fSegmentation(seg),
+fNpx(0),
+fNpz(0),
+fObjects(obj),
+fNobjects(0),
+fMaxIndex(0),
+fMapThresholdArr(thr),
+fHitMap(0),
+fMapThreshold(0){
+    //constructor
+
+  fNpz          = fSegmentation->Npz();
+  fNpx          = fSegmentation->Npx();
+  fMaxIndex     = fNpz*fNpx+fNpx;             // 2 halves of detector
+  fHitMap       = new Int_t[fMaxIndex];
+  if(fObjects) fNobjects = fObjects->GetEntriesFast();
+  ClearMap();
 }
+
 //______________________________________________________________________
 AliITSMapA1::~AliITSMapA1(){
     //destructor
@@ -96,22 +130,23 @@ AliITSMapA1::~AliITSMapA1(){
 AliITSMapA1& AliITSMapA1::operator=(const AliITSMapA1 &source) {
     //    Assignment operator
 
-    if(&source == this) return *this;
-
-    this->fNpx          = source.fNpx;
-    this->fNpz          = source.fNpz;
-    this->fObjects      = source.fObjects;
-    this->fNobjects     = source.fNobjects;
-    this->fMaxIndex     = source.fMaxIndex;
-    this->fHitMap       = source.fHitMap;
-    this->fMapThreshold = source.fMapThreshold;
-    return *this;
+  this->~AliITSMapA1();
+  new(this) AliITSMapA1(source);
+  return *this;
 }
 //______________________________________________________________________
-AliITSMapA1::AliITSMapA1(const AliITSMapA1 &source) : AliITSMap(source){
-    //     Copy Constructor
-
-    *this = source;
+AliITSMapA1::AliITSMapA1(const AliITSMapA1 &source) : AliITSMap(source),
+fSegmentation(source.fSegmentation),
+fNpx(source.fNpx),
+fNpz(source.fNpz),
+fObjects(source.fObjects),
+fNobjects(source.fNobjects),
+fMaxIndex(source.fMaxIndex),
+fMapThresholdArr(source.fMapThresholdArr),
+fHitMap(source.fHitMap),
+fMapThreshold(source.fMapThreshold){
+  //     Copy Constructor
+  
 }
 //______________________________________________________________________
 void AliITSMapA1::ClearMap(){
@@ -156,6 +191,22 @@ void  AliITSMapA1::FillMap(){
        } // end if fSignal > fMapthreshold
     } // end for ndig
 }
+//______________________________________________________________________
+void  AliITSMapA1::FillMap2(){
+    // fill array with digits indices
+
+    Int_t ndigits = fObjects->GetEntriesFast();
+    if (!ndigits) return;
+
+    AliITSdigit *dig;
+    for (Int_t ndig=0; ndig<ndigits; ndig++) {
+       dig = (AliITSdigit*)fObjects->UncheckedAt(ndig);
+       if(dig->GetSignal() > fMapThresholdArr[dig->GetCoord1()]) {
+           SetHit(dig->GetCoord1(),dig->GetCoord2(),ndig);
+       } // end if fSignal > fMapthreshold
+    } // end for ndig
+}
+
 //______________________________________________________________________
 void  AliITSMapA1::SetHit(Int_t iz, Int_t ix, Int_t idigit){
     // set the digit index at a certain position in array
@@ -181,7 +232,7 @@ Int_t AliITSMapA1::GetHitIndex(Int_t iz, Int_t ix) const {
     return TMath::Abs(fHitMap[CheckedIndex(iz, ix)])-1;
 }
 //______________________________________________________________________
-TObject* AliITSMapA1::GetHit(Int_t iz, Int_t ix){
+TObject* AliITSMapA1::GetHit(Int_t iz, Int_t ix) const {
     // return the pointer to the digit 
 
     Int_t index=GetHitIndex(iz,ix);
@@ -189,7 +240,7 @@ TObject* AliITSMapA1::GetHit(Int_t iz, Int_t ix){
     return (index <0) ? 0 : fObjects->UncheckedAt(GetHitIndex(iz,ix));
 }
 //______________________________________________________________________
-Double_t AliITSMapA1::GetSignal(Int_t iz, Int_t ix){
+Double_t AliITSMapA1::GetSignal(Int_t iz, Int_t ix) const{
     // get a pad signal
     Double_t signal;
 
@@ -199,7 +250,7 @@ Double_t AliITSMapA1::GetSignal(Int_t iz, Int_t ix){
     return signal;
 }
 //______________________________________________________________________
-FlagType AliITSMapA1::TestHit(Int_t iz, Int_t ix){
+FlagType AliITSMapA1::TestHit(Int_t iz, Int_t ix)  {
     // check whether the digit has already been flagged
 
     if (CheckedIndex(iz, ix) < 0) return kEmpty;