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;
167 Theta = atan(R_ECAL / ZEcal);
172 if (fabs(ETA) > etaBarrelEndcap) {
174 if (EtaParticle < 0.0)
176 float Zlen = Zend - Zvertex;
177 float RR = Zlen / sinh(EtaParticle);
178 Theta = atan(RR / Zend);
181 ETA = -
log(
tan(0.5 * Theta));
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);
209 std::cout <<
"ConvertedPhotonAnalyzer Photons with conversions collection size " << photonCollection.size() <<
"\n";
212 std::cout <<
" ConvertedPhotonAnalyzer Looking for MC truth "
216 std::vector<SimTrack> theSimTracks;
217 std::vector<SimVertex> theSimVertices;
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);
262 for (reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end();
268 float phiClu = (*iPho).superCluster()->phi();
269 float etaClu = (*iPho).superCluster()->eta();
277 deltaPhi =
pow(deltaPhi, 2);
278 deltaEta =
pow(deltaEta, 2);
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())
313 for (
unsigned int i = 0;
i < conversions.
size();
i++) {
315 std::vector<edm::RefToBase<reco::Track> >
tracks = conversions[
i]->tracks();
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 "
static std::vector< std::string > checklist log
std::string photonCollectionProducer_
T * make(const Args &...args) const
make new ROOT object
auto const & tracks
cannot be loose
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Log< level::Info, false > LogInfo
std::vector< Photon > PhotonCollection
collectin of Photon objects
T getParameter(std::string const &) const
void analyze(const edm::Event &, const edm::EventSetup &) override
static constexpr float ZEcal
size_type size() const
Size of the RefVector.
std::string fOutputFileName_
Power< A, B >::type pow(const A &a, const B &b)
static constexpr float Z_Endcap