42 LogInfo(
"ContainmentCorrectionAnalyzer") <<
"Analyzing event " << evt.
id() <<
"\n";
45 std::vector<SimTrack> theSimTracks;
51 if (SimTk.
isValid() ) theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
52 else {
LogError(
"ContainmentCorrectionAnalyzer") <<
"Error! can't get collection with label " << l.module; }
54 std::vector<SimVertex> theSimVertexes;
60 if (SimVtx.
isValid()) theSimVertexes.insert(theSimVertexes.end(),SimVtx->begin(),SimVtx->end());
61 else {
LogError(
"ContainmentCorrectionAnalyzer") <<
"Error! can't get collection with label " << l.module; }
68 if (pHybridBarrelSuperClusters.
isValid()) { BarrelSuperClusters = pHybridBarrelSuperClusters.
product(); }
69 else {
LogError(
"ContainmentCorrectionAnalyzer") <<
"Error! can't get collection with label " << l.module; }
76 if (pMulti5x5EndcapSuperClusters.
isValid()) EndcapSuperClusters = pMulti5x5EndcapSuperClusters.
product();
77 else {
LogError(
"ContainmentCorrectionAnalyzer") <<
"Error! can't get collection with label " << l.module; }
85 else {
LogError(
"ContainmentCorrectionAnalyzer") <<
"Error! can't get collection with label " << l.module; }
93 else {
LogError(
"ContainmentCorrectionAnalyzer") <<
"Error! can't get collection with label " << l.module; }
105 int mc_size = photons.size();
107 mcEta.resize(mc_size);
108 mcPhi.resize(mc_size);
109 mcPt.resize(mc_size);
111 x_vtx.resize(mc_size);
112 y_vtx.resize(mc_size);
113 z_vtx.resize(mc_size);
127 for (
unsigned int ipho=0;ipho<photons.size();ipho++) {
130 double phiTrue = photons[ipho].fourMomentum().phi();
131 double vtxPerp =
sqrt(vtx.x()*vtx.x() + vtx.y()*vtx.y());
132 double etaTrue =
ecalEta(photons[ipho].fourMomentum().
eta(), vtx.z(), vtxPerp);
133 double etTrue = photons[ipho].fourMomentum().e()/cosh(etaTrue);
145 if(std::fabs(etaTrue) < 1.479) {
146 h_EB_eTrue ->Fill(photons[ipho].fourMomentum().
e());
149 if(std::fabs(etaTrue) >= 1.6) {
150 h_EE_eTrue ->Fill(photons[ipho].fourMomentum().
e());
155 if(std::fabs(etaTrue) < 1.479) {
161 double closestParticleDistance = 999;
162 for(reco::SuperClusterCollection::const_iterator aClus = BarrelSuperClusters->begin();
163 aClus != BarrelSuperClusters->end(); aClus++) {
164 etaCurrent = aClus->
position().eta();
165 phiCurrent = aClus->position().phi();
168 if(deltaR < closestParticleDistance) {
171 closestParticleDistance =
deltaR;
176 if(closestParticleDistance < 0.3) {
188 e9[
nRECOphotons-1] = EcalClusterTools::e3x3(*theSeed, ebRecHits, topology );
189 e25[
nRECOphotons-1] = EcalClusterTools::e5x5(*theSeed, ebRecHits, topology );
194 if(std::fabs(etaTrue) >= 1.6) {
200 double closestParticleDistance = 999;
201 for(reco::SuperClusterCollection::const_iterator aClus = EndcapSuperClusters->begin();
202 aClus != EndcapSuperClusters->end(); aClus++) {
203 etaCurrent = aClus->
position().eta();
204 phiCurrent = aClus->position().phi();
207 if(deltaR < closestParticleDistance) {
210 closestParticleDistance =
deltaR;
215 if(closestParticleDistance < 0.3) {
227 e1[
nRECOphotons-1] = EcalClusterTools::eMax(*theSeed, eeRecHits) + psEnergy;
228 e9[
nRECOphotons-1] = EcalClusterTools::e3x3(*theSeed, eeRecHits, topology ) + psEnergy;
229 e25[
nRECOphotons-1] = EcalClusterTools::e5x5(*theSeed, eeRecHits, topology ) + psEnergy;
243 if (ietaAbs > 5 && ietaAbs < 21 && ((iphi % 20) > 5) && ((iphi % 20) < 16) ) {
const math::XYZPoint & position() const
cluster centroid position
std::vector< float > mcEnergy
std::vector< EcalSimPhotonMCTruth > findMcTruth(std::vector< SimTrack > &theSimTracks, std::vector< SimVertex > &theSimVertices)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::vector< float > x_vtx
CaloTopology const * topology(0)
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< float > y_vtx
std::vector< int > isConverted
std::vector< float > z_vtx
edm::EDGetTokenT< edm::SimTrackContainer > SimTrackCollection_
std::vector< float > mcPt
TH1F * h_EE_e9EtrueReference
std::vector< float > superClusterPhi
TH1F * h_EB_eRecoEtrueReference
std::vector< float > superClusterEnergy
std::vector< float > superClusterEta
edm::EDGetTokenT< reco::SuperClusterCollection > BarrelSuperClusterCollection_
float ecalEta(float EtaParticle, float Zvertex, float plane_Radius)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
edm::EDGetTokenT< edm::SimVertexContainer > SimVertexCollection_
TH1F * h_EE_e25EtrueReference
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::vector< float > mcEta
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollection_
T const * product() const
T const * product() const
std::vector< float > superClusterEt
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
TH1F * h_EE_eRecoEtrueReference
TH1F * h_EB_e25EtrueReference
std::vector< float > mcPhi
std::vector< int > seedXtal
edm::EDGetTokenT< reco::SuperClusterCollection > EndcapSuperClusterCollection_
TH1F * h_EB_e9EtrueReference
const CaloClusterPtr & seed() const
seed BasicCluster
double preshowerEnergy() const
energy deposited in preshower
Power< A, B >::type pow(const A &a, const B &b)