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.12 2000/12/04 08:48:18 alibrary
19 Fixing problems in the HEAD
21 Revision 1.11 2000/11/17 10:15:24 morsch
22 Call to AliDetector::ResetHits() added to method AliPMD::ResetHits()
24 Revision 1.10 2000/11/06 09:07:13 morsch
25 Set fRecPoints to zero in default constructor.
27 Revision 1.9 2000/10/30 09:03:59 morsch
28 Prototype for PMD reconstructed hits (AliPMDRecPoint) added.
30 Revision 1.8 2000/10/20 06:24:40 fca
31 Put the PMD at the right position in the event display
33 Revision 1.7 2000/10/02 21:28:12 fca
34 Removal of useless dependecies via forward declarations
36 Revision 1.6 2000/01/19 17:17:06 fca
37 Introducing a list of lists of hits -- more hits allowed for detector now
39 Revision 1.5 1999/09/29 09:24:27 fca
40 Introduction of the Copyright and cvs Log
44 ///////////////////////////////////////////////////////////////////////////////
47 // Photon Multiplicity Detector //
48 // This class contains the basic functions for the Photon Multiplicity //
49 // Detector. Functions specific to one particular geometry are //
50 // contained in the derived classes //
54 <img src="picts/AliPMDClass.gif">
57 <font size=+2 color=red>
58 <p>The responsible person for this module is
59 <a href="mailto:sub@vecdec.veccal.ernet.in">Subhasis Chattopadhyay</a>.
65 ///////////////////////////////////////////////////////////////////////////////
70 #include <TGeometry.h>
71 #include <TClonesArray.h>
78 #include "AliPMDRecPoint.h"
82 //_____________________________________________________________________________
86 // Default constructor
90 // Always make the TClonesArray, otherwise the automatic streamer gets angry
91 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
95 //_____________________________________________________________________________
96 AliPMD::AliPMD(const char *name, const char *title)
97 : AliDetector(name,title)
100 // Default constructor
104 // Allocate the array of hits
105 fHits = new TClonesArray("AliPMDhit", 405);
106 gAlice->AddHitList(fHits);
108 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
135 // Default constructor
141 //_____________________________________________________________________________
142 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
147 TClonesArray &lhits = *fHits;
148 AliPMDhit *newcell, *curcell;
149 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d\n",
150 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3]);
151 newcell = new AliPMDhit(fIshunt, track, vol, hits);
153 for (i=0; i<fNhits; i++) {
155 // See if this cell has already been hit
156 curcell=(AliPMDhit*) lhits[i];
157 if (*curcell==*newcell) {
158 // printf("Cell with same numbers found\n") ; curcell->Print();
159 *curcell = *curcell+*newcell;
160 // printf("Cell after addition\n") ; curcell->Print();
165 new(lhits[fNhits++]) AliPMDhit(newcell);
169 //_____________________________________________________________________________
170 void AliPMD::BuildGeometry()
173 // Build simple ROOT TNode geometry for event display
177 const int kColorPMD = kRed;
180 Top=gAlice->GetGeometry()->GetNode("alice");
183 new TBRIK("S_PMD","PMD box","void",300,300,5);
185 Node = new TNode("PMD","PMD","S_PMD",0,0,-600,"");
186 Node->SetLineColor(kColorPMD);
190 //_____________________________________________________________________________
191 Int_t AliPMD::DistancetoPrimitive(Int_t , Int_t )
194 // Distance from mouse to detector on the screen
200 //_____________________________________________________________________________
201 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
204 // Set PMD parameters
212 //_____________________________________________________________________________
213 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
216 // Set PMD parameters
225 //_____________________________________________________________________________
226 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
229 // Set geometry parameters
236 //_____________________________________________________________________________
237 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
248 //_____________________________________________________________________________
249 void AliPMD::StepManager()
252 // Called at every step in PMD
256 void AliPMD::AddRecPoint(const AliPMDRecPoint &p)
259 // Add a PMD reconstructed hit to the list
261 TClonesArray &lrecpoints = *fRecPoints;
262 new(lrecpoints[fNRecPoints++]) AliPMDRecPoint(p);
265 void AliPMD::MakeBranch(Option_t* option, char *file)
267 // Create Tree branches for the PMD
269 char *cR = strstr(option,"R");
271 AliDetector::MakeBranch(option,file);
274 printf("Make Branch - TreeR address %p\n",gAlice->TreeR());
276 const Int_t kBufferSize = 4000;
279 sprintf(branchname,"%sRecPoints",GetName());
280 if (fRecPoints && gAlice->TreeR()) {
281 gAlice->MakeBranchInTree(gAlice->TreeR(),
282 branchname, &fRecPoints, kBufferSize, file) ;
288 void AliPMD::SetTreeAddress()
290 // Set branch address for the TreeR
292 AliDetector::SetTreeAddress();
295 TTree *treeR = gAlice->TreeR();
297 sprintf(branchname,"%s",GetName());
298 if (treeR && fRecPoints) {
299 branch = treeR->GetBranch(branchname);
300 if (branch) branch->SetAddress(&fRecPoints);
304 void AliPMD::ResetHits()
307 // Reset number of hits and the hits array
309 AliDetector::ResetHits();
311 if (fRecPoints) fRecPoints->Clear();
314 ///////////////////////////////////////////////////////////////////////////////
316 // Photon Multiplicity Detector Version 1 //
320 <img src="picts/AliPMDv1Class.gif">
324 ///////////////////////////////////////////////////////////////////////////////
330 //_____________________________________________________________________________
331 AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits):
338 for (i=0;i<5;i++) fVolume[i] = vol[i];