42 : fOutputFileName_(pset.getUntrackedParameter<
string>(
"HistOutFile",
std::
string(
"TestConversions.root"))),
55 h_MCEleE_ =
new TH1F(
"MCEleE",
"MC ele energy", 100, 0., 200.);
56 h_MCElePhi_ =
new TH1F(
"MCElePhi",
"MC ele phi", 40, -3.14, 3.14);
57 h_MCEleEta_ =
new TH1F(
"MCEleEta",
"MC ele eta", 40, -3., 3.);
58 h_BremFrac_ =
new TH1F(
"bremFrac",
"brem frac ", 100, 0., 1.);
59 h_BremEnergy_ =
new TH1F(
"BremE",
"Brem energy", 100, 0., 200.);
61 p_BremVsR_ =
new TProfile(
"BremVsR",
" Mean Brem energy vs R ", 48, 0., 120.);
62 p_BremVsEta_ =
new TProfile(
"BremVsEta",
" Mean Brem energy vs Eta ", 50, -2.5, 2.5);
69 const float PI = 3.1415927;
73 const float R_ECAL = 136.5;
80 float ZEcal = R_ECAL * sinh(EtaParticle) + Zvertex;
83 Theta = atan(R_ECAL / ZEcal);
88 if (
std::abs(ETA) > etaBarrelEndcap) {
90 if (EtaParticle < 0.0)
92 float Zlen = Zend - Zvertex;
93 float RR = Zlen / sinh(EtaParticle);
94 Theta = atan(RR / Zend);
97 ETA = -
log(
tan(0.5 * Theta));
106 const float PI = 3.1415927;
132 LogInfo(
"MCElectronAnalyzer") <<
"MCElectronAnalyzer Analyzing event number: " << e.
id() <<
" Global Counter " 135 std::cout <<
"MCElectronAnalyzer Analyzing event number: " << e.
id() <<
" Global Counter " <<
nEvt_ <<
"\n";
138 std::cout <<
" MCElectronAnalyzer Looking for MC truth " 142 std::vector<SimTrack> theSimTracks;
143 std::vector<SimVertex> theSimVertices;
150 theSimTracks.insert(theSimTracks.end(), SimTk->begin(), SimTk->end());
151 theSimVertices.insert(theSimVertices.end(), SimVtx->begin(), SimVtx->end());
152 std::cout <<
" MCElectronAnalyzer This Event has " << theSimTracks.size() <<
" sim tracks " << std::endl;
153 std::cout <<
" MCElectronAnalyzer This Event has " << theSimVertices.size() <<
" sim vertices " << std::endl;
154 if (theSimTracks.empty())
155 std::cout <<
" Event number " << e.
id() <<
" has NO sim tracks " << std::endl;
158 std::cout <<
" MCElectronAnalyzer MCElectronctrons size " << MCElectronctrons.size() << std::endl;
160 for (std::vector<ElectronMCTruth>::const_iterator iEl = MCElectronctrons.begin(); iEl != MCElectronctrons.end();
162 h_MCEleE_->Fill((*iEl).fourMomentum().e());
163 h_MCEleEta_->Fill((*iEl).fourMomentum().pseudoRapidity());
168 for (iBrem = 0; iBrem < (*iEl).bremVertices().size(); ++iBrem) {
169 float rBrem = (*iEl).bremVertices()[iBrem].perp();
170 float etaBrem = (*iEl).bremVertices()[iBrem].eta();
172 totBrem += (*iEl).bremMomentum()[iBrem].e();
173 p_BremVsR_->Fill(rBrem, (*iEl).bremMomentum()[iBrem].e());
174 p_BremVsEta_->Fill(etaBrem, (*iEl).bremMomentum()[iBrem].e());
178 h_BremFrac_->Fill(totBrem / (*iEl).fourMomentum().e());
188 std::cout <<
"MCElectronAnalyzer::endJob Analyzed " <<
nEvt_ <<
" events "
MCElectronAnalyzer(const edm::ParameterSet &)
ElectronMCTruthFinder * theElectronMCTruthFinder_
Tan< T >::type tan(const T &t)
static float etaBarrelEndcap
Abs< T >::type abs(const T &t)
float phiNormalization(float &a)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
float etaTransformation(float a, float b)
std::vector< ElectronMCTruth > find(const std::vector< SimTrack > &simTracks, const std::vector< SimVertex > &simVertices)
void analyze(const edm::Event &, const edm::EventSetup &) override
~MCElectronAnalyzer() override
std::string fOutputFileName_