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 ///////////////////////////////////////////////////////////////////////////////
41 #include <TClonesArray.h>
43 #include <TVirtualMC.h>
46 #include "AliLoader.h"
47 #include "AliPMDLoader.h"
51 #include "AliPMDDigitizer.h"
52 #include "AliPMDhit.h"
53 #include "AliPMDDDLRawData.h"
54 #include "AliPMDRawToSDigits.h"
58 //_____________________________________________________________________________
62 // Default constructor
68 //_____________________________________________________________________________
69 AliPMD::AliPMD(const char *name, const char *title)
70 : AliDetector(name,title)
73 // Default constructor
77 // Allocate the array of hits
78 fHits = new TClonesArray("AliPMDhit", 405);
79 gAlice->GetMCApp()->AddHitList(fHits);
102 AliLoader* AliPMD::MakeLoader(const char* topfoldername)
106 fLoader = new AliPMDLoader(GetName(),topfoldername);
110 AliDebug(100,"Success");
127 //_____________________________________________________________________________
128 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
133 TClonesArray &lhits = *fHits;
134 AliPMDhit *newcell, *curcell;
135 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d %d %d %d %d\n",
136 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3],
137 // vol[4],vol[5],vol[6],vol[7]);
139 newcell = new AliPMDhit(fIshunt, track, vol, hits);
141 for (i=0; i<fNhits; i++) {
143 // See if this cell has already been hit
144 curcell=(AliPMDhit*) lhits[i];
145 if (*curcell==*newcell) {
146 // printf("Cell with same numbers found\n") ; curcell->Print();
147 *curcell = *curcell+*newcell;
148 // printf("Cell after addition\n") ; curcell->Print();
153 new(lhits[fNhits++]) AliPMDhit(newcell);
157 //_____________________________________________________________________________
158 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
161 // Set PMD parameters
169 //_____________________________________________________________________________
170 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
173 // Set PMD parameters
182 //_____________________________________________________________________________
183 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
186 // Set geometry parameters
193 //_____________________________________________________________________________
194 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
205 //_____________________________________________________________________________
206 void AliPMD::StepManager()
209 // Called at every step in PMD
213 void AliPMD::MakeBranch(Option_t* option)
215 // Create Tree branches for the PMD
217 const char *cH = strstr(option,"H");
218 if (cH && fLoader->TreeH() && (fHits == 0x0))
219 fHits = new TClonesArray("AliPMDhit", 405);
221 AliDetector::MakeBranch(option);
225 void AliPMD::SetTreeAddress()
227 // Set branch address
229 if (fLoader->TreeH() && fHits==0x0)
230 fHits = new TClonesArray("AliPMDhit", 405);
232 AliDetector::SetTreeAddress();
235 //____________________________________________________________________________
236 void AliPMD::Hits2SDigits()
238 // create summable digits
240 AliRunLoader* runLoader = fLoader->GetRunLoader();
241 AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer;
242 pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(),
244 pmdDigitizer->SetZPosition(361.5);
246 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
247 pmdDigitizer->Hits2SDigits(iEvent);
249 fLoader->UnloadHits();
250 fLoader->UnloadSDigits();
253 //____________________________________________________________________________
254 void AliPMD::SDigits2Digits()
256 // creates sdigits to digits
258 //____________________________________________________________________________
259 void AliPMD::Hits2Digits()
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->Hits2Digits(iEvent);
272 fLoader->UnloadHits();
273 fLoader->UnloadDigits();
277 // ---------------------------------------------------------------------------
278 AliDigitizer* AliPMD::CreateDigitizer(AliRunDigitizer* manager) const
280 return new AliPMDDigitizer(manager);
282 // ---------------------------------------------------------------------------
283 void AliPMD::Digits2Raw()
285 // convert digits of the current event to raw data
287 fLoader->LoadDigits();
288 TTree* digits = fLoader->TreeD();
290 AliError("No digits tree");
294 AliPMDDDLRawData rawWriter;
295 rawWriter.WritePMDRawData(digits);
297 fLoader->UnloadDigits();
300 Bool_t AliPMD::Raw2SDigits(AliRawReader *rawReader)
302 // converts raw to sdigits
303 AliRunLoader* runLoader = fLoader->GetRunLoader();
304 //runLoader->GetEvent(ievt);
306 AliPMDRawToSDigits pmdr2sd;
307 pmdr2sd.Raw2SDigits(runLoader, rawReader);
308 fLoader->UnloadSDigits();