Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-22 22:55:13

0001 import glob
0002 import FWCore.ParameterSet.Config as cms
0003 
0004 ###################################################################
0005 # Setup 'standard' options
0006 ###################################################################
0007 import FWCore.ParameterSet.VarParsing as VarParsing
0008 options = VarParsing.VarParsing()
0009 options.register('outFileName',
0010                  "test.root", # default value
0011                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0012                  VarParsing.VarParsing.varType.string, # string, int, or float
0013                  "name of the output file (test.root is default)")
0014 
0015 options.register('trackCollection',
0016                  "ctfWithMaterialTracksP5", #ALCARECOTkAlCosmicsCTF0T
0017                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0018                  VarParsing.VarParsing.varType.string, # string, int, or float
0019                  "name of the input track collection")
0020 
0021 options.register('globalTag',
0022                  "auto:run3_data_prompt", # default value
0023                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0024                  VarParsing.VarParsing.varType.string, # string, int, or float
0025                  "name of the input Global Tag")
0026 
0027 options.register('unitTest',
0028                  False, # default value
0029                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0030                  VarParsing.VarParsing.varType.bool, # string, int, or float
0031                  "is it a unit test?")
0032 
0033 options.register('inputData',
0034                  "/eos/cms/store/express/Commissioning2022/ExpressCosmics/FEVT/Express-v1/000/350/010/00000/*",
0035                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0036                  VarParsing.VarParsing.varType.string, # string, int, or float
0037                  "eos directory to read from")
0038 
0039 options.register('maxEvents',
0040                  -1,
0041                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list                 
0042                  VarParsing.VarParsing.varType.int, # string, int, or float
0043                  "num. events to run")
0044 
0045 options.parseArguments()
0046 
0047 process = cms.Process("AlCaRECOAnalysis")
0048 
0049 ###################################################################
0050 # Message logger service
0051 ###################################################################
0052 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0053 process.MessageLogger.cerr.enable = False
0054 process.MessageLogger.DMRChecker=dict()  
0055 process.MessageLogger.GeneralPurposeTrackAnalyzer=dict()
0056 process.MessageLogger.cout = cms.untracked.PSet(
0057     enable = cms.untracked.bool(True),
0058     threshold = cms.untracked.string("INFO"),
0059     default   = cms.untracked.PSet(limit = cms.untracked.int32(0)),                       
0060     FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1),
0061                                    reportEvery = cms.untracked.int32(1000)
0062                                    ),                                                      
0063     DMRChecker = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0064     GeneralPurposeTrackAnalyzer = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0065     #enableStatistics = cms.untracked.bool(True)
0066     )
0067 
0068 ###################################################################
0069 # Geometry producer and standard includes
0070 ###################################################################
0071 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
0072 process.load("Configuration.StandardSequences.Services_cff")
0073 process.load("Configuration.StandardSequences.GeometryRecoDB_cff")
0074 process.load('Configuration.StandardSequences.MagneticField_cff')
0075 #process.load("Configuration.StandardSequences.MagneticField_0T_cff")
0076 process.load("CondCore.CondDB.CondDB_cfi")
0077 
0078 ####################################################################
0079 # Get the GlogalTag
0080 ####################################################################
0081 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0082 from Configuration.AlCa.GlobalTag import GlobalTag
0083 process.GlobalTag = GlobalTag(process.GlobalTag,options.globalTag, '')
0084 
0085 ###################################################################
0086 # Source
0087 ###################################################################
0088 readFiles = cms.untracked.vstring()
0089 process.source = cms.Source("PoolSource",fileNames = readFiles)
0090 the_files=[]
0091 if(options.unitTest):
0092     ## fixed input for the unit test
0093     readFiles.extend(["/store/express/Commissioning2022/ExpressCosmics/FEVT/Express-v1/000/350/010/00000/e0edb947-f8c4-4e6a-b856-ab64117fc6ee.root"]) 
0094 else:
0095     file_list = glob.glob(options.inputData)
0096     for f in file_list:
0097         the_files.append(f.replace("/eos/cms",""))
0098     print(the_files)
0099     readFiles.extend(the_files)
0100 
0101 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(options.maxEvents))
0102 
0103 ###################################################################
0104 # momentum constraint for 0T
0105 ###################################################################
0106 process.load("RecoTracker.TrackProducer.MomentumConstraintProducer_cff")
0107 import RecoTracker.TrackProducer.MomentumConstraintProducer_cff
0108 process.AliMomConstraint = RecoTracker.TrackProducer.MomentumConstraintProducer_cff.MyMomConstraint.clone()
0109 process.AliMomConstraint.src = options.trackCollection
0110 process.AliMomConstraint.fixedMomentum = 5.0
0111 process.AliMomConstraint.fixedMomentumError = 0.005
0112 
0113 ###################################################################
0114 # Alignment Track Selector
0115 ###################################################################
0116 import Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi
0117 process.MuSkimSelector = Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi.AlignmentTrackSelector.clone(
0118     applyBasicCuts = True,                                                                            
0119     filter = True,
0120     src = options.trackCollection,
0121     ptMin = 17.,
0122     pMin = 17.,
0123     etaMin = -2.5,
0124     etaMax = 2.5,
0125     d0Min = -2.,
0126     d0Max = 2.,
0127     dzMin = -25.,
0128     dzMax = 25.,
0129     nHitMin = 6,
0130     nHitMin2D = 0)
0131 
0132 ###################################################################
0133 # The TrackRefitter
0134 ###################################################################
0135 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
0136 import RecoTracker.TrackProducer.TrackRefitters_cff
0137 process.TrackRefitter1 = process.TrackRefitterP5.clone(
0138     src =  options.trackCollection, #'AliMomConstraint',
0139     TrajectoryInEvent = True,
0140     TTRHBuilder = "WithAngleAndTemplate", #"WithTrackAngle"
0141     NavigationSchool = "",
0142     #constraint = 'momentum', ### SPECIFIC FOR CRUZET
0143     #srcConstr='AliMomConstraint' ### SPECIFIC FOR CRUZET$works only with tag V02-10-02 TrackingTools/PatternTools / or CMSSW >=31X
0144     )
0145 
0146 ###################################################################
0147 # the pT filter
0148 ###################################################################
0149 from CommonTools.RecoAlgos.ptMaxTrackCountFilter_cfi import ptMaxTrackCountFilter
0150 process.myfilter = ptMaxTrackCountFilter.clone(src = cms.InputTag(options.trackCollection),
0151                                                ptMax = cms.double(3.))
0152 
0153 process.preAnaSeq = cms.Sequence()
0154 if(options.unitTest):
0155     print("adding the max pT filter")
0156     process.preAnaSeq = cms.Sequence(process.myfilter)
0157 
0158 ###################################################################
0159 # The analysis module
0160 ###################################################################
0161 process.myanalysis = cms.EDAnalyzer("GeneralPurposeTrackAnalyzer",
0162                                     TkTag  = cms.InputTag('TrackRefitter1'),
0163                                     isCosmics = cms.bool(True))
0164 
0165 process.fastdmr = cms.EDAnalyzer("DMRChecker",
0166                                  TkTag  = cms.InputTag('TrackRefitter1'),
0167                                  isCosmics = cms.bool(True))
0168 
0169 ###################################################################
0170 # Output name
0171 ###################################################################
0172 process.TFileService = cms.Service("TFileService",
0173                                    fileName = cms.string(options.outFileName))
0174 
0175 ###################################################################
0176 # Path
0177 ###################################################################
0178 process.p1 = cms.Path(process.offlineBeamSpot
0179                       #*process.AliMomConstraint  # for 0T
0180                       *process.TrackRefitter1
0181                       *process.myanalysis
0182                       *process.fastdmr)
0183 
0184 ###################################################################
0185 # preprend the filter
0186 ###################################################################
0187 if(options.unitTest):
0188     process.p1.insert(0, process.preAnaSeq)