20 : EBRecHitCollectionToken_(
22 EERecHitCollectionToken_(
63 for (reco::TrackCollection::const_iterator ndTrack = tracks->begin(); ndTrack != tracks->end(); ++ndTrack) {
66 if (dr > 0.00001 && dr < result.
trkIsoDr)
75 std::map<int, GlobalPoint> trackExitPositionMap;
76 std::map<int, float> trackCrossedXtalCurvedMap;
80 std::vector<SteppingHelixStateInfo> neckLace;
83 double totalLengthCurved = 0.;
86 if (neckLace.size() > 1) {
88 trackCrossedXtalCurvedMap,
98 float sumWeightedTime = 0;
99 float sumTimeErrorSqr = 0;
101 float sumTrackLength = 0;
102 std::vector<EcalRecHit> crossedRecHits;
105 std::map<int, GlobalPoint>::const_iterator trackExitMapIt = trackExitPositionMap.begin();
106 for (std::map<int, float>::const_iterator mapIt = trackCrossedXtalCurvedMap.begin();
107 mapIt != trackCrossedXtalCurvedMap.end();
111 thisHit = ebRecHits->
find(ebDetId);
112 if (thisHit == ebRecHits->
end()) {
125 sumTrackLength += mapIt->second;
126 sumEnergy += hit.
energy();
127 crossedRecHits.push_back(hit);
145 sumWeightedTime += hit.
time() / (errorOnThis * errorOnThis);
146 sumTimeErrorSqr += 1 / (errorOnThis * errorOnThis);
152 if (!crossedRecHits.empty()) {
154 sort(crossedRecHits.begin(), crossedRecHits.end(), [](
auto&
x,
auto&
y) {
return (
x.energy() >
y.energy()); });
157 result.
ecalDeDx = sumEnergy / sumTrackLength;
162 if (sumTimeErrorSqr > 0) {
163 result.
ecalTime = sumWeightedTime / sumTimeErrorSqr;
165 DetId maxEnergyId = crossedRecHits.begin()->id();
167 if (maxEnergyId !=
DetId())
172 double frontFaceR =
sqrt(
pow(position.
x(), 2) +
pow(position.
y(), 2) +
pow(position.
z(), 2));
173 double muonShowerMax = frontFaceR + 11.5;
174 double gammaShowerMax = frontFaceR + 6.23;
176 result.
ecalBeta = (muonShowerMax) / (result.
ecalTime * speedOfLight + gammaShowerMax);
178 pow(speedOfLight * result.
ecalTime + gammaShowerMax, 2);
222 std::map<int, float>& trackCrossedXtalMap,
223 double& totalLengthCurved,
228 const std::vector<SteppingHelixStateInfo>& neckLace) {
230 internalPointCurved = origin;
231 externalPointCurved = origin;
233 bool firstPoint =
false;
234 trackCrossedXtalMap.clear();
239 for (std::vector<SteppingHelixStateInfo>::const_iterator itr = (neckLace.begin() + 1); itr != neckLace.end(); ++itr) {
241 std::vector<DetId> surroundingMatrix;
249 ->inside(probe_gp))) {
250 double step = ((*itr).position() - (*(itr - 1)).position()).
mag();
253 trackExitPositionMap, trackCrossedXtalMap, closestEndcapDetIdToProbe, step, point, theEndcapSubdetGeometry);
254 totalLengthCurved +=
step;
256 if (firstPoint ==
false) {
257 internalPointCurved = probe_gp;
261 externalPointCurved = probe_gp;
266 ->inside(probe_gp))) {
267 double step = ((*itr).position() - (*(itr - 1)).position()).
mag();
270 trackExitPositionMap, trackCrossedXtalMap, closestBarrelDetIdToProbe, step, point, theBarrelSubdetGeometry);
271 totalLengthCurved +=
step;
273 if (firstPoint ==
false) {
274 internalPointCurved = probe_gp;
278 externalPointCurved = probe_gp;
284 for (
unsigned int k = 0;
k < surroundingMatrix.size(); ++
k) {
287 ->inside(probe_gp)) {
288 double step = ((*itr).position() - (*(itr - 1)).position()).
mag();
292 surroundingMatrix[
k],
296 totalLengthCurved +=
step;
298 if (firstPoint ==
false) {
299 internalPointCurved = probe_gp;
303 externalPointCurved = probe_gp;
308 surroundingMatrix.clear();
316 std::map<int, float>& trackCrossedXtalMap,
321 auto cell_p = theSubdetGeometry->
getGeometry(aDetId);
325 std::map<int, GlobalPoint>::iterator xtal = trackExitPositionMap.find(aDetId.
rawId());
326 if (xtal != trackExitPositionMap.end())
327 ((*xtal).second) =
diff;
329 trackExitPositionMap.insert(std::pair<int, GlobalPoint>(aDetId.
rawId(),
diff));
331 std::map<int, float>::iterator xtal2 = trackCrossedXtalMap.find(aDetId.
rawId());
332 if (xtal2 != trackCrossedXtalMap.end())
333 ((*xtal2).second) +=
step;
335 trackCrossedXtalMap.insert(std::pair<int, float>(aDetId.
rawId(),
step));
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
GlobalPoint getPosition(const DetId &)
int getDetailedTrackLengthInXtals(std::map< int, GlobalPoint > &trackExitPositionMap, std::map< int, float > &trackCrossedXtalMap, double &totalLengthCurved, GlobalPoint &internalPointCurved, GlobalPoint &externalPointCurved, const CaloGeometry *theGeometry, const CaloTopology *theTopology, const std::vector< SteppingHelixStateInfo > &neckLace)
std::vector< float > ecalTrackLengths
std::vector< float > ecalEnergies
bool isTimeErrorValid() const
std::vector< const HBHERecHit * > crossedHcalRecHits
bool getByToken(EDGetToken token, Handle< PROD > &result) const
BetaCalculatorECAL(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
static FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup &, const reco::Track &)
get FreeTrajectoryState from different track representations
double maxZ(bool withTolerance=true) const
std::vector< GlobalPoint > ecalTrackExitPositions
void useDefaultPropagator()
use the default propagator
constexpr uint32_t rawId() const
get the raw id
std::vector< EcalRecHit >::const_iterator const_iterator
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
static double constexpr speedOfLight
Speed of light [cm / ns].
void addInfoToCandidate(susybsm::HSCParticle &candidate, edm::Handle< reco::TrackCollection > &tracks, edm::Event &iEvent, const edm::EventSetup &iSetup, susybsm::HSCPCaloInfo &caloInfo)
double minZ(bool withTolerance=true) const
CaloGeometry const * getGeometry()
double nXnEnergy(const DetId &, EnergyType, int gridSize=1)
get energy of the NxN shape (N = 2*gridSize + 1) around given detector element
std::vector< DetId > ecalDetIds
std::vector< float > ecalTimeErrors
std::vector< float > ecalTimes
edm::EDGetTokenT< EERecHitCollection > EERecHitCollectionToken_
void applyRadX0Correction(bool applyRadX0Correction)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
edm::ESHandle< DetIdAssociator > ecalDetIdAssociator_
double crossedEnergy(EnergyType)
energy in detector elements crossed by the track by types
std::vector< float > ecalChi2s
double minR(bool withTolerance=true) const
const_iterator end() const
TrackAssociatorParameters parameters_
virtual DetId getClosestCell(const GlobalPoint &r) const
double outerEta() const
pseudorapidity of the momentum vector at the outermost hit position
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
Flags recoFlag() const
DEPRECATED provided for temporary backward compatibility.
void addStepToXtal(std::map< int, GlobalPoint > &trackExitPositionMap, std::map< int, float > &trackCrossedXtalMap, DetId aDetId, float step, GlobalPoint point, const CaloSubdetectorGeometry *theSubdetGeometry)
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
reco::TrackRef trackRef() const
TrackDetectorAssociator trackAssociator_
iterator find(key_type k)
static int position[264][3]
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
std::vector< float > ecalOutOfTimeChi2s
const FiducialVolume & volume() const
get active detector volume
std::vector< SteppingHelixStateInfo > propagateThoughFromIP(const SteppingHelixStateInfo &state, const Propagator *prop, const FiducialVolume &volume, int nsteps, float step, float minR, float minZ, float maxR, float maxZ)
edm::EDGetTokenT< EBRecHitCollection > EBRecHitCollectionToken_
edm::ESHandle< MagneticField > bField_
std::vector< float > ecalOutOfTimeEnergies
T const * product() const
double outerPhi() const
azimuthal angle of the momentum vector at the outermost hit position
edm::ESHandle< CaloGeometry > theCaloGeometry_
double maxR(bool withTolerance=true) const
void setMaterialMode(bool noMaterial)
Switch for material effects mode: no material effects if true.
Power< A, B >::type pow(const A &a, const B &b)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
std::vector< SteppingHelixStateInfo > calcEcalDeposit(const FreeTrajectoryState *tkInnerState, const DetIdAssociator &associator)