]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PMD/AliPMD.cxx
Possibility to specify user defined OCDB path for
[u/mrichter/AliRoot.git] / PMD / AliPMD.cxx
CommitLineData
4c039060 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$ */
4c039060 17
fe4da5cc 18///////////////////////////////////////////////////////////////////////////////
6edc06da 19//
fe4da5cc 20// //
21// Photon Multiplicity Detector //
22// This class contains the basic functions for the Photon Multiplicity //
23// Detector. Functions specific to one particular geometry are //
24// contained in the derived classes //
25// //
26//Begin_Html
27/*
1439f98e 28<img src="picts/AliPMDClass.gif">
fe4da5cc 29</pre>
30<br clear=left>
31<font size=+2 color=red>
32<p>The responsible person for this module is
33<a href="mailto:sub@vecdec.veccal.ernet.in">Subhasis Chattopadhyay</a>.
34</font>
35<pre>
36*/
37//End_Html
38// //
39///////////////////////////////////////////////////////////////////////////////
40
4fa198c6 41#include <TClonesArray.h>
88cb7938 42#include <TTree.h>
43#include <TVirtualMC.h>
94de3818 44
ecee2a1a 45#include "AliLog.h"
88cb7938 46#include "AliLoader.h"
895a906e 47#include "AliPMDLoader.h"
88cb7938 48#include "AliPMD.h"
88cb7938 49#include "AliRun.h"
5d12ce38 50#include "AliMC.h"
85a5290f 51#include "AliPMDDigitizer.h"
895a906e 52#include "AliPMDhit.h"
c39d2a93 53#include "AliPMDDDLRawData.h"
68a330f6 54#include "AliPMDRawToSDigits.h"
4fa198c6 55
fe4da5cc 56ClassImp(AliPMD)
57
58//_____________________________________________________________________________
59AliPMD::AliPMD()
60{
61 //
62 // Default constructor
63 //
64 fIshunt = 0;
0cc62300 65
fe4da5cc 66}
67
68//_____________________________________________________________________________
69AliPMD::AliPMD(const char *name, const char *title)
70 : AliDetector(name,title)
71{
72 //
73 // Default constructor
74 //
75
76 //
77 // Allocate the array of hits
78 fHits = new TClonesArray("AliPMDhit", 405);
5d12ce38 79 gAlice->GetMCApp()->AddHitList(fHits);
4fa198c6 80
4fa198c6 81
4187e4de 82 fIshunt = 0;
fe4da5cc 83
84 fPar[0] = 1;
85 fPar[1] = 1;
86 fPar[2] = 0.8;
87 fPar[3] = 0.02;
88 fIn[0] = 6;
89 fIn[1] = 20;
90 fIn[2] = 600;
91 fIn[3] = 27;
92 fIn[4] = 27;
93 fGeo[0] = 0;
94 fGeo[1] = 0.2;
95 fGeo[2] = 4;
96 fPadSize[0] = 0.8;
97 fPadSize[1] = 1.0;
98 fPadSize[2] = 1.2;
99 fPadSize[3] = 1.5;
100}
101
1661e612 102AliLoader* AliPMD::MakeLoader(const char* topfoldername)
103{
895a906e 104 // Makes PMD Loader
1661e612 105
895a906e 106 fLoader = new AliPMDLoader(GetName(),topfoldername);
1661e612 107
895a906e 108 if (fLoader)
109 {
2dcb8f31 110 AliDebug(100,"Success");
895a906e 111 }
112 else
113 {
ecee2a1a 114 AliError("Failure");
895a906e 115 }
1661e612 116
895a906e 117 return fLoader;
1661e612 118}
119
4fa198c6 120AliPMD::~AliPMD()
121{
122 //
30fdb6d0 123 // Destructor
4fa198c6 124 //
4fa198c6 125}
126
fe4da5cc 127//_____________________________________________________________________________
128void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
129{
130 //
131 // Add a PMD hit
132 //
133 TClonesArray &lhits = *fHits;
134 AliPMDhit *newcell, *curcell;
41c97e7a 135 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d %d %d %d %d\n",
136 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3],
137 // vol[4],vol[5],vol[6],vol[7]);
138
fe4da5cc 139 newcell = new AliPMDhit(fIshunt, track, vol, hits);
140 Int_t i;
141 for (i=0; i<fNhits; i++) {
142 //
143 // See if this cell has already been hit
144 curcell=(AliPMDhit*) lhits[i];
145 if (*curcell==*newcell) {
6edc06da 146// printf("Cell with same numbers found\n") ; curcell->Print();
fe4da5cc 147 *curcell = *curcell+*newcell;
6edc06da 148// printf("Cell after addition\n") ; curcell->Print();
fe4da5cc 149 delete newcell;
150 return;
151 }
152 }
153 new(lhits[fNhits++]) AliPMDhit(newcell);
154 delete newcell;
155}
156
fe4da5cc 157//_____________________________________________________________________________
158void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
159{
160 //
161 // Set PMD parameters
162 //
163 fPar[0] = p1;
164 fPar[1] = p2;
165 fPar[2] = p3;
166 fPar[3] = p4;
167}
168
169//_____________________________________________________________________________
170void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
171{
172 //
173 // Set PMD parameters
174 //
175 fIn[0] = p1;
176 fIn[1] = p2;
177 fIn[2] = p3;
178 fIn[3] = p4;
179 fIn[4] = p5;
180}
181
182//_____________________________________________________________________________
183void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
184{
185 //
186 // Set geometry parameters
187 //
188 fGeo[0] = p1;
189 fGeo[1] = p2;
190 fGeo[2] = p3;
191}
192
193//_____________________________________________________________________________
194void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
195{
196 //
197 // Set pad size
198 //
199 fPadSize[0] = p1;
200 fPadSize[1] = p2;
201 fPadSize[2] = p3;
202 fPadSize[3] = p4;
203}
204
205//_____________________________________________________________________________
206void AliPMD::StepManager()
207{
208 //
209 // Called at every step in PMD
210 //
211}
212
88cb7938 213void AliPMD::MakeBranch(Option_t* option)
4fa198c6 214{
215 // Create Tree branches for the PMD
4fa198c6 216
88cb7938 217 const char *cH = strstr(option,"H");
218 if (cH && fLoader->TreeH() && (fHits == 0x0))
219 fHits = new TClonesArray("AliPMDhit", 405);
2ab0c725 220
88cb7938 221 AliDetector::MakeBranch(option);
4fa198c6 222}
223
224
225void AliPMD::SetTreeAddress()
226{
30fdb6d0 227 // Set branch address
228
1da4d0d9 229 if (fLoader->TreeH() && fHits==0x0)
88cb7938 230 fHits = new TClonesArray("AliPMDhit", 405);
231
4fa198c6 232 AliDetector::SetTreeAddress();
4fa198c6 233}
234
85a5290f 235//____________________________________________________________________________
236void AliPMD::Hits2SDigits()
237{
238// create summable digits
239
240 AliRunLoader* runLoader = fLoader->GetRunLoader();
241 AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer;
242 pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(),
243 "HS");
40be8527 244 pmdDigitizer->SetZPosition(361.5);
85a5290f 245
246 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
247 pmdDigitizer->Hits2SDigits(iEvent);
248 }
249 fLoader->UnloadHits();
250 fLoader->UnloadSDigits();
251 delete pmdDigitizer;
252}
53043784 253//____________________________________________________________________________
254void AliPMD::SDigits2Digits()
255{
256 // creates sdigits to digits
257}
258//____________________________________________________________________________
259void AliPMD::Hits2Digits()
260{
261// create digits
262
263 AliRunLoader* runLoader = fLoader->GetRunLoader();
264 AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer;
265 pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(),
266 "HD");
267 pmdDigitizer->SetZPosition(361.5);
268
269 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
270 pmdDigitizer->Hits2Digits(iEvent);
271 }
272 fLoader->UnloadHits();
273 fLoader->UnloadDigits();
274 delete pmdDigitizer;
275
276}
fe743527 277// ---------------------------------------------------------------------------
dfaeee5f 278AliDigitizer* AliPMD::CreateDigitizer(AliRunDigitizer* manager) const
53043784 279{
280 return new AliPMDDigitizer(manager);
281}
fe743527 282// ---------------------------------------------------------------------------
c39d2a93 283void AliPMD::Digits2Raw()
284{
285// convert digits of the current event to raw data
286
287 fLoader->LoadDigits();
288 TTree* digits = fLoader->TreeD();
289 if (!digits) {
ecee2a1a 290 AliError("No digits tree");
c39d2a93 291 return;
292 }
293
294 AliPMDDDLRawData rawWriter;
295 rawWriter.WritePMDRawData(digits);
296
297 fLoader->UnloadDigits();
298}
68a330f6 299
300Bool_t AliPMD::Raw2SDigits(AliRawReader *rawReader)
2dcb8f31 301{
68a330f6 302 // converts raw to sdigits
303 AliRunLoader* runLoader = fLoader->GetRunLoader();
304 //runLoader->GetEvent(ievt);
305
306 AliPMDRawToSDigits pmdr2sd;
307 pmdr2sd.Raw2SDigits(runLoader, rawReader);
308 fLoader->UnloadSDigits();
2778698f 309 return kTRUE;
2dcb8f31 310}
fe743527 311