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 Member Functions | Protected Attributes
MuScleFit Class Reference
Inheritance diagram for MuScleFit:
edm::EDLooper MuScleFitBase edm::EDLooperBase

Public Member Functions

void beginOfJobInConstructor ()
 
virtual void duringFastLoop ()
 
virtual edm::EDLooper::Status duringLoop (const edm::Event &event, const edm::EventSetup &eventSetup) override
 
virtual void endOfFastLoop (const unsigned int iLoop)
 
virtual void endOfJob () override
 
virtual edm::EDLooper::Status endOfLoop (const edm::EventSetup &eventSetup, unsigned int iLoop) override
 
template<typename T >
std::vector< MuScleFitMuonfillMuonCollection (const std::vector< T > &tracks)
 
 MuScleFit (const edm::ParameterSet &pset)
 
virtual void startingNewLoop (unsigned int iLoop) override
 
virtual ~MuScleFit ()
 
- Public Member Functions inherited from edm::EDLooper
 EDLooper ()
 
 EDLooper (EDLooper const &)=delete
 
EDLooperoperator= (EDLooper const &)=delete
 
virtual ~EDLooper ()
 
- Public Member Functions inherited from edm::EDLooperBase
virtual void attachTo (ActivityRegistry &)
 Override this method if you need to monitor the state of the processing. More...
 
virtual void beginOfJob (EventSetup const &)
 
virtual void beginOfJob ()
 
void copyInfo (ScheduleInfo const &)
 
void doBeginLuminosityBlock (LuminosityBlockPrincipal &, EventSetup const &, ProcessContext *)
 
void doBeginRun (RunPrincipal &, EventSetup const &, ProcessContext *)
 
Status doDuringLoop (EventPrincipal &eventPrincipal, EventSetup const &es, ProcessingController &, StreamContext *)
 
void doEndLuminosityBlock (LuminosityBlockPrincipal &, EventSetup const &, ProcessContext *)
 
Status doEndOfLoop (EventSetup const &es)
 
void doEndRun (RunPrincipal &, EventSetup const &, ProcessContext *)
 
void doStartingNewLoop ()
 
 EDLooperBase ()
 
 EDLooperBase (EDLooperBase const &)=delete
 
virtual std::set
< eventsetup::EventSetupRecordKey
modifyingRecords () const
 
EDLooperBaseoperator= (EDLooperBase const &)=delete
 
void prepareForNextLoop (eventsetup::EventSetupProvider *esp)
 
void setActionTable (ExceptionToActionTable const *actionTable)
 
void setModuleChanger (ModuleChanger *)
 
virtual ~EDLooperBase ()
 

Protected Member Functions

void applyBias (reco::Particle::LorentzVector &mu, const int charge)
 Apply the bias if needed using the function in MuScleFitUtils. More...
 
void applySmearing (reco::Particle::LorentzVector &mu)
 Apply the smearing if needed using the function in MuScleFitUtils. More...
 
bool checkDeltaR (reco::Particle::LorentzVector &genMu, reco::Particle::LorentzVector &recMu)
 Check if two lorentzVector are near in deltaR. More...
 
void checkParameters ()
 
void fillComparisonHistograms (const reco::Particle::LorentzVector &genMu, const reco::Particle::LorentzVector &recoMu, const std::string &inputName, const int charge)
 Fill the reco vs gen and reco vs sim comparison histograms. More...
 
void selectMuons (const edm::Event &event)
 
void selectMuons (const int maxEvents, const TString &treeFileName)
 
bool selGlobalMuon (const pat::Muon *aMuon)
 Function for onia selections. More...
 
bool selTrackerMuon (const pat::Muon *aMuon)
 
template<typename T >
void takeSelectedMuonType (const T &muon, std::vector< reco::Track > &tracks)
 Template method used to fill the track collection starting from reco::muons or pat::muons. More...
 
- Protected Member Functions inherited from edm::EDLooperBase
ModuleChangermoduleChanger ()
 This only returns a non-zero value during the call to endOfLoop. More...
 
ScheduleInfo const * scheduleInfo () const
 This returns a non-zero value after the constructor has been called. More...
 

Protected Attributes

bool compareToSimTracks_
 
bool fastLoop
 
std::string genParticlesName_
 
int iev
 
bool ifGenPart
 
bool ifHepMC
 
std::string inputRootTreeFileName_
 
unsigned int loopCounter
 
int maxEventsFromRootTree_
 
unsigned int maxLoopNumber
 
double maxResMass_hwindow [6]
 
double minResMass_hwindow [6]
 
std::auto_ptr
< MuScleFitMuonSelector
muonSelector_
 
bool negateTrigger_
 
int numberOfEwkZ
 
int numberOfSimMuons
 
int numberOfSimTracks
 
int numberOfSimVertices
 
std::string outputRootTreeFileName_
 
bool PATmuons_
 
MuScleFitPlotterplotter
 
edm::InputTag puInfoSrc_
 
reco::Particle::LorentzVector recMu1
 
reco::Particle::LorentzVector recMu2
 
MuScleFitMuon recMuScleMu1
 
MuScleFitMuon recMuScleMu2
 
bool saveAllToTree_
 
edm::InputTag simTracksCollection_
 
MuonServiceProxytheService
 
int totalEvents_
 
std::vector< std::string > triggerPath_
 
std::string triggerResultsLabel_
 
std::string triggerResultsProcess_
 
edm::InputTag vertexSrc_
 

Additional Inherited Members

- Public Types inherited from edm::EDLooperBase
enum  Status { kContinue, kStop }
 
- Private Member Functions inherited from MuScleFitBase
 MuScleFitBase (const edm::ParameterSet &iConfig)
 
virtual ~MuScleFitBase ()
 
void clearHistoMap ()
 Clean the histograms map. More...
 
void fillHistoMap (TFile *outputFile, unsigned int iLoop)
 Create the histograms map. More...
 
void readProbabilityDistributionsFromFile ()
 Read probability distributions from a local root file. More...
 
void writeHistoMap (const unsigned int iLoop)
 Save the histograms map to file. More...
 
- Private Attributes inherited from MuScleFitBase
int debug_
 
std::vector< GenMuonPairgenMuonPairs_
 Stores the genMuon pairs and the motherId prior to the creation of the internal tree. More...
 
std::map< std::string,
Histograms * > 
mapHisto_
 The map of histograms. More...
 
std::vector< MuonPairmuonPairs_
 Used to store the muon pairs plus run and event number prior to the creation of the internal tree. More...
 
std::string probabilitiesFile_
 
std::string probabilitiesFileInPath_
 
std::vector< TFile * > theFiles_
 The files were the histograms are saved. More...
 
std::string theGenInfoRootFileName_
 
edm::InputTag theMuonLabel_
 
int theMuonType_
 
std::string theRootFileName_
 

Detailed Description

Analyzer of the Global muon tracks

Definition at line 186 of file MuScleFit.cc.

Constructor & Destructor Documentation

MuScleFit::MuScleFit ( const edm::ParameterSet pset)

Definition at line 376 of file MuScleFit.cc.

References MuScleFitUtils::backgroundHandler, beginOfJobInConstructor(), MuScleFitUtils::biasFunction, MuScleFitUtils::BiasType, checkParameters(), compareToSimTracks_, MuScleFitUtils::computeMinosErrors_, gather_cfg::cout, MuScleFitUtils::crossSectionHandler, MuScleFitUtils::debug, MuScleFitBase::debug_, MuScleFitUtils::debugMassResol_, MuScleFitUtils::deltaPhiMaxCut_, MuScleFitUtils::deltaPhiMinCut_, MuScleFitUtils::doBackgroundFit, MuScleFitUtils::doCrossSectionFit, MuScleFitUtils::doResolFit, MuScleFitUtils::doScaleFit, cmsRelvalreport::exit, fastLoop, MuScleFitUtils::FitStrategy, callgraph::G, genParticlesName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), MuScleFitUtils::goodmuon, i, inputRootTreeFileName_, HLT_25ns10e33_v2_cff::InputTag, j, loopCounter, MuScleFitUtils::massWindowHalfWidth, maxEventsFromRootTree_, maxLoopNumber, MuScleFitUtils::maxMuonEtaFirstRange_, MuScleFitUtils::maxMuonEtaSecondRange_, MuScleFitUtils::maxMuonPt_, maxResMass_hwindow, MuScleFitUtils::minimumShapePlots_, MuScleFitUtils::minMuonEtaFirstRange_, MuScleFitUtils::minMuonEtaSecondRange_, MuScleFitUtils::minMuonPt_, minResMass_hwindow, muonSelector_, MuScleFitUtils::MuonType, MuScleFitUtils::MuonTypeForCheckMassWindow, negateTrigger_, MuScleFitUtils::normalizeLikelihoodByEventNumber_, outputRootTreeFileName_, MuScleFitUtils::parBgr, MuScleFitUtils::parBgrFix, MuScleFitUtils::parBgrOrder, MuScleFitUtils::parBias, MuScleFitUtils::parCrossSection, MuScleFitUtils::parCrossSectionFix, MuScleFitUtils::parCrossSectionOrder, MuScleFitUtils::parResol, MuScleFitUtils::parResolFix, MuScleFitUtils::parResolMax, MuScleFitUtils::parResolMin, MuScleFitUtils::parResolOrder, MuScleFitUtils::parResolStep, MuScleFitUtils::parScale, MuScleFitUtils::parScaleFix, MuScleFitUtils::parScaleMax, MuScleFitUtils::parScaleMin, MuScleFitUtils::parScaleOrder, MuScleFitUtils::parScaleStep, MuScleFitUtils::parSmear, PATmuons_, Pi, puInfoSrc_, MuScleFitUtils::rapidityBinsForZ_, MuScleFitUtils::resfind, MuScleFitUtils::ResMass, MuScleFitUtils::ResolFitType, MuScleFitUtils::resolutionFunction, MuScleFitUtils::resolutionFunctionForVec, resolutionFunctionService(), resolutionFunctionVecService(), saveAllToTree_, MuScleFitUtils::ScaleFitType, MuScleFitUtils::scaleFunction, MuScleFitUtils::scaleFunctionForVec, scaleFunctionService(), scaleFunctionVecService(), MuScleFitUtils::separateRanges_, MuScleFitUtils::sherpa_, simTracksCollection_, MuScleFitUtils::smearFunction, smearFunctionService(), MuScleFitUtils::SmearType, MuScleFitUtils::speedup, mathSSE::sqrt(), MuScleFitUtils::startWithSimplex_, AlCaHLTBitMon_QueryRunRegistry::string, MuScleFitBase::theMuonLabel_, MuScleFitBase::theMuonType_, triggerPath_, triggerResultsLabel_, triggerResultsProcess_, MuScleFitUtils::useProbsFile_, vertexSrc_, and MuScleFitUtils::x.

376  :
377  MuScleFitBase( pset ),
378  totalEvents_(0)
379 {
381  if (debug_>0) std::cout << "[MuScleFit]: Constructor" << std::endl;
382 
383  if ((theMuonType_<-4 || theMuonType_>5) && theMuonType_<10) {
384  std::cout << "[MuScleFit]: Unknown muon type! Aborting." << std::endl;
385  abort();
386  }
387 
388  loopCounter = 0;
389 
390  // Boundaries for h-function computation (to be improved!)
391  // -------------------------------------------------------
392  minResMass_hwindow[0] = 71.1876; // 76.;
393  maxResMass_hwindow[0] = 111.188; // 106.;
394  minResMass_hwindow[1] = 10.15;
395  maxResMass_hwindow[1] = 10.55;
396  minResMass_hwindow[2] = 9.8;
397  maxResMass_hwindow[2] = 10.2;
398  minResMass_hwindow[3] = 9.25;
399  maxResMass_hwindow[3] = 9.65;
400  minResMass_hwindow[4] = 3.58;
401  maxResMass_hwindow[4] = 3.78;
402  minResMass_hwindow[5] = 3.0;
403  maxResMass_hwindow[5] = 3.2;
404 
405  // Max number of loops (if > 2 then try to minimize likelihood more than once)
406  // ---------------------------------------------------------------------------
407  maxLoopNumber = pset.getUntrackedParameter<int>("maxLoopNumber", 2);
408  fastLoop = pset.getUntrackedParameter<bool>("FastLoop", true);
409 
410  // Selection of fits according to loop
411  MuScleFitUtils::doResolFit = pset.getParameter<std::vector<int> >("doResolFit");
412  MuScleFitUtils::doScaleFit = pset.getParameter<std::vector<int> >("doScaleFit");
413  MuScleFitUtils::doCrossSectionFit = pset.getParameter<std::vector<int> >("doCrossSectionFit");
414  MuScleFitUtils::doBackgroundFit = pset.getParameter<std::vector<int> >("doBackgroundFit");
415 
416  // Bias and smear types
417  // --------------------
418  int biasType = pset.getParameter<int>("BiasType");
419  MuScleFitUtils::BiasType = biasType;
420  // No error, the scale functions are used also for the bias
422  int smearType = pset.getParameter<int>("SmearType");
423  MuScleFitUtils::SmearType = smearType;
425 
426  // Fit types
427  // ---------
428  int resolFitType = pset.getParameter<int>("ResolFitType");
429  MuScleFitUtils::ResolFitType = resolFitType;
432  int scaleType = pset.getParameter<int>("ScaleFitType");
433  MuScleFitUtils::ScaleFitType = scaleType;
436 
437  // Initial parameters values
438  // -------------------------
439  MuScleFitUtils::parBias = pset.getParameter<std::vector<double> >("parBias");
440  MuScleFitUtils::parSmear = pset.getParameter<std::vector<double> >("parSmear");
441  MuScleFitUtils::parResol = pset.getParameter<std::vector<double> >("parResol");
442  MuScleFitUtils::parResolStep = pset.getUntrackedParameter<std::vector<double> >("parResolStep", std::vector<double>());
443  MuScleFitUtils::parResolMin = pset.getUntrackedParameter<std::vector<double> >("parResolMin", std::vector<double>());
444  MuScleFitUtils::parResolMax = pset.getUntrackedParameter<std::vector<double> >("parResolMax", std::vector<double>());
445  MuScleFitUtils::parScale = pset.getParameter<std::vector<double> >("parScale");
446  MuScleFitUtils::parScaleStep = pset.getUntrackedParameter<std::vector<double> >("parScaleStep", std::vector<double>());
447  MuScleFitUtils::parScaleMin = pset.getUntrackedParameter<std::vector<double> >("parScaleMin", std::vector<double>());
448  MuScleFitUtils::parScaleMax = pset.getUntrackedParameter<std::vector<double> >("parScaleMax", std::vector<double>());
449  MuScleFitUtils::parCrossSection = pset.getParameter<std::vector<double> >("parCrossSection");
450  MuScleFitUtils::parBgr = pset.getParameter<std::vector<double> >("parBgr");
451  MuScleFitUtils::parResolFix = pset.getParameter<std::vector<int> >("parResolFix");
452  MuScleFitUtils::parScaleFix = pset.getParameter<std::vector<int> >("parScaleFix");
453  MuScleFitUtils::parCrossSectionFix = pset.getParameter<std::vector<int> >("parCrossSectionFix");
454  MuScleFitUtils::parBgrFix = pset.getParameter<std::vector<int> >("parBgrFix");
455  MuScleFitUtils::parResolOrder = pset.getParameter<std::vector<int> >("parResolOrder");
456  MuScleFitUtils::parScaleOrder = pset.getParameter<std::vector<int> >("parScaleOrder");
457  MuScleFitUtils::parCrossSectionOrder = pset.getParameter<std::vector<int> >("parCrossSectionOrder");
458  MuScleFitUtils::parBgrOrder = pset.getParameter<std::vector<int> >("parBgrOrder");
459 
460  MuScleFitUtils::resfind = pset.getParameter<std::vector<int> >("resfind");
461  MuScleFitUtils::FitStrategy = pset.getParameter<int>("FitStrategy");
462 
463  // Option to skip unnecessary stuff
464  // --------------------------------
465  MuScleFitUtils::speedup = pset.getParameter<bool>("speedup");
466 
467  // Option to skip simTracks comparison
468  compareToSimTracks_ = pset.getParameter<bool>("compareToSimTracks");
469  simTracksCollection_ = pset.getUntrackedParameter<edm::InputTag>("SimTracksCollection", edm::InputTag("g4SimHits"));
470 
471  triggerResultsLabel_ = pset.getUntrackedParameter<std::string>("TriggerResultsLabel");
472  triggerResultsProcess_ = pset.getUntrackedParameter<std::string>("TriggerResultsProcess");
473  triggerPath_ = pset.getUntrackedParameter<std::vector<std::string> >("TriggerPath");
474  negateTrigger_ = pset.getUntrackedParameter<bool>("NegateTrigger", false);
475  saveAllToTree_ = pset.getUntrackedParameter<bool>("SaveAllToTree", false);
476 
477  // input collections for PU related infos
478  puInfoSrc_ = pset.getUntrackedParameter<edm::InputTag>("PileUpSummaryInfo");
479  vertexSrc_ = pset.getUntrackedParameter<edm::InputTag>("PrimaryVertexCollection");
480 
481 
482  PATmuons_ = pset.getUntrackedParameter<bool>("PATmuons", false);
483  genParticlesName_ = pset.getUntrackedParameter<std::string>("GenParticlesName", "genParticles");
484 
485  // Use the probability file or not. If not it will perform a simpler selection taking the muon pair with
486  // invariant mass closer to the pdf value and will crash if some fit is attempted.
487  MuScleFitUtils::useProbsFile_ = pset.getUntrackedParameter<bool>("UseProbsFile", true);
488 
489  // This must be set to true if using events generated with Sherpa
490  MuScleFitUtils::sherpa_ = pset.getUntrackedParameter<bool>("Sherpa", false);
491 
492  MuScleFitUtils::rapidityBinsForZ_ = pset.getUntrackedParameter<bool>("RapidityBinsForZ", true);
493 
494  // Set the cuts on muons to be used in the fit
495  MuScleFitUtils::separateRanges_ = pset.getUntrackedParameter<bool>("SeparateRanges", true);
496  MuScleFitUtils::maxMuonPt_ = pset.getUntrackedParameter<double>("MaxMuonPt", 100000000.);
497  MuScleFitUtils::minMuonPt_ = pset.getUntrackedParameter<double>("MinMuonPt", 0.);
498  MuScleFitUtils::minMuonEtaFirstRange_ = pset.getUntrackedParameter<double>("MinMuonEtaFirstRange", -6.);
499  MuScleFitUtils::maxMuonEtaFirstRange_ = pset.getUntrackedParameter<double>("MaxMuonEtaFirstRange", 6.);
500  MuScleFitUtils::minMuonEtaSecondRange_ = pset.getUntrackedParameter<double>("MinMuonEtaSecondRange", -100.);
501  MuScleFitUtils::maxMuonEtaSecondRange_ = pset.getUntrackedParameter<double>("MaxMuonEtaSecondRange", 100.);
502  MuScleFitUtils::deltaPhiMinCut_ = pset.getUntrackedParameter<double>("DeltaPhiMinCut", -100.);
503  MuScleFitUtils::deltaPhiMaxCut_ = pset.getUntrackedParameter<double>("DeltaPhiMaxCut", 100.);
504 
505  MuScleFitUtils::debugMassResol_ = pset.getUntrackedParameter<bool>("DebugMassResol", false);
506  // MuScleFitUtils::massResolComponentsStruct MuScleFitUtils::massResolComponents;
507 
508  // Check for parameters consistency
509  // it will abort in case of errors.
510  checkParameters();
511 
512  // Generate array of gaussian-distributed numbers for smearing
513  // -----------------------------------------------------------
515  std::cout << "[MuScleFit-Constructor]: Generating random values for smearing" << std::endl;
516  TF1 G("G", "[0]*exp(-0.5*pow(x,2))", -5., 5.);
517  double norm = 1/sqrt(2*TMath::Pi());
518  G.SetParameter (0,norm);
519  for (int i=0; i<10000; i++) {
520  for (int j=0; j<7; j++) {
521  MuScleFitUtils::x[j][i] = G.GetRandom();
522  }
523  }
524  }
526 
527  if(theMuonType_ > 0 && theMuonType_ < 4) {
530  }
531  else if(theMuonType_ == 0 || theMuonType_ == 4 || theMuonType_ == 5 || theMuonType_ >= 10 || theMuonType_==-1 || theMuonType_==-2 || theMuonType_==-3 || theMuonType_==-4) {
534  }
535  else{
536  std::cout<<"Wrong muon type "<<theMuonType_<<std::endl;
537  exit(1);
538  }
539 
540  // When using standalone muons switch to the single Z pdf
541  if( theMuonType_ == 2 ) {
543  }
544 
545  // Initialize ResMaxSigma And ResHalfWidth - 0 = global, 1 = SM, 2 = tracker
546  // -------------------------------------------------------------------------
565 
571 
572  MuScleFitUtils::backgroundHandler = new BackgroundHandler( pset.getParameter<std::vector<int> >("BgrFitType"),
573  pset.getParameter<std::vector<double> >("LeftWindowBorder"),
574  pset.getParameter<std::vector<double> >("RightWindowBorder"),
577 
579 
580  // Build cross section scale factors
581  // MuScleFitUtils::resfind
582 
583  MuScleFitUtils::normalizeLikelihoodByEventNumber_ = pset.getUntrackedParameter<bool>("NormalizeLikelihoodByEventNumber", true);
584  if(debug_>0) std::cout << "End of MuScleFit constructor" << std::endl;
585 
586  inputRootTreeFileName_ = pset.getParameter<std::string>("InputRootTreeFileName");
587  outputRootTreeFileName_ = pset.getParameter<std::string>("OutputRootTreeFileName");
588  maxEventsFromRootTree_ = pset.getParameter<int>("MaxEventsFromRootTree");
589 
590  MuScleFitUtils::startWithSimplex_ = pset.getParameter<bool>("StartWithSimplex");
591  MuScleFitUtils::computeMinosErrors_ = pset.getParameter<bool>("ComputeMinosErrors");
592  MuScleFitUtils::minimumShapePlots_ = pset.getParameter<bool>("MinimumShapePlots");
593 
595 }
const double Pi
static std::vector< int > doScaleFit
static std::vector< int > doResolFit
T getParameter(std::string const &) const
scaleFunctionBase< double * > * scaleFunctionService(const int identifier)
Service to build the scale functor corresponding to the passed identifier.
Definition: Functions.cc:3
MuScleFitBase(const edm::ParameterSet &iConfig)
Definition: MuScleFitBase.h:21
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
static std::vector< double > parBias
static std::vector< int > parCrossSectionOrder
static smearFunctionBase * smearFunction
static std::vector< int > parScaleOrder
edm::InputTag theMuonLabel_
Definition: MuScleFitBase.h:46
static std::vector< int > doCrossSectionFit
static double maxMuonEtaSecondRange_
static std::vector< int > parBgrOrder
static double deltaPhiMaxCut_
static std::vector< double > parResolMax
unsigned int loopCounter
Definition: MuScleFit.cc:277
int totalEvents_
Definition: MuScleFit.cc:288
static bool startWithSimplex_
std::string triggerResultsProcess_
Definition: MuScleFit.cc:303
static std::vector< int > doBackgroundFit
static std::vector< double > parResol
static bool debugMassResol_
bool saveAllToTree_
Definition: MuScleFit.cc:306
void checkParameters()
Definition: MuScleFit.cc:1382
static BackgroundHandler * backgroundHandler
static double x[7][10000]
static int debug
static double ResMass[6]
edm::InputTag vertexSrc_
Definition: MuScleFit.cc:310
static double massWindowHalfWidth[3][6]
static bool speedup
static scaleFunctionBase< std::vector< double > > * biasFunction
static std::vector< int > parBgrFix
static std::vector< double > parResolMin
static bool minimumShapePlots_
edm::InputTag simTracksCollection_
Definition: MuScleFit.cc:291
static int MuonTypeForCheckMassWindow
static double minMuonEtaFirstRange_
static int BiasType
std::vector< std::string > triggerPath_
Definition: MuScleFit.cc:304
static std::vector< int > parScaleFix
static bool computeMinosErrors_
static scaleFunctionBase< std::vector< double > > * scaleFunctionForVec
static double maxMuonPt_
static int ScaleFitType
std::string outputRootTreeFileName_
Definition: MuScleFit.cc:298
resolutionFunctionBase< std::vector< double > > * resolutionFunctionVecService(const int identifier)
Service to build the resolution functor corresponding to the passed identifier when receiving a std::...
Definition: Functions.cc:50
bool PATmuons_
Definition: MuScleFit.cc:292
static std::vector< double > parScaleMin
T sqrt(T t)
Definition: SSEVec.h:18
static std::vector< double > parBgr
unsigned int maxLoopNumber
Definition: MuScleFit.cc:276
static int SmearType
std::string genParticlesName_
Definition: MuScleFit.cc:293
int j
Definition: DBlmapReader.cc:9
bool compareToSimTracks_
Definition: MuScleFit.cc:290
static std::vector< double > parScaleStep
static std::vector< int > parResolFix
static std::vector< double > parSmear
void beginOfJobInConstructor()
Definition: MuScleFit.cc:634
smearFunctionBase * smearFunctionService(const int identifier)
Service to build the smearing functor corresponding to the passed identifier.
Definition: Functions.cc:23
static std::vector< int > parResolOrder
static bool sherpa_
std::auto_ptr< MuScleFitMuonSelector > muonSelector_
Definition: MuScleFit.cc:312
bool fastLoop
Definition: MuScleFit.cc:279
tuple G
Definition: callgraph.py:12
static std::vector< double > parScaleMax
scaleFunctionBase< std::vector< double > > * scaleFunctionVecService(const int identifier)
Service to build the scale functor corresponding to the passed identifier when receiving a std::vecto...
Definition: Functions.cc:13
static std::vector< double > parScale
edm::InputTag puInfoSrc_
Definition: MuScleFit.cc:309
static double deltaPhiMinCut_
std::string triggerResultsLabel_
Definition: MuScleFit.cc:302
static bool rapidityBinsForZ_
double minResMass_hwindow[6]
Definition: MuScleFit.cc:271
static int ResolFitType
static int goodmuon
static bool separateRanges_
static double minMuonEtaSecondRange_
static std::vector< double > parCrossSection
static bool normalizeLikelihoodByEventNumber_
std::string inputRootTreeFileName_
Definition: MuScleFit.cc:296
resolutionFunctionBase< double * > * resolutionFunctionService(const int identifier)
Service to build the resolution functor corresponding to the passed identifier.
Definition: Functions.cc:38
int maxEventsFromRootTree_
Definition: MuScleFit.cc:300
double maxResMass_hwindow[6]
Definition: MuScleFit.cc:272
static int MuonType
tuple cout
Definition: gather_cfg.py:145
static double minMuonPt_
static scaleFunctionBase< double * > * scaleFunction
static bool useProbsFile_
static std::vector< int > resfind
static resolutionFunctionBase< std::vector< double > > * resolutionFunctionForVec
static int FitStrategy
static double maxMuonEtaFirstRange_
bool negateTrigger_
Definition: MuScleFit.cc:305
static CrossSectionHandler * crossSectionHandler
static std::vector< double > parResolStep
static std::vector< int > parCrossSectionFix
static resolutionFunctionBase< double * > * resolutionFunction
MuScleFit::~MuScleFit ( )
virtual

Definition at line 599 of file MuScleFit.cc.

References gather_cfg::cout, MuScleFitBase::debug_, MuScleFitBase::genMuonPairs_, inputRootTreeFileName_, MuScleFitBase::muonPairs_, outputRootTreeFileName_, saveAllToTree_, MuScleFitUtils::SavedPair, findQualityFiles::size, MuScleFitUtils::speedup, MuScleFitBase::theMuonType_, totalEvents_, and RootTreeHandler::writeTree().

599  {
600  if (debug_>0) std::cout << "[MuScleFit]: Destructor" << std::endl;
601  std::cout << "Total number of analyzed events = " << totalEvents_ << std::endl;
602 
603  if( !(outputRootTreeFileName_.empty()) ) {
604  // Save the events to a root tree unless we are reading from the edm root file and the SavedPair size is different from the totalEvents_
605  if( !(inputRootTreeFileName_.empty() && (int(MuScleFitUtils::SavedPair.size()) != totalEvents_)) ) {
606  std::cout << "Saving muon pairs to root tree" << std::endl;
607  RootTreeHandler rootTreeHandler;
609  // rootTreeHandler.writeTree(outputRootTreeFileName_, &(MuScleFitUtils::SavedPair), theMuonType_, 0, saveAllToTree_);
610  if (debug_>0) {
611  std::vector<MuonPair>::const_iterator it = muonPairs_.begin();
612  std::cout<<"[MuScleFit::~MuScleFit] (Destructor)"<<std::endl;
613  for (; it<muonPairs_.end();++it){
614  std::cout<<" Debugging pairs that are going to be written to file"<<std::endl;
615  std::cout<<" muon1 = "<<it->mu1<<std::endl;
616  std::cout<<" muon2 = "<<it->mu2<<std::endl;
617  }
618  }
620  }
621  else {
622  // rootTreeHandler.writeTree(outputRootTreeFileName_, &(MuScleFitUtils::SavedPair), theMuonType_, &(MuScleFitUtils::genPair), saveAllToTree_ );
624  }
625  }
626  else {
627  std::cout << "ERROR: events in the vector = " << MuScleFitUtils::SavedPair.size() << " != totalEvents = " << totalEvents_ << std::endl;
628  }
629  }
630 }
std::vector< GenMuonPair > genMuonPairs_
Stores the genMuon pairs and the motherId prior to the creation of the internal tree.
Definition: MuScleFitBase.h:82
int totalEvents_
Definition: MuScleFit.cc:288
bool saveAllToTree_
Definition: MuScleFit.cc:306
static bool speedup
std::string outputRootTreeFileName_
Definition: MuScleFit.cc:298
static std::vector< std::pair< lorentzVector, lorentzVector > > SavedPair
void writeTree(const TString &fileName, const std::vector< MuonPair > *savedPair, const int muonType=0, const std::vector< GenMuonPair > *genPair=0, const bool saveAll=false)
std::string inputRootTreeFileName_
Definition: MuScleFit.cc:296
std::vector< MuonPair > muonPairs_
Used to store the muon pairs plus run and event number prior to the creation of the internal tree...
Definition: MuScleFitBase.h:80
tuple cout
Definition: gather_cfg.py:145
tuple size
Write out results.

Member Function Documentation

void MuScleFit::applyBias ( reco::Particle::LorentzVector mu,
const int  charge 
)
protected

Apply the bias if needed using the function in MuScleFitUtils.

Definition at line 1371 of file MuScleFit.cc.

References MuScleFitUtils::applyBias(), MuScleFitUtils::BiasType, gather_cfg::cout, MuScleFitBase::debug_, and MuScleFitUtils::goodmuon.

Referenced by fillMuonCollection(), and selectMuons().

1372 {
1373  if( MuScleFitUtils::BiasType>0 ) {
1375  if (debug_>0) std::cout << "Muon #" << MuScleFitUtils::goodmuon
1376  << ": after bias Pt = " << mu.Pt() << std::endl;
1377  }
1378 }
static int BiasType
static lorentzVector applyBias(const lorentzVector &muon, const int charge)
const int mu
Definition: Constants.h:22
static int goodmuon
tuple cout
Definition: gather_cfg.py:145
void MuScleFit::applySmearing ( reco::Particle::LorentzVector mu)
protected

Apply the smearing if needed using the function in MuScleFitUtils.

Definition at line 1362 of file MuScleFit.cc.

References MuScleFitUtils::applySmearing(), gather_cfg::cout, MuScleFitBase::debug_, MuScleFitUtils::goodmuon, and MuScleFitUtils::SmearType.

Referenced by fillMuonCollection(), and selectMuons().

1363 {
1364  if( MuScleFitUtils::SmearType>0 ) {
1366  if (debug_>0) std::cout << "Muon #" << MuScleFitUtils::goodmuon
1367  << ": after smearing Pt = " << mu.Pt() << std::endl;
1368  }
1369 }
static int SmearType
const int mu
Definition: Constants.h:22
static int goodmuon
static lorentzVector applySmearing(const lorentzVector &muon)
tuple cout
Definition: gather_cfg.py:145
void MuScleFit::beginOfJobInConstructor ( )

Definition at line 634 of file MuScleFit.cc.

References gather_cfg::cout, MuScleFitPlotter::debug, MuScleFitBase::debug_, i, maxLoopNumber, plotter, MuScleFitBase::readProbabilityDistributionsFromFile(), dtT0Analyzer_cfg::rootFileName, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, MuScleFitBase::theFiles_, MuScleFitBase::theGenInfoRootFileName_, MuScleFitBase::theRootFileName_, and MuScleFitUtils::useProbsFile_.

Referenced by MuScleFit().

637 {
638  if (debug_>0) std::cout << "[MuScleFit]: beginOfJob" << std::endl;
639  //if(maxLoopNumber>1)
642  }
643 
644  if (debug_>0) std::cout << "[MuScleFit]: beginOfJob" << std::endl;
645 
646  // Create the root file
647  // --------------------
648  for (unsigned int i=0; i<(maxLoopNumber); i++) {
649  std::stringstream ss;
650  ss << i;
651  std::string rootFileName = ss.str() + "_" + theRootFileName_;
652  theFiles_.push_back (new TFile(rootFileName.c_str(), "RECREATE"));
653  }
654  if (debug_>0) std::cout << "[MuScleFit]: Root file created" << std::endl;
655 
656  std::cout << "creating plotter" << std::endl;
658  plotter->debug = debug_;
659 }
int i
Definition: DBlmapReader.cc:9
std::string theGenInfoRootFileName_
Definition: MuScleFitBase.h:48
unsigned int maxLoopNumber
Definition: MuScleFit.cc:276
std::string theRootFileName_
Definition: MuScleFitBase.h:47
MuScleFitPlotter * plotter
Definition: MuScleFit.cc:281
std::vector< TFile * > theFiles_
The files were the histograms are saved.
Definition: MuScleFitBase.h:74
tuple cout
Definition: gather_cfg.py:145
static bool useProbsFile_
void readProbabilityDistributionsFromFile()
Read probability distributions from a local root file.
bool MuScleFit::checkDeltaR ( reco::Particle::LorentzVector genMu,
reco::Particle::LorentzVector recMu 
)
protected

Check if two lorentzVector are near in deltaR.

Definition at line 1331 of file MuScleFit.cc.

References gather_cfg::cout, MuScleFitBase::debug_, MuScleFitUtils::deltaPhi(), deltaR(), and mathSSE::sqrt().

Referenced by duringFastLoop().

1331  {
1332  //first is always mu-, second is always mu+
1333  double deltaR = sqrt(MuScleFitUtils::deltaPhi(recMu.Phi(),genMu.Phi()) * MuScleFitUtils::deltaPhi(recMu.Phi(),genMu.Phi()) +
1334  ((recMu.Eta()-genMu.Eta()) * (recMu.Eta()-genMu.Eta())));
1335  if(deltaR<0.01)
1336  return true;
1337  else if( debug_ > 0 ) {
1338  std::cout<<"Reco muon "<<recMu<<" with eta "<<recMu.Eta()<<" and phi "<<recMu.Phi()<<std::endl
1339  <<" DOES NOT MATCH with generated muon from resonance: "<<std::endl
1340  <<genMu<<" with eta "<<genMu.Eta()<<" and phi "<<genMu.Phi()<<std::endl;
1341  }
1342  return false;
1343 }
T sqrt(T t)
Definition: SSEVec.h:18
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
static double deltaPhi(const double &phi1, const double &phi2)
tuple cout
Definition: gather_cfg.py:145
void MuScleFit::checkParameters ( )
protected

Simple method to check parameters consistency. It aborts the job if the parameters are not consistent.

Definition at line 1382 of file MuScleFit.cc.

References MuScleFitUtils::BiasType, gather_cfg::cout, MuScleFitUtils::doBackgroundFit, MuScleFitUtils::doCrossSectionFit, MuScleFitUtils::doResolFit, MuScleFitUtils::doScaleFit, maxLoopNumber, MuScleFitUtils::parBgr, MuScleFitUtils::parBgrFix, MuScleFitUtils::parBgrOrder, MuScleFitUtils::parBias, MuScleFitUtils::parCrossSection, MuScleFitUtils::parCrossSectionFix, MuScleFitUtils::parCrossSectionOrder, MuScleFitUtils::parResol, MuScleFitUtils::parResolFix, MuScleFitUtils::parResolOrder, MuScleFitUtils::parScale, MuScleFitUtils::parScaleFix, MuScleFitUtils::parScaleOrder, MuScleFitUtils::parSmear, MuScleFitUtils::resfind, findQualityFiles::size, and MuScleFitUtils::SmearType.

Referenced by MuScleFit().

