]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSsimulation.cxx
Modifications associated with remerging the Ba/Sa and Dubna pixel simulations,
[u/mrichter/AliRoot.git] / ITS / AliITSsimulation.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 #include "TClonesArray.h"
17
18 #include "AliITSsimulation.h"
19 #include "AliITSpList.h"
20
21 ClassImp(AliITSsimulation)
22
23 //______________________________________________________________________
24 AliITSsimulation::AliITSsimulation(): TObject(),
25 fResponse(0),
26 fSegmentation(0),
27 fpList(0),
28 fModule(0),
29 fEvent(0),
30 fDebug(0){
31     // Default constructor
32     // Inputs:
33     //    none.
34     // Outputs:
35     //    none.
36     // Return:
37     //    a default constructed AliITSsimulation class
38 }
39 //______________________________________________________________________
40 AliITSsimulation::AliITSsimulation(AliITSsegmentation *seg,
41                                    AliITSresponse *res): TObject(),
42 fResponse(res),
43 fSegmentation(seg),
44 fpList(0),
45 fModule(0),
46 fEvent(0),
47 fDebug(0){
48     // Default constructor
49     // Inputs:
50     //    AliITSsegmentation *seg  Segmentation class to be used
51     //    AliITSresponse     *res  Response class to be used.
52     // Outputs:
53     //    none.
54     // Return:
55     //    a default constructed AliITSsimulation class
56 }
57 //__________________________________________________________________________
58 AliITSsimulation::~AliITSsimulation(){
59     // destructor
60     // Inputs:
61     //    none.
62     // Outputs:
63     //    none.
64     // Return:
65     //    none.
66
67     fSegmentation = 0; // local copies of pointer, do not delete
68     fResponse     = 0; // local copies of pointer, do not delete
69     delete fpList;
70 }
71 //__________________________________________________________________________
72 AliITSsimulation::AliITSsimulation(const AliITSsimulation &s) : TObject(s){
73     //     Copy Constructor
74     // Inputs:
75     //    const AliITSsimulation &s  simulation class to copy from
76     // Outputs:
77     //    none.
78     // Return:
79     //    a standard constructed AliITSsimulation class with values the same
80     //    as that of s.
81  
82     *this = s;
83     return;
84 }
85
86 //_________________________________________________________________________
87 AliITSsimulation&  AliITSsimulation::operator=(const AliITSsimulation &s){
88     //    Assignment operator
89     // Inputs:
90     //    const AliITSsimulation &s  simulation class to copy from
91     // Outputs:
92     //    none.
93     // Return:
94     //    a standard constructed AliITSsimulation class with values the same
95     //    as that of s.
96
97     if(&s == this) return *this;
98     this->fResponse     = s.fResponse; 
99     this->fSegmentation = s.fSegmentation;
100     this->fModule       = s.fModule;
101     this->fEvent        = s.fEvent;
102     this->fpList        = s.fpList;
103     return *this;
104 }
105 //______________________________________________________________________
106 Bool_t AliITSsimulation::AddSDigitsToModule(TClonesArray *pItemA,Int_t mask ){
107     // Add Summable digits to module maps.
108     // Inputs:
109     //    TClonesArray *pItemA  Array of AliITSpListItems (SDigits).
110     //    Int_t         mask    Track number off set value (see 
111     //                          AliITSpList::AddItemTo).
112     // Outputs:
113     //    none.
114     // Return:
115     //    kTRUE if there is a signal >0 else kFALSE
116     Int_t nItems = pItemA->GetEntries();
117     Bool_t sig = kFALSE;
118  
119     // cout << "Adding "<< nItems <<" SDigits to module " << fModule << endl;
120     for( Int_t i=0; i<nItems; i++ ) {
121         AliITSpListItem * pItem = (AliITSpListItem *)(pItemA->At( i ));
122         if( pItem->GetModule() != fModule ) {
123             Error( "AddSDigitsToModule","Error reading, SDigits module %d "
124                    "!= current module %d: exit",
125                    pItem->GetModule(), fModule );
126             return sig;
127         } // end if
128         if(pItem->GetSignal()>0.0 ) sig = kTRUE;
129         fpList->AddItemTo( mask, pItem );
130     } // end for i
131     return sig;
132 }