CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
BetaCalculatorECAL Class Reference

#include <BetaCalculatorECAL.h>

Public Member Functions

void addInfoToCandidate (susybsm::HSCParticle &candidate, edm::Handle< reco::TrackCollection > &tracks, edm::Event &iEvent, const edm::EventSetup &iSetup, susybsm::HSCPCaloInfo &caloInfo)
 
 BetaCalculatorECAL (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
 

Private Member Functions

void addStepToXtal (std::map< int, GlobalPoint > &trackExitPositionMap, std::map< int, float > &trackCrossedXtalMap, DetId aDetId, float step, GlobalPoint point, const CaloSubdetectorGeometry *theSubdetGeometry)
 
std::vector< SteppingHelixStateInfocalcEcalDeposit (const FreeTrajectoryState *tkInnerState, const DetIdAssociator &associator)
 
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)
 

Private Attributes

edm::ESHandle< MagneticFieldbField_
 
edm::EDGetTokenT< EBRecHitCollectionEBRecHitCollectionToken_
 
edm::ESHandle< DetIdAssociatorecalDetIdAssociator_
 
edm::EDGetTokenT< EERecHitCollectionEERecHitCollectionToken_
 
TrackAssociatorParameters parameters_
 
edm::ESHandle< CaloGeometrytheCaloGeometry_
 
TrackDetectorAssociator trackAssociator_
 

Detailed Description

Definition at line 33 of file BetaCalculatorECAL.h.

Constructor & Destructor Documentation

BetaCalculatorECAL::BetaCalculatorECAL ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)

Definition at line 18 of file BetaCalculatorECAL.cc.

References edm::ParameterSet::getParameter(), TrackAssociatorParameters::loadParameters(), parameters_, trackAssociator_, and TrackDetectorAssociator::useDefaultPropagator().

