Difference: CMSSWCheatSheet (51 vs. 52)

Revision 522016-04-24 - HalilGamsizkan

Line: 1 to 1
 
META TOPICPARENT name="HalilGamsizkan"

Cheatsheet: CMSSW Analysis a la Framework

Changed:
<
<
An unofficial information dump page for CMSSW.
>
>
An unofficial information dump page for CMSSW. In below there's older and newer information together, I tried to separate them whenever I can.
  CMSSW

Accessing physics objects

Added:
>
>

Electrons (PAT/MiniAOD)

Wiki pages WorkBookPATDataFormats#PatElectron, WorkBookElectronAnalysis
Add to buildfile <use name="DataFormats/PatCandidates"/> Related error: undefined reference to `pat::Electron::electronID(std::string const&) const
Header file(s) #include <DataFormats/PatCandidates/interface/Electron.h>
Label slimmedElectrons
Collection type pat::ElectronCollection (vector<pat::Electron>)
Object reference link
Notes To see available electron IDs in data, type a wrong ID name in the electronID method and framework will list them along with the error message.
 %TWISTY{ mode="div" showlink="Show legacy information "
Line: 115 to 125
 
  • More labels, collections and documentation available here.
  • Namespace documentations: reco, edm.
Deleted:
<
<

What is a reco::Particle::LorentzVector ?

  • This is reco::Particle
  • On this page we find that LorentzVector is actually a typedef. Let's click on it.
  • We find what it actually is: typedef math::XYZTLorentzVector reco::Particle::LorentzVector . So it's a math::XYZTLorentzVector . Let's click on it.
  • Now we find typedef XYZTLorentzVectorD math::XYZTLorentzVector, so it's actually math::XYZTLorentzVectorD. We click on it.
  • We find that typedef ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D > math::XYZTLorentzVectorD. OK, but no hyperlinks anymore. Let's try google:
  • We google search for ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D > and eventually find it's reference page.
Ouch.
 </>
<!--/twistyPlugin-->
Added:
>
>
 

"Handling" the data

Deleted:
<
<
One accesses the data in the root file thru "handles". Handles types are templated with the collection/data type in the root file. EdmDumpEvent prints the collection types in the first column of it's output.
 
Added:
>
>
One accesses the data in the root file thru "handles". Handles types are templated with the collection/data type in the EDM root file. EdmDumpEvent prints the collection types in the first column of it's output.

In the class definition, define as private the token

edm::EDGetTokenT< pat::ElectronCollection > tok_electrons_;
In the constructor assign it's value
std::string labelElec_("slimmedElectrons");
tok_electrons_ = consumes< pat::ElectronCollection >(edm::InputTag(labelElec_));
In the analysis code, handle it
Handle<pat::ElectronCollection> elec;
iEvent.getByToken( tok_electrons_, elec );

<!--/twistyPlugin twikiMakeVisibleInline-->
 Taken from Benedikt's presentation:
# by module and default product label
Handle<TrackVector> trackPtr;
Line: 148 to 167
 ParameterSelector coneSel("coneSize",5); Handle jetPtr; iEvent.get( coneSel, jetPtr );
Added:
>
>
<!--/twistyPlugin-->
 

Looping over particles

Handle types are edm::Handle<CollectionType> and collection types are usually std::vector<ObjectType>.
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback