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
71 //_____________________________________________________________________________
72 AliPMD::AliPMD(const char *name, const char *title)
73 : AliDetector(name,title)
76 // Default constructor
80 // Allocate the array of hits
81 fHits = new TClonesArray("AliPMDhit", 405);
82 gAlice->GetMCApp()->AddHitList(fHits);
105 AliLoader* AliPMD::MakeLoader(const char* topfoldername)
109 fLoader = new AliPMDLoader(GetName(),topfoldername);
113 AliDebug(100,"Success");
130 //_____________________________________________________________________________
131 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
136 TClonesArray &lhits = *fHits;
137 AliPMDhit *newcell, *curcell;
138 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d %d %d %d %d\n",
139 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3],
140 // vol[4],vol[5],vol[6],vol[7]);
142 newcell = new AliPMDhit(fIshunt, track, vol, hits);
144 for (i=0; i<fNhits; i++) {
146 // See if this cell has already been hit
147 curcell=(AliPMDhit*) lhits[i];
148 if (*curcell==*newcell) {
149 // printf("Cell with same numbers found\n") ; curcell->Print();
150 *curcell = *curcell+*newcell;
151 // printf("Cell after addition\n") ; curcell->Print();
156 new(lhits[fNhits++]) AliPMDhit(newcell);
160 //_____________________________________________________________________________
161 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
164 // Set PMD parameters
172 //_____________________________________________________________________________
173 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
176 // Set PMD parameters
185 //_____________________________________________________________________________
186 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
189 // Set geometry parameters
196 //_____________________________________________________________________________
197 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
208 //_____________________________________________________________________________
209 void AliPMD::StepManager()
212 // Called at every step in PMD
216 void AliPMD::MakeBranch(Option_t* option)
218 // Create Tree branches for the PMD
220 const char *cH = strstr(option,"H");
221 if (cH && fLoader->TreeH() && (fHits == 0x0))
222 fHits = new TClonesArray("AliPMDhit", 405);
224 AliDetector::MakeBranch(option);
228 void AliPMD::SetTreeAddress()
230 // Set branch address
232 if (fLoader->TreeH() && fHits==0x0)
233 fHits = new TClonesArray("AliPMDhit", 405);
235 AliDetector::SetTreeAddress();
238 void AliPMD::SetCpvOff()
240 // Set the CPV plane off
242 void AliPMD::SetPreOff()
244 // Set the Preshower plane off
247 void AliPMD::SetModuleOff(Int_t /*imodule*/)
249 // Set the desired module off
253 //____________________________________________________________________________
254 void AliPMD::Hits2SDigits()
256 // create summable digits
258 AliRunLoader* runLoader = fLoader->GetRunLoader();
259 AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer;
260 pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(),
262 pmdDigitizer->SetZPosition(361.5);
264 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
265 pmdDigitizer->Hits2SDigits(iEvent);
267 fLoader->UnloadHits();
268 fLoader->UnloadSDigits();
271 //____________________________________________________________________________
272 void AliPMD::SDigits2Digits()
274 // creates sdigits to digits
276 //____________________________________________________________________________
277 void AliPMD::Hits2Digits()
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->Hits2Digits(iEvent);
290 fLoader->UnloadHits();
291 fLoader->UnloadDigits();
295 // ---------------------------------------------------------------------------
296 AliDigitizer* AliPMD::CreateDigitizer(AliRunDigitizer* manager) const
298 return new AliPMDDigitizer(manager);
300 // ---------------------------------------------------------------------------
301 void AliPMD::Digits2Raw()
303 // convert digits of the current event to raw data
305 fLoader->LoadDigits();
306 TTree* digits = fLoader->TreeD();
308 AliError("No digits tree");
312 AliPMDDDLRawData rawWriter;
313 rawWriter.WritePMDRawData(digits);
315 fLoader->UnloadDigits();
318 Bool_t AliPMD::Raw2SDigits(AliRawReader *rawReader)
320 // converts raw to sdigits
321 AliRunLoader* runLoader = fLoader->GetRunLoader();
322 //runLoader->GetEvent(ievt);
324 AliPMDRawToSDigits pmdr2sd;
325 pmdr2sd.Raw2SDigits(runLoader, rawReader);
326 fLoader->UnloadSDigits();