CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
L2TauAnalyzer Class Reference

#include <L2TauAnalyzer.h>

Inheritance diagram for L2TauAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L2TauAnalyzer (const edm::ParameterSet &)
 
 ~L2TauAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 
MatchElementL2 match (const reco::Jet &, const LVColl &)
 
MatchElementL2 match (const reco::Jet &, const l1extra::L1JetParticleCollection &)
 

Private Attributes

float cl_drRMS
 
float cl_etaRMS
 
int cl_Nclusters
 
float cl_phiRMS
 
float ecalIsol_Et
 
bool IsSignal_
 
float jetEMF
 
float JetEt
 
float JetEta
 
float L1et
 
float L1eta
 
edm::EDGetTokenT
< l1extra::L1JetParticleCollection
l1Jets_
 
edm::EDGetTokenT
< l1extra::L1JetParticleCollection
l1Taus_
 
TFile * l2file
 
edm::EDGetTokenT
< reco::L2TauInfoAssociation
l2TauInfoAssoc_
 
TTree * l2tree
 
double matchDR_
 
edm::EDGetTokenT< LVCollmcColl_
 
float MCet
 
float MCeta
 
std::string rootFile_
 
float seedTowerEt
 
float towerIsol_Et
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 39 of file L2TauAnalyzer.h.

Constructor & Destructor Documentation

L2TauAnalyzer::L2TauAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 7 of file L2TauAnalyzer.cc.

References cl_drRMS, cl_etaRMS, cl_Nclusters, cl_phiRMS, ecalIsol_Et, jetEMF, JetEt, JetEta, L1et, L1eta, l2file, l2tree, MCet, MCeta, rootFile_, seedTowerEt, and towerIsol_Et.

7  :
8  l2TauInfoAssoc_(consumes<reco::L2TauInfoAssociation>(iConfig.getParameter<edm::InputTag>("L2InfoAssociationInput"))),
9  l1Taus_(consumes<l1extra::L1JetParticleCollection>(iConfig.getParameter<edm::InputTag>("L1TauCollection"))),
10  l1Jets_(consumes<l1extra::L1JetParticleCollection>(iConfig.getParameter<edm::InputTag>("L1JetCollection"))),
11  rootFile_(iConfig.getParameter<std::string>("outputFileName")),
12  IsSignal_(iConfig.getParameter<bool>("IsSignal")),
13  mcColl_(consumes<LVColl>(iConfig.getParameter<edm::InputTag>("MatchedCollection")))
14 {
15  //File Setup
16  l2file = new TFile(rootFile_.c_str(),"recreate");
17  //Tree Setup
18  l2tree = new TTree("l2tree","Level 2 Tau Tree");
19 
20 
21  //Initialize the vars
22  ecalIsol_Et=0.;
23  towerIsol_Et=0.;
24  cl_etaRMS=0.;
25  cl_phiRMS=0.;
26  cl_drRMS=0.;
27  MCeta=0.;
28  MCet=0.;
29  cl_Nclusters=0;
30  seedTowerEt = 0.;
31  JetEt=0.;
32  JetEta=0.;
33  L1et=0.;
34  L1eta=0.;
35  jetEMF = 0.;
36 
37  //Setup Branches
38  l2tree->Branch("ecalIsolEt",&ecalIsol_Et,"ecalIsolEt/F");
39  l2tree->Branch("jetEMF",&jetEMF,"jetEMF/F");
40  l2tree->Branch("towerIsolEt",&towerIsol_Et,"towerIsolEt/F");
41  l2tree->Branch("clEtaRMS",&cl_etaRMS,"clEtaRMS/F");
42  l2tree->Branch("clPhiRMS",&cl_phiRMS,"clPhiRMS/F");
43  l2tree->Branch("clDrRMS",&cl_drRMS,"clDrRMS/F");
44  l2tree->Branch("mcEta",&MCeta,"mcEta/F");
45  l2tree->Branch("mcEt",&MCet,"mcEt/F");
46  l2tree->Branch("clNclusters",&cl_Nclusters,"clNclusters/I");
47  l2tree->Branch("seedTowerEt",&seedTowerEt,"seedTowerEt/F");
48  l2tree->Branch("jetEt",&JetEt,"jetEt/F");
49  l2tree->Branch("jetEta",&JetEta,"jetEta/F");
50  l2tree->Branch("L1Et",&L1et,"L1Et/F");
51  l2tree->Branch("L1Eta",&L1eta,"L1Eta/F");
52 
53 }
T getParameter(std::string const &) const
TFile * l2file
Definition: L2TauAnalyzer.h:61
edm::EDGetTokenT< LVColl > mcColl_
Definition: L2TauAnalyzer.h:54
edm::EDGetTokenT< reco::L2TauInfoAssociation > l2TauInfoAssoc_
Definition: L2TauAnalyzer.h:49
edm::EDGetTokenT< l1extra::L1JetParticleCollection > l1Taus_
Definition: L2TauAnalyzer.h:50
std::string rootFile_
Definition: L2TauAnalyzer.h:52
float towerIsol_Et
Definition: L2TauAnalyzer.h:60
edm::EDGetTokenT< l1extra::L1JetParticleCollection > l1Jets_
Definition: L2TauAnalyzer.h:51
TTree * l2tree
Definition: L2TauAnalyzer.h:62
L2TauAnalyzer::~L2TauAnalyzer ( )

