Skip to content
Snippets Groups Projects
Commit ecf9d70a authored by mingrui.zhao@mail.labz0.org's avatar mingrui.zhao@mail.labz0.org
Browse files

remove file with *.remove

parent fe60296c
No related branches found
No related tags found
No related merge requests found
#ifndef MarlinTrkDiagnostics_h
#define MarlinTrkDiagnostics_h
//// switch to turn on diagnostics code
//#define MARLINTRK_DIAGNOSTICS_ON
#ifdef MARLINTRK_DIAGNOSTICS_ON
#include "lcio.h"
#include "EVENT/SimTrackerHit.h"
#include "EVENT/TrackerHit.h"
namespace MarlinTrk{
// LCIO Extension creating a pointer to the simhit for trackerhits
struct MCTruth4HitExtStruct{
MCTruth4HitExtStruct() : simhit(0) {}
EVENT::SimConstTrackerHit simhit;
} ;
struct MCTruth4HitExt : lcio::LCOwnedExtension<MCTruth4HitExt, MCTruth4HitExtStruct> {} ;
// fills a vector of MCParticle pointers with the MCParticles assosiated with the provided tracker hit using MCTruth4HitExtStruct
void getMCParticlesForTrackerHit(EVENT::ConstTrackerHit trkhit, std::vector<EVENT::MCParticle*>& mcps) ;
}
#endif
#endif
This diff is collapsed.
#ifndef DiagnosticsController_h
#define DiagnosticsController_h
#include "MarlinTrk/MarlinTrkDiagnostics.h"
#ifdef MARLINTRK_DIAGNOSTICS_ON
class TFile;
class TH1F;
class TTree;
class TKalMatrix;
namespace EVENT {
class MCParticle;
}
class ILDVTrackHit;
class TKalTrackSite;
class MarlinTrkNtuple;
namespace MarlinTrk{
class MarlinKalTestTrack;
class IMarlinTrack;
class DiagnosticsController {
public:
/** constructor */
DiagnosticsController();
/** Destructor */
virtual ~DiagnosticsController();
void init(std::string root_file_name, std::string root_Tree_name, bool _recording_on=true ) ;
void new_track(MarlinKalTestTrack* trk) ;
void set_intial_track_parameters(double d0, double phi0, double omega, double z0, double tanL, double pivot_x, double pivot_y, double pivot_z, TKalMatrix& cov);
void record_site(ILDVTrackHit* hit, TKalTrackSite* site);
void record_rejected_site(ILDVTrackHit* hit, TKalTrackSite* site);
void skip_current_track();
void end_track() ;
void end();
private:
DiagnosticsController(const DiagnosticsController&) ; // Prevent copy-construction
DiagnosticsController& operator=(const DiagnosticsController&) ; // Prevent assignment
void clear_track_record();
bool _initialised;
bool _recording_on;
int _ntracks_written;
int _ntracks_skipped;
std::string _root_file_name;
std::string _root_tree_name;
TFile* _root_file;
TTree* _tree;
MarlinTrkNtuple* _track_record;
MarlinKalTestTrack* _current_track;
EVENT::MCParticle* _currentMCP;
bool _mcpInfoStored;
bool _skip_track;
};
}
#endif
#endif
#include "MarlinTrkDiagnostics.h"
#include "EVENT/LCObject.h"
#include "UTIL/BitSet32.h"
#include "UTIL/ILDConf.h"
#ifdef MARLINTRK_DIAGNOSTICS_ON
namespace MarlinTrk{
void getMCParticlesForTrackerHit(EVENT::ConstTrackerHit trkhit, std::vector<EVENT::MCParticle*>& mcps){
if ( !trkhit ) {
return;
}
// make sure there is nothing in the vector we wish to return
mcps.clear();
// first check if this is a composite space point
if(UTIL::BitSet32( trkhit.getType() )[ UTIL::ILDTrkHitTypeBit::COMPOSITE_SPACEPOINT ]){
const EVENT::LCObjectVec rawObjects = trkhit.getRawHits();
for (unsigned iraw = 0; iraw < rawObjects.size(); ++iraw) {
EVENT::ConstTrackerHit rawHit = dynamic_cast< EVENT::ConstTrackerHit >( rawObjects[iraw] );
if( rawHit && rawHit->ext<MarlinTrk::MCTruth4HitExt>()){
EVENT::MCParticle* mcp = rawHit->ext<MarlinTrk::MCTruth4HitExt>()->simhit->getMCParticle();
bool found = false;
// check that it is not already in the vector
for (unsigned imcp=0; imcp<mcps.size(); ++imcp) {
if (mcp == mcps[imcp]) {
found = true;
break;
}
}
if( found == false ) mcps.push_back(mcp);
}
} // end of loop over rawObjects
// end if COMPOSITE_SPACEPOINT
} else {
if( trkhit.ext<MarlinTrk::MCTruth4HitExt>()){
mcps.push_back(trkhit.ext<MarlinTrk::MCTruth4HitExt>()->simhit->getMCParticle());
}
}
}
}
#endif
#include "ILDTPCKalDetector.h"
#include "ILDCylinderMeasLayer.h"
#include "ILDCylinderHit.h"
#include "TMath.h"
#include "TTUBE.h"
#include "MaterialDataBase.h"
#include <sstream>
#include "gear/GEAR.h"
#include "gear/BField.h"
#include "gear/TPCParameters.h"
#include "gear/PadRowLayout2D.h"
#include "gearimpl/Util.h"
#include <UTIL/BitField64.h>
#include <UTIL/ILDConf.h>
#include "streamlog/streamlog.h"
namespace kaldet{
ILDTPCKalDetector::ILDTPCKalDetector( const gear::GearMgr& gearMgr ) :
TVKalDetector(250) // SJA:FIXME initial size, 250 looks reasonable for ILD, though this would be better stored as a const somewhere
{
streamlog_out(DEBUG1) << "ILDTPCKalDetector building TPC detector using GEAR " << std::endl ;
const gear::TPCParameters& tpcParams = gearMgr.getTPCParameters();
const gear::PadRowLayout2D& pL = tpcParams.getPadLayout() ;
streamlog_out(DEBUG1) << "ILDTPCKalDetector - got padlayout with nLayers = " << pL.getNRows() << std::endl ;
const Double_t bz = gearMgr.getBField().at( gear::Vector3D( 0.,0.,0.) ).z() ;
static const Int_t nlayers = pL.getNRows() ; // n rows
static const Double_t lhalf = tpcParams.getMaxDriftLength() ; // half length
static const Double_t rstep = pL.getRowHeight(0) ; // step length of radius
// assuming that this is the radius of the first measurment layer ....
static const Double_t rmin = tpcParams.getPlaneExtent()[0] + rstep/2. ; // minimum radius
streamlog_out( DEBUG0 ) << tpcParams << std::endl ;
static const Double_t rtub = tpcParams.getDoubleVal("tpcInnerRadius") ; // inner r of support tube
static const Double_t outerr = tpcParams.getDoubleVal("tpcOuterRadius") ; // outer radius of TPC
static const Double_t inthick = tpcParams.getDoubleVal("tpcInnerWallThickness") ; // thickness of inner shell
static const Double_t outthick = tpcParams.getDoubleVal("tpcOuterWallThickness") ; // thickness of outer shell
MaterialDataBase::Instance().registerForService(gearMgr);
TMaterial & air = *MaterialDataBase::Instance().getMaterial("air");
TMaterial & tpcgas = *MaterialDataBase::Instance().getMaterial("tpcgas");
// TMaterial & aluminium = *MaterialDataBase::Instance().getMaterial("aluminium");
TMaterial & tpcinnerfieldcage = *MaterialDataBase::Instance().getMaterial("tpcinnerfieldcage");
TMaterial & tpcouterfieldcage = *MaterialDataBase::Instance().getMaterial("tpcouterfieldcage");
Bool_t active = true;
Bool_t dummy = false;
std::string name = "TPC";
const double x0 = 0.0;
const double y0 = 0.0;
const double z0 = 0.0;
// add inner field cage
Add( new ILDCylinderMeasLayer(air, tpcinnerfieldcage , rtub, lhalf, x0, y0, z0, bz, dummy,-1,"TPCInnerFCInr" ) );
streamlog_out( DEBUG0 ) << " *** adding " << name << " Measurement layer using CellID: [ inner field cage ] at R = " << rtub
<< " X0_in = " << air.GetRadLength() << " X0_out = " << tpcinnerfieldcage.GetRadLength()
<< std::endl ;
Add( new ILDCylinderMeasLayer(tpcinnerfieldcage , tpcgas, rtub+inthick, lhalf, x0, y0, z0, bz, dummy,-1,"TPCInnerFCOtr" ) );
streamlog_out( DEBUG0 ) << " *** adding " << name << " Measurement layer using CellID: [ inner field cage ] at R = " << rtub+inthick
<< " X0_in = " << tpcinnerfieldcage.GetRadLength() << " X0_out = " << tpcgas.GetRadLength()
<< std::endl ;
streamlog_out( DEBUG0 ) << " *** Inner Field Cage = " << int( (inthick/(tpcinnerfieldcage.GetRadLength()*10.0) /*cm*/ )*1000) / 10.0 << "% of a radiation length " << std::endl ;
// create measurement layers
Double_t r = rmin;
UTIL::BitField64 encoder( lcio::ILDCellID0::encoder_string ) ;
for (Int_t layer = 0; layer < nlayers; layer++) {
encoder.reset() ; // reset to 0
encoder[lcio::ILDCellID0::subdet] = lcio::ILDDetID::TPC ;
encoder[lcio::ILDCellID0::layer] = layer ;
int CellID = encoder.lowWord() ;
ILDCylinderMeasLayer* tpcL = new ILDCylinderMeasLayer(tpcgas, tpcgas, r, lhalf, x0, y0, z0, bz, active, CellID, "TPCMeasLayer") ;
Add( tpcL ) ;
int nth_layers(10) ;
if( layer % nth_layers == 0 ){
streamlog_out( DEBUG0 ) << " *** for TPC Gas printing only every " << nth_layers << "th layer" << std::endl ;
streamlog_out( DEBUG0 ) << " *** adding " << name << " Measurement layer using CellID: [" << CellID << "] at R = " << r
<< " X0_in = " << tpcgas.GetRadLength() << " X0_out = " << tpcgas.GetRadLength()
<< std::endl ;
}
r += rstep;
}
// add outer field cage
Add( new ILDCylinderMeasLayer(tpcgas, tpcouterfieldcage, outerr-outthick, lhalf, x0, y0, z0, bz, dummy,-1,"TPCOuterFCInr") ) ;
streamlog_out( DEBUG0 ) << " *** adding " << name << " Measurement layer using CellID: [ outer field cage ] at R = " << outerr-outthick
<< " X0_in = " << tpcgas.GetRadLength() << " X0_out = " << tpcouterfieldcage.GetRadLength()
<< std::endl ;
Add( new ILDCylinderMeasLayer(tpcouterfieldcage, air, outerr, lhalf, x0, y0, z0, bz, dummy,-1,"TPCOuterFCOtr") ) ;
streamlog_out( DEBUG0 ) << " *** adding " << name << " Measurement layer using CellID: [ outer field cage ] at R = " << outerr
<< " X0_in = " << tpcouterfieldcage.GetRadLength() << " X0_out = " << air.GetRadLength()
<< std::endl ;
streamlog_out( DEBUG0 ) << " *** Outer Field Cage = " << int( (outthick/(tpcouterfieldcage.GetRadLength()*10.0) /*cm*/ )*1000) / 10.0 << "% of a radiation length " << std::endl ;
SetOwner();
}
}
# build KalTest library
SET( lib_input_dirs geomlib kallib kaltracklib utils )
FOREACH( lib_input_dir ${lib_input_dirs} )
LIST( APPEND ROOT_DICT_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/${lib_input_dir} )
ENDFOREACH()
#MESSAGE( STATUS "ROOT_DICT_INCLUDE_DIRS: ${ROOT_DICT_INCLUDE_DIRS}" )
FOREACH( lib_input_dir ${lib_input_dirs} )
AUX_SOURCE_DIRECTORY( ${lib_input_dir} lib_sources )
PREPARE_ROOT_DICT_HEADERS( ${lib_input_dir} )
INSTALL_DIRECTORY( ${lib_input_dir}/ DESTINATION "include/kaltest"
FILES_MATCHING PATTERN "*.h" PATTERN "LinkDef.h" EXCLUDE
)
GEN_ROOT_DICT_SOURCES( ${lib_input_dir}Dict.cxx )
LIST( APPEND lib_sources ${ROOT_DICT_OUTPUT_SOURCES} )
ENDFOREACH()
INCLUDE_DIRECTORIES( ${ROOT_DICT_INCLUDE_DIRS} )
INCLUDE_DIRECTORIES( ${ROOT_INCLUDE_DIRS} )
#MESSAGE( STATUS "KalTest lib sources: ${lib_sources}" )
ADD_SHARED_LIBRARY( KalTest ${lib_sources} )
INSTALL_SHARED_LIBRARY( KalTest DESTINATION lib )
TARGET_LINK_LIBRARIES( KalTest ${ROOT_LIBRARIES} )
IF( APPLE ) #---- need special linker flags for ROOT dictionary on MacOS
SET_TARGET_PROPERTIES( KalTest PROPERTIES
LINK_FLAGS "-single_module -undefined dynamic_lookup -bind_at_load"
)
ENDIF( APPLE )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment