CMS 3D CMS Logo

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

#include <Histograms.h>

Inheritance diagram for HMassResolutionVSPart:
Histograms

Public Member Functions

virtual void Clear ()
 
virtual void Fill (const reco::Particle::LorentzVector &recoP1, const int charge1, const reco::Particle::LorentzVector &genP1, const reco::Particle::LorentzVector &recoP2, const int charge2, const reco::Particle::LorentzVector &genP2, const double &recoMass, const double &genMass)
 
virtual void Fill (const reco::Particle::LorentzVector &recoP1, const int charge1, const reco::Particle::LorentzVector &recoP2, const int charge2, const double &recoMass, const double &genMass)
 
 HMassResolutionVSPart (TFile *outputFile, const TString &name)
 
virtual void Write ()
 
 ~HMassResolutionVSPart ()
 
- Public Member Functions inherited from Histograms
void declareHistograms ()
 
virtual void Fill (const reco::Particle::LorentzVector &p1, const reco::Particle::LorentzVector &p2)
 
virtual void Fill (const reco::Particle::LorentzVector &p1, const reco::Particle::LorentzVector &p2, const int charge, const double &weight=1.)
 
virtual void Fill (const CLHEP::HepLorentzVector &momentum1, const CLHEP::HepLorentzVector &momentum2)
 
virtual void Fill (const CLHEP::HepLorentzVector &momentum1, const CLHEP::HepLorentzVector &momentum2, const int charge, const double &weight=1.)
 
virtual void Fill (const CLHEP::HepLorentzVector &p1, const reco::Particle::LorentzVector &p2)
 
virtual void Fill (const reco::Particle::LorentzVector &p4, const double &weight=1.)
 
virtual void Fill (const reco::Particle::LorentzVector &p4, const int charge, const double &weight=1.)
 
virtual void Fill (const CLHEP::HepLorentzVector &momentum, const int charge, const double &weight=1.)
 
virtual void Fill (const reco::Particle::LorentzVector &p4, const double &resValue, const int charge)
 
virtual void Fill (const reco::Particle::LorentzVector &p4, const double &genValue, const double recValue, const int charge)
 
virtual void Fill (const CLHEP::HepLorentzVector &p, const double &likeValue)
 
virtual void Fill (const unsigned int number)
 
virtual void Fill (const reco::Particle::LorentzVector &recoP1, const reco::Particle::LorentzVector &genP1, const reco::Particle::LorentzVector &recoP2, const reco::Particle::LorentzVector &genP2)
 
virtual void Fill (const double &x, const double &y)
 
virtual void Fill (const double &x, const double &y, const double &a, const double &b)
 
virtual void Fill (const reco::Particle::LorentzVector &p41, const reco::Particle::LorentzVector &p42, const reco::Particle::LorentzVector &p4Res, const double &weight=1.)
 
virtual void Fill (const CLHEP::HepLorentzVector &momentum1, const CLHEP::HepLorentzVector &momentum2, const CLHEP::HepLorentzVector &momentumRes, const double &weight=1.)
 
void fillEventInfo (int proc, int strk, int ntrkr)
 
void fillRecHistograms (const RecTrack_t &r)
 
void fillSimHistograms (const SimTrack_t &s)
 
void fillVzeroHistograms (const RecVzero_t &r, int part)
 
virtual double Get (const reco::Particle::LorentzVector &recoP1, const TString &covarianceName)
 
virtual TString GetName ()
 
 Histograms ()
 
 Histograms (const TString &name)
 
 Histograms (TFile *outputFile, const TString &name)
 
 Histograms (const edm::ParameterSet &pset)
 
virtual void SetWeight (double weight)
 
void writeHistograms ()
 
virtual ~Histograms ()
 
 ~Histograms ()
 

Protected Attributes

std::map< TString, TH1 * > mapHisto_
 
std::auto_ptr< HDeltamuMinus
 
std::auto_ptr< HDeltamuPlus
 
TString nameSuffix_ [2]
 
- Protected Attributes inherited from Histograms
TDirectory * histoDir_
 
TString name_
 
TFile * outputFile_
 
double theWeight_
 

Detailed Description

A set of histograms for resolution. The fill method requires the two selected muons, their charges and the reconstructed and generated masses. It evaluates the resolution on the mass vs: Pt of the pair DeltaEta of the pair DeltaPhi of the pair pt, eta and phi of the plus and minus muon separately

Definition at line 2146 of file Histograms.h.

Constructor & Destructor Documentation

HMassResolutionVSPart::HMassResolutionVSPart ( TFile *  outputFile,
const TString &  name 
)
inline

Definition at line 2149 of file Histograms.h.

References Histograms::histoDir_, i, mapHisto_, muMinus, muPlus, mergeVDriftHistosByStation::name, and nameSuffix_.

