-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13368 from suchandradutta/80X_Phase2TrackerDigitizer
Porting Phase2Tracker Digitizer from 62X_SLHC release. Updated also T…
- Loading branch information
Showing
33 changed files
with
4,104 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<use name="SimGeneral/MixingModule"/> | ||
<use name="MagneticField/Records"/> | ||
<use name="MagneticField/Engine"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="DataFormats/Common"/> | ||
<use name="DataFormats/SiPixelDigi"/> | ||
<use name="SimDataFormats/TrackingHit"/> | ||
<use name="SimDataFormats/TrackerDigiSimLink"/> | ||
<use name="CondFormats/SiPixelObjects"/> | ||
<use name="Geometry/TrackerGeometryBuilder"/> | ||
<use name="SimGeneral/NoiseGenerators"/> | ||
<use name="SimTracker/Common"/> | ||
<use name="DataFormats/SiPixelDetId"/> | ||
<use name="CalibTracker/SiPixelESProducers"/> | ||
<use name="clhep"/> | ||
<export> | ||
<lib name="1"/> | ||
</export> |
9 changes: 9 additions & 0 deletions
9
SimTracker/SiPhase2Digitizer/interface/Phase2TrackerDigiCommon.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef Phase2TrackerDigiCommon_HH | ||
#define Phase2TrackerDigiCommon_HH | ||
|
||
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" | ||
|
||
namespace phase2trackerdigi { | ||
unsigned int getLayerNumber(unsigned int& detid, const TrackerTopology* topo); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<use name="SimTracker/SiPhase2Digitizer"/> | ||
<library file="Phase2TrackerDigitizer.cc PSPDigitizerAlgorithm.cc Phase2TrackerDigitizerAlgorithm.cc PixelDigitizerAlgorithm.cc PSSDigitizerAlgorithm.cc SSDigitizerAlgorithm.cc" name="SimTrackerSiPhase2DigitizerPlugins"> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> |
149 changes: 149 additions & 0 deletions
149
SimTracker/SiPhase2Digitizer/plugins/DigitizerUtility.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
#ifndef __SimTracker_SiPhase2Digitizer_DigitizerUtility_h | ||
#define __SimTracker_SiPhase2Digitizer_DigitizerUtility_h | ||
|
||
#include <map> | ||
#include <memory> | ||
#include <vector> | ||
#include <iostream> | ||
|
||
#include "SimDataFormats/TrackingHit/interface/PSimHit.h" | ||
#include "SimTracker/Common/interface/SimHitInfoForLinks.h" | ||
#include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" | ||
|
||
namespace DigitizerUtility { | ||
class Amplitude { | ||
public: | ||
Amplitude() : _amp(0.0) | ||
{} | ||
Amplitude(float amp, float frac) : | ||
_amp(amp), _frac(1, frac), _hitInfo() | ||
{ | ||
// in case of digi from noisypixels | ||
// the MC information are removed | ||
if (_frac[0] < -0.5) | ||
_frac.pop_back(); | ||
} | ||
|
||
Amplitude( float amp, const PSimHit* hitp, size_t hitIndex, unsigned int tofBin, float frac) : | ||
_amp(amp), _frac(1, frac), _hitInfo(new SimHitInfoForLinks(hitp, hitIndex, tofBin)) { | ||
// in case of digi from noisypixels | ||
// the MC information are removed | ||
if (_frac[0] < -0.5) { | ||
_frac.pop_back(); | ||
_hitInfo->trackIds_.pop_back(); | ||
} | ||
} | ||
|
||
// can be used as a float by convers. | ||
operator float() const {return _amp;} | ||
float ampl() const {return _amp;} | ||
std::vector<float> individualampl() const {return _frac;} | ||
const std::vector<unsigned int>& trackIds() const {return _hitInfo->trackIds_;} | ||
const std::shared_ptr<SimHitInfoForLinks>& hitInfo() const {return _hitInfo;} | ||
|
||
void operator+= (const Amplitude& other) { | ||
_amp += other._amp; | ||
|
||
// in case of contribution of noise to the digi | ||
// the MC information are removed | ||
if (other._frac.size() > 0 && other._frac[0] >- 0.5) { | ||
if (other._hitInfo) { | ||
std::vector<unsigned int>& otherTrackIds = other._hitInfo->trackIds_; | ||
if (_hitInfo) { | ||
std::vector<unsigned int>& trackIds = _hitInfo->trackIds_; | ||
trackIds.insert(trackIds.end(), otherTrackIds.begin(), otherTrackIds.end()); | ||
} | ||
else | ||
_hitInfo.reset(new SimHitInfoForLinks(*other._hitInfo)); | ||
} | ||
_frac.insert(_frac.end(), other._frac.begin(), other._frac.end()); | ||
} | ||
} | ||
const EncodedEventId& eventId() const { | ||
return _hitInfo->eventId_; | ||
} | ||
const unsigned int hitIndex() const { | ||
return _hitInfo->hitIndex_; | ||
} | ||
const unsigned int tofBin() const { | ||
return _hitInfo->tofBin_; | ||
} | ||
void operator+= (const float& amp) { | ||
_amp += amp; | ||
} | ||
void set (const float amplitude) { // Used to reset the amplitude | ||
_amp = amplitude; | ||
} | ||
// void setind (const float indamplitude) { // Used to reset the amplitude | ||
// _frac = idamplitude; | ||
// } | ||
|
||
private: | ||
float _amp; | ||
std::vector<float> _frac; | ||
std::shared_ptr<SimHitInfoForLinks> _hitInfo; | ||
}; | ||
|
||
//********************************************************* | ||
// Define a class for 3D ionization points and energy | ||
//********************************************************* | ||
class EnergyDepositUnit { | ||
public: | ||
EnergyDepositUnit(): _energy(0),_position(0,0,0) {} | ||
EnergyDepositUnit(float energy,float x, float y, float z): | ||
_energy(energy),_position(x,y,z) {} | ||
EnergyDepositUnit(float energy, Local3DPoint position): | ||
_energy(energy),_position(position) {} | ||
float x() const{return _position.x();} | ||
float y() const{return _position.y();} | ||
float z() const{return _position.z();} | ||
float energy() const { return _energy;} | ||
private: | ||
float _energy; | ||
Local3DPoint _position; | ||
}; | ||
|
||
//********************************************************** | ||
// define class to store signals on the collection surface | ||
//********************************************************** | ||
class SignalPoint { | ||
public: | ||
SignalPoint(): _pos(0,0), _time(0), _amplitude(0), | ||
_sigma_x(1.), _sigma_y(1.), _hitp(0) {} | ||
|
||
SignalPoint(float x, float y, float sigma_x, float sigma_y, | ||
float t, float a=1.0): | ||
_pos(x,y), _time(t), _amplitude(a), _sigma_x(sigma_x), | ||
_sigma_y(sigma_y), _hitp(0) {} | ||
|
||
SignalPoint(float x, float y, float sigma_x, float sigma_y, | ||
float t, const PSimHit& hit, float a=1.0): | ||
_pos(x,y), _time(t), _amplitude(a), _sigma_x(sigma_x), | ||
_sigma_y(sigma_y),_hitp(&hit) {} | ||
|
||
const LocalPoint& position() const {return _pos;} | ||
float x() const {return _pos.x();} | ||
float y() const {return _pos.y();} | ||
float sigma_x() const {return _sigma_x;} | ||
float sigma_y() const {return _sigma_y;} | ||
float time() const {return _time;} | ||
float amplitude() const {return _amplitude;} | ||
const PSimHit& hit() {return *_hitp;} | ||
SignalPoint& set_amplitude(float amp) {_amplitude = amp; return *this;} | ||
private: | ||
LocalPoint _pos; | ||
float _time; | ||
float _amplitude; | ||
float _sigma_x; // gaussian sigma in the x direction (cm) | ||
float _sigma_y; // " " y direction (cm) */ | ||
const PSimHit* _hitp; | ||
}; | ||
struct DigiSimInfo { | ||
int sig_tot; | ||
std::map<unsigned int, float> track_map; | ||
unsigned int hit_counter; | ||
unsigned int tof_bin; | ||
EncodedEventId event_id; | ||
}; | ||
} | ||
#endif |
128 changes: 128 additions & 0 deletions
128
SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
#include <iostream> | ||
#include <math.h> | ||
|
||
#include "SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h" | ||
#include "SimTracker/Common/interface/SiG4UniversalFluctuation.h" | ||
#include "SimGeneral/NoiseGenerators/interface/GaussianTailNoiseGenerator.h" | ||
|
||
#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" | ||
#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" | ||
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" | ||
#include "DataFormats/DetId/interface/DetId.h" | ||
#include "DataFormats/FEDRawData/interface/FEDNumbering.h" | ||
#include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h" | ||
#include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h" | ||
|
||
#include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h" | ||
#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" | ||
|
||
#include "FWCore/Utilities/interface/RandomNumberGenerator.h" | ||
#include "CLHEP/Random/RandGaussQ.h" | ||
#include "CLHEP/Random/RandFlat.h" | ||
|
||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "FWCore/Utilities/interface/Exception.h" | ||
#include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationOfflineSimService.h" | ||
|
||
#include "CondFormats/SiPixelObjects/interface/GlobalPixel.h" | ||
#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" | ||
#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" | ||
#include "CondFormats/DataRecord/interface/SiPixelLorentzAngleSimRcd.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCabling.h" | ||
#include "CondFormats/SiPixelObjects/interface/PixelIndices.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelLorentzAngle.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" | ||
#include "CondFormats/SiPixelObjects/interface/PixelROC.h" | ||
#include "CondFormats/SiPixelObjects/interface/LocalPixel.h" | ||
#include "CondFormats/SiPixelObjects/interface/CablingPathToDetUnit.h" | ||
#include "CondFormats/SiPixelObjects/interface/SiPixelFrameReverter.h" | ||
#include "CondFormats/SiPixelObjects/interface/PixelFEDCabling.h" | ||
#include "CondFormats/SiPixelObjects/interface/PixelFEDLink.h" | ||
#include "CondFormats/SiPixelObjects/interface/PixelROC.h" | ||
|
||
// Geometry | ||
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" | ||
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" | ||
#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" | ||
#include "Geometry/CommonTopologies/interface/PixelTopology.h" | ||
#include "Geometry/Records/interface/IdealGeometryRecord.h" | ||
|
||
using namespace edm; | ||
using namespace sipixelobjects; | ||
|
||
void PSPDigitizerAlgorithm::init(const edm::EventSetup& es) { | ||
if (use_ineff_from_db_) // load gain calibration service from db | ||
theSiPixelGainCalibrationService_->setESObjects(es); | ||
|
||
if (use_deadmodule_DB_) | ||
es.get<SiPixelQualityRcd>().get(SiPixelBadModule_); | ||
|
||
if (use_LorentzAngle_DB_) | ||
// Get Lorentz angle from DB record | ||
es.get<SiPixelLorentzAngleSimRcd>().get(SiPixelLorentzAngle_); | ||
|
||
// gets the map and geometry from the DB (to kill ROCs) | ||
es.get<SiPixelFedCablingMapRcd>().get(map_); | ||
es.get<TrackerDigiGeometryRecord>().get(geom_); | ||
} | ||
PSPDigitizerAlgorithm::PSPDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine& eng): | ||
Phase2TrackerDigitizerAlgorithm(conf.getParameter<ParameterSet>("AlgorithmCommon"), | ||
conf.getParameter<ParameterSet>("PSPDigitizerAlgorithm"), | ||
eng) | ||
{ | ||
pixelFlag = false; | ||
LogInfo("PSPDigitizerAlgorithm") << "Algorithm constructed " | ||
<< "Configuration parameters:" | ||
<< "Threshold/Gain = " | ||
<< "threshold in electron Endcap = " | ||
<< theThresholdInE_Endcap | ||
<< "threshold in electron Barrel = " | ||
<< theThresholdInE_Barrel | ||
<< " " << theElectronPerADC << " " << theAdcFullScale | ||
<< " The delta cut-off is set to " << tMax | ||
<< " pix-inefficiency " << AddPixelInefficiency; | ||
} | ||
PSPDigitizerAlgorithm::~PSPDigitizerAlgorithm() { | ||
LogDebug("PSPDigitizerAlgorithm") << "Algorithm deleted"; | ||
} | ||
void PSPDigitizerAlgorithm::accumulateSimHits(std::vector<PSimHit>::const_iterator inputBegin, | ||
std::vector<PSimHit>::const_iterator inputEnd, | ||
const size_t inputBeginGlobalIndex, | ||
const unsigned int tofBin, | ||
const Phase2TrackerGeomDetUnit* pixdet, | ||
const GlobalVector& bfield) { | ||
// produce SignalPoint's for all SimHit's in detector | ||
// Loop over hits | ||
uint32_t detId = pixdet->geographicalId().rawId(); | ||
size_t simHitGlobalIndex = inputBeginGlobalIndex; // This needs to be stored to create the digi-sim link later | ||
for (auto it = inputBegin; it != inputEnd; ++it, ++simHitGlobalIndex) { | ||
// skip hits not in this detector. | ||
if ((*it).detUnitId() != detId) | ||
continue; | ||
|
||
LogDebug("PSPDigitizerAlgorithm") | ||
<< (*it).particleType() << " " << (*it).pabs() << " " | ||
<< (*it).energyLoss() << " " << (*it).tof() << " " | ||
<< (*it).trackId() << " " << (*it).processType() << " " | ||
<< (*it).detUnitId() | ||
<< (*it).entryPoint() << " " << (*it).exitPoint(); | ||
|
||
std::vector<DigitizerUtility::EnergyDepositUnit> ionization_points; | ||
std::vector<DigitizerUtility::SignalPoint> collection_points; | ||
|
||
// fill collection_points for this SimHit, indpendent of topology | ||
// Check the TOF cut | ||
if (((*it).tof() - pixdet->surface().toGlobal((*it).localPosition()).mag()/30.) >= theTofLowerCut && | ||
((*it).tof() - pixdet->surface().toGlobal((*it).localPosition()).mag()/30.) <= theTofUpperCut) { | ||
primary_ionization(*it, ionization_points); // fills _ionization_points | ||
drift(*it, pixdet, bfield, ionization_points, collection_points); // transforms _ionization_points to collection_points | ||
|
||
// compute induced signal on readout elements and add to _signal | ||
induce_signal(*it, simHitGlobalIndex, tofBin, pixdet, collection_points); // *ihit needed only for SimHit<-->Digi link | ||
} | ||
} | ||
} |
Oops, something went wrong.