17 EBRecHitCollection_ (iConfig.getParameter<edm::InputTag>(
"EBRecHitCollection")),
18 EERecHitCollection_ (iConfig.getParameter<edm::InputTag>(
"EERecHitCollection"))
57 for(reco::TrackCollection::const_iterator ndTrack = tracks->begin(); ndTrack != tracks->end(); ++ndTrack) {
68 std::map<int,GlobalPoint> trackExitPositionMap;
69 std::map<int,float> trackCrossedXtalCurvedMap;
73 std::vector<SteppingHelixStateInfo> neckLace;
76 double totalLengthCurved = 0.;
79 if(neckLace.size() > 1)
82 trackCrossedXtalCurvedMap,
90 int numCrysCrossed = -1;
91 numCrysCrossed = trackCrossedXtalCurvedMap.size();
94 float sumWeightedTime = 0;
95 float sumTimeErrorSqr = 0;
97 float sumTrackLength = 0;
98 std::vector<EcalRecHit> crossedRecHits;
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)
108 thisHit = ebRecHits->find(ebDetId);
109 if(thisHit == ebRecHits->end())
123 sumTrackLength+=mapIt->second;
125 crossedRecHits.push_back(hit);
143 sumWeightedTime+=hit.
time()/(errorOnThis*errorOnThis);
144 sumTimeErrorSqr+=1/(errorOnThis*errorOnThis);
150 if(crossedRecHits.size() > 0)
156 result.
ecalDeDx = sumEnergy/sumTrackLength;
161 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);
216 prop -> setMaterialMode(
false);
217 prop -> applyRadX0Correction(
true);
231 bool isPropagationSuccessful = neckLace.
propagateAll(trackOrigin);
233 if (!isPropagationSuccessful)
237 return std::vector<SteppingHelixStateInfo> () ;
240 std::vector<SteppingHelixStateInfo> complicatePoints;
244 return complicatePoints;
248 std::map<int,float>& trackCrossedXtalMap,
249 double& totalLengthCurved,
254 const std::vector<SteppingHelixStateInfo>& neckLace)
257 internalPointCurved = origin ;
258 externalPointCurved = origin ;
260 bool firstPoint =
false;
261 trackCrossedXtalMap.clear();
266 for(std::vector<SteppingHelixStateInfo>::const_iterator itr = (neckLace.begin() + 1); itr != neckLace.end(); ++itr)
270 std::vector<DetId> surroundingMatrix;
272 EBDetId closestBarrelDetIdToProbe = ((theBarrelSubdetGeometry -> getClosestCell(probe_gp)).rawId());
273 EEDetId closestEndcapDetIdToProbe = ((theEndcapSubdetGeometry -> getClosestCell(probe_gp)).rawId());
277 getGeometry(closestEndcapDetIdToProbe)->inside(probe_gp)) )
279 double step = ((*itr).position() - (*(itr-1)).position()).
mag();
281 addStepToXtal(trackExitPositionMap, trackCrossedXtalMap, closestEndcapDetIdToProbe, step, point, theEndcapSubdetGeometry);
282 totalLengthCurved +=
step;
284 if (firstPoint ==
false)
286 internalPointCurved = probe_gp ;
290 externalPointCurved = probe_gp ;
294 getGeometry(closestBarrelDetIdToProbe)->inside(probe_gp)) )
296 double step = ((*itr).position() - (*(itr-1)).position()).
mag();
298 addStepToXtal(trackExitPositionMap, trackCrossedXtalMap, closestBarrelDetIdToProbe, step, point, theBarrelSubdetGeometry);
299 totalLengthCurved +=
step;
301 if (firstPoint ==
false)
303 internalPointCurved = probe_gp ;
307 externalPointCurved = probe_gp ;
314 for(
unsigned int k=0;
k<surroundingMatrix.size(); ++
k ) {
315 if(theGeometry->
getSubdetectorGeometry(surroundingMatrix.at(
k))->getGeometry(surroundingMatrix.at(
k))->inside(probe_gp))
317 double step = ((*itr).position() - (*(itr-1)).position()).
mag();
319 addStepToXtal(trackExitPositionMap, trackCrossedXtalMap, surroundingMatrix[
k], step,
321 totalLengthCurved +=
step;
323 if (firstPoint ==
false)
325 internalPointCurved = probe_gp ;
329 externalPointCurved = probe_gp ;
334 surroundingMatrix.clear();
342 std::map<int,float>& trackCrossedXtalMap,
353 std::map<int,GlobalPoint>::iterator xtal = trackExitPositionMap.find(aDetId.
rawId());
354 if (xtal!=trackExitPositionMap.end())
355 ((*xtal).second)=
diff;
357 trackExitPositionMap.insert(std::pair<int,GlobalPoint>(aDetId.
rawId(),
diff));
359 std::map<int,float>::iterator xtal2 = trackCrossedXtalMap.find(aDetId.
rawId());
360 if (xtal2!= trackCrossedXtalMap.end())
361 ((*xtal2).second)+=
step;
363 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
void setMinDetectorLength(float l=0.)
static FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup &, const reco::Track &)
get FreeTrajectoryState from different track representations
void setMinDetectorRadius(float r=0.)
double maxZ(bool withTolerance=true) const
std::vector< GlobalPoint > ecalTrackExitPositions
void useDefaultPropagator()
use the default propagator
std::vector< T >::const_iterator const_iterator
BetaCalculatorECAL(const edm::ParameterSet &iConfig)
void setPropagationStep(float s=20.)
void getTrajectory(std::vector< SteppingHelixStateInfo > &, const FiducialVolume &, int steps=4)
double minZ(bool withTolerance=true) const
double nXnEnergy(const DetId &, EnergyType, int gridSize=1)
get energy of the NxN shape (N = 2*gridSize + 1) around given detector element
static int position[TOTALCHAMBERS][3]
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< DetId > ecalDetIds
std::vector< float > ecalTimeErrors
uint32_t rawId() const
get the raw id
std::vector< float > ecalTimes
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
bool propagateAll(const SteppingHelixStateInfo &initialState)
propagate through the whole detector, returns true if successful
uint32_t recoFlag() const
float outOfTimeEnergy() const
tuple SteppingHelixPropagator
float outOfTimeChi2() const
edm::ESHandle< DetIdAssociator > ecalDetIdAssociator_
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double crossedEnergy(EnergyType)
energy in detector elements crossed by the track by types
std::vector< float > ecalChi2s
double minR(bool withTolerance=true) const
TrackAssociatorParameters parameters_
double outerEta() const
pseudorapidity of the momentum vector at the outermost hit position
void setPropagator(const Propagator *ptr)
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
edm::InputTag EERecHitCollection_
T const * product() 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
A base class to handle the particular shape of Ecal Xtals. Taken from ORCA Calorimetry Code...
reco::TrackRef trackRef() const
TrackDetectorAssociator trackAssociator_
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
std::vector< float > ecalOutOfTimeChi2s
const FiducialVolume & volume() const
get active detector volume
edm::ESHandle< MagneticField > bField_
std::vector< float > ecalOutOfTimeEnergies
void setStateAtIP(const SteppingHelixStateInfo &state)
double outerPhi() const
azimuthal angle of the momentum vector at the outermost hit position
void setMaxDetectorLength(float l=2200.)
edm::ESHandle< CaloGeometry > theCaloGeometry_
double maxR(bool withTolerance=true) const
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
void loadParameters(const edm::ParameterSet &)
void setMaxDetectorRadius(float r=800.)
std::vector< SteppingHelixStateInfo > calcEcalDeposit(const FreeTrajectoryState *tkInnerState, const DetIdAssociator &associator)
void addInfoToCandidate(HSCParticle &candidate, edm::Handle< reco::TrackCollection > &tracks, edm::Event &iEvent, const edm::EventSetup &iSetup, HSCPCaloInfo &caloInfo)
const double speedOfLight
edm::InputTag EBRecHitCollection_