501 def makeAlgs (self, config) :
502
503 configFile = None
504 calibSeq = None
505 calibArea = None
506
507 jetCollectionName=self.jetCollection
508 if(self.jetCollection==
"AnalysisJets") :
509 jetCollectionName="AntiKt4EMPFlowJets"
510 if(self.jetCollection==
"AnalysisLargeRJets") :
511 jetCollectionName="AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets"
512
513 if self.largeRMass not in ["Comb", "Calo", "TA"]:
514 raise ValueError("Invalid large-R mass defintion {0}!".format(self.largeRMass) )
515
516 if self.jetInput not in ["LCTopo", "TrackCaloCluster", "UFO"]:
517 raise ValueError("Invalid input type '{0}' for large-R jets!".format(self.jetInput) )
518
519 if self.jetInput == "TrackCaloCluster":
520
521 if self.largeRMass != "Calo":
522 raise ValueError("Invalid large-R TCC jet mass '{0}'!".format(self.largeRMass) )
523 configFile = "JES_MC16recommendation_FatJet_TCC_JMS_calo_30Oct2018.config"
524 if self.jetInput == "LCTopo":
525 configFile = _largeLCTopoConfigFile(config, self)
526 if self.jetInput == "UFO":
527 configFile = "JES_MC20PreRecommendation_R10_UFO_CSSK_SoftDrop_JMS_R21Insitu_26Nov2024.config"
528 calibArea = "00-04-83"
529 if self.calibToolConfigFile is not None:
530 configFile = self.calibToolConfigFile
531
532
533 if self.jetInput == "TrackCaloCluster" or config.dataType() is DataType.FullSim or config.dataType() is DataType.FastSim:
534 calibSeq = "EtaJES_JMS"
535 elif config.dataType() is DataType.Data:
536 calibSeq = "EtaJES_JMS_Insitu"
537 if self.calibToolCalibSeq is not None:
538 calibSeq = self.calibToolCalibSeq
539
540 if self.calibToolCalibArea is not None:
541 calibArea = self.calibToolCalibArea
542
543 if not config.isPhyslite() or self.recalibratePhyslite:
544
545 alg = config.createAlgorithm( 'CP::JetCalibrationAlg', 'JetCalibrationAlg' )
546 config.addPrivateTool( 'calibrationTool', 'JetCalibrationTool' )
547
548 alg.calibrationTool.JetCollection = jetCollectionName[:-4]
549
550 if configFile is None:
551 raise ValueError(f'Unsupported: {self.jetInput=}, {config.dataType()=}')
552 alg.calibrationTool.ConfigFile = configFile
553
554 if calibSeq is None:
555 raise ValueError(f'Unsupported: {self.jetInput=}, {config.dataType()=}')
556 alg.calibrationTool.CalibSequence = calibSeq
557
558 if calibArea is not None:
559 alg.calibrationTool.CalibArea = calibArea
560
561 alg.calibrationTool.IsData = (config.dataType() is DataType.Data)
562 alg.jets = config.readName(self.containerName)
563
564 if self.jetInput == "UFO" and config.dataType() is not DataType.Data:
565
566 alg = config.createAlgorithm( 'CP::JetFFSmearingAlg', 'JetFFSmearingAlg' )
567 self.createFFSmearingTool(alg, config)
568 alg.outOfValidity = 2
569 alg.outOfValidityDeco = 'outOfValidityJMR'
570 alg.jets = config.readName (self.containerName)
571 alg.jetsOut = config.copyName (self.containerName)
572 alg.preselection = config.getPreselection (self.containerName, '')
573
574 if self.minPt > 0 or self.maxPt > 0 or self.maxEta > 0 or self.maxRapidity > 0:
575
576 alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'JetPtEtaCutAlg' )
577 alg.selectionDecoration = 'selectPtEta,as_bits'
578 config.addPrivateTool( 'selectionTool', 'CP::AsgPtEtaSelectionTool' )
579 alg.selectionTool.minPt = self.minPt
580 alg.selectionTool.maxPt = self.maxPt
581 alg.selectionTool.maxEta = self.maxEta
582 alg.selectionTool.maxRapidity = self.maxRapidity
583 alg.particles = config.readName (self.containerName)
584 alg.preselection = config.getPreselection (self.containerName, '')
585 config.addSelection (self.containerName, '', alg.selectionDecoration,
586 preselection=True)
587
588 if self.minMass > 0 or self.maxMass > 0:
589
590 alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'JetMassCutAlg' )
591 alg.selectionDecoration = 'selectMass,as_bits'
592 config.addPrivateTool( 'selectionTool', 'CP::AsgMassSelectionTool' )
593 alg.selectionTool.minM = self.minMass
594 alg.selectionTool.maxM = self.maxMass
595 alg.particles = config.readName (self.containerName)
596 alg.preselection = config.getPreselection (self.containerName, '')
597 config.addSelection (self.containerName, '', alg.selectionDecoration,
598 preselection=True)
599
600 config.addOutputVar (self.containerName, 'm', 'm')
601
602
603
604
605
606
607
608
609
610
611
612
613@groupBlocks