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"
38 #include "AliBCMLoader.h"
46 //_____________________________________________________________________________
52 // Default constructor for BCM
56 //_____________________________________________________________________________
57 AliBCM::AliBCM(const char *name, const char *title):
58 AliDetector(name,title),
63 fHits = new TClonesArray("AliBCMHit");
65 gAlice->GetMCApp()->AddHitList(fHits);
70 if(fHits) delete fHits;
73 void AliBCM::StepManager()
76 // Step Manager for ALICE Beam Condition Monitor
80 static Double_t xh[4] = {0., 0., 0., 0.};
85 if (gMC->TrackCharge() &&
86 gMC->CurrentVolID(copy) == fVolId) {
87 // Charged particle inside sensitive volume
90 if (gMC->IsTrackEntering()) {
92 gMC->TrackPosition(xh[0],xh[1],xh[2]);
93 xh[3] = gMC->TrackTime();
98 if ((edep = gMC->Edep()) > 0.) {
100 gMC->TrackPosition(x[0],x[1],x[2]);
105 if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared())
107 Int_t track = gAlice->GetMCApp()->GetCurrentTrackNumber();
108 TClonesArray &lhits = *fHits;
109 Int_t ic = copy + 10;
110 if (xh[2] < 0.) ic+=10;
111 new(lhits[fNhits++]) AliBCMHit(1, track, xh, ic, edepT);
118 //_____________________________________________________________________________
119 void AliBCM::CreateGeometry()
122 // Create geometry for BCM
127 TGeoVolume* top = gGeoManager->GetVolume("ALIC");
129 TGeoMedium* medPCD = gGeoManager->GetMedium("BCM_PCD");
131 TGeoRotation* rotxz = new TGeoRotation("rotxz" , 270., 0., 90., 90., 180., 0.);
132 TGeoRotation* rot000 = new TGeoRotation("rot000", 90., 0., 90., 90., 0., 0.);
133 TGeoRotation* rot090 = new TGeoRotation("rot090", 90., 90., 90., 180., 0., 0.);
134 TGeoRotation* rot180 = new TGeoRotation("rot180", 90., 180., 90., 270., 0., 0.);
135 TGeoRotation* rot270 = new TGeoRotation("rot270", 90., 270., 90., 0., 0., 0.);
137 const Float_t kWidth = 1.00;
138 const Float_t kThickness = 0.05;
139 const Float_t rBCM = 7.;
142 TGeoBBox* shBCMpcd = new TGeoBBox(kWidth/2., kWidth/2., kThickness/2.);
143 TGeoVolume* voBCMpcd = new TGeoVolume("BCMpcd", shBCMpcd, medPCD);
144 TGeoVolumeAssembly* voBCM = new TGeoVolumeAssembly("BCM");
146 voBCM->AddNode(voBCMpcd, 1, new TGeoCombiTrans(+rBCM, 0. , 0., rot000));
147 voBCM->AddNode(voBCMpcd, 2, new TGeoCombiTrans(0. , +rBCM , 0., rot090));
148 voBCM->AddNode(voBCMpcd, 3, new TGeoCombiTrans(-rBCM, 0., 0., rot180));
149 voBCM->AddNode(voBCMpcd, 4, new TGeoCombiTrans(0. , -rBCM , 0., rot270));
151 top->AddNode(voBCM, 1, new TGeoTranslation(0., 0., 1561.));
152 top->AddNode(voBCM, 2, new TGeoCombiTrans(0., 0., -1908., rotxz));
156 //_____________________________________________________________________________
157 void AliBCM::CreateMaterials()
160 // Create materials for BCM
162 // Polycristalline Diamond
164 Float_t absl = 86.3 / rho;
165 Float_t radl = 42.7 / rho;
167 Float_t epsil = .001; // Tracking precision,
168 Float_t stemax = -1.; // Maximum displacement for multiple scat
169 Float_t tmaxfd = -20. ; // Maximum angle due to field deflection
170 Float_t deemax = -.01; // Maximum fractional energy loss, DLS
172 Int_t isxfld = gAlice->Field()->Integ();
173 Float_t sxmgmx = gAlice->Field()->Max();
175 AliMaterial(1, "PCD", 12.011, 6., rho, radl, absl);
177 AliMedium(1, "PCD", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
180 //_____________________________________________________________________________
184 // Initialise BCM magnet after it has been built
188 if(AliLog::GetGlobalDebugLevel()>0) {
189 printf("\n%s: ",ClassName());
190 for(i=0;i<35;i++) printf("*");
191 printf(" BCM_INIT ");
192 for(i=0;i<35;i++) printf("*");
193 printf("\n%s: ",ClassName());
194 for(i=0;i<80;i++) printf("*");
199 // Here the BCM initialisation code (if any!)
200 fVolId = gMC->VolId("BCMpcd");
203 void AliBCM::MakeBranch(Option_t* option)
205 //Create Tree branches for the BCM
207 const Int_t kBufSize = 4000;
208 const char *cH = strstr(option,"H");
209 // const char *cD = strstr(option,"D");
210 // const char *cR = strstr(option,"R");
211 // const char *cS = strstr(option,"S");
213 if(cH && TreeH() && (fHits == 0x0)){
214 fHits = new TClonesArray("AliBCMHit");
216 MakeBranchInTree(TreeH(), "BCM" ,&fHits ,kBufSize, 0);
218 AliDetector::MakeBranch(option);
221 void AliBCM::SetTreeAddress()
223 // Set branch address
225 if (TreeH() && fHits==0x0)
226 fHits = new TClonesArray("AliBCMHit", 4000);
227 AliDetector::SetTreeAddress();
230 //_____________________________________________________________________________
231 AliLoader* AliBCM::MakeLoader(const char* topfoldername)
234 // Builds BCM getter (AliLoader type)
235 AliDebug(1,Form("Creating AliBCMLoader, Top folder is %s ",topfoldername));
236 fLoader = new AliBCMLoader(GetName(),topfoldername);