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 ///////////////////////////////////////////////////////////////////////////////
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 //
28 <img src="picts/AliPMDClass.gif">
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>.
39 ///////////////////////////////////////////////////////////////////////////////
42 #include <TClonesArray.h>
44 #include <TGeometry.h>
47 #include <TVirtualMC.h>
50 #include "AliLoader.h"
52 #include "AliPMDRecPoint.h"
57 //_____________________________________________________________________________
61 // Default constructor
69 //_____________________________________________________________________________
70 AliPMD::AliPMD(const char *name, const char *title)
71 : AliDetector(name,title)
74 // Default constructor
78 // Allocate the array of hits
79 fHits = new TClonesArray("AliPMDhit", 405);
80 gAlice->AddHitList(fHits);
82 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
106 AliLoader* AliPMD::MakeLoader(const char* topfoldername)
108 cout<<"AliPMD::MakeLoader ";
110 fLoader = new AliPMDLoader(GetName(),topfoldername);
114 cout<<"Success"<<endl;
118 cout<<"Failure"<<endl;
127 // Default constructor
133 //_____________________________________________________________________________
134 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
139 TClonesArray &lhits = *fHits;
140 AliPMDhit *newcell, *curcell;
141 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d %d %d %d %d\n",
142 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3],
143 // vol[4],vol[5],vol[6],vol[7]);
145 newcell = new AliPMDhit(fIshunt, track, vol, hits);
147 for (i=0; i<fNhits; i++) {
149 // See if this cell has already been hit
150 curcell=(AliPMDhit*) lhits[i];
151 if (*curcell==*newcell) {
152 // printf("Cell with same numbers found\n") ; curcell->Print();
153 *curcell = *curcell+*newcell;
154 // printf("Cell after addition\n") ; curcell->Print();
159 new(lhits[fNhits++]) AliPMDhit(newcell);
163 //_____________________________________________________________________________
164 void AliPMD::BuildGeometry()
167 // Build simple ROOT TNode geometry for event display
171 const int kColorPMD = kRed;
174 Top=gAlice->GetGeometry()->GetNode("alice");
177 new TBRIK("S_PMD","PMD box","void",300,300,5);
179 Node = new TNode("PMD","PMD","S_PMD",0,0,-600,"");
180 Node->SetLineColor(kColorPMD);
184 //_____________________________________________________________________________
185 Int_t AliPMD::DistancetoPrimitive(Int_t , Int_t )
188 // Distance from mouse to detector on the screen
194 //_____________________________________________________________________________
195 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
198 // Set PMD parameters
206 //_____________________________________________________________________________
207 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
210 // Set PMD parameters
219 //_____________________________________________________________________________
220 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
223 // Set geometry parameters
230 //_____________________________________________________________________________
231 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
242 //_____________________________________________________________________________
243 void AliPMD::StepManager()
246 // Called at every step in PMD
250 void AliPMD::AddRecPoint(const AliPMDRecPoint &p)
253 // Add a PMD reconstructed hit to the list
255 TClonesArray &lrecpoints = *fRecPoints;
256 new(lrecpoints[fNRecPoints++]) AliPMDRecPoint(p);
259 void AliPMD::MakeBranch(Option_t* option)
261 // Create Tree branches for the PMD
263 const char *cR = strstr(option,"R");
264 const char *cH = strstr(option,"H");
265 if (cH && fLoader->TreeH() && (fHits == 0x0))
266 fHits = new TClonesArray("AliPMDhit", 405);
268 AliDetector::MakeBranch(option);
270 if (cR && fLoader->TreeR()) {
271 printf("Make Branch - TreeR address %p\n",fLoader->TreeR());
273 const Int_t kBufferSize = 4000;
276 sprintf(branchname,"%sRecPoints",GetName());
277 if (fRecPoints == 0x0) {
278 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
280 MakeBranchInTree(fLoader->TreeR(), branchname, &fRecPoints, kBufferSize,0);
285 void AliPMD::SetTreeAddress()
287 // Set branch address for the TreeR
290 if (fLoader->TreeH() && fHits==0x0)
291 fHits = new TClonesArray("AliPMDhit", 405);
293 AliDetector::SetTreeAddress();
296 TTree *treeR = fLoader->TreeR();
298 sprintf(branchname,"%s",GetName());
300 branch = treeR->GetBranch(branchname);
303 if (fRecPoints == 0x0) {
304 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
306 branch->SetAddress(&fRecPoints);
311 void AliPMD::ResetHits()
314 // Reset number of hits and the hits array
316 AliDetector::ResetHits();
318 if (fRecPoints) fRecPoints->Clear();
321 ///////////////////////////////////////////////////////////////////////////////
323 // Photon Multiplicity Detector Version 1 //
327 <img src="picts/AliPMDv1Class.gif">
331 ///////////////////////////////////////////////////////////////////////////////
337 //_____________________________________________________________________________
338 AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits):
345 for (i=0;i<8;i++) fVolume[i] = vol[i];