1382  {
1383 
1384  // Fits selection dimension check
1386  std::cout << "[MuScleFit-Constructor]: wrong size of resolution fits selector = " << MuScleFitUtils::doResolFit.size() << std::endl;
1387  std::cout << "it must have as many values as the number of loops, which is = " << maxLoopNumber << std::endl;
1388  abort();
1389  }
1391  std::cout << "[MuScleFit-Constructor]: wrong size of scale fits selector = " << MuScleFitUtils::doScaleFit.size() << std::endl;
1392  std::cout << "it must have as many values as the number of loops, which is = " << maxLoopNumber << std::endl;
1393  abort();
1394  }
1396  std::cout << "[MuScleFit-Constructor]: wrong size of cross section fits selector = " << MuScleFitUtils::doCrossSectionFit.size() << std::endl;
1397  std::cout << "it must have as many values as the number of loops, which is = " << maxLoopNumber << std::endl;
1398  abort();
1399  }
1401  std::cout << "[MuScleFit-Constructor]: wrong size of background fits selector = " << MuScleFitUtils::doBackgroundFit.size() << std::endl;
1402  std::cout << "it must have as many values as the number of loops, which is = " << maxLoopNumber << std::endl;
1403  abort();
1404  }
1405 
1406  // Bias parameters: dimension check
1407  // --------------------------------
1408  if ((MuScleFitUtils::BiasType==1 && MuScleFitUtils::parBias.size()!=2) || // linear in pt
1409  (MuScleFitUtils::BiasType==2 && MuScleFitUtils::parBias.size()!=2) || // linear in |eta|
1410  (MuScleFitUtils::BiasType==3 && MuScleFitUtils::parBias.size()!=4) || // sinusoidal in phi
1411  (MuScleFitUtils::BiasType==4 && MuScleFitUtils::parBias.size()!=3) || // linear in pt and |eta|
1412  (MuScleFitUtils::BiasType==5 && MuScleFitUtils::parBias.size()!=3) || // linear in pt and sinusoidal in phi
1413  (MuScleFitUtils::BiasType==6 && MuScleFitUtils::parBias.size()!=3) || // linear in |eta| and sinusoidal in phi
1414  (MuScleFitUtils::BiasType==7 && MuScleFitUtils::parBias.size()!=4) || // linear in pt and |eta| and sinusoidal in phi
1415  (MuScleFitUtils::BiasType==8 && MuScleFitUtils::parBias.size()!=4) || // linear in pt and parabolic in |eta|
1416  (MuScleFitUtils::BiasType==9 && MuScleFitUtils::parBias.size()!=2) || // exponential in pt
1417  (MuScleFitUtils::BiasType==10 && MuScleFitUtils::parBias.size()!=3) || // parabolic in pt
1418  (MuScleFitUtils::BiasType==11 && MuScleFitUtils::parBias.size()!=4) || // linear in pt and sin in phi with chg
1419  (MuScleFitUtils::BiasType==12 && MuScleFitUtils::parBias.size()!=6) || // linear in pt and para in plus sin in phi with chg
1420  (MuScleFitUtils::BiasType==13 && MuScleFitUtils::parBias.size()!=8) || // linear in pt and para in plus sin in phi with chg
1421  MuScleFitUtils::BiasType<0 || MuScleFitUtils::BiasType>13) {
1422  std::cout << "[MuScleFit-Constructor]: Wrong bias type or number of parameters: aborting!" << std::endl;
1423  abort();
1424  }
1425  // Smear parameters: dimension check
1426  // ---------------------------------
1434  MuScleFitUtils::SmearType<0 || MuScleFitUtils::SmearType>7) {
1435  std::cout << "[MuScleFit-Constructor]: Wrong smear type or number of parameters: aborting!" << std::endl;
1436  abort();
1437  }
1438  // Protect against bad size of parameters
1439  // --------------------------------------
1442  std::cout << "[MuScleFit-Constructor]: Mismatch in number of parameters for Resol: aborting!" << std::endl;
1443  abort();
1444  }
1447  std::cout << "[MuScleFit-Constructor]: Mismatch in number of parameters for Scale: aborting!" << std::endl;
1448  abort();
1449  }
1452  std::cout << "[MuScleFit-Constructor]: Mismatch in number of parameters for Bgr: aborting!" << std::endl;
1453  abort();
1454  }
1457  std::cout << "[MuScleFit-Constructor]: Mismatch in number of parameters for Bgr: aborting!" << std::endl;
1458  abort();
1459  }
1460 
1461  // Protect against an incorrect number of resonances
1462  // -------------------------------------------------
1463  if (MuScleFitUtils::resfind.size()!=6) {
1464  std::cout << "[MuScleFit-Constructor]: resfind must have 6 elements (1 Z, 3 Y, 2 Psi): aborting!" << std::endl;
1465  abort();
1466  }
1467 }
static std::vector< int > doScaleFit
static std::vector< int > doResolFit
static std::vector< double > parBias
static std::vector< int > parCrossSectionOrder
static std::vector< int > parScaleOrder
static std::vector< int > doCrossSectionFit
static std::vector< int > parBgrOrder
static std::vector< int > doBackgroundFit
static std::vector< double > parResol
static std::vector< int > parBgrFix
static int BiasType
static std::vector< int > parScaleFix
static std::vector< double > parBgr
unsigned int maxLoopNumber
Definition: MuScleFit.cc:276
static int SmearType
static std::vector< int > parResolFix
static std::vector< double > parSmear
static std::vector< int > parResolOrder
static std::vector< double > parScale
static std::vector< double > parCrossSection
tuple cout
Definition: gather_cfg.py:145
static std::vector< int > resfind
tuple size
Write out results.
static std::vector< int > parCrossSectionFix
void MuScleFit::duringFastLoop ( )
virtual

This method performs all needed operations on the muon pair. It reads the muons from SavedPair and uses the iev counter to keep track of the event number. The iev is incremented internally and reset to 0 in startingNewLoop.

Definition at line 1074 of file MuScleFit.cc.

References CrossSectionHandler::addParameters(), MuScleFitUtils::applyScale(), checkDeltaR(), compareToSimTracks_, MuScleFitUtils::computeWeight(), gather_cfg::cout, MuScleFitUtils::crossSectionHandler, MuScleFitBase::debug_, MuScleFitUtils::debugMassResol_, MuScleFitUtils::doScaleFit, fillComparisonHistograms(), plotBeamSpotDB::first, MuScleFitUtils::genPair, i, iev, MuScleFitUtils::iev_, dqm-mbProfile::log, loopCounter, MuScleFitBase::mapHisto_, MuScleFitUtils::massProb(), MuScleFitUtils::massResolComponents, MuScleFitUtils::massResolution(), MuScleFitUtils::parBgr, MuScleFitUtils::parCrossSection, MuScleFitUtils::parResol, MuScleFitUtils::parScale, MuScleFitUtils::parvalue, funct::pow(), recMu1, recMu2, MuScleFitUtils::ResFound, MuScleFitUtils::resolutionFunctionForVec, MuScleFitUtils::SavedPair, edm::second(), MuScleFitUtils::simPair, findQualityFiles::size, MuScleFitUtils::speedup, and puppiForMET_cff::weight.

Referenced by duringLoop(), and endOfLoop().

