80 : fOutputFileName_(
pset.getUntrackedParameter<
string>(
"HistOutFile",
std::
string(
"TestConversions.root"))),
81 fOutputFile_(nullptr) {}
93 h_MCEleE_ =
new TH1F(
"MCEleE",
"MC ele energy", 100, 0., 200.);
94 h_MCElePhi_ =
new TH1F(
"MCElePhi",
"MC ele phi", 40, -3.14, 3.14);
95 h_MCEleEta_ =
new TH1F(
"MCEleEta",
"MC ele eta", 40, -3., 3.);
96 h_BremFrac_ =
new TH1F(
"bremFrac",
"brem frac ", 100, 0., 1.);
97 h_BremEnergy_ =
new TH1F(
"BremE",
"Brem energy", 100, 0., 200.);
99 p_BremVsR_ =
new TProfile(
"BremVsR",
" Mean Brem energy vs R ", 48, 0., 120.);
100 p_BremVsEta_ =
new TProfile(
"BremVsEta",
" Mean Brem energy vs Eta ", 50, -2.5, 2.5);
107 const float PI = 3.1415927;
111 const float R_ECAL = 136.5;
118 float ZEcal =
R_ECAL * sinh(EtaParticle) + Zvertex;
128 if (EtaParticle < 0.0)
130 float Zlen = Zend - Zvertex;
131 float RR = Zlen / sinh(EtaParticle);
132 Theta = atan(RR / Zend);
144 const float PI = 3.1415927;
170 LogInfo(
"MCElectronAnalyzer") <<
"MCElectronAnalyzer Analyzing event number: " <<
e.id() <<
" Global Counter " 173 std::cout <<
"MCElectronAnalyzer Analyzing event number: " <<
e.id() <<
" Global Counter " <<
nEvt_ <<
"\n";
176 std::cout <<
" MCElectronAnalyzer Looking for MC truth " 180 std::vector<SimTrack> theSimTracks;
181 std::vector<SimVertex> theSimVertices;
185 e.getByLabel(
"g4SimHits", SimTk);
186 e.getByLabel(
"g4SimHits", SimVtx);
188 theSimTracks.insert(theSimTracks.end(), SimTk->begin(), SimTk->end());
189 theSimVertices.insert(theSimVertices.end(), SimVtx->begin(), SimVtx->end());
190 std::cout <<
" MCElectronAnalyzer This Event has " << theSimTracks.size() <<
" sim tracks " << std::endl;
191 std::cout <<
" MCElectronAnalyzer This Event has " << theSimVertices.size() <<
" sim vertices " << std::endl;
192 if (theSimTracks.empty())
193 std::cout <<
" Event number " <<
e.id() <<
" has NO sim tracks " << std::endl;
196 std::cout <<
" MCElectronAnalyzer MCElectronctrons size " << MCElectronctrons.size() << std::endl;
198 for (std::vector<ElectronMCTruth>::const_iterator iEl = MCElectronctrons.begin(); iEl != MCElectronctrons.end();
200 h_MCEleE_->Fill((*iEl).fourMomentum().e());
201 h_MCEleEta_->Fill((*iEl).fourMomentum().pseudoRapidity());
206 for (iBrem = 0; iBrem < (*iEl).bremVertices().size(); ++iBrem) {
207 float rBrem = (*iEl).bremVertices()[iBrem].perp();
208 float etaBrem = (*iEl).bremVertices()[iBrem].eta();
210 totBrem += (*iEl).bremMomentum()[iBrem].e();
211 p_BremVsR_->Fill(rBrem, (*iEl).bremMomentum()[iBrem].e());
212 p_BremVsEta_->Fill(etaBrem, (*iEl).bremMomentum()[iBrem].e());
216 h_BremFrac_->Fill(totBrem / (*iEl).fourMomentum().e());
226 std::cout <<
"MCElectronAnalyzer::endJob Analyzed " <<
nEvt_ <<
" events "
double mcPhi_
global variable for the MC photon
#define DEFINE_FWK_MODULE(type)
MCElectronAnalyzer(const edm::ParameterSet &)
ElectronMCTruthFinder * theElectronMCTruthFinder_
static constexpr float R_ECAL
const TrackerGeometry * trackerGeom
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
static constexpr float etaBarrelEndcap
float phiNormalization(float &a)
Log< level::Info, false > LogInfo
float etaTransformation(float a, float b)
std::vector< ElectronMCTruth > find(const std::vector< SimTrack > &simTracks, const std::vector< SimVertex > &simVertices)
static constexpr float ZEcal
void analyze(const edm::Event &, const edm::EventSetup &) override
~MCElectronAnalyzer() override
std::string fOutputFileName_
static constexpr float Z_Endcap