Skip to content

Commit

Permalink
Merge pull request #12 from edjtscott/topic_escott_forPR
Browse files Browse the repository at this point in the history
Update to recipe for CMSSW 90X
  • Loading branch information
clelange authored Jan 12, 2017
2 parents 7c7e0fd + ee819dd commit 9b139bc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
1 change: 1 addition & 0 deletions HGCalAnalysis/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<use name="RecoNtuples/HGCalAnalysis"/>
<use name="Geometry/Records"/>
<use name="SimDataFormats/CaloAnalysis"/>
<use name="CommonTools/UtilAlgos"/>
<library file="*.cc" name="RecoNtuplesHGCalAnalysisPlugins">
<flags EDM_PLUGIN="1"/>
</library>
Expand Down
42 changes: 22 additions & 20 deletions HGCalAnalysis/plugins/HGCalAnalysis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@



#include "RecoLocalCalo/HGCalRecHitDump/interface/HGCalDepthPreClusterer.h"
#include "RecoLocalCalo/HGCalRecHitDump/interface/HGCalMultiCluster.h"
#include "RecoLocalCalo/HGCalRecAlgos/interface/HGCalDepthPreClusterer.h"
#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"

#include "RecoNtuples/HGCalAnalysis/interface/AEvent.h"
Expand Down Expand Up @@ -73,6 +72,7 @@ class HGCalAnalysis : public edm::one::EDAnalyzer<edm::one::SharedResources> {
edm::EDGetTokenT<std::vector<SimCluster> > _simClusters;
edm::EDGetTokenT<std::vector<reco::PFCluster> > _pfClusters;
edm::EDGetTokenT<std::vector<CaloParticle> > _caloParticles;
edm::EDGetTokenT<std::vector<reco::HGCalMultiCluster> > _multiClusters;

TTree *tree;
AEvent *event;
Expand All @@ -95,7 +95,6 @@ class HGCalAnalysis : public edm::one::EDAnalyzer<edm::one::SharedResources> {

HGCalAnalysis::HGCalAnalysis(const edm::ParameterSet& iConfig) :
detector(iConfig.getParameter<std::string >("detector")),
pre(iConfig.getParameter<double>("depthClusteringCone")),
rawRecHits(iConfig.getParameter<bool>("rawRecHits"))
{
//now do what ever initialization is needed
Expand All @@ -115,12 +114,13 @@ HGCalAnalysis::HGCalAnalysis(const edm::ParameterSet& iConfig) :
_recHitsBH = consumes<HGCRecHitCollection>(edm::InputTag("HGCalRecHit","HGCHEBRecHits"));
algo = 3;
}
_clusters = consumes<reco::CaloClusterCollection>(edm::InputTag("imagingClusterHGCal"));
_clusters = consumes<reco::CaloClusterCollection>(edm::InputTag("hgcalLayerClusters"));
_vtx = consumes<std::vector<TrackingVertex> >(edm::InputTag("mix","MergedTrackTruth"));
_part = consumes<std::vector<TrackingParticle> >(edm::InputTag("mix","MergedTrackTruth"));
_simClusters = consumes<std::vector<SimCluster> >(edm::InputTag("mix","MergedCaloTruth"));
_pfClusters = consumes<std::vector<reco::PFCluster> >(edm::InputTag("particleFlowClusterHGCal"));
_caloParticles = consumes<std::vector<CaloParticle> >(edm::InputTag("mix","MergedCaloTruth"));
_multiClusters = consumes<std::vector<reco::HGCalMultiCluster> >(edm::InputTag("hgcalLayerClusters"));

edm::Service<TFileService> fs;
fs->make<TH1F>("total", "total", 100, 0, 5.);
Expand Down Expand Up @@ -185,7 +185,6 @@ HGCalAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
Handle<HGCRecHitCollection> recHitHandleBH;
Handle<reco::CaloClusterCollection> clusterHandle;

std::vector<HGCalMultiCluster> multiClusters;
iEvent.getByToken(_clusters,clusterHandle);
Handle<std::vector<TrackingVertex> > vtxHandle;
Handle<std::vector<TrackingParticle> > partHandle;
Expand All @@ -206,6 +205,10 @@ HGCalAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
const std::vector<reco::PFCluster>& pfClusters = *pfClusterHandle;
const std::vector<CaloParticle>& caloParticles = *caloParticleHandle;

Handle<std::vector<reco::HGCalMultiCluster> > multiClusterHandle;
iEvent.getByToken(_multiClusters, multiClusterHandle);
const std::vector<reco::HGCalMultiCluster>& multiClusters = *multiClusterHandle;

float vx = 0.;
float vy = 0.;
float vz = 0.;
Expand Down Expand Up @@ -366,16 +369,15 @@ HGCalAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)

const reco::CaloClusterCollection &clusters = *clusterHandle;
nclus = clusters.size();
multiClusters = pre.makePreClusters(clusters);
nmclus = multiClusters.size();
unsigned int cluster_index = 0;
for(unsigned int i = 0; i < multiClusters.size(); i++){
int cl2dSeed = 0;
for(HGCalMultiCluster::component_iterator it = multiClusters[i].begin();
for(reco::HGCalMultiCluster::component_iterator it = multiClusters[i].begin();
it!=multiClusters[i].end(); it++){
if(it->energy() > (it+cl2dSeed)->energy()) cl2dSeed = it - multiClusters[i].begin();
if((*it)->energy() > (*(it+cl2dSeed))->energy()) cl2dSeed = it - multiClusters[i].begin();

const std::vector< std::pair<DetId, float> > &hf = it->hitsAndFractions();
const std::vector< std::pair<DetId, float> > &hf = (*it)->hitsAndFractions();
int ncoreHit = 0;
int layer = 0;
int rhSeed = 0;
Expand Down Expand Up @@ -413,21 +415,21 @@ HGCalAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
isHalfCell, flags, cluster_index));

}
double pt = it->energy() / cosh(it->eta());
acdc->push_back(ACluster2d(it->x(),it->y(),it->z(),
it->eta(),it->phi(),pt,it->energy(),
double pt = (*it)->energy() / cosh((*it)->eta());
acdc->push_back(ACluster2d((*it)->x(),(*it)->y(),(*it)->z(),
(*it)->eta(),(*it)->phi(),pt,(*it)->energy(),
layer, ncoreHit,hf.size(),i, rhSeed));
cluster_index++;
}

double pt = multiClusters[i].total_uncalibrated_energy() / cosh(multiClusters[i].simple_eta(vz));
amcc->push_back(AMultiCluster(multiClusters[i].simple_eta(vz),
multiClusters[i].simple_phi(),
pt,
multiClusters[i].simple_z(vz),
multiClusters[i].simple_slope_x(vz),
multiClusters[i].simple_slope_y(vz),
multiClusters[i].total_uncalibrated_energy(),
double pt = multiClusters[i].energy() / cosh(multiClusters[i].eta());
amcc->push_back(AMultiCluster(multiClusters[i].eta(),
multiClusters[i].phi(),
pt,
multiClusters[i].z(),
multiClusters[i].x(),
multiClusters[i].y(),
multiClusters[i].energy(),
multiClusters[i].size(),
cl2dSeed));
}
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ Home of the Ntuplizer for the HGCAL reconstruction software studies

Ntuple content definitions can be found at [Definitions.md](Definitions.md).

to be added on top of CMS-HGCAL:hgcal_clustering_development_810, based on CMSSW_8_1_0_pre15:
This version is based on CMSSW_9_0_X. Further updates to the recipe will occur once github.com/cms-sw/cmssw/pull/16997 is merged into CMSSW.

```
cmsrel CMSSW_8_1_0_pre15
cd CMSSW_8_1_0_pre15/src
cmsrel CMSSW_9_0_0_pre2
cd CMSSW_9_0_pre2/src
cmsenv
git cms-merge-topic CMS-HGCAL:hgcal_clustering_development_810
git checkout CMS-HGCAL/hgcal_clustering_development_810
git cms-merge-topic edjtscott:hgcal_multiclustering_realspacecone
git checkout -b topic_${USER}
git clone [email protected]:CMS-HGCAL/reco-ntuples.git RecoNtuples
scram b -j9
Expand Down

0 comments on commit 9b139bc

Please sign in to comment.