2149  : Histograms( outputFile, name ) {
2150  // Kinematical variables
2151  nameSuffix_[0] = "Plus";
2152  nameSuffix_[1] = "Minus";
2153  TString titleSuffix[] = {" for mu+", " for mu-"};
2154 
2155  mapHisto_[name] = new TH1F (name, "#Delta M/M", 4000, -1, 1);
2156  mapHisto_[name+"VSPairPt"] = new HResolution (name+"VSPairPt", "resolution VS pt of the pair", 100, 0, 200, -1, 1, histoDir_);
2157  mapHisto_[name+"VSPairDeltaEta"] = new HResolution (name+"VSPairDeltaEta", "resolution VS #Delta#eta of the pair", 100, -0.1, 6.2, -1, 1, histoDir_);
2158  mapHisto_[name+"VSPairDeltaPhi"] = new HResolution (name+"VSPairDeltaPhi", "resolution VS #Delta#phi of the pair", 100, -0.1, 3.2, -1, 1, histoDir_);
2159 
2160  for( int i=0; i<2; ++i ) {
2161  mapHisto_[name+"VSPt"+nameSuffix_[i]] = new HResolution (name+"VSPt"+nameSuffix_[i], "resolution VS pt"+titleSuffix[i], 100, 0, 200, -1, 1, histoDir_);
2162  mapHisto_[name+"VSEta"+nameSuffix_[i]] = new HResolution (name+"VSEta"+nameSuffix_[i], "resolution VS #eta"+titleSuffix[i], 100, -3, 3, -1, 1, histoDir_);
2163  mapHisto_[name+"VSPhi"+nameSuffix_[i]] = new HResolution (name+"VSPhi"+nameSuffix_[i], "resolution VS #phi"+titleSuffix[i], 100, -3.2, 3.2, -1, 1, histoDir_);
2164  }
2165 
2166  // single particles histograms
2167  muMinus.reset( new HDelta("muMinus") );
2168  muPlus.reset( new HDelta("muPlus") );
2169  }
int i
Definition: DBlmapReader.cc:9
TString nameSuffix_[2]
Definition: Histograms.h:2274
std::auto_ptr< HDelta > muPlus
Definition: Histograms.h:2276
std::auto_ptr< HDelta > muMinus
Definition: Histograms.h:2275
std::map< TString, TH1 * > mapHisto_
Definition: Histograms.h:2273
TDirectory * histoDir_
Definition: Histograms.h:126
HMassResolutionVSPart::~HMassResolutionVSPart ( )
inline

Definition at line 2171 of file Histograms.h.

References interpolateCardsSimple::histo, and mapHisto_.

2171  {
2172  for (std::map<TString, TH1*>::const_iterator histo=mapHisto_.begin();
2173  histo!=mapHisto_.end(); histo++) {
2174  delete (*histo).second;
2175  }
2176  }
std::map< TString, TH1 * > mapHisto_
Definition: Histograms.h:2273

Member Function Documentation

virtual void HMassResolutionVSPart::Clear ( )
inlinevirtual

Implements Histograms.

Definition at line 2249 of file Histograms.h.

References interpolateCardsSimple::histo, mapHisto_, muMinus, and muPlus.

2249  {
2250  for (std::map<TString, TH1*>::const_iterator histo=mapHisto_.begin();
2251  histo!=mapHisto_.end(); histo++) {
2252  (*histo).second->Clear();
2253  }
2254  muMinus->Clear();
2255  muPlus->Clear();
2256  }
std::auto_ptr< HDelta > muPlus
Definition: Histograms.h:2276
std::auto_ptr< HDelta > muMinus
Definition: Histograms.h:2275
std::map< TString, TH1 * > mapHisto_
Definition: Histograms.h:2273
virtual void HMassResolutionVSPart::Fill ( const reco::Particle::LorentzVector recoP1,
const int  charge1,
const reco::Particle::LorentzVector genP1,
const reco::Particle::LorentzVector recoP2,
const int  charge2,
const reco::Particle::LorentzVector genP2,
const double &  recoMass,
const double &  genMass 
)
inlinevirtual

Reimplemented from Histograms.

Definition at line 2178 of file Histograms.h.

References muMinus, and muPlus.

2182  {
2183  muMinus->Fill(recoP1, genP1);
2184  muPlus->Fill(recoP2, genP2);
2185 
2186  Fill( recoP1, charge1, recoP2, charge2, recoMass, genMass );
2187  }
std::auto_ptr< HDelta > muPlus
Definition: Histograms.h:2276
std::auto_ptr< HDelta > muMinus
Definition: Histograms.h:2275
virtual void Fill(const reco::Particle::LorentzVector &recoP1, const int charge1, const reco::Particle::LorentzVector &genP1, const reco::Particle::LorentzVector &recoP2, const int charge2, const reco::Particle::LorentzVector &genP2, const double &recoMass, const double &genMass)
Definition: Histograms.h:2178
virtual void HMassResolutionVSPart::Fill ( const reco::Particle::LorentzVector recoP1,
const int  charge1,
const reco::Particle::LorentzVector recoP2,
const int  charge2,
const double &  recoMass,
const double &  genMass 
)
inlinevirtual

Reimplemented from Histograms.

