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 **************************************************************************/
20 ////////////////////////////////////////////////
21 // Manager and hits classes for set //
22 // Charged Particle Veto (CPV) //
24 // Author: Yuri Kharlov, IHEP, Protvino //
25 // e-mail: Yuri.Kharlov@cern.ch //
26 // Last modified: 28 September 2000 //
27 ////////////////////////////////////////////////
29 // --- ROOT system ---
32 // --- Standard library ---
38 // --- galice header files ---
39 #include "AliPHOSCPV.h"
42 //==============================================================================
44 //==============================================================================
48 //______________________________________________________________________________
50 CPVModule::CPVModule(void) {
52 // Allocate an array of hits
55 if ( NULL==(fHits=new TClonesArray("CPVHit",100)) ) {
56 Error("CPV","Can not create array of hits");
61 //______________________________________________________________________________
63 CPVModule::~CPVModule(void)
68 //______________________________________________________________________________
70 void CPVModule::Clear(Option_t *opt="")
72 // Clear hit information
77 //______________________________________________________________________________
79 void CPVModule::AddHit(TLorentzVector p, Float_t *xy, Int_t ipart)
82 // Add this hit to the hit list in CPV detector.
85 TClonesArray &lhits = *(TClonesArray *)fHits;
86 new(lhits[fHits->GetEntriesFast()]) CPVHit(p,xy,ipart);
89 //______________________________________________________________________________
91 void CPVModule::Print(Option_t *opt)
94 // Print CPVModule information.
95 // options: 'p' - print hits in the module
99 if (strcmp(opt,"p")==0) {
100 printf ("CPV module has %d hits\n",nhits=fHits->GetEntriesFast());
101 for (hit=0;hit<nhits;hit++) {
102 CPVHit *cpvHit = (CPVHit*)fHits->UncheckedAt(hit);
108 //______________________________________________________________________________
110 void CPVModule::MakeBranch(Int_t i)
113 // Create a new branch for a CPV module #i in the current Root Tree
117 sprintf(branchname,"CPV%d",i);
118 gAlice->TreeH()->Branch(branchname,&fHits, 1000);
121 //_____________________________________________________________________________
122 void CPVModule::SetTreeAddress(Int_t i)
125 // Set branch address for the Hits Tree for a CPV module #i
130 TTree *treeH = gAlice->TreeH();
132 sprintf(branchname,"CPV%d",i);
133 branch = treeH->GetBranch(branchname);
134 if (branch) branch->SetAddress(&fHits);
138 //==============================================================================
140 //==============================================================================
144 //______________________________________________________________________________
146 CPVHit::CPVHit(TLorentzVector p, Float_t *xy, Int_t ipart)
149 // Create a CPV hit object
158 //______________________________________________________________________________
165 printf("CPV hit: p = (% .4f, % .4f, % .4f, % .4f) GeV,\n",
166 GetMomentum().Px(),GetMomentum().Py(),GetMomentum().Pz(),GetMomentum().E());
167 printf(" xy = (%8.4f, %8.4f) cm, ipart = %d\n",
171 //==============================================================================
173 //==============================================================================
177 //______________________________________________________________________________
179 CPVDigit::CPVDigit(Int_t x, Int_t y, Float_t q)
182 // Create a CPV digit object
190 //______________________________________________________________________________