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>
43 #include <TGeometry.h>
46 #include <TVirtualMC.h>
49 #include "AliLoader.h"
50 #include "AliPMDLoader.h"
54 #include "AliPMDDigitizer.h"
55 #include "AliPMDhit.h"
56 #include "AliPMDDDLRawData.h"
60 //_____________________________________________________________________________
64 // Default constructor
70 //_____________________________________________________________________________
71 AliPMD::AliPMD(const char *name, const char *title)
72 : AliDetector(name,title)
75 // Default constructor
79 // Allocate the array of hits
80 fHits = new TClonesArray("AliPMDhit", 405);
81 gAlice->GetMCApp()->AddHitList(fHits);
104 AliLoader* AliPMD::MakeLoader(const char* topfoldername)
108 fLoader = new AliPMDLoader(GetName(),topfoldername);
129 //_____________________________________________________________________________
130 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
135 TClonesArray &lhits = *fHits;
136 AliPMDhit *newcell, *curcell;
137 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d %d %d %d %d\n",
138 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3],
139 // vol[4],vol[5],vol[6],vol[7]);
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 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
184 // Set PMD parameters
192 //_____________________________________________________________________________
193 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
196 // Set PMD parameters
205 //_____________________________________________________________________________
206 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
209 // Set geometry parameters
216 //_____________________________________________________________________________
217 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
228 //_____________________________________________________________________________
229 void AliPMD::StepManager()
232 // Called at every step in PMD
236 void AliPMD::MakeBranch(Option_t* option)
238 // Create Tree branches for the PMD
240 const char *cH = strstr(option,"H");
241 if (cH && fLoader->TreeH() && (fHits == 0x0))
242 fHits = new TClonesArray("AliPMDhit", 405);
244 AliDetector::MakeBranch(option);
248 void AliPMD::SetTreeAddress()
250 // Set branch address
252 if (fLoader->TreeH() && fHits==0x0)
253 fHits = new TClonesArray("AliPMDhit", 405);
255 AliDetector::SetTreeAddress();
258 //____________________________________________________________________________
259 void AliPMD::Hits2SDigits()
261 // create summable digits
263 AliRunLoader* runLoader = fLoader->GetRunLoader();
264 AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer;
265 pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(),
267 pmdDigitizer->SetZPosition(361.5);
269 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
270 pmdDigitizer->Hits2SDigits(iEvent);
272 fLoader->UnloadHits();
273 fLoader->UnloadSDigits();
276 //____________________________________________________________________________
277 void AliPMD::SDigits2Digits()
279 // creates sdigits to digits
281 //____________________________________________________________________________
282 void AliPMD::Hits2Digits()
286 AliRunLoader* runLoader = fLoader->GetRunLoader();
287 AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer;
288 pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(),
290 pmdDigitizer->SetZPosition(361.5);
292 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
293 pmdDigitizer->Hits2Digits(iEvent);
295 fLoader->UnloadHits();
296 fLoader->UnloadDigits();
300 // ---------------------------------------------------------------------------
301 AliDigitizer* AliPMD::CreateDigitizer(AliRunDigitizer* manager) const
303 return new AliPMDDigitizer(manager);
305 // ---------------------------------------------------------------------------
306 void AliPMD::Digits2Raw()
308 // convert digits of the current event to raw data
310 fLoader->LoadDigits();
311 TTree* digits = fLoader->TreeD();
313 AliError("No digits tree");
317 AliPMDDDLRawData rawWriter;
318 rawWriter.WritePMDRawData(digits);
320 fLoader->UnloadDigits();