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"
57 #include "AliPMDRawToSDigits.h"
61 //_____________________________________________________________________________
65 // Default constructor
90 //_____________________________________________________________________________
91 AliPMD::AliPMD(const char *name, const char *title)
92 : AliDetector(name,title)
95 // Default constructor
99 // Allocate the array of hits
100 fHits = new TClonesArray("AliPMDhit", 405);
101 gAlice->GetMCApp()->AddHitList(fHits);
128 AliLoader* AliPMD::MakeLoader(const char* topfoldername)
132 fLoader = new AliPMDLoader(GetName(),topfoldername);
136 AliDebug(100,"Success");
153 //_____________________________________________________________________________
154 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
159 TClonesArray &lhits = *fHits;
160 AliPMDhit *newcell, *curcell;
161 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d %d %d %d %d\n",
162 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3],
163 // vol[4],vol[5],vol[6],vol[7]);
165 newcell = new AliPMDhit(fIshunt, track, vol, hits);
167 for (Int_t i=0; i<fNhits; i++) {
169 // See if this cell has already been hit
170 curcell=(AliPMDhit*) lhits[i];
171 if (*curcell==*newcell) {
172 // printf("Cell with same numbers found\n") ; curcell->Print();
173 *curcell = *curcell+*newcell;
174 // printf("Cell after addition\n") ; curcell->Print();
179 new(lhits[fNhits++]) AliPMDhit(newcell);
183 //_____________________________________________________________________________
184 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
187 // Set PMD parameters
195 //_____________________________________________________________________________
196 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
199 // Set PMD parameters
208 //_____________________________________________________________________________
209 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
212 // Set geometry parameters
219 //_____________________________________________________________________________
220 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
231 //_____________________________________________________________________________
232 void AliPMD::StepManager()
235 // Called at every step in PMD
239 void AliPMD::MakeBranch(Option_t* option)
241 // Create Tree branches for the PMD
243 const char *cH = strstr(option,"H");
244 if (cH && fLoader->TreeH() && (fHits == 0x0))
245 fHits = new TClonesArray("AliPMDhit", 405);
247 AliDetector::MakeBranch(option);
251 void AliPMD::SetTreeAddress()
253 // Set branch address
255 if (fLoader->TreeH() && fHits==0x0)
256 fHits = new TClonesArray("AliPMDhit", 405);
258 AliDetector::SetTreeAddress();
261 void AliPMD::SetCpvOff()
263 // Set the CPV plane off
265 void AliPMD::SetPreOff()
267 // Set the Preshower plane off
270 void AliPMD::SetModuleOff(Int_t /*imodule*/)
272 // Set the desired module off
276 //____________________________________________________________________________
277 void AliPMD::Hits2SDigits()
279 // create summable digits
281 AliRunLoader* runLoader = fLoader->GetRunLoader();
282 AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer;
283 pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(),
285 pmdDigitizer->SetZPosition(361.5);
287 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
288 pmdDigitizer->Hits2SDigits(iEvent);
290 fLoader->UnloadHits();
291 fLoader->UnloadSDigits();
294 //____________________________________________________________________________
295 void AliPMD::SDigits2Digits()
297 // creates sdigits to digits
299 //____________________________________________________________________________
300 void AliPMD::Hits2Digits()
304 AliRunLoader* runLoader = fLoader->GetRunLoader();
305 AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer;
306 pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(),
308 pmdDigitizer->SetZPosition(361.5);
310 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
311 pmdDigitizer->Hits2Digits(iEvent);
313 fLoader->UnloadHits();
314 fLoader->UnloadDigits();
318 // ---------------------------------------------------------------------------
319 AliDigitizer* AliPMD::CreateDigitizer(AliDigitizationInput* digInput) const
321 return new AliPMDDigitizer(digInput);
323 // ---------------------------------------------------------------------------
324 void AliPMD::Digits2Raw()
326 // convert digits of the current event to raw data
328 fLoader->LoadDigits();
329 TTree* digits = fLoader->TreeD();
331 AliError("No digits tree");
335 AliPMDDDLRawData rawWriter;
336 rawWriter.WritePMDRawData(digits);
338 fLoader->UnloadDigits();
341 Bool_t AliPMD::Raw2SDigits(AliRawReader *rawReader)
343 // converts raw to sdigits
344 AliRunLoader* runLoader = fLoader->GetRunLoader();
345 //runLoader->GetEvent(ievt);
347 AliPMDRawToSDigits pmdr2sd;
348 pmdr2sd.Raw2SDigits(runLoader, rawReader);
349 fLoader->UnloadSDigits();