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