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 Attributes
calcTopMass Class Reference
Inheritance diagram for calcTopMass:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 calcTopMass (const edm::ParameterSet &)
 
 ~calcTopMass ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

float bMass
 
float cMass
 
TH1F * hMassCorFl0
 
TH1F * hMassCorFlM
 
TH1F * hMassCorMix
 
TH1F * hMassNoCorr
 
std::string m_bT_CorrectorName
 
std::string m_cT_CorrectorName
 
std::string m_qT_CorrectorName
 
std::string m_tT_CorrectorName
 
float qMass
 
edm::InputTag sourceByRefer_
 
edm::InputTag sourcePartons_
 
edm::Handle
< reco::JetMatchedPartonsCollection
theJetPartonMatch
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 56 of file CalcTopMassExample.cc.

Constructor & Destructor Documentation

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

Definition at line 86 of file CalcTopMassExample.cc.

References edm::ParameterSet::getParameter(), and TFileDirectory::make().

87 {
88 
89  sourceByRefer_ = iConfig.getParameter<InputTag> ("srcByReference");
90  m_qT_CorrectorName = iConfig.getParameter <std::string> ("qTopCorrector");
91  m_cT_CorrectorName = iConfig.getParameter <std::string> ("cTopCorrector");
92  m_bT_CorrectorName = iConfig.getParameter <std::string> ("bTopCorrector");
93  m_tT_CorrectorName = iConfig.getParameter <std::string> ("tTopCorrector");
94 
95  bMass = 4.5;
96  cMass = 1.5;
97  qMass = 0.3;
98 
100  hMassNoCorr = fs->make<TH1F>("hMassNoCorr","",100,100,300);
101  hMassCorFl0 = fs->make<TH1F>("hMassCorFl0","",100,100,300);
102  hMassCorFlM = fs->make<TH1F>("hMassCorFlM","",100,100,300);
103  hMassCorMix = fs->make<TH1F>("hMassCorMix","",100,100,300);
104 
105 }
T getParameter(std::string const &) const
std::string m_cT_CorrectorName
edm::InputTag sourceByRefer_
std::string m_qT_CorrectorName
std::string m_tT_CorrectorName
T * make() const
make new ROOT object
std::string m_bT_CorrectorName
calcTopMass::~calcTopMass ( )
inline

Definition at line 59 of file CalcTopMassExample.cc.

59 {};

Member Function Documentation

void calcTopMass::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 107 of file CalcTopMassExample.cc.

References dtNoiseDBValidation_cfg::cerr, JetCorrector::correction(), gather_cfg::cout, cppFunctionSkipper::exception, edm::Ref< C, T, F >::get(), edm::Event::getByLabel(), JetCorrector::getJetCorrector(), edm::EventBase::id(), edm::Ref< C, T, F >::isNonnull(), j, and reco::MatchedPartons::physicsDefinitionParton().