Definition at line 56 of file L2TauAnalyzer.cc.

57 {
58 }

Member Function Documentation

void L2TauAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 63 of file L2TauAnalyzer.cc.

References cl_drRMS, cl_etaRMS, cl_Nclusters, cl_phiRMS, MatchElementL2::deltar, reco::L2TauIsolationInfo::ecalClusterShape(), ecalIsol_Et, reco::L2TauIsolationInfo::ecalIsolEt(), reco::CaloJet::emEnergyFraction(), reco::LeafCandidate::et(), reco::LeafCandidate::eta(), edm::Event::getByToken(), reco::L2TauIsolationInfo::hcalIsolEt(), IsSignal_, metsig::jet, jetEMF, JetEt, JetEta, L1et, L1eta, l1Jets_, l1Taus_, l2TauInfoAssoc_, l2tree, match(), MatchElementL2::matched, mcColl_, MatchElementL2::mcEt, MCet, MatchElementL2::mcEta, MCeta, reco::L2TauIsolationInfo::nEcalHits(), AlCaHLTBitMon_ParallelJobs::p, dt_dqm_sourceclient_common_cff::reco, reco::L2TauIsolationInfo::seedHcalHitEt(), seedTowerEt, and towerIsol_Et.

64 {
65  using namespace edm;
66  using namespace reco;
67 
68  Handle<L2TauInfoAssociation> l2TauInfoAssoc; //Handle to the input (L2 Tau Info Association)
69  Handle<LVColl> McInfo; //Handle To The Truth!!!!
70  Handle<l1extra::L1JetParticleCollection> L1Taus; //Handle To The L1 Taus
71  Handle<l1extra::L1JetParticleCollection> L1Jets; //Handle To The L1 jets
72 
73  if(iEvent.getByToken(l2TauInfoAssoc_,l2TauInfoAssoc))//get the handle
74  {
75  if(l2TauInfoAssoc->size()>0)
76  for(L2TauInfoAssociation::const_iterator p = l2TauInfoAssoc->begin();p!=l2TauInfoAssoc->end();++p)
77  {
78  const L2TauIsolationInfo l2info = p->val;
79  const CaloJet& jet =*(p->key);
80 
81  MatchElementL2 mcMatch;
82  mcMatch.matched=false;
83  mcMatch.mcEt=0;
84  mcMatch.mcEta=0;
85  mcMatch.deltar=0;
86 
87  if(IsSignal_) //Get Collection and match it
88  {
89  if(iEvent.getByToken(mcColl_,McInfo))
90  mcMatch=match(jet,*McInfo);
91  }
92 
93  if((mcMatch.matched&&IsSignal_)||(!IsSignal_))
94  {
95  //Fill variables
96  jetEMF = jet.emEnergyFraction();
97  ecalIsol_Et=l2info.ecalIsolEt();
98  towerIsol_Et=l2info.hcalIsolEt();
99  cl_Nclusters=l2info.nEcalHits();
100  cl_etaRMS=l2info.ecalClusterShape()[0];
101  cl_phiRMS=l2info.ecalClusterShape()[1];
102  cl_drRMS=l2info.ecalClusterShape()[2];
103  seedTowerEt = l2info.seedHcalHitEt();
104  MCeta =mcMatch.mcEta;
105  MCet=mcMatch.mcEt;
106  JetEt = jet.et();
107  JetEta = jet.eta();
108 
109  //Match with L1 and fill
110  L1et=0;
111  L1eta=0;
112  if(iEvent.getByToken(l1Taus_,L1Taus))
113  {
114  MatchElementL2 l1Match;
115  l1Match.matched=false;
116  l1Match.mcEt=0;
117  l1Match.mcEta=0;
118  l1Match.deltar=0;
119  l1Match=match(jet,*L1Taus);
120  if(l1Match.matched)
121  {
122  L1et=l1Match.mcEt;
123  L1eta=l1Match.mcEta;
124  }
125  //If not matched look at the jet collection
126  else
127  {
128  if(iEvent.getByToken(l1Jets_,L1Jets))
129  {
130  l1Match=match(jet,*L1Taus);
131  if(l1Match.matched)
132  {
133  L1et=l1Match.mcEt;
134  L1eta=l1Match.mcEta;
135  }
136 
137  }
138  }
139 
140  }
141  //Fill Tree
142  l2tree->Fill();
143  }
144 
145  }
146  }
147 }
Jets made from CaloTowers.
Definition: CaloJet.h:29
virtual double et() const
transverse energy
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< LVColl > mcColl_
Definition: L2TauAnalyzer.h:54
edm::EDGetTokenT< reco::L2TauInfoAssociation > l2TauInfoAssoc_
Definition: L2TauAnalyzer.h:49
virtual float eta() const
momentum pseudorapidity
edm::EDGetTokenT< l1extra::L1JetParticleCollection > l1Taus_
Definition: L2TauAnalyzer.h:50
MatchElementL2 match(const reco::Jet &, const LVColl &)
float towerIsol_Et
Definition: L2TauAnalyzer.h:60
edm::EDGetTokenT< l1extra::L1JetParticleCollection > l1Jets_
Definition: L2TauAnalyzer.h:51
std::vector< double > ecalClusterShape() const
TTree * l2tree
Definition: L2TauAnalyzer.h:62
float emEnergyFraction() const
Definition: CaloJet.h:102
void L2TauAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 152 of file L2TauAnalyzer.cc.

