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.14 2001/03/12 17:46:22 hristov
19 Changes needed on Sun with CC 5.0
21 Revision 1.13 2001/01/26 20:02:43 hristov
22 Major upgrade of AliRoot code
24 Revision 1.12 2000/12/04 08:48:18 alibrary
25 Fixing problems in the HEAD
27 Revision 1.11 2000/11/17 10:15:24 morsch
28 Call to AliDetector::ResetHits() added to method AliPMD::ResetHits()
30 Revision 1.10 2000/11/06 09:07:13 morsch
31 Set fRecPoints to zero in default constructor.
33 Revision 1.9 2000/10/30 09:03:59 morsch
34 Prototype for PMD reconstructed hits (AliPMDRecPoint) added.
36 Revision 1.8 2000/10/20 06:24:40 fca
37 Put the PMD at the right position in the event display
39 Revision 1.7 2000/10/02 21:28:12 fca
40 Removal of useless dependecies via forward declarations
42 Revision 1.6 2000/01/19 17:17:06 fca
43 Introducing a list of lists of hits -- more hits allowed for detector now
45 Revision 1.5 1999/09/29 09:24:27 fca
46 Introduction of the Copyright and cvs Log
50 ///////////////////////////////////////////////////////////////////////////////
53 // Photon Multiplicity Detector //
54 // This class contains the basic functions for the Photon Multiplicity //
55 // Detector. Functions specific to one particular geometry are //
56 // contained in the derived classes //
60 <img src="picts/AliPMDClass.gif">
63 <font size=+2 color=red>
64 <p>The responsible person for this module is
65 <a href="mailto:sub@vecdec.veccal.ernet.in">Subhasis Chattopadhyay</a>.
71 ///////////////////////////////////////////////////////////////////////////////
76 #include <TGeometry.h>
77 #include <TClonesArray.h>
84 #include "AliPMDRecPoint.h"
88 //_____________________________________________________________________________
92 // Default constructor
96 // Always make the TClonesArray, otherwise the automatic streamer gets angry
97 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
101 //_____________________________________________________________________________
102 AliPMD::AliPMD(const char *name, const char *title)
103 : AliDetector(name,title)
106 // Default constructor
110 // Allocate the array of hits
111 fHits = new TClonesArray("AliPMDhit", 405);
112 gAlice->AddHitList(fHits);
114 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
141 // Default constructor
147 //_____________________________________________________________________________
148 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
153 TClonesArray &lhits = *fHits;
154 AliPMDhit *newcell, *curcell;
155 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d\n",
156 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3]);
157 newcell = new AliPMDhit(fIshunt, track, vol, hits);
159 for (i=0; i<fNhits; i++) {
161 // See if this cell has already been hit
162 curcell=(AliPMDhit*) lhits[i];
163 if (*curcell==*newcell) {
164 // printf("Cell with same numbers found\n") ; curcell->Print();
165 *curcell = *curcell+*newcell;
166 // printf("Cell after addition\n") ; curcell->Print();
171 new(lhits[fNhits++]) AliPMDhit(newcell);
175 //_____________________________________________________________________________
176 void AliPMD::BuildGeometry()
179 // Build simple ROOT TNode geometry for event display
183 const int kColorPMD = kRed;
186 Top=gAlice->GetGeometry()->GetNode("alice");
189 new TBRIK("S_PMD","PMD box","void",300,300,5);
191 Node = new TNode("PMD","PMD","S_PMD",0,0,-600,"");
192 Node->SetLineColor(kColorPMD);
196 //_____________________________________________________________________________
197 Int_t AliPMD::DistancetoPrimitive(Int_t , Int_t )
200 // Distance from mouse to detector on the screen
206 //_____________________________________________________________________________
207 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
210 // Set PMD parameters
218 //_____________________________________________________________________________
219 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
222 // Set PMD parameters
231 //_____________________________________________________________________________
232 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
235 // Set geometry parameters
242 //_____________________________________________________________________________
243 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
254 //_____________________________________________________________________________
255 void AliPMD::StepManager()
258 // Called at every step in PMD
262 void AliPMD::AddRecPoint(const AliPMDRecPoint &p)
265 // Add a PMD reconstructed hit to the list
267 TClonesArray &lrecpoints = *fRecPoints;
268 new(lrecpoints[fNRecPoints++]) AliPMDRecPoint(p);
271 void AliPMD::MakeBranch(Option_t* option, const char *file)
273 // Create Tree branches for the PMD
275 const char *cR = strstr(option,"R");
277 AliDetector::MakeBranch(option,file);
280 printf("Make Branch - TreeR address %p\n",gAlice->TreeR());
282 const Int_t kBufferSize = 4000;
285 sprintf(branchname,"%sRecPoints",GetName());
286 if (fRecPoints && gAlice->TreeR()) {
287 MakeBranchInTree(gAlice->TreeR(),
288 branchname, &fRecPoints, kBufferSize, file);
294 void AliPMD::SetTreeAddress()
296 // Set branch address for the TreeR
298 AliDetector::SetTreeAddress();
301 TTree *treeR = gAlice->TreeR();
303 sprintf(branchname,"%s",GetName());
304 if (treeR && fRecPoints) {
305 branch = treeR->GetBranch(branchname);
306 if (branch) branch->SetAddress(&fRecPoints);
310 void AliPMD::ResetHits()
313 // Reset number of hits and the hits array
315 AliDetector::ResetHits();
317 if (fRecPoints) fRecPoints->Clear();
320 ///////////////////////////////////////////////////////////////////////////////
322 // Photon Multiplicity Detector Version 1 //
326 <img src="picts/AliPMDv1Class.gif">
330 ///////////////////////////////////////////////////////////////////////////////
336 //_____________________________________________________________________________
337 AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits):
344 for (i=0;i<5;i++) fVolume[i] = vol[i];