1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.15 2001/05/16 14:57:19 alibrary
19 New files for folders and Stack
21 Revision 1.14 2001/03/12 17:46:22 hristov
22 Changes needed on Sun with CC 5.0
24 Revision 1.13 2001/01/26 20:02:43 hristov
25 Major upgrade of AliRoot code
27 Revision 1.12 2000/12/04 08:48:18 alibrary
28 Fixing problems in the HEAD
30 Revision 1.11 2000/11/17 10:15:24 morsch
31 Call to AliDetector::ResetHits() added to method AliPMD::ResetHits()
33 Revision 1.10 2000/11/06 09:07:13 morsch
34 Set fRecPoints to zero in default constructor.
36 Revision 1.9 2000/10/30 09:03:59 morsch
37 Prototype for PMD reconstructed hits (AliPMDRecPoint) added.
39 Revision 1.8 2000/10/20 06:24:40 fca
40 Put the PMD at the right position in the event display
42 Revision 1.7 2000/10/02 21:28:12 fca
43 Removal of useless dependecies via forward declarations
45 Revision 1.6 2000/01/19 17:17:06 fca
46 Introducing a list of lists of hits -- more hits allowed for detector now
48 Revision 1.5 1999/09/29 09:24:27 fca
49 Introduction of the Copyright and cvs Log
53 ///////////////////////////////////////////////////////////////////////////////
56 // Photon Multiplicity Detector //
57 // This class contains the basic functions for the Photon Multiplicity //
58 // Detector. Functions specific to one particular geometry are //
59 // contained in the derived classes //
63 <img src="picts/AliPMDClass.gif">
66 <font size=+2 color=red>
67 <p>The responsible person for this module is
68 <a href="mailto:sub@vecdec.veccal.ernet.in">Subhasis Chattopadhyay</a>.
74 ///////////////////////////////////////////////////////////////////////////////
79 #include <TGeometry.h>
80 #include <TClonesArray.h>
87 #include "AliPMDRecPoint.h"
91 //_____________________________________________________________________________
95 // Default constructor
99 // Always make the TClonesArray, otherwise the automatic streamer gets angry
100 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
104 //_____________________________________________________________________________
105 AliPMD::AliPMD(const char *name, const char *title)
106 : AliDetector(name,title)
109 // Default constructor
113 // Allocate the array of hits
114 fHits = new TClonesArray("AliPMDhit", 405);
115 gAlice->AddHitList(fHits);
117 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
144 // Default constructor
150 //_____________________________________________________________________________
151 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
156 TClonesArray &lhits = *fHits;
157 AliPMDhit *newcell, *curcell;
158 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d\n",
159 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3]);
160 newcell = new AliPMDhit(fIshunt, track, vol, hits);
162 for (i=0; i<fNhits; i++) {
164 // See if this cell has already been hit
165 curcell=(AliPMDhit*) lhits[i];
166 if (*curcell==*newcell) {
167 // printf("Cell with same numbers found\n") ; curcell->Print();
168 *curcell = *curcell+*newcell;
169 // printf("Cell after addition\n") ; curcell->Print();
174 new(lhits[fNhits++]) AliPMDhit(newcell);
178 //_____________________________________________________________________________
179 void AliPMD::BuildGeometry()
182 // Build simple ROOT TNode geometry for event display
186 const int kColorPMD = kRed;
189 Top=gAlice->GetGeometry()->GetNode("alice");
192 new TBRIK("S_PMD","PMD box","void",300,300,5);
194 Node = new TNode("PMD","PMD","S_PMD",0,0,-600,"");
195 Node->SetLineColor(kColorPMD);
199 //_____________________________________________________________________________
200 Int_t AliPMD::DistancetoPrimitive(Int_t , Int_t )
203 // Distance from mouse to detector on the screen
209 //_____________________________________________________________________________
210 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
213 // Set PMD parameters
221 //_____________________________________________________________________________
222 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
225 // Set PMD parameters
234 //_____________________________________________________________________________
235 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
238 // Set geometry parameters
245 //_____________________________________________________________________________
246 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
257 //_____________________________________________________________________________
258 void AliPMD::StepManager()
261 // Called at every step in PMD
265 void AliPMD::AddRecPoint(const AliPMDRecPoint &p)
268 // Add a PMD reconstructed hit to the list
270 TClonesArray &lrecpoints = *fRecPoints;
271 new(lrecpoints[fNRecPoints++]) AliPMDRecPoint(p);
274 void AliPMD::MakeBranch(Option_t* option, const char *file)
276 // Create Tree branches for the PMD
278 const char *cR = strstr(option,"R");
280 AliDetector::MakeBranch(option,file);
283 printf("Make Branch - TreeR address %p\n",gAlice->TreeR());
285 const Int_t kBufferSize = 4000;
288 sprintf(branchname,"%sRecPoints",GetName());
289 if (fRecPoints && gAlice->TreeR()) {
290 MakeBranchInTree(gAlice->TreeR(),
291 branchname, &fRecPoints, kBufferSize, file);
297 void AliPMD::SetTreeAddress()
299 // Set branch address for the TreeR
301 AliDetector::SetTreeAddress();
304 TTree *treeR = gAlice->TreeR();
306 sprintf(branchname,"%s",GetName());
307 if (treeR && fRecPoints) {
308 branch = treeR->GetBranch(branchname);
309 if (branch) branch->SetAddress(&fRecPoints);
313 void AliPMD::ResetHits()
316 // Reset number of hits and the hits array
318 AliDetector::ResetHits();
320 if (fRecPoints) fRecPoints->Clear();
323 ///////////////////////////////////////////////////////////////////////////////
325 // Photon Multiplicity Detector Version 1 //
329 <img src="picts/AliPMDv1Class.gif">
333 ///////////////////////////////////////////////////////////////////////////////
339 //_____________________________________________________________________________
340 AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits):
347 for (i=0;i<5;i++) fVolume[i] = vol[i];