45 : fOutputFileName_( pset.getUntrackedParameter<
string>(
"HistOutFile",
std::
string(
"TestConversions.root")) ),
74 h_MCEleE_ =
new TH1F(
"MCEleE",
"MC ele energy",100,0.,200.);
75 h_MCElePhi_ =
new TH1F(
"MCElePhi",
"MC ele phi",40,-3.14, 3.14);
76 h_MCEleEta_ =
new TH1F(
"MCEleEta",
"MC ele eta",40,-3., 3.);
77 h_BremFrac_ =
new TH1F(
"bremFrac",
"brem frac ", 100, 0., 1.);
80 p_BremVsR_ =
new TProfile(
"BremVsR",
" Mean Brem energy vs R ", 48, 0., 120.);
81 p_BremVsEta_ =
new TProfile(
"BremVsEta",
" Mean Brem energy vs Eta ", 50, -2.5, 2.5);
93 const float PI = 3.1415927;
97 const float R_ECAL = 136.5;
104 float ZEcal = R_ECAL*sinh(EtaParticle)+Zvertex;
106 if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
107 if(Theta<0.0) Theta = Theta+
PI ;
110 if(
std::abs(ETA) > etaBarrelEndcap )
113 if(EtaParticle<0.0 ) Zend = -Zend ;
114 float Zlen = Zend - Zvertex ;
115 float RR = Zlen/sinh(EtaParticle);
116 Theta = atan(RR/Zend);
117 if(Theta<0.0) Theta = Theta+
PI ;
118 ETA = -
log(
tan(0.5*Theta));
128 const float PI = 3.1415927;
132 if(phi > PI) {phi = phi -
TWOPI;}
133 if(phi < -PI) {phi = phi +
TWOPI;}
160 LogInfo(
"MCElectronAnalyzer") <<
"MCElectronAnalyzer Analyzing event number: " << e.
id() <<
" Global Counter " <<
nEvt_ <<
"\n";
162 std::cout <<
"MCElectronAnalyzer Analyzing event number: " << e.
id() <<
" Global Counter " <<
nEvt_ <<
"\n";
165 std::cout <<
" MCElectronAnalyzer Looking for MC truth " <<
"\n";
168 std::vector<SimTrack> theSimTracks;
169 std::vector<SimVertex> theSimVertices;
176 theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
177 theSimVertices.insert(theSimVertices.end(),SimVtx->begin(),SimVtx->end());
178 std::cout <<
" MCElectronAnalyzer This Event has " << theSimTracks.size() <<
" sim tracks " << std::endl;
179 std::cout <<
" MCElectronAnalyzer This Event has " << theSimVertices.size() <<
" sim vertices " << std::endl;
180 if ( theSimTracks.empty() )
std::cout <<
" Event number " << e.
id() <<
" has NO sim tracks " << std::endl;
184 std::cout <<
" MCElectronAnalyzer MCElectronctrons size " << MCElectronctrons.size() << std::endl;
186 for ( std::vector<ElectronMCTruth>::const_iterator iEl=MCElectronctrons.begin(); iEl !=MCElectronctrons.end(); ++iEl ){
188 h_MCEleE_->Fill ( (*iEl).fourMomentum().e() );
189 h_MCEleEta_->Fill ( (*iEl).fourMomentum().pseudoRapidity() );
194 for ( iBrem=0; iBrem < (*iEl).bremVertices().size(); ++iBrem ) {
195 float rBrem= (*iEl).bremVertices()[iBrem].perp();
196 float etaBrem= (*iEl).bremVertices()[iBrem].eta();
198 totBrem += (*iEl).bremMomentum()[iBrem].e();
199 p_BremVsR_ ->Fill ( rBrem, (*iEl).bremMomentum()[iBrem].e() );
200 p_BremVsEta_ ->Fill ( etaBrem, (*iEl).bremMomentum()[iBrem].e() );
206 h_BremFrac_->Fill( totBrem/(*iEl).fourMomentum().e() );
232 std::cout <<
"MCElectronAnalyzer::endJob Analyzed " <<
nEvt_ <<
" events " <<
"\n";
MCElectronAnalyzer(const edm::ParameterSet &)
ElectronMCTruthFinder * theElectronMCTruthFinder_
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
#define TWOPI
EgammaCoreTools.
float phiNormalization(float &a)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
float etaTransformation(float a, float b)
static const float etaBarrelEndcap
static const float Z_Endcap
return(e1-e2)*(e1-e2)+dp *dp
std::vector< ElectronMCTruth > find(const std::vector< SimTrack > &simTracks, const std::vector< SimVertex > &simVertices)
static const float R_ECAL
void analyze(const edm::Event &, const edm::EventSetup &) override
~MCElectronAnalyzer() override
std::string fOutputFileName_