46 : fOutputFileName_( pset.getUntrackedParameter<
string>(
"HistOutFile",
std::
string(
"TestConversions.root")) ),
74 h_MCPizE_ =
new TH1F(
"MCPizE",
"MC piz energy",100,0.,200.);
75 h_MCPizPhi_ =
new TH1F(
"MCPizPhi",
"MC piz phi",40,-3.14, 3.14);
76 h_MCPizEta_ =
new TH1F(
"MCPizEta",
"MC piz eta",40,-3., 3.);
77 h_MCPizUnEta_ =
new TH1F(
"MCPizUnEta",
"MC un piz eta",40,-3., 3.);
78 h_MCPiz1ConEta_ =
new TH1F(
"MCPiz1ConEta",
"MC con piz eta: at least one converted photon",40,-3., 3.);
79 h_MCPiz2ConEta_ =
new TH1F(
"MCPiz2ConEta",
"MC con piz eta: two converted photons",40,-3., 3.);
80 h_MCPizMass1_=
new TH1F(
"MCPizMass1",
"Piz mass unconverted ",100, 0., 200);
81 h_MCPizMass2_=
new TH1F(
"MCPizMass2",
"Piz mass converted ",100, 0., 200);
84 h_MCPhoE_ =
new TH1F(
"MCPhoE",
"MC photon energy",100,0.,200.);
85 h_MCPhoPhi_ =
new TH1F(
"MCPhoPhi",
"MC photon phi",40,-3.14, 3.14);
86 h_MCPhoEta_ =
new TH1F(
"MCPhoEta",
"MC photon eta",40,-3., 3.);
89 h_MCConvPhoE_ =
new TH1F(
"MCConvPhoE",
"MC converted photon energy",100,0.,200.);
90 h_MCConvPhoPhi_ =
new TH1F(
"MCConvPhoPhi",
"MC converted photon phi",40,-3.14, 3.14);
91 h_MCConvPhoEta_ =
new TH1F(
"MCConvPhoEta",
"MC converted photon eta",40,-3., 3.);
92 h_MCConvPhoR_ =
new TH1F(
"MCConvPhoR",
"MC converted photon R",120,0.,120.);
94 h_MCEleE_ =
new TH1F(
"MCEleE",
"MC ele energy",100,0.,200.);
95 h_MCElePhi_ =
new TH1F(
"MCElePhi",
"MC ele phi",40,-3.14, 3.14);
96 h_MCEleEta_ =
new TH1F(
"MCEleEta",
"MC ele eta",40,-3., 3.);
97 h_BremFrac_ =
new TH1F(
"bremFrac",
"brem frac ", 50, 0., 1.);
101 h_EleEvsPhoE_ =
new TH2F (
"eleEvsPhoE",
"eleEvsPhoE",100,0.,200.,100,0.,200.);
111 const float PI = 3.1415927;
115 const float R_ECAL = 136.5;
122 float ZEcal = R_ECAL*sinh(EtaParticle)+Zvertex;
124 if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
125 if(Theta<0.0) Theta = Theta+
PI ;
128 if( fabs(ETA) > etaBarrelEndcap )
131 if(EtaParticle<0.0 ) Zend = -Zend ;
132 float Zlen = Zend - Zvertex ;
133 float RR = Zlen/sinh(EtaParticle);
134 Theta = atan(RR/Zend);
135 if(Theta<0.0) Theta = Theta+
PI ;
136 ETA = -
log(
tan(0.5*Theta));
146 const float PI = 3.1415927;
150 if(phi > PI) {phi = phi -
TWOPI;}
151 if(phi < -PI) {phi = phi +
TWOPI;}
178 LogInfo(
"MCPizeroAnalyzer") <<
"MCPizeroAnalyzer Analyzing event number: " << e.
id() <<
" Global Counter " <<
nEvt_ <<
"\n";
180 std::cout <<
"MCPizeroAnalyzer Analyzing event number: " << e.
id() <<
" Global Counter " <<
nEvt_ <<
"\n";
183 std::cout <<
" MCPizeroAnalyzer Looking for MC truth " <<
"\n";
186 std::vector<SimTrack> theSimTracks;
187 std::vector<SimVertex> theSimVertices;
194 theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
195 theSimVertices.insert(theSimVertices.end(),SimVtx->begin(),SimVtx->end());
196 std::cout <<
" MCPizeroAnalyzer This Event has " << theSimTracks.size() <<
" sim tracks " << std::endl;
197 std::cout <<
" MCPizeroAnalyzer This Event has " << theSimVertices.size() <<
" sim vertices " << std::endl;
198 if ( theSimTracks.empty() )
std::cout <<
" Event number " << e.
id() <<
" has NO sim tracks " << std::endl;
202 std::cout <<
" MCPizeroAnalyzer MCPizeroeros size " << MCPizeroeros.size() << std::endl;
204 for ( std::vector<PizeroMCTruth>::const_iterator iPiz=MCPizeroeros.begin(); iPiz !=MCPizeroeros.end(); ++iPiz ){
206 h_MCPizE_->Fill ( (*iPiz).fourMomentum().e() );
207 h_MCPizEta_->Fill ( (*iPiz).fourMomentum().pseudoRapidity() );
208 h_MCPizPhi_->Fill ( (*iPiz).fourMomentum().phi() );
210 std::vector<PhotonMCTruth> mcPhotons=(*iPiz).photons();
211 std::cout <<
" MCPizeroAnalyzer mcPhotons size " << mcPhotons.size() << std::endl;
213 float px = mcPhotons[0].fourMomentum().x() + mcPhotons[1].fourMomentum().x();
214 float py = mcPhotons[0].fourMomentum().y() + mcPhotons[1].fourMomentum().y();
215 float pz = mcPhotons[0].fourMomentum().z() + mcPhotons[1].fourMomentum().z();
216 float e = mcPhotons[0].fourMomentum().e() + mcPhotons[1].fourMomentum().e();
217 float invM =
sqrt( e*e - px*px -py*py - pz*pz)*1000;
221 for ( std::vector<PhotonMCTruth>::const_iterator iPho=mcPhotons.begin(); iPho !=mcPhotons.end(); ++iPho ){
222 h_MCPhoE_->Fill ( (*iPho).fourMomentum().e() );
223 h_MCPhoEta_->Fill ( (*iPho).fourMomentum().pseudoRapidity() );
224 h_MCPhoPhi_->Fill ( (*iPho).fourMomentum().phi() );
225 if ( (*iPho).isAConversion() ) {
234 std::vector<ElectronMCTruth> mcElectrons=(*iPho).electrons();
235 std::cout <<
" MCPizeroAnalyzer mcElectrons size " << mcElectrons.size() << std::endl;
237 for ( std::vector<ElectronMCTruth>::const_iterator iEl=mcElectrons.begin(); iEl !=mcElectrons.end(); ++iEl ){
239 if ( (*iEl).fourMomentum().e() < 30 )
continue;
240 h_MCEleE_->Fill ( (*iEl).fourMomentum().e() );
241 h_MCEleEta_->Fill ( (*iEl).fourMomentum().pseudoRapidity() );
245 h_EleEvsPhoE_->Fill ( (*iPho).fourMomentum().e(), (*iEl).fourMomentum().e() );
248 for (
unsigned int iBrem=0; iBrem < (*iEl).bremVertices().size(); ++iBrem )
249 totBrem += (*iEl).bremMomentum()[iBrem].e();
251 h_BremFrac_->Fill( totBrem/(*iEl).fourMomentum().e() );
260 if ( converted > 0 ) {
262 if ( converted==2)
h_MCPiz2ConEta_->Fill ( (*iPiz).fourMomentum().pseudoRapidity() );
264 h_MCPizUnEta_->Fill ( (*iPiz).fourMomentum().pseudoRapidity() );
289 std::cout <<
"MCPizeroAnalyzer::endJob Analyzed " <<
nEvt_ <<
" events " <<
"\n";
float phiNormalization(float &a)
~MCPizeroAnalyzer() override
void analyze(const edm::Event &, const edm::EventSetup &) override
MCPizeroAnalyzer(const edm::ParameterSet &)
float etaTransformation(float a, float b)
Tan< T >::type tan(const T &t)
static float etaBarrelEndcap
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::string fOutputFileName_
std::vector< PizeroMCTruth > find(const std::vector< SimTrack > &simTracks, const std::vector< SimVertex > &simVertices)
PizeroMCTruthFinder * thePizeroMCTruthFinder_