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\n",
142 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3]);
143 newcell = new AliPMDhit(fIshunt, track, vol, hits);
145 for (i=0; i<fNhits; i++) {
147 // See if this cell has already been hit
148 curcell=(AliPMDhit*) lhits[i];
149 if (*curcell==*newcell) {
150 // printf("Cell with same numbers found\n") ; curcell->Print();
151 *curcell = *curcell+*newcell;
152 // printf("Cell after addition\n") ; curcell->Print();
157 new(lhits[fNhits++]) AliPMDhit(newcell);
161 //_____________________________________________________________________________
162 void AliPMD::BuildGeometry()
165 // Build simple ROOT TNode geometry for event display
169 const int kColorPMD = kRed;
172 Top=gAlice->GetGeometry()->GetNode("alice");
175 new TBRIK("S_PMD","PMD box","void",300,300,5);
177 Node = new TNode("PMD","PMD","S_PMD",0,0,-600,"");
178 Node->SetLineColor(kColorPMD);
182 //_____________________________________________________________________________
183 Int_t AliPMD::DistancetoPrimitive(Int_t , Int_t )
186 // Distance from mouse to detector on the screen
192 //_____________________________________________________________________________
193 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
196 // Set PMD parameters
204 //_____________________________________________________________________________
205 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
208 // Set PMD parameters
217 //_____________________________________________________________________________
218 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
221 // Set geometry parameters
228 //_____________________________________________________________________________
229 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
240 //_____________________________________________________________________________
241 void AliPMD::StepManager()
244 // Called at every step in PMD
248 void AliPMD::AddRecPoint(const AliPMDRecPoint &p)
251 // Add a PMD reconstructed hit to the list
253 TClonesArray &lrecpoints = *fRecPoints;
254 new(lrecpoints[fNRecPoints++]) AliPMDRecPoint(p);
257 void AliPMD::MakeBranch(Option_t* option)
259 // Create Tree branches for the PMD
261 const char *cR = strstr(option,"R");
262 const char *cH = strstr(option,"H");
263 if (cH && fLoader->TreeH() && (fHits == 0x0))
264 fHits = new TClonesArray("AliPMDhit", 405);
266 AliDetector::MakeBranch(option);
268 if (cR && fLoader->TreeR()) {
269 printf("Make Branch - TreeR address %p\n",fLoader->TreeR());
271 const Int_t kBufferSize = 4000;
274 sprintf(branchname,"%sRecPoints",GetName());
275 if (fRecPoints == 0x0) {
276 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
278 MakeBranchInTree(fLoader->TreeR(), branchname, &fRecPoints, kBufferSize,0);
283 void AliPMD::SetTreeAddress()
285 // Set branch address for the TreeR
288 if (fLoader->TreeH() && fHits==0x0)
289 fHits = new TClonesArray("AliPMDhit", 405);
291 AliDetector::SetTreeAddress();
294 TTree *treeR = fLoader->TreeR();
296 sprintf(branchname,"%s",GetName());
298 branch = treeR->GetBranch(branchname);
301 if (fRecPoints == 0x0) {
302 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
304 branch->SetAddress(&fRecPoints);
309 void AliPMD::ResetHits()
312 // Reset number of hits and the hits array
314 AliDetector::ResetHits();
316 if (fRecPoints) fRecPoints->Clear();
319 ///////////////////////////////////////////////////////////////////////////////
321 // Photon Multiplicity Detector Version 1 //
325 <img src="picts/AliPMDv1Class.gif">
329 ///////////////////////////////////////////////////////////////////////////////
335 //_____________________________________________________________________________
336 AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits):
343 for (i=0;i<5;i++) fVolume[i] = vol[i];