Line data Source code
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 : /* $Id$ */
17 :
18 : #include <Riostream.h>
19 :
20 : #include <TROOT.h>
21 : #include <TFile.h>
22 : #include <TSeqCollection.h>
23 : #include <TString.h>
24 : #include <TClonesArray.h>
25 :
26 : #include "AliHeader.h"
27 : #include "AliRun.h"
28 :
29 : #include "AliITS.h"
30 : #include "AliITSsDigitize.h"
31 : #include "AliITSgeom.h"
32 :
33 : /////////////////////////////////////////////////////////
34 : // //
35 : // //
36 : // //
37 : /////////////////////////////////////////////////////////
38 :
39 : using std::endl;
40 : using std::cout;
41 116 : ClassImp(AliITSsDigitize)
42 : //______________________________________________________________________
43 0 : AliITSsDigitize::AliITSsDigitize():
44 0 : fInit(kFALSE),
45 0 : fEnt(0),
46 0 : fEnt0(0),
47 0 : fITS(0),
48 0 : fRunLoader(0x0){
49 : // Default constructor.
50 : // Inputs:
51 : // none.
52 : // Outputs:
53 : // none.
54 : // Return:
55 : // A zero-ed constructed AliITSsDigitize class.
56 :
57 0 : fDet[0] = fDet[1] = fDet[2] = kTRUE;
58 0 : }
59 : //______________________________________________________________________
60 0 : AliITSsDigitize::AliITSsDigitize(const char* filename):
61 0 : fInit(),
62 0 : fEnt(0),
63 0 : fEnt0(0),
64 0 : fITS(0),
65 0 : fRunLoader(0x0){
66 : // Standard constructor.
67 : // Inputs:
68 : // const char* filename filename containing the digits to be
69 : // reconstructed. If filename = 0 (nil)
70 : // then no file is opened but a file is
71 : // assumed to already be opened. This
72 : // already opened file will be used.
73 : // Outputs:
74 : // none.
75 : // Return:
76 : // A standardly constructed AliITSsDigitize class.
77 :
78 0 : if(gAlice)
79 : {
80 0 : delete gAlice;
81 0 : gAlice = 0;
82 0 : }
83 0 : fRunLoader = AliRunLoader::Open(filename);
84 0 : fRunLoader->LoadgAlice();
85 0 : fRunLoader->LoadHeader();
86 :
87 :
88 0 : Init();
89 0 : }
90 : //______________________________________________________________________
91 0 : AliITSsDigitize::~AliITSsDigitize(){
92 : // Default constructor.
93 : // Inputs:
94 : // none.
95 : // Outputs:
96 : // none.
97 : // Return:
98 : // A destroyed AliITSsDigitize class.
99 :
100 0 : if(fRunLoader) delete fRunLoader;
101 0 : fITS = 0;
102 :
103 0 : }
104 : //______________________________________________________________________
105 : Bool_t AliITSsDigitize::Init(){
106 : // Class Initilizer.
107 : // Inputs:
108 : // none.
109 : // Outputs:
110 : // none.
111 : // Return:
112 : // kTRUE if no errors initilizing this class occurse else kFALSE
113 : //Int_t nparticles;
114 :
115 0 : fITS = (AliITS*) gAlice->GetDetector("ITS");
116 0 : if(!fITS){
117 0 : cout << "ITS not found aborting. fITS=" << fITS << endl;
118 0 : fInit = kFALSE;
119 0 : return fInit;
120 : } // end if !fITS
121 0 : if(!(fITS->GetITSgeom())){
122 0 : cout << "ITSgeom not found aborting."<< endl;
123 0 : fInit = kFALSE;
124 0 : return fInit;
125 : } // end if !GetITSgeom()
126 : // Now ready to init.
127 :
128 0 : fDet[0] = fDet[1] = fDet[2] = kTRUE;
129 0 : fEnt0 = 0;
130 0 : fEnt = AliRunLoader::Instance()->GetNumberOfEvents();
131 :
132 0 : AliLoader* loader = fRunLoader->GetLoader("ITSLoader");
133 :
134 0 : if(!loader->TreeS()){
135 0 : cout << "Having to create the SDigits Tree." << endl;
136 0 : loader->MakeTree("S");
137 0 : } // end if !gAlice->TreeS()
138 : //make branch
139 0 : fITS->MakeBranch("S");
140 0 : fITS->SetTreeAddress();
141 :
142 0 : fRunLoader->GetEvent(fEnt0);
143 : // finished init.
144 0 : fInit = InitSDig();
145 0 : return fInit;
146 0 : }
147 : //______________________________________________________________________
148 : Bool_t AliITSsDigitize::InitSDig() const {
149 : // Sets up SDigitization part of AliITSDetType..
150 : // Inputs:
151 : // none.
152 : // Outputs:
153 : // none.
154 : // Return:
155 : // none.
156 :
157 0 : return kTRUE;
158 : }
159 :
160 : //______________________________________________________________________
161 : void AliITSsDigitize::Digitize(const Option_t *opt){
162 : // Main SDigitization function.
163 : // Inputs:
164 : // Option_t * opt list of subdetector to digitize. =0 all.
165 : // Outputs:
166 : // none.
167 : // Return:
168 : // none.
169 : Option_t *lopt;
170 : Bool_t condition =kFALSE;
171 0 : if(opt){
172 0 : if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS"))condition =kTRUE;
173 : }
174 : else{
175 : condition = kTRUE;
176 : }
177 0 : if(condition){
178 0 : fDet[0] = fDet[1] = fDet[2] = kTRUE;
179 : lopt = "All";
180 0 : }else{
181 0 : fDet[0] = fDet[1] = fDet[2] = kFALSE;
182 0 : if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
183 0 : if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
184 0 : if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
185 0 : if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
186 : else lopt = opt;
187 : } // end if strstr(opt,...)
188 :
189 0 : if(!fInit){
190 0 : cout << "Initilization Failed, Can't run Digitize." << endl;
191 0 : return;
192 : } // end if !fInit
193 :
194 0 : fITS->HitsToSDigits(fRunLoader->GetHeader()->GetEvent(),0,-1," ",lopt," ");
195 0 : }
|