]> git.uio.no Git - u/mrichter/AliRoot.git/blob - CPV/AliCPVv0.cxx
Correct minor syntax for CC HP-UX
[u/mrichter/AliRoot.git] / CPV / AliCPVv0.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.2  1999/09/29 09:24:08  fca
19 Introduction of the Copyright and cvs Log
20
21 */
22
23 /////////////////////////////////////////////////////////
24 //  Manager and hits classes for set:CPV version 0     //
25 //  Coarse geometry                                    //
26 //                                                     //
27 //  Author: Yuri Kharlov, IHEP, Protvino               //
28 //  e-mail: Yuri.Kharlov@cern.ch                       //
29 //  Last modified: 17 September 1999                   //
30 /////////////////////////////////////////////////////////
31  
32 // --- ROOT system ---
33 #include "TH1.h"
34 #include "TRandom.h"
35 #include "TFile.h"
36 #include "TTree.h"
37 #include "TBRIK.h"
38 #include "TNode.h"
39
40 // --- galice header files ---
41 #include "AliCPVv0.h"
42 #include "AliRun.h"
43 #include "AliMC.h" 
44
45 ClassImp(AliCPVv0)
46
47 //==============================================================================
48 //                            AliCPVv0
49 //==============================================================================
50
51 AliCPVv0::AliCPVv0()
52 {
53 }
54  
55 //______________________________________________________________________________
56
57 AliCPVv0::AliCPVv0(const char *name, const char *title)
58           : AliCPV(name, title)
59 {
60 }
61  
62 //______________________________________________________________________________
63
64 void AliCPVv0::CreateGeometry()
65 {
66
67   AliCPV *CPV_tmp = (AliCPV*)gAlice->GetModule("CPV");
68   if( NULL==CPV_tmp )
69   {
70     printf("There isn't CPV detector!\n");
71     return;
72   }
73
74   Int_t    rotation_matrix_number=0;
75   Float_t  par[3],
76            x,y,z;
77
78   // CPV creation
79
80   par[0] = GetPadZSize()   / 2 * GetNz();
81   par[1] = GetPadPhiSize() / 2 * GetNphi();
82   par[2] = GetThickness()  / 2;
83   gMC->Gsvolu("CPV","BOX ",GetCPVIdtmed(),par,3);
84
85   for( Int_t i=0; i<GetNofCradles(); i++ )
86   {
87     Float_t cradle_angle_pos = -90+(i-(GetNofCradles()-1)/2.) * GetAngle();
88
89     // Cradles are numerated in clock reversed order. (general way of angle increment)
90
91     Float_t r = GetRadius() + GetThickness()/2;
92     x = r*cos(cradle_angle_pos*kPI/180);
93     y = r*sin(cradle_angle_pos*kPI/180);
94     z = 0;
95     AliMatrix(rotation_matrix_number, 0,0 , 90,90+cradle_angle_pos , 90,180+cradle_angle_pos);
96     gMC->Gspos("CPV",i+1,"ALIC",x,y,z,rotation_matrix_number,"ONLY");
97   }
98   AddCPVCradles();
99
100 }
101
102 //______________________________________________________________________________
103
104 void AliCPVv0::StepManager()
105 {
106
107 //    if( gMC->IsTrackEntering() ) {
108 //      const char *VolumeName = gMC->CurrentVolName();
109 //      cout << "AliCPVv0::StepManager() entered to CPV to the volume " 
110 //           << VolumeName << "!\n";
111 //    }
112
113   Int_t i;
114   
115   if( strcmp(gMC->CurrentVolName(),"CPV ")==0 && gMC->IsTrackEntering() )
116   {
117     // GEANT particle just have entered into CPV detector.
118
119     AliCPV &CPV = *(AliCPV*)gAlice->GetModule("CPV");
120
121     Int_t CradleNumber;
122     gMC->CurrentVolOffID(0,CradleNumber);
123     CradleNumber--;
124     AliCPVCradle  &cradle = CPV.GetCradle(CradleNumber);
125
126     // Current position of the hit in the cradle ref. system
127
128     TLorentzVector xyzt;
129     gMC -> TrackPosition(xyzt);
130     Float_t xyzm[3], xyzd[3], xyd[2];
131     for (i=0; i<3; i++) xyzm[i] = xyzt[i];
132     gMC -> Gmtod (xyzm, xyzd, 1);
133     for (i=0; i<2; i++) xyd[i]  = xyzd[i];
134
135     // Current momentum of the hit's track in the MARS ref. system
136     
137     TLorentzVector  pmom;
138     gMC -> TrackMomentum(pmom);
139     Int_t ipart = gMC->TrackPid();
140
141     // Store current particle in the list of Cradle particles.
142     cradle.AddHit(pmom,xyd,ipart);
143
144 //      if (gMC->TrackCharge()!=0.) CPV.Reconstruction(0,0);
145
146 //      CPV.Print("p");
147 //      CPV.Print("r");
148
149   }
150 }