1075 {
1076  // On loops>0 the two muons are directly obtained from the SavedMuon array
1077  // -----------------------------------------------------------------------
1078  MuScleFitUtils::ResFound = false;
1080  recMu2 = (MuScleFitUtils::SavedPair[iev].second);
1081 
1082  //std::cout << "iev = " << iev << ", recMu1 pt = " << recMu1.Pt() << ", recMu2 pt = " << recMu2.Pt() << std::endl;
1083 
1084  if (recMu1.Pt()>0 && recMu2.Pt()>0) {
1085  MuScleFitUtils::ResFound = true;
1086  if (debug_>0) std::cout << "Ev = " << iev << ": found muons in tree with Pt = "
1087  << recMu1.Pt() << " " << recMu2.Pt() << std::endl;
1088  }
1089 
1090  if( debug_>0 ) std::cout << "About to start lik par correction and histo filling; ResFound is "
1091  << MuScleFitUtils::ResFound << std::endl;
1092  // If resonance found, do the hard work
1093  // ------------------------------------
1094  if( MuScleFitUtils::ResFound ) {
1095 
1096  // Find weight and reference mass for this muon pair
1097  // -------------------------------------------------
1098  // The last parameter = true means that we want to use always the background window to compute the weight,
1099  // otherwise the probability will be filled only for the resonance region.
1100  double weight = MuScleFitUtils::computeWeight( (recMu1+recMu2).mass(), iev, true );
1101  if (debug_>0) {
1102  std::cout << "Loop #" << loopCounter << "Event #" << iev << ": before correction Pt1 = "
1103  << recMu1.Pt() << " Pt2 = " << recMu2.Pt() << std::endl;
1104  }
1105  // For successive iterations, correct the muons only if the previous iteration was a scale fit.
1106  // --------------------------------------------------------------------------------------------
1107  if ( loopCounter>0 ) {
1111  }
1112  }
1113  if (debug_>0) {
1114  std::cout << "Loop #" << loopCounter << "Event #" << iev << ": after correction Pt1 = "
1115  << recMu1.Pt() << " Pt2 = " << recMu2.Pt() << std::endl;
1116  }
1117 
1119 
1120  //Fill histograms
1121  //------------------
1122 
1123  mapHisto_["hRecBestMu"]->Fill(recMu1, -1,weight);
1124  mapHisto_["hRecBestMuVSEta"]->Fill(recMu1);
1125  mapHisto_["hRecBestMu"]->Fill(recMu2, +1,weight);
1126  mapHisto_["hRecBestMuVSEta"]->Fill(recMu2);
1127  mapHisto_["hDeltaRecBestMu"]->Fill(recMu1, recMu2);
1128  // Reconstructed resonance
1129  mapHisto_["hRecBestRes"]->Fill(bestRecRes,+1, weight);
1130  mapHisto_["hRecBestResAllEvents"]->Fill(bestRecRes,+1, 1.);
1131 // // Fill histogram of Res mass vs muon variables
1132 // mapHisto_["hRecBestResVSMu"]->Fill (recMu1, bestRecRes, -1);
1133 // mapHisto_["hRecBestResVSMu"]->Fill (recMu2, bestRecRes, +1);
1134 // // Fill also the mass mu+/mu- comparisons
1135 // mapHisto_["hRecBestResVSMu"]->Fill(recMu1, recMu2, bestRecRes);
1136 
1137  mapHisto_["hRecBestResVSMu"]->Fill (recMu1, bestRecRes, -1, weight);
1138  mapHisto_["hRecBestResVSMu"]->Fill (recMu2, bestRecRes, +1, weight);
1139  // Fill also the mass mu+/mu- comparisons
1140  mapHisto_["hRecBestResVSMu"]->Fill(recMu1, recMu2, bestRecRes, weight);
1141 
1142  //-- rc 2010 filling histograms for mu+ /mu- ------
1143  // mapHisto_["hRecBestResVSMuMinus"]->Fill (recMu1, bestRecRes, -1);
1144  // mapHisto_["hRecBestResVSMuPlus"]->Fill (recMu2, bestRecRes, +1);
1145 
1146  //-- rc 2010 filling histograms MassVsMuEtaPhi------
1147  // mapHisto_["hRecBestResVSMuEtaPhi"]->Fill (recMu1, bestRecRes,-1);
1148  // mapHisto_["hRecBestResVSMuEtaPhi"]->Fill (recMu2, bestRecRes,+1);
1149 
1150  // Fill histogram of Res mass vs Res variables
1151  // mapHisto_["hRecBestResVSRes"]->Fill (bestRecRes, bestRecRes, +1);
1152  mapHisto_["hRecBestResVSRes"]->Fill (bestRecRes, bestRecRes, +1, weight);
1153 
1154 
1155 
1156 
1157 
1158 
1159  std::vector<double> * parval;
1160  std::vector<double> initpar;
1161  // Store a pointer to the vector of parameters of the last iteration, or the initial
1162  // parameters if this is the first iteration
1163  if (loopCounter==0) {
1164  initpar = MuScleFitUtils::parResol;
1165  initpar.insert( initpar.end(), MuScleFitUtils::parScale.begin(), MuScleFitUtils::parScale.end() );
1166  initpar.insert( initpar.end(), MuScleFitUtils::parCrossSection.begin(), MuScleFitUtils::parCrossSection.end() );
1167  initpar.insert( initpar.end(), MuScleFitUtils::parBgr.begin(), MuScleFitUtils::parBgr.end() );
1168  parval = &initpar;
1169  } else {
1170  parval = &(MuScleFitUtils::parvalue[loopCounter-1]);
1171  }
1172 
1173  //Compute pt resolution w.r.t generated and simulated muons
1174  //--------------------------------------------------------
1175  if( !MuScleFitUtils::speedup ) {
1176 
1177  //first is always mu-, second is always mu+
1180  }
1183  }
1184  if( compareToSimTracks_ ) {
1185  //first is always mu-, second is always mu+
1188  }
1191  }
1192  }
1193  }
1194 
1195  // ATTENTION: this was done only when a matching was found. Moved it outside because, genInfo or not, we still want to see the resolution function
1196  // Fill also the resolution histogramsm using the resolution functions:
1197  // the parameters are those from the last iteration, as the muons up to this point have also the corrections from the same iteration.
1198  // Need to use a different array (ForVec), containing functors able to operate on std::vector<double>
1199  mapHisto_["hFunctionResolPt"]->Fill( recMu1, MuScleFitUtils::resolutionFunctionForVec->sigmaPt(recMu1.Pt(), recMu1.Eta(), *parval ), -1 );
1200  mapHisto_["hFunctionResolCotgTheta"]->Fill( recMu1, MuScleFitUtils::resolutionFunctionForVec->sigmaCotgTh(recMu1.Pt(), recMu1.Eta(), *parval ), -1 );
1201  mapHisto_["hFunctionResolPhi"]->Fill( recMu1, MuScleFitUtils::resolutionFunctionForVec->sigmaPhi(recMu1.Pt(), recMu1.Eta(), *parval ), -1 );
1202  mapHisto_["hFunctionResolPt"]->Fill( recMu2, MuScleFitUtils::resolutionFunctionForVec->sigmaPt(recMu2.Pt(), recMu2.Eta(), *parval ), +1 );
1203  mapHisto_["hFunctionResolCotgTheta"]->Fill( recMu2, MuScleFitUtils::resolutionFunctionForVec->sigmaCotgTh(recMu2.Pt(), recMu2.Eta(), *parval ), +1 );
1204  mapHisto_["hFunctionResolPhi"]->Fill( recMu2, MuScleFitUtils::resolutionFunctionForVec->sigmaPhi(recMu2.Pt(), recMu2.Eta(), *parval ), +1 );
1205 
1206  // Compute likelihood histograms
1207  // -----------------------------
1208  if( debug_ > 0 ) std::cout << "mass = " << bestRecRes.mass() << std::endl;
1209  if (weight!=0.) {
1210  double massResol;
1211  double prob;
1212  double deltalike;
1213  if (loopCounter==0) {
1214  std::vector<double> initpar;
1215  for (int i=0; i<(int)(MuScleFitUtils::parResol.size()); i++) {
1216  initpar.push_back(MuScleFitUtils::parResol[i]);
1217  }
1218  for (int i=0; i<(int)(MuScleFitUtils::parScale.size()); i++) {
1219  initpar.push_back(MuScleFitUtils::parScale[i]);
1220  }
1221 // for (int i=0; i<(int)(MuScleFitUtils::parCrossSection.size()); i++) {
1222 // initpar.push_back(MuScleFitUtils::parCrossSection[i]);
1223 // }
1225 
1226  for (int i=0; i<(int)(MuScleFitUtils::parBgr.size()); i++) {
1227  initpar.push_back(MuScleFitUtils::parBgr[i]);
1228  }
1229  massResol = MuScleFitUtils::massResolution( recMu1, recMu2, initpar );
1230  // prob = MuScleFitUtils::massProb( bestRecRes.mass(), bestRecRes.Eta(), bestRecRes.Rapidity(), massResol, initpar, true );
1231  prob = MuScleFitUtils::massProb( bestRecRes.mass(), bestRecRes.Eta(), bestRecRes.Rapidity(), massResol,
1232  initpar, true, recMu1.eta(), recMu2.eta() );
1233  } else {
1236  // prob = MuScleFitUtils::massProb( bestRecRes.mass(), bestRecRes.Eta(), bestRecRes.Rapidity(),
1237  // massResol, MuScleFitUtils::parvalue[loopCounter-1], true );
1238  prob = MuScleFitUtils::massProb( bestRecRes.mass(), bestRecRes.Eta(), bestRecRes.Rapidity(),
1239  massResol, MuScleFitUtils::parvalue[loopCounter-1], true,
1240  recMu1.eta(), recMu2.eta() );
1241  }
1242  if( debug_ > 0 ) std::cout << "inside weight: mass = " << bestRecRes.mass() << ", prob = " << prob << std::endl;
1243  if (prob>0) {
1244  if( debug_ > 0 ) std::cout << "inside prob: mass = " << bestRecRes.mass() << ", prob = " << prob << std::endl;
1245 
1246  deltalike = log(prob)*weight; // NB maximum likelihood --> deltalike is maximized
1247  mapHisto_["hLikeVSMu"]->Fill(recMu1, deltalike);
1248  mapHisto_["hLikeVSMu"]->Fill(recMu2, deltalike);
1249  mapHisto_["hLikeVSMuMinus"]->Fill(recMu1, deltalike);
1250  mapHisto_["hLikeVSMuPlus"]->Fill(recMu2, deltalike);
1251 
1252  double recoMass = (recMu1+recMu2).mass();
1253  if( recoMass != 0 ) {
1254  // IMPORTANT: massResol is not a relative resolution
1255  mapHisto_["hResolMassVSMu"]->Fill(recMu1, massResol, -1);
1256  mapHisto_["hResolMassVSMu"]->Fill(recMu2, massResol, +1);
1257  mapHisto_["hFunctionResolMassVSMu"]->Fill(recMu1, massResol/recoMass, -1);
1258  mapHisto_["hFunctionResolMassVSMu"]->Fill(recMu2, massResol/recoMass, +1);
1259  }
1260 
1262  mapHisto_["hdMdPt1"]->Fill(recMu1, MuScleFitUtils::massResolComponents.dmdpt1, -1);
1263  mapHisto_["hdMdPt2"]->Fill(recMu2, MuScleFitUtils::massResolComponents.dmdpt2, +1);
1264  mapHisto_["hdMdPhi1"]->Fill(recMu1, MuScleFitUtils::massResolComponents.dmdphi1, -1);
1265  mapHisto_["hdMdPhi2"]->Fill(recMu2, MuScleFitUtils::massResolComponents.dmdphi2, +1);
1266  mapHisto_["hdMdCotgTh1"]->Fill(recMu1, MuScleFitUtils::massResolComponents.dmdcotgth1, -1);
1267  mapHisto_["hdMdCotgTh2"]->Fill(recMu2, MuScleFitUtils::massResolComponents.dmdcotgth2, +1);
1268  }
1269 
1270  if( !MuScleFitUtils::speedup ) {
1271  double genMass = (MuScleFitUtils::genPair[iev].first + MuScleFitUtils::genPair[iev].second).mass();
1272  // Fill the mass resolution (computed from MC), we use the covariance class to compute the variance
1273  if( genMass != 0 ) {
1274  mapHisto_["hGenResVSMu"]->Fill((MuScleFitUtils::genPair[iev].first), (MuScleFitUtils::genPair[iev].first + MuScleFitUtils::genPair[iev].second), -1);
1275  mapHisto_["hGenResVSMu"]->Fill((MuScleFitUtils::genPair[iev].second), (MuScleFitUtils::genPair[iev].first + MuScleFitUtils::genPair[iev].second), +1);
1276  double diffMass = (recoMass - genMass)/genMass;
1277  // double diffMass = recoMass - genMass;
1278  // Fill if for both muons
1279  double pt1 = recMu1.pt();
1280  double eta1 = recMu1.eta();
1281  double pt2 = recMu2.pt();
1282  double eta2 = recMu2.eta();
1283  // This is to avoid nan
1284  if( diffMass == diffMass ) {
1285  // Mass relative difference vs Pt and Eta. To be used to extract the true mass resolution
1286  mapHisto_["hDeltaMassOverGenMassVsPt"]->Fill(pt1, diffMass);
1287  mapHisto_["hDeltaMassOverGenMassVsPt"]->Fill(pt2, diffMass);
1288  mapHisto_["hDeltaMassOverGenMassVsEta"]->Fill(eta1, diffMass);
1289  mapHisto_["hDeltaMassOverGenMassVsEta"]->Fill(eta2, diffMass);
1290  // This is used for the covariance comparison
1291  mapHisto_["hMassResolutionVsPtEta"]->Fill(pt1, eta1, diffMass, diffMass);
1292  mapHisto_["hMassResolutionVsPtEta"]->Fill(pt2, eta2, diffMass, diffMass);
1293  }
1294  else {
1295  std::cout << "Error, there is a nan: recoMass = " << recoMass << ", genMass = " << genMass << std::endl;
1296  }
1297  }
1298  // Fill with mass resolution from resolution function
1300  mapHisto_["hFunctionResolMass"]->Fill( recMu1, std::pow(massRes,2), -1 );
1301  mapHisto_["hFunctionResolMass"]->Fill( recMu2, std::pow(massRes,2), +1 );
1302  }
1303 
1304  mapHisto_["hMass_P"]->Fill(bestRecRes.mass(), prob);
1305  if( debug_ > 0 ) std::cout << "mass = " << bestRecRes.mass() << ", prob = " << prob << std::endl;
1306  mapHisto_["hMass_fine_P"]->Fill(bestRecRes.mass(), prob);
1307 
1308  mapHisto_["hMassProbVsRes"]->Fill(bestRecRes, bestRecRes, +1, prob);
1309  mapHisto_["hMassProbVsMu"]->Fill(recMu1, bestRecRes, -1, prob);
1310  mapHisto_["hMassProbVsMu"]->Fill(recMu2, bestRecRes, +1, prob);
1311  mapHisto_["hMassProbVsRes_fine"]->Fill(bestRecRes, bestRecRes, +1, prob);
1312  mapHisto_["hMassProbVsMu_fine"]->Fill(recMu1, bestRecRes, -1, prob);
1313  mapHisto_["hMassProbVsMu_fine"]->Fill(recMu2, bestRecRes, +1, prob);
1314  }
1315  }
1316  } // end if ResFound
1317 
1318  // Fill the pair
1319  // -------------
1320  if (loopCounter>0) {
1321  if (debug_>0) std::cout << "[MuScleFit]: filling the pair" << std::endl;
1322  MuScleFitUtils::SavedPair[iev] = std::make_pair( recMu1, recMu2 );
1323  }
1324 
1325  iev++;
1327 
1328  // return kContinue;
1329 }
static std::vector< std::pair< lorentzVector, lorentzVector > > simPair
static std::vector< int > doScaleFit
int i
Definition: DBlmapReader.cc:9
unsigned int loopCounter
Definition: MuScleFit.cc:277
static std::vector< double > parResol
static bool debugMassResol_
static bool speedup
std::map< std::string, Histograms * > mapHisto_
The map of histograms.
Definition: MuScleFitBase.h:77
static bool ResFound
static double massProb(const double &mass, const double &rapidity, const int ires, const double &massResol)
void fillComparisonHistograms(const reco::Particle::LorentzVector &genMu, const reco::Particle::LorentzVector &recoMu, const std::string &inputName, const int charge)
Fill the reco vs gen and reco vs sim comparison histograms.
Definition: MuScleFit.cc:1345
static struct MuScleFitUtils::massResolComponentsStruct massResolComponents
static std::vector< std::vector< double > > parvalue
U second(std::pair< T, U > const &p)
static std::vector< std::pair< lorentzVector, lorentzVector > > genPair
static double massResolution(const lorentzVector &mu1, const lorentzVector &mu2)
reco::Particle::LorentzVector recMu2
Definition: MuScleFit.cc:285
reco::Particle::LorentzVector recMu1
Definition: MuScleFit.cc:285
static std::vector< double > parBgr
bool compareToSimTracks_
Definition: MuScleFit.cc:290
static double computeWeight(const double &mass, const int iev, const bool doUseBkgrWindow=false)
static std::vector< std::pair< lorentzVector, lorentzVector > > SavedPair
static lorentzVector applyScale(const lorentzVector &muon, const std::vector< double > &parval, const int charge)
static std::vector< double > parScale
static int iev_
static std::vector< double > parCrossSection
bool checkDeltaR(reco::Particle::LorentzVector &genMu, reco::Particle::LorentzVector &recMu)
Check if two lorentzVector are near in deltaR.
Definition: MuScleFit.cc:1331
tuple cout
Definition: gather_cfg.py:145
static resolutionFunctionBase< std::vector< double > > * resolutionFunctionForVec
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
static CrossSectionHandler * crossSectionHandler
void addParameters(std::vector< double > &initpar)
Inputs the vars in a vector.
edm::EDLooper::Status MuScleFit::duringLoop ( const edm::Event ,
const edm::EventSetup  
)
overridevirtual

Called after all event modules have had a chance to process the edm::Event.

Implements edm::EDLooper.

Definition at line 779 of file MuScleFit.cc.

