103 photonCollectionProducer_ =
pset.getParameter<
std::string>(
"phoProducer");
104 photonCollection_ =
pset.getParameter<
std::string>(
"photonCollection");
120 h_ErecoEMC_ =
fs->make<TH1F>(
"deltaE",
" delta(reco-mc) energy", 100, 0., 2.);
121 h_deltaPhi_ =
fs->make<TH1F>(
"deltaPhi",
" delta(reco-mc) phi", 100, -0.1, 0.1);
122 h_deltaEta_ =
fs->make<TH1F>(
"deltaEta",
" delta(reco-mc) eta", 100, -0.05, 0.05);
125 h_MCphoE_ =
fs->make<TH1F>(
"MCphoE",
"MC photon energy", 100, 0., 100.);
126 h_MCphoPhi_ =
fs->make<TH1F>(
"MCphoPhi",
"MC photon phi", 40, -3.14, 3.14);
127 h_MCphoEta_ =
fs->make<TH1F>(
"MCphoEta",
"MC photon eta", 40, -3., 3.);
130 h_MCConvE_ =
fs->make<TH1F>(
"MCConvE",
"MC converted photon energy", 100, 0., 100.);
131 h_MCConvPt_ =
fs->make<TH1F>(
"MCConvPt",
"MC converted photon pt", 100, 0., 100.);
132 h_MCConvEta_ =
fs->make<TH1F>(
"MCConvEta",
"MC converted photon eta", 50, 0., 2.5);
135 h_scE_ =
fs->make<TH1F>(
"scE",
"SC Energy ", 100, 0., 200.);
136 h_scEt_ =
fs->make<TH1F>(
"scEt",
"SC Et ", 100, 0., 200.);
137 h_scEta_ =
fs->make<TH1F>(
"scEta",
"SC Eta ", 40, -3., 3.);
138 h_scPhi_ =
fs->make<TH1F>(
"scPhi",
"SC Phi ", 40, -3.14, 3.14);
140 h_phoE_ =
fs->make<TH1F>(
"phoE",
"Photon Energy ", 100, 0., 200.);
141 h_phoEta_ =
fs->make<TH1F>(
"phoEta",
"Photon Eta ", 40, -3., 3.);
142 h_phoPhi_ =
fs->make<TH1F>(
"phoPhi",
"Photon Phi ", 40, -3.14, 3.14);
145 h2_tk_nHitsVsR_ =
fs->make<TH2F>(
"tknHitsVsR",
"Tracks Hits vs R ", 12, 0., 120., 20, 0.5, 20.5);
146 h2_tk_inPtVsR_ =
fs->make<TH2F>(
"tkInPtvsR",
"Tracks inner Pt vs R ", 12, 0., 120., 100, 0., 100.);
153 const float PI = 3.1415927;
157 const float R_ECAL = 136.5;
164 float ZEcal =
R_ECAL * sinh(EtaParticle) + Zvertex;
174 if (EtaParticle < 0.0)
176 float Zlen = Zend - Zvertex;
177 float RR = Zlen / sinh(EtaParticle);
178 Theta = atan(RR / Zend);
190 const float etaPhiDistance = 0.01;
200 LogInfo(
"ConvertedPhotonAnalyzer") <<
"ConvertedPhotonAnalyzer Analyzing event number: " <<
e.id()
201 <<
" Global Counter " << nEvt_ <<
"\n";
203 std::cout <<
"ConvertedPhotonAnalyzer Analyzing event number: " <<
e.id() <<
" Global Counter " << nEvt_ <<
"\n";
207 e.getByLabel(photonCollectionProducer_, photonCollection_, photonHandle);
212 std::cout <<
" ConvertedPhotonAnalyzer Looking for MC truth " 216 std::vector<SimTrack> theSimTracks;
217 std::vector<SimVertex> theSimVertices;
221 e.getByLabel(
"g4SimHits", SimTk);
222 e.getByLabel(
"g4SimHits", SimVtx);
224 theSimTracks.insert(theSimTracks.end(), SimTk->begin(), SimTk->end());
225 theSimVertices.insert(theSimVertices.end(), SimVtx->begin(), SimVtx->end());
227 std::vector<PhotonMCTruth> mcPhotons = thePhotonMCTruthFinder_->find(theSimTracks, theSimVertices);
228 std::cout <<
" ConvertedPhotonAnalyzer mcPhotons size " << mcPhotons.size() << std::endl;
235 for (std::vector<PhotonMCTruth>::const_iterator mcPho = mcPhotons.begin(); mcPho != mcPhotons.end(); mcPho++) {
236 float mcPhi = (*mcPho).fourMomentum().phi();
237 float mcEta = (*mcPho).fourMomentum().pseudoRapidity();
238 mcEta = etaTransformation(mcEta, (*mcPho).primaryVertex().z());
240 if ((*mcPho).fourMomentum().et() < 20)
246 h_MCphoE_->Fill((*mcPho).fourMomentum().e());
247 h_MCphoEta_->Fill((*mcPho).fourMomentum().eta());
248 h_MCphoPhi_->Fill((*mcPho).fourMomentum().phi());
251 if ((*mcPho).isAConversion() == 0)
256 h_MCConvEta_->Fill(fabs((*mcPho).fourMomentum().pseudoRapidity()) - 0.001);
268 float phiClu = (*iPho).superCluster()->phi();
269 float etaClu = (*iPho).superCluster()->eta();
280 if (
delta >= etaPhiDistance)
294 h_ErecoEMC_->Fill((*iPho).superCluster()->energy() / (*mcPho).fourMomentum().e());
295 h_deltaPhi_->Fill((*iPho).superCluster()->position().phi() - mcPhi);
296 h_deltaEta_->Fill((*iPho).superCluster()->position().eta() - mcEta);
298 h_scE_->Fill((*iPho).superCluster()->energy());
299 h_scEt_->Fill((*iPho).superCluster()->energy() / cosh((*iPho).superCluster()->position().eta()));
300 h_scEta_->Fill((*iPho).superCluster()->position().eta());
301 h_scPhi_->Fill((*iPho).superCluster()->position().phi());
303 h_phoE_->Fill((*iPho).energy());
304 h_phoEta_->Fill((*iPho).eta());
305 h_phoPhi_->Fill((*iPho).phi());
307 if (!(*iPho).hasConversionTracks())
317 for (
unsigned int i = 0;
i <
tracks.size();
i++) {
320 h2_tk_nHitsVsR_->Fill((*mcPho).vertex().perp(),
tracks[
i]->recHitsSize());
321 h2_tk_inPtVsR_->Fill((*mcPho).vertex().perp(),
sqrt(
tracks[
i]->innerMomentum().Mag2()));
334 edm::LogInfo(
"ConvertedPhotonAnalyzer") <<
"Analyzed " << nEvt_ <<
"\n";
336 std::cout <<
"ConvertedPhotonAnalyzer::endJob Analyzed " << nEvt_ <<
" events "
std::string photonCollectionProducer_
T const * product() const
static constexpr float R_ECAL
static const double deltaEta
PhotonsWithConversionsAnalyzer(const edm::ParameterSet &)
PhotonMCTruthFinder * thePhotonMCTruthFinder_
~PhotonsWithConversionsAnalyzer() override
std::string photonCollection_
float etaTransformation(float a, float b)
Tan< T >::type tan(const T &t)
static constexpr float etaBarrelEndcap
Log< level::Info, false > LogInfo
auto const & tracks
cannot be loose
std::vector< Photon > PhotonCollection
collectin of Photon objects
void analyze(const edm::Event &, const edm::EventSetup &) override
static constexpr float ZEcal
std::string fOutputFileName_
Power< A, B >::type pow(const A &a, const B &b)
static constexpr float Z_Endcap