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 ///////////////////////////////////////////////////////////////////////////////
20 // Beam Condition Monitor BCM //
22 // andreas.morsch@cern.ch //
23 ///////////////////////////////////////////////////////////////////////////////
25 #include <TVirtualMC.h>
26 #include <TClonesArray.h>
27 #include <TGeoMaterial.h>
28 #include <TGeoMedium.h>
29 #include <TGeoVolume.h>
30 #include <TGeoMatrix.h>
33 #include <TGeoCompositeShape.h>
34 #include <TGeoManager.h>
37 #include "AliBCMHit.h"
45 //_____________________________________________________________________________
51 // Default constructor for BCM
55 //_____________________________________________________________________________
56 AliBCM::AliBCM(const char *name, const char *title):
57 AliDetector(name,title),
62 fHits = new TClonesArray("AliBCMHit");
64 gAlice->GetMCApp()->AddHitList(fHits);
69 if(fHits) delete fHits;
72 void AliBCM::StepManager()
75 // Step Manager for ALICE Beam Condition Monitor
79 static Double_t xh[3] = {0., 0., 0.};
84 if (gMC->TrackCharge() &&
85 gMC->CurrentVolID(copy) == fVolId) {
86 // Charged particle inside sensitive volume
89 if (gMC->IsTrackEntering()) {
91 gMC->TrackPosition(xh[0],xh[1],xh[2]);
96 if ((edep = gMC->Edep()) > 0.) {
98 gMC->TrackPosition(x[0],x[1],x[2]);
103 if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared())
105 Int_t track = gAlice->GetMCApp()->GetCurrentTrackNumber();
106 TClonesArray &lhits = *fHits;
107 Int_t ic = copy + 10;
108 if (xh[2] < 0.) ic+=10;
109 new(lhits[fNhits++]) AliBCMHit(1, track, xh, ic, edepT);
116 //_____________________________________________________________________________
117 void AliBCM::CreateGeometry()
120 // Create geometry for BCM
125 TGeoVolume* top = gGeoManager->GetVolume("ALIC");
127 TGeoMedium* medPCD = gGeoManager->GetMedium("BCM_PCD");
129 TGeoRotation* rotxz = new TGeoRotation("rotxz" , 270., 0., 90., 90., 180., 0.);
130 TGeoRotation* rot000 = new TGeoRotation("rot000", 90., 0., 90., 90., 0., 0.);
131 TGeoRotation* rot090 = new TGeoRotation("rot090", 90., 90., 90., 180., 0., 0.);
132 TGeoRotation* rot180 = new TGeoRotation("rot180", 90., 180., 90., 270., 0., 0.);
133 TGeoRotation* rot270 = new TGeoRotation("rot270", 90., 270., 90., 0., 0., 0.);
135 const Float_t kWidth = 1.00;
136 const Float_t kThickness = 0.05;
137 const Float_t rBCM = 7.;
140 TGeoBBox* shBCMpcd = new TGeoBBox(kWidth/2., kWidth/2., kThickness/2.);
141 TGeoVolume* voBCMpcd = new TGeoVolume("BCMpcd", shBCMpcd, medPCD);
142 TGeoVolumeAssembly* voBCM = new TGeoVolumeAssembly("BCM");
144 voBCM->AddNode(voBCMpcd, 1, new TGeoCombiTrans(+rBCM, 0. , 0., rot000));
145 voBCM->AddNode(voBCMpcd, 2, new TGeoCombiTrans(0. , +rBCM , 0., rot090));
146 voBCM->AddNode(voBCMpcd, 3, new TGeoCombiTrans(-rBCM, 0., 0., rot180));
147 voBCM->AddNode(voBCMpcd, 4, new TGeoCombiTrans(0. , -rBCM , 0., rot270));
149 top->AddNode(voBCM, 1, new TGeoTranslation(0., 0., 1561.));
150 top->AddNode(voBCM, 2, new TGeoCombiTrans(0., 0., -1908., rotxz));
154 //_____________________________________________________________________________
155 void AliBCM::CreateMaterials()
158 // Create materials for BCM
160 // Polycristalline Diamond
162 Float_t absl = 86.3 / rho;
163 Float_t radl = 42.7 / rho;
165 Float_t epsil = .001; // Tracking precision,
166 Float_t stemax = -1.; // Maximum displacement for multiple scat
167 Float_t tmaxfd = -20. ; // Maximum angle due to field deflection
168 Float_t deemax = -.01; // Maximum fractional energy loss, DLS
170 Int_t isxfld = gAlice->Field()->Integ();
171 Float_t sxmgmx = gAlice->Field()->Max();
173 AliMaterial(1, "PCD", 12.011, 6., rho, radl, absl);
175 AliMedium(1, "PCD", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
178 //_____________________________________________________________________________
182 // Initialise BCM magnet after it has been built
186 if(AliLog::GetGlobalDebugLevel()>0) {
187 printf("\n%s: ",ClassName());
188 for(i=0;i<35;i++) printf("*");
189 printf(" BCM_INIT ");
190 for(i=0;i<35;i++) printf("*");
191 printf("\n%s: ",ClassName());
192 for(i=0;i<80;i++) printf("*");
197 // Here the BCM initialisation code (if any!)
198 fVolId = gMC->VolId("BCMpcd");
201 void AliBCM::MakeBranch(Option_t* option)
203 //Create Tree branches for the BCM
205 const Int_t kBufSize = 4000;
206 const char *cH = strstr(option,"H");
207 // const char *cD = strstr(option,"D");
208 // const char *cR = strstr(option,"R");
209 // const char *cS = strstr(option,"S");
211 if(cH && TreeH() && (fHits == 0x0)){
212 fHits = new TClonesArray("AliBCMHit");
214 MakeBranchInTree(TreeH(), "BCM" ,&fHits ,kBufSize, 0);
216 AliDetector::MakeBranch(option);
219 void AliBCM::SetTreeAddress()
221 // Set branch address
223 if (TreeH() && fHits==0x0)
224 fHits = new TClonesArray("AliBCMHit", 4000);
225 AliDetector::SetTreeAddress();