References gather_cfg::cout, MuScleFitBase::debug_, duringFastLoop(), fastLoop, edm::Event::getRun(), HltComparatorCreateWorkflow::hltConfig, i, HLTConfigProvider::init(), inputRootTreeFileName_, edm::EDLooperBase::kContinue, loopCounter, negateTrigger_, selectMuons(), edm::TriggerNames::size(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, totalEvents_, HLTConfigProvider::triggerIndex(), edm::TriggerNames::triggerName(), edm::TriggerNames::triggerNames(), triggerPath_, triggerResults, triggerResultsLabel_, and triggerResultsProcess_.

780 {
782  event.getByLabel(edm::InputTag(triggerResultsLabel_.c_str(), "", triggerResultsProcess_.c_str()), triggerResults);
783  //event.getByLabel(InputTag(triggerResultsLabel_),triggerResults);
784  bool isFired = false;
785 
786  if(triggerPath_[0] == "")
787  isFired = true;
788  else if(triggerPath_[0] == "All"){
789  isFired =triggerResults->accept();
790  if(debug_>0)
791  std::cout<<"Trigger "<<isFired<<std::endl;
792  }
793  else{
794  bool changed;
796  hltConfig.init(event.getRun(), eventSetup, triggerResultsProcess_, changed);
797 
798 
799  const edm::TriggerNames triggerNames = event.triggerNames(*triggerResults);
800 
801  for (unsigned i=0; i<triggerNames.size(); i++) {
802  std::string hltName = triggerNames.triggerName(i);
803 
804  // match the path in the pset with the true name of the trigger
805  for ( unsigned int ipath=0; ipath<triggerPath_.size(); ipath++ ) {
806  if ( hltName.find(triggerPath_[ipath]) != std::string::npos ) {
807  unsigned int triggerIndex( hltConfig.triggerIndex(hltName) );
808 
809  // triggerIndex must be less than the size of HLTR or you get a CMSException: _M_range_check
810  if (triggerIndex < triggerResults->size()) {
811  isFired = triggerResults->accept(triggerIndex);
812  if(debug_>0)
813  std::cout << triggerPath_[ipath] <<" "<< hltName << " " << isFired<<std::endl;
814  }
815  } // end if (matching the path in the pset with the true trigger name
816  }
817  }
818 
819  }
820 
821  if( negateTrigger_ && isFired ) return kContinue;
822  else if( !(negateTrigger_) && !isFired ) return kContinue;
823 
824 #ifdef USE_CALLGRIND
825  CALLGRIND_START_INSTRUMENTATION;
826 #endif
827 
828  if (debug_>0) {
829  std::cout << "[MuScleFit-duringLoop]: loopCounter = " << loopCounter
830  << " Run: " << event.id().run() << " Event: " << event.id().event() << std::endl;
831  }
832 
833  // On the first iteration we read the bank, otherwise we fetch the information from the muon tree
834  // ------------------------------------ Important Note --------------------------------------- //
835  // The fillMuonCollection method applies any smearing or bias to the muons, so we NEVER use
836  // unbiased muons.
837  // ----------------------------------------------------------------------------------------------
838  if( loopCounter == 0 ) {
839 
840  if( !fastLoop || inputRootTreeFileName_.empty() ) {
841  if( debug_ > 0 ) std::cout << "Reading from edm event" << std::endl;
843  duringFastLoop();
844  ++totalEvents_;
845  }
846  }
847 
848  return kContinue;
849 
850 #ifdef USE_CALLGRIND
851  CALLGRIND_STOP_INSTRUMENTATION;
852  CALLGRIND_DUMP_STATS;
853 #endif
854 }
int i
Definition: DBlmapReader.cc:9
void selectMuons(const edm::Event &event)
Definition: MuScleFit.cc:856
unsigned int loopCounter
Definition: MuScleFit.cc:277
int totalEvents_
Definition: MuScleFit.cc:288
std::string triggerResultsProcess_
Definition: MuScleFit.cc:303
virtual void duringFastLoop()
Definition: MuScleFit.cc:1074
Strings::size_type size() const
Definition: TriggerNames.cc:39
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
std::vector< std::string > triggerPath_
Definition: MuScleFit.cc:304
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
static std::string const triggerResults
Definition: EdmProvDump.cc:41
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool fastLoop
Definition: MuScleFit.cc:279
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::string triggerResultsLabel_
Definition: MuScleFit.cc:302
std::string inputRootTreeFileName_
Definition: MuScleFit.cc:296
tuple cout
Definition: gather_cfg.py:145
tuple size
Write out results.
bool negateTrigger_
Definition: MuScleFit.cc:305
void MuScleFit::endOfFastLoop ( const unsigned int  iLoop)
virtual

Definition at line 743 of file MuScleFit.cc.

References MuScleFitBase::clearHistoMap(), gather_cfg::cout, loopCounter, MuScleFitUtils::minimizeLikelihood(), plotter, MuScleFitBase::theFiles_, and MuScleFitBase::writeHistoMap().

Referenced by endOfLoop().

744 {
745  // std::cout<< "Inside endOfFastLoop, iLoop = " << iLoop << " and loopCounter = " << loopCounter << std::endl;
746 
747  if( loopCounter == 0 ) {
748  // plotter->writeHistoMap();
749  // The destructor will call the writeHistoMap after the cd to the output file
750  delete plotter;
751  }
752 
753  std::cout << "Ending loop # " << iLoop << std::endl;
754 
755  // Write the histos to file
756  // ------------------------
757  // theFiles_[iLoop]->cd();
758  writeHistoMap(iLoop);
759 
760  // Likelihood minimization to compute corrections
761  // ----------------------------------------------
762  // theFiles_[iLoop]->cd();
763  TDirectory * likelihoodDir = theFiles_[iLoop]->mkdir("likelihood");
764  likelihoodDir->cd();
766 
767  // ATTENTION, this was put BEFORE the minimizeLikelihood. Check for problems.
768  theFiles_[iLoop]->Close();
769  // ATTENTION: Check that this delete does not give any problem
770  delete theFiles_[iLoop];
771 
772  // Clear the histos
773  // ----------------
774  clearHistoMap();
775 }
static void minimizeLikelihood()
unsigned int loopCounter
Definition: MuScleFit.cc:277
void clearHistoMap()
Clean the histograms map.
void writeHistoMap(const unsigned int iLoop)
Save the histograms map to file.
MuScleFitPlotter * plotter
Definition: MuScleFit.cc:281
std::vector< TFile * > theFiles_
The files were the histograms are saved.
Definition: MuScleFitBase.h:74
tuple cout
Definition: gather_cfg.py:145
void MuScleFit::endOfJob ( )
overridevirtual

Reimplemented from edm::EDLooperBase.

Definition at line 663 of file MuScleFit.cc.

References gather_cfg::cout, and MuScleFitBase::debug_.

663  {
664  if (debug_>0) std::cout << "[MuScleFit]: endOfJob" << std::endl;
665 }
tuple cout
Definition: gather_cfg.py:145
edm::EDLooper::Status MuScleFit::endOfLoop ( const edm::EventSetup ,
unsigned int  iCounter 
)
overridevirtual

Called after the system has finished one loop over the events. Thar argument is a count of how many loops have been processed before this loo. For the first time through the events the argument will be 0.

Implements edm::EDLooperBase.

Definition at line 696 of file MuScleFit.cc.

References gather_cfg::cout, duringFastLoop(), endOfFastLoop(), fastLoop, iev, inputRootTreeFileName_, edm::EDLooperBase::kContinue, edm::EDLooperBase::kStop, maxEventsFromRootTree_, maxLoopNumber, MuScleFitUtils::SavedPair, selectMuons(), startingNewLoop(), and totalEvents_.

697 {
698  unsigned int iFastLoop = 1;
699 
700  // Read the events from the root tree if requested
701  if( !(inputRootTreeFileName_.empty()) ) {
703  // When reading from local file all the loops are done here
705  iFastLoop = 0;
706  }
707  else {
708  endOfFastLoop(iLoop);
709  }
710 
711  // If a fastLoop is required we do all the remaining iterations here
712  if( fastLoop == true ) {
713  for( ; iFastLoop<maxLoopNumber; ++iFastLoop ) {
714 
715  std::cout << "Starting fast loop number " << iFastLoop << std::endl;
716 
717  // In the first loop is called by the framework
718  // if( iFastLoop > 0 ) {
719  startingNewLoop(iFastLoop);
720  // }
721 
722  // std::vector<std::pair<lorentzVector,lorentzVector> >::const_iterator it = MuScleFitUtils::SavedPair.begin();
723  // for( ; it != SavedPair.end(); ++it ) {
724  while( iev<totalEvents_ ) {
725  if( iev%50000 == 0 ) {
726  std::cout << "Fast looping on event number " << iev << std::endl;
727  }
728  // This reads muons from SavedPair using iev to keep track of the event
729  duringFastLoop();
730  }
731  std::cout << "End of fast loop number " << iFastLoop << ". Ran on " << iev << " events" << std::endl;
732  endOfFastLoop(iFastLoop);
733  }
734  }
735 
736  if (iFastLoop>=maxLoopNumber-1) {
737  return kStop;
738  } else {
739  return kContinue;
740  }
741 }
void selectMuons(const edm::Event &event)
Definition: MuScleFit.cc:856
int totalEvents_
Definition: MuScleFit.cc:288
virtual void duringFastLoop()
Definition: MuScleFit.cc:1074
virtual void startingNewLoop(unsigned int iLoop) override
Definition: MuScleFit.cc:669
unsigned int maxLoopNumber
Definition: MuScleFit.cc:276
static std::vector< std::pair< lorentzVector, lorentzVector > > SavedPair
bool fastLoop
Definition: MuScleFit.cc:279
std::string inputRootTreeFileName_
Definition: MuScleFit.cc:296
int maxEventsFromRootTree_
Definition: MuScleFit.cc:300
tuple cout
Definition: gather_cfg.py:145
virtual void endOfFastLoop(const unsigned int iLoop)
Definition: MuScleFit.cc:743
void MuScleFit::fillComparisonHistograms ( const reco::Particle::LorentzVector genMu,
const reco::Particle::LorentzVector recoMu,
const std::string &  inputName,
const int  charge 
)
protected

Fill the reco vs gen and reco vs sim comparison histograms.

Definition at line 1345 of file MuScleFit.cc.

References RecoTauCleanerPlugins::charge, funct::cos(), MuScleFitUtils::deltaPhiNoFabs(), MuScleFitBase::mapHisto_, mergeVDriftHistosByStation::name, funct::sin(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by duringFastLoop().

1347 {
1348  std::string name(inputName + "VSMu");
1349  mapHisto_["hResolPt"+name]->Fill(recMu, (-genMu.Pt()+recMu.Pt())/genMu.Pt(), charge);
1350  mapHisto_["hResolTheta"+name]->Fill(recMu, (-genMu.Theta()+recMu.Theta()), charge);
1351  mapHisto_["hResolCotgTheta"+name]->Fill(recMu,(-cos(genMu.Theta())/sin(genMu.Theta())
1352  +cos(recMu.Theta())/sin(recMu.Theta())), charge);
1353  mapHisto_["hResolEta"+name]->Fill(recMu, (-genMu.Eta()+recMu.Eta()),charge);
1354  mapHisto_["hResolPhi"+name]->Fill(recMu, MuScleFitUtils::deltaPhiNoFabs(recMu.Phi(), genMu.Phi()), charge);
1355 
1356  // Fill only if it was matched to a genMu and this muon is valid
1357  if( (genMu.Pt() != 0) && (recMu.Pt() != 0) ) {
1358  mapHisto_["hPtRecoVsPt"+inputName]->Fill(genMu.Pt(), recMu.Pt());
1359  }
1360 }
static double deltaPhiNoFabs(const double &phi1, const double &phi2)
Without fabs at the end, used to have a symmetric distribution for the resolution fits and variance c...
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::map< std::string, Histograms * > mapHisto_
The map of histograms.
Definition: MuScleFitBase.h:77
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
template<typename T >
std::vector< MuScleFitMuon > MuScleFit::fillMuonCollection ( const std::vector< T > &  tracks)

Definition at line 316 of file MuScleFit.cc.

References applyBias(), applySmearing(), gather_cfg::cout, MuScleFitBase::debug_, MuScleFitUtils::goodmuon, MuScleFitUtils::mMu2, RPCpg::mu, metsig::muon, patZpeak::muons, and mathSSE::sqrt().

317 {
318  std::vector<MuScleFitMuon> muons;
319  typename std::vector<T>::const_iterator track;
320  for( track = tracks.begin(); track != tracks.end(); ++track ) {
322  mu = reco::Particle::LorentzVector(track->px(),track->py(),track->pz(),
323  sqrt(track->p()*track->p() + MuScleFitUtils::mMu2));
324  // Apply smearing if needed, and then bias
325  // ---------------------------------------
327  if (debug_>0)
328  std::cout <<std::setprecision(9)<< "Muon #" << MuScleFitUtils::goodmuon
329  << ": initial value Pt = " << mu.Pt() << std::endl;
330 
331  applySmearing(mu);
332  applyBias(mu, track->charge());
333  if (debug_>0) std::cout<<"track charge: "<<track->charge()<<std::endl;
334 
335  Double_t hitsTk = track->innerTrack()->hitPattern().numberOfValidTrackerHits();
336  Double_t hitsMuon = track->innerTrack()->hitPattern().numberOfValidMuonHits();
337  Double_t ptError = track->innerTrack()->ptError();
338  MuScleFitMuon muon(mu,track->charge(),ptError,hitsTk,hitsMuon,false);
339  if (debug_>0) {
340  std::cout<<"[MuScleFit::fillMuonCollection]"<<std::endl;
341  std::cout<<" muon = "<<muon<<std::endl;
342  }
343 
344  // Store modified muon
345  // -------------------
346  muons.push_back (muon);
347  }
348  return muons;
349 }
T sqrt(T t)
Definition: SSEVec.h:18
const int mu
Definition: Constants.h:22
void applySmearing(reco::Particle::LorentzVector &mu)
Apply the smearing if needed using the function in MuScleFitUtils.
Definition: MuScleFit.cc:1362
tuple tracks
Definition: testEve_cfg.py:39
static int goodmuon
static const double mMu2
tuple muons
Definition: patZpeak.py:38
tuple cout
Definition: gather_cfg.py:145
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
void applyBias(reco::Particle::LorentzVector &mu, const int charge)
Apply the bias if needed using the function in MuScleFitUtils.
Definition: MuScleFit.cc:1371
void MuScleFit::selectMuons ( const edm::Event event)
protected

Selects the muon pairs and fills the SavedPair and (if needed) the genPair vector. This version reads the events from the edm root file and performs a selection of the muons according to the parameters in the cfg.

Definition at line 856 of file MuScleFit.cc.

References rpcdqm::BX, gather_cfg::cout, MuScleFitBase::debug_, MuScleFitUtils::findBestRecoRes(), plotBeamSpotDB::first, MuScleFitBase::genMuonPairs_, MuScleFitUtils::genPair, edm::HandleBase::isValid(), MuScleFitBase::muonPairs_, patZpeak::muons, muonSelector_, plotter, reco::tau::disc::Pt(), puInfoSrc_, recMu1, recMu2, recMuScleMu1, recMuScleMu2, MuScleFitUtils::ResFound, edm::Event::run(), MuScleFitUtils::SavedPair, MuScleFitUtils::SavedPairMuScleFitMuons, edm::second(), MuScleFitUtils::simPair, MuScleFitUtils::speedup, vertexSrc_, and HLT_25ns10e33_v2_cff::vertices.

Referenced by duringLoop(), and endOfLoop().

857 {
860 
861  std::vector<MuScleFitMuon> muons;
862  muonSelector_->selectMuons(event, muons, genMuonPairs_, MuScleFitUtils::simPair, plotter);
863  // plotter->fillRec(muons); // @EM method already invoked inside MuScleFitMuonSelector::selectMuons()
864 
865  if (debug_>0){
866  std::cout<<"[MuScleFit::selectMuons] Debugging muons collections after call to muonSelector_->selectMuons"<<std::endl;
867  int iMu=0;
868  for (std::vector<MuScleFitMuon>::const_iterator it = muons.begin(); it < muons.end(); ++it) {
869  std::cout<<" - muon n. "<<iMu<<" = "<<(*it)<<std::endl;
870  ++iMu;
871  }
872  }
873 
874  // Find the two muons from the resonance, and set ResFound bool
875  // ------------------------------------------------------------
876  std::pair<MuScleFitMuon, MuScleFitMuon> recMuFromBestRes =
878 
880  if (debug_>0) {
881  std::cout <<std::setprecision(9)<< "Pt after findbestrecores: " << (recMuFromBestRes.first).Pt() << " "
882  << (recMuFromBestRes.second).Pt() << std::endl;
883  std::cout << "recMu1 = " << recMu1 << std::endl;
884  std::cout << "recMu2 = " << recMu2 << std::endl;
885  }
886  recMu1 = recMuFromBestRes.first.p4();
887  recMu2 = recMuFromBestRes.second.p4();
888  recMuScleMu1 = recMuFromBestRes.first;
889  recMuScleMu2 = recMuFromBestRes.second;
890 
891  if (debug_>0) {
892  std::cout << "after recMu1 = " << recMu1 << std::endl;
893  std::cout << "after recMu2 = " << recMu2 << std::endl;
894  std::cout << "mu1.pt = " << recMu1.Pt() << std::endl;
895  std::cout << "mu2.pt = " << recMu2.Pt() << std::endl;
896  std::cout << "after recMuScleMu1 = " << recMuScleMu1 << std::endl;
897  std::cout << "after recMuScleMu2 = " << recMuScleMu2 << std::endl;
898  }
899  MuScleFitUtils::SavedPair.push_back( std::make_pair( recMu1, recMu2 ) );
900  MuScleFitUtils::SavedPairMuScleFitMuons.push_back( std::make_pair( recMuScleMu1, recMuScleMu2 ) );
901  } else {
902  MuScleFitUtils::SavedPair.push_back( std::make_pair( lorentzVector(0.,0.,0.,0.), lorentzVector(0.,0.,0.,0.) ) );
903  MuScleFitUtils::SavedPairMuScleFitMuons.push_back( std::make_pair( MuScleFitMuon() , MuScleFitMuon() ) );
904  }
905  // Save the events also in the external tree so that it can be saved late
906 
907 
908 
909  // Fetch extra information (per event)
910  UInt_t the_NVtx(0);
911  Int_t the_numPUvtx(0);
912  Float_t the_TrueNumInteractions(0);
913 
914  // Fill pile-up related informations
915  // --------------------------------
917  event.getByLabel(puInfoSrc_, puInfo);
918  if ( puInfo.isValid() ) {
919  std::vector<PileupSummaryInfo>::const_iterator PVI;
920  for(PVI = puInfo->begin(); PVI != puInfo->end(); ++PVI) {
921  int BX = PVI->getBunchCrossing();
922  if(BX == 0) { // "0" is the in-time crossing, negative values are the early crossings, positive are late
923  the_TrueNumInteractions = PVI->getTrueNumInteractions();
924  the_numPUvtx = PVI->getPU_NumInteractions();
925  }
926  }
927  }
928 
930  event.getByLabel(vertexSrc_, vertices);
931  if ( vertices.isValid() ) {
932  std::vector<reco::Vertex>::const_iterator itv;
933  // now, count vertices
934  for (itv = vertices->begin(); itv != vertices->end(); ++itv) {
935  // require that the vertex meets certain criteria
936  if(itv->ndof()<5) continue;
937  if(fabs(itv->z())>50.0) continue;
938  if(fabs(itv->position().rho())>2.0) continue;
939  ++the_NVtx;
940  }
941  }
942 
943  // get the MC event weight
945  event.getByLabel("generator", genEvtInfo);
946  double the_genEvtweight = 1.;
947  if ( genEvtInfo.isValid() ) {
948  the_genEvtweight = genEvtInfo->weight();
949  }
950 
952  MuScleFitEvent(event.run(), event.id().event(), the_genEvtweight, the_numPUvtx, the_TrueNumInteractions, the_NVtx)
953  ));
954  // Fill the internal genPair tree from the external one
955  if( MuScleFitUtils::speedup == false ) {
956  MuScleFitUtils::genPair.push_back(std::make_pair( genMuonPairs_.back().mu1.p4(), genMuonPairs_.back().mu2.p4() ));
957  }
958 }
static std::vector< std::pair< lorentzVector, lorentzVector > > simPair
std::vector< GenMuonPair > genMuonPairs_
Stores the genMuon pairs and the motherId prior to the creation of the internal tree.
Definition: MuScleFitBase.h:82
static std::vector< std::pair< MuScleFitMuon, MuScleFitMuon > > SavedPairMuScleFitMuons
edm::InputTag vertexSrc_
Definition: MuScleFit.cc:310
static bool speedup
static bool ResFound
MuScleFitMuon recMuScleMu1
Definition: MuScleFit.cc:286
reco::Particle::LorentzVector lorentzVector
Definition: GenMuonPair.h:9
U second(std::pair< T, U > const &p)
static std::pair< MuScleFitMuon, MuScleFitMuon > findBestRecoRes(const std::vector< MuScleFitMuon > &muons)
static std::vector< std::pair< lorentzVector, lorentzVector > > genPair
reco::Particle::LorentzVector recMu2
Definition: MuScleFit.cc:285
reco::Particle::LorentzVector recMu1
Definition: MuScleFit.cc:285
RunNumber_t run() const
Definition: Event.h:93
MuScleFitMuon recMuScleMu2
Definition: MuScleFit.cc:286
static std::vector< std::pair< lorentzVector, lorentzVector > > SavedPair
bool isValid() const
Definition: HandleBase.h:75
std::auto_ptr< MuScleFitMuonSelector > muonSelector_
Definition: MuScleFit.cc:312
edm::InputTag puInfoSrc_
Definition: MuScleFit.cc:309
MuScleFitPlotter * plotter
Definition: MuScleFit.cc:281
tuple muons
Definition: patZpeak.py:38
std::vector< MuonPair > muonPairs_
Used to store the muon pairs plus run and event number prior to the creation of the internal tree...
Definition: MuScleFitBase.h:80
tuple cout
Definition: gather_cfg.py:145
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
void MuScleFit::selectMuons ( const int  maxEvents,
const TString &  treeFileName 
)
protected

Selects the muon pairs and fills the SavedPair and (if needed) the genPair vector. This version reads the events from a tree in the file specified in the cfg. The tree only contains one muon pair per event. This means that no selection is performed and we use preselected muons.

Definition at line 960 of file MuScleFit.cc.

References applyBias(), applySmearing(), MuScleFitUtils::BiasType, gather_cfg::cout, SiPixelRawToDigiRegional_cfi::deltaPhi, MuScleFitUtils::deltaPhi(), MuScleFitUtils::deltaPhiMaxCut_, MuScleFitUtils::deltaPhiMinCut_, MuScleFitPlotter::fillTreeGen(), MuScleFitPlotter::fillTreeRec(), MuScleFitBase::genMuonPairs_, MuScleFitUtils::genMuscleFitPair, MuScleFitUtils::genPair, inputRootTreeFileName_, MuScleFitUtils::maxMuonEtaFirstRange_, MuScleFitUtils::maxMuonEtaSecondRange_, MuScleFitUtils::maxMuonPt_, MuScleFitUtils::minMuonEtaFirstRange_, MuScleFitUtils::minMuonEtaSecondRange_, MuScleFitUtils::minMuonPt_, MuScleFitBase::muonPairs_, plotter, RootTreeHandler::readTree(), MuScleFitUtils::SavedPair, MuScleFitUtils::SavedPairMuScleFitMuons, MuScleFitUtils::separateRanges_, MuScleFitUtils::SmearType, MuScleFitUtils::speedup, and MuScleFitBase::theMuonType_.

961 {
962  std::cout << "Reading muon pairs from Root Tree in " << treeFileName << std::endl;
963  RootTreeHandler rootTreeHandler;
964  std::vector<std::pair<unsigned int, unsigned long long> > evtRun;
967  }
968  else {
970  }
971  // Now loop on all the pairs and apply any smearing and bias if needed
972  std::vector<std::pair<unsigned int, unsigned long long> >::iterator evtRunIt = evtRun.begin();
973  std::vector<std::pair<MuScleFitMuon, MuScleFitMuon> >::iterator it = MuScleFitUtils::SavedPairMuScleFitMuons.begin();
974  std::vector<std::pair<MuScleFitMuon, MuScleFitMuon> >::iterator genIt;
975  if (MuScleFitUtils::speedup == false) genIt = MuScleFitUtils::genMuscleFitPair.begin();
976  for (; it != MuScleFitUtils::SavedPairMuScleFitMuons.end(); ++it, ++evtRunIt) {
977 
978  // Apply any cut if requested
979  // Note that cuts here are only applied to already selected muons. They should not be used unless
980  // you are sure that the difference is negligible (e.g. the number of events with > 2 muons is negligible).
981  double pt1 = it->first.pt();
982  //std::cout << "pt1 = " << pt1 << std::endl;
983  double pt2 = it->second.pt();
984  //std::cout << "pt2 = " << pt2 << std::endl;
985  double eta1 = it->first.eta();
986  //std::cout << "eta1 = " << eta1 << std::endl;
987  double eta2 = it->second.eta();
988  //std::cout << "eta2 = " << eta2 << std::endl;
989  // If they don't pass the cuts set to null vectors
990  bool dontPass = false;
991  bool eta1InFirstRange;
992  bool eta2InFirstRange;
993  bool eta1InSecondRange;
994  bool eta2InSecondRange;
995 
996  int ch1 = it->first.charge();
997  int ch2 = it->second.charge();
998 
1004 
1005  // This is my logic, which should be erroneous, but certainly simpler...
1006  if (
1007  !(
1010  ((eta1InFirstRange && eta2InSecondRange && ch1>=ch2)||(eta1InSecondRange && eta2InFirstRange && ch1<ch2))
1011  )
1012  ) dontPass = true;
1013  }
1014  else {
1019  if (
1020  !(
1023  (
1024  ((eta1InFirstRange && !eta2InFirstRange) && (eta2InSecondRange && !eta1InSecondRange) && ch1>=ch2) ||
1025  ((eta2InFirstRange && !eta1InFirstRange) && (eta1InSecondRange && !eta2InSecondRange) && ch1<ch2)
1026  )
1027  )
1028  ) dontPass = true;
1029  }
1030 
1031  // Additional check on deltaPhi
1032  double deltaPhi = MuScleFitUtils::deltaPhi(it->first.phi(), it->second.phi());
1033  if( (deltaPhi <= MuScleFitUtils::deltaPhiMinCut_) || (deltaPhi >= MuScleFitUtils::deltaPhiMaxCut_) ) dontPass = true;
1034 
1035  lorentzVector vec1 = it->first.p4();
1036  lorentzVector vec2 = it->second.p4();
1037  if (ch1>=ch2){
1038  lorentzVector vectemp=vec1;
1039  vec1=vec2;
1040  vec2=vectemp;
1041  }
1042 
1043  if (!dontPass) {
1044  // First is always mu-, second mu+
1045  if ((MuScleFitUtils::SmearType != 0) || (MuScleFitUtils::BiasType != 0)) {
1046  applySmearing(vec1);
1047  applyBias(vec1, -1);
1048  applySmearing(vec2);
1049  applyBias(vec2, 1);
1050  }
1051 
1052  MuScleFitUtils::SavedPair.push_back(std::make_pair(vec1, vec2));
1053  }
1054 
1055  //FIXME: we loose the additional information besides the 4-momenta
1056  muonPairs_.push_back(
1057  MuonPair(MuScleFitMuon(vec1, -1), MuScleFitMuon(vec2, +1),
1058  MuScleFitEvent((*evtRunIt).first, (*evtRunIt).second, 0, 0, 0, 0)) // FIXME: order of event and run number mixed up!
1059  );
1060 
1061  // Fill the internal genPair tree from the external one
1062  if (!MuScleFitUtils::speedup) {
1063  MuScleFitUtils::genPair.push_back(std::make_pair(genIt->first.p4(), genIt->second.p4()));
1064  genMuonPairs_.push_back(GenMuonPair(genIt->first.p4(), genIt->second.p4(), 0));
1065  ++genIt;
1066  }
1067  }
1069  if( !(MuScleFitUtils::speedup) ) {
1071  }
1072 }
std::vector< GenMuonPair > genMuonPairs_
Stores the genMuon pairs and the motherId prior to the creation of the internal tree.
Definition: MuScleFitBase.h:82
static double maxMuonEtaSecondRange_
static double deltaPhiMaxCut_
static std::vector< std::pair< MuScleFitMuon, MuScleFitMuon > > SavedPairMuScleFitMuons
static std::vector< std::pair< MuScleFitMuon, MuScleFitMuon > > genMuscleFitPair
static bool speedup
void fillTreeRec(const std::vector< std::pair< reco::Particle::LorentzVector, reco::Particle::LorentzVector > > &savedPairs)
Used when running on the root tree containing preselected muon pairs.
static double minMuonEtaFirstRange_
static int BiasType
reco::Particle::LorentzVector lorentzVector
Definition: GenMuonPair.h:9
static double maxMuonPt_
static std::vector< std::pair< lorentzVector, lorentzVector > > genPair
std::vector< double > vec1
Definition: HCALResponse.h:15
static int SmearType
static std::vector< std::pair< lorentzVector, lorentzVector > > SavedPair
void applySmearing(reco::Particle::LorentzVector &mu)
Apply the smearing if needed using the function in MuScleFitUtils.
Definition: MuScleFit.cc:1362
void fillTreeGen(const std::vector< std::pair< reco::Particle::LorentzVector, reco::Particle::LorentzVector > > &genPairs)
static double deltaPhiMinCut_
MuScleFitPlotter * plotter
Definition: MuScleFit.cc:281
static bool separateRanges_
static double minMuonEtaSecondRange_
std::string inputRootTreeFileName_
Definition: MuScleFit.cc:296
std::vector< MuonPair > muonPairs_
Used to store the muon pairs plus run and event number prior to the creation of the internal tree...
Definition: MuScleFitBase.h:80
static double deltaPhi(const double &phi1, const double &phi2)
tuple cout
Definition: gather_cfg.py:145
static double minMuonPt_
std::vector< vec1 > vec2
Definition: HCALResponse.h:16
static double maxMuonEtaFirstRange_
void applyBias(reco::Particle::LorentzVector &mu, const int charge)
Apply the bias if needed using the function in MuScleFitUtils.
Definition: MuScleFit.cc:1371
void readTree(const int maxEvents, const TString &fileName, MuonPairVector *savedPair, const int muonType, std::vector< std::pair< unsigned int, unsigned long long > > *evtRun, MuonPairVector *genPair=0)
bool MuScleFit::selGlobalMuon ( const pat::Muon aMuon)
protected

Function for onia selections.

Definition at line 1469 of file MuScleFit.cc.

References pat::Muon::globalTrack(), pat::Muon::innerTrack(), pat::Muon::muonID(), reco::HitPattern::numberOfValidMuonHits(), AlCaHLTBitMon_ParallelJobs::p, reco::HitPattern::pixelLayersWithMeasurement(), and lumiQueryAPI::q.

1469  {
1470 
1471  reco::TrackRef iTrack = aMuon->innerTrack();
1472  const reco::HitPattern& p = iTrack->hitPattern();
1473 
1474  reco::TrackRef gTrack = aMuon->globalTrack();
1475  const reco::HitPattern& q = gTrack->hitPattern();
1476 
1477  return (//isMuonInAccept(aMuon) &&// no acceptance cuts!
1478  iTrack->found() > 11 &&
1479  gTrack->chi2()/gTrack->ndof() < 20.0 &&
1480  q.numberOfValidMuonHits() > 0 &&
1481  iTrack->chi2()/iTrack->ndof() < 4.0 &&
1482  aMuon->muonID("TrackerMuonArbitrated") &&
1483  aMuon->muonID("TMLastStationAngTight") &&
1484  p.pixelLayersWithMeasurement() > 1 &&
1485  fabs(iTrack->dxy()) < 3.0 && //should be done w.r.t. PV!
1486  fabs(iTrack->dz()) < 15.0 );//should be done w.r.t. PV!
1487 }
reco::TrackRef innerTrack() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.h:72
bool muonID(const std::string &name) const
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:508
reco::TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
Definition: Muon.h:80
int numberOfValidMuonHits() const
Definition: HitPattern.h:833
bool MuScleFit::selTrackerMuon ( const pat::Muon aMuon)
protected

Definition at line 1490 of file MuScleFit.cc.

References pat::Muon::innerTrack(), pat::Muon::muonID(), AlCaHLTBitMon_ParallelJobs::p, and reco::HitPattern::pixelLayersWithMeasurement().

1490  {
1491 
1492  reco::TrackRef iTrack = aMuon->innerTrack();
1493  const reco::HitPattern& p = iTrack->hitPattern();
1494 
1495  return (//isMuonInAccept(aMuon) // no acceptance cuts!
1496  iTrack->found() > 11 &&
1497  iTrack->chi2()/iTrack->ndof() < 4.0 &&
1498  aMuon->muonID("TrackerMuonArbitrated") &&
1499  aMuon->muonID("TMLastStationAngTight") &&
1500  p.pixelLayersWithMeasurement() > 1 &&
1501  fabs(iTrack->dxy()) < 3.0 && //should be done w.r.t. PV!
1502  fabs(iTrack->dz()) < 15.0 );//should be done w.r.t. PV!
1503 
1504 }
reco::TrackRef innerTrack() const
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
Definition: Muon.h:72
bool muonID(const std::string &name) const
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:508
void MuScleFit::startingNewLoop ( unsigned int  int)
overridevirtual

Called before system starts to loop over the events. The argument is a count of how many loops have been processed. For the first time through the events the argument will be 0.

Implements edm::EDLooperBase.

Definition at line 669 of file MuScleFit.cc.

References MuScleFitUtils::counter_resprob, gather_cfg::cout, MuScleFitBase::debug_, MuScleFitBase::fillHistoMap(), MuScleFitUtils::goodmuon, iev, MuScleFitUtils::iev_, MuScleFitUtils::loopCounter, loopCounter, MuScleFitUtils::oldNormalization_, and MuScleFitBase::theFiles_.

Referenced by endOfLoop().

670 {
671  if (debug_>0) std::cout << "[MuScleFit]: Starting loop # " << iLoop << std::endl;
672 
673  // Number of muons used
674  // --------------------
676 
677  // Counters for problem std::cout-ing
678  // -----------------------------
680 
681  // Create the root file
682  // --------------------
683  fillHistoMap(theFiles_[iLoop], iLoop);
684 
685  loopCounter = iLoop;
687 
688  iev = 0;
690 
692 }
static unsigned int loopCounter
unsigned int loopCounter
Definition: MuScleFit.cc:277
static double oldNormalization_
void fillHistoMap(TFile *outputFile, unsigned int iLoop)
Create the histograms map.
Definition: MuScleFitBase.cc:7
std::vector< TFile * > theFiles_
The files were the histograms are saved.
Definition: MuScleFitBase.h:74
static int goodmuon
static int iev_
tuple cout
Definition: gather_cfg.py:145
static int counter_resprob
template<typename T >
void MuScleFit::takeSelectedMuonType ( const T muon,
std::vector< reco::Track > &  tracks 
)
protected

Template method used to fill the track collection starting from reco::muons or pat::muons.

Definition at line 353 of file MuScleFit.cc.

References MuScleFitBase::theMuonType_.

354 {
355  // std::cout<<"muon "<<muon->isGlobalMuon()<<muon->isStandAloneMuon()<<muon->isTrackerMuon()<<std::endl;
356  //NNBB: one muon can be of many kinds at once but with the theMuonType_ we are sure
357  // to avoid double counting of the same muon
358  if(muon->isGlobalMuon() && theMuonType_==1)
359  tracks.push_back(*(muon->globalTrack()));
360  else if(muon->isStandAloneMuon() && theMuonType_==2)
361  tracks.push_back(*(muon->outerTrack()));
362  else if(muon->isTrackerMuon() && theMuonType_==3)
363  tracks.push_back(*(muon->innerTrack()));
364 
365  else if( theMuonType_ == 10 && !(muon->isStandAloneMuon()) ) //particular case!!
366  tracks.push_back(*(muon->innerTrack()));
367  else if( theMuonType_ == 11 && muon->isGlobalMuon() )
368  tracks.push_back(*(muon->innerTrack()));
369  else if( theMuonType_ == 13 && muon->isTrackerMuon() )
370  tracks.push_back(*(muon->innerTrack()));
371 }
tuple tracks
Definition: testEve_cfg.py:39

Member Data Documentation

bool MuScleFit::compareToSimTracks_
protected

Definition at line 290 of file MuScleFit.cc.

Referenced by duringFastLoop(), and MuScleFit().

bool MuScleFit::fastLoop
protected

Definition at line 279 of file MuScleFit.cc.

Referenced by duringLoop(), endOfLoop(), and MuScleFit().

std::string MuScleFit::genParticlesName_
protected

Definition at line 293 of file MuScleFit.cc.

Referenced by MuScleFit().

int MuScleFit::iev
protected

Definition at line 287 of file MuScleFit.cc.

Referenced by duringFastLoop(), endOfLoop(), and startingNewLoop().

bool MuScleFit::ifGenPart
protected

Definition at line 267 of file MuScleFit.cc.

bool MuScleFit::ifHepMC
protected

Definition at line 266 of file MuScleFit.cc.

std::string MuScleFit::inputRootTreeFileName_
protected

Definition at line 296 of file MuScleFit.cc.

Referenced by duringLoop(), endOfLoop(), MuScleFit(), selectMuons(), and ~MuScleFit().

unsigned int MuScleFit::loopCounter
protected

Definition at line 277 of file MuScleFit.cc.

Referenced by duringFastLoop(), duringLoop(), endOfFastLoop(), MuScleFit(), and startingNewLoop().

int MuScleFit::maxEventsFromRootTree_
protected

Definition at line 300 of file MuScleFit.cc.

Referenced by endOfLoop(), and MuScleFit().

unsigned int MuScleFit::maxLoopNumber
protected

Definition at line 276 of file MuScleFit.cc.

Referenced by beginOfJobInConstructor(), checkParameters(), endOfLoop(), and MuScleFit().

double MuScleFit::maxResMass_hwindow[6]
protected

Definition at line 272 of file MuScleFit.cc.

Referenced by MuScleFit().

double MuScleFit::minResMass_hwindow[6]
protected

Definition at line 271 of file MuScleFit.cc.

Referenced by MuScleFit().

std::auto_ptr<MuScleFitMuonSelector> MuScleFit::muonSelector_
protected

Definition at line 312 of file MuScleFit.cc.

Referenced by MuScleFit(), and selectMuons().

bool MuScleFit::negateTrigger_
protected

Definition at line 305 of file MuScleFit.cc.

Referenced by duringLoop(), and MuScleFit().

int MuScleFit::numberOfEwkZ
protected

Definition at line 264 of file MuScleFit.cc.

int MuScleFit::numberOfSimMuons
protected

Definition at line 262 of file MuScleFit.cc.

int MuScleFit::numberOfSimTracks
protected

Definition at line 261 of file MuScleFit.cc.

int MuScleFit::numberOfSimVertices
protected

Definition at line 263 of file MuScleFit.cc.

std::string MuScleFit::outputRootTreeFileName_
protected

Definition at line 298 of file MuScleFit.cc.

Referenced by MuScleFit(), and ~MuScleFit().

bool MuScleFit::PATmuons_
protected

Definition at line 292 of file MuScleFit.cc.

Referenced by MuScleFit().

MuScleFitPlotter* MuScleFit::plotter
protected

Definition at line 281 of file MuScleFit.cc.

Referenced by beginOfJobInConstructor(), endOfFastLoop(), and selectMuons().

edm::InputTag MuScleFit::puInfoSrc_
protected

Definition at line 309 of file MuScleFit.cc.

Referenced by MuScleFit(), and selectMuons().

reco::Particle::LorentzVector MuScleFit::recMu1
protected

Definition at line 285 of file MuScleFit.cc.

Referenced by duringFastLoop(), and selectMuons().

reco::Particle::LorentzVector MuScleFit::recMu2
protected

Definition at line 285 of file MuScleFit.cc.

Referenced by duringFastLoop(), and selectMuons().

MuScleFitMuon MuScleFit::recMuScleMu1
protected

Definition at line 286 of file MuScleFit.cc.

Referenced by selectMuons().

MuScleFitMuon MuScleFit::recMuScleMu2
protected

Definition at line 286 of file MuScleFit.cc.

Referenced by selectMuons().

bool MuScleFit::saveAllToTree_
protected

Definition at line 306 of file MuScleFit.cc.

Referenced by MuScleFit(), and ~MuScleFit().

edm::InputTag MuScleFit::simTracksCollection_
protected

Definition at line 291 of file MuScleFit.cc.

Referenced by MuScleFit().

MuonServiceProxy* MuScleFit::theService
protected

Definition at line 257 of file MuScleFit.cc.

int MuScleFit::totalEvents_
protected

Definition at line 288 of file MuScleFit.cc.

Referenced by duringLoop(), endOfLoop(), and ~MuScleFit().

std::vector<std::string> MuScleFit::triggerPath_
protected

Definition at line 304 of file MuScleFit.cc.

Referenced by duringLoop(), and MuScleFit().

std::string MuScleFit::triggerResultsLabel_
protected

Definition at line 302 of file MuScleFit.cc.

Referenced by duringLoop(), and MuScleFit().

std::string MuScleFit::triggerResultsProcess_
protected

Definition at line 303 of file MuScleFit.cc.

Referenced by duringLoop(), and MuScleFit().

edm::InputTag MuScleFit::vertexSrc_
protected

Definition at line 310 of file MuScleFit.cc.

Referenced by MuScleFit(), and selectMuons().