108 {
109  cout << "[calcTopMass] analysing event " << iEvent.id() << endl;
110  try {
112  } catch(std::exception& ce) {
113  cerr << "[calcTopMass] caught std::exception " << ce.what() << endl;
114  return;
115  }
116 
117  // get all correctors from top events
118  const JetCorrector* qTopCorrector = JetCorrector::getJetCorrector (m_qT_CorrectorName, iSetup);
119  const JetCorrector* cTopCorrector = JetCorrector::getJetCorrector (m_cT_CorrectorName, iSetup);
120  const JetCorrector* bTopCorrector = JetCorrector::getJetCorrector (m_bT_CorrectorName, iSetup);
121  const JetCorrector* tTopCorrector = JetCorrector::getJetCorrector (m_tT_CorrectorName, iSetup);
122 
123  TLorentzVector jetsNoCorr[6];
124  TLorentzVector jetsCorFl0[6];
125  TLorentzVector jetsCorFlM[6];
126  TLorentzVector jetsCorMix[6];
127 
128  bool isQuarkFound[6] = {false};
129 
130  for ( JetMatchedPartonsCollection::const_iterator j = theJetPartonMatch->begin();
131  j != theJetPartonMatch->end();
132  j ++ ) {
133 
134  const math::XYZTLorentzVector theJet = (*j).first.get()->p4();
135  const MatchedPartons aMatch = (*j).second;
136  const GenParticleRef thePhyDef = aMatch.physicsDefinitionParton() ;
137 
138  if(thePhyDef.isNonnull()) {
139 
140  int particPDG = thePhyDef.get()->pdgId();
141 
142  if( particPDG == 5 ) { //b from t
143  double bTcorr = bTopCorrector->correction (theJet);
144  double tTcorr = tTopCorrector->correction (theJet);
145  jetsNoCorr[0].SetPtEtaPhiM( theJet.pt() , theJet.eta() , theJet.phi() , theJet.mass() );
146  jetsCorFl0[0].SetPtEtaPhiM( theJet.pt()*bTcorr , theJet.eta() , theJet.phi() , 0 );
147  jetsCorFlM[0].SetPtEtaPhiM( theJet.pt()*bTcorr , theJet.eta() , theJet.phi() , bMass );
148  jetsCorMix[0].SetPtEtaPhiM( theJet.pt()*tTcorr , theJet.eta() , theJet.phi() , 0 );
149  isQuarkFound[0]=true;
150  } else if ( particPDG == -5 ) { //bbar from tbar
151  double bTcorr = bTopCorrector->correction (theJet);
152  double tTcorr = tTopCorrector->correction (theJet);
153  jetsNoCorr[3].SetPtEtaPhiM( theJet.pt() , theJet.eta() , theJet.phi() , theJet.mass() );
154  jetsCorFl0[3].SetPtEtaPhiM( theJet.pt()*bTcorr , theJet.eta() , theJet.phi() , 0 );
155  jetsCorFlM[3].SetPtEtaPhiM( theJet.pt()*bTcorr , theJet.eta() , theJet.phi() , bMass );
156  jetsCorMix[3].SetPtEtaPhiM( theJet.pt()*tTcorr , theJet.eta() , theJet.phi() , 0 );
157  isQuarkFound[3]=true;
158  } else if ( particPDG == 2 ) { //W+ from t
159  double qTcorr = qTopCorrector->correction (theJet);
160  double tTcorr = tTopCorrector->correction (theJet);
161  jetsNoCorr[1].SetPtEtaPhiM( theJet.pt() , theJet.eta() , theJet.phi() , theJet.mass() );
162  jetsCorFl0[1].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , 0 );
163  jetsCorFlM[1].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , qMass );
164  jetsCorMix[1].SetPtEtaPhiM( theJet.pt()*tTcorr , theJet.eta() , theJet.phi() , 0 );
165  isQuarkFound[1]=true;
166  } else if ( particPDG == 4 ) { //W+ from t
167  double cTcorr = cTopCorrector->correction (theJet);
168  double tTcorr = tTopCorrector->correction (theJet);
169  jetsNoCorr[1].SetPtEtaPhiM( theJet.pt() , theJet.eta() , theJet.phi() , theJet.mass() );
170  jetsCorFl0[1].SetPtEtaPhiM( theJet.pt()*cTcorr , theJet.eta() , theJet.phi() , 0 );
171  jetsCorFlM[1].SetPtEtaPhiM( theJet.pt()*cTcorr , theJet.eta() , theJet.phi() , cMass );
172  jetsCorMix[1].SetPtEtaPhiM( theJet.pt()*tTcorr , theJet.eta() , theJet.phi() , 0 );
173  isQuarkFound[1]=true;
174  } else if ( particPDG == -1 ) { //W+ from t
175  double qTcorr = qTopCorrector->correction (theJet);
176  double tTcorr = tTopCorrector->correction (theJet);
177  jetsNoCorr[2].SetPtEtaPhiM( theJet.pt() , theJet.eta() , theJet.phi() , theJet.mass() );
178  jetsCorFl0[2].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , 0 );
179  jetsCorFlM[2].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , qMass );
180  jetsCorMix[2].SetPtEtaPhiM( theJet.pt()*tTcorr , theJet.eta() , theJet.phi() , 0 );
181  isQuarkFound[2]=true;
182  } else if ( particPDG == -3 ) { //W+ from t
183  double qTcorr = qTopCorrector->correction (theJet);
184  double tTcorr = tTopCorrector->correction (theJet);
185  jetsNoCorr[2].SetPtEtaPhiM( theJet.pt() , theJet.eta() , theJet.phi() , theJet.mass() );
186  jetsCorFl0[2].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , 0 );
187  jetsCorFlM[2].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , qMass );
188  jetsCorMix[2].SetPtEtaPhiM( theJet.pt()*tTcorr , theJet.eta() , theJet.phi() , 0 );
189  isQuarkFound[2]=true;
190  } else if ( particPDG == -2 ) { //W- from tbar
191  double qTcorr = qTopCorrector->correction (theJet);
192  double tTcorr = tTopCorrector->correction (theJet);
193  jetsNoCorr[4].SetPtEtaPhiM( theJet.pt() , theJet.eta() , theJet.phi() , theJet.mass() );
194  jetsCorFl0[4].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , 0 );
195  jetsCorFlM[4].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , qMass );
196  jetsCorMix[4].SetPtEtaPhiM( theJet.pt()*tTcorr , theJet.eta() , theJet.phi() , 0 );
197  isQuarkFound[4]=true;
198  } else if ( particPDG == -4 ) { //W- from tbar
199  double qTcorr = qTopCorrector->correction (theJet);
200  double tTcorr = tTopCorrector->correction (theJet);
201  jetsNoCorr[4].SetPtEtaPhiM( theJet.pt() , theJet.eta() , theJet.phi() , theJet.mass() );
202  jetsCorFl0[4].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , 0 );
203  jetsCorFlM[4].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , qMass );
204  jetsCorMix[4].SetPtEtaPhiM( theJet.pt()*tTcorr , theJet.eta() , theJet.phi() , 0 );
205  isQuarkFound[4]=true;
206  } else if ( particPDG == 1 ) { //W- from tbar
207  double qTcorr = qTopCorrector->correction (theJet);
208  double tTcorr = tTopCorrector->correction (theJet);
209  jetsNoCorr[5].SetPtEtaPhiM( theJet.pt() , theJet.eta() , theJet.phi() , theJet.mass() );
210  jetsCorFl0[5].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , 0 );
211  jetsCorFlM[5].SetPtEtaPhiM( theJet.pt()*qTcorr , theJet.eta() , theJet.phi() , qMass );
212  jetsCorMix[5].SetPtEtaPhiM( theJet.pt()*tTcorr , theJet.eta() , theJet.phi() , 0 );
213  isQuarkFound[5]=true;
214  } else if ( particPDG == 3 ) { //W- from tbar
215  double cTcorr = cTopCorrector->correction (theJet);
216  double tTcorr = tTopCorrector->correction (theJet);
217  jetsNoCorr[5].SetPtEtaPhiM( theJet.pt() , theJet.eta() , theJet.phi() , theJet.mass() );
218  jetsCorFl0[5].SetPtEtaPhiM( theJet.pt()*cTcorr , theJet.eta() , theJet.phi() , 0 );
219  jetsCorFlM[5].SetPtEtaPhiM( theJet.pt()*cTcorr , theJet.eta() , theJet.phi() , cMass );
220  jetsCorMix[5].SetPtEtaPhiM( theJet.pt()*tTcorr , theJet.eta() , theJet.phi() , 0 );
221  isQuarkFound[5]=true;
222  }
223  }
224  }
225 
226  if( isQuarkFound[0] && isQuarkFound[1] && isQuarkFound[2] ) {
227  TLorentzVector *theTopPNoCorr = new TLorentzVector( jetsNoCorr[0] + jetsNoCorr[1] + jetsNoCorr[2] );
228  TLorentzVector *theTopPCorFl0 = new TLorentzVector( jetsCorFl0[0] + jetsCorFl0[1] + jetsCorFl0[2] );
229  TLorentzVector *theTopPCorFlM = new TLorentzVector( jetsCorFlM[0] + jetsCorFlM[1] + jetsCorFlM[2] );
230  TLorentzVector *theTopPCorMix = new TLorentzVector( jetsCorMix[0] + jetsCorMix[1] + jetsCorMix[2] );
231  hMassNoCorr->Fill( theTopPNoCorr->M() );
232  hMassCorFl0->Fill( theTopPCorFl0->M() );
233  hMassCorFlM->Fill( theTopPCorFlM->M() );
234  hMassCorMix->Fill( theTopPCorMix->M() );
235  }
236 
237  if( isQuarkFound[3] && isQuarkFound[4] && isQuarkFound[5] ) {
238  TLorentzVector *theTopMNoCorr = new TLorentzVector( jetsNoCorr[3] + jetsNoCorr[4] + jetsNoCorr[5] );
239  TLorentzVector *theTopMCorFl0 = new TLorentzVector( jetsCorFl0[3] + jetsCorFl0[4] + jetsCorFl0[5] );
240  TLorentzVector *theTopMCorFlM = new TLorentzVector( jetsCorFlM[3] + jetsCorFlM[4] + jetsCorFlM[5] );
241  TLorentzVector *theTopMCorMix = new TLorentzVector( jetsCorMix[3] + jetsCorMix[4] + jetsCorMix[5] );
242  hMassNoCorr->Fill( theTopMNoCorr->M() );
243  hMassCorFl0->Fill( theTopMCorFl0->M() );
244  hMassCorFlM->Fill( theTopMCorFlM->M() );
245  hMassCorMix->Fill( theTopMCorMix->M() );
246  }
247 
248 }
edm::Handle< reco::JetMatchedPartonsCollection > theJetPartonMatch
std::string m_cT_CorrectorName
virtual double correction(const LorentzVector &fJet) const =0
get correction using Jet information only
edm::InputTag sourceByRefer_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::string m_qT_CorrectorName
const GenParticleRef & physicsDefinitionParton() const
static const JetCorrector * getJetCorrector(const std::string &fName, const edm::EventSetup &fSetup)
retrieve corrector from the event setup. troughs exception if something is missing ...
Definition: JetCorrector.cc:51
std::string m_tT_CorrectorName
edm::EventID id() const
Definition: EventBase.h:56
tuple cout
Definition: gather_cfg.py:121
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
std::string m_bT_CorrectorName

