113 iEvent.
getByLabel(
"generalTracks", trkCollection);
116 iEvent.
getByLabel(
"offlinePrimaryVertices",recVtxs);
120 iEvent.
getByLabel(
"offlineBeamSpot", beamSpotH);
123 if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
124 leadPV =
math::XYZPoint( (*recVtxs)[0].
x(),(*recVtxs)[0].
y(), (*recVtxs)[0].
z() );
125 }
else if (beamSpotH.
isValid()) {
126 leadPV = beamSpotH->position();
130 std::cout <<
"Primary Vertex " << leadPV;
131 if (beamSpotH.
isValid())
std::cout <<
" Beam Spot " << beamSpotH->position();
135 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
137 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
141 iEvent.
getByLabel(
"ecalRecHit",
"EcalRecHitsEB",barrelRecHitsHandle);
142 iEvent.
getByLabel(
"ecalRecHit",
"EcalRecHitsEE",endcapRecHitsHandle);
150 edm::SimTrackContainer::const_iterator simTrkItr;
152 edm::SimVertexContainer::const_iterator vtxItr = SimVtx->begin();
165 iEvent.
getByLabel(
"g4SimHits",
"EcalHitsEB", pcaloeb);
166 iEvent.
getByLabel(
"g4SimHits",
"EcalHitsEE", pcaloee);
167 iEvent.
getByLabel(
"g4SimHits",
"HcalHits", pcalohh);
171 unsigned int nTracks=0;
172 for (trkDetItr = trkCaloDirections.begin(),nTracks=0; trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++){
173 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
175 int nRH_eMipDR=0, nRH_eDR=0, nNearTRKs=0, nRecHitsCone=-99;
176 double distFromHotCell=-99.0, distFromHotCell2=-99.0;
177 int ietaHotCell=-99, iphiHotCell=-99;
178 int ietaHotCell2=-99, iphiHotCell2=-99;
179 GlobalPoint gposHotCell(0.,0.,0.), gposHotCell2(0.,0.,0.);
180 std::vector<DetId> coneRecHitDetIds, coneRecHitDetIds2;
181 std::pair<double, bool> e11x11_20SigP, e15x15_20SigP;
183 trkDetItr->pointECAL,
184 a_coneR, trkDetItr->directionHCAL,
185 nRecHitsCone, coneRecHitDetIds,
186 distFromHotCell, ietaHotCell, iphiHotCell,
189 trkDetItr->pointECAL,
190 a_coneR, trkDetItr->directionHCAL,
191 nRecHitsCone, coneRecHitDetIds,
192 distFromHotCell, ietaHotCell,
193 iphiHotCell, gposHotCell,
197 trkDetItr->directionHCAL, nRecHitsCone,
198 coneRecHitDetIds2, distFromHotCell2,
199 ietaHotCell2, iphiHotCell2, gposHotCell2,
203 trkDetItr->directionHCAL, nRecHitsCone,
204 coneRecHitDetIds2, distFromHotCell2,
205 ietaHotCell2, iphiHotCell2,
211 endcapRecHitsHandle,trkDetItr->pointHCAL,
212 trkDetItr->pointECAL,
a_mipR,
213 trkDetItr->directionECAL, nRH_eMipDR);
215 endcapRecHitsHandle,trkDetItr->pointHCAL,
217 trkDetItr->directionECAL, nRH_eDR);
219 endcapRecHitsHandle,trkDetItr->pointHCAL,
220 trkDetItr->pointECAL,
a_mipR,
221 trkDetItr->directionECAL, nRH_eMipDR,
224 endcapRecHitsHandle,trkDetItr->pointHCAL,
226 trkDetItr->directionECAL, nRH_eDR,
229 endcapRecHitsHandle,trkDetItr->pointHCAL,
230 trkDetItr->pointECAL,
a_mipR,
231 trkDetItr->directionECAL, nRH_eMipDR,
234 endcapRecHitsHandle,trkDetItr->pointHCAL,
236 trkDetItr->directionECAL, nRH_eDR,
244 e11x11_20SigP =
spr::eECALmatrix(trkDetItr->detIdECAL,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,sevlv.
product(),5,5, 0.060, 0.300,
tMinE_,
tMaxE_);
245 e15x15_20SigP =
spr::eECALmatrix(trkDetItr->detIdECAL,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,sevlv.
product(),7,7, 0.060, 0.300,
tMinE_,
tMaxE_);
269 std::cout <<
"Track p " << pTrack->
p() <<
" pt " << pTrack->
pt()
270 <<
" eta " << pTrack->
momentum().eta() <<
" phi "
271 << pTrack->
momentum().phi() <<
" ieta/iphi ("
272 << closestCell.
ieta() <<
", " << closestCell.
iphi()
273 <<
") Energy in cone " << hCone <<
" Charge Isolation "
274 << conehmaxNearP <<
" eMIP (" << eMipDR <<
", "
275 << eMipDR_1 <<
", " << eMipDR_2 <<
")"
276 <<
" Neutral isolation (ECAL) (" << eECALDR-eMipDR <<
", "
277 << eECALDR_1-eMipDR_1 <<
", " << eECALDR_2-eMipDR_2 <<
")"
278 <<
" (ECAL NxN) " << e15x15_20SigP.first-e11x11_20SigP.first
279 <<
" (HCAL) " << eHCALDR-hCone << std::endl;
285 std::map<std::string, double> hsimInfo;
286 std::vector<int> multiplicity;
289 trkDetItr->directionHCAL, nSimHits);
290 hsimInfo = spr::eHCALSimInfoCone(iEvent, pcalohh, SimTk, SimVtx,
291 pTrack, *associate, geo,
292 trkDetItr->pointHCAL,
294 trkDetItr->directionHCAL,
312 t_hsim ->push_back(hsim );
316 std::cout <<
"Matched (E) " << hsimInfo[
"eMatched"] <<
" (N) "
317 << multiplicity.at(0) <<
" Rest (E) " << hsimInfo[
"eRest"]
318 <<
" (N) " << multiplicity.at(1) <<
" Gamma (E) "
319 << hsimInfo[
"eGamma"] <<
" (N) " << multiplicity.at(2)
320 <<
" Neutral Had (E) " << hsimInfo[
"eNeutralHad"]
321 <<
" (N) " << multiplicity.at(3) <<
" Charged Had (E) "
322 << hsimInfo[
"eChargedHad"] <<
" (N) " << multiplicity.at(4)
323 <<
" Total (E) " << hsimInfo[
"eTotal"] <<
" (N) "
324 << multiplicity.at(5) <<
" PDG " << hsimInfo[
"pdgMatched"]
325 <<
" Total E " << hsim <<
" NHit " << nSimHits <<std::endl;
332 if (associate)
delete associate;
double p() const
momentum vector magnitude
std::vector< double > * t_hsimInfoMatched
EventNumber_t event() const
std::vector< double > * t_eHCALDR
std::vector< int > * t_hsimInfoNRest
std::string theTrackQuality
std::vector< double > * t_hCone
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
const Vector & momentum() const
track momentum vector
std::vector< int > * t_hsimInfoNTotal
std::vector< int > * t_hsimInfoNCharHad
std::vector< int > * t_hsimInfoNMatched
std::vector< double > * t_hsim
int bunchCrossing() const
std::vector< double > * t_hsimInfoNeutHad
edm::LuminosityBlockNumber_t luminosityBlock() const
std::vector< double > * t_eMipDR_2
std::vector< int > * t_hsimInfoNPhoton
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
double eCone_hcal(const CaloGeometry *geo, edm::Handle< T > &hits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double hbThr=-100, double heThr=-100, double hfThr=-100, double hoThr=-100, double tMin=-500, double tMax=500, int detOnly=-1)
std::vector< double > * t_e11x11_20Sig
std::vector< int > * t_hsimInfoNNeutHad
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
double pt() const
track transverse momentum
std::vector< double > * t_trackEta
int ieta() const
get the cell ieta
std::vector< double > * t_eECALDR_2
std::vector< double > * t_eECALDR
spr::trackSelectionParameters selectionParameters
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::vector< double > * t_eMipDR_1
int iphi() const
get the cell iphi
std::vector< double > * t_trackPt
const MagneticField * bField
std::vector< double > * t_trackHcalEta
std::vector< double > * t_trackP
std::vector< double > * t_eECALDR_1
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< double > * t_trackHcalPhi
T const * product() const
T const * product() const
std::vector< double > * t_hsimInfoPhoton
std::vector< double > * t_hsimInfoTotal
double eCone_ecal(const CaloGeometry *geo, edm::Handle< T > &barrelhits, edm::Handle< T > &endcaphits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500)
std::vector< double > * t_hsimInfoCharHad
std::vector< double > * t_trackPhi
std::vector< double > * t_eHCALDRHB
std::vector< double > * t_hsimInfoPdgMatched
std::vector< int > * t_nSimHits
std::vector< double > * t_hConeHB
std::vector< double > * t_hsimInfoRest
std::vector< double > * t_conehmaxNearP
std::vector< double > * t_e15x15_20Sig
std::vector< double > * t_eMipDR
double eECALmatrix(const DetId &detId, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, const CaloGeometry *geo, const CaloTopology *caloTopology, int ieta, int iphi, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)