]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsimulation.cxx
Added new creator which passes a pointer to type AliRun. Can now use either
[u/mrichter/AliRoot.git] / ITS / AliITSsimulation.cxx
index 04c40244bb85646254f2446aa99a2e9a8bd863b1..2a40f90e5e51c872b1da6ecdcb65054578618b96 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
+#include "TClonesArray.h"
+
 #include "AliITSsimulation.h"
+#include "AliITSpList.h"
 
-ClassImp(AliITSsimulation)     
+ClassImp(AliITSsimulation)
 
-AliITSsimulation::AliITSsimulation() 
-{
-  // constructor
-    fSegmentation=0;
-    fResponse=0;
+AliITSsimulation::AliITSsimulation(){
+    // constructor
+    fSegmentation = 0;
+    fResponse     = 0;
+    fpList        = 0;
+}
+//__________________________________________________________________________
+AliITSsimulation::~AliITSsimulation(){
+    // destructor
+    fSegmentation = 0; // local copies of pointer, do not delete
+    fResponse     = 0; // local copies of pointer, do not delete
+    delete fpList;
 }
-
 //__________________________________________________________________________
 AliITSsimulation::AliITSsimulation(const AliITSsimulation &source){
-  //     Copy Constructor 
-  if(&source == this) return;
-  this->fResponse = source.fResponse;
-  this->fSegmentation = source.fSegmentation;
-  return;
+    //     Copy Constructor 
+    if(&source == this) return;
+    this->fResponse     = source.fResponse;
+    this->fSegmentation = source.fSegmentation;
+    this->fModule       = source.fModule;
+    this->fEvent        = source.fEvent;
+    this->fpList        = source.fpList;
+    return;
 }
 
 //_________________________________________________________________________
-AliITSsimulation& 
-  AliITSsimulation::operator=(const AliITSsimulation &source) {
-  //    Assignment operator
-  if(&source == this) return *this;
-  this->fResponse = source.fResponse; 
-  this->fSegmentation = source.fSegmentation;
-  return *this;
+AliITSsimulation&  AliITSsimulation::operator=(const AliITSsimulation &source){
+    //    Assignment operator
+
+    if(&source == this) return *this;
+    this->fResponse     = source.fResponse; 
+    this->fSegmentation = source.fSegmentation;
+    this->fModule       = source.fModule;
+    this->fEvent        = source.fEvent;
+    this->fpList        = source.fpList;
+    return *this;
+}
+//______________________________________________________________________
+Bool_t AliITSsimulation::AddSDigitsToModule(TClonesArray *pItemA,Int_t mask ){
+    // Add Summable digits to module maps.
+    Int_t nItems = pItemA->GetEntries();
+    Bool_t sig = kFALSE;
+    // cout << "Adding "<< nItems <<" SDigits to module " << fModule << endl;
+    for( Int_t i=0; i<nItems; i++ ) {
+        AliITSpListItem * pItem = (AliITSpListItem *)(pItemA->At( i ));
+        if( pItem->GetModule() != fModule ) {
+            Error( "AddSDigitsToModule","Error reading, SDigits module %d "
+                  "!= current module %d: exit",
+                  pItem->GetModule(), fModule );
+            return sig;
+        } // end if
+       if(pItem->GetSignal()>0.0 ) sig = kTRUE;
+        fpList->AddItemTo( mask, pItem );
+    } // end for i
+    return sig;
 }