66 delete thePhotonMCTruthFinder_;
88 h_ErecoEMC_ = fs->
make<TH1F>(
"deltaE",
" delta(reco-mc) energy",100,0.,2.);
89 h_deltaPhi_ = fs->
make<TH1F>(
"deltaPhi",
" delta(reco-mc) phi",100,-0.1, 0.1);
90 h_deltaEta_ = fs->
make<TH1F>(
"deltaEta",
" delta(reco-mc) eta",100,-0.05, 0.05);
93 h_MCphoE_ = fs->
make<TH1F>(
"MCphoE",
"MC photon energy",100,0.,100.);
94 h_MCphoPhi_ = fs->
make<TH1F>(
"MCphoPhi",
"MC photon phi",40,-3.14, 3.14);
95 h_MCphoEta_ = fs->
make<TH1F>(
"MCphoEta",
"MC photon eta",40,-3., 3.);
99 h_MCConvE_ = fs->
make<TH1F>(
"MCConvE",
"MC converted photon energy",100,0.,100.);
100 h_MCConvPt_ = fs->
make<TH1F>(
"MCConvPt",
"MC converted photon pt",100,0.,100.);
101 h_MCConvEta_ = fs->
make<TH1F>(
"MCConvEta",
"MC converted photon eta",50, 0., 2.5);
104 h_scE_ = fs->
make<TH1F>(
"scE",
"SC Energy ",100,0., 200.);
105 h_scEt_ = fs->
make<TH1F>(
"scEt",
"SC Et ",100,0., 200.);
106 h_scEta_ = fs->
make<TH1F>(
"scEta",
"SC Eta ",40,-3., 3.);
107 h_scPhi_ = fs->
make<TH1F>(
"scPhi",
"SC Phi ",40, -3.14, 3.14);
109 h_phoE_ = fs->
make<TH1F>(
"phoE",
"Photon Energy ",100,0., 200.);
110 h_phoEta_ = fs->
make<TH1F>(
"phoEta",
"Photon Eta ",40,-3., 3.);
111 h_phoPhi_ = fs->
make<TH1F>(
"phoPhi",
"Photon Phi ",40, -3.14, 3.14);
114 h2_tk_nHitsVsR_ = fs->
make<TH2F>(
"tknHitsVsR",
"Tracks Hits vs R ", 12,0.,120.,20,0.5, 20.5);
115 h2_tk_inPtVsR_ = fs->
make<TH2F>(
"tkInPtvsR",
"Tracks inner Pt vs R ", 12,0.,120.,100,0., 100.);
125 const float PI = 3.1415927;
129 const float R_ECAL = 136.5;
136 float ZEcal = R_ECAL*sinh(EtaParticle)+Zvertex;
138 if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
139 if(Theta<0.0) Theta = Theta+
PI ;
142 if( fabs(ETA) > etaBarrelEndcap )
145 if(EtaParticle<0.0 ) Zend = -Zend ;
146 float Zlen = Zend - Zvertex ;
147 float RR = Zlen/sinh(EtaParticle);
148 Theta = atan(RR/Zend);
149 if(Theta<0.0) Theta = Theta+
PI ;
150 ETA = -
log(
tan(0.5*Theta));
167 const float etaPhiDistance=0.01;
178 LogInfo(
"ConvertedPhotonAnalyzer") <<
"ConvertedPhotonAnalyzer Analyzing event number: " << e.
id() <<
" Global Counter " << nEvt_ <<
"\n";
180 std::cout <<
"ConvertedPhotonAnalyzer Analyzing event number: " << e.
id() <<
" Global Counter " << nEvt_ <<
"\n";
185 e.
getByLabel(photonCollectionProducer_, photonCollection_ , photonHandle);
187 std::cout <<
"ConvertedPhotonAnalyzer Photons with conversions collection size " << photonCollection.size() <<
"\n";
191 std::cout <<
" ConvertedPhotonAnalyzer Looking for MC truth " <<
"\n";
194 std::vector<SimTrack> theSimTracks;
195 std::vector<SimVertex> theSimVertices;
202 theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
203 theSimVertices.insert(theSimVertices.end(),SimVtx->begin(),SimVtx->end());
205 std::vector<PhotonMCTruth> mcPhotons=thePhotonMCTruthFinder_->find (theSimTracks, theSimVertices);
206 std::cout <<
" ConvertedPhotonAnalyzer mcPhotons size " << mcPhotons.size() << std::endl;
215 for ( std::vector<PhotonMCTruth>::const_iterator mcPho=mcPhotons.begin(); mcPho !=mcPhotons.end(); mcPho++) {
216 float mcPhi= (*mcPho).fourMomentum().phi();
217 float mcEta= (*mcPho).fourMomentum().pseudoRapidity();
218 mcEta = etaTransformation(mcEta, (*mcPho).primaryVertex().z() );
220 if ( (*mcPho).fourMomentum().et() < 20 )
continue;
227 h_MCphoE_->Fill( (*mcPho).fourMomentum().e());
228 h_MCphoEta_->Fill( (*mcPho).fourMomentum().eta());
229 h_MCphoPhi_->Fill( (*mcPho).fourMomentum().phi());
234 if ( (*mcPho).isAConversion() == 0 )
continue;
239 h_MCConvEta_ ->Fill ( fabs( (*mcPho).fourMomentum().pseudoRapidity()) - 0.001);
247 for( reco::PhotonCollection::const_iterator iPho = photonCollection.begin(); iPho != photonCollection.end(); iPho++) {
252 float phiClu=(*iPho).superCluster()->phi();
253 float etaClu=(*iPho).superCluster()->eta();
260 deltaPhi=
pow(deltaPhi,2);
261 deltaEta=
pow(deltaEta,2);
263 if ( delta >= etaPhiDistance ) REJECTED=
true;
268 if ( REJECTED )
continue;
278 h_ErecoEMC_->Fill( (*iPho).superCluster()->energy()/(*mcPho).fourMomentum().e());
279 h_deltaPhi_->
Fill ( (*iPho).superCluster()->position().phi()- mcPhi);
280 h_deltaEta_->
Fill ( (*iPho).superCluster()->position().eta()- mcEta);
282 h_scE_->Fill( (*iPho).superCluster()->energy() );
283 h_scEt_->Fill( (*iPho).superCluster()->energy()/cosh( (*iPho).superCluster()->position().eta()) );
284 h_scEta_->Fill( (*iPho).superCluster()->position().eta() );
285 h_scPhi_->Fill( (*iPho).superCluster()->position().phi() );
288 h_phoE_->Fill( (*iPho).energy() );
289 h_phoEta_->Fill( (*iPho).eta() );
290 h_phoPhi_->Fill( (*iPho).phi() );
292 if ( !(*iPho).hasConversionTracks() )
continue;
298 for (
unsigned int i=0;
i<conversions.
size();
i++) {
300 std::vector< edm::RefToBase<reco::Track> >
tracks = conversions[
i]->tracks();
302 for (
unsigned int i=0;
i<tracks.size();
i++) {
307 h2_tk_nHitsVsR_ ->
Fill ( (*mcPho).vertex().perp(), tracks[
i]->recHitsSize() );
308 h2_tk_inPtVsR_->Fill ( (*mcPho).vertex().perp(),
sqrt( tracks[
i]->innerMomentum().Mag2() ) );
333 edm::LogInfo(
"ConvertedPhotonAnalyzer") <<
"Analyzed " << nEvt_ <<
"\n";
335 std::cout <<
"ConvertedPhotonAnalyzer::endJob Analyzed " << nEvt_ <<
" events " <<
"\n";
T getParameter(std::string const &) const
T * make(const Args &...args) const
make new ROOT object
virtual void analyze(const edm::Event &, const edm::EventSetup &)
PhotonsWithConversionsAnalyzer(const edm::ParameterSet &)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
float etaTransformation(float a, float b)
Tan< T >::type tan(const T &t)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::vector< Photon > PhotonCollection
collectin of Photon objects
static const float etaBarrelEndcap
static const float Z_Endcap
return(e1-e2)*(e1-e2)+dp *dp
virtual ~PhotonsWithConversionsAnalyzer()
static const float R_ECAL
size_type size() const
Size of the RefVector.
Power< A, B >::type pow(const A &a, const B &b)