110 iEvent.
getByLabel(
"generalTracks", trkCollection);
113 iEvent.
getByLabel(
"offlinePrimaryVertices",recVtxs);
117 iEvent.
getByLabel(
"offlineBeamSpot", beamSpotH);
120 if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
121 leadPV =
math::XYZPoint( (*recVtxs)[0].
x(),(*recVtxs)[0].
y(), (*recVtxs)[0].
z() );
122 }
else if (beamSpotH.
isValid()) {
123 leadPV = beamSpotH->position();
127 std::cout <<
"Primary Vertex " << leadPV;
128 if (beamSpotH.
isValid())
std::cout <<
" Beam Spot " << beamSpotH->position();
132 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
134 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
138 iEvent.
getByLabel(
"ecalRecHit",
"EcalRecHitsEB",barrelRecHitsHandle);
139 iEvent.
getByLabel(
"ecalRecHit",
"EcalRecHitsEE",endcapRecHitsHandle);
147 edm::SimTrackContainer::const_iterator simTrkItr;
149 edm::SimVertexContainer::const_iterator vtxItr = SimVtx->begin();
162 iEvent.
getByLabel(
"g4SimHits",
"EcalHitsEB", pcaloeb);
163 iEvent.
getByLabel(
"g4SimHits",
"EcalHitsEE", pcaloee);
164 iEvent.
getByLabel(
"g4SimHits",
"HcalHits", pcalohh);
168 unsigned int nTracks=0;
169 for (trkDetItr = trkCaloDirections.begin(),nTracks=0; trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++){
170 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
172 int nRH_eMipDR=0, nRH_eDR=0, nNearTRKs=0, nRecHitsCone=-99;
173 double distFromHotCell=-99.0, distFromHotCell2=-99.0;
174 int ietaHotCell=-99, iphiHotCell=-99;
175 int ietaHotCell2=-99, iphiHotCell2=-99;
176 GlobalPoint gposHotCell(0.,0.,0.), gposHotCell2(0.,0.,0.);
177 std::vector<DetId> coneRecHitDetIds, coneRecHitDetIds2;
178 std::pair<double, bool> e11x11_20SigP, e15x15_20SigP;
179 double hCone =
spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL, trkDetItr->pointECAL,
180 a_coneR, trkDetItr->directionHCAL, nRecHitsCone,
181 coneRecHitDetIds, distFromHotCell,
182 ietaHotCell, iphiHotCell, gposHotCell);
183 double eHCALDR =
spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL, trkDetItr->pointECAL,
184 a_charIsoR, trkDetItr->directionHCAL, nRecHitsCone,
185 coneRecHitDetIds2, distFromHotCell2,
186 ietaHotCell2, iphiHotCell2, gposHotCell2);
190 double eMipDR =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
191 trkDetItr->pointHCAL, trkDetItr->pointECAL,
192 a_mipR, trkDetItr->directionECAL, nRH_eMipDR);
193 double eECALDR =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
194 trkDetItr->pointHCAL, trkDetItr->pointECAL,
195 a_neutIsoR, trkDetItr->directionECAL, nRH_eDR);
198 e11x11_20SigP =
spr::eECALmatrix(trkDetItr->detIdECAL,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,5,5, 0.060, 0.300,
tMinE_,
tMaxE_);
199 e15x15_20SigP =
spr::eECALmatrix(trkDetItr->detIdECAL,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,7,7, 0.060, 0.300,
tMinE_,
tMaxE_);
217 std::cout <<
"Track p " << pTrack->
p() <<
" pt " << pTrack->
pt()
218 <<
" eta " << pTrack->
momentum().eta() <<
" phi "
219 << pTrack->
momentum().phi() <<
" ieta/iphi ("
220 << closestCell.
ieta() <<
", " << closestCell.
iphi()
221 <<
") Energy in cone " << hCone <<
" Charge Isolation "
222 << conehmaxNearP <<
" eMIP " << eMipDR
223 <<
" Neutral isolation (ECAL) " << eECALDR-eMipDR
224 <<
" (ECAL NxN) " << e15x15_20SigP.first-e11x11_20SigP.first
225 <<
" (HCAL) " << eHCALDR-hCone << std::endl;
231 std::map<std::string, double> hsimInfo;
232 std::vector<int> multiplicity;
235 trkDetItr->directionHCAL, nSimHits);
236 hsimInfo = spr::eHCALSimInfoCone(iEvent, pcalohh, SimTk, SimVtx,
237 pTrack, *associate, geo,
238 trkDetItr->pointHCAL,
240 trkDetItr->directionHCAL,
258 t_hsim ->push_back(hsim );
262 std::cout <<
"Matched (E) " << hsimInfo[
"eMatched"] <<
" (N) "
263 << multiplicity.at(0) <<
" Rest (E) " << hsimInfo[
"eRest"]
264 <<
" (N) " << multiplicity.at(1) <<
" Gamma (E) "
265 << hsimInfo[
"eGamma"] <<
" (N) " << multiplicity.at(2)
266 <<
" Neutral Had (E) " << hsimInfo[
"eNeutralHad"]
267 <<
" (N) " << multiplicity.at(3) <<
" Charged Had (E) "
268 << hsimInfo[
"eChargedHad"] <<
" (N) " << multiplicity.at(4)
269 <<
" Total (E) " << hsimInfo[
"eTotal"] <<
" (N) "
270 << multiplicity.at(5) <<
" PDG " << hsimInfo[
"pdgMatched"]
271 <<
" Total E " << hsim <<
" NHit " << nSimHits <<std::endl;
278 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< int > * t_hsimInfoNPhoton
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
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)
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
spr::trackSelectionParameters selectionParameters
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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
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
std::vector< double > * t_hsimInfoCharHad
std::vector< double > * t_trackPhi
double eCone_hcal(const CaloGeometry *geo, edm::Handle< T > &hits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits)
std::vector< double > * t_hsimInfoPdgMatched
std::vector< int > * t_nSimHits
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)