153 {
154 
155 }
void L2TauAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 159 of file L2TauAnalyzer.cc.

References l2file.

159  {
160  l2file->Write();
161 
162 }
TFile * l2file
Definition: L2TauAnalyzer.h:61
MatchElementL2 L2TauAnalyzer::match ( const reco::Jet jet,
const LVColl McInfo 
)
private

Definition at line 165 of file L2TauAnalyzer.cc.

References delta, MatchElementL2::deltar, MatchElementL2::matched, MatchElementL2::mcEt, MatchElementL2::mcEta, and reco::LeafCandidate::p4().

Referenced by analyze(), and match().

166 {
167 
168  //Loop On the Collection and see if your tau jet is matched to one there
169  //Also find the nearest Matched MC Particle to your Jet (to be complete)
170 
171  bool matched=false;
172  double delta_min=100.;
173  double mceta=0;
174  double mcet=0;
175 
176  double matchingDR=0.3;
177 
178 
179 
180 
181  if(McInfo.size()>0)
182  for(std::vector<LV>::const_iterator it = McInfo.begin();it!=McInfo.end();++it)
183  {
184  double delta = ROOT::Math::VectorUtil::DeltaR(jet.p4().Vect(),*it);
185  if(delta<matchingDR)
186  {
187  matched=true;
188  if(delta<delta_min)
189  {
190  delta_min=delta;
191  mceta=it->eta();
192  mcet=it->Et();
193  }
194  }
195  }
196 
197  //Create Struct and send it out!
199  match.matched=matched;
200  match.deltar=delta_min;
201  match.mcEta = mceta;
202  match.mcEt = mcet;
203 
204 
205  return match;
206 }
dbl * delta
Definition: mlp_gen.cc:36
MatchElementL2 match(const reco::Jet &, const LVColl &)
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
MatchElementL2 L2TauAnalyzer::match ( const reco::Jet jet,
const l1extra::L1JetParticleCollection McInfo 
)
private

