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>
48 #include "AliLoader.h"
49 #include "AliPMDLoader.h"
53 #include "AliPMDDigitizer.h"
54 #include "AliPMDhit.h"
55 #include "AliPMDDDLRawData.h"
59 //_____________________________________________________________________________
63 // 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->GetMCApp()->AddHitList(fHits);
103 AliLoader* AliPMD::MakeLoader(const char* topfoldername)
107 fLoader = new AliPMDLoader(GetName(),topfoldername);
111 cout<<"Success"<<endl;
115 cout<<"Failure"<<endl;
128 //_____________________________________________________________________________
129 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
134 TClonesArray &lhits = *fHits;
135 AliPMDhit *newcell, *curcell;
136 // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d %d %d %d %d\n",
137 // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3],
138 // vol[4],vol[5],vol[6],vol[7]);
140 newcell = new AliPMDhit(fIshunt, track, vol, hits);
142 for (i=0; i<fNhits; i++) {
144 // See if this cell has already been hit
145 curcell=(AliPMDhit*) lhits[i];
146 if (*curcell==*newcell) {
147 // printf("Cell with same numbers found\n") ; curcell->Print();
148 *curcell = *curcell+*newcell;
149 // printf("Cell after addition\n") ; curcell->Print();
154 new(lhits[fNhits++]) AliPMDhit(newcell);
158 //_____________________________________________________________________________
159 void AliPMD::BuildGeometry()
162 // Build simple ROOT TNode geometry for event display
166 const int kColorPMD = kRed;
169 top=gAlice->GetGeometry()->GetNode("alice");
172 new TBRIK("S_PMD","PMD box","void",300,300,5);
174 node = new TNode("PMD","PMD","S_PMD",0,0,-600,"");
175 node->SetLineColor(kColorPMD);
179 //_____________________________________________________________________________
180 Int_t AliPMD::DistancetoPrimitive(Int_t , Int_t ) const
183 // Distance from mouse to detector on the screen
189 //_____________________________________________________________________________
190 void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
193 // Set PMD parameters
201 //_____________________________________________________________________________
202 void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
205 // Set PMD parameters
214 //_____________________________________________________________________________
215 void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
218 // Set geometry parameters
225 //_____________________________________________________________________________
226 void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
237 //_____________________________________________________________________________
238 void AliPMD::StepManager()
241 // Called at every step in PMD
245 void AliPMD::MakeBranch(Option_t* option)
247 // Create Tree branches for the PMD
249 const char *cH = strstr(option,"H");
250 if (cH && fLoader->TreeH() && (fHits == 0x0))
251 fHits = new TClonesArray("AliPMDhit", 405);
253 AliDetector::MakeBranch(option);
257 void AliPMD::SetTreeAddress()
259 // Set branch address
261 if (fLoader->TreeH() && fHits==0x0)
262 fHits = new TClonesArray("AliPMDhit", 405);
264 AliDetector::SetTreeAddress();
267 //____________________________________________________________________________
268 void AliPMD::Hits2SDigits()
270 // create summable digits
272 AliRunLoader* runLoader = fLoader->GetRunLoader();
273 AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer;
274 pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(),
276 pmdDigitizer->SetZPosition(361.5);
278 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
279 pmdDigitizer->Hits2SDigits(iEvent);
281 fLoader->UnloadHits();
282 fLoader->UnloadSDigits();
285 //____________________________________________________________________________
286 void AliPMD::SDigits2Digits()
288 // creates sdigits to digits
290 //____________________________________________________________________________
291 void AliPMD::Hits2Digits()
295 AliRunLoader* runLoader = fLoader->GetRunLoader();
296 AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer;
297 pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(),
299 pmdDigitizer->SetZPosition(361.5);
301 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
302 pmdDigitizer->Hits2Digits(iEvent);
304 fLoader->UnloadHits();
305 fLoader->UnloadDigits();
309 // ---------------------------------------------------------------------------
310 AliDigitizer* AliPMD::CreateDigitizer(AliRunDigitizer* manager) const
312 return new AliPMDDigitizer(manager);
314 // ---------------------------------------------------------------------------
315 void AliPMD::Digits2Raw()
317 // convert digits of the current event to raw data
319 fLoader->LoadDigits();
320 TTree* digits = fLoader->TreeD();
322 Error("Digits2Raw", "no digits tree");
326 AliPMDDDLRawData rawWriter;
327 rawWriter.WritePMDRawData(digits);
329 fLoader->UnloadDigits();