diff --git a/.build.ci.sh b/.build.ci.sh index e0b5edb0a0a7e589a43b74b7fafc6e16334476a9..011fd6aec2830f401761aa721d7f205ada99e475 100644 --- a/.build.ci.sh +++ b/.build.ci.sh @@ -2,7 +2,7 @@ # This is wrapper to run the build.sh on CI echo "LCG_RELEASE: ${LCG_RELEASE}" - +echo "CEPCSW_BLDTOOL: ${CEPCSW_BLDTOOL}" buildpid= logfile=mylog.txt diff --git a/.ci/github/Singularity b/.ci/github/Singularity new file mode 100644 index 0000000000000000000000000000000000000000..4303d620e6086c0bd09b64a007e980416f357acb --- /dev/null +++ b/.ci/github/Singularity @@ -0,0 +1,5 @@ +BootStrap:docker +From:centos:7 + +%post + yum install -y libicu which make redhat-lsb epel-release libglvnd-devel git mesa-libGLU-devel libXmu-devel motif-devel compat-db47 diff --git a/.ci/github/setup-github-runner.sh b/.ci/github/setup-github-runner.sh new file mode 100755 index 0000000000000000000000000000000000000000..0d7147c42c106a38a9ce5364d720a25361c2a5b9 --- /dev/null +++ b/.ci/github/setup-github-runner.sh @@ -0,0 +1,154 @@ +#!/bin/bash +############################################ +# Description: +# Manage the github runners in singularity +# Usage: +# $ ./setup-github-runner new <TOKEN> +# $ ./setup-github-runner start +# Author: Tao Lin <lintao AT ihep.ac.cn> +############################################ + + +############################################# +# Configuration +############################################# +export RUNNER_TOP_DIR=/tmp/$USER/github-runner +export SINGULARITY_BINDPATH=/cvmfs +export RUNNER_REPO=https://github.com/cepc/CEPCSW + +[ -d "$RUNNER_TOP_DIR" ] || mkdir $RUNNER_TOP_DIR + +############################################# +# Create a new github action runner (gar) +############################################# + +function gar-new-id() { + local currentid="$(find $RUNNER_TOP_DIR -maxdepth 1 -name github-runner-\* -type d | rev | cut -d- -f 1 | rev | sort -n | tail -n1)" + if [ -z "$currentid" ]; then + echo 1 + else + echo $((currentid+1)) + fi +} + +function gar-new-name() { + echo github-runner-$(gar-new-id) +} + +function gar-download-url() { + echo https://github.com/actions/runner/releases/download/v2.274.2/actions-runner-linux-x64-2.274.2.tar.gz +} +function gar-download-filename() { + echo actions-runner-linux-x64-2.274.2.tar.gz +} + +function gar-new() { + local dn=$(gar-new-name) + local fdn=$RUNNER_TOP_DIR/$dn + if [ -d "$fdn" ]; then + echo "ERROR: $dn already exists" 1>&2 + exit -1 + fi + + mkdir $fdn || { + echo "ERROR: Failed to create $fdn" 1>&2 + exit -1 + } + + + pushd $RUNNER_TOP_DIR + if [ ! -f "$(gar-download-filename)" ]; then + curl -O -L $(gar-download-url) || exit -1 + fi + popd + + pushd $fdn + + tar xzf $RUNNER_TOP_DIR/$(gar-download-filename) || exit -1 + + # start singularity instance + singularity instance start ~/github-runner.sif ${dn} + + singularity run instance://${dn} ./config.sh --url ${RUNNER_REPO} --token ${token} || exit -1 + singularity run instance://${dn} bash -c "./run.sh &" + + popd + +} + +function new() { + + token=$1; shift + if [ -z "$token" ]; then + echo "Please pass the token to this script" 1>&2 + exit -1 + fi + gar-new +} + +############################################# +# Start github action runners (gar) +############################################# + +function gar-lists() { + find $RUNNER_TOP_DIR -maxdepth 1 -name github-runner-\* -type d -exec basename {} \; +} + +function gar-check() { + local gar=$1; + local result=$(singularity instance list $gar | grep $gar) + if [ -n "$result" ]; then + echo Y + else + echo N + fi +} + +function gar-start() { + local gar=$1; + + local isrunning=$(gar-check $gar) + if [ "$isrunning" = "Y" ]; then + echo "WARNING: $gar is already running. skip it." + return + fi + + pushd $RUNNER_TOP_DIR/$gar + singularity instance start ~/github-runner.sif ${gar} + singularity run instance://${gar} bash -c "./run.sh &" + popd +} + +function start() { + local gars="$*" + if [ -z "$gars" ]; then + echo "All the github action runners will be started" + gars="$(gar-lists)" + fi + local gar + for gar in $gars; do + gar-start $gar + done +} + +############################################# +# Command line options +############################################# + +cmd=$1; shift +if [ -z "$cmd" ]; then + echo "Please specify the command to be invoked" 1>&2 + exit -1 +fi + +case $cmd in + new) + new $* + ;; + start) + start $* + ;; + *) + echo "Unknown command '$cmd'" 1>&2 + ;; +esac diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..50d11a4dca231e34b6f76a5898bbf95267b1b99e --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,49 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + pull_request: + branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: self-hosted + strategy: + matrix: + LCG_RELEASE: [LCG_98, KEY4HEP_STACK] + # CEPCSW_BLDTOOL: [make, ninja] + CEPCSW_BLDTOOL: [ninja] + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Run a one-line script + run: echo Hello, world! + + # Runs a set of commands using the runners shell + - name: Run a multi-line script + run: | + echo Add other actions to build, + echo test, and deploy your project. + + - name: Run the build script + run: | + pwd + bash ./.build.ci.sh + env: + LCG_RELEASE: ${{matrix.LCG_RELEASE}} + CEPCSW_BLDTOOL: ${{matrix.CEPCSW_BLDTOOL}} diff --git a/Analysis/CMakeLists.txt b/Analysis/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7e666e5bb77e848d9218a4ee66b5018fcd871a94 --- /dev/null +++ b/Analysis/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_subdirectory(TotalInvMass) +add_subdirectory(TrackInspect) diff --git a/Analysis/TotalInvMass/CMakeLists.txt b/Analysis/TotalInvMass/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6a9be88ec6a7332efd371b9aa91c4f5a0956623b --- /dev/null +++ b/Analysis/TotalInvMass/CMakeLists.txt @@ -0,0 +1,18 @@ + +gaudi_add_module(TotalInvMass + SOURCES src/TotalInvMass.cc + LINK k4FWCore::k4FWCore + Gaudi::GaudiKernel + Gaudi::GaudiAlgLib + ${CLHEP_LIBRARIES} + ${GSL_LIBRARIES} + ${LCIO_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict + ${ROOT_LIBRARIES} +) + +install(TARGETS TotalInvMass + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Analysis/TotalInvMass/src/TotalInvMass.cc b/Analysis/TotalInvMass/src/TotalInvMass.cc new file mode 100644 index 0000000000000000000000000000000000000000..536739b25b1939bb841dbb54216c21671c78a28c --- /dev/null +++ b/Analysis/TotalInvMass/src/TotalInvMass.cc @@ -0,0 +1,718 @@ +#include "TotalInvMass.hh" +#include <EVENT/LCCollection.h> +#include <IMPL/LCCollectionVec.h> +#include <EVENT/LCFloatVec.h> +#include <EVENT/MCParticle.h> +#include <EVENT/ReconstructedParticle.h> +#include <IMPL/MCParticleImpl.h> +#include <values.h> +#include <string> +#include <iostream> +#include <EVENT/LCFloatVec.h> +#include <EVENT/LCParameters.h> +#include <stdexcept> +#include <TFile.h> +#include <TTree.h> +#include <TH1F.h> +#include <TVector3.h> +#include <TRandom.h> +#include <Rtypes.h> +#include <sstream> +#include <cmath> +#include <vector> +#include <TMath.h> +#include "TLorentzVector.h" +#include <UTIL/CellIDDecoder.h> + +using namespace std; + +DECLARE_COMPONENT(TotalInvMass) + + +const float sqrts = 250.0; //GeV + +const string ECALCellIDDecoder = "M:3,S-1:3,I:9,J:9,K-1:6"; +//TH1F *h_hit; + +TotalInvMass::TotalInvMass(const std::string& name, ISvcLocator* svcLoc) + : GaudiAlgorithm(name, svcLoc), + _output(0) +{ + // _description = "Print MC Truth" ; + + /* + _colName="MCParticle"; + registerProcessorParameter( "MCObjects" , + "The name of the PFOs" , + _colName , + _colName); + */ + + /* + _leptonID = 13; + registerProcessorParameter( "LeptonIDTag" , + "Lepton ID that will be used in this analysis." , + _leptonID , + _leptonID); + */ + +} + +StatusCode TotalInvMass::initialize() { + info() << "TotalInvMass::initializing..." << endmsg; + // printParameters(); + + TFile *tree_file=new TFile(_treeFileName.value().c_str(),(_overwrite ? "RECREATE" : "UPDATE")); + + if (!tree_file->IsOpen()) { + delete tree_file; + tree_file=new TFile(_treeFileName.value().c_str(),"NEW"); + } + + //h_hit=new TH1F("hit","hit",80,0,80); + _outputTree = new TTree(_treeName.value().c_str(),_treeName.value().c_str()); + _outputTree->SetAutoSave(32*1024*1024); // autosave every 32MB + _outputTree->Branch("EventNr", &_eventNr, "EventNr/I"); + _outputTree->Branch("Num", &_Num, "Num/I"); + + _outputTree->Branch("OriQuarkID", &_OriQuarkID, "OriQuarkID/I"); + + _outputTree->Branch("ISREn", &_ISREn, "ISREn/F"); + _outputTree->Branch("ISRP", _ISRP, "ISRP[3]/F"); + _outputTree->Branch("ISRPt", &_ISRPt, "ISRPt/F"); + + + _outputTree->Branch("NEn", &_NEn, "NEn/F"); + _outputTree->Branch("NPt", &_NPt, "NPt/F"); + + _outputTree->Branch("N3En", &_N3En, "N3En/F"); + _outputTree->Branch("N3Pt", &_N3Pt, "N3Pt/F"); + + + _outputTree->Branch("OriJ1CosTheta", &_OriJ1CosTheta, "OriJ1CosTheta/F"); + _outputTree->Branch("OriJ2CosTheta", &_OriJ2CosTheta, "OriJ2CosTheta/F"); + _outputTree->Branch("MaxOriJetCosTheta", &_MaxOriJetCosTheta, "MaxOriJetCosTheta/F"); + + _outputTree->Branch("J1CosTheta", &_J1CosTheta, "J1CosTheta/F"); + _outputTree->Branch("J2CosTheta", &_J2CosTheta, "J2CosTheta/F"); + _outputTree->Branch("MaxJetCosTheta", &_MaxJetCosTheta, "MaxJetCosTheta/F"); + + _outputTree->Branch("OQDir", &_OQDir, "OQDir/F"); + _outputTree->Branch("HDPID", &_HDPID, "HDPID/I"); //Higgs Daughter Type, Direction?? + _outputTree->Branch("visE", &_visE, "visE/F"); //Higgs Daughter Type, Direction?? + _outputTree->Branch("HDir", &_HDir, "HDir/F"); + _outputTree->Branch("Mass_a", &_Mass_a, "Mass_a/F"); + _outputTree->Branch("Mass_p", &_Mass_p, "Mass_p/F"); + _outputTree->Branch("Mass_p_Pisr", &_Mass_p_Pisr, "Mass_p_Pisr"); + _outputTree->Branch("Mass_a_Pisr", &_Mass_a_Pisr, "Mass_a_Pisr"); + _outputTree->Branch("Mass_a_Plcal",&_Mass_a_Plcal, "Mass_a_Plcal"); + + _outputTree->Branch("TotalP_a", TotalP_a, "TotalP_a[4]/F"); + _outputTree->Branch("ChP", ChP, "ChP[4]/F"); + _outputTree->Branch("PhP", PhP, "PhP[4]/F"); //Gamma + _outputTree->Branch("NeP", NeP, "NeP[4]/F"); + _outputTree->Branch("FrP", FrP, "FrP[4]/F"); + + _outputTree->Branch("FrPh", FrPh, "FrPh[4]/F"); + _outputTree->Branch("FrNe", FrNe, "FrNe[4]/F"); + + _outputTree->Branch("KPF", KPF, "KPF[4]/F"); + + _outputTree->Branch("UdP", UdP, "UdP[4]/F"); + + _outputTree->Branch("TotalP_p", TotalP_p, "TotalP_p[4]/F"); + _outputTree->Branch("nCHPFO_a", &nCHPFO_a, "nCHPFO_a/I"); + _outputTree->Branch("nCHPFO_p", &nCHPFO_p, "nCHPFO_p/I"); + _outputTree->Branch("nNEPFO_a", &nNEPFO_a, "nNEPFO_a/I"); + _outputTree->Branch("nNEPFO_p", &nNEPFO_p, "nNEPFO_p/I"); + _outputTree->Branch("NeCaloE_a", NeCaloE_a, "NeCaloE_a[2]/F"); + _outputTree->Branch("NeCaloE_p", NeCaloE_p, "NeCaloE_p[2]/F"); + _outputTree->Branch("ElargeP", &ElargeP, "ElargeP[2]/F"); + _outputTree->Branch("TrkSumEn", &TrkSumEn, "TrkSumEn/F"); + _outputTree->Branch("EequP", &EequP, "EequP[2]/F"); + _outputTree->Branch("EsmallP", &EsmallP, "EsmallP[2]/F"); + + _outputTree->Branch("EcalTotalE", &_EcalTotalE, "EcalTotalE/F"); + _outputTree->Branch("EcalEn1", &_EcalEn1, "EcalEn1/F"); + _outputTree->Branch("EcalEn2", &_EcalEn2, "EcalEn2/F"); + _outputTree->Branch("EcalEn3", &_EcalEn3, "EcalEn3/F"); + _outputTree->Branch("EcalEn4", &_EcalEn4, "EcalEn4/F"); + _outputTree->Branch("EcalEn5", &_EcalEn5, "EcalEn5/F"); + _outputTree->Branch("HcalTotalE", &_HcalTotalE, "HcalTotalE/F"); + _outputTree->Branch("HcalEn1", &_HcalEn1, "HcalEn1/F"); + _outputTree->Branch("HcalEn2", &_HcalEn2, "HcalEn2/F"); + _outputTree->Branch("HcalEn3", &_HcalEn3, "HcalEn3/F"); + _outputTree->Branch("HcalEn4", &_HcalEn4, "HcalEn4/F"); + _outputTree->Branch("HcalEn5", &_HcalEn5, "HcalEn5/F"); + _outputTree->Branch("EcalCluE", &_EcalCluE, "EcalCluE/F"); + _outputTree->Branch("HcalCluE", &_HcalCluE, "HcalCluE/F"); + + _outputTree->Branch("EcalCluE_p", &_EcalCluE_p, "EcalCluE_p/F"); + _outputTree->Branch("HcalCluE_p", &_HcalCluE_p, "HcalCluE_p/F"); + + _outputPFO = new TTree("PFO","PFO"); + _outputPFO->Branch("EventNr", &_eventNr, "EventNr/I"); + _outputPFO->Branch("Num", &_Num, "Num/I"); + _outputPFO->Branch("Type", &Type, "Type/I"); // 0 == Arbor & 1 == Pandora + _outputPFO->Branch("Charge", &Charge, "Charge/I"); + _outputPFO->Branch("Energy", &Energy, "Energy/F"); + _outputPFO->Branch("P", P, "P[3]/F"); + _outputPFO->Branch("CluEn", &CluEn, "CluEn/F"); + _outputPFO->Branch("CluEnCom", CluEnCom, "CluEnCom[2]/F"); + + _outputPFO->Branch("TrackHit", &TrackHit, "TrackHit/I"); + _outputPFO->Branch("StartPos", StartPos, "StartPos[3]/F"); + _outputPFO->Branch("EndPos", EndPos, "EndPos[3]/F"); + + _Num = 0; + + info() << "TotalInvMass::initializd" << endmsg; + + return GaudiAlgorithm::initialize(); + +} + +StatusCode TotalInvMass::execute() +{ + info() << "TotalInvMass::executing..." << endmsg; + + EVENT::LCEvent* evtP = nullptr; + + // if (evtP) { + + TLorentzVector ArborTotalP(0, 0, 0, 0); + TLorentzVector ArborChP(0, 0, 0, 0); + TLorentzVector ArborPhP(0, 0, 0, 0); + TLorentzVector ArborNeP(0, 0, 0, 0); + TLorentzVector ArborFrP(0, 0, 0, 0); + TLorentzVector ArborUdP(0, 0, 0, 0); + TLorentzVector ArborFrPh(0, 0, 0, 0); + TLorentzVector ArborFrNe(0, 0, 0, 0); + TLorentzVector ArborKPF(0, 0, 0, 0); + TLorentzVector PandoraTotalP(0, 0, 0, 0); + TLorentzVector ArborLCAL(0, 0, 0, 0); + TLorentzVector ArborISR(0, 0, 0, 0); + TLorentzVector PandoraISR(0, 0, 0, 0); + + // TODO: using the event header + // _eventNr = evtP->getEventNumber(); + + for(int i0 = 0; i0 < 4; i0++) { + TotalP_a[i0] = 0; + TotalP_p[i0] = 0; + ChP[i0] = 0; + PhP[i0] = 0; + NeP[i0] = 0; + FrP[i0] = 0; + UdP[i0] = 0; + FrPh[i0] = 0; + FrNe[i0] = 0; + KPF[i0] = 0; + if(i0 < 2) { + NeCaloE_a[i0] = 0; + NeCaloE_p[i0] = 0; + CluEnCom[i0] = 0; + ElargeP[i0] = 0; + EequP[i0] = 0; + EsmallP[i0] = 0; + } + if(i0 < 3) { + P[i0] = 0; + } + } + + nCHPFO_a = 0; + nCHPFO_p = 0; + nNEPFO_a = 0; + nNEPFO_p = 0; + Type = -100; + Charge = -100; + Energy = 0; + CluEn = 0; + TrkSumEn = 0; + + _EcalTotalE = 0; _HcalTotalE = 0; _EcalCluE = 0; _HcalCluE = 0; + _EcalCluE_p = 0; _HcalCluE_p = 0; + _HcalEn1=0;_HcalEn2=0;_HcalEn3=0;_HcalEn4=0;_HcalEn5=0; + _EcalEn1=0;_EcalEn2=0;_EcalEn3=0;_EcalEn4=0;_EcalEn5=0; + + _HDPID = -1; + _OriQuarkID = 0; + _OQDir = -10; + _HDir = -10; + _visE=0; + + _J1CosTheta = -2; + _J2CosTheta = -2; + + std::vector<CaloHitColHandler*> hdl_EcalHitColl{ + &m_ecalbarrelhitcol, + &m_ecalendcaphitcol + }; + std::vector<CaloHitColHandler*> hdl_HcalHitColl{ + &m_hcalbarrelhitcol, + &m_hcalendcaphitcol, + &m_hcalotherhitcol + }; + + std::vector<std::string> EcalHitColl; + std::vector<std::string> HcalHitColl; + EcalHitColl.push_back("ECALBarrel"); + EcalHitColl.push_back("ECALEndcap"); + //EcalHitColl.push_back("ECALOther"); + //EcalHitColl.push_back("LCAL"); + //EcalHitColl.push_back("LHCAL"); + HcalHitColl.push_back("HCALBarrel"); + HcalHitColl.push_back("HCALEndcap"); + HcalHitColl.push_back("HCALOther"); + + try{ + + for(int t = 0; t< int(hdl_EcalHitColl.size()); t++) { + const edm4hep::CalorimeterHitCollection* ecalcoll = hdl_EcalHitColl[t]->get(); + for(auto hit: *ecalcoll) { + // TODO + int NLayer = 0; + _EcalTotalE += hit.getEnergy(); + + // UTIL::CellIDDecoder<EVENT::CalorimeterHit> idDecoder(ECALCellIDDecoder); + // int NLayer = idDecoder(a_hit)["K-1"]; + //h_hit->Fill(NLayer,a_hit->getEnergy()); + if(NLayer < 6) { + _EcalEn1 += hit.getEnergy(); + } else if(NLayer < 12) { + _EcalEn2 += hit.getEnergy(); + } else if(NLayer < 18) { + _EcalEn3 += hit.getEnergy(); + } else if(NLayer < 24) { + _EcalEn4 += hit.getEnergy(); + } else{ + _EcalEn5 += hit.getEnergy(); + } + } + } + + for(int t2 = 0; t2< int(hdl_HcalHitColl.size()); t2++) { + const edm4hep::CalorimeterHitCollection* hcalcoll = hdl_HcalHitColl[t2]->get(); + for (auto hit: *hcalcoll) { + // TODO + int NLayer = 0; + int HLayer = NLayer+30; + // UTIL::CellIDDecoder<EVENT::CalorimeterHit> idDecoder(ECALCellIDDecoder); + // int NLayer = idDecoder(a_hit)["K-1"]; + + //h_hit->Fill(HLayer,a_hit->getEnergy()); + _HcalTotalE += hit.getEnergy(); + if(NLayer < 10) { + _HcalEn1 += hit.getEnergy(); + } else if(NLayer < 20) { + _HcalEn2 += hit.getEnergy(); + } else if(NLayer < 30) { + _HcalEn3 += hit.getEnergy(); + } else if(NLayer < 40) { + _HcalEn4 += hit.getEnergy(); + } else { + _HcalEn5 += hit.getEnergy(); + } + } + } + + + }catch(lcio::DataNotAvailableException err) { } + + try{ + auto MCPCol = m_mcParticle.get(); + + TVector3 tmpP; + TVector3 ISRP(0, 0, 0); + _N3En = 0; + _N3Pt = 0; + + int NNeutrinoCount = 0; + + for (int s0 = 0; s0 < MCPCol->size(); ++s0) { + auto MCP = (*MCPCol)[s0]; + int tmpPID = MCP.getPDG(); + int NParent = MCP.parents_size(); + int NDaughter = MCP.daughters_size(); + auto VTX0 = MCP.getVertex(); + auto EndP0 = MCP.getEndpoint(); + TVector3 VTX(VTX0.x, VTX0.y, VTX0.z); + TVector3 EndP(EndP0.x, EndP0.y, EndP0.z); + + if(tmpPID == 22 && NParent == 0 && s0 < 4) { + auto tmpP0 = MCP.getMomentum(); + tmpP = TVector3(tmpP0.x, tmpP0.y, tmpP0.z); + ISRP += tmpP; + } + + if( (abs(tmpPID) == 12 || abs(tmpPID) == 14 || abs(tmpPID) == 16) && NParent != 0 && NDaughter == 0 && VTX.Mag() < 100 && EndP.Mag() > 100) { + _NEn += tmpP.Mag(); + _NPt += tmpP.Perp(); + NNeutrinoCount++; + if(NNeutrinoCount > 2) { + auto tmpP0 = MCP.getMomentum(); + tmpP = TVector3(tmpP0.x, tmpP0.y, tmpP0.z); + _N3En += tmpP.Mag(); + _N3Pt += tmpP.Perp(); + cout<<"Found Neutrino: "<<NNeutrinoCount<<" En "<<_N3En<<" Pt "<<_N3Pt<<endl; + } + } + + if(tmpPID == 25 && NDaughter > 1 && NParent !=0 ) { //Higgs + // cout<<"tmpPID:HDPID"<<tmpPID<<" "<<NDaughter<<" "<<NParent<<endl; + _HDPID = abs(MCP.getDaughters(0).getPDG()); + _HDir = MCP.getMomentum()[2]/MCP.getEnergy(); + + if(NDaughter == 2) { + auto D1 = MCP.getDaughters(0); + _J1CosTheta = D1.getMomentum()[2]/D1.getEnergy(); + auto D2 = MCP.getDaughters(1); + _J2CosTheta = D2.getMomentum()[2]/D2.getEnergy(); + } + } + if(abs(tmpPID)<7 && NParent == 0) { + if(tmpPID>0) + _OriJ1CosTheta =MCP.getMomentum()[2]/MCP.getEnergy(); + else + _OriJ2CosTheta = MCP.getMomentum()[2]/MCP.getEnergy(); + } + + if(abs(tmpPID)<7 && NParent == 0) { + _OriQuarkID = abs(tmpPID); + _OQDir = MCP.getMomentum()[2]/MCP.getEnergy(); + } + + + if(abs(_J1CosTheta) > abs(_J2CosTheta)) + _MaxJetCosTheta = _J1CosTheta; + else + _MaxJetCosTheta = _J2CosTheta; + + if(abs(_OriJ1CosTheta) > abs(_OriJ2CosTheta)) + _MaxOriJetCosTheta = _OriJ1CosTheta; + else + _MaxOriJetCosTheta = _OriJ2CosTheta; + + if( (fabs(VTX.Z()) < 1000 && fabs(VTX.Perp()) < 1600 ) && ( fabs(EndP.Z()) > 2000 || fabs(EndP.Perp()) > 1600 )&&abs(tmpPID)!=12&&abs(tmpPID)!=14&&abs(tmpPID)!=16 ){ + _visE+=MCP.getEnergy(); + } + } + + _ISRPt = ISRP.Perp(); + _ISREn = ISRP.Mag(); + _ISRP[0] = ISRP.X(); + _ISRP[1] = ISRP.Y(); + _ISRP[2] = ISRP.Z(); + + }catch(lcio::DataNotAvailableException err) { } + + try{ + auto col_RecoNeP = m_reconep.get(); + for(int i0 = 0; i0 < col_RecoNeP->size(); i0++) { + auto a_RecoP = (*col_RecoNeP)[i0]; + TLorentzVector currP( a_RecoP.getMomentum()[0], a_RecoP.getMomentum()[1], a_RecoP.getMomentum()[2], a_RecoP.getEnergy()); + ArborTotalP += currP; + auto currMom0 = a_RecoP.getMomentum(); + TVector3 currMom(currMom0.x, currMom0.y, currMom0.z); + // if(a_RecoP->getType() == 22 && a_RecoP->getEnergy() > 2) //Compensate... + // ArborTotalP += 0.98*currP; + // else + // ArborTotalP += currP; + + if(a_RecoP.getCharge() != 0) { + ArborChP += currP; + } else if(a_RecoP.getType() == 310) { + ArborKPF += currP; + } else if(a_RecoP.getType() == 22) { + if(a_RecoP.getEnergy() < 3.0) + ArborFrPh += currP; + else + ArborPhP += currP; + } else if(a_RecoP.getType() == 2112) { + if(a_RecoP.getEnergy() < 3.0) + ArborFrNe += currP; + else + ArborNeP += currP; + } else if(a_RecoP.getEnergy() < 3.0) { + ArborFrP += currP; + cout<<"Undef "<<a_RecoP.getType()<<endl; + } else { + ArborUdP += currP; + cout<<"Undef "<<a_RecoP.getType() << "En "<<a_RecoP.getEnergy()<<endl; + } + + if(a_RecoP.clusters_size() > 0) { + auto a_clu = a_RecoP.getClusters(0); + auto CluPos0 = a_clu.getPosition(); + TVector3 CluPos(CluPos0.x, CluPos0.y, CluPos0.z); + if( CluPos.Perp() < 300 && abs(CluPos.Z()) < 1300 && a_RecoP.getCharge() == 0 ) // 1150-1300 + ArborLCAL += currP; + + float MinAngleToCH = 1.0E6; + float MinAngleToNE = 1.0E6; + + if(a_RecoP.getEnergy() > 5 && a_RecoP.getCharge() == 0) { + for(int i1 = 0; i1 < col_RecoNeP->size(); i1++) { + if(i1 != i0) { + auto b_RecoP = (*col_RecoNeP)[i1]; + auto tmpMom0 = b_RecoP.getMomentum(); + TVector3 tmpMom(tmpMom0.x, tmpMom0.y, tmpMom0.z); + float tmpAngle = currMom.Angle(tmpMom); + if( b_RecoP.getEnergy() > 3.0 ) { + if(b_RecoP.getCharge() != 0) { + if(tmpAngle < MinAngleToCH) { + MinAngleToCH = tmpAngle; + } + } else { + if(tmpAngle < MinAngleToNE) { + MinAngleToNE = tmpAngle; + } + } + } + } + } + + if( MinAngleToNE > 0.5 || MinAngleToCH > 0.5 ) { + ArborISR += currP; + } + } + } + + TrackHit = 0; + for(int k = 0; k < 3; k++) { + StartPos[k] = 0; + EndPos[k] = 0; + } + + Charge = int(a_RecoP.getCharge()); + CluEn = 0; + CluEnCom[0] = 0; + CluEnCom[1] = 0; + + if(Charge) { + Type = 1; + nCHPFO_a ++; + } else { + Type = 0; + nNEPFO_a ++; + } + + Energy = a_RecoP.getEnergy(); + P[0] = a_RecoP.getMomentum()[0]; + P[1] = a_RecoP.getMomentum()[1]; + P[2] = a_RecoP.getMomentum()[2]; + + if(a_RecoP.clusters_size() > 0) { + + auto currClu = a_RecoP.getClusters(0); + CluEn = currClu.getEnergy(); + + if((!Charge) and (currClu.subdetectorEnergies_size() > 2)) { + CluEnCom[0] = currClu.getSubdetectorEnergies(0); + CluEnCom[1] = currClu.getSubdetectorEnergies(1); + NeCaloE_a[0] += currClu.getSubdetectorEnergies(0); + NeCaloE_a[1] += currClu.getSubdetectorEnergies(1); + } + + if (currClu.subdetectorEnergies_size() > 2) { + _EcalCluE += currClu.getSubdetectorEnergies(0); + _HcalCluE += currClu.getSubdetectorEnergies(1); + } + + + if(Charge) { + TrkSumEn += Energy; + + if (a_RecoP.tracks_size()>0) { + auto a_Trk = a_RecoP.getTracks(0); + TrackHit = a_Trk.trackerHits_size(); + + if (TrackHit>2) { + StartPos[0] = (a_Trk.getTrackerHits(0)).getPosition()[0]; + StartPos[1] = (a_Trk.getTrackerHits(0)).getPosition()[1]; + StartPos[2] = (a_Trk.getTrackerHits(0)).getPosition()[2]; + + EndPos[0] = (a_Trk.getTrackerHits(TrackHit - 1)).getPosition()[0]; + EndPos[1] = (a_Trk.getTrackerHits(TrackHit - 1)).getPosition()[1]; + EndPos[2] = (a_Trk.getTrackerHits(TrackHit - 1)).getPosition()[2]; + } + } + + if( Energy > CluEn + sqrt(Energy)) { + ElargeP[0] += Energy; + ElargeP[1] += CluEn; + } else if( fabs(Energy - CluEn) < sqrt(Energy) ) { + EequP[0] += Energy; + EequP[1] += CluEn; + } else { + EsmallP[0] += Energy; + EsmallP[1] += CluEn; + } + + } + } + + _outputPFO->Fill(); + + } + }catch (lcio::DataNotAvailableException err) { } + + try{ + //LCCollection* col_RecoPandora = evtP->getCollection( "PandoraPFOs" ); + //for(int i2 = 0; i2 < col_RecoPandora->getNumberOfElements(); i2++) + for(int s = 0; s < 1; s++) { + auto col_PFO_iter = m_arbopfo.get(); + /* + if(s==0) + col_PFO_iter = evtP->getCollection( "ArborChargedCore" ); + else + col_PFO_iter = evtP->getCollection( "ArborNeutralCore" ); + */ + + for(int i2 = 0; i2 < col_PFO_iter->size(); i2++) { + auto a_RecoP = (*col_PFO_iter)[i2]; + TLorentzVector currP( a_RecoP.getMomentum()[0], a_RecoP.getMomentum()[1], a_RecoP.getMomentum()[2], a_RecoP.getEnergy()); + PandoraTotalP += currP; + + if(a_RecoP.getCharge()) { + nCHPFO_p++; + } else { + nNEPFO_p++; + } + + auto currMom0 = a_RecoP.getMomentum(); + TVector3 currMom(currMom0.x, currMom0.y, currMom0.z); + + if(a_RecoP.clusters_size() > 0) { + + float MinAngleToCH = 1.0E6; + float MinAngleToNE = 1.0E6; + + auto currClu = a_RecoP.getClusters(0); + CluEn = currClu.getEnergy(); + + _EcalCluE_p += CluEn; + _HcalCluE_p += currClu.getSubdetectorEnergies(1); + + if(a_RecoP.getEnergy() > 5 && a_RecoP.getCharge() == 0) { + for(int i3 = 0; i3 < col_PFO_iter->size(); i3++) { + if(i3 != i2) { + auto b_RecoP = (*col_PFO_iter)[i3]; + auto tmpMom0 = b_RecoP.getMomentum(); + TVector3 tmpMom(tmpMom0.x, tmpMom0.y, tmpMom0.z); + float tmpAngle = currMom.Angle(tmpMom); + if( b_RecoP.getEnergy() > 3.0 ) { + if(b_RecoP.getCharge() != 0) { + if(tmpAngle < MinAngleToCH) { + MinAngleToCH = tmpAngle; + } + } else { + if(tmpAngle < MinAngleToNE) { + MinAngleToNE = tmpAngle; + } + } + } + } + } + + if( MinAngleToNE > 0.5 || MinAngleToCH > 0.5 ) { + PandoraISR += currP; + } + } + } + } + } + }catch (lcio::DataNotAvailableException err) { } + + _Mass_a = 0; + _Mass_p = 0; + _Mass_a_Pisr = 0; + _Mass_a_Plcal = 0; + _Mass_p_Pisr = 0; + + _Mass_a = ArborTotalP.M(); + _Mass_p = PandoraTotalP.M(); + + _Mass_a_Pisr = (ArborTotalP - ArborISR).M(); + _Mass_a_Plcal = (ArborTotalP - ArborLCAL).M(); + _Mass_p_Pisr = (PandoraTotalP - PandoraISR).M(); + + TotalP_a[0] = ArborTotalP.X(); + TotalP_a[1] = ArborTotalP.Y(); + TotalP_a[2] = ArborTotalP.Z(); + TotalP_a[3] = ArborTotalP.T(); + + TotalP_p[0] = PandoraTotalP.X(); + TotalP_p[1] = PandoraTotalP.Y(); + TotalP_p[2] = PandoraTotalP.Z(); + TotalP_p[3] = PandoraTotalP.T(); + + ChP[0] = ArborChP.X(); + ChP[1] = ArborChP.Y(); + ChP[2] = ArborChP.Z(); + ChP[3] = ArborChP.T(); + + PhP[0] = ArborPhP.X(); + PhP[1] = ArborPhP.Y(); + PhP[2] = ArborPhP.Z(); + PhP[3] = ArborPhP.T(); + + NeP[0] = ArborNeP.X(); + NeP[1] = ArborNeP.Y(); + NeP[2] = ArborNeP.Z(); + NeP[3] = ArborNeP.T(); + + FrP[0] = ArborFrP.X(); + FrP[1] = ArborFrP.Y(); + FrP[2] = ArborFrP.Z(); + FrP[3] = ArborFrP.T(); + + UdP[0] = ArborUdP.X(); + UdP[1] = ArborUdP.Y(); + UdP[2] = ArborUdP.Z(); + UdP[3] = ArborUdP.T(); + + FrPh[0] = ArborFrPh.X(); + FrPh[1] = ArborFrPh.Y(); + FrPh[2] = ArborFrPh.Z(); + FrPh[3] = ArborFrPh.T(); + + FrNe[0] = ArborFrNe.X(); + FrNe[1] = ArborFrNe.Y(); + FrNe[2] = ArborFrNe.Z(); + FrNe[3] = ArborFrNe.T(); + + KPF[0] = ArborKPF.X(); + KPF[1] = ArborKPF.Y(); + KPF[2] = ArborKPF.Z(); + KPF[3] = ArborKPF.T(); + + cout<<_Mass_a<<" : "<<_Mass_p<<endl; + + _outputTree->Fill(); + _Num++; + // } + + + info() << "TotalInvMass::execute done" << endmsg; + + return StatusCode::SUCCESS; + +} + +StatusCode TotalInvMass::finalize() +{ + + if (_outputTree) { + + TFile *tree_file = _outputTree->GetCurrentFile(); //just in case we switched to a new file + tree_file->Write(); + delete tree_file; + } + + return GaudiAlgorithm::finalize(); +} + + + diff --git a/Analysis/TotalInvMass/src/TotalInvMass.hh b/Analysis/TotalInvMass/src/TotalInvMass.hh new file mode 100644 index 0000000000000000000000000000000000000000..97d48d5ad80a82aa59ab6c3769b04bbae016afd8 --- /dev/null +++ b/Analysis/TotalInvMass/src/TotalInvMass.hh @@ -0,0 +1,125 @@ +#ifndef _TotalInvMass_hh_ +#define _TotalInvMass_hh_ + +#include "GaudiAlg/GaudiAlgorithm.h" +#include <Gaudi/Property.h> + +#include "k4FWCore/DataHandle.h" + +#include <string> +#include <iostream> +#include <fstream> +#include <TNtuple.h> +#include <TObject.h> +#include <TTree.h> +#include <TFile.h> + +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/CalorimeterHitCollection.h" +#include "edm4hep/ReconstructedParticleCollection.h" + +class TotalInvMass : public GaudiAlgorithm +{ +public: + + TotalInvMass(const std::string& name, ISvcLocator* svcLoc); + + ~TotalInvMass() {}; + + StatusCode initialize() override; + + StatusCode execute() override; + + StatusCode finalize() override; + +protected: + typedef DataHandle<edm4hep::MCParticleCollection> MCParticleColHandler; + MCParticleColHandler m_mcParticle{"MCParticle", Gaudi::DataHandle::Reader, this}; + + typedef DataHandle<edm4hep::CalorimeterHitCollection> CaloHitColHandler; + CaloHitColHandler m_ecalbarrelhitcol{"ECALBarrel", Gaudi::DataHandle::Reader, this}; + CaloHitColHandler m_ecalendcaphitcol{"ECALEndcap", Gaudi::DataHandle::Reader, this}; + + CaloHitColHandler m_hcalbarrelhitcol{"HCALBarrel", Gaudi::DataHandle::Reader, this}; + CaloHitColHandler m_hcalendcaphitcol{"HCALEndcap", Gaudi::DataHandle::Reader, this}; + CaloHitColHandler m_hcalotherhitcol {"HCALOther", Gaudi::DataHandle::Reader, this}; + + typedef DataHandle<edm4hep::ReconstructedParticleCollection> RecParticleColHandler; + RecParticleColHandler m_reconep{"AncientPFOs", Gaudi::DataHandle::Reader, this}; + RecParticleColHandler m_arbopfo{"ArborLICHPFOs", Gaudi::DataHandle::Reader, this}; + + Gaudi::Property<std::string> _treeFileName{this, + "TreeOutputFile", "MCTruth.root", + "The name of the file to which the ROOT tree will be written"}; + Gaudi::Property<std::string> _treeName{this, + "TreeName", "MCPart", + "The name of the ROOT tree"}; + std::string _colName; + std::string _colAdcVals; + + Gaudi::Property<int> _overwrite{this, + "OverwriteFile", 0, + "If zero an already existing file will not be overwritten."}; + int _leptonID; + float _cmsE; + TTree *_outputTree, *_outputPFO; + float _ISRP[3]; + float _ISREn, _ISRPt; + float _N3En, _N3Pt; + float _NEn, _NPt; + + int _HDPID, _OriQuarkID; + float _OQDir, _HDir; + int _NMuP, _NMuM, _NChP, _NChM; + float _P_MuP[4], _P_MuM[4], _P_DL[4]; + int _EventType; + float _InvMass, _RecoilMass; + float _J1CosTheta, _J2CosTheta, _MaxJetCosTheta; + float _OriJ1CosTheta, _OriJ2CosTheta, _MaxOriJetCosTheta; + float _Mass_a, _Mass_p; + + int _PID1, _PID2; + float _PL1[4], _PL2[4], _RPL1[4], _RPL2[4], _SM[4], _P_allCharged[4], _P_allNeutral[4], _P_Higgs[4], _P_allReco[4]; + float _Hmass; + int _Num; + int _NHDaug; + int _HdaughterPID; + int _ZdaughterPID; + float _Pz[4], _Ph[4], _PzD1[4], _PzD2[4], _PhD1[4], _PhD2[4], _RPzD1[4], _RPzD2[4], _RPhD1[4], _RPhD2[4]; + float _P[4], _SumP[4], _VisP[4], _MissP[4]; + int _PID, _NFMCP, _MotherFlag, _NNeutrino; + float _ENeutrino, _DiPhMass, _DiPhMassCorr; + // float _CosTheta, _Phi, _Charge; + float _Mz, _Mrecoil, _MzReco, _MhReco, _MrecoilReco; + float KthEn[7][9]; + unsigned int _eventNr; + + float _Mass_p_Pisr, _Mass_a_Pisr, _Mass_a_Plcal; + + float TotalP_a[4], TotalP_p[4]; + int nCHPFO_a, nCHPFO_p, nNEPFO_a, nNEPFO_p; + float NeCaloE_a[2], NeCaloE_p[2]; + float ElargeP[2], EequP[2], EsmallP[2]; + + float ChP[4], FrP[4], PhP[4], NeP[4], UdP[4], FrPh[4], FrNe[4], KPF[4]; + float _EcalTotalE, _HcalTotalE, _EcalCluE, _HcalCluE, _EcalCluE_p, _HcalCluE_p; + float _HcalEn1, _HcalEn2,_HcalEn3,_HcalEn4,_HcalEn5; + float _EcalEn1, _EcalEn2,_EcalEn3,_EcalEn4,_EcalEn5; + + int Type, Charge; + float Energy, TrkSumEn; + float P[3], CluEnCom[2]; + float CluEn; + + int TrackHit; + float StartPos[3], EndPos[3]; + float _visE; + + std::string _fileName; + std::ostream *_output; + std::string _histFileName; +}; + +#endif + + diff --git a/Analysis/TrackInspect/CMakeLists.txt b/Analysis/TrackInspect/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..fa42c0508250c1fb1f7e7f2afcb68c8452cbe3ce --- /dev/null +++ b/Analysis/TrackInspect/CMakeLists.txt @@ -0,0 +1,16 @@ + +# Modules +gaudi_add_module(TrackInspect + SOURCES src/TrackInspectAlg.cpp + LINK DataHelperLib + Gaudi::GaudiKernel + EDM4HEP::edm4hep + ${ROOT_LIBRARIES} + ${CLHEP_LIBRARIES} +) + +install(TARGETS TrackInspect + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Analysis/TrackInspect/src/TrackInspectAlg.cpp b/Analysis/TrackInspect/src/TrackInspectAlg.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9e9fde8cc53671b41d5afdf806a85c7b8ceca6b6 --- /dev/null +++ b/Analysis/TrackInspect/src/TrackInspectAlg.cpp @@ -0,0 +1,376 @@ +/***********************************************************************************\ +* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations * +* * +* This software is distributed under the terms of the Apache version 2 licence, * +* copied verbatim in the file "LICENSE". * +* * +* In applying this licence, CERN does not waive the privileges and immunities * +* granted to it by virtue of its status as an Intergovernmental Organization * +* or submit itself to any jurisdiction. * +\***********************************************************************************/ +/* The algorithm is created by Mingrui ZHAO. + * It is transplanted from Marlin to Gaudi by Shunan ZHANG and Mingrui ZHAO. + * It is now maintained by Mingrui ZHAO (mingrui.zhao@mail.labz0.org) + * please contact if you have any question. + * + * ------------------------------------ + * The algorithm inspects the MCParticles and the correponding tracks. + * The output of the algorithm is a tuple. + * In each element of the tuple, it contains: + * The information of the MCParticle, + * The information of the corresponding tracks. + * If the number of reconstructed track candidates is larger than 1, + * each reconstructed track will occupy an element of the tuple, and they + * will be differred through the "nCandidates", + * + * Establishment of the correspondance: + * MCParticle -(1)-> SimTrackerHit -(2)-> TrackerHits -(3)-> Track + * + * + * + */ +// Include files +#include "TrackInspectAlg.h" + +#include "GaudiKernel/DataObject.h" +#include "GaudiKernel/IHistogramSvc.h" +#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/SmartDataPtr.h" + +#include "DataHelper/HelixClass.h" + +#include "CLHEP/Units/SystemOfUnits.h" +#include <math.h> +#include <TTree.h> +#include <TFile.h> +#include <TLorentzVector.h> +#include <TVector3.h> +#include <vector> +#include <iostream> + +DECLARE_COMPONENT( TrackInspectAlg ) + +//------------------------------------------------------------------------------ +TrackInspectAlg::TrackInspectAlg( const std::string& name, ISvcLocator* pSvcLocator ) + : Algorithm( name, pSvcLocator ) { + declareProperty("TrackCollection", _inTrackColHdl, "Handle of the Input Track collection"); + declareProperty("MCParticleCollection", _inMCParticleColHdl, "Handle of the Input MC particle collection"); + + declareProperty("TPCTrackerHitRelations", _TPCRelColHdl, "Handle of the TPC Tracker Hit relations"); + declareProperty("VXDTrackerHitRelations", _VXDRelColHdl, "Handle of the TPC Tracker Hit relations"); + declareProperty("SITTrackerHitRelations", _SITRelColHdl, "Handle of the TPC Tracker Hit relations"); + declareProperty("SETTrackerHitRelations", _SETRelColHdl, "Handle of the TPC Tracker Hit relations"); + declareProperty("FTDTrackerHitRelations", _FTDRelColHdl, "Handle of the TPC Tracker Hit relations"); + + declareProperty("useTPC", _useTPC, "flag whether to use TPC hits"); + declareProperty("useVXD", _useVXD, "flag whether to use VXD hits"); + declareProperty("useSIT", _useSIT, "flag whether to use SIT hits"); + declareProperty("useSET", _useSET, "flag whether to use SET hits"); + declareProperty("useFTD", _useFTD, "flag whether to use FTD hits"); + + m_thisName = name; + } + +//------------------------------------------------------------------------------ +StatusCode TrackInspectAlg::initialize(){ + info() << "Booking Ntuple" << endmsg; + + NTuplePtr nt1(ntupleSvc(), "MyTuples/Track"+m_thisName); + if ( !nt1 ) { + m_tuple = ntupleSvc()->book("MyTuples/Track"+m_thisName,CLID_ColumnWiseTuple,"Tracking result"); + if ( 0 != m_tuple ) { + m_tuple->addItem ("nmc", m_nParticles, 0, 1000 ).ignore(); + m_tuple->addIndexedItem ("vx", m_nParticles, vx ).ignore(); + m_tuple->addIndexedItem ("vy", m_nParticles, vy ).ignore(); + m_tuple->addIndexedItem ("vz", m_nParticles, vz ).ignore(); + m_tuple->addIndexedItem ("ex", m_nParticles, ex ).ignore(); + m_tuple->addIndexedItem ("ey", m_nParticles, ey ).ignore(); + m_tuple->addIndexedItem ("ez", m_nParticles, ez ).ignore(); + m_tuple->addIndexedItem ("Omega", m_nParticles, Omega ).ignore(); + m_tuple->addIndexedItem ("D0", m_nParticles, D0 ).ignore(); + m_tuple->addIndexedItem ("Z0", m_nParticles, Z0 ).ignore(); + m_tuple->addIndexedItem ("Phi", m_nParticles, Phi ).ignore(); + m_tuple->addIndexedItem ("TanLambda", m_nParticles, TanLambda ).ignore(); + m_tuple->addIndexedItem ("TRUEPX", m_nParticles, TRUEPX ).ignore(); + m_tuple->addIndexedItem ("TRUEPY", m_nParticles, TRUEPY ).ignore(); + m_tuple->addIndexedItem ("TRUEPZ", m_nParticles, TRUEPZ ).ignore(); + m_tuple->addIndexedItem ("TRUEPE", m_nParticles, TRUEPE ).ignore(); + m_tuple->addIndexedItem ("TRUEPT", m_nParticles, TRUEPT ).ignore(); + m_tuple->addIndexedItem ("TRUEP", m_nParticles, TRUEP ).ignore(); + m_tuple->addIndexedItem ("TRUEETA", m_nParticles, TRUEETA ).ignore(); + m_tuple->addIndexedItem ("TRUEY", m_nParticles, TRUEY ).ignore(); + m_tuple->addIndexedItem ("TRUETHETA", m_nParticles, TRUETHETA ).ignore(); + m_tuple->addIndexedItem ("eventNumber", m_nParticles, eventNumber ).ignore(); + m_tuple->addIndexedItem ("particleNumber", m_nParticles, particleNumber ).ignore(); + m_tuple->addIndexedItem ("totalCandidates", m_nParticles, totalCandidates ).ignore(); + m_tuple->addIndexedItem ("nCandidate", m_nParticles, nCandidate ).ignore(); + m_tuple->addIndexedItem ("nHits", m_nParticles, nHits ).ignore(); + m_tuple->addIndexedItem ("pid", m_nParticles, pid ).ignore(); + m_tuple->addIndexedItem ("WMSelectionVariable", m_nParticles, WMSelectionVariable).ignore(); + } + else { // did not manage to book the N tuple.... + fatal() << "Cannot book MyTuples/Track"+m_thisName <<endmsg; + return StatusCode::FAILURE; + } + } + else{ + m_tuple = nt1; + } + + _nEvt = 0; + return StatusCode::SUCCESS; +} + +//------------------------------------------------------------------------------ +StatusCode TrackInspectAlg::execute(){ + debug() << "TrackInspectAlg::execute() ------ start ------" << endmsg; + hitmap.clear(); + mcpHitMap.clear(); + matchvec.clear(); + + std::vector<const edm4hep::MCRecoTrackerAssociationCollection*> relCols; + + + for (auto relCol: relCols) { + if (relCol){ + for (auto rel: *relCol){ + std::pair<edm4hep::ConstTrackerHit, edm4hep::ConstMCParticle> p = std::make_pair(rel.getRec(), rel.getSim().getMCParticle()); + if (hitmap.find(p) == hitmap.end()) hitmap[p] = 0.; + hitmap[p] += rel.getWeight(); + } + } + } + + + // Establish the relation of MCParticle --> Track + // Put the relation of MCParticle --> Track to matchvec + const edm4hep::TrackCollection* trkCol = nullptr; + try { + trkCol = _inTrackColHdl.get(); + } + catch ( GaudiException &e ) { + debug() << "Collection " << _inTrackColHdl.fullKey() << " is unavailable in event " << _nEvt << endmsg; + } + const edm4hep::MCParticleCollection* mcpCol = nullptr; + try { + mcpCol = _inMCParticleColHdl.get(); + } + catch ( GaudiException &e ) { + debug() << "Collection " << _inMCParticleColHdl.fullKey() << " is unavailable in event " << _nEvt << endmsg; + } + if (trkCol && mcpCol){ + for (auto track: *trkCol){ + for (auto particle: *mcpCol){ + double match_weight = match(particle, track); + if (match_weight > 0.2){ + std::tuple<edm4hep::ConstMCParticle, edm4hep::ConstTrack, double> tuple = std::make_tuple(particle, track, match_weight); + matchvec.push_back(tuple); + } + } + } + } + + if (mcpCol){ + // MCParticleHitAssociator(mcpCol); + m_nParticles = 0; + for (auto particle: *mcpCol) { + std::vector<edm4hep::ConstTrack> theTracks = MCParticleTrackAssociator(particle); + + if (theTracks.size() == 0) { + totalCandidates[m_nParticles] = 0; + nCandidate[m_nParticles] = -1; + Fill(particle, edm4hep::Track(nullptr)); + m_nParticles++; + } + else { + for (unsigned j = 0; j < theTracks.size(); j++) { + totalCandidates[m_nParticles] = theTracks.size(); + nCandidate[m_nParticles] = j; + Fill(particle, theTracks[j]); + m_nParticles++; + } + } + } + debug() << "MCParticle: " << m_nParticles << endmsg; + } + m_tuple->write(); + _nEvt++; + debug() << "TrackInspectAlg::execute() ------ end ------" << endmsg; + return StatusCode::SUCCESS; +} + +double TrackInspectAlg::match(edm4hep::ConstMCParticle particle, edm4hep::ConstTrack track){ + + int NHits = track.trackerHits_size(); + + double matchedHits = 0; + double usedHits = 0; + for (int i = 0; i < NHits; i++) { + edm4hep::ConstTrackerHit hit = track.getTrackerHits(i); + usedHits++; + std::pair<edm4hep::ConstTrackerHit, edm4hep::ConstMCParticle> ele = std::make_pair(hit, particle); + //std::cout << "lookup --> " << ele.first << std::endl; + //if (hitmap.find(ele) != hitmap.end() ) { + //std::cout << "find --> " << hitmap[ele] << std::endl; + //} + if (hitmap.find(ele) != hitmap.end() && hitmap[ele] > 0.2) { + matchedHits++; + } + } + + // UTIL::BitField64* encoder = new UTIL::BitField64(lcio::ILDCellID0::encoder_string); + // encoder->setValue(hit->getCellID0()); + // int detID = (*encoder)[lcio::ILDCellID0::subdet]; + // if (detID < 0 || !usedDetectorsArray[detID]) continue; + // delete encoder; + + return matchedHits / usedHits; +} + +void TrackInspectAlg::Fill(edm4hep::ConstMCParticle particle, edm4hep::ConstTrack theTrack) { + pid[m_nParticles] = particle.getPDG(); + + vx[m_nParticles] = particle.getVertex().x; + vy[m_nParticles] = particle.getVertex().y; + vz[m_nParticles] = particle.getVertex().z; + + ex[m_nParticles] = particle.getEndpoint().x; + ey[m_nParticles] = particle.getEndpoint().y; + ez[m_nParticles] = particle.getEndpoint().z; + + TLorentzVector v2; + v2.SetXYZM( + particle.getMomentum().x, + particle.getMomentum().y, + particle.getMomentum().z, + particle.getMass() ); + TRUEPX[m_nParticles] = v2.X(); + TRUEPY[m_nParticles] = v2.Y(); + TRUEPZ[m_nParticles] = v2.Z(); + TRUEPE[m_nParticles] = v2.E(); + TRUEPT[m_nParticles] = v2.Pt(); + TRUEP[m_nParticles] = v2.P(); + TRUEETA[m_nParticles] = v2.PseudoRapidity(); + TRUEY[m_nParticles] = v2.Rapidity(); + TRUETHETA[m_nParticles] = v2.Theta(); + + // TVector3 theMomentum = TVector3( + // particle->getMomentum().x, + // particle->getMomentum().y, + // particle->getMomentum().z ); + + // WMSelectionVariable = ( + // theParticle->isDecayedInTracker()==0 && + // theMomentum.Perp()>1.0 && + // theParticle->isDecayedInCalorimeter() && + // theParticle->getGeneratorStatus() == 1 && + // sin(theMomentum.Theta()) > 0.18 ); + + if (theTrack.isAvailable()) { + for (std::vector<edm4hep::TrackState>::const_iterator it = theTrack.trackStates_end() - 1; it != theTrack.trackStates_begin() - 1; it--){ + edm4hep::TrackState trackState = *it; + Omega[m_nParticles] = trackState.omega; + TanLambda[m_nParticles] = trackState.tanLambda; + Phi[m_nParticles] = trackState.phi; + D0[m_nParticles] = trackState.D0; + Z0[m_nParticles] = trackState.Z0; + nHits[m_nParticles] = theTrack.trackerHits_size(); + } + } + else { + Omega[m_nParticles] = -1; + TanLambda[m_nParticles] = -1; + Phi[m_nParticles] = -1; + D0[m_nParticles] = -1; + Z0[m_nParticles] = -1; + nHits[m_nParticles] = 0; + } +} + +std::vector<edm4hep::ConstTrack> TrackInspectAlg::MCParticleTrackAssociator(edm4hep::ConstMCParticle theParticle) { + std::vector<edm4hep::ConstTrack> theTracks; + // std::cout << "The particle: " << theParticle.getPDG() << " " << theParticle << std::endl; + for (auto matchtuple: matchvec){ + if (std::get<0>(matchtuple) == theParticle){ + if (std::get<2>(matchtuple) > _weight){ + theTracks.push_back(std::get<1>(matchtuple)); + } + } + } + return theTracks; +} + +void TrackInspectAlg::initializeRelationCollections(std::vector<const edm4hep::MCRecoTrackerAssociationCollection*> &relCols) { + + // Use TPC + if (_useTPC) { + const edm4hep::MCRecoTrackerAssociationCollection* relCol = nullptr; + // Establish the relation of MCParticle --> TrackerHit + try { + relCol = _TPCRelColHdl.get(); + } + catch ( GaudiException &e ) { + debug() << "Collection " << _TPCRelColHdl.fullKey() << " is unavailable in event " << _nEvt << endmsg; + } + relCols.push_back(relCol); + } + + // Use VXD + if (_useVXD) { + const edm4hep::MCRecoTrackerAssociationCollection* relCol = nullptr; + // Establish the relation of MCParticle --> TrackerHit + try { + relCol = _VXDRelColHdl.get(); + } + catch ( GaudiException &e ) { + debug() << "Collection " << _VXDRelColHdl.fullKey() << " is unavailable in event " << _nEvt << endmsg; + } + relCols.push_back(relCol); + } + + // Use SIT + if (_useSIT) { + const edm4hep::MCRecoTrackerAssociationCollection* relCol = nullptr; + // Establish the relation of MCParticle --> TrackerHit + try { + relCol = _SITRelColHdl.get(); + } + catch ( GaudiException &e ) { + debug() << "Collection " << _SITRelColHdl.fullKey() << " is unavailable in event " << _nEvt << endmsg; + } + relCols.push_back(relCol); + } + + // Use SET + if (_useSET) { + const edm4hep::MCRecoTrackerAssociationCollection* relCol = nullptr; + // Establish the relation of MCParticle --> TrackerHit + try { + relCol = _SETRelColHdl.get(); + } + catch ( GaudiException &e ) { + debug() << "Collection " << _SETRelColHdl.fullKey() << " is unavailable in event " << _nEvt << endmsg; + } + relCols.push_back(relCol); + } + + // Use FTD + if (_useFTD) { + const edm4hep::MCRecoTrackerAssociationCollection* relCol = nullptr; + // Establish the relation of MCParticle --> TrackerHit + try { + relCol = _FTDRelColHdl.get(); + } + catch ( GaudiException &e ) { + debug() << "Collection " << _FTDRelColHdl.fullKey() << " is unavailable in event " << _nEvt << endmsg; + } + relCols.push_back(relCol); + } +} + +//------------------------------------------------------------------------------ +StatusCode TrackInspectAlg::finalize(){ + debug() << "Finalizing..." << endmsg; + + return StatusCode::SUCCESS; +} diff --git a/Analysis/TrackInspect/src/TrackInspectAlg.h b/Analysis/TrackInspect/src/TrackInspectAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..99c7878e11654eae33f16f156ca38278fc0e128c --- /dev/null +++ b/Analysis/TrackInspect/src/TrackInspectAlg.h @@ -0,0 +1,96 @@ +#ifndef HITSCANPROCESSOR_H +#define HITSCANPROCESSOR_H + +#include "k4FWCore/DataHandle.h" +#include "GaudiKernel/Algorithm.h" + +#include "edm4hep/TrackCollection.h" +#include "edm4hep/TrackerHit.h" +#include "edm4hep/MCParticle.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimTrackerHitCollection.h" +#include "edm4hep/TrackerHitCollection.h" +#include "edm4hep/MCRecoTrackerAssociationCollection.h" + +#include "GaudiKernel/NTuple.h" + +class TrackInspectAlg : public Algorithm { + public : + TrackInspectAlg(const std::string& name, ISvcLocator* pSvcLocator); + ~TrackInspectAlg(){}; + + StatusCode initialize() override; + StatusCode execute() override; + StatusCode finalize() override; + + private : + + // TruthMatchProcessor + DataHandle<edm4hep::TrackCollection> _inTrackColHdl{"InputTrackCollection", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::MCParticleCollection> _inMCParticleColHdl{"InputMCParticleCollection", Gaudi::DataHandle::Reader, this}; + + DataHandle<edm4hep::MCRecoTrackerAssociationCollection> _TPCRelColHdl{"TPCTrackerHitRelations", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::MCRecoTrackerAssociationCollection> _VXDRelColHdl{"VXDTrackerHitRelations", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::MCRecoTrackerAssociationCollection> _SITRelColHdl{"SITTrackerHitRelations", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::MCRecoTrackerAssociationCollection> _SETRelColHdl{"SETTrackerHitRelations", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::MCRecoTrackerAssociationCollection> _FTDRelColHdl{"FTDTrackerHitRelations", Gaudi::DataHandle::Reader, this}; + Gaudi::Property<double> _weight{this, "Weight", 0.5}; + + Gaudi::Property<bool> _useTPC{this, "useTPC", true}; + Gaudi::Property<bool> _useVXD{this, "useVXD", true}; + Gaudi::Property<bool> _useSIT{this, "useSIT", true}; + Gaudi::Property<bool> _useSET{this, "useSET", true}; + Gaudi::Property<bool> _useFTD{this, "useFTD", true}; + + std::map<std::pair<edm4hep::ConstTrackerHit, edm4hep::ConstMCParticle>, double> hitmap; + std::vector<std::tuple<edm4hep::ConstMCParticle, edm4hep::ConstTrack, double>> matchvec; + double match(edm4hep::ConstMCParticle, edm4hep::ConstTrack); + + void initializeRelationCollections(std::vector<const edm4hep::MCRecoTrackerAssociationCollection*> &relCols); + + int _nEvt; + std::string m_thisName; + + // TrackingEfficiency + void Fill(edm4hep::ConstMCParticle, edm4hep::ConstTrack); + std::vector<edm4hep::ConstTrack> MCParticleTrackAssociator(edm4hep::ConstMCParticle); + + std::map<edm4hep::ConstMCParticle, std::vector<edm4hep::ConstSimTrackerHit>> mcpHitMap; + std::string treeFileName; + + NTuple::Tuple* m_tuple; + + NTuple::Item<long> m_nParticles; + NTuple::Array<double> vx; + NTuple::Array<double> vy; + NTuple::Array<double> vz; + NTuple::Array<double> ex; + NTuple::Array<double> ey; + NTuple::Array<double> ez; + NTuple::Array<double> Omega; + NTuple::Array<double> D0; + NTuple::Array<double> Z0; + NTuple::Array<double> Phi; + NTuple::Array<double> TanLambda; + NTuple::Array<double> TRUEPX; + NTuple::Array<double> TRUEPY; + NTuple::Array<double> TRUEPZ; + NTuple::Array<double> TRUEPE; + NTuple::Array<double> TRUEPT; + NTuple::Array<double> TRUEP; + NTuple::Array<double> TRUEETA; + NTuple::Array<double> TRUEY; + NTuple::Array<double> TRUETHETA; + NTuple::Array<int> eventNumber; + NTuple::Array<int> particleNumber; + NTuple::Array<int> totalCandidates; + NTuple::Array<int> nCandidate; + NTuple::Array<int> pid; + NTuple::Array<int> nHits; + NTuple::Array<int> WMSelectionVariable; + // TTree tree; + // TTree tuple; + // TFile treeFile; +}; + +#endif diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e47f29f1c1614c9b661a6d8c6fad1c0fec9a8c7..4ece9e6f2354abaffca924fd075bdcce7eed1de0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,23 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) +CMAKE_MINIMUM_REQUIRED(VERSION 3.15) + +project(CEPCSW) + +# setup some necessary envvar +include(cmake/CEPCSWEnv.cmake) +# find_package(ROOT COMPONENTS RIO Tree) -find_package(GaudiProject) +find_package(Gaudi) + + +include(GNUInstallDirs) +include(CTest) + +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/InstallArea/ CACHE PATH + "Install path prefix, prepended onto install directories." FORCE ) +endif() # Set up C++ Standard # ``-DCMAKE_CXX_STANDARD=<standard>`` when invoking CMake @@ -12,8 +27,27 @@ if(NOT CMAKE_CXX_STANDARD MATCHES "14|17") message(FATAL_ERROR "Unsupported C++ standard: ${CMAKE_CXX_STANDARD}") endif() +list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # (Find*.cmake) +include(cmake/CEPCSWDependencies.cmake) + +add_subdirectory(Analysis) +add_subdirectory(Detector) +add_subdirectory(Digitisers) +add_subdirectory(Examples) +add_subdirectory(Generator) +add_subdirectory(Reconstruction) +add_subdirectory(Service) +add_subdirectory(Simulation) +add_subdirectory(Utilities) + +############################################################################## +# INSTALL +############################################################################## + +install(EXPORT ${PROJECT_NAME}Targets + NAMESPACE ${PROJECT_NAME}:: + FILE "${PROJECT_NAME}Targets.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/" + ) -gaudi_project(CEPCSW v0r1 - USE Gaudi v33r1 - USE k4FWCore v0r1 -) \ No newline at end of file +gaudi_install(CMAKE cmake/${PROJECT_NAME}Config.cmake) diff --git a/Detector/CMakeLists.txt b/Detector/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..be45fff6cab99071fd9915a4452980e4a22b9340 --- /dev/null +++ b/Detector/CMakeLists.txt @@ -0,0 +1,8 @@ + +add_subdirectory(DetCEPCv4) +add_subdirectory(DetCRD) +add_subdirectory(DetDriftChamber) +add_subdirectory(DetEcalMatrix) +add_subdirectory(DetInterface) +add_subdirectory(DetSegmentation) +add_subdirectory(GeomSvc) diff --git a/Detector/DetCEPCv4/CMakeLists.txt b/Detector/DetCEPCv4/CMakeLists.txt index e969df42e033b2bff74f08dd13c729fb0eec31f9..c273799ff5c77a71140dafd9ba011b56a4b28f15 100644 --- a/Detector/DetCEPCv4/CMakeLists.txt +++ b/Detector/DetCEPCv4/CMakeLists.txt @@ -3,10 +3,6 @@ # Ref to Package: DetFCCeeIDEA # Based on package: lcgeo ################################################################################ -gaudi_subdir(DetCEPCv4 v0r0) - -gaudi_depends_on_subdirs(GaudiKernel) - find_package(DD4hep COMPONENTS DDRec DDG4 DDParsers REQUIRED) # find_package(DD4hep) @@ -18,39 +14,42 @@ include( DD4hep ) find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED) -install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetCEPCv4) - -set(DetCEPCv4_src - src/tracker/VXD04_geo.cpp - src/tracker/FTD_Simple_Staggered_geo.cpp - src/tracker/FTD_cepc_geo.cpp - src/tracker/SIT_Simple_Pixel_geo.cpp - src/tracker/SIT_Simple_Planar_geo.cpp - src/tracker/TPC10_geo.cpp - src/tracker/SET_Simple_Planar_geo.cpp - src/calorimeter/SEcal05_Helpers.cpp - src/calorimeter/SEcal05_Barrel.cpp - src/calorimeter/SEcal05_Endcaps.cpp - src/calorimeter/SEcal05_ECRing.cpp - src/other/BoxSupport_o1_v01_geo.cpp - src/other/TubeSupport_o1_v01_geo.cpp -) +# install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetCEPCv4) gaudi_add_module(DetCEPCv4 - ${DetCEPCv4_src} - INCLUDE_DIRS - # DD4hep - # ROOT - # Geant4 - src/include - LINK_LIBRARIES - # GaudiKernel - #DD4hep - ${DD4hep_COMPONENT_LIBRARIES} - # ROOT - # Geant4 + SOURCES src/tracker/VXD04_geo.cpp + src/tracker/FTD_Simple_Staggered_geo.cpp + src/tracker/FTD_cepc_geo.cpp + src/tracker/SIT_Simple_Pixel_geo.cpp + src/tracker/SIT_Simple_Planar_geo.cpp + src/tracker/TPC10_geo.cpp + src/tracker/SET_Simple_Planar_geo.cpp + src/calorimeter/SEcal05_Helpers.cpp + src/calorimeter/SEcal05_Barrel.cpp + src/calorimeter/SEcal05_Endcaps.cpp + src/calorimeter/SEcal05_ECRing.cpp + src/calorimeter/SHcalRpc01_Barrel.cpp + src/calorimeter/SHcalRpc01_Endcaps.cpp + src/calorimeter/SHcalRpc01_EndcapRing.cpp + src/calorimeter/Yoke05_Barrel.cpp + src/calorimeter/Yoke05_Endcaps.cpp + src/other/BoxSupport_o1_v01_geo.cpp + src/other/TubeSupport_o1_v01_geo.cpp + src/other/SCoil02_geo.cpp + + LINK ${DD4hep_COMPONENT_LIBRARIES} ) +target_include_directories(DetCEPCv4 PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/src/include + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) + set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}") dd4hep_generate_rootmap(DetCEPCv4) + +install(TARGETS DetCEPCv4 + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Detector/DetCEPCv4/compact/Beampipe_o1_v01_01.xml b/Detector/DetCEPCv4/compact/Beampipe_o1_v01_01.xml index 4b6d0ef0a0b00d7d66b9ecd0ade581b486def75d..6dd10eac88c04dbc8d619271715e2ae4e55f4f52 100644 --- a/Detector/DetCEPCv4/compact/Beampipe_o1_v01_01.xml +++ b/Detector/DetCEPCv4/compact/Beampipe_o1_v01_01.xml @@ -103,17 +103,17 @@ rMax1="TUBE_incoming_beamcalToQD0_InnerRadius+TUBE_upstream_thickness" rMax2="TUBE_incoming_QD0andBeyond_InnerRadius+TUBE_upstream_thickness" material="stainless_steel" name="BeamCalToQD0UpstreamTrans" /> - <section type ="Upstream" + <!--section type ="Upstream" start="TUBE_QD0_Lstar" end="TUBE_QD0_Lstar+TUBE_QD0_length" rMin1="TUBE_incoming_QD0andBeyond_InnerRadius" rMin2="TUBE_incoming_QD0andBeyond_InnerRadius" rMax1="TUBE_incoming_QD0andBeyond_InnerRadius+20*mm" rMax2="TUBE_incoming_QD0andBeyond_InnerRadius+20*mm" - material="stainless_steel" name="QD0CryoUpstream" /> + material="stainless_steel" name="QD0CryoUpstream" /--> - <section type ="Upstream" + <!--section type ="Upstream" start="TUBE_QD0_Lstar+TUBE_QD0_length" end="10*m" rMin1="TUBE_incoming_QD0andBeyond_InnerRadius" rMin2="TUBE_incoming_QD0andBeyond_InnerRadius" rMax1="TUBE_incoming_QD0andBeyond_InnerRadius+TUBE_upstream_thickness" rMax2="TUBE_incoming_QD0andBeyond_InnerRadius+TUBE_upstream_thickness" - material="stainless_steel" name="BeyondQD0Upstream" /> + material="stainless_steel" name="BeyondQD0Upstream" /--> @@ -137,17 +137,17 @@ rMax1="TUBE_outgoing_beamcalToQD0_InnerRadius+TUBE_upstream_thickness" rMax2="TUBE_outgoing_beamcalToQD0_InnerRadius+TUBE_upstream_thickness" material="stainless_steel" name="BeamCalToQDEX1ADnstream" /> - <section type ="Dnstream" + <!--section type ="Dnstream" start="TUBE_QDEX1A_Lstar" end="TUBE_QD0_Lstar+TUBE_QD0_cryostat_length" rMin1="TUBE_outgoing_QD0andBeyond_InnerRadius" rMin2="TUBE_outgoing_QD0andBeyond_InnerRadius" rMax1="TUBE_outgoing_QD0andBeyond_InnerRadius+20*mm" rMax2="TUBE_outgoing_QD0andBeyond_InnerRadius+20*mm" - material="stainless_steel" name="QDEX1A" /> + material="stainless_steel" name="QDEX1A" /--> - <section type ="Dnstream" + <!--section type ="Dnstream" start="TUBE_QD0_Lstar+TUBE_QD0_cryostat_length" end="10*m" rMin1="TUBE_outgoing_QD0andBeyond_InnerRadius" rMin2="TUBE_outgoing_QD0andBeyond_InnerRadius" rMax1="TUBE_outgoing_QD0andBeyond_InnerRadius+TUBE_upstream_thickness" rMax2="TUBE_outgoing_QD0andBeyond_InnerRadius+TUBE_upstream_thickness" - material="stainless_steel" name="BeyondQD0Dnstream" /> + material="stainless_steel" name="BeyondQD0Dnstream" /--> </detector> @@ -160,12 +160,12 @@ <type_flags type="DetType_SUPPORT + DetType_BEAMPIPE "/> <section start="TUBE_QD0_Lstar-20*mm" end="TUBE_QD0_Lstar+TUBE_QD0_cryostat_length" - rMin="235.*mm" rMax="250.*mm" + rMin="170.*mm" rMax="185.*mm" material="stainless_steel" name="qd0_cryostat"/> <section start="TUBE_QD0_Lstar-20*mm" end="TUBE_QD0_Lstar+TUBE_QD0_cryostat_length" - rMin="235.*mm" rMax="250.*mm" + rMin="205.*mm" rMax="210.*mm" material="stainless_steel" name="qd0_cryostat_wall"/> @@ -183,7 +183,7 @@ </detector> -<detector name="QD0_support" type="BoxSupport_o1_v01" vis="BeamPipeVis" id="ILDDetID_NOTUSED" reflect="true"> +<detector name="QD0_support" type="TubeSupport_o1_v01" vis="BeamPipeVis" id="ILDDetID_NOTUSED" reflect="true"> <envelope vis="BlueVis"> <shape type="Assembly"/> @@ -191,18 +191,19 @@ <type_flags type="DetType_SUPPORT + DetType_BEAMPIPE "/> - <section start="TUBE_QD0_Lstar+20*mm" end="TUBE_QD0_Lstar+TUBE_QD0_cryostat_length" - rMin="275.*mm" rMax="300*mm" + <section start="TUBE_QD0_Lstar-20*mm" end="TUBE_QD0_Lstar+TUBE_QD0_cryostat_length" + rMin="240.*mm" rMax="310*mm" material="stainless_steel" name="qd0_support"/> - <section start="Ecal_endcap_zmin" end="Ecal_endcap_zmin+Ecal_barrel_thickness" + <!--section start="Ecal_endcap_zmin" end="Ecal_endcap_zmin+Ecal_barrel_thickness" rMin="EcalEndcapRing_outer_radius + 2*env_safety" rMax="EcalEndcap_inner_radius - 2*env_safety" material="stainless_steel" - name="forward_support_tube"/> + name="forward_support_tube"/--> - <section start="top_LHCal_min_z + top_LHCal_thickness+10*mm" end="BeamCal_min_z + top_BeamCal_thickness+4600*mm" - rMin="305*mm" rMax="325*mm" + <!--section start="top_LHCal_min_z + top_LHCal_thickness+10*mm" end="BeamCal_min_z + top_BeamCal_thickness+4600*mm"--> + <section start="top_LHCal_min_z + top_LHCal_thickness+10*mm" end="TUBE_QD0_Lstar-20*mm" + rMin="175*mm" rMax="240*mm" material="stainless_steel" name="forward_support_tube"/> diff --git a/Detector/DetCEPCv4/compact/CepC_v4-onlyTracker.xml b/Detector/DetCEPCv4/compact/CepC_v4-onlyTracker.xml index 586e4a1f3a3acd99861ee9127b981d8091ca43fb..bf5aace81f5fd37f6616f77d19d0bf1a29ec2318 100644 --- a/Detector/DetCEPCv4/compact/CepC_v4-onlyTracker.xml +++ b/Detector/DetCEPCv4/compact/CepC_v4-onlyTracker.xml @@ -75,12 +75,13 @@ <include ref="Field_AntiDID_Map_s.xml"/> <include ref="Field_FwdMagnets_Ideal_1000GeV.xml"/--> - <fields> - - <field name="MagnetFields_Constant" type="ConstantField" field="magnetic"> - <strength x="0" y="0" z="3.0*tesla"/> + <field name="GlobalSolenoid" type="solenoid" + inner_field="Field_nominal_value" + outer_field="Field_outer_nominal_value" + zmax="TPC_Ecal_Hcal_barrel_halfZ + Coil_extra_size" + outer_radius="Hcal_outer_radius + Coil_thickness/2"> </field> - </fields> + </lccdd> diff --git a/Detector/DetCEPCv4/compact/CepC_v4-onlyTrackerECAL.xml b/Detector/DetCEPCv4/compact/CepC_v4-onlyTrackerECAL.xml new file mode 100644 index 0000000000000000000000000000000000000000..8978202b9380aadbc7e602a40e9a40ac36eefd41 --- /dev/null +++ b/Detector/DetCEPCv4/compact/CepC_v4-onlyTrackerECAL.xml @@ -0,0 +1,86 @@ +<lccdd xmlns:compact="http://www.lcsim.org/schemas/compact/1.0" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd"> + <info name="CepC_v04" + title="CepC detctor used for the optimisation" + author="C.D.Fu" + url="http://cepc.ihep.ac.cn" + status="experimental" + version="v04"> + <comment>CepC detector simulation models used for detector optimisation </comment> + </info> + <includes> + <gdmlFile ref="elements.xml"/> + <gdmlFile ref="materials.xml"/> + </includes> + <define> + <include ref="top_defs_CepC_v04.xml"/> + <include ref="top_defs.xml"/> + <include ref="basic_defs.xml"/> + <include ref="envelope_defs.xml"/> + <include ref="tube_defs.xml"/> + <include ref="misc_defs.xml"/> + <include ref="tracker_defs.xml"/> + <include ref="fcal_defs.xml"/> + <include ref="ecal_defs.xml"/> + <include ref="hcal_defs.xml"/> + <include ref="yoke_defs.xml"/> + <include ref="services_defs.xml"/> + <include ref="detector_types.xml"/> + <include ref="limits.xml"/> + <!-- Readout slice in ecal for reconstruction --> + <constant name="Ecal_readout_segmentation_slice0" value="4"/> + <constant name="Ecal_readout_segmentation_slice1" value="10"/> + <!-- Readout slice in hcal for reconstruction --> + <constant name="Hcal_readout_segmentation_slice" value="3"/> + </define> + <limits> + <limitset name="cal_limits"> + <limit name="step_length_max" particles="*" value="cal_steplimit_val" unit="cal_steplimit_unit" /> + </limitset> + <limitset name="TPC_limits"> + <limit name="step_length_max" particles="*" value="tpc_steplimit_val" unit="tpc_steplimit_unit" /> + </limitset> + <limitset name="Tracker_limits"> + <limit name="step_length_max" particles="*" value="tracker_steplimit_val" unit="tracker_steplimit_unit" /> + </limitset> + </limits> + <include ref="display.xml"/> + <include ref="Beampipe_o1_v01_01.xml"/> + <include ref="vxd07.xml"/> + <include ref="ftd_cepc.xml"/> + <include ref="sit_simple_planar_sensors_01.xml"/> + <include ref="tpc10_01.xml"/> + <include ref="set_simple_planar_sensors_01.xml"/> + <include ref="SEcal05_siw_Barrel.xml"/> + <include ref="SEcal05_siw_Endcaps.xml"/> + <include ref="SEcal05_siw_ECRing.xml"/> + <!--include ref="Hcal_Barrel_SD_v01.xml"/> + <include ref="Hcal_Endcaps_SD_v01.xml"/> + <include ref="Hcal_EndcapRing_SD_v01.xml"/> + <include ref="Yoke05_Barrel.xml"/> + <include ref="Yoke05_Endcaps.xml"/> + <include ref="LumiCal.xml"/--> + + <!--include ref="LHCal01.xml"/> + <include ref="BeamCal08.xml"/--> + + <!--include ref="coil03.xml"/--> + <!--include ref="SServices00.xml"/--> + <plugins> + <plugin name="DD4hepVolumeManager"/> + <plugin name="InstallSurfaceManager"/> + </plugins> + <!--include ref="Field_Solenoid_Map_s_4.0T.xml"/> + <include ref="Field_AntiDID_Map_s.xml"/> + <include ref="Field_FwdMagnets_Ideal_1000GeV.xml"/--> + + + <fields> + + <field name="MagnetFields_Constant" type="ConstantField" field="magnetic"> + <strength x="0" y="0" z="3.0*tesla"/> + </field> + + </fields> +</lccdd> diff --git a/Detector/DetCEPCv4/compact/CepC_v4.xml b/Detector/DetCEPCv4/compact/CepC_v4.xml index 393a40e9002e23cdfb6975e88e1117b53441becb..105a00712d512d1c7788aeece1bde77c6e406608 100644 --- a/Detector/DetCEPCv4/compact/CepC_v4.xml +++ b/Detector/DetCEPCv4/compact/CepC_v4.xml @@ -34,6 +34,15 @@ <!-- Readout slice in hcal for reconstruction --> <constant name="Hcal_readout_segmentation_slice" value="3"/> </define> + <materials> + <material name="RPC2ECRMix" state="solid"> + <D unit="g/cm3" value="Hcal_mix_density"/> + <composite n="Hcal_airgap_fraction" ref="Air"/> + <composite n="Hcal_graphite_fraction" ref="graphite"/> + <composite n="Hcal_mylar_fraction" ref="mylar"/> + <composite n="Hcal_g10_fraction" ref="g10"/> + </material> + </materials> <limits> <limitset name="cal_limits"> <limit name="step_length_max" particles="*" value="cal_steplimit_val" unit="cal_steplimit_unit" /> @@ -47,25 +56,25 @@ </limits> <include ref="display.xml"/> <include ref="Beampipe_o1_v01_01.xml"/> - <!--include ref="vxd07.xml"/> - <include ref="ftd_simple_staggered_02.xml"/> - <include ref="sit_simple_pixel_sensors_01.xml"/> + <include ref="vxd07.xml"/> + <include ref="ftd_cepc.xml"/> + <include ref="sit_simple_planar_sensors_01.xml"/> <include ref="tpc10_01.xml"/> - <include ref="set_simple_planar_sensors_01.xml"/--> + <include ref="set_simple_planar_sensors_01.xml"/> <include ref="SEcal05_siw_Barrel.xml"/> <include ref="SEcal05_siw_Endcaps.xml"/> <include ref="SEcal05_siw_ECRing.xml"/> - <!--include ref="Hcal_Barrel_SD_v01.xml"/> - <include ref="Hcal_Endcaps_SD_v01.xml"/> - <include ref="Hcal_EndcapRing_SD_v01.xml"/> + <include ref="SHcalRpc01_Barrel_01.xml"/> + <include ref="SHcalRpc01_Endcaps_01.xml"/> + <include ref="SHcalRpc01_EndcapRing_01.xml"/> <include ref="Yoke05_Barrel.xml"/> <include ref="Yoke05_Endcaps.xml"/> - <include ref="LumiCal.xml"/--> + <!--include ref="LumiCal.xml"/--> <!--include ref="LHCal01.xml"/> <include ref="BeamCal08.xml"/--> - <!--include ref="coil03.xml"/--> + <include ref="coil03.xml"/> <!--include ref="SServices00.xml"/--> <plugins> <plugin name="DD4hepVolumeManager"/> @@ -74,4 +83,20 @@ <!--include ref="Field_Solenoid_Map_s_4.0T.xml"/> <include ref="Field_AntiDID_Map_s.xml"/> <include ref="Field_FwdMagnets_Ideal_1000GeV.xml"/--> + <fields> + <field name="InnerSolenoid" type="solenoid" + inner_field="Field_nominal_value" + outer_field="0" + zmax="Coil_half_length" + inner_radius="Hcal_outer_radius+Coil_thickness/2" + outer_radius="Yoke_barrel_inner_radius"> + </field> + <field name="OuterSolenoid" type="solenoid" + inner_field="0" + outer_field="Field_outer_nominal_value" + zmax="Coil_half_length" + inner_radius="Yoke_barrel_inner_radius" + outer_radius="Yoke_barrel_inner_radius+Field_outer_thickness"> + </field> + </fields> </lccdd> diff --git a/Detector/DetCEPCv4/compact/Hcal_Barrel_SD_v01.xml b/Detector/DetCEPCv4/compact/Hcal_Barrel_SD_v01.xml deleted file mode 100644 index bfee3f1b9cea39cc91b3e3938af66e2f45344d65..0000000000000000000000000000000000000000 --- a/Detector/DetCEPCv4/compact/Hcal_Barrel_SD_v01.xml +++ /dev/null @@ -1,47 +0,0 @@ -<lccdd> - - <detectors> - <detector name="HcalBarrel" type="Hcal_Barrel_SD_v01" id="ILDDetID_HCAL" readout="HCalBarrelRPCHits" vis="GreenVis" insideTrackingVolume="false" > - <comment>Hadron Calorimeter Barrel</comment> - - <envelope vis="ILD_HCALVis"> - <shape type="BooleanShape" operation="Subtraction" material="Air" > - <shape type="Cone" z="Hcal_half_length + env_safety/2" rmin1="0.0" rmax1="Hcal_outer_radius + env_safety" rmin2="0.0" rmax2="Hcal_outer_radius + env_safety"/> - <shape type="PolyhedraRegular" numsides="Hcal_inner_symmetry" rmin="0.0" - rmax="Hcal_inner_radius - env_safety" dz="2*(Hcal_half_length + env_safety)"/> - </shape> - <rotation x="0" y="0" z="90*deg-180*deg/Hcal_inner_symmetry"/> - </envelope> - <type_flags type=" DetType_CALORIMETER + DetType_BARREL + DetType_HADRONIC " /> - - <staves material = "Steel304L" vis="BlueVis"/> - - <!-- The layer structure reference in the following paper--> - <!-- ??? --> - <layer repeat="HcalBarrelSD_nlayers" vis="SeeThrough"> - <slice material = "Steel304L" thickness = "HcalSD_radiator_thickness" vis="BlueVis" /> - <slice material = "Air" thickness = "HcalSD_airgap_thickness" vis="WhiteVis" /> - <slice material = "Steel304L" thickness = "HcalSD_steel_casette_thickness" vis="BlueVis" /> - <slice material = "epoxy" thickness = "HcalSD_electronics_mask_thickness" vis="GreenVis" /> - <slice material = "PCB" thickness = "HcalSD_PCB_thickness" vis="CyanVis" /> - <slice material = "mylar" thickness = "HcalSD_mylar_anode_thickness" vis="MagentaVis" /> - <slice material = "graphite" thickness = "HcalSD_graphite_anode_thickness" vis="Invisible" /> - <slice material = "FloatGlass" thickness = "HcalSD_glass_anode_thickness" vis="RedVis" /> - <slice material = "RPCGAS2" thickness = "HcalSD_sensitive_gas_gap" sensitive = "yes" vis="YellowVis" /> - <slice material = "FloatGlass" thickness = "HcalSD_glass_cathode_thickness" vis="RedVis" /> - <slice material = "graphite" thickness = "HcalSD_graphite_cathode_thickness" vis="Invisible" /> - <slice material = "mylar" thickness = "HcalSD_mylar_cathode_thickness" vis="MagentaVis" /> - <slice material = "Steel304L" thickness = "HcalSD_steel_casette_thickness" vis="BlueVis" /> - <slice material = "Air" thickness = "HcalSD_airgap_thickness" vis="WhiteVis" /> - </layer> - </detector> - </detectors> - - <readouts> - <readout name="HCalBarrelRPCHits"> - <segmentation type="CartesianGridXY" grid_size_x="HcalSD_cells_size" grid_size_y="HcalSD_cells_size"/> - <id>system:5,module:3,stave:3,tower:5,layer:6,slice:4,x:32:-16,y:-16</id> - </readout> - </readouts> - -</lccdd> diff --git a/Detector/DetCEPCv4/compact/Hcal_EndcapRing_SD_v01.xml b/Detector/DetCEPCv4/compact/Hcal_EndcapRing_SD_v01.xml deleted file mode 100644 index ee89545a0187d2cc8e87318e770aa9e7f408800d..0000000000000000000000000000000000000000 --- a/Detector/DetCEPCv4/compact/Hcal_EndcapRing_SD_v01.xml +++ /dev/null @@ -1,56 +0,0 @@ -<lccdd> - - <detectors> - <detector name="HcalRing" type="Hcal_EndcapRing_SD_v01" id="ILDDetID_HCAL_RING" readout="HCalECRingRPCHits" vis="SeeThrough" insideTrackingVolume="false" > - <comment>Hadron Calorimeter EndcapRing</comment> - - <envelope vis="ILD_HCALVis"> - <shape type="BooleanShape" operation="Subtraction" material="Air"> - <shape type="BooleanShape" operation="Intersection" material="Air"> - <shape type="Box" dx="HcalEndcapRing_outer_radius + 2.0*env_safety" dy="HcalEndcapRing_outer_radius + 2.0*env_safety" - dz="HcalEndcapRing_max_z + 2.0*env_safety"/> <!--Box defined the coordinate system--> - <shape type="PolyhedraRegular" numsides="HcalEndcapRingSD_inner_symmetry" rmin="HcalEndcapRing_inner_radius - env_safety" - rmax="HcalEndcapRing_outer_radius + env_safety" dz="2.0*HcalEndcapRing_max_z + env_safety" material="Air"/> - <rotation x="0" y="0" z="90*deg-180*deg/HcalEndcapRingSD_inner_symmetry"/> - </shape> - - <shape type="Box" dx="HcalEndcapRing_outer_radius + 2.0*env_safety" dy="HcalEndcapRing_outer_radius + 2.0*env_safety" - dz="HcalEndcapRing_min_z - env_safety"/> - </shape> - </envelope> - - <type_flags type=" DetType_CALORIMETER + DetType_ENDCAP + DetType_HADRONIC + DetType_AUXILIARY " /> - - <!-- absorber material - --> - <staves material = "Steel304L" vis="GreenVis"/> - <material name="Steel304L"/> - - <layer repeat="HcalEndcapRingSD_nlayers" vis="SeeThrough"> - <slice material = "Steel304L" thickness = "HcalSD_radiator_thickness" vis="BlueVis" /> - <slice material = "Air" thickness = "HcalSD_airgap_thickness" vis="WhiteVis" /> - <slice material = "Steel304L" thickness = "HcalSD_steel_casette_thickness" vis="BlueVis" /> - <slice material = "epoxy" thickness = "HcalSD_electronics_mask_thickness" vis="GreenVis" /> - <slice material = "PCB" thickness = "HcalSD_PCB_thickness" vis="CyanVis" /> - <slice material = "mylar" thickness = "HcalSD_mylar_anode_thickness" vis="MagentaVis" /> - <slice material = "graphite" thickness = "HcalSD_graphite_anode_thickness" vis="Invisible" /> - <slice material = "FloatGlass" thickness = "HcalSD_glass_anode_thickness" vis="RedVis" /> - <slice material = "RPCGAS2" thickness = "HcalSD_sensitive_gas_gap" sensitive = "yes" vis="YellowVis" /> - <slice material = "FloatGlass" thickness = "HcalSD_glass_cathode_thickness" vis="RedVis" /> - <slice material = "graphite" thickness = "HcalSD_graphite_cathode_thickness" vis="Invisible" /> - <slice material = "mylar" thickness = "HcalSD_mylar_cathode_thickness" vis="MagentaVis" /> - <slice material = "Steel304L" thickness = "HcalSD_steel_casette_thickness" vis="BlueVis" /> - <slice material = "Air" thickness = "HcalSD_airgap_thickness" vis="WhiteVis" /> - </layer> - </detector> - </detectors> - - <readouts> - <readout name="HCalECRingRPCHits"> - <segmentation type="CartesianGridXY" grid_size_x="HcalSD_cells_size" grid_size_y="HcalSD_cells_size"/> - <id>system:5,module:3,stave:4,tower:3,layer:6,x:32:-16,y:-16</id> - </readout> - </readouts> - -</lccdd> - diff --git a/Detector/DetCEPCv4/compact/Hcal_Endcaps_SD_v01.xml b/Detector/DetCEPCv4/compact/Hcal_Endcaps_SD_v01.xml deleted file mode 100644 index 3b77b0fa6104dd0cd1e60b439d185ed6eb9af23c..0000000000000000000000000000000000000000 --- a/Detector/DetCEPCv4/compact/Hcal_Endcaps_SD_v01.xml +++ /dev/null @@ -1,53 +0,0 @@ -<lccdd> - -<detectors> -<detector id="ILDDetID_HCAL_ENDCAP" name="HcalEndcap" type="Hcal_Endcaps_SD_v01" readout="HCalEndcapRPCHits" vis="SeeThrough" calorimeterType="HAD_ENDCAP"> - <comment>Hadron Calorimeter Endcap</comment> - - - <envelope vis="ILD_HCALVis"> - <shape type="BooleanShape" operation="Subtraction" material="Air"><!--2. create center box hole --> - <shape type="BooleanShape" operation="Subtraction" material="Air"><!--1. create Endcaps envelope --> - <shape type="Tube" rmin="0.0" rmax="HcalEndcap_outer_radius + env_safety" dz="HcalEndcap_max_z + env_safety"/> - <shape type="Tube" rmin="0.0" rmax="HcalEndcap_outer_radius + 2.0*env_safety" dz="HcalEndcap_min_z - env_safety"/> - </shape> - <shape type="Box" dx="HcalEndcap_inner_radius - env_safety" dy="HcalEndcap_inner_radius - env_safety" - dz="HcalEndcap_max_z + 2.0*env_safety"/> - </shape> - <rotation x="0" y="0" z="0"/> - </envelope> - - <type_flags type=" DetType_CALORIMETER + DetType_ENDCAP + DetType_HADRONIC " /> - <material name="Steel304L"/><!-- radiator and the thickness has been defined in the main xml file--> - <staves material = "Steel235" vis="SeeThrough"/> - - - <!-- slice: from inner to outer --> - <layer repeat="HcalEndcapSD_nlayers" vis="SeeThrough"> - <slice material = "Steel304L" thickness = "HcalSD_radiator_thickness" vis="BlueVis" /> - <slice material = "Air" thickness = "HcalSD_airgap_thickness" vis="WhiteVis" /> - <slice material = "Steel304L" thickness = "HcalSD_steel_casette_thickness" vis="BlueVis" /> - <slice material = "epoxy" thickness = "HcalSD_electronics_mask_thickness" vis="GreenVis" /> - <slice material = "PCB" thickness = "HcalSD_PCB_thickness" vis="CyanVis" /> - <slice material = "mylar" thickness = "HcalSD_mylar_anode_thickness" vis="MagentaVis"/> - <slice material = "graphite" thickness = "HcalSD_graphite_anode_thickness" vis="Invisible" /> - <slice material = "FloatGlass" thickness = "HcalSD_glass_anode_thickness" vis="RedVis" /> - <slice material = "RPCGAS2" thickness = "HcalSD_sensitive_gas_gap" sensitive = "yes" vis="YellowVis" /> - <slice material = "FloatGlass" thickness = "HcalSD_glass_cathode_thickness" vis="RedVis" /> - <slice material = "graphite" thickness = "HcalSD_graphite_cathode_thickness" vis="Invisible" /> - <slice material = "mylar" thickness = "HcalSD_mylar_cathode_thickness" vis="MagentaVis"/> - <slice material = "Steel304L" thickness = "HcalSD_steel_casette_thickness" vis="BlueVis" /> - <slice material = "Air" thickness = "HcalSD_airgap_thickness" vis="WhiteVis" /> - </layer> - -</detector> -</detectors> - -<readouts> - <readout name="HCalEndcapRPCHits"> - <segmentation type="CartesianGridXY" grid_size_x="HcalSD_cells_size" grid_size_y="HcalSD_cells_size" offset_x="HcalSD_cells_size/2.0" offset_y="HcalSD_cells_size/2.0" /> - <id>system:5,module:3,stave:3,tower:5,layer:6,x:32:-16,y:-16</id> - </readout> -</readouts> - -</lccdd> diff --git a/Detector/DetCEPCv4/compact/README.md b/Detector/DetCEPCv4/compact/README.md index 82da7ff49a3b444b1a19340295a69d5fbde13cd2..0150fa3782ecdea2b5b8256678848dd3bf193c65 100644 --- a/Detector/DetCEPCv4/compact/README.md +++ b/Detector/DetCEPCv4/compact/README.md @@ -20,10 +20,10 @@ The following CEPC_v4 detector models are available in CEPCSW - TPC_outer_radius = 1808*mm - EndcapTracker - with silicon pestals (FTDPixel + FTDStrip) - - Ecal (un-implemented) + - Ecal - with si-W calorimeter - - Hcal (un-implemented) - - with scintillator **and** RPC readout - - creates two sets of hit collections + - Hcal + - with RPC readout + - creates three sets of hit collections - compact files: - only Tracker [./CEPC_v4.xml](./CEPC_v4.xml) diff --git a/Detector/DetCEPCv4/compact/SHcalRpc01_Barrel_01.xml b/Detector/DetCEPCv4/compact/SHcalRpc01_Barrel_01.xml new file mode 100644 index 0000000000000000000000000000000000000000..8ea02125f3e24158e985c8f2dc9ac455b84c013f --- /dev/null +++ b/Detector/DetCEPCv4/compact/SHcalRpc01_Barrel_01.xml @@ -0,0 +1,41 @@ +<lccdd> + <detectors> + <detector name="HcalBarrel" type="SHcalRpc01_Barrel" id="ILDDetID_HCAL" readout="HcalBarrelCollection" vis="GreenVis" insideTrackingVolume="false" > + <comment>Hadron Calorimeter Barrel</comment> + <envelope vis="ILD_HCALVis"> + <shape type="BooleanShape" operation="Subtraction" material="Air" > + <shape type="Cone" z="Hcal_half_length + env_safety/2" rmin1="0.0" rmax1="Hcal_outer_radius + env_safety" rmin2="0.0" rmax2="Hcal_outer_radius + env_safety"/> + <shape type="PolyhedraRegular" numsides="Hcal_inner_symmetry" rmin="0.0" + rmax="Hcal_inner_radius - env_safety" dz="2*(Hcal_half_length + env_safety)"/> + <rotation x="0" y="0" z="-180*deg/Hcal_inner_symmetry"/> + </shape> + <!--rotation x="0" y="0" z="90*deg-180*deg/Hcal_inner_symmetry"/--> + </envelope> + <type_flags type=" DetType_CALORIMETER + DetType_BARREL + DetType_HADRONIC " /> + + <staves material="stainless_steel" vis="BlueVis"/> + + <layer repeat="Hcal_nlayers" vis="SeeThrough"> + <slice material="stainless_steel" thickness="Hcal_radiator_thickness" vis="BlueVis" /> + <slice material="Air" thickness="Hcal_airgap_thickness" vis="WhiteVis" /> + <slice material="mylar" thickness="Hcal_mylar_cathode_thickness" vis="MagentaVis" /> + <slice material="graphite" thickness="Hcal_graphite_cathode_thickness" vis="Invisible" /> + <slice material="FloatGlass" thickness="Hcal_glass_cathode_thickness" vis="RedVis" /> + <slice material="RPCGAS2" thickness="Hcal_sensitive_gas_gap" sensitive = "yes" vis="YellowVis" edge_material="PEEK-GF30" spacer_material="Nylon"/> + <slice material="FloatGlass" thickness="Hcal_glass_anode_thickness" vis="RedVis" /> + <slice material="graphite" thickness="Hcal_graphite_anode_thickness" vis="Invisible" /> + <slice material="mylar" thickness="Hcal_mylar_anode_thickness" vis="MagentaVis" /> + <slice material="g10" thickness="Hcal_PCB_thickness" vis="CyanVis" /> + <slice material="g10" thickness="Hcal_electronics_mask_thickness" vis="GreenVis" /> + </layer> + </detector> + </detectors> + + <readouts> + <readout name="HcalBarrelCollection"> + <segmentation type="CartesianGridXY" grid_size_x="Hcal_cells_size" grid_size_y="Hcal_cells_size"/> + <id>system:5,module:3,stave:3,tower:5,layer:6,slice:4,x:32:-16,y:-16</id> + </readout> + </readouts> + +</lccdd> diff --git a/Detector/DetCEPCv4/compact/SHcalRpc01_EndcapRing_01.xml b/Detector/DetCEPCv4/compact/SHcalRpc01_EndcapRing_01.xml new file mode 100644 index 0000000000000000000000000000000000000000..ab41b9af64cb63b92de5c198e83f90867caedc78 --- /dev/null +++ b/Detector/DetCEPCv4/compact/SHcalRpc01_EndcapRing_01.xml @@ -0,0 +1,41 @@ +<lccdd> + <detectors> + <detector name="HcalRing" type="SHcalRpc01_EndcapRing" id="ILDDetID_HCAL_RING" readout="HcalEndcapRingCollection" vis="SeeThrough" insideTrackingVolume="false" > + <comment>Hadron Calorimeter EndcapRing</comment> + <envelope vis="ILD_HCALVis"> + <!--shape type="Assembly"/--> + <shape type="BooleanShape" operation="Subtraction" material="Air"> + <shape type="BooleanShape" operation="Intersection" material="Air"> + <shape type="Box" dx="HcalEndcapRing_outer_radius + 2.0*env_safety" dy="HcalEndcapRing_outer_radius + 2.0*env_safety" + dz="HcalEndcapRing_max_z + 2.0*env_safety"/> + <shape type="PolyhedraRegular" numsides="Hcal_ring_inner_symmetry" rmin="HcalEndcapRing_inner_radius - env_safety" + rmax="HcalEndcapRing_outer_radius*cos(pi/Hcal_ring_outer_symmetry) + env_safety" dz="2.0*HcalEndcapRing_max_z + env_safety" material="Air"/> + <rotation x="0" y="0" z="90*deg-180*deg/Hcal_ring_inner_symmetry"/> + </shape> + <shape type="Box" dx="HcalEndcapRing_outer_radius + 2.0*env_safety" dy="HcalEndcapRing_outer_radius + 2.0*env_safety" + dz="HcalEndcapRing_min_z - env_safety"/> + </shape> + </envelope> + + <type_flags type=" DetType_CALORIMETER + DetType_ENDCAP + DetType_HADRONIC + DetType_AUXILIARY " /> + <staves material="stainless_steel" vis="GreenVis"/> + + <layer repeat="HcalEndcapRing_nlayers" vis="SeeThrough"> + <slice material="stainless_steel" thickness="Hcal_radiator_thickness" vis="BlueVis"/> + <slice material="FloatGlass" thickness="Hcal_glass_cathode_thickness" vis="RedVis"/> + <slice material="RPCGAS2" thickness="Hcal_sensitive_gas_gap" sensitive = "yes" vis="YellowVis"/> + <slice material="FloatGlass" thickness="Hcal_glass_anode_thickness" vis="RedVis"/> + <slice material="RPC2ECRMix" thickness="Hcal_mix_thickness" vis="CyanVis"/> + </layer> + </detector> + </detectors> + + <readouts> + <readout name="HcalEndcapRingCollection"> + <segmentation type="CartesianGridXY" grid_size_x="Hcal_cells_size" grid_size_y="Hcal_cells_size"/> + <id>system:5,module:3,stave:4,tower:3,layer:6,x:32:-16,y:-16</id> + </readout> + </readouts> + +</lccdd> + diff --git a/Detector/DetCEPCv4/compact/SHcalRpc01_Endcaps_01.xml b/Detector/DetCEPCv4/compact/SHcalRpc01_Endcaps_01.xml new file mode 100644 index 0000000000000000000000000000000000000000..677a23dd3dcdb7f207f11089a0144e0846f00a84 --- /dev/null +++ b/Detector/DetCEPCv4/compact/SHcalRpc01_Endcaps_01.xml @@ -0,0 +1,38 @@ +<lccdd> + <detectors> + <detector id="ILDDetID_HCAL_ENDCAP" name="HcalEndcap" type="SHcalRpc01_Endcaps" readout="HcalEndcapsCollection" vis="SeeThrough" calorimeterType="HAD_ENDCAP"> + <comment>Hadron Calorimeter Endcap</comment> + <envelope vis="ILD_HCALVis"> + <shape type="BooleanShape" operation="Subtraction" material="Air"> + <shape type="BooleanShape" operation="Subtraction" material="Air"> + <shape type="Tube" rmin="0.0" rmax="HcalEndcap_outer_radius + env_safety" dz="HcalEndcap_max_z + env_safety"/> + <shape type="Tube" rmin="0.0" rmax="HcalEndcap_outer_radius + 2.0*env_safety" dz="HcalEndcap_min_z - env_safety"/> + </shape> + <shape type="Box" dx="HcalEndcap_inner_radius - env_safety" dy="HcalEndcap_inner_radius - env_safety" dz="HcalEndcap_max_z + 2.0*env_safety"/> + </shape> + <rotation x="0" y="0" z="0"/> + </envelope> + + <type_flags type="DetType_CALORIMETER + DetType_ENDCAP + DetType_HADRONIC " /> + + <staves material="stainless_steel" vis="SeeThrough"/> + + <layer repeat="Hcal_endcap_nlayers" vis="SeeThrough"> + <slice material="stainless_steel" thickness="Hcal_radiator_thickness" vis="BlueVis"/> + <slice material="FloatGlass" thickness="Hcal_glass_cathode_thickness" vis="RedVis"/> + <slice material="RPCGAS2" thickness="Hcal_sensitive_gas_gap" sensitive = "yes" vis="YellowVis"/> + <slice material="FloatGlass" thickness="Hcal_glass_anode_thickness" vis="RedVis"/> + <slice material="RPC2ECRMix" thickness="Hcal_mix_thickness" vis="CyanVis"/> + </layer> + + </detector> + </detectors> + + <readouts> + <readout name="HcalEndcapsCollection"> + <segmentation type="CartesianGridXY" grid_size_x="Hcal_cells_size" grid_size_y="Hcal_cells_size" offset_x="Hcal_cells_size/2.0" offset_y="Hcal_cells_size/2.0" /> + <id>system:5,module:3,stave:3,tower:5,layer:6,x:32:-16,y:-16</id> + </readout> + </readouts> + +</lccdd> diff --git a/Detector/DetCEPCv4/compact/Yoke05_Barrel.xml b/Detector/DetCEPCv4/compact/Yoke05_Barrel.xml index 00c8d26420b532947ee63a14c43542c267b8f352..a742d756fe940d5eaddbca7ce4c62af6cdc735c7 100644 --- a/Detector/DetCEPCv4/compact/Yoke05_Barrel.xml +++ b/Detector/DetCEPCv4/compact/Yoke05_Barrel.xml @@ -1,13 +1,11 @@ <!-- comment>Calorimeters</comment --> <lccdd> <detectors> - <detector name="YokeBarrel" type="Yoke05_Barrel" id="ILDDetID_YOKE" readout="YokeBarrelCollection" vis="YellowVis" insideTrackingVolume="false" buildType="BUILD_ENVELOPE"> + <detector name="YokeBarrel" type="Yoke05_Barrel" id="ILDDetID_YOKE" readout="MuonBarrelCollection" vis="YellowVis" insideTrackingVolume="false" buildType="BUILD_ENVELOPE"> <envelope vis="ILD_YOKEVis"> <shape type="BooleanShape" operation="Intersection" material="Air" > - <shape type="Box" dx="Yoke_outer_radius + env_safety" dy="Yoke_outer_radius + env_safety" - dz="Yoke_half_length + env_safety"/> <!--Box defined the coordinate system--> - <shape type="PolyhedraRegular" numsides="Yoke_symmetry" rmin="Yoke_inner_radius" - rmax="Yoke_outer_radius" dz="2.0*Yoke_half_length" material = "Air" /> + <shape type="Box" dx="Yoke_outer_radius + env_safety" dy="Yoke_outer_radius + env_safety" dz="Yoke_half_length + env_safety"/> <!--Box defined the coordinate system--> + <shape type="PolyhedraRegular" numsides="Yoke_symmetry" rmin="Yoke_inner_radius" rmax="Yoke_outer_radius" dz="2.0*Yoke_half_length" material = "Air" /> <rotation x="0*deg" y="0*deg" z="90*deg-180*deg/Yoke_symmetry"/> </shape> </envelope> @@ -28,7 +26,7 @@ </detectors> <readouts> - <readout name="YokeBarrelCollection"> + <readout name="MuonBarrelCollection"> <segmentation type="CartesianGridXZ" grid_size_x="Yoke_cells_size" grid_size_z="Yoke_cells_size"/> <id>system:5,module:3,stave:4,tower:3,layer:6,x:32:-16,z:-16</id> </readout> diff --git a/Detector/DetCEPCv4/compact/Yoke05_Endcaps.xml b/Detector/DetCEPCv4/compact/Yoke05_Endcaps.xml index 6115d54d883e03bb70002cba6ae92bd9314621cd..74b85fdd0b2b37da1c03715a33397dfd0c10220f 100644 --- a/Detector/DetCEPCv4/compact/Yoke05_Endcaps.xml +++ b/Detector/DetCEPCv4/compact/Yoke05_Endcaps.xml @@ -1,8 +1,7 @@ <!-- comment>Calorimeters</comment --> <lccdd> <detectors> - <detector name="YokeEndcap" type="Yoke05_Endcaps" id="ILDDetID_YOKE_ENDCAP" readout="YokeEndcapsCollection" vis="YellowVis" insideTrackingVolume="false" > - + <detector name="YokeEndcap" type="Yoke05_Endcaps" id="ILDDetID_YOKE_ENDCAP" readout="MuonEndcapsCollection" vis="YellowVis" insideTrackingVolume="false" > <envelope vis="ILD_YOKEVis"> <shape type="BooleanShape" operation="Subtraction" material="Air"> <shape type="BooleanShape" operation="Subtraction" material="Air"> @@ -16,7 +15,7 @@ <shape type="Box" dx="YokeEndcap_outer_radius + 1.5*env_safety" dy="YokeEndcap_outer_radius + 1.5*env_safety" dz="YokeEndcapPlug_min_z - env_safety"/> </shape> - <shape type="PolyhedraRegular" numsides="YokeEndcapPlug_symmetry" rmin="YokeEndcapPlug_outer_radius + env_safety" + <shape type="PolyhedraRegular" numsides="YokeEndcapPlug_symmetry" rmin="YokeEndcapPlug_outer_radius*cos(pi/Hcal_ring_outer_symmetry) + env_safety" rmax="YokeEndcap_outer_radius + 2.0*env_safety" dz="2.*YokeEndcap_min_z - env_safety" /> <rotation x="0*deg" y="0*deg" z="90*deg-180*deg/YokeEndcapPlug_symmetry"/> </shape> @@ -24,7 +23,7 @@ <type_flags type=" DetType_CALORIMETER + DetType_ENDCAP + DetType_MUON " /> - <dimensions numsides="12" rmin="Yoke_inner_radius" z="Yoke_barrel_halfZ" /> + <dimensions numsides="Yoke_symmetry" rmin="Yoke_inner_radius" z="Yoke_barrel_halfZ" /> <material name="Iron"/> <layer repeat="12" vis="SeeThrough"> <slice material = "Air" thickness = "15.0*mm" vis="YellowVis" /> @@ -35,7 +34,7 @@ </detectors> <readouts> - <readout name="YokeEndcapsCollection"> + <readout name="MuonEndcapsCollection"> <segmentation type="CartesianGridXY" grid_size_x="Yoke_cells_size" grid_size_y="Yoke_cells_size"/> <id>system:5,module:3,stave:4,tower:3,layer:6,x:32:-16,y:-16</id> </readout> diff --git a/Detector/DetCEPCv4/compact/coil03.xml b/Detector/DetCEPCv4/compact/coil03.xml index 3f176d2827f53c0cab3790f2c0d5dc0e494a94fd..1714b455ed9e32198a57890bae6ac28141d75c81 100644 --- a/Detector/DetCEPCv4/compact/coil03.xml +++ b/Detector/DetCEPCv4/compact/coil03.xml @@ -2,29 +2,29 @@ Coil parameters for ILD_o1_v5 --> <lccdd> -<detectors> - -<detector name="Coil" type="SCoil02" vis="CoilVis" id="ILDDetID_COIL" insideTrackingVolume="false" sensitive="no"> - + <detectors> + <detector name="Coil" type="SCoil02" vis="ILD_COILVis" id="ILDDetID_COIL" insideTrackingVolume="false" readout="COILCollection"> <!-- fg: taken from SCoil02.cc::PreLoadScriptAction() : there the variable Hcal_R_max was used, which was set from Hcal_module_radius in the SHcal driver - here we simply use the value Hcal_outer_radius defined in ILD_l1_v01 -> now (03/2015) done in main compact file ILD_l1_v01.xml --> - - <envelope vis="ILD_COILVis"> - <shape type="Tube" rmin="Coil_inner_radius" rmax="Coil_outer_radius" - dz="Coil_half_length" material="Air"/> - </envelope> - - <type_flags type=" DetType_SUPPORT + DetType_COIL " /> - - <!--fg: for now only a simple aluminum cylinder is created inside the envelope --> - <tube rmin="Coil_inner_radius+env_safety" rmax="Coil_outer_radius-env_safety" - dz="Coil_half_length-env_safety" material="G4_Al"/> - -</detector> - -</detectors> + <envelope vis="SeeThrough"> + <shape type="Tube" rmin="Coil_inner_radius" rmax="Coil_outer_radius" dz="Coil_half_length" material="Air"/> + </envelope> + + <type_flags type=" DetType_SUPPORT + DetType_COIL " /> + + <!--fg: for now only a simple aluminum cylinder is created inside the envelope --> + <tube rmin="Coil_inner_radius" rmax="Coil_outer_radius" dz="Coil_half_length" material="G4_Al"/> + + </detector> + </detectors> + + <readouts> + <readout name="COILCollection"> + <id>system:5,side:-2,layer:9,module:8,sensor:8,barrelside:-2</id> + </readout> + </readouts> </lccdd> diff --git a/Detector/DetCEPCv4/compact/envelope_defs.xml b/Detector/DetCEPCv4/compact/envelope_defs.xml index e80faf2de8143bc34460b2c4b05ab373f2bd14aa..0c6db07312a2a10377732356d2033892c35f78f3 100644 --- a/Detector/DetCEPCv4/compact/envelope_defs.xml +++ b/Detector/DetCEPCv4/compact/envelope_defs.xml @@ -50,12 +50,13 @@ <constant name="VXD_inner_radius" value="top_VXD_inner_radius"/> <constant name="VXD_outer_radius" value="top_VXD_outer_radius"/> <constant name="VXD_half_length" value="top_VXD_half_length"/> - <constant name="VXD_cone_min_z" value="TUBE_IPInnerTube_end_z"/> + <!--constant name="VXD_cone_min_z" value="TUBE_IPInnerTube_end_z"/--> + <constant name="VXD_cone_min_z" value="135*mm"/> <!--constant name="VXD_cone_max_z" value="TUBE_IPInnerBulge_end_z"/--> - <constant name="VXD_cone_max_z" value="VXD_half_length"/> + <constant name="VXD_cone_max_z" value="VXD_half_length-10*mm"/> <!--constant name="VXD_cone_max_z" value="125.1*mm "/--> <constant name="VXD_inner_radius_1" value="TUBE_IPInnerBulge_end_envradius + env_safety "/> - + <!--constant name="VXD_inner_radius_1" value="TUBE_central_inner_radius + TUBE_central_thickness + env_safety"/--> <constant name="SIT_inner_radius" value="SIT1_Radius - env_safety"/> <constant name="SIT_outer_radius_1" value="SIT2_Radius - env_safety"/> @@ -92,7 +93,8 @@ <constant name="Ecal_symmetry" value="Ecal_Hcal_symmetry"/> <constant name="Hcal_inner_radius" value="Ecal_outer_radius+Hcal_Ecal_gap"/> - <constant name="Hcal_outer_radius" value="(Hcal_inner_radius+Hcal_barrel_thickness)/cos(pi/Hcal_outer_symmetry)"/> <!-- cos(pi/16) --> + <!--constant name="Hcal_outer_radius" value="(Hcal_inner_radius+Hcal_barrel_thickness)/cos(pi/Hcal_outer_symmetry)"/--> <!-- cos(pi/16) --> + <constant name="Hcal_outer_radius" value="3144.43*mm + 0.00244676*mm"/> <constant name="Hcal_half_length" value="TPC_Ecal_Hcal_barrel_halfZ"/> <constant name="Hcal_inner_symmetry" value="Ecal_Hcal_symmetry"/> @@ -118,7 +120,8 @@ <constant name="Coil_outer_radius" value="Hcal_outer_radius+Hcal_Coil_additional_gap+Coil_thickness"/> <constant name="Coil_half_length" value="TPC_Ecal_Hcal_barrel_halfZ+Coil_extra_size"/> - <constant name="Yoke_inner_radius" value="Coil_outer_radius+top_Hcal_Yoke_gap"/> + <!--constant name="Yoke_inner_radius" value="Hcal_outer_radius+top_Hcal_Yoke_gap"/--><!--two ways to obtain Yoke_inner_radius--> + <constant name="Yoke_inner_radius" value="Coil_outer_radius+Coil_Yoke_radial_clearance"/> <constant name="Yoke_outer_radius" value="Yoke_inner_radius+top_Yoke_thickness"/> <constant name="Yoke_half_length" value="top_Yoke_half_length"/> <constant name="Yoke_symmetry" value="top_Yoke_symmetry"/> diff --git a/Detector/DetCEPCv4/compact/ftd_cepc.xml b/Detector/DetCEPCv4/compact/ftd_cepc.xml index 1566734d9cc99303396268d315a9df8f578a3aee..c32b76369a1474eb45996d855444066ed4bba94a 100644 --- a/Detector/DetCEPCv4/compact/ftd_cepc.xml +++ b/Detector/DetCEPCv4/compact/ftd_cepc.xml @@ -19,7 +19,8 @@ <shape type="Tube" rmin="FTD_inner_radius" rmax="FTD_outer_radius" dz="FTD_half_length" /> <shape type="Tube" rmin="0." rmax="FTD_outer_radius+env_safety" dz="FTD_min_z_0" /> </shape> - <shape type="Tube" rmin="FTD_outer_radius_1" rmax="FTD_outer_radius+env_safety" dz="FTD_min_z_2-petal_cp_support_thickness-petal_support_zoffset" /> + <!--shape type="Tube" rmin="FTD_outer_radius_1" rmax="FTD_outer_radius+env_safety" dz="FTD_min_z_2-petal_cp_support_thickness-petal_support_zoffset" /--> + <shape type="Tube" rmin="FTD_outer_radius_1" rmax="FTD_outer_radius+env_safety" dz="FTD_min_z_2-FTD_layer_shift"/> </shape> <shape type="Tube" rmin="FTD_outer_radius_2" rmax="FTD_outer_radius+env_safety" dz="FTD_min_z_2" /> </shape> @@ -46,9 +47,9 @@ <!-- SQL command: "select * from extended_reconstruction_parameters;" same as ftd_cepc_v4 checked by fucd --> <extended_reconstruction_parameters strip_width="0.001*mm" strip_length="250*mm" strip_pitch="0.01*mm" strip_angle="5*deg" /> - <!-- SQL command: "select * from disks;" same as ftd_cepc_v4 checked by fucd--> - <disk disk_number="1" z_position_ReltoTPCLength="0" disk_si_thickness="0.02*mm" petal_cp_support_dxMax="72*mm" padUp_Si_dxMax="68*mm" petal_cp_support_thickness="1*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="1" double_sided="0" /> - <disk disk_number="2" z_position_ReltoTPCLength="FTD_disk2_zPosRelToTpcLength" disk_si_thickness="0.02*mm" petal_cp_support_dxMax="72*mm" padUp_Si_dxMax="68*mm" petal_cp_support_thickness="1*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="1" double_sided="0" /> + <!-- SQL command: "select * from disks;" same as ftd_cepc_v4 checked by fucd, but overlap exist, reduce petal_cp_support_dxMax from 72mm to 71.4mm/71.8mm--> + <disk disk_number="1" z_position_ReltoTPCLength="0" disk_si_thickness="0.02*mm" petal_cp_support_dxMax="71.4*mm" padUp_Si_dxMax="68*mm" petal_cp_support_thickness="1*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="1" double_sided="0" /> + <disk disk_number="2" z_position_ReltoTPCLength="FTD_disk2_zPosRelToTpcLength" disk_si_thickness="0.02*mm" petal_cp_support_dxMax="71.8*mm" padUp_Si_dxMax="68*mm" petal_cp_support_thickness="1*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="1" double_sided="0" /> <disk disk_number="3" z_position_ReltoTPCLength="FTD_disk3_zPosRelToTpcLength" disk_si_thickness="0.20*mm" petal_cp_support_dxMax="122.49*mm" padUp_Si_dxMax="118.46*mm" petal_cp_support_thickness="2*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="0" double_sided="1" /> <disk disk_number="4" z_position_ReltoTPCLength="FTD_disk4_zPosRelToTpcLength" disk_si_thickness="0.20*mm" petal_cp_support_dxMax="122.49*mm" padUp_Si_dxMax="118.46*mm" petal_cp_support_thickness="2*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="0" double_sided="1" /> <disk disk_number="5" z_position_ReltoTPCLength="FTD_disk5_zPosRelToTpcLength" disk_si_thickness="0.20*mm" petal_cp_support_dxMax="122.49*mm" padUp_Si_dxMax="118.46*mm" petal_cp_support_thickness="2*mm" petal_support_zoffset="1.5*mm" sensor_is_pixel="0" double_sided="1" /> @@ -61,8 +62,7 @@ <readouts> <readout name="FTDCollection"> - <!-- fixme: for now DD4hep cannot handle signed values - side should actually be "-2" --> - <id>system:5,side:2,layer:9,module:8,sensor:8</id> + <id>system:5,side:-2,layer:9,module:8,sensor:8</id> </readout> </readouts> diff --git a/Detector/DetCEPCv4/compact/hcal_defs.xml b/Detector/DetCEPCv4/compact/hcal_defs.xml index 12f7ba31c749056b80cd53abd81378c13773c787..c9d72eae8ed9263a480936e222fed1ab76508715 100644 --- a/Detector/DetCEPCv4/compact/hcal_defs.xml +++ b/Detector/DetCEPCv4/compact/hcal_defs.xml @@ -1,85 +1,49 @@ <define> - - <constant name="Hcal_radiator_thickness" value="20.0*mm"/> - <constant name="Hcal_chamber_thickness" value="6.73*mm"/> - <constant name="Hcal_back_plate_thickness" value="15*mm"/> - <constant name="Hcal_lateral_structure_thickness" value="10*mm"/> - <constant name="Hcal_stave_gaps" value="3*mm"/> - <constant name="Hcal_modules_gap" value="0.001*mm"/> - <constant name="Hcal_layer_air_gap" value="2*mm"/> - <constant name="Hcal_middle_stave_gaps" value="10*mm"/> + <constant name="Hcal_airgap_thickness" value="1*mm"/> + <constant name="Hcal_mylar_cathode_thickness" value="0.18*mm"/> + <constant name="Hcal_graphite_cathode_thickness" value="0.05*mm"/> + <constant name="Hcal_glass_cathode_thickness" value="1.1*mm"/> + <constant name="Hcal_sensitive_gas_gap" value="1.2*mm"/> + <constant name="Hcal_glass_anode_thickness" value="0.7*mm"/> + <constant name="Hcal_graphite_anode_thickness" value="0.05*mm"/> + <constant name="Hcal_mylar_anode_thickness" value="0.05*mm"/> + <constant name="Hcal_PCB_thickness" value="0.8*mm"/> + <constant name="Hcal_electronics_mask_thickness" value="1.6*mm"/> + <constant name="Hcal_nlayers" value="40"/> - <constant name="Hcal_fiber_gap" value="1.5*mm"/> - <constant name="Hcal_Cu_thickness" value="0.1*mm"/> - <constant name="Hcal_PCB_thickness" value="0.7*mm"/> - <constant name="Hcal_scintillator_thickness" value="3.0*mm"/> + <constant name="Hcal_endcap_nlayers" value="Hcal_nlayers"/> + <constant name="Hcal_ring_nlayers" value="7"/> <constant name="Hcal_cells_size" value="10*mm"/> - <constant name="Hcal_endcap_lateral_structure_thickness" value="5.0*mm"/> - <constant name="Hcal_endcap_layer_air_gap" value="2.5*mm"/> - <constant name="Hcal_endcap_nlayers" value="40"/> <!-- needed for ring only? --> - - <!-- fg: - copy extra parameters for SDHcal from ILD_o2_v01 here - maybe they should all be renamed to SDHCal_ for clarity ? - TK: Yes, here are they ... HcalSD_ - --> - <constant name="HcalSD_cells_size" value="10.406*mm"/> - <constant name="HcalSD_pad_separation" value="0.406*mm"/> - <constant name="HcalSD_radiator_thickness" value="15.0*mm"/> - <constant name="HcalSD_sensitive_gas_gap" value="1.2*mm"/> - <constant name="HcalSD_graphite_cathode_thickness" value="0.05*mm"/> - <constant name="HcalSD_graphite_anode_thickness" value="0.05*mm"/> - <constant name="HcalSD_glass_cathode_thickness" value="1.1*mm"/> - <constant name="HcalSD_glass_anode_thickness" value="0.7*mm"/> - <constant name="HcalSD_g10_thickness" value="1.4*mm"/> - <constant name="HcalSD_mylar_anode_thickness" value="0.05*mm"/> - <constant name="HcalSD_mylar_cathode_thickness" value="0.175*mm"/> - <constant name="HcalSD_mylar_thickness" value="0.2*mm"/> - <constant name="HcalSD_PCB_thickness" value="1.2*mm"/> - <constant name="HcalSD_electronics_mask_thickness" value="1.6*mm"/> - <constant name="HcalSD_steel_casette_thickness" value="2.5*mm"/> - <constant name="HcalSD_airgap_thickness" value="0.5*mm"/> - <constant name="HcalSD_back_plate_thickness" value="10*mm"/> - <constant name="HcalSD_barrel_end_module_type" value="1"/> - <constant name="HcalSD_stave_gaps" value="10*mm"/> - <constant name="HcalSD_lateral_structure_thickness" value="10*mm"/> - <constant name="HcalSD_layer_air_gap" value="2*mm"/> - <constant name="HcalSD_endcap_lateral_structure_thickness" value="5.0*mm"/> - - <constant name="HcalSD_module_wall_thickness" value="10*mm"/> - - <constant name="HcalBarrelSD_nlayers" value="40"/> - <constant name="HcalSD_MinNumCellsInTransvPlane" value="1"/> - <constant name="HcalBarrelSD_number_modules" value="5"/> - <constant name="HcalEndcap_symmetry" value="Hcal_outer_symmetry"/> - <constant name="HcalEndcapRingSD_inner_symmetry" value="Ecal_Hcal_symmetry"/> - <constant name="HcalEndcapRingSD_outer_symmetry" value="HcalEndcap_symmetry"/> - <constant name="HcalEndcapRingSD_nlayers" value="7"/> - <constant name="HcalEndcapSD_nlayers" value="40"/> - - <constant name="HcalSD_gasInlet_length" value="3.0*mm"/> - <constant name="HcalSD_modules_gap" value="20*mm"/> - <constant name="HcalSD_spacer_separation" value="100*mm"/> - <constant name="HcalSD_spacer_thickness" value="8*mm"/> - <constant name="HcalSD_gasInlet_innerRadius" value="0.4*mm"/> - <constant name="HcalSD_gasInlet_outerRadius" value="0.5*mm"/> - - - - <!-- translations --> - <constant name="Hcal_endcap_zmin" value="HcalEndcap_min_z"/> - - <!-- used for "hybrid" readout segmentation --> - <constant name="AHCal_cell_size" value="3.0*cm"/> - <constant name="SDHCal_cell_size" value="1.0*cm"/> - - <!-- TODO move these two element at the correct place --> - <!-- TODO create the additional detectors for the different options for l/s4 and l/s5 --> - <!-- TODO merge the two variables to only one for both barrel and endcap --> - <!-- barrel and endcvap constructors use the slices in reversed order ! --> - <!-- <constant name="Hcal_readout_segmentation_slice_barrel" value="3"/> --> - <!-- <constant name="Hcal_readout_segmentation_slice_endcap" value="3"/> --> - + <constant name="Hcal_gas_edge_width" value="1*mm"/> + <constant name="Hcal_MinNumCellsInTransvPlane" value="11"/> + <constant name="Hcal_barrel_number_modules" value="5"/> + <constant name="Hcal_chamber_thickness" value="6.73*mm"/> + <constant name="Hcal_back_plate_thickness" value="15*mm"/> + <constant name="Hcal_lateral_structure_thickness" value="10*mm"/> + <constant name="Hcal_stave_gaps" value="0*mm"/> + <constant name="Hcal_modules_gap" value="2*mm"/> + + <constant name="Hcal_pad_separation" value="0*mm"/> + <constant name="Hcal_gasInlet_length" value="3.0*mm"/> + <constant name="Hcal_spacer_separation" value="100*mm"/> + <constant name="Hcal_spacer_thickness" value="8*mm"/> + <constant name="Hcal_gasInlet_inner_radius" value="0.4*mm"/> + <constant name="Hcal_gasInlet_outer_radius" value="0.5*mm"/> + + <constant name="Hcal_endcap_outer_symmetry" value="Hcal_outer_symmetry"/> + <constant name="Hcal_ring_inner_symmetry" value="Ecal_Hcal_symmetry"/> + <constant name="Hcal_ring_outer_symmetry" value="Hcal_endcap_outer_symmetry"/> + + <constant name="Hcal_graphite_thickness" value="Hcal_graphite_cathode_thickness+Hcal_graphite_anode_thickness"/> + <constant name="Hcal_mylar_thickness" value="Hcal_mylar_cathode_thickness+Hcal_mylar_anode_thickness"/> + <constant name="Hcal_g10_thickness" value="Hcal_PCB_thickness+Hcal_electronics_mask_thickness"/> + <constant name="Hcal_mix_thickness" value="Hcal_airgap_thickness+Hcal_graphite_thickness+Hcal_mylar_thickness+Hcal_g10_thickness"/> + <constant name="Hcal_mix_density" value="Hcal_airgap_thickness/Hcal_mix_thickness*0.00120479 + Hcal_graphite_thickness/Hcal_mix_thickness*2.21 + + Hcal_mylar_thickness/Hcal_mix_thickness*1.4 + Hcal_g10_thickness/Hcal_mix_thickness*1.7"/> + <constant name="Hcal_airgap_fraction" value="Hcal_airgap_thickness/Hcal_mix_thickness*0.00120479/Hcal_mix_density"/> + <constant name="Hcal_graphite_fraction" value="Hcal_graphite_thickness/Hcal_mix_thickness*2.21/Hcal_mix_density"/> + <constant name="Hcal_mylar_fraction" value="Hcal_mylar_thickness/Hcal_mix_thickness*1.4/Hcal_mix_density"/> + <constant name="Hcal_g10_fraction" value="Hcal_g10_thickness/Hcal_mix_thickness*1.7/Hcal_mix_density"/> </define> diff --git a/Detector/DetCEPCv4/compact/services_defs.xml b/Detector/DetCEPCv4/compact/services_defs.xml index 91e4ed58b436936f24818235a97d85022c8fbcf3..f60250d5862bbd44032db692743d159bb3daa210 100644 --- a/Detector/DetCEPCv4/compact/services_defs.xml +++ b/Detector/DetCEPCv4/compact/services_defs.xml @@ -39,6 +39,7 @@ <constant name="SServices_FTD2_cone_thickness" value="0.040*mm"/> <constant name="SServices_FTD3_cone_thickness" value="0.020*mm"/> <constant name="SServices_FTD7_cables_thickness" value="0.85*mm"/> + <constant name="FTD_layer_shift" value="petal_cp_support_thickness+petal_support_zoffset+1*mm"/> <constant name="VXD_cable_cross_section_area" value="25.0*mm*mm"/> <constant name="VXD_cable_inner1_radius" value="30.0*mm"/> diff --git a/Detector/DetCEPCv4/compact/top_defs.xml b/Detector/DetCEPCv4/compact/top_defs.xml index 8516b3a129614567b22deb7163e22f09b69dd8b1..021f80a852b9e20e8cd3fa1aad6b8a04f1882f2c 100644 --- a/Detector/DetCEPCv4/compact/top_defs.xml +++ b/Detector/DetCEPCv4/compact/top_defs.xml @@ -10,11 +10,11 @@ <constant name="CepC_Main_Crossing_Angle" value="33*mrad"/> <!-- the field inside and outside the solenoid --> - <constant name="outerField_nominal_value" value="-1.5*tesla"/> - + <constant name="Field_outer_nominal_value" value="-1.33716*tesla"/> + <constant name="Field_outer_thickness" value="2550*mm"/> <!-- VXD --> - <constant name="top_VXD_inner_radius" value="15.95*mm "/> + <constant name="top_VXD_inner_radius" value="15*mm "/> <constant name="top_VXD_outer_radius" value="101*mm "/> <constant name="top_VXD_half_length" value="200*mm "/> @@ -58,16 +58,17 @@ <constant name="Ecal_EC_Ring_gap" value="10*mm"/> <!-- HCAL --> - <constant name="Hcal_barrel_thickness" value="1272.3*mm"/> + <!--constant name="Hcal_barrel_thickness" value="1086.43*mm"/--> <constant name="Hcal_Coil_additional_gap" value="29.5*mm"/> <!--constant name="Hcal_outer_symmetry" value="16"/--> <constant name="Hcal_outer_symmetry" value="8"/> <constant name="Hcal_endcap_center_box_size" value="700.0*mm"/> <constant name="Hcal_endcap_zmin" value="2650*mm" /> - <constant name="Hcal_endcap_thickness" value="1287.0*mm"/> + <constant name="Hcal_endcap_thickness" value="1084.2*mm"/> <constant name="Hcal_radial_ring_inner_gap" value="50*mm"/> - <constant name="Hcal_endcap_cryostat_gap" value="170*mm"/> + <constant name="Hcal_endcap_cryostat_gap" value="0*mm"/> + <constant name="Hcal_endcap_ecal_gap" value="15*mm"/> <!-- coil --> <constant name="Coil_extra_size" value="1522*mm"/> @@ -80,8 +81,9 @@ <constant name="top_Yoke_inner_radius" value="4424.0*mm"/> <constant name="top_Yoke_outer_radius" value="7725.0*mm"/> --> - <constant name="top_Hcal_Yoke_gap" value="300*mm"/> - <constant name="top_Yoke_thickness" value="2550*mm"/> + <constant name="Coil_Yoke_radial_clearance" value="250*mm"/> + <constant name="top_Hcal_Yoke_gap" value="Hcal_Coil_additional_gap+Coil_thickness+Coil_Yoke_radial_clearance"/> + <constant name="top_Yoke_thickness" value="3241*mm"/> <constant name="top_Yoke_half_length" value="4047.0*mm"/> <constant name="Yoke_Z_start_endcaps" value="4072.0*mm"/> diff --git a/Detector/DetCEPCv4/compact/tpc10_01.xml b/Detector/DetCEPCv4/compact/tpc10_01.xml index aa769400e9d7e8abc95cc808e50da6d7c9971e63..539e06577a621ecf4a610af491c9d9c564a036c2 100644 --- a/Detector/DetCEPCv4/compact/tpc10_01.xml +++ b/Detector/DetCEPCv4/compact/tpc10_01.xml @@ -37,25 +37,25 @@ <!-- SQL command: "SELECT * FROM `innerWall`;" --> <innerWall> <!-- updates from Dimitra 4/7/17 --> - <row dr="0.07*mm" material="G4_Cu" /> + <row dr="0.01*mm" material="G4_Al" /> <row dr="0.05*mm" material="G4_KAPTON" /> <row dr="0.3*mm" material="g10" /> <row dr="24.22*mm" material="G4_AIR" /> <row dr="0.3*mm" material="g10" /> <row dr="0.05*mm" material="G4_KAPTON" /> - <row dr="0.01*mm" material="G4_Al" /> + <row dr="0.07*mm" material="G4_Cu" /> </innerWall> <!-- SQL command: "SELECT * FROM `outerWall`;" --> <outerWall> <!-- updates from Dimitra 4/7/17 --> <!--recover to tpc10_01 matching CEPC_v4, by fucd--> - <row dr="0.01*mm" material="G4_Al" /> + <row dr="0.07*mm" material="G4_Cu" /> <row dr="0.05*mm" material="G4_KAPTON" /> <row dr="0.3*mm" material="g10" /> <!-- row dr="57.66*mm" material="G4_AIR" / --> <row dr="59.22*mm" material="G4_AIR" /> <!-- removed 5 mm to accomadate fat ecal: to be finalised when numbers available --> <row dr="0.3*mm" material="g10" /> <row dr="0.05*mm" material="G4_KAPTON" /> - <row dr="0.07*mm" material="G4_Cu" /> + <row dr="0.01*mm" material="G4_Al" /> </outerWall> <!-- SQL command: "SELECT * FROM `readout`;" --> <readout> @@ -86,8 +86,7 @@ <readouts> <readout name="TPCCollection"> - <!-- fixme: for now DD4hep cannot handle signed values - side should actually be "-2" --> - <id>system:5,side:2,layer:9,module:8,sensor:8</id> + <id>system:5,side:-2,layer:9,module:8,sensor:8</id> </readout> </readouts> diff --git a/Detector/DetCEPCv4/compact/yoke_defs.xml b/Detector/DetCEPCv4/compact/yoke_defs.xml index 59672a5a558a68871b9693ab6504643de54342a4..f299a2820ab91fb5b26e13fd947a4d6c57ec64b7 100644 --- a/Detector/DetCEPCv4/compact/yoke_defs.xml +++ b/Detector/DetCEPCv4/compact/yoke_defs.xml @@ -1,6 +1,7 @@ <define> <constant name="Yoke_cells_size" value="30*mm"/> <constant name="Yoke_barrel_inner_radius" value="Yoke_inner_radius"/> + <constant name="Hcal_Yoke_plug_gap" value="45*mm"/> </define> diff --git a/Detector/DetCEPCv4/src/calorimeter/SEcal05_Barrel.cpp b/Detector/DetCEPCv4/src/calorimeter/SEcal05_Barrel.cpp index 11104445600631b3e42ada1907e76389e1e3bfb0..ee42d87b617e7f9ab9df7329aa57442716007ee7 100644 --- a/Detector/DetCEPCv4/src/calorimeter/SEcal05_Barrel.cpp +++ b/Detector/DetCEPCv4/src/calorimeter/SEcal05_Barrel.cpp @@ -395,7 +395,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h element, SensitiveDete // end of slabs aligned to inner face of support plate in next stave (not the outer surface) // double Y = (module_thickness/2.) / sin(M_PI/4.); // double Y = (module_thickness_noSupport/2.) / sin(2.*M_PI/nsides); - double Y = (module_thickness/2.) / sin(2.*M_PI/nsides); + double Y = -(module_thickness/2.) / sin(2.*M_PI/nsides); // stave numbering from 1->8 // stave = 1 is in +ve x direction @@ -422,7 +422,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h element, SensitiveDete for (int imodule = 0; imodule < Ecal_barrel_z_modules; imodule++) { int module_id = imodule+1; - Transform3D tr( RotationZYX( 0 , phirot, M_PI/2.), // magic rotation! + Transform3D tr( RotationZYX( M_PI , phirot, M_PI/2.), // magic rotation! Translation3D( ( X*cos(phirot2)-Y*sin(phirot2) ) , ( X*sin(phirot2)+Y*cos(phirot2) ) , diff --git a/Detector/DetCEPCv4/src/calorimeter/SHcalRpc01_Barrel.cpp b/Detector/DetCEPCv4/src/calorimeter/SHcalRpc01_Barrel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9801a0a17418f93b03e46f8ea259be8f80e6ad6c --- /dev/null +++ b/Detector/DetCEPCv4/src/calorimeter/SHcalRpc01_Barrel.cpp @@ -0,0 +1,333 @@ +//==================================================================== +// SHcalRpc01 - Implementation from ILCSoft's Mokka version +//==================================================================== +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/DD4hepUnits.h" +#include "DD4hep/DetType.h" + +#include "DDRec/Surface.h" +#include "DDRec/DetectorData.h" +#include "XML/Utilities.h" + +using namespace std; + +using dd4hep::Ref_t; +using dd4hep::BUILD_ENVELOPE; +using dd4hep::DetElement; +using dd4hep::Detector; +using dd4hep::SensitiveDetector; +using dd4hep::Segmentation; +using dd4hep::Readout; +using dd4hep::Material; +using dd4hep::Volume; +using dd4hep::PlacedVolume; +using dd4hep::Position; +using dd4hep::RotationZYX; +using dd4hep::Transform3D; +using dd4hep::Box; +using dd4hep::Tube; +using dd4hep::PolyhedraRegular; +using dd4hep::SubtractionSolid; +using dd4hep::_toString; +using dd4hep::pi; +using dd4hep::rec::LayeredCalorimeterData; + +/** Construction of SHcalRpc01 detector, ported from Mokka driver SHcalRpc01.cc + * + * Mokka History: + * - first implementation from ILCSoft + * - http://cepcgit.ihep.ac.cn/cepcsoft/MokkaC + */ +static Ref_t create_detector(Detector& theDetector, xml_h element, SensitiveDetector sens) { + cout << "--------------------------" << endl; + cout << "creating SHcalRpc01_Barrel" << endl; + cout << "--------------------------" << endl; + + xml_det_t x_det = element; + string name = x_det.nameStr(); + int det_id = x_det.id(); + DetElement det(name, det_id); + + Volume envelope = dd4hep::xml::createPlacedEnvelope(theDetector, element , det ) ; + + dd4hep::xml::setDetectorTypeFlag(element, det) ; + + if( theDetector.buildType() == BUILD_ENVELOPE ) return det ; + + xml_comp_t x_staves = x_det.staves(); + string Hcal_radiator_material = x_staves.materialStr(); + Material stavesMaterial = theDetector.material(Hcal_radiator_material); + Material air = theDetector.air(); + + sens.setType("calorimeter"); + + Readout readout = sens.readout(); + Segmentation seg = readout.segmentation(); + + std::vector<double> cellSizeVector = seg.segmentation()->cellDimensions(0); + double cell_sizeX = cellSizeVector[0]; + double cell_sizeZ = cellSizeVector[1]; + + double Hcal_inner_radius = theDetector.constant<double>("Hcal_inner_radius"); + double Hcal_outer_radius_set = theDetector.constant<double>("Hcal_outer_radius"); + double Hcal_half_length = theDetector.constant<double>("Hcal_half_length"); + int Hcal_inner_symmetry = theDetector.constant<int>("Hcal_inner_symmetry"); + int Hcal_outer_symmetry = 0; + double Hcal_lateral_plate_thickness = theDetector.constant<double>("Hcal_lateral_structure_thickness"); + double Hcal_modules_gap = theDetector.constant<double>("Hcal_modules_gap"); + int Hcal_nlayers = theDetector.constant<int>("Hcal_nlayers"); + double TPC_outer_radius = theDetector.constant<double>("TPC_outer_radius"); + double Ecal_outer_radius = theDetector.constant<double>("Ecal_outer_radius"); + int Hcal_barrel_number_modules = theDetector.constant<int>("Hcal_barrel_number_modules"); + + double hPrime = Ecal_outer_radius + theDetector.constant<double>("Hcal_Ecal_gap"); + Hcal_inner_radius = hPrime / cos(pi/8.); + + double Hcal_normal_dim_z = (2*Hcal_half_length - (Hcal_barrel_number_modules-1)*Hcal_modules_gap)/Hcal_barrel_number_modules; + + xml_coll_t c(x_det,_U(layer)); + xml_comp_t x_layer = c; + + double Hcal_radiator_thickness = 0; + double layerThickness = 0.0; + for(xml_coll_t k(x_layer,_U(slice)); k; ++k) { + xml_comp_t x_slice = k; + layerThickness += x_slice.thickness(); + if(x_slice.materialStr()==Hcal_radiator_material) Hcal_radiator_thickness = x_slice.thickness(); + } + cout << " layer_thickness (from slices) = " << layerThickness << " and radiator_thickness = " << Hcal_radiator_thickness << endl; + double Hcal_chamber_thickness = layerThickness - Hcal_radiator_thickness; + + int MinNumCellsInTransvPlane = theDetector.constant<int>("Hcal_MinNumCellsInTransvPlane"); + double RPC_EdgeWidth = theDetector.constant<double>("Hcal_gas_edge_width"); + double RPCGazInletInnerRadius = theDetector.constant<double>("Hcal_gasInlet_inner_radius"); + double RPCGazInletOuterRadius = theDetector.constant<double>("Hcal_gasInlet_outer_radius"); + double RPCGazInletLength = theDetector.constant<double>("Hcal_gasInlet_length"); + double RPC_PadSeparation = theDetector.constant<double>("Hcal_pad_separation"); + double Hcal_spacer_thickness = theDetector.constant<double>("Hcal_spacer_thickness"); + double Hcal_spacer_separation = theDetector.constant<double>("Hcal_spacer_separation"); + + //========== fill data for reconstruction ============================ + LayeredCalorimeterData* caloData = new LayeredCalorimeterData ; + caloData->layoutType = LayeredCalorimeterData::BarrelLayout ; + caloData->inner_symmetry = Hcal_inner_symmetry ; + caloData->outer_symmetry = Hcal_outer_symmetry ; + caloData->phi0 = 0 ; // fg: also hardcoded below + + // general calculated parameters + double AngleRatio=0.76536686;//"k" + double d_InnerOctoSize=AngleRatio*Hcal_inner_radius;//"d" + double LMin = 2*RPC_EdgeWidth+cell_sizeX*MinNumCellsInTransvPlane+(MinNumCellsInTransvPlane+1)*RPC_PadSeparation; + + double Ynl = 0.5*d_InnerOctoSize - Hcal_nlayers*layerThickness; + double Hcal_outer_radius = sqrt((LMin-Ynl)*(LMin-Ynl) + (hPrime + Hcal_nlayers*layerThickness)*(hPrime + Hcal_nlayers*layerThickness)); + if(Hcal_outer_radius!=Hcal_outer_radius_set){ + cout << "calculated Hcal_outer_radius != input, will impact HcalEndcap and HcalEndcapRing. Hcal_outer_radius = " << Hcal_outer_radius + << " but set as " << Hcal_outer_radius_set << " difference = " << Hcal_outer_radius-Hcal_outer_radius_set << endl; + } + + /// extent of the calorimeter in the r-z-plane [ rmin, rmax, zmin, zmax ] in cm. + caloData->extent[0] = Hcal_inner_radius ; + caloData->extent[1] = Hcal_outer_radius ; + caloData->extent[2] = 0. ; // Barrel zmin is "0" by default. + caloData->extent[3] = Hcal_half_length ; + + double Hcal_total_dim_y = Hcal_outer_radius - hPrime; + + // the y_dim1_for_z kept as the original value in TDR + double Hcal_regular_chamber_dim_z = Hcal_normal_dim_z - 2 *(Hcal_lateral_plate_thickness); + //int N_cells_z = static_cast <int> ( (Hcal_regular_chamber_dim_z - 2*RPC_EdgeWidth - RPC_PadSeparation) / (Hcal_cell_dim_x + RPC_PadSeparation) ); + // Hcal_cell_dim_z=(Hcal_regular_chamber_dim_z-RPC_PadSeparation )/N_cells_z + // - RPC_PadSeparation; + Tube solidCaloTube(0, Hcal_outer_radius, Hcal_half_length); + + PolyhedraRegular solidOctogon(8, 0, hPrime, 4*Hcal_half_length); + RotationZYX rotOctogon(dd4hep::twopi/16,0,0); + SubtractionSolid solidCalo(solidCaloTube, solidOctogon, rotOctogon); + Volume logicCalo(name+"_radiator", solidCalo, stavesMaterial); + logicCalo.setAttributes(theDetector,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + PlacedVolume calo_pv = envelope.placeVolume(logicCalo, Position(0,0,0)); + DetElement calo(det, "envelope", det_id); + calo.setPlacement(calo_pv); + + for(int layer_id=1; layer_id<=Hcal_nlayers; layer_id++){ + double yn = sqrt(Hcal_outer_radius*Hcal_outer_radius - (hPrime + layer_id*layerThickness)*(hPrime + layer_id*layerThickness)); + double Yn = 0.5*d_InnerOctoSize - layer_id*layerThickness; + + double halfX = Hcal_chamber_thickness/2.; + double halfZ = (yn+Yn)/2.; + + LayeredCalorimeterData::Layer caloLayer ; + caloLayer.cellSize0 = cell_sizeX; + caloLayer.cellSize1 = cell_sizeZ; + + //double halfY = Hcal_normal_dim_z / 2.; + double halfY = Hcal_regular_chamber_dim_z / 2.; + + double localXPos = hPrime + Hcal_radiator_thickness + Hcal_chamber_thickness/2. + (layer_id-1)*layerThickness; + double localYPos = -Yn + 0.5*(Yn + yn); + Box chamberSolid(halfX, halfY, halfZ); + string chamberLogical_name = name+_toString(layer_id,"_layer%d"); + Volume chamberLogical(chamberLogical_name, chamberSolid, air); + chamberLogical.setAttributes(theDetector, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr()); + + string layer_name = name+_toString(layer_id,"_layer%d"); + + double nRadiationLengths=0.; + double nInteractionLengths=0.; + double thickness_sum=0; + + nRadiationLengths = Hcal_radiator_thickness/(stavesMaterial.radLength()); + nInteractionLengths = Hcal_radiator_thickness/(stavesMaterial.intLength()); + + double slice_pos_z = -halfX; + int slice_number = 0; + for(xml_coll_t k(x_layer,_U(slice)); k; ++k) { + xml_comp_t x_slice = k; + if(x_slice.materialStr()==Hcal_radiator_material) continue; + string slice_name = layer_name + _toString(slice_number,"_slice%d"); + double slice_thickness = x_slice.thickness(); + Material slice_material = theDetector.material(x_slice.materialStr()); + if(layer_id==1) cout<<" Layer_slice: "<< slice_name<<" slice_thickness: "<< slice_thickness<< endl; + + slice_pos_z += slice_thickness/2.; + nRadiationLengths += slice_thickness/(2.*slice_material.radLength()); + nInteractionLengths += slice_thickness/(2.*slice_material.intLength()); + thickness_sum += slice_thickness/2; + + // Slice volume & box + Box sliceSolid(slice_thickness/2., halfY, halfZ); + Volume sliceVol(slice_name, sliceSolid, slice_material); + + if ( x_slice.isSensitive() ) { + sliceVol.setSensitiveDetector(sens); + if(RPC_EdgeWidth>0){ + double RPC_GazInlet_In_Y = halfY - RPC_EdgeWidth - RPCGazInletOuterRadius; + double RPC_GazInlet_In_Z = halfZ - RPC_EdgeWidth/2; + double RPC_GazInlet_Out_Y = -RPC_GazInlet_In_Y; + double RPC_GazInlet_Out_Z = RPC_GazInlet_In_Z; + + string mateialName = x_slice.attr<string>(_Unicode(edge_material)); + Material edge_material = theDetector.material(mateialName); + Box solidRPCEdge1(slice_thickness/2.,halfY, halfZ); + Box solidRPCEdge2(slice_thickness/2.,halfY-RPC_EdgeWidth, halfZ-RPC_EdgeWidth); + SubtractionSolid solidRPCEdge(solidRPCEdge1, solidRPCEdge2, Position(0,0,0)); + Volume logicRPCEdge(slice_name+"_edge", solidRPCEdge, edge_material); + logicRPCEdge.setAttributes(theDetector,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + sliceVol.placeVolume(logicRPCEdge); + + Tube solidRPCGazInlet(RPCGazInletInnerRadius,RPCGazInletOuterRadius,RPC_EdgeWidth/*RPCGazInletLength*//2); + Volume logicRPCGazInlet(slice_name+"_GazInlet", solidRPCGazInlet, edge_material); + logicRPCGazInlet.setAttributes(theDetector,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + logicRPCEdge.placeVolume(logicRPCGazInlet, Position(0,RPC_GazInlet_In_Y,RPC_GazInlet_In_Z)); + logicRPCEdge.placeVolume(logicRPCGazInlet, Position(0,RPC_GazInlet_Out_Y,RPC_GazInlet_Out_Z)); + + Tube solidRPCGazInsideInlet(0,RPCGazInletInnerRadius,RPC_EdgeWidth/*RPCGazInletLength*//2); + Volume logicRPCGazInsideInlet(slice_name+"_GazInsideInlet", solidRPCGazInsideInlet, slice_material); + logicRPCGazInsideInlet.setAttributes(theDetector,x_slice.regionStr(),x_slice.limitsStr(),"SeeThrough"); + logicRPCEdge.placeVolume(logicRPCGazInsideInlet, Position(0,RPC_GazInlet_In_Y,RPC_GazInlet_In_Z)); + logicRPCEdge.placeVolume(logicRPCGazInsideInlet, Position(0,RPC_GazInlet_Out_Y,RPC_GazInlet_Out_Z)); + } + if(Hcal_spacer_thickness>0){ + Tube solidRPCSpacer(0,Hcal_spacer_thickness/2,slice_thickness/2); + Material space_material = theDetector.material(x_slice.attr<string>(_Unicode(spacer_material))); + Volume logicRPCSpacer(slice_name+"_spacer", solidRPCSpacer, space_material); + logicRPCSpacer.setAttributes(theDetector,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + RotationZYX rotSpacer(0, pi/2., 0); + + double gap_hZ = halfZ-RPC_EdgeWidth; + double gap_hY = halfY-RPC_EdgeWidth; + int y_number_of_separations = (int)(2*gap_hY/Hcal_spacer_separation); + int z_number_of_separations = (int)(2*gap_hZ/Hcal_spacer_separation); + double y_lateral_space = (2*gap_hY - y_number_of_separations*Hcal_spacer_separation)/2; + double z_lateral_space = (2*gap_hZ - z_number_of_separations*Hcal_spacer_separation)/2; + if(y_lateral_space < Hcal_spacer_thickness/2.){ + y_number_of_separations = (int)((2*gap_hY-Hcal_spacer_thickness)/Hcal_spacer_separation); + y_lateral_space = (2*gap_hY - y_number_of_separations*Hcal_spacer_separation)/2; + } + if(z_lateral_space < Hcal_spacer_thickness/2.){ + z_number_of_separations = (int)((2*gap_hZ-Hcal_spacer_thickness)/Hcal_spacer_separation); + z_lateral_space = (2*gap_hZ - z_number_of_separations*Hcal_spacer_separation)/2; + } + for(int y_counter = 0; y_counter <=y_number_of_separations; y_counter++){ + double SpacerY = gap_hY - y_lateral_space - y_counter*Hcal_spacer_separation; + for(int z_counter = 0; z_counter <=z_number_of_separations; z_counter++){ + double SpacerZ = gap_hZ - z_lateral_space - z_counter*Hcal_spacer_separation; + PlacedVolume space_pv = sliceVol.placeVolume(logicRPCSpacer, Transform3D(rotSpacer, Position(0,SpacerY,SpacerZ))); + } + } + } + + caloLayer.inner_nRadiationLengths = nRadiationLengths; + caloLayer.inner_nInteractionLengths = nInteractionLengths; + caloLayer.inner_thickness = thickness_sum; + if(layer_id==1) cout<<"Hcal_Barrel: inner_thickness= "<<thickness_sum<<endl; + //Store readout gasgap thickness + caloLayer.sensitive_thickness = slice_thickness; + //Reset counters to measure "outside" quantitites + nRadiationLengths=0.; + nInteractionLengths=0.; + thickness_sum = 0.; + + sliceVol.setAttributes(theDetector,x_slice.regionStr(),x_slice.limitsStr(),"SeeThrough"); + } + else{ + sliceVol.setAttributes(theDetector,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + } + nRadiationLengths += slice_thickness/(2.*slice_material.radLength()); + nInteractionLengths += slice_thickness/(2.*slice_material.intLength()); + thickness_sum += slice_thickness/2; + + // slice PlacedVolume + PlacedVolume slice_phv = chamberLogical.placeVolume(sliceVol,Position(slice_pos_z,0,0)); + if ( x_slice.isSensitive() ) { + int slice_id = (layer_id > Hcal_nlayers)? 1:-1; + slice_phv.addPhysVolID("layer",layer_id).addPhysVolID("slice",slice_id); + } + DetElement sliceDetE(layer_name,_toString(slice_number,"slice%d"),x_det.id()); + sliceDetE.setPlacement(slice_phv); + // Increment x position for next slice. + slice_pos_z += slice_thickness/2.; + // Increment slice number. + ++slice_number; + } + caloLayer.outer_nRadiationLengths = nRadiationLengths; + caloLayer.outer_nInteractionLengths = nInteractionLengths; + caloLayer.outer_thickness = thickness_sum; + if(layer_id==1) cout << "Hcal_Barrel: outer_thickness= " << thickness_sum << endl; + + double chamber_y_offset = -(-Hcal_total_dim_y/2. + (layer_id-1)*layerThickness + layerThickness/2.); + + caloLayer.distance = Hcal_inner_radius + Hcal_total_dim_y/2.0 + chamber_y_offset ; + caloLayer.absorberThickness = Hcal_radiator_thickness ; + + caloData->layers.push_back( caloLayer ) ; + + double stave_phi_offset, module_z_offset; + + stave_phi_offset = pi*0.5; + for(int stave_id = 1; stave_id <= 8; stave_id++){ + double phirot = stave_phi_offset+(stave_id-1)*pi/4.; + + RotationZYX rot(0, phirot, pi*0.5); + RotationZYX rotInverse(0,-phirot, -pi*0.5); + for(int module_id = 1; module_id <= Hcal_barrel_number_modules; module_id++){ + module_z_offset = - Hcal_half_length + Hcal_normal_dim_z/2. + (module_id-1)*(Hcal_normal_dim_z+Hcal_modules_gap); + + Position localPos(localXPos,-module_z_offset,localYPos); + Position newPos = rotInverse*localPos; + Transform3D tran3D(rot, newPos); + PlacedVolume pv = logicCalo.placeVolume(chamberLogical, tran3D); + pv.addPhysVolID("stave",stave_id).addPhysVolID("module",module_id).addPhysVolID("layer",layer_id); + DetElement layer(calo, name+_toString(stave_id,"_stave%d")+_toString(module_id,"_module%d")+_toString(layer_id,"_layer%d"), det_id); + layer.setPlacement(pv); + } + } + } + + det.addExtension< LayeredCalorimeterData >( caloData ) ; + + return det; +} + +DECLARE_DETELEMENT(SHcalRpc01_Barrel, create_detector) diff --git a/Detector/DetCEPCv4/src/calorimeter/SHcalRpc01_EndcapRing.cpp b/Detector/DetCEPCv4/src/calorimeter/SHcalRpc01_EndcapRing.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3a9978cc85833ad6807f55cbaae2fd9d74d3656d --- /dev/null +++ b/Detector/DetCEPCv4/src/calorimeter/SHcalRpc01_EndcapRing.cpp @@ -0,0 +1,266 @@ +//==================================================================== +// SHcalRpc01 - Implementation from ILCSoft's Mokka version +//==================================================================== +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/DD4hepUnits.h" +#include "DD4hep/DetType.h" + +#include "DDRec/Surface.h" +#include "DDRec/DetectorData.h" +#include "XML/Utilities.h" + +using namespace std; + +using dd4hep::Ref_t; +using dd4hep::BUILD_ENVELOPE; +using dd4hep::DetElement; +using dd4hep::Detector; +using dd4hep::SensitiveDetector; +using dd4hep::Segmentation; +using dd4hep::Readout; +using dd4hep::Material; +using dd4hep::Volume; +using dd4hep::PlacedVolume; +using dd4hep::Position; +using dd4hep::RotationZYX; +using dd4hep::Transform3D; +using dd4hep::Box; +using dd4hep::Tube; +using dd4hep::PolyhedraRegular; +using dd4hep::SubtractionSolid; +using dd4hep::IntersectionSolid; +using dd4hep::_toString; +using dd4hep::pi; +using dd4hep::rec::LayeredCalorimeterData; + +/** Construction of SHcalRpc01 detector, ported from Mokka driver SHcalRpc01.cc + * + * Mokka History: + * - first implementation from ILCSoft + * - http://cepcgit.ihep.ac.cn/cepcsoft/MokkaC + */ +static Ref_t create_detector(Detector& theDetector, xml_h element, SensitiveDetector sens) { + cout << "------------------------------" << endl; + cout << "creating SHcalRpc01_EndcapRing" << endl; + cout << "------------------------------" << endl; + + xml_det_t x_det = element; + string name = x_det.nameStr(); + + int det_id = x_det.id(); + DetElement det(name, det_id) ; + + xml_comp_t x_staves = x_det.staves(); + string Hcal_radiator_material = x_staves.materialStr(); + Material stavesMaterial = theDetector.material(Hcal_radiator_material); + Material air = theDetector.air(); + + Volume envelope = dd4hep::xml::createPlacedEnvelope( theDetector, element , det ) ; + + dd4hep::xml::setDetectorTypeFlag( element, det ) ; + + if( theDetector.buildType() == BUILD_ENVELOPE ) return det ; + + sens.setType("calorimeter"); + + DetElement module(det,"module0",det_id); + DetElement layer(module, "stave_layer", det_id); + DetElement slice(layer, "slice", det_id); + + Readout readout = sens.readout(); + Segmentation seg = readout.segmentation(); + + std::vector<double> cellSizeVector = seg.segmentation()->cellDimensions(0); + double cell_sizeX = cellSizeVector[0]; + double cell_sizeY = cellSizeVector[1]; + + double Hcal_outer_radius = theDetector.constant<double>("Hcal_outer_radius"); + int Hcal_endcap_outer_symmetry = theDetector.constant<int>("Hcal_endcap_outer_symmetry"); + double Hcal_stave_gaps = theDetector.constant<double>("Hcal_stave_gaps"); + int Hcal_nlayers = theDetector.constant<int>("Hcal_endcap_nlayers"); + double Hcal_start_z = theDetector.constant<double>("Hcal_endcap_zmin"); + double Hcal_lateral_plate_thickness = theDetector.constant<double>("Hcal_lateral_structure_thickness"); + double Ecal_endcap_zmin = theDetector.constant<double>("Ecal_endcap_zmin"); + double Hcal_endcap_ecal_gap = theDetector.constant<double>("Hcal_endcap_ecal_gap"); + double Ecal_endcap_outer_radius = theDetector.constant<double>("EcalEndcap_outer_radius"); + double Hcal_radial_ring_inner_gap = theDetector.constant<double>("Hcal_radial_ring_inner_gap"); + + xml_coll_t c(x_det,_U(layer)); + xml_comp_t x_layer = c; + + double Hcal_radiator_thickness = 0; + double layerThickness = 0.0; + for(xml_coll_t k(x_layer,_U(slice)); k; ++k) { + xml_comp_t x_slice = k; + layerThickness += x_slice.thickness(); + if(x_slice.materialStr()==Hcal_radiator_material) Hcal_radiator_thickness = x_slice.thickness(); + } + cout << " layer_thickness (from slices) = " << layerThickness << " and radiator_thickness = " << Hcal_radiator_thickness << endl; + double Hcal_chamber_thickness = layerThickness - Hcal_radiator_thickness; + + int numSide = Hcal_endcap_outer_symmetry; + double Hcal_endcap_rmax = Hcal_outer_radius * cos(pi/numSide); + + LayeredCalorimeterData* caloData = new LayeredCalorimeterData ; + caloData->layoutType = LayeredCalorimeterData::EndcapLayout ; + caloData->inner_symmetry = numSide; + caloData->outer_symmetry = numSide; + caloData->phi0 = 0; + + double start_z = Ecal_endcap_zmin; + double SpaceForLayers = Hcal_start_z - Hcal_endcap_ecal_gap - Ecal_endcap_zmin - 2*Hcal_lateral_plate_thickness; + int MaxNumberOfLayers = (int)(SpaceForLayers / (Hcal_chamber_thickness + Hcal_radiator_thickness)); + double stop_z = start_z + MaxNumberOfLayers*layerThickness + 2*Hcal_lateral_plate_thickness; + + double pRMax = Hcal_endcap_rmax; + double pDz = (stop_z - start_z)/2.; + double pRMin = Ecal_endcap_outer_radius + Hcal_radial_ring_inner_gap; + + cout << "Rings will have " << MaxNumberOfLayers << " layers." << endl; + cout << " Z: " << start_z << " -> " << stop_z << endl; + cout << " R: " << pRMin << " -> " << pRMax << endl; + + caloData->extent[0] = pRMin; + caloData->extent[1] = pRMax; + caloData->extent[2] = start_z; + caloData->extent[3] = stop_z; + + PolyhedraRegular EndCapRingSolidPoly(numSide, -pi/numSide, pRMin, pRMax, 2*pDz); + Volume EndCapRingLogical(name+"_radiator", EndCapRingSolidPoly, stavesMaterial); + EndCapRingLogical.setAttributes(theDetector,x_staves.regionStr(),x_staves.limitsStr(),x_staves.visStr()); + + int number_of_chambers = Hcal_nlayers; + if(MaxNumberOfLayers < number_of_chambers) number_of_chambers = MaxNumberOfLayers; + + double rInner = pRMin + Hcal_lateral_plate_thickness; + double rOuter = pRMax - Hcal_lateral_plate_thickness; + + PolyhedraRegular EndCapRingChamberPoly(numSide, -pi/numSide, rInner, rOuter, Hcal_chamber_thickness); + Box IntersectionStaveBox(rOuter/2., rOuter/2., Hcal_chamber_thickness/2); + Position IntersectPos(rOuter/2. + Hcal_stave_gaps/2., rOuter/2. + Hcal_stave_gaps/2., 0.); + IntersectionSolid EndCapRingStaveSolid(EndCapRingChamberPoly, IntersectionStaveBox, IntersectPos); + Volume EndCapRingChamberLogical(name+"_chamber", EndCapRingStaveSolid, air); + EndCapRingChamberLogical.setAttributes(theDetector,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); + + double nRadiationLengthsInside=0.; + double nInteractionLengthsInside=0.; + double inner_thickness=0; + double sensitive_thickness=0; + double nRadiationLengths=0.; + double nInteractionLengths=0.; + double thickness_sum=0; + + double slice_pos_z = -Hcal_chamber_thickness/2.; + int slice_number = 0; + for(xml_coll_t k(x_layer,_U(slice)); k; ++k) { + xml_comp_t x_slice = k; + string slice_name = name + _toString(slice_number,"_slice%d"); + double slice_thickness = x_slice.thickness(); + Material slice_material = theDetector.material(x_slice.materialStr()); + cout<<" Layer_slice: " << slice_name << " slice_thickness: " << slice_thickness<< endl; + + nRadiationLengths += slice_thickness/(2.*slice_material.radLength()); + nInteractionLengths += slice_thickness/(2.*slice_material.intLength()); + thickness_sum += slice_thickness/2; + if(x_slice.materialStr()==Hcal_radiator_material) continue; + + slice_pos_z += slice_thickness/2.; + + PolyhedraRegular slicePoly(numSide, -pi/numSide, rInner, rOuter, slice_thickness); + IntersectionSolid sliceStaveSolid(slicePoly, IntersectionStaveBox, IntersectPos); + Volume sliceVol(name + _toString(slice_number,"_slice%d"), sliceStaveSolid, slice_material); + sliceVol.setAttributes(theDetector,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + if(x_slice.isSensitive()){ + sliceVol.setSensitiveDetector(sens); + nRadiationLengthsInside = nRadiationLengths; + nInteractionLengthsInside = nInteractionLengths; + inner_thickness = thickness_sum; + sensitive_thickness = slice_thickness; + + nRadiationLengths=0.; + nInteractionLengths=0.; + thickness_sum = 0.; + } + + nRadiationLengths += slice_thickness/(2.*slice_material.radLength()); + nInteractionLengths += slice_thickness/(2.*slice_material.intLength()); + thickness_sum += slice_thickness/2; + // slice PlacedVolume + PlacedVolume slice_phv = EndCapRingChamberLogical.placeVolume(sliceVol,Position(0,0,slice_pos_z)); + //DetElement slice(layer_name,_toString(slice_number,"slice%d"),x_det.id()); + slice.setPlacement(slice_phv); + // Increment x position for next slice. + slice_pos_z += slice_thickness/2.; + // Increment slice number. + ++slice_number; + } + + // chamber placements + for(int stave_id = 1; stave_id <= 4; stave_id++){ + double angle = pi/2.*(stave_id-1); + RotationZYX lrot(angle,0,0); + for (int layer_id = 1; layer_id <= number_of_chambers; layer_id++){ + double Zoff = -pDz + (layer_id-1)*layerThickness + Hcal_radiator_thickness + Hcal_chamber_thickness/2.; + Position l_pos(0., 0., Zoff); + Position l_new = lrot*l_pos; + Transform3D ltran3D(lrot,l_new); + PlacedVolume layer_phv = EndCapRingLogical.placeVolume(EndCapRingChamberLogical, ltran3D); + layer_phv.addPhysVolID("layer",layer_id); + layer_phv.addPhysVolID("stave",stave_id); + + //string l_name = _toString(layer_id,"layer%d"); + //string stave_name = _toString(stave_id,"stave%d"); + //DetElement layer(module_det, l_name+stave_name, det_id); + layer.setPlacement(layer_phv); + + if(stave_id==1&&layer_id==1){ + cout << "Hcal_EndcapRing: inner_thickness= " << inner_thickness << endl; + cout << "Hcal_EndcapRing: outer_thickness= " << thickness_sum << endl; + } + LayeredCalorimeterData::Layer caloLayer ; + caloLayer.cellSize0 = cell_sizeX; + caloLayer.cellSize1 = cell_sizeY; + caloLayer.inner_nRadiationLengths = nRadiationLengthsInside; + caloLayer.inner_nInteractionLengths = nInteractionLengthsInside; + caloLayer.inner_thickness = inner_thickness; + caloLayer.sensitive_thickness = sensitive_thickness; + caloLayer.outer_nRadiationLengths = nRadiationLengths; + caloLayer.outer_nInteractionLengths = nInteractionLengths; + caloLayer.outer_thickness = thickness_sum; + + caloLayer.distance = start_z + (layer_id-1)*layerThickness; + caloLayer.absorberThickness = Hcal_radiator_thickness ; + + caloData->layers.push_back( caloLayer ) ; + } + } + + // Placements + double endcap_z_offset = start_z + pDz; + for(int side = 0; side <= 1; side++){ + int module_id = (side==0) ? 0 : 6; + double this_module_z_offset = (side==0) ? endcap_z_offset : -endcap_z_offset; + // use reflect volume for z<0, therefore, same rotation + // segmentation violation happen if EndCapRingLogical.reflect(), back to rotate Y + // double this_module_rotY = (side==0) ? 0.0 : 0.0; + double this_module_rotY = (side==0) ? 0.0 : pi; + //double this_module_rotZ = (side==0) ? pi/8. : pi/8; + RotationZYX rot(0,this_module_rotY,0); + Transform3D tran3D(rot,Position(0,0,this_module_z_offset)); + + PlacedVolume module_phv; + //if(side==0) module_phv = envelope.placeVolume(EndCapRingLogical, tran3D); + //else module_phv = envelope.placeVolume(EndCapRingLogical.reflect(), tran3D); + module_phv = envelope.placeVolume(EndCapRingLogical, tran3D); + + module_phv.addPhysVolID("module", module_id); + //DetElement sd = (module_id==0) ? module_det : module_det.clone(_toString(side,"module%d")); + module.setPlacement(module_phv); + } + + det.addExtension<LayeredCalorimeterData>(caloData) ; + + return det; +} + +DECLARE_DETELEMENT(SHcalRpc01_EndcapRing, create_detector) diff --git a/Detector/DetCEPCv4/src/calorimeter/SHcalRpc01_Endcaps.cpp b/Detector/DetCEPCv4/src/calorimeter/SHcalRpc01_Endcaps.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e55eb4722038d9f9879659d71f407b0e79313df1 --- /dev/null +++ b/Detector/DetCEPCv4/src/calorimeter/SHcalRpc01_Endcaps.cpp @@ -0,0 +1,275 @@ +//==================================================================== +// SHcalRpc01 - Implementation from ILCSoft's Mokka version +//==================================================================== +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/DD4hepUnits.h" +#include "DD4hep/DetType.h" + +#include "DDRec/Surface.h" +#include "DDRec/DetectorData.h" +#include "XML/Utilities.h" + +using namespace std; + +using dd4hep::Ref_t; +using dd4hep::BUILD_ENVELOPE; +using dd4hep::DetElement; +using dd4hep::Detector; +using dd4hep::SensitiveDetector; +using dd4hep::Segmentation; +using dd4hep::Readout; +using dd4hep::Material; +using dd4hep::Volume; +using dd4hep::PlacedVolume; +using dd4hep::Position; +using dd4hep::RotationZYX; +using dd4hep::Transform3D; +using dd4hep::Box; +using dd4hep::Tube; +using dd4hep::PolyhedraRegular; +using dd4hep::SubtractionSolid; +using dd4hep::IntersectionSolid; +using dd4hep::_toString; +using dd4hep::pi; +using dd4hep::rec::LayeredCalorimeterData; + +/** Construction of SHcalRpc01 detector, ported from Mokka driver SHcalRpc01.cc + * + * Mokka History: + * - first implementation from ILCSoft + * - http://cepcgit.ihep.ac.cn/cepcsoft/MokkaC + */ +static Ref_t create_detector(Detector& theDetector, xml_h element, SensitiveDetector sens) { + cout << "--------------------------" << endl; + cout << "creating SHcalRpc01_Endcap" << endl; + cout << "--------------------------" << endl; + + xml_det_t x_det = element; + string name = x_det.nameStr(); + + int det_id = x_det.id(); + DetElement det(name, det_id) ; + + xml_comp_t x_staves = x_det.staves(); + string Hcal_radiator_material = x_staves.materialStr(); + Material stavesMaterial = theDetector.material(Hcal_radiator_material); + Material air = theDetector.air(); + + Volume envelope = dd4hep::xml::createPlacedEnvelope( theDetector, element , det ) ; + + dd4hep::xml::setDetectorTypeFlag( element, det ) ; + + if( theDetector.buildType() == BUILD_ENVELOPE ) return det ; + + sens.setType("calorimeter"); + + DetElement module(det,"module0",det_id); + DetElement layer(module, "stave_layer", det_id); + DetElement slice(layer, "slice", det_id); + + Readout readout = sens.readout(); + Segmentation seg = readout.segmentation(); + + std::vector<double> cellSizeVector = seg.segmentation()->cellDimensions(0); + double cell_sizeX = cellSizeVector[0]; + double cell_sizeY = cellSizeVector[1]; + + //double Hcal_inner_radius = theDetector.constant<double>("Hcal_inner_radius"); + double Hcal_outer_radius = theDetector.constant<double>("Hcal_outer_radius"); + //double Hcal_half_length = theDetector.constant<double>("Hcal_half_length"); + int Hcal_endcap_outer_symmetry = theDetector.constant<int>("Hcal_endcap_outer_symmetry"); + //double Hcal_cells_size = theDetector.constant<double>("Hcal_cells_size"); + double Hcal_stave_gaps = theDetector.constant<double>("Hcal_stave_gaps"); + int Hcal_nlayers = theDetector.constant<int>("Hcal_endcap_nlayers"); + double Hcal_start_z = theDetector.constant<double>("Hcal_endcap_zmin"); + double Hcal_end_z = theDetector.constant<double>("HcalEndcap_max_z"); + double Hcal_back_plate_thickness = theDetector.constant<double>("Hcal_back_plate_thickness"); + double Hcal_lateral_plate_thickness = theDetector.constant<double>("Hcal_lateral_structure_thickness"); + double Hcal_endcap_center_box_size = theDetector.constant<double>("Hcal_endcap_center_box_size"); + + xml_coll_t c(x_det,_U(layer)); + xml_comp_t x_layer = c; + + double Hcal_radiator_thickness = 0; + double layerThickness = 0.0; + for(xml_coll_t k(x_layer,_U(slice)); k; ++k) { + xml_comp_t x_slice = k; + layerThickness += x_slice.thickness(); + if(x_slice.materialStr()==Hcal_radiator_material) Hcal_radiator_thickness = x_slice.thickness(); + } + cout << " layer_thickness (from slices) = " << layerThickness << " and radiator_thickness = " << Hcal_radiator_thickness << endl; + double Hcal_chamber_thickness = layerThickness - Hcal_radiator_thickness; + + int numSide = Hcal_endcap_outer_symmetry; + double Hcal_endcap_thickness = Hcal_nlayers*layerThickness + Hcal_back_plate_thickness; + double Hcal_endcap_rmax = Hcal_outer_radius * cos(pi/numSide); + cout << " module thickness = " << Hcal_endcap_thickness << endl; + if(Hcal_end_z!=Hcal_start_z+Hcal_endcap_thickness){ + cout << "Hcal_end_z input != Hcal_start_z + Hcal_endcap_thickness: " << "Hcal_end_z=" << Hcal_end_z + << " but Hcal_start_z=" << Hcal_start_z << " and calculate as " << Hcal_start_z+Hcal_endcap_thickness << endl; + } + + LayeredCalorimeterData* caloData = new LayeredCalorimeterData; + caloData->layoutType = LayeredCalorimeterData::EndcapLayout; + caloData->inner_symmetry = 4; + caloData->outer_symmetry = Hcal_endcap_outer_symmetry; + caloData->phi0 = 0; + + caloData->extent[0] = Hcal_endcap_center_box_size/2.; + caloData->extent[1] = Hcal_outer_radius; + caloData->extent[2] = Hcal_start_z; + caloData->extent[3] = Hcal_start_z+Hcal_endcap_thickness; + + double pRMax = Hcal_endcap_rmax; + double pDz = Hcal_endcap_thickness/2.; + double pRMin = Hcal_endcap_center_box_size/2.; + + PolyhedraRegular EndCapSolidPoly(numSide, -pi/numSide, 0., pRMax, 2*pDz); + Box hcalECInnerHole(pRMin, pRMin, pDz); + SubtractionSolid solidHCalEC(EndCapSolidPoly,hcalECInnerHole); + Volume EndCapLogical(name+"_radiator", solidHCalEC, stavesMaterial); + EndCapLogical.setAttributes(theDetector,x_staves.regionStr(),x_staves.limitsStr(),x_staves.visStr()); + + int number_of_chambers = Hcal_nlayers; + int possible_number_of_chambers = (int) (floor(abs(Hcal_endcap_thickness-Hcal_back_plate_thickness) / (Hcal_chamber_thickness + Hcal_radiator_thickness))); + if(possible_number_of_chambers < number_of_chambers) number_of_chambers = possible_number_of_chambers; + + double rInner = 0.; + double rOuter= Hcal_endcap_rmax - Hcal_lateral_plate_thickness; + + PolyhedraRegular EndCapChamberPoly(numSide, -pi/numSide, rInner, rOuter, Hcal_chamber_thickness); + Box hcalECChamberInnerHole(pRMin + Hcal_lateral_plate_thickness, pRMin + Hcal_lateral_plate_thickness, Hcal_chamber_thickness/2); + SubtractionSolid EndCapChamberSolid(EndCapChamberPoly, hcalECChamberInnerHole); + Box IntersectionStaveBox(rOuter/2., rOuter/2., Hcal_chamber_thickness/2); + Position pos(rOuter/2. + Hcal_stave_gaps/2., rOuter/2. + Hcal_stave_gaps/2., 0.); + Position IntersectPos = pos; + IntersectionSolid EndCapStaveSolid(EndCapChamberSolid, IntersectionStaveBox, IntersectPos); + Volume EndCapChamberLogical(name+"_chamber", EndCapStaveSolid, air); + EndCapChamberLogical.setAttributes(theDetector,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr()); + + double nRadiationLengthsInside=0.; + double nInteractionLengthsInside=0.; + double inner_thickness=0; + double sensitive_thickness=0; + double nRadiationLengths=0.; + double nInteractionLengths=0.; + double thickness_sum=0; + + double slice_pos_z = -Hcal_chamber_thickness/2.; + int slice_number = 0; + for(xml_coll_t k(x_layer,_U(slice)); k; ++k) { + xml_comp_t x_slice = k; + string slice_name = name + _toString(slice_number,"_slice%d"); + double slice_thickness = x_slice.thickness(); + Material slice_material = theDetector.material(x_slice.materialStr()); + cout<<" Layer_slice: " << slice_name << " slice_thickness: " << slice_thickness<< endl; + + nRadiationLengths += slice_thickness/(2.*slice_material.radLength()); + nInteractionLengths += slice_thickness/(2.*slice_material.intLength()); + thickness_sum += slice_thickness/2; + if(x_slice.materialStr()==Hcal_radiator_material) continue; + + slice_pos_z += slice_thickness/2.; + + PolyhedraRegular slicePoly(numSide, -pi/numSide, rInner, rOuter, slice_thickness); + SubtractionSolid sliceSolid(slicePoly, hcalECChamberInnerHole); + IntersectionSolid sliceStaveSolid(sliceSolid, IntersectionStaveBox, IntersectPos); + + Volume sliceVol(name + _toString(slice_number,"_slice%d"), sliceStaveSolid, slice_material); + sliceVol.setAttributes(theDetector,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + if(x_slice.isSensitive()){ + sliceVol.setSensitiveDetector(sens); + nRadiationLengthsInside = nRadiationLengths; + nInteractionLengthsInside = nInteractionLengths; + inner_thickness = thickness_sum; + sensitive_thickness = slice_thickness; + + nRadiationLengths=0.; + nInteractionLengths=0.; + thickness_sum = 0.; + } + + nRadiationLengths += slice_thickness/(2.*slice_material.radLength()); + nInteractionLengths += slice_thickness/(2.*slice_material.intLength()); + thickness_sum += slice_thickness/2; + // slice PlacedVolume + PlacedVolume slice_phv = EndCapChamberLogical.placeVolume(sliceVol,Position(0,0,slice_pos_z)); + //DetElement slice(layer_name,_toString(slice_number,"slice%d"),x_det.id()); + slice.setPlacement(slice_phv); + // Increment x position for next slice. + slice_pos_z += slice_thickness/2.; + // Increment slice number. + ++slice_number; + } + + if(possible_number_of_chambers < number_of_chambers) number_of_chambers = possible_number_of_chambers; + // chamber placements + for(int stave_id = 1; stave_id <= 4; stave_id++){ + double angle = pi/2.*(stave_id-1); + //RotationZ lrotz(angle); + RotationZYX lrot(angle,0,0); + for (int layer_id = 1; layer_id <= number_of_chambers; layer_id++){ + double Zoff = -Hcal_endcap_thickness/2. + (layer_id-1) *(Hcal_chamber_thickness + Hcal_radiator_thickness) + Hcal_radiator_thickness + Hcal_chamber_thickness/2.; + Position l_pos(0., 0., Zoff); + Position l_new = lrot*l_pos; + Transform3D ltran3D(lrot,l_new); + PlacedVolume layer_phv = EndCapLogical.placeVolume(EndCapChamberLogical, ltran3D); + layer_phv.addPhysVolID("layer",layer_id); + layer_phv.addPhysVolID("stave",stave_id); + + //string l_name = _toString(layer_id,"layer%d"); + //string stave_name = _toString(stave_id,"stave%d"); + //DetElement layer(module_det, l_name+stave_name, det_id); + layer.setPlacement(layer_phv); + + if(stave_id==1&&layer_id==1){ + cout << "Hcal_Endcap: inner_thickness= " << inner_thickness << endl; + cout << "Hcal_Endcap: outer_thickness= " << thickness_sum << endl; + } + LayeredCalorimeterData::Layer caloLayer ; + caloLayer.cellSize0 = cell_sizeX; + caloLayer.cellSize1 = cell_sizeY; + caloLayer.inner_nRadiationLengths = nRadiationLengthsInside; + caloLayer.inner_nInteractionLengths = nInteractionLengthsInside; + caloLayer.inner_thickness = inner_thickness; + caloLayer.sensitive_thickness = sensitive_thickness; + caloLayer.outer_nRadiationLengths = nRadiationLengths; + caloLayer.outer_nInteractionLengths = nInteractionLengths; + caloLayer.outer_thickness = thickness_sum; + + caloLayer.distance = Hcal_start_z + (layer_id-1)*layerThickness; + caloLayer.absorberThickness = Hcal_radiator_thickness ; + + caloData->layers.push_back( caloLayer ) ; + } + } + + // Placements + double endcap_z_offset = Hcal_start_z + Hcal_endcap_thickness/2.; + for(int side = 0; side <= 1; side++){ + int module_id = (side==0) ? 0 : 6; + double this_module_z_offset = (side==0) ? endcap_z_offset : -endcap_z_offset; + // use reflect volume for z<0, therefore, same rotation + // segmentation violation happen if EndCapRingLogical.reflect(), back to rotate Y + // double this_module_rotY = (side==0) ? 0.0 : 0.0; + double this_module_rotY = (side==0) ? 0.0 : pi; + //double this_module_rotZ = (side==0) ? pi/8. : pi/8; + RotationZYX rot(0,this_module_rotY,0); + Transform3D tran3D(rot,Position(0,0,this_module_z_offset)); + + PlacedVolume module_phv; + //if(side==0) module_phv = envelope.placeVolume(EndCapRingLogical, tran3D); + //else module_phv = envelope.placeVolume(EndCapRingLogical.reflect(), tran3D); + module_phv = envelope.placeVolume(EndCapLogical, tran3D); + + module_phv.addPhysVolID("module", module_id); + //DetElement sd = (module_id==0) ? module_det : module_det.clone(_toString(side,"module%d")); + module.setPlacement(module_phv); + } + + det.addExtension<LayeredCalorimeterData>(caloData) ; + + return det; +} + +DECLARE_DETELEMENT(SHcalRpc01_Endcaps, create_detector) diff --git a/Detector/DetCEPCv4/src/calorimeter/Yoke05_Barrel.cpp b/Detector/DetCEPCv4/src/calorimeter/Yoke05_Barrel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7eac4ee59c8628447dd56d335e800d47cf2b5b9a --- /dev/null +++ b/Detector/DetCEPCv4/src/calorimeter/Yoke05_Barrel.cpp @@ -0,0 +1,429 @@ +//==================================================================== +// lcgeo - LC detector models in DD4hep +//-------------------------------------------------------------------- +// DD4hep Geometry driver for YokeBarrel +// Ported from Mokka +//-------------------------------------------------------------------- +// S.Lu, DESY +// $Id$ +//==================================================================== +// ********************************************************* +// * Mokka * +// * -- A Detailed Geant 4 Simulation for the ILC -- * +// * * +// * polywww.in2p3.fr/geant4/tesla/www/mokka/mokka.html * +// ********************************************************* +// +// $Id$ +// $Name: $ +// +// History: +// - first implementation P. Mora de Freitas (May 2001) +// - selectable symmetry, self-scaling, removed pole tips +// - Adrian Vogel, 2006-03-17 +// - muon system plus +// instrumented pole tip back for TESLA models +// - Predrag Krstonosic , 2006-08-30 +// - added barrelEndcapGap, gear parameters, made barrel +// and endcap same thickness, made plug insensitive, +// - F.Gaede, DESY 2008-10-04 +// + +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/DetType.h" +#include "XML/Layering.h" +#include "TGeoTrd2.h" +#include "XML/Utilities.h" +#include "DDRec/DetectorData.h" + +using namespace std; + +using dd4hep::BUILD_ENVELOPE; +using dd4hep::Box; +using dd4hep::DetElement; +using dd4hep::DetType; +using dd4hep::Detector; +using dd4hep::Layering; +using dd4hep::Material; +using dd4hep::PlacedVolume; +using dd4hep::PolyhedraRegular; +using dd4hep::Position; +using dd4hep::Readout; +using dd4hep::Ref_t; +using dd4hep::Rotation3D; +using dd4hep::RotationZYX; +using dd4hep::Segmentation; +using dd4hep::SensitiveDetector; +using dd4hep::Transform3D; +using dd4hep::Volume; +using dd4hep::_toString; + +using dd4hep::rec::LayeredCalorimeterData; + +#define VERBOSE 1 + +// workaround for DD4hep v00-14 (and older) +#ifndef DD4HEP_VERSION_GE +#define DD4HEP_VERSION_GE(a,b) 0 +#endif + +static Ref_t create_detector(Detector& theDetector, xml_h element, SensitiveDetector sens) { + static double tolerance = 0e0; + + xml_det_t x_det = element; + string det_name = x_det.nameStr(); + Layering layering (element); + + xml_comp_t x_dim = x_det.dimensions(); + int nsides = x_dim.numsides(); + + Material air = theDetector.air(); + + xml_comp_t x_staves = x_det.staves(); + Material yokeMaterial = theDetector.material(x_staves.materialStr()); + + //unused: Material env_mat = theDetector.material(x_dim.materialStr()); + + xml_comp_t env_pos = x_det.position(); + xml_comp_t env_rot = x_det.rotation(); + + Position pos(env_pos.x(),env_pos.y(),env_pos.z()); + RotationZYX rotZYX(env_rot.z(),env_rot.y(),env_rot.x()); + + Transform3D tr(rotZYX,pos); + + int det_id = x_det.id(); + DetElement sdet (det_name,det_id); + + // --- create an envelope volume and position it into the world --------------------- + + Volume envelope = dd4hep::xml::createPlacedEnvelope( theDetector, element , sdet ) ; + + dd4hep::xml::setDetectorTypeFlag( element, sdet ) ; + + if( theDetector.buildType() == BUILD_ENVELOPE ) return sdet ; + + //----------------------------------------------------------------------------------- + + sens.setType("calorimeter"); + + +//==================================================================== +// +// Read all the constant from ILD_o1_v05.xml +// Use them to build Yoke05Barrel +// +//==================================================================== + double Yoke_barrel_inner_radius = theDetector.constant<double>("Yoke_barrel_inner_radius"); + //double Yoke_thickness = theDetector.constant<double>("Yoke_thickness"); + //double Yoke_Barrel_Half_Z = theDetector.constant<double>("Yoke_Barrel_Half_Z"); + double Yoke_Z_start_endcaps = theDetector.constant<double>("Yoke_Z_start_endcaps"); + //double Yoke_cells_size = theDetector.constant<double>("Yoke_cells_size"); + + //Database *db = new Database(env.GetDBName()); + //db->exec("SELECT * FROM `yoke`;"); + //db->getTuple(); + ////... Geometry parameters from the environment and from the database + //symmetry = db->fetchInt("symmetry"); + //const G4double rInnerBarrel = + // env.GetParameterAsDouble("Yoke_barrel_inner_radius"); + //const G4double rInnerEndcap = + // env.GetParameterAsDouble("Yoke_endcap_inner_radius"); + //const G4double zStartEndcap = + // env.GetParameterAsDouble("Yoke_Z_start_endcaps"); + // + //db->exec("SELECT * FROM `muon`;"); + //db->getTuple(); + //iron_thickness = db->fetchDouble("iron_thickness"); + //G4double gap_thickness = db->fetchDouble("layer_thickness"); + //number_of_layers = db->fetchInt("number_of_layers"); + //G4double yokeBarrelEndcapGap = db->fetchInt("barrel_endcap_gap"); + //G4double cell_dim_x = db->fetchDouble("cell_size"); + //G4double cell_dim_z = db->fetchDouble("cell_size"); + //G4double chamber_thickness = 10*mm; + + double yokeBarrelEndcapGap = 2.5;// ?? theDetector.constant<double>("barrel_endcap_gap"); //25.0*mm + + +//==================================================================== +// +// general calculated parameters +// +//==================================================================== + + //port from Mokka Yoke05, the following parameters used by Yoke05 + int symmetry = nsides; + double rInnerBarrel = Yoke_barrel_inner_radius; + double zStartEndcap = Yoke_Z_start_endcaps; // has been updated to 4072.0*mm by driver SCoil02 + + //TODO: put all magic numbers into ILD_o1_v05.xml file. + double gap_thickness = 4.0; + double iron_thickness = 10.0; //10.0 cm + int number_of_layers = 10; + + //... Barrel parameters: + //... tolerance 1 mm + double yokeBarrelThickness = gap_thickness + + number_of_layers*(iron_thickness + gap_thickness) + + 3*(5.6*iron_thickness + gap_thickness) + + 0.1; // the tolerance 1 mm + + double rOuterBarrel = rInnerBarrel + yokeBarrelThickness; + double z_halfBarrel = zStartEndcap - yokeBarrelEndcapGap; + + + // In this release the number of modules is fixed to 3 + double Yoke_Barrel_module_dim_z = 2.0*(zStartEndcap-yokeBarrelEndcapGap)/3.0 ; + + //double Yoke_cell_dim_x = Yoke_cells_size; + //double Yoke_cell_dim_z = Yoke_Barrel_module_dim_z / floor (Yoke_Barrel_module_dim_z/Yoke_cell_dim_x); + + cout<<" Build the yoke within this dimension "<<endl; + cout << " ...Yoke db: symmetry " << symmetry <<endl; + cout << " ...Yoke db: rInnerBarrel " << rInnerBarrel <<endl; + cout << " ...Yoke db: zStartEndcap " << zStartEndcap <<endl; + + cout << " ...Muon db: iron_thickness " << iron_thickness <<endl; + cout << " ...Muon db: gap_thickness " << gap_thickness <<endl; + cout << " ...Muon db: number_of_layers " << number_of_layers <<endl; + + cout << " ...Muon par: yokeBarrelThickness " << yokeBarrelThickness <<endl; + cout << " ...Muon par: Barrel_half_z " << z_halfBarrel <<endl; + + Readout readout = sens.readout(); + Segmentation seg = readout.segmentation(); + + std::vector<double> cellSizeVector = seg.segmentation()->cellDimensions(0); //Assume uniform cell sizes, provide dummy cellID + double cell_sizeX = cellSizeVector[0]; + double cell_sizeY = cellSizeVector[1]; + + //========== fill data for reconstruction ============================ + LayeredCalorimeterData* caloData = new LayeredCalorimeterData ; + caloData->layoutType = LayeredCalorimeterData::BarrelLayout ; + caloData->inner_symmetry = symmetry ; + caloData->outer_symmetry = symmetry ; + caloData->phi0 = 0 ; // also hardcoded below + + /// extent of the calorimeter in the r-z-plane [ rmin, rmax, zmin, zmax ] in mm. + caloData->extent[0] = rInnerBarrel ; + caloData->extent[1] = rOuterBarrel ; + caloData->extent[2] = 0. ; + caloData->extent[3] = z_halfBarrel ; + + +// ========= Create Yoke Barrel module ==================================== + PolyhedraRegular YokeBarrelSolid( symmetry, M_PI/2.0-M_PI/symmetry, rInnerBarrel, rOuterBarrel, Yoke_Barrel_module_dim_z); + + Volume mod_vol(det_name+"_module", YokeBarrelSolid, yokeMaterial); + //Volume mod_vol(det_name+"_module", YokeBarrelSolid, air); + + mod_vol.setVisAttributes(theDetector.visAttributes(x_det.visStr())); + + +//==================================================================== +// Build chamber volume +//==================================================================== + //double gap_thickness = db->fetchDouble("layer_thickness"); + + //-------------------- start loop over Yoke layers ---------------------- + // Loop over the sets of layer elements in the detector. + + double nRadiationLengths=0.; + double nInteractionLengths=0.; + double thickness_sum=0; + + int l_num = 1; + for(xml_coll_t li(x_det,_U(layer)); li; ++li) { + xml_comp_t x_layer = li; + int repeat = x_layer.repeat(); + + // Loop over number of repeats for this layer. + for (int i=0; i<repeat; i++) { + //if(i>11) continue; + string l_name = _toString(l_num,"layer%d"); + //double l_thickness = layering.layer(l_num-1)->thickness(); // Layer's thickness. + double l_thickness = layering.layer(i)->thickness(); // Layer's thickness. + + //double gap_thickness = l_thickness; + //double iron_thickness = 10.0; //10.0 cm + + double radius_low = rInnerBarrel+ 0.05 + i*gap_thickness + i*iron_thickness; + //rInnerBarrel+ 0.5*mm + i*gap_thickness + i*iron_thickness; + //double radius_mid = radius_low+0.5*gap_thickness; + //double radius_sensitive = radius_mid; + + if( i>=10 ) radius_low = rInnerBarrel + 0.05 + i*gap_thickness + (i+(i-10)*4.6)*iron_thickness; + //{ radius_low = + // rInnerBarrel + 0.5*mm + i*gap_thickness + // + (i+(i-10)*4.6)*iron_thickness; + //radius_mid = radius_low+0.5*gap_thickness; + //radius_sensitive = radius_mid; + //} + + //... safety margines of 0.1 mm for x,y of chambers + //double dx = radius_low*tan(Angle2)-0.1*mm; + //double dy = (zStartEndcap-yokeBarrelEndcapGap)/3.0-0.1*mm; + + double Angle2 = M_PI/symmetry; + double dx = radius_low*tan(Angle2)-0.01; + double dy = (zStartEndcap-yokeBarrelEndcapGap)/3.0-0.01; + //Box ChamberSolid(dx,gap_thickness/2.,dy); + //Volume ChamberLog("muonSci",ChamberSolid,air); + + LayeredCalorimeterData::Layer caloLayer ; + caloLayer.cellSize0 = cell_sizeX; + caloLayer.cellSize1 = cell_sizeY; + + Box ChamberSolid(dx,l_thickness/2.0, dy); + Volume ChamberLog(det_name+"_"+l_name,ChamberSolid,air); + DetElement layer(l_name, det_id); + + ChamberLog.setVisAttributes(theDetector.visAttributes(x_layer.visStr())); + + // Loop over the sublayers or slices for this layer. + int s_num = 1; + double s_pos_y = -(l_thickness / 2); + + + + //-------------------------------------------------------------------------------- + // Build Layer, Sensitive Scintilator in the middle, and Air tolorance at two sides + //-------------------------------------------------------------------------------- + double radiator_thickness = 0.05; // Yoke05 Barrel: No radiator before first sensitive layer. + if ( i>0 ) radiator_thickness = gap_thickness + iron_thickness - l_thickness; + if ( i>=10 ) radiator_thickness = gap_thickness + 5.6*iron_thickness - l_thickness; + + nRadiationLengths = radiator_thickness/(yokeMaterial.radLength()); + nInteractionLengths = radiator_thickness/(yokeMaterial.intLength()); + thickness_sum = radiator_thickness; + + + for(xml_coll_t si(x_layer,_U(slice)); si; ++si) { + xml_comp_t x_slice = si; + string s_name = _toString(s_num,"slice%d"); + double s_thickness = x_slice.thickness(); + Material slice_material = theDetector.material(x_slice.materialStr()); + + s_pos_y += s_thickness/2.; + + double slab_dim_x = dx-tolerance; + double slab_dim_y = s_thickness/2.; + double slab_dim_z = dy-tolerance; + + Box s_box(slab_dim_x,slab_dim_y,slab_dim_z); + Volume s_vol(det_name+"_"+l_name+"_"+s_name,s_box,slice_material); + DetElement slice(layer,s_name,det_id); + + nRadiationLengths += s_thickness/(2.*slice_material.radLength()); + nInteractionLengths += s_thickness/(2.*slice_material.intLength()); + thickness_sum += s_thickness/2; + + if ( x_slice.isSensitive() ) { + s_vol.setSensitiveDetector(sens); + std::cout << " ...Barrel i, position: " << i << " " << radius_low + l_thickness/2.0 + s_pos_y << std::endl; +#if DD4HEP_VERSION_GE( 0, 15 ) + //Store "inner" quantities + caloLayer.inner_nRadiationLengths = nRadiationLengths; + caloLayer.inner_nInteractionLengths = nInteractionLengths; + caloLayer.inner_thickness = thickness_sum; + //Store scintillator thickness + caloLayer.sensitive_thickness = s_thickness; +#endif + //Reset counters to measure "outside" quantitites + nRadiationLengths=0.; + nInteractionLengths=0.; + thickness_sum = 0.; + } + + nRadiationLengths += s_thickness/(2.*slice_material.radLength()); + nInteractionLengths += s_thickness/(2.*slice_material.intLength()); + thickness_sum += s_thickness/2; + + // Set region, limitset, and vis. + s_vol.setAttributes(theDetector,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + + Position s_pos(0,s_pos_y,0); // Position of the layer. + PlacedVolume s_phv = ChamberLog.placeVolume(s_vol,s_pos); + slice.setPlacement(s_phv); + + // Increment x position for next slice. + s_pos_y += s_thickness/2.; + + ++s_num; + + } + +#if DD4HEP_VERSION_GE( 0, 15 ) + //Store "outer" quantities + caloLayer.outer_nRadiationLengths = nRadiationLengths; + caloLayer.outer_nInteractionLengths = nInteractionLengths; + caloLayer.outer_thickness = thickness_sum; +#endif + + ++l_num; + + + + double phirot = 0; + + for(int j=0;j<symmetry;j++) + { + double Y = radius_low + l_thickness/2.0; + Position xyzVec(-Y*sin(phirot), Y*cos(phirot), 0); + + RotationZYX rot(phirot,0,0); + Rotation3D rot3D(rot); + + Transform3D tran3D(rot3D,xyzVec); + PlacedVolume layer_phv = mod_vol.placeVolume(ChamberLog,tran3D); + layer_phv.addPhysVolID("layer", l_num).addPhysVolID("stave",j+1); + string stave_name = _toString(j+1,"stave%d"); + string stave_layer_name = stave_name+_toString(l_num,"layer%d"); + DetElement stave(stave_layer_name,det_id);; + stave.setPlacement(layer_phv); + sdet.add(stave); + phirot -= M_PI/symmetry*2.0; + + } + + //----------------------------------------------------------------------------------------- + + + caloLayer.distance = radius_low - radiator_thickness ; + caloLayer.absorberThickness = radiator_thickness ; + + caloData->layers.push_back( caloLayer ) ; + + //----------------------------------------------------------------------------------------- + + } + + } + + +//==================================================================== +// Place Yoke05 Barrel stave module into the world volume +//==================================================================== + + for (int module_id = 1; module_id < 4; module_id++) + { + double module_z_offset = (module_id-2) * Yoke_Barrel_module_dim_z; + + Position mpos(0,0,module_z_offset); + + PlacedVolume m_phv = envelope.placeVolume(mod_vol,mpos); + m_phv.addPhysVolID("module",module_id).addPhysVolID("system", det_id); + m_phv.addPhysVolID("tower", 1);// Not used + string m_name = _toString(module_id,"module%d"); + DetElement sd (m_name,det_id); + sd.setPlacement(m_phv); + sdet.add(sd); + + } + + sdet.addExtension< LayeredCalorimeterData >( caloData ) ; + + return sdet; +} + +DECLARE_DETELEMENT(Yoke05_Barrel,create_detector) diff --git a/Detector/DetCEPCv4/src/calorimeter/Yoke05_Endcaps.cpp b/Detector/DetCEPCv4/src/calorimeter/Yoke05_Endcaps.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d77dc101a79c1e251766b5e52b9907f89bd105e7 --- /dev/null +++ b/Detector/DetCEPCv4/src/calorimeter/Yoke05_Endcaps.cpp @@ -0,0 +1,412 @@ +//==================================================================== +// lcgeo - LC detector models in DD4hep +//-------------------------------------------------------------------- +// DD4hep Geometry driver for YokeEndcaps +// Ported from Mokka +//-------------------------------------------------------------------- +// S.Lu, DESY +// $Id$ +//==================================================================== +// ********************************************************* +// * Mokka * +// * -- A Detailed Geant 4 Simulation for the ILC -- * +// * * +// * polywww.in2p3.fr/geant4/tesla/www/mokka/mokka.html * +// ********************************************************* +// +// $Id$ +// $Name: $ +// +// History: +// - first implementation P. Mora de Freitas (May 2001) +// - selectable symmetry, self-scaling, removed pole tips +// - Adrian Vogel, 2006-03-17 +// - muon system plus +// instrumented pole tip back for TESLA models +// - Predrag Krstonosic , 2006-08-30 +// - added barrelEndcapGap, gear parameters, made barrel +// and endcap same thickness, made plug insensitive, +// - F.Gaede, DESY 2008-10-04 +// + +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/DetType.h" +#include "XML/Layering.h" +#include "XML/Utilities.h" +#include "DDRec/DetectorData.h" + +using namespace std; + +using dd4hep::BUILD_ENVELOPE; +using dd4hep::DetElement; +using dd4hep::DetType; +using dd4hep::Detector; +using dd4hep::Layering; +using dd4hep::Material; +using dd4hep::PlacedVolume; +using dd4hep::PolyhedraRegular; +using dd4hep::Position; +using dd4hep::Readout; +using dd4hep::Ref_t; +using dd4hep::Rotation3D; +using dd4hep::RotationZYX; +using dd4hep::Segmentation; +using dd4hep::SensitiveDetector; +using dd4hep::Transform3D; +using dd4hep::Volume; +using dd4hep::_toString; + +using dd4hep::rec::LayeredCalorimeterData; + +#define VERBOSE 1 + +// workaround for DD4hep v00-14 (and older) +#ifndef DD4HEP_VERSION_GE +#define DD4HEP_VERSION_GE(a,b) 0 +#endif + +static Ref_t create_detector(Detector& theDetector, xml_h element, SensitiveDetector sens) { + double tolerance = 0.1; + + xml_det_t x_det = element; + string det_name = x_det.nameStr(); + Layering layering (element); + + xml_comp_t x_dim = x_det.dimensions(); + int nsides = x_dim.numsides(); + + Material air = theDetector.air(); + //unused: Material vacuum = theDetector.vacuum(); + + Material yokeMaterial = theDetector.material(x_det.materialStr());; + + int det_id = x_det.id(); + DetElement sdet (det_name,det_id); + + // --- create an envelope volume and position it into the world --------------------- + + Volume envelope = dd4hep::xml::createPlacedEnvelope( theDetector, element , sdet ) ; + + dd4hep::xml::setDetectorTypeFlag( element, sdet ) ; + + if( theDetector.buildType() == BUILD_ENVELOPE ) return sdet ; + + //----------------------------------------------------------------------------------- + + sens.setType("calorimeter"); + + +//==================================================================== +// +// Read all the constant from ILD_o1_v05.xml +// Use them to build Yoke05Endcaps +// +//==================================================================== + double Yoke_barrel_inner_radius = theDetector.constant<double>("Yoke_barrel_inner_radius"); + double Yoke_endcap_inner_radius = theDetector.constant<double>("Yoke_endcap_inner_radius"); + double Yoke_Z_start_endcaps = theDetector.constant<double>("Yoke_Z_start_endcaps"); + double HCAL_R_max = theDetector.constant<double>("Hcal_outer_radius"); + //double Yoke_cells_size = theDetector.constant<double>("Yoke_cells_size"); + + double yokeBarrelEndcapGap = 2.5;// ?? theDetector.constant<double>("barrel_endcap_gap"); //25.0*mm + + +//==================================================================== +// +// general calculated parameters +// +//==================================================================== + + //port from Mokka Yoke05, the following parameters used by Yoke05 + int symmetry = nsides; + double rInnerBarrel = Yoke_barrel_inner_radius; + double zStartEndcap = Yoke_Z_start_endcaps; // has been updated to 4072.0*mm by driver SCoil02 + + //TODO: put all magic numbers into ILD_o1_v05.xml file. + double gap_thickness = 4.0; + double iron_thickness = 10.0; //10.0 cm + int number_of_layers = 10; + + //... Barrel parameters: + //... tolerance 1 mm + double yokeBarrelThickness = gap_thickness + + number_of_layers*(iron_thickness + gap_thickness) + + 3*(5.6*iron_thickness + gap_thickness) + + 0.1; // the tolerance 1 mm + + double yokeEndcapThickness = number_of_layers*(iron_thickness + gap_thickness) + + 2*(5.6*iron_thickness + gap_thickness); // + gap_thickness; + + double rInnerEndcap = Yoke_endcap_inner_radius; + double rOuterEndcap = rInnerBarrel + yokeBarrelThickness; + double z_halfBarrel = zStartEndcap - yokeBarrelEndcapGap; + + //Port from Mokka: + // Endcap Thickness has no tolerance + // But the placement should shift_middle by -0.05 (0.5*mm) later + double Yoke_Endcap_module_dim_z = yokeEndcapThickness; + + //double Yoke_cell_dim_x = rOuterEndcap*2.0 / floor (rOuterEndcap*2.0/Yoke_cells_size); + //double Yoke_cell_dim_y = Yoke_cell_dim_x; + + cout<<" Build the yoke within this dimension "<<endl; + cout << " ...Yoke db: symmetry " << symmetry <<endl; + cout << " ...Yoke db: rInnerEndcap " << rInnerEndcap <<endl; + cout << " ...Yoke db: rOuterEndcap " << rOuterEndcap <<endl; + cout << " ...Yoke db: zStartEndcap " << zStartEndcap <<endl; + + cout << " ...Muon db: iron_thickness " << iron_thickness <<endl; + cout << " ...Muon db: gap_thickness " << gap_thickness <<endl; + cout << " ...Muon db: number_of_layers " << number_of_layers <<endl; + + cout << " ...Muon par: yokeEndcapThickness " << yokeEndcapThickness <<endl; + cout << " ...Muon par: Barrel_half_z " << z_halfBarrel <<endl; + + Readout readout = sens.readout(); + Segmentation seg = readout.segmentation(); + + std::vector<double> cellSizeVector = seg.segmentation()->cellDimensions(0); //Assume uniform cell sizes, provide dummy cellID + double cell_sizeX = cellSizeVector[0]; + double cell_sizeY = cellSizeVector[1]; + + //========== fill data for reconstruction ============================ + LayeredCalorimeterData* caloData = new LayeredCalorimeterData ; + caloData->layoutType = LayeredCalorimeterData::EndcapLayout ; + caloData->inner_symmetry = symmetry ; + caloData->outer_symmetry = symmetry ; + caloData->phi0 = 0 ; // hardcoded + + /// extent of the calorimeter in the r-z-plane [ rmin, rmax, zmin, zmax ] in mm. + caloData->extent[0] = rInnerEndcap ; + caloData->extent[1] = rOuterEndcap ; + caloData->extent[2] = zStartEndcap ; + caloData->extent[3] = zStartEndcap + Yoke_Endcap_module_dim_z ; + + + + PolyhedraRegular YokeEndcapSolid( symmetry, M_PI/symmetry, rInnerEndcap, rOuterEndcap, Yoke_Endcap_module_dim_z); + + Volume mod_vol(det_name+"_module", YokeEndcapSolid, yokeMaterial); + + mod_vol.setVisAttributes(theDetector.visAttributes(x_det.visStr())); + + +//==================================================================== +// Build chamber volume +//==================================================================== + //double gap_thickness = db->fetchDouble("layer_thickness"); + + //-------------------- start loop over Yoke layers ---------------------- + // Loop over the sets of layer elements in the detector. + + double nRadiationLengths=0.; + double nInteractionLengths=0.; + double thickness_sum=0; + + + int l_num = 1; + for(xml_coll_t li(x_det,_U(layer)); li; ++li) { + xml_comp_t x_layer = li; + int repeat = x_layer.repeat(); + + // Loop over number of repeats for this layer. + for (int i=0; i<repeat; i++) { + //if(i>11) continue; + string l_name = _toString(l_num,"layer%d"); + double l_thickness = layering.layer(i)->thickness(); // Layer's thickness. + + LayeredCalorimeterData::Layer caloLayer ; + caloLayer.cellSize0 = cell_sizeX; + caloLayer.cellSize1 = cell_sizeY; + + PolyhedraRegular ChamberSolid( symmetry, M_PI/symmetry, rInnerEndcap + tolerance, rOuterEndcap - tolerance, l_thickness); + Volume ChamberLog(det_name+"_"+l_name,ChamberSolid,air); + DetElement layer(l_name, det_id); + + ChamberLog.setVisAttributes(theDetector.visAttributes(x_layer.visStr())); + + // Loop over the sublayers or slices for this layer. + int s_num = 1; + double s_pos_z = -(l_thickness / 2); + + double shift_middle = - yokeEndcapThickness/2 - 0.05 //-0.5*mm since PolyhedraRegular from -Yoke_Endcap_module_dim_z/2 to Yoke_Endcap_module_dim_z/2 + + iron_thickness*(i+1) + + (i+0.5)*gap_thickness; + + if( i>= 10){ + shift_middle = - yokeEndcapThickness/2 - 0.05 //0.5*mm + + iron_thickness*(i+1+(i-9)*4.6) + (i+0.5)*gap_thickness; + } + + //-------------------------------------------------------------------------------- + // Build Layer, Sensitive Scintilator in the middle, and Air tolorance at two sides + //-------------------------------------------------------------------------------- + double radiator_thickness = -0.05 + 0.5*gap_thickness + iron_thickness - l_thickness/2.0 ; + if ( i>0 ) radiator_thickness = gap_thickness + iron_thickness - l_thickness ; + if ( i>=10 ) radiator_thickness = gap_thickness + 5.6*iron_thickness - l_thickness ; + + nRadiationLengths = radiator_thickness/(yokeMaterial.radLength()); + nInteractionLengths = radiator_thickness/(yokeMaterial.intLength()); + thickness_sum = radiator_thickness; + + for(xml_coll_t si(x_layer,_U(slice)); si; ++si) { + xml_comp_t x_slice = si; + string s_name = _toString(s_num,"slice%d"); + double s_thickness = x_slice.thickness(); + Material slice_material = theDetector.material(x_slice.materialStr()); + + s_pos_z += s_thickness/2.; + + PolyhedraRegular sliceSolid( symmetry, M_PI/symmetry, rInnerEndcap + tolerance + 0.01, rOuterEndcap - tolerance -0.01, s_thickness); + Volume s_vol(det_name+"_"+l_name+"_"+s_name,sliceSolid,slice_material); + DetElement slice(layer,s_name,det_id); + + nRadiationLengths += s_thickness/(2.*slice_material.radLength()); + nInteractionLengths += s_thickness/(2.*slice_material.intLength()); + thickness_sum += s_thickness/2; + + if ( x_slice.isSensitive() ) { + s_vol.setSensitiveDetector(sens); + cout << " ...Endcap i, position: " << i << " " << zStartEndcap + yokeEndcapThickness/2 + shift_middle + l_thickness/2.0 + s_pos_z << endl; +#if DD4HEP_VERSION_GE( 0, 15 ) + //Store "inner" quantities + caloLayer.inner_nRadiationLengths = nRadiationLengths; + caloLayer.inner_nInteractionLengths = nInteractionLengths; + caloLayer.inner_thickness = thickness_sum; + //Store scintillator thickness + caloLayer.sensitive_thickness = s_thickness; +#endif + //Reset counters to measure "outside" quantitites + nRadiationLengths=0.; + nInteractionLengths=0.; + thickness_sum = 0.; + } + + nRadiationLengths += s_thickness/(2.*slice_material.radLength()); + nInteractionLengths += s_thickness/(2.*slice_material.intLength()); + thickness_sum += s_thickness/2; + + // Set region, limitset, and vis. + s_vol.setAttributes(theDetector,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); + + Position s_pos(0,0,s_pos_z); // Position of the layer. + PlacedVolume s_phv = ChamberLog.placeVolume(s_vol,s_pos); + slice.setPlacement(s_phv); + + // Increment x position for next slice. + s_pos_z += s_thickness/2.; + + ++s_num; + + } + +#if DD4HEP_VERSION_GE( 0, 15 ) + //Store "outer" quantities + caloLayer.outer_nRadiationLengths = nRadiationLengths; + caloLayer.outer_nInteractionLengths = nInteractionLengths; + caloLayer.outer_thickness = thickness_sum; +#endif + + ++l_num; + + Position xyzVec(0,0,shift_middle); + + PlacedVolume layer_phv = mod_vol.placeVolume(ChamberLog,xyzVec); + layer_phv.addPhysVolID("layer", l_num); + //string stave_name = "stave1"; + string stave_layer_name = "stave1"+_toString(l_num,"layer%d"); + DetElement stave(stave_layer_name,det_id);; + stave.setPlacement(layer_phv); + sdet.add(stave); + + //----------------------------------------------------------------------------------------- + + + caloLayer.distance = zStartEndcap + yokeEndcapThickness/2.0 + shift_middle + - caloLayer.inner_thickness ; + caloLayer.absorberThickness = radiator_thickness ; + + caloData->layers.push_back( caloLayer ) ; + + //----------------------------------------------------------------------------------------- + + } + + } + +//==================================================================== +// Check Yoke05 plug module +//==================================================================== + bool build_plug = false; + double HCAL_z = theDetector.constant<double>("HcalEndcap_max_z");; + double HCAL_plug_gap = theDetector.constant<double>("Hcal_Yoke_plug_gap"); + int Hcal_endcap_outer_symmetry = theDetector.constant<int>("Hcal_endcap_outer_symmetry"); + double plug_thickness = zStartEndcap-HCAL_z-HCAL_plug_gap; + + double rInnerPlug = Yoke_endcap_inner_radius; + double rOuterPlug = HCAL_R_max*cos(dd4hep::pi/16.) *cos(dd4hep::pi/Hcal_endcap_outer_symmetry); + double Yoke_Plug_module_dim_z = plug_thickness; + + // Is there a space to build Yoke plug + if( Yoke_Plug_module_dim_z > 0 ) + { + build_plug = true; + + cout << " ...Plug par: build_plug is true, there is space to build yoke plug" <<endl; + cout << " ...Plug par: HCAL_half_z " << HCAL_z <<endl; + cout << " ...Plug par: HCAL_Plug_Gap " << HCAL_plug_gap <<endl; + cout << " ...Plug par: Plug Thickness " << plug_thickness <<endl; + cout << " ...Plug par: Plug Radius " << rOuterPlug <<endl; + + } + +//==================================================================== +// Place Yoke05 Endcaps module into the world volume +//==================================================================== + + double zEndcap = zStartEndcap + yokeEndcapThickness/2.0 + 0.1; // Need 0.1 (1.0*mm) according to the Mokka Yoke05 driver. + double zPlug = zStartEndcap - plug_thickness/2.0 -0.05; // Need 0.05 (0.5*mm) according to the Mokka Yoke05 driver. + + for(int module_num=0;module_num<2;module_num++) { + + int module_id = ( module_num == 0 ) ? 0:6; + double this_module_z_offset = ( module_id == 0 ) ? - zEndcap : zEndcap; + double this_module_rotY = ( module_id == 0 ) ? M_PI:0; + + Position xyzVec(0,0,this_module_z_offset); + RotationZYX rot(0,this_module_rotY,0); + Rotation3D rot3D(rot); + Transform3D tran3D(rot3D,xyzVec); + + PlacedVolume pv = envelope.placeVolume(mod_vol,tran3D); + pv.addPhysVolID("module",module_id); // z: -/+ 0/6 + + string m_name = _toString(module_id,"module%d"); + DetElement sd (m_name,det_id); + sd.setPlacement(pv); + sdet.add(sd); + + //==================================================================== + // If build_plug is true, Place the plug module into the world volume + //==================================================================== + if(build_plug == true){ + PolyhedraRegular YokePlugSolid( symmetry, M_PI/symmetry, rInnerPlug, rOuterPlug, Yoke_Plug_module_dim_z); + Volume plug_vol(det_name+"_plug", YokePlugSolid, yokeMaterial); + plug_vol.setVisAttributes(theDetector.visAttributes(x_det.visStr())); + + double this_plug_z_offset = ( module_id == 0 ) ? - zPlug : zPlug; + Position plug_pos(0,0,this_plug_z_offset); + PlacedVolume plug_phv = envelope.placeVolume(plug_vol,plug_pos); + string plug_name = _toString(module_id,"plug%d"); + DetElement plug (plug_name,det_id); + plug.setPlacement(plug_phv); + } + + } + + sdet.addExtension< LayeredCalorimeterData >( caloData ) ; + + return sdet; +} + +DECLARE_DETELEMENT(Yoke05_Endcaps,create_detector) diff --git a/Detector/DetCEPCv4/src/other/SCoil02_geo.cpp b/Detector/DetCEPCv4/src/other/SCoil02_geo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..424e6b71ea7d55a95f6b6c5be332a647e32d31c8 --- /dev/null +++ b/Detector/DetCEPCv4/src/other/SCoil02_geo.cpp @@ -0,0 +1,497 @@ +//==================================================================== +// DDSim - LC detector models in DD4hep +//-------------------------------------------------------------------- +// F.Gaede, DESY +// $Id$ +//==================================================================== +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/DD4hepUnits.h" +#include "DD4hep/DetType.h" +#include "DDRec/Surface.h" +#include "XMLHandlerDB.h" +#include "XML/Utilities.h" +#include <cmath> +#include "DDRec/DetectorData.h" + +//#include "GearWrapper.h" + +using namespace std; + +using dd4hep::BUILD_ENVELOPE; +using dd4hep::Box; +using dd4hep::DetElement; +using dd4hep::Detector; +using dd4hep::Material; +using dd4hep::PlacedVolume; +using dd4hep::PolyhedraRegular; +using dd4hep::Position; +using dd4hep::Ref_t; +using dd4hep::RotationZYX; +using dd4hep::SensitiveDetector; +using dd4hep::Transform3D; +using dd4hep::Tube; +using dd4hep::Volume; + +using dd4hep::xml::_toString; + +using dd4hep::rec::LayeredCalorimeterData; + + +/** Construction of the coil, ported from Mokka drivers SCoil02.cc and Coil01.cc + * + * Mokka History: + * SCoil02.cc + * F.Gaede, DESY: based on SCoil01, with added parameters for the + * clearance to the yoke: + * Hcal_Coil_additional_gap : adjust the actual gap in r (Hcal_R_max allready defines a gap) + * Coil_Yoke_radial_clearance : -> defines inner r of yoke + * Coil_Yoke_lateral_clearance : -> defines zEndcap of yoke + * Coil00.cc + * - first implementation P. Mora de Freitas (may 01) + * - F.Gaede: write out parameters to GEAR (Oct 08) + * Coil00.cc: + * - V. Saveliev: replaced simple Al-tube with more detailed structure (cryostat, etc ) + * + * @author: F.Gaede, DESY, Aug 2014 + */ + +static Ref_t create_element(Detector& theDetector, xml_h element, SensitiveDetector sens) { + + //------------------------------------------ + // See comments starting with '//**' for + // hints on porting issues + //------------------------------------------ + + xml_det_t x_det = element; + string name = x_det.nameStr(); + + DetElement coil( name, x_det.id() ) ; + + // --- create an envelope volume and position it into the world --------------------- + + Volume envelope = dd4hep::xml::createPlacedEnvelope( theDetector, element , coil ) ; + + dd4hep::xml::setDetectorTypeFlag( element, coil ) ; + + if( theDetector.buildType() == BUILD_ENVELOPE ) return coil ; + + //----------------------------------------------------------------------------------- + sens.setType("tracker"); + + PlacedVolume pv; + + //###################################################################################################################################################################### + // code ported from Coil02::construct() : + //################################## + + cout << "\nBuilding Coil..." << endl; + + xml_comp_t x_tube (x_det.child(_U(tube))); + + double inner_radius = x_tube.rmin() ; + double outer_radius = x_tube.rmax() ; + double half_z = x_tube.dz() ; + + cout << "\n... cryostat inner_radius " << inner_radius + << "\n... cryostat outer_radius " << outer_radius + << "\n... cryostat half_z " << half_z + << endl; + + double tCoil = outer_radius - inner_radius; + double zMandrel = half_z-197*dd4hep::mm; + + double rInnerMain = 175./750.*tCoil; + double rOuterMain = 426./750.*tCoil; + double zCorrect = zMandrel/3; + double zMain = (zMandrel-zCorrect)*2/3; + double rInnerMandrel = rOuterMain; + double rOuterMandrel = 654./750.*tCoil; + + double rInnerSci1 = 90*dd4hep::mm; + double rInnerSci2 = 105*dd4hep::mm; + double rInnerSci3 = -90*dd4hep::mm; + double rInnerSci4 = -105*dd4hep::mm; + double zReduceSci = 100*dd4hep::mm; + + Material coilMaterial = theDetector.material( x_tube.materialStr() ) ; + + //FG: for now fall back to a simple tube filled with Al + // the code below has to many hard coded numbers + // that need verification and then need to be converted + // to xml parameters ... +#define code_is_cleaned_up true +#if 0 //!code_is_cleaned_up + + Tube coil_tube( x_tube.rmin(), x_tube.rmax(), x_tube.dz() ); + + Volume coil_vol( "coil_vol", coil_tube , coilMaterial ); + pv = envelope.placeVolume( coil_vol ) ; + coil.setVisAttributes( theDetector, "BlueVis" , coil_vol ); + + cout << " ... for the time being simply use a tube of aluminum ..." << endl ; + + //========================================================================================================= +#else + //... Coil Cryostat (Al, inside vacuum) + //... inner cylinder + Tube CoilEnvelopeSolid_1( inner_radius, 40.* dd4hep::mm + inner_radius , half_z ) ; + + Volume CoilLogical_1( "CoilEnvelope_1", CoilEnvelopeSolid_1, coilMaterial ) ; + + coil.setVisAttributes( theDetector, "ShellVis" , CoilLogical_1 ); + + pv = envelope.placeVolume( CoilLogical_1 ) ; + + //... outer cylinder + Tube CoilEnvelopeSolid_2 ( -30*dd4hep::mm + outer_radius, outer_radius , half_z ) ; + + Volume CoilLogical_2( "CoilEnvelope_2", CoilEnvelopeSolid_2, coilMaterial ) ; + + coil.setVisAttributes( theDetector, "ShellVis" , CoilLogical_2 ); + + pv = envelope.placeVolume( CoilLogical_2 ) ; + + + //... side wall left + Tube CoilEnvelopeSolid_3( 40*dd4hep::mm + inner_radius, -30*dd4hep::mm + outer_radius, 25.* dd4hep::mm ) ; + + Volume CoilLogical_3( "CoilEnvelope_3", CoilEnvelopeSolid_3, coilMaterial ) ; + + coil.setVisAttributes( theDetector, "ShellVis" , CoilLogical_3 ); + + pv = envelope.placeVolume( CoilLogical_3 , Position( 0., 0., -25.*dd4hep::mm + half_z ) ) ; + + + //... side wall right + // Tube CoilEnvelopeSolid_4( 40*dd4hep::mm + inner_radius, -30*dd4hep::mm + outer_radius, 25.* dd4hep::mm ) ; + // Volume CoilLogical_4( "CoilEnvelope_4", CoilEnvelopeSolid_4, coilMaterial ) ; + // coil.setVisAttributes( theDetector, "BlueVis" , CoilLogical_4 ); + // pv = envelope.placeVolume( CoilLogical_4 , Position( 0., 0., 25.*dd4hep::mm - half_z ) ) ; + //simply place the same volume again + + pv = envelope.placeVolume( CoilLogical_3 , Position( 0., 0., 25.*dd4hep::mm - half_z ) ) ; + + + //... Coil modules + //... main coll module 1,2,3 + + Tube CoilMainSolid_1( rInnerMain + inner_radius, rOuterMain + inner_radius, zMain/2-0.*dd4hep::mm ) ; + + Volume CoilMainLogical_1( "CoilMain_1" , CoilMainSolid_1, coilMaterial ) ; + + coil.setVisAttributes( theDetector, "GreyVis" , CoilMainLogical_1 ); + + pv = envelope.placeVolume( CoilMainLogical_1 , Position( 0., 0., -zMain ) ) ; + pv = envelope.placeVolume( CoilMainLogical_1 , Position( 0., 0., 0. ) ) ; + pv = envelope.placeVolume( CoilMainLogical_1 , Position( 0., 0., zMain ) ) ; + + Material aluminium = theDetector.material("G4_Al"); + Material polystyrene = theDetector.material("G4_POLYSTYRENE"); + + //... corrected coil module 1,2 + Tube CoilCorrectSolid_1(rInnerMain + inner_radius, rOuterMain + inner_radius, zCorrect/2); + + Volume CoilCorrectLogical_1("CoilCorrect_1", CoilCorrectSolid_1, aluminium); + + coil.setVisAttributes( theDetector, "BlueVis", CoilCorrectLogical_1); + + pv = envelope.placeVolume(CoilCorrectLogical_1, Position(0., 0., -zMain*3/2-zCorrect/2)); + pv = envelope.placeVolume(CoilCorrectLogical_1, Position(0., 0., zMain*3/2+zCorrect/2)); + + //... Coil mandrel + Tube CoilMandrelSolid(rInnerMandrel + inner_radius, rOuterMandrel + inner_radius, zMandrel); + + Volume CoilMandrelLogical("CoilMandrel", CoilMandrelSolid, aluminium); + + coil.setVisAttributes( theDetector, "GreenVis", CoilMandrelLogical); + + pv = envelope.placeVolume(CoilMandrelLogical, Position(0., 0., 0.)); + + //... Coil sensitive detectors + int layer_id=1; //Put in the database!!! + // Threshold is 20%. mip = 200 keV/dd4hep::mm + const double sensitive_thickness = 10. *dd4hep::mm; + + //theCoilSD = new TRKSD00("COIL", sensitive_thickness * 200 * keV * 0.01); + //RegisterSensitiveDetector(theCoilSD); + + double rOuterSci1 = rInnerSci1 + sensitive_thickness; + double rOuterSci2 = rInnerSci2 + sensitive_thickness; + double rOuterSci3 = rInnerSci3 + sensitive_thickness; + double rOuterSci4 = rInnerSci4 + sensitive_thickness; + double halfZSci = half_z - zReduceSci; + //... Scintillator Detector layer 1 + if((rOuterSci1+inner_radius)/cos(dd4hep::pi/24)<rInnerMain+inner_radius){ + const double zPozBarrelArray_1 = halfZSci; + const double rInnerBarrelArray_1 = rInnerSci1+inner_radius; + const double rOuterBarrelArray_1 = rOuterSci1+inner_radius; + + PolyhedraRegular CoilScintSolid_1(24, rInnerBarrelArray_1, rOuterBarrelArray_1, zPozBarrelArray_1*2); + + Volume CoilScintLogical_1("CoilScint_1", CoilScintSolid_1, polystyrene); + + coil.setVisAttributes( theDetector, "RedVis", CoilScintLogical_1); + CoilScintLogical_1.setSensitiveDetector(sens); + + pv = envelope.placeVolume(CoilScintLogical_1, Position(0., 0., 0.)); + pv.addPhysVolID("layer",layer_id); + } + + layer_id++; + //... Scintillation Detector layer 2 + if((rOuterSci2+inner_radius)/cos(dd4hep::pi/24)<rInnerMain+inner_radius){ + const double zPozBarrelArray_2 = halfZSci; + const double rInnerBarrelArray_2 = rInnerSci2+inner_radius; + const double rOuterBarrelArray_2 = rOuterSci2+inner_radius; + + PolyhedraRegular CoilScintSolid_2(24, rInnerBarrelArray_2, rOuterBarrelArray_2, zPozBarrelArray_2*2); + + Volume CoilScintLogical_2("CoilScint_2", CoilScintSolid_2, polystyrene); + + coil.setVisAttributes( theDetector, "RedVis", CoilScintLogical_2); + CoilScintLogical_2.setSensitiveDetector(sens); + + pv = envelope.placeVolume(CoilScintLogical_2, Position(0., 0., 0.)); + pv.addPhysVolID("layer",layer_id); + } + + layer_id++; + //... Scint detector layer 3 + if(rInnerSci3+outer_radius>rOuterMandrel+inner_radius){ + const double zPozBarrelArray_3 = halfZSci; + const double rInnerBarrelArray_3 = rInnerSci3+outer_radius; + const double rOuterBarrelArray_3 = rOuterSci3+outer_radius; + + PolyhedraRegular CoilScintSolid_3(24, rInnerBarrelArray_3, rOuterBarrelArray_3, zPozBarrelArray_3*2); + + Volume CoilScintLogical_3("CoilScint_3", CoilScintSolid_3, polystyrene); + + coil.setVisAttributes( theDetector, "RedVis", CoilScintLogical_3); + CoilScintLogical_3.setSensitiveDetector(sens); + + pv = envelope.placeVolume(CoilScintLogical_3, Position(0., 0., 0.)); + pv.addPhysVolID("layer",layer_id); + } + + layer_id++; + //... Scintillation Detector layer 4 + if(rInnerSci4+outer_radius>rOuterMandrel+inner_radius){ + const double zPozBarrelArray_4 = halfZSci; + const double rInnerBarrelArray_4 = rInnerSci4+outer_radius; + const double rOuterBarrelArray_4 = rOuterSci4+outer_radius; + + PolyhedraRegular CoilScintSolid_4(24, rInnerBarrelArray_4, rOuterBarrelArray_4, zPozBarrelArray_4*2); + + Volume CoilScintLogical_4("CoilScint_4", CoilScintSolid_4, polystyrene); + + coil.setVisAttributes( theDetector, "RedVis", CoilScintLogical_4); + CoilScintLogical_4.setSensitiveDetector(sens); + + pv = envelope.placeVolume(CoilScintLogical_4, Position(0., 0., 0.)); + pv.addPhysVolID("layer",layer_id); + } +#ifdef MOKKA_GEAR + //---------------------------------------------------- + // MokkaGear + //---------------------------------------------------- + + MokkaGear* gearMgr = MokkaGear::getMgr() ; + + gear::GearParametersImpl* gp = new gear::GearParametersImpl ; + + //Inner Cylinder + gp->setDoubleVal("Coil_cryostat_inner_cyl_inner_radius", + inner_radius); + gp->setDoubleVal("Coil_cryostat_inner_cyl_outer_radius", + 40.*dd4hep::mm+inner_radius); + gp->setDoubleVal("Coil_cryostat_inner_cyl_half_z", half_z); + gp->setStringVal("Coil_material_inner_cyl", "aluminium"); + + + //Outer Cylinder + gp->setDoubleVal("Coil_cryostat_outer_cyl_inner_radius", + -30*dd4hep::mm+outer_radius); + gp->setDoubleVal("Coil_cryostat_outer_cyl_outer_radius", + outer_radius); + gp->setDoubleVal("Coil_cryostat_outer_cyl_half_z", half_z); + gp->setStringVal("Coil_material_outer_cyl", "aluminium"); + + //FG: add the parameters under the 'old' names as expected by the reconstruction: + gp->setDoubleVal("Coil_cryostat_inner_radius", inner_radius); + gp->setDoubleVal("Coil_cryostat_outer_radius", outer_radius); + gp->setDoubleVal("Coil_cryostat_half_z", half_z); + + //Side wall left + + gp->setDoubleVal("Coil_cryostat_side_l_inner_radius", + 40*dd4hep::mm+inner_radius); + gp->setDoubleVal("Coil_cryostat_side_l_outer_radius", + -30*dd4hep::mm+outer_radius); + gp->setDoubleVal("Coil_cryostat_side_l_half_z", 25.*dd4hep::mm); + gp->setStringVal("Coil_material_side_l", "aluminium"); + + //Side wall right + + gp->setDoubleVal("Coil_cryostat_side_r_inner_radius", + 40*dd4hep::mm+inner_radius); + gp->setDoubleVal("Coil_cryostat_side_r_outer_radius", + -30*dd4hep::mm+outer_radius); + gp->setDoubleVal("Coil_cryostat_side_r_half_z", 25.*dd4hep::mm); + gp->setStringVal("Coil_material_side_r", "aluminium"); + + // Coil modules + + gp->setDoubleVal("Coil_cryostat_modules_inner_radius", + rInnerMain+inner_radius); + gp->setDoubleVal("Coil_cryostat_modules_outer_radius", + rOuterMain+inner_radius); + gp->setDoubleVal("Coil_cryostat_modules_half_z", zMain/2-20.*dd4hep::mm); + gp->setStringVal("Coil_material_modules", "aluminium"); + + gp->setDoubleVal("Coil_cryostat_c_modules_inner_radius", + rInnerMain+inner_radius); + gp->setDoubleVal("Coil_cryostat_c_modules_outer_radius", + rOuterMain+inner_radius); + gp->setDoubleVal("Coil_cryostat_c_modules_half_z", zCorrect); + gp->setStringVal("Coil_material_c_modules", "aluminium"); + + + //Coil mandrel + + + gp->setDoubleVal("Coil_cryostat_mandrel_inner_radius", + rInnerMandrel+inner_radius); + gp->setDoubleVal("Coil_cryostat_mandrel_outer_radius", + rOuterMandrel+inner_radius); + gp->setDoubleVal("Coil_cryostat_mandrel_half_z", zMandrel); + gp->setStringVal("Coil_material_mandrel", "aluminium"); + + //Sensitive detectors + + gp->setDoubleVal("Coil_cryostat_scint1_inner_radius", + rInnerSci1+inner_radius); + gp->setDoubleVal("Coil_cryostat_scint1_outer_radius", + rOuterSci1+inner_radius); + gp->setDoubleVal("Coil_cryostat_scint1_zposin", + -zReduceSci+half_z); + gp->setDoubleVal("Coil_cryostat_scint1_zposend", + +zReduceSci+half_z); + gp->setStringVal("Coil_material_scint1", "polystyrene"); + + gp->setDoubleVal("Coil_cryostat_scint2_inner_radius", + rInnerSci2+inner_radius); + gp->setDoubleVal("Coil_cryostat_scint2_outer_radius", + rOuterSci2+inner_radius); + gp->setDoubleVal("Coil_cryostat_scint2_zposin", + -zReduceSci+half_z); + gp->setDoubleVal("Coil_cryostat_scint2_zposend", + +zReduceSci+half_z); + gp->setStringVal("Coil_material_scint2", "polystyrene"); + + gp->setDoubleVal("Coil_cryostat_scint3_inner_radius", + rInnerSci3+outer_radius); + gp->setDoubleVal("Coil_cryostat_scint3_outer_radius", + rOuterSci3+outer_radius); + gp->setDoubleVal("Coil_cryostat_scint3_zposin", + -zReduceSci+half_z); + gp->setDoubleVal("Coil_cryostat_scint3_zposend", + +zReduceSci+half_z); + gp->setStringVal("Coil_material_scint3", "polystyrene"); + + gp->setDoubleVal("Coil_cryostat_scint4_inner_radius", + rInnerSci4+outer_radius); + gp->setDoubleVal("Coil_cryostat_scint4_outer_radius", + rOuterSci4+outer_radius); + gp->setDoubleVal("Coil_cryostat_scint4_zposin", + -zReduceSci+half_z); + gp->setDoubleVal("Coil_cryostat_scint4_zposend", + +zReduceSci+half_z); + gp->setStringVal("Coil_material_scint4", "polystyrene"); + gearMgr->setGearParameters("CoilParameters", gp); +#endif + + + cout << "Coil done.\n" << endl; + + + + + + + + + // //====== create the meassurement surface =================== + // Vector3D u,v,n ; + + // if( faces_IP == 0 ){ + // // will be rotated around z-axis later + // u.fill( 0. , -1. , 0. ) ; + // v.fill( 0. , 0. , 1. ) ; + // n.fill( -1. , 0. , 0. ) ; + + // // implement 7 deg stereo angle + // u.fill( 0. , -cos( 3.5 * dd4hep::deg ) , -sin( 3.5 * dd4hep::deg ) ) ; + // v.fill( 0. , -sin( 3.5 * dd4hep::deg ) , cos( 3.5 * dd4hep::deg ) ) ; + + // } else { + + // u.fill( 0. , 1. , 0. ) ; + // v.fill( 0. , 0. , 1. ) ; + // n.fill( 1. , 0. , 0. ) ; + + // // implement 7 deg stereo angle + // u.fill( 0. , cos( 3.5 * dd4hep::deg ) , sin( 3.5 * dd4hep::deg ) ) ; + // v.fill( 0. , -sin( 3.5 * dd4hep::deg ) , cos( 3.5 * dd4hep::deg ) ) ; + // } + + + // double inner_thick = sensitive_thickness / 2.0 ; + // double outer_thick = sensitive_thickness / 2.0 + support_thickness ; // support is on top + + // VolPlane surf( sitSenLogical , SurfaceType(SurfaceType::Sensitive,SurfaceType::Measurement1D) ,inner_thick, outer_thick , u,v,n ) ; //,o ) ; + + // // vector of sensor placements - needed for DetElements in ladder loop below + // std::vector<PlacedVolume> pvV( layer_geom.n_sensors_per_ladder ) ; + + // //============================================================ + + + +#endif //code_is_cleaned_up + //========================================================================================================= + + + cout << "SCoil02 done.\n" << endl; + //###################################################################################################################################################################### + + + //-------------------------------------- + + //coil.setVisAttributes( theDetector, x_det.visStr(), envelope ); + //added coded by Thorben Quast + //the coil is modelled as a calorimeter layer to be consistent with the + //implementation of the solenoid (layers) of CLIC + LayeredCalorimeterData* coilData = new LayeredCalorimeterData; + + //NN: Adding the rest of the data + coilData->inner_symmetry = 0; + coilData->outer_symmetry = 0; + coilData->layoutType = LayeredCalorimeterData::BarrelLayout ; + + coilData->extent[0] = inner_radius ; + coilData->extent[1] = outer_radius; + coilData->extent[2] = 0. ; + coilData->extent[3] = half_z; + + //NN: These probably need to be fixed and ced modified to read the extent, rather than the layer + LayeredCalorimeterData::Layer coilLayer; + coilLayer.distance = inner_radius; + coilLayer.inner_thickness = ( outer_radius - inner_radius ) / 2. ; + coilLayer.outer_thickness = coilLayer.inner_thickness ; + coilLayer.cellSize0 = 0; //equivalent to + coilLayer.cellSize1 = half_z; //half extension along z-axis + coilData->layers.push_back(coilLayer); + coil.addExtension< LayeredCalorimeterData >( coilData ) ; + return coil; +} +DECLARE_DETELEMENT(SCoil02,create_element) diff --git a/Detector/DetCRD/CMakeLists.txt b/Detector/DetCRD/CMakeLists.txt index 3bdd6f88554a66e520204d2350dad67825f3597b..55e3317890aa2f7420ac0b7298a9bcb66b631004 100644 --- a/Detector/DetCRD/CMakeLists.txt +++ b/Detector/DetCRD/CMakeLists.txt @@ -2,10 +2,6 @@ # Package: DetCRD # CEPC Reference Detector (CRD) ################################################################################ -gaudi_subdir(DetCRD v0r0) - -gaudi_depends_on_subdirs(GaudiKernel) - find_package(DD4hep COMPONENTS DDRec DDG4 DDParsers REQUIRED) # find_package(DD4hep) @@ -17,28 +13,20 @@ include( DD4hep ) find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED) -install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetCRD) - -set(DetCRD_src - src/Calorimeter/CRDEcal.cpp - src/Other/CRDBeamPipe_v01_geo.cpp -) +# install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetCRD) gaudi_add_module(DetCRD - ${DetCRD_src} - INCLUDE_DIRS - # DD4hep - # ROOT - # Geant4 - src/include - LINK_LIBRARIES - # GaudiKernel - DD4hep - ${DD4hep_COMPONENT_LIBRARIES} - # ROOT - # Geant4 + SOURCES src/Calorimeter/CRDEcal.cpp + src/Other/CRDBeamPipe_v01_geo.cpp + LINK ${DD4hep_COMPONENT_LIBRARIES} ) set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}") dd4hep_generate_rootmap(DetCRD) + +install(TARGETS DetCRD + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Detector/DetCRD/compact/CRD_common_v01/DC_Simple_v01_01.xml b/Detector/DetCRD/compact/CRD_common_v01/DC_Simple_v01_01.xml index 3b843fc94fe3ce620f80727b73373a3353d259eb..cb346b082a29872267f46861cc7aeb3073ad6ca3 100644 --- a/Detector/DetCRD/compact/CRD_common_v01/DC_Simple_v01_01.xml +++ b/Detector/DetCRD/compact/CRD_common_v01/DC_Simple_v01_01.xml @@ -16,29 +16,48 @@ <constant name="SDT_half_length" value="MainTracker_half_length"/> <constant name="SDT_length" value="SDT_half_length*2"/> - <constant name="SDT_inner_chamber_radius_min" value="SDT_radius_min"/> + <constant name="SDT_inner_chamber_radius_min" value="235*mm"/> <constant name="SDT_inner_chamber_radius_max" value="InnerTracker_outer_radius"/> <constant name="SDT_inner_chamber_length" value="SDT_length"/> <constant name="SDT_outer_chamber_radius_min" value="OuterTracker_inner_radius"/> - <constant name="SDT_outer_chamber_radius_max" value="SDT_radius_max"/> + <constant name="SDT_outer_chamber_radius_max" value="1715*mm"/> <constant name="SDT_outer_chamber_length" value="SDT_length"/> <constant name="SDT_inner_chamber_layer_number" value="67"/> <constant name="SDT_outer_chamber_layer_number" value="63"/> <constant name="SDT_chamber_layer_width" value="10*mm"/> <constant name="Epsilon" value="0*deg"/> + + <constant name="SDT_inner_chamber_inner_wall_radius_min" value="234.8*mm"/> + <constant name="SDT_inner_chamber_inner_wall_radius_max" value="235*mm"/> + <constant name="SDT_inner_chamber_outer_wall_radius_min" value="906*mm"/> + <constant name="SDT_inner_chamber_outer_wall_radius_max" value="908.8*mm"/> + <constant name="SDT_outer_chamber_inner_wall_radius_min" value="1084.8*mm"/> + <constant name="SDT_outer_chamber_inner_wall_radius_max" value="1085*mm"/> + <constant name="SDT_outer_chamber_outer_wall_radius_min" value="1715*mm"/> + <constant name="SDT_outer_chamber_outer_wall_radius_max" value="1717.8*mm"/> + </define> <detectors> <detector id="DetID_DC" name="DriftChamber" type="DriftChamber" readout="DriftChamberHitsCollection" vis="BlueVis" sensitive="true" insideTrackingVolume="true"> <envelope vis="SeeThrough"> <shape type="BooleanShape" operation="Union" material="Air"> - <shape type="Tube" rmin="SDT_inner_chamber_radius_min" rmax="SDT_inner_chamber_radius_max" dz="SDT_half_length" /> - <shape type="Tube" rmin="SDT_outer_chamber_radius_min" rmax="SDT_outer_chamber_radius_max" dz="SDT_half_length" /> + <shape type="Tube" rmin="SDT_radius_min" rmax="909*mm" dz="SDT_half_length" /> + <shape type="Tube" rmin="1084.8*mm" rmax="SDT_radius_max" dz="SDT_half_length" /> </shape> </envelope> + <module id="0" repeat="1" name="SignalWire" type="Tube" rmin="0*mm" rmax="0.01*mm"> + <tubs name="W" type="Tube" rmin="0*mm" rmax="0.007*mm" material="Tungsten"/> + <tubs name="Au" type="Tube" rmin="0.007*mm" rmax="0.01*mm" material="Gold"/> + </module> + <module id="1" repeat="3" name="FieldWire" type="Tube" rmin="0*mm" rmax="0.02*mm"> + <tubs name="Al" type="Tube" rmin="0*mm" rmax="0.017*mm" material="Aluminum"/> + <tubs name="Ag" type="Tube" rmin="0.017*mm" rmax="0.02*mm" material="Silver"/> + </module> + <type_flags type="DetType_TRACKER + DetType_BARREL + DetType_GASEOUS + DetType_WIRE"/> <!-- Use cm as unit if you want to use Pandora for reconstruction --> diff --git a/Detector/DetCRD/compact/CRD_common_v01/materials.xml b/Detector/DetCRD/compact/CRD_common_v01/materials.xml index 74b3f3fa8dca29cc34b251fc38fc82d09884af1c..c9f7edf444b55e0cc7e766b4c87892bb081b5d28 100644 --- a/Detector/DetCRD/compact/CRD_common_v01/materials.xml +++ b/Detector/DetCRD/compact/CRD_common_v01/materials.xml @@ -562,4 +562,12 @@ <fraction n="0.671054" ref="Bi" /> </material> + <!-- Driftchamber: material for the drift chamber --> + <material name="GasHe_90Isob_10"> + <D value="0.0003983999999999999" unit="g/cm3" /> + <fraction n="0.3826351004462046" ref="He"/> + <fraction n="0.011371937371285891" ref="H" /> + <fraction n="0.6059929621825095" ref="C" /> + </material> + </materials> diff --git a/Detector/DetCRD/compact/CRD_o1_v01/CRD_Dimensions_v01_01.xml b/Detector/DetCRD/compact/CRD_o1_v01/CRD_Dimensions_v01_01.xml index 0c1d96af5a4b36b0ed192ffa84bda86e09fe830c..d7c15e97cfa2c49240cebbe6a1fa0196ae0ff2b3 100644 --- a/Detector/DetCRD/compact/CRD_o1_v01/CRD_Dimensions_v01_01.xml +++ b/Detector/DetCRD/compact/CRD_o1_v01/CRD_Dimensions_v01_01.xml @@ -83,11 +83,11 @@ <constant name="MainTracker_half_length" value="2225*mm" /> <constant name="InnerTracker_half_length" value="MainTracker_half_length" /> - <constant name="InnerTracker_inner_radius" value="235*mm"/> - <constant name="InnerTracker_outer_radius" value="909*mm"/> + <constant name="InnerTracker_inner_radius" value="234*mm"/> + <constant name="InnerTracker_outer_radius" value="906*mm"/> <constant name="OuterTracker_half_length" value="MainTracker_half_length"/> <constant name="OuterTracker_inner_radius" value="1085*mm"/> - <constant name="OuterTracker_outer_radius" value="1716*mm"/> + <constant name="OuterTracker_outer_radius" value="1720*mm"/> <constant name="SIT1_inner_radius" value="152.90*mm"/> <constant name="SIT1_half_length" value="368.00*mm"/> diff --git a/Detector/DetDriftChamber/CMakeLists.txt b/Detector/DetDriftChamber/CMakeLists.txt index 0c1cc85b2d26105a245427a369270ad4027769a5..fbf8e01ce18666fac8cda6937368dd0fd605c2b2 100644 --- a/Detector/DetDriftChamber/CMakeLists.txt +++ b/Detector/DetDriftChamber/CMakeLists.txt @@ -2,11 +2,6 @@ # Package: DetDriftChamber # Based on package: lcgeo ################################################################################ -gaudi_subdir(DetDriftChamber v0r0) - -gaudi_depends_on_subdirs(Detector/DetSegmentation) -#gaudi_depends_on_subdirs(GaudiKernel) - find_package(DD4hep COMPONENTS DDRec DDG4 DDParsers REQUIRED) find_package(Geant4) @@ -17,22 +12,21 @@ include( DD4hep ) find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED) -install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetDriftChamber) - -set(DetDriftChamber_src - src/driftchamber/DriftChamber.cpp -) +# install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetDriftChamber) gaudi_add_module(DetDriftChamber - ${DetDriftChamber_src} - INCLUDE_DIRS - # DD4hep ROOT Geant4 src/include - LINK_LIBRARIES GaudiKernel DD4hep ROOT DetSegmentation - # GaudiKernel - #DD4hep ${DD4hep_COMPONENT_LIBRARIES} + SOURCES src/driftchamber/DriftChamber.cpp + LINK DetSegmentation + ${DD4hep_COMPONENT_LIBRARIES} # ROOT Geant4 ) set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}") dd4hep_generate_rootmap(DetDriftChamber) + +install(TARGETS DetDriftChamber + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Detector/DetDriftChamber/compact/det.xml b/Detector/DetDriftChamber/compact/det.xml index f588fd48c9811cde95ae3577cc4991f6875b9e93..7ee0d9ae62e7700f6cffcb4770329e0383344907 100644 --- a/Detector/DetDriftChamber/compact/det.xml +++ b/Detector/DetDriftChamber/compact/det.xml @@ -22,17 +22,17 @@ <constant name="world_z" value="world_size"/> <!-- SDT --> - <constant name="SDT_radius_min" value="235*mm"/> - <constant name="SDT_radius_max" value="1716*mm"/> + <constant name="SDT_radius_min" value="234*mm"/> + <constant name="SDT_radius_max" value="1720*mm"/> <constant name="SDT_half_length" value="2225*mm"/> <constant name="SDT_length" value="SDT_half_length*2"/> - <constant name="SDT_inner_chamber_radius_min" value="SDT_radius_min"/> - <constant name="SDT_inner_chamber_radius_max" value="909*mm"/> + <constant name="SDT_inner_chamber_radius_min" value="235*mm"/> + <constant name="SDT_inner_chamber_radius_max" value="906*mm"/> <constant name="SDT_inner_chamber_length" value="SDT_length"/> <constant name="SDT_outer_chamber_radius_min" value="1085*mm"/> - <constant name="SDT_outer_chamber_radius_max" value="SDT_radius_max"/> + <constant name="SDT_outer_chamber_radius_max" value="1715*mm"/> <constant name="SDT_outer_chamber_length" value="SDT_length"/> <constant name="SDT_inner_chamber_layer_number" value="67"/> @@ -40,25 +40,49 @@ <constant name="SDT_chamber_layer_width" value="10*mm"/> <constant name="Epsilon" value="0*deg"/> + <constant name="SDT_inner_chamber_inner_wall_radius_min" value="234.8*mm"/> + <constant name="SDT_inner_chamber_inner_wall_radius_max" value="235*mm"/> + <constant name="SDT_inner_chamber_outer_wall_radius_min" value="906*mm"/> + <constant name="SDT_inner_chamber_outer_wall_radius_max" value="908.8*mm"/> + <constant name="SDT_outer_chamber_inner_wall_radius_min" value="1084.8*mm"/> + <constant name="SDT_outer_chamber_inner_wall_radius_max" value="1085*mm"/> + <constant name="SDT_outer_chamber_outer_wall_radius_min" value="1715*mm"/> + <constant name="SDT_outer_chamber_outer_wall_radius_max" value="1717.8*mm"/> + </define> <display> <vis name="Invisible" showDaughters="false" visible="false"/> <vis name="InvisibleWithChildren" showDaughters="true" visible="false"/> <vis name="VisibleRed" r="1.0" g="0.0" b="0.0" showDaughters="true" visible="true"/> - <vis name="VisibleBlue" r="0.0" g="0.0" b="1.0" showDaughters="false" visible="true"/> + <vis name="VisibleBlue" r="0.0" g="0.0" b="1.0" showDaughters="true" visible="true"/> <vis name="VisibleGreen" alpha="1.0" r="0.0" g="1.0" b="0.0" drawingStyle="solid" lineStyle="solid" showDaughters="true" visible="true"/> </display> + <regions> + <region name="DriftChamberRegion"> + </region> + </regions> + <detectors> - <detector id="1" name="DriftChamber" type="DriftChamber" readout="DriftChamberHitsCollection" vis="VisibleBlue" sensitive="true"> + <detector id="1" name="DriftChamber" type="DriftChamber" readout="DriftChamberHitsCollection" vis="VisibleBlue" sensitive="true" region="DriftChamberRegion"> <envelope vis="SeeThrough"> <shape type="BooleanShape" operation="Union" material="Air"> - <shape type="Tube" rmin="SDT_inner_chamber_radius_min" rmax="SDT_inner_chamber_radius_max" dz="SDT_half_length" /> - <shape type="Tube" rmin="SDT_outer_chamber_radius_min" rmax="SDT_outer_chamber_radius_max" dz="SDT_half_length" /> + <shape type="Tube" rmin="SDT_radius_min" rmax="909*mm" dz="SDT_half_length" /> + <shape type="Tube" rmin="1084.8*mm" rmax="SDT_radius_max" dz="SDT_half_length" /> </shape> </envelope> + <module id="0" name="SignalWire" type="Tube" rmin="0*mm" rmax="0.01*mm" vis="VisibleRed"> + <tubs name="W" type="Tube" rmin="0*mm" rmax="0.007*mm" material="Tungsten"/> + <tubs name="Au" type="Tube" rmin="0.007*mm" rmax="0.01*mm" material="Gold"/> + </module> + + <module id="1" name="FieldWire" type="Tube" rmin="0*mm" rmax="0.02*mm" vis="VisibleGreen"> + <tubs name="Al" type="Tube" rmin="0*mm" rmax="0.017*mm" material="Aluminum"/> + <tubs name="Ag" type="Tube" rmin="0.017*mm" rmax="0.02*mm" material="Silver"/> + </module> + <type_flags type="DetType_TRACKER + DetType_BARREL + DetType_GASEOUS + DetType_WIRE"/> <!-- Use cm as unit if you want to use Pandora for reconstruction --> <sensitive type="SimpleDriftChamber"/> diff --git a/Detector/DetDriftChamber/compact/materials.xml b/Detector/DetDriftChamber/compact/materials.xml index a86e3c48cccd159c8fa873bf65f60c66bc6378de..44ee58bf7f60632ec8addf1cee047ed2f259cb5b 100644 --- a/Detector/DetDriftChamber/compact/materials.xml +++ b/Detector/DetDriftChamber/compact/materials.xml @@ -148,5 +148,12 @@ <fraction n="0.671054" ref="Bi" /> </material> + <!-- Driftchamber: material for the drift chamber --> + <material name="GasHe_90Isob_10"> + <D value="0.0003983999999999999" unit="g/cm3" /> + <fraction n="0.3826351004462046" ref="He"/> + <fraction n="0.011371937371285891" ref="H" /> + <fraction n="0.6059929621825095" ref="C" /> + </material> </materials> diff --git a/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp b/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp index 79df65c47ef2a552b91127e6f9caf1592754e277..8a978ef41b86175dc1d95f4097e258be5f3bf9c5 100644 --- a/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp +++ b/Detector/DetDriftChamber/src/driftchamber/DriftChamber.cpp @@ -62,6 +62,10 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, double epsilon = theDetector.constant<double>("Epsilon"); + // - Only keep one chamber +// bool Close_inner_chamber = 1; +// bool Close_outer_chamber = 1; + // ======================================================================= // Detector Construction // ======================================================================= @@ -88,6 +92,57 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, dd4hep::Tube det_outer_chamber_solid(outer_chamber_radius_min, outer_chamber_radius_max, outer_chamber_length*0.5); dd4hep::Volume det_outer_chamber_vol(det_name+"_outer_chamber_vol", det_outer_chamber_solid, det_mat); + // - wall + double inner_chamber_inner_wall_rmin = theDetector.constant<double>("SDT_inner_chamber_inner_wall_radius_min"); + double inner_chamber_inner_wall_rmax = theDetector.constant<double>("SDT_inner_chamber_inner_wall_radius_max"); + double inner_chamber_outer_wall_rmin = theDetector.constant<double>("SDT_inner_chamber_outer_wall_radius_min"); + double inner_chamber_outer_wall_rmax = theDetector.constant<double>("SDT_inner_chamber_outer_wall_radius_max"); + double outer_chamber_outer_wall_rmin = theDetector.constant<double>("SDT_outer_chamber_outer_wall_radius_min"); + double outer_chamber_outer_wall_rmax = theDetector.constant<double>("SDT_outer_chamber_outer_wall_radius_max"); + double outer_chamber_inner_wall_rmin = theDetector.constant<double>("SDT_outer_chamber_inner_wall_radius_min"); + double outer_chamber_inner_wall_rmax = theDetector.constant<double>("SDT_outer_chamber_inner_wall_radius_max"); + + dd4hep::Material wall_mat(theDetector.material("CarbonFiber")); + + double wall_rmin[4] = {inner_chamber_inner_wall_rmin,inner_chamber_outer_wall_rmin,outer_chamber_inner_wall_rmin,outer_chamber_outer_wall_rmin}; + double wall_rmax[4] = {inner_chamber_inner_wall_rmax,inner_chamber_outer_wall_rmax,outer_chamber_inner_wall_rmax,outer_chamber_outer_wall_rmax}; + + // - wire + dd4hep::Volume module_vol; + dd4hep::Volume Module_vol; + for(xml_coll_t c(x_det,_U(module)); c; ++c) { + xml_comp_t x_module = c; + double module_rmin = x_module.rmin(); + double module_rmax = x_module.rmax(); + std::string module_name = x_module.nameStr(); + dd4hep::Tube module_solid(module_rmin,module_rmax,chamber_length*0.5); + if(x_module.id()==0) { + module_vol = dd4hep::Volume(module_name,module_solid,det_mat); + module_vol.setVisAttributes(theDetector.visAttributes(x_module.visStr())); + } else { + Module_vol = dd4hep::Volume(module_name,module_solid,det_mat); + Module_vol.setVisAttributes(theDetector.visAttributes(x_module.visStr())); + } + + for(xml_coll_t l(x_module,_U(tubs)); l; ++l) { + xml_comp_t x_tube =l; + double tube_rmin = x_tube.rmin(); + double tube_rmax = x_tube.rmax(); + std::string tube_name = x_tube.nameStr(); + std::string wire_name= module_name + tube_name; + dd4hep::Material tube_mat = theDetector.material(x_tube.materialStr()); + dd4hep::Tube wire_solid(tube_rmin,tube_rmax,chamber_length*0.5); + dd4hep::Volume wire_vol(wire_name,wire_solid,tube_mat); + dd4hep::Transform3D transform_wire(dd4hep::Rotation3D(),dd4hep::Position(0.,0.,0.)); + dd4hep::PlacedVolume wire_phy; + if(x_module.id()==0) { + wire_phy = module_vol.placeVolume(wire_vol,transform_wire); + } else { + wire_phy = Module_vol.placeVolume(wire_vol,transform_wire); + } + } + } + //Initialize the segmentation dd4hep::Readout readout = sd.readout(); dd4hep::Segmentation geomseg = readout.segmentation(); @@ -96,11 +151,11 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, auto DCHseg = dynamic_cast<dd4hep::DDSegmentation::GridDriftChamber*>(_geoSeg->segmentation()); // - layer - for(int layer_id = 0; layer_id < (inner_chamber_layer_number+outer_chamber_layer_number); layer_id++) { + for(int layer_id = 0; layer_id < (inner_chamber_layer_number+outer_chamber_layer_number); layer_id++) { double rmin,rmax,offset; std::string layer_name; dd4hep::Volume* current_vol_ptr = nullptr; - + dd4hep::Material layer_mat(theDetector.material("GasHe_90Isob_10")); if( layer_id < inner_chamber_layer_number ) { current_vol_ptr = &det_inner_chamber_vol; rmin = inner_chamber_radius_min+(layer_id*chamber_layer_width); @@ -129,7 +184,37 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, DCHseg->setWiresInLayer(layer_id, numWire); dd4hep::Tube layer_solid(rmin,rmax,chamber_length*0.5); - dd4hep::Volume layer_vol(layer_name,layer_solid,det_mat); + dd4hep::Volume layer_vol(layer_name,layer_solid,layer_mat); + layer_vol.setAttributes(theDetector,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); + + // - wire vol + //phi <-------------------> -phi + // | F8 F7 F6 F5| Only on the outermost layer. + // | | + // | S F4| + // | | + // | F0 F1 F2 F3| + // ----------------------- +// if(layer_id == 1|| layer_id == 2 || layer_id ==3) { + for(int icell=0; icell< numWire; icell++) { + double wire_phi = (icell+0.5)*layer_Phi + offset; + // - signal wire + dd4hep::Transform3D transform_module(dd4hep::Rotation3D(),dd4hep::Position(rmid*std::cos(wire_phi),rmid*std::sin(wire_phi),0.)); + dd4hep::PlacedVolume module_phy = layer_vol.placeVolume(module_vol,transform_module); + // - Field wire + dd4hep::PlacedVolume Module_phy; + double radius[9] = {rmid-chamber_layer_width*0.5,rmid-chamber_layer_width*0.5,rmid-chamber_layer_width*0.5,rmid-chamber_layer_width*0.5,rmid,rmid+chamber_layer_width*0.5,rmid+chamber_layer_width*0.5,rmid+chamber_layer_width*0.5,rmid+chamber_layer_width*0.5}; + double phi[9] = {wire_phi+layer_Phi*0.25,wire_phi,wire_phi-layer_Phi*0.25,wire_phi-layer_Phi*0.5,wire_phi-layer_Phi*0.5,wire_phi-layer_Phi*0.5,wire_phi-layer_Phi*0.25,wire_phi,wire_phi+layer_Phi*0.25}; + int num = 5; + if(layer_id==66||layer_id==129) { num = 9; } + for(int i=0; i<num ; i++) { + dd4hep::Position tr3D = Position(radius[i]*std::cos(phi[i]),radius[i]*std::sin(phi[i]),0.); + dd4hep::Transform3D transform_Module(dd4hep::Rotation3D(),tr3D); + Module_phy = layer_vol.placeVolume(Module_vol,transform_Module); + } + } +// } + dd4hep::Transform3D transform_layer(dd4hep::Rotation3D(),dd4hep::Position(0.,0.,0.)); dd4hep::PlacedVolume layer_phy = (*current_vol_ptr).placeVolume(layer_vol, transform_layer); layer_phy.addPhysVolID("layer",layer_id); @@ -143,23 +228,33 @@ static dd4hep::Ref_t create_detector(dd4hep::Detector& theDetector, // inner dd4hep::Transform3D transform_inner_chamber(dd4hep::Rotation3D(), dd4hep::Position(0,0,0)); +// if(Close_inner_chamber) { dd4hep::PlacedVolume det_inner_chamber_phy = det_vol.placeVolume(det_inner_chamber_vol, transform_inner_chamber); - - det_inner_chamber_phy.addPhysVolID("chamber", 0); + det_inner_chamber_phy.addPhysVolID("chamber", 0); +// } // outer dd4hep::Transform3D transform_outer_chamber(dd4hep::Rotation3D(), dd4hep::Position(0,0,0)); +// if(Close_outer_chamber) { dd4hep::PlacedVolume det_outer_chamber_phy = det_vol.placeVolume(det_outer_chamber_vol, transform_inner_chamber); - - det_outer_chamber_phy.addPhysVolID("chamber", 1); + det_outer_chamber_phy.addPhysVolID("chamber", 1); +// } // - place in world dd4hep::Transform3D transform(dd4hep::Rotation3D(), dd4hep::Position(0,0,0)); - dd4hep::PlacedVolume phv = envelope.placeVolume(det_vol,transform); + dd4hep::PlacedVolume phv = envelope.placeVolume(det_vol,transform); + // - place wall +// dd4hep::PlacedVolume wall_phy; + for(int i=0; i<4; i++) { + dd4hep::Tube wall_solid(wall_rmin[i],wall_rmax[i],chamber_length*0.5); + dd4hep::Volume wall_vol(det_name+"_wall_vol",wall_solid,wall_mat); + wall_vol.setVisAttributes(theDetector,"VisibleGreen"); + dd4hep::PlacedVolume wall_phy = envelope.placeVolume(wall_vol,transform); + } if ( x_det.hasAttr(_U(id)) ) { phv.addPhysVolID("system",x_det.id()); diff --git a/Detector/DetEcalMatrix/CMakeLists.txt b/Detector/DetEcalMatrix/CMakeLists.txt index 54407d226fed4c44d41a0294e3ac8a8f0ebef1db..10b59035d664eb2c7993dfa818738c2bb2541426 100644 --- a/Detector/DetEcalMatrix/CMakeLists.txt +++ b/Detector/DetEcalMatrix/CMakeLists.txt @@ -2,9 +2,6 @@ # Package: DetEcalMatrix # Based on package: lcgeo ################################################################################ -gaudi_subdir(DetEcalMatrix v0r0) - -gaudi_depends_on_subdirs(GaudiKernel) find_package(DD4hep COMPONENTS DDRec DDG4 DDParsers REQUIRED) @@ -16,22 +13,20 @@ include( DD4hep ) find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED) -install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetEcalMatrix) - -set(DetEcalMatrix_src - src/calorimeter/EcalMatrix.cpp -) - +# TODO: how to handle +# install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/compact DESTINATION Detector/DetEcalMatrix) gaudi_add_module(DetEcalMatrix - ${DetEcalMatrix_src} - INCLUDE_DIRS - # DD4hep ROOT Geant4 src/include - LINK_LIBRARIES - # GaudiKernel - DD4hep ${DD4hep_COMPONENT_LIBRARIES} - # ROOT Geant4 + SOURCES src/calorimeter/EcalMatrix.cpp + LINK ${DD4hep_COMPONENT_LIBRARIES} + # ROOT Geant4 ) set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}") dd4hep_generate_rootmap(DetEcalMatrix) + +install(TARGETS DetEcalMatrix + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Detector/DetInterface/CMakeLists.txt b/Detector/DetInterface/CMakeLists.txt index 0467315516667b8ae5ba630ab34301d072eeca84..d0365a9acd6a7e27ceaf1005443369c59409040b 100644 --- a/Detector/DetInterface/CMakeLists.txt +++ b/Detector/DetInterface/CMakeLists.txt @@ -1,8 +1,11 @@ ################################################################################ # Package: DetInterface ################################################################################ -gaudi_subdir(DetInterface v1r0) -gaudi_depends_on_subdirs(GaudiKernel) +gaudi_add_header_only_library(DetInterface) -gaudi_install_headers(DetInterface) +install(TARGETS DetInterface + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Detector/DetInterface/DetInterface/IGeomSvc.h b/Detector/DetInterface/include/DetInterface/IGeomSvc.h similarity index 100% rename from Detector/DetInterface/DetInterface/IGeomSvc.h rename to Detector/DetInterface/include/DetInterface/IGeomSvc.h diff --git a/Detector/DetSegmentation/CMakeLists.txt b/Detector/DetSegmentation/CMakeLists.txt index f6b2611e35080a64fdb67ecb30a2e67729a5364b..9b0273348b5b524c7624a6cc1016873e742fce96 100644 --- a/Detector/DetSegmentation/CMakeLists.txt +++ b/Detector/DetSegmentation/CMakeLists.txt @@ -1,33 +1,32 @@ ################################################################################# ##Package : DetSegmentation ################################################################################# -gaudi_subdir(DetSegmentation v1r0) - -gaudi_depends_on_subdirs(GaudiKernel) find_package(DD4hep COMPONENTS DDRec DDG4 DDParsers REQUIRED) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DD4hep_ROOT}/cmake ) include(DD4hep) -find_package(ROOT COMPONENTS MathCore Physics GenVector Geom REQUIRED) - gaudi_add_library(DetSegmentation - src/*.cpp - INCLUDE_DIRS DD4hep ROOT - LINK_LIBRARIES GaudiKernel DD4hep ROOT ${DD4hep_COMPONENT_LIBRARIES} - PUBLIC_HEADERS DetSegmentation) + SOURCES src/GridDriftChamber.cpp + LINK Gaudi::GaudiKernel + ${DD4hep_COMPONENT_LIBRARIES} + ${ROOT_LIBRARIES} +) gaudi_add_module(DetSegmentationPlugin - src/plugins/*.cpp - INCLUDE_DIRS DD4hep ROOT - LINK_LIBRARIES GaudiKernel DD4hep ROOT ${DD4hep_COMPONENT_LIBRARIES} DetSegmentation) + SOURCES src/plugins/SegmentationFactories.cpp + LINK Gaudi::GaudiKernel + ${ROOT_LIBRARIES} + ${DD4hep_COMPONENT_LIBRARIES} + DetSegmentation) set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}") dd4hep_generate_rootmap(DetSegmentationPlugin) -include(CTest) -gaudi_add_test(TestSegmentationPhiEta - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - FRAMEWORK tests/options/phiEtaSegmentation.py) +install(TARGETS DetSegmentation DetSegmentationPlugin + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Detector/DetSegmentation/DetSegmentation/GridDriftChamber.h b/Detector/DetSegmentation/include/DetSegmentation/GridDriftChamber.h similarity index 97% rename from Detector/DetSegmentation/DetSegmentation/GridDriftChamber.h rename to Detector/DetSegmentation/include/DetSegmentation/GridDriftChamber.h index 38e236c0d19d8b4419184510036b9db7e873e261..82a4e8f041b4a9934977fb4943b69a782fc4b37e 100644 --- a/Detector/DetSegmentation/DetSegmentation/GridDriftChamber.h +++ b/Detector/DetSegmentation/include/DetSegmentation/GridDriftChamber.h @@ -66,13 +66,10 @@ public: inline void setWiresInLayer(int layer, int numWires) { - double phi0; updateParams(layer); for (int i = 0; i<numWires; ++i) { - double phi0 = m_offset; - - auto phi_start = _currentLayerphi * i + phi0; + auto phi_start = _currentLayerphi * (i+0.5) + m_offset; auto phi_end = phi_start + _currentLayerphi; TVector3 Wstart = returnWirePosition(phi_start, 1); diff --git a/Detector/DetSegmentation/src/GridDriftChamber.cpp b/Detector/DetSegmentation/src/GridDriftChamber.cpp index c9cb9d50ed66d48130594f0afe718bae06e11f5a..d4facaaea91861aea6166c8d117d8823178f3b4f 100644 --- a/Detector/DetSegmentation/src/GridDriftChamber.cpp +++ b/Detector/DetSegmentation/src/GridDriftChamber.cpp @@ -56,13 +56,13 @@ CellID GridDriftChamber::cellID(const Vector3D& /*localPosition*/, const Vector3 _decoder->set(cID, m_phiID, lphi); -std::cout << "#######################################: " - << " offset : " << m_offset - << " offsetphi: " << offsetphi - << " layerID: " << layerID - << " r: " << _currentRadius - << " layerphi: " << _currentLayerphi - << std::endl; +// std::cout << "#######################################: " +// << " offset : " << m_offset +// << " offsetphi: " << offsetphi +// << " layerID: " << layerID +// << " r: " << _currentRadius +// << " layerphi: " << _currentLayerphi +// << std::endl; return cID; } diff --git a/Detector/GeomSvc/CMakeLists.txt b/Detector/GeomSvc/CMakeLists.txt index 58c69f7eaec67c8f136f0b002aa676dc5ed84fb1..137aa0e58561f914a5f8b194b5038c11b9f7d308 100644 --- a/Detector/GeomSvc/CMakeLists.txt +++ b/Detector/GeomSvc/CMakeLists.txt @@ -4,31 +4,18 @@ # Desc: implement the IGeomSvc interface. ############################################################################## -gaudi_subdir(GeomSvc v0r0) - -gaudi_depends_on_subdirs( - k4FWCore - Detector/DetInterface -) - -find_package(ROOT COMPONENTS MathCore GenVector Geom Tree) -find_package(DD4hep COMPONENTS DDG4 DDRec REQUIRED) -find_package(GEAR REQUIRED) - -message("GEAR_LIBRARIES: ${GEAR_LIBRARIES}") - gaudi_add_module(GeomSvc - src/GeomSvc.cpp - INCLUDE_DIRS - # DetInterface - # DD4hep - # GaudiKernel - # ROOT - LINK_LIBRARIES - DD4hep + SOURCES src/GeomSvc.cpp + LINK + DetInterface ${DD4hep_COMPONENT_LIBRARIES} - GaudiKernel + Gaudi::GaudiKernel ${GEAR_LIBRARIES} ${ROOT_LIBRARIES} - # ROOT ) + +install(TARGETS GeomSvc + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Detector/GeomSvc/src/GeomSvc.h b/Detector/GeomSvc/src/GeomSvc.h index 7c4207af96982af2e4f4055b07d5b4f67ee6cc2b..20d559a790c47c5f928d8db4a094f97b8cbeded7 100644 --- a/Detector/GeomSvc/src/GeomSvc.h +++ b/Detector/GeomSvc/src/GeomSvc.h @@ -57,9 +57,9 @@ private: dd4hep::Detector* m_dd4hep_geo; - gear::ZPlanarParametersImpl* m_vxdParameters; - dd4hep::rec::ZPlanarData* m_vxdData; - dd4hep::rec::ConicalSupportData* m_beamPipeData; + gear::ZPlanarParametersImpl* m_vxdParameters{nullptr}; + dd4hep::rec::ZPlanarData* m_vxdData{nullptr}; + dd4hep::rec::ConicalSupportData* m_beamPipeData{nullptr}; //gear::GearParametersImpl* m_vxdInfra; std::map<std::string, std::map<std::string,double> > m_detParameters; diff --git a/Digitisers/CMakeLists.txt b/Digitisers/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6f6f2e40403e248ab60d5ab5ddbe435334b0c29d --- /dev/null +++ b/Digitisers/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(DCHDigi) +add_subdirectory(G2CDArbor) +add_subdirectory(SimHitMerge) +add_subdirectory(SimpleDigi) diff --git a/Digitisers/DCHDigi/CMakeLists.txt b/Digitisers/DCHDigi/CMakeLists.txt index fa9dc143874c99b4550a6f7f259e0a962507bae6..8246da79bab1c211208b1f8ca28f5e117d564668 100644 --- a/Digitisers/DCHDigi/CMakeLists.txt +++ b/Digitisers/DCHDigi/CMakeLists.txt @@ -1,25 +1,19 @@ -gaudi_subdir(DCHDigi v0r0) - -find_package(CLHEP REQUIRED;CONFIG) -find_package(DD4hep COMPONENTS DDG4 REQUIRED) -find_package(EDM4HEP REQUIRED ) -include_directories(${EDM4HEP_INCLUDE_DIR}) - -find_package(podio REQUIRED ) -find_package(ROOT COMPONENTS MathCore Physics GenVector Geom REQUIRED) - -set(srcs - src/*.cpp -) - -gaudi_depends_on_subdirs( - Detector/DetInterface - Detector/DetSegmentation -) ## Modules -gaudi_add_module(DCHDigi ${srcs} - INCLUDE_DIRS k4FWCore GaudiKernel GaudiAlgLib ${CLHEP_INCLUDE_DIR} DD4hep ROOT - LINK_LIBRARIES k4FWCore GaudiKernel GaudiAlgLib ${CLHEP_LIBRARIES} DD4hep ${DD4hep_COMPONENT_LIBRARIES} DDRec ROOT DetSegmentation - -Wl,--no-as-needed - EDM4HEP::edm4hep EDM4HEP::edm4hepDict +gaudi_add_module(DCHDigi + SOURCES src/DCHDigiAlg.cpp + LINK DetInterface + DetSegmentation + k4FWCore::k4FWCore + Gaudi::GaudiKernel + Gaudi::GaudiAlgLib + ${CLHEP_LIBRARIES} + ${DD4hep_COMPONENT_LIBRARIES} + ${ROOT_LIBRARIES} + DetSegmentation + EDM4HEP::edm4hep EDM4HEP::edm4hepDict ) +install(TARGETS DCHDigi + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Digitisers/DCHDigi/src/DCHDigiAlg.cpp b/Digitisers/DCHDigi/src/DCHDigiAlg.cpp index d7c2949b4416a5d5e62809a620c3cb33f1b4d274..36783972a794fab389b648b8b36f772a3cf7ff06 100644 --- a/Digitisers/DCHDigi/src/DCHDigiAlg.cpp +++ b/Digitisers/DCHDigi/src/DCHDigiAlg.cpp @@ -8,6 +8,7 @@ #include "DD4hep/Detector.h" #include <DD4hep/Objects.h> +#include "DD4hep/DD4hepUnits.h" #include "DDRec/Vector3D.h" #include "GaudiKernel/INTupleSvc.h" @@ -109,9 +110,10 @@ StatusCode DCHDigiAlg::execute() id_hits_map[id] = vhit ; } } - - m_n_sim = 0; - m_n_digi = 0 ; + if(m_WriteAna){ + m_n_sim = 0; + m_n_digi = 0 ; + } for(std::map<unsigned long long, std::vector<edm4hep::SimTrackerHit> >::iterator iter = id_hits_map.begin(); iter != id_hits_map.end(); iter++) { unsigned long long wcellid = iter->first; @@ -133,8 +135,10 @@ StatusCode DCHDigiAlg::execute() TVector3 Wstart(0,0,0); TVector3 Wend (0,0,0); m_segmentation->cellposition(wcellid, Wstart, Wend); - Wstart = 10*Wstart;// from DD4HEP cm to mm - Wend = 10*Wend ; + float dd4hep_mm = dd4hep::mm; + //std::cout<<"dd4hep_mm="<<dd4hep_mm<<std::endl; + Wstart =(1/dd4hep_mm)* Wstart;// from DD4HEP cm to mm + Wend =(1/dd4hep_mm)* Wend ; //std::cout<<"wcellid="<<wcellid<<",chamber="<<chamber<<",layer="<<layer<<",cellID="<<cellID<<",s_x="<<Wstart.x()<<",s_y="<<Wstart.y()<<",s_z="<<Wstart.z()<<",E_x="<<Wend.x()<<",E_y="<<Wend.y()<<",E_z="<<Wend.z()<<std::endl; TVector3 denominator = (Wend-Wstart) ; diff --git a/Digitisers/G2CDArbor/CMakeLists.txt b/Digitisers/G2CDArbor/CMakeLists.txt index cbc70cd8ea041643734cd2e337dbb12516718e1b..cc6bf3892ef7ebbff268e2f9560acc8609699fbe 100644 --- a/Digitisers/G2CDArbor/CMakeLists.txt +++ b/Digitisers/G2CDArbor/CMakeLists.txt @@ -1,28 +1,20 @@ -gaudi_subdir(G2CDArbor v0r0) - -find_package(CLHEP REQUIRED;CONFIG) -find_package(DD4hep COMPONENTS DDG4 REQUIRED) -find_package(EDM4HEP REQUIRED) -find_package(GEAR REQUIRED) -find_package(GSL REQUIRED ) -find_package(LCIO REQUIRED ) -find_package(podio REQUIRED ) -find_package(k4FWCore REQUIRED) - -message("EDM4HEP_INCLUDE_DIRS: ${EDM4HEP_INCLUDE_DIR}") -message("EDM4HEP_LIB: ${EDM4HEP_LIBRARIES}") -include_directories(${EDM4HEP_INCLUDE_DIR}) - -gaudi_depends_on_subdirs( - Service/GearSvc - Detector/DetInterface -) - -set(G2CDArbor_srcs src/*.cpp) - # Modules -gaudi_add_module(G2CDArbor ${G2CDArbor_srcs} - INCLUDE_DIRS k4FWCore GaudiKernel GaudiAlgLib ${CLHEP_INCLUDE_DIR} DD4hep gear ${GSL_INCLUDE_DIRS} ${LCIO_INCLUDE_DIRS} - LINK_LIBRARIES k4FWCore GaudiKernel GaudiAlgLib ${CLHEP_LIBRARIES} DD4hep ${GEAR_LIBRARIES} ${GSL_LIBRARIES} ${LCIO_LIBRARIES} - EDM4HEP::edm4hep EDM4HEP::edm4hepDict +gaudi_add_module(G2CDArbor + SOURCES src/G2CDArborAlg.cpp + LINK k4FWCore::k4FWCore + GearSvc + DetInterface + Gaudi::GaudiKernel + Gaudi::GaudiAlgLib + ${CLHEP_LIBRARIES} + ${GEAR_LIBRARIES} + ${GSL_LIBRARIES} + ${LCIO_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict ) +install(TARGETS G2CDArbor + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) + diff --git a/Digitisers/G2CDArbor/src/G2CDArborAlg.h b/Digitisers/G2CDArbor/src/G2CDArborAlg.h index 4c9a1985d9da20adc45733d5dbd4fc37043dd1de..910675c9e930e4b3fe9a3c8390604898bf8dfaf2 100644 --- a/Digitisers/G2CDArbor/src/G2CDArborAlg.h +++ b/Digitisers/G2CDArbor/src/G2CDArborAlg.h @@ -3,7 +3,7 @@ #include "k4FWCore/DataHandle.h" #include "GaudiAlg/GaudiAlgorithm.h" -#include "GaudiKernel/Property.h" +#include "Gaudi/Property.h" #include "edm4hep/EventHeader.h" #include "edm4hep/EventHeaderCollection.h" #include "edm4hep/SimCalorimeterHitConst.h" diff --git a/Digitisers/SimHitMerge/CMakeLists.txt b/Digitisers/SimHitMerge/CMakeLists.txt index 680d80a9dde0329eb068a9b6fd913654495809be..4c89a1b84a5878fc6862bc1bf81e750551a2c7ed 100644 --- a/Digitisers/SimHitMerge/CMakeLists.txt +++ b/Digitisers/SimHitMerge/CMakeLists.txt @@ -1,20 +1,18 @@ -gaudi_subdir(SimHitMergeAlg v0r0) - -find_package(DD4hep COMPONENTS DDG4 REQUIRED) -find_package(EDM4HEP REQUIRED) -find_package(podio REQUIRED ) -find_package(k4FWCore REQUIRED) - -include_directories(${EDM4HEP_INCLUDE_DIR}) - -gaudi_depends_on_subdirs( - Detector/DetInterface -) -set(SimHitMergeAlg_srcs src/*.cpp) # Modules -gaudi_add_module(SimHitMerge ${SimHitMergeAlg_srcs} - INCLUDE_DIRS k4FWCore GaudiKernel GaudiAlgLib DD4hep - LINK_LIBRARIES k4FWCore GaudiKernel GaudiAlgLib DD4hep DDRec - EDM4HEP::edm4hep EDM4HEP::edm4hepDict +gaudi_add_module(SimHitMerge + SOURCES src/SimHitMergeAlg.cpp + LINK DetInterface + k4FWCore::k4FWCore + Gaudi::GaudiKernel + Gaudi::GaudiAlgLib + ${DD4hep_COMPONENT_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict ) + +install(TARGETS SimHitMerge + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) + diff --git a/Digitisers/SimHitMerge/src/SimHitMergeAlg.h b/Digitisers/SimHitMerge/src/SimHitMergeAlg.h index 8bded1c038538fdf346c858b4bdfe55c7796a8db..d91de40f0a111a99d9c0ca36f2e9177703e8ff96 100644 --- a/Digitisers/SimHitMerge/src/SimHitMergeAlg.h +++ b/Digitisers/SimHitMerge/src/SimHitMergeAlg.h @@ -3,7 +3,7 @@ #include "k4FWCore/DataHandle.h" #include "GaudiAlg/GaudiAlgorithm.h" -#include "GaudiKernel/Property.h" +#include "Gaudi/Property.h" #include "edm4hep/EventHeader.h" #include "edm4hep/EventHeaderCollection.h" #include "edm4hep/SimCalorimeterHitConst.h" diff --git a/Digitisers/SimpleDigi/CMakeLists.txt b/Digitisers/SimpleDigi/CMakeLists.txt index 052a27dfcf36b9fbc09f222a46ae20f5afdf96f4..4e2687bc123eeb14f5b013af3cf0461ec48605db 100644 --- a/Digitisers/SimpleDigi/CMakeLists.txt +++ b/Digitisers/SimpleDigi/CMakeLists.txt @@ -1,24 +1,24 @@ -gaudi_subdir(SimpleDigi v0r0) - -find_package(CLHEP REQUIRED;CONFIG) -find_package(GEAR REQUIRED) -find_package(GSL REQUIRED ) -find_package(LCIO REQUIRED ) -find_package(podio REQUIRED ) -find_package(k4FWCore REQUIRED) -find_package(EDM4HEP REQUIRED) - -gaudi_depends_on_subdirs( - Service/GearSvc - Service/EventSeeder - Service/TrackSystemSvc - Utilities/DataHelper -) - -set(SimpleDigi_srcs src/*.cpp) - # Modules -gaudi_add_module(SimpleDigi ${SimpleDigi_srcs} - INCLUDE_DIRS k4FWCore GaudiKernel GaudiAlgLib ${CLHEP_INCLUDE_DIR} gear ${GSL_INCLUDE_DIRS} ${LCIO_INCLUDE_DIRS} - LINK_LIBRARIES k4FWCore GaudiKernel GaudiAlgLib ${CLHEP_LIBRARIES} ${GEAR_LIBRARIES} ${GSL_LIBRARIES} ${LCIO_LIBRARIES} EDM4HEP::edm4hep EDM4HEP::edm4hepDict DataHelperLib +gaudi_add_module(SimpleDigi + SOURCES src/PlanarDigiAlg.cpp + src/TPCDigiAlg.cpp + src/voxel.cpp + LINK GearSvc + EventSeeder + TrackSystemSvcLib + DataHelperLib + k4FWCore::k4FWCore + Gaudi::GaudiKernel + Gaudi::GaudiAlgLib + ${CLHEP_LIBRARIES} + ${GEAR_LIBRARIES} + ${GSL_LIBRARIES} + ${LCIO_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict ) + +install(TARGETS SimpleDigi + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index e11457877fd94d615f12dcf8d5f7bd7388f91c24..6d37ea639a5354eb09dd50e37a86ce23a596654a 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -1,58 +1,33 @@ - -gaudi_subdir(Examples v0r0) - -find_package(podio REQUIRED) -#find_package(plcio REQUIRED) -find_package(LCIO REQUIRED) -find_package(EDM4HEP REQUIRED) -find_package(k4FWCore REQUIRED) -find_package(DD4hep COMPONENTS DDRec DDParsers REQUIRED) - -gaudi_depends_on_subdirs( - Detector/DetInterface -) - -set(Examples_srcs - src/HelloWorld/*.cpp - src/FirstSvc/*.cpp - src/SecondAlg/*.cpp - # src/PlcioTest/*.cpp - src/Edm4hepTest/*.cpp - src/DumpIDAlg/*.cpp -) - # Headers and Libraries -gaudi_install_headers(Examples) - # Modules -gaudi_add_module(Examples ${Examples_srcs} - INCLUDE_DIRS k4FWCore GaudiAlgLib GaudiKernel ${podio_INCLUDE_DIRS} ${LCIO_INCLUDE_DIRS} - LINK_LIBRARIES k4FWCore GaudiAlgLib GaudiKernel ${LCIO_LIBRARIES} - DD4hep ${DD4hep_COMPONENT_LIBRARIES} - # Force loading the libraries. - -Wl,--no-as-needed EDM4HEP::edm4hep EDM4HEP::edm4hepDict ${podio_LIBRARIES} podio::podioRootIO -Wl,--as-needed +gaudi_add_module(Examples + SOURCES src/HelloWorld/HelloAlg.cpp + src/FirstSvc/FirstSvc.cpp + src/SecondAlg/SecondAlg.cpp + src/Edm4hepTest/Edm4hepReadAlg.cpp + src/Edm4hepTest/Edm4hepReadDCAlg.cpp + src/Edm4hepTest/Edm4hepWriteAlg.cpp + src/DumpIDAlg/DumpIDAlg.cpp + LINK DetInterface + k4FWCore::k4FWCore + Gaudi::GaudiAlgLib Gaudi::GaudiKernel + ${LCIO_LIBRARIES} + ${DD4hep_COMPONENT_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict + ${podio_LIBRARIES} podio::podioRootIO ) -# Unit tests -gaudi_add_test(HelloAlg - FRAMEWORK options/helloalg.py) - -gaudi_add_test(SecondAlg - FRAMEWORK options/secondalg.py) - -gaudi_add_test(PlcioWriteAlg - FRAMEWORK options/plcio_write.py) - -gaudi_add_test(PlcioReadAlg - FRAMEWORK options/plcio_read.py) - -gaudi_add_test(Edm4hepWriteAlg - FRAMEWORK options/edm4hep_write.py) - -gaudi_add_test(Edm4hepReadAlg - FRAMEWORK options/edm4hep_read.py) +if (GenFit_FOUND) + target_link_libraries(Examples PUBLIC GenFit::genfit2) +endif() -gaudi_add_test(LCIOReadAlg - FRAMEWORK options/LCIO_read.py) +target_include_directories(Examples PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) +install(TARGETS Examples + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Examples/Examples/IFirstSvc.h b/Examples/include/Examples/IFirstSvc.h similarity index 100% rename from Examples/Examples/IFirstSvc.h rename to Examples/include/Examples/IFirstSvc.h diff --git a/Examples/options/LCIO_read_pan.py b/Examples/options/LCIO_read_pan.py index 2f91258cd4dba49776fed8a96d361598333e55bc..c1e8997ff94ba0302440d811d987c1f700d79d71 100644 --- a/Examples/options/LCIO_read_pan.py +++ b/Examples/options/LCIO_read_pan.py @@ -8,7 +8,8 @@ dsvc = k4DataSvc("EventDataSvc") from Configurables import LCIOInput read = LCIOInput("read") read.inputs = [ -"/cefs/higgs/wxfang/cepc/Pandora/CaloDigi/gamma/Digi_sim_1.slcio" +#"/cefs/higgs/wxfang/cepc/Pandora/ele_lcio_full_det_rec/reco_sim_0.slcio" +"/cefs/higgs/wxfang/cepc/Pandora/ele_lcio_full_det_rec/reco_sim_34.slcio" ] read.collections = [ "MCParticle:MCParticle", @@ -54,6 +55,7 @@ ntsvc.Output = ["MyTuples DATAFILE='LCIO_Pan_ana.root' OPT='NEW' TYP='ROOT'"] from Configurables import PandoraPFAlg pandoralg = PandoraPFAlg("PandoraPFAlg") +pandoralg.debug = False pandoralg.use_dd4hep_geo = False pandoralg.use_dd4hep_decoder = False pandoralg.use_preshower = False @@ -127,7 +129,7 @@ write.outputCommands = ["keep *"] # ApplicationMgr from Configurables import ApplicationMgr ApplicationMgr( - TopAlg = [read, pandoralg, write], + TopAlg = [read, pandoralg], EvtSel = 'NONE', EvtMax = 10, ExtSvc = [dsvc, gearSvc], diff --git a/Examples/options/sim-rec-trackerecal.py b/Examples/options/sim-rec-trackerecal.py new file mode 100644 index 0000000000000000000000000000000000000000..1117e414ab57dbc65ee71160ee28c5d3ca61af95 --- /dev/null +++ b/Examples/options/sim-rec-trackerecal.py @@ -0,0 +1,337 @@ +#!/usr/bin/env python + +from Gaudi.Configuration import * + +NTupleSvc().Output = ["MyTuples DATAFILE='sim-rec-trackerEcal.root' OPT='NEW' TYP='ROOT'"] + +from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_ +rndmengine = HepRndm__Engine_CLHEP__HepJamesRandom_() +rndmengine.SetSingleton = True +rndmengine.Seeds = [1] + +from Configurables import k4DataSvc +dsvc = k4DataSvc("EventDataSvc") + +from Configurables import MarlinEvtSeeder +evtseeder = MarlinEvtSeeder("EventSeeder") + +geometry_option = "CepC_v4-onlyTrackerECAL.xml" + +if not os.getenv("DETCEPCV4ROOT"): + print("Can't find the geometry. Please setup envvar DETCEPCV4ROOT." ) + sys.exit(-1) + +geometry_path = os.path.join(os.getenv("DETCEPCV4ROOT"), "compact", geometry_option) +if not os.path.exists(geometry_path): + print("Can't find the compact geometry file: %s"%geometry_path) + sys.exit(-1) + +from Configurables import GeomSvc +geosvc = GeomSvc("GeomSvc") +geosvc.compact = geometry_path + +from Configurables import GenAlgo +from Configurables import GtGunTool +from Configurables import StdHepRdr +from Configurables import SLCIORdr +from Configurables import HepMCRdr +from Configurables import GenPrinter + +gun = GtGunTool("GtGunTool") +gun.Particles = ["e-"] +#gun.EnergyMins = [1] +#gun.EnergyMaxs = [50] +#gun.ThetaMins = [50] +#gun.ThetaMaxs = [130] +#gun.PhiMins = [-90] +#gun.PhiMaxs = [90] +gun.EnergyMins = [10] +gun.EnergyMaxs = [10] +gun.ThetaMins = [90] +gun.ThetaMaxs = [90] +gun.PhiMins = [0] +gun.PhiMaxs = [0] + +genprinter = GenPrinter("GenPrinter") + +genalg = GenAlgo("GenAlgo") +genalg.GenTools = ["GtGunTool"] + +from Configurables import DetSimSvc +detsimsvc = DetSimSvc("DetSimSvc") + +from Configurables import DetSimAlg +detsimalg = DetSimAlg("DetSimAlg") +# detsimalg.VisMacs = ["vis.mac"] +detsimalg.RunCmds = [ +# "/physics_lists/factory/addOptical" +] +detsimalg.PhysicsList = "FTFP_BERT" +detsimalg.AnaElems = ["Edm4hepWriterAnaElemTool"] +detsimalg.RootDetElem = "WorldDetElemTool" + +from Configurables import AnExampleDetElemTool +example_dettool = AnExampleDetElemTool("AnExampleDetElemTool") + +from Configurables import TimeProjectionChamberSensDetTool +tpc_sensdettool = TimeProjectionChamberSensDetTool("TimeProjectionChamberSensDetTool") +tpc_sensdettool.TypeOption = 1 + +from Configurables import GearSvc +gearsvc = GearSvc("GearSvc") +gearsvc.GearXMLFile = "Detector/DetCEPCv4/compact/FullDetGear.xml" + +from Configurables import TrackSystemSvc +tracksystemsvc = TrackSystemSvc("TrackSystemSvc") + +vxdhitname = "VXDTrackerHits" +sithitname = "SITTrackerHits" +sitspname = "SITSpacePoints" +tpchitname = "TPCTrackerHits" +sethitname = "SETTrackerHits" +setspname = "SETSpacePoints" +ftdspname = "FTDSpacePoints" +ftdhitname = "FTDTrackerHits" +from Configurables import PlanarDigiAlg +digiVXD = PlanarDigiAlg("VXDDigi") +digiVXD.SimTrackHitCollection = "VXDCollection" +digiVXD.TrackerHitCollection = vxdhitname +digiVXD.ResolutionU = [0.0028, 0.006, 0.004, 0.004, 0.004, 0.004] +digiVXD.ResolutionV = [0.0028, 0.006, 0.004, 0.004, 0.004, 0.004] + +digiSIT = PlanarDigiAlg("SITDigi") +digiSIT.IsStrip = 1 +digiSIT.SimTrackHitCollection = "SITCollection" +digiSIT.TrackerHitCollection = sithitname +digiSIT.TrackerHitAssociationCollection = "SITTrackerHitAssociation" +digiSIT.ResolutionU = [0.007] +digiSIT.ResolutionV = [0.000] + +digiSET = PlanarDigiAlg("SETDigi") +digiSET.IsStrip = 1 +digiSET.SimTrackHitCollection = "SETCollection" +digiSET.TrackerHitCollection = sethitname +digiSET.TrackerHitAssociationCollection = "SETTrackerHitAssociation" +digiSET.ResolutionU = [0.007] +digiSET.ResolutionV = [0.000] + +digiFTD = PlanarDigiAlg("FTDDigi") +digiFTD.SimTrackHitCollection = "FTDCollection" +digiFTD.TrackerHitCollection = ftdhitname +digiFTD.TrackerHitAssociationCollection = "FTDTrackerHitAssociation" +digiFTD.ResolutionU = [0.003, 0.003, 0.007, 0.007, 0.007, 0.007, 0.007, 0.007] +digiFTD.ResolutionV = [0.003, 0.003, 0, 0, 0, 0, 0, 0 ] +#digiFTD.OutputLevel = DEBUG + +from Configurables import SpacePointBuilderAlg +spSIT = SpacePointBuilderAlg("SITBuilder") +spSIT.TrackerHitCollection = sithitname +spSIT.TrackerHitAssociationCollection = "SITTrackerHitAssociation" +spSIT.SpacePointCollection = sitspname +spSIT.SpacePointAssociationCollection = "SITSpacePointAssociation" +#spSIT.OutputLevel = DEBUG + +spFTD = SpacePointBuilderAlg("FTDBuilder") +spFTD.TrackerHitCollection = ftdhitname +spFTD.TrackerHitAssociationCollection = "FTDTrackerHitAssociation" +spFTD.SpacePointCollection = ftdspname +spFTD.SpacePointAssociationCollection = "FTDSpacePointAssociation" +#spFTD.OutputLevel = DEBUG + +from Configurables import TPCDigiAlg +digiTPC = TPCDigiAlg("TPCDigi") +digiTPC.TPCCollection = "TPCCollection" +digiTPC.TPCLowPtCollection = "TPCLowPtCollection" +digiTPC.TPCTrackerHitsCol = tpchitname +#digiTPC.OutputLevel = DEBUG + +from Configurables import ClupatraAlg +clupatra = ClupatraAlg("Clupatra") +clupatra.TPCHitCollection = tpchitname +#clupatra.OutputLevel = DEBUG + +from Configurables import SiliconTrackingAlg +tracking = SiliconTrackingAlg("SiliconTracking") +tracking.HeaderCol = "EventHeader" +tracking.VTXHitCollection = vxdhitname +tracking.SITHitCollection = sitspname +tracking.FTDPixelHitCollection = ftdhitname +tracking.FTDSpacePointCollection = ftdspname +tracking.SITRawHitCollection = sithitname +tracking.FTDRawHitCollection = ftdhitname +tracking.UseSIT = 1 +tracking.SmoothOn = 0 +#tracking.OutputLevel = DEBUG + +from Configurables import ForwardTrackingAlg +forward = ForwardTrackingAlg("ForwardTracking") +forward.FTDPixelHitCollection = ftdhitname +forward.FTDSpacePointCollection = ftdspname +forward.FTDRawHitCollection = ftdhitname +forward.Chi2ProbCut = 0.0 +forward.HitsPerTrackMin = 3 +forward.BestSubsetFinder = "SubsetSimple" +forward.Criteria = ["Crit2_DeltaPhi","Crit2_StraightTrackRatio","Crit3_3DAngle","Crit3_ChangeRZRatio","Crit3_IPCircleDist","Crit4_3DAngleChange","Crit4_DistToExtrapolation", + "Crit2_DeltaRho","Crit2_RZRatio","Crit3_PT"] +forward.CriteriaMin = [0, 0.9, 0, 0.995, 0, 0.8, 0, 20, 1.002, 0.1, 0, 0.99, 0, 0.999, 0, 0.99, 0] +forward.CriteriaMax = [30, 1.02, 10, 1.015, 20, 1.3, 1.0, 150, 1.08, 99999999, 0.8, 1.01, 0.35, 1.001, 1.5, 1.01, 0.05] +#forward.OutputLevel = DEBUG + +from Configurables import TrackSubsetAlg +subset = TrackSubsetAlg("TrackSubset") +subset.TrackInputCollections = ["ForwardTracks", "SiTracks"] +subset.RawTrackerHitCollections = [vxdhitname, sithitname, ftdhitname, sitspname, ftdspname] +subset.TrackSubsetCollection = "SubsetTracks" +#subset.OutputLevel = DEBUG + +from Configurables import FullLDCTrackingAlg +full = FullLDCTrackingAlg("FullTracking") +full.VTXTrackerHits = vxdhitname +full.SITTrackerHits = sitspname +full.TPCTrackerHits = tpchitname +full.SETTrackerHits = setspname +full.FTDPixelTrackerHits = ftdhitname +full.FTDSpacePoints = ftdspname +full.SITRawHits = sithitname +full.SETRawHits = sethitname +full.FTDRawHits = ftdhitname +full.TPCTracks = "ClupatraTracks" +full.SiTracks = "SubsetTracks" +full.OutputTracks = "MarlinTrkTracks" +#full.OutputLevel = DEBUG +''' +from Configurables import DumpMCParticleAlg +dumpMC = DumpMCParticleAlg("DumpMC") +dumpMC.MCParticleCollection = "MCParticle" + +from Configurables import DumpTrackAlg +dumpFu = DumpTrackAlg("DumpFu") +dumpFu.TrackCollection = "MarlinTrkTracks" +#dumpFu.OutputLevel = DEBUG + +dumpCl = DumpTrackAlg("DumpCl") +dumpCl.TrackCollection = "ClupatraTracks" +#dumpCl.OutputLevel = DEBUG + +dumpSu = DumpTrackAlg("DumpSu") +dumpSu.TrackCollection = "SubsetTracks" +#dumpSu.OutputLevel = DEBUG + +dumpSi = DumpTrackAlg("DumpSi") +dumpSi.TrackCollection = "SiTracks" +#dumpSi.OutputLevel = DEBUG + +dumpFo = DumpTrackAlg("DumpFo") +dumpFo.TrackCollection = "ForwardTracks" +#dumpFo.OutputLevel = DEBUG +''' +############################################################ +from Configurables import SimHitMergeAlg +simHitMerge = SimHitMergeAlg("SimHitMergeAlg") +simHitMerge.InputCollections=["EcalBarrelCollection", "EcalEndcapsCollection"] +simHitMerge.OutputCollections=["EcalBarrelCollectionMerged", "EcalEndcapsCollectionMerged"] +############################################################ + +from Configurables import G2CDArborAlg +caloDigi = G2CDArborAlg("G2CDArborAlg") +caloDigi.ReadLCIO = False +#caloDigi.CalibrECAL = [48.16, 96.32] +caloDigi.CalibrECAL = [46.538, 93.0769] +caloDigi.ECALCollections = ["EcalBarrelCollectionMerged", "EcalEndcapsCollectionMerged"] +caloDigi.ECALReadOutNames= ["EcalBarrelCollection", "EcalEndcapsCollection"] +caloDigi.DigiECALCollection = ["ECALBarrel", "ECALEndcap"] +caloDigi.HCALCollections = [] +caloDigi.HCALReadOutNames= [] +caloDigi.DigiHCALCollection = [] +caloDigi.EventReportEvery = 100 +############################################################################## +from Configurables import PandoraPFAlg + +pandoralg = PandoraPFAlg("PandoraPFAlg") +pandoralg.debug = False +pandoralg.use_dd4hep_geo = True +pandoralg.use_dd4hep_decoder = True +pandoralg.use_preshower = False +pandoralg.WriteAna = True +pandoralg.collections = [ + "MCParticle:MCParticle", + "CalorimeterHit:ECALBarrel", + "CalorimeterHit:ECALEndcap", + "CalorimeterHit:ECALOther" , + "CalorimeterHit:HCALBarrel", + "CalorimeterHit:HCALEndcap", + "CalorimeterHit:HCALOther" , + "CalorimeterHit:MUON", + "CalorimeterHit:LCAL", + "CalorimeterHit:LHCAL", + "CalorimeterHit:BCAL", + "Vertex:KinkVertices", + "Vertex:ProngVertices", + "Vertex:SplitVertices", + "Vertex:V0Vertices", + "Track:MarlinTrkTracks", + "MCRecoCaloAssociation:MCRecoCaloAssociationCollection" + ] +pandoralg.WriteClusterCollection = "PandoraClusters" +pandoralg.WriteReconstructedParticleCollection = "PandoraPFOs" +pandoralg.WriteVertexCollection = "PandoraPFANewStartVertices" + +pandoralg.PandoraSettingsDefault_xml = "Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml" +#### Do not chage the collection name, only add or remove ############### +pandoralg.TrackCollections = ["MarlinTrkTracks"] +pandoralg.ECalCaloHitCollections= ["ECALBarrel" , "ECALEndcap" , "ECALOther"] +pandoralg.ECalReadOutNames = ["EcalBarrelCollection", "EcalEndcapsCollection", "ECALOther"] +pandoralg.HCalCaloHitCollections= ["HCALBarrel", "HCALEndcap", "HCALOther"] +pandoralg.HCalReadOutNames = ["HcalBarrelCollection", "HcalEndcapsCollection", "HCALOther"] +pandoralg.LCalCaloHitCollections= ["LCAL"] +pandoralg.LCalReadOutNames = ["LcalCollection"] +pandoralg.LHCalCaloHitCollections= ["LHCAL"] +pandoralg.LHCalReadOutNames = ["LHcalCollection"] +pandoralg.MuonCaloHitCollections= ["MUON"] +pandoralg.MuonCalReadOutNames = ["MuoncalCollection"] +pandoralg.MCParticleCollections = ["MCParticle"] +pandoralg.RelCaloHitCollections = ["MCRecoCaloAssociationCollection"] +pandoralg.RelTrackCollections = ["MarlinTrkTracksMCTruthLink"] +pandoralg.KinkVertexCollections = ["KinkVertices"] +pandoralg.ProngVertexCollections= ["ProngVertices"] +pandoralg.SplitVertexCollections= ["SplitVertices"] +pandoralg.V0VertexCollections = ["V0Vertices"] +pandoralg.ECalToMipCalibration = 160.0 +pandoralg.HCalToMipCalibration = 34.8 +pandoralg.ECalMipThreshold = 0.5 +pandoralg.HCalMipThreshold = 0.3 +pandoralg.ECalToEMGeVCalibration= 0.9 #for G2CD Digi, 1.007 for NewLDCaloDigi +pandoralg.HCalToEMGeVCalibration= 1.007 +pandoralg.ECalToHadGeVCalibrationBarrel= 1.12 #very small effect +pandoralg.ECalToHadGeVCalibrationEndCap= 1.12 +pandoralg.HCalToHadGeVCalibration= 1.07 +pandoralg.MuonToMipCalibration= 10.0 +pandoralg.DigitalMuonHits= 0 +pandoralg.MaxHCalHitHadronicEnergy = 1.0 +pandoralg.UseOldTrackStateCalculation= 0 +pandoralg.AbsorberRadLengthECal= 0.2854 #= 1/3.504 mm +pandoralg.AbsorberIntLengthECal= 0.0101 #= 1/99.46 mm +pandoralg.AbsorberRadLengthHCal= 0.0569 +pandoralg.AbsorberIntLengthHCal= 0.006 +pandoralg.AbsorberRadLengthOther= 0.0569 +pandoralg.AbsorberIntLengthOther= 0.006 + +############################################################################## + +# write PODIO file +from Configurables import PodioOutput +write = PodioOutput("write") +write.filename = "test.root" +write.outputCommands = ["keep *"] + +# ApplicationMgr +from Configurables import ApplicationMgr +ApplicationMgr( + #TopAlg = [genalg, detsimalg, digiVXD, digiSIT, digiSET, digiFTD, spSIT, spFTD, digiTPC, clupatra, tracking, forward, subset, full, dumpMC, dumpFu, dumpCl, dumpSu, dumpSi, dumpFo, write], + TopAlg = [genalg, detsimalg, digiVXD, digiSIT, digiSET, digiFTD, spSIT, spFTD, digiTPC, clupatra, tracking, forward, subset, full, simHitMerge, caloDigi, pandoralg, write], + EvtSel = 'NONE', + EvtMax = 10, + ExtSvc = [rndmengine, dsvc, evtseeder, gearsvc, geosvc, tracksystemsvc], + HistogramPersistency='ROOT', + OutputLevel=INFO +) diff --git a/Examples/options/tut_analysis_TotalInvMass.py b/Examples/options/tut_analysis_TotalInvMass.py new file mode 100644 index 0000000000000000000000000000000000000000..eb7faebb30a6907790371ff4677735c2ece03b11 --- /dev/null +++ b/Examples/options/tut_analysis_TotalInvMass.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +from Gaudi.Configuration import * + +from Configurables import k4DataSvc +dsvc = k4DataSvc("EventDataSvc") + +# read LCIO files +from Configurables import k4LCIOInput +lcioinput = k4LCIOInput("k4LCIOInput") + +import glob + +# inputlists = ["/cefs/higgs/yudan/CEPC240/Reco_tpc_1800/qqh/Reco_qqh__00001.slcio"] +inputlists = ["/cefs/higgs/yudan/CEPC240/Reco_tpc_1800/qqh/Reco_qqh__00003.slcio"] +# inputlists = glob.glob("/cefs/higgs/yudan/CEPC240/Reco_tpc_1800/qqh/Reco_qqh__*.slcio") + +lcioinput.inputs = inputlists +lcioinput.collections = [ + "MCParticle:MCParticle", + "CalorimeterHit:ECALBarrel", + "CalorimeterHit:ECALEndcap", + "CalorimeterHit:HCALBarrel", + "CalorimeterHit:HCALEndcap", + "CalorimeterHit:HCALOther", + "ReconstructedParticle:AncientPFOs", + "ReconstructedParticle:ArborLICHPFOs" +] + +from Configurables import TotalInvMass +total_inv_mass = TotalInvMass("TotalInvMass") + +# # write PODIO file +# from Configurables import PodioOutput +# write = PodioOutput("write") +# write.filename = "test.root" +# write.outputCommands = ["keep *"] + +# ApplicationMgr +from Configurables import ApplicationMgr +ApplicationMgr( + TopAlg = [lcioinput, total_inv_mass], + EvtSel = 'NONE', + EvtMax = -1, + ExtSvc = [dsvc], + OutputLevel=INFO #DEBUG +) + diff --git a/Examples/options/tut_detsim_SDT.py b/Examples/options/tut_detsim_SDT.py index 779454ac323fdd87a20415dd3e3193dfbf643b14..d040cbd404134e03eda3f52604e6dcf3eb3b0e0b 100644 --- a/Examples/options/tut_detsim_SDT.py +++ b/Examples/options/tut_detsim_SDT.py @@ -36,7 +36,7 @@ dsvc = k4DataSvc("EventDataSvc") geometry_option = "det.xml" if not os.getenv("DETDRIFTCHAMBERROOT"): - print("Can't find the geometry. Please setup envvar DETCEPCV4ROOT." ) + print("Can't find the geometry. Please setup envvar DETDRIFTCHAMBERROOT." ) sys.exit(-1) geometry_path = os.path.join(os.getenv("DETDRIFTCHAMBERROOT"), "compact", geometry_option) @@ -117,6 +117,13 @@ if int(os.environ.get("VIS", 0)): detsimalg.RunCmds = [ # "/tracking/verbose 1", ] + +from Configurables import DummyFastSimG4Tool +dummy_fastsim_tool = DummyFastSimG4Tool("DummyFastSimG4Tool") + +detsimalg.FastSimG4Tools = [ + "DummyFastSimG4Tool" +] detsimalg.AnaElems = [ # example_anatool.name() # "ExampleAnaElemTool" diff --git a/Examples/options/tut_detsim_digi_truthTracker_SDT.py b/Examples/options/tut_detsim_digi_truthTracker_SDT.py new file mode 100644 index 0000000000000000000000000000000000000000..a5fd439aa790627b439c51e0146b233b5069399a --- /dev/null +++ b/Examples/options/tut_detsim_digi_truthTracker_SDT.py @@ -0,0 +1,200 @@ +#!/usr/bin/env python + +import os +print(os.environ["DD4HEP_LIBRARY_PATH"]) +import sys +# sys.exit(0) + +from Gaudi.Configuration import * + +############################################################################## +# Random Number Svc +############################################################################## +from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_ + +# rndmengine = HepRndm__Engine_CLHEP__RanluxEngine_() # The default engine in Gaudi +rndmengine = HepRndm__Engine_CLHEP__HepJamesRandom_() # The default engine in Geant4 +rndmengine.SetSingleton = True +rndmengine.Seeds = [42] + +# rndmgensvc = RndmGenSvc("RndmGenSvc") +# rndmgensvc.Engine = rndmengine.name() + + +############################################################################## +# Event Data Svc +############################################################################## +from Configurables import k4DataSvc +dsvc = k4DataSvc("EventDataSvc") + + +############################################################################## +# Geometry Svc +############################################################################## + +# geometry_option = "CepC_v4-onlyTracker.xml" +geometry_option = "det.xml" + +if not os.getenv("DETDRIFTCHAMBERROOT"): + print("Can't find the geometry. Please setup envvar DETCEPCV4ROOT." ) + sys.exit(-1) + +geometry_path = os.path.join(os.getenv("DETDRIFTCHAMBERROOT"), "compact", geometry_option) +if not os.path.exists(geometry_path): + print("Can't find the compact geometry file: %s"%geometry_path) + sys.exit(-1) + +from Configurables import GeomSvc +geosvc = GeomSvc("GeomSvc") +geosvc.compact = geometry_path + +############################################################################## +# Physics Generator +############################################################################## +from Configurables import GenAlgo +from Configurables import GtGunTool +from Configurables import StdHepRdr +from Configurables import SLCIORdr +from Configurables import HepMCRdr +from Configurables import GenPrinter + +gun = GtGunTool("GtGunTool") +# gun.Particles = ["pi+"] +# gun.EnergyMins = [100.] # GeV +# gun.EnergyMaxs = [100.] # GeV + +gun.Particles = ["e-"] + +# gun.PositionXs = [100.] # mm +# gun.PositionYs = [100.] # mm +# gun.PositionZs = [0.] # mm + + +gun.EnergyMins = [10.] # GeV +gun.EnergyMaxs = [10.] # GeV + +gun.ThetaMins = [90] # rad; 45deg +gun.ThetaMaxs = [90] # rad; 45deg + +gun.PhiMins = [90] # rad; 0deg +gun.PhiMaxs = [90] # rad; 360deg +#gun.PhiMins = [0] # rad; 0deg +#gun.PhiMaxs = [360] # rad; 360deg + +# stdheprdr = StdHepRdr("StdHepRdr") +# stdheprdr.Input = "/cefs/data/stdhep/CEPC250/2fermions/E250.Pbhabha.e0.p0.whizard195/bhabha.e0.p0.00001.stdhep" + +# lciordr = SLCIORdr("SLCIORdr") +# lciordr.Input = "/cefs/data/stdhep/lcio250/signal/Higgs/E250.Pbbh.whizard195/E250.Pbbh_X.e0.p0.whizard195/Pbbh_X.e0.p0.00001.slcio" + +# hepmcrdr = HepMCRdr("HepMCRdr") +# hepmcrdr.Input = "example_UsingIterators.txt" + +genprinter = GenPrinter("GenPrinter") + +genalg = GenAlgo("GenAlgo") +genalg.GenTools = ["GtGunTool"] +# genalg.GenTools = ["StdHepRdr"] +# genalg.GenTools = ["StdHepRdr", "GenPrinter"] +# genalg.GenTools = ["SLCIORdr", "GenPrinter"] +# genalg.GenTools = ["HepMCRdr", "GenPrinter"] + +############################################################################## +# Detector Simulation +############################################################################## +from Configurables import DetSimSvc + +detsimsvc = DetSimSvc("DetSimSvc") + +# from Configurables import ExampleAnaElemTool +# example_anatool = ExampleAnaElemTool("ExampleAnaElemTool") + +from Configurables import DetSimAlg + +detsimalg = DetSimAlg("DetSimAlg") + +if int(os.environ.get("VIS", 0)): + detsimalg.VisMacs = ["vis.mac"] + +detsimalg.RunCmds = [ +# "/tracking/verbose 1", +] +detsimalg.AnaElems = [ + # example_anatool.name() + # "ExampleAnaElemTool" + "Edm4hepWriterAnaElemTool" +] +detsimalg.RootDetElem = "WorldDetElemTool" + +from Configurables import AnExampleDetElemTool +example_dettool = AnExampleDetElemTool("AnExampleDetElemTool") + +from Configurables import CalorimeterSensDetTool +from Configurables import DriftChamberSensDetTool + +calo_sensdettool = CalorimeterSensDetTool("CalorimeterSensDetTool") +driftchamber_sensdettool = DriftChamberSensDetTool("DriftChamberSensDetTool") + +# dedxoption = "DummyDedxSimTool" +dedxoption = "BetheBlochEquationDedxSimTool" + +driftchamber_sensdettool.DedxSimTool = dedxoption + +from Configurables import DummyDedxSimTool +from Configurables import BetheBlochEquationDedxSimTool + +if dedxoption == "DummyDedxSimTool": + dedx_simtool = DummyDedxSimTool("DummyDedxSimTool") +elif dedxoption == "BetheBlochEquationDedxSimTool": + dedx_simtool = BetheBlochEquationDedxSimTool("BetheBlochEquationDedxSimTool") + dedx_simtool.material_Z = 2 + dedx_simtool.material_A = 4 + dedx_simtool.scale = 10 + dedx_simtool.resolution = 0.0001 + +############################################################################## +from Configurables import NTupleSvc +ntsvc = NTupleSvc("NTupleSvc") +ntsvc.Output = ["MyTuples DATAFILE='DCH_digi_ana.root' OPT='NEW' TYP='ROOT'"] + +############################################################################## +# DCHDigiAlg +############################################################################## +from Configurables import DCHDigiAlg +dCHDigiAlg = DCHDigiAlg("DCHDigiAlg") +dCHDigiAlg.readout = "DriftChamberHitsCollection" +dCHDigiAlg.drift_velocity = 40#um/ns +dCHDigiAlg.mom_threshold = 0 #GeV +dCHDigiAlg.SimDCHitCollection = "DriftChamberHitsCollection" +dCHDigiAlg.DigiDCHitCollection = "DigiDCHitsCollection" +dCHDigiAlg.AssociationCollection = "DCHAssociationCollectio" +dCHDigiAlg.WriteAna = True + +############################################################################## +# TruthTrackerAlg +############################################################################## +from Configurables import TruthTrackerAlg +truthTrackerAlg = TruthTrackerAlg("TruthTrackerAlg") +truthTrackerAlg.DCHitAssociationCollection="DCHAssociationCollectio" +truthTrackerAlg.debug = 1 + +############################################################################## +# POD I/O +############################################################################## +from Configurables import PodioOutput +out = PodioOutput("outputalg") +out.filename = "truthRec_DCH.root" +out.outputCommands = ["keep *"] + +############################################################################## +# ApplicationMgr +############################################################################## + +from Configurables import ApplicationMgr +ApplicationMgr( TopAlg = [genalg, detsimalg, dCHDigiAlg, truthTrackerAlg, out], + EvtSel = 'NONE', + EvtMax = 10, + ExtSvc = [rndmengine, dsvc, geosvc], + HistogramPersistency = "ROOT", + OutputLevel=INFO +) diff --git a/Examples/options/tut_detsim_digi_truthTracker_SDT_dedx.py b/Examples/options/tut_detsim_digi_truthTracker_SDT_dedx.py new file mode 100644 index 0000000000000000000000000000000000000000..892572df60aac3d093d145135c7872e4506e9409 --- /dev/null +++ b/Examples/options/tut_detsim_digi_truthTracker_SDT_dedx.py @@ -0,0 +1,222 @@ +#!/usr/bin/env python + +import os +print(os.environ["DD4HEP_LIBRARY_PATH"]) +import sys +# sys.exit(0) + +from Gaudi.Configuration import * + +############################################################################## +# Random Number Svc +############################################################################## +from Configurables import RndmGenSvc, HepRndm__Engine_CLHEP__RanluxEngine_ + +# rndmengine = HepRndm__Engine_CLHEP__RanluxEngine_() # The default engine in Gaudi +rndmengine = HepRndm__Engine_CLHEP__HepJamesRandom_() # The default engine in Geant4 +rndmengine.SetSingleton = True +rndmengine.Seeds = [42] + +# rndmgensvc = RndmGenSvc("RndmGenSvc") +# rndmgensvc.Engine = rndmengine.name() + + +############################################################################## +# Event Data Svc +############################################################################## +from Configurables import k4DataSvc +dsvc = k4DataSvc("EventDataSvc") + + +############################################################################## +# Geometry Svc +############################################################################## + +# geometry_option = "CepC_v4-onlyTracker.xml" +geometry_option = "det.xml" + +if not os.getenv("DETDRIFTCHAMBERROOT"): + print("Can't find the geometry. Please setup envvar DETCEPCV4ROOT." ) + sys.exit(-1) + +geometry_path = os.path.join(os.getenv("DETDRIFTCHAMBERROOT"), "compact", geometry_option) +if not os.path.exists(geometry_path): + print("Can't find the compact geometry file: %s"%geometry_path) + sys.exit(-1) + +from Configurables import GeomSvc +geosvc = GeomSvc("GeomSvc") +geosvc.compact = geometry_path +#geosvc.compact = "/workfs/higgs/fangwx/fork_DedxAlg_20201217/CEPCSW/Detector/DetCRD/compact/CRD_o1_v01/CRD_o1_v01.xml" +#geosvc.compact = "/workfs/higgs/fangwx/fork_DedxAlg_20201217/CEPCSW/Detector/DetCRD/compact/CRD_o1_v01/CRD_o1_v01_DCH.xml" +############################################################################## +# Physics Generator +############################################################################## +from Configurables import GenAlgo +from Configurables import GtGunTool +from Configurables import StdHepRdr +from Configurables import SLCIORdr +from Configurables import HepMCRdr +from Configurables import GenPrinter + +gun = GtGunTool("GtGunTool") +# gun.Particles = ["pi+"] +# gun.EnergyMins = [100.] # GeV +# gun.EnergyMaxs = [100.] # GeV + + +# gun.PositionXs = [100.] # mm +# gun.PositionYs = [100.] # mm +# gun.PositionZs = [0.] # mm + +gun.Particles = ["K-"] + +gun.EnergyMins = [0.1] # GeV +gun.EnergyMaxs = [20] # GeV + +gun.ThetaMins = [90] # rad; 45deg +gun.ThetaMaxs = [90] # rad; 45deg + +gun.PhiMins = [90] # rad; 0deg +gun.PhiMaxs = [90] # rad; 360deg +#gun.PhiMins = [0] # rad; 0deg +#gun.PhiMaxs = [360] # rad; 360deg + +# stdheprdr = StdHepRdr("StdHepRdr") +# stdheprdr.Input = "/cefs/data/stdhep/CEPC250/2fermions/E250.Pbhabha.e0.p0.whizard195/bhabha.e0.p0.00001.stdhep" + +# lciordr = SLCIORdr("SLCIORdr") +# lciordr.Input = "/cefs/data/stdhep/lcio250/signal/Higgs/E250.Pbbh.whizard195/E250.Pbbh_X.e0.p0.whizard195/Pbbh_X.e0.p0.00001.slcio" + +# hepmcrdr = HepMCRdr("HepMCRdr") +# hepmcrdr.Input = "example_UsingIterators.txt" + +genprinter = GenPrinter("GenPrinter") + +genalg = GenAlgo("GenAlgo") +genalg.GenTools = ["GtGunTool"] +# genalg.GenTools = ["StdHepRdr"] +# genalg.GenTools = ["StdHepRdr", "GenPrinter"] +# genalg.GenTools = ["SLCIORdr", "GenPrinter"] +# genalg.GenTools = ["HepMCRdr", "GenPrinter"] + +############################################################################## +# Detector Simulation +############################################################################## +from Configurables import DetSimSvc + +detsimsvc = DetSimSvc("DetSimSvc") + +# from Configurables import ExampleAnaElemTool +# example_anatool = ExampleAnaElemTool("ExampleAnaElemTool") + +from Configurables import DetSimAlg + +detsimalg = DetSimAlg("DetSimAlg") +#detsimalg.RunMacs = ["Examples/options/noDecay.mac"] +#detsimalg.RunCmds = ["Examples/options/noDecay.mac"] + +if int(os.environ.get("VIS", 0)): + detsimalg.VisMacs = ["vis.mac"] + +detsimalg.RunCmds = [ +# "/tracking/verbose 1", +] +detsimalg.AnaElems = [ + # example_anatool.name() + # "ExampleAnaElemTool" + "Edm4hepWriterAnaElemTool" +] +detsimalg.RootDetElem = "WorldDetElemTool" + +from Configurables import AnExampleDetElemTool +example_dettool = AnExampleDetElemTool("AnExampleDetElemTool") + +from Configurables import CalorimeterSensDetTool +from Configurables import DriftChamberSensDetTool + +calo_sensdettool = CalorimeterSensDetTool("CalorimeterSensDetTool") +driftchamber_sensdettool = DriftChamberSensDetTool("DriftChamberSensDetTool") + +# dedxoption = "DummyDedxSimTool" +dedxoption = "BetheBlochEquationDedxSimTool" + +driftchamber_sensdettool.DedxSimTool = dedxoption + +from Configurables import DummyDedxSimTool +from Configurables import BetheBlochEquationDedxSimTool + +if dedxoption == "DummyDedxSimTool": + dedx_simtool = DummyDedxSimTool("DummyDedxSimTool") +elif dedxoption == "BetheBlochEquationDedxSimTool": + dedx_simtool = BetheBlochEquationDedxSimTool("BetheBlochEquationDedxSimTool") + dedx_simtool.material_Z = 7 # approximate to Air + dedx_simtool.material_A = 14 + dedx_simtool.scale = 1 + dedx_simtool.resolution = 0 + +############################################################################## +from Configurables import NTupleSvc +ntsvc = NTupleSvc("NTupleSvc") +ntsvc.Output = ["MyTuples DATAFILE='Dedx_ana.root' OPT='NEW' TYP='ROOT'"] + +############################################################################## +# DCHDigiAlg +############################################################################## +from Configurables import DCHDigiAlg +dCHDigiAlg = DCHDigiAlg("DCHDigiAlg") +dCHDigiAlg.readout = "DriftChamberHitsCollection" +dCHDigiAlg.drift_velocity = 40#um/ns +dCHDigiAlg.mom_threshold = 0 #GeV +dCHDigiAlg.SimDCHitCollection = "DriftChamberHitsCollection" +dCHDigiAlg.DigiDCHitCollection = "DigiDCHitsCollection" +dCHDigiAlg.AssociationCollection = "DCHAssociationCollection" +dCHDigiAlg.WriteAna = False + +############################################################################## +# TruthTrackerAlg +############################################################################## +from Configurables import TruthTrackerAlg +truthTrackerAlg = TruthTrackerAlg("TruthTrackerAlg") +truthTrackerAlg.MCParticle= "MCParticle" +truthTrackerAlg.DigiDCHitCollection="DigiDCHitsCollection" +truthTrackerAlg.DCHitAssociationCollection="DCHAssociationCollection" +truthTrackerAlg.DCTrackCollection="DCTrackCollection" +truthTrackerAlg.debug = 1 + +############################################################################## +# DedxAlg +############################################################################## +from Configurables import GFDndxSimTool +dndx_simtool = GFDndxSimTool("GFDndxSimTool") +from Configurables import RecDCHDedxAlg +dedxAlg = RecDCHDedxAlg("RecDCHDedxAlg") +dedxAlg.debug = True +#dedxAlg.method = 1 +#dedxAlg.sampling_option = "BetheBlochEquationDedxSimTool" +dedxAlg.method = 2 +dedxAlg.sampling_option = "GFDndxSimTool" +dedxAlg.dedx_resolution = 0.0 +dedxAlg.DCTrackCollection = "DCTrackCollection" +dedxAlg.DCHitAssociationCollection = "DCHAssociationCollection" +dedxAlg.WriteAna = True +############################################################################## +# POD I/O +############################################################################## +from Configurables import PodioOutput +out = PodioOutput("outputalg") +out.filename = "DedxAlg.root" +out.outputCommands = ["keep *"] + +############################################################################## +# ApplicationMgr +############################################################################## + +from Configurables import ApplicationMgr +ApplicationMgr( TopAlg = [genalg, detsimalg, dCHDigiAlg, truthTrackerAlg, dedxAlg], + EvtSel = 'NONE', + EvtMax = 10, + ExtSvc = [rndmengine, dsvc, geosvc], + HistogramPersistency = "ROOT", + OutputLevel=INFO +) diff --git a/Examples/options/tut_detsim_pandora.py b/Examples/options/tut_detsim_pandora.py index a9bc9504bc7bd4f5a0835d90587ec66ab88952ff..2768ea499d7259f85fdf03099d593c82e81ed895 100644 --- a/Examples/options/tut_detsim_pandora.py +++ b/Examples/options/tut_detsim_pandora.py @@ -53,13 +53,13 @@ from Configurables import HepMCRdr from Configurables import GenPrinter gun = GtGunTool("GtGunTool") -gun.Particles = ["gamma","gamma"] -gun.EnergyMins= [10, 10] # GeV -gun.EnergyMaxs= [10, 10] # GeV -gun.ThetaMins = [90, 90] # degree -gun.ThetaMaxs = [90, 90] # degree -gun.PhiMins = [0, 1 ] # degree -gun.PhiMaxs = [0, 1 ] # degree +gun.Particles = ["gamma"] +gun.EnergyMins= [10] # GeV +gun.EnergyMaxs= [10] # GeV +gun.ThetaMins = [80] # degree +gun.ThetaMaxs = [80] # degree +gun.PhiMins = [0 ] # degree +gun.PhiMaxs = [0 ] # degree #stdheprdr = StdHepRdr("StdHepRdr") @@ -104,13 +104,25 @@ detsimalg.RootDetElem = "WorldDetElemTool" from Configurables import AnExampleDetElemTool example_dettool = AnExampleDetElemTool("AnExampleDetElemTool") -############################################################################## -from Configurables import CaloDigiAlg -example_CaloDigiAlg = CaloDigiAlg("CaloDigiAlg") -example_CaloDigiAlg.Scale = 1 -example_CaloDigiAlg.SimCaloHitCollection = "EcalBarrelCollection" -example_CaloDigiAlg.CaloHitCollection = "ECALBarrel" -example_CaloDigiAlg.CaloAssociationCollection = "RecoCaloAssociation_ECALBarrel" +############################################################ +from Configurables import SimHitMergeAlg +simHitMerge = SimHitMergeAlg("SimHitMergeAlg") +simHitMerge.InputCollections=["EcalBarrelCollection", "EcalEndcapsCollection"] +simHitMerge.OutputCollections=["EcalBarrelCollectionMerged", "EcalEndcapsCollectionMerged"] +############################################################ + +from Configurables import G2CDArborAlg +caloDigi = G2CDArborAlg("G2CDArborAlg") +caloDigi.ReadLCIO = False +#caloDigi.CalibrECAL = [48.16, 96.32] +caloDigi.CalibrECAL = [46.538, 93.0769] +caloDigi.ECALCollections = ["EcalBarrelCollectionMerged", "EcalEndcapsCollectionMerged"] +caloDigi.ECALReadOutNames= ["EcalBarrelCollection", "EcalEndcapsCollection"] +caloDigi.DigiECALCollection = ["ECALBarrel", "ECALEndcap"] +caloDigi.HCALCollections = [] +caloDigi.HCALReadOutNames= [] +caloDigi.DigiHCALCollection = [] +caloDigi.EventReportEvery = 100 ############################################################################## from Configurables import GearSvc gearSvc = GearSvc("GearSvc") @@ -123,6 +135,7 @@ ntsvc.Output = ["MyTuples DATAFILE='detsim_Pan_ana.root' OPT='NEW' TYP='ROOT'"] from Configurables import PandoraPFAlg pandoralg = PandoraPFAlg("PandoraPFAlg") +pandoralg.debug = False pandoralg.use_dd4hep_geo = True pandoralg.use_dd4hep_decoder = True pandoralg.use_preshower = False @@ -144,7 +157,7 @@ pandoralg.collections = [ "Vertex:SplitVertices", "Vertex:V0Vertices", "Track:MarlinTrkTracks", - "MCRecoCaloAssociation:RecoCaloAssociation_ECALBarrel" + "MCRecoCaloAssociation:MCRecoCaloAssociationCollection" ] pandoralg.WriteClusterCollection = "PandoraClusters" pandoralg.WriteReconstructedParticleCollection = "PandoraPFOs" @@ -154,12 +167,17 @@ pandoralg.PandoraSettingsDefault_xml = "Reconstruction/PFA/Pandora/PandoraSettin #### Do not chage the collection name, only add or remove ############### pandoralg.TrackCollections = ["MarlinTrkTracks"] pandoralg.ECalCaloHitCollections= ["ECALBarrel", "ECALEndcap", "ECALOther"] +pandoralg.ECalReadOutNames = ["EcalBarrelCollection", "EcalEndcapsCollection", "ECALOther"] pandoralg.HCalCaloHitCollections= ["HCALBarrel", "HCALEndcap", "HCALOther"] +pandoralg.HCalReadOutNames = ["HcalBarrelCollection", "HcalEndcapsCollection", "HCALOther"] pandoralg.LCalCaloHitCollections= ["LCAL"] +pandoralg.LCalReadOutNames = ["LcalCollection"] pandoralg.LHCalCaloHitCollections= ["LHCAL"] +pandoralg.LHCalReadOutNames = ["LHcalCollection"] pandoralg.MuonCaloHitCollections= ["MUON"] +pandoralg.MuonCalReadOutNames = ["MuoncalCollection"] pandoralg.MCParticleCollections = ["MCParticle"] -pandoralg.RelCaloHitCollections = ["RecoCaloAssociation_ECALBarrel", "RecoCaloAssociation_ECALEndcap", "RecoCaloAssociation_ECALOther", "RecoCaloAssociation_HCALBarrel", "RecoCaloAssociation_HCALEndcap", "RecoCaloAssociation_HCALOther", "RecoCaloAssociation_LCAL", "RecoCaloAssociation_LHCAL", "RecoCaloAssociation_MUON"] +pandoralg.RelCaloHitCollections = ["MCRecoCaloAssociationCollection"] pandoralg.RelTrackCollections = ["MarlinTrkTracksMCTruthLink"] pandoralg.KinkVertexCollections = ["KinkVertices"] pandoralg.ProngVertexCollections= ["ProngVertices"] @@ -196,7 +214,7 @@ write.outputCommands = ["keep *"] # ApplicationMgr from Configurables import ApplicationMgr ApplicationMgr( - TopAlg = [genalg, detsimalg, example_CaloDigiAlg, pandoralg, write], + TopAlg = [genalg, detsimalg, simHitMerge, caloDigi, pandoralg, write], EvtSel = 'NONE', EvtMax = 10, ExtSvc = [rndmengine, dsvc, geosvc, gearSvc,detsimsvc], diff --git a/Examples/src/Edm4hepTest/Edm4hepReadDCAlg.cpp b/Examples/src/Edm4hepTest/Edm4hepReadDCAlg.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3c0baa9949049a4ff0d784b5900925dba56c1d6d --- /dev/null +++ b/Examples/src/Edm4hepTest/Edm4hepReadDCAlg.cpp @@ -0,0 +1,85 @@ +#include "Edm4hepReadDCAlg.h" +#include "edm4hep/EventHeaderCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimTrackerHitCollection.h" + +DECLARE_COMPONENT(Edm4hepReadDCAlg) + +Edm4hepReadDCAlg::Edm4hepReadDCAlg(const std::string& name, ISvcLocator* svcLoc) + : GaudiAlgorithm(name, svcLoc) +{ + declareProperty("MCParticleCol", m_mcParCol, "MCParticle collection (input)"); + declareProperty("DCHitCol", m_dcCol, "Drift Chamber collections (input)"); +} + +StatusCode Edm4hepReadDCAlg::initialize() +{ + debug() << "begin initialize Edm4hepReadDCAlg" << endmsg; + return GaudiAlgorithm::initialize(); +} + +StatusCode Edm4hepReadDCAlg::execute() +{ + debug() << "begin execute Edm4hepReadDCAlg" << endmsg; + + auto mcCol = m_mcParCol.get(); + for ( auto p : *mcCol ) { + info() << p.getObjectID().index << " : ["; + for ( auto it = p.daughters_begin(), end = p.daughters_end(); it != end; ++it ) { + info() << " " << it->getObjectID().index; + } + info() << " ]; "; + } + info() << "}" << endmsg; + + auto trkCol = m_dcCol.get(); + for (auto trkhit : *trkCol) { + auto position = trkhit.getPosition(); + auto momentum = trkhit.getMomentum(); + auto primary_particle = trkhit.getMCParticle(); + + info() << " cellID: " << trkhit.getCellID() + << " edep: " << trkhit.getEDep() + << " time: " << trkhit.getTime() + << " length: " << trkhit.getPathLength() + << " quality: " << trkhit.getQuality() + << " position: (" + << position[0] << ", " << position[1] << ", " << position[2] + << ")" + << " momentum: (" + << momentum[0] << ", " << momentum[1] << ", " << momentum[2] + << ")" + << " primary track: " + << primary_particle.getPDG() + << endmsg; + + + // unsigned int contrib_size = calohit.contributions_size(); + // info() << " contributions_size: " + // << contrib_size + // << endmsg; + // for (unsigned int i = 0; i < contrib_size; ++i) { + // auto contrib = calohit.getContributions(i); + // auto primary_particle = contrib.getParticle(); + + // info() << " - #" << i << ": " + // << " track with " + // << " PDG: " << contrib.getPDG() // current track + // << ". " + // << " primary track with " + // << " PDG: " << primary_particle.getPDG() + // << endmsg; + + + // } + + } + + return StatusCode::SUCCESS; +} + +StatusCode Edm4hepReadDCAlg::finalize() +{ + debug() << "begin finalize Edm4hepReadDCAlg" << endmsg; + return GaudiAlgorithm::finalize(); +} diff --git a/Examples/src/Edm4hepTest/Edm4hepReadDCAlg.h b/Examples/src/Edm4hepTest/Edm4hepReadDCAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..7a09eb6df5faa601afd0d0c614b43167926efd34 --- /dev/null +++ b/Examples/src/Edm4hepTest/Edm4hepReadDCAlg.h @@ -0,0 +1,33 @@ +#ifndef TEST_EDM4HEP_READ_DC_ALG_H +#define TEST_EDM4HEP_READ_DC_ALG_H + +#include "k4FWCore/DataHandle.h" +#include "GaudiAlg/GaudiAlgorithm.h" + +namespace edm4hep { + class EventHeaderCollection; + class MCParticleCollection; + class SimTrackerHitCollection; +} + +class Edm4hepReadDCAlg : public GaudiAlgorithm +{ + + public : + + Edm4hepReadDCAlg(const std::string& name, ISvcLocator* svcLoc); + + virtual StatusCode initialize(); + virtual StatusCode execute(); + virtual StatusCode finalize(); + + private : + + // DataHandle<edm4hep::EventHeaderCollection> m_headerCol{"EventHeader", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::MCParticleCollection> m_mcParCol{"MCParticle", Gaudi::DataHandle::Reader, this}; + DataHandle<edm4hep::SimTrackerHitCollection> m_dcCol{"DriftChamberHitsCollection", + Gaudi::DataHandle::Reader, this}; + +}; + +#endif diff --git a/Examples/src/HelloWorld/HelloAlg.h b/Examples/src/HelloWorld/HelloAlg.h index 9c689ca91c4363403285348c14d378aa0cf56054..357ac4f8e3a1ae41f0112a52ae46d577cf04dcc0 100644 --- a/Examples/src/HelloWorld/HelloAlg.h +++ b/Examples/src/HelloWorld/HelloAlg.h @@ -2,7 +2,7 @@ #define HelloAlg_h #include <GaudiKernel/Algorithm.h> -#include "GaudiKernel/Property.h" +#include <Gaudi/Property.h> class HelloAlg: public Algorithm { public: diff --git a/Examples/src/SecondAlg/SecondAlg.h b/Examples/src/SecondAlg/SecondAlg.h index e96306c826dc503a2c6c6cc3f11b74608ca81baf..9026b0b37425b2b0dd480f9f0363b59f4046fff2 100644 --- a/Examples/src/SecondAlg/SecondAlg.h +++ b/Examples/src/SecondAlg/SecondAlg.h @@ -2,7 +2,7 @@ #define SecondAlg_h #include <GaudiKernel/Algorithm.h> -#include <GaudiKernel/Property.h> +#include <Gaudi/Property.h> #include "Examples/IFirstSvc.h" diff --git a/Generator/CMakeLists.txt b/Generator/CMakeLists.txt index 7eb4c9ca590664ef22db4ec00c5834c3c804ced8..0a244a3aa61afe39e9c8fa48ab7344a5866db4de 100644 --- a/Generator/CMakeLists.txt +++ b/Generator/CMakeLists.txt @@ -1,61 +1,34 @@ ######################################## -gaudi_subdir(Generator v0r0) -set(GenAlgo_srcs - src/IGenTool.cpp - src/GenAlgo.cpp - src/GenEvent.cpp - src/GenReader.cpp - src/StdHepRdr.cpp - src/GenPrinter.cpp - # src/LCAscHepRdr.cc - # src/HepevtRdr.cpp - src/SLCIORdr.cpp - src/HepMCRdr.cpp - src/GtGunTool.cpp -) -set(GenAlgo_incs src) find_package(Geant4 REQUIRED) include(${Geant4_USE_FILE}) -find_package(ROOT COMPONENTS RIO Tree TreePlayer MathCore Net Graf3d Graf Gpad EG REQUIRED) -find_package(LCIO) -find_package(podio) -find_package(EDM4HEP) -find_package(HepMC) -find_package(CLHEP REQUIRED;CONFIG) -find_package(k4FWCore REQUIRED) - -if(ROOT_FOUND) - message("found ROOT: ${ROOT_INCLUDE_DIRS} ${ROOT_LIBRARIES}") -endif(ROOT_FOUND) -if(LCIO_FOUND) - message("found LCIO: ${LCIO_INCLUDE_DIRS} ${LCIO_LIBRARIES}") -endif(LCIO_FOUND) -if(podio_FOUND) - message("found podio: ${podio_INCLUDE_DIRS} ${podio_LIBRARIES}") -endif(podio_FOUND) -if(HepMC_FOUND) - message("found HepMC: ${HepMC_INCLUDE_DIRS} ${HepMC_LIBRARY_DIR}") -endif(HepMC_FOUND) -if(CLHEP_FOUND) - message("found CLHEP: ${CLHEP_INCLUDE_DIRS} ${CLHEP_LIBRARY_DIR}") -endif(CLHEP_FOUND) -############## for producing plcio library ############# -INCLUDE_DIRECTORIES(${GenAlgo_incs}) +gaudi_add_module(GenAlgo + SOURCES src/IGenTool.cpp + src/GenAlgo.cpp + src/GenEvent.cpp + src/GenReader.cpp + src/StdHepRdr.cpp + src/GenPrinter.cpp + # src/LCAscHepRdr.cc + # src/HepevtRdr.cpp + src/SLCIORdr.cpp + src/HepMCRdr.cpp + src/GtGunTool.cpp -gaudi_add_module(GenAlgo ${GenAlgo_srcs} - INCLUDE_DIRS - k4FWCore - LINK_LIBRARIES - ROOT - k4FWCore - GaudiAlgLib GaudiKernel - HepMC - CLHEP - LCIO - EDM4HEP::edm4hep EDM4HEP::edm4hepDict - ) -#gaudi_add_test(Reader FRAMEWORK options/read.py) + LINK ${ROOT_LIBRARIES} + k4FWCore::k4FWCore + Gaudi::GaudiAlgLib + Gaudi::GaudiKernel + ${HEPMC_LIBRARIES} + ${CLHEP_LIBRARIES} + ${LCIO_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict + ROOT::EG +) -########################### +install(TARGETS GenAlgo + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Generator/src/GenAlgo.h b/Generator/src/GenAlgo.h index cd26745385eae2dcc7270ceee205d65678da7372..2eb6ac616f0a54f9acca641d197016b0fadf6b1f 100644 --- a/Generator/src/GenAlgo.h +++ b/Generator/src/GenAlgo.h @@ -3,7 +3,7 @@ #include <GaudiKernel/Algorithm.h> -#include "GaudiKernel/Property.h" +#include <Gaudi/Property.h> #include <GaudiKernel/ToolHandle.h> #include "GaudiAlg/GaudiAlgorithm.h" diff --git a/Generator/src/GtGunTool.h b/Generator/src/GtGunTool.h index 0c62f4c386a34ad5468a99052998d4f04cda0611..fa4f887007a824d63445cbe940369f48e237b6b6 100644 --- a/Generator/src/GtGunTool.h +++ b/Generator/src/GtGunTool.h @@ -12,7 +12,7 @@ */ #include <GaudiKernel/AlgTool.h> -#include <GaudiKernel/Property.h> +#include <Gaudi/Property.h> #include "IGenTool.h" #include <vector> diff --git a/README.md b/README.md index 995ab2bae06fe1b3306b413a83ea65eaadd46a3b..a438dd0d99cf5f83501fe0152baf3482d4efd3c0 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ # [CEPCSW](https://cepc.github.io/CEPCSW/) [](https://www.travis-ci.com/cepc/CEPCSW) +[](https://github.com/cepc/CEPCSW/actions) CEPC offline software prototype based on [Key4hep](https://github.com/key4hep). ## Quick start -Start an SL6 container in lxslc7 (OS: CentOS7): -``` -$ /cvmfs/container.ihep.ac.cn/bin/hep_container shell SL6 -``` +SSH to lxslc7 (CentOS 7). Before run following commands, please make sure you setup the CVMFS: diff --git a/Reconstruction/CMakeLists.txt b/Reconstruction/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e506b90c7c3096915bb1d881d3109984958fa517 --- /dev/null +++ b/Reconstruction/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(DCHDedx) +add_subdirectory(Digi_Calo) +add_subdirectory(PFA) +add_subdirectory(SiliconTracking) +add_subdirectory(Tracking) diff --git a/Reconstruction/DCHDedx/CMakeLists.txt b/Reconstruction/DCHDedx/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..3303351eb6232aa252044695fe6228d6a93208d4 --- /dev/null +++ b/Reconstruction/DCHDedx/CMakeLists.txt @@ -0,0 +1,19 @@ + +# Modules +gaudi_add_module(DCHDedx + SOURCES src/RecDCHDedxAlg.cpp + LINK DetSimInterface + DetInterface + DetSegmentation + k4FWCore::k4FWCore + Gaudi::GaudiAlgLib + Gaudi::GaudiKernel + DetSegmentation + EDM4HEP::edm4hep EDM4HEP::edm4hepDict +) + +install(TARGETS DCHDedx + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Reconstruction/DCHDedx/src/RecDCHDedxAlg.cpp b/Reconstruction/DCHDedx/src/RecDCHDedxAlg.cpp new file mode 100644 index 0000000000000000000000000000000000000000..eaac6ffe1be6efd69df095a9500ba33562ca3c0d --- /dev/null +++ b/Reconstruction/DCHDedx/src/RecDCHDedxAlg.cpp @@ -0,0 +1,255 @@ +#include "RecDCHDedxAlg.h" +#include "edm4hep/EventHeaderCollection.h" +#include "edm4hep/MCParticleCollection.h" +#include "edm4hep/SimTrackerHitCollection.h" +#include "edm4hep/TrackerHitCollection.h" +#include "edm4hep/TrackCollection.h" +#include "edm4hep/MCRecoTrackerAssociationCollection.h" +#include "edm4hep/MCRecoParticleAssociationCollection.h" +#include "edm4hep/ReconstructedParticleCollection.h" +#include "DDSegmentation/Segmentation.h" +#include "DetSegmentation/GridDriftChamber.h" +#include "DetInterface/IGeomSvc.h" +//#include "edm4hep/SimCalorimeterHitCollection.h" +//#include "edm4hep/CaloHitContributionCollection.h" + +#include "DD4hep/Detector.h" +#include "DD4hep/IDDescriptor.h" +#include "DD4hep/Plugins.h" +#include "DD4hep/DD4hepUnits.h" +#include "CLHEP/Random/RandGauss.h" + +DECLARE_COMPONENT(RecDCHDedxAlg) + +RecDCHDedxAlg::RecDCHDedxAlg(const std::string& name, ISvcLocator* svcLoc) +: GaudiAlgorithm(name, svcLoc) +{ + declareProperty("DCHitAssociationCollection", m_dcHitAssociationCol, "Handle of association collection"); + declareProperty("DCTrackCollection", m_dcTrackCol,"Handle of input Track collection"); +} + +StatusCode RecDCHDedxAlg::initialize() +{ + if(m_WriteAna){ + + NTuplePtr nt( ntupleSvc(), "MyTuples/Dedx_evt" ); + if ( nt ) m_tuple = nt; + else { + m_tuple = ntupleSvc()->book( "MyTuples/Dedx_evt", CLID_ColumnWiseTuple, "Dedx" ); + if ( m_tuple ) { + m_tuple->addItem( "N_track" , m_n_track, 0, 1000 ).ignore(); + m_tuple->addItem( "track_dedx" , m_n_track, m_track_dedx ).ignore(); + m_tuple->addItem( "track_dedx_BB" , m_n_track, m_track_dedx_BB ).ignore(); + m_tuple->addItem( "track_px" , m_n_track, m_track_px ).ignore(); + m_tuple->addItem( "track_py" , m_n_track, m_track_py ).ignore(); + m_tuple->addItem( "track_pz" , m_n_track, m_track_pz ).ignore(); + m_tuple->addItem( "track_mass" , m_n_track, m_track_mass ).ignore(); + m_tuple->addItem( "track_pid" , m_n_track, m_track_pid ).ignore(); + } + else { // did not manage to book the N tuple.... + error() << " Cannot book N-tuple:" << long( m_tuple ) << endmsg; + return StatusCode::FAILURE; + } + } + } + + return GaudiAlgorithm::initialize(); +} + + +StatusCode RecDCHDedxAlg::execute() +{ + + if(m_WriteAna){ + m_n_track = 0; + } + if(m_method==1){// get the primary mc particle of the reconstructed track and do dedx sampling using beta-gamma curve + + m_dedx_simtool = ToolHandle<IDedxSimTool>(m_dedx_sim_option.value()); + if (!m_dedx_simtool) { + error() << "Failed to find dedx sampling tool :"<<m_dedx_sim_option.value()<< endmsg; + return StatusCode::FAILURE; + } + + const edm4hep::TrackCollection* trkCol=nullptr; + trkCol=m_dcTrackCol.get(); + if(nullptr==trkCol){ + throw ("Error: TrackCollection not found."); + return StatusCode::SUCCESS; + } + edm4hep::TrackCollection* ptrkCol = const_cast<edm4hep::TrackCollection*>(trkCol); + + const edm4hep::MCRecoTrackerAssociationCollection* assoCol=nullptr; + assoCol = m_dcHitAssociationCol.get(); + if(nullptr==assoCol){ + throw ("Error: MCRecoTrackerAssociationCollection not found."); + return StatusCode::SUCCESS; + } + for(unsigned j=0; j<ptrkCol->size(); j++){ + std::map< edm4hep::ConstMCParticle, int > map_mc_count; + auto tmp_track = ptrkCol->at(j); + for(unsigned k=0; k< tmp_track.trackerHits_size(); k++){ + for(unsigned z=0; z< assoCol->size(); z++){ + if(assoCol->at(z).getRec().id() != tmp_track.getTrackerHits(k).id()) continue; + + auto tmp_mc = assoCol->at(z).getSim().getMCParticle(); + if(tmp_mc.parents_size()!=0) continue; + if(map_mc_count.find(tmp_mc) != map_mc_count.end()) map_mc_count[tmp_mc] += 1; + else map_mc_count[tmp_mc] = 1; + + } + } + edm4hep::MCParticle tmp_mc; + int max_cout = 0; + for(auto iter = map_mc_count.begin(); iter != map_mc_count.end(); iter++ ){ + if(iter->second > max_cout){ + max_cout = iter->second; + //tmp_mc = iter->first; + tmp_mc.setMass(iter->first.getMass()); + tmp_mc.setCharge(iter->first.getCharge()); + tmp_mc.setMomentum(iter->first.getMomentum()); + if(m_debug){ + std::cout<<"mass="<<iter->first.getMass()<<",charge="<<iter->first.getCharge()<<",mom_x"<<iter->first.getMomentum()[0]<<",mom_y"<<iter->first.getMomentum()[1]<<",mom_z"<<iter->first.getMomentum()[2]<<std::endl; + } + } + } + double dedx_ori = tmp_track.getDEdx(); + double dedx = 0.0; + dedx = m_dedx_simtool->dedx(tmp_mc); + float dedx_smear = CLHEP::RandGauss::shoot(m_scale, m_resolution); + if(m_debug) std::cout<<"ori dedx="<<dedx_ori<<", dedx from sampling ="<<dedx<<",smear="<<dedx_smear<<",final="<<dedx*dedx_smear<<",scale="<<m_scale<<",res="<<m_resolution<<std::endl; + ptrkCol->at(j).setDEdx(dedx*dedx_smear); + if(m_WriteAna){ + m_track_dedx[m_n_track]= dedx*dedx_smear; + m_track_dedx_BB[m_n_track]= dedx; + m_track_px [m_n_track]= tmp_mc.getMomentum()[0]; + m_track_py [m_n_track]= tmp_mc.getMomentum()[1]; + m_track_pz [m_n_track]= tmp_mc.getMomentum()[2]; + m_track_mass [m_n_track]= tmp_mc.getMass(); + m_track_pid [m_n_track]= tmp_mc.getPDG(); + m_n_track ++; + } + } + }//method 1 + if(m_method==2){// get the primary mc particle of the reconstructed track and do dndx sampling according the mc beta-gamma + + m_dedx_simtool = ToolHandle<IDedxSimTool>(m_dedx_sim_option.value()); + if (!m_dedx_simtool) { + error() << "Failed to find dedx sampling tool :"<<m_dedx_sim_option.value()<< endmsg; + return StatusCode::FAILURE; + } + + const edm4hep::TrackCollection* trkCol=nullptr; + trkCol=m_dcTrackCol.get(); + if(nullptr==trkCol){ + throw ("Error: TrackCollection not found."); + return StatusCode::SUCCESS; + } + edm4hep::TrackCollection* ptrkCol = const_cast<edm4hep::TrackCollection*>(trkCol); + + const edm4hep::MCRecoTrackerAssociationCollection* assoCol=nullptr; + assoCol = m_dcHitAssociationCol.get(); + if(nullptr==assoCol){ + throw ("Error: MCRecoTrackerAssociationCollection not found."); + return StatusCode::SUCCESS; + } + for(unsigned j=0; j<ptrkCol->size(); j++){ + std::map< edm4hep::ConstMCParticle, int > map_mc_count; + auto tmp_track = ptrkCol->at(j); + for(unsigned k=0; k< tmp_track.trackerHits_size(); k++){ + for(unsigned z=0; z< assoCol->size(); z++){ + if(assoCol->at(z).getRec().id() != tmp_track.getTrackerHits(k).id()) continue; + + auto tmp_mc = assoCol->at(z).getSim().getMCParticle(); + if(tmp_mc.parents_size()!=0) continue; + if(map_mc_count.find(tmp_mc) != map_mc_count.end()) map_mc_count[tmp_mc] += 1; + else map_mc_count[tmp_mc] = 1; + + } + } + edm4hep::MCParticle tmp_mc; + int max_cout = 0; + for(auto iter = map_mc_count.begin(); iter != map_mc_count.end(); iter++ ){ + if(iter->second > max_cout){ + max_cout = iter->second; + //tmp_mc = iter->first; + tmp_mc.setMass(iter->first.getMass()); + tmp_mc.setCharge(iter->first.getCharge()); + tmp_mc.setMomentum(iter->first.getMomentum()); + if(m_debug){ + std::cout<<"mass="<<iter->first.getMass()<<",charge="<<iter->first.getCharge()<<",mom_x"<<iter->first.getMomentum()[0]<<",mom_y"<<iter->first.getMomentum()[1]<<",mom_z"<<iter->first.getMomentum()[2]<<std::endl; + } + } + } + double dndx = 0.0; + double betagamma = tmp_mc.getMass() !=0 ? sqrt(tmp_mc.getMomentum()[0]*tmp_mc.getMomentum()[0] + tmp_mc.getMomentum()[1]*tmp_mc.getMomentum()[1] + tmp_mc.getMomentum()[2]*tmp_mc.getMomentum()[2] )/tmp_mc.getMass() : -1 ; + dndx = m_dedx_simtool->dndx(betagamma); + float dndx_smear = CLHEP::RandGauss::shoot(m_scale, m_resolution); + if(m_debug) std::cout<<"dndx from sampling ="<<dndx<<",smear="<<dndx_smear<<",final="<<dndx*dndx_smear<<",scale="<<m_scale<<",res="<<m_resolution<<std::endl; + ptrkCol->at(j).setDEdx(dndx*dndx_smear);//update the dndx + if(m_WriteAna){ + m_track_dedx[m_n_track]= dndx*dndx_smear; + m_track_dedx_BB[m_n_track]= dndx; + m_track_px [m_n_track]= tmp_mc.getMomentum()[0]; + m_track_py [m_n_track]= tmp_mc.getMomentum()[1]; + m_track_pz [m_n_track]= tmp_mc.getMomentum()[2]; + m_track_mass [m_n_track]= tmp_mc.getMass(); + m_track_pid [m_n_track]= tmp_mc.getPDG(); + m_n_track ++; + } + } + }//method 2 + if(m_WriteAna){ + StatusCode status = m_tuple->write(); + if ( status.isFailure() ) { + error() << " Cannot fill N-tuple:" << long( m_tuple ) << endmsg; + return StatusCode::FAILURE; + } + } + + return StatusCode::SUCCESS; +} + +StatusCode RecDCHDedxAlg::finalize() +{ + return GaudiAlgorithm::finalize(); +} + +double RecDCHDedxAlg::cal_dedx_bitrunc(float truncate, std::vector<double> phlist, int & usedhit ) +{ + sort(phlist.begin(),phlist.end()); + int nsampl = (int)( phlist.size()*truncate ); + int smpl = (int)(phlist.size()*(truncate+0.05)); + int min_cut = (int)( phlist.size()*0.05 + 0.5 ); + double qSum = 0; + unsigned i = 0; + for(std::vector<double>::iterator ql= phlist.begin();ql!=phlist.end();ql++) + { + i++; + if(i<= smpl && i>=min_cut ) qSum += (*ql); + } + double trunc=-99; + usedhit = smpl-min_cut+1; + if(usedhit>0) trunc=qSum/usedhit; + + return trunc; +} +/* +double RecDCHDedxAlg::BetheBlochEquationDedx(const edm4hep::MCParticle& mcp) +{ + int z = mcp.getCharge(); + if (z == 0) return 0; + float m_I = m_material_Z*10; // Approximate + + double M = mcp.getMass(); + double gammabeta=sqrt(mcp.getMomentum()[0]*mcp.getMomentum()[0]+mcp.getMomentum()[1]*mcp.getMomentum()[1]+mcp.getMomentum()[2]*mcp.getMomentum()[2])/M; + if(gammabeta<0.01)return 0;//too low momentum + float beta = gammabeta/sqrt(1.0+pow(gammabeta,2)); + float gamma = gammabeta/beta; + M = M*pow(10,9);//to eV + float Tmax = 2*m_me*pow(gammabeta,2)/(1+(2*gamma*m_me/M)+pow(m_me/M,2)); + float dedx = m_K*pow(z,2)*m_material_Z*(0.5*log(2*m_me*pow(gammabeta,2)*Tmax/pow(m_I,2))-pow(beta,2))/(m_material_A*pow(beta,2)); + dedx = dedx*CLHEP::RandGauss::shoot(m_scale, m_resolution); + return dedx; // (CLHEP::MeV/CLHEP::cm) / (CLHEP::g/CLHEP::cm3) +} +*/ diff --git a/Reconstruction/DCHDedx/src/RecDCHDedxAlg.h b/Reconstruction/DCHDedx/src/RecDCHDedxAlg.h new file mode 100644 index 0000000000000000000000000000000000000000..b2a5b9f58775ffe47675741184a908eaa460b76e --- /dev/null +++ b/Reconstruction/DCHDedx/src/RecDCHDedxAlg.h @@ -0,0 +1,75 @@ +#ifndef RecDCHDedxAlg_h +#define RecDCHDedxAlg_h + +#include "edm4hep/MCParticleCollection.h" +#include "GaudiAlg/GaudiAlgorithm.h" +#include "GaudiKernel/NTuple.h" +#include "k4FWCore/DataHandle.h" +#include "DD4hep/Fields.h" +#include "DetSimInterface/IDedxSimTool.h" +#include "GaudiKernel/ToolHandle.h" + +class IGeomSvc; +namespace dd4hep { + class Detector; + namespace DDSegmentation{ + class GridDriftChamber; + class BitFieldCoder; + } +} +namespace edm4hep { + class MCParticleCollection; + class TrackerHitCollection; + class TrackCollection; + class MCRecoTrackerAssociationCollection; + class ReconstructedParticleCollection; + class MCRecoParticleAssociationCollection; +} + +class RecDCHDedxAlg: public GaudiAlgorithm +{ + public: + RecDCHDedxAlg(const std::string& name, ISvcLocator* svcLoc); + + virtual StatusCode initialize(); + virtual StatusCode execute(); + virtual StatusCode finalize(); + double cal_dedx_bitrunc(float truncate, std::vector<double> phlist, int & usedhit ); + + private: + ToolHandle<IDedxSimTool> m_dedx_simtool; + Gaudi::Property<std::string> m_dedx_sim_option{ this, "sampling_option", ""}; + + //reader + DataHandle<edm4hep::MCRecoTrackerAssociationCollection> m_dcHitAssociationCol{ "DCHitAssociationCollection",Gaudi::DataHandle::Reader, this}; + //writer + DataHandle<edm4hep::TrackCollection> m_dcTrackCol{"DCTrackCollection", Gaudi::DataHandle::Writer, this}; + + Gaudi::Property<int> m_debug{ this, "debug", false}; + Gaudi::Property<int> m_method{ this, "method", 1}; + Gaudi::Property<float> m_truncate{ this, "truncate", 0.7}; + Gaudi::Property<bool> m_WriteAna{ this, "WriteAna", false}; + Gaudi::Property<float> m_scale{this, "dedx_scale", 1}; + Gaudi::Property<float> m_resolution{this, "dedx_resolution", 0.}; + + NTuple::Tuple* m_tuple = nullptr ; + NTuple::Item<long> m_n_track; + NTuple::Item<long> m_hit; + NTuple::Array<double> m_track_dedx; + NTuple::Array<double> m_track_dedx_BB; + NTuple::Array<double> m_track_px; + NTuple::Array<double> m_track_py; + NTuple::Array<double> m_track_pz; + NTuple::Array<double> m_track_mass; + NTuple::Array<int> m_track_pid; + NTuple::Array<double> m_hit_x ; + NTuple::Array<double> m_hit_y ; + NTuple::Array<double> m_hit_z ; + NTuple::Array<double> m_hit_dedx; + NTuple::Item<double> m_mc_px; + NTuple::Item<double> m_mc_py; + NTuple::Item<double> m_mc_pz; + +}; + +#endif diff --git a/Reconstruction/Digi_Calo/CMakeLists.txt b/Reconstruction/Digi_Calo/CMakeLists.txt index 179346ca39c4764bab67a382633635546a35e9a2..e3c5b9d4686d117ec7489f90011acc324af150bf 100644 --- a/Reconstruction/Digi_Calo/CMakeLists.txt +++ b/Reconstruction/Digi_Calo/CMakeLists.txt @@ -1,26 +1,18 @@ -gaudi_subdir(Digi_Calo v0r0) -find_package(CLHEP REQUIRED;CONFIG) -find_package(DD4hep COMPONENTS DDG4 REQUIRED) -find_package(EDM4HEP REQUIRED ) -message("EDM4HEP_INCLUDE_DIRS: ${EDM4HEP_INCLUDE_DIR}") -message("EDM4HEP_LIB: ${EDM4HEP_LIBRARIES}") -include_directories(${EDM4HEP_INCLUDE_DIR}) - -find_package(CLHEP REQUIRED) -find_package(podio REQUIRED ) - -set(srcs - src/*.cpp -) - -gaudi_depends_on_subdirs( - Detector/DetInterface -) ## Modules -gaudi_add_module(Digi_Calo ${srcs} - INCLUDE_DIRS k4FWCore GaudiKernel GaudiAlgLib ${CLHEP_INCLUDE_DIR} DD4hep - LINK_LIBRARIES k4FWCore GaudiKernel GaudiAlgLib ${CLHEP_LIBRARIES} DD4hep ${DD4hep_COMPONENT_LIBRARIES} DDRec - -Wl,--no-as-needed - EDM4HEP::edm4hep EDM4HEP::edm4hepDict +gaudi_add_module(Digi_Calo + SOURCES src/CaloDigiAlg.cpp + LINK DetInterface + k4FWCore::k4FWCore + Gaudi::GaudiKernel + Gaudi::GaudiAlgLib + ${CLHEP_LIBRARIES} + ${DD4hep_COMPONENT_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict ) +install(TARGETS Digi_Calo + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) + diff --git a/Reconstruction/PFA/CMakeLists.txt b/Reconstruction/PFA/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b3a1b42645d41829b472ce79e403cb99e0aa26d5 --- /dev/null +++ b/Reconstruction/PFA/CMakeLists.txt @@ -0,0 +1,2 @@ + +add_subdirectory(Pandora) diff --git a/Reconstruction/PFA/Pandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..ea3f290b015f21bdd64fcaa56459853c88f7578e --- /dev/null +++ b/Reconstruction/PFA/Pandora/CMakeLists.txt @@ -0,0 +1,3 @@ + +add_subdirectory(GaudiPandora) +add_subdirectory(MatrixPandora) diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt index 7b07fd673ed3592ae2e2200aa34960666cca55d9..80307e39ad0df371f0a6fd107cf04155a8571136 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt +++ b/Reconstruction/PFA/Pandora/GaudiPandora/CMakeLists.txt @@ -1,48 +1,36 @@ -gaudi_subdir(GaudiPandora v0r0) -find_package(LCIO REQUIRED ) -find_package(DD4hep COMPONENTS DDG4 REQUIRED) -find_package(GEAR REQUIRED) -find_package(CLHEP REQUIRED;CONFIG) -message("ENV GEAR: $ENV{GEAR}") - -find_package(EDM4HEP REQUIRED ) -include_directories(${EDM4HEP_INCLUDE_DIR}) - -find_package(PandoraSDK REQUIRED ) -include_directories(${PandoraSDK_INCLUDE_DIRS}) -link_libraries(${PandoraSDK_LIBRARIES}) -find_package(LCContent REQUIRED ) -include_directories(${LCContent_INCLUDE_DIRS}) -link_libraries(${LCContent_LIBRARIES}) - - -find_package(ROOT COMPONENTS MathCore Physics GenVector Geom REQUIRED) - - -gaudi_depends_on_subdirs( - Service/EventSeeder - Service/GearSvc - Utilities/DataHelper - Detector/DetInterface +# Modules +gaudi_add_module(GaudiPandora + SOURCES src/PandoraPFAlg.cpp + src/MCParticleCreator.cpp + src/GeometryCreator.cpp + src/CaloHitCreator.cpp + src/TrackCreator.cpp + src/PfoCreator.cpp + src/Utility.cpp + LINK EventSeeder + GearSvc + DataHelperLib + DetInterface + Gaudi::GaudiKernel + k4FWCore::k4FWCore + ${PandoraSDK_LIBRARIES} + ${LCContent_LIBRARIES} + ${CLHEP_LIBRARIES} + ${ROOT_LIBRARIES} + ${LCIO_LIBRARIES} + ${GEAR_LIBRARIES} + ${DD4hep_COMPONENT_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict ) -set(dir_srcs - src/PandoraPFAlg.cpp - src/MCParticleCreator.cpp - src/GeometryCreator.cpp - src/CaloHitCreator.cpp - src/TrackCreator.cpp - src/PfoCreator.cpp - src/Utility.cpp -) -set(dir_include include) -# Modules -gaudi_add_module(GaudiPandora ${dir_srcs} - INCLUDE_DIRS ${dir_include} GaudiKernel k4FWCore CLHEP ${LCIO_INCLUDE_DIRS} ROOT gear DD4hep - LINK_LIBRARIES GaudiKernel k4FWCore CLHEP ROOT ${LCIO_LIBRARIES} ${GEAR_LIBRARIES} DataHelperLib DD4hep ${DD4hep_COMPONENT_LIBRARIES} DDRec - -Wl,--no-as-needed - EDM4HEP::edm4hep EDM4HEP::edm4hepDict - -Wl,--as-needed +target_include_directories(GaudiPandora PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) + +install(TARGETS GaudiPandora + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) -) diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h index b947f49d25bf7e6147302d4c167e3bac7b026227..df9793abc42eca3ebf7c83ae6a968077ec65ee3a 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/CaloHitCreator.h @@ -50,10 +50,15 @@ public: Settings(); StringVector m_eCalCaloHitCollections; ///< The ecal calorimeter hit collections + StringVector m_eCalCaloReadOuts; ///< The ecal calorimeter ReadOut StringVector m_hCalCaloHitCollections; ///< The hcal calorimeter hit collections + StringVector m_hCalCaloReadOuts; ///< The hcal calorimeter ReadOut StringVector m_lCalCaloHitCollections; ///< The lcal calorimeter hit collections + StringVector m_lCalCaloReadOuts; ///< The lcal calorimeter ReadOut StringVector m_lHCalCaloHitCollections; ///< The lhcal calorimeter hit collections + StringVector m_lHCalCaloReadOuts; ///< The lhcal calorimeter ReadOut StringVector m_muonCaloHitCollections; ///< The muon calorimeter hit collections + StringVector m_muonCalCaloReadOuts; ///< The muon calorimeter ReadOut float m_absorberRadLengthECal; ///< The absorber radiation length in the ECal float m_absorberIntLengthECal; ///< The absorber interaction length in the ECal @@ -100,6 +105,7 @@ public: bool m_use_dd4hep_geo; /// bool m_use_dd4hep_decoder; /// bool m_use_preshower; /// + bool m_debug; }; /** diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/GeometryCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/GeometryCreator.h index de894a78c27d288fc54028afa002d2beedd9a1cb..442a356b05b90fe2dbf8999159e08aa6fac7872a 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/GeometryCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/GeometryCreator.h @@ -59,6 +59,7 @@ public: int m_hCalRingOuterSymmetryOrder; ///< HCal ring outer symmetry order (missing from ILD gear files) float m_hCalRingOuterPhiCoordinate; ///< HCal ring outer phi coordinate (missing from ILD gear files) bool m_use_dd4hep_geo; ///true to use dd4hep geo info + bool m_debug; }; /** diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h index 0926f870b6dc8738a7122f1a412f2ece40077f7a..4e446cf9c59ed15ea3f28034f99adedd8f407917 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/MCParticleCreator.h @@ -39,6 +39,7 @@ public: StringVector m_CaloHitRelationCollections; ///< The SimCaloHit to CaloHit particle relations StringVector m_TrackRelationCollections; ///< The SimTrackerHit to TrackerHit particle relations float m_bField; ///< m_bField + bool m_debug; }; /** diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h index 4dd9b784d53fa83cf1fdb82086ade7ae4ec71b6f..a74b8a77297e8facbbf6aee29c6916d35c0497c8 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/PandoraPFAlg.h @@ -132,10 +132,15 @@ protected: Gaudi::Property< std::vector<std::string> > m_TrackCollections{ this, "TrackCollections", {"MarlinTrkTracks"} }; Gaudi::Property< std::vector<std::string> > m_ECalCaloHitCollections{ this, "ECalCaloHitCollections", {"ECALBarrel","ECALEndcap","ECALOther"} }; + Gaudi::Property< std::vector<std::string> > m_ECalReadOutNames { this, "ECalReadOutNames", {"EcalBarrelCollection","EcalEndcapsCollection","ECALOther"} }; Gaudi::Property< std::vector<std::string> > m_HCalCaloHitCollections{ this, "HCalCaloHitCollections", {"HCALBarrel","HCALEndcap","HCALOther"} }; + Gaudi::Property< std::vector<std::string> > m_HCalReadOutNames { this, "HCalReadOutNames", {"HcalBarrelCollection","HcalEndcapsCollection","HCALOther"} }; Gaudi::Property< std::vector<std::string> > m_LCalCaloHitCollections{ this, "LCalCaloHitCollections", {"LCAL"} }; + Gaudi::Property< std::vector<std::string> > m_LCalReadOutNames { this, "LCalReadOutNames", {"LcalBarrelCollection"} }; Gaudi::Property< std::vector<std::string> > m_LHCalCaloHitCollections{ this, "LHCalCaloHitCollections", {"LHCAL"} }; + Gaudi::Property< std::vector<std::string> > m_LHCalReadOutNames { this, "LHCalReadOutNames", {"LHcalBarrelCollection"} }; Gaudi::Property< std::vector<std::string> > m_MuonCaloHitCollections{ this, "MuonCaloHitCollections", {"MUON"} }; + Gaudi::Property< std::vector<std::string> > m_MuonCalReadOutNames { this, "MuonCalReadOutNames", {"MuonCollection"} }; Gaudi::Property< std::vector<std::string> > m_MCParticleCollections{ this, "MCParticleCollections", {"MCParticle"} }; Gaudi::Property< std::vector<std::string> > m_RelCaloHitCollections{ this, "RelCaloHitCollections", {"RelationCaloHit","RelationMuonHit"} }; Gaudi::Property< std::vector<std::string> > m_RelTrackCollections{ this, "RelTrackCollections", {"MarlinTrkTracksMCTruthLink"} }; @@ -257,6 +262,7 @@ protected: NTuple::Item<long> m_n_mc; NTuple::Item<long> m_n_rec; NTuple::Item<int> m_hasConversion; + NTuple::Item<int> m_marlinTrack; NTuple::Array<int > m_pReco_PID; NTuple::Array<float> m_pReco_mass; NTuple::Array<float> m_pReco_energy; @@ -275,6 +281,7 @@ protected: + Gaudi::Property<bool> m_debug {this, "debug", false,"if do debug"}; Gaudi::Property<bool> m_WriteAna {this, "WriteAna", false,"if do ana"}; Gaudi::Property<bool> m_use_dd4hep_geo{this, "use_dd4hep_geo", false,"choose if use geo info from dd4hep"}; Gaudi::Property<bool> m_use_dd4hep_decoder {this, "use_dd4hep_decoder", true,"if use decoder from dd4hep"}; diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h index ed69d77817a5d5ead53263c0b7b93f11d0d46918..1f97017ac33da390169fa16ec1d922c1d62b85e8 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/PfoCreator.h @@ -51,6 +51,7 @@ public: float m_hadStochasticTerm; ///< The stochastic term for Hadronic shower energy resolution float m_emConstantTerm; ///< The constant term for EM shower energy resolution float m_hadConstantTerm; ///< The constant term for Hadronic shower energy resolution + bool m_debug; }; /** diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h b/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h index 2b2c4011d2b24434816cd6bc94050dd540864a5e..ad8f903451f4cea1a2a9b2a1879a615fd01d4139 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h +++ b/Reconstruction/PFA/Pandora/GaudiPandora/include/TrackCreator.h @@ -105,6 +105,7 @@ public: float m_minTpcHitFractionOfExpected; ///< Minimum fraction of TPC hits compared to expected int m_minFtdHitsForTpcHitFraction; ///< Minimum number of FTD hits to ignore TPC hit fraction bool m_use_dd4hep_geo; /// + bool m_debug; }; /** diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp index a97fff97ae3bba4284739af60e15e539f948e71c..7e0836c9330ad81423000b6c6beebd22ee2cb1cd 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/CaloHitCreator.cpp @@ -49,9 +49,11 @@ CaloHitCreator::CaloHitCreator(const Settings &settings, const pandora::Pandora throw "Failed to find GearSvc ..."; } _GEAR = iSvc->getGearMgr(); - if(m_settings.m_use_dd4hep_geo){ + if(m_settings.m_use_dd4hep_decoder){ sc = svcloc->service("GeomSvc", m_geosvc, false); if (!sc) throw "Failed to find GeomSvc."; + } + if(m_settings.m_use_dd4hep_geo){ const dd4hep::rec::LayeredCalorimeterData * eCalBarrelExtension= PanUtil::getExtension( ( dd4hep::DetType::CALORIMETER | dd4hep::DetType::ELECTROMAGNETIC | dd4hep::DetType::BARREL), ( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ) ); m_eCalBarrelOuterZ = eCalBarrelExtension->extent[3]/dd4hep::mm; @@ -121,13 +123,14 @@ pandora::StatusCode CaloHitCreator::CreateCaloHits(const CollectionMaps& collect pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& collectionMaps) { - for (StringVector::const_iterator iter = m_settings.m_eCalCaloHitCollections.begin(), iterEnd = m_settings.m_eCalCaloHitCollections.end(); - iter != iterEnd; ++iter) + for (unsigned int k = 0; k < m_settings.m_eCalCaloHitCollections.size(); k++) { - if(collectionMaps.collectionMap_CaloHit.find(*iter) == collectionMaps.collectionMap_CaloHit.end()) { std::cout<<"not find "<<(*iter)<<std::endl; continue;} + std::string tmp_col_name = m_settings.m_eCalCaloHitCollections.at(k); + if(collectionMaps.collectionMap_CaloHit.find(tmp_col_name) == collectionMaps.collectionMap_CaloHit.end()) { std::cout<<"not find "<<tmp_col_name<<std::endl; continue;} try { - const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(*iter))->second; + if(m_settings.m_debug) std::cout<<"CaloHitCreator for "<<tmp_col_name<<std::endl; + const std::vector<edm4hep::CalorimeterHit>& pCaloHitCollection = (collectionMaps.collectionMap_CaloHit.find(tmp_col_name))->second; const int nElements(pCaloHitCollection.size()); if (0 == nElements) @@ -141,8 +144,9 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col const std::string layerCoding(this->GetLayerCoding(layerCodingString)); const std::string staveCoding(this->GetStaveCoding(layerCodingString)); // get the DD4hep readout - const std::string name_readout = "EcalBarrelCollection"; - if(m_settings.m_use_dd4hep_geo && m_settings.m_use_dd4hep_decoder ){ + const std::string name_readout = m_settings.m_eCalCaloReadOuts.at(k); + if(m_settings.m_debug) std::cout<<"readout= "<<name_readout<<std::endl; + if( m_settings.m_use_dd4hep_decoder ){ m_decoder = m_geosvc->getDecoder(name_readout); if (!m_decoder) throw "Failed to get the decoder. "; } @@ -163,7 +167,7 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col // Hybrid ECAL including pure ScECAL. if (m_settings.m_useEcalScLayers) { - std::string collectionName(*iter); + std::string collectionName(tmp_col_name); std::transform(collectionName.begin(), collectionName.end(), collectionName.begin(), ::tolower); if (collectionName.find("ecal", 0) == std::string::npos) @@ -265,7 +269,7 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col } catch (...) { - std::cout<< "Failed to extract ecal calo hit collection: " << *iter << std::endl; + std::cout<< "Failed to extract ecal calo hit collection: " << tmp_col_name << std::endl; } } diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/GeometryCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/GeometryCreator.cpp index 2e996bfcdf35bdd963a5c214e48f08e082bac6d4..7a9a74cfe3ce2de993ba4c6a68a48bf00ab2ba00 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/GeometryCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/GeometryCreator.cpp @@ -111,6 +111,7 @@ void GeometryCreator::SetMandatorySubDetectorParameters(SubDetectorTypeMap &subD trackerParameters.m_innerRCoordinate = tpcParameters.getPadLayout().getPlaneExtent()[0]; trackerParameters.m_outerRCoordinate = tpcParameters.getPadLayout().getPlaneExtent()[1]; trackerParameters.m_outerZCoordinate = tpcParameters.getMaxDriftLength(); + std::cout<<"Gear m_innerRCoordinate="<<trackerParameters.m_innerRCoordinate.Get()<<",m_outerRCoordinate="<<trackerParameters.m_outerRCoordinate.Get()<<",m_outerZCoordinate="<<trackerParameters.m_outerZCoordinate.Get()<<std::endl; } trackerParameters.m_innerZCoordinate = 0.f; trackerParameters.m_innerPhiCoordinate = 0.f; diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp index 92eff92534fe76494250e43867e63b28049f1deb..9d94a93931dd76458ac5da6cdc49a4762ad2ba59 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/PandoraPFAlg.cpp @@ -83,6 +83,16 @@ void PandoraPFAlg::FinaliseSteeringParameters(ISvcLocator* svcloc) std::cout<<"m_innerBField="<<m_settings.m_innerBField<<std::endl; m_mcParticleCreatorSettings.m_bField = m_settings.m_innerBField; } + std::cout<<"m_absorberRadLengthECal ="<< m_geometryCreatorSettings.m_absorberRadLengthECal <<std::endl; + std::cout<<"m_absorberIntLengthECal ="<< m_geometryCreatorSettings.m_absorberIntLengthECal <<std::endl; + std::cout<<"m_absorberRadLengthHCal ="<< m_geometryCreatorSettings.m_absorberRadLengthHCal <<std::endl; + std::cout<<"m_absorberIntLengthHCal ="<< m_geometryCreatorSettings.m_absorberIntLengthHCal <<std::endl; + std::cout<<"m_absorberRadLengthOther ="<< m_geometryCreatorSettings.m_absorberRadLengthOther <<std::endl; + std::cout<<"m_absorberIntLengthOther ="<< m_geometryCreatorSettings.m_absorberIntLengthOther <<std::endl; + std::cout<<"m_hCalEndCapInnerSymmetryOrder ="<< m_geometryCreatorSettings.m_hCalEndCapInnerSymmetryOrder<<std::endl; + std::cout<<"m_hCalEndCapInnerPhiCoordinate ="<< m_geometryCreatorSettings.m_hCalEndCapInnerPhiCoordinate<<std::endl; + + } @@ -116,6 +126,7 @@ StatusCode PandoraPFAlg::initialize() m_tuple->addItem( "m_mc_pz" , m_n_mc ,m_mc_pz ).ignore(); m_tuple->addItem( "m_mc_charge", m_n_mc ,m_mc_charge ).ignore(); m_tuple->addItem( "m_hasConversion", m_hasConversion ).ignore(); + m_tuple->addItem( "m_marlinTrack", m_marlinTrack ).ignore(); } else { // did not manage to book the N tuple.... error() << " Cannot book N-tuple:" << long( m_tuple ) << endmsg; @@ -169,6 +180,7 @@ StatusCode PandoraPFAlg::initialize() m_settings.m_muonBarrelBField = m_MuonBarrelBField; m_settings.m_muonEndCapBField = m_MuonEndCapBField; + m_trackCreatorSettings.m_debug = m_debug; m_trackCreatorSettings.m_trackCollections = m_TrackCollections ; m_trackCreatorSettings.m_kinkVertexCollections = m_KinkVertexCollections; m_trackCreatorSettings.m_prongVertexCollections = m_ProngVertexCollections; @@ -176,20 +188,28 @@ StatusCode PandoraPFAlg::initialize() m_trackCreatorSettings.m_v0VertexCollections = m_V0VertexCollections; m_trackCreatorSettings.m_use_dd4hep_geo = m_use_dd4hep_geo; + m_caloHitCreatorSettings.m_debug = m_debug; m_caloHitCreatorSettings.m_eCalCaloHitCollections = m_ECalCaloHitCollections; + m_caloHitCreatorSettings.m_eCalCaloReadOuts = m_ECalReadOutNames; m_caloHitCreatorSettings.m_hCalCaloHitCollections = m_HCalCaloHitCollections; + m_caloHitCreatorSettings.m_hCalCaloReadOuts = m_HCalReadOutNames; m_caloHitCreatorSettings.m_lCalCaloHitCollections = m_LCalCaloHitCollections; + m_caloHitCreatorSettings.m_lCalCaloReadOuts = m_LCalReadOutNames; m_caloHitCreatorSettings.m_lHCalCaloHitCollections = m_LHCalCaloHitCollections; + m_caloHitCreatorSettings.m_lHCalCaloReadOuts = m_LHCalReadOutNames; m_caloHitCreatorSettings.m_muonCaloHitCollections = m_MuonCaloHitCollections; + m_caloHitCreatorSettings.m_muonCalCaloReadOuts = m_MuonCalReadOutNames; m_caloHitCreatorSettings.m_use_dd4hep_geo = m_use_dd4hep_geo; m_caloHitCreatorSettings.m_use_dd4hep_decoder = m_use_dd4hep_decoder ; m_caloHitCreatorSettings.m_use_preshower = m_use_preshower ; m_mcParticleCreatorSettings.m_mcParticleCollections = m_MCParticleCollections; m_mcParticleCreatorSettings.m_CaloHitRelationCollections = m_RelCaloHitCollections; m_mcParticleCreatorSettings.m_TrackRelationCollections = m_RelTrackCollections; + m_mcParticleCreatorSettings.m_debug = m_debug; // Absorber properties + m_geometryCreatorSettings.m_debug = m_debug; m_geometryCreatorSettings.m_absorberRadLengthECal = m_AbsorberRadLengthECal; m_geometryCreatorSettings.m_absorberIntLengthECal = m_AbsorberIntLengthECal; m_geometryCreatorSettings.m_absorberRadLengthHCal = m_AbsorberRadLengthHCal; @@ -199,6 +219,7 @@ StatusCode PandoraPFAlg::initialize() // Name of PFO collection written by GaudiPandora + m_pfoCreatorSettings.m_debug = m_debug; m_pfoCreatorSettings.m_clusterCollectionName = m_ClusterCollectionName;// not used m_pfoCreatorSettings.m_pfoCollectionName = m_PFOCollectionName;// m_pfoCreatorSettings.m_startVertexCollectionName = m_StartVertexCollectionName; // @@ -443,6 +464,7 @@ collectionMap_TrkRel.clear(); StatusCode PandoraPFAlg::updateMap() { + m_marlinTrack = 0; //check for(auto &v : m_dataHandles){ try{ if(m_collections[v.first]=="MCParticle"){ @@ -479,6 +501,7 @@ StatusCode PandoraPFAlg::updateMap() m_CollectionMaps->collectionMap_Track[v.first] = v_cal ; for(unsigned int i=0 ; i< po->size(); i++) m_CollectionMaps->collectionMap_Track [v.first].push_back(po->at(i)); std::cout<<"saved col name="<<v.first<<std::endl; + m_marlinTrack = po->size(); } else{ std::cout<<"don't find col name="<<v.first<<std::endl; @@ -562,10 +585,11 @@ StatusCode PandoraPFAlg::Ana() m_pReco_py [m_n_rec]=py; m_pReco_pz [m_n_rec]=pz; m_n_rec ++ ; + if(m_debug) std::cout<<"rec type="<<type<<",energy="<<energy<<std::endl; for(int j=0; j < reco_associa_col->size(); j++) { if(reco_associa_col->at(j).getRec().id() != pReco.id() ) continue; - std::cout<<"MC pid ="<<reco_associa_col->at(j).getSim().getPDG()<<",weight="<<reco_associa_col->at(j).getWeight()<<", px="<<reco_associa_col->at(j).getSim().getMomentum()[0]<<", py="<<reco_associa_col->at(j).getSim().getMomentum()[1]<<",pz="<<reco_associa_col->at(j).getSim().getMomentum()[2]<<std::endl; + if(m_debug) std::cout<<"MC pid ="<<reco_associa_col->at(j).getSim().getPDG()<<",weight="<<reco_associa_col->at(j).getWeight()<<", px="<<reco_associa_col->at(j).getSim().getMomentum()[0]<<", py="<<reco_associa_col->at(j).getSim().getMomentum()[1]<<",pz="<<reco_associa_col->at(j).getSim().getMomentum()[2]<<std::endl; } } const edm4hep::MCParticleCollection* MCParticle = nullptr; @@ -581,6 +605,8 @@ StatusCode PandoraPFAlg::Ana() m_mc_py [m_n_mc] = MCParticle->at(i).getMomentum()[1]; m_mc_pz [m_n_mc] = MCParticle->at(i).getMomentum()[2]; m_mc_charge[m_n_mc] = MCParticle->at(i).getCharge(); + float mc_E = sqrt( MCParticle->at(i).getMass()*MCParticle->at(i).getMass() + MCParticle->at(i).getMomentum()[0]*MCParticle->at(i).getMomentum()[0] + MCParticle->at(i).getMomentum()[1]*MCParticle->at(i).getMomentum()[1] + MCParticle->at(i).getMomentum()[2]*MCParticle->at(i).getMomentum()[2]); + if(m_debug) std::cout<<"mc type="<<MCParticle->at(i).getPDG()<<",energy="<<mc_E<<std::endl; m_n_mc ++ ; if (MCParticle->at(i).getPDG() != 22) continue; int hasEm = 0; diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp index 8e51d16c863803f9f1b97b5b7596fa7b189f4a5e..f9fd064f1a7195bb046ebcb4efcf5d24895e69e2 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/TrackCreator.cpp @@ -8,6 +8,7 @@ #include "edm4hep/Vertex.h" +#include "edm4hep/Vector3f.h" #include "edm4hep/ReconstructedParticle.h" #include "gear/BField.h" @@ -61,10 +62,11 @@ TrackCreator::TrackCreator(const Settings &settings, const pandora::Pandora *con //There should only be one TPC if(tpcDets.size()==1) { theExtension = tpcDets[0].extension<dd4hep::rec::FixedPadSizeTPCData>(); - m_tpcInnerR = theExtension->rMin/dd4hep::mm ; - m_tpcOuterR = theExtension->rMax/dd4hep::mm ; + m_tpcInnerR = theExtension->rMinReadout/dd4hep::mm ;// keep same as Gear + m_tpcOuterR = theExtension->rMaxReadout/dd4hep::mm ; + m_tpcZmax = theExtension->driftLength/dd4hep::mm ; m_tpcMaxRow = theExtension->maxRow; - m_tpcZmax = theExtension->zHalf/dd4hep::mm ; + std::cout<<"DD4HEP m_tpcInnerR="<<m_tpcInnerR<<",m_tpcOuterR="<<m_tpcOuterR<<",m_tpcMaxRow="<<m_tpcMaxRow<<",m_tpcZmax="<<m_tpcZmax<<std::endl; } else{ m_tpcInnerR = 100 ; @@ -102,7 +104,7 @@ TrackCreator::TrackCreator(const Settings &settings, const pandora::Pandora *con // Take the mean z position of the staggered petals const double zpos(thisLayer.zPosition/dd4hep::mm); m_ftdZPositions.push_back(zpos); - std::cout << " layer " << i << " - mean z position = " << zpos << std::endl; + std::cout << "DD: layer " << i << " - mean z position = " << zpos << std::endl; } m_nFtdLayers = m_ftdZPositions.size() ; } @@ -132,6 +134,7 @@ TrackCreator::TrackCreator(const Settings &settings, const pandora::Pandora *con m_tpcOuterR = (_GEAR->getTPCParameters().getPadLayout().getPlaneExtent()[1]); m_tpcMaxRow = (_GEAR->getTPCParameters().getPadLayout().getNRows()); m_tpcZmax = (_GEAR->getTPCParameters().getMaxDriftLength()); + std::cout<<"Gear: m_tpcInnerR="<<m_tpcInnerR<<",m_tpcOuterR="<<m_tpcOuterR<<",m_tpcMaxRow="<<m_tpcMaxRow<<",m_tpcZmax="<<m_tpcZmax<<std::endl; try{ m_ftdInnerRadii = _GEAR->getGearParameters("FTD").getDoubleVals("FTDInnerRadius"); m_ftdOuterRadii = _GEAR->getGearParameters("FTD").getDoubleVals("FTDOuterRadius"); @@ -149,7 +152,7 @@ TrackCreator::TrackCreator(const Settings &settings, const pandora::Pandora *con // Take the mean z position of the staggered petals const double zpos(ftdLayerLayout.getZposition(i)); m_ftdZPositions.push_back(zpos); - std::cout << " layer " << i << " - mean z position = " << zpos << std::endl; + std::cout << "Gear: layer " << i << " - mean z position = " << zpos << std::endl; } m_nFtdLayers = m_ftdZPositions.size() ; } @@ -502,7 +505,7 @@ const edm4hep::Track* TrackCreator::GetTrackAddress(const CollectionMaps& collec pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionMaps) { - std::cout<<"start TrackCreator::CreateTracks:"<<std::endl; + if(m_settings.m_debug) std::cout<<"start TrackCreator::CreateTracks:"<<std::endl; for (StringVector::const_iterator iter = m_settings.m_trackCollections.begin(), iterEnd = m_settings.m_trackCollections.end(); iter != iterEnd; ++iter) { @@ -511,6 +514,7 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM { const std::vector<edm4hep::Track>& pTrackCollection = (collectionMaps.collectionMap_Track.find(*iter))->second; + if(m_settings.m_debug) std::cout<<"TrackSize:"<<pTrackCollection.size()<<std::endl; for (int i = 0, iMax = pTrackCollection.size(); i < iMax; ++i) { try @@ -519,7 +523,14 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM const edm4hep::Track* pTrack = (const edm4hep::Track*)(&pTrack0); if (NULL == pTrack) throw ("Collection type mismatch"); - + if(m_settings.m_debug){ + for(int ip=0; ip<pTrack->trackStates_size(); ip++){ + edm4hep::TrackState tmp_pTrackState = pTrack->getTrackStates(ip); + const double tmp_pt(m_bField * 2.99792e-4 / std::fabs(tmp_pTrackState.omega)); + edm4hep::Vector3f pref = tmp_pTrackState.referencePoint; + std::cout<<"ip="<<ip<<",pt=" << tmp_pt <<",refx="<<pref[0]<<",refy="<<pref[1]<<",refz="<<pref[2]<<",tanLambda=" << tmp_pTrackState.tanLambda<<",D0="<<tmp_pTrackState.D0<<",Z0="<<tmp_pTrackState.Z0<<",phi="<<tmp_pTrackState.phi<< std::endl; + } + } int minTrackHits = m_settings.m_minTrackHits; const float tanLambda(std::fabs(pTrack->getTrackStates(0).tanLambda)); @@ -569,6 +580,7 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM this->TrackReachesECAL(pTrack, trackParameters); this->DefineTrackPfoUsage(pTrack, trackParameters); + if(m_settings.m_debug) std::cout<<"i="<<i<<",canFormPfo=" << trackParameters.m_canFormPfo.Get()<<", m_canFormClusterlessPfo="<<trackParameters.m_canFormClusterlessPfo.Get()<<",m_reachesCalorimeter="<< trackParameters.m_reachesCalorimeter.Get()<<"," << std::endl; PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::Track::Create(*m_pPandora, trackParameters)); m_trackVector.push_back(pTrack); } @@ -595,18 +607,17 @@ pandora::StatusCode TrackCreator::CreateTracks(const CollectionMaps& collectionM void TrackCreator::GetTrackStates(const edm4hep::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const { - edm4hep::TrackState pTrackState = pTrack->getTrackStates(1); // ref /cvmfs/cepcsw.ihep.ac.cn/prototype/LCIO/include/EVENT/TrackState.h + // for DD4HEP, 0 is IP, 1 is AtFirstHit, 2 is AtLastHit, 3 is AtCalo + edm4hep::TrackState pTrackState = pTrack->getTrackStates(0); const double pt(m_bField * 2.99792e-4 / std::fabs(pTrackState.omega)); trackParameters.m_momentumAtDca = pandora::CartesianVector(std::cos(pTrackState.phi), std::sin(pTrackState.phi), pTrackState.tanLambda) * pt; - this->CopyTrackState(pTrack->getTrackStates(2), trackParameters.m_trackStateAtStart); + this->CopyTrackState(pTrack->getTrackStates(1), trackParameters.m_trackStateAtStart);//m_trackStateAtStart is AtFirstHit auto pEndTrack = (pTrack->tracks_size() ==0 ) ? *pTrack : pTrack->getTracks(pTrack->tracks_size()-1); - this->CopyTrackState(pEndTrack.getTrackStates(3), trackParameters.m_trackStateAtEnd); - //FIXME ? LCIO input only has 4 states, so 4 can't be used. - if( pEndTrack.trackStates_size()<5) this->CopyTrackState(pEndTrack.getTrackStates(3), trackParameters.m_trackStateAtCalorimeter); - else this->CopyTrackState(pEndTrack.getTrackStates(4), trackParameters.m_trackStateAtCalorimeter); + this->CopyTrackState(pEndTrack.getTrackStates(2), trackParameters.m_trackStateAtEnd);// m_trackStateAtEnd is AtLastHit + this->CopyTrackState(pEndTrack.getTrackStates(3), trackParameters.m_trackStateAtCalorimeter); trackParameters.m_isProjectedToEndCap = ((std::fabs(trackParameters.m_trackStateAtCalorimeter.Get().GetPosition().GetZ()) < m_eCalEndCapInnerZ) ? false : true); @@ -802,6 +813,7 @@ void TrackCreator::DefineTrackPfoUsage(const edm4hep::Track *const pTrack, Pando if (this->PassesQualityCuts(pTrack, trackParameters)) { + if(m_settings.m_debug) std::cout<<"passed PassesQualityCuts"<<std::endl; const pandora::CartesianVector &momentumAtDca(trackParameters.m_momentumAtDca.Get()); const float pX(momentumAtDca.GetX()), pY(momentumAtDca.GetY()), pZ(momentumAtDca.GetZ()); const float pT(std::sqrt(pX * pX + pY * pY)); @@ -949,7 +961,7 @@ int TrackCreator::GetNTpcHits(const edm4hep::Track *const pTrack) const //According to FG: [ 2 * lcio::ILDDetID::TPC - 2 ] is the first number and it is supposed to //be the number of hits in the fit and this is what should be used ! // at least for DD4hep/DDSim - return pTrack->getSubDetectorHitNumbers(2 * 4 - 2 );//FIXME + return pTrack->getSubDetectorHitNumbers(3);//FIXME https://github.com/wenxingfang/CEPCSW/blob/master/Reconstruction/Tracking/src/FullLDCTracking/FullLDCTrackingAlg.cpp#L483 } else return pTrack->getSubDetectorHitNumbers(2 * 4 - 1);// lcio::ILDDetID::TPC=4, still use LCIO code now } @@ -965,7 +977,7 @@ int TrackCreator::GetNFtdHits(const edm4hep::Track *const pTrack) const // ---- use hitsInFit : //return pTrack->getSubdetectorHitNumbers()[ 2 * lcio::ILDDetID::FTD - 1 ]; if(m_settings.m_use_dd4hep_geo){ - return pTrack->getSubDetectorHitNumbers(2 * 3 - 1);//FIXME + return pTrack->getSubDetectorHitNumbers(1);//FIXME https://github.com/wenxingfang/CEPCSW/blob/master/Reconstruction/Tracking/src/FullLDCTracking/FullLDCTrackingAlg.cpp#L481 } else return pTrack->getSubDetectorHitNumbers( 2 * 3 - 1 );// lcio::ILDDetID::FTD=3 } diff --git a/Reconstruction/PFA/Pandora/GaudiPandora/src/Utility.cpp b/Reconstruction/PFA/Pandora/GaudiPandora/src/Utility.cpp index 02797f01c188f175867e7e1af78ac0fc1e239322..83edea103d7fab42363d57e7076ba8b4c7829177 100644 --- a/Reconstruction/PFA/Pandora/GaudiPandora/src/Utility.cpp +++ b/Reconstruction/PFA/Pandora/GaudiPandora/src/Utility.cpp @@ -22,7 +22,7 @@ std::vector<double> PanUtil::getTrackingRegionExtent(){ extent.reserve(3); try{ dd4hep::Detector & mainDetector = dd4hep::Detector::getInstance(); - extent[0]=0.1; ///FIXME! CLIC-specific: Inner radius was set to 0 for SiD-type detectors + extent[0]=329; ///FIXME! CEPCv4-specific extent[1]=mainDetector.constantAsDouble("tracker_region_rmax")/dd4hep::mm; extent[2]=mainDetector.constantAsDouble("tracker_region_zmax")/dd4hep::mm; } diff --git a/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt b/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt index 16cd82d27ec2a26c0860ea72fbde7170b28d7515..84ba59b342928ec9b6819285eb2aad4c8a265788 100644 --- a/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt +++ b/Reconstruction/PFA/Pandora/MatrixPandora/CMakeLists.txt @@ -1,45 +1,34 @@ -gaudi_subdir(MatrixPandora v0r0) - -find_package(DD4hep COMPONENTS DDG4 REQUIRED) -find_package(CLHEP REQUIRED;CONFIG) -find_package(LCIO REQUIRED ) -find_package(GEAR REQUIRED) -find_package(EDM4HEP REQUIRED ) -include_directories(${EDM4HEP_INCLUDE_DIR}) - -find_package(PandoraSDK REQUIRED ) -find_package(LCContent REQUIRED ) -include_directories(${PandoraSDK_INCLUDE_DIRS}) -link_libraries(${PandoraSDK_LIBRARIES}) -include_directories(${LCContent_INCLUDE_DIRS}) -link_libraries(${LCContent_LIBRARIES}) - - -list(APPEND CMAKE_MODULE_PATH "$ENV{ROOTSYS}/etc/cmake/") -find_package(ROOT 5.26.00 REQUIRED COMPONENTS Eve Geom RGL EG) +# Modules +gaudi_add_module(MatrixPandora + SOURCES src/PandoraMatrixAlg.cpp + src/MCParticleCreator.cpp + src/GeometryCreator.cpp + src/CaloHitCreator.cpp + src/TrackCreator.cpp + src/PfoCreator.cpp + LINK EventSeeder + GearSvc + DetInterface + DataHelperLib + Gaudi::GaudiKernel + k4FWCore::k4FWCore + ${PandoraSDK_LIBRARIES} + ${LCContent_LIBRARIES} + ${CLHEP_LIBRARIES} + ${ROOT_LIBRARIES} + ${LCIO_LIBRARIES} + ${GEAR_LIBRARIES} + ${DD4hep_COMPONENT_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict +) +target_include_directories(MatrixPandora PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) -gaudi_depends_on_subdirs( - Service/EventSeeder - Service/GearSvc - Detector/DetInterface - Utilities/DataHelper -) +install(TARGETS MatrixPandora + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) -set(dir_srcs - src/PandoraMatrixAlg.cpp - src/MCParticleCreator.cpp - src/GeometryCreator.cpp - src/CaloHitCreator.cpp - src/TrackCreator.cpp - src/PfoCreator.cpp -) -set(dir_include include) -# Modules -gaudi_add_module(MatrixPandora ${dir_srcs} - INCLUDE_DIRS ${dir_include} GaudiKernel k4FWCore ${CLHEP_INCLUDE_DIR} ${LCIO_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} gear DD4hep - LINK_LIBRARIES GaudiKernel k4FWCore ${CLHEP_LIBRARIES} ROOT ${LCIO_LIBRARIES} ${GEAR_LIBRARIES} DD4hep ${DD4hep_COMPONENT_LIBRARIES} DDRec DataHelperLib - -Wl,--no-as-needed - EDM4HEP::edm4hep EDM4HEP::edm4hepDict - -Wl,--as-needed -) diff --git a/Reconstruction/PFA/Pandora/PandoraLikelihoodData9EBin.xml b/Reconstruction/PFA/Pandora/PandoraLikelihoodData9EBin.xml index ab63905438a22a636fc7d58a6853acc4f858533e..3123ccf89061825c1974bf693d19bf5c58b200f5 100644 --- a/Reconstruction/PFA/Pandora/PandoraLikelihoodData9EBin.xml +++ b/Reconstruction/PFA/Pandora/PandoraLikelihoodData9EBin.xml @@ -1,652 +1,652 @@ <NEnergyBins>9</NEnergyBins> <EnergyBinLowerEdges>0 0.2 0.5 1 1.5 2.5 5 10 20 </EnergyBinLowerEdges> -<NSignalEvents>42213 22561 20497 14219 19767 26770 22039 14547 10186 </NSignalEvents> -<NBackgroundEvents>109034 45109 13323 4171 3447 3033 2077 1206 1006 </NBackgroundEvents> +<NSignalEvents>0 0 0 0 0 0 0 0 0 </NSignalEvents> +<NBackgroundEvents>32791 5844 2492 1566 2072 3443 4109 5165 16767 </NBackgroundEvents> <PhotonSigPeakRms_0> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0.000213204 0.00485632 0.0255372 0.0994717 0.15481 0.0870111 0.0978845 0.0800701 0.0638429 0.0593656 0.0497714 0.0426172 0.0375951 0.0313884 0.0267216 0.0234999 0.0200649 0.0174117 0.0140478 0.0110393 0.00916779 0.00864663 0.00575652 0.00547225 0.00381399 0.0035771 0.0028901 0.00232156 0.00198991 0.00172933 0.00127923 0.00116078 0.000947575 0.000639613 0.000331651 0.000473788 0.000426409 0.000355341 0.000331651 0.000260583 0.000260583 0.000260583 0.000118447 7.10682e-05 0.000331651 4.73788e-05 4.73788e-05 7.10682e-05 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakRms_0> <PhotonBkgPeakRms_0> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0.000183429 0.00168755 0.0126291 0.0673093 0.147431 0.0799659 0.109259 0.0951355 0.0711154 0.0654383 0.0544968 0.0471596 0.0394831 0.0327054 0.0263221 0.0227177 0.0189482 0.0167562 0.0134729 0.011446 0.00903388 0.00792413 0.00656676 0.0058147 0.00423721 0.00423721 0.00329255 0.00319167 0.00265972 0.00228369 0.0020544 0.00180678 0.00159583 0.00145826 0.00132986 0.00114643 0.00113726 0.000953831 0.000953831 0.000935488 0.000834602 0.000596144 0.000412715 0.000412715 0.000403544 0.000421887 0.000247629 0.000394372 0 </BinContents> + <BinContents>0 0 0 6.09923e-05 0.00262267 0.0142417 0.0759355 0.146443 0.0792291 0.11125 0.0987466 0.0766369 0.0766979 0.0653533 0.0559605 0.0451953 0.035528 0.0278125 0.0219267 0.0175048 0.0124424 0.0101857 0.00741057 0.00530633 0.00387301 0.0024092 0.00213473 0.00170779 0.000731908 0.000853893 0.000518435 0.000457443 0.000243969 0.000243969 0.000121985 6.09923e-05 6.09923e-05 0 0 0 3.04962e-05 0 0 3.04962e-05 0 3.04962e-05 0 0 0 0 0 0 </BinContents> </PhotonBkgPeakRms_0> <PhotonSigPeakRms_1> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0.000132973 0.00093081 0.00483135 0.0188378 0.0378086 0.0551837 0.0777448 0.1023 0.108949 0.1066 0.0948096 0.0789859 0.0641816 0.0491556 0.0402908 0.0274811 0.0224724 0.0156021 0.0133859 0.0121892 0.00979566 0.00771242 0.00611675 0.00540756 0.00483135 0.0047427 0.00367891 0.00305838 0.00257081 0.00248216 0.00164 0.00234919 0.00195027 0.00203892 0.00132973 0.00115243 0.00101946 0.00093081 0.0012854 0.000531891 0.000398918 0.000398918 0.000664864 0.000398918 0.000576216 0.000487567 0.00031027 0.000265946 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakRms_1> <PhotonBkgPeakRms_1> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 4.43371e-05 0.000665056 0.00181782 0.00589683 0.0195526 0.0389058 0.0514975 0.0672815 0.0762376 0.0795185 0.0771686 0.0732448 0.0666164 0.0605644 0.0513423 0.0425414 0.0407236 0.0338292 0.0288856 0.0250948 0.0215921 0.0178457 0.0153628 0.0141435 0.0114833 0.00935512 0.00791416 0.00773682 0.00649538 0.00476623 0.00418985 0.00474406 0.00399033 0.00336962 0.00272673 0.00270456 0.00266022 0.00195083 0.00192866 0.00172915 0.00157397 0.00175131 0.00164047 0.00168481 0.00104192 0.00113059 0.0011971 0.00115276 0.000709393 0 </BinContents> + <BinContents>0 0 0 0.000171116 0.00188227 0.00718686 0.0237851 0.0515058 0.0686174 0.08436 0.0833333 0.0879535 0.0817933 0.0773443 0.0793977 0.0626283 0.0511636 0.0482546 0.036961 0.0290897 0.0258385 0.0227584 0.0196783 0.0136893 0.0121492 0.00564682 0.00581793 0.00290897 0.00393566 0.00273785 0.00154004 0.00136893 0.00136893 0.00188227 0.000684463 0.000513347 0.000513347 0.000513347 0.000171116 0.000342231 0.000171116 0.000171116 0 0 0.000171116 0 0 0 0 0 0 0 </BinContents> </PhotonBkgPeakRms_1> <PhotonSigPeakRms_2> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 4.87876e-05 0 0.000487876 0.00278089 0.00482998 0.0105869 0.0228814 0.0499097 0.0847929 0.110894 0.131678 0.136605 0.115627 0.0926477 0.0687906 0.0494707 0.0325901 0.021369 0.0157096 0.0120018 0.00785481 0.00658633 0.00390301 0.00336635 0.00219544 0.00195151 0.0015612 0.00160999 0.000926965 0.000926965 0.000390301 0.000878177 0.000634239 0.000390301 0.000487876 0.000439089 0.000243938 0.000292726 0.000243938 4.87876e-05 0.000243938 0.000292726 9.75753e-05 0.000146363 0.000146363 0.000146363 4.87876e-05 0.000243938 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakRms_2> <PhotonBkgPeakRms_2> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0.000225175 0.000600465 0.00150116 0.00360279 0.011559 0.0228177 0.02582 0.0390302 0.0531412 0.0672521 0.0832395 0.0880432 0.0803873 0.0737071 0.0711551 0.0585454 0.0469864 0.0385799 0.0316745 0.029648 0.0231179 0.0178638 0.0179389 0.0138107 0.0114088 0.0101329 0.00900698 0.0082564 0.00683029 0.00637994 0.00547925 0.00450349 0.00382797 0.00397808 0.00390302 0.00330256 0.00240186 0.00307738 0.00225174 0.0023268 0.00172634 0.00217669 0.00150116 0.00120093 0.00112587 0.00142611 0.00127599 0.00120093 0.00105081 0 </BinContents> + <BinContents>0 0 0 0 0.00120385 0.00280899 0.00963082 0.0292937 0.0658106 0.117175 0.117978 0.125201 0.110353 0.103531 0.0770466 0.0549759 0.0537721 0.0429374 0.0256822 0.0200642 0.0120385 0.0100321 0.00682183 0.00401284 0.00200642 0.00280899 0.0024077 0.000802568 0.000401284 0.000802568 0 0 0 0.000401284 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonBkgPeakRms_2> <PhotonSigPeakRms_3> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0 0 0.000562627 0.00105493 0.00281314 0.00464168 0.00829875 0.0132217 0.0302412 0.0673043 0.109923 0.138828 0.147338 0.131584 0.100992 0.0720866 0.0485969 0.0335467 0.0244743 0.0164569 0.0103383 0.00689219 0.0056966 0.00506365 0.00344609 0.00295379 0.00225051 0.00168788 0.0014769 0.00126591 0.00091427 0.00105493 0.000773613 0.000632956 0.000562627 0.000492299 0.000492299 0.000492299 0.000281314 0.000140657 7.03284e-05 0.000140657 7.03284e-05 0.000140657 0.000281314 0.000281314 7.03284e-05 7.03284e-05 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakRms_3> <PhotonBkgPeakRms_3> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0.000959003 0.000959003 0.00119875 0.00263726 0.00455526 0.0129465 0.0148645 0.0275713 0.0357228 0.0417166 0.0592184 0.0748022 0.0863102 0.0949413 0.0937425 0.0791177 0.0678494 0.0537042 0.0431551 0.0364421 0.0198993 0.0218173 0.0177415 0.012467 0.0136658 0.00982978 0.00671302 0.00767202 0.00479501 0.00599377 0.00551427 0.00407576 0.00287701 0.00359626 0.00311676 0.00287701 0.00383601 0.00263726 0.00191801 0.00167825 0.00287701 0.00119875 0.00167825 0.00167825 0.0014385 0.00167825 0.00119875 0.00119875 0.00191801 0 </BinContents> + <BinContents>0 0 0 0 0 0 0.00446999 0.0159642 0.0434227 0.096424 0.132184 0.146871 0.1341 0.10281 0.0836526 0.0696041 0.054917 0.0408685 0.0255428 0.0172414 0.0108557 0.0083014 0.00446999 0.00063857 0.00319285 0.00191571 0.00127714 0 0.00063857 0 0 0 0 0 0.00063857 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonBkgPeakRms_3> <PhotonSigPeakRms_4> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0 0.000202357 0.000151768 0.00126473 0.00222593 0.00338949 0.00419892 0.00607072 0.0122932 0.0264582 0.0617696 0.105934 0.1459 0.14676 0.137047 0.103455 0.0766429 0.0498305 0.0324278 0.0233217 0.0125968 0.0107249 0.00698133 0.00490717 0.00480599 0.00344008 0.00288359 0.00212475 0.00156827 0.00106238 0.00131532 0.00080943 0.00101179 0.000708251 0.000910609 0.00075884 0.000556483 0.000657662 0.000404715 0.000354126 0.000455304 0.000202357 0.000354126 0.000151768 0.000252947 0.000202357 0.000252947 0.000202357 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakRms_4> <PhotonBkgPeakRms_4> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0.000580215 0.000870322 0.00116043 0.00203075 0.00319118 0.00696258 0.0127647 0.018857 0.0208877 0.0345228 0.0368436 0.05396 0.0791993 0.0771685 0.100667 0.086452 0.0786191 0.0646939 0.0519292 0.0472875 0.0301712 0.0281404 0.0258196 0.0229185 0.0142153 0.00870322 0.00899333 0.0078329 0.00754279 0.00696258 0.00870322 0.00638236 0.00551204 0.00290107 0.00464172 0.00435161 0.00319118 0.00261097 0.00261097 0.00145054 0.00290107 0.00319118 0.00145054 0.00232086 0.00290107 0.00203075 0.000580215 0.00203075 0.000290107 0 </BinContents> + <BinContents>0 0 0 0 0.000482625 0.00144788 0.0111004 0.0183398 0.0241313 0.0511583 0.111004 0.151544 0.152992 0.124517 0.107143 0.0651544 0.0574324 0.0352317 0.0318533 0.0144788 0.0212355 0.00820463 0.00482625 0.0019305 0.00289575 0.000965251 0 0.000482625 0 0 0 0.000482625 0 0 0 0 0 0.000965251 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonBkgPeakRms_4> <PhotonSigPeakRms_5> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0 0 7.47105e-05 0.000747105 0.00194247 0.00265222 0.00414643 0.00489354 0.00638775 0.00762047 0.0194247 0.0411655 0.0872619 0.130855 0.147217 0.140082 0.115652 0.0861038 0.0577512 0.0395966 0.0255136 0.0187897 0.0132238 0.0100486 0.0075084 0.00649981 0.00377288 0.00373552 0.00272693 0.00212925 0.00164363 0.00164363 0.0014195 0.0010833 0.00100859 0.000971236 0.000560329 0.000933881 0.000635039 0.000373552 0.000448263 0.000485618 0.000410908 0.000298842 0.000112066 0.000261487 7.47105e-05 0.000112066 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakRms_5> <PhotonBkgPeakRms_5> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0 0.000329707 0.000329707 0.00131883 0.00098912 0.00395648 0.00758325 0.0102209 0.0181339 0.0214309 0.0276954 0.0412133 0.0626442 0.0791296 0.0919881 0.0900099 0.0824266 0.0787999 0.0646225 0.0586878 0.0412133 0.0306627 0.0253874 0.019123 0.0211012 0.0151665 0.0121991 0.00923178 0.00890208 0.00758325 0.00956149 0.00626442 0.00560501 0.0052753 0.00395648 0.0052753 0.00296736 0.00395648 0.00296736 0.00395648 0.00296736 0.00329707 0.00263765 0.00296736 0.00164853 0.00329707 0.000659413 0.000659413 0 </BinContents> + <BinContents>0 0 0 0 0.000290444 0.002614 0.0136509 0.0217833 0.0226547 0.0255591 0.0752251 0.151322 0.187627 0.168167 0.114726 0.0659309 0.041824 0.0354342 0.0255591 0.0185884 0.0139413 0.005228 0.00319489 0.00348533 0.00116178 0.000871333 0.000580889 0.000290444 0.000290444 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonBkgPeakRms_5> <PhotonSigPeakRms_6> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0 0 4.53741e-05 0.000453741 0.0012251 0.00235945 0.00349381 0.00725986 0.0077136 0.00830346 0.0107083 0.0142475 0.030809 0.0653387 0.105949 0.14125 0.141113 0.126412 0.0980988 0.0671537 0.045601 0.0323517 0.02305 0.0158356 0.0112528 0.00925632 0.0064885 0.00480966 0.00426517 0.00299469 0.00190571 0.00163347 0.00167884 0.00154272 0.00131585 0.000408367 0.00077136 0.000499115 0.000408367 0.000544489 0.000226871 0.000317619 0.000317619 0.000181496 0.000181496 9.07482e-05 9.07482e-05 4.53741e-05 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakRms_6> <PhotonBkgPeakRms_6> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0 0 0 0.000481464 0.000962927 0.00385171 0.00674049 0.00818488 0.00770342 0.0129995 0.0187771 0.0187771 0.0438132 0.0370727 0.0597015 0.0746269 0.0702937 0.0794415 0.0871449 0.0645161 0.0654791 0.0452576 0.0409244 0.0365912 0.0284064 0.0327395 0.0202215 0.0231103 0.0216659 0.0144439 0.0129995 0.0110737 0.00914781 0.00433317 0.0052961 0.0052961 0.00481464 0.00337025 0.00288878 0.00337025 0.00144439 0.00192585 0.00337025 0.00337025 0 0.00144439 0.000962927 0.000962927 0 </BinContents> + <BinContents>0 0 0 0 0 0.000243368 0.00584084 0.027744 0.0265271 0.0175225 0.0447798 0.13653 0.233147 0.20808 0.125091 0.0603553 0.0384522 0.0311511 0.0172791 0.0131419 0.00705768 0.00316379 0.00146021 0.00121684 0.000243368 0.000486736 0.000243368 0 0.000243368 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonBkgPeakRms_6> <PhotonSigPeakRms_7> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0.000481199 0.00288719 0.00481199 0.00749295 0.0103801 0.0105864 0.0139548 0.0204853 0.0338901 0.063587 0.10607 0.131986 0.147866 0.122225 0.0924589 0.0685365 0.0504571 0.0290094 0.021104 0.0145047 0.0129924 0.00866158 0.00680553 0.00501822 0.00281845 0.00247474 0.00213102 0.00130611 0.00116863 0.000962398 0.000824912 0.000618684 0.000343713 0.000206228 0.000274971 0.000206228 0.000137485 0.000137485 0 0 6.87427e-05 0 6.87427e-05 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakRms_7> <PhotonBkgPeakRms_7> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0 0 0 0.000829187 0 0 0.00165837 0.00165837 0.00746269 0.00912106 0.0066335 0.0107794 0.0182421 0.0381426 0.0323383 0.0489221 0.0605307 0.0588723 0.0746269 0.0704809 0.0613599 0.0538972 0.0480929 0.0505804 0.0613599 0.053068 0.0414594 0.0290216 0.0273632 0.0298507 0.0215589 0.0182421 0.00829187 0.0107794 0.00912106 0.0107794 0.0066335 0.00165837 0.00497512 0.00248756 0.00414594 0.00248756 0.000829187 0 0 0.000829187 0 0.000829187 0 </BinContents> + <BinContents>0 0 0 0 0 0.000193611 0.000580833 0.00774443 0.0216844 0.0238141 0.0280736 0.0826718 0.245692 0.292546 0.155663 0.0658277 0.0340755 0.017425 0.0125847 0.00484027 0.00367861 0.00135528 0.00135528 0 0.000193611 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonBkgPeakRms_7> <PhotonSigPeakRms_8> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0 9.8174e-05 0.000883566 0.00137444 0.00274887 0.00382878 0.00854114 0.0105046 0.0196348 0.0350481 0.0608679 0.0949342 0.118692 0.125663 0.126743 0.112704 0.0869821 0.060966 0.0416258 0.0243471 0.0175731 0.0121736 0.009032 0.00628313 0.00549774 0.00343609 0.00274887 0.00215983 0.00137444 0.000687218 0.000687218 0.000785392 0.000589044 0.000392696 0.000196348 9.8174e-05 0 0 9.8174e-05 0 0 0 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakRms_8> <PhotonBkgPeakRms_8> <NBinsX>50</NBinsX> <XLow>0</XLow> <XHigh>5</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0 0 0 0.000994036 0.000994036 0.00198807 0.00298211 0.00695825 0.0109344 0.0119284 0.0228628 0.0298211 0.0407555 0.05666 0.0685885 0.0854871 0.0755467 0.0805169 0.0785288 0.0675944 0.0606362 0.0536779 0.0447316 0.0377734 0.0357853 0.028827 0.026839 0.0208747 0.0139165 0.00894632 0.00397614 0.00397614 0.00795229 0.00397614 0.00198807 0.000994036 0.000994036 0 0 0.000994036 0 0 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0.000119282 0.000775333 0.00280313 0.00560625 0.017773 0.0948291 0.315978 0.374784 0.139679 0.03489 0.00834973 0.00316097 0.00059641 0.000417487 0.000238564 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonBkgPeakRms_8> <PhotonSigRmsRatio_0> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.122877 0.0934072 0.085874 0.0783408 0.0719447 0.0632743 0.0581811 0.0520219 0.045223 0.04103 0.0363632 0.0317438 0.0279772 0.0241158 0.021581 0.0195201 0.0181698 0.0155639 0.0136688 0.0120105 0.00952313 0.00933362 0.00840973 0.00774643 0.00696468 0.00559069 0.00570914 0.00495108 0.00483263 0.00405088 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigRmsRatio_0> <PhotonBkgRmsRatio_0> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.128409 0.085056 0.0776363 0.0704001 0.0624851 0.0577893 0.052103 0.0482327 0.0486545 0.0454445 0.0397216 0.0338885 0.0294954 0.0266064 0.0231121 0.0213328 0.0191867 0.0162243 0.015087 0.0132986 0.0117761 0.0114185 0.0105105 0.00974925 0.00872205 0.00805253 0.00725462 0.0067135 0.00589724 0.00574133 0 </BinContents> + <BinContents>0 0.115093 0.0951481 0.0821872 0.0746241 0.0691653 0.063371 0.0584612 0.0538867 0.047879 0.0431521 0.0374188 0.0333933 0.0294593 0.0275685 0.0230856 0.0207679 0.0179927 0.0152176 0.0142722 0.01168 0.0103382 0.00978927 0.00811198 0.00741057 0.00707511 0.00494038 0.00512336 0.0047879 0.0047879 0.00381202 0 </BinContents> </PhotonBkgRmsRatio_0> <PhotonSigRmsRatio_1> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.122512 0.112273 0.100483 0.0878064 0.0772129 0.0699437 0.0597048 0.0542529 0.0468064 0.0381189 0.0327556 0.0286335 0.0246886 0.0201675 0.019813 0.0155135 0.0132973 0.0117903 0.0107265 0.00899783 0.00802269 0.00589513 0.00567351 0.00465405 0.00429945 0.00421081 0.00367891 0.00279243 0.00314702 0.00212757 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigRmsRatio_1> <PhotonBkgRmsRatio_1> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.11 0.0959232 0.0860139 0.0770135 0.0702077 0.0618724 0.0554657 0.0507438 0.0441154 0.0419428 0.0352923 0.0298832 0.0284644 0.024075 0.0227006 0.0205724 0.0195083 0.0161165 0.0146977 0.0127469 0.0120818 0.0100423 0.0101975 0.00966548 0.00804717 0.00755947 0.00720477 0.00620719 0.00607418 0.0055643 0 </BinContents> + <BinContents>0 0.119439 0.0966804 0.0965092 0.0896646 0.0809377 0.0663929 0.0583504 0.0573238 0.0432923 0.0431212 0.0335387 0.0323409 0.0253251 0.0208761 0.0213895 0.013347 0.0128337 0.0136893 0.011807 0.011807 0.0112936 0.00581793 0.00496235 0.00581793 0.00513347 0.00581793 0.00308008 0.0032512 0.0032512 0.00290897 0 </BinContents> </PhotonBkgRmsRatio_1> <PhotonSigRmsRatio_2> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.157535 0.138313 0.121725 0.104893 0.0883056 0.0722545 0.0612773 0.0521052 0.0390301 0.0320535 0.0252232 0.0215153 0.0172708 0.013319 0.0115627 0.00756208 0.00751329 0.00648875 0.00502513 0.0035615 0.00224423 0.00224423 0.00180514 0.00200029 0.00126848 0.00107333 0.00112212 0.000926965 0.000390301 0.000390301 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigRmsRatio_2> <PhotonBkgRmsRatio_2> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.124446 0.117316 0.0990768 0.0917961 0.0779104 0.0668768 0.0587705 0.0504391 0.0409818 0.0385799 0.030999 0.0288974 0.0220671 0.0210163 0.0153869 0.0156121 0.0135105 0.0128349 0.010358 0.0101329 0.0082564 0.00698041 0.00668018 0.006455 0.00495384 0.00517901 0.00457855 0.00292727 0.00367785 0.00330256 0 </BinContents> + <BinContents>0 0.136838 0.140449 0.109149 0.0983146 0.0822632 0.0774478 0.0626003 0.0485554 0.0473515 0.0288925 0.0337079 0.0228732 0.0184591 0.0176565 0.00922953 0.00842697 0.0100321 0.00682183 0.00561798 0.00722311 0.00642055 0.00321027 0.0024077 0.0024077 0.0024077 0.00401284 0.00280899 0.00160514 0.00280899 0 0 </BinContents> </PhotonBkgRmsRatio_2> <PhotonSigRmsRatio_3> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.181096 0.166327 0.131936 0.113369 0.0912863 0.0707504 0.0577396 0.0446586 0.0326324 0.0264435 0.0197623 0.0148393 0.0110416 0.00787678 0.00675153 0.00478233 0.00337576 0.00344609 0.00281314 0.00189887 0.00161755 0.00140657 0.000984598 0.000703284 0.000351642 0.000492299 0.000492299 0.000281314 0.000421971 0.000421971 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigRmsRatio_3> <PhotonBkgRmsRatio_3> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.157996 0.135939 0.110285 0.107169 0.078878 0.0733637 0.0618557 0.0409974 0.0419564 0.0347638 0.0246943 0.0165428 0.0239751 0.0158235 0.011508 0.00982978 0.00863102 0.00551427 0.00839127 0.00455526 0.00503476 0.00287701 0.00407576 0.00263726 0.00335651 0.00191801 0.00311676 0.00191801 0.00119875 0.00119875 0 </BinContents> + <BinContents>0 0.168582 0.145594 0.112388 0.0989783 0.0836526 0.0862069 0.0625798 0.0491699 0.0395913 0.0255428 0.0312899 0.0185185 0.0114943 0.0166028 0.00702427 0.0063857 0.0083014 0.00702427 0.00255428 0.00766284 0.00191571 0.00255428 0.00063857 0.00191571 0.00191571 0.00063857 0 0 0.00063857 0.00063857 0 </BinContents> </PhotonBkgRmsRatio_3> <PhotonSigRmsRatio_4> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.203572 0.180199 0.155765 0.116659 0.090302 0.0672839 0.0489199 0.035969 0.0283806 0.0197804 0.0142662 0.00900491 0.00804371 0.00500835 0.0033389 0.00268124 0.00252947 0.00197299 0.00136591 0.00101179 0.000860019 0.000657662 0.000860019 0.000556483 0.000252947 0.000404715 5.05894e-05 0.000101179 5.05894e-05 0.000151768 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigRmsRatio_4> <PhotonBkgRmsRatio_4> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.173194 0.158979 0.120104 0.111981 0.0844212 0.0690455 0.0586017 0.0420656 0.0348129 0.0249492 0.0203075 0.0182768 0.0124746 0.010734 0.010734 0.010734 0.00899333 0.00725268 0.0037714 0.0037714 0.00232086 0.00145054 0.00116043 0.00261097 0.00174064 0.00174064 0.000870322 0.000870322 0.000580215 0.00145054 0 </BinContents> + <BinContents>0 0.165541 0.148166 0.131274 0.10666 0.0916988 0.0694981 0.0598456 0.0530888 0.0313707 0.0352317 0.0212355 0.0178571 0.0125483 0.011583 0.00965251 0.00772201 0.00723938 0.00530888 0.0019305 0.00289575 0.00144788 0.00241313 0.000965251 0.000965251 0.000965251 0.000482625 0 0 0.00144788 0.000965251 0 </BinContents> </PhotonBkgRmsRatio_4> <PhotonSigRmsRatio_5> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.240605 0.202652 0.159357 0.118379 0.0868136 0.0602167 0.0386627 0.0288383 0.0196489 0.0131117 0.00833022 0.00620097 0.00437056 0.002839 0.00212925 0.00149421 0.00119537 0.00104595 0.000896526 0.000672394 0.000522973 0.000448263 0.000298842 0.000373552 0.000149421 7.47105e-05 0.000224131 0.000112066 0.000261487 7.47105e-05 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigRmsRatio_5> <PhotonBkgRmsRatio_5> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.183976 0.16881 0.149027 0.107814 0.0877019 0.0652819 0.0530828 0.0375865 0.0323112 0.0240686 0.0154962 0.0161556 0.0128586 0.00923178 0.00791296 0.00428619 0.00329707 0.0052753 0.00131883 0.00197824 0.00329707 0.00131883 0.00164853 0.000329707 0.00131883 0.000659413 0.00098912 0.00131883 0.00098912 0.000659413 0 </BinContents> + <BinContents>0 0.185013 0.157711 0.15016 0.123148 0.0923613 0.073192 0.0560558 0.0380482 0.0351438 0.023526 0.0177171 0.0121987 0.010456 0.00580889 0.00348533 0.00319489 0.00319489 0.00232356 0.00174267 0.000871333 0.00145222 0.000871333 0.00116178 0.000871333 0 0.000290444 0 0 0 0 0 </BinContents> </PhotonBkgRmsRatio_5> <PhotonSigRmsRatio_6> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.269931 0.222242 0.163755 0.1182 0.0780435 0.0516357 0.0320795 0.0208267 0.0135215 0.00871183 0.00657925 0.00381143 0.00317619 0.00186034 0.00163347 0.000907482 0.000635238 0.000408367 0.000408367 0.000408367 0.000362993 0.000226871 9.07482e-05 9.07482e-05 0.000136122 9.07482e-05 4.53741e-05 4.53741e-05 4.53741e-05 9.07482e-05 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigRmsRatio_6> <PhotonBkgRmsRatio_6> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.202215 0.189215 0.135773 0.129032 0.0832932 0.0683678 0.0476649 0.0389986 0.0250361 0.0202215 0.0178142 0.00962927 0.00818488 0.0052961 0.00433317 0.0052961 0.00337025 0.000481464 0.000962927 0.00144439 0.000962927 0 0.000962927 0.000962927 0.000481464 0 0 0 0 0 0 </BinContents> + <BinContents>0 0.243125 0.23193 0.16184 0.112679 0.083962 0.0540277 0.0335848 0.0267705 0.0148455 0.0107082 0.00559747 0.00559747 0.00365052 0.00292042 0.00267705 0.00219031 0.000973473 0.00121684 0.000486736 0.000243368 0.000243368 0.000486736 0 0 0 0 0 0 0.000243368 0 0 </BinContents> </PhotonBkgRmsRatio_6> <PhotonSigRmsRatio_7> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.291538 0.231044 0.16842 0.116244 0.0696364 0.0448202 0.0283907 0.0171169 0.0116863 0.00673678 0.00474325 0.00302468 0.00240599 0.000962398 0.000687427 0.000549942 0.000687427 0.000343713 0.000137485 0.000206228 0 6.87427e-05 6.87427e-05 6.87427e-05 0.000137485 6.87427e-05 6.87427e-05 0 6.87427e-05 6.87427e-05 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigRmsRatio_7> <PhotonBkgRmsRatio_7> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.237977 0.217247 0.1534 0.108624 0.0713101 0.0704809 0.0422886 0.0315091 0.0190713 0.0157546 0.00829187 0.00580431 0.00497512 0.00165837 0.00165837 0.00331675 0 0.00248756 0.00165837 0.000829187 0 0 0.000829187 0 0 0.000829187 0 0 0 0 0 </BinContents> + <BinContents>0 0.329913 0.252856 0.169216 0.106486 0.0565344 0.0317522 0.0201355 0.0100678 0.00735721 0.00387222 0.00271055 0.00232333 0.000968054 0.00154889 0.00135528 0.000193611 0.000387222 0.000387222 0.000580833 0 0.000193611 0.000387222 0.000193611 0 0 0.000193611 0 0.000387222 0 0 0 </BinContents> </PhotonBkgRmsRatio_7> <PhotonSigRmsRatio_8> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.311604 0.245042 0.174357 0.106421 0.0615551 0.0387787 0.0229727 0.0148243 0.00893383 0.00530139 0.00353426 0.002258 0.00147261 0.00098174 0.00049087 0.000196348 0.000294522 0.000392696 9.8174e-05 0.000294522 9.8174e-05 9.8174e-05 0 0 0 0 0 0 0 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigRmsRatio_8> <PhotonBkgRmsRatio_8> <NBinsX>30</NBinsX> <XLow>1</XLow> <XHigh>3</XHigh> - <BinContents>0 0.305169 0.223658 0.161034 0.122266 0.0596421 0.0407555 0.0347912 0.0198807 0.0119284 0.0119284 0.00298211 0.00298211 0.00298211 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> + <BinContents>0 0.444266 0.291644 0.147552 0.0614898 0.0292837 0.0128228 0.00638158 0.00304169 0.0013121 0.00059641 0.000656051 0.000178923 0.000119282 5.9641e-05 0 0.000119282 0.000178923 5.9641e-05 5.9641e-05 0 5.9641e-05 0 0 0 0 0 5.9641e-05 0 5.9641e-05 0 0 </BinContents> </PhotonBkgRmsRatio_8> <PhotonSigLongProfileStart_0> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.0520456 0.137233 0.112927 0.123682 0.130979 0.128586 0.106057 0.0800227 0.0637244 0.0455784 0.0191647 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileStart_0> <PhotonBkgLongProfileStart_0> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.0566245 0.189996 0.130592 0.128079 0.133674 0.130455 0.0956491 0.0595869 0.0397307 0.0255241 0.0100886 0 </BinContents> + <BinContents>0 0.101796 0.09527 0.129792 0.12537 0.133299 0.11552 0.102803 0.0751731 0.0626391 0.0419017 0.0164374 0 </BinContents> </PhotonBkgLongProfileStart_0> <PhotonSigLongProfileStart_1> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.148797 0.282878 0.168565 0.116307 0.0837729 0.0670183 0.0447675 0.0332875 0.0282789 0.0185275 0.00780107 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileStart_1> <PhotonBkgLongProfileStart_1> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.0692545 0.182469 0.141901 0.13995 0.133122 0.119222 0.0809151 0.0543351 0.0391053 0.0279102 0.0118158 0 </BinContents> + <BinContents>0 0.177618 0.179671 0.145791 0.120465 0.108487 0.0853867 0.0645106 0.0470568 0.0330253 0.0278919 0.0100958 0 </BinContents> </PhotonBkgLongProfileStart_1> <PhotonSigLongProfileStart_2> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.234425 0.335122 0.19998 0.102356 0.0572279 0.033322 0.0170269 0.00961116 0.00561058 0.00424452 0.00107333 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileStart_2> <PhotonBkgLongProfileStart_2> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.104781 0.189597 0.156571 0.140359 0.123996 0.101554 0.0642498 0.0463859 0.0344517 0.0266456 0.0114088 0 </BinContents> + <BinContents>0 0.288122 0.261236 0.148876 0.0943018 0.0726324 0.0501605 0.0313002 0.0176565 0.0176565 0.0148475 0.00321027 0 </BinContents> </PhotonBkgLongProfileStart_2> <PhotonSigLongProfileStart_3> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.263169 0.352345 0.190027 0.0927632 0.0499332 0.0259512 0.0123778 0.0066812 0.00344609 0.00281314 0.000492299 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileStart_3> <PhotonBkgLongProfileStart_3> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.135459 0.198514 0.179094 0.132582 0.120834 0.083673 0.0510669 0.0371614 0.0278111 0.0249341 0.00887077 0 </BinContents> + <BinContents>0 0.326948 0.280971 0.144955 0.0836526 0.0625798 0.0389527 0.0249042 0.0159642 0.00957854 0.00957854 0.00191571 0 </BinContents> </PhotonBkgLongProfileStart_3> <PhotonSigLongProfileStart_4> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.287348 0.345374 0.187181 0.0916173 0.045581 0.0222087 0.0110791 0.00495776 0.00278242 0.00126473 0.000607072 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileStart_4> <PhotonBkgLongProfileStart_4> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.156078 0.225413 0.178416 0.125036 0.100087 0.0699159 0.0490281 0.0365535 0.0284305 0.0211778 0.00986365 0 </BinContents> + <BinContents>0 0.371139 0.282336 0.137548 0.0796332 0.0472973 0.0323359 0.0212355 0.0111004 0.00772201 0.00627413 0.00337838 0 </BinContents> </PhotonBkgLongProfileStart_4> <PhotonSigLongProfileStart_5> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.30777 0.33941 0.184535 0.0889055 0.0415764 0.0208069 0.00945088 0.00410908 0.00224131 0.000933881 0.000261487 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileStart_5> <PhotonBkgLongProfileStart_5> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.204748 0.23574 0.167491 0.102539 0.0748434 0.060666 0.0487966 0.0346192 0.0323112 0.0250577 0.0131883 0 </BinContents> + <BinContents>0 0.404589 0.285216 0.128086 0.0746442 0.0395004 0.0223642 0.0171362 0.0119082 0.00900378 0.00493755 0.002614 0 </BinContents> </PhotonBkgLongProfileStart_5> <PhotonSigLongProfileStart_6> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.33114 0.330641 0.172512 0.0880258 0.0432869 0.0202369 0.00825809 0.00372068 0.00131585 0.000544489 0.000317619 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileStart_6> <PhotonBkgLongProfileStart_6> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.223881 0.217622 0.142995 0.102552 0.0741454 0.0635532 0.0539239 0.0418873 0.0370727 0.0317766 0.0105922 0 </BinContents> + <BinContents>0 0.4422 0.271842 0.124361 0.0618155 0.0391823 0.0236067 0.0148455 0.00900462 0.00705768 0.004624 0.00146021 0 </BinContents> </PhotonBkgLongProfileStart_6> <PhotonSigLongProfileStart_7> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.349007 0.319379 0.178525 0.0798103 0.0387021 0.0201416 0.00783667 0.00426205 0.00137485 0.00075617 0.000206228 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileStart_7> <PhotonBkgLongProfileStart_7> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.212272 0.197347 0.126866 0.10199 0.0837479 0.0671642 0.0621891 0.0497512 0.0439469 0.039801 0.0149254 0 </BinContents> + <BinContents>0 0.504163 0.249177 0.109003 0.0590513 0.0360116 0.0207164 0.010455 0.00561471 0.00329138 0.0017425 0.000774443 0 </BinContents> </PhotonBkgLongProfileStart_7> <PhotonSigLongProfileStart_8> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.417632 0.298645 0.151188 0.0719615 0.0337718 0.0147261 0.00736305 0.00323974 0.000785392 0.000392696 0.000294522 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileStart_8> <PhotonBkgLongProfileStart_8> <NBinsX>11</NBinsX> <XLow>-0.5</XLow> <XHigh>10.5</XHigh> - <BinContents>0 0.237575 0.150099 0.102386 0.0805169 0.0785288 0.0904573 0.0854871 0.0536779 0.05666 0.0417495 0.0228628 0 </BinContents> + <BinContents>0 0.622055 0.22592 0.0796803 0.0419872 0.0180712 0.00721656 0.00268384 0.00155067 0.000536769 0.000238564 5.9641e-05 0 </BinContents> </PhotonBkgLongProfileStart_8> <PhotonSigLongProfileDiscrepancy_0> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0.000307962 0.000165826 0.00040272 0.000734371 0.0011134 0.000829128 0.00127923 0.00187146 0.00220311 0.00296117 0.00376661 0.00506953 0.00637244 0.00881245 0.011821 0.0150901 0.0186435 0.0240921 0.0282851 0.034018 0.0397271 0.0449625 0.0488475 0.0502926 0.0543671 0.0521403 0.0523772 0.0525667 0.0540592 0.0496766 0.0479473 0.0442518 0.0426646 0.0386137 0.0341127 0.0313174 0.0297302 0.0244474 0.0221496 0.0179092 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileDiscrepancy_0> <PhotonBkgLongProfileDiscrepancy_0> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0.000201772 0.000311829 0.000348515 0.000577801 0.000715373 0.000843773 0.00117395 0.00164169 0.0017976 0.00317332 0.00505347 0.00732799 0.0106664 0.0144542 0.0197278 0.0257259 0.0322193 0.0408405 0.0457564 0.0520296 0.0555698 0.0588073 0.0567713 0.0561843 0.0550654 0.051672 0.0497643 0.0474623 0.0426197 0.0395932 0.0371719 0.032577 0.0303116 0.025891 0.0234331 0.019847 0.0166095 0.0146101 0.011877 0.00957499 0 0 </BinContents> + <BinContents>0 0 0.000335458 0.000487939 0.000426946 0.000762404 0.000701412 0.00103687 0.00118935 0.00143332 0.00207374 0.00332408 0.00503187 0.00597725 0.00829496 0.0115276 0.0153091 0.0218048 0.0267756 0.031777 0.0384252 0.0429386 0.0465067 0.0529719 0.0549541 0.0552286 0.0578207 0.0576683 0.0578207 0.056174 0.0522704 0.0480315 0.0444329 0.0391266 0.0335458 0.0297033 0.0257083 0.020097 0.0170474 0.0132658 0.00969778 0.00829496 0 0 </BinContents> </PhotonBkgLongProfileDiscrepancy_0> <PhotonSigLongProfileDiscrepancy_1> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 4.43243e-05 8.86486e-05 4.43243e-05 8.86486e-05 0.000132973 0.000753513 0.00168432 0.00332432 0.00558486 0.00944107 0.0123665 0.0179513 0.0242897 0.0314259 0.0373654 0.0428616 0.0487567 0.0504854 0.0563362 0.0557599 0.0583307 0.055627 0.0563362 0.056868 0.0530118 0.0464962 0.0424183 0.0396702 0.0368778 0.0342183 0.0302292 0.0274367 0.0234919 0.0214529 0.0187492 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileDiscrepancy_1> <PhotonBkgLongProfileDiscrepancy_1> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0.000110843 0.00015518 0.000731561 0.00126361 0.00219468 0.00396817 0.00605201 0.00793633 0.0109734 0.0134341 0.0167816 0.0216365 0.0263362 0.0294841 0.0341617 0.0377973 0.0412556 0.043539 0.0481722 0.0508768 0.0528276 0.0525616 0.0509433 0.0503226 0.0500787 0.0478175 0.0451129 0.0442705 0.0415438 0.0403911 0.0369328 0.0321 0.0310138 0.027223 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0.000342231 0.000342231 0.00119781 0.00205339 0.00444901 0.00684463 0.00735797 0.0164271 0.019165 0.0249829 0.0314853 0.0379877 0.0405544 0.0431212 0.0508214 0.0590349 0.0588638 0.057666 0.0566393 0.0580082 0.0549281 0.0485969 0.0499658 0.0400411 0.0405544 0.0350787 0.0321697 0.029603 0.0263518 0.0229295 0.0210472 0.0213895 0 0 </BinContents> </PhotonBkgLongProfileDiscrepancy_1> <PhotonSigLongProfileDiscrepancy_2> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 0 4.87876e-05 4.87876e-05 4.87876e-05 0.000243938 0.000878177 0.00307362 0.00585452 0.0108796 0.0147339 0.0226375 0.0328341 0.0448846 0.0508855 0.057667 0.0659609 0.069376 0.0702542 0.0671806 0.0664487 0.0584964 0.0569839 0.0494219 0.0436649 0.0370298 0.0342977 0.0274674 0.0243938 0.0201005 0.0169781 0.0133678 0.0112212 0.00931844 0.00780602 0.005513 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileDiscrepancy_2> <PhotonBkgLongProfileDiscrepancy_2> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 0 7.50582e-05 0.000225175 0.000150116 0.000600465 0.000750582 0.00187645 0.00255198 0.00442843 0.00818134 0.0106583 0.0127599 0.0179389 0.0230429 0.0286722 0.0322 0.0370037 0.0390302 0.0454102 0.0457104 0.0506643 0.0499137 0.0558433 0.0454102 0.0497636 0.0475869 0.0499137 0.0484876 0.0478121 0.042633 0.0445845 0.0433086 0.0411319 0.0390302 0.0326503 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0.000401284 0 0 0.000401284 0.00280899 0.00481541 0.0128411 0.0132424 0.0236758 0.0304976 0.0292937 0.0397271 0.0605939 0.0605939 0.0674157 0.0722311 0.0666132 0.0569823 0.0597913 0.0613965 0.0529695 0.0513644 0.0365169 0.0405297 0.0329053 0.0284912 0.0276886 0.0188604 0.0124398 0.011236 0.00922953 0.0076244 0.00682183 0 0 </BinContents> </PhotonBkgLongProfileDiscrepancy_2> <PhotonSigLongProfileDiscrepancy_3> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0 7.03284e-05 0.000140657 0.00126591 0.0019692 0.00555595 0.0115339 0.0174415 0.0301006 0.0395246 0.0504255 0.0635066 0.076236 0.0784162 0.0793305 0.0786975 0.0744075 0.0677263 0.0590056 0.0495815 0.0414938 0.0380477 0.0316478 0.0239117 0.0189887 0.0152613 0.0120262 0.00893171 0.00696251 0.00555595 0.00436036 0.00337576 0.00260215 0.00189887 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileDiscrepancy_3> <PhotonBkgLongProfileDiscrepancy_3> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0 0 0.000239751 0.000479501 0.000479501 0.00263726 0.00671302 0.00743227 0.0112683 0.0210981 0.0227763 0.0345241 0.0388396 0.0445936 0.0465116 0.0484296 0.0501079 0.0515464 0.0407576 0.0469911 0.0469911 0.0383601 0.0462719 0.0409974 0.0393191 0.0383601 0.0393191 0.0326061 0.0357228 0.0414769 0.0299688 0.0309278 0.0342843 0.0299688 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0.00063857 0.00191571 0.00127714 0.0063857 0.0172414 0.0153257 0.0293742 0.0383142 0.0568327 0.0568327 0.0708812 0.0664112 0.0708812 0.0702427 0.0753512 0.0676884 0.063857 0.0517241 0.0363985 0.0344828 0.041507 0.0185185 0.0236271 0.0223499 0.0121328 0.0108557 0.0114943 0.00893997 0.00510856 0.00510856 0.00510856 0.00319285 0 0 </BinContents> </PhotonBkgLongProfileDiscrepancy_3> <PhotonSigLongProfileDiscrepancy_4> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0 0.000303536 0.000455304 0.00212475 0.00440127 0.0130015 0.0211969 0.0348055 0.0498305 0.0649062 0.07897 0.0837254 0.0931856 0.0896949 0.0813477 0.0748217 0.0623767 0.0524612 0.0420904 0.0335913 0.0258512 0.020944 0.0177569 0.0131532 0.0102191 0.00753782 0.00581778 0.00424951 0.00288359 0.00288359 0.00217534 0.00146709 0.00131532 0.000455304 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileDiscrepancy_4> <PhotonBkgLongProfileDiscrepancy_4> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0 0.000580215 0 0.00145054 0.00174064 0.00522193 0.0118944 0.0159559 0.0252393 0.0316217 0.0409051 0.0490281 0.0571511 0.05396 0.056861 0.0522193 0.0571511 0.0438062 0.0501886 0.0394546 0.0371337 0.0403249 0.0409051 0.0348129 0.0295909 0.0287206 0.0275602 0.0261097 0.0272701 0.0232086 0.0211778 0.0237888 0.0205976 0.024369 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0.000965251 0.00241313 0.00868726 0.0135135 0.0183398 0.0415058 0.0472973 0.0545367 0.0704633 0.0767374 0.0873552 0.0796332 0.0651544 0.0752896 0.0569498 0.0583977 0.046332 0.0328185 0.0323359 0.0265444 0.0279923 0.0207529 0.0135135 0.0130309 0.00530888 0.00434363 0.00482625 0.00289575 0.00530888 0.003861 0.00241313 0.000482625 0 0 </BinContents> </PhotonBkgLongProfileDiscrepancy_4> <PhotonSigLongProfileDiscrepancy_5> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 3.73552e-05 0.000112066 0.00078446 0.00321255 0.00847964 0.0212178 0.0367949 0.0561076 0.0758685 0.0914456 0.101233 0.0995144 0.0946956 0.083489 0.0738513 0.0589092 0.047217 0.0342921 0.0275682 0.0207695 0.0169966 0.0108704 0.00896526 0.00691072 0.00466941 0.00381024 0.00306313 0.00194247 0.00209189 0.00138214 0.00127008 0.000971236 0.000560329 0.000560329 0.000336197 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileDiscrepancy_5> <PhotonBkgLongProfileDiscrepancy_5> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0.000329707 0 0.00197824 0.00428619 0.0108803 0.0201121 0.0339598 0.0369271 0.0520936 0.0639631 0.0679196 0.0698978 0.0712166 0.0573689 0.060666 0.0544016 0.0418727 0.0333004 0.0356083 0.0342895 0.0257171 0.0253874 0.0194527 0.0201121 0.0201121 0.0171447 0.0220903 0.0131883 0.0141774 0.016815 0.0125288 0.0151665 0.0141774 0.0128586 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0.000290444 0.00406622 0.00958466 0.0203311 0.0447284 0.0665118 0.0737729 0.0897473 0.0880046 0.0911995 0.0865524 0.0821958 0.06535 0.0546035 0.0490851 0.0354342 0.0293349 0.0293349 0.018298 0.0133604 0.00987511 0.00697067 0.010456 0.00464711 0.00290444 0.00319489 0.00145222 0.00232356 0.00232356 0.00174267 0.00145222 0.000290444 0.000580889 0 0 </BinContents> </PhotonBkgLongProfileDiscrepancy_5> <PhotonSigLongProfileDiscrepancy_6> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 0.000226871 0.00099823 0.00431054 0.0137484 0.0335315 0.0600753 0.0868007 0.10858 0.119515 0.11103 0.0988702 0.0870729 0.0678343 0.0551295 0.038931 0.0282227 0.0226417 0.0156994 0.0103907 0.00889332 0.00644312 0.00462816 0.00299469 0.00326694 0.00217796 0.00222333 0.00113435 0.00145197 0.000725986 0.000499115 0.000680612 0.000317619 0.000136122 0.000499115 0.000317619 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileDiscrepancy_6> <PhotonBkgLongProfileDiscrepancy_6> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0 0.00144439 0.00625903 0.0125181 0.0250361 0.0544054 0.0669234 0.0813674 0.0751083 0.0702937 0.0688493 0.0548869 0.0597015 0.0481464 0.046702 0.0380356 0.033221 0.0240732 0.0327395 0.0207029 0.0221473 0.0192585 0.0221473 0.013481 0.0110737 0.0129995 0.0129995 0.0139624 0.0115551 0.0110737 0.00722195 0.00722195 0.00577756 0.00866635 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0.000243368 0.000486736 0.00681431 0.0172791 0.0425894 0.0734972 0.0895595 0.111463 0.106352 0.104162 0.0871258 0.067413 0.0571915 0.0486736 0.0377221 0.0321246 0.0248236 0.0209297 0.0146021 0.0111949 0.00949136 0.00754441 0.00632757 0.00511073 0.00292042 0.00316379 0.00316379 0.00121684 0.00146021 0.00170358 0.00146021 0.000486736 0.000243368 0.000243368 0.00121684 0 0 </BinContents> </PhotonBkgLongProfileDiscrepancy_6> <PhotonSigLongProfileDiscrepancy_7> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0.000137485 0.000962398 0.0065993 0.0227538 0.0514883 0.0906029 0.112257 0.123874 0.11645 0.106139 0.0908778 0.0655805 0.0540318 0.0393896 0.0274971 0.0208978 0.0158108 0.0129924 0.00824912 0.00790541 0.00543067 0.00426205 0.00254348 0.00295594 0.00213102 0.00158108 0.00171857 0.00123737 0.000824912 0.00075617 0.000206228 0.000618684 0.000481199 0.000481199 0.000137485 0.000137485 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileDiscrepancy_7> <PhotonBkgLongProfileDiscrepancy_7> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0 0.000829187 0.00414594 0.013267 0.0257048 0.0489221 0.0547264 0.0646766 0.0878939 0.0704809 0.0754561 0.0555556 0.0679934 0.0588723 0.0257048 0.0422886 0.0257048 0.0257048 0.0306799 0.0248756 0.0290216 0.0174129 0.0174129 0.0157546 0.0165837 0.0174129 0.0140962 0.00912106 0.00912106 0.00580431 0.0116086 0.0066335 0.0116086 0.00497512 0.00331675 0.0066335 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0.000387222 0.00154889 0.00774443 0.0315586 0.0629235 0.0991288 0.109971 0.108035 0.105324 0.0904163 0.0733785 0.0586641 0.0524685 0.0425944 0.0352372 0.0272991 0.0216844 0.0123911 0.0123911 0.00793805 0.00851888 0.00619555 0.00464666 0.00367861 0.00367861 0.00212972 0.00251694 0.00135528 0.000580833 0.00154889 0.000774443 0.000580833 0.00116167 0.000387222 0.000968054 0.000193611 0 0 </BinContents> </PhotonBkgLongProfileDiscrepancy_7> <PhotonSigLongProfileDiscrepancy_8> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0.00049087 0.00628313 0.0170823 0.0405458 0.0650893 0.0862949 0.110151 0.11074 0.114078 0.098763 0.0793246 0.0642058 0.0460436 0.0341645 0.0269978 0.0233654 0.0172786 0.0139407 0.009032 0.0075594 0.00647948 0.00402513 0.00431965 0.00196348 0.00314157 0.00117809 0.000883566 0.000883566 0.000687218 0.000785392 0.00157078 0.000589044 0.000687218 0.000294522 0.000589044 0.000294522 0.000196348 0 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigLongProfileDiscrepancy_8> <PhotonBkgLongProfileDiscrepancy_8> <NBinsX>42</NBinsX> <XLow>-0.02</XLow> <XHigh>0.82</XHigh> - <BinContents>0 0 0 0 0 0 0.00397614 0.0109344 0.0218688 0.0457256 0.0576541 0.0685885 0.0755467 0.083499 0.0626243 0.0616302 0.0636183 0.0487077 0.0347912 0.0397614 0.0328032 0.027833 0.0318091 0.0208747 0.0168986 0.0218688 0.0248509 0.00795229 0.0139165 0.0139165 0.0228628 0.0149105 0.0129225 0.00695825 0.00894632 0.00795229 0.00695825 0.0109344 0.00695825 0.00497018 0.00298211 0.000994036 0 0 </BinContents> + <BinContents>0 0 0 0 5.9641e-05 0.00345918 0.0187273 0.0481899 0.0753265 0.102582 0.107473 0.105028 0.0939345 0.0777718 0.071271 0.0572553 0.0499791 0.0412715 0.0320272 0.0291644 0.0214111 0.0159838 0.0110336 0.0108547 0.00739548 0.00554661 0.00333989 0.00298205 0.00184887 0.00137174 0.0010139 0.000954255 0.000357846 0.000417487 0.00059641 0.000298205 0.000238564 5.9641e-05 0.000357846 0.000178923 0.000119282 0.000119282 0 0 </BinContents> </PhotonBkgLongProfileDiscrepancy_8> <PhotonSigPeakEnergyFraction_0> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0.0229787 0.0358183 0.0323834 0.0279772 0.0252529 0.0217942 0.0179566 0.0172696 0.0155402 0.0154929 0.0144742 0.0133845 0.0126028 0.0116552 0.0111103 0.0106365 0.00992585 0.0104707 0.00978372 0.00862294 0.00916779 0.00791225 0.00805439 0.00734371 0.00698837 0.00656196 0.00686992 0.0064672 0.00594604 0.00596973 0.0053538 0.00521166 0.00497477 0.00466681 0.00360079 0.00338758 0.00281904 0.00258214 0.00189515 0.00175301 0.00151612 0.000923886 0.000686992 0.000497477 4.73788e-05 4.73788e-05 0 0 2.36894e-05 0 0.5436 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakEnergyFraction_0> <PhotonBkgPeakEnergyFraction_0> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0.0242585 0.0401343 0.0417943 0.0420694 0.0401618 0.0384376 0.0341912 0.0318616 0.0292661 0.0270008 0.0254966 0.0240384 0.0215621 0.0192692 0.0176 0.016582 0.0153163 0.0139865 0.0134453 0.0116936 0.0110608 0.0103637 0.00957499 0.00946494 0.00808922 0.00772236 0.00766733 0.00679605 0.00663096 0.00602564 0.00559459 0.00526441 0.00477833 0.00393455 0.00391621 0.00298072 0.00294404 0.00227452 0.00212778 0.00143075 0.00118312 0.000779573 0.000394372 0.000210943 7.33716e-05 1.83429e-05 9.17145e-06 9.17145e-06 0 0 0.350515 0 </BinContents> + <BinContents>0 0 0.000670916 0.00256168 0.00262267 0.00338508 0.00463542 0.00582477 0.00606874 0.00652618 0.00652618 0.00774603 0.00820347 0.00853893 0.00905736 0.00823397 0.00838645 0.00914885 0.00905736 0.00887439 0.0100637 0.00887439 0.0087829 0.00799 0.00805099 0.00930133 0.00899637 0.00853893 0.00780702 0.00655668 0.00677015 0.00670916 0.00701412 0.00643469 0.00606874 0.0055808 0.00454393 0.00451343 0.00362904 0.00338508 0.00292763 0.00308011 0.00152481 0.00106737 0.000731908 0.000457443 0.000243969 6.09923e-05 0 0 0 0 0.734226 0 </BinContents> </PhotonBkgPeakEnergyFraction_0> <PhotonSigPeakEnergyFraction_1> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0.00726918 0.0163557 0.0164443 0.012987 0.0111697 0.0102832 0.0101946 0.00868756 0.00886486 0.00851026 0.00695891 0.00802269 0.00842161 0.00726918 0.0076681 0.00740215 0.00704756 0.00731351 0.00704756 0.00651567 0.00687026 0.00695891 0.00709188 0.00722486 0.00678161 0.00647134 0.00660432 0.00802269 0.0076681 0.00797837 0.00780107 0.0091308 0.00921945 0.00842161 0.0107265 0.0101946 0.0109924 0.0103719 0.0110367 0.0108594 0.0103719 0.00970702 0.00859891 0.00642702 0.00554053 0.00412216 0.00141838 0.00031027 0 0 0.598644 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakEnergyFraction_1> <PhotonBkgPeakEnergyFraction_1> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0.00982066 0.0238977 0.0254938 0.0258485 0.0250504 0.0223237 0.0220133 0.0212818 0.0193975 0.0180895 0.0186881 0.0178457 0.0162052 0.0162495 0.0154958 0.0162717 0.015518 0.0145647 0.0143209 0.0140548 0.0138997 0.0146534 0.0141657 0.0127912 0.0129686 0.0123257 0.0115498 0.0117493 0.0118158 0.0106852 0.0115498 0.0112394 0.0105522 0.0100202 0.009998 0.00955463 0.00895608 0.00897825 0.00911126 0.00811368 0.00813585 0.00649538 0.0059855 0.00469973 0.00334745 0.00208384 0.00126361 0.00015518 2.21685e-05 0 0.370702 0 </BinContents> + <BinContents>0 0 0.000855578 0.00290897 0.00154004 0.0032512 0.00376455 0.00410678 0.00427789 0.00273785 0.00564682 0.00633128 0.00564682 0.00581793 0.00616016 0.00598905 0.00684463 0.00752909 0.00889802 0.00667351 0.00479124 0.00855578 0.00941136 0.00924025 0.00924025 0.011807 0.00975359 0.00975359 0.00975359 0.0100958 0.0102669 0.0107803 0.00855578 0.0114648 0.0116359 0.0124914 0.0135181 0.0128337 0.0123203 0.0142026 0.0135181 0.0104381 0.0121492 0.0114648 0.0087269 0.0065024 0.00804244 0.00342231 0.00154004 0.000513347 0 0 0.62423 0 </BinContents> </PhotonBkgPeakEnergyFraction_1> <PhotonSigPeakEnergyFraction_2> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0.00209787 0.00439089 0.00575694 0.00517149 0.00400059 0.00400059 0.00502513 0.00312241 0.00414695 0.0035615 0.00331756 0.00370786 0.00302483 0.00361028 0.00321998 0.0039518 0.00429331 0.00307362 0.00346392 0.00312241 0.00390301 0.00341513 0.00351271 0.00351271 0.00326877 0.00307362 0.00287847 0.00419574 0.00414695 0.00390301 0.00385422 0.00517149 0.00536664 0.00580573 0.005513 0.00653754 0.0086842 0.0103918 0.0107333 0.0144411 0.0161975 0.0178563 0.0207835 0.0223447 0.0228814 0.0206372 0.0168317 0.00878177 0.00170757 4.87876e-05 0.663561 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakEnergyFraction_2> <PhotonBkgPeakEnergyFraction_2> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0.00382797 0.0177888 0.0214666 0.023193 0.025745 0.02582 0.0240937 0.0228177 0.0237934 0.0225175 0.0209412 0.0187645 0.0192899 0.0183893 0.0159123 0.0176387 0.015537 0.0138858 0.0152368 0.0153869 0.0146363 0.0140359 0.0123846 0.0130601 0.0124597 0.0122345 0.0132102 0.0132853 0.0108084 0.0111086 0.0114839 0.0113338 0.0111086 0.0102079 0.010283 0.010358 0.0128349 0.0105081 0.0127599 0.0114088 0.010283 0.011634 0.00998274 0.0111837 0.0121594 0.0114088 0.00840651 0.00442843 0.00120093 0 0.297756 0 </BinContents> + <BinContents>0 0 0.000401284 0.00361156 0.000401284 0.0024077 0.00280899 0.00361156 0.00200642 0.0024077 0.00401284 0.00361156 0.00401284 0.00321027 0.00321027 0.0024077 0.00280899 0.00441413 0.00401284 0.00842697 0.00441413 0.00842697 0.00922953 0.00802568 0.00682183 0.00642055 0.00922953 0.00722311 0.0076244 0.0116372 0.00802568 0.00722311 0.00601926 0.0100321 0.0100321 0.011236 0.0124398 0.0108347 0.00963082 0.0100321 0.0136437 0.0128411 0.0144462 0.0120385 0.0128411 0.0192616 0.0164526 0.0148475 0.00882825 0.00361156 0.00120385 0 0.63764 0 </BinContents> </PhotonBkgPeakEnergyFraction_2> <PhotonSigPeakEnergyFraction_3> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0.000773613 0.00274281 0.00478233 0.00386806 0.00323511 0.00295379 0.00414938 0.00253182 0.00210985 0.00302412 0.00302412 0.00358675 0.00309445 0.00218018 0.00302412 0.00260215 0.00288347 0.00281314 0.00239117 0.00218018 0.00330544 0.00267248 0.00168788 0.00218018 0.00239117 0.00302412 0.00232084 0.00365708 0.00281314 0.00330544 0.00337576 0.00337576 0.00379774 0.00492299 0.00414938 0.004712 0.00696251 0.00647022 0.00696251 0.00858007 0.0128701 0.0160349 0.0175118 0.024193 0.0317884 0.0353049 0.0373444 0.0300302 0.0111822 0.000281314 0.644841 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakEnergyFraction_3> <PhotonBkgPeakEnergyFraction_3> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0.0014385 0.00982978 0.0191801 0.0196596 0.0246943 0.0230161 0.0184608 0.0246943 0.0227763 0.0249341 0.0220571 0.0179813 0.0206186 0.0191801 0.0206186 0.0198993 0.0201391 0.0179813 0.0165428 0.0170223 0.0177415 0.016303 0.0141453 0.0139055 0.0122273 0.0131863 0.0129465 0.013426 0.0103093 0.013426 0.0127068 0.0107888 0.0112683 0.0103093 0.010549 0.0131863 0.0112683 0.0119875 0.0122273 0.0119875 0.010549 0.00982978 0.0136658 0.0141453 0.014385 0.0177415 0.015344 0.013426 0.00575402 0 0.250539 0 </BinContents> + <BinContents>0 0 0 0.00383142 0.00319285 0.00446999 0.00383142 0.00383142 0.00255428 0.00063857 0.00574713 0.00255428 0.00191571 0.00446999 0.00319285 0.00319285 0.00255428 0.00191571 0.00319285 0.00383142 0.00127714 0.00127714 0.00191571 0.00574713 0.00191571 0.00127714 0.00510856 0.00510856 0.00319285 0.00191571 0.00766284 0.00957854 0.00446999 0.0063857 0.00766284 0.00766284 0.0102171 0.0063857 0.0063857 0.0102171 0.0114943 0.00893997 0.0121328 0.00893997 0.0153257 0.0191571 0.0191571 0.0223499 0.0153257 0.0127714 0.00383142 0 0.690294 0 </BinContents> </PhotonBkgPeakEnergyFraction_3> <PhotonSigPeakEnergyFraction_4> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0.000354126 0.00278242 0.00389538 0.00374361 0.00344008 0.00308595 0.00323772 0.00298477 0.00258006 0.00278242 0.00308595 0.002833 0.00217534 0.0023777 0.0019224 0.00298477 0.00258006 0.00182122 0.00263065 0.00303536 0.00268124 0.00217534 0.00197299 0.00273183 0.00202357 0.00263065 0.00298477 0.00273183 0.00268124 0.00288359 0.0033389 0.00349067 0.00344008 0.00323772 0.00409774 0.00394597 0.00627308 0.00490717 0.0061719 0.00748723 0.00860019 0.0109779 0.0134568 0.0185663 0.0262559 0.0361208 0.0457328 0.0574695 0.0339961 0.0023777 0.620226 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakEnergyFraction_4> <PhotonBkgPeakEnergyFraction_4> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0.000580215 0.00899333 0.0130548 0.0171163 0.0159559 0.0174064 0.0205976 0.0185669 0.0205976 0.0174064 0.0165361 0.0191471 0.0145054 0.0153757 0.0232086 0.0174064 0.0165361 0.0159559 0.0191471 0.0147955 0.0145054 0.0176965 0.0150856 0.0168262 0.0150856 0.013635 0.0156658 0.0156658 0.0145054 0.0124746 0.0150856 0.0116043 0.0118944 0.0191471 0.0165361 0.0124746 0.0133449 0.0121845 0.0127647 0.010734 0.0142153 0.0139252 0.0116043 0.0153757 0.0153757 0.0185669 0.0226284 0.0252393 0.0127647 0.00116043 0.239339 0 </BinContents> + <BinContents>0 0 0 0.00241313 0.0168919 0.00627413 0.00772201 0.0019305 0.00144788 0.00241313 0.000482625 0.00241313 0.000965251 0.000482625 0.00241313 0.00241313 0.00289575 0.00337838 0.000965251 0.00241313 0.00289575 0.00337838 0.0019305 0.00434363 0.000965251 0.003861 0.00337838 0.00241313 0.00241313 0.00241313 0.00337838 0.00144788 0.00289575 0.00144788 0.00482625 0.00337838 0.003861 0.0019305 0.00723938 0.00820463 0.00482625 0.00868726 0.00965251 0.0101351 0.011583 0.0139961 0.015444 0.0168919 0.0207529 0.0212355 0.0135135 0.00144788 0.727317 0 </BinContents> </PhotonBkgPeakEnergyFraction_4> <PhotonSigPeakEnergyFraction_5> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0 0.00115801 0.00310049 0.00414643 0.00354875 0.00328726 0.0031752 0.0031752 0.00381024 0.00351139 0.0031752 0.00310049 0.00246545 0.00306313 0.00339933 0.00354875 0.00324991 0.00313784 0.00313784 0.00261487 0.00276429 0.00272693 0.00257751 0.00242809 0.00246545 0.0025028 0.00246545 0.00302578 0.002839 0.00324991 0.00332462 0.00298842 0.00339933 0.00354875 0.00351139 0.00377288 0.00496825 0.00429585 0.00545387 0.00612626 0.00668659 0.00870377 0.0112066 0.0146433 0.0182294 0.0270078 0.0429959 0.0679492 0.0812103 0.0189391 0.574188 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakEnergyFraction_5> <PhotonBkgPeakEnergyFraction_5> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0.000329707 0.00230795 0.00725354 0.0125288 0.0108803 0.0118694 0.013518 0.0161556 0.01121 0.0161556 0.0131883 0.0105506 0.0151665 0.0121991 0.0194527 0.0194527 0.016815 0.0118694 0.0161556 0.0145071 0.0181339 0.0158259 0.0187933 0.0187933 0.013518 0.0171447 0.0154962 0.0171447 0.0184636 0.019123 0.0184636 0.016815 0.0145071 0.0164853 0.0148368 0.0174744 0.0154962 0.0201121 0.0148368 0.0164853 0.0148368 0.0197824 0.0161556 0.0141774 0.0178042 0.0184636 0.0243983 0.0339598 0.0425321 0.00791296 0.200462 0 </BinContents> + <BinContents>0 0 0 0 0.00668022 0.0203311 0.0177171 0.010456 0.00668022 0.002614 0.00319489 0.00377578 0.002614 0.00145222 0.00145222 0.00232356 0.00116178 0.00116178 0.00116178 0.00290444 0.00145222 0.000871333 0.00232356 0.00116178 0.00116178 0.00145222 0.00116178 0.00174267 0.00174267 0.000580889 0.00232356 0.00174267 0.002614 0.00406622 0.00232356 0.00145222 0.00377578 0.00174267 0.00464711 0.00290444 0.002614 0.00232356 0.00435667 0.00377578 0.00464711 0.00580889 0.00638978 0.0133604 0.0165553 0.0217833 0.0226547 0.00435667 0.76445 0 </BinContents> </PhotonBkgPeakEnergyFraction_5> <PhotonSigPeakEnergyFraction_6> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0 9.07482e-05 0.00099823 0.00249558 0.00390217 0.00417442 0.00521802 0.00571714 0.00598938 0.00626163 0.00671537 0.00417442 0.00562639 0.00535414 0.00521802 0.00544489 0.00517265 0.00435591 0.00499115 0.00412904 0.00362993 0.00462816 0.00435591 0.00376605 0.00362993 0.00362993 0.00317619 0.00390217 0.00390217 0.0040383 0.00362993 0.00358455 0.0036753 0.00372068 0.00390217 0.00444666 0.0040383 0.00539952 0.00467353 0.0052634 0.00780435 0.00644312 0.00907482 0.0111167 0.0127501 0.0186034 0.0286764 0.0484595 0.0945143 0.0617088 0.533826 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakEnergyFraction_6> <PhotonBkgPeakEnergyFraction_6> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0 0 0.00337025 0.0052961 0.00481464 0.00962927 0.0101107 0.0120366 0.0125181 0.0144439 0.0154068 0.0139624 0.0125181 0.00914781 0.00770342 0.0120366 0.0221473 0.0178142 0.0173327 0.0163698 0.0173327 0.013481 0.0178142 0.0125181 0.0115551 0.0144439 0.0154068 0.0129995 0.0129995 0.0168512 0.0202215 0.0173327 0.0202215 0.0192585 0.0173327 0.01974 0.0226288 0.0178142 0.0216659 0.0211844 0.0149254 0.0250361 0.0250361 0.0235917 0.0178142 0.0235917 0.0240732 0.0385171 0.052961 0.0284064 0.166586 0 </BinContents> + <BinContents>0 0 0 0 0 0.00292042 0.0111949 0.0201996 0.0194695 0.0136286 0.00949136 0.00657094 0.00584084 0.00365052 0.00243368 0.00243368 0.00389389 0.000730105 0.00243368 0.000486736 0.000730105 0.00121684 0.00146021 0.00194695 0.000730105 0.00146021 0.000973473 0.000730105 0.00243368 0.00146021 0.00170358 0.00292042 0.000486736 0.00194695 0.00243368 0.00243368 0.00170358 0.00146021 0.00170358 0.00121684 0.000973473 0.00170358 0.00365052 0.00146021 0.00146021 0.00243368 0.00292042 0.00292042 0.004624 0.00827452 0.0170358 0.0053541 0.81066 0 </BinContents> </PhotonBkgPeakEnergyFraction_6> <PhotonSigPeakEnergyFraction_7> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0 0 0 0.000343713 0.00123737 0.00206228 0.00364336 0.00371211 0.00543067 0.00577439 0.00653056 0.00714924 0.00845535 0.00941775 0.0080429 0.00983021 0.00879906 0.00996769 0.00859284 0.00866158 0.00824912 0.00859284 0.00955523 0.00818038 0.0075617 0.00687427 0.00818038 0.00687427 0.0075617 0.00632433 0.00666804 0.0061181 0.0061181 0.00701175 0.00577439 0.0061181 0.0056369 0.0056369 0.00584313 0.00604936 0.00673678 0.00879906 0.0061181 0.00859284 0.0120987 0.0136111 0.0181481 0.0317591 0.0653743 0.0873032 0.494879 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakEnergyFraction_7> <PhotonBkgPeakEnergyFraction_7> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0 0 0 0 0.000829187 0.00414594 0.00414594 0.00829187 0.0116086 0.00746269 0.00912106 0.0116086 0.00995025 0.013267 0.00497512 0.00912106 0.0107794 0.00995025 0.013267 0.00912106 0.0157546 0.013267 0.0165837 0.0140962 0.0165837 0.0174129 0.0165837 0.00912106 0.013267 0.0165837 0.0190713 0.00995025 0.0149254 0.0257048 0.0174129 0.0165837 0.0232172 0.0232172 0.0257048 0.0257048 0.0331675 0.0298507 0.0323383 0.0323383 0.0447761 0.0339967 0.0339967 0.0348259 0.053068 0.0373134 0.145937 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0.000774443 0.00329138 0.00696999 0.0112294 0.0145208 0.014908 0.010455 0.00987415 0.010455 0.00600194 0.00600194 0.00406583 0.00367861 0.00193611 0.00271055 0.00193611 0.00309777 0.00154889 0.00154889 0.0017425 0.00116167 0.000580833 0.00116167 0.00154889 0.000580833 0.0017425 0.00135528 0.000580833 0.00135528 0.000968054 0.00232333 0.00135528 0.00116167 0.000968054 0.0017425 0.00290416 0.00154889 0.0017425 0.00193611 0.00116167 0.00329138 0.00232333 0.00271055 0.00387222 0.0054211 0.837754 0 </BinContents> </PhotonBkgPeakEnergyFraction_7> <PhotonSigPeakEnergyFraction_8> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0.000294522 0.00049087 0.000589044 0.000883566 0.00166896 0.00245435 0.00284704 0.00598861 0.00314157 0.00657766 0.00657766 0.006774 0.00775574 0.00795209 0.00824661 0.00834479 0.0105046 0.0120754 0.00932653 0.0100137 0.013548 0.0144316 0.0123699 0.0127626 0.0145297 0.0126644 0.015806 0.0151188 0.0138425 0.0130571 0.0149224 0.0138425 0.0154133 0.0170823 0.0141371 0.0122717 0.0139407 0.0139407 0.0151188 0.017475 0.0177695 0.0226782 0.0336737 0.0731396 0.453956 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigPeakEnergyFraction_8> <PhotonBkgPeakEnergyFraction_8> <NBinsX>52</NBinsX> <XLow>-0.02</XLow> <XHigh>1.02</XHigh> - <BinContents>0 0 0 0 0 0 0 0 0.000994036 0 0 0.000994036 0.00497018 0.00198807 0 0.00298211 0.00695825 0.00298211 0.00894632 0.00994036 0.0109344 0.00497018 0.0109344 0.00695825 0.00596421 0.0149105 0.0119284 0.0109344 0.0119284 0.0139165 0.00994036 0.0109344 0.0139165 0.0168986 0.0109344 0.0198807 0.0168986 0.0119284 0.026839 0.0208747 0.026839 0.0328032 0.0208747 0.027833 0.027833 0.028827 0.0337972 0.0497018 0.05666 0.0666004 0.0785288 0.0934394 0.153082 0 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0.000178923 0.000715692 0.0010139 0.00190851 0.00220672 0.00226636 0.00280313 0.00268384 0.00304169 0.002326 0.00274348 0.00369774 0.00268384 0.00208743 0.00143138 0.00143138 0.00161031 0.00202779 0.00143138 0.00172959 0.00119282 0.00161031 0.00137174 0.00184887 0.00149102 0.00178923 0.00256456 0.00149102 0.00178923 0.00238564 0.00244528 0.00214707 0.00184887 0.0026242 0.00333989 0.00298205 0.00256456 0.00256456 0.00125246 0.000894614 0.919783 0 </BinContents> </PhotonBkgPeakEnergyFraction_8> <PhotonSigMinDistanceToTrack_0> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.00172933 0.00206098 0.00151612 0.00187146 0.00139767 0.00130292 0.00132661 0.00106602 0.00130292 0.00127923 0.00130292 0.00113709 0.00132661 0.00137398 0.00132661 0.00149243 0.0015635 0.00144505 0.00158719 0.00168195 0.00144505 0.00198991 0.00168195 0.00258214 0.00198991 0.00232156 0.00227418 0.00260583 0.00244001 0.00213204 0.0028901 0.00281904 0.00307962 0.00305593 0.00329282 0.00293748 0.931372 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigMinDistanceToTrack_0> <PhotonBkgMinDistanceToTrack_0> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.0364749 0.0241851 0.020434 0.017279 0.0143625 0.0117578 0.011125 0.00979511 0.00868536 0.00851111 0.00896968 0.00886879 0.00886879 0.00831851 0.00877708 0.00855696 0.00810756 0.00819928 0.00778656 0.00751142 0.00762148 0.00792413 0.00791496 0.0076123 0.00805253 0.00827265 0.00818093 0.00819011 0.00824513 0.00779573 0.00800668 0.0076765 0.00853862 0.00822679 0.00796999 0.00804336 0.625154 </BinContents> + <BinContents>0 0 0 0 0 0.000182977 9.14885e-05 0.000365954 0.000365954 0.000365954 0.000304962 0.000335458 0.00039645 0.000304962 0.000213473 0.000182977 0.000121985 0.000213473 0.000335458 0.000457443 0.000457443 0.00039645 0.000426946 0.000823397 0.000670916 0.000731908 0.00125034 0.00103687 0.00103687 0.00137233 0.00176878 0.00186027 0.00228721 0.00204324 0.00250069 0.00295813 0.00402549 0.00375103 0.003995 0.00436095 0.00500137 0.953005 </BinContents> </PhotonBkgMinDistanceToTrack_0> <PhotonSigMinDistanceToTrack_1> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.00616107 0.00390054 0.00328 0.0027481 0.00217189 0.00252648 0.00190594 0.00203892 0.00141838 0.00150703 0.00141838 0.00132973 0.00164 0.00177297 0.00212757 0.00199459 0.00234919 0.0018173 0.00177297 0.00164 0.00208324 0.00212757 0.00208324 0.00190594 0.00203892 0.00168432 0.00212757 0.00243784 0.00208324 0.00203892 0.00226054 0.00265946 0.00270378 0.0027481 0.00248216 0.00239351 0.918621 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigMinDistanceToTrack_1> <PhotonBkgMinDistanceToTrack_1> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.031834 0.0211044 0.0196413 0.0171806 0.0157618 0.0126361 0.011439 0.0111729 0.0107739 0.0106409 0.0105522 0.0115941 0.0124144 0.0119488 0.0123257 0.0106852 0.011439 0.0117272 0.0105522 0.0106631 0.0108182 0.0111508 0.0112173 0.0114168 0.0106631 0.0111286 0.0107074 0.0100645 0.0102197 0.00968765 0.0090891 0.00886741 0.00964331 0.00937729 0.0103305 0.00982066 0.559711 </BinContents> + <BinContents>0 0 0 0 0 0.00273785 0.00359343 0.00735797 0.00598905 0.00359343 0.00410678 0.00256674 0.00171116 0.00136893 0.00136893 0.00136893 0.00102669 0.00136893 0.00102669 0.00119781 0.000684463 0.0022245 0.00239562 0.00308008 0.00359343 0.0032512 0.00290897 0.0032512 0.00427789 0.00564682 0.00564682 0.00633128 0.00735797 0.00598905 0.00701574 0.00821355 0.00838467 0.0123203 0.0111225 0.0116359 0.00975359 0.834531 </BinContents> </PhotonBkgMinDistanceToTrack_1> <PhotonSigMinDistanceToTrack_2> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.0035615 0.00175635 0.00136605 0.00131727 0.00107333 0.00082939 0.000780602 0.000487876 0.000634239 0.000683027 0.00126848 0.000780602 0.000731814 0.00151242 0.00131727 0.000731814 0.00180514 0.00151242 0.0011709 0.00131727 0.000878177 0.00190272 0.00141484 0.00234181 0.00239059 0.00219544 0.00209787 0.00190272 0.00180514 0.00165878 0.00146363 0.00180514 0.00185393 0.00224423 0.00200029 0.00239059 0.945016 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigMinDistanceToTrack_2> <PhotonBkgMinDistanceToTrack_2> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.0443594 0.0261202 0.0249944 0.0190648 0.0199655 0.014186 0.014186 0.0146363 0.0114088 0.0124597 0.0117091 0.0150867 0.0177888 0.0149366 0.0159874 0.0135105 0.0146363 0.0144862 0.0126098 0.0117841 0.0114839 0.0118592 0.0107333 0.011559 0.0127599 0.0119342 0.00960745 0.0096825 0.00990768 0.00893192 0.00983262 0.00863169 0.00960745 0.0091571 0.00840651 0.0073557 0.494633 </BinContents> + <BinContents>0 0 0 0 0 0.0160514 0.00963082 0.0188604 0.0116372 0.00802568 0.00481541 0.00321027 0.00401284 0.00321027 0.00280899 0.000802568 0.00200642 0.0024077 0.000802568 0.0024077 0.00321027 0.00280899 0.00401284 0.00441413 0.00441413 0.00200642 0.00561798 0.00722311 0.00561798 0.00521669 0.00561798 0.00963082 0.00561798 0.00882825 0.0100321 0.0100321 0.00802568 0.0124398 0.0116372 0.0124398 0.0136437 0.756822 </BinContents> </PhotonBkgMinDistanceToTrack_2> <PhotonSigMinDistanceToTrack_3> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.000984598 0.00119558 0.000773613 0.000351642 0.000703284 0.000562627 0.000632956 0.000773613 0.000843941 0.000492299 0.00091427 0.00091427 0.00133624 0.00140657 0.00119558 0.00105493 0.00189887 0.00182854 0.00161755 0.00232084 0.00182854 0.00182854 0.00253182 0.00203952 0.0019692 0.00218018 0.00239117 0.00274281 0.00302412 0.00253182 0.00154723 0.00182854 0.00302412 0.00210985 0.00232084 0.00302412 0.941276 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigMinDistanceToTrack_3> <PhotonBkgMinDistanceToTrack_3> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.0366818 0.0249341 0.0246943 0.0230161 0.017262 0.0165428 0.0151043 0.014385 0.012467 0.013426 0.0122273 0.0182211 0.0167825 0.0129465 0.0189403 0.0155838 0.011508 0.0139055 0.0103093 0.0129465 0.00935028 0.0141453 0.00911053 0.0107888 0.010549 0.0100695 0.0100695 0.0112683 0.00647327 0.00671302 0.00791177 0.00599377 0.00791177 0.00863102 0.00959003 0.00647327 0.513066 </BinContents> + <BinContents>0 0 0 0 0 0.0166028 0.0121328 0.0280971 0.0108557 0.00574713 0.00702427 0.0063857 0.00255428 0.00319285 0.00191571 0.00319285 0.00191571 0.00127714 0.00063857 0.00191571 0.00319285 0.00255428 0.00127714 0.00446999 0.00255428 0.00574713 0.0063857 0.00702427 0.0114943 0.00574713 0.00510856 0.0108557 0.0083014 0.0102171 0.0114943 0.0083014 0.0114943 0.00893997 0.0102171 0.00766284 0.0083014 0.745211 </BinContents> </PhotonBkgMinDistanceToTrack_3> <PhotonSigMinDistanceToTrack_4> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.00131532 0.000556483 0.000657662 0.000505894 0.000708251 0.000303536 0.000708251 0.000657662 0.000505894 0.00106238 0.00121414 0.00116356 0.00131532 0.00151768 0.00172004 0.00182122 0.00242829 0.00166945 0.00202357 0.00202357 0.00207416 0.002833 0.002833 0.00227652 0.00242829 0.00273183 0.00222593 0.00217534 0.00278242 0.00242829 0.00217534 0.002833 0.00258006 0.00318713 0.00303536 0.0033389 0.934183 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigMinDistanceToTrack_4> <PhotonBkgMinDistanceToTrack_4> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.0272701 0.0194372 0.0203075 0.016246 0.0156658 0.0139252 0.0171163 0.0124746 0.010734 0.0121845 0.0110241 0.0121845 0.016246 0.016246 0.0168262 0.0113142 0.0124746 0.00957354 0.00841311 0.00899333 0.00841311 0.0101538 0.0104439 0.008123 0.00928343 0.00696258 0.00841311 0.00725268 0.00841311 0.00638236 0.0078329 0.00754279 0.00522193 0.00551204 0.00667247 0.00435161 0.590368 </BinContents> + <BinContents>0 0 0 0 0 0.0159266 0.0120656 0.0482625 0.0357143 0.0178571 0.0144788 0.00434363 0.0019305 0.000965251 0.00144788 0.000965251 0.00241313 0.00337838 0.00337838 0.00337838 0.00241313 0.003861 0.00289575 0.00772201 0.00627413 0.003861 0.00675676 0.00530888 0.00627413 0.00820463 0.00675676 0.00723938 0.00916988 0.00965251 0.0106178 0.00916988 0.011583 0.00820463 0.0164093 0.00627413 0.0125483 0.672297 </BinContents> </PhotonBkgMinDistanceToTrack_4> <PhotonSigMinDistanceToTrack_5> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.000933881 0.000522973 0.000747105 0.000672394 0.000410908 0.0010833 0.000859171 0.0010833 0.000933881 0.00134479 0.0014195 0.00235338 0.00201718 0.002839 0.00268958 0.00246545 0.00287635 0.00276429 0.00257751 0.0031752 0.00276429 0.00332462 0.00351139 0.00339933 0.00306313 0.00384759 0.0042585 0.00369817 0.0039223 0.00324991 0.00373552 0.00474412 0.0035861 0.00362346 0.0039223 0.00366081 0.907919 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigMinDistanceToTrack_5> <PhotonBkgMinDistanceToTrack_5> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.0171447 0.0145071 0.0201121 0.0148368 0.0148368 0.0171447 0.0121991 0.0121991 0.0105506 0.00923178 0.0118694 0.0158259 0.0121991 0.0131883 0.0105506 0.00857237 0.00824266 0.0108803 0.0115397 0.00560501 0.013518 0.0115397 0.0102209 0.00956149 0.00791296 0.00725354 0.0049456 0.00461589 0.00461589 0.00791296 0.00824266 0.0049456 0.00824266 0.00758325 0.00461589 0.00461589 0.628421 </BinContents> + <BinContents>0 0 0 0 0 0.0101656 0.00638978 0.0853906 0.0560558 0.0435667 0.0252687 0.00580889 0.00290444 0.00174267 0.00203311 0.00203311 0.00290444 0.00290444 0.00290444 0.00348533 0.00493755 0.00697067 0.00668022 0.005228 0.00697067 0.00697067 0.00842289 0.00755155 0.00697067 0.007842 0.00755155 0.00580889 0.0101656 0.00697067 0.00842289 0.0110369 0.00929422 0.0101656 0.0127796 0.00813244 0.0116178 0.575951 </BinContents> </PhotonBkgMinDistanceToTrack_5> <PhotonSigMinDistanceToTrack_6> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.000907482 0.00077136 0.000725986 0.0010436 0.0010436 0.00167884 0.00231408 0.00204183 0.00208721 0.00267707 0.00322156 0.00412904 0.00458279 0.00394755 0.00394755 0.00458279 0.00444666 0.00512727 0.00449204 0.00539952 0.00503653 0.00585326 0.00499115 0.00535414 0.00589863 0.00512727 0.00503653 0.00512727 0.00576251 0.00626163 0.00571714 0.006307 0.00558102 0.00567176 0.00589863 0.00512727 0.85208 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigMinDistanceToTrack_6> <PhotonBkgMinDistanceToTrack_6> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.0163698 0.0105922 0.0163698 0.0144439 0.0101107 0.0105922 0.0115551 0.0125181 0.00866635 0.00914781 0.0110737 0.0120366 0.0105922 0.0105922 0.0110737 0.00866635 0.00818488 0.00818488 0.00722195 0.0052961 0.00674049 0.0052961 0.00577756 0.0120366 0.00866635 0.00674049 0.00577756 0.00625903 0.0052961 0.00722195 0.00722195 0.00385171 0.00577756 0.00866635 0.00625903 0.00770342 0.677419 </BinContents> + <BinContents>0 0 0 0 0 0.0153322 0.0111949 0.126795 0.0846921 0.053541 0.0348017 0.0114383 0.004624 0.00316379 0.00413726 0.00292042 0.00365052 0.00170358 0.0053541 0.00584084 0.00608421 0.00438063 0.00608421 0.00657094 0.00511073 0.00949136 0.00778778 0.00827452 0.0099781 0.00681431 0.00803115 0.00851789 0.0099781 0.0104648 0.0099781 0.00924799 0.0124118 0.0121684 0.00876126 0.0131419 0.00803115 0.449501 </BinContents> </PhotonBkgMinDistanceToTrack_6> <PhotonSigMinDistanceToTrack_7> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.00123737 0.00116863 0.00171857 0.00233725 0.00171857 0.00247474 0.00295594 0.00398708 0.00350588 0.00426205 0.00460576 0.00488073 0.00783667 0.00701175 0.00666804 0.00701175 0.00721798 0.00584313 0.00776792 0.00653056 0.00714924 0.00907404 0.00831787 0.00797415 0.00701175 0.00790541 0.0075617 0.00763044 0.00653056 0.0065993 0.0065993 0.00769918 0.00584313 0.00749295 0.00776792 0.0061181 0.791985 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigMinDistanceToTrack_7> <PhotonBkgMinDistanceToTrack_7> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.0124378 0.00829187 0.0165837 0.00912106 0.00829187 0.00829187 0.00497512 0.00746269 0.00829187 0.00829187 0.00746269 0.00746269 0.00912106 0.0149254 0.00580431 0.00746269 0.0066335 0.0066335 0.00746269 0.0107794 0.00414594 0.00580431 0.00995025 0.00746269 0.00497512 0.00912106 0.000829187 0.00912106 0.013267 0.00497512 0.0066335 0.00746269 0.00331675 0.00331675 0.00829187 0.00331675 0.722222 </BinContents> + <BinContents>0 0 0 0 0 0.0152953 0.0089061 0.170571 0.114424 0.0799613 0.0495644 0.0158761 0.0121975 0.00600194 0.00813166 0.00561471 0.00580833 0.00600194 0.00638916 0.00755082 0.00619555 0.00851888 0.00968054 0.00851888 0.0100678 0.0102614 0.0071636 0.0106486 0.0106486 0.00987415 0.0106486 0.0100678 0.011423 0.011423 0.0116167 0.0102614 0.0116167 0.0116167 0.00948693 0.00696999 0.00909971 0.281897 </BinContents> </PhotonBkgMinDistanceToTrack_7> <PhotonSigMinDistanceToTrack_8> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.00196348 0.00284704 0.002258 0.00363244 0.00481052 0.00441783 0.00530139 0.00539957 0.00500687 0.00638131 0.00549774 0.00854114 0.01129 0.00962105 0.0113882 0.0106028 0.00952287 0.0107991 0.0103083 0.0094247 0.0113882 0.009032 0.0109955 0.0106028 0.0104064 0.0113882 0.0102101 0.00932653 0.0106028 0.009032 0.0108973 0.00873748 0.0098174 0.00863931 0.00795209 0.00932653 0.702631 </BinContents> + <BinContents>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </BinContents> </PhotonSigMinDistanceToTrack_8> <PhotonBkgMinDistanceToTrack_8> <NBinsX>40</NBinsX> <XLow>0</XLow> <XHigh>20</XHigh> - <BinContents>0 0 0 0 0 0.00397614 0.00298211 0.0129225 0.00497018 0.00497018 0.00894632 0.00894632 0.00298211 0.00994036 0.00795229 0.00596421 0.00894632 0.0149105 0.00298211 0.0119284 0.00695825 0.0149105 0.00695825 0.00695825 0.00596421 0.0129225 0.00994036 0.0149105 0.0119284 0.00397614 0.00596421 0.0149105 0.00695825 0.00994036 0.00795229 0.00994036 0.00596421 0.0109344 0.00497018 0.00497018 0.00894632 0.699801 </BinContents> + <BinContents>0 0 0 0 0 0.0135981 0.0107354 0.312638 0.218644 0.145106 0.0873144 0.0228425 0.0113318 0.00745512 0.00518876 0.00453271 0.00441343 0.0036381 0.00435379 0.00387666 0.00351882 0.00250492 0.0036381 0.00274348 0.00208743 0.00351882 0.002326 0.00250492 0.00202779 0.00256456 0.00250492 0.00280313 0.002326 0.00256456 0.00328025 0.00220672 0.00274348 0.00250492 0.00190851 0.00172959 0.002326 0.0899982 </BinContents> </PhotonBkgMinDistanceToTrack_8> diff --git a/Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml b/Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml index 81a41e39c6bf686f35ea5664624c8e2ffde2efd9..ea248899b40a480e45bcc82688b33cfded165a9c 100644 --- a/Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml +++ b/Reconstruction/PFA/Pandora/PandoraSettingsDefault.xml @@ -69,8 +69,7 @@ <ClusterListName>PhotonClusters</ClusterListName> <ReplaceCurrentClusterList>false</ReplaceCurrentClusterList> <ShouldMakePdfHistograms>false</ShouldMakePdfHistograms> - <HistogramFile>./Reconstruction/PFA/Pandora/PandoraLikelihoodData9EBin.xml</HistogramFile> - <!--HistogramFile>/junofs/users/wxfang/MyGit/tmp/fork_update_pandora/CEPCSW/Reconstruction/PFA/Pandora/PandoraLikelihoodData9EBin.xml</HistogramFile--> + <HistogramFile>Reconstruction/PFA/Pandora/PandoraLikelihoodData9EBin.xml</HistogramFile> </algorithm> <!-- Clustering parent algorithm runs a daughter clustering algorithm --> diff --git a/Reconstruction/SiliconTracking/CMakeLists.txt b/Reconstruction/SiliconTracking/CMakeLists.txt index 32864bf2a894d7efb3525f3d92fd1871742a189e..9eb87350466e1836ee641b685b1a9ac24e084126 100644 --- a/Reconstruction/SiliconTracking/CMakeLists.txt +++ b/Reconstruction/SiliconTracking/CMakeLists.txt @@ -1,23 +1,23 @@ -gaudi_subdir(SiliconTracking v0r0) - -find_package(GEAR REQUIRED) -find_package(GSL REQUIRED ) -find_package(LCIO REQUIRED ) -find_package(EDM4HEP REQUIRED ) -find_package(DD4hep COMPONENTS DDCore DDRec REQUIRED) - -gaudi_depends_on_subdirs( - Service/GearSvc - Service/EventSeeder - Service/TrackSystemSvc - Utilities/DataHelper - Utilities/KiTrack -) - -set(SiliconTracking_srcs src/*.cpp) # Modules -gaudi_add_module(SiliconTracking ${SiliconTracking_srcs} - INCLUDE_DIRS GaudiKernel k4FWCore gear ${GSL_INCLUDE_DIRS} ${LCIO_INCLUDE_DIRS} - LINK_LIBRARIES TrackSystemSvcLib DataHelperLib KiTrackLib GaudiKernel k4FWCore ${GEAR_LIBRARIES} ${GSL_LIBRARIES} ${LCIO_LIBRARIES} +gaudi_add_module(SiliconTracking + SOURCES src/ForwardTrackingAlg.cpp + src/SiliconTrackingAlg.cpp + src/SpacePointBuilderAlg.cpp + src/TrackSubsetAlg.cpp + LINK GearSvc + EventSeeder + TrackSystemSvcLib + DataHelperLib + KiTrackLib + Gaudi::GaudiKernel + k4FWCore::k4FWCore + ${GEAR_LIBRARIES} + ${GSL_LIBRARIES} + ${LCIO_LIBRARIES} ) +install(TARGETS SiliconTracking + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Reconstruction/Tracking/CMakeLists.txt b/Reconstruction/Tracking/CMakeLists.txt index 0a4452cce02376ded13ec19bbafc8425b88d0f78..5123c2922caa0f44e9346f3e11b8bc0710fb04ea 100644 --- a/Reconstruction/Tracking/CMakeLists.txt +++ b/Reconstruction/Tracking/CMakeLists.txt @@ -1,32 +1,28 @@ -gaudi_subdir(Tracking v0r0) - -find_package(GEAR REQUIRED) -find_package(GSL REQUIRED ) -find_package(LCIO REQUIRED ) -find_package(EDM4HEP REQUIRED ) -find_package(DD4hep COMPONENTS DDCore DDRec REQUIRED) - - -gaudi_depends_on_subdirs( - Service/GearSvc - Service/EventSeeder - Service/TrackSystemSvc - Detector/DetSegmentation +# Modules +gaudi_add_module(Tracking + SOURCES src/Clupatra/ClupatraAlg.cpp + src/Clupatra/clupatra_new.cpp + src/FullLDCTracking/FullLDCTrackingAlg.cpp + src/TruthTracker/TruthTrackerAlg.cpp + LINK GearSvc + EventSeeder + TrackSystemSvcLib + DetSegmentation + Gaudi::GaudiAlgLib + Gaudi::GaudiKernel + ${GEAR_LIBRARIES} + ${GSL_LIBRARIES} + ${LCIO_LIBRARIES} + DetSegmentation + EDM4HEP::edm4hep EDM4HEP::edm4hepDict ) -set(Tracking_srcs - src/Clupatra/*.cpp - src/FullLDCTracking/*.cpp - src/TruthTracker/*.cpp -) +target_include_directories(Tracking PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) -# Modules -gaudi_add_module(Tracking ${Tracking_srcs} - INCLUDE_DIRS GaudiKernel gear ${GSL_INCLUDE_DIRS} ${LCIO_INCLUDE_DIRS} - LINK_LIBRARIES GaudiAlgLib GaudiKernel ${GEAR_LIBRARIES} ${GSL_LIBRARIES} - ${LCIO_LIBRARIES} TrackSystemSvcLib - DetSegmentation - -Wl,--no-as-needed - EDM4HEP::edm4hep EDM4HEP::edm4hepDict - -Wl,--as-needed -) +install(TARGETS Tracking + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Reconstruction/Tracking/Tracking/TrackingHelper.h b/Reconstruction/Tracking/include/Tracking/TrackingHelper.h similarity index 100% rename from Reconstruction/Tracking/Tracking/TrackingHelper.h rename to Reconstruction/Tracking/include/Tracking/TrackingHelper.h diff --git a/Reconstruction/Tracking/src/Clupatra/ClupatraAlg.cpp b/Reconstruction/Tracking/src/Clupatra/ClupatraAlg.cpp index af73dccf723b0c9db0770543e79f0f194239900d..5c14a0fbdead30aab938178d07112e55c379bf03 100644 --- a/Reconstruction/Tracking/src/Clupatra/ClupatraAlg.cpp +++ b/Reconstruction/Tracking/src/Clupatra/ClupatraAlg.cpp @@ -232,12 +232,6 @@ StatusCode ClupatraAlg::initialize() { StatusCode ClupatraAlg::execute() { - TrackInfo_of_edm4hepTrack.init(); - MarTrk_of_edm4hepTrack.init(); - CluTrk_of_MarTrack.init(); - MarTrkof.init(); - GHitof.init(); - debug() << "Clupatra Algorithm started" << endmsg; @@ -1267,6 +1261,12 @@ StatusCode ClupatraAlg::execute() { _nEvt++ ; + TrackInfo_of_edm4hepTrack.clear(); + MarTrk_of_edm4hepTrack.clear(); + CluTrk_of_MarTrack.clear(); + MarTrkof.clear(); + GHitof.clear(); + return StatusCode::SUCCESS; } diff --git a/Reconstruction/Tracking/src/Clupatra/RuntimeMap.h b/Reconstruction/Tracking/src/Clupatra/RuntimeMap.h index 2b0b14a2ed1b0edcbcd75e427fa942f6d1f19853..a85f460913d7225f389d638ffb5c51dd4d0ebbbe 100644 --- a/Reconstruction/Tracking/src/Clupatra/RuntimeMap.h +++ b/Reconstruction/Tracking/src/Clupatra/RuntimeMap.h @@ -9,7 +9,7 @@ class RuntimeMap { V& operator()(const U& u) { return data[u]; } - void init() { + void clear() { data.clear(); } }; diff --git a/Reconstruction/Tracking/src/TruthTracker/TruthTrackerAlg.cpp b/Reconstruction/Tracking/src/TruthTracker/TruthTrackerAlg.cpp index b6da32ed0afc0c6291ff250f6de75b0dfe91c787..612fae8e2a0de342361d2ad0527a5c90b9055629 100644 --- a/Reconstruction/Tracking/src/TruthTracker/TruthTrackerAlg.cpp +++ b/Reconstruction/Tracking/src/TruthTracker/TruthTrackerAlg.cpp @@ -71,29 +71,6 @@ StatusCode TruthTrackerAlg::initialize() return StatusCode::FAILURE; } - // Book N-tuple 1 - NTuplePtr nt1(ntupleSvc(), "TruthTrackerAlg/1"); - if ( nt1 ) { - m_tuple_id = nt1; - } else { - m_tuple_id = ntupleSvc()->book( "TruthTrackerAlg/1", CLID_RowWiseTuple, "Row-wise N-Tuple example" ); - if ( m_tuple_id ) { - m_tuple_id->addItem( "system", m_id_system ).ignore(); - m_tuple_id->addItem( "module", m_id_module ).ignore(); - m_tuple_id->addItem( "stave", m_id_stave ).ignore(); - m_tuple_id->addItem( "tower", m_id_tower ).ignore(); - m_tuple_id->addItem( "layer", m_id_layer ).ignore(); - m_tuple_id->addItem( "wafer", m_id_wafer ).ignore(); - m_tuple_id->addItem( "cellX", m_id_cellX ).ignore(); - m_tuple_id->addItem( "cellY", m_id_cellY ).ignore(); - - } else { // did not manage to book the N tuple.... - error() << " Cannot book N-tuple:" << long( m_tuple_id ) << endmsg; - return StatusCode::FAILURE; - } - } - - return GaudiAlgorithm::initialize(); } diff --git a/Reconstruction/Tracking/src/TruthTracker/TruthTrackerAlg.h b/Reconstruction/Tracking/src/TruthTracker/TruthTrackerAlg.h index f8f31c13ba50813a05e7eb47c50658ab47282e1d..23e581e1b73a4e1f962ddc3e53cfb8e525258de6 100644 --- a/Reconstruction/Tracking/src/TruthTracker/TruthTrackerAlg.h +++ b/Reconstruction/Tracking/src/TruthTracker/TruthTrackerAlg.h @@ -3,13 +3,11 @@ #include "GaudiAlg/GaudiAlgorithm.h" #include "k4FWCore/DataHandle.h" -#include "GaudiKernel/NTuple.h" #include "DD4hep/Fields.h" class IGeomSvc; namespace dd4hep { class Detector; - //class rec::CellIDPositionConverter; namespace DDSegmentation{ class GridDriftChamber; class BitFieldCoder; @@ -37,7 +35,6 @@ class TruthTrackerAlg: public GaudiAlgorithm SmartIF<IGeomSvc> m_geomSvc; dd4hep::Detector* m_dd4hep; dd4hep::OverlayedField m_dd4hepField; - //dd4hep::rec::CellIDPositionConverter* m_cellIDConverter; dd4hep::DDSegmentation::GridDriftChamber* m_gridDriftChamber; dd4hep::DDSegmentation::BitFieldCoder* m_decoder; @@ -62,18 +59,7 @@ class TruthTrackerAlg: public GaudiAlgorithm Gaudi::Property<std::string> m_readout_name{this, "readout", "DriftChamberHitsCollection"}; - int m_debug; - //strore all the id for later analysis - NTuple::Tuple* m_tuple_id = nullptr; - - NTuple::Item<int> m_id_system; - NTuple::Item<int> m_id_module; - NTuple::Item<int> m_id_stave; - NTuple::Item<int> m_id_tower; - NTuple::Item<int> m_id_layer; - NTuple::Item<int> m_id_wafer; - NTuple::Item<int> m_id_cellX; - NTuple::Item<int> m_id_cellY; + Gaudi::Property<int> m_debug{ this, "debug", false}; }; #endif diff --git a/Service/CMakeLists.txt b/Service/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..24ff600bbc724865bb12782e5710849a7b1fd3c2 --- /dev/null +++ b/Service/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(EventSeeder) +add_subdirectory(GearSvc) +add_subdirectory(TrackSystemSvc) diff --git a/Service/EventSeeder/CMakeLists.txt b/Service/EventSeeder/CMakeLists.txt index 8bf504d85fbab7043e0fcd82e7b45043fc9b7347..3c45a7468265daa6e1b57b60a597becaad5396bd 100644 --- a/Service/EventSeeder/CMakeLists.txt +++ b/Service/EventSeeder/CMakeLists.txt @@ -1,14 +1,16 @@ -gaudi_subdir(EventSeeder v0r0) -#find_package(GEAR REQUIRED) +gaudi_add_header_only_library(EventSeeder) -set(EventSeeder_srcs - src/*.cpp +gaudi_add_module(EventSeederPlugins + SOURCES src/MarlinEvtSeeder.cpp + LINK EventSeeder + Gaudi::GaudiKernel ) -gaudi_install_headers(EventSeeder) +install(TARGETS EventSeeder EventSeederPlugins + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) + -gaudi_add_module(EventSeeder ${EventSeeder_srcs} - INCLUDE_DIRS GaudiKernel - LINK_LIBRARIES GaudiKernel -) diff --git a/Service/EventSeeder/EventSeeder/IEventSeeder.h b/Service/EventSeeder/include/EventSeeder/IEventSeeder.h similarity index 100% rename from Service/EventSeeder/EventSeeder/IEventSeeder.h rename to Service/EventSeeder/include/EventSeeder/IEventSeeder.h diff --git a/Service/GearSvc/CMakeLists.txt b/Service/GearSvc/CMakeLists.txt index 52beee1e171a5a31071ab88efaeb241e27360d6a..248cf3dfebc8ce42bca6f4e45c1803293989f853 100644 --- a/Service/GearSvc/CMakeLists.txt +++ b/Service/GearSvc/CMakeLists.txt @@ -1,14 +1,18 @@ -gaudi_subdir(GearSvc v0r0) -find_package(GEAR REQUIRED) +gaudi_add_header_only_library(GearSvc) -set(GearSvc_srcs - src/*.cpp +gaudi_add_module(GearSvcPlugins + SOURCES src/GearSvc.cpp + LINK GearSvc + Gaudi::GaudiKernel + ${GEAR_LIBRARIES} + ${DD4hep_COMPONENT_LIBRARIES} + DetInterface ) -gaudi_install_headers(GearSvc) +install(TARGETS GearSvc GearSvcPlugins + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) -gaudi_add_module(GearSvc ${GearSvc_srcs} - INCLUDE_DIRS GaudiKernel gear - LINK_LIBRARIES GaudiKernel ${GEAR_LIBRARIES} -) diff --git a/Service/GearSvc/GearSvc/IGearSvc.h b/Service/GearSvc/include/GearSvc/IGearSvc.h similarity index 100% rename from Service/GearSvc/GearSvc/IGearSvc.h rename to Service/GearSvc/include/GearSvc/IGearSvc.h diff --git a/Service/GearSvc/src/GearSvc.cpp b/Service/GearSvc/src/GearSvc.cpp index 7aafb84e56cc3c121826cf752582d77453a31d9c..274479f5d47ec58bae73034a6596cd50ba91ac3d 100644 --- a/Service/GearSvc/src/GearSvc.cpp +++ b/Service/GearSvc/src/GearSvc.cpp @@ -1,6 +1,36 @@ #include "GearSvc.h" +#include "DetInterface/IGeomSvc.h" #include "gearxml/GearXML.h" #include "gearimpl/GearMgrImpl.h" +#include "gearimpl/ConstantBField.h" +#include "gearimpl/ZPlanarParametersImpl.h" +#include "gearimpl/ZPlanarLayerLayoutImpl.h" +#include "gearimpl/FTDParametersImpl.h" +#include "gearimpl/TPCParametersImpl.h" +#include "gearimpl/FixedPadSizeDiskLayout.h" +#include "gearimpl/CalorimeterParametersImpl.h" +#include "gearimpl/SimpleMaterialImpl.h" +#include "gearxml/tinyxml.h" + +#include "DD4hep/Detector.h" +#include "DD4hep/DetElement.h" +#include "DDRec/DetectorData.h" +#include "DD4hep/DD4hepUnits.h" +#include "CLHEP/Units/SystemOfUnits.h" + +struct helpLayer { + double distance =0; + double offset =0; + double thickness =0; + double length =0; + double width =0; + double radLength =0; + double z =0; + double foam_spacer_radLength =0; +}; + +static const double deg_to_rad = dd4hep::degree/CLHEP::rad; +static const double rad_to_deg = dd4hep::rad/CLHEP::degree; DECLARE_COMPONENT(GearSvc) @@ -21,16 +51,87 @@ gear::GearMgr* GearSvc::getGearMgr() StatusCode GearSvc::initialize() { - if ( m_gearFile.size() > 0 ) { - info() << "instantiated GEAR from file " << m_gearFile << endmsg; - m_gearMgr = gear::GearXML(m_gearFile).createGearMgr(); + StatusCode sc; + + if ( m_gearFile.size() > 0 ) { + info() << "instantiated GEAR from file " << m_gearFile << endmsg; + m_gearMgr = gear::GearXML(m_gearFile).createGearMgr(); + } + else { + warning() << "no GEAR XML file given ..." << endmsg; + m_gearMgr = new gear::GearMgrImpl; + + auto geomSvc = service<IGeomSvc>("GeomSvc"); + if ( !geomSvc ) { + info() << "Failed to find GeomSvc ..." << endmsg; + return StatusCode::FAILURE; } - else { - warning() << "no GEAR XML file given ..." << endmsg; - m_gearMgr = new gear::GearMgrImpl; + info() << "Fill GEAR data from GeomSvc" << endmsg; + m_gearMgr->setDetectorName("CRD_o1_v01"); + + const dd4hep::Direction& field = geomSvc->lcdd()->field().magneticField(dd4hep::Position(0,0,0)); + gear::ConstantBField* b = new gear::ConstantBField(gear::Vector3D(field.x()/dd4hep::tesla, field.y()/dd4hep::tesla, field.z()/dd4hep::tesla)); + m_gearMgr->setBField(b); + + dd4hep::DetElement world = geomSvc->getDD4HepGeo(); + const std::map<std::string, dd4hep::DetElement>& subs = world.children(); + for(std::map<std::string, dd4hep::DetElement>::const_iterator it=subs.begin();it!=subs.end();it++){ + dd4hep::DetElement sub = it->second; + info() << it->first << " " << sub.path() << " " << sub.placementPath() << endmsg; + if(it->first=="Tube"||it->first=="BeamPipe"){ + sc = convertBeamPipe(sub); + } + else if(it->first=="VXD"){ + sc = convertVXD(sub); + } + else if(it->first=="FTD"){ + sc = convertFTD(sub); + } + else if(it->first=="SIT"){ + sc = convertSIT(sub); + } + else if(it->first=="TPC"){ + sc = convertTPC(sub); + } + else if(it->first=="SET"){ + sc = convertSET(sub); + } + else{ + info() << it->first << " will convert in future! now fake parameters" << endmsg; + } + if(sc==StatusCode::FAILURE) return sc; + } + gear::CalorimeterParametersImpl* barrelParam = new gear::CalorimeterParametersImpl(1847.415655, 2350., 8, 0.); + gear::CalorimeterParametersImpl* endcapParam = new gear::CalorimeterParametersImpl(400., 2088.8, 2450., 2, 0.); + for(int i=0;i<29;i++){ + if(i<19){ + barrelParam->layerLayout().positionLayer(0, 5.25, 1.016666667e+01, 1.016666667e+01, 2.1); + endcapParam->layerLayout().positionLayer(0, 5.25, 1.016666667e+01, 1.016666667e+01, 2.1); + } + else if(i<20){ + barrelParam->layerLayout().positionLayer(0, 6.3, 1.016666667e+01, 1.016666667e+01, 2.1); + endcapParam->layerLayout().positionLayer(0, 6.3, 1.016666667e+01, 1.016666667e+01, 2.1); + } + else{ + barrelParam->layerLayout().positionLayer(0, 4.2, 1.016666667e+01, 1.016666667e+01, 4.2); + endcapParam->layerLayout().positionLayer(0, 4.2, 1.016666667e+01, 1.016666667e+01, 4.2); + } } + m_gearMgr->setEcalBarrelParameters(barrelParam); + m_gearMgr->setEcalEndcapParameters(endcapParam); - return StatusCode::SUCCESS; + gear::CalorimeterParametersImpl* barrelYokeParam = new gear::CalorimeterParametersImpl(4173.929932, 4072., 12, 0.0); + gear::CalorimeterParametersImpl* endcapYokeParam = new gear::CalorimeterParametersImpl(320., 7414.929932, 4072., 2, 0.0); + gear::CalorimeterParametersImpl* plugYokeParam = new gear::CalorimeterParametersImpl(320., 2849.254326, 3781.43, 2, 0.0); + plugYokeParam->setDoubleVal("YokePlugThickness", 290.57) ; + m_gearMgr->setYokeBarrelParameters(barrelYokeParam) ; + m_gearMgr->setYokeEndcapParameters(endcapYokeParam) ; + m_gearMgr->setYokePlugParameters(plugYokeParam) ; + gear::TiXmlDocument* doc = new gear::TiXmlDocument ; + gear::GearXML::createXMLFile(m_gearMgr, "test.xml"); + } + + return StatusCode::SUCCESS; } StatusCode GearSvc::finalize() @@ -42,3 +143,645 @@ StatusCode GearSvc::finalize() return StatusCode::SUCCESS; } + +StatusCode GearSvc::convertBeamPipe(dd4hep::DetElement& pipe){ + StatusCode sc; + + dd4hep::rec::ConicalSupportData* beamPipeData = nullptr; + try{ + beamPipeData = pipe.extension<dd4hep::rec::ConicalSupportData>(); + } + catch(std::runtime_error& e){ + warning() << e.what() << " " << beamPipeData << endmsg; + return StatusCode::FAILURE; + } + + std::vector<double> gearValRInner; + std::vector<double> gearValROuter; + std::vector<double> gearValZ; + const std::vector<dd4hep::rec::ConicalSupportData::Section>& sections = beamPipeData->sections; + for(int i=0;i<sections.size();i++){ + gearValZ.push_back(sections[i].zPos*CLHEP::cm ); + gearValRInner.push_back(sections[i].rInner*CLHEP::cm ); + gearValROuter.push_back(sections[i].rOuter*CLHEP::cm ); + } + + gear::GearParametersImpl* gearParameters = new gear::GearParametersImpl; + gearParameters -> setDoubleVals( "Z" , gearValZ ) ; + gearParameters -> setDoubleVals( "RInner" , gearValRInner ) ; + gearParameters -> setDoubleVals( "ROuter" , gearValROuter ) ; + + m_gearMgr->setGearParameters("BeamPipe", gearParameters ) ; + + return StatusCode::SUCCESS; +} + +StatusCode GearSvc::convertVXD(dd4hep::DetElement& vxd){ + StatusCode sc; + //fucd: another method to obtain parameters, but not fully for KalDet + dd4hep::rec::ZPlanarData* vxdData = nullptr; + bool extensionDataValid = true; + try{ + vxdData = vxd.extension<dd4hep::rec::ZPlanarData>(); + } + catch(std::runtime_error& e){ + extensionDataValid = false; + info() << e.what() << " " << vxdData << endmsg; + } + + std::vector<helpLayer> helpSensitives; + std::vector<helpLayer> helpLadders; + std::vector<int> helpNumberLadders; + std::vector<double> helpPhi0; + int helpCount=0; + int type=0; + double shellInnerRadius, shellOuterRadius, shellHalfLength, gap, shellRadLength; + int nLadders=0; + double phi0=0; + helpLayer thisLadder; + double beryllium_ladder_block_length=0,end_electronics_half_z=0,side_band_electronics_width=0; + double rAlu, drAlu, rSty, drSty, dzSty, rInner, aluEndcapZ, aluHalfZ, alu_RadLen, Cryostat_dEdx; + double VXDSupportDensity, VXDSupportZeff, VXDSupportAeff, VXDSupportRadLen, VXDSupportIntLen=0; + double styDensity, styZeff, styAeff, styRadLen, styIntLen; + dd4hep::Volume vxd_vol = vxd.volume(); + for(int i=0;i<vxd_vol->GetNdaughters();i++){ + TGeoNode* daughter = vxd_vol->GetNode(i); + std::string nodeName = daughter->GetName(); + if(nodeName=="VXD_support_assembly_0"){ + TGeoNode* shell = FindNode(daughter, "SupportShell"); + if(shell){ + const TGeoShape* shape_shell = shell->GetVolume()->GetShape(); + //fucd: IsA() method does not always work for TGeoTube, sometimes, strange? + //if(shape_shell->IsA()==TGeoTube::Class()){ + if(shape_shell->TestShapeBit(TGeoTube::kGeoTube)){ + const TGeoTube* tube = (const TGeoTube*) shape_shell; + shellInnerRadius = tube->GetRmin()*CLHEP::cm; + shellOuterRadius = tube->GetRmax()*CLHEP::cm; + shellHalfLength = tube->GetDz()*CLHEP::cm; + } + else{ + error() << shell->GetName() << " is not a TGeoTube! Shape bits = " << shape_shell->TestShapeBits(0xFFFFFFFF) << endmsg; + } + TGeoMaterial* mat = shell->GetMedium()->GetMaterial(); + shellRadLength = mat->GetRadLen()*CLHEP::cm; + } + TGeoNode* block = FindNode(daughter, "BerylliumAnnulusBlock"); + if(block){ + const TGeoShape* shape_block = block->GetVolume()->GetShape(); + if(shape_block->IsA()==TGeoBBox::Class()){ + const TGeoBBox* box = (const TGeoBBox*) shape_block; + beryllium_ladder_block_length = box->GetDY()*CLHEP::cm; + } + else{ + error() << block->GetName() << " is not a TGeoTube! Shape bits = " << shape_block->TestShapeBits(0xFFFFFFFF) << endmsg; + } + } + TGeoNode* skin = FindNode(daughter, "CryostatAluSkinBarrel"); + if(skin){ + const TGeoShape* shape_skin = skin->GetVolume()->GetShape(); + if(shape_skin->TestShapeBit(TGeoTube::kGeoTube)){ + const TGeoTube* tube = (const TGeoTube*) shape_skin; + rAlu = tube->GetRmin()*CLHEP::cm; + drAlu = tube->GetRmax()*CLHEP::cm - rAlu; + aluHalfZ = tube->GetDz()*CLHEP::cm; + } + else{ + error() << skin->GetName() << " is not a TGeoTube! Shape bits = " << shape_skin->TestShapeBits(0xFFFFFFFF) << endmsg; + } + } + TGeoNode* foam = FindNode(daughter, "CryostatFoamBarrel"); + if(foam){ + const TGeoShape* shape_foam = foam->GetVolume()->GetShape(); + if(shape_foam->TestShapeBit(TGeoTube::kGeoTube)){ + const TGeoTube* tube = (const TGeoTube*) shape_foam; + rSty = tube->GetRmin()*CLHEP::cm; + drSty = tube->GetRmax()*CLHEP::cm - rSty; + dzSty = tube->GetDz()*CLHEP::cm; + } + else{ + error() << foam->GetName() << " is not a TGeoTube! Shape bits = " << shape_foam->TestShapeBits(0xFFFFFFFF) << endmsg; + } + TGeoMaterial* mat = foam->GetMedium()->GetMaterial(); + double Zeff = 0, ZAeff = 0; + for(int iEle = 0; iEle<mat->GetNelements(); iEle++){ + double A, Z, w; + mat->GetElementProp(A,Z,w,iEle); + Zeff += Z*w; + ZAeff += Z/A*w; + //std::cout << std::setprecision(16) << Z << " " << A << " " << w << std::endl; + } + styZeff = Zeff; + styAeff = Zeff/ZAeff; + styRadLen = mat->GetRadLen()*CLHEP::cm; + styIntLen = mat->GetIntLen()*CLHEP::cm; + styDensity = mat->GetDensity(); + } + TGeoNode* skinEnd = FindNode(daughter, "CryostatAluSkinEndPlateInner"); + if(skinEnd){ + const TGeoShape* shape_skinEnd = skinEnd->GetVolume()->GetShape(); + if(shape_skinEnd->TestShapeBit(TGeoTube::kGeoTube)){ + const TGeoTube* tube = (const TGeoTube*) shape_skinEnd; + rInner = tube->GetRmin()*CLHEP::cm; + double rmax = tube->GetRmax()*CLHEP::cm; + drAlu = tube->GetDz()*CLHEP::cm*2; + } + else{ + error() << skinEnd->GetName() << " is not a TGeoTube! Shape bits = " << shape_skinEnd->TestShapeBits(0xFFFFFFFF) << endmsg; + } + } + TGeoNode* shellEnd = FindNode(daughter, "EndPlateShell_outer"); + if(shellEnd){ + const TGeoShape* shape_shellEnd = shellEnd->GetVolume()->GetShape(); + if(shape_shellEnd->TestShapeBit(TGeoTube::kGeoTube)){ + const TGeoTube* tube = (const TGeoTube*) shape_shellEnd; + double rmin = tube->GetRmin()*CLHEP::cm; + double rmax = tube->GetRmax()*CLHEP::cm; + double zhalf = tube->GetDz()*CLHEP::cm; + } + else{ + error() << shellEnd->GetName() << " is not a TGeoTube! Shape bits = " << shape_shellEnd->TestShapeBits(0xFFFFFFFF) << endmsg; + } + } + + } + else if(nodeName=="layer_assembly_0_1"){ + if(TGeoNode* side_band = FindNode(daughter, "ElectronicsBand")){ + const TGeoShape* shape_band = side_band->GetVolume()->GetShape(); + if(shape_band->IsA()==TGeoBBox::Class()){ + const TGeoBBox* box = (const TGeoBBox*) shape_band; + side_band_electronics_width = box->GetDX()*CLHEP::cm*2; + //info() << "fucd: "<< box->GetDX() << " " << box->GetDY() << " " << box->GetDZ() <<endmsg; + } + else{ + error() << "ElectronicsBand is not a TGeoBBox!!!"<< endmsg; + } + } + if(TGeoNode* end = FindNode(daughter, "ElectronicsEnd")){ + const TGeoShape* shape_end = end->GetVolume()->GetShape(); + if(shape_end->IsA()==TGeoBBox::Class()){ + const TGeoBBox* box = (const TGeoBBox*) shape_end; + end_electronics_half_z = box->GetDY()*CLHEP::cm; + //info() << "fucd: " << box->GetDX() << " " << box->GetDY() << " " << box->GetDZ() << endmsg; + } + else{ + error() << "ElectronicsEnd is not a TGeoBBox!!!"<< endmsg; + } + } + } + } + + const std::map<std::string, dd4hep::DetElement>& components = vxd.children(); + for(std::map<std::string, dd4hep::DetElement>::const_iterator it=components.begin();it!=components.end();it++){ + dd4hep::DetElement component = it->second; + dd4hep::Volume vol = component.volume(); + dd4hep::PlacedVolume phys = component.placement(); + TGeoMaterial* mat = vol->GetMaterial(); + const TGeoShape* shape = vol->GetShape(); + const dd4hep::PlacedVolumeExtension::VolIDs& ids = phys.volIDs(); + if(vol.isSensitive()&&shape->IsA()==TGeoBBox::Class()){ + int iLayer = ids.find("layer")->second; + int iModule = ids.find("module")->second; + int iSide = ids.find("side")->second; + if(iModule==0&&iLayer==helpCount+1){ + helpCount++; + helpSensitives.push_back(thisLadder); + helpLadders.push_back(thisLadder); + helpNumberLadders.push_back(nLadders); + helpPhi0.push_back(phi0); + nLadders = 0; + thisLadder.length = 0; + } + if(iLayer == helpCount){ + if(iModule == 0){ + const TGeoBBox* box = (const TGeoBBox*) shape; + double width = box->GetDX()*CLHEP::cm; + double length = box->GetDY()*CLHEP::cm; + double thickness = box->GetDZ()*CLHEP::cm; + TGeoMatrix* matrix = phys->GetMatrix(); + const double* pos = matrix->GetTranslation(); + const double* rot_data = matrix->GetRotationMatrix(); + TGeoRotation rot; + rot.SetMatrix(rot_data); + double theta,phi,psi; + rot.GetAngles(phi,theta,psi); + phi *= deg_to_rad; + theta *= deg_to_rad; + psi *= deg_to_rad; + phi0 = -dd4hep::halfpi+phi; + double distance = fabs(cos(phi0)*sin(theta)*pos[0]+sin(phi0)*sin(theta)*pos[1]+cos(theta)*pos[2]); + double offset = sqrt(pos[0]*pos[0]+pos[1]*pos[1]-distance*distance)*pos[0]/fabs(pos[0])*CLHEP::cm; + distance *= CLHEP::cm; + distance -= thickness; + double radL = mat->GetRadLen()*CLHEP::cm; + //info() << " -> " << helpCount << ": " << distance << " " << cos(atan2(pos[1],pos[0])-phi)*sqrt(pos[0]*pos[0]+pos[1]*pos[1]) << endmsg; + thisLadder.distance = distance; + thisLadder.offset = offset; + thisLadder.thickness = thickness; + thisLadder.length += length; + thisLadder.width = width; + thisLadder.radLength = radL; + thisLadder.z = pos[2]*CLHEP::cm; + } + if(iModule==nLadders) nLadders++; + } + } + else if(it->first=="VXD_support"){ + helpCount++; + helpSensitives.push_back(thisLadder); + helpLadders.push_back(thisLadder); + helpNumberLadders.push_back(nLadders); + helpPhi0.push_back(phi0); + nLadders = 0; + if(vol->GetNdaughters()==0) error() << "!!!!!!!!!" << endmsg; + + int nFlexCable = 0, nFoamSpacer=0, nMetalTraces=0; + int currentLayer = -1; + double tFlexCable, tFoamSpacer, tMetalTraces; + double radLFlexCable, radLFoamSpacer, radLMetalTraces; + double intLFlexCable, intLFoamSpacer, intLMetalTraces; + double dFlexCable, dFoamSpacer, dMetalTraces; + double metalZeff, metalZAeff, foamZeff, foamZAeff, flexZeff, flexZAeff; + for(int i=0;i<vol->GetNdaughters();i++){ + TGeoNode* daughter = vol->GetNode(i); + TGeoMaterial* matDaughter = daughter->GetMedium()->GetMaterial(); + const TGeoShape* shape_sup = daughter->GetVolume()->GetShape(); + TGeoMatrix* matrix = daughter->GetMatrix(); + const double* pos = matrix->GetTranslation(); + const double* rot_data = matrix->GetRotationMatrix(); + TGeoRotation rot; + rot.SetMatrix(rot_data); + double theta,phi,psi; + rot.GetAngles(phi,theta,psi); + phi *= deg_to_rad; + theta *= deg_to_rad; + psi *= deg_to_rad; + phi0 = -CLHEP::halfpi+phi; + std::string phy_name = daughter->GetName(); + if(phy_name.find("FoamSpacer")==-1&&phy_name.find("FlexCable")==-1&&phy_name.find("MetalTraces")==-1){ + //info() << phy_name <<endmsg; + continue; + } + int iLayer = atoi(phy_name.substr(phy_name.find("_")+1,2).c_str()); + if(iLayer!=currentLayer){ + //info() << tFoamSpacer << "," << tFlexCable << "," << tMetalTraces << endmsg; + helpLadders[currentLayer].thickness = tFoamSpacer+tFlexCable+tMetalTraces; + helpLadders[currentLayer].radLength = helpLadders[currentLayer].thickness / (tFoamSpacer/radLFoamSpacer+tFlexCable/radLFlexCable+tMetalTraces/radLMetalTraces); + nFlexCable = 0; + nFoamSpacer=0; + nMetalTraces=0; + currentLayer=iLayer; + } + if(shape_sup->IsA()==TGeoBBox::Class()&&(nFoamSpacer==0||nFlexCable==0||nMetalTraces==0)){ + const TGeoBBox* box = (const TGeoBBox*) shape_sup; + double distance = fabs(cos(phi0)*sin(theta)*pos[0]+sin(phi0)*sin(theta)*pos[1]+cos(theta)*pos[2]); + double offset = sqrt(pos[0]*pos[0]+pos[1]*pos[1]-distance*distance)*pos[0]/fabs(pos[0])*CLHEP::cm; + distance -= box->GetDZ(); + distance *= CLHEP::cm; + if(helpLadders[iLayer].distance == helpSensitives[iLayer].distance) helpLadders[iLayer].distance = distance; + else helpLadders[iLayer].distance = TMath::Min(helpLadders[iLayer].distance, distance); + if(phy_name.find("FoamSpacer")!=-1&&nFoamSpacer==0){ + helpLadders[iLayer].offset = offset; + tFoamSpacer = box->GetDZ()*CLHEP::cm; + radLFoamSpacer = matDaughter->GetRadLen()*CLHEP::cm; + intLFoamSpacer = matDaughter->GetIntLen()*CLHEP::cm; + dFoamSpacer = matDaughter->GetDensity(); + double totalA = 0, Zeff = 0, ZAeff = 0; + for(int iEle = 0; iEle<matDaughter->GetNelements(); iEle++){ + totalA += matDaughter->GetElement(iEle)->A(); + } + for(int iEle = 0; iEle<matDaughter->GetNelements(); iEle++){ + double A, Z, w; + // by fucd: w!=A/totalA, strange! to fix + matDaughter->GetElementProp(A,Z,w,iEle); + Zeff += Z*w; + ZAeff += Z/A*w; + //info() << std::setprecision(16) << Z << " " << A << " " << A/totalA << " " << w << endmsg; + } + foamZeff = Zeff; + foamZAeff = ZAeff; + nFoamSpacer++; + } + if(phy_name.find("FlexCable")!=-1&&nFlexCable==0){ + helpLadders[iLayer].width = box->GetDX()*CLHEP::cm; + helpLadders[iLayer].length = box->GetDY()*CLHEP::cm-beryllium_ladder_block_length*2-end_electronics_half_z*2; + tFlexCable = box->GetDZ()*CLHEP::cm; + radLFlexCable = matDaughter->GetRadLen()*CLHEP::cm; + intLFlexCable = matDaughter->GetIntLen()*CLHEP::cm; + dFlexCable = matDaughter->GetDensity(); + double Zeff = 0, ZAeff = 0; + for(int iEle = 0; iEle<matDaughter->GetNelements(); iEle++){ + double A, Z, w; + matDaughter->GetElementProp(A,Z,w,iEle); + Zeff += Z*w; + ZAeff += Z/A*w; + //std::cout << std::setprecision(16) << Z << " " << A << " " << w << std::endl; + } + flexZeff = Zeff; + flexZAeff = ZAeff; + nFlexCable++; + } + if(phy_name.find("MetalTraces")!=-1&&nMetalTraces==0){ + tMetalTraces = box->GetDZ()*CLHEP::cm; + radLMetalTraces = matDaughter->GetRadLen()*CLHEP::cm; + intLMetalTraces = matDaughter->GetIntLen()*CLHEP::cm; + dMetalTraces = matDaughter->GetDensity(); + double totalA = 0, Zeff = 0, ZAeff = 0; + for(int iEle = 0; iEle<matDaughter->GetNelements(); iEle++){ + totalA += matDaughter->GetElement(iEle)->A(); + } + for(int iEle = 0; iEle<matDaughter->GetNelements(); iEle++){ + double A, Z, w; + matDaughter->GetElementProp(A,Z,w,iEle); + Zeff += Z*w; + ZAeff += Z/A*w; + //info() << Z << " " << A << " " << w << endmsg; + } + metalZeff = Zeff; + metalZAeff = ZAeff; + nMetalTraces++; + } + } + } + { + //info() << tFoamSpacer << "," << tFlexCable << "," << tMetalTraces << endmsg; + double tSupport = tMetalTraces + tFoamSpacer + tFlexCable; + helpLadders[currentLayer].thickness = tSupport; + helpLadders[currentLayer].radLength = helpLadders[currentLayer].thickness / (tFoamSpacer/radLFoamSpacer+tFlexCable/radLFlexCable+tMetalTraces/radLMetalTraces); + nFlexCable = 0; + nFoamSpacer=0; + nMetalTraces=0; + + //calculations of thickness fractions of each layer of the support + double metalTF = tMetalTraces / tSupport; + double foamTF = tFoamSpacer / tSupport; + double flexTF = tFlexCable / tSupport; + //info() << foamTF << "," << flexTF << "," << metalTF << endmsg; + //info() << dFoamSpacer/(CLHEP::kg/CLHEP::cm3) << "," << dFlexCable/(CLHEP::kg/CLHEP::cm3) << "," << dMetalTraces/(CLHEP::kg/CLHEP::cm3) << endmsg; + //info() << foamZeff << " " << flexZeff << " " << metalZeff << endmsg; + //info() << foamZAeff << " " << flexZAeff << " " << metalZAeff << endmsg; + double elemVol = 1*CLHEP::cm3; + double VXDSupportMass = (foamTF*dFoamSpacer + flexTF*dFlexCable + metalTF*dMetalTraces)*elemVol; + VXDSupportDensity = VXDSupportMass/elemVol; + double foamFM = 100. * ((foamTF*(elemVol)*dFoamSpacer) / VXDSupportMass) ; + double kaptonFM = 100. * ((flexTF*(elemVol)*dFlexCable) / VXDSupportMass) ; + double metalFM = 100. * ((metalTF*(elemVol)*dMetalTraces) / VXDSupportMass) ; + + VXDSupportRadLen = helpLadders[currentLayer].radLength; + + VXDSupportZeff = (metalFM/100.)*metalZeff + (kaptonFM/100.)*flexZeff + (foamFM/100.)*foamZeff; + double VXDSupportZAeff = (metalFM/100.)*metalZAeff + (kaptonFM/100.)*flexZAeff + (foamFM/100.)*foamZAeff; + VXDSupportAeff = VXDSupportZeff / VXDSupportZAeff; + double VXDSupportIntLength = 1. / ((metalTF/intLMetalTraces) + (flexTF/intLFlexCable) + (foamTF/intLFoamSpacer)); + VXDSupportDensity = VXDSupportDensity*(CLHEP::g/CLHEP::cm3)/(CLHEP::kg/CLHEP::m3); + //info() << "fucd: " << VXDSupportZeff << " " << VXDSupportAeff << " " << VXDSupportRadLen << " " << VXDSupportIntLength << " " << VXDSupportDensity << endmsg; + //info() << intLMetalTraces << " " << intLFlexCable << " " << intLFoamSpacer <<endmsg; + } + } + //info() << it->first << endmsg; + } + if(end_electronics_half_z>0 && side_band_electronics_width==0) type = gear::ZPlanarParametersImpl::CCD ; + if(side_band_electronics_width>0 && end_electronics_half_z==0 ) type = gear::ZPlanarParametersImpl::CMOS ; + if(side_band_electronics_width>0 && end_electronics_half_z>0) type = gear::ZPlanarParametersImpl::HYBRID ; + gear::ZPlanarParametersImpl* vxdParameters = new gear::ZPlanarParametersImpl(type, shellInnerRadius, shellOuterRadius, shellHalfLength, gap, shellRadLength); + // by fucd: debug info, if validated enough, merge them in future + info() << "=====================from convertor==============================" << endmsg; + info() << type << " " << shellInnerRadius << " " << shellOuterRadius << " " << shellHalfLength << " " << gap << " " << shellRadLength << endmsg; + for(int i=0;i<helpCount;i++){ + vxdParameters->addLayer(helpNumberLadders[i] , helpPhi0[i] , + helpLadders[i].distance , helpLadders[i].offset, helpLadders[i].thickness*2 , + helpLadders[i].length , helpLadders[i].width*2 , helpLadders[i].radLength , + helpSensitives[i].distance, helpSensitives[i].offset , helpSensitives[i].thickness*2 , + helpSensitives[i].length , helpSensitives[i].width*2 , helpSensitives[i].radLength ) ; + info() << "fucd " << i << ": " << helpNumberLadders[i] << ", " << helpPhi0[i] << ", " + << helpLadders[i].distance << ", " << helpLadders[i].offset << ", " << helpLadders[i].thickness*2 << ", " << helpLadders[i].length << ", " + << helpLadders[i].width*2 << ", " << helpLadders[i].radLength << ", " << helpSensitives[i].distance << ", " << helpSensitives[i].offset << ", " + << helpSensitives[i].thickness*2 << ", " << helpSensitives[i].length << ", " << helpSensitives[i].width*2 << ", " << helpSensitives[i].radLength << endmsg; + } + m_gearMgr->setVXDParameters(vxdParameters) ; + gear::GearParametersImpl* gearParameters = new gear::GearParametersImpl; + //CryostatAlRadius, CryostatAlThickness, CryostatAlInnerR, CryostatAlZEndCap, CryostatAlHalfZ + gearParameters->setDoubleVal("CryostatAlRadius", rAlu); + gearParameters->setDoubleVal("CryostatAlThickness", drAlu); + gearParameters->setDoubleVal("CryostatAlInnerR", rInner); + gearParameters->setDoubleVal("CryostatAlZEndCap", aluEndcapZ = dzSty+drSty+drAlu/2); + gearParameters->setDoubleVal("CryostatAlHalfZ", dzSty+drSty); + m_gearMgr->setGearParameters("VXDInfra", gearParameters); + //effective A different with what in Mokka, fix them as Mokka's + gear::SimpleMaterialImpl* VXDFoamShellMaterial_old = new gear::SimpleMaterialImpl("VXDFoamShellMaterial_old", 1.043890843e+01, 5.612886646e+00, 2.500000000e+01, 1.751650267e+04, 0); + m_gearMgr->registerSimpleMaterial(VXDFoamShellMaterial_old); + gear::SimpleMaterialImpl* VXDFoamShellMaterial = new gear::SimpleMaterialImpl("VXDFoamShellMaterial", styAeff, styZeff, styDensity*(CLHEP::g/CLHEP::cm3)/(CLHEP::kg/CLHEP::m3), + styRadLen, styIntLen); + m_gearMgr->registerSimpleMaterial(VXDFoamShellMaterial); + gear::SimpleMaterialImpl* VXDSupportMaterial_old = new gear::SimpleMaterialImpl("VXDSupportMaterial_old", 2.075865162e+01, 1.039383117e+01, 2.765900000e+02, 1.014262421e+03, 3.341388059e+03); + m_gearMgr->registerSimpleMaterial(VXDSupportMaterial_old); + gear::SimpleMaterialImpl* VXDSupportMaterial = new gear::SimpleMaterialImpl("VXDSupportMaterial", VXDSupportAeff, VXDSupportZeff, VXDSupportDensity, VXDSupportRadLen, VXDSupportIntLen); + m_gearMgr->registerSimpleMaterial(VXDSupportMaterial); + info() << "=====================from ZPlanarData==============================" << endmsg; + if(vxdData){ + info() << vxdData->rInnerShell << " " << vxdData->rOuterShell << " " << vxdData->zHalfShell << " " << vxdData->gapShell << endmsg; + const std::vector<dd4hep::rec::ZPlanarData::LayerLayout>& layers = vxdData->layers; + for(int i=0;i<layers.size();i++){ + const dd4hep::rec::ZPlanarData::LayerLayout& thisLayer = layers[i]; + info() << i << ": " << thisLayer.ladderNumber << "," << thisLayer.phi0 << "," << thisLayer.distanceSupport << "," << thisLayer.offsetSupport << "," + << thisLayer.thicknessSupport << "," << thisLayer.zHalfSupport << "," << thisLayer.widthSupport << "," << "NULL," + << thisLayer.distanceSensitive << "," << thisLayer.offsetSensitive << "," << thisLayer.thicknessSensitive << "," << thisLayer.zHalfSensitive << "," + << thisLayer.widthSensitive << ",NULL" << endmsg; + } + } + info() << rAlu << " " << drAlu << " " << rInner << " " << aluEndcapZ << " " << aluHalfZ << endmsg; + //info() << m_materials["VXDSupportMaterial"] << endmsg; + return sc; +} + +StatusCode GearSvc::convertFTD(dd4hep::DetElement& ftd){ + dd4hep::rec::ZDiskPetalsData* ftdData = nullptr; + try{ + ftdData = ftd.extension<dd4hep::rec::ZDiskPetalsData>(); + } + catch(std::runtime_error& e){ + warning() << e.what() << " " << ftdData << endmsg; + return StatusCode::FAILURE; + } + + std::vector<dd4hep::rec::ZDiskPetalsData::LayerLayout>& ftdlayers = ftdData->layers; + int nLayers = ftdlayers.size(); + + gear::FTDParametersImpl* ftdParam = new gear::FTDParametersImpl(); + ftdParam->setDoubleVal("strip_width_mm", ftdData->widthStrip*CLHEP::cm); + ftdParam->setDoubleVal("strip_length_mm", ftdData->lengthStrip*CLHEP::cm); + ftdParam->setDoubleVal("strip_pitch_mm", ftdData->pitchStrip*CLHEP::cm); + ftdParam->setDoubleVal("strip_angle_deg", ftdData->angleStrip*rad_to_deg); + for(int layer = 0; layer < nLayers; layer++){ + dd4hep::rec::ZDiskPetalsData::LayerLayout& ftdlayer = ftdlayers[layer]; + int nPetals = ftdlayer.petalNumber; + double dphi = CLHEP::twopi/nPetals; + double phi0 = ftdlayer.phi0; + double alpha = ftdlayer.alphaPetal; + double zposition = ftdlayer.zPosition*CLHEP::cm; + double zoffset = ftdlayer.zOffsetSupport*CLHEP::cm; + int signoffset = ftdlayer.zOffsetSupport>0?1:-1; + zoffset *= signoffset; + + double supRinner = ftdlayer.distanceSupport*CLHEP::cm; + double supThickness = ftdlayer.thicknessSupport*CLHEP::cm; + double supLengthMin = ftdlayer.widthInnerSupport*CLHEP::cm; + double supLengthMax = ftdlayer.widthOuterSupport*CLHEP::cm; + double supWidth = ftdlayer.lengthSupport*CLHEP::cm; + double senRinner = ftdlayer.distanceSensitive*CLHEP::cm; + double senThickness = ftdlayer.thicknessSensitive*CLHEP::cm; + double senLengthMin = ftdlayer.widthInnerSensitive*CLHEP::cm; + double senLengthMax = ftdlayer.widthOuterSensitive*CLHEP::cm; + double senWidth = ftdlayer.lengthSensitive*CLHEP::cm; + + bool isDoubleSided = ftdlayer.typeFlags[dd4hep::rec::ZDiskPetalsData::SensorType::DoubleSided]; + bool isPixelReadout = (bool)ftdlayer.typeFlags[dd4hep::rec::ZDiskPetalsData::SensorType::Pixel]; + int sensorType = (isPixelReadout)?gear::FTDParameters::PIXEL:gear::FTDParameters::STRIP; + int nSensors = ftdlayer.sensorsPerPetal; + double phalfangle = ftdlayer.petalHalfAngle; + + ftdParam->addLayer(nPetals, nSensors, isDoubleSided, sensorType, phalfangle, phi0, alpha, zposition, zoffset, signoffset, + supRinner, supThickness, supLengthMin, supLengthMax, supWidth, 0, + senRinner, senThickness, senLengthMin, senLengthMax, senWidth, 0); + } + m_gearMgr->setFTDParameters(ftdParam); + + return StatusCode::SUCCESS; +} + +StatusCode GearSvc::convertSIT(dd4hep::DetElement& sit){ + dd4hep::rec::ZPlanarData* sitData = nullptr; + try{ + sitData = sit.extension<dd4hep::rec::ZPlanarData>(); + } + catch(std::runtime_error& e){ + warning() << e.what() << " " << sitData << endmsg; + return StatusCode::FAILURE; + } + + std::vector<dd4hep::rec::ZPlanarData::LayerLayout>& sitlayers = sitData->layers; + int nLayers = sitlayers.size(); + double strip_angle_deg = sitData->angleStrip*rad_to_deg; + + gear::ZPlanarParametersImpl* sitParams = new gear::ZPlanarParametersImpl(1, 0.0, 0.0, 0.0, 0.0, 0.0); + sitParams->setDoubleVal("strip_width_mm", sitData->widthStrip*CLHEP::cm); + sitParams->setDoubleVal("strip_length_mm", sitData->lengthStrip*CLHEP::cm); + sitParams->setDoubleVal("strip_pitch_mm", sitData->pitchStrip*CLHEP::cm); + sitParams->setDoubleVal("strip_angle_deg", strip_angle_deg); + std::vector<int> n_sensors_per_ladder; + for( int layer=0; layer < nLayers; layer++){ + dd4hep::rec::ZPlanarData::LayerLayout& layout = sitlayers[layer]; + + int nLadders = layout.ladderNumber; + double phi0 = layout.phi0; + double supRMin = layout.distanceSupport*CLHEP::cm; + double supOffset = layout.offsetSupport*CLHEP::cm; + double supThickness = layout.thicknessSupport*CLHEP::cm; + double supHalfLength = layout.zHalfSupport*CLHEP::cm; + double supWidth = layout.widthSupport*CLHEP::cm; + double senRMin = layout.distanceSensitive*CLHEP::cm; + double senOffset = layout.offsetSensitive*CLHEP::cm; + double senThickness = layout.thicknessSensitive*CLHEP::cm; + double senHalfLength = layout.zHalfSensitive*CLHEP::cm; + double senWidth = layout.widthSensitive*CLHEP::cm; + int nSensorsPerLadder = layout.sensorsPerLadder; + double stripAngle = strip_angle_deg*CLHEP::degree; + n_sensors_per_ladder.push_back(nSensorsPerLadder); + sitParams->addLayer(nLadders, phi0, supRMin, supOffset, supThickness, supHalfLength, supWidth, 0, senRMin, senOffset, senThickness, senHalfLength, senWidth, 0); + } + sitParams->setIntVals("n_sensors_per_ladder",n_sensors_per_ladder); + m_gearMgr->setSITParameters( sitParams ) ; + + return StatusCode::SUCCESS; +} + +StatusCode GearSvc::convertTPC(dd4hep::DetElement& tpc){ + dd4hep::rec::FixedPadSizeTPCData* tpcData = nullptr; + try{ + tpcData = tpc.extension<dd4hep::rec::FixedPadSizeTPCData>(); + } + catch(std::runtime_error& e){ + warning() << e.what() << " " << tpcData << endmsg; + return StatusCode::FAILURE; + } + + gear::TPCParametersImpl *tpcParameters = new gear::TPCParametersImpl(); + gear::PadRowLayout2D *padLayout = new gear::FixedPadSizeDiskLayout(tpcData->rMinReadout*CLHEP::cm, tpcData->rMaxReadout*CLHEP::cm, + tpcData->padHeight*CLHEP::cm, tpcData->padWidth*CLHEP::cm, tpcData->maxRow, 0.0); + tpcParameters->setPadLayout(padLayout); + tpcParameters->setMaxDriftLength(tpcData->driftLength*CLHEP::cm); + tpcParameters->setDriftVelocity( 0.0); // SJA: not set in Mokka so set to 0.0 + tpcParameters->setReadoutFrequency( 0.0); + tpcParameters->setDoubleVal( "tpcOuterRadius" , tpcData->rMax*CLHEP::cm ) ; + tpcParameters->setDoubleVal( "tpcInnerRadius", tpcData->rMin*CLHEP::cm ) ; + tpcParameters->setDoubleVal( "tpcInnerWallThickness", tpcData->innerWallThickness*CLHEP::cm ) ; + tpcParameters->setDoubleVal( "tpcOuterWallThickness", tpcData->outerWallThickness*CLHEP::cm ) ; + + m_gearMgr->setTPCParameters(tpcParameters); + + return StatusCode::SUCCESS; +} + +StatusCode GearSvc::convertSET(dd4hep::DetElement& set){ + dd4hep::rec::ZPlanarData* setData = nullptr; + try{ + setData = set.extension<dd4hep::rec::ZPlanarData>(); + } + catch(std::runtime_error& e){ + warning() << e.what() << " " << setData << endmsg; + return StatusCode::FAILURE; + } + + std::vector<dd4hep::rec::ZPlanarData::LayerLayout>& setlayers = setData->layers; + int nLayers = setlayers.size(); + double strip_angle_deg = setData->angleStrip*rad_to_deg; + + gear::ZPlanarParametersImpl* setParams = new gear::ZPlanarParametersImpl(1, 0.0 , 0.0 , 0.0 , 0.0 , 0.0); + setParams->setDoubleVal("strip_width_mm", setData->widthStrip*CLHEP::cm); + setParams->setDoubleVal("strip_length_mm", setData->lengthStrip*CLHEP::cm); + setParams->setDoubleVal("strip_pitch_mm", setData->pitchStrip*CLHEP::cm); + setParams->setDoubleVal("strip_angle_deg", strip_angle_deg); + std::vector<int> n_sensors_per_ladder; + for( int layer=0; layer < nLayers; layer++){ + dd4hep::rec::ZPlanarData::LayerLayout& layout = setlayers[layer]; + + int nLadders = layout.ladderNumber; + double phi0 = layout.phi0; + double supRMin = layout.distanceSupport*CLHEP::cm; + double supOffset = layout.offsetSupport*CLHEP::cm; + double supThickness = layout.thicknessSupport*CLHEP::cm; + double supHalfLength = layout.zHalfSupport*CLHEP::cm; + double supWidth = layout.widthSupport*CLHEP::cm; + double senRMin = layout.distanceSensitive*CLHEP::cm; + double senOffset = layout.offsetSensitive*CLHEP::cm; + double senThickness = layout.thicknessSensitive*CLHEP::cm; + double senHalfLength = layout.zHalfSensitive*CLHEP::cm; + double senWidth = layout.widthSensitive*CLHEP::cm; + int nSensorsPerLadder = layout.sensorsPerLadder; + double stripAngle = strip_angle_deg*CLHEP::degree; + n_sensors_per_ladder.push_back(nSensorsPerLadder); + setParams->addLayer(nLadders, phi0, supRMin, supOffset, supThickness, supHalfLength, supWidth, 0, senRMin, senOffset, senThickness, senHalfLength, senWidth, 0); + } + setParams->setIntVals("n_sensors_per_ladder",n_sensors_per_ladder); + m_gearMgr->setSETParameters( setParams ) ; + + return StatusCode::SUCCESS; +} + +TGeoNode* GearSvc::FindNode(TGeoNode* mother, char* name){ + TGeoNode* next = 0; + if(mother->GetNdaughters()!=0){ + for(int i=0;i<mother->GetNdaughters();i++){ + TGeoNode* daughter = mother->GetDaughter(i); + std::string s = daughter->GetName(); + //info() << "current: " << s << " search for" << name << endmsg; + if(s.find(name)!=-1){ + next = daughter; + break; + } + else{ + next = FindNode(daughter, name); + } + } + } + return next; +} diff --git a/Service/GearSvc/src/GearSvc.h b/Service/GearSvc/src/GearSvc.h index 00a8045834baba425c732aab2bf754313d01f663..fcd5bcc8a63bb6710221f31a4dacf0bfe26e17f5 100644 --- a/Service/GearSvc/src/GearSvc.h +++ b/Service/GearSvc/src/GearSvc.h @@ -3,6 +3,9 @@ #include "GearSvc/IGearSvc.h" #include <GaudiKernel/Service.h> +#include "DD4hep/Detector.h" +class dd4hep::DetElement; +class TGeoNode; class GearSvc : public extends<Service, IGearSvc> { @@ -16,6 +19,13 @@ class GearSvc : public extends<Service, IGearSvc> StatusCode finalize() override; private: + StatusCode convertBeamPipe(dd4hep::DetElement& pipe); + StatusCode convertVXD(dd4hep::DetElement& vxd); + StatusCode convertSIT(dd4hep::DetElement& sit); + StatusCode convertTPC(dd4hep::DetElement& tpc); + StatusCode convertSET(dd4hep::DetElement& set); + StatusCode convertFTD(dd4hep::DetElement& ftd); + TGeoNode* FindNode(TGeoNode* mother, char* name); Gaudi::Property<std::string> m_gearFile{this, "GearXMLFile", ""}; diff --git a/Service/TrackSystemSvc/CMakeLists.txt b/Service/TrackSystemSvc/CMakeLists.txt index d12bfb8758945e3b5b43083f23de9245b6af2afe..67710976b6990942ab95d781ccf8fbf9ad1ca90a 100644 --- a/Service/TrackSystemSvc/CMakeLists.txt +++ b/Service/TrackSystemSvc/CMakeLists.txt @@ -1,34 +1,37 @@ -gaudi_subdir(TrackSystemSvc v0r0) +# gaudi_subdir(TrackSystemSvc v0r0) -find_package(CLHEP REQUIRED;CONFIG) -find_package(ROOT 6.14 REQUIRED COMPONENTS Matrix Physics) -find_package(GEAR REQUIRED) -find_package(LCIO REQUIRED) -find_package(EDM4HEP REQUIRED) -#find_package(KalTest REQUIRED) -#find_package(KalDet REQUIRED) -find_package(DD4hep COMPONENTS DDCore DDRec REQUIRED) +gaudi_add_library(TrackSystemSvcLib + SOURCES src/HelixFit.cc + src/HelixTrack.cc + src/IMarlinTrack.cc + src/IMarlinTrkSystem.cc + src/LCIOTrackPropagators.cc + src/MarlinKalTest.cc + src/MarlinKalTestTrack.cc + src/MarlinTrkUtils.cc -gaudi_depends_on_subdirs(Service/GearSvc Detector/DetInterface Utilities/DataHelper Utilities/KalTest Utilities/KalDet) - -set(TrackSystemSvc_srcs src/*.cpp) -set(TrackSystemSvcLib_srcs src/*.cc) - -gaudi_install_headers(TrackSystemSvc) - -#message( "${INCLUDE_DIRS}" ) -#message( "${LINK_LIBRARIES}" ) - -gaudi_add_library(TrackSystemSvcLib ${TrackSystemSvcLib_srcs} - PUBLIC_HEADERS TrackSystemSvc - INCLUDE_DIRS GaudiKernel ROOT ${CLHEP_INCLUDE_DIR} gear ${LCIO_INCLUDE_DIRS} ${EDM4HEP_INCLUDE_DIRS} - LINK_LIBRARIES DataHelperLib KalTestLib KalDetLib GaudiKernel ROOT ${CLHEP_LIBRARIES} ${GEAR_LIBRARIES} ${LCIO_LIBRARIES} - -Wl,--no-as-needed - EDM4HEP::edm4hep EDM4HEP::edm4hepDict - -Wl,--as-needed + LINK DataHelperLib + KalTestLib + KalDetLib + GearSvc + Gaudi::GaudiKernel + ${ROOT_LIBRARIES} + ${CLHEP_LIBRARIES} + ${GEAR_LIBRARIES} + ${LCIO_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict ) -gaudi_add_module(TrackSystemSvc ${TrackSystemSvc_srcs} - INCLUDE_DIRS GaudiKernel gear - LINK_LIBRARIES TrackSystemSvcLib GaudiKernel ${GEAR_LIBRARIES} +gaudi_add_module(TrackSystemSvc + SOURCES src/TrackSystemSvc.cpp + LINK TrackSystemSvcLib + Gaudi::GaudiKernel + ${GEAR_LIBRARIES} ) + +install(TARGETS TrackSystemSvcLib TrackSystemSvc + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) + diff --git a/Service/TrackSystemSvc/TrackSystemSvc/ConfigFlags.h b/Service/TrackSystemSvc/include/TrackSystemSvc/ConfigFlags.h similarity index 100% rename from Service/TrackSystemSvc/TrackSystemSvc/ConfigFlags.h rename to Service/TrackSystemSvc/include/TrackSystemSvc/ConfigFlags.h diff --git a/Service/TrackSystemSvc/TrackSystemSvc/HelixFit.h b/Service/TrackSystemSvc/include/TrackSystemSvc/HelixFit.h similarity index 100% rename from Service/TrackSystemSvc/TrackSystemSvc/HelixFit.h rename to Service/TrackSystemSvc/include/TrackSystemSvc/HelixFit.h diff --git a/Service/TrackSystemSvc/TrackSystemSvc/HelixTrack.h b/Service/TrackSystemSvc/include/TrackSystemSvc/HelixTrack.h similarity index 100% rename from Service/TrackSystemSvc/TrackSystemSvc/HelixTrack.h rename to Service/TrackSystemSvc/include/TrackSystemSvc/HelixTrack.h diff --git a/Service/TrackSystemSvc/TrackSystemSvc/IMarlinTrack.h b/Service/TrackSystemSvc/include/TrackSystemSvc/IMarlinTrack.h similarity index 100% rename from Service/TrackSystemSvc/TrackSystemSvc/IMarlinTrack.h rename to Service/TrackSystemSvc/include/TrackSystemSvc/IMarlinTrack.h diff --git a/Service/TrackSystemSvc/TrackSystemSvc/IMarlinTrkSystem.h b/Service/TrackSystemSvc/include/TrackSystemSvc/IMarlinTrkSystem.h similarity index 100% rename from Service/TrackSystemSvc/TrackSystemSvc/IMarlinTrkSystem.h rename to Service/TrackSystemSvc/include/TrackSystemSvc/IMarlinTrkSystem.h diff --git a/Service/TrackSystemSvc/TrackSystemSvc/ITrackSystemSvc.h b/Service/TrackSystemSvc/include/TrackSystemSvc/ITrackSystemSvc.h similarity index 100% rename from Service/TrackSystemSvc/TrackSystemSvc/ITrackSystemSvc.h rename to Service/TrackSystemSvc/include/TrackSystemSvc/ITrackSystemSvc.h diff --git a/Service/TrackSystemSvc/TrackSystemSvc/LCIOTrackPropagators.h b/Service/TrackSystemSvc/include/TrackSystemSvc/LCIOTrackPropagators.h similarity index 100% rename from Service/TrackSystemSvc/TrackSystemSvc/LCIOTrackPropagators.h rename to Service/TrackSystemSvc/include/TrackSystemSvc/LCIOTrackPropagators.h diff --git a/Service/TrackSystemSvc/TrackSystemSvc/MarlinTrkUtils.h b/Service/TrackSystemSvc/include/TrackSystemSvc/MarlinTrkUtils.h similarity index 100% rename from Service/TrackSystemSvc/TrackSystemSvc/MarlinTrkUtils.h rename to Service/TrackSystemSvc/include/TrackSystemSvc/MarlinTrkUtils.h diff --git a/Service/TrackSystemSvc/src/MarlinKalTest.cc b/Service/TrackSystemSvc/src/MarlinKalTest.cc index 90dcd47c8cb43e0c6ee332c1827050e5529bbaa6..eb35f7428ca2066055f09ab119295bbd1a1b17a6 100644 --- a/Service/TrackSystemSvc/src/MarlinKalTest.cc +++ b/Service/TrackSystemSvc/src/MarlinKalTest.cc @@ -70,8 +70,8 @@ namespace MarlinTrk{ void MarlinKalTest::init() { - //streamlog_out( DEBUG4 ) << " MarlinKalTest - call this init " << std::endl ; - + std::cout << "debug: MarlinKalTest - call this init " << std::endl ; + //ILDSITKalDetector* sitdet = new ILDSITKalDetector( *_gearMgr, _geoSvc ) ; MeasurementSurfaceStore& surfstore = _gearMgr->getMeasurementSurfaceStore(); @@ -84,11 +84,9 @@ namespace MarlinTrk{ } else { - - //streamlog_out( DEBUG4 ) << " MarlinKalTest - MeasurementSurfaceStore is already full. Using store as filled by MeasurementSurfaceStoreFiller " << surfstore.getFillerName() << std::endl ; - + std::cout << "debug: MarlinKalTest - MeasurementSurfaceStore is already full. Using store as filled by MeasurementSurfaceStoreFiller " << surfstore.getFillerName() << std::endl ; } - + if (_gearMgr -> getDetectorName() == "LPTPC") { try{ kaldet::LCTPCKalDetector* tpcdet = new kaldet::LCTPCKalDetector( *_gearMgr ) ; @@ -125,7 +123,6 @@ namespace MarlinTrk{ std::cout << "Warning: " << " MarlinKalTest - VXD missing in gear file: VXD Material Not Built " << std::endl ; } - bool SIT_found = false ; try{ ILDSITKalDetector* sitdet = new ILDSITKalDetector( *_gearMgr, _geoSvc ) ; @@ -160,7 +157,6 @@ namespace MarlinTrk{ std::cout << "Warning: " << " MarlinKalTest - SET missing in gear file: SET Not Built " << std::endl ; } - bool FTD_found = false ; try{ ILDFTDKalDetector* ftddet = new ILDFTDKalDetector( *_gearMgr, _geoSvc ) ; @@ -184,7 +180,7 @@ namespace MarlinTrk{ std::cout << "Warning: " << " MarlinKalTest - Simple Disc Based FTD missing in gear file: Simple Disc Based FTD Not Built " << std::endl ; } } - + try{ ILDTPCKalDetector* tpcdet = new ILDTPCKalDetector( *_gearMgr, _geoSvc ) ; // store the measurement layer id's for the active layers @@ -194,6 +190,7 @@ namespace MarlinTrk{ catch( gear::UnknownParameterException& e){ std::cout << "Warning: " << " MarlinKalTest - TPC missing in gear file: TPC Not Built " << std::endl ; } + } _det->Close() ; // close the cradle diff --git a/Service/TrackSystemSvc/src/MarlinKalTest.h b/Service/TrackSystemSvc/src/MarlinKalTest.h index df37d747418d538449feace37006cfeb902d6b8d..8c07d22d99c25a8d943150bbc6d8be29e18ee499 100644 --- a/Service/TrackSystemSvc/src/MarlinKalTest.h +++ b/Service/TrackSystemSvc/src/MarlinKalTest.h @@ -48,7 +48,7 @@ namespace MarlinTrk{ /** Default c'tor, initializes the geometry from GEAR. */ - MarlinKalTest( const gear::GearMgr& gearMgr, IGeomSvc* geoSvc) ; + MarlinKalTest( const gear::GearMgr& gearMgr, IGeomSvc* geoSvc = 0) ; /** d'tor */ ~MarlinKalTest() ; diff --git a/Service/TrackSystemSvc/src/TrackSystemSvc.cpp b/Service/TrackSystemSvc/src/TrackSystemSvc.cpp index 238c12b8a34e758fe31cccd681be2f91939c76fc..31d5a5b7757e94d38036317d3c44422d763ee5b5 100644 --- a/Service/TrackSystemSvc/src/TrackSystemSvc.cpp +++ b/Service/TrackSystemSvc/src/TrackSystemSvc.cpp @@ -35,7 +35,8 @@ MarlinTrk::IMarlinTrkSystem* TrackSystemSvc::getTrackSystem(void* address){ return 0; } debug() << "GearMgr=" << mgr << " GeomSvc=" << _geoSvc << endmsg; - MarlinTrk::IMarlinTrkSystem* sys = new MarlinTrk::MarlinKalTest( *mgr, _geoSvc ); + //MarlinTrk::IMarlinTrkSystem* sys = new MarlinTrk::MarlinKalTest( *mgr, _geoSvc ); + MarlinTrk::IMarlinTrkSystem* sys = new MarlinTrk::MarlinKalTest(*mgr); m_trackSystems[address] = sys; debug() << "Track system created successfully for " << address << endmsg; return sys; diff --git a/Simulation/CMakeLists.txt b/Simulation/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..3ce6540c7301bfc59af6ade09e7cc41de7802f23 --- /dev/null +++ b/Simulation/CMakeLists.txt @@ -0,0 +1,8 @@ + +add_subdirectory(DetSimAna) +add_subdirectory(DetSimCore) +add_subdirectory(DetSimDedx) +add_subdirectory(DetSimFastModel) +add_subdirectory(DetSimGeom) +add_subdirectory(DetSimInterface) +add_subdirectory(DetSimSD) diff --git a/Simulation/DetSimAna/CMakeLists.txt b/Simulation/DetSimAna/CMakeLists.txt index e0c9aca523f0e6f33ffc9b33c40a2d7aca33c971..794bcc2faab238a6196d8c8b949b98316b4add9a 100644 --- a/Simulation/DetSimAna/CMakeLists.txt +++ b/Simulation/DetSimAna/CMakeLists.txt @@ -1,44 +1,17 @@ -gaudi_subdir(DetSimAna v0r0) - -gaudi_depends_on_subdirs( - FWCore - Simulation/DetSimInterface -) - find_package(Geant4 REQUIRED ui_all vis_all) include(${Geant4_USE_FILE}) -find_package(DD4hep COMPONENTS DDG4 REQUIRED) -# For EDM & I/O -find_package(podio REQUIRED) -find_package(EDM4HEP REQUIRED) -# find_package(LCIO REQUIRED) - -set(DetSimAna_srcs -# src/ExampleAnaElemTool.cpp - src/Edm4hepWriterAnaElemTool.cpp +gaudi_add_module(DetSimAna + SOURCES src/Edm4hepWriterAnaElemTool.cpp + LINK DetSimInterface + ${DD4hep_COMPONENT_LIBRARIES} + Gaudi::GaudiKernel + EDM4HEP::edm4hep EDM4HEP::edm4hepDict ) -message("podio_LIBRARIES: ${podio_LIBRARIES}") -gaudi_add_module(DetSimAna ${DetSimAna_srcs} - INCLUDE_DIRS - # DetSimInterface - # FWCore - # DD4hep - # GaudiKernel - # Geant4 - # ${plcio_INCLUDE_DIRS} - # ${podio_INCLUDE_DIRS} - LINK_LIBRARIES - # DetSimInterface - # FWCore - DD4hep - ${DD4hep_COMPONENT_LIBRARIES} - GaudiKernel - # Geant4 - -Wl,--no-as-needed - EDM4HEP::edm4hep EDM4HEP::edm4hepDict - -Wl,--as-needed - # ${podio_LIBRARIES} -) +install(TARGETS DetSimAna + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp index 954664bf21a5897f86285f1380299bf16068df1a..2736ac984c15b53f291dfac472a5e3307f823a60 100644 --- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp +++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.cpp @@ -2,6 +2,9 @@ #include "G4Event.hh" #include "G4THitsCollection.hh" +#include "G4EventManager.hh" +#include "G4TrackingManager.hh" +#include "G4SteppingManager.hh" #include "DD4hep/Detector.h" #include "DD4hep/Plugins.h" @@ -56,6 +59,20 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) { auto ecalendcapringcol = m_EcalEndcapRingCol.createAndPut(); auto ecalendcapringcontribcol = m_EcalEndcapRingContributionCol.createAndPut(); + auto hcalbarrelcol = m_HcalBarrelCol.createAndPut(); + auto hcalbarrelcontribcols = m_HcalBarrelContributionCol.createAndPut(); + auto hcalendcapscol = m_HcalEndcapsCol.createAndPut(); + auto hcalendcapscontribcols = m_HcalEndcapsContributionCol.createAndPut(); + auto hcalendcapringcol = m_HcalEndcapRingCol.createAndPut(); + auto hcalendcapringcontribcol = m_HcalEndcapRingContributionCol.createAndPut(); + + auto coilcols = m_COILCol.createAndPut(); + + auto muonbarrelcol = m_MuonBarrelCol.createAndPut(); + auto muonbarrelcontribcols = m_MuonBarrelContributionCol.createAndPut(); + auto muonendcapscol = m_MuonEndcapsCol.createAndPut(); + auto muonendcapscontribcols = m_MuonEndcapsContributionCol.createAndPut(); + auto driftchamberhitscol = m_DriftChamberHitsCol.createAndPut(); // readout defined in DD4hep @@ -118,6 +135,23 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) { } else if (collect->GetName() == "EcalEndcapRingCollection") { calo_col_ptr = ecalendcapringcol; calo_contrib_col_ptr = ecalendcapringcontribcol; + } else if (collect->GetName() == "HcalBarrelCollection") { + calo_col_ptr = hcalbarrelcol; + calo_contrib_col_ptr = hcalbarrelcontribcols; + } else if (collect->GetName() == "HcalEndcapsCollection") { + calo_col_ptr = hcalendcapscol; + calo_contrib_col_ptr = hcalendcapscontribcols; + } else if (collect->GetName() == "HcalEndcapRingCollection") { + calo_col_ptr = hcalendcapringcol; + calo_contrib_col_ptr = hcalendcapringcontribcol; + } else if (collect->GetName() == "COILCollection") { + tracker_col_ptr = coilcols; + } else if (collect->GetName() == "MuonBarrelCollection") { + calo_col_ptr = muonbarrelcol; + calo_contrib_col_ptr = muonbarrelcontribcols; + } else if (collect->GetName() == "MuonEndcapsCollection") { + calo_col_ptr = muonendcapscol; + calo_contrib_col_ptr = muonendcapscontribcols; } else if (collect->GetName() == "DriftChamberHitsCollection") { tracker_col_ptr = driftchamberhitscol; } else { @@ -193,6 +227,22 @@ Edm4hepWriterAnaElemTool::EndOfEventAction(const G4Event* anEvent) { trk_hit->momentum.z()/CLHEP::GeV}; edm_trk_hit.setMomentum(edm4hep::Vector3f(mom)); + // get the truth or contribution + auto& truth = trk_hit->truth; + int trackID = truth.trackID; + + int pritrkid = m_track2primary[trackID]; + if (pritrkid <= 0) { + error() << "Failed to find the primary track for trackID #" << trackID << endmsg; + pritrkid = 1; + } + + edm_trk_hit.setMCParticle(mcCol->at(pritrkid-1)); + + if (pritrkid != trackID) { + // If the track is a secondary, then the primary track id and current track id is different + edm_trk_hit.setProducedBySecondary(true); + } } dd4hep::sim::Geant4CalorimeterHit* cal_hit = dynamic_cast<dd4hep::sim::Geant4CalorimeterHit*>(h); @@ -272,7 +322,122 @@ Edm4hepWriterAnaElemTool::PreUserTrackingAction(const G4Track* track) { } void -Edm4hepWriterAnaElemTool::PostUserTrackingAction(const G4Track*) { +Edm4hepWriterAnaElemTool::PostUserTrackingAction(const G4Track* track) { + int curtrkid = track->GetTrackID(); // starts from 1 + int curparid = track->GetParentID(); + + if (curparid == 0) { + // select the primary tracks (parentID == 0) + auto mcCol = m_mcParCol.get(); + + if (curtrkid-1>=mcCol->size()) { + error() << "out of range: curtrkid is " << curtrkid + << " while the MCParticle size is " << mcCol->size() << endmsg; + return; + } + auto primary_particle = mcCol->at(curtrkid-1); + + const G4ThreeVector& stop_pos = track->GetPosition(); + edm4hep::Vector3d endpoint(stop_pos.x()/CLHEP::mm, + stop_pos.y()/CLHEP::mm, + stop_pos.z()/CLHEP::mm); + primary_particle.setEndpoint(endpoint); + + const G4ThreeVector& stop_mom = track->GetMomentum(); + + edm4hep::Vector3f mom_endpoint(stop_mom.x()/CLHEP::GeV, + stop_mom.y()/CLHEP::GeV, + stop_mom.z()/CLHEP::GeV); + primary_particle.setMomentumAtEndpoint(mom_endpoint); + + // =================================================================== + // Update the flags of the primary particles + // =================================================================== + + // processes + static G4VProcess* proc_decay = nullptr; + if (!proc_decay) { + G4ProcessManager* pm + = track->GetDefinition()->GetProcessManager(); + G4int nprocesses = pm->GetProcessListLength(); + G4ProcessVector* pv = pm->GetProcessList(); + + for(G4int i=0; i<nprocesses; ++i){ + if((*pv)[i]->GetProcessName()=="Decay"){ + proc_decay = (*pv)[i]; + } + } + + } + + // flags + bool is_decay = false; + + G4TrackingManager* tm = G4EventManager::GetEventManager() + -> GetTrackingManager(); + G4TrackVector* secondaries = tm->GimmeSecondaries(); + if(secondaries) { + + + size_t nSeco = secondaries->size(); + for (size_t i = 0; i < nSeco; ++i) { + G4Track* sectrk = (*secondaries)[i]; + G4ParticleDefinition* secparticle = sectrk->GetDefinition(); + const G4VProcess* creatorProcess = sectrk->GetCreatorProcess(); + + // select the necessary processes + if (creatorProcess==proc_decay) { + info() << "Creator Process is Decay for secondary particle: " + << " idx: " << i + << " trkid: " << sectrk->GetTrackID() // not valid until track + << " particle: " << secparticle->GetParticleName() + << " pdg: " << secparticle->GetPDGEncoding() + << " at position: " << sectrk->GetPosition() // + << " time: " << sectrk->GetGlobalTime() + << " momentum: " << sectrk->GetMomentum() // + << endmsg; + is_decay = true; + + // create secondaries in MC particles + // todo: convert the const collection to non-const + auto mcCol = const_cast<edm4hep::MCParticleCollection*>(m_mcParCol.get()); + edm4hep::MCParticle mcp = mcCol->create(); + mcp.setPDG(secparticle->GetPDGEncoding()); + mcp.setGeneratorStatus(0); // not created by Generator + mcp.setCreatedInSimulation(1); + mcp.setCharge(secparticle->GetPDGCharge()); + mcp.setTime(sectrk->GetGlobalTime()/CLHEP::ns); // todo + mcp.setMass(secparticle->GetPDGMass()); + + const G4ThreeVector& sec_init_pos = sectrk->GetPosition(); + double x=sec_init_pos.x()/CLHEP::mm; + double y=sec_init_pos.y()/CLHEP::mm; + double z=sec_init_pos.z()/CLHEP::mm; + + const G4ThreeVector& sec_init_mom = sectrk->GetMomentum(); + double px=sec_init_mom.x()/CLHEP::GeV; + double py=sec_init_mom.y()/CLHEP::GeV; + double pz=sec_init_mom.z()/CLHEP::GeV; + mcp.setVertex(edm4hep::Vector3d(x,y,z)); // todo + mcp.setEndpoint(edm4hep::Vector3d(x,y,z)); // todo + mcp.setMomentum(edm4hep::Vector3f(px,py,pz)); // todo + mcp.setMomentumAtEndpoint(edm4hep::Vector3f(px,py,pz)); //todo + + mcp.addToParents(primary_particle); + primary_particle.addToDaughters(mcp); + } + } + } + + // now update + if (is_decay) { + primary_particle.setDecayedInTracker(is_decay); + primary_particle.setDecayedInCalorimeter(is_decay); + } + + } else { + // TODO: select other interested tracks + } } diff --git a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h index 746c2a4b34a3395f5ee0d4e14ed3ea59c1eae38f..26a1ba48a1ab00a05fa65a4fa011320d1770d988 100644 --- a/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h +++ b/Simulation/DetSimAna/src/Edm4hepWriterAnaElemTool.h @@ -81,6 +81,39 @@ private: "EcalEndcapRingContributionCollection", Gaudi::DataHandle::Writer, this}; + // Hcal + DataHandle<edm4hep::SimCalorimeterHitCollection> m_HcalBarrelCol{"HcalBarrelCollection", + Gaudi::DataHandle::Writer, this}; + DataHandle<edm4hep::CaloHitContributionCollection> m_HcalBarrelContributionCol{ + "HcalBarrelContributionCollection", + Gaudi::DataHandle::Writer, this}; + DataHandle<edm4hep::SimCalorimeterHitCollection> m_HcalEndcapsCol{"HcalEndcapsCollection", + Gaudi::DataHandle::Writer, this}; + DataHandle<edm4hep::CaloHitContributionCollection> m_HcalEndcapsContributionCol{ + "HcalEndcapsContributionCollection", + Gaudi::DataHandle::Writer, this}; + DataHandle<edm4hep::SimCalorimeterHitCollection> m_HcalEndcapRingCol{"HcalEndcapRingCollection", + Gaudi::DataHandle::Writer, this}; + DataHandle<edm4hep::CaloHitContributionCollection> m_HcalEndcapRingContributionCol{ + "HcalEndcapRingContributionCollection", + Gaudi::DataHandle::Writer, this}; + + // Coil + DataHandle<edm4hep::SimTrackerHitCollection> m_COILCol{"COILCollection", + Gaudi::DataHandle::Writer, this}; + + // Muon + DataHandle<edm4hep::SimCalorimeterHitCollection> m_MuonBarrelCol{"MuonBarrelCollection", + Gaudi::DataHandle::Writer, this}; + DataHandle<edm4hep::CaloHitContributionCollection> m_MuonBarrelContributionCol{ + "MuonBarrelContributionCollection", + Gaudi::DataHandle::Writer, this}; + DataHandle<edm4hep::SimCalorimeterHitCollection> m_MuonEndcapsCol{"MuonEndcapsCollection", + Gaudi::DataHandle::Writer, this}; + DataHandle<edm4hep::CaloHitContributionCollection> m_MuonEndcapsContributionCol{ + "MuonEndcapsContributionCollection", + Gaudi::DataHandle::Writer, this}; + // Drift Chamber // - DriftChamberHitsCollection DataHandle<edm4hep::SimTrackerHitCollection> m_DriftChamberHitsCol{ diff --git a/Simulation/DetSimCore/CMakeLists.txt b/Simulation/DetSimCore/CMakeLists.txt index 49ee4777117113ebc52384e4c2f1c60d6c885cc3..9c225fc7332999dc1bd7ca9088a33d8b6b0e46f9 100644 --- a/Simulation/DetSimCore/CMakeLists.txt +++ b/Simulation/DetSimCore/CMakeLists.txt @@ -1,44 +1,32 @@ -gaudi_subdir(DetSimCore v0r0) - -gaudi_depends_on_subdirs( - k4FWCore - Simulation/DetSimInterface -) - find_package(Geant4 REQUIRED ui_all vis_all) include(${Geant4_USE_FILE}) -find_package(podio REQUIRED) -find_package(EDM4HEP REQUIRED) -find_package(DD4hep COMPONENTS DDG4 REQUIRED) -set(DetSimCore_srcs - src/DetSimAlg.cpp - src/DetSimSvc.cpp - src/DetectorConstruction.cpp - src/PrimaryGeneratorAction.cpp - src/G4PrimaryCnvTool.cpp - src/ActionInitialization.cpp - src/RunAction.cpp - src/EventAction.cpp - src/TrackingAction.cpp - src/SteppingAction.cpp -) message(" Geant4_LIBRARIES: ${Geant4_LIBRARIES}") -gaudi_add_module(DetSimCore ${DetSimCore_srcs} - INCLUDE_DIRS - # DetSimInterface - # GaudiKernel - # Geant4 - # plcio ${plcio_INCLUDE_DIRS} ${podio_INCLUDE_DIRS} - LINK_LIBRARIES - DetSimInterface - GaudiKernel - # Geant4 - # ${Geant4_LIBRARIES} - DD4hep ${DD4hep_COMPONENT_LIBRARIES} - EDM4HEP::edm4hep EDM4HEP::edm4hepDict - # podio +gaudi_add_module(DetSimCore + SOURCES src/DetSimAlg.cpp + src/DetSimSvc.cpp + src/DetectorConstruction.cpp + src/PrimaryGeneratorAction.cpp + src/G4PrimaryCnvTool.cpp + src/ActionInitialization.cpp + src/RunAction.cpp + src/EventAction.cpp + src/TrackingAction.cpp + src/SteppingAction.cpp + LINK DetSimInterface + Gaudi::GaudiKernel + ${Geant4_LIBRARIES} + ${DD4hep_COMPONENT_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict ) + +install(TARGETS DetSimCore + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) + + diff --git a/Simulation/DetSimCore/src/DetSimAlg.cpp b/Simulation/DetSimCore/src/DetSimAlg.cpp index 17385cf701b1a40ce8370d7c86d17ae8c325e668..31583d82135590f33f4ed712740df02505d8199e 100644 --- a/Simulation/DetSimCore/src/DetSimAlg.cpp +++ b/Simulation/DetSimCore/src/DetSimAlg.cpp @@ -10,6 +10,9 @@ #include "DetectorConstruction.h" #include "G4PhysListFactory.hh" +#include "G4EmParameters.hh" +#include "G4StepLimiterPhysics.hh" +#include "G4FastSimulationPhysics.hh" #include "PrimaryGeneratorAction.h" #include "ActionInitialization.h" @@ -42,14 +45,37 @@ DetSimAlg::initialize() { // Detector Construction m_root_detelem = ToolHandle<IDetElemTool>(m_root_det_elem.value()); - runmgr->SetUserInitialization(new DetectorConstruction(m_root_detelem)); + + for (auto fastsimname: m_fast_simnames) { + info() << "Fast Sim Tool: " << fastsimname << endmsg; + m_fast_simtools.push_back(fastsimname); + } + + runmgr->SetUserInitialization(new DetectorConstruction(m_root_detelem, m_fast_simtools)); // Physics List G4VUserPhysicsList *physicsList = nullptr; if (m_physics_lists_name.value() == "CEPC") { } else { G4PhysListFactory *physListFactory = new G4PhysListFactory(); - physicsList = physListFactory->GetReferencePhysList(m_physics_lists_name.value()); + G4VModularPhysicsList* modularPhysicsList = physListFactory->GetReferencePhysList(m_physics_lists_name.value()); + + // PAI model + G4EmParameters::Instance()->AddPAIModel("all","DriftChamberRegion","pai"); + // G4EmParameters::Instance()->AddPAIModel("all","DriftChamberRegion","pai_photon"); + + // register addition physics list + modularPhysicsList->RegisterPhysics(new G4StepLimiterPhysics()); + + // register fastsim physics + G4FastSimulationPhysics* fastsim_physics = new G4FastSimulationPhysics(); + fastsim_physics->BeVerbose(); + fastsim_physics->ActivateFastSimulation("e-"); + fastsim_physics->ActivateFastSimulation("e+"); + fastsim_physics->ActivateFastSimulation("gamma"); + modularPhysicsList->RegisterPhysics(fastsim_physics); + + physicsList = modularPhysicsList; } assert(physicsList); runmgr->SetUserInitialization(physicsList); diff --git a/Simulation/DetSimCore/src/DetSimAlg.h b/Simulation/DetSimCore/src/DetSimAlg.h index 0f66b74ccc89b9dc0d4d65f3bb590914d2ec249a..36646d9e8b449058aa7588cc8bbe89d3acff5342 100644 --- a/Simulation/DetSimCore/src/DetSimAlg.h +++ b/Simulation/DetSimCore/src/DetSimAlg.h @@ -5,13 +5,14 @@ #include <vector> #include <GaudiKernel/Algorithm.h> -#include <GaudiKernel/Property.h> +#include <Gaudi/Property.h> #include <GaudiKernel/ToolHandle.h> #include <DetSimInterface/IDetSimSvc.h> #include <DetSimInterface/IG4PrimaryCnvTool.h> #include <DetSimInterface/IAnaElemTool.h> #include <DetSimInterface/IDetElemTool.h> +#include <DetSimInterface/IFastSimG4Tool.h> class DetSimAlg: public Algorithm { public: @@ -24,6 +25,7 @@ public: private: SmartIF<IDetSimSvc> m_detsimsvc; ToolHandleArray<IAnaElemTool> m_anaelemtools; + ToolHandleArray<IFastSimG4Tool> m_fast_simtools; ToolHandle<IDetElemTool> m_root_detelem; ToolHandle<IG4PrimaryCnvTool> m_prim_cnvtool{"G4PrimaryCnvTool", this}; @@ -36,6 +38,7 @@ private: Gaudi::Property<std::string> m_physics_lists_name{this, "PhysicsList", "QGSP_BERT"}; Gaudi::Property<std::vector<std::string>> m_ana_elems{this, "AnaElems"}; + Gaudi::Property<std::vector<std::string>> m_fast_simnames{this, "FastSimG4Tools"}; Gaudi::Property<std::string> m_root_det_elem{this, "RootDetElem"}; diff --git a/Simulation/DetSimCore/src/DetectorConstruction.cpp b/Simulation/DetSimCore/src/DetectorConstruction.cpp index 1f06435134761a8c0c14f3f9627396e166eaf51b..fb3bbb131afbbfefa6e1bbb5dfa1cc853f37c1c9 100644 --- a/Simulation/DetSimCore/src/DetectorConstruction.cpp +++ b/Simulation/DetSimCore/src/DetectorConstruction.cpp @@ -25,8 +25,9 @@ #include "G4ios.hh" -DetectorConstruction::DetectorConstruction(ToolHandle<IDetElemTool>& root_elem) - : m_root_detelem(root_elem) { +DetectorConstruction::DetectorConstruction(ToolHandle<IDetElemTool>& root_elem, + ToolHandleArray<IFastSimG4Tool>& fast_simtools) + : m_root_detelem(root_elem), m_fast_simtools(fast_simtools) { } @@ -60,6 +61,15 @@ DetectorConstruction::Construct() { false, // no boolean operations 0); // no field specific to volume + // ======================================================================= + // Associate Fast Simulation Model and Regions + // ======================================================================= + for (auto fastsimtool: m_fast_simtools) { + G4cout << "Invoke CreateFastSimulationModel of fastsimtool instance " + << m_fast_simtools << G4endl; + fastsimtool->CreateFastSimulationModel(); + } + return physiWorld; } diff --git a/Simulation/DetSimCore/src/DetectorConstruction.h b/Simulation/DetSimCore/src/DetectorConstruction.h index 3e211205f782d3501addbb0ef055cd6383d0dd15..e8d992a30abc0caafe6afdcb75f457f9a66f80f4 100644 --- a/Simulation/DetSimCore/src/DetectorConstruction.h +++ b/Simulation/DetSimCore/src/DetectorConstruction.h @@ -3,6 +3,7 @@ #include "GaudiKernel/ToolHandle.h" #include "DetSimInterface/IDetElemTool.h" +#include "DetSimInterface/IFastSimG4Tool.h" #include "globals.hh" #include "G4VUserDetectorConstruction.hh" @@ -16,7 +17,8 @@ class DetectorConstruction: public G4VUserDetectorConstruction { public: - DetectorConstruction(ToolHandle<IDetElemTool>& root_elem); + DetectorConstruction(ToolHandle<IDetElemTool>& root_elem, + ToolHandleArray<IFastSimG4Tool>& fast_simtools); ~DetectorConstruction(); public: G4VPhysicalVolume* Construct() override; @@ -24,6 +26,7 @@ public: private: ToolHandle<IDetElemTool>& m_root_detelem; + ToolHandleArray<IFastSimG4Tool>& m_fast_simtools; }; #endif diff --git a/Simulation/DetSimDedx/CMakeLists.txt b/Simulation/DetSimDedx/CMakeLists.txt index 69e83034f8d6224856e93a44fed8e9badc955c7c..fb8e4d3a65429de7514834b96268b8cae7b611fb 100644 --- a/Simulation/DetSimDedx/CMakeLists.txt +++ b/Simulation/DetSimDedx/CMakeLists.txt @@ -1,24 +1,15 @@ -gaudi_subdir(DetSimDedx v0r0) - -gaudi_depends_on_subdirs( - k4FWCore - Simulation/DetSimInterface -) find_package(Geant4 REQUIRED ui_all vis_all) include(${Geant4_USE_FILE}) -find_package(DD4hep COMPONENTS DDG4 REQUIRED) -set(DetSimDedx_srcs - src/DummyDedxSimTool.cpp - src/BetheBlochEquationDedxSimTool.cpp -) +gaudi_add_module(DetSimDedx + SOURCES src/DummyDedxSimTool.cpp + src/BetheBlochEquationDedxSimTool.cpp + src/GFDndxSimTool.cpp -gaudi_add_module(DetSimDedx ${DetSimDedx_srcs} - INCLUDE_DIRS - LINK_LIBRARIES - DD4hep - ${DD4hep_COMPONENT_LIBRARIES} - GaudiKernel + LINK DetSimInterface + ${DD4hep_COMPONENT_LIBRARIES} + Gaudi::GaudiKernel + EDM4HEP::edm4hep EDM4HEP::edm4hepDict ) diff --git a/Simulation/DetSimDedx/src/BetheBlochEquationDedxSimTool.cpp b/Simulation/DetSimDedx/src/BetheBlochEquationDedxSimTool.cpp index f8dab312c8eb867116cb537732976803a47a3575..4c5ff269eaa4f0bc30bbe935f4ebd43b00f32ad8 100644 --- a/Simulation/DetSimDedx/src/BetheBlochEquationDedxSimTool.cpp +++ b/Simulation/DetSimDedx/src/BetheBlochEquationDedxSimTool.cpp @@ -28,8 +28,29 @@ double BetheBlochEquationDedxSimTool::dedx(const G4Step* aStep) float Tmax = 2*m_me*pow(gammabeta,2)/(1+(2*gamma*m_me/M)+pow(m_me/M,2)); float dedx = m_K*pow(z,2)*material_Z*(0.5*log(2*m_me*pow(gammabeta,2)*Tmax/pow(m_I,2))-pow(beta,2))/(material_A*pow(beta,2)); dedx = dedx*CLHEP::RandGauss::shoot(m_scale, m_resolution); - double Dedx = dedx * (CLHEP::MeV/CLHEP::cm) / (CLHEP::g/CLHEP::cm3) ; - return Dedx*material_density; + double Dedx = dedx * (CLHEP::MeV/CLHEP::cm) ; + return Dedx; +} + +double BetheBlochEquationDedxSimTool::dedx(const edm4hep::MCParticle& mcp) { + + int z = mcp.getCharge(); + if (z == 0) return 0; + float m_I = m_material_Z*10; // Approximate + + double M = mcp.getMass(); + double gammabeta=sqrt(mcp.getMomentum()[0]*mcp.getMomentum()[0]+mcp.getMomentum()[1]*mcp.getMomentum()[1]+mcp.getMomentum()[2]*mcp.getMomentum()[2])/M; + if(gammabeta<0.01)return 0;//too low momentum + float beta = gammabeta/sqrt(1.0+pow(gammabeta,2)); + float gamma = gammabeta/beta; + M = M*pow(10,9);//to eV + float Tmax = 2*m_me*pow(gammabeta,2)/(1+(2*gamma*m_me/M)+pow(m_me/M,2)); + float dedx = m_K*pow(z,2)*m_material_Z*(0.5*log(2*m_me*pow(gammabeta,2)*Tmax/pow(m_I,2))-pow(beta,2))/(m_material_A*pow(beta,2)); + dedx = dedx*CLHEP::RandGauss::shoot(m_scale, m_resolution); + return dedx; // (CLHEP::MeV/CLHEP::cm) / (CLHEP::g/CLHEP::cm3) +} +double BetheBlochEquationDedxSimTool::dndx(double betagamma) { + return -1; } StatusCode BetheBlochEquationDedxSimTool::initialize() diff --git a/Simulation/DetSimDedx/src/BetheBlochEquationDedxSimTool.h b/Simulation/DetSimDedx/src/BetheBlochEquationDedxSimTool.h index dfb671e3d9ddb692bcc4ea5eb63f2d5a9f06266d..a4d08870ccfe3634772001d6d4f6136c3c7217f8 100644 --- a/Simulation/DetSimDedx/src/BetheBlochEquationDedxSimTool.h +++ b/Simulation/DetSimDedx/src/BetheBlochEquationDedxSimTool.h @@ -3,6 +3,7 @@ #include "DetSimInterface/IDedxSimTool.h" #include <GaudiKernel/AlgTool.h> +#include "edm4hep/MCParticle.h" class BetheBlochEquationDedxSimTool: public extends<AlgTool, IDedxSimTool> { public: @@ -11,6 +12,8 @@ class BetheBlochEquationDedxSimTool: public extends<AlgTool, IDedxSimTool> { StatusCode initialize() override; StatusCode finalize() override; double dedx(const G4Step* aStep) override; + double dedx(const edm4hep::MCParticle& mc) override; + double dndx(double betagamma) override; private: @@ -18,7 +21,7 @@ class BetheBlochEquationDedxSimTool: public extends<AlgTool, IDedxSimTool> { Gaudi::Property<float> m_material_A{this, "material_A", 4}; Gaudi::Property<float> m_material_density{this, "material_density", 0.000178};//g/cm^3 Gaudi::Property<float> m_scale{this, "scale", 1}; - Gaudi::Property<float> m_resolution{this, "resolution", 0.01}; + Gaudi::Property<float> m_resolution{this, "resolution", 0}; float m_me;// Here me is the electron rest mass float m_K; // K was set as a constant. float m_I; // Mean excitation energy diff --git a/Simulation/DetSimDedx/src/DummyDedxSimTool.cpp b/Simulation/DetSimDedx/src/DummyDedxSimTool.cpp index 291b8c205eafd630a9e45f9be64a99cbd0827c87..a5c3244ce4f292dac27a2249d0d770f94c15040f 100644 --- a/Simulation/DetSimDedx/src/DummyDedxSimTool.cpp +++ b/Simulation/DetSimDedx/src/DummyDedxSimTool.cpp @@ -22,3 +22,9 @@ double DummyDedxSimTool::dedx(const G4Step* aStep) { return result; } +double DummyDedxSimTool::dedx(const edm4hep::MCParticle& mc) { + return -1; +} +double DummyDedxSimTool::dndx(double betagamma) { + return -1; +} diff --git a/Simulation/DetSimDedx/src/DummyDedxSimTool.h b/Simulation/DetSimDedx/src/DummyDedxSimTool.h index ce7f3e3e4a49430a2f9736e03c4538c2cb87878f..58ac1cf63b05518b229b5b3e0fb329767e64d0e7 100644 --- a/Simulation/DetSimDedx/src/DummyDedxSimTool.h +++ b/Simulation/DetSimDedx/src/DummyDedxSimTool.h @@ -3,6 +3,7 @@ #include "GaudiKernel/AlgTool.h" #include "DetSimInterface/IDedxSimTool.h" +#include "edm4hep/MCParticle.h" class DummyDedxSimTool: public extends<AlgTool, IDedxSimTool> { @@ -15,6 +16,8 @@ public: /// Overriding dedx tool double dedx(const G4Step* aStep) override; + double dedx(const edm4hep::MCParticle& mc) override; + double dndx(double betagamma) override; }; diff --git a/Simulation/DetSimDedx/src/GFDndxSimTool.cpp b/Simulation/DetSimDedx/src/GFDndxSimTool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..96592f7fcbe689df63895ecf1b2043baa0a50be7 --- /dev/null +++ b/Simulation/DetSimDedx/src/GFDndxSimTool.cpp @@ -0,0 +1,28 @@ +#include "GFDndxSimTool.h" + +#include "G4Step.hh" + +DECLARE_COMPONENT(GFDndxSimTool); + +StatusCode GFDndxSimTool::initialize() { + StatusCode sc; + + return sc; +} + +StatusCode GFDndxSimTool::finalize() { + StatusCode sc; + + return sc; +} + +double GFDndxSimTool::dedx(const G4Step* aStep) { + double result = aStep->GetTotalEnergyDeposit(); + return result; +} +double GFDndxSimTool::dedx(const edm4hep::MCParticle& mc) { + return -1; +} +double GFDndxSimTool::dndx(double betagamma) { + return -999; +} diff --git a/Simulation/DetSimDedx/src/GFDndxSimTool.h b/Simulation/DetSimDedx/src/GFDndxSimTool.h new file mode 100644 index 0000000000000000000000000000000000000000..3fbc2a8375544a3cdf90563c138f17f455795635 --- /dev/null +++ b/Simulation/DetSimDedx/src/GFDndxSimTool.h @@ -0,0 +1,24 @@ +#ifndef GFDndxSimTool_h +#define GFDndxSimTool_h + +#include "GaudiKernel/AlgTool.h" +#include "DetSimInterface/IDedxSimTool.h" +#include "edm4hep/MCParticle.h" + +class GFDndxSimTool: public extends<AlgTool, IDedxSimTool> { + +public: + using extends::extends; + + /// Overriding initialize and finalize + StatusCode initialize() override; + StatusCode finalize() override; + + /// Overriding dedx tool + double dedx(const G4Step* aStep) override; + double dedx(const edm4hep::MCParticle& mc) override; + double dndx(double betagamma) override; + +}; + +#endif diff --git a/Simulation/DetSimFastModel/CMakeLists.txt b/Simulation/DetSimFastModel/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..50ceb1e33fdd4634f93dffb710a1d020dc58aea4 --- /dev/null +++ b/Simulation/DetSimFastModel/CMakeLists.txt @@ -0,0 +1,13 @@ + +find_package(Geant4 REQUIRED ui_all vis_all) +include(${Geant4_USE_FILE}) + + +gaudi_add_module(DetSimFastModel + SOURCES src/DummyFastSimG4Tool.cpp + src/DummyFastSimG4Model.cpp + LINK DetSimInterface + ${DD4hep_COMPONENT_LIBRARIES} + Gaudi::GaudiKernel +) + diff --git a/Simulation/DetSimFastModel/src/DummyFastSimG4Model.cpp b/Simulation/DetSimFastModel/src/DummyFastSimG4Model.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0e7f7da425a2c8af576b2c69e8a8198ada98c03e --- /dev/null +++ b/Simulation/DetSimFastModel/src/DummyFastSimG4Model.cpp @@ -0,0 +1,37 @@ +#include "DummyFastSimG4Model.h" + +#include "G4Track.hh" +#include "G4FastTrack.hh" + +DummyFastSimG4Model::DummyFastSimG4Model(G4String aModelName, G4Region* aEnvelope) + : G4VFastSimulationModel(aModelName, aEnvelope) { + +} + +DummyFastSimG4Model::~DummyFastSimG4Model() { + +} + +G4bool DummyFastSimG4Model::IsApplicable(const G4ParticleDefinition& aParticle) { + return aParticle.GetPDGCharge() != 0; +} + +G4bool DummyFastSimG4Model::ModelTrigger(const G4FastTrack& aFastTrack) { + // G4cout << __FILE__ << __LINE__ << ": ModelTrigger." << G4endl; + + bool istrigged = false; + + // only select the secondaries + const G4Track* track = aFastTrack.GetPrimaryTrack(); + // secondaries + if (track->GetParentID() != 0) { + istrigged = true; + } + return istrigged; +} + +void DummyFastSimG4Model::DoIt(const G4FastTrack& aFastTrack, G4FastStep& aFastStep) { + // G4cout << __FILE__ << __LINE__ << ": DoIt." << G4endl; + + aFastStep.ProposeTrackStatus(fStopAndKill); +} diff --git a/Simulation/DetSimFastModel/src/DummyFastSimG4Model.h b/Simulation/DetSimFastModel/src/DummyFastSimG4Model.h new file mode 100644 index 0000000000000000000000000000000000000000..fca5093f8574d8529df72b9e74e0bcbcdcc4414a --- /dev/null +++ b/Simulation/DetSimFastModel/src/DummyFastSimG4Model.h @@ -0,0 +1,19 @@ +#ifndef DummyFastSimG4Model_h +#define DummyFastSimG4Model_h + +#include "G4VFastSimulationModel.hh" + +class DummyFastSimG4Model: public G4VFastSimulationModel { +public: + + DummyFastSimG4Model(G4String aModelName, G4Region* aEnvelope); + ~DummyFastSimG4Model(); + + virtual G4bool IsApplicable( const G4ParticleDefinition& aParticle ); + virtual G4bool ModelTrigger( const G4FastTrack& aFastTrack ); + virtual void DoIt( const G4FastTrack& aFastTrack, G4FastStep& aFastStep ); + +}; + +#endif + diff --git a/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.cpp b/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6fa049f8c45e5754d3e833c2fcdaf1322bc0ac50 --- /dev/null +++ b/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.cpp @@ -0,0 +1,41 @@ +#include "DummyFastSimG4Tool.h" + +#include "G4Region.hh" +#include "G4RegionStore.hh" + +#include "G4VFastSimulationModel.hh" +#include "DummyFastSimG4Model.h" + +DECLARE_COMPONENT(DummyFastSimG4Tool); + +StatusCode DummyFastSimG4Tool::initialize() { + StatusCode sc; + + return sc; +} + +StatusCode DummyFastSimG4Tool::finalize() { + StatusCode sc; + + return sc; +} + +bool DummyFastSimG4Tool::CreateFastSimulationModel() { + // In this method: + // * Retrieve the G4Region + // * Create Model + // * Associate model and region + + G4String model_name = "DummyFastSimG4Model"; + for (auto region_name: m_regions.value()) { + G4Region* aEnvelope = G4RegionStore::GetInstance()->GetRegion(region_name); + if (!aEnvelope) { + error() << "Failed to find G4Region '" << region_name << "'" << endmsg; + return false; + } + + DummyFastSimG4Model* model = new DummyFastSimG4Model(model_name+region_name, aEnvelope); + info() << "Create Model " << model_name << " for G4Region " << region_name << endmsg; + } + return true; +} diff --git a/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.h b/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.h new file mode 100644 index 0000000000000000000000000000000000000000..54c09dbeb904fa9015f9b8ffe913fafb14eca3c2 --- /dev/null +++ b/Simulation/DetSimFastModel/src/DummyFastSimG4Tool.h @@ -0,0 +1,21 @@ +#ifndef DummyFastSimG4Tool_h +#define DummyFastSimG4Tool_h + +#include "GaudiKernel/AlgTool.h" +#include "DetSimInterface/IFastSimG4Tool.h" + +class DummyFastSimG4Tool: public extends<AlgTool, IFastSimG4Tool> { +public: + using extends::extends; + + StatusCode initialize() override; + StatusCode finalize() override; + + bool CreateFastSimulationModel() override; + +private: + // the regions will be associated with the fast sim model + Gaudi::Property<std::vector<std::string>> m_regions{this, "Regions"}; +}; + +#endif diff --git a/Simulation/DetSimGeom/CMakeLists.txt b/Simulation/DetSimGeom/CMakeLists.txt index a3b5f3249132d19400359fd728b2dbe676df34a9..aec488006934729263b1872cf49bfea7c9f4538c 100644 --- a/Simulation/DetSimGeom/CMakeLists.txt +++ b/Simulation/DetSimGeom/CMakeLists.txt @@ -1,29 +1,21 @@ -gaudi_subdir(DetSimGeom v0r0) - -gaudi_depends_on_subdirs( - Simulation/DetSimInterface - Detector/DetInterface -) - find_package(Geant4 REQUIRED ui_all vis_all) include(${Geant4_USE_FILE}) -find_package(DD4hep COMPONENTS DDG4 REQUIRED) -set(DetSimGeom_srcs - src/WorldDetElemTool.cpp - src/AnExampleDetElemTool.cpp +gaudi_add_module(DetSimGeom + SOURCES src/WorldDetElemTool.cpp + src/AnExampleDetElemTool.cpp + LINK DetSimInterface + DetInterface + ${DD4hep_COMPONENT_LIBRARIES} + Gaudi::GaudiKernel + ${Geant4_LIBRARIES} ) -gaudi_add_module(DetSimGeom ${DetSimGeom_srcs} - INCLUDE_DIRS - # DetSimInterface - # DetInterface - # DD4hep - # GaudiKernel - # Geant4 - LINK_LIBRARIES - DD4hep ${DD4hep_COMPONENT_LIBRARIES} - GaudiKernel - # Geant4 -) +install(TARGETS DetSimGeom + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) + + diff --git a/Simulation/DetSimGeom/src/AnExampleDetElemTool.h b/Simulation/DetSimGeom/src/AnExampleDetElemTool.h index 908de073479727ff2b035c8b703ad9e4fca38522..1ad3702f910e3c9643670c76e8fb0891b09291ed 100644 --- a/Simulation/DetSimGeom/src/AnExampleDetElemTool.h +++ b/Simulation/DetSimGeom/src/AnExampleDetElemTool.h @@ -2,7 +2,7 @@ #define AnExampleDetElemTool_h #include "GaudiKernel/AlgTool.h" -#include "GaudiKernel/Property.h" +#include <Gaudi/Property.h> #include <GaudiKernel/ToolHandle.h> #include "G4SystemOfUnits.hh" diff --git a/Simulation/DetSimInterface/CMakeLists.txt b/Simulation/DetSimInterface/CMakeLists.txt index 8950d300d14e0df6f5319d26bd209a2a79a28b31..ed99eead6c48943bbe639731e2705a8e70423d31 100644 --- a/Simulation/DetSimInterface/CMakeLists.txt +++ b/Simulation/DetSimInterface/CMakeLists.txt @@ -1,15 +1,15 @@ -gaudi_subdir(DetSimInterface v0r0) - -gaudi_depends_on_subdirs(GaudiKernel) # DetSimInterface (headers only) -set(DetSimInterface_srcs - src/IDetSimSvc.cpp -) -gaudi_add_library(DetSimInterface ${DetSimInterface_srcs} - PUBLIC_HEADERS DetSimInterface - LINK_LIBRARIES GaudiKernel +gaudi_add_library(DetSimInterface + SOURCES src/IDetSimSvc.cpp + LINK Gaudi::GaudiKernel ) +install(TARGETS DetSimInterface + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) + diff --git a/Simulation/DetSimInterface/DetSimInterface/IAnaElemTool.h b/Simulation/DetSimInterface/include/DetSimInterface/IAnaElemTool.h similarity index 100% rename from Simulation/DetSimInterface/DetSimInterface/IAnaElemTool.h rename to Simulation/DetSimInterface/include/DetSimInterface/IAnaElemTool.h diff --git a/Simulation/DetSimInterface/DetSimInterface/IDedxSimTool.h b/Simulation/DetSimInterface/include/DetSimInterface/IDedxSimTool.h similarity index 76% rename from Simulation/DetSimInterface/DetSimInterface/IDedxSimTool.h rename to Simulation/DetSimInterface/include/DetSimInterface/IDedxSimTool.h index f47ceb0211c3a61553adca623e443f25e46c5038..8c804500a7b4322e1998a04a7a8a43f46ba3f499 100644 --- a/Simulation/DetSimInterface/DetSimInterface/IDedxSimTool.h +++ b/Simulation/DetSimInterface/include/DetSimInterface/IDedxSimTool.h @@ -15,6 +15,9 @@ #include "GaudiKernel/IAlgTool.h" class G4Step; +namespace edm4hep{ + class MCParticle; +} class IDedxSimTool: virtual public IAlgTool { public: @@ -23,6 +26,8 @@ public: virtual ~IDedxSimTool() {} virtual double dedx(const G4Step* aStep) = 0; + virtual double dedx(const edm4hep::MCParticle& mc) = 0; + virtual double dndx(double betagamma) = 0; }; diff --git a/Simulation/DetSimInterface/DetSimInterface/IDetElemTool.h b/Simulation/DetSimInterface/include/DetSimInterface/IDetElemTool.h similarity index 100% rename from Simulation/DetSimInterface/DetSimInterface/IDetElemTool.h rename to Simulation/DetSimInterface/include/DetSimInterface/IDetElemTool.h diff --git a/Simulation/DetSimInterface/DetSimInterface/IDetSimSvc.h b/Simulation/DetSimInterface/include/DetSimInterface/IDetSimSvc.h similarity index 100% rename from Simulation/DetSimInterface/DetSimInterface/IDetSimSvc.h rename to Simulation/DetSimInterface/include/DetSimInterface/IDetSimSvc.h diff --git a/Simulation/DetSimInterface/include/DetSimInterface/IFastSimG4Tool.h b/Simulation/DetSimInterface/include/DetSimInterface/IFastSimG4Tool.h new file mode 100644 index 0000000000000000000000000000000000000000..12d9c421f3a06f1fc4b2637e5284c3373cba471a --- /dev/null +++ b/Simulation/DetSimInterface/include/DetSimInterface/IFastSimG4Tool.h @@ -0,0 +1,20 @@ +#ifndef IFastSimG4Tool_h +#define IFastSimG4Tool_h + +// IFastSimG4Tool is to associate the G4Region and Fast simulation model in G4. +// It is recommended to create one fast simulation model in one tool. +// -- Tao Lin <lintao@ihep.ac.cn>, 7 Dec 2020 + +#include "GaudiKernel/IAlgTool.h" + +class IFastSimG4Tool: virtual public IAlgTool { +public: + DeclareInterfaceID(IFastSimG4Tool, 0, 1); + + virtual ~IFastSimG4Tool() {} + + // Build the association between G4Region and G4 Fast simulation model + virtual bool CreateFastSimulationModel() = 0; +}; + +#endif diff --git a/Simulation/DetSimInterface/DetSimInterface/IG4PrimaryCnvTool.h b/Simulation/DetSimInterface/include/DetSimInterface/IG4PrimaryCnvTool.h similarity index 100% rename from Simulation/DetSimInterface/DetSimInterface/IG4PrimaryCnvTool.h rename to Simulation/DetSimInterface/include/DetSimInterface/IG4PrimaryCnvTool.h diff --git a/Simulation/DetSimInterface/DetSimInterface/ISensDetTool.h b/Simulation/DetSimInterface/include/DetSimInterface/ISensDetTool.h similarity index 100% rename from Simulation/DetSimInterface/DetSimInterface/ISensDetTool.h rename to Simulation/DetSimInterface/include/DetSimInterface/ISensDetTool.h diff --git a/Simulation/DetSimSD/CMakeLists.txt b/Simulation/DetSimSD/CMakeLists.txt index 33d00e18e00177f47582ad8ab7679c1debc2d08b..eed28a788b4893b6a771aa965f15759b3f2addfa 100644 --- a/Simulation/DetSimSD/CMakeLists.txt +++ b/Simulation/DetSimSD/CMakeLists.txt @@ -1,41 +1,30 @@ -gaudi_subdir(DetSimSD v0r0) - -gaudi_depends_on_subdirs( - k4FWCore - Detector/DetInterface - Simulation/DetSimInterface -) - find_package(Geant4 REQUIRED ui_all vis_all) include(${Geant4_USE_FILE}) -find_package(DD4hep COMPONENTS DDG4 REQUIRED) -set(DetSimSD_srcs - src/CalorimeterSensDetTool.cpp +gaudi_add_module(DetSimSD + SOURCES src/CalorimeterSensDetTool.cpp + src/DDG4SensitiveDetector.cpp + src/CaloSensitiveDetector.cpp - src/DDG4SensitiveDetector.cpp - src/CaloSensitiveDetector.cpp + src/DriftChamberSensDetTool.cpp + src/DriftChamberSensitiveDetector.cpp - src/DriftChamberSensDetTool.cpp - src/DriftChamberSensitiveDetector.cpp + src/TimeProjectionChamberSensDetTool.cpp + src/TimeProjectionChamberSensitiveDetector.cpp - src/TimeProjectionChamberSensDetTool.cpp - src/TimeProjectionChamberSensitiveDetector.cpp + LINK DetSimInterface + DetInterface + ${DD4hep_COMPONENT_LIBRARIES} + Gaudi::GaudiKernel ) +target_include_directories(DetSimSD PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) + +install(TARGETS DetSimSD + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) -gaudi_add_module(DetSimSD ${DetSimSD_srcs} - INCLUDE_DIRS - # DetSimInterface - # k4FWCore - # DD4hep - # GaudiKernel - # Geant4 - LINK_LIBRARIES - # DetSimInterface - # k4FWCore - DD4hep - ${DD4hep_COMPONENT_LIBRARIES} - GaudiKernel - # Geant4 -) diff --git a/Simulation/DetSimSD/DetSimSD/CaloSensitiveDetector.h b/Simulation/DetSimSD/include/DetSimSD/CaloSensitiveDetector.h similarity index 100% rename from Simulation/DetSimSD/DetSimSD/CaloSensitiveDetector.h rename to Simulation/DetSimSD/include/DetSimSD/CaloSensitiveDetector.h diff --git a/Simulation/DetSimSD/DetSimSD/DDG4SensitiveDetector.h b/Simulation/DetSimSD/include/DetSimSD/DDG4SensitiveDetector.h similarity index 100% rename from Simulation/DetSimSD/DetSimSD/DDG4SensitiveDetector.h rename to Simulation/DetSimSD/include/DetSimSD/DDG4SensitiveDetector.h diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7558d9c2f012f9e95edddcec2811687f25450506 --- /dev/null +++ b/Utilities/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(DataHelper) +add_subdirectory(KalTest) +add_subdirectory(KalDet) +add_subdirectory(KiTrack) + diff --git a/Utilities/DataHelper/CMakeLists.txt b/Utilities/DataHelper/CMakeLists.txt index a93dc10a07a2ab5cd239c4dea1cd1ef23565cecf..0583b24bdabbbe3328ac3c8d357502ba2115fe9c 100644 --- a/Utilities/DataHelper/CMakeLists.txt +++ b/Utilities/DataHelper/CMakeLists.txt @@ -1,19 +1,28 @@ -gaudi_subdir(DataHelper v0r0) -find_package(CLHEP REQUIRED;CONFIG) -find_package(EDM4HEP REQUIRED) -find_package(GSL REQUIRED ) -message("GSL: ${GSL_LIBRARIES} ") -message("GSL INCLUDE_DIRS: ${GSL_INCLUDE_DIRS} ") - -# gaudi_depends_on_subdirs() - -set(DataHelperLib_srcs src/*.cc src/*.cpp) - -#gaudi_install_headers(DataHelper) - -gaudi_add_library(DataHelperLib ${DataHelperLib_srcs} - PUBLIC_HEADERS DataHelper - INCLUDE_DIRS ${CLHEP_INCLUDE_DIR} ${GSL_INCLUDE_DIRS} - LINK_LIBRARIES EDM4HEP::edm4hep EDM4HEP::edm4hepDict ${GSL_LIBRARIES} ${CLHEP_LIBRARIES} +gaudi_add_library(DataHelperLib + SOURCES src/CaloHitExtended.cc + src/Circle.cc + src/ClusterExtended.cc + src/ClusterShapes.cc + src/GroupTracks.cc + src/HelixClass.cc + src/LCCylinder.cc + src/LCLine3D.cc + src/LCPlane3D.cc + src/LineClass.cc + src/Navigation.cpp + src/SimpleHelix.cc + src/TrackerHitExtended.cc + src/TrackExtended.cc + src/TrackHitPair.cc + LINK EDM4HEP::edm4hep + EDM4HEP::edm4hepDict + ${GSL_LIBRARIES} + ${CLHEP_LIBRARIES} ) + +install(TARGETS DataHelperLib + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Utilities/DataHelper/DataHelper/CaloHitExtended.h b/Utilities/DataHelper/include/DataHelper/CaloHitExtended.h similarity index 100% rename from Utilities/DataHelper/DataHelper/CaloHitExtended.h rename to Utilities/DataHelper/include/DataHelper/CaloHitExtended.h diff --git a/Utilities/DataHelper/DataHelper/Circle.h b/Utilities/DataHelper/include/DataHelper/Circle.h similarity index 100% rename from Utilities/DataHelper/DataHelper/Circle.h rename to Utilities/DataHelper/include/DataHelper/Circle.h diff --git a/Utilities/DataHelper/DataHelper/ClusterExtended.h b/Utilities/DataHelper/include/DataHelper/ClusterExtended.h similarity index 100% rename from Utilities/DataHelper/DataHelper/ClusterExtended.h rename to Utilities/DataHelper/include/DataHelper/ClusterExtended.h diff --git a/Utilities/DataHelper/DataHelper/ClusterShapes.h b/Utilities/DataHelper/include/DataHelper/ClusterShapes.h similarity index 100% rename from Utilities/DataHelper/DataHelper/ClusterShapes.h rename to Utilities/DataHelper/include/DataHelper/ClusterShapes.h diff --git a/Utilities/DataHelper/DataHelper/GroupTracks.h b/Utilities/DataHelper/include/DataHelper/GroupTracks.h similarity index 100% rename from Utilities/DataHelper/DataHelper/GroupTracks.h rename to Utilities/DataHelper/include/DataHelper/GroupTracks.h diff --git a/Utilities/DataHelper/DataHelper/HelixClass.h b/Utilities/DataHelper/include/DataHelper/HelixClass.h similarity index 100% rename from Utilities/DataHelper/DataHelper/HelixClass.h rename to Utilities/DataHelper/include/DataHelper/HelixClass.h diff --git a/Utilities/DataHelper/DataHelper/LCCylinder.h b/Utilities/DataHelper/include/DataHelper/LCCylinder.h similarity index 100% rename from Utilities/DataHelper/DataHelper/LCCylinder.h rename to Utilities/DataHelper/include/DataHelper/LCCylinder.h diff --git a/Utilities/DataHelper/DataHelper/LCGeometryTypes.h b/Utilities/DataHelper/include/DataHelper/LCGeometryTypes.h similarity index 100% rename from Utilities/DataHelper/DataHelper/LCGeometryTypes.h rename to Utilities/DataHelper/include/DataHelper/LCGeometryTypes.h diff --git a/Utilities/DataHelper/DataHelper/LCLine3D.h b/Utilities/DataHelper/include/DataHelper/LCLine3D.h similarity index 100% rename from Utilities/DataHelper/DataHelper/LCLine3D.h rename to Utilities/DataHelper/include/DataHelper/LCLine3D.h diff --git a/Utilities/DataHelper/DataHelper/LCPlane3D.h b/Utilities/DataHelper/include/DataHelper/LCPlane3D.h similarity index 100% rename from Utilities/DataHelper/DataHelper/LCPlane3D.h rename to Utilities/DataHelper/include/DataHelper/LCPlane3D.h diff --git a/Utilities/DataHelper/DataHelper/LineClass.h b/Utilities/DataHelper/include/DataHelper/LineClass.h similarity index 100% rename from Utilities/DataHelper/DataHelper/LineClass.h rename to Utilities/DataHelper/include/DataHelper/LineClass.h diff --git a/Utilities/DataHelper/DataHelper/Navigation.h b/Utilities/DataHelper/include/DataHelper/Navigation.h similarity index 100% rename from Utilities/DataHelper/DataHelper/Navigation.h rename to Utilities/DataHelper/include/DataHelper/Navigation.h diff --git a/Utilities/DataHelper/DataHelper/SimpleHelix.h b/Utilities/DataHelper/include/DataHelper/SimpleHelix.h similarity index 100% rename from Utilities/DataHelper/DataHelper/SimpleHelix.h rename to Utilities/DataHelper/include/DataHelper/SimpleHelix.h diff --git a/Utilities/DataHelper/DataHelper/TrackExtended.h b/Utilities/DataHelper/include/DataHelper/TrackExtended.h similarity index 100% rename from Utilities/DataHelper/DataHelper/TrackExtended.h rename to Utilities/DataHelper/include/DataHelper/TrackExtended.h diff --git a/Utilities/DataHelper/DataHelper/TrackHitPair.h b/Utilities/DataHelper/include/DataHelper/TrackHitPair.h similarity index 100% rename from Utilities/DataHelper/DataHelper/TrackHitPair.h rename to Utilities/DataHelper/include/DataHelper/TrackHitPair.h diff --git a/Utilities/DataHelper/DataHelper/TrackerHitExtended.h b/Utilities/DataHelper/include/DataHelper/TrackerHitExtended.h similarity index 100% rename from Utilities/DataHelper/DataHelper/TrackerHitExtended.h rename to Utilities/DataHelper/include/DataHelper/TrackerHitExtended.h diff --git a/Utilities/DataHelper/DataHelper/Trajectory.h b/Utilities/DataHelper/include/DataHelper/Trajectory.h similarity index 100% rename from Utilities/DataHelper/DataHelper/Trajectory.h rename to Utilities/DataHelper/include/DataHelper/Trajectory.h diff --git a/Utilities/KalDet/CMakeLists.txt b/Utilities/KalDet/CMakeLists.txt index f7843bd2b474f63625b0316b3f11e7587370f590..faacdc5b6132c6762b8098a79a6b90184f59526c 100644 --- a/Utilities/KalDet/CMakeLists.txt +++ b/Utilities/KalDet/CMakeLists.txt @@ -3,30 +3,16 @@ # Desc: import from ILCSoft ############################################################################## -gaudi_subdir(KalDet v0r0) - -find_package(CLHEP REQUIRED;CONFIG) -find_package(LCIO) -find_package(GEAR) -find_package(ROOT COMPONENTS MathCore) -find_package(EDM4HEP REQUIRED) -find_package(DD4hep COMPONENTS DDCore DDRec REQUIRED) - -gaudi_depends_on_subdirs( - Detector/DetInterface - Utilities/KalTest -) - get_target_property(to_incl KalTestLib SOURCE_DIR) if (to_incl) - LIST( APPEND DICT_INCLUDE_DIRS ${to_incl}) + LIST( APPEND DICT_INCLUDE_DIRS ${to_incl}/include) else() message(FATAL_ERROR "Failed to get the source dir for package KalTestLib") endif() set( DICT_CINT_DEFINITIONS "HANDLE_DICT_EXCEPTIONS=IGNORED_FOR_CINT" ) set( DICT_INPUT_DIRS gen kern lctpc/gearTPC ) -set( DICT_OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rootdict ) +set( DICT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/rootdict ) foreach( DICT_DIR ${DICT_INPUT_DIRS} ) list( APPEND DICT_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/${DICT_DIR} ) @@ -75,7 +61,22 @@ include_directories( ${DICT_INCLUDE_DIRS} ) set( KalDetLib_srcs ${LIB_SOURCES} ${COMMON_SOURCES} ) -gaudi_add_library(KalDetLib ${KalDetLib_srcs} - PUBLIC_HEADERS kaldet - LINK_LIBRARIES GaudiKernel ROOT ${CLHEP_LIBRARIES} LCIO ${GEAR_LIBRARIES} KalTestLib EDM4HEP::edm4hep EDM4HEP::edm4hepDict ${DD4hep_COMPONENT_LIBRARIES} +gaudi_add_library(KalDetLib + SOURCES ${KalDetLib_srcs} + LINK DetInterface + KalTestLib + Gaudi::GaudiKernel + ${ROOT_LIBRARIES} + ${CLHEP_LIBRARIES} + ${LCIO_LIBRARIES} + ${GEAR_LIBRARIES} + EDM4HEP::edm4hep EDM4HEP::edm4hepDict + ${DD4hep_COMPONENT_LIBRARIES} ) + +install(TARGETS KalDetLib + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) + diff --git a/Utilities/KalDet/kaldet/EXEventGen.h b/Utilities/KalDet/include/kaldet/EXEventGen.h similarity index 100% rename from Utilities/KalDet/kaldet/EXEventGen.h rename to Utilities/KalDet/include/kaldet/EXEventGen.h diff --git a/Utilities/KalDet/kaldet/EXTPCHit.h b/Utilities/KalDet/include/kaldet/EXTPCHit.h similarity index 100% rename from Utilities/KalDet/kaldet/EXTPCHit.h rename to Utilities/KalDet/include/kaldet/EXTPCHit.h diff --git a/Utilities/KalDet/kaldet/EXTPCKalDetector.h b/Utilities/KalDet/include/kaldet/EXTPCKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/EXTPCKalDetector.h rename to Utilities/KalDet/include/kaldet/EXTPCKalDetector.h diff --git a/Utilities/KalDet/kaldet/EXTPCMeasLayer.h b/Utilities/KalDet/include/kaldet/EXTPCMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/EXTPCMeasLayer.h rename to Utilities/KalDet/include/kaldet/EXTPCMeasLayer.h diff --git a/Utilities/KalDet/kaldet/EXVKalDetector.h b/Utilities/KalDet/include/kaldet/EXVKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/EXVKalDetector.h rename to Utilities/KalDet/include/kaldet/EXVKalDetector.h diff --git a/Utilities/KalDet/kaldet/EXVMeasLayer.h b/Utilities/KalDet/include/kaldet/EXVMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/EXVMeasLayer.h rename to Utilities/KalDet/include/kaldet/EXVMeasLayer.h diff --git a/Utilities/KalDet/kaldet/GearTPCCylinderHit.h b/Utilities/KalDet/include/kaldet/GearTPCCylinderHit.h similarity index 100% rename from Utilities/KalDet/kaldet/GearTPCCylinderHit.h rename to Utilities/KalDet/include/kaldet/GearTPCCylinderHit.h diff --git a/Utilities/KalDet/kaldet/GearTPCCylinderMeasLayer.h b/Utilities/KalDet/include/kaldet/GearTPCCylinderMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/GearTPCCylinderMeasLayer.h rename to Utilities/KalDet/include/kaldet/GearTPCCylinderMeasLayer.h diff --git a/Utilities/KalDet/kaldet/GearTPCHit.h b/Utilities/KalDet/include/kaldet/GearTPCHit.h similarity index 100% rename from Utilities/KalDet/kaldet/GearTPCHit.h rename to Utilities/KalDet/include/kaldet/GearTPCHit.h diff --git a/Utilities/KalDet/kaldet/GearTPCKalDetector.h b/Utilities/KalDet/include/kaldet/GearTPCKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/GearTPCKalDetector.h rename to Utilities/KalDet/include/kaldet/GearTPCKalDetector.h diff --git a/Utilities/KalDet/kaldet/GearTPCMeasLayer.h b/Utilities/KalDet/include/kaldet/GearTPCMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/GearTPCMeasLayer.h rename to Utilities/KalDet/include/kaldet/GearTPCMeasLayer.h diff --git a/Utilities/KalDet/kaldet/ILDConeMeasLayer.h b/Utilities/KalDet/include/kaldet/ILDConeMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDConeMeasLayer.h rename to Utilities/KalDet/include/kaldet/ILDConeMeasLayer.h diff --git a/Utilities/KalDet/kaldet/ILDCylinderHit.h b/Utilities/KalDet/include/kaldet/ILDCylinderHit.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDCylinderHit.h rename to Utilities/KalDet/include/kaldet/ILDCylinderHit.h diff --git a/Utilities/KalDet/kaldet/ILDCylinderMeasLayer.h b/Utilities/KalDet/include/kaldet/ILDCylinderMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDCylinderMeasLayer.h rename to Utilities/KalDet/include/kaldet/ILDCylinderMeasLayer.h diff --git a/Utilities/KalDet/kaldet/ILDDiscMeasLayer.h b/Utilities/KalDet/include/kaldet/ILDDiscMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDDiscMeasLayer.h rename to Utilities/KalDet/include/kaldet/ILDDiscMeasLayer.h diff --git a/Utilities/KalDet/kaldet/ILDFTDDiscBasedKalDetector.h b/Utilities/KalDet/include/kaldet/ILDFTDDiscBasedKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDFTDDiscBasedKalDetector.h rename to Utilities/KalDet/include/kaldet/ILDFTDDiscBasedKalDetector.h diff --git a/Utilities/KalDet/kaldet/ILDFTDKalDetector.h b/Utilities/KalDet/include/kaldet/ILDFTDKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDFTDKalDetector.h rename to Utilities/KalDet/include/kaldet/ILDFTDKalDetector.h diff --git a/Utilities/KalDet/kaldet/ILDMeasurementSurfaceStoreFiller.h b/Utilities/KalDet/include/kaldet/ILDMeasurementSurfaceStoreFiller.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDMeasurementSurfaceStoreFiller.h rename to Utilities/KalDet/include/kaldet/ILDMeasurementSurfaceStoreFiller.h diff --git a/Utilities/KalDet/kaldet/ILDParallelPlanarMeasLayer.h b/Utilities/KalDet/include/kaldet/ILDParallelPlanarMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDParallelPlanarMeasLayer.h rename to Utilities/KalDet/include/kaldet/ILDParallelPlanarMeasLayer.h diff --git a/Utilities/KalDet/kaldet/ILDParallelPlanarStripMeasLayer.h b/Utilities/KalDet/include/kaldet/ILDParallelPlanarStripMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDParallelPlanarStripMeasLayer.h rename to Utilities/KalDet/include/kaldet/ILDParallelPlanarStripMeasLayer.h diff --git a/Utilities/KalDet/kaldet/ILDPlanarHit.h b/Utilities/KalDet/include/kaldet/ILDPlanarHit.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDPlanarHit.h rename to Utilities/KalDet/include/kaldet/ILDPlanarHit.h diff --git a/Utilities/KalDet/kaldet/ILDPlanarMeasLayer.h b/Utilities/KalDet/include/kaldet/ILDPlanarMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDPlanarMeasLayer.h rename to Utilities/KalDet/include/kaldet/ILDPlanarMeasLayer.h diff --git a/Utilities/KalDet/kaldet/ILDPlanarStripHit.h b/Utilities/KalDet/include/kaldet/ILDPlanarStripHit.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDPlanarStripHit.h rename to Utilities/KalDet/include/kaldet/ILDPlanarStripHit.h diff --git a/Utilities/KalDet/kaldet/ILDPolygonBarrelMeasLayer.h b/Utilities/KalDet/include/kaldet/ILDPolygonBarrelMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDPolygonBarrelMeasLayer.h rename to Utilities/KalDet/include/kaldet/ILDPolygonBarrelMeasLayer.h diff --git a/Utilities/KalDet/kaldet/ILDRotatedTrapMeaslayer.h b/Utilities/KalDet/include/kaldet/ILDRotatedTrapMeaslayer.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDRotatedTrapMeaslayer.h rename to Utilities/KalDet/include/kaldet/ILDRotatedTrapMeaslayer.h diff --git a/Utilities/KalDet/kaldet/ILDSETKalDetector.h b/Utilities/KalDet/include/kaldet/ILDSETKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDSETKalDetector.h rename to Utilities/KalDet/include/kaldet/ILDSETKalDetector.h diff --git a/Utilities/KalDet/kaldet/ILDSITCylinderKalDetector.h b/Utilities/KalDet/include/kaldet/ILDSITCylinderKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDSITCylinderKalDetector.h rename to Utilities/KalDet/include/kaldet/ILDSITCylinderKalDetector.h diff --git a/Utilities/KalDet/kaldet/ILDSITKalDetector.h b/Utilities/KalDet/include/kaldet/ILDSITKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDSITKalDetector.h rename to Utilities/KalDet/include/kaldet/ILDSITKalDetector.h diff --git a/Utilities/KalDet/kaldet/ILDSegmentedDiscMeasLayer.h b/Utilities/KalDet/include/kaldet/ILDSegmentedDiscMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDSegmentedDiscMeasLayer.h rename to Utilities/KalDet/include/kaldet/ILDSegmentedDiscMeasLayer.h diff --git a/Utilities/KalDet/kaldet/ILDSegmentedDiscStripMeasLayer.h b/Utilities/KalDet/include/kaldet/ILDSegmentedDiscStripMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDSegmentedDiscStripMeasLayer.h rename to Utilities/KalDet/include/kaldet/ILDSegmentedDiscStripMeasLayer.h diff --git a/Utilities/KalDet/kaldet/ILDSupportKalDetector.h b/Utilities/KalDet/include/kaldet/ILDSupportKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDSupportKalDetector.h rename to Utilities/KalDet/include/kaldet/ILDSupportKalDetector.h diff --git a/Utilities/KalDet/kaldet/ILDTPCKalDetector.h b/Utilities/KalDet/include/kaldet/ILDTPCKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDTPCKalDetector.h rename to Utilities/KalDet/include/kaldet/ILDTPCKalDetector.h diff --git a/Utilities/KalDet/kaldet/ILDVMeasLayer.h b/Utilities/KalDet/include/kaldet/ILDVMeasLayer.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDVMeasLayer.h rename to Utilities/KalDet/include/kaldet/ILDVMeasLayer.h diff --git a/Utilities/KalDet/kaldet/ILDVTrackHit.h b/Utilities/KalDet/include/kaldet/ILDVTrackHit.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDVTrackHit.h rename to Utilities/KalDet/include/kaldet/ILDVTrackHit.h diff --git a/Utilities/KalDet/kaldet/ILDVXDKalDetector.h b/Utilities/KalDet/include/kaldet/ILDVXDKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/ILDVXDKalDetector.h rename to Utilities/KalDet/include/kaldet/ILDVXDKalDetector.h diff --git a/Utilities/KalDet/kaldet/LCTPCKalDetector.h b/Utilities/KalDet/include/kaldet/LCTPCKalDetector.h similarity index 100% rename from Utilities/KalDet/kaldet/LCTPCKalDetector.h rename to Utilities/KalDet/include/kaldet/LCTPCKalDetector.h diff --git a/Utilities/KalDet/kaldet/MaterialDataBase.h b/Utilities/KalDet/include/kaldet/MaterialDataBase.h similarity index 100% rename from Utilities/KalDet/kaldet/MaterialDataBase.h rename to Utilities/KalDet/include/kaldet/MaterialDataBase.h diff --git a/Utilities/KalTest/CMakeLists.txt b/Utilities/KalTest/CMakeLists.txt index 1b20a31d7280316c67d7ab12a05d23a0d31c633c..d1a29b90d61522b3804673af3636b3ba62641694 100644 --- a/Utilities/KalTest/CMakeLists.txt +++ b/Utilities/KalTest/CMakeLists.txt @@ -3,15 +3,9 @@ # Desc: import from ILCSoft ############################################################################## -gaudi_subdir(KalTest v0r0) - -find_package(ROOT REQUIRED COMPONENTS MathCore) - -gaudi_depends_on_subdirs() - set( DICT_CINT_DEFINITIONS "HANDLE_DICT_EXCEPTIONS=IGNORED_FOR_CINT" ) set( DICT_INPUT_DIRS geomlib kallib kaltracklib utils ) -set( DICT_OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rootdict ) +set( DICT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/rootdict ) foreach( DICT ${DICT_INPUT_DIRS} ) list( APPEND DICT_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/${DICT} ) @@ -54,7 +48,18 @@ include_directories( ${ROOT_INCLUDE_DIRS} ) set(KalTestLib_srcs ${LIB_SOURCES}) -gaudi_add_library(KalTestLib ${KalTestLib_srcs} - PUBLIC_HEADERS kaltest - LINK_LIBRARIES GaudiKernel ROOT +gaudi_add_library(KalTestLib + SOURCES ${KalTestLib_srcs} + LINK Gaudi::GaudiKernel + ${ROOT_LIBRARIES} ) + +target_include_directories(KalTestLib PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) + +install(TARGETS KalTestLib + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Utilities/KalTest/kaltest/KalTrackDim.h b/Utilities/KalTest/include/kaltest/KalTrackDim.h similarity index 100% rename from Utilities/KalTest/kaltest/KalTrackDim.h rename to Utilities/KalTest/include/kaltest/KalTrackDim.h diff --git a/Utilities/KalTest/kaltest/TAttDrawable.h b/Utilities/KalTest/include/kaltest/TAttDrawable.h similarity index 100% rename from Utilities/KalTest/kaltest/TAttDrawable.h rename to Utilities/KalTest/include/kaltest/TAttDrawable.h diff --git a/Utilities/KalTest/kaltest/TAttElement.h b/Utilities/KalTest/include/kaltest/TAttElement.h similarity index 100% rename from Utilities/KalTest/kaltest/TAttElement.h rename to Utilities/KalTest/include/kaltest/TAttElement.h diff --git a/Utilities/KalTest/kaltest/TAttLockable.h b/Utilities/KalTest/include/kaltest/TAttLockable.h similarity index 100% rename from Utilities/KalTest/kaltest/TAttLockable.h rename to Utilities/KalTest/include/kaltest/TAttLockable.h diff --git a/Utilities/KalTest/kaltest/TCircle.h b/Utilities/KalTest/include/kaltest/TCircle.h similarity index 100% rename from Utilities/KalTest/kaltest/TCircle.h rename to Utilities/KalTest/include/kaltest/TCircle.h diff --git a/Utilities/KalTest/kaltest/TCutCone.h b/Utilities/KalTest/include/kaltest/TCutCone.h similarity index 100% rename from Utilities/KalTest/kaltest/TCutCone.h rename to Utilities/KalTest/include/kaltest/TCutCone.h diff --git a/Utilities/KalTest/kaltest/TCylinder.h b/Utilities/KalTest/include/kaltest/TCylinder.h similarity index 100% rename from Utilities/KalTest/kaltest/TCylinder.h rename to Utilities/KalTest/include/kaltest/TCylinder.h diff --git a/Utilities/KalTest/kaltest/THelicalTrack.h b/Utilities/KalTest/include/kaltest/THelicalTrack.h similarity index 100% rename from Utilities/KalTest/kaltest/THelicalTrack.h rename to Utilities/KalTest/include/kaltest/THelicalTrack.h diff --git a/Utilities/KalTest/kaltest/THype.h b/Utilities/KalTest/include/kaltest/THype.h similarity index 100% rename from Utilities/KalTest/kaltest/THype.h rename to Utilities/KalTest/include/kaltest/THype.h diff --git a/Utilities/KalTest/kaltest/TKalDetCradle.h b/Utilities/KalTest/include/kaltest/TKalDetCradle.h similarity index 100% rename from Utilities/KalTest/kaltest/TKalDetCradle.h rename to Utilities/KalTest/include/kaltest/TKalDetCradle.h diff --git a/Utilities/KalTest/kaltest/TKalFilterCond.h b/Utilities/KalTest/include/kaltest/TKalFilterCond.h similarity index 100% rename from Utilities/KalTest/kaltest/TKalFilterCond.h rename to Utilities/KalTest/include/kaltest/TKalFilterCond.h diff --git a/Utilities/KalTest/kaltest/TKalMatrix.h b/Utilities/KalTest/include/kaltest/TKalMatrix.h similarity index 100% rename from Utilities/KalTest/kaltest/TKalMatrix.h rename to Utilities/KalTest/include/kaltest/TKalMatrix.h diff --git a/Utilities/KalTest/kaltest/TKalTrack.h b/Utilities/KalTest/include/kaltest/TKalTrack.h similarity index 100% rename from Utilities/KalTest/kaltest/TKalTrack.h rename to Utilities/KalTest/include/kaltest/TKalTrack.h diff --git a/Utilities/KalTest/kaltest/TKalTrackSite.h b/Utilities/KalTest/include/kaltest/TKalTrackSite.h similarity index 100% rename from Utilities/KalTest/kaltest/TKalTrackSite.h rename to Utilities/KalTest/include/kaltest/TKalTrackSite.h diff --git a/Utilities/KalTest/kaltest/TKalTrackState.h b/Utilities/KalTest/include/kaltest/TKalTrackState.h similarity index 100% rename from Utilities/KalTest/kaltest/TKalTrackState.h rename to Utilities/KalTest/include/kaltest/TKalTrackState.h diff --git a/Utilities/KalTest/kaltest/TPlane.h b/Utilities/KalTest/include/kaltest/TPlane.h similarity index 100% rename from Utilities/KalTest/kaltest/TPlane.h rename to Utilities/KalTest/include/kaltest/TPlane.h diff --git a/Utilities/KalTest/kaltest/TStraightTrack.h b/Utilities/KalTest/include/kaltest/TStraightTrack.h similarity index 100% rename from Utilities/KalTest/kaltest/TStraightTrack.h rename to Utilities/KalTest/include/kaltest/TStraightTrack.h diff --git a/Utilities/KalTest/kaltest/TTube.h b/Utilities/KalTest/include/kaltest/TTube.h similarity index 100% rename from Utilities/KalTest/kaltest/TTube.h rename to Utilities/KalTest/include/kaltest/TTube.h diff --git a/Utilities/KalTest/kaltest/TVCurve.h b/Utilities/KalTest/include/kaltest/TVCurve.h similarity index 100% rename from Utilities/KalTest/kaltest/TVCurve.h rename to Utilities/KalTest/include/kaltest/TVCurve.h diff --git a/Utilities/KalTest/kaltest/TVKalDetector.h b/Utilities/KalTest/include/kaltest/TVKalDetector.h similarity index 100% rename from Utilities/KalTest/kaltest/TVKalDetector.h rename to Utilities/KalTest/include/kaltest/TVKalDetector.h diff --git a/Utilities/KalTest/kaltest/TVKalSite.h b/Utilities/KalTest/include/kaltest/TVKalSite.h similarity index 100% rename from Utilities/KalTest/kaltest/TVKalSite.h rename to Utilities/KalTest/include/kaltest/TVKalSite.h diff --git a/Utilities/KalTest/kaltest/TVKalState.h b/Utilities/KalTest/include/kaltest/TVKalState.h similarity index 100% rename from Utilities/KalTest/kaltest/TVKalState.h rename to Utilities/KalTest/include/kaltest/TVKalState.h diff --git a/Utilities/KalTest/kaltest/TVKalSystem.h b/Utilities/KalTest/include/kaltest/TVKalSystem.h similarity index 100% rename from Utilities/KalTest/kaltest/TVKalSystem.h rename to Utilities/KalTest/include/kaltest/TVKalSystem.h diff --git a/Utilities/KalTest/kaltest/TVMeasLayer.h b/Utilities/KalTest/include/kaltest/TVMeasLayer.h similarity index 100% rename from Utilities/KalTest/kaltest/TVMeasLayer.h rename to Utilities/KalTest/include/kaltest/TVMeasLayer.h diff --git a/Utilities/KalTest/kaltest/TVSolid.h b/Utilities/KalTest/include/kaltest/TVSolid.h similarity index 100% rename from Utilities/KalTest/kaltest/TVSolid.h rename to Utilities/KalTest/include/kaltest/TVSolid.h diff --git a/Utilities/KalTest/kaltest/TVSurface.h b/Utilities/KalTest/include/kaltest/TVSurface.h similarity index 100% rename from Utilities/KalTest/kaltest/TVSurface.h rename to Utilities/KalTest/include/kaltest/TVSurface.h diff --git a/Utilities/KalTest/kaltest/TVTrack.h b/Utilities/KalTest/include/kaltest/TVTrack.h similarity index 100% rename from Utilities/KalTest/kaltest/TVTrack.h rename to Utilities/KalTest/include/kaltest/TVTrack.h diff --git a/Utilities/KalTest/kaltest/TVTrackHit.h b/Utilities/KalTest/include/kaltest/TVTrackHit.h similarity index 100% rename from Utilities/KalTest/kaltest/TVTrackHit.h rename to Utilities/KalTest/include/kaltest/TVTrackHit.h diff --git a/Utilities/KiTrack/CMakeLists.txt b/Utilities/KiTrack/CMakeLists.txt index 7a20e00dc7f34a62d6a97bad8e0c4886d6db62a9..6beed3c6cdd723246c7332fcc76dabfe55a99677 100644 --- a/Utilities/KiTrack/CMakeLists.txt +++ b/Utilities/KiTrack/CMakeLists.txt @@ -1,22 +1,74 @@ -gaudi_subdir(KiTrack v0r0) -find_package(CLHEP REQUIRED;CONFIG) -find_package(ROOT REQUIRED) -#find_package(DD4hep REQUIRED) -find_package(GSL REQUIRED) -find_package(EDM4HEP REQUIRED) -find_package(LCIO REQUIRED) -find_package(DD4hep COMPONENTS DDCore DDRec REQUIRED) +gaudi_add_library(KiTrackLib + SOURCES src/KiTrack/Automaton.cc + src/KiTrack/HopfieldNeuralNet.cc + src/KiTrack/IHit.cc + src/KiTrack/SegmentBuilder.cc + src/KiTrack/Segment.cc -gaudi_depends_on_subdirs(Service/TrackSystemSvc Utilities/DataHelper) + src/Criteria/Crit2_DeltaPhi.cc + src/Criteria/Crit2_DeltaPhi_MV.cc + src/Criteria/Crit2_DeltaRho.cc + src/Criteria/Crit2_DeltaTheta_MV.cc + src/Criteria/Crit2_Distance_MV.cc + src/Criteria/Crit2_HelixWithIP.cc + src/Criteria/Crit2_RZRatio.cc + src/Criteria/Crit2_StraightTrackRatio.cc + src/Criteria/Crit3_2DAngle.cc + src/Criteria/Crit3_2DAngleTimesR.cc + src/Criteria/Crit3_3DAngle.cc + src/Criteria/Crit3_3DAngleTimesR.cc + src/Criteria/Crit3_ChangeRZRatio.cc + src/Criteria/Crit3_IPCircleDist.cc + src/Criteria/Crit3_IPCircleDistTimesR.cc + src/Criteria/Crit3_NoZigZag_MV.cc + src/Criteria/Crit3_PT.cc + src/Criteria/Crit3_PT_MV.cc + src/Criteria/Crit4_2DAngleChange.cc + src/Criteria/Crit4_3DAngleChange.cc + src/Criteria/Crit4_3DAngleChangeNormed.cc + src/Criteria/Crit4_DistOfCircleCenters.cc + src/Criteria/Crit4_DistToExtrapolation.cc + src/Criteria/Crit4_NoZigZag.cc + src/Criteria/Crit4_PhiZRatioChange.cc + src/Criteria/Crit4_RChange.cc + src/Criteria/Criteria.cc + src/Criteria/SimpleCircle.cc -set(KiTrackLib_srcs src/KiTrack/*.cc src/Criteria/*.cc src/ILDImpl/*.cc src/Tools/*.cc) + src/ILDImpl/FTDHit01.cc + src/ILDImpl/FTDHitSimple.cc + src/ILDImpl/FTDNeighborPetalSecCon.cc + src/ILDImpl/FTDSectorConnector.cc + src/ILDImpl/FTDTrack.cc + src/ILDImpl/MiniVector.cc + src/ILDImpl/MiniVectorHit01.cc + src/ILDImpl/SectorSystemFTD.cc + src/ILDImpl/SectorSystemVXD.cc + src/ILDImpl/VXDHit01.cc + src/ILDImpl/VXDHitSimple.cc + src/ILDImpl/VXDSectorConnector.cc + src/ILDImpl/VXDTrack.cc -#gaudi_install_headers(src) -include_directories(src) + src/Tools/Fitter.cc + src/Tools/FTDHelixFitter.cc + src/Tools/KiTrackMarlinTools.cc + src/Tools/Timer.cc -gaudi_add_library(KiTrackLib ${KiTrackLib_srcs} - PUBLIC_HEADERS KiTrack - LINK_LIBRARIES DataHelperLib TrackSystemSvcLib ROOT ${CLHEP_LIBRARIES} GSL EDM4HEP::edm4hep LCIO - # DD4hep + LINK DataHelperLib + TrackSystemSvcLib + ${ROOT_LIBRARIES} + ${CLHEP_LIBRARIES} + ${GSL_LIBRARIES} + EDM4HEP::edm4hep + ${LCIO_LIBRARIES} ) + +target_include_directories(KiTrackLib PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> + $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) + +install(TARGETS KiTrackLib + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/Utilities/KiTrack/Criteria/Criteria.h b/Utilities/KiTrack/include/Criteria/Criteria.h similarity index 100% rename from Utilities/KiTrack/Criteria/Criteria.h rename to Utilities/KiTrack/include/Criteria/Criteria.h diff --git a/Utilities/KiTrack/Criteria/ICriterion.h b/Utilities/KiTrack/include/Criteria/ICriterion.h similarity index 100% rename from Utilities/KiTrack/Criteria/ICriterion.h rename to Utilities/KiTrack/include/Criteria/ICriterion.h diff --git a/Utilities/KiTrack/ILDImpl/FTDHit01.h b/Utilities/KiTrack/include/ILDImpl/FTDHit01.h similarity index 100% rename from Utilities/KiTrack/ILDImpl/FTDHit01.h rename to Utilities/KiTrack/include/ILDImpl/FTDHit01.h diff --git a/Utilities/KiTrack/ILDImpl/FTDHitSimple.h b/Utilities/KiTrack/include/ILDImpl/FTDHitSimple.h similarity index 100% rename from Utilities/KiTrack/ILDImpl/FTDHitSimple.h rename to Utilities/KiTrack/include/ILDImpl/FTDHitSimple.h diff --git a/Utilities/KiTrack/ILDImpl/FTDNeighborPetalSecCon.h b/Utilities/KiTrack/include/ILDImpl/FTDNeighborPetalSecCon.h similarity index 100% rename from Utilities/KiTrack/ILDImpl/FTDNeighborPetalSecCon.h rename to Utilities/KiTrack/include/ILDImpl/FTDNeighborPetalSecCon.h diff --git a/Utilities/KiTrack/ILDImpl/FTDSectorConnector.h b/Utilities/KiTrack/include/ILDImpl/FTDSectorConnector.h similarity index 100% rename from Utilities/KiTrack/ILDImpl/FTDSectorConnector.h rename to Utilities/KiTrack/include/ILDImpl/FTDSectorConnector.h diff --git a/Utilities/KiTrack/ILDImpl/FTDTrack.h b/Utilities/KiTrack/include/ILDImpl/FTDTrack.h similarity index 100% rename from Utilities/KiTrack/ILDImpl/FTDTrack.h rename to Utilities/KiTrack/include/ILDImpl/FTDTrack.h diff --git a/Utilities/KiTrack/ILDImpl/IFTDHit.h b/Utilities/KiTrack/include/ILDImpl/IFTDHit.h similarity index 100% rename from Utilities/KiTrack/ILDImpl/IFTDHit.h rename to Utilities/KiTrack/include/ILDImpl/IFTDHit.h diff --git a/Utilities/KiTrack/ILDImpl/SectorSystemFTD.h b/Utilities/KiTrack/include/ILDImpl/SectorSystemFTD.h similarity index 100% rename from Utilities/KiTrack/ILDImpl/SectorSystemFTD.h rename to Utilities/KiTrack/include/ILDImpl/SectorSystemFTD.h diff --git a/Utilities/KiTrack/ILDImpl/SectorSystemVXD.h b/Utilities/KiTrack/include/ILDImpl/SectorSystemVXD.h similarity index 100% rename from Utilities/KiTrack/ILDImpl/SectorSystemVXD.h rename to Utilities/KiTrack/include/ILDImpl/SectorSystemVXD.h diff --git a/Utilities/KiTrack/ILDImpl/VXDHitSimple.h b/Utilities/KiTrack/include/ILDImpl/VXDHitSimple.h similarity index 100% rename from Utilities/KiTrack/ILDImpl/VXDHitSimple.h rename to Utilities/KiTrack/include/ILDImpl/VXDHitSimple.h diff --git a/Utilities/KiTrack/KiTrack/Automaton.h b/Utilities/KiTrack/include/KiTrack/Automaton.h similarity index 100% rename from Utilities/KiTrack/KiTrack/Automaton.h rename to Utilities/KiTrack/include/KiTrack/Automaton.h diff --git a/Utilities/KiTrack/KiTrack/HopfieldNeuralNet.h b/Utilities/KiTrack/include/KiTrack/HopfieldNeuralNet.h similarity index 100% rename from Utilities/KiTrack/KiTrack/HopfieldNeuralNet.h rename to Utilities/KiTrack/include/KiTrack/HopfieldNeuralNet.h diff --git a/Utilities/KiTrack/KiTrack/IHit.h b/Utilities/KiTrack/include/KiTrack/IHit.h similarity index 100% rename from Utilities/KiTrack/KiTrack/IHit.h rename to Utilities/KiTrack/include/KiTrack/IHit.h diff --git a/Utilities/KiTrack/KiTrack/ISectorConnector.h b/Utilities/KiTrack/include/KiTrack/ISectorConnector.h similarity index 100% rename from Utilities/KiTrack/KiTrack/ISectorConnector.h rename to Utilities/KiTrack/include/KiTrack/ISectorConnector.h diff --git a/Utilities/KiTrack/KiTrack/ISectorSystem.h b/Utilities/KiTrack/include/KiTrack/ISectorSystem.h similarity index 100% rename from Utilities/KiTrack/KiTrack/ISectorSystem.h rename to Utilities/KiTrack/include/KiTrack/ISectorSystem.h diff --git a/Utilities/KiTrack/KiTrack/ITrack.h b/Utilities/KiTrack/include/KiTrack/ITrack.h similarity index 100% rename from Utilities/KiTrack/KiTrack/ITrack.h rename to Utilities/KiTrack/include/KiTrack/ITrack.h diff --git a/Utilities/KiTrack/KiTrack/KiTrackExceptions.h b/Utilities/KiTrack/include/KiTrack/KiTrackExceptions.h similarity index 100% rename from Utilities/KiTrack/KiTrack/KiTrackExceptions.h rename to Utilities/KiTrack/include/KiTrack/KiTrackExceptions.h diff --git a/Utilities/KiTrack/KiTrack/Segment.h b/Utilities/KiTrack/include/KiTrack/Segment.h similarity index 100% rename from Utilities/KiTrack/KiTrack/Segment.h rename to Utilities/KiTrack/include/KiTrack/Segment.h diff --git a/Utilities/KiTrack/KiTrack/SegmentBuilder.h b/Utilities/KiTrack/include/KiTrack/SegmentBuilder.h similarity index 100% rename from Utilities/KiTrack/KiTrack/SegmentBuilder.h rename to Utilities/KiTrack/include/KiTrack/SegmentBuilder.h diff --git a/Utilities/KiTrack/KiTrack/Subset.h b/Utilities/KiTrack/include/KiTrack/Subset.h similarity index 100% rename from Utilities/KiTrack/KiTrack/Subset.h rename to Utilities/KiTrack/include/KiTrack/Subset.h diff --git a/Utilities/KiTrack/KiTrack/SubsetHopfieldNN.h b/Utilities/KiTrack/include/KiTrack/SubsetHopfieldNN.h similarity index 100% rename from Utilities/KiTrack/KiTrack/SubsetHopfieldNN.h rename to Utilities/KiTrack/include/KiTrack/SubsetHopfieldNN.h diff --git a/Utilities/KiTrack/KiTrack/SubsetSimple.h b/Utilities/KiTrack/include/KiTrack/SubsetSimple.h similarity index 100% rename from Utilities/KiTrack/KiTrack/SubsetSimple.h rename to Utilities/KiTrack/include/KiTrack/SubsetSimple.h diff --git a/Utilities/KiTrack/Tools/FTDHelixFitter.h b/Utilities/KiTrack/include/Tools/FTDHelixFitter.h similarity index 100% rename from Utilities/KiTrack/Tools/FTDHelixFitter.h rename to Utilities/KiTrack/include/Tools/FTDHelixFitter.h diff --git a/Utilities/KiTrack/Tools/Fitter.h b/Utilities/KiTrack/include/Tools/Fitter.h similarity index 100% rename from Utilities/KiTrack/Tools/Fitter.h rename to Utilities/KiTrack/include/Tools/Fitter.h diff --git a/Utilities/KiTrack/Tools/KiTrackMarlinTools.h b/Utilities/KiTrack/include/Tools/KiTrackMarlinTools.h similarity index 100% rename from Utilities/KiTrack/Tools/KiTrackMarlinTools.h rename to Utilities/KiTrack/include/Tools/KiTrackMarlinTools.h diff --git a/Utilities/KiTrack/src/ILDImpl/#FTDTrack.cc# b/Utilities/KiTrack/src/ILDImpl/#FTDTrack.cc# deleted file mode 100644 index 6d928c374e857ebcc3f08f657a8f873024955dbb..0000000000000000000000000000000000000000 --- a/Utilities/KiTrack/src/ILDImpl/#FTDTrack.cc# +++ /dev/null @@ -1,132 +0,0 @@ -#include "ILDImpl/FTDTrack.h" - - -#include <algorithm> -#include <math.h> - -//#include "UTIL/LCTrackerConf.h" - -// Root, for calculating the chi2 probability. -#include "Math/ProbFunc.h" - - - -using namespace KiTrackMarlin; - -/** @return if the absolute z value of hit a is bigger than that of hit b */ -bool compare_IHit_z( IHit* a, IHit* b ){ - - return ( fabs( a->getZ() ) < fabs( b->getZ() ) ); //compare their z values - -} - - - -FTDTrack::FTDTrack( MarlinTrk::IMarlinTrkSystem* trkSystem ){ - - _trkSystem = trkSystem; - _chi2Prob = 0.; - - _lcioTrack = new edm4hep::Track(); - - -} - -FTDTrack::FTDTrack( std::vector< IFTDHit* > hits , MarlinTrk::IMarlinTrkSystem* trkSystem ){ - - - _trkSystem = trkSystem; - _chi2Prob = 0.; - - _lcioTrack = new edm4hep::Track(); - - for( unsigned i=0; i < hits.size(); i++ ){ - - addHit( hits[i] ); - - - } - -} - - -FTDTrack::FTDTrack( const FTDTrack& f ){ - - //make a new copied lcio track - _lcioTrack = new edm4hep::Track( *f._lcioTrack ); - - - _hits = f._hits; - _chi2Prob = f._chi2Prob; - _trkSystem = f._trkSystem; - -} - -FTDTrack & FTDTrack::operator= (const FTDTrack & f){ - - if (this == &f) return *this; //protect against self assignment - - //make a new copied lcio track - _lcioTrack = new edm4hep::Track( *f._lcioTrack ); - - - _hits = f._hits; - _chi2Prob = f._chi2Prob; - _trkSystem = f._trkSystem; - - return *this; - -} - - - -void FTDTrack::addHit( IFTDHit* hit ){ - if ( hit != NULL ){ - _hits.push_back( hit ); - // and sort the track again - sort( _hits.begin(), _hits.end(), compare_IHit_z ); - _lcioTrack->addToTrackerHits( *hit->getTrackerHit() ); - } -} - - - - - -void FTDTrack::fit() { - - - Fitter fitter( _lcioTrack , _trkSystem ); - - - _lcioTrack->setChi2( fitter.getChi2( 1/*by fucd AtIP=1 in LCIO, changed to CepC rule in future: lcio::TrackState::AtIP*/ ) ); - _lcioTrack->setNdf( fitter.getNdf( 1/*lcio::TrackState::AtIP*/ ) ); - _chi2Prob = fitter.getChi2Prob( 1/*lcio::TrackState::AtIP*/ ); - - edm4hep::TrackState trkState( *fitter.getTrackState( 1/*lcio::TrackState::AtIP*/ ) ) ; - trkState.location = 1/*lcio::TrackState::AtIP*/ ; - _lcioTrack->addToTrackStates( trkState ); - - -} - - -double FTDTrack::getQI() const{ - - - double QI = _chi2Prob; - - // make sure QI is between 0 and 1 - if (QI > 1. ) QI = 1.; - if (QI < 0. ) QI = 0.; - - return QI; - -} - - - - - - - diff --git a/build-k4.sh b/build-k4.sh index f7e7560497b51e2dae4bbf8a3e6ecd0611d3c535..a483d8993ef03f377d1fdd74fecf76d4f1d6adbe 100755 --- a/build-k4.sh +++ b/build-k4.sh @@ -20,7 +20,8 @@ function error:() { } function check-cepcsw-envvar() { - source /cvmfs/sw.hsf.org/key4hep/setup.sh + # source /cvmfs/sw.hsf.org/key4hep/setup.sh + source /cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh # fix the order of compiler local ccdir=$(dirname $CC) export PATH=$ccdir:$PATH @@ -29,6 +30,10 @@ function check-cepcsw-envvar() { function build-dir() { local blddir=build + if [ -n "${bldtool}" ]; then + blddir=${blddir}.${bldtool} + fi + # If detect the extra env var, append it to the build dir if [ -n "${k4_version}" ]; then blddir=${blddir}.${k4_version} @@ -57,6 +62,16 @@ function run-cmake() { error: "Failed to create $blddir" return 1 fi + local bldgen + if [ -n "$bldtool" ] ; then + case $bldtool in + ninja) + bldgen="-G Ninja" + ;; + *) + ;; + esac + fi cd $blddir @@ -77,7 +92,7 @@ function run-cmake() { local cmake_modules=${pandorapfa_cmake_modules} - cmake .. -DHOST_BINARY_TAG=${k4_platform} \ + cmake .. -DHOST_BINARY_TAG=${k4_platform} ${bldgen} \ -DCMAKE_MODULE_PATH=${cmake_modules} || { error: "Failed to cmake" return 1 @@ -86,7 +101,7 @@ function run-cmake() { } function run-make() { - make + cmake --build . } ############################################################################## @@ -96,6 +111,7 @@ function run-make() { # The current default platform k4_platform=x86_64-linux-gcc9-opt k4_version=master +bldtool=${CEPCSW_BLDTOOL} # make, ninja # set in env var check-cepcsw-envvar || exit -1 diff --git a/build.sh b/build.sh index b7f11d7f4e35995e09bc749de5e3acd41ad13103..718e78011df25d88fdbb932d30d2ffe8fa35c668 100755 --- a/build.sh +++ b/build.sh @@ -30,6 +30,10 @@ function check-cepcsw-envvar() { function build-dir() { local blddir=build + if [ -n "${bldtool}" ]; then + blddir=${blddir}.${bldtool} + fi + # If detect the extra env var, append it to the build dir if [ -n "${lcg_version}" ]; then blddir=${blddir}.${lcg_version} @@ -58,10 +62,20 @@ function run-cmake() { error: "Failed to create $blddir" return 1 fi + local bldgen + if [ -n "$bldtool" ] ; then + case $bldtool in + ninja) + bldgen="-G Ninja" + ;; + *) + ;; + esac + fi cd $blddir - cmake .. -DHOST_BINARY_TAG=${lcg_platform} || { + cmake .. -DHOST_BINARY_TAG=${lcg_platform} ${bldgen} || { error: "Failed to cmake" return 1 } @@ -69,7 +83,7 @@ function run-cmake() { } function run-make() { - make + cmake --build . } ############################################################################## @@ -77,8 +91,10 @@ function run-make() { ############################################################################## # The current default platform -lcg_platform=x86_64-slc6-gcc8-opt -lcg_version=97.0.2 +lcg_platform=x86_64-centos7-gcc8-opt +lcg_version=98.0.0 + +bldtool=${CEPCSW_BLDTOOL} # make, ninja # set in env var check-cepcsw-envvar || exit -1 diff --git a/cmake/CEPCSWConfig.cmake b/cmake/CEPCSWConfig.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4f9445ac3683765653b333811ce5ca8803cec5c6 --- /dev/null +++ b/cmake/CEPCSWConfig.cmake @@ -0,0 +1,13 @@ +include(CMakeFindDependencyMacro) +find_dependency(podio REQUIRED) +find_dependency(Gaudi REQUIRED) +find_dependency(k4FWCore REQUIRED) +find_dependency(EDM4HEP REQUIRED) +find_dependency(ROOT REQUIRED) + +# - Include the targets file to create the imported targets that a client can +# link to (libraries) or execute (programs) +include("${CMAKE_CURRENT_LIST_DIR}/CEPCSWTargets.cmake") + +get_property(TEST_CEPCSW_LIBRARY TARGET CEPCSW::GeomSvc PROPERTY LOCATION) +find_package_handle_standard_args(CEPCSW DEFAULT_MSG CMAKE_CURRENT_LIST_FILE TEST_CEPCSW_LIBRARY) diff --git a/cmake/CEPCSWDependencies.cmake b/cmake/CEPCSWDependencies.cmake new file mode 100644 index 0000000000000000000000000000000000000000..78aa0f26d7c8c84bfb581cb6bdebf9c53568e522 --- /dev/null +++ b/cmake/CEPCSWDependencies.cmake @@ -0,0 +1,34 @@ +#[[ + +Find all the dependencies here, so in each package user don't need to find the packages again. + +- CLHEP +- DD4hep +- EDM4hep +- Gaudi +- Geant4 +- GEAR +- GSL +- HepMC +- k4FWCore +- LCContent +- LCIO +- PandoraSDK +- podio +- ROOT +#]] + +find_package(CLHEP REQUIRED;CONFIG) +find_package(DD4hep COMPONENTS DDCore DDG4 DDParsers DDRec REQUIRED) +find_package(EDM4HEP REQUIRED) +find_package(Geant4 REQUIRED ui_all vis_all) +find_package(GEAR REQUIRED) +find_package(GSL REQUIRED) +find_package(HepMC) +find_package(k4FWCore REQUIRED) +find_package(LCContent REQUIRED) +find_package(LCIO REQUIRED) +find_package(PandoraSDK REQUIRED) +find_package(podio REQUIRED) +find_package(ROOT COMPONENTS EG Graf Graf3d Gpad MathCore Net RIO Tree TreePlayer REQUIRED) +find_package(GenFit) diff --git a/cmake/CEPCSWEnv.cmake b/cmake/CEPCSWEnv.cmake new file mode 100644 index 0000000000000000000000000000000000000000..1854ce60582ad2107eaa1bdd530d743d31835424 --- /dev/null +++ b/cmake/CEPCSWEnv.cmake @@ -0,0 +1,9 @@ +# This variable will be used by GaudiToolbox.cmake to generate the cepcswenv.sh + +set(RUN_SCRIPT_EXTRA_COMMANDS "${RUN_SCRIPT_EXTRA_COMMANDS} +export CEPCSW_ROOT=${CMAKE_SOURCE_DIR} + +export DETCEPCV4ROOT=${CMAKE_SOURCE_DIR}/Detector/DetCEPCv4 +export DETCRDROOT=${CMAKE_SOURCE_DIR}/Detector/DetCRD +export DETDRIFTCHAMBERROOT=${CMAKE_SOURCE_DIR}/Detector/DetDriftChamber +") diff --git a/cmake/FindGenFit.cmake b/cmake/FindGenFit.cmake new file mode 100644 index 0000000000000000000000000000000000000000..6a3cf181bb45f63a5608fb6cc3eb8692fe1ef89b --- /dev/null +++ b/cmake/FindGenFit.cmake @@ -0,0 +1,55 @@ +# - Try to find GenFit +# Defines: +# +# GenFit_FOUND +# GenFit_INCLUDE_DIRS +# GenFit_LIBRARIES +# +# Imports: +# +# GenFit::genfit2 +# +# Usage of the target instead of the variables is advised + +# Find quietly if already found before +if(DEFINED CACHE{GenFit_INCLUDE_DIRS}) + set(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY YES) +endif() + +find_path(GenFit_INCLUDE_DIRS NAMES GFGbl.h + HINTS ${GENFIT_ROOT_DIR}/include $ENV{GENFIT_ROOT_DIR}/include + ${GenFit_DIR}/include $ENV{GenFit_DIR}/include + ${CMAKE_PREFIX_PATH}/include +) +find_library(GenFit_LIBRARIES NAMES genfit2 + HINTS $ENV{GENFIT_ROOT_DIR}/lib ${GENFIT_ROOT_DIR}/lib + ${GenFit_DIR}/lib ${GenFit_DIR}/lib64 + $ENV{GenFit_DIR}/lib $ENV{GenFit_DIR}/lib64 + ${CMAKE_PREFIX_PATH}/lib ${CMAKE_PREFIX_PATH}/lib64 +) + +# handle the QUIETLY and REQUIRED arguments and set GENFIT_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GenFit DEFAULT_MSG GenFit_INCLUDE_DIRS GenFit_LIBRARIES) + +mark_as_advanced(GenFit_FOUND GenFit_INCLUDE_DIRS GenFit_LIBRARIES) + +# Modernisation: create an interface target to link against +if(TARGET GenFit::genfit2) + return() +endif() +if(GenFit_FOUND) + add_library(GenFit::genfit2 IMPORTED INTERFACE) + target_include_directories(GenFit::genfit2 SYSTEM INTERFACE "${GenFit_INCLUDE_DIRS}") + target_link_libraries(GenFit::genfit2 INTERFACE "${GenFit_LIBRARIES}") + + # Display the imported target for the user to know + if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + message(STATUS " Import target: GenFit::genfit2") + endif() +endif() + +if(COMMAND __deprecate_var_for_target) + variable_watch(GenFit_INCLUDE_DIRS __deprecate_var_for_target) +endif() diff --git a/run.sh b/run.sh index d5739c556c2b6d2c6f3e6a9c00e815f6c2a9d898..991b9f174f543cb691dc22b1c1a670fd8a748a4f 100755 --- a/run.sh +++ b/run.sh @@ -62,8 +62,8 @@ function run-job() { ############################################################################## # The current default platform -lcg_platform=x86_64-slc6-gcc8-opt -lcg_version=97.0.2 +lcg_platform=x86_64-centos7-gcc8-opt +lcg_version=98.0.0 check-cepcsw-envvar || exit -1 diff --git a/setup.sh b/setup.sh index bf0d11953647b9626c0d71c8d206733fba7beb68..44ff6369a32f24d7c1ae39bde6748d9488c7329c 100644 --- a/setup.sh +++ b/setup.sh @@ -30,7 +30,7 @@ function cepcsw-external() { } function setup-external() { - local f=$(cepcsw-external)/setup.sh + local f=$(cepcsw-external)/setup-${CEPCSW_LCG_VERSION}.sh if [ ! -f $f ]; then error: "Failed to find setup script $f" return @@ -49,7 +49,7 @@ function setup-external() { # CEPCSW_LCG_VERSION=${1}; shift if [ -z "$CEPCSW_LCG_VERSION" ]; then - CEPCSW_LCG_VERSION=97.0.2 + CEPCSW_LCG_VERSION=98.0.0 fi export CEPCSW_LCG_VERSION