ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/IPHCalignment2/scripts/testTwoBodyDecayConstraints.py
(Generate patch)

Comparing UserCode/IPHCalignment2/scripts/testTwoBodyDecayConstraints.py (file contents):
Revision 1.1 by econte, Fri Nov 25 16:32:45 2011 UTC vs.
Revision 1.6 by cgoetzma, Wed Dec 7 18:44:38 2011 UTC

# Line 1 | Line 1
1   import FWCore.ParameterSet.Config as cms
2  
3 < process = cms.Process("Demo")
3 > # IPHC variable for specifying geometry alignment scenario :
4 > # 1 -> STARTUP
5 > # 2 -> IDEAL
6 > # 3 -> SAGITTA
7 > # 4 -> TWIST
8 > IPHC_GEOM=4
9  
10 + process = cms.Process("Demo")
11   process.load("FWCore.MessageService.MessageLogger_cfi")
12   process.MessageLogger.cerr.FwkReport.reportEvery = 50
13  
14   #name of the output file containing the tree
15 < process.TFileService = cms.Service("TFileService", fileName = cms.string("analyzerTree.root") )
15 > process.TFileService = cms.Service("TFileService", fileName = cms.string("twist.root") )
16  
17   process.load( "RecoTracker.Configuration.RecoTracker_cff" )
18   process.load( "Configuration.StandardSequences.Services_cff" )
# Line 15 | Line 21 | process.load( "Configuration.StandardSeq
21   process.load( "Configuration.StandardSequences.FrontierConditions_GlobalTag_cff" )
22   process.GlobalTag.globaltag = "START44_V7::All"
23  
18 # process.GlobalTag.toGet = cms.VPSet(
19 #     cms.PSet( record = cms.string( "TrackerAlignmentRcd" ),
20 #               tag = cms.string( "TrackerIdealGeometry210_mc" ),
21 #               connect = cms.untracked.string( "frontier://FrontierProd/CMS_COND_31X_FROM21X" ) ),
22 #     cms.PSet( record = cms.string( "TrackerAlignmentErrorRcd" ),
23 #               tag = cms.string( "TrackerIdealGeometryErrors210_mc" ),
24 #               connect = cms.untracked.string( "frontier://FrontierProd/CMS_COND_31X_FROM21X" ) )
25 # )
24  
25   process.source = cms.Source( "PoolSource",
26      fileNames = cms.untracked.vstring(
# Line 46 | Line 44 | process.out = cms.OutputModule( "PoolOut
44   # ------------------------------------------------------------------------------
45   # 0) Change geometry
46   # ------------------------------------------------------------------------------
47 < #from CondCore.DBCommon.CondDBSetup_cfi import *
48 < #process.trackerAlignment = cms.ESSource("PoolDBESSource",
49 < #                  CondDBSetup,
50 < #                  timetype = cms.string('runnumber'),
51 < #                  toGet = cms.VPSet( cms.PSet(
52 < #                     record = cms.string('TrackerAlignmentRcd'),
53 < #                     tag = cms.string('Alignments')   )),
54 < #                  connect =
55 < #cms.string('sqlite_file:/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/PayLoads/SystematicMisalignmentsMoriond/mcScenarioMoriond/misalignment_on_ideal39X/IDEALplusDelta_ichepVrealignedTwist.db')
56 < #cms.string('sqlite_file:/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/PayLoads/SystematicMisalignmentsMoriond/mcScenarioMoriond/misalignment_on_ideal39X/IDEALplusDelta_ichepVrealignedSagitta.db')
57 <
58 < #                                        )
47 > if IPHC_GEOM==1:
48 >    print "\x1b[31mIPHC config : STARTUP geometry !!!\x1b[0m"
49 >    pass
50 > elif IPHC_GEOM==2:
51 >    print "\x1b[31mIPHC config : IDEAL geometry !!!\x1b[0m"
52 >    process.GlobalTag.toGet = cms.VPSet(
53 >        cms.PSet( record = cms.string( "TrackerAlignmentRcd" ),
54 >                  tag = cms.string( "TrackerIdealGeometry210_mc" ),
55 >                  connect = cms.untracked.string( "frontier://FrontierProd/CMS_COND_31X_FROM21X" ) ),
56 >        cms.PSet( record = cms.string( "TrackerAlignmentErrorRcd" ),
57 >                  tag = cms.string( "TrackerIdealGeometryErrors210_mc" ),
58 >                  connect = cms.untracked.string( "frontier://FrontierProd/CMS_COND_31X_FROM21X" ) )
59 >        )
60 > elif IPHC_GEOM==3 or IPHC_GEOM==4:
61 >    if IPHC_GEOM==4:
62 >        print "\x1b[31mIPHC config : TWIST geometry !!!\x1b[0m"
63 >        IPHC_STRING = 'sqlite_file:/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/PayLoads/SystematicMisalignmentsMoriond/mcScenarioMoriond/misalignment_on_ideal39X/IDEALplusDelta_ichepVrealignedTwist.db'
64 >    elif IPHC_GEOM==3:
65 >        print "\x1b[31mIPHC config : SAGITTA geometry !!!\x1b[0m"
66 >        IPHC_STRING = 'sqlite_file:/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/PayLoads/SystematicMisalignmentsMoriond/mcScenarioMoriond/misalignment_on_ideal39X/IDEALplusDelta_ichepVrealignedSagitta.db'
67 >
68 >    
69 >    from CondCore.DBCommon.CondDBSetup_cfi import *
70 >    process.trackerAlignment = cms.ESSource("PoolDBESSource",
71 >                  CondDBSetup,
72 >                  timetype = cms.string('runnumber'),
73 >                  toGet = cms.VPSet( cms.PSet(
74 >                     record = cms.string('TrackerAlignmentRcd'),
75 >                     tag = cms.string('Alignments')   )),
76 >                  connect = cms.string(IPHC_STRING)
77 >                                        )
78                                          
79 < #process.es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource","trackerAlignment")
79 >    process.es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource","trackerAlignment")
80 >
81 > else:
82 >    print "\x1b[31mIPHC config : UNKNOWN geometry !!!\x1b[0m"
83 >    exit
84 >    
85  
86  
87   # ------------------------------------------------------------------------------
# Line 79 | Line 101 | process.AlignmentTrackSelector.TwoBodyDe
101   # 2) Constructs transient tracks and trajectories from persistent tracks
102   # ------------------------------------------------------------------------------
103   from RecoTracker.TrackProducer.TrackRefitter_cfi import TrackRefitter
104 < process.Refitter = TrackRefitter.clone(
104 > process.GeomRefitter = TrackRefitter.clone(
105      src = "AlignmentTrackSelector",
106      TrajectoryInEvent = True )
107  
# Line 99 | Line 121 | process.TwoBodyDecayTrackFitter = KFFitt
121   # A-4) Refitter tracks without constraint
122   # ------------------------------------------------------------------------------
123   process.TrackRefitterWithoutConstraint = TrackRefitter.clone(
124 <    src = "AlignmentTrackSelector",
124 >    src = "GeomRefitter",
125      Fitter = cms.string('TwoBodyDecayTrackFitter'))
126  
127   # ------------------------------------------------------------------------------
128   # A-5) Fill Tree with refit tracks (without constraint)
129   # ------------------------------------------------------------------------------
130 < process.treeproducer1 = cms.EDAnalyzer('AlignmentTree',
130 > process.treeWithoutConstraints = cms.EDAnalyzer('AlignmentTree',
131      trackLabel       = cms.InputTag('TrackRefitterWithoutConstraint'),
132      tkTraj           = cms.InputTag('TrackRefitterWithoutConstraint'),
133      labelTrajToTrack = cms.InputTag('TrackRefitterWithoutConstraint'),
134      siStripClusters  = cms.InputTag('TrackRefitterWithoutConstraint'),
135      primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
136 +    offlineBeamSpot  = cms.InputTag('offlineBeamSpot'),
137      isLaserRun       = cms.bool(False),
138      isMC             = cms.bool(True),
139 <    algoName         = cms.string("NoAlgo")
139 >    algoName         = cms.string("NoAlgo"),
140 >    trkVertexconstrcoll  = cms.InputTag(''),
141 >    trkMomconstrcoll     = cms.InputTag(''),
142 >    trkFullconstrcoll    = cms.InputTag('')
143   )
144  
145   # ------------------------------------------------------------------------------
146   # B-4) Producer for full TwoBodyDecay constraint
147   # ------------------------------------------------------------------------------
148   process.load("RecoTracker.TrackProducer.TwoBodyDecayConstraintProducer_cff")
149 < #process.TwoBodyDecayConstraint.chi2Cut = 100
149 > process.TwoBodyDecayConstraint.src = "GeomRefitter"
150 > process.TwoBodyDecayConstraint.chi2Cut = 10
151 >
152 >
153  
154   # ------------------------------------------------------------------------------
155   # B-5) Refitter using the full TwoBodyDecay constraint
156   # ------------------------------------------------------------------------------
157   process.TrackRefitterTBDFullConstraint = TrackRefitter.clone(
158 <    src = "AlignmentTrackSelector",
158 >    src = "GeomRefitter",
159      srcConstr = "TwoBodyDecayConstraint",
160      Fitter = cms.string('TwoBodyDecayTrackFitter'),
161      constraint = "trackParameters",
# Line 135 | Line 164 | process.TrackRefitterTBDFullConstraint =
164   # ------------------------------------------------------------------------------
165   # B-6) Fill Tree with full TBD constraint
166   # ------------------------------------------------------------------------------
167 < process.treeproducer2 = cms.EDAnalyzer('AlignmentTree',
167 > process.treeTBDFullConstraints = cms.EDAnalyzer('AlignmentTree',
168      trackLabel       = cms.InputTag('TrackRefitterTBDFullConstraint'),
169      tkTraj           = cms.InputTag('TrackRefitterTBDFullConstraint'),
170      labelTrajToTrack = cms.InputTag('TrackRefitterTBDFullConstraint'),
171      siStripClusters  = cms.InputTag('TrackRefitterTBDFullConstraint'),
172      primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
173 +    offlineBeamSpot  = cms.InputTag('offlineBeamSpot'),
174      isLaserRun       = cms.bool(False),
175      isMC             = cms.bool(True),
176 <    algoName         = cms.string("FullTBD")
176 >    algoName         = cms.string("FullTBD"),
177 >    trkVertexconstrcoll  = cms.InputTag('TwoBodyDecayConstraint'),
178 >    trkMomconstrcoll     = cms.InputTag('TwoBodyDecayConstraint'),
179 >    trkFullconstrcoll    = cms.InputTag('TwoBodyDecayConstraint')
180   )
181  
182   # ------------------------------------------------------------------------------
# Line 151 | Line 184 | process.treeproducer2 = cms.EDAnalyzer('
184   # ------------------------------------------------------------------------------
185   process.load("RecoTracker.TrackProducer.TwoBodyDecayMomConstraintProducer_cff")
186   process.TwoBodyDecayMomConstraint.isMC = True
187 < #process.TwoBodyDecayMomConstraint.chi2Cut = 100
187 > process.TwoBodyDecayMomConstraint.src = "GeomRefitter"
188 > process.TwoBodyDecayMomConstraint.chi2Cut = 10
189  
190   # ------------------------------------------------------------------------------
191   # C-5) Refit the tracks with momentum constraint
192   # ------------------------------------------------------------------------------
193   process.TrackRefitterTBDMomConstraint = TrackRefitter.clone(
194 <    src = "AlignmentTrackSelector",
194 >    src = "GeomRefitter",
195      srcConstr = "TwoBodyDecayMomConstraint",
196      Fitter = cms.string('TwoBodyDecayTrackFitter'),
197      constraint = "momentum",
# Line 166 | Line 200 | process.TrackRefitterTBDMomConstraint =
200   # ------------------------------------------------------------------------------
201   # C-6) Fill Tree with mom TBD constraint
202   # ------------------------------------------------------------------------------
203 < process.treeproducer3 = cms.EDAnalyzer('AlignmentTree',
203 > process.treeTBDMomConstraints = cms.EDAnalyzer('AlignmentTree',
204      trackLabel       = cms.InputTag('TrackRefitterTBDMomConstraint'),
205      tkTraj           = cms.InputTag('TrackRefitterTBDMomConstraint'),
206      labelTrajToTrack = cms.InputTag('TrackRefitterTBDMomConstraint'),
207      siStripClusters  = cms.InputTag('TrackRefitterTBDMomConstraint'),
208      primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
209 +    offlineBeamSpot  = cms.InputTag('offlineBeamSpot'),
210      isLaserRun       = cms.bool(False),
211      isMC             = cms.bool(True),
212 <    algoName         = cms.string("MomTBD")
212 >    algoName         = cms.string("MomTBD"),
213 >    trkVertexconstrcoll  = cms.InputTag('TwoBodyDecayMomConstraint'),
214 >    trkMomconstrcoll     = cms.InputTag('TwoBodyDecayMomConstraint'),
215 >    trkFullconstrcoll    = cms.InputTag('TwoBodyDecayMomConstraint')
216   )
217  
218   # ------------------------------------------------------------------------------
# Line 182 | Line 220 | process.treeproducer3 = cms.EDAnalyzer('
220   # ------------------------------------------------------------------------------
221   process.doConstraintKinFit = cms.EDProducer('ZmassConstraintsProd',
222      isMC             = cms.bool(True),
223 <    trackLabel       = cms.InputTag('AlignmentTrackSelector')
223 >    trackLabel       = cms.InputTag('GeomRefitter')
224   )
225  
226   # ------------------------------------------------------------------------------
227   # D-5) Refitter for KinFit
228   # ------------------------------------------------------------------------------
229   process.TrackRefitterKinFit = TrackRefitter.clone(
230 <    src = "AlignmentTrackSelector",
230 >    src = "GeomRefitter",
231      srcConstr = "doConstraintKinFit",
232      Fitter = cms.string('TwoBodyDecayTrackFitter'),
233      constraint = "momentum",
# Line 198 | Line 236 | process.TrackRefitterKinFit = TrackRefit
236   # ------------------------------------------------------------------------------
237   # D-6) Fill Tree with KinFit constraint
238   # ------------------------------------------------------------------------------
239 < process.treeproducer4 = cms.EDAnalyzer('AlignmentTree',
239 > process.treeKinFitConstraints = cms.EDAnalyzer('AlignmentTree',
240      trackLabel       = cms.InputTag('TrackRefitterKinFit'),
241      tkTraj           = cms.InputTag('TrackRefitterKinFit'),
242      labelTrajToTrack = cms.InputTag('TrackRefitterKinFit'),
243      siStripClusters  = cms.InputTag('TrackRefitterKinFit'),
244      primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
245 +    offlineBeamSpot  = cms.InputTag('offlineBeamSpot'),
246      isLaserRun       = cms.bool(False),
247      isMC             = cms.bool(True),
248 <    algoName         = cms.string("KinFit")
248 >    algoName         = cms.string("KinFit"),
249 >    trkVertexconstrcoll  = cms.InputTag(''),
250 >    trkMomconstrcoll     = cms.InputTag(''),
251 >    trkFullconstrcoll    = cms.InputTag('')
252   )
253  
254   # ------------------------------------------------------------------------------
255 < # E-4) Producer for TwoBodyDecay vertex constraint
255 > # E-4) Producer for TwoBodyDecay vertex constraints
256   # ------------------------------------------------------------------------------
257   process.load("RecoTracker.TrackProducer.TwoBodyDecayVertexConstraintProducer_cff")
258   process.TwoBodyDecayVertexConstraint.isMC = True
259 < #process.TwoBodyDecayVertexConstraint.chi2Cut = 100
259 > process.TwoBodyDecayVertexConstraint.src = "GeomRefitter"
260 > process.TwoBodyDecayVertexConstraint.chi2Cut = 10
261  
262   # ------------------------------------------------------------------------------
263 < # E-5) Producer for TwoBodyDecay vertex constraint
263 > # E-5) Track refitter with vertex constraints
264   # ------------------------------------------------------------------------------
265   process.TrackRefitterTBDVertexConstraint = TrackRefitter.clone(
266 <    src = "AlignmentTrackSelector",
266 >    src = "GeomRefitter",
267      srcConstr = "TwoBodyDecayVertexConstraint",
268      Fitter = cms.string('TwoBodyDecayTrackFitter'),
269      constraint = "vertex",
# Line 229 | Line 272 | process.TrackRefitterTBDVertexConstraint
272   # ------------------------------------------------------------------------------
273   # E-6) Fill Tree with vertex TBD constraint
274   # ------------------------------------------------------------------------------
275 < process.treeproducer5 = cms.EDAnalyzer('AlignmentTree',
275 > process.treeTBDVertexConstraints = cms.EDAnalyzer('AlignmentTree',
276      trackLabel       = cms.InputTag('TrackRefitterTBDVertexConstraint'),
277      tkTraj           = cms.InputTag('TrackRefitterTBDVertexConstraint'),
278      labelTrajToTrack = cms.InputTag('TrackRefitterTBDVertexConstraint'),
279      siStripClusters  = cms.InputTag('TrackRefitterTBDVertexConstraint'),
280      primaryVertexColl= cms.InputTag('offlinePrimaryVertices'),
281 +    offlineBeamSpot  = cms.InputTag('offlineBeamSpot'),
282      isLaserRun       = cms.bool(False),
283      isMC             = cms.bool(True),
284 <    algoName         = cms.string("VtxTBD")
284 >    algoName         = cms.string("VtxTBD"),
285 >    trkVertexconstrcoll  = cms.InputTag('TwoBodyDecayVertexConstraint'),
286 >    trkMomconstrcoll     = cms.InputTag('TwoBodyDecayVertexConstraint'),
287 >    trkFullconstrcoll    = cms.InputTag('TwoBodyDecayVertexConstraint')
288   )
289  
290  
# Line 246 | Line 293 | process.treeproducer5 = cms.EDAnalyzer('
293  
294  
295   process.p = cms.Path( process.AlignmentTrackSelector *
296 <                      process.Refitter *
296 >                      process.GeomRefitter *
297                        process.TrackRefitterWithoutConstraint *
298 <                      process.treeproducer1 *
298 >                      process.treeWithoutConstraints *
299                        process.TwoBodyDecayConstraint *
300                        process.TrackRefitterTBDFullConstraint *
301 <                      process.treeproducer2 *
301 >                      process.treeTBDFullConstraints *
302                        process.TwoBodyDecayMomConstraint *
303                        process.TrackRefitterTBDMomConstraint *
304 <                      process.treeproducer3 *
304 >                      process.treeTBDMomConstraints *
305                        process.doConstraintKinFit *
306                        process.TrackRefitterKinFit *
307 <                      process.treeproducer4*
307 >                      process.treeKinFitConstraints*
308                        process.TwoBodyDecayVertexConstraint *
309                        process.TrackRefitterTBDVertexConstraint *
310 <                      process.treeproducer5)
310 >                      process.treeTBDVertexConstraints
311 >                      )
312  
313   process.outpath = cms.EndPath(process.out)
314 +
315 +
316 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines