Beam Condition Monitor simulation kick start.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Jun 2007 07:48:34 +0000 (07:48 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Jun 2007 07:48:34 +0000 (07:48 +0000)
BCM/AliBCM.cxx [new file with mode: 0644]
BCM/AliBCM.h [new file with mode: 0644]
BCM/AliBCMHit.cxx [new file with mode: 0644]
BCM/AliBCMHit.h [new file with mode: 0644]
BCM/BCMLinkDef.h [new file with mode: 0644]
BCM/libBCM.pkg [new file with mode: 0644]

diff --git a/BCM/AliBCM.cxx b/BCM/AliBCM.cxx
new file mode 100644 (file)
index 0000000..4bf2ef1
--- /dev/null
@@ -0,0 +1,226 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  Beam Condition Monitor BCM                                               //
+//                                                                           //
+//  andreas.morsch@cern.ch                                                   // 
+///////////////////////////////////////////////////////////////////////////////
+#include <TVirtualMC.h>
+#include <TClonesArray.h>
+#include <TGeoMaterial.h>
+#include <TGeoMedium.h>
+#include <TGeoVolume.h>
+#include <TGeoMatrix.h>
+#include <TGeoPgon.h>
+#include <TGeoXtru.h>
+#include <TGeoCompositeShape.h>
+#include <TGeoManager.h>
+
+#include "AliBCM.h"
+#include "AliBCMHit.h"
+#include "AliMagF.h"
+#include "AliRun.h"
+#include "AliMC.h"
+ClassImp(AliBCM)
+
+//_____________________________________________________________________________
+AliBCM::AliBCM():
+    AliDetector(),
+    fVolId(0)
+{
+  //
+  // Default constructor for BCM
+  //
+}
+//_____________________________________________________________________________
+AliBCM::AliBCM(const char *name, const char *title): 
+    AliDetector(name,title),
+    fVolId(0)  
+{
+//
+//  Constructor
+    fHits  = new TClonesArray("AliBCMHit");
+    fNhits = 0;    
+    gAlice->GetMCApp()->AddHitList(fHits);
+}
+AliBCM::~AliBCM()
+{  
+    // Destructor
+    if(fHits)      delete fHits;
+}
+
+void AliBCM::StepManager()
+{
+//
+// Step Manager for ALICE Beam Condition Monitor
+//    
+
+    static Float_t edepT;    
+    static Double_t xh[3] = {0., 0., 0.};
+    Float_t edep = 0.;
+    Int_t   copy = -1; 
+    
+    
+    if (gMC->TrackCharge() && 
+       gMC->CurrentVolID(copy) == fVolId) {
+       // Charged particle inside sensitive volume
+       //
+       // Entering
+       if (gMC->IsTrackEntering()) {
+           edepT = 0.;
+           gMC->TrackPosition(xh[0],xh[1],xh[2]); 
+       }
+       
+       //
+       // Any step
+       if ((edep = gMC->Edep()) > 0.) {
+           Double_t x[3];   
+           gMC->TrackPosition(x[0],x[1],x[2]); 
+           edepT += edep;
+       }
+       //
+       // Exiting 
+       if(gMC->IsTrackExiting()||gMC->IsTrackStop()||gMC->IsTrackDisappeared())
+       {
+           Int_t track = gAlice->GetMCApp()->GetCurrentTrackNumber();
+           TClonesArray &lhits = *fHits;
+           Int_t ic = copy + 10;
+           if (xh[2] < 0.) ic+=10;
+           new(lhits[fNhits++]) AliBCMHit(1, track, xh, ic, edepT);
+       }
+    }
+
+    
+}
+
+//_____________________________________________________________________________
+void AliBCM::CreateGeometry()
+{
+    //
+    // Create geometry for BCM
+    //
+    
+    //
+    // Top volume 
+    TGeoVolume* top      = gGeoManager->GetVolume("ALIC");
+    // Media 
+    TGeoMedium* medPCD   = gGeoManager->GetMedium("BCM_PCD");
+    // Rotations
+    TGeoRotation* rotxz   = new TGeoRotation("rotxz" ,  270.,   0., 90.,  90., 180., 0.);
+    TGeoRotation* rot000  = new TGeoRotation("rot000",   90.,   0., 90.,  90.,   0., 0.);
+    TGeoRotation* rot090  = new TGeoRotation("rot090",   90.,  90., 90., 180.,   0., 0.);
+    TGeoRotation* rot180  = new TGeoRotation("rot180",   90., 180., 90., 270.,   0., 0.);
+    TGeoRotation* rot270  = new TGeoRotation("rot270",   90., 270., 90.,   0.,   0., 0.);
+    //
+    const Float_t kWidth     = 1.00;
+    const Float_t kThickness = 0.05;
+    const Float_t rBCM       = 7.;
+    
+    
+    TGeoBBox*   shBCMpcd = new TGeoBBox(kWidth/2., kWidth/2., kThickness/2.);
+    TGeoVolume* voBCMpcd = new TGeoVolume("BCMpcd", shBCMpcd, medPCD);
+    TGeoVolumeAssembly* voBCM = new TGeoVolumeAssembly("BCM");
+    
+    voBCM->AddNode(voBCMpcd, 1, new TGeoCombiTrans(+rBCM, 0.    , 0., rot000));
+    voBCM->AddNode(voBCMpcd, 2, new TGeoCombiTrans(0.   , +rBCM , 0., rot090));
+    voBCM->AddNode(voBCMpcd, 3, new TGeoCombiTrans(-rBCM, 0.,     0., rot180));
+    voBCM->AddNode(voBCMpcd, 4, new TGeoCombiTrans(0.   , -rBCM , 0., rot270));
+    
+    top->AddNode(voBCM, 1, new TGeoTranslation(0., 0., 1561.));
+    top->AddNode(voBCM, 2, new TGeoCombiTrans(0., 0., -1908., rotxz));
+    
+}
+
+//_____________________________________________________________________________
+void AliBCM::CreateMaterials()
+{
+  //
+  // Create materials for BCM
+  //
+  // Polycristalline Diamond
+    Float_t rho  = 3.53;
+    Float_t absl = 86.3 / rho;
+    Float_t radl = 42.7 / rho;
+    //
+    Float_t epsil  = .001;   // Tracking precision, 
+    Float_t stemax = -1.;    // Maximum displacement for multiple scat 
+    Float_t tmaxfd = -20. ;  // Maximum angle due to field deflection 
+    Float_t deemax = -.01;   // Maximum fractional energy loss, DLS 
+    Float_t stmin  = -.8;
+    Int_t   isxfld = gAlice->Field()->Integ();
+    Float_t sxmgmx = gAlice->Field()->Max();
+
+    AliMaterial(1, "PCD", 12.011, 6., rho, radl, absl);
+    //
+    AliMedium(1, "PCD", 1, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
+}
+
+//_____________________________________________________________________________
+void AliBCM::Init()
+{
+    //
+    // Initialise BCM magnet after it has been built
+    //
+  Int_t i;
+  //
+  if(AliLog::GetGlobalDebugLevel()>0) {
+    printf("\n%s: ",ClassName());
+    for(i=0;i<35;i++) printf("*");
+    printf(" BCM_INIT ");
+    for(i=0;i<35;i++) printf("*");
+    printf("\n%s: ",ClassName());
+    for(i=0;i<80;i++) printf("*");
+    printf("\n");
+  }
+
+    //
+    // Here the BCM initialisation code (if any!)
+    fVolId =  gMC->VolId("BCMpcd");
+}
+
+void AliBCM::MakeBranch(Option_t* option)
+{
+//Create Tree branches for the BCM
+    
+  const Int_t kBufSize = 4000;
+  const char *cH = strstr(option,"H");
+//  const char *cD = strstr(option,"D");
+//  const char *cR = strstr(option,"R");
+//  const char *cS = strstr(option,"S");
+
+  if(cH && TreeH() && (fHits == 0x0)){
+      fHits  = new TClonesArray("AliBCMHit");
+      fNhits = 0;    
+      MakeBranchInTree(TreeH(), "BCM" ,&fHits ,kBufSize, 0);
+  }
+  AliDetector::MakeBranch(option);
+}
+
+void AliBCM::SetTreeAddress()
+{
+  // Set branch address
+
+    if (TreeH() && fHits==0x0)
+       fHits   = new TClonesArray("AliBCMHit",  4000);
+    AliDetector::SetTreeAddress();
+}
diff --git a/BCM/AliBCM.h b/BCM/AliBCM.h
new file mode 100644 (file)
index 0000000..d44a03b
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef ALIBCM_H
+#define ALIBCM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+////////////////////////////////////////////////
+//  Manager class for detector BCM            //
+//  andreas.morsch@cern.ch                    //
+////////////////////////////////////////////////
+#include "AliDetector.h"
+class AliBCM : public AliDetector {
+ public:
+    AliBCM();
+    AliBCM(const char *name, const char *title);
+    virtual      ~AliBCM();
+    virtual void  CreateGeometry();
+    virtual void  CreateMaterials();
+    virtual void  Init();
+    virtual void  StepManager();
+    virtual void  MakeBranch(Option_t* option);
+    virtual void  SetTreeAddress();
+    
+    virtual Int_t IsVersion() const {return 0;}
+ private:
+    Int_t fVolId;  // Volume Id of the sensor
+   
+   ClassDef(AliBCM,1)  // Manager for detector BCM
+};
+
+#endif
diff --git a/BCM/AliBCMHit.cxx b/BCM/AliBCMHit.cxx
new file mode 100644 (file)
index 0000000..a95389b
--- /dev/null
@@ -0,0 +1,50 @@
+//  **************************************************************************
+//  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+//  *                                                                        *
+//  * Author: The ALICE Off-line Project.                                    *
+//  * Contributors are mentioned in the code where appropriate.              *
+//  *                                                                        *
+//  * Permission to use, copy, modify and distribute this software and its   *
+//  * documentation strictly for non-commercial purposes is hereby granted   *
+//  * without fee, provided that the above copyright notice appears in all   *
+//  * copies and that both the copyright notice and this permission notice   *
+//  * appear in the supporting documentation. The authors make no claims     *
+//  * about the suitability of this software for any purpose. It is          *
+//  * provided "as is" without express or implied warranty.                  *
+//  **************************************************************************
+
+
+/* $Id$ */
+
+//
+// BCM Hit Class
+// 
+// Detector Numberig 
+// 11, 12, 13, 14 for z > 0
+// 21, 22, 23, 24 for z < 0
+//
+// andreas.morsch@cern.ch
+
+
+#include "AliBCMHit.h"
+ClassImp(AliBCMHit);
+
+
+AliBCMHit::AliBCMHit():
+    AliHit(),
+    fId(-1),
+    fEdep(0)
+{
+    // Default constructor
+}
+
+AliBCMHit::AliBCMHit(Int_t shunt, Int_t track, Double_t x[3], Int_t isens, Float_t edep):
+    AliHit(shunt, track),
+    fId(isens),
+    fEdep(edep)
+{
+    // Constructor
+    fX = x[0];
+    fY = x[1];
+    fZ = x[2];
+}
diff --git a/BCM/AliBCMHit.h b/BCM/AliBCMHit.h
new file mode 100644 (file)
index 0000000..b7b88c1
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef ALIBCMHIT_H
+#define ALIBCMHIT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+//
+// Beam Condition Monitor (BCM) Hit Class
+//
+// andreas.morsch@cern.ch
+//
+#include "AliHit.h"
+
+class AliBCMHit : public AliHit 
+{
+ public:
+    AliBCMHit();
+    AliBCMHit(Int_t shunt, Int_t track, Double_t x[3], Int_t isens, Float_t edep);
+    Int_t Id() { return fId; }
+    
+ private:
+    Int_t fId;      // ID of the sensor (11, 12, 13, 14) for z > 0 and (21, 22, 23, 24) for z < 0
+    Float_t fEdep;  // Deposited energy [GeV]
+    
+    ClassDef(AliBCMHit, 1) // BCM hit class 
+};
+      
+#endif
diff --git a/BCM/BCMLinkDef.h b/BCM/BCMLinkDef.h
new file mode 100644 (file)
index 0000000..71d38ac
--- /dev/null
@@ -0,0 +1,13 @@
+#ifdef __CINT__
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ class  AliBCM+;
+#pragma link C++ class  AliBCMHit+;
+#endif
diff --git a/BCM/libBCM.pkg b/BCM/libBCM.pkg
new file mode 100644 (file)
index 0000000..fc94b4f
--- /dev/null
@@ -0,0 +1,6 @@
+SRCS=          AliBCM.cxx AliBCMHit.cxx
+
+HDRS= $(SRCS:.cxx=.h)
+
+DHDR:=BCMLinkDef.h
+