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.10 2000/11/06 09:07:13 morsch
19 Set fRecPoints to zero in default constructor.
21 Revision 1.9 2000/10/30 09:03:59 morsch
22 Prototype for PMD reconstructed hits (AliPMDRecPoint) added.
24 Revision 1.8 2000/10/20 06:24:40 fca
25 Put the PMD at the right position in the event display
27 Revision 1.7 2000/10/02 21:28:12 fca
28 Removal of useless dependecies via forward declarations
30 Revision 1.6 2000/01/19 17:17:06 fca
31 Introducing a list of lists of hits -- more hits allowed for detector now
33 Revision 1.5 1999/09/29 09:24:27 fca
34 Introduction of the Copyright and cvs Log
38 ///////////////////////////////////////////////////////////////////////////////
41 // Photon Multiplicity Detector //
42 // This class contains the basic functions for the Photon Multiplicity //
43 // Detector. Functions specific to one particular geometry are //
44 // contained in the derived classes //
48 <img src="picts/AliPMDClass.gif">
51 <font size=+2 color=red>
52 <p>The responsible person for this module is
53 <a href="mailto:sub@vecdec.veccal.ernet.in">Subhasis Chattopadhyay</a>.
59 ///////////////////////////////////////////////////////////////////////////////
64 #include <TGeometry.h>
65 #include <TClonesArray.h>
71 #include "AliPMDRecPoint.h"
75 //_____________________________________________________________________________
79 // Default constructor
85 //_____________________________________________________________________________
86 AliPMD::AliPMD(const char *name, const char *title)
87 : AliDetector(name,title)
90 // Default constructor
94 // Allocate the array of hits
95 fHits = new TClonesArray("AliPMDhit", 405);
96 gAlice->AddHitList(fHits);
98 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
125 // Default constructor
131 //_____________________________________________________________________________
132 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
137 TClonesArray &lhits = *fHits;
138 AliPMDhit *newcell, *curcell;
139 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d\n",
140 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3]);
141 newcell = new AliPMDhit(fIshunt, track, vol, hits);
143 for (i=0; i<fNhits; i++) {
145 // See if this cell has already been hit
146 curcell=(AliPMDhit*) lhits[i];
147 if (*curcell==*newcell) {
148 // printf("Cell with same numbers found\n") ; curcell->Print();
149 *curcell = *curcell+*newcell;
150 // printf("Cell after addition\n") ; curcell->Print();
155 new(lhits[fNhits++]) AliPMDhit(newcell);
159 //_____________________________________________________________________________
160 void AliPMD::BuildGeometry()
163 // Build simple ROOT TNode geometry for event display
167 const int kColorPMD = kRed;
170 Top=gAlice->GetGeometry()->GetNode("alice");
173 new TBRIK("S_PMD","PMD box","void",300,300,5);
175 Node = new TNode("PMD","PMD","S_PMD",0,0,-600,"");
176 Node->SetLineColor(kColorPMD);
180 //_____________________________________________________________________________
181 Int_t AliPMD::DistancetoPrimitive(Int_t , Int_t )
184 // Distance from mouse to detector on the screen
190 //_____________________________________________________________________________
191 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
194 // Set PMD parameters
202 //_____________________________________________________________________________
203 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
206 // Set PMD parameters
215 //_____________________________________________________________________________
216 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
219 // Set geometry parameters
226 //_____________________________________________________________________________
227 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
238 //_____________________________________________________________________________
239 void AliPMD::StepManager()
242 // Called at every step in PMD
246 void AliPMD::AddRecPoint(const AliPMDRecPoint &p)
249 // Add a PMD reconstructed hit to the list
251 TClonesArray &lrecpoints = *fRecPoints;
252 new(lrecpoints[fNRecPoints++]) AliPMDRecPoint(p);
255 void AliPMD::MakeBranch(Option_t* option)
257 // Create Tree branches for the PMD
258 printf("Make Branch - TreeR address %p\n",gAlice->TreeR());
260 const Int_t kBufferSize = 4000;
263 AliDetector::MakeBranch(option);
265 sprintf(branchname,"%sRecPoints",GetName());
266 if (fRecPoints && gAlice->TreeR()) {
267 gAlice->TreeR()->Branch(branchname, &fRecPoints, kBufferSize);
268 printf("Making Branch %s for reconstructed hits\n",branchname);
273 void AliPMD::SetTreeAddress()
275 // Set branch address for the TreeR
277 AliDetector::SetTreeAddress();
280 TTree *treeR = gAlice->TreeR();
282 sprintf(branchname,"%s",GetName());
283 if (treeR && fRecPoints) {
284 branch = treeR->GetBranch(branchname);
285 if (branch) branch->SetAddress(&fRecPoints);
289 void AliPMD::ResetHits()
292 // Reset number of hits and the hits array
294 AliDetector::ResetHits();
296 if (fRecPoints) fRecPoints->Clear();
299 ///////////////////////////////////////////////////////////////////////////////
301 // Photon Multiplicity Detector Version 1 //
305 <img src="picts/AliPMDv1Class.gif">
309 ///////////////////////////////////////////////////////////////////////////////
315 //_____________________________________________________________________________
316 AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits):
323 for (i=0;i<5;i++) fVolume[i] = vol[i];