Definition at line 209 of file L2TauAnalyzer.cc.

References delta, MatchElementL2::deltar, match(), MatchElementL2::matched, MatchElementL2::mcEt, MatchElementL2::mcEta, and reco::LeafCandidate::p4().

210 {
211 
212  //Loop On the Collection and see if your tau jet is matched to one there
213  //Also find the nearest Matched MC Particle to your Jet (to be complete)
214 
215  bool matched=false;
216  double delta_min=100.;
217  double mceta=0;
218  double mcet=0;
219 
220  double matchingDR=0.5;
221 
222 
223 
224 
225  if(McInfo.size()>0)
226  for(l1extra::L1JetParticleCollection::const_iterator it = McInfo.begin();it!=McInfo.end();++it)
227  {
228  double delta = ROOT::Math::VectorUtil::DeltaR(jet.p4().Vect(),it->p4().Vect());
229  if(delta<matchingDR)
230  {
231  matched=true;
232  if(delta<delta_min)
233  {
234  delta_min=delta;
235  mceta=it->eta();
236  mcet=it->et();
237  }
238  }
239  }
240 
241  //Create Struct and send it out!
243  match.matched=matched;
244  match.deltar=delta_min;
245  match.mcEta = mceta;
246  match.mcEt = mcet;
247 
248 
249  return match;
250 }
dbl * delta
Definition: mlp_gen.cc:36
MatchElementL2 match(const reco::Jet &, const LVColl &)
virtual const LorentzVector & p4() const
four-momentum Lorentz vector

Member Data Documentation

float L2TauAnalyzer::cl_drRMS
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

float L2TauAnalyzer::cl_etaRMS
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

int L2TauAnalyzer::cl_Nclusters
private

Definition at line 59 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

float L2TauAnalyzer::cl_phiRMS
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

float L2TauAnalyzer::ecalIsol_Et
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

bool L2TauAnalyzer::IsSignal_
private

Definition at line 53 of file L2TauAnalyzer.h.

Referenced by analyze().

float L2TauAnalyzer::jetEMF
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

float L2TauAnalyzer::JetEt
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

float L2TauAnalyzer::JetEta
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

float L2TauAnalyzer::L1et
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

float L2TauAnalyzer::L1eta
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

edm::EDGetTokenT<l1extra::L1JetParticleCollection> L2TauAnalyzer::l1Jets_
private

Definition at line 51 of file L2TauAnalyzer.h.

Referenced by analyze().

edm::EDGetTokenT<l1extra::L1JetParticleCollection> L2TauAnalyzer::l1Taus_
private

Definition at line 50 of file L2TauAnalyzer.h.

Referenced by analyze().

TFile* L2TauAnalyzer::l2file
private

Definition at line 61 of file L2TauAnalyzer.h.

Referenced by endJob(), and L2TauAnalyzer().

edm::EDGetTokenT<reco::L2TauInfoAssociation> L2TauAnalyzer::l2TauInfoAssoc_
private

Definition at line 49 of file L2TauAnalyzer.h.

Referenced by analyze().

TTree* L2TauAnalyzer::l2tree
private

Definition at line 62 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

double L2TauAnalyzer::matchDR_
private

Definition at line 57 of file L2TauAnalyzer.h.

edm::EDGetTokenT<LVColl> L2TauAnalyzer::mcColl_
private

Definition at line 54 of file L2TauAnalyzer.h.

Referenced by analyze().

float L2TauAnalyzer::MCet
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

float L2TauAnalyzer::MCeta
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

std::string L2TauAnalyzer::rootFile_
private

Definition at line 52 of file L2TauAnalyzer.h.

Referenced by L2TauAnalyzer().

float L2TauAnalyzer::seedTowerEt
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().

float L2TauAnalyzer::towerIsol_Et
private

Definition at line 60 of file L2TauAnalyzer.h.

Referenced by analyze(), and L2TauAnalyzer().