41 std::cout <<
"Parameters read from config file \n"
43 <<
"\t myverbose " << myverbose
45 <<
"\t theTrackQuality " << theTrackQuality
55 <<
"\t a_coneR " << a_coneR
112 iEvent.
getByLabel(
"generalTracks", trkCollection);
115 iEvent.
getByLabel(
"offlinePrimaryVertices",recVtxs);
119 iEvent.
getByLabel(
"offlineBeamSpot", beamSpotH);
122 if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
123 leadPV =
math::XYZPoint( (*recVtxs)[0].
x(),(*recVtxs)[0].
y(), (*recVtxs)[0].
z() );
124 }
else if (beamSpotH.
isValid()) {
125 leadPV = beamSpotH->position();
129 std::cout <<
"Primary Vertex " << leadPV;
130 if (beamSpotH.
isValid())
std::cout <<
" Beam Spot " << beamSpotH->position();
134 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
136 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
140 iEvent.
getByLabel(
"ecalRecHit",
"EcalRecHitsEB",barrelRecHitsHandle);
141 iEvent.
getByLabel(
"ecalRecHit",
"EcalRecHitsEE",endcapRecHitsHandle);
149 edm::SimTrackContainer::const_iterator simTrkItr;
151 edm::SimVertexContainer::const_iterator vtxItr = SimVtx->begin();
164 iEvent.
getByLabel(
"g4SimHits",
"EcalHitsEB", pcaloeb);
165 iEvent.
getByLabel(
"g4SimHits",
"EcalHitsEE", pcaloee);
166 iEvent.
getByLabel(
"g4SimHits",
"HcalHits", pcalohh);
170 unsigned int nTracks=0;
171 for (trkDetItr = trkCaloDirections.begin(),nTracks=0; trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++){
172 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
174 int nRH_eMipDR=0, nRH_eDR=0, nNearTRKs=0, nRecHitsCone=-99;
175 double distFromHotCell=-99.0, distFromHotCell2=-99.0;
176 int ietaHotCell=-99, iphiHotCell=-99;
177 int ietaHotCell2=-99, iphiHotCell2=-99;
178 GlobalPoint gposHotCell(0.,0.,0.), gposHotCell2(0.,0.,0.);
179 std::vector<DetId> coneRecHitDetIds, coneRecHitDetIds2;
180 std::pair<double, bool> e11x11_20SigP, e15x15_20SigP;
181 double hCone =
spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL, trkDetItr->pointECAL,
182 a_coneR, trkDetItr->directionHCAL, nRecHitsCone,
183 coneRecHitDetIds, distFromHotCell,
184 ietaHotCell, iphiHotCell, gposHotCell);
185 double eHCALDR =
spr::eCone_hcal(geo, hbhe, trkDetItr->pointHCAL, trkDetItr->pointECAL,
186 a_charIsoR, trkDetItr->directionHCAL, nRecHitsCone,
187 coneRecHitDetIds2, distFromHotCell2,
188 ietaHotCell2, iphiHotCell2, gposHotCell2);
192 double eMipDR =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
193 trkDetItr->pointHCAL, trkDetItr->pointECAL,
194 a_mipR, trkDetItr->directionECAL, nRH_eMipDR);
195 double eECALDR =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
196 trkDetItr->pointHCAL, trkDetItr->pointECAL,
197 a_neutIsoR, trkDetItr->directionECAL, nRH_eDR);
198 double eMipDR_1 =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
199 trkDetItr->pointHCAL, trkDetItr->pointECAL,
200 a_mipR, trkDetItr->directionECAL, nRH_eMipDR,
202 double eECALDR_1=
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
203 trkDetItr->pointHCAL, trkDetItr->pointECAL,
204 a_neutIsoR, trkDetItr->directionECAL, nRH_eDR,
206 double eMipDR_2 =
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
207 trkDetItr->pointHCAL, trkDetItr->pointECAL,
208 a_mipR, trkDetItr->directionECAL, nRH_eMipDR,
210 double eECALDR_2=
spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle,
211 trkDetItr->pointHCAL, trkDetItr->pointECAL,
212 a_neutIsoR, trkDetItr->directionECAL, nRH_eDR,
220 e11x11_20SigP =
spr::eECALmatrix(trkDetItr->detIdECAL,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,sevlv.
product(),5,5, 0.060, 0.300,
tMinE_,
tMaxE_);
221 e15x15_20SigP =
spr::eECALmatrix(trkDetItr->detIdECAL,barrelRecHitsHandle,endcapRecHitsHandle, *theEcalChStatus, geo, caloTopology,sevlv.
product(),7,7, 0.060, 0.300,
tMinE_,
tMaxE_);
243 std::cout <<
"Track p " << pTrack->
p() <<
" pt " << pTrack->
pt()
244 <<
" eta " << pTrack->
momentum().eta() <<
" phi "
245 << pTrack->
momentum().phi() <<
" ieta/iphi ("
246 << closestCell.
ieta() <<
", " << closestCell.
iphi()
247 <<
") Energy in cone " << hCone <<
" Charge Isolation "
248 << conehmaxNearP <<
" eMIP (" << eMipDR <<
", "
249 << eMipDR_1 <<
", " << eMipDR_2 <<
")"
250 <<
" Neutral isolation (ECAL) (" << eECALDR-eMipDR <<
", "
251 << eECALDR_1-eMipDR_1 <<
", " << eECALDR_2-eMipDR_2 <<
")"
252 <<
" (ECAL NxN) " << e15x15_20SigP.first-e11x11_20SigP.first
253 <<
" (HCAL) " << eHCALDR-hCone << std::endl;
259 std::map<std::string, double> hsimInfo;
260 std::vector<int> multiplicity;
263 trkDetItr->directionHCAL, nSimHits);
264 hsimInfo = spr::eHCALSimInfoCone(iEvent, pcalohh, SimTk, SimVtx,
265 pTrack, *associate, geo,
266 trkDetItr->pointHCAL,
268 trkDetItr->directionHCAL,
286 t_hsim ->push_back(hsim );
290 std::cout <<
"Matched (E) " << hsimInfo[
"eMatched"] <<
" (N) "
291 << multiplicity.at(0) <<
" Rest (E) " << hsimInfo[
"eRest"]
292 <<
" (N) " << multiplicity.at(1) <<
" Gamma (E) "
293 << hsimInfo[
"eGamma"] <<
" (N) " << multiplicity.at(2)
294 <<
" Neutral Had (E) " << hsimInfo[
"eNeutralHad"]
295 <<
" (N) " << multiplicity.at(3) <<
" Charged Had (E) "
296 << hsimInfo[
"eChargedHad"] <<
" (N) " << multiplicity.at(4)
297 <<
" Total (E) " << hsimInfo[
"eTotal"] <<
" (N) "
298 << multiplicity.at(5) <<
" PDG " << hsimInfo[
"pdgMatched"]
299 <<
" Total E " << hsim <<
" NHit " << nSimHits <<std::endl;
306 if (associate)
delete associate;
317 tree->SetAutoSave(10000);
323 t_trackP =
new std::vector<double>();
329 t_hCone =
new std::vector<double>();
331 t_eMipDR =
new std::vector<double>();
342 tree->Branch(
"t_trackPt",
"vector<double>", &t_trackPt );
343 tree->Branch(
"t_trackEta",
"vector<double>", &t_trackEta );
344 tree->Branch(
"t_trackPhi",
"vector<double>", &t_trackPhi );
345 tree->Branch(
"t_trackHcalEta",
"vector<double>", &t_trackHcalEta );
346 tree->Branch(
"t_trackHcalPhi",
"vector<double>", &t_trackHcalPhi );
347 tree->Branch(
"t_hCone",
"vector<double>", &t_hCone );
348 tree->Branch(
"t_conehmaxNearP",
"vector<double>", &t_conehmaxNearP );
349 tree->Branch(
"t_eMipDR",
"vector<double>", &t_eMipDR );
350 tree->Branch(
"t_eECALDR",
"vector<double>", &t_eECALDR );
351 tree->Branch(
"t_eHCALDR",
"vector<double>", &t_eHCALDR );
352 tree->Branch(
"t_e11x11_20Sig",
"vector<double>", &t_e11x11_20Sig );
353 tree->Branch(
"t_e15x15_20Sig",
"vector<double>", &t_e15x15_20Sig );
354 tree->Branch(
"t_eMipDR_1",
"vector<double>", &t_eMipDR_1 );
355 tree->Branch(
"t_eECALDR_1",
"vector<double>", &t_eECALDR_1 );
356 tree->Branch(
"t_eMipDR_2",
"vector<double>", &t_eMipDR_2 );
357 tree->Branch(
"t_eECALDR_2",
"vector<double>", &t_eECALDR_2 );
373 t_hsim =
new std::vector<double>();
377 tree->Branch(
"t_hsimInfoRest",
"vector<double>", &t_hsimInfoRest );
378 tree->Branch(
"t_hsimInfoPhoton",
"vector<double>", &t_hsimInfoPhoton );
379 tree->Branch(
"t_hsimInfoNeutHad",
"vector<double>", &t_hsimInfoNeutHad );
380 tree->Branch(
"t_hsimInfoCharHad",
"vector<double>", &t_hsimInfoCharHad );
381 tree->Branch(
"t_hsimInfoPdgMatched",
"vector<double>", &t_hsimInfoPdgMatched );
382 tree->Branch(
"t_hsimInfoTotal",
"vector<double>", &t_hsimInfoTotal );
383 tree->Branch(
"t_hsimInfoNMatched",
"vector<int>", &t_hsimInfoNMatched );
384 tree->Branch(
"t_hsimInfoNTotal",
"vector<int>", &t_hsimInfoNTotal );
385 tree->Branch(
"t_hsimInfoNNeutHad",
"vector<int>", &t_hsimInfoNNeutHad );
386 tree->Branch(
"t_hsimInfoNCharHad",
"vector<int>", &t_hsimInfoNCharHad );
387 tree->Branch(
"t_hsimInfoNPhoton",
"vector<int>", &t_hsimInfoNPhoton );
388 tree->Branch(
"t_hsimInfoNRest",
"vector<int>", &t_hsimInfoNRest );
389 tree->Branch(
"t_hsim",
"vector<double>", &t_hsim );
390 tree->Branch(
"t_nSimHits",
"vector<int>", &t_nSimHits );
double p() const
momentum vector magnitude
std::vector< double > * t_hsimInfoMatched
edm::Service< TFileService > fs
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) 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)
IsolatedTracksHcalScale(const edm::ParameterSet &)
const Vector & momentum() const
track momentum vector
std::vector< int > * t_hsimInfoNTotal
std::vector< int > * t_hsimInfoNCharHad
std::vector< int > * t_hsimInfoNMatched
TrackQuality
track quality
#define DEFINE_FWK_MODULE(type)
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)
~IsolatedTracksHcalScale()
std::vector< double > * t_e11x11_20Sig
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)
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
void analyze(const edm::Event &, const edm::EventSetup &)
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
static TrackQuality qualityByName(const std::string &name)
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
reco::TrackBase::TrackQuality minQuality
std::vector< double > * t_trackPhi
T * make() const
make new ROOT object
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)