49 photonCollectionProducer_ =
pset.getParameter<
std::string>(
"phoProducer");
66 h_ErecoEMC_ = fs->
make<TH1F>(
"deltaE",
" delta(reco-mc) energy", 100, 0., 2.);
67 h_deltaPhi_ = fs->
make<TH1F>(
"deltaPhi",
" delta(reco-mc) phi", 100, -0.1, 0.1);
68 h_deltaEta_ = fs->
make<TH1F>(
"deltaEta",
" delta(reco-mc) eta", 100, -0.05, 0.05);
71 h_MCphoE_ = fs->
make<TH1F>(
"MCphoE",
"MC photon energy", 100, 0., 100.);
72 h_MCphoPhi_ = fs->
make<TH1F>(
"MCphoPhi",
"MC photon phi", 40, -3.14, 3.14);
73 h_MCphoEta_ = fs->
make<TH1F>(
"MCphoEta",
"MC photon eta", 40, -3., 3.);
76 h_MCConvE_ = fs->
make<TH1F>(
"MCConvE",
"MC converted photon energy", 100, 0., 100.);
77 h_MCConvPt_ = fs->
make<TH1F>(
"MCConvPt",
"MC converted photon pt", 100, 0., 100.);
78 h_MCConvEta_ = fs->
make<TH1F>(
"MCConvEta",
"MC converted photon eta", 50, 0., 2.5);
81 h_scE_ = fs->
make<TH1F>(
"scE",
"SC Energy ", 100, 0., 200.);
82 h_scEt_ = fs->
make<TH1F>(
"scEt",
"SC Et ", 100, 0., 200.);
83 h_scEta_ = fs->
make<TH1F>(
"scEta",
"SC Eta ", 40, -3., 3.);
84 h_scPhi_ = fs->
make<TH1F>(
"scPhi",
"SC Phi ", 40, -3.14, 3.14);
86 h_phoE_ = fs->
make<TH1F>(
"phoE",
"Photon Energy ", 100, 0., 200.);
87 h_phoEta_ = fs->
make<TH1F>(
"phoEta",
"Photon Eta ", 40, -3., 3.);
88 h_phoPhi_ = fs->
make<TH1F>(
"phoPhi",
"Photon Phi ", 40, -3.14, 3.14);
91 h2_tk_nHitsVsR_ = fs->
make<TH2F>(
"tknHitsVsR",
"Tracks Hits vs R ", 12, 0., 120., 20, 0.5, 20.5);
92 h2_tk_inPtVsR_ = fs->
make<TH2F>(
"tkInPtvsR",
"Tracks inner Pt vs R ", 12, 0., 120., 100, 0., 100.);
99 const float PI = 3.1415927;
103 const float R_ECAL = 136.5;
110 float ZEcal =
R_ECAL * sinh(EtaParticle) + Zvertex;
120 if (EtaParticle < 0.0)
122 float Zlen = Zend - Zvertex;
123 float RR = Zlen / sinh(EtaParticle);
124 Theta = atan(RR / Zend);
136 const float etaPhiDistance = 0.01;
146 LogInfo(
"ConvertedPhotonAnalyzer") <<
"ConvertedPhotonAnalyzer Analyzing event number: " <<
e.id()
147 <<
" Global Counter " << nEvt_ <<
"\n";
149 std::cout <<
"ConvertedPhotonAnalyzer Analyzing event number: " <<
e.id() <<
" Global Counter " << nEvt_ <<
"\n";
153 e.getByLabel(photonCollectionProducer_, photonCollection_, photonHandle);
158 std::cout <<
" ConvertedPhotonAnalyzer Looking for MC truth "
162 std::vector<SimTrack> theSimTracks;
163 std::vector<SimVertex> theSimVertices;
167 e.getByLabel(
"g4SimHits", SimTk);
168 e.getByLabel(
"g4SimHits", SimVtx);
170 theSimTracks.insert(theSimTracks.end(), SimTk->begin(), SimTk->end());
171 theSimVertices.insert(theSimVertices.end(), SimVtx->begin(), SimVtx->end());
173 std::vector<PhotonMCTruth> mcPhotons = thePhotonMCTruthFinder_->find(theSimTracks, theSimVertices);
174 std::cout <<
" ConvertedPhotonAnalyzer mcPhotons size " << mcPhotons.size() << std::endl;
181 for (std::vector<PhotonMCTruth>::const_iterator mcPho = mcPhotons.begin(); mcPho != mcPhotons.end(); mcPho++) {
182 float mcPhi = (*mcPho).fourMomentum().phi();
183 float mcEta = (*mcPho).fourMomentum().pseudoRapidity();
184 mcEta = etaTransformation(mcEta, (*mcPho).primaryVertex().z());
186 if ((*mcPho).fourMomentum().et() < 20)
192 h_MCphoE_->Fill((*mcPho).fourMomentum().e());
193 h_MCphoEta_->Fill((*mcPho).fourMomentum().eta());
194 h_MCphoPhi_->Fill((*mcPho).fourMomentum().phi());
197 if ((*mcPho).isAConversion() == 0)
202 h_MCConvEta_->Fill(fabs((*mcPho).fourMomentum().pseudoRapidity()) - 0.001);
214 float phiClu = (*iPho).superCluster()->phi();
215 float etaClu = (*iPho).superCluster()->eta();
226 if (
delta >= etaPhiDistance)
240 h_ErecoEMC_->Fill((*iPho).superCluster()->energy() / (*mcPho).fourMomentum().e());
241 h_deltaPhi_->Fill((*iPho).superCluster()->position().phi() - mcPhi);
242 h_deltaEta_->Fill((*iPho).superCluster()->position().eta() - mcEta);
244 h_scE_->Fill((*iPho).superCluster()->energy());
245 h_scEt_->Fill((*iPho).superCluster()->energy() / cosh((*iPho).superCluster()->position().eta()));
246 h_scEta_->Fill((*iPho).superCluster()->position().eta());
247 h_scPhi_->Fill((*iPho).superCluster()->position().phi());
249 h_phoE_->Fill((*iPho).energy());
250 h_phoEta_->Fill((*iPho).eta());
251 h_phoPhi_->Fill((*iPho).phi());
253 if (!(*iPho).hasConversionTracks())
263 for (
unsigned int i = 0;
i <
tracks.size();
i++) {
266 h2_tk_nHitsVsR_->Fill((*mcPho).vertex().perp(),
tracks[
i]->recHitsSize());
267 h2_tk_inPtVsR_->Fill((*mcPho).vertex().perp(),
sqrt(
tracks[
i]->innerMomentum().Mag2()));
280 edm::LogInfo(
"ConvertedPhotonAnalyzer") <<
"Analyzed " << nEvt_ <<
"\n";
282 std::cout <<
"ConvertedPhotonAnalyzer::endJob Analyzed " << nEvt_ <<
" events "