18  :
21 {
22  edm::ParameterSet trkParameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
23  parameters_.loadParameters( trkParameters, iC );
25 
26 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
void useDefaultPropagator()
use the default propagator
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
edm::EDGetTokenT< EERecHitCollection > EERecHitCollectionToken_
TrackAssociatorParameters parameters_
TrackDetectorAssociator trackAssociator_
edm::EDGetTokenT< EBRecHitCollection > EBRecHitCollectionToken_

Member Function Documentation

void BetaCalculatorECAL::addInfoToCandidate ( susybsm::HSCParticle candidate,
edm::Handle< reco::TrackCollection > &  tracks,
edm::Event iEvent,
const edm::EventSetup iSetup,
susybsm::HSCPCaloInfo caloInfo 
)

Definition at line 29 of file BetaCalculatorECAL.cc.

References TrackDetectorAssociator::associate(), bField_, calcEcalDeposit(), EcalRecHit::chi2(), TrackDetMatchInfo::crossedEnergy(), TrackDetMatchInfo::crossedHcalRecHits, runTauDisplay::dr, EBRecHitCollectionToken_, susybsm::HSCPCaloInfo::ecal3by3dir, susybsm::HSCPCaloInfo::ecal5by5dir, EcalBarrel, susybsm::HSCPCaloInfo::ecalBeta, susybsm::HSCPCaloInfo::ecalBetaError, susybsm::HSCPCaloInfo::ecalChi2s, susybsm::HSCPCaloInfo::ecalCrossedEnergy, susybsm::HSCPCaloInfo::ecalCrysCrossed, susybsm::HSCPCaloInfo::ecalDeDx, ecalDetIdAssociator_, susybsm::HSCPCaloInfo::ecalDetIds, susybsm::HSCPCaloInfo::ecalEnergies, susybsm::HSCPCaloInfo::ecalInvBetaError, susybsm::HSCPCaloInfo::ecalOutOfTimeChi2s, susybsm::HSCPCaloInfo::ecalOutOfTimeEnergies, TrackDetMatchInfo::EcalRecHits, susybsm::HSCPCaloInfo::ecalTime, susybsm::HSCPCaloInfo::ecalTimeError, susybsm::HSCPCaloInfo::ecalTimeErrors, susybsm::HSCPCaloInfo::ecalTimes, susybsm::HSCPCaloInfo::ecalTrackExitPositions, susybsm::HSCPCaloInfo::ecalTrackLengths, EERecHitCollectionToken_, edm::SortedCollection< T, SORT >::end(), EcalRecHit::energy(), edm::SortedCollection< T, SORT >::find(), edm::EventSetup::get(), edm::Event::getByToken(), getDetailedTrackLengthInXtals(), TrackDetectorAssociator::getFreeTrajectoryState(), TrackDetMatchInfo::getPosition(), susybsm::HSCParticle::hasTrackRef(), susybsm::HSCPCaloInfo::hcal3by3dir, susybsm::HSCPCaloInfo::hcal5by5dir, susybsm::HSCPCaloInfo::hcalCrossedEnergy, TrackDetMatchInfo::HcalRecHits, susybsm::HSCPCaloInfo::hoCrossedEnergy, TrackDetMatchInfo::HORecHits, info(), trajectoryStateTransform::innerFreeState(), EcalRecHit::isTimeErrorValid(), EcalRecHit::isTimeValid(), EcalRecHit::kGood, EcalRecHit::kOutOfTime, EcalRecHit::kPoorCalib, TrackDetMatchInfo::nXnEnergy(), reco::Track::outerEta(), reco::Track::outerPhi(), parameters_, position, funct::pow(), edm::ESHandle< T >::product(), EcalRecHit::recoFlag(), mps_fire::result, fastsim::Constants::speedOfLight, mathSSE::sqrt(), DetId::subdetId(), theCaloGeometry_, EcalRecHit::time(), EcalRecHit::timeError(), HiIsolationCommonParameters_cff::track, trackAssociator_, susybsm::HSCParticle::trackRef(), susybsm::HSCPCaloInfo::trkIsoDr, x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

29  {
30  bool setCalo = false;
32 
33  // EcalDetIdAssociator
34  iSetup.get<DetIdAssociatorRecord>().get("EcalDetIdAssociator", ecalDetIdAssociator_);
35  // Get the Bfield
36  iSetup.get<IdealMagneticFieldRecord>().get(bField_);
37  // Geometry
39  const CaloGeometry* theGeometry = theCaloGeometry_.product();
40  // Topology
41  edm::ESHandle<CaloTopology> pCaloTopology;
42  iSetup.get<CaloTopologyRecord>().get(pCaloTopology);
43  const CaloTopology* theCaloTopology = pCaloTopology.product();
44  // EcalRecHits
46  iEvent.getByToken(EBRecHitCollectionToken_,ebRecHits);
48  iEvent.getByToken(EERecHitCollectionToken_,eeRecHits);
49 
50  // select the track
52  if(candidate.hasTrackRef())
53  track = *(candidate.trackRef());
54  else
55  return; // in case there is no track ref, we can't do much
56 
57  // compute the track isolation
58  result.trkIsoDr=100;
59  for(reco::TrackCollection::const_iterator ndTrack = tracks->begin(); ndTrack != tracks->end(); ++ndTrack) {
60  double dr=sqrt(pow((track.outerEta()-ndTrack->outerEta()),2)+pow((track.outerPhi()-ndTrack->outerPhi()),2));
61  if(dr>0.00001 && dr<result.trkIsoDr) result.trkIsoDr=dr;
62  }
63 
64  // use the track associator to propagate to the calo
67  parameters_ );
68 
69  // do a custom propagation through Ecal
70  std::map<int,GlobalPoint> trackExitPositionMap; // rawId to exit position (subtracting cry center)
71  std::map<int,float> trackCrossedXtalCurvedMap; // rawId to trackLength
72 
74  // Build set of points in Ecal (necklace) using the propagator
75  std::vector<SteppingHelixStateInfo> neckLace;
76  neckLace = calcEcalDeposit(&tkInnerState,*ecalDetIdAssociator_);
77  // Initialize variables to be filled by the track-length function
78  double totalLengthCurved = 0.;
79  GlobalPoint internalPointCurved(0., 0., 0.);
80  GlobalPoint externalPointCurved(0., 0., 0.);
81  if(neckLace.size() > 1)
82  {
83  getDetailedTrackLengthInXtals(trackExitPositionMap,
84  trackCrossedXtalCurvedMap,
85  totalLengthCurved,
86  internalPointCurved,
87  externalPointCurved,
88  & (*theGeometry),
89  & (*theCaloTopology),
90  neckLace);
91  }
92 
93  // Make weighted sum of times
94  float sumWeightedTime = 0;
95  float sumTimeErrorSqr = 0;
96  float sumEnergy = 0;
97  float sumTrackLength = 0;
98  std::vector<EcalRecHit> crossedRecHits;
100 
101  std::map<int,GlobalPoint>::const_iterator trackExitMapIt = trackExitPositionMap.begin();
102  for(std::map<int,float>::const_iterator mapIt = trackCrossedXtalCurvedMap.begin();
103  mapIt != trackCrossedXtalCurvedMap.end(); ++mapIt)
104  {
105  if(DetId(mapIt->first).subdetId()==EcalBarrel)
106  {
107  EBDetId ebDetId(mapIt->first);
108  thisHit = ebRecHits->find(ebDetId);
109  if(thisHit == ebRecHits->end())
110  {
111  //std::cout << "\t Could not find crossedEcal detId: " << ebDetId << " in EBRecHitCollection!" << std::endl;
112  continue;
113  }
114  const EcalRecHit hit = *thisHit;
115  // Cut out badly-reconstructed hits
116  if(!hit.isTimeValid())
117  continue;
118  uint32_t rhFlag = hit.recoFlag();
119  if((rhFlag != EcalRecHit::kGood) && (rhFlag != EcalRecHit::kOutOfTime) && (rhFlag != EcalRecHit::kPoorCalib))
120  continue;
121 
122  float errorOnThis = hit.timeError();
123  sumTrackLength+=mapIt->second;
124  sumEnergy+=hit.energy();
125  crossedRecHits.push_back(hit);
126 // result.ecalSwissCrossKs.push_back(EcalSeverityLevelAlgo::spikeFromNeighbours(ebDetId,(*ebRecHits),0.2,EcalSeverityLevelAlgo::kSwissCross));
127 // result.ecalE1OverE9s.push_back(EcalSeverityLevelAlgo::spikeFromNeighbours(ebDetId,(*ebRecHits),0.2,EcalSeverityLevelAlgo::kE1OverE9));
128  result.ecalTrackLengths.push_back(mapIt->second);
129  result.ecalTrackExitPositions.push_back(trackExitMapIt->second);
130  result.ecalEnergies.push_back(hit.energy());
131  result.ecalTimes.push_back(hit.time());
132  result.ecalTimeErrors.push_back(hit.timeError());
133  result.ecalOutOfTimeEnergies.push_back(0.);
134  result.ecalOutOfTimeChi2s.push_back(0.);
135  result.ecalChi2s.push_back(hit.chi2());
136  result.ecalDetIds.push_back(ebDetId);
137  // SIC DEBUG
138  //std::cout << " SIC DEBUG: time error on this crossed RecHit: " << errorOnThis << " energy of hit: "
139  // << hit.energy() << " time of hit: " << hit.time() << " trackLength: " << mapIt->second << std::endl;
140 
141  if(hit.isTimeErrorValid()) // use hit time for weighted time average
142  {
143  sumWeightedTime+=hit.time()/(errorOnThis*errorOnThis);
144  sumTimeErrorSqr+=1/(errorOnThis*errorOnThis);
145  }
146  }
147  trackExitMapIt++;
148  }
149 
150  if(!crossedRecHits.empty())
151  {
152  setCalo = true;
153  sort(crossedRecHits.begin(),crossedRecHits.end(),
154  [](auto& x, auto& y){return (x.energy() > y.energy());});
155  result.ecalCrossedEnergy = sumEnergy;
156  result.ecalCrysCrossed = crossedRecHits.size();
157  result.ecalDeDx = sumEnergy/sumTrackLength;
158  // replace the below w/o trackassociator quantities?
161 
162  if(sumTimeErrorSqr > 0)
163  {
164  result.ecalTime = sumWeightedTime/sumTimeErrorSqr;
165  result.ecalTimeError = sqrt(1/sumTimeErrorSqr);
166  DetId maxEnergyId = crossedRecHits.begin()->id();
167 
168  if(maxEnergyId != DetId()) // double check
169  {
170  // To get beta, we assume photon propagation time is about the same for muons and e/gamma
171  // Since the typical path length is >> crystal length, this shouldn't be too bad
172  GlobalPoint position = info.getPosition(maxEnergyId); // position of crystal center on front face
173  double frontFaceR = sqrt(pow(position.x(),2)+pow(position.y(),2)+pow(position.z(),2));
174  double muonShowerMax = frontFaceR+11.5; // assume muon "showerMax" is halfway into the crystal
175  double gammaShowerMax = frontFaceR+6.23; // 7 X0 for e/gamma showerMax
176  double speedOfLight = 29.979; // cm/ns
177  result.ecalBeta = (muonShowerMax)/(result.ecalTime*speedOfLight+gammaShowerMax);
178  result.ecalBetaError = (speedOfLight*muonShowerMax*result.ecalTimeError)/pow(speedOfLight*result.ecalTime+gammaShowerMax,2);
179  result.ecalInvBetaError = speedOfLight*result.ecalTimeError/muonShowerMax;
180  }
181  // SIC debug
182  //std::cout << "BetaCalcEcal: CrossedRecHits: " << crossedRecHits.size()
183  // << " ecalTime: " << result.ecalTime << " timeError: " << result.ecalTimeError
184  // << " ecalCrossedEnergy: " << result.ecalCrossedEnergy << " ecalBeta: " << result.ecalBeta
185  // << " ecalBetaError: " << result.ecalBetaError << " ecalDeDx (MeV/cm): " << 1000*result.ecalDeDx << std::endl;
186  }
187  }
188 
189  if(!info.crossedHcalRecHits.empty())
190  {
191  // HCAL (not ECAL) info
194  //maxEnergyId = info.findMaxDeposition(TrackDetMatchInfo::HcalRecHits);
197  }
198 
199  if(setCalo)
200  caloInfo = result;
201 }
GlobalPoint getPosition(const DetId &)
static const TGPicture * info(bool iBackgroundIsBlack)
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
Definition: HSCPCaloInfo.h:28
std::vector< float > ecalEnergies
Definition: HSCPCaloInfo.h:29
bool isTimeErrorValid() const
Definition: EcalRecHit.h:87
std::vector< const HBHERecHit * > crossedHcalRecHits
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
static FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup &, const reco::Track &)
get FreeTrajectoryState from different track representations
std::vector< GlobalPoint > ecalTrackExitPositions
Definition: HSCPCaloInfo.h:36
std::vector< EcalRecHit >::const_iterator const_iterator
T y() const
Definition: PV3DBase.h:63
static double constexpr speedOfLight
Speed of light [cm / ns].
Definition: Constants.h:16
float time() const
Definition: EcalRecHit.h:70
bool hasTrackRef() const
Definition: HSCParticle.h:57
double nXnEnergy(const DetId &, EnergyType, int gridSize=1)
get energy of the NxN shape (N = 2*gridSize + 1) around given detector element
bool isTimeValid() const
Definition: EcalRecHit.h:85
std::vector< DetId > ecalDetIds
Definition: HSCPCaloInfo.h:35
std::vector< float > ecalTimeErrors
Definition: HSCPCaloInfo.h:31
std::vector< float > ecalTimes
Definition: HSCPCaloInfo.h:30
edm::EDGetTokenT< EERecHitCollection > EERecHitCollectionToken_
T sqrt(T t)
Definition: SSEVec.h:18
float chi2() const
Definition: EcalRecHit.h:121
T z() const
Definition: PV3DBase.h:64
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
float energy() const
Definition: EcalRecHit.h:68
edm::ESHandle< DetIdAssociator > ecalDetIdAssociator_
double crossedEnergy(EnergyType)
energy in detector elements crossed by the track by types
float timeError() const
Definition: EcalRecHit.h:165
std::vector< float > ecalChi2s
Definition: HSCPCaloInfo.h:32
const_iterator end() const
TrackAssociatorParameters parameters_
Definition: DetId.h:18
double outerEta() const
pseudorapidity of the momentum vector at the outermost hit position
Definition: Track.h:174
Flags recoFlag() const
DEPRECATED provided for temporary backward compatibility.
Definition: EcalRecHit.h:206
reco::TrackRef trackRef() const
Definition: HSCParticle.h:72
TrackDetectorAssociator trackAssociator_
iterator find(key_type k)
static int position[264][3]
Definition: ReadPGInfo.cc:509
T get() const
Definition: EventSetup.h:71
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
std::vector< float > ecalOutOfTimeChi2s
Definition: HSCPCaloInfo.h:33
FreeTrajectoryState innerFreeState(const reco::Track &tk, const MagneticField *field, bool withErr=true)
edm::EDGetTokenT< EBRecHitCollection > EBRecHitCollectionToken_
edm::ESHandle< MagneticField > bField_
std::vector< float > ecalOutOfTimeEnergies
Definition: HSCPCaloInfo.h:34
T x() const
Definition: PV3DBase.h:62
T const * product() const
Definition: ESHandle.h:86
double outerPhi() const
azimuthal angle of the momentum vector at the outermost hit position
Definition: Track.h:169
edm::ESHandle< CaloGeometry > theCaloGeometry_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
std::vector< SteppingHelixStateInfo > calcEcalDeposit(const FreeTrajectoryState *tkInnerState, const DetIdAssociator &associator)
void BetaCalculatorECAL::addStepToXtal ( std::map< int, GlobalPoint > &  trackExitPositionMap,
std::map< int, float > &  trackCrossedXtalMap,
DetId  aDetId,
float  step,
GlobalPoint  point,
const CaloSubdetectorGeometry theSubdetGeometry 
)
private

