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);
109 // Default constructor
115 //_____________________________________________________________________________
116 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
121 TClonesArray &lhits = *fHits;
122 AliPMDhit *newcell, *curcell;
123 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d\n",
124 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3]);
125 newcell = new AliPMDhit(fIshunt, track, vol, hits);
127 for (i=0; i<fNhits; i++) {
129 // See if this cell has already been hit
130 curcell=(AliPMDhit*) lhits[i];
131 if (*curcell==*newcell) {
132 // printf("Cell with same numbers found\n") ; curcell->Print();
133 *curcell = *curcell+*newcell;
134 // printf("Cell after addition\n") ; curcell->Print();
139 new(lhits[fNhits++]) AliPMDhit(newcell);
143 //_____________________________________________________________________________
144 void AliPMD::BuildGeometry()
147 // Build simple ROOT TNode geometry for event display
151 const int kColorPMD = kRed;
154 Top=gAlice->GetGeometry()->GetNode("alice");
157 new TBRIK("S_PMD","PMD box","void",300,300,5);
159 Node = new TNode("PMD","PMD","S_PMD",0,0,-600,"");
160 Node->SetLineColor(kColorPMD);
164 //_____________________________________________________________________________
165 Int_t AliPMD::DistancetoPrimitive(Int_t , Int_t )
168 // Distance from mouse to detector on the screen
174 //_____________________________________________________________________________
175 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
178 // Set PMD parameters
186 //_____________________________________________________________________________
187 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
190 // Set PMD parameters
199 //_____________________________________________________________________________
200 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
203 // Set geometry parameters
210 //_____________________________________________________________________________
211 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
222 //_____________________________________________________________________________
223 void AliPMD::StepManager()
226 // Called at every step in PMD
230 void AliPMD::AddRecPoint(const AliPMDRecPoint &p)
233 // Add a PMD reconstructed hit to the list
235 TClonesArray &lrecpoints = *fRecPoints;
236 new(lrecpoints[fNRecPoints++]) AliPMDRecPoint(p);
239 void AliPMD::MakeBranch(Option_t* option)
241 // Create Tree branches for the PMD
243 const char *cR = strstr(option,"R");
244 const char *cH = strstr(option,"H");
245 if (cH && fLoader->TreeH() && (fHits == 0x0))
246 fHits = new TClonesArray("AliPMDhit", 405);
248 AliDetector::MakeBranch(option);
250 if (cR && fLoader->TreeR()) {
251 printf("Make Branch - TreeR address %p\n",fLoader->TreeR());
253 const Int_t kBufferSize = 4000;
256 sprintf(branchname,"%sRecPoints",GetName());
257 if (fRecPoints == 0x0) {
258 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
260 MakeBranchInTree(fLoader->TreeR(), branchname, &fRecPoints, kBufferSize,0);
265 void AliPMD::SetTreeAddress()
267 // Set branch address for the TreeR
270 if (fLoader->TreeH() && fHits==0x0)
271 fHits = new TClonesArray("AliPMDhit", 405);
273 AliDetector::SetTreeAddress();
276 TTree *treeR = fLoader->TreeR();
278 sprintf(branchname,"%s",GetName());
280 branch = treeR->GetBranch(branchname);
283 if (fRecPoints == 0x0) {
284 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
286 branch->SetAddress(&fRecPoints);
291 void AliPMD::ResetHits()
294 // Reset number of hits and the hits array
296 AliDetector::ResetHits();
298 if (fRecPoints) fRecPoints->Clear();
301 ///////////////////////////////////////////////////////////////////////////////
303 // Photon Multiplicity Detector Version 1 //
307 <img src="picts/AliPMDv1Class.gif">
311 ///////////////////////////////////////////////////////////////////////////////
317 //_____________________________________________________________________________
318 AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits):
325 for (i=0;i<5;i++) fVolume[i] = vol[i];