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 Revision 1.5 2000/11/30 11:58:21 schutz
19 make it compile with Federico modifications
21 Revision 1.4 2000/11/20 09:50:03 schutz
22 AliPHOSCPVHit inherits from AliHit
24 Revision 1.3 2000/11/13 11:45:36 schutz
25 DEC and HP compilers sufisfied
27 Revision 1.2 2000/11/13 09:34:11 martinez
28 Copy constructor and operator = changed
30 Revision 1.1 2000/11/03 16:49:35 schutz
31 New class AliPHOSCPVModule
35 ////////////////////////////////////////////////
36 // Manager class for one CPV module //
38 // Author: Yuri Kharlov, IHEP, Protvino //
39 // e-mail: Yuri.Kharlov@cern.ch //
40 // Last modified: 2 November 2000 //
41 ////////////////////////////////////////////////
43 // --- ROOT system ---
47 // --- Standard library ---
53 // --- galice header files ---
55 #include "AliPHOSCPVModule.h"
56 #include "AliPHOSCPVHit.h"
58 //==============================================================================
60 //==============================================================================
62 ClassImp(AliPHOSCPVModule)
64 //______________________________________________________________________________
66 AliPHOSCPVModule::AliPHOSCPVModule(void)
69 // Allocate an array of hits
72 if ( NULL==(fHits =new TClonesArray("AliPHOSCPVHit",100)) ) {
73 Error("CPV","Can not create array of hits per track");
78 //______________________________________________________________________________
79 AliPHOSCPVModule::AliPHOSCPVModule(const AliPHOSCPVModule & module)
85 //____________________________________________________________________________
86 AliPHOSCPVModule & AliPHOSCPVModule::operator= (const AliPHOSCPVModule &module)
92 //______________________________________________________________________________
93 void AliPHOSCPVModule::Copy(AliPHOSCPVModule & module) const
95 // Copy *this onto module
96 // It takes care about copying array of hits fHits
100 ((TObject*) this)->Copy((TObject&)module);
101 module.fHits = fHits;
105 //______________________________________________________________________________
107 AliPHOSCPVModule::~AliPHOSCPVModule(void)
112 //______________________________________________________________________________
114 void AliPHOSCPVModule::Clear(Option_t *opt)
116 // Clear hit information
121 //______________________________________________________________________________
123 void AliPHOSCPVModule::AddHit(Int_t shunt, Int_t track, TLorentzVector p, Float_t *xy, Int_t ipart)
126 // Add this hit to the hit list in CPV detector.
129 TClonesArray &lhits = *(TClonesArray *)fHits;
130 new(lhits[fHits->GetEntriesFast()]) AliPHOSCPVHit(shunt,track,p,xy,ipart);
133 //______________________________________________________________________________
135 void AliPHOSCPVModule::Print(Option_t *opt)
138 // Print AliPHOSCPVModule information.
139 // options: 'p' - print hits in the module
143 if (strcmp(opt,"p")==0) {
144 printf ("CPV module has %d hits\n",nhits=fHits->GetEntriesFast());
145 for (hit=0;hit<nhits;hit++) {
146 AliPHOSCPVHit *cpvHit = (AliPHOSCPVHit*)fHits->UncheckedAt(hit);
152 //______________________________________________________________________________
154 void AliPHOSCPVModule::MakeBranch(char *title,Int_t i,char *file)
157 // Create a new branch for a EMC or CPV module #i in the current Root Tree
161 sprintf(branchname,"%s%d",title,i);
162 gAlice->MakeBranchInTree(gAlice->TreeH(),
163 branchname, &fHits, 1000, file) ;
166 //_____________________________________________________________________________
167 void AliPHOSCPVModule::SetTreeAddress(char *title, Int_t i)
170 // Set branch address for the Hits Tree for a CPV or EMC module #i
175 TTree *treeH = gAlice->TreeH();
177 sprintf(branchname,"%s%d",title,i);
178 branch = treeH->GetBranch(branchname);
179 if (branch) branch->SetAddress(&fHits);