Definition at line 318 of file BetaCalculatorECAL.cc.

References diffTreeTool::diff, CaloSubdetectorGeometry::getGeometry(), AlCaHLTBitMon_ParallelJobs::p, DetId::rawId(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by getDetailedTrackLengthInXtals().

324 {
325 
326  auto cell_p = theSubdetGeometry->getGeometry(aDetId);
327  GlobalPoint p = cell_p->getPosition(23);
328  GlobalPoint diff(point.x()-p.x(),point.y()-p.y(),point.z()-p.z());
329 
330  std::map<int,GlobalPoint>::iterator xtal = trackExitPositionMap.find(aDetId.rawId());
331  if (xtal!=trackExitPositionMap.end())
332  ((*xtal).second)=diff;
333  else
334  trackExitPositionMap.insert(std::pair<int,GlobalPoint>(aDetId.rawId(),diff));
335 
336  std::map<int,float>::iterator xtal2 = trackCrossedXtalMap.find(aDetId.rawId());
337  if (xtal2!= trackCrossedXtalMap.end())
338  ((*xtal2).second)+=step;
339  else
340  trackCrossedXtalMap.insert(std::pair<int,float>(aDetId.rawId(),step));
341 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
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.
step
Definition: StallMonitor.cc:94
T x() const
Definition: PV3DBase.h:62
std::vector< SteppingHelixStateInfo > BetaCalculatorECAL::calcEcalDeposit ( const FreeTrajectoryState tkInnerState,
const DetIdAssociator associator 
)
private

Definition at line 203 of file BetaCalculatorECAL.cc.

References alongMomentum, bField_, FiducialVolume::maxR(), pvSelector_cfi::maxZ, FiducialVolume::maxZ(), FiducialVolume::minR(), HiClusterCompatibility_cfi::minZ, FiducialVolume::minZ(), propagateThoughFromIP(), SteppingHelixPropagator_cfi::SteppingHelixPropagator, and DetIdAssociator::volume().

Referenced by addInfoToCandidate().

205 {
206  // Set some parameters
207  double minR = associator.volume().minR () ;
208  double minZ = associator.volume().minZ () ;
209  double maxR = associator.volume().maxR () ;
210  double maxZ = associator.volume().maxZ () ;
211 
212  // Define the TrackOrigin (where the propagation starts)
213  SteppingHelixStateInfo trackOrigin(*tkInnerState);
214 
215  // Define Propagator
217  prop -> setMaterialMode(false);
218  prop -> applyRadX0Correction(true);
219 
220  return propagateThoughFromIP(trackOrigin,prop,associator.volume(), 500,0.1,minR,minZ,maxR,maxZ);
221 }
double maxZ(bool withTolerance=true) const
double minZ(bool withTolerance=true) const
double minR(bool withTolerance=true) const
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::ESHandle< MagneticField > bField_
double maxR(bool withTolerance=true) const
int BetaCalculatorECAL::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 
)
private

Definition at line 223 of file BetaCalculatorECAL.cc.

References addStepToXtal(), DetId::Ecal, ecaldqm::getGeometry(), CaloGeometry::getSubdetectorGeometry(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), gen::k, mag(), point, and funct::true.

Referenced by addInfoToCandidate().

231 {
232  GlobalPoint origin (0., 0., 0.);
233  internalPointCurved = origin ;
234  externalPointCurved = origin ;
235 
236  bool firstPoint = false;
237  trackCrossedXtalMap.clear();
238 
239  const CaloSubdetectorGeometry* theBarrelSubdetGeometry = theGeometry->getSubdetectorGeometry(DetId::Ecal,1);
240  const CaloSubdetectorGeometry* theEndcapSubdetGeometry = theGeometry->getSubdetectorGeometry(DetId::Ecal,2);
241 
242  for(std::vector<SteppingHelixStateInfo>::const_iterator itr = (neckLace.begin() + 1); itr != neckLace.end(); ++itr)
243  {
244  GlobalPoint probe_gp = (*itr).position();
245  std::vector<DetId> surroundingMatrix;
246 
247  EBDetId closestBarrelDetIdToProbe = ((theBarrelSubdetGeometry -> getClosestCell(probe_gp)).rawId());
248  EEDetId closestEndcapDetIdToProbe = ((theEndcapSubdetGeometry -> getClosestCell(probe_gp)).rawId());
249 
250  // check if the probe is inside the xtal
251  if( (closestEndcapDetIdToProbe) &&
252  (theGeometry->getSubdetectorGeometry(closestEndcapDetIdToProbe)->
253  getGeometry(closestEndcapDetIdToProbe)->inside(probe_gp)) )
254  {
255  double step = ((*itr).position() - (*(itr-1)).position()).mag();
256  GlobalPoint point = itr->position();
257  addStepToXtal(trackExitPositionMap, trackCrossedXtalMap, closestEndcapDetIdToProbe, step, point, theEndcapSubdetGeometry);
258  totalLengthCurved += step;
259 
260  if (firstPoint == false)
261  {
262  internalPointCurved = probe_gp ;
263  firstPoint = true ;
264  }
265 
266  externalPointCurved = probe_gp ;
267  }
268 
269  if( (closestBarrelDetIdToProbe) &&
270  (theGeometry->getSubdetectorGeometry(closestBarrelDetIdToProbe)->
271  getGeometry(closestBarrelDetIdToProbe)->inside(probe_gp)) )
272  {
273  double step = ((*itr).position() - (*(itr-1)).position()).mag();
274  GlobalPoint point = itr->position();
275  addStepToXtal(trackExitPositionMap, trackCrossedXtalMap, closestBarrelDetIdToProbe, step, point, theBarrelSubdetGeometry);
276  totalLengthCurved += step;
277 
278  if (firstPoint == false)
279  {
280  internalPointCurved = probe_gp ;
281  firstPoint = true ;
282  }
283 
284  externalPointCurved = probe_gp ;
285  }
286  else
287  {
288  // 3x3 matrix surrounding the probe
289  surroundingMatrix = theTopology->getSubdetectorTopology(closestBarrelDetIdToProbe)->getWindow(closestBarrelDetIdToProbe,3,3);
290 
291  for( unsigned int k=0; k<surroundingMatrix.size(); ++k ) {
292  if(theGeometry->getSubdetectorGeometry(surroundingMatrix.at(k))->getGeometry(surroundingMatrix.at(k))->inside(probe_gp))
293  {
294  double step = ((*itr).position() - (*(itr-1)).position()).mag();
295  GlobalPoint point = itr->position();
296  addStepToXtal(trackExitPositionMap, trackCrossedXtalMap, surroundingMatrix[k], step,
297  point, theGeometry->getSubdetectorGeometry(surroundingMatrix.at(k)));
298  totalLengthCurved += step;
299 
300  if (firstPoint == false)
301  {
302  internalPointCurved = probe_gp ;
303  firstPoint = true ;
304  }
305 
306  externalPointCurved = probe_gp ;
307  }
308  }
309 
310  // clear neighborhood matrix
311  surroundingMatrix.clear();
312  }
313  }
314 
315  return 0;
316 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
CaloGeometry const * getGeometry()
int k[5][pyjets_maxn]
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
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
Definition: CaloTopology.cc:20
step
Definition: StallMonitor.cc:94
*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
Definition: invegas.h:5

Member Data Documentation

edm::ESHandle<MagneticField> BetaCalculatorECAL::bField_
private

Definition at line 64 of file BetaCalculatorECAL.h.

Referenced by addInfoToCandidate(), and calcEcalDeposit().

edm::EDGetTokenT<EBRecHitCollection> BetaCalculatorECAL::EBRecHitCollectionToken_
private

Definition at line 60 of file BetaCalculatorECAL.h.

Referenced by addInfoToCandidate().

edm::ESHandle<DetIdAssociator> BetaCalculatorECAL::ecalDetIdAssociator_
private

Definition at line 63 of file BetaCalculatorECAL.h.

Referenced by addInfoToCandidate().

edm::EDGetTokenT<EERecHitCollection> BetaCalculatorECAL::EERecHitCollectionToken_
private

Definition at line 61 of file BetaCalculatorECAL.h.

Referenced by addInfoToCandidate().

TrackAssociatorParameters BetaCalculatorECAL::parameters_
private
edm::ESHandle<CaloGeometry> BetaCalculatorECAL::theCaloGeometry_
private

Definition at line 65 of file BetaCalculatorECAL.h.

Referenced by addInfoToCandidate().

TrackDetectorAssociator BetaCalculatorECAL::trackAssociator_
private

Definition at line 58 of file BetaCalculatorECAL.h.

Referenced by addInfoToCandidate(), and BetaCalculatorECAL().