Member Data Documentation

float calcTopMass::bMass
private

Definition at line 71 of file CalcTopMassExample.cc.

float calcTopMass::cMass
private

Definition at line 72 of file CalcTopMassExample.cc.

TH1F* calcTopMass::hMassCorFl0
private

Definition at line 76 of file CalcTopMassExample.cc.

TH1F* calcTopMass::hMassCorFlM
private

Definition at line 77 of file CalcTopMassExample.cc.

TH1F* calcTopMass::hMassCorMix
private

Definition at line 78 of file CalcTopMassExample.cc.

TH1F* calcTopMass::hMassNoCorr
private

Definition at line 75 of file CalcTopMassExample.cc.

std::string calcTopMass::m_bT_CorrectorName
private

Definition at line 68 of file CalcTopMassExample.cc.

std::string calcTopMass::m_cT_CorrectorName
private

Definition at line 67 of file CalcTopMassExample.cc.

std::string calcTopMass::m_qT_CorrectorName
private

Definition at line 66 of file CalcTopMassExample.cc.

std::string calcTopMass::m_tT_CorrectorName
private

Definition at line 69 of file CalcTopMassExample.cc.

float calcTopMass::qMass
private

Definition at line 73 of file CalcTopMassExample.cc.

edm::InputTag calcTopMass::sourceByRefer_
private

Definition at line 63 of file CalcTopMassExample.cc.

edm::InputTag calcTopMass::sourcePartons_
private

Definition at line 62 of file CalcTopMassExample.cc.

edm::Handle<reco::JetMatchedPartonsCollection> calcTopMass::theJetPartonMatch
private

Definition at line 64 of file CalcTopMassExample.cc.