Definition at line 2189 of file Histograms.h.

References gather_cfg::cout, MuScleFitUtils::deltaPhi(), i, getHLTprescales::index, mapHisto_, Histograms::name_, and nameSuffix_.

2193  {
2194 
2195  if ( charge1 == charge2 ) std::cout << "Error: must get two opposite charge particles" << std::endl;
2196 
2197  double massRes = (recoMass - genMass)/genMass;
2198 
2199  reco::Particle::LorentzVector recoPair( recoP1 + recoP2 );
2200  double pairPt = recoPair.Pt();
2201 
2202  double recoPt[2] = {recoP1.Pt(), recoP2.Pt()};
2203  double recoEta[2] = {recoP1.Eta(), recoP2.Eta()};
2204  double recoPhi[2] = {recoP1.Phi(), recoP2.Phi()};
2205 
2206  // std::cout << "pairPt = " << pairPt << ", massRes = ("<<recoMass<<" - "<<genMass<<")/"<<genMass<<" = " << massRes
2207  // << ", recoPt[0] = " << recoPt[0] << ", recoPt[1] = " << recoPt[1] << std::endl;
2208 
2209  // Index of the histogram. If the muons have charge1 = -1 and charge2 = 1, they already have the
2210  // correct histogram indeces. Otherwise, swap the indeces.
2211  // In any case the negative muon has index = 0 and the positive muon has index = 1.
2212  int id[2] = {0,1};
2213  if ( charge1 > 0 ) {
2214  id[0] = 1;
2215  id[1] = 0;
2216  }
2217 
2218  double pairDeltaEta = fabs(recoEta[0] - recoEta[1]);
2219  double pairDeltaPhi = MuScleFitUtils::deltaPhi(recoPhi[0], recoPhi[1]);
2220 
2221  mapHisto_[name_]->Fill(massRes);
2222  mapHisto_[name_+"VSPairPt"]->Fill(pairPt, massRes);
2223  mapHisto_[name_+"VSPairDeltaEta"]->Fill(pairDeltaEta, massRes);
2224  mapHisto_[name_+"VSPairDeltaPhi"]->Fill(pairDeltaPhi, massRes);
2225 
2226  // Resolution vs single muon quantities
2227  // ------------------------------------
2228  int index = 0;
2229  for( int i=0; i<2; ++i ) {
2230  index = id[i];
2231  mapHisto_[name_+"VSPt"+nameSuffix_[i]]->Fill(recoPt[index], massRes); // EM [index] or [i]???
2232  mapHisto_[name_+"VSEta"+nameSuffix_[i]]->Fill(recoEta[index], massRes);
2233  mapHisto_[name_+"VSPhi"+nameSuffix_[i]]->Fill(recoPhi[index], massRes);
2234  }
2235  }
int i
Definition: DBlmapReader.cc:9
TString nameSuffix_[2]
Definition: Histograms.h:2274
TString name_
Definition: Histograms.h:124
std::map< TString, TH1 * > mapHisto_
Definition: Histograms.h:2273
static double deltaPhi(const double &phi1, const double &phi2)
tuple cout
Definition: gather_cfg.py:121
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:25
virtual void HMassResolutionVSPart::Write ( )
inlinevirtual

Implements Histograms.

Definition at line 2237 of file Histograms.h.

References interpolateCardsSimple::histo, Histograms::histoDir_, mapHisto_, muMinus, and muPlus.

2237  {
2238  histoDir_->cd();
2239  for (std::map<TString, TH1*>::const_iterator histo=mapHisto_.begin();
2240  histo!=mapHisto_.end(); histo++) {
2241  (*histo).second->Write();
2242  }
2243  // Create the new dir and cd into it
2244  (histoDir_->mkdir("singleMuonsVSgen"))->cd();
2245  muMinus->Write();
2246  muPlus->Write();
2247  }
std::auto_ptr< HDelta > muPlus
Definition: Histograms.h:2276
std::auto_ptr< HDelta > muMinus
Definition: Histograms.h:2275
std::map< TString, TH1 * > mapHisto_
Definition: Histograms.h:2273
TDirectory * histoDir_
Definition: Histograms.h:126

Member Data Documentation

std::map<TString, TH1*> HMassResolutionVSPart::mapHisto_
protected

Definition at line 2273 of file Histograms.h.

Referenced by Clear(), Fill(), HMassResolutionVSPart(), Write(), and ~HMassResolutionVSPart().

std::auto_ptr<HDelta> HMassResolutionVSPart::muMinus
protected

Definition at line 2275 of file Histograms.h.

Referenced by Clear(), Fill(), HMassResolutionVSPart(), and Write().

std::auto_ptr<HDelta> HMassResolutionVSPart::muPlus
protected

Definition at line 2276 of file Histograms.h.

Referenced by Clear(), Fill(), HMassResolutionVSPart(), and Write().

TString HMassResolutionVSPart::nameSuffix_[2]
protected

Definition at line 2274 of file Histograms.h.

Referenced by Fill(), and HMassResolutionVSPart().