Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:24:15

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 process = cms.Process("TagProbe")
0004 
0005 process.load('FWCore.MessageService.MessageLogger_cfi')
0006 
0007 process.source = cms.Source("EmptySource")
0008 
0009 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) )    
0010 
0011 process.TagProbeFitTreeAnalyzer = cms.EDAnalyzer("TagProbeFitTreeAnalyzer",
0012     # IO parameters:
0013     InputFileNames = cms.vstring("testTagProbeFitTreeProducer_JPsiMuMu.root"),
0014     InputDirectoryName = cms.string("MuonID"),
0015     InputTreeName = cms.string("fitter_tree"),
0016     OutputFileName = cms.string("testTagProbeFitTreeAnalyzer_JPsiMuMu.root"),
0017     #numbrer of CPUs to use for fitting
0018     NumCPU = cms.uint32(1),
0019     # specifies wether to save the RooWorkspace containing the data for each bin and
0020     # the pdf object with the initial and final state snapshots
0021     SaveWorkspace = cms.bool(True),
0022 
0023     # defines all the real variables of the probes available in the input tree and intended for use in the efficiencies
0024     Variables = cms.PSet(
0025         mass = cms.vstring("Tag-Probe Mass", "2.6", "3.6", "GeV/c^{2}"),
0026         pt = cms.vstring("Probe p_{T}", "0", "100", "GeV/c"),
0027         eta = cms.vstring("Probe #eta", "-2.5", "2.5", ""),
0028         abseta = cms.vstring("Probe |#eta|", "0", "2.5", ""),
0029     ),
0030 
0031     # defines all the discrete variables of the probes available in the input tree and intended for use in the efficiency calculations
0032     Categories = cms.PSet(
0033         mcTrue = cms.vstring("MC true", "dummy[true=1,false=0]"),
0034         Glb = cms.vstring("isGlobalMuon", "dummy[true=1,false=0]"),
0035         TM = cms.vstring("isTrackerMuon", "dummy[true=1,false=0]"),
0036     ),
0037 
0038     # defines all the PDFs that will be available for the efficiency calculations; uses RooFit's "factory" syntax;
0039     # each pdf needs to define "signal", "backgroundPass", "backgroundFail" pdfs, "efficiency[0.9,0,1]" and "signalFractionInPassing[0.9]" are used for initial values  
0040     PDFs = cms.PSet(
0041         gaussPlusLinear = cms.vstring(
0042             "Gaussian::signal(mass, mean[3.1,3.0,3.2], sigma[0.03,0.01,0.05])",
0043             "Chebychev::backgroundPass(mass, cPass[0,-1,1])",
0044             "Chebychev::backgroundFail(mass, cFail[0,-1,1])",
0045             "efficiency[0.9,0,1]",
0046             "signalFractionInPassing[0.9]"
0047         ),
0048         gaussPlusQuadratic = cms.vstring(
0049             "Gaussian::signal(mass, mean[3.1,3.0,3.2], sigma[0.03,0.01,0.05])",
0050             "Chebychev::backgroundPass(mass, {cPass1[0,-1,1], cPass2[0,-1,1]})",
0051             "Chebychev::backgroundFail(mass, {cFail1[0,-1,1], cFail2[0,-1,1]})",
0052             "efficiency[0.9,0,1]",
0053             "signalFractionInPassing[0.9]"
0054         )
0055     ),
0056 
0057     # defines a set of efficiency calculations, what PDF to use for fitting and how to bin the data;
0058     # there will be a separate output directory for each calculation that includes a simultaneous fit, side band subtraction and counting. 
0059     Efficiencies = cms.PSet(
0060         #the name of the parameter set becomes the name of the directory
0061         Glb_pt_abseta = cms.PSet(
0062             #specifies the efficiency of which category and state to measure 
0063             EfficiencyCategoryAndState = cms.vstring("Glb","true"),
0064             #specifies what unbinned variables to include in the dataset, the mass is needed for the fit
0065             UnbinnedVariables = cms.vstring("mass"),
0066             #specifies the binning of parameters
0067             BinnedVariables = cms.PSet(
0068                 pt = cms.vdouble(3.0, 6.0, 20.0),
0069                 abseta = cms.vdouble(0.0, 1.2, 2.4),
0070             ),
0071             #first string is the default followed by binRegExp - PDFname pairs
0072             BinToPDFmap = cms.vstring("gaussPlusLinear", "*pt_bin0*", "gaussPlusQuadratic")
0073         ),
0074         Glb_pt_abseta_mcTrue = cms.PSet(
0075             EfficiencyCategoryAndState = cms.vstring("Glb","true"),
0076             UnbinnedVariables = cms.vstring("mass"),
0077             BinnedVariables = cms.PSet(
0078                 mcTrue = cms.vstring("true"),
0079                 pt = cms.vdouble(3.0, 6.0, 20.0),
0080                 abseta = cms.vdouble(0.0, 1.2, 2.4),
0081             )
0082             #unspecified binToPDFmap means no fitting
0083         ),
0084         Glb_pt = cms.PSet(
0085             EfficiencyCategoryAndState = cms.vstring("Glb","true"),
0086             UnbinnedVariables = cms.vstring("mass"),
0087             BinnedVariables = cms.PSet(
0088                 pt = cms.vdouble(3.0, 6.0, 20.0),
0089             ),
0090             BinToPDFmap = cms.vstring("gaussPlusLinear")
0091         ),
0092         Glb_pt_mcTrue = cms.PSet(
0093             EfficiencyCategoryAndState = cms.vstring("Glb","true"),
0094             UnbinnedVariables = cms.vstring("mass"),
0095             BinnedVariables = cms.PSet(
0096                 mcTrue = cms.vstring("true"),
0097                 pt = cms.vdouble(3.0, 6.0, 20.0),
0098             )
0099         ),
0100     )
0101 )
0102 
0103 process.fitness = cms.Path(
0104     process.TagProbeFitTreeAnalyzer
0105 )
0106