]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSsimulation.cxx
Use of appropriate sensor depending response objects in SPD simulation
[u/mrichter/AliRoot.git] / ITS / AliITSsimulation.cxx
index 04c40244bb85646254f2446aa99a2e9a8bd863b1..50570570431bebb5e57b92981e60b86611445a98 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
+//////////////////////////////////////////////////////////////////////////////
+// This is the base class for ITS detector signal simulations. Data members //
+// include are a pointer to the AliITSDetTypeSim clas in order to access    //
+// segmentation and response objects                                        // 
+// classes. See the detector specific implementations for the propper code. //
+//////////////////////////////////////////////////////////////////////////////
+#include "TClonesArray.h"
 
 #include "AliITSsimulation.h"
+#include "AliITSpList.h"
 
-ClassImp(AliITSsimulation)     
+ClassImp(AliITSsimulation)
 
-AliITSsimulation::AliITSsimulation() 
-{
-  // constructor
-    fSegmentation=0;
-    fResponse=0;
+//______________________________________________________________________
+AliITSsimulation::AliITSsimulation(): TObject(),
+fpList(0),
+fModule(0),
+fEvent(0),
+fDebug(0){
+    // Default constructor
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //    a default constructed AliITSsimulation class
+  fDetType = 0;
 }
+//______________________________________________________________________
+AliITSsimulation::AliITSsimulation(AliITSDetTypeSim *dettyp): TObject(),
+fpList(0),
+fModule(0),
+fEvent(0),
+fDebug(0){
+    // Default constructor
+    // Inputs:
+    //    AliITSDetTypeSim * : object used to access segmentation and response
+    // Outputs:
+    //    none.
+    // Return:
+    //    a default constructed AliITSsimulation class
+  fDetType = dettyp;
+}
+//__________________________________________________________________________
+AliITSsimulation::~AliITSsimulation(){
+    // destructor
+    // Inputs:
+    //    none.
+    // Outputs:
+    //    none.
+    // Return:
+    //    none.
 
+    if(fpList){
+      delete fpList;
+      fpList = 0;
+    }
+}
 //__________________________________________________________________________
-AliITSsimulation::AliITSsimulation(const AliITSsimulation &source){
-  //     Copy Constructor 
-  if(&source == this) return;
-  this->fResponse = source.fResponse;
-  this->fSegmentation = source.fSegmentation;
-  return;
+AliITSsimulation::AliITSsimulation(const AliITSsimulation &s) : TObject(s){
+    //     Copy Constructor
+    // Inputs:
+    //    const AliITSsimulation &s  simulation class to copy from
+    // Outputs:
+    //    none.
+    // Return:
+    //    a standard constructed AliITSsimulation class with values the same
+    //    as that of s.
+    *this = s;
+    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 &s){
+    //    Assignment operator
+    // Inputs:
+    //    const AliITSsimulation &s  simulation class to copy from
+    // Outputs:
+    //    none.
+    // Return:
+    //    a standard constructed AliITSsimulation class with values the same
+    //    as that of s.
+
+    if(&s == this) return *this;
+    this->fModule       = s.fModule;
+    this->fEvent        = s.fEvent;
+    this->fpList        = s.fpList;
+    return *this;
+}
+//______________________________________________________________________
+Bool_t AliITSsimulation::AddSDigitsToModule(TClonesArray *pItemA,Int_t mask ){
+    // Add Summable digits to module maps.
+    // Inputs:
+    //    TClonesArray *pItemA  Array of AliITSpListItems (SDigits).
+    //    Int_t         mask    Track number off set value (see 
+    //                          AliITSpList::AddItemTo).
+    // Outputs:
+    //    none.
+    // Return:
+    //    kTRUE if there is a signal >0 else kFALSE
+    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;
 }