Skip to content
Snippets Groups Projects
Commit 4d44b696 authored by Chao Peng's avatar Chao Peng
Browse files

add envelope

parent 7772361a
No related branches found
No related tags found
1 merge request!10Resolve "Implement ce_MRICH"
This commit is part of merge request !10. Comments created here will be created in the context of that merge request.
#include <XML/Helper.h>
#include "TMath.h"
#include "TString.h"
#include "Math/Point2D.h"
#include "DDRec/Surface.h"
#include "DDRec/DetectorData.h"
#include "DD4hep/OpticalSurfaces.h"
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/Printout.h"
using namespace std;
using namespace dd4hep;
using namespace dd4hep::rec;
typedef ROOT::Math::XYPoint Point;
// create the detector
static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetector sens)
{
xml::DetElement detElem = handle;
std::string detName = detElem.nameStr();
int detID = detElem.id();
DetElement det(detName, detID);
xml::Component dims = detElem.dimensions();
xml::Component mods = detElem.child(_Unicode(modules));
xml::Component rads = detElem.child(_Unicode(radiator));
auto RIn = dims.attr<double>(_Unicode(r_in));
auto ROut = dims.attr<double>(_Unicode(r_out));
auto SizeZ = dims.attr<double>(_Unicode(size_z));
auto PosZ = dims.z();
auto InnerR = dims.attr<double>(_Unicode(inner_r));
auto mThick = mods.attr<double>(_Unicode(thickness));
auto mWidth = mods.attr<double>(_Unicode(width));
auto mGap = mods.attr<double>(_Unicode(gap));
auto envMat = desc.material(detElem.materialStr());
// detector envelope
auto envShape = Tube(RIn, ROut, SizeZ / 2., 0., 2*M_PI);
Volume envVol("ce_MRICH_GVol", envShape, envMat);
envVol.setVisAttributes(desc.visAttributes(detElem.visStr()));
// modules
// place envelope
Volume motherVol = desc.pickMotherVolume(det);
PlacedVolume envPV = motherVol.placeVolume(envVol, Position(0, 0, PosZ));
envPV.addPhysVolID("system", detID);
det.setPlacement(envPV);
return det;
}
// clang-format off
DECLARE_DETELEMENT(ce_MRICH, createDetector)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment