Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • maxt/CEPCSW
  • zyjonah/CEPCSW
  • wanjw03/CEPCSW
  • yudian2002/CEPCSW
  • starr136a/CEPCSW
  • fucd/CEPCSW
  • shuohan/CEPCSW
  • glliu/CEPCSW
  • zhangjinxian/CEPCSW_20250110
  • zhangyz/CEPCSW
  • shuxian/CEPCSW
  • lihp29/CEPCSW
  • zhangkl/CEPCSW
  • laipz/CEPCSW
  • lizhihao/CEPCSW
  • yudian2002/cepcsw-otk-endcap-update-01
  • xuchj7/CEPCSW
  • wuchonghao9612/CEPCSW
  • chenye/CEPCSW
  • zhangxm/CEPCSW
  • mengwq/CEPCSW
  • yudian2002/cepcsw-geo-upgrade-v-2
  • fangwx/CEPCSW
  • yudian2002/cepcsw-geo-upgrade
  • jiangxj/CEPCSW
  • yudian2002/cepcsw-otk-end-cap-development
  • guolei/CEPCSW
  • chenbp/CEPCSW
  • dhb112358/CEPCSW
  • tangyb/CEPCSW
  • luhc/CEPCSW
  • songwz/cepcsw-tdr
  • yudian2002/cepcsw-ote-development
  • yudian2002/cepcsw-otb-development
  • dudejing/CEPCSW
  • shexin/CEPCSW
  • sunwy/CEPCSW
  • 1810337/CEPCSW
  • cepcsw/CEPCSW
  • tyzhang/CEPCSW
  • fucd/CEPCSW1
  • xiaolin.wang/CEPCSW
  • wangchu/CEPCSW
  • 201840277/CEPCSW
  • zhaog/CEPCSW
  • shihy/cepcsw-dose
  • myliu/CEPCSW
  • thinking/CEPCSW
  • lihn/CEPCSW
  • 221840222/CEPCSW
  • gongjd1119/CEPCSW
  • tanggy/CEPCSW
  • lintao/CEPCSW
  • guofangyi/cepcsw-release
  • shihy/CEPCSW
  • 1365447033/CEPCSW
  • lizhan/CEPCSW
  • shixin/CEPCSW
  • cepc/CEPCSW
59 results
Show changes
Showing
with 966 additions and 252 deletions
#ifndef BackgroundBatch_hh
#define BackgroundBatch_hh
#include <cstdint>
#include <vector>
#include "TTimeStamp.h"
class BackgroundBatch {
public:
TTimeStamp start_time; // the start time of the batch
double duration; // the duration of the batch (in ns)
int num_events; // the number of events in the batch
// below are the metadata of each type of backgrouds in the batch
std::vector<int> event_numbers_groupby_type; // the number of events for each type
// below are the metadata of each event in the batch
std::vector<size_t> event_types; // the event types in the batch
std::vector<double> event_times; // the relative event times in the batch (in ns)
};
#endif
#ifndef BackgroundLoader_hh
#define BackgroundLoader_hh
#include "IBackgroundLoader.hh"
#include <iostream>
#include <vector>
#include <string>
#include <podio/Frame.h>
#include <podio/ROOTFrameReader.h>
class BackgroundLoader: public IBackgroundLoader {
public:
BackgroundLoader(const std::vector<std::string>& filenames) {
m_reader.openFiles(filenames);
m_max_evt = m_reader.getEntries(podio::Category::Event);
}
virtual ~BackgroundLoader() = default;
bool fill(BackgroundEvent& evt, const double current_time_in_ns) override {
// before load the next event, check whether end or not.
// if reach the end, then go back to the first event.
if (m_current_evt >= m_max_evt) {
m_current_evt = 0;
}
// get the frame of the current event
auto frame = podio::Frame(m_reader.readEntry(podio::Category::Event, m_current_evt));
// before unpack the hits, check the collections name to index map.
if (evt.collection_index.empty()) {
size_t idx = 0;
for (auto col_name: frame.getAvailableCollections()) {
// std::cout << "available collection: " << col_name << std::endl;
evt.collection_index[col_name] = idx;
++idx;
}
}
for (auto [name, colidx]: evt.collection_index) {
auto col_ = frame.get(name);
if (auto col = dynamic_cast<const edm4hep::SimTrackerHitCollection*>(col_)) {
auto& trk_col = evt.tracker_hits[colidx];
for (auto oldhit: *col) {
auto newhit = oldhit.clone();
newhit.setTime(oldhit.getTime() + current_time_in_ns);
newhit.setOverlay(true);
trk_col.push_back(newhit);
}
} else if (auto col = dynamic_cast<const edm4hep::SimCalorimeterHitCollection*>(col_)) {
auto& calo_col = evt.calorimeter_hits[colidx];
for (auto oldhit: *col) {
auto newhit = oldhit.clone();
// loop all the contributions and add the time.
for (auto contrib: oldhit.getContributions()) {
auto newcontrib = contrib.clone();
newcontrib.setTime(contrib.getTime() + current_time_in_ns);
newhit.addToContributions(newcontrib);
}
calo_col.push_back(newhit);
}
} else {
continue;
}
}
++m_current_evt;
return true;
}
private:
podio::ROOTFrameReader m_reader;
unsigned int m_current_evt{0};
unsigned int m_max_evt{0};
};
#endif
\ No newline at end of file
#include "DetSimMixingAlg.hh"
#include "GaudiKernel/IEventProcessor.h"
#include "GaudiKernel/IAppMgrUI.h"
#include "GaudiKernel/GaudiException.h"
#include "GaudiKernel/IRndmEngine.h"
#include <CLHEP/Random/RandExponential.h>
#include <CLHEP/Random/RandFlat.h>
#include <CLHEP/Random/RandPoisson.h>
#include "BackgroundLoader.hh"
DECLARE_COMPONENT(DetSimMixingAlg)
DetSimMixingAlg::DetSimMixingAlg(const std::string& name, ISvcLocator* pSvcLocator)
: Algorithm(name, pSvcLocator) {
}
StatusCode DetSimMixingAlg::initialize() {
StatusCode sc;
info() << "Initialize DetSimMixingAlg... " << endmsg;
// preparation according to user properties
if (m_background_rates.value().size() != m_background_filelists.value().size()) {
error() << "The size of the background rates and filelists should be the same." << endmsg;
return StatusCode::FAILURE;
}
for (auto [type, rate]: m_background_rates.value()) {
if (m_background_filelists.value().find(type) == m_background_filelists.value().end()) {
error() << "The input file lists for the background type " << type << " is not provided." << endmsg;
return StatusCode::FAILURE;
}
m_event_types.push_back(type);
m_event_rates.push_back(rate);
m_input_lists.push_back(m_background_filelists.value()[type]);
}
// prepare the loaders
for (size_t i = 0; i < m_event_types.size(); ++i) {
m_total_rates += m_event_rates[i];
m_event_loaders.push_back(new BackgroundLoader(m_input_lists[i]));
}
if (m_total_rates <= 0) {
error() << "The total rate of the background events should be positive." << endmsg;
return StatusCode::FAILURE;
}
m_total_tau = 1.0 / m_total_rates;
info() << "Summary of the background events: " << endmsg;
for (size_t i = 0; i < m_event_types.size(); ++i) {
info() << " Event type: " << m_event_types[i] << ", rate: " << m_event_rates[i] << " Hz" << endmsg;
}
return sc;
}
StatusCode DetSimMixingAlg::execute() {
StatusCode sc;
info() << "Execute DetSimMixingAlg... " << endmsg;
// ========================================================================
// Prepare the batches
// ========================================================================
std::vector<BackgroundBatch> batches;
int nbatches = 5;
double duration = 1e3; // 1 us = 1,000 ns of each batch
TTimeStamp start_time;
for (int i = 0; i < nbatches; i++) {
BackgroundBatch batch;
batch.start_time = start_time + TTimeStamp(0, static_cast<int>(i*duration));
batch.duration = duration;
// todo: need to sample according to the rate
batch.num_events = 0;
for (size_t evttype = 0; evttype < m_event_types.size(); ++evttype) {
batch.event_numbers_groupby_type.push_back(0);
}
double current_time = 0;
while (true) {
// sampling and get an event
size_t selected_evttype = 0;
double r = CLHEP::RandFlat::shoot(m_total_rates);
double accumulated = 0;
for (size_t evttype = 0; evttype < m_event_types.size(); ++evttype) {
accumulated += m_event_rates[evttype];
if (r < accumulated) {
selected_evttype = evttype;
break;
}
}
// sampling the time
current_time += CLHEP::RandExponential::shoot(m_total_tau)*1e9; // ns
if (current_time > duration) {
break;
}
// add the event to Batch.
++batch.num_events;
batch.event_types.push_back(selected_evttype);
batch.event_times.push_back(current_time);
batch.event_numbers_groupby_type[selected_evttype] += 1;
}
batches.push_back(batch);
}
// ========================================================================
// Unpack the hits from Loader and fill the existing hits into collections
// of BackgroundEvent.
// ========================================================================
BackgroundEvent bkg_evt;
for (size_t i = 0; i < batches.size(); ++i) {
const BackgroundBatch& batch = batches[i];
for (size_t j = 0; j < batch.num_events; ++j) {
size_t evttype = batch.event_types[j];
double evttime = batch.event_times[j];
IBackgroundLoader* loader = m_event_loaders[evttype];
if (not loader->fill(bkg_evt, evttime)) {
error() << "Failed to load the next event." << endmsg;
return StatusCode::FAILURE;
}
}
}
// dump the information
for (auto [name, idx]: bkg_evt.collection_index) {
info() << "Collection: " << name << ", index: " << idx;
if (bkg_evt.tracker_hits.count(idx)) {
info() << " Tracker hits: " << bkg_evt.tracker_hits[idx].size() << endmsg;
} else if (bkg_evt.calorimeter_hits.count(idx)) {
info() << " Calorimeter hits: " << bkg_evt.calorimeter_hits[idx].size() << endmsg;
} else {
info() << endmsg;
}
}
// ========================================================================
// Put the BackgroundEvent into the event store
// ========================================================================
return sc;
}
StatusCode DetSimMixingAlg::finalize() {
StatusCode sc;
info() << "Finalize DetSimMixingAlg... " << endmsg;
return sc;
}
\ No newline at end of file
#ifndef DetSimMixingAlg_hh
#define DetSimMixingAlg_hh
/*
* Description:
* This algorithm is used to generate a mixing event.
* Assume there will be one physics event and multiple background events.
*
* The main algorithm first creates enough BackgroundBatch instances.
* All the metadata will be prepared into the batch.
* Then, the main algorithm will start the mixing and load the real hits.
* The reason to unpack the hits in main algorithm is to reduce the data copy.
*
* About the BackgroundBatch:
*
* -----------------------------------------------> time
* | o x o o x |
* | | |
* | | \-> group by event type 'x', num of events = 2
* | -> group by event type 'o', num of events = 3
* \-> start time
*
* For each event, it consists of several collections. For one batch:
*
* | EventType | Collection 1 | Collection 2 | ... | Collection N |
* | o | | | ... | |
* | x | | | ... | |
* | o | | | ... | |
* | o | | | ... | |
* | x | | | ... | |
*
* The main algorithm needs to loop BackgroundLoader and unpack the collections.
* For each iteration in the loop of the above table, a current event could be accessed.
* According to the current event, the main algorithm could unpack the collections.
*
* Authors:
* Tao Lin <lintao AT ihep.ac.cn>
*/
#include <string>
#include <vector>
#include <map>
#include <GaudiKernel/Algorithm.h>
#include <Gaudi/Property.h>
#include <GaudiKernel/ToolHandle.h>
#include "k4FWCore/DataHandle.h"
#include "BackgroundBatch.hh"
#include "IBackgroundLoader.hh"
class DetSimMixingAlg: public Algorithm {
public:
DetSimMixingAlg(const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize() override;
StatusCode execute() override;
StatusCode finalize() override;
private:
double m_total_rates{0}; // Hz.
double m_total_tau{0}; // s. the total time of the background events
private:
std::vector<std::string> m_event_types; // the event types of the background events
std::vector<double> m_event_rates; // the rates of the background events
std::vector<IBackgroundLoader*> m_event_loaders; // the loaders of the background events
std::vector<std::vector<std::string>> m_input_lists; // input files for each backgroud
private:
// properties for user side
Gaudi::Property<std::map<std::string, double>> m_background_rates{this, "BackgroundRates", {}, "The rates of the background events"};
Gaudi::Property<std::map<std::string, std::vector<std::string>>> m_background_filelists{this, "BackgroundFileLists", {}, "The input file lists for the background events"};
};
#endif
#ifndef IBackgroundLoader_hh
#define IBackgroundLoader_hh
#include "BackgroundBatch.hh"
#include <map>
#include "edm4hep/SimTrackerHitCollection.h"
#include "edm4hep/SimCalorimeterHitCollection.h"
#include "edm4hep/CaloHitContributionCollection.h"
/*
* Description:
* As there are multiple collections for one event, this BackgrounEvent
* is used to organize these collections.
*
* The key is the index of collection.
*
* BackgroundLoader is resposible to fill its hit collections into the
* BackgroundEvent.
*/
struct BackgroundEvent {
std::map<size_t, edm4hep::SimTrackerHitCollection> tracker_hits;
std::map<size_t, edm4hep::SimCalorimeterHitCollection> calorimeter_hits;
std::map<size_t, edm4hep::CaloHitContributionCollection> calo_contribs;
std::map<std::string, size_t> collection_index; // key is collection name, value is index.
};
class IBackgroundLoader {
public:
virtual ~IBackgroundLoader() = default;
// the loader is responsible to unpack the hits into background event.
// if failed, then return false.
virtual bool fill(BackgroundEvent& bkg_event, const double current_time_in_ns) = 0;
};
#endif
\ No newline at end of file
......@@ -33,6 +33,10 @@ CaloSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*) {
// std::cout << "CaloSensitiveDetector::ProcessHits" << std::endl;
dd4hep::sim::Geant4StepHandler h(step);
// if there is no deposit energy, don't create hit object
if (h.deposit() <= 0) return true;
if(m_applyBirksLaw) h.doApplyBirksLaw();
dd4hep::Position pos = 0.5 * (h.prePos() + h.postPos());
HitContribution contrib = dd4hep::sim::Geant4Hit::extractContribution(step);
......
......@@ -23,10 +23,9 @@ void MuonBarrelSensitiveDetector::Initialize(G4HCofThisEvent* HCE){
}
G4bool MuonBarrelSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*){
G4TouchableHandle touchPost = step->GetPostStepPoint()->GetTouchableHandle();
G4TouchableHandle touchPre = step->GetPreStepPoint()->GetTouchableHandle();
dd4hep::sim::Geant4StepHandler h(step);
//if (fabs(h.trackDef()->GetPDGCharge()) < 0.01) return true;
if (h.deposit() <= 0 && !Geant4Hit::isGeantino(step->GetTrack())) return true;
dd4hep::Position prePos = h.prePos();
dd4hep::Position postPos = h.postPos();
......
......@@ -24,10 +24,9 @@ void MuonEndcapSensitiveDetector::Initialize(G4HCofThisEvent* HCE){
}
G4bool MuonEndcapSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*){
G4TouchableHandle touchPost = step->GetPostStepPoint()->GetTouchableHandle();
G4TouchableHandle touchPre = step->GetPreStepPoint()->GetTouchableHandle();
dd4hep::sim::Geant4StepHandler h(step);
//if (fabs(h.trackDef()->GetPDGCharge()) < 0.01) return true;
if (h.deposit() <= 0 && !Geant4Hit::isGeantino(step->GetTrack())) return true;
dd4hep::Position prePos = h.prePos();
dd4hep::Position postPos = h.postPos();
......
......@@ -35,6 +35,10 @@ private:
double _relative_position_of_measurement_surface;
double _shellInnerR;
double _shellOuterR;
double _shellHalfZ;
struct VXD_Layer {
int nLadders;
double phi0;
......
......@@ -207,7 +207,8 @@ void CEPCOTKEndcapKalDetector::create_segmented_disk_layers(int idisk, int nsegm
double eps3 = 1.0e-06 ; // layer in disk
double eps4 = 1.0e-08 ; // forward or backwards
double sort_policy = rInner+height + eps1 * idisk + eps3 * 1;
//double sort_policy = rInner+height + eps1 * idisk + eps3 * 1;
double sort_policy = fabs(z) + eps1 * idisk + eps3 * 1;
if (!even_petals) sort_policy += eps2;
// if this is the negative z disk add epsilon to the policy
......@@ -228,7 +229,7 @@ void CEPCOTKEndcapKalDetector::create_segmented_disk_layers(int idisk, int nsegm
// measurement plane
z += zsign*0.5*senThickness;
//sort_policy = fabs(z) ;
sort_policy = rInner+height + eps1 * idisk + eps3 * 2 ;
sort_policy = fabs(z) + eps1 * idisk + eps3 * 2 ;
if (z < 0) sort_policy += eps4 ;
if (!even_petals) sort_policy += eps2;
......@@ -266,7 +267,7 @@ void CEPCOTKEndcapKalDetector::create_segmented_disk_layers(int idisk, int nsegm
// interface between sensitive and support
z += zsign*0.5*senThickness;
// sort_policy = fabs(z) ;
sort_policy = rInner+height + eps1 * idisk + eps3 * 3;
sort_policy = fabs(z) + eps1 * idisk + eps3 * 3;
if (z < 0) sort_policy += eps4;
if (!even_petals) sort_policy += eps2;
......@@ -289,7 +290,7 @@ void CEPCOTKEndcapKalDetector::create_segmented_disk_layers(int idisk, int nsegm
// interface between support and sensitive
z += zsign*supThickness;
// sort_policy = fabs(z) ;
sort_policy = rInner+height + eps1 * idisk + eps3 * 4;
sort_policy = fabs(z) + eps1 * idisk + eps3 * 4;
if (z < 0) sort_policy += eps4;
if (!even_petals) sort_policy += eps2;
......@@ -309,7 +310,7 @@ void CEPCOTKEndcapKalDetector::create_segmented_disk_layers(int idisk, int nsegm
// measurement plane at the back
z += zsign*0.5*senThickness;
// sort_policy = fabs(z) ;
sort_policy = rInner+height + eps1 * idisk + eps3 * 5;
sort_policy = fabs(z) + eps1 * idisk + eps3 * 5;
if (z < 0) sort_policy += eps4;
if (!even_petals) {
sort_policy += eps2;
......@@ -349,7 +350,7 @@ void CEPCOTKEndcapKalDetector::create_segmented_disk_layers(int idisk, int nsegm
// rear face of sensitive
z += zsign*0.5*senThickness;
// sort_policy = fabs(z) ;
sort_policy = rInner+height + eps1 * idisk + eps3 * 6;
sort_policy = fabs(z) + eps1 * idisk + eps3 * 6;
if (z < 0) sort_policy += eps4;
if (!even_petals) sort_policy += eps2;
......@@ -371,7 +372,7 @@ void CEPCOTKEndcapKalDetector::create_segmented_disk_layers(int idisk, int nsegm
// rear face of support
z += zsign*supThickness;
// sort_policy = fabs(z) ;
sort_policy = rInner+height + eps1 * idisk + eps3 * 4;
sort_policy = fabs(z) + eps1 * idisk + eps3 * 4;
if (z < 0) sort_policy += eps4;
if (!even_petals) sort_policy += eps2;
......
......@@ -17,6 +17,7 @@
#include "kaldet/ILDSegmentedDiscMeasLayer.h"
#include "kaldet/ILDDiscMeasLayer.h"
#include "kaldet/ILDCylinderMeasLayer.h"
#include "streamlog/streamlog.h"
#include "CLHEP/Units/SystemOfUnits.h"
......@@ -43,6 +44,11 @@ void CEPCITKEndcapKalDetector::build() {
streamlog_out(DEBUG) << "CEPCITKEndcapKalDetector::build " << std::endl;
double eps = 1e-9;
double eps1 = 1.0e-04; // disk
double eps2 = 1.0e-05; // odd or even
double eps3 = 1.0e-06; // layer in disk
//double eps4 = 1.0e-07; // ring
double eps5 = 1.0e-08; // forward or backwards
int ndisks = _disksData.layers.size();
for (int idisk = 0; idisk < ndisks; idisk++) {
......@@ -58,6 +64,7 @@ void CEPCITKEndcapKalDetector::build() {
double rmaxSupport = disk.rmaxSupport;
double thicknessSupport = disk.thicknessSupport;
int nrings = rings.size();
double thicknessTotal = 0;
for (int iring = 0; iring < nrings; iring++) {
auto& ring = rings[iring];
......@@ -67,6 +74,11 @@ void CEPCITKEndcapKalDetector::build() {
double widthInner = ring.widthInner;
double widthOuter = ring.widthOuter;
double length = ring.length;
double tSensitive = ring.thicknessSensitive;
double tGlue = ring.thicknessGlue;
double tService = ring.thicknessService;
double thickness = tSensitive + tGlue + tService;
if (thickness > thicknessTotal) thicknessTotal = thickness;
int nsegments = npetals/2;
this->create_segmented_disk_layers(idisk, iring, nsegments, true, phi0, zPosition);
......@@ -74,7 +86,7 @@ void CEPCITKEndcapKalDetector::build() {
// odd segements
// update phi0 by the angular distance of one petal
phi0 -= 2.0 * M_PI / npetals;
phi0 += 2.0 * M_PI / npetals;
this->create_segmented_disk_layers(idisk, iring, nsegments, false, phi0, zPosition);
this->create_segmented_disk_layers(idisk, iring, nsegments, false, phi0, -zPosition);
}
......@@ -84,33 +96,53 @@ void CEPCITKEndcapKalDetector::build() {
Bool_t dummy = false;
double z0 = zPosition - 0.5*thicknessSupport + eps;
double z_front = zPosition - 0.5*thicknessSupport + eps;
streamlog_out(DEBUG) << "CEPCITKEndcapKalDetector::create air support disk at " << z0 << " sort_policy = " << fabs(z0) << std::endl;
TVector3 xc0_fwd(0.0, 0.0, z0);
TVector3 normal0_fwd(xc0_fwd);
normal0_fwd.SetMag(1.0);
Add(new ILDDiscMeasLayer(air, support, xc0_fwd, normal0_fwd, _bZ, fabs(z0), rminSupport, rmaxSupport, dummy, -1, "ITKEAirSupportDiscPositiveZ"));
TVector3 xc0_bwd(0.0, 0.0, -z0);
TVector3 normal0_bwd(xc0_bwd);
normal0_bwd.SetMag(1.0);
Add(new ILDDiscMeasLayer(support, air, xc0_bwd, normal0_bwd, _bZ, fabs(z0), rminSupport, rmaxSupport, dummy, -1, "ITKEAirSupportDiscNegativeZ"));
double z1 = zPosition + 0.5*thicknessSupport - eps;
TVector3 xc1_fwd(0.0, 0.0, z1);
TVector3 normal1_fwd(xc1_fwd);
normal1_fwd.SetMag(1.0);
Add(new ILDDiscMeasLayer(air, support, xc1_fwd, normal1_fwd, _bZ, fabs(z1), rminSupport, rmaxSupport, dummy, -1, "ITKESupportAirDiscPositiveZ"));
TVector3 xc1_bwd(0.0, 0.0, -z1);
TVector3 normal1_bwd(xc1_bwd);
normal1_bwd.SetMag(1.0);
Add(new ILDDiscMeasLayer(support, air, xc1_bwd, normal1_bwd, _bZ, fabs(z1), rminSupport, rmaxSupport, dummy, -1, "ITKESupportAirDiscNegativeZ"));
double sort_policy = rmaxSupport + idisk * eps1 + 6 * eps3;
streamlog_out(DEBUG) << "CEPCITKEndcapKalDetector::create air support disk at " << z_front << " sort_policy = " << sort_policy << std::endl;
TVector3 normal_fwd(0, 0, 1);
TVector3 normal_bwd(0, 0,-1);
TVector3 xc_front_fwd(0.0, 0.0, z_front);
Add(new ILDDiscMeasLayer(air, support, xc_front_fwd, normal_fwd, _bZ, sort_policy, rminSupport, rmaxSupport, dummy, -1, "ITKEAirSupportDiscPositiveZ"));
TVector3 xc_front_bwd(0.0, 0.0, -z_front);
Add(new ILDDiscMeasLayer(air, support, xc_front_bwd, normal_bwd, _bZ, sort_policy+eps5, rminSupport, rmaxSupport, dummy, -1, "ITKEAirSupportDiscNegativeZ"));
double z_rear = zPosition + 0.5*thicknessSupport - eps;
TVector3 xc_rear_fwd(0.0, 0.0, z_rear);
Add(new ILDDiscMeasLayer(support, air, xc_rear_fwd, normal_fwd, _bZ, sort_policy+eps3, rminSupport, rmaxSupport, dummy, -1, "ITKESupportAirDiscPositiveZ"));
TVector3 xc_rear_bwd(0.0, 0.0, -z_rear);
Add(new ILDDiscMeasLayer(support, air, xc_rear_bwd, normal_bwd, _bZ, sort_policy+eps3+eps5, rminSupport, rmaxSupport, dummy, -1, "ITKESupportAirDiscNegativeZ"));
double inner_radius = rminSupport - idisk * eps1;
double outer_radius = rmaxSupport + idisk * eps1 + 2 * eps2;
Add(new ILDCylinderMeasLayer(air, air, inner_radius, 0.5*thicknessSupport+thicknessTotal+eps, 0, 0, zPosition, _bZ, dummy, -1, "ITKEInnerEdgePositiveZ"));
Add(new ILDCylinderMeasLayer(air, air, inner_radius, 0.5*thicknessSupport+thicknessTotal+eps, 0, 0, -zPosition, _bZ, dummy, -1, "ITKEInnerEdgeNegativeZ"));
sort_policy = rmaxSupport + idisk * eps1;
TVector3 xc_front_edge_fwd(0.0, 0.0, zPosition - 0.5*thicknessSupport - thicknessTotal - eps);
Add(new ILDDiscMeasLayer(air, air, xc_front_edge_fwd, normal_fwd, _bZ, sort_policy, inner_radius, outer_radius, dummy, -1, "ITKEFrontEdgePositiveZ"));
TVector3 xc_front_edge_bwd(0.0, 0.0, -zPosition + 0.5*thicknessSupport + thicknessTotal + eps);
Add(new ILDDiscMeasLayer(air, air, xc_front_edge_bwd, normal_bwd, _bZ, sort_policy+eps5, inner_radius, outer_radius, dummy, -1, "ITKEFrontEdgeNegativeZ"));
Add(new ILDCylinderMeasLayer(air, air, outer_radius, 0.5*thicknessSupport+thicknessTotal+eps, 0, 0, zPosition, _bZ, dummy, -1, "ITKEOuterEdgePositiveZ"));
Add(new ILDCylinderMeasLayer(air, air, outer_radius, 0.5*thicknessSupport+thicknessTotal+eps, 0, 0, -zPosition, _bZ, dummy, -1, "ITKEOuterEdgeNegativeZ"));
sort_policy = rmaxSupport + idisk * eps1 + 3 * eps2;
TVector3 xc_rear_edge_fwd(0.0, 0.0, zPosition + 0.5*thicknessSupport + thicknessTotal + eps);
Add(new ILDDiscMeasLayer(air, air, xc_rear_edge_fwd, normal_fwd, _bZ, sort_policy, inner_radius, outer_radius, dummy, -1, "ITKERearEdgePositiveZ"));
TVector3 xc_rear_edge_bwd(0.0, 0.0, -zPosition - 0.5*thicknessSupport - thicknessTotal - eps);
Add(new ILDDiscMeasLayer(air, air, xc_rear_edge_bwd, normal_bwd, _bZ, sort_policy+eps5, inner_radius, outer_radius, dummy, -1, "ITKERearEdgeNegativeZ"));
}
streamlog_out(DEBUG1) << "MultiRingsZDisk based ITKEndcap MeasLayer created" << std::endl;
}
void CEPCITKEndcapKalDetector::create_segmented_disk_layers(int idisk, int iring, int nsegments, bool even_petals, double phi0, double zpos) {
......@@ -141,16 +173,19 @@ void CEPCITKEndcapKalDetector::create_segmented_disk_layers(int idisk, int iring
}
// create segmented disk
double rmaxSupport = _disksData.layers[idisk].rmaxSupport;
double eps1 = 1.0e-04; // ring
double eps1 = 1.0e-04; // disk
double eps2 = 1.0e-05; // odd or even
double eps3 = 1.0e-06; // layer in disk
double eps4 = 1.0e-08; // forward or backwards
double eps4 = 1.0e-07; // ring
double eps5 = 1.0e-08; // forward or backwards
//double sort_policy = fabs(z);
//double sort_policy = rInner+height + eps1 * idisk + eps3 * 1 ;
double sort_policy = eps1 * iring;
//double sort_policy = eps1 * iring;
double sort_policy = rmaxSupport + eps1 * idisk + eps3 + eps4 * iring;
if (!even_petals) sort_policy += eps2;
if (zpos < 0) sort_policy += eps4;
if (zpos < 0) sort_policy += eps5;
double tSupport = _disksData.layers[idisk].thicknessSupport;
double tSensitive = _disksData.layers[idisk].rings[iring].thicknessSensitive;
......@@ -167,26 +202,26 @@ void CEPCITKEndcapKalDetector::create_segmented_disk_layers(int idisk, int iring
TMaterial& rear = even_petals ? glue : service;
double z = even_petals ? zpos - zsign*(0.5*tSupport + tRear + tSensitive + tFront) : zpos + zsign*(0.5*tSupport);
streamlog_out(DEBUG1) << "CEPCITKEndcapKalDetector::create_segmented_disk add front face of sensitive at " << z << " sort_policy = " << fabs(z)+sort_policy << std::endl;
streamlog_out(DEBUG1) << "CEPCITKEndcapKalDetector::create_segmented_disk add front face of sensitive at " << z << " sort_policy = " << sort_policy << std::endl;
const char *name1 = z > 0 ? "ITKEFrontFacePositiveZ" : "ITKEFrontFaceNegativeZ";
Add(new ILDSegmentedDiscMeasLayer(air, front, _bZ, fabs(z)+sort_policy, nsegments, z, phi0, rInner, height, widthInner, widthOuter, dummy, name1));
const char *name1 = z > 0 ? (even_petals ? "ITKEFrontFacePositiveZ_even" : "ITKEFrontFacePositiveZ_odd") : (even_petals ? "ITKEFrontFaceNegativeZ_even" : "ITKEFrontFaceNegativeZ_odd");
Add(new ILDSegmentedDiscMeasLayer(air, front, _bZ, sort_policy, nsegments, z, phi0, rInner, height, widthInner, widthOuter, dummy, name1));
z += zsign*tFront;
const char *name2 = z > 0 ? "ITKEFrontPositiveZ" : "ITKEFrontNegativeZ";
Add(new ILDSegmentedDiscMeasLayer(front, silicon, _bZ, fabs(z)+sort_policy, nsegments, z, phi0, rInner, height, widthInner, widthOuter, dummy, name2));
const char *name2 = z > 0 ? (even_petals ? "ITKEFrontPositiveZ_even" : "ITKEFrontPositiveZ_odd") : (even_petals ? "ITKEFrontNegativeZ_even" : "ITKEFrontNegativeZ_odd");
Add(new ILDSegmentedDiscMeasLayer(front, silicon, _bZ, sort_policy+eps3, nsegments, z, phi0, rInner, height, widthInner, widthOuter, dummy, name2));
z += zsign*0.5*tSensitive;
const char *name3 = z > 0 ? "ITKESenPositiveZ" : "ITKESenNegativeZ";
Add( new ILDSegmentedDiscMeasLayer(silicon, silicon, _bZ, fabs(z)+sort_policy, nsegments, z, phi0, rInner, height, widthInner, widthOuter, active, module_ids, name3));
const char *name3 = z > 0 ? (even_petals ? "ITKESenPositiveZ_even" : "ITKESenPositiveZ_odd") : (even_petals ? "ITKESenNegativeZ_even" : "ITKESenNegativeZ_odd");
Add( new ILDSegmentedDiscMeasLayer(silicon, silicon, _bZ, sort_policy+2*eps3, nsegments, z, phi0, rInner, height, widthInner, widthOuter, active, module_ids, name3));
z += zsign*0.5*tSensitive;
const char *name4 = z > 0 ? "ITKERearPositiveZ" : "ITKERearNegativeZ";
Add( new ILDSegmentedDiscMeasLayer(silicon, rear, _bZ, fabs(z)+sort_policy, nsegments, z, phi0, rInner, height, widthInner, widthOuter, dummy, name4));
const char *name4 = z > 0 ? (even_petals ? "ITKERearPositiveZ_even" : "ITKERearPositiveZ_odd") : (even_petals ? "ITKERearNegativeZ_even" : "ITKERearNegativeZ_odd");
Add( new ILDSegmentedDiscMeasLayer(silicon, rear, _bZ, sort_policy+3*eps3, nsegments, z, phi0, rInner, height, widthInner, widthOuter, dummy, name4));
z += zsign*tRear;
const char *name5 = z > 0 ? "ITKERearFacePositiveZ" : "ITKERearFaceNegativeZ";
Add(new ILDSegmentedDiscMeasLayer(rear, air, _bZ, fabs(z)+sort_policy, nsegments, z, phi0, rInner, height, widthInner, widthOuter, dummy, name5));
const char *name5 = z > 0 ? (even_petals ? "ITKERearFacePositiveZ_even" : "ITKERearFacePositiveZ_odd") : (even_petals ? "ITKERearFaceNegativeZ_even" : "ITKERearFaceNegativeZ_odd");
Add(new ILDSegmentedDiscMeasLayer(rear, air, _bZ, sort_policy+4*eps3, nsegments, z, phi0, rInner, height, widthInner, widthOuter, dummy, name5));
}
void CEPCITKEndcapKalDetector::setupGearGeom(const gear::GearMgr& gearMgr) {
......
......@@ -2,6 +2,7 @@
#include "kaldet/CEPCITKKalDetector.h"
#include "kaldet/MaterialDataBase.h"
#include "kaldet/ILDParallelPlanarStripMeasLayer.h"
#include "kaldet/ILDCylinderMeasLayer.h"
#include <UTIL/BitField64.h>
#include <UTIL/ILDConf.h>
......@@ -80,6 +81,11 @@ CEPCITKKalDetector::CEPCITKKalDetector( const gear::GearMgr& gearMgr, IGeomSvc*
const double width = _ITKgeo[layer].width ;
const double length = _ITKgeo[layer].length;
double nonoverlap_width = width / 2.0;
double nonoverlap_offset = offset - offset/fabs(offset) * (width/2.0 - nonoverlap_width/2.0);
double overlap_width = width - nonoverlap_width;
double overlap_offset = offset + offset/fabs(offset) * (width/2.0 - overlap_width/2.0);
double currPhi;
const double dphi = _ITKgeo[layer].dphi ;
......@@ -103,63 +109,142 @@ CEPCITKKalDetector::CEPCITKKalDetector( const gear::GearMgr& gearMgr, IGeomSvc*
encoder[lcio::ILDCellID0::side] = 0 ;
encoder[lcio::ILDCellID0::layer] = layer ;
encoder[lcio::ILDCellID0::module] = ladder ;
int nsort = offset > 0 ? (nLadders - ladder)%nLadders : ladder;
// check if the sensitive is inside or outside for the support
if( sensitive_distance < ladder_distance ) {
double sen_front_sorting_policy = sensitive_distance + (4 * ladder+0) * eps_layer ;
double sen_back_sorting_policy = sensitive_distance + (4 * ladder+2) * eps_layer ;
double sup_back_sorting_policy = ladder_distance + (4 * ladder+3) * eps_layer ;
// air - sensitive boundary
Add(new ILDParallelPlanarMeasLayer(air, silicon, sensitive_distance, currPhi, _bZ, sen_front_sorting_policy, width, length, offset, z_centre_support, offset, dummy,-1,"ITKSenFront")) ;
double sen_front_sorting_policy = sensitive_distance + (4 * nsort + 0) * eps_layer;
double sen_back_sorting_policy = sensitive_distance + (4 * nsort + 2) * eps_layer;
double sup_back_sorting_policy = sensitive_distance + (4 * nsort + 3) * eps_layer;
// overlap sorting policy uses nLadders as the overlapping "ladder" is the order i.e. there will now be nLadders+1
double overlap_front_sorting_policy = sensitive_distance + (4 * nLadders + 0) * eps_layer;
double overlap_back_sorting_policy = sensitive_distance + (4 * nLadders + 2) * eps_layer;
double overlap_sup_back_sorting_policy = sensitive_distance + (4 * nLadders + 3) * eps_layer;
// air - sensitive boundary
if (ladder == 0) {
double overlap_front_sorting_policy = sensitive_distance + (4 * nLadders + 0) * eps_layer;
Add(new ILDParallelPlanarMeasLayer(air, silicon, sensitive_distance, currPhi, _bZ, sen_front_sorting_policy,
nonoverlap_width, length, nonoverlap_offset, z_centre_support, offset, dummy, -1, "ITKSenFront_nonoverlap"));
Add(new ILDParallelPlanarMeasLayer(air, silicon, sensitive_distance, currPhi, _bZ, overlap_front_sorting_policy,
overlap_width, length, overlap_offset, z_centre_support, offset, dummy, -1, "ITKSenFront_nonoverlap"));
}
else {
Add(new ILDParallelPlanarMeasLayer(air, silicon, sensitive_distance, currPhi, _bZ, sen_front_sorting_policy,
width, length, offset, z_centre_support, offset, dummy, -1, "ITKSenFront"));
}
for (int isensor=0; isensor<nsensors; ++isensor) {
encoder[lcio::ILDCellID0::sensor] = isensor ;
int CellID = encoder.lowWord() ;
double measurement_plane_sorting_policy = sensitive_distance + (4 * ladder+1) * eps_layer + eps_sensor * isensor ;
double measurement_plane_sorting_policy = sensitive_distance + (4 * nsort + 1) * eps_layer + eps_sensor * isensor;
double overlap_measurement_plane_sorting_policy = sensitive_distance + (4 * nLadders + 1) * eps_layer + eps_sensor * isensor;
double z_centre_sensor = -0.5*length + (0.5*sensor_length) + (isensor%(nsensors/nrow))*sensor_length;
if (z_centre_sensor>0) z_centre_sensor += gap;
if (_isStripDetector) {
// measurement plane defined as the middle of the sensitive volume
Add(new ILDParallelPlanarStripMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy, width, sensor_length, offset, z_centre_sensor, offset, stripAngle, CellID, "ITKStripMeaslayer")) ;
if (ladder == 0) {
Add(new ILDParallelPlanarStripMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy,
nonoverlap_width, sensor_length, nonoverlap_offset, z_centre_sensor, offset, stripAngle, CellID,
"ITKStripMeaslayer_nonoverlap"));
Add(new ILDParallelPlanarStripMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, overlap_measurement_plane_sorting_policy,
overlap_width, sensor_length, overlap_offset, z_centre_sensor, offset, stripAngle, CellID,
"ITKStripMeaslayer_overlap"));
}
else {
Add(new ILDParallelPlanarStripMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy,
width, sensor_length, offset, z_centre_sensor, offset, stripAngle, CellID, "ITKStripMeaslayer"));
}
}
else {
// measurement plane defined as the middle of the sensitive volume
Add(new ILDParallelPlanarMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy, width, sensor_length, offset, z_centre_sensor, offset, true, CellID, "ITKMeaslayer")) ;
if (ladder == 0) {
Add(new ILDParallelPlanarMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy,
nonoverlap_width, sensor_length, nonoverlap_offset, z_centre_sensor, offset, true, CellID, "ITKMeaslayer_nonoverlap"));
Add(new ILDParallelPlanarMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, overlap_measurement_plane_sorting_policy,
overlap_width, sensor_length, overlap_offset, z_centre_sensor, offset, true, CellID, "ITKMeaslayer_overlap"));
}
else {
Add(new ILDParallelPlanarMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy,
width, sensor_length, offset, z_centre_sensor, offset, true, CellID, "ITKMeaslayer"));
}
}
//std::cout << "CEPCITKKalDetector add surface with CellID = " << CellID << std::endl ;
}
// sensitive - support boundary
Add(new ILDParallelPlanarMeasLayer(silicon, carbon, sensitive_distance+sensitive_thickness, currPhi, _bZ, sen_back_sorting_policy, width, length, offset, z_centre_support, offset, dummy,-1,"ITKSenSupportIntf" )) ;
// sensitive - support boundary
if (ladder == 0) {
Add(new ILDParallelPlanarMeasLayer(silicon, carbon, sensitive_distance+sensitive_thickness, currPhi, _bZ, sen_back_sorting_policy,
nonoverlap_width, length, nonoverlap_offset, z_centre_support, offset, dummy, -1, "ITKSenSupportIntf_nonoverlap"));
Add(new ILDParallelPlanarMeasLayer(silicon, carbon, sensitive_distance+sensitive_thickness, currPhi, _bZ, overlap_back_sorting_policy,
overlap_width, length, overlap_offset, z_centre_support, offset, dummy, -1, "ITKSenSupportIntf_overlap"));
}
else {
Add(new ILDParallelPlanarMeasLayer(silicon, carbon, sensitive_distance+sensitive_thickness, currPhi, _bZ, sen_back_sorting_policy,
width, length, offset, z_centre_support, offset, dummy, -1, "ITKSenSupportIntf"));
}
// support - air boundary
Add(new ILDParallelPlanarMeasLayer(carbon, air, ladder_distance+ladder_thickness, currPhi, _bZ, sup_back_sorting_policy, width, length, offset, z_centre_support, offset, dummy,-1,"ITKSupRear" )) ;
if (ladder == 0) {
Add(new ILDParallelPlanarMeasLayer(carbon, air, ladder_distance+ladder_thickness, currPhi, _bZ, sup_back_sorting_policy,
nonoverlap_width, length, nonoverlap_offset, z_centre_support, offset, dummy, -1, "ITKSupRear_nonoverlap"));
Add(new ILDParallelPlanarMeasLayer(carbon, air, ladder_distance+ladder_thickness, currPhi, _bZ, overlap_sup_back_sorting_policy,
overlap_width, length, overlap_offset, z_centre_support, offset, dummy, -1, "ITKSupRear_overlap"));
}
else {
Add(new ILDParallelPlanarMeasLayer(carbon, air, ladder_distance+ladder_thickness, currPhi, _bZ, sup_back_sorting_policy,
width, length, offset, z_centre_support, offset, dummy, -1, "ITKSupRear"));
}
}
else {
double sup_front_sorting_policy = ladder_distance + (4 * ladder+0) * eps_layer ;
double sen_front_sorting_policy = sensitive_distance + (4 * ladder+1) * eps_layer ;
double sen_back_sorting_policy = sensitive_distance + (4 * ladder+3) * eps_layer ;
// air - support boundary
Add(new ILDParallelPlanarMeasLayer(air, carbon, ladder_distance, currPhi, _bZ, sup_front_sorting_policy, width, length, offset, z_centre_support, offset, dummy,-1,"ITKSupFront")) ;
// support boundary - sensitive
Add(new ILDParallelPlanarMeasLayer(carbon, silicon, sensitive_distance, currPhi, _bZ, sen_front_sorting_policy, width, length, offset, z_centre_support, offset, dummy,-1,"ITKSenSupportIntf" )) ;
double sup_front_sorting_policy = sensitive_distance + (4 * nsort + 0) * eps_layer;
double sen_front_sorting_policy = sensitive_distance + (4 * nsort + 1) * eps_layer;
double sen_back_sorting_policy = sensitive_distance + (4 * nsort + 3) * eps_layer;
// overlap sorting policy uses nLadders as the overlapping "ladder" is the order i.e. there will now be nLadders+1
double overlap_sup_front_sorting_policy = sensitive_distance + (4 * nLadders + 0) * eps_layer;
double overlap_sen_front_sorting_policy = sensitive_distance + (4 * nLadders + 1) * eps_layer;
double overlap_sen_back_sorting_policy = sensitive_distance + (4 * nLadders + 3) * eps_layer;
if (ladder == 0) {
// air - support boundary
Add(new ILDParallelPlanarMeasLayer(air, carbon, ladder_distance, currPhi, _bZ, sup_front_sorting_policy,
nonoverlap_width, length, nonoverlap_offset, z_centre_support, offset, dummy, -1, "ITKSupFront_nonoverlap"));
Add(new ILDParallelPlanarMeasLayer(air, carbon, ladder_distance, currPhi, _bZ, overlap_sup_front_sorting_policy,
overlap_width, length, overlap_offset, z_centre_support, offset, dummy, -1, "ITKSupFront_overlap"));
// support boundary - sensitive
Add(new ILDParallelPlanarMeasLayer(carbon, silicon, sensitive_distance, currPhi, _bZ, sen_front_sorting_policy,
nonoverlap_width, length, nonoverlap_offset, z_centre_support, offset, dummy, -1, "ITKSenSupportIntf_nonoverlap"));
Add(new ILDParallelPlanarMeasLayer(carbon, silicon, sensitive_distance, currPhi, _bZ, overlap_sen_front_sorting_policy,
overlap_width, length, overlap_offset, z_centre_support, offset, dummy, -1, "ITKSenSupportIntf_overlap"));
// support - air boundary
Add(new ILDParallelPlanarMeasLayer(silicon, air, sensitive_distance+sensitive_thickness, currPhi, _bZ, sen_back_sorting_policy,
nonoverlap_width, length, nonoverlap_offset, z_centre_support, offset, dummy, -1, "ITKSenRear_nonoverlap"));
Add(new ILDParallelPlanarMeasLayer(silicon, air, sensitive_distance+sensitive_thickness, currPhi, _bZ, overlap_sen_back_sorting_policy,
overlap_width, length, overlap_offset, z_centre_support, offset, dummy, -1, "ITKSenRear_overlap"));
}
else {
// air - support boundary
Add(new ILDParallelPlanarMeasLayer(air, carbon, ladder_distance, currPhi, _bZ, sup_front_sorting_policy,
width, length, offset, z_centre_support, offset, dummy, -1, "ITKSupFront"));
// support boundary - sensitive
Add(new ILDParallelPlanarMeasLayer(carbon, silicon, sensitive_distance, currPhi, _bZ, sen_front_sorting_policy,
width, length, offset, z_centre_support, offset, dummy, -1, "ITKSenSupportIntf"));
// support - air boundary
Add(new ILDParallelPlanarMeasLayer(silicon, air, sensitive_distance+sensitive_thickness, currPhi, _bZ, sen_back_sorting_policy,
width, length, offset, z_centre_support, offset, dummy, -1, "ITKSenRear"));
}
for (int isensor=0; isensor<nsensors; ++isensor) {
encoder[lcio::ILDCellID0::sensor] = isensor ;
int CellID = encoder.lowWord() ;
double measurement_plane_sorting_policy = sensitive_distance + (4 * ladder+2) * eps_layer + eps_sensor * isensor ;
double measurement_plane_sorting_policy = sensitive_distance + (4 * nsort + 2) * eps_layer + eps_sensor * isensor;
double overlap_measurement_plane_sorting_policy = sensitive_distance + (4 * nLadders + 2) * eps_layer + eps_sensor * isensor;
//double z_centre_sensor = -0.5*length + (0.5*sensor_length) + (isensor*sensor_length) ;
double z_centre_sensor = -0.5*length + (0.5*sensor_length) + (isensor%(nsensors/nrow))*sensor_length;
......@@ -167,19 +252,35 @@ CEPCITKKalDetector::CEPCITKKalDetector( const gear::GearMgr& gearMgr, IGeomSvc*
if (_isStripDetector) {
// measurement plane defined as the middle of the sensitive volume
Add(new ILDParallelPlanarStripMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy, width, sensor_length, offset, z_centre_sensor, offset, stripAngle, CellID, "ITKStripMeaslayer")) ;
if (ladder == 0) {
Add(new ILDParallelPlanarStripMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy,
nonoverlap_width, sensor_length, nonoverlap_offset, z_centre_sensor, offset, stripAngle, CellID, "ITKStripMeaslayer_nonoverlap"));
Add(new ILDParallelPlanarStripMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, overlap_measurement_plane_sorting_policy,
overlap_width, sensor_length, overlap_offset, z_centre_sensor, offset, stripAngle, CellID, "ITKStripMeaslayer_overlap"));
}
else {
Add(new ILDParallelPlanarStripMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy,
width, sensor_length, offset, z_centre_sensor, offset, stripAngle, CellID, "ITKStripMeaslayer"));
}
} else {
// measurement plane defined as the middle of the sensitive volume
Add(new ILDParallelPlanarMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy, width, sensor_length, offset, z_centre_sensor, offset, true, CellID, "ITKMeaslayer")) ;
if (ladder == 0) {
Add(new ILDParallelPlanarMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy,
nonoverlap_width, sensor_length, nonoverlap_offset, z_centre_sensor, offset, true, CellID, "ITKMeaslayer_nonoverlap"));
Add(new ILDParallelPlanarMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, overlap_measurement_plane_sorting_policy,
overlap_width, sensor_length, overlap_offset, z_centre_sensor, offset, true, CellID, "ITKMeaslayer_overlap"));
}
else {
Add(new ILDParallelPlanarMeasLayer(silicon, silicon, sensitive_distance+sensitive_thickness*0.5, currPhi, _bZ, measurement_plane_sorting_policy,
width, sensor_length, offset, z_centre_sensor, offset, true, CellID, "ITKMeaslayer"));
}
}
//std::cout << "CEPCITKKalDetector add surface with CellID = " << CellID << std::endl ;
}
// support - air boundary
Add(new ILDParallelPlanarMeasLayer(silicon, air, sensitive_distance+sensitive_thickness, currPhi, _bZ, sen_back_sorting_policy, width, length, offset, z_centre_support, offset, dummy,-1,"ITKSenRear" )) ;
}
}
}
double redge = sqrt((ladder_distance+ladder_thickness)*(ladder_distance+ladder_thickness) + (fabs(offset)+0.5*width) * (fabs(offset)+0.5*width)) + eps_layer;
Add(new ILDCylinderMeasLayer(air, air, redge, 0.5*length, 0, 0, 0, _bZ, dummy, -1, "ITKOuterEdge"));
}
SetOwner();
......
......@@ -347,7 +347,7 @@ TVKalDetector(10)
TVector3 front_face_normal_bwd(front_face_centre_bwd);
front_face_normal_bwd.SetMag(1.0);
Add (new ILDDiscMeasLayer(air, air, front_face_centre_bwd,front_face_normal_bwd, bz, -z_min_ecal_ecap, 0., r_max_ecal_ecap/cos(M_PI/8.0), true, encoder.lowWord(),"ECalEndcapFace-Z"));
Add (new ILDDiscMeasLayer(air, air, front_face_centre_bwd,front_face_normal_bwd, bz, z_min_ecal_ecap+1e-8, 0., r_max_ecal_ecap/cos(M_PI/8.0), true, encoder.lowWord(),"ECalEndcapFace-Z"));
// streamlog_out( DEBUG0 ) << " *** adding ECalEndcapFace-Z Measurement layer at Zmin = " << front_face_centre_bwd.z() << " and Rmax = " << r_max_ecal_ecap/cos(M_PI/8.0) << std::endl ;
......
......@@ -203,13 +203,13 @@ TVKalDetector(250) // SJA:FIXME initial size, 250 looks reasonable for ILD, thou
Add(new ILDDiscMeasLayer(tpcgas, tpcreadout, TVector3(0,0,zminReadout), TVector3(0,0,1), bz, zminReadout, rminReadout, rmaxReadout, dummy, -1, "TPCReadoutFace+Z1"));
Add(new ILDDiscMeasLayer(tpcreadout, air, TVector3(0,0,zmaxReadout), TVector3(0,0,1), bz, zmaxReadout, rminReadout, rmaxReadout, dummy, -1, "TPCReadoutFace+Z2"));
Add(new ILDDiscMeasLayer(air, tpcendplate, TVector3(0,0,zminEndplate), TVector3(0,0,1), bz, zminEndplate, rminEndplate, rmaxEndplate, dummy, -1,"EPCEndplateFace+Z1"));
Add(new ILDDiscMeasLayer(tpcendplate, air, TVector3(0,0,zmaxEndplate), TVector3(0,0,1), bz, zmaxEndplate, rminEndplate, rmaxEndplate, dummy, -1,"EPCEndplateFace+Z2"));
Add(new ILDDiscMeasLayer(air, tpcendplate, TVector3(0,0,zminEndplate), TVector3(0,0,1), bz, zminEndplate, rtub, outerr, dummy, -1,"TPCEndplateFace+Z1"));
Add(new ILDDiscMeasLayer(tpcendplate, air, TVector3(0,0,zmaxEndplate), TVector3(0,0,1), bz, zmaxEndplate, rtub, outerr, dummy, -1,"TPCEndplateFace+Z2"));
Add(new ILDDiscMeasLayer(tpcgas, tpcreadout, TVector3(0,0,-zminReadout), TVector3(0,0,-1), bz, -zminReadout, rminReadout, rmaxReadout, dummy, -1, "TPCReadoutFace-Z1"));
Add(new ILDDiscMeasLayer(tpcreadout, air, TVector3(0,0,-zmaxReadout), TVector3(0,0,-1), bz, -zmaxReadout, rminReadout, rmaxReadout, dummy, -1, "TPCReadoutFace-Z2"));
Add(new ILDDiscMeasLayer(air, tpcendplate, TVector3(0,0,-zminEndplate), TVector3(0,0,-1), bz, -zminEndplate, rminEndplate, rmaxEndplate, dummy, -1,"EPCEndplateFace-Z1"));
Add(new ILDDiscMeasLayer(tpcendplate, air, TVector3(0,0,-zmaxEndplate), TVector3(0,0,-1), bz, -zmaxEndplate, rminEndplate, rmaxEndplate, dummy, -1,"EPCEndplateFace-Z2"));
Add(new ILDDiscMeasLayer(tpcgas, tpcreadout, TVector3(0,0,-zminReadout), TVector3(0,0,-1), bz, zminReadout+1e-8, rminReadout, rmaxReadout, dummy, -1, "TPCReadoutFace-Z1"));
Add(new ILDDiscMeasLayer(tpcreadout, air, TVector3(0,0,-zmaxReadout), TVector3(0,0,-1), bz, zmaxReadout+1e-8, rminReadout, rmaxReadout, dummy, -1, "TPCReadoutFace-Z2"));
Add(new ILDDiscMeasLayer(air, tpcendplate, TVector3(0,0,-zminEndplate), TVector3(0,0,-1), bz, zminEndplate+1e-8, rtub, outerr, dummy, -1,"TPCEndplateFace-Z1"));
Add(new ILDDiscMeasLayer(tpcendplate, air, TVector3(0,0,-zmaxEndplate), TVector3(0,0,-1), bz, zmaxEndplate+1e-8, rtub, outerr, dummy, -1,"TPCEndplateFace-Z2"));
SetOwner();
}
......
......@@ -2,19 +2,32 @@
# Description:
# This script is used to build the CEPCSW docs.
function install-sphinx() {
if [ ! -d "venv" ]; then
python -m venv venv
source venv/bin/activate
# pip install -r requirements.txt
pip install sphinx-rtd-theme myst-parser
else
source venv/bin/activate
fi
}
function check-sphinx() {
which sphinx-build >& /dev/null
}
function run-build-docs() {
pushd docs
make html
popd
}
pushd docs
install-sphinx
if check-sphinx; then
run-build-docs
else
echo "Please setup sphinx before build the docs. " 1>&2
exit -1
fi
popd
......@@ -94,7 +94,7 @@ endif()
if (CEPCSW_USE_SYSTEM_EDM4CEPC)
message("Try to use an existing installation of EDM4CEPC")
find_package(EDM4CEPC)
find_package(EDM4CEPC REQUIRED)
else()
message("Try to use an internal installation of EDM4CEPC")
include("${CMAKE_CURRENT_LIST_DIR}/internal_edm4cepc.cmake")
......
......@@ -19,23 +19,23 @@ option(CEPCSW_USE_SYSTEM_CKF_BELLE
"Use the existing installation of CKF BELLE. Otherwise the internal version will be used."
FALSE)
option(CEPCSW_USER_SYSTEM_EDM4CEPC
option(CEPCSW_USE_SYSTEM_EDM4CEPC
"Use the existing installation of EDM4CEPC. Otherwise the internal version will be used."
FALSE)
TRUE)
option(CEPCSW_USER_SYSTEM_ILCUTIL
option(CEPCSW_USE_SYSTEM_ILCUTIL
"Use the existing installation of ILCUTIL. Otherwise the internal version will be used."
FALSE)
option(CEPCSW_USER_SYSTEM_AIDATT
option(CEPCSW_USE_SYSTEM_AIDATT
"Use the existing installation of aidaTT. Otherwise the internal version will be used."
FALSE)
option(CEPCSW_USER_SYSTEM_KALTEST
option(CEPCSW_USE_SYSTEM_KALTEST
"Use the existing installation of KalTest. Otherwise the internal version will be used."
FALSE)
option(CEPCSW_USER_SYSTEM_DDKALTEST
option(CEPCSW_USE_SYSTEM_DDKALTEST
"Use the existing installation of DDKalTest. Otherwise the internal version will be used."
FALSE)
......
......@@ -13,7 +13,7 @@ It consists three major parts:
To use CEPCSW, users can use the software release deployed at IHEP's CVMFS or build from source code.
Currently, the libraries are built in `CentOS 7`. If you are using other different operating systems, you can consider to use the container technologies, such as Docker, Apptainer.
Currently, the libraries are built in `AlmaLinux 9` (previously it is `CentOS 7`). If you are using other different operating systems, you can consider to use the container technologies, such as Docker, Apptainer.
### SSH login
If you already have an IHEP AFS account, you can first login using an SSH client, such as OpenSSH:
......@@ -21,8 +21,10 @@ If you already have an IHEP AFS account, you can first login using an SSH client
$ ssh -Y username@lxlogin.ihep.ac.cn
```
### Start CentOS 7 container
Then, you need to **start the container** with following command:
### Start container if necessary (optional)
Before start the container, make sure you really need it. Since tdr25.3, the default OS is AlmaLinux 9. If you still work on an older version, then you need the CentOS 7 container.
Then, you need to **start the container** with following command if necessary:
```bash
$ /cvmfs/container.ihep.ac.cn/bin/hep_container shell CentOS7
```
......@@ -51,12 +53,10 @@ REDHAT_SUPPORT_PRODUCT_VERSION="7"
As CEPCSW is already deployed at IHEP CVMFS. You can use it as following:
```bash
Singularity> source /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/tdr24.5.0/CEPCSW/setup.sh
INFO: Setup CEPCSW externals: /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/103.0.2/setup-103.0.2.sh
INFO: Setup CEPCSW: /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/tdr24.5.0/CEPCSW/InstallArea
$ source /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/tdr25.3.2/CEPCSW/setup.sh
```
From the output, you will know the current version of external libraries is 103.0.2. This is based on the LCG 103.
From the output, you will know the current version of external libraries is 105.0.0. This is based on the LCG 105.
To start a simulation and reconstruction with `TDR_o1_v1`:
```bash
......@@ -129,7 +129,9 @@ There are two options:
* One is that install CVMFS in your machine directly.
* Another is that install CVMFS in the Docker container.
We provide two images for the two cases:
We provide several images for the two cases:
* `cepc/cepcsw:el9`
* `cepc/cepcsw-cvmfs:el9`
* `cepc/cepcsw:el7`
* `cepc/cepcsw-cvmfs:el7`
......@@ -161,13 +163,13 @@ $ sudo cvmfs_config setup
After you see CVMFS is setup without issues, you can try to access the CEPCSW:
```bash
ls /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/tdr24.5.0
ls /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/tdr25.3.2
CEPCSW CEPCSWData
```
Now, you can start the container with following long command:
```bash
$ docker run --privileged --rm -i -t -v /home:/home -v /cvmfs/sft.cern.ch:/cvmfs/sft.cern.ch -v /cvmfs/geant4.cern.ch:/cvmfs/geant4.cern.ch -v /cvmfs/cepcsw.ihep.ac.cn:/cvmfs/cepcsw.ihep.ac.cn -v /cvmfs/container.ihep.ac.cn:/cvmfs/container.ihep.ac.cn cepc/cepcsw:el7 /bin/bash
$ docker run --privileged --rm -i -t -v /home:/home -v /cvmfs/sft.cern.ch:/cvmfs/sft.cern.ch -v /cvmfs/geant4.cern.ch:/cvmfs/geant4.cern.ch -v /cvmfs/cepcsw.ihep.ac.cn:/cvmfs/cepcsw.ihep.ac.cn -v /cvmfs/container.ihep.ac.cn:/cvmfs/container.ihep.ac.cn cepc/cepcsw:el9 /bin/bash
```
The option `-v` allows the Docker container to access the directories in the local machine.
......@@ -176,7 +178,7 @@ The option `-v` allows the Docker container to access the directories in the loc
We also provide a Docker image with cvmfs client installed inside.
```bash
$ docker run --privileged --rm -i -t -v /home:/home cepc/cepcsw-cvmfs:el7 /bin/bash
$ docker run --privileged --rm -i -t -v /home:/home cepc/cepcsw-cvmfs:el9 /bin/bash
```
Now, you should be in the container. However, the cvmfs is not setup automatically. You need to mount the repositories manually. Here is an example:
......@@ -190,9 +192,7 @@ Then, you should be able access the necessary CVMFS repositories.
For example, setting up an existing CEPCSW:
```bash
$ source /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/tdr24.5.0/CEPCSW/setup.sh
INFO: Setup CEPCSW externals: /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/103.0.2/setup-103.0.2.sh
INFO: Setup CEPCSW: /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/tdr24.5.0/CEPCSW/InstallArea
$ source /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/tdr25.3.2/CEPCSW/setup.sh
```
Run a simulation:
......