diff --git a/Alignment/OfflineValidation/python/TkAlAllInOneTool/preexistingValidation.py b/Alignment/OfflineValidation/python/TkAlAllInOneTool/preexistingValidation.py index 3c9fc5b9ca1ba..baec6c0bdd2f5 100644 --- a/Alignment/OfflineValidation/python/TkAlAllInOneTool/preexistingValidation.py +++ b/Alignment/OfflineValidation/python/TkAlAllInOneTool/preexistingValidation.py @@ -1,7 +1,7 @@ import os from genericValidation import GenericValidation, GenericValidationData from geometryComparison import GeometryComparison -from helperFunctions import getCommandOutput2, parsecolor, parsestyle +from helperFunctions import boolfromstring, getCommandOutput2, parsecolor, parsestyle from monteCarloValidation import MonteCarloValidation from offlineValidation import OfflineValidation from plottingOptions import PlottingOptions @@ -31,7 +31,7 @@ def __init__(self, valName, config): if "|" in self.title or "," in self.title or '"' in self.title: msg = "The characters '|', '\"', and ',' cannot be used in the alignment title!" raise AllInOneError(msg) - self.needsproxy = bool(int(self.general["needsproxy"])) + self.needsproxy = boolfromstring(self.general["needsproxy"], "needsproxy") self.jobid = self.general["jobid"] if self.jobid: try: #make sure it's actually a valid jobid diff --git a/Alignment/OfflineValidation/scripts/validateAlignments.py b/Alignment/OfflineValidation/scripts/validateAlignments.py index 5744ebd6c2ce6..f77224e6060aa 100755 --- a/Alignment/OfflineValidation/scripts/validateAlignments.py +++ b/Alignment/OfflineValidation/scripts/validateAlignments.py @@ -297,7 +297,7 @@ def createMergeScript( path, validations, options ): for validation in validations: for referenceName in validation.filesToCompare: validationtype = type(validation) - if isinstance(validationtype, PreexistingValidation): + if issubclass(validationtype, PreexistingValidation): #find the actual validationtype for parentclass in validationtype.mro(): if not issubclass(parentclass, PreexistingValidation): diff --git a/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h b/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h index 12751a62770b6..f334b8897ff1a 100644 --- a/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h +++ b/CalibCalorimetry/HcalAlgos/interface/HcalPulseShape.h @@ -6,9 +6,9 @@ class HcalPulseShape { public: HcalPulseShape(); + HcalPulseShape(const std::vector&,unsigned); void setNBin(int n); void setShapeBin(int i, float f); - float getTpeak() const { return tpeak_; } float operator()(double time) const; float at(double time) const; float integrate(double tmin, double tmax) const; @@ -16,7 +16,6 @@ class HcalPulseShape { private: std::vector shape_; int nbin_; - float tpeak_; }; #endif diff --git a/CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h b/CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h index 6bfcdb8728a35..a525294972a30 100644 --- a/CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h +++ b/CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h @@ -65,19 +65,47 @@ class HcalPulseShapes { } return result; } + static std::vector normalize(std::vector nt, unsigned nbin){ + //skip first bin, always 0 + double norm = 0.; + for (unsigned int j = 1; j <= nbin; ++j) { + norm += (nt[j]>0) ? nt[j] : 0.; + } + + double normInv=1./norm; + for (unsigned int j = 1; j <= nbin; ++j) { + nt[j] *= normInv; + } + + return nt; + } + static std::vector normalizeShift(std::vector nt, unsigned nbin, int shift){ + //skip first bin, always 0 + double norm = 0.; + for (unsigned int j = std::max(1,-1*shift); j<=nbin; j++) { + norm += std::max(0., nt[j-shift]); + } + double normInv=1./norm; + std::vector nt2(nbin,0); + for ( int j = 1; j<=(int)nbin; j++) { + if ( j-shift>=0 ) { + nt2[j] = nt[j-shift]*normInv; + } + } + return nt2; + } private: void computeHPDShape(float, float, float, float, float , float, float, float, Shape&); void computeHFShape(); void computeSiPMShapeHO(); - void computeSiPMShapeHE203(); - void computeSiPMShapeHE206(); + const HcalPulseShape& computeSiPMShapeHE203(); + const HcalPulseShape& computeSiPMShapeHE206(); void computeSiPMShapeData2017(); void computeSiPMShapeData2018(); Shape hpdShape_, hfShape_, siPMShapeHO_; - Shape siPMShapeMC2017_, siPMShapeData2017_; - Shape siPMShapeMC2018_, siPMShapeData2018_; + Shape siPMShapeData2017_, siPMShapeData2018_; Shape hpdShape_v2, hpdShapeMC_v2; Shape hpdShape_v3, hpdShapeMC_v3; Shape hpdBV30Shape_v2, hpdBV30ShapeMC_v2; diff --git a/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc b/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc index 72d21c603c7b0..1cae3776d730a 100644 --- a/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc +++ b/CalibCalorimetry/HcalAlgos/src/HcalPulseShape.cc @@ -2,9 +2,15 @@ HcalPulseShape::HcalPulseShape() { nbin_=0; - tpeak_=0; } +HcalPulseShape::HcalPulseShape(const std::vector& shape, unsigned nbin) : + shape_(shape.begin(),shape.begin()+nbin), + nbin_(nbin) +{ +} + + void HcalPulseShape::setNBin(int n) { nbin_=n; shape_=std::vector(n,0.0f); diff --git a/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc b/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc index 5ca3d9e9f1f0c..0a048b34b22bb 100644 --- a/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc +++ b/CalibCalorimetry/HcalAlgos/src/HcalPulseShapes.cc @@ -77,16 +77,14 @@ Reco MC computeHFShape(); computeSiPMShapeHO(); - computeSiPMShapeHE203(); - computeSiPMShapeHE206(); computeSiPMShapeData2017(); computeSiPMShapeData2018(); theShapes[201] = &siPMShapeHO_; theShapes[202] = theShapes[201]; - theShapes[203] = &siPMShapeMC2017_; + theShapes[203] = &(computeSiPMShapeHE203()); theShapes[205] = &siPMShapeData2017_; - theShapes[206] = &siPMShapeMC2018_; + theShapes[206] = &(computeSiPMShapeHE206()); theShapes[207] = &siPMShapeData2018_; theShapes[301] = &hfShape_; //theShapes[401] = new CaloCachedShapeIntegrator(&theZDCShape); @@ -380,50 +378,19 @@ void HcalPulseShapes::computeSiPMShapeHO() } } -void HcalPulseShapes::computeSiPMShapeHE203() +const HcalPulseShape& HcalPulseShapes::computeSiPMShapeHE203() { //numerical convolution of SiPM pulse + WLS fiber shape - std::vector nt = convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11203); - - siPMShapeMC2017_.setNBin(nBinsSiPM_); - - //skip first bin, always 0 - double norm = 0.; - for (unsigned int j = 1; j <= nBinsSiPM_; ++j) { - norm += (nt[j]>0) ? nt[j] : 0.; - } - - for (unsigned int j = 1; j <= nBinsSiPM_; ++j) { - nt[j] /= norm; - siPMShapeMC2017_.setShapeBin(j,nt[j]); - } + static const HcalPulseShape siPMShapeMC2017(normalize(convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11203),nBinsSiPM_),nBinsSiPM_); + return siPMShapeMC2017; } -void HcalPulseShapes::computeSiPMShapeHE206() +const HcalPulseShape& HcalPulseShapes::computeSiPMShapeHE206() { //numerical convolution of SiPM pulse + WLS fiber shape - std::vector nt = convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11206); - - siPMShapeMC2018_.setNBin(nBinsSiPM_); - - //Aligning 206 phase closer to 205 in order to have good reco agreement - int shift = -2; - - //skip first bin, always 0 - double norm = 0.; - for (unsigned int j = std::max(1,-1*shift); j<=nBinsSiPM_; j++) { - norm += std::max(0., nt[j-shift]); - } - double normInv=1./norm; - for ( int j = 1; j<=nBinsSiPM_; j++) { - if ( j-shift>=0 ) { - nt[j-shift]*=normInv; - siPMShapeMC2018_.setShapeBin(j,nt[j-shift]); - } - else{ - siPMShapeMC2018_.setShapeBin(j,0); - } - } + //shift: aligning 206 phase closer to 205 in order to have good reco agreement + static const HcalPulseShape siPMShapeMC2018(normalizeShift(convolve(nBinsSiPM_,analyticPulseShapeSiPMHE,Y11206),nBinsSiPM_,-2),nBinsSiPM_); + return siPMShapeMC2018; } const HcalPulseShapes::Shape & diff --git a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h index 1e8106c233031..160651c147a1a 100644 --- a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h +++ b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h @@ -64,9 +64,7 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { static const int QIE8_LUT_BITMASK = 0x3FF; static const int QIE10_LUT_BITMASK = 0x7FF; - static const int QIE11_LUT_BITMASK = 0x7FF; - // only the lowest 10 bits were used in 2017 - static const int QIE11_LUT_BITMASK_2017 = 0x3FF; + static const int QIE11_LUT_BITMASK = 0x3FF; private: // typedef @@ -79,8 +77,8 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { static const int nFi_ = 72; static const int QIE8_LUT_MSB = 0x400; - static const int QIE11_LUT_MSB0 = 0x800; - static const int QIE11_LUT_MSB1 = 0x1000; + static const int QIE11_LUT_MSB0 = 0x400; + static const int QIE11_LUT_MSB1 = 0x800; static const int QIE10_LUT_MSB = 0x1000; // member variables diff --git a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc index 46f3c73f00605..f0f29135233d8 100644 --- a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc +++ b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc @@ -35,7 +35,6 @@ const float HcaluLUTTPGCoder::lsb_=1./16; const int HcaluLUTTPGCoder::QIE8_LUT_BITMASK; const int HcaluLUTTPGCoder::QIE10_LUT_BITMASK; const int HcaluLUTTPGCoder::QIE11_LUT_BITMASK; -const int HcaluLUTTPGCoder::QIE11_LUT_BITMASK_2017; constexpr double MaximumFractionalError = 0.002; // 0.2% error allowed from this source @@ -348,8 +347,7 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { const size_t SIZE = qieType==QIE8 ? INPUT_LUT_SIZE : UPGRADE_LUT_SIZE; const int MASK = qieType==QIE8 ? QIE8_LUT_BITMASK : - qieType==QIE10 ? QIE10_LUT_BITMASK : - is2018OrLater ? QIE11_LUT_BITMASK : QIE11_LUT_BITMASK_2017; + qieType==QIE10 ? QIE10_LUT_BITMASK : QIE11_LUT_BITMASK; double linearLSB = linearLSB_QIE8_; if (qieType == QIE11 and cell.ietaAbs() == topo_->lastHBRing()) linearLSB = linearLSB_QIE11Overlap_; diff --git a/CalibTracker/SiPixelESProducers/interface/SiPixel2DTemplateDBObjectESProducer.h b/CalibTracker/SiPixelESProducers/interface/SiPixel2DTemplateDBObjectESProducer.h new file mode 100644 index 0000000000000..3c6a6d7ed93ea --- /dev/null +++ b/CalibTracker/SiPixelESProducers/interface/SiPixel2DTemplateDBObjectESProducer.h @@ -0,0 +1,33 @@ +#ifndef CalibTracker_SiPixelESProducers_SiPixel2DTemplateDBObjectESProducer_h +#define CalibTracker_SiPixelESProducers_SiPixel2DTemplateDBObjectESProducer_h +// -*- C++ -*- +// +// Package: SiPixel2DTemplateDBObjectESProducer +// Class: SiPixel2DTemplateDBObjectESProducer +// +/**\class SiPixel2DTemplateDBObjectESProducer SiPixel2DTemplateDBObjectESProducer.cc CalibTracker/SiPixelESProducers/plugin/SiPixel2DTemplateDBObjectESProducer.cc + + Description: ESProducer for magnetic-field-dependent local reco templates + + Implementation: Used inside the RecoLocalTracker/Records/TkPixelRecord to select the correct db for given magnetic field +*/ +// +// Original Author: D.Fehling +// Created: Tue Sep 29 14:49:31 CET 2009 +// +// + +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" +#include "CalibTracker/Records/interface/SiPixel2DTemplateDBObjectESProducerRcd.h" + +class SiPixel2DTemplateDBObjectESProducer : public edm::ESProducer { + +public: + + SiPixel2DTemplateDBObjectESProducer(const edm::ParameterSet& iConfig); + ~SiPixel2DTemplateDBObjectESProducer() override; + std::shared_ptr produce(const SiPixel2DTemplateDBObjectESProducerRcd &); + }; +#endif diff --git a/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h b/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h index 09ae4d2ee3ed0..bcd45dc5e7fbf 100644 --- a/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h +++ b/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h @@ -73,6 +73,8 @@ class SiPixelGainCalibrationServicePayloadGetter : public SiPixelGainCalibration void setESObjects(const edm::EventSetup& es ) override; + thePayloadObject const & payload() const { return *ped; } + std::vector getDetIds() override; double getGainLow() override; double getGainHigh() override; diff --git a/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc b/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc new file mode 100644 index 0000000000000..511d58b044e9d --- /dev/null +++ b/CalibTracker/SiPixelESProducers/plugins/SiPixel2DTemplateDBObjectESProducer.cc @@ -0,0 +1,64 @@ +// -*- C++ -*- +// Package: SiPixelESProducers +// Class: SiPixel2DTemplateDBObjectESProducer +// Original Author: D.Fehling +// Created: Tue Sep 29 14:49:31 CET 2009 +// + +#include "CalibTracker/SiPixelESProducers/interface/SiPixel2DTemplateDBObjectESProducer.h" + +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/do_nothing_deleter.h" + +#include +#include "boost/mpl/vector.hpp" + +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "MagneticField/Engine/interface/MagneticField.h" + +using namespace edm; + +SiPixel2DTemplateDBObjectESProducer::SiPixel2DTemplateDBObjectESProducer(const edm::ParameterSet& iConfig) { + setWhatProduced(this); +} + + +SiPixel2DTemplateDBObjectESProducer::~SiPixel2DTemplateDBObjectESProducer(){ +} + + + + +std::shared_ptr SiPixel2DTemplateDBObjectESProducer::produce(const SiPixel2DTemplateDBObjectESProducerRcd & iRecord) { + + ESHandle magfield; + iRecord.getRecord().get(magfield); + + GlobalPoint center(0.0, 0.0, 0.0); + float theMagField = magfield.product()->inTesla(center).mag(); + + // std::string label = "numerator"; // &&& Temporary: matches Barrel Layer1 for 2017 data + // std::string label = "denominator"; // &&& Temporary: matches Barrel Layer1 fullsim MC + std::string label = ""; // the correct default + + if( theMagField>=-0.1 && theMagField<1.0 ) label = "0T"; + else if(theMagField>=1.0 && theMagField<2.5 ) label = "2T"; + else if(theMagField>=2.5 && theMagField<3.25) label = "3T"; + else if(theMagField>=3.25 && theMagField<3.65) label = "35T"; + else if(theMagField>=3.9 && theMagField<4.1 ) label = "4T"; + else { + //label = "3.8T"; + if(theMagField>=4.1 || theMagField<-0.1) edm::LogWarning("UnexpectedMagneticFieldUsingDefaultPixel2DTemplate") << "Magnetic field is " << theMagField; + } + ESHandle dbobject; + iRecord.getRecord().get(label,dbobject); + + if(std::fabs(theMagField-dbobject->sVector()[22])>0.1) + edm::LogWarning("UnexpectedMagneticFieldUsingNonIdealPixel2DTemplate") << "Magnetic field is " << theMagField << " Template Magnetic field is " << dbobject->sVector()[22]; + + return std::shared_ptr(const_cast(&(*dbobject)), edm::do_nothing_deleter()); +} + +DEFINE_FWK_EVENTSETUP_MODULE(SiPixel2DTemplateDBObjectESProducer); diff --git a/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py b/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py new file mode 100644 index 0000000000000..659a654f6f1e7 --- /dev/null +++ b/CalibTracker/SiPixelESProducers/python/SiPixel2DTemplateDBObjectESProducer_cfi.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +siPixel2DTemplateDBObjectESProducer = cms.ESProducer("SiPixel2DTemplateDBObjectESProducer") + diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h index dde44c835e9ce..21a784ebae6bf 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h @@ -25,16 +25,16 @@ class SiPixelDetectorStatus { void addModule(int detid, SiPixelModuleStatus a); // fill hit in double idc in ROC roc into module detid - void fillDIGI(int detid, int roc, int idc); - // fill stuck TBM info - void fillStuckTBM(int detid, PixelFEDChannel ch, std::time_t time); + void fillDIGI(int detid, int roc); + // fill FEDerror25 info + void fillFEDerror25(int detid, PixelFEDChannel ch); - std::map> getStuckTBMsRocs(); + std::map> getFEDerror25Rocs(); // determine detector average nhits and RMS - void digiOccupancy(); - double perRocDigiOcc(){ digiOccupancy(); return fDetAverage; } - double perRocDigiOccVar(){ digiOccupancy(); return fDetSigma; } + double perRocDigiOcc(); + double perRocDigiOccVar(); + unsigned long int digiOccDET(){ return fDetHits; } // number of modules in detector @@ -54,21 +54,17 @@ class SiPixelDetectorStatus { std::pair getRunRange() {return std::make_pair(fRun0,fRun1);} void setLSRange(int ls0, int ls1) {fLS0 = ls0; fLS1 = ls1;} std::pair getLSRange() {return std::make_pair(fLS0,fLS1);} - void setRefTime(std::time_t refTime0, std::time_t refTime1) {fTime0 = refTime0; fTime1 = refTime1;} - std::pair getRefTime() {return std::make_pair(fTime0,fTime1);} // total processed events void setNevents(unsigned long int N){ fNevents = N; } unsigned long int getNevents(){ return fNevents; } - void resetDetectorStatus() { fModules.clear(); fDetAverage=0; fDetSigma=0; fDetHits=0; fNevents=0; + void resetDetectorStatus() { fModules.clear(); fDetHits=0; fNevents=0; fRun0 = 99999999; fRun1 = 0; fLS0 = 99999999; fLS1 = 0; - fTime0 = 0; fTime1 = 0; } // combine detector status void updateDetectorStatus(SiPixelDetectorStatus newData); - SiPixelDetectorStatus combineDetectorStatus(SiPixelDetectorStatus newData); // detector status std::map getDetectorStatus(){ return fModules; } @@ -79,19 +75,12 @@ class SiPixelDetectorStatus { // first and last lumisection seen in this instance int fLS0, fLS1; - - // first and last run seen in this instance (likely to be the same number!) + // first and last run seen in this instance (should be the same number!) int fRun0, fRun1; - // being and end time stamp - std::time_t fTime0, fTime1; - // number of events processed unsigned long int fNevents; - // average (per module) number of hits over entire detector - double fDetAverage, fDetSigma; - // total hits in detector unsigned long int fDetHits; diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h index f8791ce030930..c9c8fc6f5acfe 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h @@ -16,22 +16,19 @@ class SiPixelModuleStatus { ~SiPixelModuleStatus(); /// fill with online coordinates - void fillDIGI(int iroc, int idc); + void fillDIGI(int iroc); /// fill with online coordinates (nhit > 1) - void updateDIGI(int iroc, int idc, unsigned long nhit); + void updateDIGI(int iroc, unsigned int nhit); - /// fill stuck TBM - void fillStuckTBM( PixelFEDChannel ch, std::time_t time ); - - /// return DC status of a ROC (=hits on DC idc on ROC iroc) - unsigned long int digiOccDC(int iroc, int idc); + /// fill FEDerror25 + void fillFEDerror25( PixelFEDChannel ch ); /// return ROC status (= hits on ROC iroc) - unsigned long int digiOccROC(int iroc); + unsigned int digiOccROC(int iroc); /// return module status (= hits on module) - unsigned long int digiOccMOD(); + unsigned int digiOccMOD(); /// get a ROC SiPixelRocStatus* getRoc(int i); @@ -42,18 +39,16 @@ class SiPixelModuleStatus { void setNrocs(int iroc); /// calculate (averaged over this module's ROCs) mean hit number and its sigma - void digiOccupancy(); double perRocDigiOcc(); double perRocDigiOccVar(); /// combine new data to update(topup) module status - void updateModuleDIGI(int roc, int dc, unsigned long int nhits); + void updateModuleDIGI(int roc, unsigned int nhits); void updateModuleStatus(SiPixelModuleStatus newData); private: int fDetid, fNrocs; - double fModAverage, fModSigma; std::vector fRocs; }; diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h b/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h index 910ef7242b5bb..8606b6a4b867d 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelRocStatus.h @@ -1,42 +1,25 @@ #ifndef SIPIXELROCSTATUS_h #define SIPIXELROCSTATUS_h -#include - // ---------------------------------------------------------------------- class SiPixelRocStatus { public: SiPixelRocStatus(); ~SiPixelRocStatus(); - void fillDIGI(int idc); - void updateDIGI(int idc, unsigned long int hits); - - void fillStuckTBM(unsigned int fed, unsigned int link, std::time_t time); - void updateStuckTBM(unsigned int fed, unsigned int link, std::time_t time, unsigned long int freq); + void fillDIGI(); + void updateDIGI(unsigned int hits); + void fillFEDerror25(); // stuckTBM - bool isStuckTBM(){ return isStuckTBM_; } - unsigned int getBadFed(){ return badFed_; } - unsigned int getBadLink(){ return badLink_; } - std::time_t getStartBadTime(){ return startBadTime_; } - unsigned long int getBadFreq(){ return badFreq_; } + bool isFEDerror25(){ return isFEDerror25_; } // occpancy - unsigned long int digiOccDC(int idc); - unsigned long int digiOccROC(); - - int nDC(){ return nDC_;} - + unsigned int digiOccROC(); private: - const int nDC_ = 26; - unsigned long int fDC[26]; - bool isStuckTBM_; - unsigned int badFed_; - unsigned int badLink_; - std::time_t startBadTime_; - unsigned long int badFreq_; + unsigned int fDC; + bool isFEDerror25_; }; diff --git a/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h b/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h index 882845ef2e2a1..388c6794a0e1b 100644 --- a/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h +++ b/CalibTracker/SiPixelQuality/interface/SiPixelStatusManager.h @@ -15,6 +15,8 @@ #include #include #include +#include // std::sort +#include // std::vector //Data format #include "CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h" @@ -29,24 +31,24 @@ class SiPixelStatusManager { void reset(); void readLumi(const edm::LuminosityBlock&); - void createStuckTBMs(); - void createBadComponents(); - - void createPayloads(){ - createStuckTBMs(); - createBadComponents(); - } + void createPayloads(); const std::map& getBadComponents(){return siPixelStatusMap_; } - const std::map> >& getStuckTBMsRocs(){return stuckTBMsMap_;} + const std::map> >& getFEDerror25Rocs(){return FEDerror25Map_;} typedef std::map::iterator siPixelStatusMap_iterator; - typedef std::map> >::iterator stuckTBMsMap_iterator; + typedef std::map> >::iterator FEDerror25Map_iterator; + typedef std::vector::iterator siPixelStatusVtr_iterator; private: + static bool rankByLumi(SiPixelDetectorStatus status1, SiPixelDetectorStatus status2); + void createFEDerror25(); + void createBadComponents(); + + std::vector siPixelStatusVtr_; std::map siPixelStatusMap_; - std::map> > stuckTBMsMap_; + std::map> > FEDerror25Map_; std::string outputBase_; int aveDigiOcc_; diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc index fe7cd4d8d9529..d5ad30eb76a1e 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc @@ -44,16 +44,14 @@ using namespace edm; //-------------------------------------------------------------------------------------------------- SiPixelStatusHarvester::SiPixelStatusHarvester(const edm::ParameterSet& iConfig) : outputBase_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("outputBase")), - aveDigiOcc_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("aveDigiOcc", 20000)), + aveDigiOcc_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("aveDigiOcc")), nLumi_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("resetEveryNLumi")), moduleName_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("moduleName")), label_(iConfig.getParameter("SiPixelStatusManagerParameters").getUntrackedParameter("label")), - siPixelStatusManager_(iConfig, consumesCollector()) { + siPixelStatusManager_(iConfig, consumesCollector()){ + debug_ = iConfig.getUntrackedParameter("debug"); recordName_ = iConfig.getUntrackedParameter("recordName", "SiPixelQualityFromDbRcd"); - debug_ = iConfig.getUntrackedParameter("debug",false); - dumpTxt_ = iConfig.getUntrackedParameter("dumpTxt",false); - outTxtFileName_ = iConfig.getUntrackedParameter("txtFileName"); } @@ -86,7 +84,7 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& siPixelStatusManager_.createPayloads(); - std::map> > stuckTBMsMap = siPixelStatusManager_.getStuckTBMsRocs(); + std::map> > FEDerror25Map = siPixelStatusManager_.getFEDerror25Rocs(); std::map siPixelStatusMap = siPixelStatusManager_.getBadComponents(); edm::Service poolDbService; @@ -100,8 +98,13 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& siPixelQualityPermBad->addDisabledModule(badComponentList[i]); } + // IOV for final payloads. FEDerror25 and pcl + std::map finalIOV; + std::map fedError25IOV; + std::map pclIOV; + // stuckTBM tag from FED error 25 with permanent component removed - for(SiPixelStatusManager::stuckTBMsMap_iterator it=stuckTBMsMap.begin(); it!=stuckTBMsMap.end();it++){ + for(SiPixelStatusManager::FEDerror25Map_iterator it=FEDerror25Map.begin(); it!=FEDerror25Map.end();it++){ cond::Time_t thisIOV = 1; edm::LuminosityBlockID lu(iRun.id().run(),it->first); @@ -109,8 +112,8 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& SiPixelQuality *siPixelQuality = new SiPixelQuality(); - std::map > tmpStuckTBMs = it->second; - for(std::map >::iterator ilist = tmpStuckTBMs.begin(); ilist!=tmpStuckTBMs.end();ilist++){ + std::map > tmpFEDerror25 = it->second; + for(std::map >::iterator ilist = tmpFEDerror25.begin(); ilist!=tmpFEDerror25.end();ilist++){ int detid = ilist->first; @@ -143,35 +146,37 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& BadModule.BadRocs = badrocs; siPixelQuality->addDisabledModule(BadModule); } - } - if (poolDbService->isNewTagRequest(recordName_+"_stuckTBM") ) { - edm::LogInfo("SiPixelStatusHarvester") - << "new tag requested for stuckTBM" << std::endl; - poolDbService->writeOne(siPixelQuality, thisIOV, recordName_+"_stuckTBM"); - } - else { - edm::LogInfo("SiPixelStatusHarvester") - << "no new tag requested, appending IOV for stuckTBM" << std::endl; - poolDbService->writeOne(siPixelQuality, thisIOV, recordName_+"_stuckTBM"); - } + } // loop over modules + + finalIOV[it->first] = it->first; + fedError25IOV[it->first] = it->first; + + poolDbService->writeOne(siPixelQuality, thisIOV, recordName_+"_stuckTBM"); } - // Payload for PCL combines permanent bad/stuckTBM/other + // IOV for PCL combines permanent bad/stuckTBM/other for(SiPixelStatusManager::siPixelStatusMap_iterator it=siPixelStatusMap.begin(); it!=siPixelStatusMap.end();it++){ + finalIOV[it->first] = it->first; + pclIOV[it->first] = it->first; + } + + // loop over final IOV + std::map::iterator itIOV; + for(itIOV=finalIOV.begin();itIOV!=finalIOV.end();itIOV++){ cond::Time_t thisIOV = 1; + edm::LuminosityBlockID lu(iRun.id().run(),itIOV->first); + thisIOV = (cond::Time_t)(lu.value()); - if (outputBase_ == "runbased") { - thisIOV = (cond::Time_t) iRun.id().run(); - } - else if (outputBase_ == "nLumibased" || outputBase_ == "dynamicLumibased" ) { - edm::LuminosityBlockID lu(iRun.id().run(),it->first); - thisIOV = (cond::Time_t)(lu.value()); - } + edm::LuminosityBlockNumber_t lumiStuckTBMs = SiPixelStatusHarvester::stepIOV(itIOV->first,fedError25IOV); + edm::LuminosityBlockNumber_t lumiPCL = SiPixelStatusHarvester::stepIOV(itIOV->first,pclIOV); - SiPixelDetectorStatus tmpSiPixelStatus = it->second; + // get badROC list due to FEDerror25 = stuckTBM + permanent bad components + std::map > tmpFEDerror25 = FEDerror25Map[lumiStuckTBMs]; + // get SiPixelDetectorStatus + SiPixelDetectorStatus tmpSiPixelStatus = siPixelStatusMap[lumiPCL]; double DetAverage = tmpSiPixelStatus.perRocDigiOcc(); // For the IOV of which the statistics is too low, for e.g., a cosmic run @@ -195,21 +200,16 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& /////////////////////////////////////////////////////////////////////////////////////////////////// // create the DB object - // payload including all : permanent bad + other + stuckTBM + // payload including all : PCL = permanent bad + other + stuckTBM SiPixelQuality *siPixelQualityPCL = new SiPixelQuality(); - // payload for prompt reco : permanent bad + other sources of bad components SiPixelQuality *siPixelQualityPrompt = new SiPixelQuality(); - // payload for : other sources of bad components SiPixelQuality *siPixelQualityOther = new SiPixelQuality(); - // get badROC list due to stuck TBM - std::map > tmpStuckTBMs = tmpSiPixelStatus.getStuckTBMsRocs(); - std::map detectorStatus = tmpSiPixelStatus.getDetectorStatus(); std::map::iterator itModEnd = detectorStatus.end(); for (std::map::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) { - // create the bad module list + // create the bad module list for PCL, prompt and other SiPixelQuality::disabledModuleType BadModulePCL, BadModulePrompt, BadModuleOther; int detid = itMod->first; @@ -225,7 +225,7 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& std::vector BadRocListPCL, BadRocListPrompt, BadRocListOther; SiPixelModuleStatus modStatus = itMod->second; - std::vector listStuckTBM = tmpStuckTBMs[detid]; + std::vector listFEDerror25 = tmpFEDerror25[detid]; for (int iroc = 0; iroc < modStatus.nrocs(); ++iroc) { @@ -234,89 +234,73 @@ void SiPixelStatusHarvester::endRun(const edm::Run& iRun, const edm::EventSetup& // Bad ROC are from low DIGI Occ ROCs if(rocOccupancy<1.e-4*DetAverage){ + //PCL bad roc list BadRocListPCL.push_back(uint32_t(iroc)); - std::vector::iterator it = std::find(listStuckTBM.begin(), listStuckTBM.end(),iroc); - - // from prompt = permanent bad + other - if(it==listStuckTBM.end() || badPixelInfo_->IsRocBad(detid, iroc)) - // if permanent or not stuck TBM( in the stuckTBM list but not permanent) - BadRocListPrompt.push_back(uint32_t(iroc)); - - // other source of bad components - if(it==listStuckTBM.end() && !(badPixelInfo_->IsRocBad(detid, iroc))) - // if not permanent and not stuck TBM - BadRocListOther.push_back(uint32_t(iroc)); - + //FEDerror25 list + std::vector::iterator it = std::find(listFEDerror25.begin(), listFEDerror25.end(),iroc); + + // from prompt = PCL bad - stuckTBM = PCL bad - FEDerror25 + permanent bad + if(it==listFEDerror25.end() || badPixelInfo_->IsRocBad(detid, iroc)) + // if not FEDerror25 or permanent bad + BadRocListPrompt.push_back(uint32_t(iroc)); + + // other source of bad components = prompt - permanent bad = PCL bad - FEDerror25 + // or to be safe, say not FEDerro25 and not permanent bad + if(it==listFEDerror25.end() && !(badPixelInfo_->IsRocBad(detid, iroc))) + // if not permanent and not stuck TBM + BadRocListOther.push_back(uint32_t(iroc)); + } - } + + } // loop over ROCs if(BadRocListPCL.size()==16) BadModulePCL.errorType = 0; if(BadRocListPrompt.size()==16) BadModulePrompt.errorType = 0; if(BadRocListOther.size()==16) BadModuleOther.errorType = 0; + // pcl short badrocsPCL = 0; for(std::vector::iterator iterPCL = BadRocListPCL.begin(); iterPCL != BadRocListPCL.end(); ++iterPCL){ badrocsPCL += 1 << *iterPCL; // 1 << *iter = 2^{*iter} using bitwise shift } - // fill the badmodule only if there is(are) bad ROC(s) in it if(badrocsPCL!=0){ BadModulePCL.BadRocs = badrocsPCL; siPixelQualityPCL->addDisabledModule(BadModulePCL); } + // prompt short badrocsPrompt = 0; for(std::vector::iterator iterPrompt = BadRocListPrompt.begin(); iterPrompt != BadRocListPrompt.end(); ++iterPrompt){ badrocsPrompt += 1 << *iterPrompt; // 1 << *iter = 2^{*iter} using bitwise shift } - // fill the badmodule only if there is(are) bad ROC(s) in it if(badrocsPrompt!=0){ BadModulePrompt.BadRocs = badrocsPrompt; siPixelQualityPrompt->addDisabledModule(BadModulePrompt); } - short badrocsOther = 0; + // other + short badrocsOther= 0; for(std::vector::iterator iterOther = BadRocListOther.begin(); iterOther != BadRocListOther.end(); ++iterOther){ badrocsOther += 1 << *iterOther; // 1 << *iter = 2^{*iter} using bitwise shift } - // fill the badmodule only if there is(are) bad ROC(s) in it if(badrocsOther!=0){ BadModuleOther.BadRocs = badrocsOther; siPixelQualityOther->addDisabledModule(BadModuleOther); } - + } // end module loop + + //PCL + if(debug_==true) // only produce the tag for all sources of bad components for debugging reason + poolDbService->writeOne(siPixelQualityPCL, thisIOV, recordName_+"_PCL"); - if(debug_) // only produce the tag for all sources of bad components for debugging reason - poolDbService->writeOne(siPixelQualityPCL, thisIOV, recordName_+"_PCL"); - - if (poolDbService->isNewTagRequest(recordName_+"_prompt")) { - edm::LogInfo("SiPixelStatusHarvester") - << "new tag requested for prompt" << std::endl; - poolDbService->writeOne(siPixelQualityPrompt, thisIOV, recordName_+"_prompt"); - } - else { - edm::LogInfo("SiPixelStatusHarvester") - << "no new tag requested, appending IOV for prompt" << std::endl; - poolDbService->writeOne(siPixelQualityPrompt, thisIOV, recordName_+"_prompt"); - } - - if (poolDbService->isNewTagRequest(recordName_+"_other")) { - edm::LogInfo("SiPixelStatusHarvester") - << "new tag requested for other" << std::endl; - poolDbService->writeOne(siPixelQualityOther, thisIOV, recordName_+"_other"); - } - else { - edm::LogInfo("SiPixelStatusHarvester") - << "no new tag requested, appending IOV for other" << std::endl; - poolDbService->writeOne(siPixelQualityOther, thisIOV, recordName_+"_other"); - } + // prompt + poolDbService->writeOne(siPixelQualityPrompt, thisIOV, recordName_+"_prompt"); - if (dumpTxt_){ // text dump for the DIGI occuancy for all pixels in all ROCs for the pixle detector - std::string outTxt = Form("%s_Run%d_Lumi%d_SiPixelStatus.txt", outTxtFileName_.c_str(), iRun.id().run(),it->first); - tmpSiPixelStatus.dumpToFile(outTxt); - } + // other + poolDbService->writeOne(siPixelQualityOther, thisIOV, recordName_+"_other"); - }// loop over IOV-structured Map (payloads) + }// loop over IOV // Add a dummy IOV starting from last lumisection+1 to close the tag for the run if(outputBase_ == "nLumibased" || outputBase_ == "dynamicLumibased"){ @@ -350,5 +334,30 @@ void SiPixelStatusHarvester::endLuminosityBlock(const edm::LuminosityBlock& iLum } +// step function for IOV +edm::LuminosityBlockNumber_t SiPixelStatusHarvester::stepIOV(edm::LuminosityBlockNumber_t pin, std::map IOV){ + + std::map::iterator itIOV; + for(itIOV=IOV.begin();itIOV!=IOV.end();itIOV++){ + std::map::iterator nextItIOV; + nextItIOV = itIOV; nextItIOV++; + + if(nextItIOV!=IOV.end()){ + if(pin>=itIOV->first && pinfirst){ + return itIOV->first; + } + } + else{ + if(pin>=itIOV->first){ + return itIOV->first; + } + } + + } + + // return the firstIOV in case all above fail + return (IOV.begin())->first; + +} DEFINE_FWK_MODULE(SiPixelStatusHarvester); diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h index f2f04b0fccebc..e27b965657afc 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.h @@ -30,7 +30,6 @@ class SiPixelStatusHarvester : public edm::EDAnalyzer { protected: private: - bool debug_; // Parameters std::string outputBase_; int aveDigiOcc_; @@ -39,6 +38,8 @@ class SiPixelStatusHarvester : public edm::EDAnalyzer { std::string label_; // harvest helper classs that setup the IOV structure SiPixelStatusManager siPixelStatusManager_; + // debug mode + bool debug_; // for DB output naming std::string recordName_; @@ -48,9 +49,8 @@ class SiPixelStatusHarvester : public edm::EDAnalyzer { // last lumi section of the SiPixeDetectorStatus data edm::LuminosityBlockNumber_t endLumiBlock_; - // only for debugging - bool dumpTxt_; - std::string outTxtFileName_; + // "step function" for IOV + edm::LuminosityBlockNumber_t stepIOV(edm::LuminosityBlockNumber_t pin, std::map IOV); }; diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc index 6184e9df60d69..5aabc3c71e7eb 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusProducer.cc @@ -28,7 +28,7 @@ #include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h" #include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h" #include "DataFormats/SiPixelDigi/interface/PixelDigi.h" -// "FED error 25" - stuck TBM +// "FED error 25" #include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" // CMSSW CondFormats @@ -62,7 +62,6 @@ SiPixelStatusProducer::SiPixelStatusProducer(const edm::ParameterSet& iConfig){ fPixelClusterLabel_ = iConfig.getParameter("SiPixelStatusProducerParameters").getUntrackedParameter("pixelClusterLabel"); fSiPixelClusterToken_ = consumes>(fPixelClusterLabel_); - monitorOnDoubleColumn_ = iConfig.getParameter("SiPixelStatusProducerParameters").getUntrackedParameter("monitorOnDoubleColumn",false); resetNLumi_ = iConfig.getParameter("SiPixelStatusProducerParameters").getUntrackedParameter("resetEveryNLumi",1); ftotalevents = 0; @@ -85,14 +84,10 @@ void SiPixelStatusProducer::beginLuminosityBlock(edm::LuminosityBlock const& lum edm::LogInfo("SiPixelStatusProducer") << "beginlumi setup "<> 32; - if ( countLumi_ == 0 && resetNLumi_ > 0 ) { beginLumi_ = lumiSeg.luminosityBlock(); beginRun_ = lumiSeg.run(); - refTime_[0] = ftmptime; ftotalevents = 0; } @@ -115,7 +110,7 @@ void SiPixelStatusProducer::beginLuminosityBlock(edm::LuminosityBlock const& lum for (TrackerGeometry::DetContainer::const_iterator it = fTG->dets().begin(); it != fTG->dets().end(); it++){ const PixelGeomDetUnit *pgdu = dynamic_cast((*it)); - if (nullptr == pgdu) continue; + if (pgdu == nullptr) continue; DetId detId = (*it)->geographicalId(); int detid = detId.rawId(); @@ -129,6 +124,7 @@ void SiPixelStatusProducer::beginLuminosityBlock(edm::LuminosityBlock const& lum int nrocs = nROCrows*nROCcolumns; fDet.addModule(detid, nrocs); + fSensors[detid] = std::make_pair(rowsperroc,colsperroc); fSensorLayout[detid] = std::make_pair(nROCrows,nROCcolumns); @@ -152,7 +148,6 @@ void SiPixelStatusProducer::beginLuminosityBlock(edm::LuminosityBlock const& lum } fRocIds[detid] = rocIdMap; - } } // init when countLumi = 0 @@ -174,82 +169,81 @@ void SiPixelStatusProducer::accumulate(edm::Event const& iEvent, const edm::Even // ---------------------------------------------------------------------- edm::Handle > hClusterColl; - iEvent.getByToken(fSiPixelClusterToken_, hClusterColl); - //const edmNew::DetSetVector *clustColl(0); - //clustColl = hClusterColl.product(); - - for (const auto& clusters: *hClusterColl) { - //loop over different clusters in a clusters vector (module) - for(const auto& clu: clusters) { - // loop over cluster in a given detId (module) - int detid = clusters.detId(); - DetId detId = DetId(detid); - int rowsperroc = fSensors[detid].first; - int colsperroc = fSensors[detid].second; - - int nROCcolumns = fSensorLayout[detid].second; + if(!iEvent.getByToken(fSiPixelClusterToken_, hClusterColl)){ + edm::LogWarning("SiPixelStatusProducer") << " edmNew::DetSetVector "<(&clu); - int roc(-1), rocC(-1), rocR(-1); + iEvent.getByToken(fSiPixelClusterToken_, hClusterColl); - std::map fRocIds_detid; - if(fRocIds.find(detid)!=fRocIds.end()){ - fRocIds_detid = fRocIds[detid]; - } + if (hClusterColl.isValid()){ - const vector& pixvector = clu.pixels(); - for (unsigned int i = 0; i < pixvector.size(); ++i) { + for (const auto& clusters: *hClusterColl) { //loop over different clusters in a clusters vector (module) + for(const auto& clu: clusters) { // loop over cluster in a given detId (module) + int detid = clusters.detId(); + int rowsperroc = fSensors[detid].first; + int colsperroc = fSensors[detid].second; - int mr0 = pixvector[i].x; // constant column direction is along x-axis, - int mc0 = pixvector[i].y; // constant row direction is along y-axis + int nROCcolumns = fSensorLayout[detid].second; - if(monitorOnDoubleColumn_) onlineRocColRow(detId, mr0, mc0, roc, rocR, rocC); - else { + int roc(-1); + std::map fRocIds_detid; + if(fRocIds.find(detid)!=fRocIds.end()){ + fRocIds_detid = fRocIds[detid]; + } - int irow = mr0/rowsperroc; - int icol = mc0/colsperroc; + const vector& pixvector = clu.pixels(); + for (unsigned int i = 0; i < pixvector.size(); ++i) { - int key = indexROC(irow,icol,nROCcolumns); - if(fRocIds_detid.find(key)!=fRocIds_detid.end()){ - roc = fRocIds_detid[key]; - } + int mr0 = pixvector[i].x; // constant column direction is along x-axis, + int mc0 = pixvector[i].y; // constant row direction is along y-axis - // if monitor on whole ROC DIGI occupancy, so pixel column and row are nuisances - // just use the "center" of the ROC as a dummy local row/column - rocR = rowsperroc/2-1; - rocC = colsperroc/2-1; + int irow = mr0/rowsperroc; + int icol = mc0/colsperroc; - } + int key = indexROC(irow,icol,nROCcolumns); + if(fRocIds_detid.find(key)!=fRocIds_detid.end()){ + roc = fRocIds_detid[key]; + } - fDet.fillDIGI(detid, roc, rocC/2); + fDet.fillDIGI(detid, roc); - }// loop over pixels in a given cluster + }// loop over pixels in a given cluster - }// loop over cluster in a given detId (module) + }// loop over cluster in a given detId (module) - }// loop over detId-grouped clusters in cluster detId-grouped clusters-vector + }// loop over detId-grouped clusters in cluster detId-grouped clusters-vector + } // hClusterColl.isValid() + else{ + edm::LogWarning("SiPixelStatusProducer") << " edmNew::DetSetVector "<> 32; - - // the error given by FED due to stuck TBM + // FEDerror25 per-ROC per-event edm::Handle pixelFEDChannelCollectionHandle; // look over different resouces of takens for (const edm::EDGetTokenT& tk: theBadPixelFEDChannelsTokens_) { - if (!iEvent.getByToken(tk, pixelFEDChannelCollectionHandle)) continue; + // collection has to exist + if (!iEvent.getByToken(tk, pixelFEDChannelCollectionHandle)) { + edm::LogWarning("SiPixelStatusProducer") << " PixelFEDChannelCollection with index "<> 32; - refTime_[1] = fendtime; - endLumi_ = lumiSeg.luminosityBlock(); endRun_ = lumiSeg.run(); @@ -288,7 +278,6 @@ void SiPixelStatusProducer::endLuminosityBlockProduce(edm::LuminosityBlock& lumi fDet.setRunRange(beginRun_,endRun_); fDet.setLSRange(beginLumi_,endLumi_); - fDet.setRefTime(refTime_[0],refTime_[1]); fDet.setNevents(ftotalevents); // save result @@ -296,11 +285,9 @@ void SiPixelStatusProducer::endLuminosityBlockProduce(edm::LuminosityBlock& lumi *result = fDet; // only save for the lumi sections with NON-ZERO events - if(ftotalevents>0) { - lumiSeg.put(std::move(result), std::string("siPixelStatus")); - edm::LogInfo("SiPixelStatusProducer") + lumiSeg.put(std::move(result), std::string("siPixelStatus")); + edm::LogInfo("SiPixelStatusProducer") << "new lumi-based data stored for run "< siPixelFedCablingMapWatcher_; @@ -58,7 +56,6 @@ class SiPixelStatusProducer : public edm::one::EDProduceronline conversion // -- map (for each detid) of the map from offline col/row to the online roc/col/row - bool monitorOnDoubleColumn_; // whether to use CablingMap to get the roc/ pixel local coordinate SiPixelCoordinates coord_; // ROC size (number of row, number of columns for each det id) @@ -71,8 +68,6 @@ class SiPixelStatusProducer : public edm::one::EDProducer >fRocIds; // Producer inputs / controls - int fVerbose; - std::string fFileName; edm::InputTag fPixelClusterLabel_; edm::EDGetTokenT> fSiPixelClusterToken_; std::vector > theBadPixelFEDChannelsTokens_; diff --git a/CalibTracker/SiPixelQuality/python/SiPixelStatusHarvester_cfi.py b/CalibTracker/SiPixelQuality/python/SiPixelStatusHarvester_cfi.py index 3f2ac182e4610..6432b11a7428f 100644 --- a/CalibTracker/SiPixelQuality/python/SiPixelStatusHarvester_cfi.py +++ b/CalibTracker/SiPixelQuality/python/SiPixelStatusHarvester_cfi.py @@ -10,9 +10,7 @@ label = cms.untracked.string("siPixelStatus"), ), debug = cms.untracked.bool(False), - recordName = cms.untracked.string("SiPixelQualityFromDbRcd"), - dumpTxt = cms.untracked.bool(False), - txtFileName = cms.untracked.string("SiPixelBadComponent"), + recordName = cms.untracked.string("SiPixelQualityFromDbRcd") ) diff --git a/CalibTracker/SiPixelQuality/python/SiPixelStatusProducer_cfi.py b/CalibTracker/SiPixelQuality/python/SiPixelStatusProducer_cfi.py index dcbd3b366bb67..e9f339cdb94f7 100644 --- a/CalibTracker/SiPixelQuality/python/SiPixelStatusProducer_cfi.py +++ b/CalibTracker/SiPixelQuality/python/SiPixelStatusProducer_cfi.py @@ -4,7 +4,6 @@ SiPixelStatusProducerParameters = cms.PSet( badPixelFEDChannelCollections = cms.VInputTag(cms.InputTag('siPixelDigis')), pixelClusterLabel = cms.untracked.InputTag("siPixelClusters::RECO"), - monitorOnDoubleColumn = cms.untracked.bool(False), resetEveryNLumi = cms.untracked.int32( 1 ) ) ) diff --git a/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc b/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc index 33431ca3c5643..ad266ec13e7b5 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelDetectorStatus.cc @@ -9,17 +9,11 @@ #include #include "CalibTracker/SiPixelQuality/interface/SiPixelDetectorStatus.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -using namespace std; - // ---------------------------------------------------------------------- -SiPixelDetectorStatus::SiPixelDetectorStatus(): fLS0(99999999), fLS1(0), fRun0(99999999), fRun1(0), fDetHits(0) { - - fDetAverage = fDetSigma = 0.; +SiPixelDetectorStatus::SiPixelDetectorStatus(): fLS0(99999999), fLS1(0), fRun0(99999999), fRun1(0) { - fTime0 = fTime1 = 0; + fDetHits = 0; fNevents = 0; } @@ -33,41 +27,41 @@ SiPixelDetectorStatus::~SiPixelDetectorStatus() { // ---------------------------------------------------------------------- void SiPixelDetectorStatus::readFromFile(std::string filename) { - ifstream INS; - string sline; + std::ifstream INS; + std::string sline; INS.open(filename.c_str()); int oldDetId(-1); - int detid(0), roc(0), dc(0), hits(0), nroc(0); + int detid(0), roc(0), hits(0), nroc(0); SiPixelModuleStatus *pMod(nullptr); bool readOK(false); - while (getline(INS, sline)) { + while (std::getline(INS, sline)) { - if (string::npos != sline.find("# SiPixelDetectorStatus START")) { + if (std::string::npos != sline.find("# SiPixelDetectorStatus START")) { readOK = true; continue; } if (!readOK) continue; - if (string::npos != sline.find("# SiPixelDetectorStatus END")) { + if (std::string::npos != sline.find("# SiPixelDetectorStatus END")) { pMod->setNrocs(nroc+1); break; } - if (sline.find("# SiPixelDetectorStatus for LS") != string::npos) { - sscanf(sline.c_str(), "# SiPixelDetectorStatus for LS %d .. %d", &fLS0, &fLS1); + if (sline.find("# SiPixelDetectorStatus for LS") != std::string::npos) { + std::sscanf(sline.c_str(), "# SiPixelDetectorStatus for LS %d .. %d", &fLS0, &fLS1); continue; } - if (sline.find("# SiPixelDetectorStatus for run") != string::npos) { - sscanf(sline.c_str(), "# SiPixelDetectorStatus for run %d .. %d", &fRun0, &fRun1); + if (sline.find("# SiPixelDetectorStatus for run") != std::string::npos) { + std::sscanf(sline.c_str(), "# SiPixelDetectorStatus for run %d .. %d", &fRun0, &fRun1); continue; } - if (sline.find("# SiPixelDetectorStatus total hits = ") != string::npos) { - sscanf(sline.c_str(), "# SiPixelDetectorStatus total hits = %ld", &fDetHits); + if (sline.find("# SiPixelDetectorStatus total hits = ") != std::string::npos) { + std::sscanf(sline.c_str(), "# SiPixelDetectorStatus total hits = %ld", &fDetHits); continue; } - sscanf(sline.c_str(), "%d %d %d %d", &detid, &roc, &dc, &hits); + std::sscanf(sline.c_str(), "%d %d %d", &detid, &roc, &hits); if (roc > nroc) nroc = roc; if (detid != oldDetId) { if (pMod) { @@ -75,7 +69,7 @@ void SiPixelDetectorStatus::readFromFile(std::string filename) { } oldDetId = detid; - if (nullptr == getModule(detid)) { + if (getModule(detid) == nullptr) { addModule(detid,nroc+1); } @@ -84,7 +78,7 @@ void SiPixelDetectorStatus::readFromFile(std::string filename) { } if (pMod) { fDetHits += hits; - pMod->updateModuleDIGI(roc, dc, hits); + pMod->updateModuleDIGI(roc, hits); } } @@ -97,20 +91,20 @@ void SiPixelDetectorStatus::readFromFile(std::string filename) { // ---------------------------------------------------------------------- void SiPixelDetectorStatus::dumpToFile(std::string filename) { - ofstream OD(filename.c_str()); - OD << "# SiPixelDetectorStatus START" << endl; - OD << "# SiPixelDetectorStatus for LS " << fLS0 << " .. " << fLS1 << endl; - OD << "# SiPixelDetectorStatus for run " << fRun0 << " .. " << fRun1 << endl; - OD << "# SiPixelDetectorStatus total hits = " << fDetHits << endl; - map::iterator itEnd = end(); - for (map::iterator it = begin(); it != itEnd; ++it) { + std::ofstream OD(filename.c_str()); + OD << "# SiPixelDetectorStatus START" << std::endl; + OD << "# SiPixelDetectorStatus for LS " << fLS0 << " .. " << fLS1 << std::endl; + OD << "# SiPixelDetectorStatus for run " << fRun0 << " .. " << fRun1 << std::endl; + OD << "# SiPixelDetectorStatus total hits = " << fDetHits << std::endl; + + for (std::map::iterator it = SiPixelDetectorStatus::begin(); it != SiPixelDetectorStatus::end(); ++it) { for (int iroc = 0; iroc < it->second.nrocs(); ++iroc) { for (int idc = 0; idc < 26; ++idc) { - OD << Form("%10d %2d %2d %3d", it->first, iroc, idc, int(it->second.getRoc(iroc)->digiOccDC(idc))) << endl; + OD << Form("%10d %2d %3d", it->first, iroc, int(it->second.getRoc(iroc)->digiOccROC())) << std::endl; } } } - OD << "# SiPixelDetectorStatus END" << endl; + OD << "# SiPixelDetectorStatus END" << std::endl; OD.close(); } @@ -118,46 +112,52 @@ void SiPixelDetectorStatus::dumpToFile(std::string filename) { // ---------------------------------------------------------------------- void SiPixelDetectorStatus::addModule(int detid, int nrocs) { + SiPixelModuleStatus a(detid, nrocs); - fModules.insert(make_pair(detid, a)); + fModules.insert(std::make_pair(detid, a)); + } + // ---------------------------------------------------------------------- void SiPixelDetectorStatus::addModule(int detid, SiPixelModuleStatus a) { - fModules.insert(make_pair(detid, a)); + + fModules.insert(std::make_pair(detid, a)); + } // ---------------------------------------------------------------------- -void SiPixelDetectorStatus::fillDIGI(int detid, int roc, int idc) { +void SiPixelDetectorStatus::fillDIGI(int detid, int roc) { + ++fDetHits; - fModules[detid].fillDIGI(roc, idc); + fModules[detid].fillDIGI(roc); + } // ---------------------------------------------------------------------- -void SiPixelDetectorStatus::fillStuckTBM(int detid,PixelFEDChannel ch, std::time_t time){ +void SiPixelDetectorStatus::fillFEDerror25(int detid,PixelFEDChannel ch){ if (fModules.find(detid) != fModules.end()){ - fModules[detid].fillStuckTBM(ch,time); + fModules[detid].fillFEDerror25(ch); } } -// stuck TBM effected ROCs in for each module -std::map> SiPixelDetectorStatus::getStuckTBMsRocs(){ +// FEDerror25 effected ROCs in for each module +std::map> SiPixelDetectorStatus::getFEDerror25Rocs(){ std::map> badRocLists_; - std::map::iterator itModEnd = end(); - for (std::map::iterator itMod = begin(); itMod != itModEnd; ++itMod) { - + for(std::map::iterator itMod = SiPixelDetectorStatus::begin(); itMod != SiPixelDetectorStatus::end(); ++itMod) + { int detid = itMod->first; - // stuck TBM effected ROCs in a given module + // FEDerror25 effected ROCs in a given module std::vector list; SiPixelModuleStatus modStatus = itMod->second; for (int iroc = 0; iroc < modStatus.nrocs(); ++iroc) { SiPixelRocStatus* roc = modStatus.getRoc(iroc); - if(roc->isStuckTBM()){ + if(roc->isFEDerror25()){ list.push_back(iroc); } badRocLists_[detid]=list; @@ -169,8 +169,10 @@ std::map> SiPixelDetectorStatus::getStuckTBMsRocs(){ } // ---------------------------------------------------------------------- -map::iterator SiPixelDetectorStatus::begin() { +std::map::iterator SiPixelDetectorStatus::begin() { + return fModules.begin(); + } // ---------------------------------------------------------------------- @@ -180,12 +182,16 @@ map::iterator SiPixelDetectorStatus::begin() { // ---------------------------------------------------------------------- std::map::iterator SiPixelDetectorStatus::end() { + return fModules.end(); + } // ---------------------------------------------------------------------- int SiPixelDetectorStatus::nmodules() { + return static_cast(fModules.size()); + } // ---------------------------------------------------------------------- @@ -195,6 +201,7 @@ SiPixelModuleStatus* SiPixelDetectorStatus::getModule(int detid) { return nullptr; } return &(fModules[detid]); + } bool SiPixelDetectorStatus::findModule(int detid) { @@ -207,40 +214,48 @@ bool SiPixelDetectorStatus::findModule(int detid) { } // ---------------------------------------------------------------------- -void SiPixelDetectorStatus::digiOccupancy() { +double SiPixelDetectorStatus::perRocDigiOcc() { - fDetAverage = fDetSigma = 0; - unsigned long int ave(0), sig(0); + unsigned long int ave(0); int nrocs(0); - map::iterator itEnd = end(); - for (map::iterator it = begin(); it != itEnd; ++it) { + for (std::map::iterator it = SiPixelDetectorStatus::begin(); it != SiPixelDetectorStatus::end(); ++it) { unsigned long int inc = it->second.digiOccMOD(); ave += inc; nrocs += it->second.nrocs(); } - fDetAverage = (1.0*ave)/nrocs; + return (1.0*ave)/nrocs; - for (map::iterator it = begin(); it != itEnd; ++it) { +} + +double SiPixelDetectorStatus::perRocDigiOccVar(){ + + double fDetAverage = SiPixelDetectorStatus::perRocDigiOcc(); + + double sig = 0.0; + int nrocs(0); + for(std::map::iterator it = SiPixelDetectorStatus::begin(); it != SiPixelDetectorStatus::end(); ++it) { unsigned long int inc = it->second.digiOccMOD(); sig += (fDetAverage - inc) * (fDetAverage - inc); + nrocs += it->second.nrocs(); } - fDetSigma = sig/(nrocs - 1); - fDetSigma = TMath::Sqrt(fDetSigma); - + double fDetSigma = sig/(nrocs - 1); + return TMath::Sqrt(fDetSigma); } // combine status from different data (coming from different run/lumi) void SiPixelDetectorStatus::updateDetectorStatus(SiPixelDetectorStatus newData){ // loop over new data status - std::map::iterator itEnd = newData.end(); - for (map::iterator it = newData.begin(); it != itEnd; ++it) { + for(std::map::iterator it = newData.begin(); it != newData.end(); ++it) { int detid = it->first; if(fModules.find(detid) != fModules.end()){// if the detid is in the module lists fModules[detid].updateModuleStatus( *(newData.getModule(detid)) ); } + else{ + fModules.insert(std::make_pair(detid, *(newData.getModule(detid)))); + } } @@ -248,25 +263,3 @@ void SiPixelDetectorStatus::updateDetectorStatus(SiPixelDetectorStatus newData){ fNevents = fNevents + newData.getNevents(); } - -SiPixelDetectorStatus SiPixelDetectorStatus::combineDetectorStatus(SiPixelDetectorStatus newData){ - - SiPixelDetectorStatus combine; - - // loop over current module status - std::map::iterator itEnd = end(); - for (map::iterator it = begin(); it != itEnd; ++it) { - - int detid = it->first; - combine.addModule(detid, fModules[detid]); - - if(newData.findModule(detid)){ // the detid in current data is also in new data - // then update the module status - SiPixelModuleStatus* moduleStatus = combine.getModule(detid); - moduleStatus->updateModuleStatus(*(newData.getModule(detid))); - } - } - - return combine; - -} diff --git a/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc b/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc index 6660d464462d6..7de17ac04b0ee 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelModuleStatus.cc @@ -8,8 +8,6 @@ #include "CalibTracker/SiPixelQuality/interface/SiPixelModuleStatus.h" -using namespace std; - // ---------------------------------------------------------------------- SiPixelModuleStatus::SiPixelModuleStatus(int detId, int nrocs): fDetid(detId), fNrocs(nrocs) { @@ -18,8 +16,6 @@ SiPixelModuleStatus::SiPixelModuleStatus(int detId, int nrocs): fDetid(detId), f fRocs.push_back(a); } - fModAverage = fModSigma = 0.; - }; @@ -28,55 +24,44 @@ SiPixelModuleStatus::~SiPixelModuleStatus() {}; // ---------------------------------------------------------------------- -void SiPixelModuleStatus::fillDIGI(int iroc, int idc) { +void SiPixelModuleStatus::fillDIGI(int iroc) { if (iroc < fNrocs) - fRocs[iroc].fillDIGI(idc); + fRocs[iroc].fillDIGI(); } // ---------------------------------------------------------------------- -void SiPixelModuleStatus::updateDIGI(int iroc, int idc, unsigned long int nhit) { +void SiPixelModuleStatus::updateDIGI(int iroc, unsigned int nhit) { if (iroc < fNrocs) - fRocs[iroc].updateDIGI(idc, nhit); + fRocs[iroc].updateDIGI(nhit); } // ---------------------------------------------------------------------- -void SiPixelModuleStatus::fillStuckTBM( PixelFEDChannel ch, std::time_t time ){ +void SiPixelModuleStatus::fillFEDerror25( PixelFEDChannel ch){ - int fed = int(ch.fed); - int link = int(ch.link); int roc_first = int(ch.roc_first); int roc_last = int(ch.roc_last); for (int iroc = 0; iroc < fNrocs; iroc++){ if(iroc>=roc_first && iroc<=roc_last){ - fRocs[iroc].fillStuckTBM(fed,link,time); + fRocs[iroc].fillFEDerror25(); } } } // ---------------------------------------------------------------------- -unsigned long int SiPixelModuleStatus::digiOccDC(int iroc, int idc) { - - return (iroc < fNrocs ? fRocs[iroc].digiOccDC(idc) : -1); - -} - - -// ---------------------------------------------------------------------- -unsigned long int SiPixelModuleStatus::digiOccROC(int iroc) { +unsigned int SiPixelModuleStatus::digiOccROC(int iroc) { return (iroc < fNrocs ? fRocs[iroc].digiOccROC() : -1); } - // ---------------------------------------------------------------------- -unsigned long int SiPixelModuleStatus::digiOccMOD() { +unsigned int SiPixelModuleStatus::digiOccMOD() { - unsigned long int count(0); + unsigned int count(0); for (int iroc = 0; iroc < fNrocs; ++iroc) { count += digiOccROC(iroc); } @@ -84,7 +69,6 @@ unsigned long int SiPixelModuleStatus::digiOccMOD() { } - // ---------------------------------------------------------------------- int SiPixelModuleStatus::detid() { @@ -92,63 +76,60 @@ int SiPixelModuleStatus::detid() { } - // ---------------------------------------------------------------------- int SiPixelModuleStatus::nrocs() { + return fNrocs; + } // ---------------------------------------------------------------------- void SiPixelModuleStatus::setNrocs(int iroc) { + fNrocs = iroc; -} +} // ---------------------------------------------------------------------- double SiPixelModuleStatus::perRocDigiOcc() { - digiOccupancy(); - return fModAverage; -} + unsigned int ave(0), sig(0); + for (int iroc = 0; iroc < fNrocs; ++iroc) { + unsigned int inc = digiOccROC(iroc); + ave += inc; + } + return (1.0*ave)/fNrocs; -// ---------------------------------------------------------------------- -double SiPixelModuleStatus::perRocDigiOccVar() { - - digiOccupancy(); - return fModSigma; } -// ---------------------------------------------------------------------- -void SiPixelModuleStatus::digiOccupancy() { +double SiPixelModuleStatus::perRocDigiOccVar() { - fModAverage = fModSigma = 0.; - unsigned long int ave(0.), sig(0.); - for (int iroc = 0; iroc < fNrocs; ++iroc) { - unsigned long int inc = digiOccROC(iroc); - ave += inc; - } - fModAverage = (1.0*ave)/fNrocs; + double fModAverage = SiPixelModuleStatus::perRocDigiOcc(); + double sig = 1.0; for (int iroc = 0; iroc < fNrocs; ++iroc) { - unsigned long int inc = digiOccROC(iroc); + unsigned int inc = digiOccROC(iroc); sig += (fModAverage-inc)*(fModAverage-inc); } - fModSigma = sig/(fNrocs-1); - fModSigma = TMath::Sqrt(fModSigma); + double fModSigma = sig/(fNrocs-1); + return TMath::Sqrt(fModSigma); } - // ---------------------------------------------------------------------- // Be careful : return the address not the value of ROC status SiPixelRocStatus* SiPixelModuleStatus::getRoc(int i) { + return &fRocs[i]; + } // ---------------------------------------------------------------------- -void SiPixelModuleStatus::updateModuleDIGI(int iroc, int idc, unsigned long int nhits) { - fRocs[iroc].updateDIGI(idc,nhits); +void SiPixelModuleStatus::updateModuleDIGI(int iroc, unsigned int nhits) { + + fRocs[iroc].updateDIGI(nhits); + } void SiPixelModuleStatus::updateModuleStatus(SiPixelModuleStatus newData) { @@ -161,15 +142,12 @@ void SiPixelModuleStatus::updateModuleStatus(SiPixelModuleStatus newData) { if(isSameModule){ for (int iroc = 0; iroc < fNrocs; ++iroc) { - int nDC = fRocs[iroc].nDC(); //update occupancy - for(int idc = 0; idc < nDC; ++idc) { - fRocs[iroc].updateDIGI(idc,newData.digiOccDC(iroc,idc)); - } - //update stuckTBM + fRocs[iroc].updateDIGI(newData.digiOccROC(iroc)); + //update FEDerror25 SiPixelRocStatus* rocStatus = newData.getRoc(iroc); - if(rocStatus->isStuckTBM()){ - fRocs[iroc].updateStuckTBM(rocStatus->getBadFed(), rocStatus->getBadLink(),rocStatus->getStartBadTime(), rocStatus->getBadFreq()); + if(rocStatus->isFEDerror25()){ + fRocs[iroc].fillFEDerror25(); } } diff --git a/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc b/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc index 7c39675ef4269..10a5ee8fcc2b9 100644 --- a/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc +++ b/CalibTracker/SiPixelQuality/src/SiPixelRocStatus.cc @@ -9,15 +9,8 @@ using namespace std; // ---------------------------------------------------------------------- SiPixelRocStatus::SiPixelRocStatus() { - - for (int i = 0; i < nDC_; ++i) { - fDC[i] = 0; - } - isStuckTBM_ = false; - badFed_ = -1; - badLink_ = -1; - startBadTime_ = -1; - badFreq_ = 0; + fDC = 0; + isFEDerror25_ = false; } @@ -27,54 +20,29 @@ SiPixelRocStatus::~SiPixelRocStatus() { } // ---------------------------------------------------------------------- -void SiPixelRocStatus::fillDIGI(int idc) { +void SiPixelRocStatus::fillDIGI() { - if (idc0){ // only put in SiPixelDetectorStatus with non zero digi (pixel hit) + siPixelStatusVtr_.push_back(tmpStatus); + } } else { - LogInfo("SiPixelStatusManager") - << "Lumi: " << iLumi.luminosityBlock() << std::endl; - LogInfo("SiPixelStatusManager") - << " SiPixelDetectorStatus is not valid!" << std::endl; + edm::LogWarning("SiPixelStatusManager") + << " SiPixelDetectorStatus is not valid for run "< tmpSiPixelStatusMap_; + siPixelStatusMap_.clear(); if(outputBase_ == "nLumibased" && nLumi_>1){ // doesn't work for nLumi_=1 cos any integer can be completely divided by 1 @@ -84,41 +101,42 @@ void SiPixelStatusManager::createBadComponents(){ LuminosityBlockNumber_t tmpLumi; SiPixelDetectorStatus tmpSiPixelStatus; - for (siPixelStatusMap_iterator it = firstStatus; it != lastStatus; it++) { - + for (siPixelStatusVtr_iterator it = firstStatus; it != lastStatus; it++) { + // this is the begining of an IOV if(iterationLumi%nLumi_==0){ - tmpLumi = it->first; - tmpSiPixelStatus = it->second; + tmpLumi = edm::LuminosityBlockNumber_t(it->getLSRange().first); + tmpSiPixelStatus = (*it); } // keep update detector status up to nLumi_ lumi sections if(iterationLumi%nLumi_>0){ - tmpSiPixelStatus.updateDetectorStatus(it->second); + tmpSiPixelStatus.updateDetectorStatus((*it)); + tmpSiPixelStatus.setLSRange(int(tmpLumi), (*it).getLSRange().second); } - siPixelStatusMap_iterator currentIt = it; - siPixelStatusMap_iterator nextIt = (++currentIt); + siPixelStatusVtr_iterator currentIt = it; + siPixelStatusVtr_iterator nextIt = (++currentIt); // wirte out if current lumi is the last lumi-section in the IOV if(iterationLumi%nLumi_==nLumi_-1 || nextIt==lastStatus) { // fill it into a new map (with IOV structured) - tmpSiPixelStatusMap_[tmpLumi] = tmpSiPixelStatus; + siPixelStatusMap_[tmpLumi] = tmpSiPixelStatus; } iterationLumi=iterationLumi+1; } // check whether there is not enough number of Lumi in the last IOV - // (only when siPixelStatusMap_.size() > nLumi_ or equivalently tmpSiPixelStatusMap_.size()>1 + // (only when siPixelStatusVtr_.size() > nLumi_ or equivalently current siPixelStatusMap_.size()>1 // (otherwise there will be only one IOV, and not previous IOV before the last IOV) // and the number of lumi can not be completely divided by the nLumi_. // (then the number of lumis in the last IOV is equal to the residual, which is less than nLumi_) // if it is, combine last IOV with the IOV before it - if(siPixelStatusMap_.size()%nLumi_!=0 && tmpSiPixelStatusMap_.size()>1){ + if(siPixelStatusVtr_.size()%nLumi_!=0 && siPixelStatusMap_.size()>1){ // start from the iterator of the end of std::map - siPixelStatusMap_iterator iterEnd = tmpSiPixelStatusMap_.end(); + siPixelStatusMap_iterator iterEnd = siPixelStatusMap_.end(); // the last IOV siPixelStatusMap_iterator iterLastIOV = std::prev(iterEnd); // the IOV before the last IOV @@ -126,43 +144,43 @@ void SiPixelStatusManager::createBadComponents(){ // combine the last IOV data to the IOV before the last IOV (iterBeforeLastIOV->second).updateDetectorStatus(iterLastIOV->second); + (iterBeforeLastIOV->second).setLSRange((iterBeforeLastIOV->second).getLSRange().first, (iterLastIOV->second).getLSRange().second); + // delete the last IOV, so the IOV before the last IOV becomes the new last IOV - tmpSiPixelStatusMap_.erase(iterLastIOV); + siPixelStatusMap_.erase(iterLastIOV); } - siPixelStatusMap_.clear(); - siPixelStatusMap_ = tmpSiPixelStatusMap_; - } else if(outputBase_ == "dynamicLumibased"){ double aveDigiOcc = 1.0*aveDigiOcc_; - LuminosityBlockNumber_t tmpLumi; + edm::LuminosityBlockNumber_t tmpLumi; SiPixelDetectorStatus tmpSiPixelStatus; bool isNewIOV = true; int counter = 0; - for (siPixelStatusMap_iterator it = firstStatus; it != lastStatus; it++) { + for (siPixelStatusVtr_iterator it = firstStatus; it != lastStatus; it++) { if(isNewIOV){ // if it is new IOV, init with the current data - tmpLumi = it->first; - tmpSiPixelStatus = it->second; + tmpLumi = edm::LuminosityBlockNumber_t(it->getLSRange().first); + tmpSiPixelStatus = (*it); } else{ // if it is not new IOV, append current data - tmpSiPixelStatus.updateDetectorStatus(it->second); + tmpSiPixelStatus.updateDetectorStatus((*it)); + tmpSiPixelStatus.setLSRange(int(tmpLumi),(*it).getLSRange().second); } // if reaching the end of data, write the last IOV to the map whatsoevec - siPixelStatusMap_iterator currentIt = it; - siPixelStatusMap_iterator nextIt = (++currentIt); + siPixelStatusVtr_iterator currentIt = it; + siPixelStatusVtr_iterator nextIt = (++currentIt); if(tmpSiPixelStatus.perRocDigiOcc()1){ + if(siPixelStatusMap_.size()>1){ // start from the end iterator of the std::map - siPixelStatusMap_iterator iterEnd = tmpSiPixelStatusMap_.end(); + siPixelStatusMap_iterator iterEnd = siPixelStatusMap_.end(); // the last IOV siPixelStatusMap_iterator iterLastIOV = std::prev(iterEnd); // if the statistics of the last IOV is not enough @@ -184,30 +202,25 @@ void SiPixelStatusManager::createBadComponents(){ siPixelStatusMap_iterator iterBeforeLastIOV = std::prev(iterLastIOV); // combine the last IOV data to the IOV before the last IOV (iterBeforeLastIOV->second).updateDetectorStatus(iterLastIOV->second); + (iterBeforeLastIOV->second).setLSRange((iterBeforeLastIOV->second).getLSRange().first, (iterLastIOV->second).getLSRange().second); // erase the last IOV, so the IOV before the last IOV becomes the new last IOV - tmpSiPixelStatusMap_.erase(iterLastIOV); + siPixelStatusMap_.erase(iterLastIOV); } } - siPixelStatusMap_.clear(); - siPixelStatusMap_ = tmpSiPixelStatusMap_; - } - else if(outputBase_ == "runbased" || ( (int(siPixelStatusMap_.size()) <= nLumi_ && outputBase_ == "nLumibased")) ){ - - siPixelStatusMap_iterator firstStatus = siPixelStatusMap_.begin(); - siPixelStatusMap_iterator lastStatus = siPixelStatusMap_.end(); + else if(outputBase_ == "runbased" || ( (int(siPixelStatusVtr_.size()) <= nLumi_ && outputBase_ == "nLumibased")) ){ - LuminosityBlockNumber_t tmpLumi = firstStatus->first; - SiPixelDetectorStatus tmpSiPixelStatus = firstStatus->second; + edm::LuminosityBlockNumber_t tmpLumi = edm::LuminosityBlockNumber_t(firstStatus->getLSRange().first); + SiPixelDetectorStatus tmpSiPixelStatus = (*firstStatus); - siPixelStatusMap_iterator nextStatus = ++siPixelStatusMap_.begin(); - for (siPixelStatusMap_iterator it = nextStatus; it != lastStatus; it++) { - tmpSiPixelStatus.updateDetectorStatus(it->second); + siPixelStatusVtr_iterator nextStatus = ++siPixelStatusVtr_.begin(); + for (siPixelStatusVtr_iterator it = nextStatus; it != lastStatus; it++) { + tmpSiPixelStatus.updateDetectorStatus((*it)); + tmpSiPixelStatus.setLSRange(int(tmpLumi),(*it).getLSRange().second); } - siPixelStatusMap_.clear(); siPixelStatusMap_[tmpLumi] = tmpSiPixelStatus; } @@ -221,42 +234,45 @@ void SiPixelStatusManager::createBadComponents(){ } -void SiPixelStatusManager::createStuckTBMs(){ +void SiPixelStatusManager::createFEDerror25(){ // initialize the first IOV and SiPixelDetector status (in the first IOV) - siPixelStatusMap_iterator firstStatus = siPixelStatusMap_.begin(); - LuminosityBlockNumber_t firstLumi = firstStatus->first; - SiPixelDetectorStatus firstStuckTBMs = firstStatus->second; - stuckTBMsMap_[firstLumi] = firstStuckTBMs.getStuckTBMsRocs(); + siPixelStatusVtr_iterator firstStatus = siPixelStatusVtr_.begin(); + edm::LuminosityBlockNumber_t firstLumi = edm::LuminosityBlockNumber_t(firstStatus->getLSRange().first); + SiPixelDetectorStatus firstFEDerror25 = (*firstStatus); + FEDerror25Map_[firstLumi] = firstFEDerror25.getFEDerror25Rocs(); - siPixelStatusMap_iterator lastStatus = siPixelStatusMap_.end(); + siPixelStatusVtr_iterator lastStatus = siPixelStatusVtr_.end(); /////////// bool sameAsLastIOV = true; - LuminosityBlockNumber_t previousLumi = firstLumi; - siPixelStatusMap_iterator secondStatus = ++siPixelStatusMap_.begin(); - for (siPixelStatusMap_iterator it = secondStatus; it != lastStatus; it++) { - - LuminosityBlockNumber_t tmpLumi = it->first; - SiPixelDetectorStatus tmpStuckTBMs = it->second; - std::map >tmpBadRocLists = tmpStuckTBMs.getStuckTBMsRocs(); - - std::map::iterator itModEnd = tmpStuckTBMs.end(); - for (std::map::iterator itMod = tmpStuckTBMs.begin(); itMod != itModEnd; ++itMod) + edm::LuminosityBlockNumber_t previousLumi = firstLumi; + + siPixelStatusVtr_iterator secondStatus = ++siPixelStatusVtr_.begin(); + for (siPixelStatusVtr_iterator it = secondStatus; it != lastStatus; it++) { + // init for each lumi section (iterator) + edm::LuminosityBlockNumber_t tmpLumi = edm::LuminosityBlockNumber_t(it->getLSRange().first); + SiPixelDetectorStatus tmpFEDerror25 = (*it); + + std::map >tmpBadRocLists = tmpFEDerror25.getFEDerror25Rocs(); + + std::map::iterator itModEnd = tmpFEDerror25.end(); + for (std::map::iterator itMod = tmpFEDerror25.begin(); itMod != itModEnd; ++itMod) { int detid = itMod->first; // if the badroc list differs for any detid, update the payload - if(tmpBadRocLists[detid]!=(stuckTBMsMap_[previousLumi])[detid]){ + if(tmpBadRocLists[detid]!=(FEDerror25Map_[previousLumi])[detid]){ sameAsLastIOV = false; - return; + break; // jump out of the loop once a new payload is found } } if(sameAsLastIOV==false){ //only write new IOV when this Lumi is not equal to the previous one - - stuckTBMsMap_[tmpLumi] = tmpBadRocLists; + FEDerror25Map_[tmpLumi] = tmpBadRocLists; + // and reset previousLumi = tmpLumi; + sameAsLastIOV = true; } diff --git a/CalibTracker/SiPixelQuality/src/classes_def.xml b/CalibTracker/SiPixelQuality/src/classes_def.xml index daca0d8194e15..ce92229721d54 100644 --- a/CalibTracker/SiPixelQuality/src/classes_def.xml +++ b/CalibTracker/SiPixelQuality/src/classes_def.xml @@ -1,15 +1,15 @@ - - + + - - + + - - + + diff --git a/CalibTracker/SiStripChannelGain/python/ntuple_cff.py b/CalibTracker/SiStripChannelGain/python/ntuple_cff.py index 14ac29a906ced..4839c5b75d7a4 100644 --- a/CalibTracker/SiStripChannelGain/python/ntuple_cff.py +++ b/CalibTracker/SiStripChannelGain/python/ntuple_cff.py @@ -6,29 +6,23 @@ from CalibTracker.SiStripCommon.SiStripBFieldFilter_cfi import * from HLTrigger.HLTfilters.triggerResultsFilter_cfi import * -AAGFilter = triggerResultsFilter.clone( -# triggerConditions = cms.vstring("HLT_ZeroBias_*"), - triggerConditions = cms.vstring("HLT_ZeroBias_FirstCollisionAfterAbortGap_*"), - hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), - l1tResults = cms.InputTag( "" ), - throw = cms.bool(False) - ) - -IsolatedMuonFilter = triggerResultsFilter.clone( -# triggerConditions = cms.vstring("HLT_ZeroBias_*"), - triggerConditions = cms.vstring("HLT_IsoMu20_*"), - hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), - l1tResults = cms.InputTag( "" ), - throw = cms.bool(False) - ) - -ZeroBiasFilter = triggerResultsFilter.clone( -# triggerConditions = cms.vstring("HLT_ZeroBias_*"), - triggerConditions = cms.vstring("HLT_ZeroBias_*"), - hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), - l1tResults = cms.InputTag( "" ), - throw = cms.bool(False) - ) +AAGFilter = triggerResultsFilter.clone(triggerConditions = cms.vstring("HLT_ZeroBias_FirstCollisionAfterAbortGap_*"), + hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), + l1tResults = cms.InputTag( "" ), + throw = cms.bool(False) + ) + +IsolatedMuonFilter = triggerResultsFilter.clone(triggerConditions = cms.vstring("HLT_IsoMu20_*"), + hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), + l1tResults = cms.InputTag( "" ), + throw = cms.bool(False) + ) + +ZeroBiasFilter = triggerResultsFilter.clone(triggerConditions = cms.vstring("HLT_ZeroBias_*",), + hltResults = cms.InputTag( "TriggerResults", "", "HLT" ), + l1tResults = cms.InputTag( "" ), + throw = cms.bool(False) + ) OfflineChannelGainOutputCommands = [ @@ -65,10 +59,10 @@ inputDataSequence = cms.Sequence( shallowEventRun + shallowTracks + shallowGainCalibration ) -OfflineGainNtuple_StdBunch = cms.Sequence( ZeroBiasFilter + siStripBFieldOnFilter + +OfflineGainNtuple_StdBunch = cms.Sequence( ZeroBiasFilter + ~AAGFilter + siStripBFieldOnFilter + inputDataSequence * gainCalibrationTreeStdBunch ) -OfflineGainNtuple_StdBunch0T = cms.Sequence( ZeroBiasFilter + siStripBFieldOffFilter + +OfflineGainNtuple_StdBunch0T = cms.Sequence( ZeroBiasFilter + ~AAGFilter + siStripBFieldOffFilter + inputDataSequence * gainCalibrationTreeStdBunch0T ) OfflineGainNtuple_AagBunch = cms.Sequence( siStripBFieldOnFilter + AAGFilter + @@ -77,10 +71,10 @@ OfflineGainNtuple_AagBunch0T = cms.Sequence( siStripBFieldOffFilter + AAGFilter + inputDataSequence * gainCalibrationTreeAagBunch0T ) -OfflineGainNtuple_IsoMuon = cms.Sequence( siStripBFieldOnFilter + AAGFilter + +OfflineGainNtuple_IsoMuon = cms.Sequence( siStripBFieldOnFilter + IsolatedMuonFilter + inputDataSequence * gainCalibrationTreeIsoMuon ) -OfflineGainNtuple_IsoMuon0T = cms.Sequence( siStripBFieldOffFilter + AAGFilter + +OfflineGainNtuple_IsoMuon0T = cms.Sequence( siStripBFieldOffFilter + IsolatedMuonFilter + inputDataSequence * gainCalibrationTreeIsoMuon0T ) #OfflineGainNtuple = cms.Sequence( (shallowEventRun+ diff --git a/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalCalIsolElectron_Output_cff.py b/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalCalIsolElectron_Output_cff.py index 29cc327dbe624..dd484da3704a3 100644 --- a/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalCalIsolElectron_Output_cff.py +++ b/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalCalIsolElectron_Output_cff.py @@ -24,8 +24,8 @@ ), outputCommands = cms.untracked.vstring( 'keep *_pfMet_*_*', # met for Wenu selection - 'keep *_kt6PFJetsForRhoCorrection_rho_*', #rho for effective area subtraction - 'keep *_kt6PFJets_rho_*', #rho for effective area subtraction + #'keep *_kt6PFJetsForRhoCorrection_rho_*', #rho for effective area subtraction + #'keep *_kt6PFJets_rho_*', #rho for effective area subtraction #'keep recoVertexs_offlinePrimaryVertices*_*_*', 'keep recoVertexs_offlinePrimaryVertices_*_*', 'keep recoVertexs_offlinePrimaryVerticesWithBS_*_*', @@ -34,14 +34,14 @@ 'keep *_conversions_*_*', #'keep *GsfTrack*_*_*_*', 'keep *GsfTrack*_electronGsfTracks_*_*', - 'keep *GsfTrack*_uncleanedOnlyElectronGsfTracks_*_*', +# 'keep *GsfTrack*_uncleanedOnlyElectronGsfTracks_*_*', 'keep *_generator_*_*', 'keep *_addPileupInfo_*_*', 'keep *_genParticles_*_*', 'keep recoGsfElectron*_gsfElectron*_*_*', #'keep recoGsfElectron*_gedGsfElectron*_*_*', 'keep recoGsfElectron*_gedGsfElectrons_*_*', - 'keep recoGsfElectron*_gedGsfElectronsTmp_*_*', +# 'keep recoGsfElectron*_gedGsfElectronsTmp_*_*', 'keep recoGsfElectron*_gedGsfElectronCores_*_*', 'keep recoPhoton*_gedPhoton_*_*', #'keep recoCaloClusters_*_*_*', @@ -94,6 +94,8 @@ # pfisolation CMSSW_5_3_X 'keep *EcalRecHit*_alCaIsolatedElectrons_*_*', 'keep *EcalRecHit*_reducedEcalRecHitsES_alCaRecHitsES_*', + 'keep *_fixedGridRhoFastjetAll_*_*' + ) ) diff --git a/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalUncalIsolElectron_Output_cff.py b/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalUncalIsolElectron_Output_cff.py index f0e523a8d6816..64f4cf47baa8e 100644 --- a/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalUncalIsolElectron_Output_cff.py +++ b/Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalUncalIsolElectron_Output_cff.py @@ -18,7 +18,15 @@ 'drop recoSuperClusters_*_*_*', 'drop recoPreshowerCluster*_*_*_*', 'drop *EcalRecHit*_reducedEcalRecHitsES*_*_*', - 'keep reco*Clusters_pfElectronTranslator_*_*' + 'keep reco*Clusters_pfElectronTranslator_*_*', + 'drop TrajectorysToOnerecoGsfTracksAssociation_electronGsfTracks_*_*', + 'drop TrajectorysToOnerecoGsfTracksAssociation_uncleanedOnlyElectronGsfTracks_*_*', + 'drop recoGsfElectronsrecoGsfElectronrecoGsfElectronsrecoGsfElectronedmrefhelperFindUsingAdvanceedmRefedmValueMap_gedGsfElectronsTmp_*_*', + 'drop recoConversions_conversions_uncleanedConversions_*', + 'drop recoGsfElectrons_gedGsfElectronsTmp_*_*', + 'drop recoGsfTracks_uncleanedOnlyElectronGsfTracks_*_*', + 'drop recoGsfTrackExtras_uncleanedOnlyElectronGsfTracks_*_*' + ) OutALCARECOEcalUncalElectron.SelectEvents = cms.untracked.PSet( diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc index 101d31889934a..1dd98737c7e01 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc @@ -92,7 +92,10 @@ class AlCaIsoTracksFilter : public edm::stream::EDFilter("maxTrackP")), slopeRestrictionP_(iConfig.getParameter("slopeTrackP")), eIsolate_(iConfig.getParameter("isolationEnergy")), + hitEthrEB_(iConfig.getParameter("EBHitEnergyThreshold") ), + hitEthrEE0_(iConfig.getParameter("EEHitEnergyThreshold0") ), + hitEthrEE1_(iConfig.getParameter("EEHitEnergyThreshold1") ), + hitEthrEE2_(iConfig.getParameter("EEHitEnergyThreshold2") ), + hitEthrEE3_(iConfig.getParameter("EEHitEnergyThreshold3") ), pTrackLow_(iConfig.getParameter("momentumRangeLow")), pTrackHigh_(iConfig.getParameter("momentumRangeHigh")), preScale_(iConfig.getParameter("preScaleFactor")), @@ -340,13 +348,23 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) { double t_p = pTrack->p(); nselTracks++; - int nRH_eMipDR(0), nNearTRKs(0); - double eMipDR = spr::eCone_ecal(geo, barrelRecHitsHandle, - endcapRecHitsHandle, - trkDetItr->pointHCAL, - trkDetItr->pointECAL, a_mipR_, - trkDetItr->directionECAL, - nRH_eMipDR); + int nNearTRKs(0); + std::vector eIds; + std::vector eHit; + double eEcal = spr::eCone_ecal(geo, barrelRecHitsHandle, + endcapRecHitsHandle, + trkDetItr->pointHCAL, + trkDetItr->pointECAL, a_mipR_, + trkDetItr->directionECAL, + eIds, eHit); + double eMipDR(0); + for (unsigned int k=0; kgetPosition(eIds[k]); + double eta = std::abs(pos.eta()); + double eThr = (eIds[k].subdetId() == EcalBarrel) ? hitEthrEB_ : + (((eta*hitEthrEE3_+hitEthrEE2_)*eta+hitEthrEE1_)*eta+hitEthrEE0_); + if (eHit[k] > eThr) eMipDR += eHit[k]; + } double hmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections, a_charIsoR_, @@ -358,7 +376,7 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet << pTrack->pt() << "|" << pTrack->eta() << "|" << pTrack->phi() << "|" << t_p - << "e_MIP " << eMipDR + << "e_MIP " << eMipDR <<":" << eEcal << " Chg Isolation " << hmaxNearP << ":" << eIsolation; if (t_p>pTrackMin_ && eMipDR("maxTrackP",8.0); desc.add("slopeTrackP",0.05090504066); desc.add("isolationEnergy",10.0); + // energy thershold for ECAL (from Egamma group) + desc.add("EBHitEnergyThreshold",0.10); + desc.add("EEHitEnergyThreshold0",-41.0664); + desc.add("EEHitEnergyThreshold1",68.7950); + desc.add("EEHitEnergyThreshold2",-38.1483); + desc.add("EEHitEnergyThreshold3",7.04303); // Prescale events only containing isolated tracks in the range desc.add("momentumRangeLow",20.0); desc.add("momentumRangeHigh",40.0); diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py index d5be8e928e221..13ad8e7050077 100644 --- a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBiasNoise_cff.py @@ -21,7 +21,7 @@ hbherecoNoise = RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi.hbheprereco.clone( digiLabelQIE8 = cms.InputTag("hcalDigiAlCaMB"), digiLabelQIE11 = cms.InputTag("hcalDigiAlCaMB"), - tsFromDB = cms.bool(False), +### tsFromDB = cms.bool(False), dropZSmarkedPassed = cms.bool(False), algorithm = dict( useMahi = cms.bool(False), @@ -39,8 +39,7 @@ setLegacyFlagsQIE11 = cms.bool(False), ) -hbherecoNoise.algorithm.firstSample = 0 -hbherecoNoise.algorithm.samplesToAdd = 4 +hbherecoNoise.algorithm.firstSampleShift = -100 # to set reco window at very beginning of the TS array import RecoLocalCalo.HcalRecProducers.hosimplereco_cfi horecoNoise = RecoLocalCalo.HcalRecProducers.hosimplereco_cfi.hosimplereco.clone() diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py index 18dc31b3e7c65..8d7371ee07f4f 100644 --- a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalMinBias_cff.py @@ -17,7 +17,7 @@ hbherecoMBNZS = RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi.hbheprereco.clone( digiLabelQIE8 = cms.InputTag("hcalDigiAlCaMB"), digiLabelQIE11 = cms.InputTag("hcalDigiAlCaMB"), - tsFromDB = cms.bool(False), +### tsFromDB = cms.bool(False), dropZSmarkedPassed = cms.bool(False), algorithm = dict( useMahi = cms.bool(False), @@ -35,8 +35,7 @@ setLegacyFlagsQIE11 = cms.bool(False), ) -hbherecoMBNZS.algorithm.firstSample = 4 -hbherecoMBNZS.algorithm.samplesToAdd = 4 +hbherecoMBNZS.algorithm.firstSampleShift = 0 # explicitly repeating the default import RecoLocalCalo.HcalRecProducers.hosimplereco_cfi horecoMBNZS = RecoLocalCalo.HcalRecProducers.hosimplereco_cfi.hosimplereco.clone() @@ -50,7 +49,7 @@ import RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi hfrecoMBNZS = RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi.hfsimplereco.clone() -hfrecoMBNZS.firstSample = 2 +hfrecoMBNZS.firstSample = 2 # Run 2 default before 2017 hfrecoMBNZS.samplesToAdd = 2 hfrecoMBNZS.digiLabel = 'hcalDigiAlCaMB' hfrecoMBNZS.tsFromDB = cms.bool(False) diff --git a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalPedestal_cff.py b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalPedestal_cff.py index ff0ee534f975e..a7cbd5a691a78 100644 --- a/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalPedestal_cff.py +++ b/Calibration/HcalAlCaRecoProducers/python/ALCARECOHcalCalPedestal_cff.py @@ -35,7 +35,7 @@ hbherecoPedestal = RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi.hbheprereco.clone( digiLabelQIE8 = cms.InputTag("hcalDigiAlCaPedestal"), digiLabelQIE11 = cms.InputTag("hcalDigiAlCaPedestal"), - tsFromDB = cms.bool(False), +### tsFromDB = cms.bool(False), dropZSmarkedPassed = cms.bool(False), algorithm = dict( useMahi = cms.bool(False), @@ -53,8 +53,7 @@ setLegacyFlagsQIE11 = cms.bool(False), ) -hbherecoPedestal.algorithm.firstSample = 0 -hbherecoPedestal.algorithm.samplesToAdd = 4 +hbherecoPedestal.algorithm.firstSampleShift = -100 # for the very beginning of the TS array import RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi hfrecoPedestal = RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi.hfsimplereco.clone() diff --git a/Calibration/HcalCalibAlgos/macros/CalibRho.C b/Calibration/HcalCalibAlgos/macros/CalibRho.C new file mode 100644 index 0000000000000..ebde86d8e4929 --- /dev/null +++ b/Calibration/HcalCalibAlgos/macros/CalibRho.C @@ -0,0 +1,689 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Usage: +// .L CalibRho.C+g +// +// EHcalVsRho c1(inpFilName, dupFileName); +// c1.LoopFill(maxEta, outFile1, logFile); +// FitEvsRho(logFile, parameterFile, outFile2); +// c1.LoopTest(maxEta, parameterFile, rootFile); +// FitEovPwithRho(maxEta, rootFile, outFile3); +// +// inpFileName (const char*) File name of the input ROOT tree +// dupFileName (const char*) Name of the file containing list of entries +// of duplicate events +// maxEta (int) Maximum value of |iEta| +// outFile1 (const char*) Output ROOT file name which will contain the +// scatter plots and profile histograms which +// will provide the estimate of "effective area" +// logFile (const char*) Name of the text file which will contain the +// effective area for each ieta value +// parameterFile (const char*) Name of the text file with values of the +// fitted parameter set +// outFile2 (const char*) Name of the ROOT file with the results of +// the fit +// rootFile (const char*) Name of the ROOT file with corrected and +// uncorrected histograms of E/p +// outFile3 (const char*) Name of the ROOT file containing the E/p +// histograms and the fit results +////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +class EHcalVsRho { +public : + TTree *fChain; //!pointer to the analyzed TTree or TChain + Int_t fCurrent; //!current Tree number in a TChain + + EHcalVsRho(const char *inFile, const char *dupFile); + virtual ~EHcalVsRho(); + virtual Int_t Cut(Long64_t entry); + virtual Int_t GetEntry(Long64_t entry); + virtual Long64_t LoadTree(Long64_t entry); + virtual void Init(TTree *tree, const char* dupFile); + virtual Bool_t Notify(); + virtual void Show(Long64_t entry = -1); + void LoopFill(int maxEta, const char *outFile, const char *logFile); + void LoopTest(int maxEta, const char *inFile, const char *outFile); + double EffCalc(TH1D*, double, double&, double&); + double getEA(const int ieta, const double* par); + +private: + + // Declaration of leaf types + Int_t t_Run; + Int_t t_Event; + Int_t t_DataType; + Int_t t_ieta; + Int_t t_iphi; + Double_t t_EventWeight; + Int_t t_nVtx; + Int_t t_nTrk; + Int_t t_goodPV; + Double_t t_l1pt; + Double_t t_l1eta; + Double_t t_l1phi; + Double_t t_l3pt; + Double_t t_l3eta; + Double_t t_l3phi; + Double_t t_p; + Double_t t_pt; + Double_t t_phi; + Double_t t_mindR1; + Double_t t_mindR2; + Double_t t_eMipDR; + Double_t t_eHcal; + Double_t t_eHcal10; + Double_t t_eHcal30; + Double_t t_hmaxNearP; + Double_t t_rhoh; + Bool_t t_selectTk; + Bool_t t_qltyFlag; + Bool_t t_qltyMissFlag; + Bool_t t_qltyPVFlag; + Double_t t_gentrackP; + std::vector *t_DetIds; + std::vector *t_HitEnergies; + std::vector *t_trgbits; + std::vector *t_DetIds1; + std::vector *t_DetIds3; + std::vector *t_HitEnergies1; + std::vector *t_HitEnergies3; + + // List of branches + TBranch *b_t_Run; //! + TBranch *b_t_Event; //! + TBranch *b_t_DataType; //! + TBranch *b_t_ieta; //! + TBranch *b_t_iphi; //! + TBranch *b_t_EventWeight; //! + TBranch *b_t_nVtx; //! + TBranch *b_t_nTrk; //! + TBranch *b_t_goodPV; //! + TBranch *b_t_l1pt; //! + TBranch *b_t_l1eta; //! + TBranch *b_t_l1phi; //! + TBranch *b_t_l3pt; //! + TBranch *b_t_l3eta; //! + TBranch *b_t_l3phi; //! + TBranch *b_t_p; //! + TBranch *b_t_pt; //! + TBranch *b_t_phi; //! + TBranch *b_t_mindR1; //! + TBranch *b_t_mindR2; //! + TBranch *b_t_eMipDR; //! + TBranch *b_t_eHcal; //! + TBranch *b_t_eHcal10; //! + TBranch *b_t_eHcal30; //! + TBranch *b_t_hmaxNearP; //! + TBranch *b_t_rhoh; //! + TBranch *b_t_selectTk; //! + TBranch *b_t_qltyFlag; //! + TBranch *b_t_qltyMissFlag; //! + TBranch *b_t_qltyPVFlag; //! + TBranch *b_t_gentrackP; //! + TBranch *b_t_DetIds; //! + TBranch *b_t_HitEnergies; //! + TBranch *b_t_trgbits; //! + TBranch *b_t_DetIds1; //! + TBranch *b_t_DetIds3; //! + TBranch *b_t_HitEnergies1; //! + TBranch *b_t_HitEnergies3; //! + + std::vector entries_; +}; + +EHcalVsRho::EHcalVsRho(const char *inFile, const char *dupFile) : fChain(0) { + TFile *infile = TFile::Open(inFile); + TDirectory *dir = (TDirectory*)infile->FindObjectAny("HcalIsoTrkAnalyzer"); + TTree *tree = (TTree*)dir->FindObjectAny("CalibTree"); + Init(tree, dupFile); +} + +EHcalVsRho::~EHcalVsRho() { + if (!fChain) return; + delete fChain->GetCurrentFile(); +} + +Int_t EHcalVsRho::GetEntry(Long64_t entry) { + // Read contents of entry. + if (!fChain) return 0; + return fChain->GetEntry(entry); +} + +Long64_t EHcalVsRho::LoadTree(Long64_t entry) { + // Set the environment to read one entry + if (!fChain) return -5; + Long64_t centry = fChain->LoadTree(entry); + if (centry < 0) return centry; + if (fChain->GetTreeNumber() != fCurrent) { + fCurrent = fChain->GetTreeNumber(); + Notify(); + } + return centry; +} + +void EHcalVsRho::Init(TTree *tree, const char* dupFile) { + // The Init() function is called when the selector needs to initialize + // a new tree or chain. Typically here the branch addresses and branch + // pointers of the tree will be set. + // It is normally not necessary to make changes to the generated + // code, but the routine can be extended by the user if needed. + // Init() will be called many times when running on PROOF + // (once per file to be processed). + + // Set object pointer + t_DetIds = 0; + t_HitEnergies = 0; + t_trgbits = 0; + t_DetIds1 = 0; + t_DetIds3 = 0; + t_HitEnergies1 = 0; + t_HitEnergies3 = 0; + // Set branch addresses and branch pointers + if (!tree) return; + fChain = tree; + fCurrent = -1; + fChain->SetMakeClass(1); + + fChain->SetBranchAddress("t_Run", &t_Run, &b_t_Run); + fChain->SetBranchAddress("t_Event", &t_Event, &b_t_Event); + fChain->SetBranchAddress("t_DataType", &t_DataType, &b_t_DataType); + fChain->SetBranchAddress("t_ieta", &t_ieta, &b_t_ieta); + fChain->SetBranchAddress("t_iphi", &t_iphi, &b_t_iphi); + fChain->SetBranchAddress("t_EventWeight", &t_EventWeight, &b_t_EventWeight); + fChain->SetBranchAddress("t_nVtx", &t_nVtx, &b_t_nVtx); + fChain->SetBranchAddress("t_nTrk", &t_nTrk, &b_t_nTrk); + fChain->SetBranchAddress("t_goodPV", &t_goodPV, &b_t_goodPV); + fChain->SetBranchAddress("t_l1pt", &t_l1pt, &b_t_l1pt); + fChain->SetBranchAddress("t_l1eta", &t_l1eta, &b_t_l1eta); + fChain->SetBranchAddress("t_l1phi", &t_l1phi, &b_t_l1phi); + fChain->SetBranchAddress("t_l3pt", &t_l3pt, &b_t_l3pt); + fChain->SetBranchAddress("t_l3eta", &t_l3eta, &b_t_l3eta); + fChain->SetBranchAddress("t_l3phi", &t_l3phi, &b_t_l3phi); + fChain->SetBranchAddress("t_p", &t_p, &b_t_p); + fChain->SetBranchAddress("t_pt", &t_pt, &b_t_pt); + fChain->SetBranchAddress("t_phi", &t_phi, &b_t_phi); + fChain->SetBranchAddress("t_mindR1", &t_mindR1, &b_t_mindR1); + fChain->SetBranchAddress("t_mindR2", &t_mindR2, &b_t_mindR2); + fChain->SetBranchAddress("t_eMipDR", &t_eMipDR, &b_t_eMipDR); + fChain->SetBranchAddress("t_eHcal", &t_eHcal, &b_t_eHcal); + fChain->SetBranchAddress("t_eHcal10", &t_eHcal10, &b_t_eHcal10); + fChain->SetBranchAddress("t_eHcal30", &t_eHcal30, &b_t_eHcal30); + fChain->SetBranchAddress("t_hmaxNearP", &t_hmaxNearP, &b_t_hmaxNearP); + fChain->SetBranchAddress("t_rhoh", &t_rhoh, &b_t_rhoh); + fChain->SetBranchAddress("t_selectTk", &t_selectTk, &b_t_selectTk); + fChain->SetBranchAddress("t_qltyFlag", &t_qltyFlag, &b_t_qltyFlag); + fChain->SetBranchAddress("t_qltyMissFlag", &t_qltyMissFlag, &b_t_qltyMissFlag); + fChain->SetBranchAddress("t_qltyPVFlag", &t_qltyPVFlag, &b_t_qltyPVFlag); + fChain->SetBranchAddress("t_gentrackP", &t_gentrackP, &b_t_gentrackP); + fChain->SetBranchAddress("t_DetIds", &t_DetIds, &b_t_DetIds); + fChain->SetBranchAddress("t_HitEnergies", &t_HitEnergies, &b_t_HitEnergies); + fChain->SetBranchAddress("t_trgbits", &t_trgbits, &b_t_trgbits); + fChain->SetBranchAddress("t_DetIds1", &t_DetIds1, &b_t_DetIds1); + fChain->SetBranchAddress("t_DetIds3", &t_DetIds3, &b_t_DetIds3); + fChain->SetBranchAddress("t_HitEnergies1", &t_HitEnergies1, &b_t_HitEnergies1); + fChain->SetBranchAddress("t_HitEnergies3", &t_HitEnergies3, &b_t_HitEnergies3); + Notify(); + + ifstream infile(dupFile); + if (!infile.is_open()) { + std::cout << "Cannot open " << dupFile << std::endl; + } else { + while (1) { + Long64_t jentry; + infile >> jentry; + if (!infile.good()) break; + entries_.push_back(jentry); + } + infile.close(); + std::cout << "Reads a list of " << entries_.size() << " events from " + << dupFile << std::endl; + } +} + +Bool_t EHcalVsRho::Notify() { + // The Notify() function is called when a new file is opened. This + // can be either for a new TTree in a TChain or when when a new TTree + // is started when using PROOF. It is normally not necessary to make changes + // to the generated code, but the routine can be extended by the + // user if needed. The return value is currently not used. + + return kTRUE; +} + +void EHcalVsRho::Show(Long64_t entry) { + // Print contents of entry. + // If entry is not specified, print current entry + if (!fChain) return; + fChain->Show(entry); +} + +Int_t EHcalVsRho::Cut(Long64_t) { + // This function may be called from Loop. + // returns 1 if entry is accepted. + // returns -1 otherwise. + return 1; +} + +void EHcalVsRho::LoopFill(int maxEta, const char *outFile, const char *logFile){ + if (fChain == 0) return; + TFile *f1 = new TFile(outFile,"RECREATE"); + char name[100], Title[100], graph[100], proji[100]; + + std::vector VIsoRho; + std::vector Hcal_corr; + for (int ieta = 0; ietaGetEntriesFast(); + std::cout << "Total # of entries: " << nentries << std::endl; + Long64_t nbytes = 0, nb = 0; + Long64_t kount(0), duplicate(0), good(0); + for (Long64_t jentry=0; jentryGetEntry(jentry); nbytes += nb; + + ++kount; + if (kount%100000 == 0) std::cout << "Processing Entry " << kount<=40) && (t_p<=60)) { + VIsoRho[absIeta-1]->Fill(t_rhoh,t_eHcal); + Hcal_corr[absIeta-1]->Fill(t_rhoh,t_eHcal); + ++good; + } + } + std::cout << "Uses " << good << " events out of " << kount << " excluding " + << duplicate << " duplicate events" << std::endl; + + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptTitle(0); gStyle->SetOptFit(1); + std::ofstream myfile; + myfile.open(logFile); + for (int ieta=0; ietaWrite(); + Hcal_corr[ieta]->Write(); + TH2D *his_i = dynamic_cast(VIsoRho[ieta]->Clone()); + his_i ->GetEntries(); + int dim = his_i->GetXaxis()->GetNbins(); + double *xcut, *binc, *errXL, *errXH, *errYL, *errYH; + double *errX, *errY; + double errX1, errX2, xmax(0); + + xcut = new double[dim]; + binc = new double[dim]; + errX = new double[dim]; + errY = new double[dim]; + errXL = new double[dim]; + errXH = new double[dim]; + errYL = new double[dim]; + errYH = new double[dim]; + + for (int j= 0; j < dim; j++) { + sprintf (proji,"proj%d-%d",ieta+1,j); + TH1D* h_proj = dynamic_cast(his_i->ProjectionY(proji,j,j+1," ")); + binc[j] = his_i->GetXaxis()->GetBinCenter(j+1); + xcut[j] = EffCalc(h_proj,0.90,errX1,errX2); + + errXL[j]=0.0; + errXH[j]=0.0; + errYL[j]=errX1; + errYH[j]=errX2; + + errX[j]=0.0; + errY[j]=0.0; + h_proj->Write(); + if (xcut[j] > xmax) xmax = xcut[j]; + } + + TGraphAsymmErrors * Isovsrho = new TGraphAsymmErrors(dim,binc,xcut,errXL,errXH,errYL,errYH); + sprintf(graph,"IsovsRho%d",ieta+1); + sprintf(name,"EvsRho%d",ieta+1); + + TF1 *fnc = new TF1("fnc","[1]*x + [0]",4,13); + TFitResultPtr fitI = Isovsrho->Fit("fnc","+QSR"); + double ic = fnc->GetParameter(1); + double err = fitI->FitResult::Error(1); + myfile << ieta+1 << " " << ic << " " << err << std::endl; + std::cout << "Fit " << ieta+1 << " " << fnc->GetParameter(0) << " " + << fitI->FitResult::Error(0) << " " << ic << " " << err << "\n"; + gStyle->SetOptFit(1); + TCanvas *pad = new TCanvas(graph,name,0,10,1200,400); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + Isovsrho->SetMarkerStyle(24); + Isovsrho->SetMarkerSize(0.4); + Isovsrho->GetXaxis()->SetRangeUser(0,15); + Isovsrho->GetXaxis()->SetTitle("#rho"); + Isovsrho->GetXaxis()->SetLabelSize(0.04); + Isovsrho->GetXaxis()->SetTitleSize(0.06); + Isovsrho->GetXaxis()->SetTitleOffset(0.8); + Isovsrho->GetYaxis()->SetRangeUser(0,1.25*xmax); + Isovsrho->GetYaxis()->SetTitle("Energy (GeV)"); + Isovsrho->GetYaxis()->SetLabelSize(0.04); + Isovsrho->GetYaxis()->SetTitleSize(0.06); + Isovsrho->GetYaxis()->SetTitleOffset(0.6); + Isovsrho->Draw("AP"); + pad->Update(); + TPaveStats* st1 = (TPaveStats*)Isovsrho->GetListOfFunctions()->FindObject("stats"); + if (st1 != nullptr) { + st1->SetY1NDC(0.78); st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); + } + pad->Write(); + } + + myfile.close(); + f1->Close(); +} + +double EHcalVsRho::EffCalc(TH1D* h, double perc, double & errXL, + double & errXH) { + double eff, eff_err=0.0, xCut=0.0; + int tot = h->GetEntries(); + int integ = 0; + errXL = 0.0; + errXH = 0.0; + for(int i = 0; i < (h->GetXaxis()->GetNbins()+1 ); i++) { + xCut = h->GetXaxis()->GetBinLowEdge(i); + integ += h->GetBinContent(i); + + if (integ != 0 && tot != 0 ) { + eff = (integ*1.0/tot); + eff_err = sqrt ( eff * ( 1 - eff ) / tot ) ; + } else { + eff = 0.0; + } + if (eff > perc) break; + } + if (eff == 0.0) xCut = 0.0; + errXL = eff_err; + errXH = eff_err; + return xCut; +} + +void EHcalVsRho::LoopTest(int maxEta, const char *inFile, const char *outFile) { + + if (fChain == 0) return; + + TFile *f1 = new TFile(outFile,"RECREATE"); + std::map histo, histo_uncorr; + char name[100], title[100]; + for (int ieta =-maxEta; ieta<=maxEta; ieta++) { + sprintf(name, "MPV%d",ieta); + sprintf(title, "Corrected Response (i#eta = %d)", ieta-30); + histo[ieta] = new TH1D(name, title, 100, 0, 2); + sprintf(name, "MPVUn%d",ieta); + sprintf(title, "Uncorrected Response (i#eta = %d)", ieta-30); + histo_uncorr[ieta] = new TH1D(name, title, 100, 0, 2); + } + std::cout << "Initialized histograms from " << -maxEta << ":" << maxEta<<"\n"; + + double par[10]; + ifstream myReadFile; + myReadFile.open(inFile); + int npar = 0; + if (myReadFile.is_open()) { + while (!myReadFile.eof()) { + myReadFile >> par[npar]; + ++npar; + } + } + myReadFile.close(); + std::cout << "Reads " << npar << " parameters:"; + for (int k=0; k 40) && (t_p < 60.0)); + if (select) { + double corr_eHcal = 0.0; + int absIeta = abs(t_ieta); + ++good; + if (absIeta <= maxEta) { + corr_eHcal = t_eHcal - t_rhoh*getEA(absIeta,par); + double myEovP = corr_eHcal/(t_p-t_eMipDR); + double myEovP_uncorr = t_eHcal/(t_p-t_eMipDR); + histo[t_ieta]->Fill(myEovP); + histo_uncorr[t_ieta]->Fill(myEovP_uncorr); + } + } + } + + for (std::map::iterator itr=histo.begin(); + itr != histo.end(); ++itr) itr->second->Write(); + for (std::map::iterator itr=histo_uncorr.begin(); + itr != histo_uncorr.end(); ++itr) itr->second->Write(); + f1->Close(); + std::cout << "Processes " << good << " out of " << kount << " events with " + << duplicate << " duplicate entries" << std::endl; +} + +double EHcalVsRho::getEA(const int eta, const double* par) { + double eA; + if (eta<20) + eA = par[0]; + else + eA = (((par[5]*eta+par[4])*eta+par[3])*eta+par[2])*eta+par[1]; + return eA; +} + +void FitEvsRho(const char *inFile, const char *outFile, const char *rootFile) { + + const int ndim=30; + double EA[ndim] = {0.0}; + double errEA[ndim]={0.0}; + double ietaEA[ndim]={0.0}; + ifstream myReadFile; + myReadFile.open(inFile); + + int ii = 0; + if (myReadFile.is_open()) { + while (!myReadFile.eof()) { + myReadFile >> ietaEA[ii] >> EA[ii] >> errEA[ii]; + if (EA[ii] < 0) EA[ii] = 0; + ii++; + } + } + myReadFile.close(); + std::cout << "Reads " << ii << " points from " << inFile << std::endl; + + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptTitle(0); gStyle->SetOptStat(0); + gStyle->SetOptFit(0); + TFile *f1 = new TFile(rootFile,"RECREATE"); + TGraphErrors * eA = new TGraphErrors(ii,ietaEA,EA,errEA,errEA); + eA->SetMarkerStyle(20); eA->SetMarkerColor(4); + eA->SetLineColor(2); + eA->GetXaxis()->SetTitle("i#eta"); + eA->GetXaxis()->SetTitleOffset(0.6); + eA->GetXaxis()->SetTitleSize(0.06); + eA->GetYaxis()->SetTitle("Effective Area"); + eA->GetYaxis()->SetTitleOffset(0.6); + eA->GetYaxis()->SetTitleSize(0.06); + + Double_t par[6]; + const int nmid=19; + TF1 *g1 = new TF1("g1","pol0",1,nmid); + TF1 *g2 = new TF1("g2","pol4",nmid,ii); + + eA->Fit(g1,"R"); + eA->Fit(g2,"R+"); + g1->GetParameters(&par[0]); + g2->GetParameters(&par[1]); + + TCanvas *c2 = new TCanvas("EA vs #eta","EA vs ieta",0,10,1200,400); + eA->Draw("AP"); + c2->Write(); + f1->Close(); + + ofstream params; + params.open(outFile); + for (int i=0; i<6; i++) { + params << par[i] << endl; + std::cout << "Parameter[" << i << "] = " << par[i] << std::endl; + } + params.close(); +} + +void FitEovPwithRho(int maxEta, const char *inFile, const char *outFile) { + + TFile *file = new TFile(inFile); + std::map histo, histo_uncorr; + char name[100]; + for (int ieta =-maxEta; ieta<=maxEta; ieta++) { + sprintf(name, "MPV%d",ieta); + TH1D* h0 = (TH1D*)file->FindObjectAny(name); + histo[ieta] = (h0 != 0) ? (TH1D*)(h0->Clone()) : 0; + sprintf(name, "MPVUn%d",ieta); + TH1D* h1 = (TH1D*)file->FindObjectAny(name); + histo_uncorr[ieta] = (h1 != 0) ? (TH1D*)(h1->Clone()) : 0; + } + +//TFile *f1 = + new TFile(outFile,"RECREATE"); + double xlim = maxEta + 0.5; + TH1D* EovPvsieta = new TH1D("Corrected","Corrected",2*maxEta+1,-xlim,xlim); + TH1D* EovPvsieta_uncorr = new TH1D("Uncorrect","Uncorrect",2*maxEta+1,-xlim,xlim); + + TF1* fnc = new TF1("fnc","gaus"); + unsigned int k1(0), k2(0); + for (int ieta=-maxEta; ieta<=maxEta; ieta++) { + if (ieta == 0) continue; + if (histo[ieta] != 0) { + double mean = histo[ieta]->GetMean(); + double rms = histo[ieta]->GetRMS(); + TFitResultPtr FitG = histo[ieta]->Fit("fnc","QRWLS","",mean-rms,mean+rms); + double a = fnc->GetParameter(1); + double err = FitG->FitResult::Error(1); + histo[ieta]->Write(); + ++k1; + int ibin = ieta+maxEta+1; + EovPvsieta->SetBinContent(ibin,a); + EovPvsieta->SetBinError(ibin,err); + std::cout << "Correct[" << k1 << "] " << ieta << " a " << a << " +- " + << err << std::endl; + } + + if (histo_uncorr[ieta] != 0) { + double mean = histo_uncorr[ieta]->GetMean(); + double rms = histo_uncorr[ieta]->GetRMS(); + TFitResultPtr FitG = histo_uncorr[ieta]->Fit("fnc","QRWLS","",mean-rms,mean+rms); + double a = fnc->GetParameter(1); + double err = FitG->FitResult::Error(1); + histo_uncorr[ieta]->Write(); + ++k2; + int ibin = ieta+maxEta+1; + EovPvsieta_uncorr->SetBinContent(ibin,a); + EovPvsieta_uncorr->SetBinError(ibin,err); + std::cout << "Correct[" << k2 << "] " << ieta << " a " << a << " +- " + << err << std::endl; + } + } + + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptTitle(0); + gStyle->SetOptStat(10); gStyle->SetOptFit(1); + TCanvas *c3 = new TCanvas("E/P vs ieta","E/P vs ieta",0,10,1200,400); + EovPvsieta->GetXaxis()->SetTitle("i#eta"); + EovPvsieta->GetYaxis()->SetTitle("MPV[E_{Hcal}/(p_{Track}-E_{Ecal})]"); + EovPvsieta->SetMarkerStyle(20); EovPvsieta->SetMarkerColor(2); + EovPvsieta->SetMarkerSize(1.0); + EovPvsieta->Fit("pol0","+QRWLS","",-maxEta,maxEta); + + EovPvsieta_uncorr->SetMarkerStyle(24); EovPvsieta_uncorr->SetMarkerColor(4); + EovPvsieta_uncorr->SetMarkerSize(1.0); + + EovPvsieta->GetYaxis()->SetRangeUser(0.5,2.0); + EovPvsieta->Draw(); + c3->Update(); + TPaveStats* st1 = (TPaveStats*)EovPvsieta->GetListOfFunctions()->FindObject("stats"); + if (st1 != nullptr) { + st1->SetY1NDC(0.81); st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); + } + EovPvsieta_uncorr->Draw("sames"); + c3->Update(); + st1 = (TPaveStats*)EovPvsieta_uncorr->GetListOfFunctions()->FindObject("stats"); + std::cout << st1 << std::endl; + if (st1 != nullptr) { + st1->SetY1NDC(0.78); st1->SetY2NDC(0.81); + st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); + } + c3->Modified(); + c3->Update(); + EovPvsieta->Write(); + EovPvsieta_uncorr->Write(); +} + +void PlotEvsRho(const char* inFile, int type=-1, bool save=false) { + + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptTitle(0); + gStyle->SetOptStat(10); gStyle->SetOptFit(1); + + TFile *file = new TFile(inFile); + int itmin = (type > 0) ? type : 1; + int itmax = (type > 0) ? type : 25; + for (int it = itmin; it <= itmax; ++it) { + char name[50]; + sprintf (name, "IsovsRho%d", it); + TCanvas* pad = (TCanvas*)file->FindObjectAny(name); + pad->Draw(); + if (save) { + sprintf (name, "%s.pdf", pad->GetName()); + pad->Print(name); + } + } +} diff --git a/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc b/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc index 2c58a0d98ae35..c24350628e412 100644 --- a/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc +++ b/Calibration/HcalCalibAlgos/test/HcalIsoTrkAnalyzer.cc @@ -132,6 +132,8 @@ class HcalIsoTrkAnalyzer : public edm::one::EDAnalyzer> tok_alg_; TTree *tree, *tree2; + unsigned int t_RunNo, t_EventNo; int t_Run, t_Event, t_DataType, t_ieta, t_iphi; int t_goodPV, t_nVtx, t_nTrk; double t_EventWeight, t_p, t_pt, t_phi; @@ -169,7 +172,7 @@ class HcalIsoTrkAnalyzer : public edm::one::EDAnalyzer *t_trgbits, *t_hltbits; bool t_L1Bit; int t_Tracks, t_TracksProp, t_TracksSaved; - int t_TracksLoose, t_TracksTight; + int t_TracksLoose, t_TracksTight, t_allvertex; std::vector *t_ietaAll, *t_ietaGood, *t_trackType; }; @@ -199,6 +202,11 @@ HcalIsoTrkAnalyzer::HcalIsoTrkAnalyzer(const edm::ParameterSet& iConfig) : useL1Trigger_(iConfig.getUntrackedParameter("useL1Trigger",false)), unCorrect_(iConfig.getUntrackedParameter("unCorrect",false)), collapseDepth_(iConfig.getUntrackedParameter("collapseDepth",false)), + hitEthrEB_(iConfig.getParameter("EBHitEnergyThreshold") ), + hitEthrEE0_(iConfig.getParameter("EEHitEnergyThreshold0") ), + hitEthrEE1_(iConfig.getParameter("EEHitEnergyThreshold1") ), + hitEthrEE2_(iConfig.getParameter("EEHitEnergyThreshold2") ), + hitEthrEE3_(iConfig.getParameter("EEHitEnergyThreshold3") ), triggerEvent_(iConfig.getParameter("labelTriggerEvent")), theTriggerResultsLabel_(iConfig.getParameter("labelTriggerResult")), labelGenTrack_(iConfig.getParameter("labelTrack")), @@ -409,6 +417,7 @@ void HcalIsoTrkAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const if (t_goodPV == 0 && beamSpotH.isValid()) { leadPV = beamSpotH->position(); } + t_allvertex = t_goodPV; #ifdef EDM_ML_DEBUG edm::LogVerbatim("HcalIsoTrack") << "Primary Vertex " << leadPV << " out of " << t_goodPV << " vertex"; @@ -446,6 +455,8 @@ void HcalIsoTrkAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const spr::propagateCALO(trkCollection, geo, bField, theTrackQuality_, trkCaloDirections, false); std::vector vecL1, vecL3; + t_RunNo = iEvent.id().run(); + t_EventNo = iEvent.id().event(); t_Tracks = trkCollection->size(); t_TracksProp = trkCaloDirections.size(); t_ietaAll->clear(); t_ietaGood->clear(); t_trackType->clear(); @@ -693,6 +704,8 @@ void HcalIsoTrkAnalyzer::beginJob() { } tree2 = fs->make("EventInfo", "Event Information"); + tree2->Branch("t_RunNo", &t_RunNo, "t_RunNo/i"); + tree2->Branch("t_EventNo", &t_EventNo, "t_EventNo/i"); tree2->Branch("t_Tracks", &t_Tracks, "t_Tracks/I"); tree2->Branch("t_TracksProp", &t_TracksProp, "t_TracksProp/I"); tree2->Branch("t_TracksSaved", &t_TracksSaved, "t_TracksSaved/I"); @@ -701,6 +714,7 @@ void HcalIsoTrkAnalyzer::beginJob() { tree2->Branch("t_TrigPass", &t_TrigPass, "t_TrigPass/O"); tree2->Branch("t_TrigPassSel", &t_TrigPassSel, "t_TrigPassSel/O"); tree2->Branch("t_L1Bit", &t_L1Bit, "t_L1Bit/O"); + tree2->Branch("t_allvertex", &t_allvertex, "t_allvertex/I"); t_hltbits = new std::vector(); t_ietaAll = new std::vector(); t_ietaGood = new std::vector(); @@ -786,6 +800,12 @@ void HcalIsoTrkAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descri desc.add("slopeTrackP",0.05090504066); desc.add("isolationEnergyTight",2.0); desc.add("isolationEnergyLoose",10.0); + // energy thershold for ECAL (from Egamma group) + desc.add("EBHitEnergyThreshold",0.10); + desc.add("EEHitEnergyThreshold0",-41.0664); + desc.add("EEHitEnergyThreshold1",68.7950); + desc.add("EEHitEnergyThreshold2",-38.1483); + desc.add("EEHitEnergyThreshold3",7.04303); // various labels for collections used in the code desc.add("labelTriggerEvent",edm::InputTag("hltTriggerSummaryAOD","","HLT")); desc.add("labelTriggerResult",edm::InputTag("TriggerResults","","HLT")); @@ -890,11 +910,26 @@ std::array HcalIsoTrkAnalyzer::fillTree(std::vector< math::XYZTLorentzVec t_qltyFlag = (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL); if (t_qltyFlag) { nselTracks++; - int nRH_eMipDR(0), nNearTRKs(0); + int nNearTRKs(0); + std::vector eIds; + std::vector eHit; t_eMipDR = spr::eCone_ecal(geo, barrelRecHitsHandle, endcapRecHitsHandle, trkDetItr->pointHCAL, trkDetItr->pointECAL, a_mipR_, - trkDetItr->directionECAL, nRH_eMipDR); + trkDetItr->directionECAL, eIds, eHit); + double eEcal(0); + for (unsigned int k=0; kgetPosition(eIds[k]); + double eta = std::abs(pos.eta()); + double eThr = (eIds[k].subdetId() == EcalBarrel) ? hitEthrEB_ : + (((eta*hitEthrEE3_+hitEthrEE2_)*eta+hitEthrEE1_)*eta+hitEthrEE0_); + if (eHit[k] > eThr) eEcal += eHit[k]; + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "eMIP befor and after: " << t_eMipDR + << ":" << eEcal; +#endif + t_eMipDR = eEcal; t_hmaxNearP = spr::chargeIsolationCone(nTracks, trkCaloDirections, a_charIsoR_, nNearTRKs, false); t_gentrackP = trackP(pTrack, genParticles); diff --git a/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h b/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h index 5b11e88b99070..51132bb75bdd0 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h +++ b/Calibration/HcalIsolatedTrackReco/interface/IPTCorrector.h @@ -11,6 +11,7 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h" @@ -21,6 +22,8 @@ class IPTCorrector : public edm::global::EDProducer<> public: IPTCorrector (const edm::ParameterSet& ps); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override; private: diff --git a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h index 4d02b267fa2a1..7153c4e47741c 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h +++ b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateL1TProducer.h @@ -9,6 +9,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -47,7 +48,8 @@ class IsolatedPixelTrackCandidateL1TProducer : public edm::stream::EDProducer<> IsolatedPixelTrackCandidateL1TProducer (const edm::ParameterSet& ps); ~IsolatedPixelTrackCandidateL1TProducer() override; - + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); void beginRun(const edm::Run&, const edm::EventSetup&) override; void produce(edm::Event& evt, const edm::EventSetup& es) override; diff --git a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h index d92435245092a..2bedfb949b66b 100644 --- a/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h +++ b/Calibration/HcalIsolatedTrackReco/interface/IsolatedPixelTrackCandidateProducer.h @@ -9,6 +9,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -44,7 +45,8 @@ class IsolatedPixelTrackCandidateProducer : public edm::stream::EDProducer<> { IsolatedPixelTrackCandidateProducer (const edm::ParameterSet& ps); ~IsolatedPixelTrackCandidateProducer() override; - + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); void beginRun(const edm::Run&, const edm::EventSetup&) override; void produce(edm::Event& evt, const edm::EventSetup& es) override; diff --git a/Calibration/HcalIsolatedTrackReco/python/iptCorrector_cfi.py b/Calibration/HcalIsolatedTrackReco/python/iptCorrector_cfi.py deleted file mode 100644 index 14795a2ff71c9..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/iptCorrector_cfi.py +++ /dev/null @@ -1,9 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -iptCorrector = cms.EDProducer("IPTCorrector", - corTracksLabel = cms.InputTag( "hltIter0PFlowCtfWithMaterialTracks" ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2Filter" ), - associationCone = cms.double( 0.2 ) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProdL1T_cfi.py b/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProdL1T_cfi.py deleted file mode 100644 index 50d399aabd96b..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProdL1T_cfi.py +++ /dev/null @@ -1,21 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -#IsolatedPixelTrackCandidateProducer default configuration -isolPixelTrackProd = cms.EDProducer("IsolatedPixelTrackCandidateL1TProducer", - L1eTauJetsSource = cms.InputTag( 'hltGtStage2Digis','Tau' ), - tauAssociationCone = cms.double( 0.0 ), - tauUnbiasCone = cms.double( 1.2 ), - PixelTracksSources = cms.VInputTag( "hltPixelTracks" ), - ExtrapolationConeSize = cms.double(1.0), - PixelIsolationConeSizeAtEC = cms.double(40), - L1GTSeedLabel = cms.InputTag( "hltL1sV0SingleJet60" ), - MaxVtxDXYSeed = cms.double( 101.0 ), - MaxVtxDXYIsol = cms.double( 101.0 ), - VertexLabel = cms.InputTag( "hltTrimmedPixelVertices" ), - MagFieldRecordName = cms.string("VolumeBasedMagneticField"), - minPTrack = cms.double( 5.0 ), - maxPTrackForIsolation = cms.double( 3.0 ), - EBEtaBoundary = cms.double(1.479) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProd_cfi.py b/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProd_cfi.py deleted file mode 100644 index b5e1495ecb1ca..0000000000000 --- a/Calibration/HcalIsolatedTrackReco/python/isolPixelTrackProd_cfi.py +++ /dev/null @@ -1,21 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -#IsolatedPixelTrackCandidateProducer default configuration -isolPixelTrackProd = cms.EDProducer("IsolatedPixelTrackCandidateProducer", - L1eTauJetsSource = cms.InputTag('hltCaloStage2Digis','Tau'), - tauAssociationCone = cms.double( 0.0 ), - tauUnbiasCone = cms.double( 1.2 ), - PixelTracksSources = cms.VInputTag( "hltPixelTracks" ), - ExtrapolationConeSize = cms.double(1.0), - PixelIsolationConeSizeAtEC = cms.double(40), - L1GTSeedLabel = cms.InputTag( "hltL1sIsoTrack" ), - MaxVtxDXYSeed = cms.double( 101.0 ), - MaxVtxDXYIsol = cms.double( 101.0 ), - VertexLabel = cms.InputTag( "hltTrimmedPixelVertices" ), - MagFieldRecordName = cms.string("VolumeBasedMagneticField"), - minPTrack = cms.double( 5.0 ), - maxPTrackForIsolation = cms.double( 3.0 ), - EBEtaBoundary = cms.double(1.479) -) - - diff --git a/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc b/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc index cf2bf000ae1f0..233143df88fad 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc +++ b/Calibration/HcalIsolatedTrackReco/src/IPTCorrector.cc @@ -9,6 +9,7 @@ #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" // #include "DataFormats/Common/interface/TriggerResults.h" @@ -27,6 +28,13 @@ IPTCorrector::IPTCorrector(const edm::ParameterSet& config) : produces< reco::IsolatedPixelTrackCandidateCollection >(); } +void IPTCorrector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("corTracksLabel",edm::InputTag("hltIter0PFlowCtfWithMaterialTracks")); + desc.add("filterLabel",edm::InputTag("hltIsolPixelTrackL2Filter")); + desc.add("associationCone",0.2); + descriptions.add("iptCorrector",desc); +} void IPTCorrector::produce(edm::StreamID, edm::Event& theEvent, edm::EventSetup const&) const { diff --git a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc b/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc index 73c22200df0a1..d73bd98edb761 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateL1TProducer.cc @@ -11,6 +11,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESTransientHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/transform.h" // @@ -63,8 +64,26 @@ IsolatedPixelTrackCandidateL1TProducer::IsolatedPixelTrackCandidateL1TProducer(c produces< reco::IsolatedPixelTrackCandidateCollection >(); } -IsolatedPixelTrackCandidateL1TProducer::~IsolatedPixelTrackCandidateL1TProducer() { - +IsolatedPixelTrackCandidateL1TProducer::~IsolatedPixelTrackCandidateL1TProducer() { } + +void IsolatedPixelTrackCandidateL1TProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + std::vector tracksrc = {edm::InputTag("hltPixelTracks")}; + desc.add("L1eTauJetsSource",edm::InputTag("hltGtStage2Digis","Tau")); + desc.add("tauAssociationCone", 0.0 ); + desc.add("tauUnbiasCone", 1.2 ); + desc.add >("PixelTracksSources",tracksrc); + desc.add("ExtrapolationConeSize", 1.0); + desc.add("PixelIsolationConeSizeAtEC",40); + desc.add("L1GTSeedLabel",edm::InputTag("hltL1sV0SingleJet60")); + desc.add("MaxVtxDXYSeed", 101.0); + desc.add("MaxVtxDXYIsol", 101.0); + desc.add("VertexLabel",edm::InputTag("hltTrimmedPixelVertices")); + desc.add("MagFieldRecordName","VolumeBasedMagneticField"); + desc.add("minPTrack", 5.0); + desc.add("maxPTrackForIsolation", 3.0); + desc.add("EBEtaBoundary", 1.479); + descriptions.add("isolPixelTrackProdL1T",desc); } void IsolatedPixelTrackCandidateL1TProducer::beginRun(const edm::Run &run, const edm::EventSetup &theEventSetup) { diff --git a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc b/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc index 29b2b0d1f8efb..3e0beca1c4dc7 100644 --- a/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc +++ b/Calibration/HcalIsolatedTrackReco/src/IsolatedPixelTrackCandidateProducer.cc @@ -11,6 +11,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESTransientHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/transform.h" // @@ -64,8 +65,26 @@ IsolatedPixelTrackCandidateProducer::IsolatedPixelTrackCandidateProducer(const e produces< reco::IsolatedPixelTrackCandidateCollection >(); } -IsolatedPixelTrackCandidateProducer::~IsolatedPixelTrackCandidateProducer() { - +IsolatedPixelTrackCandidateProducer::~IsolatedPixelTrackCandidateProducer() { } + +void IsolatedPixelTrackCandidateProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + std::vector tracksrc = {edm::InputTag("hltPixelTracks")}; + desc.add("L1eTauJetsSource",edm::InputTag("hltCaloStage2Digis","Tau")); + desc.add("tauAssociationCone", 0.0 ); + desc.add("tauUnbiasCone", 1.2 ); + desc.add >("PixelTracksSources",tracksrc); + desc.add("ExtrapolationConeSize", 1.0); + desc.add("PixelIsolationConeSizeAtEC",40); + desc.add("L1GTSeedLabel",edm::InputTag("hltL1sIsoTrack")); + desc.add("MaxVtxDXYSeed", 101.0); + desc.add("MaxVtxDXYIsol", 101.0); + desc.add("VertexLabel",edm::InputTag("hltTrimmedPixelVertices")); + desc.add("MagFieldRecordName","VolumeBasedMagneticField"); + desc.add("minPTrack", 5.0); + desc.add("maxPTrackForIsolation", 3.0); + desc.add("EBEtaBoundary", 1.479); + descriptions.add("isolPixelTrackProd",desc); } void IsolatedPixelTrackCandidateProducer::beginRun(const edm::Run &run, const edm::EventSetup &theEventSetup) { diff --git a/Calibration/IsolatedParticles/interface/eCone.h b/Calibration/IsolatedParticles/interface/eCone.h index f33cd3ef8e037..797f98adce464 100644 --- a/Calibration/IsolatedParticles/interface/eCone.h +++ b/Calibration/IsolatedParticles/interface/eCone.h @@ -41,6 +41,9 @@ namespace spr{ template double eCone_ecal(const CaloGeometry* geo, edm::Handle& barrelhits, edm::Handle& endcaphits, const GlobalPoint& hpoint1, const GlobalPoint& point1, double dR, const GlobalVector& trackMom, int& nRecHits, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false); + template + double eCone_ecal(const CaloGeometry* geo, edm::Handle& barrelhits, edm::Handle& endcaphits, const GlobalPoint& hpoint1, const GlobalPoint& point1, double dR, const GlobalVector& trackMom, std::vector& coneRecHitDetIds, std::vector& eHit, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false); + } #include "eCone.icc" diff --git a/Calibration/IsolatedParticles/interface/eCone.icc b/Calibration/IsolatedParticles/interface/eCone.icc index 8ed53aafecf7f..c1b68deb49a3f 100644 --- a/Calibration/IsolatedParticles/interface/eCone.icc +++ b/Calibration/IsolatedParticles/interface/eCone.icc @@ -16,11 +16,11 @@ namespace spr{ nRecHits = -99; double energySum = 0.0; std::set uniqueIdset; - for (unsigned int ihit=0; ihitid()).subdetId(); + for (auto const& ihit : hit) { + int subdet = DetId(ihit->id()).subdetId(); if (detOnly < 0 || subdet == detOnly) { - double eTower = spr::getEnergy(hit[ihit],useRaw); - double tt = hit[ihit]->time(); + double eTower = spr::getEnergy(ihit,useRaw); + double tt = ihit->time(); bool ok = (eTower>hbThr); if (subdet == (int)(HcalEndcap)) ok = (eTower>heThr); else if (subdet == (int)(HcalForward)) ok = (eTower>hfThr); @@ -29,7 +29,7 @@ namespace spr{ energySum += eTower; int eta(-99); int phi(-99); - spr::getEtaPhi(hit[ihit], eta, phi); + spr::getEtaPhi(ihit, eta, phi); int uniqueEtaPhiId = 100*eta+phi; uniqueIdset.insert(uniqueEtaPhiId); } @@ -76,7 +76,7 @@ namespace spr{ int uniqueEtaPhiId = 100*eta+phi; uniqueIdset.insert(uniqueEtaPhiId); // Get list of det ids - coneRecHitDetIds.push_back(hit[ihit]->id()); + coneRecHitDetIds.emplace_back(hit[ihit]->id()); } } @@ -106,18 +106,18 @@ namespace spr{ nRecHits = -99; double energySum = 0.0; std::set uniqueIdset; - for (unsigned int ihit=0; ihitid()); - eHit.push_back(energy); + coneRecHitDetIds.emplace_back(ihit->id()); + eHit.emplace_back(energy); } nRecHits = uniqueIdset.size(); @@ -168,7 +168,7 @@ namespace spr{ int uniqueEtaPhiId = 100*eta+phi; uniqueIdset.insert(uniqueEtaPhiId); // Get vector of detids. - coneRecHitDetIds.push_back(hit[ihit]->id()); + coneRecHitDetIds.emplace_back(hit[ihit]->id()); } } nRecHits = uniqueIdset.size(); @@ -200,12 +200,12 @@ namespace spr{ // No depth in Ecal so nRecHits = hit.size() nRecHits = hit.size(); double energySum = 0.0; - for (unsigned int ihit=0; ihitenergy(); - double tt = hit[ihit]->time(); - if (DetId(hit[ihit]->id()).subdetId()==EcalBarrel) ok = (eTower > ebThr); - else if (DetId(hit[ihit]->id()).subdetId()==EcalEndcap) ok = (eTower > eeThr); + double eTower = ihit->energy(); + double tt = ihit->time(); + if (DetId(ihit->id()).subdetId()==EcalBarrel) ok = (eTower > ebThr); + else if (DetId(ihit->id()).subdetId()==EcalEndcap) ok = (eTower > eeThr); // No need for hcal sampling weight if (ok && tt > tMin && tt < tMax) energySum += eTower; } @@ -217,6 +217,36 @@ namespace spr{ return energySum; } + // + template + double eCone_ecal(const CaloGeometry* geo, edm::Handle& barrelhits, edm::Handle& endcaphits, const GlobalPoint& hpoint1, const GlobalPoint& point1, double dR, const GlobalVector& trackMom, std::vector& coneRecHitDetIds, std::vector& eHit, double ebThr, double eeThr, double tMin, double tMax, bool debug) { + + std::vector< typename T::const_iterator> hit = spr::findHitCone(geo, barrelhits, endcaphits, hpoint1, point1, dR, trackMom, debug); + + // No depth in Ecal + double energySum = 0.0; + for (auto const& ihit : hit) { + bool ok = true; + double eTower = ihit->energy(); + double tt = ihit->time(); + if (DetId(ihit->id()).subdetId()==EcalBarrel) ok = (eTower > ebThr); + else if (DetId(ihit->id()).subdetId()==EcalEndcap) ok = (eTower > eeThr); + // No need for hcal sampling weight + if (tt > tMin && tt < tMax) { + if (ok) energySum += eTower; + // Get list of det ids + coneRecHitDetIds.emplace_back(ihit->id()); + eHit.emplace_back(eTower); + } + } + + if (debug) { + std::cout << "eCone_ecal: Energy " << energySum << " from " << hit.size() + << " hits" << std::endl; + } + return energySum; + } + } diff --git a/Calibration/IsolatedParticles/macros/PlotTracks.C b/Calibration/IsolatedParticles/macros/PlotTracks.C index e492c84fd525c..fd7eeae3fcebf 100644 --- a/Calibration/IsolatedParticles/macros/PlotTracks.C +++ b/Calibration/IsolatedParticles/macros/PlotTracks.C @@ -39,7 +39,7 @@ // savePlot= Plot to be saved: no (-1), eps (0), gif (1), pdf (2) [-1] // // void plotEMeanAll(int data, int models, bool ratio, bool approve, -// int savePlot) +// std::string postfix, int savePlot) // // Plots mean energy response as a function of track momentum or the ratio // @@ -48,11 +48,12 @@ // ratio = flag to say if raw mean will be shown or ratio [false] // wrt a reference // approve= If meant for approval talks [true] +// postfix= String to be added in the name of saved file [""] // savePlot= Plot to be saved: no (-1), eps (0), gif (1), pdf (2) [-1] // // void plotEMean(std::string fname, std::string hlt, int models, int var, // int eta, int pv, int data, bool ratio, bool approve, -// int savePlot) +// std::string postfix, int savePlot) // // Plots mean energy response as a function of track momentum or the ratio // MC/Data @@ -70,6 +71,7 @@ // ratio = flag to say if raw mean will be shown or ratio wrt [false] // a reference // approve= If meant for approval talks [true] +// postfix= String to be added in the name of saved file [""] // savePlot= Plot to be saved: no (-1), eps (0), gif (1), pdf (2) [-1] // // void plotEnergy(std::string fname, std::string HLT, int var, int ien, @@ -188,9 +190,9 @@ #include //const int nmodelm=15, nmodelx=16, nmodels=2; -//const int nmodelm=3, nmodelx=4, nmodels=2; +const int nmodelm=3, nmodelx=4, nmodels=2; //const int nmodelm=4, nmodelx=5, nmodels=2; -const int nmodelm=2, nmodelx=3, nmodels=2; +//const int nmodelm=2, nmodelx=3, nmodels=2; int styles[7] = {20, 21, 24, 22, 23, 33, 25}; int colors[7] = {1, 2, 4, 6, 7, 38, 3}; std::string names[7] = {"All", "Quality", "okEcal", "EcalCharIso", @@ -295,12 +297,28 @@ std::string typem[nmodelm]={"10.2.p02 FTFP_BERT_EMM", "10.4 VecGeom FTFP_BERT_EMM", "10.4 VecGeom+CLHEP FTFP_BERT_EMM"}; */ - +/* std::string filem[nmodelm]={"pikp/FBE4cMixStudyHLT10.root", "pikp/FBE4vcMixStudyHLT10.root"}; std::string typem[nmodelm]={"10.4 CLHEP FTFP_BERT_EMM", "10.4 VecGeom+CLHEP FTFP_BERT_EMM"}; - +*/ +/* +std::string filem[nmodelm]={"pikp/FBE3r9MixStudyHLT.root", + "pikp/FBE4r00MixStudyHLT.root", + "pikp/FBE4r01MixStudyHLT.root"}; +std::string typem[nmodelm]={"10.3.ref09 FTFP_BERT_EMM", + "10.4.ref00 FTFP_BERT_EMM", + "10.4.ref01 FTFP_BERT_EMM"}; +*/ +/* +std::string filem[nmodelm]={"pikp/QFB3r9MixStudyHLT.root", + "pikp/QFB4r00MixStudyHLT.root", + "pikp/QFB4r01MixStudyHLT.root"}; +std::string typem[nmodelm]={"10.3.ref09 QGSP_FTFP_BERT_EML", + "10.4.ref00 QGSP_FTFP_BERT_EML", + "10.4.ref01 QGSP_FTFP_BERT_EML"}; +*/ /* std::string filem[nmodelm]={"pikp/FBE2p2StudyHLT.root", "pikp/FBE4r00MixStudyHLT.root", @@ -317,6 +335,12 @@ std::string typem[nmodelm]={"10.3.ref06 FTFP_BERT_EMM (Native)", "10.3.ref06 FTFP_BERT_EMM (VecGeom 4)", "10.3.ref06 FTFP_BERT_EMM (VecGeom Corr)"}; */ +std::string filem[nmodelm]={"pikp/FBE4r00vMixStudyHLT.root", + "pikp/FBE4r01MixStudyHLT.root", + "pikp/FBE4r01vMixStudyHLT.root"}; +std::string typem[nmodelm]={"10.4 VecGeom FTFP_BERT_EMM", + "10.4.ref01 FTFP_BERT_EMM", + "10.4.ref01 VecGeom FTFP_BERT_EMM"}; /* std::string filex[nmodelx]={"AllDataStudyHLT.root", "pikp/FBE2p2StudyHLT.root", @@ -363,14 +387,34 @@ std::string typex[nmodelx]={"Data (2016B)", "10.4 VecGeom FTFP_BERT_EMM", "10.4 VecGeom+CLHEP FTFP_BERT_EMM"}; */ - +/* std::string filex[nmodelx]={"AllDataStudyHLT.root", "pikp/FBE4cMixStudyHLT10.root", "pikp/FBE4vcMixStudyHLT10.root"}; std::string typex[nmodelx]={"Data (2016B)", "10.4 CLHEP FTFP_BERT_EMM", "10.4 VecGeom+CLHEP FTFP_BERT_EMM"}; - +*/ +/* +std::string filex[nmodelx]={"AllDataStudyHLT.root", + "pikp/FBE3r9MixStudyHLT.root", + "pikp/FBE4r00MixStudyHLT.root", + "pikp/FBE4r01MixStudyHLT.root"}; +std::string typex[nmodelx]={"Data (2016B)", + "10.3.ref09 FTFP_BERT_EMM", + "10.4.ref00 FTFP_BERT_EMM", + "10.4.ref01 FTFP_BERT_EMM"}; +*/ +/* +std::string filex[nmodelx]={"AllDataStudyHLT.root", + "pikp/QFB3r9MixStudyHLT.root", + "pikp/QFB4r00MixStudyHLT.root", + "pikp/QFB4r01MixStudyHLT.root"}; +std::string typex[nmodelx]={"Data (2016B)", + "10.3.ref09 QGSP_FTFP_BERT_EML", + "10.4.ref00 QGSP_FTFP_BERT_EML", + "10.4.ref01 QGSP_FTFP_BERT_EML"}; +*/ /* std::string filex[nmodelx]={"AllDataStudyHLT.root", "pikp/FBE2p2StudyHLT.root", @@ -391,6 +435,14 @@ std::string typex[nmodelx]={"Data (2016B)", "10.3.ref06 FTFP_BERT_EMM (VecGeom 4)", "10.3.ref06 FTFP_BERT_EMM (VecGeom Corr)"}; */ +std::string filex[nmodelx]={"AllDataStudyHLT.root", + "pikp/FBE4r00vMixStudyHLT.root", + "pikp/FBE4r01MixStudyHLT.root", + "pikp/FBE4r01vMixStudyHLT.root"}; +std::string typex[nmodelx]={"Data (2016B)", + "10.4 VecGeom FTFP_BERT_EMM", + "10.4.ref01 FTFP_BERT_EMM", + "10.4.ref01 VecGeom FTFP_BERT_EMM"}; /* std::string files[nmodelx]={"StudyHLT_ZeroBias_1PV.root","StudyHLT_PixelTrack_1PV.root","StudyHLT_1PV.root"}; std::string types[nmodels]={"Zero Bias HLT","Pixel Track HLT","All HLTs"}; @@ -404,8 +456,8 @@ std::string typex[nmodelx]={"Data (2016B)", void plotAll(std::string fname="hlt.root", std::string HLT="All HLTs", int var=-1, int ien=-1, int eta=-1, bool varbin=false, int rebin=1, bool approve=true, bool logy=true, int pos=0, bool pv=false, int savePlot=-1); void plotEnergyAll(std::string fname="", std::string hlt="All HLTs", int models=15, int pv=0, int data=4, bool varbin=false, int rebin=5, bool approve=true, bool logy=true, int pos=0, int var=-1, int ene=-1, int eta=-1, int savePlot=-1); -void plotEMeanAll(int data=4, int models=15, bool ratio=false, bool approve=true, int savePlot=-1); -void plotEMean(std::string fname="", std::string hlt="All HLTs", int models=15, int var=0, int eta=0, int pv=0, int dataMC=1, bool raio=false, bool approve=true, int savePlot=-1); +void plotEMeanAll(int data=4, int models=15, bool ratio=false, bool approve=true, std::string postfix="", int savePlot=-1); +void plotEMean(std::string fname="", std::string hlt="All HLTs", int models=15, int var=0, int eta=0, int pv=0, int dataMC=1, bool raio=false, bool approve=true, std::string postfix="",int savePlot=-1); TCanvas* plotEMeanDraw(std::vector fnames, std::vector hlts, int var, int eta, int pv=0, bool approve=false, std::string dtype="Data", int coloff=0); TCanvas* plotEMeanRatioDraw(std::vector fnames, std::vector hlts, int var, int eta, int pv=0, bool approve=false, std::string dtype="Data", int coloff=0); TCanvas* plotEnergies(std::vector fnames, std::vector hlts, int var=0, int ien=0, int eta=0, int pv=0, bool varbin=false, int rebin=1, bool approve=false, std::string dtype="Data", bool logy=true, int pos=0, int coloff=0); @@ -508,21 +560,24 @@ void plotEnergyAll(std::string fname, std::string hlt, int models, int pv, } } -void plotEMeanAll(int data, int models, bool ratio, bool approve, int savePlot){ +void plotEMeanAll(int data, int models, bool ratio, bool approve, + std::string postfix, int savePlot){ int varmin(0), varmax(5), pvmin(0), pvmax(0), etamin(0), etamax(3); // std::cout << "Var " << varmin << ":" << varmax << " PV " << pvmin << ":" // << pvmax << " Eta " << etamin << ":" << etamax << std::endl; for (int var=varmin; var<=varmax; ++var) { for (int eta=etamin; eta<=etamax; ++eta) { for (int pv=pvmin; pv<=pvmax; ++pv) { - plotEMean("", "", models, var, eta, pv, data, ratio, approve, savePlot); + plotEMean("", "", models, var, eta, pv, data, ratio, approve, postfix, + savePlot); } } } } void plotEMean(std::string fname, std::string hlt, int models, int var, int eta, - int pv, int data, bool ratio, bool approve, int savePlot) { + int pv, int data, bool ratio, bool approve, std::string postfix, + int savePlot) { std::vector fnames, hlts; std::string dtype = (data == 1) ? "Data" : "MC"; @@ -579,7 +634,8 @@ void plotEMean(std::string fname, std::string hlt, int models, int var, int eta, if (c != 0 && savePlot >= 0 && savePlot < 3) { std::string ext[3] = {"eps", "gif", "pdf"}; char name[200]; - sprintf (name, "%s.%s", c->GetName(), ext[savePlot].c_str()); + sprintf (name, "%s%s.%s", c->GetName(), postfix.c_str(), + ext[savePlot].c_str()); c->Print(name); } } diff --git a/Calibration/IsolatedParticles/plugins/StudyHLT.cc b/Calibration/IsolatedParticles/plugins/StudyHLT.cc index 027ce346d8a8a..7aa64a7684ce3 100644 --- a/Calibration/IsolatedParticles/plugins/StudyHLT.cc +++ b/Calibration/IsolatedParticles/plugins/StudyHLT.cc @@ -104,7 +104,7 @@ class StudyHLT : public edm::one::EDAnalyzer&); // ----------member data --------------------------- - static const int nPBin_=10, nEtaBin_=4, nPVBin_=4; + static const int nPBin_=15, nEtaBin_=4, nPVBin_=4; static const int nGen_=(nPVBin_+12); HLTConfigProvider hltConfig_; edm::Service fs_; @@ -113,7 +113,7 @@ class StudyHLT : public edm::one::EDAnalyzer puWeights_; const edm::InputTag triggerEvent_, theTriggerResultsLabel_; spr::trackSelectionParameters selectionParameters_; @@ -135,8 +135,8 @@ class StudyHLT : public edm::one::EDAnalyzer h_HLTAccepts; - TH1D *h_p[nGen_+2], *h_pt[nGen_+2]; - TH1D *h_eta[nGen_+2], *h_phi[nGen_+2]; + TH1D *h_p[nGen_+2], *h_pt[nGen_+2], *h_counter[8]; + TH1D *h_eta[nGen_+2], *h_phi[nGen_+2], *h_h_pNew[8]; TH1I *h_ntrk[2]; TH1D *h_maxNearP[2], *h_ene1[2], *h_ene2[2], *h_ediff[2]; TH1D *h_energy[nPVBin_+8][nPBin_][nEtaBin_][6]; @@ -166,6 +166,7 @@ StudyHLT::StudyHLT(const edm::ParameterSet& iConfig) : tMinH_(iConfig.getUntrackedParameter("timeMinCutHCAL",-500.)), tMaxH_(iConfig.getUntrackedParameter("timeMaxCutHCAL",500.)), isItAOD_(iConfig.getUntrackedParameter("isItAOD",false)), + vetoTrigger_(iConfig.getUntrackedParameter("vetoTrigger",false)), doTree_(iConfig.getUntrackedParameter("doTree",false)), puWeights_(iConfig.getUntrackedParameter >("puWeights")), triggerEvent_(edm::InputTag("hltTriggerSummaryAOD","","HLT")), @@ -221,9 +222,11 @@ StudyHLT::StudyHLT(const edm::ParameterSet& iConfig) : << minTrackP_ << " maxTrackEta " << maxTrackEta_ << " tMinE_ " << tMinE_ << " tMaxE " << tMaxE_ << " tMinH_ " << tMinH_ << " tMaxH_ " << tMaxH_ - << " isItAOD " << isItAOD_ << " doTree " << doTree_; + << " isItAOD " << isItAOD_ << " doTree " << doTree_ + << " vetoTrigger " << vetoTrigger_; - double pBins[nPBin_+1] = {1.0,2.0,3.0,4.0,5.0,6.0,7.0,9.0,11.0,15.0,20.0}; + double pBins[nPBin_+1] = {1.0,2.0,3.0,4.0,5.0,6.0,7.0,9.0,11.0,15.0,20.0, + 25.0,30.0,40.0,60.0,100.0}; int etaBins[nEtaBin_+1] = {1, 7, 13, 17, 23}; int pvBins[nPVBin_+1] = {1, 2, 3, 5, 100}; for (int i=0; i<=nPBin_; ++i) pBin_[i] = pBins[i]; @@ -262,6 +265,7 @@ void StudyHLT::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { desc.addUntracked("timeMinCutHCAL",-500.0); desc.addUntracked("timeMaxCutHCAL", 500.0); desc.addUntracked("isItAOD", false); + desc.addUntracked("vetoTrigger", false); desc.addUntracked("doTree", false); desc.addUntracked >("puWeights", weights); descriptions.add("studyHLT",desc); @@ -269,6 +273,14 @@ void StudyHLT::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { void StudyHLT::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) { clear(); + int counter0[1000] = {0}; + int counter1[1000] = {0}; + int counter2[1000] = {0}; + int counter3[1000] = {0}; + int counter4[1000] = {0}; + int counter5[1000] = {0}; + int counter6[1000] = {0}; + int counter7[1000] = {0}; if (verbosity_ > 0) edm::LogInfo("IsoTrack") << "Event starts===================================="; int RunNo = iEvent.id().run(); @@ -310,8 +322,6 @@ void StudyHLT::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults); const std::vector & triggerNames_ = triggerNames.triggerNames(); for (unsigned int iHLT=0; iHLTsize(); iHLT++) { - // unsigned int triggerindx = hltConfig_.triggerIndex(triggerNames_[iHLT]); - // const std::vector& moduleLabels(hltConfig_.moduleLabels(triggerindx)); int ipos=-1; std::string newtriggerName = truncate_str(triggerNames_[iHLT]); for (unsigned int i=0; i 0) @@ -470,6 +481,10 @@ void StudyHLT::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) bool quality = pTrack->quality(selectionParameters_.minQuality); fillTrack(0, pt1,p1,eta1,phi1); if (quality) fillTrack(1, pt1,p1,eta1,phi1); + if (p1<1000) { + h_h_pNew[0]->Fill(p1); + ++counter0[(int)(p1)]; + } } h_ntrk[0]->Fill(ntrk,tr_eventWeight); @@ -568,15 +583,53 @@ void StudyHLT::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) fillTrack(nPVBin_+trackID+7, pt1,p1,eta1,phi1); fillEnergy(nPVBin_+trackID+3,ieta,p1,e7x7P.first,h3x3,e11x11P.first,h5x5); } + if (p1<1000) { + h_h_pNew[7]->Fill(p1); + ++counter7[(int)(p1)]; + } + } + if (p1<1000) { + h_h_pNew[6]->Fill(p1); + ++counter6[(int)(p1)]; } } + if (p1<1000) { + h_h_pNew[5]->Fill(p1); + ++counter5[(int)(p1)]; + } + } + if (p1<1000) { + h_h_pNew[4]->Fill(p1); + ++counter4[(int)(p1)]; } } + if (p1<1000) { + h_h_pNew[3]->Fill(p1); + ++counter3[(int)(p1)]; + } } + if (p1<1000) { + h_h_pNew[2]->Fill(p1); + ++counter2[(int)(p1)]; + } + } + if (p1<1000) { + h_h_pNew[1]->Fill(p1); + ++counter1[(int)(p1)]; } } h_ntrk[1]->Fill(ntrk,tr_eventWeight); if ((!tr_TrkPt.empty()) && doTree_) tree_->Fill(); + for (int i=0; i <1000; ++i) { + if (counter0[i]) h_counter[0]->Fill(i, counter0[i]); + if (counter1[i]) h_counter[1]->Fill(i, counter1[i]); + if (counter2[i]) h_counter[2]->Fill(i, counter2[i]); + if (counter3[i]) h_counter[3]->Fill(i, counter3[i]); + if (counter4[i]) h_counter[4]->Fill(i, counter4[i]); + if (counter5[i]) h_counter[5]->Fill(i, counter5[i]); + if (counter6[i]) h_counter[6]->Fill(i, counter6[i]); + if (counter7[i]) h_counter[7]->Fill(i, counter7[i]); + } } firstEvent_ = false; } @@ -709,13 +762,22 @@ void StudyHLT::beginJob() { (etaBin_[ie+1]-1), particle[i-4-nPVBin_].c_str(), TrkNames[7].c_str()); } - h_energy[i][ip][ie][j] = fs_->make(hname, htit, 500, -0.1, 4.9); + h_energy[i][ip][ie][j] = fs_->make(hname, htit, 5000,-0.1,49.9); h_energy[i][ip][ie][j]->Sumw2(); } } } } + for (int i=0; i<8; ++i) { + sprintf(hname,"counter%d",i); + sprintf(htit,"Counter with cut %d",i); + h_counter[i] = fs_->make(hname, htit, 1000, 0, 1000); + sprintf(hname,"h_pTNew%d",i); + sprintf(htit,"Track momentum with cut %d",i); + h_h_pNew[i] = fs_->make(hname, htit, 1000, 0, 1000); + } + // Now the tree if (doTree_) { tree_ = fs_->make("testTree", "new HLT Tree"); diff --git a/CommonTools/RecoAlgos/plugins/TrackingParticleConversionRefSelector.cc b/CommonTools/RecoAlgos/plugins/TrackingParticleConversionRefSelector.cc index 1f411cba9ef7b..fd7c5de75df74 100644 --- a/CommonTools/RecoAlgos/plugins/TrackingParticleConversionRefSelector.cc +++ b/CommonTools/RecoAlgos/plugins/TrackingParticleConversionRefSelector.cc @@ -31,7 +31,7 @@ TrackingParticleConversionRefSelector::TrackingParticleConversionRefSelector(con void TrackingParticleConversionRefSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("src", edm::InputTag("mix", "MergedTrackTruth")); - descriptions.add("trackingParticleConversionRefSelector", desc); + descriptions.add("trackingParticleConversionRefSelectorDefault", desc); } void TrackingParticleConversionRefSelector::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { diff --git a/CommonTools/RecoAlgos/python/trackingParticleConversionRefSelector_cfi.py b/CommonTools/RecoAlgos/python/trackingParticleConversionRefSelector_cfi.py new file mode 100644 index 0000000000000..dc7ffb018b2b8 --- /dev/null +++ b/CommonTools/RecoAlgos/python/trackingParticleConversionRefSelector_cfi.py @@ -0,0 +1,5 @@ +from CommonTools.RecoAlgos.trackingParticleConversionRefSelectorDefault_cfi import trackingParticleConversionRefSelectorDefault as _trackingParticleConversionRefSelectorDefault +trackingParticleConversionRefSelector = _trackingParticleConversionRefSelectorDefault.clone() + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleConversionRefSelector, src = "mixData:MergedTrackTruth") diff --git a/CommonTools/RecoAlgos/python/trackingParticleRefSelector_cfi.py b/CommonTools/RecoAlgos/python/trackingParticleRefSelector_cfi.py index cca1cdf827744..9cc21efd01c5c 100644 --- a/CommonTools/RecoAlgos/python/trackingParticleRefSelector_cfi.py +++ b/CommonTools/RecoAlgos/python/trackingParticleRefSelector_cfi.py @@ -18,5 +18,5 @@ maxPhi = cms.double(3.2), ) - - +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleRefSelector, src = "mixData:MergedTrackTruth") diff --git a/CommonTools/Statistics/interface/SequentialCombinationGenerator.h b/CommonTools/Statistics/interface/SequentialCombinationGenerator.h index 3f65bc0cb1d06..35ba5c8d86abc 100644 --- a/CommonTools/Statistics/interface/SequentialCombinationGenerator.h +++ b/CommonTools/Statistics/interface/SequentialCombinationGenerator.h @@ -102,7 +102,7 @@ template class SequentialCombinationGenerator { Vecint::iterator j1=find_if(ss.begin(),ss.end(),bind2nd(std::greater(),mincnew2)); if (ss.end()-j1 < p[i]) return empty; Vecint sss(j1,ss.end()); - for (int j=0;j +#include +#include "TH1.h" +#include "TH2.h" +#include "TStyle.h" +#include "TPaveText.h" +#include "TStyle.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +namespace RunInfoPI { + + // values are taken from https://github.com/cms-sw/cmssw/blob/master/MagneticField/GeomBuilder/plugins/VolumeBasedMagneticFieldESProducerFromDB.cc#L74-L75 + constexpr std::array nominalCurrents {{-1 ,0 ,9558,14416,16819,18268,19262}}; + constexpr std::array nominalFields {{3.8 ,0. , 2., 3., 3.5, 3.8, 4.}}; + + // all parameter than can be displayed + enum parameters {m_run, // int + m_start_time_ll, // long long; + m_stop_time_ll, // long long + m_start_current, // float + m_stop_current, // float + m_avg_current, // float + m_max_current, // float + m_min_current, // float + m_run_intervall_micros, // float + m_fedIN, // unsigned int + m_BField, // float + END_OF_TYPES}; + + /************************************************/ + float theBField (const float current){ + + // logic is taken from https://github.com/cms-sw/cmssw/blob/master/MagneticField/GeomBuilder/plugins/VolumeBasedMagneticFieldESProducerFromDB.cc#L156 + + int i=0; + for(;i<(int)nominalFields.size()-1;i++) { + if(2*current < nominalCurrents[i]+nominalCurrents[i+1] ){ + return nominalFields[i]; + } + } + return nominalFields[i]; + } + + /************************************************/ + std::string getStringFromTypeEnum (const parameters ¶meter){ + switch(parameter){ + case m_run : return "run number"; + case m_start_time_ll : return "start time"; + case m_stop_time_ll : return "stop time"; + case m_start_current : return "start current [A]"; + case m_stop_current : return "stop current [A]"; + case m_avg_current : return "average current [A]"; + case m_max_current : return "max current [A]"; + case m_min_current : return "min current [A]"; + case m_run_intervall_micros : return "run duration [#mus]"; + case m_fedIN : return "n. FEDs"; + case m_BField : return "B-field intensity [T]"; + default: return "should never be here"; + } + } + + /************************************************/ + void reportSummaryMapPalette(TH2* obj){ + + static int pcol[20]; + + float rgb[20][3]; + + for( int i=0; i<20; i++ ) { + if ( i < 17 ){ + rgb[i][0] = 0.80+0.01*i; + rgb[i][1] = 0.00+0.03*i; + rgb[i][2] = 0.00; + } else if ( i < 19 ) { + rgb[i][0] = 0.80+0.01*i; + rgb[i][1] = 0.00+0.03*i+0.15+0.10*(i-17); + rgb[i][2] = 0.00; + } else if ( i == 19 ){ + rgb[i][0] = 0.00; + rgb[i][1] = 0.80; + rgb[i][2] = 0.00; + } + pcol[i] = TColor::GetColor(rgb[i][0], rgb[i][1], rgb[i][2]); + } + + gStyle->SetPalette(20, pcol); + + if( obj ){ + obj->SetMinimum(-1.e-15); + obj->SetMaximum(+1.0); + obj->SetOption("colz"); + } + } + +}; +#endif diff --git a/CondCore/RunInfoPlugins/plugins/BuildFile.xml b/CondCore/RunInfoPlugins/plugins/BuildFile.xml new file mode 100644 index 0000000000000..4e290c7753304 --- /dev/null +++ b/CondCore/RunInfoPlugins/plugins/BuildFile.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/CondCore/RunInfoPlugins/plugins/RunInfo_PayloadInspector.cc b/CondCore/RunInfoPlugins/plugins/RunInfo_PayloadInspector.cc new file mode 100644 index 0000000000000..28931fff862e5 --- /dev/null +++ b/CondCore/RunInfoPlugins/plugins/RunInfo_PayloadInspector.cc @@ -0,0 +1,233 @@ +/*! + \file RunInfo_PayloadInspector + \Payload Inspector Plugin for RunInfo + \author M. Musich + \version $Revision: 1.0 $ + \date $Date: 2018/03/18 10:01:00 $ +*/ + +#include "CondCore/Utilities/interface/PayloadInspectorModule.h" +#include "CondCore/Utilities/interface/PayloadInspector.h" +#include "CondCore/CondDB/interface/Time.h" + +// the data format of the condition to be inspected +#include "CondFormats/RunInfo/interface/RunInfo.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +// helper +#include "CondCore/RunInfoPlugins/interface/RunInfoPayloadInspectoHelper.h" + +// system includes +#include +#include +#include + +// include ROOT +#include "TProfile.h" +#include "TH2F.h" +#include "TLegend.h" +#include "TCanvas.h" +#include "TLine.h" +#include "TStyle.h" +#include "TLatex.h" +#include "TPave.h" +#include "TPaveStats.h" +#include "TPaletteAxis.h" + +namespace { + + /************************************************ + RunInfo Payload Inspector of 1 IOV + *************************************************/ + class RunInfoTest : public cond::payloadInspector::Histogram1D { + + public: + RunInfoTest() : cond::payloadInspector::Histogram1D( "Test RunInfo", "Test RunInfo",10,0.0,10.0) + { + Base::setSingleIov( true ); + } + + bool fill( const std::vector >& iovs ) override{ + auto iov = iovs.front(); + std::shared_ptr payload = Base::fetchPayload( std::get<1>(iov) ); + + if(payload.get() ) { + payload->printAllValues(); + } + return true; + } + }; + + /************************************************ + Summary of RunInfo of 1 IOV + *************************************************/ + class RunInfoParameters : public cond::payloadInspector::PlotImage { + public: + RunInfoParameters() : cond::payloadInspector::PlotImage( "Display of RunInfo parameters" ){ + setSingleIov( true ); + } + + bool fill( const std::vector >& iovs ) override{ + auto iov = iovs.front(); + std::shared_ptr payload = fetchPayload( std::get<1>(iov) ); + + TCanvas canvas("Beam Spot Parameters Summary","RunInfo Parameters summary",1000,1000); + canvas.cd(); + + gStyle->SetHistMinimumZero(); + + canvas.SetTopMargin(0.08); + canvas.SetBottomMargin(0.06); + canvas.SetLeftMargin(0.3); + canvas.SetRightMargin(0.02); + canvas.Modified(); + canvas.SetGrid(); + + auto h2_RunInfoParameters = std::unique_ptr(new TH2F("Parameters","",1,0.0,1.0,11,0,11.)); + auto h2_RunInfoState = std::unique_ptr(new TH2F("State","",1,0.0,1.0,11,0,11.)); + h2_RunInfoParameters->SetStats(false); + h2_RunInfoState->SetStats(false); + + float fieldIntensity = RunInfoPI::theBField(payload->m_avg_current); + + std::function cutFunctor = [&payload,fieldIntensity](RunInfoPI::parameters my_param) { + float ret(-999.); + switch(my_param){ + case RunInfoPI::m_run : return float(payload->m_run); + case RunInfoPI::m_start_time_ll : return float(payload->m_start_time_ll); + case RunInfoPI::m_stop_time_ll : return float(payload->m_stop_time_ll); + case RunInfoPI::m_start_current : return payload->m_start_current; + case RunInfoPI::m_stop_current : return payload->m_stop_current; + case RunInfoPI::m_avg_current : return payload->m_avg_current; + case RunInfoPI::m_max_current : return payload->m_max_current; + case RunInfoPI::m_min_current : return payload->m_min_current; + case RunInfoPI::m_run_intervall_micros : return payload->m_run_intervall_micros; + case RunInfoPI::m_BField : return fieldIntensity; + case RunInfoPI::m_fedIN : return float((payload->m_fed_in).size()); + case RunInfoPI::END_OF_TYPES : return ret; + default : return ret; + } + }; + + h2_RunInfoParameters->GetXaxis()->SetBinLabel(1,"Value"); + h2_RunInfoState->GetXaxis()->SetBinLabel(1,"Value"); + + unsigned int yBin=11; + for(int foo = RunInfoPI::m_run; foo != RunInfoPI::END_OF_TYPES; foo++ ){ + RunInfoPI::parameters param = static_cast(foo); + std::string theLabel = RunInfoPI::getStringFromTypeEnum(param); + h2_RunInfoState->GetYaxis()->SetBinLabel(yBin,theLabel.c_str()); + h2_RunInfoParameters->GetYaxis()->SetBinLabel(yBin,theLabel.c_str()); + h2_RunInfoParameters->SetBinContent(1,yBin,cutFunctor(param)); + // non-fake payload + if((payload->m_run)!=-1){ + if ((payload->m_avg_current)<=-1){ + // go in error state + h2_RunInfoState->SetBinContent(1,yBin,0.); + } else { + // all is OK + h2_RunInfoState->SetBinContent(1,yBin,1.); + } + } else { + // this is a fake payload + h2_RunInfoState->SetBinContent(1,yBin,0.9); + } + yBin--; + + } + + h2_RunInfoParameters->GetXaxis()->LabelsOption("h"); + h2_RunInfoParameters->GetYaxis()->SetLabelSize(0.05); + h2_RunInfoParameters->GetXaxis()->SetLabelSize(0.05); + h2_RunInfoParameters->SetMarkerSize(1.5); + + h2_RunInfoState->GetXaxis()->LabelsOption("h"); + h2_RunInfoState->GetYaxis()->SetLabelSize(0.05); + h2_RunInfoState->GetXaxis()->SetLabelSize(0.05); + h2_RunInfoState->SetMarkerSize(1.5); + + RunInfoPI::reportSummaryMapPalette(h2_RunInfoState.get()); + h2_RunInfoState->Draw("col"); + + h2_RunInfoParameters->Draw("TEXTsame"); + + TLatex t1; + t1.SetNDC(); + t1.SetTextAlign(12); + t1.SetTextSize(0.03); + t1.DrawLatex(0.1, 0.98,"RunInfo parameters:"); + t1.DrawLatex(0.1, 0.95,"payload:"); + + t1.SetTextFont(42); + t1.SetTextColor(4); + t1.DrawLatex(0.37, 0.982,Form("IOV %s",std::to_string(+std::get<0>(iov)).c_str())); + t1.DrawLatex(0.21, 0.952,Form(" %s",(std::get<1>(iov)).c_str())); + + std::string fileName(m_imageFileName); + canvas.SaveAs(fileName.c_str()); + + return true; + } + + + }; + + /************************************************ + time history of Magnet currents from RunInfo + *************************************************/ + + template class RunInfoCurrentHistory : public cond::payloadInspector::HistoryPlot { + public: + RunInfoCurrentHistory() : cond::payloadInspector::HistoryPlot(getStringFromTypeEnum(param),getStringFromTypeEnum(param)+" value"){} + ~RunInfoCurrentHistory() override = default; + + float getFromPayload( RunInfo& payload ) override{ + + float fieldIntensity = RunInfoPI::theBField(payload.m_avg_current); + + switch(param){ + case RunInfoPI::m_start_current : return payload.m_start_current; + case RunInfoPI::m_stop_current : return payload.m_stop_current; + case RunInfoPI::m_avg_current : return payload.m_avg_current; + case RunInfoPI::m_max_current : return payload.m_max_current; + case RunInfoPI::m_min_current : return payload.m_min_current; + case RunInfoPI::m_BField : return fieldIntensity; + default: + edm::LogWarning("LogicError") << "Unknown parameter: " << param; + break; + } + + } // payload + + /************************************************/ + std::string getStringFromTypeEnum (const RunInfoPI::parameters ¶meter){ + switch(parameter){ + case RunInfoPI::m_start_current : return "Magent start current [A]"; + case RunInfoPI::m_stop_current : return "Magnet stop current [A]"; + case RunInfoPI::m_avg_current : return "Magnet average current [A]"; + case RunInfoPI::m_max_current : return "Magnet max current [A]"; + case RunInfoPI::m_min_current : return "Magnet min current [A]"; + case RunInfoPI::m_BField : return "B-field intensity [T]"; + default: return "should never be here"; + } + } + }; + + typedef RunInfoCurrentHistory RunInfoStartCurrentHistory; + typedef RunInfoCurrentHistory RunInfoStopCurrentHistory; + typedef RunInfoCurrentHistory RunInfoAverageCurrentHistory; + typedef RunInfoCurrentHistory RunInfoMaxCurrentHistory; + typedef RunInfoCurrentHistory RunInfoMinCurrentHistory; + typedef RunInfoCurrentHistory RunInfoBFieldHistory; + +} // close namespace + +PAYLOAD_INSPECTOR_MODULE( RunInfo ){ + PAYLOAD_INSPECTOR_CLASS( RunInfoTest ); + PAYLOAD_INSPECTOR_CLASS( RunInfoParameters ) ; + PAYLOAD_INSPECTOR_CLASS( RunInfoStopCurrentHistory ) ; + PAYLOAD_INSPECTOR_CLASS( RunInfoAverageCurrentHistory) ; + PAYLOAD_INSPECTOR_CLASS( RunInfoMaxCurrentHistory ) ; + PAYLOAD_INSPECTOR_CLASS( RunInfoMinCurrentHistory ) ; + PAYLOAD_INSPECTOR_CLASS( RunInfoBFieldHistory ) ; +} diff --git a/CondCore/RunInfoPlugins/test/BuildFile.xml b/CondCore/RunInfoPlugins/test/BuildFile.xml new file mode 100644 index 0000000000000..1d25e5fc2ac57 --- /dev/null +++ b/CondCore/RunInfoPlugins/test/BuildFile.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp b/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp new file mode 100644 index 0000000000000..fa18dd9c76eee --- /dev/null +++ b/CondCore/RunInfoPlugins/test/testRunInfoPayloadInspector.cpp @@ -0,0 +1,44 @@ +#include +#include +#include "CondCore/Utilities/interface/PayloadInspector.h" +#include "CondCore/RunInfoPlugins/plugins/RunInfo_PayloadInspector.cc" + +#include "FWCore/PluginManager/interface/PluginManager.h" +#include "FWCore/PluginManager/interface/standard.h" +#include "FWCore/PluginManager/interface/SharedLibrary.h" +#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h" + +int main(int argc, char** argv) { + + edmplugin::PluginManager::Config config; + edmplugin::PluginManager::configure(edmplugin::standard::config()); + + std::vector psets; + edm::ParameterSet pSet; + pSet.addParameter("@service_type",std::string("SiteLocalConfigService")); + psets.push_back(pSet); + edm::ServiceToken servToken(edm::ServiceRegistry::createSet(psets)); + edm::ServiceRegistry::Operate operate(servToken); + + std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS"); + + std::string tag = "runinfo_31X_hlt"; + std::string runTimeType = cond::time::timeTypeName(cond::runnumber); + cond::Time_t start = boost::lexical_cast(311950); + cond::Time_t end = boost::lexical_cast(312237); + + std::cout <<"## RunInfo testing"<); diff --git a/CondCore/Utilities/o2o/deploy_offline.sh b/CondCore/Utilities/o2o/deploy_offline.sh new file mode 100644 index 0000000000000..aec7e3669ba5e --- /dev/null +++ b/CondCore/Utilities/o2o/deploy_offline.sh @@ -0,0 +1,79 @@ +#!/bin/sh + +home=~ +localhome=/data/condbpro +root=/data/O2O +cmsswroot=/cvmfs/cms.cern.ch/ +extroot=/data/ext +release=CMSSW_10_0_5 +arch=slc6_amd64_gcc630 +sourceroot=CondCore/Utilities/o2o/templates +source=$cmsswroot/$arch/cms/cmssw/$release/src/$sourceroot + +files=( setup.sh + setStrip.sh + SiStripDCS.sh + ecal_laser.sh + EcalLaser.sh + EcalLaserTest.sh + EcalLaser_express.sh + EcalLaser_expressTest.sh ) + +folders=( EcalLaser + EcalLaserTest + EcalLaser_express + EcalLaser_expressTest + SiStrip ) + +cd $root +if [ ! -d scripts ]; then + mkdir scripts +fi +if [ ! -d logs ]; then + mkdir logs +fi + +sed_fmt () { + var=$(echo $1 | sed -e "s#/#\\\/#g") +} + +replace_params () { + params=( @root + @home + @cmsswroot + @extroot ) + tgt_file=$1 + var='' + # replace path params + sed_fmt $root + tgt_root=$var + sed -i -e s/@root/$tgt_root/g $tgt_file + sed_fmt $cmsswroot + tgt_cmsswroot=$var + sed -i -e s/@cmsswroot/$tgt_cmsswroot/g $tgt_file + sed_fmt $extroot + tgt_extroot=$var + sed -i -e s/@extroot/$tgt_extroot/g $tgt_file + sed_fmt $home + tgt_home=$var + # relace non-path params + sed -i -e s/@home/$tgt_home/g $tgt_file + sed -i -e s/@release/$release/g $tgt_file + sed -i -e s/@arch/$arch/g $tgt_file +} + +for file in "${files[@]}" +do + cp $source/$file scripts/ + tgt_file=scripts/$file + replace_params $tgt_file +done +for f in "${folders[@]}" +do + if [ ! -d $f ]; then + mkdir -p $f + fi + if [ ! -d logs/$f ]; then + mkdir logs/$f + fi +done diff --git a/CondCore/Utilities/o2o/deploy_online.sh b/CondCore/Utilities/o2o/deploy_online.sh new file mode 100644 index 0000000000000..94b7561325285 --- /dev/null +++ b/CondCore/Utilities/o2o/deploy_online.sh @@ -0,0 +1,89 @@ +#!/bin/sh + +home=~ +localhome=/data/popconpro +root=/data/O2O +cmsswroot=/opt/offline +extroot=/data/ext +release=CMSSW_10_0_5 +arch=slc7_amd64_gcc630 +sourceroot=CondCore/Utilities/o2o/templates +source=$cmsswroot/$arch/cms/cmssw/$release/src/$sourceroot + +files=( setup.sh + runStart.sh + runTestStart.sh + runStop.sh + runTestStop.sh + EcalDAQ.sh + EcalDAQTest.sh + EcalDCS.sh + EcalDCSTest.sh + EcalTPG.sh + RunInfoStart.sh + RunInfoStop.sh + RunInfoStartTest.sh + RunInfoStopTest.sh ) + +folders=( EcalDAQ + EcalDAQTest + EcalDCS + EcalDCSTest + EcalTPG + RunInfoStart + RunInfoStop + RunInfoStartTest + RunInfoStopTest ) + +cd $root +if [ ! -d scripts ]; then + mkdir scripts +fi +if [ ! -d logs ]; then + mkdir logs +fi + +sed_fmt () { + var=$(echo $1 | sed -e "s#/#\\\/#g") +} + +replace_params () { + params=( @root + @home + @cmsswroot + @extroot ) + tgt_file=$1 + var='' + # replace path params + sed_fmt $root + tgt_root=$var + sed -i -e s/@root/$tgt_root/g $tgt_file + sed_fmt $cmsswroot + tgt_cmsswroot=$var + sed -i -e s/@cmsswroot/$tgt_cmsswroot/g $tgt_file + sed_fmt $extroot + tgt_extroot=$var + sed -i -e s/@extroot/$tgt_extroot/g $tgt_file + sed_fmt $home + tgt_home=$var + # relace non-path params + sed -i -e s/@home/$tgt_home/g $tgt_file + sed -i -e s/@release/$release/g $tgt_file + sed -i -e s/@arch/$arch/g $tgt_file +} + +for file in "${files[@]}" +do + cp $source/$file scripts/ + tgt_file=scripts/$file + replace_params $tgt_file +done +for f in "${folders[@]}" +do + if [ ! -d $f ]; then + mkdir -p $f + fi + if [ ! -d logs/$f ]; then + mkdir logs/$f + fi +done diff --git a/CondCore/Utilities/o2o/deployed/offline/EcalLaser.sh b/CondCore/Utilities/o2o/deployed/offline/EcalLaser.sh new file mode 100755 index 0000000000000..c625c82aec887 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/EcalLaser.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j Laser +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaser $SRCDIR/EcalLaser_prompt_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/offline/EcalLaserTest.sh b/CondCore/Utilities/o2o/deployed/offline/EcalLaserTest.sh new file mode 100755 index 0000000000000..61c71e74e4042 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/EcalLaserTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j LaserTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaserTest $SRCDIR/EcalLaser_prompt_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/offline/EcalLaser_express.sh b/CondCore/Utilities/o2o/deployed/offline/EcalLaser_express.sh new file mode 100755 index 0000000000000..4db2775f4fea0 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/EcalLaser_express.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j Laser_express +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaser_express $SRCDIR/EcalLaser_express_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/offline/EcalLaser_expressTest.sh b/CondCore/Utilities/o2o/deployed/offline/EcalLaser_expressTest.sh new file mode 100755 index 0000000000000..771c6cc78a5ca --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/EcalLaser_expressTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O_new.sh -s Ecal -j Laser_expressTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_test_popCon EcalLaser_expressTest $SRCDIR/EcalLaser_express_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.crontab b/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.crontab new file mode 100644 index 0000000000000..a09be0c0cb4e9 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.crontab @@ -0,0 +1,4 @@ +5 * * * * /data/O2O/scripts/SiStripDCS.sh SiStripDetVOff_1hourDelay +20 * * * * /data/O2O/scripts/SiStripDCS.sh SiStripDetVOff_13hourDelay +40 * * * * /data/O2O/scripts/SiStripDCS.sh SiStripDetVOff_prompt +45 * * * * /data/O2O/scripts/SiStripDCS.sh SiStripDetVOff_sampling_test \ No newline at end of file diff --git a/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.sh b/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.sh new file mode 100755 index 0000000000000..6c4b3bdd5fa32 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/SiStripDCS.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# +# wrapper script to run DCS O2O +# Last updated: Apr 21, 2017 +# Author: Huilin Qu +# +# Usage: SiStripDCS.sh JOB_NAME + +JOBNAME=$1 + +O2O_HOME=/data/O2O/ + +source $O2O_HOME/scripts/setStripO2O.sh $JOBNAME +o2oRun_SiStripDCS.py $JOBNAME |tee -a $LOGFILE + +# Exit with status of last command +# Make sure the last command is o2oRun_SiStripDCS.py! +exit $? diff --git a/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.crontab b/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.crontab new file mode 100644 index 0000000000000..e3e73bb7ebd2c --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.crontab @@ -0,0 +1 @@ +0 */2 * * * /bin/sh /data/O2O/scripts/runTimeBasedO2O.sh >/dev/null 2>&1 diff --git a/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.sh b/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.sh new file mode 100755 index 0000000000000..1db430b3a498e --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/runTimeBasedO2O.sh @@ -0,0 +1,26 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +BASEDIR=/data/O2O +LOGFILE=${BASEDIR}/logs/TimeBasedO2O.log +DATE=`date` +echo " " | tee -a $LOGFILE +echo "----- new cronjob started for Time Based O2O at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +#Check if the exportation scripts are running, if so exits without launching them +PID_0=`ps aux | grep '/bin/sh /data/O2O/scripts/EcalLaser.sh' | grep -v grep | awk '{print $2}'` +if [ "${PID_0}" ] + then + echo "Ecal Laser Exportation script still running with pid ${PID_0}: exiting" | tee -a $LOGFILE + exit 1 +else + /bin/sh /data/O2O/scripts/EcalLaser.sh +fi +PID_1=`ps aux | grep '/bin/sh /data/O2O/scripts/EcalLaser_express.sh' | grep -v grep | awk '{print $2}'` +if [ "${PID_1}" ] + then + echo "Ecal LaserExpress Exportation script still running with pid ${PID_1}: exiting" | tee -a $LOGFILE + exit 1 +else + /bin/sh /data/O2O/scripts/EcalLaser_express.sh +fi diff --git a/CondCore/Utilities/o2o/deployed/offline/setStripO2O.sh b/CondCore/Utilities/o2o/deployed/offline/setStripO2O.sh new file mode 100755 index 0000000000000..d06950b821034 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/setStripO2O.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# set the CMSSW environtmet for SiStripO2O +# and the proxies for conditionUploader +# + +O2ONAME=$1 + +# deployment-specific params +BASEDIR=/data/O2O +SCRAM_ARCH=slc6_amd64_gcc630 +RELEASE=CMSSW_10_0_5 +RELEASEDIR=/cvmfs/cms.cern.ch/slc6_amd64_gcc630/cms/cmssw/${RELEASE} + +source /cvmfs/cms.cern.ch/cmsset_default.sh +cd ${RELEASEDIR}/src +eval `scramv1 ru -sh` +cd - + +O2O_HOME=/data/O2O/SiStrip/ + +# for sqlalchmey (?) +export PYTHON_EGG_CACHE=/data/condbpro +# path to .netrc file and .cms_cond dir +export COND_AUTH_PATH=/data/O2O/SiStrip + +# save log files produced by o2oRun.py on disk +export JOBDIR=${O2O_HOME}/jobs/${O2ONAME} +export O2O_LOG_FOLDER=${BASEDIR}/logs/${O2ONAME} +export LOGFILE=${BASEDIR}/logs/$O2ONAME.log + +# temperoray fix for TNS_ADMIN +export TNS_ADMIN=/cvmfs/cms.cern.ch/slc6_amd64_gcc530/cms/oracle-env/29/etc diff --git a/CondCore/Utilities/o2o/deployed/offline/setupO2O.sh b/CondCore/Utilities/o2o/deployed/offline/setupO2O.sh new file mode 100755 index 0000000000000..1a3a7caf9d5d8 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/offline/setupO2O.sh @@ -0,0 +1,100 @@ +#!/bin/sh + +# deployment-specific params +BASEDIR=/data/O2O +RELEASE=CMSSW_10_0_5 +RELEASEDIR=/cvmfs/cms.cern.ch/slc6_amd64_gcc630/cms/cmssw/${RELEASE} + +# command params +OPTIND=1 + +SUBSYS="" +JOBNAME="" + +while getopts "h?s:j:" opt; do + case $opt in + h|\?) + echo "Mo' to spiego..." + exit 0 + ;; + s) SUBSYS=$OPTARG + ;; + j) JOBNAME=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) + +[ "$1" = "--" ] && shift + +O2ONAME=$SUBSYS$JOBNAME +#echo "name=$O2ONAME, subsystem=$SUBSYS, job=$JOBNAME" + +# o2o specific params +LOGFILE=${BASEDIR}/logs/$O2ONAME.log +JOBDIR=${BASEDIR}/${SUBSYS}/${JOBNAME} +DATE=`date` + +# functions +function logRun(){ + echo "----- new job started for $1 at -----" | tee -a $LOGFILE + echo $DATE | tee -a $LOGFILE +} + +function log() { + echo "[`date`] : $@ " | tee -a $LOGFILE +} + +function submit_command() { + logRun $1 + o2o run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_test_command() { + logRun $1 + o2o --db dev run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +# global variables +export PYTHON_EGG_CACHE=/data/condbpro +export SCRAM_ARCH=slc6_amd64_gcc630 +export O2O_LOG_FOLDER=/data/O2O/logs/${O2ONAME} +export COND_AUTH_PATH=$BASEDIR +source /cvmfs/cms.cern.ch/cmsset_default.sh + +cd ${RELEASEDIR}/src +eval `scramv1 run -sh` +# set up OCCI workaround +export LD_PRELOAD=$CMS_ORACLEOCCI_LIB + +# workaround for oracle tnsnames +export TNS_ADMIN=/cvmfs/cms.cern.ch/slc6_amd64_gcc530/cms/oracle-env/29/etc + +cd ${JOBDIR} + + diff --git a/CondCore/Utilities/o2o/deployed/online/EcalDAQ.sh b/CondCore/Utilities/o2o/deployed/online/EcalDAQ.sh new file mode 100755 index 0000000000000..924483807112c --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalDAQ.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j DAQ +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDAQ $SRCDIR/EcalDAQ_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/online/EcalDAQTest.sh b/CondCore/Utilities/o2o/deployed/online/EcalDAQTest.sh new file mode 100755 index 0000000000000..b9d5f6dfe6559 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalDAQTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j DAQTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDAQTest $SRCDIR/EcalDAQ_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/online/EcalDCS.sh b/CondCore/Utilities/o2o/deployed/online/EcalDCS.sh new file mode 100755 index 0000000000000..0fbdf27fa6bf3 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalDCS.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j DCS +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDCS $SRCDIR/EcalDCS_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/online/EcalDCSTest.sh b/CondCore/Utilities/o2o/deployed/online/EcalDCSTest.sh new file mode 100755 index 0000000000000..a86c72eb59369 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalDCSTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s Ecal -j DCSTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDCSTest $SRCDIR/EcalDCS_popcon.py diff --git a/CondCore/Utilities/o2o/deployed/online/EcalTPG.sh b/CondCore/Utilities/o2o/deployed/online/EcalTPG.sh new file mode 100755 index 0000000000000..40f2beccb1a08 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalTPG.sh @@ -0,0 +1,68 @@ +#!/bin/bash +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +JCPORT=9999 + +while getopts ":t:r:p:k" options; do + case $options in + t ) TPG_KEY=$OPTARG;; + r ) RUN_NUMBER=$OPTARG;; + p ) JCPORT=$OPTARG;; + k ) KILLSWITCH=1;; + esac +done + +source /data/O2O/scripts/setupO2O.sh -s Ecal -j TPG + +log "-----------------------------------------------------------------------" +log "EcalTPG.sh" +log "PID $$" +log "HOSTNAME $HOSTNAME" +log "JCPORT $JCPORT" +log "TPG_KEY $TPG_KEY" +log "RUN_NUMBER $RUN_NUMBER" +log "date `date`" +log "-----------------------------------------------------------------------" + +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python + +# run the O2Os... +submit_cmsRun EcalTPGTowerStatus $SRCDIR/copyBadTT_cfg.py +submit_cmsRun EcalTPGCrystalStatus $SRCDIR/copyBadXT_cfg.py +submit_cmsRun EcalTPGFineGrainEBGroup $SRCDIR/copyFgrGroup_cfg.py +submit_cmsRun EcalTPGFineGrainEBIdMap $SRCDIR/copyFgrIdMap_cfg.py +submit_cmsRun EcalTPGFineGrainStripEE $SRCDIR/copyFgrStripEE_cfg.py +submit_cmsRun EcalTPGFineGrainTowerEE $SRCDIR/copyFgrTowerEE_cfg.py +submit_cmsRun EcalTPGLinearizationConst $SRCDIR/copyLin_cfg.py +submit_cmsRun EcalTPGLutGroup $SRCDIR/copyLutGroup_cfg.py +submit_cmsRun EcalTPGLutIdMap $SRCDIR/copyLutIdMap_cfg.py +submit_cmsRun EcalTPGPedestals $SRCDIR/copyPed_cfg.py +submit_cmsRun EcalTPGPhysicsConst $SRCDIR/copyPhysConst_cfg.py +submit_cmsRun EcalTPGSlidingWindow $SRCDIR/copySli_cfg.py +submit_cmsRun EcalTPGWeightGroup $SRCDIR/copyWGroup_cfg.py +submit_cmsRun EcalTPGWeightIdMap $SRCDIR/copyWIdMap_cfg.py +submit_cmsRun EcalTPGSpike $SRCDIR/copySpikeTh_cfg.py +submit_cmsRun EcalTPGStripStatus $SRCDIR/copyBadStrip_cfg.py +submit_command EcalADCToGeV_express "cmsRun $SRCDIR/EcalADCToGeVConstantPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalADCToGeV_hlt "cmsRun $SRCDIR/EcalADCToGeVConstantPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalIntercalibConstants_express "cmsRun $SRCDIR/EcalIntercalibConstantsPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalIntercalibConstants_hlt "cmsRun $SRCDIR/EcalIntercalibConstantsPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" + +log "-----------------------------------------------------------------------" +if [ -n "$KILLSWITCH" ]; then + log "Killswitch activated" +ADDR="http://$HOSTNAME:$JCPORT/urn:xdaq-application:service=jobcontrol/ProcKill?kill=$$" + +KILLCMD="curl $ADDR" + +log $KILLCMD +$KILLCMD > /dev/null + +fi + +log DONE + + +exit 0 diff --git a/CondCore/Utilities/o2o/deployed/online/EcalTPGTest.sh b/CondCore/Utilities/o2o/deployed/online/EcalTPGTest.sh new file mode 100755 index 0000000000000..f34553a5c7fe0 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/EcalTPGTest.sh @@ -0,0 +1,55 @@ +#!/bin/bash +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +#JCPORT=9999 + +#while getopts ":t:r:p:k" options; do +# case $options in +# t ) TPG_KEY=$OPTARG;; +# r ) RUN_NUMBER=$OPTARG;; +# p ) JCPORT=$OPTARG;; +# k ) KILLSWITCH=1;; +# esac +#done + +source /data/O2O/scripts/setupO2O.sh -s Ecal -j TPGTest + +#log "-----------------------------------------------------------------------" +#log "EcalTPG.sh" +#log "PID $$" +#log "HOSTNAME $HOSTNAME" +#log "JCPORT $JCPORT" +#log "TPG_KEY $TPG_KEY" +#log "RUN_NUMBER $RUN_NUMBER" +#log "date `date`" +#log "-----------------------------------------------------------------------" + +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python + +# run the O2Os... +submit_test_cmsRun copyBadTT $SRCDIR/copyBadTT_cfg.py +submit_test_cmsRun copyLin copyLin_cfg.py +submit_test_cmsRun copyPed copyPed_cfg.py +submit_test_cmsRun copyPhysConst copyPhysConst_cfg.py +submit_test_cmsRun copySli copySli_cfg.py +submit_test_cmsRun updateADCToGeV_express updateADCToGeV_express.py + +# END OF CHANGES +#log "-----------------------------------------------------------------------" +#if [ -n "$KILLSWITCH" ]; then +# log "Killswitch activated" +#ADDR="http://$HOSTNAME:$JCPORT/urn:xdaq-application:service=jobcontrol/ProcKill?kill=$$" + +#KILLCMD="curl $ADDR" + +#log $KILLCMD +#$KILLCMD > /dev/null + +#fi + +#log DONE + + +exit 0 diff --git a/CondCore/Utilities/o2o/deployed/online/RunInfoStart.sh b/CondCore/Utilities/o2o/deployed/online/RunInfoStart.sh new file mode 100644 index 0000000000000..102df4adc3cbb --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/RunInfoStart.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s RunInfo -j Start +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_command RunInfoStart "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/deployed/online/RunInfoStartTest.sh b/CondCore/Utilities/o2o/deployed/online/RunInfoStartTest.sh new file mode 100644 index 0000000000000..be4bbd7955738 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/RunInfoStartTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s RunInfo -j StartTest +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_test_command RunInfoStartTest "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/deployed/online/RunInfoStop.sh b/CondCore/Utilities/o2o/deployed/online/RunInfoStop.sh new file mode 100644 index 0000000000000..27216bcb0fe94 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/RunInfoStop.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s RunInfo -j Stop +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_command RunInfoStop "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/deployed/online/RunInfoStopTest.sh b/CondCore/Utilities/o2o/deployed/online/RunInfoStopTest.sh new file mode 100644 index 0000000000000..bdae7b9b2c9db --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/RunInfoStopTest.sh @@ -0,0 +1,3 @@ +source /data/O2O/scripts/setupO2O.sh -s RunInfo -j StopTest +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_test_command RunInfoStopTest "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/deployed/online/runStart.sh b/CondCore/Utilities/o2o/deployed/online/runStart.sh new file mode 100755 index 0000000000000..f0e51c1f563c2 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/runStart.sh @@ -0,0 +1,16 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=/data/O2O/logs/runStart.log +DATE=`date` +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 start at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh /data/O2O/scripts/RunInfoStart.sh $1 | tee -a $LOGFILE +/bin/sh /data/O2O/scripts/EcalDAQ.sh | tee -a $LOGFILE +/bin/sh /data/O2O/scripts/EcalDCS.sh | tee -a $LOGFILE +#/bin/sh /data/O2O/scripts/RunInfoStartTest.sh $1 | tee -a /data/O2O/logs/runTestStart.log diff --git a/CondCore/Utilities/o2o/deployed/online/runStop.sh b/CondCore/Utilities/o2o/deployed/online/runStop.sh new file mode 100755 index 0000000000000..3cde915c38aa7 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/runStop.sh @@ -0,0 +1,14 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=/data/O2O/logs/runStop.log +DATE=`date` +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 stop at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh /data/O2O/scripts/RunInfoStop.sh $1 | tee -a $LOGFILE +#/bin/sh /data/O2O/scripts/RunInfoStopTest.sh $1 | tee -a /data/O2O/logs/runTestStop.log \ No newline at end of file diff --git a/CondCore/Utilities/o2o/deployed/online/runTestStart.sh b/CondCore/Utilities/o2o/deployed/online/runTestStart.sh new file mode 100755 index 0000000000000..d4fa05e02f513 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/runTestStart.sh @@ -0,0 +1,15 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=/data/O2O/logs/runTestStart.log +DATE=`date` +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +echo " " | tee -a $LOGFILE +echo "----- new cronjob started for Run $1 test start at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh /data/O2O/scripts/RunInfoStartTest.sh $1 | tee -a $LOGFILE +/bin/sh /data/O2O/scripts/EcalDAQTest.sh | tee -a $LOGFILE +/bin/sh /data/O2O/scripts/EcalDCSTest.sh | tee -a $LOGFILE \ No newline at end of file diff --git a/CondCore/Utilities/o2o/deployed/online/runTestStop.sh b/CondCore/Utilities/o2o/deployed/online/runTestStop.sh new file mode 100755 index 0000000000000..83ceb4334a157 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/runTestStop.sh @@ -0,0 +1,13 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=/data/O2O/logs/runTestStop.log +DATE=`date` +#setting up environment variables +export HOME=/nfshome0/popconpro +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:/nfshome0/popconpro/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 test stop at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh /data/O2O/scripts/RunInfoStopTest.sh $1 | tee -a $LOGFILE diff --git a/CondCore/Utilities/o2o/deployed/online/setupO2O.sh b/CondCore/Utilities/o2o/deployed/online/setupO2O.sh new file mode 100755 index 0000000000000..ed4b9abc3a6c8 --- /dev/null +++ b/CondCore/Utilities/o2o/deployed/online/setupO2O.sh @@ -0,0 +1,100 @@ +#!/bin/sh + +# deployment-specific params +BASEDIR=/data/O2O +RELEASE=CMSSW_10_0_5 +ARCH=slc7_amd64_gcc630 +RELEASEDIR=/opt/offline/${ARCH}/cms/cmssw/${RELEASE} + +# command params +OPTIND=1 + +SUBSYS="" +JOBNAME="" + +while getopts "h?s:j:" opt; do + case $opt in + h|\?) + echo "Mo' to spiego..." + exit 0 + ;; + s) SUBSYS=$OPTARG + ;; + j) JOBNAME=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) + +[ "$1" = "--" ] && shift + +O2ONAME=$SUBSYS$JOBNAME +#echo "name=$O2ONAME, subsystem=$SUBSYS, job=$JOBNAME" + +# o2o specific params +LOGFILE=${BASEDIR}/logs/$O2ONAME.log +JOBDIR=${BASEDIR}/${SUBSYS}/${JOBNAME} +DATE=`date` + +# functions +function logRun(){ + echo "----- new job started for $1 at -----" | tee -a $LOGFILE + echo $DATE | tee -a $LOGFILE +} + +function log() { + echo "[`date`] : $@ " | tee -a $LOGFILE +} + +function submit_command() { + logRun $1 + o2o run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_test_command() { + logRun $1 + o2o --db dev run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +# global variables +export SCRAM_ARCH=$ARCH +export O2O_LOG_FOLDER=/data/O2O/logs/${O2ONAME} +export COND_AUTH_PATH=$BASEDIR +source /opt/offline/cmsset_default.sh + +cd ${RELEASEDIR}/src +eval `scramv1 run -sh` +# set up OCCI workaround +export LD_PRELOAD=$CMS_ORACLEOCCI_LIB + +# workaround for oracle tnsnames +export TNS_ADMIN=/data/ext/oracle-env/29/etc + +cd ${JOBDIR} + + diff --git a/CondCore/Utilities/o2o/templates/EcalDAQ.sh b/CondCore/Utilities/o2o/templates/EcalDAQ.sh new file mode 100755 index 0000000000000..f4e5a03d5f8cb --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalDAQ.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalDAQ +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDAQ $SRCDIR/EcalDAQ_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalDAQTest.sh b/CondCore/Utilities/o2o/templates/EcalDAQTest.sh new file mode 100755 index 0000000000000..68d887d87b4d6 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalDAQTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalDAQTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDAQTest $SRCDIR/EcalDAQ_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalDCS.sh b/CondCore/Utilities/o2o/templates/EcalDCS.sh new file mode 100755 index 0000000000000..bcfef7d0b99ce --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalDCS.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalDCS +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDCS $SRCDIR/EcalDCS_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalDCSTest.sh b/CondCore/Utilities/o2o/templates/EcalDCSTest.sh new file mode 100755 index 0000000000000..215673cf07506 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalDCSTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalDCSTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalDCSTest $SRCDIR/EcalDCS_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalLaser.sh b/CondCore/Utilities/o2o/templates/EcalLaser.sh new file mode 100755 index 0000000000000..52c262a3f89d7 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalLaser.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalLaser +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaser $SRCDIR/EcalLaser_prompt_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalLaserTest.sh b/CondCore/Utilities/o2o/templates/EcalLaserTest.sh new file mode 100755 index 0000000000000..c2586688b6c19 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalLaserTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalLaserTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaserTest $SRCDIR/EcalLaser_prompt_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalLaser_express.sh b/CondCore/Utilities/o2o/templates/EcalLaser_express.sh new file mode 100755 index 0000000000000..2c0f8becd9c69 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalLaser_express.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalLaser_express +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_popCon EcalLaser_express $SRCDIR/EcalLaser_express_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalLaser_expressTest.sh b/CondCore/Utilities/o2o/templates/EcalLaser_expressTest.sh new file mode 100755 index 0000000000000..f433d8345b69e --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalLaser_expressTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j EcalLaser_expressTest +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python +submit_test_popCon EcalLaser_expressTest $SRCDIR/EcalLaser_express_popcon.py diff --git a/CondCore/Utilities/o2o/templates/EcalTPG.sh b/CondCore/Utilities/o2o/templates/EcalTPG.sh new file mode 100755 index 0000000000000..1ab900de0a7be --- /dev/null +++ b/CondCore/Utilities/o2o/templates/EcalTPG.sh @@ -0,0 +1,68 @@ +#!/bin/bash +#setting up environment variables +export HOME=@home +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:@home/bin + +JCPORT=9999 + +while getopts ":t:r:p:k" options; do + case $options in + t ) TPG_KEY=$OPTARG;; + r ) RUN_NUMBER=$OPTARG;; + p ) JCPORT=$OPTARG;; + k ) KILLSWITCH=1;; + esac +done + +source @root/scripts/setup.sh -j EcalTPG + +log "-----------------------------------------------------------------------" +log "EcalTPG.sh" +log "PID $$" +log "HOSTNAME $HOSTNAME" +log "JCPORT $JCPORT" +log "TPG_KEY $TPG_KEY" +log "RUN_NUMBER $RUN_NUMBER" +log "date `date`" +log "-----------------------------------------------------------------------" + +SRCDIR=$RELEASEDIR/src/CondTools/Ecal/python + +# run the O2Os... +submit_cmsRun EcalTPGTowerStatus $SRCDIR/copyBadTT_cfg.py +submit_cmsRun EcalTPGCrystalStatus $SRCDIR/copyBadXT_cfg.py +submit_cmsRun EcalTPGFineGrainEBGroup $SRCDIR/copyFgrGroup_cfg.py +submit_cmsRun EcalTPGFineGrainEBIdMap $SRCDIR/copyFgrIdMap_cfg.py +submit_cmsRun EcalTPGFineGrainStripEE $SRCDIR/copyFgrStripEE_cfg.py +submit_cmsRun EcalTPGFineGrainTowerEE $SRCDIR/copyFgrTowerEE_cfg.py +submit_cmsRun EcalTPGLinearizationConst $SRCDIR/copyLin_cfg.py +submit_cmsRun EcalTPGLutGroup $SRCDIR/copyLutGroup_cfg.py +submit_cmsRun EcalTPGLutIdMap $SRCDIR/copyLutIdMap_cfg.py +submit_cmsRun EcalTPGPedestals $SRCDIR/copyPed_cfg.py +submit_cmsRun EcalTPGPhysicsConst $SRCDIR/copyPhysConst_cfg.py +submit_cmsRun EcalTPGSlidingWindow $SRCDIR/copySli_cfg.py +submit_cmsRun EcalTPGWeightGroup $SRCDIR/copyWGroup_cfg.py +submit_cmsRun EcalTPGWeightIdMap $SRCDIR/copyWIdMap_cfg.py +submit_cmsRun EcalTPGSpike $SRCDIR/copySpikeTh_cfg.py +submit_cmsRun EcalTPGStripStatus $SRCDIR/copyBadStrip_cfg.py +submit_command EcalADCToGeV_express "cmsRun $SRCDIR/EcalADCToGeVConstantPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalADCToGeV_hlt "cmsRun $SRCDIR/EcalADCToGeVConstantPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalIntercalibConstants_express "cmsRun $SRCDIR/EcalIntercalibConstantsPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" +submit_command EcalIntercalibConstants_hlt "cmsRun $SRCDIR/EcalIntercalibConstantsPopConBTransitionAnalyzer_cfg.py runNumber=$RUN_NUMBER destinationDatabase={db} destinationTag={tag} tagForRunInfo={runInfoTag} tagForBOff={boffTag} tagForBOn={bonTag}" + +log "-----------------------------------------------------------------------" +if [ -n "$KILLSWITCH" ]; then + log "Killswitch activated" +ADDR="http://$HOSTNAME:$JCPORT/urn:xdaq-application:service=jobcontrol/ProcKill?kill=$$" + +KILLCMD="curl $ADDR" + +log $KILLCMD +$KILLCMD > /dev/null + +fi + +log DONE + + +exit 0 diff --git a/CondCore/Utilities/o2o/templates/RunInfoStart.sh b/CondCore/Utilities/o2o/templates/RunInfoStart.sh new file mode 100644 index 0000000000000..fb643348bf769 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/RunInfoStart.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j RunInfoStart +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_command RunInfoStart "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/templates/RunInfoStartTest.sh b/CondCore/Utilities/o2o/templates/RunInfoStartTest.sh new file mode 100644 index 0000000000000..7c0e0f6701acd --- /dev/null +++ b/CondCore/Utilities/o2o/templates/RunInfoStartTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j RunInfoStartTest +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_test_command RunInfoStartTest "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/templates/RunInfoStop.sh b/CondCore/Utilities/o2o/templates/RunInfoStop.sh new file mode 100644 index 0000000000000..f7b890f32b677 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/RunInfoStop.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j RunInfoStop +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_command RunInfoStop "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/templates/RunInfoStopTest.sh b/CondCore/Utilities/o2o/templates/RunInfoStopTest.sh new file mode 100644 index 0000000000000..2d00c78731045 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/RunInfoStopTest.sh @@ -0,0 +1,3 @@ +source @root/scripts/setup.sh -j RunInfoStopTest +SRCDIR=$RELEASEDIR/src/CondTools/RunInfo/python +submit_test_command RunInfoStopTest "cmsRun $SRCDIR/RunInfoPopConAnalyzer.py runNumber=$1 destinationConnection={db} tag={tag}" diff --git a/CondCore/Utilities/o2o/templates/SiStripDCS.sh b/CondCore/Utilities/o2o/templates/SiStripDCS.sh new file mode 100755 index 0000000000000..f85242a0f7032 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/SiStripDCS.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# +# wrapper script to run DCS O2O +# Last updated: Apr 21, 2017 +# Author: Huilin Qu +# +# Usage: SiStripDCS.sh JOB_NAME + +JOBNAME=$1 + +O2O_HOME=@root + +source $O2O_HOME/scripts/setStrip.sh $JOBNAME +o2oRun_SiStripDCS.py $JOBNAME |tee -a $LOGFILE + +# Exit with status of last command +# Make sure the last command is o2oRun_SiStripDCS.py! +exit $? diff --git a/CondCore/Utilities/o2o/templates/ecal_laser.sh b/CondCore/Utilities/o2o/templates/ecal_laser.sh new file mode 100755 index 0000000000000..73cee73809d6f --- /dev/null +++ b/CondCore/Utilities/o2o/templates/ecal_laser.sh @@ -0,0 +1,26 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +BASEDIR=@root +LOGFILE=${BASEDIR}/logs/TimeBasedO2O.log +DATE=`date` +echo " " | tee -a $LOGFILE +echo "----- new cronjob started for Time Based O2O at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +#Check if the exportation script is running, if so exits without launching it +PID_0=`ps aux | grep '/bin/sh @root/scripts/EcalLaser.sh' | grep -v grep | awk '{print $2}'` +if [ "${PID_0}" ] + then + echo "Ecal Laser Exportation script still running with pid ${PID_0}: exiting" | tee -a $LOGFILE + exit 1 +else + /bin/sh @root/scripts/EcalLaser.sh +fi +PID_1=`ps aux | grep '/bin/sh @root/scripts/EcalLaser_express.sh' | grep -v grep | awk '{print $2}'` +if [ "${PID_1}" ] + then + echo "Ecal LaserExpress Exportation script still running with pid ${PID_1}: exiting" | tee -a $LOGFILE + exit 1 +else + /bin/sh @root/scripts/EcalLaser_express.sh +fi diff --git a/CondCore/Utilities/o2o/templates/runStart.sh b/CondCore/Utilities/o2o/templates/runStart.sh new file mode 100755 index 0000000000000..2fb4bc2a32c7a --- /dev/null +++ b/CondCore/Utilities/o2o/templates/runStart.sh @@ -0,0 +1,16 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=@root/logs/runStart.log +DATE=`date` +#setting up environment variables +export HOME=@home +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:@home/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 start at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh @root/scripts/RunInfoStart.sh $1 | tee -a $LOGFILE +/bin/sh @root/scripts/EcalDAQ.sh | tee -a $LOGFILE +/bin/sh @root/scripts/EcalDCS.sh | tee -a $LOGFILE + diff --git a/CondCore/Utilities/o2o/templates/runStop.sh b/CondCore/Utilities/o2o/templates/runStop.sh new file mode 100755 index 0000000000000..80ff72487b180 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/runStop.sh @@ -0,0 +1,13 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=@root/logs/runStop.log +DATE=`date` +#setting up environment variables +export HOME=@home +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:@home/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 stop at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh @root/scripts/RunInfoStop.sh $1 | tee -a $LOGFILE diff --git a/CondCore/Utilities/o2o/templates/runTestStart.sh b/CondCore/Utilities/o2o/templates/runTestStart.sh new file mode 100755 index 0000000000000..0e5d91cfe4ec9 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/runTestStart.sh @@ -0,0 +1,15 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=@root/logs/runTestStart.log +DATE=`date` +#setting up environment variables +export HOME=@home +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:@home/bin + +echo " " | tee -a $LOGFILE +echo "----- new cronjob started for Run $1 test start at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh @root/scripts/RunInfoStartTest.sh $1 | tee -a $LOGFILE +/bin/sh @root/scripts/EcalDAQTest.sh | tee -a $LOGFILE +/bin/sh @root/scripts/EcalDCSTest.sh | tee -a $LOGFILE \ No newline at end of file diff --git a/CondCore/Utilities/o2o/templates/runTestStop.sh b/CondCore/Utilities/o2o/templates/runTestStop.sh new file mode 100755 index 0000000000000..00601ca371a42 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/runTestStop.sh @@ -0,0 +1,13 @@ +#!/bin/bash +####### ------ beginning -------- ####################### +LOGFILE=@root/logs/runTestStop.log +DATE=`date` +#setting up environment variables +export HOME=@home +export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:/opt/ibutils/bin:@home/bin + +echo " " | tee -a $LOGFILE +echo "----- new job started for run $1 test stop at -----" | tee -a $LOGFILE +echo "$DATE" | tee -a $LOGFILE + +/bin/sh @root/scripts/RunInfoStopTest.sh $1 | tee -a $LOGFILE diff --git a/CondCore/Utilities/o2o/templates/setStrip.sh b/CondCore/Utilities/o2o/templates/setStrip.sh new file mode 100755 index 0000000000000..8e252cac96b66 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/setStrip.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# +# set the CMSSW environtmet for SiStripO2O +# and the proxies for conditionUploader +# + +O2ONAME=$1 + +# deployment-specific params +BASEDIR=@root +SCRAM_ARCH=@arch +RELEASE=@release +RELEASEDIR=@cmsswroot/@arch/cms/cmssw/${RELEASE} + +source @cmsswroot/cmsset_default.sh +cd ${RELEASEDIR}/src +eval `scramv1 ru -sh` +cd - + +O2O_HOME=$BASEDIR/SiStrip/ + +# for sqlalchmey (?) +export PYTHON_EGG_CACHE=@localhome +# path to .netrc file and .cms_cond dir +export COND_AUTH_PATH=@root/SiStrip + +# save log files produced by o2oRun.py on disk +export JOBDIR=${O2O_HOME}/jobs/${O2ONAME} +export O2O_LOG_FOLDER=${BASEDIR}/logs/${O2ONAME} +export LOGFILE=${BASEDIR}/logs/$O2ONAME.log + +# temperoray fix for TNS_ADMIN +export TNS_ADMIN=@extroot/oracle-env/29/etc diff --git a/CondCore/Utilities/o2o/templates/setup.sh b/CondCore/Utilities/o2o/templates/setup.sh new file mode 100755 index 0000000000000..1158c53931393 --- /dev/null +++ b/CondCore/Utilities/o2o/templates/setup.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# deployment-specific params +BASEDIR=@root +RELEASE=@release +ARCH=@arch +RELEASEDIR=@cmsswroot/${RELEASE} + +# command params +OPTIND=1 + +JOBNAME="" + +while getopts "h?s:j:" opt; do + case $opt in + h|\?) + echo "Mo' to spiego..." + exit 0 + ;; + j) JOBNAME=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) + +[ "$1" = "--" ] && shift + +# o2o specific params +LOGFILE=${BASEDIR}/logs/$JOBNAME.log +JOBDIR=${BASEDIR}/${JOBNAME} +DATE=`date` + +# functions +function logRun(){ + echo "----- new job started for $1 at -----" | tee -a $LOGFILE + echo $DATE | tee -a $LOGFILE +} + +function log() { + echo "[`date`] : $@ " | tee -a $LOGFILE +} + +function submit_command() { + logRun $1 + o2o run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_test_command() { + logRun $1 + o2o --db dev run -n $1 "$2" | tee -a $LOGFILE +} + +function submit_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_cmsRun() { + COMMAND="cmsRun $2 destinationDatabase={db} destinationTag={tag}" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +function submit_test_popCon() { + COMMAND="popconRun $2 -d {db} -t {tag} -c" + logRun $1 + o2o --db dev run -n $1 "$COMMAND" | tee -a $LOGFILE +} + +# global variables +export PYTHON_EGG_CACHE=@localhome +export SCRAM_ARCH=$ARCH +export O2O_LOG_FOLDER=@root/logs/${JOBNAME} +export COND_AUTH_PATH=$BASEDIR +source @cmsswroot/cmsset_default.sh + +cd ${RELEASEDIR}/src +eval `scramv1 run -sh` +# set up OCCI workaround +export LD_PRELOAD=$CMS_ORACLEOCCI_LIB + +# workaround for oracle tnsnames +export TNS_ADMIN=@extroot/oracle-env/29/etc + +cd ${JOBDIR} + + diff --git a/CondCore/Utilities/python/popcon2dropbox.py b/CondCore/Utilities/python/popcon2dropbox.py index 5e4ddaec5a2d3..12008182a66a7 100644 --- a/CondCore/Utilities/python/popcon2dropbox.py +++ b/CondCore/Utilities/python/popcon2dropbox.py @@ -9,8 +9,8 @@ from datetime import datetime errorInImportFileFolder = 'import_errors' -dateformatForFolder = "%y-%m-%d-%H-%M-%S" -dateformatForLabel = "%y-%m-%d %H:%M:%S" +dateformatForFolder = "%Y-%m-%d-%H-%M-%S" +dateformatForLabel = "%Y-%m-%d %H:%M:%S" auth_path_key = 'COND_AUTH_PATH' @@ -183,10 +183,10 @@ def run( args ): return retCode ret = checkFile( dbName ) - if ret < 0: - return ret - elif ret == 0: - return 0 - if args.copy: - return copy( args, dbName ) - return upload( args, dbName ) + if ret > 0: + if args.copy: + ret = copy( args, dbName ) + else: + ret = upload( args, dbName ) + os.remove( '%s.db' %dbName ) + return ret diff --git a/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h b/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h index 30d68a3dd8027..d9a4deff7d72d 100644 --- a/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h +++ b/CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h @@ -43,7 +43,20 @@ class TotemDAQMapping public: std::map VFATMapping; + /// Hw Id mapping for Totem Timing (dynamical mapping in Sampic) + struct TotemTimingPlaneChannelPair + { + int plane; + int channel; + + TotemTimingPlaneChannelPair(const int& plane=-1, const int& channel=-1) : plane(plane), channel(channel) {}; + }; + std::map totemTimingChannelMap; + void insert(const TotemFramePosition &fp, const TotemVFATInfo &vi); + + /// Given the hardware ID, returns the corresponding Plane, Channel pair (TotemTimingPlaneChannelPair) + const TotemTimingPlaneChannelPair getTimingChannel( const uint8_t hwId ) const; }; #endif diff --git a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc index b894fe1182a1a..1b3c0c4dc853c 100644 --- a/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc +++ b/CondFormats/CTPPSReadoutObjects/plugins/TotemDAQMappingESSourceXML.cc @@ -22,6 +22,7 @@ #include "DataFormats/CTPPSDetId/interface/TotemRPDetId.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" +#include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" #include "CondFormats/DataRecord/interface/TotemReadoutRcd.h" #include "CondFormats/CTPPSReadoutObjects/interface/TotemDAQMapping.h" @@ -65,10 +66,16 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup /// COMMON Chip XML tags static const std::string tagChip1; static const std::string tagChip2; - + /// diamond specific tags static const std::string tagDiamondPlane; - static const std::string tagDiamondCh; + static const std::string tagDiamondCh; + + /// totem timing specific tags + static const std::string tagSampicBoard; + static const std::string tagSampicCh; + static const std::string tagTotemTimingCh; + static const std::string tagTotemTimingPlane; TotemDAQMappingESSourceXML(const edm::ParameterSet &); ~TotemDAQMappingESSourceXML() override; @@ -106,7 +113,7 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup bool currentBlockValid; /// enumeration of XML node types - enum NodeType { nUnknown, nSkip, nTop, nArm, nRPStation, nRPPot, nRPPlane, nDiamondPlane, nChip, nDiamondCh, nChannel }; + enum NodeType { nUnknown, nSkip, nTop, nArm, nRPStation, nRPPot, nRPPlane, nDiamondPlane, nChip, nDiamondCh, nChannel, nSampicBoard, nSampicChannel, nTotemTimingPlane, nTotemTimingCh }; /// whether to parse a mapping of a mask XML enum ParseType { pMapping, pMask }; @@ -122,6 +129,10 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup void ParseTreeDiamond(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, const std::shared_ptr&, const std::shared_ptr&); + /// recursive method to extract RP-related information from the DOM tree + void ParseTreeTotemTiming(ParseType, xercesc::DOMNode *, NodeType, unsigned int parentID, + const std::shared_ptr&, const std::shared_ptr&); + private: /// adds the path prefix, if needed string CompleteFileName(const string &fn); @@ -161,6 +172,12 @@ class TotemDAQMappingESSourceXML: public edm::ESProducer, public edm::EventSetup { return ((type == nArm)||(type == nRPStation)||(type == nRPPot)||(type == nDiamondPlane)||(type == nDiamondCh)); } + + bool TotemTimingNode(NodeType type) + { + return ((type == nArm)||(type == nRPStation)||(type == nRPPot)||(type == nSampicBoard)||(type == nSampicChannel)||(type == nTotemTimingPlane)||(type == nTotemTimingCh)); + } + bool CommonNode(NodeType type) { return ((type==nChip)||(type==nArm)); @@ -197,6 +214,11 @@ const string TotemDAQMappingESSourceXML::tagRPPlane = "rp_plane"; const string TotemDAQMappingESSourceXML::tagDiamondPlane = "rp_plane_diamond"; const string TotemDAQMappingESSourceXML::tagDiamondCh = "diamond_channel"; +// specific tags for totem timing +const string TotemDAQMappingESSourceXML::tagSampicBoard = "rp_sampic_board"; +const string TotemDAQMappingESSourceXML::tagSampicCh = "rp_sampic_channel"; +const string TotemDAQMappingESSourceXML::tagTotemTimingCh = "timing_channel"; +const string TotemDAQMappingESSourceXML::tagTotemTimingPlane = "timing_plane"; //---------------------------------------------------------------------------------------------------- @@ -247,11 +269,11 @@ void TotemDAQMappingESSourceXML::setIntervalFor(const edm::eventsetup::EventSetu { currentBlockValid = true; currentBlock = idx; - + const IOVSyncValue begin(range.startEventID()); const IOVSyncValue end(range.endEventID()); oValidity = edm::ValidityInterval(begin, end); - + LogVerbatim("TotemDAQMappingESSourceXML") << " block found: index=" << currentBlock << ", interval=(" << range.startEventID() << " - " << range.endEventID() << ")"; @@ -270,7 +292,7 @@ void TotemDAQMappingESSourceXML::setIntervalFor(const edm::eventsetup::EventSetu //---------------------------------------------------------------------------------------------------- TotemDAQMappingESSourceXML::~TotemDAQMappingESSourceXML() -{ +{ } //---------------------------------------------------------------------------------------------------- @@ -328,17 +350,19 @@ void TotemDAQMappingESSourceXML::ParseXML(ParseType pType, const string &file, if (!domDoc) throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML") << "Cannot parse file `" << file - << "' (domDoc = NULL)." << endl; + << "' (domDoc = NULL)."; DOMElement* elementRoot = domDoc->getDocumentElement(); if (!elementRoot) throw cms::Exception("TotemDAQMappingESSourceXML::ParseXML") << "File `" << - file << "' is empty." << endl; + file << "' is empty."; ParseTreeRP(pType, elementRoot, nTop, 0, mapping, mask); ParseTreeDiamond(pType, elementRoot, nTop, 0, mapping, mask); + + ParseTreeTotemTiming(pType, elementRoot, nTop, 0, mapping, mask); } //----------------------------------------------------------------------------------------------------------- @@ -369,7 +393,7 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * // structure control if (!RPNode(type)) continue; - + NodeType expectedParentType; switch (type) { @@ -417,15 +441,15 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * // content control if (!id_set) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") << "id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; + << cms::xerces::toString(n->getNodeName()) << "'"; if (!hw_id_set && type == nChip && pType == pMapping) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") << "hw_id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; + << cms::xerces::toString(n->getNodeName()) << "'"; if (type == nRPPlane && id > 9) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeRP") << - "Plane IDs range from 0 to 9. id = " << id << " is invalid." << endl; + "Plane IDs range from 0 to 9. id = " << id << " is invalid."; #ifdef DEBUG printf("\tID found: 0x%x\n", id); @@ -438,10 +462,10 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * TotemVFATInfo vfatInfo; vfatInfo.hwID = hw_id; - const unsigned int armIdx = (parentID / 1000) % 10; - const unsigned int stIdx = (parentID / 100) % 10; - const unsigned int rpIdx = (parentID / 10) % 10; - const unsigned int plIdx = parentID % 10; + const unsigned int armIdx = (parentID / 1000) % 10; + const unsigned int stIdx = (parentID / 100) % 10; + const unsigned int rpIdx = (parentID / 10) % 10; + const unsigned int plIdx = parentID % 10; vfatInfo.symbolicID.symbolicID = TotemRPDetId(armIdx, stIdx, rpIdx, plIdx, id); @@ -453,10 +477,10 @@ void TotemDAQMappingESSourceXML::ParseTreeRP(ParseType pType, xercesc::DOMNode * // store mask data if (pType == pMask && type == nChip) { - const unsigned int armIdx = (parentID / 1000) % 10; - const unsigned int stIdx = (parentID / 100) % 10; - const unsigned int rpIdx = (parentID / 10) % 10; - const unsigned int plIdx = parentID % 10; + const unsigned int armIdx = (parentID / 1000) % 10; + const unsigned int stIdx = (parentID / 100) % 10; + const unsigned int rpIdx = (parentID / 10) % 10; + const unsigned int plIdx = parentID % 10; TotemSymbID symbId; symbId.symbolicID = TotemRPDetId(armIdx, stIdx, rpIdx, plIdx, id); @@ -484,17 +508,17 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN #ifdef DEBUG printf(">> TotemDAQMappingESSourceXML::ParseTreeDiamond(%s, %u, %u)\n", cms::xerces::toString(parent->getNodeName()), - parentType, parentID); + parentType, parentID); #endif DOMNodeList *children = parent->getChildNodes(); for (unsigned int i = 0; i < children->getLength(); i++) - { + { DOMNode *n = children->item(i); if (n->getNodeType() != DOMNode::ELEMENT_NODE) continue; - + NodeType type = GetNodeType(n); #ifdef DEBUG printf("\tname = %s, type = %u\n", cms::xerces::toString(n->getNodeName()), type); @@ -522,8 +546,8 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN } // parse tag attributes - unsigned int id =0,hw_id = 0; - bool id_set = false,hw_id_set = false; + unsigned int id =0,hw_id = 0; + bool id_set = false,hw_id_set = false; DOMNamedNodeMap* attr = n->getAttributes(); for (unsigned int j = 0; j < attr->getLength(); j++) @@ -533,30 +557,29 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) { sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id); - id_set = true; + id_set = true; } if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hw_id")) { sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hw_id); - hw_id_set = true; + hw_id_set = true; } } // content control - if (!id_set) + if (!id_set) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << "id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; - + << cms::xerces::toString(n->getNodeName()) << "'"; if (!hw_id_set && type == nDiamondCh && pType == pMapping) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << "hw_id not given for element `" - << cms::xerces::toString(n->getNodeName()) << "'" << endl; - + << cms::xerces::toString(n->getNodeName()) << "'"; + if (type == nDiamondPlane && id > 3) throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeDiamond") << - "Plane IDs range from 0 to 3. id = " << id << " is invalid." << endl; + "Plane IDs range from 0 to 3. id = " << id << " is invalid."; #ifdef DEBUG printf("\tID found: 0x%x\n", id); @@ -567,16 +590,16 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN { const TotemFramePosition &framepos = ChipFramePosition(n); - + TotemVFATInfo vfatInfo; - vfatInfo.hwID = hw_id; + vfatInfo.hwID = hw_id; if (type == nDiamondCh) { unsigned int ArmNum = (parentID/ 10000) % 10; unsigned int StationNum = (parentID / 1000) % 10; unsigned int RpNum = (parentID/ 100) % 10; - unsigned int PlaneNum = (parentID % 100) ; + unsigned int PlaneNum = (parentID % 100) ; vfatInfo.symbolicID.symbolicID = CTPPSDiamondDetId(ArmNum, StationNum, RpNum, PlaneNum, id); @@ -596,12 +619,140 @@ void TotemDAQMappingESSourceXML::ParseTreeDiamond(ParseType pType, xercesc::DOMN childId = parentID * 10 + id; ParseTreeDiamond(pType,n ,type ,childId ,mapping ,mask); - + } } +//---------------------------------------------------------------------------------------------------- + +void TotemDAQMappingESSourceXML::ParseTreeTotemTiming(ParseType pType, xercesc::DOMNode * parent, NodeType parentType, + unsigned int parentID, const std::shared_ptr& mapping, + const std::shared_ptr& mask) +{ + DOMNodeList *children = parent->getChildNodes(); + + // Fill map hwId -> TotemTimingPlaneChannelPair + for (unsigned int i = 0; i < children->getLength(); i++) + { + DOMNode *child = children->item(i); + if ( (child->getNodeType() != DOMNode::ELEMENT_NODE) || (GetNodeType(child)!=nTotemTimingCh) ) + continue; + + int plane = -1; + DOMNamedNodeMap* attr = parent->getAttributes(); + for (unsigned int j = 0; j < attr->getLength(); j++) + { + DOMNode *a = attr->item(j); + + if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) + sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%d", &plane); + } + + + int channel = -1; + unsigned int hwId = 0; + attr = child->getAttributes(); + for (unsigned int j = 0; j < attr->getLength(); j++) + { + DOMNode *a = attr->item(j); + + if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) + sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%d", &channel); + if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "hwId")) + sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%x", &hwId); + } + + mapping->totemTimingChannelMap[ (uint8_t) hwId ] = TotemDAQMapping::TotemTimingPlaneChannelPair(plane, channel); + } + + for (unsigned int i = 0; i < children->getLength(); i++) + { + DOMNode *n = children->item(i); + if (n->getNodeType() != DOMNode::ELEMENT_NODE) + continue; + + NodeType type = GetNodeType(n); + + // structure control + if (!TotemTimingNode(type)) + continue; + + NodeType expectedParentType; + switch (type) + { + case nArm: expectedParentType = nTop; break; + case nRPStation: expectedParentType = nArm; break; + case nRPPot: expectedParentType = nRPStation; break; + case nSampicBoard: expectedParentType = nRPPot; break; + case nSampicChannel: expectedParentType = nSampicBoard; break; + case nTotemTimingPlane: expectedParentType = nRPPot; break; + case nTotemTimingCh: expectedParentType = nTotemTimingPlane; break; + default: expectedParentType = nUnknown; break; + } + + if (expectedParentType != parentType) + { + throw cms::Exception("TotemDAQMappingESSourceXML") << "Node " << cms::xerces::toString(n->getNodeName()) + << " not allowed within " << cms::xerces::toString(parent->getNodeName()) << " block.\n"; + } + + // parse tag attributes + unsigned int id =0; + bool id_set = false; + DOMNamedNodeMap* attr = n->getAttributes(); + + + for (unsigned int j = 0; j < attr->getLength(); j++) + { + DOMNode *a = attr->item(j); + + if (!strcmp(cms::xerces::toString(a->getNodeName()).c_str(), "id")) + { + sscanf(cms::xerces::toString(a->getNodeValue()).c_str(), "%u", &id); + id_set = true; + } + + } + + // content control + if (!id_set) + throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemTiming") << "id not given for element `" + << cms::xerces::toString(n->getNodeName()) << "'"; + if (type == nSampicBoard && id > 5) + throw cms::Exception("TotemDAQMappingESSourceXML::ParseTreeTotemTiming") << + "SampicBoard IDs range from 0 to 5. id = " << id << " is invalid."; + + // store mapping data + if (pType == pMapping &&type == nSampicChannel) + { + + const TotemFramePosition &framepos = ChipFramePosition(n); + + TotemVFATInfo vfatInfo; + unsigned int ArmNum = (parentID/ 10000) % 10; + unsigned int StationNum = (parentID / 1000) % 10; + unsigned int RpNum = (parentID/ 100) % 10; + + vfatInfo.symbolicID.symbolicID = TotemTimingDetId(ArmNum, StationNum, RpNum, 0, TotemTimingDetId::ID_NOT_SET); //Dynamical: it is encoded in the frame + + mapping->insert(framepos, vfatInfo); + + continue; + } + + unsigned int childId; + if (pType == pMapping &&type == nSampicBoard) + childId = parentID * 100 + id; + else + childId = parentID * 10 + id; + + ParseTreeTotemTiming(pType,n ,type ,childId ,mapping ,mask); + + } +} + //---------------------------------------------------------------------------------------------------- TotemFramePosition TotemDAQMappingESSourceXML::ChipFramePosition(xercesc::DOMNode *chipnode) @@ -618,14 +769,14 @@ TotemFramePosition TotemDAQMappingESSourceXML::ChipFramePosition(xercesc::DOMNod throw cms::Exception("TotemDAQMappingESSourceXML") << "Unrecognized tag `" << cms::xerces::toString(a->getNodeName()) << "' or incompatible value `" << cms::xerces::toString(a->getNodeValue()) << - "'." << endl; + "'."; } } if (!fp.checkXMLAttributeFlag(attributeFlag)) { throw cms::Exception("TotemDAQMappingESSourceXML") << - "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ")." << endl; + "Wrong/incomplete DAQ channel specification (attributeFlag = " << attributeFlag << ")."; } return fp; @@ -649,6 +800,12 @@ TotemDAQMappingESSourceXML::NodeType TotemDAQMappingESSourceXML::GetNodeType(xer if (Test(n, tagDiamondCh)) return nDiamondCh; if (Test(n, tagDiamondPlane)) return nDiamondPlane; + //totem timing specifics + if (Test(n, tagSampicBoard)) return nSampicBoard; + if (Test(n, tagSampicCh)) return nSampicChannel; + if (Test(n, tagTotemTimingCh)) return nTotemTimingCh; + if (Test(n, tagTotemTimingPlane)) return nTotemTimingPlane; + // for backward compatibility if (Test(n, "trigger_vfat")) return nSkip; diff --git a/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc b/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc index e39918a00f4db..b51207b24e6f6 100644 --- a/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc +++ b/CondFormats/CTPPSReadoutObjects/src/TotemDAQMapping.cc @@ -37,4 +37,14 @@ void TotemDAQMapping::insert(const TotemFramePosition &fp, const TotemVFATInfo & //---------------------------------------------------------------------------------------------------- +const TotemDAQMapping::TotemTimingPlaneChannelPair TotemDAQMapping::getTimingChannel( const uint8_t hwId ) const +{ + TotemTimingPlaneChannelPair pair; + auto iterator = totemTimingChannelMap.find( hwId ); + if ( iterator != totemTimingChannelMap.end() ) pair = iterator->second; + return pair; +} + +//---------------------------------------------------------------------------------------------------- + TYPELOOKUP_DATA_REG(TotemDAQMapping); diff --git a/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml new file mode 100644 index 0000000000000..c9b0db9df1ff9 --- /dev/null +++ b/CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml @@ -0,0 +1,451 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CondFormats/CTPPSReadoutObjects/xml/rpix_mapping_2018.xml b/CondFormats/CTPPSReadoutObjects/xml/rpix_mapping_2018.xml new file mode 100644 index 0000000000000..87129483f93e7 --- /dev/null +++ b/CondFormats/CTPPSReadoutObjects/xml/rpix_mapping_2018.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CondFormats/Common/test/LumiCorrections_prep.json b/CondFormats/Common/test/LumiCorrections_prep.json new file mode 100644 index 0000000000000..9b6ee12c2bb7c --- /dev/null +++ b/CondFormats/Common/test/LumiCorrections_prep.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcoff_prep/CMS_CONDITIONS", + "destinationTags": { + "LumiPCC_Corrections_prep_prompt": {} + }, + "inputTag": "LumiPCCCorrections_pcl", + "since": null, + "userText": "Tier0 PCL Upload for PCC" +} diff --git a/CondFormats/Common/test/LumiCorrections_prod.json b/CondFormats/Common/test/LumiCorrections_prod.json new file mode 100644 index 0000000000000..38256023f0a78 --- /dev/null +++ b/CondFormats/Common/test/LumiCorrections_prod.json @@ -0,0 +1,9 @@ +{ + "destinationDatabase": "oracle://cms_orcon_prod/CMS_CONDITIONS", + "destinationTags": { + "LumiPCC_Corrections_prompt": {} + }, + "inputTag": "LumiPCCCorrections_pcl", + "since": null, + "userText": "Tier0 PCL Upload for PCC" +} diff --git a/CondFormats/Common/test/ProduceDropBoxMetadata.py b/CondFormats/Common/test/ProduceDropBoxMetadata.py index 4dbfb4e91c5d8..ecf3114244741 100644 --- a/CondFormats/Common/test/ProduceDropBoxMetadata.py +++ b/CondFormats/Common/test/ProduceDropBoxMetadata.py @@ -66,6 +66,10 @@ def encodeJsonInString(filename): EcalPedestalsRcd_prod_str = encodeJsonInString("EcalPedestal_prod.json") EcalPedestalsRcd_prep_str = encodeJsonInString("EcalPedestal_prep.json") +#LumiCorrectionsRcd +LumiCorrectionsRcd_prod_str = encodeJsonInString("LumiCorrections_prod.json") +LumiCorrectionsRcd_prep_str = encodeJsonInString("LumiCorrections_prep.json") + # given a set of .json files in the current dir, ProduceDropBoxMetadata produces a sqlite containign the payload with the prod/and/prep metadata process.mywriter = cms.EDAnalyzer("ProduceDropBoxMetadata", # set to True if you want to write out a sqlite.db translating the json's into a payload @@ -136,13 +140,19 @@ def encodeJsonInString(filename): prodMetaData = cms.untracked.string(EcalPedestalsRcd_prod_str), prepMetaData = cms.untracked.string(EcalPedestalsRcd_prep_str), ), + cms.PSet(record = cms.untracked.string('LumiCorrectionsRcd'), + Source = cms.untracked.string("AlcaHarvesting"), + FileClass = cms.untracked.string("ALCA"), + prodMetaData = cms.untracked.string(LumiCorrectionsRcd_prod_str), + prepMetaData = cms.untracked.string(LumiCorrectionsRcd_prep_str), + ), ), # this boolean will read the content of whichever payload is available and print its content to stoutput # set this to false if you write out a sqlite.db translating the json's into a payload read = cms.untracked.bool(False), # toRead lists of record naemes to be sought inside the DropBoxMetadataRcd payload avaialble to the ProduceDropBoxMetadata; for instance, if write is True, you're reading back the metadata you've just entered in the payload from the .json files - toRead = cms.untracked.vstring('BeamSpotObjectsRcdByRun','BeamSpotObjectsRcdByLumi','BeamSpotObjectsRcdHPByLumi','BeamSpotObjectsRcdHPByRun','SiStripBadStripRcd','SiStripApvGainRcd','TrackerAlignmentRcd','SiStripApvGainRcdAfterAbortGap','SiStripApvGainRcdAAG','EcalPedestalsRcd') # same strings as fType + toRead = cms.untracked.vstring('BeamSpotObjectsRcdByRun','BeamSpotObjectsRcdByLumi','BeamSpotObjectsRcdHPByLumi','BeamSpotObjectsRcdHPByRun','SiStripBadStripRcd','SiStripApvGainRcd','TrackerAlignmentRcd','SiStripApvGainRcdAfterAbortGap','SiStripApvGainRcdAAG','EcalPedestalsRcd',"LumiCorrectionsRcd")# same strings as fType ) process.p = cms.Path(process.mywriter) @@ -150,7 +160,7 @@ def encodeJsonInString(filename): if process.mywriter.write: from CondCore.CondDB.CondDB_cfi import CondDB - CondDB.connect = "sqlite_file:DropBoxMetadata_addHPbyRun_addAAGmulti.db" + CondDB.connect = "sqlite_file:DropBoxMetadata_addLumiCorrections_TrackerAlignmentPCLoff.db" process.PoolDBOutputService = cms.Service("PoolDBOutputService", CondDB, diff --git a/CondFormats/Common/test/SiPixelAliRcd_prod.json b/CondFormats/Common/test/SiPixelAliRcd_prod.json index 7458f05704a93..49307ff5085cc 100644 --- a/CondFormats/Common/test/SiPixelAliRcd_prod.json +++ b/CondFormats/Common/test/SiPixelAliRcd_prod.json @@ -2,9 +2,9 @@ "destinationDatabase": "oracle://cms_orcon_prod/CMS_CONDITIONS", "destinationTags": { "SiPixelAli_PCL_v0_hlt": {}, - "TrackerAlignment_PCL_byRun_v2_express": {} + "TrackerAlignment_PCL_byRun_v1_express": {} }, "inputTag": "SiPixelAli_pcl", "since": null, - "userText": "T0 PCL Upload for SiPixel Ali - moved to the tag consumed by prompt. (prod)" + "userText": "T0 PCL Upload for SiPixel Ali - changed to v1 to not be consumed by prompt. (prod). To be consumed change v1 to v2." } diff --git a/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h new file mode 100644 index 0000000000000..c94643023f834 --- /dev/null +++ b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h @@ -0,0 +1,26 @@ +#ifndef DataRecord_SiPixel2DTemplateDBObject0TRcd_h +#define DataRecord_SiPixel2DTemplateDBObject0TRcd_h +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject0TRcd +// +/**\class SiPixel2DTemplateDBObject0TRcd SiPixel2DTemplateDBObject0TRcd.h CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h + + Description: + + Usage: + + +*/ +// +// Author: +// Created: Mon Sep 28 15:40:32 CEST 2009 +// $Id$ +// + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" + +class SiPixel2DTemplateDBObject0TRcd : public edm::eventsetup::EventSetupRecordImplementation {}; + +#endif diff --git a/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h new file mode 100644 index 0000000000000..314fc4b0b4b9f --- /dev/null +++ b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h @@ -0,0 +1,26 @@ +#ifndef DataRecord_SiPixel2DTemplateDBObject38TRcd_h +#define DataRecord_SiPixel2DTemplateDBObject38TRcd_h +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject38TRcd +// +/**\class SiPixel2DTemplateDBObject38TRcd SiPixel2DTemplateDBObject38TRcd.h CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h + + Description: + + Usage: + + +*/ +// +// Author: +// Created: Mon Sep 28 15:40:47 CEST 2009 +// $Id$ +// + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" + +class SiPixel2DTemplateDBObject38TRcd : public edm::eventsetup::EventSetupRecordImplementation {}; + +#endif diff --git a/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h new file mode 100644 index 0000000000000..6c486df4226b0 --- /dev/null +++ b/CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h @@ -0,0 +1,26 @@ +#ifndef DataRecord_SiPixel2DTemplateDBObject4TRcd_h +#define DataRecord_SiPixel2DTemplateDBObject4TRcd_h +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject4TRcd +// +/**\class SiPixel2DTemplateDBObject4TRcd SiPixel2DTemplateDBObject4TRcd.h CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h + + Description: + + Usage: + + +*/ +// +// Author: +// Created: Mon Sep 28 15:40:50 CEST 2009 +// $Id$ +// + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" + +class SiPixel2DTemplateDBObject4TRcd : public edm::eventsetup::EventSetupRecordImplementation {}; + +#endif diff --git a/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject0TRcd.cc b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject0TRcd.cc new file mode 100644 index 0000000000000..96f55b1f8c17a --- /dev/null +++ b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject0TRcd.cc @@ -0,0 +1,16 @@ +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject0TRcd +// +// Implementation: +// +// +// Author: +// Created: Mon Sep 28 15:40:32 CEST 2009 +// $Id$ + +#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject0TRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(SiPixel2DTemplateDBObject0TRcd); diff --git a/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject38TRcd.cc b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject38TRcd.cc new file mode 100644 index 0000000000000..4197d11069891 --- /dev/null +++ b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject38TRcd.cc @@ -0,0 +1,16 @@ +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject38TRcd +// +// Implementation: +// +// +// Author: +// Created: Mon Sep 28 15:40:47 CEST 2009 +// $Id$ + +#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject38TRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(SiPixel2DTemplateDBObject38TRcd); diff --git a/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject4TRcd.cc b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject4TRcd.cc new file mode 100644 index 0000000000000..e593c2179a4f1 --- /dev/null +++ b/CondFormats/DataRecord/src/SiPixel2DTemplateDBObject4TRcd.cc @@ -0,0 +1,16 @@ +// -*- C++ -*- +// +// Package: DataRecord +// Class : SiPixel2DTemplateDBObject4TRcd +// +// Implementation: +// +// +// Author: +// Created: Mon Sep 28 15:40:50 CEST 2009 +// $Id$ + +#include "CondFormats/DataRecord/interface/SiPixel2DTemplateDBObject4TRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(SiPixel2DTemplateDBObject4TRcd); diff --git a/CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h b/CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h index c1c9c427eb7f9..8501285fc9748 100644 --- a/CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h +++ b/CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h @@ -73,6 +73,9 @@ class SiPixelGainCalibrationForHLT { float getPedLow() const { return minPed_; } float getPedHigh() const { return maxPed_; } + std::vector const & data() const { return v_pedestals;} + std::vector const & getIndexes() const { return indexes; } + // Set and get public methods void setData(float ped, float gain, std::vector& vped, bool thisColumnIsDead = false, bool thisColumnIsNoisy = false); void setDeadColumn(const int& nRows, std::vector& vped) { setData(0, 0 /*dummy values, not used*/, vped, true, false); } @@ -84,7 +87,7 @@ class SiPixelGainCalibrationForHLT { float getPed (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const; float getGain (const int& col, const int& row, const Range& range, const int& nCols, bool& isDeadColumn, bool& isNoisyColumn ) const; - private: +private: float encodeGain(const float& gain); float encodePed (const float& ped); diff --git a/CondFormats/SiStripObjects/interface/CalibrationAnalysis.h b/CondFormats/SiStripObjects/interface/CalibrationAnalysis.h index 467a3bb122d55..73d481f048944 100644 --- a/CondFormats/SiStripObjects/interface/CalibrationAnalysis.h +++ b/CondFormats/SiStripObjects/interface/CalibrationAnalysis.h @@ -33,6 +33,10 @@ class CalibrationAnalysis : public CommissioningAnalysis { inline const VVFloat& tail() const { return tail_; } inline const VVFloat& riseTime() const { return riseTime_; } inline const VVFloat& timeConstant() const { return timeConstant_; } + inline const VVFloat& turnOn() const { return turnOn_; } + inline const VVFloat& maximum() const { return maximum_; } + inline const VVFloat& undershoot() const { return undershoot_; } + inline const VVFloat& baseline() const { return baseline_; } inline const VVFloat& smearing() const { return smearing_; } inline const VVFloat& chi2() const { return chi2_; } @@ -42,6 +46,10 @@ class CalibrationAnalysis : public CommissioningAnalysis { inline const VFloat& riseTimeMean() const { return mean_riseTime_; } inline const VFloat& timeConstantMean() const { return mean_timeConstant_; } inline const VFloat& smearingMean() const { return mean_smearing_; } + inline const VFloat& turnOnMean() const { return mean_turnOn_; } + inline const VFloat& maximumMean() const { return mean_maximum_; } + inline const VFloat& undershootMean() const { return mean_undershoot_; } + inline const VFloat& baselineMean() const { return mean_baseline_; } inline const VFloat& chi2Mean() const { return mean_chi2_; } // spread, min and max @@ -65,6 +73,22 @@ class CalibrationAnalysis : public CommissioningAnalysis { inline const VFloat& smearingMin() const { return min_smearing_; } inline const VFloat& smearingMax() const { return max_smearing_; } + inline const VFloat& turnOnSpread() const { return spread_turnOn_; } + inline const VFloat& turnOnMin() const { return min_turnOn_; } + inline const VFloat& turnOnMax() const { return max_turnOn_; } + + inline const VFloat& maximumSpread() const { return spread_maximum_; } + inline const VFloat& maximumMin() const { return min_maximum_; } + inline const VFloat& maximumMax() const { return max_maximum_; } + + inline const VFloat& undershootSpread() const { return spread_undershoot_; } + inline const VFloat& undershootMin() const { return min_undershoot_; } + inline const VFloat& undershootMax() const { return max_undershoot_; } + + inline const VFloat& baselineSpread() const { return spread_baseline_; } + inline const VFloat& baselineMin() const { return min_baseline_; } + inline const VFloat& baselineMax() const { return max_baseline_; } + inline const VFloat& chi2Spread() const { return spread_chi2_; } inline const VFloat& chi2Min() const { return min_chi2_; } inline const VFloat& chi2Max() const { return max_chi2_; } @@ -79,15 +103,11 @@ class CalibrationAnalysis : public CommissioningAnalysis { private: /** Parameters extracted from the fit of pulse shape */ - VVFloat amplitude_, tail_, riseTime_, timeConstant_, smearing_, chi2_; - - VFloat mean_amplitude_,mean_tail_,mean_riseTime_,mean_timeConstant_,mean_smearing_,mean_chi2_; - - VFloat min_amplitude_,min_tail_,min_riseTime_,min_timeConstant_,min_smearing_,min_chi2_; - - VFloat max_amplitude_,max_tail_,max_riseTime_,max_timeConstant_,max_smearing_,max_chi2_; - - VFloat spread_amplitude_,spread_tail_,spread_riseTime_,spread_timeConstant_,spread_smearing_,spread_chi2_; + VVFloat amplitude_, tail_, riseTime_, timeConstant_, turnOn_, maximum_, undershoot_, baseline_, smearing_, chi2_; + VFloat mean_amplitude_,mean_tail_,mean_riseTime_,mean_timeConstant_, mean_turnOn_, mean_maximum_, mean_undershoot_, mean_baseline_, mean_smearing_,mean_chi2_; + VFloat min_amplitude_,min_tail_,min_riseTime_,min_timeConstant_, min_turnOn_, min_maximum_, min_undershoot_, min_baseline_, min_smearing_,min_chi2_; + VFloat max_amplitude_,max_tail_,max_riseTime_,max_timeConstant_, max_turnOn_, max_maximum_, max_undershoot_, max_baseline_, max_smearing_,max_chi2_; + VFloat spread_amplitude_,spread_tail_,spread_riseTime_,spread_timeConstant_, spread_turnOn_, spread_maximum_, spread_undershoot_, spread_baseline_, spread_smearing_,spread_chi2_; /** fit mode: deconv or not ? */ bool deconv_; diff --git a/CondFormats/SiStripObjects/interface/PedsFullNoiseAnalysis.h b/CondFormats/SiStripObjects/interface/PedsFullNoiseAnalysis.h index 1c32ceef786a3..21fae3520ef58 100644 --- a/CondFormats/SiStripObjects/interface/PedsFullNoiseAnalysis.h +++ b/CondFormats/SiStripObjects/interface/PedsFullNoiseAnalysis.h @@ -12,6 +12,7 @@ @author M. Wingham, R.Bainbridge @brief Histogram-based analysis for pedestal run. */ + class PedsFullNoiseAnalysis : public CommissioningAnalysis { public: @@ -28,30 +29,47 @@ class PedsFullNoiseAnalysis : public CommissioningAnalysis { friend class PedsFullNoiseAlgorithm; // ---------- public interface ---------- + + /** Identifies if analysis is valid or not. */ + bool isValid() const override; - /** Identifies if analysis is valid or not. */ - bool isValid() const override; - - // Pedestal, noise and raw noise (128-strip vector per APV) - inline const VVFloat& peds() const; + // Pedestal, noise and raw noise (128-strip vector per APV) + inline const VVFloat& peds() const; inline const VVFloat& noise() const; inline const VVFloat& raw() const; - // KS Probability for each strip - inline const VVFloat& ksProb() const; - // KS Probability for each strip - inline const VVFloat& chi2Prob() const; - // Noise value calculated by a gaussian fit instead of RMS. - inline const VVFloat& noiseGaus() const; - // Noise value calculated by a gaussian fit instead of RMS. - inline const VVFloat& noiseBin84() const; - // Noise value calculated by RMS of ADC values. - inline const VVFloat& noiseRMS() const; - // The significance of noise of each strip compared to the apv - inline const VVFloat& noiseSignif() const; - - // Dead and noisy strips (vector per APV) - inline const VVInt& dead() const; - inline const VVInt& noisy() const; + + // test statistics for each APV (128-strip vector per APV) + inline const VVFloat& adProbab() const; + inline const VVFloat& ksProbab() const; + inline const VVFloat& jbProbab() const; + inline const VVFloat& chi2Probab() const; + + // Per strip values + inline const VVFloat& residualRMS() const; // RMS + inline const VVFloat& residualSigmaGaus() const; // from gaus fit + inline const VVFloat& noiseSignificance() const; // noise significance + inline const VVFloat& residualMean() const; + inline const VVFloat& residualSkewness() const; + inline const VVFloat& residualKurtosis() const; + inline const VVFloat& residualIntegralNsigma() const; + inline const VVFloat& residualIntegral() const; + + // status for different class of bad or problematic strips + inline const VVInt& deadStrip() const; + inline const VVInt& badStrip() const; + inline const VVInt& badStripBit() const; + inline const VVInt& deadStripBit() const; + inline const VVInt& shiftedStrip() const; + inline const VVInt& lowNoiseStrip() const; + inline const VVInt& largeNoiseStrip() const; + inline const VVInt& largeNoiseSignificance() const; + inline const VVInt& badFitStatus() const; + inline const VVInt& badADProbab() const; + inline const VVInt& badKSProbab() const; + inline const VVInt& badJBProbab() const; + inline const VVInt& badChi2Probab() const; + inline const VVInt& badTailStrip() const; + inline const VVInt& badDoublePeakStrip() const; // Mean and rms spread (value per APV) inline const VFloat& pedsMean() const; @@ -84,70 +102,56 @@ class PedsFullNoiseAnalysis : public CommissioningAnalysis { private: - // VVFloats means: 1 vector per APV, 1 value per strip. - /** Peds values. */ + /// Quantitles that are always filled for every strip VVFloat peds_; - - /** Noise values. */ VVFloat noise_; - - /** Raw noise values. */ VVFloat raw_; - - VVFloat ksProb_; - VVFloat chi2Prob_; - VVFloat noiseGaus_; - VVFloat noiseBin84_; - VVFloat noiseRMS_; - VVFloat noiseSignif_; - // VVInts means: 1 vector per APV, values are strip numbers. - - /** Dead strips. */ - VVInt dead_; - - /** Noisy strips. */ - VVInt noisy_; + VVFloat adProbab_; + VVFloat ksProbab_; + VVFloat jbProbab_; + VVFloat chi2Probab_; + VVFloat residualRMS_; + VVFloat residualSigmaGaus_; + VVFloat noiseSignificance_; + VVFloat residualMean_; + VVFloat residualSkewness_; + VVFloat residualKurtosis_; + VVFloat residualIntegralNsigma_; + VVFloat residualIntegral_; + VVInt badStripBit_; + VVInt deadStripBit_; + + /// Quantities filled only for bad strips i.e. vectors of strip-id + VVInt deadStrip_; + VVInt badStrip_; + VVInt shiftedStrip_; + VVInt lowNoiseStrip_; + VVInt largeNoiseStrip_; + VVInt largeNoiseSignificance_; + VVInt badFitStatus_; + VVInt badADProbab_; + VVInt badKSProbab_; + VVInt badJBProbab_; + VVInt badChi2Probab_; + VVInt badTailStrip_; + VVInt badDoublePeakStrip_; // VFloat: 1 value per APV - - /** Mean peds value. */ VFloat pedsMean_; - - /** Rms spread in peds. */ VFloat pedsSpread_; - - /** Mean noise value. */ VFloat noiseMean_; - - /** Rms spread in noise. */ VFloat noiseSpread_; - - /** Mean raw noise value. */ VFloat rawMean_; - - /** Rms spread in raw noise. */ VFloat rawSpread_; - - /** Max peds value. */ VFloat pedsMax_; - - /** Min peds value. */ VFloat pedsMin_; - - /** Max noise value. */ VFloat noiseMax_; - - /** Min noise value. */ VFloat noiseMin_; - - /** Max raw noise value. */ VFloat rawMax_; - - /** Min raw noise value. */ VFloat rawMin_; - + // true if legacy histogram naming is used bool legacy_; }; @@ -157,16 +161,37 @@ class PedsFullNoiseAnalysis : public CommissioningAnalysis { const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::peds() const { return peds_; } const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noise() const { return noise_; } const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::raw() const { return raw_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::ksProb() const { return ksProb_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::chi2Prob() const { return chi2Prob_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noiseGaus() const { return noiseGaus_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noiseBin84() const { return noiseBin84_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noiseRMS() const { return noiseRMS_; } -const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noiseSignif() const { return noiseSignif_; } - -const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::dead() const { return dead_; } -const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::noisy() const { return noisy_; } +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::adProbab() const { return adProbab_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::ksProbab() const { return ksProbab_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::jbProbab() const { return jbProbab_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::chi2Probab() const { return chi2Probab_;} + +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualRMS() const { return residualRMS_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualSigmaGaus() const { return residualSigmaGaus_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::noiseSignificance() const { return noiseSignificance_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualMean() const { return residualMean_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualSkewness() const { return residualSkewness_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualKurtosis() const { return residualKurtosis_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualIntegralNsigma() const { return residualIntegralNsigma_;} +const PedsFullNoiseAnalysis::VVFloat& PedsFullNoiseAnalysis::residualIntegral() const { return residualIntegral_;} + +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::deadStrip() const { return deadStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badStrip() const { return badStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badStripBit() const { return badStripBit_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::deadStripBit() const { return deadStripBit_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::shiftedStrip() const { return shiftedStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::lowNoiseStrip() const { return lowNoiseStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::largeNoiseStrip() const { return largeNoiseStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::largeNoiseSignificance() const { return largeNoiseSignificance_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badFitStatus() const { return badFitStatus_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badADProbab() const { return badADProbab_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badKSProbab() const { return badKSProbab_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badJBProbab() const { return badJBProbab_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badChi2Probab() const { return badChi2Probab_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badTailStrip() const { return badTailStrip_;} +const PedsFullNoiseAnalysis::VVInt& PedsFullNoiseAnalysis::badDoublePeakStrip() const { return badDoublePeakStrip_;} + const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::pedsMean() const { return pedsMean_; } const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::pedsSpread() const { return pedsSpread_; } const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::noiseMean() const { return noiseMean_; } @@ -180,4 +205,7 @@ const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::noiseMax() const { r const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::noiseMin() const { return noiseMin_; } const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::rawMax() const { return rawMax_; } const PedsFullNoiseAnalysis::VFloat& PedsFullNoiseAnalysis::rawMin() const { return rawMin_; } + #endif // CondFormats_SiStripObjects_PedsFullNoiseAnalysis_H + + diff --git a/CondFormats/SiStripObjects/src/CalibrationAnalysis.cc b/CondFormats/SiStripObjects/src/CalibrationAnalysis.cc index 0606fbeca84a7..f9d3f900b31fd 100644 --- a/CondFormats/SiStripObjects/src/CalibrationAnalysis.cc +++ b/CondFormats/SiStripObjects/src/CalibrationAnalysis.cc @@ -17,30 +17,50 @@ CalibrationAnalysis::CalibrationAnalysis( const uint32_t& key, const bool& decon tail_(2,VFloat(128,sistrip::invalid_)), riseTime_(2,VFloat(128,sistrip::invalid_)), timeConstant_(2,VFloat(128,sistrip::invalid_)), + turnOn_(2,VFloat(128,sistrip::invalid_)), + maximum_(2,VFloat(128,sistrip::invalid_)), + undershoot_(2,VFloat(128,sistrip::invalid_)), + baseline_(2,VFloat(128,sistrip::invalid_)), smearing_(2,VFloat(128,sistrip::invalid_)), chi2_(2,VFloat(128,sistrip::invalid_)), mean_amplitude_(2,sistrip::invalid_), mean_tail_(2,sistrip::invalid_), mean_riseTime_(2,sistrip::invalid_), mean_timeConstant_(2,sistrip::invalid_), + mean_turnOn_(2,sistrip::invalid_), + mean_maximum_(2,sistrip::invalid_), + mean_undershoot_(2,sistrip::invalid_), + mean_baseline_(2,sistrip::invalid_), mean_smearing_(2,sistrip::invalid_), mean_chi2_(2,sistrip::invalid_), min_amplitude_(2,sistrip::invalid_), min_tail_(2,sistrip::invalid_), min_riseTime_(2,sistrip::invalid_), min_timeConstant_(2,sistrip::invalid_), + min_turnOn_(2,sistrip::invalid_), + min_maximum_(2,sistrip::invalid_), + min_undershoot_(2,sistrip::invalid_), + min_baseline_(2,sistrip::invalid_), min_smearing_(2,sistrip::invalid_), min_chi2_(2,sistrip::invalid_), max_amplitude_(2,sistrip::invalid_), max_tail_(2,sistrip::invalid_), max_riseTime_(2,sistrip::invalid_), max_timeConstant_(2,sistrip::invalid_), + max_turnOn_(2,sistrip::invalid_), + max_maximum_(2,sistrip::invalid_), + max_undershoot_(2,sistrip::invalid_), + max_baseline_(2,sistrip::invalid_), max_smearing_(2,sistrip::invalid_), max_chi2_(2,sistrip::invalid_), spread_amplitude_(2,sistrip::invalid_), spread_tail_(2,sistrip::invalid_), spread_riseTime_(2,sistrip::invalid_), spread_timeConstant_(2,sistrip::invalid_), + spread_turnOn_(2,sistrip::invalid_), + spread_maximum_(2,sistrip::invalid_), + spread_undershoot_(2,sistrip::invalid_), + spread_baseline_(2,sistrip::invalid_), spread_smearing_(2,sistrip::invalid_), spread_chi2_(2,sistrip::invalid_), deconv_(deconv), @@ -56,30 +76,50 @@ CalibrationAnalysis::CalibrationAnalysis(const bool& deconv, int calchan) tail_(2,VFloat(128,sistrip::invalid_)), riseTime_(2,VFloat(128,sistrip::invalid_)), timeConstant_(2,VFloat(128,sistrip::invalid_)), + turnOn_(2,VFloat(128,sistrip::invalid_)), + maximum_(2,VFloat(128,sistrip::invalid_)), + undershoot_(2,VFloat(128,sistrip::invalid_)), + baseline_(2,VFloat(128,sistrip::invalid_)), smearing_(2,VFloat(128,sistrip::invalid_)), chi2_(2,VFloat(128,sistrip::invalid_)), mean_amplitude_(2,sistrip::invalid_), mean_tail_(2,sistrip::invalid_), mean_riseTime_(2,sistrip::invalid_), mean_timeConstant_(2,sistrip::invalid_), + mean_turnOn_(2,sistrip::invalid_), + mean_maximum_(2,sistrip::invalid_), + mean_undershoot_(2,sistrip::invalid_), + mean_baseline_(2,sistrip::invalid_), mean_smearing_(2,sistrip::invalid_), mean_chi2_(2,sistrip::invalid_), min_amplitude_(2,sistrip::invalid_), min_tail_(2,sistrip::invalid_), min_riseTime_(2,sistrip::invalid_), min_timeConstant_(2,sistrip::invalid_), + min_turnOn_(2,sistrip::invalid_), + min_maximum_(2,sistrip::invalid_), + min_undershoot_(2,sistrip::invalid_), + min_baseline_(2,sistrip::invalid_), min_smearing_(2,sistrip::invalid_), min_chi2_(2,sistrip::invalid_), max_amplitude_(2,sistrip::invalid_), max_tail_(2,sistrip::invalid_), max_riseTime_(2,sistrip::invalid_), max_timeConstant_(2,sistrip::invalid_), + max_turnOn_(2,sistrip::invalid_), + max_maximum_(2,sistrip::invalid_), + max_undershoot_(2,sistrip::invalid_), + max_baseline_(2,sistrip::invalid_), max_smearing_(2,sistrip::invalid_), max_chi2_(2,sistrip::invalid_), spread_amplitude_(2,sistrip::invalid_), spread_tail_(2,sistrip::invalid_), spread_riseTime_(2,sistrip::invalid_), spread_timeConstant_(2,sistrip::invalid_), + spread_turnOn_(2,sistrip::invalid_), + spread_maximum_(2,sistrip::invalid_), + spread_undershoot_(2,sistrip::invalid_), + spread_baseline_(2,sistrip::invalid_), spread_smearing_(2,sistrip::invalid_), spread_chi2_(2,sistrip::invalid_), deconv_(deconv), @@ -94,30 +134,50 @@ void CalibrationAnalysis::reset() { tail_ = VVFloat(2,VFloat(128,sistrip::invalid_)); riseTime_ = VVFloat(2,VFloat(128,sistrip::invalid_)); timeConstant_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + turnOn_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + maximum_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + undershoot_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + baseline_ = VVFloat(2,VFloat(128,sistrip::invalid_)); smearing_ = VVFloat(2,VFloat(128,sistrip::invalid_)); chi2_ = VVFloat(2,VFloat(128,sistrip::invalid_)); mean_amplitude_ = VFloat(2,sistrip::invalid_); mean_tail_ = VFloat(2,sistrip::invalid_); mean_riseTime_ = VFloat(2,sistrip::invalid_); mean_timeConstant_ = VFloat(2,sistrip::invalid_); + mean_turnOn_ = VFloat(2,sistrip::invalid_); + mean_maximum_ = VFloat(2,sistrip::invalid_); + mean_undershoot_ = VFloat(2,sistrip::invalid_); + mean_baseline_ = VFloat(2,sistrip::invalid_); mean_smearing_ = VFloat(2,sistrip::invalid_); mean_chi2_ = VFloat(2,sistrip::invalid_); min_amplitude_ = VFloat(2,sistrip::invalid_); min_tail_ = VFloat(2,sistrip::invalid_); min_riseTime_ = VFloat(2,sistrip::invalid_); min_timeConstant_ = VFloat(2,sistrip::invalid_); + min_turnOn_ = VFloat(2,sistrip::invalid_); + min_maximum_ = VFloat(2,sistrip::invalid_); + min_undershoot_ = VFloat(2,sistrip::invalid_); + min_baseline_ = VFloat(2,sistrip::invalid_); min_smearing_ = VFloat(2,sistrip::invalid_); min_chi2_ = VFloat(2,sistrip::invalid_); max_amplitude_ = VFloat(2,sistrip::invalid_); max_tail_ = VFloat(2,sistrip::invalid_); max_riseTime_ = VFloat(2,sistrip::invalid_); max_timeConstant_ = VFloat(2,sistrip::invalid_); + max_turnOn_ = VFloat(2,sistrip::invalid_); + max_maximum_ = VFloat(2,sistrip::invalid_); + max_undershoot_ = VFloat(2,sistrip::invalid_); + max_baseline_ = VFloat(2,sistrip::invalid_); max_smearing_ = VFloat(2,sistrip::invalid_); max_chi2_ = VFloat(2,sistrip::invalid_); spread_amplitude_ = VFloat(2,sistrip::invalid_); spread_tail_ = VFloat(2,sistrip::invalid_); spread_riseTime_ = VFloat(2,sistrip::invalid_); spread_timeConstant_ = VFloat(2,sistrip::invalid_); + spread_turnOn_ = VFloat(2,sistrip::invalid_); + spread_maximum_ = VFloat(2,sistrip::invalid_); + spread_undershoot_ = VFloat(2,sistrip::invalid_); + spread_baseline_ = VFloat(2,sistrip::invalid_); spread_smearing_ = VFloat(2,sistrip::invalid_); spread_chi2_ = VFloat(2,sistrip::invalid_); } @@ -134,6 +194,10 @@ void CalibrationAnalysis::print( std::stringstream& ss, uint32_t iapv ) { << " Mean Tail amplitude after 150ns : " << mean_tail_[iapv] << std::endl << " Mean Rise time : " << mean_riseTime_[iapv] << std::endl << " Mean Time constant : " << mean_timeConstant_[iapv] << std::endl + << " Mean Turn on time : " << mean_turnOn_[iapv] << std::endl + << " Mean peak time : " << mean_maximum_[iapv] << std::endl + << " Mean undershoot amplitude : " << mean_undershoot_[iapv] << std::endl + << " Mean baseline amplitude : " << mean_baseline_[iapv] << std::endl << " Mean Smearing parameter : " << mean_smearing_[iapv] << std::endl << " Mean Chi2 of the fit : " << mean_chi2_[iapv] << std::endl; if(deconvMode()) { diff --git a/CondFormats/SiStripObjects/src/PedsFullNoiseAnalysis.cc b/CondFormats/SiStripObjects/src/PedsFullNoiseAnalysis.cc index 3723d2d96a99d..9055a61040366 100644 --- a/CondFormats/SiStripObjects/src/PedsFullNoiseAnalysis.cc +++ b/CondFormats/SiStripObjects/src/PedsFullNoiseAnalysis.cc @@ -8,6 +8,7 @@ using namespace sistrip; + // ---------------------------------------------------------------------------- // PedsFullNoiseAnalysis::PedsFullNoiseAnalysis( const uint32_t& key ) @@ -15,14 +16,33 @@ PedsFullNoiseAnalysis::PedsFullNoiseAnalysis( const uint32_t& key ) peds_(2,VFloat(128,sistrip::invalid_)), noise_(2,VFloat(128,sistrip::invalid_)), raw_(2,VFloat(128,sistrip::invalid_)), - ksProb_(2,VFloat(0,sistrip::invalid_)), - chi2Prob_(2,VFloat(0,sistrip::invalid_)), - noiseGaus_(2,VFloat(0,sistrip::invalid_)), - noiseBin84_(2,VFloat(0,sistrip::invalid_)), - noiseRMS_(2,VFloat(0,sistrip::invalid_)), - noiseSignif_(2,VFloat(0,sistrip::invalid_)), - dead_(2,VInt(0,sistrip::invalid_)), - noisy_(2,VInt(0,sistrip::invalid_)), + adProbab_(2,VFloat(128,sistrip::invalid_)), + ksProbab_(2,VFloat(128,sistrip::invalid_)), + jbProbab_(2,VFloat(128,sistrip::invalid_)), + chi2Probab_(2,VFloat(128,sistrip::invalid_)), + residualRMS_(2,VFloat(128,sistrip::invalid_)), + residualSigmaGaus_(2,VFloat(128,sistrip::invalid_)), + noiseSignificance_(2,VFloat(128,sistrip::invalid_)), + residualMean_(2,VFloat(128,sistrip::invalid_)), + residualSkewness_(2,VFloat(128,sistrip::invalid_)), + residualKurtosis_(2,VFloat(128,sistrip::invalid_)), + residualIntegralNsigma_(2,VFloat(128,sistrip::invalid_)), + residualIntegral_(2,VFloat(128,sistrip::invalid_)), + badStripBit_(2,VInt(128,sistrip::invalid_)), + deadStripBit_(2,VInt(128,sistrip::invalid_)), + deadStrip_(2,VInt(0,sistrip::invalid_)), + badStrip_(2,VInt(0,sistrip::invalid_)), + shiftedStrip_(2,VInt(0,sistrip::invalid_)), + lowNoiseStrip_(2,VInt(0,sistrip::invalid_)), + largeNoiseStrip_(2,VInt(0,sistrip::invalid_)), + largeNoiseSignificance_(2,VInt(0,sistrip::invalid_)), + badFitStatus_(2,VInt(0,sistrip::invalid_)), + badADProbab_(2,VInt(0,sistrip::invalid_)), + badKSProbab_(2,VInt(0,sistrip::invalid_)), + badJBProbab_(2,VInt(0,sistrip::invalid_)), + badChi2Probab_(2,VInt(0,sistrip::invalid_)), + badTailStrip_(2,VInt(0,sistrip::invalid_)), + badDoublePeakStrip_(2,VInt(0,sistrip::invalid_)), pedsMean_(2,sistrip::invalid_), pedsSpread_(2,sistrip::invalid_), noiseMean_(2,sistrip::invalid_), @@ -37,14 +57,33 @@ PedsFullNoiseAnalysis::PedsFullNoiseAnalysis( const uint32_t& key ) rawMin_(2,sistrip::invalid_), legacy_(false) { - dead_[0].reserve(128); dead_[1].reserve(128); - noisy_[0].reserve(128); noisy_[1].reserve(128); - ksProb_[0].reserve(128); ksProb_[1].reserve(128); - chi2Prob_[0].reserve(128); chi2Prob_[1].reserve(128); - noiseGaus_[0].reserve(128); noiseGaus_[1].reserve(128); - noiseBin84_[0].reserve(128); noiseBin84_[1].reserve(128); - noiseRMS_[0].reserve(128); noiseRMS_[1].reserve(128); - noiseSignif_[0].reserve(128); noiseSignif_[1].reserve(128); + // for flag bits one reserve at max 128 positions since will be filled with strip id only if the strip is bad + for(auto iapv : deadStrip_) + iapv.reserve(128); + for(auto iapv : badStrip_) + iapv.reserve(128); + for(auto iapv : shiftedStrip_) + iapv.reserve(128); + for(auto iapv : lowNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseSignificance_) + iapv.reserve(128); + for(auto iapv : badFitStatus_) + iapv.reserve(128); + for(auto iapv : badADProbab_) + iapv.reserve(128); + for(auto iapv : badKSProbab_) + iapv.reserve(128); + for(auto iapv : badJBProbab_) + iapv.reserve(128); + for(auto iapv : badChi2Probab_) + iapv.reserve(128); + for(auto iapv : badTailStrip_) + iapv.reserve(128); + for(auto iapv : badDoublePeakStrip_) + iapv.reserve(128); } // ---------------------------------------------------------------------------- @@ -54,14 +93,33 @@ PedsFullNoiseAnalysis::PedsFullNoiseAnalysis() peds_(2,VFloat(128,sistrip::invalid_)), noise_(2,VFloat(128,sistrip::invalid_)), raw_(2,VFloat(128,sistrip::invalid_)), - ksProb_(2,VFloat(0,sistrip::invalid_)), - chi2Prob_(2,VFloat(0,sistrip::invalid_)), - noiseGaus_(2,VFloat(0,sistrip::invalid_)), - noiseBin84_(2,VFloat(0,sistrip::invalid_)), - noiseRMS_(2,VFloat(0,sistrip::invalid_)), - noiseSignif_(2,VFloat(0,sistrip::invalid_)), - dead_(2,VInt(0,sistrip::invalid_)), - noisy_(2,VInt(0,sistrip::invalid_)), + adProbab_(2,VFloat(128,sistrip::invalid_)), + ksProbab_(2,VFloat(128,sistrip::invalid_)), + jbProbab_(2,VFloat(128,sistrip::invalid_)), + chi2Probab_(2,VFloat(128,sistrip::invalid_)), + residualRMS_(2,VFloat(128,sistrip::invalid_)), + residualSigmaGaus_(2,VFloat(128,sistrip::invalid_)), + noiseSignificance_(2,VFloat(128,sistrip::invalid_)), + residualMean_(2,VFloat(128,sistrip::invalid_)), + residualSkewness_(2,VFloat(128,sistrip::invalid_)), + residualKurtosis_(2,VFloat(128,sistrip::invalid_)), + residualIntegralNsigma_(2,VFloat(128,sistrip::invalid_)), + residualIntegral_(2,VFloat(128,sistrip::invalid_)), + badStripBit_(2,VInt(128,sistrip::invalid_)), + deadStripBit_(2,VInt(128,sistrip::invalid_)), + deadStrip_(2,VInt(0,sistrip::invalid_)), + badStrip_(2,VInt(0,sistrip::invalid_)), + shiftedStrip_(2,VInt(0,sistrip::invalid_)), + lowNoiseStrip_(2,VInt(0,sistrip::invalid_)), + largeNoiseStrip_(2,VInt(0,sistrip::invalid_)), + largeNoiseSignificance_(2,VInt(0,sistrip::invalid_)), + badFitStatus_(2,VInt(0,sistrip::invalid_)), + badADProbab_(2,VInt(0,sistrip::invalid_)), + badKSProbab_(2,VInt(0,sistrip::invalid_)), + badJBProbab_(2,VInt(0,sistrip::invalid_)), + badChi2Probab_(2,VInt(0,sistrip::invalid_)), + badTailStrip_(2,VInt(0,sistrip::invalid_)), + badDoublePeakStrip_(2,VInt(128,sistrip::invalid_)), pedsMean_(2,sistrip::invalid_), pedsSpread_(2,sistrip::invalid_), noiseMean_(2,sistrip::invalid_), @@ -76,30 +134,99 @@ PedsFullNoiseAnalysis::PedsFullNoiseAnalysis() rawMin_(2,sistrip::invalid_), legacy_(false) { - dead_[0].reserve(128); dead_[1].reserve(128); - noisy_[0].reserve(128); noisy_[1].reserve(128); - ksProb_[0].reserve(128); ksProb_[1].reserve(128); - chi2Prob_[0].reserve(128); chi2Prob_[1].reserve(128); - noiseGaus_[0].reserve(128); noiseGaus_[1].reserve(128); - noiseBin84_[0].reserve(128); noiseBin84_[1].reserve(128); - noiseRMS_[0].reserve(128); noiseRMS_[1].reserve(128); - noiseSignif_[0].reserve(128); noiseSignif_[1].reserve(128); + // for flag bits one reserve at max 128 positions since will be filled with strip id only if the strip is bad + for(auto iapv : deadStrip_) + iapv.reserve(128); + for(auto iapv : badStrip_) + iapv.reserve(128); + for(auto iapv : shiftedStrip_) + iapv.reserve(128); + for(auto iapv : lowNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseSignificance_) + iapv.reserve(128); + for(auto iapv : badFitStatus_) + iapv.reserve(128); + for(auto iapv : badADProbab_) + iapv.reserve(128); + for(auto iapv : badKSProbab_) + iapv.reserve(128); + for(auto iapv : badJBProbab_) + iapv.reserve(128); + for(auto iapv : badChi2Probab_) + iapv.reserve(128); + for(auto iapv : badTailStrip_) + iapv.reserve(128); + for(auto iapv : badDoublePeakStrip_) + iapv.reserve(128); } // ---------------------------------------------------------------------------- // void PedsFullNoiseAnalysis::reset() { - peds_ = VVFloat(2,VFloat(128,sistrip::invalid_)); - noise_ = VVFloat(2,VFloat(128,sistrip::invalid_)); - raw_ = VVFloat(2,VFloat(128,sistrip::invalid_)); - ksProb_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - chi2Prob_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - noiseGaus_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - noiseBin84_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - noiseRMS_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - noiseSignif_ = VVFloat(2,VFloat(0,sistrip::invalid_)); - dead_ = VVInt(2,VInt(0,sistrip::invalid_)); - noisy_ = VVInt(2,VInt(0,sistrip::invalid_)); + + peds_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + noise_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + raw_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + adProbab_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + ksProbab_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + jbProbab_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + chi2Probab_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualRMS_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualSigmaGaus_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + noiseSignificance_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualMean_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualSkewness_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualKurtosis_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualIntegralNsigma_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + residualIntegral_ = VVFloat(2,VFloat(128,sistrip::invalid_)); + + deadStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + badStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + badStripBit_ = VVInt(2,VInt(128,sistrip::invalid_)); + deadStripBit_ = VVInt(2,VInt(128,sistrip::invalid_)); + shiftedStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + lowNoiseStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + largeNoiseStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + largeNoiseSignificance_ = VVInt(2,VInt(0,sistrip::invalid_)); + badFitStatus_ = VVInt(2,VInt(0,sistrip::invalid_)); + badADProbab_ = VVInt(2,VInt(0,sistrip::invalid_)); + badKSProbab_ = VVInt(2,VInt(0,sistrip::invalid_)); + badJBProbab_ = VVInt(2,VInt(0,sistrip::invalid_)); + badChi2Probab_ = VVInt(2,VInt(0,sistrip::invalid_)); + badTailStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + badDoublePeakStrip_ = VVInt(2,VInt(0,sistrip::invalid_)); + + // for flag bits one reserve at max 128 positions since will be filled with strip id only if the strip is bad + for(auto iapv : deadStrip_) + iapv.reserve(128); + for(auto iapv : badStrip_) + iapv.reserve(128); + for(auto iapv : shiftedStrip_) + iapv.reserve(128); + for(auto iapv : lowNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseStrip_) + iapv.reserve(128); + for(auto iapv : largeNoiseSignificance_) + iapv.reserve(128); + for(auto iapv : badFitStatus_) + iapv.reserve(128); + for(auto iapv : badADProbab_) + iapv.reserve(128); + for(auto iapv : badKSProbab_) + iapv.reserve(128); + for(auto iapv : badJBProbab_) + iapv.reserve(128); + for(auto iapv : badChi2Probab_) + iapv.reserve(128); + for(auto iapv : badTailStrip_) + iapv.reserve(128); + for(auto iapv : badDoublePeakStrip_) + iapv.reserve(128); + pedsMean_ = VFloat(2,sistrip::invalid_); pedsSpread_ = VFloat(2,sistrip::invalid_); noiseMean_ = VFloat(2,sistrip::invalid_); @@ -112,14 +239,7 @@ void PedsFullNoiseAnalysis::reset() { noiseMin_ = VFloat(2,sistrip::invalid_); rawMax_ = VFloat(2,sistrip::invalid_); rawMin_ = VFloat(2,sistrip::invalid_); - dead_[0].reserve(128); dead_[1].reserve(128); - noisy_[0].reserve(128); noisy_[1].reserve(128); - ksProb_[0].reserve(128); ksProb_[1].reserve(128); - chi2Prob_[0].reserve(128); chi2Prob_[1].reserve(128); - noiseGaus_[0].reserve(128); noiseGaus_[1].reserve(128); - noiseBin84_[0].reserve(128); noiseBin84_[1].reserve(128); - noiseRMS_[0].reserve(128); noiseRMS_[1].reserve(128); - noiseSignif_[0].reserve(128); noiseSignif_[1].reserve(128); + legacy_ = false; } @@ -151,8 +271,6 @@ bool PedsFullNoiseAnalysis::isValid() const { rawMin_[0] < sistrip::maximum_ && rawMin_[1] < sistrip::maximum_ && getErrorCodes().empty() ); - //noiseMean_[0] <= rawMean_[0] && //@@ temp - //noiseMean_[1] <= rawMean_[1] ); //@@ temp } // ---------------------------------------------------------------------------- @@ -236,9 +354,10 @@ void PedsFullNoiseAnalysis::print( std::stringstream& ss, uint32_t iapv ) { if ( iapv == 1 || iapv == 2 ) { iapv--; } else { iapv = 0; } - if ( peds_[iapv].size() < 128 || + if ( peds_[iapv].size() < 128 || noise_[iapv].size() < 128 || - raw_[iapv].size() < 128 ) { + raw_[iapv].size() < 128 ) { + edm::LogWarning(mlCommissioning_) << "[" << myName() << "::" << __func__ << "]" << " Unexpected number of pedestal/noise values: " @@ -271,14 +390,15 @@ void PedsFullNoiseAnalysis::print( std::stringstream& ss, uint32_t iapv ) { << std::setw(6) << raw_[iapv][31] << ", " << std::setw(6) << raw_[iapv][63] << ", " << std::setw(6) << raw_[iapv][127] << std::endl - << " Dead strips (<5s) [strip] : (" << dead_[iapv].size() << " in total) "; - for ( uint16_t ii = 0; ii < dead_[iapv].size(); ii++ ) { - ss << dead_[iapv][ii] << " "; } + << " Dead strips (<5s) [strip] : (" << deadStrip_[iapv].size() << " in total) "; + + for ( uint16_t ii = 0; ii < deadStrip_[iapv].size(); ii++ ) { + ss << deadStrip_[iapv][ii] << " "; } ss << std::endl; - ss << " Noisy strips (>5s) [strip] : (" << noisy_[iapv].size() << " in total) "; - for ( uint16_t ii = 0; ii < noisy_[iapv].size(); ii++ ) { - ss << noisy_[iapv][ii] << " "; + ss << " Bad strips (>5s) [strip] : (" << badStrip_[iapv].size() << " in total) "; + for ( uint16_t ii = 0; ii < badStrip_[iapv].size(); ii++ ) { + ss << badStrip_[iapv][ii] << " "; } ss << std::endl; ss << " Mean peds +/- spread [ADC] : " << pedsMean_[iapv] << " +/- " << pedsSpread_[iapv] << std::endl diff --git a/CondTools/BTau/src/BTagCalibrationReader.cc b/CondTools/BTau/src/BTagCalibrationReader.cc index a6ecc51c3215f..a34ac7e3cdb52 100644 --- a/CondTools/BTau/src/BTagCalibrationReader.cc +++ b/CondTools/BTau/src/BTagCalibrationReader.cc @@ -67,7 +67,7 @@ BTagCalibrationReader::BTagCalibrationReaderImpl::BTagCalibrationReaderImpl( << "Every otherSysType should only be given once. Duplicate: " << ost; } - otherSysTypeReaders_[ost] = std::auto_ptr( + otherSysTypeReaders_[ost] = std::unique_ptr( new BTagCalibrationReaderImpl(op, ost) ); } diff --git a/CondTools/BTau/test/BTagCalibrationStandalone.cpp b/CondTools/BTau/test/BTagCalibrationStandalone.cpp index 63b8b30794587..eb596a103b61e 100644 --- a/CondTools/BTau/test/BTagCalibrationStandalone.cpp +++ b/CondTools/BTau/test/BTagCalibrationStandalone.cpp @@ -432,7 +432,7 @@ std::cerr << "ERROR in BTagCalibration: " << ost; throw std::exception(); } - otherSysTypeReaders_[ost] = std::auto_ptr( + otherSysTypeReaders_[ost] = std::unique_ptr( new BTagCalibrationReaderImpl(op, ost) ); } @@ -443,7 +443,7 @@ void BTagCalibrationReader::BTagCalibrationReaderImpl::load( BTagEntry::JetFlavor jf, std::string measurementType) { - if (tmpData_[jf].size()) { + if (!tmpData_[jf].empty()) { std::cerr << "ERROR in BTagCalibration: " << "Data for this jet-flavor is already loaded: " << jf; diff --git a/CondTools/Ecal/interface/EcalIntercalibHandler.h b/CondTools/Ecal/interface/EcalIntercalibHandler.h index 911f45ee9e3da..411d3586279c9 100644 --- a/CondTools/Ecal/interface/EcalIntercalibHandler.h +++ b/CondTools/Ecal/interface/EcalIntercalibHandler.h @@ -49,44 +49,26 @@ namespace edm { class EventSetup; } -namespace popcon -{ - - - class EcalIntercalibHandler : public popcon::PopConSourceHandler - { - - public: - EcalIntercalibHandler(edm::ParameterSet const & ); - ~EcalIntercalibHandler() override; - - void getNewObjects() override; - void readXML(const std::string& filename, EcalFloatCondObjectContainer& record); - - std::string id() const override { return m_name;} - EcalCondDBInterface* econn; - - - - private: - const EcalIntercalibConstants * myintercalib; - - unsigned int m_firstRun ; - unsigned int m_lastRun ; +namespace popcon { + class EcalIntercalibHandler : public popcon::PopConSourceHandler { + public: + EcalIntercalibHandler(edm::ParameterSet const & ); + ~EcalIntercalibHandler() override; - std::string m_location; - std::string m_gentag; - std::string m_sid; - std::string m_user; - std::string m_pass; - std::string m_locationsource; - std::string m_name; - std::string m_file_lowfield; - std::string m_file_highfield; - double m_value_highfield; - - - }; + void getNewObjects() override; + void readXML(const std::string& filename, EcalFloatCondObjectContainer& record); + void readTXT(const std::string& filename, EcalFloatCondObjectContainer& record); + + std::string id() const override { return m_name;} + EcalCondDBInterface* econn; + + private: + const EcalIntercalibConstants * myintercalib; + std::string m_name; + unsigned int m_firstRun ; + std::string m_file_name; + std::string m_file_type; + }; } #endif diff --git a/CondTools/Ecal/python/updateIntercali.py b/CondTools/Ecal/python/updateIntercali.py index 42db899d9d1c7..9323fc7bd5f0e 100644 --- a/CondTools/Ecal/python/updateIntercali.py +++ b/CondTools/Ecal/python/updateIntercali.py @@ -17,41 +17,33 @@ interval = cms.uint64(1) ) -process.load("CondCore.DBCommon.CondDBCommon_cfi") +process.load("CondCore.CondDB.CondDB_cfi") -#process.CondDBCommon.connect = 'sqlite_file:DB.db' -#process.CondDBCommon.connect = 'oracle://cms_orcoff_prep/CMS_COND_ECAL' -process.CondDBCommon.connect = 'oracle://cms_orcon_prod/CMS_COND_31X_ECAL' -process.CondDBCommon.DBParameters.authenticationPath = '/nfshome0/popcondev/conddb' +process.CondDB.connect = 'sqlite_file:EcalIntercalibConstants.db' process.PoolDBOutputService = cms.Service("PoolDBOutputService", - process.CondDBCommon, - logconnect = cms.untracked.string('sqlite_file:log.db'), - toPut = cms.VPSet(cms.PSet( - record = cms.string('EcalIntercalibConstantsRcd'), - tag = cms.string('EcalIntercalibConstants_v9_offline') - )) + process.CondDB, + logconnect = cms.untracked.string('sqlite_file:log.db'), + toPut = cms.VPSet( + cms.PSet( + record = cms.string('EcalIntercalibConstantsRcd'), + tag = cms.string('EcalIntercalibConstants') + ) + ) ) process.Test1 = cms.EDAnalyzer("ExTestEcalIntercalibAnalyzer", - record = cms.string('EcalIntercalibConstantsRcd'), - loggingOn= cms.untracked.bool(True), - IsDestDbCheckedInQueryLog=cms.untracked.bool(True), - SinceAppendMode=cms.bool(True), - Source=cms.PSet( - FileLowField = cms.string('/nfshome0/popcondev/EcalTPGPopCon/CMSSW_3_11_0_ONLINE/src/CondTools/Ecal/python/interCalib_Boff.xml'), - FileHighField = cms.string('/nfshome0/popcondev/EcalTPGPopCon/CMSSW_3_11_0_ONLINE/src/CondTools/Ecal/python/interCalib_Bon.xml'), - Value_Bon = cms.untracked.double(0.75585), - firstRun = cms.string('98273'), - lastRun = cms.string('10000000'), - OnlineDBSID = cms.string('cms_omds_lb'), - OnlineDBUser = cms.string('cms_ecal_r'), - OnlineDBPassword = cms.string('*******'), - LocationSource = cms.string('P5'), - Location = cms.string('P5_Co'), - GenTag = cms.string('GLOBAL'), - RunType = cms.string('COSMICS') - ) + record = cms.string('EcalIntercalibConstantsRcd'), + loggingOn= cms.untracked.bool(True), + IsDestDbCheckedInQueryLog=cms.untracked.bool(True), + SinceAppendMode=cms.bool(True), + Source=cms.PSet( + firstRun = cms.string('1'), +# type = cms.string('txt'), +# fileName = cms.string('IC2017.txt'), + type = cms.string('xml'), + fileName = cms.string('Intercalib_Bon.xml'), + ) ) process.p = cms.Path(process.Test1) diff --git a/CondTools/Ecal/python/updateIntercali_test.py b/CondTools/Ecal/python/updateIntercali_test.py deleted file mode 100644 index 5371e330759b0..0000000000000 --- a/CondTools/Ecal/python/updateIntercali_test.py +++ /dev/null @@ -1,60 +0,0 @@ -import FWCore.ParameterSet.Config as cms -import CondTools.Ecal.conddb_init as conddb_init -import CondTools.Ecal.db_credentials as auth - -process = cms.Process("ProcessOne") - -process.MessageLogger = cms.Service("MessageLogger", - debugModules = cms.untracked.vstring('*'), - cout = cms.untracked.PSet( - threshold = cms.untracked.string('DEBUG') - ), - destinations = cms.untracked.vstring('cout') -) - -process.source = cms.Source("EmptyIOVSource", - lastValue = cms.uint64(100000000000), - timetype = cms.string('runnumber'), - firstValue = cms.uint64(100000000000), - interval = cms.uint64(1) -) - -process.load("CondCore.CondDB.CondDB_cfi") - -process.CondDB.DBParameters.authenticationPath = '' -process.CondDB.connect = conddb_init.options.destinationDatabase -if process.CondDB.connect == '': - process.CondDB.connect = 'sqlite_file:EcalIntercalibConstants_test.db' - -process.PoolDBOutputService = cms.Service("PoolDBOutputService", - process.CondDB, - toPut = cms.VPSet(cms.PSet( - record = cms.string('EcalIntercalibConstantsRcd'), - tag = cms.string('EcalIntercalib_test') - )) -) - -db_service,db_user,db_pwd = auth.get_readOnly_db_credentials() - -process.Test1 = cms.EDAnalyzer("ExTestEcalIntercalibAnalyzer", - record = cms.string('EcalIntercalibConstantsRcd'), - loggingOn= cms.untracked.bool(True), - IsDestDbCheckedInQueryLog=cms.untracked.bool(True), - SinceAppendMode=cms.bool(True), - Source=cms.PSet( - FileLowField = cms.string('Intercalib_Boff.xml'), - FileHighField = cms.string('Intercalib_Bon.xml'), - Value_Bon = cms.untracked.double(0.7041), - firstRun = cms.string('207149'), - lastRun = cms.string('10000000'), - OnlineDBSID = cms.string(db_service), - OnlineDBUser = cms.string(db_user), - OnlineDBPassword = cms.string( db_pwd ), - LocationSource = cms.string('P5'), - Location = cms.string('P5_Co'), - GenTag = cms.string('GLOBAL'), - RunType = cms.string('COSMICS') - ) -) - -process.p = cms.Path(process.Test1) diff --git a/CondTools/Ecal/src/EcalIntercalibHandler.cc b/CondTools/Ecal/src/EcalIntercalibHandler.cc index a39e3a0470198..69cebc787d0ba 100644 --- a/CondTools/Ecal/src/EcalIntercalibHandler.cc +++ b/CondTools/Ecal/src/EcalIntercalibHandler.cc @@ -10,202 +10,33 @@ const Int_t kEBChannels = 61200, kEEChannels = 14648; popcon::EcalIntercalibHandler::EcalIntercalibHandler(const edm::ParameterSet & ps) : m_name(ps.getUntrackedParameter("name","EcalIntercalibHandler")) { - std::cout << "EcalIntercalib Source handler constructor\n" << std::endl; - m_firstRun=static_cast(atoi( ps.getParameter("firstRun").c_str())); - m_lastRun=static_cast(atoi( ps.getParameter("lastRun").c_str())); - m_sid= ps.getParameter("OnlineDBSID"); - m_user= ps.getParameter("OnlineDBUser"); - m_pass= ps.getParameter("OnlineDBPassword"); - m_locationsource= ps.getParameter("LocationSource"); - m_location=ps.getParameter("Location"); - m_gentag=ps.getParameter("GenTag"); - m_file_lowfield= ps.getParameter("FileLowField"); - m_file_highfield= ps.getParameter("FileHighField"); - m_value_highfield= ps.getUntrackedParameter< double >("Value_Bon"); - // m_value_highfield= 0.75585; - - - - std::cout << m_sid<<"/"<(atoi( ps.getParameter("firstRun").c_str())); + m_file_type = ps.getParameter("type"); // xml/txt + m_file_name = ps.getParameter("fileName"); } +popcon::EcalIntercalibHandler::~EcalIntercalibHandler() {} -void popcon::EcalIntercalibHandler::getNewObjects() -{ - - std::cout << "------- Ecal - > getNewObjects\n"; - +void popcon::EcalIntercalibHandler::getNewObjects() { + // std::cout << "------- Ecal - > getNewObjects\n"; std::ostringstream ss; ss<<"ECAL "; - - unsigned int max_since=0; - max_since=static_cast(tagInfo().lastInterval.first); - std::cout << "max_since : " << max_since << std::endl; - bool something_to_transfer = false; - bool magnet_high = true; - if(tagInfo().size) { - Ref ped_db = lastPayload(); - - // we parse the last record in the DB and check if it is low or high field - - std::cout << "retrieved last payload " << std::endl; - - - EcalIntercalibConstant the_cal = 0. ; // relies on it being a float. - // instead should perhaps - // protect the next if when - // the EEDetId isn't valid? - - int iX=50; - int iY=5; - int iZ=-1; - - - float the_value_high=(float)m_value_highfield; - std::cout << "The value for high field at EE x/y/z= 50/5/-1 is " << the_value_high << std::endl; - - if (EEDetId::validDetId(iX,iY,iZ)) - { - EEDetId eedetidpos(iX,iY,iZ); - - EcalIntercalibConstants::const_iterator it =ped_db->find(eedetidpos.rawId()); - - - the_cal = (*it); - - } - - if(the_cal!= the_value_high) magnet_high=false; - } // check if there is already a payload - else something_to_transfer = true; - - // here we connect to the online DB to check the value of the magnetic field - std::cout << "Connecting to ONLINE DB ... " << std::endl; - econn = new EcalCondDBInterface( m_sid, m_user, m_pass ); - std::cout << "Connection done" << std::endl; - if (!econn) - { - std::cout << " Problem with OMDS: connection parameters " < rundat; - RunIOV rp ; - run_t runmax=10000000; - std::string location_p5="P5_Co"; - econn->fetchValidDataSet(&rundat , &rp, location_p5 ,runmax); - - unsigned long long irun=(unsigned long long) rp.getRunNumber(); - - std::cout<< "retrieved run number "<< irun <max_since) { - // retrieve from last value data record - // always call this method at first run - - std::map dataset; - - econn->fetchDataSet(&dataset, &rp); - - if (dataset.empty()) { - throw(std::runtime_error("Zero rows read back")); - } else { - std::cout<< "retrieved magnet current"<::iterator it; - for (it=dataset.begin(); it!=dataset.end(); ++it){ - - RunDCSMagnetDat a_mag = (*it).second; - mag_cur= a_mag.getMagnetCurrent(); - - } - - - std::string file_=m_file_highfield; - if(tagInfo().size) { - - if(mag_cur>7000. && magnet_high ) { - - std::cout << " the magnet is ON and the constants are for magnet ON " << std::endl; - - } else if(mag_cur>7000. && !magnet_high ) { - something_to_transfer=true; - std::cout << " the magnet is ON and the constants are for magnet OFF " << std::endl; - std::cout << " I transfer the ON constants "<< std::endl; - file_=m_file_highfield; - - } else if(mag_cur<6000. && magnet_high ) { - something_to_transfer=true; - std::cout << " the magnet is OFF and the constants are for magnet ON "<< std::endl; - std::cout << " I transfer the OFF constants "<< std::endl; - file_=m_file_lowfield; - - } else if( mag_cur<6000. && !magnet_high ){ - - std::cout << " the magnet is OFF and the constants are for magnet OFF "<< std::endl; - file_=m_file_lowfield; - - } else { - - std::cout << " the magnet is in a strange situation I do nothing ... just be patient "<< std::endl; - - } - } - else { - if(mag_cur>7000.) - std::cout <<" first payload, the magnet is ON " << std::endl; - else if( mag_cur<6000.) { - std::cout <<" first payload, the magnet is OFF " << std::endl; - file_=m_file_lowfield; - } - else - std::cout << " the magnet is in a strange situation I do nothing ... just be patient "<< std::endl; - } - - if(something_to_transfer){ - - std::cout << "Generating popcon record for run " << irun << "..." << std::flush; - std::cout << "going to open file "<::m_to_transfer.push_back( - std::make_pair(payload,snc)); - ss << "Run=" << irun << "_Magnet_changed_"< max_since - else { - std::cout << "Run " << irun << " nothing sent to the DB"<< std::endl; - ss<< "Run=" << irun << "_no_new_runs_"< end of getNewObjects -----------\n"; + unsigned long long irun; + std::string file_= m_file_name; + edm::LogInfo("going to open file ") << file_; + + // EcalCondHeader header; + EcalIntercalibConstants * payload = new EcalIntercalibConstants; + if(m_file_type == "xml") + readXML(file_, *payload); + else + readTXT(file_, *payload); + irun = m_firstRun; + Time_t snc= (Time_t) irun ; + + popcon::PopConSourceHandler::m_to_transfer.push_back(std::make_pair(payload, snc)); } void popcon::EcalIntercalibHandler::readXML(const std::string& file_, @@ -214,7 +45,7 @@ void popcon::EcalIntercalibHandler::readXML(const std::string& file_, std::ifstream fxml; fxml.open(file_); if(!fxml.is_open()) { - std::cout << "ERROR : cannot open file " << file_ << std::endl; + edm::LogInfo("ERROR : cannot open file ") << file_; exit (1); } // header @@ -223,13 +54,12 @@ void popcon::EcalIntercalibHandler::readXML(const std::string& file_, // std::cout << dummyLine << std::endl; } fxml >> bid; - // std::cout << bid << std::endl; std::string stt = bid.substr(7,5); std::istringstream iEB(stt); int nEB; iEB >> nEB; if(nEB != kEBChannels) { - std::cout << " strange number of EB channels " << nEB << std::endl; + edm::LogInfo("strange number of EB channels ") << nEB; exit(-1); } fxml >> bid; // 0 @@ -246,13 +76,12 @@ void popcon::EcalIntercalibHandler::readXML(const std::string& file_, // std::cout << dummyLine << std::endl; } fxml >> bid; - // cout << bid << endl; stt = bid.substr(7,5); std::istringstream iEE(stt); int nEE; iEE >> nEE; if(nEE != kEEChannels) { - std::cout << " strange number of EE channels " << nEE << std::endl; + edm::LogInfo("strange number of EE channels ") << nEE; exit(-1); } fxml >> bid; // 0 @@ -266,3 +95,33 @@ void popcon::EcalIntercalibHandler::readXML(const std::string& file_, record[myEEDetId] = val; } } + +void popcon::EcalIntercalibHandler::readTXT(const std::string& file_, + EcalFloatCondObjectContainer& record){ + std::ifstream ftxt; + ftxt.open(file_); + if(!ftxt.is_open()) { + edm::LogInfo("ERROR : cannot open file ") << file_; + exit (1); + } + int number_of_lines = 0, eta, phi, x, y, z; + float val; + std::string line; + while (std::getline(ftxt, line)) { + if(number_of_lines < kEBChannels) { // barrel + sscanf(line.c_str(), "%i %i %i %f", &eta, &phi, &z, &val); + EBDetId ebdetid(eta, phi, EBDetId::ETAPHIMODE); + record[ebdetid] = val; + } + else { // endcaps + sscanf(line.c_str(), "%i %i %i %f", &x, &y, &z, &val); + EEDetId eedetid(x, y, z, EEDetId::XYMODE); + record[eedetid] = val; + } + number_of_lines++; + } + edm::LogInfo("Number of lines in text file: ") << number_of_lines; + int kChannels = kEBChannels + kEEChannels; + if(number_of_lines != kChannels) + edm::LogInfo("wrong number of channels! Please check "); +} diff --git a/CondTools/Geometry/test/writehelpers/createCTPPS2017Payloads.sh b/CondTools/Geometry/test/writehelpers/createCTPPS2017Payloads.sh new file mode 100755 index 0000000000000..c12720002ae61 --- /dev/null +++ b/CondTools/Geometry/test/writehelpers/createCTPPS2017Payloads.sh @@ -0,0 +1 @@ +conddb_import -f sqlite_file:myfile.db -c sqlite_file:XMLFILE_CTPPS_Geometry.db -t XMLFILE_CTPPS_Geometry_2017_101YV3 -i XMLFILE_CTPPS_Geometry_2017_101YV3 diff --git a/CondTools/Geometry/test/writehelpers/createCTPPSExtended2016Payloads.sh b/CondTools/Geometry/test/writehelpers/createCTPPSExtended2016Payloads.sh new file mode 100644 index 0000000000000..f7aa5f1e0a6bb --- /dev/null +++ b/CondTools/Geometry/test/writehelpers/createCTPPSExtended2016Payloads.sh @@ -0,0 +1 @@ +conddb_import -f sqlite_file:myfile.db -c sqlite_file:XMLFILE_CTPPS_Geometry.db -t XMLFILE_CTPPS_Geometry_2016_922V1 -i XMLFILE_CTPPS_Geometry_2016_922V1 diff --git a/CondTools/Geometry/test/writehelpers/createCTPPSHLTPayload.sh b/CondTools/Geometry/test/writehelpers/createCTPPSHLTPayload.sh new file mode 100755 index 0000000000000..2ba15d9b8429e --- /dev/null +++ b/CondTools/Geometry/test/writehelpers/createCTPPSHLTPayload.sh @@ -0,0 +1,4 @@ +conddb_import -f frontier://FrontierProd/CMS_CONDITIONS -i XMLFILE_CTPPS_Geometry_2016_922V1 -c sqlite:file.db -b 264232 -e 286693 -t XMLFILE_CTPPS_Geometry_101YV3_hlt +conddb_import -f frontier://FrontierProd/CMS_CONDITIONS -i XMLFILE_CTPPS_Geometry_2017_101YV3 -c sqlite:file.db -b 286693 -e 309055 -t XMLFILE_CTPPS_Geometry_101YV3_hlt +conddb_import -f frontier://FrontierProd/CMS_CONDITIONS -i XMLFILE_CTPPS_Geometry_2018_101YV1 -c sqlite:file.db -b 309055 -t XMLFILE_CTPPS_Geometry_101YV3_hlt +conddb_import -f sqlite_file:file.db -c sqlite_file:XMLFILE_CTPPS_HLT_Geometry.db -t XMLFILE_CTPPS_Geometry_101YV3_hlt -i XMLFILE_CTPPS_Geometry_101YV3_hlt diff --git a/CondTools/Geometry/test/writehelpers/createExtended2018Payloads.sh b/CondTools/Geometry/test/writehelpers/createExtended2018Payloads.sh index 00c250c19c980..87e546599e96f 100755 --- a/CondTools/Geometry/test/writehelpers/createExtended2018Payloads.sh +++ b/CondTools/Geometry/test/writehelpers/createExtended2018Payloads.sh @@ -27,6 +27,33 @@ cmsRun geometryExtended2018_xmlwriter.py # reco parts of the database are also filled. cmsRun geometryExtended2018_writer.py +# Now put the other scenarios into the database. +# Input the many XML files referenced by the cff file and +# output a single big XML file. +# This is repeated several times below. The sed commands +# serve to give the following sequence of input and output +# files +# +# Input cff Output file +# GeometryIdeal_cff giSingleBigFile.xml +# +sed -i '{s/Extended2018/Extended2018ZeroMaterial/g}' geometryExtended2018_xmlwriter.py +sed -i '{s/\/ge/\/gez/g}' geometryExtended2018_xmlwriter.py +cmsRun geometryExtended2018_xmlwriter.py + +# Read the one big XML file and output a record to the +# database with the an identifying tag +# This is repeated several times below. The sed commands +# serve to give the following sequence of input file and output +# tag +# +# Input file Output tag +# gezSingleBigFile.xml XMLFILE_Geometry_${mytag}_Extended2018ZeroMaterial_mc +# +sed -i '{s/Extended/Extended2018ZeroMaterial/g}' xmlgeometrywriter.py +sed -i '{s/\/ge/\/gez/g}' xmlgeometrywriter.py +cmsRun xmlgeometrywriter.py + # All the database objects were written into one database # (myfile.db) in the steps above. Extract the different # pieces into separate database files. These are the payloads diff --git a/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_writer.py b/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_writer.py index 091c693879ce8..5a2375a8520b4 100644 --- a/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_writer.py +++ b/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_writer.py @@ -17,7 +17,7 @@ # XML files, but there is no way to directly build the # DDCompactView from this. process.XMLGeometryWriter = cms.EDAnalyzer("XMLGeometryBuilder", - XMLFileName = cms.untracked.string("./geSingleBigFile.xml"), + XMLFileName = cms.untracked.string("./ge2017SingleBigFile.xml"), ZIP = cms.untracked.bool(True) ) @@ -26,7 +26,7 @@ process.PoolDBOutputService = cms.Service("PoolDBOutputService", process.CondDB, toPut = cms.VPSet(cms.PSet(record = cms.string('GeometryFileRcd'), - tag = cms.string('XMLFILE_CTPPS_Geometry_TagXX')) + tag = cms.string('XMLFILE_CTPPS_Geometry_2017_TagXX')) ) ) diff --git a/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_xmlwriter.py b/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_xmlwriter.py index 02d0e846221e3..781248d59863a 100644 --- a/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_xmlwriter.py +++ b/CondTools/Geometry/test/writehelpers/geometryCTPPS2017_xmlwriter.py @@ -2,8 +2,8 @@ process = cms.Process("GeometryXMLWriter") -process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_cfi') -from Geometry.VeryForwardGeometry.geometryRPFromDD_cfi import XMLIdealGeometryESSource_CTPPS +process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi') +from Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi import XMLIdealGeometryESSource_CTPPS process.XMLIdealGeometryESSource = XMLIdealGeometryESSource_CTPPS.clone() process.source = cms.Source("EmptyIOVSource", @@ -15,7 +15,7 @@ process.BigXMLWriter = cms.EDAnalyzer("OutputDDToDDL", rotNumSeed = cms.int32(0), - fileName = cms.untracked.string("./geSingleBigFile.xml") + fileName = cms.untracked.string("./ge2017SingleBigFile.xml") ) diff --git a/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_writer.py b/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_writer.py new file mode 100644 index 0000000000000..12db9758baaf6 --- /dev/null +++ b/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_writer.py @@ -0,0 +1,38 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("GeometryWriter") + +process.load('CondCore.CondDB.CondDB_cfi') + +process.source = cms.Source("EmptyIOVSource", + lastValue = cms.uint64(1), + timetype = cms.string('runnumber'), + firstValue = cms.uint64(1), + interval = cms.uint64(1) + ) + +# This reads the big XML file and the only way to fill the +# nonreco part of the database is to read this file. It +# somewhat duplicates the information read from the little +# XML files, but there is no way to directly build the +# DDCompactView from this. +process.XMLGeometryWriter = cms.EDAnalyzer("XMLGeometryBuilder", + XMLFileName = cms.untracked.string("./ge2018SingleBigFile.xml"), + ZIP = cms.untracked.bool(True) + ) + +process.CondDB.timetype = cms.untracked.string('runnumber') +process.CondDB.connect = cms.string('sqlite_file:myfile.db') +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + process.CondDB, + toPut = cms.VPSet(cms.PSet(record = cms.string('GeometryFileRcd'), + tag = cms.string('XMLFILE_CTPPS_Geometry_2018_101YV1')) + ) + ) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) + ) + +process.p1 = cms.Path(process.XMLGeometryWriter) + diff --git a/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_xmlwriter.py b/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_xmlwriter.py new file mode 100644 index 0000000000000..5a0ff2737497c --- /dev/null +++ b/CondTools/Geometry/test/writehelpers/geometryCTPPS2018_xmlwriter.py @@ -0,0 +1,27 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("GeometryXMLWriter") + +process.load('Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi') +from Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi import XMLIdealGeometryESSource_CTPPS +process.XMLIdealGeometryESSource = XMLIdealGeometryESSource_CTPPS.clone() + +process.source = cms.Source("EmptyIOVSource", + lastValue = cms.uint64(1), + timetype = cms.string('runnumber'), + firstValue = cms.uint64(1), + interval = cms.uint64(1) + ) + +process.BigXMLWriter = cms.EDAnalyzer("OutputDDToDDL", + rotNumSeed = cms.int32(0), + fileName = cms.untracked.string("./ge2018SingleBigFile.xml") + ) + + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) + ) + +process.p1 = cms.Path(process.BigXMLWriter) + diff --git a/CondTools/Geometry/test/writehelpers/splitExtended2018Database.sh b/CondTools/Geometry/test/writehelpers/splitExtended2018Database.sh index 4db56c45766bf..2eac2afd463e2 100755 --- a/CondTools/Geometry/test/writehelpers/splitExtended2018Database.sh +++ b/CondTools/Geometry/test/writehelpers/splitExtended2018Database.sh @@ -1,6 +1,7 @@ #!/bin/sh conddb_import -f sqlite_file:myfile.db -c sqlite_file:GeometryFileExtended2018.db -t XMLFILE_Geometry_TagXX_Extended2018_mc -i XMLFILE_Geometry_TagXX_Extended2018_mc +conddb_import -f sqlite_file:myfile.db -c sqlite_file:GeometryFileExtended2018ZeroMaterial.db -t XMLFILE_Geometry_TagXX_Extended2018ZeroMaterial_mc -i XMLFILE_Geometry_TagXX_Extended2018ZeroMaterial_mc conddb_import -f sqlite_file:myfile.db -c sqlite_file:TKRECO_Geometry.db -t TKRECO_Geometry_TagXX -i TKRECO_Geometry_TagXX conddb_import -f sqlite_file:myfile.db -c sqlite_file:TKExtra_Geometry.db -t TKExtra_Geometry_TagXX -i TKExtra_Geometry_TagXX conddb_import -f sqlite_file:myfile.db -c sqlite_file:TKParameters_Geometry.db -t TKParameters_Geometry_TagXX -i TKParameters_Geometry_TagXX diff --git a/CondTools/L1TriggerExt/README.md b/CondTools/L1TriggerExt/README.md new file mode 100644 index 0000000000000..60f07949f7d57 --- /dev/null +++ b/CondTools/L1TriggerExt/README.md @@ -0,0 +1,28 @@ +L1T O2O code organization +------------------------- + +This README briefly covers some "bolts and nuts" of the L1T O2O system. +For more general information on the system organization check [this link](https://github.com/kkotov/l1o2o). + +The L1T O2O system is partitioned into the core framework (this package) +and a set of system-specific [online producers](https://github.com/cms-sw/cmssw/blob/master/L1TriggerConfig/L1TConfigProducers) +invoked by means of [data writers](https://github.com/cms-sw/cmssw/blob/master/CondTools/L1TriggerExt/src/DataWriterExt.cc) +from the core framework and fetching the information from the online DB. The only component of the core framework that +explicitly queries online DB is +[L1SubsystemKeysOnlineProdExt](https://github.com/cms-sw/cmssw/blob/master/CondTools/L1TriggerExt/plugins/L1SubsystemKeysOnlineProdExt.cc) +generating a L1TriggerKeyExt object with TSC and RS keys for all of the systems. This object is distributed to +system-specific ObjectKey\_online\_producers that in turn generate system-specific L1TriggerKeyExt objects forwarded +to the payload online\_producers. The CondDB tag names are specified in +[this config](https://github.com/cms-sw/cmssw/blob/master/CondTools/L1TriggerExt/python/L1SubsystemParamsExt_cfi.py), +while the current set of versions (suffixes) is given +[here](https://github.com/cms-sw/cmssw/blob/master/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py). +The versions can also be overridden from the top-level scripts as described in the bottom of +[this slide](http://kkotov.github.io/l1o2o/talks/2017.03.01/#4). +The core framework's general design is outlined in [this talk](http://kkotov.github.io/l1o2o/talks/2016.04.19). + +Currently, the RS specific code is still available in the core framework, +but is not used or intended to be used. So if you browse the code, you can +ignore files containing the RS in the name. Same applies to all but +[runL1-O2O-iov.sh](https://github.com/cms-sw/cmssw/blob/master/CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh) +scripts. + diff --git a/CondTools/L1TriggerExt/python/L1ConfigTSCKeysExt_cff.py b/CondTools/L1TriggerExt/python/L1ConfigTSCKeysExt_cff.py index 33f98490d37b6..43e4e1c45ba51 100644 --- a/CondTools/L1TriggerExt/python/L1ConfigTSCKeysExt_cff.py +++ b/CondTools/L1TriggerExt/python/L1ConfigTSCKeysExt_cff.py @@ -2,7 +2,7 @@ from L1TriggerConfig.L1TConfigProducers.L1TMuonBarrelObjectKeysOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TMuonGlobalObjectKeysOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapObjectKeysOnline_cfi import * -from L1TriggerConfig.L1TConfigProducers.L1TMuonEndcapObjectKeysOnline_cfi import * +from L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapObjectKeysOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TCaloParamsObjectKeysOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TGlobalPrescalesVetosObjectKeysOnline_cfi import * @@ -11,7 +11,7 @@ def setTSCKeysDB(process, DBConnect, DBAuth): process.L1TCaloParamsObjectKeysOnline.onlineDB = cms.string( DBConnect ) process.L1TGlobalPrescalesVetosObjectKeysOnline.onlineDB = cms.string( DBConnect ) process.L1TMuonBarrelObjectKeysOnline.onlineDB = cms.string( DBConnect ) - process.L1TMuonEndcapObjectKeysOnline.onlineDB = cms.string( DBConnect ) + process.L1TMuonEndCapObjectKeysOnline.onlineDB = cms.string( DBConnect ) process.L1TMuonGlobalObjectKeysOnline.onlineDB = cms.string( DBConnect ) process.L1TMuonOverlapObjectKeysOnline.onlineDB = cms.string( DBConnect ) process.L1TUtmTriggerMenuObjectKeysOnline.onlineDB = cms.string( DBConnect ) @@ -19,9 +19,27 @@ def setTSCKeysDB(process, DBConnect, DBAuth): process.L1TCaloParamsObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) process.L1TGlobalPrescalesVetosObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) process.L1TMuonBarrelObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) - process.L1TMuonEndcapObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) + process.L1TMuonEndCapObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) process.L1TMuonGlobalObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) process.L1TMuonOverlapObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) process.L1TUtmTriggerMenuObjectKeysOnline.onlineAuthentication = cms.string( DBAuth ) +def liftKeySafetyFor(process, systems): + if 'CALO' in systems: + process.L1TCaloParamsObjectKeysOnline.transactionSafe = cms.bool(False) + + if 'uGTrs' in systems: + process.L1TGlobalPrescalesVetosObjectKeysOnline.transactionSafe = cms.bool(False) + + if 'BMTF' in systems: + process.L1TMuonBarrelObjectKeysOnline.transactionSafe = cms.bool(False) + + if 'EMTF' in systems: + process.L1TMuonEndCapObjectKeysOnline.transactionSafe = cms.bool(False) + + if 'uGMT' in systems: + process.L1TMuonGlobalObjectKeysOnline.transactionSafe = cms.bool(False) + + if 'OMTF' in systems: + process.L1TMuonOverlapObjectKeysOnline.transactionSafe = cms.bool(False) diff --git a/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py b/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py index 6801b1010aade..28a156e988286 100644 --- a/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py +++ b/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py @@ -35,3 +35,24 @@ def setTSCPayloadsDB(process, DBConnect, DBAuth, protoDBConnect, protoDBAuth): process.l1bmtfparProtodb.DBParameters.authenticationPath = cms.untracked.string( protoDBAuth ) process.l1emtfparProtodb.DBParameters.authenticationPath = cms.untracked.string( protoDBAuth ) process.l1gmtparProtodb.DBParameters.authenticationPath = cms.untracked.string( protoDBAuth ) + +def liftPayloadSafetyFor(process, systems): + if 'CALO' in systems: + process.L1TCaloParamsOnlineProd.transactionSafe = cms.bool(False) + + if 'uGTrs' in systems: + process.L1TGlobalPrescalesVetosOnlineProd.transactionSafe = cms.bool(False) + + if 'BMTF' in systems: + process.L1TMuonBarrelParamsOnlineProd.transactionSafe = cms.bool(False) + + if 'EMTF' in systems: + process.L1TMuonEndCapParamsOnlineProd.transactionSafe = cms.bool(False) + process.L1TMuonEndCapForestOnlineProd.transactionSafe = cms.bool(False) + + if 'uGMT' in systems: + process.L1TMuonGlobalParamsOnlineProd.transactionSafe = cms.bool(False) + + if 'OMTF' in systems: + process.L1TMuonOverlapParamsOnlineProd.transactionSafe = cms.bool(False) + diff --git a/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py b/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py index eef94292a8660..fc0b89265351e 100644 --- a/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py +++ b/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py @@ -10,12 +10,12 @@ def initL1O2OTagsExt(): initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TUtmTriggerMenu ] = "Stage2v0_hlt" initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TGlobalPrescalesVetos ] = "Stage2v0_hlt" - initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonBarrelParams ] = "Stage2v0_hlt" + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonBarrelParams ] = "Stage2v1_hlt" initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonOverlapParams ] = "Stage2v0_hlt" - initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonEndCapParams ] = "Stage2v0_hlt" - initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonEndCapForest ] = "Stage2v0_hlt" + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonEndCapParams ] = "Stage2v1_hlt" + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonEndCapForest ] = "Stage2v1_hlt" initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonGlobalParams ] = "Stage2v0_hlt" - initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TCaloParams ] = "Stage2v0_hlt" + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TCaloParams ] = "Stage2v3_hlt" # for i in range( 0, L1CondEnumExt.NumL1Cond ): # print i, initL1O2OTagsExt.tagBaseVec[ i ] diff --git a/CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh b/CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh index de13a5f92052b..eb2a8330cf82f 100755 --- a/CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh +++ b/CondTools/L1TriggerExt/scripts/runL1-O2O-iov.sh @@ -4,8 +4,9 @@ xflag=0 CMS_OPTIONS="" KEY_CONTENT="" TAG_UPDATE="" +UNSAFE="" -while getopts 'xfk:t:h' OPTION +while getopts 'xfk:t:s:h' OPTION do case $OPTION in x) xflag=1 @@ -17,11 +18,15 @@ while getopts 'xfk:t:h' OPTION t) if [ -z $TAG_UPDATE ] ; then TAG_UPDATE="tagUpdate="; else TAG_UPDATE=$TAG_UPDATE","; fi TAG_UPDATE=$TAG_UPDATE$OPTARG ;; + s) if [ -z $UNSAFE ] ; then UNSAFE="unsafe="; else UNSAFE=$UNSAFE","; fi + UNSAFE=$UNSAFE$OPTARG + ;; h) echo "Usage: [-xf] runnum tsckey" echo " -x: write to ORCON instead of sqlite file" echo " -f: force IOV update" echo " -k: limit update to the specific systems (default are all, which is equivalent to -k uGT,uGTrs,GMT,EMTF,OMTF,BMTF,CALO)" echo " -t: override tag name as TYPE:NEW_TAG_BASE (e.g. -t L1TCaloParams:Stage2v1)" + echo " -s: lift transaction safety: carry on even problems are encountered (e.g. -s EMTF,OMTF,CALO)" exit ;; esac @@ -32,11 +37,11 @@ runnum=$1 tsckey=$2 rskey=$3 +export TNS_ADMIN=/opt/offline/slc6_amd64_gcc493/cms/oracle-env/29/etc/ + echo "INFO: ADDITIONAL CMS OPTIONS: " $CMS_OPTIONS $KEY_CONTENT $TAG_UPDATE -#ONLINEDB_OPTIONS="onlineDBConnect=oracle://cms_omds_adg/CMS_TRG_R onlineDBAuth=./" -#ONLINEDB_OPTIONS="onlineDBConnect=oracle://int2r_lb/CMS_TRG_R onlineDBAuth=./" -ONLINEDB_OPTIONS="onlineDBConnect=oracle://cms_orcoff_prep/CMS_TRG_R onlineDBAuth=./" +ONLINEDB_OPTIONS="onlineDBConnect=oracle://cms_omds_adg/CMS_TRG_R onlineDBAuth=./" PROTODB_OPTIONS="protoDBConnect=oracle://cms_orcon_adg/CMS_CONDITIONS protoDBAuth=./" #ONLINEDB_OPTIONS="onlineDBConnect=oracle://cms_omds_lb/CMS_TRG_R onlineDBAuth=/data/O2O/L1T/" #PROTODB_OPTIONS="protoDBConnect=oracle://cms_orcon_prod/CMS_CONDITIONS protoDBAuth=/data/O2O/L1T/" @@ -65,7 +70,7 @@ fi if cmsRun ${CMSSW_RELEASE_BASE}/src/CondTools/L1TriggerExt/test/l1o2otestanalyzer_cfg.py ${INDB_OPTIONS} printL1TriggerKeyListExt=1 | grep "${tsckey}:${rskey}" ; then echo "TSC payloads present" else echo "TSC payloads absent; writing $KEY_CONTENT now" - cmsRun ${CMSSW_RELEASE_BASE}/src/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py tscKey=${tsckey} rsKey=${rskey} ${ONLINEDB_OPTIONS} ${PROTODB_OPTIONS} ${OUTDB_OPTIONS} ${COPY_OPTIONS} ${KEY_CONTENT} ${TAG_UPDATE} logTransactions=0 print + cmsRun ${CMSSW_RELEASE_BASE}/src/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py tscKey=${tsckey} rsKey=${rskey} ${ONLINEDB_OPTIONS} ${PROTODB_OPTIONS} ${OUTDB_OPTIONS} ${COPY_OPTIONS} ${KEY_CONTENT} ${TAG_UPDATE} ${UNSAFE} logTransactions=0 print o2ocode=$? if [ ${o2ocode} -ne 0 ] then diff --git a/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py b/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py index 25070b5b5ea87..400d951e16ea3 100644 --- a/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py +++ b/CondTools/L1TriggerExt/test/L1ConfigWritePayloadOnlineExt_cfg.py @@ -84,6 +84,11 @@ VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Comma-separated list of column-separated pairs relating type to a new tagBase") +options.register('unsafe', + '', #default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Comma-separated list of systems that we do not care about anymore") options.parseArguments() @@ -95,25 +100,18 @@ process.L1SubsystemKeysOnlineExt.onlineAuthentication = cms.string( options.onlineDBAuth ) process.load("CondTools.L1TriggerExt.L1ConfigTSCKeysExt_cff") -from CondTools.L1TriggerExt.L1ConfigTSCKeysExt_cff import setTSCKeysDB +from CondTools.L1TriggerExt.L1ConfigTSCKeysExt_cff import setTSCKeysDB, liftKeySafetyFor setTSCKeysDB( process, options.onlineDBConnect, options.onlineDBAuth ) +liftKeySafetyFor( process, options.unsafe.split(',') ) process.load("CondTools.L1TriggerExt.L1TriggerKeyOnlineExt_cfi") -#process.L1TriggerKeyOnlineExt.subsystemLabels = cms.vstring( -# 'uGT', -# 'uGTrs', -# 'uGMT', -# 'CALO', -# 'BMTF', -# 'OMTF', -# 'EMTF' -# ) process.L1TriggerKeyOnlineExt.subsystemLabels = cms.vstring( options.subsystemLabels.split(',') ) # Generate configuration data from OMDS process.load("CondTools.L1TriggerExt.L1ConfigTSCPayloadsExt_cff") -from CondTools.L1TriggerExt.L1ConfigTSCPayloadsExt_cff import setTSCPayloadsDB +from CondTools.L1TriggerExt.L1ConfigTSCPayloadsExt_cff import setTSCPayloadsDB, liftPayloadSafetyFor setTSCPayloadsDB( process, options.onlineDBConnect, options.onlineDBAuth, options.protoDBConnect, options.protoDBAuth ) +liftPayloadSafetyFor( process, options.unsafe.split(',') ) # Define CondDB tags from CondTools.L1TriggerExt.L1CondEnumExt_cfi import L1CondEnumExt diff --git a/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py b/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py index bf9313d94eb4c..08bddc4c4d8bf 100644 --- a/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py +++ b/CondTools/L1TriggerExt/test/L1ConfigWriteSinglePayloadExt_cfg.py @@ -49,17 +49,22 @@ '.', #default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "Authentication path for outputDB") + "Authentication path for output DB") +options.register('protoDBConnect', + 'oracle://cms_orcon_prod/CMS_CONDITIONS', #default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Authentication path for proto DB") +options.register('protoDBAuth', + '.', #default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Authentication path for proto DB") options.register('overwriteKey', 0, #default value VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "Overwrite existing key") -options.register('startup', - 0, #default value - VarParsing.VarParsing.multiplicity.singleton, - VarParsing.VarParsing.varType.int, - "Use L1StartupConfig_cff instead of L1DummyConfig_cff") options.parseArguments() @@ -100,20 +105,16 @@ if options.genFromOMDS == 0: # Generate dummy configuration data - process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapParamsOnlineProxy_cfi') - process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapParamsOnlineProxy_cfi') - process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapForestOnlineProxy_cfi') -# if options.startup == 0: -# process.load("L1Trigger.Configuration.L1DummyConfig_cff") -# process.load("L1TriggerConfig.L1GtConfigProducers.Luminosity.lumi1031.L1Menu_MC2009_v2_L1T_Scales_20090624_Imp0_Unprescaled_cff") -# else: -# process.load("L1Trigger.Configuration.L1StartupConfig_cff") -# process.load("L1TriggerConfig.L1GtConfigProducers.Luminosity.startup.L1Menu_Commissioning2009_v3_L1T_Scales_20080926_startup_Imp0_Unprescaled_cff") - + if options.objectType == 'L1TMuonEndCapForest' : + process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapForestOnlineProxy_cfi') + process.l1emtfForestProtodb.DBParameters.connect = cms.untracked.string(options.protoDBConnect) + process.l1emtfForestProtodb.DBParameters.authenticationPath = cms.untracked.string(options.protoDBAuth) + else : + process.load('L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapParamsOnlineProxy_cfi') else: # Generate configuration data from OMDS process.load("CondTools.L1TriggerExt.L1ConfigTSCPayloadsExt_cff") - process.load("CondTools.L1TriggerExt.L1ConfigRSPayloadsExt_cff") + #process.load("CondTools.L1TriggerExt.L1ConfigRSPayloadsExt_cff") # writer modules from CondTools.L1TriggerExt.L1CondDBPayloadWriterExt_cff import initPayloadWriterExt diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index d5864890f72a8..d5319a268b049 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -2,63 +2,63 @@ ### NEW KEYS ### # GlobalTag for MC production with perfectly aligned and calibrated detector for Run1 - 'run1_design' : '101X_mcRun1_design_v2', + 'run1_design' : '101X_mcRun1_design_v4', # GlobalTag for MC production (pp collisions) with realistic alignment and calibrations for Run1 - 'run1_mc' : '101X_mcRun1_realistic_v2', + 'run1_mc' : '101X_mcRun1_realistic_v4', # GlobalTag for MC production (Heavy Ions collisions) with realistic alignment and calibrations for Run1 - 'run1_mc_hi' : '101X_mcRun1_HeavyIon_v2', + 'run1_mc_hi' : '101X_mcRun1_HeavyIon_v4', # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run1 - 'run1_mc_pa' : '101X_mcRun1_pA_v2', + 'run1_mc_pa' : '101X_mcRun1_pA_v4', # GlobalTag for MC production with perfectly aligned and calibrated detector for Run2 - 'run2_design' : '101X_mcRun2_design_v3', + 'run2_design' : '101X_mcRun2_design_v5', # GlobalTag for MC production with pessimistic alignment and calibrations for Run2 - 'run2_mc_50ns' : '101X_mcRun2_startup_v3', + 'run2_mc_50ns' : '101X_mcRun2_startup_v5', #GlobalTag for MC production with optimistic alignment and calibrations for Run2 - 'run2_mc' : '101X_mcRun2_asymptotic_v3', + 'run2_mc' : '101X_mcRun2_asymptotic_v5', # GlobalTag for MC production (L1 Trigger Stage1) with starup-like alignment and calibrations for Run2, L1 trigger in Stage1 mode 'run2_mc_l1stage1' : '93X_mcRun2_asymptotic_v4', # GlobalTag for MC production (cosmics) with starup-like alignment and calibrations for Run2, Strip tracker in peak mode - 'run2_mc_cosmics' : '101X_mcRun2cosmics_startup_deco_v3', + 'run2_mc_cosmics' : '101X_mcRun2cosmics_startup_deco_v5', # GlobalTag for MC production (Heavy Ions collisions) with optimistic alignment and calibrations for Run2 - 'run2_mc_hi' : '101X_mcRun2_HeavyIon_v4', + 'run2_mc_hi' : '101X_mcRun2_HeavyIon_v6', # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run2 - 'run2_mc_pa' : '101X_mcRun2_pA_v3', + 'run2_mc_pa' : '101X_mcRun2_pA_v5', # GlobalTag for Run1 data reprocessing - 'run1_data' : '101X_dataRun2_v7', + 'run1_data' : '101X_dataRun2_v8', # GlobalTag for Run2 data reprocessing - 'run2_data' : '101X_dataRun2_v7', + 'run2_data' : '101X_dataRun2_v8', # GlobalTag for Run2 data relvals: allows customization to run with fixed L1 menu - 'run2_data_relval' : '101X_dataRun2_relval_v7', + 'run2_data_relval' : '101X_dataRun2_relval_v8', # GlobalTag for Run2 data 2016H relvals only: Prompt Conditions + fixed L1 menu (to be removed) - 'run2_data_promptlike' : '101X_dataRun2_PromptLike_v7', + 'run2_data_promptlike' : '101X_dataRun2_PromptLike_v9', # GlobalTag for Run1 HLT: it points to the online GT - 'run1_hlt' : '101X_dataRun2_HLT_frozen_v5', + 'run1_hlt' : '101X_dataRun2_HLT_frozen_v6', # GlobalTag for Run2 HLT: it points to the online GT - 'run2_hlt' : '101X_dataRun2_HLT_frozen_v5', + 'run2_hlt' : '101X_dataRun2_HLT_frozen_v6', # GlobalTag for Run2 HLT RelVals: customizations to run with fixed L1 Menu - 'run2_hlt_relval' : '101X_dataRun2_HLT_relval_v6', + 'run2_hlt_relval' : '101X_dataRun2_HLT_relval_v7', # GlobalTag for Run2 HLT for HI: it points to the online GT - 'run2_hlt_hi' : '101X_dataRun2_HLTHI_frozen_v6', + 'run2_hlt_hi' : '101X_dataRun2_HLTHI_frozen_v7', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) - 'phase1_2017_design' : '101X_mc2017_design_IdealBS_v5', + 'phase1_2017_design' : '101X_mc2017_design_IdealBS_v7', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector - 'phase1_2017_realistic' : '101X_mc2017_realistic_v5', + 'phase1_2017_realistic' : '101X_mc2017_realistic_v7', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in DECO mode - 'phase1_2017_cosmics' : '101X_mc2017cosmics_realistic_deco_v5', + 'phase1_2017_cosmics' : '101X_mc2017cosmics_realistic_deco_v7', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in PEAK mode - 'phase1_2017_cosmics_peak' : '101X_mc2017cosmics_realistic_peak_v5', + 'phase1_2017_cosmics_peak' : '101X_mc2017cosmics_realistic_peak_v7', # GlobalTag for MC production with perfectly aligned and calibrated detector for full Phase1 2018 (and 0,0,0-centred beamspot) - 'phase1_2018_design' : '101X_upgrade2018_design_v7', + 'phase1_2018_design' : '101X_upgrade2018_design_v8', # GlobalTag for MC production with realistic conditions for full Phase1 2018 detector - 'phase1_2018_realistic' : '101X_upgrade2018_realistic_v6', + 'phase1_2018_realistic' : '101X_upgrade2018_realistic_v7', # GlobalTag for MC production (cosmics) with realistic conditions for full Phase1 2018 detector, Strip tracker in DECO mode - 'phase1_2018_cosmics' : '101X_upgrade2018cosmics_realistic_deco_v7', + 'phase1_2018_cosmics' : '101X_upgrade2018cosmics_realistic_deco_v8', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2019 - 'phase1_2019_design' : '101X_postLS2_design_v4', # GT containing design conditions for postLS2 + 'phase1_2019_design' : '101X_postLS2_design_v5', # GT containing design conditions for postLS2 # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2019 - 'phase1_2019_realistic' : '101X_postLS2_realistic_v4', # GT containing realistic conditions for postLS2 + 'phase1_2019_realistic' : '101X_postLS2_realistic_v5', # GT containing realistic conditions for postLS2 # GlobalTag for MC production with realistic conditions for Phase2 2023 - 'phase2_realistic' : '101X_upgrade2023_realistic_v4' + 'phase2_realistic' : '101X_upgrade2023_realistic_v5' } aliases = { diff --git a/Configuration/DataProcessing/python/Merge.py b/Configuration/DataProcessing/python/Merge.py index c5d416286c3e2..7c2659a61d727 100644 --- a/Configuration/DataProcessing/python/Merge.py +++ b/Configuration/DataProcessing/python/Merge.py @@ -10,7 +10,6 @@ from FWCore.ParameterSet.Config import Process, EndPath from FWCore.ParameterSet.Modules import OutputModule, Source, Service -from Configuration.EventContent.EventContent_cff import NANOAODEventContent import FWCore.ParameterSet.Types as CfgTypes @@ -65,7 +64,8 @@ def mergeProcess(*inputFiles, **options): if newDQMIO: outMod = OutputModule("DQMRootOutputModule") elif mergeNANO: - outMod = OutputModule("NanoAODOutputModule",NANOAODEventContent.clone()) + import Configuration.EventContent.EventContent_cff + outMod = OutputModule("NanoAODOutputModule",Configuration.EventContent.EventContent_cff.NANOAODEventContent.clone()) else: outMod = OutputModule("PoolOutputModule") diff --git a/Configuration/DataProcessing/test/RunMerge.py b/Configuration/DataProcessing/test/RunMerge.py index f94d68c986886..8a88d3aaf1f1c 100644 --- a/Configuration/DataProcessing/test/RunMerge.py +++ b/Configuration/DataProcessing/test/RunMerge.py @@ -35,7 +35,8 @@ def __call__(self): process_name = self.processName, output_file = self.outputFile, output_lfn = self.outputLFN, - newDQMIO = self.newDQMIO) + newDQMIO = self.newDQMIO, + mergeNANO = self.mergeNANO) except Exception as ex: msg = "Error creating process for Merge:\n" msg += str(ex) @@ -51,7 +52,7 @@ def __call__(self): if __name__ == '__main__': - valid = ["input-files=", "output-file=", "output-lfn=", "dqmroot" ] + valid = ["input-files=", "output-file=", "output-lfn=", "dqmroot", "mergeNANO" ] usage = """RunMerge.py """ try: @@ -75,6 +76,7 @@ def __call__(self): merger.outputLFN = arg if opt == "--dqmroot" : merger.newDQMIO = True - + if opt == "--mergeNANO" : + merger.mergeNANO = True merger() diff --git a/Configuration/Generator/python/Hydjet_Quenched_MinBias_XeXe_5442GeV_cfi.py b/Configuration/Generator/python/Hydjet_Quenched_MinBias_XeXe_5442GeV_cfi.py index d8cc727c664cc..e90c8b1b1eb1d 100644 --- a/Configuration/Generator/python/Hydjet_Quenched_MinBias_XeXe_5442GeV_cfi.py +++ b/Configuration/Generator/python/Hydjet_Quenched_MinBias_XeXe_5442GeV_cfi.py @@ -15,10 +15,10 @@ numQuarkFlavor = cms.int32(0), ## to be removed sigmaInelNN = cms.double(70), shadowingSwitch = cms.int32(1), - nMultiplicity = cms.int32(9000), + nMultiplicity = cms.int32(18545), fracSoftMultiplicity = cms.double(1.), - maxLongitudinalRapidity = cms.double(2.3), - maxTransverseRapidity = cms.double(1.15), + maxLongitudinalRapidity = cms.double(3.75), + maxTransverseRapidity = cms.double(1.16), angularSpectrumSelector = cms.int32(1), rotateEventPlane = cms.bool(True), allowEmptyEvents = cms.bool(False), @@ -28,7 +28,7 @@ PythiaParameters = cms.PSet( pythiaUESettingsBlock, hydjetPythiaDefault = cms.vstring('MSEL=0 ! user processes', - 'CKIN(3)=8.15',# ! ptMin + 'CKIN(3)=9.2',# ! ptMin 'MSTP(81)=1' ), myParameters = cms.vstring('MDCY(310,1)=0'), diff --git a/Configuration/Geometry/python/GeometryExtended2018ZeroMaterial_cff.py b/Configuration/Geometry/python/GeometryExtended2018ZeroMaterial_cff.py new file mode 100644 index 0000000000000..984727c4ba340 --- /dev/null +++ b/Configuration/Geometry/python/GeometryExtended2018ZeroMaterial_cff.py @@ -0,0 +1,11 @@ +import FWCore.ParameterSet.Config as cms + +# +# Geometry master configuration +# +# Ideal geometry, needed for simulation +from Geometry.CMSCommonData.cmsExtendedGeometry2018ZeroMaterialXML_cfi import * +from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import * +from Geometry.HcalCommonData.hcalParameters_cfi import * +from Geometry.HcalCommonData.hcalDDDSimConstants_cfi import * + diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index e6a85627df485..1b2b8f9544f97 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -247,7 +247,7 @@ workflows[136.791] = ['',['RunNoBPTX2017B','HLTDR2_2017','RECODR2_2017reHLTAlCaTkCosmics_Prompt','HARVEST2017']] workflows[136.7801] = ['',['RunHLTPhy2017B_AOD','DQMHLTonAOD_2017','HARVESTDQMHLTonAOD_2017']] workflows[136.7802] = ['',['RunHLTPhy2017B_AODextra','DQMHLTonAODextra_2017','HARVESTDQMHLTonAOD_2017']] -workflows[136.7803] = ['',['RunHLTPhy2017B_RAWAOD','DQMHLTonRAWAOD_2017']] +workflows[136.7803] = ['',['RunHLTPhy2017B_RAWAOD','DQMHLTonRAWAOD_2017','HARVESTDQMHLTonAOD_2017']] workflows[136.844] = ['',['RunCharmonium2017B','HLTDR2_2017','RECODR2_2017reHLT_skimCharmonium_Prompt','HARVEST2017']] ### run 2017C ### @@ -317,6 +317,8 @@ # reminiAOD wf on 2017F 94X input workflows[136.8311] = ['',['RunJetHT2017F_reminiaod','REMINIAOD_data2017','HARVEST2017_REMINIAOD_data2017']] +# NANOAOD wf on 2017C miniAODv2 94X input +workflows[136.7952] = ['',['RunJetHT2017C_94Xv2NanoAODINPUT','NANOEDM2017_94XMiniAODv2','HARVESTNANOAOD2017_94XMiniAODv2']] ### fastsim ### workflows[5.1] = ['TTbar', ['TTbarFS','HARVESTFS']] @@ -442,10 +444,11 @@ workflows[1325.51] = ['', ['TTbar_13_94XreminiaodINPUT','REMINIAOD_mc2017','HARVESTUP17_REMINIAOD_mc2017']] # nanoaod wf without intermediate EDM, starting from existing MINIAOD inputs -workflows[1325.6] = ['', ['TTbar_13_94XNanoAODINPUT','NANOAODMC2017']] +workflows[1325.6] = ['', ['TTbar_13_94Xv1NanoAODINPUT','NANOAODMC2017_94XMiniAODv1']] # nanoaod wf with intermediate EDM and merge step, starting from existing MINIAOD inputs -workflows[1325.7] = ['', ['TTbar_13_94XNanoAODINPUT','NANOEDMMC2017','HARVESTNANOAODMC2017']] -workflows[1325.8] = ['', ['TTbar_13_92XNanoAODINPUT','NANOEDMMC2017_92X','HARVESTNANOAODMC2017_92X']] +workflows[1325.7] = ['', ['TTbar_13_94Xv2NanoAODINPUT','NANOEDMMC2017_94XMiniAODv2','HARVESTNANOAODMC2017_94XMiniAODv2']] +workflows[1325.8] = ['', ['TTbar_13_94Xv1NanoAODINPUT','NANOEDMMC2017_94XMiniAODv1','HARVESTNANOAODMC2017_94XMiniAODv1']] +workflows[1325.9] = ['', ['TTbar_13_92XNanoAODINPUT','NANOEDMMC2017_92X','HARVESTNANOAODMC2017_92X']] #using ZEE as I cannot find TT at CERN workflows[1329.1] = ['', ['ZEE_13_80XNanoAODINPUT','NANOEDMMC2016_80X','HARVESTNANOAODMC2016_80X']] diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 25b974790e195..a35a876686d79 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -365,6 +365,7 @@ steps['RunJetHT2017F_reminiaod']={'INPUT':InputInfo(dataSet='/JetHT/Run2017F-17Nov2017-v1/AOD',label='rmaod_jetHT2017F',events=100000,location='STD', ls=Run2017F)} +steps['RunJetHT2017C_94Xv2NanoAODINPUT']={'INPUT':InputInfo(dataSet='/JetHT/CMSSW_9_4_5_cand1-94X_dataRun2_relval_v11_RelVal_rmaod_jetHT2017C-v1/MINIAOD',label='nano_jetHT2017C',events=100000,location='STD', ls=Run2017C)} # Highstat HLTPhysics Run2015DHS=selectedLS([258712,258713,258714,258741,258742,258745,258749,258750,259626,259637,259683,259685,259686,259721,259809,259810,259818,259820,259821,259822,259862,259890,259891]) @@ -507,7 +508,7 @@ def identitySim(wf): baseDataSetRelease=[ 'CMSSW_9_2_4-91X_mcRun1_realistic_v2-v1', # 0 run1 samples; note TTbar GENSIM has v2 (see TTbarINPUT below) - 'CMSSW_10_1_0_pre3-101X_upgrade2018_realistic_v3-v1', # 1 GEN-SIM for HI RunII, 2018 + 'CMSSW_10_1_0-101X_upgrade2018_realistic_v6_resub-v1', # 1 GEN-SIM for HI RunII, 2018 'CMSSW_6_2_0_pre8-PRE_ST62_V8_FastSim-v1', # 2 for fastsim id test # 'CMSSW_7_1_0_pre5-START71_V1-v2', # 3 8 TeV , for the one sample which is part of the routine relval production (RelValZmumuJets_Pt_20_300, because of -v2) # THIS ABOVE IS NOT USED, AT THE MOMENT @@ -515,16 +516,16 @@ def identitySim(wf): 'CMSSW_7_3_0_pre1-PRE_LS172_V15_FastSim-v1', # 4 - fast sim GEN-SIM-DIGI-RAW-HLTDEBUG for id tests 'CMSSW_9_0_0_pre4-PU25ns_90X_mcRun2_asymptotic_v1-v1', # 5 - fullSim PU 25ns UP15 premix 'CMSSW_8_1_0_pre15-PU50ns_81X_mcRun2_startup_v12-v1', # 6 - fullSim PU 50ns UP15 premix - 'CMSSW_10_1_0_pre3-101X_mcRun2_asymptotic_v2_FastSim-v1', # 7 - fastSim MinBias for mixing - 'CMSSW_10_1_0_pre3-PU25ns_101X_mcRun2_asymptotic_v2_FastSim-v1',# 8 - fastSim premixed MinBias - 'CMSSW_10_1_0_pre3-101X_upgrade2018_realistic_v3-v1', # 9 - Run2 HI GEN-SIM for mixing + 'CMSSW_10_1_0-101X_mcRun2_asymptotic_v3_resub_FastSim-v1', # 7 - fastSim MinBias for mixing + 'CMSSW_10_1_0-PU25ns_101X_mcRun2_asymptotic_v3_FastSim-v1',# 8 - fastSim premixed MinBias + 'CMSSW_10_1_0-101X_upgrade2018_realistic_v6_resub-v1', # 9 - Run2 HI GEN-SIM for mixing 'CMSSW_7_6_0-76X_mcRun2_asymptotic_v11-v1', # 10 - 13 TeV High Stats GEN-SIM 'CMSSW_7_6_0_pre7-76X_mcRun2_asymptotic_v9_realBS-v1', # 11 - 13 TeV High Stats MiniBias for mixing GEN-SIM 'CMSSW_8_1_0_pre9_Geant4102-81X_mcRun2cosmics_startup_peak_v2-v1', # 12 - GEN-SIM input for 1307 cosmics wf from 810_p2 'CMSSW_10_0_0_pre2-100X_mc2017_realistic_v1-v1', # 13 - 13 TeV samples with GEN-SIM from PhaseI upgrade 'CMSSW_10_0_0_pre2-PU25ns_100X_mc2017_realistic_v1-v1', # 14 - fullSim PU 25ns UP17 premix - 'CMSSW_10_1_0_pre3-PU25ns_101X_upgrade2018_realistic_v3-v1', #15 - fullSim PU 25ns UP18 premix - 'CMSSW_10_1_0_pre3-101X_upgrade2018_realistic_v3-v1', #16 - GENSIM input 2018 + 'CMSSW_10_1_0-PU25ns_101X_upgrade2018_realistic_v6-v1', #15 - fullSim PU 25ns UP18 premix + 'CMSSW_10_1_0-101X_upgrade2018_realistic_v6_rsb-v1', #16 - GENSIM input 2018 ] @@ -565,7 +566,8 @@ def identitySim(wf): #input for a NANOAOD from MINIAOD workflow steps['ZEE_13_80XNanoAODINPUT']={'INPUT':InputInfo(dataSet='/RelValZEE_13/CMSSW_8_0_21-PU25ns_80X_mcRun2_asymptotic_2016_TrancheIV_v6_Tr4GT_v6-v1/MINIAODSIM',label='nanoaod80X',location='STD')} steps['TTbar_13_92XNanoAODINPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/CMSSW_9_2_12-PU25ns_92X_upgrade2017_realistic_v11-v1/MINIAODSIM',label='nanoaod92X',location='STD')} -steps['TTbar_13_94XNanoAODINPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/CMSSW_9_4_0_pre3-PU25ns_94X_mc2017_realistic_v4-v1/MINIAODSIM',label='nanoaod94X',location='STD')} +steps['TTbar_13_94Xv1NanoAODINPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/CMSSW_9_4_0_pre3-PU25ns_94X_mc2017_realistic_v4-v1/MINIAODSIM',label='nanoaod94X',location='STD')} +steps['TTbar_13_94Xv2NanoAODINPUT']={'INPUT':InputInfo(dataSet='/RelValTTbar_13/CMSSW_9_4_5_cand1-94X_mc2017_realistic_v14_PU_RelVal_rmaod-v1/MINIAODSIM',label='nanoaod94Xv2',location='STD')} # 13 TeV recycle GEN-SIM input steps['MinBias_13INPUT']={'INPUT':InputInfo(dataSet='/RelValMinBias_13/%s/GEN-SIM'%(baseDataSetRelease[3],),location='STD')} @@ -913,7 +915,6 @@ def genS(fragment,howMuch): "--datamix" : "PreMix", "--procModifiers": "premix_stage2", "--pileup_input" : "dbs:/RelValFS_PREMIXUP15_PU25/%s/GEN-SIM-DIGI-RAW"%(baseDataSetRelease[8],), - "--customise":"SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput" }, Kby(100,500),step1FastUpg2015Defaults]) @@ -1770,17 +1771,17 @@ def gen2018HiMix(fragment,howMuch): # for premixing: no --pileup_input for replay; GEN-SIM only available for in-time event, from FEVTDEBUGHLT previous step steps['RECOPRMXUP15_PU25']=merge([ - {'--era':'Run2_2016','--customise':'SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput'}, # temporary replacement for premix; to be brought back to customisePostLS1; DataMixer customize for rerouting inputs to mixed data. + {'--era':'Run2_2016','--procModifiers':'premix_stage2'}, # temporary replacement for premix; to be brought back to customisePostLS1; DataMixer customize for rerouting inputs to mixed data. step3Up2015Defaults]) steps['RECOPRMXUP15_PU50']=merge([ - {'--era':'Run2_50ns','--customise':'SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput'}, + {'--era':'Run2_50ns','--procModifiers':'premix_stage2'}, step3Up2015Defaults50ns]) steps['RECOPRMXUP17_PU25']=merge([ - {'--conditions':'auto:phase1_2017_realistic','--era':'Run2_2017','--customise':'SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput'}, + {'--conditions':'auto:phase1_2017_realistic','--era':'Run2_2017','--procModifiers':'premix_stage2'}, step3Up2015Defaults]) steps['RECOPRMXUP18_PU25']=merge([ - {'--conditions':'auto:phase1_2018_realistic','--era':'Run2_2018','--customise':'SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput'}, + {'--conditions':'auto:phase1_2018_realistic','--era':'Run2_2018','--procModifiers':'premix_stage2'}, step3Up2015Defaults]) steps['RECOPRMXUP18_PU25_L1TEgDQM']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,RECOSIM,EI,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@L1TEgamma'},steps['RECOPRMXUP18_PU25']]) steps['RECOPRMXUP18_PU25_L1TMuDQM']=merge([{'-s':'RAW2DIGI,L1Reco,RECO,RECOSIM,EI,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@L1TMuon'},steps['RECOPRMXUP18_PU25']]) @@ -2016,6 +2017,7 @@ def gen2018HiMix(fragment,howMuch): '--era':'Run2_2017', '--secondfilein':'filelist:step1_dasparentquery.log', '--customise_commands':'"process.HLTAnalyzerEndpath.remove(process.hltL1TGlobalSummary)"', + '--fileout':'DQMHLTonAOD.root', } steps['HARVESTDQMHLTonAOD_2017'] = merge([ {'--filein':'file:DQMHLTonAOD.root','-s':'HARVESTING:hltOfflineDQMClient'}, steps['HARVEST2017'] ]) ### Harvesting step for the DQM-only workflow @@ -2304,27 +2306,39 @@ def gen2018HiMix(fragment,howMuch): steps['NANOAOD2016_80X'] = merge([{'--era': 'Run2_2016,run2_miniAOD_80XLegacy'}, steps['NANOAOD2016'] ]) steps['NANOAOD2017_92X'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'}, steps['NANOAOD2017'] ]) +steps['NANOAOD2017_94XMiniAODv1'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'}, steps['NANOAOD2017'] ]) +steps['NANOAOD2017_94XMiniAODv2'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'}, steps['NANOAOD2017'] ]) steps['NANOAODMC2016'] = merge([{'--conditions': 'auto:run2_mc', '--era': 'Run2_2016'}, stepNanoAODMC ]) steps['NANOAODMC2017'] = merge([{'--conditions': 'auto:phase1_2017_realistic', '--era': 'Run2_2017'}, stepNanoAODMC ]) steps['NANOAODMC2016_80X'] = merge([{'--era': 'Run2_2016,run2_miniAOD_80XLegacy'}, steps['NANOAODMC2016'] ]) steps['NANOAODMC2017_92X'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'}, steps['NANOAODMC2017'] ]) +steps['NANOAODMC2017_94XMiniAODv1'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'}, steps['NANOAODMC2017'] ]) +steps['NANOAODMC2017_94XMiniAODv2'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'}, steps['NANOAODMC2017'] ]) steps['NANOEDMMC2017'] = merge([{'--conditions': 'auto:phase1_2017_realistic', '--era': 'Run2_2017'}, stepNanoEDMMC ]) steps['NANOEDMMC2017_92X'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'}, steps['NANOEDMMC2017'] ]) +steps['NANOEDMMC2017_94XMiniAODv1'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'}, steps['NANOEDMMC2017'] ]) +steps['NANOEDMMC2017_94XMiniAODv2'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'}, steps['NANOEDMMC2017'] ]) steps['NANOEDMMC2016_80X'] = merge([{'--conditions': 'auto:run2_mc', '--era': 'Run2_2016,run2_miniAOD_80XLegacy'}, steps['NANOEDMMC2017'] ]) steps['NANOEDM2017'] = merge([{'--conditions': 'auto:run2_data_relval', '--era': 'Run2_2017'}, stepNanoEDMData ]) steps['NANOEDM2017_92X'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'}, steps['NANOEDM2017'] ]) +steps['NANOEDM2017_94XMiniAODv1'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'}, steps['NANOEDM2017'] ]) +steps['NANOEDM2017_94XMiniAODv2'] = merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'}, steps['NANOEDM2017'] ]) steps['NANOEDM2016_80X'] = merge([{'--era': 'Run2_2016,run2_miniAOD_80XLegacy'}, steps['NANOEDM2017'] ]) steps['HARVESTNANOAODMC2017']=merge([{'-s':'HARVESTING:@nanoAODDQM','--conditions': 'auto:phase1_2017_realistic','--era': 'Run2_2017'},steps['HARVESTUP15']]) steps['HARVESTNANOAODMC2017_92X']=merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'},steps['HARVESTNANOAODMC2017']]) +steps['HARVESTNANOAODMC2017_94XMiniAODv1']=merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'},steps['HARVESTNANOAODMC2017']]) +steps['HARVESTNANOAODMC2017_94XMiniAODv2']=merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'},steps['HARVESTNANOAODMC2017']]) steps['HARVESTNANOAODMC2016_80X']=merge([{'--conditions': 'auto:run2_mc','--era': 'Run2_2016,run2_miniAOD_80XLegacy'},steps['HARVESTNANOAODMC2017']]) steps['HARVESTNANOAOD2017']=merge([{'--data':'','-s':'HARVESTING:@nanoAODDQM','--conditions':'auto:run2_data_relval','--era':'Run2_2017'},steps['HARVESTDR2']]) steps['HARVESTNANOAOD2017_92X']=merge([{'--era': 'Run2_2017,run2_nanoAOD_92X'},steps['HARVESTNANOAOD2017']]) +steps['HARVESTNANOAOD2017_94XMiniAODv1']=merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv1'},steps['HARVESTNANOAOD2017']]) +steps['HARVESTNANOAOD2017_94XMiniAODv2']=merge([{'--era': 'Run2_2017,run2_nanoAOD_94XMiniAODv2'},steps['HARVESTNANOAOD2017']]) steps['HARVESTNANOAOD2016_80X']=merge([{'--era': 'Run2_2016,run2_miniAOD_80XLegacy'},steps['HARVESTNANOAOD2017']]) steps['NANOMERGE'] = { '-s': 'ENDJOB', '-n': 1000 , '--eventcontent' : 'NANOAODSIM','--datatier': 'NANOAODSIM', '--conditions': 'auto:run2_mc' } @@ -2345,8 +2359,8 @@ def gen2018HiMix(fragment,howMuch): defaultDataSets={} defaultDataSets['2017']='CMSSW_10_0_0_pre2-100X_mc2017_realistic_v1-v' defaultDataSets['2017Design']='CMSSW_10_0_0_pre2-100X_mc2017_design_IdealBS_v1-v' -defaultDataSets['2018']='CMSSW_10_1_0_pre3-101X_upgrade2018_realistic_v3-v' -defaultDataSets['2018Design']='CMSSW_10_1_0_pre3-101X_upgrade2018_design_v4-v' +defaultDataSets['2018']='CMSSW_10_1_0-101X_upgrade2018_realistic_v6_rsb-v' +defaultDataSets['2018Design']='CMSSW_10_1_0-101X_upgrade2018_design_v7_resub-v' #defaultDataSets['2019']='' #defaultDataSets['2019Design']='' defaultDataSets['2023D17']='CMSSW_9_3_2-93X_upgrade2023_realistic_v2_2023D17noPU-v' @@ -2632,11 +2646,10 @@ def gen2018HiMix(fragment,howMuch): "--procModifiers": "premix_stage2"}, d]) elif "Reco" in step: - custNew = "SimGeneral/DataMixingModule/customiseForPremixingInput.customiseForPreMixingInput" - if "--customise" in d: - d["--customise"] += ","+custNew + if "--procModifiers" in d: + d["--procModifiers"] += ",premix_stage2" else: - d["--customise"] = custNew + d["--procModifiers"] = "premix_stage2" upgradeStepDict[stepNamePUpmx][k] = d for step in upgradeStepDict.keys(): diff --git a/Configuration/Skimming/python/Skims_PDWG_cff.py b/Configuration/Skimming/python/Skims_PDWG_cff.py index 3a4dcc8a9d38e..bacf6cde78cb2 100644 --- a/Configuration/Skimming/python/Skims_PDWG_cff.py +++ b/Configuration/Skimming/python/Skims_PDWG_cff.py @@ -399,7 +399,7 @@ from Configuration.Skimming.PDWG_MuonPOGSkim_cff import * MuonPOGSkimTrackPath = cms.Path(MuonPOGSkimTrackSequence) MuonPOGSkimSTAPath = cms.Path(MuonPOGSkimSTASequence) -MuonPOGSkim = cms.FilteredStream( +SKIMStreamMuonPOGSkim = cms.FilteredStream( responsible = 'PDWG', name = 'MuonPOGSkim', paths = (MuonPOGSkimTrackPath,MuonPOGSkimSTAPath), @@ -412,7 +412,7 @@ MuonPOGJPsiSkimTrackPath = cms.Path(MuonPOGJPsiSkimTrackSequence) MuonPOGJPsiSkimSTAPath = cms.Path(MuonPOGJPsiSkimSTASequence) -MuonPOGJPsiSkim = cms.FilteredStream( +SKIMStreamMuonPOGJPsiSkim = cms.FilteredStream( responsible = 'PDWG', name = 'MuonPOGJPsiSkim', paths = (MuonPOGJPsiSkimTrackPath,MuonPOGJPsiSkimSTAPath), diff --git a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py index 2c8e3c9b2cba5..4cecb4ed85860 100644 --- a/Configuration/StandardSequences/python/AlCaHarvesting_cff.py +++ b/Configuration/StandardSequences/python/AlCaHarvesting_cff.py @@ -63,6 +63,7 @@ ALCAHARVESTBeamSpotHPByRun = alcaBeamSpotHarvester.clone() ALCAHARVESTBeamSpotHPByRun.AlcaBeamSpotHarvesterParameters.BeamSpotOutputBase = cms.untracked.string("runbased") ALCAHARVESTBeamSpotHPByRun.AlcaBeamSpotHarvesterParameters.outputRecordName = cms.untracked.string("BeamSpotObjectsRcdHPByRun") +ALCAHARVESTBeamSpotHPByRun.AlcaBeamSpotHarvesterParameters.BeamSpotModuleName = cms.untracked.string('alcaBeamSpotProducerHP') ALCAHARVESTBeamSpotHPByRun_metadata = cms.PSet(record = cms.untracked.string('BeamSpotObjectsRcdHPByRun')) @@ -76,6 +77,7 @@ ALCAHARVESTBeamSpotHPByLumi = alcaBeamSpotHarvester.clone() ALCAHARVESTBeamSpotHPByLumi.AlcaBeamSpotHarvesterParameters.BeamSpotOutputBase = cms.untracked.string("lumibased") ALCAHARVESTBeamSpotHPByLumi.AlcaBeamSpotHarvesterParameters.outputRecordName = cms.untracked.string("BeamSpotObjectsRcdHPByLumi") +ALCAHARVESTBeamSpotHPByLumi.AlcaBeamSpotHarvesterParameters.BeamSpotModuleName = cms.untracked.string('alcaBeamSpotProducerHP') ALCAHARVESTBeamSpotHPByLumi.AlcaBeamSpotHarvesterParameters.DumpTxt = cms.untracked.bool(True) # configuration of DropBox metadata and DB output @@ -165,6 +167,14 @@ ) ) +if ALCAHARVESTSiPixelQuality.debug == cms.untracked.bool(True) : + ALCAHARVESTSiPixelQuality_dbOutput.append( + cms.PSet(record = cms.string('SiPixelQualityFromDbRcd_PCL'), + tag = cms.string('SiPixelQualityFromDbRcd_PCL'), + timetype = cms.untracked.string('lumiid') + ) + ) + # define all the paths BeamSpotByRun = cms.Path(ALCAHARVESTBeamSpotByRun) BeamSpotByLumi = cms.Path(ALCAHARVESTBeamSpotByLumi) diff --git a/Configuration/StandardSequences/python/DataMixerPreMix_cff.py b/Configuration/StandardSequences/python/DataMixerPreMix_cff.py index d9b8fc489fce0..32786024a4f13 100644 --- a/Configuration/StandardSequences/python/DataMixerPreMix_cff.py +++ b/Configuration/StandardSequences/python/DataMixerPreMix_cff.py @@ -4,7 +4,7 @@ from SimCalorimetry.Configuration.SimCalorimetry_cff import * -from SimGeneral.DataMixingModule.mixOne_simraw_on_sim_cfi import * +from SimGeneral.PreMixingModule.mixOne_premix_on_sim_cfi import * # Run after the DataMixer only. # diff --git a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc index 5de3a86fe804a..fdb70397e2c4a 100644 --- a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc @@ -24,18 +24,38 @@ #include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h" #include "DataFormats/CTPPSDigi/interface/TotemFEDInfo.h" #include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" #include "DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h" +#include "DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h" +#include "DataFormats/CTPPSDetId/interface/CTPPSPixelDetId.h" + #include "DataFormats/CTPPSReco/interface/CTPPSDiamondRecHit.h" #include "DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h" +#include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" +#include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" #include //---------------------------------------------------------------------------------------------------- + +// Utility for efficiency computations +bool channelAlignedWithTrack( const CTPPSGeometry* geom, const CTPPSDiamondDetId& detid, const CTPPSDiamondLocalTrack& localTrack, const float tolerance=1) { + const DetGeomDesc* det = geom->getSensor( detid ); + const float x_pos = det->translation().x(), + x_width = 2.0 * det->params().at( 0 ); // parameters stand for half the size + return + ( ( x_pos + 0.5 * x_width > localTrack.getX0() - localTrack.getX0Sigma() - tolerance + && x_pos + 0.5 * x_width < localTrack.getX0() + localTrack.getX0Sigma() + tolerance ) + || ( x_pos - 0.5 * x_width > localTrack.getX0() - localTrack.getX0Sigma() - tolerance + && x_pos - 0.5 * x_width < localTrack.getX0() + localTrack.getX0Sigma() + tolerance ) + || ( x_pos - 0.5 * x_width < localTrack.getX0() - localTrack.getX0Sigma() - tolerance + && x_pos + 0.5 * x_width > localTrack.getX0() + localTrack.getX0Sigma() + tolerance ) ); +} + + class CTPPSDiamondDQMSource : public DQMEDAnalyzer { public: @@ -60,6 +80,7 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer static const int CTPPS_NUM_OF_ARMS; static const int CTPPS_DIAMOND_STATION_ID; static const int CTPPS_DIAMOND_RP_ID; + static const int CTPPS_PIXEL_STATION_ID; static const int CTPPS_NEAR_RP_ID; static const int CTPPS_FAR_RP_ID; static const int CTPPS_DIAMOND_NUM_OF_PLANES; @@ -68,15 +89,15 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer static const int CTPPS_FED_ID_56; edm::EDGetTokenT< edm::DetSetVector > tokenStatus_; - edm::EDGetTokenT< edm::DetSetVector > tokenLocalTrack_; + edm::EDGetTokenT< edm::DetSetVector > tokenPixelTrack_; edm::EDGetTokenT< edm::DetSetVector > tokenDigi_; edm::EDGetTokenT< edm::DetSetVector > tokenDiamondHit_; edm::EDGetTokenT< edm::DetSetVector > tokenDiamondTrack_; edm::EDGetTokenT< std::vector > tokenFEDInfo_; bool excludeMultipleHits_; - double minimumStripAngleForTomography_; - double maximumStripAngleForTomography_; + double horizontalShiftBwDiamondPixels_; + double horizontalShiftOfDiamond_; std::vector< std::pair > runParameters_; int centralOOT_; unsigned int verbosity_; @@ -109,12 +130,12 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer MonitorElement* trackDistribution = nullptr; MonitorElement* trackDistributionOOT = nullptr; - MonitorElement* stripTomographyAllFar_0_25 = nullptr; - MonitorElement* stripTomographyAllFar_25_50 = nullptr; - MonitorElement* stripTomographyAllFar_50_75 = nullptr; - std::vector< MonitorElement* > stripTomographyAllFar; + MonitorElement* pixelTomographyAll_0_25 = nullptr; + MonitorElement* pixelTomographyAll_25_50 = nullptr; + MonitorElement* pixelTomographyAll_50_75 = nullptr; + std::vector< MonitorElement* > pixelTomographyAll; - MonitorElement* leadingEdgeCumulative_both = nullptr, *leadingEdgeCumulative_le = nullptr, *trailingEdgeCumulative_te = nullptr; + MonitorElement* leadingEdgeCumulative_both = nullptr, *leadingEdgeCumulative_all = nullptr, *leadingEdgeCumulative_le = nullptr, *trailingEdgeCumulative_te = nullptr; MonitorElement* timeOverThresholdCumulativePot = nullptr, *leadingTrailingCorrelationPot = nullptr; MonitorElement* leadingWithoutTrailingCumulativePot = nullptr; @@ -130,7 +151,12 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer unsigned int HitCounter, MHCounter, LeadingOnlyCounter, TrailingOnlyCounter, CompleteCounter; - PotPlots() {}; + std::map effTriplecountingChMap; + std::map effDoublecountingChMap; + MonitorElement* EfficiencyOfChannelsInPot = nullptr; + TH2F pixelTracksMap; + + PotPlots() {} PotPlots( DQMStore::IBooker& ibooker, unsigned int id ); }; @@ -144,7 +170,10 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer MonitorElement* hitProfile = nullptr; MonitorElement* hit_multiplicity = nullptr; - MonitorElement* stripTomography_far = nullptr; + MonitorElement* pixelTomography_far = nullptr; + MonitorElement* EfficiencyWRTPixelsInPlane = nullptr; + + TH2F pixelTracksMapWithDiamonds; PlanePlots() {} PlanePlots( DQMStore::IBooker& ibooker, unsigned int id ); @@ -165,7 +194,7 @@ class CTPPSDiamondDQMSource : public DQMEDAnalyzer MonitorElement* TimeOverThresholdCumulativePerChannel = nullptr; MonitorElement* LeadingTrailingCorrelationPerChannel = nullptr; MonitorElement* leadingWithoutTrailing = nullptr; - MonitorElement* stripTomography_far = nullptr; + MonitorElement* pixelTomography_far = nullptr; MonitorElement* hit_rate = nullptr; MonitorElement* ECCheckPerChannel = nullptr; unsigned long hitsCounterPerLumisection; @@ -189,6 +218,7 @@ const double CTPPSDiamondDQMSource::INV_DISPLAY_RESOLUTION_FOR_HITS_MM = 1./D const double CTPPSDiamondDQMSource::HPTDC_BIN_WIDTH_NS = 25./1024; const int CTPPSDiamondDQMSource::CTPPS_NUM_OF_ARMS = 2; const int CTPPSDiamondDQMSource::CTPPS_DIAMOND_STATION_ID = 1; +const int CTPPSDiamondDQMSource::CTPPS_PIXEL_STATION_ID = 2; const int CTPPSDiamondDQMSource::CTPPS_DIAMOND_RP_ID = 6; const int CTPPSDiamondDQMSource::CTPPS_NEAR_RP_ID = 2; const int CTPPSDiamondDQMSource::CTPPS_FAR_RP_ID = 3; @@ -217,7 +247,7 @@ CTPPSDiamondDQMSource::GlobalPlots::GlobalPlots( DQMStore::IBooker& ibooker ) //---------------------------------------------------------------------------------------------------- -CTPPSDiamondDQMSource::PotPlots::PotPlots( DQMStore::IBooker& ibooker, unsigned int id ): HitCounter(0), MHCounter(0), LeadingOnlyCounter(0), TrailingOnlyCounter(0), CompleteCounter(0) +CTPPSDiamondDQMSource::PotPlots::PotPlots( DQMStore::IBooker& ibooker, unsigned int id ): HitCounter(0), MHCounter(0), LeadingOnlyCounter(0), TrailingOnlyCounter(0), CompleteCounter(0), pixelTracksMap("Pixel track maps for efficiency", "Pixel track maps for efficiency", 27, -2, 25, 18, -4, 14 ) { std::string path, title; CTPPSDiamondDetId( id ).rpName( path, CTPPSDiamondDetId::nPath ); @@ -232,26 +262,27 @@ CTPPSDiamondDQMSource::PotPlots::PotPlots( DQMStore::IBooker& ibooker, unsigned activity_per_bx_50_75 = ibooker.book1D( "activity per BX 50 75", title+" Activity per BX 50 - 75 ns;Event.BX", 3600, -1.5, 3598. + 0.5 ); activity_per_bx.emplace_back(activity_per_bx_50_75); - hitDistribution2d = ibooker.book2D( "hits in planes", title+" hits in planes;plane number;x (mm)", 10, -0.5, 4.5, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); - hitDistribution2d_lumisection = ibooker.book2D( "hits in planes lumisection", title+" hits in planes in the last lumisection;plane number;x (mm)", 10, -0.5, 4.5, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); - hitDistribution2dOOT= ibooker.book2D( "hits with OOT in planes", title+" hits with OOT in planes;plane number + 0.25 OOT;x (mm)", 17, -0.25, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); - hitDistribution2dOOT_le= ibooker.book2D( "hits with OOT in planes (le only)", title+" hits with OOT in planes (le only);plane number + 0.25 OOT;x (mm)", 17, -0.25, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); + hitDistribution2d = ibooker.book2D( "hits in planes", title+" hits in planes;plane number;x (mm)", 10, -0.5, 4.5, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); + hitDistribution2d_lumisection = ibooker.book2D( "hits in planes lumisection", title+" hits in planes in the last lumisection;plane number;x (mm)", 10, -0.5, 4.5, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); + hitDistribution2dOOT= ibooker.book2D( "hits with OOT in planes", title+" hits with OOT in planes;plane number + 0.25 OOT;x (mm)", 17, -0.25, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); + hitDistribution2dOOT_le= ibooker.book2D( "hits with OOT in planes (le only)", title+" hits with OOT in planes (le only);plane number + 0.25 OOT;x (mm)", 17, -0.25, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); activePlanes = ibooker.book1D( "active planes", title+" active planes (per event);number of active planes", 6, -0.5, 5.5 ); activePlanesInclusive = ibooker.book1D( "active planes inclusive", title+" active planes, MH and le only included (per event);number of active planes", 6, -0.5, 5.5 ); - trackDistribution = ibooker.book1D( "tracks", title+" tracks;x (mm)", 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); - trackDistributionOOT = ibooker.book2D( "tracks with OOT", title+" tracks with OOT;plane number;x (mm)", 9, -0.5, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); + trackDistribution = ibooker.book1D( "tracks", title+" tracks;x (mm)", 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); + trackDistributionOOT = ibooker.book2D( "tracks with OOT", title+" tracks with OOT;plane number;x (mm)", 9, -0.5, 4, 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); - stripTomographyAllFar_0_25 = ibooker.book2D( "tomography all far 0 25", title+" tomography with strips far 0 - 25 ns (all planes);x + 25*plane(mm);y (mm)", 100, 0, 100, 12, -2, 10 ); - stripTomographyAllFar.emplace_back(stripTomographyAllFar_0_25); - stripTomographyAllFar_25_50 = ibooker.book2D( "tomography all far 25 50", title+" tomography with strips far 25 - 50 ns (all planes);x + 25*plane(mm);y (mm)", 100, 0, 100, 12, -2, 10 ); - stripTomographyAllFar.emplace_back(stripTomographyAllFar_25_50); - stripTomographyAllFar_50_75 = ibooker.book2D( "tomography all far 50 75", title+" tomography with strips far 50 - 75 ns (all planes);x + 25*plane(mm);y (mm)", 100, 0, 100, 12, -2, 10 ); - stripTomographyAllFar.emplace_back(stripTomographyAllFar_50_75); + pixelTomographyAll_0_25 = ibooker.book2D( "tomography pixel 0 25", title+" tomography with pixel 0 - 25 ns (all planes);x + 25*plane(mm);y (mm)", 100, -2, 98, 12, -2, 10 ); + pixelTomographyAll.emplace_back(pixelTomographyAll_0_25); + pixelTomographyAll_25_50 = ibooker.book2D( "tomography pixel 25 50", title+" tomography with pixel 25 - 50 ns (all planes);x + 25*plane(mm);y (mm)", 100, -2, 98, 12, -2, 10 ); + pixelTomographyAll.emplace_back(pixelTomographyAll_25_50); + pixelTomographyAll_50_75 = ibooker.book2D( "tomography pixel 50 75", title+" tomography with pixel 50 - 75 ns (all planes);x + 25*plane(mm);y (mm)", 100, -2, 98, 12, -2, 10 ); + pixelTomographyAll.emplace_back(pixelTomographyAll_50_75); - leadingEdgeCumulative_both = ibooker.book1D( "leading edge (le and te)", title+" leading edge (le and te); leading edge (ns)", 125, 0, 125 ); - leadingEdgeCumulative_le = ibooker.book1D( "leading edge (le only)", title+" leading edge (le only); leading edge (ns)", 125, 0, 125 ); - trailingEdgeCumulative_te = ibooker.book1D( "trailing edge (te only)", title+" trailing edge (te only); trailing edge (ns)", 125, 0, 125 ); + leadingEdgeCumulative_both = ibooker.book1D( "leading edge (le and te)", title+" leading edge (le and te) (recHits); leading edge (ns)", 125, 0, 125 ); + leadingEdgeCumulative_all = ibooker.book1D( "leading edge (all)", title+" leading edge (all) (DIGIs); leading edge (ns)", 125, 0, 125 ); + leadingEdgeCumulative_le = ibooker.book1D( "leading edge (le only)", title+" leading edge (le only) (DIGIs); leading edge (ns)", 125, 0, 125 ); + trailingEdgeCumulative_te = ibooker.book1D( "trailing edge (te only)", title+" trailing edge (te only) (DIGIs); trailing edge (ns)", 125, 0, 125 ); timeOverThresholdCumulativePot = ibooker.book1D( "time over threshold", title+" time over threshold;time over threshold (ns)", 250, -25, 100 ); leadingTrailingCorrelationPot = ibooker.book2D( "leading trailing correlation", title+" leading trailing correlation;leading edge (ns);trailing edge (ns)", 75, 0, 75, 75, 0, 75 ); @@ -269,16 +300,19 @@ CTPPSDiamondDQMSource::PotPlots::PotPlots( DQMStore::IBooker& ibooker, unsigned MHComprensive = ibooker.book2D( "MH in channels", title+" MH (%) in channels;plane number;ch number", 10, -0.5, 4.5, 14, -1, 13 ); + EfficiencyOfChannelsInPot = ibooker.book2D( "Efficiency in channels", title+" Efficiency (%) in channels (diamonds only);plane number;ch number", 10, -0.5, 4.5, 14, -1, 13 ); + ibooker.setCurrentFolder( path+"/clock/" ); clock_Digi1_le = ibooker.book1D( "clock1 leading edge", title+" clock1;leading edge (ns)", 1250, 0, 125 ); clock_Digi1_te = ibooker.book1D( "clock1 trailing edge", title+" clock1;trailing edge (ns)", 75, 0, 75 ); clock_Digi3_le = ibooker.book1D( "clock3 leading edge", title+" clock3;leading edge (ns)", 1250, 0, 125 ); clock_Digi3_te = ibooker.book1D( "clock3 trailing edge", title+" clock3;trailing edge (ns)", 75, 0, 75 ); + } //---------------------------------------------------------------------------------------------------- -CTPPSDiamondDQMSource::PlanePlots::PlanePlots( DQMStore::IBooker& ibooker, unsigned int id ) +CTPPSDiamondDQMSource::PlanePlots::PlanePlots( DQMStore::IBooker& ibooker, unsigned int id ) : pixelTracksMapWithDiamonds("Pixel track maps for efficiency with coincidence", "Pixel track maps for efficiency with coincidence", 27, -2, 25, 18, -4, 14 ) { std::string path, title; CTPPSDiamondDetId( id ).planeName( path, CTPPSDiamondDetId::nPath ); @@ -287,10 +321,12 @@ CTPPSDiamondDQMSource::PlanePlots::PlanePlots( DQMStore::IBooker& ibooker, unsig CTPPSDiamondDetId( id ).planeName( title, CTPPSDiamondDetId::nFull ); digiProfileCumulativePerPlane = ibooker.book1D( "digi profile", title+" digi profile; ch number", 12, -0.5, 11.5 ); - hitProfile = ibooker.book1D( "hit profile", title+" hit profile;x (mm)", 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -1, 18 ); + hitProfile = ibooker.book1D( "hit profile", title+" hit profile;x (mm)", 19.*INV_DISPLAY_RESOLUTION_FOR_HITS_MM, -0.5, 18.5 ); hit_multiplicity = ibooker.book1D( "channels per plane", title+" channels per plane; ch per plane", 13, -0.5, 12.5 ); - stripTomography_far = ibooker.book2D( "tomography far", title+" tomography with strips far;x + 25 OOT (mm);y (mm)", 50, 0, 50, 12, -2, 10 ); + pixelTomography_far = ibooker.book2D( "tomography pixel", title+" tomography with pixel;x + 25 OOT (mm);y (mm)", 100, -2, 98, 12, -2, 10 ); + EfficiencyWRTPixelsInPlane = ibooker.book2D( "Efficieny wrt pixel", title+" Efficieny wrt pixel;x (mm);y (mm)", 27, -2, 25, 18, -4, 14 ); + } //---------------------------------------------------------------------------------------------------- @@ -320,15 +356,15 @@ CTPPSDiamondDQMSource::ChannelPlots::ChannelPlots( DQMStore::IBooker& ibooker, u HPTDCErrorFlags->getTH1F()->GetXaxis()->SetBinLabel( error_index, HPTDCErrorFlags::getHPTDCErrorName( error_index-1 ).c_str() ); HPTDCErrorFlags->getTH1F()->GetXaxis()->SetBinLabel( 16, "MH (%)" ); - leadingEdgeCumulative_both = ibooker.book1D( "leading edge (le and te)", title+" leading edge; leading edge (ns)", 125, 0, 125 ); - leadingEdgeCumulative_le = ibooker.book1D( "leading edge (le only)", title+" leading edge; leading edge (ns)", 125, 0, 125 ); - trailingEdgeCumulative_te = ibooker.book1D( "trailing edge (te only)", title+" trailing edge (te only); trailing edge (ns)", 125, 0, 125 ); + leadingEdgeCumulative_both = ibooker.book1D( "leading edge (le and te)", title+" leading edge (recHits); leading edge (ns)", 125, 0, 125 ); + leadingEdgeCumulative_le = ibooker.book1D( "leading edge (le only)", title+" leading edge (DIGIs); leading edge (ns)", 125, 0, 125 ); + trailingEdgeCumulative_te = ibooker.book1D( "trailing edge (te only)", title+" trailing edge (te only) (DIGIs); trailing edge (ns)", 125, 0, 125 ); TimeOverThresholdCumulativePerChannel = ibooker.book1D( "time over threshold", title+" time over threshold;time over threshold (ns)", 75, -25, 50 ); LeadingTrailingCorrelationPerChannel = ibooker.book2D( "leading trailing correlation", title+" leading trailing correlation;leading edge (ns);trailing edge (ns)", 75, 0, 75, 75, 0, 75 ); ECCheckPerChannel = ibooker.book1D("optorxEC(8bit) - vfatEC vs optorxEC", title+" EC Error;optorxEC-vfatEC", 128, -64, 64 ); - stripTomography_far = ibooker.book2D( "tomography far", "tomography with strips far;x + 25 OOT (mm);y (mm)", 50, 0, 50, 12, -2, 10 ); + pixelTomography_far = ibooker.book2D( "tomography pixel", "tomography with pixel;x + 25 OOT (mm);y (mm)", 100, -2, 98, 12, -2, 10 ); hit_rate = ibooker.book1D( "hit rate", title+"hit rate;rate (Hz)", 40, 0, 20); } @@ -337,14 +373,12 @@ CTPPSDiamondDQMSource::ChannelPlots::ChannelPlots( DQMStore::IBooker& ibooker, u CTPPSDiamondDQMSource::CTPPSDiamondDQMSource( const edm::ParameterSet& ps ) : tokenStatus_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagStatus" ) ) ), - tokenLocalTrack_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagLocalTrack" ) ) ), + tokenPixelTrack_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagPixelLocalTracks" ) ) ), tokenDigi_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagDigi" ) ) ), tokenDiamondHit_ ( consumes< edm::DetSetVector > ( ps.getParameter( "tagDiamondRecHits" ) ) ), tokenDiamondTrack_( consumes< edm::DetSetVector >( ps.getParameter( "tagDiamondLocalTracks" ) ) ), tokenFEDInfo_ ( consumes< std::vector > ( ps.getParameter( "tagFEDInfo" ) ) ), - excludeMultipleHits_ ( ps.getParameter( "excludeMultipleHits" ) ), - minimumStripAngleForTomography_( ps.getParameter( "minimumStripAngleForTomography" ) ), - maximumStripAngleForTomography_( ps.getParameter( "maximumStripAngleForTomography" ) ), + excludeMultipleHits_ ( ps.getParameter( "excludeMultipleHits" ) ), centralOOT_( -999 ), verbosity_ ( ps.getUntrackedParameter( "verbosity", 0 ) ), EC_difference_56_( -500 ), EC_difference_45_( -500 ) @@ -362,7 +396,7 @@ CTPPSDiamondDQMSource::~CTPPSDiamondDQMSource() //---------------------------------------------------------------------------------------------------- void -CTPPSDiamondDQMSource::dqmBeginRun( const edm::Run& iRun, const edm::EventSetup& ) +CTPPSDiamondDQMSource::dqmBeginRun( const edm::Run& iRun, const edm::EventSetup& iSetup ) { centralOOT_ = -999; for ( const auto& oot : runParameters_ ) { @@ -370,6 +404,21 @@ CTPPSDiamondDQMSource::dqmBeginRun( const edm::Run& iRun, const edm::EventSetup& centralOOT_ = oot.second; break; } } + + // Get detector shifts from the geometry + edm::ESHandle geometry_; + iSetup.get().get( geometry_ ); + const CTPPSGeometry *geom = geometry_.product(); + const CTPPSDiamondDetId detid(0, CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID, 0, 0 ); + const DetGeomDesc* det = geom->getSensor( detid ); + horizontalShiftOfDiamond_ = det->translation().x() - det->params().at( 0 ); + + // Rough alignement of pixel detector for diamond thomography + const CTPPSPixelDetId pixid(0, CTPPS_PIXEL_STATION_ID, CTPPS_FAR_RP_ID, 0); + if ( iRun.run()>300000 ) { //Pixel installed + det = geom->getSensor( pixid ); + horizontalShiftBwDiamondPixels_ = det->translation().x() - det->params().at( 0 ) - horizontalShiftOfDiamond_ - 3; + } } @@ -410,14 +459,14 @@ CTPPSDiamondDQMSource::beginLuminosityBlock( const edm::LuminosityBlock&, const //---------------------------------------------------------------------------------------------------- void -CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& ) +CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& iSetup ) { // get event data edm::Handle< edm::DetSetVector > diamondVFATStatus; event.getByToken( tokenStatus_, diamondVFATStatus ); - - edm::Handle< edm::DetSetVector > stripTracks; - event.getByToken( tokenLocalTrack_, stripTracks ); + + edm::Handle< edm::DetSetVector > pixelTracks; + event.getByToken( tokenPixelTrack_, pixelTracks ); edm::Handle< edm::DetSetVector > diamondDigis; event.getByToken( tokenDigi_, diamondDigis ); @@ -431,6 +480,9 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& edm::Handle< edm::DetSetVector > diamondLocalTracks; event.getByToken( tokenDiamondTrack_, diamondLocalTracks ); + edm::ESHandle geometry_; + iSetup.get().get( geometry_ ); + // check validity bool valid = true; valid &= diamondVFATStatus.isValid(); @@ -457,7 +509,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& // Correlation Plots //------------------------------ - for ( const auto& ds1 : *stripTracks ) { + for ( const auto& ds1 : *pixelTracks ) { for ( const auto& tr1 : ds1 ) { if ( ! tr1.isValid() ) continue; @@ -468,7 +520,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& if (stNum1 != 0 || ( rpNum1 != 2 && rpNum1 != 3 ) ) continue; unsigned int idx1 = arm1*3 + rpNum1-2; - for ( const auto& ds2 : *stripTracks ) { + for ( const auto& ds2 : *pixelTracks ) { for ( const auto& tr2 : ds2 ) { if ( ! tr2.isValid() ) continue; @@ -538,6 +590,9 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& //Leading without trailing investigation if ( digi.getLeadingEdge() != 0 || digi.getTrailingEdge() != 0 ) { ++(potPlots_[detId_pot].HitCounter); + if ( digi.getLeadingEdge() != 0 ) { + potPlots_[detId_pot].leadingEdgeCumulative_all->Fill( HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() ); + } if ( digi.getLeadingEdge() != 0 && digi.getTrailingEdge() == 0 ) { ++(potPlots_[detId_pot].LeadingOnlyCounter); potPlots_[detId_pot].leadingEdgeCumulative_le->Fill( HPTDC_BIN_WIDTH_NS * digi.getLeadingEdge() ); @@ -623,7 +678,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& if ( rechit.getToT() != 0 && centralOOT_ != -999 && rechit.getOOTIndex() == centralOOT_ ) { TH2F *hitHistoTmp = potPlots_[detId_pot].hitDistribution2d->getTH2F(); TAxis *hitHistoTmpYAxis = hitHistoTmp->GetYaxis(); - int startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() ); + int startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - horizontalShiftOfDiamond_ - 0.5*rechit.getXWidth() ); int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+i) ); @@ -631,7 +686,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& hitHistoTmp = potPlots_[detId_pot].hitDistribution2d_lumisection->getTH2F(); hitHistoTmpYAxis = hitHistoTmp->GetYaxis(); - startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() ); + startBin = hitHistoTmpYAxis->FindBin( rechit.getX() - horizontalShiftOfDiamond_ - 0.5*rechit.getXWidth() ); numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( detId.plane() + UFSDShift, hitHistoTmpYAxis->GetBinCenter(startBin+i) ); @@ -646,25 +701,25 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& TH2F *hitHistoOOTTmp = potPlots_[detId_pot].hitDistribution2dOOT->getTH2F(); TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis(); - int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() ); + int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - horizontalShiftOfDiamond_ - 0.5*rechit.getXWidth() ); int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( detId.plane() + 0.2 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+i) ); } } else { - if ( rechit.getT() != 0 ) { + if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING ) { // Only leading TH2F *hitHistoOOTTmp = potPlots_[detId_pot].hitDistribution2dOOT_le->getTH2F(); TAxis *hitHistoOOTTmpYAxis = hitHistoOOTTmp->GetYaxis(); - int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - 0.5*rechit.getXWidth() ); + int startBin = hitHistoOOTTmpYAxis->FindBin( rechit.getX() - horizontalShiftOfDiamond_ - 0.5*rechit.getXWidth() ); int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( detId.plane() + 0.2 * rechit.getOOTIndex(), hitHistoOOTTmpYAxis->GetBinCenter(startBin+i) ); } } } - if ( (unsigned int) rechit.getOOTIndex() < potPlots_[detId_pot].activity_per_bx.size() ) + if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.getOOTIndex() < (int) potPlots_[detId_pot].activity_per_bx.size() ) potPlots_[detId_pot].activity_per_bx.at( rechit.getOOTIndex() )->Fill( event.bunchCrossing() ); } } @@ -683,12 +738,13 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& for ( const auto& track : tracks ) { if ( ! track.isValid() ) continue; + if ( track.getOOTIndex() == CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING ) continue; if ( excludeMultipleHits_ && track.getMultipleHits() > 0 ) continue; if ( potPlots_.find( detId_pot ) == potPlots_.end() ) continue; TH2F *trackHistoOOTTmp = potPlots_[detId_pot].trackDistributionOOT->getTH2F(); TAxis *trackHistoOOTTmpYAxis = trackHistoOOTTmp->GetYaxis(); - int startBin = trackHistoOOTTmpYAxis->FindBin( track.getX0() - track.getX0Sigma() ); + int startBin = trackHistoOOTTmpYAxis->FindBin( track.getX0() - horizontalShiftOfDiamond_ - track.getX0Sigma() ); int numOfBins = 2*track.getX0Sigma()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( track.getOOTIndex(), trackHistoOOTTmpYAxis->GetBinCenter(startBin+i) ); @@ -696,7 +752,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& if ( centralOOT_ != -999 && track.getOOTIndex() == centralOOT_ ) { TH1F *trackHistoInTimeTmp = potPlots_[detId_pot].trackDistribution->getTH1F(); - int startBin = trackHistoInTimeTmp->FindBin( track.getX0() - track.getX0Sigma() ); + int startBin = trackHistoInTimeTmp->FindBin( track.getX0() - horizontalShiftOfDiamond_ - track.getX0Sigma() ); int numOfBins = 2*track.getX0Sigma()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( trackHistoInTimeTmp->GetBinCenter(startBin+i) ); @@ -704,30 +760,78 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& } } } + + // Channel efficiency using CTPPSDiamondLocalTrack + for ( const auto& tracks : *diamondLocalTracks ) { + CTPPSDiamondDetId detId_pot( tracks.detId() ); + detId_pot.setPlane( 0 ); + detId_pot.setChannel( 0 ); + for ( const auto& track : tracks ) { + // Find hits and planes in the track + int numOfHits = 0; + std::set planesInTrackSet; + for ( const auto& vec : *diamondRecHits ) { + const CTPPSDiamondDetId detid( vec.detId() ); + if ( detid.arm() != detId_pot.arm() ) continue; + + for ( const auto& hit : vec ) { + // first check if the hit contributes to the track + if ( track.containsHit(hit) ) { + ++numOfHits; + planesInTrackSet.insert(detid.plane()); + } + } + } + + if ( numOfHits > 0 && numOfHits <= 10 && planesInTrackSet.size() > 2 ) { + for ( int plane=0; plane<4; ++plane ) { + for ( int channel=0; channel<12; ++channel ) { + int map_index = plane*100 + channel; + if ( potPlots_[detId_pot].effDoublecountingChMap.find( map_index ) == potPlots_[detId_pot].effDoublecountingChMap.end() ) { + potPlots_[detId_pot].effTriplecountingChMap[map_index] = 0; + potPlots_[detId_pot].effDoublecountingChMap[map_index] = 0; + } + CTPPSDiamondDetId detId( detId_pot.arm(), CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID, plane, channel); + if ( channelAlignedWithTrack( geometry_.product(), detId, track, 0.1) ) { + // Channel should fire + ++(potPlots_[detId_pot].effDoublecountingChMap[map_index]); + for ( const auto& rechits : *diamondRecHits ) { + CTPPSDiamondDetId detId_hit( rechits.detId() ); + if ( detId_hit == detId ) { + for ( const auto& rechit : rechits ) { + if ( track.containsHit( rechit, 1 ) ) { + // Channel fired + ++(potPlots_[detId_pot].effTriplecountingChMap[map_index]); + } + } + } + } + } + } + } + } + } + } - // Tomography of diamonds using strips + // Tomography of diamonds using pixel for ( const auto& rechits : *diamondRecHits ) { CTPPSDiamondDetId detId_pot( rechits.detId() ); detId_pot.setPlane( 0 ); detId_pot.setChannel( 0 ); const CTPPSDiamondDetId detId( rechits.detId() ); - for ( const auto& rechit : rechits ) { if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue; if ( rechit.getToT() == 0 ) continue; - if ( !stripTracks.isValid() ) continue; + if ( !pixelTracks.isValid() ) continue; if ( potPlots_.find( detId_pot ) == potPlots_.end() ) continue; - for ( const auto& ds : *stripTracks ) { - const CTPPSDetId stripId( ds.detId() ); - for ( const auto& striplt : ds ) { - if ( !striplt.isValid() ) continue; - if ( stripId.arm() != detId_pot.arm() ) continue; - if ( striplt.getTx() > maximumStripAngleForTomography_ || striplt.getTy() > maximumStripAngleForTomography_) continue; - if ( striplt.getTx() < minimumStripAngleForTomography_ || striplt.getTy() < minimumStripAngleForTomography_) continue; - if ( stripId.rp() == CTPPS_FAR_RP_ID ) { - if ( (unsigned int) rechit.getOOTIndex() < potPlots_[detId_pot].stripTomographyAllFar.size() ) - potPlots_[detId_pot].stripTomographyAllFar.at( rechit.getOOTIndex() )->Fill( striplt.getX0() + 25*detId.plane(), striplt.getY0() ); + for ( const auto& ds : *pixelTracks ) { + const CTPPSPixelDetId pixId( ds.detId() ); + if ( pixId.station() != CTPPS_PIXEL_STATION_ID || pixId.rp() != CTPPS_FAR_RP_ID ) continue; + for ( const auto& lt : ds ) { + if ( lt.isValid() && pixId.arm() == detId_pot.arm() ) { + if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.getOOTIndex() - centralOOT_ < (int) potPlots_[detId_pot].pixelTomographyAll.size() && rechit.getOOTIndex() - centralOOT_ >= 0 ) + potPlots_[detId_pot].pixelTomographyAll.at( rechit.getOOTIndex() - centralOOT_ )->Fill( lt.getX0() - horizontalShiftBwDiamondPixels_ + 25*detId.plane(), lt.getY0() ); } } } @@ -795,7 +899,7 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& if ( planePlots_.find( detId_plane ) != planePlots_.end() ) { if ( centralOOT_ != -999 && rechit.getOOTIndex() == centralOOT_ ) { TH1F *hitHistoTmp = planePlots_[detId_plane].hitProfile->getTH1F(); - int startBin = hitHistoTmp->FindBin( rechit.getX() - 0.5*rechit.getXWidth() ); + int startBin = hitHistoTmp->FindBin( rechit.getX() - horizontalShiftOfDiamond_ - 0.5*rechit.getXWidth() ); int numOfBins = rechit.getXWidth()*INV_DISPLAY_RESOLUTION_FOR_HITS_MM; for ( int i=0; iFill( hitHistoTmp->GetBinCenter(startBin+i) ); @@ -804,31 +908,44 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& } } } - - // Tomography of diamonds using strips - for ( const auto& rechits : *diamondRecHits ) { - CTPPSDiamondDetId detId_plane( rechits.detId() ); - detId_plane.setChannel( 0 ); - for ( const auto& rechit : rechits ) { - if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue; - if ( rechit.getToT() == 0 ) continue; - if ( !stripTracks.isValid() ) continue; - if (planePlots_.find(detId_plane) == planePlots_.end()) continue; - - for ( const auto& ds : *stripTracks ) { - const CTPPSDetId stripId(ds.detId()); - for ( const auto& striplt : ds ) { - if (! striplt.isValid()) continue; - if ( stripId.arm() != detId_plane.arm() ) continue; - if ( striplt.getTx() > maximumStripAngleForTomography_ || striplt.getTy() > maximumStripAngleForTomography_) continue; - if ( striplt.getTx() < minimumStripAngleForTomography_ || striplt.getTy() < minimumStripAngleForTomography_) continue; - if ( stripId.rp() == CTPPS_FAR_RP_ID ) { - planePlots_[detId_plane].stripTomography_far->Fill( striplt.getX0() + 25*rechit.getOOTIndex() , striplt.getY0() ); + + + //Tomography of diamonds using pixel and Efficiency WRT Pixels + for ( const auto& ds : *pixelTracks ) { + const CTPPSPixelDetId pixId( ds.detId() ); + if ( pixId.station() != CTPPS_PIXEL_STATION_ID || pixId.rp() != CTPPS_FAR_RP_ID ) continue; + if ( ds.size() > 1 ) continue; + for ( const auto& lt : ds ) { + if ( lt.isValid() ) { + // For efficieny + CTPPSDiamondDetId detId_pot( pixId.arm(), CTPPS_DIAMOND_STATION_ID, CTPPS_DIAMOND_RP_ID ); + potPlots_[detId_pot].pixelTracksMap.Fill( lt.getX0() - horizontalShiftBwDiamondPixels_, lt.getY0() ); + + std::set< CTPPSDiamondDetId > planesWitHits_set; + for ( const auto& rechits : *diamondRecHits ) { + CTPPSDiamondDetId detId_plane( rechits.detId() ); + detId_plane.setChannel( 0 ); + for ( const auto& rechit : rechits ) { + if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue; + if ( rechit.getOOTIndex() == CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING || rechit.getToT() == 0 ) continue; + if ( planePlots_.find(detId_plane) == planePlots_.end() ) continue; + if ( pixId.arm() == detId_plane.arm() ) { + planePlots_[detId_plane].pixelTomography_far->Fill( lt.getX0() - horizontalShiftBwDiamondPixels_ + 25*rechit.getOOTIndex(), lt.getY0() ); + if ( centralOOT_ != -999 && rechit.getOOTIndex() == centralOOT_ ) planesWitHits_set.insert( detId_plane ); + } + } } + + for (auto& planeId : planesWitHits_set) + planePlots_[planeId].pixelTracksMapWithDiamonds.Fill( lt.getX0() - horizontalShiftBwDiamondPixels_, lt.getY0() ); + } + } } + + //------------------------------ // Channel Plots //------------------------------ @@ -886,41 +1003,39 @@ CTPPSDiamondDQMSource::analyze( const edm::Event& event, const edm::EventSetup& for ( const auto& rechit : rechits ) { if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue; if ( channelPlots_.find( detId ) != channelPlots_.end() ) { - if ( rechit.getToT() != 0 ) { + if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.getToT() != 0 ) { channelPlots_[detId].leadingEdgeCumulative_both->Fill( rechit.getT() + 25*rechit.getOOTIndex() ); channelPlots_[detId].TimeOverThresholdCumulativePerChannel->Fill( rechit.getToT() ); } ++(channelPlots_[detId].hitsCounterPerLumisection); } - if ( (unsigned int) rechit.getOOTIndex() < channelPlots_[detId].activity_per_bx.size() ) + if ( rechit.getOOTIndex() != CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING && rechit.getOOTIndex() < (int) channelPlots_[detId].activity_per_bx.size() ) channelPlots_[detId].activity_per_bx.at( rechit.getOOTIndex() )->Fill( event.bunchCrossing() ); } } - // Tomography of diamonds using strips + // Tomography of diamonds using pixel for ( const auto& rechits : *diamondRecHits ) { const CTPPSDiamondDetId detId( rechits.detId() ); for ( const auto& rechit : rechits ) { if ( excludeMultipleHits_ && rechit.getMultipleHits() > 0 ) continue; - if ( stripTracks.isValid() ) { - if (channelPlots_.find(detId) == channelPlots_.end()) continue; - for ( const auto& ds : *stripTracks ) { - for ( const auto& striplt : ds ) { - CTPPSDetId stripId(ds.detId()); - if ( !striplt.isValid() ) continue; - if ( stripId.arm() != detId.arm() ) continue; - if ( striplt.getTx() > maximumStripAngleForTomography_ || striplt.getTy() > maximumStripAngleForTomography_) continue; - if ( striplt.getTx() < minimumStripAngleForTomography_ || striplt.getTy() < minimumStripAngleForTomography_) continue; - if ( stripId.rp() == CTPPS_FAR_RP_ID ) { - channelPlots_[detId].stripTomography_far->Fill( striplt.getX0() + 25*rechit.getOOTIndex(), striplt.getY0() ); - } - } + if ( rechit.getOOTIndex() == CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING || rechit.getToT() == 0 ) continue; + if ( !pixelTracks.isValid() ) continue; + if (channelPlots_.find(detId) == channelPlots_.end()) continue; + + for ( const auto& ds : *pixelTracks ) { + const CTPPSPixelDetId pixId( ds.detId() ); + if ( pixId.station() != CTPPS_PIXEL_STATION_ID || pixId.rp() != CTPPS_FAR_RP_ID ) continue; + for ( const auto& lt : ds ) { + if ( lt.isValid() && pixId.arm() == detId.arm() ) + channelPlots_[detId].pixelTomography_far->Fill( lt.getX0() - horizontalShiftBwDiamondPixels_ + 25*rechit.getOOTIndex(), lt.getY0() ); } } } } + } //---------------------------------------------------------------------------------------------------- @@ -963,6 +1078,32 @@ CTPPSDiamondDQMSource::endLuminosityBlock( const edm::LuminosityBlock&, const ed } + // Efficiencies of single channels + for ( auto& plot : potPlots_ ) { + plot.second.EfficiencyOfChannelsInPot->Reset(); + for ( auto& element : plot.second.effTriplecountingChMap ) { + if ( plot.second.effDoublecountingChMap[ element.first ] > 0) { + int plane = element.first / 100; + int channel = element.first % 100; + double counted = element.second; + double total = plot.second.effDoublecountingChMap[ element.first ]; + double efficiency = counted / total; +// double error = std::sqrt( efficiency * ( 1 - efficiency ) / total ); + + plot.second.EfficiencyOfChannelsInPot->Fill(plane, channel, 100*efficiency); + } + } + } + + // Efficeincy wrt pixels //TODO + for ( auto& plot : planePlots_ ) { + TH2F *hitHistoTmp = plot.second.EfficiencyWRTPixelsInPlane->getTH2F(); + + CTPPSDiamondDetId detId_pot( plot.first ); + detId_pot.setPlane( 0 ); + + hitHistoTmp->Divide( &(plot.second.pixelTracksMapWithDiamonds), &(potPlots_[detId_pot].pixelTracksMap) ); + } } //---------------------------------------------------------------------------------------------------- diff --git a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc index 642b327d1fdbf..c7eef77b14ea6 100644 --- a/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSPixelDQMSource.cc @@ -11,8 +11,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/Run.h" -#include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -55,6 +53,9 @@ class CTPPSPixelDQMSource: public DQMEDAnalyzer static constexpr int NplaneMAX=6; // per RPot static constexpr int NROCsMAX = 6; // per plane static constexpr int RPn_first = 3, RPn_last = 4; + static constexpr int ADCMax = 256; + static constexpr int StationIDMAX=4; // possible range of ID + static constexpr int RPotsIDMAX=8; // possible range of ID const int hitMultMAX = 300; // tuned const int ClusMultMAX = 10; // tuned @@ -67,7 +68,7 @@ class CTPPSPixelDQMSource: public DQMEDAnalyzer static constexpr int NRPotBinsInStation = RPn_last-RPn_first; static constexpr int NPlaneBins = NplaneMAX*NRPotBinsInStation; - MonitorElement *hBX, *hBXshort; + MonitorElement *hBX, *hBXshort, *h2AllPlanesActive; MonitorElement *hp2HitsOcc[NArms][NStationMAX]; MonitorElement *h2HitsMultipl[NArms][NStationMAX]; @@ -88,16 +89,16 @@ class CTPPSPixelDQMSource: public DQMEDAnalyzer MonitorElement *h2xyHits[RPotsTotalNumber][NplaneMAX]; MonitorElement *hp2xyADC[RPotsTotalNumber][NplaneMAX]; MonitorElement *h2xyROCHits[RPotsTotalNumber*NplaneMAX][NROCsMAX]; - MonitorElement *h2xyROCadc[RPotsTotalNumber*NplaneMAX][NROCsMAX]; + MonitorElement *hROCadc[RPotsTotalNumber*NplaneMAX][NROCsMAX]; MonitorElement *hRPotActivBXall[RPotsTotalNumber]; int HitsMultROC[RPotsTotalNumber*NplaneMAX][NROCsMAX]; int HitsMultPlane[RPotsTotalNumber][NplaneMAX]; int ClusMultPlane[RPotsTotalNumber][NplaneMAX]; - unsigned int rpStatusWord = 0x8000; // 220 fr_hr (stn2rp3) - int RPstatus[NStationMAX][NRPotsMAX]; // symmetric in both arms - int StationStatus[NStationMAX]; // symmetric in both arms + unsigned int rpStatusWord = 0x8008; //220_fr_hr(stn2rp3)+ 210_fr_hr + int RPstatus[StationIDMAX][RPotsIDMAX]; // symmetric in both arms + int StationStatus[StationIDMAX]; // symmetric in both arms const int IndexNotValid = 0; int getRPindex(int arm, int station, int rp) { @@ -114,6 +115,15 @@ class CTPPSPixelDQMSource: public DQMEDAnalyzer return(rc*NplaneMAX + plane); } + int getRPInStationBin(int rp) { return(rp - RPn_first +1); } + + + static constexpr int NRPglobalBins = 4; //2 arms w. 2 stations w. 1 RP + int getRPglobalBin(int arm, int stn) { + static constexpr int stationBinOrder[NStationMAX] = {0, 4, 1}; + return( arm*2 + stationBinOrder[stn] +1 ); + } + int prIndex(int rp, int plane) // plane index in station {return((rp - RPn_first)*NplaneMAX + plane);} int getDet(int id) @@ -135,7 +145,7 @@ using namespace edm; CTPPSPixelDQMSource::CTPPSPixelDQMSource(const edm::ParameterSet& ps) : verbosity(ps.getUntrackedParameter("verbosity", 0)), - rpStatusWord(ps.getUntrackedParameter("RPStatusWord",0x8000)) + rpStatusWord(ps.getUntrackedParameter("RPStatusWord",0x8008)) { tokenDigi = consumes >(ps.getParameter("tagRPixDigi")); tokenCluster=consumes>(ps.getParameter("tagRPixCluster")); @@ -160,8 +170,13 @@ void CTPPSPixelDQMSource::dqmBeginRun(edm::Run const &run, edm::EventSetup const ROCSizeInX = pixRowMAX/2; // ROC row size in pixels = 80 ROCSizeInY = pixColMAX/3; + for(int stn=0; stn> 1); RPstatus[stn][rp] = rpSts&1; @@ -183,24 +198,34 @@ edm::EventSetup const &) ibooker.cd(); ibooker.setCurrentFolder("CTPPS/TrackingPixel"); char s[50]; + string armTitleShort, stnTitleShort; hBX = ibooker.book1D("events per BX", "ctpps_pixel;Event.BX", 4002, -1.5, 4000. +0.5); hBXshort = ibooker.book1D("events per BX(short)", "ctpps_pixel;Event.BX", 102, -1.5, 100. + 0.5); + string str1st = "Pixel planes activity"; + h2AllPlanesActive = ibooker.book2DD(str1st,str1st+";Plane #", + NplaneMAX,0,NplaneMAX, NRPglobalBins, 0.5, NRPglobalBins+0.5); + TH2D *h1st = h2AllPlanesActive->getTH2D(); + h1st->SetOption("colz"); + TAxis *yah1st = h1st->GetYaxis(); + for(int arm=0; arm<2; arm++) { CTPPSDetId ID(CTPPSDetId::sdTrackingPixel,arm,0); string sd, armTitle; ID.armName(sd, CTPPSDetId::nPath); ID.armName(armTitle, CTPPSDetId::nFull); + ID.armName(armTitleShort, CTPPSDetId::nShort); ibooker.setCurrentFolder(sd); - for(int stn=2; stngetTH2D(); h->SetOption("colz"); TAxis *yah = h->GetYaxis(); @@ -252,8 +277,10 @@ edm::EventSetup const &) ID.setRP(rp); string rpd, rpTitle; CTPPSDetId(ID.getRPId()).rpName(rpTitle, CTPPSDetId::nShort); - yah->SetBinLabel(rp - RPn_first +1, rpTitle.c_str()); // h - yah2->SetBinLabel(rp - RPn_first +1, rpTitle.c_str()); //h2 + yah->SetBinLabel(getRPInStationBin(rp), rpTitle.c_str()); // h + yah2->SetBinLabel(getRPInStationBin(rp), rpTitle.c_str()); //h2 + string rpBinName = armTitleShort + "_" + stnTitleShort+"_"+rpTitle; + yah1st->SetBinLabel(getRPglobalBin(arm,stn), rpBinName.c_str()); if(RPstatus[stn][rp]==0) continue; int indexP = getRPindex(arm,stn,rp); @@ -338,11 +365,8 @@ edm::EventSetup const &) h2xyROCHits[index][roc]=ibooker.book2DD("hits",st2+";pix col;pix row", ROCSizeInY,0,ROCSizeInY, ROCSizeInX,0,ROCSizeInX); h2xyROCHits[index][roc]->getTH2D()->SetOption("colz"); - - string st = "adc average value"; - h2xyROCadc[index][roc]=ibooker.bookProfile2D(st,st2+";pix col;pix row", - ROCSizeInY,0,ROCSizeInY,ROCSizeInX,0,ROCSizeInX, 0.,512.,""); - h2xyROCadc[index][roc]->getTProfile2D()->SetOption("colz"); + hROCadc[index][roc]=ibooker.book1D("adc value",st2+";ADC;number of ROCs", + ADCMax, 0.,float(ADCMax)); } } // end of for(int p=0; p > pixDigi; @@ -409,14 +432,16 @@ void CTPPSPixelDQMSource::analyze(edm::Event const& event, edm::EventSetup const int arm = theId.arm()&0x1; int station = theId.station()&0x3; int rpot = theId.rp()&0x7; - RPactivity[arm][rpot] = 1; - ++digiSize[arm][rpot]; + int rpInd = getRPindex(arm,station,rpot); + RPactivity[rpInd] = 1; + ++RPdigiSize[rpInd]; if(StationStatus[station] && RPstatus[station][rpot]) { hp2HitsOcc[arm][station]->Fill(plane,rpot,(int)ds_digi.data.size()); h2HitsMultipl[arm][station]->Fill(prIndex(rpot,plane),ds_digi.data.size()); - h2PlaneActive[arm][station]->Fill(plane,rpot); + h2PlaneActive[arm][station]->Fill(plane,getRPInStationBin(rpot)); + h2AllPlanesActive->Fill(plane,getRPglobalBin(arm,station)); int index = getRPindex(arm,station,rpot); HitsMultPlane[index][plane] += ds_digi.data.size(); @@ -439,7 +464,7 @@ void CTPPSPixelDQMSource::analyze(edm::Event const& event, edm::EventSetup const if(!thePixIndices.transformToROC(col,row, trocId, colROC, rowROC)) { if(trocId>=0 && trocIdFill(colROC,rowROC); - h2xyROCadc[rocHistIndex][trocId]->Fill(colROC,rowROC,adc); + hROCadc[rocHistIndex][trocId]->Fill(adc); ++HitsMultROC[rocHistIndex][trocId]; } } @@ -468,6 +493,8 @@ void CTPPSPixelDQMSource::analyze(edm::Event const& event, edm::EventSetup const int station = theId.station()&0x3; int rpot = theId.rp()&0x7; + if((StationStatus[station]==0) || (RPstatus[station][rpot]==0)) continue; + int index = getRPindex(arm,station,rpot); ++ClusMultPlane[index][plane]; @@ -495,7 +522,7 @@ void CTPPSPixelDQMSource::analyze(edm::Event const& event, edm::EventSetup const for(int rp=0; rpFill(prIndex(rp,p),ClusMultPlane[index][p]); @@ -507,7 +534,7 @@ void CTPPSPixelDQMSource::analyze(edm::Event const& event, edm::EventSetup const else hRPotActivPlanes[index]->Fill(p,0.); } if(np>5) hRPotActivBX[index]->Fill(event.bunchCrossing()); - hRPotActivBXall[index]->Fill(event.bunchCrossing(),float(digiSize[arm][rp])); + hRPotActivBXall[index]->Fill(event.bunchCrossing(),float(RPdigiSize[index])); int rocf[NplaneMAX]; for(int r=0; rgetTH1()->SetBit(uint32_t(actualObject + 1) << 20); if(isMap) me->getTH1()->SetBit(0x1 << 19); */ + + // The render plugin requires some metadata in order to set the correct rendering for each plot. + // The original solution was to use bits number 19 to 23 in TH1::fBits, but these were meant for ROOT's internal usage and eventually started breaking things, see: https://github.com/cms-sw/cmssw/issues/21423 + // The current solution is to use the UniqueID field in the parent TObject, which is expected to work if there is no TRef pointing to the TObject. + + // To check that indeed there is no such TRef, one can use TestBit(kIsReferenced), e.g. + // std::cout << "Need to set unique ID at path = " << path << "; for this path, TestBit(kIsReferenced) is: " << (me->getTH1()->TestBit(kIsReferenced)? "true": "false") << std::endl; // should always output false for the solution to work + + // Originally, bit 19 in TH1::fBits was set to isMap, while bits 20-23 contained (actualObject+1). + // The idea is to make sure that both these variables are easily recoverable in the render plugin, + // as in this solution, where isMap is the last bit. + me->getTH1()->SetUniqueID(uint32_t(2*(actualObject + 1) + (isMap? 1: 0))); } if(lumiFlag_) me->setLumiFlag(); diff --git a/DQM/EcalCommon/src/MESetNonObject.cc b/DQM/EcalCommon/src/MESetNonObject.cc index d263268110d86..313b7b995afa8 100644 --- a/DQM/EcalCommon/src/MESetNonObject.cc +++ b/DQM/EcalCommon/src/MESetNonObject.cc @@ -48,7 +48,7 @@ namespace ecaldqm MESetNonObject::clone(std::string const& _path/* = ""*/) const { std::string path(path_); - if(_path != "") path_ = _path; + if(!_path.empty()) path_ = _path; MESet* copy(new MESetNonObject(*this)); path_ = path; return copy; @@ -264,6 +264,13 @@ namespace ecaldqm return mes_[0]->getBinContent(_bin); } + double + MESetNonObject::getFloatValue() const + { + if(kind_ == MonitorElement::DQM_KIND_REAL) return mes_[0]->getFloatValue(); + else return 0.; + } + double MESetNonObject::getBinError(int _bin, int) const { diff --git a/DQM/EcalMonitorClient/interface/PresampleClient.h b/DQM/EcalMonitorClient/interface/PresampleClient.h index f91df947c1f51..d0b557dec50f6 100644 --- a/DQM/EcalMonitorClient/interface/PresampleClient.h +++ b/DQM/EcalMonitorClient/interface/PresampleClient.h @@ -17,7 +17,8 @@ namespace ecaldqm int minChannelEntries_; float expectedMean_; - float toleranceMean_; + float toleranceLow_; + float toleranceHigh_; float toleranceRMS_; float toleranceRMSFwd_; }; diff --git a/DQM/EcalMonitorClient/python/PresampleClient_cfi.py b/DQM/EcalMonitorClient/python/PresampleClient_cfi.py index 440a6c48f9e19..356351f652cb6 100644 --- a/DQM/EcalMonitorClient/python/PresampleClient_cfi.py +++ b/DQM/EcalMonitorClient/python/PresampleClient_cfi.py @@ -5,7 +5,8 @@ minChannelEntries = 6 expectedMean = 200.0 -toleranceMean = 25.0 +toleranceLow = 25.0 +toleranceHigh = 40.0 toleranceRMS = 3.0 toleranceRMSFwd = 6.0 @@ -13,7 +14,8 @@ params = cms.untracked.PSet( minChannelEntries = cms.untracked.int32(minChannelEntries), expectedMean = cms.untracked.double(expectedMean), - toleranceMean = cms.untracked.double(toleranceMean), + toleranceLow = cms.untracked.double(toleranceLow), + toleranceHigh = cms.untracked.double(toleranceHigh), toleranceRMS = cms.untracked.double(toleranceRMS), toleranceRMSFwd = cms.untracked.double(toleranceRMSFwd) ), @@ -84,14 +86,14 @@ kind = cms.untracked.string('TH2F'), otype = cms.untracked.string('Ecal3P'), btype = cms.untracked.string('Crystal'), - description = cms.untracked.string('Summary of the presample data quality. A channel is red if presample mean is off by ' + str(toleranceMean) + ' from ' + str(expectedMean) + ' or RMS is greater than ' + str(toleranceRMS) + '. RMS threshold is ' + str(toleranceRMSFwd) + ' in the forward region (|eta| > 2.1). Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') + description = cms.untracked.string('Summary of the presample data quality. A channel is red if presample mean is outside the range (' + str(expectedMean - toleranceLow) + ', ' + str(expectedMean + toleranceHigh) + '), or RMS is greater than ' + str(toleranceRMS) + '. RMS threshold is ' + str(toleranceRMSFwd) + ' in the forward region (|eta| > 2.1). Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), Quality = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sPedestalOnlineClient/%(prefix)sPOT pedestal quality G12 %(sm)s'), kind = cms.untracked.string('TH2F'), otype = cms.untracked.string('SM'), btype = cms.untracked.string('Crystal'), - description = cms.untracked.string('Summary of the presample data quality. A channel is red if presample mean is off by ' + str(toleranceMean) + ' from ' + str(expectedMean) + ' or RMS is greater than ' + str(toleranceRMS) + '. RMS threshold is ' + str(toleranceRMSFwd) + ' in the forward region (|eta| > 2.1). Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') + description = cms.untracked.string('Summary of the presample data quality. A channel is red if presample mean is outside the range (' + str(expectedMean - toleranceLow) + ', ' + str(expectedMean + toleranceHigh) + '), or RMS is greater than ' + str(toleranceRMS) + '. RMS threshold is ' + str(toleranceRMSFwd) + ' in the forward region (|eta| > 2.1). Channels with entries less than ' + str(minChannelEntries) + ' are not considered.') ), ErrorsSummary = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sSummaryClient/%(prefix)sPOT pedestal quality errors summary G12'), diff --git a/DQM/EcalMonitorClient/python/TrigPrimClient_cfi.py b/DQM/EcalMonitorClient/python/TrigPrimClient_cfi.py index d6a26e1055850..de2a49e0480e5 100644 --- a/DQM/EcalMonitorClient/python/TrigPrimClient_cfi.py +++ b/DQM/EcalMonitorClient/python/TrigPrimClient_cfi.py @@ -17,6 +17,7 @@ TTFlags4 = ecalTrigPrimTask.MEs.TTFlags4, TTMaskMapAll = ecalTrigPrimTask.MEs.TTMaskMapAll, TTFMismatch = ecalTrigPrimTask.MEs.TTFMismatch, + LHCStatusByLumi = ecalTrigPrimTask.MEs.LHCStatusByLumi, TPDigiThrAll = ecalOccupancyTask.MEs.TPDigiThrAll ), MEs = cms.untracked.PSet( diff --git a/DQM/EcalMonitorClient/src/PresampleClient.cc b/DQM/EcalMonitorClient/src/PresampleClient.cc index 32925dd3ed534..ddf50274a1a0d 100644 --- a/DQM/EcalMonitorClient/src/PresampleClient.cc +++ b/DQM/EcalMonitorClient/src/PresampleClient.cc @@ -15,7 +15,8 @@ namespace ecaldqm DQWorkerClient(), minChannelEntries_(0), expectedMean_(0.), - toleranceMean_(0.), + toleranceLow_(0.), + toleranceHigh_(0.), toleranceRMS_(0.), toleranceRMSFwd_(0.) { @@ -28,7 +29,8 @@ namespace ecaldqm { minChannelEntries_ = _params.getUntrackedParameter("minChannelEntries"); expectedMean_ = _params.getUntrackedParameter("expectedMean"); - toleranceMean_ = _params.getUntrackedParameter("toleranceMean"); + toleranceLow_ = _params.getUntrackedParameter("toleranceLow"); + toleranceHigh_ = _params.getUntrackedParameter("toleranceHigh"); toleranceRMS_ = _params.getUntrackedParameter("toleranceRMS"); toleranceRMSFwd_ = _params.getUntrackedParameter("toleranceRMSFwd"); } @@ -93,7 +95,7 @@ namespace ecaldqm meRMSMap.setBinContent(id, rms); meRMSMapAllByLumi.setBinContent(id, rmsLS); - if(std::abs(mean - expectedMean_) > toleranceMean_ || rms > rmsThresh){ + if(((mean > expectedMean_ + toleranceHigh_) || (mean < expectedMean_ - toleranceLow_)) || rms > rmsThresh){ qItr->setBinContent(doMask ? kMBad : kBad); meQualitySummary.setBinContent(id, doMask ? kMBad : kBad); if(!doMask) meErrorsSummary.fill(id); diff --git a/DQM/EcalMonitorClient/src/TrigPrimClient.cc b/DQM/EcalMonitorClient/src/TrigPrimClient.cc index 488d5fab36f8d..3076ef50fe5fb 100644 --- a/DQM/EcalMonitorClient/src/TrigPrimClient.cc +++ b/DQM/EcalMonitorClient/src/TrigPrimClient.cc @@ -1,6 +1,7 @@ #include "../interface/TrigPrimClient.h" #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h" +#include "DQM/EcalCommon/interface/MESetNonObject.h" #include "CondFormats/EcalObjects/interface/EcalDQMStatusHelper.h" @@ -35,12 +36,16 @@ namespace ecaldqm MESet const& sEtEmulError(sources_.at("EtEmulError")); MESet const& sMatchedIndex(sources_.at("MatchedIndex")); MESet const& sTPDigiThrAll(sources_.at("TPDigiThrAll")); + MESetNonObject const& sLHCStatusByLumi(static_cast(sources_.at("LHCStatusByLumi"))); uint32_t mask(1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING); // Store # of entries for Occupancy analysis std::vector Nentries(nDCC,0.); + double currentLHCStatus = sLHCStatusByLumi.getFloatValue(); + bool statsCheckEnabled = ((currentLHCStatus > 10.5 && currentLHCStatus < 11.5) || currentLHCStatus < 0); // currentLHCStatus = -1 is the default when no beam info is available + for(unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; iTT++){ EcalTrigTowerDetId ttid(EcalTrigTowerDetId::detIdFromDenseIndex(iTT)); @@ -158,7 +163,7 @@ namespace ecaldqm rmsFED = rmsFEDEE; } float threshold( meanFED < nRMS*rmsFED ? minEntries_ : meanFED - nRMS*rmsFED ); - if ( meanFED > 100. && Nentries[iDCC] < threshold ) + if ( (meanFED > 100. && Nentries[iDCC] < threshold) && statsCheckEnabled ) meEmulQualitySummary.setBinContent( ttid, meEmulQualitySummary.maskMatches(ttid, mask, statusManager_) ? kMBad : kBad ); } diff --git a/DQM/EcalMonitorTasks/BuildFile.xml b/DQM/EcalMonitorTasks/BuildFile.xml index c9fc5c1c10295..cfbb551e0bbb7 100644 --- a/DQM/EcalMonitorTasks/BuildFile.xml +++ b/DQM/EcalMonitorTasks/BuildFile.xml @@ -7,6 +7,7 @@ + diff --git a/DQM/EcalMonitorTasks/interface/TrigPrimTask.h b/DQM/EcalMonitorTasks/interface/TrigPrimTask.h index cf609af093393..ff395671d2bc5 100644 --- a/DQM/EcalMonitorTasks/interface/TrigPrimTask.h +++ b/DQM/EcalMonitorTasks/interface/TrigPrimTask.h @@ -4,8 +4,12 @@ #include "DQWorkerTask.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" +#include "DataFormats/TCDS/interface/TCDSRecord.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/Utilities/interface/EDGetToken.h" #include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h" #include "CondFormats/EcalObjects/interface/EcalTPGStripStatus.h" @@ -29,6 +33,8 @@ namespace ecaldqm { void runOnEmulTPs(EcalTrigPrimDigiCollection const&); template void runOnDigis(DigiCollection const&); + void setTokens(edm::ConsumesCollector&) override; + enum Constants { nBXBins = 15 }; @@ -53,6 +59,10 @@ namespace ecaldqm { edm::ESHandle TTStatusRcd; edm::ESHandle StripStatusRcd; + edm::InputTag lhcStatusInfoCollectionTag_; + edm::EDGetTokenT lhcStatusInfoRecordToken_; + bool lhcStatusSet_; + }; inline bool TrigPrimTask::analyze(void const* _p, Collections _collection){ diff --git a/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py b/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py index de5c7bc3a46f8..2be326b74bf48 100644 --- a/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py +++ b/DQM/EcalMonitorTasks/python/TrigPrimTask_cfi.py @@ -23,7 +23,8 @@ params = cms.untracked.PSet( # HLTMuonPath = cms.untracked.string('HLT_Mu5_v*'), # HLTCaloPath = cms.untracked.string('HLT_SingleJet*'), - runOnEmul = cms.untracked.bool(True) + runOnEmul = cms.untracked.bool(True), + lhcStatusInfoCollectionTag = cms.untracked.InputTag("tcdsDigis","tcdsRecord") ), MEs = cms.untracked.PSet( LowIntMap = cms.untracked.PSet( @@ -268,6 +269,13 @@ btype = cms.untracked.string('User'), path = cms.untracked.string('%(subdet)s/%(prefix)sTriggerTowerTask/%(prefix)sTTT Real vs Emulated TP Et%(suffix)s'), description = cms.untracked.string('Real data VS emulated TP Et (in-time)') + ), + LHCStatusByLumi = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/LHC status by lumi'), + kind = cms.untracked.string('REAL'), + otype = cms.untracked.string('None'), + btype = cms.untracked.string('User'), + description = cms.untracked.string('LHC Status in this lumisection. The convention for the value is the same as in the plot Info/LhcInfo/beamMode') ) ) ) diff --git a/DQM/EcalMonitorTasks/src/PNDiodeTask.cc b/DQM/EcalMonitorTasks/src/PNDiodeTask.cc index d93a71cc4553f..bbe155c1f2608 100644 --- a/DQM/EcalMonitorTasks/src/PNDiodeTask.cc +++ b/DQM/EcalMonitorTasks/src/PNDiodeTask.cc @@ -1,6 +1,7 @@ #include "../interface/PNDiodeTask.h" #include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" namespace ecaldqm { @@ -59,7 +60,12 @@ namespace ecaldqm { } std::for_each(_ids.begin(), _ids.end(), [&](EcalElectronicsIdCollection::value_type const& id){ - set->fill(EcalElectronicsId(id.dccId(), id.towerId(), 1, id.xtalId())); + if (id.towerId() == 69) { + edm::LogWarning("EcalDQM") << "PNDiodeTask::runOnErrors : one of the ids in the electronics ID collection is unphysical in lumi number " << timestamp_.iLumi << ", event number " << timestamp_.iEvt; // Added March 2018 because some events have this unphysical tower ID and cause the ECAL calibration application to crash. + } + else { + set->fill(EcalElectronicsId(id.dccId(), id.towerId(), 1, id.xtalId())); + } }); } diff --git a/DQM/EcalMonitorTasks/src/TrigPrimTask.cc b/DQM/EcalMonitorTasks/src/TrigPrimTask.cc index b8bb4594fa764..2c6ab6d1f6896 100644 --- a/DQM/EcalMonitorTasks/src/TrigPrimTask.cc +++ b/DQM/EcalMonitorTasks/src/TrigPrimTask.cc @@ -24,7 +24,9 @@ namespace ecaldqm // HLTMuonBit_(false), bxBinEdges_{ {1, 271, 541, 892, 1162, 1432, 1783, 2053, 2323, 2674, 2944, 3214, 3446, 3490, 3491, 3565} }, bxBin_(0.), - towerReadouts_() + towerReadouts_(), + lhcStatusInfoCollectionTag_(), + lhcStatusSet_(false) { } @@ -39,6 +41,7 @@ namespace ecaldqm MEs_.erase(std::string("EtEmulError")); MEs_.erase(std::string("FGEmulError")); } + lhcStatusInfoCollectionTag_ = _params.getUntrackedParameter("lhcStatusInfoCollectionTag", edm::InputTag("tcdsDigis", "tcdsRecord")); } void @@ -62,6 +65,10 @@ namespace ecaldqm { // Reset by LS plots at beginning of every LS MEs_.at("EtSummaryByLumi").reset(); + MEs_.at("LHCStatusByLumi").reset(-1); + + // Reset lhcStatusSet_ to false at the beginning of each LS; when LHC status is set in some event this variable will be set to true + lhcStatusSet_ = false; } void @@ -71,6 +78,17 @@ namespace ecaldqm towerReadouts_.clear(); + if (!lhcStatusSet_) { + // Update LHC status once each LS + MESet& meLHCStatusByLumi(static_cast(MEs_.at("LHCStatusByLumi"))); + edm::Handle tcdsData; + _evt.getByToken(lhcStatusInfoRecordToken_, tcdsData); + if (tcdsData.isValid()) { + meLHCStatusByLumi.fill(double(tcdsData->getBST().getBeamMode())); + lhcStatusSet_ = true; + } + } + realTps_ = nullptr; // HLTCaloBit_ = false; @@ -177,6 +195,12 @@ namespace ecaldqm } } + void + TrigPrimTask::setTokens(edm::ConsumesCollector& _collector) + { + lhcStatusInfoRecordToken_ = _collector.consumes(lhcStatusInfoCollectionTag_); + } + void TrigPrimTask::runOnRealTPs(EcalTrigPrimDigiCollection const& _tps) { diff --git a/DQM/HcalCommon/interface/Constants.h b/DQM/HcalCommon/interface/Constants.h index 88d5a3618f707..21cea096a99a0 100644 --- a/DQM/HcalCommon/interface/Constants.h +++ b/DQM/HcalCommon/interface/Constants.h @@ -180,7 +180,6 @@ namespace hcaldqm int const HF = 4; int const SUBDET_NUM = 4; int const TPSUBDET_NUM = 2; - int const DIGISIZE[SUBDET_NUM] = {10, 10, 10, 3}; std::string const SUBDET_NAME[SUBDET_NUM]={"HB", "HE", "HO", "HF"}; std::string const SUBDETPM_NAME[2*SUBDET_NUM] = { "HBM", "HBP", "HEM", "HEP", "HOM", "HOP", "HFM", "HFP"}; diff --git a/DQM/HcalCommon/interface/ValueQuantity.h b/DQM/HcalCommon/interface/ValueQuantity.h index 335dd9c6b5d51..f18cd49ced849 100644 --- a/DQM/HcalCommon/interface/ValueQuantity.h +++ b/DQM/HcalCommon/interface/ValueQuantity.h @@ -77,10 +77,10 @@ namespace hcaldqm {ffC_1000,"fC (QIE8)"}, {ffC_3000,"fC (QIE8)"}, {ffC_10000,"fC (QIE8)"}, - {fQIE8fC_1000_50,"fC (QIE8)"}, - {fQIE10fC_2000,"fC (QIE10/11)"}, - {fQIE10fC_10000,"fC (QIE10/11)"}, - {fQIE10fC_400000,"fC (QIE10/11)"}, + {fQIE8fC_1000_50,"fC"}, + {fQIE10fC_2000,"fC"}, + {fQIE10fC_10000,"fC"}, + {fQIE10fC_400000,"fC"}, {ffC_generic_10000,"fC (QIE8/10/11)"}, {ffC_generic_400000,"fC (QIE8/10/11)"}, {fTiming_TS,"Timing"}, @@ -112,7 +112,7 @@ namespace hcaldqm {fTime_ns_250,"Time (ns)"}, {fDualAnodeAsymmetry, "(q_{1}-q_{2})/(q_{1}+q_{2})"}, {fTimingRatio, "q_{SOI+1}/q_{SOI}"}, - {fQIE10fC_100000Coarse,"fC (QIE10/11)"}, + {fQIE10fC_100000Coarse,"fC"}, {fBadTDC, "TDC"}, }; const std::map min_value = { @@ -261,7 +261,7 @@ namespace hcaldqm {fQIE10fC_2000,100}, {fQIE10fC_10000,500}, {fQIE8fC_1000_50,50}, - {fTime_ns_250,250}, + {fTime_ns_250,100}, {fADC_256,256}, {ffC_generic_10000,10000}, {ffC_generic_400000,10000}, diff --git a/DQM/HcalTasks/interface/DigiRunSummary.h b/DQM/HcalTasks/interface/DigiRunSummary.h index 4b4e599e21697..aeba451fab92c 100644 --- a/DQM/HcalTasks/interface/DigiRunSummary.h +++ b/DQM/HcalTasks/interface/DigiRunSummary.h @@ -3,6 +3,7 @@ #include "DQM/HcalCommon/interface/DQClient.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" namespace hcaldqm { @@ -38,6 +39,8 @@ namespace hcaldqm ContainerXXX _xDead, _xDigiSize, _xUniHF, _xUni, _xNChs, _xNChsNominal; + std::map _refDigiSize; + // flag enum enum DigiLSFlag { diff --git a/DQM/HcalTasks/interface/DigiTask.h b/DQM/HcalTasks/interface/DigiTask.h index 4a4fb019eb33e..0419140cea16a 100644 --- a/DQM/HcalTasks/interface/DigiTask.h +++ b/DQM/HcalTasks/interface/DigiTask.h @@ -44,15 +44,15 @@ class DigiTask : public hcaldqm::DQTask void _resetMonitors(hcaldqm::UpdateFreq) override; edm::InputTag _tagHBHE; - edm::InputTag _tagHEP17; + edm::InputTag _tagHE; edm::InputTag _tagHO; edm::InputTag _tagHF; edm::EDGetTokenT _tokHBHE; - edm::EDGetTokenT _tokHEP17; + edm::EDGetTokenT _tokHE; edm::EDGetTokenT _tokHO; edm::EDGetTokenT _tokHF; - double _cutSumQ_HBHE, _cutSumQ_HEP17, _cutSumQ_HO, _cutSumQ_HF; + double _cutSumQ_HBHE, _cutSumQ_HE, _cutSumQ_HO, _cutSumQ_HF; double _thresh_unihf; // flag vector @@ -69,6 +69,8 @@ class DigiTask : public hcaldqm::DQTask // hashes/FED vectors std::vector _vhashFEDs; + std::map _refDigiSize; + // emap hcaldqm::electronicsmap::ElectronicsMap _ehashmap; // online only hcaldqm::electronicsmap::ElectronicsMap _dhashmap; @@ -77,8 +79,8 @@ class DigiTask : public hcaldqm::DQTask hcaldqm::filter::HashFilter _filter_VME; hcaldqm::filter::HashFilter _filter_uTCA; hcaldqm::filter::HashFilter _filter_FEDHF; - hcaldqm::filter::HashFilter _filter_HF; - hcaldqm::filter::HashFilter _filter_notHF; + hcaldqm::filter::HashFilter _filter_QIE1011; + hcaldqm::filter::HashFilter _filter_QIE8; hcaldqm::filter::HashFilter _filter_HEP17; /* hcaldqm::Containers */ @@ -91,17 +93,17 @@ class DigiTask : public hcaldqm::DQTask hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM; // online only! // ADC, fC for HF (QIE10 has different ADC/fC) - hcaldqm::Container1D _cADC_SubdetPM_HF; - hcaldqm::Container1D _cfC_SubdetPM_HF; - hcaldqm::Container1D _cSumQ_SubdetPM_HF; - hcaldqm::ContainerProf1D _cSumQvsLS_SubdetPM_HF; - hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM_HF; // online only! + hcaldqm::Container1D _cADC_SubdetPM_QIE1011; + hcaldqm::Container1D _cfC_SubdetPM_QIE1011; + hcaldqm::Container1D _cSumQ_SubdetPM_QIE1011; + hcaldqm::ContainerProf1D _cSumQvsLS_SubdetPM_QIE1011; + hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM_QIE1011; // online only! // Shape - just filling - not summary! hcaldqm::Container1D _cShapeCut_FED; hcaldqm::Container2D _cADCvsTS_SubdetPM; - hcaldqm::Container2D _cADCvsTS_SubdetPM_HF; + hcaldqm::Container2D _cADCvsTS_SubdetPM_QIE1011; // Timing // just filling - no summary! @@ -141,7 +143,7 @@ class DigiTask : public hcaldqm::DQTask hcaldqm::Container2D _cOccupancyCut_depth; hcaldqm::Container1D _cOccupancyCutvsiphi_SubdetPM; // online only hcaldqm::Container1D _cOccupancyCutvsieta_Subdet; // online only - hcaldqm::Container2D _cOccupancyCutvsSlotvsLS_HFPM; // online only + //hcaldqm::Container2D _cOccupancyCutvsSlotvsLS_HFPM; // online only hcaldqm::Container2D _cOccupancyCutvsiphivsLS_SubdetPM; // online only // Occupancy w/o and w/ a Cut vs BX and vs LS @@ -165,14 +167,14 @@ class DigiTask : public hcaldqm::DQTask hcaldqm::Container1D _cLETDCTime_SubdetPM; // Bad TDC histograms - hcaldqm::Container1D _cBadTDCValues_SubdetPM_HF; - hcaldqm::Container1D _cBadTDCvsBX_SubdetPM_HF; - hcaldqm::Container1D _cBadTDCvsLS_SubdetPM_HF; + hcaldqm::Container1D _cBadTDCValues_SubdetPM; + hcaldqm::Container1D _cBadTDCvsBX_SubdetPM; + hcaldqm::Container1D _cBadTDCvsLS_SubdetPM; hcaldqm::Container2D _cBadTDCCount_depth; - hcaldqm::Container1D _cBadTDCValues_SubdetPM_HEP17; - hcaldqm::Container1D _cBadTDCvsBX_SubdetPM_HEP17; - hcaldqm::Container1D _cBadTDCvsLS_SubdetPM_HEP17; + hcaldqm::Container1D _cBadTDCValues; + hcaldqm::Container1D _cBadTDCvsBX; + hcaldqm::Container1D _cBadTDCvsLS; // #events counters MonitorElement *meNumEvents1LS; // to transfer the #events to harvesting diff --git a/DQM/HcalTasks/interface/LEDTask.h b/DQM/HcalTasks/interface/LEDTask.h index 276958047a18e..4211688113ef4 100644 --- a/DQM/HcalTasks/interface/LEDTask.h +++ b/DQM/HcalTasks/interface/LEDTask.h @@ -45,7 +45,7 @@ class LEDTask : public hcaldqm::DQTask // tags and tokens edm::InputTag _tagHBHE; - edm::InputTag _tagHEP17; + edm::InputTag _tagHE; edm::InputTag _tagHO; edm::InputTag _tagHF; edm::InputTag _tagTrigger; diff --git a/DQM/HcalTasks/interface/LaserTask.h b/DQM/HcalTasks/interface/LaserTask.h index 4a8c3b0ae7f58..7cd9af7bc99eb 100644 --- a/DQM/HcalTasks/interface/LaserTask.h +++ b/DQM/HcalTasks/interface/LaserTask.h @@ -50,7 +50,7 @@ class LaserTask : public hcaldqm::DQTask // tags and tokens edm::InputTag _tagHBHE; - edm::InputTag _tagHEP17; + edm::InputTag _tagHE; edm::InputTag _tagHO; edm::InputTag _tagHF; edm::InputTag _taguMN; diff --git a/DQM/HcalTasks/interface/PedestalTask.h b/DQM/HcalTasks/interface/PedestalTask.h index c0d2c96aadd74..51adbd0df7d3c 100644 --- a/DQM/HcalTasks/interface/PedestalTask.h +++ b/DQM/HcalTasks/interface/PedestalTask.h @@ -42,7 +42,7 @@ class PedestalTask : public hcaldqm::DQTask // tags and tokens edm::InputTag _tagHBHE; - edm::InputTag _tagHEP17; + edm::InputTag _tagHE; edm::InputTag _tagHO; edm::InputTag _tagHF; edm::InputTag _tagTrigger; diff --git a/DQM/HcalTasks/plugins/DigiTask.cc b/DQM/HcalTasks/plugins/DigiTask.cc index 4e7d1e9a82638..3a7f18c4fd6ec 100644 --- a/DQM/HcalTasks/plugins/DigiTask.cc +++ b/DQM/HcalTasks/plugins/DigiTask.cc @@ -9,7 +9,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): { _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); - _tagHEP17 = ps.getUntrackedParameter("tagHEP17", + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); @@ -17,12 +17,12 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): edm::InputTag("hcalDigis")); _tokHBHE = consumes(_tagHBHE); - _tokHEP17 = consumes(_tagHEP17); + _tokHE = consumes(_tagHE); _tokHO = consumes(_tagHO); _tokHF = consumes(_tagHF); _cutSumQ_HBHE = ps.getUntrackedParameter("cutSumQ_HBHE", 20); - _cutSumQ_HEP17 = ps.getUntrackedParameter("cutSumQ_HEP17", 20); + _cutSumQ_HE = ps.getUntrackedParameter("cutSumQ_HE", 20); _cutSumQ_HO = ps.getUntrackedParameter("cutSumQ_HO", 20); _cutSumQ_HF = ps.getUntrackedParameter("cutSumQ_HF", 20); _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); @@ -34,6 +34,13 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): _vflags[fUnknownIds]=hcaldqm::flag::Flag("UnknownIds"); _qie10InConditions = ps.getUntrackedParameter("qie10InConditions", true); + + // Get reference digi sizes. Convert from unsigned to signed int, because ::size()/samples() return ints for some reason. + std::vector vrefDigiSize = ps.getUntrackedParameter>("refDigiSize"); + _refDigiSize[HcalBarrel] = (int)vrefDigiSize[0]; + _refDigiSize[HcalEndcap] = (int)vrefDigiSize[1]; + _refDigiSize[HcalOuter] = (int)vrefDigiSize[2]; + _refDigiSize[HcalForward] = (int)vrefDigiSize[3]; } /* virtual */ void DigiTask::bookHistograms(DQMStore::IBooker& ib, @@ -56,20 +63,14 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vuTCA); - // Filters for HEP17 and HF, aka QIE10/11 - std::vector vhashHF; - vhashHF.push_back(hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalForward, 29,1,1))); - _filter_HF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdet, - vhashHF); - _filter_notHF.initialize(filter::fFilter, hcaldqm::hashfunctions::fSubdet, - vhashHF); - - std::vector vhashHEP17; - vhashHEP17.push_back(HcalDetId(HcalEndcap, 1, 63, 1)); - vhashHEP17.push_back(HcalDetId(HcalEndcap, 1, 64, 1)); - vhashHEP17.push_back(HcalDetId(HcalEndcap, 1, 65, 1)); - vhashHEP17.push_back(HcalDetId(HcalEndcap, 1, 66, 1)); - _filter_HEP17.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdetPMiphi, vhashHEP17); + // Filters for QIE8 vs QIE10/11 + std::vector vhashQIE1011; + vhashQIE1011.push_back(hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalEndcap, 20,1,1))); + vhashQIE1011.push_back(hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalForward, 29,1,1))); + _filter_QIE1011.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdet, + vhashQIE1011); + _filter_QIE8.initialize(filter::fFilter, hcaldqm::hashfunctions::fSubdet, + vhashQIE1011); // INITIALIZE FIRST _cADC_SubdetPM.initialize(_name, "ADC", hcaldqm::hashfunctions::fSubdetPM, @@ -90,16 +91,16 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): new hcaldqm::quantity::LumiSection(_maxLS), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),0); - _cADC_SubdetPM_HF.initialize(_name, "ADC", hcaldqm::hashfunctions::fSubdetPM, + _cADC_SubdetPM_QIE1011.initialize(_name, "ADC", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cfC_SubdetPM_HF.initialize(_name, "fC", hcaldqm::hashfunctions::fSubdetPM, + _cfC_SubdetPM_QIE1011.initialize(_name, "fC", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_10000), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSumQ_SubdetPM_HF.initialize(_name, "SumQ", hcaldqm::hashfunctions::fSubdetPM, + _cSumQ_SubdetPM_QIE1011.initialize(_name, "SumQ", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_10000), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSumQvsLS_SubdetPM_HF.initialize(_name, "SumQvsLS", + _cSumQvsLS_SubdetPM_QIE1011.initialize(_name, "SumQvsLS", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::LumiSection(_maxLS), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_10000),0); @@ -150,11 +151,12 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cADCvsTS_SubdetPM_HF.initialize(_name, "ADCvsTS", + _cADCvsTS_SubdetPM_QIE1011.initialize(_name, "ADCvsTS", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); + _cLETDCTimevsADC_SubdetPM.initialize(_name, "LETDCTimevsADC", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), @@ -174,15 +176,16 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCValues_SubdetPM_HF.initialize(_name, "BadTDCValues", + + _cBadTDCValues_SubdetPM.initialize(_name, "BadTDCValues", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBadTDC), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCvsBX_SubdetPM_HF.initialize(_name, "BadTDCvsBX", + _cBadTDCvsBX_SubdetPM.initialize(_name, "BadTDCvsBX", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCvsLS_SubdetPM_HF.initialize(_name, "BadTDCvsLS", + _cBadTDCvsLS_SubdetPM.initialize(_name, "BadTDCvsLS", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::LumiSection(_maxLS), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); @@ -191,18 +194,6 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cBadTDCValues_SubdetPM_HEP17.initialize(_name, "BadTDCValues", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBadTDC), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCvsBX_SubdetPM_HEP17.initialize(_name, "BadTDCvsBX", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCvsLS_SubdetPM_HEP17.initialize(_name, "BadTDCvsLS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); if (_ptype == fOnline || _ptype == fLocal) { _cOccupancy_Crate.initialize(_name, @@ -229,7 +220,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),0); - _cSumQvsBX_SubdetPM_HF.initialize(_name, "SumQvsBX", + _cSumQvsBX_SubdetPM_QIE1011.initialize(_name, "SumQvsBX", hcaldqm::hashfunctions::fSubdetPM, new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_10000),0); @@ -421,18 +412,18 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): char cutstr2[200]; sprintf(cutstr2, "_SumQHF%d", int(_cutSumQ_HF)); - _cADC_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cADC_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); - _cfC_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cfC_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); - _cSumQ_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cSumQ_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); + _cADC_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cADC_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); + _cfC_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cfC_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); + _cSumQ_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cSumQ_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); _cSumQ_depth.book(ib, _emap, _subsystem); - _cSumQvsLS_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cSumQvsLS_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); + _cSumQvsLS_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cSumQvsLS_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); _cDigiSize_Crate.book(ib, _emap, _subsystem); - _cADCvsTS_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cADCvsTS_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); + _cADCvsTS_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cADCvsTS_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); if (_ptype != fOffline) { // hidefed2crate _cShapeCut_FED.book(ib, _emap, _subsystem); @@ -460,17 +451,15 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): _cOccupancy_depth.book(ib, _emap, _subsystem); _cOccupancyCut_depth.book(ib, _emap, _subsystem); - _cLETDCTimevsADC_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); - _cLETDCvsADC_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); - _cLETDCvsTS_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); - _cLETDCTime_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); - _cBadTDCValues_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); - _cBadTDCvsBX_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); - _cBadTDCvsLS_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); - _cBadTDCCount_depth.book(ib, _emap, _filter_HF, _subsystem); - _cBadTDCValues_SubdetPM_HEP17.book(ib, _emap, _filter_HEP17, _subsystem); - _cBadTDCvsBX_SubdetPM_HEP17.book(ib, _emap, _filter_HEP17, _subsystem); - _cBadTDCvsLS_SubdetPM_HEP17.book(ib, _emap, _filter_HEP17, _subsystem); + _cLETDCTimevsADC_SubdetPM.book(ib, _emap, _subsystem); + _cLETDCvsADC_SubdetPM.book(ib, _emap, _subsystem); + _cLETDCvsTS_SubdetPM.book(ib, _emap, _subsystem); + _cLETDCTime_SubdetPM.book(ib, _emap, _subsystem); + + _cBadTDCValues_SubdetPM.book(ib, _emap, _subsystem); + _cBadTDCvsBX_SubdetPM.book(ib, _emap, _subsystem); + _cBadTDCvsLS_SubdetPM.book(ib, _emap, _subsystem); + _cBadTDCCount_depth.book(ib, _emap, _subsystem); // BOOK HISTOGRAMS that are only for Online _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); @@ -484,8 +473,8 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): if (_ptype==fOnline) { _cQ2Q12CutvsLS_FEDHF.book(ib, _emap, _filter_FEDHF, _subsystem); - _cSumQvsBX_SubdetPM.book(ib, _emap, _filter_notHF, _subsystem); - _cSumQvsBX_SubdetPM_HF.book(ib, _emap, _filter_HF, _subsystem); + _cSumQvsBX_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cSumQvsBX_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); _cDigiSizevsLS_FED.book(ib, _emap, _subsystem); _cTimingCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); _cTimingCutvsieta_Subdet.book(ib, _emap, _subsystem); @@ -495,7 +484,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): _cOccupancyvsieta_Subdet.book(ib, _emap, _subsystem); _cOccupancyCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); _cOccupancyCutvsieta_Subdet.book(ib, _emap, _subsystem); -// _cOccupancyCutvsSlotvsLS_HFPM.book(ib, _emap, _filter_HF, _subsystem); +// _cOccupancyCutvsSlotvsLS_HFPM.book(ib, _emap, _filter_QIE1011, _subsystem); _cOccupancyCutvsiphivsLS_SubdetPM.book(ib, _emap, _subsystem); _cSummaryvsLS_FED.book(ib, _emap, _subsystem); _cSummaryvsLS.book(ib, _subsystem); @@ -576,16 +565,16 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): edm::EventSetup const&) { edm::Handle chbhe; - edm::Handle chep17; + edm::Handle che_qie11; edm::Handle cho; edm::Handle chf; if (!e.getByToken(_tokHBHE, chbhe)) _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE.label() + " " + _tagHBHE.instance()); - if (!e.getByToken(_tokHEP17, chep17)) - _logger.dqmthrow("Collection HEP17DigiCollection isn't available" - + _tagHEP17.label() + " " + _tagHEP17.instance()); + if (!e.getByToken(_tokHE, che_qie11)) + _logger.dqmthrow("Collection QIE11DigiCollection isn't available" + + _tagHE.label() + " " + _tagHE.instance()); if (!e.getByToken(_tokHO, cho)) _logger.dqmthrow("Collection HODigiCollection isn't available" + _tagHO.label() + " " + _tagHO.instance()); @@ -613,6 +602,9 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): { // Explicit check on the DetIds present in the Collection HcalDetId const& did = it->id(); + if (did.subdet() != HcalBarrel) { + continue; + } uint32_t rawid = _ehashmap.lookup(did); if (rawid==0) {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} @@ -645,7 +637,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): if (_ptype==fOnline) { _cDigiSizevsLS_FED.fill(eid, _currentLS, it->size()); - it->size()!=constants::DIGISIZE[did.subdet()-1]? + it->size()!=_refDigiSize[did.subdet()]? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; _cOccupancyvsiphi_SubdetPM.fill(did); _cOccupancyvsieta_Subdet.fill(did); @@ -726,15 +718,8 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): did.subdet()==HcalBarrel?numChs++:numChsHE++; } - // HEP17 collection - // The following are filled w.r.t. HBHE digis - // - All eta-phi maps - // - Occupancy in electronics coordinates - // - Digi size - // - // The following are not filled: - // - ADC, fC, sumQ, timing. These are different for QIE11 vs. QIE8. Find them in QIE11Task instead. - for (QIE11DigiCollection::const_iterator it=chep17->begin(); it!=chep17->end(); + // HE QIE11 collection + for (QIE11DigiCollection::const_iterator it=che_qie11->begin(); it!=che_qie11->end(); ++it) { const QIE11DataFrame digi = static_cast(*it); @@ -742,15 +727,21 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): // Explicit check on the DetIds present in the Collection HcalDetId const& did = digi.detid(); uint32_t rawid = _ehashmap.lookup(did); - if (rawid==0) - {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} + if (rawid==0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent=true; + continue; + } HcalElectronicsId const& eid(rawid); - if (did.subdet()==HcalBarrel) // Note: since this is HEP17, we obviously expect did.subdet() always to be HcalEndcap, but QIE11DigiCollection may someday expand. + if (did.subdet() != HcalEndcap) { + continue; + } + if (did.subdet()==HcalBarrel) { // Note: since this is HE, we obviously expect did.subdet() always to be HcalEndcap, but QIE11DigiCollection will have HB for Run 3. rawidHBValid = did.rawId(); - else if (did.subdet()==HcalEndcap) + } else if (did.subdet()==HcalEndcap) { rawidHEValid = did.rawId(); + } - //double sumQ = hcaldqm::utilities::sumQ_v10(digi, 2.5, 0, digi.samples()-1); CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); @@ -764,11 +755,16 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): continue; } + _cSumQ_SubdetPM_QIE1011.fill(did, sumQ); _cOccupancy_depth.fill(did); + if (_ptype == fOnline || _ptype == fLocal) { + _cOccupancy_Crate.fill(eid); + _cOccupancy_CrateSlot.fill(eid); + } if (_ptype==fOnline) { _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples()); - digi.samples()!=constants::DIGISIZE[did.subdet()-1]? + digi.samples()!=_refDigiSize[did.subdet()]? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; _cOccupancyvsiphi_SubdetPM.fill(did); _cOccupancyvsieta_Subdet.fill(did); @@ -794,27 +790,49 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): } } for (int i=0; i(_dbService, digi_fC, did, digi, i); + _cADC_SubdetPM_QIE1011.fill(did, digi[i].adc()); + _cfC_SubdetPM_QIE1011.fill(did, q); + _cLETDCvsADC_SubdetPM.fill(did, digi[i].adc(), digi[i].tdc()); + _cLETDCvsTS_SubdetPM.fill(did, (int)i, digi[i].tdc()); + if (digi[i].tdc() <50) { + double time = i*25. + (digi[i].tdc() / 2.); + _cLETDCTime_SubdetPM.fill(did, time); + _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time); } + // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we saw some in 2017 data. + if ((50 <= digi[i].tdc()) && (digi[i].tdc() <= 61)) { + _cBadTDCValues_SubdetPM.fill(did, digi[i].tdc()); + _cBadTDCvsBX_SubdetPM.fill(did, bx); + _cBadTDCvsLS_SubdetPM.fill(did, _currentLS); + _cBadTDCCount_depth.fill(did); + } + if (_ptype != fOffline) { // hidefed2crate + _cADCvsTS_SubdetPM_QIE1011.fill(did, i, q); + if (sumQ>_cutSumQ_HE) { + _cShapeCut_FED.fill(eid, i, q); + } + } } - if (sumQ>_cutSumQ_HEP17) + if (sumQ>_cutSumQ_HE) { //double timing = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0,digi.samples()-1); double timing = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); - - _cOccupancyCut_depth.fill(did); + _cTimingCut_SubdetPM.fill(did, timing); _cTimingCut_depth.fill(did, timing); + _cOccupancyCut_depth.fill(did); + _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } _cSumQ_depth.fill(did, sumQ); + _cSumQvsLS_SubdetPM_QIE1011.fill(did, _currentLS, sumQ); if (_ptype==fOnline) { + _cSumQvsBX_SubdetPM_QIE1011.fill(did, bx, sumQ); + _cTimingCutvsiphi_SubdetPM.fill(did, timing); + _cTimingCutvsieta_Subdet.fill(did, timing); _cOccupancyCutvsiphi_SubdetPM.fill(did); _cOccupancyCutvsieta_Subdet.fill(did); _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); @@ -822,11 +840,15 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): if (_ptype != fOffline) { // hidefed2crate if (eid.isVMEid()) { + _cTimingCut_FEDVME.fill(eid, timing); + _cTimingCut_ElectronicsVME.fill(eid, timing); _cOccupancyCut_FEDVME.fill(eid); _cOccupancyCut_ElectronicsVME.fill(eid); } else { + _cTimingCut_FEDuTCA.fill(eid, timing); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); _cOccupancyCut_FEDuTCA.fill(eid); _cOccupancyCut_ElectronicsuTCA.fill(eid); } @@ -895,7 +917,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): if (_ptype==fOnline) { _cDigiSizevsLS_FED.fill(eid, _currentLS, it->size()); - it->size()!=constants::DIGISIZE[did.subdet()-1]? + it->size()!=_refDigiSize[did.subdet()]? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; _cOccupancyvsiphi_SubdetPM.fill(did); _cOccupancyvsieta_Subdet.fill(did); @@ -1031,15 +1053,15 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): cs.isBitSet(HcalChannelStatus::HcalCellDead)) continue; } - if (!_filter_HF.filter(did)) { - _cSumQ_SubdetPM_HF.fill(did, sumQ); - } + //if (!_filter_QIE1011.filter(did)) { + _cSumQ_SubdetPM_QIE1011.fill(did, sumQ); + //} _cOccupancy_depth.fill(did); if (_ptype==fOnline) { _xNChs.get(eid)++; _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples()); - digi.samples()!=constants::DIGISIZE[did.subdet()-1]? + digi.samples()!=_refDigiSize[did.subdet()]? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; _cOccupancyvsiphi_SubdetPM.fill(did); _cOccupancyvsieta_Subdet.fill(did); @@ -1068,31 +1090,30 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): for (int i=0; i(_dbService, digi_fC, did, digi, i); - if (!_filter_HF.filter(did)) { - _cADC_SubdetPM_HF.fill(did, digi[i].adc()); - _cfC_SubdetPM_HF.fill(did, q); - _cLETDCvsADC_SubdetPM.fill(did, digi[i].adc(), digi[i].le_tdc()); - _cLETDCvsTS_SubdetPM.fill(did, (int)i, digi[i].le_tdc()); - if (digi[i].le_tdc() <50) { - double time = i*25. + (digi[i].le_tdc() / 2.); - _cLETDCTime_SubdetPM.fill(did, time); - _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time); - } - - // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we are seeing some in 2017 data. - if ((50 <= digi[i].le_tdc()) && (digi[i].le_tdc() <= 61)) { - _cBadTDCValues_SubdetPM_HF.fill(did, digi[i].le_tdc()); - _cBadTDCvsBX_SubdetPM_HF.fill(did, bx); - _cBadTDCvsLS_SubdetPM_HF.fill(did, _currentLS); - _cBadTDCCount_depth.fill(did); - } + //if (!_filter_QIE1011.filter(did)) { + _cADC_SubdetPM_QIE1011.fill(did, digi[i].adc()); + _cfC_SubdetPM_QIE1011.fill(did, q); + _cLETDCvsADC_SubdetPM.fill(did, digi[i].adc(), digi[i].le_tdc()); + _cLETDCvsTS_SubdetPM.fill(did, (int)i, digi[i].le_tdc()); + if (digi[i].le_tdc() <50) { + double time = i*25. + (digi[i].le_tdc() / 2.); + _cLETDCTime_SubdetPM.fill(did, time); + _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time); } + // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we are seeing some in 2017 data. + if ((50 <= digi[i].le_tdc()) && (digi[i].le_tdc() <= 61)) { + _cBadTDCValues_SubdetPM.fill(did, digi[i].le_tdc()); + _cBadTDCvsBX_SubdetPM.fill(did, bx); + _cBadTDCvsLS_SubdetPM.fill(did, _currentLS); + _cBadTDCCount_depth.fill(did); + } if (_ptype != fOffline) { // hidefed2crate - _cADCvsTS_SubdetPM_HF.fill(did, (int)i, q); + _cADCvsTS_SubdetPM_QIE1011.fill(did, (int)i, q); if (sumQ>_cutSumQ_HF) _cShapeCut_FED.fill(eid, (int)i, q); } + //} } if (sumQ>_cutSumQ_HF) @@ -1103,14 +1124,17 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): double q2 = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, 2); double q2q12 = q2/(q1+q2); _cSumQ_depth.fill(did, sumQ); - if (!_filter_HF.filter(did)) { - _cSumQvsLS_SubdetPM_HF.fill(did, _currentLS, sumQ); - } + //if (!_filter_QIE1011.filter(did)) { + _cSumQvsLS_SubdetPM_QIE1011.fill(did, _currentLS, sumQ); + //} + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCut_depth.fill(did, timing); + _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); if (_ptype==fOnline) { - if (!_filter_HF.filter(did)) { - _cSumQvsBX_SubdetPM_HF.fill(did, bx, sumQ); - } + //if (!_filter_QIE1011.filter(did)) { + _cSumQvsBX_SubdetPM_QIE1011.fill(did, bx, sumQ); + //} _cTimingCutvsiphi_SubdetPM.fill(did, timing); _cTimingCutvsieta_Subdet.fill(did, timing); _cOccupancyCutvsiphi_SubdetPM.fill(did); @@ -1119,9 +1143,6 @@ DigiTask::DigiTask(edm::ParameterSet const& ps): // _cOccupancyCutvsSlotvsLS_HFPM.fill(did, _currentLS); _xUniHF.get(eid)++; } - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCut_depth.fill(did, timing); - _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); if (_ptype != fOffline) { // hidefed2crate _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); } diff --git a/DQM/HcalTasks/plugins/LEDTask.cc b/DQM/HcalTasks/plugins/LEDTask.cc index 3b3bdca70deed..0ff2f64f95dae 100644 --- a/DQM/HcalTasks/plugins/LEDTask.cc +++ b/DQM/HcalTasks/plugins/LEDTask.cc @@ -10,7 +10,7 @@ LEDTask::LEDTask(edm::ParameterSet const& ps): // tags _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); - _tagHEP17 = ps.getUntrackedParameter("tagHEP17", + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); @@ -19,7 +19,7 @@ LEDTask::LEDTask(edm::ParameterSet const& ps): _tagTrigger = ps.getUntrackedParameter("tagTrigger", edm::InputTag("tbunpacker")); _tokHBHE = consumes(_tagHBHE); - _tokHEP17 = consumes(_tagHEP17); + _tokHEP17 = consumes(_tagHE); _tokHO = consumes(_tagHO); _tokHF = consumes(_tagHF); _tokTrigger = consumes(_tagTrigger); @@ -306,7 +306,7 @@ LEDTask::LEDTask(edm::ParameterSet const& ps): + _tagHF.label() + " " + _tagHF.instance()); if (!e.getByToken(_tokHEP17, chep17)) _logger.dqmthrow("Collection QIE11DigiCollection isn't available " - + _tagHEP17.label() + " " + _tagHEP17.instance()); + + _tagHE.label() + " " + _tagHE.instance()); // int currentEvent = e.eventAuxiliary().id().event(); diff --git a/DQM/HcalTasks/plugins/LaserTask.cc b/DQM/HcalTasks/plugins/LaserTask.cc index cbaec5ac7daf4..3226a20580273 100644 --- a/DQM/HcalTasks/plugins/LaserTask.cc +++ b/DQM/HcalTasks/plugins/LaserTask.cc @@ -12,7 +12,7 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): // tags _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); - _tagHEP17 = ps.getUntrackedParameter("tagHEP17", + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); @@ -21,7 +21,7 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); _tokHBHE = consumes(_tagHBHE); - _tokHEP17 = consumes(_tagHEP17); + _tokHEP17 = consumes(_tagHE); _tokHO = consumes(_tagHO); _tokHF = consumes(_tagHF); _tokuMN = consumes(_taguMN); @@ -66,7 +66,7 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): // INITIALIZE _cSignalMean_Subdet.initialize(_name, "SignalMean", hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); _cSignalRMS_Subdet.initialize(_name, "SignalRMS", hcaldqm::hashfunctions::fSubdet, @@ -91,12 +91,12 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): hcaldqm::hashfunctions::fFED, new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse),0); _cSignalMean_FEDuTCA.initialize(_name, "SignalMean", hcaldqm::hashfunctions::fFED, new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse),0); _cSignalRMS_FEDVME.initialize(_name, "SignalRMS", hcaldqm::hashfunctions::fFED, new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), @@ -162,7 +162,7 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): hcaldqm::hashfunctions::fdepth, new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse),0); _cSignalRMS_depth.initialize(_name, "SignalRMS", hcaldqm::hashfunctions::fdepth, new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), @@ -293,11 +293,6 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): HcalDetId did = HcalDetId(it->rawId()); HcalElectronicsId eid(_ehashmap.lookup(*it)); int n = _xEntries.get(did); - double msig = _xSignalSum.get(did)/n; - double mtim = _xTimingSum.get(did)/n; - double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig); - double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim); - // channels missing or low signal if (n==0) { @@ -310,6 +305,12 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): } continue; } + + double msig = _xSignalSum.get(did)/n; + double mtim = _xTimingSum.get(did)/n; + double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig); + double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim); + _cSignalMean_Subdet.fill(did, msig); _cSignalMean_depth.fill(did, msig); _cSignalRMS_Subdet.fill(did, rsig); @@ -350,7 +351,7 @@ LaserTask::LaserTask(edm::ParameterSet const& ps): + _tagHBHE.label() + " " + _tagHBHE.instance()); if (!e.getByToken(_tokHEP17, chep17)) _logger.dqmthrow("Collection QIE11DigiCollection isn't available " - + _tagHEP17.label() + " " + _tagHEP17.instance()); + + _tagHE.label() + " " + _tagHE.instance()); if (!e.getByToken(_tokHO, cho)) _logger.dqmthrow("Collection HODigiCollection isn't available " + _tagHO.label() + " " + _tagHO.instance()); diff --git a/DQM/HcalTasks/plugins/PedestalTask.cc b/DQM/HcalTasks/plugins/PedestalTask.cc index 4dfb1abb7e6a3..2add7f03ce4c7 100644 --- a/DQM/HcalTasks/plugins/PedestalTask.cc +++ b/DQM/HcalTasks/plugins/PedestalTask.cc @@ -9,7 +9,7 @@ PedestalTask::PedestalTask(edm::ParameterSet const& ps): // tags _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); - _tagHEP17 = ps.getUntrackedParameter("tagHEP17", + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); @@ -20,7 +20,7 @@ PedestalTask::PedestalTask(edm::ParameterSet const& ps): _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); _tokHBHE = consumes(_tagHBHE); - _tokHEP17 = consumes(_tagHEP17); + _tokHEP17 = consumes(_tagHE); _tokHO = consumes(_tagHO); _tokHF = consumes(_tagHF); _tokTrigger = consumes(_tagTrigger); @@ -859,7 +859,7 @@ PedestalTask::PedestalTask(edm::ParameterSet const& ps): + _tagHF.label() + " " + _tagHF.instance()); if (!e.getByToken(_tokHEP17, chep17)) _logger.dqmthrow("Collection QIE11DigiCollection isn't available" - + _tagHEP17.label() + " " + _tagHEP17.instance()); + + _tagHE.label() + " " + _tagHE.instance()); int nHB(0), nHE(0), nHO(0), nHF(0); for (HBHEDigiCollection::const_iterator it=chbhe->begin(); diff --git a/DQM/HcalTasks/python/DigiTask.py b/DQM/HcalTasks/python/DigiTask.py index 965295135be1e..64da293db57bc 100644 --- a/DQM/HcalTasks/python/DigiTask.py +++ b/DQM/HcalTasks/python/DigiTask.py @@ -27,7 +27,15 @@ thresh_unifh = cms.untracked.double(0.2), qie10InConditions = cms.untracked.bool(False), + + # Reference digi sizes + refDigiSize = cms.untracked.vuint32(10, 10, 10, 4), # HB, HE, HO, HF ) from Configuration.Eras.Modifier_run2_HF_2017_cff import run2_HF_2017 run2_HF_2017.toModify(digiTask, qie10InConditions=cms.untracked.bool(True)) +run2_HF_2017.toModify(digiTask, refDigiSize=cms.untracked.vuint32(10, 10, 10, 3)) + +from Configuration.Eras.Modifier_run2_HCAL_2018_cff import run2_HCAL_2018 +run2_HCAL_2018.toModify(digiTask, qie10InConditions=cms.untracked.bool(True)) +run2_HCAL_2018.toModify(digiTask, refDigiSize=cms.untracked.vuint32(8, 8, 10, 3)) diff --git a/DQM/HcalTasks/python/HcalOfflineHarvesting.py b/DQM/HcalTasks/python/HcalOfflineHarvesting.py index 71acca2d1dd0a..089b59d70bcd9 100644 --- a/DQM/HcalTasks/python/HcalOfflineHarvesting.py +++ b/DQM/HcalTasks/python/HcalOfflineHarvesting.py @@ -1,5 +1,6 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +from DQM.HcalTasks.DigiTask import digiTask hcalOfflineHarvesting = DQMEDHarvester( "HcalOfflineHarvesting", @@ -17,5 +18,6 @@ thresh_FGMsmRate_high = cms.untracked.double(0.2), thresh_FGMsmRate_low = cms.untracked.double(0.1), thresh_unihf = cms.untracked.double(0.2), - thresh_tcds = cms.untracked.double(1.5) + thresh_tcds = cms.untracked.double(1.5), + refDigiSize = digiTask.refDigiSize, ) diff --git a/DQM/HcalTasks/python/HcalOnlineHarvesting.py b/DQM/HcalTasks/python/HcalOnlineHarvesting.py index 58b217ee8f9cd..a2f0c6b56ecfb 100644 --- a/DQM/HcalTasks/python/HcalOnlineHarvesting.py +++ b/DQM/HcalTasks/python/HcalOnlineHarvesting.py @@ -1,5 +1,6 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +from DQM.HcalTasks.DigiTask import digiTask hcalOnlineHarvesting = DQMEDHarvester( "HcalOnlineHarvesting", @@ -11,4 +12,5 @@ ptype = cms.untracked.int32(0), mtype = cms.untracked.bool(True), subsystem = cms.untracked.string("Hcal"), + refDigiSize = digiTask.refDigiSize, ) diff --git a/DQM/HcalTasks/src/DigiRunSummary.cc b/DQM/HcalTasks/src/DigiRunSummary.cc index 16032b0b025eb..6d1bd7639138f 100644 --- a/DQM/HcalTasks/src/DigiRunSummary.cc +++ b/DQM/HcalTasks/src/DigiRunSummary.cc @@ -8,6 +8,12 @@ namespace hcaldqm { _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); + + std::vector vrefDigiSize = ps.getUntrackedParameter>("refDigiSize"); + _refDigiSize[HcalBarrel] = vrefDigiSize[0]; + _refDigiSize[HcalEndcap] = vrefDigiSize[1]; + _refDigiSize[HcalOuter] = vrefDigiSize[2]; + _refDigiSize[HcalForward] = vrefDigiSize[3]; } /* virtual */ void DigiRunSummary::beginRun(edm::Run const& r, @@ -140,7 +146,7 @@ namespace hcaldqm _cOccupancy_depth.fill(did, cOccupancy_depth.getBinContent(did)); // digi size cDigiSize_Crate.getMean(eid)!= - constants::DIGISIZE[did.subdet()-1]? + _refDigiSize[did.subdet()]? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; cDigiSize_Crate.getRMS(eid)!=0? _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; diff --git a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py index b9d33a3cde290..bb9fd37b202e5 100644 --- a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -process = cms.Process("BeamMonitor", eras.Run2_2017) +process = cms.Process("BeamMonitor", eras.Run2_2018) #---------------------------------------------- # Switch to change between firstStep and Pixel @@ -131,7 +131,6 @@ minLayers = cms.vint32( 0, 2, 3 ) ), ignoreVertices = cms.bool( True ), - GBRForestFileName = cms.string( "" ) ) process.pixelTracksHP = cms.EDProducer( "TrackCollectionFilterCloner", minQuality = cms.string( "highPurity" ), diff --git a/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py index 613a9b5aee636..c4c3e0c82b562 100755 --- a/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -process = cms.Process("BeamMonitor", eras.Run2_2017) +process = cms.Process("BeamMonitor", eras.Run2_2018) # Message logger #process.load("FWCore.MessageLogger.MessageLogger_cfi") diff --git a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py index 01c407a6810b0..422e28c40a4bf 100644 --- a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -process = cms.Process("BeamPixel", eras.Run2_2017) +process = cms.Process("BeamPixel", eras.Run2_2018) #---------------------------- @@ -59,9 +59,9 @@ #---------------------------- from DQM.Integration.config.online_customizations_cfi import * process = customise(process) - from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer + #---------------------------- # Proton-Proton Specific Part #---------------------------- @@ -128,15 +128,13 @@ from RecoPixelVertexing.PixelLowPtUtilities.siPixelClusterShapeCache_cfi import * process.siPixelClusterShapeCachePreSplitting = siPixelClusterShapeCache.clone(src = 'siPixelClustersPreSplitting') process.load("RecoLocalTracker.SiPixelRecHits.PixelCPEGeneric_cfi") - process.load("RecoPixelVertexing.PixelTrackFitting.PixelTracks_2017_cff") - process.load("RecoVertex.PrimaryVertexProducer.OfflinePixel3DPrimaryVertices_cfi") - process.recopixelvertexing = cms.Sequence(process.pixelTracksSequence + process.pixelVertices) + process.load("RecoPixelVertexing.Configuration.RecoPixelVertexing_cff") process.pixelVertices.TkFilterParameters.minPt = process.pixelTracksTrackingRegions.RegionPSet.ptMin - process.pixelTracksTrackingRegions.RegionPSet.originRadius = 0.4 - process.pixelTracksTrackingRegions.RegionPSet.originHalfLength = 6 - process.pixelTracksTrackingRegions.RegionPSet.originXPos = 0.08 - process.pixelTracksTrackingRegions.RegionPSet.originYPos = -0.03 - process.pixelTracksTrackingRegions.RegionPSet.originZPos = 1 + process.pixelTracksTrackingRegions.RegionPSet.originRadius = 0.4 + process.pixelTracksTrackingRegions.RegionPSet.originHalfLength = 15. + process.pixelTracksTrackingRegions.RegionPSet.originXPos = 0.08 + process.pixelTracksTrackingRegions.RegionPSet.originYPos = -0.03 + process.pixelTracksTrackingRegions.RegionPSet.originZPos = 0. #---------------------------- diff --git a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py index 13012338c7647..a069b26f4a38b 100644 --- a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py @@ -1,5 +1,6 @@ ### AUTO-GENERATED CMSRUN CONFIGURATION FOR ECAL DQM ### import FWCore.ParameterSet.Config as cms +from EventFilter.Utilities.tcdsRawToDigi_cfi import * # To monitor LHC status, e.g. to mask trigger primitives quality alarm during Cosmics process = cms.Process("process") @@ -92,6 +93,9 @@ process.preScaler.prescaleFactor = 1 +process.tcdsDigis = tcdsRawToDigi.clone() +process.tcdsDigis.InputLabel = cms.InputTag("rawDataCollector") + process.DQMStore.referenceFileName = "/dqmdata/dqm/reference/ecal_reference.root" process.dqmEnv.subSystemFolder = cms.untracked.string('Ecal') @@ -122,7 +126,7 @@ ### Paths ### -process.ecalMonitorPath = cms.Path(process.preScaler+process.ecalPreRecoSequence+process.ecalPhysicsFilter+process.ecalRecoSequence+process.ecalMonitorTask) +process.ecalMonitorPath = cms.Path(process.preScaler+process.ecalPreRecoSequence+process.ecalPhysicsFilter+process.ecalRecoSequence+process.tcdsDigis+process.ecalMonitorTask) process.ecalClientPath = cms.Path(process.preScaler+process.ecalPreRecoSequence+process.ecalPhysicsFilter+process.ecalMonitorClient) process.dqmEndPath = cms.EndPath(process.dqmEnv) diff --git a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py index 791e42e1cdaa8..9aa9d9c373b70 100644 --- a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py @@ -29,9 +29,9 @@ folder_name = 'FEDIntegrity_EvF' # L1T sequence: -process.load('DQM.L1TMonitor.L1TFED_cfi') +process.load('DQM.L1TMonitor.L1TStage2FED_cff') # stage2 L1T path = 'L1T/%s/' % folder_name -process.l1tfed.FEDDirName = cms.untracked.string(path) +process.l1tStage2Fed.FEDDirName = cms.untracked.string(path) # Pixel sequence: process.load('Configuration.StandardSequences.MagneticField_cff') process.load('EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi') @@ -80,7 +80,7 @@ # Setting raw data collection label for all subsytem modules, depending on run type: if (process.runType.getRunType() == process.runType.hi_run): - process.l1tfed.rawTag = cms.InputTag('rawDataRepacker') + process.l1tStage2Fed.rawTag = cms.InputTag('rawDataRepacker') process.siPixelDigis.InputLabel = cms.InputTag('rawDataRepacker') process.SiPixelHLTSource.RawInput = cms.InputTag('rawDataRepacker') process.siStripFEDCheck.RawDataTag = cms.InputTag('rawDataRepacker') @@ -93,7 +93,7 @@ process.rpcunpacker.InputLabel = cms.InputTag('rawDataRepacker') process.cscDQMEvF.InputObjects = cms.untracked.InputTag('rawDataRepacker') else: - process.l1tfed.rawTag = cms.InputTag('rawDataCollector') + process.l1tStage2Fed.rawTag = cms.InputTag('rawDataCollector') process.siPixelDigis.InputLabel = cms.InputTag('rawDataCollector') process.SiPixelHLTSource.RawInput = cms.InputTag('rawDataCollector') process.siStripFEDCheck.RawDataTag = cms.InputTag('rawDataCollector') @@ -114,7 +114,7 @@ # Modules for the FED process.FEDModulesPath = cms.Path( - process.l1tfed + process.l1tStage2Fed + process.siPixelDigis + process.SiPixelHLTSource + process.siStripFEDCheck diff --git a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py index 118cf46fdb94d..f8615e7a49b14 100644 --- a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py @@ -118,7 +118,7 @@ process.load('DQM.HcalTasks.RawTask') process.load('DQM.HcalTasks.NoCQTask') #process.load('DQM.HcalTasks.ZDCTask') -process.load('DQM.HcalTasks.QIE11Task') +#process.load('DQM.HcalTasks.QIE11Task') # 2018: integrate QIE11Task into DigiTask process.load('DQM.HcalTasks.HcalOnlineHarvesting') #------------------------------------- @@ -154,9 +154,9 @@ #process.zdcTask.runkeyVal = runType #process.zdcTask.runkeyName = runTypeName #process.zdcTask.tagQIE10 = cms.untracked.InputTag("castorDigis") -process.qie11Task.runkeyVal = runType -process.qie11Task.runkeyName = runTypeName -process.qie11Task.tagQIE11 = cms.untracked.InputTag("hcalDigis") +#process.qie11Task.runkeyVal = runType +#process.qie11Task.runkeyName = runTypeName +#process.qie11Task.tagQIE11 = cms.untracked.InputTag("hcalDigis") #------------------------------------- # Hcal DQM Tasks/Clients Sequences Definition @@ -166,7 +166,7 @@ +process.digiTask +process.tpTask +process.nocqTask - +process.qie11Task + #+process.qie11Task #ZDC to be removed for 2017 pp running #+process.zdcTask ) diff --git a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py index dfd1c78c14049..68d90b5c0fa70 100644 --- a/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/hlt_dqm_sourceclient-live_cfg.py @@ -22,6 +22,13 @@ process.load("Configuration.StandardSequences.GeometryRecoDB_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.GlobalTrackingGeometryESProducer = cms.ESProducer( "GlobalTrackingGeometryESProducer" ) # for muon hlt dqm +process.HLTSiStripClusterChargeCutNone = cms.PSet( value = cms.double( -1.0 ) ) +process.ClusterShapeHitFilterESProducer = cms.ESProducer( "ClusterShapeHitFilterESProducer", + ComponentName = cms.string( "ClusterShapeHitFilter" ), + PixelShapeFileL1 = cms.string( "RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase1_loose.par" ), + clusterChargeCut = cms.PSet( refToPSet_ = cms.string( "HLTSiStripClusterChargeCutNone" ) ), + PixelShapeFile = cms.string( "RecoPixelVertexing/PixelLowPtUtilities/data/pixelShapePhase1_noL1.par" ) +) #SiStrip Local Reco process.load("CalibTracker.SiStripCommon.TkDetMap_cff") diff --git a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py index ee354984be30b..80fd32375beb7 100644 --- a/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py +++ b/DQM/Integration/python/clients/visualization-live-secondInstance_cfg.py @@ -74,7 +74,6 @@ process.FEVToutput = cms.OutputModule("JsonWritingTimeoutPoolOutputModule", splitLevel = oldo.splitLevel, - eventAutoFlushCompressedSize = oldo.eventAutoFlushCompressedSize, outputCommands = oldo.outputCommands, fileName = oldo.fileName, dataset = oldo.dataset, diff --git a/DQM/Integration/python/clients/visualization-live_cfg.py b/DQM/Integration/python/clients/visualization-live_cfg.py index 665a6d453bb66..a531379fc563a 100644 --- a/DQM/Integration/python/clients/visualization-live_cfg.py +++ b/DQM/Integration/python/clients/visualization-live_cfg.py @@ -74,7 +74,6 @@ process.FEVToutput = cms.OutputModule("JsonWritingTimeoutPoolOutputModule", splitLevel = oldo.splitLevel, - eventAutoFlushCompressedSize = oldo.eventAutoFlushCompressedSize, outputCommands = oldo.outputCommands, fileName = oldo.fileName, dataset = oldo.dataset, diff --git a/DQM/Integration/python/config/FrontierCondition_GT_autoExpress_cfi.py b/DQM/Integration/python/config/FrontierCondition_GT_autoExpress_cfi.py index b27f926db6a95..f79273188ff41 100644 --- a/DQM/Integration/python/config/FrontierCondition_GT_autoExpress_cfi.py +++ b/DQM/Integration/python/config/FrontierCondition_GT_autoExpress_cfi.py @@ -6,7 +6,7 @@ # It should be kept in synch with Express processing at Tier0: what the url # https://cmsweb.cern.ch/t0wmadatasvc/prod/express_config # would tell you. -GlobalTag.globaltag = "100X_dataRun2_Express_v1" +GlobalTag.globaltag = "101X_dataRun2_Express_v7" # ===== auto -> Automatically get the GT string from current Tier0 configuration via a Tier0Das call. # This needs a valid proxy to access the cern.ch network from the .cms one. diff --git a/DQM/Integration/python/config/FrontierCondition_GT_cfi.py b/DQM/Integration/python/config/FrontierCondition_GT_cfi.py index 48ba0a7b62072..d48d1bb5e4005 100644 --- a/DQM/Integration/python/config/FrontierCondition_GT_cfi.py +++ b/DQM/Integration/python/config/FrontierCondition_GT_cfi.py @@ -1,3 +1,3 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.FrontierConditions_GlobalTag_cff import * -GlobalTag.globaltag = "100X_dataRun2_HLT_v3" +GlobalTag.globaltag = "101X_dataRun2_HLT_v7" diff --git a/DQM/L1TMonitor/interface/L1TdeStage2uGT.h b/DQM/L1TMonitor/interface/L1TdeStage2uGT.h new file mode 100644 index 0000000000000..11f2b9e34094b --- /dev/null +++ b/DQM/L1TMonitor/interface/L1TdeStage2uGT.h @@ -0,0 +1,82 @@ +#ifndef L1TdeStage2uGT_H +#define L1TdeStage2uGT_H + +// system include files +#include +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +// #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/LuminosityBlock.h" + +#include "DQMServices/Core/interface/MonitorElement.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" + +#include "DataFormats/L1TGlobal/interface/GlobalAlgBlk.h" +// #include "DataFormats/Provenance/interface/EventAuxiliary.h" + +#include "CondFormats/RunInfo/interface/RunInfo.h" +#include "CondFormats/DataRecord/interface/RunSummaryRcd.h" + +#include "L1Trigger/L1TGlobal/interface/L1TGlobalUtil.h" + +#include "FWCore/Utilities/interface/RegexMatch.h" +#include + +using namespace l1t; + +class L1TdeStage2uGT : public DQMEDAnalyzer { + public: + L1TdeStage2uGT(const edm::ParameterSet& ps); + ~L1TdeStage2uGT() override; + + protected: + void analyze(const edm::Event& e, const edm::EventSetup& c) override; + void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run&, const edm::EventSetup&) override; + void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; + void beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) override; + void endLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) override; + + private: + // Input and config info + edm::InputTag dataLabel_; + edm::EDGetTokenT dataSource_; + edm::InputTag emulLabel_; + edm::EDGetTokenT emulSource_; + std::vector triggerBlackList_; + int numBx_; + std::string histFolder_; + L1TGlobalUtil* gtUtil_; + int numLS_; + uint m_currentLumi; + + int firstBx, lastBx; + + std::map m_HistNamesInitial, m_HistNamesFinal, m_SummaryHistograms; + MonitorElement* initDecisionMismatches_vs_LS; + MonitorElement* finalDecisionMismatches_vs_LS; + MonitorElement* m_normalizationHisto; + + enum SummaryColumn { + NInitalMismatchDataNoEmul, + NInitalMismatchEmulNoData, + NFinalMismatchDataNoEmul, + NFinalMismatchEmulNoData, + NSummaryColumns, + }; + + void fillHist(const std::map&, const std::string&, const Double_t& , const Double_t&); +}; + +#endif diff --git a/DQM/L1TMonitor/plugins/SealModule.cc b/DQM/L1TMonitor/plugins/SealModule.cc index 2247698bcc1bd..23beb85a3c676 100644 --- a/DQM/L1TMonitor/plugins/SealModule.cc +++ b/DQM/L1TMonitor/plugins/SealModule.cc @@ -121,3 +121,6 @@ DEFINE_FWK_MODULE(L1TStage2uGTCaloLayer2Comp); #include "DQM/L1TMonitor/interface/L1TdeStage2CaloLayer2.h" DEFINE_FWK_MODULE(L1TdeStage2CaloLayer2); + +#include +DEFINE_FWK_MODULE(L1TdeStage2uGT); diff --git a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py index 52ca2dca3a502..df2cff83272b2 100644 --- a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py @@ -53,7 +53,7 @@ from L1Trigger.L1TGlobal.simGtExtFakeProd_cfi import simGtExtFakeProd valGtStage2Digis = simGtStage2Digis.clone() -valGtStage2Digis.ExtInputTag = cms.InputTag("simGtExtFakeProd") +valGtStage2Digis.ExtInputTag = cms.InputTag("gtStage2Digis") valGtStage2Digis.MuonInputTag = cms.InputTag("gtStage2Digis", "Muon") valGtStage2Digis.EGammaInputTag = cms.InputTag("gtStage2Digis", "EGamma") valGtStage2Digis.TauInputTag = cms.InputTag("gtStage2Digis", "Tau") @@ -61,6 +61,10 @@ valGtStage2Digis.EtSumInputTag = cms.InputTag("gtStage2Digis", "EtSum") valGtStage2Digis.AlgorithmTriggersUnmasked = cms.bool(False) valGtStage2Digis.AlgorithmTriggersUnprescaled = cms.bool(False) +valGtStage2Digis.EmulateBxInEvent = cms.int32(5) +valGtStage2Digis.PrescaleSet = cms.uint32(7) +valGtStage2Digis.GetPrescaleColumnFromData = cms.bool(True) +valGtStage2Digis.AlgoBlkInputTag = cms.InputTag("gtStage2Digis") Stage2L1HardwareValidation = cms.Sequence( valCaloStage2Layer1Digis + @@ -101,6 +105,7 @@ # uGT from DQM.L1TMonitor.L1TStage2uGTEmul_cfi import * +from DQM.L1TMonitor.L1TdeStage2uGT_cfi import * #------------------------------------------------- # Stage2 Emulator and Emulator DQM Sequences @@ -111,6 +116,7 @@ l1tdeStage2Omtf + l1tdeStage2EmtfOnlineDQMSeq + l1tStage2uGMTEmulatorOnlineDQMSeq + + l1tdeStage2uGT + l1tStage2uGtEmul ) diff --git a/DQM/L1TMonitor/python/L1TStage2FED_cff.py b/DQM/L1TMonitor/python/L1TStage2FED_cff.py new file mode 100644 index 0000000000000..bd21bc1db1558 --- /dev/null +++ b/DQM/L1TMonitor/python/L1TStage2FED_cff.py @@ -0,0 +1,14 @@ +from DQM.L1TMonitor.L1TFED_cfi import * + +l1tStage2Fed = l1tfed.clone() +l1tStage2Fed.L1FEDS = cms.vint32( + 1354, 1356, 1358, # CALOL1 + 1360, # CALOL2 + 1376, 1377, # BMTF + 1380, 1381, # OMTF + 1384, 1385, # EMTF + 1386, # CPPF + 1402, # GMT + 1404, # UGT + 1405) # UGTSPARE + diff --git a/DQM/L1TMonitor/python/L1TStage2uGMT_cff.py b/DQM/L1TMonitor/python/L1TStage2uGMT_cff.py index 85f346bc86723..b648e60b9624a 100644 --- a/DQM/L1TMonitor/python/L1TStage2uGMT_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2uGMT_cff.py @@ -84,6 +84,7 @@ # List of bins to ignore ignoreBins = { 'Bmtf' : [1], + 'Omtf' : [1], 'Emtf' : [1] } @@ -111,6 +112,7 @@ regionalMuonCollection1Title = cms.untracked.string("OMTF output data"), regionalMuonCollection2Title = cms.untracked.string("uGMT input data from OMTF"), summaryTitle = cms.untracked.string("Summary of comparison between OMTF output muons and uGMT input muons from OMTF"), + ignoreBin = cms.untracked.vint32(ignoreBins['Omtf']), verbose = cms.untracked.bool(False), ) diff --git a/DQM/L1TMonitor/python/L1TStage2uGT_cff.py b/DQM/L1TMonitor/python/L1TStage2uGT_cff.py index 02319dc42c34a..b930f89e7ecf5 100644 --- a/DQM/L1TMonitor/python/L1TStage2uGT_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2uGT_cff.py @@ -14,6 +14,7 @@ muonCollection1Title = cms.untracked.string("uGMT output muons"), muonCollection2Title = cms.untracked.string("uGT input muons"), summaryTitle = cms.untracked.string("Summary of comparison between uGMT output muons and uGT input muons"), + ignoreBin = cms.untracked.vint32([1]), # ignore the BX range bin verbose = cms.untracked.bool(False), ) diff --git a/DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py b/DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py new file mode 100644 index 0000000000000..78c6469e9adb4 --- /dev/null +++ b/DQM/L1TMonitor/python/L1TdeStage2uGT_cfi.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +l1tdeStage2uGT = DQMEDAnalyzer('L1TdeStage2uGT', + dataSource = cms.InputTag("gtStage2Digis"), + emulSource = cms.InputTag("valGtStage2Digis"), + triggerBlackList = cms.vstring("L1_IsolatedBunch","L1_FirstBunchInTrain","L1_FirstBunchAfterTrain","*3BX","L1_CDC*"), + numBxToMonitor = cms.int32(5), + histFolder = cms.string('L1TEMU/L1TdeStage2uGT') +) diff --git a/DQM/L1TMonitor/src/L1TFED.cc b/DQM/L1TMonitor/src/L1TFED.cc index 161d4d83e1c42..b3b16a4a5b789 100755 --- a/DQM/L1TMonitor/src/L1TFED.cc +++ b/DQM/L1TMonitor/src/L1TFED.cc @@ -34,13 +34,14 @@ void L1TFED::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, fedentries = ibooker.book1D("FEDEntries", "Fed ID occupancy", l1feds_.size(), 0.,l1feds_.size() ); fedfatal = ibooker.book1D("FEDFatal", "Fed ID non present ", l1feds_.size(), 0., l1feds_.size()); fednonfatal = ibooker.book1D("FEDNonFatal", "Fed corrupted data ", l1feds_.size(), 0.,l1feds_.size() ); - hfedprof = ibooker.bookProfile("fedprofile","FED Size by ID", l1feds_.size(), 0., l1feds_.size(),0,0.,5000.); + hfedprof = ibooker.bookProfile("fedprofile","FED Size by ID", l1feds_.size(), 0., l1feds_.size(),0,0.,10000.); for(unsigned int i=0;isetBinLabel(i+1,"FED "+ sfed.str()); fedfatal->setBinLabel(i+1,"FED "+ sfed.str()); fednonfatal->setBinLabel(i+1,"FED "+ sfed.str()); + hfedprof->setBinLabel(i+1,"FED "+ sfed.str()); } hfedsize = ibooker.book1D("fedsize","FED Size Distribution",100,0.,10000.); diff --git a/DQM/L1TMonitor/src/L1TdeStage2uGT.cc b/DQM/L1TMonitor/src/L1TdeStage2uGT.cc new file mode 100644 index 0000000000000..aef5edfbeae92 --- /dev/null +++ b/DQM/L1TMonitor/src/L1TdeStage2uGT.cc @@ -0,0 +1,290 @@ +/* + * \file L1TdeStage2uGT.cc + * + * L. Apanasevich + */ + +#include "DQM/L1TMonitor/interface/L1TdeStage2uGT.h" + +L1TdeStage2uGT::L1TdeStage2uGT(const edm::ParameterSet & ps) : + dataLabel_(ps.getParameter("dataSource")), + dataSource_(consumes(dataLabel_)), + emulLabel_(ps.getParameter("emulSource")), + emulSource_(consumes(emulLabel_)), + triggerBlackList_(ps.getParameter >("triggerBlackList")), + numBx_(ps.getParameter("numBxToMonitor")), + histFolder_(ps.getParameter("histFolder")), + gtUtil_(new l1t::L1TGlobalUtil(ps, consumesCollector(), *this, ps.getParameter("dataSource"), ps.getParameter("dataSource"))), + numLS_(2000), + m_currentLumi(0) +{ + + if (numBx_ >5 ) numBx_ = 5; + if ( ( numBx_ > 0 ) && ( ( numBx_ % 2 ) == 0 )) { + numBx_ = numBx_ - 1; + + edm::LogWarning("L1TdeStage2uGT") + << "\nWARNING: Number of bunch crossing to be emulated rounded to: " + << numBx_ << "\n The number must be an odd number!\n" + << std::endl; + } + firstBx = (numBx_ + 1)/2 - numBx_; + lastBx = (numBx_ + 1)/2 - 1; + + edm::LogInfo("L1TdeStage2uGT") << "Number of bunches crossings monitored: " << numBx_ + << "\t" << "Min BX= " << firstBx << "\t" << "Max BX= " << lastBx << std::endl; + +} + +L1TdeStage2uGT::~L1TdeStage2uGT() +{ +} + +void L1TdeStage2uGT::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& evtSetup) +{ +} + +void L1TdeStage2uGT::analyze(const edm::Event & event, const edm::EventSetup & es) +{ + edm::Handle dataCollection; + event.getByToken(dataSource_, dataCollection); + edm::Handle emulCollection; + event.getByToken(emulSource_, emulCollection); + + if (!dataCollection.isValid()) { + edm::LogError("L1TdeStage2uGT") << "Cannot find unpacked uGT readout record."; + return; + } + if (!emulCollection.isValid()) { + edm::LogError("L1TdeStage2uGT") << "Cannot find emulated uGT readout record."; + return; + } + + // Only using gtUtil to find prescale factors and mapping of bits to names, so only call gtUtil_ at lumi boundaries. + if (m_currentLumi != event.luminosityBlock()){ + m_currentLumi=event.luminosityBlock(); + gtUtil_->retrieveL1(event,es,dataSource_); + } + + // Get standard event parameters + int lumi = event.luminosityBlock(); + if (lumi > numLS_) lumi=numLS_; + + // int bx = event.bunchCrossing(); + + // check that the requested range of BX's is consistent with the BX's in the emulated and unpacked collections + if (emulCollection->getFirstBX() > firstBx) firstBx = emulCollection->getFirstBX(); + if (emulCollection->getLastBX() < lastBx) lastBx = emulCollection->getLastBX(); + + if (dataCollection->getFirstBX() > firstBx) firstBx = dataCollection->getFirstBX(); + if (dataCollection->getLastBX() < lastBx) lastBx = dataCollection->getLastBX(); + + m_normalizationHisto -> Fill(float(NInitalMismatchDataNoEmul)); + m_normalizationHisto -> Fill(float(NInitalMismatchEmulNoData)); + m_normalizationHisto -> Fill(float(NFinalMismatchDataNoEmul)); + m_normalizationHisto -> Fill(float(NFinalMismatchEmulNoData)); + + for (int ibx = firstBx; ibx <= lastBx; ++ibx) { + + ostringstream bxt; + if (ibx==0){ + bxt << "CentralBX"; + }else{ + bxt << "BX" << ibx; + } + std::string hname, hsummary; + float wt; + + hsummary="dataEmulSummary_" + bxt.str(); + + std::vector::const_iterator it_data, it_emul; + for (it_data = dataCollection->begin(ibx), it_emul = emulCollection->begin(ibx); + it_data != dataCollection->end(ibx) && it_emul != emulCollection->end(ibx); + ++it_data, ++it_emul) { + + + // Fills algorithm bits histograms + int numAlgs= it_data->getAlgoDecisionInitial().size(); + for(int algoBit = 0; algoBit < numAlgs; ++algoBit) { + + string algoName = "xxx"; + bool found=gtUtil_->getAlgNameFromBit(algoBit,algoName); + if (not found) continue; + + // skip bits which emulator does not handle (only skiped for bx !=0) + bool isBlackListed(false); + BOOST_FOREACH(const std::string & pattern, triggerBlackList_) { + //std::cout << pattern << std::endl; + if (edm::is_glob(pattern)) { + std::regex regexp(edm::glob2reg(pattern)); + if (regex_match (algoName.c_str(),regexp)) isBlackListed = true; + } else { + if (algoName == pattern) isBlackListed = true; + } + } + if (ibx !=0 && isBlackListed) continue; + + // Check initial decisions + if(it_data->getAlgoDecisionInitial(algoBit) != it_emul->getAlgoDecisionInitial(algoBit)) { + + if (it_data->getAlgoDecisionInitial(algoBit)){ + hname = "DataNoEmul_" + bxt.str(); + fillHist(m_SummaryHistograms, hsummary, float(NInitalMismatchDataNoEmul),1.); + wt=1; + }else{ + hname = "EmulatorNoData_" + bxt.str(); + fillHist(m_SummaryHistograms, hsummary, float(NInitalMismatchEmulNoData),1.); + wt=-1; + } + fillHist(m_HistNamesInitial, hname, float(algoBit),1.); + initDecisionMismatches_vs_LS->Fill(float(lumi),wt); + + } + + // Check final decisions + if(it_data->getAlgoDecisionFinal(algoBit) != it_emul->getAlgoDecisionFinal(algoBit)) { + bool unprescaled=true; + // check the prescale factor + int prescale = -999; + bool dummy=gtUtil_->getPrescaleByBit(algoBit,prescale); + if (not dummy) + edm::LogWarning("L1TdeStage2uGT") << "Could not find prescale value for algobit: " << algoBit << std::endl; + + if (prescale != 1) unprescaled=false; + + if (unprescaled) { + + if (it_data->getAlgoDecisionFinal(algoBit)){ + hname = "DataNoEmul_" + bxt.str(); + fillHist(m_SummaryHistograms, hsummary, float(NFinalMismatchDataNoEmul),1.); + wt=1; + }else{ + hname = "EmulatorNoData_" + bxt.str(); + fillHist(m_SummaryHistograms, hsummary, float(NFinalMismatchEmulNoData),1.); + wt=-1; + } + fillHist(m_HistNamesFinal, hname, float(algoBit),1.); + finalDecisionMismatches_vs_LS->Fill(float(lumi), wt); + } + } + + }// end loop over algoBits + }// end loop over globalalgblk vector + }// endof loop over BX collections + +} + +void L1TdeStage2uGT::beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) {} + +void L1TdeStage2uGT::endLuminosityBlock(const edm::LuminosityBlock& lumi, const edm::EventSetup&) {} + +void L1TdeStage2uGT::bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& run , const edm::EventSetup& es) +{ + gtUtil_->retrieveL1Setup(es); + + auto const& prescales = gtUtil_->prescales(); + int nbins = prescales.size(); // dummy values for now; update later when gtutils function is called + double xmin = -0.5; + double xmax = nbins-0.5; + + string hname, htitle; + + int ibx = (numBx_ + 1)/2 - numBx_; + for ( int i = 0; i < numBx_; i++) { + + ostringstream bxn,bxt; + + if (ibx==0){ + bxt << "CentralBX"; + bxn << " Central BX "; + }else{ + bxt << "BX" << ibx; + bxn<< " BX " << ibx; + } + ibx++; + + ibooker.setCurrentFolder(histFolder_); + hname = "dataEmulSummary_" + bxt.str(); + htitle = "uGT Data/Emulator Mismatches --" + bxn.str(); + m_SummaryHistograms[hname] = ibooker.book1D(hname, htitle, NSummaryColumns, 0., double(NSummaryColumns)); + m_SummaryHistograms[hname]->getTH1F()->GetYaxis()->SetTitle("Events"); + m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NInitalMismatchDataNoEmul, "Data, NoEmul -- Initial Decisions"); + m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NInitalMismatchEmulNoData, "Emulator, No Data -- Initial Decisions"); + m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NFinalMismatchDataNoEmul, "Data, NoEmul -- Final Decisions"); + m_SummaryHistograms[hname]->getTH1F()->GetXaxis()->SetBinLabel(1+NFinalMismatchEmulNoData, "Emulator, No Data -- Final Decisions"); + + if (i == 0){ + hname="normalizationHisto"; + htitle="Normalization histogram for uGT Data/Emulator Mismatches ratios"; + m_normalizationHisto = ibooker.book1D(hname, htitle, NSummaryColumns, 0., double(NSummaryColumns)); + m_normalizationHisto->getTH1F()->GetYaxis()->SetTitle("Events"); + m_normalizationHisto->getTH1F()->GetXaxis()->SetBinLabel(1+NInitalMismatchDataNoEmul, "Data, NoEmul -- Initial Decisions"); + m_normalizationHisto->getTH1F()->GetXaxis()->SetBinLabel(1+NInitalMismatchEmulNoData, "Emulator, No Data -- Initial Decisions"); + m_normalizationHisto->getTH1F()->GetXaxis()->SetBinLabel(1+NFinalMismatchDataNoEmul, "Data, NoEmul -- Final Decisions"); + m_normalizationHisto->getTH1F()->GetXaxis()->SetBinLabel(1+NFinalMismatchEmulNoData, "Emulator, No Data -- Final Decisions"); + } + + // book initial decisions histograms + ibooker.setCurrentFolder(histFolder_+"/InitialDecisionMismatches"); + initDecisionMismatches_vs_LS = ibooker.book1D("initialDecisionMismatches_vs_LS", "uGT initial decision mismatches vs Luminosity Segment", numLS_, 0., double(numLS_)); + initDecisionMismatches_vs_LS->getTH1F()->GetYaxis()->SetTitle("Events with Initial Decision Mismatch"); + initDecisionMismatches_vs_LS->getTH1F()->GetXaxis()->SetTitle("Luminosity Segment"); + + hname = "DataNoEmul_" + bxt.str(); + htitle = "uGT data-emul mismatch -- Data fired but not Emulator --" + bxn.str(); + m_HistNamesInitial[hname] = ibooker.book1D(hname, htitle, nbins, xmin, xmax); + + hname = "EmulatorNoData_" + bxt.str(); + htitle = "uGT data-emul mismatch -- Emulator fired but not Data --" + bxn.str(); + m_HistNamesInitial[hname] = ibooker.book1D(hname, htitle, nbins, xmin, xmax); + + + // book final decisions histograms + ibooker.setCurrentFolder(histFolder_+"/FinalDecisionMismatches"); + finalDecisionMismatches_vs_LS = ibooker.book1D("finalDecisionMismatches_vs_LS", "uGT final decision mismatches vs Luminosity Segment", numLS_, 0., double(numLS_)); + finalDecisionMismatches_vs_LS->getTH1F()->GetYaxis()->SetTitle("Events with Final Decision Mismatch"); + finalDecisionMismatches_vs_LS->getTH1F()->GetXaxis()->SetTitle("Luminosity Segment"); + + hname = "DataNoEmul_" + bxt.str(); + htitle = "uGT data-emul mismatch -- Data fired but not Emulator --" + bxn.str(); + m_HistNamesFinal[hname] = ibooker.book1D(hname, htitle, nbins, xmin, xmax); + + hname = "EmulatorNoData_" + bxt.str(); + htitle = "uGT data-emul mismatch -- Emulator fired but not Data --" + bxn.str(); + m_HistNamesFinal[hname] = ibooker.book1D(hname, htitle, nbins, xmin, xmax); + + } + + // Set some histogram attributes + for (std::map::iterator it = m_HistNamesInitial.begin(); it != m_HistNamesInitial.end(); ++it) { + // for (unsigned int i = 0; i < prescales.size(); i++) { + // auto const& name = prescales.at(i).first; + // if (name != "NULL") + // (*it).second->getTH1F()->GetXaxis()->SetBinLabel(1+i, name.c_str()); + // } + (*it).second->getTH1F()->GetXaxis()->SetTitle("Trigger Bit"); + (*it).second->getTH1F()->GetYaxis()->SetTitle("Events with Initial Decision Mismatch"); + } + + for (std::map::iterator it = m_HistNamesFinal.begin(); it != m_HistNamesFinal.end(); ++it) { + // for (unsigned int i = 0; i < prescales.size(); i++) { + // auto const& name = prescales.at(i).first; + // if (name != "NULL") + // (*it).second->getTH1F()->GetXaxis()->SetBinLabel(1+i, name.c_str()); + // } + (*it).second->getTH1F()->GetXaxis()->SetTitle("Trigger Bit (Unprescaled)"); + (*it).second->getTH1F()->GetYaxis()->SetTitle("Events with Final Decision Mismatch"); + } + + +} + +void L1TdeStage2uGT::fillHist(const std::map& m_HistNames, const std::string& histName, const Double_t& value, const Double_t& wt=1.){ + + std::map::const_iterator hid = m_HistNames.find(histName); + + if (hid==m_HistNames.end()) + edm::LogWarning("L1TdeStage2uGT") << "%fillHist -- Could not find histogram with name: " << histName << std::endl; + else + hid->second->Fill(value,wt); +} diff --git a/DQM/L1TMonitorClient/data/L1TStage2BMTFQualityTests.xml b/DQM/L1TMonitorClient/data/L1TStage2BMTFQualityTests.xml index 77e3405db2176..8c45a1ade4704 100644 --- a/DQM/L1TMonitorClient/data/L1TStage2BMTFQualityTests.xml +++ b/DQM/L1TMonitorClient/data/L1TStage2BMTFQualityTests.xml @@ -28,20 +28,4 @@ BMTF_WedgeBXNoisyWedge - - - - ContentsYRange - 0.00 - 0.00 - 0.95 - 0.99 - 1 - - - - zeroSupp_MismatchRatioMax0 - - - diff --git a/DQM/L1TMonitorClient/python/L1TStage2EmulatorMonitorClient_cff.py b/DQM/L1TMonitorClient/python/L1TStage2EmulatorMonitorClient_cff.py index e03ce52326671..b4bf6fa938b8a 100644 --- a/DQM/L1TMonitorClient/python/L1TStage2EmulatorMonitorClient_cff.py +++ b/DQM/L1TMonitorClient/python/L1TStage2EmulatorMonitorClient_cff.py @@ -35,6 +35,8 @@ # L1 emulator event info DQM client from DQM.L1TMonitorClient.L1TStage2EmulatorEventInfoClient_cfi import * +## uGT emulator client +from DQM.L1TMonitorClient.L1TStage2uGTEmulatorClient_cff import * # # define sequences @@ -48,7 +50,8 @@ + l1tStage2BMTFEmulatorClient + l1tStage2OMTFEmulatorClient + l1tStage2EMTFEmulatorClient - + l1tStage2EmulatorEventInfoClient + + l1tStage2EmulatorEventInfoClient + + l1tStage2uGTEmulatorClient ) l1tStage2EmulatorMonitorClient = cms.Sequence( diff --git a/DQM/L1TMonitorClient/python/L1TStage2EventInfoClient_cfi.py b/DQM/L1TMonitorClient/python/L1TStage2EventInfoClient_cfi.py index 130939e3a6175..a72924144bc7b 100644 --- a/DQM/L1TMonitorClient/python/L1TStage2EventInfoClient_cfi.py +++ b/DQM/L1TMonitorClient/python/L1TStage2EventInfoClient_cfi.py @@ -110,16 +110,6 @@ QualityTestHist = cms.string("L1T/L1TStage2BMTF/bmtf_wedge_bx"), QualityTestSummaryEnabled = cms.uint32(1) ), - cms.PSet( - QualityTestName = cms.string("zeroSupp_MismatchRatioMax0"), - QualityTestHist = cms.string("L1T/L1TStage2BMTF/zeroSuppression/AllEvts/mismatchRatio"), - QualityTestSummaryEnabled = cms.uint32(1) - ), - cms.PSet( - QualityTestName = cms.string("zeroSupp_MismatchRatioMax0"), - QualityTestHist = cms.string("L1T/L1TStage2BMTF/zeroSuppression/FatEvts/mismatchRatio"), - QualityTestSummaryEnabled = cms.uint32(1) - ), ) ), cms.PSet( diff --git a/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py b/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py index c067e8b6c2008..f23dfff79ba02 100644 --- a/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py +++ b/DQM/L1TMonitorClient/python/L1TStage2uGMTClient_cff.py @@ -12,9 +12,9 @@ # Muons l1tStage2uGMTMuonVsuGMTMuonCopy1RatioClient = DQMEDHarvester("L1TStage2RatioClient", - monitorDir = cms.untracked.string(ugmtDqmDir+'/uGMTMuonCopy1'), - inputNum = cms.untracked.string(ugmtDqmDir+'/uGMTMuonCopy1/'+errHistNumStr), - inputDen = cms.untracked.string(ugmtDqmDir+'/uGMTMuonCopy1/'+errHistDenStr), + monitorDir = cms.untracked.string(ugmtMuCpyDqmDir+'/uGMTMuonCopy1'), + inputNum = cms.untracked.string(ugmtMuCpyDqmDir+'/uGMTMuonCopy1/'+errHistNumStr), + inputDen = cms.untracked.string(ugmtMuCpyDqmDir+'/uGMTMuonCopy1/'+errHistDenStr), ratioName = cms.untracked.string('mismatchRatio'), ratioTitle = cms.untracked.string('Summary of mismatch rates between uGMT muons and uGMT muon copy 1'), yAxisTitle = cms.untracked.string('# mismatch / # total'), @@ -58,6 +58,7 @@ l1tStage2OmtfOutVsuGMTInRatioClient.inputNum = cms.untracked.string(ugmtDqmDir+'/OMTFoutput_vs_uGMTinput/'+errHistNumStr) l1tStage2OmtfOutVsuGMTInRatioClient.inputDen = cms.untracked.string(ugmtDqmDir+'/OMTFoutput_vs_uGMTinput/'+errHistDenStr) l1tStage2OmtfOutVsuGMTInRatioClient.ratioTitle = cms.untracked.string('Summary of mismatch rates between OMTF output muons and uGMT input muons from OMTF') +l1tStage2OmtfOutVsuGMTInRatioClient.ignoreBin = cms.untracked.vint32(ignoreBins['Omtf']) l1tStage2EmtfOutVsuGMTInRatioClient = l1tStage2uGMTMuonVsuGMTMuonCopy1RatioClient.clone() l1tStage2EmtfOutVsuGMTInRatioClient.monitorDir = cms.untracked.string(ugmtDqmDir+'/EMTFoutput_vs_uGMTinput') diff --git a/DQM/L1TMonitorClient/python/L1TStage2uGTClient_cff.py b/DQM/L1TMonitorClient/python/L1TStage2uGTClient_cff.py index 8115a83019ecb..5187b80f17990 100644 --- a/DQM/L1TMonitorClient/python/L1TStage2uGTClient_cff.py +++ b/DQM/L1TMonitorClient/python/L1TStage2uGTClient_cff.py @@ -1,5 +1,6 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +from DQM.L1TMonitor.L1TStage2uGT_cff import l1tStage2uGMTOutVsuGTIn # directory path shortening ugtDqmDir = 'L1T/L1TStage2uGT' @@ -12,6 +13,7 @@ monitorDir = cms.untracked.string(ugtDqmDir+'/uGMToutput_vs_uGTinput'), inputNum = cms.untracked.string(ugtDqmDir+'/uGMToutput_vs_uGTinput/'+errHistNumStr), inputDen = cms.untracked.string(ugtDqmDir+'/uGMToutput_vs_uGTinput/'+errHistDenStr), + ignoreBin = cms.untracked.vint32(l1tStage2uGMTOutVsuGTIn.ignoreBin), ratioName = cms.untracked.string('mismatchRatio'), ratioTitle = cms.untracked.string('Summary of mismatch rates between uGMT output muons and uGT input muons'), yAxisTitle = cms.untracked.string('# mismatch / # total'), @@ -21,7 +23,6 @@ dqmRatioTimingPlots = DQMEDHarvester("DQMGenericClient", subDirs = cms.untracked.vstring("L1T/L1TStage2uGT/"), - monitorDir = cms.untracked.string(ugtDqmDir), efficiency = cms.vstring( "Ratio_First_Bunch_In_Train 'First Bunch In Train Ratio; Bunch crossing number relative to L1A; Algorithm trigger bit' first_bunch_in_train den_first_bunch_in_train", "Ratio_Last_Bunch_In_Train 'Last Bunch In Train Ratio; Bunch crossing number relative to L1A; Algorithm trigger bit' last_bunch_in_train den_last_bunch_in_train", diff --git a/DQM/L1TMonitorClient/python/L1TStage2uGTEmulatorClient_cff.py b/DQM/L1TMonitorClient/python/L1TStage2uGTEmulatorClient_cff.py new file mode 100644 index 0000000000000..363819cefe0cc --- /dev/null +++ b/DQM/L1TMonitorClient/python/L1TStage2uGTEmulatorClient_cff.py @@ -0,0 +1,72 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +from DQM.L1TMonitor.L1TdeStage2uGMT_cff import ignoreBins + +# directories +ugmtEmuDqmDir = "L1TEMU/L1TdeStage2uGT" + + +BX = 'CentralBX' +errHistNumStr = 'dataEmulSummary_' + BX +errHistDenStr = 'normalizationHisto' +ratioHistStr = 'dataEmulMismatchRatio_' + BX + +l1tStage2uGTEmulatorCompRatioClientBX0 = DQMEDHarvester("L1TStage2RatioClient", + monitorDir = cms.untracked.string(ugmtEmuDqmDir), + inputNum = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistNumStr), + inputDen = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistDenStr), + ratioName = cms.untracked.string(ratioHistStr), + ratioTitle = cms.untracked.string('Summary of mismatch rates between uGT emulator and data'), + yAxisTitle = cms.untracked.string('# mismatch / # total'), + binomialErr = cms.untracked.bool(True) +) + +l1tStage2uGTEmulatorCompRatioClientBXP1 = l1tStage2uGTEmulatorCompRatioClientBX0.clone() +l1tStage2uGTEmulatorCompRatioClientBXP2 = l1tStage2uGTEmulatorCompRatioClientBX0.clone() +l1tStage2uGTEmulatorCompRatioClientBXM1 = l1tStage2uGTEmulatorCompRatioClientBX0.clone() +l1tStage2uGTEmulatorCompRatioClientBXM2 = l1tStage2uGTEmulatorCompRatioClientBX0.clone() + + +BX = 'BX1' +errHistNumStr = 'dataEmulSummary_' + BX +errHistDenStr = 'normalizationHisto' +ratioHistStr = 'dataEmulMismatchRatio_' + BX +l1tStage2uGTEmulatorCompRatioClientBXP1.inputNum = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistNumStr) +l1tStage2uGTEmulatorCompRatioClientBXP1.inputDen = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistDenStr) +l1tStage2uGTEmulatorCompRatioClientBXP1.ratioName = cms.untracked.string(ratioHistStr) + +BX = 'BX2' +errHistNumStr = 'dataEmulSummary_' + BX +errHistDenStr = 'normalizationHisto' +ratioHistStr = 'dataEmulMismatchRatio_' + BX +l1tStage2uGTEmulatorCompRatioClientBXP2.inputNum = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistNumStr) +l1tStage2uGTEmulatorCompRatioClientBXP2.inputDen = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistDenStr) +l1tStage2uGTEmulatorCompRatioClientBXP2.ratioName = cms.untracked.string(ratioHistStr) + +BX = 'BX-1' +errHistNumStr = 'dataEmulSummary_' + BX +errHistDenStr = 'normalizationHisto' +ratioHistStr = 'dataEmulMismatchRatio_' + BX +l1tStage2uGTEmulatorCompRatioClientBXM1.inputNum = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistNumStr) +l1tStage2uGTEmulatorCompRatioClientBXM1.inputDen = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistDenStr) +l1tStage2uGTEmulatorCompRatioClientBXM1.ratioName = cms.untracked.string(ratioHistStr) + +BX = 'BX-2' +errHistNumStr = 'dataEmulSummary_' + BX +errHistDenStr = 'normalizationHisto' +ratioHistStr = 'dataEmulMismatchRatio_' + BX +l1tStage2uGTEmulatorCompRatioClientBXM2.inputNum = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistNumStr) +l1tStage2uGTEmulatorCompRatioClientBXM2.inputDen = cms.untracked.string(ugmtEmuDqmDir+'/'+errHistDenStr) +l1tStage2uGTEmulatorCompRatioClientBXM2.ratioName = cms.untracked.string(ratioHistStr) + +# uGT + +# sequences +l1tStage2uGTEmulatorClient = cms.Sequence( + l1tStage2uGTEmulatorCompRatioClientBX0 + + l1tStage2uGTEmulatorCompRatioClientBXP1 + + l1tStage2uGTEmulatorCompRatioClientBXP2 + + l1tStage2uGTEmulatorCompRatioClientBXM1 + + l1tStage2uGTEmulatorCompRatioClientBXM2 +) + diff --git a/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py b/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py index 3fafad77eeee6..5f39421e7093d 100644 --- a/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py +++ b/DQM/SiPixelPhase1Clusters/python/SiPixelPhase1Clusters_cfi.py @@ -18,6 +18,35 @@ ) ) +SiPixelPhase1ClustersBigPixelCharge = DefaultHistoDigiCluster.clone( + name = "bigpixelcharge", + title = "Big Pixel Charge", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + + specs = VPSet( + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() + ) +) + +SiPixelPhase1ClustersNotBigPixelCharge = DefaultHistoDigiCluster.clone( + name = "notbigpixelcharge", + title = "Not Big Pixel Charge", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + enabled=False, + + specs = VPSet( + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() + ) +) + SiPixelPhase1ClustersSize = DefaultHistoDigiCluster.clone( name = "size", title = "Total Cluster Size", @@ -74,11 +103,11 @@ StandardSpecifications1D_Num, Specification().groupBy("PXBarrel/PXLayer/Event") #this will produce inclusive counts per Layer/Disk - .reduce("COUNT") + .reduce("COUNT") .groupBy("PXBarrel/PXLayer") .save(nbins=50, xmin=0, xmax=10000), Specification().groupBy("PXForward/PXDisk/Event") - .reduce("COUNT") + .reduce("COUNT") .groupBy("PXForward/PXDisk/") .save(nbins=50, xmin=0, xmax=5000), ) @@ -219,18 +248,18 @@ enabled = False, name = "cluster_ratio", title = "Pixel to Strip clusters ratio", - + xlabel = "ratio", dimensions = 1, - + specs = VPSet( - Specification().groupBy("PXAll").save(100, 0, 1), + Specification().groupBy("PXAll").save(100, 0, 1), Specification().groupBy("PXAll/LumiBlock") - .reduce("MEAN") + .reduce("MEAN") .groupBy("PXAll", "EXTEND_X") .save(), Specification().groupBy("PXAll/BX") - .reduce("MEAN") + .reduce("MEAN") .groupBy("PXAll", "EXTEND_X") .save(), ) @@ -238,6 +267,8 @@ SiPixelPhase1ClustersConf = cms.VPSet( SiPixelPhase1ClustersCharge, + SiPixelPhase1ClustersBigPixelCharge, + SiPixelPhase1ClustersNotBigPixelCharge, SiPixelPhase1ClustersSize, SiPixelPhase1ClustersSizeX, SiPixelPhase1ClustersSizeY, diff --git a/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc b/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc index f9341076ce81d..b8b53afe2beb2 100644 --- a/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc +++ b/DQM/SiPixelPhase1Clusters/src/SiPixelPhase1Clusters.cc @@ -24,6 +24,8 @@ namespace { class SiPixelPhase1Clusters final : public SiPixelPhase1Base { enum { CHARGE, + BIGPIXELCHARGE, + NOTBIGPIXELCHARGE, SIZE, SIZEX, SIZEY, @@ -72,7 +74,7 @@ void SiPixelPhase1Clusters::analyze(const edm::Event& iEvent, const edm::EventSe { histo[PIXEL_TO_STRIP_RATIO].fill((double)inputPixel.product()->data().size() / (double) inputStrip.product()->data().size(), DetId(0), &iEvent); } - } + } bool hasClusters=false; @@ -89,6 +91,26 @@ void SiPixelPhase1Clusters::analyze(const edm::Event& iEvent, const edm::EventSe for(SiPixelCluster const& cluster : *it) { int row = cluster.x()-0.5, col = cluster.y()-0.5; + const std::vector pixelsVec = cluster.pixels(); + + for (unsigned int i = 0; i < pixelsVec.size(); ++i) { + + float pixx = pixelsVec[i].x; // index as float=iteger, row index + float pixy = pixelsVec[i].y; // same, col index + + bool bigInX = topol.isItBigPixelInX(int(pixx)); + bool bigInY = topol.isItBigPixelInY(int(pixy)); + float pixel_charge = pixelsVec[i].adc; + + + if (bigInX==true || bigInY==true) { + histo[BIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row); + } + + else { + histo[NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent, col, row); + } + } histo[READOUT_CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row); histo[CHARGE].fill(double(cluster.charge()), id, &iEvent, col, row); histo[SIZE ].fill(double(cluster.size() ), id, &iEvent, col, row); diff --git a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py index 785441d0186d6..f0dc279c4d454 100644 --- a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py +++ b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py @@ -34,7 +34,7 @@ SiPixelPhase1Geometry.upgradePhase = 1 #define number of lumis for overlayed plots -SiPixelPhase1Geometry.onlineblock = 50 +SiPixelPhase1Geometry.onlineblock = 150 # Turn on 'online' harvesting. This has to be set before other configs are # loaded (due to how the DefaultHisto PSet is later cloned), therefore it is @@ -61,6 +61,7 @@ # Raw data errors from DQM.SiPixelPhase1RawData.SiPixelPhase1RawData_cfi import * +from DQM.SiPixelPhase1DeadFEDChannels.SiPixelPhase1DeadFEDChannels_cfi import * from DQM.SiPixelPhase1Common.SiPixelPhase1GeometryDebug_cfi import * @@ -73,6 +74,7 @@ siPixelPhase1OnlineDQM_source = cms.Sequence( SiPixelPhase1DigisAnalyzer + + SiPixelPhase1DeadFEDChannelsAnalyzer + SiPixelPhase1ClustersAnalyzer + SiPixelPhase1RawDataAnalyzer + SiPixelPhase1TrackClustersAnalyzer @@ -82,6 +84,7 @@ siPixelPhase1OnlineDQM_harvesting = cms.Sequence( SiPixelPhase1DigisHarvester + + SiPixelPhase1DeadFEDChannelsHarvester + SiPixelPhase1ClustersHarvester + SiPixelPhase1RawDataHarvester + SiPixelPhase1TrackClustersHarvester @@ -104,6 +107,7 @@ siPixelPhase1OnlineDQM_source_cosmics = cms.Sequence( SiPixelPhase1DigisAnalyzer + + SiPixelPhase1DeadFEDChannelsAnalyzer + SiPixelPhase1ClustersAnalyzer + SiPixelPhase1RawDataAnalyzer + SiPixelPhase1TrackClustersAnalyzer_cosmics @@ -124,6 +128,7 @@ siPixelPhase1OnlineDQM_source_pprun = cms.Sequence( SiPixelPhase1DigisAnalyzer + + SiPixelPhase1DeadFEDChannelsAnalyzer + SiPixelPhase1ClustersAnalyzer + SiPixelPhase1RawDataAnalyzer + SiPixelPhase1TrackClustersAnalyzer_pprun diff --git a/DQM/SiPixelPhase1Summary/interface/SiPixelPhase1Summary.h b/DQM/SiPixelPhase1Summary/interface/SiPixelPhase1Summary.h index fa3008f39e648..9d5b99afa6d44 100644 --- a/DQM/SiPixelPhase1Summary/interface/SiPixelPhase1Summary.h +++ b/DQM/SiPixelPhase1Summary/interface/SiPixelPhase1Summary.h @@ -68,6 +68,7 @@ bool firstLumi; std::map summaryMap_; + MonitorElement * deadROCSummary; MonitorElement * reportSummary; //Float value of the average of the ins in the grand summary std::map summaryPlotName_; @@ -76,6 +77,9 @@ std::map deadROCTrends_; std::map ineffROCTrends_; + //Error thresholds for the dead ROC plots + std::vector deadRocThresholds_; + //book the summary plots void bookSummaries(DQMStore::IBooker & iBooker); diff --git a/DQM/SiPixelPhase1Summary/python/SiPixelPhase1Summary_cfi.py b/DQM/SiPixelPhase1Summary/python/SiPixelPhase1Summary_cfi.py index f079f8fe6d6ad..fad85abfd48b6 100644 --- a/DQM/SiPixelPhase1Summary/python/SiPixelPhase1Summary_cfi.py +++ b/DQM/SiPixelPhase1Summary/python/SiPixelPhase1Summary_cfi.py @@ -30,7 +30,9 @@ MapName = cms.string("Charge"), MapHist = cms.string("mean_charge") ) - ) + ), + # Number of dead ROCs required to generate an error. Order must be layers 1-4, ring1, ring2. + DeadROCErrorThreshold = cms.vdouble(0.2,0.2,0.2,0.2,0.2,0.2) ) SiPixelPhase1SummaryOffline = DQMEDHarvester("SiPixelPhase1Summary", @@ -58,7 +60,9 @@ MapName = cms.string("Charge"), MapHist = cms.string("mean_charge") ) - ) + ), + DeadROCErrorThreshold = cms.vdouble(0.2,0.2,0.2,0.2,0.2,0.2) + ) SiPixelPhase1SummaryCosmics = DQMEDHarvester("SiPixelPhase1Summary", @@ -78,7 +82,8 @@ MapName = cms.string("Charge"), MapHist = cms.string("mean_charge") ) - ) + ), + DeadROCErrorThreshold = cms.vdouble(0.2,0.2,0.2,0.2,0.2,0.2) ) ADCQTester = cms.EDAnalyzer("QualityTester", diff --git a/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc b/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc index 1e675484e0b7e..ed17e95e564bc 100644 --- a/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc +++ b/DQM/SiPixelPhase1Summary/src/SiPixelPhase1Summary.cc @@ -62,7 +62,7 @@ SiPixelPhase1Summary::SiPixelPhase1Summary(const edm::ParameterSet& iConfig) : for (auto const mapPSet : mapPSets){ summaryPlotName_[mapPSet.getParameter("MapName")] = mapPSet.getParameter("MapHist"); } - + deadRocThresholds_ = conf_.getParameter >("DeadROCErrorThreshold"); } SiPixelPhase1Summary::~SiPixelPhase1Summary() @@ -83,9 +83,9 @@ void SiPixelPhase1Summary::dqmEndLuminosityBlock(DQMStore::IBooker & iBooker, DQ } if (runOnEndLumi_){ - fillSummaries(iBooker,iGetter); int lumiSec = lumiSeg.id().luminosityBlock(); fillTrendPlots(iBooker,iGetter,lumiSec); + fillSummaries(iBooker,iGetter); } // iBooker.cd(); @@ -103,8 +103,9 @@ void SiPixelPhase1Summary::dqmEndJob(DQMStore::IBooker & iBooker, DQMStore::IGet firstLumi = false; } if (runOnEndJob_){ - fillSummaries(iBooker,iGetter); if (!runOnEndLumi_) fillTrendPlots(iBooker,iGetter); //If we're filling these plots at the end lumi step, it doesn't really make sense to also do them at the end job + fillSummaries(iBooker,iGetter); + } } @@ -125,13 +126,37 @@ void SiPixelPhase1Summary::bookSummaries(DQMStore::IBooker & iBooker){ auto name = mapInfo.first; summaryMap_[name] = iBooker.book2D("pixel"+name+"Summary","Pixel "+name+" Summary",12,0,12,4,0,4); } - //Now book the overall summary map + //Make the new 6 bin ROC summary + deadROCSummary = iBooker.book2D("deadROCSummary","Percentage of dead ROCs per layer/ring",2,0,2,4,0,4); + std::vector xAxisLabelsReduced_ = {"Barrel","Forward"}; + deadROCSummary->setAxisTitle("Subdetector",1); + for (unsigned int i = 0; i < xAxisLabelsReduced_.size(); i++){ + deadROCSummary->setBinLabel(i+1,xAxisLabelsReduced_[i]); + } + + //Book the summary plot iBooker.setCurrentFolder("PixelPhase1/EventInfo"); - summaryMap_["Grand"] = iBooker.book2D("reportSummaryMap","Pixel Summary Map",12,0,12,4,0,4); + + if (runOnEndLumi_){ + //New less granular summary plot - this is currently only done online + summaryMap_["Grand"] = iBooker.book2D("reportSummaryMap","Pixel Summary Map",2,0,2,4,0,4); + summaryMap_["Grand"]->setAxisTitle("Subdetector",1); + for (unsigned int i = 0; i < xAxisLabelsReduced_.size(); i++){ + summaryMap_["Grand"]->setBinLabel(i+1,xAxisLabelsReduced_[i]); + for (unsigned int j = 0; j < 4; j++){ summaryMap_["Grand"]->setBinContent(i,j,-1);} + } + } + else{ + //Book the original summary plot, for now juts doing this one offline. + summaryMap_["Grand"] = iBooker.book2D("reportSummaryMap","Pixel Summary Map",12,0,12,4,0,4); + } + reportSummary = iBooker.bookFloat("reportSummary"); + //Now set up axis and bin labels for (auto summaryMapEntry: summaryMap_){ + if (summaryMapEntry.first == "Grand") continue; auto summaryMap = summaryMapEntry.second; for (unsigned int i = 0; i < xAxisLabels_.size(); i++){ summaryMap->setBinLabel(i+1, xAxisLabels_[i],1); @@ -141,13 +166,14 @@ void SiPixelPhase1Summary::bookSummaries(DQMStore::IBooker & iBooker){ } summaryMap->setAxisTitle("Subdetector",1); summaryMap->setAxisTitle("Layer/disk",2); - for (int i = 0; i < 12; i++){ // !??!?!? xAxisLabels_.size() ?!?! - for (int j = 0; j < 4; j++){ // !??!?!? yAxisLabels_.size() ?!?!?! + for (int i = 0; i < summaryMap->getTH1()->GetXaxis()->GetNbins(); i++){ // !??!?!? xAxisLabels_.size() ?!?! + for (int j = 0; j < summaryMap->getTH1()->GetYaxis()->GetNbins(); j++){ // !??!?!? yAxisLabels_.size() ?!?!?! summaryMap->Fill(i,j,-1.); } } } reportSummary->Fill(-1.); + //Reset the iBooker iBooker.setCurrentFolder("PixelPhase1/"); } @@ -175,8 +201,8 @@ void SiPixelPhase1Summary::bookTrendPlots(DQMStore::IBooker & iBooker){ } } else { - deadROCTrends_[offline] = iBooker.book1D("deadRocTotal","N dead ROCs",6,0,6); - ineffROCTrends_[offline] = iBooker.book1D("ineffRocTotal","N inefficient ROCs",6,0,6); + deadROCTrends_[offline] = iBooker.bookProfile("deadRocTotal","N dead ROCs",6,0,6,0.,8192,""); + ineffROCTrends_[offline] = iBooker.bookProfile("ineffRocTotal","N inefficient ROCs",6,0,6,0.,8192,""); deadROCTrends_[offline]->setAxisTitle("Subdetector",1); ineffROCTrends_[offline]->setAxisTitle("Subdetector",1); for (unsigned int i = 1; i <= binAxisLabels.size(); i++){ @@ -223,28 +249,68 @@ void SiPixelPhase1Summary::fillSummaries(DQMStore::IBooker & iBooker, DQMStore:: } } } + + //Fill the dead ROC summary + std::vector trendOrder = {layer1,layer2,layer3,layer4,ring1,ring2}; + std::vector nRocsPerTrend = {1536,3584,5632,8192,4224,6528}; + for (unsigned int i = 0; i < trendOrder.size(); i++){ + int xBin = i < 4 ? 1 : 2; + int yBin = i%4 + 1; + float nROCs = 0.; + if (runOnEndLumi_){ //Online case + TH1 * tempProfile = deadROCTrends_[trendOrder[i]]->getTH1(); + nROCs = tempProfile->GetBinContent(tempProfile->FindLastBinAbove()); + } + else { //Offline case + TH1* tempProfile = deadROCTrends_[offline]->getTH1(); + nROCs = tempProfile->GetBinContent(i+1); + } + deadROCSummary->setBinContent(xBin,yBin,nROCs/nRocsPerTrend[i]); + } + //Sum of non-negative bins for the reportSummary float sumOfNonNegBins = 0.; //Now we will use the other summary maps to create the overall map. - for (int i = 0; i < 12; i++){ // !??!?!? xAxisLabels_.size() ?!?! - if (summaryMap_["Grand"]==nullptr){ - edm::LogWarning("SiPixelPhase1Summary") << "Grand summary does not exist!"; - break; - } - for (int j = 0; j < 4; j++){ // !??!?!? yAxisLabels_.size() ?!?!?! - summaryMap_["Grand"]->setBinContent(i+1,j+1,1); // This resets the map to be good. We only then set it to 0 if there has been a problem in one of the other summaries. - for (auto const mapInfo: summaryPlotName_){ //Check summary maps - auto name = mapInfo.first; - if (summaryMap_[name]==nullptr){ - edm::LogWarning("SiPixelPhase1Summary") << "Summary " << name << " does not exist!"; - continue; + //For now we only want to do this offline + if (!runOnEndLumi_){ + for (int i = 0; i < 12; i++){ // !??!?!? xAxisLabels_.size() ?!?! + if (summaryMap_["Grand"]==nullptr){ + edm::LogWarning("SiPixelPhase1Summary") << "Grand summary does not exist!"; + break; + } + for (int j = 0; j < 4; j++){ // !??!?!? yAxisLabels_.size() ?!?!?! + summaryMap_["Grand"]->setBinContent(i+1,j+1,1); // This resets the map to be good. We only then set it to 0 if there has been a problem in one of the other summaries. + for (auto const mapInfo: summaryPlotName_){ //Check summary maps + auto name = mapInfo.first; + if (summaryMap_[name]==nullptr){ + edm::LogWarning("SiPixelPhase1Summary") << "Summary " << name << " does not exist!"; + continue; + } + if (summaryMap_["Grand"]->getBinContent(i+1,j+1) > summaryMap_[name]->getBinContent(i+1,j+1)) summaryMap_["Grand"]->setBinContent(i+1,j+1,summaryMap_[name]->getBinContent(i+1,j+1)); } - if (summaryMap_["Grand"]->getBinContent(i+1,j+1) > summaryMap_[name]->getBinContent(i+1,j+1)) summaryMap_["Grand"]->setBinContent(i+1,j+1,summaryMap_[name]->getBinContent(i+1,j+1)); + if (summaryMap_["Grand"]->getBinContent(i+1,j+1) > -0.1) sumOfNonNegBins += summaryMap_["Grand"]->getBinContent(i+1,j+1); + } + } + reportSummary->Fill(sumOfNonNegBins/40.); // The average of the 40 useful bins in the summary map. + } + + //Fill the new overall map + // if (!runOnEndLumi_) return; + else{ //Do this for online only + for (int i = 0; i < 2; i++){ + if (summaryMap_["Grand"]==nullptr){ + edm::LogWarning("SiPixelPhase1Summary") << "Grand summary does not exist!"; + break; + } + for (int j = 0; j < 4; j++){ // !??!?!? yAxisLabels_.size() ?!?!?! + //Ignore the bins without detectors in them + if (i == 1 && j > 1) continue; + summaryMap_["Grand"]->setBinContent(i+1,j+1,1); // This resets the map to be good. We only then set it to 0 if there has been a problem in one of the other summaries. + if (deadROCSummary->getBinContent(i+1,j+1) > deadRocThresholds_[i*4+j]) summaryMap_["Grand"]->setBinContent(i+1,j+1,0); + sumOfNonNegBins += summaryMap_["Grand"]->getBinContent(i+1,j+1); } - if (summaryMap_["Grand"]->getBinContent(i+1,j+1) > -0.1) sumOfNonNegBins += summaryMap_["Grand"]->getBinContent(i+1,j+1); } } - reportSummary->Fill(sumOfNonNegBins/40.); // The average of the 40 useful bins in the summary map. } @@ -256,9 +322,17 @@ void SiPixelPhase1Summary::fillTrendPlots(DQMStore::IBooker & iBooker, DQMStore: // If we're running in online mode and the lumi section is not modulo 10, return. Offline running always uses lumiSec=0, so it will pass this test. if (lumiSec%10 != 0) return; + if (runOnEndLumi_) { + MonitorElement * nClustersAll = iGetter.get("PixelPhase1/Phase1_MechanicalView/num_clusters_per_Lumisection_PXAll"); + if (nClustersAll==nullptr){ + edm::LogWarning("SiPixelPhase1Summary") << "All pixel cluster trend plot not available!!"; + return; + } + if (nClustersAll->getTH1()->GetBinContent(lumiSec) < 100) return; + } + std::string histName; - //Find the total number of filled bins and hi efficiency bins std::vector trendOrder = {layer1,layer2,layer3,layer4,ring1,ring2}; std::vector nFilledROCs(trendOrder.size(),0); @@ -294,8 +368,8 @@ void SiPixelPhase1Summary::fillTrendPlots(DQMStore::IBooker & iBooker, DQMStore: if (!runOnEndLumi_) { //offline for (unsigned int i = 0; i < trendOrder.size(); i++){ - deadROCTrends_[offline]->setBinContent(i+1,nRocsPerTrend[i]-nFilledROCs[i]); - ineffROCTrends_[offline]->setBinContent(i+1,nFilledROCs[i]-hiEffROCs[i]); + deadROCTrends_[offline]->Fill(i,nRocsPerTrend[i]-nFilledROCs[i]); + ineffROCTrends_[offline]->Fill(i,nFilledROCs[i]-hiEffROCs[i]); } } else { //online diff --git a/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py b/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py index 0c35475b3c6a4..5ac9f63e343b0 100644 --- a/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py +++ b/DQM/SiPixelPhase1TrackClusters/python/SiPixelPhase1TrackClusters_cfi.py @@ -10,10 +10,10 @@ xlabel = "Charge (electrons)", specs = VPSet( - StandardSpecifications1D, + StandardSpecifications1D, StandardSpecification2DProfile, - - #what is below is only for the timing client + + #what is below is only for the timing client Specification(OverlayCurvesForTiming).groupBy("PXBarrel/OnlineBlock") .groupBy("PXBarrel", "EXTEND_Y") .save(), @@ -63,6 +63,35 @@ ) ) +SiPixelPhase1TrackClustersOnTrackBigPixelCharge = DefaultHistoTrack.clone( + name = "bigpixelcharge", + title = "Corrected Big Pixel Charge (OnTrack)", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + + specs = VPSet( + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() + ) +) + +SiPixelPhase1TrackClustersOnTrackNotBigPixelCharge = DefaultHistoTrack.clone( + name = "notbigpixelcharge", + title = "Corrected Not Big Pixel Charge (OnTrack)", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + enabled=False, + + specs = VPSet( + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() + ) +) + SiPixelPhase1TrackClustersOnTrackSize = DefaultHistoTrack.clone( name = "size", title = "Total Cluster Size (OnTrack)", @@ -70,7 +99,7 @@ xlabel = "size[pixels]", specs = VPSet( - StandardSpecifications1D, + StandardSpecifications1D, StandardSpecification2DProfile, Specification().groupBy("PXForward/PXRing").save(), @@ -159,12 +188,12 @@ StandardSpecification2DProfile_Num, Specification().groupBy("PXBarrel/PXLayer/Event") #this will produce inclusive counts per Layer/Disk - .reduce("COUNT") + .reduce("COUNT") .groupBy("PXBarrel/PXLayer") .save(nbins=50, xmin=0, xmax=5000), Specification().groupBy("PXForward/PXDisk/Event") - .reduce("COUNT") + .reduce("COUNT") .groupBy("PXForward/PXDisk/") .save(nbins=50, xmin=0, xmax=2000), @@ -226,7 +255,7 @@ .groupBy("PXBarrel/OnlineBlock") .groupBy("PXBarrel", "EXTEND_Y") .save() - + ) ) @@ -365,7 +394,7 @@ xlabel = "y size", ylabel = "x size", range_min = 0, range_max = 20, range_nbins = 20, - range_y_min = 0, range_y_max = 10, range_y_nbins = 10 + range_y_min = 0, range_y_max = 10, range_y_nbins = 10 ) SiPixelPhase1TrackClustersOnTrackSizeXYInner = SiPixelPhase1TrackClustersOnTrackSizeXYOuter.clone( @@ -407,11 +436,11 @@ Specification().groupBy("PXBarrel/PXLayer").save() ) ) - + SiPixelPhase1TrackClustersOnTrackChargeInner = SiPixelPhase1TrackClustersOnTrackChargeOuter.clone( name = "chargeInner", title = "Corrected Cluster Charge (OnTrack) inner ladders" -) +) SiPixelPhase1TrackClustersOnTrackShapeOuter = DefaultHistoTrack.clone( topFolderName = "PixelPhase1/ClusterShape", @@ -432,6 +461,8 @@ # copy this in the enum SiPixelPhase1TrackClustersConf = cms.VPSet( SiPixelPhase1TrackClustersOnTrackCharge, + SiPixelPhase1TrackClustersOnTrackBigPixelCharge, + SiPixelPhase1TrackClustersOnTrackNotBigPixelCharge, SiPixelPhase1TrackClustersOnTrackSize, SiPixelPhase1TrackClustersOnTrackShape, SiPixelPhase1TrackClustersOnTrackNClusters, @@ -478,7 +509,3 @@ histograms = SiPixelPhase1TrackClustersConf, geometry = SiPixelPhase1Geometry ) - - - - diff --git a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc index 74512ef6d6b92..dc61faa933835 100644 --- a/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc @@ -1,5 +1,5 @@ // -*- C++ -*- -// +// // Package: SiPixelPhase1TrackClusters // Class : SiPixelPhase1TrackClusters // @@ -35,8 +35,10 @@ namespace { class SiPixelPhase1TrackClusters final : public SiPixelPhase1Base { -enum { +enum { ON_TRACK_CHARGE, + ON_TRACK_BIGPIXELCHARGE, + ON_TRACK_NOTBIGPIXELCHARGE, ON_TRACK_SIZE, ON_TRACK_SHAPE, ON_TRACK_NCLUSTERS, @@ -54,20 +56,20 @@ enum { ON_TRACK_SHAPE_OUTER, ON_TRACK_SHAPE_INNER, - + ON_TRACK_SIZE_X_OUTER, ON_TRACK_SIZE_X_INNER, ON_TRACK_SIZE_X_F, ON_TRACK_SIZE_Y_OUTER, ON_TRACK_SIZE_Y_INNER, ON_TRACK_SIZE_Y_F, - + ON_TRACK_SIZE_XY_OUTER, ON_TRACK_SIZE_XY_INNER, ON_TRACK_SIZE_XY_F, CHARGE_VS_SIZE_ON_TRACK, - ENUM_SIZE + ENUM_SIZE }; public: @@ -87,11 +89,11 @@ SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& applyVertexCut_(iConfig.getUntrackedParameter("VertexCut", true)) { tracksToken_ = consumes(iConfig.getParameter("tracks")); - + offlinePrimaryVerticesToken_ = applyVertexCut_ ? consumes(iConfig.getParameter("vertices")) : edm::EDGetTokenT(); - + pixelClusterShapeCacheToken_ = consumes(iConfig.getParameter("clusterShapeCache")); } @@ -137,18 +139,18 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev if ( !pixelClusterShapeCacheH.isValid() ) { edm::LogWarning("SiPixelPhase1TrackClusters") << "PixelClusterShapeCache collection is not valid"; return; - } + } auto const & pixelClusterShapeCache = *pixelClusterShapeCacheH; for (auto const & track : *tracks) { - if (applyVertexCut_ && + if (applyVertexCut_ && (track.pt() < 0.75 || std::abs( track.dxy((*vertices)[0].position()) ) > 5 * track.dxyError())) continue; bool isBpixtrack = false, isFpixtrack = false, crossesPixVol = false; // find out whether track crosses pixel fiducial volume (for cosmic tracks) - auto d0 = track.d0(), dz = track.dz(); + auto d0 = track.d0(), dz = track.dz(); if (std::abs(d0) < 15 && std::abs(dz) < 50) crossesPixVol = true; auto etatk = track.eta(); @@ -156,9 +158,9 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev auto const & trajParams = track.extra()->trajParams(); assert(trajParams.size()==track.recHitsSize()); auto hb = track.recHitsBegin(); - + for (unsigned int h = 0; h < track.recHitsSize(); h++){ - + auto hit = *(hb + h); if (!hit->isValid()) continue; auto id = hit->geographicalId(); @@ -169,25 +171,42 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev if (subdetid == PixelSubdetector::PixelEndcap) isFpixtrack = true; if (subdetid != PixelSubdetector::PixelBarrel && subdetid != PixelSubdetector::PixelEndcap) continue; bool iAmBarrel = subdetid == PixelSubdetector::PixelBarrel; - + // PXB_L4 IS IN THE OTHER WAY // CAN BE XORed BUT LETS KEEP THINGS SIMPLE - bool iAmOuter = ((tkTpl.pxbLadder(id) % 2 == 1) && tkTpl.pxbLayer(id) != 4) || + bool iAmOuter = ((tkTpl.pxbLadder(id) % 2 == 1) && tkTpl.pxbLayer(id) != 4) || ((tkTpl.pxbLadder(id) % 2 != 1) && tkTpl.pxbLayer(id) == 4); - + auto pixhit = dynamic_cast(hit->hit()); if (!pixhit) continue; - // auto geomdetunit = dynamic_cast(pixhit->detUnit()); - // auto const & topol = geomdetunit->specificTopology(); - + auto geomdetunit = dynamic_cast(pixhit->detUnit()); + auto const & topol = geomdetunit->specificTopology(); + // get the cluster auto clustp = pixhit->cluster(); - if (clustp.isNull()) continue; + if (clustp.isNull()) continue; auto const & cluster = *clustp; + const std::vector pixelsVec = cluster.pixels(); + for (unsigned int i = 0; i < pixelsVec.size(); ++i) { + + float pixx = pixelsVec[i].x; // index as float=iteger, row index + float pixy = pixelsVec[i].y; // same, col index + + bool bigInX = topol.isItBigPixelInX(int(pixx)); + bool bigInY = topol.isItBigPixelInY(int(pixy)); + float pixel_charge = pixelsVec[i].adc; + + if (bigInX==true || bigInY==true) { + histo[ON_TRACK_BIGPIXELCHARGE].fill(pixel_charge, id, &iEvent); + } + else { + histo[ON_TRACK_NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent); + } + } // End loop over pixels auto const & ltp = trajParams[h]; - + auto localDir = ltp.momentum() / ltp.momentum().mag(); // correct charge for track impact angle @@ -201,7 +220,7 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev if(shapeFilter.getSizes(*pixhit, localDir, pixelClusterShapeCache, part, meas, pred)) { auto shape = shapeFilter.isCompatible(*pixhit, localDir, pixelClusterShapeCache); unsigned shapeVal = (shape ? 1 : 0); - + if (iAmBarrel) { if(iAmOuter) { histo[ON_TRACK_SIZE_X_OUTER].fill(pred.first, cluster.sizeX(), id, &iEvent); @@ -237,7 +256,7 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev histo[ON_TRACK_POSITIONF].fill(clustgp.x(), clustgp.y(), id, &iEvent); histo[CHARGE_VS_SIZE_ON_TRACK].fill(cluster.size(), charge, id, &iEvent); - + if (iAmBarrel) // Avoid mistakes even if specification < should > handle it { if(iAmOuter) { @@ -252,17 +271,17 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev // statistics on tracks histo[NTRACKS].fill(1, DetId(0), &iEvent); - if (isBpixtrack || isFpixtrack) + if (isBpixtrack || isFpixtrack) histo[NTRACKS].fill(2, DetId(0), &iEvent); - if (isBpixtrack) + if (isBpixtrack) histo[NTRACKS].fill(3, DetId(0), &iEvent); - if (isFpixtrack) + if (isFpixtrack) histo[NTRACKS].fill(4, DetId(0), &iEvent); if (crossesPixVol) { if (isBpixtrack || isFpixtrack) histo[NTRACKS_INVOLUME].fill(1, DetId(0), &iEvent); - else + else histo[NTRACKS_INVOLUME].fill(0, DetId(0), &iEvent); } } @@ -275,4 +294,3 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(SiPixelPhase1TrackClusters); - diff --git a/DQM/SiStripCommissioningAnalysis/interface/CalibrationAlgorithm.h b/DQM/SiStripCommissioningAnalysis/interface/CalibrationAlgorithm.h index 6c53bffae0d2a..1aa5af5ed00b5 100644 --- a/DQM/SiStripCommissioningAnalysis/interface/CalibrationAlgorithm.h +++ b/DQM/SiStripCommissioningAnalysis/interface/CalibrationAlgorithm.h @@ -41,7 +41,7 @@ class CalibrationAlgorithm : public CommissioningAlgorithm { float maximum( TH1* ); - float turnOn( TH1* ); + float turnOn( TF1* ); private: @@ -51,7 +51,6 @@ class CalibrationAlgorithm : public CommissioningAlgorithm { /** Fitter in deconvolution mode */ TF1* deconv_fitter_; /** Fitter in peak mode */ - TF1* peak_fitter_; CalibrationAnalysis* cal_; diff --git a/DQM/SiStripCommissioningAnalysis/interface/PedsFullNoiseAlgorithm.h b/DQM/SiStripCommissioningAnalysis/interface/PedsFullNoiseAlgorithm.h index 242dd1168284f..621598eabfb11 100644 --- a/DQM/SiStripCommissioningAnalysis/interface/PedsFullNoiseAlgorithm.h +++ b/DQM/SiStripCommissioningAnalysis/interface/PedsFullNoiseAlgorithm.h @@ -13,6 +13,7 @@ class TH1; @author M. Wingham, R.Bainbridge @brief Histogram-based analysis for pedestal run. */ + class PedsFullNoiseAlgorithm : public CommissioningAlgorithm { public: @@ -22,10 +23,9 @@ class PedsFullNoiseAlgorithm : public CommissioningAlgorithm { ~PedsFullNoiseAlgorithm() override {;} inline const Histo& hPeds() const; - inline const Histo& hNoise() const; + inline const Histo& hNoise2D() const; - inline const Histo& hNoise1D() const; private: @@ -37,24 +37,37 @@ class PedsFullNoiseAlgorithm : public CommissioningAlgorithm { /** Performs histogram anaysis. */ void analyse() override; + /** reset vector */ + void reset(PedsFullNoiseAnalysis*); + private: /** Pedestals and raw noise */ Histo hPeds_; - - /** Residuals and noise */ + /** Noise and residuals */ Histo hNoise_; - Histo hNoise1D_; + Histo hNoise2D_; /** Analysis parameters */ - float deadStripMax_; - float noisyStripMin_; - std::string noiseDef_; - float ksProbCut_; + float maxDriftResidualCut_; + float minStripNoiseCut_; + float maxStripNoiseCut_; + float maxStripNoiseSignificanceCut_; + float adProbabCut_; + float ksProbabCut_; + bool generateRandomHisto_; + float jbProbabCut_; + float chi2ProbabCut_; + float kurtosisCut_; + float integralTailCut_; + int integralNsigma_; + float ashmanDistance_; + float amplitudeRatio_; + }; const PedsFullNoiseAlgorithm::Histo& PedsFullNoiseAlgorithm::hPeds() const { return hPeds_; } - +const PedsFullNoiseAlgorithm::Histo& PedsFullNoiseAlgorithm::hNoise2D() const { return hNoise2D_; } const PedsFullNoiseAlgorithm::Histo& PedsFullNoiseAlgorithm::hNoise() const { return hNoise_; } #endif // DQM_SiStripCommissioningAnalysis_PedsFullNoiseAlgorithm_H diff --git a/DQM/SiStripCommissioningAnalysis/interface/SiStripPulseShape.h b/DQM/SiStripCommissioningAnalysis/interface/SiStripPulseShape.h index 8e15bdbcb7645..35ec0222d89f6 100644 --- a/DQM/SiStripCommissioningAnalysis/interface/SiStripPulseShape.h +++ b/DQM/SiStripCommissioningAnalysis/interface/SiStripPulseShape.h @@ -11,7 +11,10 @@ // // Original Author: Christophe Delaere // Created: Thu Nov 5 17:02:15 CEST 2006 -// +// Revision Author: Georg Auzinger +// Created: Thu Nov 5 17:02:15 CEST 2006 +// Updated: Fri Jun 2 16:00:00 CEST 2017 + // #ifndef SiStripPulseShape_h_ @@ -25,6 +28,19 @@ double fpeak_convoluted(double *x, double *par); double fdeconv_convoluted(double *x, double *par); +double pulse_raw(double x, double y, double z, double t); + +double pulse_x0(double y, double z, double t); + +double pulse_yz(double x, double z, double t); + +double pulse_x0_yz(double z, double t); + +double pulse(double x, double y, double z, double t); + +double get_compensation(double x); + + class SiStripPulseShape { public: @@ -40,15 +56,15 @@ class SiStripPulseShape switch(mode_) { case peak: { - return fpeak_convoluted(&time,parameters); + return fpeak(&time,parameters); } case deconvolution: { - return fdeconv_convoluted(&time,parameters); + return fdeconv(&time,parameters); } } } - + private: mode mode_; }; diff --git a/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc b/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc index 1bd50cc265731..e0903b69ac08d 100644 --- a/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc +++ b/DQM/SiStripCommissioningAnalysis/src/CalibrationAlgorithm.cc @@ -8,6 +8,7 @@ #include "TF1.h" #include "TH1.h" #include "TVirtualFitter.h" +#include "TFitResultPtr.h" #include #include #include @@ -23,22 +24,18 @@ CalibrationAlgorithm::CalibrationAlgorithm( const edm::ParameterSet & pset, Cali peak_fitter_(nullptr), cal_(nullptr) { - deconv_fitter_ = new TF1("deconv_fitter",fdeconv_convoluted,-50,50,5); - deconv_fitter_->FixParameter(0,0); - deconv_fitter_->SetParLimits(1,-100,0); - deconv_fitter_->SetParLimits(2,0,200); - deconv_fitter_->SetParLimits(3,5,100); - deconv_fitter_->FixParameter(3,50); - deconv_fitter_->SetParLimits(4,0,50); - deconv_fitter_->SetParameters(0.,-10,0.96,50,20); - peak_fitter_ = new TF1("peak_fitter",fpeak_convoluted,-50,50,5); - peak_fitter_->FixParameter(0,0); - peak_fitter_->SetParLimits(1,-100,0); - peak_fitter_->SetParLimits(2,0,400); - peak_fitter_->SetParLimits(3,5,100); - peak_fitter_->FixParameter(3,50); - peak_fitter_->SetParLimits(4,0,50); - peak_fitter_->SetParameters(0.,-10,0.96,50,20); + + deconv_fitter_ = new TF1("deconv_fitter",fdeconv,0,200,6); + deconv_fitter_->SetParLimits(0,1,70); //x + deconv_fitter_->SetParLimits(1,0,40); //z = tau + deconv_fitter_->SetParLimits(4,15,55); // turn-on-time t_0 + deconv_fitter_->SetParameters(2,25,0.8000,50,40); + + peak_fitter_ = new TF1("peak_fitter",fpeak,0,200,5); + peak_fitter_->SetParLimits(0,1,70); //x + peak_fitter_->SetParLimits(1,20,70);//z = tau + peak_fitter_->SetParLimits(4,15,35); //turn-on-time t_0 + peak_fitter_->SetParameters(17,50,0,5000,20); } // ---------------------------------------------------------------------------- @@ -131,6 +128,26 @@ void CalibrationAlgorithm::analyse() { float Kmin[2] = {2000000.,2000000.}; float Kmax[2] = {0.,0.}; float Kspread[2] = {0.,0.}; + // turnOn + float Omean[2] = {0.,0.}; + float Omin[2] = {2000.,2000.}; + float Omax[2] = {0.,0.}; + float Ospread[2] = {0.,0.}; + // maximum + float Mmean[2] = {0.,0.}; + float Mmin[2] = {2000.,2000.}; + float Mmax[2] = {0.,0.}; + float Mspread[2] = {0.,0.}; + // undershoot + float Umean[2] = {0.,0.}; + float Umin[2] = {2000.,2000.}; + float Umax[2] = {0.,0.}; + float Uspread[2] = {0.,0.}; + // baseline + float Bmean[2] = {0.,0.}; + float Bmin[2] = {2000.,2000.}; + float Bmax[2] = {0.,0.}; + float Bspread[2] = {0.,0.}; unsigned int upperLimit = cal_->isScan_ ? 2 : 32; float nStrips = cal_->isScan_ ? 1. : 16.; @@ -163,84 +180,140 @@ void CalibrationAlgorithm::analyse() { // rescale the plot correctDistribution(histo_[i].first); - - // amplitude - cal_->amplitude_[apv][strip] = histo_[i].first->GetMaximum(); - + + /// make the fit + TF1* fit = fitPulse(histo_[i].first); + float maximum_ampl = fit->GetMaximum(); + float baseline = fit->Eval(10); + cal_->amplitude_[apv][strip] = maximum_ampl - baseline; + // rise time - cal_->riseTime_[apv][strip] = maximum(histo_[i].first) - turnOn(histo_[i].first); + float peak_time = fit->GetMaximumX(); + float turn_on_time = turnOn(fit); + float rise_time = peak_time - turn_on_time; + cal_->riseTime_[apv][strip] = rise_time; + + //turn-on + cal_->turnOn_[apv][strip] = turn_on_time; + + //maximum + cal_->maximum_[apv][strip] = peak_time; + + //undershoot + if (cal_->deconv_) + cal_->undershoot_[apv][strip] = 100*(fit->GetMinimum()-baseline)/(maximum_ampl - baseline); + else + cal_->undershoot_[apv][strip] = 0; + + //baseline + cal_->baseline_[apv][strip] = 100 * baseline/(maximum_ampl - baseline); + // tail 125 ns after the maximum - int lastBin = histo_[i].first->FindBin(histo_[i].first->GetBinCenter(histo_[i].first->GetMaximumBin())+125); + int lastBin = histo_[i].first->FindBin(peak_time + 125); if(lastBin>histo_[i].first->GetNbinsX()-4) lastBin = histo_[i].first->GetNbinsX()-4; - if(histo_[i].first->GetMaximum()!=0) - cal_->tail_[apv][strip] = 100*histo_[i].first->GetBinContent(lastBin)/histo_[i].first->GetMaximum(); - else - cal_->tail_[apv][strip] = 100; - - // perform the fit for the next quantities - TF1* fit = fitPulse(histo_[i].first); + if(histo_[i].first->GetMaximum()!=0) + cal_->tail_[apv][strip] = 100*(histo_[i].first->GetBinContent(lastBin)-baseline) / (maximum_ampl - baseline); + else + cal_->tail_[apv][strip] = 100; - // time constant - cal_->timeConstant_[apv][strip] = fit->GetParameter(3); - - // smearing - cal_->smearing_[apv][strip] = fit->GetParameter(4); - - // chi2 + cal_->timeConstant_[apv][strip] = fit->GetParameter(1); + cal_->smearing_[apv][strip] = 0; cal_->chi2_[apv][strip] = fit->GetChisquare(); + //compute mean, max, min, spread Amean[apv] += cal_->amplitude_[apv][strip]/nStrips; Amin[apv] = Amin[apv]amplitude_[apv][strip] ? Amin[apv] : cal_->amplitude_[apv][strip]; Amax[apv] = Amax[apv]>cal_->amplitude_[apv][strip] ? Amax[apv] : cal_->amplitude_[apv][strip]; Aspread[apv] += cal_->amplitude_[apv][strip]*cal_->amplitude_[apv][strip]/nStrips; + Tmean[apv] += cal_->tail_[apv][strip]/nStrips; Tmin[apv] = Tmin[apv]tail_[apv][strip] ? Tmin[apv] : cal_->tail_[apv][strip]; Tmax[apv] = Tmax[apv]>cal_->tail_[apv][strip] ? Tmax[apv] : cal_->tail_[apv][strip]; Tspread[apv] += cal_->tail_[apv][strip]*cal_->tail_[apv][strip]/nStrips; + Rmean[apv] += cal_->riseTime_[apv][strip]/nStrips; Rmin[apv] = Rmin[apv]riseTime_[apv][strip] ? Rmin[apv] : cal_->riseTime_[apv][strip]; Rmax[apv] = Rmax[apv]>cal_->riseTime_[apv][strip] ? Rmax[apv] : cal_->riseTime_[apv][strip]; Rspread[apv] += cal_->riseTime_[apv][strip]*cal_->riseTime_[apv][strip]/nStrips; + Cmean[apv] += cal_->timeConstant_[apv][strip]/nStrips; Cmin[apv] = Cmin[apv]timeConstant_[apv][strip] ? Cmin[apv] : cal_->timeConstant_[apv][strip]; Cmax[apv] = Cmax[apv]>cal_->timeConstant_[apv][strip] ? Cmax[apv] : cal_->timeConstant_[apv][strip]; Cspread[apv] += cal_->timeConstant_[apv][strip]*cal_->timeConstant_[apv][strip]/nStrips; + Smean[apv] += cal_->smearing_[apv][strip]/nStrips; Smin[apv] = Smin[apv]smearing_[apv][strip] ? Smin[apv] : cal_->smearing_[apv][strip]; Smax[apv] = Smax[apv]>cal_->smearing_[apv][strip] ? Smax[apv] : cal_->smearing_[apv][strip]; Sspread[apv] += cal_->smearing_[apv][strip]*cal_->smearing_[apv][strip]/nStrips; + Kmean[apv] += cal_->chi2_[apv][strip]/nStrips; Kmin[apv] = Kmin[apv]chi2_[apv][strip] ? Kmin[apv] : cal_->chi2_[apv][strip]; Kmax[apv] = Kmax[apv]>cal_->chi2_[apv][strip] ? Kmax[apv] : cal_->chi2_[apv][strip]; Kspread[apv] += cal_->chi2_[apv][strip]*cal_->chi2_[apv][strip]/nStrips; + + Omean[apv] += cal_->turnOn_[apv][strip]/nStrips; + Omin[apv] = Omin[apv]turnOn_[apv][strip] ? Omin[apv] : cal_->turnOn_[apv][strip]; + Omax[apv] = Omax[apv]>cal_->turnOn_[apv][strip] ? Omax[apv] : cal_->turnOn_[apv][strip]; + Ospread[apv] += cal_->turnOn_[apv][strip]*cal_->turnOn_[apv][strip]/nStrips; + + Mmean[apv] += cal_->maximum_[apv][strip]/nStrips; + Mmin[apv] = Mmin[apv]maximum_[apv][strip] ? Mmin[apv] : cal_->maximum_[apv][strip]; + Mmax[apv] = Mmax[apv]>cal_->maximum_[apv][strip] ? Mmax[apv] : cal_->maximum_[apv][strip]; + Mspread[apv] += cal_->maximum_[apv][strip]*cal_->maximum_[apv][strip]/nStrips; + + Umean[apv] += cal_->undershoot_[apv][strip]/nStrips; + Umin[apv] = Umin[apv]undershoot_[apv][strip] ? Umin[apv] : cal_->undershoot_[apv][strip]; + Umax[apv] = Umax[apv]>cal_->undershoot_[apv][strip] ? Umax[apv] : cal_->undershoot_[apv][strip]; + Uspread[apv] += cal_->undershoot_[apv][strip]*cal_->undershoot_[apv][strip]/nStrips; + + Bmean[apv] += cal_->baseline_[apv][strip]/nStrips; + Bmin[apv] = Bmin[apv]baseline_[apv][strip] ? Bmin[apv] : cal_->baseline_[apv][strip]; + Bmax[apv] = Bmax[apv]>cal_->baseline_[apv][strip] ? Bmax[apv] : cal_->baseline_[apv][strip]; + Bspread[apv] += cal_->baseline_[apv][strip]*cal_->baseline_[apv][strip]/nStrips; } - + // fill the mean, max, min, spread, ... histograms. for(int i=0;i<2;++i) { cal_->mean_amplitude_[i] = Amean[i]; cal_->mean_tail_[i] = Tmean[i]; cal_->mean_riseTime_[i] = Rmean[i]; cal_->mean_timeConstant_[i] = Cmean[i]; + cal_->mean_turnOn_[i] = Omean[i]; + cal_->mean_maximum_[i] = Mmean[i]; + cal_->mean_undershoot_[i] = Umean[i]; + cal_->mean_baseline_[i] = Bmean[i]; cal_->mean_smearing_[i] = Smean[i]; cal_->mean_chi2_[i] = Kmean[i]; cal_->min_amplitude_[i] = Amin[i]; cal_->min_tail_[i] = Tmin[i]; cal_->min_riseTime_[i] = Rmin[i]; cal_->min_timeConstant_[i] = Cmin[i]; + cal_->min_turnOn_[i] = Omin[i]; + cal_->min_maximum_[i] = Mmin[i]; + cal_->min_undershoot_[i] = Umin[i]; + cal_->min_baseline_[i] = Bmin[i]; cal_->min_smearing_[i] = Smin[i]; cal_->min_chi2_[i] = Kmin[i]; cal_->max_amplitude_[i] = Amax[i]; cal_->max_tail_[i] = Tmax[i]; cal_->max_riseTime_[i] = Rmax[i]; cal_->max_timeConstant_[i] = Cmax[i]; + cal_->max_turnOn_[i] = Omax[i]; + cal_->max_maximum_[i] = Mmax[i]; + cal_->max_undershoot_[i] = Umax[i]; + cal_->max_baseline_[i] = Bmax[i]; cal_->max_smearing_[i] = Smax[i]; cal_->max_chi2_[i] = Kmax[i]; cal_->spread_amplitude_[i] = sqrt(fabs(Aspread[i]-Amean[i]*Amean[i])); cal_->spread_tail_[i] = sqrt(fabs(Tspread[i]-Tmean[i]*Tmean[i])); cal_->spread_riseTime_[i] = sqrt(fabs(Rspread[i]-Rmean[i]*Rmean[i])); cal_->spread_timeConstant_[i] = sqrt(fabs(Cspread[i]-Cmean[i]*Cmean[i])); + cal_->spread_turnOn_[i] = sqrt(fabs(Ospread[i]-Omean[i]*Omean[i])); + cal_->spread_maximum_[i] = sqrt(fabs(Mspread[i]-Mmean[i]*Mmean[i])); + cal_->spread_undershoot_[i] = sqrt(fabs(Uspread[i]-Umean[i]*Umean[i])); + cal_->spread_baseline_[i] = sqrt(fabs(Bspread[i]-Bmean[i]*Bmean[i])); cal_->spread_smearing_[i] = sqrt(fabs(Sspread[i]-Smean[i]*Smean[i])); cal_->spread_chi2_[i] = sqrt(fabs(Kspread[i]-Kmean[i]*Kmean[i])); } @@ -252,7 +325,13 @@ void CalibrationAlgorithm::correctDistribution( TH1* histo ) const { // return the curve histo->Scale(-1); - if ( cal_ ) { if( cal_->isScan_ ) histo->Scale(1/16.); } + if ( cal_ ) { + if( cal_->isScan_ ){ + histo->Scale(1/16.); + edm::LogWarning(mlCommissioning_) + << "CalibrationAlgorithm::correctDistribution: isScan_ == true!!! "; + } + } } // ---------------------------------------------------------------------------- @@ -266,21 +345,33 @@ TF1* CalibrationAlgorithm::fitPulse( TH1* histo, float noise = 4.; float N = round(histo->GetMaximum()/125.); float error = sqrt(2*N)*noise; - //float error = sqrt(2)*noise*N; // ????????? + for(int i=1;i<=histo->GetNbinsX();++i) { histo->SetBinError(i,error); } + + // let's help our fit with a bit of parameter guessing + float maximum = histo->GetMaximum(); + float turn_on = histo->GetBinCenter((histo->FindFirstBinAbove(0.1 * maximum) - 2)); + if (cal_->deconv_) { + + deconv_fitter_->SetParameter(4, turn_on); + if(rangeLow>rangeHigh) - histo->Fit(deconv_fitter_,"Q"); + histo->Fit(deconv_fitter_,"QMR"); else - histo->Fit(deconv_fitter_,"0Q","",rangeLow,rangeHigh); + histo->Fit(deconv_fitter_,"0QMR","",rangeLow,rangeHigh); + return deconv_fitter_; - } else { + + } + else { + peak_fitter_->SetParameter(4, turn_on); if(rangeLow>rangeHigh) - histo->Fit(peak_fitter_,"Q"); + histo->Fit(peak_fitter_,"MRQ"); else - histo->Fit(peak_fitter_,"0Q","",rangeLow,rangeHigh); + histo->Fit(peak_fitter_,"0QMR","",rangeLow,rangeHigh); return peak_fitter_; } } @@ -296,25 +387,10 @@ float CalibrationAlgorithm::maximum( TH1* h ) { // ---------------------------------------------------------------------------- // -float CalibrationAlgorithm::turnOn( TH1* h ) { - // localize the rising edge - int bin=1; - float amplitude = h->GetMaximum(); - for(; bin<= h->GetNbinsX() && h->GetBinContent(bin)<0.4*amplitude; ++bin) {} - float end = h->GetBinLowEdge(bin); - // fit the rising edge with a sigmoid - TF1* sigmoid = new TF1("sigmoid","[0]/(1+exp(-[1]*(x-[2])))+[3]",0,end); - sigmoid->SetParLimits(0,amplitude/10.,amplitude); - sigmoid->SetParLimits(1,0.05,0.5); - sigmoid->SetParLimits(2,end-10,end+10); - sigmoid->SetParLimits(3,-amplitude/10.,amplitude/10.); - sigmoid->SetParameters(amplitude/2.,0.1,end,0.); - h->Fit(sigmoid,"0QR"); - // return the point where the fit = 3% signal. - float time = 0.; - float base = sigmoid->GetMinimum(0,end); - for(;timeEval(time)-base)<0.03*(amplitude-base);time += 0.1) {} - delete sigmoid; - return time-0.05; +float CalibrationAlgorithm::turnOn(TF1* f){ + float max_amplitude = f->GetMaximum(); + float time = 5.; + float base = f->GetMinimum(0,50); + for( ; time < 50 && (f->Eval(time) - base) < 0.01 * (max_amplitude - base); time += 0.1) {} + return time - 0.05; } - diff --git a/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc b/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc index b6bfa11c73d09..d1e36946adfa5 100644 --- a/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc +++ b/DQM/SiStripCommissioningAnalysis/src/PedsFullNoiseAlgorithm.cc @@ -3,41 +3,66 @@ #include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h" #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" + #include "TProfile.h" #include "TH1.h" #include "TH2.h" #include "TF1.h" +#include "TFitResult.h" +#include "TMath.h" +#include "Math/DistFunc.h" +#include "Math/ProbFuncMathCore.h" +#include "Fit/BinData.h" +#include "HFitInterface.h" +#include "Math/GoFTest.h" #include #include #include using namespace sistrip; - +using namespace std; // ---------------------------------------------------------------------------- // -PedsFullNoiseAlgorithm::PedsFullNoiseAlgorithm( const edm::ParameterSet & pset, PedsFullNoiseAnalysis* const anal ) - : CommissioningAlgorithm(anal), - hPeds_(nullptr,""), - hNoise_(nullptr,""), - hNoise1D_(nullptr,""), - deadStripMax_(pset.getParameter("DeadStripMax")), - noisyStripMin_(pset.getParameter("NoisyStripMin")), - noiseDef_(pset.getParameter("NoiseDefinition")), - ksProbCut_(pset.getParameter("KsProbCut")) +PedsFullNoiseAlgorithm::PedsFullNoiseAlgorithm( const edm::ParameterSet & pset, PedsFullNoiseAnalysis* const anal ): + CommissioningAlgorithm(anal), + hPeds_(nullptr,""), + hNoise_(nullptr,""), + hNoise2D_(nullptr,""), + maxDriftResidualCut_(pset.getParameter("MaxDriftResidualCut")), + minStripNoiseCut_(pset.getParameter("MinStripNoiseCut")), + maxStripNoiseCut_(pset.getParameter("MaxStripNoiseCut")), + maxStripNoiseSignificanceCut_(pset.getParameter("MaxStripNoiseSignificanceCut")), + adProbabCut_(pset.getParameter("AdProbabCut")), + ksProbabCut_(pset.getParameter("KsProbabCut")), + generateRandomHisto_(pset.getParameter("GenerateRandomHisto")), + jbProbabCut_(pset.getParameter("JbProbabCut")), + chi2ProbabCut_(pset.getParameter("Chi2ProbabCut")), + kurtosisCut_(pset.getParameter("KurtosisCut")), + integralTailCut_(pset.getParameter("IntegralTailCut")), + integralNsigma_(pset.getParameter("IntegralNsigma")), + ashmanDistance_(pset.getParameter("AshmanDistance")), + amplitudeRatio_(pset.getParameter("AmplitudeRatio")) { - //LogDebug(mlCommissioning_) - // << "[PedsFullNoiseAlgorithm::" << __func__ << "]" - // << " Set maximum noise deviation for dead strip determination to: " << deadStripMax_; - // LogDebug(mlCommissioning_) - // << "[PedsFullNoiseAlgorithm::" << __func__ << "]" - // << " Set minimal noise deviation for noise strip determination to: " << noisyStripMin_; + LogDebug(mlCommissioning_) + << "[PedsFullNoiseAlgorithm::" << __func__ << "]" + << " Set maximum drift of the mean value to: " << maxDriftResidualCut_ + << " Set minimum noise value to: " << minStripNoiseCut_ + << " Set maximum noise value to: " << maxStripNoiseCut_ + << " Set maximum noise significance value to: " << maxStripNoiseSignificanceCut_ + << " Set minimum Anderson-Darling p-value to: " << adProbabCut_ + << " Set minimum Kolmogorov-Smirnov p-value to: " << ksProbabCut_ + << " Set minimum Jacque-Bera p-value to: " << jbProbabCut_ + << " Set minimum Chi2 p-value to: " << chi2ProbabCut_ + << " Set N-sigma for the integral to : " << integralNsigma_ + << " Set maximum integral tail at N-sigma to : " << integralTailCut_ + << " Set maximum Kurtosis to : " << kurtosisCut_; } - + // ---------------------------------------------------------------------------- // void PedsFullNoiseAlgorithm::extract( const std::vector& histos ) { - + if ( !anal() ) { edm::LogWarning(mlCommissioning_) << "[PedsFullNoiseAlgorithm::" << __func__ << "]" @@ -45,12 +70,12 @@ void PedsFullNoiseAlgorithm::extract( const std::vector& histos ) { return; } - // Check number of histograms + // Check number of histograms --> Pedestal, noise and noise2D if ( histos.size() != 3 ) { anal()->addErrorCode(sistrip::numberOfHistos_); } - // Extract FED key from histo title + // Extract FED key from histo title --> i.e. APV pairs or LLD channel if ( !histos.empty() ) { anal()->fedKey( extractFedKey( histos.front() ) ); } @@ -62,49 +87,93 @@ void PedsFullNoiseAlgorithm::extract( const std::vector& histos ) { // Check for NULL pointer if ( !(*ihis) ) { continue; } -// TO BE UPDATED!!! - // Check run type SiStripHistoTitle title( (*ihis)->GetName() ); -/* if ( title.runType() != sistrip::PEDS_FULL_NOISE ) { + if ( title.runType() != sistrip::PEDS_FULL_NOISE ) { anal()->addErrorCode(sistrip::unexpectedTask_); continue; } -*/ + // Extract peds histos if ( title.extraInfo().find(sistrip::extrainfo::roughPedestals_) != std::string::npos ) { //@@ something here for rough peds? - } else if ( title.extraInfo().find(sistrip::extrainfo::pedestals_) != std::string::npos ) { + } + else if ( title.extraInfo().find(sistrip::extrainfo::pedestals_) != std::string::npos ) { hPeds_.first = *ihis; hPeds_.second = (*ihis)->GetName(); - } else if ( title.extraInfo().find(sistrip::extrainfo::commonMode_) != std::string::npos ) { + } + else if ( title.extraInfo().find(sistrip::extrainfo::commonMode_) != std::string::npos ) { //@@ something here for CM plots? - } else if ( title.extraInfo().find(sistrip::extrainfo::noiseProfile_) != std::string::npos ) { + } + else if ( title.extraInfo().find(sistrip::extrainfo::noiseProfile_) != std::string::npos ) { //@@ something here for noise profile plot? - hNoise1D_.first = *ihis; - hNoise1D_.second = (*ihis)->GetName(); - } else if ( title.extraInfo().find(sistrip::extrainfo::noise2D_) != std::string::npos ) { hNoise_.first = *ihis; hNoise_.second = (*ihis)->GetName(); - } else { + } + else if ( title.extraInfo().find(sistrip::extrainfo::noise2D_) != std::string::npos ) { + hNoise2D_.first = *ihis; + hNoise2D_.second = (*ihis)->GetName(); + } + else { anal()->addErrorCode(sistrip::unexpectedExtraInfo_); } - } + } +} + +// resetting vectors +void PedsFullNoiseAlgorithm::reset(PedsFullNoiseAnalysis* ana){ + for(size_t iapv = 0 ; iapv < ana->peds_.size(); iapv++){ + ana->pedsMean_[iapv] = 0.; + ana->rawMean_[iapv] = 0.; + ana->noiseMean_[iapv] = 0.; + ana->pedsSpread_[iapv] = 0.; + ana->noiseSpread_[iapv] = 0.; + ana->rawSpread_[iapv] = 0.; + ana->pedsMax_[iapv] = 0.; + ana->pedsMin_[iapv] = 0.; + ana->rawMax_[iapv] = 0.; + ana->rawMin_[iapv] = 0.; + ana->noiseMax_[iapv] = 0.; + ana->noiseMin_[iapv] = 0.; + + for(size_t istrip = 0; istrip < ana->peds_[iapv].size(); istrip++){ + ana->peds_[iapv][istrip] = 0.; + ana->noise_[iapv][istrip] = 0.; + ana->raw_[iapv][istrip] = 0.; + ana->adProbab_[iapv][istrip] = 0.; + ana->ksProbab_[iapv][istrip] = 0.; + ana->jbProbab_[iapv][istrip] = 0.; + ana->chi2Probab_[iapv][istrip] = 0.; + ana->residualRMS_[iapv][istrip] = 0.; + ana->residualSigmaGaus_[iapv][istrip] = 0.; + ana->noiseSignificance_[iapv][istrip] = 0.; + ana->residualMean_[iapv][istrip] = 0.; + ana->residualSkewness_[iapv][istrip] = 0.; + ana->residualKurtosis_[iapv][istrip] = 0.; + ana->residualIntegralNsigma_[iapv][istrip] = 0.; + ana->residualIntegral_[iapv][istrip] = 0.; + ana->deadStripBit_[iapv][istrip] = 0; + ana->badStripBit_[iapv][istrip] = 0; + } + } } // ----------------------------------------------------------------------------- // void PedsFullNoiseAlgorithm::analyse() { + // check base analysis object if ( !anal() ) { edm::LogWarning(mlCommissioning_) << "[PedsFullNoiseAlgorithm::" << __func__ << "]" << " NULL pointer to base Analysis object!"; return; } - - CommissioningAnalysis* tmp = const_cast( anal() ); + + CommissioningAnalysis* tmp = const_cast( anal() ); PedsFullNoiseAnalysis* ana = dynamic_cast( tmp ); + + // check PedsFullNoiseAnalysis object if ( !ana ) { edm::LogWarning(mlCommissioning_) << "[PedsFullNoiseAlgorithm::" << __func__ << "]" @@ -112,244 +181,442 @@ void PedsFullNoiseAlgorithm::analyse() { return; } - if ( !hPeds_.first ) { + + // check if the histograms exists + if ( !hPeds_.first) { ana->addErrorCode(sistrip::nullPtr_); return; } - + if ( !hNoise_.first ) { ana->addErrorCode(sistrip::nullPtr_); return; } - - TProfile * peds_histo = dynamic_cast(hPeds_.first); - TH2S * noise_histo = dynamic_cast(hNoise_.first); - if ( !peds_histo ) { + + if ( !hNoise2D_.first ) { + ana->addErrorCode(sistrip::nullPtr_); + return; + } + + // take the histograms + TProfile *histoPeds = dynamic_cast(hPeds_.first); + TProfile *histoNoiseMean = dynamic_cast(hNoise_.first); + TH2S * histoNoise = dynamic_cast(hNoise2D_.first); + + // Make sanity checks about pointers + if (not histoPeds) { + ana->addErrorCode(sistrip::nullPtr_); + return; + } + + if (not histoNoiseMean) { ana->addErrorCode(sistrip::nullPtr_); return; } - if ( !noise_histo ) { + if (not histoNoise) { ana->addErrorCode(sistrip::nullPtr_); return; } - if ( peds_histo->GetNbinsX() != 256 ) { + // check the binning --> each x-axis bin is 1 strip -> 2APV per lldChannel -> 256 strips + if (histoPeds->GetNbinsX() != 256 ) { ana->addErrorCode(sistrip::numberOfBins_); return; } - if ( noise_histo->GetNbinsY() != 256 ) { // X range is configurable + //check the binning --> each x-axis bin is 1 strip -> 2APV per lldChannel -> 256 strips + if (histoNoiseMean->GetNbinsX() != 256 ) { ana->addErrorCode(sistrip::numberOfBins_); return; } + + //check the binning --> each y-axis bin is 1 strip -> 2APV per lldChannel -> 256 strips + if (histoNoise->GetNbinsY() != 256 ) { + ana->addErrorCode(sistrip::numberOfBins_); + return; + } + + //Reset values + reset(ana); - // Iterate through APVs - for ( uint16_t iapv = 0; iapv < 2; iapv++ ) { - - // Used to calc mean and rms for peds and noise - float p_sum = 0., p_sum2 = 0., p_max = -1.*sistrip::invalid_, p_min = sistrip::invalid_; - float n_sum = 0., n_sum2 = 0., n_max = -1.*sistrip::invalid_, n_min = sistrip::invalid_; - float r_sum = 0., r_sum2 = 0., r_max = -1.*sistrip::invalid_, r_min = sistrip::invalid_; - // Iterate through strips of APV - - //Need our own copy for thread safety - TF1 mygaus("mygaus","gaus"); - for ( uint16_t istr = 0; istr < 128; istr++ ) { - - ana->ksProb_[iapv].push_back(0); - ana->noiseGaus_[iapv].push_back(0); - ana->noiseBin84_[iapv].push_back(0); - ana->noiseRMS_[iapv].push_back(0); - ana->noiseSignif_[iapv].push_back(0); + + // loop on each strip + uint32_t apvID = -1; + + // Save basic information at strip / APV level + vector ped_max; + vector ped_min; + vector raw_max; + vector raw_min; + vector noise_max; + vector noise_min; + + // loop on each strip in the lldChannel + for(int iStrip = 0; iStrip < histoPeds->GetNbinsX(); iStrip++){ + + if(iStrip < histoPeds->GetNbinsX()/2) apvID = 0; + else apvID = 1; - // pedestals and raw noise - if ( peds_histo ) { - if ( peds_histo->GetBinEntries(iapv*128 + istr + 1) ) { - ana->peds_[iapv][istr] = peds_histo->GetBinContent(iapv*128 + istr + 1); - p_sum += ana->peds_[iapv][istr]; - p_sum2 += (ana->peds_[iapv][istr] * ana->peds_[iapv][istr]); - if ( ana->peds_[iapv][istr] > p_max ) { p_max = ana->peds_[iapv][istr];} - if ( ana->peds_[iapv][istr] < p_min ) { p_min = ana->peds_[iapv][istr];} - ana->raw_[iapv][istr] = peds_histo->GetBinError(iapv*128 + istr + 1); - r_sum += ana->raw_[iapv][istr]; - r_sum2 += (ana->raw_[iapv][istr] * ana->raw_[iapv][istr]); - if ( ana->raw_[iapv][istr] > r_max ) { r_max = ana->raw_[iapv][istr]; } - if ( ana->raw_[iapv][istr] < r_min ) { r_min = ana->raw_[iapv][istr]; } - } - } - // Noise from Full Distribution - if ( noise_histo ) { - // Fit the ADC Distribution from TH2S by projecting it out and fitting. - - TH1S * noisehist = new TH1S("noisehist","",noise_histo->GetNbinsX(), - -noise_histo->GetNbinsX()/2,noise_histo->GetNbinsX()/2); - - - for(int i=0;i<=noise_histo->GetNbinsX()+1;i++){ - noisehist->SetBinContent(i,noise_histo->GetBinContent(i,iapv*128 + istr + 1)); - } - // If the histogram is valid. - if(noisehist->Integral() > 0){ - ana->noiseRMS_[iapv][istr] = noisehist->GetRMS(); - noisehist->Fit(&mygaus,"Q"); - ana->noiseGaus_[iapv][istr] = mygaus.GetParameter(2); - - // new Bin84 method - std::vector integralFrac; - integralFrac.push_back(1.*noisehist->GetBinContent(0)/noisehist->Integral(0,noisehist->GetNbinsX())); - // Calculate the integral of distro as a function of bins. - for(int i = 1; i < noisehist->GetNbinsX();i++){ - integralFrac.push_back(float(noisehist->GetBinContent(i))/ - noisehist->Integral(0,noisehist->GetNbinsX())+integralFrac[i-1]); - //Take the two bins next to 84% and solve for x in 0.84 = mx+b - if (integralFrac[i] >= 0.84135 && integralFrac[i-1] < 0.84135) { - // my quadratic noise calculation - double w = noisehist->GetBinWidth(i); - double a = noisehist->GetBinContent(i-1); - double b = noisehist->GetBinContent(i); - double f = w*(0.84135 -integralFrac[i-1])/(integralFrac[i]-integralFrac[i-1]); - double x = 0; - if (a==b) { - x = f; - } else { - double aa = (b-a)/(2*w); - double bb = (b+a)/2; - double cc = -b*f; - double dd = bb*bb-4*aa*cc; //if (dd<0) dd=0; - x = (-bb+sqrt(dd))/(2*aa); - } - ana->noiseBin84_[iapv][istr] = noisehist->GetBinLowEdge(i) + x; - } - } - // Compare shape of ADC to a histogram made of Gaus Fit for KSProb, Chi2Prob, Etc... - TH1D * FitHisto = new TH1D("FitHisto","FitHisto",noisehist->GetNbinsX(), - -noisehist->GetNbinsX()/2,noisehist->GetNbinsX()/2); - FitHisto->Add(&mygaus); - FitHisto->Sumw2(); - noisehist->Sumw2(); - - if(FitHisto->Integral() > 0){ - // This is stored as a float but will be plotted as an int at the summary histos. - // This forces the histo to draw 10000 bins instead of 1. - ana->ksProb_[iapv][istr] = noisehist->KolmogorovTest(FitHisto)*10000; - } - delete FitHisto; - } - delete noisehist; - } - // Assigning the actual noise values used for Upload!!!!!!!!!!!!!!!!!!!! - if (noiseDef_ == "Bin84") { - if (ana->noiseBin84_[iapv][istr] > 0) { - ana->noise_[iapv][istr] = ana->noiseBin84_[iapv][istr]; - } else { - ana->noise_[iapv][istr] = ana->noiseRMS_[iapv][istr]; - } - } else if (noiseDef_ == "RMS") { - ana->noise_[iapv][istr] = ana->noiseRMS_[iapv][istr]; - } else edm::LogWarning(mlCommissioning_)<< "[PedsFullNoiseAlgorithm::" - << __func__ << "]"<< " Unknown noise definition!!!"; + int stripBin = 0; + if(iStrip >= 128) stripBin = iStrip-128; + else stripBin = iStrip; - // Setting Sum of RMS and RMS^2 for Dead/Noisy Strip calculations - n_sum += ana->noise_[iapv][istr]; - n_sum2 += (ana->noise_[iapv][istr] * ana->noise_[iapv][istr]); - if ( ana->noise_[iapv][istr] > n_max ) { n_max = ana->noise_[iapv][istr]; } - if ( ana->noise_[iapv][istr] < n_min ) { n_min = ana->noise_[iapv][istr]; } + ana->peds_[apvID][stripBin] = histoPeds->GetBinContent(iStrip+1); // pedestal value + ana->noise_[apvID][stripBin] = histoNoiseMean->GetBinContent(iStrip+1); // noise value + ana->raw_[apvID][stripBin] = histoPeds->GetBinError(iStrip+1); // raw noise value + + ana->pedsMean_[apvID] += ana->peds_[apvID][stripBin]; // mean pedestal + ana->rawMean_[apvID] += ana->raw_[apvID][stripBin]; // mean raw noise + ana->noiseMean_[apvID] += ana->noise_[apvID][stripBin]; // mean noise + + // max pedestal + if(ped_max.size() < apvID+1) + ped_max.push_back(ana->peds_[apvID][stripBin]); + else{ + if(ana->peds_[apvID][stripBin] > ped_max.at(apvID)) + ped_max.at(apvID) = ana->peds_[apvID][stripBin]; + } + + // min pedestal + if(ped_min.size() < apvID+1) + ped_min.push_back(ana->peds_[apvID][stripBin]); + else{ + if(ana->peds_[apvID][stripBin] < ped_min.at(apvID)) + ped_min.at(apvID) = ana->peds_[apvID][stripBin]; // min pedestal + } + + // max noise + if(noise_max.size() < apvID+1) + noise_max.push_back(ana->noise_[apvID][stripBin]); + else{ + if(ana->noise_[apvID][stripBin] > noise_max.at(apvID)) + noise_max.at(apvID) = ana->noise_[apvID][stripBin]; + } + + // min noise + if(noise_min.size() < apvID+1) + noise_min.push_back(ana->noise_[apvID][stripBin]); + else{ + if(ana->noise_[apvID][stripBin] < noise_min.at(apvID)) + noise_min.at(apvID) = ana->noise_[apvID][stripBin]; + } + + // max raw + if(raw_max.size() < apvID+1) + raw_max.push_back(ana->raw_[apvID][stripBin]); + else{ + if(ana->raw_[apvID][stripBin] > raw_max.at(apvID)) + raw_max.at(apvID) = ana->raw_[apvID][stripBin]; + } + + // min raw + if(raw_min.size() < apvID+1) + raw_min.push_back(ana->raw_[apvID][stripBin]); + else{ + if(ana->raw_[apvID][stripBin] < raw_min.at(apvID)) + raw_min.at(apvID) = ana->raw_[apvID][stripBin]; + } + } + + // Mean values + for(unsigned int iApv = 0; iApv < ana->pedsMean_.size(); iApv++){ + ana->pedsMean_.at(iApv) /= (ana->peds_[iApv].size()); // calculate mean pedestal per APV + ana->rawMean_.at(iApv) /= (ana->raw_[iApv].size()); // calculate mean raw noise per APV + ana->noiseMean_.at(iApv) /= (ana->noise_[iApv].size()); // calculate mean noise per APV + } + + // Min and Max + for(unsigned int iApv = 0; iApv < ped_max.size(); iApv++){ + if(ped_max.at(iApv) > sistrip::maximum_) + ana->pedsMax_.at(iApv) = sistrip::maximum_; + else if(ped_max.at(iApv) < -1.*sistrip::maximum_) + ana->pedsMax_.at(iApv) = -1.*sistrip::maximum_; + else + ana->pedsMax_.at(iApv) = ped_max.at(iApv); + + if(ped_min.at(iApv) > sistrip::maximum_) + ana->pedsMin_.at(iApv) = sistrip::maximum_; + else if(ped_min.at(iApv) < -1.*sistrip::maximum_) + ana->pedsMin_.at(iApv) = -1.*sistrip::maximum_; + else + ana->pedsMin_.at(iApv) = ped_min.at(iApv); + + if(noise_max.at(iApv) > sistrip::maximum_) + ana->noiseMax_.at(iApv) = sistrip::maximum_; + else if(noise_max.at(iApv) < -1.*sistrip::maximum_) + ana->noiseMax_.at(iApv) = -1.*sistrip::maximum_; + else + ana->noiseMax_.at(iApv) = noise_max.at(iApv); + + if(noise_min.at(iApv) > sistrip::maximum_) + ana->noiseMin_.at(iApv) = sistrip::maximum_; + else if(noise_min.at(iApv) < -1.*sistrip::maximum_) + ana->noiseMin_.at(iApv) = -1.*sistrip::maximum_; + else + ana->noiseMin_.at(iApv) = noise_min.at(iApv); + + if(raw_max.at(iApv) > sistrip::maximum_) + ana->rawMax_.at(iApv) = sistrip::maximum_; + else if(raw_max.at(iApv) < -1.*sistrip::maximum_) + ana->rawMax_.at(iApv) = -1.*sistrip::maximum_; + else + ana->rawMax_.at(iApv) = raw_max.at(iApv); + + if(raw_min.at(iApv) > sistrip::maximum_) + ana->rawMin_.at(iApv) = sistrip::maximum_; + else if(raw_min.at(iApv) < -1.*sistrip::maximum_) + ana->rawMin_.at(iApv) = -1.*sistrip::maximum_; + else + ana->rawMin_.at(iApv) = raw_min.at(iApv); + + } + + // Calculate the spread for noise and pedestal + apvID = -1; + + for(int iStrip = 0; iStrip < histoNoiseMean->GetNbinsX(); iStrip++){ + if(iStrip < histoNoiseMean->GetNbinsX()/2) apvID = 0; + else apvID = 1; + ana->pedsSpread_[apvID] += pow(histoPeds->GetBinContent(iStrip+1)-ana->pedsMean_.at(apvID),2); + ana->noiseSpread_[apvID] += pow(histoNoiseMean->GetBinContent(iStrip+1)-ana->noiseMean_.at(apvID),2); + ana->rawSpread_[apvID] += pow(histoPeds->GetBinError(iStrip+1)-ana->rawMean_.at(apvID),2); + } + + for(unsigned int iApv = 0; iApv < ana->pedsSpread_.size(); iApv++){ + ana->pedsSpread_[iApv] = sqrt(ana->pedsSpread_[iApv])/sqrt(ana->peds_[iApv].size() -1); + ana->noiseSpread_[iApv] = sqrt(ana->noiseSpread_[iApv])/sqrt(ana->noise_[iApv].size()-1); + ana->rawSpread_[iApv] = sqrt(ana->rawSpread_[iApv])/sqrt(ana->raw_[iApv].size() -1); + } + + // loop on each strip in the lldChannel + apvID = 0; + TH1S* histoResidualStrip = new TH1S("histoResidualStrip","",histoNoise->GetNbinsX(),histoNoise->GetXaxis()->GetXmin(),histoNoise->GetXaxis()->GetXmax()); + histoResidualStrip->Sumw2(); + histoResidualStrip->SetDirectory(nullptr); + TF1* fitFunc = new TF1 ("fitFunc","gaus(0)",histoNoise->GetXaxis()->GetXmin(),histoNoise->GetXaxis()->GetXmax()); + TF1* fit2Gaus = nullptr; + TH1F* randomHisto = nullptr; + TFitResultPtr result; + + for(int iStrip = 0; iStrip < histoNoise->GetNbinsY(); iStrip++){ + // tell which APV + if(iStrip < histoNoise->GetNbinsY()/2) apvID = 0; + else apvID = 1; + histoResidualStrip->Reset(); + + int stripBin = 0; + if(iStrip >= 128) stripBin = iStrip-128; + else stripBin = iStrip; + + for(int iBinX = 0; iBinX < histoNoise->GetNbinsX(); iBinX++){ + histoResidualStrip->SetBinContent(iBinX+1,histoNoise->GetBinContent(iBinX+1,iStrip+1)); + histoResidualStrip->SetBinError(iBinX+1,histoNoise->GetBinError(iBinX+1,iStrip+1)); + } + + if(histoResidualStrip->Integral() == 0){ // dead strip --> i.e. no data - } // strip loop - - // Calc mean and rms for peds - if ( !ana->peds_[iapv].empty() ) { - p_sum /= static_cast( ana->peds_[iapv].size() ); - p_sum2 /= static_cast( ana->peds_[iapv].size() ); - ana->pedsMean_[iapv] = p_sum; - ana->pedsSpread_[iapv] = sqrt( fabs(p_sum2 - p_sum*p_sum) ); + // set default values + ana->adProbab_[apvID][stripBin] = 0; + ana->ksProbab_[apvID][stripBin] = 0; + ana->jbProbab_[apvID][stripBin] = 0; + ana->chi2Probab_[apvID][stripBin] = 0; + ana->noiseSignificance_[apvID][stripBin] = 0; + ana->residualMean_[apvID][stripBin] = 0; + ana->residualRMS_[apvID][stripBin] = 0; + ana->residualSigmaGaus_[apvID][stripBin] = 0; + ana->residualSkewness_[apvID][stripBin] = 0; + ana->residualKurtosis_[apvID][stripBin] = 0; + ana->residualIntegralNsigma_[apvID][stripBin] = 0; + ana->residualIntegral_[apvID][stripBin] = 0; + ana->deadStrip_[apvID].push_back(stripBin); + ana->deadStripBit_[apvID][stripBin] = 1; + ana->badStripBit_[apvID][stripBin] = 0; + + SiStripFecKey fec_key(ana->fecKey()); + LogTrace(mlDqmClient_)<<"DeadStrip: fecCrate " + <<" "<residualMean_[apvID][stripBin] = histoResidualStrip->GetMean(); + ana->residualRMS_[apvID][stripBin] = histoResidualStrip->GetRMS(); + ana->residualSkewness_[apvID][stripBin] = histoResidualStrip->GetSkewness(); + ana->residualKurtosis_[apvID][stripBin] = histoResidualStrip->GetKurtosis(); + ana->noiseSignificance_[apvID][stripBin] = (ana->noise_[apvID][stripBin]-ana->noiseMean_[apvID])/ana->noiseSpread_[apvID]; + ana->residualIntegral_[apvID][stripBin] = histoResidualStrip->Integral(); + ana->residualIntegralNsigma_[apvID][stripBin] = + (histoResidualStrip->Integral(histoResidualStrip->FindBin(ana->residualMean_[apvID][stripBin]+ana->residualRMS_[apvID][stripBin]*integralNsigma_),histoResidualStrip->GetNbinsX()+1) + + histoResidualStrip->Integral(0,histoResidualStrip->FindBin(ana->residualMean_[apvID][stripBin]-ana->residualRMS_[apvID][stripBin]*integralNsigma_)))/ana->residualIntegral_[apvID][stripBin]; + + // performing a Gaussian fit of the residual distribution + fitFunc->SetRange(histoNoise->GetXaxis()->GetXmin(),histoNoise->GetXaxis()->GetXmax()); + fitFunc->SetParameters(ana->residualIntegral_[apvID][stripBin],ana->residualMean_[apvID][stripBin],ana->residualRMS_[apvID][stripBin]); + result = histoResidualStrip->Fit(fitFunc,"QSRN"); + + // Good gaussian fit + if(result.Get()){ + + ana->residualSigmaGaus_[apvID][stripBin] = fitFunc->GetParameter(2); + ana->chi2Probab_[apvID][stripBin] = result->Prob(); + + // jacque bera probability + float jbVal = (ana->residualIntegral_[apvID][stripBin]/6)*(pow(ana->residualSkewness_[apvID][stripBin],2)+pow(ana->residualKurtosis_[apvID][stripBin],2)/4); + ana->jbProbab_[apvID][stripBin] = ROOT::Math::chisquared_cdf_c(jbVal,2); + + //Kolmogorov Smirnov and Anderson Darlong + if(randomHisto == nullptr) + randomHisto = (TH1F*) histoResidualStrip->Clone("randomHisto"); + randomHisto->Reset(); + randomHisto->SetDirectory(nullptr); + + if(generateRandomHisto_){/// + randomHisto->FillRandom("fitFunc",histoResidualStrip->Integral()); + if(randomHisto->Integral() != 0){ + ana->ksProbab_[apvID][stripBin] = histoResidualStrip->KolmogorovTest(randomHisto,"N"); + ana->adProbab_[apvID][stripBin] = histoResidualStrip->AndersonDarlingTest(randomHisto); + } + else{ + ana->ksProbab_[apvID][stripBin] = 0; + ana->adProbab_[apvID][stripBin] = 0; + } + + } + else{ + randomHisto->Add(fitFunc); + if(randomHisto->Integral() != 0){ + ana->ksProbab_[apvID][stripBin] = histoResidualStrip->KolmogorovTest(randomHisto,"N"); + ROOT::Fit::BinData data1; + ROOT::Fit::BinData data2; + ROOT::Fit::FillData(data1,histoResidualStrip,nullptr); + data2.Initialize(randomHisto->GetNbinsX()+1,1); + for(int ibin = 0; ibin < randomHisto->GetNbinsX(); ibin++){ + if(histoResidualStrip->GetBinContent(ibin+1) != 0 or randomHisto->GetBinContent(ibin+1) >= 1) + data2.Add(randomHisto->GetBinCenter(ibin+1),randomHisto->GetBinContent(ibin+1),randomHisto->GetBinError(ibin+1)); + } + + double probab, value; + ROOT::Math::GoFTest::AndersonDarling2SamplesTest(data1,data2,probab,value); + ana->adProbab_[apvID][stripBin] = probab; + } + else{ + ana->ksProbab_[apvID][stripBin] = 0; + ana->adProbab_[apvID][stripBin] = 0; + } + } } - // Calc mean and rms for noise using noiseRMS. - if ( !ana->noise_[iapv].empty() ) { - n_sum /= static_cast( ana->noise_[iapv].size() ); - n_sum2 /= static_cast( ana->noise_[iapv].size() ); - ana->noiseMean_[iapv] = n_sum; - ana->noiseSpread_[iapv] = sqrt( fabs(n_sum2 - n_sum*n_sum) ); + // start applying selections storing output + bool badStripFlag = false; + ana->deadStripBit_[apvID][stripBin] = 0; // is not dead if the strip has data + + if(fabs(ana->residualMean_[apvID][stripBin]) > maxDriftResidualCut_ and not badStripFlag) {//mean value + ana->shiftedStrip_[apvID].push_back(stripBin); + badStripFlag = true; + } + + if(ana->residualRMS_[apvID][stripBin] < minStripNoiseCut_ and not badStripFlag){ // low noise + ana->lowNoiseStrip_[apvID].push_back(stripBin); + badStripFlag = true; } - // Calc mean and rms for raw noise - if ( !ana->raw_[iapv].empty() ) { - r_sum /= static_cast( ana->raw_[iapv].size() ); - r_sum2 /= static_cast( ana->raw_[iapv].size() ); - ana->rawMean_[iapv] = r_sum; - ana->rawSpread_[iapv] = sqrt( fabs(r_sum2 - r_sum*r_sum) ); + if(ana->residualRMS_[apvID][stripBin] > maxStripNoiseCut_ and not badStripFlag){ // large noise + ana->largeNoiseStrip_[apvID].push_back(stripBin); + badStripFlag = true; } + + if(fabs(ana->noiseSignificance_[apvID][stripBin]) > maxStripNoiseSignificanceCut_ and not badStripFlag){ // large noise significance + ana->largeNoiseSignificance_[apvID].push_back(stripBin); + badStripFlag = true; + } + + if(result.Get() and result->Status() != 0) // bad fit status + ana->badFitStatus_[apvID].push_back(stripBin); + + if(ana->adProbab_[apvID][stripBin] < adProbabCut_ and not badStripFlag) // bad AD p-value --> store the strip-id + ana->badADProbab_[apvID].push_back(stripBin); + + if(ana->ksProbab_[apvID][stripBin] < ksProbabCut_ and not badStripFlag) // bad KS p-value --> store the strip-id + ana->badKSProbab_[apvID].push_back(stripBin); + + if(ana->jbProbab_[apvID][stripBin] < jbProbabCut_ and not badStripFlag) // bad JB p-value --> store the strip-id + ana->badJBProbab_[apvID].push_back(stripBin); + + if(ana->chi2Probab_[apvID][stripBin] < chi2ProbabCut_ and not badStripFlag) // bad CHI2 p-value --> store the strip-id + ana->badChi2Probab_[apvID].push_back(stripBin); + + if(ana->adProbab_[apvID][stripBin] < adProbabCut_ and ana->ksProbab_[apvID][stripBin] < ksProbabCut_ and + ana->jbProbab_[apvID][stripBin] < jbProbabCut_ and ana->chi2Probab_[apvID][stripBin] < chi2ProbabCut_) + badStripFlag = true; // bad strip is flagged as bad by all the methods + + if(ana->residualKurtosis_[apvID][stripBin] > kurtosisCut_ and ana->residualIntegralNsigma_[apvID][stripBin] > integralTailCut_ and not badStripFlag){ // bad tails + ana->badTailStrip_[apvID].push_back(stripBin); + badStripFlag = true; + } + + if(badStripFlag){ // loop for double peaked - // Set max and min values for peds, noise and raw noise - if ( p_max > -1.*sistrip::maximum_ ) { ana->pedsMax_[iapv] = p_max; } - if ( p_min < 1.*sistrip::maximum_ ) { ana->pedsMin_[iapv] = p_min; } - if ( n_max > -1.*sistrip::maximum_ ) { ana->noiseMax_[iapv] = n_max; } - if ( n_min < 1.*sistrip::maximum_ ) { ana->noiseMin_[iapv] = n_min; } - if ( r_max > -1.*sistrip::maximum_ ) { ana->rawMax_[iapv] = r_max; } - if ( r_min < 1.*sistrip::maximum_ ) { ana->rawMin_[iapv] = r_min; } - - // Set dead and noisy strips - for ( uint16_t istr = 0; istr < 128; istr++ ) { // strip loop - // Set the significance of the noise of each strip also compared to apv avg. - ana->noiseSignif_[iapv][istr] = (ana->noise_[iapv][istr]-ana->noiseMean_[iapv])/ana->noiseSpread_[iapv]; - if ( ana->noiseMin_[iapv] > sistrip::maximum_ || ana->noiseMax_[iapv] > sistrip::maximum_ ) { - continue; - } - // Strip Masking for Dead Strips - if(ana->noiseSignif_[iapv][istr] < -deadStripMax_){ - ana->dead_[iapv].push_back(istr); - SiStripFecKey fec_key(ana->fecKey()); - LogTrace(mlDqmClient_)<<"DeadSignif "<noiseSignif_[iapv][istr] - <<" "<noiseMax_[iapv]/ana->noiseMean_[iapv] > 3 || ana->noiseSpread_[iapv] > 3) - && ana->noiseSignif_[iapv][istr] > 1){ - ana->noisy_[iapv].push_back(istr); - SiStripFecKey fec_key(ana->fecKey()); - LogTrace(mlDqmClient_)<<"NoisyLM "<noiseMax_[iapv]/ana->noiseMean_[iapv] - <<" "<ksProb_[iapv][istr] < ksProbCut_){ - ana->noisy_[iapv].push_back(istr); - SiStripFecKey fec_key(ana->fecKey()); - LogTrace(mlDqmClient_)<<"NoisyKS "<ksProb_[iapv][istr] - <<" "<noiseSignif_[iapv][istr] > noisyStripMin_){ - ana->noisy_[iapv].push_back(istr); - SiStripFecKey fec_key(ana->fecKey()); - LogTrace(mlDqmClient_)<<"NoisySignif "<noiseSignif_[iapv][istr] - <<" "<GetXaxis()->GetXmin(),histoNoise->GetXaxis()->GetXmax()); + fit2Gaus->SetParameter(0,fitFunc->GetParameter(0)/2); + fit2Gaus->SetParameter(3,fitFunc->GetParameter(0)/2); + fit2Gaus->SetParameter(1,1.); + fit2Gaus->SetParameter(4,-1.); + fit2Gaus->SetParameter(2,fitFunc->GetParameter(2)); + fit2Gaus->SetParameter(5,fitFunc->GetParameter(2)); + fit2Gaus->SetParLimits(1,0.,histoNoise->GetXaxis()->GetXmax()); + fit2Gaus->SetParLimits(4,histoNoise->GetXaxis()->GetXmin(),0); + result = histoResidualStrip->Fit(fit2Gaus,"QSR"); + + // ashman distance + float ashman = TMath::Power(2,0.5)*abs(fit2Gaus->GetParameter(1)-fit2Gaus->GetParameter(4))/(sqrt(pow(fit2Gaus->GetParameter(2),2)+pow(fit2Gaus->GetParameter(5),2))); + // amplitude + float amplitudeRatio = std::min(fit2Gaus->GetParameter(0),fit2Gaus->GetParameter(3))/std::max(fit2Gaus->GetParameter(0),fit2Gaus->GetParameter(3)); + + if(ashman > ashmanDistance_ and amplitudeRatio > amplitudeRatio_) + ana->badDoublePeakStrip_[apvID].push_back(stripBin); + } + + if(badStripFlag){ // save the final bit + + ana->badStrip_[apvID].push_back(stripBin); + ana->badStripBit_[apvID][stripBin] = 1; + + SiStripFecKey fec_key(ana->fecKey()); + LogTrace(mlDqmClient_)<<"BadStrip: fecCrate " + <<" "<badStripBit_[apvID][stripBin] = 0; + } + + + ped_max.clear(); + ped_min.clear(); + raw_max.clear(); + raw_min.clear(); + noise_max.clear(); + noise_min.clear(); + if(histoResidualStrip) delete histoResidualStrip; + if(fitFunc) delete fitFunc; + if(randomHisto) delete randomHisto; + if(fit2Gaus) delete fit2Gaus; + } diff --git a/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc b/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc index c26b6a06d6168..b6ca37a74fac5 100644 --- a/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc +++ b/DQM/SiStripCommissioningAnalysis/src/SiStripPulseShape.cc @@ -2,31 +2,121 @@ #include #include -double fpeak(double *x, double *par) +/* New Pulse Shape Fit by G. Auzinger June 2017 +following methods are used to describe a pulse shape for a 3 stage CR-CR-RC pre-amplifier (CR) ++ shaper (CR + RC) with time constants x, y, z respectively +some special cases (x=0. y=z, x=0 && y=z) are considered (divergence of equation) and +the shaper CR y is approximated via a pol(6) of x which gives a resonable respresentation and +reduces the number of free parameters -- this shape is derived from first principle and can +be used to fit peak mode signals and deconvolution mode signals +following parameters are added in addition to the time constants x, z: +a_0 ... baseline offset amplitude +s ... scale parameter +t_0 ... turn_on time of the pulse +par[5] ... scale parameter for the time slices in deco mode +*/ + + +double pulse_raw(double x, double y, double z, double t) +{ + double result1, result2, result3; + + result1 = z * y * exp(-t / y); + result1/= pow(y,2) - (x + z) * y + z * x; + + result2 = z * x * exp(-t / x); + result2/= pow(x,2) - (x - z) * y - z * x; + + result3 = pow(z,2) * exp(-t / z); + result3/= pow(z,2) + (x - z) * y - z * x; + + return result1 + result2 + result3; +} + +double pulse_x0(double y, double z, double t) +{ + return z / (y - z) * (exp(-t / y) - exp(-t / z)); +} + +double pulse_yz(double x, double z, double t) +{ + double result1, result2; + + result1 = exp(-t / x) - exp(-t / z); + result1*= z * x / (z - x); + + result2 = t * exp(-t / z); + + return (result1 + result2) / (z - x); +} + +double pulse_x0_yz(double z, double t) +{ + return t / z * exp(-t / z); +} + +double pulse(double x, double y, double z, double t) +{ + if(x > y) { - if(x[0]+par[1]<0) return par[0]; - return par[0]+par[2]*(x[0]+par[1])*TMath::Exp(-(x[0]+par[1])/par[3]); + double pivot = x; + x = y; + y = pivot; } + if((x == 0) && (y == z)) return pulse_x0_yz(z, t); + + else if(x == 0) return pulse_x0(y, z, t); + + else if(y == z) return pulse_yz(x, z, t); + + else return pulse_raw(x, y, z, t); +} + +double get_compensation(double x) +{ + return 49.9581 + - 1.7941 * x + - 0.110089 * pow(x,2) + + 0.0113809 * pow(x,3) + - 0.000388111 * pow(x,4) + + 5.9761e-6 * pow(x,5) + - 3.51805e-8 * pow(x,6); +} + +double fpeak(double *x, double *par) +{ + double xx = par[0]; + double z = par[1]; + double a_0 = par[2]; + double s = par[3]; + double t_0 = par[4]; + double t = x[0] - t_0; + + double y = get_compensation(xx); + + if(x[0] < t_0) return a_0; + return a_0 + s * pulse(xx, y, z, t); +} + double fdeconv(double *x, double *par) - { - double xm = par[4]*(x[0]-25); - double xp = par[4]*(x[0]+25); - double xz = par[4]*x[0]; - return 1.2131*fpeak(&xp,par)-1.4715*fpeak(&xz,par)+0.4463*fpeak(&xm,par); - } +{ + double xm = par[5]*(x[0]-25); + double xp = par[5]*(x[0]+25); + double xz = par[5]*x[0]; + return 1.2131 * fpeak(&xp,par) - 1.4715 * fpeak(&xz,par) + 0.4463 * fpeak(&xm,par); +} double fpeak_convoluted(double *x, double *par) - { - TF1 f("peak_convoluted",fpeak,0,200,4); - return f.IntegralError(x[0]-par[4]/2.,x[0]+par[4]/2.,par,nullptr,1.)/(par[4]); - } +{ + TF1 f("peak_convoluted",fpeak,0,200,4); + return f.IntegralError(x[0]-par[4]/2.,x[0]+par[4]/2.,par,nullptr,1.)/(par[4]); +} double fdeconv_convoluted(double *x, double *par) - { - double xm = (x[0]-25); - double xp = (x[0]+25); - double xz = x[0]; - return 1.2131*fpeak_convoluted(&xp,par)-1.4715*fpeak_convoluted(&xz,par)+0.4463*fpeak_convoluted(&xm,par); - } - +{ + double xm = (x[0]-25); + double xp = (x[0]+25); + double xz = x[0]; + return 1.2131*fpeak_convoluted(&xp,par)-1.4715*fpeak_convoluted(&xz,par)+0.4463*fpeak_convoluted(&xm,par); +} diff --git a/DQM/SiStripCommissioningClients/data/summary.xml b/DQM/SiStripCommissioningClients/data/summary.xml index 83b4f7ca326f1..2640d069a1e4d 100644 --- a/DQM/SiStripCommissioningClients/data/summary.xml +++ b/DQM/SiStripCommissioningClients/data/summary.xml @@ -95,27 +95,52 @@ - + + + + + + + + + - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h b/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h index ff8283e51492b..6c18e147d82a0 100644 --- a/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h @@ -113,7 +113,7 @@ class CommissioningHistograms { inline DQMStore* const bei() const; - inline Analyses& data(); + Analyses& data(bool getMaskedData = false); inline Factory* const factory(); @@ -154,6 +154,17 @@ class CommissioningHistograms { FedToFecMap mapping_; edm::ParameterSet pset_; + + bool mask_; + std::vector fedMaskVector_; + std::vector fecMaskVector_; + std::vector ringVector_; + std::vector ccuVector_; + std::vector i2cChanVector_; + std::vector lldChanVector_; + + Analyses dataWithMask_; + bool dataWithMaskCached_; }; @@ -161,7 +172,6 @@ class CommissioningHistograms { const sistrip::RunType& CommissioningHistograms::task() const { return task_; } DQMStore* const CommissioningHistograms::bei() const { return bei_; } -CommissioningHistograms::Analyses& CommissioningHistograms::data() { return data_; } CommissioningHistograms::Factory* const CommissioningHistograms::factory() { return factory_.get(); } const CommissioningHistograms::HistosMap& CommissioningHistograms::histos() const { return histos_; } const CommissioningHistograms::FedToFecMap& CommissioningHistograms::mapping() const { return mapping_; } diff --git a/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc b/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc index f51797da6a47f..943cabf16e4e5 100644 --- a/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc @@ -22,7 +22,16 @@ CommissioningHistograms::CommissioningHistograms( const edm::ParameterSet& pset, bei_(bei), data_(), histos_(), - pset_(pset) + pset_(pset), + mask_(pset.existsAs("vetoModules")?pset.getParameter("vetoModules"):true), + fedMaskVector_(pset.existsAs >("fedMaskVector")?pset.getParameter >("fedMaskVector"):std::vector()), + fecMaskVector_(pset.existsAs >("fecMaskVector")?pset.getParameter >("fecMaskVector"):std::vector()), + ringVector_(pset.existsAs >("ringVector")?pset.getParameter >("ringVector"):std::vector()), + ccuVector_(pset.existsAs >("ccuVector")?pset.getParameter >("ccuVector"):std::vector()), + i2cChanVector_(pset.existsAs >("i2cChanVector")?pset.getParameter >("i2cChanVector"):std::vector()), + lldChanVector_(pset.existsAs >("lldChanVector")?pset.getParameter >("lldChanVector"):std::vector()), + dataWithMask_(), + dataWithMaskCached_(false) { LogTrace(mlDqmClient_) << "[" << __PRETTY_FUNCTION__ << "]" @@ -45,8 +54,11 @@ CommissioningHistograms::CommissioningHistograms() task_(sistrip::UNDEFINED_RUN_TYPE), bei_(nullptr), data_(), - histos_() -{ + histos_(), + mask_(true), + dataWithMask_(), + dataWithMaskCached_(false){ + LogTrace(mlDqmClient_) << "[" << __PRETTY_FUNCTION__ << "]" << " Constructing object..."; @@ -797,3 +809,39 @@ TH1* CommissioningHistograms::histogram( const sistrip::Monitorable& mon, } +CommissioningHistograms::Analyses& CommissioningHistograms::data(bool getMaskedData) { + if (!getMaskedData) return data_; + else { + if (dataWithMaskCached_) return dataWithMask_; + else { + Analyses::iterator ianal = data_.begin(); + Analyses::iterator janal = data_.end(); + for ( ; ianal != janal; ++ianal ) { + CommissioningAnalysis* anal = ianal->second; + SiStripFedKey fedkey = anal->fedKey(); + SiStripFecKey feckey = anal->fecKey(); + bool maskThisAnal_ = false; + for (std::size_t i = 0; i < fedMaskVector_.size(); i++) { + if (fedkey.fedId() == fedMaskVector_[i]) maskThisAnal_ = true; + } + for (std::size_t i = 0; i < fecMaskVector_.size(); i++) { + if (fecMaskVector_.size() != ringVector_.size() || fecMaskVector_.size() != ccuVector_.size() || fecMaskVector_.size() != i2cChanVector_.size() || fecMaskVector_.size() != lldChanVector_.size()) { + continue; + } + if (feckey.fecSlot() == fecMaskVector_[i] && + feckey.fecRing() == ringVector_[i] && + feckey.ccuAddr() == ccuVector_[i] && + feckey.ccuChan() == i2cChanVector_[i] && + feckey.lldChan() == lldChanVector_[i]) { + maskThisAnal_ = true; + } + } + if (mask_ && !maskThisAnal_) dataWithMask_[ianal->first] = ianal->second; + else if (!mask_ && maskThisAnal_) dataWithMask_[ianal->first] = ianal->second; + } + dataWithMaskCached_ = true; + return dataWithMask_; + } + } +} + diff --git a/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc b/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc index f2a94860983c6..74caa1b8635b7 100644 --- a/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc @@ -21,6 +21,7 @@ PedsFullNoiseHistograms::PedsFullNoiseHistograms( const edm::ParameterSet& pset, bei, sistrip::PEDS_FULL_NOISE ) { + factory_ = auto_ptr( new PedsFullNoiseSummaryFactory ); LogTrace(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" @@ -38,6 +39,7 @@ PedsFullNoiseHistograms::~PedsFullNoiseHistograms() { // ----------------------------------------------------------------------------- /** */ void PedsFullNoiseHistograms::histoAnalysis( bool debug ) { + LogTrace(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]"; @@ -52,11 +54,11 @@ void PedsFullNoiseHistograms::histoAnalysis( bool debug ) { if ( ianal->second ) { delete ianal->second; } } data().clear(); - + // Iterate through map containing histograms for ( iter = histos().begin(); iter != histos().end(); iter++ ) { - + // Check vector of histos is not empty if ( iter->second.empty() ) { edm::LogWarning(mlDqmClient_) @@ -68,30 +70,31 @@ void PedsFullNoiseHistograms::histoAnalysis( bool debug ) { // Retrieve pointers to peds and noise histos std::vector hists; Histos::const_iterator ihis = iter->second.begin(); + for ( ; ihis != iter->second.end(); ihis++ ) { - // pedestal profiles + // pedestal and noise 1D profiles TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { hists.push_back(prof); } - //@@ Common mode histos?... - //TH1F* his = ExtractTObject().extract( (*ihis)->me_ ); - //if ( his ) { profs.push_back(his); } - // noise 2D histos + if ( prof ) { hists.push_back(prof); + } + // 2D noise histograms TH2S * his2D = ExtractTObject().extract( (*ihis)->me_ ); - if ( his2D ) { hists.push_back(his2D); } + if ( his2D ) { + hists.push_back(his2D); } } // Perform histo analysis PedsFullNoiseAnalysis * anal = new PedsFullNoiseAnalysis( iter->first ); - PedsFullNoiseAlgorithm algo( this->pset(), anal ); + PedsFullNoiseAlgorithm algo( this->pset(), anal ); algo.analysis( hists ); + data()[iter->first] = anal; - if ( anal->isValid() ) { valid++; } - if ( !anal->getErrorCodes().empty() ) { + if (anal->isValid() ) { valid++; } + if (!anal->getErrorCodes().empty() ) { errors[anal->getErrorCodes()[0]]++; - } + } } - + if ( !histos().empty() ) { edm::LogVerbatim(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" @@ -118,10 +121,10 @@ void PedsFullNoiseHistograms::histoAnalysis( bool debug ) { edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" << " No histograms to analyze!"; - } - + } + } - + // ----------------------------------------------------------------------------- /** */ void PedsFullNoiseHistograms::printAnalyses() { diff --git a/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc b/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc index b9736210b719e..12fc888f0f99d 100644 --- a/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc +++ b/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc @@ -10,6 +10,7 @@ #include "DQM/SiStripCommissioningClients/interface/VpspScanHistograms.h" #include "DQM/SiStripCommissioningClients/interface/PedestalsHistograms.h" #include "DQM/SiStripCommissioningClients/interface/PedsOnlyHistograms.h" +#include "DQM/SiStripCommissioningClients/interface/PedsFullNoiseHistograms.h" #include "DQM/SiStripCommissioningClients/interface/NoiseHistograms.h" #include "DQM/SiStripCommissioningClients/interface/SamplingHistograms.h" #include "DQM/SiStripCommissioningClients/interface/CalibrationHistograms.h" @@ -401,6 +402,7 @@ void SiStripCommissioningOfflineClient::createHistos( const edm::ParameterSet& p else if ( runType_ == sistrip::OPTO_SCAN ) { histos_ = new OptoScanHistograms( pset, bei_ ); } else if ( runType_ == sistrip::VPSP_SCAN ) { histos_ = new VpspScanHistograms( pset, bei_ ); } else if ( runType_ == sistrip::PEDESTALS ) { histos_ = new PedestalsHistograms( pset, bei_ ); } + else if ( runType_ == sistrip::PEDS_FULL_NOISE ) { histos_ = new PedsFullNoiseHistograms( pset, bei_ ); } else if ( runType_ == sistrip::PEDS_ONLY ) { histos_ = new PedsOnlyHistograms( pset, bei_ ); } else if ( runType_ == sistrip::NOISE ) { histos_ = new NoiseHistograms( pset, bei_ ); } else if ( runType_ == sistrip::APV_LATENCY || diff --git a/DQM/SiStripCommissioningDbClients/interface/ApvTimingHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/ApvTimingHistosUsingDb.h index e67c58cecb0c2..72cc1e0173963 100644 --- a/DQM/SiStripCommissioningDbClients/interface/ApvTimingHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/ApvTimingHistosUsingDb.h @@ -29,7 +29,8 @@ class ApvTimingHistosUsingDb : public CommissioningHistosUsingDb, public ApvTimi bool skipFecUpdate_; // switch for uploading the frame finding thresholds bool skipFedUpdate_; - + // Perform a selective upload either for or excluding a certain set of FEDs + bool allowSelectiveUpload_; }; diff --git a/DQM/SiStripCommissioningDbClients/interface/OptoScanHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/OptoScanHistosUsingDb.h index 55c277c32f610..e56d53072ee53 100644 --- a/DQM/SiStripCommissioningDbClients/interface/OptoScanHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/OptoScanHistosUsingDb.h @@ -25,6 +25,8 @@ class OptoScanHistosUsingDb : public CommissioningHistosUsingDb, public OptoScan // parameters bool skipGainUpdate_; + // Perform a selective upload either for or excluding a certain set of FEDs + bool allowSelectiveUpload_; }; diff --git a/DQM/SiStripCommissioningDbClients/interface/PedestalsHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/PedestalsHistosUsingDb.h index 3808cc096ee20..2b72e26735ec5 100644 --- a/DQM/SiStripCommissioningDbClients/interface/PedestalsHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/PedestalsHistosUsingDb.h @@ -28,6 +28,8 @@ class PedestalsHistosUsingDb : public CommissioningHistosUsingDb, public Pedesta float lowThreshold_; bool disableBadStrips_; bool keepStripsDisabled_; + // Perform a selective upload either for or excluding a certain set of FEDs + bool allowSelectiveUpload_; }; diff --git a/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h index cb75cc4e705a4..9070635ad1b59 100644 --- a/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/PedsFullNoiseHistosUsingDb.h @@ -24,12 +24,18 @@ class PedsFullNoiseHistosUsingDb : public CommissioningHistosUsingDb, public Ped void create( SiStripConfigDb::AnalysisDescriptionsV&, Analysis ) override; // parameters - float highThreshold_; - float lowThreshold_; - bool disableBadStrips_; - bool keepStripsDisabled_; - bool addBadStrips_; - + float highThreshold_; // higher threshold for the zero suppression + float lowThreshold_; // lower threshold for the zero suppression + bool disableBadStrips_; // to disable bad strips flagged by the analysis in the upload + bool keepStripsDisabled_; // keep bad strips from previous runs as bad + bool skipEmptyStrips_; // skip empty strips i.e. don't flag as bad + bool uploadOnlyStripBadChannelBit_; + + // Perform a selective upload either for or excluding a certain set of FEDs + bool allowSelectiveUpload_; + + /////// + bool uploadPedsFullNoiseDBTable_; }; #endif // DQM_SiStripCommissioningClients_PedsFullNoiseHistosUsingDb_H diff --git a/DQM/SiStripCommissioningDbClients/interface/VpspScanHistosUsingDb.h b/DQM/SiStripCommissioningDbClients/interface/VpspScanHistosUsingDb.h index 580a57a7a400f..1d3c3390ef0bf 100644 --- a/DQM/SiStripCommissioningDbClients/interface/VpspScanHistosUsingDb.h +++ b/DQM/SiStripCommissioningDbClients/interface/VpspScanHistosUsingDb.h @@ -22,6 +22,9 @@ class VpspScanHistosUsingDb : public CommissioningHistosUsingDb, public VpspScan void update( SiStripConfigDb::DeviceDescriptionsRange ); void create( SiStripConfigDb::AnalysisDescriptionsV&, Analysis ) override; + + // Perform a selective upload either for or excluding a certain set of FEDs + bool allowSelectiveUpload_; }; diff --git a/DQM/SiStripCommissioningDbClients/python/OfflineDbClient_cff.py b/DQM/SiStripCommissioningDbClients/python/OfflineDbClient_cff.py index 4242f7c885e6d..a6d9d073340a5 100644 --- a/DQM/SiStripCommissioningDbClients/python/OfflineDbClient_cff.py +++ b/DQM/SiStripCommissioningDbClients/python/OfflineDbClient_cff.py @@ -33,25 +33,43 @@ SkipGainUpdate = cms.bool(False) # wether to keep the gain the same as already on the db ), PedestalsParameters = cms.PSet( - DeadStripMax = cms.double(10), # number times the noise spread below mean noise - NoisyStripMin = cms.double(10), # number times the noise spread above mean noise + DeadStripMax = cms.double(10), # number times the noise spread below mean noise + NoisyStripMin = cms.double(10), # number times the noise spread above mean noise HighThreshold = cms.double(5), # analysis-wide high threshold for the fed zero suppression LowThreshold = cms.double(2), # analysis-wide low threshold for the fed zero suppression DisableBadStrips = cms.bool(False), # for experts! disables bad strips on the fed level - AddBadStrips = cms.bool(False), #for experts! keep and add disabled bad strips. - KeepsStripsDisabled = cms.bool(False) # for experts! keep strips disabled as in the db's current state + AddBadStrips = cms.bool(False), #for experts! keep and add disabled bad strips. + KeepStripsDisabled = cms.bool(False) # for experts! keep strips disabled as in the db's current state ), PedsOnlyParameters = cms.PSet(), + ### Bad channel analysis PedsFullNoiseParameters = cms.PSet( - DeadStripMax = cms.double(10), # number times the noise spread below mean noise - NoisyStripMin = cms.double(10), # number times the noise spread above mean noise - HighThreshold = cms.double(5), # analysis-wide high threshold for the fed zero suppression - LowThreshold = cms.double(2), # analysis-wide low threshold for the fed zero suppression - KsProbCut = cms.double(10), - DisableBadStrips = cms.bool(False), # for experts! disables bad strips on the fed level - AddBadStrips = cms.bool(False), #for experts! keep and add disabled bad strips. - KeepsStripsDisabled = cms.bool(False) # for experts! keeps strip disabling as in the db's current state - ), + #### selections used to define a bad strip + MaxDriftResidualCut = cms.double(20), ### the strip baseline can drift during run .. if more then N ADC count, mark the strip as bad + MinStripNoiseCut = cms.double(2), ### if a strip has a noise value less the N ADC, mark as low noisy i.e. bad + MaxStripNoiseCut = cms.double(30), ### if a strip has a noise value larger than N ADC, mark strip has high noisy i.e. bad + MaxStripNoiseSignificanceCut = cms.double(10), ## if a strip has a noise significance larger than N, mark it as bad + AdProbabCut = cms.double(0.002699796063), ### this is 3 sigma quantile selection on the AndersonDarling p-value + KsProbabCut = cms.double(0.002699796063), ### this is 3 sigma quantile selection on the Kolmogorov Smirnov p-value + GenerateRandomHisto = cms.bool(False), ### random sampling of the gaussian fit or not while computing p-values + JbProbabCut = cms.double(0.000000573303), ### this is 3 sigma quantile selection on the jacque-Bera p-value + Chi2ProbabCut = cms.double(0.000000573303), ### this is 3 sigma quantile selection on the chi2 p-value (from a Gaussian fit) + KurtosisCut = cms.double(2), ### max value of kurtosis to identify strips with long tails + IntegralNsigma = cms.int32(5), ### this is expressed in terms of number of gaussian quantiles .. 5 means take the integral 5-sigma from the peak + IntegralTailCut = cms.double(0.0005), ### selection on the N-sigma integral + AshmanDistance = cms.double(2), ### to flag double peaked strips + AmplitudeRatio = cms.double(0.85), ### to flag double peaked strips + #### Zero suppression information + HighThreshold = cms.double(5), ### analysis-wide high threshold for the fed zero suppression + LowThreshold = cms.double(2), ### analysis-wide low threshold for the fed zero suppression + #### Flags on bad strips + DisableBadStrips = cms.bool(True), ### When the upload is performed, strips are masked in case they are flagged by the analysis + KeepStripsDisabled = cms.bool(False), ### True: if a strip is already flagged bad in the db, it will be kept bad; False: if a strip was bad, now the analysis will tell us if it's bad or not + UploadOnlyStripBadChannelBit = cms.bool(False), ### True: means that pedestal and noise values are not changed in the FED version --> use old values + SkipEmptyStrips = cms.bool(True), ### In the analysis, if true strips with no data are not marked as bad but as dead --> could be mis-configured at the time of the run, not masked + UploadPedsFullNoiseDBTable = cms.bool(False) ### Tell whether the PedsFullNoise DB table needs to be uploaded --> for the time being this can be done ONLY on the oracle test account. + ), SamplingParameters = cms.PSet(), VpspScanParameters = cms.PSet(), ) + diff --git a/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc index 4ad8d018c6949..96cc8b296df76 100644 --- a/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/ApvTimingHistosUsingDb.cc @@ -35,6 +35,13 @@ ApvTimingHistosUsingDb::ApvTimingHistosUsingDb( const edm::ParameterSet & pset, LogTrace(mlDqmClient_) << "[ApvTimingHistosUsingDb::" << __func__ << "]" << " Skipping update of FED parameters."; + + allowSelectiveUpload_ = this->pset().existsAs("doSelectiveUpload")?this->pset().getParameter("doSelectiveUpload"):false; + if (allowSelectiveUpload_) + LogTrace(mlDqmClient_) + << "[ApvTimingHistosUsingDb::" << __func__ << "]" + << " Enabling selective update of FED parameters."; + } // ----------------------------------------------------------------------------- @@ -163,8 +170,8 @@ bool ApvTimingHistosUsingDb::update( SiStripConfigDb::DeviceDescriptionsRange de fec_path = fec_key; // Locate appropriate analysis object - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { ApvTimingAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { @@ -314,8 +321,8 @@ void ApvTimingHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds conn.lldChannel() ); // Locate appropriate analysis object - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { ApvTimingAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { diff --git a/DQM/SiStripCommissioningDbClients/src/CalibrationHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/CalibrationHistosUsingDb.cc index 2265b4ace746c..1f7fd5351330f 100644 --- a/DQM/SiStripCommissioningDbClients/src/CalibrationHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/CalibrationHistosUsingDb.cc @@ -1,4 +1,3 @@ - #include "DQM/SiStripCommissioningDbClients/interface/CalibrationHistosUsingDb.h" #include "CondFormats/SiStripObjects/interface/CalibrationAnalysis.h" #include "DataFormats/SiStripCommon/interface/SiStripConstants.h" diff --git a/DQM/SiStripCommissioningDbClients/src/OptoScanHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/OptoScanHistosUsingDb.cc index 7a805b53d12cd..72b91373afd7b 100644 --- a/DQM/SiStripCommissioningDbClients/src/OptoScanHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/OptoScanHistosUsingDb.cc @@ -29,6 +29,13 @@ OptoScanHistosUsingDb::OptoScanHistosUsingDb( const edm::ParameterSet & pset, LogTrace(mlDqmClient_) << "[OptoScanHistosUsingDb::" << __func__ << "]" << " Skipping db update of gain parameters."; + + allowSelectiveUpload_ = this->pset().existsAs("doSelectiveUpload")?this->pset().getParameter("doSelectiveUpload"):false; + if (allowSelectiveUpload_) + LogTrace(mlDqmClient_) + << "[OptoScanHistosUsingDb::" << __func__ << "]" + << " Enabling selective upload of gain parameters"; + } // ----------------------------------------------------------------------------- @@ -102,8 +109,8 @@ void OptoScanHistosUsingDb::update( SiStripConfigDb::DeviceDescriptionsRange dev ichan+1 ); // Iterate through all channels and extract LLD settings - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { OptoScanAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { diff --git a/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc index 3827255d879cd..d090cb91dad62 100644 --- a/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/PedestalsHistosUsingDb.cc @@ -37,6 +37,11 @@ PedestalsHistosUsingDb::PedestalsHistosUsingDb( const edm::ParameterSet & pset, << "[PedestalsHistosUsingDb::" << __func__ << "]" << " Disabling strips: " << disableBadStrips_ << " ; keeping previously disabled strips: " << keepStripsDisabled_; + + allowSelectiveUpload_ = this->pset().existsAs("doSelectiveUpload")?this->pset().getParameter("doSelectiveUpload"):false; + LogTrace(mlDqmClient_) + << "[PedestalsHistosUsingDb::" << __func__ << "]" + << " Selective upload of modules set to : " << allowSelectiveUpload_; } // ----------------------------------------------------------------------------- @@ -111,9 +116,14 @@ void PedestalsHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds conn.lldChannel() ); // Locate appropriate analysis object - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { - + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { + + // Check if analysis is valid + if ( !iter->second->isValid() ) { + continue; + } + PedestalsAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { edm::LogError(mlDqmClient_) @@ -127,8 +137,12 @@ void PedestalsHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds for ( uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++ ) { uint32_t pedmin = (uint32_t) anal->pedsMin()[iapv]; pedshift = pedmin < pedshift ? pedmin : pedshift; - } - + std::stringstream ss; + ss << "iapv: " << iapv << " pedsMin()[iapv]: " << anal->pedsMin()[iapv] << " pedmin: " << pedmin << " pedshift: " << pedshift; + edm::LogWarning(mlDqmClient_) << ss.str(); + } + + // Iterate through APVs and strips for ( uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++ ) { for ( uint16_t istr = 0; istr < anal->peds()[iapv].size(); istr++ ) { @@ -137,6 +151,24 @@ void PedestalsHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange feds Fed9U::Fed9UAddress addr( ichan, iapv, istr ); Fed9U::Fed9UStripDescription temp = (*ifed)->getFedStrips().getStrip( addr ); + + if ( anal->peds()[iapv][istr] < 1.e-6 ) { //@@ ie, zero + edm::LogWarning(mlDqmClient_) + << "[PedestalsHistosUsingDb::" << __func__ << "]" + << " Skipping ZERO pedestal value (ie, NO UPLOAD TO DB!) for FedKey/Id/Ch: " + << hex << setw(8) << setfill('0') << fed_key.key() << dec << "/" + << (*ifed)->getFedId() << "/" + << ichan + << " and device with FEC/slot/ring/CCU/LLD " + << fec_key.fecCrate() << "/" + << fec_key.fecSlot() << "/" + << fec_key.fecRing() << "/" + << fec_key.ccuAddr() << "/" + << fec_key.ccuChan() << "/" + << fec_key.channel(); + continue; //@@ do not upload + } + // determine whether we need to disable the strip bool disableStrip = false; if ( keepStripsDisabled_ ) { diff --git a/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc index b318d3f2c56d9..468f3909b77c3 100644 --- a/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/PedsFullNoiseHistosUsingDb.cc @@ -14,30 +14,40 @@ using namespace sistrip; PedsFullNoiseHistosUsingDb::PedsFullNoiseHistosUsingDb( const edm::ParameterSet & pset, DQMStore* bei, SiStripConfigDb* const db ) - : CommissioningHistograms( pset.getParameter("PedsFullNoiseParameters"), - bei, - sistrip::PEDS_FULL_NOISE ), - CommissioningHistosUsingDb( db, - sistrip::PEDS_FULL_NOISE ), - PedsFullNoiseHistograms( pset.getParameter("PedsFullNoiseParameters"), - bei ) + : CommissioningHistograms(pset.getParameter("PedsFullNoiseParameters"),bei,sistrip::PEDS_FULL_NOISE ), + CommissioningHistosUsingDb(db,sistrip::PEDS_FULL_NOISE ), + PedsFullNoiseHistograms( pset.getParameter("PedsFullNoiseParameters"),bei ) { - LogTrace(mlDqmClient_) + + LogTrace(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " Constructing object..."; + highThreshold_ = this->pset().getParameter("HighThreshold"); - lowThreshold_ = this->pset().getParameter("LowThreshold"); + lowThreshold_ = this->pset().getParameter("LowThreshold"); + LogTrace(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " Set FED zero suppression high/low threshold to " << highThreshold_ << "/" << lowThreshold_; - disableBadStrips_ = this->pset().getParameter("DisableBadStrips"); + + disableBadStrips_ = this->pset().getParameter("DisableBadStrips"); keepStripsDisabled_ = this->pset().getParameter("KeepStripsDisabled"); - addBadStrips_ = this->pset().getParameter("AddBadStrips"); + skipEmptyStrips_ = this->pset().getParameter("SkipEmptyStrips"); + uploadOnlyStripBadChannelBit_ = this->pset().getParameter("UploadOnlyStripBadChannelBit"); + uploadPedsFullNoiseDBTable_ = this->pset().getParameter("UploadPedsFullNoiseDBTable"); + LogTrace(mlDqmClient_) << "[PedestalsHistosUsingDb::" << __func__ << "]" << " Disabling strips: " << disableBadStrips_ - << " ; keeping previously disabled strips: " << keepStripsDisabled_; + << " ; keeping previously disabled strips: " << keepStripsDisabled_ + << " ; skip strips with no data: " << skipEmptyStrips_ + << " ; upload only bad channel bit: " << uploadOnlyStripBadChannelBit_; + + allowSelectiveUpload_ = this->pset().existsAs("doSelectiveUpload")?this->pset().getParameter("doSelectiveUpload"):false; + LogTrace(mlDqmClient_) + << "[PedestalsHistosUsingDb::" << __func__ << "]" + << " Selective upload of modules set to : " << allowSelectiveUpload_; } // ----------------------------------------------------------------------------- @@ -51,6 +61,7 @@ PedsFullNoiseHistosUsingDb::~PedsFullNoiseHistosUsingDb() { // ----------------------------------------------------------------------------- /** */ void PedsFullNoiseHistosUsingDb::uploadConfigurations() { + LogTrace(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]"; @@ -65,21 +76,24 @@ void PedsFullNoiseHistosUsingDb::uploadConfigurations() { // Update FED descriptions with new peds/noise values SiStripConfigDb::FedDescriptionsRange feds = db()->getFedDescriptions(); update( feds ); - if ( doUploadConf() ) { + if (doUploadConf()) { // check whether the upload HD config is set to true + edm::LogVerbatim(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " Uploading pedestals/noise to DB..."; - db()->uploadFedDescriptions(); + + db()->uploadFedDescriptions(); // change the FED version + edm::LogVerbatim(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " Completed database upload of " << feds.size() << " FED descriptions!"; - } else { + } + else { edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " TEST! No pedestals/noise values will be uploaded to DB..."; - } - + } } // ----------------------------------------------------------------------------- @@ -88,23 +102,27 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f // Iterate through feds and update fed descriptions uint16_t updated = 0; + long int nstrips = 0; SiStripConfigDb::FedDescriptionsV::const_iterator ifed; - for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) { - - for ( uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++ ) { - // Build FED and FEC keys + for ( ifed = feds.begin(); ifed != feds.end(); ifed++ ) { // Loop on the FED for this partition + + for ( uint16_t ichan = 0; ichan < sistrip::FEDCH_PER_FED; ichan++ ) { + // Build FED and FEC keys from the cabling object i.e. checking if there is a connection const FedChannelConnection& conn = cabling()->fedConnection( (*ifed)->getFedId(), ichan ); - if ( conn.fecCrate()== sistrip::invalid_ || - conn.fecSlot() == sistrip::invalid_ || - conn.fecRing() == sistrip::invalid_ || - conn.ccuAddr() == sistrip::invalid_ || - conn.ccuChan() == sistrip::invalid_ || - conn.lldChannel() == sistrip::invalid_ ) { continue; } - + if ( conn.fecCrate() == sistrip::invalid_ || + conn.fecSlot() == sistrip::invalid_ || + conn.fecRing() == sistrip::invalid_ || + conn.ccuAddr() == sistrip::invalid_ || + conn.ccuChan() == sistrip::invalid_ || + conn.lldChannel() == sistrip::invalid_ ) + continue; + + // build the FED and FEC key from the connection object SiStripFedKey fed_key( conn.fedId(), SiStripFedKey::feUnit( conn.fedCh() ), SiStripFedKey::feChan( conn.fedCh() ) ); + SiStripFecKey fec_key( conn.fecCrate(), conn.fecSlot(), conn.fecRing(), @@ -112,11 +130,12 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f conn.ccuChan(), conn.lldChannel() ); - // Locate appropriate analysis object - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { - + // Locate appropriate analysis object --> based on FEC keys cause they are per lldChannel + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { + PedsFullNoiseAnalysis* anal = dynamic_cast( iter->second ); + if ( !anal ) { edm::LogError(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" @@ -124,7 +143,7 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f continue; } - // Determine the pedestal shift to apply + // Determine the pedestal shift to apply --> this is standard in the pedestal paylaod to avoid loss of signal from common-mode subtraction uint32_t pedshift = 127; for ( uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++ ) { uint32_t pedmin = (uint32_t) anal->pedsMin()[iapv]; @@ -133,81 +152,84 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f // Iterate through APVs and strips for ( uint16_t iapv = 0; iapv < sistrip::APVS_PER_FEDCH; iapv++ ) { - for ( uint16_t istr = 0; istr < anal->peds()[iapv].size(); istr++ ) { + for ( uint16_t istr = 0; istr < anal->peds()[iapv].size(); istr++ ) { // Loop on the pedestal for each APV + nstrips++; // get the information on the strip as it was on the db Fed9U::Fed9UAddress addr( ichan, iapv, istr ); Fed9U::Fed9UStripDescription temp = (*ifed)->getFedStrips().getStrip( addr ); - if(temp.getDisable()) { - std::cout<<"Already Disabled: "<fedKey()); - if(!disableStrip){ - PedsFullNoiseAnalysis::VInt dead = anal->dead()[iapv]; - if ( find( dead.begin(), dead.end(), istr ) != dead.end() ) { - disableStrip = true; - std::cout<<"Disabling Dead: "<noisy()[iapv]; - if ( find( noisy.begin(), noisy.end(), istr ) != noisy.end() ) { - disableStrip = true; - std::cout<<"Disabling Noisy: "<dead()[iapv]; - if ( find( dead.begin(), dead.end(), istr ) != dead.end() ) { - disableStrip = true; - std::cout<<"Disabling Dead: "<noisy()[iapv]; - if ( find( noisy.begin(), noisy.end(), istr ) != noisy.end() ) { - disableStrip = true; - std::cout<<"Disabling Noisy: "<( anal->peds()[iapv][istr]-pedshift ), - highThreshold_, - lowThreshold_, - anal->noise()[iapv][istr], - disableStrip ); + // to disable new strips + if(disableBadStrips_){ + SiStripFedKey fed_key(anal->fedKey()); + PedsFullNoiseAnalysis::VInt dead = anal->deadStrip()[iapv]; + if (not skipEmptyStrips_ and // if one don't want to skip dead strips + find( dead.begin(), dead.end(), istr ) != dead.end() ) { + disableStrip = true; + ss_disable<<"Disabling Dead Strip: "<badStrip()[iapv]; // new feature --> this is the sample of the whole bad strips from the analysis + if(not disableStrip){ + if ( find( badcChan.begin(), badcChan.end(), istr ) != badcChan.end() ) { + disableStrip = true; + ss_disable<<"Disabling Bad strip: "<(anal->peds()[iapv][istr]-pedshift); + noiseVal = static_cast(anal->noise()[iapv][istr]); + lowThr = lowThreshold_; + highThr = highThreshold_; + } + + ////// + Fed9U::Fed9UStripDescription data(pedestalVal,highThr,lowThr,noiseVal,disableStrip); std::stringstream ss; if ( data.getDisable() && edm::isDebugEnabled() ) { @@ -231,7 +253,9 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f << static_cast( temp.getNoise() ) << "/" << static_cast( temp.getDisable() ) << std::endl; } + (*ifed)->getFedStrips().setStrip( addr, data ); + if ( data.getDisable() && edm::isDebugEnabled() ) { ss << " to ped/noise/high/low/disable : " << static_cast( data.getPedestal() ) << "/" @@ -240,13 +264,12 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f << static_cast( data.getNoise() ) << "/" << static_cast( data.getDisable() ) << std::endl; LogTrace(mlDqmClient_) << ss.str(); - } - + } } // end loop on strips } // end loop on apvs updated++; - - } else { + } + else { // device not found in the analysis if ( deviceIsPresent(fec_key) ) { edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" @@ -270,6 +293,7 @@ void PedsFullNoiseHistosUsingDb::update( SiStripConfigDb::FedDescriptionsRange f << "[PedsFullNoiseHistosUsingDb::" << __func__ << "]" << " Updated FED pedestals/noise for " << updated << " channels"; + } // ----------------------------------------------------------------------------- @@ -278,57 +302,112 @@ void PedsFullNoiseHistosUsingDb::create( SiStripConfigDb::AnalysisDescriptionsV& Analysis analysis ) { PedsFullNoiseAnalysis* anal = dynamic_cast( analysis->second ); + if ( !anal ) { return; } SiStripFecKey fec_key( anal->fecKey() ); SiStripFedKey fed_key( anal->fedKey() ); for ( uint16_t iapv = 0; iapv < 2; ++iapv ) { - - // Create description - PedestalsAnalysisDescription* tmp; - tmp = new PedestalsAnalysisDescription( - anal->dead()[iapv], - anal->noisy()[iapv], - anal->pedsMean()[iapv], - anal->pedsSpread()[iapv], - anal->noiseMean()[iapv], - anal->noiseSpread()[iapv], - anal->rawMean()[iapv], - anal->rawSpread()[iapv], - anal->pedsMax()[iapv], - anal->pedsMin()[iapv], - anal->noiseMax()[iapv], - anal->noiseMin()[iapv], - anal->rawMax()[iapv], - anal->rawMin()[iapv], - fec_key.fecCrate(), - fec_key.fecSlot(), - fec_key.fecRing(), - fec_key.ccuAddr(), - fec_key.ccuChan(), - SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ), - db()->dbParams().partitions().begin()->second.partitionName(), - db()->dbParams().partitions().begin()->second.runNumber(), - anal->isValid(), - "", - fed_key.fedId(), - fed_key.feUnit(), - fed_key.feChan(), - fed_key.fedApv() - ); - - // Add comments + + // Create a description for the standard pedestal analysis + PedestalsAnalysisDescription* pedestalDescription; + pedestalDescription = new PedestalsAnalysisDescription( + anal->deadStripBit()[iapv], + anal->badStripBit()[iapv], + anal->pedsMean()[iapv], + anal->pedsSpread()[iapv], + anal->noiseMean()[iapv], + anal->noiseSpread()[iapv], + anal->rawMean()[iapv], + anal->rawSpread()[iapv], + anal->pedsMax()[iapv], + anal->pedsMin()[iapv], + anal->noiseMax()[iapv], + anal->noiseMin()[iapv], + anal->rawMax()[iapv], + anal->rawMin()[iapv], + fec_key.fecCrate(), + fec_key.fecSlot(), + fec_key.fecRing(), + fec_key.ccuAddr(), + fec_key.ccuChan(), + SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ), + db()->dbParams().partitions().begin()->second.partitionName(), + db()->dbParams().partitions().begin()->second.runNumber(), + anal->isValid(), + "", + fed_key.fedId(), + fed_key.feUnit(), + fed_key.feChan(), + fed_key.fedApv() + ); + + // Add comments typedef std::vector Strings; Strings errors = anal->getErrorCodes(); Strings::const_iterator istr = errors.begin(); Strings::const_iterator jstr = errors.end(); - for ( ; istr != jstr; ++istr ) { tmp->addComments( *istr ); } + for ( ; istr != jstr; ++istr ) {pedestalDescription->addComments( *istr ); } + + // Store description + desc.push_back(pedestalDescription); - // Store description - desc.push_back( tmp ); + // Create description + if(uploadPedsFullNoiseDBTable_){ + PedsFullNoiseAnalysisDescription* pedsFullNoiseDescription; + pedsFullNoiseDescription = new PedsFullNoiseAnalysisDescription( + anal->deadStrip()[iapv], + anal->badStrip()[iapv], + anal->shiftedStrip()[iapv], // bad strip-id within an APV due to offset + anal->lowNoiseStrip()[iapv], // bad strip-id within an APV due to noise + anal->largeNoiseStrip()[iapv], // bad strip-id within an APV due to noise + anal->largeNoiseSignificance()[iapv], // bad strip-id within an APV due to noise significance + anal->badFitStatus()[iapv], // bad strip-id within an APV due to fit status + anal->badADProbab()[iapv], // bad strip-id within an APV due to AD probab + anal->badKSProbab()[iapv], // bad strip-id within an APV due to KS probab + anal->badJBProbab()[iapv], // bad strip-id within an APV due to JB probab + anal->badChi2Probab()[iapv], // bad strip-id within an APV due to Chi2 probab + anal->badTailStrip()[iapv], // bad strip-id within an APV due to tail + anal->badDoublePeakStrip()[iapv], // bad strip-id within an APV due to Double peaks + ////// + anal->adProbab()[iapv], // one value oer strip + anal->ksProbab()[iapv], // one value oer strip + anal->jbProbab()[iapv], // one value oer strip + anal->chi2Probab()[iapv], // one value oer strip + //// --> Per strip quantities + anal->residualRMS()[iapv], + anal->residualSigmaGaus()[iapv], + anal->noiseSignificance()[iapv], + anal->residualSkewness()[iapv], + anal->residualKurtosis()[iapv], + anal->residualIntegralNsigma()[iapv], + anal->residualIntegral()[iapv], + //// + fec_key.fecCrate(), + fec_key.fecSlot(), + fec_key.fecRing(), + fec_key.ccuAddr(), + fec_key.ccuChan(), + SiStripFecKey::i2cAddr( fec_key.lldChan(), !iapv ), + db()->dbParams().partitions().begin()->second.partitionName(), + db()->dbParams().partitions().begin()->second.runNumber(), + anal->isValid(), + "", + fed_key.fedId(), + fed_key.feUnit(), + fed_key.feChan(), + fed_key.fedApv() + ); + istr = errors.begin(); + jstr = errors.end(); + for ( ; istr != jstr; ++istr ) { + pedsFullNoiseDescription->addComments( *istr ); + } + // Store description + desc.push_back(pedsFullNoiseDescription); + } } - } diff --git a/DQM/SiStripCommissioningDbClients/src/VpspScanHistosUsingDb.cc b/DQM/SiStripCommissioningDbClients/src/VpspScanHistosUsingDb.cc index 483ba7f6d31f6..c32e0b1fb65f6 100644 --- a/DQM/SiStripCommissioningDbClients/src/VpspScanHistosUsingDb.cc +++ b/DQM/SiStripCommissioningDbClients/src/VpspScanHistosUsingDb.cc @@ -24,6 +24,12 @@ VpspScanHistosUsingDb::VpspScanHistosUsingDb( const edm::ParameterSet & pset, LogTrace(mlDqmClient_) << "[VpspScanHistosUsingDb::" << __func__ << "]" << " Constructing object..."; + + allowSelectiveUpload_ = this->pset().existsAs("doSelectiveUpload")?this->pset().getParameter("doSelectiveUpload"):false; + LogTrace(mlDqmClient_) + << "[PedestalsHistosUsingDb::" << __func__ << "]" + << " Selective upload of modules set to : " << allowSelectiveUpload_; + } // ----------------------------------------------------------------------------- @@ -101,9 +107,9 @@ void VpspScanHistosUsingDb::update( SiStripConfigDb::DeviceDescriptionsRange dev ichan+1 ); // Iterate through all channels and extract LLD settings - Analyses::const_iterator iter = data().find( fec_key.key() ); - if ( iter != data().end() ) { - + Analyses::const_iterator iter = data(allowSelectiveUpload_).find( fec_key.key() ); + if ( iter != data(allowSelectiveUpload_).end() ) { + VpspScanAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { edm::LogError(mlDqmClient_) diff --git a/DQM/SiStripCommissioningSources/src/CalibrationScanTask.cc b/DQM/SiStripCommissioningSources/src/CalibrationScanTask.cc index 65478f4743080..c334a885d33f8 100644 --- a/DQM/SiStripCommissioningSources/src/CalibrationScanTask.cc +++ b/DQM/SiStripCommissioningSources/src/CalibrationScanTask.cc @@ -108,8 +108,8 @@ void CalibrationScanTask::book() { // void CalibrationScanTask::fill( const SiStripEventSummary& summary, const edm::DetSet& digis ) { -// LogDebug("Commissioning") << "[CalibrationScanTask::fill]: isha/vfs = " << summary.isha() << "/" << summary.vfs(); - // Check if ISHA/VFS changed. In that case, save, reset histo, change title, and continue + //LogDebug("Commissioning") << "[CalibrationScanTask::fill]: isha/vfs = " << summary.isha() << "/" << summary.vfs(); + //Check if ISHA/VFS changed. In that case, save, reset histo, change title, and continue checkAndSave(summary.isha(),summary.vfs()); // retrieve the delay from the EventSummary int bin = (100-summary.latency())*8+(7-summary.calSel()); diff --git a/DQM/SiStripCommissioningSources/src/CalibrationTask.cc b/DQM/SiStripCommissioningSources/src/CalibrationTask.cc index 03425623d6d5d..897816df2d794 100644 --- a/DQM/SiStripCommissioningSources/src/CalibrationTask.cc +++ b/DQM/SiStripCommissioningSources/src/CalibrationTask.cc @@ -101,7 +101,11 @@ void CalibrationTask::fill( const SiStripEventSummary& summary, isub = ical<4 ? ical+4 : ical-4; checkAndSave(ical); // retrieve the delay from the EventSummary - int bin = (100-summary.latency())*8+(7-summary.calSel()); + int bin = 0; + if(runType_ == sistrip::CALIBRATION) + bin = (100-summary.latency())*8+(7-summary.calSel()); + else if(runType_ == sistrip::CALIBRATION_DECO) + bin = (102-summary.latency())*8+(7-summary.calSel()); // Fill the histograms. // data-ped -(data-ped)_isub // the second term corresponds to the common mode substraction, looking at a strip far away. diff --git a/DQM/SiStripCommissioningSummary/src/CalibrationSummaryFactory.cc b/DQM/SiStripCommissioningSummary/src/CalibrationSummaryFactory.cc index f7c34039feb32..e0f6f7e54b77e 100644 --- a/DQM/SiStripCommissioningSummary/src/CalibrationSummaryFactory.cc +++ b/DQM/SiStripCommissioningSummary/src/CalibrationSummaryFactory.cc @@ -21,6 +21,10 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { std::vector< std::vector > tail( 2, temp ); std::vector< std::vector > riseTime( 2, temp ); std::vector< std::vector > timeConstant( 2, temp ); + std::vector< std::vector > turnOn( 2, temp ); + std::vector< std::vector > maximum( 2, temp ); + std::vector< std::vector > undershoot( 2, temp ); + std::vector< std::vector > baseline( 2, temp ); std::vector< std::vector > smearing( 2, temp ); std::vector< std::vector > chi2( 2, temp ); amplitude[0] = anal->amplitude()[0]; @@ -31,6 +35,14 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { riseTime[1] = anal->riseTime()[1]; timeConstant[0] = anal->timeConstant()[0]; timeConstant[1] = anal->timeConstant()[1]; + turnOn[0] = anal->turnOn()[0]; + turnOn[1] = anal->turnOn()[1]; + maximum[0] = anal->maximum()[0]; + maximum[1] = anal->maximum()[1]; + undershoot[0] = anal->undershoot()[0]; + undershoot[1] = anal->undershoot()[1]; + baseline[0] = anal->baseline()[0]; + baseline[1] = anal->baseline()[1]; smearing[0] = anal->smearing()[0]; smearing[1] = anal->smearing()[1]; chi2[0] = anal->chi2()[0]; @@ -54,6 +66,8 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { bool all_strips = false; bool with_error = false; + + // Amplitude if ( mon_ == sistrip::CALIBRATION_AMPLITUDE_ALLSTRIPS) { all_strips = true; uint16_t bins = amplitude[amplitude[0].size() < amplitude[1].size() ? 1 : 0].size(); @@ -73,7 +87,9 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { } else if ( mon_ == sistrip::CALIBRATION_AMPLITUDE_MAX) { value[0][0] = anal->amplitudeMax()[0]/10.; value[1][0] = anal->amplitudeMax()[1]/10.; - } else if ( mon_ == sistrip::CALIBRATION_TAIL_ALLSTRIPS) { + } + // Tail parameter + else if ( mon_ == sistrip::CALIBRATION_TAIL_ALLSTRIPS) { all_strips = true; uint16_t bins = tail[tail[0].size() < tail[1].size() ? 1 : 0].size(); for ( uint16_t i = 0; i < bins; i++ ) { @@ -92,7 +108,9 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { } else if ( mon_ == sistrip::CALIBRATION_TAIL_MAX) { value[0][0] = anal->tailMax()[0]; value[1][0] = anal->tailMax()[1]; - } else if ( mon_ == sistrip::CALIBRATION_RISETIME_ALLSTRIPS) { + } + // Risetime parameter + else if ( mon_ == sistrip::CALIBRATION_RISETIME_ALLSTRIPS) { all_strips = true; uint16_t bins = riseTime[riseTime[0].size() < riseTime[1].size() ? 1 : 0].size(); for ( uint16_t i = 0; i < bins; i++ ) { @@ -111,7 +129,9 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { } else if ( mon_ == sistrip::CALIBRATION_RISETIME_MAX) { value[0][0] = anal->riseTimeMax()[0]; value[1][0] = anal->riseTimeMax()[1]; - } else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT_ALLSTRIPS) { + } + // TimeConstant + else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT_ALLSTRIPS) { all_strips = true; uint16_t bins = timeConstant[timeConstant[0].size() < timeConstant[1].size() ? 1 : 0].size(); for ( uint16_t i = 0; i < bins; i++ ) { @@ -130,14 +150,105 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { } else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT_MAX) { value[0][0] = anal->timeConstantMax()[0]; value[1][0] = anal->timeConstantMax()[1]; - } else if ( mon_ == sistrip::CALIBRATION_SMEARING_ALLSTRIPS) { + } + // Turn-on + else if ( mon_ == sistrip::CALIBRATION_TURNON_ALLSTRIPS) { + all_strips = true; + uint16_t bins = turnOn[turnOn[0].size() < turnOn[1].size() ? 1 : 0].size(); + for ( uint16_t i = 0; i < bins; i++ ) { + value[0][i] = turnOn[0][i]; + value[1][i] = turnOn[1][i]; + } + } else if ( mon_ == sistrip::CALIBRATION_TURNON) { + with_error = true; + value[0][0] = anal->turnOnMean()[0]; + value[1][0] = anal->turnOnMean()[1]; + error[0][0] = anal->turnOnSpread()[0]; + error[1][0] = anal->turnOnSpread()[1]; + } else if ( mon_ == sistrip::CALIBRATION_TURNON_MIN) { + value[0][0] = anal->turnOnMin()[0]; + value[1][0] = anal->turnOnMin()[1]; + } else if ( mon_ == sistrip::CALIBRATION_TURNON_MAX) { + value[0][0] = anal->turnOnMax()[0]; + value[1][0] = anal->turnOnMax()[1]; + + } + // Maximum + else if ( mon_ == sistrip::CALIBRATION_MAXIMUM_ALLSTRIPS) { + all_strips = true; + uint16_t bins = maximum[maximum[0].size() < maximum[1].size() ? 1 : 0].size(); + for ( uint16_t i = 0; i < bins; i++ ) { + value[0][i] = maximum[0][i]; + value[1][i] = maximum[1][i]; + } + } else if ( mon_ == sistrip::CALIBRATION_MAXIMUM) { + with_error = true; + value[0][0] = anal->maximumMean()[0]; + value[1][0] = anal->maximumMean()[1]; + error[0][0] = anal->maximumSpread()[0]; + error[1][0] = anal->maximumSpread()[1]; + } else if ( mon_ == sistrip::CALIBRATION_MAXIMUM_MIN) { + value[0][0] = anal->maximumMin()[0]; + value[1][0] = anal->maximumMin()[1]; + } else if ( mon_ == sistrip::CALIBRATION_MAXIMUM_MAX) { + value[0][0] = anal->maximumMax()[0]; + value[1][0] = anal->maximumMax()[1]; + + } + // Undershoot + else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_ALLSTRIPS) { + all_strips = true; + uint16_t bins = undershoot[undershoot[0].size() < undershoot[1].size() ? 1 : 0].size(); + for ( uint16_t i = 0; i < bins; i++ ) { + value[0][i] = undershoot[0][i]; + value[1][i] = undershoot[1][i]; + } + } else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT) { + with_error = true; + value[0][0] = anal->undershootMean()[0]; + value[1][0] = anal->undershootMean()[1]; + error[0][0] = anal->undershootSpread()[0]; + error[1][0] = anal->undershootSpread()[1]; + } else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_MIN) { + value[0][0] = anal->undershootMin()[0]; + value[1][0] = anal->undershootMin()[1]; + } else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT_MAX) { + value[0][0] = anal->undershootMax()[0]; + value[1][0] = anal->undershootMax()[1]; + + } + // Baseline + else if ( mon_ == sistrip::CALIBRATION_BASELINE_ALLSTRIPS) { + all_strips = true; + uint16_t bins = baseline[baseline[0].size() < baseline[1].size() ? 1 : 0].size(); + for ( uint16_t i = 0; i < bins; i++ ) { + value[0][i] = baseline[0][i]; + value[1][i] = baseline[1][i]; + } + } else if ( mon_ == sistrip::CALIBRATION_BASELINE) { + with_error = true; + value[0][0] = anal->baselineMean()[0]; + value[1][0] = anal->baselineMean()[1]; + error[0][0] = anal->baselineSpread()[0]; + error[1][0] = anal->baselineSpread()[1]; + } else if ( mon_ == sistrip::CALIBRATION_BASELINE_MIN) { + value[0][0] = anal->baselineMin()[0]; + value[1][0] = anal->baselineMin()[1]; + } else if ( mon_ == sistrip::CALIBRATION_BASELINE_MAX) { + value[0][0] = anal->baselineMax()[0]; + value[1][0] = anal->baselineMax()[1]; + } + + // Smearing + else if ( mon_ == sistrip::CALIBRATION_SMEARING_ALLSTRIPS) { all_strips = true; uint16_t bins = smearing[smearing[0].size() < smearing[1].size() ? 1 : 0].size(); for ( uint16_t i = 0; i < bins; i++ ) { value[0][i] = smearing[0][i]; value[1][i] = smearing[1][i]; } - } else if ( mon_ == sistrip::CALIBRATION_SMEARING) { + } + else if ( mon_ == sistrip::CALIBRATION_SMEARING) { with_error = true; value[0][0] = anal->smearingMean()[0]; value[1][0] = anal->smearingMean()[1]; @@ -149,14 +260,17 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { } else if ( mon_ == sistrip::CALIBRATION_SMEARING_MAX) { value[0][0] = anal->smearingMax()[0]; value[1][0] = anal->smearingMax()[1]; - } else if ( mon_ == sistrip::CALIBRATION_CHI2_ALLSTRIPS) { + } + // Fit chi2 + else if ( mon_ == sistrip::CALIBRATION_CHI2_ALLSTRIPS) { all_strips = true; uint16_t bins = chi2[chi2[0].size() < chi2[1].size() ? 1 : 0].size(); for ( uint16_t i = 0; i < bins; i++ ) { value[0][i] = chi2[0][i]; value[1][i] = chi2[1][i]; } - } else if ( mon_ == sistrip::CALIBRATION_CHI2) { + } + else if ( mon_ == sistrip::CALIBRATION_CHI2) { with_error = true; value[0][0] = anal->chi2Mean()[0]/100.; value[1][0] = anal->chi2Mean()[1]/100.; @@ -222,6 +336,7 @@ void CalibrationSummaryFactory::extract( Iterator iter ) { // void CalibrationSummaryFactory::format() { + // Histogram formatting // Histogram formatting if ( mon_ == sistrip::CALIBRATION_AMPLITUDE ) { generator_->axisLabel( "Amplitude (ADC*Nevt/10.)" ); @@ -231,16 +346,23 @@ void CalibrationSummaryFactory::format() { generator_->axisLabel( "Rise time (ns)" ); } else if ( mon_ == sistrip::CALIBRATION_TIMECONSTANT ) { generator_->axisLabel( "Time constant (ns)" ); + } else if ( mon_ == sistrip::CALIBRATION_TURNON ) { + generator_->axisLabel( "TrunOn (ns)" ); + } else if ( mon_ == sistrip::CALIBRATION_MAXIMUM ) { + generator_->axisLabel( "Maximum time (ns)" ); + } else if ( mon_ == sistrip::CALIBRATION_UNDERSHOOT ) { + generator_->axisLabel( "Undershoot (ADC*Nevt/10.)" ); + } else if ( mon_ == sistrip::CALIBRATION_BASELINE ) { + generator_->axisLabel( "Baseline Amplitude (ADC*Nevt/10.)" ); } else if ( mon_ == sistrip::CALIBRATION_SMEARING ) { generator_->axisLabel( "Smearing (ns)" ); } else if ( mon_ == sistrip::CALIBRATION_CHI2 ) { generator_->axisLabel( "Chi2/100." ); } else { edm::LogWarning(mlSummaryPlots_) - << "[SummaryPlotFactory::" << __func__ << "]" - << " Unexpected SummaryHisto value:" - << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ ) ; - } - + << "[SummaryPlotFactory::" << __func__ << "]" + << " Unexpected SummaryHisto value:" + << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ ) ; + } } diff --git a/DQM/SiStripCommissioningSummary/src/PedsFullNoiseSummaryFactory.cc b/DQM/SiStripCommissioningSummary/src/PedsFullNoiseSummaryFactory.cc index 390114cc1f7ca..53b581b080f4e 100644 --- a/DQM/SiStripCommissioningSummary/src/PedsFullNoiseSummaryFactory.cc +++ b/DQM/SiStripCommissioningSummary/src/PedsFullNoiseSummaryFactory.cc @@ -10,58 +10,99 @@ using namespace sistrip; // ----------------------------------------------------------------------------- // void PedsFullNoiseSummaryFactory::extract( Iterator iter ) { - + PedsFullNoiseAnalysis* anal = dynamic_cast( iter->second ); if ( !anal ) { return; } - - std::vector< float > temp(128, 1. * sistrip::invalid_ ); - std::vector< std::vector > value( 2, temp ); - std::vector< std::vector > peds( 2, temp ); - std::vector< std::vector > noise( 2, temp ); - std::vector< std::vector > ks( 2, temp ); - std::vector< std::vector > noiseG( 2, temp ); - std::vector< std::vector > bin84( 2, temp ); - std::vector< std::vector > chi2( 2, temp ); - std::vector< std::vector > signif( 2, temp ); - std::vector< std::vector > rms( 2, temp ); + + std::vector< float > temp(128, 1. * sistrip::invalid_ ); + std::vector< uint16_t > temp2(128, sistrip::invalid_); + + std::vector< std::vector > value (2, temp); + std::vector< std::vector > peds (2, temp); + std::vector< std::vector > noise(2, temp); + std::vector< std::vector > adProbab(2, temp); + std::vector< std::vector > ksProbab(2, temp); + std::vector< std::vector > jbProbab(2, temp); + std::vector< std::vector > chi2Probab(2, temp); + std::vector< std::vector > residualRMS(2, temp); + std::vector< std::vector > residualGaus(2, temp); + std::vector< std::vector > noiseSignificance(2, temp); + std::vector< std::vector > residualMean(2, temp); + std::vector< std::vector > residualSkewness(2, temp); + std::vector< std::vector > residualKurtosis(2, temp); + std::vector< std::vector > residualIntegralNsigma(2, temp); + std::vector< std::vector > residualIntegral(2, temp); + std::vector< std::vector > badStripBit(2, temp2); + std::vector< std::vector > deadStripBit(2, temp2); + + // pedestal values peds[0] = anal->peds()[0]; peds[1] = anal->peds()[1]; + // noise values noise[0] = anal->noise()[0]; noise[1] = anal->noise()[1]; - ks[0] = anal->ksProb()[0]; // dummy values //replaced with ksProb now, wing - ks[1] = anal->ksProb()[1]; // dummy values - noiseG[0] = anal->noiseGaus()[0]; - noiseG[1] = anal->noiseGaus()[1]; - bin84[0] = anal->noiseBin84()[0]; - bin84[1] = anal->noiseBin84()[1]; - rms[0] = anal->noiseRMS()[0]; - rms[1] = anal->noiseRMS()[1]; - chi2[0] = anal->chi2Prob()[0]; - chi2[1] = anal->chi2Prob()[1]; - signif[0] = anal->noiseSignif()[0]; - signif[1] = anal->noiseSignif()[1]; + // AD probab + adProbab[0] = anal->adProbab()[0]; + adProbab[1] = anal->adProbab()[1]; + // KS probab + ksProbab[0] = anal->ksProbab()[0]; + ksProbab[1] = anal->ksProbab()[1]; + // JB probab + jbProbab[0] = anal->jbProbab()[0]; + jbProbab[1] = anal->jbProbab()[1]; + // CHI2 probab + chi2Probab[0] = anal->chi2Probab()[0]; + chi2Probab[1] = anal->chi2Probab()[1]; + // noise RMS + chi2Probab[0] = anal->chi2Probab()[0]; + chi2Probab[1] = anal->chi2Probab()[1]; + // residual RMS + residualRMS[0] = anal->residualRMS()[0]; + residualRMS[1] = anal->residualRMS()[1]; + // residual Sigma + residualGaus[0] = anal->residualSigmaGaus()[0]; + residualGaus[1] = anal->residualSigmaGaus()[1]; + // noise Significance + noiseSignificance[0] = anal->noiseSignificance()[0]; + noiseSignificance[1] = anal->noiseSignificance()[1]; + // residual mean + residualMean[0] = anal->residualMean()[0]; + residualMean[1] = anal->residualMean()[1]; + // noise Skweness + residualSkewness[0] = anal->residualSkewness()[0]; + residualSkewness[1] = anal->residualSkewness()[1]; + // noise Kurtosis + residualKurtosis[0] = anal->residualKurtosis()[0]; + residualKurtosis[1] = anal->residualKurtosis()[1]; + // noise integral N sigma + residualIntegralNsigma[0] = anal->residualIntegralNsigma()[0]; + residualIntegralNsigma[1] = anal->residualIntegralNsigma()[1]; + // noise integral N sigma + residualIntegral[0] = anal->residualIntegral()[0]; + residualIntegral[1] = anal->residualIntegral()[1]; + // bit to indicate if a strip is flagged as bad or not + residualIntegral[0] = anal->residualIntegral()[0]; + residualIntegral[1] = anal->residualIntegral()[1]; + // bit to indicate if a strip is bad (1) or not (0) + badStripBit[0] = anal->badStripBit()[0]; + badStripBit[1] = anal->badStripBit()[1]; + // bit to indicate if a strip is dead (1) or not (0) + deadStripBit[0] = anal->deadStripBit()[0]; + deadStripBit[1] = anal->deadStripBit()[1]; + bool all_strips = false; - if ( mon_ == sistrip::PEDESTALS_ALL_STRIPS ) { + // Monitor pedestals value for each strip + if (mon_ == sistrip::PEDESTALS_ALL_STRIPS ) { all_strips = true; uint16_t bins = peds[0].size(); - if ( peds[0].size() < peds[1].size() ) { bins = peds[1].size(); } - for ( uint16_t iped = 0; iped < bins; iped++ ) { + if (peds[0].size() < peds[1].size() ) { bins = peds[1].size(); } + for( uint16_t iped = 0; iped < bins; iped++ ) { value[0][iped] = peds[0][iped]; value[1][iped] = peds[1][iped]; } - } else if ( mon_ == sistrip::PEDESTALS_MEAN ) { - value[0][0] = anal->pedsMean()[0]; - value[1][0] = anal->pedsMean()[1]; - } else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { - value[0][0] = anal->pedsSpread()[0]; - value[1][0] = anal->pedsSpread()[1]; - } else if ( mon_ == sistrip::PEDESTALS_MAX ) { - value[0][0] = anal->pedsMax()[0]; - value[1][0] = anal->pedsMax()[1]; - } else if ( mon_ == sistrip::PEDESTALS_MIN ) { - value[0][0] = anal->pedsMin()[0]; - value[1][0] = anal->pedsMin()[1]; - } else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) { + } + // Monitor noise value for each strip + else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) { all_strips = true; uint16_t bins = noise[0].size(); if ( noise[0].size() < noise[1].size() ) { bins = noise[1].size(); } @@ -69,82 +110,257 @@ void PedsFullNoiseSummaryFactory::extract( Iterator iter ) { value[0][inoise] = noise[0][inoise]; value[1][inoise] = noise[1][inoise]; } - } else if ( mon_ == sistrip::NOISE_KS_ALL_STRIPS ) { + } + // Monitor pedestals aD probability for each strip + else if ( mon_ == sistrip::AD_PROBAB_ALL_STRIPS ) { all_strips = true; - uint16_t bins = ks[0].size(); - if ( ks[0].size() < ks[1].size() ) { bins = ks[1].size(); } + uint16_t bins = adProbab[0].size(); + if ( adProbab[0].size() < adProbab[1].size() ) { bins = adProbab[1].size(); } + for ( uint16_t iad = 0; iad < bins; iad++ ) { + value[0][iad] = adProbab[0][iad]; + value[1][iad] = adProbab[1][iad]; + } + } + // Monitor pedestals KS probability for each strip + else if ( mon_ == sistrip::KS_PROBAB_ALL_STRIPS ) { + all_strips = true; + uint16_t bins = ksProbab[0].size(); + if ( ksProbab[0].size() < ksProbab[1].size() ) { bins = ksProbab[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = ks[0][iks]; - value[1][iks] = ks[1][iks]; + value[0][iks] = ksProbab[0][iks]; + value[1][iks] = ksProbab[1][iks]; } - } else if ( mon_ == sistrip::NOISE_CHI2_ALL_STRIPS ) { + } + // Monitor pedestals JB probability for each strip + else if ( mon_ == sistrip::JB_PROBAB_ALL_STRIPS ) { all_strips = true; - uint16_t bins = chi2[0].size(); - if ( ks[0].size() < chi2[1].size() ) { bins = chi2[1].size(); } + uint16_t bins = jbProbab[0].size(); + if ( jbProbab[0].size() < jbProbab[1].size() ) { bins = jbProbab[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = chi2[0][iks]; - value[1][iks] = chi2[1][iks]; + value[0][iks] = jbProbab[0][iks]; + value[1][iks] = jbProbab[1][iks]; } - } else if ( mon_ == sistrip::NOISE_GAUS_ALL_STRIPS ) { + } + // Monitor pedestals Chi2 probability for each strip + else if ( mon_ == sistrip::CHI2_PROBAB_ALL_STRIPS ) { all_strips = true; - uint16_t bins = noiseG[0].size(); - if ( noiseG[0].size() < noiseG[1].size() ) { bins = noiseG[1].size(); } + uint16_t bins = chi2Probab[0].size(); + if ( chi2Probab[0].size() < chi2Probab[1].size() ) { bins = chi2Probab[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = noiseG[0][iks]; - value[1][iks] = noiseG[1][iks]; - } - } else if ( mon_ == sistrip::NOISE_BIN_84_ALL_STRIPS ) { + value[0][iks] = chi2Probab[0][iks]; + value[1][iks] = chi2Probab[1][iks]; + } + } + // Monitor pedestals RMS residual for each strip + else if ( mon_ == sistrip::RESIDUAL_RMS_ALL_STRIPS) { all_strips = true; - uint16_t bins = bin84[0].size(); - if ( bin84[0].size() < bin84[1].size() ) { bins = bin84[1].size(); } + uint16_t bins = residualRMS[0].size(); + if ( residualRMS[0].size() < residualRMS[1].size() ) { bins = residualRMS[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = bin84[0][iks]; - value[1][iks] = bin84[1][iks]; - } - } else if ( mon_ == sistrip::NOISE_RMS_ALL_STRIPS ) { + value[0][iks] = residualRMS[0][iks]; + value[1][iks] = residualRMS[1][iks]; + } + } + // Monitor pedestals sigma from gaussian firt for each strip + else if ( mon_ == sistrip::RESIDUAL_GAUS_ALL_STRIPS) { + all_strips = true; + uint16_t bins = residualGaus[0].size(); + if ( residualGaus[0].size() < residualGaus[1].size() ) { bins = residualGaus[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = residualGaus[0][iks]; + value[1][iks] = residualGaus[1][iks]; + } + } + // Monitor pedestals noise significance for each strip + else if ( mon_ == sistrip::NOISE_SIGNIFICANCE_ALL_STRIPS) { all_strips = true; - uint16_t bins = rms[0].size(); - if ( rms[0].size() < rms[1].size() ) { bins = rms[1].size(); } + uint16_t bins = noiseSignificance[0].size(); + if (noiseSignificance[0].size() < noiseSignificance[1].size() ) { bins = noiseSignificance[1].size(); } + for (uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = noiseSignificance[0][iks]; + value[1][iks] = noiseSignificance[1][iks]; + } + } + // Monitor mean residual for each strip + else if ( mon_ == sistrip::RESIDUAL_MEAN_ALL_STRIPS) { + all_strips = true; + uint16_t bins = residualMean[0].size(); + if ( residualMean[0].size() < residualMean[1].size() ) { bins = residualMean[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = rms[0][iks]; - value[1][iks] = rms[1][iks]; - } - } else if ( mon_ == sistrip::NOISE_SIGNIF_ALL_STRIPS ) { + value[0][iks] = residualMean[0][iks]; + value[1][iks] = residualMean[1][iks]; + } + } + // Monitor skweness for each strip + else if ( mon_ == sistrip::RESIDUAL_SKEWNESS_ALL_STRIPS) { all_strips = true; - uint16_t bins = signif[0].size(); - if ( signif[0].size() < signif[1].size() ) { bins = signif[1].size(); } + uint16_t bins = residualSkewness[0].size(); + if ( residualSkewness[0].size() < residualSkewness[1].size() ) { bins = residualSkewness[1].size(); } for ( uint16_t iks = 0; iks < bins; iks++ ) { - value[0][iks] = signif[0][iks]; - value[1][iks] = signif[1][iks]; - } - } else if ( mon_ == sistrip::NOISE_MEAN ) { + value[0][iks] = residualSkewness[0][iks]; + value[1][iks] = residualSkewness[1][iks]; + } + } + // Monitor Kurtosis for each strip + else if ( mon_ == sistrip::RESIDUAL_KURTOSIS_ALL_STRIPS) { + all_strips = true; + uint16_t bins = residualKurtosis[0].size(); + if ( residualKurtosis[0].size() < residualKurtosis[1].size() ) { bins = residualKurtosis[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = residualKurtosis[0][iks]; + value[1][iks] = residualKurtosis[1][iks]; + } + } + // Monitor Integral above N sigma for each strip + else if ( mon_ == sistrip::RESIDUAL_INTEGRALNSIGMA_ALL_STRIPS) { + all_strips = true; + uint16_t bins = residualIntegralNsigma[0].size(); + if ( residualIntegralNsigma[0].size() < residualIntegralNsigma[1].size() ) { bins = residualIntegralNsigma[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = residualIntegralNsigma[0][iks]; + value[1][iks] = residualIntegralNsigma[1][iks]; + } + } + // Monitor integral for each strip + else if ( mon_ == sistrip::RESIDUAL_INTEGRAL_ALL_STRIPS) { + all_strips = true; + uint16_t bins = residualIntegral[0].size(); + if ( residualIntegral[0].size() < residualIntegral[1].size() ) { bins = residualIntegral[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = residualIntegral[0][iks]; + value[1][iks] = residualIntegral[1][iks]; + } + } + + // Monitor BadStrip bit + else if ( mon_ == sistrip::BAD_STRIP_BIT_ALL_STRIPS) { + all_strips = true; + uint16_t bins = badStripBit[0].size(); + if ( badStripBit[0].size() < badStripBit[1].size() ) { bins = badStripBit[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = 1.*badStripBit[0][iks]; + value[1][iks] = 1.*badStripBit[1][iks]; + } + } + // Dead strip bit + else if ( mon_ == sistrip::DEAD_STRIP_BIT_ALL_STRIPS) { + all_strips = true; + uint16_t bins = deadStripBit[0].size(); + if ( deadStripBit[0].size() < deadStripBit[1].size() ) { bins = deadStripBit[1].size(); } + for ( uint16_t iks = 0; iks < bins; iks++ ) { + value[0][iks] = 1.*deadStripBit[0][iks]; + value[1][iks] = 1.*deadStripBit[1][iks]; + } + } + + // Per APV information: pedsMean + else if ( mon_ == sistrip::PEDESTALS_MEAN ) { + value[0][0] = anal->pedsMean()[0]; + value[1][0] = anal->pedsMean()[1]; + } + + // Per APV information: pedsSpread + else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { + value[0][0] = anal->pedsSpread()[0]; + value[1][0] = anal->pedsSpread()[1]; + } + + // Per APV information: pedsMax + else if ( mon_ == sistrip::PEDESTALS_MAX ) { + value[0][0] = anal->pedsMax()[0]; + value[1][0] = anal->pedsMax()[1]; + } + + // Per APV information: pedsMin + else if ( mon_ == sistrip::PEDESTALS_MIN ) { + value[0][0] = anal->pedsMin()[0]; + value[1][0] = anal->pedsMin()[1]; + } + + // Per APV information: noiseMean + else if ( mon_ == sistrip::NOISE_MEAN ) { value[0][0] = anal->noiseMean()[0]; value[1][0] = anal->noiseMean()[1]; - } else if ( mon_ == sistrip::NOISE_SPREAD ) { + } + // Per APV information: noiseSpread + else if ( mon_ == sistrip::NOISE_SPREAD ) { value[0][0] = anal->noiseSpread()[0]; value[1][0] = anal->noiseSpread()[1]; - } else if ( mon_ == sistrip::NOISE_MAX ) { + } + // Per APV information: noiseMax + else if ( mon_ == sistrip::NOISE_MAX ) { value[0][0] = anal->noiseMax()[0]; value[1][0] = anal->noiseMax()[1]; - } else if ( mon_ == sistrip::NOISE_MIN ) { + } + // Per APV information: noiseMin + else if ( mon_ == sistrip::NOISE_MIN ) { value[0][0] = anal->noiseMin()[0]; value[1][0] = anal->noiseMin()[1]; - } else if ( mon_ == sistrip::NUM_OF_DEAD ) { - value[0][0] = 1. * anal->dead()[0].size(); - value[1][0] = 1. * anal->dead()[1].size(); - } else if ( mon_ == sistrip::NUM_OF_NOISY ) { - value[0][0] = 1. * anal->noisy()[0].size(); - value[1][0] = 1. * anal->noisy()[1].size(); - } else { + } + + // BAD channels per APV + else if ( mon_ == sistrip::NUM_OF_DEAD ) { + value[0][0] = 1. * anal->deadStrip()[0].size(); + value[1][0] = 1. * anal->deadStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD ) { + value[0][0] = 1. * anal->badStrip()[0].size(); + value[1][0] = 1. * anal->badStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_SHIFTED) { + value[0][0] = 1. * anal->shiftedStrip()[0].size(); + value[1][0] = 1. * anal->shiftedStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_LOW_NOISE) { + value[0][0] = 1. * anal->lowNoiseStrip()[0].size(); + value[1][0] = 1. * anal->lowNoiseStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_LARGE_NOISE) { + value[0][0] = 1. * anal->largeNoiseStrip()[0].size(); + value[1][0] = 1. * anal->largeNoiseStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_LARGE_SIGNIF) { + value[0][0] = 1. * anal->largeNoiseSignificance()[0].size(); + value[1][0] = 1. * anal->largeNoiseSignificance()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_FIT_STATUS) { + value[0][0] = 1. * anal->badFitStatus()[0].size(); + value[1][0] = 1. * anal->badFitStatus()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_AD_PROBAB) { + value[0][0] = 1. * anal->badADProbab()[0].size(); + value[1][0] = 1. * anal->badADProbab()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_KS_PROBAB) { + value[0][0] = 1. * anal->badKSProbab()[0].size(); + value[1][0] = 1. * anal->badKSProbab()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_JB_PROBAB) { + value[0][0] = 1. * anal->badJBProbab()[0].size(); + value[1][0] = 1. * anal->badJBProbab()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_CHI2_PROBAB) { + value[0][0] = 1. * anal->badChi2Probab()[0].size(); + value[1][0] = 1. * anal->badChi2Probab()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_TAIL) { + value[0][0] = 1. * anal->badTailStrip()[0].size(); + value[1][0] = 1. * anal->badTailStrip()[1].size(); + } + else if ( mon_ == sistrip::NUM_OF_BAD_DOUBLE_PEAK) { + value[0][0] = 1. * anal->badDoublePeakStrip()[0].size(); + value[1][0] = 1. * anal->badDoublePeakStrip()[1].size(); + } + else { edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]" << " Unexpected monitorable: " << SiStripEnumsAndStrings::monitorable( SummaryPlotFactoryBase::mon_ ); return; } - + if ( !all_strips ) { - + SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, iter->first, @@ -163,8 +379,8 @@ void PedsFullNoiseSummaryFactory::extract( Iterator iter ) { SummaryPlotFactoryBase::gran_, iter->first, value[0][istr] ); - } - + } + for ( uint16_t istr = 0; istr < value[1].size(); istr++ ) { SummaryPlotFactoryBase::generator_->fillMap( SummaryPlotFactoryBase::level_, SummaryPlotFactoryBase::gran_, @@ -180,29 +396,94 @@ void PedsFullNoiseSummaryFactory::format() { if ( mon_ == sistrip::PEDESTALS_ALL_STRIPS ) { generator_->axisLabel( "Pedestal value [adc]" ); - } else if ( mon_ == sistrip::PEDESTALS_MEAN ) { - } else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { - } else if ( mon_ == sistrip::PEDESTALS_MAX ) { - } else if ( mon_ == sistrip::PEDESTALS_MIN ) { - } else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) { + } + else if ( mon_ == sistrip::PEDESTALS_MEAN ) { + } + else if ( mon_ == sistrip::PEDESTALS_SPREAD ) { + } + else if ( mon_ == sistrip::PEDESTALS_MAX ) { + } + else if ( mon_ == sistrip::PEDESTALS_MIN ) { + } + else if ( mon_ == sistrip::NOISE_ALL_STRIPS ) { generator_->axisLabel( "Noise [adc]" ); - } else if ( mon_ == sistrip::NOISE_MEAN ) { - } else if ( mon_ == sistrip::NOISE_SPREAD ) { - } else if ( mon_ == sistrip::NOISE_MAX ) { - } else if ( mon_ == sistrip::NOISE_MIN ) { - } else if ( mon_ == sistrip::NUM_OF_DEAD ) { - } else if ( mon_ == sistrip::NUM_OF_NOISY ) { - } else if ( mon_ == sistrip::NOISE_KS_ALL_STRIPS ) { - generator_->axisLabel( "KS Prob." ); - } else if ( mon_ == sistrip::NOISE_GAUS_ALL_STRIPS ) { - generator_->axisLabel( "Noise Gaus." ); - } else if ( mon_ == sistrip::NOISE_BIN_84_ALL_STRIPS ) { - generator_->axisLabel( "Noise Bin 84." ); - } else if ( mon_ == sistrip::NOISE_RMS_ALL_STRIPS ) { - generator_->axisLabel( "Noise RMS." ); - } else if ( mon_ == sistrip::NOISE_CHI2_ALL_STRIPS ) { - generator_->axisLabel( "Chi2 Prob." ); - } else { + } + else if ( mon_ == sistrip::NOISE_MEAN ) { + } + else if ( mon_ == sistrip::NOISE_SPREAD ) { + } + else if ( mon_ == sistrip::NOISE_MAX ) { + } + else if ( mon_ == sistrip::NOISE_MIN ) { + } + else if( mon_ == sistrip::AD_PROBAB_ALL_STRIPS) { + generator_->axisLabel("Anderson-Darling p-value" ); + } + else if( mon_ == sistrip::KS_PROBAB_ALL_STRIPS) { + generator_->axisLabel("Kolmogorov-Smirnov p-value" ); + } + else if( mon_ == sistrip::JB_PROBAB_ALL_STRIPS) { + generator_->axisLabel("Jacque-Bera p-value" ); + } + else if( mon_ == sistrip::CHI2_PROBAB_ALL_STRIPS) { + generator_->axisLabel("Chi2 p-value" ); + } + else if( mon_ == sistrip::RESIDUAL_RMS_ALL_STRIPS) { + generator_->axisLabel("Residual RMS [adc]" ); + } + else if( mon_ == sistrip::RESIDUAL_GAUS_ALL_STRIPS) { + generator_->axisLabel("Residual Gaus [adc]" ); + } + else if( mon_ == sistrip::NOISE_SIGNIFICANCE_ALL_STRIPS) { + generator_->axisLabel("Noise Significance" ); + } + else if( mon_ == sistrip::RESIDUAL_MEAN_ALL_STRIPS) { + generator_->axisLabel("Residual Mean [adc]" ); + } + else if( mon_ == sistrip::RESIDUAL_SKEWNESS_ALL_STRIPS) { + generator_->axisLabel("Residual Skewness [adc]" ); + } + else if( mon_ == sistrip::RESIDUAL_KURTOSIS_ALL_STRIPS) { + generator_->axisLabel("Residual Kurtosis [adc]" ); + } + else if( mon_ == sistrip::RESIDUAL_INTEGRALNSIGMA_ALL_STRIPS) { + generator_->axisLabel("Residual Integral at N sigma" ); + } + else if( mon_ == sistrip::RESIDUAL_INTEGRAL_ALL_STRIPS) { + generator_->axisLabel("Residual Integral" ); + } + else if( mon_ == sistrip::BAD_STRIP_BIT_ALL_STRIPS) { + generator_->axisLabel("Bad Strip Bit" ); + } + else if( mon_ == sistrip::DEAD_STRIP_BIT_ALL_STRIPS) { + generator_->axisLabel("Dead Strip Bit" ); + } + else if( mon_ == sistrip::NUM_OF_DEAD) { + } + else if( mon_ == sistrip::NUM_OF_BAD) { + } + else if( mon_ == sistrip::NUM_OF_BAD_SHIFTED) { + } + else if( mon_ == sistrip::NUM_OF_BAD_LOW_NOISE) { + } + else if( mon_ == sistrip::NUM_OF_BAD_LARGE_SIGNIF) { + } + else if( mon_ == sistrip::NUM_OF_BAD_FIT_STATUS) { + } + else if( mon_ == sistrip::NUM_OF_BAD_AD_PROBAB) { + } + else if( mon_ == sistrip::NUM_OF_BAD_KS_PROBAB) { + } + else if( mon_ == sistrip::NUM_OF_BAD_JB_PROBAB) { + } + else if( mon_ == sistrip::NUM_OF_BAD_CHI2_PROBAB) { + } + else if( mon_ == sistrip::NUM_OF_BAD_TAIL) { + } + else if( mon_ == sistrip::NUM_OF_BAD_DOUBLE_PEAK) { + } + + else { edm::LogWarning(mlSummaryPlots_) << "[SummaryPlotFactory::" << __func__ << "]" << " Unexpected SummaryHisto value:" diff --git a/DQM/SiStripCommon/interface/TkHistoMap.h b/DQM/SiStripCommon/interface/TkHistoMap.h index 8c441b08edcd1..acb87c4bb94a2 100644 --- a/DQM/SiStripCommon/interface/TkHistoMap.h +++ b/DQM/SiStripCommon/interface/TkHistoMap.h @@ -47,18 +47,15 @@ class TkHistoMap{ void saveAsCanvas(const std::string& filename, const std::string& options="", const std::string& mode="RECREATE"); private: - + void load(const TkDetMap* tkDetMap, const std::string& path, float baseline, bool mechanicalView, bool isTH2F, bool createTkMap = true); - void createTkHistoMap(const std::string& path, const std::string& MapName, float baseline, bool mechanicalView); + void createTkHistoMap(DQMStore::IBooker& ibooker, const std::string& path, const std::string& MapName, float baseline, bool mechanicalView); - std::string folderDefinition(std::string folder, const std::string& MapName, int layer , bool mechanicalView,std::string& fullName ); + std::string folderDefinition(DQMStore::IBooker& ibooker, std::string folder, const std::string& MapName, int layer , bool mechanicalView,std::string& fullName ); DQMStore* dqmStore_{nullptr}; - DQMStore::IBooker* ibooker_{nullptr}; - DQMStore::IGetter* igetter_{nullptr}; - - + const TkDetMap* tkdetmap_; DetId cached_detid; int16_t cached_layer; diff --git a/DQM/SiStripCommon/src/TkHistoMap.cc b/DQM/SiStripCommon/src/TkHistoMap.cc index e4eed1c0dd31b..f5c84d1a5c8bc 100644 --- a/DQM/SiStripCommon/src/TkHistoMap.cc +++ b/DQM/SiStripCommon/src/TkHistoMap.cc @@ -6,32 +6,41 @@ TkHistoMap::TkHistoMap(const TkDetMap* tkDetMap): HistoNumber(35) { - LogTrace("TkHistoMap") <<"TkHistoMap::constructor without parameters"; + LogTrace("TkHistoMap") <<"TkHistoMap::constructor without parameters"; load(tkDetMap, "", 0.0f, false, false, false); } TkHistoMap::TkHistoMap(const TkDetMap* tkDetMap, const std::string& path, const std::string& MapName, float baseline, bool mechanicalView): - HistoNumber(35), + HistoNumber(35), MapName_(MapName) { - LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; + LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; load(tkDetMap, path, baseline, mechanicalView, false); + dqmStore_->meBookerGetter([this, &path, &baseline, mechanicalView](DQMStore::IBooker& ibooker, + DQMStore::IGetter&){ + this->createTkHistoMap(ibooker, path, MapName_, baseline, mechanicalView); + }); } TkHistoMap::TkHistoMap(const TkDetMap* tkDetMap, const std::string& path, const std::string& MapName, float baseline, bool mechanicalView, bool isTH2F): HistoNumber(35), MapName_(MapName) { - LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; + LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; load(tkDetMap, path, baseline, mechanicalView, isTH2F); + dqmStore_->meBookerGetter([this, &path, &baseline, mechanicalView](DQMStore::IBooker& ibooker, + DQMStore::IGetter&){ + this->createTkHistoMap(ibooker, path, MapName_, baseline, mechanicalView); + }); } TkHistoMap::TkHistoMap(const TkDetMap* tkDetMap, DQMStore::IBooker& ibooker, const std::string& path, const std::string& MapName, float baseline, bool mechanicalView): HistoNumber(35), MapName_(MapName) { - LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; + LogTrace("TkHistoMap") <<"TkHistoMap::constructor with parameters"; load(tkDetMap, path, baseline, mechanicalView, false); + createTkHistoMap(ibooker, path, MapName_, baseline, mechanicalView); } void TkHistoMap::load(const TkDetMap* tkDetMap, const std::string& path, float baseline, bool mechanicalView, bool isTH2F, bool createTkMap) @@ -41,7 +50,6 @@ void TkHistoMap::load(const TkDetMap* tkDetMap, const std::string& path, float b loadServices(); tkdetmap_ = tkDetMap; isTH2F_ = isTH2F; - if (createTkMap) createTkHistoMap(path, MapName_, baseline, mechanicalView); } void TkHistoMap::loadServices(){ @@ -51,12 +59,8 @@ void TkHistoMap::loadServices(){ "\nUnAvailable Service DQMStore: please insert in the configuration file an instance like" "\n\tprocess.load(\"DQMServices.Core.DQMStore_cfg\")" "\n------------------------------------------"; - } + } dqmStore_ = edm::Service().operator->(); - dqmStore_->meBookerGetter([this](DQMStore::IBooker &b, DQMStore::IGetter &g){ - this->ibooker_ = &b; - this->igetter_ = &g; - }); } void TkHistoMap::save(const std::string& filename){ @@ -66,24 +70,27 @@ void TkHistoMap::save(const std::string& filename){ void TkHistoMap::loadTkHistoMap(const std::string& path, const std::string& MapName, bool mechanicalView){ MapName_=MapName; - std::string fullName, folder; tkHistoMap_.resize(HistoNumber); - for(int layer=1;layerget(folder+fullName); + if (folder.find_last_of("/")!=folder.length()-1) + folder+="/"; + tkHistoMap_[layer]=igetter.get(folder+fullName); #ifdef debug_TkHistoMap - LogTrace("TkHistoMap") << "[TkHistoMap::loadTkHistoMap] folder " << folder << " histoName " << fullName << " layer " << layer << " ptr " << tkHistoMap_[layer] << " find " << folder.find_last_of("/") << " length " << folder.length(); + LogTrace("TkHistoMap") << "[TkHistoMap::loadTkHistoMap] folder " << folder << " histoName " << fullName << " layer " << layer << " ptr " << tkHistoMap_[layer] << " find " << folder.find_last_of("/") << " length " << folder.length(); #endif - } + } + }; + dqmStore_->meBookerGetter(loadMap); } -void TkHistoMap::createTkHistoMap(const std::string& path, const std::string& MapName, float baseline, bool mechanicalView){ +void TkHistoMap::createTkHistoMap(DQMStore::IBooker& ibooker, const std::string& path, const std::string& MapName, float baseline, bool mechanicalView){ int nchX; int nchY; @@ -94,17 +101,17 @@ void TkHistoMap::createTkHistoMap(const std::string& path, const std::string& Ma tkHistoMap_.resize(HistoNumber); const bool bookTH2F = isTH2F_; for(int layer=1;layergetComponents(layer,nchX,lowX,highX,nchY,lowY,highY); MonitorElement* me; if(bookTH2F==false){ - me = ibooker_->bookProfile2D(fullName.c_str(),fullName.c_str(), + me = ibooker.bookProfile2D(fullName.c_str(),fullName.c_str(), nchX,lowX,highX, nchY,lowY,highY, 0.0, 0.0); } else{ - me = ibooker_->book2D(fullName.c_str(),fullName.c_str(), + me = ibooker.book2D(fullName.c_str(),fullName.c_str(), nchX,lowX,highX, nchY,lowY,highY); } @@ -123,11 +130,10 @@ void TkHistoMap::createTkHistoMap(const std::string& path, const std::string& Ma } } -std::string TkHistoMap::folderDefinition(std::string folder, const std::string& MapName, int layer , bool mechanicalView,std::string& fullName ){ +std::string TkHistoMap::folderDefinition(DQMStore::IBooker& ibooker, std::string folder, const std::string& MapName, int layer , bool mechanicalView,std::string& fullName ){ std::string name = MapName+std::string("_"); fullName=name+TkDetMap::getLayerName(layer); - // std::cout << "[TkHistoMap::folderDefinition] fullName: " << fullName << std::endl; if(mechanicalView){ std::stringstream ss; @@ -140,9 +146,8 @@ std::string TkHistoMap::folderDefinition(std::string folder, const std::string& TkDetMap::getSubDetLayerSide(layer,subDet,subdetlayer,side); folderOrg.getSubDetLayerFolderName(ss,subDet,subdetlayer,side); folder = ss.str(); - // std::cout << "[TkHistoMap::folderDefinition] folder: " << folder << std::endl; } - ibooker_->setCurrentFolder(folder); + ibooker.setCurrentFolder(folder); return folder; } @@ -323,4 +328,4 @@ void TkHistoMap::saveAsCanvas(const std::string& filename, const std::string& op CTECM->Write(); f->Close(); delete f; -} \ No newline at end of file +} diff --git a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc index ed98b9fdf4219..89aa4ab3b056e 100644 --- a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc +++ b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.cc @@ -34,33 +34,34 @@ SiStripBadComponentInfo::SiStripBadComponentInfo(edm::ParameterSet const& pSet) // SiStripBadComponentInfo::~SiStripBadComponentInfo() { LogDebug("SiStripBadComponentInfo") << "SiStripBadComponentInfo::Deleting SiStripBadComponentInfo "; - + mapBadAPV.clear(); + mapBadFiber.clear(); + mapBadStrip.clear(); } // // -- Begin Run // void SiStripBadComponentInfo::beginRun(edm::Run const& run, edm::EventSetup const& eSetup) { +} +// +// -- Read Condition +// +void SiStripBadComponentInfo::checkBadComponents(edm::EventSetup const& eSetup) { + LogDebug ("SiStripBadComponentInfo") <<"SiStripBadComponentInfo:: Begining of Run"; //Retrieve tracker topology from geometry eSetup.get().get(tTopoHandle_); - + const TrackerTopology* const topo = tTopoHandle_.product(); + unsigned long long cacheID = eSetup.get().cacheIdentifier(); if (m_cacheID_ == !cacheID) { - m_cacheID_ = cacheID; LogDebug("SiStripBadComponentInfo") <<"SiStripBadchannelInfoNew::readCondition : " - << " Change in Cache"; + <<" Change in Cache"; eSetup.get().get(qualityLabel_,siStripQuality_); - } -} -// -// -- Read Condition -// -void SiStripBadComponentInfo::checkBadComponents() { - const TrackerTopology* const topo = tTopoHandle_.product(); - + std::vector BC = siStripQuality_->getBadComponentList(); for (size_t i=0;itecWheel(BC[i].detid); } - fillBadComponentHistos(subdet,component,BC[i]); + fillBadComponentMaps(subdet,component,BC[i]); } + //&&&&&&&&&&&&&&&&&& // Single Strip Info //&&&&&&&&&&&&&&&&&& @@ -125,27 +127,33 @@ void SiStripBadComponentInfo::checkBadComponents() { else subdet=1; component=topo->tecWheel(detid); } - + SiStripQuality::Range sqrange = SiStripQuality::Range( siStripQuality_->getDataVectorBegin()+rp->ibegin , siStripQuality_->getDataVectorBegin()+rp->iend ); for(int it=0;itdecode( *(sqrange.first+it) ).range; - float val = badStripME_->getBinContent(subdet, component); + float val = (mapBadStrip.find(std::make_pair(subdet,component))!=mapBadStrip.end()) ? mapBadStrip.at(std::make_pair(subdet,component)) : 0.; val += range; - badStripME_->setBinContent(subdet, component,val); + mapBadStrip[std::make_pair(subdet,component)]=val; } } } // // -- End Run // +void SiStripBadComponentInfo::endRun(edm::Run const& run, edm::EventSetup const& eSetup){ + LogDebug ("SiStripBadComponentInfo") <<"SiStripBadComponentInfo:: End of Run"; + checkBadComponents(eSetup); +} +// +// -- End Job +// void SiStripBadComponentInfo::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter){ LogDebug ("SiStripBadComponentInfo") <<"SiStripBadComponentInfo::dqmEndRun"; bookBadComponentHistos(ibooker, igetter); - checkBadComponents(); - createSummary(badAPVME_); - createSummary(badFiberME_); - createSummary(badStripME_); + createSummary(badAPVME_ ,mapBadAPV ); + createSummary(badFiberME_,mapBadFiber); + createSummary(badStripME_,mapBadStrip); } // // -- Book MEs for SiStrip Dcs Fraction @@ -159,7 +167,7 @@ void SiStripBadComponentInfo::bookBadComponentHistos(DQMStore::IBooker &ibooker, ibooker.cd("SiStrip"); strip_dir = ibooker.pwd(); } - std::cout << "SiStripBadComponentInfo::bookBadComponentHistos ==> " << strip_dir << " " << ibooker.pwd() << std::endl; + edm::LogInfo ("SiStripBadComponentInfo") << "SiStripBadComponentInfo::bookBadComponentHistos ==> " << strip_dir << " " << ibooker.pwd() << std::endl; if (!strip_dir.empty()) ibooker.setCurrentFolder(strip_dir+"/EventInfo"); else ibooker.setCurrentFolder("SiStrip/EventInfo"); @@ -203,28 +211,34 @@ void SiStripBadComponentInfo::bookBadComponentHistos(DQMStore::IBooker &ibooker, ibooker.cd(); } } -void SiStripBadComponentInfo::fillBadComponentHistos(int xbin,int component,SiStripQuality::BadComponent& BC){ +void SiStripBadComponentInfo::fillBadComponentMaps(int xbin,int component,SiStripQuality::BadComponent& BC){ + + auto index = std::make_pair(xbin,component); if (BC.BadApvs){ - int ntot = std::bitset<16>(BC.BadApvs&0x3f).count(); - float val = badAPVME_->getBinContent(xbin, component); + int ntot = std::bitset<16>(BC.BadApvs&0x3f).count(); + float val = (mapBadAPV.find(index)!=mapBadAPV.end()) ? mapBadAPV.at(index) : 0.; val += ntot; - badAPVME_->setBinContent(xbin, component, val); + mapBadAPV[index]=val; } if (BC.BadFibers){ int ntot = std::bitset<16>(BC.BadFibers&0x7).count(); - float val = badFiberME_->getBinContent(xbin, component); + float val = (mapBadStrip.find(index)!=mapBadStrip.end()) ? mapBadStrip.at(index) : 0.; val+= ntot; - badFiberME_->setBinContent(xbin, component, val); + mapBadStrip[index]=val; } } -void SiStripBadComponentInfo::createSummary(MonitorElement* me) { +void SiStripBadComponentInfo::createSummary(MonitorElement* me,const std::map,float >& map) { for (int i=1; igetNbinsY(); k++) { - if (me->getBinContent(i,k)) sum+= me->getBinContent(i,k); - } - me->setBinContent(i,me->getNbinsY(), sum); + float sum = 0.0; + for (int k=1; kgetNbinsY(); k++) { + auto index = std::make_pair(i,k); + if (map.find(index)!=map.end()){ + me->setBinContent(i,k,map.at(index)); // fill the layer/wheel bins + sum += map.at(index); + } + } + me->setBinContent(i,me->getNbinsY(), sum); // fill the summary bin (last one) } } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h index af1a3f781dec1..4086a297403d1 100644 --- a/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h +++ b/DQM/SiStripMonitorClient/plugins/SiStripBadComponentInfo.h @@ -50,18 +50,22 @@ class SiStripBadComponentInfo: public DQMEDHarvester { protected: void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override; //performed in the endJob private: - void checkBadComponents(); + void checkBadComponents(edm::EventSetup const& eSetup); void bookBadComponentHistos(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter); - void fillBadComponentHistos(int xbin, int component,SiStripQuality::BadComponent& BC); - void createSummary(MonitorElement* me); + void fillBadComponentMaps(int xbin, int component,SiStripQuality::BadComponent& BC); + void createSummary(MonitorElement* me,const std::map,float >& map); MonitorElement * badAPVME_; MonitorElement * badFiberME_; MonitorElement * badStripME_; + std::map,float > mapBadAPV; + std::map,float > mapBadFiber; + std::map,float > mapBadStrip; unsigned long long m_cacheID_; bool bookedStatus_; diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py index 76ebbe3eca577..1380afcfc1496 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_Cosmic_cff.py @@ -21,30 +21,29 @@ getQualityTestsFromFile = cms.untracked.bool(True) ) -# from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* -# siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') -# siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) - -# from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* -# siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( -# cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information -# cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected -# cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components -# cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL -# cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes -# cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking -# ) -# siStripQualityESProducer.ReduceGranularity = cms.bool(False) -# siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) -# siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' - -# siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", -# StripQualityLabel = cms.string('MergedBadComponent') -# ) +from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* +siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') +siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) + +from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* +siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( + cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information + cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected + cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components + cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL + cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes + cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking + ) +siStripQualityESProducer.ReduceGranularity = cms.bool(False) +siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) +siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' + +siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", + StripQualityLabel = cms.string('MergedBadComponent') +) # Sequence -# SiStripCosmicDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser*siStripBadComponentInfo) -SiStripCosmicDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser) +SiStripCosmicDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser*siStripBadComponentInfo) #removed modules using TkDetMap #SiStripCosmicDQMClient = cms.Sequence(siStripQTester) diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py index 4dcac3a03adbb..b145e9b4ff887 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_HeavyIons_cff.py @@ -32,32 +32,31 @@ getQualityTestsFromFile = cms.untracked.bool(True) ) -# from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* -# siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') -# siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) +from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* +siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') +siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) -# from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* -# siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( -# cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information -# cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected -# cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components -# cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL -# cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes -# cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking -# ) -# siStripQualityESProducer.ReduceGranularity = cms.bool(False) -# siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) -# siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' +from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* +siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( + cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information + cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected + cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components + cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL + cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes + cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking + ) +siStripQualityESProducer.ReduceGranularity = cms.bool(False) +siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) +siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' -# siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", -# StripQualityLabel = cms.string('MergedBadComponent') -# ) +siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", + StripQualityLabel = cms.string('MergedBadComponent') +) # define new HI sequence #removed modules using TkDetMap #SiStripOfflineDQMClientHI = cms.Sequence(siStripQTesterHI) -# SiStripOfflineDQMClientHI = cms.Sequence(siStripQTesterHI*siStripOfflineAnalyser*siStripBadComponentInfo) -SiStripOfflineDQMClientHI = cms.Sequence(siStripQTesterHI*siStripOfflineAnalyser) +SiStripOfflineDQMClientHI = cms.Sequence(siStripQTesterHI*siStripOfflineAnalyser*siStripBadComponentInfo) # Services needed for TkHistoMap from CalibTracker.SiStripCommon.TkDetMap_cff import * diff --git a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py index f9787e729c008..b779f0d3c9319 100644 --- a/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py +++ b/DQM/SiStripMonitorClient/python/SiStripClientConfig_Tier0_cff.py @@ -37,31 +37,30 @@ getQualityTestsFromFile = cms.untracked.bool(True) ) -# from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* -# siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') -# siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) +from CalibTracker.SiStripESProducers.SiStripBadModuleFedErrESSource_cfi import* +siStripBadModuleFedErrESSource.appendToDataLabel = cms.string('BadModules_from_FEDBadChannel') +siStripBadModuleFedErrESSource.ReadFromFile = cms.bool(False) -# from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* -# siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( -# cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information -# cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected -# cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components -# cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL -# cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes -# cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking -# ) -# siStripQualityESProducer.ReduceGranularity = cms.bool(False) -# siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) -# siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' +from CalibTracker.SiStripESProducers.SiStripQualityESProducer_cfi import* +siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet( + cms.PSet(record = cms.string("SiStripDetVOffRcd"), tag = cms.string('')), # DCS information + cms.PSet(record = cms.string('SiStripDetCablingRcd'), tag = cms.string('')), # Use Detector cabling information to exclude detectors not connected + cms.PSet(record = cms.string('SiStripBadChannelRcd'), tag = cms.string('')), # Online Bad components + cms.PSet(record = cms.string('SiStripBadFiberRcd'), tag = cms.string('')), # Bad Channel list from the selected IOV as done at PCL + cms.PSet(record = cms.string('SiStripBadModuleFedErrRcd'), tag = cms.string('BadModules_from_FEDBadChannel')), # BadChannel list from FED erroes + cms.PSet(record = cms.string('RunInfoRcd'), tag = cms.string('')) # List of FEDs exluded during data taking + ) +siStripQualityESProducer.ReduceGranularity = cms.bool(False) +siStripQualityESProducer.ThresholdForReducedGranularity = cms.double(0.3) +siStripQualityESProducer.appendToDataLabel = 'MergedBadComponent' -# siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", -# StripQualityLabel = cms.string('MergedBadComponent') -# ) +siStripBadComponentInfo = cms.EDProducer("SiStripBadComponentInfo", + StripQualityLabel = cms.string('MergedBadComponent') +) # Sequence -# SiStripOfflineDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser*siStripBadComponentInfo) -SiStripOfflineDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser) +SiStripOfflineDQMClient = cms.Sequence(siStripQTester*siStripOfflineAnalyser*siStripBadComponentInfo) #removed modules using TkDetMap #SiStripOfflineDQMClient = cms.Sequence(siStripQTester) diff --git a/DQM/TrackingMonitor/src/PackedCandidateTrackValidator.cc b/DQM/TrackingMonitor/src/PackedCandidateTrackValidator.cc index 3dc9014546df3..3fa7dadee67e3 100644 --- a/DQM/TrackingMonitor/src/PackedCandidateTrackValidator.cc +++ b/DQM/TrackingMonitor/src/PackedCandidateTrackValidator.cc @@ -13,8 +13,8 @@ #include "DataFormats/Common/interface/Association.h" #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/PatCandidates/interface/PackedCandidate.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" -#include "DataFormats/PatCandidates/interface/liblogintpack.h" +#include "DataFormats/Math/interface/libminifloat.h" +#include "DataFormats/Math/interface/liblogintpack.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "DataFormats/Math/interface/deltaPhi.h" diff --git a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h b/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h deleted file mode 100644 index f0f5071627778..0000000000000 --- a/DQMOffline/Trigger/interface/BTVHLTOfflineSource.h +++ /dev/null @@ -1,194 +0,0 @@ -#ifndef BTVHLTOfflineSource_H -#define BTVHLTOfflineSource_H -/* - BTVHLTOffline DQM code -*/ -// -// Originally created by: Anne-Catherine Le Bihan -// June 2015 -// Following the structure used in JetMetHLTOfflineSource - - -// system include files -#include -#include -#include -#include -#include -#include -#include -#include - -// user include files -#include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "DataFormats/BTauReco/interface/JetTag.h" -#include "DataFormats/BTauReco/interface/SecondaryVertexTagInfo.h" -#include "DataFormats/Common/interface/TriggerResults.h" -#include "DataFormats/HLTReco/interface/TriggerEvent.h" -#include "DataFormats/HLTReco/interface/TriggerObject.h" -#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" -#include "FWCore/Common/interface/TriggerNames.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" - -class BTVHLTOfflineSource : public DQMEDAnalyzer { - public: - explicit BTVHLTOfflineSource(const edm::ParameterSet&); - ~BTVHLTOfflineSource() override; - - private: - void analyze(const edm::Event&, const edm::EventSetup&) override; - void bookHistograms(DQMStore::IBooker &, edm::Run const & run, edm::EventSetup const & c) override; - void dqmBeginRun(edm::Run const& run, edm::EventSetup const& c) override; - - bool verbose_; - std::string dirname_; - std::string processname_; - std::string pathname_; - std::string filtername_; - - std::vector > custompathnamepairs_; - - edm::InputTag triggerSummaryLabel_; - edm::InputTag triggerResultsLabel_; - - edm::EDGetTokenT offlineCSVTokenPF_; - edm::EDGetTokenT offlineCSVTokenCalo_; - - edm::EDGetTokenT > hltFastPVToken_; - edm::EDGetTokenT > hltPFPVToken_; - edm::EDGetTokenT > hltCaloPVToken_; - edm::EDGetTokenT > offlinePVToken_; - - edm::EDGetTokenT triggerResultsToken; - edm::EDGetTokenT triggerResultsFUToken; - edm::EDGetTokenT triggerSummaryToken; - edm::EDGetTokenT triggerSummaryFUToken; - - edm::EDGetTokenT csvCaloTagsToken_; - edm::EDGetTokenT csvPfTagsToken_; - edm::Handle csvCaloTags; - edm::Handle csvPfTags; - - HLTConfigProvider hltConfig_; - edm::Handle triggerResults_; - edm::TriggerNames triggerNames_; - edm::Handle triggerObj_; - - class PathInfo { - PathInfo(): - prescaleUsed_(-1), - pathName_("unset"), - filterName_("unset"), - processName_("unset"), - objectType_(-1), - triggerType_("unset") - {}; - - public: - void setHistos( - MonitorElement* const CSV, MonitorElement* const Pt, MonitorElement* const Eta, - MonitorElement* const CSV_RECOvsHLT, MonitorElement* const PVz, MonitorElement* const fastPVz, - MonitorElement* const PVz_HLTMinusRECO, MonitorElement* const fastPVz_HLTMinusRECO - ) - { CSV_ = CSV; Pt_ = Pt; Eta_ = Eta; CSV_RECOvsHLT_ = CSV_RECOvsHLT; PVz_ = PVz; fastPVz_ = fastPVz; - PVz_HLTMinusRECO_ = PVz_HLTMinusRECO; fastPVz_HLTMinusRECO_ = fastPVz_HLTMinusRECO; - }; - - - ~PathInfo() = default;; - PathInfo(int prescaleUsed, - std::string pathName, - std::string filterName, - std::string processName, - size_t type, - std::string triggerType): - prescaleUsed_(prescaleUsed), - pathName_(std::move(pathName)), - filterName_(std::move(filterName)), - processName_(std::move(processName)), - objectType_(type), - triggerType_(std::move(triggerType)) - { - } - - MonitorElement * getMEhisto_CSV() { return CSV_;} - MonitorElement * getMEhisto_Pt() { return Pt_; } - MonitorElement * getMEhisto_Eta() { return Eta_;} - MonitorElement * getMEhisto_CSV_RECOvsHLT() { return CSV_RECOvsHLT_;} - MonitorElement * getMEhisto_PVz() { return PVz_;} - MonitorElement * getMEhisto_fastPVz() { return fastPVz_;} - MonitorElement * getMEhisto_PVz_HLTMinusRECO() { return PVz_HLTMinusRECO_;} - MonitorElement * getMEhisto_fastPVz_HLTMinusRECO() { return fastPVz_HLTMinusRECO_;} - - const std::string getLabel( ) const { - return filterName_; - } - void setLabel(std::string labelName){ - filterName_ = std::move(labelName); - return; - } - const std::string getPath( ) const { - return pathName_; - } - const int getprescaleUsed() const { - return prescaleUsed_; - } - const std::string getProcess( ) const { - return processName_; - } - const int getObjectType( ) const { - return objectType_; - } - const std::string getTriggerType( ) const { - return triggerType_; - } - const edm::InputTag getTag() const{ - edm::InputTag tagName(filterName_,"",processName_); - return tagName; - } - bool operator==(const std::string& v) - { - return v==pathName_; - } - - private: - - int prescaleUsed_; - std::string pathName_; - std::string filterName_; - std::string processName_; - int objectType_; - std::string triggerType_; - - MonitorElement* CSV_; - MonitorElement* Pt_; - MonitorElement* Eta_; - MonitorElement* CSV_RECOvsHLT_; - MonitorElement* PVz_; - MonitorElement* fastPVz_; - MonitorElement* PVz_HLTMinusRECO_; - MonitorElement* fastPVz_HLTMinusRECO_; - - }; - - class PathInfoCollection: public std::vector { - public: - PathInfoCollection(): std::vector() - {}; - std::vector::iterator find(const std::string& pathName) { - return std::find(begin(), end(), pathName); - } - }; - PathInfoCollection hltPathsAll_; - - }; -#endif diff --git a/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h b/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h index 20d7bace699a7..8e1af9480408f 100644 --- a/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h +++ b/DQMOffline/Trigger/interface/HLTTauDQMOfflineSource.h @@ -59,9 +59,7 @@ class HLTTauDQMOfflineSource : public DQMEDAnalyzer { }; std::vector refObjects_; bool tagAndProbe_; - - std::vector > num_genTriggerEventFlag_; - std::vector > den_genTriggerEventFlag_; + std::vector tagAndProbePaths; //DQM Prescaler int counterEvt_; //counter diff --git a/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h b/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h index 9c8f2fd494d49..bf64920d24a01 100644 --- a/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h +++ b/DQMOffline/Trigger/interface/HLTTauDQMTagAndProbePlotter.h @@ -5,13 +5,13 @@ #include "DQMOffline/Trigger/interface/HLTTauDQMPlotter.h" #include "DQMOffline/Trigger/interface/HLTTauDQMPath.h" -#include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h" - +//#include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h" +#include "FWCore/Common/interface/TriggerNames.h" +#include "DataFormats/Common/interface/TriggerResults.h" namespace edm { class Event; class EventSetup; - class TriggerResults; } namespace trigger { @@ -22,17 +22,19 @@ class HLTConfigProvider; class HLTTauDQMTagAndProbePlotter: private HLTTauDQMPlotter { public: - HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, std::unique_ptr numFlag, std::unique_ptr denFlag, const std::string& dqmBaseFolder); + HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, const std::vector& modLabels, const std::string& dqmBaseFolder); ~HLTTauDQMTagAndProbePlotter(); using HLTTauDQMPlotter::isValid; void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &iRun, edm::EventSetup const &iSetup); - void analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup, const HLTTauDQMOfflineObjects& refCollection); + void analyze(edm::Event const& iEvent, const edm::TriggerResults& triggerResults, const trigger::TriggerEvent& triggerEvent, const HLTTauDQMOfflineObjects& refCollection); private: + LV findTrgObject(std::string, const trigger::TriggerEvent&); + const int nbinsPt_; const double ptmin_,ptmax_; int nbinsEta_; @@ -41,8 +43,10 @@ class HLTTauDQMTagAndProbePlotter: private HLTTauDQMPlotter { const double phimin_,phimax_; std::string xvariable; - std::unique_ptr num_genTriggerEventFlag_; - std::unique_ptr den_genTriggerEventFlag_; + std::vector numTriggers; + std::vector denTriggers; + + std::vector moduleLabels; unsigned int nOfflineObjs; diff --git a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc new file mode 100644 index 0000000000000..4b3eb52b59735 --- /dev/null +++ b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.cc @@ -0,0 +1,417 @@ +#include "DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h" + +#include "FWCore/Common/interface/TriggerNames.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/Run.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/HLTReco/interface/TriggerEvent.h" +#include "DataFormats/HLTReco/interface/TriggerObject.h" +#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" + +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" + +#include "DQMServices/Core/interface/MonitorElement.h" + +#include "CommonTools/UtilAlgos/interface/DeltaR.h" +#include "DataFormats/VertexReco/interface/Vertex.h" + +#include "TMath.h" +#include "TH1F.h" +#include "TH2F.h" +#include "TProfile.h" +#include "TPRegexp.h" + +#include +#include + +using namespace edm; +using namespace reco; +using namespace std; +using namespace trigger; + +BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) +{ + LogDebug("BTVHLTOfflineSource") << "constructor...."; + + dirname_ = iConfig.getUntrackedParameter("dirname",std::string("HLT/BTV/")); + processname_ = iConfig.getParameter("processname"); + verbose_ = iConfig.getUntrackedParameter< bool >("verbose", false); + triggerSummaryLabel_ = iConfig.getParameter("triggerSummaryLabel"); + triggerResultsLabel_ = iConfig.getParameter("triggerResultsLabel"); + turnon_threshold_loose_ = iConfig.getParameter("turnon_threshold_loose"); + turnon_threshold_medium_ = iConfig.getParameter("turnon_threshold_medium"); + turnon_threshold_tight_ = iConfig.getParameter("turnon_threshold_tight"); + triggerSummaryToken = consumes (triggerSummaryLabel_); + triggerResultsToken = consumes (triggerResultsLabel_); + triggerSummaryFUToken = consumes (edm::InputTag(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(),std::string("FU"))); + triggerResultsFUToken = consumes (edm::InputTag(triggerResultsLabel_.label(),triggerResultsLabel_.instance(),std::string("FU"))); + shallowTagInfosTokenCalo_ = consumes > (edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsInfosCalo")); + shallowTagInfosTokenPf_ = consumes > (edm::InputTag("hltDeepCombinedSecondaryVertexBJetTagsInfos")); + // caloTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( + // edm::InputTag("hltCombinedSecondaryVertexBJetTagsCalo")); + // pfTagInfosToken_ = consumes,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > ( + // edm::InputTag("hltCombinedSecondaryVertexBJetTagsPF")); + pfTagsToken_ = consumes (iConfig.getParameter("onlineDiscrLabelPF")); + caloTagsToken_ = consumes (iConfig.getParameter("onlineDiscrLabelCalo")); + offlineDiscrTokenb_ = consumes (iConfig.getParameter("offlineDiscrLabelb")); + offlineDiscrTokenbb_ = consumes (iConfig.getParameter("offlineDiscrLabelbb")); + hltFastPVToken_ = consumes > (iConfig.getParameter("hltFastPVLabel")); + hltPFPVToken_ = consumes > (iConfig.getParameter("hltPFPVLabel")); + hltCaloPVToken_ = consumes > (iConfig.getParameter("hltCaloPVLabel")); + offlinePVToken_ = consumes > (iConfig.getParameter("offlinePVLabel")); + + std::vector paths = iConfig.getParameter >("pathPairs"); + for(auto & path : paths) { + custompathnamepairs_.push_back(make_pair( + path.getParameter("pathname"), + path.getParameter("pathtype") + ));} +} + +BTVHLTOfflineSource::~BTVHLTOfflineSource() = default; + + +void BTVHLTOfflineSource::dqmBeginRun(const edm::Run& run, const edm::EventSetup& c) +{ + bool changed = true; + if (!hltConfig_.init(run, c, processname_, changed)) { + LogDebug("BTVHLTOfflineSource") << "HLTConfigProvider failed to initialize."; + } + + for (unsigned int i=0; i!=hltConfig_.size(); ++i) { + pathname_ = hltConfig_.triggerName(i); + filtername_ = "dummy"; + unsigned int usedPrescale = 1; + unsigned int objectType = 0; + std::string triggerType = ""; + + for (auto & custompathnamepair : custompathnamepairs_) { + if(pathname_.find(custompathnamepair.first) != std::string::npos) { + triggerType = custompathnamepair.second; + hltPathsAll_.push_back( + PathInfo(usedPrescale, pathname_, "dummy", processname_, objectType, triggerType)); + } + } + } +} + + +void +BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) +{ + iEvent.getByToken(triggerResultsToken, triggerResults_); + if(!triggerResults_.isValid()) { + iEvent.getByToken(triggerResultsFUToken,triggerResults_); + if(!triggerResults_.isValid()) { + edm::LogInfo("BTVHLTOfflineSource") << "TriggerResults not found, " + "skipping event"; + return; + } + } + + triggerNames_ = iEvent.triggerNames(*triggerResults_); + + iEvent.getByToken(triggerSummaryToken,triggerObj_); + if(!triggerObj_.isValid()) { + iEvent.getByToken(triggerSummaryFUToken,triggerObj_); + if(!triggerObj_.isValid()) { + edm::LogInfo("BTVHLTOfflineSource") << "TriggerEvent not found, " + "skipping event"; + return; + } + } + + iEvent.getByToken(caloTagsToken_, caloTags); + iEvent.getByToken(pfTagsToken_, pfTags); + + Handle VertexHandler; + + Handle offlineJetTagHandlerb; + iEvent.getByToken(offlineDiscrTokenb_, offlineJetTagHandlerb); + + Handle offlineJetTagHandlerbb; + iEvent.getByToken(offlineDiscrTokenbb_, offlineJetTagHandlerbb); + + Handle offlineVertexHandler; + iEvent.getByToken(offlinePVToken_, offlineVertexHandler); + + if(verbose_ && iEvent.id().event()%10000==0) + cout<<"Run = "<empty()) ) + { + const auto & iter = (v.getTriggerType() == "PF") ? pfTags->begin() : caloTags->begin(); + + float Discr_online = iter->second; + if (Discr_online<0) Discr_online = -0.05; + + v.Discr->Fill(Discr_online); + v.Pt->Fill(iter->first->pt()); + v.Eta->Fill(iter->first->eta()); + + if(offlineJetTagHandlerb.isValid()){ + for (auto const & iterOffb : *offlineJetTagHandlerb){ + float DR = reco::deltaR(iterOffb.first->eta(),iterOffb.first->phi(),iter->first->eta(),iter->first->phi()); + if (DR<0.3) { + float Discr_offline = iterOffb.second; + + // offline probb and probbb must be added (if probbb isn't specified, it'll just use probb) + if(offlineJetTagHandlerbb.isValid()){ + for (auto const & iterOffbb : *offlineJetTagHandlerbb){ + DR = reco::deltaR(iterOffbb.first->eta(),iterOffbb.first->phi(),iter->first->eta(),iter->first->phi()); + if (DR<0.3) { + Discr_offline += iterOffbb.second; + break; + } + } + } + + if (Discr_offline<0) Discr_offline = -0.05; + v.Discr_HLTvsRECO->Fill(Discr_online, Discr_offline); + v.Discr_HLTMinusRECO->Fill(Discr_online - Discr_offline); + + v.Discr_turnon_loose .denominator->Fill(Discr_offline); + v.Discr_turnon_medium.denominator->Fill(Discr_offline); + v.Discr_turnon_tight .denominator->Fill(Discr_offline); + + if (Discr_online > turnon_threshold_loose_) v.Discr_turnon_loose .numerator->Fill(Discr_offline); + if (Discr_online > turnon_threshold_medium_)v.Discr_turnon_medium.numerator->Fill(Discr_offline); + if (Discr_online > turnon_threshold_tight_) v.Discr_turnon_tight .numerator->Fill(Discr_offline); + + break; + } + } + } + + if (v.getTriggerType() == "PF") { + iEvent.getByToken(hltPFPVToken_, VertexHandler); + } else { + iEvent.getByToken(hltFastPVToken_, VertexHandler); + } + if (VertexHandler.isValid()) { + v.PVz->Fill(VertexHandler->begin()->z()); + if (offlineVertexHandler.isValid()) { + v.PVz_HLTMinusRECO->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); + } + } + } + + // specific to Calo b-tagging + if (caloTags.isValid() && v.getTriggerType() == "Calo" && !caloTags->empty()) { + iEvent.getByToken(hltCaloPVToken_, VertexHandler); + if (VertexHandler.isValid()) { + v.fastPVz->Fill(VertexHandler->begin()->z()); + if (offlineVertexHandler.isValid()) { + v.fastPVz_HLTMinusRECO->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); + } + } + } + + + // additional plots from tag info collections + ///////////////////////////////////////////// + + iEvent.getByToken(shallowTagInfosTokenPf_, shallowTagInfosPf); + iEvent.getByToken(shallowTagInfosTokenCalo_, shallowTagInfosCalo); + // iEvent.getByToken(pfTagInfosToken_, pfTagInfos); + // iEvent.getByToken(caloTagInfosToken_, caloTagInfos); + + // first try to get info from shallowTagInfos ... + if ( (v.getTriggerType() == "PF" && shallowTagInfosPf.isValid()) + || (v.getTriggerType() == "Calo" && shallowTagInfosCalo.isValid()) ) + { + const auto & shallowTagInfoCollection = (v.getTriggerType() == "PF") ? shallowTagInfosPf : shallowTagInfosCalo; + for (const auto & shallowTagInfo : *shallowTagInfoCollection) { + const auto & tagVars = shallowTagInfo.taggingVariables(); + + // n secondary vertices and n selected tracks + for (const auto & tagVar : tagVars.getList(reco::btau::jetNSecondaryVertices, false)) { + v.n_vtx->Fill(tagVar); + } + for (const auto & tagVar : tagVars.getList(reco::btau::jetNSelectedTracks, false)) { + v.n_sel_tracks->Fill(tagVar);} + + // impact parameter + const auto & trackSip3dVal = tagVars.getList(reco::btau::trackSip3dVal, false); + const auto & trackSip3dSig = tagVars.getList(reco::btau::trackSip3dSig, false); + for (unsigned i_trk=0; i_trk < trackSip3dVal.size(); i_trk++) { + float val = trackSip3dVal[i_trk]; + float sig = trackSip3dSig[i_trk]; + v.h_3d_ip_distance->Fill(val); + v.h_3d_ip_error->Fill(val/sig); + v.h_3d_ip_sig->Fill(sig); + } + + // vertex mass and tracks per vertex + for (const auto & tagVar : tagVars.getList(reco::btau::vertexMass, false)) { + v.vtx_mass->Fill(tagVar);} + for (const auto & tagVar : tagVars.getList(reco::btau::vertexNTracks, false)) { + v.n_vtx_trks->Fill(tagVar);} + + // // track N total/pixel hits + // for (const auto & tagVar : tagVars.getList(reco::btau::trackNPixelHits, false)) { + // v.n_pixel_hits->Fill(tagVar);} + // for (const auto & tagVar : tagVars.getList(reco::btau::trackNTotalHits, false)) { + // v.n_total_hits->Fill(tagVar);} + } + } + + // ... otherwise from usual tag infos. + // else + // if ( (v.getTriggerType() == "PF" && pfTagInfos.isValid()) + // || (v.getTriggerType() == "Calo" && caloTagInfos.isValid()) ) + // { + // const auto & DiscrTagInfoCollection = (v.getTriggerType() == "PF") ? pfTagInfos : caloTagInfos; + + // // loop over secondary vertex tag infos + // for (const auto & DiscrTagInfo : *DiscrTagInfoCollection) { + // v.n_vtx->Fill(DiscrTagInfo.nVertexCandidates()); + // v.n_sel_tracks->Fill(DiscrTagInfo.nSelectedTracks()); + + // // loop over selected tracks in each tag info + // for (unsigned i_trk=0; i_trk < DiscrTagInfo.nSelectedTracks(); i_trk++) { + // const auto & ip3d = DiscrTagInfo.trackIPData(i_trk).ip3d; + // v.h_3d_ip_distance->Fill(ip3d.value()); + // v.h_3d_ip_error->Fill(ip3d.error()); + // v.h_3d_ip_sig->Fill(ip3d.significance()); + // } + + // // loop over vertex candidates in each tag info + // for (unsigned i_sv=0; i_sv < DiscrTagInfo.nVertexCandidates(); i_sv++) { + // const auto & sv = DiscrTagInfo.secondaryVertex(i_sv); + // v.vtx_mass->Fill(sv.p4().mass()); + // v.n_vtx_trks->Fill(sv.nTracks()); + + // // loop over tracks for number of pixel and total hits + // const auto & trkIPTagInfo = DiscrTagInfo.trackIPTagInfoRef().get(); + // for (const auto & trk : trkIPTagInfo->selectedTracks()) { + // v.n_pixel_hits->Fill(trk.get()->hitPattern().numberOfValidPixelHits()); + // v.n_total_hits->Fill(trk.get()->hitPattern().numberOfValidHits()); + // } + // } + // } + // } + } +} + +void +BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const & run, edm::EventSetup const & c) +{ + iBooker.setCurrentFolder(dirname_); + for(auto & v : hltPathsAll_){ + // + std::string trgPathName = HLTConfigProvider::removeVersion(v.getPath()); + std::string subdirName = dirname_ +"/"+ trgPathName + v.getTriggerType(); + std::string trigPath = "("+trgPathName+")"; + iBooker.setCurrentFolder(subdirName); + + std::string labelname("HLT"); + std::string histoname(labelname+""); + std::string title(labelname+""); + + histoname = labelname+"_Discr"; + title = labelname+"_Discr "+trigPath; + v.Discr = iBooker.book1D(histoname.c_str(),title.c_str(),110,-0.1,1); + + histoname = labelname+"_Pt"; + title = labelname+"_Pt "+trigPath; + v.Pt = iBooker.book1D(histoname.c_str(),title.c_str(),100,0,400); + + histoname = labelname+"_Eta"; + title = labelname+"_Eta "+trigPath; + v.Eta = iBooker.book1D(histoname.c_str(),title.c_str(),60,-3.0,3.0); + + histoname = "HLTvsRECO_Discr"; + title = "online discr vs offline discr "+trigPath; + v.Discr_HLTvsRECO = iBooker.book2D(histoname.c_str(),title.c_str(),110,-0.1,1,110,-0.1,1); + + histoname = "HLTMinusRECO_Discr"; + title = "online discr minus offline discr "+trigPath; + v.Discr_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),100,-1,1); + + histoname = "Turnon_loose_Discr"; + title = "turn-on with loose threshold "+trigPath; + v.bookME(iBooker, v.Discr_turnon_loose, histoname, title, 22, -0.1, 1.); + + histoname = "Turnon_medium_Discr"; + title = "turn-on with medium threshold "+trigPath; + v.bookME(iBooker, v.Discr_turnon_medium, histoname, title, 22, -0.1, 1.); + + histoname = "Turnon_tight_Discr"; + title = "turn-on with tight threshold "+trigPath; + v.bookME(iBooker, v.Discr_turnon_tight, histoname, title, 22, -0.1, 1.); + + histoname = labelname+"_PVz"; + title = "online z(PV) "+trigPath; + v.PVz = iBooker.book1D(histoname.c_str(),title.c_str(),80,-20,20); + + histoname = labelname+"_fastPVz"; + title = "online z(fastPV) "+trigPath; + v.fastPVz = iBooker.book1D(histoname.c_str(),title.c_str(),80,-20,20); + + histoname = "HLTMinusRECO_PVz"; + title = "online z(PV) - offline z(PV) "+trigPath; + v.PVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),200,-0.5,0.5); + + histoname = "HLTMinusRECO_fastPVz"; + title = "online z(fastPV) - offline z(PV) "+trigPath; + v.fastPVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),100,-2,2); + + histoname = "n_vtx"; + title = "N vertex candidates "+trigPath; + v.n_vtx = iBooker.book1D(histoname.c_str(),title.c_str(), 10, -0.5, 9.5); + + histoname = "vtx_mass"; + title = "secondary vertex mass (GeV)"+trigPath; + v.vtx_mass = iBooker.book1D(histoname.c_str(), title.c_str(), 20, 0, 10); + + histoname = "n_vtx_trks"; + title = "N tracks associated to secondary vertex"+trigPath; + v.n_vtx_trks = iBooker.book1D(histoname.c_str(), title.c_str(), 20, -0.5, 19.5); + + histoname = "n_sel_tracks"; + title = "N selected tracks"+trigPath; + v.n_sel_tracks = iBooker.book1D(histoname.c_str(), title.c_str(), 25, -0.5, 24.5); + + histoname = "3d_ip_distance"; + title = "3D IP distance of tracks (cm)"+trigPath; + v.h_3d_ip_distance = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.1, 0.1); + + histoname = "3d_ip_error"; + title = "3D IP error of tracks (cm)"+trigPath; + v.h_3d_ip_error = iBooker.book1D(histoname.c_str(), title.c_str(), 40, 0., 0.1); + + histoname = "3d_ip_sig"; + title = "3D IP significance of tracks (cm)"+trigPath; + v.h_3d_ip_sig = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -40, 40); + + // histoname = "n_pixel_hits"; + // title = "N pixel hits"+trigPath; + // v.n_pixel_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 16, -0.5, 15.5); + + // histoname = "n_total_hits"; + // title = "N hits"+trigPath; + // v.n_total_hits = iBooker.book1D(histoname.c_str(), title.c_str(), 40, -0.5, 39.5); + } +} + +// Define this as a plug-in +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(BTVHLTOfflineSource); diff --git a/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h new file mode 100644 index 0000000000000..54b7826eeb74e --- /dev/null +++ b/DQMOffline/Trigger/plugins/BTVHLTOfflineSource.h @@ -0,0 +1,185 @@ +#ifndef BTVHLTOfflineSource_H +#define BTVHLTOfflineSource_H +/* + BTVHLTOffline DQM code +*/ +// +// Originally created by: Anne-Catherine Le Bihan +// June 2015 +// Following the structure used in JetMetHLTOfflineSource + + +// system include files +#include +#include +#include +#include +#include +#include +#include +#include + +// user include files +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include "DQMOffline/Trigger/plugins/TriggerDQMBase.h" +#include "DataFormats/BTauReco/interface/JetTag.h" +#include "DataFormats/BTauReco/interface/SecondaryVertexTagInfo.h" +#include "DataFormats/BTauReco/interface/ShallowTagInfo.h" +#include "DataFormats/Common/interface/TriggerResults.h" +#include "DataFormats/HLTReco/interface/TriggerEvent.h" +#include "DataFormats/HLTReco/interface/TriggerObject.h" +#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" +#include "FWCore/Common/interface/TriggerNames.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" + +class BTVHLTOfflineSource : public DQMEDAnalyzer { + public: + explicit BTVHLTOfflineSource(const edm::ParameterSet&); + ~BTVHLTOfflineSource() override; + + private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + void bookHistograms(DQMStore::IBooker &, edm::Run const & run, edm::EventSetup const & c) override; + void dqmBeginRun(edm::Run const& run, edm::EventSetup const& c) override; + + bool verbose_; + std::string dirname_; + std::string processname_; + std::string pathname_; + std::string filtername_; + + std::vector > custompathnamepairs_; + + edm::InputTag triggerSummaryLabel_; + edm::InputTag triggerResultsLabel_; + + float turnon_threshold_loose_; + float turnon_threshold_medium_; + float turnon_threshold_tight_; + + edm::EDGetTokenT offlineDiscrTokenb_; + edm::EDGetTokenT offlineDiscrTokenbb_; + + edm::EDGetTokenT > hltFastPVToken_; + edm::EDGetTokenT > hltPFPVToken_; + edm::EDGetTokenT > hltCaloPVToken_; + edm::EDGetTokenT > offlinePVToken_; + + edm::EDGetTokenT triggerResultsToken; + edm::EDGetTokenT triggerResultsFUToken; + edm::EDGetTokenT triggerSummaryToken; + edm::EDGetTokenT triggerSummaryFUToken; + + edm::EDGetTokenT > shallowTagInfosTokenCalo_; + edm::EDGetTokenT > shallowTagInfosTokenPf_; + + edm::Handle > shallowTagInfosCalo; + edm::Handle > shallowTagInfosPf; + + // edm::EDGetTokenT,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > + // caloTagInfosToken_; + // edm::EDGetTokenT,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > + // pfTagInfosToken_; + + edm::Handle,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > + caloTagInfos; + edm::Handle,reco::Track,edm::refhelper::FindUsingAdvance,reco::Track> >,reco::JTATagInfo>,reco::Vertex> > > + pfTagInfos; + + edm::EDGetTokenT caloTagsToken_; + edm::EDGetTokenT pfTagsToken_; + edm::Handle caloTags; + edm::Handle pfTags; + + HLTConfigProvider hltConfig_; + edm::Handle triggerResults_; + edm::TriggerNames triggerNames_; + edm::Handle triggerObj_; + + class PathInfo : public TriggerDQMBase { + PathInfo(): + prescaleUsed_(-1), + pathName_("unset"), + filterName_("unset"), + processName_("unset"), + objectType_(-1), + triggerType_("unset") + {}; + + public: + ~PathInfo() = default;; + PathInfo(int prescaleUsed, + std::string pathName, + std::string filterName, + std::string processName, + size_t type, + std::string triggerType): + prescaleUsed_(prescaleUsed), + pathName_(std::move(pathName)), + filterName_(std::move(filterName)), + processName_(std::move(processName)), + objectType_(type), + triggerType_(std::move(triggerType)) {} + + const std::string getLabel( ) const {return filterName_;} + void setLabel(std::string labelName) {filterName_ = std::move(labelName);} + const std::string getPath( ) const {return pathName_;} + const int getprescaleUsed() const {return prescaleUsed_;} + const std::string getProcess( ) const {return processName_;} + const int getObjectType( ) const {return objectType_;} + const std::string getTriggerType( ) const {return triggerType_;} + const edm::InputTag getTag() const {return edm::InputTag(filterName_,"",processName_);} + const bool operator== (const std::string& v) const {return v==pathName_;} + + MonitorElement* Discr; + MonitorElement* Pt; + MonitorElement* Eta; + MonitorElement* Discr_HLTvsRECO; + MonitorElement* Discr_HLTMinusRECO; + ObjME Discr_turnon_loose; + ObjME Discr_turnon_medium; + ObjME Discr_turnon_tight; + MonitorElement* PVz; + MonitorElement* fastPVz; + MonitorElement* PVz_HLTMinusRECO; + MonitorElement* fastPVz_HLTMinusRECO; + MonitorElement* n_vtx; + MonitorElement* vtx_mass; + MonitorElement* n_vtx_trks; + MonitorElement* n_sel_tracks; + MonitorElement* h_3d_ip_distance; + MonitorElement* h_3d_ip_error; + MonitorElement* h_3d_ip_sig; + // MonitorElement* n_pixel_hits_; + // MonitorElement* n_total_hits_; + + private: + int prescaleUsed_; + std::string pathName_; + std::string filterName_; + std::string processName_; + int objectType_; + std::string triggerType_; + }; + + class PathInfoCollection: public std::vector { + public: + PathInfoCollection(): std::vector() + {}; + std::vector::iterator find(const std::string& pathName) { + return std::find(begin(), end(), pathName); + } + }; + PathInfoCollection hltPathsAll_; + + }; +#endif diff --git a/DQMOffline/Trigger/plugins/TopMonitor.cc b/DQMOffline/Trigger/plugins/TopMonitor.cc index 4a3f2e472c0be..5832ab3bcd594 100644 --- a/DQMOffline/Trigger/plugins/TopMonitor.cc +++ b/DQMOffline/Trigger/plugins/TopMonitor.cc @@ -95,6 +95,8 @@ TopMonitor::TopMonitor( const edm::ParameterSet& iConfig ) : , invMassCutInAllMuPairs_ (iConfig.getParameter("invMassCutInAllMuPairs")) //Menglei , enablePhotonPlot_ ( iConfig.getParameter("enablePhotonPlot") ) + //Mateusz + , enableMETplot_(iConfig.getParameter("enableMETplot")) { std::string metcut_str = iConfig.getParameter("metSelection"); @@ -165,7 +167,7 @@ void TopMonitor::bookHistograms(DQMStore::IBooker & ibooker, std::string currentFolder = folderName_ ; ibooker.setCurrentFolder(currentFolder); - if (applyMETcut_){ + if (applyMETcut_ || enableMETplot_){ histname = "met"; histtitle = "PFMET"; bookME(ibooker,metME_,histname,histtitle,met_binning_.nbins,met_binning_.xmin, met_binning_.xmax); @@ -555,7 +557,7 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup edm::Handle metHandle; iEvent.getByToken( metToken_, metHandle ); - if (!metHandle.isValid() && applyMETcut_){ + if (!metHandle.isValid() && (applyMETcut_ || enableMETplot_)){ edm::LogWarning("TopMonitor") << "MET handle not valid \n"; return; } @@ -563,7 +565,7 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup float met = 0; float phi = 0; - if (applyMETcut_){ + if (applyMETcut_ || enableMETplot_){ reco::PFMET pfmet = metHandle->front(); if ( ! metSelection_( pfmet ) ) return; met = pfmet.pt(); @@ -759,7 +761,7 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup int ls = iEvent.id().luminosityBlock(); // filling histograms (denominator) - if (applyMETcut_){ + if (applyMETcut_ || enableMETplot_){ metME_.denominator -> Fill(met); metME_variableBinning_.denominator -> Fill(met); metPhiME_.denominator -> Fill(phi); @@ -902,7 +904,7 @@ void TopMonitor::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup // filling histograms (num_genTriggerEventFlag_) - if (applyMETcut_>0){ + if (applyMETcut_>0 || enableMETplot_){ metME_.numerator -> Fill(met); metME_variableBinning_.numerator -> Fill(met); metPhiME_.numerator -> Fill(phi); @@ -1089,6 +1091,8 @@ void TopMonitor::fillDescriptions(edm::ConfigurationDescriptions & descriptions) desc.add("invMassCutInAllMuPairs",false); //Menglei desc.add("enablePhotonPlot", false); + //Mateusz + desc.add("enableMETplot", false); edm::ParameterSetDescription genericTriggerEventPSet; genericTriggerEventPSet.add("andOr"); diff --git a/DQMOffline/Trigger/plugins/TopMonitor.h b/DQMOffline/Trigger/plugins/TopMonitor.h index 86132d14cce4c..9cbfe8a3604cf 100644 --- a/DQMOffline/Trigger/plugins/TopMonitor.h +++ b/DQMOffline/Trigger/plugins/TopMonitor.h @@ -279,6 +279,9 @@ bool invMassCutInAllMuPairs_; //Menglei bool enablePhotonPlot_; + + //Mateusz + bool enableMETplot_; }; diff --git a/DQMOffline/Trigger/plugins/TriggerDQMBase.h b/DQMOffline/Trigger/plugins/TriggerDQMBase.h index f02d5086fc3c5..c4606191a1636 100644 --- a/DQMOffline/Trigger/plugins/TriggerDQMBase.h +++ b/DQMOffline/Trigger/plugins/TriggerDQMBase.h @@ -8,7 +8,7 @@ class TriggerDQMBase { public: - TriggerDQMBase()= default;; + TriggerDQMBase()= default;; virtual ~TriggerDQMBase()= default;; struct MEbinning { @@ -16,7 +16,7 @@ class TriggerDQMBase double xmin; double xmax; }; - + struct ObjME { MonitorElement* numerator = nullptr; MonitorElement* denominator = nullptr; @@ -27,7 +27,6 @@ class TriggerDQMBase static MEbinning getHistoPSet (const edm::ParameterSet& pset); static MEbinning getHistoLSPSet (const edm::ParameterSet& pset); - protected: void bookME(DQMStore::IBooker &, ObjME& me, const std::string& histname, const std::string& histtitle, unsigned nbins, double xmin, double xmax); void bookME(DQMStore::IBooker &, ObjME& me, const std::string& histname, const std::string& histtitle, const std::vector& binningX); void bookME(DQMStore::IBooker &, ObjME& me, const std::string& histname, const std::string& histtitle, unsigned nbinsX, double xmin, double xmax, double ymin, double ymax); @@ -35,6 +34,8 @@ class TriggerDQMBase void bookME(DQMStore::IBooker &, ObjME& me, const std::string& histname, const std::string& histtitle, const std::vector& binningX, const std::vector& binningY); void setMETitle(ObjME& me, const std::string& titleX, const std::string& titleY); + protected: + private: };//class diff --git a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py index ccd59449076db..0eb2b02b1c953 100644 --- a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py +++ b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py @@ -4,30 +4,33 @@ BTVHLTOfflineSource = DQMEDAnalyzer( "BTVHLTOfflineSource", # - dirname = cms.untracked.string("HLT/BTV"), - processname = cms.string("HLT"), - verbose = cms.untracked.bool(False), + dirname = cms.untracked.string("HLT/BTV"), + processname = cms.string("HLT"), + verbose = cms.untracked.bool(False), # - triggerSummaryLabel = cms.InputTag("hltTriggerSummaryAOD","","HLT"), - triggerResultsLabel = cms.InputTag("TriggerResults","","HLT"), - offlineCSVLabelPF = cms.InputTag("pfCombinedInclusiveSecondaryVertexV2BJetTags"), - offlineCSVLabelCalo = cms.InputTag("pfCombinedInclusiveSecondaryVertexV2BJetTags"), - hltFastPVLabel = cms.InputTag("hltFastPrimaryVertex"), - hltPFPVLabel = cms.InputTag("hltVerticesPFSelector"), - hltCaloPVLabel = cms.InputTag("hltVerticesL3"), - offlinePVLabel = cms.InputTag("offlinePrimaryVertices"), - + triggerSummaryLabel = cms.InputTag("hltTriggerSummaryAOD","","HLT"), + triggerResultsLabel = cms.InputTag("TriggerResults","","HLT"), + onlineDiscrLabelPF = cms.InputTag("hltDeepCombinedSecondaryVertexBJetTagsPF", "probb"), + onlineDiscrLabelCalo = cms.InputTag("hltDeepCombinedSecondaryVertexBJetTagsCalo", "probb"), + offlineDiscrLabelb = cms.InputTag("pfDeepCSVJetTags", "probb"), + offlineDiscrLabelbb = cms.InputTag("pfDeepCSVJetTags", "probbb"), + hltFastPVLabel = cms.InputTag("hltFastPrimaryVertex"), + hltPFPVLabel = cms.InputTag("hltVerticesPFSelector"), + hltCaloPVLabel = cms.InputTag("hltVerticesL3"), + offlinePVLabel = cms.InputTag("offlinePrimaryVertices"), + turnon_threshold_loose = cms.double(0.2), + turnon_threshold_medium = cms.double(0.5), + turnon_threshold_tight = cms.double(0.8), # pathPairs = cms.VPSet( cms.PSet( - pathname = cms.string("HLT_QuadPFJet_BTagCSV"), + pathname = cms.string("HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_"), pathtype = cms.string("PF"), ), cms.PSet( - #pathname = cms.string("HLT_PFMET120_NoiseCleaned_BTagCSV07"), - pathname = cms.string("HLT_PFMET120_"), - pathtype = cms.string("Calo"), - ) + pathname = cms.string("HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_"), + pathtype = cms.string("Calo"), + ) ) ) diff --git a/DQMOffline/Trigger/python/BTaggingMonitoring_Client_cff.py b/DQMOffline/Trigger/python/BTaggingMonitoring_Client_cff.py index 6239109898fdc..210137af350be 100644 --- a/DQMOffline/Trigger/python/BTaggingMonitoring_Client_cff.py +++ b/DQMOffline/Trigger/python/BTaggingMonitoring_Client_cff.py @@ -175,13 +175,26 @@ ), ) +BTVEfficiency_TurnOnCurves = DQMEDHarvester("DQMGenericClient", + subDirs = cms.untracked.vstring( + "HLT/BTV/HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_*", + ), + verbose = cms.untracked.uint32(0), # Set to 2 for all messages + resolution = cms.vstring(), + efficiency = cms.vstring( + "turnon_loose 'turn-on (loose online OP); discriminator; efficiency' Turnon_loose_Discr_numerator Turnon_loose_Discr_denominator", + "turnon_medium 'turn-on (medium online OP); discriminator; efficiency' Turnon_medium_Discr_numerator Turnon_medium_Discr_denominator", + "turnon_tight 'turn-on (tight online OP); discriminator; efficiency' Turnon_tight_Discr_numerator Turnon_tight_Discr_denominator", + ), +) + btaggingClient = cms.Sequence( - BTVEfficiency_BTagMu_DiJet + BTVEfficiency_TurnOnCurves + + BTVEfficiency_BTagMu_DiJet + BTVEfficiency_BTagMu_Jet + BTVEfficiency_BTagDiMu_Jet + BTVEfficiency_PFJet ) - diff --git a/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py b/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py index 0338cefb4fed6..fea4ebe551704 100644 --- a/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py +++ b/DQMOffline/Trigger/python/DisplacedJet_Monitor_cff.py @@ -54,12 +54,11 @@ hltHT_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") -hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring = hltHTmonitoring.clone() -hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HLT_CaloJet_HT430_DisplacedDijet80_DisplacedTrack') -hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT430_DisplacedDijet80_DisplacedTrack_v*") -hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.jetSelection = cms.string("pt>80 && eta<2.0") -hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") - +hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring = hltHTmonitoring.clone() +hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HLT_CaloJet_HT500_DisplacedDijet40_DisplacedTrack') +hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT500_DisplacedDijet40_DisplacedTrack_v*") +hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.jetSelection = cms.string("pt>40 && eta<2.0") +hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta <3.0") hltHT_HT550_DisplacedDijet60_Inclusive_Prommonitoring = hltHTmonitoring.clone() @@ -68,13 +67,6 @@ hltHT_HT550_DisplacedDijet60_Inclusive_Prommonitoring.jetSelection = cms.string("pt>60 && eta<2.0") hltHT_HT550_DisplacedDijet60_Inclusive_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") -hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring = hltHTmonitoring.clone() -hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HT_CaloJet_HLT_HT550_DisplacedDijet80_Inclusive') -hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT550_DisplacedDijet80_Inclusive_v*") -hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection = cms.string("pt>80 && eta<2.0") -hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") - - hltHT_HT650_DisplacedDijet60_Inclusive_Prommonitoring = hltHTmonitoring.clone() hltHT_HT650_DisplacedDijet60_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HT_CaloJet_HLT_HT650_DisplacedDijet60_Inclusive') @@ -83,20 +75,6 @@ hltHT_HT650_DisplacedDijet60_Inclusive_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") -hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring = hltHTmonitoring.clone() -hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HT_CaloJet_HLT_HT650_DisplacedDijet80_Inclusive') -hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT650_DisplacedDijet80_Inclusive_v*") -hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection = cms.string("pt>80 && eta<2.0") -hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") - - -hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring = hltHTmonitoring.clone() -hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/HT/HT_CaloJet_HLT_HT750_DisplacedDijet80_Inclusive') -hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT750_DisplacedDijet80_Inclusive_v*") -hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection = cms.string("pt>80 && eta<2.0") -hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring.jetSelection_HT = cms.string("pt > 40 && eta < 3.0") - - hltJet_HT400_DisplacedDijet40_DisplacedTrack_Prommonitoring = hltJetMETmonitoring.clone() hltJet_HT400_DisplacedDijet40_DisplacedTrack_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") hltJet_HT400_DisplacedDijet40_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT400_DisplacedDijet40_DisplacedTrack') @@ -127,14 +105,14 @@ hltJet_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring.iscalojettrg = cms.bool(True) -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring = hltJetMETmonitoring.clone() -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT430_DisplacedDijet80_DisplacedTrack') -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.ptcut = cms.double(20) -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.histoPSet.jetptBinning = cms.vdouble(20.,30.,40.,50.,60.,65.,68.,70.,72.,74.,76.,78.,80.,82.,84.,86.,88.,90.,92.,94.,100.,120.,170.,220.,300.,400.) -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT430_DisplacedDijet80_DisplacedTrack_v*") -hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring.ispfjettrg = cms.bool(False) -hltJet_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring.iscalojettrg = cms.bool(True) +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring = hltJetMETmonitoring.clone() +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT500_DisplacedDijet40_DisplacedTrack') +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.ptcut = cms.double(20) +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.histoPSet.jetptBinning = cms.vdouble(20.,26.,28.,30.,32.,34.,36.,38.,40.,42.,44.,46.,48.,50.,55.,60.,70.,80.,100.,120.,170.,220.,300.,400.) +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT500_DisplacedDijet40_DisplacedTrack_v*") +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.ispfjettrg = cms.bool(False) +hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring.iscalojettrg = cms.bool(True) hltJet_HT550_DisplacedDijet60_Inclusive_Prommonitoring = hltJetMETmonitoring.clone() @@ -147,17 +125,6 @@ hltJet_HT550_DisplacedDijet60_Inclusive_Prommonitoring.iscalojettrg = cms.bool(True) -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring = hltJetMETmonitoring.clone() -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT550_DisplacedDijet80_Inclusive') -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.ptcut = cms.double(20) -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.histoPSet.jetptBinning = cms.vdouble(20.,30.,40.,50.,60,65,68,70,72,74,76,78,80,82,84,86,88,90,92,94,100,120,170,220,300,400) -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT550_DisplacedDijet80_Inclusive_v*") -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.ispfjettrg = cms.bool(False) -hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring.iscalojettrg = cms.bool(True) - - - hltJet_HT650_DisplacedDijet60_Inclusive_Prommonitoring = hltJetMETmonitoring.clone() hltJet_HT650_DisplacedDijet60_Inclusive_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") hltJet_HT650_DisplacedDijet60_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT650_DisplacedDijet60_Inclusive') @@ -168,48 +135,21 @@ hltJet_HT650_DisplacedDijet60_Inclusive_Prommonitoring.iscalojettrg = cms.bool(True) -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring = hltJetMETmonitoring.clone() -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT650_DisplacedDijet80_Inclusive') -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.ptcut = cms.double(20) -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.histoPSet.jetptBinning = cms.vdouble(20,30,40,50,60,65,68,70,72,74,76,78,80,82,84,86,88,90,92,94,100,120,170,220,300,400) -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT650_DisplacedDijet80_Inclusive_v*") -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.ispfjettrg = cms.bool(False) -hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring.iscalojettrg = cms.bool(True) - - -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring = hltJetMETmonitoring.clone() -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.jetSrc = cms.InputTag("ak4CaloJets") -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.FolderName = cms.string('HLT/EXO/DisplacedJet/Jet/HLT_CaloJet_HT750_DisplacedDijet80_Inclusive') -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.ptcut = cms.double(20) -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.histoPSet.jetptBinning = cms.vdouble(20,30,40,50,60,65,68,70,72,74,76,78,80,82,84,86,88,90,92,94,100,120,170,220,300,400) -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_HT750_DisplacedDijet80_Inclusive_v*") -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.ispfjettrg = cms.bool(False) -hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring.iscalojettrg = cms.bool(True) - - - exoHLTDisplacedJetmonitoring = cms.Sequence( hltHT_HT425_Prommonitoring +hltHT_HT400_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltHT_HT430_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltHT_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring -+hltHT_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring ++hltHT_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltHT_HT550_DisplacedDijet60_Inclusive_Prommonitoring -+hltHT_HT550_DisplacedDijet80_Inclusive_Prommonitoring +hltHT_HT650_DisplacedDijet60_Inclusive_Prommonitoring -+hltHT_HT650_DisplacedDijet80_Inclusive_Prommonitoring -+hltHT_HT750_DisplacedDijet80_Inclusive_Prommonitoring +hltJet_HT400_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltJet_HT430_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltJet_HT430_DisplacedDijet60_DisplacedTrack_Prommonitoring -+hltJet_HT430_DisplacedDijet80_DisplacedTrack_Prommonitoring ++hltJet_HT500_DisplacedDijet40_DisplacedTrack_Prommonitoring +hltJet_HT550_DisplacedDijet60_Inclusive_Prommonitoring -+hltJet_HT550_DisplacedDijet80_Inclusive_Prommonitoring +hltJet_HT650_DisplacedDijet60_Inclusive_Prommonitoring -+hltJet_HT650_DisplacedDijet80_Inclusive_Prommonitoring -+hltJet_HT750_DisplacedDijet80_Inclusive_Prommonitoring ) diff --git a/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py b/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py index b844153e3de1a..82f902980a3c7 100644 --- a/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py +++ b/DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py @@ -86,6 +86,8 @@ L1ETMMin = cms.untracked.double(50), ), Paths = cms.untracked.string("PFTau"), + PtHistoBins = cms.untracked.int32(50), + PtHistoMax = cms.untracked.double(500), PathSummaryPlotter = cms.untracked.PSet( DQMFolder = cms.untracked.string('Summary'), ), @@ -153,12 +155,12 @@ def TriggerSelectionParameters(hltpaths): cms.untracked.PSet( FilterName = cms.untracked.InputTag("TauRefProducer","MET"), matchObjectID = cms.untracked.int32(0), - ), - ), - ), + ), + ), + ), TagAndProbe = cms.untracked.VPSet( cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau20_SingleL1'), + name = cms.string('MuTauTemplate'), xvariable = cms.string('Tau'), nPtBins = cms.int32(20), ptmin = cms.double(0.), @@ -169,431 +171,11 @@ def TriggerSelectionParameters(hltpaths): nPhiBins = cms.int32(20), phimin = cms.double(-3.15), phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau20_SingleL1_v*','HLT_IsoMu27_LooseChargedIsoPFTau20_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau20_SingleL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau20_SingleL1_v*','HLT_IsoMu27_MediumChargedIsoPFTau20_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau20_SingleL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau20_SingleL1_v*','HLT_IsoMu27_TightChargedIsoPFTau20_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau20_TightID_SingleL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau20_TightID_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau20_TightID_SingleL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau20_TightID_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau20_TightID_SingleL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau20_TightID_SingleL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau27_eta2p1_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau27_eta2p1_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau27_eta2p1_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau27_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_TightID_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau50_Trk30_eta2p1_1pr'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(30), - ptmin = cms.double(0.), - ptmax = cms.double(300.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau40_Trk1_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_LooseChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_TightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(50), - ptmin = cms.double(0.), - ptmax = cms.double(500.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(50), - ptmin = cms.double(0.), - ptmax = cms.double(500.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau100HighPtRelaxedIso_Trk50_eta2p1_1pr_v*','HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v*')), + numerator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu24_eta2p1_.+PFTau.+')), denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) ), cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau30_eta2p1_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau30_eta2p1_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau30_eta2p1_CrossL1'), + name = cms.string('ETauTemplate'), xvariable = cms.string('Tau'), nPtBins = cms.int32(20), ptmin = cms.double(0.), @@ -604,56 +186,11 @@ def TriggerSelectionParameters(hltpaths): nPhiBins = cms.int32(20), phimin = cms.double(-3.15), phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) - ), - cms.untracked.PSet( - name = cms.string('LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) - ), - cms.untracked.PSet( - name = cms.string('MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) - ), - cms.untracked.PSet( - name = cms.string('TightChargedIsoPFTau30_eta2p1_TightID_CrossL1'), - xvariable = cms.string('Tau'), - nPtBins = cms.int32(20), - ptmin = cms.double(0.), - ptmax = cms.double(200.), - nEtaBins = cms.int32(20), - etamin = cms.double(-2.5), - etamax = cms.double(2.5), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_TightID_CrossL1_v*')), + numerator = TriggerSelectionParameters(cms.vstring('HLT_Ele.+PFTau.+')), denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) ), cms.untracked.PSet( - name = cms.string('MET90'), + name = cms.string('TauMETTemplate'), xvariable = cms.string('MET'), nPtBins = cms.int32(50), ptmin = cms.double(0.), @@ -661,43 +198,7 @@ def TriggerSelectionParameters(hltpaths): nPhiBins = cms.int32(20), phimin = cms.double(-3.15), phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v*')) - ), - cms.untracked.PSet( - name = cms.string('MET100'), - xvariable = cms.string('MET'), - nPtBins = cms.int32(50), - ptmin = cms.double(0.), - ptmax = cms.double(500.), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v*')) - ), - cms.untracked.PSet( - name = cms.string('MET110'), - xvariable = cms.string('MET'), - nPtBins = cms.int32(50), - ptmin = cms.double(0.), - ptmax = cms.double(500.), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v*')) - ), - cms.untracked.PSet( - name = cms.string('MET120'), - xvariable = cms.string('MET'), - nPtBins = cms.int32(50), - ptmin = cms.double(0.), - ptmax = cms.double(500.), - nPhiBins = cms.int32(20), - phimin = cms.double(-3.15), - phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v*')), + numerator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET.*')), denominator = TriggerSelectionParameters(cms.vstring('HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v*')) ), cms.untracked.PSet( @@ -728,9 +229,8 @@ def TriggerSelectionParameters(hltpaths): nPhiBins = cms.int32(20), phimin = cms.double(-3.15), phimax = cms.double(3.15), - numerator = TriggerSelectionParameters(cms.vstring('HLT_DoubleIsoMu24_eta2p1_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')), - nOfflObjs = cms.untracked.uint32(2) + numerator = TriggerSelectionParameters(cms.vstring('HLT_DoubleIsoMu24_eta2p1_v*')), + denominator = TriggerSelectionParameters(cms.vstring('HLT_IsoMu27_v*')) ), cms.untracked.PSet( name = cms.string('Ele24_eta2p1_WPTight_Gsf'), @@ -745,8 +245,7 @@ def TriggerSelectionParameters(hltpaths): phimin = cms.double(-3.15), phimax = cms.double(3.15), numerator = TriggerSelectionParameters(cms.vstring('HLT_DoubleEle24_eta2p1_WPTight_Gsf_v*')), - denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')), - nOfflObjs = cms.untracked.uint32(2) + denominator = TriggerSelectionParameters(cms.vstring('HLT_Ele35_WPTight_Gsf_v*')) ) ) ) diff --git a/DQMOffline/Trigger/python/MssmHbbBtagTriggerMonitor_cfi.py b/DQMOffline/Trigger/python/MssmHbbBtagTriggerMonitor_cfi.py index fe02032e31418..987c600583d95 100644 --- a/DQMOffline/Trigger/python/MssmHbbBtagTriggerMonitor_cfi.py +++ b/DQMOffline/Trigger/python/MssmHbbBtagTriggerMonitor_cfi.py @@ -43,53 +43,53 @@ mssmHbbBtagTriggerMonitorSL40noMu.jetPtMin = cms.double(40) mssmHbbBtagTriggerMonitorSL40noMu.triggerobjbtag = cms.string("hltBTagCalo30x8CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorSL40noMu.histoPSet.jetPt = cms.vdouble(40,45,50,55,60,65,70,75,80,85,90,95,100) -mssmHbbBtagTriggerMonitorSL40noMu.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets40_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorSL40noMu.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets40_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorSL40 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorSL40.dirname = cms.string("HLT/Higgs/MssmHbb/semileptonic/BtagTrigger/pt40") mssmHbbBtagTriggerMonitorSL40.jetPtMin = cms.double(40) mssmHbbBtagTriggerMonitorSL40.triggerobjbtag = cms.string("hltBTagCalo30x8CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorSL40.histoPSet.jetPt = cms.vdouble(40,45,50,55,60,65,70,75,80,85,90,95,100) -mssmHbbBtagTriggerMonitorSL40.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets40_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorSL40.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets40_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorSL100 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorSL100.dirname = cms.string("HLT/Higgs/MssmHbb/semileptonic/BtagTrigger/pt100") mssmHbbBtagTriggerMonitorSL100.jetPtMin = cms.double(100) mssmHbbBtagTriggerMonitorSL100.triggerobjbtag = cms.string("hltBTagCalo30x8CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorSL100.histoPSet.jetPt = cms.vdouble(100,110,120,130,140,150,160,170,180,190,200) -mssmHbbBtagTriggerMonitorSL100.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets100_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorSL100.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets100_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorSL200 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorSL200.dirname = cms.string("HLT/Higgs/MssmHbb/semileptonic/BtagTrigger/pt200") mssmHbbBtagTriggerMonitorSL200.jetPtMin = cms.double(200) mssmHbbBtagTriggerMonitorSL200.triggerobjbtag = cms.string("hltBTagCalo30x8CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorSL200.histoPSet.jetPt = cms.vdouble(200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350) -mssmHbbBtagTriggerMonitorSL200.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets200_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorSL200.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets200_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorSL350 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorSL350.dirname = cms.string("HLT/Higgs/MssmHbb/semileptonic/BtagTrigger/pt350") mssmHbbBtagTriggerMonitorSL350.jetPtMin = cms.double(350) mssmHbbBtagTriggerMonitorSL350.triggerobjbtag = cms.string("hltBTagCalo30x8CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorSL350.histoPSet.jetPt = cms.vdouble(350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600) -mssmHbbBtagTriggerMonitorSL350.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets350_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorSL350.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_Mu12_DoublePFJets350_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorAH100 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorAH100.dirname = cms.string("HLT/Higgs/MssmHbb/fullhadronic/BtagTrigger/pt100") mssmHbbBtagTriggerMonitorAH100.jetPtMin = cms.double(100) mssmHbbBtagTriggerMonitorAH100.triggerobjbtag = cms.string("hltBTagCalo80x6CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorAH100.histoPSet.jetPt = cms.vdouble(100,110,120,130,140,150,160,170,180,190,200) -mssmHbbBtagTriggerMonitorAH100.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets100_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorAH100.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets100_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorAH200 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorAH200.dirname = cms.string("HLT/Higgs/MssmHbb/fullhadronic/BtagTrigger/pt200") mssmHbbBtagTriggerMonitorAH200.jetPtMin = cms.double(200) mssmHbbBtagTriggerMonitorAH200.triggerobjbtag = cms.string("hltBTagCalo80x6CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorAH200.histoPSet.jetPt = cms.vdouble(200,210,220,230,240,250,260,270,280,290,300,310,320,330,340,350) -mssmHbbBtagTriggerMonitorAH200.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets200_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorAH200.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets200_CaloBTagCSV_p79_v*') mssmHbbBtagTriggerMonitorAH350 = mssmHbbBtagTriggerMonitor.clone() mssmHbbBtagTriggerMonitorAH350.dirname = cms.string("HLT/Higgs/MssmHbb/fullhadronic/BtagTrigger/pt350") mssmHbbBtagTriggerMonitorAH350.jetPtMin = cms.double(350) mssmHbbBtagTriggerMonitorAH350.triggerobjbtag = cms.string("hltBTagCalo80x6CSVp0p92SingleWithMatching") mssmHbbBtagTriggerMonitorAH350.histoPSet.jetPt = cms.vdouble(350,360,370,380,390,400,410,420,430,440,450,460,470,480,490,500,510,520,530,540,550,560,570,580,590,600) -mssmHbbBtagTriggerMonitorAH350.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets350_CaloBTagCSV_p33_v*') +mssmHbbBtagTriggerMonitorAH350.genericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets350_CaloBTagCSV_p79_v*') diff --git a/DQMOffline/Trigger/python/MssmHbbMonitoring_cff.py b/DQMOffline/Trigger/python/MssmHbbMonitoring_cff.py index 748fbb06448c7..1bed7c621b1d9 100644 --- a/DQMOffline/Trigger/python/MssmHbbMonitoring_cff.py +++ b/DQMOffline/Trigger/python/MssmHbbMonitoring_cff.py @@ -15,7 +15,7 @@ hltMssmHbbmonitoringAL100.nmuons = cms.uint32(0) hltMssmHbbmonitoringAL100.nbjets = cms.uint32(2) hltMssmHbbmonitoringAL100.bjetSelection = cms.string('pt>110 & abs(eta)<2.2') -hltMssmHbbmonitoringAL100.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets100MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringAL100.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets100MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringAL100.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) hltMssmHbbmonitoringAL116 = hltMssmHbbmonitoring.clone() @@ -23,7 +23,7 @@ hltMssmHbbmonitoringAL116.nmuons = cms.uint32(0) hltMssmHbbmonitoringAL116.nbjets = cms.uint32(2) hltMssmHbbmonitoringAL116.bjetSelection = cms.string('pt>116 & abs(eta)<2.2') -hltMssmHbbmonitoringAL116.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringAL116.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringAL116.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) hltMssmHbbmonitoringAL128 = hltMssmHbbmonitoring.clone() @@ -31,7 +31,7 @@ hltMssmHbbmonitoringAL128.nmuons = cms.uint32(0) hltMssmHbbmonitoringAL128.nbjets = cms.uint32(2) hltMssmHbbmonitoringAL128.bjetSelection = cms.string('pt>128 & abs(eta)<2.2') -hltMssmHbbmonitoringAL128.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringAL128.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringAL128.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) # Semi-leptonic MssmHbb(mu) @@ -41,7 +41,7 @@ hltMssmHbbmonitoringSL40.nbjets = cms.uint32(2) hltMssmHbbmonitoringSL40.muoSelection = cms.string('pt>12 & abs(eta)<2.2 & isPFMuon & isGlobalMuon & innerTrack.hitPattern.trackerLayersWithMeasurement>5 & innerTrack.hitPattern.numberOfValidPixelHits>0 & globalTrack.hitPattern.numberOfValidMuonHits>0 & globalTrack.normalizedChi2<10') hltMssmHbbmonitoringSL40.bjetSelection = cms.string('pt>40 & abs(eta)<2.2') -hltMssmHbbmonitoringSL40.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringSL40.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringSL40.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) hltMssmHbbmonitoringSL54 = hltMssmHbbmonitoring.clone() @@ -50,7 +50,7 @@ hltMssmHbbmonitoringSL54.nbjets = cms.uint32(2) hltMssmHbbmonitoringSL54.muoSelection = cms.string('pt>12 & abs(eta)<2.2 & isPFMuon & isGlobalMuon & innerTrack.hitPattern.trackerLayersWithMeasurement>5 & innerTrack.hitPattern.numberOfValidPixelHits>0 & globalTrack.hitPattern.numberOfValidMuonHits>0 & globalTrack.normalizedChi2<10') hltMssmHbbmonitoringSL54.bjetSelection = cms.string('pt>54 & abs(eta)<2.2') -hltMssmHbbmonitoringSL54.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringSL54.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringSL54.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) hltMssmHbbmonitoringSL62 = hltMssmHbbmonitoring.clone() @@ -59,7 +59,7 @@ hltMssmHbbmonitoringSL62.nbjets = cms.uint32(2) hltMssmHbbmonitoringSL62.muoSelection = cms.string('pt>12 & abs(eta)<2.2 & isPFMuon & isGlobalMuon & innerTrack.hitPattern.trackerLayersWithMeasurement>5 & innerTrack.hitPattern.numberOfValidPixelHits>0 & globalTrack.hitPattern.numberOfValidMuonHits>0 & globalTrack.normalizedChi2<10') hltMssmHbbmonitoringSL62.bjetSelection = cms.string('pt>62 & abs(eta)<2.2') -hltMssmHbbmonitoringSL62.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p33_v*') +hltMssmHbbmonitoringSL62.numGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p79_v*') hltMssmHbbmonitoringSL62.histoPSet.jetPtBinning = cms.vdouble(0,250,280,300,320,360,400,700,1000,1500) #control b-tagging diff --git a/DQMOffline/Trigger/python/MuonMonitor_cff.py b/DQMOffline/Trigger/python/MuonMonitor_cff.py index 5b96b3bde5db2..1c70ea164f635 100644 --- a/DQMOffline/Trigger/python/MuonMonitor_cff.py +++ b/DQMOffline/Trigger/python/MuonMonitor_cff.py @@ -34,6 +34,19 @@ DoubleMu48NoFiltersNoVtx_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + +DoubleMu33NoFiltersNoVtxDisplaced_monitoring = hltMuonmonitoring.clone() +DoubleMu33NoFiltersNoVtxDisplaced_monitoring.FolderName = cms.string('HLT/EXO/DoubleMu33NoFiltersNoVtxDisplaced/') +DoubleMu33NoFiltersNoVtxDisplaced_monitoring.nmuons = cms.uint32(2) +DoubleMu33NoFiltersNoVtxDisplaced_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_DoubleMu33NoFiltersNoVtxDisplaced_v*") +DoubleMu33NoFiltersNoVtxDisplaced_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + +DoubleMu40NoFiltersNoVtxDisplaced_monitoring = hltMuonmonitoring.clone() +DoubleMu40NoFiltersNoVtxDisplaced_monitoring.FolderName = cms.string('HLT/EXO/DoubleMu40NoFiltersNoVtxDisplaced/') +DoubleMu40NoFiltersNoVtxDisplaced_monitoring.nmuons = cms.uint32(2) +DoubleMu40NoFiltersNoVtxDisplaced_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_DoubleMu40NoFiltersNoVtxDisplaced_v*") +DoubleMu40NoFiltersNoVtxDisplaced_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + #-------------------------------------------------- DoubleL2Mu23NoVtx_2Cha_monitoring = hltMuonmonitoring.clone() DoubleL2Mu23NoVtx_2Cha_monitoring.FolderName = cms.string('HLT/EXO/DoubleL2Mu23NoVtx_2Cha/') @@ -108,18 +121,84 @@ +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring = hltMuonmonitoring.clone() +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring.FolderName = cms.string('HLT/EXO/Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL/') +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring.nmuons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring.nelectrons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v*") +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + + + +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring = hltMuonmonitoring.clone() +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.FolderName = cms.string('HLT/EXO/Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg/') +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.nmuons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.nelectrons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.eleSelection = cms.string('pt > 38') +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v*") +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + + + + +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring = hltMuonmonitoring.clone() +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.FolderName = cms.string('HLT/EXO/Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg/') +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.nmuons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.nelectrons = cms.uint32(1) +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.muonSelection = cms.string('pt > 38') +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v*") +Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + + + +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring = hltMuonmonitoring.clone() +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring.FolderName = cms.string('HLT/EXO/Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL/') +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring.nmuons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring.nelectrons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v*") +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + + + +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring = hltMuonmonitoring.clone() +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.FolderName = cms.string('HLT/EXO/Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg/') +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.nmuons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.nelectrons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.eleSelection = cms.string('pt > 43') +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v*") +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + + + + +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring = hltMuonmonitoring.clone() +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.FolderName = cms.string('HLT/EXO/Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg/') +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.nmuons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.nelectrons = cms.uint32(1) +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.muonSelection = cms.string('pt > 43') +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v*") +Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_PFMET120_PFMHT120_IDTight_v*","HLT_PFMETTypeOne120_PFMHT120_IDTight_v*","HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v*") + exoHLTMuonmonitoring = cms.Sequence( TrkMu12_DoubleTrkMu5NoFiltersNoVtx_monitoring + TrkMu16_DoubleTrkMu6NoFiltersNoVtx_monitoring + TrkMu17_DoubleTrkMu8NoFiltersNoVtx_monitoring + DoubleMu43NoFiltersNoVtx_monitoring - + Mu43NoFiltersNoVtx_Photon43_CaloIdL_monitoring + DoubleMu48NoFiltersNoVtx_monitoring + + DoubleMu33NoFiltersNoVtxDisplaced_monitoring + + DoubleMu40NoFiltersNoVtxDisplaced_monitoring + + Mu43NoFiltersNoVtx_Photon43_CaloIdL_monitoring + Mu48NoFiltersNoVtx_Photon48_CaloIdL_monitoring + Mu43NoFiltersNoVtx_Photon43_CaloIdL_MuLeg_monitoring + Mu48NoFiltersNoVtx_Photon48_CaloIdL_MuLeg_monitoring + Mu43NoFiltersNoVtx_Photon43_CaloIdL_EleLeg_monitoring + Mu48NoFiltersNoVtx_Photon48_CaloIdL_EleLeg_monitoring + + Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_monitoring + + Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_monitoring + + Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_MuLeg_monitoring + + Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_MuLeg_monitoring + + Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_EleLeg_monitoring + + Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_EleLeg_monitoring + DoubleL2Mu23NoVtx_2Cha_monitoring + DoubleL2Mu23NoVtx_2Cha_CosmicSeed_monitoring ) diff --git a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_Cluster_cff.py b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_Cluster_cff.py index 57e71553c0089..5846bf38d33f4 100644 --- a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_Cluster_cff.py +++ b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_Cluster_cff.py @@ -3,13 +3,13 @@ from DQMOffline.Trigger.SiPixel_OfflineMonitoring_HistogramManager_cfi import * -# order is important and it should follow ordering in .h !!! +# order is important and it should follow ordering in hltSiPixelPhase1ClustersConf VPSet hltSiPixelPhase1ClustersCharge = hltDefaultHistoDigiCluster.clone( name = "charge", title = "Cluster Charge", range_min = 0, range_max = 200e3, range_nbins = 200, xlabel = "Charge (electrons)", - + specs = VPSet( #StandardSpecification2DProfile, hltStandardSpecificationPixelmapProfile, @@ -20,6 +20,36 @@ ) ) +hltSiPixelPhase1ClustersBigPixelCharge = DefaultHistoDigiCluster.clone( + name = "bigpixelcharge", + title = "Big Pixel Charge", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + enabled=False, + + specs = VPSet( + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() + ) +) + +hltSiPixelPhase1ClustersNotBigPixelCharge = DefaultHistoDigiCluster.clone( + name = "notbigpixelcharge", + title = "Not Big Pixel Charge", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + enabled=False, + + specs = VPSet( + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() + ) +) + hltSiPixelPhase1ClustersSize = hltDefaultHistoDigiCluster.clone( enabled = cms.bool(False), # TO BE CHECKED IF NEEDED name = "size", @@ -220,18 +250,18 @@ hltSiPixelPhase1ClustersPixelToStripRatio = hltDefaultHistoDigiCluster.clone( name = "cluster_ratio", title = "Pixel to Strip clusters ratio", - + xlabel = "ratio", dimensions = 1, - + specs = VPSet( - Specification().groupBy("PXAll").save(100, 0, 1), + Specification().groupBy("PXAll").save(100, 0, 1), Specification().groupBy("PXAll/Lumisection") - .reduce("MEAN") + .reduce("MEAN") .groupBy("PXAll", "EXTEND_X") .save(), Specification().groupBy("PXAll/BX") - .reduce("MEAN") + .reduce("MEAN") .groupBy("PXAll", "EXTEND_X") .save(), ) @@ -239,6 +269,8 @@ hltSiPixelPhase1ClustersConf = cms.VPSet( hltSiPixelPhase1ClustersCharge, + hltSiPixelPhase1ClustersBigPixelCharge, + hltSiPixelPhase1ClustersNotBigPixelCharge, hltSiPixelPhase1ClustersSize, hltSiPixelPhase1ClustersSizeX, hltSiPixelPhase1ClustersSizeY, @@ -275,4 +307,3 @@ histograms = hltSiPixelPhase1ClustersConf, geometry = hltSiPixelPhase1Geometry ) - diff --git a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py index 2ad4ac01c8a81..6240e4fde909c 100644 --- a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py +++ b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py @@ -3,7 +3,7 @@ from DQMOffline.Trigger.SiPixel_OfflineMonitoring_HistogramManager_cfi import * -# order is important and it should follow ordering in .h !!! +# order is important and it should follow ordering in hltSiPixelPhase1ClustersConf VPSet hltSiPixelPhase1TrackClustersOnTrackCharge = hltDefaultHistoTrack.clone( name = "charge", title = "Corrected Cluster Charge (OnTrack)", @@ -15,6 +15,36 @@ ) ) +hltSiPixelPhase1TrackClustersOnTrackBigPixelCharge = DefaultHistoTrack.clone( + name = "bigpixelcharge", + title = "Corrected Big Pixel Charge (OnTrack)", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + enabled=False, + + specs = VPSet( + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() + ) +) + +hltSiPixelPhase1TrackClustersOnTrackNotBigPixelCharge = DefaultHistoTrack.clone( + name = "notbigpixelcharge", + title = "Corrected Not Big Pixel Charge (OnTrack)", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + enabled=False, + + specs = VPSet( + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save() + ) +) + hltSiPixelPhase1TrackClustersOnTrackSize = hltDefaultHistoTrack.clone( name = "size", title = "Total Cluster Size (OnTrack)", @@ -22,7 +52,7 @@ xlabel = "size[pixels]", specs = VPSet( - hltStandardSpecifications1D + hltStandardSpecifications1D ) ) @@ -58,12 +88,12 @@ xlabel = "clusters", dimensions = 0, specs = VPSet( - Specification().groupBy("PXBarrel/PXLayer" + "/DetId/Event") - .reduce("COUNT") + Specification().groupBy("PXBarrel/PXLayer" + "/DetId/Event") + .reduce("COUNT") .groupBy("PXBarrel/PXLayer") .saveAll(), - Specification().groupBy("PXForward/PXDisk" + "/DetId/Event") - .reduce("COUNT") + Specification().groupBy("PXForward/PXDisk" + "/DetId/Event") + .reduce("COUNT") .groupBy("PXForward/PXDisk") .saveAll(), StandardSpecificationInclusive_Num, @@ -205,7 +235,7 @@ xlabel = "y size", ylabel = "x size", range_min = 0, range_max = 20, range_nbins = 20, - range_y_min = 0, range_y_max = 10, range_y_nbins = 10 + range_y_min = 0, range_y_max = 10, range_y_nbins = 10 ) hltSiPixelPhase1TrackClustersOnTrackSizeXYInner = hltSiPixelPhase1TrackClustersOnTrackSizeXYOuter.clone( @@ -247,11 +277,11 @@ Specification().groupBy("PXBarrel/PXLayer").save() ) ) - + hltSiPixelPhase1TrackClustersOnTrackChargeInner = hltSiPixelPhase1TrackClustersOnTrackChargeOuter.clone( name = "chargeInner", title = "Corrected Cluster Charge (OnTrack) inner ladders" -) +) hltSiPixelPhase1TrackClustersOnTrackShapeOuter = hltDefaultHistoTrack.clone( enabled = False, @@ -275,31 +305,33 @@ ### THE LIST DEFINED IN THE ENUM ### https://cmssdt.cern.ch/lxr/source/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc#0063 hltSiPixelPhase1TrackClustersOnTrackCharge, + hltSiPixelPhase1TrackClustersOnTrackBigPixelCharge, + hltSiPixelPhase1TrackClustersOnTrackNotBigPixelCharge, hltSiPixelPhase1TrackClustersOnTrackSize, hltSiPixelPhase1TrackClustersOnTrackShape, hltSiPixelPhase1TrackClustersOnTrackNClusters, hltSiPixelPhase1TrackClustersOnTrackPositionB, hltSiPixelPhase1TrackClustersOnTrackPositionF, hltSiPixelPhase1DigisHitmapOnTrack, - + hltSiPixelPhase1TrackClustersNTracks, hltSiPixelPhase1TrackClustersNTracksInVolume, - + hltSiPixelPhase1ClustersSizeVsEtaOnTrackOuter, hltSiPixelPhase1ClustersSizeVsEtaOnTrackInner, hltSiPixelPhase1TrackClustersOnTrackChargeOuter, hltSiPixelPhase1TrackClustersOnTrackChargeInner, - + hltSiPixelPhase1TrackClustersOnTrackShapeOuter, hltSiPixelPhase1TrackClustersOnTrackShapeInner, - + hltSiPixelPhase1TrackClustersOnTrackSizeXOuter, hltSiPixelPhase1TrackClustersOnTrackSizeXInner, hltSiPixelPhase1TrackClustersOnTrackSizeXF, hltSiPixelPhase1TrackClustersOnTrackSizeYOuter, hltSiPixelPhase1TrackClustersOnTrackSizeYInner, hltSiPixelPhase1TrackClustersOnTrackSizeYF, - + hltSiPixelPhase1TrackClustersOnTrackSizeXYOuter, hltSiPixelPhase1TrackClustersOnTrackSizeXYInner, hltSiPixelPhase1TrackClustersOnTrackSizeXYF, @@ -321,4 +353,3 @@ histograms = hltSiPixelPhase1TrackClustersConf, geometry = hltSiPixelPhase1Geometry ) - diff --git a/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_Client_cff.py b/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_Client_cff.py new file mode 100644 index 0000000000000..04372cb148c22 --- /dev/null +++ b/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_Client_cff.py @@ -0,0 +1,37 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester + +SoftMuHardJetMETEfficiency_muPt = DQMEDHarvester("DQMGenericClient", + subDirs = cms.untracked.vstring("HLT/SUSY/SoftMuHardJetMET/Muon"), + verbose = cms.untracked.uint32(0), + resolution = cms.vstring(), + efficiency = cms.vstring( + "effic_muPt 'Efficiency vs Muon p_{T} ; Muon p_{T} [GeV] ; efficiency' muPt_1_variableBinning_numerator muPt_1_variableBinning_denominator", + "effic_muEta 'Efficiency vs Muon #eta ; Muon #eta ; efficiency' muEta_1_variableBinning_numerator muEta_1_variableBinning_denominator", + ), +) + +SoftMuHardJetMETEfficiency_jetPt = DQMEDHarvester("DQMGenericClient", + subDirs = cms.untracked.vstring("HLT/SUSY/SoftMuHardJetMET/Jet"), + verbose = cms.untracked.uint32(0), + resolution = cms.vstring(), + efficiency = cms.vstring( + "effic_jetPt 'Efficiency vs Jet p_{T} ; PFJet p_{T} [GeV] ; efficiency' jetPt_1_numerator jetPt_1_denominator", + "effic_jetEta 'Efficiency vs Jet #eta ; Jet #eta ; efficiency' jetEta_1_numerator jetEta_1_denominator", + ), +) + +SoftMuHardJetMETEfficiency_metPt = DQMEDHarvester("DQMGenericClient", + subDirs = cms.untracked.vstring("HLT/SUSY/SoftMuHardJetMET/MET"), + verbose = cms.untracked.uint32(0), + resolution = cms.vstring(), + efficiency = cms.vstring( + "effic_metPt 'Efficiency vs MET ; PF MET [GeV] ; efficiency' met_numerator met_denominator", + ), +) + +susyHLTSoftMuHardJetMETClient = cms.Sequence( + SoftMuHardJetMETEfficiency_muPt + + SoftMuHardJetMETEfficiency_jetPt + + SoftMuHardJetMETEfficiency_metPt +) diff --git a/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_cff.py b/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_cff.py new file mode 100644 index 0000000000000..956f5838300f1 --- /dev/null +++ b/DQMOffline/Trigger/python/SoftMuHardJetMETSUSYMonitor_cff.py @@ -0,0 +1,92 @@ +# Offline DQM for HLT_Mu3er1p5_PFJet100er2p5_PFMETX_PFMHTX_IDTight (X = 70, 80, 90) +# Mateusz Zarucki 2018 + +import FWCore.ParameterSet.Config as cms + +from DQMOffline.Trigger.SusyMonitor_cfi import hltSUSYmonitoring + +SoftMuHardJetMETSUSYmonitoring = hltSUSYmonitoring.clone() +SoftMuHardJetMETSUSYmonitoring.FolderName = cms.string('HLT/SUSY/SoftMuHardJetMET/') + +SoftMuHardJetMETSUSYmonitoring.numGenericTriggerEventPSet.hltInputTag = cms.InputTag("TriggerResults","","HLT") +SoftMuHardJetMETSUSYmonitoring.numGenericTriggerEventPSet.hltPaths = cms.vstring( + "HLT_Mu3er1p5_PFJet100er2p5_PFMET70_PFMHT70_IDTight_v*", + "HLT_Mu3er1p5_PFJet100er2p5_PFMET80_PFMHT80_IDTight_v*", + "HLT_Mu3er1p5_PFJet100er2p5_PFMET90_PFMHT90_IDTight_v*" +) + +SoftMuHardJetMETSUSYmonitoring.met = cms.InputTag("pfMetEI") +SoftMuHardJetMETSUSYmonitoring.jets = cms.InputTag("ak4PFJetsCHS") +SoftMuHardJetMETSUSYmonitoring.muons = cms.InputTag("muons") + +SoftMuHardJetMETSUSYmonitoring.HTdefinition = cms.string('pt>30 & abs(eta)<2.5') +SoftMuHardJetMETSUSYmonitoring.leptJetDeltaRmin = cms.double(0.4) +SoftMuHardJetMETSUSYmonitoring.MHTdefinition = cms.string('pt>30 & abs(eta)<2.4') + +############### +### Muon pt ### +############### +SoftMuHardJetMETSUSYmonitoring_muPt = SoftMuHardJetMETSUSYmonitoring.clone() +SoftMuHardJetMETSUSYmonitoring_muPt.FolderName = cms.string('HLT/SUSY/SoftMuHardJetMET/Muon') + +## Selection ## +SoftMuHardJetMETSUSYmonitoring_muPt.denGenericTriggerEventPSet.hltPaths = cms.vstring('HLT_PFMET120_PFMHT120_IDTight_v*', 'HLT_PFMET130_PFMHT130_IDTight_v*', 'HLT_PFMET140_PFMHT140_IDTight_v*') +# Muon selection +SoftMuHardJetMETSUSYmonitoring_muPt.nmuons = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_muPt.muoSelection = cms.string('abs(eta)<1.5') +# Jet selection +SoftMuHardJetMETSUSYmonitoring_muPt.njets = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_muPt.jetSelection = cms.string("pt>130 & abs(eta)<2.5") +# MET selection +SoftMuHardJetMETSUSYmonitoring_muPt.metSelection = cms.string('pt>150') +SoftMuHardJetMETSUSYmonitoring_muPt.MHTcut = cms.double(150) + +## Binning ## +SoftMuHardJetMETSUSYmonitoring_muPt.histoPSet.muPtBinning = cms.vdouble(0,2,5,7,10,12,15,17,20,25,30,50) + +############## +### Jet pt ### +############## +SoftMuHardJetMETSUSYmonitoring_jetPt = SoftMuHardJetMETSUSYmonitoring.clone() +SoftMuHardJetMETSUSYmonitoring_jetPt.FolderName = cms.string('HLT/SUSY/SoftMuHardJetMET/Jet') + +## Selection ## +SoftMuHardJetMETSUSYmonitoring_jetPt.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_IsoMu27_v*") +# Muon selection +SoftMuHardJetMETSUSYmonitoring_jetPt.nmuons = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_jetPt.muoSelection = cms.string('pt>30 & abs(eta)<1.5') +# Jet selection +SoftMuHardJetMETSUSYmonitoring_jetPt.njets = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_jetPt.jetSelection = cms.string("abs(eta)<2.5") +# MET selection +SoftMuHardJetMETSUSYmonitoring_jetPt.metSelection = cms.string('pt>150') +SoftMuHardJetMETSUSYmonitoring_jetPt.MHTcut = cms.double(150) + +# Binning +SoftMuHardJetMETSUSYmonitoring_jetPt.histoPSet.jetPtBinning = cms.vdouble(0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,90,100,120,200,400) + +############## +### MET pt ### +############## +SoftMuHardJetMETSUSYmonitoring_metPt = SoftMuHardJetMETSUSYmonitoring.clone() +SoftMuHardJetMETSUSYmonitoring_metPt.FolderName = cms.string('HLT/SUSY/SoftMuHardJetMET/MET') + +## Selection ## +SoftMuHardJetMETSUSYmonitoring_metPt.denGenericTriggerEventPSet.hltPaths = cms.vstring("HLT_IsoMu27_v*") +# Muon selection +SoftMuHardJetMETSUSYmonitoring_metPt.nmuons = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_metPt.muoSelection = cms.string('pt>30 & abs(eta)<1.5') +# Jet selection +SoftMuHardJetMETSUSYmonitoring_metPt.njets = cms.uint32(1) +SoftMuHardJetMETSUSYmonitoring_metPt.jetSelection = cms.string("pt>130 & abs(eta)<2.5") +# MET selection +SoftMuHardJetMETSUSYmonitoring_metPt.enableMETplot = cms.bool(True) + +# Binning +SoftMuHardJetMETSUSYmonitoring_metPt.histoPSet.metPSet = cms.PSet(nbins=cms.uint32(50),xmin=cms.double(50),xmax=cms.double(300)) + +susyHLTSoftMuHardJetMETMonitoring = cms.Sequence( + SoftMuHardJetMETSUSYmonitoring_muPt + + SoftMuHardJetMETSUSYmonitoring_jetPt + + SoftMuHardJetMETSUSYmonitoring_metPt +) diff --git a/DQMOffline/Trigger/python/SusyMonitoring_Client_cff.py b/DQMOffline/Trigger/python/SusyMonitoring_Client_cff.py index 3f79633527906..bb3bde8be3dff 100644 --- a/DQMOffline/Trigger/python/SusyMonitoring_Client_cff.py +++ b/DQMOffline/Trigger/python/SusyMonitoring_Client_cff.py @@ -4,6 +4,7 @@ from DQMOffline.Trigger.LepHTMonitor_cff import * from DQMOffline.Trigger.susyHLTEleCaloJetsClient_cfi import * from DQMOffline.Trigger.RazorMonitor_Client_cff import * +from DQMOffline.Trigger.SoftMuHardJetMETSUSYMonitor_Client_cff import * #george double_soft_muon_muonpt_efficiency = DQMEDHarvester("DQMGenericClient", @@ -182,4 +183,5 @@ + double_soft_dca_metpt_efficiency + susyHLTRazorClient + triple_muon_mupt_efficiency + + susyHLTSoftMuHardJetMETClient ) diff --git a/DQMOffline/Trigger/python/SusyMonitoring_cff.py b/DQMOffline/Trigger/python/SusyMonitoring_cff.py index cf1e5d1f2c2fa..0e91df4ba5205 100644 --- a/DQMOffline/Trigger/python/SusyMonitoring_cff.py +++ b/DQMOffline/Trigger/python/SusyMonitoring_cff.py @@ -4,6 +4,7 @@ from DQMOffline.Trigger.VBFSUSYMonitor_cff import * from DQMOffline.Trigger.LepHTMonitor_cff import * from DQMOffline.Trigger.susyHLTEleCaloJets_cff import * +from DQMOffline.Trigger.SoftMuHardJetMETSUSYMonitor_cff import * from DQMOffline.Trigger.TopMonitor_cfi import hltTOPmonitoring #george @@ -257,6 +258,7 @@ + double_soft_muon_backup_90_metpt + double_soft_muon_backup_90_mhtpt + susyMuEGMonitoring - +double_soft_muon_dca_muonpt - +double_soft_muon_dca_metpt + + double_soft_muon_dca_muonpt + + double_soft_muon_dca_metpt + + susyHLTSoftMuHardJetMETMonitoring ) diff --git a/DQMOffline/Trigger/python/TopMonitor_cfi.py b/DQMOffline/Trigger/python/TopMonitor_cfi.py index eecbe38b999e5..41dc466f9825e 100644 --- a/DQMOffline/Trigger/python/TopMonitor_cfi.py +++ b/DQMOffline/Trigger/python/TopMonitor_cfi.py @@ -70,6 +70,7 @@ hltTOPmonitoring.enablePhotonPlot = cms.bool(False) +hltTOPmonitoring.enableMETplot = cms.bool(False) #MET and HT binning hltTOPmonitoring.histoPSet.metBinning = cms.vdouble(0,20,40,60,80,100,125,150,175,200) diff --git a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc b/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc deleted file mode 100644 index ff99ee28e1e2f..0000000000000 --- a/DQMOffline/Trigger/src/BTVHLTOfflineSource.cc +++ /dev/null @@ -1,273 +0,0 @@ -#include "DQMOffline/Trigger/interface/BTVHLTOfflineSource.h" - -#include "FWCore/Common/interface/TriggerNames.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Run.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Common/interface/TriggerResults.h" -#include "DataFormats/HLTReco/interface/TriggerEvent.h" -#include "DataFormats/HLTReco/interface/TriggerObject.h" -#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" - -#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" - -#include "DQMServices/Core/interface/MonitorElement.h" - -#include "CommonTools/UtilAlgos/interface/DeltaR.h" -#include "DataFormats/VertexReco/interface/Vertex.h" - -#include "TMath.h" -#include "TH1F.h" -#include "TH2F.h" -#include "TProfile.h" -#include "TPRegexp.h" - -#include - -using namespace edm; -using namespace reco; -using namespace std; -using namespace trigger; - -BTVHLTOfflineSource::BTVHLTOfflineSource(const edm::ParameterSet& iConfig) -{ - LogDebug("BTVHLTOfflineSource") << "constructor...."; - - dirname_ = iConfig.getUntrackedParameter("dirname",std::string("HLT/BTV/")); - processname_ = iConfig.getParameter("processname"); - verbose_ = iConfig.getUntrackedParameter< bool >("verbose", false); - triggerSummaryLabel_ = iConfig.getParameter("triggerSummaryLabel"); - triggerResultsLabel_ = iConfig.getParameter("triggerResultsLabel"); - triggerSummaryToken = consumes (triggerSummaryLabel_); - triggerResultsToken = consumes (triggerResultsLabel_); - triggerSummaryFUToken = consumes (edm::InputTag(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(),std::string("FU"))); - triggerResultsFUToken = consumes (edm::InputTag(triggerResultsLabel_.label(),triggerResultsLabel_.instance(),std::string("FU"))); - csvCaloTagsToken_ = consumes (edm::InputTag("hltCombinedSecondaryVertexBJetTagsCalo")); - csvPfTagsToken_ = consumes (edm::InputTag("hltCombinedSecondaryVertexBJetTagsPF")); - offlineCSVTokenPF_ = consumes (iConfig.getParameter("offlineCSVLabelPF")); - offlineCSVTokenCalo_ = consumes (iConfig.getParameter("offlineCSVLabelCalo")); - hltFastPVToken_ = consumes > (iConfig.getParameter("hltFastPVLabel")); - hltPFPVToken_ = consumes > (iConfig.getParameter("hltPFPVLabel")); - hltCaloPVToken_ = consumes > (iConfig.getParameter("hltCaloPVLabel")); - offlinePVToken_ = consumes > (iConfig.getParameter("offlinePVLabel")); - - std::vector paths = iConfig.getParameter >("pathPairs"); - for(auto & path : paths) { - custompathnamepairs_.push_back(make_pair( - path.getParameter("pathname"), - path.getParameter("pathtype") - ));} -} - -BTVHLTOfflineSource::~BTVHLTOfflineSource() = default; - -void BTVHLTOfflineSource::dqmBeginRun(const edm::Run& run, const edm::EventSetup& c) -{ - bool changed(true); - if (!hltConfig_.init(run, c, processname_, changed)) { - LogDebug("BTVHLTOfflineSource") << "HLTConfigProvider failed to initialize."; - } - - const unsigned int numberOfPaths(hltConfig_.size()); - for(unsigned int i=0; i!=numberOfPaths; ++i){ - pathname_ = hltConfig_.triggerName(i); - filtername_ = "dummy"; - unsigned int usedPrescale = 1; - unsigned int objectType = 0; - std::string triggerType = ""; - bool trigSelected = false; - - for (auto & custompathnamepair : custompathnamepairs_){ - if(pathname_.find(custompathnamepair.first)!=std::string::npos) { trigSelected = true; triggerType = custompathnamepair.second;} - } - - if (!trigSelected) continue; - - hltPathsAll_.push_back(PathInfo(usedPrescale, pathname_, "dummy", processname_, objectType, triggerType)); - } - - -} - -void -BTVHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - iEvent.getByToken(triggerResultsToken, triggerResults_); - if(!triggerResults_.isValid()) { - iEvent.getByToken(triggerResultsFUToken,triggerResults_); - if(!triggerResults_.isValid()) { - edm::LogInfo("BTVHLTOfflineSource") << "TriggerResults not found, " - "skipping event"; - return; - } - } - - triggerNames_ = iEvent.triggerNames(*triggerResults_); - - iEvent.getByToken(triggerSummaryToken,triggerObj_); - if(!triggerObj_.isValid()) { - iEvent.getByToken(triggerSummaryFUToken,triggerObj_); - if(!triggerObj_.isValid()) { - edm::LogInfo("BTVHLTOfflineSource") << "TriggerEvent not found, " - "skipping event"; - return; - } - } - - iEvent.getByToken(csvCaloTagsToken_, csvCaloTags); - iEvent.getByToken(csvPfTagsToken_, csvPfTags); - - Handle VertexHandler; - - Handle offlineJetTagHandlerPF; - iEvent.getByToken(offlineCSVTokenPF_, offlineJetTagHandlerPF); - - Handle offlineJetTagHandlerCalo; - iEvent.getByToken(offlineCSVTokenCalo_, offlineJetTagHandlerCalo); - - Handle offlineVertexHandler; - iEvent.getByToken(offlinePVToken_, offlineVertexHandler); - - if(verbose_ && iEvent.id().event()%10000==0) - cout<<"Run = "<begin(); - - float CSV_online = iter->second; - if (CSV_online<0) CSV_online = -0.05; - - v.getMEhisto_CSV()->Fill(CSV_online); - v.getMEhisto_Pt()->Fill(iter->first->pt()); - v.getMEhisto_Eta()->Fill(iter->first->eta()); - - DR = 9999.; - if(offlineJetTagHandlerPF.isValid()){ - for (auto const & iterO : *offlineJetTagHandlerPF){ - float CSV_offline = iterO.second; - if (CSV_offline<0) CSV_offline = -0.05; - DR = reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi()); - if (DR<0.3) { - v.getMEhisto_CSV_RECOvsHLT()->Fill(CSV_offline,CSV_online); continue; - } - } - } - - iEvent.getByToken(hltPFPVToken_, VertexHandler); - if (VertexHandler.isValid()) - { - v.getMEhisto_PVz()->Fill(VertexHandler->begin()->z()); - if (offlineVertexHandler.isValid()) v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); - } - } - - if (csvCaloTags.isValid() && v.getTriggerType() == "Calo" && !csvCaloTags->empty()) - { - auto iter = csvCaloTags->begin(); - - float CSV_online = iter->second; - if (CSV_online<0) CSV_online = -0.05; - - v.getMEhisto_CSV()->Fill(CSV_online); - v.getMEhisto_Pt()->Fill(iter->first->pt()); - v.getMEhisto_Eta()->Fill(iter->first->eta()); - - DR = 9999.; - if(offlineJetTagHandlerCalo.isValid()){ - for (auto const & iterO : *offlineJetTagHandlerCalo) - { - float CSV_offline = iterO.second; - if (CSV_offline<0) CSV_offline = -0.05; - DR = reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi()); - if (DR<0.3) - { - v.getMEhisto_CSV_RECOvsHLT()->Fill(CSV_offline,CSV_online); continue; - } - } - } - - iEvent.getByToken(hltFastPVToken_, VertexHandler); - if (VertexHandler.isValid()) - { - v.getMEhisto_PVz()->Fill(VertexHandler->begin()->z()); - if (offlineVertexHandler.isValid()) v.getMEhisto_fastPVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); - } - - iEvent.getByToken(hltCaloPVToken_, VertexHandler); - if (VertexHandler.isValid()) - { - v.getMEhisto_fastPVz()->Fill(VertexHandler->begin()->z()); - if (offlineVertexHandler.isValid()) v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z()); - } - - } - - - } - } - -} - -void -BTVHLTOfflineSource::bookHistograms(DQMStore::IBooker & iBooker, edm::Run const & run, edm::EventSetup const & c) -{ - iBooker.setCurrentFolder(dirname_); - for(auto & v : hltPathsAll_){ - // - std::string trgPathName = HLTConfigProvider::removeVersion(v.getPath()); - std::string subdirName = dirname_ +"/"+ trgPathName; - std::string trigPath = "("+trgPathName+")"; - iBooker.setCurrentFolder(subdirName); - - std::string labelname("HLT"); - std::string histoname(labelname+""); - std::string title(labelname+""); - - histoname = labelname+"_CSV"; - title = labelname+"_CSV "+trigPath; - MonitorElement * CSV = iBooker.book1D(histoname.c_str(),title.c_str(),110,-0.1,1); - - histoname = labelname+"_Pt"; - title = labelname+"_Pt "+trigPath; - MonitorElement * Pt = iBooker.book1D(histoname.c_str(),title.c_str(),100,0,400); - - histoname = labelname+"_Eta"; - title = labelname+"_Eta "+trigPath; - MonitorElement * Eta = iBooker.book1D(histoname.c_str(),title.c_str(),60,-3.0,3.0); - - histoname = "RECOvsHLT_CSV"; - title = "offline CSV vs online CSV "+trigPath; - MonitorElement * CSV_RECOvsHLT = iBooker.book2D(histoname.c_str(),title.c_str(),110,-0.1,1,110,-0.1,1); - - histoname = labelname+"_PVz"; - title = "online z(PV) "+trigPath; - MonitorElement * PVz = iBooker.book1D(histoname.c_str(),title.c_str(),80,-20,20); - - histoname = labelname+"_fastPVz"; - title = "online z(fastPV) "+trigPath; - MonitorElement * fastPVz = iBooker.book1D(histoname.c_str(),title.c_str(),80,-20,20); - - histoname = "HLTMinusRECO_PVz"; - title = "online z(PV) - offline z(PV) "+trigPath; - MonitorElement * PVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),200,-0.5,0.5); - - histoname = "HLTMinusRECO_fastPVz"; - title = "online z(fastPV) - offline z(PV) "+trigPath; - MonitorElement * fastPVz_HLTMinusRECO = iBooker.book1D(histoname.c_str(),title.c_str(),100,-2,2); - - v.setHistos(CSV,Pt,Eta,CSV_RECOvsHLT,PVz,fastPVz,PVz_HLTMinusRECO,fastPVz_HLTMinusRECO); - } -} diff --git a/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc b/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc index 12aacc4c46447..d88acae907cf5 100644 --- a/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc +++ b/DQMOffline/Trigger/src/HLTTauDQMOfflineSource.cc @@ -43,14 +43,8 @@ HLTTauDQMOfflineSource::HLTTauDQMOfflineSource( const edm::ParameterSet& ps ): } tagAndProbe_ = false; if(ps.exists("TagAndProbe")) { - std::vector tagAndProbePaths = ps.getUntrackedParameter >("TagAndProbe"); + tagAndProbePaths = ps.getUntrackedParameter >("TagAndProbe"); tagAndProbe_ = true; - // tagandprobePlotters_.reserve(tagAndProbePaths.size()); - for(const edm::ParameterSet& tpset: tagAndProbePaths) { - num_genTriggerEventFlag_.emplace_back(new GenericTriggerEventFlag(tpset.getParameter("numerator"),consumesCollector(), *this)); - den_genTriggerEventFlag_.emplace_back(new GenericTriggerEventFlag(tpset.getParameter("denominator"),consumesCollector(), *this)); - tagandprobePlotters_.emplace_back( new HLTTauDQMTagAndProbePlotter(tpset,std::move(num_genTriggerEventFlag_.back()),std::move(den_genTriggerEventFlag_.back()),dqmBaseFolder_)); - } } if(doRefAnalysis_) { @@ -72,19 +66,19 @@ void HLTTauDQMOfflineSource::dqmBeginRun(const edm::Run& iRun, const edm::EventS if(HLTCP_.init(iRun, iSetup, hltProcessName_, hltMenuChanged)) { LogDebug("HLTTauDQMOffline") << "dqmBeginRun(), hltMenuChanged " << hltMenuChanged; if(hltMenuChanged) { - // Find all paths to monitor - std::vector foundPaths; - std::smatch what; - LogDebug("HLTTauDQMOffline") << "Looking for paths with regex " << pathRegex_; - for(const std::string& pathName: HLTCP_.triggerNames()) { - if(std::regex_search(pathName, what, pathRegex_)) { - LogDebug("HLTTauDQMOffline") << "Found path " << pathName; - foundPaths.emplace_back(pathName); - } - } - std::sort(foundPaths.begin(), foundPaths.end()); - if(!tagAndProbe_) { + // Find all paths to monitor + std::vector foundPaths; + std::smatch what; + LogDebug("HLTTauDQMOffline") << "Looking for paths with regex " << pathRegex_; + for(const std::string& pathName: HLTCP_.triggerNames()) { + if(std::regex_search(pathName, what, pathRegex_)) { + LogDebug("HLTTauDQMOffline") << "Found path " << pathName; + foundPaths.emplace_back(pathName); + } + } + std::sort(foundPaths.begin(), foundPaths.end()); + // Construct path plotters std::vector pathObjects; pathPlotters_.reserve(foundPaths.size()); @@ -100,6 +94,48 @@ void HLTTauDQMOfflineSource::dqmBeginRun(const edm::Run& iRun, const edm::EventS if(pathSummaryPlotter_) { pathSummaryPlotter_->setPathObjects(pathObjects); } + }else{ // tag and probe + // Find all paths to monitor + std::vector foundPaths; + std::smatch what; + + for(const edm::ParameterSet& tpset: tagAndProbePaths) { + std::vector moduleLabels; + edm::ParameterSet denpset = tpset.getParameter("denominator"); + std::vector denominators = denpset.getParameter >("hltPaths"); + std::vector updatedDenominators; + for(size_t i = 0; i < denominators.size(); ++i){ + const std::regex denRegex_(denominators[i]); + for(const std::string& pathName: HLTCP_.triggerNames()) { + if(std::regex_search(pathName, what, denRegex_)) { + updatedDenominators.push_back(pathName); + moduleLabels = HLTCP_.moduleLabels(pathName); + } + } + } + denpset.addParameter >("hltPaths",updatedDenominators); + + + + edm::ParameterSet numpset = tpset.getParameter("numerator"); + std::vector numerators = numpset.getParameter >("hltPaths"); + + const std::regex numRegex_(numerators[0]); + for(const std::string& pathName: HLTCP_.triggerNames()) { + if(std::regex_search(pathName, what, numRegex_)) { + + edm::ParameterSet new_tpset = tpset; + new_tpset.addParameter("name",pathName); + std::vector updatedHltPaths; + updatedHltPaths.push_back(pathName); + numpset.addParameter >("hltPaths",updatedHltPaths); + new_tpset.addParameter("numerator",numpset); + new_tpset.addParameter("denominator",denpset); + + tagandprobePlotters_.emplace_back( new HLTTauDQMTagAndProbePlotter(new_tpset,moduleLabels,dqmBaseFolder_)); + } + } + } } } } else { @@ -186,7 +222,7 @@ void HLTTauDQMOfflineSource::analyze(const Event& iEvent, const EventSetup& iSet //Tag and probe plotters for(auto& tpPlotter: tagandprobePlotters_) { if(tpPlotter->isValid()) - tpPlotter->analyze(iEvent,iSetup,refC); + tpPlotter->analyze(iEvent,*triggerResultsHandle, *triggerEventHandle, refC); } } else { diff --git a/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc b/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc index 5f5760254b826..40e4a55a9a65f 100644 --- a/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc +++ b/DQMOffline/Trigger/src/HLTTauDQMTagAndProbePlotter.cc @@ -4,6 +4,7 @@ #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" #include +#include "Math/GenVector/VectorUtil.h" namespace { std::string stripVersion(const std::string& pathName) { @@ -14,21 +15,21 @@ namespace { } } -HLTTauDQMTagAndProbePlotter::HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, std::unique_ptr numFlag, std::unique_ptr denFlag, const std::string& dqmBaseFolder) : +//HLTTauDQMTagAndProbePlotter::HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, std::unique_ptr numFlag, std::unique_ptr denFlag, const std::string& dqmBaseFolder) : +HLTTauDQMTagAndProbePlotter::HLTTauDQMTagAndProbePlotter(const edm::ParameterSet& iConfig, const std::vector& modLabels, const std::string& dqmBaseFolder) : HLTTauDQMPlotter(stripVersion(iConfig.getParameter("name")), dqmBaseFolder), nbinsPt_(iConfig.getParameter("nPtBins")), ptmin_(iConfig.getParameter("ptmin")), ptmax_(iConfig.getParameter("ptmax")), -// nbinsEta_(iConfig.getParameter("nEtaBins")), -// etamin_(iConfig.getParameter("etamin")), -// etamax_(iConfig.getParameter("etamax")), nbinsPhi_(iConfig.getParameter("nPhiBins")), phimin_(iConfig.getParameter("phimin")), phimax_(iConfig.getParameter("phimax")), xvariable(iConfig.getParameter("xvariable")) { - num_genTriggerEventFlag_ = std::move(numFlag); - den_genTriggerEventFlag_ = std::move(denFlag); + numTriggers = iConfig.getParameter("numerator").getParameter >("hltPaths"); + denTriggers = iConfig.getParameter("denominator").getParameter >("hltPaths"); + + moduleLabels = modLabels; boost::algorithm::to_lower(xvariable); @@ -46,10 +47,6 @@ void HLTTauDQMTagAndProbePlotter::bookHistograms(DQMStore::IBooker &iBooker,edm: if(!isValid()) return; - // Initialize the GenericTriggerEventFlag - if ( num_genTriggerEventFlag_ && num_genTriggerEventFlag_->on() ) num_genTriggerEventFlag_->initRun( iRun, iSetup ); - if ( den_genTriggerEventFlag_ && den_genTriggerEventFlag_->on() ) den_genTriggerEventFlag_->initRun( iRun, iSetup ); - // Efficiency helpers iBooker.setCurrentFolder(triggerTag()+"/helpers"); h_num_pt = iBooker.book1D(xvariable+"EtEffNum", "", nbinsPt_, ptmin_, ptmax_); @@ -73,8 +70,28 @@ void HLTTauDQMTagAndProbePlotter::bookHistograms(DQMStore::IBooker &iBooker,edm: HLTTauDQMTagAndProbePlotter::~HLTTauDQMTagAndProbePlotter() = default; -void HLTTauDQMTagAndProbePlotter::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup, const HLTTauDQMOfflineObjects& refCollection) { +LV HLTTauDQMTagAndProbePlotter::findTrgObject(std::string pathName, const trigger::TriggerEvent& triggerEvent){ + trigger::TriggerObjectCollection trigObjs = triggerEvent.getObjects(); + const unsigned moduleIndex = moduleLabels.size()-2; + + const unsigned hltFilterIndex = triggerEvent.filterIndex(edm::InputTag(moduleLabels[moduleIndex],"","HLT")); + + if (hltFilterIndex < triggerEvent.sizeFilters()) { + const trigger::Keys& triggerKeys(triggerEvent.filterKeys(hltFilterIndex)); + const trigger::Vids& triggerVids(triggerEvent.filterIds(hltFilterIndex)); + + const unsigned nTriggers = triggerVids.size(); + for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) { + const trigger::TriggerObject trigObject = trigObjs[triggerKeys[iTrig]]; +// std::cout << " trigger objs pt,eta,phi: " << triggerKeys[iTrig] << " " +// << trigObject.pt() << " " << trigObject.eta() << " " << trigObject.phi() << " " << trigObject.id() << std::endl; + return LV(trigObject.px(),trigObject.py(),trigObject.pz(),trigObject.energy()); + } + } + return LV(0,0,0,0); +} +void HLTTauDQMTagAndProbePlotter::analyze(edm::Event const& iEvent, const edm::TriggerResults& triggerResults, const trigger::TriggerEvent& triggerEvent, const HLTTauDQMOfflineObjects& refCollection) { std::vector offlineObjects; if(xvariable == "tau") offlineObjects = refCollection.taus; if(xvariable == "muon") offlineObjects = refCollection.muons; @@ -83,10 +100,28 @@ void HLTTauDQMTagAndProbePlotter::analyze(edm::Event const& iEvent, edm::EventSe if(offlineObjects.size() < nOfflineObjs) return; - for(const LV& offlineObject: offlineObjects) { + const edm::TriggerNames& trigNames = iEvent.triggerNames(triggerResults); + for(const LV& offlineObject: offlineObjects) { // Filter out events if Trigger Filtering is requested - if (den_genTriggerEventFlag_->on() && ! den_genTriggerEventFlag_->accept( iEvent, iSetup) ) return; + bool passTrigger = false; + bool hltMatched = false; + for ( size_t i = 0; i < denTriggers.size(); ++i){ + LV trgObject = findTrgObject(denTriggers[i],triggerEvent); + + for ( unsigned int hltIndex = 0; hltIndex < trigNames.size(); ++hltIndex){ + passTrigger = (trigNames.triggerName(hltIndex).find(denTriggers[i]) != std::string::npos && triggerResults.wasrun(hltIndex) && triggerResults.accept(hltIndex)); + + if (passTrigger) { + double dr = ROOT::Math::VectorUtil::DeltaR(trgObject,offlineObject); + if(dr < 0.4) hltMatched = true; + break; + } + } + if (passTrigger) break; + } + if(!passTrigger) return; + if(hltMatched) return; // do not consider offline objects which match the tag trigger h_den_pt->Fill(offlineObject.pt()); if(xvariable != "met"){ @@ -95,9 +130,16 @@ void HLTTauDQMTagAndProbePlotter::analyze(edm::Event const& iEvent, edm::EventSe } h_den_phi->Fill(offlineObject.phi()); - // applying selection for numerator - if (num_genTriggerEventFlag_->on() && ! num_genTriggerEventFlag_->accept( iEvent, iSetup) ) return; + passTrigger = false; + for ( size_t i = 0; i < numTriggers.size(); ++i){ + for ( unsigned int hltIndex = 0; hltIndex < trigNames.size(); ++hltIndex){ + passTrigger = (trigNames.triggerName(hltIndex).find(numTriggers[i]) != std::string::npos && triggerResults.wasrun(hltIndex) && triggerResults.accept(hltIndex)); + if (passTrigger) break; + } + if (passTrigger) break; + } + if(!passTrigger) return; h_num_pt->Fill(offlineObject.pt()); if(xvariable != "met"){ diff --git a/DQMOffline/Trigger/src/SealModule.cc b/DQMOffline/Trigger/src/SealModule.cc index 37b2f4f9a72b4..c46c5bdea4758 100644 --- a/DQMOffline/Trigger/src/SealModule.cc +++ b/DQMOffline/Trigger/src/SealModule.cc @@ -14,7 +14,6 @@ #include "DQMOffline/Trigger/interface/TopDiLeptonHLTOfflineDQM.h" #include "DQMOffline/Trigger/interface/TopSingleLeptonHLTOfflineDQM.h" #include "DQMOffline/Trigger/interface/FSQDiJetAve.h" -#include "DQMOffline/Trigger/interface/BTVHLTOfflineSource.h" #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(EgHLTOfflineSource); @@ -32,5 +31,4 @@ DEFINE_FWK_MODULE(HLTInclusiveVBFClient); DEFINE_FWK_MODULE(TopDiLeptonHLTOfflineDQM); DEFINE_FWK_MODULE(TopSingleLeptonHLTOfflineDQM); DEFINE_FWK_MODULE(FSQDiJetAve); -DEFINE_FWK_MODULE(BTVHLTOfflineSource); diff --git a/DQMServices/Components/test/BuildFile.xml b/DQMServices/Components/test/BuildFile.xml index 2708dbf00e2f8..7b929a930b7d2 100644 --- a/DQMServices/Components/test/BuildFile.xml +++ b/DQMServices/Components/test/BuildFile.xml @@ -5,6 +5,7 @@ + @@ -18,3 +19,6 @@ + + + diff --git a/DQMServices/Components/test/testSchemaEvolution.cpp b/DQMServices/Components/test/testSchemaEvolution.cpp new file mode 100644 index 0000000000000..c8e5fcc4a1ec5 --- /dev/null +++ b/DQMServices/Components/test/testSchemaEvolution.cpp @@ -0,0 +1,147 @@ +#include "Utilities/Testing/interface/CppUnit_testdriver.icpp" //gives main +#include + +#include "TClass.h" +#include "TList.h" +#include "TDataMember.h" + +#include +#include +#include +#include + +using std::unordered_map; +using std::string; + +class TestSchemaEvolution : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(TestSchemaEvolution); + CPPUNIT_TEST(checkVersions); + CPPUNIT_TEST_SUITE_END(); + +public: + TestSchemaEvolution() = default; + ~TestSchemaEvolution() = default; + void setUp() {} + void tearDown() {} + void checkVersions(); + +private: + void fillBaseline(); + void gatherAllClasses(); + void runComparison(); + void loopOnDataMembers(TClass *); + void loopOnBases(TClass *); + void analyseClass(TClass *); + + + unordered_map unique_classes_; + unordered_map unique_classes_current_; + +}; + +CPPUNIT_TEST_SUITE_REGISTRATION( TestSchemaEvolution ); + +void TestSchemaEvolution::fillBaseline() { + unique_classes_current_.insert(std::make_pair("TArray", 1)); + unique_classes_current_.insert(std::make_pair("TArrayD", 1)); + unique_classes_current_.insert(std::make_pair("TArrayF", 1)); + unique_classes_current_.insert(std::make_pair("TArrayI", 1)); + unique_classes_current_.insert(std::make_pair("TArrayS", 1)); + unique_classes_current_.insert(std::make_pair("TAtt3D", 1)); + unique_classes_current_.insert(std::make_pair("TAttAxis", 4)); + unique_classes_current_.insert(std::make_pair("TAttFill", 2)); + unique_classes_current_.insert(std::make_pair("TAttLine", 2)); + unique_classes_current_.insert(std::make_pair("TAttMarker", 2)); + unique_classes_current_.insert(std::make_pair("TAxis", 10)); + unique_classes_current_.insert(std::make_pair("TH1", 8)); + unique_classes_current_.insert(std::make_pair("TH1D", 2)); + unique_classes_current_.insert(std::make_pair("TH1F", 2)); + unique_classes_current_.insert(std::make_pair("TH1I", 2)); + unique_classes_current_.insert(std::make_pair("TH1S", 2)); + unique_classes_current_.insert(std::make_pair("TH2", 4)); + unique_classes_current_.insert(std::make_pair("TH2D", 3)); + unique_classes_current_.insert(std::make_pair("TH2F", 3)); + unique_classes_current_.insert(std::make_pair("TH2I", 3)); + unique_classes_current_.insert(std::make_pair("TH2S", 3)); + unique_classes_current_.insert(std::make_pair("TH3", 5)); + unique_classes_current_.insert(std::make_pair("TH3D", 3)); + unique_classes_current_.insert(std::make_pair("TH3F", 3)); + unique_classes_current_.insert(std::make_pair("TH3I", 3)); + unique_classes_current_.insert(std::make_pair("TH3S", 3)); + unique_classes_current_.insert(std::make_pair("TNamed", 1)); + unique_classes_current_.insert(std::make_pair("TObject", 1)); + unique_classes_current_.insert(std::make_pair("TProfile", 6)); + unique_classes_current_.insert(std::make_pair("TProfile2D", 7)); + unique_classes_current_.insert(std::make_pair("TString", 2)); +} + +void TestSchemaEvolution::runComparison() { + CPPUNIT_ASSERT(unique_classes_current_.size() == unique_classes_.size()); + for (auto cl : unique_classes_current_) { + std::cout << "Checking " << cl.first << " " << cl.second << std::endl; + CPPUNIT_ASSERT(unique_classes_.find(cl.first) != unique_classes_.end()); + CPPUNIT_ASSERT(unique_classes_[cl.first] <= unique_classes_current_[cl.first]); + } +} + +void TestSchemaEvolution::checkVersions() { + fillBaseline(); + gatherAllClasses(); + runComparison(); +} + +void TestSchemaEvolution::gatherAllClasses() { + static const char *classes[] = + { + "TH1F", "TH1S", "TH1D", "TH1I", + "TH2F", "TH2S", "TH2D", "TH2I", + "TH3F", "TH3S", "TH3D", "TH3I", + "TProfile", "TProfile2D", 0 + }; + + int i = 0; + while (classes[i]) + { + TClass *tcl = TClass::GetClass(classes[i]); + if (!tcl) + continue; + unique_classes_.insert(std::make_pair(classes[i], tcl->GetClassVersion())); + analyseClass(tcl); + ++i; + } +} + +void TestSchemaEvolution::loopOnDataMembers(TClass *tcl) +{ + TList *dms = tcl->GetListOfDataMembers(); + TIter next(dms); + while (TObject *obj = next()) { + TClass *cl = TClass::GetClass(((TDataMember *)obj)->GetFullTypeName()); + if (cl && cl->HasDictionary()) { + unique_classes_.insert(std::make_pair(cl->GetName(), cl->GetClassVersion())); + analyseClass(cl); + } + } +} + + +void TestSchemaEvolution::loopOnBases(TClass *tcl) +{ + TList *bases = tcl->GetListOfBases(); + TIter next(bases); + while (TObject *obj = next()) { + TClass *cl = TClass::GetClass(obj->GetName()); + if (cl && cl->HasDictionary()) { + unique_classes_.insert(std::make_pair(cl->GetName(), cl->GetClassVersion())); + analyseClass(cl); + } + } +} + + +void TestSchemaEvolution::analyseClass(TClass *cl) +{ + loopOnBases(cl); + loopOnDataMembers(cl); +} + diff --git a/DQMServices/Core/interface/ConcurrentMonitorElement.h b/DQMServices/Core/interface/ConcurrentMonitorElement.h index c54b879b58a85..3fdc6799ef9b6 100644 --- a/DQMServices/Core/interface/ConcurrentMonitorElement.h +++ b/DQMServices/Core/interface/ConcurrentMonitorElement.h @@ -141,6 +141,11 @@ class ConcurrentMonitorElement me_->getTH1()->Sumw2(); } + void disableAlphanumeric() + { + me_->getTH1()->GetXaxis()->SetNoAlphanumeric(false); + me_->getTH1()->GetYaxis()->SetNoAlphanumeric(false); + } }; #endif // DQMServices_Core_ConcurrentMonitorElement_h diff --git a/DQMServices/Core/interface/DQMStore.h b/DQMServices/Core/interface/DQMStore.h index 021ccc4a30275..83beeac5848e5 100644 --- a/DQMServices/Core/interface/DQMStore.h +++ b/DQMServices/Core/interface/DQMStore.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -58,7 +59,6 @@ class fastmatch public: fastmatch (std::string _fastString); - ~fastmatch(); bool match (std::string const& s) const; @@ -70,7 +70,7 @@ class fastmatch bool compare_strings (std::string const& pattern, std::string const& input) const; - lat::Regexp * regexp_; + std::unique_ptr regexp_{nullptr}; std::string fastString_; MatchingHeuristicEnum matching_; }; @@ -359,7 +359,8 @@ class DQMStore run_ = run; moduleId_ = moduleId; } - f(*ibooker_); + IBooker booker{this}; + f(booker); /* Reset the run number and module id only if multithreading is enabled */ if (enableMultiThread_) { @@ -393,7 +394,9 @@ class DQMStore // is not needed. template void meBookerGetter(iFunc f) { - f(*ibooker_, *igetter_); + IBooker booker{this}; + IGetter getter{this}; + f(booker, getter); } //------------------------------------------------------------------------- @@ -791,8 +794,8 @@ class DQMStore void print_trace(const std::string &dir, const std::string &name); // ----------------------- Unavailable --------------------------------------- - DQMStore(const DQMStore&); - const DQMStore& operator=(const DQMStore&); + DQMStore(DQMStore const&) = delete; + DQMStore& operator=(DQMStore const&) = delete; //------------------------------------------------------------------------------- //------------------------------------------------------------------------------- @@ -828,20 +831,20 @@ class DQMStore TFile & file, unsigned int & counter); - unsigned verbose_; - unsigned verboseQT_; - bool reset_; + unsigned verbose_{1}; + unsigned verboseQT_{1}; + bool reset_{false}; double scaleFlag_; - bool collateHistograms_; - bool enableMultiThread_; + bool collateHistograms_{false}; + bool enableMultiThread_{false}; bool LSbasedMode_; - bool forceResetOnBeginLumi_; - std::string readSelectedDirectory_; - uint32_t run_; - uint32_t moduleId_; - std::ofstream * stream_; + bool forceResetOnBeginLumi_{false}; + std::string readSelectedDirectory_{}; + uint32_t run_{}; + uint32_t moduleId_{}; + std::unique_ptr stream_{nullptr}; - std::string pwd_; + std::string pwd_{}; MEMap data_; std::set dirs_; @@ -850,8 +853,6 @@ class DQMStore QTestSpecs qtestspecs_; std::mutex book_mutex_; - IBooker * ibooker_; - IGetter * igetter_; friend class edm::DQMHttpSource; friend class DQMService; diff --git a/DQMServices/Core/src/DQMStore.cc b/DQMServices/Core/src/DQMStore.cc index 3c874633cdbaf..d41376a57d10d 100644 --- a/DQMServices/Core/src/DQMStore.cc +++ b/DQMServices/Core/src/DQMStore.cc @@ -52,83 +52,86 @@ DQMOldReceiver::runQualityTests. */ /** @var DQMStore::qalgos_ Set of all the available quality test algorithms. */ -////////////////////////////////////////////////////////////////////// -/// name of global monitoring folder (containing all sources subdirectories) -static const std::string s_monitorDirName = "DQMData"; -static const std::string s_referenceDirName = "Reference"; -static const std::string s_collateDirName = "Collate"; -static const std::string s_safe = "/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+=_()# "; - -static const lat::Regexp s_rxmeval ("^<(.*)>(i|f|s|e|t|qr)=(.*)$"); -static const lat::Regexp s_rxmeqr1 ("^st:(\\d+):([-+e.\\d]+):([^:]*):(.*)$"); -static const lat::Regexp s_rxmeqr2 ("^st\\.(\\d+)\\.(.*)$"); -static const lat::Regexp s_rxtrace ("(.*)\\((.*)\\+0x.*\\).*"); -static const lat::Regexp s_rxself ("^[^()]*DQMStore::.*"); -static const lat::Regexp s_rxpbfile (".*\\.pb$"); - -////////////////////////////////////////////////////////////////////// -/// Check whether the @a path is a subdirectory of @a ofdir. Returns -/// true both for an exact match and any nested subdirectory. -static bool -isSubdirectory(const std::string &ofdir, const std::string &path) -{ - return (ofdir.empty() - || (path.size() >= ofdir.size() - && path.compare(0, ofdir.size(), ofdir) == 0 - && (path.size() == ofdir.size() - || path[ofdir.size()] == '/'))); -} - -static void -cleanTrailingSlashes(const std::string &path, std::string &clean, const std::string *&cleaned) -{ - clean.clear(); - cleaned = &path; +namespace { + + ////////////////////////////////////////////////////////////////////// + /// name of global monitoring folder (containing all sources subdirectories) + const std::string s_monitorDirName = "DQMData"; + const std::string s_referenceDirName = "Reference"; + const std::string s_collateDirName = "Collate"; + const std::string s_safe = "/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+=_()# "; + + const lat::Regexp s_rxmeval ("^<(.*)>(i|f|s|e|t|qr)=(.*)$"); + const lat::Regexp s_rxmeqr1 ("^st:(\\d+):([-+e.\\d]+):([^:]*):(.*)$"); + const lat::Regexp s_rxmeqr2 ("^st\\.(\\d+)\\.(.*)$"); + const lat::Regexp s_rxtrace ("(.*)\\((.*)\\+0x.*\\).*"); + const lat::Regexp s_rxself ("^[^()]*DQMStore::.*"); + const lat::Regexp s_rxpbfile (".*\\.pb$"); + + ////////////////////////////////////////////////////////////////////// + /// Check whether the @a path is a subdirectory of @a ofdir. Returns + /// true both for an exact match and any nested subdirectory. + bool + isSubdirectory(const std::string &ofdir, const std::string &path) + { + return (ofdir.empty() + || (path.size() >= ofdir.size() + && path.compare(0, ofdir.size(), ofdir) == 0 + && (path.size() == ofdir.size() + || path[ofdir.size()] == '/'))); + } + + void + cleanTrailingSlashes(const std::string &path, std::string &clean, const std::string *&cleaned) + { + clean.clear(); + cleaned = &path; + + size_t len = path.size(); + for ( ; len > 0 && path[len-1] == '/'; --len) + ; - size_t len = path.size(); - for ( ; len > 0 && path[len-1] == '/'; --len) - ; + if (len != path.size()) + { + clean = path.substr(0, len); + cleaned = &clean; + } + } - if (len != path.size()) + void + splitPath(std::string &dir, std::string &name, const std::string &path) { - clean = path.substr(0, len); - cleaned = &clean; + size_t slash = path.rfind('/'); + if (slash != std::string::npos) + { + dir.append(path, 0, slash); + name.append(path, slash+1, std::string::npos); + } + else + name = path; } -} -static void -splitPath(std::string &dir, std::string &name, const std::string &path) -{ - size_t slash = path.rfind('/'); - if (slash != std::string::npos) + void + mergePath(std::string &path, const std::string &dir, const std::string &name) { - dir.append(path, 0, slash); - name.append(path, slash+1, std::string::npos); + path.reserve(dir.size() + name.size() + 2); + path += dir; + if (! path.empty()) + path += '/'; + path += name; } - else - name = path; -} - -static void -mergePath(std::string &path, const std::string &dir, const std::string &name) -{ - path.reserve(dir.size() + name.size() + 2); - path += dir; - if (! path.empty()) - path += '/'; - path += name; -} -template -QCriterion * -makeQCriterion(const std::string &qtname) -{ return new T(qtname); } + template + QCriterion * + makeQCriterion(const std::string &qtname) + { return new T(qtname); } -template -void -initQCriterion(std::map &m) -{ m[T::getAlgoName()] = &makeQCriterion; } + template + void + initQCriterion(std::map &m) + { m[T::getAlgoName()] = &makeQCriterion; } +} // anonymous namespace ///////////////////////////////////////////////////////////// fastmatch::fastmatch (std::string _fastString) : @@ -136,13 +139,11 @@ fastmatch::fastmatch (std::string _fastString) : { try { - regexp_ = nullptr; - regexp_ = new lat::Regexp(fastString_, 0, lat::Regexp::Wildcard); + regexp_ = std::make_unique(fastString_, 0, lat::Regexp::Wildcard); regexp_->study(); } catch (lat::Error &e) { - delete regexp_; raiseDQMError("DQMStore", "Invalid wildcard pattern '%s' in quality" " test specification", fastString_.c_str()); } @@ -155,7 +156,7 @@ fastmatch::fastmatch (std::string _fastString) : pos = fastString_.find('*', pos + 1 ); if ((size_t)pos == std::string::npos) break; - starCount ++; + ++starCount; } // investigate for heuristics @@ -201,12 +202,6 @@ fastmatch::fastmatch (std::string _fastString) : } } -fastmatch::~fastmatch() -{ - if (regexp_ != nullptr) - delete regexp_; -} - bool fastmatch::compare_strings_reverse(std::string const& pattern, std::string const& input) const { @@ -216,10 +211,10 @@ bool fastmatch::compare_strings_reverse(std::string const& pattern, // compare the two strings character by character for equalness: // this does not create uneeded copies of std::string. The // boost::algorithm implementation does - std::string::const_reverse_iterator rit_pattern = pattern.rbegin(); - std::string::const_reverse_iterator rit_input = input.rbegin(); + auto rit_pattern = pattern.crbegin(); + auto rit_input = input.crbegin(); - for (; rit_pattern < pattern.rend(); rit_pattern++, rit_input++) + for (; rit_pattern < pattern.rend(); ++rit_pattern, ++rit_input) { if (*rit_pattern != *rit_input) // found a difference, fail @@ -237,10 +232,10 @@ bool fastmatch::compare_strings(std::string const& pattern, // compare the two strings character by character for equalness: // this does not create uneeded copies of std::string. The // boost::algorithm implementation does. - std::string::const_iterator rit_pattern = pattern.begin(); - std::string::const_iterator rit_input = input.begin(); + auto rit_pattern = pattern.cbegin(); + auto rit_input = input.cbegin(); - for (; rit_pattern < pattern.end(); rit_pattern++, rit_input++) + for (; rit_pattern < pattern.end(); ++rit_pattern, ++rit_input) { if (*rit_pattern != *rit_input) // found a difference, fail @@ -299,8 +294,8 @@ void DQMStore::IBooker::tagContents(const std::string &path, unsigned int myTag) //IGetter methods std::vector DQMStore::IGetter::getAllContents(const std::string &path, - uint32_t run /* = 0 */, - uint32_t lumi /* = 0 */) { + uint32_t run /* = 0 */, + uint32_t lumi /* = 0 */) { return owner_->getAllContents(path, run, lumi); } @@ -352,29 +347,11 @@ void DQMStore::IGetter::setCurrentFolder(const std::string &fullpath) { ////////////////////////////////////////////////////////////////////// DQMStore::DQMStore(const edm::ParameterSet &pset, edm::ActivityRegistry& ar) - : verbose_ (1), - verboseQT_ (1), - reset_ (false), - collateHistograms_ (false), - enableMultiThread_(false), - forceResetOnBeginLumi_(false), - readSelectedDirectory_ (""), - run_(0), - moduleId_(0), - stream_(nullptr), - pwd_ (""), - ibooker_(nullptr), - igetter_(nullptr) -{ - if (!ibooker_) - ibooker_ = new DQMStore::IBooker(this); - if (!igetter_) - igetter_ = new DQMStore::IGetter(this); - initializeFrom(pset); - + : DQMStore{pset} +{ ar.preallocateSignal_.connect([this](edm::service::SystemBounds const& iBounds) { if(iBounds.maxNumberOfStreams() > 1 ) { - enableMultiThread_ = true; + enableMultiThread_ = true; } }); if(pset.getUntrackedParameter("forceResetOnBeginRun",false)) { @@ -388,23 +365,7 @@ DQMStore::DQMStore(const edm::ParameterSet &pset, edm::ActivityRegistry& ar) } DQMStore::DQMStore(const edm::ParameterSet &pset) - : verbose_ (1), - verboseQT_ (1), - reset_ (false), - collateHistograms_ (false), - enableMultiThread_(false), - readSelectedDirectory_ (""), - run_(0), - moduleId_(0), - stream_(nullptr), - pwd_ (""), - ibooker_(nullptr), - igetter_(nullptr) -{ - if (!ibooker_) - ibooker_ = new DQMStore::IBooker(this); - if (!igetter_) - igetter_ = new DQMStore::IGetter(this); +{ initializeFrom(pset); } @@ -415,10 +376,6 @@ DQMStore::~DQMStore() for (auto & qtestspec : qtestspecs_) delete qtestspec.first; - - if (stream_) - stream_->close(); - delete stream_; } void @@ -490,7 +447,7 @@ DQMStore::print_trace (const std::string &dir, const std::string &name) // concurrency problems because the print_trace method is always called behind // a lock (see bookTransaction). if (!stream_) - stream_ = new std::ofstream("histogramBookingBT.log"); + stream_ = std::make_unique("histogramBookingBT.log"); void *array[10]; size_t size; @@ -504,7 +461,7 @@ DQMStore::print_trace (const std::string &dir, const std::string &name) size_t level = 1; char * demangled = nullptr; - for (; level < size; level++) { + for (; level < size; ++level) { if (!s_rxtrace.match(strings[level], 0, 0, &m)) continue; demangled = abi::__cxa_demangle(m.matchString(strings[level], 2).c_str(), nullptr, nullptr, &r); if (!demangled) continue; @@ -531,7 +488,7 @@ DQMStore::print_trace (const std::string &dir, const std::string &name) size_t i; m.reset(); - for (i = 0; i < size; i++) + for (i = 0; i < size; ++i) if (s_rxtrace.match(strings[i], 0, 0, &m)) { char * demangled = abi::__cxa_demangle(m.matchString(strings[i], 2).c_str(), nullptr, nullptr, &r); @@ -702,12 +659,10 @@ DQMStore::book_(const std::string &dir, const std::string &name, .initialise((MonitorElement::Kind)kind, h); // Initialise quality test information. - auto qi = qtestspecs_.begin(); - auto qe = qtestspecs_.end(); - for ( ; qi != qe; ++qi) + for (auto const& q : qtestspecs_) { - if ( qi->first->match(path) ) - me->addQReport(qi->second); + if (q.first->match(path)) + me->addQReport(q.second); } // If we just booked a (plain) MonitorElement, and there is a reference @@ -1455,10 +1410,10 @@ DQMStore::checkBinningMatches(MonitorElement *me, TH1 *h, unsigned verbose) { if(verbose > 0) std::cout << "*** DQMStore: WARNING:" - << "checkBinningMatches: different binning - cannot add object '" - << h->GetName() << "' of type " - << h->IsA()->GetName() << " to existing ME: '" - << me->getFullname() << "'\n"; + << "checkBinningMatches: different binning - cannot add object '" + << h->GetName() << "' of type " + << h->IsA()->GetName() << " to existing ME: '" + << me->getFullname() << "'\n"; return false; } return true; @@ -1729,17 +1684,15 @@ DQMStore::getContents(std::vector &into, bool showContents /* = tru into.reserve(dirs_.size()); auto me = data_.end(); - auto di = dirs_.begin(); - auto de = dirs_.end(); - for ( ; di != de; ++di) + for (auto const& dir : dirs_) { - MonitorElement proto(&*di, std::string()); + MonitorElement proto(&dir, std::string()); auto mi = data_.lower_bound(proto); auto m = mi; - size_t sz = di->size() + 2; + size_t sz = dir.size() + 2; size_t nfound = 0; - for ( ; m != me && isSubdirectory(*di, *m->data_.dirname); ++m) - if (*di == *m->data_.dirname) + for ( ; m != me && isSubdirectory(dir, *m->data_.dirname); ++m) + if (dir == *m->data_.dirname) { sz += m->data_.objname.size() + 1; ++nfound; @@ -1755,11 +1708,11 @@ DQMStore::getContents(std::vector &into, bool showContents /* = tru { istr->reserve(sz); - *istr += *di; + *istr += dir; *istr += ':'; for (sz = 0; mi != m; ++mi) { - if (*di != *mi->data_.dirname) + if (dir != *mi->data_.dirname) continue; if (sz > 0) @@ -1771,8 +1724,8 @@ DQMStore::getContents(std::vector &into, bool showContents /* = tru } else { - istr->reserve(di->size() + 2); - *istr += *di; + istr->reserve(dir.size() + 2); + *istr += dir; *istr += ':'; } } @@ -1872,14 +1825,12 @@ DQMStore::getMatchingContents(const std::string &pattern, lat::Regexp::Syntax sy std::string path; std::vector result; - auto i = data_.begin(); - auto e = data_.end(); - for ( ; i != e; ++i) + for (auto const& me : data_) { path.clear(); - mergePath(path, *i->data_.dirname, i->data_.objname); + mergePath(path, *me.data_.dirname, me.data_.objname); if (rx.match(path)) - result.push_back(const_cast(&*i)); + result.push_back(const_cast(&me)); } return result; @@ -1894,12 +1845,10 @@ DQMStore::getMatchingContents(const std::string &pattern, lat::Regexp::Syntax sy void DQMStore::reset() { - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) + for (auto const& m : data_) { - auto &me = const_cast(*mi); - if (mi->wasUpdated()) + auto &me = const_cast(m); + if (me.wasUpdated()) { if (me.resetMe()) me.Reset(); @@ -1918,13 +1867,11 @@ DQMStore::reset() void DQMStore::forceReset() { - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) + for (auto const& m : data_) { - if (forceResetOnBeginLumi_ && ((*mi).getLumiFlag() == false)) + if (forceResetOnBeginLumi_ && (m.getLumiFlag() == false)) continue; - auto &me = const_cast(*mi); + auto &me = const_cast(m); me.Reset(); me.resetUpdate(); } @@ -2523,8 +2470,8 @@ DQMStore::saveMonitorElementRangeToROOT( std::string mname(me.getFullname(), s_referenceDirName.size()+1, std::string::npos); MonitorElement *master = get(mname); if (master) - for (size_t i = 0, e = master->data_.qreports.size(); i != e; ++i) - status = std::max(status, master->data_.qreports[i].code); + for (auto const& qreport : master->data_.qreports) + status = std::max(status, qreport.code); if (not master or status < minStatus) { @@ -3062,10 +3009,8 @@ DQMStore::readFile(const std::string &filename, unsigned n = readDirectory(f.get(), overwrite, onlypath, prepend, "", stripdirs); f->Close(); - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) - const_cast(*mi).updateQReportStats(); + for (auto const& me : data_) + const_cast(me).updateQReportStats(); if (verbose_) { @@ -3113,11 +3058,11 @@ void DQMStore::get_info(const dqmstorepb::ROOTFilePB::Histo &h, bool DQMStore::readFilePB(const std::string &filename, - bool overwrite /* = false */, - const std::string &onlypath /* ="" */, - const std::string &prepend /* ="" */, - OpenRunDirs stripdirs /* =StripRunDirs */, - bool fileMustExist /* =true */) + bool overwrite /* = false */, + const std::string &onlypath /* ="" */, + const std::string &prepend /* ="" */, + OpenRunDirs stripdirs /* =StripRunDirs */, + bool fileMustExist /* =true */) { using google::protobuf::io::FileInputStream; using google::protobuf::io::FileOutputStream; @@ -3150,7 +3095,7 @@ DQMStore::readFilePB(const std::string &filename, } ::close(filedescriptor); - for (int i = 0; i < dqmstore_message.histo_size(); i++) { + for (int i = 0; i < dqmstore_message.histo_size(); ++i) { std::string path; std::string objname; @@ -3325,18 +3270,16 @@ DQMStore::useQTestByMatch(const std::string &pattern, const std::string &qtname) qtestspecs_.push_back(qts); // Apply the quality test. - auto mi = data_.begin(); - auto me = data_.end(); std::string path; int cases = 0; - for ( ; mi != me; ++mi) + for (auto const& me : data_) { path.clear(); - mergePath(path, *mi->data_.dirname, mi->data_.objname); + mergePath(path, *me.data_.dirname, me.data_.objname); if (fm->match(path)) { ++cases; - const_cast(*mi).addQReport(qts.second); + const_cast(me).addQReport(qts.second); } } @@ -3354,11 +3297,9 @@ DQMStore::runQTests() << ( reset_ ? "true" : "false" ) << std::endl; // Apply quality tests to each monitor element, skipping references. - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) - if (! isSubdirectory(s_referenceDirName, *mi->data_.dirname)) - const_cast(*mi).runQTests(); + for (auto const& me : data_) + if (! isSubdirectory(s_referenceDirName, *me.data_.dirname)) + const_cast(me).runQTests(); reset_ = false; } @@ -3374,19 +3315,17 @@ DQMStore::getStatus(const std::string &path /* = "" */) const cleanTrailingSlashes(path, clean, cleaned); int status = dqm::qstatus::STATUS_OK; - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) + for (auto const& me : data_) { - if (! cleaned->empty() && ! isSubdirectory(*cleaned, *mi->data_.dirname)) + if (! cleaned->empty() && ! isSubdirectory(*cleaned, *me.data_.dirname)) continue; - if (mi->hasError()) + if (me.hasError()) return dqm::qstatus::ERROR; - else if (mi->hasWarning()) + else if (me.hasWarning()) status = dqm::qstatus::WARNING; else if (status < dqm::qstatus::WARNING - && mi->hasOtherReport()) + && me.hasOtherReport()) status = dqm::qstatus::OTHER; } return status; @@ -3479,11 +3418,9 @@ DQMStore::scaleElements() } factor = factor/(events*1.0); - auto mi = data_.begin(); - auto me = data_.end(); - for ( ; mi != me; ++mi) + for (auto const& m : data_) { - auto &me = const_cast(*mi); + auto &me = const_cast(m); switch (me.kind()) { case MonitorElement::DQM_KIND_TH1F: diff --git a/DQMServices/Core/src/ROOTFilePB.pb.cc b/DQMServices/Core/src/ROOTFilePB.pb.cc index e282e1ec99feb..3fb274d424079 100644 --- a/DQMServices/Core/src/ROOTFilePB.pb.cc +++ b/DQMServices/Core/src/ROOTFilePB.pb.cc @@ -1,7 +1,6 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: DQMServices/Core/src/ROOTFilePB.proto -#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION #include "DQMServices/Core/src/ROOTFilePB.pb.h" #include @@ -15,84 +14,107 @@ #include #include #include +// This is a temporary google only hack +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS +#include "third_party/protobuf/version.h" +#endif // @@protoc_insertion_point(includes) - namespace dqmstorepb { class ROOTFilePB_HistoDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; } _ROOTFilePB_Histo_default_instance_; class ROOTFilePBDefaultTypeInternal { -public: - ::google::protobuf::internal::ExplicitlyConstructed - _instance; + public: + ::google::protobuf::internal::ExplicitlyConstructed + _instance; } _ROOTFilePB_default_instance_; - +} // namespace dqmstorepb namespace protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto { +void InitDefaultsROOTFilePB_HistoImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + { + void* ptr = &::dqmstorepb::_ROOTFilePB_Histo_default_instance_; + new (ptr) ::dqmstorepb::ROOTFilePB_Histo(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::dqmstorepb::ROOTFilePB_Histo::InitAsDefaultInstance(); +} -namespace { +void InitDefaultsROOTFilePB_Histo() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsROOTFilePB_HistoImpl); +} -::google::protobuf::Metadata file_level_metadata[2]; +void InitDefaultsROOTFilePBImpl() { + GOOGLE_PROTOBUF_VERIFY_VERSION; -} // namespace +#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + ::google::protobuf::internal::InitProtobufDefaultsForceUnique(); +#else + ::google::protobuf::internal::InitProtobufDefaults(); +#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS + protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB_Histo(); + { + void* ptr = &::dqmstorepb::_ROOTFilePB_default_instance_; + new (ptr) ::dqmstorepb::ROOTFilePB(); + ::google::protobuf::internal::OnShutdownDestroyMessage(ptr); + } + ::dqmstorepb::ROOTFilePB::InitAsDefaultInstance(); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField - const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0}, -}; +void InitDefaultsROOTFilePB() { + static GOOGLE_PROTOBUF_DECLARE_ONCE(once); + ::google::protobuf::GoogleOnceInit(&once, &InitDefaultsROOTFilePBImpl); +} -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField - const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - ::google::protobuf::internal::AuxillaryParseTableField(), -}; -PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const - TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { nullptr, nullptr, 0, -1, -1, -1, -1, nullptr, false }, - { nullptr, nullptr, 0, -1, -1, -1, -1, nullptr, false }, -}; +::google::protobuf::Metadata file_level_metadata[2]; -const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, _internal_metadata_), +const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, full_pathname_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, size_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, streamed_histo_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB_Histo, flags_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, full_pathname_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, size_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, streamed_histo_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB_Histo, flags_), 0, 2, 1, 3, - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB, _has_bits_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB, _internal_metadata_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB, _has_bits_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ROOTFilePB, histo_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::dqmstorepb::ROOTFilePB, histo_), ~0u, }; -static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { - { 0, 9, sizeof(ROOTFilePB_Histo)}, - { 13, 19, sizeof(ROOTFilePB)}, +static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + { 0, 9, sizeof(::dqmstorepb::ROOTFilePB_Histo)}, + { 13, 19, sizeof(::dqmstorepb::ROOTFilePB)}, }; static ::google::protobuf::Message const * const file_default_instances[] = { - reinterpret_cast(&_ROOTFilePB_Histo_default_instance_), - reinterpret_cast(&_ROOTFilePB_default_instance_), + reinterpret_cast(&::dqmstorepb::_ROOTFilePB_Histo_default_instance_), + reinterpret_cast(&::dqmstorepb::_ROOTFilePB_default_instance_), }; -namespace { - void protobuf_AssignDescriptors() { AddDescriptors(); ::google::protobuf::MessageFactory* factory = nullptr; AssignDescriptors( "DQMServices/Core/src/ROOTFilePB.proto", schemas, file_default_instances, TableStruct::offsets, factory, - file_level_metadata, nullptr, nullptr); + file_level_metadata, NULL, NULL); } void protobuf_AssignDescriptorsOnce() { @@ -100,31 +122,15 @@ void protobuf_AssignDescriptorsOnce() { ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors); } -void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD; +void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD; void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 2); } -} // namespace -void TableStruct::InitDefaultsImpl() { - GOOGLE_PROTOBUF_VERIFY_VERSION; - - ::google::protobuf::internal::InitProtobufDefaults(); - _ROOTFilePB_Histo_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_ROOTFilePB_Histo_default_instance_);_ROOTFilePB_default_instance_._instance.DefaultConstruct(); - ::google::protobuf::internal::OnShutdownDestroyMessage( - &_ROOTFilePB_default_instance_);} - -void InitDefaults() { - static GOOGLE_PROTOBUF_DECLARE_ONCE(once); - ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl); -} -namespace { void AddDescriptorsImpl() { InitDefaults(); - static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { + static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = { "\n%DQMServices/Core/src/ROOTFilePB.proto\022" "\ndqmstorepb\"\216\001\n\nROOTFilePB\022+\n\005histo\030\001 \003(" "\0132\034.dqmstorepb.ROOTFilePB.Histo\032S\n\005Histo" @@ -136,7 +142,6 @@ void AddDescriptorsImpl() { ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "DQMServices/Core/src/ROOTFilePB.proto", &protobuf_RegisterTypes); } -} // anonymous namespace void AddDescriptors() { static GOOGLE_PROTOBUF_DECLARE_ONCE(once); @@ -148,12 +153,13 @@ struct StaticDescriptorInitializer { AddDescriptors(); } } static_descriptor_initializer; - } // namespace protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto - +namespace dqmstorepb { // =================================================================== +void ROOTFilePB_Histo::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int ROOTFilePB_Histo::kFullPathnameFieldNumber; const int ROOTFilePB_Histo::kSizeFieldNumber; @@ -164,7 +170,7 @@ const int ROOTFilePB_Histo::kFlagsFieldNumber; ROOTFilePB_Histo::ROOTFilePB_Histo() : ::google::protobuf::Message(), _internal_metadata_(nullptr) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaults(); + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB_Histo(); } SharedCtor(); // @@protoc_insertion_point(constructor:dqmstorepb.ROOTFilePB.Histo) @@ -214,17 +220,17 @@ void ROOTFilePB_Histo::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* ROOTFilePB_Histo::descriptor() { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const ROOTFilePB_Histo& ROOTFilePB_Histo::default_instance() { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaults(); + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB_Histo(); return *internal_default_instance(); } ROOTFilePB_Histo* ROOTFilePB_Histo::New(::google::protobuf::Arena* arena) const { - auto* n = new ROOTFilePB_Histo; + ROOTFilePB_Histo* n = new ROOTFilePB_Histo; if (arena != nullptr) { arena->Own(n); } @@ -504,7 +510,7 @@ size_t ROOTFilePB_Histo::ByteSizeLong() const { void ROOTFilePB_Histo::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:dqmstorepb.ROOTFilePB.Histo) GOOGLE_DCHECK_NE(&from, this); - const auto* source = + const ROOTFilePB_Histo* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == nullptr) { @@ -579,190 +585,14 @@ void ROOTFilePB_Histo::InternalSwap(ROOTFilePB_Histo* other) { ::google::protobuf::Metadata ROOTFilePB_Histo::GetMetadata() const { protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// ROOTFilePB_Histo - -// required string full_pathname = 1; -bool ROOTFilePB_Histo::has_full_pathname() const { - return (_has_bits_[0] & 0x00000001u) != 0; -} -void ROOTFilePB_Histo::set_has_full_pathname() { - _has_bits_[0] |= 0x00000001u; -} -void ROOTFilePB_Histo::clear_has_full_pathname() { - _has_bits_[0] &= ~0x00000001u; -} -void ROOTFilePB_Histo::clear_full_pathname() { - full_pathname_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_full_pathname(); -} -const ::std::string& ROOTFilePB_Histo::full_pathname() const { - // @@protoc_insertion_point(field_get:dqmstorepb.ROOTFilePB.Histo.full_pathname) - return full_pathname_.GetNoArena(); -} -void ROOTFilePB_Histo::set_full_pathname(const ::std::string& value) { - set_has_full_pathname(); - full_pathname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:dqmstorepb.ROOTFilePB.Histo.full_pathname) -} -#if LANG_CXX11 -void ROOTFilePB_Histo::set_full_pathname(::std::string&& value) { - set_has_full_pathname(); - full_pathname_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:dqmstorepb.ROOTFilePB.Histo.full_pathname) -} -#endif -void ROOTFilePB_Histo::set_full_pathname(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_full_pathname(); - full_pathname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:dqmstorepb.ROOTFilePB.Histo.full_pathname) -} -void ROOTFilePB_Histo::set_full_pathname(const char* value, size_t size) { - set_has_full_pathname(); - full_pathname_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:dqmstorepb.ROOTFilePB.Histo.full_pathname) -} -::std::string* ROOTFilePB_Histo::mutable_full_pathname() { - set_has_full_pathname(); - // @@protoc_insertion_point(field_mutable:dqmstorepb.ROOTFilePB.Histo.full_pathname) - return full_pathname_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* ROOTFilePB_Histo::release_full_pathname() { - // @@protoc_insertion_point(field_release:dqmstorepb.ROOTFilePB.Histo.full_pathname) - clear_has_full_pathname(); - return full_pathname_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void ROOTFilePB_Histo::set_allocated_full_pathname(::std::string* full_pathname) { - if (full_pathname != NULL) { - set_has_full_pathname(); - } else { - clear_has_full_pathname(); - } - full_pathname_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), full_pathname); - // @@protoc_insertion_point(field_set_allocated:dqmstorepb.ROOTFilePB.Histo.full_pathname) -} - -// required uint32 size = 2; -bool ROOTFilePB_Histo::has_size() const { - return (_has_bits_[0] & 0x00000004u) != 0; -} -void ROOTFilePB_Histo::set_has_size() { - _has_bits_[0] |= 0x00000004u; -} -void ROOTFilePB_Histo::clear_has_size() { - _has_bits_[0] &= ~0x00000004u; -} -void ROOTFilePB_Histo::clear_size() { - size_ = 0u; - clear_has_size(); -} -::google::protobuf::uint32 ROOTFilePB_Histo::size() const { - // @@protoc_insertion_point(field_get:dqmstorepb.ROOTFilePB.Histo.size) - return size_; -} -void ROOTFilePB_Histo::set_size(::google::protobuf::uint32 value) { - set_has_size(); - size_ = value; - // @@protoc_insertion_point(field_set:dqmstorepb.ROOTFilePB.Histo.size) -} - -// required bytes streamed_histo = 3; -bool ROOTFilePB_Histo::has_streamed_histo() const { - return (_has_bits_[0] & 0x00000002u) != 0; -} -void ROOTFilePB_Histo::set_has_streamed_histo() { - _has_bits_[0] |= 0x00000002u; -} -void ROOTFilePB_Histo::clear_has_streamed_histo() { - _has_bits_[0] &= ~0x00000002u; -} -void ROOTFilePB_Histo::clear_streamed_histo() { - streamed_histo_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_streamed_histo(); -} -const ::std::string& ROOTFilePB_Histo::streamed_histo() const { - // @@protoc_insertion_point(field_get:dqmstorepb.ROOTFilePB.Histo.streamed_histo) - return streamed_histo_.GetNoArena(); -} -void ROOTFilePB_Histo::set_streamed_histo(const ::std::string& value) { - set_has_streamed_histo(); - streamed_histo_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:dqmstorepb.ROOTFilePB.Histo.streamed_histo) -} -#if LANG_CXX11 -void ROOTFilePB_Histo::set_streamed_histo(::std::string&& value) { - set_has_streamed_histo(); - streamed_histo_.SetNoArena( - &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value)); - // @@protoc_insertion_point(field_set_rvalue:dqmstorepb.ROOTFilePB.Histo.streamed_histo) -} -#endif -void ROOTFilePB_Histo::set_streamed_histo(const char* value) { - GOOGLE_DCHECK(value != NULL); - set_has_streamed_histo(); - streamed_histo_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:dqmstorepb.ROOTFilePB.Histo.streamed_histo) -} -void ROOTFilePB_Histo::set_streamed_histo(const void* value, size_t size) { - set_has_streamed_histo(); - streamed_histo_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), - ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:dqmstorepb.ROOTFilePB.Histo.streamed_histo) -} -::std::string* ROOTFilePB_Histo::mutable_streamed_histo() { - set_has_streamed_histo(); - // @@protoc_insertion_point(field_mutable:dqmstorepb.ROOTFilePB.Histo.streamed_histo) - return streamed_histo_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -::std::string* ROOTFilePB_Histo::release_streamed_histo() { - // @@protoc_insertion_point(field_release:dqmstorepb.ROOTFilePB.Histo.streamed_histo) - clear_has_streamed_histo(); - return streamed_histo_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); -} -void ROOTFilePB_Histo::set_allocated_streamed_histo(::std::string* streamed_histo) { - if (streamed_histo != NULL) { - set_has_streamed_histo(); - } else { - clear_has_streamed_histo(); - } - streamed_histo_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), streamed_histo); - // @@protoc_insertion_point(field_set_allocated:dqmstorepb.ROOTFilePB.Histo.streamed_histo) -} - -// required uint32 flags = 4; -bool ROOTFilePB_Histo::has_flags() const { - return (_has_bits_[0] & 0x00000008u) != 0; -} -void ROOTFilePB_Histo::set_has_flags() { - _has_bits_[0] |= 0x00000008u; -} -void ROOTFilePB_Histo::clear_has_flags() { - _has_bits_[0] &= ~0x00000008u; -} -void ROOTFilePB_Histo::clear_flags() { - flags_ = 0u; - clear_has_flags(); -} -::google::protobuf::uint32 ROOTFilePB_Histo::flags() const { - // @@protoc_insertion_point(field_get:dqmstorepb.ROOTFilePB.Histo.flags) - return flags_; -} -void ROOTFilePB_Histo::set_flags(::google::protobuf::uint32 value) { - set_has_flags(); - flags_ = value; - // @@protoc_insertion_point(field_set:dqmstorepb.ROOTFilePB.Histo.flags) -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // =================================================================== +void ROOTFilePB::InitAsDefaultInstance() { +} #if !defined(_MSC_VER) || _MSC_VER >= 1900 const int ROOTFilePB::kHistoFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -770,7 +600,7 @@ const int ROOTFilePB::kHistoFieldNumber; ROOTFilePB::ROOTFilePB() : ::google::protobuf::Message(), _internal_metadata_(nullptr) { if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaults(); + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB(); } SharedCtor(); // @@protoc_insertion_point(constructor:dqmstorepb.ROOTFilePB) @@ -803,17 +633,17 @@ void ROOTFilePB::SetCachedSize(int size) const { GOOGLE_SAFE_CONCURRENT_WRITES_END(); } const ::google::protobuf::Descriptor* ROOTFilePB::descriptor() { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); + return ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages].descriptor; } const ROOTFilePB& ROOTFilePB::default_instance() { - protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaults(); + ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB(); return *internal_default_instance(); } ROOTFilePB* ROOTFilePB::New(::google::protobuf::Arena* arena) const { - auto* n = new ROOTFilePB; + ROOTFilePB* n = new ROOTFilePB; if (arena != nullptr) { arena->Own(n); } @@ -845,8 +675,7 @@ bool ROOTFilePB::MergePartialFromCodedStream( case 1: { if (static_cast< ::google::protobuf::uint8>(tag) == static_cast< ::google::protobuf::uint8>(10u /* 10 & 0xFF */)) { - DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( - input, add_histo())); + DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_histo())); } else { goto handle_unusual; } @@ -904,7 +733,7 @@ ::google::protobuf::uint8* ROOTFilePB::InternalSerializeWithCachedSizesToArray( for (unsigned int i = 0, n = static_cast(this->histo_size()); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: - InternalWriteMessageNoVirtualToArray( + InternalWriteMessageToArray( 1, this->histo(static_cast(i)), deterministic, target); } @@ -927,11 +756,11 @@ size_t ROOTFilePB::ByteSizeLong() const { } // repeated .dqmstorepb.ROOTFilePB.Histo histo = 1; { - auto count = static_cast(this->histo_size()); + unsigned int count = static_cast(this->histo_size()); total_size += 1UL * count; for (unsigned int i = 0; i < count; i++) { total_size += - ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + ::google::protobuf::internal::WireFormatLite::MessageSize( this->histo(static_cast(i))); } } @@ -946,7 +775,7 @@ size_t ROOTFilePB::ByteSizeLong() const { void ROOTFilePB::MergeFrom(const ::google::protobuf::Message& from) { // @@protoc_insertion_point(generalized_merge_from_start:dqmstorepb.ROOTFilePB) GOOGLE_DCHECK_NE(&from, this); - const auto* source = + const ROOTFilePB* source = ::google::protobuf::internal::DynamicCastToGenerated( &from); if (source == nullptr) { @@ -1001,46 +830,11 @@ void ROOTFilePB::InternalSwap(ROOTFilePB* other) { ::google::protobuf::Metadata ROOTFilePB::GetMetadata() const { protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::protobuf_AssignDescriptorsOnce(); - return protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages]; + return ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::file_level_metadata[kIndexInFileMessages]; } -#if PROTOBUF_INLINE_NOT_IN_HEADERS -// ROOTFilePB - -// repeated .dqmstorepb.ROOTFilePB.Histo histo = 1; -int ROOTFilePB::histo_size() const { - return histo_.size(); -} -void ROOTFilePB::clear_histo() { - histo_.Clear(); -} -const ::dqmstorepb::ROOTFilePB_Histo& ROOTFilePB::histo(int index) const { - // @@protoc_insertion_point(field_get:dqmstorepb.ROOTFilePB.histo) - return histo_.Get(index); -} -::dqmstorepb::ROOTFilePB_Histo* ROOTFilePB::mutable_histo(int index) { - // @@protoc_insertion_point(field_mutable:dqmstorepb.ROOTFilePB.histo) - return histo_.Mutable(index); -} -::dqmstorepb::ROOTFilePB_Histo* ROOTFilePB::add_histo() { - // @@protoc_insertion_point(field_add:dqmstorepb.ROOTFilePB.histo) - return histo_.Add(); -} -::google::protobuf::RepeatedPtrField< ::dqmstorepb::ROOTFilePB_Histo >* -ROOTFilePB::mutable_histo() { - // @@protoc_insertion_point(field_mutable_list:dqmstorepb.ROOTFilePB.histo) - return &histo_; -} -const ::google::protobuf::RepeatedPtrField< ::dqmstorepb::ROOTFilePB_Histo >& -ROOTFilePB::histo() const { - // @@protoc_insertion_point(field_list:dqmstorepb.ROOTFilePB.histo) - return histo_; -} - -#endif // PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) - } // namespace dqmstorepb // @@protoc_insertion_point(global_scope) diff --git a/DQMServices/Core/src/ROOTFilePB.pb.h b/DQMServices/Core/src/ROOTFilePB.pb.h index e13eaeb5b27fc..2099ad08d85f8 100644 --- a/DQMServices/Core/src/ROOTFilePB.pb.h +++ b/DQMServices/Core/src/ROOTFilePB.pb.h @@ -8,12 +8,12 @@ #include -#if GOOGLE_PROTOBUF_VERSION < 3004000 +#if GOOGLE_PROTOBUF_VERSION < 3005000 #error This file was generated by a newer version of protoc which is #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3004000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. @@ -30,31 +30,36 @@ #include // IWYU pragma: export #include // @@protoc_insertion_point(includes) -namespace dqmstorepb { -class ROOTFilePB; -class ROOTFilePBDefaultTypeInternal; -extern ROOTFilePBDefaultTypeInternal _ROOTFilePB_default_instance_; -class ROOTFilePB_Histo; -class ROOTFilePB_HistoDefaultTypeInternal; -extern ROOTFilePB_HistoDefaultTypeInternal _ROOTFilePB_Histo_default_instance_; -} // namespace dqmstorepb - -namespace dqmstorepb { namespace protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto { -// Internal implementation detail -- do not call these. +// Internal implementation detail -- do not use these members. struct TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; - static const ::google::protobuf::internal::ParseTable schema[]; - static const ::google::protobuf::uint32 offsets[]; + static const ::google::protobuf::internal::ParseTable schema[2]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; - static void InitDefaultsImpl(); + static const ::google::protobuf::uint32 offsets[]; }; void AddDescriptors(); -void InitDefaults(); +void InitDefaultsROOTFilePB_HistoImpl(); +void InitDefaultsROOTFilePB_Histo(); +void InitDefaultsROOTFilePBImpl(); +void InitDefaultsROOTFilePB(); +inline void InitDefaults() { + InitDefaultsROOTFilePB_Histo(); + InitDefaultsROOTFilePB(); +} } // namespace protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto +namespace dqmstorepb { +class ROOTFilePB; +class ROOTFilePBDefaultTypeInternal; +extern ROOTFilePBDefaultTypeInternal _ROOTFilePB_default_instance_; +class ROOTFilePB_Histo; +class ROOTFilePB_HistoDefaultTypeInternal; +extern ROOTFilePB_HistoDefaultTypeInternal _ROOTFilePB_Histo_default_instance_; +} // namespace dqmstorepb +namespace dqmstorepb { // =================================================================== @@ -94,6 +99,7 @@ class ROOTFilePB_Histo : public ::google::protobuf::Message /* @@protoc_insertio static const ::google::protobuf::Descriptor* descriptor(); static const ROOTFilePB_Histo& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ROOTFilePB_Histo* internal_default_instance() { return reinterpret_cast( &_ROOTFilePB_Histo_default_instance_); @@ -211,7 +217,8 @@ class ROOTFilePB_Histo : public ::google::protobuf::Message /* @@protoc_insertio ::google::protobuf::internal::ArenaStringPtr streamed_histo_; ::google::protobuf::uint32 size_; ::google::protobuf::uint32 flags_; - friend struct protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::TableStruct; + friend struct ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::TableStruct; + friend void ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePB_HistoImpl(); }; // ------------------------------------------------------------------- @@ -251,6 +258,7 @@ class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_poin static const ::google::protobuf::Descriptor* descriptor(); static const ROOTFilePB& default_instance(); + static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY static inline const ROOTFilePB* internal_default_instance() { return reinterpret_cast( &_ROOTFilePB_default_instance_); @@ -301,7 +309,7 @@ class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_poin // nested types ---------------------------------------------------- - using Histo = dqmstorepb::ROOTFilePB_Histo; + typedef ROOTFilePB_Histo Histo; // accessors ------------------------------------------------------- @@ -324,14 +332,14 @@ class ROOTFilePB : public ::google::protobuf::Message /* @@protoc_insertion_poin ::google::protobuf::internal::HasBits<1> _has_bits_; mutable int _cached_size_; ::google::protobuf::RepeatedPtrField< ::dqmstorepb::ROOTFilePB_Histo > histo_; - friend struct protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::TableStruct; + friend struct ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::TableStruct; + friend void ::protobuf_DQMServices_2fCore_2fsrc_2fROOTFilePB_2eproto::InitDefaultsROOTFilePBImpl(); }; // =================================================================== // =================================================================== -#if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" @@ -549,13 +557,11 @@ ROOTFilePB::histo() const { #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ -#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- // @@protoc_insertion_point(namespace_scope) - } // namespace dqmstorepb // @@protoc_insertion_point(global_scope) diff --git a/DQMServices/FileIO/scripts/dqmMemoryStats.py b/DQMServices/FileIO/scripts/dqmMemoryStats.py index 7286a5ca78cf1..bd93fe278369f 100755 --- a/DQMServices/FileIO/scripts/dqmMemoryStats.py +++ b/DQMServices/FileIO/scripts/dqmMemoryStats.py @@ -38,7 +38,9 @@ def analyze(self, fn, obj): self._all[fn] = HistogramEntry(t, bin_size, bin_count, extra, total_bytes) else: t = str(type(obj)) - bin_count, bin_size, extra = 0, 0, len(str(obj)) + len(fn) + #bin_count, bin_size, extra = 0, 0, len(str(obj)) + len(fn) + # assume constant size for strings + bin_count, bin_size, extra = 0, 0, 10 + len(fn) total_bytes = bin_count * bin_size + extra self._all[fn] = HistogramEntry(t, bin_size, bin_count, extra, total_bytes) diff --git a/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h b/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h new file mode 100644 index 0000000000000..b9348a647112b --- /dev/null +++ b/DataFormats/CTPPSDetId/interface/TotemTimingDetId.h @@ -0,0 +1,105 @@ +/**************************************************************************** + * Author: Nicola Minafra + * March 2018 + ****************************************************************************/ + +#ifndef DataFormats_CTPPSDetId_TotemTimingDetId +#define DataFormats_CTPPSDetId_TotemTimingDetId + +#include "DataFormats/CTPPSDetId/interface/CTPPSDetId.h" + +#include "FWCore/Utilities/interface/Exception.h" + +#include +#include +#include + +/** + *\brief Detector ID class for CTPPS Totem Timing detectors. + * Bits [19:31] : Assigend in CTPPSDetId Calss + * Bits [17:18] : 2 bits for UFSD plane 0,1,2,3 + * Bits [12:16] : 5 bits for UFSD channel numbers 1,2,3,..16 + * Bits [0:11] : unspecified yet + * + * This class is very similar to CTPPSDiamondDetId; however the detector is completely separated, therefore it is useful to keep them separate and independent. + **/ + +class TotemTimingDetId : public CTPPSDetId +{ + public: + enum { ID_NOT_SET = 28 }; + + /// Construct from a raw id + explicit TotemTimingDetId( uint32_t id ); + TotemTimingDetId( const CTPPSDetId&id ) : CTPPSDetId( id ) {} + + /// Construct from hierarchy indices. + TotemTimingDetId( uint32_t arm, uint32_t station, uint32_t romanPot = 0, uint32_t plane = 0, uint32_t channel = 0 ); + + static constexpr uint32_t startPlaneBit = 17, maskPlane = 0x3, maxPlane = 3, lowMaskPlane = 0x1FFFF; + static constexpr uint32_t startDetBit = 12, maskChannel = 0x1F, maxChannel = 31, lowMaskChannel = 0xFFF; + + /// returns true if the raw ID is a PPS-timing one + static bool check( unsigned int raw ) + { + return ( ( ( raw >> DetId::kDetOffset ) & 0xF ) == DetId::VeryForward + && ( ( raw >> DetId::kSubdetOffset ) & 0x7 ) == sdTimingFastSilicon ); + } + //-------------------- getting and setting methods -------------------- + + uint32_t plane() const + { + return ( ( id_ >> startPlaneBit ) & maskPlane ); + } + + void setPlane( uint32_t channel ) + { + id_ &= ~( maskPlane << startPlaneBit ); + id_ |= ( ( channel & maskPlane ) << startPlaneBit ); + } + + uint32_t channel() const + { + return ( ( id_ >> startDetBit ) & maskChannel ); + } + + void setChannel( uint32_t channel ) + { + id_ &= ~( maskChannel << startDetBit ); + id_ |= ( ( channel & maskChannel ) << startDetBit ); + } + + //-------------------- id getters for higher-level objects -------------------- + + TotemTimingDetId getPlaneId() const + { + return TotemTimingDetId( rawId() & ( ~lowMaskPlane ) ); + } + + //-------------------- name methods -------------------- + + inline void planeName( std::string& name, NameFlag flag = nFull ) const + { + switch ( flag ) { + case nShort: name = ""; break; + case nFull: rpName( name, flag ); name += "_"; break; + case nPath: rpName( name, flag ); name += "/plane "; break; + } + name += std::to_string( plane() ); + } + + inline void channelName( std::string& name, NameFlag flag = nFull ) const + { + switch ( flag ) { + case nShort: name = ""; break; + case nFull: planeName( name, flag ); name += "_"; break; + case nPath: planeName( name, flag ); name += "/channel "; break; + } + name += std::to_string( channel() ); + } +}; + +std::ostream& operator<<( std::ostream& os, const TotemTimingDetId& id ); + +#endif + diff --git a/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc b/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc new file mode 100644 index 0000000000000..e9fff959ff21a --- /dev/null +++ b/DataFormats/CTPPSDetId/src/TotemTimingDetId.cc @@ -0,0 +1,60 @@ +/**************************************************************************** + * Author: Nicola Minafra + * March 2018 + ****************************************************************************/ + +#include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" +#include "FWCore/Utilities/interface/Exception.h" + +//---------------------------------------------------------------------------------------------------- + +TotemTimingDetId::TotemTimingDetId( uint32_t id ) : + CTPPSDetId( id ) +{ + if ( !check( id ) ) { + throw cms::Exception( "InvalidDetId" ) + << "TotemTimingDetId ctor:" + << " channel: " << channel() + << " subdet: " << subdetId() + << " is not a valid Totem Timing id"; + } +} + +//---------------------------------------------------------------------------------------------------- + +TotemTimingDetId::TotemTimingDetId( uint32_t arm, uint32_t station, uint32_t romanPot, uint32_t plane, uint32_t channel ) : + CTPPSDetId( sdTimingFastSilicon, arm, station, romanPot ) +{ + if ( arm > maxArm || station > maxStation || romanPot > maxRP || plane > maxPlane || channel > maxChannel ) { + throw cms::Exception( "InvalidDetId" ) + << "TotemTimingDetId ctor:" + << " Invalid parameters:" + << " arm=" << arm + << " station=" << station + << " rp=" << romanPot + << " plane=" << plane + << " detector=" << channel + << std::endl; + } + + uint32_t ok = 0xfe000000; + id_ &= ok; + + id_ |= ( ( arm & maskArm ) << startArmBit ); + id_ |= ( ( station & maskStation ) << startStationBit ); + id_ |= ( ( romanPot & maskRP ) << startRPBit ); + id_ |= ( ( plane & maskPlane ) << startPlaneBit ); + id_ |= ( ( channel & maskChannel ) << startDetBit ); +} + +//---------------------------------------------------------------------------------------------------- + +std::ostream& operator<<( std::ostream& os, const TotemTimingDetId& id ) +{ + return os + << "arm=" << id.arm() + << " station=" << id.station() + << " rp=" << id.rp() + << " plane=" << id.plane() + << " Detector=" << id.channel(); +} diff --git a/DataFormats/CTPPSDetId/src/classes.h b/DataFormats/CTPPSDetId/src/classes.h index c529d815a77e2..715643332bc41 100644 --- a/DataFormats/CTPPSDetId/src/classes.h +++ b/DataFormats/CTPPSDetId/src/classes.h @@ -2,11 +2,13 @@ #include "DataFormats/CTPPSDetId/interface/CTPPSDetId.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" #include "DataFormats/CTPPSDetId/interface/CTPPSPixelDetId.h" +#include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" namespace DataFormats_TotemRPDetId { struct dictionary { CTPPSDetId dummy0; TotemRPDetId dummy1; CTPPSDiamondDetId dummy2; CTPPSPixelDetId dummy3; + TotemTimingDetId dummy4; }; } diff --git a/DataFormats/CTPPSDetId/src/classes_def.xml b/DataFormats/CTPPSDetId/src/classes_def.xml index 95c41b0738666..ddfa1a7b4237b 100644 --- a/DataFormats/CTPPSDetId/src/classes_def.xml +++ b/DataFormats/CTPPSDetId/src/classes_def.xml @@ -13,5 +13,9 @@ + + + + diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h new file mode 100644 index 0000000000000..db2e16e8bb863 --- /dev/null +++ b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h @@ -0,0 +1,209 @@ +#ifndef CTPPSDigi_TotemTimingDigi_h +#define CTPPSDigi_TotemTimingDigi_h + +/** \class TotemTimingDigi + * + * Digi Class for CTPPS Timing Detector + * + * \author Mirko Berretti + * \author Nicola Minafra + * \author Laurent Forthomme + * March 2018 + */ + +#include +#include + +#include + +class TotemTimingDigi +{ + public: + TotemTimingDigi( const uint8_t hwId, const uint64_t fpgaTimestamp, const uint16_t timestampA, const uint16_t timestampB, const uint16_t cellInfo, const std::vector& samples, const TotemTimingEventInfo& totemTimingEventInfo ); + TotemTimingDigi( const TotemTimingDigi& digi ); + TotemTimingDigi(); + ~TotemTimingDigi() {}; + + /// Digis are equal if they have all the same values, NOT checking the samples! + bool operator==( const TotemTimingDigi& digi ) const; + + /// Return digi values number + + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline unsigned int getHardwareId() const + { + return hwId_; + } + + inline unsigned int getHardwareBoardId() const + { + return ( hwId_ & 0xE0 ) >> 5; + } + + inline unsigned int getHardwareSampicId() const + { + return ( hwId_ & 0x10 ) >> 4; + } + + inline unsigned int getHardwareChannelId() const + { + return ( hwId_ & 0x0F ); + } + + inline unsigned int getFPGATimestamp() const + { + return fpgaTimestamp_; + } + + inline unsigned int getTimestampA() const + { + return timestampA_; + } + + inline unsigned int getTimestampB() const + { + return timestampB_; + } + + inline unsigned int getCellInfo() const + { + return cellInfo_; + } + + inline std::vector getSamples() const + { + return samples_; + } + + inline std::vector::const_iterator getSamplesBegin() const + { + return samples_.cbegin(); + } + + inline std::vector::const_iterator getSamplesEnd() const + { + return samples_.cend(); + } + + inline unsigned int getNumberOfSamples() const + { + return samples_.size(); + } + + inline int getSampleAt( const unsigned int i ) const + { + int sampleValue = -1; + if ( i < samples_.size() ) + sampleValue = (int) samples_.at( i ); + return sampleValue; + } + + inline TotemTimingEventInfo getEventInfo() const + { + return totemTimingEventInfo_; + } + + /// Set digi values + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline void setHardwareId( const uint8_t hwId ) + { + hwId_ = hwId; + } + + inline void setHardwareBoardId( const unsigned int boardId ) + { + hwId_ &= 0x1F; // set board bits to 0 + hwId_ |= ( ( boardId & 0x07 ) << 5 ) & 0xE0; + } + + inline void setHardwareSampicId( const unsigned int sampicId ) + { + hwId_ &= 0xEF; // set Sampic bit to 0 + hwId_ |= ( ( sampicId & 0x01 ) << 4 ) & 0x10; + } + + inline void setHardwareChannelId( const unsigned int channelId ) + { + hwId_ &= 0xF0; // Set Sampic bit to 0 + hwId_ |= ( channelId & 0x0F ) & 0x0F; + } + + inline void setFPGATimestamp( const uint64_t fpgaTimestamp ) + { + fpgaTimestamp_ = fpgaTimestamp; + } + + inline void setTimestampA( const uint16_t timestampA ) + { + timestampA_ = timestampA; + } + + inline void setTimestampB( const uint16_t timestampB ) + { + timestampB_ = timestampB; + } + + inline void setCellInfo( const uint16_t cellInfo ) + { + cellInfo_ = cellInfo & 0x3F; + } + + inline void setSamples( const std::vector& samples ) + { + samples_ = samples; + } + + inline void addSample( const uint8_t sampleValue ) + { + samples_.emplace_back( sampleValue ); + } + + inline void setSampleAt( const unsigned int i, const uint8_t sampleValue ) + { + if ( i < samples_.size() ) + samples_.at(i) = sampleValue; + } + + inline void setEventInfo( const TotemTimingEventInfo& totemTimingEventInfo ) + { + totemTimingEventInfo_ = totemTimingEventInfo; + } + + private: + uint8_t hwId_; + uint64_t fpgaTimestamp_; + uint16_t timestampA_; + uint16_t timestampB_; + uint16_t cellInfo_; + + std::vector samples_; + + TotemTimingEventInfo totemTimingEventInfo_; +}; + +#include + +inline bool operator<( const TotemTimingDigi& one, const TotemTimingDigi& other ) +{ + if ( one.getEventInfo() < other.getEventInfo() ) + return true; + if ( one.getHardwareId() < other.getHardwareId() ) + return true; + return false; +} + +inline std::ostream& operator<<( std::ostream& os, const TotemTimingDigi& digi ) +{ + return os << "TotemTimingDigi:" + << "\nHardwareId:\t" << std::hex << digi.getHardwareId() + << "\nDB: " << std::dec << digi.getHardwareBoardId() << "\tSampic: " << digi.getHardwareSampicId() << "\tChannel: " << digi.getHardwareChannelId() + << "\nFPGATimestamp:\t" << std::dec << digi.getFPGATimestamp() + << "\nTimestampA:\t" << std::dec << digi.getTimestampA() + << "\nTimestampB:\t" << std::dec << digi.getTimestampB() + << "\nCellInfo:\t" << std::hex << digi.getCellInfo() + << "\nNumberOfSamples:\t" << std::dec << digi.getNumberOfSamples() + << std::endl << digi.getEventInfo() << std::endl; +} + +#endif + diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h new file mode 100644 index 0000000000000..64aa6b64a52e5 --- /dev/null +++ b/DataFormats/CTPPSDigi/interface/TotemTimingEventInfo.h @@ -0,0 +1,211 @@ +#ifndef CTPPSDigi_TotemTimingEventInfo_h +#define CTPPSDigi_TotemTimingEventInfo_h + +/** \class TotemTimingEventInfo + * + * Event Info Class for CTPPS Timing Detector + * + * \author Mirko Berretti + * \author Nicola Minafra + * \author Laurent Forthomme + * \date March 2018 + */ + +#include +#include + +class TotemTimingEventInfo +{ + public: + TotemTimingEventInfo( const uint8_t hwId, const uint64_t l1ATimestamp, const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, const uint16_t channelMap, const uint16_t l1ALatency, const uint8_t numberOfSamples, const uint8_t offsetOfSamples, const uint8_t pllInfo ); + TotemTimingEventInfo( const TotemTimingEventInfo& eventInfo ); + TotemTimingEventInfo(); + ~TotemTimingEventInfo() {}; + + /// Digis are equal if they have all the same values, NOT checking the samples! + bool operator==( const TotemTimingEventInfo& eventInfo ) const; + + /// Return digi values number + + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline unsigned int getHardwareId() const + { + return hwId_; + } + + inline unsigned int getHardwareBoardId() const + { + return ( hwId_ & 0xE0 ) >> 5; + } + + inline unsigned int getHardwareSampicId() const + { + return ( hwId_ & 0x10 ) >> 4; + } + + inline unsigned int getHardwareChannelId() const + { + return ( hwId_ & 0x0F ); + } + + inline unsigned int getL1ATimestamp() const + { + return l1ATimestamp_; + } + + inline unsigned int getBunchNumber() const + { + return bunchNumber_; + } + + inline unsigned int getOrbitNumber() const + { + return orbitNumber_; + } + + inline unsigned int getEventNumber() const + { + return eventNumber_; + } + + inline uint16_t getChannelMap() const + { + return channelMap_; + } + + inline unsigned int getL1ALatency() const + { + return l1ALatency_; + } + + inline unsigned int getNumberOfSamples() const + { + return numberOfSamples_; + } + + inline unsigned int getOffsetOfSamples() const + { + return offsetOfSamples_; + } + + inline uint8_t getPLLInfo() const + { + return pllInfo_; + } + + /// Set digi values + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline void setHardwareId( const uint8_t hwId ) + { + hwId_ = hwId; + } + + inline void setHardwareBoardId( const unsigned int boardId ) + { + hwId_ &= 0x1F; // Set board bits to 0 + hwId_ |= ( ( boardId & 0x07 ) << 5 ) & 0xE0; + } + + inline void setHardwareSampicId( const unsigned int sampicId ) + { + hwId_ &= 0xEF; // set Sampic bit to 0 + hwId_ |= ( ( sampicId & 0x01 ) << 4 ) & 0x10; + } + + inline void setHardwareChannelId( const unsigned int channelId ) + { + hwId_ &= 0xF0; // set Sampic bit to 0 + hwId_ |= ( channelId & 0x0F ) & 0x0F; + } + + inline void setL1ATimestamp( const uint64_t l1ATimestamp ) + { + l1ATimestamp_ = l1ATimestamp; + } + + inline void setBunchNumber( const uint16_t bunchNumber ) + { + bunchNumber_ = bunchNumber; + } + + inline void setOrbitNumber( const uint32_t orbitNumber ) + { + orbitNumber_ = orbitNumber; + } + + inline void setEventNumber( const uint32_t eventNumber ) + { + eventNumber_ = eventNumber; + } + + inline void setChannelMap( const uint16_t channelMap ) + { + channelMap_ = channelMap; + } + + inline void setL1ALatency( const uint16_t l1ALatency ) + { + l1ALatency_ = l1ALatency; + } + + inline void setNumberOfSamples( const uint8_t numberOfSamples ) + { + numberOfSamples_ = numberOfSamples; + } + + inline void setOffsetOfSamples( const uint8_t offsetOfSamples ) + { + offsetOfSamples_ = offsetOfSamples; + } + + inline void setPLLInfo( const uint8_t pllInfo ) + { + pllInfo_ = pllInfo; + } + + private: + uint8_t hwId_; + uint64_t l1ATimestamp_; + uint16_t bunchNumber_; + uint32_t orbitNumber_; + uint32_t eventNumber_; + uint16_t channelMap_; + uint16_t l1ALatency_; + uint8_t numberOfSamples_; + uint8_t offsetOfSamples_; + uint8_t pllInfo_; +}; + +#include + +inline bool operator<( const TotemTimingEventInfo& one, const TotemTimingEventInfo& other ) +{ + if ( one.getEventNumber() < other.getEventNumber() ) + return true; + if ( one.getL1ATimestamp() < other.getL1ATimestamp() ) + return true; + if ( one.getHardwareId() < other.getHardwareId() ) + return true; + return false; +} + +inline std::ostream& operator<<( std::ostream& o, const TotemTimingEventInfo& digi ) +{ + std::bitset<16> bitsPLLInfo( digi.getPLLInfo() ); + return o << "TotemTimingEventInfo:" + << "\nHardwareId:\t" << std::hex << digi.getHardwareId() + << "\nDB: " << std::dec << digi.getHardwareBoardId() << "\tSampic: " << digi.getHardwareSampicId() << "\tChannel: " << digi.getHardwareChannelId() + << "\nL1A Timestamp:\t" << std::dec << digi.getL1ATimestamp() + << "\nL1A Latency:\t" << std::dec << digi.getL1ALatency() + << "\nBunch Number:\t" << std::dec << digi.getBunchNumber() + << "\nOrbit Number:\t" << std::dec << digi.getOrbitNumber() + << "\nEvent Number:\t" << std::dec << digi.getEventNumber() + << "\nChannels fired:\t" << std::hex << digi.getChannelMap() + << "\nNumber of Samples:\t" << std::dec << digi.getNumberOfSamples() + << "\nOffset of Samples:\t" << std::dec << digi.getOffsetOfSamples() + << "\nPLL Info:\t" << bitsPLLInfo.to_string() + << std::endl; +} + +#endif + diff --git a/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc b/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc new file mode 100644 index 0000000000000..22be241be9a55 --- /dev/null +++ b/DataFormats/CTPPSDigi/src/TotemTimingDigi.cc @@ -0,0 +1,40 @@ +/** \file + * + * + * \author Mirko Berretti + * \author Nicola Minafra + */ + +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" + +TotemTimingDigi::TotemTimingDigi( const uint8_t hwId, + const uint64_t fpgaTimestamp, const uint16_t timestampA, const uint16_t timestampB, + const uint16_t cellInfo, const std::vector& samples, + const TotemTimingEventInfo& totemTimingEventInfo ) : + hwId_( hwId ), fpgaTimestamp_( fpgaTimestamp ), timestampA_( timestampA ), timestampB_( timestampB ), + cellInfo_( cellInfo ), samples_( samples ), totemTimingEventInfo_( totemTimingEventInfo ) +{} + +TotemTimingDigi::TotemTimingDigi( const TotemTimingDigi& digi ) : + hwId_( digi.hwId_ ), fpgaTimestamp_( digi.fpgaTimestamp_ ), timestampA_( digi.timestampA_ ), timestampB_( digi.timestampB_ ), + cellInfo_( digi.cellInfo_ ), samples_( digi.samples_ ), totemTimingEventInfo_( digi.totemTimingEventInfo_ ) +{} + +TotemTimingDigi::TotemTimingDigi() : + hwId_( 0 ), fpgaTimestamp_( 0 ), timestampA_( 0 ), timestampB_( 0 ), cellInfo_( 0 ) +{} + +// Comparison +bool +TotemTimingDigi::operator==( const TotemTimingDigi& digi ) const +{ + if ( hwId_ != digi.hwId_ + || fpgaTimestamp_ != digi.fpgaTimestamp_ + || timestampA_ != digi.timestampA_ + || timestampB_ != digi.timestampB_ + || cellInfo_ != digi.cellInfo_ + || samples_ != digi.samples_ + ) return false; + return true; +} + diff --git a/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc b/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc new file mode 100644 index 0000000000000..5c661f5baa3c0 --- /dev/null +++ b/DataFormats/CTPPSDigi/src/TotemTimingEventInfo.cc @@ -0,0 +1,50 @@ +/** \file + * + * \author Mirko Berretti + * \author Nicola Minafra + */ + +#include + +TotemTimingEventInfo::TotemTimingEventInfo( const uint8_t hwId, const uint64_t l1ATimestamp, + const uint16_t bunchNumber, const uint32_t orbitNumber, const uint32_t eventNumber, + const uint16_t channelMap, const uint16_t l1ALatency, + const uint8_t numberOfSamples, const uint8_t offsetOfSamples, const uint8_t pllInfo ) : + hwId_( hwId ), l1ATimestamp_( l1ATimestamp ), + bunchNumber_( bunchNumber ), orbitNumber_( orbitNumber ), eventNumber_( eventNumber ), + channelMap_( channelMap ), l1ALatency_( l1ALatency ), + numberOfSamples_( numberOfSamples ), offsetOfSamples_( offsetOfSamples ), pllInfo_( pllInfo ) +{} + +TotemTimingEventInfo::TotemTimingEventInfo( const TotemTimingEventInfo& eventInfo ) : + hwId_( eventInfo.hwId_ ), l1ATimestamp_( eventInfo.l1ATimestamp_ ), + bunchNumber_( eventInfo.bunchNumber_ ), orbitNumber_( eventInfo.orbitNumber_ ), eventNumber_( eventInfo.eventNumber_ ), + channelMap_( eventInfo.channelMap_ ), l1ALatency_( eventInfo.l1ALatency_ ), + numberOfSamples_( eventInfo.numberOfSamples_ ), offsetOfSamples_( eventInfo.offsetOfSamples_ ), pllInfo_ ( eventInfo.pllInfo_ ) +{} + +TotemTimingEventInfo::TotemTimingEventInfo() : + hwId_( 0 ), l1ATimestamp_( 0 ), + bunchNumber_( 0 ), orbitNumber_( 0 ), eventNumber_( 0 ), + channelMap_( 0 ), l1ALatency_( 0 ), + numberOfSamples_( 0 ), offsetOfSamples_( 0 ), pllInfo_( 0 ) +{} + +// Comparison +bool +TotemTimingEventInfo::operator==(const TotemTimingEventInfo& eventInfo) const +{ + if ( hwId_ != eventInfo.hwId_ + || l1ATimestamp_ != eventInfo.l1ATimestamp_ + || bunchNumber_ != eventInfo.bunchNumber_ + || orbitNumber_ != eventInfo.orbitNumber_ + || eventNumber_ != eventInfo.eventNumber_ + || channelMap_ != eventInfo.channelMap_ + || l1ALatency_ != eventInfo.l1ALatency_ + || numberOfSamples_ != eventInfo.numberOfSamples_ + || offsetOfSamples_ != eventInfo.offsetOfSamples_ + || pllInfo_ != eventInfo.pllInfo_ + ) return false; + return true; +} + diff --git a/DataFormats/CTPPSDigi/src/classes.h b/DataFormats/CTPPSDigi/src/classes.h index 10021bcc99643..61534ddebecd0 100644 --- a/DataFormats/CTPPSDigi/src/classes.h +++ b/DataFormats/CTPPSDigi/src/classes.h @@ -15,6 +15,7 @@ #include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h" #include "DataFormats/CTPPSDigi/interface/TotemFEDInfo.h" #include "DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h" +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" #include "DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h" #include "DataFormats/CTPPSDigi/interface/CTPPSPixelDigiCollection.h" @@ -56,6 +57,14 @@ namespace DataFormats_CTPPSDigi { std::vector > vec_ds_rp_diamo_dig; edm::Wrapper > wds_rp_diamo_dig; edm::Wrapper > wdsv_rp_diamo_dig; + + TotemTimingDigi rm_totTiming_dig; + edm::DetSet ds_rp_totTiming_dig; + std::vector vec_rp_totTiming_dig; + edm::DetSetVector dsv_rp_totTiming_dig; + std::vector > vec_ds_rp_totTiming_dig; + edm::Wrapper > wds_rp_totTiming_dig; + edm::Wrapper > wdsv_rp_totTiming_dig; HPTDCErrorFlags rm_hptdcerr; CTPPSPixelDigi ff0; diff --git a/DataFormats/CTPPSDigi/src/classes_def.xml b/DataFormats/CTPPSDigi/src/classes_def.xml index 3bc5bfff38f6c..c39918dd19aed 100644 --- a/DataFormats/CTPPSDigi/src/classes_def.xml +++ b/DataFormats/CTPPSDigi/src/classes_def.xml @@ -8,7 +8,7 @@ - + @@ -28,7 +28,7 @@ - + @@ -38,7 +38,7 @@ - + @@ -46,10 +46,31 @@ + + + + + + + + + + + + + + + + + + + + + - + diff --git a/DataFormats/DetId/interface/DetId.h b/DataFormats/DetId/interface/DetId.h index 634dd4f3988f8..f5d731f2d2b31 100644 --- a/DataFormats/DetId/interface/DetId.h +++ b/DataFormats/DetId/interface/DetId.h @@ -22,7 +22,8 @@ class DetId { enum Detector {Tracker=1, Muon=2, Ecal=3, Hcal=4, Calo=5, Forward=6, - VeryForward=7, HGCalEE=8, HGCalHSi=9, HGCalHSc=10 }; + VeryForward=7, HGCalEE=8, HGCalHSi=9, HGCalHSc=10, + HGCalTrigger=11}; /// Create an empty or null id (also for persistence) DetId() : id_(0) { } /// Create an id from a raw number diff --git a/DataFormats/ForwardDetId/interface/ForwardSubdetector.h b/DataFormats/ForwardDetId/interface/ForwardSubdetector.h index ab17dcf0e0ed0..04678738bfe6a 100644 --- a/DataFormats/ForwardDetId/interface/ForwardSubdetector.h +++ b/DataFormats/ForwardDetId/interface/ForwardSubdetector.h @@ -3,5 +3,7 @@ enum ForwardSubdetector { ForwardEmpty=0, FastTime=1, BHM=2, HGCEE=3, HGCHEF=4, HGCHEB=5, HGCHET=6, HGCTrigger=7 }; +enum HGCalTriggerSubdetector { HGCalEmptyTrigger=0, HGCalEETrigger=1, + HGCalHSiTrigger=2, HGCalHScTrigger=3}; #endif diff --git a/DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h b/DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h index 4ae87b6db5bee..b9446260d48ff 100644 --- a/DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h +++ b/DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h @@ -9,9 +9,10 @@ [0:8] iphi index wrt x-axis on +z side [9:16] |ieta| index (starting from |etamin|) [17:21] Layer # - [22:22] z-side (0 for +z; 1 for -z) - [23:23] Type (0 fine divisions; 1 for coarse division) - [24:24] Reserved for future extension + [22:24] Reserved for future extension + [25:25] z-side (0 for +z; 1 for -z) + [26:27] Type (0 fine divisions of scintillators; + 1 coarse divisions of scintillators) [28:31] Detector type (HGCalHSc) */ @@ -34,7 +35,7 @@ class HGCScintillatorDetId : public DetId { HGCScintillatorDetId geometryCell () const {return HGCScintillatorDetId (type(), layer(), ieta(), 0);} /// get the subdetector - ForwardSubdetector subdet() const { return HGCHEB; } + DetId::Detector subdet() const { return det(); } /// get the type int type() const { return (id_>>kHGCalTypeOffset)&kHGCalTypeMask; } @@ -68,11 +69,10 @@ class HGCScintillatorDetId : public DetId { static const int kHGCalEtaMask = 0xFF; static const int kHGCalLayerOffset = 17; static const int kHGCalLayerMask = 0x1F; - static const int kHGCalZsideOffset = 22; + static const int kHGCalZsideOffset = 25; static const int kHGCalZsideMask = 0x1; - static const int kHGCalZsideMask2 = 0x400000; - static const int kHGCalTypeOffset = 23; - static const int kHGCalTypeMask = 0x1; + static const int kHGCalTypeOffset = 26; + static const int kHGCalTypeMask = 0x3; }; std::ostream& operator<<(std::ostream&,const HGCScintillatorDetId& id); diff --git a/DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h b/DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h new file mode 100644 index 0000000000000..5190ce6886055 --- /dev/null +++ b/DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h @@ -0,0 +1,114 @@ +#ifndef DataFormats_ForwardDetId_HGCalTriggerDetId_H +#define DataFormats_ForwardDetId_HGCalTriggerDetId_H 1 + +#include +#include +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" +#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" + +/* \brief description of the bit assigment + [0:4] u-coordinate of the cell (measured from the lower left + [5:9] v-coordinate of the cell corner of the wafer) + [10:13] abs(u) of the wafer (u-axis points along -x axis) + [14:14] sign of u (0:+u; 1:-u) (u=0 is at the center of beam line) + [15:18] abs(v) of the wafer (v-axis points 60-degree wrt x-axis) + [19:19] sign of v (0:+v; 1:-v) (v=0 is at the center of beam line) + [20:24] layer number + [25:25] z-side (0 for +z; 1 for -z) + [26:27] Type (0 fine divisions of wafer with 120 mum thick silicon + 1 coarse divisions of wafer with 200 mum thick silicon + 2 coarse divisions of wafer with 300 mum thick silicon) + [28:31] Detector type (HGCalEE or HGCalHSi) +*/ + +class HGCalTriggerDetId : public DetId { + +public: + + static const int HGCalTriggerCell =4; + + /** Create a null cellid*/ + HGCalTriggerDetId(); + /** Create cellid from raw id (0=invalid tower id) */ + HGCalTriggerDetId(uint32_t rawid); + /** Constructor from subdetector, zplus, layer, module, cell numbers */ + HGCalTriggerDetId(int subdet, int zp, int type, int layer, + int waferU, int waferV, int cellU, int cellV); + /** Constructor from a generic cell id */ + HGCalTriggerDetId(const DetId& id); + /** Assignment from a generic cell id */ + HGCalTriggerDetId& operator=(const DetId& id); + + /// get the subdetector + HGCalTriggerSubdetector subdet() const { + return (HGCalTriggerSubdetector)((id_>>kHGCalSubdetOffset)&kHGCalSubdetMask); } + + /// get the type + int type() const { return (id_>>kHGCalTypeOffset)&kHGCalTypeMask; } + + /// get the z-side of the cell (1/-1) + int zside() const { return (((id_>>kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); } + + /// get the layer # + int layer() const { return (id_>>kHGCalLayerOffset)&kHGCalLayerMask; } + + /// get the cell #'s in u,v or in x,y + int triggerCellU() const { return (id_>>kHGCalCellUOffset)&kHGCalCellUMask; } + int triggerCellV() const { return (id_>>kHGCalCellVOffset)&kHGCalCellVMask; } + std::pair triggerCellUV() const { + return std::pair(triggerCellU(),triggerCellV()); } + int triggerCellX() const; + int triggerCellY() const; + std::pair triggerCellXY() const { + return std::pair(triggerCellX(),triggerCellY()); } + + /// get the wafer #'s in u,v or in x,y + int waferUAbs() const { return (id_>>kHGCalWaferUOffset)&kHGCalWaferUMask; } + int waferVAbs() const { return (id_>>kHGCalWaferVOffset)&kHGCalWaferVMask; } + int waferU() const { return (((id_>>kHGCalWaferUSignOffset) & kHGCalWaferUSignMask) ? -waferUAbs() : waferUAbs()); } + int waferV() const { return (((id_>>kHGCalWaferVSignOffset) & kHGCalWaferVSignMask) ? -waferVAbs() : waferVAbs()); } + std::pair waferUV() const { return std::pair(waferU(),waferV()); } + int waferX() const { return (-2*waferU()+waferV()); } + int waferY() const { return (2*waferV()); } + std::pair waferXY() const { return std::pair(waferX(),waferY()); } + + // get trigger cell u,v + std::vector cellU() const; + std::vector cellV() const; + std::vector > cellUV() const; + + /// consistency check : no bits left => no overhead + bool isEE() const { return (subdet() == HGCalEETrigger); } + bool isHSilicon() const { return (subdet() == HGCalHSiTrigger); } + bool isForward() const { return true; } + + static const HGCalTriggerDetId Undefined; + + private: + + static const int kHGCalCellUOffset = 0; + static const int kHGCalCellUMask = 0xF; + static const int kHGCalCellVOffset = 4; + static const int kHGCalCellVMask = 0xF; + static const int kHGCalWaferUOffset = 8; + static const int kHGCalWaferUMask = 0xF; + static const int kHGCalWaferUSignOffset = 12; + static const int kHGCalWaferUSignMask = 0x1; + static const int kHGCalWaferVOffset = 13; + static const int kHGCalWaferVMask = 0xF; + static const int kHGCalWaferVSignOffset = 17; + static const int kHGCalWaferVSignMask = 0x1; + static const int kHGCalLayerOffset = 18; + static const int kHGCalLayerMask = 0x1F; + static const int kHGCalTypeOffset = 23; + static const int kHGCalTypeMask = 0x1; + static const int kHGCalZsideOffset = 27; + static const int kHGCalZsideMask = 0x1; + static const int kHGCalSubdetOffset = 25; + static const int kHGCalSubdetMask = 0x3; +}; + +std::ostream& operator<<(std::ostream&,const HGCalTriggerDetId& id); + +#endif diff --git a/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc b/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc index 329ca05671b11..52581071429c8 100644 --- a/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc +++ b/DataFormats/ForwardDetId/src/HGCScintillatorDetId.cc @@ -12,12 +12,15 @@ HGCScintillatorDetId::HGCScintillatorDetId(uint32_t rawid) : DetId(rawid) { } HGCScintillatorDetId::HGCScintillatorDetId(int type, int layer, int eta, - int phi) : DetId(HGCalHSc,HGCHEB) { - - id_ |= ((type&kHGCalTypeMask)<= 0) ? 0 : 1; int waferVsign = (waferV >= 0) ? 0 : 1; int zside = (zp < 0) ? 1 : 0; - id_ |= ((cellU & kHGCalCellUMask) << kHGCalCellUOffset); - id_ |= ((cellV & kHGCalCellVMask) << kHGCalCellVOffset); - id_ |= ((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset); - id_ |= ((waferUsign& kHGCalWaferUSignMask) << kHGCalWaferUSignOffset); - id_ |= ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset); - id_ |= ((waferVsign& kHGCalWaferVSignMask) << kHGCalWaferVSignOffset); - id_ |= ((layer & kHGCalLayerMask) << kHGCalLayerOffset); - id_ |= ((zside & kHGCalZsideMask) << kHGCalZsideOffset); - id_ |= ((type & kHGCalTypeMask) << kHGCalTypeOffset); + id_ |= (((cellU & kHGCalCellUMask) << kHGCalCellUOffset) | + ((cellV & kHGCalCellVMask) << kHGCalCellVOffset) | + ((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset) | + ((waferUsign& kHGCalWaferUSignMask) << kHGCalWaferUSignOffset) | + ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset) | + ((waferVsign& kHGCalWaferVSignMask) << kHGCalWaferVSignOffset) | + ((layer & kHGCalLayerMask) << kHGCalLayerOffset) | + ((zside & kHGCalZsideMask) << kHGCalZsideOffset) | + ((type & kHGCalTypeMask) << kHGCalTypeOffset)); } HGCSiliconDetId::HGCSiliconDetId(const DetId& gen) { diff --git a/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc b/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc new file mode 100644 index 0000000000000..f28bc7ab4fe8d --- /dev/null +++ b/DataFormats/ForwardDetId/src/HGCalTriggerDetId.cc @@ -0,0 +1,169 @@ +#include "DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h" +#include "FWCore/Utilities/interface/Exception.h" +#include +#include + +const HGCalTriggerDetId HGCalTriggerDetId::Undefined(HGCalEE,0,0,0,0,0,0,0); + +HGCalTriggerDetId::HGCalTriggerDetId() : DetId() { +} + +HGCalTriggerDetId::HGCalTriggerDetId(uint32_t rawid) : DetId(rawid) { +} + +HGCalTriggerDetId::HGCalTriggerDetId(int subdet, int zp, int type, int layer, + int waferU, int waferV, int cellU, + int cellV) : DetId(HGCalTrigger,ForwardEmpty) { + + int waferUabs(std::abs(waferU)), waferVabs(std::abs(waferV)); + int waferUsign = (waferU >= 0) ? 0 : 1; + int waferVsign = (waferV >= 0) ? 0 : 1; + int zside = (zp < 0) ? 1 : 0; + id_ |= (((cellU & kHGCalCellUMask) << kHGCalCellUOffset) | + ((cellV & kHGCalCellVMask) << kHGCalCellVOffset) | + ((waferUabs & kHGCalWaferUMask) << kHGCalWaferUOffset) | + ((waferUsign& kHGCalWaferUSignMask) << kHGCalWaferUSignOffset) | + ((waferVabs & kHGCalWaferVMask) << kHGCalWaferVOffset) | + ((waferVsign& kHGCalWaferVSignMask) << kHGCalWaferVSignOffset) | + ((layer & kHGCalLayerMask) << kHGCalLayerOffset) | + ((zside & kHGCalZsideMask) << kHGCalZsideOffset) | + ((type & kHGCalTypeMask) << kHGCalTypeOffset) | + ((subdet & kHGCalSubdetMask)<< kHGCalSubdetOffset)); +} + +HGCalTriggerDetId::HGCalTriggerDetId(const DetId& gen) { + if (!gen.null()) { + if ((gen.det()!=HGCalTrigger) || + (((gen.subdetId()&kHGCalSubdetMask)!=HGCalEETrigger) && + ((gen.subdetId()&kHGCalSubdetMask)!=HGCalHSiTrigger))) { + throw cms::Exception("Invalid DetId") << "Cannot initialize HGCalTriggerDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); +} + +HGCalTriggerDetId& HGCalTriggerDetId::operator=(const DetId& gen) { + if (!gen.null()) { + if ((gen.det()!=HGCalTrigger) || + (((gen.subdetId()&kHGCalSubdetMask)!=HGCalEETrigger) && + ((gen.subdetId()&kHGCalSubdetMask)!=HGCalHSiTrigger))) { + throw cms::Exception("Invalid DetId") << "Cannot assign HGCalTriggerDetId from " << std::hex << gen.rawId() << std::dec; + } + } + id_ = gen.rawId(); + return (*this); +} + +int HGCalTriggerDetId::triggerCellX() const { + int nT = (type() == HGCSiliconDetId::HGCalFine) ? + HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + int N = nT*HGCalTriggerCell; + std::vector vc = cellV(); + int x(0); + for (auto const & v : vc) { + x += (3*(v-N)+2); + } + return (x/vc.size()); +} + +int HGCalTriggerDetId::triggerCellY() const { + int nT = (type() == HGCSiliconDetId::HGCalFine) ? + HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + int N = nT*HGCalTriggerCell; + std::vector uc = cellU(); + std::vector vc = cellV(); + int y(0); + for (unsigned int k=0; k HGCalTriggerDetId::cellU() const { + std::vector uc; + int nT = (type() == HGCSiliconDetId::HGCalFine) ? + HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + if ((triggerCellU() >= HGCalTriggerCell) && + (triggerCellV() >= HGCalTriggerCell)) { + int u0 = nT*triggerCellU(); + for (int i=0; i HGCalTriggerDetId::cellV() const { + + std::vector vc; + int nT = (type() == HGCSiliconDetId::HGCalFine) ? + HGCSiliconDetId::HGCalFineTrigger : HGCSiliconDetId::HGCalCoarseTrigger; + if ((triggerCellU() >= HGCalTriggerCell) && + (triggerCellV() >= HGCalTriggerCell)) { + int v0 = nT*triggerCellV(); + for (int i=0; i > HGCalTriggerDetId::cellUV() const { + + std::vector uc = cellU(); + std::vector vc = cellV(); + std::vector > uv; + for (unsigned int k=0; k(uc[k],vc[k])); + } + return uv; +} + +std::ostream& operator<<(std::ostream& s,const HGCalTriggerDetId& id) { + return s << " EE:HSil= " << id.isEE() << ":" << id.isHSilicon() + << " type= " << id.type() << " z= " << id.zside() + << " layer= " << id.layer() + << " wafer(u,v:x,y)= (" << id.waferU() << "," << id.waferV() << ":" + << id.waferX() << "," << id.waferY() << ")" + << " triggerCell(u,v:x,y)= (" << id.triggerCellU() << "," + << id.triggerCellV() << ":" << id.triggerCellX() << "," + << id.triggerCellY() << ")"; +} + + diff --git a/DataFormats/ForwardDetId/src/classes.h b/DataFormats/ForwardDetId/src/classes.h index 21cf11bbcd429..38902bbe20825 100644 --- a/DataFormats/ForwardDetId/src/classes.h +++ b/DataFormats/ForwardDetId/src/classes.h @@ -2,6 +2,8 @@ #include "DataFormats/ForwardDetId/interface/HGCEEDetId.h" #include "DataFormats/ForwardDetId/interface/HGCHEDetId.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "DataFormats/ForwardDetId/interface/HGCTriggerDetId.h" #include "DataFormats/ForwardDetId/interface/FastTimeDetId.h" @@ -17,6 +19,10 @@ namespace DataFormats_ForwardDetId { //HGCal specific HGCalDetId anHGCalDetId; + //HGCal specific (new format) + HGCSiliconDetId anHGCSiliconDetid; + HGCScintillatorDetId anHGCScintillatorDetId; + //FastTimer specific FastTimeDetId anFastTimeDetId; }; diff --git a/DataFormats/ForwardDetId/src/classes_def.xml b/DataFormats/ForwardDetId/src/classes_def.xml index c50f6e562b075..e77f6ba13491a 100644 --- a/DataFormats/ForwardDetId/src/classes_def.xml +++ b/DataFormats/ForwardDetId/src/classes_def.xml @@ -14,6 +14,12 @@ + + + + + + diff --git a/DataFormats/ForwardDetId/test/testHGCDetId.cc b/DataFormats/ForwardDetId/test/testHGCDetId.cc index 38800e426144b..d4c81d46158eb 100644 --- a/DataFormats/ForwardDetId/test/testHGCDetId.cc +++ b/DataFormats/ForwardDetId/test/testHGCDetId.cc @@ -1,5 +1,6 @@ #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCalTriggerDetId.h" #include "DataFormats/DetId/interface/DetId.h" #include @@ -115,6 +116,42 @@ void testScint(int layer) { } } +void testTriggerCell(int type) { + + int N = (type == 0) ? + HGCSiliconDetId::HGCalFineN : HGCSiliconDetId::HGCalCoarseN; + const int waferu(0), waferv(0), layer(1), zside(1); + std::string error[2] = {"ERROR","OK"}; + int ntot(0), nerror(0); + for (int u=0; u<2*N; ++u) { + for (int v=0; v<2*N; ++v) { + if (((v-u) < N) && (u-v) <= N) { + HGCSiliconDetId id(DetId::HGCalEE,zside,type,layer,waferu,waferv,u,v); + std::cout << "ID " << std::hex << id.rawId() << std::dec << " " << id + << " Trigger: " << id.triggerCellU() << ":" + << id.triggerCellV() << std::endl; + HGCalTriggerDetId idt((int)(HGCalEETrigger),id.zside(),id.type(), + id.layer(),id.waferU(),id.waferV(), + id.triggerCellU(),id.triggerCellV()); + int ok(0); + std::vector > uvs = idt.cellUV(); + for (auto const& uv : uvs) { + HGCSiliconDetId idn(DetId::HGCalEE,idt.zside(),idt.type(), + idt.layer(),idt.waferU(),idt.waferV(), + uv.first,uv.second); + if (idn == id) {ok = 1; break;} + } + std::cout << "Trigger Cell: " << idt << " obtained from cell (" + << error[ok] << ")" << std::endl; + ++ntot; + if (ok == 0) ++nerror; + } + } + } + std::cout << "Total of " << ntot << " cells in type " << type << " with " + << nerror << " errors for trigger cells" << std::endl; +} + int main() { testCell(0); @@ -123,6 +160,8 @@ int main() { testWafer(28, 352.46, 1658.68); testScint(10); testScint(22); + testTriggerCell(0); + testTriggerCell(1); return 0; } diff --git a/DataFormats/GeometrySurface/interface/SOARotation.h b/DataFormats/GeometrySurface/interface/SOARotation.h new file mode 100644 index 0000000000000..1373a4091c5e5 --- /dev/null +++ b/DataFormats/GeometrySurface/interface/SOARotation.h @@ -0,0 +1,157 @@ +#ifndef DataFormats_GeometrySurface_SOARotation_h +#define DataFormats_GeometrySurface_SOARotation_h + +template class TkRotation; + +// to be moved in an external common library??? + +/** Rotation matrix used by SOA (as in GPU) + */ + +template +class SOARotation { +public: + + constexpr inline + SOARotation(){} + + constexpr inline + explicit SOARotation(T) : + R11(1), R12(0), R13(0), + R21(0), R22(1), R23(0), + R31(0), R32(0), R33(1) {} + + constexpr inline + SOARotation(T xx, T xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz) : + R11(xx), R12(xy), R13(xz), + R21(yx), R22(yy), R23(yz), + R31(zx), R32(zy), R33(zz) {} + + constexpr inline + SOARotation(const T* p) : + R11(p[0]), R12(p[1]), R13(p[2]), + R21(p[3]), R22(p[4]), R23(p[5]), + R31(p[6]), R32(p[7]), R33(p[8]) {} + + + template + constexpr inline + SOARotation(const TkRotation& a) : + R11(a.xx()), R12(a.xy()), R13(a.xz()), + R21(a.yx()), R22(a.yy()), R23(a.yz()), + R31(a.zx()), R32(a.zy()), R33(a.zz()) {} + + constexpr inline + SOARotation transposed() const { + return SOARotation(R11, R21, R31, + R12, R22, R32, + R13, R23, R33); + } + + // if frame this is to local + constexpr inline + void multiply(T const vx, T const vy, T const vz, + T & ux, T & uy, T & uz) const { + ux = R11*vx + R12*vy + R13*vz; + uy = R21*vx + R22*vy + R23*vz; + uz = R31*vx + R32*vy + R33*vz; + } + + // if frame this is to global + constexpr inline + void multiplyInverse (T const vx, T const vy, T const vz, + T & ux, T & uy, T & uz) const { + ux = R11*vx + R21*vy + R31*vz; + uy = R12*vx + R22*vy + R32*vz; + uz = R13*vx + R23*vy + R33*vz; + } + + + // if frame this is to global + constexpr inline + void multiplyInverse (T const vx, T const vy, + T & ux, T & uy, T & uz) const { + ux = R11*vx + R21*vy; + uy = R12*vx + R22*vy; + uz = R13*vx + R23*vy; + } + + + constexpr inline + T const &xx() const { return R11; } + constexpr inline + T const &xy() const { return R12; } + constexpr inline + T const &xz() const { return R13; } + constexpr inline + T const &yx() const { return R21; } + constexpr inline + T const &yy() const { return R22; } + constexpr inline + T const &yz() const { return R23; } + constexpr inline + T const &zx() const { return R31; } + constexpr inline + T const &zy() const { return R32; } + constexpr inline + T const &zz() const { return R33; } + +private: + + T R11, R12, R13; + T R21, R22, R23; + T R31, R32, R33; +}; + + +template +class SOAFrame { +public: + + constexpr inline + SOAFrame(){} + + constexpr inline + SOAFrame(T ix, T iy, T iz, SOARotation const & irot) : + px(ix), py(iy), pz(iz), rot(irot){} + + constexpr inline + SOARotation const & rotation() const { return rot; } + + constexpr inline + void toLocal(T const vx, T const vy, T const vz, + T & ux, T & uy, T & uz) const { + rot.multiply(vx-px, vy-py, vz-pz, ux, uy, uz); + } + + + constexpr inline + void toGlobal(T const vx, T const vy, T const vz, + T & ux, T & uy, T & uz) const { + rot.multiplyInverse(vx, vy, vz, ux, uy, uz); + ux+=px; uy+=py; uz+=pz; + } + + constexpr inline + void toGlobal(T const vx, T const vy, + T & ux, T & uy, T & uz) const { + rot.multiplyInverse(vx, vy, ux, uy, uz); + ux+=px; uy+=py; uz+=pz; + } + + + constexpr inline + T x() const { return px; } + constexpr inline + T y() const { return py; } + constexpr inline + T z() const { return pz; } + +private: + + T px, py, pz; + SOARotation rot; + +}; + +#endif // DataFormats_GeometrySurface_SOARotation_h diff --git a/DataFormats/GeometrySurface/test/BuildFile.xml b/DataFormats/GeometrySurface/test/BuildFile.xml index c02a36305923e..ed732f292ebf1 100644 --- a/DataFormats/GeometrySurface/test/BuildFile.xml +++ b/DataFormats/GeometrySurface/test/BuildFile.xml @@ -1,16 +1,16 @@ - - - - + + + + + - + - - + - + - + - + diff --git a/DataFormats/GeometrySurface/test/FrameTransformTest.cpp b/DataFormats/GeometrySurface/test/FrameTransformTest.cpp index d95ffdd4a2897..690336af16429 100644 --- a/DataFormats/GeometrySurface/test/FrameTransformTest.cpp +++ b/DataFormats/GeometrySurface/test/FrameTransformTest.cpp @@ -1,56 +1,52 @@ +#include #include + +#include "DataFormats/GeometrySurface/interface/SOARotation.h" #include "DataFormats/GeometrySurface/interface/TkRotation.h" #include "DataFormats/GeometrySurface/interface/GloballyPositioned.h" #include "DataFormats/GeometrySurface/interface/BoundPlane.h" -//#include "CommonReco/RKPropagators/interface/FrameChanger.h" #include "DataFormats/GeometrySurface/interface/Cylinder.h" -#include - using namespace std; + template -void go() { +void go() { typedef TkRotation Rotation; + typedef SOARotation SRotation; typedef GloballyPositioned Frame; - typedef typename Frame::PositionType Position; - typedef typename Frame::GlobalVector GlobalVector; - typedef typename Frame::GlobalPoint GlobalPoint; - typedef typename Frame::LocalVector LocalVector; - typedef typename Frame::LocalPoint LocalPoint; - - std::cout << "size of Rot " << sizeof(Rotation) << std::endl; - std::cout << "size of Pos " << sizeof(Position) << std::endl; - std::cout << "size of Point " << sizeof(GlobalPoint) << std::endl; - std::cout << "size of Frame " << sizeof(Frame) << std::endl; + typedef SOAFrame SFrame; + typedef typename Frame::PositionType Position; + typedef typename Frame::GlobalVector GlobalVector; + typedef typename Frame::GlobalPoint GlobalPoint; + typedef typename Frame::LocalVector LocalVector; + typedef typename Frame::LocalPoint LocalPoint; + + std::cout << "size of Rot " << sizeof(Rotation) << std::endl; + std::cout << "size of Pos " << sizeof(Position) << std::endl; + std::cout << "size of Point " << sizeof(GlobalPoint) << std::endl; + std::cout << "size of Frame " << sizeof(Frame) << std::endl; + std::cout << "size of soa Rot " << sizeof(SRotation) << std::endl; + std::cout << "size of soa Frame " << sizeof(SFrame) << std::endl; double a = 0.01; double ca = cos(a); double sa = sin(a); Rotation r1(ca, sa, 0, - -sa, ca, 0, - 0, 0, 1);; - Frame f1(Position(2,3,4), r1); + -sa, ca, 0, + 0, 0, 1);; + Frame f1(Position(2, 3, 4), r1); cout << "f1.position() " << f1.position() << endl; cout << "f1.rotation() " << endl << f1.rotation() << endl; - Rotation r2( GlobalVector( 0, 1 ,0), GlobalVector( 0, 0, 1)); - Frame f2(Position(5,6,7), r2); + Rotation r2( GlobalVector( 0, 1 , 0), GlobalVector( 0, 0, 1)); + Frame f2(Position(5, 6, 7), r2); cout << "f2.position() " << f2.position() << endl; cout << "f2.rotation() " << endl << f2.rotation() << endl; - // transform f2 to f1 so that f1 becomes the "global" frame of f3 - // Rotation r3 = r2.multiplyInverse(r1); - // Rotation r3 = r2*r1; - - // Rotation r3 = r1*r2; - // Rotation r3 = r1*r2.transposed(); - // Rotation r3 = r1.transposed()*r2; - // Rotation r3 = r1.transposed()*r2.transposed(); - // Rotation r3 = r2*r1; Rotation r3 = r2*r1.transposed(); - + SRotation sr3(r3); GlobalPoint pos2(f2.position()); LocalPoint lp3 = f1.toLocal(pos2); @@ -58,8 +54,20 @@ void go() { cout << "f3.position() " << f3.position() << endl; cout << "f3.rotation() " << endl << f3.rotation() << endl; -// test - GlobalPoint gp( 11,22,33); + SFrame sf1(f1.position().x(), + f1.position().y(), + f1.position().z(), + f1.rotation() + ); + + SFrame sf3(f3.position().x(), + f3.position().y(), + f3.position().z(), + sr3 + ); + + // test + GlobalPoint gp(11, 22, 33); LocalPoint p_in1 = f1.toLocal( gp); typename Frame::ToLocal ff1(f1); LocalPoint p_in2 = f2.toLocal( gp); @@ -69,25 +77,19 @@ void go() { cout << "p_in2 " << p_in2 << endl; cout << "p_in3 " << p_in3 << endl; - LocalPoint p_in1_from3( f3.toGlobal(p_in3).basicVector()); - cout << "p_in1_from3 + " << p_in1_from3 << endl; - - BoundPlane plane(f2.position(), f2.rotation()); - -// FrameChanger changer; -// FrameChanger::PlanePtr pp = changer.toFrame( plane, f1); - -/* - FrameChanger changer; - FrameChanger::PlanePtr pp = changer.transformPlane( plane, f1); - - LocalPoint p_in2p = plane.toLocal( gp); - LocalPoint p_in3p = pp->toLocal( GlobalPoint(p_in1.basicVector())); - cout << "p_in2p " << p_in2p << endl; - cout << "p_in3p " << p_in3p << endl; -*/ - - + LocalPoint p_in1_from3(f3.toGlobal(p_in3).basicVector()); + cout << "p_in1_from3 " << p_in1_from3 << endl; + + T xx, yy, zz; + sf1.toLocal(gp.x(), gp.y(), gp.z(), + xx, yy, zz); + cout << "p_in1 soa " << xx<<','<( 1, 1, 1), .3); - Cylinder cyl(5.f, Position(2,-1,3), ll); - Plane t = cyl.fastTangent(LocalPoint(3.,4.,1.)); + Cylinder cyl(5.f, Position(2,-1, 3), ll); + Plane t = cyl.fastTangent(LocalPoint(3., 4., 1.)); std::cout << t.position() << '\n' << t.rotation() << std::endl; std::cout << t.rotation().x()*cyl.rotation().z().cross( (t.position()-cyl.position()).basicVector() ).unit() << std::endl; } - + } int main() { - + go(); cyl(); std::cout << std::endl; diff --git a/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc b/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc index 313fc93e1c588..ee9ba468ab802 100644 --- a/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc +++ b/DataFormats/L1TGlobal/src/GlobalAlgBlk.cc @@ -161,16 +161,39 @@ void GlobalAlgBlk::reset() // compare the content of this GlobalAlgBlk with another one bool GlobalAlgBlk::operator==(const GlobalAlgBlk& rhs) const { - return m_orbitNr == rhs.getL1MenuUUID() + // Not all variables can be compared since the prescale counters are + // generally not the same when producing the collections and so the + // prescaled algo decisions do not match. + bool eq = m_orbitNr == rhs.getL1MenuUUID() && m_bxNr == rhs.getL1FirmwareUUID() && m_bxInEvent == rhs.getbxInEventNr() - && m_finalOR == rhs.getFinalOR() - && m_finalORPreVeto == rhs.getFinalORPreVeto() - && m_finalORVeto == rhs.getFinalORVeto() - && m_preScColumn == rhs.getPreScColumn() + //&& m_finalOR == rhs.getFinalOR() + //&& m_finalORPreVeto == rhs.getFinalORPreVeto() + //&& m_finalORVeto == rhs.getFinalORVeto() + //&& m_preScColumn == rhs.getPreScColumn() && m_algoDecisionInitial == rhs.getAlgoDecisionInitial() - && m_algoDecisionPreScaled == rhs.getAlgoDecisionInterm() - && m_algoDecisionFinal == rhs.getAlgoDecisionFinal(); + //&& m_algoDecisionPreScaled == rhs.getAlgoDecisionInterm() + //&& m_algoDecisionFinal == rhs.getAlgoDecisionFinal() + ; + + //if (not eq) { + // std::cout << "m_orbitNr: " << m_orbitNr << " : " << rhs.getL1MenuUUID() << std::endl + // << "m_bxNr: " << m_bxNr << " : " << rhs.getL1FirmwareUUID() << std::endl + // << "m_bxInEvent: " << m_bxInEvent << " : " << rhs.getbxInEventNr() << std::endl + // << "m_finalOR: " << m_finalOR << " : " << rhs.getFinalOR() << std::endl + // << "m_finalORPreVeto: " << m_finalORPreVeto << " : " << rhs.getFinalORPreVeto() << std::endl + // << "m_finalORVeto: " << m_finalORVeto << " : " << rhs.getFinalORVeto() << std::endl + // << "m_preScColumn: " << m_preScColumn << " : " << rhs.getPreScColumn() << std::endl + // << std::endl; + // std::cout << "algoDecisions" << std::endl; + // for (size_t i = 0; i < m_algoDecisionInitial.size(); ++i) { + // std::cout << "bit " << i << ": " << m_algoDecisionInitial.at(i) << " : " << rhs.getAlgoDecisionInitial(i) + // << " " << m_algoDecisionPreScaled.at(i) << " : " << rhs.getAlgoDecisionInterm(i) + // << " " << m_algoDecisionFinal.at(i) << " : " << rhs.getAlgoDecisionFinal(i) << std::endl; + // } + //} + + return eq; } // pretty print the content of a GlobalAlgBlk diff --git a/DataFormats/L1THGCal/interface/HGCalClusterT.h b/DataFormats/L1THGCal/interface/HGCalClusterT.h index 4908be1041691..b740216b89cbc 100644 --- a/DataFormats/L1THGCal/interface/HGCalClusterT.h +++ b/DataFormats/L1THGCal/interface/HGCalClusterT.h @@ -120,18 +120,20 @@ namespace l1t double pt_had = 0.; double hOe = 0.; - for(const auto& constituent : constituents()) + for(const auto& id_constituent : constituents()) { - switch( constituent->subdetId() ) + auto id_fraction = constituentsFraction_.find(id_constituent.first); + double fraction = (id_fraction!=constituentsFraction_.end() ? id_fraction->second : 1.); + switch( id_constituent.second->subdetId() ) { case HGCEE: - pt_em += constituent->pt(); + pt_em += id_constituent.second->pt() * fraction; break; case HGCHEF: - pt_had += constituent->pt(); + pt_had += id_constituent.second->pt() * fraction; break; case HGCHEB: - pt_had += constituent->pt(); + pt_had += id_constituent.second->pt() * fraction; break; default: break; diff --git a/DataFormats/L1TMuon/interface/EMTFHit.h b/DataFormats/L1TMuon/interface/EMTFHit.h index 3bb8bc046eeb7..0fb81b40b42a0 100644 --- a/DataFormats/L1TMuon/interface/EMTFHit.h +++ b/DataFormats/L1TMuon/interface/EMTFHit.h @@ -11,9 +11,11 @@ #include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "DataFormats/MuonDetId/interface/RPCDetId.h" #include "DataFormats/MuonDetId/interface/GEMDetId.h" +#include "DataFormats/MuonDetId/interface/ME0DetId.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" #include "DataFormats/RPCDigi/interface/RPCDigi.h" #include "DataFormats/GEMDigi/interface/GEMPadDigi.h" +#include "DataFormats/GEMDigi/interface/ME0PadDigi.h" #include "DataFormats/L1TMuon/interface/EMTF/ME.h" namespace l1t { @@ -22,15 +24,16 @@ namespace l1t { public: EMTFHit() : - endcap(-99), station(-99), ring(-99), sector(-99), sector_RPC(-99), sector_idx(-99), - subsector(-99), subsector_RPC(-99), chamber(-99), csc_ID(-99), csc_nID(-99), roll(-99), + rawDetId(0), + endcap(-99), station(-99), ring(-99), sector(-99), sector_RPC(-99), sector_idx(-99), + subsector(-99), subsector_RPC(-99), chamber(-99), csc_ID(-99), csc_nID(-99), roll(-99), neighbor(-99), mpc_link(-99), pc_sector(-99), pc_station(-99), pc_chamber(-99), pc_segment(-99), wire(-99), strip(-99), strip_hi(-99), strip_low(-99), track_num(-99), quality(-99), pattern(-99), bend(-99), valid(-99), sync_err(-99), bc0(-99), bx(-99), stub_num(-99), phi_fp(-99), theta_fp(-99), phzvl(-99), ph_hit(-99), zone_hit(-99), zone_code(-99), fs_segment(-99), fs_zone_code(-99), bt_station(-99), bt_segment(-99), - phi_loc(-99), phi_glob(-999), theta(-99), eta(-99), - phi_sim(-999), theta_sim(-99), eta_sim(-99), + phi_loc(-99), phi_glob(-999), theta(-99), eta(-99), time(-99), + phi_sim(-999), theta_sim(-99), eta_sim(-99), rho_sim(-99), z_sim(-99), is_CSC(-99), is_RPC(-99), is_GEM(-99), subsystem(-99) {}; @@ -52,19 +55,27 @@ namespace l1t { // void PrintSimulatorHeader() const; // void PrintForSimulator() const; - void SetCSCDetId (const CSCDetId& id) { csc_DetId = id; } - void SetRPCDetId (const RPCDetId& id) { rpc_DetId = id; } - void SetGEMDetId (const GEMDetId& id) { gem_DetId = id; } - void SetCSCLCTDigi (const CSCCorrelatedLCTDigi& digi) { csc_LCTDigi = digi; } - void SetRPCDigi (const RPCDigi& digi) { rpc_Digi = digi; } - void SetGEMPadDigi (const GEMPadDigi& digi) { gem_PadDigi = digi; } + //void SetCSCDetId (const CSCDetId& id) { csc_DetId = id; } + //void SetRPCDetId (const RPCDetId& id) { rpc_DetId = id; } + //void SetGEMDetId (const GEMDetId& id) { gem_DetId = id; } + //void SetCSCLCTDigi (const CSCCorrelatedLCTDigi& digi) { csc_LCTDigi = digi; } + //void SetRPCDigi (const RPCDigi& digi) { rpc_Digi = digi; } + //void SetGEMPadDigi (const GEMPadDigi& digi) { gem_PadDigi = digi; } + void SetCSCDetId (const CSCDetId& id) { rawDetId = id.rawId(); } + void SetRPCDetId (const RPCDetId& id) { rawDetId = id.rawId(); } + void SetGEMDetId (const GEMDetId& id) { rawDetId = id.rawId(); } + void SetME0DetId (const ME0DetId& id) { rawDetId = id.rawId(); } - CSCDetId CSC_DetId () const { return csc_DetId; } - RPCDetId RPC_DetId () const { return rpc_DetId; } - GEMDetId GEM_DetId () const { return gem_DetId; } - CSCCorrelatedLCTDigi CSC_LCTDigi () const { return csc_LCTDigi; } - RPCDigi RPC_Digi () const { return rpc_Digi; } - GEMPadDigi GEM_PadDigi () const { return gem_PadDigi; } + //CSCDetId CSC_DetId () const { return csc_DetId; } + //RPCDetId RPC_DetId () const { return rpc_DetId; } + //GEMDetId GEM_DetId () const { return gem_DetId; } + //CSCCorrelatedLCTDigi CSC_LCTDigi () const { return csc_LCTDigi; } + //RPCDigi RPC_Digi () const { return rpc_Digi; } + //GEMPadDigi GEM_PadDigi () const { return gem_PadDigi; } + CSCDetId CSC_DetId () const { return CSCDetId(rawDetId); } + RPCDetId RPC_DetId () const { return RPCDetId(rawDetId); } + GEMDetId GEM_DetId () const { return GEMDetId(rawDetId); } + ME0DetId ME0_DetId () const { return ME0DetId(rawDetId); } void set_endcap (int bits) { endcap = bits; } void set_station (int bits) { station = bits; } @@ -111,9 +122,12 @@ namespace l1t { void set_phi_glob (float val) { phi_glob = val; } void set_theta (float val) { theta = val; } void set_eta (float val) { eta = val; } + void set_time (float val) { time = val; } void set_phi_sim (float val) { phi_sim = val; } void set_theta_sim (float val) { theta_sim = val; } void set_eta_sim (float val) { eta_sim = val; } + void set_rho_sim (float val) { rho_sim = val; } + void set_z_sim (float val) { z_sim = val; } void set_is_CSC (int bits) { is_CSC = bits; } void set_is_RPC (int bits) { is_RPC = bits; } void set_is_GEM (int bits) { is_GEM = bits; } @@ -164,9 +178,12 @@ namespace l1t { float Phi_glob () const { return phi_glob ; } float Theta () const { return theta ; } float Eta () const { return eta ; } + float Time () const { return time ; } float Phi_sim () const { return phi_sim ; } float Theta_sim () const { return theta_sim ; } float Eta_sim () const { return eta_sim ; } + float Rho_sim () const { return rho_sim ; } + float Z_sim () const { return z_sim ; } int Is_CSC () const { return is_CSC ; } int Is_RPC () const { return is_RPC ; } int Is_GEM () const { return is_GEM ; } @@ -175,12 +192,14 @@ namespace l1t { private: - CSCDetId csc_DetId; - RPCDetId rpc_DetId; - GEMDetId gem_DetId; - CSCCorrelatedLCTDigi csc_LCTDigi; - RPCDigi rpc_Digi; - GEMPadDigi gem_PadDigi; + //CSCDetId csc_DetId; + //RPCDetId rpc_DetId; + //GEMDetId gem_DetId; + //CSCCorrelatedLCTDigi csc_LCTDigi; + //RPCDigi rpc_Digi; + //GEMPadDigi gem_PadDigi; + + uint32_t rawDetId; // raw CMSSW DetId int endcap ; // +/-1. For ME+ and ME-. int station ; // 1 - 4. @@ -227,9 +246,12 @@ namespace l1t { float phi_glob ; // +/-180. float theta ; // 0 - 90. float eta ; // +/-2.5. + float time ; // ? - ?. RPC time information float phi_sim ; // +/-180. float theta_sim ; // 0 - 90. float eta_sim ; // +/-2.5. + float rho_sim ; // ? - ?. + float z_sim ; // ? - ?. int is_CSC ; // 0 or 1. int is_RPC ; // 0 or 1. int is_GEM ; // 0 or 1. diff --git a/DataFormats/L1TMuon/interface/EMTFTrack.h b/DataFormats/L1TMuon/interface/EMTFTrack.h index 058fad7e73a97..9da4af04fd172 100644 --- a/DataFormats/L1TMuon/interface/EMTFTrack.h +++ b/DataFormats/L1TMuon/interface/EMTFTrack.h @@ -6,14 +6,13 @@ #include #include -#include #include "DataFormats/L1TMuon/interface/EMTFHit.h" #include "DataFormats/L1TMuon/interface/EMTFRoad.h" #include "DataFormats/L1TMuon/interface/EMTF/SP.h" namespace l1t { - + struct EMTFPtLUT { uint64_t address; uint16_t mode; @@ -31,47 +30,52 @@ namespace l1t { uint16_t bt_ci [5]; // ^ uint16_t bt_si [5]; // ^ }; - - + + class EMTFTrack { public: - - EMTFTrack() : - _PtLUT(), endcap(-99), sector(-99), sector_idx(-99), + + EMTFTrack() : + _PtLUT(), endcap(-99), sector(-99), sector_idx(-99), mode(-99), mode_CSC(0), mode_RPC(0), mode_neighbor(0), mode_inv(-99), rank(-99), winner(-99), charge(-99), bx(-99), first_bx(-99), second_bx(-99), pt(-99), pt_XML(-99), zone(-99), ph_num(-99), ph_q(-99), theta_fp(-99), theta(-99), eta(-99), phi_fp(-99), phi_loc(-99), phi_glob(-999), gmt_pt(-99), gmt_phi(-999), gmt_eta(-999), gmt_quality(-99), gmt_charge(-99), gmt_charge_valid(-99), - track_num(-99), numHits(-99) + track_num(-99), numHits(-99) {}; - + virtual ~EMTFTrack() {}; - + void ImportSP( const emtf::SP _SP, int _sector ); // void ImportPtLUT( int _mode, unsigned long _address ); - - void clear_Hits() { - _Hits.clear(); numHits = 0; - mode_CSC = 0; mode_RPC = 0; mode_neighbor = 0; + + void clear_Hits() { + _Hits.clear(); + numHits = 0; + mode_CSC = 0; + mode_RPC = 0; + mode_neighbor = 0; } + void push_Hit(const EMTFHit& hit) { - _Hits.push_back( hit ); - numHits = _Hits.size(); - mode_CSC += ( hit.Is_CSC() ? pow(2, 4 - hit.Station()) : 0 ); - mode_RPC += ( hit.Is_RPC() ? pow(2, 4 - hit.Station()) : 0 ); - mode_neighbor += ( hit.Neighbor() ? pow(2, 4 - hit.Station()) : 0 ); + _Hits.push_back( hit ); + numHits = _Hits.size(); + if (hit.Is_CSC()) mode_CSC |= (1 << (4 - hit.Station())); + if (hit.Is_RPC()) mode_RPC |= (1 << (4 - hit.Station())); + if (hit.Neighbor()) mode_neighbor |= (1 << (4 - hit.Station())); } + void set_Hits(const EMTFHitCollection& hits) { clear_Hits(); for (const auto& hit : hits) - push_Hit( hit ); + push_Hit( hit ); } - void set_HitIdx(const std::vector& bits) { _HitIdx = bits; } void clear_HitIdx() { _HitIdx.clear(); } void push_HitIdx(unsigned int bits) { _HitIdx.push_back(bits); } + void set_HitIdx(const std::vector& bits) { _HitIdx = bits; } int NumHits () const { return numHits; } EMTFHitCollection Hits () const { return _Hits; } diff --git a/DataFormats/L1TMuon/src/EMTFHit.cc b/DataFormats/L1TMuon/src/EMTFHit.cc index cbefb8507a09c..96794539cfcfe 100644 --- a/DataFormats/L1TMuon/src/EMTFHit.cc +++ b/DataFormats/L1TMuon/src/EMTFHit.cc @@ -5,11 +5,11 @@ namespace l1t { CSCDetId EMTFHit::CreateCSCDetId() const { return CSCDetId( (endcap == 1) ? 1 : 2, station, - (ring == 4) ? 1 : ring, chamber, 0 ); + (ring == 4) ? 1 : ring, chamber, 0 ); // Layer always filled as 0 (indicates "whole chamber") // See http://cmslxr.fnal.gov/source/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc#0198 } - + // // Not yet implemented - AWB 15.03.17 // RPCDetId EMTFHit::CreateRPCDetId() const { // return RPCDetId( endcap, ring, station, sector, rpc_layer, subsector, roll ); @@ -23,10 +23,10 @@ namespace l1t { // May consider filling "trknmb" with 2 for 2nd LCT in the same chamber. - AWB 24.05.17 // trknmb and bx0 are unused in the EMTF emulator code. mpclink = 0 (after bx) indicates unsorted. } - + // // Not yet implemented - AWB 15.03.17 // RPCDigi EMTFHit::CreateRPCDigi() const { // return RPCDigi( (strip_hi + strip_lo) / 2, bx + CSCConstants::LCT_CENTRAL_BX ); // } - + } // End namespace l1t diff --git a/DataFormats/Luminosity/src/BeamCurrentInfo.cc b/DataFormats/Luminosity/src/BeamCurrentInfo.cc index 9c7936b45996b..966b654325c72 100644 --- a/DataFormats/Luminosity/src/BeamCurrentInfo.cc +++ b/DataFormats/Luminosity/src/BeamCurrentInfo.cc @@ -1,5 +1,5 @@ #include "DataFormats/Luminosity/interface/BeamCurrentInfo.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include #include diff --git a/DataFormats/PatCandidates/interface/liblogintpack.h b/DataFormats/Math/interface/liblogintpack.h similarity index 100% rename from DataFormats/PatCandidates/interface/liblogintpack.h rename to DataFormats/Math/interface/liblogintpack.h diff --git a/DataFormats/PatCandidates/interface/libminifloat.h b/DataFormats/Math/interface/libminifloat.h similarity index 100% rename from DataFormats/PatCandidates/interface/libminifloat.h rename to DataFormats/Math/interface/libminifloat.h diff --git a/DataFormats/PatCandidates/src/libminifloat.cc b/DataFormats/Math/src/libminifloat.cc similarity index 97% rename from DataFormats/PatCandidates/src/libminifloat.cc rename to DataFormats/Math/src/libminifloat.cc index c8078232d189a..3d2dc5904c613 100644 --- a/DataFormats/PatCandidates/src/libminifloat.cc +++ b/DataFormats/Math/src/libminifloat.cc @@ -1,4 +1,4 @@ -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" namespace { MiniFloatConverter dummy; // so the constructor is called diff --git a/DataFormats/Math/test/BuildFile.xml b/DataFormats/Math/test/BuildFile.xml index 32ac3a3074890..0fea2a9418c49 100644 --- a/DataFormats/Math/test/BuildFile.xml +++ b/DataFormats/Math/test/BuildFile.xml @@ -65,3 +65,7 @@ + + + + diff --git a/DataFormats/PatCandidates/test/testMiniFloat.cpp b/DataFormats/Math/test/testMiniFloat.cpp similarity index 98% rename from DataFormats/PatCandidates/test/testMiniFloat.cpp rename to DataFormats/Math/test/testMiniFloat.cpp index ddff36646a9d3..297f21bbef3ff 100644 --- a/DataFormats/PatCandidates/test/testMiniFloat.cpp +++ b/DataFormats/Math/test/testMiniFloat.cpp @@ -1,7 +1,7 @@ #include #include -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "FWCore/Utilities/interface/isFinite.h" class testMiniFloat : public CppUnit::TestFixture { diff --git a/DataFormats/Math/test/testRunner.cpp b/DataFormats/Math/test/testRunner.cpp new file mode 100644 index 0000000000000..afea4e798f6d9 --- /dev/null +++ b/DataFormats/Math/test/testRunner.cpp @@ -0,0 +1 @@ +#include "Utilities/Testing/interface/CppUnit_testdriver.icpp" diff --git a/DataFormats/Math/test/testlogintpack.cpp b/DataFormats/Math/test/testlogintpack.cpp new file mode 100644 index 0000000000000..d12783f6cfce5 --- /dev/null +++ b/DataFormats/Math/test/testlogintpack.cpp @@ -0,0 +1,195 @@ +#include +#include +#include +#include + +#include "DataFormats/Math/interface/liblogintpack.h" + +class testlogintpack : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(testlogintpack); + + CPPUNIT_TEST(test16base11); + CPPUNIT_TEST(test8); + + CPPUNIT_TEST_SUITE_END(); +public: + void setUp() {} + void tearDown() {} + + void test16base11(); + void test8(); + +private: +}; + +namespace { + int16_t pack16base11(double x) { return logintpack::pack16log (x, -15, 0, 1<<11); } + int16_t pack16base11ceil(double x) { return logintpack::pack16logCeil (x, -15, 0, 1<<11); } + int16_t pack16base11closed(double x) { return logintpack::pack16logClosed (x, -15, 0, 1<<11); } + double unpack16base11(int16_t x) { return logintpack::unpack16log (x, -15, 0, 1<<11); } + double unpack16base11closed(int16_t x) { return logintpack::unpack16logClosed(x, -15, 0, 1<<11); } + + int8_t pack(double x) { return logintpack::pack8log (x, -15, 0); } + int8_t packceil(double x) { return logintpack::pack8logCeil (x, -15, 0); } + int8_t packclosed(double x) { return logintpack::pack8log (x, -15, 0); } + double unpack(int8_t x) { return logintpack::unpack8log (x, -15, 0); } + double unpackclosed(int8_t x) { return logintpack::unpack8logClosed(x, -15, 0); } +} + +void testlogintpack::test16base11() { + constexpr uint16_t base = 1<<11; // 2^11 = 2048 + + constexpr int16_t smallestPositive = 0; + constexpr int16_t smallestNegative = -1; + constexpr int16_t largestPositive = base-1; + constexpr int16_t largestNegative = -largestPositive; + + union { float flt; uint32_t i32; } conv32; + union { double flt; uint64_t i64; } conv64; + + const double smallestValuePos = std::exp(-15.); + const double smallestValueNeg = -std::exp(-15. + 1./base*15.); + const double smallestValueNegForClosed = -std::exp(-15. + 1./(base-1)*15.); + CPPUNIT_ASSERT(pack16base11(smallestValuePos) == smallestPositive); + CPPUNIT_ASSERT(pack16base11ceil(smallestValuePos) == smallestPositive); + CPPUNIT_ASSERT(pack16base11closed(smallestValuePos) == smallestPositive); + CPPUNIT_ASSERT(unpack16base11(smallestPositive) == smallestValuePos); + CPPUNIT_ASSERT(unpack16base11closed(smallestPositive) == smallestValuePos); + + CPPUNIT_ASSERT(pack16base11(smallestValueNeg) == smallestNegative); + CPPUNIT_ASSERT(pack16base11ceil(smallestValueNeg) == smallestNegative); + CPPUNIT_ASSERT(unpack16base11(smallestNegative) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11(pack16base11(smallestValueNeg)) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11(pack16base11ceil(smallestValueNeg)) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11closed(pack16base11closed(smallestValueNegForClosed)) == smallestValueNegForClosed); + + CPPUNIT_ASSERT(pack16base11(smallestValuePos-std::exp(-16.)) == smallestPositive); + CPPUNIT_ASSERT(pack16base11ceil(smallestValuePos-std::exp(-16.)) == smallestPositive); + CPPUNIT_ASSERT(pack16base11closed(smallestValuePos-std::exp(-16.)) == smallestPositive); + conv64.flt = smallestValuePos; + conv64.i64 -= 1; + const double smallestValuePosMinus1Ulp64 = conv64.flt; + CPPUNIT_ASSERT(pack16base11(smallestValuePosMinus1Ulp64) == smallestPositive); + CPPUNIT_ASSERT(pack16base11ceil(smallestValuePosMinus1Ulp64) == smallestPositive); + CPPUNIT_ASSERT(pack16base11closed(smallestValuePosMinus1Ulp64) == smallestPositive); + + CPPUNIT_ASSERT(pack16base11(smallestValueNeg+std::exp(-16.)) == smallestNegative); + CPPUNIT_ASSERT(pack16base11ceil(smallestValueNeg+std::exp(-16.)) == smallestNegative); + CPPUNIT_ASSERT(unpack16base11(pack16base11(smallestValueNeg+std::exp(-16.))) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11(pack16base11ceil(smallestValueNeg+std::exp(-16.))) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11closed(pack16base11closed(smallestValueNegForClosed+std::exp(-16.))) == smallestValueNegForClosed); + conv64.flt = smallestValueNeg; + conv64.i64 += 1; + const double smallestValueNegPlusUlp64 = conv64.flt; + CPPUNIT_ASSERT(pack16base11(smallestValueNegPlusUlp64) == smallestNegative); + CPPUNIT_ASSERT(pack16base11ceil(smallestValueNegPlusUlp64) == smallestNegative); + CPPUNIT_ASSERT(unpack16base11(pack16base11(smallestValueNegPlusUlp64)) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11(pack16base11ceil(smallestValueNegPlusUlp64)) == smallestValueNeg); + CPPUNIT_ASSERT(unpack16base11closed(pack16base11closed(smallestValueNegPlusUlp64)) == smallestValueNegForClosed); + + + const double largestValuePos = std::exp(-15. + double(base-1)/base * 15.); + const double largestValueNeg = -largestValuePos; + CPPUNIT_ASSERT(pack16base11(largestValuePos) == largestPositive); + CPPUNIT_ASSERT(pack16base11ceil(largestValuePos) == largestPositive); + CPPUNIT_ASSERT(unpack16base11(largestPositive) == largestValuePos); + + CPPUNIT_ASSERT(pack16base11(largestValueNeg) == largestNegative); + CPPUNIT_ASSERT(pack16base11ceil(largestValueNeg) == largestNegative); + CPPUNIT_ASSERT(unpack16base11(largestNegative) == largestValueNeg); + + CPPUNIT_ASSERT(pack16base11(largestValuePos+0.1) == largestPositive); + CPPUNIT_ASSERT(pack16base11ceil(largestValuePos+0.1) == largestPositive); + + CPPUNIT_ASSERT(pack16base11(largestValueNeg-0.1) == largestNegative); + CPPUNIT_ASSERT(pack16base11ceil(largestValueNeg-0.1) == largestNegative); + + + const double largestValueClosedPos = std::exp(0.); + const double largestValueClosedNeg = -largestValueClosedPos; + CPPUNIT_ASSERT(pack16base11closed(largestValueClosedPos) == largestPositive); + CPPUNIT_ASSERT(unpack16base11closed(largestPositive) == largestValueClosedPos); + CPPUNIT_ASSERT(pack16base11closed(largestValueClosedNeg) == largestNegative); + CPPUNIT_ASSERT(unpack16base11closed(largestNegative) == largestValueClosedNeg); + + CPPUNIT_ASSERT(pack16base11closed(largestValueClosedPos+0.1) == largestPositive); + CPPUNIT_ASSERT(pack16base11closed(largestValueClosedNeg-0.1) == largestNegative); + + const double someValue = std::exp(-15. + 1./base*15.); + const float someValueFloat = std::exp(-15.f + 1.f/float(base)*15.f); + CPPUNIT_ASSERT(unpack16base11(pack16base11ceil(someValue)) == someValue); + CPPUNIT_ASSERT(static_cast(unpack16base11(pack16base11ceil(someValue))) == someValueFloat); + + conv32.flt = someValueFloat; + conv32.i32 += 1; + const float someValuePlus1Ulp32 = conv32.flt; + CPPUNIT_ASSERT(static_cast(unpack16base11(pack16base11ceil(someValuePlus1Ulp32))) >= someValuePlus1Ulp32); + + conv64.flt = someValue; + conv64.i64 += 1; + const float someValuePlus1Ulp64 = conv64.flt; + CPPUNIT_ASSERT(unpack16base11(pack16base11ceil(someValuePlus1Ulp64)) >= someValuePlus1Ulp64); +} + +void testlogintpack::test8() { + using logintpack::smallestPositive; + using logintpack::smallestNegative; + constexpr int8_t largestPositive = 127; + constexpr int8_t largestNegative = -127; + + const double smallestValuePos = std::exp(-15.); + const double smallestValueNeg = -std::exp(-15.+1./128.*15.); + const double smallestValueNegForClosed = -std::exp(-15.+1./127.*15.); + CPPUNIT_ASSERT(pack(smallestValuePos) == smallestPositive); + CPPUNIT_ASSERT(packceil(smallestValuePos) == smallestPositive); + CPPUNIT_ASSERT(packclosed(smallestValuePos) == smallestPositive); + CPPUNIT_ASSERT(unpack(smallestPositive) == smallestValuePos); + CPPUNIT_ASSERT(unpackclosed(smallestPositive) == smallestValuePos); + + CPPUNIT_ASSERT(pack(smallestValueNeg) == smallestNegative); + CPPUNIT_ASSERT(packceil(smallestValueNeg) == smallestNegative); + CPPUNIT_ASSERT(unpack(smallestNegative) == smallestValueNeg); + CPPUNIT_ASSERT(unpack(pack(smallestValueNeg)) == smallestValueNeg); + CPPUNIT_ASSERT(unpack(packceil(smallestValueNeg)) == smallestValueNeg); + CPPUNIT_ASSERT(unpackclosed(packclosed(smallestValueNegForClosed)) == smallestValueNegForClosed); + + const double largestValuePos = std::exp(-15.+127./128.*15.); + const double largestValueNeg = -largestValuePos; + CPPUNIT_ASSERT(pack(largestValuePos) == largestPositive); + CPPUNIT_ASSERT(packceil(largestValuePos) == largestPositive); + CPPUNIT_ASSERT(unpack(largestPositive) == largestValuePos); + + CPPUNIT_ASSERT(pack(largestValueNeg) == largestNegative); + CPPUNIT_ASSERT(packceil(largestValueNeg) == largestNegative); + CPPUNIT_ASSERT(unpack(largestNegative) == largestValueNeg); + + const double largestValueClosedPos = std::exp(0.); + const double largestValueClosedNeg = -largestValueClosedPos; + CPPUNIT_ASSERT(packclosed(largestValueClosedPos) == largestPositive); + CPPUNIT_ASSERT(unpackclosed(largestPositive) == largestValueClosedPos); + CPPUNIT_ASSERT(packclosed(largestValueClosedNeg) == largestNegative); + CPPUNIT_ASSERT(unpackclosed(largestNegative) == largestValueClosedNeg); + + const double someValue = std::exp(-15. + 1/128.*15.); + const float someValueFloat = std::exp(-15.f + 1/128.f*15.f); + CPPUNIT_ASSERT(unpack(packceil(someValue)) == someValue); + CPPUNIT_ASSERT(static_cast(unpack(packceil(someValue))) == someValueFloat); + { + union { float flt; uint32_t i32; } conv; + conv.flt = someValueFloat; + conv.i32 += 1; + const float someValuePlus1Ulp32 = conv.flt; + CPPUNIT_ASSERT(static_cast(unpack(packceil(someValuePlus1Ulp32))) >= someValuePlus1Ulp32); + } + { + union { double flt; uint64_t i64; } conv; + conv.flt = someValue; + conv.i64 += 1; + const float someValuePlus1Ulp64 = conv.flt; + CPPUNIT_ASSERT(unpack(packceil(someValuePlus1Ulp64)) >= someValuePlus1Ulp64); + } + +} + +CPPUNIT_TEST_SUITE_REGISTRATION(testlogintpack); + diff --git a/DataFormats/NanoAOD/interface/FlatTable.h b/DataFormats/NanoAOD/interface/FlatTable.h index d15b26df9b34d..47cb6ca76f619 100644 --- a/DataFormats/NanoAOD/interface/FlatTable.h +++ b/DataFormats/NanoAOD/interface/FlatTable.h @@ -6,7 +6,7 @@ #include #include #include "FWCore/Utilities/interface/Exception.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" namespace nanoaod { diff --git a/DataFormats/PatCandidates/interface/ioread_packedgen.h b/DataFormats/PatCandidates/interface/ioread_packedgen.h index 87d1a25f7ace8..bc28c376156e5 100644 --- a/DataFormats/PatCandidates/interface/ioread_packedgen.h +++ b/DataFormats/PatCandidates/interface/ioread_packedgen.h @@ -1,4 +1,4 @@ -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "DataFormats/Candidate/interface/Candidate.h" int16_t convertPackedEtaToPackedY(int16_t packedPt_, int16_t packedEta_,int16_t packedM_) { diff --git a/DataFormats/PatCandidates/src/CovarianceParameterization.cc b/DataFormats/PatCandidates/src/CovarianceParameterization.cc index 91e0ff74a418e..5a327f8f588e7 100644 --- a/DataFormats/PatCandidates/src/CovarianceParameterization.cc +++ b/DataFormats/PatCandidates/src/CovarianceParameterization.cc @@ -1,6 +1,6 @@ #include "DataFormats/PatCandidates/interface/CovarianceParameterization.h" -#include "DataFormats/PatCandidates/interface/liblogintpack.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/liblogintpack.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "FWCore/ParameterSet/interface/FileInPath.h" #include #include diff --git a/DataFormats/PatCandidates/src/MET.cc b/DataFormats/PatCandidates/src/MET.cc index 494321d86645b..10b5286502cbf 100644 --- a/DataFormats/PatCandidates/src/MET.cc +++ b/DataFormats/PatCandidates/src/MET.cc @@ -445,7 +445,7 @@ double MET::shiftedSumEt_74x(MET::METUncertainty shift, MET::METCorrectionLevel -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" void MET::PackedMETUncertainty::pack() { packedDpx_ = MiniFloatConverter::float32to16(dpx_); diff --git a/DataFormats/PatCandidates/src/PackedCandidate.cc b/DataFormats/PatCandidates/src/PackedCandidate.cc index d5826dde3bd54..18749daaea243 100644 --- a/DataFormats/PatCandidates/src/PackedCandidate.cc +++ b/DataFormats/PatCandidates/src/PackedCandidate.cc @@ -1,10 +1,10 @@ #include "DataFormats/PatCandidates/interface/PackedCandidate.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "DataFormats/Math/interface/deltaPhi.h" -#include "DataFormats/PatCandidates/interface/liblogintpack.h" +#include "DataFormats/Math/interface/liblogintpack.h" using namespace logintpack; CovarianceParameterization pat::PackedCandidate::covarianceParameterization_; diff --git a/DataFormats/PatCandidates/src/PackedGenParticle.cc b/DataFormats/PatCandidates/src/PackedGenParticle.cc index e5bb456546103..f39b77d7cde3f 100644 --- a/DataFormats/PatCandidates/src/PackedGenParticle.cc +++ b/DataFormats/PatCandidates/src/PackedGenParticle.cc @@ -1,5 +1,5 @@ #include "DataFormats/PatCandidates/interface/PackedGenParticle.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "DataFormats/Math/interface/deltaPhi.h" diff --git a/DataFormats/PatCandidates/src/TriggerObjectStandAlone.cc b/DataFormats/PatCandidates/src/TriggerObjectStandAlone.cc index 60cdb237f02b8..c045fb5d8d8a9 100644 --- a/DataFormats/PatCandidates/src/TriggerObjectStandAlone.cc +++ b/DataFormats/PatCandidates/src/TriggerObjectStandAlone.cc @@ -3,7 +3,7 @@ #include "DataFormats/Common/interface/TriggerResults.h" #include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" #include "DataFormats/Provenance/interface/ProcessConfiguration.h" #include "DataFormats/Provenance/interface/ProcessHistory.h" #include "FWCore/Common/interface/TriggerNames.h" diff --git a/DataFormats/PatCandidates/test/BuildFile.xml b/DataFormats/PatCandidates/test/BuildFile.xml index 49fc6eb4e5d29..14eda66621850 100644 --- a/DataFormats/PatCandidates/test/BuildFile.xml +++ b/DataFormats/PatCandidates/test/BuildFile.xml @@ -1,7 +1,7 @@ - + diff --git a/DataFormats/PatCandidates/test/testlogintpack.cpp b/DataFormats/PatCandidates/test/testlogintpack.cpp deleted file mode 100644 index e8fe375a20db3..0000000000000 --- a/DataFormats/PatCandidates/test/testlogintpack.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include -#include -#include -#include - -#include "DataFormats/PatCandidates/interface/liblogintpack.h" - -class testlogintpack : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(testlogintpack); - - CPPUNIT_TEST(test); - - CPPUNIT_TEST_SUITE_END(); -public: - void setUp() {} - void tearDown() {} - - void test(); - -private: -}; - -namespace { - int8_t pack(double x) { return logintpack::pack8log (x, -15, 0); } - int8_t packceil(double x) { return logintpack::pack8logCeil (x, -15, 0); } - int8_t packclosed(double x) { return logintpack::pack8log (x, -15, 0); } - double unpack(int8_t x) { return logintpack::unpack8log (x, -15, 0); } - double unpackclosed(int8_t x) { return logintpack::unpack8logClosed(x, -15, 0); } -} - -void testlogintpack::test() { - using logintpack::smallestPositive; - using logintpack::smallestNegative; - constexpr int8_t largestPositive = 127; - constexpr int8_t largestNegative = -127; - - const double smallestValuePos = std::exp(-15.); - const double smallestValueNeg = -std::exp(-15.+1./128.*15.); - const double smallestValueNegForClosed = -std::exp(-15.+1./127.*15.); - CPPUNIT_ASSERT(pack(smallestValuePos) == smallestPositive); - CPPUNIT_ASSERT(packceil(smallestValuePos) == smallestPositive); - CPPUNIT_ASSERT(packclosed(smallestValuePos) == smallestPositive); - CPPUNIT_ASSERT(unpack(smallestPositive) == smallestValuePos); - CPPUNIT_ASSERT(unpackclosed(smallestPositive) == smallestValuePos); - - CPPUNIT_ASSERT(pack(smallestValueNeg) == smallestNegative); - CPPUNIT_ASSERT(packceil(smallestValueNeg) == smallestNegative); - CPPUNIT_ASSERT(unpack(smallestNegative) == smallestValueNeg); - CPPUNIT_ASSERT(unpack(pack(smallestValueNeg)) == smallestValueNeg); - CPPUNIT_ASSERT(unpack(packceil(smallestValueNeg)) == smallestValueNeg); - CPPUNIT_ASSERT(unpackclosed(packclosed(smallestValueNegForClosed)) == smallestValueNegForClosed); - - const double largestValuePos = std::exp(-15.+127./128.*15.); - const double largestValueNeg = -largestValuePos; - CPPUNIT_ASSERT(pack(largestValuePos) == largestPositive); - CPPUNIT_ASSERT(packceil(largestValuePos) == largestPositive); - CPPUNIT_ASSERT(unpack(largestPositive) == largestValuePos); - - CPPUNIT_ASSERT(pack(largestValueNeg) == largestNegative); - CPPUNIT_ASSERT(packceil(largestValueNeg) == largestNegative); - CPPUNIT_ASSERT(unpack(largestNegative) == largestValueNeg); - - const double largestValueClosedPos = std::exp(0.); - const double largestValueClosedNeg = -largestValueClosedPos; - CPPUNIT_ASSERT(packclosed(largestValueClosedPos) == largestPositive); - CPPUNIT_ASSERT(unpackclosed(largestPositive) == largestValueClosedPos); - CPPUNIT_ASSERT(packclosed(largestValueClosedNeg) == largestNegative); - CPPUNIT_ASSERT(unpackclosed(largestNegative) == largestValueClosedNeg); - - const double someValue = std::exp(-15. + 1/128.*15.); - const float someValueFloat = std::exp(-15.f + 1/128.f*15.f); - CPPUNIT_ASSERT(unpack(packceil(someValue)) == someValue); - CPPUNIT_ASSERT(static_cast(unpack(packceil(someValue))) == someValueFloat); - { - union { float flt; uint32_t i32; } conv; - conv.flt = someValueFloat; - conv.i32 += 1; - const float someValuePlus1Ulp32 = conv.flt; - CPPUNIT_ASSERT(static_cast(unpack(packceil(someValuePlus1Ulp32))) >= someValuePlus1Ulp32); - } - { - union { double flt; uint64_t i64; } conv; - conv.flt = someValue; - conv.i64 += 1; - const float someValuePlus1Ulp64 = conv.flt; - CPPUNIT_ASSERT(unpack(packceil(someValuePlus1Ulp64)) >= someValuePlus1Ulp64); - } - -} - -CPPUNIT_TEST_SUITE_REGISTRATION(testlogintpack); - diff --git a/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h b/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h index b492ed440a75f..8bf14b8cddf9f 100644 --- a/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h +++ b/DataFormats/SiStripCommon/interface/ConstantsForMonitorable.h @@ -1,4 +1,3 @@ - #ifndef DataFormats_SiStripCommon_ConstantsForMonitorable_H #define DataFormats_SiStripCommon_ConstantsForMonitorable_H @@ -80,20 +79,42 @@ namespace sistrip { static const char pedestalsMin_[] = "PedestalMin"; // noise - static const char noiseAllStrips_[] = "StripNoise"; - static const char noiseMean_[] = "NoiseMean"; - static const char noiseSpread_[] = "NoiseRmsSpread"; - static const char noiseMax_[] = "NoiseMax"; - static const char noiseMin_[] = "NoiseMin"; - static const char numOfDead_[] = "NumOfDeadStrips"; - static const char numOfNoisy_[] = "NumOfNoisyStrips"; - static const char noiseKSAllStrips_[] = "StripNoiseKS"; - static const char noiseChi2AllStrips_[] = "StripNoiseChi2"; - static const char noiseGausAllStrips_[] = "StripNoiseGaus"; - static const char noiseBin84AllStrips_[] = "StripNoiseBin84"; - static const char noiseRMSAllStrips_[] = "StripNoiseRMS"; - static const char noiseSignif_[] = "StripNoiseSignif"; + static const char noiseAllStrips_[] = "StripNoise"; + static const char noiseMean_[] = "NoiseMean"; + static const char noiseSpread_[] = "NoiseRmsSpread"; + static const char noiseMax_[] = "NoiseMax"; + static const char noiseMin_[] = "NoiseMin"; + + static const char numOfDeadStrips_[] = "NumOfDeadStrips"; + static const char numOfNoisy_[] = "NumOfNoisyStrips"; + static const char numOfBadStrips_[] = "NumOfBadStrips"; + static const char numOfBadADProbabStrips_[] = "NumOfBadADProbabStrips"; + static const char numOfBadKSProbabStrips_[] = "NumOfBadKSProbabStrips"; + static const char numOfBadJBProbabStrips_[] = "NumOfBadJBProbabStrips"; + static const char numOfBadChi2ProbabStrips_[] = "NumOfBadChi2ProbabStrips"; + static const char numOfBadShiftedStrips_[] = "NumOfBadShfitedStrips"; + static const char numOfBadLowNoiseStrips_[] = "NumOfBadLowNoiseStrips"; + static const char numOfBadLargeNoiseStrips_[] = "NumOfBadLargeNoiseStrips"; + static const char numOfBadLargeNoiseSignificanceStrips_[] = "NumOfBadLargeNoiseSignificanceStrips"; + static const char numOfBadTailStrips_[] = "NumOfBadTailStrips"; + static const char numOfBadFitStatusStrips_[] = "NumOfBadFitStatusStrips"; + static const char numOfBadDoublePeakStrips_[] = "NumOfBadDoublePeakStrips"; + static const char badStripBit_[] = "badStripBit"; + static const char deadStripBit_[] = "deadStripBit"; + static const char adProbabAllStrips_[] = "adProbabStrips"; + static const char ksProbabAllStrips_[] = "ksProbabStrips"; + static const char jbProbabAllStrips_[] = "jbProbabStrips"; + static const char chi2ProbabAllStrips_[] = "chi2ProbabStrips"; + static const char residualRMSAllStrips_[] = "residualRMSStrips"; + static const char residualSigmaGausAllStrips_[] = "residualSigmaGausStrips"; + static const char noiseSignificanceAllStrips_[] = "noiseSignificanceStrips"; + static const char residualMeanAllStrips_[] = "residualMeanStrips"; + static const char residualSkewnessAllStrips_[] = "residualSkewnessStrips"; + static const char residualKurtosisAllStrips_[] = "residualKurtosisStrips"; + static const char residualIntegralNsigmaAllStrips_[] = "residualIntegralNsigmaStrips"; + static const char residualIntegralAllStrips_[] = "residualIntegralStrips"; + // Fine Delay static const char fineDelayPos_[] = "FineDelayPosition"; static const char fineDelayErr_[] = "FineDelayError"; @@ -103,27 +124,44 @@ namespace sistrip { static const char calibrationTail_[] = "CalibrationTail"; static const char calibrationRiseTime_[] = "CalibrationRiseTime"; static const char calibrationTimeConstant_[] = "CalibrationTimeConstant"; + static const char calibrationTurnOn_[] = "CalibrationTurnOn"; + static const char calibrationMaximum_[] = "CalibrationMaximum"; + static const char calibrationUndershoot_[] = "CalibrationUndershoot"; + static const char calibrationBaseline_[] = "CalibrationBaseline"; static const char calibrationSmearing_[] = "CalibrationSmearing"; static const char calibrationChi2_[] = "CalibrationChi2"; static const char calibrationAmplitudeAS_[] = "StripCalibrationAmplitude"; static const char calibrationTailAS_[] = "StripCalibrationTail"; static const char calibrationRiseTimeAS_[] = "StripCalibrationRiseTime"; static const char calibrationTimeConstantAS_[] = "StripCalibrationTimeConstant"; + static const char calibrationTurnOnAS_[] = "StripCalibrationTurnOn"; + static const char calibrationMaximumAS_[] = "StripCalibrationMaximum"; + static const char calibrationUndershootAS_[] = "StripCalibrationUndershoot"; + static const char calibrationBaselineAS_[] = "StripCalibrationBaseline"; static const char calibrationSmearingAS_[] = "StripCalibrationSmearing"; static const char calibrationChi2AS_[] = "StripCalibrationChi2"; static const char calibrationAmplitudeMin_[] = "MinCalibrationAmplitude"; static const char calibrationTailMin_[] = "MinCalibrationTail"; static const char calibrationRiseTimeMin_[] = "MinCalibrationRiseTime"; static const char calibrationTimeConstantMin_[] = "MinCalibrationTimeConstant"; + static const char calibrationTurnOnMin_[] = "MinCalibrationTurnOn"; + static const char calibrationMaximumMin_[] = "MinCalibrationMaximum"; + static const char calibrationUndershootMin_[] = "MinCalibrationUndershoot"; + static const char calibrationBaselineMin_[] = "MinCalibrationBaseline"; static const char calibrationSmearingMin_[] = "MinCalibrationSmearing"; static const char calibrationChi2Min_[] = "MinCalibrationChi2"; static const char calibrationAmplitudeMax_[] = "MaxCalibrationAmplitude"; static const char calibrationTailMax_[] = "MaxCalibrationTail"; static const char calibrationRiseTimeMax_[] = "MaxCalibrationRiseTime"; static const char calibrationTimeConstantMax_[] = "MaxCalibrationTimeConstant"; + static const char calibrationTurnOnMax_[] = "MaxCalibrationTurnOn"; + static const char calibrationMaximumMax_[] = "MaxCalibrationMaximum"; + static const char calibrationUndershootMax_[] = "MaxCalibrationUndershoot"; + static const char calibrationBaselineMax_[] = "MaxCalibrationBaseline"; static const char calibrationSmearingMax_[] = "MaxCalibrationSmearing"; static const char calibrationChi2Max_[] = "MaxCalibrationChi2"; + // daq scope mode static const char daqScopeModeMeanSignal_[] = "DaqScopeMode_MeanSignal"; @@ -188,15 +226,39 @@ namespace sistrip { NOISE_MEAN = 207, NOISE_SPREAD = 208, NOISE_MAX = 209, - NOISE_MIN = 210, + NOISE_MIN = 210, + + /// Bad strip NUM_OF_DEAD = 211, - NUM_OF_NOISY = 212, - NOISE_KS_ALL_STRIPS = 215, - NOISE_GAUS_ALL_STRIPS = 216, - NOISE_BIN_84_ALL_STRIPS= 217, - NOISE_CHI2_ALL_STRIPS = 218, - NOISE_SIGNIF_ALL_STRIPS= 219, - NOISE_RMS_ALL_STRIPS = 220, + NUM_OF_BAD = 212, + NUM_OF_NOISY = 213, + NUM_OF_BAD_SHIFTED = 214, + NUM_OF_BAD_LOW_NOISE = 215, + NUM_OF_BAD_LARGE_NOISE = 216, + NUM_OF_BAD_LARGE_SIGNIF = 217, + NUM_OF_BAD_FIT_STATUS = 218, + NUM_OF_BAD_AD_PROBAB = 219, + NUM_OF_BAD_KS_PROBAB = 220, + NUM_OF_BAD_JB_PROBAB = 221, + NUM_OF_BAD_CHI2_PROBAB = 222, + NUM_OF_BAD_TAIL = 223, + NUM_OF_BAD_DOUBLE_PEAK = 224, + // + BAD_STRIP_BIT_ALL_STRIPS = 225, + DEAD_STRIP_BIT_ALL_STRIPS = 226, + AD_PROBAB_ALL_STRIPS = 227, + KS_PROBAB_ALL_STRIPS = 228, + JB_PROBAB_ALL_STRIPS = 229, + CHI2_PROBAB_ALL_STRIPS = 230, + RESIDUAL_RMS_ALL_STRIPS = 231, + RESIDUAL_GAUS_ALL_STRIPS = 232, + NOISE_SIGNIFICANCE_ALL_STRIPS= 233, + RESIDUAL_MEAN_ALL_STRIPS = 234, + RESIDUAL_SKEWNESS_ALL_STRIPS = 235, + RESIDUAL_KURTOSIS_ALL_STRIPS = 236, + RESIDUAL_INTEGRALNSIGMA_ALL_STRIPS = 237, + RESIDUAL_INTEGRAL_ALL_STRIPS = 238, + FINE_DELAY_POS = 601, FINE_DELAY_ERROR = 602, @@ -224,6 +286,22 @@ namespace sistrip { CALIBRATION_TIMECONSTANT_MAX = 722, CALIBRATION_SMEARING_MAX = 723, CALIBRATION_CHI2_MAX = 724, + CALIBRATION_TURNON = 725, + CALIBRATION_MAXIMUM = 726, + CALIBRATION_UNDERSHOOT = 727, + CALIBRATION_BASELINE = 728, + CALIBRATION_TURNON_ALLSTRIPS = 729, + CALIBRATION_MAXIMUM_ALLSTRIPS = 730, + CALIBRATION_UNDERSHOOT_ALLSTRIPS = 731, + CALIBRATION_BASELINE_ALLSTRIPS = 732, + CALIBRATION_TURNON_MIN = 733, + CALIBRATION_MAXIMUM_MIN = 734, + CALIBRATION_UNDERSHOOT_MIN = 735, + CALIBRATION_BASELINE_MIN = 736, + CALIBRATION_TURNON_MAX = 737, + CALIBRATION_MAXIMUM_MAX = 738, + CALIBRATION_UNDERSHOOT_MAX = 739, + CALIBRATION_BASELINE_MAX = 740, DAQ_SCOPE_MODE_MEAN_SIGNAL = 1501 }; diff --git a/DataFormats/SiStripCommon/src/SiStripDetKey.cc b/DataFormats/SiStripCommon/src/SiStripDetKey.cc index 52e873b63e06b..f40ed86ff7516 100644 --- a/DataFormats/SiStripCommon/src/SiStripDetKey.cc +++ b/DataFormats/SiStripCommon/src/SiStripDetKey.cc @@ -206,13 +206,9 @@ bool SiStripDetKey::isInvalid( const sistrip::Granularity& gran ) const { void SiStripDetKey::initFromValue() { // partition - if ( partition_ >= 1 && //sistrip::PARTITION_MIN && - partition_ <= 4 ) { //sistrip::PARTITION_MAX ) { - partition_ = partition_; - } else if ( partition_ == 0 ) { - partition_ = 0; - } else { partition_ = sistrip::invalid_; } - + if(partition_ > 4) { + partition_ = sistrip::invalid_; + } } // ----------------------------------------------------------------------------- diff --git a/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc b/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc index b2b7f3831de0b..eb86e4eaf46f5 100644 --- a/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc +++ b/DataFormats/SiStripCommon/src/SiStripEnumsAndStrings.cc @@ -1,4 +1,3 @@ - #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h" // ----------------------------------------------------------------------------- @@ -369,14 +368,35 @@ std::string SiStripEnumsAndStrings::monitorable( const sistrip::Monitorable& mon else if ( mon == sistrip::NOISE_SPREAD ) { return sistrip::noiseSpread_; } else if ( mon == sistrip::NOISE_MAX ) { return sistrip::noiseMax_; } else if ( mon == sistrip::NOISE_MIN ) { return sistrip::noiseMin_; } - else if ( mon == sistrip::NUM_OF_DEAD ) { return sistrip::numOfDead_; } + else if ( mon == sistrip::NUM_OF_DEAD ) { return sistrip::numOfDeadStrips_; } else if ( mon == sistrip::NUM_OF_NOISY ) { return sistrip::numOfNoisy_; } - else if ( mon == sistrip::NOISE_GAUS_ALL_STRIPS ) { return sistrip::noiseGausAllStrips_; } - else if ( mon == sistrip::NOISE_KS_ALL_STRIPS ) { return sistrip::noiseKSAllStrips_; } - else if ( mon == sistrip::NOISE_CHI2_ALL_STRIPS ) { return sistrip::noiseChi2AllStrips_; } - else if ( mon == sistrip::NOISE_BIN_84_ALL_STRIPS) { return sistrip::noiseBin84AllStrips_; } - else if ( mon == sistrip::NOISE_RMS_ALL_STRIPS) { return sistrip::noiseRMSAllStrips_; } - else if ( mon == sistrip::NOISE_SIGNIF_ALL_STRIPS ) { return sistrip::noiseSignif_; } + else if ( mon == sistrip::NUM_OF_BAD ) { return sistrip::numOfBadStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_SHIFTED ) { return sistrip::numOfBadShiftedStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_LOW_NOISE ) { return sistrip::numOfBadLowNoiseStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_LARGE_NOISE ) { return sistrip::numOfBadLargeNoiseStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_LARGE_SIGNIF ) { return sistrip::numOfBadLargeNoiseSignificanceStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_FIT_STATUS ) { return sistrip::numOfBadFitStatusStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_AD_PROBAB ) { return sistrip::numOfBadADProbabStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_KS_PROBAB ) { return sistrip::numOfBadKSProbabStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_JB_PROBAB ) { return sistrip::numOfBadJBProbabStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_CHI2_PROBAB ) { return sistrip::numOfBadChi2ProbabStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_TAIL ) { return sistrip::numOfBadTailStrips_; } + else if ( mon == sistrip::NUM_OF_BAD_DOUBLE_PEAK ) { return sistrip::numOfBadDoublePeakStrips_; } + + else if ( mon == sistrip::BAD_STRIP_BIT_ALL_STRIPS ) { return sistrip::badStripBit_; } + else if ( mon == sistrip::DEAD_STRIP_BIT_ALL_STRIPS ) { return sistrip::deadStripBit_; } + else if ( mon == sistrip::AD_PROBAB_ALL_STRIPS ) { return sistrip::adProbabAllStrips_; } + else if ( mon == sistrip::KS_PROBAB_ALL_STRIPS ) { return sistrip::ksProbabAllStrips_; } + else if ( mon == sistrip::JB_PROBAB_ALL_STRIPS ) { return sistrip::jbProbabAllStrips_; } + else if ( mon == sistrip::CHI2_PROBAB_ALL_STRIPS ) { return sistrip::chi2ProbabAllStrips_; } + else if ( mon == sistrip::RESIDUAL_RMS_ALL_STRIPS ) { return sistrip::residualRMSAllStrips_; } + else if ( mon == sistrip::RESIDUAL_GAUS_ALL_STRIPS ) { return sistrip::residualSigmaGausAllStrips_; } + else if ( mon == sistrip::NOISE_SIGNIFICANCE_ALL_STRIPS ) { return sistrip::noiseSignificanceAllStrips_; } + else if ( mon == sistrip::RESIDUAL_MEAN_ALL_STRIPS ) { return sistrip::residualMeanAllStrips_; } + else if ( mon == sistrip::RESIDUAL_SKEWNESS_ALL_STRIPS ) { return sistrip::residualSkewnessAllStrips_; } + else if ( mon == sistrip::RESIDUAL_KURTOSIS_ALL_STRIPS ) { return sistrip::residualKurtosisAllStrips_; } + else if ( mon == sistrip::RESIDUAL_INTEGRALNSIGMA_ALL_STRIPS ) { return sistrip::residualIntegralNsigmaAllStrips_; } + else if ( mon == sistrip::RESIDUAL_INTEGRAL_ALL_STRIPS ) { return sistrip::residualIntegralAllStrips_; } // fine delay else if ( mon == sistrip::FINE_DELAY_POS) { return sistrip::fineDelayPos_; } @@ -387,27 +407,43 @@ std::string SiStripEnumsAndStrings::monitorable( const sistrip::Monitorable& mon else if ( mon == sistrip::CALIBRATION_TAIL) { return sistrip::calibrationTail_; } else if ( mon == sistrip::CALIBRATION_RISETIME) { return sistrip::calibrationRiseTime_; } else if ( mon == sistrip::CALIBRATION_TIMECONSTANT) { return sistrip::calibrationTimeConstant_; } + else if ( mon == sistrip::CALIBRATION_TURNON) { return sistrip::calibrationTurnOn_; } + else if ( mon == sistrip::CALIBRATION_MAXIMUM) { return sistrip::calibrationMaximum_; } + else if ( mon == sistrip::CALIBRATION_UNDERSHOOT) { return sistrip::calibrationUndershoot_; } + else if ( mon == sistrip::CALIBRATION_BASELINE) { return sistrip::calibrationBaseline_; } else if ( mon == sistrip::CALIBRATION_SMEARING) { return sistrip::calibrationSmearing_; } else if ( mon == sistrip::CALIBRATION_CHI2) { return sistrip::calibrationChi2_; } else if ( mon == sistrip::CALIBRATION_AMPLITUDE_ALLSTRIPS) { return sistrip::calibrationAmplitudeAS_; } else if ( mon == sistrip::CALIBRATION_TAIL_ALLSTRIPS) { return sistrip::calibrationTailAS_; } else if ( mon == sistrip::CALIBRATION_RISETIME_ALLSTRIPS) { return sistrip::calibrationRiseTimeAS_; } else if ( mon == sistrip::CALIBRATION_TIMECONSTANT_ALLSTRIPS) { return sistrip::calibrationTimeConstantAS_; } + else if ( mon == sistrip::CALIBRATION_TURNON_ALLSTRIPS) { return sistrip::calibrationTurnOnAS_; } + else if ( mon == sistrip::CALIBRATION_MAXIMUM_ALLSTRIPS) { return sistrip::calibrationMaximumAS_; } + else if ( mon == sistrip::CALIBRATION_UNDERSHOOT_ALLSTRIPS) { return sistrip::calibrationUndershootAS_; } + else if ( mon == sistrip::CALIBRATION_BASELINE_ALLSTRIPS) { return sistrip::calibrationBaselineAS_; } else if ( mon == sistrip::CALIBRATION_SMEARING_ALLSTRIPS) { return sistrip::calibrationSmearingAS_; } else if ( mon == sistrip::CALIBRATION_CHI2_ALLSTRIPS) { return sistrip::calibrationChi2AS_; } else if ( mon == sistrip::CALIBRATION_AMPLITUDE_MIN) { return sistrip::calibrationAmplitudeMin_; } else if ( mon == sistrip::CALIBRATION_TAIL_MIN) { return sistrip::calibrationTailMin_; } else if ( mon == sistrip::CALIBRATION_RISETIME_MIN) { return sistrip::calibrationRiseTimeMin_; } else if ( mon == sistrip::CALIBRATION_TIMECONSTANT_MIN) { return sistrip::calibrationTimeConstantMin_; } + else if ( mon == sistrip::CALIBRATION_TURNON_MIN) { return sistrip::calibrationTurnOnMin_; } + else if ( mon == sistrip::CALIBRATION_MAXIMUM_MIN) { return sistrip::calibrationMaximumMin_; } + else if ( mon == sistrip::CALIBRATION_UNDERSHOOT_MIN) { return sistrip::calibrationUndershootMin_; } + else if ( mon == sistrip::CALIBRATION_BASELINE_MIN) { return sistrip::calibrationBaselineMin_; } else if ( mon == sistrip::CALIBRATION_SMEARING_MIN) { return sistrip::calibrationSmearingMin_; } else if ( mon == sistrip::CALIBRATION_CHI2_MIN) { return sistrip::calibrationChi2Min_; } else if ( mon == sistrip::CALIBRATION_AMPLITUDE_MAX) { return sistrip::calibrationAmplitudeMax_; } else if ( mon == sistrip::CALIBRATION_TAIL_MAX) { return sistrip::calibrationTailMax_; } else if ( mon == sistrip::CALIBRATION_RISETIME_MAX) { return sistrip::calibrationRiseTimeMax_; } else if ( mon == sistrip::CALIBRATION_TIMECONSTANT_MAX) { return sistrip::calibrationTimeConstantMax_; } + else if ( mon == sistrip::CALIBRATION_TURNON_MAX) { return sistrip::calibrationTurnOnMax_; } + else if ( mon == sistrip::CALIBRATION_MAXIMUM_MAX) { return sistrip::calibrationMaximumMax_; } + else if ( mon == sistrip::CALIBRATION_UNDERSHOOT_MAX) { return sistrip::calibrationUndershootMax_; } + else if ( mon == sistrip::CALIBRATION_BASELINE_MAX) { return sistrip::calibrationBaselineMax_; } else if ( mon == sistrip::CALIBRATION_SMEARING_MAX) { return sistrip::calibrationSmearingMax_; } else if ( mon == sistrip::CALIBRATION_CHI2_MAX) { return sistrip::calibrationChi2Max_; } - + // scope mode else if ( mon == sistrip::DAQ_SCOPE_MODE_MEAN_SIGNAL ) { return sistrip::daqScopeModeMeanSignal_; } @@ -481,20 +517,41 @@ sistrip::Monitorable SiStripEnumsAndStrings::monitorable( const std::string& mon else if ( mon.find( sistrip::pedestalsMin_ ) != std::string::npos ) { return sistrip::PEDESTALS_MIN; } // noiseKS must come before the more general noiseAllStrips, since it contains that string - else if ( mon.find( sistrip::noiseGausAllStrips_ ) != std::string::npos ) { return sistrip::NOISE_GAUS_ALL_STRIPS; } - else if ( mon.find( sistrip::noiseKSAllStrips_ ) != std::string::npos ) { return sistrip::NOISE_KS_ALL_STRIPS; } - else if ( mon.find( sistrip::noiseChi2AllStrips_ ) != std::string::npos ) { return sistrip::NOISE_CHI2_ALL_STRIPS; } - else if ( mon.find( sistrip::noiseBin84AllStrips_ ) != std::string::npos ) { return sistrip::NOISE_BIN_84_ALL_STRIPS;} - else if ( mon.find( sistrip::noiseRMSAllStrips_ ) != std::string::npos ) { return sistrip::NOISE_RMS_ALL_STRIPS;} - else if ( mon.find( sistrip::noiseSignif_ ) != std::string::npos ) { return sistrip::NOISE_SIGNIF_ALL_STRIPS; } else if ( mon.find( sistrip::noiseAllStrips_ ) != std::string::npos ) { return sistrip::NOISE_ALL_STRIPS; } else if ( mon.find( sistrip::noiseMean_ ) != std::string::npos ) { return sistrip::NOISE_MEAN; } else if ( mon.find( sistrip::noiseSpread_ ) != std::string::npos ) { return sistrip::NOISE_SPREAD; } else if ( mon.find( sistrip::noiseMax_ ) != std::string::npos ) { return sistrip::NOISE_MAX; } else if ( mon.find( sistrip::noiseMin_ ) != std::string::npos ) { return sistrip::NOISE_MIN; } - else if ( mon.find( sistrip::numOfDead_ ) != std::string::npos ) { return sistrip::NUM_OF_DEAD; } + else if ( mon.find( sistrip::numOfDeadStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_DEAD; } else if ( mon.find( sistrip::numOfNoisy_ ) != std::string::npos ) { return sistrip::NUM_OF_NOISY; } - + else if ( mon.find( sistrip::numOfBadStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD; } + else if ( mon.find( sistrip::numOfBadShiftedStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_SHIFTED; } + else if ( mon.find( sistrip::numOfBadLowNoiseStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_LOW_NOISE; } + else if ( mon.find( sistrip::numOfBadLargeNoiseStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_LARGE_NOISE; } + else if ( mon.find( sistrip::numOfBadLargeNoiseSignificanceStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_LARGE_SIGNIF; } + else if ( mon.find( sistrip::numOfBadFitStatusStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_FIT_STATUS; } + else if ( mon.find( sistrip::numOfBadADProbabStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_AD_PROBAB; } + else if ( mon.find( sistrip::numOfBadKSProbabStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_KS_PROBAB; } + else if ( mon.find( sistrip::numOfBadJBProbabStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_JB_PROBAB; } + else if ( mon.find( sistrip::numOfBadChi2ProbabStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_CHI2_PROBAB; } + else if ( mon.find( sistrip::numOfBadTailStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_TAIL; } + else if ( mon.find( sistrip::numOfBadDoublePeakStrips_ ) != std::string::npos ) { return sistrip::NUM_OF_BAD_DOUBLE_PEAK; } + + else if ( mon.find( sistrip::badStripBit_ ) != std::string::npos ) { return sistrip::BAD_STRIP_BIT_ALL_STRIPS; } + else if ( mon.find( sistrip::deadStripBit_ ) != std::string::npos ) { return sistrip::DEAD_STRIP_BIT_ALL_STRIPS; } + else if ( mon.find( sistrip::adProbabAllStrips_ ) != std::string::npos ) { return sistrip::AD_PROBAB_ALL_STRIPS; } + else if ( mon.find( sistrip::ksProbabAllStrips_ ) != std::string::npos ) { return sistrip::KS_PROBAB_ALL_STRIPS; } + else if ( mon.find( sistrip::jbProbabAllStrips_ ) != std::string::npos ) { return sistrip::JB_PROBAB_ALL_STRIPS; } + else if ( mon.find( sistrip::chi2ProbabAllStrips_ ) != std::string::npos ) { return sistrip::CHI2_PROBAB_ALL_STRIPS; } + else if ( mon.find( sistrip::residualRMSAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_RMS_ALL_STRIPS; } + else if ( mon.find( sistrip::residualSigmaGausAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_GAUS_ALL_STRIPS; } + else if ( mon.find( sistrip::noiseSignificanceAllStrips_ ) != std::string::npos ) { return sistrip::NOISE_SIGNIFICANCE_ALL_STRIPS; } + else if ( mon.find( sistrip::residualMeanAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_MEAN_ALL_STRIPS; } + else if ( mon.find( sistrip::residualSkewnessAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_SKEWNESS_ALL_STRIPS; } + else if ( mon.find( sistrip::residualKurtosisAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_KURTOSIS_ALL_STRIPS; } + else if ( mon.find( sistrip::residualIntegralNsigmaAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_INTEGRALNSIGMA_ALL_STRIPS; } + else if ( mon.find( sistrip::residualIntegralAllStrips_ ) != std::string::npos ) { return sistrip::RESIDUAL_INTEGRAL_ALL_STRIPS; } + // fine delay else if ( mon.find( sistrip::fineDelayPos_ ) != std::string::npos ) { return sistrip::FINE_DELAY_POS; } else if ( mon.find( sistrip::fineDelayErr_ ) != std::string::npos ) { return sistrip::FINE_DELAY_ERROR; } @@ -504,24 +561,40 @@ sistrip::Monitorable SiStripEnumsAndStrings::monitorable( const std::string& mon else if ( mon.find( sistrip::calibrationTailAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_TAIL_ALLSTRIPS; } else if ( mon.find( sistrip::calibrationRiseTimeAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_RISETIME_ALLSTRIPS; } else if ( mon.find( sistrip::calibrationTimeConstantAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_TIMECONSTANT_ALLSTRIPS; } + else if ( mon.find( sistrip::calibrationTurnOnAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_TURNON_ALLSTRIPS; } + else if ( mon.find( sistrip::calibrationMaximumAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_MAXIMUM_ALLSTRIPS; } + else if ( mon.find( sistrip::calibrationUndershootAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_UNDERSHOOT_ALLSTRIPS; } + else if ( mon.find( sistrip::calibrationBaselineAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_BASELINE_ALLSTRIPS; } else if ( mon.find( sistrip::calibrationSmearingAS_ ) != std::string::npos ) { return sistrip::CALIBRATION_SMEARING_ALLSTRIPS; } else if ( mon.find( sistrip::calibrationChi2AS_ ) != std::string::npos ) { return sistrip::CALIBRATION_CHI2_ALLSTRIPS; } else if ( mon.find( sistrip::calibrationAmplitudeMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_AMPLITUDE_MIN; } else if ( mon.find( sistrip::calibrationTailMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_TAIL_MIN; } else if ( mon.find( sistrip::calibrationRiseTimeMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_RISETIME_MIN; } else if ( mon.find( sistrip::calibrationTimeConstantMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_TIMECONSTANT_MIN; } + else if ( mon.find( sistrip::calibrationTurnOnMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_TURNON_MIN; } + else if ( mon.find( sistrip::calibrationMaximumMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_MAXIMUM_MIN; } + else if ( mon.find( sistrip::calibrationUndershootMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_UNDERSHOOT_MIN; } + else if ( mon.find( sistrip::calibrationBaselineMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_BASELINE_MIN; } else if ( mon.find( sistrip::calibrationSmearingMin_ ) != std::string::npos ) { return sistrip::CALIBRATION_SMEARING_MIN; } else if ( mon.find( sistrip::calibrationChi2Min_ ) != std::string::npos ) { return sistrip::CALIBRATION_CHI2_MIN; } else if ( mon.find( sistrip::calibrationAmplitudeMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_AMPLITUDE_MAX; } else if ( mon.find( sistrip::calibrationTailMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_TAIL_MAX; } else if ( mon.find( sistrip::calibrationRiseTimeMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_RISETIME_MAX; } else if ( mon.find( sistrip::calibrationTimeConstantMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_TIMECONSTANT_MAX; } + else if ( mon.find( sistrip::calibrationTurnOnMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_TURNON_MAX; } + else if ( mon.find( sistrip::calibrationMaximumMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_MAXIMUM_MAX; } + else if ( mon.find( sistrip::calibrationUndershootMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_UNDERSHOOT_MAX; } + else if ( mon.find( sistrip::calibrationBaselineMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_BASELINE_MAX; } else if ( mon.find( sistrip::calibrationSmearingMax_ ) != std::string::npos ) { return sistrip::CALIBRATION_SMEARING_MAX; } else if ( mon.find( sistrip::calibrationChi2Max_ ) != std::string::npos ) { return sistrip::CALIBRATION_CHI2_MAX; } else if ( mon.find( sistrip::calibrationAmplitude_ ) != std::string::npos ) { return sistrip::CALIBRATION_AMPLITUDE; } else if ( mon.find( sistrip::calibrationTail_ ) != std::string::npos ) { return sistrip::CALIBRATION_TAIL; } else if ( mon.find( sistrip::calibrationRiseTime_ ) != std::string::npos ) { return sistrip::CALIBRATION_RISETIME; } else if ( mon.find( sistrip::calibrationTimeConstant_ ) != std::string::npos ) { return sistrip::CALIBRATION_TIMECONSTANT; } + else if ( mon.find( sistrip::calibrationTurnOn_ ) != std::string::npos ) { return sistrip::CALIBRATION_TURNON; } + else if ( mon.find( sistrip::calibrationMaximum_ ) != std::string::npos ) { return sistrip::CALIBRATION_MAXIMUM; } + else if ( mon.find( sistrip::calibrationUndershoot_ ) != std::string::npos ) { return sistrip::CALIBRATION_UNDERSHOOT; } + else if ( mon.find( sistrip::calibrationBaseline_ ) != std::string::npos ) { return sistrip::CALIBRATION_BASELINE; } else if ( mon.find( sistrip::calibrationSmearing_ ) != std::string::npos ) { return sistrip::CALIBRATION_SMEARING; } else if ( mon.find( sistrip::calibrationChi2_ ) != std::string::npos ) { return sistrip::CALIBRATION_CHI2; } diff --git a/DataFormats/SiStripCommon/src/SiStripFecKey.cc b/DataFormats/SiStripCommon/src/SiStripFecKey.cc index b74927478a405..6ad8f9c720da3 100644 --- a/DataFormats/SiStripCommon/src/SiStripFecKey.cc +++ b/DataFormats/SiStripCommon/src/SiStripFecKey.cc @@ -346,64 +346,50 @@ bool SiStripFecKey::isInvalid( const sistrip::Granularity& gran ) const { void SiStripFecKey::initFromValue() { // FEC crate - if ( fecCrate_ >= sistrip::FEC_CRATE_MIN && - fecCrate_ <= sistrip::FEC_CRATE_MAX ) { - fecCrate_ = fecCrate_; - } else if ( fecCrate_ == 0 ) { - fecCrate_ = 0; - } else { fecCrate_ = sistrip::invalid_; } + if ( not ( (fecCrate_ >= sistrip::FEC_CRATE_MIN && + fecCrate_ <= sistrip::FEC_CRATE_MAX) || + (fecCrate_ == 0) ) ) { + fecCrate_ = sistrip::invalid_; } // FEC slot - if ( fecSlot_ >= sistrip::CRATE_SLOT_MIN && - fecSlot_ <= sistrip::CRATE_SLOT_MAX ) { - fecSlot_ = fecSlot_; - } else if ( fecSlot_ == 0 ) { - fecSlot_ = 0; - } else { fecSlot_ = sistrip::invalid_; } + if ( not ( (fecSlot_ >= sistrip::CRATE_SLOT_MIN && + fecSlot_ <= sistrip::CRATE_SLOT_MAX) || + ( fecSlot_ == 0 ) ) ) { + fecSlot_ = sistrip::invalid_; } // FEC ring - if ( fecRing_ >= sistrip::FEC_RING_MIN && - fecRing_ <= sistrip::FEC_RING_MAX ) { - fecRing_ = fecRing_; - } else if ( fecRing_ == 0 ) { - fecRing_ = 0; - } else { fecRing_ = sistrip::invalid_; } + if ( not ( (fecRing_ >= sistrip::FEC_RING_MIN && + fecRing_ <= sistrip::FEC_RING_MAX ) || + ( fecRing_ == 0 ) ) ) { + fecRing_ = sistrip::invalid_; } // CCU addr - if ( ccuAddr_ >= sistrip::CCU_ADDR_MIN && - ccuAddr_ <= sistrip::CCU_ADDR_MAX ) { - ccuAddr_ = ccuAddr_; - } else if ( ccuAddr_ == 0 ) { - ccuAddr_ = 0; - } else { ccuAddr_ = sistrip::invalid_; } + if ( not ( (ccuAddr_ >= sistrip::CCU_ADDR_MIN && + ccuAddr_ <= sistrip::CCU_ADDR_MAX ) || + ( ccuAddr_ == 0 ) ) ) { + ccuAddr_ = sistrip::invalid_; } // CCU chan - if ( ccuChan_ >= sistrip::CCU_CHAN_MIN && - ccuChan_ <= sistrip::CCU_CHAN_MAX ) { - ccuChan_ = ccuChan_; - } else if ( ccuChan_ == 0 ) { - ccuChan_ = 0; - } else { ccuChan_ = sistrip::invalid_; } + if ( not ( (ccuChan_ >= sistrip::CCU_CHAN_MIN && + ccuChan_ <= sistrip::CCU_CHAN_MAX ) || + ( ccuChan_ == 0 ) ) ) { + ccuChan_ = sistrip::invalid_; } // LLD channel - if ( lldChan_ >= sistrip::LLD_CHAN_MIN && - lldChan_ <= sistrip::LLD_CHAN_MAX ) { - lldChan_ = lldChan_; - } else if ( lldChan_ == 0 ) { - lldChan_ = 0; - } else { lldChan_ = sistrip::invalid_; } + if ( not ( (lldChan_ >= sistrip::LLD_CHAN_MIN && + lldChan_ <= sistrip::LLD_CHAN_MAX ) || + ( lldChan_ == 0 ) ) ) { + lldChan_ = sistrip::invalid_; } // APV I2C address if ( i2cAddr_ >= sistrip::APV_I2C_MIN && i2cAddr_ <= sistrip::APV_I2C_MAX ) { - i2cAddr_ = i2cAddr_; if ( lldChan_ && lldChan( i2cAddr_ ) != lldChan_ ) { i2cAddr_ = sistrip::invalid_; key( key() | (i2cAddrMask_<= sistrip::FED_ID_MIN && - fedId_ <= sistrip::FED_ID_MAX ) { - fedId_ = fedId_; - } else if ( fedId_ == 0 ) { - fedId_ = fedId_; - } else { + if ( not ( (fedId_ >= sistrip::FED_ID_MIN && + fedId_ <= sistrip::FED_ID_MAX ) || + ( fedId_ == 0 ) ) ) { fedId_ = sistrip::invalid_; } - if ( feUnit_ <= sistrip::FEUNITS_PER_FED ) { feUnit_ = feUnit_; } - else { feUnit_ = sistrip::invalid_; } + if ( feUnit_ > sistrip::FEUNITS_PER_FED ) { feUnit_ = sistrip::invalid_; } - if ( feChan_ <= sistrip::FEDCH_PER_FEUNIT ) { feChan_ = feChan_; } - else { feChan_ = sistrip::invalid_; } + if ( feChan_ > sistrip::FEDCH_PER_FEUNIT ) { feChan_ = sistrip::invalid_; } - if ( fedApv_ <= sistrip::APVS_PER_FEDCH ) { fedApv_ = fedApv_; } - else { fedApv_ = sistrip::invalid_; } + if ( fedApv_ > sistrip::APVS_PER_FEDCH ) { fedApv_ = sistrip::invalid_; } } diff --git a/DataFormats/V0Candidate/interface/V0Candidate.h b/DataFormats/V0Candidate/interface/V0Candidate.h index e15b5d2d82712..ab99d593e111c 100644 --- a/DataFormats/V0Candidate/interface/V0Candidate.h +++ b/DataFormats/V0Candidate/interface/V0Candidate.h @@ -19,8 +19,7 @@ namespace reco{ const Vertex::CovarianceMatrix vtxCovariance() { return recoVertex.covariance(); } - - void setVertex( const Vertex & vtxIn ); + void setRecoVertex( const Vertex & vtxIn ); // virtual int pdgId() const { return PDGid; } // void setPdgId( const int & Id ) { PDGid = Id; } private: diff --git a/DataFormats/V0Candidate/src/V0Candidate.cc b/DataFormats/V0Candidate/src/V0Candidate.cc index eb4fef042c550..18765e87953b1 100644 --- a/DataFormats/V0Candidate/src/V0Candidate.cc +++ b/DataFormats/V0Candidate/src/V0Candidate.cc @@ -2,7 +2,7 @@ using namespace reco; -void V0Candidate::setVertex( const Vertex & vtxIn ) { +void V0Candidate::setRecoVertex( const Vertex & vtxIn ) { recoVertex = vtxIn; LeafCandidate::setVertex( vtxIn.position() ); } diff --git a/DetectorDescription/Core/interface/DDCompactView.h b/DetectorDescription/Core/interface/DDCompactView.h index 04e7b14e08002..3ecebbb7d20e8 100644 --- a/DetectorDescription/Core/interface/DDCompactView.h +++ b/DetectorDescription/Core/interface/DDCompactView.h @@ -1,5 +1,5 @@ -#ifndef DDCompactView_h -#define DDCompactView_h +#ifndef DETECTOR_DESCRIPTION_CORE_DD_COMPACT_VIEW_H +#define DETECTOR_DESCRIPTION_CORE_DD_COMPACT_VIEW_H #include #include @@ -19,8 +19,6 @@ class DDCompactViewImpl; class DDDivision; class DDName; -class DDPartSelector; -class DDPhysicalPart; struct DDPosData; namespace DDI { @@ -49,10 +47,6 @@ Updated: Michael Case [ MEC ] 2010-02-11 //FIXME: THIS IS NOT ALLOWED, but currently can be specified using DDL .... //FIXME: -//typedef TreeNode expnode_t; -//! type of data representation of DDCompactView -//typedef graph graph_type; //:typedef Graph graph_type; - //! Compact representation of the geometrical detector hierarchy /** A DDCompactView represents the detector as an acyclic directed multigraph. The nodes are instances of DDLogicalPart while the edges are pointers to diff --git a/DetectorDescription/Core/interface/DDCompactViewImpl.h b/DetectorDescription/Core/interface/DDCompactViewImpl.h index fe6e9c1684296..c2ca14ec7c8cc 100644 --- a/DetectorDescription/Core/interface/DDCompactViewImpl.h +++ b/DetectorDescription/Core/interface/DDCompactViewImpl.h @@ -9,7 +9,6 @@ #include "DataFormats/Math/interface/GraphWalker.h" class DDDivision; -class DDPartSelector; struct DDPosData; class DDCompactViewImpl diff --git a/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h b/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h index 86273e54609cd..3d94f596e8244 100644 --- a/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h +++ b/EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h @@ -1,7 +1,7 @@ /**************************************************************************** * * This is a part of the TOTEM offline software. -* Authors: +* Authors: * Jan KaÅ¡par (jan.kaspar@gmail.com) * Nicola Minafra * @@ -39,23 +39,26 @@ namespace ctpps static constexpr unsigned int VFAT_HEADER_OF_EC = 0xC000; RawDataUnpacker() {} - + RawDataUnpacker(const edm::ParameterSet &conf); /// Unpack data from FED with fedId into `coll' collection. - int Run(int fedId, const FEDRawData &data, std::vector &fedInfoColl, SimpleVFATFrameCollection &coll) const; + int run(int fedId, const FEDRawData &data, std::vector &fedInfoColl, SimpleVFATFrameCollection &coll) const; /// Process one Opto-Rx (or LoneG) frame. - int ProcessOptoRxFrame(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; + int processOptoRxFrame(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; /// Process one Opto-Rx frame in serial (old) format - int ProcessOptoRxFrameSerial(const word *buffer, unsigned int frameSize, SimpleVFATFrameCollection *fc) const; + int processOptoRxFrameSerial(const word *buffer, unsigned int frameSize, SimpleVFATFrameCollection *fc) const; /// Process one Opto-Rx frame in parallel (new) format - int ProcessOptoRxFrameParallel(const word *buffer, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; + int processOptoRxFrameParallel(const word *buffer, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; + + /// Process one Opto-Rx frame that contains SAMPIC frames + int processOptoRxFrameSampic(const word *buffer, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const; /// Process data from one VFAT in parallel (new) format - int ProcessVFATDataParallel(const uint16_t *buf, unsigned int maxWords, unsigned int OptoRxId, SimpleVFATFrameCollection *fc) const; + int processVFATDataParallel(const uint16_t *buf, unsigned int maxWords, unsigned int OptoRxId, SimpleVFATFrameCollection *fc) const; private: unsigned char verbosity; diff --git a/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h b/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h index 990c9f5ae6ba5..575594a52bcb0 100644 --- a/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h +++ b/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h @@ -1,7 +1,7 @@ /**************************************************************************** * * This is a part of the TOTEM offline software. -* Authors: +* Authors: * Jan KaÅ¡par (jan.kaspar@gmail.com) * ****************************************************************************/ @@ -20,6 +20,7 @@ #include "DataFormats/CTPPSDigi/interface/TotemRPDigi.h" #include "DataFormats/CTPPSDigi/interface/TotemVFATStatus.h" #include "DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h" +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" /// \brief Collection of code to convert TOTEM raw data into digi. class RawToDigiConverter @@ -28,15 +29,19 @@ class RawToDigiConverter RawToDigiConverter(const edm::ParameterSet &conf); /// Creates RP digi. - void Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, + void run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector &digi, edm::DetSetVector &status); /// Creates Diamond digi. - void Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, + void run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector &digi, edm::DetSetVector &status); + /// Creates Totem Timing digi. + void run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, + edm::DetSetVector &digi, edm::DetSetVector &status); + /// Print error summaries. - void PrintSummaries() const; + void printSummaries() const; private: struct Record @@ -47,7 +52,7 @@ class RawToDigiConverter }; unsigned char verbosity; - + unsigned int printErrorSummary; unsigned int printUnknownFrameSummary; @@ -73,7 +78,7 @@ class RawToDigiConverter std::map unknownSummary; /// Common processing for all VFAT based sub-systems. - void RunCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, + void runCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, std::map &records); }; diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h new file mode 100644 index 0000000000000..8fe703e877fcc --- /dev/null +++ b/EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h @@ -0,0 +1,315 @@ +/**************************************************************************** +* +* This is a part of the TOTEM offline software. +* Authors: +* Nicola Minafra +* +****************************************************************************/ + +#ifndef EventFilter_CTPPSRawToDigi_TotemSampicFrame +#define EventFilter_CTPPSRawToDigi_TotemSampicFrame + +#include +#include +#include +#include +#include + +#include "EventFilter/CTPPSRawToDigi/interface/VFATFrame.h" + +enum TotemSampicConstant +{ + hwId_Position = 0, + hwId_Size = 1, + controlBits0_Position = 1, + controlBits1_Position = 2, + controlBits2_Position = 3, + controlBits3_Position = 4, + controlBits4_Position = 5, + controlBits5_Position = 6, + fpgaTime_Position = 7, + fpgaTime_Size = 5, + timestampA_Position = 12, + timestampA_Size = 2, + timestampB_Position = 14, + timestampB_Size = 2, + cellInfo_Position = 16, + cellInfo_Size = 2, + planeChannelId_Position = 18, + planeChannelId_Size = 1, + reserved_Position = 19, + reserved_Size = 5, + + boardId_Position = 0, + boardId_Size = 1, + l1ATimestamp_Position = 1, + l1ATimestamp_Size = 5, + bunchNumber_Position = 6, + bunchNumber_Size = 2, + orbitNumber_Position = 8, + orbitNumber_Size = 4, + eventNumber_Position = 12, + eventNumber_Size = 4, + channelMap_Position = 16, + channelMap_Size = 2, + l1ALatency_Position = 18, + l1ALatency_Size = 2, + numberOfSamples_Position = 20, + numberOfSamples_Size = 1, + offsetOfSamples_Position = 21, + offsetOfSamples_Size = 1, + fwVersion_Position = 22, + fwVersion_Size = 1, + pllInfo_Position = 23, + pllInfo_Size = 1, + + numberOfSamples = 24, + controlBits3 = 0x69, + cellInfo_Mask = 0x3F, + +}; + +template +T grayToBinary( const T& gcode_data ) +{ + //b[0] = g[0] + T binary = gcode_data & ( 0x0001 << ( 8*sizeof(T) - 1 ) ); // MSB is the same + + //b[i] = g[i] xor b[i-1] + for (unsigned short int i = 1; i < 8*sizeof(T); ++i) + binary |= ( gcode_data ^ ( binary >> 1 ) ) & (0x0001 << ( 8*sizeof(T) - i - 1 ) ); + + return binary; +} + +/** + * This class is intended to handle the timing infromation of SAMPIC in the TOTEM implementation +**/ +class TotemSampicFrame +{ + public: + TotemSampicFrame( const uint8_t* chInfoPtr, const uint8_t* chDataPtr, const uint8_t* eventInfoPtr ) : + totemSampicInfoPtr_( chInfoPtr ), totemSampicDataPtr_( chDataPtr ), totemSampicEventInfoPtr_( eventInfoPtr ), + status_( 0 ) { + if ( chInfoPtr != nullptr && chDataPtr != nullptr && eventInfoPtr != nullptr && totemSampicInfoPtr_[ TotemSampicConstant::controlBits3_Position ] == TotemSampicConstant::controlBits3 ) + status_ = 1; + } + ~TotemSampicFrame() {} + + /// Prints the frame. + /// If binary is true, binary format is used. + void printRaw( bool binary = false ) const { + std::cout << "Event Info: " << std::endl; + printRawBuffer( (uint16_t*) totemSampicEventInfoPtr_ ); + + std::cout << "Channel Info: " << std::endl; + printRawBuffer( (uint16_t*) totemSampicInfoPtr_ ); + + std::cout << "Channel Data: " << std::endl; + printRawBuffer( (uint16_t*) totemSampicDataPtr_ ); + } + + void print() const { + std::bitset<16> bitsChannelMap( getChannelMap() ); + std::bitset<16> bitsPLLInfo( getPLLInfo() ); + std::cout << "TotemSampicFrame:\nEvent:" + << "\nHardwareId (Event):\t" << std::hex << (unsigned int) getEventHardwareId() + << "\nL1A Timestamp:\t" << std::dec << getL1ATimestamp() + << "\nL1A Latency:\t" << std::dec << getL1ALatency() + << "\nBunch Number:\t" << std::dec << getBunchNumber() + << "\nOrbit Number:\t" << std::dec << getOrbitNumber() + << "\nEvent Number:\t" << std::dec << getEventNumber() + << "\nChannels fired:\t" << std::hex << bitsChannelMap.to_string() + << "\nNumber of Samples:\t" << std::dec << getNumberOfSentSamples() + << "\nOffset of Samples:\t" << std::dec << (int) getOffsetOfSamples() + << "\nFW Version:\t" << std::hex << (int) getFWVersion() + << "\nChannel:\nHardwareId:\t" << std::hex << (unsigned int) getHardwareId() + << "\nFPGATimestamp:\t" << std::dec << getFPGATimestamp() + << "\nTimestampA:\t" << std::dec << getTimestampA() + << "\nTimestampB:\t" << std::dec << getTimestampB() + << "\nCellInfo:\t" << std::dec << getCellInfo() + << "\nPlane:\t" << std::dec << getDetPlane() + << "\nChannel:\t" << std::dec << getDetChannel() + << "\nPLL Info:\t" << bitsPLLInfo.to_string() + << std::endl << std::endl; + } + + // All getters + inline uint8_t getHardwareId() const { + uint8_t tmp = 0; + if ( status_ ) tmp = totemSampicInfoPtr_[ TotemSampicConstant::hwId_Position ]; + return tmp; + } + + inline uint64_t getFPGATimestamp() const { + uint64_t tmp = 0; + if ( status_ ) { + for ( unsigned short i = 0; i < TotemSampicConstant::fpgaTime_Size; ++i ) + tmp += totemSampicInfoPtr_[ TotemSampicConstant::fpgaTime_Position + i ] << 8*i; + } + return tmp; + } + + inline uint16_t getTimestampA() const { + uint16_t tmp = 0; + if ( status_ ) { + for ( unsigned short i = 0; i < TotemSampicConstant::timestampA_Size; ++i ) + tmp |= ( totemSampicInfoPtr_[ TotemSampicConstant::timestampA_Position + i ] ) << 8*i; + } + return grayToBinary ( tmp ); + } + + inline uint16_t getTimestampB() const { + uint16_t tmp = 0; + if ( status_ ) { + for ( unsigned short i = 0; i < TotemSampicConstant::timestampB_Size; ++i ) + tmp |= ( totemSampicInfoPtr_[ TotemSampicConstant::timestampB_Position + i ] ) << 8*i; + } + return grayToBinary ( tmp ); + } + + inline uint16_t getCellInfo() const { + uint16_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint16_t* ) ( totemSampicInfoPtr_ + TotemSampicConstant::cellInfo_Position ) ); + return tmp & TotemSampicConstant::cellInfo_Mask; + } + + inline int getDetPlane() const { + int tmp = 0; + if ( status_ ) + tmp = ( totemSampicInfoPtr_[ planeChannelId_Position ] & 0xF0 ) >> 4; + return tmp; + } + + inline int getDetChannel() const { + int tmp = 0; + if ( status_ ) + tmp = totemSampicInfoPtr_[ planeChannelId_Position ] & 0x0F; + return tmp; + } + + const std::vector getSamples() const { + std::vector samples; + if ( status_ ) { + samples.assign( totemSampicDataPtr_, totemSampicDataPtr_ + TotemSampicConstant::numberOfSamples ); + for ( auto it = samples.begin(); it != samples.end(); ++it ) + *it = grayToBinary( *it ); + } + return samples; + } + + inline unsigned int getNumberOfSamples() const { + return status_ * TotemSampicConstant::numberOfSamples; + } + + // Event Info + inline uint8_t getEventHardwareId() const { + uint8_t tmp = 0; + if ( status_ ) + tmp = totemSampicEventInfoPtr_[ TotemSampicConstant::boardId_Position ]; + return tmp; + } + + inline uint64_t getL1ATimestamp() const { + uint64_t tmp = 0; + if ( status_ ) { + for ( unsigned short i = 0; i < TotemSampicConstant::l1ATimestamp_Size; ++i ) + tmp += totemSampicEventInfoPtr_[ TotemSampicConstant::l1ATimestamp_Position + i ] << 8*i; + } + return tmp; + } + + inline uint16_t getBunchNumber() const + { + uint16_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint16_t* ) ( totemSampicEventInfoPtr_ + TotemSampicConstant::bunchNumber_Position ) ); + return tmp; + } + + inline uint32_t getOrbitNumber() const + { + uint32_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint32_t* ) ( totemSampicEventInfoPtr_ + TotemSampicConstant::orbitNumber_Position ) ); + return tmp; + } + + inline uint32_t getEventNumber() const + { + uint32_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint32_t* ) ( totemSampicEventInfoPtr_ + TotemSampicConstant::eventNumber_Position ) ); + return tmp; + } + + inline uint16_t getChannelMap() const + { + uint16_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint16_t* ) ( totemSampicEventInfoPtr_ + TotemSampicConstant::channelMap_Position ) ); + return tmp; + } + + inline uint16_t getL1ALatency() const + { + uint16_t tmp = 0; + if ( status_ ) + tmp = *( ( const uint16_t* ) ( totemSampicEventInfoPtr_ + TotemSampicConstant::l1ALatency_Position ) ); + return tmp; + } + + inline uint8_t getNumberOfSentSamples() const + { + uint8_t tmp = 0; + if ( status_ ) tmp = totemSampicEventInfoPtr_[ TotemSampicConstant::numberOfSamples_Position ]; + return tmp; + } + + inline uint8_t getOffsetOfSamples() const + { + uint8_t tmp = 0; + if ( status_ ) tmp = totemSampicEventInfoPtr_[ TotemSampicConstant::offsetOfSamples_Position ]; + return tmp; + } + + inline uint8_t getPLLInfo() const { + uint8_t tmp = 0; + if ( status_ ) tmp = totemSampicEventInfoPtr_[ pllInfo_Position ]; + return tmp; + } + + inline uint8_t getFWVersion() const { + uint8_t tmp = 0; + if ( status_ ) tmp = totemSampicEventInfoPtr_[ fwVersion_Position ]; + return tmp; + } + + inline bool valid() const { + return status_ != 0; + } + + protected: + const uint8_t* totemSampicInfoPtr_; + const uint8_t* totemSampicDataPtr_; + const uint8_t* totemSampicEventInfoPtr_; + + int status_; + + inline void printRawBuffer( const uint16_t* buffer, const bool binary = false, const unsigned int size = 12 ) const { + for ( unsigned int i = 0; i < size; i++ ) { + if ( binary ) { + std::bitset<16> bits( *( buffer++ ) ); + std::cout << bits.to_string() << std::endl; + } + else + std::cout << std::setfill( '0' ) << std::setw( 4 ) << std::hex << *( buffer++ ) << std::endl; + } + std::cout << std::endl; + } + +}; + + +#endif diff --git a/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h b/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h index f795b5770590b..4b4c346919036 100644 --- a/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h @@ -41,6 +41,11 @@ class VFATFrame { return data; } + + const VFATFrame::word* getData() const + { + return data; + } /// Returns Bunch Crossing number (BC<11:0>). VFATFrame::word getBC() const diff --git a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc index d64596bba3bd1..735a2024a0b54 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc @@ -1,7 +1,7 @@ /**************************************************************************** * * This is a part of TOTEM offline software. -* Authors: +* Authors: * Jan KaÅ¡par (jan.kaspar@gmail.com) * ****************************************************************************/ @@ -31,6 +31,8 @@ #include "EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h" #include "EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h" +#include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" + #include //---------------------------------------------------------------------------------------------------- @@ -47,7 +49,7 @@ class TotemVFATRawToDigi : public edm::stream::EDProducer<> private: std::string subSystemName; - enum { ssUndefined, ssTrackingStrip, ssTimingDiamond } subSystem; + enum { ssUndefined, ssTrackingStrip, ssTimingDiamond, ssTotemTiming } subSystem; std::vector fedIds; @@ -79,8 +81,10 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): // validate chosen subSystem if (subSystemName == "TrackingStrip") subSystem = ssTrackingStrip; - if (subSystemName == "TimingDiamond") + else if (subSystemName == "TimingDiamond") subSystem = ssTimingDiamond; + else if (subSystemName == "TotemTiming") + subSystem = ssTotemTiming; if (subSystem == ssUndefined) throw cms::Exception("TotemVFATRawToDigi::TotemVFATRawToDigi") << "Unknown sub-system string " << subSystemName << "." << endl; @@ -92,14 +96,15 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): if (subSystem == ssTrackingStrip) produces< DetSetVector >(subSystemName); - if (subSystem == ssTimingDiamond) + else if (subSystem == ssTimingDiamond) produces< DetSetVector >(subSystemName); + else if (subSystem == ssTotemTiming) + produces< DetSetVector >(subSystemName); + // set default IDs - if (fedIds.empty()) - { - if (subSystem == ssTrackingStrip) - { + if (fedIds.empty()) { + if (subSystem == ssTrackingStrip) { for (int id = FEDNumbering::MINTotemRPHorizontalFEDID; id <= FEDNumbering::MAXTotemRPHorizontalFEDID; ++id) fedIds.push_back(id); @@ -107,12 +112,15 @@ TotemVFATRawToDigi::TotemVFATRawToDigi(const edm::ParameterSet &conf): fedIds.push_back(id); } - if (subSystem == ssTimingDiamond) - { - + else if (subSystem == ssTimingDiamond) { for (int id = FEDNumbering::MINCTPPSDiamondFEDID; id <= FEDNumbering::MAXCTPPSDiamondFEDID; ++id) fedIds.push_back(id); } + + else if (subSystem == ssTotemTiming) { + for (int id = FEDNumbering::MINTotemRPTimingVerticalFEDID; id <= FEDNumbering::MAXTotemRPTimingVerticalFEDID; ++id) + fedIds.push_back(id); + } } // conversion status @@ -132,8 +140,11 @@ void TotemVFATRawToDigi::produce(edm::Event& event, const edm::EventSetup &es) if (subSystem == ssTrackingStrip) run< DetSetVector >(event, es); - if (subSystem == ssTimingDiamond) + else if (subSystem == ssTimingDiamond) run< DetSetVector >(event, es); + + else if (subSystem == ssTotemTiming) + run< DetSetVector >(event, es); } //---------------------------------------------------------------------------------------------------- @@ -164,11 +175,11 @@ void TotemVFATRawToDigi::run(edm::Event& event, const edm::EventSetup &es) { const FEDRawData &data = rawData->FEDData(fedId); if (data.size() > 0) - rawDataUnpacker.Run(fedId, data, fedInfo, vfatCollection); + rawDataUnpacker.run(fedId, data, fedInfo, vfatCollection); } // raw-to-digi conversion - rawToDigiConverter.Run(vfatCollection, *mapping, *analysisMask, digi, conversionStatus); + rawToDigiConverter.run(vfatCollection, *mapping, *analysisMask, digi, conversionStatus); // commit products to event event.put(make_unique>(fedInfo), subSystemName); @@ -180,7 +191,7 @@ void TotemVFATRawToDigi::run(edm::Event& event, const edm::EventSetup &es) void TotemVFATRawToDigi::endStream() { - rawToDigiConverter.PrintSummaries(); + rawToDigiConverter.printSummaries(); } DEFINE_FWK_MODULE(TotemVFATRawToDigi); diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py index b58cf406d8eda..2cf7534251836 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py @@ -4,8 +4,6 @@ from EventFilter.CTPPSRawToDigi.totemTriggerRawToDigi_cfi import totemTriggerRawToDigi totemTriggerRawToDigi.rawDataTag = cms.InputTag("rawDataCollector") - - # ---------- Si strips ---------- totemDAQMappingESSourceXML_TrackingStrip = cms.ESSource("TotemDAQMappingESSourceXML", verbosity = cms.untracked.uint32(0), @@ -47,8 +45,6 @@ # totemRPRawToDigi.RawToDigi.printErrorSummary = 1 # totemRPRawToDigi.RawToDigi.printUnknownFrameSummary = 1 - - # ---------- diamonds ---------- totemDAQMappingESSourceXML_TimingDiamond = cms.ESSource("TotemDAQMappingESSourceXML", verbosity = cms.untracked.uint32(0), @@ -84,10 +80,30 @@ from EventFilter.CTPPSRawToDigi.ctppsDiamondRawToDigi_cfi import ctppsDiamondRawToDigi ctppsDiamondRawToDigi.rawDataTag = cms.InputTag("rawDataCollector") +# ---------- Totem Timing ---------- +totemDAQMappingESSourceXML_TotemTiming = cms.ESSource("TotemDAQMappingESSourceXML", + verbosity = cms.untracked.uint32(10), + subSystem = cms.untracked.string("TotemTiming"), + configuration = cms.VPSet( + # 2017, before detector inserted in DAQ + cms.PSet( + validityRange = cms.EventRange("1:min - 310000:max"), + mappingFileNames = cms.vstring(), + maskFileNames = cms.vstring() + ), + # 2018 + cms.PSet( + validityRange = cms.EventRange("310001:min - 999999999:max"), + mappingFileNames = cms.vstring("CondFormats/CTPPSReadoutObjects/xml/mapping_totem_timing_2018.xml"), + maskFileNames = cms.vstring() + ) + ) +) +from EventFilter.CTPPSRawToDigi.totemTimingRawToDigi_cfi import totemTimingRawToDigi +totemTimingRawToDigi.rawDataTag = cms.InputTag("rawDataCollector") # ---------- pixels ---------- - from EventFilter.CTPPSRawToDigi.ctppsPixelDigis_cfi import ctppsPixelDigis ctppsPixelDigis.inputLabel = cms.InputTag("rawDataCollector") @@ -96,5 +112,6 @@ totemTriggerRawToDigi * totemRPRawToDigi * ctppsDiamondRawToDigi* + totemTimingRawToDigi* ctppsPixelDigis ) diff --git a/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py b/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py new file mode 100644 index 0000000000000..1183792e65007 --- /dev/null +++ b/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms + +from EventFilter.CTPPSRawToDigi.totemVFATRawToDigi_cfi import totemVFATRawToDigi + +totemTimingRawToDigi = totemVFATRawToDigi.clone( + subSystem = cms.string('TotemTiming'), + + # IMPORTANT: leave empty to load the default configuration from + # DataFormats/FEDRawData/interface/FEDNumbering.h + fedIds = cms.vuint32(), + + RawToDigi = cms.PSet( + verbosity = cms.untracked.uint32(0), + + # disable all the checks + testFootprint = cms.uint32(0), + testCRC = cms.uint32(0), + testID = cms.uint32(0), # compare the ID from data and mapping + testECMostFrequent = cms.uint32(0), # compare frame's EC with the most frequent value in the event + testBCMostFrequent = cms.uint32(0), # compare frame's BC with the most frequent value in the event + + # if non-zero, prints a per-VFAT error summary at the end of the job + printErrorSummary = cms.untracked.uint32(0), + + # if non-zero, prints a summary of frames found in data, but not in the mapping + printUnknownFrameSummary = cms.untracked.uint32(0) + ) +) diff --git a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc index c1cc49e5f8e80..a6c55f8139bb8 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc @@ -1,15 +1,15 @@ /**************************************************************************** * * This is a part of TOTEM offline software. -* Authors: +* Authors: * Jan KaÅ¡par (jan.kaspar@gmail.com) * Nicola Minafra * ****************************************************************************/ #include "EventFilter/CTPPSRawToDigi/interface/RawDataUnpacker.h" - #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" //---------------------------------------------------------------------------------------------------- @@ -25,25 +25,25 @@ RawDataUnpacker::RawDataUnpacker(const edm::ParameterSet& iConfig) : //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::Run(int fedId, const FEDRawData &data, vector &fedInfoColl, SimpleVFATFrameCollection &coll) const +int RawDataUnpacker::run(int fedId, const FEDRawData &data, vector &fedInfoColl, SimpleVFATFrameCollection &coll) const { unsigned int size_in_words = data.size() / 8; // bytes -> words if (size_in_words < 2) { if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::Run > " << + LogWarning("Totem") << "Error in RawDataUnpacker::run > " << "Data in FED " << fedId << " too short (size = " << size_in_words << " words)."; return 1; } fedInfoColl.push_back(TotemFEDInfo(fedId)); - return ProcessOptoRxFrame((const word *) data.data(), size_in_words, fedInfoColl.back(), &coll); + return processOptoRxFrame((const word *) data.data(), size_in_words, fedInfoColl.back(), &coll); } //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::ProcessOptoRxFrame(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const +int RawDataUnpacker::processOptoRxFrame(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const { // get OptoRx metadata unsigned long long head = buf[0]; @@ -52,56 +52,60 @@ int RawDataUnpacker::ProcessOptoRxFrame(const word *buf, unsigned int frameSize, fedInfo.setHeader(head); fedInfo.setFooter(foot); - unsigned int BOE = (head >> 60) & 0xF; - unsigned int H0 = (head >> 0) & 0xF; + unsigned int boe = (head >> 60) & 0xF; + unsigned int h0 = (head >> 0) & 0xF; - //unsigned long LV1 = (head >> 32) & 0xFFFFFF; - //unsigned long BX = (head >> 20) & 0xFFF; - unsigned int OptoRxId = (head >> 8) & 0xFFF; - unsigned int FOV = (head >> 4) & 0xF; + unsigned long lv1 = (head >> 32) & 0xFFFFFF; + unsigned long bx = (head >> 20) & 0xFFF; + unsigned int optoRxId = (head >> 8) & 0xFFF; + unsigned int fov = (head >> 4) & 0xF; - unsigned int EOE = (foot >> 60) & 0xF; - unsigned int F0 = (foot >> 0) & 0xF; - unsigned int FSize = (foot >> 32) & 0x3FF; + unsigned int eoe = (foot >> 60) & 0xF; + unsigned int f0 = (foot >> 0) & 0xF; + unsigned int fSize = (foot >> 32) & 0x3FF; // check header and footer structure - if (BOE != 5 || H0 != 0 || EOE != 10 || F0 != 0 || FSize != frameSize) + if (boe != 5 || h0 != 0 || eoe != 10 || f0 != 0 || fSize != frameSize) { if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessOptoRxFrame > " << "Wrong structure of OptoRx header/footer: " - << "BOE=" << BOE << ", H0=" << H0 << ", EOE=" << EOE << ", F0=" << F0 - << ", size (OptoRx)=" << FSize << ", size (DATE)=" << frameSize - << ". OptoRxID=" << OptoRxId << ". Skipping frame." << endl; + LogWarning("Totem") << "Error in RawDataUnpacker::processOptoRxFrame > " << "Wrong structure of OptoRx header/footer: " + << "BOE=" << boe << ", H0=" << h0 << ", EOE=" << eoe << ", F0=" << f0 + << ", size (OptoRx)=" << fSize << ", size (DATE)=" << frameSize + << ". OptoRxID=" << optoRxId << ". Skipping frame." << endl; return 0; } - #ifdef DEBUG - printf(">> RawDataUnpacker::ProcessOptoRxFrame > OptoRxId = %u, BX = %lu, LV1 = %lu, frameSize = %u, subFrames = %u)\n", - OptoRxId, BX, LV1, frameSize, subFrames); - #endif + LogDebug( "Totem" ) << "RawDataUnpacker::processOptoRxFrame: " + << "OptoRxId = " << optoRxId << ", BX = " << bx << ", LV1 = " << lv1 << ", frameSize = " << frameSize; + + if (optoRxId >= FEDNumbering::MINTotemRPTimingVerticalFEDID && optoRxId <= FEDNumbering::MAXTotemRPTimingVerticalFEDID) + { + processOptoRxFrameSampic(buf, frameSize, fedInfo, fc); + return 0; + } // parallel or serial transmission? - switch (FOV) { + switch (fov) { case 1: - return ProcessOptoRxFrameSerial(buf, frameSize, fc); + return processOptoRxFrameSerial(buf, frameSize, fc); case 2: case 3: - return ProcessOptoRxFrameParallel(buf, frameSize, fedInfo, fc); + return processOptoRxFrameParallel(buf, frameSize, fedInfo, fc); default: break; } if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessOptoRxFrame > " << "Unknown FOV = " << FOV << endl; + LogWarning("Totem") << "Error in RawDataUnpacker::processOptoRxFrame > " << "Unknown FOV = " << fov << endl; return 0; } //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::ProcessOptoRxFrameSerial(const word *buf, unsigned int frameSize, SimpleVFATFrameCollection *fc) const +int RawDataUnpacker::processOptoRxFrameSerial(const word *buf, unsigned int frameSize, SimpleVFATFrameCollection *fc) const { // get OptoRx metadata - unsigned int OptoRxId = (buf[0] >> 8) & 0xFFF; + unsigned int optoRxId = (buf[0] >> 8) & 0xFFF; // get number of subframes unsigned int subFrames = (frameSize - 2) / 194; @@ -115,33 +119,32 @@ int RawDataUnpacker::ProcessOptoRxFrameSerial(const word *buf, unsigned int fram unsigned int head = (buf[1 + 194 * r] >> (16 * c)) & 0xFFFF; unsigned int foot = (buf[194 + 194 * r] >> (16 * c)) & 0xFFFF; - #ifdef DEBUG - printf(">>>> r = %i, c = %i: S = %i, BOF = %i, EOF = %i, ID = %i, ID' = %i\n", r, c, head & 0x1, head >> 12, foot >> 12, (head >> 8) & 0xF, (foot >> 8) & 0xF); - #endif + LogDebug( "Totem" ) + << "r = " << r << ", c = " << c << ": " + << "S = " << ( head & 0x1 ) << ", BOF = " << ( head >> 12 ) << ", EOF = " << ( foot >> 12 ) + << ", ID = " << ( ( head >> 8 ) & 0xF ) << ", ID' = " << ( ( foot >> 8) & 0xF ); // stop if this GOH is NOT active if ((head & 0x1) == 0) continue; - #ifdef DEBUG - printf("\tHeader active (%04x -> %x).\n", head, head & 0x1); - #endif + LogDebug( "Totem" ) + << "Header active (" << head << " -> " << ( head & 0x1 ) << ")."; // check structure if (head >> 12 != 0x4 || foot >> 12 != 0xB || ((head >> 8) & 0xF) != ((foot >> 8) & 0xF)) { - char ss[500]; + std::ostringstream oss; if (head >> 12 != 0x4) - sprintf(ss, "\n\tHeader is not 0x4 as expected (%x).", head); + oss << "\n\tHeader is not 0x4 as expected (0x" << std::hex << head << ")."; if (foot >> 12 != 0xB) - sprintf(ss, "\n\tFooter is not 0xB as expected (%x).", foot); + oss << "\n\tFooter is not 0xB as expected (0x" << std::hex << foot << ")."; if (((head >> 8) & 0xF) != ((foot >> 8) & 0xF)) - sprintf(ss, "\n\tIncompatible GOH IDs in header (%x) and footer (%x).", ((head >> 8) & 0xF), - ((foot >> 8) & 0xF)); + oss << "\n\tIncompatible GOH IDs in header (0x" << std::hex << ( ( head >> 8 ) & 0xF ) << ") and footer (0x" << std::hex << ( ( foot >> 8 ) & 0xF ) << ")."; if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessOptoRxFrame > " << "Wrong payload structure (in GOH block row " << r << - " and column " << c << ") in OptoRx frame ID " << OptoRxId << ". GOH block omitted." << ss << endl; + LogWarning("Totem") << "Error in RawDataUnpacker::processOptoRxFrame > " << "Wrong payload structure (in GOH block row " << r << + " and column " << c << ") in OptoRx frame ID " << optoRxId << ". GOH block omitted." << oss.str() << endl; errorCounter++; continue; @@ -152,13 +155,12 @@ int RawDataUnpacker::ProcessOptoRxFrameSerial(const word *buf, unsigned int fram vector dataPtrs; for (unsigned int fi = 0; fi < 16; fi++) { - TotemFramePosition fp(0, 0, OptoRxId, goh, fi); + TotemFramePosition fp(0, 0, optoRxId, goh, fi); dataPtrs.push_back( fc->InsertEmptyFrame(fp)->getData() ); } - #ifdef DEBUG - printf(">>>> transposing GOH block at prefix: %i, dataPtrs = %p\n", OptoRxId*192 + goh*16, dataPtrs); - #endif + LogDebug( "Totem" ) + << "transposing GOH block at prefix: " << ( optoRxId*192+goh*16 ) << ", dataPtrs = " << dataPtrs; // deserialization for (int i = 0; i < 192; i++) @@ -182,11 +184,11 @@ int RawDataUnpacker::ProcessOptoRxFrameSerial(const word *buf, unsigned int fram //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::ProcessOptoRxFrameParallel(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const +int RawDataUnpacker::processOptoRxFrameParallel(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const { // get OptoRx metadata unsigned long long head = buf[0]; - unsigned int OptoRxId = (head >> 8) & 0xFFF; + unsigned int optoRxId = (head >> 8) & 0xFFF; // recast data as buffer or 16bit words, skip header const uint16_t *payload = (const uint16_t *) (buf + 1); @@ -202,7 +204,7 @@ int RawDataUnpacker::ProcessOptoRxFrameParallel(const word *buf, unsigned int fr // process all VFAT data for (unsigned int offset = 0; offset < nWords;) { - unsigned int wordsProcessed = ProcessVFATDataParallel(payload + offset, nWords, OptoRxId, fc); + unsigned int wordsProcessed = processVFATDataParallel(payload + offset, nWords, optoRxId, fc); offset += wordsProcessed; } @@ -211,7 +213,7 @@ int RawDataUnpacker::ProcessOptoRxFrameParallel(const word *buf, unsigned int fr //---------------------------------------------------------------------------------------------------- -int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int maxWords, unsigned int OptoRxId, SimpleVFATFrameCollection *fc) const +int RawDataUnpacker::processVFATDataParallel(const uint16_t *buf, unsigned int maxWords, unsigned int optoRxId, SimpleVFATFrameCollection *fc) const { // start counting processed words unsigned int wordsProcessed = 1; @@ -225,7 +227,7 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m if (hFlag != vmCluster && hFlag != vmRaw && hFlag != vmDiamondCompact) { if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessVFATDataParallel > " + LogWarning("Totem") << "Error in RawDataUnpacker::processVFATDataParallel > " << "Unknown header flag " << hFlag << ". Skipping this word." << endl; return wordsProcessed; } @@ -234,7 +236,7 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m // NOTE: DAQ group uses terms GOH and fiber in the other way unsigned int gohIdx = (buf[0] >> 4) & 0xF; unsigned int fiberIdx = (buf[0] >> 0) & 0xF; - TotemFramePosition fp(0, 0, OptoRxId, gohIdx, fiberIdx); + TotemFramePosition fp(0, 0, optoRxId, gohIdx, fiberIdx); // prepare temporary VFAT frame VFATFrame f; @@ -320,7 +322,7 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m if (skipFrame) { if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessVFATDataParallel > Frame at " << fp + LogWarning("Totem") << "Error in RawDataUnpacker::processVFATDataParallel > Frame at " << fp << " has the following problems and will be skipped.\n" << endl << ess.rdbuf(); return wordsProcessed; @@ -355,7 +357,7 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m if (chMax < 0 || chMax > 127 || chMin < 0 || chMin > 127 || chMin > chMax) { if (verbosity) - LogWarning("Totem") << "Error in RawDataUnpacker::ProcessVFATDataParallel > " + LogWarning("Totem") << "Error in RawDataUnpacker::processVFATDataParallel > " << "Invalid cluster (pos=" << clPos << ", size=" << clSize << ", min=" << chMin << ", max=" << chMax << ") at " << fp <<". Skipping this cluster." << endl; @@ -381,7 +383,7 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m presenceFlags |= 0x8; fd[0] = buf[dataOffset + 8]; } - + // get channel data for diamond compact mode if (hFlag == vmDiamondCompact) { @@ -425,3 +427,54 @@ int RawDataUnpacker::ProcessVFATDataParallel(const uint16_t *buf, unsigned int m return wordsProcessed; } + +//---------------------------------------------------------------------------------------------------- + +int RawDataUnpacker::processOptoRxFrameSampic(const word *buf, unsigned int frameSize, TotemFEDInfo &fedInfo, SimpleVFATFrameCollection *fc) const +{ + unsigned int optoRxId = (buf[0] >> 8) & 0xFFF; + + LogDebug( "RawDataUnpacker::processOptoRxFrameSampic" ) + << "Processing sampic frame: OptoRx " << optoRxId << " framesize: " << frameSize; + + unsigned int orbitCounterVFATFrameWords = 6; + unsigned int sizeofVFATPayload = 12; + + const VFATFrame::word *VFATFrameWordPtr = (const VFATFrame::word *) buf; + VFATFrameWordPtr += orbitCounterVFATFrameWords - 1; + + LogDebug( "RawDataUnpacker::processOptoRxFrameSampic" ) + << "Framesize: " << frameSize << "\tframes: " << frameSize/(sizeofVFATPayload+2); + + unsigned int nWords = (frameSize-2) * 4 - 2; + + for (unsigned int i=1; i*(sizeofVFATPayload+2)> 4) & 0xF; + TotemFramePosition fp(0, 0, optoRxId, gohIdx, fiberIdx); + + LogDebug( "RawDataUnpacker::processOptoRxFrameSampic" ) + << "OptoRx: " << optoRxId << " Goh: " << gohIdx << " Idx: " << fiberIdx; + + // prepare temporary VFAT frame + VFATFrame frame(++VFATFrameWordPtr); + VFATFrameWordPtr += sizeofVFATPayload; + + if ( *(VFATFrameWordPtr) != 0xf00e ) { + edm::LogError( "RawDataUnpacker::processOptoRxFrameSampic" ) + << "Wrong trailer " << *VFATFrameWordPtr; + continue; + } + // save frame to output + frame.setPresenceFlags(1); + fc->Insert(fp, frame); + + LogDebug( "RawDataUnpacker::processOptoRxFrameSampic" ) + << "Trailer: " << std::hex << *VFATFrameWordPtr; + } + + return 0; +} + diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index add0a282c8d5e..72c7f364a211c 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -6,16 +6,16 @@ * Seyed Mohsen Etesami (setesami@cern.ch) ****************************************************************************/ -#include "EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h" #include "EventFilter/CTPPSRawToDigi/interface/CounterChecker.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "EventFilter/CTPPSRawToDigi/interface/DiamondVFATFrame.h" +#include "EventFilter/CTPPSRawToDigi/interface/TotemSampicFrame.h" #include "DataFormats/CTPPSDetId/interface/TotemRPDetId.h" #include "DataFormats/CTPPSDetId/interface/CTPPSDiamondDetId.h" - -#include "EventFilter/CTPPSRawToDigi/interface/DiamondVFATFrame.h" +#include "DataFormats/CTPPSDetId/interface/TotemTimingDetId.h" //---------------------------------------------------------------------------------------------------- @@ -45,7 +45,7 @@ RawToDigiConverter::RawToDigiConverter(const edm::ParameterSet &conf) : //---------------------------------------------------------------------------------------------------- -void RawToDigiConverter::RunCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, +void RawToDigiConverter::runCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, map &records) { // EC and BC checks (wrt. the most frequent value), BC checks per subsystem @@ -175,9 +175,9 @@ void RawToDigiConverter::RunCommon(const VFATFrameCollection &input, const Totem if (verbosity > 0 && !ees.rdbuf()->str().empty()) { if (verbosity > 1) - LogWarning("Totem") << "Error in RawToDigiConverter::RunCommon > " << "event contains the following problems:" << endl << ees.rdbuf() << endl; + LogWarning("Totem") << "Error in RawToDigiConverter::runCommon > " << "event contains the following problems:" << endl << ees.rdbuf() << endl; else - LogWarning("Totem") << "Error in RawToDigiConverter::RunCommon > " << "event contains problems." << endl; + LogWarning("Totem") << "Error in RawToDigiConverter::runCommon > " << "event contains problems." << endl; } // increase error counters @@ -196,7 +196,7 @@ void RawToDigiConverter::RunCommon(const VFATFrameCollection &input, const Totem //---------------------------------------------------------------------------------------------------- -void RawToDigiConverter::Run(const VFATFrameCollection &input, +void RawToDigiConverter::run(const VFATFrameCollection &input, const TotemDAQMapping &mapping, const TotemAnalysisMask &analysisMask, DetSetVector &rpData, DetSetVector &finalStatus) { @@ -204,7 +204,7 @@ void RawToDigiConverter::Run(const VFATFrameCollection &input, map records; // common processing - frame validation - RunCommon(input, mapping, records); + runCommon(input, mapping, records); // second loop over data for (auto &p : records) @@ -260,14 +260,14 @@ void RawToDigiConverter::Run(const VFATFrameCollection &input, //---------------------------------------------------------------------------------------------------- -void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, +void RawToDigiConverter::run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector &digi, edm::DetSetVector &status) { // structure merging vfat frame data with the mapping map records; // common processing - frame validation - RunCommon(coll, mapping, records); + runCommon(coll, mapping, records); // second loop over data for (auto &p : records) @@ -298,7 +298,97 @@ void RawToDigiConverter::Run(const VFATFrameCollection &coll, const TotemDAQMapp //---------------------------------------------------------------------------------------------------- -void RawToDigiConverter::PrintSummaries() const +void RawToDigiConverter::run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, + edm::DetSetVector &digi, edm::DetSetVector &status) +{ + // structure merging vfat frame data with the mapping + map records; + + // common processing - frame validation + runCommon(coll, mapping, records); + + // second loop over data + for (auto &p : records) + { + Record &record = p.second; + if (!record.status.isOK()) continue; + + const TotemFramePosition* framepos = &p.first; + + if(((framepos->getIdxInFiber()%2)==0)&&(framepos->getIdxInFiber()<14)) + { + //corresponding channel data are always in the neighbouring idx in fiber + + TotemFramePosition frameposdata(framepos->getSubSystemId(),framepos->getTOTFEDId(),framepos->getOptoRxId(),framepos->getGOHId(),(framepos->getIdxInFiber()+1)); + TotemFramePosition frameposEvtInfo(framepos->getSubSystemId(),framepos->getTOTFEDId(),framepos->getOptoRxId(),framepos->getGOHId(),0xe); + + auto channelwaveformPtr = records.find(frameposdata); + auto eventInfoPtr = records.find(frameposEvtInfo); + + if ( channelwaveformPtr != records.end() && eventInfoPtr != records.end() ) + { + Record &channelwaveform = records[frameposdata]; + Record &eventInfo = records[frameposEvtInfo]; + + // Extract all the waveform information from the raw data + TotemSampicFrame totemSampicFrame((const uint8_t*) record.frame->getData(), (const uint8_t*) channelwaveform.frame->getData(), (const uint8_t*) eventInfo.frame->getData()); + + if (totemSampicFrame.valid()) + { + // create the digi + TotemTimingEventInfo eventInfoTmp( totemSampicFrame.getEventHardwareId(), totemSampicFrame.getL1ATimestamp(), totemSampicFrame.getBunchNumber(), totemSampicFrame.getOrbitNumber(), totemSampicFrame.getEventNumber(), totemSampicFrame.getChannelMap(), totemSampicFrame.getL1ALatency(), totemSampicFrame.getNumberOfSentSamples(), totemSampicFrame.getOffsetOfSamples(), totemSampicFrame.getPLLInfo() ); + TotemTimingDigi digiTmp( totemSampicFrame.getHardwareId(), totemSampicFrame.getFPGATimestamp(), totemSampicFrame.getTimestampA(), totemSampicFrame.getTimestampB(), totemSampicFrame.getCellInfo(), totemSampicFrame.getSamples(), eventInfoTmp); + // calculate ids + TotemTimingDetId detId(record.info->symbolicID.symbolicID); + + const TotemDAQMapping::TotemTimingPlaneChannelPair SWpair = mapping.getTimingChannel( totemSampicFrame.getHardwareId() ); + // for FW Version > 0 plane and channel are encoded in the dataframe + if ( totemSampicFrame.getFWVersion() == 0 ) // Mapping not present in HW, read from SW + { + if ( SWpair.plane == -1 || SWpair.channel == -1 ) + { + if (verbosity>0) + LogWarning("Totem") << "Error in RawToDigiConverter::TotemTiming > " << "HwId not recognized! hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << endl; + } + else + { + detId.setPlane( SWpair.plane % 4); + detId.setChannel( SWpair.channel ); + detId.setRP( SWpair.plane / 4 ); // Top:0 or Bottom:1 + } + } + else // Mapping read from HW, checked by SW + { + const int HWplane = totemSampicFrame.getDetPlane() % 16; + const int HWchannel = totemSampicFrame.getDetChannel() % 16; + + if ( SWpair.plane == -1 || SWpair.channel == -1 ) + { + if ( verbosity>0 ) + LogWarning("Totem") << "Warning in RawToDigiConverter::TotemTiming > " << "HwId not recognized! hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << "\tUsing plane and ch from HW without check!" << endl; + } + else + { + if ( verbosity>0 && ( SWpair.plane != HWplane || SWpair.channel != HWchannel ) ) + LogWarning("Totem") << "Warning in RawToDigiConverter::TotemTiming > " << "Hw mapping different from SW mapping. hwId: " << std::hex << (unsigned int) totemSampicFrame.getHardwareId() << "HW: " << std::dec << HWplane << ":" << HWchannel << "\tSW " << SWpair.plane << ":" << SWpair.channel << "\tUsing plane and ch from HW!" << endl; + } + detId.setPlane( HWplane % 4 ); + detId.setChannel( HWchannel ); + detId.setRP( HWplane / 4 ); // Top:0 or Bottom:1 + } + + DetSet &digiDetSet = digi.find_or_insert(detId); + digiDetSet.push_back(digiTmp); + } + } + } + } +} + + +//---------------------------------------------------------------------------------------------------- + +void RawToDigiConverter::printSummaries() const { // print error summary if (printErrorSummary) diff --git a/EventFilter/CTPPSRawToDigi/test/TotemVFATFrameAnalyzer.cc b/EventFilter/CTPPSRawToDigi/test/TotemVFATFrameAnalyzer.cc index 1831eccd4f723..a3754f40e58c1 100644 --- a/EventFilter/CTPPSRawToDigi/test/TotemVFATFrameAnalyzer.cc +++ b/EventFilter/CTPPSRawToDigi/test/TotemVFATFrameAnalyzer.cc @@ -1,7 +1,7 @@ /**************************************************************************** * * This is a part of TOTEM offline software. -* Authors: +* Authors: * Jan Kašpar (jan.kaspar@gmail.com) * ****************************************************************************/ @@ -80,7 +80,7 @@ void TotemVFATFrameAnalyzer::analyze(edm::StreamID, const edm::Event& event, con { const FEDRawData &data = rawData->FEDData(fedId); if (data.size() > 0) - rawDataUnpacker.Run(fedId, data, fedInfo, vfatCollection); + rawDataUnpacker.run(fedId, data, fedInfo, vfatCollection); } // print VFAT frames diff --git a/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py b/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py index 6b195f8b249df..656709fcce142 100644 --- a/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py +++ b/EventFilter/CTPPSRawToDigi/test/analyze_vfat_frames.py @@ -5,7 +5,7 @@ # default options options = VarParsing.VarParsing ('analysis') -options.inputFiles= 'file:/afs/cern.ch/user/j/jkaspar/public/run268608_ls0001_streamA_StorageManager.root', +options.inputFiles= 'file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/TotemTiming/Minidaq/306/run312306_ls0015_streamA_StorageManager.dat', options.outputFile = 'this_is_not_used' options.maxEvents = 10 @@ -22,7 +22,7 @@ ) # raw data source -process.source = cms.Source("PoolSource", +process.source = cms.Source("NewEventStreamFileReader", fileNames = cms.untracked.vstring(options.inputFiles) ) @@ -33,7 +33,7 @@ # frame analyzer process.totemVFATFrameAnalyzer = cms.EDAnalyzer("TotemVFATFrameAnalyzer", rawDataTag = cms.InputTag("rawDataCollector"), - fedIds = cms.vuint32(578, 579, 580), + fedIds = cms.vuint32(587), RawUnpacking = cms.PSet() ) @@ -41,3 +41,4 @@ process.p = cms.Path( process.totemVFATFrameAnalyzer ) + diff --git a/EventFilter/CTPPSRawToDigi/test/test_totem_timing_cfg.py b/EventFilter/CTPPSRawToDigi/test/test_totem_timing_cfg.py new file mode 100644 index 0000000000000..404f66d1848a1 --- /dev/null +++ b/EventFilter/CTPPSRawToDigi/test/test_totem_timing_cfg.py @@ -0,0 +1,48 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("CTPPSRawToDigiTestStandardSequence") + +# minimum of logs +process.MessageLogger = cms.Service("MessageLogger", + statistics = cms.untracked.vstring(), + destinations = cms.untracked.vstring('cerr'), + cerr = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) +) + +# raw data source +process.source = cms.Source("NewEventStreamFileReader", + fileNames = cms.untracked.vstring( +# '/store/express/Run2016H/ExpressPhysics/FEVT/Express-v2/000/283/877/00000/4EE44B0E-2499-E611-A155-02163E011938.root' + 'file:/eos/cms/store/group/dpg_ctpps/comm_ctpps/TotemTiming/Minidaq/519/run312519_ls0002_streamA_StorageManager.dat' + ) +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10) +) + +process.verbosity = cms.untracked.PSet( + input = cms.untracked.int32(10) +) + +# raw-to-digi conversion +process.load("EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff") + +# execution configuration +process.p = cms.Path( + process.ctppsRawToDigi +) + +# output configuration +process.output = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string("file:./totemTiming_digi.root"), + outputCommands = cms.untracked.vstring( + 'drop *', + 'keep *_*totemTimingRawToDigi_*_*', + ) +) + +process.outpath = cms.EndPath(process.output) + diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockME.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockME.cc index 4dacc60b40097..b33fbad403fee 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockME.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFBlockME.cc @@ -190,7 +190,7 @@ namespace l1t { (res->at(iOut)).push_ME(ME_); res_hit->push_back(Hit_); if (not duplicate_hit_exists) // Don't write duplicate LCTs from adjacent sectors - res_LCT->insertDigi( Hit_.CSC_DetId(), Hit_.CSC_LCTDigi() ); + res_LCT->insertDigi( Hit_.CSC_DetId(), Hit_.CreateCSCCorrelatedLCTDigi() ); // Finished with unpacking one ME Data Record return true; diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFUnpackerTools.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFUnpackerTools.cc index 2b4a102870850..11037e08ab82e 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFUnpackerTools.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/EMTFUnpackerTools.cc @@ -31,7 +31,7 @@ namespace l1t { _hit.Subsector(), _hit.Ring(), _hit.CSC_ID() ) ); _hit.SetCSCDetId ( _hit.CreateCSCDetId() ); - _hit.SetCSCLCTDigi ( _hit.CreateCSCCorrelatedLCTDigi() ); + //_hit.SetCSCLCTDigi ( _hit.CreateCSCCorrelatedLCTDigi() ); // Station, CSC_ID, Sector, Subsector, and Neighbor filled in // EventFilter/L1TRawToDigi/src/implementations_stage2/EMTFBlockME.cc diff --git a/FWCore/Concurrency/scripts/edmStreamStallGrapher.py b/FWCore/Concurrency/scripts/edmStreamStallGrapher.py index a370c88ceefb2..23f10658813d0 100755 --- a/FWCore/Concurrency/scripts/edmStreamStallGrapher.py +++ b/FWCore/Concurrency/scripts/edmStreamStallGrapher.py @@ -137,6 +137,7 @@ def processingStepsFromStallMonitorOutput(f,moduleNames): class StallMonitorParser(object): def __init__(self,f): numStreams = 0 + numStreamsFromSource = 0 moduleNames = {} for rawl in f: l = rawl.strip() @@ -146,11 +147,17 @@ def __init__(self,f): #found global begin run numStreams = int(i[1])+1 break + if numStreams == 0 and l and l[0] == 'S': + s = int(l.split(' ')[1]) + if s > numStreamsFromSource: + numStreamsFromSource = s if len(l) > 5 and l[0:2] == "#M": (id,name)=tuple(l[2:].split()) moduleNames[id] = name continue self._f = f + if numStreams == 0: + numStreams = numStreamsFromSource +1 self.numStreams =numStreams self._moduleNames = moduleNames self.maxNameSize =0 diff --git a/FWCore/Framework/interface/ProducerBase.h b/FWCore/Framework/interface/ProducerBase.h index 3896584ba3b36..865b2d4953080 100644 --- a/FWCore/Framework/interface/ProducerBase.h +++ b/FWCore/Framework/interface/ProducerBase.h @@ -60,7 +60,7 @@ namespace edm { public: typedef ProductRegistryHelper::TypeLabelList TypeLabelList; ProducerBase (); - ~ProducerBase() override; + ~ProducerBase() noexcept(false) override; /// used by the fwk to register list of products std::function registrationCallback() const; diff --git a/FWCore/Framework/src/EventProcessor.cc b/FWCore/Framework/src/EventProcessor.cc index 532d7e04c5520..838962e8eb01f 100644 --- a/FWCore/Framework/src/EventProcessor.cc +++ b/FWCore/Framework/src/EventProcessor.cc @@ -1118,7 +1118,7 @@ namespace edm { auto status= std::make_shared(this, preallocations_.numberOfStreams(), iRunResource) ; - auto lumiWork = [this, iHolder, iSync, status](edm::LimitedTaskQueue::Resumer iResumer) mutable { + auto lumiWork = [this, iHolder, status](edm::LimitedTaskQueue::Resumer iResumer) mutable { if(iHolder.taskHasFailed()) { return; } status->setResumer(std::move(iResumer)); diff --git a/FWCore/Framework/test/MockEventProcessor.cc b/FWCore/Framework/test/MockEventProcessor.cc index 6992bc04b6483..dc95cba24e619 100644 --- a/FWCore/Framework/test/MockEventProcessor.cc +++ b/FWCore/Framework/test/MockEventProcessor.cc @@ -30,7 +30,8 @@ namespace { } namespace edm { -struct LuminosityBlockPrincipal { +class LuminosityBlockPrincipal { +public: LuminosityBlockPrincipal(int iRun,int iLumi): run_(iRun),lumi_(iLumi){} int run_; int lumi_; diff --git a/FWCore/Modules/src/TimeStudyModules.cc b/FWCore/Modules/src/TimeStudyModules.cc new file mode 100644 index 0000000000000..8b6a32544b934 --- /dev/null +++ b/FWCore/Modules/src/TimeStudyModules.cc @@ -0,0 +1,374 @@ +// -*- C++ -*- +// +// Package: FWCore/Modules +// Class : TimeStudyModules +// +// Implementation: +// [Notes on implementation] +// +// Original Author: Chris Jones +// Created: Thu, 22 Mar 2018 16:23:48 GMT +// + +// system include files +#include +#include +#include +#include +#include +#include + +// user include files +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "FWCore/ServiceRegistry/interface/SystemBounds.h" + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ServiceRegistry/interface/ServiceMaker.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + + +namespace timestudy { + namespace { + struct Sleeper { + Sleeper(edm::ParameterSet const& p, edm::ConsumesCollector&& iCol ) { + auto const& cv = p.getParameter>("consumes"); + tokens_.reserve(cv.size()); + for(auto const& c: cv) { + tokens_.emplace_back( iCol.consumes(c)); + } + + auto const& tv = p.getParameter>("eventTimes"); + eventTimes_.reserve(tv.size()); + for(auto t: tv) { + eventTimes_.push_back( static_cast(t*1E6)); + } + } + + void + getAndSleep(edm::Event const& e) const { + edm::Handle h; + for(auto const&t: tokens_) { + e.getByToken(t,h); + } + //Event number minimum value is 1 + usleep( eventTimes_[ (e.id().event()-1) % eventTimes_.size()]); + } + + static void fillDescription(edm::ParameterSetDescription& desc) { + desc.add>("consumes", {})->setComment("What event int data products to consume"); + desc.add>("eventTimes")->setComment("The time, in seconds, for how long the module should sleep each event. The index to use is based on a modulo of size of the list applied to the Event ID number."); + } + + private: + std::vector> tokens_; + std::vector eventTimes_; + + }; + } +//-------------------------------------------------------------------- +// +// Produces an IntProduct instance. +// +class SleepingProducer : public edm::global::EDProducer<> { +public: + explicit SleepingProducer(edm::ParameterSet const& p) : + value_(p.getParameter("ivalue")), + sleeper_(p, consumesCollector()) + { + produces(); + } + void produce(edm::StreamID, edm::Event& e, edm::EventSetup const& c) const override; + + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); + +private: + int value_; + Sleeper sleeper_; +}; + +void +SleepingProducer::produce(edm::StreamID, edm::Event& e, edm::EventSetup const&) const { + // EventSetup is not used. + sleeper_.getAndSleep(e); + + e.put(std::make_unique(value_)); +} + +void +SleepingProducer::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + + desc.add("ivalue")->setComment("Value to put into Event"); + Sleeper::fillDescription(desc); + + descriptions.addDefault(desc); +} + + class OneSleepingProducer : public edm::one::EDProducer { + public: + explicit OneSleepingProducer(edm::ParameterSet const& p) : + value_(p.getParameter("ivalue")), + sleeper_(p, consumesCollector()) + { + produces(); + usesResource(p.getParameter("resource")); + } + void produce( edm::Event& e, edm::EventSetup const& c) override; + + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); + + private: + int value_; + Sleeper sleeper_; + }; + + void + OneSleepingProducer::produce(edm::Event& e, edm::EventSetup const&) { + // EventSetup is not used. + sleeper_.getAndSleep(e); + + e.put(std::make_unique(value_)); + } + + void + OneSleepingProducer::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + + desc.add("ivalue")->setComment("Value to put into Event"); + desc.add("resource",std::string())->setComment("The name of the resource that is being shared"); + Sleeper::fillDescription(desc); + + descriptions.addDefault(desc); + } + + class OneSleepingAnalyzer : public edm::one::EDAnalyzer<> { + public: + explicit OneSleepingAnalyzer(edm::ParameterSet const& p) : + sleeper_(p, consumesCollector()) + { + } + void analyze( edm::Event const& e, edm::EventSetup const& c) override; + + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); + + private: + int value_; + Sleeper sleeper_; + }; + + void + OneSleepingAnalyzer::analyze(edm::Event const& e, edm::EventSetup const&) { + // EventSetup is not used. + sleeper_.getAndSleep(e); + } + + void + OneSleepingAnalyzer::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + + Sleeper::fillDescription(desc); + + descriptions.addDefault(desc); + } + + /* + The SleepingServer is configured to wait to accumulate X events before starting to run. + On a call to asyncWork + -the data will be added to the streams' slot then the waiting thread will be informed + -if the server is waiting on threads + - it wakes up and sleeps for 'initTime' + - it then checks to see if another event was pushed and if it does it continues to do the sleep loop + - once all sleep are done, it checks to see if enough events have contacted it and if so it sleeps for the longest 'workTime' duration given + - when done, it sleeps for each event 'finishTime' and when it wakes it sends the callback + - when all calledback, it goes back to check if there are waiting events + - if there are not enough waiting events, it goes back to waiting on a condition variable + + The SleepingServer keeps track of the number of active Streams by counting the number of streamBeginLumi and streamEndLumi calls have taken place. If there are insufficient active Lumis compared to the number of events it wants to wait for, the Server thread is told to start processing without further waiting. + + */ + class SleepingServer { + public: + SleepingServer(edm::ParameterSet const& iPS, edm::ActivityRegistry& iAR): + nWaitingEvents_(iPS.getUntrackedParameter("nWaitingEvents")) + { + iAR.watchPreallocate([this](edm::service::SystemBounds const& iBounds) { + auto const nStreams =iBounds.maxNumberOfStreams(); + waitingStreams_.reserve(nStreams); + waitTimesPerStream_.resize(nStreams); + waitingTaskPerStream_.resize(nStreams); + }); + + iAR.watchPreEndJob([this]() { + stopProcessing_ = true; + condition_.notify_one(); + serverThread_->join(); + }); + iAR.watchPreStreamBeginLumi([this](edm::StreamContext const&) { + ++activeStreams_; + }); + iAR.watchPreStreamEndLumi([this](edm::StreamContext const&) { + --activeStreams_; + condition_.notify_one(); + }); + + serverThread_ = std::make_unique([this]() { threadWork(); } ); + } + + void asyncWork(edm::StreamID id, edm::WaitingTaskWithArenaHolder iTask, long initTime, long workTime, long finishTime) { + waitTimesPerStream_[id.value()]={{initTime,workTime,finishTime}}; + waitingTaskPerStream_[id.value()]=std::move(iTask); + { + std::lock_guard lk{mutex_}; + waitingStreams_.push_back(id.value()); + } + condition_.notify_one(); + } + + private: + bool readyToDoSomething() { + if(stopProcessing_) { + return true; + } + if(waitingStreams_.size() >= nWaitingEvents_) { + return true; + } + //every running stream is now waiting + return waitingStreams_.size() == activeStreams_; + } + + void threadWork() { + while(not stopProcessing_.load()) { + std::vector streamsToProcess; + { + std::unique_lock lk(mutex_); + condition_.wait(lk, [this]() { + return readyToDoSomething(); + }); + swap(streamsToProcess,waitingStreams_); + } + if(stopProcessing_) { + break; + } + long longestTime = 0; + //simulate filling the external device + for(auto i: streamsToProcess) { + auto const& v=waitTimesPerStream_[i]; + if(v[1]>longestTime) { + longestTime = v[1]; + } + usleep(v[0]); + } + //simulate running external device + usleep(longestTime); + + //simulate copying data back + for(auto i: streamsToProcess) { + auto const& v=waitTimesPerStream_[i]; + usleep(v[2]); + waitingTaskPerStream_[i].doneWaiting(std::exception_ptr()); + } + } + waitingTaskPerStream_.clear(); + } + const unsigned int nWaitingEvents_; + std::unique_ptr serverThread_; + std::vector waitingStreams_; + std::vector> waitTimesPerStream_; + std::vector waitingTaskPerStream_; + std::mutex mutex_; + std::condition_variable condition_; + std::atomic activeStreams_{0}; + std::atomic stopProcessing_{false}; + }; + + class ExternalWorkSleepingProducer : public edm::global::EDProducer { + public: + explicit ExternalWorkSleepingProducer(edm::ParameterSet const& p) : + value_(p.getParameter("ivalue")), + sleeper_(p, consumesCollector()) + { + { + auto const& tv = p.getParameter>("serviceInitTimes"); + initTimes_.reserve(tv.size()); + for(auto t: tv) { + initTimes_.push_back( static_cast(t*1E6)); + } + } + { + auto const& tv = p.getParameter>("serviceWorkTimes"); + workTimes_.reserve(tv.size()); + for(auto t: tv) { + workTimes_.push_back( static_cast(t*1E6)); + } + } + { + auto const& tv = p.getParameter>("serviceFinishTimes"); + finishTimes_.reserve(tv.size()); + for(auto t: tv) { + finishTimes_.push_back( static_cast(t*1E6)); + } + } + assert(finishTimes_.size() == initTimes_.size()); + assert(workTimes_.size() == initTimes_.size()); + + produces(); + } + void acquire(edm::StreamID, edm::Event const & e, edm::EventSetup const& c, edm::WaitingTaskWithArenaHolder holder) const override; + + void produce(edm::StreamID, edm::Event& e, edm::EventSetup const& c) const override; + + static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); + + private: + std::vector initTimes_; + std::vector workTimes_; + std::vector finishTimes_; + int value_; + Sleeper sleeper_; + }; + + void + ExternalWorkSleepingProducer::acquire(edm::StreamID id, edm::Event const& e, edm::EventSetup const&, edm::WaitingTaskWithArenaHolder holder) const { + // EventSetup is not used. + sleeper_.getAndSleep(e); + edm::Service server; + auto index = (e.id().event()-1) % initTimes_.size(); + server->asyncWork(id, std::move(holder), initTimes_[index], workTimes_[index], finishTimes_[index]); + } + + void + ExternalWorkSleepingProducer::produce(edm::StreamID, edm::Event& e, edm::EventSetup const&) const { + e.put(std::make_unique(value_)); + } + + void + ExternalWorkSleepingProducer::fillDescriptions(edm::ConfigurationDescriptions & descriptions) { + edm::ParameterSetDescription desc; + + desc.add("ivalue")->setComment("Value to put into Event"); + desc.add>("serviceInitTimes"); + desc.add>("serviceWorkTimes"); + desc.add>("serviceFinishTimes"); + Sleeper::fillDescription(desc); + + descriptions.addDefault(desc); + } + +} +DEFINE_FWK_SERVICE(timestudy::SleepingServer); +DEFINE_FWK_MODULE(timestudy::SleepingProducer); +DEFINE_FWK_MODULE(timestudy::OneSleepingProducer); +DEFINE_FWK_MODULE(timestudy::ExternalWorkSleepingProducer); +DEFINE_FWK_MODULE(timestudy::OneSleepingAnalyzer); + diff --git a/FWCore/Modules/test/FWCoreModulesTest.sh b/FWCore/Modules/test/FWCoreModulesTest.sh index 6b1ac1515e6b4..606e4a4fa1106 100755 --- a/FWCore/Modules/test/FWCoreModulesTest.sh +++ b/FWCore/Modules/test/FWCoreModulesTest.sh @@ -14,5 +14,7 @@ echo checkcacheidentifier cmsRun ${LOCAL_TEST_DIR}/checkcacheidentifier_cfg.py || die 'failed running cmsRun checkcacheidentifier_cfg.py' $? echo testPathStatusFilter cmsRun ${LOCAL_TEST_DIR}/testPathStatusFilter_cfg.py || die 'failed running cmsRun testPathStatusFilter_cfg.py' $? +echo sleepingModules +cmsRun ${LOCAL_TEST_DIR}/sleepingModules_cfg.py || die 'failed running cmsRun sleepingModules_cfg.py' $? popd diff --git a/FWCore/Modules/test/sleepingModules_cfg.py b/FWCore/Modules/test/sleepingModules_cfg.py new file mode 100644 index 0000000000000..e76e6f67df11e --- /dev/null +++ b/FWCore/Modules/test/sleepingModules_cfg.py @@ -0,0 +1,67 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Test") + +process.source =cms.Source("EmptySource") + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(10)) + +process.options = cms.untracked.PSet(numberOfThreads = cms.untracked.uint32(4), + numberOfStreams = cms.untracked.uint32(0)) + +#allows something like simulation of source +process.s1 = cms.EDProducer("timestudy::OneSleepingProducer", + resource = cms.string("source"), + ivalue = cms.int32(1), + consumes = cms.VInputTag(), + eventTimes = cms.vdouble(0.01,0.005)) + +process.s2 = cms.EDProducer("timestudy::OneSleepingProducer", + resource = cms.string("source"), + ivalue = cms.int32(2), + consumes = cms.VInputTag(), + eventTimes = cms.vdouble(0.02,0.03)) + +process.p1 = cms.EDProducer("timestudy::SleepingProducer", + ivalue = cms.int32(3), + consumes = cms.VInputTag("s1","s2"), + eventTimes = cms.vdouble(0.05)) + + +process.p2 = cms.EDProducer("timestudy::SleepingProducer", + ivalue = cms.int32(3), + consumes = cms.VInputTag("s2"), + eventTimes = cms.vdouble(0.03)) + +process.p3 = cms.EDProducer("timestudy::SleepingProducer", + ivalue = cms.int32(3), + consumes = cms.VInputTag("p1","p2"), + eventTimes = cms.vdouble(0.03)) + +#external work +process.add_(cms.Service("timestudy::SleepingServer", + nWaitingEvents = cms.untracked.uint32(4))) + +process.e = cms.EDProducer("timestudy::ExternalWorkSleepingProducer", + consumes = cms.VInputTag("p2","p3"), + ivalue = cms.int32(10), + eventTimes = cms.vdouble(0.01), + serviceInitTimes = cms.vdouble(0.,0.), + serviceWorkTimes = cms.vdouble(0.1,0.15), + serviceFinishTimes = cms.vdouble(0.,0.) +) + +#approximates an OutputModule +process.out = cms.EDAnalyzer("timestudy::OneSleepingAnalyzer", + consumes = cms.VInputTag("s1","s2", "p1", "p2", "p3","e"), + eventTimes = cms.vdouble(0.02,0.03) +) + + +process.o = cms.EndPath(process.out, cms.Task(process.s1,process.s2,process.p1,process.p2,process.p3,process.e)) + +#process.add_(cms.Service("Tracer")) + +#process.add_(cms.Service("StallMonitor", fileName = cms.untracked.string("stall_sleep.log"))) + +process.add_(cms.Service("ZombieKillerService", secondsBetweenChecks = cms.untracked.uint32(10))) \ No newline at end of file diff --git a/FWCore/Services/plugins/InitRootHandlers.cc b/FWCore/Services/plugins/InitRootHandlers.cc index 88fc29cd31ff6..b5aa5c5385517 100644 --- a/FWCore/Services/plugins/InitRootHandlers.cc +++ b/FWCore/Services/plugins/InitRootHandlers.cc @@ -252,7 +252,8 @@ namespace { // be fatal, but we do want an error to print. bool alreadyPrinted = false; if ((el_message.find("number of iterations was insufficient") != std::string::npos) || - (el_message.find("bad integrand behavior") != std::string::npos)) { + (el_message.find("bad integrand behavior") != std::string::npos) || + (el_message.find("integral is divergent, or slowly convergent") != std::string::npos)) { el_severity = SeverityLevel::kInfo; edm::LogError("Root_Error") << el_location << el_message; alreadyPrinted = true; diff --git a/FWCore/Services/plugins/Timing.cc b/FWCore/Services/plugins/Timing.cc index d95ac557d6aaa..0266bd0e1ebd6 100644 --- a/FWCore/Services/plugins/Timing.cc +++ b/FWCore/Services/plugins/Timing.cc @@ -18,11 +18,14 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" +#include "FWCore/ServiceRegistry/interface/GlobalContext.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ServiceRegistry/interface/StreamContext.h" #include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" +#include "FWCore/ServiceRegistry/interface/ProcessContext.h" #include "FWCore/ServiceRegistry/interface/SystemBounds.h" #include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Utilities/interface/thread_safety_macros.h" #include #include @@ -52,11 +55,13 @@ namespace edm { private: + void preBeginJob(PathsAndConsumesOfModulesBase const&, ProcessContext const&); void postBeginJob(); void postEndJob(); void preEvent(StreamContext const&); void postEvent(StreamContext const&); + void lastPostEvent(double curr_event_time, unsigned int index, StreamContext const& iStream); void postModuleEvent(StreamContext const&, ModuleCallingContext const&); @@ -133,10 +138,16 @@ namespace edm { CountAndTime countAndTimeZero_; std::atomic countAndTimeForLock_; - double accumulatedTimeForLock_; + CMS_THREAD_GUARD(countAndTimeForLock_) double accumulatedTimeForLock_; std::atomic countAndTimeForGet_; - double accumulatedTimeForGet_; + CMS_THREAD_GUARD(countAndTimeForGet_) double accumulatedTimeForGet_; + + std::vector>> countSubProcessesPreEvent_; + std::vector>> countSubProcessesPostEvent_; + + bool configuredInTopLevelProcess_; + unsigned int nSubProcesses_; }; } } @@ -202,7 +213,10 @@ namespace edm { } static - void pushStack() { + void pushStack(bool configuredInTopLevelProcess) { + if (!configuredInTopLevelProcess) { + return; + } auto& modStack = moduleTimeStack(); modStack.push_back(getTime()); } @@ -226,8 +240,11 @@ namespace edm { countAndTimeForLock_{&countAndTimeZero_}, accumulatedTimeForLock_{0.0}, countAndTimeForGet_{&countAndTimeZero_}, - accumulatedTimeForGet_{0.0} { + accumulatedTimeForGet_{0.0}, + configuredInTopLevelProcess_{false}, + nSubProcesses_{0} { + iRegistry.watchPreBeginJob(this, &Timing::preBeginJob); iRegistry.watchPostBeginJob(this, &Timing::postBeginJob); iRegistry.watchPostEndJob(this, &Timing::postEndJob); @@ -308,9 +325,12 @@ namespace edm { sum_events_time_.resize(nStreams_,0.); max_events_time_.resize(nStreams_,0.); min_events_time_.resize(nStreams_,1.E6); - + for (unsigned int i = 0; i < nStreams_; ++i) { + countSubProcessesPreEvent_.emplace_back(std::make_unique>(0)); + countSubProcessesPostEvent_.emplace_back(std::make_unique>(0)); + } }); - + iRegistry.postGlobalEndRunSignal_.connect([this](edm::GlobalContext const&) { last_run_time_ = getTime(); last_run_cpu_ = getCPU(); @@ -343,7 +363,18 @@ namespace edm { "This service reports the time it takes to run each module in a job."); } + void Timing::preBeginJob(PathsAndConsumesOfModulesBase const& pathsAndConsumes, ProcessContext const& pc) { + if (pc.isSubProcess()) { + ++nSubProcesses_; + } else { + configuredInTopLevelProcess_ = true; + } + } + void Timing::postBeginJob() { + if (!configuredInTopLevelProcess_) { + return; + } curr_job_time_ = getTime(); curr_job_cpu_ = getCPU(); @@ -359,6 +390,14 @@ namespace edm { } void Timing::postEndJob() { + + if (!configuredInTopLevelProcess_) { + LogImportant("TimeReport") << "\nTimeReport> This instance of the Timing Service will be disabled because it is configured in a SubProcess.\n" + << "If multiple instances of the TimingService were configured only the one in the top level process will function.\n" + << "The other instance(s) will simply print this message and do nothing.\n\n"; + return; + } + const double job_end_time =getTime(); const double job_end_cpu =getCPU(); double total_job_time = job_end_time - jobStartTime(); @@ -453,23 +492,48 @@ namespace edm { } void Timing::preEvent(StreamContext const& iStream) { + if (!configuredInTopLevelProcess_) { + return; + } auto index = iStream.streamID().value(); - curr_events_time_[index] = getTime(); + if (nSubProcesses_ == 0u) { + curr_events_time_[index] = getTime(); + } else { + unsigned int count = ++(*countSubProcessesPreEvent_[index]); + if (count == 1) { + curr_events_time_[index] = getTime(); + } else if (count == (nSubProcesses_ + 1)) { + *countSubProcessesPreEvent_[index] = 0; + } + } } void Timing::postEvent(StreamContext const& iStream) { + if (!configuredInTopLevelProcess_) { + return; + } auto index = iStream.streamID().value(); + if (nSubProcesses_ == 0u) { + lastPostEvent(getTime() - curr_events_time_[index], index, iStream); + } else { + unsigned int count = ++(*countSubProcessesPostEvent_[index]); + if (count == (nSubProcesses_ + 1)) { + lastPostEvent(getTime() - curr_events_time_[index], index, iStream); + *countSubProcessesPostEvent_[index] = 0; + } + } + } - double curr_event_time = getTime() - curr_events_time_[index]; + void Timing::lastPostEvent(double curr_event_time, unsigned int index, StreamContext const& iStream) { sum_events_time_[index] +=curr_event_time; if(not summary_only_) { auto const & eventID = iStream.eventID(); LogPrint("TimeEvent") - << "TimeEvent> " - << eventID.event() << " " - << eventID.run() << " " - << curr_event_time ; + << "TimeEvent> " + << eventID.event() << " " + << eventID.run() << " " + << curr_event_time ; } if(curr_event_time > max_events_time_[index]) max_events_time_[index] = curr_event_time; if(curr_event_time < min_events_time_[index]) min_events_time_[index] = curr_event_time; @@ -477,6 +541,9 @@ namespace edm { } void Timing::postModuleEvent(StreamContext const& iStream, ModuleCallingContext const& iModule) { + if (!configuredInTopLevelProcess_) { + return; + } auto const & eventID = iStream.eventID(); auto const & desc = *(iModule.moduleDescription()); double t = postCommon(); @@ -491,7 +558,7 @@ namespace edm { } void Timing::preSourceEvent(StreamID sid) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postSourceEvent(StreamID sid) { @@ -499,7 +566,7 @@ namespace edm { } void Timing::preSourceLumi(LuminosityBlockIndex index) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postSourceLumi(LuminosityBlockIndex index) { @@ -507,7 +574,7 @@ namespace edm { } void Timing::preSourceRun(RunIndex index) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postSourceRun(RunIndex index) { @@ -515,7 +582,7 @@ namespace edm { } void Timing::preOpenFile(std::string const& lfn, bool b) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void Timing::postOpenFile(std::string const& lfn, bool b) { @@ -524,7 +591,7 @@ namespace edm { void Timing::preModule(ModuleDescription const&) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void @@ -534,7 +601,7 @@ namespace edm { void Timing::preModuleGlobal(GlobalContext const&, ModuleCallingContext const&) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void @@ -543,18 +610,28 @@ namespace edm { } void - Timing::postGlobalBeginRun(GlobalContext const&) { - ++begin_run_count_; + Timing::postGlobalBeginRun(GlobalContext const& gc) { + if (!configuredInTopLevelProcess_) { + return; + } + if (!gc.processContext()->isSubProcess()) { + ++begin_run_count_; + } } void - Timing::postGlobalBeginLumi(GlobalContext const&) { - ++begin_lumi_count_; + Timing::postGlobalBeginLumi(GlobalContext const& gc) { + if (!configuredInTopLevelProcess_) { + return; + } + if (!gc.processContext()->isSubProcess()) { + ++begin_lumi_count_; + } } void Timing::preModuleStream(StreamContext const&, ModuleCallingContext const&) { - pushStack(); + pushStack(configuredInTopLevelProcess_); } void @@ -564,6 +641,9 @@ namespace edm { double Timing::postCommon() const { + if (!configuredInTopLevelProcess_) { + return 0.0; + } double t = popStack(); if(t > threshold_) { LogError("ExcessiveTime") @@ -579,6 +659,9 @@ namespace edm { eventsetup::EventSetupRecordKey const&, eventsetup::DataKey const&) { + if (!configuredInTopLevelProcess_) { + return; + } accumulateTimeBegin(countAndTimeForLock_, accumulatedTimeForLock_); } @@ -587,6 +670,9 @@ namespace edm { eventsetup::EventSetupRecordKey const&, eventsetup::DataKey const&) { + if (!configuredInTopLevelProcess_) { + return; + } accumulateTimeEnd(countAndTimeForLock_, accumulatedTimeForLock_); accumulateTimeBegin(countAndTimeForGet_, accumulatedTimeForGet_); } @@ -606,9 +692,12 @@ namespace edm { auto newStat = std::make_unique(0, newTime); CountAndTime* oldStat = countAndTime.load(); - while (oldStat == nullptr || - !countAndTime.compare_exchange_strong(oldStat, nullptr)) { - oldStat = countAndTime.load(); + while (true) { + if (oldStat == nullptr) { + oldStat = countAndTime.load(); + } else if (countAndTime.compare_exchange_strong(oldStat, nullptr)) { + break; + } } newStat->count_ = oldStat->count_ + 1; @@ -627,9 +716,12 @@ namespace edm { double newTime = getTime(); CountAndTime* oldStat = countAndTime.load(); - while (oldStat == nullptr || - !countAndTime.compare_exchange_strong(oldStat, nullptr)) { - oldStat = countAndTime.load(); + while (true) { + if (oldStat == nullptr) { + oldStat = countAndTime.load(); + } else if (countAndTime.compare_exchange_strong(oldStat, nullptr)) { + break; + } } if (oldStat->count_ == 1) { diff --git a/GeneratorInterface/CosmicMuonGenerator/interface/CosMuoGenProducer.h b/GeneratorInterface/CosmicMuonGenerator/interface/CosMuoGenProducer.h index 17218feb31702..fde6a80a4eb99 100644 --- a/GeneratorInterface/CosmicMuonGenerator/interface/CosMuoGenProducer.h +++ b/GeneratorInterface/CosmicMuonGenerator/interface/CosMuoGenProducer.h @@ -15,6 +15,8 @@ #include "GeneratorInterface/CosmicMuonGenerator/interface/CosmicMuonGenerator.h" +#include + namespace edm { class CosMuoGenProducer : public one::EDProducer { @@ -81,9 +83,8 @@ namespace edm double extCrossSect; double extFilterEff; - CosmicMuonGenerator* CosMuoGen; + std::unique_ptr CosMuoGen; // the event format itself - HepMC::GenEvent* fEvt; bool cmVerbosity_; bool isInitialized_; diff --git a/GeneratorInterface/CosmicMuonGenerator/src/CosMuoGenProducer.cc b/GeneratorInterface/CosmicMuonGenerator/src/CosMuoGenProducer.cc index dff753c40dc5e..89e3ee22899dc 100644 --- a/GeneratorInterface/CosmicMuonGenerator/src/CosMuoGenProducer.cc +++ b/GeneratorInterface/CosmicMuonGenerator/src/CosMuoGenProducer.cc @@ -52,7 +52,7 @@ edm::CosMuoGenProducer::CosMuoGenProducer( const ParameterSet & pset ) : if(MinP_CMS < 0) MinP_CMS = MinP; // set up the generator - CosMuoGen = new CosmicMuonGenerator(); + CosMuoGen = std::make_unique(); // Begin JMM change // CosMuoGen->setNumberOfEvents(numberEventsInRun()); CosMuoGen->setNumberOfEvents(999999999); @@ -97,9 +97,6 @@ edm::CosMuoGenProducer::CosMuoGenProducer( const ParameterSet & pset ) : } edm::CosMuoGenProducer::~CosMuoGenProducer(){ - //CosMuoGen->terminate(); - delete CosMuoGen; - // delete fEvt; clear(); } @@ -107,7 +104,7 @@ void edm::CosMuoGenProducer::beginLuminosityBlock(LuminosityBlock const& lumi, E { if(!isInitialized_) { isInitialized_ = true; - RandomEngineSentry randomEngineSentry(CosMuoGen, lumi.index()); + RandomEngineSentry randomEngineSentry(CosMuoGen.get(), lumi.index()); CosMuoGen->initialize(randomEngineSentry.randomEngine()); } } @@ -131,7 +128,7 @@ void edm::CosMuoGenProducer::clear(){} void edm::CosMuoGenProducer::produce(Event &e, const edm::EventSetup &es) { - RandomEngineSentry randomEngineSentry(CosMuoGen, e.streamID()); + RandomEngineSentry randomEngineSentry(CosMuoGen.get(), e.streamID()); // generate event if (!MultiMuon) { @@ -177,7 +174,7 @@ void edm::CosMuoGenProducer::produce(Event &e, const edm::EventSetup &es) } - fEvt = new HepMC::GenEvent(); + auto fEvt = std::make_unique(); HepMC::GenVertex* Vtx_at = new HepMC::GenVertex(HepMC::FourVector(CosMuoGen->Vx_at, //[mm] CosMuoGen->Vy_at, //[mm] @@ -232,11 +229,11 @@ void edm::CosMuoGenProducer::produce(Event &e, const edm::EventSetup &es) if (cmVerbosity_) fEvt->print(); - std::unique_ptr CMProduct(new HepMCProduct()); - CMProduct->addHepMCData( fEvt ); - e.put(std::move(CMProduct), "unsmeared"); - - std::unique_ptr genEventInfo(new GenEventInfoProduct( fEvt )); + std::unique_ptr genEventInfo(new GenEventInfoProduct( fEvt.get() )); e.put(std::move(genEventInfo)); + //This causes fEvt to be deleted + std::unique_ptr CMProduct(new HepMCProduct()); + CMProduct->addHepMCData( fEvt.release() ); + e.put(std::move(CMProduct), "unsmeared"); } diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc index d6023990db5e1..554744386b1a9 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEAsciiDumper.cc @@ -42,6 +42,8 @@ class ExternalLHEAsciiDumper : public edm::EDAnalyzer { edm::InputTag lheProduct_; std::string lheFileName_; + edm::EDGetTokenT LHEAsciiToken_; + // ----------member data --------------------------- }; @@ -51,6 +53,8 @@ ExternalLHEAsciiDumper::ExternalLHEAsciiDumper(const edm::ParameterSet& ps): lheFileName_( ps.getParameter("lheFileName") ) { + LHEAsciiToken_ = consumes (edm::InputTag(lheProduct_)); + return; } @@ -70,7 +74,7 @@ void ExternalLHEAsciiDumper::endRun(edm::Run const& iRun, edm::EventSetup const&) { edm::Handle< LHEXMLStringProduct > LHEAscii; - iRun.getByLabel(lheProduct_,LHEAscii); + iRun.getByToken(LHEAsciiToken_,LHEAscii); const std::vector& lheOutputs = LHEAscii->getStrings(); @@ -87,7 +91,7 @@ ExternalLHEAsciiDumper::endRun(edm::Run const& iRun, edm::EventSetup const&) { else { std::stringstream fname; fname << basename << "_" << iout ; - if (extension != "") + if (!extension.empty()) fname << "." << extension; outfile.open (fname.str().c_str(), std::ofstream::out | std::ofstream::app); } @@ -103,7 +107,7 @@ ExternalLHEAsciiDumper::endRun(edm::Run const& iRun, edm::EventSetup const&) { else { std::stringstream fname; fname << basename << "_" << iout ; - if (extension != "") + if (!extension.empty()) fname << "." << extension; outfile.open (fname.str().c_str(), std::ofstream::out | std::ofstream::app); } diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc index d9291aa1fbcb0..08cc57b926cd0 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc @@ -93,6 +93,7 @@ class ExternalLHEProducer : public edm::one::EDProducer args_; uint32_t npars_; uint32_t nEvents_; + bool storeXML_; unsigned int nThreads_{1}; std::string outputContents_; @@ -133,7 +134,8 @@ ExternalLHEProducer::ExternalLHEProducer(const edm::ParameterSet& iConfig) : outputFile_(iConfig.getParameter("outputFile")), args_(iConfig.getParameter >("args")), npars_(iConfig.getParameter("numberOfParameters")), - nEvents_(iConfig.getUntrackedParameter("nEvents")) + nEvents_(iConfig.getUntrackedParameter("nEvents")), + storeXML_(iConfig.getUntrackedParameter("storeXML")) { if (npars_ != args_.size()) throw cms::Exception("ExternalLHEProducer") << "Problem with configuration: " << args_.size() << " script arguments given, expected " << npars_; @@ -258,15 +260,19 @@ ExternalLHEProducer::beginRunProduce(edm::Run& run, edm::EventSetup const& es) //fill LHEXMLProduct (streaming read directly into compressed buffer to save memory) std::unique_ptr p(new LHEXMLStringProduct); - std::ifstream instream(outputFile_); - if (!instream) { - throw cms::Exception("OutputOpenError") << "Unable to open script output file " << outputFile_ << "."; - } - instream.seekg (0, instream.end); - int insize = instream.tellg(); - instream.seekg (0, instream.beg); - p->fillCompressedContent(instream, 0.25*insize); - instream.close(); + + //store the XML file only if explictly requested + if (storeXML_) { + std::ifstream instream(outputFile_); + if (!instream) { + throw cms::Exception("OutputOpenError") << "Unable to open script output file " << outputFile_ << "."; + } + instream.seekg (0, instream.end); + int insize = instream.tellg(); + instream.seekg (0, instream.beg); + p->fillCompressedContent(instream, 0.25*insize); + instream.close(); + } run.put(std::move(p), "LHEScriptOutput"); // LHE C++ classes translation @@ -499,6 +505,7 @@ ExternalLHEProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptio desc.add >("args"); desc.add("numberOfParameters"); desc.addUntracked("nEvents"); + desc.addUntracked("storeXML", false); descriptions.addDefault(desc); } diff --git a/GeneratorInterface/LHEInterface/python/ExternalLHEProducer_cfi.py b/GeneratorInterface/LHEInterface/python/ExternalLHEProducer_cfi.py index 59e4a9259898b..2abd6225f4775 100644 --- a/GeneratorInterface/LHEInterface/python/ExternalLHEProducer_cfi.py +++ b/GeneratorInterface/LHEInterface/python/ExternalLHEProducer_cfi.py @@ -5,6 +5,7 @@ outputFile = cms.string("W1Jet_7TeV_madgraph_final.lhe"), numberOfParameters = cms.uint32(10), args = cms.vstring('slc5_ia32_gcc434/madgraph/V5_1.3.27/test','W1Jet_7TeV_madgraph','false','true','wjets','5','20','false','0','99'), - nEvents = cms.untracked.uint32(100) + nEvents = cms.untracked.uint32(100), + storeXML = cms.untracked.bool(False) ) diff --git a/Geometry/CaloGeometry/interface/FlatHexagon.h b/Geometry/CaloGeometry/interface/FlatHexagon.h new file mode 100644 index 0000000000000..ce674636aee61 --- /dev/null +++ b/Geometry/CaloGeometry/interface/FlatHexagon.h @@ -0,0 +1,92 @@ +#ifndef GeometryCaloGeometryFlatHexagon_h +#define GeometryCaloGeometryFlatHexagon_h + +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include +#include +#include +#include +#include +#include + +/** + + \class FlatHexagon + + \brief A base class to handle the hexagonal shape of HGCal silicon volumes. + +*/ + +class FlatHexagon : public CaloCellGeometry { +public: + + typedef CaloCellGeometry::CCGFloat CCGFloat ; + typedef CaloCellGeometry::Pt3D Pt3D ; + typedef CaloCellGeometry::Pt3DVec Pt3DVec ; + typedef CaloCellGeometry::Tr3D Tr3D ; + + FlatHexagon( void ); + + FlatHexagon( const FlatHexagon& tr ) ; + + FlatHexagon& operator=( const FlatHexagon& tr ) ; + + FlatHexagon( CornersMgr* cMgr , + const GlobalPoint& fCtr , + const GlobalPoint& bCtr , + const GlobalPoint& cor1 , + const CCGFloat* parV ) ; + + FlatHexagon( const CornersVec& corn , + const CCGFloat* par ) ; + + FlatHexagon( const FlatHexagon& tr, const Pt3D& local) ; + + ~FlatHexagon() override ; + + GlobalPoint const & getPosition() const override { return m_global; } + GlobalPoint getPosition( const Pt3D& local ) const override; + virtual float etaPos() const { return m_global.eta(); } + virtual float phiPos() const { return m_global.phi(); } + Pt3D getLocal( const GlobalPoint& global ) const; + + // Return thetaAxis polar angle of axis of the crystal + CCGFloat getThetaAxis() const ; + + // Return phiAxis azimuthal angle of axis of the crystal + CCGFloat getPhiAxis() const ; + + void vocalCorners( Pt3DVec& vec , + const CCGFloat* pv , + Pt3D& ref ) const override; + + const GlobalVector& axis() const ; + + static void createCorners( const std::vector& pv , + const Tr3D& tr , + std::vector& co ) ; + + static void localCorners( Pt3DVec& vec , + const CCGFloat* pv , + Pt3D& ref ) ; + + void getTransform( Tr3D& tr, Pt3DVec* lptr ) const override; + + void setPosition ( const GlobalPoint& p ) { m_global = p; setRefPoint(p); } + +private: + + void initCorners(CornersVec& ) override; + + GlobalVector makeAxis( void ); + + GlobalPoint backCtr( void ) const; + GlobalVector m_axis; + Pt3D m_corOne, m_local; + GlobalPoint m_global; + Tr3D m_tr; +}; + +std::ostream& operator<<( std::ostream& s, const FlatHexagon& cell ) ; + +#endif diff --git a/Geometry/CaloGeometry/src/FlatHexagon.cc b/Geometry/CaloGeometry/src/FlatHexagon.cc new file mode 100644 index 0000000000000..d1f9840c4a44a --- /dev/null +++ b/Geometry/CaloGeometry/src/FlatHexagon.cc @@ -0,0 +1,295 @@ +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "Geometry/CaloGeometry/interface/FlatHexagon.h" +#include "Geometry/CaloGeometry/interface/TruncatedPyramid.h" +#include +#include + +//#define EDM_ML_DEBUG + +typedef FlatHexagon::CCGFloat CCGFloat ; +typedef FlatHexagon::Pt3D Pt3D ; +typedef FlatHexagon::Pt3DVec Pt3DVec ; +typedef FlatHexagon::Tr3D Tr3D ; + +typedef HepGeom::Vector3D FVec3D ; +typedef HepGeom::Plane3D Plane3D ; + +typedef HepGeom::Vector3D DVec3D ; +typedef HepGeom::Plane3D DPlane3D ; +typedef HepGeom::Point3D DPt3D ; + +//---------------------------------------------------------------------- + +FlatHexagon::FlatHexagon() : CaloCellGeometry(), m_axis ( 0., 0., 0. ), + m_corOne ( 0., 0., 0. ), m_local (0., 0., 0.), + m_global ( 0., 0., 0. ) { +} + +FlatHexagon::FlatHexagon( const FlatHexagon& tr ) : CaloCellGeometry( tr ) { + *this = tr ; +} + +FlatHexagon& FlatHexagon::operator=( const FlatHexagon& tr ) { + CaloCellGeometry::operator=( tr ) ; + if ( this != &tr ) { + m_axis = tr.m_axis ; + m_corOne = tr.m_corOne ; + m_local = tr.m_local; + m_global = tr.m_global; + m_tr = tr.m_tr; + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon(Copy): Local " << m_local + << " Global " << m_global << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); +#endif + return *this ; +} + +FlatHexagon::FlatHexagon( CornersMgr* cMgr , + const GlobalPoint& fCtr , + const GlobalPoint& bCtr , + const GlobalPoint& cor1 , + const CCGFloat* parV ) : + CaloCellGeometry ( fCtr, cMgr, parV ) , + m_axis ( ( bCtr - fCtr ).unit() ) , + m_corOne ( cor1.x(), cor1.y(), cor1.z() ), + m_local (0., 0., 0.) { + getTransform(m_tr,nullptr); + Pt3D glb = m_tr*m_local; + m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); +#endif +} + +FlatHexagon::FlatHexagon( const CornersVec& corn , + const CCGFloat* par ) : + CaloCellGeometry ( corn, par ) , + m_corOne ( corn[0].x(), corn[0].y(), corn[0].z() ), + m_local (0., 0., 0.) { + getTransform(m_tr,nullptr); + m_axis = makeAxis(); + Pt3D glb = m_tr*m_local; + m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); +#endif +} + +FlatHexagon::FlatHexagon( const FlatHexagon& tr, const Pt3D & local ) : + CaloCellGeometry( tr ), m_local(local) { + *this = tr; + Pt3D glb = m_tr*m_local; + m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); +#endif +} + +FlatHexagon::~FlatHexagon() {} + +GlobalPoint FlatHexagon::getPosition(const Pt3D& local ) const { + Pt3D glb = m_tr*local; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon::Local " << local.x() << ":" + << local.y() << ":" << local.z() + << " Global " << glb.x() << ":" << glb.y() + << ":" << glb.z() << " TR " << m_tr.xx() + << ":" << m_tr.xy() << ":" << m_tr.xz() + << ":" << m_tr.yx() << ":" << m_tr.yy() + << ":" << m_tr.yz() << ":" << m_tr.zx() + << ":" << m_tr.zy() << ":" << m_tr.zz() + << ":" << m_tr.dx() << ":" << m_tr.dy() + << ":" << m_tr.dz(); +#endif + return GlobalPoint(glb.x(),glb.y(),glb.z()); +} + +Pt3D FlatHexagon::getLocal(const GlobalPoint& global) const { + Pt3D local = m_tr.inverse()*Pt3D(global.x(),global.y(),global.z()); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatHexagon::Global " << global.x() + << ":" << global.y() << ":" << global.z() + << " Local " << local.x() << ":" + << local.y() << ":" << local.z(); +#endif + return local; +} + +CCGFloat FlatHexagon::getThetaAxis() const { + return m_axis.theta() ; +} + +CCGFloat FlatHexagon::getPhiAxis() const { + return m_axis.phi() ; +} + +const GlobalVector& FlatHexagon::axis() const { + return m_axis ; +} + +void FlatHexagon::vocalCorners( Pt3DVec& vec , + const CCGFloat* pv , + Pt3D& ref ) const { + localCorners( vec, pv, ref ) ; +} + +void FlatHexagon::createCorners( const std::vector& pv , + const Tr3D& tr , + std::vector& co ) { + + assert( 3 == pv.size() ) ; + assert( 12 == co.size() ) ; + + Pt3DVec ko ( 12, Pt3D(0,0,0) ) ; + + Pt3D tmp ; + Pt3DVec to ( 12, Pt3D(0,0,0) ) ; + localCorners( to, &pv.front(), tmp ) ; + + for( unsigned int i ( 0 ) ; i != 12 ; ++i ) { + ko[i] = tr * to[i] ; // apply transformation + const Pt3D & p ( ko[i] ) ; + co[ i ] = GlobalPoint( p.x(), p.y(), p.z() ) ; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "Corner[" << i << "] = " << co[i]; +#endif + } +} + +void FlatHexagon::localCorners( Pt3DVec& lc , + const CCGFloat* pv , + Pt3D& ref ) { + assert( nullptr != pv ) ; + assert( 12 == lc.size() ) ; + + const CCGFloat dz ( pv[0] ) ; + const CCGFloat r ( pv[1] ) ; + const CCGFloat R ( pv[2] ) ; + + lc[0] = Pt3D ( 0 , - 2*R , -dz ); // (0,-,-) + lc[1] = Pt3D ( - r , - R , -dz ); // (-,-,-) + lc[2] = Pt3D ( - r , R , -dz ); // (-,+,-) + lc[3] = Pt3D ( 0 , 2*R , -dz ); // (0,+,-) + lc[4] = Pt3D ( r , R , -dz ); // (+,+,-) + lc[5] = Pt3D ( r , - R , -dz ); // (+,-,-) + lc[6] = Pt3D ( 0 , - 2*R , dz ); // (0,-,+) + lc[7] = Pt3D ( - r , - R , dz ); // (-,-,+) + lc[8] = Pt3D ( - r , R , dz ); // (-,+,+) + lc[9] = Pt3D ( 0 , 2*R , dz ); // (0,+,+) + lc[10]= Pt3D ( r , R , dz ); // (+,+,+) + lc[11]= Pt3D ( r , - R , dz ); // (+,-,+) + + ref = ( lc[0] + lc[1] + lc[2] + lc[3] + lc[4] + lc[5] ) / 6.0; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "Ref " << ref << " Local Corners " + << lc[0] << "|" << lc[1] << "|" << lc[2] + << "|" << lc[3] << "|" << lc[4] << "|" + << lc[5] << "|" << lc[6] << "|" << lc[7] + << "|" << lc[8] << "|" << lc[9] << "|" + << lc[10] << "|" << lc[11]; +#endif +} + +void FlatHexagon::getTransform( Tr3D& tr, Pt3DVec* lptr ) const { + const GlobalPoint& p ( CaloCellGeometry::getPosition() ) ; + const Pt3D gFront ( p.x(), p.y(), p.z() ) ; + const DPt3D dgFront ( p.x(), p.y(), p.z() ) ; + + Pt3D lFront ; + assert( nullptr != param() ) ; + std::vector lc( 12, Pt3D(0,0,0) ) ; + localCorners( lc, param(), lFront ) ; + + // figure out if reflction volume or not + + Pt3D lBack ( (lc[6]+lc[7]+lc[8]+lc[9]+lc[10]+lc[11]) / 6.0 ) ; + + const DPt3D dlFront ( lFront.x(), lFront.y(), lFront.z() ) ; + const DPt3D dlBack ( lBack.x() , lBack.y() , lBack.z() ) ; + const DPt3D dlOne ( lc[0].x() , lc[0].y() , lc[0].z() ) ; + + const FVec3D dgAxis ( axis().x(), axis().y(), axis().z() ) ; + + const DPt3D dmOne ( m_corOne.x(), m_corOne.y(), m_corOne.z() ) ; + + const DPt3D dgBack ( dgFront + ( dlBack - dlFront ).mag()*dgAxis ) ; + DPt3D dgOne ( dgFront + ( dlOne - dlFront ).mag()*( dmOne - dgFront ).unit() ) ; + + const double dlangle ( ( dlBack - dlFront).angle( dlOne - dlFront ) ) ; + const double dgangle ( ( dgBack - dgFront).angle( dgOne - dgFront ) ) ; + const double dangle ( dlangle - dgangle ) ; + + if( 1.e-6 < fabs(dangle) ) {//guard against precision problems + const DPlane3D dgPl ( dgFront, dgOne, dgBack ) ; + const DPt3D dp2 ( dgFront + dgPl.normal().unit() ) ; + + DPt3D dgOld ( dgOne ) ; + + dgOne = ( dgFront + HepGeom::Rotate3D( -dangle, dgFront, dp2 )* + DVec3D( dgOld - dgFront ) ) ; + } + + tr = Tr3D( dlFront , dlBack , dlOne , + dgFront , dgBack , dgOne ) ; + + if( nullptr != lptr ) (*lptr) = lc ; +} + +void FlatHexagon::initCorners(CaloCellGeometry::CornersVec& co) { + + if( co.uninitialized() ) { + CornersVec& corners ( co ) ; + Pt3DVec lc ; + Tr3D tr ; + getTransform( tr, &lc ) ; + + for (unsigned int i ( 0 ) ; i != 12 ; ++i ) { + const Pt3D corn ( tr*lc[i] ) ; + corners[i] = GlobalPoint( corn.x(), corn.y(), corn.z() ) ; + } + } +} + +GlobalVector FlatHexagon::makeAxis() { + return GlobalVector( backCtr() - getPosition() ).unit() ; +} + +GlobalPoint FlatHexagon::backCtr() const { + float dz = (getCorners()[6].z() > getCorners()[0].z()) ? + param()[0] : -param()[0]; + Pt3D local_b(m_local.x(),m_local.y(),m_local.z()+dz); + Pt3D global_b = m_tr*local_b; + GlobalPoint global(global_b.x(),global_b.y(),global_b.z()); + return global; +} + +//---------------------------------------------------------------------- +//---------------------------------------------------------------------- + +std::ostream& operator<<( std::ostream& s, const FlatHexagon& cell ) { + s << "Center: " << cell.getPosition() << " eta " << cell.etaPos() + << " phi " << cell.phiPos() << std::endl; + s << "Axis: " << cell.getThetaAxis() << " " << cell.getPhiAxis() < #include -//#define DebugLog +//#define EDM_ML_DEBUG typedef FlatTrd::CCGFloat CCGFloat ; typedef FlatTrd::Pt3D Pt3D ; @@ -37,10 +38,12 @@ FlatTrd& FlatTrd::operator=( const FlatTrd& tr ) { m_global = tr.m_global; m_tr = tr.m_tr; } -#ifdef DebugLog - std::cout << "FlatTrd(Copy): Local " << m_local << " Global " << m_global - << " eta " << etaPos() << " phi " << phiPos() << " Translation " - << m_tr.getTranslation() << " and rotation " << m_tr.getRotation(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd(Copy): Local " << m_local + << " Global " << m_global << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); #endif return *this ; } @@ -57,10 +60,12 @@ FlatTrd::FlatTrd( CornersMgr* cMgr , getTransform(m_tr,nullptr); Pt3D glb = m_tr*m_local; m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); -#ifdef DebugLog - std::cout << "FlatTrd: Local " << m_local << " Global " << glb << " eta " - << etaPos() << " phi " << phiPos() << " Translation " - << m_tr.getTranslation() << " and rotation " << m_tr.getRotation(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); #endif } @@ -73,10 +78,12 @@ FlatTrd::FlatTrd( const CornersVec& corn , m_axis = makeAxis(); Pt3D glb = m_tr*m_local; m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); -#ifdef DebugLog - std::cout << "FlatTrd: Local " << m_local << " Global " << glb << " eta " - << etaPos() << " phi " << phiPos() << " Translation " - << m_tr.getTranslation() << " and rotation " << m_tr.getRotation(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); #endif } @@ -85,10 +92,12 @@ FlatTrd::FlatTrd( const FlatTrd& tr, const Pt3D & local ) : *this = tr; Pt3D glb = m_tr*m_local; m_global = GlobalPoint(glb.x(),glb.y(),glb.z()); -#ifdef DebugLog - std::cout << "FlatTrd: Local " << m_local << " Global " << glb << " eta " - << etaPos() << " phi " << phiPos() << " Translation " - << m_tr.getTranslation() << " and rotation " << m_tr.getRotation(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd: Local " << m_local + << " Global " << glb << " eta " + << etaPos() << " phi " << phiPos() + << " Translation " << m_tr.getTranslation() + << " and rotation " << m_tr.getRotation(); #endif } @@ -96,24 +105,28 @@ FlatTrd::~FlatTrd() {} GlobalPoint FlatTrd::getPosition(const Pt3D& local ) const { Pt3D glb = m_tr*local; -#ifdef DebugLog - std::cout << "FlatTrd::Local " << local.x() << ":" << local.y() << ":" - << local.z() << " Global " << glb.x() << ":" << glb.y() << ":" - << glb.z() << " TR " << m_tr.xx() << ":" << m_tr.xy() << ":" - << m_tr.xz() << ":" << m_tr.yx() << ":" << m_tr.yy() << ":" - << m_tr.yz() << ":" << m_tr.zx() << ":" << m_tr.zy() << ":" - << m_tr.zz() << ":" << m_tr.dx() << ":" << m_tr.dy() << ":" - << m_tr.dz() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd::Local " << local.x() << ":" + << local.y() << ":" << local.z() + << " Global " << glb.x() << ":" << glb.y() + << ":" << glb.z() << " TR " << m_tr.xx() + << ":" << m_tr.xy() << ":" << m_tr.xz() + << ":" << m_tr.yx() << ":" << m_tr.yy() + << ":" << m_tr.yz() << ":" << m_tr.zx() + << ":" << m_tr.zy() << ":" << m_tr.zz() + << ":" << m_tr.dx() << ":" << m_tr.dy() + << ":" << m_tr.dz(); #endif return GlobalPoint(glb.x(),glb.y(),glb.z()); } Pt3D FlatTrd::getLocal(const GlobalPoint& global) const { Pt3D local = m_tr.inverse()*Pt3D(global.x(),global.y(),global.z()); -#ifdef DebugLog - std::cout << "FlatTrd::Global " << global.x() << ":" << global.y() << ":" - << global.z() << " Local " << local.x() << ":" << local.y() << ":" - << local.z() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "FlatTrd::Global " << global.x() << ":" + << global.y() << ":" << global.z() + << " Local " << local.x() << ":" + << local.y() << ":" << local.z(); #endif return local; } @@ -153,8 +166,8 @@ void FlatTrd::createCorners( const std::vector& pv , ko[i] = tr * to[i] ; // apply transformation const Pt3D & p ( ko[i] ) ; co[ i ] = GlobalPoint( p.x(), p.y(), p.z() ) ; -#ifdef DebugLog - std::cout << "Corner[" << i << "] = " << co[i] << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "Corner[" << i << "] = " << co[i]; #endif } } @@ -183,10 +196,11 @@ void FlatTrd::localCorners( Pt3DVec& lc , lc[7] = Pt3D ( - h*ta1 + bl, - h , dz ); // (+,-,+) ref = 0.25*( lc[0] + lc[1] + lc[2] + lc[3] ) ; -#ifdef DebugLog - std::cout << "Ref " << ref << " Local Corners " << lc[0] << "|" << lc[1] - << "|" << lc[2] << "|" << lc[3] << "|" << lc[4] << "|" << lc[5] - << "|" << lc[6] << "|" << lc[7] << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloGeometry") << "Ref " << ref << " Local Corners " + << lc[0] << "|" << lc[1] << "|" << lc[2] + << "|" << lc[3] << "|" << lc[4] << "|" + << lc[5] << "|" << lc[6] << "|" << lc[7]; #endif } diff --git a/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml b/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml index 67c95fd3076a8..a64dbb69d4201 100644 --- a/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml +++ b/Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml @@ -11,10 +11,34 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -104,12 +128,12 @@ - + - + diff --git a/Geometry/HGCalCommonData/data/hgcal/v9p/hgcal.xml b/Geometry/HGCalCommonData/data/hgcal/v9p/hgcal.xml new file mode 100644 index 0000000000000..455de1d440bdc --- /dev/null +++ b/Geometry/HGCalCommonData/data/hgcal/v9p/hgcal.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml b/Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml new file mode 100644 index 0000000000000..0de48904ddb23 --- /dev/null +++ b/Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml @@ -0,0 +1,71 @@ + + + + + + [hgcal:CellThicknessFine], [hgcal:CellThicknessCoarse1], + [hgcal:CellThicknessCoarse2] + + [hgcal:rad100200P0], [hgcal:rad100200P1], [hgcal:rad100200P2], + [hgcal:rad100200P3], [hgcal:rad100200P4] + + [hgcal:rad200300P0], [hgcal:rad200300P1], [hgcal:rad200300P2], + [hgcal:rad200300P3], [hgcal:rad200300P4] + + [hgcal:NCornerCut], [hgcal:zMinForRadPar] + + [hgcal:radMixL0], [hgcal:radMixL1], [hgcal:radMixL2], [hgcal:radMixL3], + [hgcal:radMixL4], [hgcal:radMixL5], [hgcal:radMixL6], [hgcal:radMixL7], + [hgcal:radMixL8], [hgcal:radMixL9], [hgcal:radMixL10],[hgcal:radMixL11], + [hgcal:radMixL12],[hgcal:radMixL13],[hgcal:radMixL14],[hgcal:radMixL15] + + + 360, 360, 360, 360, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240 + + [etaMax:slope], [etaMax:slope] + + [hgcal:slope2], [hgcal:slope3], 0, 0 + + [hgcal:zHGCal1], [hgcal:zHGCal2], [hgcal:zHGCal3], + [hgcal:zHGCal4] + + [hgcal:rMaxHGCal1], [hgcal:rMaxHGCal2], [hgcal:rMaxHGCal3], + [hgcal:rMaxHGCal4] + + [hgcal:zMinEE], [hgcal:zMinHEsil], [hgcal:zMinHEmix], + [hgcal:zMaxHEmix] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcal.xml b/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcal.xml index e451989b073c1..57f3245be3063 100644 --- a/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcal.xml +++ b/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcal.xml @@ -11,10 +11,18 @@ - - - - + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml b/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml index 30678536b18de..3d06ede303803 100644 --- a/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml +++ b/Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml @@ -57,11 +57,17 @@ - - + + [hgcal:rad100200P0], [hgcal:rad100200P1], [hgcal:rad100200P2], + [hgcal:rad100200P3], [hgcal:rad100200P4] + + [hgcal:rad200300P0], [hgcal:rad200300P1], [hgcal:rad200300P2], + [hgcal:rad200300P3], [hgcal:rad200300P4] + + - + [etaMax:slope], [etaMax:slope] diff --git a/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcal.xml b/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcal.xml index 0d2d184e162c7..98329b1f6c1ae 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcal.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcal.xml @@ -11,10 +11,34 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml b/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml index f2581fba3c4a8..eef4f2bbb73cd 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml @@ -16,24 +16,33 @@ HEHeatShield 35.0*mm, 68.0*mm, 1.0*mm, 1.0*mm, 7.9*mm, 6.0*mm - - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 - + + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 + 50.9*mm, 50.9*mm, 50.9*mm, 50.9*mm, 83.9*mm, 83.9*mm, - 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm - - 1380.0*mm, 1320.0*mm, 1200.0*mm, 1200.0*mm, 1150.0*mm, 1060.0*mm, - 910.0*mm, 910.0*mm, 910.0*mm, 910.0*mm, 910.0*mm, 910.0*mm - + 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm, + 83.9*mm, 83.9*mm, 83.9*mm, 83.9*mm + + [hgcal:radMixL0], [hgcal:radMixL1], [hgcal:radMixL2], + [hgcal:radMixL3], [hgcal:radMixL4], [hgcal:radMixL5], + [hgcal:radMixL6], [hgcal:radMixL7], [hgcal:radMixL8], + [hgcal:radMixL9], [hgcal:radMixL10], [hgcal:radMixL11], + [hgcal:radMixL12], [hgcal:radMixL13], [hgcal:radMixL14], + [hgcal:radMixL15] + 0, 2, 3, 4, 5, 0, 2, 3, 4, 5, 0, 2, 3, 4, 5, 0, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, - 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 - + 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, + 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, + 1, 2, 3, 4, 5 + + 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0 + 0, 0, 0, 1, 0 materials:Cables, materials:H_Scintillator, @@ -56,11 +65,17 @@ 0, 0, 0, 0, 1, 0 - - + + [hgcal:rad100200P0], [hgcal:rad100200P1], [hgcal:rad100200P2], + [hgcal:rad100200P3], [hgcal:rad100200P4] + + [hgcal:rad200300P0], [hgcal:rad200300P1], [hgcal:rad200300P2], + [hgcal:rad200300P3], [hgcal:rad200300P4] + + - + [etaMax:slope], [etaMax:slope] diff --git a/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcal.xml b/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcal.xml index 8407714e8c4f9..b254e1b034f54 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcal.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcal.xml @@ -11,10 +11,18 @@ - - - - + + + + + + + + + + + + diff --git a/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml b/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml index 92fe6c52b6039..06cc87e7dc422 100644 --- a/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml +++ b/Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml @@ -43,11 +43,17 @@ 0, 0, 0, 0, 0, 0, 1, 0, 0 - - + + [hgcal:rad100200P0], [hgcal:rad100200P1], [hgcal:rad100200P2], + [hgcal:rad100200P3], [hgcal:rad100200P4] + + [hgcal:rad200300P0], [hgcal:rad200300P1], [hgcal:rad200300P2], + [hgcal:rad200300P3], [hgcal:rad200300P4] + + - + [etaMax:slope], [etaMax:slope] diff --git a/Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml b/Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml index c9597c2778a6a..cdfe40f98bc26 100644 --- a/Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml +++ b/Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml @@ -168,7 +168,7 @@ hgcalcell:HGCalHECellFull0Coarse2, hgcalcell:HGCalHECellTrunc01Coarse2, hgcalcell:HGCalHECellTrunc02Coarse2, hgcalcell:HGCalHECellTrunc03Coarse2, hgcalcell:HGCalHECellExten01Coarse2, hgcalcell:HGCalHECellExten02Coarse2, - hgcalcell:HGCalHECellExten03Coarse2, hgcalcell:HGCalHECellCorner01Coarse2, + hgcalcell:HGCalHECellExten03Coarse2, hgcalcell:HGCalHECellCorner01Coarse2, hgcalcell:HGCalHECellCorner02Coarse2,hgcalcell:HGCalHECellCorner03Coarse2, hgcalcell:HGCalHECellCorner04Coarse2,hgcalcell:HGCalHECellCorner05Coarse2, hgcalcell:HGCalHECellCorner06Coarse2 diff --git a/Geometry/HGCalCommonData/interface/HGCalGeometryMode.h b/Geometry/HGCalCommonData/interface/HGCalGeometryMode.h index fd069940c1599..8271a1ce6adbe 100644 --- a/Geometry/HGCalCommonData/interface/HGCalGeometryMode.h +++ b/Geometry/HGCalCommonData/interface/HGCalGeometryMode.h @@ -23,7 +23,8 @@ class HGCalStringToEnumParser { }; namespace HGCalGeometryMode { - enum GeometryMode { Square=0, Hexagon=1, HexagonFull=2 }; + enum GeometryMode { Square=0, Hexagon=1, HexagonFull=2, Hexagon8=3, + Hexagon8Full=4, Trapezoid=5}; enum WaferMode { Polyhedra=0, ExtrudedPolygon=1}; } diff --git a/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h b/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h index 32eb15f7cee51..91d4ecc5fc6e4 100644 --- a/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h +++ b/Geometry/HGCalCommonData/interface/HGCalParametersFromDD.h @@ -1,6 +1,7 @@ #ifndef HGCalCommonData_HGCalParametersFromDD_h #define HGCalCommonData_HGCalParametersFromDD_h +#include "DetectorDescription/Core/interface/DDsvalues.h" #include class DDCompactView; @@ -13,6 +14,9 @@ class HGCalParametersFromDD { bool build(const DDCompactView*, HGCalParameters&, const std::string&, const std::string&, const std::string&); + +private: + double getDDDValue(const char* s, const DDsvalues_type& sv); }; #endif diff --git a/Geometry/HGCalCommonData/interface/HGCalWaferType.h b/Geometry/HGCalCommonData/interface/HGCalWaferType.h new file mode 100644 index 0000000000000..17f05da72e33c --- /dev/null +++ b/Geometry/HGCalCommonData/interface/HGCalWaferType.h @@ -0,0 +1,42 @@ +#ifndef HGCalCommonData_HGCalWaferType_h +#define HGCalCommonData_HGCalWaferType_h + +/** \class HGCalWaferType + * + * this class determines the wafer type depending on its position + * (taken from Philippe Bloch's parametrisation) + * rad100, rad200 parameters assume r,z to be in cm + * xpos, ypos, zpos, zmin, waferSize are all in mm + * + * $Date: 2018/03/22 00:06:50 $ + * \author Sunanda Banerjee, Fermilab + * + */ + +#include +#include +#include + +class HGCalWaferType { + +public: + + HGCalWaferType(const std::vector& rad100, + const std::vector& rad200, + double waferSize, double zMin, int cutValue); + ~HGCalWaferType(); + int getType(double xpos, double ypos, double zpos); + std::pair rLimits(double zpos); + +private: + + const double sqrt3_ = 1.0/std::sqrt(3.0); + const std::vector rad100_; + const std::vector rad200_; + const double waferSize_; + const double zMin_; + const int cutValue_; + double r_, R_; +}; + +#endif diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc index 1858deb773523..aad35834b7d7f 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.cc @@ -21,7 +21,7 @@ DDHGCalEEAlgo::DDHGCalEEAlgo() { #endif } -DDHGCalEEAlgo::~DDHGCalEEAlgo() {} +DDHGCalEEAlgo::~DDHGCalEEAlgo() { } void DDHGCalEEAlgo::initialize(const DDNumericArguments & nArgs, const DDVectorArguments & vArgs, @@ -87,17 +87,24 @@ void DDHGCalEEAlgo::initialize(const DDNumericArguments & nArgs, << layerSense_[i]; #endif zMinBlock_ = nArgs["zMinBlock"]; - rMaxFine_ = nArgs["rMaxFine"]; - rMinThick_ = nArgs["rMinThick"]; + rad100to200_ = vArgs["rad100to200"]; + rad200to300_ = vArgs["rad200to300"]; + zMinRadPar_ = nArgs["zMinForRadPar"]; + nCutRadPar_ = (int)(nArgs["nCornerCut"]); waferSize_ = nArgs["waferSize"]; waferSepar_ = nArgs["SensorSeparation"]; sectors_ = (int)(nArgs["Sectors"]); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalGeom") << "zStart " << zMinBlock_ << " rFineCoarse " - << rMaxFine_ << " rMaxThick " << rMinThick_ + edm::LogVerbatim("HGCalGeom") << "zStart " << zMinBlock_ + << " radius for wafer type separation uses " + << rad100to200_.size() << " parameters; zmin " + << zMinRadPar_ << " cutoff " << nCutRadPar_ << " wafer width " << waferSize_ << " separations " << waferSepar_ << " sectors " << sectors_; + for (unsigned int k=0; k(rad100to200_, rad200to300_, + (waferSize_+waferSepar_), + zMinRadPar_, nCutRadPar_); } //////////////////////////////////////////////////////////////////// @@ -217,7 +228,7 @@ void DDHGCalEEAlgo::constructLayers(const DDLogicalPart& module, << " and position " << glog.name() << " number " << copy; #endif - positionSensitive(glog,rinB,routF,layerSense_[ly],cpv); + positionSensitive(glog,rinB,routF,zz,layerSense_[ly],cpv); } DDTranslation r1(0,0,zz); DDRotation rot; @@ -233,7 +244,7 @@ void DDHGCalEEAlgo::constructLayers(const DDLogicalPart& module, } // End of loop over layers in a block zi = zo; laymin = laymax; - if (fabs(thickTot-layerThick_[i]) < 0.00001) { + if (std::abs(thickTot-layerThick_[i]) < 0.00001) { } else if (thickTot > layerThick_[i]) { edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick_[i] << " is smaller than " @@ -267,7 +278,7 @@ double DDHGCalEEAlgo::rMax(double z) { } void DDHGCalEEAlgo::positionSensitive(const DDLogicalPart& glog, double rin, - double rout, int layertype, + double rout, double zpos, int layertype, DDCompactView& cpv) { static const double sqrt3 = std::sqrt(3.0); double r = 0.5*(waferSize_ + waferSepar_); @@ -306,7 +317,8 @@ void DDHGCalEEAlgo::positionSensitive(const DDLogicalPart& glog, double rin, ++ntot; #endif if (cornerOne) { - int copy = iv*100 + iu; + int type = waferType_->getType(xpos,ypos,zpos); + int copy = type*1000000 + iv*100 + iu; if (u < 0) copy += 10000; if (v < 0) copy += 100000; #ifdef EDM_ML_DEBUG @@ -321,10 +333,8 @@ void DDHGCalEEAlgo::positionSensitive(const DDLogicalPart& glog, double rin, if (iv > ivmAll) ivmAll = iv; ++nin; #endif - double rpos = std::sqrt(xpos*xpos+ypos*ypos); DDTranslation tran(xpos, ypos, 0.0); DDRotation rotation; - int type = (rpos < rMaxFine_) ? 0 : ((rpos < rMinThick_) ? 1 : 2); if (layertype > 1) type += 3; DDName name = DDName(DDSplit(wafers_[type]).first, DDSplit(wafers_[type]).second); diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h index 3f1dcc25f01f0..7518251849176 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h +++ b/Geometry/HGCalCommonData/plugins/DDHGCalEEAlgo.h @@ -1,12 +1,16 @@ #ifndef HGCalCommonData_DDHGCalEEAlgo_h #define HGCalCommonData_DDHGCalEEAlgo_h +#include +#include #include +#include #include + #include "DetectorDescription/Core/interface/DDTypes.h" #include "DetectorDescription/Core/interface/DDAlgorithm.h" #include "DetectorDescription/Core/interface/DDLogicalPart.h" -#include +#include "Geometry/HGCalCommonData/interface/HGCalWaferType.h" class DDHGCalEEAlgo : public DDAlgorithm { @@ -27,11 +31,13 @@ class DDHGCalEEAlgo : public DDAlgorithm { void constructLayers (const DDLogicalPart&, DDCompactView& cpv); double rMax(double z); void positionSensitive(const DDLogicalPart& glog, double rin, - double rout, int layertype, + double rout, double zpos, int layertype, DDCompactView& cpv); private: + std::unique_ptr waferType_; + std::vector wafers_; //Wafers std::vector materials_; //Materials std::vector names_; //Names @@ -43,8 +49,10 @@ class DDHGCalEEAlgo : public DDAlgorithm { std::vector layerSense_; //Content of a layer (sensitive?) int firstLayer_; //Copy # of the first sensitive layer double zMinBlock_; //Starting z-value of the block - double rMaxFine_; //Maximum r-value for fine wafer - double rMinThick_; //Transition R between 200 & 300 mum + std::vector rad100to200_; //Parameters for 120-200mum trans. + std::vector rad200to300_; //Parameters for 200-300mum trans. + double zMinRadPar_; //Minimum z for radius parametriz. + int nCutRadPar_; //Cut off threshold for corners double waferSize_; //Width of the wafer double waferSepar_; //Sensor separation int sectors_; //Sectors diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc index 3e5c7d21d5c21..b2cd1525ebd05 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.cc @@ -20,7 +20,7 @@ DDHGCalHEAlgo::DDHGCalHEAlgo() { #endif } -DDHGCalHEAlgo::~DDHGCalHEAlgo() {} +DDHGCalHEAlgo::~DDHGCalHEAlgo() { } void DDHGCalHEAlgo::initialize(const DDNumericArguments & nArgs, const DDVectorArguments & vArgs, @@ -131,18 +131,24 @@ void DDHGCalHEAlgo::initialize(const DDNumericArguments & nArgs, << layerSenseBot_[i]; #endif zMinBlock_ = nArgs["zMinBlock"]; - rMaxFine_ = nArgs["rMaxFine"]; - rMinThick_ = nArgs["rMinThick"]; + rad100to200_ = vArgs["rad100to200"]; + rad200to300_ = vArgs["rad200to300"]; + zMinRadPar_ = nArgs["zMinForRadPar"]; + nCutRadPar_ = (int)(nArgs["nCornerCut"]); waferSize_ = nArgs["waferSize"]; waferSepar_ = nArgs["SensorSeparation"]; sectors_ = (int)(nArgs["Sectors"]); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: zStart " << zMinBlock_ - << " rFineCoarse " << rMaxFine_ - << " rMaxThick " << rMinThick_ + << " radius for wafer type separation uses " + << rad100to200_.size() << " parameters; zmin " + << zMinRadPar_ << " cutoff " << nCutRadPar_ << " wafer width " << waferSize_ << " separations " << waferSepar_ << " sectors " << sectors_; + for (unsigned int k=0; k(rad100to200_, rad200to300_, + (waferSize_+waferSepar_), + zMinRadPar_, nCutRadPar_); } //////////////////////////////////////////////////////////////////// @@ -261,7 +271,7 @@ void DDHGCalHEAlgo::constructLayers(const DDLogicalPart& module, << " number " << copy; #endif positionMix(glog, name, copy, thick_[ii], matter, rinB, rMixLayer_[i], - routF, cpv); + routF, zz, cpv); } DDTranslation r1(0,0,zz); DDRotation rot; @@ -277,7 +287,7 @@ void DDHGCalHEAlgo::constructLayers(const DDLogicalPart& module, } // End of loop over layers in a block zi = zo; laymin = laymax; - if (fabs(thickTot-layerThick_[i]) < 0.00001) { + if (std::abs(thickTot-layerThick_[i]) < 0.00001) { } else if (thickTot > layerThick_[i]) { edm::LogError("HGCalGeom") << "Thickness of the partition " << layerThick_[i] << " is smaller than " @@ -314,7 +324,7 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, const std::string& nameM, int copyM, double thick, const DDMaterial& matter, double rin, double rmid, double rout, - DDCompactView& cpv) { + double zz, DDCompactView& cpv) { DDLogicalPart glog1; DDTranslation tran; @@ -353,7 +363,7 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, int copy = copyNumberTop_[ii]; double hthickl = 0.5*layerThickTop_[ii]; thickTot += layerThickTop_[ii]; - name = nameM+namesTop_[ii]+std::to_string(copy); + name = "HGCal"+namesTop_[ii]+std::to_string(copy); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":" << ii << " R " << rmid << ":" << rout << " Thick " @@ -366,6 +376,11 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, 0.0, CLHEP::twopi); DDLogicalPart glog2 = DDLogicalPart(solid.ddname(), matter1, solid); #ifdef EDM_ML_DEBUG + double eta1 = -log(tan(0.5*atan(rmid/zz))); + double eta2 = -log(tan(0.5*atan(rout/zz))); + edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << zz << ":" + << rmid << ":" << rout << " eta " << eta1 + << ":" << eta2; edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name() << " Tubs made of " << matName << " of dimensions " << rmid << ", " << rout @@ -384,7 +399,7 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, ++copyNumberTop_[ii]; zpos += hthickl; } - if (fabs(thickTot-thick) < 0.00001) { + if (std::abs(thickTot-thick) < 0.00001) { } else if (thickTot > thick) { edm::LogError("HGCalGeom") << "Thickness of the partition " << thick << " is smaller than " << thickTot @@ -421,7 +436,7 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, int copy = copyNumberBot_[ii]; double hthickl = 0.5*layerThickBot_[ii]; thickTot += layerThickBot_[ii]; - name = nameM+namesBot_[ii]+std::to_string(copy); + name = "HGCal"+namesBot_[ii]+std::to_string(copy); #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: Layer " << ly << ":" << ii << " R " << rin << ":" << rmid << " Thick " @@ -434,6 +449,11 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, 0.0, CLHEP::twopi); DDLogicalPart glog2 = DDLogicalPart(solid.ddname(), matter1, solid); #ifdef EDM_ML_DEBUG + double eta1 = -log(tan(0.5*atan(rin/zz))); + double eta2 = -log(tan(0.5*atan(rmid/zz))); + edm::LogVerbatim("HGCalGeom") << name << " z|rin|rout " << zz << ":" + << rin << ":" << rmid << " eta " << eta1 + << ":" << eta2; edm::LogVerbatim("HGCalGeom") << "DDHGCalHEAlgo: " << solid.name() << " Tubs made of " << matName << " of dimensions " << rin << ", " << rmid @@ -449,12 +469,12 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, << glog1.name() << " at " << r1 << " with " << rot; #endif + if (layerSenseBot_[ly] != 0) + positionSensitive(glog2,rin,rmid,zz+zpos,layerSenseBot_[ly],cpv); zpos += hthickl; ++copyNumberBot_[ii]; - if (layerSenseBot_[ly] != 0) - positionSensitive(glog2,rin,rmid,layerSenseBot_[ly],cpv); } - if (fabs(thickTot-thick) < 0.00001) { + if (std::abs(thickTot-thick) < 0.00001) { } else if (thickTot > thick) { edm::LogError("HGCalGeom") << "Thickness of the partition " << thick << " is smaller than " << thickTot @@ -468,7 +488,7 @@ void DDHGCalHEAlgo::positionMix(const DDLogicalPart& glog, } void DDHGCalHEAlgo::positionSensitive(const DDLogicalPart& glog, double rin, - double rout, int layertype, + double rout, double zpos, int layertype, DDCompactView& cpv) { static const double sqrt3 = std::sqrt(3.0); double r = 0.5*(waferSize_ + waferSepar_); @@ -507,7 +527,8 @@ void DDHGCalHEAlgo::positionSensitive(const DDLogicalPart& glog, double rin, ++ntot; #endif if (cornerOne) { - int copy = iv*100 + iu; + int type = waferType_->getType(xpos,ypos,zpos); + int copy = type*1000000 + iv*100 + iu; if (u < 0) copy += 10000; if (v < 0) copy += 100000; #ifdef EDM_ML_DEBUG @@ -522,10 +543,8 @@ void DDHGCalHEAlgo::positionSensitive(const DDLogicalPart& glog, double rin, if (iv > ivmAll) ivmAll = iv; ++nin; #endif - double rpos = std::sqrt(xpos*xpos+ypos*ypos); DDTranslation tran(xpos, ypos, 0.0); DDRotation rotation; - int type = (rpos < rMaxFine_) ? 0 : ((rpos < rMinThick_) ? 1 : 2); if (layertype > 1) type += 3; DDName name = DDName(DDSplit(wafers_[type]).first, DDSplit(wafers_[type]).second); diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h index 38928c778b235..1332f489b9afe 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h +++ b/Geometry/HGCalCommonData/plugins/DDHGCalHEAlgo.h @@ -1,13 +1,17 @@ #ifndef HGCalCommonData_DDHGCalHEAlgo_h #define HGCalCommonData_DDHGCalHEAlgo_h +#include +#include #include +#include #include + #include "DetectorDescription/Core/interface/DDTypes.h" #include "DetectorDescription/Core/interface/DDAlgorithm.h" #include "DetectorDescription/Core/interface/DDLogicalPart.h" #include "DetectorDescription/Core/interface/DDMaterial.h" -#include +#include "Geometry/HGCalCommonData/interface/HGCalWaferType.h" class DDHGCalHEAlgo : public DDAlgorithm { @@ -29,14 +33,16 @@ class DDHGCalHEAlgo : public DDAlgorithm { double rMax(double z); void positionMix(const DDLogicalPart& glog,const std::string& name, int copy, double thick, const DDMaterial& matter, - double rin, double rmid, double routF, + double rin, double rmid, double routF, double zz, DDCompactView& cpv); void positionSensitive(const DDLogicalPart& glog, double rin, - double rout, int layertype, + double rout, double zpos, int layertype, DDCompactView& cpv); private: + std::unique_ptr waferType_; + std::vector wafers_; //Wafers std::vector materials_; //Materials std::vector names_; //Names @@ -61,8 +67,10 @@ class DDHGCalHEAlgo : public DDAlgorithm { std::vector layerSenseBot_; //Content of bottom layer (sensitive?) double zMinBlock_; //Starting z-value of the block - double rMaxFine_; //Maximum r-value for fine wafer - double rMinThick_; //Transition R between 200 & 300 mum + std::vector rad100to200_; //Parameters for 120-200mum trans. + std::vector rad200to300_; //Parameters for 200-300mum trans. + double zMinRadPar_; //Minimum z for radius parametriz. + int nCutRadPar_; //Cut off threshold for corners double waferSize_; //Width of the wafer double waferSepar_; //Sensor separation int sectors_; //Sectors diff --git a/Geometry/HGCalCommonData/python/testHGCXML_cfi.py b/Geometry/HGCalCommonData/python/testHGCXML_cfi.py index 22e687704d45d..69b5a4db2d38e 100644 --- a/Geometry/HGCalCommonData/python/testHGCXML_cfi.py +++ b/Geometry/HGCalCommonData/python/testHGCXML_cfi.py @@ -8,12 +8,15 @@ 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', 'Geometry/CMSCommonData/data/eta3/etaMax.xml', 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/caloBase/2023/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', 'Geometry/HGCalCommonData/data/hgcal/v9/hgcal.xml', 'Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml', 'Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml', 'Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml', 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', 'Geometry/HGCalCommonData/data/hgcalcell/v9/hgcalcell.xml', + 'Geometry/HGCalCommonData/data/hgcalCons/v9/hgcalCons.xml', 'Geometry/CMSCommonData/data/FieldParameters.xml', ), rootNodeName = cms.string('cms:OCMS') diff --git a/Geometry/HGCalCommonData/python/testHGCalEEXML_cfi.py b/Geometry/HGCalCommonData/python/testHGCalEEXML_cfi.py index e577dbb036642..3edd91ed7950e 100644 --- a/Geometry/HGCalCommonData/python/testHGCalEEXML_cfi.py +++ b/Geometry/HGCalCommonData/python/testHGCalEEXML_cfi.py @@ -8,6 +8,8 @@ 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', 'Geometry/CMSCommonData/data/eta3/etaMax.xml', 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/caloBase/2023/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', 'Geometry/HGCalCommonData/data/hgcalEE/v9/hgcal.xml', 'Geometry/HGCalCommonData/data/hgcalEE/v9/hgcalEE.xml', 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', diff --git a/Geometry/HGCalCommonData/python/testHGCalHEmixXML_cfi.py b/Geometry/HGCalCommonData/python/testHGCalHEmixXML_cfi.py index 5ca7964453394..fa7b065b0d9b2 100644 --- a/Geometry/HGCalCommonData/python/testHGCalHEmixXML_cfi.py +++ b/Geometry/HGCalCommonData/python/testHGCalHEmixXML_cfi.py @@ -8,6 +8,8 @@ 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', 'Geometry/CMSCommonData/data/eta3/etaMax.xml', 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/caloBase/2023/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', 'Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcal.xml', 'Geometry/HGCalCommonData/data/hgcalHEmix/v9/hgcalHEmix.xml', 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', diff --git a/Geometry/HGCalCommonData/python/testHGCalHEsilXML_cfi.py b/Geometry/HGCalCommonData/python/testHGCalHEsilXML_cfi.py index e0597e30da6b8..1004daa9d2d37 100644 --- a/Geometry/HGCalCommonData/python/testHGCalHEsilXML_cfi.py +++ b/Geometry/HGCalCommonData/python/testHGCalHEsilXML_cfi.py @@ -8,6 +8,8 @@ 'Geometry/CMSCommonData/data/cms/2019/v1/cms.xml', 'Geometry/CMSCommonData/data/eta3/etaMax.xml', 'Geometry/CMSCommonData/data/cmsMother.xml', + 'Geometry/CMSCommonData/data/caloBase/2023/v1/caloBase.xml', + 'Geometry/CMSCommonData/data/cmsCalo.xml', 'Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcal.xml', 'Geometry/HGCalCommonData/data/hgcalHEsil/v9/hgcalHEsil.xml', 'Geometry/HGCalCommonData/data/hgcalwafer/v9/hgcalwafer.xml', diff --git a/Geometry/HGCalCommonData/src/HGCalGeometryMode.cc b/Geometry/HGCalCommonData/src/HGCalGeometryMode.cc index d436a4f260674..f49005ecc06c0 100644 --- a/Geometry/HGCalCommonData/src/HGCalGeometryMode.cc +++ b/Geometry/HGCalCommonData/src/HGCalGeometryMode.cc @@ -2,13 +2,17 @@ template<> HGCalStringToEnumParser::HGCalStringToEnumParser() { - enumMap["HGCalGeometryMode::Hexagon"] = HGCalGeometryMode::Hexagon; - enumMap["HGCalGeometryMode::HexagonFull"] = HGCalGeometryMode::HexagonFull; -} + enumMap["HGCalGeometryMode::Square"] = HGCalGeometryMode::Square; + enumMap["HGCalGeometryMode::Hexagon"] = HGCalGeometryMode::Hexagon; + enumMap["HGCalGeometryMode::HexagonFull"] = HGCalGeometryMode::HexagonFull; + enumMap["HGCalGeometryMode::Hexagon8"] = HGCalGeometryMode::Hexagon8; + enumMap["HGCalGeometryMode::Hexagon8Full"] = HGCalGeometryMode::Hexagon8Full; + enumMap["HGCalGeometryMode::Trapezoid"] = HGCalGeometryMode::Trapezoid; + } template<> HGCalStringToEnumParser::HGCalStringToEnumParser() { - enumMap["HGCalGeometryMode::Polyhedra"] = HGCalGeometryMode::Polyhedra; + enumMap["HGCalGeometryMode::Polyhedra"] = HGCalGeometryMode::Polyhedra; enumMap["HGCalGeometryMode::ExtrudedPolygon"] = HGCalGeometryMode::ExtrudedPolygon; } diff --git a/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc b/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc index 64861d9e0c679..31a12c7db4e6c 100644 --- a/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc +++ b/Geometry/HGCalCommonData/src/HGCalParametersFromDD.cc @@ -56,8 +56,9 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv, const std::string& namec) { #ifdef EDM_ML_DEBUG - std::cout << "HGCalParametersFromDD::build called with names " << name << ":" - << namew << ":" << namec << std::endl; + edm::LogVerbatim("HGCalGeom") << "HGCalParametersFromDD::build called with " + << "names " << name << ":" << namew << ":" + << namec; #endif //Special parameters at simulation level @@ -73,9 +74,9 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv, DDsvalues_type sv(fv.mergedSpecifics()); php.mode_ = getGeometryMode("GeometryMode", sv); #ifdef EDM_ML_DEBUG - std::cout << "GeometryMode " << php.mode_ - << ":" << HGCalGeometryMode::Hexagon << ":" - << HGCalGeometryMode::HexagonFull << std::endl; + edm::LogVerbatim("HGCalGeom") << "GeometryMode " << php.mode_ + << ":" << HGCalGeometryMode::Hexagon << ":" + << HGCalGeometryMode::HexagonFull; #endif HGCalGeomParameters *geom = new HGCalGeomParameters(); if ((php.mode_ == HGCalGeometryMode::Hexagon) || @@ -90,8 +91,9 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv, DDsvalues_type sv2(fv2.mergedSpecifics()); mode = getGeometryWaferMode("WaferMode", sv2); #ifdef EDM_ML_DEBUG - std::cout << "WaferMode " << mode << ":" << HGCalGeometryMode::Polyhedra - << ":" << HGCalGeometryMode::ExtrudedPolygon << std::endl; + edm::LogVerbatim("HGCalGeom") << "WaferMode " << mode << ":" + << HGCalGeometryMode::Polyhedra << ":" + << HGCalGeometryMode::ExtrudedPolygon; #endif } } @@ -130,3 +132,17 @@ bool HGCalParametersFromDD::build(const DDCompactView* cpv, << ok; return ok; } + +double HGCalParametersFromDD::getDDDValue(const char* s, + const DDsvalues_type& sv) { + DDValue val(s); + if (DDfetch(&sv, val)) { + const std::vector & fvec = val.doubles(); + if (fvec.empty()) { + throw cms::Exception("HGCalGeom") << "Failed to get " << s << " tag."; + } + return fvec[0]; + } else { + throw cms::Exception("HGCalGeom") << "Failed to get "<< s << " tag"; + } +} diff --git a/Geometry/HGCalCommonData/src/HGCalWaferType.cc b/Geometry/HGCalCommonData/src/HGCalWaferType.cc new file mode 100644 index 0000000000000..7965c104c04b5 --- /dev/null +++ b/Geometry/HGCalCommonData/src/HGCalWaferType.cc @@ -0,0 +1,73 @@ +#include "Geometry/HGCalCommonData/interface/HGCalWaferType.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include + +//#define EDM_ML_DEBUG + +const double k_ScaleFromDDD = 0.1; + +HGCalWaferType::HGCalWaferType(const std::vector& rad100, + const std::vector& rad200, + double waferSize, double zMin, + int cutValue) : rad100_(rad100), + rad200_(rad200), + waferSize_(waferSize), + zMin_(zMin), + cutValue_(cutValue) { + r_ = 0.5*waferSize_; + R_ = sqrt3_*waferSize_; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HGCalGeom") << "HGCalWaferType: initialized with waferR's " + << waferSize_ << ":" << r_ << ":" << R_ + << " Cut " << cutValue_ << " zMin " << zMin_ + << " with " << rad100_.size() << ":" + << rad200_.size() << " parameters for R:"; + for (unsigned k=0; k rv = rLimits(zpos); + int fine(0), coarse(0); + for (int k=0; k<6; ++k) { + double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]); + if (rpos <= rv.first) ++fine; + else if (rpos <= rv.second) ++coarse; + } + int type = 2; + if (fine >= cutValue_) type = 0; + else if (coarse >= cutValue_) type = 1; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HGCalGeom") << "HGCalWaferType: position " << xpos << ":" + << ypos << ":" << zpos << " R " << ":" + << rv.first << ":" << rv.second + << " corners|type " << fine << ":" << coarse + << ":" << type ; +#endif + return type; +} + +std::pair HGCalWaferType::rLimits(double zpos) { + double zz = std::abs(zpos); + if (zz < zMin_) zz = zMin_; + zz *= k_ScaleFromDDD; + double rfine = rad100_[0]; + double rcoarse = rad200_[0]; + for (int i=1; i<5; ++i) { + rfine *= zz; rfine += rad100_[i]; + rcoarse *= zz; rcoarse += rad200_[i]; + } + return std::pair(rfine/k_ScaleFromDDD,rcoarse/k_ScaleFromDDD); +} + diff --git a/Geometry/HGCalCommonData/test/dumpSimGeometry_cfg.py b/Geometry/HGCalCommonData/test/dumpHGCalGeometry_cfg.py similarity index 68% rename from Geometry/HGCalCommonData/test/dumpSimGeometry_cfg.py rename to Geometry/HGCalCommonData/test/dumpHGCalGeometry_cfg.py index 30f798240d048..ff15753ac81f5 100644 --- a/Geometry/HGCalCommonData/test/dumpSimGeometry_cfg.py +++ b/Geometry/HGCalCommonData/test/dumpHGCalGeometry_cfg.py @@ -2,6 +2,12 @@ process = cms.Process("DUMP") process.load("Geometry.HGCalCommonData.testHGCXML_cfi") +process.load('FWCore.MessageService.MessageLogger_cfi') + +if 'MessageLogger' in process.__dict__: + process.MessageLogger.categories.append('G4cerr') + process.MessageLogger.categories.append('G4cout') + process.MessageLogger.categories.append('HGCalGeom') process.source = cms.Source("EmptySource") diff --git a/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h b/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h new file mode 100644 index 0000000000000..455de58ce3408 --- /dev/null +++ b/Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h @@ -0,0 +1,77 @@ +#ifndef Geometry_TrackerGeometryBuilder_phase1PixelTopology_h +#define Geometry_TrackerGeometryBuilder_phase1PixelTopology_h + +#include + +namespace phase1PixelTopology { + + constexpr uint16_t numRowsInRoc = 80; + constexpr uint16_t numColsInRoc = 52; + constexpr uint16_t lastRowInRoc = numRowsInRoc - 1; + constexpr uint16_t lastColInRoc = numColsInRoc - 1; + + constexpr uint16_t numRowsInModule = 2 * numRowsInRoc; + constexpr uint16_t numColsInModule = 8 * numColsInRoc; + constexpr uint16_t lastRowInModule = numRowsInModule - 1; + constexpr uint16_t lastColInModule = numColsInModule - 1; + + constexpr int16_t xOffset = -81; + constexpr int16_t yOffset = -54*4; + + constexpr uint32_t numPixsInModule = uint32_t(numRowsInModule)* uint32_t(numColsInModule); + + // this is for the ROC n<512 (upgrade 1024) + constexpr inline + uint16_t divu52(uint16_t n) { + n = n>>2; + uint16_t q = (n>>1) + (n>>4); + q = q + (q>>4) + (q>>5); q = q >> 3; + uint16_t r = n - q*13; + return q + ((r + 3) >> 4); + } + + constexpr inline + bool isEdgeX(uint16_t px) { return (px==0) | (px==lastRowInModule);} + constexpr inline + bool isEdgeY(uint16_t py) { return (py==0) | (py==lastColInModule);} + + + constexpr inline + uint16_t toRocX(uint16_t px) { return (pxlastRowInRoc) shift+=1; + if (px>numRowsInRoc) shift+=1; + return px+shift; + } + + constexpr inline + uint16_t localY(uint16_t py) { + auto roc = divu52(py); + auto shift = 2*roc; + auto yInRoc = py - 52*roc; + if (yInRoc>0) shift+=1; + return py+shift; + } + +} + +#endif // Geometry_TrackerGeometryBuilder_phase1PixelTopology_h diff --git a/Geometry/TrackerGeometryBuilder/test/BuildFile.xml b/Geometry/TrackerGeometryBuilder/test/BuildFile.xml index 949f4d81bc9a9..b67f820e5e9de 100644 --- a/Geometry/TrackerGeometryBuilder/test/BuildFile.xml +++ b/Geometry/TrackerGeometryBuilder/test/BuildFile.xml @@ -1,29 +1,31 @@ - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - + + + + + diff --git a/Geometry/TrackerGeometryBuilder/test/phase1PixelTopology_t.cpp b/Geometry/TrackerGeometryBuilder/test/phase1PixelTopology_t.cpp new file mode 100644 index 0000000000000..b9f9a4f3b3487 --- /dev/null +++ b/Geometry/TrackerGeometryBuilder/test/phase1PixelTopology_t.cpp @@ -0,0 +1,145 @@ +#include +#include +#include + +#include "Geometry/TrackerGeometryBuilder/interface/phase1PixelTopology.h" + +namespace { + + // original code from CMSSW_4_4 + + std::tuple localXori(int mpx) { + const float m_pitchx=1.f; + int binoffx = int(mpx); // truncate to int + float local_pitchx = m_pitchx; // defaultpitch + + if (binoffx>80) { // ROC 1 - handles x on edge cluster + binoffx=binoffx+2; + } else if (binoffx==80) { // ROC 1 + binoffx=binoffx+1; + local_pitchx = 2 * m_pitchx; + + } else if (binoffx==79) { // ROC 0 + binoffx=binoffx+0; + local_pitchx = 2 * m_pitchx; + } else if (binoffx>=0) { // ROC 0 + binoffx=binoffx+0; + + } else { // too small + assert("binoffx too small"==0); + } + + return std::make_tuple(binoffx,local_pitchx>m_pitchx); + } + + std::tuple localYori(int mpy) { + const float m_pitchy=1.f; + int binoffy = int(mpy); // truncate to int + float local_pitchy = m_pitchy; // defaultpitch + + if (binoffy>416) { // ROC 8, not real ROC + binoffy=binoffy+17; + } else if (binoffy==416) { // ROC 8 + binoffy=binoffy+16; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==415) { // ROC 7, last big pixel + binoffy=binoffy+15; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>364) { // ROC 7 + binoffy=binoffy+15; + } else if (binoffy==364) { // ROC 7 + binoffy=binoffy+14; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==363) { // ROC 6 + binoffy=binoffy+13; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>312) { // ROC 6 + binoffy=binoffy+13; + } else if (binoffy==312) { // ROC 6 + binoffy=binoffy+12; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==311) { // ROC 5 + binoffy=binoffy+11; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>260) { // ROC 5 + binoffy=binoffy+11; + } else if (binoffy==260) { // ROC 5 + binoffy=binoffy+10; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==259) { // ROC 4 + binoffy=binoffy+9; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>208) { // ROC 4 + binoffy=binoffy+9; + } else if (binoffy==208) { // ROC 4 + binoffy=binoffy+8; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==207) { // ROC 3 + binoffy=binoffy+7; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>156) { // ROC 3 + binoffy=binoffy+7; + } else if (binoffy==156) { // ROC 3 + binoffy=binoffy+6; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==155) { // ROC 2 + binoffy=binoffy+5; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>104) { // ROC 2 + binoffy=binoffy+5; + } else if (binoffy==104) { // ROC 2 + binoffy=binoffy+4; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==103) { // ROC 1 + binoffy=binoffy+3; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>52) { // ROC 1 + binoffy=binoffy+3; + } else if (binoffy==52) { // ROC 1 + binoffy=binoffy+2; + local_pitchy = 2 * m_pitchy; + + } else if (binoffy==51) { // ROC 0 + binoffy=binoffy+1; + local_pitchy = 2 * m_pitchy; + } else if (binoffy>0) { // ROC 0 + binoffy=binoffy+1; + } else if (binoffy==0) { // ROC 0 + binoffy=binoffy+0; + local_pitchy = 2 * m_pitchy; + } else { + assert("binoffy too small"==0); + } + + return std::make_tuple(binoffy,local_pitchy>m_pitchy); + } + +} + +int main() { + + for (uint16_t ix=0; ix<80*2; ++ix) { + auto ori = localXori(ix); + auto xl = phase1PixelTopology::localX(ix); + auto bp = phase1PixelTopology::isBigPixX(ix); + if (std::get<0>(ori)!=xl) std::cout << "Error " << std::get<0>(ori) << "!=" << xl << std::endl; + assert(std::get<1>(ori)==bp); + } + + for (uint16_t iy=0; iy<52*8; ++iy) { + auto ori = localYori(iy); + auto yl = phase1PixelTopology::localY(iy); + auto bp = phase1PixelTopology::isBigPixY(iy); + if (std::get<0>(ori)!=yl) std::cout << "Error " << std::get<0>(ori) << "!=" << yl << std::endl; + assert(std::get<1>(ori)==bp); + } + + return 0; +} diff --git a/HLTrigger/Configuration/python/CustomConfigs.py b/HLTrigger/Configuration/python/CustomConfigs.py index bda6a99b80db3..ac0366e061f0f 100644 --- a/HLTrigger/Configuration/python/CustomConfigs.py +++ b/HLTrigger/Configuration/python/CustomConfigs.py @@ -134,7 +134,7 @@ def L1REPACK(process,sequence="Full"): getattr(process,path).insert(0,process.SimL1Emulator) # special L1T cleanup - for obj in ('SimL1TCalorimeter','SimL1TMuonCommon','SimL1TMuon','SimL1TechnicalTriggers','SimL1EmulatorCore','ecalDigiSequence','hcalDigiSequence','calDigi','me0TriggerPseudoDigiSequence'): + for obj in ('SimL1TCalorimeter','SimL1TMuonCommon','SimL1TMuon','SimL1TechnicalTriggers','SimL1EmulatorCore','ecalDigiSequence','hcalDigiSequence','calDigi','me0TriggerPseudoDigiSequence','hgcalTriggerGeometryESProducer'): if hasattr(process,obj): delattr(process,obj) diff --git a/HLTrigger/Configuration/python/HLT_FULL_cff.py b/HLTrigger/Configuration/python/HLT_FULL_cff.py index f40cc23ced2cf..121aef682e173 100644 --- a/HLTrigger/Configuration/python/HLT_FULL_cff.py +++ b/HLTrigger/Configuration/python/HLT_FULL_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/HLT --type FULL +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/HLT --type FULL -# /dev/CMSSW_10_0_0/HLT/V140 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/HLT/V3 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/HLT/V140') + tableName = cms.string('/dev/CMSSW_10_1_0/HLT/V3') ) fragment.transferSystem = cms.PSet( @@ -4377,13 +4377,13 @@ 'HcalCellDead' ) ) fragment.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -4396,7 +4396,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -4405,12 +4405,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -4423,7 +4423,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -4433,13 +4433,13 @@ trackFlip = cms.bool( False ) ) fragment.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4465,18 +4465,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4502,7 +4502,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -5952,9 +5952,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) fragment.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -5962,10 +5964,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) fragment.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -12752,11 +12756,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) fragment.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) fragment.hltDiMu5Ele3CaloIdLTrackIdLElectronlegOneOEMinusOneOPFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -38605,6 +38611,7 @@ lMinHighEHitTime = cms.double( -9999.0 ), fillLaserMonitor = cms.bool( True ), tMinHPDHits = cms.int32( 16 ), + tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), minRecHitE = cms.double( 1.5 ), pMaxHighEHitTime = cms.double( 5.0 ), lRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.5, 0.0, 0.0, 1.0, -0.5 ), @@ -38618,12 +38625,13 @@ maxNHF = cms.double( 0.9 ), minHighHitE = cms.double( 25.0 ), minR45HitE = cms.double( 5.0 ), - tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), + lasermonDigis = cms.InputTag( 'hltHcalDigis','LASERMON' ), lMinZeros = cms.int32( 10 ), lMinRBXHits = cms.int32( 999 ), fillRecHits = cms.bool( True ), minERatio = cms.double( 50.0 ), TS4TS5LowerThreshold = cms.vdouble( 100.0, 120.0, 150.0, 200.0, 300.0, 400.0, 500.0 ), + hlMaxRBXEMF = cms.double( 0.01 ), lMinHPDNoOtherHits = cms.int32( 10 ), pMinRBXRechitR45EnergyFraction = cms.double( 0.1 ), hlMaxHPDEMF = cms.double( -9999.0 ), @@ -38633,7 +38641,6 @@ laserMonIEtaList = cms.vint32( 0, 0, 0, 0, 0, 0, 0, 0 ), laserMonIPhiList = cms.vint32( 23, 17, 11, 5, 29, 35, 41, 47 ), pMinRatio = cms.double( 0.75 ), - tMinLowEHitTime = cms.double( -9999.0 ), HcalAcceptSeverityLevel = cms.uint32( 9 ), pMaxRBXEMF = cms.double( 0.02 ), tMaxRatio = cms.double( 0.92 ), @@ -38666,7 +38673,7 @@ tMinHPDNoOtherHits = cms.int32( 9 ), pMaxHPDEMF = cms.double( 0.02 ), jetCollName = cms.string( "" ), - hlMaxRBXEMF = cms.double( 0.01 ), + tMinLowEHitTime = cms.double( -9999.0 ), tMaxHighEHitTime = cms.double( 6.0 ), pMaxLowEHitTime = cms.double( 6.0 ), lMinHPDHits = cms.int32( 17 ), @@ -55189,6 +55196,7 @@ MinPt = cms.double( 110.0 ) ) fragment.hltL1TPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 35.0 ), mjjMin = cms.double( 650.0 ), @@ -56783,6 +56791,7 @@ MinPt = cms.double( 20.0 ) ) fragment.hltVBFL1TLooseIDPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 40.0 ), mjjMin = cms.double( 650.0 ), @@ -65973,13 +65982,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForBtag" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForBtag" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -77619,15 +77628,15 @@ ) fragment.hltSiPixelClustersAfterSplittingForRefPP = cms.EDProducer( "JetCoreClusterSplitter", verbose = cms.bool( False ), - deltaRmax = cms.double( 0.05 ), + chargeFractionMin = cms.double( 2.0 ), forceXError = cms.double( 100.0 ), vertices = cms.InputTag( "hltFullIter0PrimaryVerticesPreSplittingForRefPP" ), chargePerUnit = cms.double( 2000.0 ), - forceYError = cms.double( 150.0 ), centralMIPCharge = cms.double( 26000.0 ), + forceYError = cms.double( 150.0 ), pixelClusters = cms.InputTag( "hltSiPixelClustersForRefPP" ), ptMin = cms.double( 200.0 ), - chargeFractionMin = cms.double( 2.0 ), + deltaRmax = cms.double( 0.05 ), cores = cms.InputTag( "hltJetsForCoreTracking" ), fractionalWidth = cms.double( 0.4 ), pixelCPE = cms.string( "hltESPPixelCPEGeneric" ) @@ -85913,20 +85922,27 @@ filterTrackEnergy = cms.bool( True ) ) fragment.hltIsolEcalPixelTrackProdHB = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) fragment.hltEcalIsolPixelTrackL2FilterHB = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHB" ) ) fragment.hltHcalITIPTCorrectorHB = cms.EDProducer( "IPTCorrector", @@ -85983,20 +85999,27 @@ filterTrackEnergy = cms.bool( True ) ) fragment.hltIsolEcalPixelTrackProdHE = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) fragment.hltEcalIsolPixelTrackL2FilterHE = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHE" ) ) fragment.hltHcalITIPTCorrectorHE = cms.EDProducer( "IPTCorrector", @@ -100666,13 +100689,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForDBtagAK8" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForDBtagAK8" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), diff --git a/HLTrigger/Configuration/python/HLT_Fake1_cff.py b/HLTrigger/Configuration/python/HLT_Fake1_cff.py index aeb73000534a7..1c5629f5b4b3d 100644 --- a/HLTrigger/Configuration/python/HLT_Fake1_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake1_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/Fake1 --type Fake1 +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/Fake1 --type Fake1 -# /dev/CMSSW_10_0_0/Fake1/V7 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake1/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake1/V7') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake1/V2') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_Fake2_cff.py b/HLTrigger/Configuration/python/HLT_Fake2_cff.py index 99f8c8284ed0e..00ca7fe566544 100644 --- a/HLTrigger/Configuration/python/HLT_Fake2_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake2_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/Fake2 --type Fake2 +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/Fake2 --type Fake2 -# /dev/CMSSW_10_0_0/Fake2/V8 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake2/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake2/V8') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake2/V2') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_Fake_cff.py b/HLTrigger/Configuration/python/HLT_Fake_cff.py index 0b4636f5bee96..0603f8020ab93 100644 --- a/HLTrigger/Configuration/python/HLT_Fake_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/Fake --type Fake +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/Fake --type Fake -# /dev/CMSSW_10_0_0/Fake/V7 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake/V7') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake/V2') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_GRun_cff.py b/HLTrigger/Configuration/python/HLT_GRun_cff.py index 7263b475183c4..615c1346e84a8 100644 --- a/HLTrigger/Configuration/python/HLT_GRun_cff.py +++ b/HLTrigger/Configuration/python/HLT_GRun_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/GRun --type GRun +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/GRun --type GRun -# /dev/CMSSW_10_0_0/GRun/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/GRun/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/GRun/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/GRun/V1') ) fragment.transferSystem = cms.PSet( @@ -2263,6 +2263,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8', 'HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8', @@ -2785,6 +2787,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10', @@ -2886,9 +2890,9 @@ 'HLT_HT500_DisplacedDijet40_DisplacedTrack_v11', 'HLT_HT550_DisplacedDijet60_Inclusive_v11', 'HLT_HT650_DisplacedDijet60_Inclusive_v11', - 'HLT_HcalNZS_v12', - 'HLT_HcalPhiSym_v14', - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10')+cms.vstring( 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', + 'HLT_HcalNZS_v12')+cms.vstring( 'HLT_HcalPhiSym_v14', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10', @@ -3140,9 +3144,9 @@ 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2', 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2', 'HLT_TkMu100_v2', - 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4', - 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', - 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7')+cms.vstring( 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', + 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4')+cms.vstring( 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', + 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7', + 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', 'HLT_TripleJet110_35_35_Mjj650_PFMET130_v7', 'HLT_TripleMu_10_5_5_DZ_v9', 'HLT_TripleMu_12_10_5_v9', @@ -3757,13 +3761,13 @@ 'HcalCellDead' ) ) fragment.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3776,7 +3780,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3785,12 +3789,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3803,7 +3807,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3813,13 +3817,13 @@ trackFlip = cms.bool( False ) ) fragment.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -3845,18 +3849,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -3882,7 +3886,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -5332,9 +5336,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) fragment.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -5342,10 +5348,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) fragment.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -12084,11 +12092,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) fragment.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) fragment.hltDiMu5Ele3CaloIdLTrackIdLElectronlegOneOEMinusOneOPFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -31798,7 +31808,7 @@ L1MuonInputTag = cms.InputTag( 'hltGtStage2Digis','Muon' ), L1GlobalInputTag = cms.InputTag( "hltGtStage2Digis" ) ) -fragment.hltPreDoubleL2Mu50 = cms.EDFilter( "HLTPrescaler", +fragment.hltPreL2Mu23NoVtx2Cha = cms.EDFilter( "HLTPrescaler", L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) @@ -31812,26 +31822,54 @@ SelectQualities = cms.vint32( ), CandTag = cms.InputTag( 'hltGtStage2Digis','Muon' ) ) -fragment.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", +fragment.hltL2MuonCandidatesNoVtx = cms.EDProducer( "L2MuonCandidateProducer", + InputObjects = cms.InputTag( "hltL2Muons" ) +) +fragment.hltL2fL1sMuORL1f0L2NoVtx23Q2Cha = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), - CutOnChambers = cms.bool( False ), + CutOnChambers = cms.bool( True ), PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), - MinPt = cms.double( 50.0 ), - MinN = cms.int32( 2 ), - SeedMapTag = cms.InputTag( "hltL2MuonsAllBx" ), - MaxEta = cms.double( 2.5 ), - MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinPt = cms.double( 23.0 ), + MinN = cms.int32( 1 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MaxEta = cms.double( 2.0 ), + MinNhits = cms.vint32( 0 ), MinDxySig = cms.double( -1.0 ), - MinNchambers = cms.vint32( 0 ), - AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), MaxDz = cms.double( 9999.0 ), MatchToPreviousCand = cms.bool( False ), - CandTag = cms.InputTag( "hltL2MuonCandidatesAllBx" ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), MinDr = cms.double( -1.0 ), NSigmaPt = cms.double( 0.0 ), - MinNstations = cms.vint32( 0, 2, 0, 2 ) + MinNstations = cms.vint32( 0 ) +) +fragment.hltPreL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +fragment.hltL2fL1sMuORL1f0L2NoVtx23Q2ChaCosmicSeed = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( True ), + PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), + MinPt = cms.double( 23.0 ), + MinN = cms.int32( 1 ), + SeedMapTag = cms.InputTag( "hltL2CosmicMuons" ), + MaxEta = cms.double( 2.0 ), + MinNhits = cms.vint32( 0 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtxMeanTimerCosmicSeed" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0 ) ) fragment.hltL1sDoubleMu125to157ORTripleMu444 = cms.EDFilter( "HLTL1TSeed", L1SeedsLogicalExpression = cms.string( "L1_DoubleMu_12_5 OR L1_DoubleMu_15_5_SQ OR L1_DoubleMu_15_7 OR L1_TripleMu_4_4_4" ), @@ -31844,7 +31882,7 @@ L1MuonInputTag = cms.InputTag( 'hltGtStage2Digis','Muon' ), L1GlobalInputTag = cms.InputTag( "hltGtStage2Digis" ) ) -fragment.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", +fragment.hltPreDoubleL2Mu30NoVtx2ChaCosmicSeedEta2p4 = cms.EDFilter( "HLTPrescaler", L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) @@ -31858,6 +31896,108 @@ SelectQualities = cms.vint32( ), CandTag = cms.InputTag( 'hltGtStage2Digis','Muon' ) ) +fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q2ChaCosmicSeedEta2p4 = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( True ), + PreviousCandTag = cms.InputTag( "hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0" ), + MinPt = cms.double( 30.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2CosmicMuons" ), + MaxEta = cms.double( 2.4 ), + MinNhits = cms.vint32( 0 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtxMeanTimerCosmicSeed" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0 ) +) +fragment.hltPreDoubleL2Mu30NoVtx2ChaEta2p4 = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( False ), + PreviousCandTag = cms.InputTag( "hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0" ), + MinPt = cms.double( 30.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MaxEta = cms.double( 2.5 ), + MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 0 ), + AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0, 2, 0, 2 ) +) +fragment.hltL2DoubleMu30NoVtxFiltered2ChaEta2p4 = cms.EDFilter( "HLTMuonDimuonL2FromL1TFilter", + saveTags = cms.bool( True ), + ChargeOpt = cms.int32( 0 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MinNchambers = cms.int32( 2 ), + FastAccept = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), + PreviousCandTag = cms.InputTag( "hltL1sDoubleMu125to157ORTripleMu444" ), + MinAngle = cms.double( -999.0 ), + MaxPtBalance = cms.double( 999999.0 ), + MaxAcop = cms.double( 3.15 ), + MinPtMin = cms.double( 30.0 ), + MaxInvMass = cms.double( 999999.0 ), + MinPtMax = cms.double( 30.0 ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MaxAngle = cms.double( 9999.0 ), + MaxDz = cms.double( 9999.0 ), + MinPtPair = cms.double( 0.0 ), + MaxDr = cms.double( 100.0 ), + MinAcop = cms.double( -1.0 ), + MinNstations = cms.int32( 0 ), + MinNhits = cms.int32( 0 ), + NSigmaPt = cms.double( 0.0 ), + MinPtBalance = cms.double( -1.0 ), + MaxEta = cms.double( 2.4 ), + MinInvMass = cms.double( -999999.0 ) +) +fragment.hltPreDoubleL2Mu50 = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +fragment.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( False ), + PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), + MinPt = cms.double( 50.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2MuonsAllBx" ), + MaxEta = cms.double( 2.5 ), + MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 0 ), + AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesAllBx" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0, 2, 0, 2 ) +) +fragment.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx23Q2ChaCosmicSeed = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), @@ -31933,9 +32073,6 @@ L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) -fragment.hltL2MuonCandidatesNoVtx = cms.EDProducer( "L2MuonCandidateProducer", - InputObjects = cms.InputTag( "hltL2Muons" ) -) fragment.hltL2pfL1sDoubleMu155ORTripleMu444L1f0L2PreFiltered0NoVtx = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), @@ -37305,6 +37442,7 @@ lMinHighEHitTime = cms.double( -9999.0 ), fillLaserMonitor = cms.bool( True ), tMinHPDHits = cms.int32( 16 ), + tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), minRecHitE = cms.double( 1.5 ), pMaxHighEHitTime = cms.double( 5.0 ), lRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.5, 0.0, 0.0, 1.0, -0.5 ), @@ -37318,12 +37456,13 @@ maxNHF = cms.double( 0.9 ), minHighHitE = cms.double( 25.0 ), minR45HitE = cms.double( 5.0 ), - tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), + lasermonDigis = cms.InputTag( 'hltHcalDigis','LASERMON' ), lMinZeros = cms.int32( 10 ), lMinRBXHits = cms.int32( 999 ), fillRecHits = cms.bool( True ), minERatio = cms.double( 50.0 ), TS4TS5LowerThreshold = cms.vdouble( 100.0, 120.0, 150.0, 200.0, 300.0, 400.0, 500.0 ), + hlMaxRBXEMF = cms.double( 0.01 ), lMinHPDNoOtherHits = cms.int32( 10 ), pMinRBXRechitR45EnergyFraction = cms.double( 0.1 ), hlMaxHPDEMF = cms.double( -9999.0 ), @@ -37333,7 +37472,6 @@ laserMonIEtaList = cms.vint32( 0, 0, 0, 0, 0, 0, 0, 0 ), laserMonIPhiList = cms.vint32( 23, 17, 11, 5, 29, 35, 41, 47 ), pMinRatio = cms.double( 0.75 ), - tMinLowEHitTime = cms.double( -9999.0 ), HcalAcceptSeverityLevel = cms.uint32( 9 ), pMaxRBXEMF = cms.double( 0.02 ), tMaxRatio = cms.double( 0.92 ), @@ -37366,7 +37504,7 @@ tMinHPDNoOtherHits = cms.int32( 9 ), pMaxHPDEMF = cms.double( 0.02 ), jetCollName = cms.string( "" ), - hlMaxRBXEMF = cms.double( 0.01 ), + tMinLowEHitTime = cms.double( -9999.0 ), tMaxHighEHitTime = cms.double( 6.0 ), pMaxLowEHitTime = cms.double( 6.0 ), lMinHPDHits = cms.int32( 17 ), @@ -53386,6 +53524,7 @@ MinPt = cms.double( 110.0 ) ) fragment.hltL1TPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 35.0 ), mjjMin = cms.double( 650.0 ), @@ -54980,6 +55119,7 @@ MinPt = cms.double( 20.0 ) ) fragment.hltVBFL1TLooseIDPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 40.0 ), mjjMin = cms.double( 650.0 ), @@ -64022,13 +64162,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForBtag" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForBtag" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -69986,20 +70126,27 @@ filterTrackEnergy = cms.bool( True ) ) fragment.hltIsolEcalPixelTrackProdHB = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) fragment.hltEcalIsolPixelTrackL2FilterHB = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHB" ) ) fragment.hltHcalITIPTCorrectorHB = cms.EDProducer( "IPTCorrector", @@ -70056,20 +70203,27 @@ filterTrackEnergy = cms.bool( True ) ) fragment.hltIsolEcalPixelTrackProdHE = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) fragment.hltEcalIsolPixelTrackL2FilterHE = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHE" ) ) fragment.hltHcalITIPTCorrectorHE = cms.EDProducer( "IPTCorrector", @@ -82952,13 +83106,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForDBtagAK8" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForDBtagAK8" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -84215,6 +84369,10 @@ fragment.HLT_L2Mu10_v7 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMu22or25 + fragment.hltPreL2Mu10 + fragment.hltL1fL1sMu22or25L1Filtered0 + fragment.HLTL2muonrecoSequence + fragment.hltL2fL1sMu22or25L1f0L2FilteredQ + fragment.HLTEndSequence ) fragment.HLT_L2Mu10_NoVertex_NoBPTX_v6 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMuOpenNotBptxOR + fragment.hltPreL2Mu10NoVertexNoBPTX + fragment.hltL1fL1sMuOpenNotBptxORL1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + fragment.hltL2fL1sMuOpenNotBptxORL1f0NoVtxCosmicSeedMeanTimerL2Filtered10 + fragment.HLTEndSequence ) fragment.HLT_L2Mu50_v2 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMu22or25 + fragment.hltPreL2Mu50 + fragment.hltL1fL1sMu22or25L1Filtered0 + fragment.HLTL2muonrecoSequenceAllBx + fragment.hltL2fL1sMu22or25L1f0L2AllBxFiltered50Q + fragment.HLTEndSequence ) +fragment.HLT_L2Mu23NoVtx_2Cha_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMuOR + fragment.hltPreL2Mu23NoVtx2Cha + fragment.hltL1fL1sMuORL1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtx + fragment.hltL2fL1sMuORL1f0L2NoVtx23Q2Cha + fragment.HLTEndSequence ) +fragment.HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMuOR + fragment.hltPreL2Mu23NoVtx2ChaCosmicSeed + fragment.hltL1fL1sMuORL1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + fragment.hltL2fL1sMuORL1f0L2NoVtx23Q2ChaCosmicSeed + fragment.HLTEndSequence ) +fragment.HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sDoubleMu125to157ORTripleMu444 + fragment.hltPreDoubleL2Mu30NoVtx2ChaCosmicSeedEta2p4 + fragment.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q2ChaCosmicSeedEta2p4 + fragment.HLTEndSequence ) +fragment.HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sDoubleMu125to157ORTripleMu444 + fragment.hltPreDoubleL2Mu30NoVtx2ChaEta2p4 + fragment.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtx + fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q + fragment.hltL2DoubleMu30NoVtxFiltered2ChaEta2p4 + fragment.HLTEndSequence ) fragment.HLT_DoubleL2Mu50_v2 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sSingleMuOR + fragment.hltPreDoubleL2Mu50 + fragment.hltL1fL1sMuORL1Filtered0 + fragment.HLTL2muonrecoSequenceAllBx + fragment.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q + fragment.HLTEndSequence ) fragment.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sDoubleMu125to157ORTripleMu444 + fragment.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed + fragment.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx23Q2ChaCosmicSeed + fragment.HLTEndSequence ) fragment.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1 = cms.Path( fragment.HLTBeginSequence + fragment.hltL1sDoubleMu125to157ORTripleMu444 + fragment.hltPreDoubleL2Mu25NoVtx2ChaCosmicSeed + fragment.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + fragment.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + fragment.hltL2fL1sMuORL1f0DoubleL2NoVtx25Q2ChaCosmicSeed + fragment.HLTEndSequence ) @@ -84766,7 +84924,7 @@ fragment.ScoutingCaloMuonOutput = cms.Path( fragment.hltGtStage2Digis + fragment.hltPreScoutingCaloMuonOutput + fragment.hltFEDSelectorL1 + fragment.hltScoutingCaloPacker + fragment.hltScoutingMuonPackerCalo + fragment.hltScoutingPrimaryVertexPacker + fragment.hltScoutingPrimaryVertexPackerCaloMuon ) -fragment.HLTSchedule = cms.Schedule( *(fragment.HLTriggerFirstPath, fragment.HLT_AK8PFJet360_TrimMass30_v16, fragment.HLT_AK8PFJet380_TrimMass30_v9, fragment.HLT_AK8PFJet400_TrimMass30_v10, fragment.HLT_AK8PFJet420_TrimMass30_v9, fragment.HLT_AK8PFHT750_TrimMass50_v10, fragment.HLT_AK8PFHT800_TrimMass50_v10, fragment.HLT_AK8PFHT850_TrimMass50_v9, fragment.HLT_AK8PFHT900_TrimMass50_v9, fragment.HLT_CaloJet500_NoJetID_v11, fragment.HLT_CaloJet550_NoJetID_v6, fragment.HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v2, fragment.HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v2, fragment.HLT_Trimuon5_3p5_2_Upsilon_Muon_v4, fragment.HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2, fragment.HLT_DoubleEle25_CaloIdL_MW_v2, fragment.HLT_DoubleEle27_CaloIdL_MW_v2, fragment.HLT_DoubleEle33_CaloIdL_MW_v15, fragment.HLT_DoubleEle24_eta2p1_WPTight_Gsf_v5, fragment.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v18, fragment.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v18, fragment.HLT_Ele27_Ele37_CaloIdL_MW_v2, fragment.HLT_Mu27_Ele37_CaloIdL_MW_v3, fragment.HLT_Mu37_Ele27_CaloIdL_MW_v3, fragment.HLT_Mu37_TkMu27_v3, fragment.HLT_DoubleMu4_3_Bs_v13, fragment.HLT_DoubleMu4_3_Jpsi_v1, fragment.HLT_DoubleMu4_JpsiTrk_Displaced_v14, fragment.HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v14, fragment.HLT_DoubleMu3_Trk_Tau3mu_v11, fragment.HLT_DoubleMu3_TkMu_DsTau3Mu_v2, fragment.HLT_DoubleMu4_PsiPrimeTrk_Displaced_v14, fragment.HLT_DoubleMu4_Mass8_DZ_PFHT350_v7, fragment.HLT_DoubleMu8_Mass8_PFHT350_v7, fragment.HLT_Mu3_PFJet40_v14, fragment.HLT_Mu7p5_L2Mu2_Jpsi_v9, fragment.HLT_Mu7p5_L2Mu2_Upsilon_v9, fragment.HLT_Mu7p5_Track2_Jpsi_v10, fragment.HLT_Mu7p5_Track3p5_Jpsi_v10, fragment.HLT_Mu7p5_Track7_Jpsi_v10, fragment.HLT_Mu7p5_Track2_Upsilon_v10, fragment.HLT_Mu7p5_Track3p5_Upsilon_v10, fragment.HLT_Mu7p5_Track7_Upsilon_v10, fragment.HLT_DoublePhoton33_CaloIdL_v5, fragment.HLT_DoublePhoton70_v5, fragment.HLT_DoublePhoton85_v13, fragment.HLT_Ele20_WPTight_Gsf_v4, fragment.HLT_Ele15_WPLoose_Gsf_v1, fragment.HLT_Ele17_WPLoose_Gsf_v1, fragment.HLT_Ele20_WPLoose_Gsf_v4, fragment.HLT_Ele20_eta2p1_WPLoose_Gsf_v4, fragment.HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v3, fragment.HLT_Ele27_WPTight_Gsf_v14, fragment.HLT_Ele32_WPTight_Gsf_v13, fragment.HLT_Ele35_WPTight_Gsf_v7, fragment.HLT_Ele35_WPTight_Gsf_L1EGMT_v3, fragment.HLT_Ele38_WPTight_Gsf_v7, fragment.HLT_Ele40_WPTight_Gsf_v7, fragment.HLT_Ele32_WPTight_Gsf_L1DoubleEG_v7, fragment.HLT_HT450_Beamspot_v9, fragment.HLT_HT300_Beamspot_v9, fragment.HLT_ZeroBias_Beamspot_v2, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_v13, fragment.HLT_IsoMu24_v11, fragment.HLT_IsoMu24_eta2p1_v13, fragment.HLT_IsoMu27_v14, fragment.HLT_IsoMu30_v2, fragment.HLT_UncorrectedJetE30_NoBPTX_v5, fragment.HLT_UncorrectedJetE30_NoBPTX3BX_v5, fragment.HLT_UncorrectedJetE60_NoBPTX3BX_v5, fragment.HLT_UncorrectedJetE70_NoBPTX3BX_v5, fragment.HLT_L1SingleMu18_v3, fragment.HLT_L1SingleMu25_v2, fragment.HLT_L2Mu10_v7, fragment.HLT_L2Mu10_NoVertex_NoBPTX_v6, fragment.HLT_L2Mu50_v2, fragment.HLT_DoubleL2Mu50_v2, fragment.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v1, fragment.HLT_DoubleL2Mu23NoVtx_2Cha_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v13, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v14, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v4, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v4, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v2, fragment.HLT_Mu25_TkMu0_Onia_v6, fragment.HLT_Mu30_TkMu0_Onia_v6, fragment.HLT_Mu20_TkMu0_Phi_v6, fragment.HLT_Mu25_TkMu0_Phi_v6, fragment.HLT_Mu12_v1, fragment.HLT_Mu15_v1, fragment.HLT_Mu20_v11, fragment.HLT_Mu27_v12, fragment.HLT_Mu50_v12, fragment.HLT_Mu55_v2, fragment.HLT_OldMu100_v3, fragment.HLT_TkMu100_v2, fragment.HLT_DiPFJet15_NoCaloMatched_v14, fragment.HLT_DiPFJet25_NoCaloMatched_v14, fragment.HLT_DiPFJet15_FBEta3_NoCaloMatched_v15, fragment.HLT_DiPFJet25_FBEta3_NoCaloMatched_v15, fragment.HLT_DiPFJetAve40_v12, fragment.HLT_DiPFJetAve60_v12, fragment.HLT_DiPFJetAve80_v11, fragment.HLT_DiPFJetAve140_v11, fragment.HLT_DiPFJetAve200_v11, fragment.HLT_DiPFJetAve260_v12, fragment.HLT_DiPFJetAve320_v12, fragment.HLT_DiPFJetAve400_v12, fragment.HLT_DiPFJetAve500_v12, fragment.HLT_DiPFJetAve15_HFJEC_v15, fragment.HLT_DiPFJetAve25_HFJEC_v15, fragment.HLT_DiPFJetAve35_HFJEC_v15, fragment.HLT_DiPFJetAve60_HFJEC_v13, fragment.HLT_DiPFJetAve80_HFJEC_v13, fragment.HLT_DiPFJetAve100_HFJEC_v13, fragment.HLT_DiPFJetAve160_HFJEC_v13, fragment.HLT_DiPFJetAve220_HFJEC_v14, fragment.HLT_DiPFJetAve300_HFJEC_v14, fragment.HLT_AK8PFJet15_v1, fragment.HLT_AK8PFJet25_v1, fragment.HLT_AK8PFJet40_v14, fragment.HLT_AK8PFJet60_v13, fragment.HLT_AK8PFJet80_v13, fragment.HLT_AK8PFJet140_v13, fragment.HLT_AK8PFJet200_v13, fragment.HLT_AK8PFJet260_v14, fragment.HLT_AK8PFJet320_v14, fragment.HLT_AK8PFJet400_v14, fragment.HLT_AK8PFJet450_v14, fragment.HLT_AK8PFJet500_v14, fragment.HLT_AK8PFJet550_v9, fragment.HLT_PFJet15_v1, fragment.HLT_PFJet25_v1, fragment.HLT_PFJet40_v19, fragment.HLT_PFJet60_v19, fragment.HLT_PFJet80_v18, fragment.HLT_PFJet140_v17, fragment.HLT_PFJet200_v17, fragment.HLT_PFJet260_v18, fragment.HLT_PFJet320_v18, fragment.HLT_PFJet400_v18, fragment.HLT_PFJet450_v19, fragment.HLT_PFJet500_v19, fragment.HLT_PFJet550_v9, fragment.HLT_PFJetFwd15_v1, fragment.HLT_PFJetFwd25_v1, fragment.HLT_PFJetFwd40_v17, fragment.HLT_PFJetFwd60_v17, fragment.HLT_PFJetFwd80_v16, fragment.HLT_PFJetFwd140_v16, fragment.HLT_PFJetFwd200_v16, fragment.HLT_PFJetFwd260_v17, fragment.HLT_PFJetFwd320_v17, fragment.HLT_PFJetFwd400_v17, fragment.HLT_PFJetFwd450_v17, fragment.HLT_PFJetFwd500_v17, fragment.HLT_AK8PFJetFwd15_v1, fragment.HLT_AK8PFJetFwd25_v1, fragment.HLT_AK8PFJetFwd40_v13, fragment.HLT_AK8PFJetFwd60_v12, fragment.HLT_AK8PFJetFwd80_v12, fragment.HLT_AK8PFJetFwd140_v12, fragment.HLT_AK8PFJetFwd200_v12, fragment.HLT_AK8PFJetFwd260_v13, fragment.HLT_AK8PFJetFwd320_v13, fragment.HLT_AK8PFJetFwd400_v13, fragment.HLT_AK8PFJetFwd450_v13, fragment.HLT_AK8PFJetFwd500_v13, fragment.HLT_PFHT180_v15, fragment.HLT_PFHT250_v15, fragment.HLT_PFHT370_v15, fragment.HLT_PFHT430_v15, fragment.HLT_PFHT510_v15, fragment.HLT_PFHT590_v15, fragment.HLT_PFHT680_v15, fragment.HLT_PFHT780_v15, fragment.HLT_PFHT890_v15, fragment.HLT_PFHT1050_v16, fragment.HLT_PFHT500_PFMET100_PFMHT100_IDTight_v10, fragment.HLT_PFHT500_PFMET110_PFMHT110_IDTight_v10, fragment.HLT_PFHT700_PFMET85_PFMHT85_IDTight_v10, fragment.HLT_PFHT700_PFMET95_PFMHT95_IDTight_v10, fragment.HLT_PFHT800_PFMET75_PFMHT75_IDTight_v10, fragment.HLT_PFHT800_PFMET85_PFMHT85_IDTight_v10, fragment.HLT_PFMET110_PFMHT110_IDTight_v18, fragment.HLT_PFMET120_PFMHT120_IDTight_v18, fragment.HLT_PFMET130_PFMHT130_IDTight_v18, fragment.HLT_PFMET140_PFMHT140_IDTight_v18, fragment.HLT_PFMET100_PFMHT100_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET110_PFMHT110_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET120_PFMHT120_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET130_PFMHT130_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET140_PFMHT140_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET120_PFMHT120_IDTight_PFHT60_v7, fragment.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne110_PFMHT110_IDTight_v10, fragment.HLT_PFMETTypeOne120_PFMHT120_IDTight_v10, fragment.HLT_PFMETTypeOne130_PFMHT130_IDTight_v10, fragment.HLT_PFMETTypeOne140_PFMHT140_IDTight_v9, fragment.HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, fragment.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, fragment.HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, fragment.HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, fragment.HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, fragment.HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, fragment.HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, fragment.HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, fragment.HLT_L1ETMHadSeeds_v1, fragment.HLT_CaloMHT90_v3, fragment.HLT_CaloMET80_NotCleaned_v3, fragment.HLT_CaloMET90_NotCleaned_v3, fragment.HLT_CaloMET100_NotCleaned_v3, fragment.HLT_CaloMET110_NotCleaned_v3, fragment.HLT_CaloMET250_NotCleaned_v3, fragment.HLT_CaloMET70_HBHECleaned_v3, fragment.HLT_CaloMET80_HBHECleaned_v3, fragment.HLT_CaloMET90_HBHECleaned_v3, fragment.HLT_CaloMET100_HBHECleaned_v3, fragment.HLT_CaloMET250_HBHECleaned_v3, fragment.HLT_CaloMET300_HBHECleaned_v3, fragment.HLT_CaloMET350_HBHECleaned_v3, fragment.HLT_PFMET200_NotCleaned_v7, fragment.HLT_PFMET200_HBHECleaned_v7, fragment.HLT_PFMET250_HBHECleaned_v7, fragment.HLT_PFMET300_HBHECleaned_v7, fragment.HLT_PFMET200_HBHE_BeamHaloCleaned_v7, fragment.HLT_PFMETTypeOne200_HBHE_BeamHaloCleaned_v7, fragment.HLT_MET105_IsoTrk50_v8, fragment.HLT_MET120_IsoTrk50_v8, fragment.HLT_SingleJet30_Mu12_SinglePFJet40_v9, fragment.HLT_Mu12_DoublePFJets40_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets100_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets200_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets350_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets40_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets100_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets200_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets350_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Photon300_NoHE_v11, fragment.HLT_Mu8_TrkIsoVVL_v11, fragment.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16, fragment.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v16, fragment.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v17, fragment.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v17, fragment.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v11, fragment.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v9, fragment.HLT_Mu17_TrkIsoVVL_v11, fragment.HLT_Mu19_TrkIsoVVL_v2, fragment.HLT_BTagMu_AK4DiJet20_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet40_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet70_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet110_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet170_Mu5_v10, fragment.HLT_BTagMu_AK4Jet300_Mu5_v11, fragment.HLT_BTagMu_AK8DiJet170_Mu5_v7, fragment.HLT_BTagMu_AK8Jet300_Mu5_v11, fragment.HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v1, fragment.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v17, fragment.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v17, fragment.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v5, fragment.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v5, fragment.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.HLT_Mu12_DoublePhoton20_v3, fragment.HLT_TriplePhoton_20_20_20_CaloIdLV2_v2, fragment.HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v2, fragment.HLT_TriplePhoton_30_30_10_CaloIdLV2_v3, fragment.HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v3, fragment.HLT_TriplePhoton_35_35_5_CaloIdLV2_R9IdVL_v3, fragment.HLT_Photon20_v1, fragment.HLT_Photon33_v4, fragment.HLT_Photon50_v12, fragment.HLT_Photon75_v12, fragment.HLT_Photon90_v12, fragment.HLT_Photon120_v12, fragment.HLT_Photon150_v5, fragment.HLT_Photon175_v13, fragment.HLT_Photon200_v12, fragment.HLT_Photon50_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon75_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v3, fragment.HLT_Photon90_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon120_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon165_R9Id90_HE10_IsoM_v14, fragment.HLT_Photon90_CaloIdL_PFHT700_v14, fragment.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v12, fragment.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v12, fragment.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, fragment.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, fragment.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, fragment.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, fragment.HLT_Dimuon0_Jpsi_L1_NoOS_v6, fragment.HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v6, fragment.HLT_Dimuon0_Jpsi_v7, fragment.HLT_Dimuon0_Jpsi_NoVertexing_v7, fragment.HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v6, fragment.HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v6, fragment.HLT_Dimuon0_Jpsi3p5_Muon2_v5, fragment.HLT_Dimuon0_Upsilon_L1_4p5_v7, fragment.HLT_Dimuon0_Upsilon_L1_5_v7, fragment.HLT_Dimuon0_Upsilon_L1_4p5NoOS_v6, fragment.HLT_Dimuon0_Upsilon_L1_4p5er2p0_v7, fragment.HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v6, fragment.HLT_Dimuon0_Upsilon_NoVertexing_v6, fragment.HLT_Dimuon0_Upsilon_L1_5M_v6, fragment.HLT_Dimuon0_LowMass_L1_0er1p5R_v6, fragment.HLT_Dimuon0_LowMass_L1_0er1p5_v7, fragment.HLT_Dimuon0_LowMass_v7, fragment.HLT_Dimuon0_LowMass_L1_4_v7, fragment.HLT_Dimuon0_LowMass_L1_4R_v6, fragment.HLT_Dimuon0_LowMass_L1_TM530_v5, fragment.HLT_Dimuon0_Upsilon_Muon_L1_TM0_v5, fragment.HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v5, fragment.HLT_TripleMu_5_3_3_Mass3p8to60_DZ_v7, fragment.HLT_TripleMu_10_5_5_DZ_v9, fragment.HLT_TripleMu_12_10_5_v9, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v2, fragment.HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8, fragment.HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v8, fragment.HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v8, fragment.HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v5, fragment.HLT_DoubleMu4_Jpsi_Displaced_v6, fragment.HLT_DoubleMu4_Jpsi_NoVertexing_v6, fragment.HLT_DoubleMu4_JpsiTrkTrk_Displaced_v6, fragment.HLT_DoubleMu43NoFiltersNoVtx_v3, fragment.HLT_DoubleMu48NoFiltersNoVtx_v3, fragment.HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v4, fragment.HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v4, fragment.HLT_DoubleMu20_7_Mass0to30_L1_DM4_v6, fragment.HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v6, fragment.HLT_HT425_v8, fragment.HLT_HT430_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT500_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT430_DisplacedDijet60_DisplacedTrack_v11, fragment.HLT_HT400_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT650_DisplacedDijet60_Inclusive_v11, fragment.HLT_HT550_DisplacedDijet60_Inclusive_v11, fragment.HLT_DiJet110_35_Mjj650_PFMET110_v7, fragment.HLT_DiJet110_35_Mjj650_PFMET120_v7, fragment.HLT_DiJet110_35_Mjj650_PFMET130_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET110_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET120_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET130_v7, fragment.HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_VBF_DoubleMediumChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_VBF_DoubleTightChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v11, fragment.HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v11, fragment.HLT_Ele28_HighEta_SC20_Mass55_v11, fragment.HLT_DoubleMu20_7_Mass0to30_Photon23_v6, fragment.HLT_Ele15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, fragment.HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v14, fragment.HLT_Ele15_IsoVVVL_PFHT450_v14, fragment.HLT_Ele50_IsoVVVL_PFHT450_v14, fragment.HLT_Ele15_IsoVVVL_PFHT600_v18, fragment.HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v13, fragment.HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v12, fragment.HLT_Mu15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, fragment.HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v13, fragment.HLT_Mu15_IsoVVVL_PFHT450_v13, fragment.HLT_Mu50_IsoVVVL_PFHT450_v13, fragment.HLT_Mu15_IsoVVVL_PFHT600_v17, fragment.HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v6, fragment.HLT_Dimuon20_Jpsi_Barrel_Seagulls_v6, fragment.HLT_Dimuon10_Upsilon_Barrel_Seagulls_v6, fragment.HLT_Dimuon12_Upsilon_eta1p5_v13, fragment.HLT_Dimuon14_Phi_Barrel_Seagulls_v6, fragment.HLT_Dimuon18_PsiPrime_v13, fragment.HLT_Dimuon25_Jpsi_v13, fragment.HLT_Dimuon18_PsiPrime_noCorrL1_v4, fragment.HLT_Dimuon24_Upsilon_noCorrL1_v4, fragment.HLT_Dimuon24_Phi_noCorrL1_v4, fragment.HLT_Dimuon25_Jpsi_noCorrL1_v4, fragment.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v15, fragment.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v15, fragment.HLT_DoubleIsoMu20_eta2p1_v5, fragment.HLT_DoubleIsoMu24_eta2p1_v5, fragment.HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v5, fragment.HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v11, fragment.HLT_TrkMu17_DoubleTrkMu8NoFiltersNoVtx_v12, fragment.HLT_Mu8_v11, fragment.HLT_Mu17_v11, fragment.HLT_Mu19_v2, fragment.HLT_Mu17_Photon30_IsoCaloId_v4, fragment.HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v14, fragment.HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, fragment.HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v1, fragment.HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, fragment.HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v16, fragment.HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v14, fragment.HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v16, fragment.HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v16, fragment.HLT_Ele115_CaloIdVT_GsfTrkIdT_v12, fragment.HLT_Ele135_CaloIdVT_GsfTrkIdT_v5, fragment.HLT_Ele145_CaloIdVT_GsfTrkIdT_v6, fragment.HLT_Ele200_CaloIdVT_GsfTrkIdT_v6, fragment.HLT_Ele250_CaloIdVT_GsfTrkIdT_v11, fragment.HLT_Ele300_CaloIdVT_GsfTrkIdT_v11, fragment.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v1, fragment.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v7, fragment.HLT_PFHT380_SixPFJet32_DoublePFBTagCSV_2p2_v7, fragment.HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_2p2_v6, fragment.HLT_PFHT380_SixPFJet32_v7, fragment.HLT_PFHT430_SixPFJet40_PFBTagCSV_1p5_v7, fragment.HLT_PFHT430_SixPFJet40_v9, fragment.HLT_PFHT350_v17, fragment.HLT_PFHT350MinPFJet15_v7, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_v4, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v4, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v9, fragment.HLT_FullTrack_Multiplicity85_v3, fragment.HLT_FullTrack_Multiplicity100_v2, fragment.HLT_FullTrack_Multiplicity130_v2, fragment.HLT_FullTrack_Multiplicity155_v3, fragment.HLT_ECALHT800_v9, fragment.HLT_DiSC30_18_EIso_AND_HE_Mass70_v12, fragment.HLT_Physics_v7, fragment.HLT_Physics_part0_v7, fragment.HLT_Physics_part1_v7, fragment.HLT_Physics_part2_v7, fragment.HLT_Physics_part3_v7, fragment.HLT_Physics_part4_v7, fragment.HLT_Physics_part5_v7, fragment.HLT_Physics_part6_v7, fragment.HLT_Physics_part7_v7, fragment.DST_Physics_v7, fragment.HLT_Random_v3, fragment.HLT_ZeroBias_v6, fragment.HLT_ZeroBias_part0_v6, fragment.HLT_ZeroBias_part1_v6, fragment.HLT_ZeroBias_part2_v6, fragment.HLT_ZeroBias_part3_v6, fragment.HLT_ZeroBias_part4_v6, fragment.HLT_ZeroBias_part5_v6, fragment.HLT_ZeroBias_part6_v6, fragment.HLT_ZeroBias_part7_v6, fragment.DST_ZeroBias_v2, fragment.DST_HT250_CaloScouting_v9, fragment.DST_HT250_CaloBTagScouting_v8, fragment.DST_HT410_PFScouting_v14, fragment.DST_HT410_BTagScouting_v14, fragment.DST_ZeroBias_BTagScouting_v13, fragment.DST_ZeroBias_CaloScouting_PFScouting_v12, fragment.DST_CaloJet40_BTagScouting_v13, fragment.DST_CaloJet40_CaloScouting_PFScouting_v13, fragment.DST_CaloJet40_CaloBTagScouting_v12, fragment.DST_L1HTT_BTagScouting_v13, fragment.DST_L1HTT_CaloScouting_PFScouting_v13, fragment.DST_L1HTT_CaloBTagScouting_v12, fragment.DST_L1DoubleMu_BTagScouting_v14, fragment.DST_L1DoubleMu_CaloScouting_PFScouting_v13, fragment.DST_DoubleMu3_noVtx_CaloScouting_Monitoring_v5, fragment.DST_DoubleMu3_noVtx_CaloScouting_v5, fragment.DST_DoubleMu1_noVtx_CaloScouting_v1, fragment.DST_DoubleMu3_noVtx_Mass10_PFScouting_v1, fragment.HLT_AK4CaloJet30_v11, fragment.HLT_AK4CaloJet40_v10, fragment.HLT_AK4CaloJet50_v10, fragment.HLT_AK4CaloJet80_v10, fragment.HLT_AK4CaloJet100_v10, fragment.HLT_AK4CaloJet120_v9, fragment.HLT_AK4PFJet30_v17, fragment.HLT_AK4PFJet50_v17, fragment.HLT_AK4PFJet80_v17, fragment.HLT_AK4PFJet100_v17, fragment.HLT_AK4PFJet120_v16, fragment.HLT_SinglePhoton10_Eta3p1ForPPRef_v8, fragment.HLT_SinglePhoton20_Eta3p1ForPPRef_v8, fragment.HLT_SinglePhoton30_Eta3p1ForPPRef_v8, fragment.HLT_Photon20_HoverELoose_v9, fragment.HLT_Photon30_HoverELoose_v9, fragment.HLT_EcalCalibration_v4, fragment.HLT_HcalCalibration_v5, fragment.AlCa_EcalPhiSym_v8, fragment.HLT_L1UnpairedBunchBptxMinus_v2, fragment.HLT_L1UnpairedBunchBptxPlus_v2, fragment.HLT_L1NotBptxOR_v3, fragment.HLT_L1MinimumBiasHF_OR_v2, fragment.HLT_L1MinimumBiasHF0OR_v3, fragment.HLT_L1_CDC_SingleMu_3_er1p2_TOP120_DPHI2p618_3p142_v2, fragment.HLT_HcalNZS_v12, fragment.HLT_HcalPhiSym_v14, fragment.HLT_HcalIsolatedbunch_v4, fragment.HLT_IsoTrackHB_v3, fragment.HLT_IsoTrackHE_v3, fragment.HLT_ZeroBias_FirstCollisionAfterAbortGap_v5, fragment.HLT_ZeroBias_IsolatedBunches_v5, fragment.HLT_ZeroBias_FirstCollisionInTrain_v4, fragment.HLT_ZeroBias_LastCollisionInTrain_v3, fragment.HLT_ZeroBias_FirstBXAfterTrain_v3, fragment.AlCa_RPCMuonNormalisation_v13, fragment.AlCa_LumiPixels_Random_v4, fragment.AlCa_LumiPixels_ZeroBias_v8, fragment.MC_ReducedIterativeTracking_v11, fragment.MC_PFMET_v15, fragment.MC_AK4PFJets_v15, fragment.MC_PFBTagCSV_v9, fragment.MC_PFHT_v14, fragment.MC_PFMHT_v14, fragment.MC_CaloMET_v8, fragment.MC_CaloMET_JetIdCleaned_v9, fragment.MC_AK4CaloJets_v9, fragment.MC_AK4CaloJetsFromPV_v7, fragment.MC_CaloBTagCSV_v7, fragment.MC_CaloHT_v8, fragment.MC_CaloMHT_v8, fragment.MC_AK8PFJets_v15, fragment.MC_AK8TrimPFJets_v15, fragment.MC_AK8PFHT_v14, fragment.MC_AK8CaloHT_v8, fragment.MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v12, fragment.MC_DoubleEle5_CaloIdL_MW_v13, fragment.MC_Ele5_WPTight_Gsf_v6, fragment.MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.MC_IsoMu_v13, fragment.MC_DoubleMu_TrkIsoVVL_DZ_v10, fragment.MC_DoubleMuNoFiltersNoVtx_v7, fragment.AlCa_EcalPi0EBonly_v12, fragment.AlCa_EcalPi0EEonly_v12, fragment.AlCa_EcalEtaEBonly_v12, fragment.AlCa_EcalEtaEEonly_v12, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v1, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, fragment.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v9, fragment.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, fragment.HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v7, fragment.HLT_Rsq0p35_v13, fragment.HLT_Rsq0p40_v13, fragment.HLT_RsqMR300_Rsq0p09_MR200_v13, fragment.HLT_RsqMR320_Rsq0p09_MR200_v13, fragment.HLT_RsqMR300_Rsq0p09_MR200_4jet_v13, fragment.HLT_RsqMR320_Rsq0p09_MR200_4jet_v13, fragment.HLT_IsoMu27_LooseChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_MediumChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_TightChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_MET90_v1, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v1, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_CrossL1_v1, fragment.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1, fragment.HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v3, fragment.HLT_PFMET100_PFMHT100_IDTight_PFHT60_v7, fragment.HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v7, fragment.HLT_Mu18_Mu9_SameSign_v3, fragment.HLT_Mu18_Mu9_SameSign_DZ_v3, fragment.HLT_Mu18_Mu9_v3, fragment.HLT_Mu18_Mu9_DZ_v3, fragment.HLT_Mu20_Mu10_SameSign_v3, fragment.HLT_Mu20_Mu10_SameSign_DZ_v3, fragment.HLT_Mu20_Mu10_v3, fragment.HLT_Mu20_Mu10_DZ_v3, fragment.HLT_Mu23_Mu12_SameSign_v3, fragment.HLT_Mu23_Mu12_SameSign_DZ_v3, fragment.HLT_Mu23_Mu12_v3, fragment.HLT_Mu23_Mu12_DZ_v3, fragment.HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v5, fragment.HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v3, fragment.HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8, fragment.HLT_TripleMu_5_3_3_Mass3p8to60_DCA_v2, fragment.HLT_QuadPFJet98_83_71_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet103_88_75_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet105_90_76_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet111_90_80_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet98_83_71_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet103_88_75_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet105_88_76_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet111_90_80_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet98_83_71_15_v3, fragment.HLT_QuadPFJet103_88_75_15_v3, fragment.HLT_QuadPFJet105_88_76_15_v3, fragment.HLT_QuadPFJet111_90_80_15_v3, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p17_v1, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p1_v1, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v1, fragment.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v8, fragment.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v8, fragment.HLTriggerFinalPath, fragment.HLTAnalyzerEndpath, fragment.ScoutingPFOutput, fragment.ScoutingCaloMuonOutput )) +fragment.HLTSchedule = cms.Schedule( *(fragment.HLTriggerFirstPath, fragment.HLT_AK8PFJet360_TrimMass30_v16, fragment.HLT_AK8PFJet380_TrimMass30_v9, fragment.HLT_AK8PFJet400_TrimMass30_v10, fragment.HLT_AK8PFJet420_TrimMass30_v9, fragment.HLT_AK8PFHT750_TrimMass50_v10, fragment.HLT_AK8PFHT800_TrimMass50_v10, fragment.HLT_AK8PFHT850_TrimMass50_v9, fragment.HLT_AK8PFHT900_TrimMass50_v9, fragment.HLT_CaloJet500_NoJetID_v11, fragment.HLT_CaloJet550_NoJetID_v6, fragment.HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v2, fragment.HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v2, fragment.HLT_Trimuon5_3p5_2_Upsilon_Muon_v4, fragment.HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2, fragment.HLT_DoubleEle25_CaloIdL_MW_v2, fragment.HLT_DoubleEle27_CaloIdL_MW_v2, fragment.HLT_DoubleEle33_CaloIdL_MW_v15, fragment.HLT_DoubleEle24_eta2p1_WPTight_Gsf_v5, fragment.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v18, fragment.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v18, fragment.HLT_Ele27_Ele37_CaloIdL_MW_v2, fragment.HLT_Mu27_Ele37_CaloIdL_MW_v3, fragment.HLT_Mu37_Ele27_CaloIdL_MW_v3, fragment.HLT_Mu37_TkMu27_v3, fragment.HLT_DoubleMu4_3_Bs_v13, fragment.HLT_DoubleMu4_3_Jpsi_v1, fragment.HLT_DoubleMu4_JpsiTrk_Displaced_v14, fragment.HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v14, fragment.HLT_DoubleMu3_Trk_Tau3mu_v11, fragment.HLT_DoubleMu3_TkMu_DsTau3Mu_v2, fragment.HLT_DoubleMu4_PsiPrimeTrk_Displaced_v14, fragment.HLT_DoubleMu4_Mass8_DZ_PFHT350_v7, fragment.HLT_DoubleMu8_Mass8_PFHT350_v7, fragment.HLT_Mu3_PFJet40_v14, fragment.HLT_Mu7p5_L2Mu2_Jpsi_v9, fragment.HLT_Mu7p5_L2Mu2_Upsilon_v9, fragment.HLT_Mu7p5_Track2_Jpsi_v10, fragment.HLT_Mu7p5_Track3p5_Jpsi_v10, fragment.HLT_Mu7p5_Track7_Jpsi_v10, fragment.HLT_Mu7p5_Track2_Upsilon_v10, fragment.HLT_Mu7p5_Track3p5_Upsilon_v10, fragment.HLT_Mu7p5_Track7_Upsilon_v10, fragment.HLT_DoublePhoton33_CaloIdL_v5, fragment.HLT_DoublePhoton70_v5, fragment.HLT_DoublePhoton85_v13, fragment.HLT_Ele20_WPTight_Gsf_v4, fragment.HLT_Ele15_WPLoose_Gsf_v1, fragment.HLT_Ele17_WPLoose_Gsf_v1, fragment.HLT_Ele20_WPLoose_Gsf_v4, fragment.HLT_Ele20_eta2p1_WPLoose_Gsf_v4, fragment.HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v3, fragment.HLT_Ele27_WPTight_Gsf_v14, fragment.HLT_Ele32_WPTight_Gsf_v13, fragment.HLT_Ele35_WPTight_Gsf_v7, fragment.HLT_Ele35_WPTight_Gsf_L1EGMT_v3, fragment.HLT_Ele38_WPTight_Gsf_v7, fragment.HLT_Ele40_WPTight_Gsf_v7, fragment.HLT_Ele32_WPTight_Gsf_L1DoubleEG_v7, fragment.HLT_HT450_Beamspot_v9, fragment.HLT_HT300_Beamspot_v9, fragment.HLT_ZeroBias_Beamspot_v2, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, fragment.HLT_IsoMu20_v13, fragment.HLT_IsoMu24_v11, fragment.HLT_IsoMu24_eta2p1_v13, fragment.HLT_IsoMu27_v14, fragment.HLT_IsoMu30_v2, fragment.HLT_UncorrectedJetE30_NoBPTX_v5, fragment.HLT_UncorrectedJetE30_NoBPTX3BX_v5, fragment.HLT_UncorrectedJetE60_NoBPTX3BX_v5, fragment.HLT_UncorrectedJetE70_NoBPTX3BX_v5, fragment.HLT_L1SingleMu18_v3, fragment.HLT_L1SingleMu25_v2, fragment.HLT_L2Mu10_v7, fragment.HLT_L2Mu10_NoVertex_NoBPTX_v6, fragment.HLT_L2Mu50_v2, fragment.HLT_L2Mu23NoVtx_2Cha_v1, fragment.HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v1, fragment.HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1, fragment.HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1, fragment.HLT_DoubleL2Mu50_v2, fragment.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v1, fragment.HLT_DoubleL2Mu23NoVtx_2Cha_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_v1, fragment.HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v13, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v14, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v4, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v2, fragment.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v4, fragment.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v2, fragment.HLT_Mu25_TkMu0_Onia_v6, fragment.HLT_Mu30_TkMu0_Onia_v6, fragment.HLT_Mu20_TkMu0_Phi_v6, fragment.HLT_Mu25_TkMu0_Phi_v6, fragment.HLT_Mu12_v1, fragment.HLT_Mu15_v1, fragment.HLT_Mu20_v11, fragment.HLT_Mu27_v12, fragment.HLT_Mu50_v12, fragment.HLT_Mu55_v2, fragment.HLT_OldMu100_v3, fragment.HLT_TkMu100_v2, fragment.HLT_DiPFJet15_NoCaloMatched_v14, fragment.HLT_DiPFJet25_NoCaloMatched_v14, fragment.HLT_DiPFJet15_FBEta3_NoCaloMatched_v15, fragment.HLT_DiPFJet25_FBEta3_NoCaloMatched_v15, fragment.HLT_DiPFJetAve40_v12, fragment.HLT_DiPFJetAve60_v12, fragment.HLT_DiPFJetAve80_v11, fragment.HLT_DiPFJetAve140_v11, fragment.HLT_DiPFJetAve200_v11, fragment.HLT_DiPFJetAve260_v12, fragment.HLT_DiPFJetAve320_v12, fragment.HLT_DiPFJetAve400_v12, fragment.HLT_DiPFJetAve500_v12, fragment.HLT_DiPFJetAve15_HFJEC_v15, fragment.HLT_DiPFJetAve25_HFJEC_v15, fragment.HLT_DiPFJetAve35_HFJEC_v15, fragment.HLT_DiPFJetAve60_HFJEC_v13, fragment.HLT_DiPFJetAve80_HFJEC_v13, fragment.HLT_DiPFJetAve100_HFJEC_v13, fragment.HLT_DiPFJetAve160_HFJEC_v13, fragment.HLT_DiPFJetAve220_HFJEC_v14, fragment.HLT_DiPFJetAve300_HFJEC_v14, fragment.HLT_AK8PFJet15_v1, fragment.HLT_AK8PFJet25_v1, fragment.HLT_AK8PFJet40_v14, fragment.HLT_AK8PFJet60_v13, fragment.HLT_AK8PFJet80_v13, fragment.HLT_AK8PFJet140_v13, fragment.HLT_AK8PFJet200_v13, fragment.HLT_AK8PFJet260_v14, fragment.HLT_AK8PFJet320_v14, fragment.HLT_AK8PFJet400_v14, fragment.HLT_AK8PFJet450_v14, fragment.HLT_AK8PFJet500_v14, fragment.HLT_AK8PFJet550_v9, fragment.HLT_PFJet15_v1, fragment.HLT_PFJet25_v1, fragment.HLT_PFJet40_v19, fragment.HLT_PFJet60_v19, fragment.HLT_PFJet80_v18, fragment.HLT_PFJet140_v17, fragment.HLT_PFJet200_v17, fragment.HLT_PFJet260_v18, fragment.HLT_PFJet320_v18, fragment.HLT_PFJet400_v18, fragment.HLT_PFJet450_v19, fragment.HLT_PFJet500_v19, fragment.HLT_PFJet550_v9, fragment.HLT_PFJetFwd15_v1, fragment.HLT_PFJetFwd25_v1, fragment.HLT_PFJetFwd40_v17, fragment.HLT_PFJetFwd60_v17, fragment.HLT_PFJetFwd80_v16, fragment.HLT_PFJetFwd140_v16, fragment.HLT_PFJetFwd200_v16, fragment.HLT_PFJetFwd260_v17, fragment.HLT_PFJetFwd320_v17, fragment.HLT_PFJetFwd400_v17, fragment.HLT_PFJetFwd450_v17, fragment.HLT_PFJetFwd500_v17, fragment.HLT_AK8PFJetFwd15_v1, fragment.HLT_AK8PFJetFwd25_v1, fragment.HLT_AK8PFJetFwd40_v13, fragment.HLT_AK8PFJetFwd60_v12, fragment.HLT_AK8PFJetFwd80_v12, fragment.HLT_AK8PFJetFwd140_v12, fragment.HLT_AK8PFJetFwd200_v12, fragment.HLT_AK8PFJetFwd260_v13, fragment.HLT_AK8PFJetFwd320_v13, fragment.HLT_AK8PFJetFwd400_v13, fragment.HLT_AK8PFJetFwd450_v13, fragment.HLT_AK8PFJetFwd500_v13, fragment.HLT_PFHT180_v15, fragment.HLT_PFHT250_v15, fragment.HLT_PFHT370_v15, fragment.HLT_PFHT430_v15, fragment.HLT_PFHT510_v15, fragment.HLT_PFHT590_v15, fragment.HLT_PFHT680_v15, fragment.HLT_PFHT780_v15, fragment.HLT_PFHT890_v15, fragment.HLT_PFHT1050_v16, fragment.HLT_PFHT500_PFMET100_PFMHT100_IDTight_v10, fragment.HLT_PFHT500_PFMET110_PFMHT110_IDTight_v10, fragment.HLT_PFHT700_PFMET85_PFMHT85_IDTight_v10, fragment.HLT_PFHT700_PFMET95_PFMHT95_IDTight_v10, fragment.HLT_PFHT800_PFMET75_PFMHT75_IDTight_v10, fragment.HLT_PFHT800_PFMET85_PFMHT85_IDTight_v10, fragment.HLT_PFMET110_PFMHT110_IDTight_v18, fragment.HLT_PFMET120_PFMHT120_IDTight_v18, fragment.HLT_PFMET130_PFMHT130_IDTight_v18, fragment.HLT_PFMET140_PFMHT140_IDTight_v18, fragment.HLT_PFMET100_PFMHT100_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET110_PFMHT110_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET120_PFMHT120_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET130_PFMHT130_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET140_PFMHT140_IDTight_CaloBTagCSV_3p1_v7, fragment.HLT_PFMET120_PFMHT120_IDTight_PFHT60_v7, fragment.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne110_PFMHT110_IDTight_v10, fragment.HLT_PFMETTypeOne120_PFMHT120_IDTight_v10, fragment.HLT_PFMETTypeOne130_PFMHT130_IDTight_v10, fragment.HLT_PFMETTypeOne140_PFMHT140_IDTight_v9, fragment.HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, fragment.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, fragment.HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, fragment.HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, fragment.HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, fragment.HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, fragment.HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, fragment.HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, fragment.HLT_L1ETMHadSeeds_v1, fragment.HLT_CaloMHT90_v3, fragment.HLT_CaloMET80_NotCleaned_v3, fragment.HLT_CaloMET90_NotCleaned_v3, fragment.HLT_CaloMET100_NotCleaned_v3, fragment.HLT_CaloMET110_NotCleaned_v3, fragment.HLT_CaloMET250_NotCleaned_v3, fragment.HLT_CaloMET70_HBHECleaned_v3, fragment.HLT_CaloMET80_HBHECleaned_v3, fragment.HLT_CaloMET90_HBHECleaned_v3, fragment.HLT_CaloMET100_HBHECleaned_v3, fragment.HLT_CaloMET250_HBHECleaned_v3, fragment.HLT_CaloMET300_HBHECleaned_v3, fragment.HLT_CaloMET350_HBHECleaned_v3, fragment.HLT_PFMET200_NotCleaned_v7, fragment.HLT_PFMET200_HBHECleaned_v7, fragment.HLT_PFMET250_HBHECleaned_v7, fragment.HLT_PFMET300_HBHECleaned_v7, fragment.HLT_PFMET200_HBHE_BeamHaloCleaned_v7, fragment.HLT_PFMETTypeOne200_HBHE_BeamHaloCleaned_v7, fragment.HLT_MET105_IsoTrk50_v8, fragment.HLT_MET120_IsoTrk50_v8, fragment.HLT_SingleJet30_Mu12_SinglePFJet40_v9, fragment.HLT_Mu12_DoublePFJets40_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets100_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets200_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets350_CaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets40_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets100_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets200_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets350_CaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, fragment.HLT_Photon300_NoHE_v11, fragment.HLT_Mu8_TrkIsoVVL_v11, fragment.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16, fragment.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v16, fragment.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v17, fragment.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v17, fragment.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v11, fragment.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v9, fragment.HLT_Mu17_TrkIsoVVL_v11, fragment.HLT_Mu19_TrkIsoVVL_v2, fragment.HLT_BTagMu_AK4DiJet20_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet40_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet70_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet110_Mu5_v11, fragment.HLT_BTagMu_AK4DiJet170_Mu5_v10, fragment.HLT_BTagMu_AK4Jet300_Mu5_v11, fragment.HLT_BTagMu_AK8DiJet170_Mu5_v7, fragment.HLT_BTagMu_AK8Jet300_Mu5_v11, fragment.HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v1, fragment.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v17, fragment.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v17, fragment.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v5, fragment.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v5, fragment.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.HLT_Mu12_DoublePhoton20_v3, fragment.HLT_TriplePhoton_20_20_20_CaloIdLV2_v2, fragment.HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v2, fragment.HLT_TriplePhoton_30_30_10_CaloIdLV2_v3, fragment.HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v3, fragment.HLT_TriplePhoton_35_35_5_CaloIdLV2_R9IdVL_v3, fragment.HLT_Photon20_v1, fragment.HLT_Photon33_v4, fragment.HLT_Photon50_v12, fragment.HLT_Photon75_v12, fragment.HLT_Photon90_v12, fragment.HLT_Photon120_v12, fragment.HLT_Photon150_v5, fragment.HLT_Photon175_v13, fragment.HLT_Photon200_v12, fragment.HLT_Photon50_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon75_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v3, fragment.HLT_Photon90_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon120_R9Id90_HE10_IsoM_v13, fragment.HLT_Photon165_R9Id90_HE10_IsoM_v14, fragment.HLT_Photon90_CaloIdL_PFHT700_v14, fragment.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v12, fragment.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v12, fragment.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, fragment.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, fragment.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, fragment.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, fragment.HLT_Dimuon0_Jpsi_L1_NoOS_v6, fragment.HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v6, fragment.HLT_Dimuon0_Jpsi_v7, fragment.HLT_Dimuon0_Jpsi_NoVertexing_v7, fragment.HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v6, fragment.HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v6, fragment.HLT_Dimuon0_Jpsi3p5_Muon2_v5, fragment.HLT_Dimuon0_Upsilon_L1_4p5_v7, fragment.HLT_Dimuon0_Upsilon_L1_5_v7, fragment.HLT_Dimuon0_Upsilon_L1_4p5NoOS_v6, fragment.HLT_Dimuon0_Upsilon_L1_4p5er2p0_v7, fragment.HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v6, fragment.HLT_Dimuon0_Upsilon_NoVertexing_v6, fragment.HLT_Dimuon0_Upsilon_L1_5M_v6, fragment.HLT_Dimuon0_LowMass_L1_0er1p5R_v6, fragment.HLT_Dimuon0_LowMass_L1_0er1p5_v7, fragment.HLT_Dimuon0_LowMass_v7, fragment.HLT_Dimuon0_LowMass_L1_4_v7, fragment.HLT_Dimuon0_LowMass_L1_4R_v6, fragment.HLT_Dimuon0_LowMass_L1_TM530_v5, fragment.HLT_Dimuon0_Upsilon_Muon_L1_TM0_v5, fragment.HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v5, fragment.HLT_TripleMu_5_3_3_Mass3p8to60_DZ_v7, fragment.HLT_TripleMu_10_5_5_DZ_v9, fragment.HLT_TripleMu_12_10_5_v9, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v2, fragment.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v2, fragment.HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8, fragment.HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v8, fragment.HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v8, fragment.HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v5, fragment.HLT_DoubleMu4_Jpsi_Displaced_v6, fragment.HLT_DoubleMu4_Jpsi_NoVertexing_v6, fragment.HLT_DoubleMu4_JpsiTrkTrk_Displaced_v6, fragment.HLT_DoubleMu43NoFiltersNoVtx_v3, fragment.HLT_DoubleMu48NoFiltersNoVtx_v3, fragment.HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v4, fragment.HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v4, fragment.HLT_DoubleMu20_7_Mass0to30_L1_DM4_v6, fragment.HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v6, fragment.HLT_HT425_v8, fragment.HLT_HT430_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT500_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT430_DisplacedDijet60_DisplacedTrack_v11, fragment.HLT_HT400_DisplacedDijet40_DisplacedTrack_v11, fragment.HLT_HT650_DisplacedDijet60_Inclusive_v11, fragment.HLT_HT550_DisplacedDijet60_Inclusive_v11, fragment.HLT_DiJet110_35_Mjj650_PFMET110_v7, fragment.HLT_DiJet110_35_Mjj650_PFMET120_v7, fragment.HLT_DiJet110_35_Mjj650_PFMET130_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET110_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET120_v7, fragment.HLT_TripleJet110_35_35_Mjj650_PFMET130_v7, fragment.HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_VBF_DoubleMediumChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_VBF_DoubleTightChargedIsoPFTau20_Trk1_eta2p1_v1, fragment.HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v11, fragment.HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v11, fragment.HLT_Ele28_HighEta_SC20_Mass55_v11, fragment.HLT_DoubleMu20_7_Mass0to30_Photon23_v6, fragment.HLT_Ele15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, fragment.HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v14, fragment.HLT_Ele15_IsoVVVL_PFHT450_v14, fragment.HLT_Ele50_IsoVVVL_PFHT450_v14, fragment.HLT_Ele15_IsoVVVL_PFHT600_v18, fragment.HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v13, fragment.HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v12, fragment.HLT_Mu15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, fragment.HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v13, fragment.HLT_Mu15_IsoVVVL_PFHT450_v13, fragment.HLT_Mu50_IsoVVVL_PFHT450_v13, fragment.HLT_Mu15_IsoVVVL_PFHT600_v17, fragment.HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v6, fragment.HLT_Dimuon20_Jpsi_Barrel_Seagulls_v6, fragment.HLT_Dimuon10_Upsilon_Barrel_Seagulls_v6, fragment.HLT_Dimuon12_Upsilon_eta1p5_v13, fragment.HLT_Dimuon14_Phi_Barrel_Seagulls_v6, fragment.HLT_Dimuon18_PsiPrime_v13, fragment.HLT_Dimuon25_Jpsi_v13, fragment.HLT_Dimuon18_PsiPrime_noCorrL1_v4, fragment.HLT_Dimuon24_Upsilon_noCorrL1_v4, fragment.HLT_Dimuon24_Phi_noCorrL1_v4, fragment.HLT_Dimuon25_Jpsi_noCorrL1_v4, fragment.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v15, fragment.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v15, fragment.HLT_DoubleIsoMu20_eta2p1_v5, fragment.HLT_DoubleIsoMu24_eta2p1_v5, fragment.HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v5, fragment.HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v11, fragment.HLT_TrkMu17_DoubleTrkMu8NoFiltersNoVtx_v12, fragment.HLT_Mu8_v11, fragment.HLT_Mu17_v11, fragment.HLT_Mu19_v2, fragment.HLT_Mu17_Photon30_IsoCaloId_v4, fragment.HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v14, fragment.HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, fragment.HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v1, fragment.HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, fragment.HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v16, fragment.HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v14, fragment.HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v16, fragment.HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v16, fragment.HLT_Ele115_CaloIdVT_GsfTrkIdT_v12, fragment.HLT_Ele135_CaloIdVT_GsfTrkIdT_v5, fragment.HLT_Ele145_CaloIdVT_GsfTrkIdT_v6, fragment.HLT_Ele200_CaloIdVT_GsfTrkIdT_v6, fragment.HLT_Ele250_CaloIdVT_GsfTrkIdT_v11, fragment.HLT_Ele300_CaloIdVT_GsfTrkIdT_v11, fragment.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v1, fragment.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v7, fragment.HLT_PFHT380_SixPFJet32_DoublePFBTagCSV_2p2_v7, fragment.HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_2p2_v6, fragment.HLT_PFHT380_SixPFJet32_v7, fragment.HLT_PFHT430_SixPFJet40_PFBTagCSV_1p5_v7, fragment.HLT_PFHT430_SixPFJet40_v9, fragment.HLT_PFHT350_v17, fragment.HLT_PFHT350MinPFJet15_v7, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_v4, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v4, fragment.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v9, fragment.HLT_FullTrack_Multiplicity85_v3, fragment.HLT_FullTrack_Multiplicity100_v2, fragment.HLT_FullTrack_Multiplicity130_v2, fragment.HLT_FullTrack_Multiplicity155_v3, fragment.HLT_ECALHT800_v9, fragment.HLT_DiSC30_18_EIso_AND_HE_Mass70_v12, fragment.HLT_Physics_v7, fragment.HLT_Physics_part0_v7, fragment.HLT_Physics_part1_v7, fragment.HLT_Physics_part2_v7, fragment.HLT_Physics_part3_v7, fragment.HLT_Physics_part4_v7, fragment.HLT_Physics_part5_v7, fragment.HLT_Physics_part6_v7, fragment.HLT_Physics_part7_v7, fragment.DST_Physics_v7, fragment.HLT_Random_v3, fragment.HLT_ZeroBias_v6, fragment.HLT_ZeroBias_part0_v6, fragment.HLT_ZeroBias_part1_v6, fragment.HLT_ZeroBias_part2_v6, fragment.HLT_ZeroBias_part3_v6, fragment.HLT_ZeroBias_part4_v6, fragment.HLT_ZeroBias_part5_v6, fragment.HLT_ZeroBias_part6_v6, fragment.HLT_ZeroBias_part7_v6, fragment.DST_ZeroBias_v2, fragment.DST_HT250_CaloScouting_v9, fragment.DST_HT250_CaloBTagScouting_v8, fragment.DST_HT410_PFScouting_v14, fragment.DST_HT410_BTagScouting_v14, fragment.DST_ZeroBias_BTagScouting_v13, fragment.DST_ZeroBias_CaloScouting_PFScouting_v12, fragment.DST_CaloJet40_BTagScouting_v13, fragment.DST_CaloJet40_CaloScouting_PFScouting_v13, fragment.DST_CaloJet40_CaloBTagScouting_v12, fragment.DST_L1HTT_BTagScouting_v13, fragment.DST_L1HTT_CaloScouting_PFScouting_v13, fragment.DST_L1HTT_CaloBTagScouting_v12, fragment.DST_L1DoubleMu_BTagScouting_v14, fragment.DST_L1DoubleMu_CaloScouting_PFScouting_v13, fragment.DST_DoubleMu3_noVtx_CaloScouting_Monitoring_v5, fragment.DST_DoubleMu3_noVtx_CaloScouting_v5, fragment.DST_DoubleMu1_noVtx_CaloScouting_v1, fragment.DST_DoubleMu3_noVtx_Mass10_PFScouting_v1, fragment.HLT_AK4CaloJet30_v11, fragment.HLT_AK4CaloJet40_v10, fragment.HLT_AK4CaloJet50_v10, fragment.HLT_AK4CaloJet80_v10, fragment.HLT_AK4CaloJet100_v10, fragment.HLT_AK4CaloJet120_v9, fragment.HLT_AK4PFJet30_v17, fragment.HLT_AK4PFJet50_v17, fragment.HLT_AK4PFJet80_v17, fragment.HLT_AK4PFJet100_v17, fragment.HLT_AK4PFJet120_v16, fragment.HLT_SinglePhoton10_Eta3p1ForPPRef_v8, fragment.HLT_SinglePhoton20_Eta3p1ForPPRef_v8, fragment.HLT_SinglePhoton30_Eta3p1ForPPRef_v8, fragment.HLT_Photon20_HoverELoose_v9, fragment.HLT_Photon30_HoverELoose_v9, fragment.HLT_EcalCalibration_v4, fragment.HLT_HcalCalibration_v5, fragment.AlCa_EcalPhiSym_v8, fragment.HLT_L1UnpairedBunchBptxMinus_v2, fragment.HLT_L1UnpairedBunchBptxPlus_v2, fragment.HLT_L1NotBptxOR_v3, fragment.HLT_L1MinimumBiasHF_OR_v2, fragment.HLT_L1MinimumBiasHF0OR_v3, fragment.HLT_L1_CDC_SingleMu_3_er1p2_TOP120_DPHI2p618_3p142_v2, fragment.HLT_HcalNZS_v12, fragment.HLT_HcalPhiSym_v14, fragment.HLT_HcalIsolatedbunch_v4, fragment.HLT_IsoTrackHB_v3, fragment.HLT_IsoTrackHE_v3, fragment.HLT_ZeroBias_FirstCollisionAfterAbortGap_v5, fragment.HLT_ZeroBias_IsolatedBunches_v5, fragment.HLT_ZeroBias_FirstCollisionInTrain_v4, fragment.HLT_ZeroBias_LastCollisionInTrain_v3, fragment.HLT_ZeroBias_FirstBXAfterTrain_v3, fragment.AlCa_RPCMuonNormalisation_v13, fragment.AlCa_LumiPixels_Random_v4, fragment.AlCa_LumiPixels_ZeroBias_v8, fragment.MC_ReducedIterativeTracking_v11, fragment.MC_PFMET_v15, fragment.MC_AK4PFJets_v15, fragment.MC_PFBTagCSV_v9, fragment.MC_PFHT_v14, fragment.MC_PFMHT_v14, fragment.MC_CaloMET_v8, fragment.MC_CaloMET_JetIdCleaned_v9, fragment.MC_AK4CaloJets_v9, fragment.MC_AK4CaloJetsFromPV_v7, fragment.MC_CaloBTagCSV_v7, fragment.MC_CaloHT_v8, fragment.MC_CaloMHT_v8, fragment.MC_AK8PFJets_v15, fragment.MC_AK8TrimPFJets_v15, fragment.MC_AK8PFHT_v14, fragment.MC_AK8CaloHT_v8, fragment.MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v12, fragment.MC_DoubleEle5_CaloIdL_MW_v13, fragment.MC_Ele5_WPTight_Gsf_v6, fragment.MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v13, fragment.MC_IsoMu_v13, fragment.MC_DoubleMu_TrkIsoVVL_DZ_v10, fragment.MC_DoubleMuNoFiltersNoVtx_v7, fragment.AlCa_EcalPi0EBonly_v12, fragment.AlCa_EcalPi0EEonly_v12, fragment.AlCa_EcalEtaEBonly_v12, fragment.AlCa_EcalEtaEEonly_v12, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, fragment.HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleMediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_DoubleTightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v10, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v6, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v1, fragment.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, fragment.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v9, fragment.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, fragment.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, fragment.HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v7, fragment.HLT_Rsq0p35_v13, fragment.HLT_Rsq0p40_v13, fragment.HLT_RsqMR300_Rsq0p09_MR200_v13, fragment.HLT_RsqMR320_Rsq0p09_MR200_v13, fragment.HLT_RsqMR300_Rsq0p09_MR200_4jet_v13, fragment.HLT_RsqMR320_Rsq0p09_MR200_4jet_v13, fragment.HLT_IsoMu27_LooseChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_MediumChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_TightChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, fragment.HLT_IsoMu27_MET90_v1, fragment.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v1, fragment.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_CrossL1_v1, fragment.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1, fragment.HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v3, fragment.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v3, fragment.HLT_PFMET100_PFMHT100_IDTight_PFHT60_v7, fragment.HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v7, fragment.HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v7, fragment.HLT_Mu18_Mu9_SameSign_v3, fragment.HLT_Mu18_Mu9_SameSign_DZ_v3, fragment.HLT_Mu18_Mu9_v3, fragment.HLT_Mu18_Mu9_DZ_v3, fragment.HLT_Mu20_Mu10_SameSign_v3, fragment.HLT_Mu20_Mu10_SameSign_DZ_v3, fragment.HLT_Mu20_Mu10_v3, fragment.HLT_Mu20_Mu10_DZ_v3, fragment.HLT_Mu23_Mu12_SameSign_v3, fragment.HLT_Mu23_Mu12_SameSign_DZ_v3, fragment.HLT_Mu23_Mu12_v3, fragment.HLT_Mu23_Mu12_DZ_v3, fragment.HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v5, fragment.HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v3, fragment.HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8, fragment.HLT_TripleMu_5_3_3_Mass3p8to60_DCA_v2, fragment.HLT_QuadPFJet98_83_71_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet103_88_75_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet105_90_76_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet111_90_80_15_DoubleBTagCSV_p013_p08_VBF1_v7, fragment.HLT_QuadPFJet98_83_71_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet103_88_75_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet105_88_76_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet111_90_80_15_BTagCSV_p013_VBF2_v7, fragment.HLT_QuadPFJet98_83_71_15_v3, fragment.HLT_QuadPFJet103_88_75_15_v3, fragment.HLT_QuadPFJet105_88_76_15_v3, fragment.HLT_QuadPFJet111_90_80_15_v3, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p17_v1, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p1_v1, fragment.HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v1, fragment.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v8, fragment.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v8, fragment.HLTriggerFinalPath, fragment.HLTAnalyzerEndpath, fragment.ScoutingPFOutput, fragment.ScoutingCaloMuonOutput )) # dummyfy hltGetConditions in cff's diff --git a/HLTrigger/Configuration/python/HLT_HIon_cff.py b/HLTrigger/Configuration/python/HLT_HIon_cff.py index b23a10740e669..90e9591689b0d 100644 --- a/HLTrigger/Configuration/python/HLT_HIon_cff.py +++ b/HLTrigger/Configuration/python/HLT_HIon_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/HIon --type HIon +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/HIon --type HIon -# /dev/CMSSW_10_0_0/HIon/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/HIon/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/HIon/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/HIon/V1') ) fragment.transferSystem = cms.PSet( @@ -2477,13 +2477,13 @@ 'HcalCellDead' ) ) fragment.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2496,7 +2496,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2505,12 +2505,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2523,7 +2523,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2533,13 +2533,13 @@ trackFlip = cms.bool( False ) ) fragment.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2565,18 +2565,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2602,7 +2602,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), diff --git a/HLTrigger/Configuration/python/HLT_PIon_cff.py b/HLTrigger/Configuration/python/HLT_PIon_cff.py index c3185df64dd82..9afccc5baa389 100644 --- a/HLTrigger/Configuration/python/HLT_PIon_cff.py +++ b/HLTrigger/Configuration/python/HLT_PIon_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/PIon --type PIon +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/PIon --type PIon -# /dev/CMSSW_10_0_0/PIon/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/PIon/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/PIon/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/PIon/V1') ) fragment.transferSystem = cms.PSet( @@ -2477,13 +2477,13 @@ 'HcalCellDead' ) ) fragment.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2496,7 +2496,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2505,12 +2505,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2523,7 +2523,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2533,13 +2533,13 @@ trackFlip = cms.bool( False ) ) fragment.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2565,18 +2565,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2602,7 +2602,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), diff --git a/HLTrigger/Configuration/python/HLT_PRef_cff.py b/HLTrigger/Configuration/python/HLT_PRef_cff.py index aab428df316d9..866ed65e78eb1 100644 --- a/HLTrigger/Configuration/python/HLT_PRef_cff.py +++ b/HLTrigger/Configuration/python/HLT_PRef_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_10_0_0/PRef --type PRef +# hltGetConfiguration --cff --data /dev/CMSSW_10_1_0/PRef --type PRef -# /dev/CMSSW_10_0_0/PRef/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/PRef/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/PRef/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/PRef/V1') ) fragment.transferSystem = cms.PSet( @@ -2842,13 +2842,13 @@ 'HcalCellDead' ) ) fragment.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2861,7 +2861,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2870,12 +2870,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2888,7 +2888,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2898,13 +2898,13 @@ trackFlip = cms.bool( False ) ) fragment.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2930,18 +2930,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2967,7 +2967,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -4417,9 +4417,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) fragment.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -4427,10 +4429,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) fragment.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -12373,15 +12377,15 @@ ) fragment.hltSiPixelClustersAfterSplittingForRefPP = cms.EDProducer( "JetCoreClusterSplitter", verbose = cms.bool( False ), - deltaRmax = cms.double( 0.05 ), + chargeFractionMin = cms.double( 2.0 ), forceXError = cms.double( 100.0 ), vertices = cms.InputTag( "hltFullIter0PrimaryVerticesPreSplittingForRefPP" ), chargePerUnit = cms.double( 2000.0 ), - forceYError = cms.double( 150.0 ), centralMIPCharge = cms.double( 26000.0 ), + forceYError = cms.double( 150.0 ), pixelClusters = cms.InputTag( "hltSiPixelClustersForRefPP" ), ptMin = cms.double( 200.0 ), - chargeFractionMin = cms.double( 2.0 ), + deltaRmax = cms.double( 0.05 ), cores = cms.InputTag( "hltJetsForCoreTracking" ), fractionalWidth = cms.double( 0.4 ), pixelCPE = cms.string( "hltESPPixelCPEGeneric" ) @@ -17189,11 +17193,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) fragment.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) fragment.hltEle10WPLoose1GsfOneOEMinusOneOPFilterForHI = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py index b665efed5c9fd..71d6d6843a6e2 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_10_0_0/GRun +# /dev/CMSSW_10_1_0/GRun import FWCore.ParameterSet.Config as cms @@ -733,6 +733,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8', 'HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8', diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py index 278cb00d53f18..1985e34c4bee7 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_10_0_0/HIon +# /dev/CMSSW_10_1_0/HIon import FWCore.ParameterSet.Config as cms diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py index 8751a3b1b2ad0..6b7d12db93cd8 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_10_0_0/PIon +# /dev/CMSSW_10_1_0/PIon import FWCore.ParameterSet.Config as cms diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py index 71fb8fb036b3c..50ae0168627a5 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_10_0_0/PRef +# /dev/CMSSW_10_1_0/PRef import FWCore.ParameterSet.Config as cms diff --git a/HLTrigger/Configuration/python/Tools/confdb.py b/HLTrigger/Configuration/python/Tools/confdb.py index d4b394e11c4c8..51e89261de7e9 100644 --- a/HLTrigger/Configuration/python/Tools/confdb.py +++ b/HLTrigger/Configuration/python/Tools/confdb.py @@ -682,9 +682,9 @@ def buildPathList(self): else: # drop all output EndPaths but the Scouting ones, and drop the RatesMonitoring and DQMHistograms paths.append( "-*Output" ) - paths.append( "Scouting*Output" ) paths.append( "-RatesMonitoring") paths.append( "-DQMHistograms") + if self.config.fragment: paths.append( "Scouting*Output" ) elif self.config.output in ('dqm', 'minimal', 'full'): if self.config.paths: @@ -693,8 +693,8 @@ def buildPathList(self): else: # drop all output EndPaths but the Scouting ones, and drop the RatesMonitoring paths.append( "-*Output" ) - paths.append( "Scouting*Output" ) paths.append( "-RatesMonitoring") + if self.config.fragment: paths.append( "Scouting*Output" ) else: if self.config.paths: diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 677eb44aba50f..0d6851377cf49 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -55,36 +55,6 @@ def customiseForUncollapsed(process): return process -def customiseFor22621_forIsoTrackHBHE(process): - """Adapt the HLT to run with different setting - of thresholds for EB/EE in """ - - for producer in producers_by_type(process, "IsolatedEcalPixelTrackCandidateProducer"): - del producer.ECHitEnergyThreshold - del producer.ECHitCountEnergyThreshold - del producer.EcalConeSizeEta0 - del producer.EcalConeSizeEta1 - producer.EBHitEnergyThreshold = cms.double(0.10) - producer.EBHitCountEnergyThreshold = cms.double(0.5) - producer.EEHitEnergyThreshold0 = cms.double(-20.5332) - producer.EEHitEnergyThreshold1 = cms.double(34.3975) - producer.EEHitEnergyThreshold2 = cms.double(-19.0741) - producer.EEHitEnergyThreshold3 = cms.double(3.52151) - producer.EEFacHitCountEnergyThreshold= cms.double(10.0) - producer.EcalConeSizeEta0 = cms.double(0.09) - producer.EcalConeSizeEta1 = cms.double(0.14) - - for filter in filters_by_type(process, "HLTEcalPixelIsolTrackFilter"): - del filter.MaxEnergyIn - del filter.MaxEnergyOut - filter.MaxEnergyInEB = cms.double( 2.0 ) - filter.MaxEnergyOutEB = cms.double( 1.2 ) - filter.MaxEnergyInEE = cms.double( 2.0 ) - filter.MaxEnergyOutEE = cms.double( 1.2 ) - - return process - - def customiseFor21664_forMahiOn(process): for producer in producers_by_type(process, "HBHEPhase1Reconstructor"): producer.algorithm.useMahi = cms.bool(True) @@ -224,6 +194,5 @@ def customizeHLTforCMSSW(process, menuType="GRun"): # add call to action function in proper order: newest last! # process = customiseFor12718(process) - process = customiseFor22621_forIsoTrackHBHE(process) return process diff --git a/HLTrigger/Configuration/tables/GRun.txt b/HLTrigger/Configuration/tables/GRun.txt index edb0621876402..d3f04564e0e58 100644 --- a/HLTrigger/Configuration/tables/GRun.txt +++ b/HLTrigger/Configuration/tables/GRun.txt @@ -612,6 +612,10 @@ HLT_DoubleL2Mu25NoVtx_2Cha_v* # CMSHLT-1727 HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v* # CMSHLT-1727 HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v* # CMSHLT-1743 HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v* # CMSHLT-1743 +HLT_L2Mu23NoVtx_2Cha_v* # CMSHLT-1727 +HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v* # CMSHLT-1727 +HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v* # CMSHLT-1727 +HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v* # CMSHLT-1727 ## EndPath ## diff --git a/HLTrigger/Configuration/tables/makeOnlineGRun b/HLTrigger/Configuration/tables/makeOnlineGRun index ac547e3096f29..05dcf42b886cb 100755 --- a/HLTrigger/Configuration/tables/makeOnlineGRun +++ b/HLTrigger/Configuration/tables/makeOnlineGRun @@ -3,8 +3,8 @@ # generate HLT tables from master table in ConfDB # -MASTER="/dev/CMSSW_9_2_0/HLT" # no version, take the latest one -TARGET="/online/collisions/2017/2e34/v4.0/HLT" # where to store the online-compliant menu +MASTER="/dev/CMSSW_10_1_0/HLT" # no version, take the latest one +TARGET="/online/collisions/2018/2e34/v1.0/HLT" # where to store the online-compliant menu TABLES="online_grun" source subtables.sh diff --git a/HLTrigger/Configuration/tables/makeSubTables b/HLTrigger/Configuration/tables/makeSubTables index b935eca6b3da9..b85551263028e 100755 --- a/HLTrigger/Configuration/tables/makeSubTables +++ b/HLTrigger/Configuration/tables/makeSubTables @@ -3,9 +3,9 @@ # generate HLT tables from master table in ConfDB # -MASTER="/dev/CMSSW_10_0_0/HLT" # no version, take the latest one +MASTER="/dev/CMSSW_10_1_0/HLT" # no version, take the latest one #MASTER="/users/sdonato/STORM/menuV1p1/HLT" -TARGET="/dev/CMSSW_10_0_0/TABLE" # directory where to store the sub-tables +TARGET="/dev/CMSSW_10_1_0/TABLE" # directory where to store the sub-tables TABLES="GRun HIon PIon PRef" # which sub-tables to create source subtables.sh diff --git a/HLTrigger/Configuration/tables/online_grun.txt b/HLTrigger/Configuration/tables/online_grun.txt index d83cf526d79ad..20e9e20c20e87 100644 --- a/HLTrigger/Configuration/tables/online_grun.txt +++ b/HLTrigger/Configuration/tables/online_grun.txt @@ -614,6 +614,10 @@ HLT_DoubleL2Mu25NoVtx_2Cha_v* # CMSHLT-1727 HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v* # CMSHLT-1727 HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v* # CMSHLT-1743 HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v* # CMSHLT-1743 +HLT_L2Mu23NoVtx_2Cha_v* # CMSHLT-1727 +HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v* # CMSHLT-1727 +HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v* # CMSHLT-1727 +HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v* # CMSHLT-1727 ## EndPath ## diff --git a/HLTrigger/Configuration/test/OnLine_HLT_FULL.py b/HLTrigger/Configuration/test/OnLine_HLT_FULL.py index 07046c6fd9842..6396da0f67543 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_FULL.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_FULL.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/HLT --type FULL --unprescale --process HLTFULL --globaltag auto:run2_hlt_FULL --input file:RelVal_Raw_FULL_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/HLT --type FULL --unprescale --process HLTFULL --globaltag auto:run2_hlt_FULL --input file:RelVal_Raw_FULL_DATA.root -# /dev/CMSSW_10_0_0/HLT/V140 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/HLT/V3 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFULL" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/HLT/V140') + tableName = cms.string('/dev/CMSSW_10_1_0/HLT/V3') ) process.transferSystem = cms.PSet( @@ -4532,13 +4532,13 @@ ) process.hcal_db_producer = cms.ESProducer( "HcalDbProducer" ) process.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -4551,7 +4551,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -4560,12 +4560,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -4578,7 +4578,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -4588,13 +4588,13 @@ trackFlip = cms.bool( False ) ) process.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4620,18 +4620,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4657,7 +4657,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -6252,9 +6252,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) process.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -6262,10 +6264,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) process.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -13052,11 +13056,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) process.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) process.hltDiMu5Ele3CaloIdLTrackIdLElectronlegOneOEMinusOneOPFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -38905,6 +38911,7 @@ lMinHighEHitTime = cms.double( -9999.0 ), fillLaserMonitor = cms.bool( True ), tMinHPDHits = cms.int32( 16 ), + tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), minRecHitE = cms.double( 1.5 ), pMaxHighEHitTime = cms.double( 5.0 ), lRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.5, 0.0, 0.0, 1.0, -0.5 ), @@ -38918,12 +38925,13 @@ maxNHF = cms.double( 0.9 ), minHighHitE = cms.double( 25.0 ), minR45HitE = cms.double( 5.0 ), - tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), + lasermonDigis = cms.InputTag( 'hltHcalDigis','LASERMON' ), lMinZeros = cms.int32( 10 ), lMinRBXHits = cms.int32( 999 ), fillRecHits = cms.bool( True ), minERatio = cms.double( 50.0 ), TS4TS5LowerThreshold = cms.vdouble( 100.0, 120.0, 150.0, 200.0, 300.0, 400.0, 500.0 ), + hlMaxRBXEMF = cms.double( 0.01 ), lMinHPDNoOtherHits = cms.int32( 10 ), pMinRBXRechitR45EnergyFraction = cms.double( 0.1 ), hlMaxHPDEMF = cms.double( -9999.0 ), @@ -38933,7 +38941,6 @@ laserMonIEtaList = cms.vint32( 0, 0, 0, 0, 0, 0, 0, 0 ), laserMonIPhiList = cms.vint32( 23, 17, 11, 5, 29, 35, 41, 47 ), pMinRatio = cms.double( 0.75 ), - tMinLowEHitTime = cms.double( -9999.0 ), HcalAcceptSeverityLevel = cms.uint32( 9 ), pMaxRBXEMF = cms.double( 0.02 ), tMaxRatio = cms.double( 0.92 ), @@ -38966,7 +38973,7 @@ tMinHPDNoOtherHits = cms.int32( 9 ), pMaxHPDEMF = cms.double( 0.02 ), jetCollName = cms.string( "" ), - hlMaxRBXEMF = cms.double( 0.01 ), + tMinLowEHitTime = cms.double( -9999.0 ), tMaxHighEHitTime = cms.double( 6.0 ), pMaxLowEHitTime = cms.double( 6.0 ), lMinHPDHits = cms.int32( 17 ), @@ -55489,6 +55496,7 @@ MinPt = cms.double( 110.0 ) ) process.hltL1TPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 35.0 ), mjjMin = cms.double( 650.0 ), @@ -57083,6 +57091,7 @@ MinPt = cms.double( 20.0 ) ) process.hltVBFL1TLooseIDPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 40.0 ), mjjMin = cms.double( 650.0 ), @@ -66273,13 +66282,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForBtag" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForBtag" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -77919,15 +77928,15 @@ ) process.hltSiPixelClustersAfterSplittingForRefPP = cms.EDProducer( "JetCoreClusterSplitter", verbose = cms.bool( False ), - deltaRmax = cms.double( 0.05 ), + chargeFractionMin = cms.double( 2.0 ), forceXError = cms.double( 100.0 ), vertices = cms.InputTag( "hltFullIter0PrimaryVerticesPreSplittingForRefPP" ), chargePerUnit = cms.double( 2000.0 ), - forceYError = cms.double( 150.0 ), centralMIPCharge = cms.double( 26000.0 ), + forceYError = cms.double( 150.0 ), pixelClusters = cms.InputTag( "hltSiPixelClustersForRefPP" ), ptMin = cms.double( 200.0 ), - chargeFractionMin = cms.double( 2.0 ), + deltaRmax = cms.double( 0.05 ), cores = cms.InputTag( "hltJetsForCoreTracking" ), fractionalWidth = cms.double( 0.4 ), pixelCPE = cms.string( "hltESPPixelCPEGeneric" ) @@ -86213,20 +86222,27 @@ filterTrackEnergy = cms.bool( True ) ) process.hltIsolEcalPixelTrackProdHB = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) process.hltEcalIsolPixelTrackL2FilterHB = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHB" ) ) process.hltHcalITIPTCorrectorHB = cms.EDProducer( "IPTCorrector", @@ -86283,20 +86299,27 @@ filterTrackEnergy = cms.bool( True ) ) process.hltIsolEcalPixelTrackProdHE = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) process.hltEcalIsolPixelTrackL2FilterHE = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHE" ) ) process.hltHcalITIPTCorrectorHE = cms.EDProducer( "IPTCorrector", @@ -100966,13 +100989,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForDBtagAK8" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForDBtagAK8" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake.py index 5f31777cba5f4..2b641a242a976 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/Fake --type Fake --unprescale --process HLTFake --globaltag auto:run1_hlt_Fake --input file:RelVal_Raw_Fake_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/Fake --type Fake --unprescale --process HLTFake --globaltag auto:run1_hlt_Fake --input file:RelVal_Raw_Fake_DATA.root -# /dev/CMSSW_10_0_0/Fake/V7 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake/V7') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake/V2') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py index c60f7d0e41a0a..ebf21f3ea9123 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/Fake1 --type Fake1 --unprescale --process HLTFake1 --globaltag auto:run2_hlt_Fake1 --input file:RelVal_Raw_Fake1_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/Fake1 --type Fake1 --unprescale --process HLTFake1 --globaltag auto:run2_hlt_Fake1 --input file:RelVal_Raw_Fake1_DATA.root -# /dev/CMSSW_10_0_0/Fake1/V7 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake1/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake1" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake1/V7') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake1/V2') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py index e162c8aec8e5a..4dace6c067da4 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/Fake2 --type Fake2 --unprescale --process HLTFake2 --globaltag auto:run2_hlt_Fake2 --input file:RelVal_Raw_Fake2_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/Fake2 --type Fake2 --unprescale --process HLTFake2 --globaltag auto:run2_hlt_Fake2 --input file:RelVal_Raw_Fake2_DATA.root -# /dev/CMSSW_10_0_0/Fake2/V8 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/Fake2/V2 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake2" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/Fake2/V8') + tableName = cms.string('/dev/CMSSW_10_1_0/Fake2/V2') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py index f9a3053ab79eb..1c64b1d61dd31 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/GRun --type GRun --unprescale --process HLTGRun --globaltag auto:run2_hlt_GRun --input file:RelVal_Raw_GRun_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/GRun --type GRun --unprescale --process HLTGRun --globaltag auto:run2_hlt_GRun --input file:RelVal_Raw_GRun_DATA.root -# /dev/CMSSW_10_0_0/GRun/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/GRun/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTGRun" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/GRun/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/GRun/V1') ) process.transferSystem = cms.PSet( @@ -2263,6 +2263,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8', 'HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8', @@ -2785,6 +2787,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10', @@ -2886,9 +2890,9 @@ 'HLT_HT500_DisplacedDijet40_DisplacedTrack_v11', 'HLT_HT550_DisplacedDijet60_Inclusive_v11', 'HLT_HT650_DisplacedDijet60_Inclusive_v11', - 'HLT_HcalNZS_v12', - 'HLT_HcalPhiSym_v14', - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10')+cms.vstring( 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', + 'HLT_HcalNZS_v12')+cms.vstring( 'HLT_HcalPhiSym_v14', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10', @@ -3140,9 +3144,9 @@ 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2', 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2', 'HLT_TkMu100_v2', - 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4', - 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', - 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7')+cms.vstring( 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', + 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4')+cms.vstring( 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', + 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7', + 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', 'HLT_TripleJet110_35_35_Mjj650_PFMET130_v7', 'HLT_TripleMu_10_5_5_DZ_v9', 'HLT_TripleMu_12_10_5_v9', @@ -3912,13 +3916,13 @@ ) process.hcal_db_producer = cms.ESProducer( "HcalDbProducer" ) process.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3931,7 +3935,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3940,12 +3944,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3958,7 +3962,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3968,13 +3972,13 @@ trackFlip = cms.bool( False ) ) process.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4000,18 +4004,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -4037,7 +4041,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -5632,9 +5636,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) process.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -5642,10 +5648,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) process.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -12384,11 +12392,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) process.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) process.hltDiMu5Ele3CaloIdLTrackIdLElectronlegOneOEMinusOneOPFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -32098,7 +32108,7 @@ L1MuonInputTag = cms.InputTag( 'hltGtStage2Digis','Muon' ), L1GlobalInputTag = cms.InputTag( "hltGtStage2Digis" ) ) -process.hltPreDoubleL2Mu50 = cms.EDFilter( "HLTPrescaler", +process.hltPreL2Mu23NoVtx2Cha = cms.EDFilter( "HLTPrescaler", L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) @@ -32112,26 +32122,54 @@ SelectQualities = cms.vint32( ), CandTag = cms.InputTag( 'hltGtStage2Digis','Muon' ) ) -process.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", +process.hltL2MuonCandidatesNoVtx = cms.EDProducer( "L2MuonCandidateProducer", + InputObjects = cms.InputTag( "hltL2Muons" ) +) +process.hltL2fL1sMuORL1f0L2NoVtx23Q2Cha = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), - CutOnChambers = cms.bool( False ), + CutOnChambers = cms.bool( True ), PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), - MinPt = cms.double( 50.0 ), - MinN = cms.int32( 2 ), - SeedMapTag = cms.InputTag( "hltL2MuonsAllBx" ), - MaxEta = cms.double( 2.5 ), - MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinPt = cms.double( 23.0 ), + MinN = cms.int32( 1 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MaxEta = cms.double( 2.0 ), + MinNhits = cms.vint32( 0 ), MinDxySig = cms.double( -1.0 ), - MinNchambers = cms.vint32( 0 ), - AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), MaxDz = cms.double( 9999.0 ), MatchToPreviousCand = cms.bool( False ), - CandTag = cms.InputTag( "hltL2MuonCandidatesAllBx" ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), MinDr = cms.double( -1.0 ), NSigmaPt = cms.double( 0.0 ), - MinNstations = cms.vint32( 0, 2, 0, 2 ) + MinNstations = cms.vint32( 0 ) +) +process.hltPreL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +process.hltL2fL1sMuORL1f0L2NoVtx23Q2ChaCosmicSeed = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( True ), + PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), + MinPt = cms.double( 23.0 ), + MinN = cms.int32( 1 ), + SeedMapTag = cms.InputTag( "hltL2CosmicMuons" ), + MaxEta = cms.double( 2.0 ), + MinNhits = cms.vint32( 0 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtxMeanTimerCosmicSeed" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0 ) ) process.hltL1sDoubleMu125to157ORTripleMu444 = cms.EDFilter( "HLTL1TSeed", L1SeedsLogicalExpression = cms.string( "L1_DoubleMu_12_5 OR L1_DoubleMu_15_5_SQ OR L1_DoubleMu_15_7 OR L1_TripleMu_4_4_4" ), @@ -32144,7 +32182,7 @@ L1MuonInputTag = cms.InputTag( 'hltGtStage2Digis','Muon' ), L1GlobalInputTag = cms.InputTag( "hltGtStage2Digis" ) ) -process.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", +process.hltPreDoubleL2Mu30NoVtx2ChaCosmicSeedEta2p4 = cms.EDFilter( "HLTPrescaler", L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) @@ -32158,6 +32196,108 @@ SelectQualities = cms.vint32( ), CandTag = cms.InputTag( 'hltGtStage2Digis','Muon' ) ) +process.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q2ChaCosmicSeedEta2p4 = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( True ), + PreviousCandTag = cms.InputTag( "hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0" ), + MinPt = cms.double( 30.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2CosmicMuons" ), + MaxEta = cms.double( 2.4 ), + MinNhits = cms.vint32( 0 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 2 ), + AbsEtaBins = cms.vdouble( 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtxMeanTimerCosmicSeed" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0 ) +) +process.hltPreDoubleL2Mu30NoVtx2ChaEta2p4 = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +process.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( False ), + PreviousCandTag = cms.InputTag( "hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0" ), + MinPt = cms.double( 30.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MaxEta = cms.double( 2.5 ), + MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 0 ), + AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0, 2, 0, 2 ) +) +process.hltL2DoubleMu30NoVtxFiltered2ChaEta2p4 = cms.EDFilter( "HLTMuonDimuonL2FromL1TFilter", + saveTags = cms.bool( True ), + ChargeOpt = cms.int32( 0 ), + SeedMapTag = cms.InputTag( "hltL2Muons" ), + MinNchambers = cms.int32( 2 ), + FastAccept = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesNoVtx" ), + PreviousCandTag = cms.InputTag( "hltL1sDoubleMu125to157ORTripleMu444" ), + MinAngle = cms.double( -999.0 ), + MaxPtBalance = cms.double( 999999.0 ), + MaxAcop = cms.double( 3.15 ), + MinPtMin = cms.double( 30.0 ), + MaxInvMass = cms.double( 999999.0 ), + MinPtMax = cms.double( 30.0 ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MaxAngle = cms.double( 9999.0 ), + MaxDz = cms.double( 9999.0 ), + MinPtPair = cms.double( 0.0 ), + MaxDr = cms.double( 100.0 ), + MinAcop = cms.double( -1.0 ), + MinNstations = cms.int32( 0 ), + MinNhits = cms.int32( 0 ), + NSigmaPt = cms.double( 0.0 ), + MinPtBalance = cms.double( -1.0 ), + MaxEta = cms.double( 2.4 ), + MinInvMass = cms.double( -999999.0 ) +) +process.hltPreDoubleL2Mu50 = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) +process.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", + saveTags = cms.bool( True ), + MaxDr = cms.double( 9999.0 ), + CutOnChambers = cms.bool( False ), + PreviousCandTag = cms.InputTag( "hltL1fL1sMuORL1Filtered0" ), + MinPt = cms.double( 50.0 ), + MinN = cms.int32( 2 ), + SeedMapTag = cms.InputTag( "hltL2MuonsAllBx" ), + MaxEta = cms.double( 2.5 ), + MinNhits = cms.vint32( 0, 1, 0, 1 ), + MinDxySig = cms.double( -1.0 ), + MinNchambers = cms.vint32( 0 ), + AbsEtaBins = cms.vdouble( 0.9, 1.5, 2.1, 5.0 ), + MaxDz = cms.double( 9999.0 ), + MatchToPreviousCand = cms.bool( False ), + CandTag = cms.InputTag( "hltL2MuonCandidatesAllBx" ), + BeamSpotTag = cms.InputTag( "hltOnlineBeamSpot" ), + MinDr = cms.double( -1.0 ), + NSigmaPt = cms.double( 0.0 ), + MinNstations = cms.vint32( 0, 2, 0, 2 ) +) +process.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed = cms.EDFilter( "HLTPrescaler", + L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), + offset = cms.uint32( 0 ) +) process.hltL2fL1sMuORL1f0DoubleL2NoVtx23Q2ChaCosmicSeed = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), @@ -32233,9 +32373,6 @@ L1GtReadoutRecordTag = cms.InputTag( "hltGtStage2Digis" ), offset = cms.uint32( 0 ) ) -process.hltL2MuonCandidatesNoVtx = cms.EDProducer( "L2MuonCandidateProducer", - InputObjects = cms.InputTag( "hltL2Muons" ) -) process.hltL2pfL1sDoubleMu155ORTripleMu444L1f0L2PreFiltered0NoVtx = cms.EDFilter( "HLTMuonL2FromL1TPreFilter", saveTags = cms.bool( True ), MaxDr = cms.double( 9999.0 ), @@ -37605,6 +37742,7 @@ lMinHighEHitTime = cms.double( -9999.0 ), fillLaserMonitor = cms.bool( True ), tMinHPDHits = cms.int32( 16 ), + tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), minRecHitE = cms.double( 1.5 ), pMaxHighEHitTime = cms.double( 5.0 ), lRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.5, 0.0, 0.0, 1.0, -0.5 ), @@ -37618,12 +37756,13 @@ maxNHF = cms.double( 0.9 ), minHighHitE = cms.double( 25.0 ), minR45HitE = cms.double( 5.0 ), - tRBXRecHitR45Cuts = cms.vdouble( 0.0, 1.0, 0.0, -0.2, 0.0, 0.0, 1.0, -0.2 ), + lasermonDigis = cms.InputTag( 'hltHcalDigis','LASERMON' ), lMinZeros = cms.int32( 10 ), lMinRBXHits = cms.int32( 999 ), fillRecHits = cms.bool( True ), minERatio = cms.double( 50.0 ), TS4TS5LowerThreshold = cms.vdouble( 100.0, 120.0, 150.0, 200.0, 300.0, 400.0, 500.0 ), + hlMaxRBXEMF = cms.double( 0.01 ), lMinHPDNoOtherHits = cms.int32( 10 ), pMinRBXRechitR45EnergyFraction = cms.double( 0.1 ), hlMaxHPDEMF = cms.double( -9999.0 ), @@ -37633,7 +37772,6 @@ laserMonIEtaList = cms.vint32( 0, 0, 0, 0, 0, 0, 0, 0 ), laserMonIPhiList = cms.vint32( 23, 17, 11, 5, 29, 35, 41, 47 ), pMinRatio = cms.double( 0.75 ), - tMinLowEHitTime = cms.double( -9999.0 ), HcalAcceptSeverityLevel = cms.uint32( 9 ), pMaxRBXEMF = cms.double( 0.02 ), tMaxRatio = cms.double( 0.92 ), @@ -37666,7 +37804,7 @@ tMinHPDNoOtherHits = cms.int32( 9 ), pMaxHPDEMF = cms.double( 0.02 ), jetCollName = cms.string( "" ), - hlMaxRBXEMF = cms.double( 0.01 ), + tMinLowEHitTime = cms.double( -9999.0 ), tMaxHighEHitTime = cms.double( 6.0 ), pMaxLowEHitTime = cms.double( 6.0 ), lMinHPDHits = cms.int32( 17 ), @@ -53686,6 +53824,7 @@ MinPt = cms.double( 110.0 ) ) process.hltL1TPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 35.0 ), mjjMin = cms.double( 650.0 ), @@ -55280,6 +55419,7 @@ MinPt = cms.double( 20.0 ) ) process.hltVBFL1TLooseIDPFJetsMatching = cms.EDProducer( "L1TPFJetsMatching", + pt3Min = cms.double( 110.0 ), matchingR = cms.double( 0.5 ), pt2Min = cms.double( 40.0 ), mjjMin = cms.double( 650.0 ), @@ -64322,13 +64462,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForBtag" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForBtag" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -70286,20 +70426,27 @@ filterTrackEnergy = cms.bool( True ) ) process.hltIsolEcalPixelTrackProdHB = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHB" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) process.hltEcalIsolPixelTrackL2FilterHB = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHB" ) ) process.hltHcalITIPTCorrectorHB = cms.EDProducer( "IPTCorrector", @@ -70356,20 +70503,27 @@ filterTrackEnergy = cms.bool( True ) ) process.hltIsolEcalPixelTrackProdHE = cms.EDProducer( "IsolatedEcalPixelTrackCandidateProducer", - ECHitEnergyThreshold = cms.double( 0.05 ), - filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EEHitEnergyThreshold3 = cms.double( 3.52151 ), + EEHitEnergyThreshold2 = cms.double( -19.0741 ), + EEHitEnergyThreshold1 = cms.double( 34.3975 ), + EEHitEnergyThreshold0 = cms.double( -20.5332 ), + EBHitCountEnergyThreshold = cms.double( 0.5 ), + EBHitEnergyThreshold = cms.double( 0.1 ), EBRecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), - ECHitCountEnergyThreshold = cms.double( 0.5 ), + filterLabel = cms.InputTag( "hltIsolPixelTrackL2FilterHE" ), + EcalConeSizeEta1 = cms.double( 0.14 ), EcalConeSizeEta0 = cms.double( 0.09 ), EERecHitSource = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - EcalConeSizeEta1 = cms.double( 0.14 ) + EEFacHitCountEnergyThreshold = cms.double( 10.0 ) ) process.hltEcalIsolPixelTrackL2FilterHE = cms.EDFilter( "HLTEcalPixelIsolTrackFilter", saveTags = cms.bool( True ), DropMultiL2Event = cms.bool( False ), - MaxEnergyIn = cms.double( 1.2 ), - MaxEnergyOut = cms.double( 1.2 ), + MaxEnergyInEB = cms.double( 2.0 ), + MaxEnergyInEE = cms.double( 2.0 ), + MaxEnergyOutEB = cms.double( 1.2 ), NMaxTrackCandidates = cms.int32( 10 ), + MaxEnergyOutEE = cms.double( 1.2 ), candTag = cms.InputTag( "hltIsolEcalPixelTrackProdHE" ) ) process.hltHcalITIPTCorrectorHE = cms.EDProducer( "IPTCorrector", @@ -83252,13 +83406,13 @@ minimumTransverseMomentum = cms.double( 1.0 ), primaryVertex = cms.InputTag( "hltVerticesPFFilter" ), maximumLongitudinalImpactParameter = cms.double( 17.0 ), - computeGhostTrack = cms.bool( True ), + jets = cms.InputTag( "hltPFJetForDBtagAK8" ), maxDeltaR = cms.double( 0.4 ), candidates = cms.InputTag( "hltParticleFlow" ), jetDirectionUsingGhostTrack = cms.bool( False ), minimumNumberOfPixelHits = cms.int32( 2 ), jetDirectionUsingTracks = cms.bool( False ), - jets = cms.InputTag( "hltPFJetForDBtagAK8" ), + computeGhostTrack = cms.bool( True ), useTrackQuality = cms.bool( False ), ghostTrackPriorDeltaR = cms.double( 0.03 ), maximumChiSquared = cms.double( 5.0 ), @@ -83978,6 +84132,8 @@ 'HLT_L2Mu10_v7 / 3', 'HLT_L2Mu10_NoVertex_NoBPTX_v6 / 3', 'HLT_L2Mu50_v2 / 3', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1 / 3', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1 / 3', 'HLT_DoubleL2Mu50_v2 / 3', 'HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1 / 3', 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1 / 3', @@ -84152,9 +84308,9 @@ 'HLT_DoublePFJets200_CaloBTagCSV_p79_v1 / 3', 'HLT_DoublePFJets350_CaloBTagCSV_p79_v1 / 3', 'HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v1 / 3', - 'HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1 / 3', - 'HLT_Photon300_NoHE_v11 / 3', - 'HLT_Mu8_TrkIsoVVL_v11 / 3')+cms.vstring( 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16 / 3', + 'HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1 / 3')+cms.vstring( 'HLT_Photon300_NoHE_v11 / 3', + 'HLT_Mu8_TrkIsoVVL_v11 / 3', + 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16 / 3', 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v16 / 3', 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v17 / 3', 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v17 / 3', @@ -84406,9 +84562,9 @@ 'HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v7 / 3', 'HLT_Mu18_Mu9_SameSign_v3 / 3', 'HLT_Mu18_Mu9_SameSign_DZ_v3 / 3', - 'HLT_Mu18_Mu9_v3 / 3', - 'HLT_Mu18_Mu9_DZ_v3 / 3', - 'HLT_Mu20_Mu10_SameSign_v3 / 3')+cms.vstring( 'HLT_Mu20_Mu10_SameSign_DZ_v3 / 3', + 'HLT_Mu18_Mu9_v3 / 3')+cms.vstring( 'HLT_Mu18_Mu9_DZ_v3 / 3', + 'HLT_Mu20_Mu10_SameSign_v3 / 3', + 'HLT_Mu20_Mu10_SameSign_DZ_v3 / 3', 'HLT_Mu20_Mu10_v3 / 3', 'HLT_Mu20_Mu10_DZ_v3 / 3', 'HLT_Mu23_Mu12_SameSign_v3 / 3', @@ -85202,6 +85358,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v6', 'HLT_DoubleMu20_7_Mass0to30_L1_DM4_v6', @@ -85527,6 +85685,8 @@ 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu25NoVtx_2Cha_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1', 'HLT_DoubleL2Mu50_v2', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10', 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10', @@ -85628,9 +85788,9 @@ 'HLT_HT500_DisplacedDijet40_DisplacedTrack_v11', 'HLT_HT550_DisplacedDijet60_Inclusive_v11', 'HLT_HT650_DisplacedDijet60_Inclusive_v11', - 'HLT_HcalNZS_v12', - 'HLT_HcalPhiSym_v14', - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10')+cms.vstring( 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', + 'HLT_HcalNZS_v12')+cms.vstring( 'HLT_HcalPhiSym_v14', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10', 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10', 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10', @@ -85882,9 +86042,9 @@ 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2', 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2', 'HLT_TkMu100_v2', - 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4', - 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', - 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7')+cms.vstring( 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', + 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v4')+cms.vstring( 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2', + 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v7', + 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v7', 'HLT_TripleJet110_35_35_Mjj650_PFMET130_v7', 'HLT_TripleMu_10_5_5_DZ_v9', 'HLT_TripleMu_12_10_5_v9', @@ -86989,6 +87149,10 @@ process.HLT_L2Mu10_v7 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMu22or25 + process.hltPreL2Mu10 + process.hltL1fL1sMu22or25L1Filtered0 + process.HLTL2muonrecoSequence + process.hltL2fL1sMu22or25L1f0L2FilteredQ + process.HLTEndSequence ) process.HLT_L2Mu10_NoVertex_NoBPTX_v6 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMuOpenNotBptxOR + process.hltPreL2Mu10NoVertexNoBPTX + process.hltL1fL1sMuOpenNotBptxORL1Filtered0 + process.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + process.hltL2fL1sMuOpenNotBptxORL1f0NoVtxCosmicSeedMeanTimerL2Filtered10 + process.HLTEndSequence ) process.HLT_L2Mu50_v2 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMu22or25 + process.hltPreL2Mu50 + process.hltL1fL1sMu22or25L1Filtered0 + process.HLTL2muonrecoSequenceAllBx + process.hltL2fL1sMu22or25L1f0L2AllBxFiltered50Q + process.HLTEndSequence ) +process.HLT_L2Mu23NoVtx_2Cha_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMuOR + process.hltPreL2Mu23NoVtx2Cha + process.hltL1fL1sMuORL1Filtered0 + process.HLTL2muonrecoSequenceNoVtx + process.hltL2fL1sMuORL1f0L2NoVtx23Q2Cha + process.HLTEndSequence ) +process.HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMuOR + process.hltPreL2Mu23NoVtx2ChaCosmicSeed + process.hltL1fL1sMuORL1Filtered0 + process.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + process.hltL2fL1sMuORL1f0L2NoVtx23Q2ChaCosmicSeed + process.HLTEndSequence ) +process.HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sDoubleMu125to157ORTripleMu444 + process.hltPreDoubleL2Mu30NoVtx2ChaCosmicSeedEta2p4 + process.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + process.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + process.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q2ChaCosmicSeedEta2p4 + process.HLTEndSequence ) +process.HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sDoubleMu125to157ORTripleMu444 + process.hltPreDoubleL2Mu30NoVtx2ChaEta2p4 + process.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + process.HLTL2muonrecoSequenceNoVtx + process.hltL2fL1sMuORL1f0DoubleL2NoVtx30Q + process.hltL2DoubleMu30NoVtxFiltered2ChaEta2p4 + process.HLTEndSequence ) process.HLT_DoubleL2Mu50_v2 = cms.Path( process.HLTBeginSequence + process.hltL1sSingleMuOR + process.hltPreDoubleL2Mu50 + process.hltL1fL1sMuORL1Filtered0 + process.HLTL2muonrecoSequenceAllBx + process.hltL2fL1sMuORL1f0DoubleL2AllBxFiltered50Q + process.HLTEndSequence ) process.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sDoubleMu125to157ORTripleMu444 + process.hltPreDoubleL2Mu23NoVtx2ChaCosmicSeed + process.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + process.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + process.hltL2fL1sMuORL1f0DoubleL2NoVtx23Q2ChaCosmicSeed + process.HLTEndSequence ) process.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1 = cms.Path( process.HLTBeginSequence + process.hltL1sDoubleMu125to157ORTripleMu444 + process.hltPreDoubleL2Mu25NoVtx2ChaCosmicSeed + process.hltL1fL1sDoubleMu155ORTripleMu444L1Filtered0 + process.HLTL2muonrecoSequenceNoVtxCosmicSeedMeanTimer + process.hltL2fL1sMuORL1f0DoubleL2NoVtx25Q2ChaCosmicSeed + process.HLTEndSequence ) @@ -87579,7 +87743,7 @@ process.PhysicsZeroBias4Output = cms.EndPath( process.hltGtStage2Digis + process.hltPrePhysicsZeroBias4Output + process.hltOutputPhysicsZeroBias4 ) -process.HLTSchedule = cms.Schedule( *(process.HLTriggerFirstPath, process.HLT_AK8PFJet360_TrimMass30_v16, process.HLT_AK8PFJet380_TrimMass30_v9, process.HLT_AK8PFJet400_TrimMass30_v10, process.HLT_AK8PFJet420_TrimMass30_v9, process.HLT_AK8PFHT750_TrimMass50_v10, process.HLT_AK8PFHT800_TrimMass50_v10, process.HLT_AK8PFHT850_TrimMass50_v9, process.HLT_AK8PFHT900_TrimMass50_v9, process.HLT_CaloJet500_NoJetID_v11, process.HLT_CaloJet550_NoJetID_v6, process.HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v2, process.HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v2, process.HLT_Trimuon5_3p5_2_Upsilon_Muon_v4, process.HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2, process.HLT_DoubleEle25_CaloIdL_MW_v2, process.HLT_DoubleEle27_CaloIdL_MW_v2, process.HLT_DoubleEle33_CaloIdL_MW_v15, process.HLT_DoubleEle24_eta2p1_WPTight_Gsf_v5, process.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v18, process.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v18, process.HLT_Ele27_Ele37_CaloIdL_MW_v2, process.HLT_Mu27_Ele37_CaloIdL_MW_v3, process.HLT_Mu37_Ele27_CaloIdL_MW_v3, process.HLT_Mu37_TkMu27_v3, process.HLT_DoubleMu4_3_Bs_v13, process.HLT_DoubleMu4_3_Jpsi_v1, process.HLT_DoubleMu4_JpsiTrk_Displaced_v14, process.HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v14, process.HLT_DoubleMu3_Trk_Tau3mu_v11, process.HLT_DoubleMu3_TkMu_DsTau3Mu_v2, process.HLT_DoubleMu4_PsiPrimeTrk_Displaced_v14, process.HLT_DoubleMu4_Mass8_DZ_PFHT350_v7, process.HLT_DoubleMu8_Mass8_PFHT350_v7, process.HLT_Mu3_PFJet40_v14, process.HLT_Mu7p5_L2Mu2_Jpsi_v9, process.HLT_Mu7p5_L2Mu2_Upsilon_v9, process.HLT_Mu7p5_Track2_Jpsi_v10, process.HLT_Mu7p5_Track3p5_Jpsi_v10, process.HLT_Mu7p5_Track7_Jpsi_v10, process.HLT_Mu7p5_Track2_Upsilon_v10, process.HLT_Mu7p5_Track3p5_Upsilon_v10, process.HLT_Mu7p5_Track7_Upsilon_v10, process.HLT_DoublePhoton33_CaloIdL_v5, process.HLT_DoublePhoton70_v5, process.HLT_DoublePhoton85_v13, process.HLT_Ele20_WPTight_Gsf_v4, process.HLT_Ele15_WPLoose_Gsf_v1, process.HLT_Ele17_WPLoose_Gsf_v1, process.HLT_Ele20_WPLoose_Gsf_v4, process.HLT_Ele20_eta2p1_WPLoose_Gsf_v4, process.HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v3, process.HLT_Ele27_WPTight_Gsf_v14, process.HLT_Ele32_WPTight_Gsf_v13, process.HLT_Ele35_WPTight_Gsf_v7, process.HLT_Ele35_WPTight_Gsf_L1EGMT_v3, process.HLT_Ele38_WPTight_Gsf_v7, process.HLT_Ele40_WPTight_Gsf_v7, process.HLT_Ele32_WPTight_Gsf_L1DoubleEG_v7, process.HLT_HT450_Beamspot_v9, process.HLT_HT300_Beamspot_v9, process.HLT_ZeroBias_Beamspot_v2, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_v13, process.HLT_IsoMu24_v11, process.HLT_IsoMu24_eta2p1_v13, process.HLT_IsoMu27_v14, process.HLT_IsoMu30_v2, process.HLT_UncorrectedJetE30_NoBPTX_v5, process.HLT_UncorrectedJetE30_NoBPTX3BX_v5, process.HLT_UncorrectedJetE60_NoBPTX3BX_v5, process.HLT_UncorrectedJetE70_NoBPTX3BX_v5, process.HLT_L1SingleMu18_v3, process.HLT_L1SingleMu25_v2, process.HLT_L2Mu10_v7, process.HLT_L2Mu10_NoVertex_NoBPTX_v6, process.HLT_L2Mu50_v2, process.HLT_DoubleL2Mu50_v2, process.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v1, process.HLT_DoubleL2Mu23NoVtx_2Cha_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v13, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v14, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v4, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v4, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v2, process.HLT_Mu25_TkMu0_Onia_v6, process.HLT_Mu30_TkMu0_Onia_v6, process.HLT_Mu20_TkMu0_Phi_v6, process.HLT_Mu25_TkMu0_Phi_v6, process.HLT_Mu12_v1, process.HLT_Mu15_v1, process.HLT_Mu20_v11, process.HLT_Mu27_v12, process.HLT_Mu50_v12, process.HLT_Mu55_v2, process.HLT_OldMu100_v3, process.HLT_TkMu100_v2, process.HLT_DiPFJet15_NoCaloMatched_v14, process.HLT_DiPFJet25_NoCaloMatched_v14, process.HLT_DiPFJet15_FBEta3_NoCaloMatched_v15, process.HLT_DiPFJet25_FBEta3_NoCaloMatched_v15, process.HLT_DiPFJetAve40_v12, process.HLT_DiPFJetAve60_v12, process.HLT_DiPFJetAve80_v11, process.HLT_DiPFJetAve140_v11, process.HLT_DiPFJetAve200_v11, process.HLT_DiPFJetAve260_v12, process.HLT_DiPFJetAve320_v12, process.HLT_DiPFJetAve400_v12, process.HLT_DiPFJetAve500_v12, process.HLT_DiPFJetAve15_HFJEC_v15, process.HLT_DiPFJetAve25_HFJEC_v15, process.HLT_DiPFJetAve35_HFJEC_v15, process.HLT_DiPFJetAve60_HFJEC_v13, process.HLT_DiPFJetAve80_HFJEC_v13, process.HLT_DiPFJetAve100_HFJEC_v13, process.HLT_DiPFJetAve160_HFJEC_v13, process.HLT_DiPFJetAve220_HFJEC_v14, process.HLT_DiPFJetAve300_HFJEC_v14, process.HLT_AK8PFJet15_v1, process.HLT_AK8PFJet25_v1, process.HLT_AK8PFJet40_v14, process.HLT_AK8PFJet60_v13, process.HLT_AK8PFJet80_v13, process.HLT_AK8PFJet140_v13, process.HLT_AK8PFJet200_v13, process.HLT_AK8PFJet260_v14, process.HLT_AK8PFJet320_v14, process.HLT_AK8PFJet400_v14, process.HLT_AK8PFJet450_v14, process.HLT_AK8PFJet500_v14, process.HLT_AK8PFJet550_v9, process.HLT_PFJet15_v1, process.HLT_PFJet25_v1, process.HLT_PFJet40_v19, process.HLT_PFJet60_v19, process.HLT_PFJet80_v18, process.HLT_PFJet140_v17, process.HLT_PFJet200_v17, process.HLT_PFJet260_v18, process.HLT_PFJet320_v18, process.HLT_PFJet400_v18, process.HLT_PFJet450_v19, process.HLT_PFJet500_v19, process.HLT_PFJet550_v9, process.HLT_PFJetFwd15_v1, process.HLT_PFJetFwd25_v1, process.HLT_PFJetFwd40_v17, process.HLT_PFJetFwd60_v17, process.HLT_PFJetFwd80_v16, process.HLT_PFJetFwd140_v16, process.HLT_PFJetFwd200_v16, process.HLT_PFJetFwd260_v17, process.HLT_PFJetFwd320_v17, process.HLT_PFJetFwd400_v17, process.HLT_PFJetFwd450_v17, process.HLT_PFJetFwd500_v17, process.HLT_AK8PFJetFwd15_v1, process.HLT_AK8PFJetFwd25_v1, process.HLT_AK8PFJetFwd40_v13, process.HLT_AK8PFJetFwd60_v12, process.HLT_AK8PFJetFwd80_v12, process.HLT_AK8PFJetFwd140_v12, process.HLT_AK8PFJetFwd200_v12, process.HLT_AK8PFJetFwd260_v13, process.HLT_AK8PFJetFwd320_v13, process.HLT_AK8PFJetFwd400_v13, process.HLT_AK8PFJetFwd450_v13, process.HLT_AK8PFJetFwd500_v13, process.HLT_PFHT180_v15, process.HLT_PFHT250_v15, process.HLT_PFHT370_v15, process.HLT_PFHT430_v15, process.HLT_PFHT510_v15, process.HLT_PFHT590_v15, process.HLT_PFHT680_v15, process.HLT_PFHT780_v15, process.HLT_PFHT890_v15, process.HLT_PFHT1050_v16, process.HLT_PFHT500_PFMET100_PFMHT100_IDTight_v10, process.HLT_PFHT500_PFMET110_PFMHT110_IDTight_v10, process.HLT_PFHT700_PFMET85_PFMHT85_IDTight_v10, process.HLT_PFHT700_PFMET95_PFMHT95_IDTight_v10, process.HLT_PFHT800_PFMET75_PFMHT75_IDTight_v10, process.HLT_PFHT800_PFMET85_PFMHT85_IDTight_v10, process.HLT_PFMET110_PFMHT110_IDTight_v18, process.HLT_PFMET120_PFMHT120_IDTight_v18, process.HLT_PFMET130_PFMHT130_IDTight_v18, process.HLT_PFMET140_PFMHT140_IDTight_v18, process.HLT_PFMET100_PFMHT100_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET110_PFMHT110_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET120_PFMHT120_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET130_PFMHT130_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET140_PFMHT140_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET120_PFMHT120_IDTight_PFHT60_v7, process.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne110_PFMHT110_IDTight_v10, process.HLT_PFMETTypeOne120_PFMHT120_IDTight_v10, process.HLT_PFMETTypeOne130_PFMHT130_IDTight_v10, process.HLT_PFMETTypeOne140_PFMHT140_IDTight_v9, process.HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, process.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, process.HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, process.HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, process.HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, process.HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, process.HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, process.HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, process.HLT_L1ETMHadSeeds_v1, process.HLT_CaloMHT90_v3, process.HLT_CaloMET80_NotCleaned_v3, process.HLT_CaloMET90_NotCleaned_v3, process.HLT_CaloMET100_NotCleaned_v3, process.HLT_CaloMET110_NotCleaned_v3, process.HLT_CaloMET250_NotCleaned_v3, process.HLT_CaloMET70_HBHECleaned_v3, process.HLT_CaloMET80_HBHECleaned_v3, process.HLT_CaloMET90_HBHECleaned_v3, process.HLT_CaloMET100_HBHECleaned_v3, process.HLT_CaloMET250_HBHECleaned_v3, process.HLT_CaloMET300_HBHECleaned_v3, process.HLT_CaloMET350_HBHECleaned_v3, process.HLT_PFMET200_NotCleaned_v7, process.HLT_PFMET200_HBHECleaned_v7, process.HLT_PFMET250_HBHECleaned_v7, process.HLT_PFMET300_HBHECleaned_v7, process.HLT_PFMET200_HBHE_BeamHaloCleaned_v7, process.HLT_PFMETTypeOne200_HBHE_BeamHaloCleaned_v7, process.HLT_MET105_IsoTrk50_v8, process.HLT_MET120_IsoTrk50_v8, process.HLT_SingleJet30_Mu12_SinglePFJet40_v9, process.HLT_Mu12_DoublePFJets40_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets100_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets200_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets350_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_DoublePFJets40_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets100_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets200_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets350_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Photon300_NoHE_v11, process.HLT_Mu8_TrkIsoVVL_v11, process.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16, process.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v16, process.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v17, process.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v17, process.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v11, process.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v9, process.HLT_Mu17_TrkIsoVVL_v11, process.HLT_Mu19_TrkIsoVVL_v2, process.HLT_BTagMu_AK4DiJet20_Mu5_v11, process.HLT_BTagMu_AK4DiJet40_Mu5_v11, process.HLT_BTagMu_AK4DiJet70_Mu5_v11, process.HLT_BTagMu_AK4DiJet110_Mu5_v11, process.HLT_BTagMu_AK4DiJet170_Mu5_v10, process.HLT_BTagMu_AK4Jet300_Mu5_v11, process.HLT_BTagMu_AK8DiJet170_Mu5_v7, process.HLT_BTagMu_AK8Jet300_Mu5_v11, process.HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v1, process.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v17, process.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v17, process.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v5, process.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v5, process.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.HLT_Mu12_DoublePhoton20_v3, process.HLT_TriplePhoton_20_20_20_CaloIdLV2_v2, process.HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v2, process.HLT_TriplePhoton_30_30_10_CaloIdLV2_v3, process.HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v3, process.HLT_TriplePhoton_35_35_5_CaloIdLV2_R9IdVL_v3, process.HLT_Photon20_v1, process.HLT_Photon33_v4, process.HLT_Photon50_v12, process.HLT_Photon75_v12, process.HLT_Photon90_v12, process.HLT_Photon120_v12, process.HLT_Photon150_v5, process.HLT_Photon175_v13, process.HLT_Photon200_v12, process.HLT_Photon50_R9Id90_HE10_IsoM_v13, process.HLT_Photon75_R9Id90_HE10_IsoM_v13, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v3, process.HLT_Photon90_R9Id90_HE10_IsoM_v13, process.HLT_Photon120_R9Id90_HE10_IsoM_v13, process.HLT_Photon165_R9Id90_HE10_IsoM_v14, process.HLT_Photon90_CaloIdL_PFHT700_v14, process.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v12, process.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v12, process.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, process.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, process.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, process.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, process.HLT_Dimuon0_Jpsi_L1_NoOS_v6, process.HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v6, process.HLT_Dimuon0_Jpsi_v7, process.HLT_Dimuon0_Jpsi_NoVertexing_v7, process.HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v6, process.HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v6, process.HLT_Dimuon0_Jpsi3p5_Muon2_v5, process.HLT_Dimuon0_Upsilon_L1_4p5_v7, process.HLT_Dimuon0_Upsilon_L1_5_v7, process.HLT_Dimuon0_Upsilon_L1_4p5NoOS_v6, process.HLT_Dimuon0_Upsilon_L1_4p5er2p0_v7, process.HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v6, process.HLT_Dimuon0_Upsilon_NoVertexing_v6, process.HLT_Dimuon0_Upsilon_L1_5M_v6, process.HLT_Dimuon0_LowMass_L1_0er1p5R_v6, process.HLT_Dimuon0_LowMass_L1_0er1p5_v7, process.HLT_Dimuon0_LowMass_v7, process.HLT_Dimuon0_LowMass_L1_4_v7, process.HLT_Dimuon0_LowMass_L1_4R_v6, process.HLT_Dimuon0_LowMass_L1_TM530_v5, process.HLT_Dimuon0_Upsilon_Muon_L1_TM0_v5, process.HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v5, process.HLT_TripleMu_5_3_3_Mass3p8to60_DZ_v7, process.HLT_TripleMu_10_5_5_DZ_v9, process.HLT_TripleMu_12_10_5_v9, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v2, process.HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8, process.HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v8, process.HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v8, process.HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v5, process.HLT_DoubleMu4_Jpsi_Displaced_v6, process.HLT_DoubleMu4_Jpsi_NoVertexing_v6, process.HLT_DoubleMu4_JpsiTrkTrk_Displaced_v6, process.HLT_DoubleMu43NoFiltersNoVtx_v3, process.HLT_DoubleMu48NoFiltersNoVtx_v3, process.HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v4, process.HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v4, process.HLT_DoubleMu20_7_Mass0to30_L1_DM4_v6, process.HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v6, process.HLT_HT425_v8, process.HLT_HT430_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT500_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT430_DisplacedDijet60_DisplacedTrack_v11, process.HLT_HT400_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT650_DisplacedDijet60_Inclusive_v11, process.HLT_HT550_DisplacedDijet60_Inclusive_v11, process.HLT_DiJet110_35_Mjj650_PFMET110_v7, process.HLT_DiJet110_35_Mjj650_PFMET120_v7, process.HLT_DiJet110_35_Mjj650_PFMET130_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET110_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET120_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET130_v7, process.HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_VBF_DoubleMediumChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_VBF_DoubleTightChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v11, process.HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v11, process.HLT_Ele28_HighEta_SC20_Mass55_v11, process.HLT_DoubleMu20_7_Mass0to30_Photon23_v6, process.HLT_Ele15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, process.HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v14, process.HLT_Ele15_IsoVVVL_PFHT450_v14, process.HLT_Ele50_IsoVVVL_PFHT450_v14, process.HLT_Ele15_IsoVVVL_PFHT600_v18, process.HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v13, process.HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v12, process.HLT_Mu15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, process.HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v13, process.HLT_Mu15_IsoVVVL_PFHT450_v13, process.HLT_Mu50_IsoVVVL_PFHT450_v13, process.HLT_Mu15_IsoVVVL_PFHT600_v17, process.HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v6, process.HLT_Dimuon20_Jpsi_Barrel_Seagulls_v6, process.HLT_Dimuon10_Upsilon_Barrel_Seagulls_v6, process.HLT_Dimuon12_Upsilon_eta1p5_v13, process.HLT_Dimuon14_Phi_Barrel_Seagulls_v6, process.HLT_Dimuon18_PsiPrime_v13, process.HLT_Dimuon25_Jpsi_v13, process.HLT_Dimuon18_PsiPrime_noCorrL1_v4, process.HLT_Dimuon24_Upsilon_noCorrL1_v4, process.HLT_Dimuon24_Phi_noCorrL1_v4, process.HLT_Dimuon25_Jpsi_noCorrL1_v4, process.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v15, process.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v15, process.HLT_DoubleIsoMu20_eta2p1_v5, process.HLT_DoubleIsoMu24_eta2p1_v5, process.HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v5, process.HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v11, process.HLT_TrkMu17_DoubleTrkMu8NoFiltersNoVtx_v12, process.HLT_Mu8_v11, process.HLT_Mu17_v11, process.HLT_Mu19_v2, process.HLT_Mu17_Photon30_IsoCaloId_v4, process.HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v14, process.HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, process.HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v1, process.HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, process.HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v16, process.HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v14, process.HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v16, process.HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v16, process.HLT_Ele115_CaloIdVT_GsfTrkIdT_v12, process.HLT_Ele135_CaloIdVT_GsfTrkIdT_v5, process.HLT_Ele145_CaloIdVT_GsfTrkIdT_v6, process.HLT_Ele200_CaloIdVT_GsfTrkIdT_v6, process.HLT_Ele250_CaloIdVT_GsfTrkIdT_v11, process.HLT_Ele300_CaloIdVT_GsfTrkIdT_v11, process.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v1, process.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v7, process.HLT_PFHT380_SixPFJet32_DoublePFBTagCSV_2p2_v7, process.HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_2p2_v6, process.HLT_PFHT380_SixPFJet32_v7, process.HLT_PFHT430_SixPFJet40_PFBTagCSV_1p5_v7, process.HLT_PFHT430_SixPFJet40_v9, process.HLT_PFHT350_v17, process.HLT_PFHT350MinPFJet15_v7, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_v4, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v4, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v9, process.HLT_FullTrack_Multiplicity85_v3, process.HLT_FullTrack_Multiplicity100_v2, process.HLT_FullTrack_Multiplicity130_v2, process.HLT_FullTrack_Multiplicity155_v3, process.HLT_ECALHT800_v9, process.HLT_DiSC30_18_EIso_AND_HE_Mass70_v12, process.HLT_Physics_v7, process.HLT_Physics_part0_v7, process.HLT_Physics_part1_v7, process.HLT_Physics_part2_v7, process.HLT_Physics_part3_v7, process.HLT_Physics_part4_v7, process.HLT_Physics_part5_v7, process.HLT_Physics_part6_v7, process.HLT_Physics_part7_v7, process.DST_Physics_v7, process.HLT_Random_v3, process.HLT_ZeroBias_v6, process.HLT_ZeroBias_part0_v6, process.HLT_ZeroBias_part1_v6, process.HLT_ZeroBias_part2_v6, process.HLT_ZeroBias_part3_v6, process.HLT_ZeroBias_part4_v6, process.HLT_ZeroBias_part5_v6, process.HLT_ZeroBias_part6_v6, process.HLT_ZeroBias_part7_v6, process.DST_ZeroBias_v2, process.DST_HT250_CaloScouting_v9, process.DST_HT250_CaloBTagScouting_v8, process.DST_HT410_PFScouting_v14, process.DST_HT410_BTagScouting_v14, process.DST_ZeroBias_BTagScouting_v13, process.DST_ZeroBias_CaloScouting_PFScouting_v12, process.DST_CaloJet40_BTagScouting_v13, process.DST_CaloJet40_CaloScouting_PFScouting_v13, process.DST_CaloJet40_CaloBTagScouting_v12, process.DST_L1HTT_BTagScouting_v13, process.DST_L1HTT_CaloScouting_PFScouting_v13, process.DST_L1HTT_CaloBTagScouting_v12, process.DST_L1DoubleMu_BTagScouting_v14, process.DST_L1DoubleMu_CaloScouting_PFScouting_v13, process.DST_DoubleMu3_noVtx_CaloScouting_Monitoring_v5, process.DST_DoubleMu3_noVtx_CaloScouting_v5, process.DST_DoubleMu1_noVtx_CaloScouting_v1, process.DST_DoubleMu3_noVtx_Mass10_PFScouting_v1, process.HLT_AK4CaloJet30_v11, process.HLT_AK4CaloJet40_v10, process.HLT_AK4CaloJet50_v10, process.HLT_AK4CaloJet80_v10, process.HLT_AK4CaloJet100_v10, process.HLT_AK4CaloJet120_v9, process.HLT_AK4PFJet30_v17, process.HLT_AK4PFJet50_v17, process.HLT_AK4PFJet80_v17, process.HLT_AK4PFJet100_v17, process.HLT_AK4PFJet120_v16, process.HLT_SinglePhoton10_Eta3p1ForPPRef_v8, process.HLT_SinglePhoton20_Eta3p1ForPPRef_v8, process.HLT_SinglePhoton30_Eta3p1ForPPRef_v8, process.HLT_Photon20_HoverELoose_v9, process.HLT_Photon30_HoverELoose_v9, process.HLT_EcalCalibration_v4, process.HLT_HcalCalibration_v5, process.AlCa_EcalPhiSym_v8, process.HLT_L1UnpairedBunchBptxMinus_v2, process.HLT_L1UnpairedBunchBptxPlus_v2, process.HLT_L1NotBptxOR_v3, process.HLT_L1MinimumBiasHF_OR_v2, process.HLT_L1MinimumBiasHF0OR_v3, process.HLT_L1_CDC_SingleMu_3_er1p2_TOP120_DPHI2p618_3p142_v2, process.HLT_HcalNZS_v12, process.HLT_HcalPhiSym_v14, process.HLT_HcalIsolatedbunch_v4, process.HLT_IsoTrackHB_v3, process.HLT_IsoTrackHE_v3, process.HLT_ZeroBias_FirstCollisionAfterAbortGap_v5, process.HLT_ZeroBias_IsolatedBunches_v5, process.HLT_ZeroBias_FirstCollisionInTrain_v4, process.HLT_ZeroBias_LastCollisionInTrain_v3, process.HLT_ZeroBias_FirstBXAfterTrain_v3, process.AlCa_RPCMuonNormalisation_v13, process.AlCa_LumiPixels_Random_v4, process.AlCa_LumiPixels_ZeroBias_v8, process.MC_ReducedIterativeTracking_v11, process.MC_PFMET_v15, process.MC_AK4PFJets_v15, process.MC_PFBTagCSV_v9, process.MC_PFHT_v14, process.MC_PFMHT_v14, process.MC_CaloMET_v8, process.MC_CaloMET_JetIdCleaned_v9, process.MC_AK4CaloJets_v9, process.MC_AK4CaloJetsFromPV_v7, process.MC_CaloBTagCSV_v7, process.MC_CaloHT_v8, process.MC_CaloMHT_v8, process.MC_AK8PFJets_v15, process.MC_AK8TrimPFJets_v15, process.MC_AK8PFHT_v14, process.MC_AK8CaloHT_v8, process.MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v12, process.MC_DoubleEle5_CaloIdL_MW_v13, process.MC_Ele5_WPTight_Gsf_v6, process.MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.MC_IsoMu_v13, process.MC_DoubleMu_TrkIsoVVL_DZ_v10, process.MC_DoubleMuNoFiltersNoVtx_v7, process.AlCa_EcalPi0EBonly_v12, process.AlCa_EcalPi0EEonly_v12, process.AlCa_EcalEtaEBonly_v12, process.AlCa_EcalEtaEEonly_v12, process.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v1, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, process.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v9, process.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, process.HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v7, process.HLT_Rsq0p35_v13, process.HLT_Rsq0p40_v13, process.HLT_RsqMR300_Rsq0p09_MR200_v13, process.HLT_RsqMR320_Rsq0p09_MR200_v13, process.HLT_RsqMR300_Rsq0p09_MR200_4jet_v13, process.HLT_RsqMR320_Rsq0p09_MR200_4jet_v13, process.HLT_IsoMu27_LooseChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_MediumChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_TightChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_MET90_v1, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v1, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_CrossL1_v1, process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1, process.HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v3, process.HLT_PFMET100_PFMHT100_IDTight_PFHT60_v7, process.HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v7, process.HLT_Mu18_Mu9_SameSign_v3, process.HLT_Mu18_Mu9_SameSign_DZ_v3, process.HLT_Mu18_Mu9_v3, process.HLT_Mu18_Mu9_DZ_v3, process.HLT_Mu20_Mu10_SameSign_v3, process.HLT_Mu20_Mu10_SameSign_DZ_v3, process.HLT_Mu20_Mu10_v3, process.HLT_Mu20_Mu10_DZ_v3, process.HLT_Mu23_Mu12_SameSign_v3, process.HLT_Mu23_Mu12_SameSign_DZ_v3, process.HLT_Mu23_Mu12_v3, process.HLT_Mu23_Mu12_DZ_v3, process.HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v5, process.HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v3, process.HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8, process.HLT_TripleMu_5_3_3_Mass3p8to60_DCA_v2, process.HLT_QuadPFJet98_83_71_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet103_88_75_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet105_90_76_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet111_90_80_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet98_83_71_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet103_88_75_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet105_88_76_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet111_90_80_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet98_83_71_15_v3, process.HLT_QuadPFJet103_88_75_15_v3, process.HLT_QuadPFJet105_88_76_15_v3, process.HLT_QuadPFJet111_90_80_15_v3, process.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p17_v1, process.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p1_v1, process.HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v1, process.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v8, process.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v8, process.HLTriggerFinalPath, process.HLTAnalyzerEndpath, process.ParkingHLTPhysicsOutput, process.ParkingZeroBiasOutput, process.PhysicsCommissioningOutput, process.PhysicsEGammaOutput, process.PhysicsEndOfFillOutput, process.PhysicsHadronsTausOutput, process.PhysicsMuonsOutput, process.ParkingOutput, process.DQMOutput, process.DQMOnlineBeamspotOutput, process.DQMCalibrationOutput, process.DQMEventDisplayOutput, process.HLTMonitorOutput, process.RPCMONOutput, process.CalibrationOutput, process.EcalCalibrationOutput, process.ALCAPHISYMOutput, process.ALCALUMIPIXELSOutput, process.ALCAP0Output, process.ExpressOutput, process.ExpressAlignmentOutput, process.NanoDSTOutput, process.ScoutingPFOutput, process.ScoutingCaloMuonOutput, process.PhysicsParkingScoutingMonitorOutput, process.PhysicsHLTPhysics1Output, process.PhysicsHLTPhysics2Output, process.PhysicsHLTPhysics3Output, process.PhysicsHLTPhysics4Output, process.PhysicsZeroBias1Output, process.PhysicsZeroBias2Output, process.PhysicsZeroBias3Output, process.PhysicsZeroBias4Output )) +process.HLTSchedule = cms.Schedule( *(process.HLTriggerFirstPath, process.HLT_AK8PFJet360_TrimMass30_v16, process.HLT_AK8PFJet380_TrimMass30_v9, process.HLT_AK8PFJet400_TrimMass30_v10, process.HLT_AK8PFJet420_TrimMass30_v9, process.HLT_AK8PFHT750_TrimMass50_v10, process.HLT_AK8PFHT800_TrimMass50_v10, process.HLT_AK8PFHT850_TrimMass50_v9, process.HLT_AK8PFHT900_TrimMass50_v9, process.HLT_CaloJet500_NoJetID_v11, process.HLT_CaloJet550_NoJetID_v6, process.HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v2, process.HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v2, process.HLT_Trimuon5_3p5_2_Upsilon_Muon_v4, process.HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v2, process.HLT_DoubleEle25_CaloIdL_MW_v2, process.HLT_DoubleEle27_CaloIdL_MW_v2, process.HLT_DoubleEle33_CaloIdL_MW_v15, process.HLT_DoubleEle24_eta2p1_WPTight_Gsf_v5, process.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v18, process.HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v18, process.HLT_Ele27_Ele37_CaloIdL_MW_v2, process.HLT_Mu27_Ele37_CaloIdL_MW_v3, process.HLT_Mu37_Ele27_CaloIdL_MW_v3, process.HLT_Mu37_TkMu27_v3, process.HLT_DoubleMu4_3_Bs_v13, process.HLT_DoubleMu4_3_Jpsi_v1, process.HLT_DoubleMu4_JpsiTrk_Displaced_v14, process.HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v14, process.HLT_DoubleMu3_Trk_Tau3mu_v11, process.HLT_DoubleMu3_TkMu_DsTau3Mu_v2, process.HLT_DoubleMu4_PsiPrimeTrk_Displaced_v14, process.HLT_DoubleMu4_Mass8_DZ_PFHT350_v7, process.HLT_DoubleMu8_Mass8_PFHT350_v7, process.HLT_Mu3_PFJet40_v14, process.HLT_Mu7p5_L2Mu2_Jpsi_v9, process.HLT_Mu7p5_L2Mu2_Upsilon_v9, process.HLT_Mu7p5_Track2_Jpsi_v10, process.HLT_Mu7p5_Track3p5_Jpsi_v10, process.HLT_Mu7p5_Track7_Jpsi_v10, process.HLT_Mu7p5_Track2_Upsilon_v10, process.HLT_Mu7p5_Track3p5_Upsilon_v10, process.HLT_Mu7p5_Track7_Upsilon_v10, process.HLT_DoublePhoton33_CaloIdL_v5, process.HLT_DoublePhoton70_v5, process.HLT_DoublePhoton85_v13, process.HLT_Ele20_WPTight_Gsf_v4, process.HLT_Ele15_WPLoose_Gsf_v1, process.HLT_Ele17_WPLoose_Gsf_v1, process.HLT_Ele20_WPLoose_Gsf_v4, process.HLT_Ele20_eta2p1_WPLoose_Gsf_v4, process.HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v3, process.HLT_Ele27_WPTight_Gsf_v14, process.HLT_Ele32_WPTight_Gsf_v13, process.HLT_Ele35_WPTight_Gsf_v7, process.HLT_Ele35_WPTight_Gsf_L1EGMT_v3, process.HLT_Ele38_WPTight_Gsf_v7, process.HLT_Ele40_WPTight_Gsf_v7, process.HLT_Ele32_WPTight_Gsf_L1DoubleEG_v7, process.HLT_HT450_Beamspot_v9, process.HLT_HT300_Beamspot_v9, process.HLT_ZeroBias_Beamspot_v2, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_CrossL1_v10, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_eta2p1_MediumChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_eta2p1_TightChargedIsoPFTau27_eta2p1_TightID_CrossL1_v10, process.HLT_IsoMu20_v13, process.HLT_IsoMu24_v11, process.HLT_IsoMu24_eta2p1_v13, process.HLT_IsoMu27_v14, process.HLT_IsoMu30_v2, process.HLT_UncorrectedJetE30_NoBPTX_v5, process.HLT_UncorrectedJetE30_NoBPTX3BX_v5, process.HLT_UncorrectedJetE60_NoBPTX3BX_v5, process.HLT_UncorrectedJetE70_NoBPTX3BX_v5, process.HLT_L1SingleMu18_v3, process.HLT_L1SingleMu25_v2, process.HLT_L2Mu10_v7, process.HLT_L2Mu10_NoVertex_NoBPTX_v6, process.HLT_L2Mu50_v2, process.HLT_L2Mu23NoVtx_2Cha_v1, process.HLT_L2Mu23NoVtx_2Cha_CosmicSeed_v1, process.HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v1, process.HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v1, process.HLT_DoubleL2Mu50_v2, process.HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v1, process.HLT_DoubleL2Mu23NoVtx_2Cha_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_v1, process.HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v1, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v13, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v14, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v4, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v2, process.HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v4, process.HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v2, process.HLT_Mu25_TkMu0_Onia_v6, process.HLT_Mu30_TkMu0_Onia_v6, process.HLT_Mu20_TkMu0_Phi_v6, process.HLT_Mu25_TkMu0_Phi_v6, process.HLT_Mu12_v1, process.HLT_Mu15_v1, process.HLT_Mu20_v11, process.HLT_Mu27_v12, process.HLT_Mu50_v12, process.HLT_Mu55_v2, process.HLT_OldMu100_v3, process.HLT_TkMu100_v2, process.HLT_DiPFJet15_NoCaloMatched_v14, process.HLT_DiPFJet25_NoCaloMatched_v14, process.HLT_DiPFJet15_FBEta3_NoCaloMatched_v15, process.HLT_DiPFJet25_FBEta3_NoCaloMatched_v15, process.HLT_DiPFJetAve40_v12, process.HLT_DiPFJetAve60_v12, process.HLT_DiPFJetAve80_v11, process.HLT_DiPFJetAve140_v11, process.HLT_DiPFJetAve200_v11, process.HLT_DiPFJetAve260_v12, process.HLT_DiPFJetAve320_v12, process.HLT_DiPFJetAve400_v12, process.HLT_DiPFJetAve500_v12, process.HLT_DiPFJetAve15_HFJEC_v15, process.HLT_DiPFJetAve25_HFJEC_v15, process.HLT_DiPFJetAve35_HFJEC_v15, process.HLT_DiPFJetAve60_HFJEC_v13, process.HLT_DiPFJetAve80_HFJEC_v13, process.HLT_DiPFJetAve100_HFJEC_v13, process.HLT_DiPFJetAve160_HFJEC_v13, process.HLT_DiPFJetAve220_HFJEC_v14, process.HLT_DiPFJetAve300_HFJEC_v14, process.HLT_AK8PFJet15_v1, process.HLT_AK8PFJet25_v1, process.HLT_AK8PFJet40_v14, process.HLT_AK8PFJet60_v13, process.HLT_AK8PFJet80_v13, process.HLT_AK8PFJet140_v13, process.HLT_AK8PFJet200_v13, process.HLT_AK8PFJet260_v14, process.HLT_AK8PFJet320_v14, process.HLT_AK8PFJet400_v14, process.HLT_AK8PFJet450_v14, process.HLT_AK8PFJet500_v14, process.HLT_AK8PFJet550_v9, process.HLT_PFJet15_v1, process.HLT_PFJet25_v1, process.HLT_PFJet40_v19, process.HLT_PFJet60_v19, process.HLT_PFJet80_v18, process.HLT_PFJet140_v17, process.HLT_PFJet200_v17, process.HLT_PFJet260_v18, process.HLT_PFJet320_v18, process.HLT_PFJet400_v18, process.HLT_PFJet450_v19, process.HLT_PFJet500_v19, process.HLT_PFJet550_v9, process.HLT_PFJetFwd15_v1, process.HLT_PFJetFwd25_v1, process.HLT_PFJetFwd40_v17, process.HLT_PFJetFwd60_v17, process.HLT_PFJetFwd80_v16, process.HLT_PFJetFwd140_v16, process.HLT_PFJetFwd200_v16, process.HLT_PFJetFwd260_v17, process.HLT_PFJetFwd320_v17, process.HLT_PFJetFwd400_v17, process.HLT_PFJetFwd450_v17, process.HLT_PFJetFwd500_v17, process.HLT_AK8PFJetFwd15_v1, process.HLT_AK8PFJetFwd25_v1, process.HLT_AK8PFJetFwd40_v13, process.HLT_AK8PFJetFwd60_v12, process.HLT_AK8PFJetFwd80_v12, process.HLT_AK8PFJetFwd140_v12, process.HLT_AK8PFJetFwd200_v12, process.HLT_AK8PFJetFwd260_v13, process.HLT_AK8PFJetFwd320_v13, process.HLT_AK8PFJetFwd400_v13, process.HLT_AK8PFJetFwd450_v13, process.HLT_AK8PFJetFwd500_v13, process.HLT_PFHT180_v15, process.HLT_PFHT250_v15, process.HLT_PFHT370_v15, process.HLT_PFHT430_v15, process.HLT_PFHT510_v15, process.HLT_PFHT590_v15, process.HLT_PFHT680_v15, process.HLT_PFHT780_v15, process.HLT_PFHT890_v15, process.HLT_PFHT1050_v16, process.HLT_PFHT500_PFMET100_PFMHT100_IDTight_v10, process.HLT_PFHT500_PFMET110_PFMHT110_IDTight_v10, process.HLT_PFHT700_PFMET85_PFMHT85_IDTight_v10, process.HLT_PFHT700_PFMET95_PFMHT95_IDTight_v10, process.HLT_PFHT800_PFMET75_PFMHT75_IDTight_v10, process.HLT_PFHT800_PFMET85_PFMHT85_IDTight_v10, process.HLT_PFMET110_PFMHT110_IDTight_v18, process.HLT_PFMET120_PFMHT120_IDTight_v18, process.HLT_PFMET130_PFMHT130_IDTight_v18, process.HLT_PFMET140_PFMHT140_IDTight_v18, process.HLT_PFMET100_PFMHT100_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET110_PFMHT110_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET120_PFMHT120_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET130_PFMHT130_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET140_PFMHT140_IDTight_CaloBTagCSV_3p1_v7, process.HLT_PFMET120_PFMHT120_IDTight_PFHT60_v7, process.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne110_PFMHT110_IDTight_v10, process.HLT_PFMETTypeOne120_PFMHT120_IDTight_v10, process.HLT_PFMETTypeOne130_PFMHT130_IDTight_v10, process.HLT_PFMETTypeOne140_PFMHT140_IDTight_v9, process.HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, process.HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, process.HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, process.HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, process.HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v18, process.HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v18, process.HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v17, process.HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v17, process.HLT_L1ETMHadSeeds_v1, process.HLT_CaloMHT90_v3, process.HLT_CaloMET80_NotCleaned_v3, process.HLT_CaloMET90_NotCleaned_v3, process.HLT_CaloMET100_NotCleaned_v3, process.HLT_CaloMET110_NotCleaned_v3, process.HLT_CaloMET250_NotCleaned_v3, process.HLT_CaloMET70_HBHECleaned_v3, process.HLT_CaloMET80_HBHECleaned_v3, process.HLT_CaloMET90_HBHECleaned_v3, process.HLT_CaloMET100_HBHECleaned_v3, process.HLT_CaloMET250_HBHECleaned_v3, process.HLT_CaloMET300_HBHECleaned_v3, process.HLT_CaloMET350_HBHECleaned_v3, process.HLT_PFMET200_NotCleaned_v7, process.HLT_PFMET200_HBHECleaned_v7, process.HLT_PFMET250_HBHECleaned_v7, process.HLT_PFMET300_HBHECleaned_v7, process.HLT_PFMET200_HBHE_BeamHaloCleaned_v7, process.HLT_PFMETTypeOne200_HBHE_BeamHaloCleaned_v7, process.HLT_MET105_IsoTrk50_v8, process.HLT_MET120_IsoTrk50_v8, process.HLT_SingleJet30_Mu12_SinglePFJet40_v9, process.HLT_Mu12_DoublePFJets40_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets100_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets200_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets350_CaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_DoublePFJets40_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets100_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets200_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets350_CaloBTagCSV_p79_v1, process.HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagCSV_p79_v1, process.HLT_Photon300_NoHE_v11, process.HLT_Mu8_TrkIsoVVL_v11, process.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v16, process.HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v16, process.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v17, process.HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v17, process.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v11, process.HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v9, process.HLT_Mu17_TrkIsoVVL_v11, process.HLT_Mu19_TrkIsoVVL_v2, process.HLT_BTagMu_AK4DiJet20_Mu5_v11, process.HLT_BTagMu_AK4DiJet40_Mu5_v11, process.HLT_BTagMu_AK4DiJet70_Mu5_v11, process.HLT_BTagMu_AK4DiJet110_Mu5_v11, process.HLT_BTagMu_AK4DiJet170_Mu5_v10, process.HLT_BTagMu_AK4Jet300_Mu5_v11, process.HLT_BTagMu_AK8DiJet170_Mu5_v7, process.HLT_BTagMu_AK8Jet300_Mu5_v11, process.HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v1, process.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v17, process.HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v17, process.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v5, process.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v5, process.HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.HLT_Mu12_DoublePhoton20_v3, process.HLT_TriplePhoton_20_20_20_CaloIdLV2_v2, process.HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v2, process.HLT_TriplePhoton_30_30_10_CaloIdLV2_v3, process.HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v3, process.HLT_TriplePhoton_35_35_5_CaloIdLV2_R9IdVL_v3, process.HLT_Photon20_v1, process.HLT_Photon33_v4, process.HLT_Photon50_v12, process.HLT_Photon75_v12, process.HLT_Photon90_v12, process.HLT_Photon120_v12, process.HLT_Photon150_v5, process.HLT_Photon175_v13, process.HLT_Photon200_v12, process.HLT_Photon50_R9Id90_HE10_IsoM_v13, process.HLT_Photon75_R9Id90_HE10_IsoM_v13, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v3, process.HLT_Photon90_R9Id90_HE10_IsoM_v13, process.HLT_Photon120_R9Id90_HE10_IsoM_v13, process.HLT_Photon165_R9Id90_HE10_IsoM_v14, process.HLT_Photon90_CaloIdL_PFHT700_v14, process.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v12, process.HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v12, process.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, process.HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, process.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v12, process.HLT_Diphoton30EB_18EB_R9Id_OR_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v13, process.HLT_Dimuon0_Jpsi_L1_NoOS_v6, process.HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v6, process.HLT_Dimuon0_Jpsi_v7, process.HLT_Dimuon0_Jpsi_NoVertexing_v7, process.HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v6, process.HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v6, process.HLT_Dimuon0_Jpsi3p5_Muon2_v5, process.HLT_Dimuon0_Upsilon_L1_4p5_v7, process.HLT_Dimuon0_Upsilon_L1_5_v7, process.HLT_Dimuon0_Upsilon_L1_4p5NoOS_v6, process.HLT_Dimuon0_Upsilon_L1_4p5er2p0_v7, process.HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v6, process.HLT_Dimuon0_Upsilon_NoVertexing_v6, process.HLT_Dimuon0_Upsilon_L1_5M_v6, process.HLT_Dimuon0_LowMass_L1_0er1p5R_v6, process.HLT_Dimuon0_LowMass_L1_0er1p5_v7, process.HLT_Dimuon0_LowMass_v7, process.HLT_Dimuon0_LowMass_L1_4_v7, process.HLT_Dimuon0_LowMass_L1_4R_v6, process.HLT_Dimuon0_LowMass_L1_TM530_v5, process.HLT_Dimuon0_Upsilon_Muon_L1_TM0_v5, process.HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v5, process.HLT_TripleMu_5_3_3_Mass3p8to60_DZ_v7, process.HLT_TripleMu_10_5_5_DZ_v9, process.HLT_TripleMu_12_10_5_v9, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v2, process.HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v2, process.HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v8, process.HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v8, process.HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v8, process.HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v5, process.HLT_DoubleMu4_Jpsi_Displaced_v6, process.HLT_DoubleMu4_Jpsi_NoVertexing_v6, process.HLT_DoubleMu4_JpsiTrkTrk_Displaced_v6, process.HLT_DoubleMu43NoFiltersNoVtx_v3, process.HLT_DoubleMu48NoFiltersNoVtx_v3, process.HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v4, process.HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v4, process.HLT_DoubleMu20_7_Mass0to30_L1_DM4_v6, process.HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v6, process.HLT_HT425_v8, process.HLT_HT430_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT500_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT430_DisplacedDijet60_DisplacedTrack_v11, process.HLT_HT400_DisplacedDijet40_DisplacedTrack_v11, process.HLT_HT650_DisplacedDijet60_Inclusive_v11, process.HLT_HT550_DisplacedDijet60_Inclusive_v11, process.HLT_DiJet110_35_Mjj650_PFMET110_v7, process.HLT_DiJet110_35_Mjj650_PFMET120_v7, process.HLT_DiJet110_35_Mjj650_PFMET130_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET110_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET120_v7, process.HLT_TripleJet110_35_35_Mjj650_PFMET130_v7, process.HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_VBF_DoubleMediumChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_VBF_DoubleTightChargedIsoPFTau20_Trk1_eta2p1_v1, process.HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v11, process.HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v11, process.HLT_Ele28_HighEta_SC20_Mass55_v11, process.HLT_DoubleMu20_7_Mass0to30_Photon23_v6, process.HLT_Ele15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, process.HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v14, process.HLT_Ele15_IsoVVVL_PFHT450_v14, process.HLT_Ele50_IsoVVVL_PFHT450_v14, process.HLT_Ele15_IsoVVVL_PFHT600_v18, process.HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v13, process.HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v12, process.HLT_Mu15_IsoVVVL_PFHT450_CaloBTagCSV_4p5_v7, process.HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v13, process.HLT_Mu15_IsoVVVL_PFHT450_v13, process.HLT_Mu50_IsoVVVL_PFHT450_v13, process.HLT_Mu15_IsoVVVL_PFHT600_v17, process.HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v6, process.HLT_Dimuon20_Jpsi_Barrel_Seagulls_v6, process.HLT_Dimuon10_Upsilon_Barrel_Seagulls_v6, process.HLT_Dimuon12_Upsilon_eta1p5_v13, process.HLT_Dimuon14_Phi_Barrel_Seagulls_v6, process.HLT_Dimuon18_PsiPrime_v13, process.HLT_Dimuon25_Jpsi_v13, process.HLT_Dimuon18_PsiPrime_noCorrL1_v4, process.HLT_Dimuon24_Upsilon_noCorrL1_v4, process.HLT_Dimuon24_Phi_noCorrL1_v4, process.HLT_Dimuon25_Jpsi_noCorrL1_v4, process.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v15, process.HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v15, process.HLT_DoubleIsoMu20_eta2p1_v5, process.HLT_DoubleIsoMu24_eta2p1_v5, process.HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v5, process.HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v11, process.HLT_TrkMu17_DoubleTrkMu8NoFiltersNoVtx_v12, process.HLT_Mu8_v11, process.HLT_Mu17_v11, process.HLT_Mu19_v2, process.HLT_Mu17_Photon30_IsoCaloId_v4, process.HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v14, process.HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, process.HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v1, process.HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v16, process.HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v16, process.HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v14, process.HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v16, process.HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v16, process.HLT_Ele115_CaloIdVT_GsfTrkIdT_v12, process.HLT_Ele135_CaloIdVT_GsfTrkIdT_v5, process.HLT_Ele145_CaloIdVT_GsfTrkIdT_v6, process.HLT_Ele200_CaloIdVT_GsfTrkIdT_v6, process.HLT_Ele250_CaloIdVT_GsfTrkIdT_v11, process.HLT_Ele300_CaloIdVT_GsfTrkIdT_v11, process.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v1, process.HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v7, process.HLT_PFHT380_SixPFJet32_DoublePFBTagCSV_2p2_v7, process.HLT_PFHT380_SixPFJet32_DoublePFBTagDeepCSV_2p2_v6, process.HLT_PFHT380_SixPFJet32_v7, process.HLT_PFHT430_SixPFJet40_PFBTagCSV_1p5_v7, process.HLT_PFHT430_SixPFJet40_v9, process.HLT_PFHT350_v17, process.HLT_PFHT350MinPFJet15_v7, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_v4, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v4, process.HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v9, process.HLT_FullTrack_Multiplicity85_v3, process.HLT_FullTrack_Multiplicity100_v2, process.HLT_FullTrack_Multiplicity130_v2, process.HLT_FullTrack_Multiplicity155_v3, process.HLT_ECALHT800_v9, process.HLT_DiSC30_18_EIso_AND_HE_Mass70_v12, process.HLT_Physics_v7, process.HLT_Physics_part0_v7, process.HLT_Physics_part1_v7, process.HLT_Physics_part2_v7, process.HLT_Physics_part3_v7, process.HLT_Physics_part4_v7, process.HLT_Physics_part5_v7, process.HLT_Physics_part6_v7, process.HLT_Physics_part7_v7, process.DST_Physics_v7, process.HLT_Random_v3, process.HLT_ZeroBias_v6, process.HLT_ZeroBias_part0_v6, process.HLT_ZeroBias_part1_v6, process.HLT_ZeroBias_part2_v6, process.HLT_ZeroBias_part3_v6, process.HLT_ZeroBias_part4_v6, process.HLT_ZeroBias_part5_v6, process.HLT_ZeroBias_part6_v6, process.HLT_ZeroBias_part7_v6, process.DST_ZeroBias_v2, process.DST_HT250_CaloScouting_v9, process.DST_HT250_CaloBTagScouting_v8, process.DST_HT410_PFScouting_v14, process.DST_HT410_BTagScouting_v14, process.DST_ZeroBias_BTagScouting_v13, process.DST_ZeroBias_CaloScouting_PFScouting_v12, process.DST_CaloJet40_BTagScouting_v13, process.DST_CaloJet40_CaloScouting_PFScouting_v13, process.DST_CaloJet40_CaloBTagScouting_v12, process.DST_L1HTT_BTagScouting_v13, process.DST_L1HTT_CaloScouting_PFScouting_v13, process.DST_L1HTT_CaloBTagScouting_v12, process.DST_L1DoubleMu_BTagScouting_v14, process.DST_L1DoubleMu_CaloScouting_PFScouting_v13, process.DST_DoubleMu3_noVtx_CaloScouting_Monitoring_v5, process.DST_DoubleMu3_noVtx_CaloScouting_v5, process.DST_DoubleMu1_noVtx_CaloScouting_v1, process.DST_DoubleMu3_noVtx_Mass10_PFScouting_v1, process.HLT_AK4CaloJet30_v11, process.HLT_AK4CaloJet40_v10, process.HLT_AK4CaloJet50_v10, process.HLT_AK4CaloJet80_v10, process.HLT_AK4CaloJet100_v10, process.HLT_AK4CaloJet120_v9, process.HLT_AK4PFJet30_v17, process.HLT_AK4PFJet50_v17, process.HLT_AK4PFJet80_v17, process.HLT_AK4PFJet100_v17, process.HLT_AK4PFJet120_v16, process.HLT_SinglePhoton10_Eta3p1ForPPRef_v8, process.HLT_SinglePhoton20_Eta3p1ForPPRef_v8, process.HLT_SinglePhoton30_Eta3p1ForPPRef_v8, process.HLT_Photon20_HoverELoose_v9, process.HLT_Photon30_HoverELoose_v9, process.HLT_EcalCalibration_v4, process.HLT_HcalCalibration_v5, process.AlCa_EcalPhiSym_v8, process.HLT_L1UnpairedBunchBptxMinus_v2, process.HLT_L1UnpairedBunchBptxPlus_v2, process.HLT_L1NotBptxOR_v3, process.HLT_L1MinimumBiasHF_OR_v2, process.HLT_L1MinimumBiasHF0OR_v3, process.HLT_L1_CDC_SingleMu_3_er1p2_TOP120_DPHI2p618_3p142_v2, process.HLT_HcalNZS_v12, process.HLT_HcalPhiSym_v14, process.HLT_HcalIsolatedbunch_v4, process.HLT_IsoTrackHB_v3, process.HLT_IsoTrackHE_v3, process.HLT_ZeroBias_FirstCollisionAfterAbortGap_v5, process.HLT_ZeroBias_IsolatedBunches_v5, process.HLT_ZeroBias_FirstCollisionInTrain_v4, process.HLT_ZeroBias_LastCollisionInTrain_v3, process.HLT_ZeroBias_FirstBXAfterTrain_v3, process.AlCa_RPCMuonNormalisation_v13, process.AlCa_LumiPixels_Random_v4, process.AlCa_LumiPixels_ZeroBias_v8, process.MC_ReducedIterativeTracking_v11, process.MC_PFMET_v15, process.MC_AK4PFJets_v15, process.MC_PFBTagCSV_v9, process.MC_PFHT_v14, process.MC_PFMHT_v14, process.MC_CaloMET_v8, process.MC_CaloMET_JetIdCleaned_v9, process.MC_AK4CaloJets_v9, process.MC_AK4CaloJetsFromPV_v7, process.MC_CaloBTagCSV_v7, process.MC_CaloHT_v8, process.MC_CaloMHT_v8, process.MC_AK8PFJets_v15, process.MC_AK8TrimPFJets_v15, process.MC_AK8PFHT_v14, process.MC_AK8CaloHT_v8, process.MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v12, process.MC_DoubleEle5_CaloIdL_MW_v13, process.MC_Ele5_WPTight_Gsf_v6, process.MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v13, process.MC_IsoMu_v13, process.MC_DoubleMu_TrkIsoVVL_DZ_v10, process.MC_DoubleMuNoFiltersNoVtx_v7, process.AlCa_EcalPi0EBonly_v12, process.AlCa_EcalPi0EEonly_v12, process.AlCa_EcalEtaEBonly_v12, process.AlCa_EcalEtaEEonly_v12, process.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTau30_eta2p1_TightID_CrossL1_v11, process.HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau40_Trk1_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleMediumChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v10, process.HLT_DoubleTightChargedIsoPFTau40_Trk1_TightID_eta2p1_Reg_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v10, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v6, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v1, process.HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v10, process.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v9, process.HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_eta2p1_Reg_CrossL1_v10, process.HLT_IsoMu24_eta2p1_TightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_CrossL1_v10, process.HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v7, process.HLT_Rsq0p35_v13, process.HLT_Rsq0p40_v13, process.HLT_RsqMR300_Rsq0p09_MR200_v13, process.HLT_RsqMR320_Rsq0p09_MR200_v13, process.HLT_RsqMR300_Rsq0p09_MR200_4jet_v13, process.HLT_RsqMR320_Rsq0p09_MR200_4jet_v13, process.HLT_IsoMu27_LooseChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_MediumChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_TightChargedIsoPFTau20_Trk1_eta2p1_SingleL1_v3, process.HLT_IsoMu27_MET90_v1, process.HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v1, process.HLT_IsoMu24_eta2p1_MediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_CrossL1_v1, process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1, process.HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v3, process.HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v3, process.HLT_PFMET100_PFMHT100_IDTight_PFHT60_v7, process.HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v7, process.HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v7, process.HLT_Mu18_Mu9_SameSign_v3, process.HLT_Mu18_Mu9_SameSign_DZ_v3, process.HLT_Mu18_Mu9_v3, process.HLT_Mu18_Mu9_DZ_v3, process.HLT_Mu20_Mu10_SameSign_v3, process.HLT_Mu20_Mu10_SameSign_DZ_v3, process.HLT_Mu20_Mu10_v3, process.HLT_Mu20_Mu10_DZ_v3, process.HLT_Mu23_Mu12_SameSign_v3, process.HLT_Mu23_Mu12_SameSign_DZ_v3, process.HLT_Mu23_Mu12_v3, process.HLT_Mu23_Mu12_DZ_v3, process.HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v5, process.HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v3, process.HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v8, process.HLT_TripleMu_5_3_3_Mass3p8to60_DCA_v2, process.HLT_QuadPFJet98_83_71_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet103_88_75_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet105_90_76_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet111_90_80_15_DoubleBTagCSV_p013_p08_VBF1_v7, process.HLT_QuadPFJet98_83_71_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet103_88_75_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet105_88_76_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet111_90_80_15_BTagCSV_p013_VBF2_v7, process.HLT_QuadPFJet98_83_71_15_v3, process.HLT_QuadPFJet103_88_75_15_v3, process.HLT_QuadPFJet105_88_76_15_v3, process.HLT_QuadPFJet111_90_80_15_v3, process.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p17_v1, process.HLT_AK8PFJet330_TrimMass30_PFAK8BTagCSV_p1_v1, process.HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v1, process.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v8, process.HLT_Diphoton30_18_PVrealAND_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v8, process.HLTriggerFinalPath, process.HLTAnalyzerEndpath, process.ParkingHLTPhysicsOutput, process.ParkingZeroBiasOutput, process.PhysicsCommissioningOutput, process.PhysicsEGammaOutput, process.PhysicsEndOfFillOutput, process.PhysicsHadronsTausOutput, process.PhysicsMuonsOutput, process.ParkingOutput, process.DQMOutput, process.DQMOnlineBeamspotOutput, process.DQMCalibrationOutput, process.DQMEventDisplayOutput, process.HLTMonitorOutput, process.RPCMONOutput, process.CalibrationOutput, process.EcalCalibrationOutput, process.ALCAPHISYMOutput, process.ALCALUMIPIXELSOutput, process.ALCAP0Output, process.ExpressOutput, process.ExpressAlignmentOutput, process.NanoDSTOutput, process.ScoutingPFOutput, process.ScoutingCaloMuonOutput, process.PhysicsParkingScoutingMonitorOutput, process.PhysicsHLTPhysics1Output, process.PhysicsHLTPhysics2Output, process.PhysicsHLTPhysics3Output, process.PhysicsHLTPhysics4Output, process.PhysicsZeroBias1Output, process.PhysicsZeroBias2Output, process.PhysicsZeroBias3Output, process.PhysicsZeroBias4Output )) process.source = cms.Source( "PoolSource", diff --git a/HLTrigger/Configuration/test/OnLine_HLT_HIon.py b/HLTrigger/Configuration/test/OnLine_HLT_HIon.py index 7f322125961b0..935a2a40861bd 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_HIon.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_HIon.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/HIon --type HIon --unprescale --process HLTHIon --globaltag auto:run2_hlt_HIon --input file:RelVal_Raw_HIon_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/HIon --type HIon --unprescale --process HLTHIon --globaltag auto:run2_hlt_HIon --input file:RelVal_Raw_HIon_DATA.root -# /dev/CMSSW_10_0_0/HIon/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/HIon/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTHIon" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/HIon/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/HIon/V1') ) process.transferSystem = cms.PSet( @@ -2632,13 +2632,13 @@ ) process.hcal_db_producer = cms.ESProducer( "HcalDbProducer" ) process.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2651,7 +2651,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2660,12 +2660,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2678,7 +2678,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2688,13 +2688,13 @@ trackFlip = cms.bool( False ) ) process.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2720,18 +2720,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2757,7 +2757,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_PIon.py b/HLTrigger/Configuration/test/OnLine_HLT_PIon.py index 558aaddc6443d..4b8b1b50fa19c 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_PIon.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_PIon.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/PIon --type PIon --unprescale --process HLTPIon --globaltag auto:run2_hlt_PIon --input file:RelVal_Raw_PIon_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/PIon --type PIon --unprescale --process HLTPIon --globaltag auto:run2_hlt_PIon --input file:RelVal_Raw_PIon_DATA.root -# /dev/CMSSW_10_0_0/PIon/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/PIon/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTPIon" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/PIon/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/PIon/V1') ) process.transferSystem = cms.PSet( @@ -2632,13 +2632,13 @@ ) process.hcal_db_producer = cms.ESProducer( "HcalDbProducer" ) process.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2651,7 +2651,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2660,12 +2660,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -2678,7 +2678,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -2688,13 +2688,13 @@ trackFlip = cms.bool( False ) ) process.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2720,18 +2720,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -2757,7 +2757,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_PRef.py b/HLTrigger/Configuration/test/OnLine_HLT_PRef.py index 92d95c58bebe8..c3b622fc54db2 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_PRef.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_PRef.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_10_0_0/PRef --type PRef --unprescale --process HLTPRef --globaltag auto:run2_hlt_PRef --input file:RelVal_Raw_PRef_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_10_1_0/PRef --type PRef --unprescale --process HLTPRef --globaltag auto:run2_hlt_PRef --input file:RelVal_Raw_PRef_DATA.root -# /dev/CMSSW_10_0_0/PRef/V42 (CMSSW_10_0_4) +# /dev/CMSSW_10_1_0/PRef/V1 (CMSSW_10_1_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTPRef" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_10_0_0/PRef/V42') + tableName = cms.string('/dev/CMSSW_10_1_0/PRef/V1') ) process.transferSystem = cms.PSet( @@ -2997,13 +2997,13 @@ ) process.hcal_db_producer = cms.ESProducer( "HcalDbProducer" ) process.hltCombinedSecondaryVertex = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3016,7 +3016,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( -99999.9 ), + sip2dSigMin = cms.double( 2.0 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3025,12 +3025,12 @@ 'CombinedSVPseudoVertex', 'CombinedSVNoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( maxDistToAxis = cms.double( 0.07 ), totalHitsMin = cms.uint32( 0 ), ptMin = cms.double( 0.0 ), @@ -3043,7 +3043,7 @@ jetDeltaRMax = cms.double( 0.3 ), normChi2Max = cms.double( 99999.9 ), pixelHitsMin = cms.uint32( 0 ), - sip2dSigMin = cms.double( 2.0 ), + sip2dSigMin = cms.double( -99999.9 ), sip2dValMin = cms.double( -99999.9 ), sip3dSigMin = cms.double( -99999.9 ), sip3dValMin = cms.double( -99999.9 ) @@ -3053,13 +3053,13 @@ trackFlip = cms.bool( False ) ) process.hltCombinedSecondaryVertexV2 = cms.ESProducer( "CombinedSecondaryVertexESProducer", + charmCut = cms.double( 1.5 ), recordLabel = cms.string( "HLT" ), - categoryVariableName = cms.string( "vertexCategory" ), useTrackWeights = cms.bool( True ), useCategories = cms.bool( True ), pseudoMultiplicityMin = cms.uint32( 2 ), - correctVertexMass = cms.bool( True ), - trackSelection = cms.PSet( + categoryVariableName = cms.string( "vertexCategory" ), + trackPseudoSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -3085,18 +3085,18 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( -99999.9 ) + sip2dSigMin = cms.double( 2.0 ) ), calibrationRecords = cms.vstring( 'CombinedSVIVFV2RecoVertex', 'CombinedSVIVFV2PseudoVertex', 'CombinedSVIVFV2NoVertex' ), trackPairV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.03 ) ), - charmCut = cms.double( 1.5 ), + correctVertexMass = cms.bool( True ), vertexFlip = cms.bool( False ), minimumTrackWeight = cms.double( 0.5 ), pseudoVertexV0Filter = cms.PSet( k0sMassWindow = cms.double( 0.05 ) ), trackMultiplicityMin = cms.uint32( 3 ), - trackPseudoSelection = cms.PSet( + trackSelection = cms.PSet( max_pT_dRcut = cms.double( 0.1 ), b_dR = cms.double( 0.6263 ), min_pT = cms.double( 120.0 ), @@ -3122,7 +3122,7 @@ jetDeltaRMax = cms.double( 0.3 ), pixelHitsMin = cms.uint32( 0 ), sip3dSigMin = cms.double( -99999.9 ), - sip2dSigMin = cms.double( 2.0 ) + sip2dSigMin = cms.double( -99999.9 ) ), trackSort = cms.string( "sip2dSig" ), SoftLeptonFlip = cms.bool( False ), @@ -4717,9 +4717,11 @@ logWarningEtThreshold_EE_FE = cms.double( 50.0 ) ) process.hltHcalDigis = cms.EDProducer( "HcalRawToDigi", + saveQIE10DataNSamples = cms.untracked.vint32( ), ExpectedOrbitMessageTime = cms.untracked.int32( -1 ), FilterDataQuality = cms.bool( True ), silent = cms.untracked.bool( True ), + saveQIE11DataNSamples = cms.untracked.vint32( ), HcalFirstFED = cms.untracked.int32( 700 ), InputLabel = cms.InputTag( "rawDataCollector" ), ComplainEmptyData = cms.untracked.bool( False ), @@ -4727,10 +4729,12 @@ UnpackCalib = cms.untracked.bool( True ), UnpackUMNio = cms.untracked.bool( True ), FEDs = cms.untracked.vint32( ), - UnpackerMode = cms.untracked.int32( 0 ), + saveQIE11DataTags = cms.untracked.vstring( ), UnpackTTP = cms.untracked.bool( False ), - lastSample = cms.int32( 9 ), UnpackZDC = cms.untracked.bool( True ), + saveQIE10DataTags = cms.untracked.vstring( ), + lastSample = cms.int32( 9 ), + UnpackerMode = cms.untracked.int32( 0 ), firstSample = cms.int32( 0 ) ) process.hltHbhePhase1Reco = cms.EDProducer( "HBHEPhase1Reconstructor", @@ -12673,15 +12677,15 @@ ) process.hltSiPixelClustersAfterSplittingForRefPP = cms.EDProducer( "JetCoreClusterSplitter", verbose = cms.bool( False ), - deltaRmax = cms.double( 0.05 ), + chargeFractionMin = cms.double( 2.0 ), forceXError = cms.double( 100.0 ), vertices = cms.InputTag( "hltFullIter0PrimaryVerticesPreSplittingForRefPP" ), chargePerUnit = cms.double( 2000.0 ), - forceYError = cms.double( 150.0 ), centralMIPCharge = cms.double( 26000.0 ), + forceYError = cms.double( 150.0 ), pixelClusters = cms.InputTag( "hltSiPixelClustersForRefPP" ), ptMin = cms.double( 200.0 ), - chargeFractionMin = cms.double( 2.0 ), + deltaRmax = cms.double( 0.05 ), cores = cms.InputTag( "hltJetsForCoreTracking" ), fractionalWidth = cms.double( 0.4 ), pixelCPE = cms.string( "hltESPPixelCPEGeneric" ) @@ -17489,11 +17493,13 @@ GsfTrackProducer = cms.InputTag( "hltEgammaGsfTracks" ) ) process.hltEgammaGsfTrackVars = cms.EDProducer( "EgammaHLTGsfTrackVarProducer", - recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), - beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), upperTrackNrToRemoveCut = cms.int32( 9999 ), + useDefaultValuesForEndcap = cms.bool( False ), lowerTrackNrToRemoveCut = cms.int32( -1 ), - inputCollection = cms.InputTag( "hltEgammaGsfTracks" ) + inputCollection = cms.InputTag( "hltEgammaGsfTracks" ), + recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), + beamSpotProducer = cms.InputTag( "hltOnlineBeamSpot" ), + useDefaultValuesForBarrel = cms.bool( False ) ) process.hltEle10WPLoose1GsfOneOEMinusOneOPFilterForHI = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), diff --git a/HLTrigger/Configuration/test/getFrozenHLT.sh b/HLTrigger/Configuration/test/getFrozenHLT.sh index 95443e5c7e9d3..a299b4e21c826 100755 --- a/HLTrigger/Configuration/test/getFrozenHLT.sh +++ b/HLTrigger/Configuration/test/getFrozenHLT.sh @@ -2,9 +2,9 @@ # ConfDB configurations to use TABLES="Fake Fake1 Fake2" -HLT_Fake="/dev/CMSSW_10_0_0/Fake" -HLT_Fake1="/dev/CMSSW_10_0_0/Fake1" -HLT_Fake2="/dev/CMSSW_10_0_0/Fake2" +HLT_Fake="/dev/CMSSW_10_1_0/Fake" +HLT_Fake1="/dev/CMSSW_10_1_0/Fake1" +HLT_Fake2="/dev/CMSSW_10_1_0/Fake2" # print extra messages ? VERBOSE=false diff --git a/HLTrigger/Configuration/test/getHLT.sh b/HLTrigger/Configuration/test/getHLT.sh index a32c3f8583135..60e2c0dbcc2ea 100755 --- a/HLTrigger/Configuration/test/getHLT.sh +++ b/HLTrigger/Configuration/test/getHLT.sh @@ -1,8 +1,8 @@ #! /bin/bash # ConfDB configurations to use -MASTER="/dev/CMSSW_10_0_0/HLT" # no explicit version, take the most recent -TARGET="/dev/CMSSW_10_0_0/\$TABLE" # no explicit version, take the most recent +MASTER="/dev/CMSSW_10_1_0/HLT" # no explicit version, take the most recent +TARGET="/dev/CMSSW_10_1_0/\$TABLE" # no explicit version, take the most recent TABLES="GRun HIon PIon PRef" # $TABLE in the above variable will be expanded to these TABLES diff --git a/HLTrigger/special/plugins/HLTPixelActivityFilter.cc b/HLTrigger/special/plugins/HLTPixelActivityFilter.cc index 1913637357b84..da47eabd43e5d 100644 --- a/HLTrigger/special/plugins/HLTPixelActivityFilter.cc +++ b/HLTrigger/special/plugins/HLTPixelActivityFilter.cc @@ -5,6 +5,8 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" // // class declaration @@ -18,10 +20,13 @@ class HLTPixelActivityFilter : public HLTFilter { private: bool hltFilter(edm::Event&, const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs & filterproduct) const override; +// int countLayersWithClusters(edm::Handle > & clusterCol,const TrackerTopology& tTopo); edm::InputTag inputTag_; // input tag identifying product containing pixel clusters unsigned int min_clusters_; // minimum number of clusters unsigned int max_clusters_; // maximum number of clusters + unsigned int min_layers_; // minimum number of clusters + unsigned int max_layers_; // maximum number of clusters edm::EDGetTokenT > inputToken_; }; @@ -32,7 +37,6 @@ class HLTPixelActivityFilter : public HLTFilter { #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h" - // // constructors and destructor // @@ -40,13 +44,20 @@ class HLTPixelActivityFilter : public HLTFilter { HLTPixelActivityFilter::HLTPixelActivityFilter(const edm::ParameterSet& config) : HLTFilter(config), inputTag_ (config.getParameter("inputTag")), min_clusters_ (config.getParameter("minClusters")), - max_clusters_ (config.getParameter("maxClusters")) + max_clusters_ (config.getParameter("maxClusters")), + min_layers_ (config.getParameter("minLayers")), + max_layers_ (config.getParameter("maxLayers")) { inputToken_ = consumes >(inputTag_); LogDebug("") << "Using the " << inputTag_ << " input collection"; LogDebug("") << "Requesting at least " << min_clusters_ << " clusters"; if(max_clusters_ > 0) LogDebug("") << "...but no more than " << max_clusters_ << " clusters"; + if(min_layers_ > 0) + LogDebug("") << "Also requesting at least " << min_layers_ << " layers with clusters"; + if(max_layers_ > 0) + LogDebug("") << "...but no more than " << max_layers_ << " layers with clusters"; + } HLTPixelActivityFilter::~HLTPixelActivityFilter() = default; @@ -58,13 +69,14 @@ HLTPixelActivityFilter::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add("inputTag",edm::InputTag("hltSiPixelClusters")); desc.add("minClusters",3); desc.add("maxClusters",0); + desc.add("minLayers",0); + desc.add("maxLayers",0); descriptions.add("hltPixelActivityFilter",desc); } // // member functions // - // ------------ method called to produce the data ------------ bool HLTPixelActivityFilter::hltFilter(edm::Event& event, const edm::EventSetup& iSetup, trigger::TriggerFilterObjectWithRefs & filterproduct) const { @@ -85,6 +97,44 @@ bool HLTPixelActivityFilter::hltFilter(edm::Event& event, const edm::EventSetup& if(max_clusters_ > 0) accept &= (clusterSize <= max_clusters_); + if (min_layers_ > 0 || max_layers_ > 0){ + + edm::ESHandle tTopoHandle; + iSetup.get().get(tTopoHandle); + const TrackerTopology& tTopo = *tTopoHandle; + unsigned int layerCount = 0; + const edmNew::DetSetVector& clusters = *clusterColl; + + edmNew::DetSetVector::const_iterator DSViter=clusters.begin(); + + + std::vector foundLayersB; + std::vector foundLayersEp; + std::vector foundLayersEm; + for ( ; DSViter != clusters.end() ; DSViter++) { + unsigned int detid = DSViter->detId(); + DetId detIdObject( detid ); + const auto nCluster = DSViter->size(); + const auto subdet = detIdObject.subdetId(); + if (subdet == PixelSubdetector::PixelBarrel){ + if(!(std::find(foundLayersB.begin(), foundLayersB.end(), tTopo.layer(detIdObject)) != foundLayersB.end()) && nCluster > 0) foundLayersB.push_back(tTopo.layer(detIdObject)); + } + else if (subdet ==PixelSubdetector::PixelEndcap){ + if (tTopo.side(detIdObject) == 2){ + if(!(std::find(foundLayersEp.begin(), foundLayersEp.end(), tTopo.layer(detIdObject)) != foundLayersEp.end()) && nCluster > 0) foundLayersEp.push_back(tTopo.layer(detIdObject)); + } + else if (tTopo.side(detIdObject) == 1){ + if(!(std::find(foundLayersEm.begin(), foundLayersEm.end(), tTopo.layer(detIdObject)) != foundLayersEm.end()) && nCluster > 0) foundLayersEm.push_back(tTopo.layer(detIdObject)); + } + + } + } + layerCount = foundLayersB.size()+foundLayersEp.size()+foundLayersEm.size(); + if (max_layers_ > 0) accept &= (layerCount <= max_layers_); + if (min_layers_ > 0) accept &= (layerCount >= min_layers_); + + + } // return with final filter decision return accept; } diff --git a/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedDimuon_cff.py b/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedDimuon_cff.py index e8a39c8631937..4dff59285e162 100644 --- a/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedDimuon_cff.py +++ b/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedDimuon_cff.py @@ -4,6 +4,8 @@ hltPathsToCheck = cms.vstring( "HLT_DoubleMu43NoFiltersNoVtx_v", # 2017 displaced mu-mu (main) "HLT_DoubleMu48NoFiltersNoVtx_v", # 2017 displaced mu-mu (backup) + "HLT_DoubleMu33NoFiltersNoVtxDisplaced_v", # 2017 displaced mu-mu, muons with dxy> 0.01 cm (main) + "HLT_DoubleMu40NoFiltersNoVtxDisplaced_v", # 2017 displaced mu-mu, muons with dxy> 0.01 cm (backup) ), recMuonLabel = cms.InputTag("muons"), # -- Analysis specific cuts diff --git a/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedMuEG_cff.py b/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedMuEG_cff.py index d197ca30b338d..0d80ab868e94f 100644 --- a/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedMuEG_cff.py +++ b/HLTriggerOffline/Exotica/python/analyses/hltExoticaDisplacedMuEG_cff.py @@ -4,6 +4,8 @@ hltPathsToCheck = cms.vstring( "HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v", # 2017 displaced e-mu (main) "HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v", # 2017 displaced e-mu (backup) + "HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v", # 2017 displaced e-mu, muon with dxy> 0.01cm (main) + "HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v", # 2017 displaced e-mu, muon with dxy> 0.01cm (backup) ), recElecLabel = cms.InputTag("gedGsfElectrons"), recMuonLabel = cms.InputTag("muons"), diff --git a/JetMETCorrections/Modules/src/classes.h b/JetMETCorrections/Modules/src/classes.h new file mode 100644 index 0000000000000..b9f5fea09ac96 --- /dev/null +++ b/JetMETCorrections/Modules/src/classes.h @@ -0,0 +1,7 @@ +#include "JetMETCorrections/Modules/interface/JetResolution.h" + +namespace JetMETCorrections_Modules { + struct dictionary { + JME::JetResolution jr; + }; +} diff --git a/JetMETCorrections/Modules/src/classes_def.xml b/JetMETCorrections/Modules/src/classes_def.xml new file mode 100644 index 0000000000000..f98c7c8a6c1bd --- /dev/null +++ b/JetMETCorrections/Modules/src/classes_def.xml @@ -0,0 +1,4 @@ + + + + diff --git a/L1Trigger/CSCCommonTrigger/interface/CSCConstants.h b/L1Trigger/CSCCommonTrigger/interface/CSCConstants.h index c09c521e90ef9..c20350ca7db78 100644 --- a/L1Trigger/CSCCommonTrigger/interface/CSCConstants.h +++ b/L1Trigger/CSCCommonTrigger/interface/CSCConstants.h @@ -80,7 +80,7 @@ class CSCConstants // An MPC receives up to 18 LCTs from 9 CSCs in the trigger sector MAX_LCTS_PER_MPC = 18, // Reference BX for LCTs in simulation and firmware - LCT_CENTRAL_BX = 6}; + LCT_CENTRAL_BX = 8}; }; #endif diff --git a/L1Trigger/CSCCommonTrigger/python/CSCCommonTrigger_cfi.py b/L1Trigger/CSCCommonTrigger/python/CSCCommonTrigger_cfi.py index a1840ddb6afae..e64e153a398ba 100644 --- a/L1Trigger/CSCCommonTrigger/python/CSCCommonTrigger_cfi.py +++ b/L1Trigger/CSCCommonTrigger/python/CSCCommonTrigger_cfi.py @@ -2,8 +2,8 @@ #Common Parameters for the various CSCTrigger producers CSCCommonTrigger = cms.PSet( - MaxBX = cms.int32(9), + MaxBX = cms.int32(11), #minimum and maximum bx to process - MinBX = cms.int32(3) + MinBX = cms.int32(5) ) diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc index 4591720e37ec4..77e128122cdb6 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc @@ -110,9 +110,6 @@ void CSCTriggerPrimitivesProducer::produce(edm::StreamID iID, edm::Event& ev, co streamCache(iID)->setConfigParameters(conf.product()); } - // temporary hack to run on data - streamCache(iID)->runOnData(ev.eventAuxiliary().isRealData()); - // Get the collections of comparator & wire digis from event. edm::Handle compDigis; edm::Handle wireDigis; diff --git a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py index 98d3ce6e88672..d81d95d2a2050 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py +++ b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py @@ -42,6 +42,9 @@ # flags to optionally disable finding stubs in ME42 or ME1a disableME1a = cms.bool(False), disableME42 = cms.bool(False), + + # offset between the ALCT and CLCT central BX in simulation + alctClctOffset = cms.uint32(1), ), # Parameters for ALCT processors: old MC studies diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index 68154ec375ef1..2d1d1ce31afea 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -1683,6 +1683,16 @@ std::vector CSCAnodeLCTProcessor::readoutALCTs() { tmpV.push_back(*plct); } + + // shift the BX from 8 to 3 + // ALCTs in real data have the central BX in bin 3 + // which is the middle of the 7BX wide L1A window + // ALCTs used in the TMB emulator have central BX at bin 8 + // but right before we put emulated ALCTs in the event, we shift the BX + // by -5 to make sure they are compatible with real data ALCTs! + for (auto& p : tmpV){ + p.setBX(p.getBX() - (CSCConstants::LCT_CENTRAL_BX - l1a_window_width/2)); + } return tmpV; } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc index 68ef71fd5e6f1..d847f19014fd8 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc @@ -271,6 +271,15 @@ CSCCathodeLCTProcessor::CSCCathodeLCTProcessor(unsigned endcap, // Flag for SLHC studies isSLHC = comm.getParameter("isSLHC"); + // shift the BX from 7 to 8 + // the unpacked real data CLCTs have central BX at bin 7 + // however in simulation the central BX is bin 8 + // to make a proper comparison with ALCTs we need + // CLCT and ALCT to have the central BX in the same bin + // this shift does not affect the readout of the CLCTs + // emulated CLCTs put in the event should be centered at bin 7 (as in data) + alctClctOffset = comm.getParameter("alctClctOffset"); + // special configuration parameters for ME11 treatment smartME1aME1b = comm.getParameter("smartME1aME1b"); disableME1a = comm.getParameter("disableME1a"); @@ -679,6 +688,18 @@ CSCCathodeLCTProcessor::run(const CSCComparatorDigiCollection* compdc) { // Return vector of CLCTs. std::vector tmpV = getCLCTs(); + + // shift the BX from 7 to 8 + // the unpacked real data CLCTs have central BX at bin 7 + // however in simulation the central BX is bin 8 + // to make a proper comparison with ALCTs we need + // CLCT and ALCT to have the central BX in the same bin + // this shift does not affect the readout of the CLCTs + // emulated CLCTs put in the event should be centered at bin 7 (as in data) + for (auto& p : tmpV){ + p.setBX(p.getBX() + alctClctOffset); + } + return tmpV; } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.h index 8e0503ad68762..a5db7174c095b 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.h @@ -157,6 +157,11 @@ class CSCCathodeLCTProcessor /** Flag for SLHC studies. */ bool isSLHC; + /** Offset between ALCT and CLCT in simulation. + * This is important when ALCTs (at BX0=8) and CLCTs (at BX0=7) + * are correlated in the trigger motherboard. */ + unsigned int alctClctOffset; + /** Configuration parameters. */ unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode. unsigned int hit_persist, drift_delay; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index f0574cc4130f4..5ac94f6884c8c 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -136,7 +136,7 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct keyStrip = clct.getKeyStrip(); keyWG = alct.getKeyWG(); bend = clct.getBend(); - thisLCT.setALCT(alct); + thisLCT.setALCT(getBXShiftedALCT(alct)); thisLCT.setCLCT(clct); thisLCT.setGEM1(gem1); thisLCT.setType(CSCCorrelatedLCTDigi::ALCTCLCTGEM); @@ -148,7 +148,7 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct keyStrip = clct.getKeyStrip(); keyWG = alct.getKeyWG(); bend = clct.getBend(); - thisLCT.setALCT(alct); + thisLCT.setALCT(getBXShiftedALCT(alct)); thisLCT.setCLCT(clct); thisLCT.setGEM1(gem2.first()); thisLCT.setGEM2(gem2.second()); @@ -161,7 +161,7 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct bx = alct.getBX(); keyStrip = mymap1[gem2.pad(2)]; keyWG = alct.getKeyWG(); - thisLCT.setALCT(alct); + thisLCT.setALCT(getBXShiftedALCT(alct)); thisLCT.setGEM1(gem2.first()); thisLCT.setGEM2(gem2.second()); thisLCT.setType(CSCCorrelatedLCTDigi::ALCT2GEM); @@ -440,4 +440,3 @@ int CSCGEMMotherboard::getLctTrigEnable() const { return clct_trig_enable; } - diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index d019ee042cc52..af5fb42d88b87 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -713,7 +713,8 @@ CSCCorrelatedLCTDigi CSCMotherboard::constructLCTs(const CSCALCTDigi& aLCT, cLCT.getKeyStrip(), pattern, cLCT.getBend(), bx, 0, 0, 0, theTrigChamber); thisLCT.setType(type); - thisLCT.setALCT(aLCT); + // make sure to shift the ALCT BX from 8 to 3! + thisLCT.setALCT(getBXShiftedALCT(aLCT)); thisLCT.setCLCT(cLCT); return thisLCT; } @@ -940,3 +941,11 @@ void CSCMotherboard::dumpConfigParams() const { strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"; LogDebug("CSCMotherboard") << strm.str(); } + +CSCALCTDigi +CSCMotherboard::getBXShiftedALCT(const CSCALCTDigi& aLCT) const +{ + CSCALCTDigi aLCT_shifted = aLCT; + aLCT_shifted.setBX(aLCT_shifted.getBX() - (CSCConstants::LCT_CENTRAL_BX - tmb_l1a_window_size/2)); + return aLCT_shifted; +} diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.h b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.h index 3b5fef190f7d8..6dddd8690dd50 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.h @@ -87,6 +87,9 @@ class CSCMotherboard // VK: change to protected, to allow inheritance protected: + // helper function to return ALCT with correct central BX + CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi&) const; + /** Verbosity level: 0: no print (default). * 1: print LCTs found. */ int infoV; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc index 3c187ccfc0f1c..978011b6f9ca0 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc @@ -433,13 +433,6 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, // run MPC simulation m_muonportcard->loadDigis(oc_lct); - // temporary hack to ensure that all MPC LCTs are read out - // in the correct readout window - if (runOnData_) { - m_minBX = 5; - m_maxBX = 11; - } - // sort the LCTs per sector // insert them into the result vector std::vector result; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.h b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.h index 1fdfe0abe109a..b5b3d7301bebb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.h +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.h @@ -56,15 +56,6 @@ class CSCTriggerPrimitivesBuilder void setCSCGeometry(const CSCGeometry *g) { csc_g = g; } void setGEMGeometry(const GEMGeometry *g) { gem_g = g; } - /* temporary function to check if running on data. - * Currently in simulation the central BX is BX6; in data - * it is BX8. This mismatch in conventions is expeced to - * be resolved in the near future. The member runOnData_ - * is used in the builder to shift the LCT BX readout - * with +2 from [3,9] to [5,11]. - */ - void runOnData(bool runOnData) {runOnData_ = runOnData;} - /** Build anode, cathode, and correlated LCTs in each chamber and fill * them into output collections. Select up to three best correlated LCTs * in each (sub)sector and put them into an output collection as well. */ @@ -106,9 +97,6 @@ class CSCTriggerPrimitivesBuilder static const int min_chamber; // chambers per trigger subsector static const int max_chamber; - /// temporary flag to run on data - bool runOnData_; - /// a flag whether to skip chambers from the bad chambers map bool checkBadChambers_; diff --git a/L1Trigger/L1TCommon/src/XmlConfigParser.cc b/L1Trigger/L1TCommon/src/XmlConfigParser.cc index 3f0ef2a4880ab..fe84e5146bb2a 100644 --- a/L1Trigger/L1TCommon/src/XmlConfigParser.cc +++ b/L1Trigger/L1TCommon/src/XmlConfigParser.cc @@ -338,7 +338,7 @@ void XmlConfigParser::readHwDescription(const DOMElement* element, TriggerSystem { XMLSize_t j = 0; if (roleChilds->item(j)->getNodeType() == DOMNode::TEXT_NODE) { - role = xercesc::XMLString::transcode(roleChilds->item(j)->getNodeValue()); + role = cms::xerces::toString(roleChilds->item(j)->getNodeValue()); pruneString(role); } } @@ -358,7 +358,7 @@ void XmlConfigParser::readHwDescription(const DOMElement* element, TriggerSystem { XMLSize_t j = 0; if (crateChilds->item(j)->getNodeType() == DOMNode::TEXT_NODE) { - crate = xercesc::XMLString::transcode(crateChilds->item(j)->getNodeValue()); + crate = cms::xerces::toString(crateChilds->item(j)->getNodeValue()); pruneString(crate); } } @@ -427,8 +427,8 @@ void XmlConfigParser::readContext(const DOMElement* element, const std::string& char *cStr = xercesc::XMLString::transcode( colChilds->item(k)->getNodeValue() ); char *saveptr, first = 1; for(char *item=strtok_r(cStr,delim.c_str(),&saveptr); - item != NULL; - item = strtok_r(NULL,delim.c_str(),&saveptr), first=0 + item != nullptr; + item = strtok_r(nullptr,delim.c_str(),&saveptr), first=0 ) columnsStr += (first ? std::string("") : delim) + pruneString(item); xercesc::XMLString::release( &cStr ); } @@ -447,8 +447,8 @@ void XmlConfigParser::readContext(const DOMElement* element, const std::string& char *tStr = xercesc::XMLString::transcode( colTypesChilds->item(k)->getNodeValue() ); char *saveptr, first = 1; for(char *item=strtok_r(tStr,delim.c_str(),&saveptr); - item != NULL; - item = strtok_r(NULL,delim.c_str(),&saveptr), first=0 + item != nullptr; + item = strtok_r(nullptr,delim.c_str(),&saveptr), first=0 ) typesStr += (first ? std::string("") : delim) + pruneString(item); xercesc::XMLString::release( &tStr ); } @@ -469,8 +469,8 @@ void XmlConfigParser::readContext(const DOMElement* element, const std::string& char *saveptr, first = 1; std::string row; for(char *item=strtok_r(rStr,delim.c_str(),&saveptr); - item != NULL; - item = strtok_r(NULL,delim.c_str(),&saveptr), first=0 + item != nullptr; + item = strtok_r(nullptr,delim.c_str(),&saveptr), first=0 ) row += (first ? std::string("") : delim) + pruneString(item); rowStrs.push_back(row); diff --git a/L1Trigger/L1TGlobal/interface/GlobalBoard.h b/L1Trigger/L1TGlobal/interface/GlobalBoard.h index 1e2273308a0fb..648eee298057d 100644 --- a/L1Trigger/L1TGlobal/interface/GlobalBoard.h +++ b/L1Trigger/L1TGlobal/interface/GlobalBoard.h @@ -259,6 +259,7 @@ class GlobalBoard bool m_firstEv; bool m_firstEvLumiSegment; + uint m_currentLumi; private: diff --git a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc index 05e7945aff827..caa19e1ed016f 100644 --- a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc +++ b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc @@ -51,6 +51,8 @@ void L1TGlobalProducer::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add ("JetInputTag", edm::InputTag(""))->setComment("InputTag for Calo Trigger Jet (required parameter: default value is invalid)"); desc.add ("EtSumInputTag", edm::InputTag(""))->setComment("InputTag for Calo Trigger EtSum (required parameter: default value is invalid)"); desc.add ("ExtInputTag", edm::InputTag(""))->setComment("InputTag for external conditions (not required, but recommend to specify explicitly in config)"); + desc.add ("AlgoBlkInputTag", edm::InputTag("gtDigis"))->setComment("InputTag for unpacked Algblk (required only if GetPrescaleColumnFromData set to true)"); + desc.add ("GetPrescaleColumnFromData",false)->setComment("Get prescale column from unpacked GlobalAlgBck. Otherwise use value specified in PrescaleSet"); desc.add ("AlgorithmTriggersUnprescaled", false)->setComment("not required, but recommend to specify explicitly in config"); desc.add ("AlgorithmTriggersUnmasked", false)->setComment("not required, but recommend to specify explicitly in config"); // These parameters have well defined default values and are not currently @@ -97,15 +99,19 @@ L1TGlobalProducer::L1TGlobalProducer(const edm::ParameterSet& parSet) : m_verbosity(parSet.getUntrackedParameter("Verbosity")), m_printL1Menu(parSet.getUntrackedParameter("PrintL1Menu")), - m_isDebugEnabled(edm::isDebugEnabled()) + m_isDebugEnabled(edm::isDebugEnabled()), + m_getPrescaleColumnFromData(parSet.getParameter("GetPrescaleColumnFromData")), + m_algoblkInputTag(parSet.getParameter("AlgoBlkInputTag")) { - m_egInputToken = consumes > (m_egInputTag); - m_tauInputToken = consumes > (m_tauInputTag); - m_jetInputToken = consumes > (m_jetInputTag); - m_sumInputToken = consumes > (m_sumInputTag); - m_muInputToken = consumes > (m_muInputTag); - m_extInputToken = consumes > (m_extInputTag); + m_egInputToken = consumes > (m_egInputTag); + m_tauInputToken = consumes > (m_tauInputTag); + m_jetInputToken = consumes > (m_jetInputTag); + m_sumInputToken = consumes > (m_sumInputTag); + m_muInputToken = consumes > (m_muInputTag); + m_extInputToken = consumes > (m_extInputTag); + if (m_getPrescaleColumnFromData) + m_algoblkInputToken = consumes > (m_algoblkInputTag); if (m_verbosity) { @@ -222,6 +228,7 @@ L1TGlobalProducer::L1TGlobalProducer(const edm::ParameterSet& parSet) : m_l1GtTmVetoAlgoCacheID = 0ULL; + m_currentLumi = 0; // Set default, initial, dummy prescale factor table std::vector > temp_prescaleTable; @@ -396,6 +403,21 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet m_l1GtPfAlgoCacheID = l1GtPfAlgoCacheID; } + if (m_getPrescaleColumnFromData && (m_currentLumi != iEvent.luminosityBlock()) ){ // get prescale column from unpacked data + + m_currentLumi=iEvent.luminosityBlock(); + + edm::Handle> m_uGtAlgBlk; + iEvent.getByToken(m_algoblkInputToken, m_uGtAlgBlk); + + if(m_uGtAlgBlk.isValid() && !m_uGtAlgBlk->isEmpty(0)) { + std::vector::const_iterator algBlk = m_uGtAlgBlk->begin(0); + m_prescaleSet=static_cast(algBlk->getPreScColumn()); + }else{ + m_prescaleSet=1; + edm::LogError("L1TGlobalProduce") << "Could not find valid algo block. Setting prescale column to 1" << std::endl; + } + } } else{ // Set Prescale factors to initial dummy values diff --git a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h index f287ab7543194..943661b4ac171 100644 --- a/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h +++ b/L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.h @@ -99,6 +99,8 @@ class L1TGlobalProducer : public edm::stream::EDProducer<> /// CSV file for prescales std::string m_prescalesFile; + uint m_currentLumi; + /// trigger masks & veto masks const L1GtTriggerMask* m_l1GtTmAlgo; unsigned long long m_l1GtTmAlgoCacheID; @@ -173,7 +175,11 @@ class L1TGlobalProducer : public edm::stream::EDProducer<> int m_verbosity; bool m_printL1Menu; bool m_isDebugEnabled; - + + bool m_getPrescaleColumnFromData; + edm::InputTag m_algoblkInputTag; + edm::EDGetToken m_algoblkInputToken; + }; diff --git a/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py b/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py index 635d8d2be682c..a765f9b3ec85d 100644 --- a/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py +++ b/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py @@ -16,6 +16,8 @@ EtSumInputTag = cms.InputTag("simCaloStage2Digis"), AlgorithmTriggersUnmasked = cms.bool(True), AlgorithmTriggersUnprescaled = cms.bool(True), + GetPrescaleColumnFromData = cms.bool(False), + AlgoBlkInputTag = cms.InputTag("gtStage2Digis") # deprecated in Mike's version of producer: #ProduceL1GtDaqRecord = cms.bool(True), #GmtInputTag = cms.InputTag("gtInput"), diff --git a/L1Trigger/L1TGlobal/src/GlobalBoard.cc b/L1Trigger/L1TGlobal/src/GlobalBoard.cc index f2f2c0f74a6ef..ae886eee51f9a 100644 --- a/L1Trigger/L1TGlobal/src/GlobalBoard.cc +++ b/L1Trigger/L1TGlobal/src/GlobalBoard.cc @@ -67,6 +67,7 @@ l1t::GlobalBoard::GlobalBoard() : m_candL1External( new BXVector), m_firstEv(true), m_firstEvLumiSegment(true), + m_currentLumi(0), m_isDebugEnabled(edm::isDebugEnabled()) { @@ -957,10 +958,11 @@ void l1t::GlobalBoard::runFDL(edm::Event& iEvent, m_prescaleCounterAlgoTrig.push_back(prescaleFactorsAlgoTrig); } m_firstEv = false; + m_currentLumi=iEvent.luminosityBlock(); } - // TODO FIXME find the beginning of the luminosity segment - if( m_firstEvLumiSegment ){ + // update and clear prescales at the beginning of the luminosity segment + if( m_firstEvLumiSegment || m_currentLumi != iEvent.luminosityBlock() ){ m_prescaleCounterAlgoTrig.clear(); for( int iBxInEvent = 0; iBxInEvent <= totalBxInEvent; ++iBxInEvent ){ @@ -968,6 +970,7 @@ void l1t::GlobalBoard::runFDL(edm::Event& iEvent, } m_firstEvLumiSegment = false; + m_currentLumi=iEvent.luminosityBlock(); } // Copy Algorithm bits to Prescaled word diff --git a/L1Trigger/L1TMuon/BuildFile.xml b/L1Trigger/L1TMuon/BuildFile.xml index a5c1862233333..9d4cb7d1a0d2d 100644 --- a/L1Trigger/L1TMuon/BuildFile.xml +++ b/L1Trigger/L1TMuon/BuildFile.xml @@ -29,3 +29,6 @@ + + + diff --git a/L1Trigger/L1TMuon/interface/GeometryTranslator.h b/L1Trigger/L1TMuon/interface/GeometryTranslator.h index 6d8d0b9d13421..9b03209f4e082 100644 --- a/L1Trigger/L1TMuon/interface/GeometryTranslator.h +++ b/L1Trigger/L1TMuon/interface/GeometryTranslator.h @@ -1,13 +1,13 @@ -#ifndef __L1TMUON_GEOMETRYTRANSLATOR_H__ -#define __L1TMUON_GEOMETRYTRANSLATOR_H__ -// +#ifndef __L1TMuon_GeometryTranslator_h__ +#define __L1TMuon_GeometryTranslator_h__ +// // Class: L1TMuon::GeometryTranslator // // Info: This class implements a the translations from packed bits or // digi information into local or global CMS coordinates for all // types of L1 trigger primitives that we want to consider for // use in the integrated muon trigger. -// +// // Note: This should be considered as a base class to some sort of global // look-up table // @@ -21,10 +21,11 @@ // forwards -namespace edm { +namespace edm { class EventSetup; } +class ME0Geometry; class GEMGeometry; class RPCGeometry; class CSCGeometry; @@ -48,6 +49,7 @@ namespace L1TMuon { void checkAndUpdateGeometry(const edm::EventSetup&); + const ME0Geometry& getME0Geometry() const { return *_geome0; } const GEMGeometry& getGEMGeometry() const { return *_geogem; } const RPCGeometry& getRPCGeometry() const { return *_georpc; } const CSCGeometry& getCSCGeometry() const { return *_geocsc; } @@ -58,6 +60,7 @@ namespace L1TMuon { private: // pointers to the current geometry records unsigned long long _geom_cache_id; + edm::ESHandle _geome0; edm::ESHandle _geogem; edm::ESHandle _georpc; edm::ESHandle _geocsc; diff --git a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h index ca16ea58d75e2..8e0e0b2736dc0 100644 --- a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h +++ b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h @@ -1,5 +1,5 @@ -#ifndef __L1TMUON_TRIGGERPRIMITIVE_H__ -#define __L1TMUON_TRIGGERPRIMITIVE_H__ +#ifndef __L1TMuon_TriggerPrimitive_h__ +#define __L1TMuon_TriggerPrimitive_h__ // // Class: L1TMuon::TriggerPrimitive // @@ -26,9 +26,6 @@ //Global point (created on the fly) #include "DataFormats/GeometryVector/interface/GlobalPoint.h" -// Forward declaration -#include "L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h" - // DT digi types class DTChamberId; class L1MuDTChambPhDigi; @@ -39,13 +36,17 @@ class CSCCorrelatedLCTDigi; class CSCDetId; // RPC digi types -class RPCDigiL1Link; +class RPCDigi; class RPCDetId; // GEM digi types class GEMPadDigi; class GEMDetId; +// ME0 digi types +class ME0PadDigi; +class ME0DetId; + namespace L1TMuon { @@ -59,19 +60,20 @@ namespace L1TMuon { // within a subsystem // for RPCs you have to unroll the digi-link and raw det-id struct RPCData { - RPCData() : strip(0), strip_low(0), strip_hi(0), layer(0), bx(0), valid(0) {} + RPCData() : strip(0), strip_low(0), strip_hi(0), layer(0), bx(0), valid(0), time(0.) {} uint16_t strip; uint16_t strip_low; // for use in clustering uint16_t strip_hi; // for use in clustering uint16_t layer; int16_t bx; uint16_t valid; + double time; // why double? }; struct CSCData { CSCData() : trknmb(0), valid(0), quality(0), keywire(0), strip(0), - pattern(0), bend(0), bx(0), mpclink(0), bx0(0), syncErr(0), - cscID(0) {} + pattern(0), bend(0), bx(0), mpclink(0), bx0(0), syncErr(0), + cscID(0) {} uint16_t trknmb; uint16_t valid; uint16_t quality; @@ -88,9 +90,9 @@ namespace L1TMuon { struct DTData { DTData() : bx(0), wheel(0), sector(0), station(0), radialAngle(0), - bendingAngle(0), qualityCode(0), Ts2TagCode(0), BxCntCode(0), - theta_bti_group(0), segment_number(0), theta_code(0), - theta_quality(0) {} + bendingAngle(0), qualityCode(0), Ts2TagCode(0), BxCntCode(0), + theta_bti_group(0), segment_number(0), theta_code(0), + theta_quality(0) {} // from ChambPhDigi (corresponds to a TRACO) // this gives us directly the phi int bx; // relative? bx number @@ -114,11 +116,13 @@ namespace L1TMuon { }; struct GEMData { - GEMData() : pad(0), pad_low(0), pad_hi(0), bx(0) {} + GEMData() : pad(0), pad_low(0), pad_hi(0), bx(0), bend(0), isME0(false) {} uint16_t pad; uint16_t pad_low; // for use in clustering uint16_t pad_hi; // for use in clustering int16_t bx; + int16_t bend; + bool isME0; }; //Persistency @@ -126,20 +130,22 @@ namespace L1TMuon { //DT TriggerPrimitive(const DTChamberId&, - const L1MuDTChambPhDigi&, - const int segment_number); + const L1MuDTChambPhDigi&, + const int segment_number); TriggerPrimitive(const DTChamberId&, - const L1MuDTChambThDigi&, - const int segment_number); + const L1MuDTChambThDigi&, + const int segment_number); TriggerPrimitive(const DTChamberId&, - const L1MuDTChambPhDigi&, - const L1MuDTChambThDigi&, - const int theta_bti_group); + const L1MuDTChambPhDigi&, + const L1MuDTChambThDigi&, + const int theta_bti_group); //CSC TriggerPrimitive(const CSCDetId&, - const CSCCorrelatedLCTDigi&); + const CSCCorrelatedLCTDigi&); //RPC TriggerPrimitive(const RPCDetId& detid, + const RPCDigi& digi); + TriggerPrimitive(const RPCDetId& detid, // keep this version for backward compatibility const unsigned strip, const unsigned layer, const int bx); @@ -147,6 +153,8 @@ namespace L1TMuon { // GEM TriggerPrimitive(const GEMDetId& detid, const GEMPadDigi& digi); + TriggerPrimitive(const ME0DetId& detid, + const ME0PadDigi& digi); //copy TriggerPrimitive(const TriggerPrimitive&); @@ -208,18 +216,14 @@ namespace L1TMuon { private: // Translate to 'global' position information at the level of 60 // degree sectors. Use CSC sectors as a template - void calculateDTGlobalSector(const DTChamberId& chid, - unsigned& global_sector, - unsigned& subsector ); - void calculateCSCGlobalSector(const CSCDetId& chid, - unsigned& global_sector, - unsigned& subsector ); - void calculateRPCGlobalSector(const RPCDetId& chid, - unsigned& global_sector, - unsigned& subsector ); - void calculateGEMGlobalSector(const GEMDetId& chid, - unsigned& global_sector, - unsigned& subsector ); + template + void calculateGlobalSector(const IDType& chid, + unsigned& globalsector, + unsigned& subsector ) { + // Not sure if this is ever going to get implemented + globalsector = 0; + subsector = 0; + } DTData _dt; CSCData _csc; diff --git a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h index 4f825819879db..0669ebf987121 100644 --- a/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h +++ b/L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h @@ -1,20 +1,24 @@ -#ifndef __L1TMUON_TRIGGERPRIMITIVEFWD_H__ -#define __L1TMUON_TRIGGERPRIMITIVEFWD_H__ +#ifndef __L1TMuon_TriggerPrimitiveFwd_h__ +#define __L1TMuon_TriggerPrimitiveFwd_h__ #include #include #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/Ptr.h" -namespace L1TMuon{ +namespace L1TMuon { class TriggerPrimitive; typedef std::vector TriggerPrimitiveCollection; - + //typedef edm::Ref TriggerPrimitiveRef; //typedef std::vector TriggerPrimitiveList; //typedef edm::Ptr TriggerPrimitivePtr; - typedef std::map TriggerPrimitiveStationMap; + //typedef std::map TriggerPrimitiveStationMap; + + class TTTriggerPrimitive; // Track Trigger hits + + typedef std::vector TTTriggerPrimitiveCollection; } #endif diff --git a/L1Trigger/L1TMuon/interface/TTGeometryTranslator.h b/L1Trigger/L1TMuon/interface/TTGeometryTranslator.h new file mode 100644 index 0000000000000..3fc79516ed36a --- /dev/null +++ b/L1Trigger/L1TMuon/interface/TTGeometryTranslator.h @@ -0,0 +1,74 @@ +#ifndef __L1TMuon_TTGeometryTranslator_h__ +#define __L1TMuon_TTGeometryTranslator_h__ + +// +// This class implements the translations from trigger primitive to +// global CMS coordinates for the Tracker trigger primitives analogous to +// the class GeometryTranslator. +// + +#include "FWCore/Framework/interface/ESHandle.h" +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" +#include + + +// forwards +namespace edm { + class EventSetup; +} + +class TrackerGeometry; +class TrackerTopology; +class MagneticField; + +namespace L1TMuon { + + class TTTriggerPrimitive; + + class TTGeometryTranslator { + public: + TTGeometryTranslator(); + ~TTGeometryTranslator(); + + // Things you have to do to just get simple det id info... + bool isBarrel (const TTTriggerPrimitive&) const; + bool isPSModule(const TTTriggerPrimitive&) const; + int region (const TTTriggerPrimitive&) const; // 0 for Barrel, +/-1 for +/- Endcap + int layer (const TTTriggerPrimitive&) const; + int ring (const TTTriggerPrimitive&) const; + int module (const TTTriggerPrimitive&) const; + + // The translations + double calculateGlobalEta(const TTTriggerPrimitive&) const; + double calculateGlobalPhi(const TTTriggerPrimitive&) const; + double calculateBendAngle(const TTTriggerPrimitive&) const; + + GlobalPoint getGlobalPoint(const TTTriggerPrimitive&) const; + + // Update geometry if necessary + void checkAndUpdateGeometry(const edm::EventSetup&); + + // Retrieve the geometry records + const TrackerGeometry& getTrackerGeometry() const { return *_geom; } + const TrackerTopology& getTrackerTopology() const { return *_topo; } + const MagneticField& getMagneticField() const { return *_magfield; } + + private: + // Pointers to the current geometry records + unsigned long long _geom_cache_id; + edm::ESHandle _geom; + + unsigned long long _topo_cache_id; + edm::ESHandle _topo; + + unsigned long long _magfield_cache_id; + edm::ESHandle _magfield; + + GlobalPoint getTTSpecificPoint(const TTTriggerPrimitive&) const; + double calcTTSpecificEta(const TTTriggerPrimitive&) const; + double calcTTSpecificPhi(const TTTriggerPrimitive&) const; + double calcTTSpecificBend(const TTTriggerPrimitive&) const; + }; +} + +#endif diff --git a/L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h b/L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h new file mode 100644 index 0000000000000..bafc05cf03eab --- /dev/null +++ b/L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h @@ -0,0 +1,121 @@ +#ifndef __L1TMuon_TTMuonTriggerPrimitive_h__ +#define __L1TMuon_TTMuonTriggerPrimitive_h__ + +// +// This class implements a layer for Phase 2 Tracker trigger primitive +// analogous to the class MuonTriggerPrimitive. +// + +#include +#include +#include + +// DetId +#include "DataFormats/DetId/interface/DetId.h" +// Global point +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" +// Track trigger data formats +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" + + +namespace L1TMuon { + + class TTTriggerPrimitive { + public: + // Define the subsystems that we have available (none at the moment). + // Start at 20 for TTMuonTriggerPrimitive to avoid collision with MuonTriggerPrimitive + enum subsystem_type{kTT = 20, kNSubsystems}; + + // Rename these + typedef TTStub TTDigi; + typedef DetId TTDetId; + + // Define the raw data + struct TTData { + TTData() : row_f(0.), col_f(0.), bend(0), bx(0) {} + float row_f; // why float? + float col_f; // why float? + int bend; + int16_t bx; + }; + + // Persistency + TTTriggerPrimitive(): _subsystem(kNSubsystems) {} + + // Constructor from track trigger digi + TTTriggerPrimitive(const TTDetId& detid, const TTDigi& digi); + + // Copy constructor + TTTriggerPrimitive(const TTTriggerPrimitive&); + + // Destructor + ~TTTriggerPrimitive() {} + + // Assignment operator + TTTriggerPrimitive& operator=(const TTTriggerPrimitive& tp); + + // Equality operator + bool operator==(const TTTriggerPrimitive& tp) const; + + // Subsystem type + const subsystem_type subsystem() const { return _subsystem; } + + // Global coordinates + const double getCMSGlobalEta() const { return _eta; } + void setCMSGlobalEta(const double eta) { _eta = eta; } + const double getCMSGlobalPhi() const { return _phi; } + void setCMSGlobalPhi(const double phi) { _phi = phi; } + const double getCMSGlobalRho() const { return _rho; } + void setCMSGlobalRho(const double rho) { _rho = rho; } + + const GlobalPoint getCMSGlobalPoint() const { + double theta = 2. * atan( exp(-_eta) ); + return GlobalPoint( GlobalPoint::Cylindrical( _rho, _phi, _rho/tan(theta)) ); + }; + + + // Detector id + TTDetId detId() const { return _id; } + + TTDetId rawId() const { return detId(); } + + // Accessors to raw data + void setTTData(const TTData& data) { _data = data; } + + const TTData getTTData() const { return _data; } + + TTData& accessTTData() { return _data; } + + // Accessors to common information + const int getStrip() const; + const int getSegment() const; + const int getBend() const; + const int getBX() const; + + const unsigned getGlobalSector() const { return _globalsector; } + const unsigned getSubSector() const { return _subsector; } + + void print(std::ostream&) const; + + private: + // Translate to 'global' position information at the level of 60 + // degree sectors. Use CSC sectors as a template + void calculateTTGlobalSector(const TTDetId& detid, + unsigned& globalsector, + unsigned& subsector ); + + TTData _data; + + TTDetId _id; + + subsystem_type _subsystem; + + unsigned _globalsector; // [1,6] in 60 degree sectors + unsigned _subsector; // [1,2] in 30 degree partitions of a sector + double _eta, _phi, _rho; // global pseudorapidity, phi, rho + double _theta; // bend angle with respect to ray from (0,0,0). // NOT USED + }; + +} // namespace L1TMuon + +#endif diff --git a/L1Trigger/L1TMuon/src/GeometryTranslator.cc b/L1Trigger/L1TMuon/src/GeometryTranslator.cc index 68443eaca0d6d..711508c704367 100644 --- a/L1Trigger/L1TMuon/src/GeometryTranslator.cc +++ b/L1Trigger/L1TMuon/src/GeometryTranslator.cc @@ -13,6 +13,7 @@ #include "L1Trigger/DTUtilities/interface/DTTrigGeom.h" #include "Geometry/RPCGeometry/interface/RPCGeometry.h" #include "Geometry/GEMGeometry/interface/GEMGeometry.h" +#include "Geometry/GEMGeometry/interface/ME0Geometry.h" #include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" @@ -25,10 +26,10 @@ GeometryTranslator::GeometryTranslator(): _geom_cache_id(0ULL), _magfield_cache_id(0ULL) { } -GeometryTranslator::~GeometryTranslator() { +GeometryTranslator::~GeometryTranslator() { } -double +double GeometryTranslator::calculateGlobalEta(const TriggerPrimitive& tp) const { switch(tp.subsystem()) { case TriggerPrimitive::kDT: @@ -44,12 +45,12 @@ GeometryTranslator::calculateGlobalEta(const TriggerPrimitive& tp) const { return calcGEMSpecificEta(tp); break; default: - return std::nan("Invalid TP type!"); + return std::nan("Invalid TP type!"); break; } } -double +double GeometryTranslator::calculateGlobalPhi(const TriggerPrimitive& tp) const { switch(tp.subsystem()) { case TriggerPrimitive::kDT: @@ -70,7 +71,7 @@ GeometryTranslator::calculateGlobalPhi(const TriggerPrimitive& tp) const { } } -double +double GeometryTranslator::calculateBendAngle(const TriggerPrimitive& tp) const { switch(tp.subsystem()) { case TriggerPrimitive::kDT: @@ -117,6 +118,7 @@ void GeometryTranslator::checkAndUpdateGeometry(const edm::EventSetup& es) { const MuonGeometryRecord& geom = es.get(); unsigned long long geomid = geom.cacheIdentifier(); if( _geom_cache_id != geomid ) { + geom.get(_geome0); geom.get(_geogem); geom.get(_georpc); geom.get(_geocsc); @@ -134,11 +136,31 @@ void GeometryTranslator::checkAndUpdateGeometry(const edm::EventSetup& es) { GlobalPoint GeometryTranslator::getGEMSpecificPoint(const TriggerPrimitive& tp) const { - const GEMDetId id(tp.detId()); - const GEMEtaPartition * roll = _geogem->etaPartition(id); - const uint16_t pad = tp.getGEMData().pad; - const LocalPoint lp = roll->centreOfPad(pad); - const GlobalPoint gp = roll->toGlobal(lp); + LocalPoint lp; + GlobalPoint gp; + + if (!tp.getGEMData().isME0) { // use GEM geometry + const GEMDetId id(tp.detId()); + const GEMEtaPartition * roll = _geogem->etaPartition(id); + assert(roll); + //const uint16_t pad = tp.getGEMData().pad; + // Use half-strip precision, - 0.5 at the end to get the center of the strip + const float pad = (0.5 * static_cast(tp.getGEMData().pad_low + tp.getGEMData().pad_hi)) - 0.5; + lp = roll->centreOfPad(pad); + gp = roll->surface().toGlobal(lp); + + } else { // use ME0 geometry + const ME0DetId id(tp.detId()); + const ME0EtaPartition * roll = _geome0->etaPartition(id); + assert(roll); + //const uint16_t pad = tp.getGEMData().pad; + // Use half-strip precision, - 0.5 at the end to get the center of the strip + const float pad = (0.5 * static_cast(tp.getGEMData().pad_low + tp.getGEMData().pad_hi)) - 0.5; + //lp = roll->centreOfPad(pad); // does not work + const float strip = 2.0 * pad; + lp = roll->centreOfStrip(strip); + gp = roll->surface().toGlobal(lp); + } //roll.release(); @@ -155,11 +177,9 @@ GeometryTranslator::calcGEMSpecificPhi(const TriggerPrimitive& tp) const { return getGEMSpecificPoint(tp).phi(); } -// this function actually does nothing since GEM -// hits are point-like objects double GeometryTranslator::calcGEMSpecificBend(const TriggerPrimitive& tp) const { - return 0.0; + return tp.getGEMData().bend; } @@ -167,30 +187,31 @@ GlobalPoint GeometryTranslator::getRPCSpecificPoint(const TriggerPrimitive& tp) const { const RPCDetId id(tp.detId()); const RPCRoll * roll = _georpc->roll(id); + assert(roll); //const int strip = static_cast(tp.getRPCData().strip); // Use half-strip precision, - 0.5 at the end to get the center of the strip const float strip = (0.5 * static_cast(tp.getRPCData().strip_low + tp.getRPCData().strip_hi)) - 0.5; const LocalPoint lp = roll->centreOfStrip(strip); - const GlobalPoint gp = roll->toGlobal(lp); - + const GlobalPoint gp = roll->surface().toGlobal(lp); + //roll.release(); - + return gp; } -double -GeometryTranslator::calcRPCSpecificEta(const TriggerPrimitive& tp) const { +double +GeometryTranslator::calcRPCSpecificEta(const TriggerPrimitive& tp) const { return getRPCSpecificPoint(tp).eta(); } -double -GeometryTranslator::calcRPCSpecificPhi(const TriggerPrimitive& tp) const { +double +GeometryTranslator::calcRPCSpecificPhi(const TriggerPrimitive& tp) const { return getRPCSpecificPoint(tp).phi(); } // this function actually does nothing since RPC // hits are point-like objects -double +double GeometryTranslator::calcRPCSpecificBend(const TriggerPrimitive& tp) const { return 0.0; } @@ -198,11 +219,11 @@ GeometryTranslator::calcRPCSpecificBend(const TriggerPrimitive& tp) const { // alot of this is transcription and consolidation of the CSC // global phi calculation code -// this works directly with the geometry +// this works directly with the geometry // rather than using the old phi luts -GlobalPoint +GlobalPoint GeometryTranslator::getCSCSpecificPoint(const TriggerPrimitive& tp) const { - const CSCDetId id(tp.detId()); + const CSCDetId id(tp.detId()); // we should change this to weak_ptrs at some point // requires introducing std::shared_ptrs to geometry std::unique_ptr chamb(_geocsc->chamber(id)); @@ -212,13 +233,13 @@ GeometryTranslator::getCSCSpecificPoint(const TriggerPrimitive& tp) const { std::unique_ptr layer( chamb->layer(CSCConstants::KEY_ALCT_LAYER) ); - + const uint16_t halfstrip = tp.getCSCData().strip; const uint16_t pattern = tp.getCSCData().pattern; - const uint16_t keyWG = tp.getCSCData().keywire; - //const unsigned maxStrips = layer_geom->numberOfStrips(); + const uint16_t keyWG = tp.getCSCData().keywire; + //const unsigned maxStrips = layer_geom->numberOfStrips(); - // so we can extend this later + // so we can extend this later // assume TMB2007 half-strips only as baseline double offset = 0.0; switch(1) { @@ -230,46 +251,46 @@ GeometryTranslator::getCSCSpecificPoint(const TriggerPrimitive& tp) const { // the rough location of the hit at the ALCT key layer // we will refine this using the half strip information - const LocalPoint coarse_lp = - layer_geom->stripWireGroupIntersection(strip,keyWG); - const GlobalPoint coarse_gp = layer->surface().toGlobal(coarse_lp); - + const LocalPoint coarse_lp = + layer_geom->stripWireGroupIntersection(strip,keyWG); + const GlobalPoint coarse_gp = layer->surface().toGlobal(coarse_lp); + // the strip width/4.0 gives the offset of the half-strip // center with respect to the strip center const double hs_offset = layer_geom->stripPhiPitch()/4.0; - + // determine handedness of the chamber const bool ccw = isCSCCounterClockwise(layer); // we need to subtract the offset of even half strips and add the odd ones const double phi_offset = ( ( halfstrip_offs%2 ? 1 : -1)* - ( ccw ? -hs_offset : hs_offset ) ); - + ( ccw ? -hs_offset : hs_offset ) ); + // the global eta calculation uses the middle of the strip // so no need to increment it const GlobalPoint final_gp( GlobalPoint::Polar( coarse_gp.theta(), - (coarse_gp.phi().value() + - phi_offset), - coarse_gp.mag() ) ); - + (coarse_gp.phi().value() + + phi_offset), + coarse_gp.mag() ) ); + // We need to add in some notion of the 'error' on trigger primitives // like the width of the wire group by the width of the strip - // or something similar + // or something similar // release ownership of the pointers chamb.release(); layer_geom.release(); layer.release(); - + return final_gp; } -double -GeometryTranslator::calcCSCSpecificEta(const TriggerPrimitive& tp) const { +double +GeometryTranslator::calcCSCSpecificEta(const TriggerPrimitive& tp) const { return getCSCSpecificPoint(tp).eta(); } -double -GeometryTranslator::calcCSCSpecificPhi(const TriggerPrimitive& tp) const { +double +GeometryTranslator::calcCSCSpecificPhi(const TriggerPrimitive& tp) const { return getCSCSpecificPoint(tp).phi(); } @@ -279,55 +300,55 @@ GeometryTranslator::calcCSCSpecificBend(const TriggerPrimitive& tp) const { } GlobalPoint -GeometryTranslator::calcDTSpecificPoint(const TriggerPrimitive& tp) const { +GeometryTranslator::calcDTSpecificPoint(const TriggerPrimitive& tp) const { const DTChamberId baseid(tp.detId()); // do not use this pointer for anything other than creating a trig geom std::unique_ptr chamb( - const_cast(_geodt->chamber(baseid)) + const_cast(_geodt->chamber(baseid)) ); std::unique_ptr trig_geom( new DTTrigGeom(chamb.get(),false) ); - chamb.release(); // release it here so no one gets funny ideas + chamb.release(); // release it here so no one gets funny ideas // super layer one is the theta superlayer in a DT chamber // station 4 does not have a theta super layer // the BTI index from the theta trigger is an OR of some BTI outputs // so, we choose the BTI that's in the middle of the group // as the BTI that we get theta from // TODO:::::>>> need to make sure this ordering doesn't flip under wheel sign - const int NBTI_theta = ( (baseid.station() != 4) ? - trig_geom->nCell(2) : trig_geom->nCell(3) ); + const int NBTI_theta = ( (baseid.station() != 4) ? + trig_geom->nCell(2) : trig_geom->nCell(3) ); const int bti_group = tp.getDTData().theta_bti_group; - const unsigned bti_actual = bti_group*NBTI_theta/7 + NBTI_theta/14 + 1; - DTBtiId thetaBTI; + const unsigned bti_actual = bti_group*NBTI_theta/7 + NBTI_theta/14 + 1; + DTBtiId thetaBTI; if ( baseid.station() != 4 && bti_group != -1) { thetaBTI = DTBtiId(baseid,2,bti_actual); } else { // since this is phi oriented it'll give us theta in the middle // of the chamber - thetaBTI = DTBtiId(baseid,3,1); + thetaBTI = DTBtiId(baseid,3,1); } const GlobalPoint theta_gp = trig_geom->CMSPosition(thetaBTI); - + // local phi in sector -> global phi - double phi = ((double)tp.getDTData().radialAngle)/4096.0; - phi += tp.getDTData().sector*M_PI/6.0; // add sector offset + double phi = ((double)tp.getDTData().radialAngle)/4096.0; + phi += tp.getDTData().sector*M_PI/6.0; // add sector offset return GlobalPoint( GlobalPoint::Polar( theta_gp.theta(), - phi, - theta_gp.mag() ) ); + phi, + theta_gp.mag() ) ); } -double -GeometryTranslator::calcDTSpecificEta(const TriggerPrimitive& tp) const { +double +GeometryTranslator::calcDTSpecificEta(const TriggerPrimitive& tp) const { return calcDTSpecificPoint(tp).eta(); } -double +double GeometryTranslator::calcDTSpecificPhi(const TriggerPrimitive& tp) const { return calcDTSpecificPoint(tp).phi(); } // we have the bend except for station 3 -double +double GeometryTranslator::calcDTSpecificBend(const TriggerPrimitive& tp) const { int bend = tp.getDTData().bendingAngle; double bendf = bend/512.0; @@ -339,6 +360,6 @@ isCSCCounterClockwise(const std::unique_ptr& layer) const { const int nStrips = layer->geometry()->numberOfStrips(); const double phi1 = layer->centerOfStrip(1).phi(); const double phiN = layer->centerOfStrip(nStrips).phi(); - return ( (std::abs(phi1 - phiN) < M_PI && phi1 >= phiN) || - (std::abs(phi1 - phiN) >= M_PI && phi1 < phiN) ); + return ( (std::abs(phi1 - phiN) < M_PI && phi1 >= phiN) || + (std::abs(phi1 - phiN) >= M_PI && phi1 < phiN) ); } diff --git a/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc b/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc index 9b179db612cb0..f8d6be8e23af2 100644 --- a/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc +++ b/L1Trigger/L1TMuon/src/MuonTriggerPrimitive.cc @@ -4,14 +4,16 @@ #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhDigi.h" #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThDigi.h" -#include "DataFormats/RPCDigi/interface/RPCDigiL1Link.h" +#include "DataFormats/RPCDigi/interface/RPCDigi.h" #include "DataFormats/GEMDigi/interface/GEMPadDigi.h" +#include "DataFormats/GEMDigi/interface/ME0PadDigi.h" // detector ID types #include "DataFormats/MuonDetId/interface/DTChamberId.h" #include "DataFormats/MuonDetId/interface/CSCDetId.h" #include "DataFormats/MuonDetId/interface/RPCDetId.h" #include "DataFormats/MuonDetId/interface/GEMDetId.h" +#include "DataFormats/MuonDetId/interface/ME0DetId.h" using namespace L1TMuon; @@ -21,11 +23,11 @@ namespace { //constructors from DT data TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, - const L1MuDTChambPhDigi& digi_phi, - const int segment_number): + const L1MuDTChambPhDigi& digi_phi, + const int segment_number): _id(detid), _subsystem(TriggerPrimitive::kDT) { - calculateDTGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); // fill in information from theta trigger _dt.theta_bti_group = -1; _dt.segment_number = segment_number; @@ -44,11 +46,11 @@ TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, } TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, - const L1MuDTChambThDigi& digi_th, - const int theta_bti_group): + const L1MuDTChambThDigi& digi_th, + const int theta_bti_group): _id(detid), _subsystem(TriggerPrimitive::kDT) { - calculateDTGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); // fill in information from theta trigger _dt.theta_bti_group = theta_bti_group; _dt.segment_number = digi_th.position(theta_bti_group); @@ -67,12 +69,12 @@ TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, } TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, - const L1MuDTChambPhDigi& digi_phi, - const L1MuDTChambThDigi& digi_th, - const int theta_bti_group): + const L1MuDTChambPhDigi& digi_phi, + const L1MuDTChambThDigi& digi_th, + const int theta_bti_group): _id(detid), _subsystem(TriggerPrimitive::kDT) { - calculateDTGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); // fill in information from theta trigger _dt.theta_bti_group = theta_bti_group; _dt.segment_number = digi_th.position(theta_bti_group); @@ -92,10 +94,10 @@ TriggerPrimitive::TriggerPrimitive(const DTChamberId& detid, //constructor from CSC data TriggerPrimitive::TriggerPrimitive(const CSCDetId& detid, - const CSCCorrelatedLCTDigi& digi): + const CSCCorrelatedLCTDigi& digi): _id(detid), _subsystem(TriggerPrimitive::kCSC) { - calculateCSCGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); _csc.trknmb = digi.getTrknmb(); _csc.valid = digi.isValid(); _csc.quality = digi.getQuality(); @@ -118,31 +120,62 @@ TriggerPrimitive::TriggerPrimitive(const CSCDetId& detid, // constructor from RPC data +TriggerPrimitive::TriggerPrimitive(const RPCDetId& detid, + const RPCDigi& digi): + _id(detid), + _subsystem(TriggerPrimitive::kRPC) { + calculateGlobalSector(detid,_globalsector,_subsector); + _rpc.strip = digi.strip(); + _rpc.strip_low = digi.strip(); + _rpc.strip_hi = digi.strip(); + _rpc.layer = detid.layer(); + _rpc.bx = digi.bx(); + _rpc.valid = 1; + _rpc.time = digi.time(); +} + TriggerPrimitive::TriggerPrimitive(const RPCDetId& detid, const unsigned strip, const unsigned layer, const int bx): _id(detid), _subsystem(TriggerPrimitive::kRPC) { - calculateRPCGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); _rpc.strip = strip; _rpc.strip_low = strip; _rpc.strip_hi = strip; _rpc.layer = layer; _rpc.bx = bx; _rpc.valid = 1; + _rpc.time = -999999.; } + // constructor from GEM data TriggerPrimitive::TriggerPrimitive(const GEMDetId& detid, const GEMPadDigi& digi): _id(detid), _subsystem(TriggerPrimitive::kGEM) { - calculateGEMGlobalSector(detid,_globalsector,_subsector); + calculateGlobalSector(detid,_globalsector,_subsector); _gem.pad = digi.pad(); _gem.pad_low = digi.pad(); _gem.pad_hi = digi.pad(); _gem.bx = digi.bx(); + _gem.bend = 0; + _gem.isME0 = false; +} + +TriggerPrimitive::TriggerPrimitive(const ME0DetId& detid, + const ME0PadDigi& digi): + _id(detid), + _subsystem(TriggerPrimitive::kGEM) { + calculateGlobalSector(detid,_globalsector,_subsector); + _gem.pad = digi.pad(); + _gem.pad_low = digi.pad(); + _gem.pad_hi = digi.pad(); + _gem.bx = digi.bx(); + _gem.bend = 0; + _gem.isME0 = true; } TriggerPrimitive::TriggerPrimitive(const TriggerPrimitive& tp): @@ -208,10 +241,13 @@ bool TriggerPrimitive::operator==(const TriggerPrimitive& tp) const { this->_rpc.layer == tp._rpc.layer && this->_rpc.bx == tp._rpc.bx && this->_rpc.valid == tp._rpc.valid && + //this->_rpc.time == tp._rpc.time && this->_gem.pad == tp._gem.pad && this->_gem.pad_low == tp._gem.pad_low && this->_gem.pad_hi == tp._gem.pad_hi && this->_gem.bx == tp._gem.bx && + this->_gem.bend == tp._gem.bend && + this->_gem.isME0 == tp._gem.isME0 && this->_id == tp._id && this->_subsystem == tp._subsystem && this->_globalsector == tp._globalsector && @@ -290,39 +326,11 @@ const int TriggerPrimitive::getPattern() const { return -1; } -void TriggerPrimitive::calculateDTGlobalSector(const DTChamberId& chid, - unsigned& global_sector, - unsigned& subsector ) { - global_sector = 0; - subsector = 0; -} - -void TriggerPrimitive::calculateCSCGlobalSector(const CSCDetId& chid, - unsigned& global_sector, - unsigned& subsector ) { - global_sector = 0; - subsector = 0; -} - -void TriggerPrimitive::calculateRPCGlobalSector(const RPCDetId& chid, - unsigned& global_sector, - unsigned& subsector ) { - global_sector = 0; - subsector = 0; -} - -void TriggerPrimitive::calculateGEMGlobalSector(const GEMDetId& chid, - unsigned& global_sector, - unsigned& subsector ) { - global_sector = 0; - subsector = 0; -} - void TriggerPrimitive::print(std::ostream& out) const { unsigned idx = (unsigned) _subsystem; out << subsystem_names[idx] << " Trigger Primitive" << std::endl; - out << "eta: " << _eta << " phi: " << _phi - << " bend: " << _theta << std::endl; + out << "eta: " << _eta << " phi: " << _phi << " rho: " << _rho + << " theta: " << _theta << std::endl; switch(_subsystem) { case kDT: out << detId() << std::endl; @@ -360,13 +368,19 @@ void TriggerPrimitive::print(std::ostream& out) const { out << "Strip High : " << _rpc.strip_hi << std::endl; out << "Layer : " << _rpc.layer << std::endl; out << "Valid : " << _rpc.valid << std::endl; + out << "Time : " << _rpc.time << std::endl; break; case kGEM: - out << detId() << std::endl; + if (!_gem.isME0) + out << detId() << std::endl; + else + out << detId() << std::endl; out << "Local BX : " << _gem.bx << std::endl; out << "Pad : " << _gem.pad << std::endl; out << "Pad Low : " << _gem.pad_low << std::endl; out << "Pad High : " << _gem.pad_hi << std::endl; + out << "Packed Bend : " << _gem.bend << std::endl; + out << "Is ME0 : " << _gem.isME0 << std::endl; break; default: throw cms::Exception("Invalid Subsytem") diff --git a/L1Trigger/L1TMuon/src/TTGeometryTranslator.cc b/L1Trigger/L1TMuon/src/TTGeometryTranslator.cc new file mode 100644 index 0000000000000..dff19506bd3f9 --- /dev/null +++ b/L1Trigger/L1TMuon/src/TTGeometryTranslator.cc @@ -0,0 +1,195 @@ +#include "L1Trigger/L1TMuon/interface/TTGeometryTranslator.h" +#include "L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h" + +// event setup stuff / geometries +#include "FWCore/Framework/interface/EventSetup.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" + +#include "Geometry/CommonTopologies/interface/PixelTopology.h" +#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" + +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" + +using Phase2TrackerGeomDetUnit = PixelGeomDetUnit; +using Phase2TrackerTopology = PixelTopology; + +using namespace L1TMuon; + + +TTGeometryTranslator::TTGeometryTranslator(): + _geom_cache_id(0ULL), _topo_cache_id(0ULL), _magfield_cache_id(0ULL) { +} + +TTGeometryTranslator::~TTGeometryTranslator() { +} + +bool TTGeometryTranslator::isBarrel(const TTTriggerPrimitive& tp) const { + const DetId detId = tp.detId(); + bool isBarrel = (detId.subdetId() == StripSubdetector::TOB); + //bool isEndcap = (detId.subdetId() == StripSubdetector::TID); + return isBarrel; +} + +bool TTGeometryTranslator::isPSModule(const TTTriggerPrimitive& tp) const { + const DetId detId = tp.detId(); + const TrackerGeometry::ModuleType moduleType = _geom->getDetectorType(detId); + bool isPSModule = (moduleType == TrackerGeometry::ModuleType::Ph2PSP) || (moduleType == TrackerGeometry::ModuleType::Ph2PSS); + //bool isSSModule = (moduleType == TrackerGeometry::ModuleType::Ph2SS); + return isPSModule; +} + +int TTGeometryTranslator::region(const TTTriggerPrimitive& tp) const { + int region = 0; + + const DetId detId = tp.detId(); + if (detId.subdetId() == StripSubdetector::TOB) { // barrel + region = 0; + } else if (detId.subdetId() == StripSubdetector::TID) { // endcap + int type = _topo->tidSide(detId); // 1=-ve 2=+ve + if (type == 1) { + region = -1; + } else if (type == 2) { + region = +1; + } + } + return region; +} + +int TTGeometryTranslator::layer(const TTTriggerPrimitive& tp) const { + int layer = 0; + + const DetId detId = tp.detId(); + if (detId.subdetId() == StripSubdetector::TOB) { // barrel + layer = static_cast(_topo->layer(detId)); + } else if (detId.subdetId() == StripSubdetector::TID) { // endcap + layer = static_cast(_topo->layer(detId)); + } + return layer; +} + +int TTGeometryTranslator::ring(const TTTriggerPrimitive& tp) const { + int ring = 0; + + const DetId detId = tp.detId(); + if (detId.subdetId() == StripSubdetector::TOB) { // barrel + ring = static_cast(_topo->tobRod(detId)); + } else if (detId.subdetId() == StripSubdetector::TID) { // endcap + ring = static_cast(_topo->tidRing(detId)); + } + return ring; +} + +int TTGeometryTranslator::module(const TTTriggerPrimitive& tp) const { + int module = 0; + + const DetId detId = tp.detId(); + if (detId.subdetId() == StripSubdetector::TOB) { // barrel + module = static_cast(_topo->module(detId)); + } else if (detId.subdetId() == StripSubdetector::TID) { // endcap + module = static_cast(_topo->module(detId)); + } + return module; +} + +double +TTGeometryTranslator::calculateGlobalEta(const TTTriggerPrimitive& tp) const { + switch(tp.subsystem()) { + case TTTriggerPrimitive::kTT: + return calcTTSpecificEta(tp); + break; + default: + return std::nan("Invalid TP type!"); + break; + } +} + +double +TTGeometryTranslator::calculateGlobalPhi(const TTTriggerPrimitive& tp) const { + switch(tp.subsystem()) { + case TTTriggerPrimitive::kTT: + return calcTTSpecificPhi(tp); + break; + default: + return std::nan("Invalid TP type!"); + break; + } +} + +double +TTGeometryTranslator::calculateBendAngle(const TTTriggerPrimitive& tp) const { + switch(tp.subsystem()) { + case TTTriggerPrimitive::kTT: + return calcTTSpecificBend(tp); + break; + default: + return std::nan("Invalid TP type!"); + break; + } +} + +GlobalPoint +TTGeometryTranslator::getGlobalPoint(const TTTriggerPrimitive& tp) const { + switch(tp.subsystem()) { + case TTTriggerPrimitive::kTT: + return getTTSpecificPoint(tp); + break; + default: + GlobalPoint ret(GlobalPoint::Polar(std::nan("Invalid TP type!"), std::nan("Invalid TP type!"), std::nan("Invalid TP type!"))); + return ret; + break; + } +} + +void TTGeometryTranslator::checkAndUpdateGeometry(const edm::EventSetup& es) { + const TrackerDigiGeometryRecord& geom = es.get(); + unsigned long long geomid = geom.cacheIdentifier(); + if( _geom_cache_id != geomid ) { + geom.get(_geom); + _geom_cache_id = geomid; + } + + const TrackerTopologyRcd& topo = es.get(); + unsigned long long topoid = topo.cacheIdentifier(); + if( _topo_cache_id != topoid ) { + topo.get(_topo); + _topo_cache_id = topoid; + } + + const IdealMagneticFieldRecord& magfield = es.get(); + unsigned long long magfieldid = magfield.cacheIdentifier(); + if( _magfield_cache_id != magfieldid ) { + magfield.get(_magfield); + _magfield_cache_id = magfieldid; + } +} + +GlobalPoint +TTGeometryTranslator::getTTSpecificPoint(const TTTriggerPrimitive& tp) const { + // Check L1Trigger/TrackTrigger/src/TTStubAlgorithm_official.cc + const DetId detId = tp.detId(); + const GeomDetUnit* geoUnit = _geom->idToDetUnit(detId+1); // det0 + //const GeomDetUnit* geoUnit = _geom->idToDetUnit(detId+2); // det1 + const Phase2TrackerGeomDetUnit* ph2TkGeoUnit = dynamic_cast(geoUnit); + const MeasurementPoint mp(tp.getTTData().row_f, tp.getTTData().col_f); + const GlobalPoint gp = ph2TkGeoUnit->surface().toGlobal(ph2TkGeoUnit->specificTopology().localPosition(mp)); + return gp; +} + +double +TTGeometryTranslator::calcTTSpecificEta(const TTTriggerPrimitive& tp) const { + return getTTSpecificPoint(tp).eta(); +} + +double +TTGeometryTranslator::calcTTSpecificPhi(const TTTriggerPrimitive& tp) const { + return getTTSpecificPoint(tp).phi(); +} + +double +TTGeometryTranslator::calcTTSpecificBend(const TTTriggerPrimitive& tp) const { + return tp.getTTData().bend; +} diff --git a/L1Trigger/L1TMuon/src/TTMuonTriggerPrimitive.cc b/L1Trigger/L1TMuon/src/TTMuonTriggerPrimitive.cc new file mode 100644 index 0000000000000..8fa46c5b1eefa --- /dev/null +++ b/L1Trigger/L1TMuon/src/TTMuonTriggerPrimitive.cc @@ -0,0 +1,142 @@ +#include "L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h" + +#include + +using namespace L1TMuon; + +namespace { + const char subsystem_names[][3] = {"TT"}; +} + +// Constructor from track trigger digi +TTTriggerPrimitive::TTTriggerPrimitive(const TTDetId& detid, const TTDigi& digi): + _id(detid), + _subsystem(kTT) { + calculateTTGlobalSector(detid,_globalsector,_subsector); + + const MeasurementPoint& mp = digi.getClusterRef(0)->findAverageLocalCoordinatesCentered(); + _data.row_f = mp.x(); + _data.col_f = mp.y(); + _data.bend = digi.getTriggerBend(); + _data.bx = 0; +} + +// Copy constructor +TTTriggerPrimitive::TTTriggerPrimitive(const TTTriggerPrimitive& tp): + _data(tp._data), + _id(tp._id), + _subsystem(tp._subsystem), + _globalsector(tp._globalsector), + _subsector(tp._subsector), + _eta(tp._eta), + _phi(tp._phi), + _rho(tp._rho), + _theta(tp._theta){ +} + +// Assignment operator +TTTriggerPrimitive& TTTriggerPrimitive::operator=(const TTTriggerPrimitive& tp) { + this->_data = tp._data; + this->_id = tp._id; + this->_subsystem = tp._subsystem; + this->_globalsector = tp._globalsector; + this->_subsector = tp._subsector; + this->_eta = tp._eta; + this->_phi = tp._phi; + this->_rho = tp._rho; + this->_theta = tp._theta; + return *this; +} + +// Equality operator +bool TTTriggerPrimitive::operator==(const TTTriggerPrimitive& tp) const { + return ( static_cast(this->_data.row_f) == static_cast(tp._data.row_f) && + static_cast(this->_data.col_f) == static_cast(tp._data.col_f) && + this->_data.bend == tp._data.bend && + this->_data.bx == tp._data.bx && + this->_id == tp._id && + this->_subsystem == tp._subsystem && + this->_globalsector == tp._globalsector && + this->_subsector == tp._subsector ); +} + +const int TTTriggerPrimitive::getBX() const { + switch(_subsystem) { + case kTT: + return _data.bx; + default: + throw cms::Exception("Invalid Subsytem") + << "The specified subsystem for this track stub is out of range" + << std::endl; + } + return -1; +} + +const int TTTriggerPrimitive::getStrip() const { + switch(_subsystem) { + case kTT: + return static_cast(_data.row_f); + default: + throw cms::Exception("Invalid Subsytem") + << "The specified subsystem for this track stub is out of range" + << std::endl; + } + return -1; +} + +const int TTTriggerPrimitive::getSegment() const { + switch(_subsystem) { + case kTT: + return static_cast(_data.col_f); + default: + throw cms::Exception("Invalid Subsytem") + << "The specified subsystem for this track stub is out of range" + << std::endl; + } + return -1; +} + +const int TTTriggerPrimitive::getBend() const { + switch(_subsystem) { + case kTT: + return static_cast(_data.bend); + default: + throw cms::Exception("Invalid Subsytem") + << "The specified subsystem for this track stub is out of range" + << std::endl; + } + return -1; +} + +void TTTriggerPrimitive::calculateTTGlobalSector(const TTDetId& detid, + unsigned& globalsector, + unsigned& subsector ) { + globalsector = 0; + subsector = 0; +} + +std::ostream& operator<<(std::ostream& os, const TTTriggerPrimitive::TTDetId& detid) { + // Note that there is no endl to end the output + os << " undefined"; + return os; +} + +void TTTriggerPrimitive::print(std::ostream& out) const { + unsigned idx = (unsigned) _subsystem; + out << subsystem_names[idx] << " Trigger Primitive" << std::endl; + out << "eta: " << _eta << " phi: " << _phi << " rho: " << _rho + << " bend: " << _theta << std::endl; + switch(_subsystem) { + case kTT: + out << detId() << std::endl; + out << "Strip : " << static_cast(_data.row_f) << std::endl; + out << "Segment : " << static_cast(_data.col_f) << std::endl; + out << "Bend : " << _data.bend << std::endl; + out << "BX : " << _data.bx << std::endl; + break; + default: + throw cms::Exception("Invalid Subsytem") + << "The specified subsystem for this track stub is out of range" + << std::endl; + } +} diff --git a/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelParamsHelper.cc b/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelParamsHelper.cc index 4268dd37f2273..985c7bb021845 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelParamsHelper.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelParamsHelper.cc @@ -124,6 +124,9 @@ void L1TMuonBarrelParamsHelper::configFromDB(l1t::TriggerSystem& trgSys) { std::map procRole = trgSys.getProcToRoleAssignment(); + //Cleaning the default masking from the prototype + l1mudttfmasks.reset(); + for(auto it_proc=procRole.begin(); it_proc!=procRole.end(); it_proc++ ) { @@ -171,26 +174,26 @@ void L1TMuonBarrelParamsHelper::configFromDB(l1t::TriggerSystem& trgSys) for(int sec=0; sec<12; sec++){ if(masks[m]=="mask_ctrl_N2"){ l1mudttfmasks.set_inrec_chdis_st1(-3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(-3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(-3,sec,true); } if(masks[m]=="mask_ctrl_N1"){ l1mudttfmasks.set_inrec_chdis_st1(-2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(-2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(-2,sec,true); } if(masks[m]=="mask_ctrl_0"){ l1mudttfmasks.set_inrec_chdis_st1(-1,sec,true); l1mudttfmasks.set_inrec_chdis_st1(1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(-1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(-1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(1,sec,true); } if(masks[m]=="mask_ctrl_P1"){ l1mudttfmasks.set_inrec_chdis_st1(2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(2,sec,true); } if(masks[m]=="mask_ctrl_P2"){ l1mudttfmasks.set_inrec_chdis_st1(3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st1(3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st1(3,sec,true); } } @@ -200,26 +203,26 @@ void L1TMuonBarrelParamsHelper::configFromDB(l1t::TriggerSystem& trgSys) for(int sec=0; sec<12; sec++){ if(masks[m]=="mask_ctrl_N2"){ l1mudttfmasks.set_inrec_chdis_st2(-3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(-3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(-3,sec,true); } if(masks[m]=="mask_ctrl_N1"){ l1mudttfmasks.set_inrec_chdis_st2(-2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(-2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(-2,sec,true); } if(masks[m]=="mask_ctrl_0"){ l1mudttfmasks.set_inrec_chdis_st2(-1,sec,true); l1mudttfmasks.set_inrec_chdis_st2(1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(-1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(-1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(1,sec,true); } if(masks[m]=="mask_ctrl_P1"){ l1mudttfmasks.set_inrec_chdis_st2(2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(2,sec,true); } if(masks[m]=="mask_ctrl_P2"){ l1mudttfmasks.set_inrec_chdis_st2(3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st2(3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st2(3,sec,true); } } } @@ -228,26 +231,26 @@ void L1TMuonBarrelParamsHelper::configFromDB(l1t::TriggerSystem& trgSys) for(int sec=0; sec<12; sec++){ if(masks[m]=="mask_ctrl_N2"){ l1mudttfmasks.set_inrec_chdis_st3(-3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(-3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(-3,sec,true); } if(masks[m]=="mask_ctrl_N1"){ l1mudttfmasks.set_inrec_chdis_st3(-2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(-2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(-2,sec,true); } if(masks[m]=="mask_ctrl_0"){ l1mudttfmasks.set_inrec_chdis_st3(-1,sec,true); l1mudttfmasks.set_inrec_chdis_st3(1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(-1,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(-1,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(1,sec,true); } if(masks[m]=="mask_ctrl_P1"){ l1mudttfmasks.set_inrec_chdis_st3(2,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(2,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(2,sec,true); } if(masks[m]=="mask_ctrl_P2"){ l1mudttfmasks.set_inrec_chdis_st3(3,sec,true); - l1mudttfmasks.set_etsoc_chdis_st3(3,sec,true); + //l1mudttfmasks.set_etsoc_chdis_st3(3,sec,true); } } } diff --git a/L1Trigger/L1TMuonCPPF/BuildFile.xml b/L1Trigger/L1TMuonCPPF/BuildFile.xml new file mode 100644 index 0000000000000..7f886a6fab6eb --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/BuildFile.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L1Trigger/L1TMuonCPPF/README.md b/L1Trigger/L1TMuonCPPF/README.md new file mode 100644 index 0000000000000..27522c7b7f799 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/README.md @@ -0,0 +1,47 @@ +# CPPFDigis Emulator + +This is the first version of the CPPF emulator. we use the RPC Digitization and +reconstruction as intermedate steps. +Under test you can find two examples, one unpacking 2017F RAW Data (cppf_emulator_RAW.py) +and another one using generated MC events (cppf_emulator_MC.py). +The output of the unpacker is an edm branch named emulatorCppfDigis, following +the CPPFDigi dataformat already committed in CMSSW_10_1_X. + +# Out of the box instructions + +``` +ssh -XY username@lxplus.cern.ch +#setenv SCRAM_ARCH slc6_amd64_gcc630 +#(or export SCRAM_ARCH=slc6_amd64_gcc630) +cmsrel CMSSW_10_1_X_2018-03-11-2300 +cd CMSSW_10_1_X_2018-03-11-2300/src +cmsenv +``` + +``` +git cms-init +git fetch maseguracern +git cms-merge-topic -u maseguracern:CPPF_Emulator +#scram b clean +scram b -j6 +``` + +## Run the code (check the input) +``` +cd L1Trigger/L1TMuonCPPF +cmsRun test/cppf_emulator_RAW.py +``` + +## Setup your Github space (In case you haven't) +``` +git remote add YourGitHubName git@github.com:YourGitHubName/cmssw.git +git fetch YourGitHubName +git checkout -b YourBranchName +``` + +## Modifying files +``` +git add +git commit -m "Commit message" +git push my-cmssw YourBranchName +``` diff --git a/L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h b/L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h new file mode 100644 index 0000000000000..f5282dac78138 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h @@ -0,0 +1,36 @@ +#ifndef L1Trigger_L1TMuonCPPF_EmulateCPPF_h +#define L1Trigger_L1TMuonCPPF_EmulateCPPF_h + +#include "L1Trigger/L1TMuonCPPF/interface/RecHitProcessor.h" + +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + + +class EmulateCPPF { + + public: + explicit EmulateCPPF(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iConsumes); + ~EmulateCPPF(); + + void process( + // Input + const edm::Event& iEvent, const edm::EventSetup& iSetup, + // Output + l1t::CPPFDigiCollection& cppf_recHit + ); + + + private: + + // For now, treat CPPF as single board + // In the future, may want to treat the 4 CPPF boards in each endcap as separate entities + std::array recHit_processors_; + + const edm::EDGetToken recHitToken_; + enum class CppfSource { File, EventSetup } cppfSource_; + std::vector CppfVec_1; + int MaxClusterSize_; +}; // End class EmulateCPPF + +#endif // #define L1Trigger_L1TMuonCPPF_EmulateCPPF_h diff --git a/L1Trigger/L1TMuonCPPF/interface/RecHitProcessor.h b/L1Trigger/L1TMuonCPPF/interface/RecHitProcessor.h new file mode 100644 index 0000000000000..fe48143e1fa49 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/interface/RecHitProcessor.h @@ -0,0 +1,79 @@ +#ifndef L1Trigger_L1TMuonCPPF_RecHitProcessor_h +#define L1Trigger_L1TMuonCPPF_RecHitProcessor_h + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "Geometry/RPCGeometry/interface/RPCRoll.h" +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" + +#include "DataFormats/MuonDetId/interface/RPCDetId.h" +#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" +#include "DataFormats/L1TMuon/interface/CPPFDigi.h" + +#include "CondFormats/RPCObjects/interface/RPCMaskedStrips.h" +#include "CondFormats/RPCObjects/interface/RPCDeadStrips.h" + +#include "CondFormats/Serialization/interface/Serializable.h" +#include "L1Trigger/L1TMuonEndCap/interface/TrackTools.h" + +#include +#include +#include +#include +#include +#include + +class RecHitProcessor { + public: + explicit RecHitProcessor(); + ~RecHitProcessor(); + + struct CppfItem { + + int lb; + int rawId; + int strip; + int lbchannel; + int halfchannel; + int int_phi; + int int_theta; + COND_SERIALIZABLE; + }; + + std::vector const & getCppfVec() const {return CppfVec;} + std::vector CppfVec; + + + void processLook( + // Input + const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const edm::EDGetToken& recHitToken, + std::vector& CppfVec1, + // Output + l1t::CPPFDigiCollection& cppfDigis, + const int MaxClusterSize + ) const; + + void process( + // Input + const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const edm::EDGetToken& recHitToken, + // Output + l1t::CPPFDigiCollection& cppfDigis + ) const; + + void print(int a, int b, float c, float d) const {std::cout << a << " " << b << " " << c << " " << d << std::endl;}; + + COND_SERIALIZABLE; + + private: + +}; + +#endif /* #define L1Trigger_L1TMuonCPPF_RecHitProcessor_h */ diff --git a/L1Trigger/L1TMuonCPPF/plugins/BuildFile.xml b/L1Trigger/L1TMuonCPPF/plugins/BuildFile.xml new file mode 100644 index 0000000000000..6cdb6e2231720 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/plugins/BuildFile.xml @@ -0,0 +1,4 @@ + + + + diff --git a/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.cc b/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.cc new file mode 100644 index 0000000000000..a5951b6d0a1e3 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.cc @@ -0,0 +1,41 @@ +// Emulator that takes RPC hits and produces CPPFDigis to send to EMTF +// Author Alejandro Segura -- Universidad de los Andes + +#include "L1TMuonCPPFDigiProducer.h" + + +L1TMuonCPPFDigiProducer::L1TMuonCPPFDigiProducer(const edm::ParameterSet& iConfig) : + cppf_emulator_(std::make_unique(iConfig, consumesCollector())) + //cppf_emulator_(new EmulateCPPF(iConfig, consumesCollector())) +{ + // produces("rpcDigi"); + produces("recHit"); +} + +L1TMuonCPPFDigiProducer::~L1TMuonCPPFDigiProducer() { +} + +void L1TMuonCPPFDigiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + + // Create pointers to the collections which will store the cppfDigis + // auto cppf_rpcDigi = std::make_unique(); + auto cppf_recHit = std::make_unique(); + + // Main CPPF emulation process: emulates CPPF output from RPCDigi or RecHit inputs + // From src/EmulateCPPF.cc + // cppf_emulator_->process(iEvent, iSetup, *cppf_rpcDigi, *cppf_recHit); + cppf_emulator_->process(iEvent, iSetup, *cppf_recHit); + + // Fill the output collections + // iEvent.put(std::move(cppf_rpcDigi), "rpcDigi"); + iEvent.put(std::move(cppf_recHit), "recHit"); +} + +void L1TMuonCPPFDigiProducer::beginStream(edm::StreamID iID) { +} + +void L1TMuonCPPFDigiProducer::endStream(){ +} + +// Define this as a plug-in +DEFINE_FWK_MODULE(L1TMuonCPPFDigiProducer); diff --git a/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.h b/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.h new file mode 100644 index 0000000000000..1d475522a91fe --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/plugins/L1TMuonCPPFDigiProducer.h @@ -0,0 +1,66 @@ +// Emulator that takes RPC hits and produces CPPFDigis to send to EMTF +// Author Alejandro Segura -- Universidad de los Andes + +#ifndef L1Trigger_L1TMuonCPPF_L1TMuonCPPFDigiProducer_h +#define L1Trigger_L1TMuonCPPF_L1TMuonCPPFDigiProducer_h + +#include "L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h" + +// System include files +#include + +// User include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +//#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +// Other includes (all needed? - AWB 27.07.17) +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" +#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" + +#include "CondFormats/RPCObjects/interface/RPCDeadStrips.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/ESHandle.h" + +#include "DataFormats/MuonDetId/interface/RPCDetId.h" +#include "DataFormats/L1TMuon/interface/CPPFDigi.h" + +#include "Geometry/RPCGeometry/interface/RPCRoll.h" +#include "Geometry/RPCGeometry/interface/RPCGeometry.h" + +#include "L1Trigger/L1TMuonEndCap/interface/PrimitiveConversion.h" +#include "L1Trigger/L1TMuonEndCap/interface/SectorProcessorLUT.h" + +#include + +#include +#include +#include +#include "TVector3.h" + +// Class declaration +class L1TMuonCPPFDigiProducer : public edm::stream::EDProducer<> { + + public: + explicit L1TMuonCPPFDigiProducer(const edm::ParameterSet&); + ~L1TMuonCPPFDigiProducer() override; + + private: + + void beginStream(edm::StreamID) override; + void endStream() override; + void produce(edm::Event& event, const edm::EventSetup& setup) override; + + private: + std::unique_ptr cppf_emulator_; + +}; + +#endif /* #define L1Trigger_L1TMuonCPPF_L1TMuonCPPFDigiProducer_h */ diff --git a/L1Trigger/L1TMuonCPPF/python/emulatorCppfDigis_cfi.py b/L1Trigger/L1TMuonCPPF/python/emulatorCppfDigis_cfi.py new file mode 100644 index 0000000000000..a3b581a6f5772 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/python/emulatorCppfDigis_cfi.py @@ -0,0 +1,21 @@ +import FWCore.ParameterSet.Config as cms + +emulatorCppfDigis = cms.EDProducer("L1TMuonCPPFDigiProducer", + + ## Input collection + recHitLabel = cms.InputTag("rpcRecHits"), + MaxClusterSize = cms.int32(3), + # cppfSource = cms.string('Geo'), #'File' for Look up table and 'Geo' for CMSSW Geometry + cppfSource = cms.string('File'), #'File' for Look up table and 'Geo' for CMSSW Geometry + + cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFmerged.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFn1.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFn2.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFn3.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFn4.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFp1.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFp2.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFp3.txt') + # cppfvecfile = cms.FileInPath('L1Trigger/L1TMuon/data/cppf/angleScale_RPC_CPPFp4.txt') + ) + diff --git a/L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc b/L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc new file mode 100644 index 0000000000000..fab4fbb6bb095 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/src/EmulateCPPF.cc @@ -0,0 +1,88 @@ + +#include "L1Trigger/L1TMuonCPPF/interface/EmulateCPPF.h" +#include "CondFormats/RPCObjects/interface/RPCMaskedStrips.h" +#include "CondFormats/RPCObjects/interface/RPCDeadStrips.h" +#include +#include + +EmulateCPPF::EmulateCPPF(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iConsumes) : + // rpcDigi_processors_(), + recHit_processors_(), + // rpcDigiToken_( iConsumes.consumes(iConfig.getParameter("recHitLabel")) ), + recHitToken_(iConsumes.consumes(iConfig.getParameter("recHitLabel"))), + cppfSource_(CppfSource::EventSetup), + MaxClusterSize_(0) +{ + MaxClusterSize_ = iConfig.getParameter("MaxClusterSize"); + + const std::string cppfSource = iConfig.getParameter("cppfSource"); + //Look up table + if (cppfSource == "File"){ + cppfSource_ = CppfSource::File; + edm::FileInPath fp = iConfig.getParameter("cppfvecfile"); + std::ifstream inputFile(fp.fullPath().c_str(), std::ios::in); + if ( !inputFile ) { + throw cms::Exception("No LUT") << "Error: CPPF look up table file cannot not be opened"; + exit(1); + } + while ( inputFile.good() ) { + RecHitProcessor::CppfItem Item; + inputFile >> Item.rawId >> Item.strip >> Item.lb >> Item.halfchannel >> Item.int_phi >> Item.int_theta; + if ( inputFile.good() ) CppfVec_1.push_back(Item); + } + inputFile.close(); + } + + //RPC Geometry + else if (cppfSource == "Geo") { + cppfSource_ = CppfSource::EventSetup; + } + //Error for wrong input + else { + throw cms::Exception("Invalid option") << "Error: Specify in python/emulatorCppfDigis_cfi 'File' for look up table or 'Geo' for RPC Geometry"; + exit(1); + } + +} + +EmulateCPPF::~EmulateCPPF() { +} + +void EmulateCPPF::process( + const edm::Event& iEvent, const edm::EventSetup& iSetup, + // l1t::CPPFDigiCollection& cppf_rpcDigi, + l1t::CPPFDigiCollection& cppf_recHit + ) { + + if( cppfSource_ == CppfSource::File ){ + //Using the look up table to fill the information + cppf_recHit.clear(); + for (auto& recHit_processor : recHit_processors_) { + recHit_processor.processLook( iEvent, iSetup, recHitToken_, CppfVec_1, cppf_recHit, MaxClusterSize_); + // recHit_processors_.at(recHit_processor).processLook( iEvent, iSetup, recHitToken_, CppfVec_1, cppf_recHit ); + } + } + else if (cppfSource_ == CppfSource::EventSetup) { + // Clear output collections + // cppf_rpcDigi.clear(); + cppf_recHit.clear(); + + // // Get the RPCDigis from the event + // edm::Handle rpcDigis; + // iEvent.getByToken(rpcDigiToken_, rpcDigis); + + // _________________________________________________________________________________ + // Run the CPPF clusterization+coordinate conversion algo on RPCDigis and RecHits + + // For now, treat CPPF as single board + // In the future, may want to treat the 4 CPPF boards in each endcap as separate entities + + // for (unsigned int iBoard = 0; iBoard < rpcDigi_processors_.size(); iBoard++) { + // rpcDigi_processors_.at(iBoard).process( iSetup, rpcDigis, cppf_rpcDigi ); + // } + for (auto& recHit_processor : recHit_processors_) { + recHit_processor.process( iEvent, iSetup, recHitToken_, cppf_recHit ); + //recHit_processors_.at(recHit_processor).process( iEvent, iSetup, recHitToken_, cppf_recHit ); + } + } +} // End void EmulateCPPF::process() diff --git a/L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc b/L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc new file mode 100644 index 0000000000000..a918890881e11 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/src/RecHitProcessor.cc @@ -0,0 +1,468 @@ +#include "L1Trigger/L1TMuonCPPF/interface/RecHitProcessor.h" + +RecHitProcessor::RecHitProcessor() { +} + +RecHitProcessor::~RecHitProcessor() { +} + +void RecHitProcessor::processLook( + const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const edm::EDGetToken& recHitToken, + std::vector& CppfVec1, + l1t::CPPFDigiCollection& cppfDigis, + const int MaxClusterSize + ) const { + + edm::Handle recHits; + iEvent.getByToken(recHitToken, recHits); + + edm::ESHandle rpcGeom; + iSetup.get().get(rpcGeom); + + // The loop is over the detector container in the rpc geometry collection. We are interested in the RPDdetID (inside of RPCChamber vectors), specifically, the RPCrechits. to assignment the CPPFDigis. + for ( TrackingGeometry::DetContainer::const_iterator iDet = rpcGeom->dets().begin(); iDet < rpcGeom->dets().end(); iDet++ ) { + + // we do a cast over the class RPCChamber to obtain the RPCroll vectors, inside of them, the RPCRechits are found. in other words, the method ->rolls() does not exist for other kind of vector within DetContainer and we can not obtain the rpcrechits in a suitable way. + if (dynamic_cast( *iDet ) == nullptr ) continue; + + auto chamb = dynamic_cast( *iDet ); + + std::vector rolls = (chamb->rolls()); + + // Loop over rolls in the chamber + for(auto& iRoll : rolls){ + + RPCDetId rpcId = (*iRoll).id(); + + + + typedef std::pair rangeRecHits; + rangeRecHits recHitCollection = recHits->get(rpcId); + + + + //Loop over the RPC digis + for (RPCRecHitCollection::const_iterator rechit_it = recHitCollection.first; rechit_it != recHitCollection.second; rechit_it++) { + + //const RPCDetId& rpcId = rechit_it->rpcId(); + int rawId = rpcId.rawId(); + //int station = rpcId.station(); + int Bx = rechit_it->BunchX(); + int isValid = rechit_it->isValid(); + int firststrip = rechit_it->firstClusterStrip(); + int clustersize = rechit_it->clusterSize(); + LocalPoint lPos = rechit_it->localPosition(); + const RPCRoll* roll = rpcGeom->roll(rpcId); + const BoundPlane& rollSurface = roll->surface(); + GlobalPoint gPos = rollSurface.toGlobal(lPos); + float global_theta = emtf::rad_to_deg(gPos.theta().value()); + float global_phi = emtf::rad_to_deg(gPos.phi().value()); + //:::::::::::::::::::::::::::: + //Establish the average position of the rechit + int rechitstrip = firststrip; + + if(clustersize > 2) { + int medium = 0; + if (clustersize % 2 == 0) medium = 0.5*(clustersize); + else medium = 0.5*(clustersize-1); + rechitstrip += medium; + } + + if(clustersize > MaxClusterSize) continue; + //This is just for test CPPFDigis with the RPC Geometry, It must be "true" in the normal runs + bool Geo = true; + ////::::::::::::::::::::::::::::::::::::::::::::::::: + //Set the EMTF Sector + int EMTFsector1 = 0; + int EMTFsector2 = 0; + + //sector 1 + if ((global_phi > 15.) && (global_phi <= 16.3)) { + EMTFsector1 = 1; + EMTFsector2 = 6; + } + else if ((global_phi > 16.3) && (global_phi <= 53.)) { + EMTFsector1 = 1; + EMTFsector2 = 0; + } + else if ((global_phi > 53.) && (global_phi <= 75.)) { + EMTFsector1 = 1; + EMTFsector2 = 2; + } + //sector 2 + else if ((global_phi > 75.) && (global_phi <= 76.3)) { + EMTFsector1 = 1; + EMTFsector2 = 2; + } + else if ((global_phi > 76.3) && (global_phi <= 113.)) { + EMTFsector1 = 2; + EMTFsector2 = 0; + } + else if ((global_phi > 113.) && (global_phi <= 135.)) { + EMTFsector1 = 2; + EMTFsector2 = 3; + } + //sector 3 + //less than 180 + else if ((global_phi > 135.) && (global_phi <= 136.3)) { + EMTFsector1 = 2; + EMTFsector2 = 3; + } + else if ((global_phi > 136.3) && (global_phi <= 173.)) { + EMTFsector1 = 3; + EMTFsector2 = 0; + } + else if ((global_phi > 173.) && (global_phi <= 180.)) { + EMTFsector1 = 3; + EMTFsector2 = 4; + } + //Greater than -180 + else if ((global_phi < -165.) && (global_phi >= -180.)) { + EMTFsector1 = 3; + EMTFsector2 = 4; + } + //Fourth sector + else if ((global_phi > -165.) && (global_phi <= -163.7)) { + EMTFsector1 = 3; + EMTFsector2 = 4; + } + else if ((global_phi > -163.7) && (global_phi <= -127.)) { + EMTFsector1 = 4; + EMTFsector2 = 0; + } + else if ((global_phi > -127.) && (global_phi <= -105.)) { + EMTFsector1 = 4; + EMTFsector2 = 5; + } + //fifth sector + else if ((global_phi > -105.) && (global_phi <= -103.7)) { + EMTFsector1 = 4; + EMTFsector2 = 5; + } + else if ((global_phi > -103.7) && (global_phi <= -67.)) { + EMTFsector1 = 5; + EMTFsector2 = 0; + } + else if ((global_phi > -67.) && (global_phi <= -45.)) { + EMTFsector1 = 5; + EMTFsector2 = 6; + } + //sixth sector + else if ((global_phi > -45.) && (global_phi <= -43.7)) { + EMTFsector1 = 5; + EMTFsector2 = 6; + } + else if ((global_phi > -43.7) && (global_phi <= -7.)) { + EMTFsector1 = 6; + EMTFsector2 = 0; + } + else if ((global_phi > -7.) && (global_phi <= 15.)) { + EMTFsector1 = 6; + EMTFsector2 = 1; + } + + + // std::vector::iterator it; + // for(it = CppfVec1.begin(); it != CppfVec1.end(); it++){ + // if( (*it).rawId == rawId) if(Geo_true) std::cout << (*it).rawId << "rawid" << rawId << std::endl; + // } + //Loop over the look up table + double EMTFLink1 = 0.; + double EMTFLink2 = 0.; + + std::vector::iterator cppf1; + std::vector::iterator cppf; + for(cppf1 = CppfVec1.begin(); cppf1 != CppfVec1.end(); cppf1++){ + + + + //Condition to save the CPPFDigi + if(((*cppf1).rawId == rawId) && ((*cppf1).strip == rechitstrip)){ + + int old_strip = (*cppf1).strip; + int before = 0; + int after = 0; + + if(cppf1 != CppfVec1.begin()) + before = (*(cppf1-2)).strip; + + else if (cppf1 == CppfVec1.begin()) + before = (*cppf1).strip; + + if(cppf1 != CppfVec1.end()) + after = (*(cppf1+2)).strip; + + else if (cppf1 == CppfVec1.end()) + after = (*cppf1).strip; + + cppf = cppf1; + + if(clustersize == 2){ + + if(firststrip == 1){ + if(before < after) cppf=(cppf1-1); + else if (before > after) cppf=(cppf1+1); + } + else if(firststrip > 1){ + if(before < after) cppf=(cppf1+1); + else if (before > after) cppf=(cppf1-1); + } + + } + //Using the RPCGeometry + if(Geo){ + std::shared_ptr MainVariables1(new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector1, EMTFLink1, old_strip, clustersize, global_phi, global_theta)); + std::shared_ptr MainVariables2(new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector2, EMTFLink2, old_strip, clustersize, global_phi, global_theta)); + + if ((EMTFsector1 > 0) && (EMTFsector2 == 0)){ + cppfDigis.push_back(*MainVariables1.get()); + } + else if ((EMTFsector1 > 0) && (EMTFsector2 > 0)){ + cppfDigis.push_back(*MainVariables1.get()); + cppfDigis.push_back(*MainVariables2.get()); + } + else if ((EMTFsector1 == 0) && (EMTFsector2 == 0)) { + continue; + } + } //Geo is true + else { + global_phi = 0.; + global_theta = 0.; + std::shared_ptr MainVariables1(new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector1, EMTFLink1, old_strip, clustersize, global_phi, global_theta)); + std::shared_ptr MainVariables2(new l1t::CPPFDigi(rpcId, Bx , (*cppf).int_phi, (*cppf).int_theta, isValid, (*cppf).lb, (*cppf).halfchannel, EMTFsector2, EMTFLink2, old_strip, clustersize, global_phi, global_theta)); + if ((EMTFsector1 > 0) && (EMTFsector2 == 0)){ + cppfDigis.push_back(*MainVariables1.get()); + } + else if ((EMTFsector1 > 0) && (EMTFsector2 > 0)){ + cppfDigis.push_back(*MainVariables1.get()); + cppfDigis.push_back(*MainVariables2.get()); + } + else if ((EMTFsector1 == 0) && (EMTFsector2 == 0)) { + continue; + } + } + } //Condition to save the CPPFDigi + } //Loop over the LUTVector + } //Loop over the recHits + } // End loop: for (std::vector::const_iterator r = rolls.begin(); r != rolls.end(); ++r) + } // End loop: for (TrackingGeometry::DetContainer::const_iterator iDet = rpcGeom->dets().begin(); iDet < rpcGeom->dets().end(); iDet++) + +} + + +void RecHitProcessor::process( + const edm::Event& iEvent, + const edm::EventSetup& iSetup, + const edm::EDGetToken& recHitToken, + l1t::CPPFDigiCollection& cppfDigis + ) const { + + // Get the RPC Geometry + edm::ESHandle rpcGeom; + iSetup.get().get(rpcGeom); + + // Get the RecHits from the event + edm::Handle recHits; + iEvent.getByToken(recHitToken, recHits); + + + // The loop is over the detector container in the rpc geometry collection. We are interested in the RPDdetID (inside of RPCChamber vectors), specifically, the RPCrechits. to assignment the CPPFDigis. + for ( TrackingGeometry::DetContainer::const_iterator iDet = rpcGeom->dets().begin(); iDet < rpcGeom->dets().end(); iDet++ ) { + + // we do a cast over the class RPCChamber to obtain the RPCroll vectors, inside of them, the RPCRechits are found. in other words, the method ->rolls() does not exist for other kind of vector within DetContainer and we can not obtain the rpcrechits in a suitable way. + if (dynamic_cast( *iDet ) == nullptr ) continue; + + auto chamb = dynamic_cast( *iDet ); + std::vector rolls = (chamb->rolls()); + + // Loop over rolls in the chamber + for(auto& iRoll : rolls){ + + RPCDetId rpcId = (*iRoll).id(); + + typedef std::pair rangeRecHits; + rangeRecHits recHitCollection = recHits->get(rpcId); + + + for (RPCRecHitCollection::const_iterator rechit_it = recHitCollection.first; rechit_it != recHitCollection.second; rechit_it++) { + + //const RPCDetId& rpcId = rechit_it->rpcId(); + //int rawId = rpcId.rawId(); + int region = rpcId.region(); + //int station = rpcId.station(); + int Bx = rechit_it->BunchX(); + int isValid = rechit_it->isValid(); + int firststrip = rechit_it->firstClusterStrip(); + int clustersize = rechit_it->clusterSize(); + LocalPoint lPos = rechit_it->localPosition(); + const RPCRoll* roll = rpcGeom->roll(rpcId); + const BoundPlane& rollSurface = roll->surface(); + GlobalPoint gPos = rollSurface.toGlobal(lPos); + float global_theta = emtf::rad_to_deg(gPos.theta().value()); + float global_phi = emtf::rad_to_deg(gPos.phi().value()); + //Endcap region only + + if (region != 0) { + + int int_theta = (region == -1 ? 180. * 32. / 36.5 : 0.) + + (float)region * global_theta * 32. / 36.5 + - 8.5 * 32 / 36.5; + + if(region == 1) { + if(global_theta < 8.5) int_theta = 0; + if(global_theta > 45.) int_theta = 31; + } + else if(region == -1) { + if(global_theta < 135.) int_theta = 31; + if(global_theta > 171.5) int_theta = 0; + } + + //Local EMTF + double local_phi = 0.; + int EMTFsector1 = 0; + int EMTFsector2 = 0; + + //sector 1 + if ((global_phi > 15.) && (global_phi <= 16.3)) { + local_phi = global_phi-15.; + EMTFsector1 = 1; + EMTFsector2 = 6; + } + else if ((global_phi > 16.3) && (global_phi <= 53.)) { + local_phi = global_phi-15.; + EMTFsector1 = 1; + EMTFsector2 = 0; + } + else if ((global_phi > 53.) && (global_phi <= 75.)) { + local_phi = global_phi-15.; + EMTFsector1 = 1; + EMTFsector2 = 2; + } + //sector 2 + else if ((global_phi > 75.) && (global_phi <= 76.3)) { + local_phi = global_phi-15.; + EMTFsector1 = 1; + EMTFsector2 = 2; + } + else if ((global_phi > 76.3) && (global_phi <= 113.)) { + local_phi = global_phi-75.; + EMTFsector1 = 2; + EMTFsector2 = 0; + } + else if ((global_phi > 113.) && (global_phi <= 135.)) { + local_phi = global_phi-75.; + EMTFsector1 = 2; + EMTFsector2 = 3; + } + //sector 3 + //less than 180 + else if ((global_phi > 135.) && (global_phi <= 136.3)) { + local_phi = global_phi-75.; + EMTFsector1 = 2; + EMTFsector2 = 3; + } + else if ((global_phi > 136.3) && (global_phi <= 173.)) { + local_phi = global_phi-135.; + EMTFsector1 = 3; + EMTFsector2 = 0; + } + else if ((global_phi > 173.) && (global_phi <= 180.)) { + local_phi = global_phi-135.; + EMTFsector1 = 3; + EMTFsector2 = 4; + } + //Greater than -180 + else if ((global_phi < -165.) && (global_phi >= -180.)) { + local_phi = global_phi+225.; + EMTFsector1 = 3; + EMTFsector2 = 4; + } + //Fourth sector + else if ((global_phi > -165.) && (global_phi <= -163.7)) { + local_phi = global_phi+225.; + EMTFsector1 = 3; + EMTFsector2 = 4; + } + else if ((global_phi > -163.7) && (global_phi <= -127.)) { + local_phi = global_phi+165.; + EMTFsector1 = 4; + EMTFsector2 = 0; + } + else if ((global_phi > -127.) && (global_phi <= -105.)) { + local_phi = global_phi+165.; + EMTFsector1 = 4; + EMTFsector2 = 5; + } + //fifth sector + else if ((global_phi > -105.) && (global_phi <= -103.7)) { + local_phi = global_phi+165.; + EMTFsector1 = 4; + EMTFsector2 = 5; + } + else if ((global_phi > -103.7) && (global_phi <= -67.)) { + local_phi = global_phi+105.; + EMTFsector1 = 5; + EMTFsector2 = 0; + } + else if ((global_phi > -67.) && (global_phi <= -45.)) { + local_phi = global_phi+105.; + EMTFsector1 = 5; + EMTFsector2 = 6; + } + //sixth sector + else if ((global_phi > -45.) && (global_phi <= -43.7)) { + local_phi = global_phi+105.; + EMTFsector1 = 5; + EMTFsector2 = 6; + } + else if ((global_phi > -43.7) && (global_phi <= -7.)) { + local_phi = global_phi+45.; + EMTFsector1 = 6; + EMTFsector2 = 0; + } + else if ((global_phi > -7.) && (global_phi <= 15.)) { + local_phi = global_phi+45.; + EMTFsector1 = 6; + EMTFsector2 = 1; + } + + int int_phi = int((local_phi + 22.0 )*15. + .5); + + double EMTFLink1 = 0.; + double EMTFLink2 = 0.; + double lb = 0.; + double halfchannel = 0.; + + //Invalid hit + if (isValid == 0) int_phi = 2047; + //Right integers range + assert(0 <= int_phi && int_phi < 1250); + assert(0 <= int_theta && int_theta < 32); + + std::shared_ptr MainVariables1(new l1t::CPPFDigi(rpcId, Bx , int_phi, int_theta, isValid, lb, halfchannel, EMTFsector1, EMTFLink1, firststrip, clustersize, global_phi, global_theta)); + std::shared_ptr MainVariables2(new l1t::CPPFDigi(rpcId, Bx , int_phi, int_theta, isValid, lb, halfchannel, EMTFsector2, EMTFLink2, firststrip, clustersize, global_phi, global_theta)); + if(int_theta == 31) continue; + if ((EMTFsector1 > 0) && (EMTFsector2 == 0)){ + cppfDigis.push_back(*MainVariables1.get()); + } + if ((EMTFsector1 > 0) && (EMTFsector2 > 0)){ + cppfDigis.push_back(*MainVariables1.get()); + cppfDigis.push_back(*MainVariables2.get()); + } + if ((EMTFsector1 == 0) && (EMTFsector2 == 0)){ + continue; + } + } // No barrel rechits + + } // End loop: for (RPCRecHitCollection::const_iterator recHit = recHitCollection.first; recHit != recHitCollection.second; recHit++) + + } // End loop: for (std::vector::const_iterator r = rolls.begin(); r != rolls.end(); ++r) + } // End loop: for (TrackingGeometry::DetContainer::const_iterator iDet = rpcGeom->dets().begin(); iDet < rpcGeom->dets().end(); iDet++) +} // End function: void RecHitProcessor::process() + + + + + diff --git a/L1Trigger/L1TMuonCPPF/test/cppf_emulator_MC.py b/L1Trigger/L1TMuonCPPF/test/cppf_emulator_MC.py new file mode 100644 index 0000000000000..788e08784fd52 --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/test/cppf_emulator_MC.py @@ -0,0 +1,137 @@ +# Auto generated configuration file +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: SingleMuPt10_pythia8_cfi.py -s GEN,SIM,DIGI --pileup=NoPileUp --geometry DB --conditions=auto:run1_mc --eventcontent FEVTDEBUGHLT --no_exec -n 30 +import FWCore.ParameterSet.Config as cms +import datetime +import random + +process = cms.Process('DIGI') + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +#process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +#process.load('Configuration.Geometry.GeometryDB_cff') +#process.load('Configuration.StandardSequences.GeometryExtended_cff') +process.load('Configuration.Geometry.GeometryExtended2016_cff') +process.load('Configuration.Geometry.GeometryExtended2016Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.Digi_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.load('RecoLocalMuon.RPCRecHit.rpcRecHits_cfi') +from RecoLocalMuon.RPCRecHit.rpcRecHits_cfi import * + +process.load('L1Trigger.L1TMuonCPPF.emulatorCppfDigis_cfi') +from L1Trigger.L1TMuonCPPF.emulatorCppfDigis_cfi import * + +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1) +process.MessageLogger = cms.Service("MessageLogger") +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(300) + ) + + +# Input source +process.source = cms.Source("EmptySource" + ) +process.options = cms.untracked.PSet( + ) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('SingleMuPt10_pythia8_cfi.py nevts:100'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') + ) + +# Output definition + +process.FEVTDEBUGHLToutput = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string(''), + filterName = cms.untracked.string('') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(10485760), + fileName = cms.untracked.string('SingleMuPt10_pythia8_cfi_py_GEN_SIM_DIGI.root'), + outputCommands = cms.untracked.vstring('drop *',"keep *_emulatorMuonRPCDigis_*_*", "keep *_emulatorCppfDigis_*_*", + "keep *_rpcRecHits_*_*", "keep *_genParticles_*_*"), + #outputCommands = process.FEVTDEBUGHLTEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) + ) + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '') + + +from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper +randHelper = RandomNumberServiceHelper(process.RandomNumberGeneratorService) +randHelper.populate() + +process.RandomNumberGeneratorService.saveFileName = cms.untracked.string("RandomEngineState.log") + + +process.generator = cms.EDFilter("Pythia8PtGun", + PGunParameters = cms.PSet( + AddAntiParticle = cms.bool(True), + MaxEta = cms.double(1.6), + MaxPhi = cms.double(3.14159265359), + MaxPt = cms.double(30.1), + MinEta = cms.double(1.2), + MinPhi = cms.double(-3.14159265359), + MinPt = cms.double(1.1), + ParticleID = cms.vint32(-13) + ), + PythiaParameters = cms.PSet( + parameterSets = cms.vstring() + ), + Verbosity = cms.untracked.int32(0), + firstRun = cms.untracked.uint32(1), + psethack = cms.string('single mu pt 10') + ) + +process.rpcRecHits.rpcDigiLabel = 'simMuonRPCDigis' +process.emulatorCppfDigis.recHitLabel = 'rpcRecHits' + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.digitisation_step = cms.Path(process.pdigi) +process.rpcrechits_step = cms.Path(process.rpcRecHits) +process.emulatorCppfDigis_step = cms.Path(process.emulatorCppfDigis) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.FEVTDEBUGHLToutput_step = cms.EndPath(process.FEVTDEBUGHLToutput) + + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.digitisation_step,process.rpcrechits_step,process.emulatorCppfDigis_step,process.endjob_step,process.FEVTDEBUGHLToutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path)._seq = process.generator * getattr(process,path)._seq + + + # Customisation from command line + # Add early deletion of temporary data products to reduce peak memory need + from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete + process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/L1Trigger/L1TMuonCPPF/test/cppf_emulator_RAW.py b/L1Trigger/L1TMuonCPPF/test/cppf_emulator_RAW.py new file mode 100644 index 0000000000000..3a0ca2684727b --- /dev/null +++ b/L1Trigger/L1TMuonCPPF/test/cppf_emulator_RAW.py @@ -0,0 +1,99 @@ + +import FWCore.ParameterSet.Config as cms +import datetime +import random + +process = cms.Process('DIGI') + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +#process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +#process.load('Configuration.Geometry.GeometryDB_cff') +#process.load('Configuration.StandardSequences.GeometryExtended_cff') +process.load('Configuration.Geometry.GeometryExtended2016_cff') +process.load('Configuration.Geometry.GeometryExtended2016Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_38T_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.Digi_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.load("EventFilter.RPCRawToDigi.rpcUnpacker_cfi") +import EventFilter.RPCRawToDigi.rpcUnpacker_cfi +muonRPCDigis = EventFilter.RPCRawToDigi.rpcUnpacker_cfi.rpcunpacker.clone() +muonRPCDigis.InputLabel = 'rawDataCollector' + +process.load('RecoLocalMuon.RPCRecHit.rpcRecHits_cfi') +from RecoLocalMuon.RPCRecHit.rpcRecHits_cfi import * + +process.load('L1Trigger.L1TMuonCPPF.emulatorCppfDigis_cfi') +from L1Trigger.L1TMuonCPPF.emulatorCppfDigis_cfi import * + +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1) +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + + +# Input source +process.source = cms.Source( + 'PoolSource',fileNames = cms.untracked.vstring ('/store/data/Run2017F/SingleMuon/RAW/v1/000/306/125/00000/4EDD5765-B3C0-E711-B906-02163E01A2D5.root') + ) + +process.options = cms.untracked.PSet( + ) + +process.treeOut = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string('test_cppf_emulator.root'), + outputCommands = cms.untracked.vstring('drop *', + "keep *_rpcunpacker_*_*", + "keep *_emulatorCppfDigis_*_*", + "keep *_rpcRecHits_*_*" + #"keep *" + ) + ) + + +# Additional output definition + +# Other statements + +# process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '') + + +process.rpcunpacker.InputLabel = 'rawDataCollector' +process.rpcRecHits.rpcDigiLabel = 'rpcunpacker' +process.emulatorCppfDigis.recHitLabel = 'rpcRecHits' + +# Path and EndPath definitions +process.path_step = cms.Path(process.rpcunpacker) +process.rpcrechits_step = cms.Path(process.rpcRecHits) +process.emulatorCppfDigis_step = cms.Path(process.emulatorCppfDigis) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.treeOut_step = cms.EndPath(process.treeOut) + + + +# Schedule definition +process.schedule = cms.Schedule( + process.path_step, + process.rpcrechits_step, + process.emulatorCppfDigis_step, + process.endjob_step, + process.treeOut_step ) + +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) + +# Customisation from command line +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/L1Trigger/L1TMuonEndCap/interface/Common.h b/L1Trigger/L1TMuonEndCap/interface/Common.h index daddb852dfac5..8bd95ecc70330 100644 --- a/L1Trigger/L1TMuonEndCap/interface/Common.h +++ b/L1Trigger/L1TMuonEndCap/interface/Common.h @@ -9,6 +9,9 @@ #include "L1Trigger/L1TMuon/interface/MuonTriggerPrimitive.h" #include "L1Trigger/L1TMuon/interface/MuonTriggerPrimitiveFwd.h" +#include "L1Trigger/L1TMuon/interface/TTGeometryTranslator.h" +#include "L1Trigger/L1TMuon/interface/TTMuonTriggerPrimitive.h" + #include "L1Trigger/L1TMuonEndCap/interface/EMTFSubsystemTag.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -29,38 +32,43 @@ typedef L1TMuon::GeometryTranslator GeometryTranslator; typedef L1TMuon::TriggerPrimitive TriggerPrimitive; typedef L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection; -typedef TriggerPrimitive::CSCData CSCData; -typedef TriggerPrimitive::RPCData RPCData; -typedef TriggerPrimitive::GEMData GEMData; +typedef L1TMuon::TTGeometryTranslator TTGeometryTranslator; +typedef L1TMuon::TTTriggerPrimitive TTTriggerPrimitive; +typedef L1TMuon::TTTriggerPrimitiveCollection TTTriggerPrimitiveCollection; + +typedef TriggerPrimitive::CSCData CSCData; +typedef TriggerPrimitive::RPCData RPCData; +typedef TriggerPrimitive::GEMData GEMData; +typedef TTTriggerPrimitive::TTData TTData; -typedef emtf::CSCTag CSCTag; -typedef emtf::RPCTag RPCTag; -typedef emtf::GEMTag GEMTag; +typedef emtf::CSCTag CSCTag; +typedef emtf::RPCTag RPCTag; +typedef emtf::GEMTag GEMTag; +typedef emtf::IRPCTag IRPCTag; +typedef emtf::ME0Tag ME0Tag; +typedef emtf::TTTag TTTag; namespace emtf { // Constants - // Phase 2 Geometry a.k.a. HL-LHC - constexpr int PHASE_TWO_GEOMETRY = 0; - // from DataFormats/MuonDetId/interface/CSCDetId.h constexpr int MIN_ENDCAP = 1; constexpr int MAX_ENDCAP = 2; - + // from DataFormats/MuonDetId/interface/CSCTriggerNumbering.h constexpr int MIN_TRIGSECTOR = 1; constexpr int MAX_TRIGSECTOR = 6; constexpr int NUM_SECTORS = 12; - + // Zones constexpr int NUM_ZONES = 4; constexpr int NUM_ZONE_HITS = 160; - + // Stations constexpr int NUM_STATIONS = 4; constexpr int NUM_STATION_PAIRS = 6; - + // Fixed-size arrays template using sector_array = std::array; diff --git a/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h b/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h new file mode 100644 index 0000000000000..61cda46ed156c --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h @@ -0,0 +1,44 @@ +#ifndef L1TMuonEndCap_EMTFGEMDetId_h +#define L1TMuonEndCap_EMTFGEMDetId_h + +#include "DataFormats/MuonDetId/interface/GEMDetId.h" +#include "DataFormats/MuonDetId/interface/ME0DetId.h" + +#include +#include + + +class GEMDetId; +class ME0DetId; + +class EMTFGEMDetId { +public: + explicit EMTFGEMDetId(const GEMDetId& id); + explicit EMTFGEMDetId(const ME0DetId& id); + + /// Sort Operator based on the raw detector id + bool operator < (const EMTFGEMDetId& r) const; + + /// The identifiers + int region() const; + int ring() const; // NOTE: use ME0 --> ring 4 convention + int station() const; // NOTE: use ME0 --> station 1 convention + int layer() const; + int chamber() const; + int roll() const; + + bool isME0() const { return isME0_; } + + GEMDetId getGEMDetId() const { return gemDetId_; } + + ME0DetId getME0DetId() const { return me0DetId_; } + +private: + GEMDetId gemDetId_; + ME0DetId me0DetId_; + bool isME0_; +}; + +std::ostream& operator<<( std::ostream& os, const EMTFGEMDetId& id ); + +#endif diff --git a/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetIdImpl.h b/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetIdImpl.h new file mode 100644 index 0000000000000..459686d57ec3e --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetIdImpl.h @@ -0,0 +1,24 @@ +#ifndef L1TMuonEndCap_EMTFGEMDetIdImpl_h +#define L1TMuonEndCap_EMTFGEMDetIdImpl_h + +#include "DataFormats/MuonDetId/interface/GEMDetId.h" +#include "DataFormats/MuonDetId/interface/ME0DetId.h" + +//#include "L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h" + +namespace emtf { + + template + EMTFGEMDetId construct_EMTFGEMDetId(const TriggerPrimitive& tp) { + if (!tp.getGEMData().isME0) { + GEMDetId id(tp.detId()); + return EMTFGEMDetId(id); + } else { + ME0DetId id(tp.detId()); + return EMTFGEMDetId(id); + } + }; + +} // namespace emtf + +#endif diff --git a/L1Trigger/L1TMuonEndCap/interface/EMTFSubsystemTag.h b/L1Trigger/L1TMuonEndCap/interface/EMTFSubsystemTag.h index 1c1f8a9135e6b..cda8a38e8b9af 100644 --- a/L1Trigger/L1TMuonEndCap/interface/EMTFSubsystemTag.h +++ b/L1Trigger/L1TMuonEndCap/interface/EMTFSubsystemTag.h @@ -7,6 +7,9 @@ #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" #include "DataFormats/GEMDigi/interface/GEMPadDigi.h" #include "DataFormats/GEMDigi/interface/GEMPadDigiCollection.h" +#include "DataFormats/GEMDigi/interface/ME0PadDigi.h" +#include "DataFormats/GEMDigi/interface/ME0PadDigiCollection.h" +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" namespace emtf { @@ -26,6 +29,22 @@ namespace emtf { typedef GEMPadDigiCollection digi_collection; }; + struct IRPCTag { + typedef RPCDigi digi_type; + typedef RPCDigiCollection digi_collection; + }; + + struct ME0Tag { + typedef ME0PadDigi digi_type; + typedef ME0PadDigiCollection digi_collection; + }; + + struct TTTag { + typedef Ref_Phase2TrackerDigi_ digi_ref; + typedef TTStub digi_type; + typedef edmNew::DetSetVector digi_collection; + }; + } // namespace emtf #endif diff --git a/L1Trigger/L1TMuonEndCap/interface/EndCapParamsHelper.h b/L1Trigger/L1TMuonEndCap/interface/EndCapParamsHelper.h index 70dfbc5ddfc8f..6f2ad4c01b204 100644 --- a/L1Trigger/L1TMuonEndCap/interface/EndCapParamsHelper.h +++ b/L1Trigger/L1TMuonEndCap/interface/EndCapParamsHelper.h @@ -39,7 +39,7 @@ namespace l1t { class EndCapParamsHelper { public: enum {VERSION = 1}; - + ~EndCapParamsHelper(); //ctor if creating a new table (e.g. from XML or python file) @@ -54,7 +54,7 @@ namespace l1t { // "PhiMatchWindowSt1" arbitrarily re-mapped to Primitive conversion (PC LUT) version // because of rigid CondFormats naming conventions - AWB 02.06.17 void SetPrimConvVersion (unsigned version) {write_->PhiMatchWindowSt1_ = version;} - + unsigned GetPtAssignVersion() const {return read_->PtAssignVersion_;} unsigned GetFirmwareVersion() const {return read_->firmwareVersion_;} unsigned GetPrimConvVersion() const {return read_->PhiMatchWindowSt1_;} @@ -65,14 +65,14 @@ namespace l1t { // access to underlying pointers, mainly for ESProducer: const L1TMuonEndCapParams * getReadInstance() const {return read_;} L1TMuonEndCapParams * getWriteInstance(){return write_; } - + private: EndCapParamsHelper(const L1TMuonEndCapParams * es); void useCopy(); void check_write() { assert(write_); } // separating read from write allows for a high-performance read-only mode (as no copy is made): const L1TMuonEndCapParams * read_; // when reading/getting, use this. - L1TMuonEndCapParams * write_; // when writing/setting, use this. + L1TMuonEndCapParams * write_; // when writing/setting, use this. bool we_own_write_; }; diff --git a/L1Trigger/L1TMuonEndCap/interface/PtAssignmentEngineAux2017.h b/L1Trigger/L1TMuonEndCap/interface/PtAssignmentEngineAux2017.h index f3f1a34c41a65..0c3f5cbb4392f 100644 --- a/L1Trigger/L1TMuonEndCap/interface/PtAssignmentEngineAux2017.h +++ b/L1Trigger/L1TMuonEndCap/interface/PtAssignmentEngineAux2017.h @@ -29,10 +29,10 @@ class PtAssignmentEngineAux2017 { void unpack2bRPC(int rpc_2b, int& rpcA, int& rpcB, int& rpcC) const; int get8bMode15(int theta, int st1_ring2, int endcap, int sPhiAB, - int clctA, int clctB, int clctC, int clctD) const; + int clctA, int clctB, int clctC, int clctD) const; void unpack8bMode15( int mode15_8b, int& theta, int& st1_ring2, int endcap, int sPhiAB, - int& clctA, int& rpcA, int& rpcB, int& rpcC, int& rpcD) const; + int& clctA, int& rpcA, int& rpcB, int& rpcC, int& rpcD) const; // Need to re-check / verify this - AWB 17.03.17 // int getFRLUT(int sector, int station, int chamber) const; diff --git a/L1Trigger/L1TMuonEndCap/interface/PtLutVarCalc.h b/L1Trigger/L1TMuonEndCap/interface/PtLutVarCalc.h index a08548b41f673..75f2898e931fd 100644 --- a/L1Trigger/L1TMuonEndCap/interface/PtLutVarCalc.h +++ b/L1Trigger/L1TMuonEndCap/interface/PtLutVarCalc.h @@ -5,18 +5,18 @@ int CalcTrackTheta( const int th1, const int th2, const int th3, const int th4, const int ring1, const int mode, const bool BIT_COMP=false ); void CalcDeltaPhis( int& dPh12, int& dPh13, int& dPh14, int& dPh23, int& dPh24, int& dPh34, int& dPhSign, - int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int& outStPh, - const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP=false ); + int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int& outStPh, + const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP=false ); void CalcDeltaThetas( int& dTh12, int& dTh13, int& dTh14, int& dTh23, int& dTh24, int& dTh34, - const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP=false ); + const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP=false ); void CalcBends( int& bend1, int& bend2, int& bend3, int& bend4, - const int pat1, const int pat2, const int pat3, const int pat4, - const int dPhSign, const int endcap, const int mode, const bool BIT_COMP=false ); + const int pat1, const int pat2, const int pat3, const int pat4, + const int dPhSign, const int endcap, const int mode, const bool BIT_COMP=false ); -void CalcRPCs( int& RPC1, int& RPC2, int& RPC3, int& RPC4, const int mode, - const int st1_ring2, const int theta, const bool BIT_COMP=false ); +void CalcRPCs( int& RPC1, int& RPC2, int& RPC3, int& RPC4, const int mode, + const int st1_ring2, const int theta, const bool BIT_COMP=false ); int CalcBendFromPattern( const int pattern, const int endcap ); diff --git a/L1Trigger/L1TMuonEndCap/interface/TTPrimitiveConversion.h b/L1Trigger/L1TMuonEndCap/interface/TTPrimitiveConversion.h new file mode 100644 index 0000000000000..60e041ef955ca --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/interface/TTPrimitiveConversion.h @@ -0,0 +1,44 @@ +#ifndef L1TMuonEndCap_TTPrimitiveConversion_h +#define L1TMuonEndCap_TTPrimitiveConversion_h + +#include "L1Trigger/L1TMuonEndCap/interface/Common.h" + + +class SectorProcessorLUT; + +class TTPrimitiveConversion { +public: + void configure( + const TTGeometryTranslator* tp_ttgeom, + const SectorProcessorLUT* lut, + int verbose, int endcap, int sector, int bx + ); + + void process( + const std::map& selected_ttprim_map, + EMTFHitCollection& conv_hits + ) const; + + void process_no_prim_sel( + const TTTriggerPrimitiveCollection& ttmuon_primitives, + EMTFHitCollection& conv_hits + ) const; + + const SectorProcessorLUT& lut() const { return *lut_; } + + // TT functions + void convert_tt( + const TTTriggerPrimitive& ttmuon_primitive, + EMTFHit& conv_hit + ) const; + +private: + const TTGeometryTranslator* tp_ttgeom_; + + const SectorProcessorLUT* lut_; + + int verbose_, endcap_, sector_, bx_; +}; + +#endif + diff --git a/L1Trigger/L1TMuonEndCap/interface/bdt/Event.h b/L1Trigger/L1TMuonEndCap/interface/bdt/Event.h index 5db19022751c6..0490bc2038b5b 100644 --- a/L1Trigger/L1TMuonEndCap/interface/bdt/Event.h +++ b/L1Trigger/L1TMuonEndCap/interface/bdt/Event.h @@ -27,8 +27,8 @@ struct Event int Quality; static int sortingIndex; - int id; - std::vector data; + int id; + std::vector data; bool operator< (const Event &rhs) const { @@ -45,9 +45,9 @@ struct Event std::cout << "x"<< i << "=" << data[i] << ", "; } std::cout << std::endl; - + } - + void resetPredictedValue(){ predictedValue = 0; } }; diff --git a/L1Trigger/L1TMuonEndCap/interface/bdt/Forest.h b/L1Trigger/L1TMuonEndCap/interface/bdt/Forest.h index 06699193caed4..9aaacec0040c9 100644 --- a/L1Trigger/L1TMuonEndCap/interface/bdt/Forest.h +++ b/L1Trigger/L1TMuonEndCap/interface/bdt/Forest.h @@ -31,7 +31,7 @@ class Forest // Get info on variable importance. void rankVariables(std::vector& rank); - + // Output the list of split values used for each variable. void saveSplitValues(const char* savefilename); @@ -39,17 +39,17 @@ class Forest void listEvents(std::vector< std::vector >& e); void sortEventVectors(std::vector< std::vector >& e); void generate(int numTrainEvents, int numTestEvents, double sigma); - void loadForestFromXML(const char* directory, unsigned int numTrees); + void loadForestFromXML(const char* directory, unsigned int numTrees); void loadFromCondPayload(const L1TMuonEndCapForest::DForest& payload); // Perform the regression void updateRegTargets(Tree *tree, double learningRate, LossFunction* l); - void doRegression(int nodeLimit, int treeLimit, double learningRate, LossFunction* l, + void doRegression(int nodeLimit, int treeLimit, double learningRate, LossFunction* l, const char* savetreesdirectory, bool saveTrees); // Stochastic Gradient Boosting void prepareRandomSubsample(double fraction); - void doStochasticRegression(int nodeLimit, int treeLimit, double learningRate, + void doStochasticRegression(int nodeLimit, int treeLimit, double learningRate, double fraction, LossFunction* l); // Predict some events diff --git a/L1Trigger/L1TMuonEndCap/interface/bdt/LossFunctions.h b/L1Trigger/L1TMuonEndCap/interface/bdt/LossFunctions.h index 7e2e852094019..73a57ce2895a7 100644 --- a/L1Trigger/L1TMuonEndCap/interface/bdt/LossFunctions.h +++ b/L1Trigger/L1TMuonEndCap/interface/bdt/LossFunctions.h @@ -1,6 +1,6 @@ // LossFunctions.h // Here we define the different loss functions that can be used -// with the BDT system. +// with the BDT system. #ifndef L1Trigger_L1TMuonEndCap_emtf_LossFunctions #define L1Trigger_L1TMuonEndCap_emtf_LossFunctions @@ -30,7 +30,7 @@ class LossFunction virtual double fit(std::vector& v) = 0; virtual std::string name() = 0; virtual int id() = 0; - virtual ~LossFunction() = default; + virtual ~LossFunction() = default; }; // ======================================================== @@ -59,12 +59,12 @@ class LeastSquares : public LossFunction Event* e = v[i]; SUM += e->trueValue - e->predictedValue; } - + return SUM/v.size(); } std::string name() override { return "Least_Squares"; } int id() override{ return 1; } - + }; // ======================================================== @@ -91,8 +91,8 @@ class AbsoluteDeviation : public LossFunction // The median of the residuals minimizes absolute deviation. if(v.empty()) return 0; std::vector residuals(v.size()); - - // Load the residuals into a vector. + + // Load the residuals into a vector. for(unsigned int i=0; itrueValue - e->predictedValue; - double diff = residual - residual_median; + double diff = residual - residual_median; x += ((diff > 0)?1.0:-1.0)*std::min(quantile, std::abs(diff)); } return (residual_median + x/v.size()); - + } std::string name() override { return "Huber"; } @@ -173,18 +173,18 @@ class Huber : public LossFunction { // Container for the residuals. std::vector residuals(v.size()); - - // Load the residuals into a vector. + + // Load the residuals into a vector. for(unsigned int i=0; itrueValue - e->predictedValue); } - std::sort(residuals.begin(), residuals.end()); + std::sort(residuals.begin(), residuals.end()); unsigned int quantile_location = whichQuantile*(residuals.size()-1); return residuals[quantile_location]; - } + } }; // ======================================================== @@ -198,28 +198,28 @@ class PercentErrorSquared : public LossFunction ~PercentErrorSquared() override{} double target(Event* e) override - { + { // The gradient of the squared percent error. return (e->trueValue - e->predictedValue)/(e->trueValue * e->trueValue); - } + } double fit(std::vector& v) override - { + { // The average of the weighted residuals minimizes the squared percent error. - // Weight(i) = 1/true(i)^2. - + // Weight(i) = 1/true(i)^2. + double SUMtop = 0; double SUMbottom = 0; - + for(unsigned int i=0; itrueValue - e->predictedValue)/(e->trueValue*e->trueValue); + SUMtop += (e->trueValue - e->predictedValue)/(e->trueValue*e->trueValue); SUMbottom += 1/(e->trueValue*e->trueValue); - } - + } + return SUMtop/SUMbottom; - } + } std::string name() override { return "Percent_Error"; } int id() override{ return 4; } }; diff --git a/L1Trigger/L1TMuonEndCap/interface/bdt/Node.h b/L1Trigger/L1TMuonEndCap/interface/bdt/Node.h index 5b6ed208d1ad9..9c21e08a3415e 100644 --- a/L1Trigger/L1TMuonEndCap/interface/bdt/Node.h +++ b/L1Trigger/L1TMuonEndCap/interface/bdt/Node.h @@ -59,7 +59,7 @@ class Node Node* filterEventToDaughter(Event* e); void listEvents(); void theMiracleOfChildBirth(); - + private: Node(const Node &) = delete; Node& operator=(const Node &) = delete; diff --git a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapForestESProducer.cc b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapForestESProducer.cc index 339bafb2ad604..bd4e981611a58 100644 --- a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapForestESProducer.cc +++ b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapForestESProducer.cc @@ -95,10 +95,10 @@ L1TMuonEndCapForestESProducer::produce(const L1TMuonEndCapForestRcd& iRecord) PtAssignmentEngine* pt_assign_engine_; std::unique_ptr pt_assign_engine_2016_; std::unique_ptr pt_assign_engine_2017_; - + pt_assign_engine_2016_.reset(new PtAssignmentEngine2016()); pt_assign_engine_2017_.reset(new PtAssignmentEngine2017()); - + if (ptLUTVersion <= 5) pt_assign_engine_ = pt_assign_engine_2016_.get(); else pt_assign_engine_ = pt_assign_engine_2017_.get(); @@ -125,7 +125,7 @@ L1TMuonEndCapForestESProducer::produce(const L1TMuonEndCapForestRcd& iRecord) // of course, move has no effect here, but I'll keep it in case move constructor will be provided some day pEMTFForest->forest_coll_.push_back( std::move( cond_forest ) ); } - + return pEMTFForest; } diff --git a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapParamsESProducer.cc b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapParamsESProducer.cc index 5a966c44e404e..d8bf7a131e56b 100644 --- a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapParamsESProducer.cc +++ b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapParamsESProducer.cc @@ -22,7 +22,7 @@ class L1TMuonEndCapParamsESProducer : public edm::ESProducer { public: L1TMuonEndCapParamsESProducer(const edm::ParameterSet&); ~L1TMuonEndCapParamsESProducer() override; - + typedef std::shared_ptr ReturnType; ReturnType produce(const L1TMuonEndCapParamsRcd&); @@ -60,7 +60,7 @@ L1TMuonEndCapParamsESProducer::produce(const L1TMuonEndCapParamsRcd& iRecord) using namespace edm::es; auto pEMTFParams = std::make_shared(*data_.getWriteInstance()); return pEMTFParams; - + } // Define this as a plug-in diff --git a/L1Trigger/L1TMuonEndCap/python/customise_Phase2C2.py b/L1Trigger/L1TMuonEndCap/python/customise_Phase2C2.py new file mode 100644 index 0000000000000..51f27e76bd700 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/python/customise_Phase2C2.py @@ -0,0 +1,37 @@ +import FWCore.ParameterSet.Config as cms + +def customise(process): + + # From python/simEmtfDigis_cfi.py + if hasattr(process, 'simEmtfDigis'): + process.simEmtfDigis.spPCParams16.ZoneBoundaries = [0,36,54,96,127] + process.simEmtfDigis.spPCParams16.UseNewZones = True + process.simEmtfDigis.RPCEnable = True + process.simEmtfDigis.GEMEnable = True + process.simEmtfDigis.IRPCEnable = True + process.simEmtfDigis.ME0Enable = True + process.simEmtfDigis.TTEnable = False + process.simEmtfDigis.ME0Input = cms.InputTag('fakeSimMuonME0PadDigis') + process.simEmtfDigis.Era = cms.string('Phase2C2') + process.simEmtfDigis.spPAParams16.PtLUTVersion = cms.int32(7) + + # From python/fakeEmtfParams_cff.py + if hasattr(process, 'emtfParams'): + process.emtfParams.PtAssignVersion = cms.int32(7) + + if hasattr(process, 'emtfForestsDB'): + process.emtfForestsDB = cms.ESSource( + "EmptyESSource", + recordName = cms.string('L1TMuonEndCapForestRcd'), + iovIsRunNotTime = cms.bool(True), + firstValid = cms.vuint32(1) + ) + + process.emtfForests = cms.ESProducer( + "L1TMuonEndCapForestESProducer", + PtAssignVersion = cms.int32(7), + bdtXMLDir = cms.string("2017_v7") + ) + + return process + diff --git a/L1Trigger/L1TMuonEndCap/python/fakeEmtfParams_cff.py b/L1Trigger/L1TMuonEndCap/python/fakeEmtfParams_cff.py index a663c6a3a407f..f349816d5feb0 100644 --- a/L1Trigger/L1TMuonEndCap/python/fakeEmtfParams_cff.py +++ b/L1Trigger/L1TMuonEndCap/python/fakeEmtfParams_cff.py @@ -37,23 +37,23 @@ firstValid = cms.vuint32(1) ) -emtfForestsDB = cms.ESSource( - "PoolDBESSource", - CondDB, - toGet = cms.VPSet( - cms.PSet( - ## https://cms-conddb.cern.ch/cmsDbBrowser/search/Prod/L1TMuonEndCapForest - record = cms.string("L1TMuonEndCapForestRcd"), - - # ## v5 EMTF pT LUTs from ~August 2016 - # tag = cms.string("L1TMuonEndCapForest_static_2016_mc") - # ## v6 EMTF pT LUTs from May 24, 2017 - # tag = cms.string("L1TMuonEndCapForest_static_Sq_20170523_mc") - ## v7 EMTF pT LUTs from June 7, 2017 - AWB 07.06.17 - tag = cms.string("L1TMuonEndCapForest_static_Sq_20170613_v7_mc") - ) - ) - ) +#emtfForestsDB = cms.ESSource( +# "PoolDBESSource", +# CondDB, +# toGet = cms.VPSet( +# cms.PSet( +# ## https://cms-conddb.cern.ch/cmsDbBrowser/search/Prod/L1TMuonEndCapForest +# record = cms.string("L1TMuonEndCapForestRcd"), +# +# # ## v5 EMTF pT LUTs from ~August 2016 +# # tag = cms.string("L1TMuonEndCapForest_static_2016_mc") +# # ## v6 EMTF pT LUTs from May 24, 2017 +# # tag = cms.string("L1TMuonEndCapForest_static_Sq_20170523_mc") +# ## v7 EMTF pT LUTs from June 7, 2017 - AWB 07.06.17 +# tag = cms.string("L1TMuonEndCapForest_static_Sq_20170613_v7_mc") +# ) +# ) +# ) # ## EMTF ESProducer. Fills CondFormats from local XML files instead of database. # emtfForests = cms.ESProducer( diff --git a/L1Trigger/L1TMuonEndCap/python/simEmtfDigis_cfi.py b/L1Trigger/L1TMuonEndCap/python/simEmtfDigis_cfi.py index 3236bfbdf0391..acc5c1eda02a6 100644 --- a/L1Trigger/L1TMuonEndCap/python/simEmtfDigis_cfi.py +++ b/L1Trigger/L1TMuonEndCap/python/simEmtfDigis_cfi.py @@ -28,7 +28,7 @@ BXWindow = cms.int32(3), # CSC LCT BX offset correction - CSCInputBXShift = cms.int32(-6), + CSCInputBXShift = cms.int32(-8), RPCInputBXShift = cms.int32(0), GEMInputBXShift = cms.int32(0), diff --git a/L1Trigger/L1TMuonEndCap/src/AngleCalculation.cc b/L1Trigger/L1TMuonEndCap/src/AngleCalculation.cc index 5071f76f2ed67..a6a75944c6f26 100644 --- a/L1Trigger/L1TMuonEndCap/src/AngleCalculation.cc +++ b/L1Trigger/L1TMuonEndCap/src/AngleCalculation.cc @@ -339,7 +339,7 @@ void AngleCalculation::calculate_angles(EMTFTrack& track) const { // if (subsystem == TriggerPrimitive::kRPC) // return (station == 2); - // In EMTF firmware, RPC hits are treated as if they came from the corresponding + // In EMTF firmware, RPC hits are treated as if they came from the corresponding // CSC chamber, so the FR bit assignment is the same as for CSCs - AWB 06.06.17 // GEMs are in front of the CSCs @@ -372,7 +372,7 @@ void AngleCalculation::calculate_angles(EMTFTrack& track) const { const auto& v = st_conv_hits.at(i); ptlut_data.cpattern[i] = v.empty() ? 0 : v.front().Pattern(); // Automatically set to 0 for RPCs ptlut_data.fr[i] = v.empty() ? 0 : isFront(v.front().Station(), v.front().Ring(), v.front().Chamber(), v.front().Subsystem()); - if (i == 0) + if (i == 0) ptlut_data.st1_ring2 = v.empty() ? 0 : (v.front().Station() == 1 && (v.front().Ring() == 2 || v.front().Ring() == 3)); } diff --git a/L1Trigger/L1TMuonEndCap/src/BestTrackSelection.cc b/L1Trigger/L1TMuonEndCap/src/BestTrackSelection.cc index 4cdf183a973c3..112405f3dee05 100644 --- a/L1Trigger/L1TMuonEndCap/src/BestTrackSelection.cc +++ b/L1Trigger/L1TMuonEndCap/src/BestTrackSelection.cc @@ -72,7 +72,7 @@ void BestTrackSelection::cancel_one_bx( const std::deque& extended_best_track_cands, EMTFTrackCollection& best_tracks ) const { - const int max_z = emtf::NUM_ZONES; // = 4 zones + const int max_z = emtf::NUM_ZONES; // = 4 zones const int max_n = maxRoadsPerZone_; // = 3 candidates per zone const int max_zn = max_z * max_n; // = 12 total candidates if (not (maxTracks_ <= max_zn)) @@ -259,7 +259,7 @@ void BestTrackSelection::cancel_multi_bx( EMTFTrackCollection& best_tracks ) const { const int max_h = bxWindow_; // = 3 bx history - const int max_z = emtf::NUM_ZONES; // = 4 zones + const int max_z = emtf::NUM_ZONES; // = 4 zones const int max_n = maxRoadsPerZone_; // = 3 candidates per zone const int max_zn = max_z * max_n; // = 12 total candidates const int max_hzn = max_h * max_zn; // = 36 total candidates diff --git a/L1Trigger/L1TMuonEndCap/src/EMTFGEMDetId.cc b/L1Trigger/L1TMuonEndCap/src/EMTFGEMDetId.cc new file mode 100644 index 0000000000000..16352ccfaf256 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/src/EMTFGEMDetId.cc @@ -0,0 +1,82 @@ +#include "L1Trigger/L1TMuonEndCap/interface/EMTFGEMDetId.h" + + +EMTFGEMDetId::EMTFGEMDetId(const GEMDetId& id) : + gemDetId_(id), + me0DetId_(), + isME0_(false) +{ + +} + +EMTFGEMDetId::EMTFGEMDetId(const ME0DetId& id) : + gemDetId_(), + me0DetId_(id), + isME0_(true) +{ + +} + +/// Sort Operator based on the raw detector id +bool EMTFGEMDetId::operator < (const EMTFGEMDetId& r) const { + if (!isME0() && !r.isME0()) { + return getGEMDetId() < r.getGEMDetId(); // compare GEM with GEM + } else if (r.isME0() && r.isME0()) { + return getME0DetId() < r.getME0DetId(); // compare ME0 with ME0 + } else { + return !r.isME0(); // compare GEM with ME0 + } +} + +/// The identifiers +int EMTFGEMDetId::region() const { + if (!isME0()) + return getGEMDetId().region(); + else + return getME0DetId().region(); +} + +int EMTFGEMDetId::ring() const { + if (!isME0()) + return getGEMDetId().ring(); + else + //return getME0DetId().ring(); + return 4; // NOTE: use ME0 --> ring 4 convention +} + +int EMTFGEMDetId::station() const { + if (!isME0()) + return getGEMDetId().station(); + else + //return getME0DetId().station(); + return 1; // use ME0 --> station 1 convention +} + +int EMTFGEMDetId::layer() const { + if (!isME0()) + return getGEMDetId().layer(); + else + return getME0DetId().layer(); +} + +int EMTFGEMDetId::chamber() const { + if (!isME0()) + return getGEMDetId().chamber(); + else + return getME0DetId().chamber(); +} + +int EMTFGEMDetId::roll() const { + if (!isME0()) + return getGEMDetId().roll(); + else + return getME0DetId().roll(); +} + +std::ostream& operator<<( std::ostream& os, const EMTFGEMDetId& id ) { + if (!id.isME0()) + os << id.getGEMDetId(); + else + os << id.getME0DetId(); + return os; +} diff --git a/L1Trigger/L1TMuonEndCap/src/EndCapParamsHelper.cc b/L1Trigger/L1TMuonEndCap/src/EndCapParamsHelper.cc index ca0231d98074f..710cdcf834f6d 100644 --- a/L1Trigger/L1TMuonEndCap/src/EndCapParamsHelper.cc +++ b/L1Trigger/L1TMuonEndCap/src/EndCapParamsHelper.cc @@ -16,11 +16,11 @@ EndCapParamsHelper * EndCapParamsHelper::readAndWriteFromEventSetup(const L1TMu } EndCapParamsHelper::EndCapParamsHelper(L1TMuonEndCapParams * w) { - write_ = w; - check_write(); + write_ = w; + check_write(); we_own_write_ = false; - //write_->m_version = VERSION; - read_ = write_; + //write_->m_version = VERSION; + read_ = write_; } EndCapParamsHelper::EndCapParamsHelper(const L1TMuonEndCapParams * es) {read_ = es; write_=nullptr;} diff --git a/L1Trigger/L1TMuonEndCap/src/MicroGMTConverter.cc b/L1Trigger/L1TMuonEndCap/src/MicroGMTConverter.cc index 110e907d205df..b503113ca7af3 100644 --- a/L1Trigger/L1TMuonEndCap/src/MicroGMTConverter.cc +++ b/L1Trigger/L1TMuonEndCap/src/MicroGMTConverter.cc @@ -109,7 +109,7 @@ void MicroGMTConverter::convert_all( // Sort by processor to match uGMT unpacked order emtf::sort_uGMT_muons(out_cands); - + } @@ -118,12 +118,12 @@ namespace emtf { void sort_uGMT_muons( l1t::RegionalMuonCandBxCollection& cands ) { - + int minBX = cands.getFirstBX(); int maxBX = cands.getLastBX(); int emtfMinProc = 0; // ME+ sector 1 int emtfMaxProc = 11; // ME- sector 6 - + // New collection, sorted by processor to match uGMT unpacked order auto sortedCands = std::make_unique(); sortedCands->clear(); @@ -131,14 +131,14 @@ void sort_uGMT_muons( for (int iBX = minBX; iBX <= maxBX; ++iBX) { for (int proc = emtfMinProc; proc <= emtfMaxProc; proc++) { for (l1t::RegionalMuonCandBxCollection::const_iterator cand = cands.begin(iBX); cand != cands.end(iBX); ++cand) { - int cand_proc = cand->processor(); - if (cand->trackFinderType() == l1t::tftype::emtf_neg) cand_proc += 6; - if (cand_proc != proc) continue; - sortedCands->push_back(iBX, *cand); + int cand_proc = cand->processor(); + if (cand->trackFinderType() == l1t::tftype::emtf_neg) cand_proc += 6; + if (cand_proc != proc) continue; + sortedCands->push_back(iBX, *cand); } } } - + // Return sorted collection std::swap(cands, *sortedCands); sortedCands.reset(); diff --git a/L1Trigger/L1TMuonEndCap/src/PrimitiveConversion.cc b/L1Trigger/L1TMuonEndCap/src/PrimitiveConversion.cc index cf7f41cdf57ec..0174b9e2a567f 100644 --- a/L1Trigger/L1TMuonEndCap/src/PrimitiveConversion.cc +++ b/L1Trigger/L1TMuonEndCap/src/PrimitiveConversion.cc @@ -446,7 +446,7 @@ void PrimitiveConversion::convert_rpc( int tp_station = tp_detId.station(); // 1 - 4 int tp_ring = tp_detId.ring(); // 2 - 3 (increasing theta) int tp_roll = tp_detId.roll(); // 1 - 3 (decreasing theta; aka A - C; space between rolls is 9 - 15 in theta_fp) - // int tp_layer = tp_detId.layer(); + //int tp_layer = tp_detId.layer(); int tp_bx = tp_data.bx; int tp_strip = ((tp_data.strip_low + tp_data.strip_hi) / 2); // in full-strip unit @@ -533,8 +533,8 @@ void PrimitiveConversion::convert_rpc_details(EMTFHit& conv_hit) const { const int pc_chamber = conv_hit.PC_chamber(); const int pc_segment = conv_hit.PC_segment(); - // const int fw_endcap = (endcap_-1); - // const int fw_sector = (sector_-1); + //const int fw_endcap = (endcap_-1); + //const int fw_sector = (sector_-1); const int fw_station = (conv_hit.Station() == 1) ? (is_neighbor ? 0 : pc_station) : conv_hit.Station(); int fw_cscid = pc_chamber; @@ -613,7 +613,7 @@ void PrimitiveConversion::convert_gem( int tp_station = tp_detId.station(); int tp_ring = tp_detId.ring(); int tp_roll = tp_detId.roll(); - // int tp_layer = tp_detId.layer(); + //int tp_layer = tp_detId.layer(); int tp_chamber = tp_detId.chamber(); int tp_bx = tp_data.bx; diff --git a/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc b/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc index b5225d5565a9f..85fe5e5154c85 100644 --- a/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc +++ b/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc @@ -74,23 +74,23 @@ void PrimitiveSelection::process( if (selected_csc >= 0) { if (not(selected_csc < NUM_CSC_CHAMBERS)) - { edm::LogError("L1T") << "selected_csc = " << selected_csc << ", NUM_CSC_CHAMBERS = " << NUM_CSC_CHAMBERS; return; } - + { edm::LogError("L1T") << "selected_csc = " << selected_csc << ", NUM_CSC_CHAMBERS = " << NUM_CSC_CHAMBERS; return; } + if (selected_csc_map[selected_csc].size() < 2) { - selected_csc_map[selected_csc].push_back(new_tp); + selected_csc_map[selected_csc].push_back(new_tp); } else { - edm::LogWarning("L1T") << "\n******************* EMTF EMULATOR: SUPER-BIZZARE CASE *******************"; - edm::LogWarning("L1T") << "Found 3 CSC trigger primitives in the same chamber"; - for (int ii = 0; ii < 3; ii++) { - TriggerPrimitive tp_err = (ii < 2 ? selected_csc_map[selected_csc].at(ii) : new_tp); - edm::LogWarning("L1T") << "LCT #" << ii+1 << ": BX " << tp_err.getBX() - << ", endcap " << tp_err.detId().endcap() << ", sector " << tp_err.detId().triggerSector() - << ", station " << tp_err.detId().station() << ", ring " << tp_err.detId().ring() - << ", chamber " << tp_err.detId().chamber() << ", CSC ID " << tp_err.getCSCData().cscID - << ": strip " << tp_err.getStrip() << ", wire " << tp_err.getWire(); - } - edm::LogWarning("L1T") << "************************* ONLY KEEP FIRST TWO *************************\n\n"; + edm::LogWarning("L1T") << "\n******************* EMTF EMULATOR: SUPER-BIZZARE CASE *******************"; + edm::LogWarning("L1T") << "Found 3 CSC trigger primitives in the same chamber"; + for (int ii = 0; ii < 3; ii++) { + TriggerPrimitive tp_err = (ii < 2 ? selected_csc_map[selected_csc].at(ii) : new_tp); + edm::LogWarning("L1T") << "LCT #" << ii+1 << ": BX " << tp_err.getBX() + << ", endcap " << tp_err.detId().endcap() << ", sector " << tp_err.detId().triggerSector() + << ", station " << tp_err.detId().station() << ", ring " << tp_err.detId().ring() + << ", chamber " << tp_err.detId().chamber() << ", CSC ID " << tp_err.getCSCData().cscID + << ": strip " << tp_err.getStrip() << ", wire " << tp_err.getWire(); + } + edm::LogWarning("L1T") << "************************* ONLY KEEP FIRST TWO *************************\n\n"; } } // End conditional: if (selected_csc >= 0) diff --git a/L1Trigger/L1TMuonEndCap/src/PtAssignment.cc b/L1Trigger/L1TMuonEndCap/src/PtAssignment.cc index 53a8cf9210fcc..9fe342b5769b3 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtAssignment.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtAssignment.cc @@ -73,9 +73,9 @@ void PtAssignment::process( // Check address packing / unpacking if (not( fabs(xmlpt - pt_assign_engine_->calculate_pt(track)) < 0.001 ) ) - { edm::LogWarning("L1T") << "EMTF pT assignment mismatch: xmlpt = " << xmlpt - << ", pt_assign_engine_->calculate_pt(track)) = " - << pt_assign_engine_->calculate_pt(track); } + { edm::LogWarning("L1T") << "EMTF pT assignment mismatch: xmlpt = " << xmlpt + << ", pt_assign_engine_->calculate_pt(track)) = " + << pt_assign_engine_->calculate_pt(track); } pt = (xmlpt < 0.) ? 1. : xmlpt; // Matt used fabs(-1) when mode is invalid pt *= pt_assign_engine_->scale_pt(pt, track.Mode()); // Multiply by some factor to achieve 90% efficiency at threshold diff --git a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine.cc b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine.cc index 66899b5b0e0b5..484e7d856de16 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine.cc @@ -49,13 +49,13 @@ void PtAssignmentEngine::load(const L1TMuonEndCapForest *payload) { for (unsigned i = 0; i < allowedModes_.size(); ++i) { int mode = allowedModes_.at(i); - + L1TMuonEndCapForest::DForestMap::const_iterator index = payload->forest_map_.find(mode); // associates mode to index if (index == payload->forest_map_.end()) continue; - + forests_.at(mode).loadFromCondPayload(payload->forest_coll_[index->second]); - - double boostWeight_ = payload->forest_map_.find(mode+16)->second / 1000000.; + + double boostWeight_ = payload->forest_map_.find(mode+16)->second / 1000000.; // std::cout << "Loaded forest for mode " << mode << " with boostWeight_ = " << boostWeight_ << std::endl; // std::cout << " * ptLUTVersion_ = " << ptLUTVersion_ << std::endl; forests_.at(mode).getTree(0)->setBoostWeight( boostWeight_ ); diff --git a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2016.cc b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2016.cc index edb68c87c3887..fe16715dafa68 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2016.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2016.cc @@ -705,4 +705,4 @@ float PtAssignmentEngine2016::calculate_pt_xml(const EMTFTrack& track) const { float pt = 0.; return pt; -} +} diff --git a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2017.cc b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2017.cc index 57d49108194bf..983d60ea1d279 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2017.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngine2017.cc @@ -21,7 +21,7 @@ float PtAssignmentEngine2017::scale_pt(const float pt, const int mode) const { // Scaling to achieve 90% efficency at any given L1 pT threshold // For now, a linear scaling based on SingleMu-quality (modes 11, 13, 14, 15), CSC+RPC tracks // Should maybe scale each mode differently in the future - AWB 31.05.17 - + // TRG = (1.2 + 0.015*TRG) * XML // TRG = 1.2*XML / (1 - 0.015*XML) // TRG / XML = 1.2 / (1 - 0.015*XML) @@ -55,7 +55,7 @@ PtAssignmentEngine::address_t PtAssignmentEngine2017::calculate_address(const EM address_t address = 0; EMTFPtLUT data = track.PtLUT(); - + int mode = track.Mode(); int theta = track.Theta_fp(); int endcap = track.Endcap(); @@ -88,7 +88,7 @@ PtAssignmentEngine::address_t PtAssignmentEngine2017::calculate_address(const EM iBC = (iB >= 0 && iC >= 0) ? iB + iC : -1; iCD = (iC >= 0 && iD >= 0) ? 5 : -1; - + // Fill variable info from pT LUT data int st1_ring2, dTheta; int dPhiAB, dPhiBC, dPhiCD; @@ -156,7 +156,7 @@ PtAssignmentEngine::address_t PtAssignmentEngine2017::calculate_address(const EM theta = aux().getTheta ( theta, st1_ring2, 5 ); } - + // Form the pT LUT address if (nHits == 4) { address |= (dPhiAB & ((1<<7)-1)) << (0); @@ -178,8 +178,8 @@ PtAssignmentEngine::address_t PtAssignmentEngine2017::calculate_address(const EM address |= (dTheta & ((1<<3)-1)) << (0+7+5+1); address |= (frA & ((1<<1)-1)) << (0+7+5+1+3); int bit = 0; - if (mode != 7) { - address |= (frB & ((1<<1)-1)) << (0+7+5+1+3+1); bit = 1; + if (mode != 7) { + address |= (frB & ((1<<1)-1)) << (0+7+5+1+3+1); bit = 1; } address |= (clctA & ((1<<2)-1)) << (0+7+5+1+3+1+bit); address |= (rpc_2b & ((1<<2)-1)) << (0+7+5+1+3+1+bit+2); @@ -193,8 +193,8 @@ PtAssignmentEngine::address_t PtAssignmentEngine2017::calculate_address(const EM if (not(address < pow(2, 27) && address >= pow(2, 26))) { edm::LogError("L1T") << "address = " << address; return 0; } } - } - else if (nHits == 2) { + } + else if (nHits == 2) { address |= (dPhiAB & ((1<<7)-1)) << (0); address |= (dTheta & ((1<<3)-1)) << (0+7); address |= (frA & ((1<<1)-1)) << (0+7+3); @@ -228,10 +228,10 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { { edm::LogError("L1T") << "address = " << address; return 0; } if (address >= pow(2, 29)) { nHits = 4; mode = 15; } else if (address >= pow(2, 27)) { nHits = 3; } - else if (address >= pow(2, 26)) { nHits = 3; mode = 7; } + else if (address >= pow(2, 26)) { nHits = 3; mode = 7; } else if (address >= pow(2, 24)) { nHits = 2; } else return pt_xml; - + // Variables to unpack from the pT LUT address int mode_ID, theta, dTheta; int dPhiAB, dPhiBC = -1, dPhiCD = -1; @@ -242,33 +242,33 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { int endcap = 1; sPhiAB = 1; // Assume positive endcap and dPhiAB for unpacking CLCT bend int mode15_8b = -1; // Combines track theta, stations with RPC hits, and station 1 bend information int rpc_2b = -1; // Identifies which stations have RPC hits in 3-station tracks - - + + // Unpack variable words from the pT LUT address if (nHits == 4) { - dPhiAB = (address >> (0) & ((1<<7)-1)); - dPhiBC = (address >> (0+7) & ((1<<5)-1)); - dPhiCD = (address >> (0+7+5) & ((1<<4)-1)); + dPhiAB = (address >> (0) & ((1<<7)-1)); + dPhiBC = (address >> (0+7) & ((1<<5)-1)); + dPhiCD = (address >> (0+7+5) & ((1<<4)-1)); sPhiBC = (address >> (0+7+5+4) & ((1<<1)-1)); sPhiCD = (address >> (0+7+5+4+1) & ((1<<1)-1)); dTheta = (address >> (0+7+5+4+1+1) & ((1<<2)-1)); - frA = (address >> (0+7+5+4+1+1+2) & ((1<<1)-1)); + frA = (address >> (0+7+5+4+1+1+2) & ((1<<1)-1)); mode15_8b = (address >> (0+7+5+4+1+1+2+1) & ((1<<8)-1)); mode_ID = (address >> (0+7+5+4+1+1+2+1+8) & ((1<<1)-1)); if (not(address < pow(2, 30))) { edm::LogError("L1T") << "address = " << address; return 0; } } else if (nHits == 3) { - dPhiAB = (address >> (0) & ((1<<7)-1)); - dPhiBC = (address >> (0+7) & ((1<<5)-1)); - sPhiBC = (address >> (0+7+5) & ((1<<1)-1)); - dTheta = (address >> (0+7+5+1) & ((1<<3)-1)); + dPhiAB = (address >> (0) & ((1<<7)-1)); + dPhiBC = (address >> (0+7) & ((1<<5)-1)); + sPhiBC = (address >> (0+7+5) & ((1<<1)-1)); + dTheta = (address >> (0+7+5+1) & ((1<<3)-1)); frA = (address >> (0+7+5+1+3) & ((1<<1)-1)); int bit = 0; - if (mode != 7) { + if (mode != 7) { frB = (address >> (0+7+5+1+3+1) & ((1<<1)-1)); bit = 1; } - clctA = (address >> (0+7+5+1+3+1+bit) & ((1<<2)-1)); + clctA = (address >> (0+7+5+1+3+1+bit) & ((1<<2)-1)); rpc_2b = (address >> (0+7+5+1+3+1+bit+2) & ((1<<2)-1)); theta = (address >> (0+7+5+1+3+1+bit+2+2) & ((1<<5)-1)); if (mode != 7) { @@ -281,12 +281,12 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { { edm::LogError("L1T") << "address = " << address; return 0; } } } - else if (nHits == 2) { + else if (nHits == 2) { dPhiAB = (address >> (0) & ((1<<7)-1)); - dTheta = (address >> (0+7) & ((1<<3)-1)); - frA = (address >> (0+7+3) & ((1<<1)-1)); - frB = (address >> (0+7+3+1) & ((1<<1)-1)); - clctA = (address >> (0+7+3+1+1) & ((1<<3)-1)); + dTheta = (address >> (0+7) & ((1<<3)-1)); + frA = (address >> (0+7+3) & ((1<<1)-1)); + frB = (address >> (0+7+3+1) & ((1<<1)-1)); + clctA = (address >> (0+7+3+1+1) & ((1<<3)-1)); clctB = (address >> (0+7+3+1+1+3) & ((1<<3)-1)); theta = (address >> (0+7+3+1+1+3+3) & ((1<<5)-1)); mode_ID = (address >> (0+7+3+1+1+3+3+5) & ((1<<3)-1)); @@ -334,7 +334,7 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { dPhiBC = aux().getdPhiFromBin( dPhiBC, 5, 256 ) * (sPhiBC == 1 ? 1 : -1); St1_ring2 = aux().unpackSt1Ring2( theta, 5 ); aux().unpack2bRPC ( rpc_2b, rpcA, rpcB, rpcC ); - + // // Check bit-wise compression / de-compression // if (not( dTheta == aux().getdTheta( aux().unpackdTheta( dTheta, 3), 3) ); // { edm::LogError("L1T") << " = " << ; return; } @@ -368,39 +368,39 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { // Fill vectors of variables for XMLs // KK: sequence of variables here should exaclty match block produced by TMVA std::vector predictors; - + // Variables for input to XMLs int dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi; // Convert words into variables for XMLs if (nHits == 4) { - predictors = { theta, St1_ring2, dPhiAB, dPhiBC, dPhiCD, dPhiAB + dPhiBC, - dPhiAB + dPhiBC + dPhiCD, dPhiBC + dPhiCD, frA, clctA }; + predictors = { theta, St1_ring2, dPhiAB, dPhiBC, dPhiCD, dPhiAB + dPhiBC, + dPhiAB + dPhiBC + dPhiCD, dPhiBC + dPhiCD, frA, clctA }; CalcDeltaPhiSums( dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, - dPhiAB, dPhiAB + dPhiBC, dPhiAB + dPhiBC + dPhiCD, - dPhiBC, dPhiBC + dPhiCD, dPhiCD ); + dPhiAB, dPhiAB + dPhiBC, dPhiAB + dPhiBC + dPhiCD, + dPhiBC, dPhiBC + dPhiCD, dPhiCD ); int tmp[10] = {dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTheta, rpcA, rpcB, rpcC, rpcD }; predictors.insert( predictors.end(), tmp, tmp+10 ); } else if (nHits == 3) { - if (mode == 14) - predictors = { theta, St1_ring2, dPhiAB, dPhiBC, dPhiAB + dPhiBC, - frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; + if (mode == 14) + predictors = { theta, St1_ring2, dPhiAB, dPhiBC, dPhiAB + dPhiBC, + frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; else if (mode == 13) - predictors = { theta, St1_ring2, dPhiAB, dPhiAB + dPhiBC, dPhiBC, - frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; + predictors = { theta, St1_ring2, dPhiAB, dPhiAB + dPhiBC, dPhiBC, + frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; else if (mode == 11) predictors = { theta, St1_ring2, dPhiBC, dPhiAB, dPhiAB + dPhiBC, - frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; + frA, frB, clctA, dTheta, rpcA, rpcB, rpcC }; else if (mode == 7) - predictors = { theta, dPhiAB, dPhiBC, dPhiAB + dPhiBC, - frA, clctA, dTheta, rpcA, rpcB, rpcC }; + predictors = { theta, dPhiAB, dPhiBC, dPhiAB + dPhiBC, + frA, clctA, dTheta, rpcA, rpcB, rpcC }; } else if (nHits == 2 && mode >= 8) { predictors = { theta, St1_ring2, dPhiAB, frA, frB, clctA, clctB, dTheta, (clctA == 0), (clctB == 0) }; - } + } else if (nHits == 2 && mode < 8) { predictors = { theta, dPhiAB, frA, frB, clctA, clctB, dTheta, (clctA == 0), (clctB == 0) }; } @@ -409,15 +409,15 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { // Retreive pT from XMLs std::vector tree_data(predictors.cbegin(),predictors.cend()); - + auto tree_event = std::make_unique(); tree_event->predictedValue = 0; tree_event->data = tree_data; - + // forests_.at(mode).predictEvent(tree_event.get(), 400); emtf::Forest &forest = const_cast(forests_.at(mode)); forest.predictEvent(tree_event.get(), 400); - + // // Adjust this for different XMLs // float log2_pt = tree_event->predictedValue; // pt_xml = pow(2, fmax(0.0, log2_pt)); // Protect against negative values @@ -429,13 +429,13 @@ float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) const { } // End function: float PtAssignmentEngine2017::calculate_pt_xml(const address_t& address) - + // Calculate XML pT directly from track quantities, without forming an address float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { float pt_xml = 0.; - + EMTFPtLUT data = track.PtLUT(); - + auto contain = [](const std::vector& vec, int elem) { return (std::find(vec.begin(), vec.end(), elem) != vec.end()); }; @@ -452,7 +452,7 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { int st2 = ((mode % 8) >= 4); int st3 = ((mode % 4) >= 2); int st4 = ((mode % 2) == 1); - + // Variables for input to XMLs int dPhi_12, dPhi_13, dPhi_14, dPhi_23, dPhi_24, dPhi_34, dPhiSign; int dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi; @@ -461,11 +461,11 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { int bend_1, bend_2, bend_3, bend_4; int RPC_1, RPC_2, RPC_3, RPC_4; int St1_ring2 = data.st1_ring2; - + int ph1 = -99, ph2 = -99, ph3 = -99, ph4 = -99; int th1 = -99, th2 = -99, th3 = -99, th4 = -99; int pat1 = -99, pat2 = -99, pat3 = -99, pat4 = -99; - + // Compute the original phi and theta coordinates if (st2) { ph2 = phi; // Track phi is from station 2 (if it exists), otherwise 3 or 4 @@ -476,13 +476,13 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { // Important that phi be from adjacent station pairs (see note below) if (st3 && st4) ph4 = ph3 + data.delta_ph[5]*(data.sign_ph[5] ? 1 : -1); else if (st4) ph4 = ph2 + data.delta_ph[4]*(data.sign_ph[4] ? 1 : -1); - // Important that theta be from first-last station pair, not adjacent pairs: delta_th values are "best" for each pair, but + // Important that theta be from first-last station pair, not adjacent pairs: delta_th values are "best" for each pair, but // thanks to duplicated CSC LCTs, are not necessarily consistent (or physical) between pairs or between delta_th and delta_ph. // This is an artifact of the firmware implementation of deltas: see src/AngleCalculation.cc. if (st1 && st3) th3 = th1 + data.delta_th[1]*(data.sign_th[1] ? 1 : -1); else if (st3) th3 = th2 + data.delta_th[3]*(data.sign_th[3] ? 1 : -1); - if (st1 && st4) th4 = th1 + data.delta_th[2]*(data.sign_th[2] ? 1 : -1); - else if (st4) th4 = th2 + data.delta_th[4]*(data.sign_th[4] ? 1 : -1); + if (st1 && st4) th4 = th1 + data.delta_th[2]*(data.sign_th[2] ? 1 : -1); + else if (st4) th4 = th2 + data.delta_th[4]*(data.sign_th[4] ? 1 : -1); } else if (st3) { ph3 = phi; th3 = theta; @@ -506,40 +506,40 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { // BEGIN: Identical (almost) to BDT training code in EMTFPtAssign2017/PtRegression_Apr_2017.C theta = CalcTrackTheta( th1, th2, th3, th4, St1_ring2, mode, true ); - + CalcDeltaPhis( dPhi_12, dPhi_13, dPhi_14, dPhi_23, dPhi_24, dPhi_34, dPhiSign, - dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, - ph1, ph2, ph3, ph4, mode, true ); - + dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, + ph1, ph2, ph3, ph4, mode, true ); + CalcDeltaThetas( dTh_12, dTh_13, dTh_14, dTh_23, dTh_24, dTh_34, - th1, th2, th3, th4, mode, true ); - + th1, th2, th3, th4, mode, true ); + FR_1 = (st1 ? data.fr[0] : -99); FR_2 = (st2 ? data.fr[1] : -99); FR_3 = (st3 ? data.fr[2] : -99); FR_4 = (st4 ? data.fr[3] : -99); - + CalcBends( bend_1, bend_2, bend_3, bend_4, - pat1, pat2, pat3, pat4, - dPhiSign, endcap, mode, true ); - + pat1, pat2, pat3, pat4, + dPhiSign, endcap, mode, true ); + RPC_1 = (st1 ? (pat1 == 0) : -99); RPC_2 = (st2 ? (pat2 == 0) : -99); RPC_3 = (st3 ? (pat3 == 0) : -99); RPC_4 = (st4 ? (pat4 == 0) : -99); CalcRPCs( RPC_1, RPC_2, RPC_3, RPC_4, mode, St1_ring2, theta, true ); - + // END: Identical (almost) to BDT training code in EMTFPtAssign2017/PtRegression_Apr_2017.C - - + + // Fill vectors of variables for XMLs // KK: sequence of variables here should exaclty match block produced by TMVA std::vector predictors; switch (mode) { case 15: // 1-2-3-4 predictors = { theta, St1_ring2, dPhi_12, dPhi_23, dPhi_34, dPhi_13, dPhi_14, dPhi_24, FR_1, bend_1, - dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTh_14, RPC_1, RPC_2, RPC_3, RPC_4 }; + dPhiSum4, dPhiSum4A, dPhiSum3, dPhiSum3A, outStPhi, dTh_14, RPC_1, RPC_2, RPC_3, RPC_4 }; break; case 14: // 1-2-3 predictors = { theta, St1_ring2, dPhi_12, dPhi_23, dPhi_13, FR_1, FR_2, bend_1, dTh_13, RPC_1, RPC_2, RPC_3 }; break; @@ -547,7 +547,7 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { predictors = { theta, St1_ring2, dPhi_12, dPhi_14, dPhi_24, FR_1, FR_2, bend_1, dTh_14, RPC_1, RPC_2, RPC_4 }; break; case 11: // 1-3-4 predictors = { theta, St1_ring2, dPhi_34, dPhi_13, dPhi_14, FR_1, FR_3, bend_1, dTh_14, RPC_1, RPC_3, RPC_4 }; break; - case 7: // 2-3-4 + case 7: // 2-3-4 predictors = { theta, dPhi_23, dPhi_34, dPhi_24, FR_2, bend_2, dTh_24, RPC_2, RPC_3, RPC_4 }; break; case 12: // 1-2 predictors = { theta, St1_ring2, dPhi_12, FR_1, FR_2, bend_1, bend_2, dTh_12, RPC_1, RPC_2 }; break; @@ -564,15 +564,15 @@ float PtAssignmentEngine2017::calculate_pt_xml(const EMTFTrack& track) const { } std::vector tree_data(predictors.cbegin(),predictors.cend()); - + auto tree_event = std::make_unique(); tree_event->predictedValue = 0; tree_event->data = tree_data; - + // forests_.at(mode).predictEvent(tree_event.get(), 400); emtf::Forest &forest = const_cast(forests_.at(mode)); forest.predictEvent(tree_event.get(), 400); - + // // Adjust this for different XMLs // float log2_pt = tree_event->predictedValue; // pt_xml = pow(2, fmax(0.0, log2_pt)); // Protect against negative values diff --git a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngineAux2017.cc b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngineAux2017.cc index 4ae8db94fdaa7..16c4c7c1f7667 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngineAux2017.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtAssignmentEngineAux2017.cc @@ -14,18 +14,18 @@ static const int dPhiNLBMap_4bit_256Max[16] = {0, 1, 2, 3, 4, 6, 8, 10, 12, 16, 20, 25, 31, 46, 68, 136}; // For use in dPhi23, dPhi24, and dPhi34 in 3- and 4-station modes (7, 11, 13, 14, 15), except for dPhi23 in mode 7 and dPhi34 in mode 15 -static const int dPhiNLBMap_5bit_256Max[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 19, 20, 21, 23, 25, 28, 31, 34, 39, 46, 55, 68, 91, 136}; +static const int dPhiNLBMap_5bit_256Max[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 19, 20, 21, 23, 25, 28, 31, 34, 39, 46, 55, 68, 91, 136}; // 512 max units---- // For use in all dPhiAB (where "A" and "B" are the first two stations in the track) in all modes -static const int dPhiNLBMap_7bit_512Max[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, - 83, 84, 86, 87, 89, 91, 92, 94, 96, 98, 100, 102, 105, 107, 110, 112, - 115, 118, 121, 124, 127, 131, 135, 138, 143, 147, 152, 157, 162, 168, 174, 181, - 188, 196, 204, 214, 224, 235, 247, 261, 276, 294, 313, 336, 361, 391, 427, 470}; +static const int dPhiNLBMap_7bit_512Max[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, + 83, 84, 86, 87, 89, 91, 92, 94, 96, 98, 100, 102, 105, 107, 110, 112, + 115, 118, 121, 124, 127, 131, 135, 138, 143, 147, 152, 157, 162, 168, 174, 181, + 188, 196, 204, 214, 224, 235, 247, 261, 276, 294, 313, 336, 361, 391, 427, 470}; int PtAssignmentEngineAux2017::getNLBdPhi(int dPhi, int bits, int max) const { @@ -44,8 +44,8 @@ int PtAssignmentEngineAux2017::getNLBdPhi(int dPhi, int bits, int max) const { if (bits == 4) { dPhi_ = dPhiNLBMap_4bit_256Max[(1 << bits) - 1]; for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_4bit_256Max[edge] <= dPhi && - dPhiNLBMap_4bit_256Max[edge+1] > dPhi) { + if (dPhiNLBMap_4bit_256Max[edge] <= dPhi && + dPhiNLBMap_4bit_256Max[edge+1] > dPhi) { dPhi_ = dPhiNLBMap_4bit_256Max[edge]; break; } @@ -54,8 +54,8 @@ int PtAssignmentEngineAux2017::getNLBdPhi(int dPhi, int bits, int max) const { if (bits == 5) { dPhi_ = dPhiNLBMap_5bit_256Max[(1 << bits) - 1]; for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_5bit_256Max[edge] <= dPhi && - dPhiNLBMap_5bit_256Max[edge+1] > dPhi) { + if (dPhiNLBMap_5bit_256Max[edge] <= dPhi && + dPhiNLBMap_5bit_256Max[edge+1] > dPhi) { dPhi_ = dPhiNLBMap_5bit_256Max[edge]; break; } @@ -67,8 +67,8 @@ int PtAssignmentEngineAux2017::getNLBdPhi(int dPhi, int bits, int max) const { if (bits == 7) { dPhi_ = dPhiNLBMap_7bit_512Max[(1 << bits) - 1]; for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_7bit_512Max[edge] <= dPhi && - dPhiNLBMap_7bit_512Max[edge+1] > dPhi) { + if (dPhiNLBMap_7bit_512Max[edge] <= dPhi && + dPhiNLBMap_7bit_512Max[edge+1] > dPhi) { dPhi_ = dPhiNLBMap_7bit_512Max[edge]; break; } @@ -93,12 +93,12 @@ int PtAssignmentEngineAux2017::getNLBdPhiBin(int dPhi, int bits, int max) const if (dPhi < 0) sign_ = -1; dPhi = sign_ * dPhi; - + if (max == 256) { if (bits == 4) { for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_4bit_256Max[edge] <= dPhi && - dPhiNLBMap_4bit_256Max[edge+1] > dPhi) { + if (dPhiNLBMap_4bit_256Max[edge] <= dPhi && + dPhiNLBMap_4bit_256Max[edge+1] > dPhi) { dPhiBin_ = edge; break; } @@ -106,20 +106,20 @@ int PtAssignmentEngineAux2017::getNLBdPhiBin(int dPhi, int bits, int max) const } // End conditional: if (bits == 4) if (bits == 5) { for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_5bit_256Max[edge] <= dPhi && - dPhiNLBMap_5bit_256Max[edge+1] > dPhi) { + if (dPhiNLBMap_5bit_256Max[edge] <= dPhi && + dPhiNLBMap_5bit_256Max[edge+1] > dPhi) { dPhiBin_ = edge; break; } } - } // End conditional: if (bits == 5) + } // End conditional: if (bits == 5) } // End conditional: if (max == 256) else if (max == 512) { if (bits == 7) { for (int edge = 0; edge < (1 << bits) - 1; edge++) { - if (dPhiNLBMap_7bit_512Max[edge] <= dPhi && - dPhiNLBMap_7bit_512Max[edge+1] > dPhi) { + if (dPhiNLBMap_7bit_512Max[edge] <= dPhi && + dPhiNLBMap_7bit_512Max[edge+1] > dPhi) { dPhiBin_ = edge; break; } @@ -143,7 +143,7 @@ int PtAssignmentEngineAux2017::getdPhiFromBin(int dPhiBin, int bits, int max) co if (dPhiBin > (1 << bits) - 1) dPhiBin = (1 << bits) - 1; - + if (max == 256) { if (bits == 4) dPhi_ = dPhiNLBMap_4bit_256Max[dPhiBin]; @@ -164,8 +164,8 @@ int PtAssignmentEngineAux2017::getdPhiFromBin(int dPhiBin, int bits, int max) co int PtAssignmentEngineAux2017::getCLCT(int clct, int endcap, int dPhiSign, int bits) const { - // std::cout << "Inside getCLCT: clct = " << clct << ", endcap = " << endcap - // << ", dPhiSign = " << dPhiSign << ", bits = " << bits << std::endl; + // std::cout << "Inside getCLCT: clct = " << clct << ", endcap = " << endcap + // << ", dPhiSign = " << dPhiSign << ", bits = " << bits << std::endl; if (not( clct >= 0 && clct <= 10 && abs(endcap) == 1 && abs(dPhiSign) == 1 && (bits == 2 || bits == 3) )) @@ -179,7 +179,7 @@ int PtAssignmentEngineAux2017::getCLCT(int clct, int endcap, int dPhiSign, int b // CLCT pattern can be converted into |bend| x sign as follows: // |bend| = (10 + (pattern % 2) - pattern) / 2 // * 10 --> 0, 9/8 --> 1, 7/6 --> 2, 5/4 --> 3, 3/2 --> 4, 0 indicates RPC hit - // sign = ((pattern % 2) == 1 ? -1 : 1) * (endcap == 1 ? -1 : 1) + // sign = ((pattern % 2) == 1 ? -1 : 1) * (endcap == 1 ? -1 : 1) // * In ME+, even CLCTs have negative sign, odd CLCTs have positive // For use in all 3- and 4-station modes (7, 11, 13, 14, 15) @@ -230,8 +230,8 @@ int PtAssignmentEngineAux2017::getCLCT(int clct, int endcap, int dPhiSign, int b int PtAssignmentEngineAux2017::unpackCLCT(int clct, int endcap, int dPhiSign, int bits) const { - // std::cout << "Inside unpackCLCT: clct = " << clct << ", endcap = " << endcap - // << ", dPhiSign = " << dPhiSign << ", bits = " << bits << std::endl; + // std::cout << "Inside unpackCLCT: clct = " << clct << ", endcap = " << endcap + // << ", dPhiSign = " << dPhiSign << ", bits = " << bits << std::endl; if (not(bits == 2 || bits == 3)) { edm::LogError("L1T") << "bits = " << bits; return 0; } @@ -251,7 +251,7 @@ int PtAssignmentEngineAux2017::unpackCLCT(int clct, int endcap, int dPhiSign, in case 3: clct_ = (sign_ > 0 ? 4 : 5); break; case 0: clct_ = 0; break; default: break; - } + } } else if (bits == 3) { switch (clct) { case 4: clct_ = 10; break; @@ -365,14 +365,14 @@ int PtAssignmentEngineAux2017::getTheta(int theta, int st1_ring2, int bits) cons if (st1_ring2 == 0) { // Should rarely fail ... should change to using ME1 for track theta - AWB 05.06.17 if (theta > 52) { - // std::cout << "\n\n*** Bizzare case of mode 15 track with ME1/1 LCT and track theta = " << theta << std::endl; - } + // std::cout << "\n\n*** Bizzare case of mode 15 track with ME1/1 LCT and track theta = " << theta << std::endl; + } theta_ = (std::min( std::max(theta, 5), 52) - 5) / 6; } else if (st1_ring2 == 1) { // Should rarely fail ... should change to using ME1 for track theta - AWB 05.06.17 if (theta < 46 || theta > 87) { - // std::cout << "\n\n*** Bizzare case of mode 15 track with ME1/2 LCT and track theta = " << theta << std::endl; + // std::cout << "\n\n*** Bizzare case of mode 15 track with ME1/2 LCT and track theta = " << theta << std::endl; } theta_ = ((std::min( std::max(theta, 46), 87) - 46) / 7) + 8; } @@ -447,10 +447,10 @@ int PtAssignmentEngineAux2017::get2bRPC(int clctA, int clctB, int clctC) const { int rpc_2b = -99; - if (clctA == 0) rpc_2b = 0; - else if (clctC == 0) rpc_2b = 1; - else if (clctB == 0) rpc_2b = 2; - else rpc_2b = 3; + if (clctA == 0) rpc_2b = 0; + else if (clctC == 0) rpc_2b = 1; + else if (clctB == 0) rpc_2b = 2; + else rpc_2b = 3; if (not(rpc_2b >= 0 && rpc_2b < 4)) { edm::LogError("L1T") << "rpc_2b = " << rpc_2b; return 0; } @@ -473,10 +473,10 @@ void PtAssignmentEngineAux2017::unpack2bRPC(int rpc_2b, int& rpcA, int& rpcB, in int PtAssignmentEngineAux2017::get8bMode15(int theta, int st1_ring2, int endcap, int sPhiAB, - int clctA, int clctB, int clctC, int clctD) const { + int clctA, int clctB, int clctC, int clctD) const { - // std::cout << "Inside get8bMode15, theta = " << theta << ", st1_ring2 = " << st1_ring2 << ", endcap = " << endcap << ", sPhiAB = " << sPhiAB - // << ", clctA = " << clctA << ", clctB = " << clctB << ", clctC = " << clctC << ", clctD = " << clctD << std::endl; + // std::cout << "Inside get8bMode15, theta = " << theta << ", st1_ring2 = " << st1_ring2 << ", endcap = " << endcap << ", sPhiAB = " << sPhiAB + // << ", clctA = " << clctA << ", clctB = " << clctB << ", clctC = " << clctC << ", clctD = " << clctD << std::endl; if (st1_ring2) theta = (std::min( std::max(theta, 46), 87) - 46) / 7; else theta = (std::min( std::max(theta, 5), 52) - 5) / 6; @@ -484,28 +484,28 @@ int PtAssignmentEngineAux2017::get8bMode15(int theta, int st1_ring2, int endcap, { edm::LogError("L1T") << "theta = " << theta; return 0; } int clctA_2b = getCLCT(clctA, endcap, sPhiAB, 2); - + int nRPC = (clctA == 0) + (clctB == 0) + (clctC == 0) + (clctD == 0); int rpc_word, rpc_clct, mode15_8b; if (st1_ring2) { - if (nRPC >= 2 && clctA == 0 && clctB == 0) rpc_word = 0; - else if (nRPC >= 2 && clctA == 0 && clctC == 0) rpc_word = 1; - else if (nRPC >= 2 && clctA == 0 && clctD == 0) rpc_word = 2; - else if (nRPC == 1 && clctA == 0 ) rpc_word = 3; - else if (nRPC >= 2 && clctD == 0 && clctB == 0) rpc_word = 4; - else if (nRPC >= 2 && clctD == 0 && clctC == 0) rpc_word = 8; - else if (nRPC >= 2 && clctB == 0 && clctC == 0) rpc_word = 12; - else if (nRPC == 1 && clctD == 0 ) rpc_word = 16; - else if (nRPC == 1 && clctB == 0 ) rpc_word = 20; - else if (nRPC == 1 && clctC == 0 ) rpc_word = 24; + if (nRPC >= 2 && clctA == 0 && clctB == 0) rpc_word = 0; + else if (nRPC >= 2 && clctA == 0 && clctC == 0) rpc_word = 1; + else if (nRPC >= 2 && clctA == 0 && clctD == 0) rpc_word = 2; + else if (nRPC == 1 && clctA == 0 ) rpc_word = 3; + else if (nRPC >= 2 && clctD == 0 && clctB == 0) rpc_word = 4; + else if (nRPC >= 2 && clctD == 0 && clctC == 0) rpc_word = 8; + else if (nRPC >= 2 && clctB == 0 && clctC == 0) rpc_word = 12; + else if (nRPC == 1 && clctD == 0 ) rpc_word = 16; + else if (nRPC == 1 && clctB == 0 ) rpc_word = 20; + else if (nRPC == 1 && clctC == 0 ) rpc_word = 24; else rpc_word = 28; rpc_clct = rpc_word + clctA_2b; mode15_8b = (theta*32) + rpc_clct + 64; } else { - if (theta >= 4 && clctD == 0) rpc_word = 0; - else if (theta >= 4 && clctC == 0) rpc_word = 1; - else if (theta >= 4 ) rpc_word = 2; + if (theta >= 4 && clctD == 0) rpc_word = 0; + else if (theta >= 4 && clctC == 0) rpc_word = 1; + else if (theta >= 4 ) rpc_word = 2; else rpc_word = 3; rpc_clct = rpc_word*4 + clctA_2b; mode15_8b = ((theta % 4)*16) + rpc_clct; @@ -542,7 +542,7 @@ void PtAssignmentEngineAux2017::unpack8bMode15( int mode15_8b, int& theta, int& if (st1_ring2) { rpc_clct = (mode15_8b % 32); - theta = (mode15_8b - 64 - rpc_clct) / 32; + theta = (mode15_8b - 64 - rpc_clct) / 32; theta += 8; if (rpc_clct < 4) clctA_2b = 0; @@ -587,7 +587,7 @@ void PtAssignmentEngineAux2017::unpack8bMode15( int mode15_8b, int& theta, int& } // std::cout << " * Output theta = " << theta << ", st1_ring2 = " << st1_ring2 << ", clctA = " << clctA - // << ", rpcA = " << rpcA << ", rpcB = " << rpcB << ", rpcC = " << rpcC << ", rpcD = " << rpcD << std::endl; + // << ", rpcA = " << rpcA << ", rpcB = " << rpcB << ", rpcC = " << rpcC << ", rpcD = " << rpcD << std::endl; if (not(nRPC >= 0)) { edm::LogError("L1T") << "nRPC = " << nRPC; return; } diff --git a/L1Trigger/L1TMuonEndCap/src/PtLUTWriter.cc b/L1Trigger/L1TMuonEndCap/src/PtLUTWriter.cc index 4cfd63926d87c..28eb4bce60aaa 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtLUTWriter.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtLUTWriter.cc @@ -40,7 +40,7 @@ void PtLUTWriter::write(const std::string& lut_full_path, const uint16_t num_, c throw std::invalid_argument(what); } - if (num_ == 1) + if (num_ == 1) ptlut_.at(0) = version_; // address 0 is the pT LUT version number typedef uint64_t full_word_t; diff --git a/L1Trigger/L1TMuonEndCap/src/PtLutVarCalc.cc b/L1Trigger/L1TMuonEndCap/src/PtLutVarCalc.cc index 998bdab4df6d8..7ff4b78a395d6 100644 --- a/L1Trigger/L1TMuonEndCap/src/PtLutVarCalc.cc +++ b/L1Trigger/L1TMuonEndCap/src/PtLutVarCalc.cc @@ -10,7 +10,7 @@ PtAssignmentEngineAux2017 ENG; int CalcTrackTheta( const int th1, const int th2, const int th3, const int th4, - const int st1_ring2, const int mode, const bool BIT_COMP ) { + const int st1_ring2, const int mode, const bool BIT_COMP ) { int theta = -99; @@ -34,8 +34,8 @@ int CalcTrackTheta( const int th1, const int th2, const int th3, const int th4, void CalcDeltaPhis( int& dPh12, int& dPh13, int& dPh14, int& dPh23, int& dPh24, int& dPh34, int& dPhSign, - int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int& outStPh, - const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP ) { + int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int& outStPh, + const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP ) { dPh12 = ph2 - ph1; dPh13 = ph3 - ph1; @@ -116,15 +116,15 @@ void CalcDeltaPhis( int& dPh12, int& dPh13, int& dPh14, int& dPh23, int& dPh24, // Compute summed quantities if (mode == 15) CalcDeltaPhiSums( dPhSum4, dPhSum4A, dPhSum3, dPhSum3A, outStPh, - dPh12, dPh13, dPh14, dPh23, dPh24, dPh34 ); + dPh12, dPh13, dPh14, dPh23, dPh24, dPh34 ); } // End function: CalcDeltaPhis() void CalcDeltaThetas( int& dTh12, int& dTh13, int& dTh14, int& dTh23, int& dTh24, int& dTh34, - const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP ) { - + const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP ) { + dTh12 = th2 - th1; dTh13 = th3 - th1; dTh14 = th4 - th1; @@ -148,14 +148,14 @@ void CalcDeltaThetas( int& dTh12, int& dTh13, int& dTh14, int& dTh23, int& dTh24 void CalcBends( int& bend1, int& bend2, int& bend3, int& bend4, - const int pat1, const int pat2, const int pat3, const int pat4, - const int dPhSign, const int endcap, const int mode, const bool BIT_COMP ) { + const int pat1, const int pat2, const int pat3, const int pat4, + const int dPhSign, const int endcap, const int mode, const bool BIT_COMP ) { bend1 = CalcBendFromPattern( pat1, endcap ); bend2 = CalcBendFromPattern( pat2, endcap ); bend3 = CalcBendFromPattern( pat3, endcap ); bend4 = CalcBendFromPattern( pat4, endcap ); - + if (BIT_COMP) { int nBits = 3; if (mode == 7 || mode == 11 || mode > 12) @@ -170,11 +170,11 @@ void CalcBends( int& bend1, int& bend2, int& bend3, int& bend4, if ( (mode % 2) > 0 ) // Has station 4 hit bend4 = ENG.getCLCT( pat4, endcap, dPhSign, nBits ); } // End conditional: if (BIT_COMP) - + } // End function: CalcBends() void CalcRPCs( int& RPC1, int& RPC2, int& RPC3, int& RPC4, const int mode, - const int st1_ring2, const int theta, const bool BIT_COMP ) { + const int st1_ring2, const int theta, const bool BIT_COMP ) { if (BIT_COMP) { @@ -184,55 +184,55 @@ void CalcRPCs( int& RPC1, int& RPC2, int& RPC3, int& RPC4, const int mode, RPC1 = 0; RPC2 = 0; if (theta < 4) { - RPC3 = 0; - RPC4 = 0; + RPC3 = 0; + RPC4 = 0; } } int nRPC = (RPC1 == 1) + (RPC2 == 1) + (RPC3 == 1) + (RPC4 == 1); - + // In 3- and 4-station modes, only specify some combinations of RPCs if (nRPC >= 2) { if (mode == 15) { - if (RPC1 == 1 && RPC2 == 1) { - RPC3 = 0; - RPC4 = 0; - } else if (RPC1 == 1 && RPC3 == 1) { - RPC4 = 0; - } else if (RPC4 == 1 && RPC2 == 1) { - RPC3 = 0; - } else if (RPC3 == 1 && RPC4 == 1 && !st1_ring2) { - RPC3 = 0; - } + if (RPC1 == 1 && RPC2 == 1) { + RPC3 = 0; + RPC4 = 0; + } else if (RPC1 == 1 && RPC3 == 1) { + RPC4 = 0; + } else if (RPC4 == 1 && RPC2 == 1) { + RPC3 = 0; + } else if (RPC3 == 1 && RPC4 == 1 && !st1_ring2) { + RPC3 = 0; + } } else if (mode == 14) { - if (RPC1 == 1) { - RPC2 = 0; - RPC3 = 0; - } else if (RPC3 == 1) { - RPC2 = 0; - } + if (RPC1 == 1) { + RPC2 = 0; + RPC3 = 0; + } else if (RPC3 == 1) { + RPC2 = 0; + } } else if (mode == 13) { - if (RPC1 == 1) { - RPC2 = 0; - RPC4 = 0; - } else if (RPC4 == 1) { - RPC2 = 0; - } + if (RPC1 == 1) { + RPC2 = 0; + RPC4 = 0; + } else if (RPC4 == 1) { + RPC2 = 0; + } } else if (mode == 11) { - if (RPC1 == 1) { - RPC3 = 0; - RPC4 = 0; - } else if (RPC4 == 1) { - RPC3 = 0; - } + if (RPC1 == 1) { + RPC3 = 0; + RPC4 = 0; + } else if (RPC4 == 1) { + RPC3 = 0; + } } else if (mode == 7) { - if (RPC2 == 1) { - RPC3 = 0; - RPC4 = 0; - } else if (RPC4 == 1) { - RPC3 = 0; - } + if (RPC2 == 1) { + RPC3 = 0; + RPC4 = 0; + } else if (RPC4 == 1) { + RPC3 = 0; + } } } // End conditional: if (nRPC >= 2) @@ -265,7 +265,7 @@ int CalcBendFromPattern( const int pattern, const int endcap ) { void CalcDeltaPhiSums( int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int& outStPh, - const int dPh12, const int dPh13, const int dPh14, const int dPh23, const int dPh24, const int dPh34 ) { + const int dPh12, const int dPh13, const int dPh14, const int dPh23, const int dPh24, const int dPh34 ) { dPhSum4 = dPh12 + dPh13 + dPh14 + dPh23 + dPh24 + dPh34; dPhSum4A = abs(dPh12) + abs(dPh13) + abs(dPh14) + abs(dPh23) + abs(dPh24) + abs(dPh34); @@ -273,13 +273,13 @@ void CalcDeltaPhiSums( int& dPhSum4, int& dPhSum4A, int& dPhSum3, int& dPhSum3A, int devSt2 = abs(dPh12) + abs(dPh23) + abs(dPh24); int devSt3 = abs(dPh13) + abs(dPh23) + abs(dPh34); int devSt4 = abs(dPh14) + abs(dPh24) + abs(dPh34); - + if (devSt4 > devSt3 && devSt4 > devSt2 && devSt4 > devSt1) outStPh = 4; else if (devSt3 > devSt4 && devSt3 > devSt2 && devSt3 > devSt1) outStPh = 3; else if (devSt2 > devSt4 && devSt2 > devSt3 && devSt2 > devSt1) outStPh = 2; else if (devSt1 > devSt4 && devSt1 > devSt3 && devSt1 > devSt2) outStPh = 1; else outStPh = 0; - + if (outStPh == 4) { dPhSum3 = dPh12 + dPh13 + dPh23; dPhSum3A = abs(dPh12) + abs(dPh13) + abs(dPh23); diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc index 37f14846937bb..a4232bffda194 100644 --- a/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc @@ -111,7 +111,7 @@ void SectorProcessor::configure_by_fw_version(unsigned fw_version) { // ___________________________________________________________________________ // Versions in 2017 - no full documentation, can refer to https://twiki.cern.ch/twiki/bin/viewauth/CMS/L1KnownIssues - + // Before July 9th (runs < 298653), all mode 7 tracks (station 2-3-4) assigned quality 11 // July 9th - 29th (runs 298653 - 300087), mode 7 tracks with |eta| > 1.6 in sector -6 assigned quality 12 // After July 29th (runs >= 300088), mode 7 track promotion applied in all sectors @@ -140,20 +140,20 @@ void SectorProcessor::configure_by_fw_version(unsigned fw_version) { fixME11Edges_ = false; pattDefinitions_ = { "4,15:15,7:7,7:7,7:7", - "3,16:16,7:7,7:6,7:6", - "3,14:14,7:7,8:7,8:7", - "2,18:17,7:7,7:5,7:5", // Should be 7:4 in ME3,4 (FW bug) - "2,13:12,7:7,10:7,10:7", - "1,22:19,7:7,7:0,7:0", - "1,11:8,7:7,14:7,14:7", - "0,30:23,7:7,7:0,7:0", - "0,7:0,7:7,14:7,14:7" }; + "3,16:16,7:7,7:6,7:6", + "3,14:14,7:7,8:7,8:7", + "2,18:17,7:7,7:5,7:5", // Should be 7:4 in ME3,4 (FW bug) + "2,13:12,7:7,10:7,10:7", + "1,22:19,7:7,7:0,7:0", + "1,11:8,7:7,14:7,14:7", + "0,30:23,7:7,7:0,7:0", + "0,7:0,7:7,14:7,14:7" }; // Straightness, hits in ME1, hits in ME2, hits in ME3, hits in ME4 symPattDefinitions_ = { "4,15:15:15:15,7:7:7:7,7:7:7:7,7:7:7:7", - "3,16:16:14:14,7:7:7:7,8:7:7:6,8:7:7:6", - "2,18:17:13:12,7:7:7:7,10:7:7:4,10:7:7:4", - "1,22:19:11:8,7:7:7:7,14:7:7:0,14:7:7:0", - "0,30:23:7:0,7:7:7:7,14:7:7:0,14:7:7:0" }; + "3,16:16:14:14,7:7:7:7,8:7:7:6,8:7:7:6", + "2,18:17:13:12,7:7:7:7,10:7:7:4,10:7:7:4", + "1,22:19:11:8,7:7:7:7,14:7:7:0,14:7:7:0", + "0,30:23:7:0,7:7:7:7,14:7:7:0,14:7:7:0" }; thetaWindow_ = 4; // Maximum dTheta between primitives in the same track useSingleHits_ = false; // Build "tracks" from single LCTs in ME1/1 @@ -164,7 +164,7 @@ void SectorProcessor::configure_by_fw_version(unsigned fw_version) { bugGMTPhi_ = true; promoteMode7_ = false; // Assign station 2-3-4 tracks with |eta| > 1.6 SingleMu quality } // End default settings for 2016 - + // ___________________________________________________________________________ // Versions in 2016 - refer to docs/EMTF_FW_LUT_versions_2016_draft2.xlsx diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessorLUT.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessorLUT.cc index 27c9d2e101b72..def3139724e10 100644 --- a/L1Trigger/L1TMuonEndCap/src/SectorProcessorLUT.cc +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessorLUT.cc @@ -26,7 +26,7 @@ void SectorProcessorLUT::read(unsigned pc_lut_version) { coord_lut_dir = "ph_lut_v1"; // All year 2016 else if (pc_lut_version == 1) coord_lut_dir = "ph_lut_v2"; // Beginning of 2017 - else + else throw cms::Exception("SectorProcessorLUT") << "Trying to use EMTF pc_lut_version = " << pc_lut_version << ", does not exist!"; // Will catch user trying to run with Global Tag settings on 2016 data, rather than fakeEmtfParams. - AWB 08.06.17 diff --git a/L1Trigger/L1TMuonEndCap/src/SingleHitTrack.cc b/L1Trigger/L1TMuonEndCap/src/SingleHitTrack.cc index db030cffd88d7..bca987eb983d1 100644 --- a/L1Trigger/L1TMuonEndCap/src/SingleHitTrack.cc +++ b/L1Trigger/L1TMuonEndCap/src/SingleHitTrack.cc @@ -42,19 +42,19 @@ void SingleHitTrack::process( // Require subsector and CSC ID to match if (conv_hits_it.Subsector() != subsector || conv_hits_it.CSC_ID() != CSC_ID) - continue; + continue; // Only consider CSC LCTs if (conv_hits_it.Is_CSC() != 1) - continue; - + continue; + // Only consider hits in station 1, ring 1 if (conv_hits_it.Station() != 1 || (conv_hits_it.Ring() % 3) != 1) - continue; - + continue; + // Only consider hits in the same sector (not neighbor hits) if ( (conv_hits_it.Endcap() == 1) != (endcap_ == 1) || conv_hits_it.Sector() != sector_ ) - continue; + continue; // Check if a hit has already been used in a track bool already_used = false; @@ -62,34 +62,34 @@ void SingleHitTrack::process( // Loop over existing multi-hit tracks for (const auto & best_tracks_it : best_tracks) { - // Only consider tracks with a hit in station 1 - if (best_tracks_it.Mode() < 8) - continue; - - // Check if hit in track is identical - // "Duplicate" hits (with same strip but different wire) are considered identical - // const EMTFHit& conv_hit_i = *conv_hits_it; - const EMTFHit& conv_hit_j = best_tracks_it.Hits().front(); - - if ( - (conv_hits_it.Subsystem() == conv_hit_j.Subsystem()) && - (conv_hits_it.PC_station() == conv_hit_j.PC_station()) && - (conv_hits_it.PC_chamber() == conv_hit_j.PC_chamber()) && - ((conv_hits_it.Ring() % 3) == (conv_hit_j.Ring() % 3)) && // because of ME1/1 - (conv_hits_it.Strip() == conv_hit_j.Strip()) && - // (conv_hits_it.Wire() == conv_hit_j.Wire()) && - (conv_hits_it.BX() == conv_hit_j.BX()) && - true - ) { - already_used = true; - break; - } + // Only consider tracks with a hit in station 1 + if (best_tracks_it.Mode() < 8) + continue; + + // Check if hit in track is identical + // "Duplicate" hits (with same strip but different wire) are considered identical + // const EMTFHit& conv_hit_i = *conv_hits_it; + const EMTFHit& conv_hit_j = best_tracks_it.Hits().front(); + + if ( + (conv_hits_it.Subsystem() == conv_hit_j.Subsystem()) && + (conv_hits_it.PC_station() == conv_hit_j.PC_station()) && + (conv_hits_it.PC_chamber() == conv_hit_j.PC_chamber()) && + ((conv_hits_it.Ring() % 3) == (conv_hit_j.Ring() % 3)) && // because of ME1/1 + (conv_hits_it.Strip() == conv_hit_j.Strip()) && + // (conv_hits_it.Wire() == conv_hit_j.Wire()) && + (conv_hits_it.BX() == conv_hit_j.BX()) && + true + ) { + already_used = true; + break; + } } // End loop: for (const auto & best_tracks_it : best_tracks) // Only use hits that have not been used in a track if (already_used) - continue; - + continue; + int zone = -1; int zone_code = conv_hits_it.Zone_code(); if (zone_code & 0b1000) zone = 4; @@ -102,10 +102,10 @@ void SingleHitTrack::process( EMTFTrack new_trk; new_trk.push_Hit ( conv_hits_it ); - + EMTFPtLUT empty_LUT = {}; new_trk.set_PtLUT ( empty_LUT ); - + new_trk.set_endcap ( conv_hits_it.Endcap() ); new_trk.set_sector ( conv_hits_it.Sector() ); new_trk.set_sector_idx ( conv_hits_it.Sector_idx() ); @@ -126,19 +126,19 @@ void SingleHitTrack::process( new_trk.set_phi_loc ( conv_hits_it.Phi_loc() ); new_trk.set_phi_glob ( conv_hits_it.Phi_glob() ); new_trk.set_track_num ( maxTracks_ - 1 ); - + one_hit_trks.push_back( new_trk ); - + if (int(best_tracks.size()) + int(one_hit_trks.size()) >= maxTracks_) - break; - + break; + // Firmware only sends one single-hit track per sector - if (!one_hit_trks.empty()) - break; + if (!one_hit_trks.empty()) + break; } // End loop: for (const auto & conv_hits_it : conv_hits) - if (!one_hit_trks.empty()) + if (!one_hit_trks.empty()) break; } // End loop: for (int sub_ID = 5; sub_ID > 0; sub_ID--) { diff --git a/L1Trigger/L1TMuonEndCap/src/TTPrimitiveConversion.cc b/L1Trigger/L1TMuonEndCap/src/TTPrimitiveConversion.cc new file mode 100644 index 0000000000000..5c243a9fed9f6 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/src/TTPrimitiveConversion.cc @@ -0,0 +1,126 @@ +#include "L1Trigger/L1TMuonEndCap/interface/TTPrimitiveConversion.h" + +#include "L1Trigger/L1TMuonEndCap/interface/SectorProcessorLUT.h" +#include "L1Trigger/L1TMuonEndCap/interface/TrackTools.h" + + +void TTPrimitiveConversion::configure( + const TTGeometryTranslator* tp_ttgeom, + const SectorProcessorLUT* lut, + int verbose, int endcap, int sector, int bx +) { + assert(tp_ttgeom != nullptr); + assert(lut != nullptr); + + tp_ttgeom_ = tp_ttgeom; + lut_ = lut; // not used + + verbose_ = verbose; + endcap_ = endcap; // 1 for ME+, 2 for ME- + sector_ = sector; + bx_ = bx; +} + +void TTPrimitiveConversion::process( + const std::map& selected_ttprim_map, + EMTFHitCollection& conv_hits +) const { + + for (const auto& map_tp_it : selected_ttprim_map) { + for (const auto& tp_it : map_tp_it.second) { + EMTFHit conv_hit; + convert_tt(tp_it, conv_hit); + conv_hits.push_back(conv_hit); + } + } +} + +void TTPrimitiveConversion::process_no_prim_sel( + const TTTriggerPrimitiveCollection& ttmuon_primitives, + EMTFHitCollection& conv_hits +) const { + + for (const auto& tp_it : ttmuon_primitives) { + if (endcap_ == 1 && sector_ == 1 && bx_ == tp_it.getTTData().bx) { //FIXME: stupidly put everything into sector +1, to be fixed. + EMTFHit conv_hit; + convert_tt(tp_it, conv_hit); + conv_hits.push_back(conv_hit); + } + } +} + + +// _____________________________________________________________________________ +// TT functions +void TTPrimitiveConversion::convert_tt( + const TTTriggerPrimitive& ttmuon_primitive, + EMTFHit& conv_hit +) const { + //const DetId& tp_detId = ttmuon_primitive.detId(); + const TTData& tp_data = ttmuon_primitive.getTTData(); + + int tp_region = tp_ttgeom_->region(ttmuon_primitive); // 0 for Barrel, +/-1 for +/- Endcap + int tp_endcap = (tp_region == -1) ? 2 : tp_region; + int tp_station = tp_ttgeom_->layer(ttmuon_primitive); + int tp_ring = tp_ttgeom_->ring(ttmuon_primitive); + int tp_chamber = tp_ttgeom_->module(ttmuon_primitive); + int tp_sector = 1; //FIXME + int tp_subsector = 0; //FIXME + + const bool is_neighbor = false; //FIXME + + // Set properties + //conv_hit.SetTTDetId ( tp_detId ); + + conv_hit.set_endcap ( (tp_endcap == 2) ? -1 : tp_endcap ); + conv_hit.set_station ( tp_station ); + conv_hit.set_ring ( tp_ring ); + //conv_hit.set_roll ( tp_roll ); + conv_hit.set_chamber ( tp_chamber ); + conv_hit.set_sector ( tp_sector ); + conv_hit.set_subsector ( tp_subsector ); + //conv_hit.set_csc_ID ( tp_csc_ID ); + //conv_hit.set_csc_nID ( csc_nID ); + //conv_hit.set_track_num ( tp_data.trknmb ); + //conv_hit.set_sync_err ( tp_data.syncErr ); + + conv_hit.set_bx ( tp_data.bx ); + conv_hit.set_subsystem ( TTTriggerPrimitive::kTT ); + conv_hit.set_is_CSC ( false ); + conv_hit.set_is_RPC ( false ); + conv_hit.set_is_GEM ( false ); + + //conv_hit.set_pc_sector ( pc_sector ); + //conv_hit.set_pc_station ( pc_station ); + //conv_hit.set_pc_chamber ( pc_chamber ); + //conv_hit.set_pc_segment ( pc_segment ); + + conv_hit.set_valid ( true ); + conv_hit.set_strip ( static_cast(tp_data.row_f) ); + //conv_hit.set_strip_low ( tp_data.strip_low ); + //conv_hit.set_strip_hi ( tp_data.strip_hi ); + conv_hit.set_wire ( static_cast(tp_data.col_f) ); + //conv_hit.set_quality ( tp_data.quality ); + //conv_hit.set_pattern ( tp_data.pattern ); + conv_hit.set_bend ( tp_data.bend ); + //conv_hit.set_time ( tp_data.time ); + + conv_hit.set_neighbor ( is_neighbor ); + conv_hit.set_sector_idx ( (endcap_ == 1) ? sector_ - 1 : sector_ + 5 ); + + // Add coordinates from fullsim + { + const GlobalPoint& gp = tp_ttgeom_->getGlobalPoint(ttmuon_primitive); + double glob_phi = emtf::rad_to_deg(gp.phi().value()); + double glob_theta = emtf::rad_to_deg(gp.theta()); + double glob_eta = gp.eta(); + double glob_rho = gp.perp(); + double glob_z = gp.z(); + + conv_hit.set_phi_sim ( glob_phi ); + conv_hit.set_theta_sim ( glob_theta ); + conv_hit.set_eta_sim ( glob_eta ); + conv_hit.set_rho_sim ( glob_rho ); + conv_hit.set_z_sim ( glob_z ); + } +} diff --git a/L1Trigger/L1TMuonEndCap/src/TrackFinder.cc b/L1Trigger/L1TMuonEndCap/src/TrackFinder.cc index 42ff902830c0f..158630ec35fa8 100644 --- a/L1Trigger/L1TMuonEndCap/src/TrackFinder.cc +++ b/L1Trigger/L1TMuonEndCap/src/TrackFinder.cc @@ -79,7 +79,7 @@ TrackFinder::TrackFinder(const edm::ParameterSet& iConfig, edm::ConsumesCollecto for (int endcap = emtf::MIN_ENDCAP; endcap <= emtf::MAX_ENDCAP; ++endcap) { for (int sector = emtf::MIN_TRIGSECTOR; sector <= emtf::MAX_TRIGSECTOR; ++sector) { const int es = (endcap - emtf::MIN_ENDCAP) * (emtf::MAX_TRIGSECTOR - emtf::MIN_TRIGSECTOR + 1) + (sector - emtf::MIN_TRIGSECTOR); - + sector_processors_.at(es).configure( &geometry_translator_, &condition_helper_, diff --git a/L1Trigger/L1TMuonEndCap/src/bdt/Forest.cc b/L1Trigger/L1TMuonEndCap/src/bdt/Forest.cc index e8da07a5b040c..adee9b9736559 100644 --- a/L1Trigger/L1TMuonEndCap/src/bdt/Forest.cc +++ b/L1Trigger/L1TMuonEndCap/src/bdt/Forest.cc @@ -8,7 +8,7 @@ // Tibshirani, and Friedman. // // *Greedy Function Approximation: A Gradient Boosting Machine. // // Friedman. The Annals of Statistics, Vol. 29, No. 5. Oct 2001. // -// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // +// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // // // ////////////////////////////////////////////////////////////////////////// @@ -80,7 +80,7 @@ Forest::Forest(const Forest &forest) Forest& Forest::operator=(const Forest &forest) { for(unsigned int i=0; i < trees.size(); i++) - { + { if(trees[i]) delete trees[i]; } trees.resize(0); @@ -104,14 +104,14 @@ void Forest::setTrainingEvents(std::vector& trainingEvents) Event* e = trainingEvents[0]; // Unused variable // unsigned int numrows = e->data.size(); - - // Reset the events matrix. + + // Reset the events matrix. events = std::vector< std::vector >(); - for(unsigned int i=0; idata.size(); i++) - { + for(unsigned int i=0; idata.size(); i++) + { events.push_back(trainingEvents); - } + } } ////////////////////////////////////////////////////////////////////////// @@ -127,8 +127,8 @@ std::vector Forest::getTrainingEvents(){ return events[0]; } // return the ith tree Tree* Forest::getTree(unsigned int i) -{ - if(/*i>=0 && */i=0 && */i >& e) for(unsigned int j=0; joutputEvent(); - } + } std::cout << std::endl; } } @@ -221,7 +221,7 @@ void Forest::rankVariables(std::vector& rank) // This function ranks the determining variables according to their importance // in determining the fit. Use a low learning rate for better results. // Separates completely useless variables from useful ones well, -// but isn't the best at separating variables of similar importance. +// but isn't the best at separating variables of similar importance. // This is calculated using the error reduction on the training set. The function // should be changed to use the testing set, but this works fine for now. // I will try to change this in the future. @@ -234,18 +234,18 @@ void Forest::rankVariables(std::vector& rank) for(unsigned int j=0; j < trees.size(); j++) { - trees[j]->rankVariables(v); + trees[j]->rankVariables(v); } double max = *std::max_element(v.begin(), v.end()); - + // Scale the importance. Maximum importance = 100. for(unsigned int i=0; i < v.size(); i++) { v[i] = 100*v[i]/max; } - // Change the storage format so that we can keep the index + // Change the storage format so that we can keep the index // and the value associated after sorting. std::vector< std::pair > w(events.size()); @@ -261,9 +261,9 @@ void Forest::rankVariables(std::vector& rank) for(int i=(v.size()-1); i>=0; i--) { rank.push_back(w[i].second); - // std::cout << "x" << w[i].second << ": " << w[i].first << std::endl; + // std::cout << "x" << w[i].second << ": " << w[i].first << std::endl; } - + // std::cout << std::endl << "Done." << std::endl << std::endl; } @@ -287,7 +287,7 @@ void Forest::saveSplitValues(const char* savefilename) // Gather the split values from each tree in the forest. for(unsigned int j=0; jgetSplitValues(v); + trees[j]->getSplitValues(v); } // Sort the lists of split values and remove the duplicates. @@ -307,7 +307,7 @@ void Forest::saveSplitValues(const char* savefilename) std::stringstream ss; ss.precision(14); ss << std::scientific << v[i][j]; - splitValues+=","; + splitValues+=","; splitValues+=ss.str().c_str(); } @@ -330,7 +330,7 @@ void Forest::updateRegTargets(Tree* tree, double learningRate, LossFunction* l) // Loop through the terminal nodes. for(std::list::iterator it=tn.begin(); it!=tn.end(); it++) - { + { // Get the events in the current terminal region. std::vector& v = (*it)->getEvents()[0]; @@ -370,21 +370,21 @@ void Forest::updateEvents(Tree* tree) // Loop through the terminal nodes. for(std::list::iterator it=tn.begin(); it!=tn.end(); it++) - { + { std::vector& v = (*it)->getEvents()[0]; double fit = (*it)->getFitValue(); // Loop through each event in the terminal region and update the // the global event it maps to. for(unsigned int j=0; jpredictedValue += fit; - } + } // Release memory. (*it)->getEvents() = std::vector< std::vector >(); - } + } } ////////////////////////////////////////////////////////////////////////// @@ -414,14 +414,14 @@ void Forest::doRegression(int nodeLimit, int treeLimit, double learningRate, Los { // std::cout << "++Building Tree " << i << "... " << std::endl; Tree* tree = new Tree(events); - trees.push_back(tree); + trees.push_back(tree); tree->buildTree(nodeLimit); // Update the targets for the next tree to fit. updateRegTargets(tree, learningRate, l); // Save trees to xml in some directory. - std::ostringstream ss; + std::ostringstream ss; ss << savetreesdirectory << "/" << i << ".xml"; std::string s = ss.str(); const char* c = s.c_str(); @@ -450,7 +450,7 @@ void Forest::predictEvents(std::vector& eventsp, unsigned int numtrees) } // i iterates through the trees in the forest. Each tree corrects the last prediction. - for(unsigned int i=0; i < numtrees; i++) + for(unsigned int i=0; i < numtrees; i++) { //std::cout << "++Tree " << i << "..." << std::endl; appendCorrection(eventsp, i); @@ -466,7 +466,7 @@ void Forest::appendCorrection(std::vector& eventsp, int treenum) // Update the prediction by appending the next correction. Tree* tree = trees[treenum]; - tree->filterEvents(eventsp); + tree->filterEvents(eventsp); // Update the events with their new prediction. updateEvents(tree); @@ -488,10 +488,10 @@ void Forest::predictEvent(Event* e, unsigned int numtrees) } // just like in line #2470 of https://root.cern.ch/doc/master/MethodBDT_8cxx_source.html for gradient boosting - e->predictedValue = trees[0]->getBoostWeight(); + e->predictedValue = trees[0]->getBoostWeight(); // i iterates through the trees in the forest. Each tree corrects the last prediction. - for(unsigned int i=0; i < numtrees; i++) + for(unsigned int i=0; i < numtrees; i++) { //std::cout << "++Tree " << i << "..." << std::endl; appendCorrection(e, i); @@ -507,7 +507,7 @@ void Forest::appendCorrection(Event* e, int treenum) // Update the prediction by appending the next correction. Tree* tree = trees[treenum]; - Node* terminalNode = tree->filterEvent(e); + Node* terminalNode = tree->filterEvent(e); // Update the event with its new prediction. double fit = terminalNode->getFitValue(); @@ -526,15 +526,15 @@ void Forest::loadForestFromXML(const char* directory, unsigned int numTrees) // Load the Forest. // std::cout << std::endl << "Loading Forest from XML ... " << std::endl; - for(unsigned int i=0; i < numTrees; i++) - { - trees[i] = new Tree(); + for(unsigned int i=0; i < numTrees; i++) + { + trees[i] = new Tree(); std::stringstream ss; ss << directory << "/" << i << ".xml"; trees[i]->loadFromXML(edm::FileInPath(ss.str().c_str()).fullPath().c_str()); - } + } //std::cout << "Done." << std::endl << std::endl; } @@ -579,14 +579,14 @@ void Forest::prepareRandomSubsample(double fraction) shuffle(events[0].begin(), events[0].end(), subSampleSize); // Get a copy of the random subset we just made. - std::vector v(events[0].begin(), events[0].begin()+subSampleSize); + std::vector v(events[0].begin(), events[0].begin()+subSampleSize); // Initialize and sort the subSample collection. for(unsigned int i=0; ibuildTree(nodeLimit); // Fit all of the events based upon the tree we built using @@ -634,7 +634,7 @@ void Forest::doStochasticRegression(int nodeLimit, int treeLimit, double learnin updateRegTargets(trees[i], learningRate, l); // Save trees to xml in some directory. - std::ostringstream ss; + std::ostringstream ss; ss << "trees/" << i << ".xml"; std::string s = ss.str(); const char* c = s.c_str(); diff --git a/L1Trigger/L1TMuonEndCap/src/bdt/Node.cc b/L1Trigger/L1TMuonEndCap/src/bdt/Node.cc index 0586c57915095..295c4bbea25a8 100644 --- a/L1Trigger/L1TMuonEndCap/src/bdt/Node.cc +++ b/L1Trigger/L1TMuonEndCap/src/bdt/Node.cc @@ -2,13 +2,13 @@ // Node.cxx // // =====================================================================// // This is the object implementation of a node, which is the // -// fundamental unit of a decision tree. // +// fundamental unit of a decision tree. // // References include // // *Elements of Statistical Learning by Hastie, // // Tibshirani, and Friedman. // // *Greedy Function Approximation: A Gradient Boosting Machine. // // Friedman. The Annals of Statistics, Vol. 29, No. 5. Oct 2001. // -// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // +// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // // // ////////////////////////////////////////////////////////////////////////// @@ -219,7 +219,7 @@ void Node::calcOptimumSplit() // Intialize some variables. double bestSplitValue = 0; - int bestSplitVariable = -1; + int bestSplitVariable = -1; double bestErrorReduction = -1; double SUM = 0; @@ -231,17 +231,17 @@ void Node::calcOptimumSplit() // Calculate the sum of the target variables and the sum of // the target variables squared. We use these later. for(unsigned int i=0; idata[0]; SUM += target; SSUM += target*target; - } + } unsigned int numVars = events.size(); // Calculate the best split point for each variable for(unsigned int variableToCheck = 1; variableToCheck < numVars; variableToCheck++) - { + { // The sum of the target variables in the left, right nodes double SUMleft = 0; @@ -255,15 +255,15 @@ void Node::calcOptimumSplit() std::vector& v = events[variableToCheck]; - // Find the best split point for this variable + // Find the best split point for this variable for(unsigned int i=1; idata[0]; SUMright = SUMright - v[i-1]->data[0]; - + // No need to check the split point if x on both sides is equal if(v[i-1]->data[candidateSplitVariable] < v[i]->data[candidateSplitVariable]) { @@ -271,7 +271,7 @@ void Node::calcOptimumSplit() // the following statement. candidateErrorReduction = SUMleft*SUMleft/nleft + SUMright*SUMright/nright - SUM*SUM/numEvents; // std::cout << "candidateErrorReduction= " << candidateErrorReduction << std::endl << std::endl; - + // if the new candidate is better than the current best, then we have a new overall best. if(candidateErrorReduction > bestErrorReduction) { @@ -285,7 +285,7 @@ void Node::calcOptimumSplit() nleft = nleft+1; } } - + // Store the information gained from our computations. // The fit value is the average for least squares. @@ -299,7 +299,7 @@ void Node::calcOptimumSplit() // [ -k^2 ] avgError = totalError/numEvents; // std::cout << "avgError= " << avgError << std::endl; - + errorReduction = bestErrorReduction; // std::cout << "errorReduction= " << errorReduction << std::endl; @@ -320,21 +320,21 @@ void Node::listEvents() std::cout << std::endl << "Listing Events... " << std::endl; for(unsigned int i=0; i < events.size(); i++) - { + { std::cout << std::endl << "Variable " << i << " vector contents: " << std::endl; for(unsigned int j=0; j < events[i].size(); j++) - { + { events[i][j]->outputEvent(); - } + } std::cout << std::endl; - } + } } // ---------------------------------------------------------------------- void Node::theMiracleOfChildBirth() -{ - // Create Daughter Nodes +{ + // Create Daughter Nodes Node* left = new Node(name + " left"); Node* right = new Node(name + " right"); @@ -342,7 +342,7 @@ void Node::theMiracleOfChildBirth() leftDaughter = left; rightDaughter = right; left->setParent(this); - right->setParent(this); + right->setParent(this); } // ---------------------------------------------------------------------- @@ -359,7 +359,7 @@ void Node::filterEventsToDaughters() // Anyways, this function takes events from the parent node // and filters an event into the left or right daughter // node depending on whether it is < or > the split point -// for the given split variable. +// for the given split variable. int sv = splitVariable; double sp = splitValue; @@ -380,10 +380,10 @@ void Node::filterEventsToDaughters() } } - events = std::vector< std::vector >(); + events = std::vector< std::vector >(); left->getEvents().swap(l); - right->getEvents().swap(r); + right->getEvents().swap(r); // Set the number of events in the node. left->setNumEvents(left->getEvents()[0].size()); @@ -397,7 +397,7 @@ Node* Node::filterEventToDaughter(Event* e) // Anyways, this function takes an event from the parent node // and filters an event into the left or right daughter // node depending on whether it is < or > the split point -// for the given split variable. +// for the given split variable. int sv = splitVariable; double sp = splitValue; @@ -410,6 +410,6 @@ Node* Node::filterEventToDaughter(Event* e) if(e->data[sv] < sp) nextNode = left; if(e->data[sv] >= sp) nextNode = right; - + return nextNode; } diff --git a/L1Trigger/L1TMuonEndCap/src/bdt/Tree.cc b/L1Trigger/L1TMuonEndCap/src/bdt/Tree.cc index 05f08bb286b07..db7a399db50d5 100644 --- a/L1Trigger/L1TMuonEndCap/src/bdt/Tree.cc +++ b/L1Trigger/L1TMuonEndCap/src/bdt/Tree.cc @@ -7,7 +7,7 @@ // Tibshirani, and Friedman. // // *Greedy Function Approximation: A Gradient Boosting Machine. // // Friedman. The Annals of Statistics, Vol. 29, No. 5. Oct 2001. // -// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // +// *Inductive Learning of Tree-based Regression Models. Luis Torgo. // // // ////////////////////////////////////////////////////////////////////////// @@ -155,7 +155,7 @@ void Tree::setRootNode(Node *sRootNode) { rootNode = sRootNode; } - + Node * Tree::getRootNode() { return rootNode; @@ -184,19 +184,19 @@ int Tree::getNumTerminalNodes() // ______________________Performace_____________________________________// ////////////////////////////////////////////////////////////////////////// -void Tree::calcError() -{ -// Loop through the separate predictive regions (terminal nodes) and -// add up the errors to get the error of the entire space. - - double totalSquaredError = 0; - - for(std::list::iterator it=terminalNodes.begin(); it!=terminalNodes.end(); it++) - { - totalSquaredError += (*it)->getTotalError(); - } - rmsError = sqrt( totalSquaredError/rootNode->getNumEvents() ); -} +void Tree::calcError() +{ +// Loop through the separate predictive regions (terminal nodes) and +// add up the errors to get the error of the entire space. + + double totalSquaredError = 0; + + for(std::list::iterator it=terminalNodes.begin(); it!=terminalNodes.end(); it++) + { + totalSquaredError += (*it)->getTotalError(); + } + rmsError = sqrt( totalSquaredError/rootNode->getNumEvents() ); +} // ---------------------------------------------------------------------- @@ -207,20 +207,20 @@ void Tree::buildTree(int nodeLimit) Node* nodeToSplit = nullptr; if(numTerminalNodes == 1) - { + { rootNode->calcOptimumSplit(); calcError(); // std::cout << std::endl << " " << numTerminalNodes << " Nodes : " << rmsError << std::endl; } for(std::list::iterator it=terminalNodes.begin(); it!=terminalNodes.end(); it++) - { - if( (*it)->getErrorReduction() > bestNodeErrorReduction ) - { + { + if( (*it)->getErrorReduction() > bestNodeErrorReduction ) + { bestNodeErrorReduction = (*it)->getErrorReduction(); nodeToSplit = (*it); - } - } + } + } //std::cout << "nodeToSplit size = " << nodeToSplit->getNumEvents() << std::endl; @@ -233,7 +233,7 @@ void Tree::buildTree(int nodeLimit) // Get left and right daughters for reference. Node* left = nodeToSplit->getLeftDaughter(); Node* right = nodeToSplit->getRightDaughter(); - + // Update the list of terminal nodes. terminalNodes.remove(nodeToSplit); terminalNodes.push_back(left); @@ -241,7 +241,7 @@ void Tree::buildTree(int nodeLimit) numTerminalNodes++; // Filter the events from the parent into the daughters. - nodeToSplit->filterEventsToDaughters(); + nodeToSplit->filterEventsToDaughters(); // Calculate the best splits for the new nodes. left->calcOptimumSplit(); @@ -249,7 +249,7 @@ void Tree::buildTree(int nodeLimit) // See if the error reduces as we add more nodes. calcError(); - + if(numTerminalNodes % 1 == 0) { // std::cout << " " << numTerminalNodes << " Nodes : " << rmsError << std::endl; @@ -349,7 +349,7 @@ void Tree::rankVariablesRecursive(Node* node, std::vector& v) v[sv] += er; rankVariablesRecursive(left, v); - rankVariablesRecursive(right, v); + rankVariablesRecursive(right, v); } @@ -387,7 +387,7 @@ void Tree::getSplitValuesRecursive(Node* node, std::vector>& v[sv].push_back(sp); getSplitValuesRecursive(left, v); - getSplitValuesRecursive(right, v); + getSplitValuesRecursive(right, v); } @@ -416,7 +416,7 @@ std::string numToStr( T num ) void Tree::addXMLAttributes(TXMLEngine* xml, Node* node, XMLNodePointer_t np) { - // Convert Node members into XML attributes + // Convert Node members into XML attributes // and add them to the XMLEngine. xml->NewAttr(np, nullptr, "splitVar", numToStr(node->getSplitVariable()).c_str()); xml->NewAttr(np, nullptr, "splitVal", numToStr(node->getSplitValue()).c_str()); @@ -458,7 +458,7 @@ void Tree::saveToXMLRecursive(TXMLEngine* xml, Node* node, XMLNodePointer_t np) if(l==nullptr || r==nullptr) return; - // Add children to the XMLEngine. + // Add children to the XMLEngine. XMLNodePointer_t left = xml->NewChild(np, nullptr, "left"); XMLNodePointer_t right = xml->NewChild(np, nullptr, "right"); @@ -474,7 +474,7 @@ void Tree::saveToXMLRecursive(TXMLEngine* xml, Node* node, XMLNodePointer_t np) // ---------------------------------------------------------------------- void Tree::loadFromXML(const char* filename) -{ +{ // First create the engine. TXMLEngine* xml = new TXMLEngine; @@ -483,7 +483,7 @@ void Tree::loadFromXML(const char* filename) if (xmldoc==nullptr) { delete xml; - return; + return; } // Get access to main node of the xml file. @@ -505,7 +505,7 @@ void Tree::loadFromXML(const char* filename) } // Recursively connect nodes together. loadFromXMLRecursive(xml, mainnode, rootNode); - + // Release memory before exit xml->FreeDoc(xmldoc); delete xml; @@ -513,7 +513,7 @@ void Tree::loadFromXML(const char* filename) // ---------------------------------------------------------------------- -void Tree::loadFromXMLRecursive(TXMLEngine* xml, XMLNodePointer_t xnode, Node* tnode) +void Tree::loadFromXMLRecursive(TXMLEngine* xml, XMLNodePointer_t xnode, Node* tnode) { // Get the split information from xml. @@ -525,21 +525,21 @@ void Tree::loadFromXMLRecursive(TXMLEngine* xml, XMLNodePointer_t xnode, Node* t if(i==3 || i==4 || i==6){ splitInfo[j++] = xml->GetAttrValue(attr); } - attr = xml->GetNextAttr(attr); + attr = xml->GetNextAttr(attr); } } else { for(unsigned int i=0; i<3; i++) { - splitInfo[i] = xml->GetAttrValue(attr); - attr = xml->GetNextAttr(attr); + splitInfo[i] = xml->GetAttrValue(attr); + attr = xml->GetNextAttr(attr); } } - + // Convert strings into numbers. std::stringstream converter; int splitVar; double splitVal; - double fitVal; + double fitVal; converter << splitInfo[0]; converter >> splitVar; @@ -561,7 +561,7 @@ void Tree::loadFromXMLRecursive(TXMLEngine* xml, XMLNodePointer_t xnode, Node* t tnode->setSplitValue(splitVal); tnode->setFitValue(fitVal); - // Get the xml daughters of the current xml node. + // Get the xml daughters of the current xml node. XMLNodePointer_t xleft = xml->GetChild(xnode); XMLNodePointer_t xright = xml->GetNext(xleft); diff --git a/L1Trigger/L1TMuonEndCap/src/bdt/Utilities.cc b/L1Trigger/L1TMuonEndCap/src/bdt/Utilities.cc index b298b6c1dc127..0db4a88a14f8d 100644 --- a/L1Trigger/L1TMuonEndCap/src/bdt/Utilities.cc +++ b/L1Trigger/L1TMuonEndCap/src/bdt/Utilities.cc @@ -49,7 +49,7 @@ const std::vector emtf::twoJetsScale = std::vector(twoJets_scale float processPrediction(float BDTPt, int Quality, float PrelimFit) { -// Discretize and scale the BDTPt prediction +// Discretize and scale the BDTPt prediction // Fix terrible predictions diff --git a/L1Trigger/L1TMuonEndCap/test/unittests/TestPhiMemoryImage.cpp b/L1Trigger/L1TMuonEndCap/test/unittests/TestPhiMemoryImage.cpp index fda57031f2239..9b97e706c077c 100644 --- a/L1Trigger/L1TMuonEndCap/test/unittests/TestPhiMemoryImage.cpp +++ b/L1Trigger/L1TMuonEndCap/test/unittests/TestPhiMemoryImage.cpp @@ -110,7 +110,7 @@ void TestPhiMemoryImage::test_rotation() CPPUNIT_ASSERT_EQUAL(image.get_word(0, 0), (word1 << (i-128)) | (word0 >> (192-i))); else CPPUNIT_ASSERT_EQUAL(image.get_word(0, 0), (word0)); - + image.rotr(i); CPPUNIT_ASSERT_EQUAL(image.get_word(0, 0), word0); diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsObjectKeysOnline_cfi.py index c8f46c0362d71..9c7c73bb96797 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsObjectKeysOnline_cfi.py @@ -2,7 +2,8 @@ L1TCaloParamsObjectKeysOnline = cms.ESProducer("L1TCaloParamsObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('CALO'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('CALO'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsOnline_cfi.py index e65a52e1775e4..cf28a10c10586 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsOnline_cfi.py @@ -7,7 +7,7 @@ l1caloparProtodb = cms.ESSource("PoolDBESSource", CondDB, - toGet = cms.VPSet( + toGet = cms.VPSet( cms.PSet( record = cms.string('L1TCaloParamsRcd'), tag = cms.string("L1TCaloParamsPrototype_Stage2v0_hlt") @@ -17,8 +17,9 @@ L1TCaloParamsOnlineProd = cms.ESProducer("L1TCaloParamsOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), - exclusiveLayer = cms.uint32(0) + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + exclusiveLayer = cms.uint32(0), # process both layers by default + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosObjectKeysOnline_cfi.py index 8bfa5b5cee4be..8062a0bde84da 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosObjectKeysOnline_cfi.py @@ -2,7 +2,8 @@ L1TGlobalPrescalesVetosObjectKeysOnline = cms.ESProducer("L1TGlobalPrescalesVetosObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('uGTrs'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('uGTrs'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py index f04d66219b749..370e13123736f 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TGlobalPrescalesVetosOnline_cfi.py @@ -4,7 +4,7 @@ L1TGlobalPrescalesVetosOnlineProd = cms.ESProducer("L1TGlobalPrescalesVetosOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), - xmlModel = cms.int32(2017) + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelObjectKeysOnline_cfi.py index 311903d477102..0490d17698061 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelObjectKeysOnline_cfi.py @@ -2,6 +2,7 @@ L1TMuonBarrelObjectKeysOnline = cms.ESProducer("L1TMuonBarrelObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('BMTF'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('BMTF'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelParamsOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelParamsOnline_cfi.py index 482513400d504..40cba5ceda053 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelParamsOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonBarrelParamsOnline_cfi.py @@ -7,16 +7,17 @@ l1bmtfparProtodb = cms.ESSource("PoolDBESSource", CondDB, - toGet = cms.VPSet( + toGet = cms.VPSet( cms.PSet( record = cms.string('L1TMuonBarrelParamsRcd'), - tag = cms.string("L1TMuonBarrelParamsPrototype_Stage2v0_hlt") + tag = cms.string("L1TMuonBarrelParamsPrototype_Stage2v0_hlt") ) ) ) L1TMuonBarrelParamsOnlineProd = cms.ESProducer("L1TMuonBarrelParamsOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnlineProxy_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnlineProxy_cfi.py index c89ef79d56005..d26aff68cca30 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnlineProxy_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnlineProxy_cfi.py @@ -1,5 +1,18 @@ import FWCore.ParameterSet.Config as cms -from L1Trigger.L1TMuonEndCap.fakeEmtfParams_cff import * +#from L1Trigger.L1TMuonEndCap.fakeEmtfParams_cff import * + +from CondCore.CondDB.CondDB_cfi import CondDB +CondDB.connect = cms.string('oracle://cms_orcon_prod/CMS_CONDITIONS') + +l1emtfForestProtodb = cms.ESSource("PoolDBESSource", + CondDB, + toGet = cms.VPSet( + cms.PSet( + record = cms.string('L1TMuonEndCapForestRcd'), + tag = cms.string('L1TMuonEndCapForest_static_Sq_20170613_v7_mc') + ) + ) +) L1TMuonEndCapForestOnlineProxy = cms.ESProducer("L1TMuonEndCapForestOnlineProxy") diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py index 1cfec9e2c201f..0316799fe1f1f 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapForestOnline_cfi.py @@ -4,6 +4,7 @@ L1TMuonEndCapForestOnlineProd = cms.ESProducer("L1TMuonEndCapForestOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapObjectKeysOnline_cfi.py new file mode 100644 index 0000000000000..60665869c15c3 --- /dev/null +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapObjectKeysOnline_cfi.py @@ -0,0 +1,8 @@ +import FWCore.ParameterSet.Config as cms + +L1TMuonEndCapObjectKeysOnline = cms.ESProducer("L1TMuonEndCapObjectKeysOnlineProd", + onlineAuthentication = cms.string('.'), + subsystemLabel = cms.string('EMTF'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what +) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnlineProxy_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnlineProxy_cfi.py deleted file mode 100644 index f8cbe5669ea84..0000000000000 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnlineProxy_cfi.py +++ /dev/null @@ -1,9 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -#from L1Trigger.L1TMuonEndcap.fakeEmtfParams_cff import * - -L1TMuonEndCapParamsOnlineProxy = cms.ESProducer("L1TMuonEndCapParamsOnlineProxy", - PtAssignVersion = cms.untracked.uint32(1), - firmwareVersion = cms.untracked.uint32(47423), - changeDate = cms.untracked.uint32(20161101) -) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnline_cfi.py index 530ea4ec8a507..2fd81b7509384 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndCapParamsOnline_cfi.py @@ -7,16 +7,17 @@ l1emtfparProtodb = cms.ESSource("PoolDBESSource", CondDB, - toGet = cms.VPSet( + toGet = cms.VPSet( cms.PSet( record = cms.string('L1TMuonEndCapParamsRcd'), - tag = cms.string('L1TMuonEndCapParamsPrototype_Stage2v0_hlt') + tag = cms.string('L1TMuonEndCapParamsPrototype_Stage2v0_hlt') ) ) ) L1TMuonEndCapParamsOnlineProd = cms.ESProducer("L1TMuonEndCapParamsOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndcapObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndcapObjectKeysOnline_cfi.py deleted file mode 100644 index 69f59c95d371f..0000000000000 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonEndcapObjectKeysOnline_cfi.py +++ /dev/null @@ -1,7 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -L1TMuonEndcapObjectKeysOnline = cms.ESProducer("L1TMuonEndcapObjectKeysOnlineProd", - onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('EMTF'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') -) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalObjectKeysOnline_cfi.py index 03e8c26ecc6ee..a382e0e72d593 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalObjectKeysOnline_cfi.py @@ -2,7 +2,8 @@ L1TMuonGlobalObjectKeysOnline = cms.ESProducer("L1TMuonGlobalObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('uGMT'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('uGMT'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # any value has no effect on this particular producer ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalParamsOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalParamsOnline_cfi.py index 9d141a9a84c93..c753bbbbe2d34 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalParamsOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonGlobalParamsOnline_cfi.py @@ -7,16 +7,17 @@ l1gmtparProtodb = cms.ESSource("PoolDBESSource", CondDB, - toGet = cms.VPSet( + toGet = cms.VPSet( cms.PSet( record = cms.string('L1TMuonGlobalParamsRcd'), - tag = cms.string('L1TMuonGlobalParamsPrototype_Stage2v0_hlt') + tag = cms.string('L1TMuonGlobalParamsPrototype_Stage2v0_hlt') ) ) ) L1TMuonGlobalParamsOnlineProd = cms.ESProducer("L1TMuonGlobalParamsOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapObjectKeysOnline_cfi.py index eaf9fd5f2f632..7f8213d3ba704 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapObjectKeysOnline_cfi.py @@ -2,6 +2,7 @@ L1TMuonOverlapObjectKeysOnline = cms.ESProducer("L1TMuonOverlapObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('OMTF'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('OMTF'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapParamsOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapParamsOnline_cfi.py index cbdde13313ccb..f1d509f1d584c 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapParamsOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapParamsOnline_cfi.py @@ -2,6 +2,7 @@ L1TMuonOverlapParamsOnlineProd = cms.ESProducer("L1TMuonOverlapParamsOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuObjectKeysOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuObjectKeysOnline_cfi.py index eaa680e229db0..0778ac264a4ec 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuObjectKeysOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuObjectKeysOnline_cfi.py @@ -2,7 +2,8 @@ L1TUtmTriggerMenuObjectKeysOnline = cms.ESProducer("L1TUtmTriggerMenuObjectKeysOnlineProd", onlineAuthentication = cms.string('.'), - subsystemLabel = cms.string('uGT'), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + subsystemLabel = cms.string('uGT'), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + # menu producer must be transaction safe otherwise everyone is screwed ) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuOnline_cfi.py index ae0744c66d810..77118c6f732b2 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TUtmTriggerMenuOnline_cfi.py @@ -2,6 +2,7 @@ L1TUtmTriggerMenuOnlineProd = cms.ESProducer("L1TUtmTriggerMenuOnlineProd", onlineAuthentication = cms.string('.'), - forceGeneration = cms.bool(False), - onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R') + # menu producer must be transaction safe otherwise everyone is screwed ) diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc index cc3852419ead5..da9fc4050a8fa 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TCaloParamsOnlineProd.cc @@ -20,16 +20,17 @@ using namespace XERCES_CPP_NAMESPACE; class L1TCaloParamsOnlineProd : public L1ConfigOnlineProdBaseExt { private: unsigned int exclusiveLayer; // 0 - process calol1 and calol2, 1 - only calol1, 2 - only calol2 + bool transactionSafe; bool readCaloLayer1OnlineSettings(l1t::CaloParamsHelperO2O& paramsHelper, std::map& conf, std::map& ); bool readCaloLayer2OnlineSettings(l1t::CaloParamsHelperO2O& paramsHelper, std::map& conf, std::map& ); public: - virtual std::shared_ptr newObject(const std::string& objectKey, const L1TCaloParamsO2ORcd& record) override ; + std::shared_ptr newObject(const std::string& objectKey, const L1TCaloParamsO2ORcd& record) override ; L1TCaloParamsOnlineProd(const edm::ParameterSet&); - ~L1TCaloParamsOnlineProd(void){} + ~L1TCaloParamsOnlineProd(void) override{} }; bool @@ -50,7 +51,7 @@ std::map& ) { }; for (const auto param : expectedParams) { if ( conf.find(param) == conf.end() ) { - std::cerr << "Unable to locate expected CaloLayer1 parameter: " << param << " in L1 settings payload!"; + edm::LogError("L1-O2O: L1TCaloParamsOnlineProd") << "Unable to locate expected CaloLayer1 parameter: " << param << " in L1 settings payload!"; return false; } } @@ -114,7 +115,7 @@ std::map& ) { }; for (const auto param : expectedParams) { if ( conf.find(param) == conf.end() ) { - std::cerr << "Unable to locate expected CaloLayer2 parameter: " << param << " in L1 settings payload!"; + edm::LogError("L1-O2O: L1TCaloParamsOnlineProd") << "Unable to locate expected CaloLayer2 parameter: " << param << " in L1 settings payload!"; return false; } } @@ -188,7 +189,8 @@ std::map& ) { L1TCaloParamsOnlineProd::L1TCaloParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { - exclusiveLayer = iConfig.getParameter("exclusiveLayer"); + exclusiveLayer = iConfig.getParameter("exclusiveLayer"); + transactionSafe = iConfig.getParameter("transactionSafe"); } std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::string& objectKey, const L1TCaloParamsO2ORcd& record) { @@ -200,15 +202,19 @@ std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::s if( objectKey.empty() ){ - edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "Key is empty, returning empty l1t::CaloParams"; - throw std::runtime_error("Empty objectKey"); + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "Key is empty"; + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: Calo | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; + return std::make_shared< l1t::CaloParams >( *(baseSettings.product()) ) ; + } } std::string tscKey = objectKey.substr(0, objectKey.find(":") ); std::string rsKey = objectKey.substr( objectKey.find(":")+1, std::string::npos ); - edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "Producing L1TCaloParamsOnlineProd with TSC key = " << tscKey << " and RS key = " << rsKey -; + edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "Producing L1TCaloParamsOnlineProd with TSC key = " << tscKey << " and RS key = " << rsKey; std::string calol1_top_key, calol1_algo_key; std::string calol1_algo_payload; @@ -279,7 +285,12 @@ std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::s } catch ( std::runtime_error &e ) { edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: Calo | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; + return std::make_shared< l1t::CaloParams >( *(baseSettings.product()) ) ; + } } if( exclusiveLayer == 0 || exclusiveLayer == 2 ){ @@ -303,48 +314,69 @@ std::shared_ptr L1TCaloParamsOnlineProd::newObject(const std::s l1t::CaloParamsHelperO2O m_params_helper( *(baseSettings.product()) ); - if( exclusiveLayer == 0 || exclusiveLayer == 1 ){ - l1t::XmlConfigParser xmlReader1; - xmlReader1.readDOMFromString( calol1_algo_payload ); + if( exclusiveLayer == 0 || exclusiveLayer == 1 ){ + try { + l1t::XmlConfigParser xmlReader1; + xmlReader1.readDOMFromString( calol1_algo_payload ); - l1t::TriggerSystem calol1; - calol1.addProcessor("processors", "processors","-1","-1"); - xmlReader1.readRootElement( calol1, "calol1" ); - calol1.setConfigured(); + l1t::TriggerSystem calol1; + calol1.addProcessor("processors", "processors","-1","-1"); + xmlReader1.readRootElement( calol1, "calol1" ); + calol1.setConfigured(); - std::map calol1_conf = calol1.getParameters("processors"); - std::map calol1_rs ;//= calol1.getMasks ("processors"); - - if( !readCaloLayer1OnlineSettings(m_params_helper, calol1_conf, calol1_rs) ) - throw std::runtime_error("Parsing error for CaloLayer1"); - } + std::map calol1_conf = calol1.getParameters("processors"); + std::map calol1_rs ;//= calol1.getMasks ("processors"); + if( !readCaloLayer1OnlineSettings(m_params_helper, calol1_conf, calol1_rs) ) + throw std::runtime_error("Parsing error for CaloLayer1"); - if( exclusiveLayer == 0 || exclusiveLayer == 2 ){ - l1t::TriggerSystem calol2; - - l1t::XmlConfigParser xmlReader2; - xmlReader2.readDOMFromString( calol2_hw_payload ); - xmlReader2.readRootElement( calol2, "calol2" ); - - for(auto &conf : calol2_algo_payloads){ - xmlReader2.readDOMFromString( conf.second ); - xmlReader2.readRootElement( calol2, "calol2" ); + } catch ( std::runtime_error &e ){ + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: Calo | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; + return std::make_shared< l1t::CaloParams >( *(baseSettings.product()) ) ; + } + } } -// calol2.setSystemId("calol2"); - calol2.setConfigured(); - // Perhaps layer 2 has to look at settings for demux and mp separately? // => No demux settings required - std::map calol2_conf = calol2.getParameters("MP1"); - std::map calol2_rs ;//= calol2.getMasks ("processors"); - - if( !readCaloLayer2OnlineSettings(m_params_helper, calol2_conf, calol2_rs) ) - throw std::runtime_error("Parsing error for CaloLayer2"); - } + if( exclusiveLayer == 0 || exclusiveLayer == 2 ){ + try { + l1t::TriggerSystem calol2; + l1t::XmlConfigParser xmlReader2; + xmlReader2.readDOMFromString( calol2_hw_payload ); + xmlReader2.readRootElement( calol2, "calol2" ); + + for(auto &conf : calol2_algo_payloads){ + xmlReader2.readDOMFromString( conf.second ); + xmlReader2.readRootElement( calol2, "calol2" ); + } + +// calol2.setSystemId("calol2"); + calol2.setConfigured(); + + std::map calol2_conf = calol2.getParameters("MP1"); + std::map calol2_rs ;//= calol2.getMasks ("processors"); + + if( !readCaloLayer2OnlineSettings(m_params_helper, calol2_conf, calol2_rs) ) + throw std::runtime_error("Parsing error for CaloLayer2"); + + } catch ( std::runtime_error &e ){ + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: Calo | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TCaloParamsOnlineProd" ) << "returning unmodified prototype of l1t::CaloParams"; + return std::make_shared< l1t::CaloParams >( *(baseSettings.product()) ) ; + } + } + } - std::shared_ptr< l1t::CaloParams > retval = std::make_shared< l1t::CaloParams >( m_params_helper ) ; + + edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "SummaryForFunctionManager: Calo | OK | All looks good"; return retval; } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc index 5f0cbcac58b4b..b13fc0d0efb0a 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TGlobalPrescalesVetosOnlineProd.cc @@ -27,16 +27,16 @@ class L1TGlobalPrescalesVetosOnlineProd : public L1ConfigOnlineProdBaseExt { private: - int xmlModel; + bool transactionSafe; public: - virtual std::shared_ptr newObject(const std::string& objectKey, const L1TGlobalPrescalesVetosO2ORcd& record) override ; + std::shared_ptr newObject(const std::string& objectKey, const L1TGlobalPrescalesVetosO2ORcd& record) override ; L1TGlobalPrescalesVetosOnlineProd(const edm::ParameterSet&); - ~L1TGlobalPrescalesVetosOnlineProd(void){} + ~L1TGlobalPrescalesVetosOnlineProd(void) override{} }; L1TGlobalPrescalesVetosOnlineProd::L1TGlobalPrescalesVetosOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { - xmlModel = iConfig.getParameter("xmlModel"); + transactionSafe = iConfig.getParameter("transactionSafe"); } std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newObject(const std::string& objectKey, const L1TGlobalPrescalesVetosO2ORcd& record) { @@ -45,8 +45,12 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO edm::LogInfo( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "Producing L1TGlobalPrescalesVetos with TSC:RS key = " << objectKey ; if( objectKey.empty() ){ - edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "Key is empty"; - throw std::runtime_error("Empty objecKey"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; + } } unsigned int m_numberPhysTriggers = 512; @@ -59,8 +63,6 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO std::string stage2Schema = "CMS_TRG_L1_CONF" ; - if( xmlModel > 2016 ){ - std::string l1_menu_key; std::vector< std::string > queryStrings ; queryStrings.push_back( "L1_MENU" ) ; @@ -76,7 +78,12 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){ edm::LogError( "L1-O2O" ) << "Cannot get UGT_KEYS.L1_MENU for ID = " << uGTtscKey << " " ; - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; + } } if( !queryResult.fillVariable( "L1_MENU", l1_menu_key) ) l1_menu_key = ""; @@ -85,7 +92,12 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO if( uGTtscKey.empty() ){ edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "TSC key is empty, returning"; - throw std::runtime_error("Empty objectKey"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; + } } std::vector< std::string > queryColumns; @@ -101,7 +113,12 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){ edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "Cannot get UGT_L1_MENU.CONF for ID = " << l1_menu_key; - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGTrs | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; + } } std::string l1Menu; @@ -118,14 +135,11 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO for(auto algo : pMenu->getAlgorithmMap()) algoName2bit[algo.first] = algo.second.getIndex(); - } else { // xmlModel <= 2016 - // identity - for(unsigned int algoBit = 0; algoBit < m_numberPhysTriggers; algoBit++) - algoName2bit[std::to_string(algoBit)] = algoBit; - } - std::vector< std::string > queryColumns; + + ///std::vector< std::string > queryColumns; + queryColumns.clear(); queryColumns.push_back( "ALGOBX_MASK" ) ; queryColumns.push_back( "ALGO_FINOR_MASK" ) ; queryColumns.push_back( "ALGO_FINOR_VETO" ) ; @@ -145,7 +159,12 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO xmlPayload_mask_veto = l1t::OnlineDBqueryHelper::fetch( {"CONF"}, "UGT_RS_CLOBS", vetomask_key, m_omdsReader )["CONF"]; } catch ( std::runtime_error &e ) { edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: uGTrs | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; + } } @@ -170,136 +189,162 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO std::vector triggerVetoMasks; std::map > triggerAlgoBxMaskAlgoTrig; - // Prescales - l1t::XmlConfigParser xmlReader_prescale; - l1t::TriggerSystem ts_prescale; - ts_prescale.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); - - // run the parser - xmlReader_prescale.readDOMFromString( xmlPayload_prescale ); // initialize it - xmlReader_prescale.readRootElement( ts_prescale, "uGT" ); // extract all of the relevant context - ts_prescale.setConfigured(); - - const std::map &settings_prescale = ts_prescale.getParameters("uGtProcessor"); - std::map prescaleColumns = settings_prescale.at("prescales").getColumnIndices(); - - unsigned int numColumns_prescale = prescaleColumns.size(); - int nPrescaleSets = numColumns_prescale - 1; - std::vector algoNames = settings_prescale.at("prescales").getTableColumn("algo/prescale-index"); - - if( nPrescaleSets > 0 ){ - // Fill default prescale set - for( int iSet=0; iSet()); - for(unsigned int iBit = 0; iBit < m_numberPhysTriggers; ++iBit ){ - int inputDefaultPrescale = 0; // only prescales that are set in the block below are used - prescales[iSet].push_back(inputDefaultPrescale); + // Prescales + try { + l1t::XmlConfigParser xmlReader_prescale; + l1t::TriggerSystem ts_prescale; + ts_prescale.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); + + // run the parser + xmlReader_prescale.readDOMFromString( xmlPayload_prescale ); // initialize it + xmlReader_prescale.readRootElement( ts_prescale, "uGT" ); // extract all of the relevant context + ts_prescale.setConfigured(); + + const std::map &settings_prescale = ts_prescale.getParameters("uGtProcessor"); + std::map prescaleColumns = settings_prescale.at("prescales").getColumnIndices(); + + unsigned int numColumns_prescale = prescaleColumns.size(); + int nPrescaleSets = numColumns_prescale - 1; + std::vector algoNames = settings_prescale.at("prescales").getTableColumn("algo/prescale-index"); + + if( nPrescaleSets > 0 ){ + // Fill default prescale set + for( int iSet=0; iSet()); + for(unsigned int iBit = 0; iBit < m_numberPhysTriggers; ++iBit ){ + int inputDefaultPrescale = 0; // only prescales that are set in the block below are used + prescales[iSet].push_back(inputDefaultPrescale); + } + } + + for(auto &col : prescaleColumns){ + if( col.second<1 ) continue; // we don't care for the algorithms' indicies in 0th column + int iSet = col.second - 1; + std::vector prescalesForSet = settings_prescale.at("prescales").getTableColumn(col.first.c_str()); + for(unsigned int row=0; row prescalesForSet = settings_prescale.at("prescales").getTableColumn(col.first.c_str()); - for(unsigned int row=0; row( ) ; } } - /////////////////////////////////////////////////////////////////////////////////////////////////////////// // finor mask - l1t::XmlConfigParser xmlReader_mask_finor; - l1t::TriggerSystem ts_mask_finor; - ts_mask_finor.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); - - // run the parser - xmlReader_mask_finor.readDOMFromString( xmlPayload_mask_finor ); // initialize it - xmlReader_mask_finor.readRootElement( ts_mask_finor, "uGT" ); // extract all of the relevant context - ts_mask_finor.setConfigured(); - - const std::map& settings_mask_finor = ts_mask_finor.getParameters("uGtProcessor"); - - std::vector algo_mask_finor = settings_mask_finor.at("finorMask").getTableColumn("algo"); - std::vector mask_mask_finor = settings_mask_finor.at("finorMask").getTableColumn("mask"); - - // mask (default=1 - unmask) - unsigned int default_finor_mask = 1; - auto default_finor_row = - std::find_if( algo_mask_finor.cbegin(), - algo_mask_finor.cend(), - [] (const std::string &s){ - // simpler than overweight std::tolower(s[], std::locale()) POSIX solution (thx to BA): - return strcasecmp("all", s.c_str()) == 0; - } - ); - if( default_finor_row == algo_mask_finor.cend() ){ - edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) - << "\nWarning: No default found in FinOR mask xml, use 1 (unmasked) as default" - << std::endl; - } else { - default_finor_mask = mask_mask_finor[ std::distance( algo_mask_finor.cbegin(), default_finor_row ) ]; - } + try { + l1t::XmlConfigParser xmlReader_mask_finor; + l1t::TriggerSystem ts_mask_finor; + ts_mask_finor.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); + + // run the parser + xmlReader_mask_finor.readDOMFromString( xmlPayload_mask_finor ); // initialize it + xmlReader_mask_finor.readRootElement( ts_mask_finor, "uGT" ); // extract all of the relevant context + ts_mask_finor.setConfigured(); + + const std::map& settings_mask_finor = ts_mask_finor.getParameters("uGtProcessor"); + + std::vector algo_mask_finor = settings_mask_finor.at("finorMask").getTableColumn("algo"); + std::vector mask_mask_finor = settings_mask_finor.at("finorMask").getTableColumn("mask"); + + // mask (default=1 - unmask) + unsigned int default_finor_mask = 1; + auto default_finor_row = + std::find_if( algo_mask_finor.cbegin(), + algo_mask_finor.cend(), + [] (const std::string &s){ + // simpler than overweight std::tolower(s[], std::locale()) POSIX solution (thx to BA): + return strcasecmp("all", s.c_str()) == 0; + } + ); + if( default_finor_row == algo_mask_finor.cend() ){ + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) + << "\nWarning: No default found in FinOR mask xml, use 1 (unmasked) as default" + << std::endl; + } else { + default_finor_mask = mask_mask_finor[ std::distance( algo_mask_finor.cbegin(), default_finor_row ) ]; + } - for( unsigned int iAlg=0; iAlg < m_numberPhysTriggers; iAlg++ ) - triggerMasks.push_back(default_finor_mask); + for( unsigned int iAlg=0; iAlg < m_numberPhysTriggers; iAlg++ ) + triggerMasks.push_back(default_finor_mask); - for(unsigned int row=0; row( ) ; + } } /////////////////////////////////////////////////////////////////////////////////////////////////////////// // veto mask - l1t::XmlConfigParser xmlReader_mask_veto; - l1t::TriggerSystem ts_mask_veto; - ts_mask_veto.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); - - // run the parser - xmlReader_mask_veto.readDOMFromString( xmlPayload_mask_veto ); // initialize it - xmlReader_mask_veto.readRootElement( ts_mask_veto, "uGT" ); // extract all of the relevant context - ts_mask_veto.setConfigured(); - - const std::map& settings_mask_veto = ts_mask_veto.getParameters("uGtProcessor"); - std::vector algo_mask_veto = settings_mask_veto.at("vetoMask").getTableColumn("algo"); - std::vector veto_mask_veto = settings_mask_veto.at("vetoMask").getTableColumn("veto"); - - // veto mask (default=0 - no veto) - unsigned int default_veto_mask = 1; - auto default_veto_row = - std::find_if( algo_mask_veto.cbegin(), - algo_mask_veto.cend(), - [] (const std::string &s){ - // simpler than overweight std::tolower(s[], std::locale()) POSIX solution (thx to BA): - return strcasecmp("all", s.c_str()) == 0; - } - ); - if( default_veto_row == algo_mask_veto.cend() ){ - edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) - << "\nWarning: No default found in Veto mask xml, use 0 (unvetoed) as default" - << std::endl; - } else { - default_veto_mask = veto_mask_veto[ std::distance( algo_mask_veto.cbegin(), default_veto_row ) ]; - } + try { + l1t::XmlConfigParser xmlReader_mask_veto; + l1t::TriggerSystem ts_mask_veto; + ts_mask_veto.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); + + // run the parser + xmlReader_mask_veto.readDOMFromString( xmlPayload_mask_veto ); // initialize it + xmlReader_mask_veto.readRootElement( ts_mask_veto, "uGT" ); // extract all of the relevant context + ts_mask_veto.setConfigured(); + + const std::map& settings_mask_veto = ts_mask_veto.getParameters("uGtProcessor"); + std::vector algo_mask_veto = settings_mask_veto.at("vetoMask").getTableColumn("algo"); + std::vector veto_mask_veto = settings_mask_veto.at("vetoMask").getTableColumn("veto"); + + // veto mask (default=0 - no veto) + unsigned int default_veto_mask = 1; + auto default_veto_row = + std::find_if( algo_mask_veto.cbegin(), + algo_mask_veto.cend(), + [] (const std::string &s){ + // simpler than overweight std::tolower(s[], std::locale()) POSIX solution (thx to BA): + return strcasecmp("all", s.c_str()) == 0; + } + ); + if( default_veto_row == algo_mask_veto.cend() ){ + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) + << "\nWarning: No default found in Veto mask xml, use 0 (unvetoed) as default" + << std::endl; + } else { + default_veto_mask = veto_mask_veto[ std::distance( algo_mask_veto.cbegin(), default_veto_row ) ]; + } - for( unsigned int iAlg=0; iAlg < m_numberPhysTriggers; iAlg++ ) - triggerVetoMasks.push_back(default_veto_mask); + for( unsigned int iAlg=0; iAlg < m_numberPhysTriggers; iAlg++ ) + triggerVetoMasks.push_back(default_veto_mask); - for(unsigned int row=0; row( ) ; + } } /////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -307,21 +352,33 @@ std::shared_ptr L1TGlobalPrescalesVetosOnlineProd::newO // Algo bx mask unsigned int m_bx_mask_default = 1; -if( xmlModel > 2016 ){ - l1t::XmlConfigParser xmlReader_mask_algobx; - l1t::TriggerSystem ts_mask_algobx; - ts_mask_algobx.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); + std::vector bx_algo_name; + std::vector bx_range; + std::vector bx_mask; - // run the parser - xmlReader_mask_algobx.readDOMFromString( xmlPayload_mask_algobx ); // initialize it - xmlReader_mask_algobx.readRootElement( ts_mask_algobx, "uGT" ); // extract all of the relevant context - ts_mask_algobx.setConfigured(); - - const std::map& settings_mask_algobx = ts_mask_algobx.getParameters("uGtProcessor"); - std::vector bx_algo_name = settings_mask_algobx.at("algorithmBxMask").getTableColumn("algo"); - std::vector bx_range = settings_mask_algobx.at("algorithmBxMask").getTableColumn("range"); - std::vector bx_mask = settings_mask_algobx.at("algorithmBxMask").getTableColumn("mask"); + try { + l1t::XmlConfigParser xmlReader_mask_algobx; + l1t::TriggerSystem ts_mask_algobx; + ts_mask_algobx.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); + + // run the parser + xmlReader_mask_algobx.readDOMFromString( xmlPayload_mask_algobx ); // initialize it + xmlReader_mask_algobx.readRootElement( ts_mask_algobx, "uGT" ); // extract all of the relevant context + ts_mask_algobx.setConfigured(); + + const std::map& settings_mask_algobx = ts_mask_algobx.getParameters("uGtProcessor"); + bx_algo_name = settings_mask_algobx.at("algorithmBxMask").getTableColumn("algo"); + bx_range = settings_mask_algobx.at("algorithmBxMask").getTableColumn("range"); + bx_mask = settings_mask_algobx.at("algorithmBxMask").getTableColumn("mask"); + } catch ( std::runtime_error &e ){ + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: uGTrs | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" ) << "returning empty L1TGlobalPrescalesVetos object"; + return std::make_shared< L1TGlobalPrescalesVetos >( ) ; + } + } int default_bxmask_row = -1; typedef std::pair Range_t; @@ -361,7 +418,7 @@ if( xmlModel > 2016 ){ first = 0; last = 3563; } else { - char *dash = 0; + char *dash = nullptr; first = strtoul(s2.data(), &dash, 0); while( *dash != '\0' && *dash != '-' ) ++dash; last = (*dash != '\0' ? strtoul(++dash, &dash, 0) : first); @@ -584,33 +641,6 @@ if( xmlModel > 2016 ){ } } -} else { // xmlModel <= 2016 - - // old algo bx mask - l1t::XmlConfigParser xmlReader_mask_algobx; - l1t::TriggerSystem ts_mask_algobx; - ts_mask_algobx.addProcessor("uGtProcessor", "uGtProcessor","-1","-1"); - - // run the parser - xmlReader_mask_algobx.readDOMFromString( xmlPayload_mask_algobx ); // initialize it - xmlReader_mask_algobx.readRootElement( ts_mask_algobx, "uGT" ); // extract all of the relevant context - ts_mask_algobx.setConfigured(); - - const std::map& settings_mask_algobx = ts_mask_algobx.getParameters("uGtProcessor"); - std::map mask_algobx_columns = settings_mask_algobx.at("algorithmBxMask").getColumnIndices(); - std::vector bunches = settings_mask_algobx.at("algorithmBxMask").getTableColumn("bx/algo"); - - unsigned int numCol_mask_algobx = mask_algobx_columns.size(); - - int NumAlgoBitsInMask = numCol_mask_algobx - 1; - for( int iBit=0; iBit algo = settings_mask_algobx.at("algorithmBxMask").getTableColumn(std::to_string(iBit).c_str()); - for(unsigned int bx=0; bx 2016 ){ data_.setTriggerAlgoBxMask ( triggerAlgoBxMaskAlgoTrig ); using namespace edm::es; - std::shared_ptr payload(data_.getWriteInstance()); - return payload; + std::shared_ptr payload( std::make_shared(*data_.getWriteInstance()) ); + + edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "SummaryForFunctionManager: uGTrs | OK | All looks good"; + return payload; } //define this as a plug-in diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc index 4cbeded2c83b1..606976064a507 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonBarrelParamsOnlineProd.cc @@ -15,14 +15,17 @@ using namespace XERCES_CPP_NAMESPACE; class L1TMuonBarrelParamsOnlineProd : public L1ConfigOnlineProdBaseExt { private: + bool transactionSafe; public: - virtual std::shared_ptr newObject(const std::string& objectKey, const L1TMuonBarrelParamsO2ORcd& record) override ; + std::shared_ptr newObject(const std::string& objectKey, const L1TMuonBarrelParamsO2ORcd& record) override ; L1TMuonBarrelParamsOnlineProd(const edm::ParameterSet&); - ~L1TMuonBarrelParamsOnlineProd(void){} + ~L1TMuonBarrelParamsOnlineProd(void) override{} }; -L1TMuonBarrelParamsOnlineProd::L1TMuonBarrelParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) {} +L1TMuonBarrelParamsOnlineProd::L1TMuonBarrelParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { + transactionSafe = iConfig.getParameter("transactionSafe"); +} std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(const std::string& objectKey, const L1TMuonBarrelParamsO2ORcd& record) { using namespace edm::es; @@ -31,10 +34,14 @@ std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(co edm::ESHandle< L1TMuonBarrelParams > baseSettings ; baseRcd.get( baseSettings ) ; - if (objectKey.empty()) { edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "Key is empty, returning empty L1TMuonBarrelParams"; - throw std::runtime_error("Empty objectKey"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: BMTF | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; + return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ; + } } std::string tscKey = objectKey.substr(0, objectKey.find(":") ); @@ -94,7 +101,12 @@ std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(co } catch ( std::runtime_error &e ) { edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; + return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ; + } } @@ -123,27 +135,49 @@ std::shared_ptr L1TMuonBarrelParamsOnlineProd::newObject(co // finally, push all payloads to the XML parser and construct the TrigSystem objects with each of those l1t::XmlConfigParser xmlRdr; l1t::TriggerSystem parsedXMLs; + try { + // HW settings should always go first + xmlRdr.readDOMFromString( hw_payload ); + xmlRdr.readRootElement ( parsedXMLs ); - // HW settings should always go first - xmlRdr.readDOMFromString( hw_payload ); - xmlRdr.readRootElement ( parsedXMLs ); + // now let's parse ALGO settings + xmlRdr.readDOMFromString( algo_payload ); + xmlRdr.readRootElement ( parsedXMLs ); - // now let's parse ALGO settings - xmlRdr.readDOMFromString( algo_payload ); - xmlRdr.readRootElement ( parsedXMLs ); + // remaining RS settings + xmlRdr.readDOMFromString( mp7_payload ); + xmlRdr.readRootElement ( parsedXMLs ); - // remaining RS settings - xmlRdr.readDOMFromString( mp7_payload ); - xmlRdr.readRootElement ( parsedXMLs ); + xmlRdr.readDOMFromString( amc13_payload ); + xmlRdr.readRootElement ( parsedXMLs ); + parsedXMLs.setConfigured(); - xmlRdr.readDOMFromString( amc13_payload ); - xmlRdr.readRootElement ( parsedXMLs ); - parsedXMLs.setConfigured(); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; + return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ; + } + } L1TMuonBarrelParamsHelper m_params_helper( *(baseSettings.product()) ); - m_params_helper.configFromDB( parsedXMLs ); + try { + m_params_helper.configFromDB( parsedXMLs ); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error(std::string("SummaryForFunctionManager: BMTF | Faulty | ") + e.what()); + else { + edm::LogError( "L1-O2O: L1TMuonBarrelParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonBarrelParams"; + return std::make_shared< L1TMuonBarrelParams >( *(baseSettings.product()) ) ; + } + } + std::shared_ptr< L1TMuonBarrelParams > retval = std::make_shared< L1TMuonBarrelParams>( m_params_helper ); - + + edm::LogInfo( "L1-O2O: L1TCaloParamsOnlineProd" ) << "SummaryForFunctionManager: BMTF | OK | All looks good"; return retval; } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapForestOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapForestOnlineProd.cc index 64e28ca8a4a35..a41c0df87ba3a 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapForestOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapForestOnlineProd.cc @@ -9,6 +9,7 @@ class L1TMuonEndCapForestOnlineProd : public L1ConfigOnlineProdBaseExt { private: + bool transactionSafe; public: std::shared_ptr newObject(const std::string& objectKey, const L1TMuonEndCapForestO2ORcd& record) override ; @@ -16,15 +17,20 @@ class L1TMuonEndCapForestOnlineProd : public L1ConfigOnlineProdBaseExt(iConfig) {} +L1TMuonEndCapForestOnlineProd::L1TMuonEndCapForestOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { + transactionSafe = iConfig.getParameter("transactionSafe"); +} std::shared_ptr L1TMuonEndCapForestOnlineProd::newObject(const std::string& objectKey, const L1TMuonEndCapForestO2ORcd& record) { edm::LogError( "L1-O2O" ) << "L1TMuonEndCapForest object with key " << objectKey << " not in ORCON!" ; - throw std::runtime_error("You are never supposed to get this code running!"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | You are never supposed to get Forests online producer running!"); std::shared_ptr< L1TMuonEndCapForest > retval = std::make_shared< L1TMuonEndCapForest >(); + + edm::LogError( "L1-O2O: L1TMuonEndCapForestOnlineProd" ) << "SummaryForFunctionManager: EMTF | Faulty | You are never supposed to get Forests online producer running; returning empty L1TMuonEndCapForest"; return retval; } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndcapObjectKeysOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc similarity index 57% rename from L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndcapObjectKeysOnlineProd.cc rename to L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc index 3b2f8c2833d6e..2dd7a3c6b7f10 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndcapObjectKeysOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapObjectKeysOnlineProd.cc @@ -5,22 +5,24 @@ #include "L1Trigger/L1TCommon/interface/XmlConfigParser.h" #include "OnlineDBqueryHelper.h" -class L1TMuonEndcapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt { +class L1TMuonEndCapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt { private: - + bool transactionSafe; public: void fillObjectKeys( ReturnType pL1TriggerKey ) override ; - L1TMuonEndcapObjectKeysOnlineProd(const edm::ParameterSet&); - ~L1TMuonEndcapObjectKeysOnlineProd(void) override{} + L1TMuonEndCapObjectKeysOnlineProd(const edm::ParameterSet&); + ~L1TMuonEndCapObjectKeysOnlineProd(void) override{} }; -L1TMuonEndcapObjectKeysOnlineProd::L1TMuonEndcapObjectKeysOnlineProd(const edm::ParameterSet& iConfig) - : L1ObjectKeysOnlineProdBaseExt( iConfig ){ +L1TMuonEndCapObjectKeysOnlineProd::L1TMuonEndCapObjectKeysOnlineProd(const edm::ParameterSet& iConfig) + : L1ObjectKeysOnlineProdBaseExt( iConfig ) +{ + transactionSafe = iConfig.getParameter("transactionSafe"); } -void L1TMuonEndcapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey ){ +void L1TMuonEndCapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey ){ std::string EMTFKey = pL1TriggerKey->subsystemKey( L1TriggerKeyExt::kEMTF ) ; @@ -30,7 +32,6 @@ void L1TMuonEndcapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey EMTFKey) ; std::string tscKey = EMTFKey.substr(0, EMTFKey.find(":") ); - std::string rsKey = EMTFKey.substr( EMTFKey.find(":")+1, std::string::npos ); //////////////////////// // the block below reproduces L1TMuonEndCapParamsOnlineProd identically @@ -61,20 +62,41 @@ void L1TMuonEndcapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey ) ["CONF"]; } catch ( std::runtime_error &e ) { - edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + edm::LogError( "L1-O2O: L1TMuonEndCapObjectKeysOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TMuonEndCapObjectKeysOnlineProd" ) << "forcing L1TMuonEndCapForest key to be = '7' (known to exist)"; + pL1TriggerKey->add( "L1TMuonEndCapForestO2ORcd", + "L1TMuonEndCapForest", + "7") ; + return; + } } l1t::XmlConfigParser xmlRdr; l1t::TriggerSystem trgSys; - xmlRdr.readDOMFromString( hw_payload ); - xmlRdr.readRootElement ( trgSys ); + try { + xmlRdr.readDOMFromString( hw_payload ); + xmlRdr.readRootElement ( trgSys ); - xmlRdr.readDOMFromString( algo_payload ); - xmlRdr.readRootElement ( trgSys ); + xmlRdr.readDOMFromString( algo_payload ); + xmlRdr.readRootElement ( trgSys ); - trgSys.setConfigured(); + trgSys.setConfigured(); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonEndCapObjectKeysOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Cannot parse XMLs"); + else { + edm::LogError( "L1-O2O: L1TMuonEndCapObjectKeysOnlineProd" ) << "forcing L1TMuonEndCapForest key to be = '7' (known to exist)"; + pL1TriggerKey->add( "L1TMuonEndCapForestO2ORcd", + "L1TMuonEndCapForest", + "7") ; + return; + } + } std::map conf = trgSys.getParameters("EMTF-1"); // any processor will do @@ -88,4 +110,4 @@ void L1TMuonEndcapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKey //define this as a plug-in -DEFINE_FWK_EVENTSETUP_MODULE(L1TMuonEndcapObjectKeysOnlineProd); +DEFINE_FWK_EVENTSETUP_MODULE(L1TMuonEndCapObjectKeysOnlineProd); diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc index 825ef9e02a287..001b99b0421c7 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProd.cc @@ -8,13 +8,13 @@ #include "CondFormats/L1TObjects/interface/L1TMuonEndCapParams.h" #include "CondFormats/DataRecord/interface/L1TMuonEndCapParamsRcd.h" #include "CondFormats/DataRecord/interface/L1TMuonEndCapParamsO2ORcd.h" -#include "L1Trigger/L1TMuonEndCap/interface/EndCapParamsHelper.h" #include "L1Trigger/L1TCommon/interface/TriggerSystem.h" #include "L1Trigger/L1TCommon/interface/XmlConfigParser.h" #include "OnlineDBqueryHelper.h" class L1TMuonEndCapParamsOnlineProd : public L1ConfigOnlineProdBaseExt { private: + bool transactionSafe; public: std::shared_ptr newObject(const std::string& objectKey, const L1TMuonEndCapParamsO2ORcd& record) override ; @@ -22,7 +22,9 @@ class L1TMuonEndCapParamsOnlineProd : public L1ConfigOnlineProdBaseExt(iConfig){} +L1TMuonEndCapParamsOnlineProd::L1TMuonEndCapParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig){ + transactionSafe = iConfig.getParameter("transactionSafe"); +} std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(const std::string& objectKey, const L1TMuonEndCapParamsO2ORcd& record) { using namespace edm::es; @@ -33,8 +35,13 @@ std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(co if (objectKey.empty()) { - edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "Key is empty, returning empty L1TMuonEndCapParams"; - throw std::runtime_error("Empty objectKey"); + edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "Key is empty"; + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: BMTF | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonEndCapParams"; + return std::make_shared< L1TMuonEndCapParams >( *(baseSettings.product()) ) ; + } } std::string tscKey = objectKey.substr(0, objectKey.find(":") ); @@ -69,7 +76,12 @@ std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(co } catch ( std::runtime_error &e ) { edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonEndCapParams"; + return std::make_shared< L1TMuonEndCapParams >( *(baseSettings.product()) ) ; + } } // for debugging purposes dump the configs to local files @@ -87,13 +99,23 @@ std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(co l1t::XmlConfigParser xmlRdr; l1t::TriggerSystem trgSys; - xmlRdr.readDOMFromString( hw_payload ); - xmlRdr.readRootElement ( trgSys ); + try { + xmlRdr.readDOMFromString( hw_payload ); + xmlRdr.readRootElement ( trgSys ); - xmlRdr.readDOMFromString( algo_payload ); - xmlRdr.readRootElement ( trgSys ); + xmlRdr.readDOMFromString( algo_payload ); + xmlRdr.readRootElement ( trgSys ); - trgSys.setConfigured(); + trgSys.setConfigured(); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: EMTF | Faulty | Cannot parse XMLs"); + else { + edm::LogError( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonEndCapParams"; + return std::make_shared< L1TMuonEndCapParams >( *(baseSettings.product()) ) ; + } + } std::map conf = trgSys.getParameters("EMTF-1"); // any processor will do @@ -102,18 +124,17 @@ std::shared_ptr L1TMuonEndCapParamsOnlineProd::newObject(co strptime(core_fwv.c_str(), "%Y-%m-%d %T", &brokenTime); time_t fw_sinceEpoch = timegm(&brokenTime); - std::string pclut_v = conf["pc_lut_version"].getValueAsStr(); - strptime(pclut_v.c_str(), "%Y-%m-%d", &brokenTime); - time_t pclut_sinceEpoch = timegm(&brokenTime); - - l1t::EndCapParamsHelper data( new L1TMuonEndCapParams() ); - - data.SetFirmwareVersion( fw_sinceEpoch ); - data.SetPtAssignVersion( conf["pt_lut_version"].getValue() ); - data.SetPrimConvVersion( pclut_sinceEpoch ); +// std::string pclut_v = conf["pc_lut_version"].getValueAsStr(); +// strptime(pclut_v.c_str(), "%Y-%m-%d", &brokenTime); +// time_t pclut_sinceEpoch = timegm(&brokenTime); - std::shared_ptr< L1TMuonEndCapParams > retval( data.getWriteInstance() ); + std::shared_ptr< L1TMuonEndCapParams > retval( new L1TMuonEndCapParams() ); + + retval->firmwareVersion_ = fw_sinceEpoch; + retval->PtAssignVersion_ = conf["pt_lut_version"].getValue(); + retval->PhiMatchWindowSt1_ = 1; //pclut_sinceEpoch; + edm::LogInfo( "L1-O2O: L1TMuonEndCapParamsOnlineProd" ) << "SummaryForFunctionManager: EMTF | OK | All looks good"; return retval; } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProxy.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProxy.cc deleted file mode 100644 index cb663a8d324b0..0000000000000 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonEndCapParamsOnlineProxy.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -#include "FWCore/Framework/interface/ModuleFactory.h" -#include "FWCore/Framework/interface/ESProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "CondFormats/L1TObjects/interface/L1TMuonEndCapParams.h" -#include "CondFormats/DataRecord/interface/L1TMuonEndCapParamsRcd.h" -#include "CondFormats/DataRecord/interface/L1TMuonEndCapParamsO2ORcd.h" - -class L1TMuonEndCapParamsOnlineProxy : public edm::ESProducer { -private: - unsigned int PtAssignVersion, firmwareVersion, changeDate; -public: - std::shared_ptr produce(const L1TMuonEndCapParamsO2ORcd& record); - - L1TMuonEndCapParamsOnlineProxy(const edm::ParameterSet&); - ~L1TMuonEndCapParamsOnlineProxy(void) override{} -}; - -L1TMuonEndCapParamsOnlineProxy::L1TMuonEndCapParamsOnlineProxy(const edm::ParameterSet& iConfig) : edm::ESProducer() { - setWhatProduced(this); - PtAssignVersion = iConfig.getUntrackedParameter("PtAssignVersion", 1); - firmwareVersion = iConfig.getUntrackedParameter("firmwareVersion", 1); - changeDate = iConfig.getUntrackedParameter("changeDate", 1); -} - -std::shared_ptr L1TMuonEndCapParamsOnlineProxy::produce(const L1TMuonEndCapParamsO2ORcd& record) { -/* - const L1TMuonEndCapParamsRcd& baseRcd = record.template getRecord< L1TMuonEndCapParamsRcd >() ; - edm::ESHandle< L1TMuonEndCapParams > baseSettings ; - baseRcd.get( baseSettings ) ; - - return boost::shared_ptr< L1TMuonEndCapParams > ( new L1TMuonEndCapParams( *(baseSettings.product()) ) ); -*/ - std::shared_ptr< L1TMuonEndCapParams > retval = std::make_shared< L1TMuonEndCapParams>(); - - retval->PtAssignVersion_ = PtAssignVersion; - retval->firmwareVersion_ = firmwareVersion; - retval->PhiMatchWindowSt1_ = changeDate; // This should be set to PrimConvVersion - AWB 13.06.17 - return retval; -} - -//define this as a plug-in -DEFINE_FWK_EVENTSETUP_MODULE(L1TMuonEndCapParamsOnlineProxy); diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc index f06d843a8e7d5..a2e36068ace35 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonGlobalParamsOnlineProd.cc @@ -14,6 +14,7 @@ class L1TMuonGlobalParamsOnlineProd : public L1ConfigOnlineProdBaseExt { private: + bool transactionSafe; public: std::shared_ptr newObject(const std::string& objectKey, const L1TMuonGlobalParamsO2ORcd &record) override ; @@ -21,7 +22,9 @@ class L1TMuonGlobalParamsOnlineProd : public L1ConfigOnlineProdBaseExt(iConfig) {} +L1TMuonGlobalParamsOnlineProd::L1TMuonGlobalParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { + transactionSafe = iConfig.getParameter("transactionSafe"); +} std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(const std::string& objectKey, const L1TMuonGlobalParamsO2ORcd &record) { using namespace edm::es; @@ -32,7 +35,12 @@ std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(co if( objectKey.empty() ){ edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "Key is empty"; - throw std::runtime_error("Empty objectKey"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Empty objectKey"); + else { + edm::LogError( "L1-O2O: L1TMuonGlobalParams" ) << "returning unmodified prototype of L1TMuonGlobalParams"; + return std::make_shared< L1TMuonGlobalParams>( *(baseSettings.product()) ) ; + } } std::string tscKey = objectKey.substr(0, objectKey.find(":") ); @@ -90,10 +98,14 @@ std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(co ) ["CONF"]; } catch ( std::runtime_error &e ) { edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << e.what(); - throw std::runtime_error("Broken key"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams"; + return std::make_shared< L1TMuonGlobalParams >( *(baseSettings.product()) ) ; + } } - // for debugging dump the configs to local files { std::ofstream output(std::string("/tmp/").append(hw_key.substr(0,hw_key.find("/"))).append(".xml")); @@ -115,26 +127,47 @@ std::shared_ptr L1TMuonGlobalParamsOnlineProd::newObject(co l1t::XmlConfigParser xmlRdr; l1t::TriggerSystem trgSys; - // HW settings should always go first - xmlRdr.readDOMFromString( hw_payload ); - xmlRdr.readRootElement ( trgSys ); - - // now let's parse ALGO and then RS settings - for(auto &conf : algo_payloads){ - xmlRdr.readDOMFromString( conf.second ); - xmlRdr.readRootElement ( trgSys ); - } - for(auto &conf : rs_payloads){ - xmlRdr.readDOMFromString( conf.second ); - xmlRdr.readRootElement ( trgSys ); + try { + // HW settings should always go first + xmlRdr.readDOMFromString( hw_payload ); + xmlRdr.readRootElement ( trgSys ); + + // now let's parse ALGO and then RS settings + for(auto &conf : algo_payloads){ + xmlRdr.readDOMFromString( conf.second ); + xmlRdr.readRootElement ( trgSys ); + } + for(auto &conf : rs_payloads){ + xmlRdr.readDOMFromString( conf.second ); + xmlRdr.readRootElement ( trgSys ); + } + trgSys.setConfigured(); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Cannot parse XMLs"); + else { + edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams"; + return std::make_shared< L1TMuonGlobalParams >( *(baseSettings.product()) ) ; + } } - trgSys.setConfigured(); L1TMuonGlobalParamsHelper m_params_helper( *(baseSettings.product()) ); - m_params_helper.loadFromOnline(trgSys); + try { + m_params_helper.loadFromOnline(trgSys); + } catch ( std::runtime_error &e ) { + edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << e.what(); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: uGMT | Faulty | Cannot run helper"); + else { + edm::LogError( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "returning unmodified prototype of L1TMuonGlobalParams"; + return std::make_shared< L1TMuonGlobalParams >( *(baseSettings.product()) ) ; + } + } std::shared_ptr< L1TMuonGlobalParams > retval = std::make_shared< L1TMuonGlobalParams >( cast_to_L1TMuonGlobalParams(m_params_helper) ); + edm::LogInfo( "L1-O2O: L1TMuonGlobalParamsOnlineProd" ) << "SummaryForFunctionManager: uGMT | OK | All looks good"; return retval ; } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc index 63535e4397e01..a04182c6e33b6 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc @@ -4,7 +4,7 @@ class L1TMuonOverlapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt { private: - + bool transactionSafe; public: void fillObjectKeys( ReturnType pL1TriggerKey ) override ; @@ -14,6 +14,7 @@ class L1TMuonOverlapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt L1TMuonOverlapObjectKeysOnlineProd::L1TMuonOverlapObjectKeysOnlineProd(const edm::ParameterSet& iConfig) : L1ObjectKeysOnlineProdBaseExt( iConfig ){ + transactionSafe = iConfig.getParameter("transactionSafe"); } @@ -23,13 +24,7 @@ void L1TMuonOverlapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKe std::string stage2Schema = "CMS_TRG_L1_CONF" ; - if( OMTFKey.empty() ){ - edm::LogError( "L1-O2O: L1TMuonOverlapObjectKeysOnlineProd" ) << "Key is empty ... do nothing, but that'll probably crash things later on"; - return; - } - std::string tscKey = OMTFKey.substr(0, OMTFKey.find(":") ); - std::string rsKey = OMTFKey.substr( OMTFKey.find(":")+1, std::string::npos ); std::vector< std::string > queryStrings ; queryStrings.push_back( "ALGO" ) ; @@ -45,13 +40,20 @@ void L1TMuonOverlapObjectKeysOnlineProd::fillObjectKeys( ReturnType pL1TriggerKe m_omdsReader.singleAttribute(tscKey) ) ; - if( queryResult.queryFailed() || queryResult.numberRows() != 1 ){ - edm::LogError( "L1-O2O" ) << "Cannot get OMTF_KEYS.ALGO "<<" do nothing, but that'll probably crash things later on"; - return; + if( queryResult.queryFailed() || queryResult.numberRows() != 1 || !queryResult.fillVariable( "ALGO", algo_key) ){ + edm::LogError( "L1-O2O L1TMuonOverlapObjectKeysOnlineProd" ) << "Cannot get OMTF_KEYS.ALGO "; + + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: OMTF | Faulty | Broken key"); + else { + edm::LogError( "L1-O2O: L1TMuonOverlapObjectKeysOnlineProd" ) << "forcing L1TMuonOverlapParams key to be = 'OMTF_ALGO_EMPTY' (known to exist)"; + pL1TriggerKey->add( "L1TMuonOverlapParamsO2ORcd", + "L1TMuonOverlapParams", + "OMTF_ALGO_EMPTY") ; + return; + } } - if( !queryResult.fillVariable( "ALGO", algo_key) ) algo_key = ""; - // simply assign the algo key to the record pL1TriggerKey->add( "L1TMuonOverlapParamsO2ORcd", "L1TMuonOverlapParams", diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc index c4b8a9570b452..aae0f689070ef 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapParamsOnlineProd.cc @@ -9,6 +9,8 @@ class L1TMuonOverlapParamsOnlineProd : public L1ConfigOnlineProdBaseExt { private: + bool transactionSafe; + public: std::shared_ptr newObject(const std::string& objectKey, const L1TMuonOverlapParamsO2ORcd& record) override ; @@ -16,15 +18,20 @@ class L1TMuonOverlapParamsOnlineProd : public L1ConfigOnlineProdBaseExt(iConfig) {} +L1TMuonOverlapParamsOnlineProd::L1TMuonOverlapParamsOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig) { + transactionSafe = iConfig.getParameter("transactionSafe"); +} std::shared_ptr L1TMuonOverlapParamsOnlineProd::newObject(const std::string& objectKey, const L1TMuonOverlapParamsO2ORcd& record) { edm::LogError( "L1-O2O" ) << "L1TMuonOverlapParams object with key " << objectKey << " not in ORCON!" ; - throw std::runtime_error("You are never supposed to get this code running!"); + if( transactionSafe ) + throw std::runtime_error("SummaryForFunctionManager: OMTF | Faulty | You are never supposed to get OMTF online producer running!"); std::shared_ptr< L1TMuonOverlapParams > retval = std::make_shared< L1TMuonOverlapParams >(); + + edm::LogError( "L1-O2O: L1TMuonOverlapParamsOnlineProd" ) << "SummaryForFunctionManager: OMTF | Faulty | You are never supposed to get OMTF online producer running; returning empty L1TMuonOverlapParams"; return retval; } diff --git a/L1TriggerConfig/Utilities/src/L1MenuReader.cc b/L1TriggerConfig/Utilities/src/L1MenuViewer.cc similarity index 88% rename from L1TriggerConfig/Utilities/src/L1MenuReader.cc rename to L1TriggerConfig/Utilities/src/L1MenuViewer.cc index 9afd09df1d45c..13d1ab2c5f739 100644 --- a/L1TriggerConfig/Utilities/src/L1MenuReader.cc +++ b/L1TriggerConfig/Utilities/src/L1MenuViewer.cc @@ -18,15 +18,15 @@ #include using namespace std; -class L1MenuReader : public edm::EDAnalyzer { +class L1MenuViewer : public edm::EDAnalyzer { public: - void analyze(const edm::Event&, const edm::EventSetup&) override; + void analyze(const edm::Event&, const edm::EventSetup&) override ; - explicit L1MenuReader(const edm::ParameterSet&) : edm::EDAnalyzer(){} - ~L1MenuReader(void) override{} + explicit L1MenuViewer(const edm::ParameterSet&) : edm::EDAnalyzer(){} + ~L1MenuViewer(void) override {} }; -void L1MenuReader::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ +void L1MenuViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ edm::ESHandle handle1; evSetup.get().get( handle1 ) ; @@ -58,5 +58,5 @@ void L1MenuReader::analyze(const edm::Event& iEvent, const edm::EventSetup& evSe #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ModuleFactory.h" -DEFINE_FWK_MODULE(L1MenuReader); +DEFINE_FWK_MODULE(L1MenuViewer); diff --git a/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc b/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc index f598bf7fd7c7f..27d7a5bba0b81 100644 --- a/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc +++ b/L1TriggerConfig/Utilities/src/L1TCaloParamsViewer.cc @@ -7,6 +7,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "CondFormats/DataRecord/interface/L1TCaloParamsRcd.h" +#include "CondFormats/DataRecord/interface/L1TCaloStage2ParamsRcd.h" #include "CondFormats/L1TObjects/interface/CaloParams.h" #include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h" #include @@ -15,26 +16,58 @@ class L1TCaloParamsViewer: public edm::EDAnalyzer { private: bool printPUSParams; bool printTauCalibLUT; + bool printTauCompressLUT; bool printJetCalibLUT; bool printJetCalibPar; + bool printJetPUSPar; + bool printJetCompressPtLUT; + bool printJetCompressEtaLUT; bool printEgCalibLUT; bool printEgIsoLUT; + bool printEtSumMetPUSLUT; + bool printHfSF; + bool printHcalSF; + bool printEcalSF; + bool printEtSumEttPUSLUT; + bool printEtSumEcalSumPUSLUT; + bool printEtSumXCalibrationLUT; + bool printEtSumYCalibrationLUT; + bool printEtSumEttCalibrationLUT; + bool printEtSumEcalSumCalibrationLUT; + + bool useStage2Rcd; std::string hash(void *buf, size_t len) const ; public: - void analyze(const edm::Event&, const edm::EventSetup&) override; + void analyze(const edm::Event&, const edm::EventSetup&) override ; explicit L1TCaloParamsViewer(const edm::ParameterSet& pset) : edm::EDAnalyzer(){ - printPUSParams = pset.getUntrackedParameter("printPUSParams", false); - printTauCalibLUT = pset.getUntrackedParameter("printTauCalibLUT",false); - printJetCalibLUT = pset.getUntrackedParameter("printJetCalibLUT",false); - printJetCalibPar = pset.getUntrackedParameter("printJetCalibParams",false); - printEgCalibLUT = pset.getUntrackedParameter("printEgCalibLUT", false); - printEgIsoLUT = pset.getUntrackedParameter("printEgIsoLUT", false); + printPUSParams = pset.getUntrackedParameter("printPUSParams", false); + printTauCalibLUT = pset.getUntrackedParameter("printTauCalibLUT",false); + printTauCompressLUT = pset.getUntrackedParameter("printTauCompressLUT",false); + printJetCalibLUT = pset.getUntrackedParameter("printJetCalibLUT",false); + printJetCalibPar = pset.getUntrackedParameter("printJetCalibParams",false); + printJetPUSPar = pset.getUntrackedParameter("printJetPUSPar", false); + printJetCompressPtLUT = pset.getUntrackedParameter("printJetCompressPtLUT", false); + printJetCompressEtaLUT = pset.getUntrackedParameter("printJetCompressEtaLUT", false); + printEgCalibLUT = pset.getUntrackedParameter("printEgCalibLUT", false); + printEgIsoLUT = pset.getUntrackedParameter("printEgIsoLUT", false); + printEtSumMetPUSLUT = pset.getUntrackedParameter("printEtSumMetPUSLUT", false); + printHfSF = pset.getUntrackedParameter("printHfSF", false); + printHcalSF = pset.getUntrackedParameter("printHcalSF", false); + printEcalSF = pset.getUntrackedParameter("printEcalSF", false); + printEtSumEttPUSLUT = pset.getUntrackedParameter("printEtSumEttPUSLUT", false); + printEtSumEcalSumPUSLUT = pset.getUntrackedParameter("printEtSumEcalSumPUSLUT", false); + printEtSumXCalibrationLUT = pset.getUntrackedParameter("printEtSumXCalibrationLUT", false); + printEtSumYCalibrationLUT = pset.getUntrackedParameter("printEtSumYCalibrationLUT", false); + printEtSumEttCalibrationLUT = pset.getUntrackedParameter("printEtSumEttCalibrationLUT", false); + printEtSumEcalSumCalibrationLUT = pset.getUntrackedParameter("printEtSumEcalSumCalibrationLUT", false); + + useStage2Rcd = pset.getUntrackedParameter("useStage2Rcd", false); } - ~L1TCaloParamsViewer(void) override{} + ~L1TCaloParamsViewer(void) override {} }; #include @@ -67,7 +100,11 @@ std::string L1TCaloParamsViewer::hash(void *buf, size_t len) const { void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ edm::ESHandle handle1; - evSetup.get().get( handle1 ) ; + if( useStage2Rcd ) + evSetup.get().get( handle1 ) ; + else + evSetup.get().get( handle1 ) ; + boost::shared_ptr ptr(new l1t::CaloParams(*(handle1.product ()))); l1t::CaloParamsHelper *ptr1 = nullptr; @@ -93,7 +130,6 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu cout<<" regionPUSType= "<regionPUSType()<regionPUSParams().size()<<"] "; float pusParams[ptr1->regionPUSParams().size()]; - for(unsigned int i=0; iregionPUSParams().size(); i++){ pusParams[i] = ceil(2*ptr1->regionPUSParams()[i]); if( printPUSParams ) cout<<" "<regionPUSParams().size()) << endl; else cout<regionPUSLUT()->empty() ){ + cout<<" regionPUSLUT= ["<regionPUSLUT()->maxSize()<<"] "; + int regionPUSLUT[ptr1->regionPUSLUT()->maxSize()]; + for(unsigned int i=0; iregionPUSLUT()->maxSize(); i++) regionPUSLUT[i] = ptr1->regionPUSLUT()->data(i); + cout << hash( regionPUSLUT, sizeof(int)*ptr1->regionPUSLUT()->maxSize() ) << endl; + } else { + cout<<" regionPUSLUT= [0]"<egShapeIdLUT()->maxSize()<<"] "<egShapeIdLUT()->maxSize()]; @@ -173,6 +219,18 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu } else { cout<<" egIsoLUT= [0]"<egIsolationLUT2()->empty() ){ + cout<<" egIsoLUT2= ["<egIsolationLUT2()->maxSize()<<"] "<egIsolationLUT2()->maxSize()]; + for(unsigned int i=0; iegIsolationLUT2()->maxSize(); i++) egIsolation2[i] = ptr1->egIsolationLUT2()->data(i); + cout << hash( egIsolation2, sizeof(int)*ptr1->egIsolationLUT2()->maxSize() ) << endl; + if( printEgIsoLUT ) + for(unsigned int i=0; iegIsolationLUT2()->maxSize(); i++) + cout<egCalibrationLUT()->maxSize()<<"] "<egCalibrationLUT()->maxSize()]; @@ -227,6 +285,23 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu } else { cout<<" tauIsoLUT= [0]"<tauIsolationLUT2()->empty() ){ + cout<<" tauIsoLUT2= ["<tauIsolationLUT2()->maxSize()<<"] "<tauIsolationLUT2()->maxSize()]; + for(unsigned int i=0; itauIsolationLUT2()->maxSize(); i++) tauIsolation2[i] = ptr1->tauIsolationLUT2()->data(i); + cout << hash( tauIsolation2, sizeof(int)*ptr1->tauIsolationLUT2()->maxSize() ) << endl; + } else { + cout<<" tauIsoLUT2= [0]"<tauTrimmingShapeVetoLUT()->empty() ){ + cout<<" tauTrimmingShapeVetoLUT=["<tauTrimmingShapeVetoLUT()->maxSize()<<"] "<tauTrimmingShapeVetoLUT()->maxSize()]; + for(unsigned int i=0; itauTrimmingShapeVetoLUT()->maxSize(); i++) tauTrimmingShapeVetoLUT[i] = ptr1->tauTrimmingShapeVetoLUT()->data(i); + cout << hash( tauTrimmingShapeVetoLUT, sizeof(int)*ptr1->tauTrimmingShapeVetoLUT()->maxSize() ) << endl; + } else { + cout<<" tauTrimmingShapeVetoLUT=[0]"<tauCalibrationLUT()->empty() ){ cout<<" tauCalibrationLUT= ["<tauCalibrationLUT()->maxSize()<<"] "<tauCalibrationParams().size()<<"] "<tauCalibrationParams().size()]; + for(unsigned int i=0; itauCalibrationParams().size(); i++) tauCalibrationParams[i] = ptr1->tauCalibrationParams()[i]; + + if( !ptr1->tauCalibrationParams().empty() ) + cout << hash( tauCalibrationParams, sizeof(double)*ptr1->tauCalibrationParams().size() ) << endl; + else cout<tauCompressLUT()->empty() ){ + cout<<" tauCompressLUT= ["<tauCompressLUT()->maxSize()<<"] "<tauCompressLUT()->maxSize()]; + for(unsigned int i=0; itauCompressLUT()->maxSize(); i++) + tauCompress[i] = ptr1->tauCompressLUT()->data(i); + cout << hash( tauCompress, sizeof(int)*ptr1->tauCompressLUT()->maxSize() ) << endl; + + if( printTauCompressLUT ) + for(unsigned int i=0; itauCompressLUT()->maxSize(); i++) + cout<tauEtToHFRingEtLUT()->empty() ){ cout<<" tauEtToHFRingEtLUT= ["<tauEtToHFRingEtLUT()->maxSize()<<"] "<tauEtToHFRingEtLUT()->maxSize()]; @@ -267,6 +369,8 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu cout<<" jetLsb= "<jetLsb()<jetCalibrationParams().size()<<"] "<jetPUSParams().size()<<"] "<jetPUSParams().size()]; // deliberately drop double precision + for(unsigned int i=0; ijetPUSParams().size(); i++) jetPUSParams[i] = ptr1->jetPUSParams()[i]; + if( !ptr1->jetPUSParams().empty() ){ + cout << hash( jetPUSParams, sizeof(float)*ptr1->jetPUSParams().size() ) << endl; + if( printJetPUSPar ) + for(unsigned int i=0; ijetPUSParams().size(); i++) + cout<jetCalibrationLUT()->empty() ){ cout<<" jetCalibrationLUT= ["<jetCalibrationLUT()->maxSize()<<"] "<jetCalibrationLUT()->maxSize()]; @@ -297,6 +413,39 @@ void L1TCaloParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetu cout<<" jetCalibrationLUT= [0]"<jetCompressPtLUT()->empty() ){ + cout<<" jetCompressPtLUT= ["<jetCompressPtLUT()->maxSize()<<"] "<jetCompressPtLUT()->maxSize()]; + for(unsigned int i=0; ijetCompressPtLUT()->maxSize(); i++) + jetCompressPt[i] = ptr1->jetCompressPtLUT()->data(i); + + cout << hash( jetCompressPt, sizeof(int)*ptr1->jetCompressPtLUT()->maxSize() ) << endl; + + if( printJetCompressPtLUT ) + for(unsigned int i=0; ijetCompressPtLUT()->maxSize(); i++) + cout<jetCompressEtaLUT()->empty() ){ + cout<<" jetCompressEtaLUT= ["<jetCompressEtaLUT()->maxSize()<<"] "<jetCompressEtaLUT()->maxSize()]; + for(unsigned int i=0; ijetCompressEtaLUT()->maxSize(); i++) + jetCompressEta[i] = ptr1->jetCompressEtaLUT()->data(i); + + cout << hash( jetCompressEta, sizeof(int)*ptr1->jetCompressEtaLUT()->maxSize() ) << endl; + + if( printJetCompressEtaLUT ) + for(unsigned int i=0; ijetCompressEtaLUT()->maxSize(); i++) + cout<etSumEtaMax(i)>0.001; i++,nEntities++) cout<<(i==0?"":",")<etSumEtaMax(i); cout<<"]"<etSumEtThreshold(i); cout<<"]"<etSumBypassEcalSumPUS() << endl; + + cout<<" etSumMetPUSType= " << ptr1->etSumMetPUSType() << endl; + cout<<" etSumEttPUSType= " << ptr1->etSumEttPUSType() << endl; + cout<<" etSumEcalSumPUSType= " << ptr1->etSumEcalSumPUSType() << endl; + cout<<" etSumXCalibrationType= " << ptr1->etSumXCalibrationType() << endl; + cout<<" etSumYCalibrationType= " << ptr1->etSumYCalibrationType() << endl; + cout<<" etSumEttCalibrationType=" << ptr1->etSumEttCalibrationType() << endl; + cout<<" etSumEcalSumCalibrationType=" << ptr1->etSumEcalSumCalibrationType() << endl; + + if( !ptr1->etSumMetPUSLUT()->empty() ){ + cout<<" etSumMetPUSLUT= ["<etSumMetPUSLUT()->maxSize()<<"] "<etSumMetPUSLUT()->maxSize()]; + for(unsigned int i=0; ietSumMetPUSLUT()->maxSize(); i++) + etSumMetPUSLUT[i] = ptr1->etSumMetPUSLUT()->data(i); + + cout << hash( etSumMetPUSLUT, sizeof(int)*ptr1->etSumMetPUSLUT()->maxSize() ) << endl; + + if( printEtSumMetPUSLUT ) + for(unsigned int i=0; ietSumMetPUSLUT()->maxSize(); i++) + cout<etSumEttPUSLUT()->empty() ){ + cout<<" etSumEttPUSLUT= ["<etSumEttPUSLUT()->maxSize()<<"] "<etSumEttPUSLUT()->maxSize()]; + for(unsigned int i=0; ietSumEttPUSLUT()->maxSize(); i++) + etSumEttPUSLUT[i] = ptr1->etSumEttPUSLUT()->data(i); + + cout << hash( etSumEttPUSLUT, sizeof(int)*ptr1->etSumEttPUSLUT()->maxSize() ) << endl; + + if( printEtSumEttPUSLUT ) + for(unsigned int i=0; ietSumEttPUSLUT()->maxSize(); i++) + cout<etSumEcalSumPUSLUT()->empty() ){ + cout<<" etSumEcalSumPUSLUT= ["<etSumEcalSumPUSLUT()->maxSize()<<"] "<etSumEcalSumPUSLUT()->maxSize()]; + for(unsigned int i=0; ietSumEcalSumPUSLUT()->maxSize(); i++) + etSumEcalSumPUSLUT[i] = ptr1->etSumEcalSumPUSLUT()->data(i); + + cout << hash( etSumEcalSumPUSLUT, sizeof(int)*ptr1->etSumEcalSumPUSLUT()->maxSize() ) << endl; + + if( printEtSumEcalSumPUSLUT ) + for(unsigned int i=0; ietSumEcalSumPUSLUT()->maxSize(); i++) + cout<etSumXCalibrationLUT()->empty() ){ + cout<<" etSumXCalibrationLUT= ["<etSumXCalibrationLUT()->maxSize()<<"] "<etSumXCalibrationLUT()->maxSize()]; + for(unsigned int i=0; ietSumXCalibrationLUT()->maxSize(); i++) + etSumXCalibrationLUT[i] = ptr1->etSumXCalibrationLUT()->data(i); + + cout << hash( etSumXCalibrationLUT, sizeof(int)*ptr1->etSumXCalibrationLUT()->maxSize() ) << endl; + + if( printEtSumXCalibrationLUT ) + for(unsigned int i=0; ietSumXCalibrationLUT()->maxSize(); i++) + cout<etSumYCalibrationLUT()->empty() ){ + cout<<" etSumYCalibrationLUT= ["<etSumYCalibrationLUT()->maxSize()<<"] "<etSumYCalibrationLUT()->maxSize()]; + for(unsigned int i=0; ietSumYCalibrationLUT()->maxSize(); i++) + etSumYCalibrationLUT[i] = ptr1->etSumYCalibrationLUT()->data(i); + + cout << hash( etSumYCalibrationLUT, sizeof(int)*ptr1->etSumYCalibrationLUT()->maxSize() ) << endl; + + if( printEtSumYCalibrationLUT ) + for(unsigned int i=0; ietSumYCalibrationLUT()->maxSize(); i++) + cout<etSumEttCalibrationLUT()->empty() ){ + cout<<" etSumEttCalibrationLUT= ["<etSumEttCalibrationLUT()->maxSize()<<"] "<etSumEttCalibrationLUT()->maxSize()]; + for(unsigned int i=0; ietSumEttCalibrationLUT()->maxSize(); i++) + etSumEttCalibrationLUT[i] = ptr1->etSumEttCalibrationLUT()->data(i); + + cout << hash( etSumEttCalibrationLUT, sizeof(int)*ptr1->etSumEttCalibrationLUT()->maxSize() ) << endl; + + if( printEtSumEttCalibrationLUT ) + for(unsigned int i=0; ietSumEttCalibrationLUT()->maxSize(); i++) + cout<etSumEcalSumCalibrationLUT()->empty() ){ + cout<<" etSumEcalSumCalibrationLUT=["<etSumEttCalibrationLUT()->maxSize()<<"] "<etSumEcalSumCalibrationLUT()->maxSize()]; + for(unsigned int i=0; ietSumEcalSumCalibrationLUT()->maxSize(); i++) + etSumEcalSumCalibrationLUT[i] = ptr1->etSumEcalSumCalibrationLUT()->data(i); + + cout << hash( etSumEcalSumCalibrationLUT, sizeof(int)*ptr1->etSumEcalSumCalibrationLUT()->maxSize() ) << endl; + + if( printEtSumEcalSumCalibrationLUT ) + for(unsigned int i=0; ietSumEcalSumCalibrationLUT()->maxSize(); i++) + cout<centralityLUT()->maxSize(); i++) cout<<(i==0?"":",")<centralityLUT()->data(i); cout<<"]"< ecalSF = ptr1->layer1ECalScaleFactors(); cout<<" layer1ECalScaleFactors= ["<< ecalSF.size()<<"] "< hcalSF = ptr1->layer1HCalScaleFactors(); cout<<" layer1HCalScaleFactors= ["<< hcalSF.size()<<"] "< hfSF = ptr1->layer1HFScaleFactors(); cout<<" layer1HFScaleFactors= ["<< hfSF.size()<<"] "< ecalScaleET = ptr1->layer1ECalScaleETBins(); cout<<" layer1ECalScaleETBins= ["; for(unsigned int i=0; i hfScaleET = ptr1->layer1HFScaleETBins(); cout<<" layer1HFScaleETBins= ["; for(unsigned int i=0; i layer1ECalScalePhi = ptr1->layer1ECalScalePhiBins(); + cout<<" layer1ECalScalePhi= ["; for(unsigned int i=0; i layer1HCalScalePhi = ptr1->layer1HCalScalePhiBins(); + cout<<" layer1HCalScalePhi= ["; for(unsigned int i=0; i layer1HFScalePhiBins = ptr1->layer1HFScalePhiBins(); + cout<<" layer1HFScalePhiBins= ["; for(unsigned int i=0; i layer1SecondStageLUT = ptr1->layer1SecondStageLUT(); +// cout<<" layer1HFScalePhiBins= ["; for(unsigned int i=0; i +#include + +#include "FWCore/Framework/interface/EDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" + +#include "L1Trigger/L1TMuonBarrel/interface/L1TMuonBarrelParamsHelper.h" +#include "CondFormats/DataRecord/interface/L1TMuonBarrelParamsRcd.h" +#include "CondFormats/L1TObjects/interface/L1TMuonBarrelParams.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "CondCore/CondDB/interface/Session.h" + +#include +using namespace std; + +class L1TMuonBarrelParamsViewer: public edm::EDAnalyzer { +private: + std::string hash(void *buf, size_t len) const ; + bool printPtaThreshold; + +public: + void analyze(const edm::Event&, const edm::EventSetup&) override; + + explicit L1TMuonBarrelParamsViewer(const edm::ParameterSet&) : edm::EDAnalyzer(){ + printPtaThreshold = false; + } + ~L1TMuonBarrelParamsViewer(void) override{} +}; + + +#include +#include +#include +using namespace std; + +std::string L1TMuonBarrelParamsViewer::hash(void *buf, size_t len) const { + char tmp[SHA_DIGEST_LENGTH*2+1]; + bzero(tmp,sizeof(tmp)); + SHA_CTX ctx; + if( !SHA1_Init( &ctx ) ) + throw cms::Exception("L1TMuonBarrelParamsViewer::hash")<<"SHA1 initialization error"; + + if( !SHA1_Update( &ctx, buf, len ) ) + throw cms::Exception("L1TMuonBarrelParamsViewer::hash")<<"SHA1 processing error"; + + unsigned char hash[SHA_DIGEST_LENGTH]; + if( !SHA1_Final(hash, &ctx) ) + throw cms::Exception("L1TMuonBarrelParamsViewer::hash")<<"SHA1 finalization error"; + + // re-write bytes in hex + for(unsigned int i=0; i<20; i++) + ::sprintf(&tmp[i*2], "%02x", hash[i]); + + tmp[20*2] = 0; + return std::string(tmp); +} + + +void L1TMuonBarrelParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ + + edm::ESHandle handle1; + evSetup.get().get( handle1 ) ; + boost::shared_ptr ptr(new L1TMuonBarrelParams(*(handle1.product ()))); + + L1TMuonBarrelParamsHelper *ptr1 = (L1TMuonBarrelParamsHelper*)ptr.get(); + + cout << "AssLUTPath: " << ptr1->AssLUTPath() << endl; + + // typedef std::map > LUT; + + for(size_t l=0; lpta_lut().size(); l++){ + const LUT &lut = ptr1->pta_lut()[l]; + if( !lut.empty() ){ + cout<<" pta_lut[" << setw(2) << l << "]= ["< &p : lut) lut_[i++] = p.first*0xFFFF + p.second; + cout << hash( lut_, sizeof(int)*lut.size() ) << endl; + } else { + cout<<" pta_lut[" << setw(2) << l << "]= [0] "<pta_threshold().size() << "] "<pta_threshold().size()]; + for(unsigned int i=0; ipta_threshold().size(); i++){ + pta_threshold[i] = ptr1->pta_threshold()[i]; + if( printPtaThreshold ) cout<<" "<pta_threshold().empty() ) + cout << hash(pta_threshold, sizeof(int)*ptr1->pta_threshold().size()) << endl; + else cout<phi_lut().size(); l++){ + const LUT &lut = ptr1->phi_lut()[l]; + if( !lut.empty() ){ + cout<<" phi_lut[" << l << "]= ["< &p : lut) lut_[i++] = p.first*0xFFFF + p.second; + cout << hash( lut_, sizeof(int)*lut.size() ) << endl; + } else { + cout<<" phi_lut[" << l << "]= [0] "<ext_lut().size(); l++){ + const LUT &lut = (ptr1->ext_lut()[l]).low; + if( !lut.empty() ){ + cout<<" ext_lut_low[" << setw(2) << l << "]= ["< &p : lut) lut_[i++] = p.first*0xFFFF + p.second; + cout << hash( lut_, sizeof(int)*lut.size() ) << endl; + } else { + cout<<" ext_lut_low[" << setw(2) << l << "]= [0] "<ext_lut().size(); l++){ + const LUT &lut = (ptr1->ext_lut()[l]).high; + if( !lut.empty() ){ + cout<<" ext_lut_high[" << setw(2) << l << "]= ["< &p : lut) lut_[i++] = p.first*0xFFFF + p.second; + cout << hash( lut_, sizeof(int)*lut.size() ) << endl; + } else { + cout<<" ext_lut_high[" << setw(2) << l << "]= [0] "< qpLUT; + for(const pair< pair, pair> > item : ptr1->qp_lut() ){ + cout << " qp_lut[" << item.first.first << "," << item.first.second << "]= " + << item.second.first << ", [" << item.second.second.size() << "] " << flush; + if( !item.second.second.empty() ){ + int lut_[item.second.second.size()]; + for(size_t i=0; i > etaLUT; + for(const pair &item : ptr1->eta_lut()) + cout << " eta_lut[" << item.first << "]= " << endl << item.second << endl; + + cout << "PT_Assignment_nbits_Phi= " << ptr1->get_PT_Assignment_nbits_Phi() << endl; + cout << "PT_Assignment_nbits_PhiB= " << ptr1->get_PT_Assignment_nbits_PhiB() << endl; + cout << "PHI_Assignment_nbits_Phi= " << ptr1->get_PHI_Assignment_nbits_Phi() << endl; + cout << "PHI_Assignment_nbits_PhiB= " << ptr1->get_PHI_Assignment_nbits_PhiB() << endl; + cout << "Extrapolation_nbits_Phi= " << ptr1->get_Extrapolation_nbits_Phi() << endl; + cout << "Extrapolation_nbits_PhiB= " << ptr1->get_Extrapolation_nbits_PhiB() << endl; + cout << "BX_min= " << ptr1->get_BX_min() << endl; + cout << "BX_max= " << ptr1->get_BX_max() << endl; + cout << "Extrapolation_Filter= " << ptr1->get_Extrapolation_Filter() << endl; + cout << "OutOfTime_Filter_Window= " << ptr1->get_OutOfTime_Filter_Window() << endl; + + cout << boolalpha; + cout << "OutOfTime_Filter= " << ptr1->get_OutOfTime_Filter() << endl; + cout << "Open_LUTs= " << ptr1->get_Open_LUTs() << endl; + cout << "EtaTrackFinder= " << ptr1->get_EtaTrackFinder() << endl; + cout << "Extrapolation_21= " << ptr1->get_Extrapolation_21() << endl; + cout << "DisableNewAlgo= " << ptr1->get_DisableNewAlgo() << endl; + cout << noboolalpha; + + // FW version + cout << "fwVersion= " << ptr1->fwVersion() << endl; + cout << "version= " << ptr1->version_ << endl; +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ModuleFactory.h" + +DEFINE_FWK_MODULE(L1TMuonBarrelParamsViewer); + diff --git a/L1TriggerConfig/Utilities/src/L1TMuonEndcapViewer.cc b/L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsViewer.cc similarity index 85% rename from L1TriggerConfig/Utilities/src/L1TMuonEndcapViewer.cc rename to L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsViewer.cc index 2a6e668590465..d47b355946918 100644 --- a/L1TriggerConfig/Utilities/src/L1TMuonEndcapViewer.cc +++ b/L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsViewer.cc @@ -20,15 +20,15 @@ #include using namespace std; -class L1TMuonEndcapViewer: public edm::EDAnalyzer { +class L1TMuonEndCapParamsViewer: public edm::EDAnalyzer { public: void analyze(const edm::Event&, const edm::EventSetup&) override; - explicit L1TMuonEndcapViewer(const edm::ParameterSet&) : edm::EDAnalyzer(){} - ~L1TMuonEndcapViewer(void) override{} + explicit L1TMuonEndCapParamsViewer(const edm::ParameterSet&) : edm::EDAnalyzer(){} + ~L1TMuonEndCapParamsViewer(void) override{} }; -void L1TMuonEndcapViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ +void L1TMuonEndCapParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ edm::ESHandle handle1; evSetup.get().get( handle1 ) ; @@ -56,5 +56,5 @@ void L1TMuonEndcapViewer::analyze(const edm::Event& iEvent, const edm::EventSetu #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ModuleFactory.h" -DEFINE_FWK_MODULE(L1TMuonEndcapViewer); +DEFINE_FWK_MODULE(L1TMuonEndCapParamsViewer); diff --git a/L1TriggerConfig/Utilities/src/L1TMuonEndcapWriter.cc b/L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsWriter.cc similarity index 81% rename from L1TriggerConfig/Utilities/src/L1TMuonEndcapWriter.cc rename to L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsWriter.cc index 941e3b7d4bf4e..a88169f631d80 100644 --- a/L1TriggerConfig/Utilities/src/L1TMuonEndcapWriter.cc +++ b/L1TriggerConfig/Utilities/src/L1TMuonEndCapParamsWriter.cc @@ -16,19 +16,19 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" -class L1TMuonEndcapWriter : public edm::EDAnalyzer { +class L1TMuonEndCapParamsWriter : public edm::EDAnalyzer { private: bool isO2Opayload; public: - void analyze(const edm::Event&, const edm::EventSetup&) override; + void analyze(const edm::Event&, const edm::EventSetup&) override ; - explicit L1TMuonEndcapWriter(const edm::ParameterSet &pset) : edm::EDAnalyzer(){ + explicit L1TMuonEndCapParamsWriter(const edm::ParameterSet &pset) : edm::EDAnalyzer(){ isO2Opayload = pset.getUntrackedParameter("isO2Opayload", false); } - ~L1TMuonEndcapWriter(void) override{} + ~L1TMuonEndCapParamsWriter(void) override {} }; -void L1TMuonEndcapWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ +void L1TMuonEndCapParamsWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ edm::ESHandle handle1; if( isO2Opayload ) @@ -50,5 +50,5 @@ void L1TMuonEndcapWriter::analyze(const edm::Event& iEvent, const edm::EventSetu #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ModuleFactory.h" -DEFINE_FWK_MODULE(L1TMuonEndcapWriter); +DEFINE_FWK_MODULE(L1TMuonEndCapParamsWriter); diff --git a/L1TriggerConfig/Utilities/src/L1TMuonOverlapReader.cc b/L1TriggerConfig/Utilities/src/L1TMuonOverlapParamsViewer.cc similarity index 92% rename from L1TriggerConfig/Utilities/src/L1TMuonOverlapReader.cc rename to L1TriggerConfig/Utilities/src/L1TMuonOverlapParamsViewer.cc index 99bf300c96821..e0e3bd3987040 100644 --- a/L1TriggerConfig/Utilities/src/L1TMuonOverlapReader.cc +++ b/L1TriggerConfig/Utilities/src/L1TMuonOverlapParamsViewer.cc @@ -18,17 +18,17 @@ #include using namespace std; -class L1TMuonOverlapReader: public edm::EDAnalyzer { +class L1TMuonOverlapParamsViewer: public edm::EDAnalyzer { private: bool printLayerMap; public: - void analyze(const edm::Event&, const edm::EventSetup&) override; + void analyze(const edm::Event&, const edm::EventSetup&) override ; string hash(void *buf, size_t len) const ; - explicit L1TMuonOverlapReader(const edm::ParameterSet& pset) : edm::EDAnalyzer(){ + explicit L1TMuonOverlapParamsViewer(const edm::ParameterSet& pset) : edm::EDAnalyzer(){ printLayerMap = pset.getUntrackedParameter("printLayerMap", false); } - ~L1TMuonOverlapReader(void) override{} + ~L1TMuonOverlapParamsViewer(void) override {} }; @@ -37,19 +37,19 @@ class L1TMuonOverlapReader: public edm::EDAnalyzer { #include using namespace std; -string L1TMuonOverlapReader::hash(void *buf, size_t len) const { +string L1TMuonOverlapParamsViewer::hash(void *buf, size_t len) const { char tmp[SHA_DIGEST_LENGTH*2+1]; bzero(tmp,sizeof(tmp)); SHA_CTX ctx; if( !SHA1_Init( &ctx ) ) - throw cms::Exception("L1TCaloParamsReader::hash")<<"SHA1 initialization error"; + throw cms::Exception("L1TCaloParamsViewer::hash")<<"SHA1 initialization error"; if( !SHA1_Update( &ctx, buf, len ) ) - throw cms::Exception("L1TCaloParamsReader::hash")<<"SHA1 processing error"; + throw cms::Exception("L1TCaloParamsViewer::hash")<<"SHA1 processing error"; unsigned char hash[SHA_DIGEST_LENGTH]; if( !SHA1_Final(hash, &ctx) ) - throw cms::Exception("L1TCaloParamsReader::hash")<<"SHA1 finalization error"; + throw cms::Exception("L1TCaloParamsViewer::hash")<<"SHA1 finalization error"; // re-write bytes in hex for(unsigned int i=0; i<20; i++) @@ -59,14 +59,14 @@ string L1TMuonOverlapReader::hash(void *buf, size_t len) const { return string(tmp); } -void L1TMuonOverlapReader::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ +void L1TMuonOverlapParamsViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ // Pull the config from the ES edm::ESHandle handle1; evSetup.get().get( handle1 ) ; boost::shared_ptr ptr1(new L1TMuonOverlapParams(*(handle1.product ()))); - cout<<"Some fields in L1TMuonOverlapParams: "< handle1; evSetup.get().get( handle1 ) ; @@ -41,5 +41,5 @@ void L1TMuonOverlapWriter::analyze(const edm::Event& iEvent, const edm::EventSet #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ModuleFactory.h" -DEFINE_FWK_MODULE(L1TMuonOverlapWriter); +DEFINE_FWK_MODULE(L1TMuonOverlapParamsWriter); diff --git a/L1TriggerConfig/Utilities/src/L1TriggerKeyExtReader.cc b/L1TriggerConfig/Utilities/src/L1TriggerKeyExtViewer.cc similarity index 88% rename from L1TriggerConfig/Utilities/src/L1TriggerKeyExtReader.cc rename to L1TriggerConfig/Utilities/src/L1TriggerKeyExtViewer.cc index 3d4b2862d0d8c..6c3effe776252 100644 --- a/L1TriggerConfig/Utilities/src/L1TriggerKeyExtReader.cc +++ b/L1TriggerConfig/Utilities/src/L1TriggerKeyExtViewer.cc @@ -8,21 +8,22 @@ #include "CondFormats/DataRecord/interface/L1TriggerKeyExtRcd.h" #include "CondFormats/L1TObjects/interface/L1TriggerKeyExt.h" -class L1TriggerKeyExtReader : public edm::EDAnalyzer { +class L1TriggerKeyExtViewer : public edm::EDAnalyzer { private: std::string label; public: - void analyze(const edm::Event&, const edm::EventSetup&) override; + void analyze(const edm::Event&, const edm::EventSetup&) override ; - explicit L1TriggerKeyExtReader(const edm::ParameterSet &pset) : edm::EDAnalyzer(), + explicit L1TriggerKeyExtViewer(const edm::ParameterSet &pset) : edm::EDAnalyzer(), label( pset.getParameter< std::string >( "label" ) ) {} - ~L1TriggerKeyExtReader(void) override{} + + ~L1TriggerKeyExtViewer(void) override {} }; #include using namespace std; -void L1TriggerKeyExtReader::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ +void L1TriggerKeyExtViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup){ edm::ESHandle handle1; evSetup.get().get( label, handle1 ) ; @@ -59,5 +60,5 @@ void L1TriggerKeyExtReader::analyze(const edm::Event& iEvent, const edm::EventSe #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/ModuleFactory.h" -DEFINE_FWK_MODULE(L1TriggerKeyExtReader); +DEFINE_FWK_MODULE(L1TriggerKeyExtViewer); diff --git a/L1TriggerConfig/Utilities/src/L1TriggerKeyListExtReader.cc b/L1TriggerConfig/Utilities/src/L1TriggerKeyListExtViewer.cc similarity index 96% rename from L1TriggerConfig/Utilities/src/L1TriggerKeyListExtReader.cc rename to L1TriggerConfig/Utilities/src/L1TriggerKeyListExtViewer.cc index bd1b9628ab8b4..0a5ab5a17ba5f 100644 --- a/L1TriggerConfig/Utilities/src/L1TriggerKeyListExtReader.cc +++ b/L1TriggerConfig/Utilities/src/L1TriggerKeyListExtViewer.cc @@ -12,11 +12,11 @@ class L1TriggerKeyListExtReader : public edm::EDAnalyzer { private: public: - void analyze(const edm::Event&, const edm::EventSetup&) override; + void analyze(const edm::Event&, const edm::EventSetup&) override ; explicit L1TriggerKeyListExtReader(const edm::ParameterSet&) : edm::EDAnalyzer(){ } - ~L1TriggerKeyListExtReader(void) override{} + ~L1TriggerKeyListExtReader(void) override {} }; #include diff --git a/L1TriggerConfig/Utilities/test/caloDump.py b/L1TriggerConfig/Utilities/test/caloL2Dump.py similarity index 100% rename from L1TriggerConfig/Utilities/test/caloDump.py rename to L1TriggerConfig/Utilities/test/caloL2Dump.py diff --git a/L1TriggerConfig/Utilities/test/uploadBmtfParams.py b/L1TriggerConfig/Utilities/test/uploadBmtfParams.py index fbbdbd9c4c736..555f12287cb57 100644 --- a/L1TriggerConfig/Utilities/test/uploadBmtfParams.py +++ b/L1TriggerConfig/Utilities/test/uploadBmtfParams.py @@ -23,7 +23,6 @@ from CondCore.CondDB.CondDB_cfi import CondDB CondDB.connect = cms.string('sqlite:l1config.db') -#CondDB.connect = cms.string('oracle://cms_orcoff_prep/CMS_CONDITIONS') outputDB = cms.Service("PoolDBOutputService", CondDB, diff --git a/L1TriggerConfig/Utilities/test/uploadCaloParams.py b/L1TriggerConfig/Utilities/test/uploadCaloParams.py index 048c054793f5e..ccc738fb1bdab 100644 --- a/L1TriggerConfig/Utilities/test/uploadCaloParams.py +++ b/L1TriggerConfig/Utilities/test/uploadCaloParams.py @@ -23,7 +23,6 @@ from CondCore.CondDB.CondDB_cfi import CondDB CondDB.connect = cms.string('sqlite:l1config.db') -#CondDB.connect = cms.string('oracle://cms_orcoff_prep/CMS_CONDITIONS') outputDB = cms.Service("PoolDBOutputService", CondDB, diff --git a/L1TriggerConfig/Utilities/test/uploadEmtfParams.py b/L1TriggerConfig/Utilities/test/uploadEmtfParams.py index 60b46791ba2b7..ce49b57b6a651 100644 --- a/L1TriggerConfig/Utilities/test/uploadEmtfParams.py +++ b/L1TriggerConfig/Utilities/test/uploadEmtfParams.py @@ -23,7 +23,6 @@ from CondCore.CondDB.CondDB_cfi import CondDB CondDB.connect = cms.string('sqlite:l1config.db') -#CondDB.connect = cms.string('oracle://cms_orcoff_prep/CMS_CONDITIONS') outputDB = cms.Service("PoolDBOutputService", CondDB, @@ -37,7 +36,7 @@ outputDB.DBParameters.authenticationPath = '.' process.add_(outputDB) -process.l1bpw = cms.EDAnalyzer("L1TMuonEndcapWriter", isO2Opayload = cms.untracked.bool(False)) +process.l1bpw = cms.EDAnalyzer("L1TMuonEndCapParamsWriter", isO2Opayload = cms.untracked.bool(False)) process.p = cms.Path(process.getter + process.l1bpw) diff --git a/L1TriggerConfig/Utilities/test/viewAll.py b/L1TriggerConfig/Utilities/test/viewAll.py index c39af37618ff9..da5f6f5e579de 100644 --- a/L1TriggerConfig/Utilities/test/viewAll.py +++ b/L1TriggerConfig/Utilities/test/viewAll.py @@ -10,7 +10,7 @@ process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) #process.load("L1Trigger.L1TMuon.fakeGmtParams_cff") -process.load("L1Trigger.L1TCalorimeter.caloStage2Params_2016_v2_2_cfi") +#process.load("L1Trigger.L1TCalorimeter.caloStage2Params_2016_v2_2_cfi") # Constructing a Global Tag process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff') @@ -24,32 +24,32 @@ cms.PSet( record = cms.string("L1TMuonBarrelParamsRcd"), tag = cms.string("L1TMuonBarrelParams_Stage2v0_hlt"), - connect = cms.string("frontier://FrontierPrep/CMS_CONDITIONS") + connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") ), cms.PSet( record = cms.string("L1TMuonOverlapParamsRcd"), - tag = cms.string("L1TMuonOverlapParams_Stage2v1_hlt"), - connect = cms.string("frontier://FrontierPrep/CMS_CONDITIONS") + tag = cms.string("L1TMuonOverlapParams_Stage2v0_hlt"), + connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") ), cms.PSet( record = cms.string("L1TMuonEndCapParamsRcd"), tag = cms.string("L1TMuonEndCapParams_Stage2v1_hlt"), - connect = cms.string("frontier://FrontierPrep/CMS_CONDITIONS") + connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") ), cms.PSet( record = cms.string("L1TMuonGlobalParamsRcd"), tag = cms.string("L1TMuonGlobalParams_Stage2v0_hlt"), - connect = cms.string("frontier://FrontierPrep/CMS_CONDITIONS") + connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") ), cms.PSet( record = cms.string("L1TCaloParamsRcd"), - tag = cms.string("L1TCaloParams_Stage2v0_hlt"), - connect = cms.string("frontier://FrontierPrep/CMS_CONDITIONS") + tag = cms.string("L1TCaloParams_Stage2v3_hlt"), + connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") ), cms.PSet( record = cms.string("L1TGlobalPrescalesVetosRcd"), tag = cms.string("L1TGlobalPrescalesVetos_Stage2v0_hlt"), - connect = cms.string("frontier://FrontierPrep/CMS_CONDITIONS") + connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") ) ) @@ -91,16 +91,15 @@ #) # Examples of various home-breed consumers -process.l1cr = cms.EDAnalyzer("L1MenuReader" ) -process.l1or = cms.EDAnalyzer("L1TOverlapReader", printLayerMap = cms.untracked.bool(True) ) -process.l1ecv = cms.EDAnalyzer("L1TEndcapViewer") +process.l1cr = cms.EDAnalyzer("L1MenuViewer") +process.l1or = cms.EDAnalyzer("L1TMuonOverlapParamsViewer", printLayerMap = cms.untracked.bool(True) ) +process.l1ecv = cms.EDAnalyzer("L1TMuonEndCapParamsViewer") process.l1gmr = cms.EDAnalyzer("L1TMuonGlobalParamsViewer", printLayerMap = cms.untracked.bool(True) ) -process.l1cpv = cms.EDAnalyzer("L1TCaloParamsViewer", printEgIsoLUT = cms.untracked.bool(False) ) +#process.l1cpv = cms.EDAnalyzer("L1TCaloParamsViewer", printEgIsoLUT = cms.untracked.bool(False) ) process.l1gpv = cms.EDAnalyzer("L1TGlobalPrescalesVetosViewer", prescale_table_verbosity = cms.untracked.int32(1), bxmask_map_verbosity = cms.untracked.int32(1) ) -process.p = cms.Path(process.l1cr + process.l1or + process.l1gmr + process.l1cpv + process.l1gpv) -#process.p = cms.Path(process.l1ecr) <- doesn't work in Prep DB because of the format change https://github.com/cms-sw/cmssw/commit/24e4598354bf66b18bd37a37eb779f35ef563847 +process.p = cms.Path(process.l1cr + process.l1or + process.l1gmr + process.l1gpv) diff --git a/L1TriggerConfig/Utilities/test/viewCaloParams.py b/L1TriggerConfig/Utilities/test/viewCaloParams.py index fe1d823739cac..efa3905b41e45 100644 --- a/L1TriggerConfig/Utilities/test/viewCaloParams.py +++ b/L1TriggerConfig/Utilities/test/viewCaloParams.py @@ -20,6 +20,13 @@ VarParsing.VarParsing.varType.int, "Run (IOV)" ) +options.register('tag', + 'L1TCaloParams_Stage2v3_hlt', + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Run (IOV)" +) + options.parseArguments() if "static" in options.db : @@ -42,7 +49,7 @@ toGet = cms.VPSet( cms.PSet( record = cms.string('L1TCaloParamsRcd'), - tag = cms.string("L1TCaloParams_Stage2v3_hlt") + tag = cms.string(options.tag) ) ) ) @@ -50,7 +57,29 @@ process.source = cms.Source("EmptySource", firstRun = cms.untracked.uint32(options.run)) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) -process.l1cpv = cms.EDAnalyzer("L1TCaloParamsViewer", printEgIsoLUT = cms.untracked.bool(False) ) +process.l1cpv = cms.EDAnalyzer("L1TCaloParamsViewer", + useStage2Rcd = cms.untracked.bool(False), + printPUSParams = cms.untracked.bool(False), + printTauCalibLUT = cms.untracked.bool(False), + printTauCompressLUT = cms.untracked.bool(False), + printJetCalibLUT = cms.untracked.bool(False), + printJetCalibPar = cms.untracked.bool(False), + printJetPUSPar = cms.untracked.bool(False), + printJetCompressPtLUT = cms.untracked.bool(False), + printJetCompressEtaLUT = cms.untracked.bool(False), + printEgCalibLUT = cms.untracked.bool(False), + printEgIsoLUT = cms.untracked.bool(False), + printEtSumMetPUSLUT = cms.untracked.bool(False), + printHfSF = cms.untracked.bool(False), + printHcalSF = cms.untracked.bool(False), + printEcalSF = cms.untracked.bool(False), + printEtSumEttPUSLUT = cms.untracked.bool(False), + printEtSumEcalSumPUSLUT = cms.untracked.bool(False), + printEtSumXCalibrationLUT = cms.untracked.bool(False), + printEtSumYCalibrationLUT = cms.untracked.bool(False), + printEtSumEttCalibrationLUT = cms.untracked.bool(False), + printEtSumEcalSumCalibrationLUT = cms.untracked.bool(False) +) process.p = cms.Path(process.l1cpv) diff --git a/L1TriggerConfig/Utilities/test/viewECpar.py b/L1TriggerConfig/Utilities/test/viewECpar.py index 5462410267d55..c72657f2353fc 100644 --- a/L1TriggerConfig/Utilities/test/viewECpar.py +++ b/L1TriggerConfig/Utilities/test/viewECpar.py @@ -51,7 +51,7 @@ process.source = cms.Source("EmptySource", firstRun = cms.untracked.uint32(options.run)) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) -process.l1ecv = cms.EDAnalyzer("L1TMuonEndcapViewer") +process.l1ecv = cms.EDAnalyzer("L1TMuonEndCapParamsViewer") process.p = cms.Path(process.l1ecv) diff --git a/L1TriggerConfig/Utilities/test/viewGlobalMuon.py b/L1TriggerConfig/Utilities/test/viewGlobalMuon.py index 295a7a0312108..70d95350c4ddf 100644 --- a/L1TriggerConfig/Utilities/test/viewGlobalMuon.py +++ b/L1TriggerConfig/Utilities/test/viewGlobalMuon.py @@ -39,7 +39,6 @@ CondDB.connect = cms.string(sourceDB) process.l1conddb = cms.ESSource("PoolDBESSource", CondDB, - connect = cms.string(sourceDB), toGet = cms.VPSet( cms.PSet( record = cms.string('L1TMuonGlobalParamsRcd'), diff --git a/L1TriggerConfig/Utilities/test/viewMenu.py b/L1TriggerConfig/Utilities/test/viewMenu.py index 7c707d0d1cde7..c81d4c47081d9 100644 --- a/L1TriggerConfig/Utilities/test/viewMenu.py +++ b/L1TriggerConfig/Utilities/test/viewMenu.py @@ -50,7 +50,7 @@ process.source = cms.Source("EmptySource", firstRun = cms.untracked.uint32(options.run)) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) -process.l1cr = cms.EDAnalyzer("L1MenuReader") +process.l1cr = cms.EDAnalyzer("L1MenuViewer") process.p = cms.Path(process.l1cr) diff --git a/L1TriggerConfig/Utilities/test/viewOverPar.py b/L1TriggerConfig/Utilities/test/viewOverPar.py index 86f1195a29690..b9502b0d1e92c 100644 --- a/L1TriggerConfig/Utilities/test/viewOverPar.py +++ b/L1TriggerConfig/Utilities/test/viewOverPar.py @@ -50,7 +50,7 @@ process.source = cms.Source("EmptySource", firstRun = cms.untracked.uint32(options.run)) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) -process.l1mor = cms.EDAnalyzer("L1TMuonOverlapReader", printLayerMap = cms.untracked.bool(True) ) +process.l1mor = cms.EDAnalyzer("L1TMuonOverlapParamsViewer", printLayerMap = cms.untracked.bool(True) ) process.p = cms.Path(process.l1mor) diff --git a/L1TriggerConfig/Utilities/test/viewL1TGlobalPrescalesVetos.py b/L1TriggerConfig/Utilities/test/viewPrescalesVetos.py similarity index 100% rename from L1TriggerConfig/Utilities/test/viewL1TGlobalPrescalesVetos.py rename to L1TriggerConfig/Utilities/test/viewPrescalesVetos.py diff --git a/OnlineDB/SiStripConfigDb/interface/SiStripPartition.h b/OnlineDB/SiStripConfigDb/interface/SiStripPartition.h index 310d040b0c054..cfdb1527f6d9f 100644 --- a/OnlineDB/SiStripConfigDb/interface/SiStripPartition.h +++ b/OnlineDB/SiStripConfigDb/interface/SiStripPartition.h @@ -95,6 +95,8 @@ class SiStripPartition { Versions pedestalsVersion() const; + Versions pedsFullNoiseVersion() const; + Versions apvLatencyVersion() const; Versions fineDelayVersion() const; @@ -169,6 +171,8 @@ class SiStripPartition { Versions pedestalsV_; + Versions pedsFullNoiseV_; + Versions apvLatencyV_; Versions fineDelayV_; @@ -210,6 +214,7 @@ inline SiStripPartition::Versions SiStripPartition::optoScanVersion() const { re inline SiStripPartition::Versions SiStripPartition::vpspScanVersion() const { return vpspScanV_; } inline SiStripPartition::Versions SiStripPartition::apvCalibVersion() const { return apvCalibV_; } inline SiStripPartition::Versions SiStripPartition::pedestalsVersion() const { return pedestalsV_; } +inline SiStripPartition::Versions SiStripPartition::pedsFullNoiseVersion() const { return pedsFullNoiseV_; } inline SiStripPartition::Versions SiStripPartition::apvLatencyVersion() const { return apvLatencyV_; } inline SiStripPartition::Versions SiStripPartition::fineDelayVersion() const { return fineDelayV_; } diff --git a/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc b/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc index cbdb736d510e9..8cfb522e6fb9e 100644 --- a/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc +++ b/OnlineDB/SiStripConfigDb/src/AnalysisDescriptions.cc @@ -34,7 +34,7 @@ SiStripConfigDb::AnalysisDescriptionsRange SiStripConfigDb::getAnalysisDescripti SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end(); for ( ; iter != jter; ++iter ) { - if ( partition == "" || partition == iter->second.partitionName() ) { + if ( partition.empty() || partition == iter->second.partitionName() ) { if ( iter->second.partitionName() == SiStripPartition::defaultPartitionName_ ) { continue; } @@ -72,6 +72,11 @@ SiStripConfigDb::AnalysisDescriptionsRange SiStripConfigDb::getAnalysisDescripti iter->second.pedestalsVersion().first, iter->second.pedestalsVersion().second, analysis_type ); + } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { + tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), + iter->second.pedestalsVersion().first, + iter->second.pedestalsVersion().second, + analysis_type ); } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_APVLATENCY ) { tmp1 = deviceFactory(__func__)->getAnalysisHistory( iter->second.partitionName(), iter->second.apvLatencyVersion().first, @@ -130,7 +135,7 @@ SiStripConfigDb::AnalysisDescriptionsRange SiStripConfigDb::getAnalysisDescripti uint16_t np = 0; uint16_t nc = 0; AnalysisDescriptionsRange anals = analyses_.emptyRange(); - if ( partition != "" ) { + if ( !partition.empty() ) { anals = analyses_.find( partition ); np = 1; nc = anals.size(); @@ -201,7 +206,7 @@ void SiStripConfigDb::addAnalysisDescriptions( std::string partition, AnalysisDe // Add to local cache analyses_.loadNext( partition, tmp ); - + // Some debug std::stringstream ss; ss << "[SiStripConfigDb::" << __func__ << "]" @@ -211,7 +216,6 @@ void SiStripConfigDb::addAnalysisDescriptions( std::string partition, AnalysisDe << " (Cache holds analysis descriptions for " << analyses_.size() << " partitions.)"; LogTrace(mlConfigDb_) << ss.str(); - } else { stringstream ss; ss << "[SiStripConfigDb::" << __func__ << "]" @@ -260,30 +264,47 @@ void SiStripConfigDb::uploadAnalysisDescriptions( bool calibration_for_physics, SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end(); for ( ; iter != jter; ++iter ) { - if ( partition == "" || partition == iter->second.partitionName() ) { - + if ( partition.empty() || partition == iter->second.partitionName() ) { + AnalysisDescriptionsRange range = analyses_.find( iter->second.partitionName() ); if ( range != analyses_.emptyRange() ) { - - AnalysisDescriptionsV anals( range.begin(), range.end() ); - - AnalysisType analysis_type = AnalysisDescription::T_UNKNOWN; - if ( anals.front() ) { analysis_type = anals.front()->getType(); } - if ( analysis_type == AnalysisDescription::T_UNKNOWN ) { - edm::LogWarning(mlConfigDb_) - << "[SiStripConfigDb::" << __func__ << "]" - << " Analysis type is UNKNOWN. Aborting upload!"; - return; + + AnalysisDescriptionsV anals( range.begin(), range.end() ); /// list of all analysis type + + vector analysis_type; // check how many different analysis type we have --> more than one analysis table could be uploaded in the same job + for(auto element : anals){ + if(std::find(analysis_type.begin(),analysis_type.end(),element->getType()) == analysis_type.end() and element->getType() != AnalysisDescription::T_UNKNOWN){ + analysis_type.push_back(element->getType()); + } + else if(element->getType() == AnalysisDescription::T_UNKNOWN){ + edm::LogWarning(mlConfigDb_) + << "[SiStripConfigDb::" << __func__ << "]" + << " Analysis type is UNKNOWN. Aborting upload!"; + return; + } } - - uint32_t version = deviceFactory(__func__)->uploadAnalysis( iter->second.runNumber(), - iter->second.partitionName(), - analysis_type, - anals, - calibration_for_physics ); + + vector analysisToUpload; // in case there are more than one analysis type to be uploaded + for(auto type : analysis_type){ + AnalysisDescriptionsV ana_temp; + for(auto element : anals){ + if(element->getType() == type) + ana_temp.push_back(element); + } + analysisToUpload.push_back(ana_temp); + } + + // perform the upload + for(auto analysis : analysisToUpload){ - // Update current state with analysis descriptions - if ( calibration_for_physics ) { deviceFactory(__func__)->uploadAnalysisState( version ); } + uint32_t version = deviceFactory(__func__)->uploadAnalysis( iter->second.runNumber(), + iter->second.partitionName(), + analysis.front()->getType(), + analysis, + calibration_for_physics); + // Update current state with analysis descriptions + if ( calibration_for_physics ) { deviceFactory(__func__)->uploadAnalysisState( version );} + } // Some debug std::stringstream ss; @@ -303,7 +324,7 @@ void SiStripConfigDb::uploadAnalysisDescriptions( bool calibration_for_physics, continue; } - } else { + }else { // stringstream ss; // ss << "[SiStripConfigDb::" << __func__ << "]" // << " Cannot find partition \"" << partition @@ -311,10 +332,8 @@ void SiStripConfigDb::uploadAnalysisDescriptions( bool calibration_for_physics, // << dbParams_.partitionNames( dbParams_.partitionNames() ) // << "\", therefore aborting upload for this partition!"; // edm::LogWarning(mlConfigDb_) << ss.str(); - } - - } - + } + } } catch (...) { handleException( __func__ ); } allowCalibUpload_ = true; @@ -336,7 +355,7 @@ void SiStripConfigDb::clearAnalysisDescriptions( std::string partition ) { // Reproduce temporary cache for "all partitions except specified one" (or clear all if none specified) AnalysisDescriptions temporary_cache; - if ( partition == "" ) { temporary_cache = AnalysisDescriptions(); } + if ( partition.empty() ) { temporary_cache = AnalysisDescriptions(); } else { SiStripDbParams::SiStripPartitions::const_iterator iter = dbParams_.partitions().begin(); SiStripDbParams::SiStripPartitions::const_iterator jter = dbParams_.partitions().end(); @@ -358,7 +377,7 @@ void SiStripConfigDb::clearAnalysisDescriptions( std::string partition ) { // Delete objects in local cache for specified partition (or all if not specified) AnalysisDescriptionsRange anals = analyses_.emptyRange(); - if ( partition == "" ) { + if ( partition.empty() ) { if ( !analyses_.empty() ) { anals = AnalysisDescriptionsRange( analyses_.find( dbParams_.partitions().begin()->second.partitionName() ).begin(), analyses_.find( (--(dbParams_.partitions().end()))->second.partitionName() ).end() ); @@ -377,7 +396,7 @@ void SiStripConfigDb::clearAnalysisDescriptions( std::string partition ) { } else { stringstream ss; ss << "[SiStripConfigDb::" << __func__ << "]"; - if ( partition == "" ) { ss << " Found no analysis descriptions in local cache!"; } + if ( partition.empty() ) { ss << " Found no analysis descriptions in local cache!"; } else { ss << " Found no analysis descriptions in local cache for partition \"" << partition << "\"!"; } edm::LogWarning(mlConfigDb_) << ss.str(); } @@ -403,7 +422,7 @@ void SiStripConfigDb::printAnalysisDescriptions( std::string partition ) { for ( ; ianal != janal; ++ianal ) { cntr++; - if ( partition == "" || partition == ianal->first ) { + if ( partition.empty() || partition == ianal->first ) { ss << " Partition number : " << cntr << " (out of " << analyses_.size() << ")" << std::endl; ss << " Partition name : \"" << ianal->first << "\"" << std::endl; @@ -514,6 +533,7 @@ std::string SiStripConfigDb::analysisType( AnalysisType analysis_type ) const { else if ( analysis_type == AnalysisDescription::T_ANALYSIS_TIMING ) { return "APV_TIMING"; } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_OPTOSCAN ) { return "OPTO_SCAN"; } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_PEDESTALS ) { return "PEDESTALS"; } + else if ( analysis_type == AnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { return "PEDSFULLNOISE"; } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_APVLATENCY ) { return "APV_LATENCY"; } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_FINEDELAY ) { return "FINE_DELAY"; } else if ( analysis_type == AnalysisDescription::T_ANALYSIS_CALIBRATION ) { return "CALIBRATION"; } diff --git a/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc b/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc index 43ac013035d05..3bbf1496fad79 100644 --- a/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc +++ b/OnlineDB/SiStripConfigDb/src/SiStripPartition.cc @@ -36,6 +36,7 @@ SiStripPartition::SiStripPartition() : vpspScanV_(0,0), apvCalibV_(0,0), pedestalsV_(0,0), + pedsFullNoiseV_(0,0), apvLatencyV_(0,0), fineDelayV_(0,0), inputModuleXml_(""), @@ -68,6 +69,7 @@ SiStripPartition::SiStripPartition( std::string partition ) : vpspScanV_(0,0), apvCalibV_(0,0), pedestalsV_(0,0), + pedsFullNoiseV_(0,0), apvLatencyV_(0,0), fineDelayV_(0,0), inputModuleXml_(""), @@ -102,6 +104,7 @@ SiStripPartition::SiStripPartition( const SiStripPartition& input ) : vpspScanV_( input.vpspScanVersion() ), apvCalibV_( input.apvCalibVersion() ), pedestalsV_( input.pedestalsVersion() ), + pedsFullNoiseV_( input.pedsFullNoiseVersion() ), apvLatencyV_( input.apvLatencyVersion() ), fineDelayV_( input.fineDelayVersion() ), inputModuleXml_( input.inputModuleXml() ), @@ -135,6 +138,7 @@ SiStripPartition& SiStripPartition::operator= ( const SiStripPartition& input ){ vpspScanV_ = input.vpspScanVersion(); apvCalibV_ = input.apvCalibVersion(); pedestalsV_ = input.pedestalsVersion(); + pedsFullNoiseV_ = input.pedsFullNoiseVersion(); apvLatencyV_ = input.apvLatencyVersion(); fineDelayV_ = input.fineDelayVersion(); inputModuleXml_ = input.inputModuleXml(); @@ -168,6 +172,7 @@ bool SiStripPartition::operator== ( const SiStripPartition& input ) const { vpspScanV_ == input.vpspScanVersion() && apvCalibV_ == input.apvCalibVersion() && pedestalsV_ == input.pedestalsVersion() && + pedsFullNoiseV_ == input.pedsFullNoiseVersion() && apvLatencyV_ == input.apvLatencyVersion() && fineDelayV_ == input.fineDelayVersion() && inputModuleXml_ == input.inputModuleXml() && @@ -215,6 +220,7 @@ void SiStripPartition::reset() { vpspScanV_ = std::make_pair(0,0); apvCalibV_ = std::make_pair(0,0); pedestalsV_ = std::make_pair(0,0); + pedsFullNoiseV_ = std::make_pair(0,0); apvLatencyV_ = std::make_pair(0,0); fineDelayV_ = std::make_pair(0,0); @@ -251,6 +257,7 @@ void SiStripPartition::pset( const edm::ParameterSet& pset ) { vpspScanV_ = versions( pset.getUntrackedParameter< std::vector >( "VpspScanVersion", tmp2 ) ); apvCalibV_ = versions( pset.getUntrackedParameter< std::vector >( "ApvCalibVersion", tmp2 ) ); pedestalsV_ = versions( pset.getUntrackedParameter< std::vector >( "PedestalsVersion", tmp2 ) ); + pedsFullNoiseV_ = versions( pset.getUntrackedParameter< std::vector >( "PedsFullNoiseVersion", tmp2 ) ); apvLatencyV_ = versions( pset.getUntrackedParameter< std::vector >( "ApvLatencyVersion", tmp2 ) ); fineDelayV_ = versions( pset.getUntrackedParameter< std::vector >( "FineDelayVersion", tmp2 ) ); @@ -350,7 +357,7 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { maskVersion_.second = (*istate)->getMaskVersionMinorId(); } //#endif - + // Retrieve global and local versions if ( forceCurrentState_ || globalAnalysisV_ ) { // use global version (or current state) @@ -382,6 +389,9 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_PEDESTALS ) { pedestalsV_.first = ivers->second.first; pedestalsV_.second = ivers->second.second; + } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { + pedsFullNoiseV_.first = ivers->second.first; + pedsFullNoiseV_.second = ivers->second.second; } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_APVLATENCY ) { apvLatencyV_.first = ivers->second.first; apvLatencyV_.second = ivers->second.second; @@ -443,6 +453,11 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { pedestalsV_.first = ivers->second.first; pedestalsV_.second = ivers->second.second; } + } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { + if ( !pedsFullNoiseV_.first && !pedsFullNoiseV_.second ) { + pedsFullNoiseV_.first = ivers->second.first; + pedsFullNoiseV_.second = ivers->second.second; + } } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_APVLATENCY ) { if ( !apvLatencyV_.first && !apvLatencyV_.second ) { apvLatencyV_.first = ivers->second.first; @@ -484,7 +499,7 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { TkRun* run = nullptr; if ( !runNumber_ ) { run = df->getLastRun( partitionName_ ); } else { run = df->getRun( partitionName_, runNumber_ ); } - + // Retrieve versioning for given TkRun object if ( run ) { @@ -570,6 +585,9 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_PEDESTALS ) { pedestalsV_.first = ivers->second.first; pedestalsV_.second = ivers->second.second; + } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { + pedsFullNoiseV_.first = ivers->second.first; + pedsFullNoiseV_.second = ivers->second.second; } else if ( ivers->first == CommissioningAnalysisDescription::T_ANALYSIS_APVLATENCY ) { apvLatencyV_.first = ivers->second.first; apvLatencyV_.second = ivers->second.second; @@ -604,6 +622,7 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { else if ( runType_ == sistrip::VPSP_SCAN ) { type = CommissioningAnalysisDescription::T_ANALYSIS_VPSPSCAN; } else if ( runType_ == sistrip::CALIBRATION ) { type = CommissioningAnalysisDescription::T_ANALYSIS_CALIBRATION; } else if ( runType_ == sistrip::PEDESTALS ) { type = CommissioningAnalysisDescription::T_ANALYSIS_PEDESTALS; } + else if ( runType_ == sistrip::PEDS_FULL_NOISE) { type = CommissioningAnalysisDescription::T_ANALYSIS_PEDSFULLNOISE; } else if ( runType_ == sistrip::APV_LATENCY ) { type = CommissioningAnalysisDescription::T_ANALYSIS_APVLATENCY; } else if ( runType_ == sistrip::FINE_DELAY_TTC ) { type = CommissioningAnalysisDescription::T_ANALYSIS_FINEDELAY; } @@ -644,6 +663,10 @@ void SiStripPartition::update( const SiStripConfigDb* const db ) { runTableVersion_ = pedestalsV_; pedestalsV_.first = ivers->second.back().first; pedestalsV_.second = ivers->second.back().second; + } else if ( type == CommissioningAnalysisDescription::T_ANALYSIS_PEDSFULLNOISE ) { + runTableVersion_ = pedsFullNoiseV_; + pedsFullNoiseV_.first = ivers->second.back().first; + pedsFullNoiseV_.second = ivers->second.back().second; } else if ( type == CommissioningAnalysisDescription::T_ANALYSIS_APVLATENCY ) { runTableVersion_ = apvLatencyV_; apvLatencyV_.first = ivers->second.back().first; @@ -752,6 +775,7 @@ void SiStripPartition::print( std::stringstream& ss, bool using_db ) const { ss << " VPSP scan maj/min vers : " << vpspScanV_.first << "." << vpspScanV_.second << std::endl; ss << " APV calib maj/min vers : " << apvCalibV_.first << "." << apvCalibV_.second << std::endl; ss << " Pedestals maj/min vers : " << pedestalsV_.first << "." << pedestalsV_.second << std::endl; + ss << " PedsFullNoise maj/min vers : " << pedsFullNoiseV_.first << "." << pedsFullNoiseV_.second << std::endl; ss << " APV latency maj/min vers : " << apvLatencyV_.first << "." << apvLatencyV_.second << std::endl; ss << " Fine delay maj/min vers : " << fineDelayV_.first << "." << fineDelayV_.second << std::endl; @@ -765,7 +789,7 @@ void SiStripPartition::print( std::stringstream& ss, bool using_db ) const { << fastCablingV_.first << "." << fastCablingV_.second << " for this FED cabling run!" << std::endl; } - + if ( runType_ != sistrip::APV_TIMING ) { ss << " APV timing maj/min vers : " << apvTimingV_.first << "." << apvTimingV_.second << std::endl; } else { @@ -811,6 +835,15 @@ void SiStripPartition::print( std::stringstream& ss, bool using_db ) const { << " for this pedestals run!" << std::endl; } + if ( runType_ != sistrip::PEDS_FULL_NOISE ) { + ss << " PedsFullNoise maj/min vers : " << pedsFullNoiseV_.first << "." << pedsFullNoiseV_.second << std::endl; + } else { + ss << " Pedestals maj/min vers : " << runTableVersion_.first << "." << runTableVersion_.second + << " <= This \"state\" version overriden by \"history\" version " + << pedsFullNoiseV_.first << "." << pedsFullNoiseV_.second + << " for this pedestals run!" << std::endl; + } + if ( runType_ != sistrip::APV_LATENCY ) { ss << " APV latency maj/min vers : " << apvLatencyV_.first << "." << apvLatencyV_.second << std::endl; } else { diff --git a/PhysicsTools/KinFitter/interface/TFitConstraintEp.h b/PhysicsTools/KinFitter/interface/TFitConstraintEp.h index 8b979de5d1948..9884982c99772 100644 --- a/PhysicsTools/KinFitter/interface/TFitConstraintEp.h +++ b/PhysicsTools/KinFitter/interface/TFitConstraintEp.h @@ -56,6 +56,7 @@ protected : Double_t _constraint; // Value of constraint TFitConstraintEp::component _component; // 4vector component to be constrained + ClassDefOverride(TFitConstraintEp, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitConstraintM.h b/PhysicsTools/KinFitter/interface/TFitConstraintM.h index 778f5e98ac865..f5775dad47656 100644 --- a/PhysicsTools/KinFitter/interface/TFitConstraintM.h +++ b/PhysicsTools/KinFitter/interface/TFitConstraintM.h @@ -50,7 +50,10 @@ protected : std::vector _ParList1; // Vector containing first list of constrained particles ( sum[ m_i ] - sum[ m_j ] == 0 ) std::vector _ParList2; // Vector containing second list of constrained particles ( sum[ m_i ] - sum[ m_j ] == 0 ) Double_t _TheMassConstraint; - + +private : + + ClassDefOverride(TFitConstraintM, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h b/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h index 34ad0c61f27a2..3fbe516498a9c 100644 --- a/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h +++ b/PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h @@ -37,7 +37,9 @@ protected : void init(); +private : + ClassDefOverride(TFitConstraintMGaus, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleCart.h b/PhysicsTools/KinFitter/interface/TFitParticleCart.h index 0bf9af349169b..d2a215631fd67 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleCart.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleCart.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDefOverride(TFitParticleCart, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleECart.h b/PhysicsTools/KinFitter/interface/TFitParticleECart.h index b5828a7407983..a15846a51a75b 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleECart.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleECart.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDefOverride(TFitParticleECart, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h index 4a43902a93d03..df087754c51d7 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h @@ -36,7 +36,8 @@ protected : private: - + + ClassDefOverride(TFitParticleEMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h index dcea16e8deb46..416952df37c7c 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h @@ -30,6 +30,9 @@ protected : void init(TLorentzVector* pini, const TMatrixD* theCovMatrix); +private : + + ClassDefOverride(TFitParticleEScaledMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleESpher.h b/PhysicsTools/KinFitter/interface/TFitParticleESpher.h index f3698f9b664d7..8e44c7b2519bc 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleESpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleESpher.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDefOverride(TFitParticleESpher, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h b/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h index a9d0c14f90b46..844b05a32d816 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDefOverride(TFitParticleEtEtaPhi, 0) }; diff --git a/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h b/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h index 5916d985c81ac..b7db328ab5482 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDefOverride(TFitParticleEtThetaPhi, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h b/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h index 1a82db060d51a..735534feb144b 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCCart.h @@ -31,8 +31,10 @@ protected : void init(TVector3* p, Double_t M, const TMatrixD* theCovMatrix); - + private: + + ClassDefOverride(TFitParticleMCCart, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h index 30c5a6682b1e3..e58403ffc9f26 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h @@ -32,8 +32,10 @@ protected : void init(TVector3* p, Double_t M, const TMatrixD* theCovMatrix); - + private: + + ClassDefOverride(TFitParticleMCMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h b/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h index d7bba8bfd8586..a3430e34df3c0 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h @@ -31,8 +31,10 @@ protected : void init(TVector3* p, Double_t M, const TMatrixD* theCovMatrix); - + private: + + ClassDefOverride(TFitParticleMCPInvSpher, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h b/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h index 76edadaf2a99a..3298a4fef0855 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h @@ -31,8 +31,10 @@ protected : void init(TVector3* p, Double_t M, const TMatrixD* theCovMatrix); - + private: + + ClassDefOverride(TFitParticleMCSpher, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h b/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h index ef43442a64e9d..61c5c37b405f8 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleMomDev.h @@ -36,7 +36,8 @@ protected : private: - + + ClassDefOverride(TFitParticleMomDev, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TFitParticleSpher.h b/PhysicsTools/KinFitter/interface/TFitParticleSpher.h index 2f9b2110ba22e..740240d139f75 100644 --- a/PhysicsTools/KinFitter/interface/TFitParticleSpher.h +++ b/PhysicsTools/KinFitter/interface/TFitParticleSpher.h @@ -34,7 +34,8 @@ protected : private: - + + ClassDefOverride(TFitParticleSpher, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TKinFitter.h b/PhysicsTools/KinFitter/interface/TKinFitter.h index 7d12c74df9f13..445c976ec4f02 100644 --- a/PhysicsTools/KinFitter/interface/TKinFitter.h +++ b/PhysicsTools/KinFitter/interface/TKinFitter.h @@ -148,6 +148,7 @@ private : Int_t _status; // Status of the last fit;_ Int_t _nbIter; // number of iteration performed in the fit + ClassDefOverride(TKinFitter, 0) }; #endif diff --git a/PhysicsTools/KinFitter/interface/TSLToyGen.h b/PhysicsTools/KinFitter/interface/TSLToyGen.h index f1dbbc582946a..e365d41ba3939 100644 --- a/PhysicsTools/KinFitter/interface/TSLToyGen.h +++ b/PhysicsTools/KinFitter/interface/TSLToyGen.h @@ -92,6 +92,7 @@ private : Bool_t _withMPDGCons; Bool_t _doCheckConstraintsTruth; + ClassDefOverride(TSLToyGen, 0) }; #endif diff --git a/PhysicsTools/KinFitter/src/classes.h b/PhysicsTools/KinFitter/src/classes.h new file mode 100644 index 0000000000000..c0e112b57b994 --- /dev/null +++ b/PhysicsTools/KinFitter/src/classes.h @@ -0,0 +1,47 @@ +#include "PhysicsTools/KinFitter/interface/TAbsFitConstraint.h" +#include "PhysicsTools/KinFitter/interface/TAbsFitParticle.h" +#include "PhysicsTools/KinFitter/interface/TFitConstraintEp.h" +#include "PhysicsTools/KinFitter/interface/TFitConstraintM.h" +#include "PhysicsTools/KinFitter/interface/TFitConstraintMGaus.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleCart.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleECart.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleEMomDev.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleEScaledMomDev.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleESpher.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleEtEtaPhi.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleEtThetaPhi.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleMCCart.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleMCMomDev.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleMCPInvSpher.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleMCSpher.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleMomDev.h" +#include "PhysicsTools/KinFitter/interface/TFitParticleSpher.h" +#include "PhysicsTools/KinFitter/interface/TKinFitter.h" +#include "PhysicsTools/KinFitter/interface/TSLToyGen.h" + + +namespace PhysicsTools_KinFitter { + struct dictionary { + + TFitConstraintEp fce; + TFitConstraintEp::component fce_c; + TFitConstraintM fcm; + TFitConstraintMGaus fcmg; + TFitParticleCart fpc; + TFitParticleECart fpec; + TFitParticleEMomDev fpemd; + TFitParticleEScaledMomDev fpesmd; + TFitParticleESpher fpes; + TFitParticleEtEtaPhi fpeep; + TFitParticleEtThetaPhi fpetp; + TFitParticleMCCart fpmcc; + TFitParticleMCMomDev fmmccd; + TFitParticleMCPInvSpher fpmcpis; + TFitParticleMCSpher fpmcs; + TFitParticleMomDev fpmd; + TFitParticleSpher fps; + TKinFitter kf; + TSLToyGen sltg; + + }; +} diff --git a/PhysicsTools/KinFitter/src/classes_def.xml b/PhysicsTools/KinFitter/src/classes_def.xml new file mode 100644 index 0000000000000..7ef2f3cb674fc --- /dev/null +++ b/PhysicsTools/KinFitter/src/classes_def.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc b/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc index b2c20d0fd2ef9..98e5eba258036 100644 --- a/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc +++ b/PhysicsTools/NanoAOD/plugins/LHETablesProducer.cc @@ -5,6 +5,7 @@ #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "DataFormats/NanoAOD/interface/FlatTable.h" #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h" +#include "TLorentzVector.h" #include #include @@ -13,9 +14,14 @@ class LHETablesProducer : public edm::global::EDProducer<> { public: LHETablesProducer( edm::ParameterSet const & params ) : - lheTag_(consumes(params.getParameter("lheInfo"))) + lheTag_(consumes(params.getParameter("lheInfo"))), + precision_(params.existsAs("precision") ? params.getParameter("precision") : -1), + storeLHEParticles_(params.existsAs("storeLHEParticles") ? params.getParameter("storeLHEParticles") : -1) { - produces(); + produces("LHE"); + if (storeLHEParticles_) + produces("LHEPart"); + } ~LHETablesProducer() override {} @@ -25,13 +31,19 @@ class LHETablesProducer : public edm::global::EDProducer<> { edm::Handle lheInfo; if (iEvent.getByToken(lheTag_, lheInfo)) { - fillLHEObjectTable(*lheInfo, *lheTab); + auto lhePartTab = fillLHEObjectTable(*lheInfo, *lheTab); + if (storeLHEParticles_) iEvent.put(std::move(lhePartTab), "LHEPart"); + } else { + if (storeLHEParticles_) { // need to store a dummy table anyway to make the framework happy + auto lhePartTab = std::make_unique(1, "LHEPart", true); + iEvent.put(std::move(lhePartTab), "LHEPart"); + } } + iEvent.put(std::move(lheTab), "LHE"); - iEvent.put(std::move(lheTab)); } - void fillLHEObjectTable(const LHEEventProduct & lheProd, nanoaod::FlatTable & out) const { + std::unique_ptr fillLHEObjectTable(const LHEEventProduct & lheProd, nanoaod::FlatTable & out) const { double lheHT = 0, lheHTIncoming = 0; unsigned int lheNj = 0, lheNb = 0, lheNc = 0, lheNuds = 0, lheNglu = 0; double lheVpt = 0; @@ -39,9 +51,22 @@ class LHETablesProducer : public edm::global::EDProducer<> { const auto & hepeup = lheProd.hepeup(); const auto & pup = hepeup.PUP; int lep = -1, lepBar = -1, nu = -1, nuBar = -1; + std::vector vals_pt; + std::vector vals_eta; + std::vector vals_phi; + std::vector vals_mass; + std::vector vals_pid; for (unsigned int i = 0, n = pup.size(); i < n; ++i) { int status = hepeup.ISTUP[i]; int idabs = std::abs(hepeup.IDUP[i]); + if (status == 1){ + TLorentzVector p4(pup[i][0], pup[i][1], pup[i][2], pup[i][3]); // x,y,z,t + vals_pt.push_back(p4.Pt()); + vals_eta.push_back(p4.Eta()); + vals_phi.push_back(p4.Phi()); + vals_mass.push_back(p4.M()); + vals_pid.push_back(hepeup.IDUP[i]); + } if ( (status == 1) && ( ( idabs == 21 ) || (idabs > 0 && idabs < 7) ) ) { //# gluons and quarks // object counters lheNj++; @@ -83,16 +108,30 @@ class LHETablesProducer : public edm::global::EDProducer<> { out.addColumnValue("Vpt", lheVpt, "pT of the W or Z boson at LHE step", nanoaod::FlatTable::FloatColumn); out.addColumnValue("NpNLO", lheProd.npNLO(), "number of partons at NLO", nanoaod::FlatTable::UInt8Column); out.addColumnValue("NpLO", lheProd.npLO(), "number of partons at LO", nanoaod::FlatTable::UInt8Column); + + + auto outPart = std::make_unique(vals_pt.size(), "LHEPart", false); + outPart->addColumn("pt", vals_pt, "Pt of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart->addColumn("eta", vals_eta, "Pseodorapidity of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart->addColumn("phi", vals_phi, "Phi of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart->addColumn("mass", vals_mass, "Mass of LHE particles", nanoaod::FlatTable::FloatColumn, this->precision_); + outPart->addColumn ("pdgId", vals_pid, "PDG ID of LHE particles", nanoaod::FlatTable::IntColumn); + + return outPart; } static void fillDescriptions(edm::ConfigurationDescriptions & descriptions) { edm::ParameterSetDescription desc; desc.add("lheInfo", edm::InputTag("externalLHEProducer"))->setComment("tag for the LHE information (LHEEventProduct)"); + desc.add("precision", -1)->setComment("precision on the 4-momenta of the LHE particles"); + desc.add("storeLHEParticles", false)->setComment("Whether we want to store the 4-momenta of the status 1 particles at LHE level"); descriptions.add("lheInfoTable", desc); } protected: const edm::EDGetTokenT lheTag_; + const unsigned int precision_; + const bool storeLHEParticles_; }; #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/NanoAOD/plugins/LeptonJetVarProducer.cc b/PhysicsTools/NanoAOD/plugins/LeptonJetVarProducer.cc index a671e8650a98f..14f3064688c2f 100644 --- a/PhysicsTools/NanoAOD/plugins/LeptonJetVarProducer.cc +++ b/PhysicsTools/NanoAOD/plugins/LeptonJetVarProducer.cc @@ -160,7 +160,9 @@ LeptonJetVarProducer::calculatePtRatioRel(edm::Ptr lep, edm: if ((rawp4-lepp4).R()<1e-4) return std::tuple(1.0,0.0,0.0); - auto jetp4 = (rawp4 - lepp4*(1.0/jet->jecFactor("L1FastJet")))*(jet->pt()/rawp4.pt())+lepp4; + auto l1corrFactor = jet->jecFactor("L1FastJet")/jet->jecFactor("Uncorrected"); + + auto jetp4 = (rawp4 - lepp4*(1.0/l1corrFactor))*(jet->pt()/rawp4.pt())+lepp4; auto ptratio = lepp4.pt()/jetp4.pt(); auto ptrel = lepp4.Vect().Cross((jetp4-lepp4).Vect().Unit()).R(); diff --git a/PhysicsTools/NanoAOD/python/electrons_cff.py b/PhysicsTools/NanoAOD/python/electrons_cff.py index 27c4cad91f536..2e2dbee7659f7 100644 --- a/PhysicsTools/NanoAOD/python/electrons_cff.py +++ b/PhysicsTools/NanoAOD/python/electrons_cff.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy from Configuration.Eras.Modifier_run2_nanoAOD_92X_cff import run2_nanoAOD_92X +from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 from PhysicsTools.NanoAOD.common_cff import * import PhysicsTools.PatAlgos.producersLayer1.electronProducer_cfi from math import ceil,log @@ -93,26 +94,27 @@ run2_nanoAOD_92X.toModify(isoForEle, src = "slimmedElectronsUpdated") ptRatioRelForEle = cms.EDProducer("ElectronJetVarProducer", - srcJet = cms.InputTag("slimmedJets"), + srcJet = cms.InputTag("updatedJets"), srcLep = cms.InputTag("slimmedElectrons"), srcVtx = cms.InputTag("offlineSlimmedPrimaryVertices"), ) run2_miniAOD_80XLegacy.toModify(ptRatioRelForEle, srcLep = "slimmedElectronsUpdated") run2_nanoAOD_92X.toModify(ptRatioRelForEle, srcLep = "slimmedElectronsUpdated") -from EgammaAnalysis.ElectronTools.calibratedElectronsRun2_cfi import calibratedPatElectrons -calibratedPatElectrons.correctionFile = cms.string("PhysicsTools/NanoAOD/data/80X_ichepV1_2016_ele") # hack, should go somewhere in EgammaAnalysis -calibratedPatElectrons.semiDeterministic = cms.bool(True) -run2_miniAOD_80XLegacy.toModify(calibratedPatElectrons, electrons = "slimmedElectronsUpdated") -run2_nanoAOD_92X.toModify(calibratedPatElectrons, electrons = "slimmedElectronsUpdated") - -energyCorrForEle = cms.EDProducer("ElectronEnergyVarProducer", - srcRaw = cms.InputTag("slimmedElectrons"), - srcCorr = cms.InputTag("calibratedPatElectrons"), +import EgammaAnalysis.ElectronTools.calibratedElectronsRun2_cfi +calibratedPatElectrons80X = EgammaAnalysis.ElectronTools.calibratedElectronsRun2_cfi.calibratedPatElectrons.clone( + electrons = cms.InputTag("slimmedElectronsUpdated"), + correctionFile = cms.string("PhysicsTools/NanoAOD/data/80X_ichepV1_2016_ele"), + semiDeterministic = cms.bool(True) +) +energyCorrForEle80X = cms.EDProducer("ElectronEnergyVarProducer", + srcRaw = cms.InputTag("slimmedElectronsUpdated"), + srcCorr = cms.InputTag("calibratedPatElectrons80X"), +) +import RecoEgamma.EgammaTools.calibratedEgammas_cff +calibratedPatElectrons94Xv1 = RecoEgamma.EgammaTools.calibratedEgammas_cff.calibratedPatElectrons.clone( + produceCalibratedObjs = False ) -run2_miniAOD_80XLegacy.toModify(energyCorrForEle, srcRaw = "slimmedElectronsUpdated") -run2_nanoAOD_92X.toModify(energyCorrForEle, srcRaw = "slimmedElectronsUpdated") - slimmedElectronsWithUserData = cms.EDProducer("PATElectronUserDataEmbedder", src = cms.InputTag("slimmedElectrons"), @@ -127,7 +129,6 @@ ptRatio = cms.InputTag("ptRatioRelForEle:ptRatio"), ptRel = cms.InputTag("ptRatioRelForEle:ptRel"), jetNDauChargedMVASel = cms.InputTag("ptRatioRelForEle:jetNDauChargedMVASel"), - eCorr = cms.InputTag("energyCorrForEle:eCorr"), ), userIntFromBools = cms.PSet( mvaFall17Iso_WP90 = cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-iso-V1-wp90"), @@ -156,6 +157,12 @@ mvaSpring16HZZ = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Spring16HZZV1Values"), mvaFall17Iso = None, mvaFall17noIso = None, + eCorr = cms.InputTag("energyCorrForEle80X","eCorr") +) +run2_nanoAOD_94XMiniAODv1.toModify(slimmedElectronsWithUserData.userFloats, + ecalTrkEnergyErrPostCorr = cms.InputTag("calibratedPatElectrons94Xv1","ecalTrkEnergyErrPostCorr"), + ecalTrkEnergyPreCorr = cms.InputTag("calibratedPatElectrons94Xv1","ecalTrkEnergyPreCorr"), + ecalTrkEnergyPostCorr = cms.InputTag("calibratedPatElectrons94Xv1","ecalTrkEnergyPostCorr"), ) run2_miniAOD_80XLegacy.toReplaceWith(slimmedElectronsWithUserData.userIntFromBools, cms.PSet( @@ -215,8 +222,8 @@ variables = cms.PSet(CandVars, jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"), photonIdx = Var("?overlaps('photons').size()>0?overlaps('photons')[0].key():-1", int, doc="index of the associated photon (-1 if none)"), - energyErr = Var("p4Error('P4_COMBINATION')*userFloat('eCorr')",float,doc="energy error of the cluster-track combination",precision=6), - eCorr = Var("userFloat('eCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), + energyErr = Var("userFloat('ecalTrkEnergyErrPostCorr')",float,doc="energy error of the cluster-track combination",precision=6), + eCorr = Var("userFloat('ecalTrkEnergyPostCorr')/userFloat('ecalTrkEnergyPreCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), dz = Var("dB('PVDZ')",float,doc="dz (with sign) wrt first PV, in cm",precision=10), dzErr = Var("abs(edB('PVDZ'))",float,doc="dz uncertainty, in cm",precision=6), dxy = Var("dB('PV2D')",float,doc="dxy (with sign) wrt first PV, in cm",precision=10), @@ -255,7 +262,7 @@ mvaTTH = ExtVar(cms.InputTag("electronMVATTH"),float, doc="TTH MVA lepton ID score",precision=14), ), ) -electronTable.variables.pt = Var("pt*userFloat('eCorr')", float, precision=-1, doc="p_{T} after energy correction & smearing") +electronTable.variables.pt = Var("pt*userFloat('ecalTrkEnergyPostCorr')/userFloat('ecalTrkEnergyPreCorr')", float, precision=-1, doc="p_{T}") run2_miniAOD_80XLegacy.toModify(electronTable.variables, cutBased_HLTPreSel = Var("userInt('cutbasedID_HLT')",int,doc="cut-based HLT pre-selection ID"), mvaSpring16GP = Var("userFloat('mvaSpring16GP')",float,doc="MVA general-purpose ID score"), @@ -271,6 +278,14 @@ mvaFall17noIso_WP80 = None, mvaFall17noIso_WP90 = None, mvaFall17noIso_WPL = None, + pt = Var("pt*userFloat('eCorr')", float, precision=-1, doc="p_{T} after energy correction & smearing"), + energyErr = Var("p4Error('P4_COMBINATION')*userFloat('eCorr')",float,doc="energy error of the cluster-track combination",precision=6), + eCorr = Var("userFloat('eCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), +) +run2_nanoAOD_92X.toModify(electronTable.variables, + pt = Var("pt", float, precision=-1, doc="p_{T} (no energy correction & smearing)"), + energyErr = Var("p4Error('P4_COMBINATION')",float,doc="energy error of the cluster-track combination",precision=6), + eCorr = None, ) electronsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR @@ -294,10 +309,18 @@ docString = cms.string("MC matching to status==1 electrons or photons"), ) -electronSequence = cms.Sequence(heepIDVarValueMaps + egmGsfElectronIDSequence + bitmapVIDForEle + isoForEle + ptRatioRelForEle + calibratedPatElectrons + energyCorrForEle + slimmedElectronsWithUserData + finalElectrons) +electronSequence = cms.Sequence(heepIDVarValueMaps + egmGsfElectronIDSequence + bitmapVIDForEle + isoForEle + ptRatioRelForEle + slimmedElectronsWithUserData + finalElectrons) electronTables = cms.Sequence (electronMVATTH + electronTable) electronMC = cms.Sequence(electronsMCMatchForTable + electronMCTable) _withUpdate_sequence = cms.Sequence(slimmedElectronsUpdated + electronSequence.copy()) run2_nanoAOD_92X.toReplaceWith(electronSequence, _withUpdate_sequence) -run2_miniAOD_80XLegacy.toReplaceWith(electronSequence, _withUpdate_sequence) + +_withUpdateAnd80XScale_sequence = _withUpdate_sequence.copy() +_withUpdateAnd80XScale_sequence.replace(slimmedElectronsWithUserData, calibratedPatElectrons80X + energyCorrForEle80X + slimmedElectronsWithUserData) +run2_miniAOD_80XLegacy.toReplaceWith(electronSequence, _withUpdateAnd80XScale_sequence) + +_with94Xv1Scale_sequence = electronSequence.copy() +_with94Xv1Scale_sequence.replace(slimmedElectronsWithUserData, calibratedPatElectrons94Xv1 + slimmedElectronsWithUserData) +run2_nanoAOD_94XMiniAODv1.toReplaceWith(electronSequence, _with94Xv1Scale_sequence) + diff --git a/PhysicsTools/NanoAOD/python/jets_cff.py b/PhysicsTools/NanoAOD/python/jets_cff.py index 19d133fd71090..fb7e550a0de3c 100644 --- a/PhysicsTools/NanoAOD/python/jets_cff.py +++ b/PhysicsTools/NanoAOD/python/jets_cff.py @@ -156,6 +156,7 @@ nElectrons = Var("?hasOverlaps('electrons')?overlaps('electrons').size():0", int, doc="number of electrons in the jet"), btagCMVA = Var("bDiscriminator('pfCombinedMVAV2BJetTags')",float,doc="CMVA V2 btag discriminator",precision=10), btagDeepB = Var("bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')",float,doc="DeepCSV b+bb tag discriminator",precision=10), + btagDeepFlavB = Var("bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')",float,doc="DeepFlavour b+bb tag discriminator",precision=10), btagCSVV2 = Var("bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10), btagDeepC = Var("bDiscriminator('pfDeepCSVJetTags:probc')",float,doc="DeepCSV charm btag discriminator",precision=10), #puIdDisc = Var("userFloat('pileupJetId:fullDiscriminant')",float,doc="Pilup ID discriminant",precision=10), diff --git a/PhysicsTools/NanoAOD/python/muons_cff.py b/PhysicsTools/NanoAOD/python/muons_cff.py index c7ee94b1743f7..1b79bf6cda8ba 100644 --- a/PhysicsTools/NanoAOD/python/muons_cff.py +++ b/PhysicsTools/NanoAOD/python/muons_cff.py @@ -26,7 +26,7 @@ run2_nanoAOD_92X.toModify(isoForMu, src = "slimmedMuonsUpdated") ptRatioRelForMu = cms.EDProducer("MuonJetVarProducer", - srcJet = cms.InputTag("slimmedJets"), + srcJet = cms.InputTag("updatedJets"), srcLep = cms.InputTag("slimmedMuons"), srcVtx = cms.InputTag("offlineSlimmedPrimaryVertices"), ) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py index 42e6dc4d0212f..e01ad8b4eba44 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py @@ -1,7 +1,27 @@ import FWCore.ParameterSet.Config as cms from PhysicsTools.NanoAOD.nanoDQM_cfi import nanoDQM +from PhysicsTools.NanoAOD.nanoDQM_tools_cff import * +## Modify plots accordingly to era +from Configuration.StandardSequences.Eras import eras +_vplots80X = nanoDQM.vplots.clone() +# Tau plots +_tauPlots80X = cms.VPSet() +for plot in _vplots80X.Tau.plots: + if plot.name.value().find("MVA")>-1 and plot.name.value().find("2017")>-1: + continue + _tauPlots80X.append(plot) +_tauPlots80X.append(Plot1D('idMVAnewDM', 'idMVAnewDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBnewDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight')) +_tauPlots80X.append(Plot1D('idMVAoldDMdR03', 'idMVAoldDMdR03', 64, -0.5, 63.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight')) +_tauPlots80X.append(Plot1D('rawMVAnewDM', 'rawMVAnewDM', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator')) +_tauPlots80X.append(Plot1D('rawMVAoldDMdR03', 'rawMVAoldDMdR03', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator')) +_vplots80X.Tau.plots = _tauPlots80X +eras.run2_miniAOD_80XLegacy.toModify(nanoDQM, + vplots = _vplots80X +) + +## MC nanoDQMMC = nanoDQM.clone() nanoDQMMC.vplots.Electron.sels.Prompt = cms.string("genPartFlav == 1") nanoDQMMC.vplots.Muon.sels.Prompt = cms.string("genPartFlav == 1") diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index 7731ab1f66d0d..49aed020d2322 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -331,7 +331,7 @@ Count1D('_size', 9, -0.5, 8.5, 'slimmedPhotons after basic selection (pt > 5 )'), Plot1D('charge', 'charge', 1, -0.5, 0.5, 'electric charge'), Plot1D('cleanmask', 'cleanmask', 1, 0.5, 1.5, 'simple cleaning mask with priority to leptons'), - Plot1D('cutBased', 'cutBased', 4, -0.5, 3.5, 'cut-based ID (0:fail, 1::loose, 2:medium, 3:tight)'), + Plot1D('cutBasedBitmap', 'cutBasedBitmap', 8, -0.5, 7.5, 'cut-based ID bitmap, 2^(0:loose, 1:medium, 2:tight)'), Plot1D('eCorr', 'eCorr', 20, 0.6, 1.6, 'ratio of the calibrated energy/miniaod energy'), NoPlot('electronIdx'), Plot1D('electronVeto', 'electronVeto', 2, -0.5, 1.5, 'pass electron veto'), @@ -440,16 +440,17 @@ Plot1D('dxy', 'dxy', 20, -1000, 1000, 'd_{xy} of lead track with respect to PV, in cm (with sign)'), Plot1D('dz', 'dz', 20, -20, 20, 'd_{z} of lead track with respect to PV, in cm (with sign)'), Plot1D('eta', 'eta', 20, -3, 3, 'eta'), - Plot1D('footprintCorr', 'footprintCorr', 20, 0, 30, 'footprint correction'), Plot1D('genPartFlav', 'genPartFlav', 6, -0.5, 5.5, 'Flavour of genParticle for MC matching to status==2 taus: 1 = prompt electron, 2 = prompt muon, 3 = tau->e decay, 4 = tau->mu decay, 5 = hadronic tau decay, 0 = unknown or unmatched'), NoPlot('genPartIdx'), Plot1D('idAntiEle', 'idAntiEle', 32, -0.5, 31.5, 'Anti-electron MVA discriminator V6: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight'), Plot1D('idAntiMu', 'idAntiMu', 4, -0.5, 3.5, 'Anti-muon discriminator V3: : bitmask 1 = Loose, 2 = Tight'), Plot1D('idDecayMode', 'idDecayMode', 2, -0.5, 1.5, "tauID('decayModeFinding')"), Plot1D('idDecayModeNewDMs', 'idDecayModeNewDMs', 2, -0.5, 1.5, "tauID('decayModeFindingNewDMs')"), - Plot1D('idMVAnewDM', 'idMVAnewDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBnewDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), + Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBnewDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), Plot1D('idMVAoldDM', 'idMVAoldDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBoldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), - Plot1D('idMVAoldDMdR03', 'idMVAoldDMdR03', 64, -0.5, 63.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), + Plot1D('idMVAoldDM2017v1', 'idMVAoldDM2017v1', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v1): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point (217v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), NoPlot('jetIdx'), Plot1D('leadTkDeltaEta', 'leadTkDeltaEta', 20, -0.1, 0.1, 'eta of the leading track, minus tau eta'), Plot1D('leadTkDeltaPhi', 'leadTkDeltaPhi', 20, -0.1, 0.1, 'phi of the leading track, minus tau phi'), @@ -463,9 +464,12 @@ Plot1D('rawAntiEle', 'rawAntiEle', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator'), Plot1D('rawAntiEleCat', 'rawAntiEleCat', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category'), Plot1D('rawIso', 'rawIso', 20, 0, 200, 'combined isolation (deltaBeta corrections)'), - Plot1D('rawMVAnewDM', 'rawMVAnewDM', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator'), + Plot1D('rawIsodR03', 'rawIsodR03', 20, 0, 200, 'combined isolation (deltaBeta corrections, dR=0.3)'), + Plot1D('rawMVAnewDM2017v2', 'rawMVAnewDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator (2017v2)'), Plot1D('rawMVAoldDM', 'rawMVAoldDM', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator'), - Plot1D('rawMVAoldDMdR03', 'rawMVAoldDMdR03', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator'), + Plot1D('rawMVAoldDM2017v1', 'rawMVAoldDM2017v1', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)'), + Plot1D('rawMVAoldDM2017v2', 'rawMVAoldDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)'), + Plot1D('rawMVAoldDMdR032017v2', 'rawMVAoldDMdR032017v2', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)'), ) ), TkMET = cms.PSet( diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 96bf144ec10f3..73d27b607f65b 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -65,12 +65,14 @@ ) lheInfoTable = cms.EDProducer("LHETablesProducer", lheInfo = cms.InputTag("externalLHEProducer"), + precision = cms.int32(14), + storeLHEParticles = cms.bool(True) ) l1bits=cms.EDProducer("L1TriggerResultsConverter", src=cms.InputTag("gtStage2Digis"), legacyL1=cms.bool(False)) nanoSequence = cms.Sequence( - nanoMetadata + muonSequence + jetSequence + tauSequence + electronSequence+photonSequence+vertexSequence+metSequence+ + nanoMetadata + jetSequence + muonSequence + tauSequence + electronSequence+photonSequence+vertexSequence+metSequence+ isoTrackSequence + # must be after all the leptons linkedObjects + jetTables + muonTables + tauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + triggerObjectTables + isoTrackTables + @@ -84,14 +86,16 @@ def nanoAOD_customizeCommon(process): def nanoAOD_customizeData(process): process = nanoAOD_customizeCommon(process) - process.calibratedPatElectrons.isMC = cms.bool(False) - process.calibratedPatPhotons.isMC = cms.bool(False) + if hasattr(process,'calibratedPatElectrons80X'): + process.calibratedPatElectrons80X.isMC = cms.bool(False) + process.calibratedPatPhotons80X.isMC = cms.bool(False) return process def nanoAOD_customizeMC(process): process = nanoAOD_customizeCommon(process) - process.calibratedPatElectrons.isMC = cms.bool(True) - process.calibratedPatPhotons.isMC = cms.bool(True) + if hasattr(process,'calibratedPatElectrons80X'): + process.calibratedPatElectrons80X.isMC = cms.bool(True) + process.calibratedPatPhotons80X.isMC = cms.bool(True) return process ### Era dependent customization diff --git a/PhysicsTools/NanoAOD/python/photons_cff.py b/PhysicsTools/NanoAOD/python/photons_cff.py index 8694ded721d72..88abad4aead57 100644 --- a/PhysicsTools/NanoAOD/python/photons_cff.py +++ b/PhysicsTools/NanoAOD/python/photons_cff.py @@ -1,7 +1,12 @@ import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy from PhysicsTools.NanoAOD.common_cff import * from math import ceil,log +from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy +from Configuration.Eras.Modifier_run2_nanoAOD_92X_cff import run2_nanoAOD_92X +from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 + from PhysicsTools.SelectorUtils.tools.vid_id_tools import setupVIDSelection from RecoEgamma.PhotonIdentification.egmPhotonIDs_cfi import * from RecoEgamma.PhotonIdentification.PhotonIDValueMapProducer_cfi import * @@ -11,28 +16,44 @@ egmPhotonIDSequence = cms.Sequence(cms.Task(egmPhotonIsolationMiniAODTask,photonIDValueMapProducer,photonMVAValueMapProducer,egmPhotonIDs,photonRegressionValueMapProducer)) egmPhotonIDs.physicsObjectIDs = cms.VPSet() egmPhotonIDs.physicsObjectSrc = cms.InputTag('slimmedPhotons') -_photon_id_vid_modules=[ -'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Spring16_V2p2_cff', -'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff', -] -_bitmapVIDForPho_WorkingPoints = cms.vstring( + +_photon_id_vid_modules_WorkingPoints = cms.PSet( + modules = cms.vstring( + 'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Fall17_94X_V1_TrueVtx_cff', + 'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V1_cff', + ), + WorkingPoints = cms.vstring( +# can run only for one working point for the moment, as the working points are not nested +# "egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-loose", + "egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-medium", +# "egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-tight", + ) +) +run2_miniAOD_80XLegacy.toModify(_photon_id_vid_modules_WorkingPoints, + modules = cms.vstring( + 'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Spring16_V2p2_cff', + 'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff', + ), + WorkingPoints = cms.vstring( "egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-loose", "egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-medium", "egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-tight", + ) ) + _bitmapVIDForPho_docstring = '' -for modname in _photon_id_vid_modules: +for modname in _photon_id_vid_modules_WorkingPoints.modules: ids= __import__(modname, globals(), locals(), ['idName','cutFlow']) for name in dir(ids): _id = getattr(ids,name) if hasattr(_id,'idName') and hasattr(_id,'cutFlow'): setupVIDSelection(egmPhotonIDs,_id) - if (len(_bitmapVIDForPho_WorkingPoints)>0 and _id.idName==_bitmapVIDForPho_WorkingPoints[0].split(':')[-1]): - _bitmapVIDForPho_docstring = 'VID compressed bitmap (%s), %d bits per cut'%(','.join([cut.cutName.value() for cut in _id.cutFlow]),int(ceil(log(len(_bitmapVIDForPho_WorkingPoints)+1,2)))) + if (len(_photon_id_vid_modules_WorkingPoints.WorkingPoints)>0 and _id.idName==_photon_id_vid_modules_WorkingPoints.WorkingPoints[0].split(':')[-1]): + _bitmapVIDForPho_docstring = 'VID compressed bitmap (%s), %d bits per cut'%(','.join([cut.cutName.value() for cut in _id.cutFlow]),int(ceil(log(len(_photon_id_vid_modules_WorkingPoints.WorkingPoints)+1,2)))) bitmapVIDForPho = cms.EDProducer("PhoVIDNestedWPBitmapProducer", src = cms.InputTag("slimmedPhotons"), - WorkingPoints = _bitmapVIDForPho_WorkingPoints, + WorkingPoints = _photon_id_vid_modules_WorkingPoints.WorkingPoints, ) isoForPho = cms.EDProducer("PhoIsoValueMapProducer", @@ -42,39 +63,65 @@ mapIsoChg = cms.InputTag("photonIDValueMapProducer:phoChargedIsolation"), mapIsoNeu = cms.InputTag("photonIDValueMapProducer:phoNeutralHadronIsolation"), mapIsoPho = cms.InputTag("photonIDValueMapProducer:phoPhotonIsolation"), + EAFile_PFIso_Chg = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfChargedHadrons_90percentBased_TrueVtx.txt"), + EAFile_PFIso_Neu = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfNeutralHadrons_90percentBased_TrueVtx.txt"), + EAFile_PFIso_Pho = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfPhotons_90percentBased_TrueVtx.txt"), +) +run2_miniAOD_80XLegacy.toModify(isoForPho, EAFile_PFIso_Chg = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Spring16/effAreaPhotons_cone03_pfChargedHadrons_90percentBased.txt"), EAFile_PFIso_Neu = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Spring16/effAreaPhotons_cone03_pfNeutralHadrons_90percentBased.txt"), EAFile_PFIso_Pho = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Spring16/effAreaPhotons_cone03_pfPhotons_90percentBased.txt"), ) -from EgammaAnalysis.ElectronTools.calibratedPhotonsRun2_cfi import calibratedPatPhotons -calibratedPatPhotons.correctionFile = cms.string("PhysicsTools/NanoAOD/data/80X_ichepV2_2016_pho") # hack, should go somewhere in EgammaAnalysis -calibratedPatPhotons.semiDeterministic = cms.bool(True) - -energyCorrForPhoton = cms.EDProducer("PhotonEnergyVarProducer", +import EgammaAnalysis.ElectronTools.calibratedPhotonsRun2_cfi +calibratedPatPhotons80X = EgammaAnalysis.ElectronTools.calibratedPhotonsRun2_cfi.calibratedPatPhotons.clone( + correctionFile = cms.string("PhysicsTools/NanoAOD/data/80X_ichepV2_2016_pho"), # hack, should go somewhere in EgammaAnalysis + semiDeterministic = cms.bool(True), +) +energyCorrForPhoton80X = cms.EDProducer("PhotonEnergyVarProducer", srcRaw = cms.InputTag("slimmedPhotons"), - srcCorr = cms.InputTag("calibratedPatPhotons"), + srcCorr = cms.InputTag("calibratedPatPhotons80X"), ) +import RecoEgamma.EgammaTools.calibratedEgammas_cff +calibratedPatPhotons94Xv1 = RecoEgamma.EgammaTools.calibratedEgammas_cff.calibratedPatPhotons.clone( + produceCalibratedObjs = False +) + slimmedPhotonsWithUserData = cms.EDProducer("PATPhotonUserDataEmbedder", src = cms.InputTag("slimmedPhotons"), userFloats = cms.PSet( - mvaID = cms.InputTag("photonMVAValueMapProducer:PhotonMVAEstimatorRun2Spring16NonTrigV1Values"), + mvaID = cms.InputTag("photonMVAValueMapProducer:PhotonMVAEstimatorRunIIFall17v1Values"), PFIsoChg = cms.InputTag("isoForPho:PFIsoChg"), PFIsoAll = cms.InputTag("isoForPho:PFIsoAll"), - eCorr = cms.InputTag("energyCorrForPhoton:eCorr"), ), userIntFromBools = cms.PSet( - cutbasedID_loose = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-loose"), - cutbasedID_medium = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-medium"), - cutbasedID_tight = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-tight"), - mvaID_WP90 = cms.InputTag("egmPhotonIDs:mvaPhoID-Spring16-nonTrig-V1-wp90"), - mvaID_WP80 = cms.InputTag("egmPhotonIDs:mvaPhoID-Spring16-nonTrig-V1-wp80"), + cutbasedID_loose = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-loose"), + cutbasedID_medium = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-medium"), + cutbasedID_tight = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-tight"), + mvaID_WP90 = cms.InputTag("egmPhotonIDs:mvaPhoID-RunIIFall17-v1-wp90"), + mvaID_WP80 = cms.InputTag("egmPhotonIDs:mvaPhoID-RunIIFall17-v1-wp80"), ), userInts = cms.PSet( VIDNestedWPBitmap = cms.InputTag("bitmapVIDForPho"), ), ) +run2_miniAOD_80XLegacy.toModify(slimmedPhotonsWithUserData.userFloats, + mvaID = cms.InputTag("photonMVAValueMapProducer:PhotonMVAEstimatorRun2Spring16NonTrigV1Values"), + eCorr = cms.InputTag("energyCorrForPhoton80X","eCorr") +) +run2_miniAOD_80XLegacy.toModify(slimmedPhotonsWithUserData.userIntFromBools, + cutbasedID_loose = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-loose"), + cutbasedID_medium = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-medium"), + cutbasedID_tight = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-tight"), + mvaID_WP90 = cms.InputTag("egmPhotonIDs:mvaPhoID-Spring16-nonTrig-V1-wp90"), + mvaID_WP80 = cms.InputTag("egmPhotonIDs:mvaPhoID-Spring16-nonTrig-V1-wp80"), +) +run2_nanoAOD_94XMiniAODv1.toModify(slimmedPhotonsWithUserData.userFloats, + ecalEnergyErrPostCorr = cms.InputTag("calibratedPatPhotons94Xv1","ecalEnergyErrPostCorr"), + ecalEnergyPreCorr = cms.InputTag("calibratedPatPhotons94Xv1","ecalEnergyPreCorr"), + ecalEnergyPostCorr = cms.InputTag("calibratedPatPhotons94Xv1","ecalEnergyPostCorr"), +) finalPhotons = cms.EDFilter("PATPhotonRefSelector", src = cms.InputTag("slimmedPhotonsWithUserData"), @@ -91,17 +138,17 @@ variables = cms.PSet(CandVars, jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"), electronIdx = Var("?hasUserCand('electron')?userCand('electron').key():-1", int, doc="index of the associated electron (-1 if none)"), - energyErr = Var("getCorrectedEnergyError('regression2')*userFloat('eCorr')",float,doc="energy error of the cluster from regression",precision=6), - eCorr = Var("userFloat('eCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), + energyErr = Var("userFloat('ecalEnergyErrPostCorr')",float,doc="energy error of the cluster from regression",precision=6), + eCorr = Var("userFloat('ecalEnergyPostCorr')/userFloat('ecalEnergyPreCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), r9 = Var("full5x5_r9()",float,doc="R9 of the supercluster, calculated with full 5x5 region",precision=10), sieie = Var("full5x5_sigmaIetaIeta()",float,doc="sigma_IetaIeta of the supercluster, calculated with full 5x5 region",precision=10), - cutBased = Var("userInt('cutbasedID_loose')+userInt('cutbasedID_medium')+userInt('cutbasedID_tight')",int,doc="cut-based ID (0:fail, 1::loose, 2:medium, 3:tight)"), + cutBasedBitmap = Var("userInt('cutbasedID_loose')+2*userInt('cutbasedID_medium')+4*userInt('cutbasedID_tight')",int,doc="cut-based ID bitmap, 2^(0:loose, 1:medium, 2:tight)"), vidNestedWPBitmap = Var("userInt('VIDNestedWPBitmap')",int,doc=_bitmapVIDForPho_docstring), electronVeto = Var("passElectronVeto()",bool,doc="pass electron veto"), pixelSeed = Var("hasPixelSeed()",bool,doc="has pixel seed"), mvaID = Var("userFloat('mvaID')",float,doc="MVA ID score",precision=10), mvaID_WP90 = Var("userInt('mvaID_WP90')",bool,doc="MVA ID WP90"), - mvaID_WP80 = Var("userInt('mvaID_WP90')",bool,doc="MVA ID WP80"), + mvaID_WP80 = Var("userInt('mvaID_WP80')",bool,doc="MVA ID WP80"), pfRelIso03_chg = Var("userFloat('PFIsoChg')/pt",float,doc="PF relative isolation dR=0.3, charged component (with rho*EA PU corrections)"), pfRelIso03_all = Var("userFloat('PFIsoAll')/pt",float,doc="PF relative isolation dR=0.3, total (with rho*EA PU corrections)"), hoe = Var("hadronicOverEm()",float,doc="H over E",precision=8), @@ -109,7 +156,20 @@ isScEtaEE = Var("abs(superCluster().eta()) > 1.566 && abs(superCluster().eta()) < 2.5",bool,doc="is supercluster eta within endcap acceptance"), ) ) -photonTable.variables.pt = Var("pt*userFloat('eCorr')", float, precision=-1) +photonTable.variables.pt = Var("pt*userFloat('ecalEnergyPostCorr')/userFloat('ecalEnergyPreCorr')", float, precision=-1) +run2_miniAOD_80XLegacy.toModify(photonTable.variables, + cutBasedBitmap = None, + cutBased = Var("userInt('cutbasedID_loose')+userInt('cutbasedID_medium')+userInt('cutbasedID_tight')",int,doc="cut-based ID (0:fail, 1::loose, 2:medium, 3:tight)"), + pt = Var("pt*userFloat('eCorr')", float, precision=-1, doc="p_{T} (no energy correction & smearing)"), + energyErr = Var("getCorrectedEnergyError('regression2')*userFloat('eCorr')",float,doc="energy error of the cluster from regression",precision=6), + eCorr = Var("userFloat('eCorr')",float,doc="ratio of the calibrated energy/miniaod energy"), +) +run2_nanoAOD_92X.toModify(photonTable.variables, + pt = Var("pt", float, precision=-1, doc="p_{T} (no energy correction & smearing)"), + energyErr = Var("getCorrectedEnergyError('regression2')",float,doc="energy error of the cluster from regression",precision=6), + eCorr = None, +) + photonsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR src = photonTable.src, # final reco collection @@ -132,6 +192,15 @@ docString = cms.string("MC matching to status==1 photons or electrons"), ) -photonSequence = cms.Sequence(egmPhotonIDSequence + bitmapVIDForPho + isoForPho + calibratedPatPhotons + energyCorrForPhoton + slimmedPhotonsWithUserData + finalPhotons) +photonSequence = cms.Sequence(egmPhotonIDSequence + bitmapVIDForPho + isoForPho + slimmedPhotonsWithUserData + finalPhotons) photonTables = cms.Sequence ( photonTable) photonMC = cms.Sequence(photonsMCMatchForTable + photonMCTable) + +_with80XScale_sequence = photonSequence.copy() +_with80XScale_sequence.replace(slimmedPhotonsWithUserData, calibratedPatPhotons80X + energyCorrForPhoton80X + slimmedPhotonsWithUserData) +run2_miniAOD_80XLegacy.toReplaceWith(photonSequence, _with80XScale_sequence) + +_with94Xv1Scale_sequence = photonSequence.copy() +_with94Xv1Scale_sequence.replace(slimmedPhotonsWithUserData, calibratedPatPhotons94Xv1 + slimmedPhotonsWithUserData) +run2_nanoAOD_94XMiniAODv1.toReplaceWith(photonSequence, _with94Xv1Scale_sequence) + diff --git a/PhysicsTools/NanoAOD/python/taus_cff.py b/PhysicsTools/NanoAOD/python/taus_cff.py index 61ef188241926..a6c27e9ebf567 100644 --- a/PhysicsTools/NanoAOD/python/taus_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_cff.py @@ -3,14 +3,25 @@ from PhysicsTools.JetMCAlgos.TauGenJets_cfi import tauGenJets from PhysicsTools.JetMCAlgos.TauGenJetsDecayModeSelectorAllHadrons_cfi import tauGenJetsSelectorAllHadrons +##################### Updated tau collection with MVA-based tau-Ids rerun ####### +# Used only in some eras +from PhysicsTools.NanoAOD.taus_updatedMVAIds_cff import * ##################### User floats producers, selectors ########################## finalTaus = cms.EDFilter("PATTauRefSelector", - src = cms.InputTag("slimmedTaus"), - cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT'))") + src = cms.InputTag("slimmedTausUpdated"), + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT2015') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2'))") ) +for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: + era.toModify(finalTaus, + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v1') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2'))") + ) +eras.run2_miniAOD_80XLegacy.toModify(finalTaus, + src = cms.InputTag("slimmedTaus"), + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT'))") + ) ##################### Tables for final output and docs ########################## def _tauIdWPMask(pattern, choices, doc=""): @@ -18,11 +29,14 @@ def _tauIdWPMask(pattern, choices, doc=""): doc=doc+": bitmask "+", ".join(["%d = %s" % (pow(2,i),c) for (i,c) in enumerate(choices)])) def _tauId2WPMask(pattern,doc): return _tauIdWPMask(pattern,choices=("Loose","Tight"),doc=doc) +def _tauId3WPMask(pattern,doc): + return _tauIdWPMask(pattern,choices=("Loose","Medium","Tight"),doc=doc) def _tauId5WPMask(pattern,doc): return _tauIdWPMask(pattern,choices=("VLoose","Loose","Medium","Tight","VTight"),doc=doc) def _tauId6WPMask(pattern,doc): return _tauIdWPMask(pattern,choices=("VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) - +def _tauId7WPMask(pattern,doc): + return _tauIdWPMask(pattern,choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) tauTable = cms.EDProducer("SimpleCandidateFlatTableProducer", src = cms.InputTag("linkedObjects","taus"), @@ -47,24 +61,17 @@ def _tauId6WPMask(pattern,doc): # these are too many, we may have to suppress some rawIso = Var( "tauID('byCombinedIsolationDeltaBetaCorrRaw3Hits')", float, doc = "combined isolation (deltaBeta corrections)", precision=10), + rawIsodR03 = Var( "(tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum')))", float, doc = "combined isolation (deltaBeta corrections, dR=0.3)", precision=10), chargedIso = Var( "tauID('chargedIsoPtSum')", float, doc = "charged isolation", precision=10), neutralIso = Var( "tauID('neutralIsoPtSum')", float, doc = "neutral (photon) isolation", precision=10), puCorr = Var( "tauID('puCorrPtSum')", float, doc = "pileup correction", precision=10), - footprintCorr = Var( "tauID('footprintCorrection')", float, doc = "footprint correction", precision=10), photonsOutsideSignalCone = Var( "tauID('photonPtSumOutsideSignalCone')", float, doc = "sum of photons outside signal cone", precision=10), - - rawMVAnewDM = Var( "tauID('byIsolationMVArun2v1DBnewDMwLTraw')",float, doc="byIsolationMVArun2v1DBnewDMwLT raw output discriminator",precision=10), - rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator",precision=10), - rawMVAoldDMdR03 = Var( "tauID('byIsolationMVArun2v1DBdR03oldDMwLTraw')",float, doc="byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator",precision=10), + rawAntiEle = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator", precision=10), rawAntiEleCat = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category"), - + idAntiMu = _tauId2WPMask("againstMuon%s3", doc= "Anti-muon discriminator V3: "), - idAntiEle = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6"), - idMVAnewDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBnewDMwLT", doc="IsolationMVArun2v1DBnewDMwLT ID working point"), - idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point"), - idMVAoldDMdR03 = _tauId6WPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT", doc="IsolationMVArun2v1DBdR03oldDMwLT ID working point"), - + idAntiEle = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6"), # isoCI3hit = Var( "tauID("byCombinedIsolationDeltaBetaCorrRaw3Hits")" doc="byCombinedIsolationDeltaBetaCorrRaw3Hits raw output discriminator"), # photonOutsideSigCone = Var( "tauID("photonPtSumOutsideSignalCone")" doc="photonPtSumOutsideSignalCone raw output discriminator"), @@ -72,7 +79,55 @@ def _tauId6WPMask(pattern,doc): ) ) - +_mvaIsoVars2015 = cms.PSet( + rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), + rawMVAnewDM = Var( "tauID('byIsolationMVArun2v1DBnewDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), + rawMVAoldDMdR03 = Var( "tauID('byIsolationMVArun2v1DBdR03oldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), + idMVAnew = _tauId6WPMask( "by%sIsolationMVArun2v1DBnewDMwLT", doc="IsolationMVArun2v1DBnewDMwLT ID working point (2015)"), + idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)"), + idMVAoldDMdR03 = _tauId6WPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT", doc="IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2015)") +) +_mvaIsoVars2015Reduced = cms.PSet( + rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw2015')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10), + idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2015", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)"), +) +_mvaIsoVars2017v1 = cms.PSet( + rawMVAoldDM2017v1 = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)",precision=10), + idMVAoldDM2017v1 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v1)") +) +_mvaIsoVars2017v2 = cms.PSet( + rawMVAnewDM2017v2 = Var( "tauID('byIsolationMVArun2v1DBnewDMwLTraw2017v2')",float, doc="byIsolationMVArun2v1DBnewDMwLT raw output discriminator (2017v2)",precision=10), + rawMVAoldDM2017v2 = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw2017v2')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)",precision=10), + rawMVAoldDMdR032017v2 = Var( "tauID('byIsolationMVArun2v1DBdR03oldDMwLTraw2017v2')",float, doc="byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)",precision=10), + idMVAnewDM2017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBnewDMwLT2017v2", doc="IsolationMVArun2v1DBnewDMwLT ID working point (2017v2)"), + idMVAoldDM2017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v2)"), + idMVAoldDMdR032017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2017v2)") +) +_variablesMiniV2 = cms.PSet( + tauTable.variables.clone(), + _mvaIsoVars2015Reduced, + _mvaIsoVars2017v1, + _mvaIsoVars2017v2 +) +_variablesMiniV1 = _variablesMiniV2.clone() +_variablesMiniV1.rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10) +_variablesMiniV1.rawMVAoldDM2017v1 = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw2017v1')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)",precision=10) +_variablesMiniV1.idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)") +_variablesMiniV1.idMVAoldDM2017v1 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v1", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v1)") +_variables80X = cms.PSet( + tauTable.variables.clone(), + _mvaIsoVars2015 +) +eras.run2_nanoAOD_94XMiniAODv2.toModify(tauTable, + variables = _variablesMiniV2 +) +for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: + era.toModify(tauTable, + variables = _variablesMiniV1 + ) +eras.run2_miniAOD_80XLegacy.toModify(tauTable, + variables = _variables80X +) tauGenJets.GenParticles = cms.InputTag("prunedGenParticles") tauGenJets.includeNeutrinos = cms.bool(False) @@ -134,7 +189,9 @@ def _tauId6WPMask(pattern,doc): ) -tauSequence = cms.Sequence(finalTaus) +tauSequence = cms.Sequence(patTauMVAIDsSeq + finalTaus) +_tauSequence80X = cms.Sequence(finalTaus) +eras.run2_miniAOD_80XLegacy.toReplaceWith(tauSequence,_tauSequence80X) tauTables = cms.Sequence(tauTable) tauMC = cms.Sequence(tauGenJets + tauGenJetsSelectorAllHadrons + genVisTaus + genVisTauTable + tausMCMatchLepTauForTable + tausMCMatchHadTauForTable + tauMCTable) diff --git a/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py b/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py new file mode 100644 index 0000000000000..7bb275e2a2983 --- /dev/null +++ b/PhysicsTools/NanoAOD/python/taus_updatedMVAIds_cff.py @@ -0,0 +1,381 @@ +import FWCore.ParameterSet.Config as cms + +##################### Updated tau collection with MVA-based tau-Ids rerun ####### +# Used only in some eras +from Configuration.StandardSequences.Eras import eras +from RecoTauTag.Configuration.loadRecoTauTagMVAsFromPrepDB_cfi import * +from RecoTauTag.RecoTau.PATTauDiscriminationByMVAIsolationRun2_cff import * + +### MVAIso 2017v2 +## DBoldDM +# Raw +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw = patDiscriminationByIsolationMVArun2v1raw.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + loadMVAfromDB = cms.bool(True), + mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2"), # name of the training you want to use + mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) + requireDecayMode = cms.bool(True), + verbosity = cms.int32(0) +) +# VVLoose WP +patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT = patDiscriminationByIsolationMVArun2v1VLoose.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw'), + key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw','category'), + loadMVAfromDB = cms.bool(True), + mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_mvaOutput_normalization"), # normalization fo the training you want to use + mapping = cms.VPSet( + cms.PSet( + category = cms.uint32(0), + cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff95"), # this is the name of the working point you want to use + variable = cms.string("pt"), + ) + ) +) +# VLoose WP +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff90") +# Loose WP +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff80") +# Medium WP +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff70") +# Tight WP +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff60") +# VTight WP +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff50") +# VVTights WP +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT.clone() +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v2_WPEff40") +# MVAIso DBoldDM Seqeunce +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTSeq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw + + patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT + + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT +) +## DBnewDM +# Raw +patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw = patDiscriminationByIsolationMVArun2v1raw.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + loadMVAfromDB = cms.bool(True), + mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2"), # name of the training you want to use + mvaOpt = cms.string("DBnewDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) + requireDecayMode = cms.bool(True), + verbosity = cms.int32(0) +) +# VVLoose WP +patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT = patDiscriminationByIsolationMVArun2v1VLoose.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw'), + key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw','category'), + loadMVAfromDB = cms.bool(True), + mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_mvaOutput_normalization"), # normalization fo the training you want to use + mapping = cms.VPSet( + cms.PSet( + category = cms.uint32(0), + cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff95"), # this is the name of the working point you want to use + variable = cms.string("pt"), + ) + ) +) +# VLoose WP +patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff90") +# Loose WP +patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff80") +# Medium WP +patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff70") +# Tight WP +patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff60") +# VTight WP +patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff50") +# VVTights WP +patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT.clone() +patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBnewDMwLT2017v2_WPEff40") +# MVAIso DBnewDM Seqeunce +patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTSeq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw + + patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT + + patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT +) +## DBoldDMdR0p3 +# Raw +patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw = patDiscriminationByIsolationMVArun2v1raw.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + loadMVAfromDB = cms.bool(True), + mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2"), # name of the training you want to use + mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) + requireDecayMode = cms.bool(True), + srcChargedIsoPtSum = cms.string('chargedIsoPtSumdR03'), + srcFootprintCorrection = cms.string('footprintCorrectiondR03'), + srcNeutralIsoPtSum = cms.string('neutralIsoPtSumdR03'), + srcPUcorrPtSum = cms.string('puCorrPtSum'), + srcPhotonPtSumOutsideSignalCone = cms.string('photonPtSumOutsideSignalConedR03'), + verbosity = cms.int32(0) +) +# VVLoose WP +patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT = patDiscriminationByIsolationMVArun2v1VLoose.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw'), + key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw','category'), + loadMVAfromDB = cms.bool(True), + mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_mvaOutput_normalization"), # normalization fo the training you want to use + mapping = cms.VPSet( + cms.PSet( + category = cms.uint32(0), + cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff95"), # this is the name of the working point you want to use + variable = cms.string("pt"), + ) + ) +) +# VLoose WP +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff90") +# Loose WP +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff80") +# Medium WP +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff70") +# Tight WP +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff60") +# VTight WP +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff50") +# VVTights WP +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT.clone() +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMdR0p3wLT2017v2_WPEff40") +# MVAIso DBoldDMdR0p3 Seqeunce +patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTSeq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw + + patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT + + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT +) +### MVAIso 2017v1 for Nano on top of MiniAODv1 +## DBoldDM +# Raw +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1 = patDiscriminationByIsolationMVArun2v1raw.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + loadMVAfromDB = cms.bool(True), + mvaName = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1"), # name of the training you want to use + mvaOpt = cms.string("DBoldDMwLTwGJ"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) + requireDecayMode = cms.bool(True), + verbosity = cms.int32(0) +) +# VVLoose WP +patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = patDiscriminationByIsolationMVArun2v1VLoose.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1'), + key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1','category'), + loadMVAfromDB = cms.bool(True), + mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_mvaOutput_normalization"), # normalization fo the training you want to use + mapping = cms.VPSet( + cms.PSet( + category = cms.uint32(0), + cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff95"), # this is the name of the working point you want to use + variable = cms.string("pt"), + ) + ) +) +# VLoose WP +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff90") +# Loose WP +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff80") +# Medium WP +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff70") +# Tight WP +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff60") +# VTight WP +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff50") +# VVTights WP +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1 = patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1.clone() +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1.mapping[0].cut = cms.string("RecoTauTag_tauIdMVAIsoDBoldDMwLT2017v1_WPEff40") +# MVAIso DBoldDM Seqeunce +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1Seq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1 + + patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1 + + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1 +) +### MVAIso 2015 for Nano on top of MiniAODv2 +## DBoldDM +# Raw +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015 = patDiscriminationByIsolationMVArun2v1raw.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + loadMVAfromDB = cms.bool(True), + mvaName = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1"), # name of the training you want to use + mvaOpt = cms.string("DBoldDMwLT"), # option you want to use for your training (i.e., which variables are used to compute the BDT score) + requireDecayMode = cms.bool(True), + verbosity = cms.int32(0) +) +# VLoose WP +patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015 = patDiscriminationByIsolationMVArun2v1VLoose.clone( + PATTauProducer = cms.InputTag('slimmedTaus'), + Prediscriminants = noPrediscriminants, + toMultiplex = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015'), + key = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015','category'), + loadMVAfromDB = cms.bool(True), + mvaOutput_normalization = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_mvaOutput_normalization"), # normalization fo the training you want to use + mapping = cms.VPSet( + cms.PSet( + category = cms.uint32(0), + cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff90"), # this is the name of the working point you want to use + variable = cms.string("pt"), + ) + ) +) +# Loose WP +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() +patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff80") +# Medium WP +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() +patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff70") +# Tight WP +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() +patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff60") +# VTight WP +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() +patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff50") +# VVTights WP +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015 = patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015.clone() +patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015.mapping[0].cut = cms.string("RecoTauTag_tauIdMVADBoldDMwLTv1_WPEff40") +# MVAIso DBoldDM Seqeunce +patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015Seq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015 + + patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015 + + patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015 + + patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015 + + patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015 + + patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015 + + patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015 +) + + +### FIXME: add other tau-Ids when ready + +### put all new MVA tau-Id stuff to one Sequence +patTauMVAIDsSeq = cms.Sequence( + patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTSeq + +patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTSeq + +patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTSeq +) +_patTauMVAIDsSeqWith2017v1 = patTauMVAIDsSeq.copy() +_patTauMVAIDsSeqWith2017v1 += patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2017v1Seq +for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: + era.toReplaceWith(patTauMVAIDsSeq,_patTauMVAIDsSeqWith2017v1) +_patTauMVAIDsSeqWith2015 = patTauMVAIDsSeq.copy() +_patTauMVAIDsSeqWith2015 += patTauDiscriminationByIsolationMVArun2v1DBoldDMwLT2015Seq +eras.run2_nanoAOD_94XMiniAODv2.toReplaceWith(patTauMVAIDsSeq,_patTauMVAIDsSeqWith2015) + +# embed new MVA tau-Ids into new tau collection +slimmedTausUpdated = cms.EDProducer("PATTauIDEmbedder", + src = cms.InputTag('slimmedTaus'), + tauIDSources = cms.PSet( + #oldDM + byIsolationMVArun2v1DBoldDMwLTraw2017v2 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw'), + byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT'), + byVLooseIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT'), + byLooseIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT'), + byMediumIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT'), + byTightIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT'), + byVTightIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT'), + byVVTightIsolationMVArun2v1DBoldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT'), + #newDM + byIsolationMVArun2v1DBnewDMwLTraw2017v2 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBnewDMwLTraw'), + byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBnewDMwLT'), + byVLooseIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBnewDMwLT'), + byLooseIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBnewDMwLT'), + byMediumIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBnewDMwLT'), + byTightIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBnewDMwLT'), + byVTightIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBnewDMwLT'), + byVVTightIsolationMVArun2v1DBnewDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBnewDMwLT'), + #oldDMdR0p3 + byIsolationMVArun2v1DBdR03oldDMwLTraw2017v2 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMdR0p3wLTraw'), + byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMdR0p3wLT'), + byVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMdR0p3wLT'), + byLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMdR0p3wLT'), + byMediumIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMdR0p3wLT'), + byTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMdR0p3wLT'), + byVTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMdR0p3wLT'), + byVVTightIsolationMVArun2v1DBdR03oldDMwLT2017v2 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMdR0p3wLT'), + ) +) +_tauIDSources2017v1 = cms.PSet( + byIsolationMVArun2v1DBoldDMwLTraw2017v1 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2017v1'), + byVVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVVLooseIsolationMVArun2v1DBoldDMwLT2017v1'), + byVLooseIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2017v1'), + byLooseIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2017v1'), + byMediumIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2017v1'), + byTightIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2017v1'), + byVTightIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2017v1'), + byVVTightIsolationMVArun2v1DBoldDMwLT2017v1 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2017v1') +) +_tauIDSourcesWith2017v1 = cms.PSet( + slimmedTausUpdated.tauIDSources.clone(), + _tauIDSources2017v1 +) +_tauIDSources2015 = cms.PSet( + byIsolationMVArun2v1DBoldDMwLTraw2015 = cms.InputTag('patTauDiscriminationByIsolationMVArun2v1DBoldDMwLTraw2015'), + byVLooseIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByVLooseIsolationMVArun2v1DBoldDMwLT2015'), + byLooseIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByLooseIsolationMVArun2v1DBoldDMwLT2015'), + byMediumIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByMediumIsolationMVArun2v1DBoldDMwLT2015'), + byTightIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByTightIsolationMVArun2v1DBoldDMwLT2015'), + byVTightIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByVTightIsolationMVArun2v1DBoldDMwLT2015'), + byVVTightIsolationMVArun2v1DBoldDMwLT2015 = cms.InputTag('patTauDiscriminationByVVTightIsolationMVArun2v1DBoldDMwLT2015') +) +_tauIDSourcesWith2015 = cms.PSet( + slimmedTausUpdated.tauIDSources.clone(), + _tauIDSources2015 +) + +for era in [eras.run2_nanoAOD_94XMiniAODv1,eras.run2_nanoAOD_92X]: + era.toModify(slimmedTausUpdated, + tauIDSources = _tauIDSourcesWith2017v1 + ) +eras.run2_nanoAOD_94XMiniAODv2.toModify(slimmedTausUpdated, + tauIDSources = _tauIDSourcesWith2015 +) + +patTauMVAIDsSeq += slimmedTausUpdated + diff --git a/PhysicsTools/NanoAOD/test/nano_cfg.py b/PhysicsTools/NanoAOD/test/nano_cfg.py index 1b4e2d5a9418f..f89dcfd27998b 100644 --- a/PhysicsTools/NanoAOD/test/nano_cfg.py +++ b/PhysicsTools/NanoAOD/test/nano_cfg.py @@ -22,22 +22,13 @@ # '/store/relval/CMSSW_9_4_0_pre3/RelValProdTTbar_13/MINIAODSIM/94X_mcRun2_asymptotic_v0-v1/10000/06F85EC5-7BB9-E711-A2CB-0025905A6134.root' #sample with LHE - '/store/mc/RunIISummer17MiniAOD/TT_TuneCUETP8M2T4_13TeV-powheg-pythia8/MINIAODSIM/92X_upgrade2017_realistic_v10_ext1-v1/110000/187F7EDA-0986-E711-ABB3-02163E014C21.root' +'/store/cmst3/group/nanoAOD/pre-94XMiniAODv2/TTToSemiLeptonic_TuneCP5_PSweights_13TeV-powheg-pythia8.root' ] process.load("PhysicsTools.NanoAOD.nano_cff") -process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", - calibratedPatElectrons = cms.PSet(initialSeed = cms.untracked.uint32(81), - engineName = cms.untracked.string('TRandom3'), - ), - calibratedPatPhotons = cms.PSet(initialSeed = cms.untracked.uint32(81), - engineName = cms.untracked.string('TRandom3'), - ), -) + process.nanoPath = cms.Path(process.nanoSequenceMC) -process.calibratedPatElectrons.isMC = cms.bool(True) -process.calibratedPatPhotons.isMC = cms.bool(True) #for data: #process.nanoPath = cms.Path(process.nanoSequence) #process.GlobalTag.globaltag = autoCond['run2_data'] diff --git a/PhysicsTools/NanoAOD/test/runtests.sh b/PhysicsTools/NanoAOD/test/runtests.sh index 8086690ee755b..397af33d850f0 100755 --- a/PhysicsTools/NanoAOD/test/runtests.sh +++ b/PhysicsTools/NanoAOD/test/runtests.sh @@ -4,8 +4,9 @@ function die { echo $1: status $2 ; exit $2; } #to be enabled with the right files #cmsDriver.py test80X -s NANO --mc --eventcontent NANOAODSIM --datatier NANO --filein /store/relval/CMSSW_8_0_0/RelValTTbar_13/MINIAODSIM/PU25ns_80X_mcRun2_asymptotic_v4-v1/10000/A65CD249-BFDA-E511-813A-0025905A6066.root --conditions auto:run2_mc -n 100 --era Run2_2016,run2_miniAOD_80XLegacy || die 'Failure using cmsdriver 80X' $? -cmsDriver.py test92X -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --filein /store/relval/CMSSW_9_2_12/RelValTTbar_13/MINIAODSIM/PU25ns_92X_upgrade2017_realistic_v11-v1/00000/080E2624-F59D-E711-ACEE-0CC47A7C35A4.root --conditions auto:phase1_2017_realistic -n 100 --era Run2_2017,run2_nanoAOD_92X || die 'Failure using cmsdriver 92X' $? +#cmsDriver.py test92X -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --filein /store/relval/CMSSW_9_2_12/RelValTTbar_13/MINIAODSIM/PU25ns_92X_upgrade2017_realistic_v11-v1/00000/080E2624-F59D-E711-ACEE-0CC47A7C35A4.root --conditions auto:phase1_2017_realistic -n 100 --era Run2_2017,run2_nanoAOD_92X || die 'Failure using cmsdriver 92X' $? -cmsDriver.py test94X -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --filein /store/relval/CMSSW_9_4_0_pre3/RelValTTbar_13/MINIAODSIM/PU25ns_94X_mc2017_realistic_v4-v1/10000/52B94CC0-6FBB-E711-B577-0CC47A7C35F8.root --conditions auto:phase1_2017_realistic -n 100 --era Run2_2017 || die 'Failure using cmsdriver 94X' $? +cmsDriver.py test94Xv1 -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --filein /store/relval/CMSSW_9_4_0_pre3/RelValTTbar_13/MINIAODSIM/PU25ns_94X_mc2017_realistic_v4-v1/10000/52B94CC0-6FBB-E711-B577-0CC47A7C35F8.root --conditions auto:phase1_2017_realistic -n 100 --era Run2_2017,run2_nanoAOD_94XMiniAODv1 || die 'Failure using cmsdriver 94X v1' $? +cmsDriver.py test94Xv2 -s NANO --mc --eventcontent NANOAODSIM --datatier NANOAODSIM --filein /store/relval/CMSSW_9_4_5_cand1/RelValTTbar_13/MINIAODSIM/94X_mc2017_realistic_v14_PU_RelVal_rmaod-v1/10000/84A84D5B-9E2E-E811-B103-0CC47A7C35F4.root --conditions auto:phase1_2017_realistic -n 100 --era Run2_2017,run2_nanoAOD_94XMiniAODv2 || die 'Failure using cmsdriver 94X v2' $? diff --git a/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc index 77589f82a936c..3f829ca818594 100644 --- a/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc @@ -19,7 +19,7 @@ #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" #include "DataFormats/PatCandidates/interface/PackedCandidate.h" #include "CommonTools/UtilAlgos/interface/StringCutObjectSelector.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" namespace pat { diff --git a/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc index 1e81cbf4bb514..dc2b6e9ff9774 100644 --- a/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc @@ -11,7 +11,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/Common/interface/ValueMap.h" -#include "DataFormats/PatCandidates/interface/libminifloat.h" +#include "DataFormats/Math/interface/libminifloat.h" namespace pat { class PATVertexSlimmer : public edm::global::EDProducer<> { diff --git a/PhysicsTools/RecoAlgos/python/trackingParticleSelector_cfi.py b/PhysicsTools/RecoAlgos/python/trackingParticleSelector_cfi.py index 61a2b49c65d8f..a51b01bfb4c71 100644 --- a/PhysicsTools/RecoAlgos/python/trackingParticleSelector_cfi.py +++ b/PhysicsTools/RecoAlgos/python/trackingParticleSelector_cfi.py @@ -18,5 +18,5 @@ maxPhi = cms.double(3.2), ) - - +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleSelector, src = "mixData:MergedTrackTruth") diff --git a/PhysicsTools/TensorFlow/src/NTSession.cc b/PhysicsTools/TensorFlow/src/NTSession.cc index 1af023f500d9b..c4a137e0365d2 100644 --- a/PhysicsTools/TensorFlow/src/NTSession.cc +++ b/PhysicsTools/TensorFlow/src/NTSession.cc @@ -18,7 +18,7 @@ limitations under the License. /* This file is an adaptation of the original direct_session.cc file located at -https://github.com/tensorflow/tensorflow/blob/v1.5.0/tensorflow/core/common_runtime/direct_session.cc +https://github.com/tensorflow/tensorflow/blob/v1.6.0/tensorflow/core/common_runtime/direct_session.cc to meet the demands of the software environment developed and used by the CMS collaboration. Changes with respect to the original code are documented in the NTSession.h header file. @@ -77,7 +77,6 @@ Changes with respect to the original code are documented in the NTSession.h head #include "tensorflow/core/util/device_name_utils.h" #include "tensorflow/core/util/env_var.h" - namespace tensorflow { namespace { @@ -248,6 +247,10 @@ NTSession::~NTSession() { for (auto d : device_mgr_->ListDevices()) { d->op_segment()->RemoveHold(session_handle_); } + for (auto d : device_mgr_->ListDevices()) { + d->ClearResourceMgr(); + } + functions_.clear(); delete cancellation_manager_; execution_state_.reset(nullptr); @@ -384,8 +387,9 @@ Status NTSession::Run(const RunOptions& run_options, args.step_id = step_id_counter_.fetch_add(1); TF_RETURN_IF_ERROR( - GetOrCreateExecutors(input_tensor_names, output_names, target_nodes, - &executors_and_keys, &run_state_args)); + GetOrCreateExecutors(input_tensor_names, output_names, + target_nodes, &executors_and_keys, + &run_state_args)); const int64 executor_step_count = executors_and_keys->step_count.fetch_add(1); std::unique_ptr debugger_state; @@ -1053,12 +1057,13 @@ Status NTSession::GetOrCreateExecutors( options.debug_options = run_state_args->debug_options; } + std::unique_ptr func_info(new FunctionInfo); std::shared_ptr ek(new ExecutorsAndKeys); // The executor_lock_ is intentionally released while executor is // being created. std::unordered_map> graphs; - TF_RETURN_IF_ERROR(CreateGraphs(options, &graphs, &ek->flib_def, + TF_RETURN_IF_ERROR(CreateGraphs(options, &graphs, &func_info->flib_def, run_state_args, &ek->input_types, &ek->output_types)); @@ -1089,9 +1094,9 @@ Status NTSession::GetOrCreateExecutors( graph_def_version = execution_state_->original_graph_def().versions().producer(); } - ek->proc_flr.reset(new ProcessFunctionLibraryRuntime( - device_mgr_.get(), options_.env, graph_def_version, ek->flib_def.get(), - optimizer_opts)); + func_info->proc_flr.reset(new ProcessFunctionLibraryRuntime( + device_mgr_.get(), options_.env, graph_def_version, + func_info->flib_def.get(), optimizer_opts)); GraphOptimizer optimizer(optimizer_opts); for (auto iter = graphs.begin(); iter != graphs.end(); ++iter) { @@ -1103,7 +1108,7 @@ Status NTSession::GetOrCreateExecutors( ek->items.resize(ek->items.size() + 1); auto* item = &(ek->items.back()); - auto lib = ek->proc_flr->GetFLR(partition_name); + auto lib = func_info->proc_flr->GetFLR(partition_name); if (lib == nullptr) { return errors::Internal("Could not find device: ", partition_name); } @@ -1199,6 +1204,7 @@ Status NTSession::GetOrCreateExecutors( // Reacquire the lock, try to insert into the map. mutex_lock l(executor_lock_); + functions_.push_back(std::move(func_info)); // Another thread may have created the entry before us, in which case we will // reuse the already created one. diff --git a/PhysicsTools/TensorFlow/src/NTSession.h b/PhysicsTools/TensorFlow/src/NTSession.h index 32e033d00e7bc..2d8329a9bea22 100644 --- a/PhysicsTools/TensorFlow/src/NTSession.h +++ b/PhysicsTools/TensorFlow/src/NTSession.h @@ -15,7 +15,7 @@ limitations under the License. /* This file is an adaptation of the original direct_session.h file located at -https://github.com/tensorflow/tensorflow/blob/v1.5.0/tensorflow/core/common_runtime/direct_session.h +https://github.com/tensorflow/tensorflow/blob/v1.6.0/tensorflow/core/common_runtime/direct_session.h to meet the demands of the software environment developed and used by the CMS collaboration. Changes: @@ -142,20 +142,12 @@ class NTSession : public Session { // a partition of the graph bundled with its dependent library runtime. // 'input_keys' are the rendezvous keys for the feeds and 'output_keys' // are rendezvous keys for the fetches. - // 'flib_def' is the function library used by graphs in 'items'. - // 'proc_flr' is the collection of FunctionLibraryRuntime objects, one per - // device. - // TODO(phawkins): currently partitions always share the same function - // library. Consider giving each partition its own function library to enable - // per-partition rewrites. struct ExecutorsAndKeys { ExecutorsAndKeys() : step_count(0) {} std::atomic_int_fast64_t step_count; std::unique_ptr graph; NameNodeMap name_to_node; - std::unique_ptr flib_def; - std::unique_ptr proc_flr; std::vector items; std::unordered_map input_name_to_index; std::unordered_map input_name_to_rendezvous_key; @@ -166,6 +158,22 @@ class NTSession : public Session { DataTypeVector output_types; }; + // A FunctionInfo object is created for every unique set of feeds/fetches. + // This info could be folded into the ExecutorsAndKeys object but we would + // like to maintain a deletion order in which the OpKernels (owned by the + // executor) should be destroyed first, followed by the resources in the + // device and then followed by the function stuff. + // TODO(rohanj): Consolidate function library definitions so that we can + // instantiate only one ProcFLR and lib_def and make this just a member + // variable and not a vector. + // 'flib_def' is the function library used. + // 'proc_flr' is the collection of FunctionLibraryRuntime objects, one per + // device. + struct FunctionInfo { + std::unique_ptr flib_def; + std::unique_ptr proc_flr; + }; + // For each live partial execution, the session maintains a RunState. // 'status' is the current status of this partial execution. 'executor_done' // is "notified" when all executors are done. 'pending_inputs' are the set @@ -295,6 +303,9 @@ class NTSession : public Session { bool sync_on_finish_ = true; void SchedClosure(std::function c); + std::vector> functions_ + GUARDED_BY(executor_lock_); + mutex executor_lock_; // protects executors_ // Holds mappings from signature to the executors that process // it. The reason for a level of indirection around mapped_type is diff --git a/PhysicsTools/TensorFlow/src/TBBSession.cc b/PhysicsTools/TensorFlow/src/TBBSession.cc index 71350c19c536e..3deb6164bebd2 100644 --- a/PhysicsTools/TensorFlow/src/TBBSession.cc +++ b/PhysicsTools/TensorFlow/src/TBBSession.cc @@ -18,7 +18,7 @@ limitations under the License. /* This file is an adaptation of the original direct_session.cc file located at -https://github.com/tensorflow/tensorflow/blob/v1.5.0/tensorflow/core/common_runtime/direct_session.cc +https://github.com/tensorflow/tensorflow/blob/v1.6.0/tensorflow/core/common_runtime/direct_session.cc to meet the demands of the software environment developed and used by the CMS collaboration. Changes with respect to the original code are documented in the TBBSession.h header file. @@ -79,7 +79,6 @@ Changes with respect to the original code are documented in the TBBSession.h hea #include "tensorflow/core/util/device_name_utils.h" #include "tensorflow/core/util/env_var.h" - namespace tensorflow { namespace { @@ -249,6 +248,10 @@ TBBSession::~TBBSession() { for (auto d : device_mgr_->ListDevices()) { d->op_segment()->RemoveHold(session_handle_); } + for (auto d : device_mgr_->ListDevices()) { + d->ClearResourceMgr(); + } + functions_.clear(); delete cancellation_manager_; execution_state_.reset(nullptr); @@ -385,8 +388,9 @@ Status TBBSession::Run(const RunOptions& run_options, args.step_id = step_id_counter_.fetch_add(1); TF_RETURN_IF_ERROR( - GetOrCreateExecutors(input_tensor_names, output_names, target_nodes, - &executors_and_keys, &run_state_args)); + GetOrCreateExecutors(input_tensor_names, output_names, + target_nodes, &executors_and_keys, + &run_state_args)); const int64 executor_step_count = executors_and_keys->step_count.fetch_add(1); std::unique_ptr debugger_state; @@ -741,12 +745,13 @@ Status TBBSession::GetOrCreateExecutors( options.debug_options = run_state_args->debug_options; } + std::unique_ptr func_info(new FunctionInfo); std::shared_ptr ek(new ExecutorsAndKeys); // The executor_lock_ is intentionally released while executor is // being created. std::unordered_map> graphs; - TF_RETURN_IF_ERROR(CreateGraphs(options, &graphs, &ek->flib_def, + TF_RETURN_IF_ERROR(CreateGraphs(options, &graphs, &func_info->flib_def, run_state_args, &ek->input_types, &ek->output_types)); @@ -777,9 +782,9 @@ Status TBBSession::GetOrCreateExecutors( graph_def_version = execution_state_->original_graph_def().versions().producer(); } - ek->proc_flr.reset(new ProcessFunctionLibraryRuntime( - device_mgr_.get(), options_.env, graph_def_version, ek->flib_def.get(), - optimizer_opts)); + func_info->proc_flr.reset(new ProcessFunctionLibraryRuntime( + device_mgr_.get(), options_.env, graph_def_version, + func_info->flib_def.get(), optimizer_opts)); GraphOptimizer optimizer(optimizer_opts); for (auto iter = graphs.begin(); iter != graphs.end(); ++iter) { @@ -791,7 +796,7 @@ Status TBBSession::GetOrCreateExecutors( ek->items.resize(ek->items.size() + 1); auto* item = &(ek->items.back()); - auto lib = ek->proc_flr->GetFLR(partition_name); + auto lib = func_info->proc_flr->GetFLR(partition_name); if (lib == nullptr) { return errors::Internal("Could not find device: ", partition_name); } @@ -887,6 +892,7 @@ Status TBBSession::GetOrCreateExecutors( // Reacquire the lock, try to insert into the map. mutex_lock l(executor_lock_); + functions_.push_back(std::move(func_info)); // Another thread may have created the entry before us, in which case we will // reuse the already created one. diff --git a/PhysicsTools/TensorFlow/src/TBBSession.h b/PhysicsTools/TensorFlow/src/TBBSession.h index e009c7daa073e..5329663287643 100644 --- a/PhysicsTools/TensorFlow/src/TBBSession.h +++ b/PhysicsTools/TensorFlow/src/TBBSession.h @@ -15,7 +15,7 @@ limitations under the License. /* This file is an adaptation of the original direct_session.h file located at -https://github.com/tensorflow/tensorflow/blob/v1.5.0/tensorflow/core/common_runtime/direct_session.h +https://github.com/tensorflow/tensorflow/blob/v1.6.0/tensorflow/core/common_runtime/direct_session.h to meet the demands of the software environment developed and used by the CMS collaboration. Changes: @@ -142,20 +142,12 @@ class TBBSession : public Session { // a partition of the graph bundled with its dependent library runtime. // 'input_keys' are the rendezvous keys for the feeds and 'output_keys' // are rendezvous keys for the fetches. - // 'flib_def' is the function library used by graphs in 'items'. - // 'proc_flr' is the collection of FunctionLibraryRuntime objects, one per - // device. - // TODO(phawkins): currently partitions always share the same function - // library. Consider giving each partition its own function library to enable - // per-partition rewrites. struct ExecutorsAndKeys { ExecutorsAndKeys() : step_count(0) {} std::atomic_int_fast64_t step_count; std::unique_ptr graph; NameNodeMap name_to_node; - std::unique_ptr flib_def; - std::unique_ptr proc_flr; std::vector items; std::unordered_map input_name_to_index; std::unordered_map input_name_to_rendezvous_key; @@ -166,6 +158,22 @@ class TBBSession : public Session { DataTypeVector output_types; }; + // A FunctionInfo object is created for every unique set of feeds/fetches. + // This info could be folded into the ExecutorsAndKeys object but we would + // like to maintain a deletion order in which the OpKernels (owned by the + // executor) should be destroyed first, followed by the resources in the + // device and then followed by the function stuff. + // TODO(rohanj): Consolidate function library definitions so that we can + // instantiate only one ProcFLR and lib_def and make this just a member + // variable and not a vector. + // 'flib_def' is the function library used. + // 'proc_flr' is the collection of FunctionLibraryRuntime objects, one per + // device. + struct FunctionInfo { + std::unique_ptr flib_def; + std::unique_ptr proc_flr; + }; + // For each live partial execution, the session maintains a RunState. // 'status' is the current status of this partial execution. 'executor_done' // is "notified" when all executors are done. 'pending_inputs' are the set @@ -275,6 +283,9 @@ class TBBSession : public Session { bool sync_on_finish_ = true; void SchedClosure(tbb::task_arena& arena, tbb::task_group& g, std::function c); + std::vector> functions_ + GUARDED_BY(executor_lock_); + mutex executor_lock_; // protects executors_ // Holds mappings from signature to the executors that process // it. The reason for a level of indirection around mapped_type is diff --git a/RecoBTag/Combined/plugins/DeepFlavourJetTagsProducer.cc b/RecoBTag/Combined/plugins/DeepFlavourJetTagsProducer.cc index b89afb6e3d7bf..293250a79825e 100644 --- a/RecoBTag/Combined/plugins/DeepFlavourJetTagsProducer.cc +++ b/RecoBTag/Combined/plugins/DeepFlavourJetTagsProducer.cc @@ -54,19 +54,48 @@ using namespace reco; // class declaration // -class DeepFlavourJetTagsProducer : public edm::stream::EDProducer<> { +namespace { + +struct MVAVar { + std::string name; + reco::btau::TaggingVariableName id; + int index; + double default_value; +}; + +class NeuralNetworkAndConstants { +public: + + NeuralNetworkAndConstants(const edm::ParameterSet&); + + std::unique_ptr const& neural_network() const { return neural_network_; } + vector const& outputs() const { return outputs_; } + bool check_sv_for_defaults() const { return check_sv_for_defaults_; } + map const& toadd() const { return toadd_; } + vector const& variables() const { return variables_; } + +private: + + std::unique_ptr neural_network_; + vector outputs_; + bool check_sv_for_defaults_; + map toadd_; + vector variables_; +}; +} + +class DeepFlavourJetTagsProducer : public edm::stream::EDProducer> { public: - explicit DeepFlavourJetTagsProducer(const edm::ParameterSet&); + explicit DeepFlavourJetTagsProducer(const edm::ParameterSet&, NeuralNetworkAndConstants const*); ~DeepFlavourJetTagsProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - struct MVAVar { - std::string name; - reco::btau::TaggingVariableName id; - int index; - double default_value; - }; + static std::unique_ptr initializeGlobalCache(const edm::ParameterSet& iConfig) { + return std::make_unique(iConfig); + } + + static void globalEndJob(NeuralNetworkAndConstants*) { } private: typedef std::vector INFOS; @@ -76,14 +105,7 @@ class DeepFlavourJetTagsProducer : public edm::stream::EDProducer<> { // ----------member data --------------------------- const edm::EDGetTokenT< INFOS > src_; - edm::FileInPath nnconfig_; - bool check_sv_for_defaults_; - bool mean_padding_; - lwt::LightweightNeuralNetwork *neural_network_; lwt::ValueMap inputs_; //typedef of unordered_map - vector outputs_; - vector variables_; - map toadd_; }; // @@ -98,29 +120,27 @@ class DeepFlavourJetTagsProducer : public edm::stream::EDProducer<> { // // constructors and destructor // -DeepFlavourJetTagsProducer::DeepFlavourJetTagsProducer(const edm::ParameterSet& iConfig) : - src_( consumes< INFOS >(iConfig.getParameter("src")) ), - nnconfig_(iConfig.getParameter("NNConfig")), - check_sv_for_defaults_(iConfig.getParameter("checkSVForDefaults")), - mean_padding_(iConfig.getParameter("meanPadding")), - neural_network_(nullptr), - inputs_(), - outputs_(), - variables_() + +NeuralNetworkAndConstants::NeuralNetworkAndConstants(const edm::ParameterSet& iConfig) : + check_sv_for_defaults_(iConfig.getParameter("checkSVForDefaults")) { + bool mean_padding = iConfig.getParameter("meanPadding"); + //parse json - ifstream jsonfile(nnconfig_.fullPath()); + edm::FileInPath nnconfig = iConfig.getParameter("NNConfig"); + ifstream jsonfile(nnconfig.fullPath()); auto config = lwt::parse_json(jsonfile); //create NN and store the output names for the future - neural_network_ = new lwt::LightweightNeuralNetwork(config.inputs, config.layers, config.outputs); + neural_network_ = std::make_unique(config.inputs, config.layers, config.outputs); + outputs_ = config.outputs; set outset(outputs_.begin(), outputs_.end()); //in case we want to merge some different outputs together - edm::ParameterSet toadd = iConfig.getParameter("toAdd"); - for(auto output : toadd.getParameterNamesForType()) { - string target = toadd.getParameter(output); + edm::ParameterSet toaddPSet = iConfig.getParameter("toAdd"); + for(auto const& output : toaddPSet.getParameterNamesForType()) { + string target = toaddPSet.getParameter(output); if(outset.find(output) == outset.end()) throw cms::Exception("RuntimeError") << "The required output: " << output << " to be added to " << target << " could not be found among the NN outputs" << endl; if(outset.find(target) == outset.end()) @@ -128,16 +148,8 @@ DeepFlavourJetTagsProducer::DeepFlavourJetTagsProducer(const edm::ParameterSet& toadd_[output] = target; } - //produce one output kind per node - for(auto outnode : config.outputs) { - if(toadd_.find(outnode) == toadd_.end()){ //produce output only if does not get added - produces(outnode); - } - } - - //get the set-up for the inputs - for(auto& input : config.inputs) { + for(auto const& input : config.inputs) { MVAVar var; var.name = input.name; //two paradigms @@ -151,21 +163,31 @@ DeepFlavourJetTagsProducer::DeepFlavourJetTagsProducer(const edm::ParameterSet& //die grafully if the tagging variable is not found! if(var.id == reco::btau::lastTaggingVariable) { throw cms::Exception("ValueError") << "I could not find the TaggingVariable named " << tokens.at(0) - << " from the NN input variable: " << input.name - << ". Please check the spelling" << std::endl; + << " from the NN input variable: " << input.name + << ". Please check the spelling" << std::endl; } var.index = (tokens.size() == 2) ? stoi(tokens.at(1)) : -1; - var.default_value = (mean_padding_) ? 0. : -1*input.offset; //set default to -offset so that when scaling (val+offset)*scale the outcome is 0 + var.default_value = (mean_padding) ? 0. : -1*input.offset; //set default to -offset so that when scaling (val+offset)*scale the outcome is 0 //for mean padding it is set to zero so that undefined values are assigned -mean/scale variables_.push_back(var); } } +DeepFlavourJetTagsProducer::DeepFlavourJetTagsProducer(const edm::ParameterSet& iConfig, NeuralNetworkAndConstants const* gc) : + src_( consumes< INFOS >(iConfig.getParameter("src")) ), + inputs_() +{ + //produce one output kind per node + for(auto const& outnode : gc->outputs()) { + if(gc->toadd().find(outnode) == gc->toadd().end()){ //produce output only if does not get added + produces(outnode); + } + } +} DeepFlavourJetTagsProducer::~DeepFlavourJetTagsProducer() { - delete neural_network_; } @@ -177,6 +199,10 @@ DeepFlavourJetTagsProducer::~DeepFlavourJetTagsProducer() void DeepFlavourJetTagsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + NeuralNetworkAndConstants const* gc = globalCache(); + vector const& outputs = gc->outputs(); + map const& toadd = gc->toadd(); + // get input TagInfos edm::Handle taginfos; iEvent.getByToken(src_, taginfos); @@ -184,8 +210,8 @@ DeepFlavourJetTagsProducer::produce(edm::Event& iEvent, const edm::EventSetup& i // create the output collection // which is a "map" RefToBase --> float vector< std::unique_ptr > output_tags; - output_tags.reserve(outputs_.size()); - for(size_t i=0; iempty()) { edm::RefToBase jj = taginfos->begin()->jet(); output_tags.push_back( @@ -207,11 +233,11 @@ DeepFlavourJetTagsProducer::produce(edm::Event& iEvent, const edm::EventSetup& i //if there are no tracks there's no point in doing it bool notracks = (vars.get(reco::btau::jetNSelectedTracks) == 0); bool novtx = (vars.get(reco::btau::jetNSecondaryVertices) == 0); - bool defaulted = (check_sv_for_defaults_) ? (notracks && novtx) : notracks; + bool defaulted = (gc->check_sv_for_defaults()) ? (notracks && novtx) : notracks; lwt::ValueMap nnout; //returned value if(!defaulted) { - for(auto& var : variables_) { + for(auto const& var : gc->variables()) { if(var.index >= 0){ std::vector vals = vars.getList(var.id, false); inputs_[var.name] = (((int) vals.size()) > var.index) ? vals.at(var.index) : var.default_value; @@ -223,10 +249,10 @@ DeepFlavourJetTagsProducer::produce(edm::Event& iEvent, const edm::EventSetup& i } //compute NN output(s) - nnout = neural_network_->compute(inputs_); + nnout = gc->neural_network()->compute(inputs_); //merge outputs - for(auto entry : toadd_) { + for(auto const& entry : toadd) { nnout[entry.second] += nnout[entry.first]; } } @@ -235,15 +261,15 @@ DeepFlavourJetTagsProducer::produce(edm::Event& iEvent, const edm::EventSetup& i edm::RefToBase key = info.jet(); //dump the NN output(s) - for(size_t i=0; i& particle, const edm::Event& iEvent) const { const int iCategory = findCategory( particle ); - const std::vector vars = std::move( fillMVAVariables( particle, iEvent ) ); + const std::vector vars = fillMVAVariables( particle, iEvent ) ; const float result = _gbrForests.at(iCategory)->GetClassifier(vars.data()); // DEBUG @@ -306,7 +306,7 @@ std::vector PhotonMVAEstimatorRun2Phys14NonTrig::fillMVAVariables(const e std::vector vars; if( isEndcapCategory( findCategory( particle ) ) ) { - vars = std::move( packMVAVariables(allMVAVars.varPhi, + vars = packMVAVariables(allMVAVars.varPhi, allMVAVars.varR9, allMVAVars.varSieie, allMVAVars.varSieip, @@ -326,9 +326,9 @@ std::vector PhotonMVAEstimatorRun2Phys14NonTrig::fillMVAVariables(const e // Declare spectator vars allMVAVars.varPt, allMVAVars.varEta) - ); + ; } else { - vars = std::move( packMVAVariables(allMVAVars.varPhi, + vars = packMVAVariables(allMVAVars.varPhi, allMVAVars.varR9, allMVAVars.varSieie, allMVAVars.varSieip, @@ -346,7 +346,7 @@ std::vector PhotonMVAEstimatorRun2Phys14NonTrig::fillMVAVariables(const e // Declare spectator vars allMVAVars.varPt, allMVAVars.varEta) - ); + ; } return vars; diff --git a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc index 8b059b13de524..3f8e86cab1e42 100644 --- a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc +++ b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring15NonTrig.cc @@ -59,7 +59,7 @@ float PhotonMVAEstimatorRun2Spring15NonTrig:: mvaValue(const edm::Ptr& particle, const edm::Event& iEvent) const { const int iCategory = findCategory( particle ); - const std::vector vars = std::move( fillMVAVariables( particle, iEvent ) ); + const std::vector vars = fillMVAVariables( particle, iEvent ) ; const float result = _gbrForests.at(iCategory)->GetClassifier(vars.data()); @@ -318,7 +318,7 @@ std::vector PhotonMVAEstimatorRun2Spring15NonTrig::fillMVAVariables(const std::vector vars; if( isEndcapCategory( findCategory( particle ) ) ) { - vars = std::move( packMVAVariables(allMVAVars.varPhi, + vars = packMVAVariables(allMVAVars.varPhi, allMVAVars.varR9, allMVAVars.varSieie, allMVAVars.varSieip, @@ -338,9 +338,9 @@ std::vector PhotonMVAEstimatorRun2Spring15NonTrig::fillMVAVariables(const // Declare spectator vars allMVAVars.varPt, allMVAVars.varEta) - ); + ; } else { - vars = std::move( packMVAVariables(allMVAVars.varPhi, + vars = packMVAVariables(allMVAVars.varPhi, allMVAVars.varR9, allMVAVars.varSieie, allMVAVars.varSieip, @@ -358,7 +358,7 @@ std::vector PhotonMVAEstimatorRun2Spring15NonTrig::fillMVAVariables(const // Declare spectator vars allMVAVars.varPt, allMVAVars.varEta) - ); + ; } return vars; } diff --git a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring16NonTrig.cc b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring16NonTrig.cc index 9627d47066959..a484d9848ea69 100644 --- a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring16NonTrig.cc +++ b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRun2Spring16NonTrig.cc @@ -53,7 +53,7 @@ float PhotonMVAEstimatorRun2Spring16NonTrig:: mvaValue(const edm::Ptr& particle, const edm::Event& iEvent) const { const int iCategory = findCategory( particle ); - const std::vector vars = std::move( fillMVAVariables( particle, iEvent ) ); + const std::vector vars = fillMVAVariables( particle, iEvent ) ; const float result = gbrForests_.at(iCategory)->GetClassifier(vars.data()); @@ -279,7 +279,7 @@ std::vector PhotonMVAEstimatorRun2Spring16NonTrig::fillMVAVariables(const // std::vector vars; if( isEndcapCategory( findCategory( particle ) ) ) { - vars = std::move( packMVAVariables( + vars = packMVAVariables( allMVAVars.scPhi, allMVAVars.varR9, allMVAVars.varSieie, @@ -296,9 +296,9 @@ std::vector PhotonMVAEstimatorRun2Spring16NonTrig::fillMVAVariables(const allMVAVars.varESEffSigmaRR, allMVAVars.varESEnOverRawE ) - ); + ; } else { - vars = std::move( packMVAVariables( + vars = packMVAVariables( allMVAVars.scPhi, allMVAVars.varR9, allMVAVars.varSieie, @@ -313,7 +313,7 @@ std::vector PhotonMVAEstimatorRun2Spring16NonTrig::fillMVAVariables(const allMVAVars.varChIsoRaw, allMVAVars.varWorstChRaw ) - ); + ; } return vars; } diff --git a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.h b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.h index b4d34420bc793..e0e15c8570394 100644 --- a/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.h +++ b/RecoEgamma/PhotonIdentification/plugins/PhotonMVAEstimatorRunIIFall17.h @@ -61,12 +61,12 @@ class PhotonMVAEstimatorRunIIFall17 : public AnyMVAEstimatorRun2Base{ ~PhotonMVAEstimatorRunIIFall17(); // Calculation of the MVA value - float mvaValue( const edm::Ptr& particle, const edm::Event&) const; + float mvaValue( const edm::Ptr& particle, const edm::Event&) const override; // Utility functions std::unique_ptr createSingleReader(const int iCategory, const edm::FileInPath &weightFile); - virtual int getNCategories() const { return nCategories; } + virtual int getNCategories() const override { return nCategories; } bool isEndcapCategory( int category ) const; virtual const std::string& getName() const override final { return name_; } virtual const std::string& getTag() const override final { return tag_; } diff --git a/RecoJets/JetProducers/interface/PileupJetIdAlgo.h b/RecoJets/JetProducers/interface/PileupJetIdAlgo.h index 4783b0c251bd2..faea19667f40d 100644 --- a/RecoJets/JetProducers/interface/PileupJetIdAlgo.h +++ b/RecoJets/JetProducers/interface/PileupJetIdAlgo.h @@ -27,21 +27,20 @@ class PileupJetIdAlgo { public: enum version_t { USER=-1, PHILv0=0 }; - - PileupJetIdAlgo(int version=PHILv0, const std::string & tmvaWeight="", const std::string & tmvaMethod="", - Float_t impactParTkThreshod_=1., const std::vector & tmvaVariables= std::vector(), bool runMvas=true); - PileupJetIdAlgo(const edm::ParameterSet & ps, bool runMvas); + + class AlgoGBRForestsAndConstants; + + PileupJetIdAlgo(AlgoGBRForestsAndConstants const* cache); ~PileupJetIdAlgo(); PileupJetIdentifier computeIdVariables(const reco::Jet * jet, float jec, const reco::Vertex *, const reco::VertexCollection &, double rho); void set(const PileupJetIdentifier &); - std::unique_ptr getMVA(const std::vector &, const std::string &); float getMVAval(const std::vector &, const std::unique_ptr &); PileupJetIdentifier computeMva(); - const std::string method() const { return tmvaMethod_; } - + const std::string method() const { return cache_->tmvaMethod(); } + std::string dumpVariables() const; typedef std::map > variables_list_t; @@ -54,38 +53,68 @@ class PileupJetIdAlgo { /// const PileupJetIdentifier::variables_list_t & getVariables() const { return variables_; }; const variables_list_t & getVariables() const { return variables_; }; + // In multithreaded mode, each PileupIdAlgo object will get duplicated + // on every stream. Some of the data it contains never changes after + // construction and can be shared by all streams. This nested class contains + // the data members that can be shared across streams. In particular + // the GBRForests take significant time to initialize and can be shared. + class AlgoGBRForestsAndConstants { + public: + + AlgoGBRForestsAndConstants(edm::ParameterSet const&, bool runMvas); + + std::unique_ptr const& reader() const { return reader_; } + std::vector> const& etaReader() const { return etaReader_; } + bool cutBased() const { return cutBased_; } + bool etaBinnedWeights() const { return etaBinnedWeights_; } + bool runMvas() const { return runMvas_; } + int nEtaBins() const { return nEtaBins_; } + std::vector const& jEtaMin() const { return jEtaMin_; } + std::vector const& jEtaMax() const { return jEtaMax_; } + std::string const& label() const { return label_; } + std::string const& tmvaMethod() const { return tmvaMethod_; } + std::vector const& tmvaVariables() const { return tmvaVariables_; } + std::vector> const& tmvaEtaVariables() const { return tmvaEtaVariables_; } + + typedef float array_t[3][4][4]; + array_t const& mvacut() const { return mvacut_; } + array_t const& rmsCut() const { return rmsCut_; } + array_t const& betaStarCut() const { return betaStarCut_; } + + std::unique_ptr getMVA(std::vector const& varList, + std::string const& tmvaWeights, + std::vector const& tmvaSpectators); + + private: + + std::unique_ptr reader_; + std::vector> etaReader_; + bool cutBased_; + bool etaBinnedWeights_; + bool runMvas_; + int nEtaBins_; + std::vector jEtaMin_; + std::vector jEtaMax_; + std::string label_; + std::string tmvaMethod_; + std::vector tmvaVariables_; + std::vector> tmvaEtaVariables_; + + float mvacut_ [3][4][4]; //Keep the array fixed + float rmsCut_ [3][4][4]; //Keep the array fixed + float betaStarCut_[3][4][4]; //Keep the array fixed + + std::map tmvaNames_; + }; + protected: - void setup(); void runMva(); - void bookReader(); void resetVariables(); void initVariables(); - PileupJetIdentifier internalId_; variables_list_t variables_; - - std::unique_ptr reader_; - std::vector> etaReader_; - std::string tmvaWeights_, tmvaMethod_; - std::vector tmvaEtaWeights_; - std::vector tmvaVariables_; - std::vector> tmvaEtaVariables_; - std::vector tmvaSpectators_; - std::map tmvaNames_; - - int version_; - float impactParTkThreshod_; - bool cutBased_; - bool etaBinnedWeights_; - int nEtaBins_; - std::vector jEtaMin_; - std::vector jEtaMax_; - bool runMvas_; - float mvacut_ [3][4][4]; //Keep the array fixed - float rmsCut_ [3][4][4]; //Keep the array fixed - float betaStarCut_[3][4][4]; //Keep the array fixed + AlgoGBRForestsAndConstants const* cache_; }; - #endif diff --git a/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc b/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc index 71051589d456e..3f02844b14740 100644 --- a/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc +++ b/RecoJets/JetProducers/plugins/PileupJetIdProducer.cc @@ -16,46 +16,49 @@ Description: [one line class summary] // // -#include #include "RecoJets/JetProducers/plugins/PileupJetIdProducer.h" +GBRForestsAndConstants::GBRForestsAndConstants(edm::ParameterSet const& iConfig) : + runMvas_(iConfig.getParameter("runMvas")), + produceJetIds_(iConfig.getParameter("produceJetIds")), + inputIsCorrected_(iConfig.getParameter("inputIsCorrected")), + applyJec_(iConfig.getParameter("applyJec")), + jec_(iConfig.getParameter("jec")), + residualsFromTxt_(iConfig.getParameter("residualsFromTxt")) { + + if (residualsFromTxt_) { + residualsTxt_ = iConfig.getParameter("residualsTxt"); + } + + std::vector algos = iConfig.getParameter >("algos"); + for (auto const& algoPset : algos) { + vAlgoGBRForestsAndConstants_.emplace_back(algoPset, runMvas_); + } + + if (!runMvas_) { + assert(algos.size() == 1); + } +} // ------------------------------------------------------------------------------------------ -PileupJetIdProducer::PileupJetIdProducer(const edm::ParameterSet& iConfig) +PileupJetIdProducer::PileupJetIdProducer(const edm::ParameterSet& iConfig, GBRForestsAndConstants const* globalCache) { - runMvas_ = iConfig.getParameter("runMvas"); - produceJetIds_ = iConfig.getParameter("produceJetIds"); - jets_ = iConfig.getParameter("jets"); - vertexes_ = iConfig.getParameter("vertexes"); - jetids_ = iConfig.getParameter("jetids"); - inputIsCorrected_ = iConfig.getParameter("inputIsCorrected"); - applyJec_ = iConfig.getParameter("applyJec"); - jec_ = iConfig.getParameter("jec"); - rho_ = iConfig.getParameter("rho"); - residualsFromTxt_ = iConfig.getParameter("residualsFromTxt"); - if(residualsFromTxt_) residualsTxt_ = iConfig.getParameter("residualsTxt"); - std::vector algos = iConfig.getParameter >("algos"); - - - if( ! runMvas_ ) assert( algos.size() == 1 ); - - if( produceJetIds_ ) { + if ( globalCache->produceJetIds() ) { produces > (""); } - for(std::vector::iterator it=algos.begin(); it!=algos.end(); ++it) { - std::string label = it->getParameter("label"); - algos_.emplace_back( label, std::make_unique(*it, runMvas_)); - if( runMvas_ ) { + for (auto const& algoGBRForestsAndConstants : globalCache->vAlgoGBRForestsAndConstants()) { + std::string const& label = algoGBRForestsAndConstants.label(); + algos_.emplace_back(label, std::make_unique(&algoGBRForestsAndConstants)); + if ( globalCache->runMvas() ) { produces > (label+"Discriminant"); produces > (label+"Id"); } } - input_jet_token_ = consumes >(jets_); - input_vertex_token_ = consumes(vertexes_); - input_vm_pujetid_token_ = consumes >(jetids_); - input_rho_token_ = consumes(rho_); - + input_jet_token_ = consumes >(iConfig.getParameter("jets")); + input_vertex_token_ = consumes(iConfig.getParameter("vertexes")); + input_vm_pujetid_token_ = consumes >(iConfig.getParameter("jetids")); + input_rho_token_ = consumes(iConfig.getParameter("rho")); } @@ -70,6 +73,8 @@ PileupJetIdProducer::~PileupJetIdProducer() void PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + GBRForestsAndConstants const* gc = globalCache(); + using namespace edm; using namespace std; using namespace reco; @@ -80,13 +85,13 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) const View & jets = *jetHandle; // vertexes Handle vertexHandle; - if( produceJetIds_ ) { + if( gc->produceJetIds() ) { iEvent.getByToken(input_vertex_token_, vertexHandle); } const VertexCollection & vertexes = *(vertexHandle.product()); // input variables Handle > vmap; - if( ! produceJetIds_ ) { + if( ! gc->produceJetIds() ) { iEvent.getByToken(input_vm_pujetid_token_, vmap); } // rho @@ -99,7 +104,7 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) map > idflags; VertexCollection::const_iterator vtx; - if( produceJetIds_ ) { + if( gc->produceJetIds() ) { // require basic quality cuts on the vertexes vtx = vertexes.begin(); while( vtx != vertexes.end() && ( vtx->isFake() || vtx->ndof() < 4 ) ) { @@ -124,7 +129,7 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) // Get jet energy correction float jec = 0.; - if( applyJec_ ) { + if( gc->applyJec() ) { // If haven't done it get rho from the event if( rho == 0. ) { iEvent.getByToken(input_rho_token_,rhoH); @@ -145,22 +150,22 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) jec = jecCor_->getCorrection(); } // If it was requested AND the input is an uncorrected jet apply the JEC - bool applyJec = applyJec_ && ( ispat || !inputIsCorrected_ ); - reco::Jet * corrJet = nullptr; + bool applyJec = gc->applyJec() && ( ispat || !gc->inputIsCorrected() ); + std::unique_ptr corrJet; if( applyJec ) { float scale = jec; if( ispat ) { - corrJet = new pat::Jet(patjet->correctedJet(0)) ; + corrJet.reset(new pat::Jet(patjet->correctedJet(0))) ; } else { - corrJet = dynamic_cast( jet.clone() ); + corrJet.reset(dynamic_cast( jet.clone() )); } corrJet->scaleEnergy(scale); } - const reco::Jet * theJet = ( applyJec ? corrJet : &jet ); + const reco::Jet * theJet = ( applyJec ? corrJet.get() : &jet ); PileupJetIdentifier puIdentifier; - if( produceJetIds_ ) { + if( gc->produceJetIds() ) { // Compute the input variables puIdentifier = ialgo->computeIdVariables(theJet, jec, &(*vtx), vertexes, rho); ids.push_back( puIdentifier ); @@ -174,7 +179,7 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) puIdentifier = ialgo->computeMva(); } - if( runMvas_ ) { + if( gc->runMvas() ) { // Compute the MVA and WP mvas[algoi->first].push_back( puIdentifier.mva() ); idflags[algoi->first].push_back( puIdentifier.idFlag() ); @@ -186,13 +191,10 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) idflags[algoi->first].push_back( id.idFlag() ); } } - - // cleanup - if( corrJet ) { delete corrJet; } } // Produce the output value maps - if( runMvas_ ) { + if( gc->runMvas() ) { for( const auto& ialgo : algos_) { // MVA vector & mva = mvas[ialgo.first]; @@ -212,7 +214,7 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } } // input variables - if( produceJetIds_ ) { + if( gc->produceJetIds() ) { assert( jetHandle->size() == ids.size() ); auto idsout = std::make_unique>(); ValueMap::Filler idsfiller(*idsout); @@ -239,23 +241,25 @@ PileupJetIdProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptio void PileupJetIdProducer::initJetEnergyCorrector(const edm::EventSetup &iSetup, bool isData) { + GBRForestsAndConstants const* gc = globalCache(); + //jet energy correction levels to apply on raw jet std::vector jecLevels; jecLevels.push_back("L1FastJet"); jecLevels.push_back("L2Relative"); jecLevels.push_back("L3Absolute"); - if(isData && ! residualsFromTxt_ ) jecLevels.push_back("L2L3Residual"); + if(isData && ! gc->residualsFromTxt() ) jecLevels.push_back("L2L3Residual"); //check the corrector parameters needed according to the correction levels edm::ESHandle parameters; - iSetup.get().get(jec_,parameters); + iSetup.get().get(gc->jec(),parameters); for(std::vector::const_iterator ll = jecLevels.begin(); ll != jecLevels.end(); ++ll) { const JetCorrectorParameters& ip = (*parameters)[*ll]; jetCorPars_.push_back(ip); } - if( isData && residualsFromTxt_ ) { - jetCorPars_.push_back(JetCorrectorParameters(residualsTxt_.fullPath())); + if( isData && gc->residualsFromTxt() ) { + jetCorPars_.push_back(JetCorrectorParameters(gc->residualsTxt().fullPath())); } //instantiate the jet corrector diff --git a/RecoJets/JetProducers/plugins/PileupJetIdProducer.h b/RecoJets/JetProducers/plugins/PileupJetIdProducer.h index ca5efae40ff3a..331f97f2e88d1 100644 --- a/RecoJets/JetProducers/plugins/PileupJetIdProducer.h +++ b/RecoJets/JetProducers/plugins/PileupJetIdProducer.h @@ -46,33 +46,65 @@ Description: Produces a value map of jet --> pileup jet ID #include "FWCore/ParameterSet/interface/FileInPath.h" // ------------------------------------------------------------------------------------------ -class PileupJetIdProducer : public edm::stream::EDProducer<> { + +class GBRForestsAndConstants { +public: + + GBRForestsAndConstants(edm::ParameterSet const&); + + std::vector const& vAlgoGBRForestsAndConstants() const { + return vAlgoGBRForestsAndConstants_; + } + + bool runMvas() const { return runMvas_; } + bool produceJetIds() const { return produceJetIds_; } + bool inputIsCorrected() const { return inputIsCorrected_; } + bool applyJec() const { return applyJec_; } + std::string const& jec() const { return jec_; } + bool residualsFromTxt() const { return residualsFromTxt_; } + edm::FileInPath const& residualsTxt() const { return residualsTxt_; } + +private: + + std::vector vAlgoGBRForestsAndConstants_; + + bool runMvas_; + bool produceJetIds_; + bool inputIsCorrected_; + bool applyJec_; + std::string jec_; + bool residualsFromTxt_; + edm::FileInPath residualsTxt_; +}; + +class PileupJetIdProducer : public edm::stream::EDProducer> { public: - explicit PileupJetIdProducer(const edm::ParameterSet&); - ~PileupJetIdProducer() override; + explicit PileupJetIdProducer(const edm::ParameterSet&, GBRForestsAndConstants const*); + ~PileupJetIdProducer() override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + static std::unique_ptr initializeGlobalCache(edm::ParameterSet const& pset) { + return std::make_unique(pset); + } + + static void globalEndJob(GBRForestsAndConstants*) { } private: - void produce(edm::Event&, const edm::EventSetup&) override; + void produce(edm::Event&, const edm::EventSetup&) override; - void initJetEnergyCorrector(const edm::EventSetup &iSetup, bool isData); + void initJetEnergyCorrector(const edm::EventSetup &iSetup, bool isData); - edm::InputTag jets_, vertexes_, jetids_, rho_; - std::string jec_; - bool runMvas_, produceJetIds_, inputIsCorrected_, applyJec_; - std::vector> > algos_; + std::vector> > algos_; - bool residualsFromTxt_; - edm::FileInPath residualsTxt_; - std::unique_ptr jecCor_; - std::vector jetCorPars_; - - edm::EDGetTokenT > input_jet_token_; - edm::EDGetTokenT input_vertex_token_; - edm::EDGetTokenT > input_vm_pujetid_token_; - edm::EDGetTokenT input_rho_token_; + std::unique_ptr jecCor_; + std::vector jetCorPars_; + + edm::EDGetTokenT > input_jet_token_; + edm::EDGetTokenT input_vertex_token_; + edm::EDGetTokenT > input_vm_pujetid_token_; + edm::EDGetTokenT input_rho_token_; }; diff --git a/RecoJets/JetProducers/src/PileupJetIdAlgo.cc b/RecoJets/JetProducers/src/PileupJetIdAlgo.cc index 56bbec7ffb236..2c56d95acb7b4 100644 --- a/RecoJets/JetProducers/src/PileupJetIdAlgo.cc +++ b/RecoJets/JetProducers/src/PileupJetIdAlgo.cc @@ -12,110 +12,129 @@ #include "TMatrixDSymEigen.h" #include "TMVA/MethodBDT.h" +#include + // ------------------------------------------------------------------------------------------ const float large_val = std::numeric_limits::max(); // ------------------------------------------------------------------------------------------ -PileupJetIdAlgo::PileupJetIdAlgo(const edm::ParameterSet & ps, bool runMvas) -{ - impactParTkThreshod_ = 1.;/// ps.getParameter("impactParTkThreshod"); - cutBased_ = false; - etaBinnedWeights_ = false; - runMvas_=runMvas; - //std::string label = ps.getParameter("label"); - cutBased_ = ps.getParameter("cutBased"); - if(!cutBased_) - { - etaBinnedWeights_ = ps.getParameter("etaBinnedWeights"); - if(etaBinnedWeights_){ - - const std::vector& trainings = ps.getParameter >("trainings"); - nEtaBins_ = ps.getParameter("nEtaBins"); - for(int v=0; v("tmvaWeights")).fullPath() ); - jEtaMin_.push_back( trainings.at(v).getParameter("jEtaMin") ); - jEtaMax_.push_back( trainings.at(v).getParameter("jEtaMax") ); - } - for(int v=0; v >("tmvaVariables") ); - } - } - else{ - tmvaWeights_ = edm::FileInPath(ps.getParameter("tmvaWeights")).fullPath(); - tmvaVariables_ = ps.getParameter >("tmvaVariables"); - } - tmvaMethod_ = ps.getParameter("tmvaMethod"); - tmvaSpectators_ = ps.getParameter >("tmvaSpectators"); - version_ = ps.getParameter("version"); - } - else version_ = USER; - edm::ParameterSet jetConfig = ps.getParameter("JetIdParams"); - for(int i0 = 0; i0 < 3; i0++) { - std::string lCutType = "Tight"; - if(i0 == PileupJetIdentifier::kMedium) lCutType = "Medium"; - if(i0 == PileupJetIdentifier::kLoose) lCutType = "Loose"; - int nCut = 1; - if(cutBased_) nCut++; - for(int i1 = 0; i1 < nCut; i1++) { - std::string lFullCutType = lCutType; - if(cutBased_ && i1 == 0) lFullCutType = "BetaStar"+ lCutType; - if(cutBased_ && i1 == 1) lFullCutType = "RMS" + lCutType; - std::vector pt010 = jetConfig.getParameter >(("Pt010_" +lFullCutType).c_str()); - std::vector pt1020 = jetConfig.getParameter >(("Pt1020_"+lFullCutType).c_str()); - std::vector pt2030 = jetConfig.getParameter >(("Pt2030_"+lFullCutType).c_str()); - std::vector pt3050 = jetConfig.getParameter >(("Pt3050_"+lFullCutType).c_str()); - if(!cutBased_) { - for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][0][i2] = pt010 [i2]; - for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][1][i2] = pt1020[i2]; - for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][2][i2] = pt2030[i2]; - for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][3][i2] = pt3050[i2]; - } - if(cutBased_ && i1 == 0) { - for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][0][i2] = pt010 [i2]; - for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][1][i2] = pt1020[i2]; - for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][2][i2] = pt2030[i2]; - for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][3][i2] = pt3050[i2]; - } - if(cutBased_ && i1 == 1) { - for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][0][i2] = pt010 [i2]; - for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][1][i2] = pt1020[i2]; - for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][2][i2] = pt2030[i2]; - for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][3][i2] = pt3050[i2]; - } - } - } - setup(); + +PileupJetIdAlgo::AlgoGBRForestsAndConstants::AlgoGBRForestsAndConstants(edm::ParameterSet const& ps, bool runMvas) : + cutBased_(ps.getParameter("cutBased")), + etaBinnedWeights_(false), + runMvas_(runMvas), + nEtaBins_(0), + label_(ps.getParameter("label")), + mvacut_{}, + rmsCut_{}, + betaStarCut_{} + { + + std::string tmvaWeights; + std::vector tmvaEtaWeights; + std::vector tmvaSpectators; + int version; + + if (!cutBased_) { + etaBinnedWeights_ = ps.getParameter("etaBinnedWeights"); + if (etaBinnedWeights_) { + const std::vector& trainings = ps.getParameter >("trainings"); + nEtaBins_ = ps.getParameter("nEtaBins"); + for (int v = 0; v < nEtaBins_; v++) { + tmvaEtaWeights.push_back( edm::FileInPath(trainings.at(v).getParameter("tmvaWeights")).fullPath() ); + jEtaMin_.push_back( trainings.at(v).getParameter("jEtaMin") ); + jEtaMax_.push_back( trainings.at(v).getParameter("jEtaMax") ); + } + for (int v = 0; v < nEtaBins_; v++) { + tmvaEtaVariables_.push_back( trainings.at(v).getParameter >("tmvaVariables") ); + } + } else { + tmvaWeights = edm::FileInPath(ps.getParameter("tmvaWeights")).fullPath(); + tmvaVariables_ = ps.getParameter >("tmvaVariables"); + } + tmvaMethod_ = ps.getParameter("tmvaMethod"); + tmvaSpectators = ps.getParameter >("tmvaSpectators"); + version = ps.getParameter("version"); + } else { + version = USER; + } + + edm::ParameterSet jetConfig = ps.getParameter("JetIdParams"); + for (int i0 = 0; i0 < 3; i0++) { + std::string lCutType = "Tight"; + if (i0 == PileupJetIdentifier::kMedium) lCutType = "Medium"; + if (i0 == PileupJetIdentifier::kLoose) lCutType = "Loose"; + int nCut = 1; + if(cutBased_) nCut++; + for (int i1 = 0; i1 < nCut; i1++) { + std::string lFullCutType = lCutType; + if (cutBased_ && i1 == 0) lFullCutType = "BetaStar"+ lCutType; + if (cutBased_ && i1 == 1) lFullCutType = "RMS" + lCutType; + std::vector pt010 = jetConfig.getParameter >(("Pt010_" +lFullCutType).c_str()); + std::vector pt1020 = jetConfig.getParameter >(("Pt1020_"+lFullCutType).c_str()); + std::vector pt2030 = jetConfig.getParameter >(("Pt2030_"+lFullCutType).c_str()); + std::vector pt3050 = jetConfig.getParameter >(("Pt3050_"+lFullCutType).c_str()); + if (!cutBased_) { + for (int i2 = 0; i2 < 4; i2++) mvacut_[i0][0][i2] = pt010 [i2]; + for (int i2 = 0; i2 < 4; i2++) mvacut_[i0][1][i2] = pt1020[i2]; + for (int i2 = 0; i2 < 4; i2++) mvacut_[i0][2][i2] = pt2030[i2]; + for (int i2 = 0; i2 < 4; i2++) mvacut_[i0][3][i2] = pt3050[i2]; + } + if (cutBased_ && i1 == 0) { + for (int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][0][i2] = pt010 [i2]; + for (int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][1][i2] = pt1020[i2]; + for (int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][2][i2] = pt2030[i2]; + for (int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][3][i2] = pt3050[i2]; + } + if (cutBased_ && i1 == 1) { + for (int i2 = 0; i2 < 4; i2++) rmsCut_[i0][0][i2] = pt010 [i2]; + for (int i2 = 0; i2 < 4; i2++) rmsCut_[i0][1][i2] = pt1020[i2]; + for (int i2 = 0; i2 < 4; i2++) rmsCut_[i0][2][i2] = pt2030[i2]; + for (int i2 = 0; i2 < 4; i2++) rmsCut_[i0][3][i2] = pt3050[i2]; + } + } + } + + if ( ! cutBased_ ) { + assert( tmvaMethod_.empty() || ((! tmvaVariables_.empty() || ( !tmvaEtaVariables_.empty() )) && version == USER) ); + } + + if (( ! cutBased_ ) && (runMvas_)) { + if (etaBinnedWeights_) { + for (int v = 0; v < nEtaBins_; v++) { + etaReader_.push_back(getMVA(tmvaEtaVariables_.at(v), tmvaEtaWeights.at(v), tmvaSpectators)); + } + } else { + reader_ = getMVA(tmvaVariables_, tmvaWeights, tmvaSpectators); + } + } } -// ------------------------------------------------------------------------------------------ -PileupJetIdAlgo::PileupJetIdAlgo(int version, - const std::string & tmvaWeights, - const std::string & tmvaMethod, - Float_t impactParTkThreshod, - const std::vector & tmvaVariables, - bool runMvas - ) -{ - impactParTkThreshod_ = impactParTkThreshod; - tmvaWeights_ = tmvaWeights; - tmvaMethod_ = tmvaMethod; - tmvaVariables_ = tmvaVariables; - version_ = version; - - runMvas_=runMvas; - - setup(); +std::unique_ptr +PileupJetIdAlgo::AlgoGBRForestsAndConstants::getMVA(std::vector const& varList, + std::string const& tmvaWeights, + std::vector const& tmvaSpectators) { + + // A temporary only to access the variables while calling TMVA AddVariable and TMVA AddSpectator. + PileupJetIdAlgo algo(nullptr); + + TMVA::Reader tmpTMVAReader( "!Color:Silent:!Error" ); + for (auto const& varName : varList) { + if ( tmvaNames_[varName].empty() ) tmvaNames_[varName] = varName; + tmpTMVAReader.AddVariable( varName, std::get(algo.getVariables().at(tmvaNames_[varName])) ); + } + for (auto const& spectatorName : tmvaSpectators) { + if ( tmvaNames_[spectatorName].empty() ) tmvaNames_[spectatorName] = spectatorName; + tmpTMVAReader.AddSpectator( spectatorName, std::get(algo.getVariables().at(tmvaNames_[spectatorName])) ); + } + reco::details::loadTMVAWeights(&tmpTMVAReader, tmvaMethod_, tmvaWeights); + return ( std::make_unique ( dynamic_cast( tmpTMVAReader.FindMVA(tmvaMethod_.c_str()) ) ) ); } -// ------------------------------------------------------------------------------------------ -void PileupJetIdAlgo::setup() -{ - initVariables(); +PileupJetIdAlgo::PileupJetIdAlgo(AlgoGBRForestsAndConstants const* cache) : + cache_(cache) { - if( ! cutBased_ ){ - assert( tmvaMethod_.empty() || ((! tmvaVariables_.empty() || ( !tmvaEtaVariables_.empty() )) && version_ == USER) ); - } - if(( ! cutBased_ ) && (runMvas_)) { bookReader();} + initVariables(); } // ------------------------------------------------------------------------------------------ @@ -140,30 +159,6 @@ void setPtEtaPhi(const reco::Candidate & p, float & pt, float & eta, float &phi phi = p.phi(); } -std::unique_ptr PileupJetIdAlgo::getMVA(const std::vector &varList, const std::string &tmvaWeights) -{ - TMVA::Reader tmpTMVAReader( "!Color:Silent:!Error" ); - for(std::vector::const_iterator it=varList.begin(); it!=varList.end(); ++it) { - if( tmvaNames_[*it].empty() ) tmvaNames_[*it] = *it; - tmpTMVAReader.AddVariable( *it, variables_[ tmvaNames_[*it] ].first ); - } - for(std::vector::iterator it=tmvaSpectators_.begin(); it!=tmvaSpectators_.end(); ++it) { - if( tmvaNames_[*it].empty() ) tmvaNames_[*it] = *it; - tmpTMVAReader.AddSpectator( *it, variables_[ tmvaNames_[*it] ].first ); - } - reco::details::loadTMVAWeights(&tmpTMVAReader, tmvaMethod_, tmvaWeights); - return( std::make_unique ( dynamic_cast( tmpTMVAReader.FindMVA(tmvaMethod_.c_str()) ) ) ); -} - -void PileupJetIdAlgo::bookReader() -{ - if(etaBinnedWeights_){ - for(int v=0; v &varList, const std::unique_ptr &reader) { - float mvaval = -2; std::vector vars; for(std::vector::const_iterator it=varList.begin(); it!=varList.end(); ++it) { std::pair var = variables_.at(*it); vars.push_back( *var.first ); } - mvaval = reader->GetClassifier(vars.data()); - return mvaval; + return reader->GetClassifier(vars.data()); } void PileupJetIdAlgo::runMva() { - if( cutBased_ ) { - internalId_.idFlag_ = computeCutIDflag(internalId_.betaStarClassic_,internalId_.dR2Mean_,internalId_.nvtx_,internalId_.jetPt_,internalId_.jetEta_); - } else { - if(std::abs(internalId_.jetEta_) >= 5.0) { - internalId_.mva_ = -2.; - } else { - if(etaBinnedWeights_){ - if(std::abs(internalId_.jetEta_) > jEtaMax_.at(nEtaBins_-1)) { - internalId_.mva_ = -2.; - } else { - for(int v=0; v=jEtaMin_.at(v) && std::abs(internalId_.jetEta_)cutBased() ) { + internalId_.idFlag_ = computeCutIDflag(internalId_.betaStarClassic_,internalId_.dR2Mean_,internalId_.nvtx_,internalId_.jetPt_,internalId_.jetEta_); + } else { + if(std::abs(internalId_.jetEta_) >= 5.0) { + internalId_.mva_ = -2.; + } else { + if(cache_->etaBinnedWeights()){ + if(std::abs(internalId_.jetEta_) > cache_->jEtaMax().at(cache_->nEtaBins() - 1)) { + internalId_.mva_ = -2.; + } else { + for(int v = 0; v < cache_->nEtaBins(); v++){ + if(std::abs(internalId_.jetEta_) >= cache_->jEtaMin().at(v) && std::abs(internalId_.jetEta_) < cache_->jEtaMax().at(v)) { + internalId_.mva_ = getMVAval(cache_->tmvaEtaVariables().at(v), cache_->etaReader().at(v)); + break; + } + } + } + } else { + internalId_.mva_ = getMVAval(cache_->tmvaVariables(), cache_->reader()); + } + } + internalId_.idFlag_ = computeIDflag(internalId_.mva_,internalId_.jetPt_,internalId_.jetEta_); + } } // ------------------------------------------------------------------------------------------ @@ -232,16 +225,16 @@ int PileupJetIdAlgo::computeCutIDflag(float betaStarClassic,float dR2Mean,float std::pair jetIdKey = getJetIdKey(jetPt,jetEta); float betaStarModified = betaStarClassic/log(nvtx-0.64); int idFlag(0); - if(betaStarModified < betaStarCut_[PileupJetIdentifier::kTight ][jetIdKey.first][jetIdKey.second] && - dR2Mean < rmsCut_ [PileupJetIdentifier::kTight ][jetIdKey.first][jetIdKey.second] + if(betaStarModified < cache_->betaStarCut()[PileupJetIdentifier::kTight ][jetIdKey.first][jetIdKey.second] && + dR2Mean < cache_->rmsCut() [PileupJetIdentifier::kTight ][jetIdKey.first][jetIdKey.second] ) idFlag += 1 << PileupJetIdentifier::kTight; - if(betaStarModified < betaStarCut_[PileupJetIdentifier::kMedium ][jetIdKey.first][jetIdKey.second] && - dR2Mean < rmsCut_ [PileupJetIdentifier::kMedium ][jetIdKey.first][jetIdKey.second] + if(betaStarModified < cache_->betaStarCut()[PileupJetIdentifier::kMedium ][jetIdKey.first][jetIdKey.second] && + dR2Mean < cache_->rmsCut() [PileupJetIdentifier::kMedium ][jetIdKey.first][jetIdKey.second] ) idFlag += 1 << PileupJetIdentifier::kMedium; - if(betaStarModified < betaStarCut_[PileupJetIdentifier::kLoose ][jetIdKey.first][jetIdKey.second] && - dR2Mean < rmsCut_ [PileupJetIdentifier::kLoose ][jetIdKey.first][jetIdKey.second] + if(betaStarModified < cache_->betaStarCut()[PileupJetIdentifier::kLoose ][jetIdKey.first][jetIdKey.second] && + dR2Mean < cache_->rmsCut() [PileupJetIdentifier::kLoose ][jetIdKey.first][jetIdKey.second] ) idFlag += 1 << PileupJetIdentifier::kLoose; return idFlag; } @@ -256,9 +249,9 @@ int PileupJetIdAlgo::computeIDflag(float mva, float jetPt, float jetEta) int PileupJetIdAlgo::computeIDflag(float mva,int ptId,int etaId) { int idFlag(0); - if(mva > mvacut_[PileupJetIdentifier::kTight ][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kTight; - if(mva > mvacut_[PileupJetIdentifier::kMedium][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kMedium; - if(mva > mvacut_[PileupJetIdentifier::kLoose ][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kLoose; + if(mva > cache_->mvacut()[PileupJetIdentifier::kTight ][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kTight; + if(mva > cache_->mvacut()[PileupJetIdentifier::kMedium][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kMedium; + if(mva > cache_->mvacut()[PileupJetIdentifier::kLoose ][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kLoose; return idFlag; } @@ -641,7 +634,7 @@ PileupJetIdentifier PileupJetIdAlgo::computeIdVariables(const reco::Jet * jet, f assert( internalId_.beta_ == 0. && internalId_.betaStar_ == 0.&& internalId_.betaClassic_ == 0. && internalId_.betaStarClassic_ == 0. ); } - if( runMvas_ ) { + if( cache_->runMvas() ) { runMva(); } diff --git a/RecoLocalCalo/Castor/src/RecHitCorrector.cc b/RecoLocalCalo/Castor/src/RecHitCorrector.cc index 30b1f5a0653a6..57908eb2ea300 100644 --- a/RecoLocalCalo/Castor/src/RecHitCorrector.cc +++ b/RecoLocalCalo/Castor/src/RecHitCorrector.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -44,15 +44,13 @@ // class declaration // -class RecHitCorrector : public edm::EDProducer { +class RecHitCorrector : public edm::stream::EDProducer<> { public: explicit RecHitCorrector(const edm::ParameterSet&); ~RecHitCorrector() override; private: - void beginJob() override ; void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override ; // ----------member data --------------------------- edm::EDGetTokenT tok_input_; @@ -114,7 +112,7 @@ RecHitCorrector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) iSetup.get().get(p); CastorChannelQuality* myqual = new CastorChannelQuality(*p.product()); - if (!rechits.isValid()) std::cout << "No valid CastorRecHitCollection found, please check the InputLabel..." << std::endl; + if (!rechits.isValid()) edm::LogWarning("CastorRecHitCorrector") << "No valid CastorRecHitCollection found, please check the InputLabel..."; CastorCalibrations calibrations; @@ -122,64 +120,41 @@ RecHitCorrector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) for (unsigned int i=0;isize();i++) { CastorRecHit rechit = (*rechits)[i]; - //std::cout << "rechit energy = " << rechit.energy() << std::endl; - double fC = factor_*rechit.energy(); double time = rechit.time(); - //std::cout << "rechit energy(fC) = " << fC << " time = " << time << std::endl; + double correctedenergy = factor_*rechit.energy(); - // do proper gain calibration reading the latest entries in the condDB - const CastorCalibrations& calibrations=conditions->getCastorCalibrations(rechit.id()); - int capid = 0; // take some capid, gains are the same for all capid's - - double correctedenergy = 0; if (doInterCalib_) { - if (rechit.id().module() <= 2) { - correctedenergy = 0.5*fC*calibrations.gain(capid); - //std::cout << " correctedenergy = " << correctedenergy << " gain = " << calibrations.gain(capid) << std::endl; - } else { - correctedenergy = fC*calibrations.gain(capid); - } - } else { - if (rechit.id().module() <= 2) { - correctedenergy = 0.5*fC; - } else { - correctedenergy = fC; - } + // do proper gain calibration reading the latest entries in the condDB + const CastorCalibrations& calibrations=conditions->getCastorCalibrations(rechit.id()); + int capid = 0; // take some capid, gains are the same for all capid's + correctedenergy *= calibrations.gain(capid); } // now check the channelquality of this rechit bool ok = true; DetId detcell=(DetId)rechit.id(); std::vector channels = myqual->getAllChannels(); - //std::cout << "number of specified quality flags = " << channels.size() << std::endl; - for (std::vector::iterator channel = channels.begin();channel != channels.end();channel++) { - if (channel->rawId() == detcell.rawId()) { - const CastorChannelStatus* mydigistatus=myqual->getValues(*channel); - //std::cout << "CastorChannelStatus = " << mydigistatus->getValue() << std::endl; - if (mydigistatus->getValue() == 2989) ok = false; // 2989 = BAD + for (auto channel : channels) { + if (channel.rawId() == detcell.rawId()) { + const CastorChannelStatus* mydigistatus=myqual->getValues(channel); + if (mydigistatus->getValue() == 2989) { + ok = false; // 2989 = BAD + break; + } } } if (ok) { - CastorRecHit *correctedhit = new CastorRecHit(rechit.id(),correctedenergy,time); - rec->push_back(*correctedhit); + rec->emplace_back(rechit.id(),correctedenergy,time); } } iEvent.put(std::move(rec)); + + delete myqual; } -// ------------ method called once each job just before starting event loop ------------ -void -RecHitCorrector::beginJob() -{ -} - -// ------------ method called once each job just after ending the event loop ------------ -void -RecHitCorrector::endJob() { -} //define this as a plug-in DEFINE_FWK_MODULE(RecHitCorrector); diff --git a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h index 45368bb28af8d..a69a13c335036 100644 --- a/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h +++ b/RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h @@ -49,7 +49,7 @@ class HGCalImagingAlgo enum VerbosityLevel { pDEBUG = 0, pWARNING = 1, pINFO = 2, pERROR = 3 }; -HGCalImagingAlgo() : vecDeltas(), kappa(1.), ecut(0.), cluster_offset(0), +HGCalImagingAlgo() : vecDeltas(), kappa(1.), ecut(0.), sigma2(1.0), algoId(reco::CaloCluster::undefined), verbosity(pERROR),initialized(false){ @@ -67,7 +67,6 @@ HGCalImagingAlgo(const std::vector& vecDeltas_in, double kappa_in, doubl VerbosityLevel the_verbosity = pERROR) : vecDeltas(vecDeltas_in), kappa(kappa_in), ecut(ecut_in), - cluster_offset(0), sigma2(1.0), algoId(algoId_in), dependSensor(dependSensor_in), @@ -99,7 +98,6 @@ HGCalImagingAlgo(const std::vector& vecDeltas_in, double kappa_in, doubl double noiseMip_in, VerbosityLevel the_verbosity = pERROR) : vecDeltas(vecDeltas_in), kappa(kappa_in), ecut(ecut_in), - cluster_offset(0), sigma2(std::pow(showerSigma,2.0)), algoId(algoId_in), dependSensor(dependSensor_in), @@ -140,9 +138,8 @@ void getEventSetup(const edm::EventSetup& es){ } // use this if you want to reuse the same cluster object but don't want to accumulate clusters (hardly useful?) void reset(){ - current_v.clear(); clusters_v.clear(); - cluster_offset = 0; + layerClustersPerLayer.clear(); for( auto& it: points) { it.clear(); @@ -177,9 +174,6 @@ double kappa; // The hit energy cutoff double ecut; -// The current offset into the temporary cluster structure -unsigned int cluster_offset; - // for energy sharing double sigma2; // transverse shower size @@ -234,7 +228,7 @@ struct Hexel { clusterIndex(-1), sigmaNoise(sigmaNoise_in), thickness(thickness_in), tools(tools_in) { - const GlobalPoint position( std::move( tools->getPosition( detid ) ) ); + const GlobalPoint position( tools->getPosition( detid ) ); weight = hit.energy(); x = position.x(); y = position.y(); @@ -260,10 +254,9 @@ typedef KDTreeLinkerAlgo KDTree; typedef KDTreeNodeInfoT KDNode; -// A vector of vectors of KDNodes holding an Hexel in the clusters - to be used to build CaloClusters of DetIds -std::vector< std::vector > current_v; +std::vector > > layerClustersPerLayer; -std::vector sort_by_delta(const std::vector &v){ +std::vector sort_by_delta(const std::vector &v) const { std::vector idx(v.size()); std::iota (std::begin(idx), std::end(idx), 0); sort(idx.begin(), idx.end(), @@ -281,18 +274,18 @@ std::vector > maxpos; //these functions should be in a helper class. -inline double distance2(const Hexel &pt1, const Hexel &pt2) { //distance squared +inline double distance2(const Hexel &pt1, const Hexel &pt2) const{ //distance squared const double dx = pt1.x - pt2.x; const double dy = pt1.y - pt2.y; return (dx*dx + dy*dy); } //distance squaredq -inline double distance(const Hexel &pt1, const Hexel &pt2) { //2-d distance on the layer (x-y) +inline double distance(const Hexel &pt1, const Hexel &pt2) const{ //2-d distance on the layer (x-y) return std::sqrt(distance2(pt1,pt2)); } -double calculateLocalDensity(std::vector &, KDTree &, const unsigned int); //return max density -double calculateDistanceToHigher(std::vector &); -int findAndAssignClusters(std::vector &, KDTree &, double, KDTreeBox &, const unsigned int); -math::XYZPoint calculatePosition(std::vector &); +double calculateLocalDensity(std::vector &, KDTree &, const unsigned int) const; //return max density +double calculateDistanceToHigher(std::vector &) const; +int findAndAssignClusters(std::vector &, KDTree &, double, KDTreeBox &, const unsigned int, std::vector >&) const; +math::XYZPoint calculatePosition(std::vector &) const; // attempt to find subclusters within a given set of hexels std::vector findLocalMaximaInCluster(const std::vector&); diff --git a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc index 3c1cf8e4ade54..fa26245cd8622 100644 --- a/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc +++ b/RecoLocalCalo/HGCalRecAlgos/src/HGCalImagingAlgo.cc @@ -1,173 +1,198 @@ #include "RecoLocalCalo/HGCalRecAlgos/interface/HGCalImagingAlgo.h" // Geometry -#include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h" // #include "DataFormats/CaloRecHit/interface/CaloID.h" +#include "tbb/task_arena.h" +#include "tbb/tbb.h" -void HGCalImagingAlgo::populate(const HGCRecHitCollection& hits){ - //loop over all hits and create the Hexel structure, skip energies below ecut +void HGCalImagingAlgo::populate(const HGCRecHitCollection &hits) { + // loop over all hits and create the Hexel structure, skip energies below ecut if (dependSensor) { - // for each layer and wafer calculate the thresholds (sigmaNoise and energy) once + // for each layer and wafer calculate the thresholds (sigmaNoise and energy) + // once computeThreshold(); } - std::vector firstHit(2*(maxlayer+1), true); - for (unsigned int i=0;i firstHit(2 * (maxlayer + 1), true); + for (unsigned int i = 0; i < hits.size(); ++i) { - const HGCRecHit& hgrh = hits[i]; + const HGCRecHit &hgrh = hits[i]; DetId detid = hgrh.detid(); unsigned int layer = rhtools_.getLayerWithOffset(detid); - float thickness = 0.; - // set sigmaNoise default value 1 to use kappa value directly in case of sensor-independent thresholds - float sigmaNoise = 1.; - if(dependSensor){ - if (layer<= lastLayerFH) // only EE and FH have silicon sensors + float thickness = 0.f; + // set sigmaNoise default value 1 to use kappa value directly in case of + // sensor-independent thresholds + float sigmaNoise = 1.f; + if (dependSensor) { + if (layer <= lastLayerFH) // only EE and FH have silicon sensors thickness = rhtools_.getSiThickness(detid); - double storedThreshold=thresholds[layer-1][layer<=lastLayerFH ? rhtools_.getWafer(detid) : 0]; - sigmaNoise = v_sigmaNoise[layer-1][layer<=lastLayerFH ? rhtools_.getWafer(detid) : 0]; - - if(hgrh.energy() < storedThreshold) - continue; //this sets the ZS threshold at ecut times the sigma noise for the sensor + double storedThreshold = + thresholds[layer - 1] + [layer <= lastLayerFH ? rhtools_.getWafer(detid) : 0]; + sigmaNoise = + v_sigmaNoise[layer - 1] + [layer <= lastLayerFH ? rhtools_.getWafer(detid) : 0]; + + if (hgrh.energy() < storedThreshold) + continue; // this sets the ZS threshold at ecut times the sigma noise + // for the sensor } - if(!dependSensor && hgrh.energy() < ecut) continue; + if (!dependSensor && hgrh.energy() < ecut) + continue; - // map layers from positive endcap (z) to layer + maxlayer+1 to prevent mixing up hits from different sides - layer += int(rhtools_.zside(detid)>0)*(maxlayer+1); + // map layers from positive endcap (z) to layer + maxlayer+1 to prevent + // mixing up hits from different sides + layer += int(rhtools_.zside(detid) > 0) * (maxlayer + 1); // determine whether this is a half-hexagon bool isHalf = rhtools_.isHalfCell(detid); - const GlobalPoint position( std::move( rhtools_.getPosition( detid ) ) ); - - //here's were the KDNode is passed its dims arguments - note that these are *copied* from the Hexel - points[layer].emplace_back(Hexel(hgrh,detid,isHalf,sigmaNoise,thickness,&rhtools_),position.x(),position.y()); - - // for each layer, store the minimum and maximum x and y coordinates for the KDTreeBox boundaries - if(firstHit[layer]){ - minpos[layer][0] = position.x(); minpos[layer][1] = position.y(); - maxpos[layer][0] = position.x(); maxpos[layer][1] = position.y(); + const GlobalPoint position(rhtools_.getPosition(detid)); + + // here's were the KDNode is passed its dims arguments - note that these are + // *copied* from the Hexel + points[layer].emplace_back( + Hexel(hgrh, detid, isHalf, sigmaNoise, thickness, &rhtools_), + position.x(), position.y()); + + // for each layer, store the minimum and maximum x and y coordinates for the + // KDTreeBox boundaries + if (firstHit[layer]) { + minpos[layer][0] = position.x(); + minpos[layer][1] = position.y(); + maxpos[layer][0] = position.x(); + maxpos[layer][1] = position.y(); firstHit[layer] = false; - }else{ - minpos[layer][0] = std::min((float)position.x(),minpos[layer][0]); - minpos[layer][1] = std::min((float)position.y(),minpos[layer][1]); - maxpos[layer][0] = std::max((float)position.x(),maxpos[layer][0]); - maxpos[layer][1] = std::max((float)position.y(),maxpos[layer][1]); + } else { + minpos[layer][0] = std::min((float)position.x(), minpos[layer][0]); + minpos[layer][1] = std::min((float)position.y(), minpos[layer][1]); + maxpos[layer][0] = std::max((float)position.x(), maxpos[layer][0]); + maxpos[layer][1] = std::max((float)position.y(), maxpos[layer][1]); } } // end loop hits - } -// Create a vector of Hexels associated to one cluster from a collection of HGCalRecHits - this can be used -// directly to make the final cluster list - this method can be invoked multiple times for the same event -// with different input (reset should be called between events) -void HGCalImagingAlgo::makeClusters() -{ - - // used for speedy search - std::vector hit_kdtree(2*(maxlayer+1)); - - //assign all hits in each layer to a cluster core or halo - for (unsigned int i = 0; i <= 2*maxlayer+1; ++i) { - KDTreeBox bounds(minpos[i][0],maxpos[i][0], - minpos[i][1],maxpos[i][1]); - - hit_kdtree[i].build(points[i],bounds); - - unsigned int actualLayer = i > maxlayer ? (i-(maxlayer+1)) : i; // maps back from index used for KD trees to actual layer - - double maxdensity = calculateLocalDensity(points[i],hit_kdtree[i], actualLayer); // also stores rho (energy density) for each point (node) - // calculate distance to nearest point with higher density storing distance (delta) and point's index - calculateDistanceToHigher(points[i]); - findAndAssignClusters(points[i],hit_kdtree[i],maxdensity,bounds,actualLayer); - } - //make the cluster vector +// Create a vector of Hexels associated to one cluster from a collection of +// HGCalRecHits - this can be used directly to make the final cluster list - +// this method can be invoked multiple times for the same event with different +// input (reset should be called between events) +void HGCalImagingAlgo::makeClusters() { + layerClustersPerLayer.resize(2 * maxlayer + 2); + // assign all hits in each layer to a cluster core or halo + tbb::this_task_arena::isolate([&] { + tbb::parallel_for(size_t(0), size_t(2 * maxlayer + 2), [&](size_t i) { + KDTreeBox bounds(minpos[i][0], maxpos[i][0], minpos[i][1], maxpos[i][1]); + KDTree hit_kdtree; + hit_kdtree.build(points[i], bounds); + + unsigned int actualLayer = + i > maxlayer + ? (i - (maxlayer + 1)) + : i; // maps back from index used for KD trees to actual layer + + double maxdensity = calculateLocalDensity( + points[i], hit_kdtree, actualLayer); // also stores rho (energy + // density) for each point (node) + // calculate distance to nearest point with higher density storing + // distance (delta) and point's index + calculateDistanceToHigher(points[i]); + findAndAssignClusters(points[i], hit_kdtree, maxdensity, bounds, + actualLayer, layerClustersPerLayer[i]); + }); + }); } -std::vector HGCalImagingAlgo::getClusters(bool doSharing){ +std::vector HGCalImagingAlgo::getClusters(bool doSharing) { reco::CaloID caloID = reco::CaloID::DET_HGCAL_ENDCAP; - std::vector< std::pair > thisCluster; - for (unsigned int i = 0; i < current_v.size(); ++i){ - double energy = 0; - Point position; - - if( doSharing ) { - - std::vector seeds = findLocalMaximaInCluster(current_v[i]); - // sharing found seeds.size() sub-cluster seeds in cluster i - - std::vector > fractions; - // first pass can have noise it in - shareEnergy(current_v[i],seeds,fractions); - - // reset and run second pass after vetoing seeds - // that result in trivial clusters (less than 2 effective cells) - - - for( unsigned isub = 0; isub < fractions.size(); ++isub ) { - double effective_hits = 0.0; - double energy = calculateEnergyWithFraction(current_v[i],fractions[isub]); - Point position = calculatePositionWithFraction(current_v[i],fractions[isub]); - - for( unsigned ihit = 0; ihit < fractions[isub].size(); ++ihit ) { - const double fraction = fractions[isub][ihit]; - if( fraction > 1e-7 ) { - effective_hits += fraction; - thisCluster.emplace_back(current_v[i][ihit].data.detid,fraction); - } - } - - if (verbosity < pINFO) - { - std::cout << "\t******** NEW CLUSTER (SHARING) ********" << std::endl; - std::cout << "\tEff. No. of cells = " << effective_hits << std::endl; - std::cout << "\t Energy = " << energy << std::endl; - std::cout << "\t Phi = " << position.phi() << std::endl; - std::cout << "\t Eta = " << position.eta() << std::endl; - std::cout << "\t*****************************" << std::endl; - } - clusters_v.push_back(reco::BasicCluster(energy, position, caloID, thisCluster, - algoId)); - thisCluster.clear(); + std::vector> thisCluster; + for (auto &clsOnLayer : layerClustersPerLayer) { + for (unsigned int i = 0; i < clsOnLayer.size(); ++i) { + double energy = 0; + Point position; + + if (doSharing) { + + std::vector seeds = findLocalMaximaInCluster(clsOnLayer[i]); + // sharing found seeds.size() sub-cluster seeds in cluster i + + std::vector> fractions; + // first pass can have noise it in + shareEnergy(clsOnLayer[i], seeds, fractions); + + // reset and run second pass after vetoing seeds + // that result in trivial clusters (less than 2 effective cells) + + for (unsigned isub = 0; isub < fractions.size(); ++isub) { + double effective_hits = 0.0; + double energy = + calculateEnergyWithFraction(clsOnLayer[i], fractions[isub]); + Point position = + calculatePositionWithFraction(clsOnLayer[i], fractions[isub]); + + for (unsigned ihit = 0; ihit < fractions[isub].size(); ++ihit) { + const double fraction = fractions[isub][ihit]; + if (fraction > 1e-7) { + effective_hits += fraction; + thisCluster.emplace_back(clsOnLayer[i][ihit].data.detid, + fraction); + } + } + + if (verbosity < pINFO) { + std::cout << "\t******** NEW CLUSTER (SHARING) ********" + << std::endl; + std::cout << "\tEff. No. of cells = " << effective_hits + << std::endl; + std::cout << "\t Energy = " << energy << std::endl; + std::cout << "\t Phi = " << position.phi() + << std::endl; + std::cout << "\t Eta = " << position.eta() + << std::endl; + std::cout << "\t*****************************" << std::endl; + } + clusters_v.emplace_back(energy, position, caloID, thisCluster, + algoId); + thisCluster.clear(); + } + } else { + position = calculatePosition(clsOnLayer[i]); // energy-weighted position + // std::vector< KDNode >::iterator it; + for (auto &it : clsOnLayer[i]) { + energy += it.data.isHalo ? 0. : it.data.weight; + // use fraction to store whether this is a Halo hit or not + thisCluster.emplace_back(it.data.detid, (it.data.isHalo ? 0.f : 1.f)); + } + if (verbosity < pINFO) { + std::cout << "******** NEW CLUSTER (HGCIA) ********" << std::endl; + std::cout << "Index " << i << std::endl; + std::cout << "No. of cells = " << clsOnLayer[i].size() << std::endl; + std::cout << " Energy = " << energy << std::endl; + std::cout << " Phi = " << position.phi() << std::endl; + std::cout << " Eta = " << position.eta() << std::endl; + std::cout << "*****************************" << std::endl; + } + clusters_v.emplace_back(energy, position, caloID, thisCluster, algoId); + thisCluster.clear(); } - }else{ - position = calculatePosition(current_v[i]); // energy-weighted position - // std::vector< KDNode >::iterator it; - for (auto& it: current_v[i]) - { - energy += it.data.isHalo ? 0. : it.data.weight; - // use fraction to store whether this is a Halo hit or not - thisCluster.emplace_back(std::pair(it.data.detid,(it.data.isHalo?0.:1.))); - }; - if (verbosity < pINFO) - { - std::cout << "******** NEW CLUSTER (HGCIA) ********" << std::endl; - std::cout << "Index " << i << std::endl; - std::cout << "No. of cells = " << current_v[i].size() << std::endl; - std::cout << " Energy = " << energy << std::endl; - std::cout << " Phi = " << position.phi() << std::endl; - std::cout << " Eta = " << position.eta() << std::endl; - std::cout << "*****************************" << std::endl; - } - clusters_v.push_back(reco::BasicCluster(energy, position, caloID, thisCluster, - algoId)); - thisCluster.clear(); } } return clusters_v; } -math::XYZPoint HGCalImagingAlgo::calculatePosition(std::vector &v){ - float total_weight = 0.; - float x = 0.; - float y = 0.; - float z = 0.; +math::XYZPoint +HGCalImagingAlgo::calculatePosition(std::vector &v) const { + float total_weight = 0.f; + float x = 0.f; + float y = 0.f; + float z = 0.f; unsigned int v_size = v.size(); unsigned int maxEnergyIndex = 0; float maxEnergyValue = 0; @@ -176,15 +201,14 @@ math::XYZPoint HGCalImagingAlgo::calculatePosition(std::vector &v){ // loop over hits in cluster candidate building up weight for // energy-weighted position calculation and determining the maximum // energy hit in case this is a halo-only cluster - for (unsigned int i = 0; i < v_size; i++){ - if(!v[i].data.isHalo){ + for (unsigned int i = 0; i < v_size; i++) { + if (!v[i].data.isHalo) { haloOnlyCluster = false; total_weight += v[i].data.weight; - x += v[i].data.x*v[i].data.weight; - y += v[i].data.y*v[i].data.weight; - z += v[i].data.z*v[i].data.weight; - } - else { + x += v[i].data.x * v[i].data.weight; + y += v[i].data.y * v[i].data.weight; + z += v[i].data.z * v[i].data.weight; + } else { if (v[i].data.weight > maxEnergyValue) { maxEnergyValue = v[i].data.weight; maxEnergyIndex = i; @@ -194,63 +218,68 @@ math::XYZPoint HGCalImagingAlgo::calculatePosition(std::vector &v){ if (!haloOnlyCluster) { if (total_weight != 0) { - return math::XYZPoint( x/total_weight, - y/total_weight, - z/total_weight ); + auto inv_tot_weight = 1. / total_weight; + return math::XYZPoint(x * inv_tot_weight, y * inv_tot_weight, + z * inv_tot_weight); } - } - else if (v_size > 0) { + } else if (v_size > 0) { // return position of hit with maximum energy - return math::XYZPoint(v[maxEnergyIndex].data.x, v[maxEnergyIndex].data.y, v[maxEnergyIndex].data.z); + return math::XYZPoint(v[maxEnergyIndex].data.x, v[maxEnergyIndex].data.y, + v[maxEnergyIndex].data.z); } return math::XYZPoint(0, 0, 0); } -double HGCalImagingAlgo::calculateLocalDensity(std::vector &nd, KDTree &lp, const unsigned int layer){ +double HGCalImagingAlgo::calculateLocalDensity(std::vector &nd, + KDTree &lp, + const unsigned int layer) const { double maxdensity = 0.; - float delta_c; // maximum search distance (critical distance) for local density calculation - if( layer<= lastLayerEE ) delta_c = vecDeltas[0]; - else if( layer <= lastLayerFH) delta_c = vecDeltas[1]; - else delta_c = vecDeltas[2]; + float delta_c; // maximum search distance (critical distance) for local + // density calculation + if (layer <= lastLayerEE) + delta_c = vecDeltas[0]; + else if (layer <= lastLayerFH) + delta_c = vecDeltas[1]; + else + delta_c = vecDeltas[2]; // for each node calculate local density rho and store it - for(unsigned int i = 0; i < nd.size(); ++i){ + for (unsigned int i = 0; i < nd.size(); ++i) { // speec up search by looking within +/- delta_c window only - KDTreeBox search_box(nd[i].dims[0]-delta_c,nd[i].dims[0]+delta_c, - nd[i].dims[1]-delta_c,nd[i].dims[1]+delta_c); + KDTreeBox search_box(nd[i].dims[0] - delta_c, nd[i].dims[0] + delta_c, + nd[i].dims[1] - delta_c, nd[i].dims[1] + delta_c); std::vector found; - lp.search(search_box,found); + lp.search(search_box, found); const unsigned int found_size = found.size(); - for(unsigned int j = 0; j < found_size; j++){ - if(distance(nd[i].data,found[j].data) < delta_c){ - nd[i].data.rho += found[j].data.weight; - if(nd[i].data.rho > maxdensity) maxdensity = nd[i].data.rho; + for (unsigned int j = 0; j < found_size; j++) { + if (distance(nd[i].data, found[j].data) < delta_c) { + nd[i].data.rho += found[j].data.weight; + maxdensity = std::max(maxdensity, nd[i].data.rho); } } // end loop found - } // end loop nodes + } // end loop nodes return maxdensity; } -double HGCalImagingAlgo::calculateDistanceToHigher(std::vector &nd){ - +double +HGCalImagingAlgo::calculateDistanceToHigher(std::vector &nd) const { - //sort vector of Hexels by decreasing local density + // sort vector of Hexels by decreasing local density std::vector rs = sorted_indices(nd); double maxdensity = 0.0; int nearestHigher = -1; - - if(!rs.empty()) + if (!rs.empty()) maxdensity = nd[rs[0]].data.rho; else return maxdensity; // there are no hits double dist2 = 0.; - //start by setting delta for the highest density hit to - //the most distant hit - this is a convention + // start by setting delta for the highest density hit to + // the most distant hit - this is a convention - for (auto& j: nd) { + for (auto &j : nd) { double tmp = distance2(nd[rs[0]].data, j.data); if (tmp > dist2) dist2 = tmp; @@ -258,174 +287,196 @@ double HGCalImagingAlgo::calculateDistanceToHigher(std::vector &nd){ nd[rs[0]].data.delta = std::sqrt(dist2); nd[rs[0]].data.nearestHigher = nearestHigher; - //now we save the largest distance as a starting point + // now we save the largest distance as a starting point const double max_dist2 = dist2; const unsigned int nd_size = nd.size(); - for(unsigned int oi = 1; oi < nd_size; ++oi){ // start from second-highest density + for (unsigned int oi = 1; oi < nd_size; + ++oi) { // start from second-highest density dist2 = max_dist2; unsigned int i = rs[oi]; // we only need to check up to oi since hits // are ordered by decreasing density // and all points coming BEFORE oi are guaranteed to have higher rho // and the ones AFTER to have lower rho - for(unsigned int oj = 0; oj < oi; ++oj){ + for (unsigned int oj = 0; oj < oi; ++oj) { unsigned int j = rs[oj]; double tmp = distance2(nd[i].data, nd[j].data); - if(tmp <= dist2){ //this "<=" instead of "<" addresses the (rare) case when there are only two hits - dist2 = tmp; - nearestHigher = j; + if (tmp <= dist2) { // this "<=" instead of "<" addresses the (rare) case + // when there are only two hits + dist2 = tmp; + nearestHigher = j; } } nd[i].data.delta = std::sqrt(dist2); - nd[i].data.nearestHigher = nearestHigher; //this uses the original unsorted hitlist + nd[i].data.nearestHigher = + nearestHigher; // this uses the original unsorted hitlist } return maxdensity; } +int HGCalImagingAlgo::findAndAssignClusters( + std::vector &nd, KDTree &lp, double maxdensity, KDTreeBox &bounds, + const unsigned int layer, + std::vector> &clustersOnLayer) const { -int HGCalImagingAlgo::findAndAssignClusters(std::vector &nd,KDTree &lp, double maxdensity, KDTreeBox &bounds, const unsigned int layer){ - - //this is called once per layer and endcap... - //so when filling the cluster temporary vector of Hexels we resize each time by the number - //of clusters found. This is always equal to the number of cluster centers... + // this is called once per layer and endcap... + // so when filling the cluster temporary vector of Hexels we resize each time + // by the number of clusters found. This is always equal to the number of + // cluster centers... - unsigned int clusterIndex = 0; + unsigned int nClustersOnLayer = 0; float delta_c; // critical distance - if( layer<=lastLayerEE ) delta_c = vecDeltas[0]; - else if( layer<=lastLayerFH ) delta_c = vecDeltas[1]; - else delta_c = vecDeltas[2]; + if (layer <= lastLayerEE) + delta_c = vecDeltas[0]; + else if (layer <= lastLayerFH) + delta_c = vecDeltas[1]; + else + delta_c = vecDeltas[2]; - std::vector rs = sorted_indices(nd); // indices sorted by decreasing rho - std::vector ds = sort_by_delta(nd); // sort in decreasing distance to higher + std::vector rs = + sorted_indices(nd); // indices sorted by decreasing rho + std::vector ds = + sort_by_delta(nd); // sort in decreasing distance to higher const unsigned int nd_size = nd.size(); - for(unsigned int i=0; i < nd_size; ++i){ + for (unsigned int i = 0; i < nd_size; ++i) { - if(nd[ds[i]].data.delta < delta_c) break; // no more cluster centers to be looked at - if(dependSensor){ + if (nd[ds[i]].data.delta < delta_c) + break; // no more cluster centers to be looked at + if (dependSensor) { - float rho_c = kappa*nd[ds[i]].data.sigmaNoise; - if(nd[ds[i]].data.rho < rho_c ) continue; // set equal to kappa times noise threshold + float rho_c = kappa * nd[ds[i]].data.sigmaNoise; + if (nd[ds[i]].data.rho < rho_c) + continue; // set equal to kappa times noise threshold - } - else if(nd[ds[i]].data.rho*kappa < maxdensity) + } else if (nd[ds[i]].data.rho * kappa < maxdensity) continue; - - nd[ds[i]].data.clusterIndex = clusterIndex; - if (verbosity < pINFO) - { - std::cout << "Adding new cluster with index " << clusterIndex+cluster_offset << std::endl; - std::cout << "Cluster center is hit " << ds[i] << std::endl; - } - clusterIndex++; + nd[ds[i]].data.clusterIndex = nClustersOnLayer; + if (verbosity < pINFO) { + std::cout << "Adding new cluster with index " << nClustersOnLayer + << std::endl; + std::cout << "Cluster center is hit " << ds[i] << std::endl; + } + nClustersOnLayer++; } - //at this point clusterIndex is equal to the number of cluster centers - if it is zero we are - //done - if(clusterIndex==0) return clusterIndex; + // at this point nClustersOnLayer is equal to the number of cluster centers - + // if it is zero we are done + if (nClustersOnLayer == 0) + return nClustersOnLayer; - //assign remaining points to clusters, using the nearestHigher set from previous step (always set except + // assign remaining points to clusters, using the nearestHigher set from + // previous step (always set except // for top density hit that is skipped...) - for(unsigned int oi =1; oi < nd_size; ++oi){ + for (unsigned int oi = 1; oi < nd_size; ++oi) { unsigned int i = rs[oi]; int ci = nd[i].data.clusterIndex; - if(ci == -1){ // clusterIndex is initialised with -1 if not yet used in cluster - nd[i].data.clusterIndex = nd[nd[i].data.nearestHigher].data.clusterIndex; + if (ci == + -1) { // clusterIndex is initialised with -1 if not yet used in cluster + nd[i].data.clusterIndex = nd[nd[i].data.nearestHigher].data.clusterIndex; } } - //make room in the temporary cluster vector for the additional clusterIndex clusters + // make room in the temporary cluster vector for the additional clusterIndex + // clusters // from this layer - if (verbosity < pINFO) - { - std::cout << "resizing cluster vector by "<< clusterIndex << std::endl; - } - current_v.resize(cluster_offset+clusterIndex); + if (verbosity < pINFO) { + std::cout << "resizing cluster vector by " << nClustersOnLayer << std::endl; + } + clustersOnLayer.resize(nClustersOnLayer); - //assign points closer than dc to other clusters to border region - //and find critical border density - std::vector rho_b(clusterIndex,0.); + // assign points closer than dc to other clusters to border region + // and find critical border density + std::vector rho_b(nClustersOnLayer, 0.); lp.clear(); - lp.build(nd,bounds); - //now loop on all hits again :( and check: if there are hits from another cluster within d_c -> flag as border hit - for(unsigned int i = 0; i < nd_size; ++i){ + lp.build(nd, bounds); + // now loop on all hits again :( and check: if there are hits from another + // cluster within d_c -> flag as border hit + for (unsigned int i = 0; i < nd_size; ++i) { int ci = nd[i].data.clusterIndex; bool flag_isolated = true; - if(ci != -1){ - KDTreeBox search_box(nd[i].dims[0]-delta_c,nd[i].dims[0]+delta_c, - nd[i].dims[1]-delta_c,nd[i].dims[1]+delta_c); + if (ci != -1) { + KDTreeBox search_box(nd[i].dims[0] - delta_c, nd[i].dims[0] + delta_c, + nd[i].dims[1] - delta_c, nd[i].dims[1] + delta_c); std::vector found; - lp.search(search_box,found); + lp.search(search_box, found); const unsigned int found_size = found.size(); - for(unsigned int j = 0; j < found_size; j++){ // start from 0 here instead of 1 - //check if the hit is not within d_c of another cluster - if(found[j].data.clusterIndex!=-1){ - float dist = distance(found[j].data,nd[i].data); - if(dist < delta_c && found[j].data.clusterIndex!=ci){ - //in which case we assign it to the border - nd[i].data.isBorder = true; - break; - } - //because we are using two different containers, we have to make sure that we don't unflag the - // hit when it finds *itself* closer than delta_c - if(dist < delta_c && dist != 0. && found[j].data.clusterIndex==ci){ - // in this case it is not an isolated hit - // the dist!=0 is because the hit being looked at is also inside the search box and at dist==0 - flag_isolated = false; - } - } + for (unsigned int j = 0; j < found_size; + j++) { // start from 0 here instead of 1 + // check if the hit is not within d_c of another cluster + if (found[j].data.clusterIndex != -1) { + float dist = distance(found[j].data, nd[i].data); + if (dist < delta_c && found[j].data.clusterIndex != ci) { + // in which case we assign it to the border + nd[i].data.isBorder = true; + break; + } + // because we are using two different containers, we have to make sure + // that we don't unflag the + // hit when it finds *itself* closer than delta_c + if (dist < delta_c && dist != 0. && + found[j].data.clusterIndex == ci) { + // in this case it is not an isolated hit + // the dist!=0 is because the hit being looked at is also inside the + // search box and at dist==0 + flag_isolated = false; + } + } } - if(flag_isolated) nd[i].data.isBorder = true; //the hit is more than delta_c from any of its brethren + if (flag_isolated) + nd[i].data.isBorder = + true; // the hit is more than delta_c from any of its brethren } - //check if this border hit has density larger than the current rho_b and update - if(nd[i].data.isBorder && rho_b[ci] < nd[i].data.rho) + // check if this border hit has density larger than the current rho_b and + // update + if (nd[i].data.isBorder && rho_b[ci] < nd[i].data.rho) rho_b[ci] = nd[i].data.rho; } // end loop all hits - //flag points in cluster with density < rho_b as halo points, then fill the cluster vector - for(unsigned int i = 0; i < nd_size; ++i){ + // flag points in cluster with density < rho_b as halo points, then fill the + // cluster vector + for (unsigned int i = 0; i < nd_size; ++i) { int ci = nd[i].data.clusterIndex; - if(ci!=-1) { - if (nd[i].data.rho <= rho_b[ci]) nd[i].data.isHalo = true; - current_v[ci+cluster_offset].push_back(nd[i]); - if (verbosity < pINFO) - { - std::cout << "Pushing hit " << i << " into cluster with index " << ci+cluster_offset << std::endl; - std::cout << "Size now " << current_v[ci+cluster_offset].size() << std::endl; - } + if (ci != -1) { + if (nd[i].data.rho <= rho_b[ci]) + nd[i].data.isHalo = true; + clustersOnLayer[ci].push_back(nd[i]); + if (verbosity < pINFO) { + std::cout << "Pushing hit " << i << " into cluster with index " << ci + << std::endl; + } } } - //prepare the offset for the next layer if there is one - if (verbosity < pINFO) - { - std::cout << "moving cluster offset by " << clusterIndex << std::endl; - } - cluster_offset += clusterIndex; - return clusterIndex; + // prepare the offset for the next layer if there is one + if (verbosity < pINFO) { + std::cout << "moving cluster offset by " << nClustersOnLayer << std::endl; + } + return nClustersOnLayer; } // find local maxima within delta_c, marking the indices in the cluster -std::vector HGCalImagingAlgo::findLocalMaximaInCluster(const std::vector& cluster) { +std::vector +HGCalImagingAlgo::findLocalMaximaInCluster(const std::vector &cluster) { std::vector result; - std::vector seed(cluster.size(),true); + std::vector seed(cluster.size(), true); float delta_c = 2.; - for( unsigned i = 0; i < cluster.size(); ++i ) { - for( unsigned j = 0; j < cluster.size(); ++j ) { - if( distance(cluster[i].data,cluster[j].data) < delta_c && i != j) { - if( cluster[i].data.weight < cluster[j].data.weight ) { - seed[i] = false; - break; - } + for (unsigned i = 0; i < cluster.size(); ++i) { + for (unsigned j = 0; j < cluster.size(); ++j) { + if (i != j and distance(cluster[i].data, cluster[j].data) < delta_c) { + if (cluster[i].data.weight < cluster[j].data.weight) { + seed[i] = false; + break; + } } } } - for( unsigned i = 0 ; i < cluster.size(); ++i ) { - if( seed[i] && cluster[i].data.weight > 5e-4) { + for (unsigned i = 0; i < cluster.size(); ++i) { + if (seed[i] && cluster[i].data.weight > 5e-4) { // seed at i with energy cluster[i].weight result.push_back(i); } @@ -436,50 +487,49 @@ std::vector HGCalImagingAlgo::findLocalMaximaInCluster(const std::vect return result; } -math::XYZPoint HGCalImagingAlgo::calculatePositionWithFraction(const std::vector& hits, - const std::vector& fractions) { +math::XYZPoint HGCalImagingAlgo::calculatePositionWithFraction( + const std::vector &hits, const std::vector &fractions) { double norm(0.0), x(0.0), y(0.0), z(0.0); - for( unsigned i = 0; i < hits.size(); ++i ) { - const double weight = fractions[i]*hits[i].data.weight; + for (unsigned i = 0; i < hits.size(); ++i) { + const double weight = fractions[i] * hits[i].data.weight; norm += weight; - x += weight*hits[i].data.x; - y += weight*hits[i].data.y; - z += weight*hits[i].data.z; + x += weight * hits[i].data.x; + y += weight * hits[i].data.y; + z += weight * hits[i].data.z; } - math::XYZPoint result(x,y,z); - double norm_inv = 1.0/norm; - result *= norm_inv; + math::XYZPoint result(x, y, z); + result /= norm; return result; } -double HGCalImagingAlgo::calculateEnergyWithFraction(const std::vector& hits, - const std::vector& fractions) { +double HGCalImagingAlgo::calculateEnergyWithFraction( + const std::vector &hits, const std::vector &fractions) { double result = 0.0; - for( unsigned i = 0 ; i < hits.size(); ++i ) { - result += fractions[i]*hits[i].data.weight; + for (unsigned i = 0; i < hits.size(); ++i) { + result += fractions[i] * hits[i].data.weight; } return result; } -void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, - const std::vector& seeds, - std::vector >& outclusters) { - std::vector isaseed(incluster.size(),false); +void HGCalImagingAlgo::shareEnergy( + const std::vector &incluster, const std::vector &seeds, + std::vector> &outclusters) { + std::vector isaseed(incluster.size(), false); outclusters.clear(); outclusters.resize(seeds.size()); std::vector centroids(seeds.size()); std::vector energies(seeds.size()); - if( seeds.size() == 1 ) { // short circuit the case of a lone cluster + if (seeds.size() == 1) { // short circuit the case of a lone cluster outclusters[0].clear(); - outclusters[0].resize(incluster.size(),1.0); + outclusters[0].resize(incluster.size(), 1.0); return; } // saving seeds // create quick seed lookup - for( unsigned i = 0; i < seeds.size(); ++i ) { + for (unsigned i = 0; i < seeds.size(); ++i) { isaseed[seeds[i]] = true; } @@ -487,122 +537,135 @@ void HGCalImagingAlgo::shareEnergy(const std::vector& incluster, // centroids start off at seed positions // seeds always have fraction 1.0, to stabilize fit // initializing fit - for( unsigned i = 0; i < seeds.size(); ++i ) { - outclusters[i].resize(incluster.size(),0.0); - for( unsigned j = 0; j < incluster.size(); ++j ) { - if( j == seeds[i] ) { - outclusters[i][j] = 1.0; - centroids[i] = math::XYZPoint(incluster[j].data.x,incluster[j].data.y,incluster[j].data.z); - energies[i] = incluster[j].data.weight; + for (unsigned i = 0; i < seeds.size(); ++i) { + outclusters[i].resize(incluster.size(), 0.0); + for (unsigned j = 0; j < incluster.size(); ++j) { + if (j == seeds[i]) { + outclusters[i][j] = 1.0; + centroids[i] = math::XYZPoint(incluster[j].data.x, incluster[j].data.y, + incluster[j].data.z); + energies[i] = incluster[j].data.weight; } } } - // run the fit while we are less than max iterations, and clusters are still moving + // run the fit while we are less than max iterations, and clusters are still + // moving const double minFracTot = 1e-20; unsigned iter = 0; const unsigned iterMax = 50; double diff = std::numeric_limits::max(); const double stoppingTolerance = 1e-8; - const double toleranceScaling = std::pow(std::max(1.0,seeds.size()-1.0),2.0); + const auto numberOfSeeds = seeds.size(); + auto toleranceScaling = + numberOfSeeds > 2 ? (numberOfSeeds - 1) * (numberOfSeeds - 1) : 1; std::vector prevCentroids; - std::vector frac(seeds.size()), dist2(seeds.size()); - while( iter++ < iterMax && diff > stoppingTolerance*toleranceScaling ) { - for( unsigned i = 0; i < incluster.size(); ++i ) { - const Hexel& ihit = incluster[i].data; + std::vector frac(numberOfSeeds), dist2(numberOfSeeds); + while (iter++ < iterMax && diff > stoppingTolerance * toleranceScaling) { + for (unsigned i = 0; i < incluster.size(); ++i) { + const Hexel &ihit = incluster[i].data; double fracTot(0.0); - for( unsigned j = 0; j < seeds.size(); ++j ) { - double fraction = 0.0; - double d2 = ( std::pow(ihit.x - centroids[j].x(),2.0) + - std::pow(ihit.y - centroids[j].y(),2.0) + - std::pow(ihit.z - centroids[j].z(),2.0) )/sigma2; - dist2[j] = d2; - // now we set the fractions up based on hit type - if( i == seeds[j] ) { // this cluster's seed - fraction = 1.0; - } else if( isaseed[i] ) { - fraction = 0.0; - } else { - fraction = energies[j]*std::exp( -0.5*d2 ); - } - fracTot += fraction; - frac[j] = fraction; + for (unsigned j = 0; j < numberOfSeeds; ++j) { + double fraction = 0.0; + double d2 = (std::pow(ihit.x - centroids[j].x(), 2.0) + + std::pow(ihit.y - centroids[j].y(), 2.0) + + std::pow(ihit.z - centroids[j].z(), 2.0)) / + sigma2; + dist2[j] = d2; + // now we set the fractions up based on hit type + if (i == seeds[j]) { // this cluster's seed + fraction = 1.0; + } else if (isaseed[i]) { + fraction = 0.0; + } else { + fraction = energies[j] * std::exp(-0.5 * d2); + } + fracTot += fraction; + frac[j] = fraction; } // now that we have calculated all fractions for all hits // assign the new fractions - for( unsigned j = 0; j < seeds.size(); ++j ) { - if( fracTot > minFracTot || - ( i == seeds[j] && fracTot > 0.0 ) ) { - outclusters[j][i] = frac[j]/fracTot; - } else { - outclusters[j][i] = 0.0; - } + for (unsigned j = 0; j < numberOfSeeds; ++j) { + if (fracTot > minFracTot || (i == seeds[j] && fracTot > 0.0)) { + outclusters[j][i] = frac[j] / fracTot; + } else { + outclusters[j][i] = 0.0; + } } } // save previous centroids prevCentroids = std::move(centroids); // finally update the position of the centroids from the last iteration - centroids.resize(seeds.size()); + centroids.resize(numberOfSeeds); double diff2 = 0.0; - for( unsigned i = 0; i < seeds.size(); ++i ) { - centroids[i] = calculatePositionWithFraction(incluster,outclusters[i]); - energies[i] = calculateEnergyWithFraction(incluster,outclusters[i]); + for (unsigned i = 0; i < numberOfSeeds; ++i) { + centroids[i] = calculatePositionWithFraction(incluster, outclusters[i]); + energies[i] = calculateEnergyWithFraction(incluster, outclusters[i]); // calculate convergence parameters - const double delta2 = (prevCentroids[i]-centroids[i]).perp2(); - if( delta2 > diff2 ) diff2 = delta2; + const double delta2 = (prevCentroids[i] - centroids[i]).perp2(); + diff2 = std::max(delta2, diff2); } - //update convergance parameter outside loop + // update convergance parameter outside loop diff = std::sqrt(diff2); } } void HGCalImagingAlgo::computeThreshold() { - if(initialized) return; // only need to calculate thresholds once - const std::vector& listee(rhtools_.getGeometry()->getValidDetIds(DetId::Forward,ForwardSubdetector::HGCEE)); - const std::vector& listfh(rhtools_.getGeometry()->getValidDetIds(DetId::Forward,ForwardSubdetector::HGCHEF)); + if (initialized) + return; // only need to calculate thresholds once + const std::vector &listee(rhtools_.getGeometry()->getValidDetIds( + DetId::Forward, ForwardSubdetector::HGCEE)); + const std::vector &listfh(rhtools_.getGeometry()->getValidDetIds( + DetId::Forward, ForwardSubdetector::HGCHEF)); std::vector dummy; dummy.resize(maxNumberOfWafersPerLayer, 0); thresholds.resize(maxlayer, dummy); v_sigmaNoise.resize(maxlayer, dummy); - int previouswafer=-999; - - for(unsigned icalo=0;icalo<2;++icalo) - { - const std::vector& listDetId( icalo==0 ? listee : listfh); - - for(auto& detid: listDetId) - { - int wafer = rhtools_.getWafer(detid); - if(wafer==previouswafer) continue; - previouswafer = wafer; - // no need to do it twice - if(rhtools_.zside(detid)<0) continue; - int layer = rhtools_.getLayerWithOffset(detid); - float thickness = rhtools_.getSiThickness(detid); - int thickIndex = -1; - if( thickness>99. && thickness<101.) thickIndex=0; - else if( thickness>199. && thickness<201. ) thickIndex=1; - else if( thickness>299. && thickness<301. ) thickIndex=2; - else assert( thickIndex>0 && "ERROR - silicon thickness has a nonsensical value" ); - float sigmaNoise = 0.001 * fcPerEle * nonAgedNoises[thickIndex] * dEdXweights[layer] / (fcPerMip[thickIndex] * thicknessCorrection[thickIndex]); - thresholds[layer-1][wafer]=sigmaNoise*ecut; - v_sigmaNoise[layer-1][wafer] = sigmaNoise; - } + int previouswafer = -999; + + for (unsigned icalo = 0; icalo < 2; ++icalo) { + const std::vector &listDetId(icalo == 0 ? listee : listfh); + + for (auto &detid : listDetId) { + int wafer = rhtools_.getWafer(detid); + if (wafer == previouswafer) + continue; + previouswafer = wafer; + // no need to do it twice + if (rhtools_.zside(detid) < 0) + continue; + int layer = rhtools_.getLayerWithOffset(detid); + float thickness = rhtools_.getSiThickness(detid); + int thickIndex = -1; + if (thickness > 99. && thickness < 101.) + thickIndex = 0; + else if (thickness > 199. && thickness < 201.) + thickIndex = 1; + else if (thickness > 299. && thickness < 301.) + thickIndex = 2; + else + assert(thickIndex > 0 && + "ERROR - silicon thickness has a nonsensical value"); + float sigmaNoise = + 0.001f * fcPerEle * nonAgedNoises[thickIndex] * dEdXweights[layer] / + (fcPerMip[thickIndex] * thicknessCorrection[thickIndex]); + thresholds[layer - 1][wafer] = sigmaNoise * ecut; + v_sigmaNoise[layer - 1][wafer] = sigmaNoise; } + } // now BH, much faster - for ( unsigned ilayer=lastLayerFH+1;ilayer<=maxlayer;++ilayer) - { - float sigmaNoise = 0.001 * noiseMip * dEdXweights[ilayer]; - std::vector bhDummy_thresholds; - std::vector bhDummy_sigmaNoise; - bhDummy_thresholds.push_back(sigmaNoise*ecut); - bhDummy_sigmaNoise.push_back(sigmaNoise); - thresholds[ilayer-1]=bhDummy_thresholds; - v_sigmaNoise[ilayer-1]=bhDummy_sigmaNoise; - } - initialized=true; + for (unsigned ilayer = lastLayerFH + 1; ilayer <= maxlayer; ++ilayer) { + float sigmaNoise = 0.001f * noiseMip * dEdXweights[ilayer]; + std::vector bhDummy_thresholds; + std::vector bhDummy_sigmaNoise; + bhDummy_thresholds.push_back(sigmaNoise * ecut); + bhDummy_sigmaNoise.push_back(sigmaNoise); + thresholds[ilayer - 1] = bhDummy_thresholds; + v_sigmaNoise[ilayer - 1] = bhDummy_sigmaNoise; + } + initialized = true; } diff --git a/RecoLocalCalo/HcalRecProducers/python/HBHEMethod0Parameters_cfi.py b/RecoLocalCalo/HcalRecProducers/python/HBHEMethod0Parameters_cfi.py index a511ccbf8b3e0..15ec32711d81c 100644 --- a/RecoLocalCalo/HcalRecProducers/python/HBHEMethod0Parameters_cfi.py +++ b/RecoLocalCalo/HcalRecProducers/python/HBHEMethod0Parameters_cfi.py @@ -2,7 +2,7 @@ # Configuration parameters for Method 0 m0Parameters = cms.PSet( - firstSample = cms.int32(4), + firstSampleShift = cms.int32(0), samplesToAdd = cms.int32(2), correctForPhaseContainment = cms.bool(True), correctionPhaseNS = cms.double(6.0), diff --git a/RecoLocalCalo/HcalRecProducers/python/HBHEPhase1Reconstructor_cfi.py b/RecoLocalCalo/HcalRecProducers/python/HBHEPhase1Reconstructor_cfi.py index 5ae57e2821206..3f39e462f65af 100644 --- a/RecoLocalCalo/HcalRecProducers/python/HBHEPhase1Reconstructor_cfi.py +++ b/RecoLocalCalo/HcalRecProducers/python/HBHEPhase1Reconstructor_cfi.py @@ -64,9 +64,6 @@ # Time shift (in ns) to add to TDC timing (for QIE11) tdcTimeShift = cms.double(0.0), - # Parameters for "Method 0" - firstSampleShift = cms.int32(0), - # Use "Method 2"? useM2 = cms.bool(False), diff --git a/RecoLocalCalo/HcalRecProducers/src/HBHEPhase1Reconstructor.cc b/RecoLocalCalo/HcalRecProducers/src/HBHEPhase1Reconstructor.cc index db6d39d2c0303..d807dfa42fa07 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HBHEPhase1Reconstructor.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HBHEPhase1Reconstructor.cc @@ -493,6 +493,7 @@ void HBHEPhase1Reconstructor::processData(const Collection& coll, coder.adc2fC(frame, cs); // Prepare to iterate over time slices + const bool saveEffectivePeds = channelInfo->hasEffectivePedestals(); const int nRead = cs.size(); const int maxTS = std::min(nRead, static_cast(HBHEChannelInfo::MAXSAMPLES)); const int soi = tsFromDB_ ? param_ts->firstSample() : frame.presamples(); @@ -508,8 +509,8 @@ void HBHEPhase1Reconstructor::processData(const Collection& coll, const int capid = s.capid(); //optionally store "effective" pedestal (measured with bias voltage on) // = QIE contribution + SiPM contribution (from dark current + crosstalk) - const double pedestal = saveEffectivePedestal_ ? calib.effpedestal(capid) : calib.pedestal(capid); - const double pedestalWidth = saveEffectivePedestal_ ? calibWidth.effpedestal(capid) : calibWidth.pedestal(capid); + const double pedestal = saveEffectivePeds ? calib.effpedestal(capid) : calib.pedestal(capid); + const double pedestalWidth = saveEffectivePeds ? calibWidth.effpedestal(capid) : calibWidth.pedestal(capid); const double gain = calib.respcorrgain(capid); const double gainWidth = calibWidth.gain(capid); //always use QIE-only pedestal for this computation diff --git a/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc b/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc index fff0b8e6d9afe..bc874da0819a3 100644 --- a/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc +++ b/RecoLocalFastTime/FTLRecProducers/plugins/FTLRecHitProducer.cc @@ -72,7 +72,7 @@ FTLRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& es) { barrelRechits->reserve(hBarrel->size()/2); for(const auto& uhit : *hBarrel) { uint32_t flags = FTLRecHit::kGood; - auto rechit = std::move(barrel_->makeRecHit(uhit, flags)); + auto rechit = barrel_->makeRecHit(uhit, flags); if( flags == FTLRecHit::kGood ) barrelRechits->push_back( std::move(rechit) ); } @@ -81,7 +81,7 @@ FTLRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& es) { endcapRechits->reserve(hEndcap->size()/2); for(const auto& uhit : *hEndcap) { uint32_t flags = FTLRecHit::kGood; - auto rechit = std::move(endcap_->makeRecHit(uhit, flags)); + auto rechit = endcap_->makeRecHit(uhit, flags); if( flags == FTLRecHit::kGood ) endcapRechits->push_back( std::move(rechit) ); } diff --git a/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc b/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc index 0ed535888a6e9..d57f204309bc3 100644 --- a/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc +++ b/RecoLocalFastTime/FTLRecProducers/plugins/FTLUncalibratedRecHitProducer.cc @@ -71,14 +71,14 @@ FTLUncalibratedRecHitProducer::produce(edm::Event& evt, const edm::EventSetup& e evt.getByToken( ftlbDigis_, hBarrel ); barrelRechits->reserve(hBarrel->size()/2); for(const auto& digi : *hBarrel) { - barrelRechits->push_back( std::move(barrel_->makeRecHit(digi)) ); + barrelRechits->emplace_back( barrel_->makeRecHit(digi) ); } edm::Handle< FTLDigiCollection > hEndcap; evt.getByToken( ftleDigis_, hEndcap ); endcapRechits->reserve(hEndcap->size()/2); for(const auto& digi : *hEndcap) { - endcapRechits->push_back( std::move(endcap_->makeRecHit(digi)) ); + endcapRechits->emplace_back( endcap_->makeRecHit(digi) ); } // put the collection of recunstructed hits in the event diff --git a/RecoLocalTracker/Records/interface/TkPixelCPERecord.h b/RecoLocalTracker/Records/interface/TkPixelCPERecord.h index 484aeba58e0f8..c3b0ce03a356e 100644 --- a/RecoLocalTracker/Records/interface/TkPixelCPERecord.h +++ b/RecoLocalTracker/Records/interface/TkPixelCPERecord.h @@ -10,11 +10,12 @@ //#include "CondFormats/DataRecord/interface/SiPixelCPEGenericErrorParmRcd.h" #include "CondFormats/DataRecord/interface/SiPixelGenErrorDBObjectRcd.h" #include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" +#include "CalibTracker/Records/interface/SiPixel2DTemplateDBObjectESProducerRcd.h" #include "boost/mpl/vector.hpp" class TkPixelCPERecord: public edm::eventsetup::DependentRecordImplementation > {}; + boost::mpl::vector > {}; #endif diff --git a/RecoLocalTracker/SiPixelClusterizer/test/BuildFile.xml b/RecoLocalTracker/SiPixelClusterizer/test/BuildFile.xml index 59653fefce5e5..3445783781551 100644 --- a/RecoLocalTracker/SiPixelClusterizer/test/BuildFile.xml +++ b/RecoLocalTracker/SiPixelClusterizer/test/BuildFile.xml @@ -1,35 +1,33 @@ - - - - - - - - - - - - - - -# for tracks - - - - -# for lumi - - -# - - + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h index 8058eb5f4d311..e344824630003 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h @@ -113,6 +113,9 @@ class PixelCPEBase : public PixelClusterParameterEstimator // ggiurgiu@jhu.edu (10/18/2008) bool with_track_angle; // filled in computeAnglesFrom.... + // More detailed edge information (for CPE ClusterRepair, and elsewhere...) + int edgeTypeX_ = 0; // 0: not on edge, 1: low end on edge, 2: high end + int edgeTypeY_ = 0; // 0: not on edge, 1: low end on edge, 2: high end }; public: diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepair.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepair.h new file mode 100644 index 0000000000000..ca34531fa17a7 --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepair.h @@ -0,0 +1,116 @@ +#ifndef RecoLocalTracker_SiPixelRecHits_PixelCPEClusterRepair_H +#define RecoLocalTracker_SiPixelRecHits_PixelCPEClusterRepair_H + +#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h" + +// Already in the base class +//#include "Geometry/CommonDetUnit/interface/GeomDetType.h" +//#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" +//#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h" +//#include "Geometry/CommonDetAlgo/interface/MeasurementPoint.h" +//#include "Geometry/CommonDetAlgo/interface/MeasurementError.h" +//#include "Geometry/Surface/interface/GloballyPositioned.h" +//#include "FWCore/ParameterSet/interface/ParameterSet.h" + +// The template header files +// +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h" +#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" + +#include +#include + + +#if 0 +/** \class PixelCPEClusterRepair + * Perform the position and error evaluation of pixel hits using + * the Det angle to estimate the track impact angle + */ +#endif + +class MagneticField; +class PixelCPEClusterRepair : public PixelCPEBase +{ +public: + struct ClusterParamTemplate : ClusterParam + { + ClusterParamTemplate(const SiPixelCluster & cl) : ClusterParam(cl){} + // The result of PixelTemplateReco2D + float templXrec_ ; + float templYrec_ ; + float templSigmaX_ ; + float templSigmaY_ ; + // Add new information produced by SiPixelTemplateReco::PixelTempReco2D &&& + // These can only be accessed if we change silicon pixel data formats and add them to the rechit + float templProbX_ ; + float templProbY_ ; + float templProbQ_; + int templQbin_ ; + int ierr; + + + // 2D fit stuff. + float templProbXY_ ; + bool recommended3D_ ; + int ierr2; + }; + + // PixelCPEClusterRepair( const DetUnit& det ); + PixelCPEClusterRepair(edm::ParameterSet const& conf, const MagneticField *, const TrackerGeometry&, const TrackerTopology&, + const SiPixelLorentzAngle *, const SiPixelTemplateDBObject *, const SiPixel2DTemplateDBObject * ); + + ~PixelCPEClusterRepair() override; + +private: + ClusterParam * createClusterParam(const SiPixelCluster & cl) const override; + + // Calculate local position. (Calls TemplateReco) + LocalPoint localPosition (DetParam const & theDetParam, ClusterParam & theClusterParam) const override; + // Calculate local error. Note: it MUST be called AFTER localPosition() !!! + LocalError localError (DetParam const & theDetParam, ClusterParam & theClusterParam) const override; + + // Helper functions: + + // Call vanilla template reco, then clean-up + void callTempReco2D( DetParam const & theDetParam, + ClusterParamTemplate & theClusterParam, + SiPixelTemplateReco::ClusMatrix & clusterPayload, + int ID, LocalPoint & lp ) const; + + // Call 2D template reco, then clean-up + void callTempReco3D( DetParam const & theDetParam, + ClusterParamTemplate & theClusterParam, + SiPixelTemplateReco2D::ClusMatrix & clusterPayload, + int ID, LocalPoint & lp ) const; + + + // Template storage + std::vector< SiPixelTemplateStore > thePixelTemp_; + std::vector< SiPixelTemplateStore2D > thePixelTemp2D_; + + int speed_ ; + + bool UseClusterSplitter_; + + // Template file management (when not getting the templates from the DB) + int barrelTemplateID_ ; + int forwardTemplateID_ ; + std::string templateDir_ ; + + // Configure 3D reco. + float minProbY_ ; + int maxSizeMismatchInY_ ; + + //bool DoCosmics_; + //bool LoadTemplatesFromDB_; + +}; + +#endif + + + + diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h new file mode 100644 index 0000000000000..7dd87dbcbbc62 --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h @@ -0,0 +1,25 @@ +#ifndef RecoLocaltracker_SiPixelRecHits_PixelCPEClusterRepairESProducer_h +#define RecoLocaltracker_SiPixelRecHits_PixelCPEClusterRepairESProducer_h + +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "RecoLocalTracker/Records/interface/TkPixelCPERecord.h" +#include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h" +#include + +class PixelCPEClusterRepairESProducer: public edm::ESProducer{ + public: + PixelCPEClusterRepairESProducer(const edm::ParameterSet & p); + ~PixelCPEClusterRepairESProducer() override; + std::unique_ptr produce(const TkPixelCPERecord &); + private: + edm::ParameterSet pset_; + bool DoLorentz_; +}; + + +#endif + + + + diff --git a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateReco.h b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateReco.h index 70a412ffb617e..f8b2592064cdc 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateReco.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateReco.h @@ -78,6 +78,11 @@ class PixelCPETemplateReco : public PixelCPEBase int speed_ ; bool UseClusterSplitter_; + + // Template file management (when not getting the templates from the DB) + int barrelTemplateID_ ; + int forwardTemplateID_ ; + std::string templateDir_ ; //bool DoCosmics_; //bool LoadTemplatesFromDB_; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h index bd4f069a26a51..7d01c8b7966db 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelGenError.h @@ -1,12 +1,16 @@ // -// SiPixelGenError.h (v2.00) +// SiPixelGenError.h (v2.20) // // Object to contain Lorentz drift and error information for the Generic Algorithm // // Created by Morris Swartz on 1/10/2014. // // Update for Phase 1 FPix, M.S. 1/15/17 -// +// V2.01 - Allow subdetector ID=5 for FPix R2P2, Fix error message +// V2.10 - Update the variable size [SI_PIXEL_TEMPLATE_USE_BOOST] option so that it works with VI's enhancements +// V2.20 - Add directory path selection to the ascii pushfile method +// V2.21 - Move templateStore to the heap, fix variable name in pushfile() + // Build the template storage structure from several pieces @@ -16,6 +20,7 @@ #include #include +#include "boost/multi_array.hpp" #ifndef SI_PIXEL_TEMPLATE_STANDALONE #include "CondFormats/SiPixelObjects/interface/SiPixelGenErrorDBObject.h" @@ -77,11 +82,19 @@ struct SiPixelGenErrorHeader { //!< template header structure struct SiPixelGenErrorStore { //!< template storage structure SiPixelGenErrorHeader head; +#ifndef SI_PIXEL_TEMPLATE_USE_BOOST float cotbetaY[60]; float cotbetaX[5]; float cotalphaX[29]; SiPixelGenErrorEntry enty[60]; //!< 60 Barrel y templates spanning cluster lengths from 0px to +18px [28 entries for fpix] SiPixelGenErrorEntry entx[5][29]; //!< 29 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 5 slices [3x29 for fpix] +#else + float* cotbetaY; + float* cotbetaX; + float* cotalphaX; + boost::multi_array enty; //!< use 1d entry to store [60] barrel entries or [28] fpix entries + boost::multi_array entx; //!< use 2d entry to store [5][29] barrel entries or [3][29] fpix entries +#endif } ; @@ -104,11 +117,12 @@ class SiPixelGenError { public: SiPixelGenError(const std::vector< SiPixelGenErrorStore > & thePixelTemp) : thePixelTemp_(thePixelTemp) { id_current_ = -1; index_id_ = -1;} //!< Constructor for cases in which template store already exists - static bool pushfile(int filenum, std::vector< SiPixelGenErrorStore > & thePixelTemp_); // load the private store with info from the - // file with the index (int) filenum - +// Load the private store with info from the file with the index (int) filenum from directory dir: +// ${dir}generror_summary_zp${filenum}.out + static bool pushfile(int filenum, std::vector< SiPixelGenErrorStore > & pixelTemp , std::string dir = ""); + #ifndef SI_PIXEL_TEMPLATE_STANDALONE - static bool pushfile(const SiPixelGenErrorDBObject& dbobject, std::vector< SiPixelGenErrorStore > & thePixelTemp_); // load the private store with info from db + static bool pushfile(const SiPixelGenErrorDBObject& dbobject, std::vector< SiPixelGenErrorStore > & pixelTemp); // load the private store with info from db #endif // initialize the binary search information; @@ -119,6 +133,11 @@ class SiPixelGenError { int qbin(int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, bool irradiationCorrections, int& pixmx, float& sigmay, float& deltay, float& sigmax, float& deltax, float& sy1, float& dy1, float& sy2, float& dy2, float& sx1, float& dx1, float& sx2, float& dx2); + +// Overload to provide backward compatibility + + int qbin(int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, float& pixmx, float& sigmay, float& deltay, float& sigmax, float& deltax, + float& sy1, float& dy1, float& sy2, float& dy2, float& sx1, float& dx1, float& sx2, float& dx2); // Overloaded method to provide only the LA parameters int qbin(int id); diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h index dd204c34b0909..bd172853c7c37 100755 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h @@ -1,5 +1,5 @@ // -// SiPixelTemplate.h (v10.13) +// SiPixelTemplate.h (v10.20) // // Add goodness-of-fit info and spare entries to templates, version number in template header, more error checking // Add correction for (Q_F-Q_L)/(Q_F+Q_L) bias @@ -76,6 +76,10 @@ // V10.11 - Allow subdetector ID=5 for FPix R2P2 [allows better internal labeling of templates] // V10.12 - Enforce minimum signal size in pixel charge uncertainty calculation // V10.13 - Update the variable size [SI_PIXEL_TEMPLATE_USE_BOOST] option so that it works with VI's enhancements +// V10.20 - Add directory path selection to the ascii pushfile method +// V10.21 - Address runtime issues in pushfile() for gcc 7.X due to using tempfile as char string + misc. cleanup [Petar] +// V10.22 - Move templateStore to the heap, fix variable name in pushfile() [Petar] + @@ -217,9 +221,9 @@ struct SiPixelTemplateStore { //!< template storage structure SiPixelTemplateEntry entx[5][29]; //!< 29 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 5 slices [3x29 for fpix] void destroy() {}; #else - float* cotbetaY=nullptr; - float* cotbetaX=nullptr; - float* cotalphaX=nullptr; + float* cotbetaY = nullptr; + float* cotbetaX = nullptr; + float* cotalphaX = nullptr; boost::multi_array enty; //!< use 1d entry to store [60] barrel entries or [28] fpix entries boost::multi_array entx; //!< use 2d entry to store [5][29] barrel entries or [3][29] fpix entries void destroy() { // deletes arrays created by pushfile method of SiPixelTemplate @@ -254,11 +258,14 @@ class SiPixelTemplate { public: SiPixelTemplate(const std::vector< SiPixelTemplateStore > & thePixelTemp) : thePixelTemp_(thePixelTemp) { id_current_ = -1; index_id_ = -1; cota_current_ = 0.; cotb_current_ = 0.; } //!< Constructor for cases in which template store already exists - static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > & thePixelTemp_); // load the private store with info from the - // file with the index (int) filenum - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - static bool pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore > & thePixelTemp_); // load the private store with info from db + +// Load the private store with info from the file with the index (int) filenum from directory dir: +// ${dir}template_summary_zp${filenum}.out +#ifdef SI_PIXEL_TEMPLATE_STANDALONE + static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > & pixelTemp , std::string dir = ""); +#else + static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > & pixelTemp , std::string dir = "CalibTracker/SiPixelESProducers/data/"); // *&^%$#@! Different default dir -- remove once FastSim is updated. + static bool pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore > & pixelTemp); // load the private store with info from db #endif // initialize the rest; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h index 18c119f7b90f6..0927a4ad429c8 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h @@ -1,5 +1,5 @@ // -// SiPixelTemplate2D.h (v1.03) +// SiPixelTemplate2D.h (v2.35) // // Full 2-D templates for cluster splitting, simulated cluster reweighting, and improved cluster probability // @@ -7,7 +7,14 @@ // V1.01 - fix qavg_ filling // V1.02 - Add locBz to test if FPix use is out of range // V1.03 - Fix edge checking on final template to increase template size and to properly truncate cluster -// +// v2.00 - Major changes to accommodate 2D reconstruction +// v2.10 - Change chi2 and error scaling information to work with partially reconstructed clusters +// v2.20 - Add cluster charge probability information, side loading for template generation +// v2.21 - Double derivative interval [improves fit convergence] +// v2.25 - Resize template store to accommodate FPix Templates +// v2.30 - Fix bug found by P. Shuetze that compromises sqlite file loading +// v2.35 - Add directory path selection to the ascii pushfile method +// V2.36 - Move templateStore to the heap, fix variable name in pushfile() // // Build the template storage structure from several pieces @@ -15,15 +22,16 @@ #ifndef SiPixelTemplate2D_h #define SiPixelTemplate2D_h 1 -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h" - #include #include #include "boost/multi_array.hpp" #ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" +#include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h" #include "FWCore/Utilities/interface/Exception.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h" +#else +#include "SiPixelTemplateDefs.h" #endif struct SiPixelTemplateEntry2D { //!< Basic template entry corresponding to a single set of track angles @@ -41,32 +49,49 @@ struct SiPixelTemplateEntry2D { //!< Basic template entry corresponding to a sin float xypar[2][5]; //!< pixel uncertainty parameterization float lanpar[2][5]; //!< pixel landau distribution parameters float xytemp[7][7][T2YSIZE][T2XSIZE]; //!< templates for y-reconstruction (binned over 1 central pixel) - float chi2avg[4]; //!< average chi^2 in 4 charge bins - float chi2min[4]; //!< minimum of chi^2 in 4 charge bins + float chi2ppix; //!< average chi^2 per pixel + float chi2scale; //!< scale factor for the chi2 distribution float chi2avgone; //!< average y chi^2 for 1 pixel clusters float chi2minone; //!< minimum of y chi^2 for 1 pixel clusters - float spare[20]; + float clsleny; //!< cluster y-length in pixels at signal height symax/2 + float clslenx; //!< cluster x-length in pixels at signal height sxmax/2 + float mpvvav; //!< most probable charge in Vavilov distribution (not actually for larger kappa) + float sigmavav; //!< "sigma" scale fctor for Vavilov distribution + float kappavav; //!< kappa parameter for Vavilov distribution + float scalexavg; //!< average x-error scale factor + float scaleyavg; //!< average y-error scale factor + float delyavg; //!< average length difference between template and cluster + float delysig; //!< rms of length difference between template and cluster + float scalex[4]; //!< x-error scale factor in 4 charge bins + float scaley[4]; //!< y-error scale factor in 4 charge bins + float offsetx[4]; //!< x-offset in 4 charge bins + float offsety[4]; //!< y-offset in 4 charge bins + float spare[3]; } ; struct SiPixelTemplateHeader2D { //!< template header structure - char title[80]; //!< template title int ID; //!< template ID number - int templ_version; //!< Version number of the template to ensure code compatibility - float Bfield; //!< Bfield in Tesla - int NTy; //!< number of Template y entries (= 0 for 2-D templates) + int NTy; //!< number of Template y entries int NTyx; //!< number of Template y-slices of x entries int NTxx; //!< number of Template x-entries in each slice int Dtype; //!< detector type (0=BPix, 1=FPix) + float qscale; //!< Charge scaling to match cmssw and pixelav + float lorywidth; //!< estimate of y-lorentz width for optimal resolution + float lorxwidth; //!< estimate of x-lorentz width for optimal resolution + float lorybias; //!< estimate of y-lorentz bias + float lorxbias; //!< estimate of x-lorentz bias float Vbias; //!< detector bias potential in Volts float temperature; //!< detector temperature in deg K float fluence; //!< radiation fluence in n_eq/cm^2 - float qscale; //!< Charge scaling to match cmssw and pixelav - float s50; //!< 1/2 of the readout threshold in ADC units - float lorywidth; //!< estimate of y-lorentz width from single pixel offset - float lorxwidth; //!< estimate of x-lorentz width from single pixel offset + float s50; //!< 1/2 of the multihit dcol threshold in electrons + float ss50; //!< 1/2 of the single hit dcol threshold in electrons + char title[80]; //!< template title + int templ_version; //!< Version number of the template to ensure code compatibility + float Bfield; //!< Bfield in Tesla + float fbin[3]; //!< The QBin definitions in Q_clus/Q_avg float xsize; //!< pixel size (for future use in upgraded geometry) float ysize; //!< pixel size (for future use in upgraded geometry) float zsize; //!< pixel size (for future use in upgraded geometry) @@ -76,7 +101,11 @@ struct SiPixelTemplateHeader2D { //!< template header structure struct SiPixelTemplateStore2D { //!< template storage structure SiPixelTemplateHeader2D head; - boost::multi_array entry; //!< use 2d entry to store [47][5] barrel entries or [5][9] fpix entries +#ifndef SI_PIXEL_TEMPLATE_USE_BOOST + SiPixelTemplateEntry2D entry[73][7]; //!< use 2d entry to store [47][5] barrel entries or [5][9] fpix +#else + boost::multi_array entry; //!< use 2d entry to store [47][5] barrel entries or [5][9] fpix entries +#endif } ; @@ -105,23 +134,35 @@ struct SiPixelTemplateStore2D { //!< template storage structure class SiPixelTemplate2D { public: SiPixelTemplate2D(const std::vector< SiPixelTemplateStore2D > & thePixelTemp) : thePixelTemp_(thePixelTemp) {id_current_ = -1; index_id_ = -1; cota_current_ = 0.; cotb_current_ = 0.;} //!< Default constructor - static bool pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & thePixelTemp_); // load the private store with info from the - // file with the index (int) filenum + +// load the private store with info from the + // file with the index (int) filenum ${dir}template_summary_zp${filenum}.out + static bool pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & pixelTemp, std::string dir = ""); #ifndef SI_PIXEL_TEMPLATE_STANDALONE - static bool pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & thePixelTemp_); // load the private store with info from db + static bool pushfile(const SiPixel2DTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & pixelTemp); // load the private store with info from db #endif + // Initialize things before interpolating + + void sideload(SiPixelTemplateEntry2D* entry, int iDtype, float locBx, float locBz, float lorwdy, float lorwdx, float q50, float fbin[3], float xsize, float ysize, float zsize); + + // Initialize things before interpolating + + bool interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx); // Interpolate input alpha and beta angles to produce a working template for each individual hit. - bool xytemp(int id, float cotalpha, float cotbeta, float locBz, float xhit, float yhit, std::vector& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]); + // Works with Phase 0+1 + bool xytemp(float xhit, float yhit, bool ydouble[BYM2], bool xdouble[BXM2], float template2d[BXM2][BYM2], bool dervatives, float dpdx2d[2][BXM2][BYM2], float& QTemplate); - // Overload to allow user to avoid the locBz information + // Overload for backward compatibility - bool xytemp(int id, float cotalpha, float cotbeta, float xhit, float yhit, std::vector& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]); + bool xytemp(float xhit, float yhit, bool ydouble[BYM2], bool xdouble[BXM2], float template2d[BXM2][BYM2]); - // Get pixel signal uncertainties + // Overload for backward compatibility with re-weighting code + + bool xytemp(int id, float cotalpha, float cotbeta, float xhit, float yhit, std::vector& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]); void xysigma2(float qpixel, int index, float& xysig2); @@ -134,35 +175,62 @@ class SiPixelTemplate2D { float qscale() {return qscale_;} //!< charge scaling factor float s50() {return s50_;} //!< 1/2 of the pixel threshold signal in adc units float sxymax() {return sxymax_;} //!< max pixel signal for pixel error calculation - float xytemp(int j, int i) { //!< get the 2-d template for pixel j (x), i (y) in BXM2 x BYM2 array (x,y)=(0,0) in lower LH corner of pixel[1][1] + float scalex(int i) { #ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(j < 0 || j > BXM3 || i < 0 || i > BYM3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::xytemp called with illegal indices = " << j << "," << i << std::endl;} + if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::scalex called with illegal index = " << i << std::endl;} #else - assert((j>=0 && j=0 && i=0 && i<4); #endif - return xytemp_[j][i];} //!< current 2-d template - float chi2avg(int i) { + return scalex_[i];} //!< x-error scale factor in 4 charge bins + float scaley(int i) { #ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::chi2yavg called with illegal index = " << i << std::endl;} + if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::scaley called with illegal index = " << i << std::endl;} #else assert(i>=0 && i<4); #endif - return chi2avg_[i];} //!< average chi^2 in 4 charge bins - float chi2min(int i) { + return scaley_[i];} //! 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::chi2ymin called with illegal index = " << i << std::endl;} + if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::scaley called with illegal index = " << i << std::endl;} #else assert(i>=0 && i<4); #endif - return chi2min_[i];} //!< minimum chi^2 in 4 charge bins - float chi2avgone() {return chi2avgone_;} //!< //!< average y chi^2 for 1 pixel clusters - float chi2minone() {return chi2minone_;} //!< //!< minimum of y chi^2 for 1 pixel clusters - float lorywidth() {return lorywidth_;} //!< signed lorentz y-width (microns) - float lorxwidth() {return lorxwidth_;} //!< signed lorentz x-width (microns) + return offsetx_[i];} //!< x-offset in 4 charge bins + float offsety(int i) { +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::scaley called with illegal index = " << i << std::endl;} +#else + assert(i>=0 && i<4); +#endif + return offsety_[i];} //!< x-offset in 4 charge bins + float fbin(int i) { +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + if(i < 0 || i > 2) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::fbin called with illegal index = " << i << std::endl;} +#else + assert(i>=0 && i<3); +#endif + return fbin_[i];} //!< Return lower bound of Qbin definition + float sizex() {return clslenx_;} //!< return x size of template cluster + float sizey() {return clsleny_;} //!< return y size of template cluster + float chi2ppix() {return chi2ppix_;} //!< average chi^2 per struck pixel + float chi2scale() {return chi2scale_;} //!< scale factor for chi^2 distribution + float chi2avgone() {return chi2avgone_;} //!< average y chi^2 for 1 pixel clusters + float chi2minone() {return chi2minone_;} //!< minimum of y chi^2 for 1 pixel clusters + float mpvvav() {return mpvvav_;} //!< most probable Q in Vavilov distribution + float sigmavav() {return sigmavav_;} //!< scale factor in Vavilov distribution + float kappavav() {return kappavav_;} //!< kappa parameter in Vavilov distribution + float lorydrift() {return lorydrift_;} //!< signed lorentz y-width (microns) + float lorxdrift() {return lorxdrift_;} //!< signed lorentz x-width (microns) + float clsleny() {return clsleny_;} //!< cluster y-size + float clslenx() {return clslenx_;} //!< cluster x-size + float scaleyavg() {return scaleyavg_;} //!< y-reco error scaling factor + float scalexavg() {return scalexavg_;} //!< x-reco error scaling factor + float delyavg() {return delyavg_;} //!< average difference between clsleny_ and cluster length [with threshold effects] + float delysig() {return delysig_;} //!< rms difference between clsleny_ and cluster length [with threshold effects] float xsize() {return xsize_;} //!< pixel x-size (microns) float ysize() {return ysize_;} //!< pixel y-size (microns) float zsize() {return zsize_;} //!< pixel z-size or thickness (microns) - int storesize() {return (int)thePixelTemp_.size();} //!< return the size of the template store (the number of stored IDs + int storesize() {return (int)thePixelTemp_.size();} //!< return the size of the template store (the number of stored IDs private: @@ -187,6 +255,12 @@ class SiPixelTemplate2D { int jx0_; //!< index of nearest cot(alpha) bin int jx1_; //!< index of next-nearest cot(alpha) bin float adcota_; //!< fractional pixel distance of cot(alpha) from jx0_ + int imin_; //!< min y index of templated cluster + int imax_; //!< max y index of templated cluster + int jmin_; //!< min x index of templated cluster + int jmax_; //!< max x index of templated cluster + bool flip_y_; //!< flip y sign-sensitive quantities + bool flip_x_; //!< flip x sign-sensitive quantities bool success_; //!< true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded) @@ -197,24 +271,44 @@ class SiPixelTemplate2D { float qscale_; //!< charge scaling factor float s50_; //!< 1/2 of the pixel threshold signal in adc units float sxymax_; //!< average pixel signal for y-projection of cluster - float xytemp_[BXM2][BYM2];//!< templates for y-reconstruction (binned over 5 central pixels) + float xytemp_[BXM2][BYM2];//!< template for xy-reconstruction float xypary0x0_[2][5]; //!< Polynomial error parameterization at ix0,iy0 float xypary1x0_[2][5]; //!< Polynomial error parameterization at ix0,iy1 float xypary0x1_[2][5]; //!< Polynomial error parameterization at ix1,iy0 float lanpar_[2][5]; //!< Interpolated Landau parameters - float chi2avg_[4]; //!< average chi^2 in 4 charge bins - float chi2min_[4]; //!< minimum of chi^2 in 4 charge bins - float chi2avgone_; //!< average chi^2 for 1 pixel clusters - float chi2minone_; //!< minimum of chi^2 for 1 pixel clusters + float chi2ppix_; //!< average chi^2 per struck pixel + float chi2scale_; //!< scale factor for chi2 distribution + float chi2avgone_; //!< average chi^2 for 1 pixel clusters + float chi2minone_; //!< minimum of chi^2 for 1 pixel clusters + float clsleny_; //!< projected y-length of cluster + float clslenx_; //!< projected x-length of cluster + float scalexavg_; //!< average x-error scale factor + float scaleyavg_; //!< average y-error scale factor + float delyavg_; //!< average difference between clsleny_ and cluster length [with threshold effects] + float delysig_; //!< rms of difference between clsleny_ and cluster length [with threshold effects] + float scalex_[4]; //!< x-error scale factor in charge bins + float scaley_[4]; //!< y-error scale factor in charge bins + float offsetx_[4]; //!< x-offset in charge bins + float offsety_[4]; //!< y-offset in charge bins + float mpvvav_; //!< most probable Q in Vavilov distribution + float sigmavav_; //!< scale factor in Vavilov distribution + float kappavav_; //!< kappa parameter in Vavilov distribution float lorywidth_; //!< Lorentz y-width (sign corrected for fpix frame) float lorxwidth_; //!< Lorentz x-width + float lorydrift_; //!< Lorentz y-drift + float lorxdrift_; //!< Lorentz x-drift float xsize_; //!< Pixel x-size float ysize_; //!< Pixel y-size float zsize_; //!< Pixel z-size (thickness) + float fbin_[3]; //!< The QBin definitions in Q_clus/Q_avg + const SiPixelTemplateEntry2D* entry00_; // Pointer to presently interpolated point + const SiPixelTemplateEntry2D* entry10_; // Pointer to presently interpolated point [iy+1] + const SiPixelTemplateEntry2D* entry01_; // Pointer to presently interpolated point [ix+1] // The actual template store is a std::vector container const std::vector< SiPixelTemplateStore2D > & thePixelTemp_; + } ; diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h index 4e38b80efb5c6..2ff244ac0519c 100644 --- a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h @@ -1,9 +1,11 @@ // -// SiPixelTemplateDefs.h (v1.10) +// SiPixelTemplateDefs.h (v2.00) // // Created by Morris Swartz on 12/01/09. // 2009 __TheJohnsHopkinsUniversity__. // +// V2.00 - Resize the 2D objects to improve angle acceptance +// // // Define template buffer size parameters @@ -33,9 +35,10 @@ #define BXM1 TXSIZE+3 #define BXM2 TXSIZE+2 #define BXM3 TXSIZE+1 -#define T2YSIZE 13 +#define T2YSIZE 21 #define T2XSIZE 7 -#define T2HY 6 // = T2YSIZE/2 +#define T2HY 10 // = T2YSIZE/2 +#define T2HYP1 T2HY+1 // = T2YSIZE/2+1 #define T2HX 3 // = T2XSIZE/2 #endif diff --git a/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h new file mode 100644 index 0000000000000..f99c091c27591 --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h @@ -0,0 +1,54 @@ +// +// SiPixelTemplateReco2D.cc (Version 2.20) +// Updated to work with the 2D template generation code +// 2.10 - Add y-lorentz drift to estimate starting point [for FPix] +// 2.10 - Remove >1 pixel requirement +// 2.20 - Fix major bug, change chi2 scan to 9x5 [YxX] + + +// +// +// Created by Morris Swartz on 7/13/17. +// +// + +#ifndef SiPixelTemplateReco2D_h +#define SiPixelTemplateReco2D_h 1 + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h" +#else +#include "SiPixelTemplateDefs.h" +#include "SiPixelTemplate2D.h" +#endif + +#include + +#ifndef SiPixelTemplateClusMatrix2D +#define SiPixelTemplateClusMatrix2D 1 + +namespace SiPixelTemplateReco2D { + + struct ClusMatrix { + float & operator()(int x, int y) { return matrix[mcol*x+y];} + float operator()(int x, int y) const { return matrix[mcol*x+y];} + float * matrix; + bool * xdouble; + bool * ydouble; + int mrow, mcol; + }; +#endif + + int PixelTempReco3D(int id, float cotalpha, float cotbeta, float locBz, float locBx, int edgeflagy, int edgeflagx, + ClusMatrix & cluster, SiPixelTemplate2D& templ, + float& yrec, float& sigmay, float& xrec, float& sigmax, float& probxy, float& probQ, int& qbin, float& deltay, int& npixel); + + int PixelTempReco3D(int id, float cotalpha, float cotbeta, float locBz, float locBx, int edgeflagy, int edgeflagx, + ClusMatrix & cluster, SiPixelTemplate2D& templ, + float& yrec, float& sigmay, float& xrec, float& sigmax, float& probxy, float& probQ, int& qbin, float& deltay); + + +} + +#endif diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc new file mode 100644 index 0000000000000..b6355b431645e --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEClusterRepairESProducer.cc @@ -0,0 +1,78 @@ +#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepair.h" +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" +#include "CalibTracker/Records/interface/SiPixel2DTemplateDBObjectESProducerRcd.h" + +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/Framework/interface/ESProducer.h" + + + +#include +#include + +using namespace edm; + +PixelCPEClusterRepairESProducer::PixelCPEClusterRepairESProducer(const edm::ParameterSet & p) +{ + std::string myname = p.getParameter("ComponentName"); + + //DoLorentz_ = p.getParameter("DoLorentz"); // True when LA from alignment is used + DoLorentz_ = p.existsAs("DoLorentz")?p.getParameter("DoLorentz"):false; + + pset_ = p; + setWhatProduced(this,myname); + + //std::cout<<" from ES Producer Templates "< +PixelCPEClusterRepairESProducer::produce(const TkPixelCPERecord & iRecord){ + + ESHandle magfield; + iRecord.getRecord().get(magfield ); + + edm::ESHandle pDD; + iRecord.getRecord().get( pDD ); + + edm::ESHandle hTT; + iRecord.getRecord().getRecord().get(hTT); + + edm::ESHandle lorentzAngle; + const SiPixelLorentzAngle * lorentzAngleProduct = nullptr; + if(DoLorentz_) { // LA correction from alignment + iRecord.getRecord().get("fromAlignment",lorentzAngle); + lorentzAngleProduct = lorentzAngle.product(); + } else { // Normal, deafult LA actually is NOT needed + //iRecord.getRecord().get(lorentzAngle); + lorentzAngleProduct=nullptr; // null is ok becuse LA is not use by templates in this mode + } + + ESHandle templateDBobject; + iRecord.getRecord().get(templateDBobject); + + ESHandle templateDBobject2D; + iRecord.getRecord().get(templateDBobject2D); + + return + std::make_unique(pset_, + magfield.product(), + *pDD.product(), + *hTT.product(), + lorentzAngleProduct, + templateDBobject.product(), + templateDBobject2D.product() ); +} + + diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc index 76cb0cab2e302..be729d9c3862f 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.cc @@ -87,7 +87,6 @@ PixelCPEGenericESProducer::produce(const TkPixelCPERecord & iRecord){ pset_,magfield.product(),*pDD.product(), *hTT.product(),lorentzAngle.product(), genErrorDBObjectProduct,lorentzAngleWidthProduct); - } diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/SealModules.cc b/RecoLocalTracker/SiPixelRecHits/plugins/SealModules.cc index b6e5bd2075d14..3b67968d4c4b7 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/SealModules.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/SealModules.cc @@ -7,6 +7,7 @@ //--- The CPE ES Producers #include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEGenericESProducer.h" #include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPETemplateRecoESProducer.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEClusterRepairESProducer.h" //---- The RecHit ED producer #include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelRecHitConverter.h" //--- The header files for the Framework infrastructure (macros etc): @@ -23,4 +24,5 @@ using cms::SiPixelRecHitConverter; DEFINE_FWK_MODULE(SiPixelRecHitConverter); DEFINE_FWK_EVENTSETUP_MODULE(PixelCPEGenericESProducer); DEFINE_FWK_EVENTSETUP_MODULE(PixelCPETemplateRecoESProducer); +DEFINE_FWK_EVENTSETUP_MODULE(PixelCPEClusterRepairESProducer); diff --git a/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py b/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py new file mode 100644 index 0000000000000..08199f72442e9 --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/python/PixelCPEClusterRepair_cfi.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms + +templates2 = cms.ESProducer("PixelCPEClusterRepairESProducer", + ComponentName = cms.string('PixelCPEClusterRepair'), + speed = cms.int32(-2), + #PixelErrorParametrization = cms.string('NOTcmsim'), + Alpha2Order = cms.bool(True), + UseClusterSplitter = cms.bool(False), + + # petar, for clusterProbability() from TTRHs + ClusterProbComputationFlag = cms.int32(0), + # gavril + DoCosmics = cms.bool(False), + # The flag to regulate if the LA offset is taken from Alignment + # True in Run II for offline RECO + DoLorentz = cms.bool(True), + + LoadTemplatesFromDB = cms.bool(True) + +) + +# This customization will be removed once we get the templates for phase2 pixel +from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker +phase2_tracker.toModify(templates2, + LoadTemplatesFromDB = False, + DoLorentz = False, +) + diff --git a/RecoLocalTracker/SiPixelRecHits/python/PixelCPEESProducers_cff.py b/RecoLocalTracker/SiPixelRecHits/python/PixelCPEESProducers_cff.py index 584a66f248178..a1ff25af2e697 100644 --- a/RecoLocalTracker/SiPixelRecHits/python/PixelCPEESProducers_cff.py +++ b/RecoLocalTracker/SiPixelRecHits/python/PixelCPEESProducers_cff.py @@ -20,7 +20,8 @@ # from RecoLocalTracker.SiPixelRecHits.PixelCPEGeneric_cfi import * # -# 5. The new ESProducer for the Magnetic-field dependent template record +# 5. ESProducer for the Magnetic-field dependent template records # from CalibTracker.SiPixelESProducers.SiPixelTemplateDBObjectESProducer_cfi import * +from CalibTracker.SiPixelESProducers.SiPixel2DTemplateDBObjectESProducer_cfi import * diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc index d16c61b116ff1..da7f2bbf1065d 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPEBase.cc @@ -55,7 +55,6 @@ magfield_(mag), geom_(geom), ttopo_(ttopo) //-- GenError Calibration Object (different from SiPixelCPEGenericErrorParm) from DB genErrorDBObject_ = genErrorDBObject; - //cout<<" new errors "<("LoadTemplatesFromDB"); - //cout<<" use generros/templaets "<("useLAWidthFromDB"):false; // Use Alignment LA-offset in generic + // (Experimental; leave commented out) //useLAAlignmentOffsets_ = conf.existsAs("useLAAlignmentOffsets")? //conf.getParameter("useLAAlignmentOffsets"):false; @@ -104,9 +103,11 @@ magfield_(mag), geom_(geom), ttopo_(ttopo) conf.getParameter("lAWidthFPix"):0.0; // Use LA-offset from config, for testing only - if(lAOffset_>0.0) useLAOffsetFromConfig_ = true; + if (lAOffset_>0.0) + useLAOffsetFromConfig_ = true; // Use LA-width from config, split into fpix & bpix, for testing only - if(lAWidthBPix_>0.0 || lAWidthFPix_>0.0) useLAWidthFromConfig_ = true; + if (lAWidthBPix_>0.0 || lAWidthFPix_>0.0) + useLAWidthFromConfig_ = true; // For Templates only @@ -114,24 +115,23 @@ magfield_(mag), geom_(geom), ttopo_(ttopo) DoLorentz_ = conf.existsAs("DoLorentz")?conf.getParameter("DoLorentz"):false; LogDebug("PixelCPEBase") <<" LA constants - " - <(dus[i]); @@ -157,7 +157,6 @@ void PixelCPEBase::fillDetParams() //--- p.theDet->type() returns a GeomDetType, which implements subDetector() p.thePart = p.theDet->type().subDetector(); - //cout<<" in PixelCPEBase - in det "<surface(), but @@ -179,6 +178,7 @@ void PixelCPEBase::fillDetParams() p.detTemplateId = templateDBobject_->getTemplateID(p.theDet->geographicalId()); } + // &&& PM: I'm not sure what this does. Ask around. // just for testing //int i1 = 0; //if(theFlag_==0) i1 = genErrorDBObject_->getGenErrorID(p.theDet->geographicalId().rawId()); @@ -194,28 +194,28 @@ void PixelCPEBase::fillDetParams() else p.theRecTopol = dynamic_cast(p.theTopol); assert(p.theRecTopol); - //---- The geometrical description of one module/plaquette - //p.theNumOfRow = p.theRecTopol->nrows(); // rows in x //Not used, AH - //p.theNumOfCol = p.theRecTopol->ncolumns(); // cols in y //Not used, AH + //--- The geometrical description of one module/plaquette + //p.theNumOfRow = p.theRecTopol->nrows(); // rows in x //Not used, AH. PM: leave commented out. + //p.theNumOfCol = p.theRecTopol->ncolumns(); // cols in y //Not used, AH. PM: leave commented out. std::pair pitchxy = p.theRecTopol->pitch(); p.thePitchX = pitchxy.first; // pitch along x p.thePitchY = pitchxy.second; // pitch along y - //p.theSign = isFlipped(&p) ? -1 : 1; //Not used, AH + //p.theSign = isFlipped(&p) ? -1 : 1; //Not used, AH. PM: leave commented out. LocalVector Bfield = p.theDet->surface().toLocal(magfield_->inTesla(p.theDet->surface().position())); p.bz = Bfield.z(); p.bx = Bfield.x(); - // Compute the Lorentz shifts for this detector element + //--- Compute the Lorentz shifts for this detector element if ( (theFlag_==0) || DoLorentz_ ) { // do always for generic and if(DOLorentz) for templates p.driftDirection = driftDirection(p, Bfield ); computeLorentzShifts(p); } - LogDebug("PixelCPEBase") << "***** PIXEL LAYOUT *****" + LogDebug("PixelCPEBase::fillDetParams()") << "***** PIXEL LAYOUT *****" << " thePart = " << p.thePart << " theThickness = " << p.theThickness << " thePitchX = " << p.thePitchX @@ -239,11 +239,24 @@ PixelCPEBase::setTheClu( DetParam const & theDetParam, ClusterParam & theCluster minInY = theClusterParam.theCluster->minPixelCol(); maxInX = theClusterParam.theCluster->maxPixelRow(); maxInY = theClusterParam.theCluster->maxPixelCol(); - - theClusterParam.isOnEdge_ = theDetParam.theRecTopol->isItEdgePixelInX(minInX) | theDetParam.theRecTopol->isItEdgePixelInX(maxInX) | - theDetParam.theRecTopol->isItEdgePixelInY(minInY) | theDetParam.theRecTopol->isItEdgePixelInY(maxInY) ; - - // FOR NOW UNUSED. KEEP IT IN CASE WE WANT TO USE IT IN THE FUTURE + + if ( theDetParam.theRecTopol->isItEdgePixelInX(minInX) ) + theClusterParam.edgeTypeX_ = 1; + else if ( theDetParam.theRecTopol->isItEdgePixelInX(maxInX) ) + theClusterParam.edgeTypeX_ = 2; + else + theClusterParam.edgeTypeX_ = 0; + + if ( theDetParam.theRecTopol->isItEdgePixelInY(minInY) ) + theClusterParam.edgeTypeY_ = 1; + else if ( theDetParam.theRecTopol->isItEdgePixelInY(maxInY) ) + theClusterParam.edgeTypeY_ = 2; + else + theClusterParam.edgeTypeY_ = 0; + + theClusterParam.isOnEdge_ = ( theClusterParam.edgeTypeX_ || theClusterParam.edgeTypeY_ ); + + // &&& FOR NOW UNUSED. KEEP IT IN CASE WE WANT TO USE IT IN THE FUTURE // Bad Pixels have their charge set to 0 in the clusterizer //hasBadPixels_ = false; //for(unsigned int i=0; ipixelADC().size(); ++i) { @@ -264,6 +277,7 @@ void PixelCPEBase:: computeAnglesFromTrajectory( DetParam const & theDetParam, ClusterParam & theClusterParam, const LocalTrajectoryParameters & ltp) const { + // &&& PM: this comment is a candidate for deletion, but ask around first. //cout<<" in PixelCPEBase:computeAnglesFromTrajectory - "<surface().toGlobal(Local3DPoint(0.,0.,0.)).perp2(); float tmp2 = theDetParam.theDet->surface().toGlobal(Local3DPoint(0.,0.,1.)).perp2(); - //cout << " 1: " << tmp1 << " 2: " << tmp2 << endl; - if ( tmp2surface().position(), theDetParam.theDet->surface().rotation()); LocalVector Bfield = detFrame.toLocal(bfield); return driftDirection(theDetParam,Bfield); - } + LocalVector -PixelCPEBase::driftDirection(DetParam & theDetParam, LocalVector Bfield ) const { - const bool LocalPrint = false; - +PixelCPEBase::driftDirection(DetParam & theDetParam, LocalVector Bfield ) const +{ // Use LA from DB or from config float langle = 0.; if( !useLAOffsetFromConfig_ ) { // get it from DB if(lorentzAngle_ != nullptr) { // a real LA object langle = lorentzAngle_->getLorentzAngle(theDetParam.theDet->geographicalId().rawId()); - //cout<<" la "<geographicalId().rawId() <geographicalId().rawId() <getLorentzAngle(theDetParam.theDet->geographicalId().rawId()); if(langleWidth!=0.0) theDetParam.widthLAFractionX = std::abs(langleWidth/langle); @@ -509,9 +522,7 @@ PixelCPEBase::driftDirection(DetParam & theDetParam, LocalVector Bfield ) const } // if flag - - if(LocalPrint) cout<<" in PixelCPEBase:driftDirection - "< +#include "boost/multi_array.hpp" + +#include + +using namespace SiPixelTemplateReco; +//using namespace SiPixelTemplateSplit; +using namespace std; + +namespace { + constexpr float micronsToCm = 1.0e-4; + constexpr int cluster_matrix_size_x = 13; + constexpr int cluster_matrix_size_y = 21; +} + +//----------------------------------------------------------------------------- +// Constructor. +// +//----------------------------------------------------------------------------- +PixelCPEClusterRepair::PixelCPEClusterRepair(edm::ParameterSet const & conf, + const MagneticField * mag, + const TrackerGeometry& geom, + const TrackerTopology& ttopo, + const SiPixelLorentzAngle * lorentzAngle, + const SiPixelTemplateDBObject * templateDBobject, + const SiPixel2DTemplateDBObject * templateDBobject2D ) +: PixelCPEBase(conf, mag, geom, ttopo, lorentzAngle, nullptr, templateDBobject, nullptr,1) +{ + LogDebug("PixelCPEClusterRepair::(constructor)") << endl; + + //--- Parameter to decide between DB or text file template access + if ( LoadTemplatesFromDB_ ) + { + // Initialize template store to the selected ID [Morris, 6/25/08] + if ( !SiPixelTemplate::pushfile( *templateDBobject_, thePixelTemp_) ) + throw cms::Exception("PixelCPEClusterRepair") + << "\nERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " + << (*templateDBobject_).version() << "\n\n"; + + // Initialize template store to the selected ID [Morris, 6/25/08] + if ( !SiPixelTemplate2D::pushfile( *templateDBobject2D , thePixelTemp2D_) ) + throw cms::Exception("PixelCPEClusterRepair") + << "\nERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " + << (*templateDBobject_).version() << "\n\n"; + } + else + { + LogDebug("PixelCPEClusterRepair") << "Loading templates for barrel and forward from ASCII files." << endl; + //--- (Archaic) Get configurable template IDs. This code executes only if we loading pixels from ASCII + // files, and then they are mandatory. + barrelTemplateID_ = conf.getParameter( "barrelTemplateID" ); + forwardTemplateID_ = conf.getParameter( "forwardTemplateID" ); + templateDir_ = conf.getParameter( "directoryWithTemplates" ); + + if ( !SiPixelTemplate::pushfile( barrelTemplateID_ , thePixelTemp_ , templateDir_ ) ) + throw cms::Exception("PixelCPEClusterRepair") + << "\nERROR: Template ID " << barrelTemplateID_ << " not loaded correctly from text file. Reconstruction will fail.\n\n"; + + if ( !SiPixelTemplate::pushfile( forwardTemplateID_ , thePixelTemp_ , templateDir_ ) ) + throw cms::Exception("PixelCPEClusterRepair") + << "\nERROR: Template ID " << forwardTemplateID_ << " not loaded correctly from text file. Reconstruction will fail.\n\n"; + } + + speed_ = conf.getParameter( "speed"); + LogDebug("PixelCPEClusterRepair::PixelCPEClusterRepair:") << + "Template speed = " << speed_ << "\n"; + + UseClusterSplitter_ = conf.getParameter("UseClusterSplitter"); + + + //--- Configure 3D reco. + if ( conf.exists("MinProbY") ) + minProbY_ = conf.getParameter("MinProbY"); + else + minProbY_ = 0.001; // probabilityY < 0.001 + + if ( conf.exists("MaxSizeMismatchInY") ) + maxSizeMismatchInY_ = conf.getParameter("MaxSizeMismatchInY"); + else + maxSizeMismatchInY_ = 1; // ( templ.clsleny() - nypix > 1) + +} + + + +//----------------------------------------------------------------------------- +// Clean up. +//----------------------------------------------------------------------------- +PixelCPEClusterRepair::~PixelCPEClusterRepair() +{ + for(auto x : thePixelTemp_) x.destroy(); + // Note: this is not needed for Template 2D +} + +PixelCPEBase::ClusterParam* PixelCPEClusterRepair::createClusterParam(const SiPixelCluster & cl) const +{ + return new ClusterParamTemplate(cl); +} + + + +//------------------------------------------------------------------ +// Public methods mandated by the base class. +//------------------------------------------------------------------ + +//------------------------------------------------------------------ +// The main call to the template code. +//------------------------------------------------------------------ +LocalPoint +PixelCPEClusterRepair::localPosition(DetParam const & theDetParam, ClusterParam & theClusterParamBase) const +{ + + ClusterParamTemplate & theClusterParam = static_cast(theClusterParamBase); + + if(!GeomDetEnumerators::isTrackerPixel(theDetParam.thePart)) + throw cms::Exception("PixelCPEClusterRepair::localPosition :") + << "A non-pixel detector type in here?"; + + int ID = -9999; + if ( LoadTemplatesFromDB_ ) { + int ID0 = templateDBobject_->getTemplateID(theDetParam.theDet->geographicalId()); // just to comapre + ID = theDetParam.detTemplateId; + if(ID0!=ID) edm::LogError("PixelCPEClusterRepair") <<" different id"<< ID<<" "<localPosition( MeasurementPoint(tmp_x, tmp_y) ); + } + + //--- Compute the size of the matrix which will be passed to TemplateReco. + // We'll later make clustMatrix[ mrow ][ mcol ] + int mrow=0, mcol=0; + for (int i=0 ; i!=theClusterParam.theCluster->size(); ++i ) + { + auto pix = theClusterParam.theCluster->pixel(i); + int irow = int(pix.x); + int icol = int(pix.y); + mrow = std::max(mrow,irow); + mcol = std::max(mcol,icol); + } + mrow -= row_offset; mrow+=1; mrow = std::min(mrow,cluster_matrix_size_x); + mcol -= col_offset; mcol+=1; mcol = std::min(mcol,cluster_matrix_size_y); + assert(mrow>0); assert(mcol>0); + + + //--- Make and fill the bool arrays flagging double pixels + bool xdouble[mrow], ydouble[mcol]; + // x directions (shorter), rows + for (int irow = 0; irow < mrow; ++irow) + xdouble[irow] = theDetParam.theRecTopol->isItBigPixelInX( irow+row_offset ); + // + // y directions (longer), columns + for (int icol = 0; icol < mcol; ++icol) + ydouble[icol] = theDetParam.theRecTopol->isItBigPixelInY( icol+col_offset ); + + //--- C-style matrix. We'll need it in either case. + float clustMatrix[mrow][mcol]; + float clustMatrix2[mrow][mcol]; + + //--- Prepare struct that passes pointers to TemplateReco. It doesn't own anything. + SiPixelTemplateReco::ClusMatrix clusterPayload { &clustMatrix[0][0], xdouble, ydouble, mrow,mcol}; + SiPixelTemplateReco2D::ClusMatrix clusterPayload2d{ &clustMatrix2[0][0], xdouble, ydouble, mrow,mcol}; + + + //--- Copy clust's pixels (calibrated in electrons) into clustMatrix; + memset( clustMatrix, 0, sizeof(float)*mrow*mcol ); // Wipe it clean. + for (int i=0 ; i!=theClusterParam.theCluster->size(); ++i ) + { + auto pix = theClusterParam.theCluster->pixel(i); + int irow = int(pix.x) - row_offset; + int icol = int(pix.y) - col_offset; + // &&& Do we ever get pixels that are out of bounds ??? Need to check. + if ( (irowsize(); ++i ) + // { + // auto pix = theClusterParam.theCluster->pixel(i); + // int irow = int(pix.x) - row_offset; + // int icol = int(pix.y) - col_offset; + // // &&& Do we ever get pixels that are out of bounds ??? Need to check. + // if ( (irow > zeropix; + int nypix =0, nxpix = 0; + // + theClusterParam.ierr = + PixelTempReco2D( ID, theClusterParam.cotalpha, theClusterParam.cotbeta, + locBz, locBx, + clusterPayload, + templ, + theClusterParam.templYrec_, theClusterParam.templSigmaY_, theClusterParam.probabilityY_, + theClusterParam.templXrec_, theClusterParam.templSigmaX_, theClusterParam.probabilityX_, + theClusterParam.qBin_, + speed_, deadpix, zeropix, + theClusterParam.probabilityQ_, nypix, nxpix + ); + // ****************************************************************** + + //--- Check exit status + if unlikely( theClusterParam.ierr != 0 ) + { + LogDebug("PixelCPEClusterRepair::localPosition") << + "reconstruction failed with error " << theClusterParam.ierr << "\n"; + + // Gavril: what do we do in this case ? For now, just return the cluster center of gravity in microns + // In the x case, apply a rough Lorentz drift average correction + // To do: call PixelCPEGeneric whenever PixelTempReco2D fails + float lorentz_drift = -999.9; + if ( ! GeomDetEnumerators::isEndcap(theDetParam.thePart) ) + lorentz_drift = 60.0f; // in microns + else + lorentz_drift = 10.0f; // in microns + // GG: trk angles needed to correct for bows/kinks + if ( theClusterParam.with_track_angle ) + { + theClusterParam.templXrec_ = theDetParam.theTopol->localX( theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred ) - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = theDetParam.theTopol->localY( theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred ); + } + else + { + edm::LogError("PixelCPEClusterRepair") + << "@SUB = PixelCPEClusterRepair::localPosition" + << "Should never be here. PixelCPEClusterRepair should always be called with track angles. This is a bad error !!! "; + + theClusterParam.templXrec_ = theDetParam.theTopol->localX( theClusterParam.theCluster->x() ) - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = theDetParam.theTopol->localY( theClusterParam.theCluster->y() ); + } + } + else + { + //--- Template Reco succeeded. The probabilities are filled. + theClusterParam.hasFilledProb_ = true; + + //--- templ.clsleny() is the expected length of the cluster along y axis. + if ( (theClusterParam.probabilityY_ < minProbY_ ) && (templ.clsleny() - nypix > 1) ) { + theClusterParam.recommended3D_ = true; + } + + //--- Go from microns to centimeters + theClusterParam.templXrec_ *= micronsToCm; + theClusterParam.templYrec_ *= micronsToCm; + + //--- Go back to the module coordinate system + theClusterParam.templXrec_ += lp.x(); + theClusterParam.templYrec_ += lp.y(); + + } + return; +} + + + + +//------------------------------------------------------------------ +// Helper function to aggregate call & handling of Template 2D fit +//------------------------------------------------------------------ +void +PixelCPEClusterRepair::callTempReco3D( DetParam const & theDetParam, + ClusterParamTemplate & theClusterParam, + SiPixelTemplateReco2D::ClusMatrix & clusterPayload, + int ID, LocalPoint & lp ) const +{ + SiPixelTemplate2D templ2d(thePixelTemp2D_); + + // Output: + float nonsense = -99999.9f; // nonsense init value + theClusterParam.templXrec_ = theClusterParam.templYrec_ = theClusterParam.templSigmaX_ = theClusterParam.templSigmaY_ = nonsense; + // If the template recontruction fails, we want to return 1.0 for now + theClusterParam.templProbY_ = theClusterParam.templProbX_ = theClusterParam.templProbQ_ = 1.0f; + theClusterParam.templQbin_ = 0; + // We have a boolean denoting whether the reco failed or not + theClusterParam.hasFilledProb_ = false; + + // ****************************************************************** + //--- Call 2D TemplateReco + // + float locBz = theDetParam.bz; + float locBx = theDetParam.bx; + + //--- Input: + // edgeflagy - (input) flag to indicate the present of edges in y: + // 0=none (or interior gap),1=edge at small y, 2=edge at large y, 3=edge at either end + // + // edgeflagx - (input) flag to indicate the present of edges in x: + // 0=none, 1=edge at small x, 2=edge at large x + // + // These two variables are calculated in setTheClu() and stored in edgeTypeX_ and edgeTypeY_ + // + //--- Output: + // deltay - (output) template y-length - cluster length [when > 0, possibly missing end] + // npixels - ??? &&& Ask Morris + + float edgeTypeY = theClusterParam.edgeTypeY_ ; // the default, from PixelCPEBase + if ( theClusterParam.recommended3D_ ) { + // Cluster is not on edge, but instead the normal TemplateReco discovered that it is + // shorter than expected. So let the 3D algorithm try extending it on both sides, in case + // there is a dead double-column on either side. (We don't know which.) + edgeTypeY = 3; + } + + float deltay = 0; // return param + int npixels = 0; // return param + + theClusterParam.ierr2 = + PixelTempReco3D( ID, theClusterParam.cotalpha, theClusterParam.cotbeta, + locBz, locBx, + edgeTypeY , theClusterParam.edgeTypeX_ , + clusterPayload, + templ2d, + theClusterParam.templYrec_, theClusterParam.templSigmaY_, + theClusterParam.templXrec_, theClusterParam.templSigmaX_, + theClusterParam.templProbXY_, + theClusterParam.probabilityQ_, + theClusterParam.qBin_, + deltay, npixels + ); + // ****************************************************************** + + //--- Check exit status + if unlikely( theClusterParam.ierr2 != 0 ) + { + LogDebug("PixelCPEClusterRepair::localPosition") << + "3D reconstruction failed with error " << theClusterParam.ierr2 << "\n"; + + // GG: what do we do in this case? For now, just return the cluster center of gravity in microns + // In the x case, apply a rough Lorentz drift average correction + float lorentz_drift = -999.9; + if ( ! GeomDetEnumerators::isEndcap(theDetParam.thePart) ) + lorentz_drift = 60.0f; // in microns // &&& replace with a constant (globally) + else + lorentz_drift = 10.0f; // in microns + // GG: trk angles needed to correct for bows/kinks + if ( theClusterParam.with_track_angle ) + { + theClusterParam.templXrec_ = theDetParam.theTopol->localX( theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred ) - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = theDetParam.theTopol->localY( theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred ); + } + else + { + edm::LogError("PixelCPEClusterRepair") + << "@SUB = PixelCPEClusterRepair::localPosition" + << "Should never be here. PixelCPEClusterRepair should always be called with track angles. This is a bad error !!! "; + + theClusterParam.templXrec_ = theDetParam.theTopol->localX( theClusterParam.theCluster->x() ) - lorentz_drift * micronsToCm; // rough Lorentz drift correction + theClusterParam.templYrec_ = theDetParam.theTopol->localY( theClusterParam.theCluster->y() ); + } + } + else + { + //--- Template Reco succeeded. + theClusterParam.hasFilledProb_ = true; + + //--- Go from microns to centimeters + theClusterParam.templXrec_ *= micronsToCm; + theClusterParam.templYrec_ *= micronsToCm; + + //--- Go back to the module coordinate system + theClusterParam.templXrec_ += lp.x(); + theClusterParam.templYrec_ += lp.y(); + } + return; +} + + + + +//------------------------------------------------------------------ +// localError() relies on localPosition() being called FIRST!!! +//------------------------------------------------------------------ +LocalError +PixelCPEClusterRepair::localError(DetParam const & theDetParam, ClusterParam & theClusterParamBase) const +{ + + ClusterParamTemplate & theClusterParam = static_cast(theClusterParamBase); + + //--- Default is the maximum error used for edge clusters. + //--- (never used, in fact: let comment it out, shut up the complains of the static analyzer, and save a few CPU cycles) + float xerr = 0.0f, yerr = 0.0f; + + //--- Check status of both template calls. + if unlikely ( (theClusterParam.ierr !=0) || (theClusterParam.ierr2 !=0) ) { + // If reconstruction fails the hit position is calculated from cluster center of gravity + // corrected in x by average Lorentz drift. Assign huge errors. + // + if unlikely (!GeomDetEnumerators::isTrackerPixel(theDetParam.thePart)) + throw cms::Exception("PixelCPEClusterRepair::localPosition :") + << "A non-pixel detector type in here?"; + + // Assign better errors based on the residuals for failed template cases + if ( GeomDetEnumerators::isBarrel(theDetParam.thePart)) { + xerr = 55.0f * micronsToCm; // &&& get errors from elsewhere? + yerr = 36.0f * micronsToCm; + } + else { + xerr = 42.0f * micronsToCm; + yerr = 39.0f * micronsToCm; + } + } + // Leave commented for now, until we study the interplay of failure modes + // of 1D template reco and edges. For edge hits we run 3D reco by default! + // + // else if ( theClusterParam.edgeTypeX_ || theClusterParam.edgeTypeY_ ) { + // // for edge pixels assign errors according to observed residual RMS + // if ( theClusterParam.edgeTypeX_ && !theClusterParam.edgeTypeY_ ) { + // xerr = 23.0f * micronsToCm; + // yerr = 39.0f * micronsToCm; + // } + // else if ( !theClusterParam.edgeTypeX_ && theClusterParam.edgeTypeY_ ) { + // xerr = 24.0f * micronsToCm; + // yerr = 96.0f * micronsToCm; + // } + // else if ( theClusterParam.edgeTypeX_ && theClusterParam.edgeTypeY_ ) { + // xerr = 31.0f * micronsToCm; + // yerr = 90.0f * micronsToCm; + // } + // } + else { + xerr = theClusterParam.templSigmaX_ * micronsToCm; + yerr = theClusterParam.templSigmaY_ * micronsToCm; + // &&& should also check ierr (saved as class variable) and return + // &&& nonsense (another class static) if the template fit failed. + } + + if (theVerboseLevel > 9) { + LogDebug("PixelCPEClusterRepair") + << " Sizex = " << theClusterParam.theCluster->sizeX() + << " Sizey = " << theClusterParam.theCluster->sizeY() + << " Edgex = " << theClusterParam.edgeTypeX_ + << " Edgey = " << theClusterParam.edgeTypeY_ + << " ErrX = " << xerr << " ErrY = " << yerr; + } + + + if ( !(xerr > 0.0f) ) + throw cms::Exception("PixelCPEClusterRepair::localError") + << "\nERROR: Negative pixel error xerr = " << xerr << "\n\n"; + + if ( !(yerr > 0.0f) ) + throw cms::Exception("PixelCPEClusterRepair::localError") + << "\nERROR: Negative pixel error yerr = " << yerr << "\n\n"; + + return LocalError(xerr*xerr, 0, yerr*yerr); +} + diff --git a/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc b/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc index f502d6b6f29ab..74a678076af8f 100644 --- a/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc +++ b/RecoLocalTracker/SiPixelRecHits/src/PixelCPETemplateReco.cc @@ -73,15 +73,18 @@ PixelCPETemplateReco::PixelCPETemplateReco(edm::ParameterSet const & conf, } else { - //cout << "PixelCPETemplateReco : Loading templates 40 and 41 from ASCII files ------------------------" << endl; - - if ( !SiPixelTemplate::pushfile( 40, thePixelTemp_ ) ) + //cout << "PixelCPETemplateReco : Loading templates for barrel and forward from ASCII files ----------" << endl; + barrelTemplateID_ = conf.getParameter( "barrelTemplateID" ); + forwardTemplateID_ = conf.getParameter( "forwardTemplateID" ); + templateDir_ = conf.getParameter( "directoryWithTemplates" ); + + if ( !SiPixelTemplate::pushfile( barrelTemplateID_ , thePixelTemp_ , templateDir_ ) ) throw cms::Exception("PixelCPETemplateReco") - << "\nERROR: Templates 40 not loaded correctly from text file. Reconstruction will fail.\n\n"; + << "\nERROR: Template ID " << barrelTemplateID_ << " not loaded correctly from text file. Reconstruction will fail.\n\n"; - if ( !SiPixelTemplate::pushfile( 41, thePixelTemp_ ) ) + if ( !SiPixelTemplate::pushfile( forwardTemplateID_ , thePixelTemp_ , templateDir_ ) ) throw cms::Exception("PixelCPETemplateReco") - << "\nERROR: Templates 41 not loaded correctly from text file. Reconstruction will fail.\n\n"; + << "\nERROR: Template ID " << forwardTemplateID_ << " not loaded correctly from text file. Reconstruction will fail.\n\n"; } speed_ = conf.getParameter( "speed"); @@ -129,10 +132,12 @@ PixelCPETemplateReco::localPosition(DetParam const & theDetParam, ClusterParam & if ( LoadTemplatesFromDB_ ) { int ID0 = templateDBobject_->getTemplateID(theDetParam.theDet->geographicalId()); // just to comapre ID = theDetParam.detTemplateId; - if(ID0!=ID) cout<<" different id"<< ID<<" "< //#include @@ -50,7 +54,7 @@ using namespace edm; //! digits of filenum. //! \param filenum - an integer NNNN used in the filename generror_summary_zpNNNN //**************************************************************** -bool SiPixelGenError::pushfile(int filenum, std::vector< SiPixelGenErrorStore > & thePixelTemp_) +bool SiPixelGenError::pushfile(int filenum, std::vector< SiPixelGenErrorStore > & pixelTemp , std::string dir) { // Add info stored in external file numbered filenum to theGenErrorStore @@ -71,7 +75,7 @@ bool SiPixelGenError::pushfile(int filenum, std::vector< SiPixelGenErrorStore > // Create different path in CMSSW than standalone #ifndef SI_PIXEL_TEMPLATE_STANDALONE - tout << "CalibTracker/SiPixelESProducers/data/generror_summary_zp" + tout << dir << "generror_summary_zp" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; std::string tempf = tout.str(); edm::FileInPath file( tempf.c_str() ); @@ -128,6 +132,11 @@ bool SiPixelGenError::pushfile(int filenum, std::vector< SiPixelGenErrorStore > // next, layout the 1-d/2-d structures needed to store GenError info + + theCurrentTemp.cotbetaY = new float[theCurrentTemp.head.NTy]; + theCurrentTemp.cotbetaX = new float[theCurrentTemp.head.NTyx]; + theCurrentTemp.cotalphaX = new float[theCurrentTemp.head.NTxx]; + theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]); theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); @@ -214,9 +223,9 @@ bool SiPixelGenError::pushfile(int filenum, std::vector< SiPixelGenErrorStore > // Add this info to the store - thePixelTemp_.push_back(theCurrentTemp); + pixelTemp.push_back(theCurrentTemp); - postInit(thePixelTemp_); + postInit(pixelTemp); return true; @@ -240,7 +249,7 @@ bool SiPixelGenError::pushfile(int filenum, std::vector< SiPixelGenErrorStore > //! \param dbobject - db storing multiple generic calibrations //**************************************************************** bool SiPixelGenError::pushfile(const SiPixelGenErrorDBObject& dbobject, - std::vector< SiPixelGenErrorStore > & thePixelTemp_) { + std::vector< SiPixelGenErrorStore > & pixelTemp) { // Add GenError stored in external dbobject to theGenErrorStore // Local variables @@ -253,7 +262,9 @@ bool SiPixelGenError::pushfile(const SiPixelGenErrorDBObject& dbobject, SiPixelGenErrorDBObject db = dbobject; // Create a local GenError storage entry - SiPixelGenErrorStore theCurrentTemp; + /// SiPixelGenErrorStore theCurrentTemp; // not on the stack... + auto tmpPtr = std::make_unique(); // must be allocated on the heap instead + auto & theCurrentTemp = *tmpPtr; // Fill the GenError storage for each GenError calibration stored in the db for(int m=0; m 0) + tempfile = std::string(nzeros, '0') + tempfile; + /// Alt implementation: for (unsigned cnt=4-tempfile.length(); cnt > 0; cnt-- ){ tempfile = "0" + tempfile; } + + tempfile = dir + "template_summary_zp" + tempfile + ".out"; + edm::FileInPath file( tempfile ); // Find the file in CMSSW + tempfile = file.fullPath(); // Put it back with the whole path. + #else + // This is the same as above, but more elegant. (Elegance not allowed in CMSSW...) + std::ostringstream tout; tout << "template_summary_zp" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; - std::string tempf = tout.str(); - tempfile = tempf.c_str(); + tempfile = tout.str(); + #endif - // open the template file - - std::ifstream in_file(tempfile, std::ios::in); + // Open the template file + // + std::ifstream in_file(tempfile); + if(in_file.is_open() && in_file.good()) { - if(in_file.is_open()) { // Create a local template storage entry @@ -523,9 +525,9 @@ bool SiPixelTemplate::pushfile(int filenum, std::vector< SiPixelTemplateStore > // Add this template to the store - thePixelTemp_.push_back(theCurrentTemp); + pixelTemp.push_back(theCurrentTemp); - postInit(thePixelTemp_); + postInit(pixelTemp); return true; } else { @@ -548,22 +550,23 @@ bool SiPixelTemplate::pushfile(int filenum, std::vector< SiPixelTemplateStore > //! external file template_summary_zpNNNN where NNNN are four digits //! \param dbobject - db storing multiple template calibrations //**************************************************************** -bool SiPixelTemplate::pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore > & thePixelTemp_) +bool SiPixelTemplate::pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore > & pixelTemp) { // Add template stored in external dbobject to theTemplateStore // Local variables int i, j, k, l; float qavg_avg; - // const char *tempfile; const int code_version={17}; // We must create a new object because dbobject must be a const and our stream must not be auto db(dbobject.reader()); // Create a local template storage entry - SiPixelTemplateStore theCurrentTemp; - + /// SiPixelTemplateStore theCurrentTemp; // large, don't allocate it on the stack + auto tmpPtr = std::make_unique(); // must be allocated on the heap instead + auto & theCurrentTemp = *tmpPtr; + // Fill the template storage for each template calibration stored in the db for(int m=0; m -//#include -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -//#include -#else -#include -#endif -#include -#include -//#include "boost/multi_array.hpp" -#include -#include -#include -#include - - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#define LOGERROR(x) LogError(x) -#define LOGINFO(x) LogInfo(x) -#define ENDL " " -#include "FWCore/Utilities/interface/Exception.h" -using namespace edm; -#else -#include "SiPixelTemplate2D.h" -#define LOGERROR(x) std::cout << x << ": " -#define LOGINFO(x) std::cout << x << ": " -#define ENDL std::endl -#endif - -//**************************************************************** -//! This routine initializes the global template structures from -//! an external file template_summary_zpNNNN where NNNN are four -//! digits of filenum. -//! \param filenum - an integer NNNN used in the filename template_summary_zpNNNN -//**************************************************************** -bool SiPixelTemplate2D::pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & thePixelTemp_) -{ - // Add template stored in external file numbered filenum to theTemplateStore - - // Local variables - int i, j, k, l, iy, jx; - const char *tempfile; - // char title[80]; remove this - char c; - const int code_version={16}; - - - - // Create a filename for this run - - std::ostringstream tout; - - // Create different path in CMSSW than standalone - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - tout << "CalibTracker/SiPixelESProducers/data/template_summary2D_zp" - << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; - std::string tempf = tout.str(); - edm::FileInPath file( tempf.c_str() ); - tempfile = (file.fullPath()).c_str(); -#else - tout << "template_summary2D_zp" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; - std::string tempf = tout.str(); - tempfile = tempf.c_str(); -#endif - - // open the template file - - std::ifstream in_file(tempfile, std::ios::in); - - if(in_file.is_open()) { - - // Create a local template storage entry - - SiPixelTemplateStore2D theCurrentTemp; - - // Read-in a header string first and print it - - for (i=0; (c=in_file.get()) != '\n'; ++i) { - if(i < 79) {theCurrentTemp.head.title[i] = c;} - } - if(i > 78) {i=78;} - theCurrentTemp.head.title[i+1] ='\0'; - LOGINFO("SiPixelTemplate2D") << "Loading Pixel Template File - " << theCurrentTemp.head.title << ENDL; - - // next, the header information - - in_file >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx - >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale - >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file, no template load" << ENDL; return false;} - - LOGINFO("SiPixelTemplate2D") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield - << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype - << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature " - << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale - << ", 1/2 threshold " << theCurrentTemp.head.s50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", x Lorentz width " << theCurrentTemp.head.lorxwidth - << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL; - - if(theCurrentTemp.head.templ_version != code_version) {LOGERROR("SiPixelTemplate2D") << "code expects version " << code_version << ", no template load" << ENDL; return false;} - - if(theCurrentTemp.head.NTy != 0) {LOGERROR("SiPixelTemplate2D") << "Trying to load 1-d template info into the 2-d template object, check your DB/global tag!" << ENDL; return false;} - - // next, layout the 2-d structure needed to store template - - theCurrentTemp.entry.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); - - // Read in the file info - - for (iy=0; iy < theCurrentTemp.head.NTyx; ++iy) { - for(jx=0; jx < theCurrentTemp.head.NTxx; ++jx) { - - in_file >> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0] - >> theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - // Calculate cot(alpha) and cot(beta) for this entry - - theCurrentTemp.entry[iy][jx].cotalpha = theCurrentTemp.entry[iy][jx].costrk[0]/theCurrentTemp.entry[iy][jx].costrk[2]; - - theCurrentTemp.entry[iy][jx].cotbeta = theCurrentTemp.entry[iy][jx].costrk[1]/theCurrentTemp.entry[iy][jx].costrk[2]; - - in_file >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >> theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin - >> theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >> theCurrentTemp.entry[iy][jx].jxmax; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - for (k=0; k<2; ++k) { - - in_file >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1] - >> theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >> theCurrentTemp.entry[iy][jx].xypar[k][4]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - } - - for (k=0; k<2; ++k) { - - in_file >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1] - >> theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >> theCurrentTemp.entry[iy][jx].lanpar[k][4]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - } - - for (l=0; l<7; ++l) { - for (k=0; k<7; ++k) { - for (j=0; j> theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j];} - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - } - } - } - - - in_file >> theCurrentTemp.entry[iy][jx].chi2minone >> theCurrentTemp.entry[iy][jx].chi2avgone >> theCurrentTemp.entry[iy][jx].chi2min[0] >> theCurrentTemp.entry[iy][jx].chi2avg[0] - >> theCurrentTemp.entry[iy][jx].chi2min[1] >> theCurrentTemp.entry[iy][jx].chi2avg[1]>> theCurrentTemp.entry[iy][jx].chi2min[2] >> theCurrentTemp.entry[iy][jx].chi2avg[2] - >> theCurrentTemp.entry[iy][jx].chi2min[3] >> theCurrentTemp.entry[iy][jx].chi2avg[3]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - in_file >> theCurrentTemp.entry[iy][jx].spare[0] >> theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2] >> theCurrentTemp.entry[iy][jx].spare[3] - >> theCurrentTemp.entry[iy][jx].spare[4] >> theCurrentTemp.entry[iy][jx].spare[5] >> theCurrentTemp.entry[iy][jx].spare[6] >> theCurrentTemp.entry[iy][jx].spare[7] - >> theCurrentTemp.entry[iy][jx].spare[8] >> theCurrentTemp.entry[iy][jx].spare[9]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - in_file >> theCurrentTemp.entry[iy][jx].spare[10] >> theCurrentTemp.entry[iy][jx].spare[11] >> theCurrentTemp.entry[iy][jx].spare[12] >> theCurrentTemp.entry[iy][jx].spare[13] - >> theCurrentTemp.entry[iy][jx].spare[14] >> theCurrentTemp.entry[iy][jx].spare[15] >> theCurrentTemp.entry[iy][jx].spare[16] >> theCurrentTemp.entry[iy][jx].spare[17] - >> theCurrentTemp.entry[iy][jx].spare[18] >> theCurrentTemp.entry[iy][jx].spare[19]; - - if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - } - - } - - - in_file.close(); - - // Add this template to the store - - thePixelTemp_.push_back(theCurrentTemp); - - return true; - - } else { - - // If file didn't open, report this - - LOGERROR("SiPixelTemplate2D") << "Error opening File" << tempfile << ENDL; - return false; - - } - -} // TempInit - - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - -//**************************************************************** -//! This routine initializes the global template structures from an -//! external file template_summary_zpNNNN where NNNN are four digits -//! \param dbobject - db storing multiple template calibrations -//**************************************************************** -bool SiPixelTemplate2D::pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & thePixelTemp_) -{ - // Add template stored in external dbobject to theTemplateStore - - // Local variables - int i, j, k, l, iy, jx; - // const char *tempfile; - const int code_version={16}; - - // We must create a new object because dbobject must be a const and our stream must not be - SiPixelTemplateDBObject db = dbobject; - - // Create a local template storage entry - SiPixelTemplateStore2D theCurrentTemp; - - // Fill the template storage for each template calibration stored in the db - for(int m=0; m> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx - >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale - >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file, no template load" << ENDL; return false;} - - LOGINFO("SiPixelTemplate2D") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield - << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype - << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature " - << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale - << ", 1/2 threshold " << theCurrentTemp.head.s50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", x Lorentz width " << theCurrentTemp.head.lorxwidth - << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL; - - if(theCurrentTemp.head.templ_version != code_version) {LOGERROR("SiPixelTemplate2D") << "code expects version " << code_version << ", no template load" << ENDL; return false;} - - if(theCurrentTemp.head.NTy != 0) {LOGERROR("SiPixelTemplate2D") << "Trying to load 1-d template info into the 2-d template object, check your DB/global tag!" << ENDL; return false;} - - // next, layout the 2-d structure needed to store template - - theCurrentTemp.entry.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); - - // Read in the file info - - for (iy=0; iy < theCurrentTemp.head.NTyx; ++iy) { - for(jx=0; jx < theCurrentTemp.head.NTxx; ++jx) { - - db >> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0] - >> theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - // Calculate cot(alpha) and cot(beta) for this entry - - theCurrentTemp.entry[iy][jx].cotalpha = theCurrentTemp.entry[iy][jx].costrk[0]/theCurrentTemp.entry[iy][jx].costrk[2]; - - theCurrentTemp.entry[iy][jx].cotbeta = theCurrentTemp.entry[iy][jx].costrk[1]/theCurrentTemp.entry[iy][jx].costrk[2]; - - db >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >> theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin - >> theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >> theCurrentTemp.entry[iy][jx].jxmax; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - for (k=0; k<2; ++k) { - - db >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1] - >> theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >> theCurrentTemp.entry[iy][jx].xypar[k][4]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - } - - for (k=0; k<2; ++k) { - - db >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1] - >> theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >> theCurrentTemp.entry[iy][jx].lanpar[k][4]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - } - - for (l=0; l<7; ++l) { - for (k=0; k<7; ++k) { - for (j=0; j> theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j];} - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - } - } - } - - - db >> theCurrentTemp.entry[iy][jx].chi2minone >> theCurrentTemp.entry[iy][jx].chi2avgone >> theCurrentTemp.entry[iy][jx].chi2min[0] >> theCurrentTemp.entry[iy][jx].chi2avg[0] - >> theCurrentTemp.entry[iy][jx].chi2min[1] >> theCurrentTemp.entry[iy][jx].chi2avg[1]>> theCurrentTemp.entry[iy][jx].chi2min[2] >> theCurrentTemp.entry[iy][jx].chi2avg[2] - >> theCurrentTemp.entry[iy][jx].chi2min[3] >> theCurrentTemp.entry[iy][jx].chi2avg[3]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - db >> theCurrentTemp.entry[iy][jx].spare[0] >> theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2] >> theCurrentTemp.entry[iy][jx].spare[3] - >> theCurrentTemp.entry[iy][jx].spare[4] >> theCurrentTemp.entry[iy][jx].spare[5] >> theCurrentTemp.entry[iy][jx].spare[6] >> theCurrentTemp.entry[iy][jx].spare[7] - >> theCurrentTemp.entry[iy][jx].spare[8] >> theCurrentTemp.entry[iy][jx].spare[9]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - db >> theCurrentTemp.entry[iy][jx].spare[10] >> theCurrentTemp.entry[iy][jx].spare[11] >> theCurrentTemp.entry[iy][jx].spare[12] >> theCurrentTemp.entry[iy][jx].spare[13] - >> theCurrentTemp.entry[iy][jx].spare[14] >> theCurrentTemp.entry[iy][jx].spare[15] >> theCurrentTemp.entry[iy][jx].spare[16] >> theCurrentTemp.entry[iy][jx].spare[17] - >> theCurrentTemp.entry[iy][jx].spare[18] >> theCurrentTemp.entry[iy][jx].spare[19]; - - if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} - - } - } - - } - - - // Add this template to the store - - thePixelTemp_.push_back(theCurrentTemp); - - return true; - -} // TempInit - -#endif - - - -// ************************************************************************************************************************************* -//! Interpolate stored 2-D information for input angles and hit position to make a 2-D template -//! \param id - (input) the id of the template -//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) -//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) -//! \param locBz - (input) the sign of this quantity is used to determine whether to flip cot(beta)<0 quantities from cot(beta)>0 (FPix only) -//! for FPix IP-related tracks, locBz < 0 for cot(beta) > 0 and locBz > 0 for cot(beta) < 0 -//! \param xhit - (input) x-position of hit relative to the lower left corner of pixel[1][1] (to allow for the "padding" of the two-d clusters in the splitter) -//! \param yhit - (input) y-position of hit relative to the lower left corner of pixel[1][1] -//! \param ydouble - (input) STL vector of 21 element array to flag a double-pixel starting at cluster[1][1] -//! \param xdouble - (input) STL vector of 11 element array to flag a double-pixel starting at cluster[1][1] -//! \param template2d - (output) 2d template of size matched to the cluster. Input must be zeroed since charge is added only. -// ************************************************************************************************************************************* - -bool SiPixelTemplate2D::xytemp(int id, float cotalpha, float cotbeta, float locBz, float xhit, float yhit, std::vector& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]) -{ - // Interpolate for a new set of track angles - - // Local variables - int i, j; - int pixx, pixy, k0, k1, l0, l1, imidx, deltax, deltay, iflipy, imin, imax, jmin, jmax; - int m, n; - float acotb, dcota, dcotb, dx, dy, ddx, ddy, adx, ady, tmpxy; - bool flip_y; - // std::vector xrms(4), xgsig(4), xrmsc2m(4), xgsigc2m(4); - std::vector chi2xavg(4), chi2xmin(4); - - - // Check to see if interpolation is valid - - if(id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) { - - cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ = true; - - if(id != id_current_) { - - // Find the index corresponding to id - - index_id_ = -1; - for(i=0; i<(int)thePixelTemp_.size(); ++i) { - - if(id == thePixelTemp_[i].head.ID) { - - index_id_ = i; - id_current_ = id; - - // Copy the charge scaling factor to the private variable - - Dtype_ = thePixelTemp_[index_id_].head.Dtype; - - // Copy the charge scaling factor to the private variable - - qscale_ = thePixelTemp_[index_id_].head.qscale; - - // Copy the pseudopixel signal size to the private variable - - s50_ = thePixelTemp_[index_id_].head.s50; - - // Copy the Lorentz widths to private variables - - lorywidth_ = thePixelTemp_[index_id_].head.lorywidth; - lorxwidth_ = thePixelTemp_[index_id_].head.lorxwidth; - - // Copy the pixel sizes private variables - - xsize_ = thePixelTemp_[index_id_].head.xsize; - ysize_ = thePixelTemp_[index_id_].head.ysize; - zsize_ = thePixelTemp_[index_id_].head.zsize; - - // Determine the size of this template - - Nyx_ = thePixelTemp_[index_id_].head.NTyx; - Nxx_ = thePixelTemp_[index_id_].head.NTxx; -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(Nyx_ < 2 || Nxx_ < 2) { - throw cms::Exception("DataCorrupt") << "template ID = " << id_current_ << "has too few entries: Nyx/Nxx = " << Nyx_ << "/" << Nxx_ << std::endl; - } -#else - assert(Nyx_ > 1 && Nxx_ > 1); -#endif - imidx = Nxx_/2; - - cotalpha0_ = thePixelTemp_[index_id_].entry[0][0].cotalpha; - cotalpha1_ = thePixelTemp_[index_id_].entry[0][Nxx_-1].cotalpha; - deltacota_ = (cotalpha1_-cotalpha0_)/(float)(Nxx_-1); - - cotbeta0_ = thePixelTemp_[index_id_].entry[0][imidx].cotbeta; - cotbeta1_ = thePixelTemp_[index_id_].entry[Nyx_-1][imidx].cotbeta; - deltacotb_ = (cotbeta1_-cotbeta0_)/(float)(Nyx_-1); - - break; - } - } - } - } - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(index_id_ < 0 || index_id_ >= (int)thePixelTemp_.size()) { - throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::interpolate can't find needed template ID = " << id - << ", Are you using the correct global tag?" << std::endl; - } -#else - assert(index_id_ >= 0 && index_id_ < (int)thePixelTemp_.size()); -#endif - - // Check angle limits and et up interpolation parameters - - if(cotalpha < cotalpha0_) { - success_ = false; - jx0_ = 0; - jx1_ = 1; - adcota_ = 0.f; - } else if(cotalpha > cotalpha1_) { - success_ = false; - jx0_ = Nxx_ - 1; - jx1_ = jx0_ - 1; - adcota_ = 0.f; - } else { - jx0_ = (int)((cotalpha-cotalpha0_)/deltacota_+0.5f); - dcota = (cotalpha - (cotalpha0_ + jx0_*deltacota_))/deltacota_; - adcota_ = fabs(dcota); - if(dcota > 0.f) {jx1_ = jx0_ + 1;if(jx1_ > Nxx_-1) jx1_ = jx0_-1;} else {jx1_ = jx0_ - 1; if(jx1_ < 0) jx1_ = jx0_+1;} - } - - // Interpolate the absolute value of cot(beta) - - acotb = std::abs(cotbeta); - - if(acotb < cotbeta0_) { - success_ = false; - iy0_ = 0; - iy1_ = 1; - adcotb_ = 0.f; - } else if(acotb > cotbeta1_) { - success_ = false; - iy0_ = Nyx_ - 1; - iy1_ = iy0_ - 1; - adcotb_ = 0.f; - } else { - iy0_ = (int)((acotb-cotbeta0_)/deltacotb_+0.5f); - dcotb = (acotb - (cotbeta0_ + iy0_*deltacotb_))/deltacotb_; - adcotb_ = fabs(dcotb); - if(dcotb > 0.f) {iy1_ = iy0_ + 1; if(iy1_ > Nyx_-1) iy1_ = iy0_-1;} else {iy1_ = iy0_ - 1; if(iy1_ < 0) iy1_ = iy0_+1;} - } - - // This works only for IP-related tracks - - flip_y = false; - if(cotbeta < 0.f) {flip_y = true;} - - // If Fpix-related track has wrong cotbeta-field correlation, return false to trigger simple template instead - - if(Dtype_ == 1) { - if(cotbeta*locBz > 0.f) success_ = false; - } - - // Interpolate things in cot(alpha)-cot(beta) - - qavg_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].qavg - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].qavg - thePixelTemp_[index_id_].entry[iy0_][jx0_].qavg) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].qavg - thePixelTemp_[index_id_].entry[iy0_][jx0_].qavg); - - pixmax_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].pixmax - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].pixmax - thePixelTemp_[index_id_].entry[iy0_][jx0_].pixmax) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].pixmax - thePixelTemp_[index_id_].entry[iy0_][jx0_].pixmax); - - sxymax_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].sxymax - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].sxymax - thePixelTemp_[index_id_].entry[iy0_][jx0_].sxymax) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].sxymax - thePixelTemp_[index_id_].entry[iy0_][jx0_].sxymax); - - chi2avgone_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avgone - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2avgone - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avgone) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].chi2avgone - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avgone); - - chi2minone_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2minone - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2minone - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2minone) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].chi2minone - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2minone); - - for(i=0; i<4 ; ++i) { - chi2avg_[i] = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avg[i] - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2avg[i] - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avg[i]) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].chi2avg[i] - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avg[i]); - - chi2min_[i] = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2min[i] - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2min[i] - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2min[i]) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].chi2min[i] - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2min[i]); - } - - for(i=0; i<2 ; ++i) { - for(j=0; j<5 ; ++j) { - // Charge loss switches sides when cot(beta) changes sign - if(flip_y) { - xypary0x0_[1-i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].xypar[i][j]; - xypary1x0_[1-i][j] = thePixelTemp_[index_id_].entry[iy1_][jx0_].xypar[i][j]; - xypary0x1_[1-i][j] = thePixelTemp_[index_id_].entry[iy0_][jx1_].xypar[i][j]; - lanpar_[1-i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j] - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]); - } else { - xypary0x0_[i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].xypar[i][j]; - xypary1x0_[i][j] = thePixelTemp_[index_id_].entry[iy1_][jx0_].xypar[i][j]; - xypary0x1_[i][j] = thePixelTemp_[index_id_].entry[iy0_][jx1_].xypar[i][j]; - lanpar_[i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j] - +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]) - +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]); - } - } - } - - // next, determine the indices of the closest point in k (y-displacement), l (x-displacement) - // pixy and pixx are the indices of the struck pixel in the (Ty,Tx) system - // k0,k1 are the k-indices of the closest and next closest point - // l0,l1 are the l-indices of the closest and next closest point - - pixy = (int)floorf(yhit/ysize_); - dy = yhit-(pixy+0.5f)*ysize_; - if(flip_y) {dy = -dy;} - k0 = (int)(dy/ysize_*6.f+3.5f); - if(k0 < 0) k0 = 0; - if(k0 > 6) k0 = 6; - ddy = 6.f*dy/ysize_ - (k0-3); - ady = fabs(ddy); - if(ddy > 0.f) {k1 = k0 + 1; if(k1 > 6) k1 = k0-1;} else {k1 = k0 - 1; if(k1 < 0) k1 = k0+1;} - pixx = (int)floorf(xhit/xsize_); - dx = xhit-(pixx+0.5f)*xsize_; - l0 = (int)(dx/xsize_*6.f+3.5f); - if(l0 < 0) l0 = 0; - if(l0 > 6) l0 = 6; - ddx = 6.f*dx/xsize_ - (l0-3); - adx = fabs(ddx); - if(ddx > 0.f) {l1 = l0 + 1; if(l1 > 6) l1 = l0-1;} else {l1 = l0 - 1; if(l1 < 0) l1 = l0+1;} - - // OK, lets do the template interpolation. - - // First find the limits of the indices for non-zero pixels - - imin = std::min(thePixelTemp_[index_id_].entry[iy0_][jx0_].iymin,thePixelTemp_[index_id_].entry[iy1_][jx0_].iymin); - imin = std::min(imin,thePixelTemp_[index_id_].entry[iy0_][jx1_].iymin); - - jmin = std::min(thePixelTemp_[index_id_].entry[iy0_][jx0_].jxmin,thePixelTemp_[index_id_].entry[iy1_][jx0_].jxmin); - jmin = std::min(jmin,thePixelTemp_[index_id_].entry[iy0_][jx1_].jxmin); - - imax = std::max(thePixelTemp_[index_id_].entry[iy0_][jx0_].iymax,thePixelTemp_[index_id_].entry[iy1_][jx0_].iymax); - imax = std::max(imax,thePixelTemp_[index_id_].entry[iy0_][jx1_].iymax); - - jmax = std::max(thePixelTemp_[index_id_].entry[iy0_][jx0_].jxmax,thePixelTemp_[index_id_].entry[iy1_][jx0_].jxmax); - jmax = std::max(jmax,thePixelTemp_[index_id_].entry[iy0_][jx1_].jxmax); - - // Calculate the x and y offsets to make the new template - - // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system - - ++pixy; ++pixx; - - // In the template store, the struck pixel is always (THy,THx) - - deltax = pixx - T2HX; - deltay = pixy - T2HY; - - // First zero the local 2-d template - - for(j=0; j=0 && m<=BXM3 && n>=0 && n<=BYM3) { - tmpxy = thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j] - + adx*(thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l1][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j]) - + ady*(thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k1][l0][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j]) - + adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].xytemp[k0][l0][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j]) - + adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].xytemp[k0][l0][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j]); - if(tmpxy > 0.f) {xytemp_[m][n] = tmpxy;} else {xytemp_[m][n] = 0.f;} - } - } - } - - //combine rows and columns to simulate double pixels - - for(n=1; n 0.f) {template2d[m][n] += xytemp_[m][n];} - } - } - - return success_; -} // xytemp - - - -// ************************************************************************************************************************************* -//! Interpolate stored 2-D information for input angles and hit position to make a 2-D template -//! \param id - (input) the id of the template -//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) -//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) -//! \param xhit - (input) x-position of hit relative to the lower left corner of pixel[1][1] (to allow for the "padding" of the two-d clusters in the splitter) -//! \param yhit - (input) y-position of hit relative to the lower left corner of pixel[1][1] -//! \param ydouble - (input) STL vector of 21 element array to flag a double-pixel starting at cluster[1][1] -//! \param xdouble - (input) STL vector of 11 element array to flag a double-pixel starting at cluster[1][1] -//! \param template2d - (output) 2d template of size matched to the cluster. Input must be zeroed since charge is added only. -// ************************************************************************************************************************************* - -bool SiPixelTemplate2D::xytemp(int id, float cotalpha, float cotbeta, float xhit, float yhit, std::vector& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]) -{ - // Interpolate for a new set of track angles - - // Local variables - float locBz = -1; - if(cotbeta < 0.f) {locBz = -locBz;} - - return SiPixelTemplate2D::xytemp(id, cotalpha, cotbeta, locBz, xhit, yhit, ydouble, xdouble, template2d); - -} // xytemp - - - -// ************************************************************************************************************ -//! Return y error (squared) for an input signal and yindex -//! Add large Q scaling for use in cluster splitting. -//! \param qpixel - (input) pixel charge -//! \param index - (input) y-index index of pixel -//! \param xysig2 - (output) square error -// ************************************************************************************************************ -void SiPixelTemplate2D::xysigma2(float qpixel, int index, float& xysig2) - -{ - // Interpolate using quantities already stored in the private variables - - // Local variables - float sigi, sigi2, sigi3, sigi4, qscale, err2, err00; - - // Make sure that input is OK - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(index < 2 || index >= BYM2) { - throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::ysigma2 called with index = " << index << std::endl; - } -#else - assert(index > 1 && index < BYM2); -#endif - - // Define the maximum signal to use in the parameterization - - // Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis - - if(qpixel < sxymax_) { - sigi = qpixel; - qscale = 1.f; - } else { - sigi = sxymax_; - qscale = qpixel/sxymax_; - } - sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi; - if(index <= THXP1) { - err00 = xypary0x0_[0][0]+xypary0x0_[0][1]*sigi+xypary0x0_[0][2]*sigi2+xypary0x0_[0][3]*sigi3+xypary0x0_[0][4]*sigi4; - err2 = err00 - +adcota_*(xypary0x1_[0][0]+xypary0x1_[0][1]*sigi+xypary0x1_[0][2]*sigi2+xypary0x1_[0][3]*sigi3+xypary0x1_[0][4]*sigi4 - err00) - +adcotb_*(xypary1x0_[0][0]+xypary1x0_[0][1]*sigi+xypary1x0_[0][2]*sigi2+xypary1x0_[0][3]*sigi3+xypary1x0_[0][4]*sigi4 - err00); - } else { - err00 = xypary0x0_[1][0]+xypary0x0_[1][1]*sigi+xypary0x0_[1][2]*sigi2+xypary0x0_[1][3]*sigi3+xypary0x0_[1][4]*sigi4; - err2 = err00 - +adcota_*(xypary0x1_[1][0]+xypary0x1_[1][1]*sigi+xypary0x1_[1][2]*sigi2+xypary0x1_[1][3]*sigi3+xypary0x1_[1][4]*sigi4 - err00) - +adcotb_*(xypary1x0_[1][0]+xypary1x0_[1][1]*sigi+xypary1x0_[1][2]*sigi2+xypary1x0_[1][3]*sigi3+xypary1x0_[1][4]*sigi4 - err00); - } - xysig2 =qscale*err2; - if(xysig2 <= 0.f) {LOGERROR("SiPixelTemplate2D") << "neg y-error-squared, id = " << id_current_ << ", index = " << index_id_ << - ", cot(alpha) = " << cota_current_ << ", cot(beta) = " << cotb_current_ << ", sigi = " << sigi << ENDL;} - - return; - -} // End xysigma2 - - -// ************************************************************************************************************ -//! Return the Landau probability parameters for this set of cot(alpha, cot(beta) -// ************************************************************************************************************ -void SiPixelTemplate2D::landau_par(float lanpar[2][5]) - -{ - // Interpolate using quantities already stored in the private variables - - // Local variables - int i,j; - for(i=0; i<2; ++i) { - for(j=0; j<5; ++j) { - lanpar[i][j] = lanpar_[i][j]; - } - } - return; - -} // End lan_par - - - +// +// SiPixelTemplate2D.cc Version 2.35 +// +// Full 2-D templates for cluster splitting, simulated cluster reweighting, and improved cluster probability +// +// Created by Morris Swartz on 12/01/09. +// 2009 __TheJohnsHopkinsUniversity__. +// +// V1.01 - fix qavg_ filling +// V1.02 - Add locBz to test if FPix use is out of range +// V1.03 - Fix edge checking on final template to increase template size and to properly truncate cluster +// v2.00 - Major changes to accommodate 2D reconstruction +// v2.10 - Change chi2 and error scaling information to work with partially reconstructed clusters +// v2.20 - Add cluster charge probability information, side loading for template generation +// v2.21 - Double derivative interval [improves fit convergence] +// v2.25 - Resize template store to accommodate FPix Templates +// v2.30 - Fix bug found by P. Shuetze that compromises sqlite file loading +// v2.35 - Add directory path selection to the ascii pushfile method +// V2.36 - Move templateStore to the heap, fix variable name in pushfile() +// + +//#include +//#include +#ifndef SI_PIXEL_TEMPLATE_STANDALONE +//#include +#else +#include +#endif +#include +#include +//#include "boost/multi_array.hpp" +#include +#include +#include +#include + + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#define LOGERROR(x) LogError(x) +#define LOGINFO(x) LogInfo(x) +#define ENDL " " +#include "FWCore/Utilities/interface/Exception.h" +using namespace edm; +#else +#include "SiPixelTemplate2D.h" +#define LOGERROR(x) std::cout << x << ": " +#define LOGINFO(x) std::cout << x << ": " +#define ENDL std::endl +#endif + +//**************************************************************** +//! This routine initializes the global template structures from +//! an external file template_summary_zpNNNN where NNNN are four +//! digits of filenum. +//! \param filenum - an integer NNNN used in the filename template_summary_zpNNNN +//**************************************************************** +bool SiPixelTemplate2D::pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & pixelTemp, std::string dir) +{ + // Add template stored in external file numbered filenum to theTemplateStore + + // Local variables + int i, j, k, l, iy, jx; + const char *tempfile; + // char title[80]; remove this + char c; + const int code_version={21}; + + + + // Create a filename for this run + + std::ostringstream tout; + + // Create different path in CMSSW than standalone + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + tout << dir << "template_summary2D_zp" + << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; + std::string tempf = tout.str(); + edm::FileInPath file( tempf.c_str() ); + tempfile = (file.fullPath()).c_str(); +#else + tout << "template_summary2D_zp" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; + std::string tempf = tout.str(); + tempfile = tempf.c_str(); +#endif + + // open the template file + + std::ifstream in_file(tempfile, std::ios::in); + + if(in_file.is_open()) { + + // Create a local template storage entry + + SiPixelTemplateStore2D theCurrentTemp; + + // Read-in a header string first and print it + + for (i=0; (c=in_file.get()) != '\n'; ++i) { + if(i < 79) {theCurrentTemp.head.title[i] = c;} + } + if(i > 78) {i=78;} + theCurrentTemp.head.title[i+1] ='\0'; + LOGINFO("SiPixelTemplate2D") << "Loading Pixel Template File - " << theCurrentTemp.head.title << ENDL; + + // next, the header information + in_file >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx + >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale + >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 0A, no template load" << ENDL; return false;} + + if(theCurrentTemp.head.templ_version > 17) { + in_file >> theCurrentTemp.head.ss50 >> theCurrentTemp.head.lorybias + >> theCurrentTemp.head.lorxbias >> theCurrentTemp.head.fbin[0] + >> theCurrentTemp.head.fbin[1] >> theCurrentTemp.head.fbin[2]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 0B, no template load" + << ENDL; return false;} + } else { + theCurrentTemp.head.ss50 = theCurrentTemp.head.s50; + theCurrentTemp.head.lorybias = theCurrentTemp.head.lorywidth/2.f; + theCurrentTemp.head.lorxbias = theCurrentTemp.head.lorxwidth/2.f; + theCurrentTemp.head.fbin[0] = 1.5f; + theCurrentTemp.head.fbin[1] = 1.00f; + theCurrentTemp.head.fbin[2] = 0.85f; + } + + LOGINFO("SiPixelTemplate2D") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield + << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype + << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature " + << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale + << ", 1/2 multi dcol threshold " << theCurrentTemp.head.s50 << ", 1/2 single dcol threshold " << theCurrentTemp.head.ss50 + << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", y Lorentz Bias " << theCurrentTemp.head.lorybias + << ", x Lorentz width " << theCurrentTemp.head.lorxwidth << ", x Lorentz Bias " << theCurrentTemp.head.lorxbias + << ", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.head.fbin[0] << ", " << theCurrentTemp.head.fbin[1] + << ", " << theCurrentTemp.head.fbin[2] + << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL; + + if(theCurrentTemp.head.templ_version < code_version) {LOGERROR("SiPixelTemplate2D") << "code expects version " << code_version << ", no template load" << ENDL; return false;} + + if(theCurrentTemp.head.NTy != 0) {LOGERROR("SiPixelTemplate2D") << "Trying to load 1-d template info into the 2-d template object, check your DB/global tag!" << ENDL; return false;} + + +#ifdef SI_PIXEL_TEMPLATE_USE_BOOST + + // next, layout the 2-d structure needed to store template + + theCurrentTemp.entry.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); + +#endif + + // Read in the file info + + for (iy=0; iy < theCurrentTemp.head.NTyx; ++iy) { + for(jx=0; jx < theCurrentTemp.head.NTxx; ++jx) { + + in_file >> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0] + >> theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + // Calculate cot(alpha) and cot(beta) for this entry + + theCurrentTemp.entry[iy][jx].cotalpha = theCurrentTemp.entry[iy][jx].costrk[0]/theCurrentTemp.entry[iy][jx].costrk[2]; + + theCurrentTemp.entry[iy][jx].cotbeta = theCurrentTemp.entry[iy][jx].costrk[1]/theCurrentTemp.entry[iy][jx].costrk[2]; + + in_file >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >> theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin + >> theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >> theCurrentTemp.entry[iy][jx].jxmax; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + for (k=0; k<2; ++k) { + + in_file >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1] + >> theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >> theCurrentTemp.entry[iy][jx].xypar[k][4]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + } + + for (k=0; k<2; ++k) { + + in_file >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1] + >> theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >> theCurrentTemp.entry[iy][jx].lanpar[k][4]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + } + + for (l=0; l<7; ++l) { + for (k=0; k<7; ++k) { + for (j=0; j> theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j];} + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + } + } + } + + + in_file >> theCurrentTemp.entry[iy][jx].chi2ppix >> theCurrentTemp.entry[iy][jx].chi2scale >> theCurrentTemp.entry[iy][jx].offsetx[0] >> theCurrentTemp.entry[iy][jx].offsetx[1] + >> theCurrentTemp.entry[iy][jx].offsetx[2] >> theCurrentTemp.entry[iy][jx].offsetx[3]>> theCurrentTemp.entry[iy][jx].offsety[0] >> theCurrentTemp.entry[iy][jx].offsety[1] + >> theCurrentTemp.entry[iy][jx].offsety[2] >> theCurrentTemp.entry[iy][jx].offsety[3]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + in_file >> theCurrentTemp.entry[iy][jx].clsleny >> theCurrentTemp.entry[iy][jx].clslenx >> theCurrentTemp.entry[iy][jx].mpvvav >> theCurrentTemp.entry[iy][jx].sigmavav + >> theCurrentTemp.entry[iy][jx].kappavav >> theCurrentTemp.entry[iy][jx].scalexavg >> theCurrentTemp.entry[iy][jx].scaleyavg >> theCurrentTemp.entry[iy][jx].delyavg >> theCurrentTemp.entry[iy][jx].delysig >> theCurrentTemp.entry[iy][jx].spare[0]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + in_file >> theCurrentTemp.entry[iy][jx].scalex[0] >> theCurrentTemp.entry[iy][jx].scalex[1] >> theCurrentTemp.entry[iy][jx].scalex[2] >> theCurrentTemp.entry[iy][jx].scalex[3] + >> theCurrentTemp.entry[iy][jx].scaley[0] >> theCurrentTemp.entry[iy][jx].scaley[1] >> theCurrentTemp.entry[iy][jx].scaley[2] >> theCurrentTemp.entry[iy][jx].scaley[3] + >> theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2]; + + if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + } + + } + + + in_file.close(); + + // Add this template to the store + + pixelTemp.push_back(theCurrentTemp); + + return true; + + } else { + + // If file didn't open, report this + + LOGERROR("SiPixelTemplate2D") << "Error opening File" << tempfile << ENDL; + return false; + + } + +} // TempInit + + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + +//**************************************************************** +//! This routine initializes the global template structures from an +//! external file template_summary_zpNNNN where NNNN are four digits +//! \param dbobject - db storing multiple template calibrations +//**************************************************************** +bool SiPixelTemplate2D::pushfile(const SiPixel2DTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & pixelTemp) +{ + // Add template stored in external dbobject to theTemplateStore + + // Local variables + int i, j, k, l, iy, jx; // &&& Do we need them? Move to the lowest scope... + // const char *tempfile; + const int code_version={21}; + + // We must create a new object because dbobject must be a const and our stream must not be + SiPixel2DTemplateDBObject db = dbobject; + + // Create a local template storage entry + /// SiPixelTemplateStore2D theCurrentTemp; // can't do this (crashes): too large (14 MB) for stack! + auto tmpPtr = std::make_unique(); // must be allocated on the heap instead + auto & theCurrentTemp = *tmpPtr; + + // Fill the template storage for each template calibration stored in the db + for(int m=0; m> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx + >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale + >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 0A, no template load" << ENDL; return false;} + + LOGINFO("SiPixelTemplate2D") << "Loading Pixel Template File - " << theCurrentTemp.head.title + <<" code version = "< 17) { + db >> theCurrentTemp.head.ss50 >> theCurrentTemp.head.lorybias >> theCurrentTemp.head.lorxbias >> theCurrentTemp.head.fbin[0] >> theCurrentTemp.head.fbin[1] >> theCurrentTemp.head.fbin[2]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 0B, no template load" + << ENDL; return false;} + } else { + theCurrentTemp.head.ss50 = theCurrentTemp.head.s50; + theCurrentTemp.head.lorybias = theCurrentTemp.head.lorywidth/2.f; + theCurrentTemp.head.lorxbias = theCurrentTemp.head.lorxwidth/2.f; + theCurrentTemp.head.fbin[0] = 1.50f; + theCurrentTemp.head.fbin[1] = 1.00f; + theCurrentTemp.head.fbin[2] = 0.85f; + //std::cout<<" set fbin "<< theCurrentTemp.head.fbin[0]<<" "<> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0] + >> theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + // Calculate cot(alpha) and cot(beta) for this entry + + theCurrentTemp.entry[iy][jx].cotalpha = theCurrentTemp.entry[iy][jx].costrk[0]/theCurrentTemp.entry[iy][jx].costrk[2]; + + theCurrentTemp.entry[iy][jx].cotbeta = theCurrentTemp.entry[iy][jx].costrk[1]/theCurrentTemp.entry[iy][jx].costrk[2]; + + db >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >> theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin + >> theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >> theCurrentTemp.entry[iy][jx].jxmax; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + for (k=0; k<2; ++k) { + + db >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1] + >> theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >> theCurrentTemp.entry[iy][jx].xypar[k][4]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + } + + for (k=0; k<2; ++k) { + + db >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1] + >> theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >> theCurrentTemp.entry[iy][jx].lanpar[k][4]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + } + + for (l=0; l<7; ++l) { + for (k=0; k<7; ++k) { + for (j=0; j> theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j];} + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + } + } + } + + db >> theCurrentTemp.entry[iy][jx].chi2ppix >> theCurrentTemp.entry[iy][jx].chi2scale >> theCurrentTemp.entry[iy][jx].offsetx[0] >> theCurrentTemp.entry[iy][jx].offsetx[1] + >> theCurrentTemp.entry[iy][jx].offsetx[2] >> theCurrentTemp.entry[iy][jx].offsetx[3]>> theCurrentTemp.entry[iy][jx].offsety[0] >> theCurrentTemp.entry[iy][jx].offsety[1] + >> theCurrentTemp.entry[iy][jx].offsety[2] >> theCurrentTemp.entry[iy][jx].offsety[3]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + db >> theCurrentTemp.entry[iy][jx].clsleny >> theCurrentTemp.entry[iy][jx].clslenx >> theCurrentTemp.entry[iy][jx].mpvvav >> theCurrentTemp.entry[iy][jx].sigmavav + >> theCurrentTemp.entry[iy][jx].kappavav >> theCurrentTemp.entry[iy][jx].scalexavg >> theCurrentTemp.entry[iy][jx].scaleyavg >> theCurrentTemp.entry[iy][jx].delyavg >> theCurrentTemp.entry[iy][jx].delysig >> theCurrentTemp.entry[iy][jx].spare[0]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + db >> theCurrentTemp.entry[iy][jx].scalex[0] >> theCurrentTemp.entry[iy][jx].scalex[1] >> theCurrentTemp.entry[iy][jx].scalex[2] >> theCurrentTemp.entry[iy][jx].scalex[3] + >> theCurrentTemp.entry[iy][jx].scaley[0] >> theCurrentTemp.entry[iy][jx].scaley[1] >> theCurrentTemp.entry[iy][jx].scaley[2] >> theCurrentTemp.entry[iy][jx].scaley[3] + >> theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2]; + + if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;} + + + } + } + +// Add this template to the store + + pixelTemp.push_back(theCurrentTemp); + + } + + + return true; + +} // TempInit + +#endif + + +// ************************************************************************************************************************************* +//! Interpolate stored 2-D information for input angles +//! \param id - (input) the id of the template +//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) +//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) +//! \param locBz - (input) the sign of this quantity is used to determine whether to flip cot(beta)<0 quantities from cot(beta)>0 (FPix only) +//! for Phase 0 FPix IP-related tracks, locBz < 0 for cot(beta) > 0 and locBz > 0 for cot(beta) < 0 +//! for Phase 1 FPix IP-related tracks, see next comment +//! \param locBx - (input) the sign of this quantity is used to determine whether to flip cot(alpha/beta)<0 quantities from cot(alpha/beta)>0 (FPix only) +//! for Phase 1 FPix IP-related tracks, locBx/locBz > 0 for cot(alpha) > 0 and locBx/locBz < 0 for cot(alpha) < 0 +//! for Phase 1 FPix IP-related tracks, locBx > 0 for cot(beta) > 0 and locBx < 0 for cot(beta) < 0 +// ************************************************************************************************************************************* + +bool SiPixelTemplate2D::interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx) +{ + + + // Interpolate for a new set of track angles + + // Local variables + int i, j, imidx; + // int pixx, pixy, k0, k1, l0, l1, deltax, deltay, iflipy, jflipx, imin, imax, jmin, jmax; + // int m, n; + float acotb, dcota, dcotb; + + // Check to see if interpolation is valid + + if(id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) { + + cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ = true; + + if(id != id_current_) { + + // Find the index corresponding to id + + index_id_ = -1; + for(i=0; i<(int)thePixelTemp_.size(); ++i) { + + if(id == thePixelTemp_[i].head.ID) { + + index_id_ = i; + id_current_ = id; + + // Copy the charge scaling factor to the private variable + + Dtype_ = thePixelTemp_[index_id_].head.Dtype; + + // Copy the charge scaling factor to the private variable + + qscale_ = thePixelTemp_[index_id_].head.qscale; + + // Copy the pseudopixel signal size to the private variable + + s50_ = thePixelTemp_[index_id_].head.s50; + + // Copy Qbinning info to private variables + + for(j=0; j<3; ++j) {fbin_[j] = thePixelTemp_[index_id_].head.fbin[j];} + + // Copy the Lorentz widths to private variables + + lorywidth_ = thePixelTemp_[index_id_].head.lorywidth; + lorxwidth_ = thePixelTemp_[index_id_].head.lorxwidth; + + // Copy the pixel sizes private variables + + xsize_ = thePixelTemp_[index_id_].head.xsize; + ysize_ = thePixelTemp_[index_id_].head.ysize; + zsize_ = thePixelTemp_[index_id_].head.zsize; + + // Determine the size of this template + + Nyx_ = thePixelTemp_[index_id_].head.NTyx; + Nxx_ = thePixelTemp_[index_id_].head.NTxx; +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + if(Nyx_ < 2 || Nxx_ < 2) { + throw cms::Exception("DataCorrupt") << "template ID = " << id_current_ << "has too few entries: Nyx/Nxx = " << Nyx_ << "/" << Nxx_ << std::endl; + } +#else + assert(Nyx_ > 1 && Nxx_ > 1); +#endif + imidx = Nxx_/2; + + cotalpha0_ = thePixelTemp_[index_id_].entry[0][0].cotalpha; + cotalpha1_ = thePixelTemp_[index_id_].entry[0][Nxx_-1].cotalpha; + deltacota_ = (cotalpha1_-cotalpha0_)/(float)(Nxx_-1); + + cotbeta0_ = thePixelTemp_[index_id_].entry[0][imidx].cotbeta; + cotbeta1_ = thePixelTemp_[index_id_].entry[Nyx_-1][imidx].cotbeta; + deltacotb_ = (cotbeta1_-cotbeta0_)/(float)(Nyx_-1); + + break; + } + } + } + } + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + if(index_id_ < 0 || index_id_ >= (int)thePixelTemp_.size()) { + throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::interpolate can't find needed template ID = " << id + << ", Are you using the correct global tag?" << std::endl; + } +#else + assert(index_id_ >= 0 && index_id_ < (int)thePixelTemp_.size()); +#endif + + // Check angle limits and et up interpolation parameters + + if(cotalpha < cotalpha0_) { + success_ = false; + jx0_ = 0; + jx1_ = 1; + adcota_ = 0.f; + } else if(cotalpha > cotalpha1_) { + success_ = false; + jx0_ = Nxx_ - 1; + jx1_ = jx0_ - 1; + adcota_ = 0.f; + } else { + jx0_ = (int)((cotalpha-cotalpha0_)/deltacota_+0.5f); + dcota = (cotalpha - (cotalpha0_ + jx0_*deltacota_))/deltacota_; + adcota_ = fabs(dcota); + if(dcota > 0.f) {jx1_ = jx0_ + 1;if(jx1_ > Nxx_-1) jx1_ = jx0_-1;} else {jx1_ = jx0_ - 1; if(jx1_ < 0) jx1_ = jx0_+1;} + } + + // Interpolate the absolute value of cot(beta) + + acotb = std::abs(cotbeta); + + if(acotb < cotbeta0_) { + success_ = false; + iy0_ = 0; + iy1_ = 1; + adcotb_ = 0.f; + } else if(acotb > cotbeta1_) { + success_ = false; + iy0_ = Nyx_ - 1; + iy1_ = iy0_ - 1; + adcotb_ = 0.f; + } else { + iy0_ = (int)((acotb-cotbeta0_)/deltacotb_+0.5f); + dcotb = (acotb - (cotbeta0_ + iy0_*deltacotb_))/deltacotb_; + adcotb_ = fabs(dcotb); + if(dcotb > 0.f) {iy1_ = iy0_ + 1; if(iy1_ > Nyx_-1) iy1_ = iy0_-1;} else {iy1_ = iy0_ - 1; if(iy1_ < 0) iy1_ = iy0_+1;} + } + + // This works only for IP-related tracks + + flip_x_ = false; + flip_y_ = false; + switch(Dtype_) { + case 0: + if(cotbeta < 0.f) {flip_y_ = true;} + break; + case 1: + if(locBz > 0.f) { + flip_y_ = true; + } + break; + case 2: + case 3: + case 4: + case 5: + if(locBx*locBz < 0.f) { + flip_x_ = true; + } + if(locBx < 0.f) { + flip_y_ = true; + } + break; + default: +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; +#else + std::cout << "SiPixelTemplate:2D:illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl; +#endif + } + + // Calculate signed quantities + + lorydrift_ = lorywidth_/2.; + if(flip_y_) lorydrift_ = -lorydrift_; + lorxdrift_ = lorxwidth_/2.; + if(flip_x_) lorxdrift_ = -lorxdrift_; + + // Use pointers to the three angle pairs used in the interpolation + + + entry00_ = &thePixelTemp_[index_id_].entry[iy0_][jx0_]; + entry10_ = &thePixelTemp_[index_id_].entry[iy1_][jx0_]; + entry01_ = &thePixelTemp_[index_id_].entry[iy0_][jx1_]; + + // Interpolate things in cot(alpha)-cot(beta) + + qavg_ = entry00_->qavg + +adcota_*(entry01_->qavg - entry00_->qavg) + +adcotb_*(entry10_->qavg - entry00_->qavg); + + pixmax_ = entry00_->pixmax + +adcota_*(entry01_->pixmax - entry00_->pixmax) + +adcotb_*(entry10_->pixmax - entry00_->pixmax); + + sxymax_ = entry00_->sxymax + +adcota_*(entry01_->sxymax - entry00_->sxymax) + +adcotb_*(entry10_->sxymax - entry00_->sxymax); + + chi2avgone_ = entry00_->chi2avgone + +adcota_*(entry01_->chi2avgone - entry00_->chi2avgone) + +adcotb_*(entry10_->chi2avgone - entry00_->chi2avgone); + + chi2minone_ = entry00_->chi2minone + +adcota_*(entry01_->chi2minone - entry00_->chi2minone) + +adcotb_*(entry10_->chi2minone - entry00_->chi2minone); + + clsleny_ = entry00_->clsleny + +adcota_*(entry01_->clsleny - entry00_->clsleny) + +adcotb_*(entry10_->clsleny - entry00_->clsleny); + + clslenx_ = entry00_->clslenx + +adcota_*(entry01_->clslenx - entry00_->clslenx) + +adcotb_*(entry10_->clslenx - entry00_->clslenx); + + + chi2ppix_ = entry00_->chi2ppix + +adcota_*(entry01_->chi2ppix - entry00_->chi2ppix) + +adcotb_*(entry10_->chi2ppix - entry00_->chi2ppix); + + chi2scale_ = entry00_->chi2scale + +adcota_*(entry01_->chi2scale - entry00_->chi2scale) + +adcotb_*(entry10_->chi2scale - entry00_->chi2scale); + + scaleyavg_ = entry00_->scaleyavg + +adcota_*(entry01_->scaleyavg - entry00_->scaleyavg) + +adcotb_*(entry10_->scaleyavg - entry00_->scaleyavg); + + scalexavg_ = entry00_->scalexavg + +adcota_*(entry01_->scalexavg - entry00_->scalexavg) + +adcotb_*(entry10_->scalexavg - entry00_->scalexavg); + + delyavg_ = entry00_->delyavg + +adcota_*(entry01_->delyavg - entry00_->delyavg) + +adcotb_*(entry10_->delyavg - entry00_->delyavg); + + delysig_ = entry00_->delysig + +adcota_*(entry01_->delysig - entry00_->delysig) + +adcotb_*(entry10_->delysig - entry00_->delysig); + + mpvvav_ = entry00_->mpvvav + +adcota_*(entry01_->mpvvav - entry00_->mpvvav) + +adcotb_*(entry10_->mpvvav - entry00_->mpvvav); + + sigmavav_ = entry00_->sigmavav + +adcota_*(entry01_->sigmavav - entry00_->sigmavav) + +adcotb_*(entry10_->sigmavav - entry00_->sigmavav); + + kappavav_ = entry00_->kappavav + +adcota_*(entry01_->kappavav - entry00_->kappavav) + +adcotb_*(entry10_->kappavav - entry00_->kappavav); + + for(i=0; i<4 ; ++i) { + scalex_[i] = entry00_->scalex[i] + +adcota_*(entry01_->scalex[i] - entry00_->scalex[i]) + +adcotb_*(entry10_->scalex[i] - entry00_->scalex[i]); + + scaley_[i] = entry00_->scaley[i] + +adcota_*(entry01_->scaley[i] - entry00_->scaley[i]) + +adcotb_*(entry10_->scaley[i] - entry00_->scaley[i]); + + offsetx_[i] = entry00_->offsetx[i] + +adcota_*(entry01_->offsetx[i] - entry00_->offsetx[i]) + +adcotb_*(entry10_->offsetx[i] - entry00_->offsetx[i]); + if(flip_x_) offsetx_[i] = -offsetx_[i]; + + offsety_[i] = entry00_->offsety[i] + +adcota_*(entry01_->offsety[i] - entry00_->offsety[i]) + +adcotb_*(entry10_->offsety[i] - entry00_->offsety[i]); + if(flip_y_) offsety_[i] = -offsety_[i]; + } + + for(i=0; i<2 ; ++i) { + for(j=0; j<5 ; ++j) { + // Charge loss switches sides when cot(beta) changes sign + if(flip_y_) { + xypary0x0_[1-i][j] = entry00_->xypar[i][j]; + xypary1x0_[1-i][j] = entry10_->xypar[i][j]; + xypary0x1_[1-i][j] = entry01_->xypar[i][j]; + lanpar_[1-i][j] = entry00_->lanpar[i][j] + +adcota_*(entry01_->lanpar[i][j] - entry00_->lanpar[i][j]) + +adcotb_*(entry10_->lanpar[i][j] - entry00_->lanpar[i][j]); + } else { + xypary0x0_[i][j] = entry00_->xypar[i][j]; + xypary1x0_[i][j] = entry10_->xypar[i][j]; + xypary0x1_[i][j] = entry01_->xypar[i][j]; + lanpar_[i][j] = entry00_->lanpar[i][j] + +adcota_*(entry01_->lanpar[i][j] - entry00_->lanpar[i][j]) + +adcotb_*(entry10_->lanpar[i][j] - entry00_->lanpar[i][j]); + } + } + } + + return success_; +} // interpolate + + +// ************************************************************************************************************************************* +//! Load template info for single angle point to invoke template reco for template generation +//! \param entry - (input) pointer to template entry +//! \param sizex - (input) pixel x-size +//! \param sizey - (input) pixel y-size +//! \param sizez - (input) pixel z-size +// ************************************************************************************************************************************* + +void SiPixelTemplate2D::sideload(SiPixelTemplateEntry2D* entry, int iDtype, float locBx, float locBz, float lorwdy, float lorwdx, float q50, float fbin[3], float xsize, float ysize, float zsize) +{ + + // Set class variables to the input parameters + + entry00_ = entry; + entry01_ = entry; + entry10_ = entry; + Dtype_ = iDtype; + lorywidth_ = lorwdy; + lorxwidth_ = lorwdx; + xsize_ = xsize; + ysize_ = ysize; + zsize_ = zsize; + s50_ = q50; + qscale_ = 1.f; + for(int i=0; i<3; ++i) {fbin_[i] = fbin[i];} + + // Set other class variables + + adcota_ = 0.f; + adcotb_ = 0.f; + + // Interpolate things in cot(alpha)-cot(beta) + + qavg_ = entry00_->qavg; + + pixmax_ = entry00_->pixmax; + + sxymax_ = entry00_->sxymax; + + clsleny_ = entry00_->clsleny; + + clslenx_ = entry00_->clslenx; + + scaleyavg_ = 1.f; + + scalexavg_ = 1.f; + + delyavg_ = 0.f; + + delysig_ = 0.f; + + for(int i=0; i<4 ; ++i) { + scalex_[i] = 1.f; + scaley_[i] = 1.f; + offsetx_[i] = 0.f; + offsety_[i] = 0.f; + } + + // This works only for IP-related tracks + + flip_x_ = false; + flip_y_ = false; + float cotbeta = entry00_->cotbeta; + switch(Dtype_) { + case 0: + if(cotbeta < 0.f) {flip_y_ = true;} + break; + case 1: + if(locBz > 0.f) { + flip_y_ = true; + } + break; + case 2: + case 3: + case 4: + case 5: + if(locBx*locBz < 0.f) { + flip_x_ = true; + } + if(locBx < 0.f) { + flip_y_ = true; + } + break; + default: +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::illegal subdetector ID = " << iDtype << std::endl; +#else + std::cout << "SiPixelTemplate:2D:illegal subdetector ID = " << iDtype << std::endl; +#endif + } + + // Calculate signed quantities + + lorydrift_ = lorywidth_/2.; + if(flip_y_) lorydrift_ = -lorydrift_; + lorxdrift_ = lorxwidth_/2.; + if(flip_x_) lorxdrift_ = -lorxdrift_; + + for(int i=0; i<2 ; ++i) { + for(int j=0; j<5 ; ++j) { + // Charge loss switches sides when cot(beta) changes sign + if(flip_y_) { + xypary0x0_[1-i][j] = entry00_->xypar[i][j]; + xypary1x0_[1-i][j] = entry00_->xypar[i][j]; + xypary0x1_[1-i][j] = entry00_->xypar[i][j]; + lanpar_[1-i][j] = entry00_->lanpar[i][j]; + } else { + xypary0x0_[i][j] = entry00_->xypar[i][j]; + xypary1x0_[i][j] = entry00_->xypar[i][j]; + xypary0x1_[i][j] = entry00_->xypar[i][j]; + lanpar_[i][j] = entry00_->lanpar[i][j]; + } + } + } + return; +} + + +// ************************************************************************************************************************************* +//! \param xhit - (input) x-position of hit relative to the lower left corner of pixel[1][1] (to allow for the "padding" of the two-d clusters in the splitter) +//! \param yhit - (input) y-position of hit relative to the lower left corner of pixel[1][1] +//! \param ydouble - (input) STL vector of 21 element array to flag a double-pixel starting at cluster[1][1] +//! \param xdouble - (input) STL vector of 11 element array to flag a double-pixel starting at cluster[1][1] +//! \param template2d - (output) 2d template of size matched to the cluster. Input must be zeroed since charge is added only. +// ************************************************************************************************************************************* + +bool SiPixelTemplate2D::xytemp(float xhit, float yhit, bool ydouble[BYM2], bool xdouble[BXM2], float template2d[BXM2][BYM2], bool derivatives, float dpdx2d[2][BXM2][BYM2], float& QTemplate) +{ + // Interpolate for a new set of track angles + + // Local variables + int i, j, k; + int pixx, pixy, k0, k1, l0, l1, deltax, deltay, iflipy, jflipx, imin, imax, jmin, jmax; + int m, n; + float dx, dy, ddx, ddy, adx, ady, tmpxy; +// const float deltaxy[2] = {8.33f, 12.5f}; + const float deltaxy[2] = {16.67f, 25.0f}; + + // Check to see if interpolation is valid + + + // next, determine the indices of the closest point in k (y-displacement), l (x-displacement) + // pixy and pixx are the indices of the struck pixel in the (Ty,Tx) system + // k0,k1 are the k-indices of the closest and next closest point + // l0,l1 are the l-indices of the closest and next closest point + + pixy = (int)floorf(yhit/ysize_); + dy = yhit-(pixy+0.5f)*ysize_; + if(flip_y_) {dy = -dy;} + k0 = (int)(dy/ysize_*6.f+3.5f); + if(k0 < 0) k0 = 0; + if(k0 > 6) k0 = 6; + ddy = 6.f*dy/ysize_ - (k0-3); + ady = fabs(ddy); + if(ddy > 0.f) {k1 = k0 + 1; if(k1 > 6) k1 = k0-1;} else {k1 = k0 - 1; if(k1 < 0) k1 = k0+1;} + pixx = (int)floorf(xhit/xsize_); + dx = xhit-(pixx+0.5f)*xsize_; + if(flip_x_) {dx = -dx;} + l0 = (int)(dx/xsize_*6.f+3.5f); + if(l0 < 0) l0 = 0; + if(l0 > 6) l0 = 6; + ddx = 6.f*dx/xsize_ - (l0-3); + adx = fabs(ddx); + if(ddx > 0.f) {l1 = l0 + 1; if(l1 > 6) l1 = l0-1;} else {l1 = l0 - 1; if(l1 < 0) l1 = l0+1;} + + // OK, lets do the template interpolation. + + // First find the limits of the indices for non-zero pixels + + imin = std::min(entry00_->iymin,entry10_->iymin); + imin_ = std::min(imin,entry01_->iymin); + + jmin = std::min(entry00_->jxmin,entry10_->jxmin); + jmin_ = std::min(jmin,entry01_->jxmin); + + imax = std::max(entry00_->iymax,entry10_->iymax); + imax_ = std::max(imax,entry01_->iymax); + + jmax = std::max(entry00_->jxmax,entry10_->jxmax); + jmax_ = std::max(jmax,entry01_->jxmax); + + // Calculate the x and y offsets to make the new template + + // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system + + ++pixy; ++pixx; + + // In the template store, the struck pixel is always (THy,THx) + + deltax = pixx - T2HX; + deltay = pixy - T2HY; + + // First zero the local 2-d template + + for(j=0; j=0 && m<=BXM3 && n>=0 && n<=BYM3) { + tmpxy = entry00_->xytemp[k0][l0][i][j] + + adx*(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) + + ady*(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcota_*(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcotb_*(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]); + if(tmpxy > 0.f) { + xytemp_[m][n] = tmpxy; + } else { + xytemp_[m][n] = 0.f; + } + } + } + } + + //combine rows and columns to simulate double pixels + + for(n=1; n 0.f) {template2d[m][n] += xytemp_[m][n]; qtemptot += xytemp_[m][n];} + } + } + + QTemplate = qtemptot; + + if(derivatives) { + + float dxytempdx[2][BXM2][BYM2], dxytempdy[2][BXM2][BYM2]; + + // First do shifted +x template + + pixx = (int)floorf((xhit+deltaxy[0])/xsize_); + dx = (xhit+deltaxy[0])-(pixx+0.5f)*xsize_; + if(flip_x_) {dx = -dx;} + l0 = (int)(dx/xsize_*6.f+3.5f); + if(l0 < 0) l0 = 0; + if(l0 > 6) l0 = 6; + ddx = 6.f*dx/xsize_ - (l0-3); + adx = fabs(ddx); + if(ddx > 0.f) {l1 = l0 + 1; if(l1 > 6) l1 = l0-1;} else {l1 = l0 - 1; if(l1 < 0) l1 = l0+1;} + + // OK, lets do the template interpolation. + + // Calculate the x and y offsets to make the new template + + // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system + + ++pixx; + + // In the template store, the struck pixel is always (THy,THx) + + deltax = pixx - T2HX; + + // First zero the local 2-d template + + for(k=0; k<2; ++k) {for(j=0; j=0 && m<=BXM3 && n>=0 && n<=BYM3) { + tmpxy = entry00_->xytemp[k0][l0][i][j] + + adx*(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) + + ady*(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcota_*(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcotb_*(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]); + if(tmpxy > 0.f) {dxytempdx[1][m][n] = tmpxy;} else {dxytempdx[1][m][n] = 0.f;} + } + } + } + + //combine rows and columns to simulate double pixels + + for(n=1; n 6) l0 = 6; + ddx = 6.f*dx/xsize_ - (l0-3); + adx = fabs(ddx); + if(ddx > 0.f) {l1 = l0 + 1; if(l1 > 6) l1 = l0-1;} else {l1 = l0 - 1; if(l1 < 0) l1 = l0+1;} + + // OK, lets do the template interpolation. + + // Calculate the x and y offsets to make the new template + + // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system + + ++pixx; + + // In the template store, the struck pixel is always (THy,THx) + + deltax = pixx - T2HX; + + // Loop over the non-zero part of the template index space and interpolate + + for(j=jmin_; j<=jmax_; ++j) { + // Flip indices as needed + if(flip_x_) {jflipx=T2XSIZE-1-j; m = deltax+jflipx;} else {m = deltax+j;} + for(i=imin_; i<=imax_; ++i) { + if(flip_y_) {iflipy=T2YSIZE-1-i; n = deltay+iflipy;} else {n = deltay+i;} + if(m>=0 && m<=BXM3 && n>=0 && n<=BYM3) { + tmpxy = entry00_->xytemp[k0][l0][i][j] + + adx*(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) + + ady*(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcota_*(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcotb_*(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]); + if(tmpxy > 0.f) {dxytempdx[0][m][n] = tmpxy;} else {dxytempdx[0][m][n] = 0.f;} + } + } + } + + //combine rows and columns to simulate double pixels + + for(n=1; n 6) k0 = 6; + ddy = 6.f*dy/ysize_ - (k0-3); + ady = fabs(ddy); + if(ddy > 0.f) {k1 = k0 + 1; if(k1 > 6) k1 = k0-1;} else {k1 = k0 - 1; if(k1 < 0) k1 = k0+1;} + pixx = (int)floorf(xhit/xsize_); + dx = xhit-(pixx+0.5f)*xsize_; + if(flip_x_) {dx = -dx;} + l0 = (int)(dx/xsize_*6.f+3.5f); + if(l0 < 0) l0 = 0; + if(l0 > 6) l0 = 6; + ddx = 6.f*dx/xsize_ - (l0-3); + adx = fabs(ddx); + if(ddx > 0.f) {l1 = l0 + 1; if(l1 > 6) l1 = l0-1;} else {l1 = l0 - 1; if(l1 < 0) l1 = l0+1;} + + // OK, lets do the template interpolation. + + // Calculate the x and y offsets to make the new template + + // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system + + ++pixy; ++pixx; + + // In the template store, the struck pixel is always (THy,THx) + + deltax = pixx - T2HX; + deltay = pixy - T2HY; + + // First zero the local 2-d template + + for(k=0; k<2; ++k) {for(j=0; j=0 && m<=BXM3 && n>=0 && n<=BYM3) { + tmpxy = entry00_->xytemp[k0][l0][i][j] + + adx*(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) + + ady*(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcota_*(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcotb_*(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]); + if(tmpxy > 0.f) {dxytempdy[1][m][n] = tmpxy;} else {dxytempdy[1][m][n] = 0.f;} + } + } + } + + //combine rows and columns to simulate double pixels + + for(n=1; n 6) k0 = 6; + ddy = 6.f*dy/ysize_ - (k0-3); + ady = fabs(ddy); + if(ddy > 0.f) {k1 = k0 + 1; if(k1 > 6) k1 = k0-1;} else {k1 = k0 - 1; if(k1 < 0) k1 = k0+1;} + + // OK, lets do the template interpolation. + + // Calculate the x and y offsets to make the new template + + // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system + + ++pixy; + + // In the template store, the struck pixel is always (THy,THx) + + deltay = pixy - T2HY; + + // Loop over the non-zero part of the template index space and interpolate + + for(j=jmin_; j<=jmax_; ++j) { + // Flip indices as needed + if(flip_x_) {jflipx=T2XSIZE-1-j; m = deltax+jflipx;} else {m = deltax+j;} + for(i=imin_; i<=imax_; ++i) { + if(flip_y_) {iflipy=T2YSIZE-1-i; n = deltay+iflipy;} else {n = deltay+i;} + if(m>=0 && m<=BXM3 && n>=0 && n<=BYM3) { + tmpxy = entry00_->xytemp[k0][l0][i][j] + + adx*(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) + + ady*(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcota_*(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) + + adcotb_*(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]); + if(tmpxy > 0.f) {dxytempdy[0][m][n] = tmpxy;} else {dxytempdy[0][m][n] = 0.f;} + } + } + } + + //combine rows and columns to simulate double pixels + + for(n=1; n& ydouble, std::vector& xdouble, float template2d[BXM2][BYM2]) +{ + + // Local variables + + bool derivatives = false; + float dpdx2d[2][BXM2][BYM2]; + float QTemplate; + float locBx = 1.f; + if(cotbeta < 0.f) {locBx = -1.f;} + float locBz = locBx; + if(cotalpha < 0.f) {locBz = -locBx;} + + bool yd[BYM2], xd[BXM2]; + + yd[0] = false; yd[BYM2-1] = false; + for(int i=0; i= BYM2) { + throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::ysigma2 called with index = " << index << std::endl; + } +#else + assert(index > 0 && index < BYM2); +#endif + + // Define the maximum signal to use in the parameterization + + // Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis + + if(qpixel < sxymax_) { + sigi = qpixel; + qscale = 1.f; + } else { + sigi = sxymax_; + qscale = qpixel/sxymax_; + } + sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi; + if(index <= T2HYP1) { + err00 = xypary0x0_[0][0]+xypary0x0_[0][1]*sigi+xypary0x0_[0][2]*sigi2+xypary0x0_[0][3]*sigi3+xypary0x0_[0][4]*sigi4; + err2 = err00 + +adcota_*(xypary0x1_[0][0]+xypary0x1_[0][1]*sigi+xypary0x1_[0][2]*sigi2+xypary0x1_[0][3]*sigi3+xypary0x1_[0][4]*sigi4 - err00) + +adcotb_*(xypary1x0_[0][0]+xypary1x0_[0][1]*sigi+xypary1x0_[0][2]*sigi2+xypary1x0_[0][3]*sigi3+xypary1x0_[0][4]*sigi4 - err00); + } else { + err00 = xypary0x0_[1][0]+xypary0x0_[1][1]*sigi+xypary0x0_[1][2]*sigi2+xypary0x0_[1][3]*sigi3+xypary0x0_[1][4]*sigi4; + err2 = err00 + +adcota_*(xypary0x1_[1][0]+xypary0x1_[1][1]*sigi+xypary0x1_[1][2]*sigi2+xypary0x1_[1][3]*sigi3+xypary0x1_[1][4]*sigi4 - err00) + +adcotb_*(xypary1x0_[1][0]+xypary1x0_[1][1]*sigi+xypary1x0_[1][2]*sigi2+xypary1x0_[1][3]*sigi3+xypary1x0_[1][4]*sigi4 - err00); + } + xysig2 =qscale*err2; + if(xysig2 <= 0.f) {LOGERROR("SiPixelTemplate2D") << "neg y-error-squared, id = " << id_current_ << ", index = " << index_id_ << + ", cot(alpha) = " << cota_current_ << ", cot(beta) = " << cotb_current_ << ", sigi = " << sigi << ENDL;} + + return; + +} // End xysigma2 + + +// ************************************************************************************************************ +//! Return the Landau probability parameters for this set of cot(alpha, cot(beta) +// ************************************************************************************************************ +void SiPixelTemplate2D::landau_par(float lanpar[2][5]) + +{ + // Interpolate using quantities already stored in the private variables + + // Local variables + int i,j; + for(i=0; i<2; ++i) { + for(j=0; j<5; ++j) { + lanpar[i][j] = lanpar_[i][j]; + } + } + return; + +} // End lan_par + + + diff --git a/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplateReco2D.cc b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplateReco2D.cc new file mode 100644 index 0000000000000..9fe1fc54d3e1d --- /dev/null +++ b/RecoLocalTracker/SiPixelRecHits/src/SiPixelTemplateReco2D.cc @@ -0,0 +1,656 @@ +// +// SiPixelTemplateReco2D.cc (Version 2.20) +// Updated to work with the 2D template generation code +// Include all bells and whistles for edge clusters +// 2.10 - Add y-lorentz drift to estimate starting point [for FPix] +// 2.10 - Remove >1 pixel requirement +// 2.20 - Fix major bug, change chi2 scan to 9x5 [YxX] + + +// +// +// Created by Morris Swartz on 7/13/17. +// +// + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE +//#include +#else +#include +#endif +#include +#include +#include +#include +// ROOT::Math has a c++ function that does the probability calc, but only in v5.12 and later +#include "TMath.h" +#include "Math/DistFunc.h" +// Use current version of gsl instead of ROOT::Math +//#include + +#ifndef SI_PIXEL_TEMPLATE_STANDALONE +#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h" +#include "RecoLocalTracker/SiPixelRecHits/interface/VVIObjF.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#define LOGERROR(x) edm::LogError(x) +#define LOGDEBUG(x) LogDebug(x) +static const int theVerboseLevel = 2; +#define ENDL " " +#include "FWCore/Utilities/interface/Exception.h" +#else +#include "SiPixelTemplateReco2D.h" +#include "VVIObjF.h" +//static int theVerboseLevel = {2}; +#define LOGERROR(x) std::cout << x << ": " +#define LOGDEBUG(x) std::cout << x << ": " +#define ENDL std::endl +#endif + +using namespace SiPixelTemplateReco2D; + +// ************************************************************************************************************************************* +//! Reconstruct the best estimate of the hit position for pixel clusters. +//! \param id - (input) identifier of the template to use +//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) +//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) +//! \param locBz - (input) the sign of this quantity is used to determine whether to flip cot(beta)<0 quantities from cot(beta)>0 (FPix only) +//! for Phase 0 FPix IP-related tracks, locBz < 0 for cot(beta) > 0 and locBz > 0 for cot(beta) < 0 +//! for Phase 1 FPix IP-related tracks, see next comment +//! \param locBx - (input) the sign of this quantity is used to determine whether to flip cot(alpha/beta)<0 quantities from cot(alpha/beta)>0 (FPix only) +//! for Phase 1 FPix IP-related tracks, locBx/locBz > 0 for cot(alpha) > 0 and locBx/locBz < 0 for cot(alpha) < 0 +//! for Phase 1 FPix IP-related tracks, locBx > 0 for cot(beta) > 0 and locBx < 0 for cot(beta) < 0 +//! \param edgeflagy - (input) flag to indicate the present of edges in y: 0-none (or interior gap), 1-edge at small y, 2-edge at large y, +//! 3-edge at either end +//! \param edgeflagx - (input) flag to indicate the present of edges in x: 0-none, 1-edge at small x, 2-edge at large x +//! \param cluster - (input) pixel array struct with double pixel flags and bounds +//! origin of local coords (0,0) at center of pixel cluster[0][0]. +//! \param templ2D - (input) the 2D template used in the reconstruction +//! \param yrec - (output) best estimate of y-coordinate of hit in microns +//! \param sigmay - (output) best estimate of uncertainty on yrec in microns +//! \param xrec - (output) best estimate of x-coordinate of hit in microns +//! \param sigmax - (output) best estimate of uncertainty on xrec in microns +//! \param probxy - (output) probability describing goodness-of-fit +//! \param probQ - (output) probability describing upper cluster charge tail +//! \param qbin - (output) index (0-4) describing the charge of the cluster +//! qbin = 0 Q/Q_avg > 1.5 [few % of all hits] +//! 1 1.5 > Q/Q_avg > 1.0 [~30% of all hits] +//! 2 1.0 > Q/Q_avg > 0.85 [~30% of all hits] +//! 3 0.85 > Q/Q_avg > min1 [~30% of all hits] +//! \param deltay - (output) template y-length - cluster length [when > 0, possibly missing end] +// ************************************************************************************************************************************* +int SiPixelTemplateReco2D::PixelTempReco3D(int id, float cotalpha, float cotbeta, float locBz, float locBx, int edgeflagy, int edgeflagx, + ClusMatrix & cluster, SiPixelTemplate2D& templ2D,float& yrec, float& sigmay, + float& xrec, float& sigmax, float& probxy, float& probQ, int& qbin, float& deltay, int& npixels) + +{ + // Local variables + int i, j, k; + float template2d[BXM2][BYM2], dpdx2d[2][BXM2][BYM2], fbin[3]; + + // fraction of truncation signal to measure the cluster ends + const float fracpix = 0.45f; + + + // Extract some relevant info from the 2D template + + if(id > 0) {templ2D.interpolate(id, cotalpha, cotbeta, locBz, locBx);} + float xsize = templ2D.xsize(); + float ysize = templ2D.ysize(); + + // Allow Qbin Q/Q_avg fractions to vary to optimize error estimation + + for(i=0; i<3; ++i) {fbin[i] = templ2D.fbin(i);} + + float q50 = templ2D.s50(); + float pseudopix = 0.1f*q50; + float pseudopix2 = q50*q50; + + + // Get charge scaling factor + + float qscale = templ2D.qscale(); + + // Check that the cluster container is (up to) a 7x21 matrix and matches the dimensions of the double pixel flags + + int nclusx = cluster.mrow; + int nclusy = (int)cluster.mcol; + bool * xdouble = cluster.xdouble; + bool * ydouble = cluster.ydouble; + + // First, rescale all pixel charges and compute total charge + float qtotal = 0.f; + for(i=0; i maxpix) { + clusxy[j][i] = maxpix; + } else { + clusxy[j][i] = cluster(j-1,i-1); + } + if(clusxy[j][i] > 0.) { + ysum[i] += clusxy[j][i]; + // xq += (xe + xpitch/2.)*clusxy[j][i]; + if(j < jmin) {jmin = j; xlow0 = xe;} + if(j > jmax) {jmax = j; xhigh0 = xe+xpitch;} + if(i < imin) {imin = i; ylow0 = ye;} + if(i > imax) {imax = i; yhigh0 = ye+ypitch;} + indexxy[0][npixel] = j; + indexxy[1][npixel] = i; + pixel[npixel] = clusxy[j][i]; + ++npixel; + } + xe += xpitch; + } + // qtot += ysum[i]; + ye += ypitch; + } + ysum[nclusy+1] = 0.f; + ypos[nclusy+1] = yhigh0+0.5f*ysize; + + // float xbaryc = xq/qtot; + + // Quit if only one pixel in cluster + + if(npixel < 2 ) { +// LOGDEBUG("SiPixelTemplateReco2D") << "2D fit not possible with single pixel" << ENDL; + return 1; + } + + + // if(jmax-jmin == 0 ) { + // LOGDEBUG("SiPixelTemplateReco2D") << "2D fit not possible with single x-pixel" << ENDL; + // return 1; + // } + + // Quit if only one pixel in cluster + + // if(imax-imin == 0) { + // LOGDEBUG("SiPixelTemplateReco2D") << "2D fit not possible with single y-pixel" << ENDL; + // return 1; + // } + + // Next, calculate the error^2 [need to know which is the middle y pixel of the cluster] + + int ypixoff = T2HYP1 - (imin+imax)/2; + for(k=0; k hmaxpix && ysum[i-1] < hmaxpix && ylow < 0.f) { + ylow = ypos[i-1] + (ypos[i]-ypos[i-1])*(hmaxpix-ysum[i-1])/(ysum[i]-ysum[i-1]); + } + if(ysum[i] < q50) { + if(imisslow < 0) imisslow = i; + imisshigh = i; + } + if(ysum[i] > hmaxpix && ysum[i+1] < hmaxpix) { + yhigh = ypos[i] + (ypos[i+1]-ypos[i])*(ysum[i]-hmaxpix)/(ysum[i]-ysum[i+1]); + } + } + if(ylow < 0.f || yhigh < 0.f) { + ylow = ylow0; + yhigh = yhigh0; + } + + float templeny = templ2D.clsleny(); + deltay = templeny - (yhigh - ylow)/ysize; + + // Calculate the corrected distance from the ylow and yhigh to the cluster center + +// float delycor = templ2D.delyavg(); +// float halfy = 0.5f*(templeny-delycor)*ysize; + +// printf("templeny = %f, deltay = %f, delycor = %f, halfy = %f \n", templeny, deltay, delycor, halfy); + + // x0 and y0 are best guess seeds for the fit + + // float x0 = 0.5f*(xlow0 + xhigh0) + 0.5f*xsize; + float x0 = 0.5f*(xlow0 + xhigh0) - templ2D.lorxdrift(); + float y0 = 0.5f*(ylow + yhigh) - templ2D.lorydrift(); +// float y1 = yhigh - halfy - templ2D.lorydrift(); +// printf("y0 = %f, y1 = %f \n", y0, y1); + // float y0 = 0.5f*(ylow + yhigh); + + // If there are missing edge columns, set up missing column flags and number + // of minimization passes + + int npass = 1; + + switch(edgeflagy) { + case 0: + break; + case 1: +// y0 = yhigh - halfy - templ2D.lorydrift(); + imisshigh = imin-1; + imisslow = -1; + break; + case 2: +// y0 = ylow + halfy - templ2D.lorydrift(); + imisshigh = -1; + imisslow = imax+1; + break; + case 3: +// y0 = yhigh - halfy - templ2D.lorydrift(); + imisshigh = imin-1; + imisslow = -1; + npass = 2; + break; + default: +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + throw cms::Exception("DataCorrupt") << "PixelTemplateReco3D::illegal edgeflagy = " << edgeflagy << std::endl; +#else + std::cout << "PixelTemplate:3D:illegal edgeflagy = " << edgeflagy << std::endl; +#endif + } + + switch(edgeflagx) { + case 0: + break; + case 1: + jmisshigh = jmin-1; + jmisslow = -1; + break; + case 2: + jmisshigh = -1; + jmisslow = jmax+1; + break; + default: +#ifndef SI_PIXEL_TEMPLATE_STANDALONE + throw cms::Exception("DataCorrupt") << "PixelTemplateReco3D::illegal edgeflagx = " << edgeflagx << std::endl; +#else + std::cout << "PixelTemplate:3D:illegal edgeflagx = " << edgeflagx << std::endl; +#endif + } + + // Define quantities to be saved for each pass + + + float chi2min[2], xerr2[2], yerr2[2]; + float x2D0[2], y2D0[2], qtfrac0[2]; + int ipass, niter0[2]; + + for(ipass = 0; ipass < npass; ++ipass) { + + if(ipass == 1) { + + // Now try again if both edges are possible + + // y0 = ylow + halfy - templ2D.lorydrift(); + imisshigh = -1; + imisslow = imax+1; + } + + // Next, add pseudo pixels around the periphery of the cluster + + int tpixel = npixel; + for(k=0; k 0.2 && fabs(ystep) > 0.2))) { + + // Remember the present parameters + x2D0[ipass] = x2D; + y2D0[ipass] = y2D; + qtfrac0[ipass] = qtfrac; + xerr2[ipass] = minv11; + yerr2[ipass] = minv22; + chi2min[ipass] = chi2; + niter0[ipass] = niter; + + // Calculate the initial template which also allows the error calculation for the struck pixels + + for(j=0; j 2.*xsize || fabs(ystep) > 2.*ysize) break; + x2D += xstep; + y2D += ystep; + ++niter; + } + } + + ipass = 0; + if(npass == 1) { + // one pass, require that it have iterated + if(niter0[0] == 0) {return 2;} + } else { + // two passes + if(niter0[0] == 0 && niter0[1] == 0) {return 2;} + if(niter0[0] > 0 && niter0[1] > 0) { + // if both have iterated, take the smaller chi2 + if(chi2min[1] < chi2min[0]) {ipass = 1;} + } else { + // if one has iterated, take it + if(niter0[1] > 0) {ipass = 1;} + } + } + + // printf("niter = %d \n", niter); + + // Correct the charge ratio for missing pixels + + float fq; + if(qtfrac0[ipass] < 0.10f || qtfrac0[ipass] > 1.f) {qtfrac0[ipass] = 1.f;} + fq = fq0/qtfrac0[ipass]; + + // printf("qtfrac0 = %f \n", qtfrac0); + + if(fq > fbin[0]) { + qbin=0; + } else { + if(fq > fbin[1]) { + qbin=1; + } else { + if(fq > fbin[2]) { + qbin=2; + } else { + qbin=3; + } + } + } + + // Get charge related quantities + + float scalex = templ2D.scalex(qbin); + float scaley = templ2D.scaley(qbin); + float offsetx = templ2D.offsetx(qbin); + float offsety = templ2D.offsety(qbin); +// printf("scalex = %f, scaley = %f, offsetx = %f, offsety = %f \n", scalex, scaley, offsetx, offsety); + + // This 2D code has the origin (0,0) at the lower left edge of the input cluster + // That is now pixel [1,1] and the template reco convention is the middle + // of that pixel, so we need to correct + + xrec = x2D0[ipass] - xsize/2. - offsetx; + if(xdouble[0]) xrec -= xsize/2.f; + yrec = y2D0[ipass] - ysize/2. - offsety; + if(ydouble[0]) yrec -= ysize/2.f; + if(xerr2[ipass] > 0.f) { + sigmax = scalex*sqrt(xerr2[ipass]); + if(sigmax < 3.f) sigmax = 3.f; + } else { + sigmax = 10000.f; + } + if(yerr2[ipass] > 0.f) { + sigmay = scaley*sqrt(yerr2[ipass]); + if(sigmay < 3.f) sigmay = 3.f; + } else { + sigmay = 10000.f; + } + if(id > 0) { + // Do chi2 probability calculation + double meanxy = (double)(npixel*templ2D.chi2ppix()); + double chi2scale = (double)templ2D.chi2scale(); + if(meanxy < 0.01) {meanxy = 0.01;} + double hndof = meanxy/2.f; + double hchi2 = chi2scale*chi2min[ipass]/2.f; + probxy = (float)(1. - TMath::Gamma(hndof, hchi2)); + // Do the charge probability + float mpv = templ2D.mpvvav(); + float sigmaQ = templ2D.sigmavav(); + float kappa = templ2D.kappavav(); + float xvav = (qtotal/qtfrac0[ipass]-mpv)/sigmaQ; + float beta2 = 1.f; + // VVIObj is a private port of CERNLIB VVIDIS + VVIObjF vvidist(kappa, beta2, 1); + float prvav = vvidist.fcn(xvav); + probQ = 1.f - prvav; + } else { + probxy = chi2min[ipass]; + npixels = npixel; + probQ = 0.f; + } + + // Now + + // printf("end minimization, errors = %f, %f \n\n", sqrt(xerr2), sqrt(yerr2)); + + // printf("** 2D-template, cotalpha = %f, cotbeta = %f, x2D = %f, y2D = %f **\n", cotalpha, cotbeta, x2D, y2D); + + // for (k=1; k < BXM3; ++k) { + // printf("%5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f // %5.0f %5.0f %5.0f \n", + //template2d[k][1],template2d[k][2],template2d[k][3],template2d[k][4],template2d[k][5],template2d[k][6],template2d[k][7],template2d[k][8],template2d[k][9], + //template2d[k][10],template2d[k][11],template2d[k][12],template2d[k][13],template2d[k][14],template2d[k][15],template2d[k][16],template2d[k][17],template2d[k][18], + // template2d[k][19],template2d[k][20],template2d[k][21]); + // } + + + + return 0; +} // PixelTempReco2D + +int SiPixelTemplateReco2D::PixelTempReco3D(int id, float cotalpha, float cotbeta, float locBz, float locBx, int edgeflagy, + int edgeflagx, ClusMatrix & cluster, SiPixelTemplate2D& templ2D,float& yrec, float& sigmay, float& xrec, float& sigmax, + float& probxy, float& probQ, int& qbin, float& deltay) + +{ + // Local variables + int npixels; + return SiPixelTemplateReco2D::PixelTempReco3D(id, cotalpha, cotbeta, locBz, locBx, edgeflagy, edgeflagx, cluster, + templ2D, yrec, sigmay, xrec, sigmax, probxy, probQ, qbin, deltay, npixels); +} // PixelTempReco2D diff --git a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h b/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h deleted file mode 100644 index da6544f752075..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h +++ /dev/null @@ -1,409 +0,0 @@ -// -// SiStripTemplate.h (v2.10) [v1.0 based on SiPixelTemplate v8.20] -// -// V1.05 - add VI optimizations from pixel template object -// V1.06 - increase angular acceptance (and structure size) -// V2.00 - add barycenter interpolation and getters, fix calculation for charge deposition to accommodate cota-offsets in the central cotb entries. -// V2.01 - fix problem with number of spare entries -// V2.10 - modify methods for cluster splitting to improve speed -// -// Created by Morris Swartz on 10/11/10. -// -// - -// Build the template storage structure from several pieces - -#ifndef SiStripTemplate_h -#define SiStripTemplate_h 1 - -#include "SiStripTemplateDefs.h" - -#include -#include -#include "boost/multi_array.hpp" - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" -#include "FWCore/Utilities/interface/Exception.h" -#endif - -struct SiStripTemplateEntry { //!< Basic template entry corresponding to a single set of track angles - int runnum; //!< number of stripav run used to generate this entry - float alpha; //!< alpha track angle (defined in CMS CMS IN 2004/014) - float cotalpha; //!< cot(alpha) is proportional to cluster length in x and is basis of interpolation - float beta; //!< beta track angle (defined in CMS CMS IN 2004/014) - float cotbeta; //!< cot(beta) is proportional to cluster length in y and is basis of interpolation - float costrk[3]; //!< direction cosines of tracks used to generate this entry - float qavg; //!< average cluster charge for this set of track angles (now includes threshold effects) - float sxmax; //!< average strip signal for x-projection of cluster - float dxone; //!< mean offset/correction for one strip x-clusters - float sxone; //!< rms for one strip x-clusters - float qmin; //!< minimum cluster charge for valid hit (keeps 99.9% of simulated hits) - float qmin2; //!< tighter minimum cluster charge for valid hit (keeps 99.8% of simulated hits) - float clslenx; //!< cluster x-length in strips at signal height sxmax/2 - float mpvvav; //!< most probable charge in Vavilov distribution (not actually for larger kappa) - float sigmavav; //!< "sigma" scale fctor for Vavilov distribution - float kappavav; //!< kappa parameter for Vavilov distribution - float mpvvav2; //!< most probable charge in Vavilov distribution for 2 merged clusters (not actually for larger kappa) - float sigmavav2; //!< "sigma" scale fctor for Vavilov distribution for 2 merged clusters - float kappavav2; //!< kappa parameter for Vavilov distribution for 2 merged clusters - float xpar[2][5]; //!< projected x-strip uncertainty parameterization - float xtemp[9][TSXSIZE]; //!< templates for x-reconstruction (binned over 1 central strip) - float xavg[4]; //!< average x-bias of reconstruction binned in 4 charge bins - float xrms[4]; //!< average x-rms of reconstruction binned in 4 charge bins - float xgx0[4]; //!< average x0 from Gaussian fit binned in 4 charge bins - float xgsig[4]; //!< average sigma_x from Gaussian fit binned in 4 charge bins - float xflpar[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins - float chi2xavg[4]; //!< average x chi^2 in 4 charge bins - float chi2xmin[4]; //!< minimum of x chi^2 in 4 charge bins - float chi2xavgone; //!< average x chi^2 for 1 strip clusters - float chi2xminone; //!< minimum of x chi^2 for 1 strip clusters - float xavgc2m[4]; //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins - float xrmsc2m[4]; //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins - float xgx0c2m[4]; //!< 1st pass chi2 min search: average x0 from Gaussian fit binned in 4 charge bins - float xgsigc2m[4]; //!< 1st pass chi2 min search: average sigma_x from Gaussian fit binned in 4 charge bins - float chi2xavgc2m[4]; //!< 1st pass chi2 min search: average x chi^2 in 4 charge bins (merged clusters) - float chi2xminc2m[4]; //!< 1st pass chi2 min search: minimum of x chi^2 in 4 charge bins (merged clusters) - float xavggen[4]; //!< generic algorithm: average x-bias of reconstruction binned in 4 charge bins - float xrmsgen[4]; //!< generic algorithm: average x-rms of reconstruction binned in 4 charge bins - float xgx0gen[4]; //!< generic algorithm: average x0 from Gaussian fit binned in 4 charge bins - float xgsiggen[4]; //!< generic algorithm: average sigma_x from Gaussian fit binned in 4 charge bins - float xavgbcn[4]; //!< barycenter: average x-bias of reconstruction binned in 4 charge bins - float xrmsbcn[4]; //!< barycenter: average x-rms of reconstruction binned in 4 charge bins - float xgx0bcn[4]; //!< barycenter: average x0 from Gaussian fit binned in 4 charge bins - float xgsigbcn[4]; //!< barycenter: average sigma_x from Gaussian fit binned in 4 charge bins - float qbfrac[3]; //!< fraction of sample in qbin = 0-2 (>=3 is the complement) - float fracxone; //!< fraction of sample with xsize = 1 - float qavg_avg; //!< average cluster charge of clusters that are less than qavg (normalize 2-D simple templates) - float qavg_spare; //!< spare cluster charge - float spare[7]; -} ; - - - - -struct SiStripTemplateHeader { //!< template header structure - char title[80]; //!< template title - int ID; //!< template ID number - int templ_version; //!< Version number of the template to ensure code compatibility - float Bfield; //!< Bfield in Tesla - int NTy; //!< number of Template y entries - int NTyx; //!< number of Template y-slices of x entries - int NTxx; //!< number of Template x-entries in each slice - int Dtype; //!< detector type (0=BPix, 1=FPix) - float Vbias; //!< detector bias potential in Volts - float temperature; //!< detector temperature in deg K - float fluence; //!< radiation fluence in n_eq/cm^2 - float qscale; //!< Charge scaling to match cmssw and stripav - float s50; //!< 1/2 of the readout threshold in ADC units - float lorywidth; //!< estimate of y-lorentz width from single strip offset - float lorxwidth; //!< estimate of x-lorentz width from single strip offset - float xsize; //!< strip size (for future use in upgraded geometry) - float ysize; //!< strip size (for future use in upgraded geometry) - float zsize; //!< strip size (for future use in upgraded geometry) -} ; - - - -struct SiStripTemplateStore { //!< template storage structure - SiStripTemplateHeader head; -#ifndef SI_STRIP_TEMPLATE_USE_BOOST - SiStripTemplateEntry enty[31]; //!< 60 Barrel y templates spanning cluster lengths from 0px to +18px [28 entries for fstrp] - SiStripTemplateEntry entx[5][73]; //!< 29 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 5 slices [3x29 for fstrp] -#else - boost::multi_array enty; //!< use 1d entry to store [60] barrel entries or [28] fstrp entries - boost::multi_array entx; //!< use 2d entry to store [5][29] barrel entries or [3][29] fstrp entries -#endif -} ; - - -// ****************************************************************************************** -//! \class SiStripTemplate -//! -//! A template management class. SiStripTemplate contains theStripTemp -//! (a std::vector of SiStripTemplateStore, each of which is a collection of many -//! SiStripTemplateEntries). Each SiStripTemplateStore corresponds to a given detector -//! condition, and is valid for a range of runs. We allow more than one Store since the -//! may change over time. -//! -//! This class reads templates from files via pushfile() method. -//! -//! The main functionality of SiStripTemplate is interpolate(), which produces a template -//! on the fly, given a specific track's alpha and beta. The results are kept in data -//! members and accessed via inline getters. -//! -//! The resulting template is then used by StripTempReco2D() (a global function) which -//! get the reference for SiStripTemplate & templ and uses the current template to -//! reconstruct the SiStripRecHit. -// ****************************************************************************************** -class SiStripTemplate { - public: - SiStripTemplate(const std::vector< SiStripTemplateStore > & theStripTemp) : theStripTemp_(theStripTemp) {id_current_ = -1; index_id_ = -1; cota_current_ = 0.; cotb_current_ = 0.;} //!< Default constructor - static bool pushfile(int filenum, std::vector< SiStripTemplateStore > & theStripTemp_); // load the private store with info from the - // file with the index (int) filenum - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - static bool pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiStripTemplateStore > & theStripTemp_); // load the private store with info from db -#endif - - -// Interpolate input alpha and beta angles to produce a working template for each individual hit. - bool interpolate(int id, float cotalpha, float cotbeta, float locBy); - -// overload for compatibility. - bool interpolate(int id, float cotalpha, float cotbeta); - -// retreive interpolated templates. - void xtemp(int fxbin, int lxbin, float xtemplate[41][BSXSIZE]); - -// interpolate a scaled cluster shape. - void sxtemp(float xhit, std::vector& cluster); - -//Method to estimate the central strip of the interpolated x-template - int cxtemp(); - -// new methods to build templates from two interpolated clusters (for splitting) - void xtemp3d_int(int nxpix, int& nxbins); - - void xtemp3d(int j, int k, std::vector& xtemplate); - -// Convert vector of projected signals into uncertainties for fitting. - void xsigma2(int fxstrp, int lxstrp, float sxthr, float xsum[BSXSIZE], float xsig2[BSXSIZE]); - -// Interpolate qfl correction in x. - float xflcorr(int binq, float qflx); - -// Interpolate input beta angle to estimate the average charge. return qbin flag for input cluster charge. - int qbin(int id, float cotalpha, float cotbeta, float qclus); - -//Method to interpolate Vavilov distribution parameters - void vavilov_pars(double& mpv, double& sigma, double& kappa); - -//Method to interpolate Vavilov distribution parameters for merged clusters - void vavilov2_pars(double& mpv, double& sigma, double& kappa); - - - float qavg() {return qavg_;} //!< average cluster charge for this set of track angles - float qscale() {return qscale_;} //!< charge scaling factor - float s50() {return s50_;} //!< 1/2 of the strip threshold signal in electrons - float sxmax() {return sxmax_;} //!< average strip signal for x-projection of cluster - float dxone() {return dxone_;} //!< mean offset/correction for one strip x-clusters - float sxone() {return sxone_;} //!< rms for one strip x-clusters - float qmin() {return qmin_;} //!< minimum cluster charge for valid hit (keeps 99.9% of simulated hits) - float qmin(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 1) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::qmin called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<2); -#endif - if(i==0){return qmin_;}else{return qmin2_;}} //!< minimum cluster charge for valid hit (keeps 99.9% or 99.8% of simulated hits) - float clslenx() {return clslenx_;} //!< x-size of smaller interpolated template in strips - float yratio() {return yratio_;} //!< fractional distance in y between cotbeta templates - float yxratio() {return yxratio_;} //!< fractional distance in y between cotalpha templates slices - float xxratio() {return xxratio_;} //!< fractional distance in x between cotalpha templates - float xavg(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xavg called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xavg_[i];} //!< average x-bias of reconstruction binned in 4 charge bins - float xrms(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xrms called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xrms_[i];} //!< average x-rms of reconstruction binned in 4 charge bins - float xgx0(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgx0 called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgx0_[i];} //!< average x0 from Gaussian fit binned in 4 charge bins - float xgsig(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgsig called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgsig_[i];} //!< average sigma_x from Gaussian fit binned in 4 charge bins - float chi2xavg(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::chi2xavg called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return chi2xavg_[i];} //!< averaage x chi^2 in 4 charge bins - float chi2xmin(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::chi2xmin called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return chi2xmin_[i];} //!< minimum y chi^2 in 4 charge bins - float xavgc2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xavgc2m called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xavgc2m_[i];} //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins - float xrmsc2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xrmsc2m called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xrmsc2m_[i];} //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins - float xgx0c2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgx0cm2 called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgx0c2m_[i];} //!< 1st pass chi2 min search: average x0 from Gaussian fit binned in 4 charge bins - float xgsigc2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgsigc2m called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgsigc2m_[i];} //!< 1st pass chi2 min search: average sigma_x from Gaussian fit binned in 4 charge bins - float chi2xavgc2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2xavgc2m called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return chi2xavgc2m_[i];} //!< 1st pass chi2 min search: average x-chisq for merged clusters - float chi2xminc2m(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2xminc2m called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return chi2xminc2m_[i];} //!< 1st pass chi2 min search: minimum x-chisq for merged clusters - float xavgbcn(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xavgbcn called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xavgbcn_[i];} //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins - float xrmsbcn(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xrmsbcn called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xrmsbcn_[i];} //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins - float xgx0bcn(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgx0cm2 called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgx0bcn_[i];} //!< 1st pass chi2 min search: average x0 from Gaussian fit binned in 4 charge bins - float xgsigbcn(int i) { -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiStripTemplate::xgsigbcn called with illegal index = " << i << std::endl;} -#else - assert(i>=0 && i<4); -#endif - return xgsigbcn_[i];} //!< 1st pass chi2 min search: average sigma_x from Gaussian fit binned in 4 charge bins - float chi2xavgone() {return chi2xavgone_;} //!< //!< average x chi^2 for 1 strip clusters - float chi2xminone() {return chi2xminone_;} //!< //!< minimum of x chi^2 for 1 strip clusters - float lorxwidth() {return lorxwidth_;} //!< signed lorentz x-width (microns) - float mpvvav() {return mpvvav_;} //!< most probable charge in Vavilov distribution (not actually for larger kappa) - float sigmavav() {return sigmavav_;} //!< "sigma" scale fctor for Vavilov distribution - float kappavav() {return kappavav_;} //!< kappa parameter for Vavilov distribution - float xsize() {return xsize_;} //!< strip x-size (microns) - float ysize() {return ysize_;} //!< strip y-size (microns) - float zsize() {return zsize_;} //!< strip z-size or thickness (microns) -// float yspare(int i) {assert(i>=0 && i<5); return pyspare[i];} //!< vector of 5 spares interpolated in beta only -// float xspare(int i) {assert(i>=0 && i<10); return pxspare[i];} //!< vector of 10 spares interpolated in alpha and beta - - - private: - - // Keep current template interpolaion parameters - - int id_current_; //!< current id - int index_id_; //!< current index - float cota_current_; //!< current cot alpha - float cotb_current_; //!< current cot beta - float abs_cotb_; //!< absolute value of cot beta - bool success_; //!< true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded) - - - // Keep results of last interpolation to return through member functions - - float qavg_; //!< average cluster charge for this set of track angles - float pixmax_; //!< maximum strip charge - float qscale_; //!< charge scaling factor - float s50_; //!< 1/2 of the strip threshold signal in adc units - float sxmax_; //!< average strip signal for x-projection of cluster - float sxparmax_; //!< maximum strip signal for parameterization of x uncertainties - float syparmax_; //!< maximum strip signal for parameterization of y-slice x uncertainties - float dxone_; //!< mean offset/correction for one strip x-clusters - float sxone_; //!< rms for one strip x-clusters - float dxtwo_; //!< mean offset/correction for one double-strip x-clusters - float sxtwo_; //!< rms for one double-strip x-clusters - float qmin_; //!< minimum cluster charge for valid hit (keeps 99.9% of simulated hits) - float clslenx_; //!< x-cluster length of smaller interpolated template in strips - float xparly0_[2][5]; //!< projected x-strip uncertainty parameterization for smaller cotbeta (central alpha) - float xparhy0_[2][5]; //!< projected x-strip uncertainty parameterization for larger cotbeta (central alpha) - float yratio_; //!< fractional distance in y between y-slices of cotbeta templates - float yxratio_; //!< fractional distance in y between x-slices of cotalpha templates - float xxratio_; //!< fractional distance in x between cotalpha templates - float xpar0_[2][5]; //!< projected x-strip uncertainty parameterization for central cotalpha - float xparl_[2][5]; //!< projected x-strip uncertainty parameterization for smaller cotalpha - float xparh_[2][5]; //!< projected x-strip uncertainty parameterization for larger cotalpha - float xtemp_[9][BSXSIZE]; //!< templates for x-reconstruction (binned over 5 central strips) - float xavg_[4]; //!< average x-bias of reconstruction binned in 4 charge bins - float xrms_[4]; //!< average x-rms of reconstruction binned in 4 charge bins - float xgx0_[4]; //!< average x0 from Gaussian fit binned in 4 charge bins - float xgsig_[4]; //!< sigma from Gaussian fit binned in 4 charge bins - float xflparll_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for smaller cotbeta, cotalpha - float xflparlh_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for smaller cotbeta, larger cotalpha - float xflparhl_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for larger cotbeta, smaller cotalpha - float xflparhh_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for larger cotbeta, cotalpha - float xavgc2m_[4]; //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins - float xrmsc2m_[4]; //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins - float xgx0c2m_[4]; //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins - float xgsigc2m_[4]; //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins - float chi2xavg_[4]; //!< average x chi^2 in 4 charge bins - float chi2xmin_[4]; //!< minimum of x chi^2 in 4 charge bins - float chi2xavgc2m_[4]; //!< 1st pass chi2 min search: average x-chisq for merged clusters - float chi2xminc2m_[4]; //!< 1st pass chi2 min search: minimum x-chisq for merged clusters - float xavgbcn_[4]; //!< barycenter: average x-bias of reconstruction binned in 4 charge bins - float xrmsbcn_[4]; //!< barycenter: average x-rms of reconstruction binned in 4 charge bins - float xgx0bcn_[4]; //!< barycenter: average x-bias of reconstruction binned in 4 charge bins - float xgsigbcn_[4]; //!< barycenter: average x-rms of reconstruction binned in 4 charge bins - float chi2xavgone_; //!< average x chi^2 for 1 strip clusters - float chi2xminone_; //!< minimum of x chi^2 for 1 strip clusters - float qmin2_; //!< tighter minimum cluster charge for valid hit (keeps 99.8% of simulated hits) - float mpvvav_; //!< most probable charge in Vavilov distribution (not actually for larger kappa) - float sigmavav_; //!< "sigma" scale fctor for Vavilov distribution - float kappavav_; //!< kappa parameter for Vavilov distribution - float mpvvav2_; //!< most probable charge in 2-cluster Vavilov distribution (not actually for larger kappa) - float sigmavav2_; //!< "sigma" scale fctor for 2-cluster Vavilov distribution - float kappavav2_; //!< kappa parameter for 2-cluster Vavilov distribution - float lorxwidth_; //!< Lorentz x-width - float xsize_; //!< Pixel x-size - float ysize_; //!< Pixel y-size - float zsize_; //!< Pixel z-size (thickness) - float qavg_avg_; //!< average of cluster charge less than qavg - float nxbins_; //!< number of bins in each dimension of the x-splitting template - boost::multi_array temp2dx_; //!< 2d-primitive for spltting 3-d template - - - // The actual template store is a std::vector container - - const std::vector< SiStripTemplateStore > & theStripTemp_; -} ; - - -#endif diff --git a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateDefs.h b/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateDefs.h deleted file mode 100644 index eaaa60e523d4d..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateDefs.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// SiStripTemplateDefs.h (v2.1) -// -// V2.0 - Expand the x dimensions to accommodate strip clusters to size 10.8 -// V2.1 - Change to strip specific names and remove un-necessary definitions -// -// Created by Morris Swartz on 10/11/10. -// 2010 __TheJohnsHopkinsUniversity__. -// -// - -// Define template buffer size parameters - -#ifndef SiStripTemplateDefs_h -#define SiStripTemplateDefs_h 1 - -// Switch to use boost multiarrays to store the template entries (instead of plain c arrays). -// It adds real time re-sizing and bounds checking at a cost in time (10%?). - -//#define SI_STRIP_TEMPLATE_USE_BOOST 1 - -#define TSXSIZE 17 -#define TSHX 8 // = TSXSIZE/2 -#define TSHXP1 TSHX+1 -#define BSXSIZE TSXSIZE+4 -#define BSHX 10 // = BSXSIZE/2 -#define BSXM1 TSXSIZE+3 -#define BSXM2 TSXSIZE+2 -#define BSXM3 TSXSIZE+1 - -#endif diff --git a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h b/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h deleted file mode 100644 index 335ee14792772..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// SiStripTemplateReco.h Version 2.01 (V1.00 based on SiPixelTemplateReco Version 8.20) -// -// V1.05 - add VI optimizations from pixel reco -// V1.07 - Improve cluster centering -// V2.00 - Change to chi2min estimator and choose barycenter when errors/bias are large -// - Increase buffer size to avoid truncation -// - Change pseudo-strip weighting to accommodate asymmetric clusters (deco mode) -// - Remove obsolete sorting of signal for weighting (truncation makes it worthless) -// V2.01 - Add barycenter bias correction -// -// -// -// Created by Morris Swartz on 10/27/06. -// -// - -#ifndef SiStripTemplateReco_h -#define SiStripTemplateReco_h 1 - -#include "SiStripTemplateDefs.h" - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h" -#else -#include "SiStripTemplate.h" -#endif - -#include - - -namespace SiStripTemplateReco - { - - int StripTempReco1D(int id, float cotalpha, float cotbeta, float locBy, std::vector& cluster, - SiStripTemplate& templ, float& xrec, float& sigmax, float& probx, int& qbin, int speed, float& probQ); - - } - -#endif diff --git a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateSplit.h b/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateSplit.h deleted file mode 100644 index 8d956e01d0a01..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateSplit.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// SiStripTemplateSplit.h -// -// Procedure to fit two templates (same angle hypotheses) to a single cluster -// -// Version 1.00 [based on SiPixelTemplateSplit.cc Version 2.30] -// Version 1.01 [improve error estimation for qbin=3 events] -// Version 1.05 [Incorporate VI-like speed improvements] -// Version 1.06 Clean-up irrelevant (since truncation) sorting -// Version 2.10 Clone speed improvements from the pixels (eliminate 3-d multi-arays, improve seach algorithm) -// -// Created by Morris Swartz on 04/10/08. -// -// - -#ifndef SiStripTemplateSplit_h -#define SiStripTemplateSplit_h 1 - -#include "SiStripTemplateDefs.h" - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h" -#else -#include "SiStripTemplate.h" -#endif - -#include -#include "boost/multi_array.hpp" - - - -namespace SiStripTemplateSplit - { - - - int StripTempSplit(int id, float cotalpha, float cotbeta, float locBy, int speed, std::vector& cluster, - SiStripTemplate& templ, - float& xrec1, float& xrec2, float& sigmax, float& prob2x, int& q2bin, float& prob2Q); - - - int StripTempSplit(int id, float cotalpha, float cotbeta, float locBy, std::vector& cluster, - SiStripTemplate& templ, - float& xrec1, float& xrec2, float& sigmax, float& prob2x, int& q2bin, float& prob2Q); - -} - -#endif diff --git a/RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTemplate.h b/RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTemplate.h deleted file mode 100644 index d1c6a577f877d..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTemplate.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef RecoLocalTracker_SiStripRecHitConverter_StripCPEfromTemplate_H -#define RecoLocalTracker_SiStripRecHitConverter_StripCPEfromTemplate_H - -#include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPE.h" - -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h" - - -class StripCPEfromTemplate : public StripCPE -{ - - public: - - using StripCPE::localParameters; - - StripClusterParameterEstimator::LocalValues - localParameters( const SiStripCluster&, const GeomDetUnit&, const LocalTrajectoryParameters&) const override; - - StripCPEfromTemplate( edm::ParameterSet & conf, - const MagneticField& mag, - const TrackerGeometry& geom, - const SiStripLorentzAngle& lorentz, - const SiStripBackPlaneCorrection& backplaneCorrections, - const SiStripConfObject& confObj, - const SiStripLatency& latency) - : StripCPE(conf, mag, geom, lorentz, backplaneCorrections, confObj, latency ), - use_template_reco( conf.getParameter("UseTemplateReco") ), - template_reco_speed( conf.getParameter("TemplateRecoSpeed") ), - use_strip_split_cluster_errors( conf.getParameter("UseStripSplitClusterErrors") ) - { - SiStripTemplate::pushfile( 11, theStripTemp_ ); - SiStripTemplate::pushfile( 12, theStripTemp_ ); - SiStripTemplate::pushfile( 13, theStripTemp_ ); - SiStripTemplate::pushfile( 14, theStripTemp_ ); - SiStripTemplate::pushfile( 15, theStripTemp_ ); - SiStripTemplate::pushfile( 16, theStripTemp_ ); - - //cout << "STRIPS: (int)use_template_reco = " << (int)use_template_reco << endl; - //cout << "template_reco_speed = " << template_reco_speed << endl; - //cout << "(int)use_strip_split_cluster_errors = " << (int)use_strip_split_cluster_errors << endl; - } - - private: - - std::vector< SiStripTemplateStore > theStripTemp_; - - bool use_template_reco; - int template_reco_speed; - bool use_strip_split_cluster_errors; - -}; -#endif diff --git a/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.cc b/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.cc index 3a375659fb928..fc14cda7becc8 100644 --- a/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.cc +++ b/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.cc @@ -1,7 +1,6 @@ #include "RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.h" #include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPE.h" #include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTrackAngle.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTemplate.h" #include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEgeometric.h" #include "CondFormats/SiStripObjects/interface/SiStripBackPlaneCorrection.h" #include "CondFormats/SiStripObjects/interface/SiStripConfObject.h" @@ -23,7 +22,6 @@ StripCPEESProducer::StripCPEESProducer(const edm::ParameterSet & p) enumMap[std::string("SimpleStripCPE")]=SIMPLE; enumMap[std::string("StripCPEfromTrackAngle")]=TRACKANGLE; enumMap[std::string("StripCPEgeometric")]=GEOMETRIC; - enumMap[std::string("StripCPEfromTemplate")]=TEMPLATE; if(enumMap.find(type)==enumMap.end()) throw cms::Exception("Unknown StripCPE type") << type; @@ -61,10 +59,6 @@ produce(const TkStripCPERecord & iRecord) cpe = std::make_unique(parametersPSet, *magfield, *pDD, *lorentzAngle, *backPlaneCorrection, *confObj, *latency ); break; - case TEMPLATE: - cpe = std::make_unique( parametersPSet, *magfield, *pDD, *lorentzAngle, *backPlaneCorrection, *confObj, *latency ); - break; - } return cpe; diff --git a/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.h b/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.h index 7934ae0ad5169..7ab3a0a9e8b4f 100644 --- a/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.h +++ b/RecoLocalTracker/SiStripRecHitConverter/plugins/StripCPEESProducer.h @@ -20,7 +20,7 @@ class StripCPEESProducer: public edm::ESProducer { private: - enum CPE_t { SIMPLE, TRACKANGLE, GEOMETRIC, TEMPLATE}; + enum CPE_t { SIMPLE, TRACKANGLE, GEOMETRIC }; std::map enumMap; CPE_t cpeNum; diff --git a/RecoLocalTracker/SiStripRecHitConverter/python/StripCPEfromTemplate_cfi.py b/RecoLocalTracker/SiStripRecHitConverter/python/StripCPEfromTemplate_cfi.py deleted file mode 100644 index c53a9f3e5f83a..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/python/StripCPEfromTemplate_cfi.py +++ /dev/null @@ -1,13 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from RecoLocalTracker.SiStripRecHitConverter.StripCPEESProducer_cfi import * -StripCPEfromTemplateESProducer = stripCPEESProducer.clone() -StripCPEfromTemplateESProducerComponentName = cms.string('StripCPEfromTemplate') -StripCPEfromTemplateESProducer.ComponentType = cms.string('StripCPEfromTemplate') -StripCPEfromTemplateESProducer.parameters = cms.PSet( - UseTemplateReco = cms.bool(False), - TemplateRecoSpeed = cms.int32(0), - UseStripSplitClusterErrors = cms.bool(False) -) - - diff --git a/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplate.cc b/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplate.cc deleted file mode 100644 index 2b9bc6c65af62..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplate.cc +++ /dev/null @@ -1,1763 +0,0 @@ -// -// SiStripTemplate.cc Version 1.00 (based on SiPixelTemplate v8.20) -// -// V1.05 - add VI optimizations from pixel template object -// V1.06 - increase angular acceptance (and structure size) -// V2.00 - add barycenter interpolation and getters, fix calculation for charge deposition to accommodate cota-offsets in the central cotb entries. -// V2.01 - fix problem with number of spare entries -// - -// Created by Morris Swartz on 2/2/11. -// -// - -//#include -//#include -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -//#include -#else -#include -#endif -#include -#include -//#include "boost/multi_array.hpp" -#include -#include -#include -#include -#include - - - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#define LOGERROR(x) LogError(x) -#define LOGINFO(x) LogInfo(x) -#define ENDL " " -#include "FWCore/Utilities/interface/Exception.h" -using namespace edm; -#else -#include "SiStripTemplate.h" -#define LOGERROR(x) std::cout << x << ": " -#define LOGINFO(x) std::cout << x << ": " -#define ENDL std::endl -#endif - -//**************************************************************** -//! This routine initializes the global template structures from -//! an external file template_summary_zpNNNN where NNNN are four -//! digits of filenum. -//! \param filenum - an integer NNNN used in the filename template_summary_zpNNNN -//**************************************************************** -bool SiStripTemplate::pushfile(int filenum, std::vector< SiStripTemplateStore > & theStripTemp_) -{ - // Add template stored in external file numbered filenum to theTemplateStore - - // Local variables - int i, j, k, l; - float qavg_avg; - const char *tempfile; - // char title[80]; remove this - char c; - const int code_version={18}; - - - - // Create a filename for this run - - std::ostringstream tout; - - // Create different path in CMSSW than standalone - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - tout << "CalibTracker/SiPixelESProducers/data/stemplate_summary_p" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; - std::string tempf = tout.str(); - edm::FileInPath file( tempf.c_str() ); - tempfile = (file.fullPath()).c_str(); -#else - tout << "stemplate_summary_p" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends; - std::string tempf = tout.str(); - tempfile = tempf.c_str(); -#endif - - // open the template file - - std::ifstream in_file(tempfile, std::ios::in); - - if(in_file.is_open()) { - - // Create a local template storage entry - - SiStripTemplateStore theCurrentTemp; - - // Read-in a header string first and print it - - for (i=0; (c=in_file.get()) != '\n'; ++i) { - if(i < 79) {theCurrentTemp.head.title[i] = c;} - } - if(i > 78) {i=78;} - theCurrentTemp.head.title[i+1] ='\0'; - LOGINFO("SiStripTemplate") << "Loading Strip Template File - " << theCurrentTemp.head.title << ENDL; - - // next, the header information - - in_file >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx - >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale - >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file, no template load" << ENDL; return false;} - - LOGINFO("SiStripTemplate") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield - << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype - << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature " - << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale - << ", 1/2 threshold " << theCurrentTemp.head.s50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", x Lorentz width " << theCurrentTemp.head.lorxwidth - << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL; - - if(theCurrentTemp.head.templ_version < code_version) {LOGERROR("SiStripTemplate") << "code expects version " << code_version << ", no template load" << ENDL; return false;} - -#ifdef SI_STRIP_TEMPLATE_USE_BOOST - -// next, layout the 1-d/2-d structures needed to store template - - theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]); - - theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); - -#endif - -// next, loop over all y-angle entries - - for (i=0; i < theCurrentTemp.head.NTy; ++i) { - - in_file >> theCurrentTemp.enty[i].runnum >> theCurrentTemp.enty[i].costrk[0] - >> theCurrentTemp.enty[i].costrk[1] >> theCurrentTemp.enty[i].costrk[2]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 1, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - // Calculate the alpha, beta, and cot(beta) for this entry - - theCurrentTemp.enty[i].alpha = static_cast(atan2((double)theCurrentTemp.enty[i].costrk[2], (double)theCurrentTemp.enty[i].costrk[0])); - - theCurrentTemp.enty[i].cotalpha = theCurrentTemp.enty[i].costrk[0]/theCurrentTemp.enty[i].costrk[2]; - - theCurrentTemp.enty[i].beta = static_cast(atan2((double)theCurrentTemp.enty[i].costrk[2], (double)theCurrentTemp.enty[i].costrk[1])); - - theCurrentTemp.enty[i].cotbeta = theCurrentTemp.enty[i].costrk[1]/theCurrentTemp.enty[i].costrk[2]; - - in_file >> theCurrentTemp.enty[i].qavg >> theCurrentTemp.enty[i].sxmax >> theCurrentTemp.enty[i].dxone >> theCurrentTemp.enty[i].sxone >> theCurrentTemp.enty[i].qmin >> theCurrentTemp.enty[i].clslenx; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 2, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - for (j=0; j<2; ++j) { - - in_file >> theCurrentTemp.enty[i].xpar[j][0] >> theCurrentTemp.enty[i].xpar[j][1] - >> theCurrentTemp.enty[i].xpar[j][2] >> theCurrentTemp.enty[i].xpar[j][3] >> theCurrentTemp.enty[i].xpar[j][4]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 6, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - } - - qavg_avg = 0.f; - for (j=0; j<9; ++j) { - - for (k=0; k> theCurrentTemp.enty[i].xtemp[j][k]; qavg_avg += theCurrentTemp.enty[i].xtemp[j][k];} - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 7, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - theCurrentTemp.enty[i].qavg_avg = qavg_avg/9.; - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].xavg[j] >> theCurrentTemp.enty[i].xrms[j] >> theCurrentTemp.enty[i].xgx0[j] >> theCurrentTemp.enty[i].xgsig[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 10, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].xflpar[j][0] >> theCurrentTemp.enty[i].xflpar[j][1] >> theCurrentTemp.enty[i].xflpar[j][2] - >> theCurrentTemp.enty[i].xflpar[j][3] >> theCurrentTemp.enty[i].xflpar[j][4] >> theCurrentTemp.enty[i].xflpar[j][5]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 11, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].chi2xavg[j] >> theCurrentTemp.enty[i].chi2xmin[j] >> theCurrentTemp.enty[i].chi2xavgc2m[j] >> theCurrentTemp.enty[i].chi2xminc2m[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 12, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].xavgc2m[j] >> theCurrentTemp.enty[i].xrmsc2m[j] >> theCurrentTemp.enty[i].xgx0c2m[j] >> theCurrentTemp.enty[i].xgsigc2m[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].xavggen[j] >> theCurrentTemp.enty[i].xrmsgen[j] >> theCurrentTemp.enty[i].xgx0gen[j] >> theCurrentTemp.enty[i].xgsiggen[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14b, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.enty[i].xavgbcn[j] >> theCurrentTemp.enty[i].xrmsbcn[j] >> theCurrentTemp.enty[i].xgx0bcn[j] >> theCurrentTemp.enty[i].xgsigbcn[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14c, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - in_file >> theCurrentTemp.enty[i].chi2xavgone >> theCurrentTemp.enty[i].chi2xminone >> theCurrentTemp.enty[i].qmin2 - >> theCurrentTemp.enty[i].mpvvav >> theCurrentTemp.enty[i].sigmavav >> theCurrentTemp.enty[i].kappavav - >> theCurrentTemp.enty[i].mpvvav2 >> theCurrentTemp.enty[i].sigmavav2 >> theCurrentTemp.enty[i].kappavav2 >> theCurrentTemp.enty[i].spare[0]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 15, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - in_file >> theCurrentTemp.enty[i].qbfrac[0] >> theCurrentTemp.enty[i].qbfrac[1] >> theCurrentTemp.enty[i].qbfrac[2] >> theCurrentTemp.enty[i].fracxone - >> theCurrentTemp.enty[i].spare[1] >> theCurrentTemp.enty[i].spare[2] >> theCurrentTemp.enty[i].spare[3] >> theCurrentTemp.enty[i].spare[4] - >> theCurrentTemp.enty[i].spare[5] >> theCurrentTemp.enty[i].spare[6]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 16, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - } - - // next, loop over all barrel x-angle entries - - for (k=0; k < theCurrentTemp.head.NTyx; ++k) { - - for (i=0; i < theCurrentTemp.head.NTxx; ++i) { - - in_file >> theCurrentTemp.entx[k][i].runnum >> theCurrentTemp.entx[k][i].costrk[0] - >> theCurrentTemp.entx[k][i].costrk[1] >> theCurrentTemp.entx[k][i].costrk[2]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 17, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - // Calculate the alpha, beta, and cot(beta) for this entry - - theCurrentTemp.entx[k][i].alpha = static_cast(atan2((double)theCurrentTemp.entx[k][i].costrk[2], (double)theCurrentTemp.entx[k][i].costrk[0])); - - theCurrentTemp.entx[k][i].cotalpha = theCurrentTemp.entx[k][i].costrk[0]/theCurrentTemp.entx[k][i].costrk[2]; - - theCurrentTemp.entx[k][i].beta = static_cast(atan2((double)theCurrentTemp.entx[k][i].costrk[2], (double)theCurrentTemp.entx[k][i].costrk[1])); - - theCurrentTemp.entx[k][i].cotbeta = theCurrentTemp.entx[k][i].costrk[1]/theCurrentTemp.entx[k][i].costrk[2]; - - in_file >> theCurrentTemp.entx[k][i].qavg >> theCurrentTemp.entx[k][i].sxmax >> theCurrentTemp.entx[k][i].dxone >> theCurrentTemp.entx[k][i].sxone >> theCurrentTemp.entx[k][i].qmin >> theCurrentTemp.entx[k][i].clslenx; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 18, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - for (j=0; j<2; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xpar[j][0] >> theCurrentTemp.entx[k][i].xpar[j][1] - >> theCurrentTemp.entx[k][i].xpar[j][2] >> theCurrentTemp.entx[k][i].xpar[j][3] >> theCurrentTemp.entx[k][i].xpar[j][4]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 19, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - } - - qavg_avg = 0.f; - for (j=0; j<9; ++j) { - - for (l=0; l> theCurrentTemp.entx[k][i].xtemp[j][l]; qavg_avg += theCurrentTemp.entx[k][i].xtemp[j][l];} - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 20, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - theCurrentTemp.entx[k][i].qavg_avg = qavg_avg/9.; - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xavg[j] >> theCurrentTemp.entx[k][i].xrms[j] >> theCurrentTemp.entx[k][i].xgx0[j] >> theCurrentTemp.entx[k][i].xgsig[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 21, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xflpar[j][0] >> theCurrentTemp.entx[k][i].xflpar[j][1] >> theCurrentTemp.entx[k][i].xflpar[j][2] - >> theCurrentTemp.entx[k][i].xflpar[j][3] >> theCurrentTemp.entx[k][i].xflpar[j][4] >> theCurrentTemp.entx[k][i].xflpar[j][5]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 22, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].chi2xavg[j] >> theCurrentTemp.entx[k][i].chi2xmin[j] >> theCurrentTemp.entx[k][i].chi2xavgc2m[j] >> theCurrentTemp.entx[k][i].chi2xminc2m[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 23, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xavgc2m[j] >> theCurrentTemp.entx[k][i].xrmsc2m[j] >> theCurrentTemp.entx[k][i].xgx0c2m[j] >> theCurrentTemp.entx[k][i].xgsigc2m[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 24, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xavggen[j] >> theCurrentTemp.entx[k][i].xrmsgen[j] >> theCurrentTemp.entx[k][i].xgx0gen[j] >> theCurrentTemp.entx[k][i].xgsiggen[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 25, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - in_file >> theCurrentTemp.entx[k][i].xavgbcn[j] >> theCurrentTemp.entx[k][i].xrmsbcn[j] >> theCurrentTemp.entx[k][i].xgx0bcn[j] >> theCurrentTemp.entx[k][i].xgsigbcn[j]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 26, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - in_file >> theCurrentTemp.entx[k][i].chi2xavgone >> theCurrentTemp.entx[k][i].chi2xminone >> theCurrentTemp.entx[k][i].qmin2 - >> theCurrentTemp.entx[k][i].mpvvav >> theCurrentTemp.entx[k][i].sigmavav >> theCurrentTemp.entx[k][i].kappavav - >> theCurrentTemp.entx[k][i].mpvvav2 >> theCurrentTemp.entx[k][i].sigmavav2 >> theCurrentTemp.entx[k][i].kappavav2 >> theCurrentTemp.entx[k][i].spare[0]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 27, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - in_file >> theCurrentTemp.entx[k][i].qbfrac[0] >> theCurrentTemp.entx[k][i].qbfrac[1] >> theCurrentTemp.entx[k][i].qbfrac[2] >> theCurrentTemp.entx[k][i].fracxone - >> theCurrentTemp.entx[k][i].spare[1] >> theCurrentTemp.entx[k][i].spare[2] >> theCurrentTemp.entx[k][i].spare[3] >> theCurrentTemp.entx[k][i].spare[4] - >> theCurrentTemp.entx[k][i].spare[5] >> theCurrentTemp.entx[k][i].spare[6]; - - if(in_file.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 28, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - - } - } - - - in_file.close(); - - // Add this template to the store - - theStripTemp_.push_back(theCurrentTemp); - - return true; - - } else { - - // If file didn't open, report this - - LOGERROR("SiStripTemplate") << "Error opening File " << tempfile << ENDL; - return false; - - } - -} // TempInit - - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - -//**************************************************************** -//! This routine initializes the global template structures from an -//! external file template_summary_zpNNNN where NNNN are four digits -//! \param dbobject - db storing multiple template calibrations -//**************************************************************** -bool SiStripTemplate::pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiStripTemplateStore > & theStripTemp_) -{ - // Add template stored in external dbobject to theTemplateStore - - // Local variables - int i, j, k, l; - float qavg_avg; - // const char *tempfile; - const int code_version={17}; - - // We must create a new object because dbobject must be a const and our stream must not be - SiPixelTemplateDBObject db = dbobject; - - // Create a local template storage entry - SiStripTemplateStore theCurrentTemp; - - // Fill the template storage for each template calibration stored in the db - for(int m=0; m> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx - >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale - >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file, no template load" << ENDL; return false;} - - LOGINFO("SiStripTemplate") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield - << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype - << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature " - << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale - << ", 1/2 threshold " << theCurrentTemp.head.s50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", x Lorentz width " << theCurrentTemp.head.lorxwidth - << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL; - - if(theCurrentTemp.head.templ_version < code_version) {LOGERROR("SiStripTemplate") << "code expects version " << code_version << ", no template load" << ENDL; return false;} - - -#ifdef SI_PIXEL_TEMPLATE_USE_BOOST - -// next, layout the 1-d/2-d structures needed to store template - - theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]); - - theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]); - -#endif - - // next, loop over all y-angle entries - - for (i=0; i < theCurrentTemp.head.NTy; ++i) { - - db >> theCurrentTemp.enty[i].runnum >> theCurrentTemp.enty[i].costrk[0] - >> theCurrentTemp.enty[i].costrk[1] >> theCurrentTemp.enty[i].costrk[2]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 1, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - // Calculate the alpha, beta, and cot(beta) for this entry - - theCurrentTemp.enty[i].alpha = static_cast(atan2((double)theCurrentTemp.enty[i].costrk[2], (double)theCurrentTemp.enty[i].costrk[0])); - - theCurrentTemp.enty[i].cotalpha = theCurrentTemp.enty[i].costrk[0]/theCurrentTemp.enty[i].costrk[2]; - - theCurrentTemp.enty[i].beta = static_cast(atan2((double)theCurrentTemp.enty[i].costrk[2], (double)theCurrentTemp.enty[i].costrk[1])); - - theCurrentTemp.enty[i].cotbeta = theCurrentTemp.enty[i].costrk[1]/theCurrentTemp.enty[i].costrk[2]; - - db >> theCurrentTemp.enty[i].qavg >> theCurrentTemp.enty[i].sxmax >> theCurrentTemp.enty[i].dxone >> theCurrentTemp.enty[i].sxone >> theCurrentTemp.enty[i].qmin >> theCurrentTemp.enty[i].clslenx; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 2, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - for (j=0; j<2; ++j) { - - db >> theCurrentTemp.enty[i].xpar[j][0] >> theCurrentTemp.enty[i].xpar[j][1] - >> theCurrentTemp.enty[i].xpar[j][2] >> theCurrentTemp.enty[i].xpar[j][3] >> theCurrentTemp.enty[i].xpar[j][4]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 6, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - } - - qavg_avg = 0.f; - for (j=0; j<9; ++j) { - - for (k=0; k> theCurrentTemp.enty[i].xtemp[j][k]; qavg_avg += theCurrentTemp.enty[i].xtemp[j][k];} - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 7, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - theCurrentTemp.enty[i].qavg_avg = qavg_avg/9.; - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].xavg[j] >> theCurrentTemp.enty[i].xrms[j] >> theCurrentTemp.enty[i].xgx0[j] >> theCurrentTemp.enty[i].xgsig[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 10, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].xflpar[j][0] >> theCurrentTemp.enty[i].xflpar[j][1] >> theCurrentTemp.enty[i].xflpar[j][2] - >> theCurrentTemp.enty[i].xflpar[j][3] >> theCurrentTemp.enty[i].xflpar[j][4] >> theCurrentTemp.enty[i].xflpar[j][5]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 11, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].chi2xavg[j] >> theCurrentTemp.enty[i].chi2xmin[j] >> theCurrentTemp.enty[i].chi2xavgc2m[j] >> theCurrentTemp.enty[i].chi2xminc2m[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 12, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].xavgc2m[j] >> theCurrentTemp.enty[i].xrmsc2m[j] >> theCurrentTemp.enty[i].xgx0c2m[j] >> theCurrentTemp.enty[i].xgsigc2m[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].xavggen[j] >> theCurrentTemp.enty[i].xrmsgen[j] >> theCurrentTemp.enty[i].xgx0gen[j] >> theCurrentTemp.enty[i].xgsiggen[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14b, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.enty[i].xavgbcn[j] >> theCurrentTemp.enty[i].xrmsbcn[j] >> theCurrentTemp.enty[i].xgx0bcn[j] >> theCurrentTemp.enty[i].xgsigbcn[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 14c, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - } - - db >> theCurrentTemp.enty[i].chi2xavgone >> theCurrentTemp.enty[i].chi2xminone >> theCurrentTemp.enty[i].qmin2 - >> theCurrentTemp.enty[i].mpvvav >> theCurrentTemp.enty[i].sigmavav >> theCurrentTemp.enty[i].kappavav - >> theCurrentTemp.enty[i].mpvvav2 >> theCurrentTemp.enty[i].sigmavav2 >> theCurrentTemp.enty[i].kappavav2 >> theCurrentTemp.enty[i].spare[0]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 15, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - db >> theCurrentTemp.enty[i].qbfrac[0] >> theCurrentTemp.enty[i].qbfrac[1] >> theCurrentTemp.enty[i].qbfrac[2] >> theCurrentTemp.enty[i].fracxone - >> theCurrentTemp.enty[i].spare[1] >> theCurrentTemp.enty[i].spare[2] >> theCurrentTemp.enty[i].spare[3] >> theCurrentTemp.enty[i].spare[4] - >> theCurrentTemp.enty[i].spare[5] >> theCurrentTemp.enty[i].spare[6]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 16, no template load, run # " << theCurrentTemp.enty[i].runnum << ENDL; return false;} - - } - - // next, loop over all barrel x-angle entries - - for (k=0; k < theCurrentTemp.head.NTyx; ++k) { - - for (i=0; i < theCurrentTemp.head.NTxx; ++i) { - - db >> theCurrentTemp.entx[k][i].runnum >> theCurrentTemp.entx[k][i].costrk[0] - >> theCurrentTemp.entx[k][i].costrk[1] >> theCurrentTemp.entx[k][i].costrk[2]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 17, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - // Calculate the alpha, beta, and cot(beta) for this entry - - theCurrentTemp.entx[k][i].alpha = static_cast(atan2((double)theCurrentTemp.entx[k][i].costrk[2], (double)theCurrentTemp.entx[k][i].costrk[0])); - - theCurrentTemp.entx[k][i].cotalpha = theCurrentTemp.entx[k][i].costrk[0]/theCurrentTemp.entx[k][i].costrk[2]; - - theCurrentTemp.entx[k][i].beta = static_cast(atan2((double)theCurrentTemp.entx[k][i].costrk[2], (double)theCurrentTemp.entx[k][i].costrk[1])); - - theCurrentTemp.entx[k][i].cotbeta = theCurrentTemp.entx[k][i].costrk[1]/theCurrentTemp.entx[k][i].costrk[2]; - - db >> theCurrentTemp.entx[k][i].qavg >> theCurrentTemp.entx[k][i].sxmax >> theCurrentTemp.entx[k][i].dxone >> theCurrentTemp.entx[k][i].sxone >> theCurrentTemp.entx[k][i].qmin >> theCurrentTemp.entx[k][i].clslenx; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 18, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - for (j=0; j<2; ++j) { - - db >> theCurrentTemp.entx[k][i].xpar[j][0] >> theCurrentTemp.entx[k][i].xpar[j][1] - >> theCurrentTemp.entx[k][i].xpar[j][2] >> theCurrentTemp.entx[k][i].xpar[j][3] >> theCurrentTemp.entx[k][i].xpar[j][4]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 19, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - } - - qavg_avg = 0.f; - for (j=0; j<9; ++j) { - - for (l=0; l> theCurrentTemp.entx[k][i].xtemp[j][l]; qavg_avg += theCurrentTemp.entx[k][i].xtemp[j][l];} - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 20, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - theCurrentTemp.entx[k][i].qavg_avg = qavg_avg/9.; - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].xavg[j] >> theCurrentTemp.entx[k][i].xrms[j] >> theCurrentTemp.entx[k][i].xgx0[j] >> theCurrentTemp.entx[k][i].xgsig[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 21, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].xflpar[j][0] >> theCurrentTemp.entx[k][i].xflpar[j][1] >> theCurrentTemp.entx[k][i].xflpar[j][2] - >> theCurrentTemp.entx[k][i].xflpar[j][3] >> theCurrentTemp.entx[k][i].xflpar[j][4] >> theCurrentTemp.entx[k][i].xflpar[j][5]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 22, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].chi2xavg[j] >> theCurrentTemp.entx[k][i].chi2xmin[j] >> theCurrentTemp.entx[k][i].chi2xavgc2m[j] >> theCurrentTemp.entx[k][i].chi2xminc2m[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 23, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].xavgc2m[j] >> theCurrentTemp.entx[k][i].xrmsc2m[j] >> theCurrentTemp.entx[k][i].xgx0c2m[j] >> theCurrentTemp.entx[k][i].xgsigc2m[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 24, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].xavggen[j] >> theCurrentTemp.entx[k][i].xrmsgen[j] >> theCurrentTemp.entx[k][i].xgx0gen[j] >> theCurrentTemp.entx[k][i].xgsiggen[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 25, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - for (j=0; j<4; ++j) { - - db >> theCurrentTemp.entx[k][i].xavgbcn[j] >> theCurrentTemp.entx[k][i].xrmsbcn[j] >> theCurrentTemp.entx[k][i].xgx0bcn[j] >> theCurrentTemp.entx[k][i].xgsigbcn[j]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 26, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - } - - db >> theCurrentTemp.entx[k][i].chi2xavgone >> theCurrentTemp.entx[k][i].chi2xminone >> theCurrentTemp.entx[k][i].qmin2 - >> theCurrentTemp.entx[k][i].mpvvav >> theCurrentTemp.entx[k][i].sigmavav >> theCurrentTemp.entx[k][i].kappavav - >> theCurrentTemp.entx[k][i].mpvvav2 >> theCurrentTemp.entx[k][i].sigmavav2 >> theCurrentTemp.entx[k][i].kappavav2 >> theCurrentTemp.entx[k][i].spare[0]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 27, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - db >> theCurrentTemp.entx[k][i].qbfrac[0] >> theCurrentTemp.entx[k][i].qbfrac[1] >> theCurrentTemp.entx[k][i].qbfrac[2] >> theCurrentTemp.entx[k][i].fracxone - >> theCurrentTemp.entx[k][i].spare[1] >> theCurrentTemp.entx[k][i].spare[2] >> theCurrentTemp.entx[k][i].spare[3] >> theCurrentTemp.entx[k][i].spare[4] - >> theCurrentTemp.entx[k][i].spare[5] >> theCurrentTemp.entx[k][i].spare[6]; - - if(db.fail()) {LOGERROR("SiStripTemplate") << "Error reading file 28, no template load, run # " << theCurrentTemp.entx[k][i].runnum << ENDL; return false;} - - - - } - } - - - // Add this template to the store - - theStripTemp_.push_back(theCurrentTemp); - - } - return true; - -} // TempInit - -#endif - - -// ************************************************************************************************************ -//! Interpolate input alpha and beta angles to produce a working template for each individual hit. -//! \param id - (input) index of the template to use -//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) -//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) -//! \param locBy - (input) the sign of the y-component of the local magnetic field (if positive, flip things) -// ************************************************************************************************************ -bool SiStripTemplate::interpolate(int id, float cotalpha, float cotbeta, float locBy) -{ - // Interpolate for a new set of track angles - - // Local variables - int i, j; - int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx, imidy, imaxx; - float yratio, yxratio, xxratio, sxmax, qcorrect, qxtempcor, chi2xavgone, chi2xminone, cota, cotb, cotalpha0, cotbeta0; - bool flip_x; -// std::vector xrms(4), xgsig(4), xrmsc2m(4), xgsigc2m(4); - std::vector chi2xavg(4), chi2xmin(4), chi2xavgc2m(4), chi2xminc2m(4); - - -// Check to see if interpolation is valid - -if(id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) { - - cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ = true; - - if(id != id_current_) { - -// Find the index corresponding to id - - index_id_ = -1; - for(i=0; i<(int)theStripTemp_.size(); ++i) { - - if(id == theStripTemp_[i].head.ID) { - - index_id_ = i; - id_current_ = id; - -// Copy the charge scaling factor to the private variable - - qscale_ = theStripTemp_[index_id_].head.qscale; - -// Copy the pseudopixel signal size to the private variable - - s50_ = theStripTemp_[index_id_].head.s50; - -// Pixel sizes to the private variables - - xsize_ = theStripTemp_[index_id_].head.xsize; - ysize_ = theStripTemp_[index_id_].head.ysize; - zsize_ = theStripTemp_[index_id_].head.zsize; - - break; - } - } - } - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(index_id_ < 0 || index_id_ >= (int)theStripTemp_.size()) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::interpolate can't find needed template ID = " << id << std::endl; - } -#else - assert(index_id_ >= 0 && index_id_ < (int)theStripTemp_.size()); -#endif - -// Interpolate the absolute value of cot(beta) - - abs_cotb_ = std::abs(cotbeta); - cotb = abs_cotb_; - -// qcorrect corrects the cot(alpha)=0 cluster charge for non-zero cot(alpha) - - cotalpha0 = theStripTemp_[index_id_].enty[0].cotalpha; - qcorrect=std::sqrt((1.f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.f+cotbeta*cotbeta+cotalpha0*cotalpha0)); -// flip quantities when the magnetic field in in the positive y local direction - if(locBy > 0.f) { - flip_x = true; - } else { - flip_x = false; - } - - Ny = theStripTemp_[index_id_].head.NTy; - Nyx = theStripTemp_[index_id_].head.NTyx; - Nxx = theStripTemp_[index_id_].head.NTxx; - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(Ny < 2 || Nyx < 1 || Nxx < 2) { - throw cms::Exception("DataCorrupt") << "template ID = " << id_current_ << "has too few entries: Ny/Nyx/Nxx = " << Ny << "/" << Nyx << "/" << Nxx << std::endl; - } -#else - assert(Ny > 1 && Nyx > 0 && Nxx > 1); -#endif - imaxx = Nyx - 1; - imidy = Nxx/2; - -// next, loop over all y-angle entries - - ilow = 0; - yratio = 0.f; - - if(cotb >= theStripTemp_[index_id_].enty[Ny-1].cotbeta) { - - ilow = Ny-2; - yratio = 1.f; - success_ = false; - - } else { - - if(cotb >= theStripTemp_[index_id_].enty[0].cotbeta) { - - for (i=0; i= theStripTemp_[index_id_].entx[Nyx-1][0].cotbeta) { - - iylow = Nyx-2; - yxratio = 1.f; - - } else if(abs_cotb_ >= theStripTemp_[index_id_].entx[0][0].cotbeta) { - - for (i=0; i= theStripTemp_[index_id_].entx[0][Nxx-1].cotalpha) { - - ilow = Nxx-2; - xxratio = 1.f; - success_ = false; - - } else { - - if(cota >= theStripTemp_[index_id_].entx[0][0].cotalpha) { - - for (i=0; i 0.f) {lorxwidth_ = -lorxwidth_;} - - } - - return success_; -} // interpolate - - - -// ************************************************************************************************************ -//! Return vector of x errors (squared) for an input vector of projected signals -//! Add large Q scaling for use in cluster splitting. -//! \param fxpix - (input) index of the first real pixel in the projected cluster (doesn't include pseudopixels) -//! \param lxpix - (input) index of the last real pixel in the projected cluster (doesn't include pseudopixels) -//! \param sxthr - (input) maximum signal before de-weighting -//! \param xsum - (input) 11-element vector of pixel signals -//! \param xsig2 - (output) 11-element vector of x errors (squared) -// ************************************************************************************************************ - void SiStripTemplate::xsigma2(int fxpix, int lxpix, float sxthr, float xsum[11], float xsig2[11]) - -{ - // Interpolate using quantities already stored in the private variables - - // Local variables - int i; - float sigi, sigi2, sigi3, sigi4, yint, sxmax, x0, qscale; - float sigiy, sigiy2, sigiy3, sigiy4; - - // Make sure that input is OK - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(fxpix < 2 || fxpix >= BSXM2) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xsigma2 called with fxpix = " << fxpix << std::endl; - } -#else - assert(fxpix > 1 && fxpix < BSXM2); -#endif -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(lxpix < fxpix || lxpix >= BSXM2) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xsigma2 called with lxpix/fxpix = " << lxpix << "/" << fxpix << std::endl; - } -#else - assert(lxpix >= fxpix && lxpix < BSXM2); -#endif - -// Define the maximum signal to use in the parameterization - - sxmax = sxmax_; - if(sxmax_ > sxparmax_) {sxmax = sxparmax_;} - -// Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis - - for(i=fxpix-2; i<=lxpix+2; ++i) { - if(i < fxpix || i > lxpix) { - -// Nearest pseudopixels have uncertainties of 50% of threshold, next-nearest have 10% of threshold - - xsig2[i] = s50_*s50_; - } else { - if(xsum[i] < sxmax) { - sigi = xsum[i]; - qscale = 1.f; - } else { - sigi = sxmax; - qscale = xsum[i]/sxmax; - } - sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi; - - if(xsum[i] < syparmax_) { - sigiy = xsum[i]; - } else { - sigiy = syparmax_; - } - sigiy2 = sigiy*sigiy; sigiy3 = sigiy2*sigiy; sigiy4 = sigiy3*sigiy; - -// First, do the cotbeta interpolation - - if(i <= BSHX) { - yint = (1.f-yratio_)* - (xparly0_[0][0]+xparly0_[0][1]*sigiy+xparly0_[0][2]*sigiy2+xparly0_[0][3]*sigiy3+xparly0_[0][4]*sigiy4) - + yratio_* - (xparhy0_[0][0]+xparhy0_[0][1]*sigiy+xparhy0_[0][2]*sigiy2+xparhy0_[0][3]*sigiy3+xparhy0_[0][4]*sigiy4); - } else { - yint = (1.f-yratio_)* - (xparly0_[1][0]+xparly0_[1][1]*sigiy+xparly0_[1][2]*sigiy2+xparly0_[1][3]*sigiy3+xparly0_[1][4]*sigiy4) - + yratio_* - (xparhy0_[1][0]+xparhy0_[1][1]*sigiy+xparhy0_[1][2]*sigiy2+xparhy0_[1][3]*sigiy3+xparhy0_[1][4]*sigiy4); - } - -// Next, do the cotalpha interpolation - - if(i <= BSHX) { - xsig2[i] = (1.f-xxratio_)* - (xparl_[0][0]+xparl_[0][1]*sigi+xparl_[0][2]*sigi2+xparl_[0][3]*sigi3+xparl_[0][4]*sigi4) - + xxratio_* - (xparh_[0][0]+xparh_[0][1]*sigi+xparh_[0][2]*sigi2+xparh_[0][3]*sigi3+xparh_[0][4]*sigi4); - } else { - xsig2[i] = (1.f-xxratio_)* - (xparl_[1][0]+xparl_[1][1]*sigi+xparl_[1][2]*sigi2+xparl_[1][3]*sigi3+xparl_[1][4]*sigi4) - + xxratio_* - (xparh_[1][0]+xparh_[1][1]*sigi+xparh_[1][2]*sigi2+xparh_[1][3]*sigi3+xparh_[1][4]*sigi4); - } - -// Finally, get the mid-point value of the cotalpha function - - if(i <= BSHX) { - x0 = xpar0_[0][0]+xpar0_[0][1]*sigi+xpar0_[0][2]*sigi2+xpar0_[0][3]*sigi3+xpar0_[0][4]*sigi4; - } else { - x0 = xpar0_[1][0]+xpar0_[1][1]*sigi+xpar0_[1][2]*sigi2+xpar0_[1][3]*sigi3+xpar0_[1][4]*sigi4; - } - -// Finally, rescale the yint value for cotalpha variation - - if(x0 != 0.f) {xsig2[i] = xsig2[i]/x0 * yint;} - xsig2[i] *=qscale; - if(xsum[i] > sxthr) {xsig2[i] = 1.e8f;} - if(xsig2[i] <= 0.f) {LOGERROR("SiStripTemplate") << "neg x-error-squared = " << xsig2[i] << ", id = " << id_current_ << ", index = " << index_id_ << - ", cot(alpha) = " << cota_current_ << ", cot(beta) = " << cotb_current_ << ", sigi = " << sigi << ", sxparmax = " << sxparmax_ << ", sxmax = " << sxmax_ << ENDL;} - } - } - - return; - -} // End xsigma2 - - - - -// ************************************************************************************************************ -//! Return interpolated x-correction for input charge bin and qflx -//! \param binq - (input) charge bin [0-3] -//! \param qflx - (input) (Q_f-Q_l)/(Q_f+Q_l) for this cluster -// ************************************************************************************************************ - float SiStripTemplate::xflcorr(int binq, float qflx) - -{ - // Interpolate using quantities already stored in the private variables - - // Local variables - float qfl, qfl2, qfl3, qfl4, qfl5, dx; - - // Make sure that input is OK - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(binq < 0 || binq > 3) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xflcorr called with binq = " << binq << std::endl; - } -#else - assert(binq >= 0 && binq < 4); -#endif -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(fabs((double)qflx) > 1.) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xflcorr called with qflx = " << qflx << std::endl; - } -#else - assert(fabs((double)qflx) <= 1.); -#endif - -// Define the maximum signal to allow before de-weighting a pixel - - qfl = qflx; - - if(qfl < -0.9f) {qfl = -0.9f;} - if(qfl > 0.9f) {qfl = 0.9f;} - -// Interpolate between the two polynomials - - qfl2 = qfl*qfl; qfl3 = qfl2*qfl; qfl4 = qfl3*qfl; qfl5 = qfl4*qfl; - dx = (1.f - yxratio_)*((1.f-xxratio_)*(xflparll_[binq][0]+xflparll_[binq][1]*qfl+xflparll_[binq][2]*qfl2+xflparll_[binq][3]*qfl3+xflparll_[binq][4]*qfl4+xflparll_[binq][5]*qfl5) - + xxratio_*(xflparlh_[binq][0]+xflparlh_[binq][1]*qfl+xflparlh_[binq][2]*qfl2+xflparlh_[binq][3]*qfl3+xflparlh_[binq][4]*qfl4+xflparlh_[binq][5]*qfl5)) - + yxratio_*((1.f-xxratio_)*(xflparhl_[binq][0]+xflparhl_[binq][1]*qfl+xflparhl_[binq][2]*qfl2+xflparhl_[binq][3]*qfl3+xflparhl_[binq][4]*qfl4+xflparhl_[binq][5]*qfl5) - + xxratio_*(xflparhh_[binq][0]+xflparhh_[binq][1]*qfl+xflparhh_[binq][2]*qfl2+xflparhh_[binq][3]*qfl3+xflparhh_[binq][4]*qfl4+xflparhh_[binq][5]*qfl5)); - - return dx; - -} // End xflcorr - - -// ************************************************************************************************************ -//! Return interpolated y-template in single call -//! \param fxbin - (input) index of first bin (0-40) to fill -//! \param fxbin - (input) index of last bin (0-40) to fill -//! \param xtemplate - (output) a 41x11 output buffer -// ************************************************************************************************************ - void SiStripTemplate::xtemp(int fxbin, int lxbin, float xtemplate[41][BSXSIZE]) - -{ - // Retrieve already interpolated quantities - - // Local variables - int i, j; - - // Verify that input parameters are in valid range - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(fxbin < 0 || fxbin > 40) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xtemp called with fxbin = " << fxbin << std::endl; - } -#else - assert(fxbin >= 0 && fxbin < 41); -#endif -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(lxbin < 0 || lxbin > 40) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::xtemp called with lxbin = " << lxbin << std::endl; - } -#else - assert(lxbin >= 0 && lxbin < 41); -#endif - -// Build the x-template, the central 25 bins are here in all cases - - for(i=0; i<9; ++i) { - for(j=0; j 32) { - for(i=1; i<9; ++i) { - xtemplate[i+32][0] = 0.f; - xtemplate[i+32][1] = 0.f; - for(j=0; j& cluster) - -{ - // Retrieve already interpolated quantities - - // Local variables - int i, j; - - // Extract x template based upon the hit position - - float xpix = xhit/xsize_ + 0.5f; -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(xpix < 0.f) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::2xtemp called with xhit = " << xhit << std::endl; - } -#else - assert(xpix >= 0.f); -#endif - -// cpix is struck pixel(strip) of the cluster - - int cpix = (int)xpix; - int shift = BSHX - cpix; - -// xbin the floating bin number and cbin is the bin number (between 0 and 7) of the interpolated template - - float xbin = 8.*(xpix-(float)cpix); - int cbin = (int)xbin; - - float xfrac = xbin-(float)cbin; - - int sizex = std::min((int)cluster.size(), BSXSIZE); - -// shift and interpolate the correct cluster shape - - for(i=0; i sizex-1) {cluster[i] = 0.f;} else { - cluster[i]=(1.f-xfrac)*xtemp_[cbin][j]+xfrac*xtemp_[cbin+1][j]; - if(cluster[i] < s50_) cluster[i] = 0.f; - } - -// Return cluster in same charge units - - cluster[i] /= qscale_; - } - - - return; - -} // End sxtemp - -// ************************************************************************************************************ -//! Return central pixel of x-template pixels above readout threshold -// ************************************************************************************************************ -int SiStripTemplate::cxtemp() - -{ - // Retrieve already interpolated quantities - - // Local variables - int j; - - // Analyze only pixels along the central entry - // First, find the maximum signal and then work out to the edges - - float sigmax = 0.f; - int jmax = -1; - - for(j=0; j sigmax) { - sigmax = xtemp_[4][j]; - jmax = j; - } - } - if(sigmax < 2.*s50_ || jmax<1 || jmax>BSXM2) {return -1;} - - // Now search forward and backward - - int jend = jmax; - - for(j=jmax+1; j0; --j) { - if(xtemp_[4][j] < 2.*s50_) break; - jbeg = j; - } - - return (jbeg+jend)/2; - -} // End cxtemp - - -// ************************************************************************************************************ -//! Make interpolated 3d x-template (stored as class variables) -//! \param nxpix - (input) number of pixels in cluster (needed to size template) -//! \param nxbins - (output) number of bins needed for each template projection -// ************************************************************************************************************ -void SiStripTemplate::xtemp3d_int(int nxpix, int& nxbins) - -{ - // Retrieve already interpolated quantities - - // Local variables - int i, j, k; - int ioff0, ioffp, ioffm; - - // Verify that input parameters are in valid range - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(nxpix < 1 || nxpix >= BSXM3) { - throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xtemp3d called with nxpix = " << nxpix << std::endl; - } -#else - assert(nxpix > 0 && nxpix < BSXM3); -#endif - - // Calculate the size of the shift in pixels needed to span the entire cluster - - float diff = fabsf(nxpix - clslenx_)/2. + 1.f; - int nshift = (int)diff; - if((diff - nshift) > 0.5f) {++nshift;} - - // Calculate the number of bins needed to specify each hit range - - nxbins_ = 9 + 16*nshift; - - // Create a 2-d working template with the correct size - - temp2dx_.resize(boost::extents[nxbins_][BSXSIZE]); - - // The 9 central bins are copied from the interpolated private store - - ioff0 = 8*nshift; - - for(i=0; i<9; ++i) { - for(j=0; j& xtemplate) - -{ - // Sum two 2-d templates to make the 3-d template - if(i >= 0 && i < nxbins_ && j <= i) { - for(int k=0; k= (int)theStripTemp_.size()) { - throw cms::Exception("DataCorrupt") << "SiStripTemplate::qbin can't find needed template ID = " << id << std::endl; - } -#else - assert(index >= 0 && index < (int)theStripTemp_.size()); -#endif - -// - -// Interpolate the absolute value of cot(beta) - - acotb = fabs((double)cotbeta); - -// qcorrect corrects the cot(alpha)=0 cluster charge for non-zero cot(alpha) - - // qcorrect corrects the cot(alpha)=0 cluster charge for non-zero cot(alpha) - - cotalpha0 = theStripTemp_[index].enty[0].cotalpha; - qcorrect=std::sqrt((1.f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.f+cotbeta*cotbeta+cotalpha0*cotalpha0)); - - // Copy the charge scaling factor to the private variable - - qscale = theStripTemp_[index].head.qscale; - - Ny = theStripTemp_[index].head.NTy; - Nyx = theStripTemp_[index].head.NTyx; - Nxx = theStripTemp_[index].head.NTxx; - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(Ny < 2 || Nyx < 1 || Nxx < 2) { - throw cms::Exception("DataCorrupt") << "template ID = " << id_current_ << "has too few entries: Ny/Nyx/Nxx = " << Ny << "/" << Nyx << "/" << Nxx << std::endl; - } -#else - assert(Ny > 1 && Nyx > 0 && Nxx > 1); -#endif - -// next, loop over all y-angle entries - - ilow = 0; - yratio = 0.f; - - if(acotb >= theStripTemp_[index].enty[Ny-1].cotbeta) { - - ilow = Ny-2; - yratio = 1.f; - - } else { - - if(acotb >= theStripTemp_[index].enty[0].cotbeta) { - - for (i=0; i 0.f && qmin > 0.f); -#endif - -// Scale the input charge to account for differences between pixelav and CMSSW simulation or data - - qtotal = qscale*qclus; - -// uncertainty and final corrections depend upon total charge bin - - fq = qtotal/qavg; - if(fq > 1.5f) { - binq=0; - } else { - if(fq > 1.0f) { - binq=1; - } else { - if(fq > 0.85f) { - binq=2; - } else { - binq=3; - } - } - } - -// If the charge is too small (then flag it) - - if(qtotal < 0.95f*qmin) {binq = 5;} else {if(qtotal < 0.95f*qmin2) {binq = 4;}} - - return binq; - -} // qbin - - -// ************************************************************************************************************ -//! Interpolate beta/alpha angles to produce Vavilov parameters for the charge distribution -//! \param mpv - (output) the Vavilov most probable charge (well, not really the most probable esp at large kappa) -//! \param sigma - (output) the Vavilov sigma parameter -//! \param kappa - (output) the Vavilov kappa parameter [0.01 (Landau-like) < kappa < 10 (Gaussian-like) -// ************************************************************************************************************ -void SiStripTemplate::vavilov_pars(double& mpv, double& sigma, double& kappa) - -{ - // Local variables - int i; - int ilow, ihigh, Ny; - float yratio, cotb, cotalpha0, arg; - -// Interpolate in cotbeta only for the correct total path length (converts cotalpha, cotbeta into an effective cotbeta) - - cotalpha0 = theStripTemp_[index_id_].enty[0].cotalpha; - arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0; - if(arg < 0.f) arg = 0.f; - cotb = std::sqrt(arg); - -// Copy the charge scaling factor to the private variable - - Ny = theStripTemp_[index_id_].head.NTy; - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(Ny < 2) { - throw cms::Exception("DataCorrupt") << "template ID = " << id_current_ << "has too few entries: Ny = " << Ny << std::endl; - } -#else - assert(Ny > 1); -#endif - -// next, loop over all y-angle entries - - ilow = 0; - yratio = 0.f; - - if(cotb >= theStripTemp_[index_id_].enty[Ny-1].cotbeta) { - - ilow = Ny-2; - yratio = 1.f; - - } else { - - if(cotb >= theStripTemp_[index_id_].enty[0].cotbeta) { - - for (i=0; i - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/VVIObj.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#define LOGERROR(x) edm::LogError(x) -#define LOGDEBUG(x) LogDebug(x) -constexpr int theVerboseLevel = 2; -#define ENDL " " -#include "FWCore/Utilities/interface/Exception.h" -#else -#include "SiStripTemplateReco.h" -#include "VVIObj.h" -//static int theVerboseLevel = {2}; -#define LOGERROR(x) std::cout << x << ": " -#define LOGDEBUG(x) std::cout << x << ": " -#define ENDL std::endl -#endif - -using namespace SiStripTemplateReco; - -// ************************************************************************************************************************************* -//! Reconstruct the best estimate of the hit position for strip clusters, -//! includes autoswitching to barycenter when that technique is more accurate. -//! \param id - (input) identifier of the template to use -//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) -//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) -//! \param locBy - (input) the sign of the local B_y field to specify the Lorentz drift direction -//! \param cluster - (input) boost multi_array container array of 13 pixel signals, -//! origin of local coords (0,0) at center of pixel cluster[0]. -//! \param templ - (input) the template used in the reconstruction -//! \param xrec - (output) best estimate of x-coordinate of hit in microns -//! \param sigmax - (output) best estimate of uncertainty on xrec in microns -//! \param probx - (output) probability describing goodness-of-fit for x-reco -//! \param qbin - (output) index (0-4) describing the charge of the cluster -//! qbin = 0 Q/Q_avg > 1.5 [few % of all hits] -//! 1 1.5 > Q/Q_avg > 1.0 [~30% of all hits] -//! 2 1.0 > Q/Q_avg > 0.85 [~30% of all hits] -//! 3 0.85 > Q/Q_avg > min1 [~30% of all hits] -//! 4 min1 > Q/Q_avg > min2 [~0.1% of all hits] -//! 5 min2 > Q/Q_avg [~0.1% of all hits] -//! \param speed - (input) switch (-2->5) trading speed vs robustness -//! -2 totally bombproof, searches the entire 41 bin range at full density (equiv to V2_4), -//! calculates Q probability w/ VVIObj (better but slower) -//! -1 totally bombproof, searches the entire 41 bin range at full density (equiv to V2_4), -//! calculates Q probability w/ TMath::VavilovI (poorer but faster) -//! 0 totally bombproof, searches the entire 41 bin range at full density (equiv to V2_4) -//! 1 faster, searches reduced 25 bin range (no big pix) + 33 bins (big pix at ends) at full density -//! 2 faster yet, searches same range as 1 but at 1/2 density -//! 3 fastest, searches same range as 1 but at 1/4 density (no big pix) and 1/2 density (big pix in cluster) -//! 4 fastest w/ Q prob, searches same range as 1 but at 1/4 density (no big pix) and 1/2 density (big pix in cluster), -//! calculates Q probability w/ VVIObj (better but slower) -//! 5 fastest w/ Q prob, searches same range as 1 but at 1/4 density (no big pix) and 1/2 density (big pix in cluster), -//! calculates Q probability w/ TMath::VavilovI (poorer but faster) -//! \param probQ - (output) the Vavilov-distribution-based cluster charge probability -// ************************************************************************************************************************************* -int SiStripTemplateReco::StripTempReco1D(int id, float cotalpha, float cotbeta, float locBy, std::vector& cluster, - SiStripTemplate& templ, - float& xrec, float& sigmax, float& probx, int& qbin, int speed, float& probQ) - -{ - // Local variables - int i, j, minbin, binl, binh, binq, midpix; - int fxpix, nxpix, lxpix, logxpx, shiftx, ftpix, ltpix; - int nclusx; - int deltaj, jmin, jmax, fxbin, lxbin, djx; - float sxthr, rnorm, delta, sigma, pseudopix, qscale, q50, q100; - float ss2, ssa, sa2, ssba, saba, sba2, rat, fq, qtotal, barycenter, sigmaxbcn; - float originx, qfx, qlx, bias, biasbcn, maxpix; - double chi2x, meanx, chi2xmin, chi21max; - double hchi2, hndof, prvav, mpv, sigmaQ, kappa, xvav, beta2; - float xtemp[41][BSXSIZE], xsum[BSXSIZE]; - float chi2xbin[41], xsig2[BSXSIZE]; - float xw2[BSXSIZE], xsw[BSXSIZE]; - bool calc_probQ, use_VVIObj; - float xsize; - const float probmin={1.110223e-16}; - const float probQmin={1.e-5}; - -// The minimum chi2 for a valid one pixel cluster = pseudopixel contribution only - - const double mean1pix={0.100}, chi21min={0.160}; - -// First, interpolate the template needed to analyze this cluster -// check to see of the track direction is in the physical range of the loaded template - - if(!templ.interpolate(id, cotalpha, cotbeta, locBy)) { - if (theVerboseLevel > 2) {LOGDEBUG("SiStripTemplateReco") << "input cluster direction cot(alpha) = " << cotalpha << ", cot(beta) = " << cotbeta << ", local B_y = " << locBy << ", template ID = " << id << ", no reconstruction performed" << ENDL;} - return 20; - } - -// Check to see if Q probability is selected - - calc_probQ = false; - use_VVIObj = false; - if(speed < 0) { - calc_probQ = true; - if(speed < -1) use_VVIObj = true; - speed = 0; - } - - if(speed > 3) { - calc_probQ = true; - if(speed < 5) use_VVIObj = true; - speed = 3; - } - -// Get pixel dimensions from the template (to allow multiple detectors in the future) - - xsize = templ.xsize(); - -// Define size of pseudopixel - - q50 = templ.s50(); - q100 = 2.f * q50; - pseudopix = q50; - -// Get charge scaling factor - - qscale = templ.qscale(); - -// enforce maximum size - - nclusx = (int)cluster.size(); - - if(nclusx > TSXSIZE) {nclusx = TSXSIZE;} - -// First, rescale all strip charges, sum them and trunate the strip charges - - qtotal = 0.; - for(i=0; i maxpix) {xsum[j] = maxpix;} - } - - barycenter = barycenter/qtotal - 0.5f*templ.lorxwidth(); - -// next, identify the x-cluster ends, count total pixels, nxpix, and logical pixels, logxpx - - fxpix = -1; - ftpix = -1; - nxpix=0; - lxpix=0; - ltpix=0; - logxpx=0; - for(i=0; i 0.f) { - if(fxpix == -1) {fxpix = i;} - ++logxpx; - ++nxpix; - lxpix = i; - if(xsum[i] > q100) { - if(ftpix == -1) {ftpix = i;} - ltpix = i; - } - } - } - - -// dlengthx = (float)nxpix - templ.clslenx(); - -// Make sure cluster is continuous - - if((lxpix-fxpix+1) != nxpix) { - - LOGDEBUG("SiStripTemplateReco") << "x-length of pixel cluster doesn't agree with number of pixels above threshold" << ENDL; - if (theVerboseLevel > 2) { - LOGDEBUG("SiStripTemplateReco") << "xsum[] = "; - for(i=0; i TSXSIZE) { - - LOGDEBUG("SiStripTemplateReco") << "x-length of pixel cluster is larger than maximum template size" << ENDL; - if (theVerboseLevel > 2) { - LOGDEBUG("SiStripTemplateReco") << "xsum[] = "; - for(i=0; i 0) { - for(i=lxpix; i>=fxpix; --i) { - xsum[i+shiftx] = xsum[i]; - xsum[i] = 0.f; - } - } else if (shiftx < 0) { - for(i=fxpix; i<=lxpix; ++i) { - xsum[i+shiftx] = xsum[i]; - xsum[i] = 0.f; - } - } - lxpix +=shiftx; - fxpix +=shiftx; - -// If the cluster boundaries are OK, add pesudopixels, otherwise quit - - if(fxpix > 1 && fxpix < BSXM2) { - xsum[fxpix-1] = pseudopix; - xsum[fxpix-2] = 0.2f*pseudopix; - } else {return 9;} - if(lxpix > 1 && lxpix < BSXM2) { - xsum[lxpix+1] = pseudopix; - xsum[lxpix+2] = 0.2f*pseudopix; - } else {return 9;} - -// finally, determine if pixel[0] is a double pixel and make an origin correction if it is - - originx = 0.f; - -// uncertainty and final corrections depend upon total charge bin - - fq = qtotal/templ.qavg(); - if(fq > 1.5f) { - binq=0; - } else { - if(fq > 1.0f) { - binq=1; - } else { - if(fq > 0.85f) { - binq=2; - } else { - binq=3; - } - } - } - -// Return the charge bin via the parameter list unless the charge is too small (then flag it) - - qbin = binq; - if(qtotal < 0.95f*templ.qmin()) {qbin = 5;} else { - if(qtotal < 0.95f*templ.qmin(1)) {qbin = 4;} - } - if (theVerboseLevel > 9) { - LOGDEBUG("SiStripTemplateReco") << - "ID = " << id << - " cot(alpha) = " << cotalpha << " cot(beta) = " << cotbeta << - " nclusx = " << nclusx << ENDL; - } - - -// Next, copy the y- and x-templates to local arrays - -// First, decide on chi^2 min search parameters - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(speed < 0 || speed > 3) { - throw cms::Exception("DataCorrupt") << "SiStripTemplateReco::StripTempReco2D called with illegal speed = " << speed << std::endl; - } -#else - assert(speed >= 0 && speed < 4); -#endif - fxbin = 2; lxbin = 38; djx = 1; - if(speed > 0) { - fxbin = 8; lxbin = 32; - } - - if(speed > 1) { - djx = 2; - if(speed > 2) { - djx = 4; - } - } - - if (theVerboseLevel > 9) { - LOGDEBUG("SiStripTemplateReco") << - "fxpix " << fxpix << " lxpix = " << lxpix << - " fxbin = " << fxbin << " lxbin = " << lxbin << - " djx = " << djx << " logxpx = " << logxpx << ENDL; - } - -// Now do the copies - - templ.xtemp(fxbin, lxbin, xtemp); - -// Do the x-reconstruction next - -// Apply the first-pass template algorithm to all clusters - -// Modify the template if double pixels are present - -// Define the maximum signal to allow before de-weighting a pixel - - sxthr = 1.1f*maxpix; - -// Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis - -// for(i=0; i 0) { - for(j=jmin; j<=jmax; j+=deltaj) { - if(chi2xbin[j] < -100.f) { - ssa = 0.f; - sa2 = 0.f; - for(i=fxpix-2; i<=lxpix+2; ++i) { - ssa += xsw[i]*xtemp[j][i]; - sa2 += xtemp[j][i]*xtemp[j][i]*xw2[i]; - } - rat=ssa/ss2; - if(rat <= 0.f) {LOGERROR("SiStripTemplateReco") << "illegal chi2xmin normalization (1) = " << rat << ENDL; rat = 1.;} - chi2xbin[j]=ss2-2.*ssa/rat+sa2/(rat*rat); - } - if(chi2xbin[j] < chi2xmin) { - chi2xmin = chi2xbin[j]; - minbin = j; - } - } - deltaj /= 2; - if(minbin > fxbin) {jmin = minbin - deltaj;} else {jmin = fxbin;} - if(minbin < lxbin) {jmax = minbin + deltaj;} else {jmax = lxbin;} - } - - if (theVerboseLevel > 9) { - LOGDEBUG("SiStripTemplateReco") << - "minbin " << minbin << " chi2xmin = " << chi2xmin << ENDL; - } - -// Do not apply final template pass to 1-pixel clusters (use calibrated offset) - - if(nxpix == 1) { - - delta = templ.dxone(); - sigma = templ.sxone(); - xrec = 0.5f*(fxpix+lxpix-2*shiftx+2.f*originx)*xsize-delta; - if(sigma <= 0.f) { - sigmax = 28.9f; - } else { - sigmax = sigma; - } - -// Do probability calculation for one-pixel clusters - - chi21max = fmax(chi21min, (double)templ.chi2xminone()); - chi2xmin -=chi21max; - if(chi2xmin < 0.) {chi2xmin = 0.;} - meanx = fmax(mean1pix, (double)templ.chi2xavgone()); - hchi2 = chi2xmin/2.; hndof = meanx/2.; - probx = 1. - TMath::Gamma(hndof, hchi2); - - } else { - -// Now make the second, interpolating pass with the templates - - binl = minbin - 1; - binh = binl + 2; - if(binl < fxbin) { binl = fxbin;} - if(binh > lxbin) { binh = lxbin;} - ssa = 0.; - sa2 = 0.; - ssba = 0.; - saba = 0.; - sba2 = 0.; - for(i=fxpix-2; i<=lxpix+2; ++i) { - ssa += xsw[i]*xtemp[binl][i]; - sa2 += xtemp[binl][i]*xtemp[binl][i]*xw2[i]; - ssba += xsw[i]*(xtemp[binh][i] - xtemp[binl][i]); - saba += xtemp[binl][i]*(xtemp[binh][i] - xtemp[binl][i])*xw2[i]; - sba2 += (xtemp[binh][i] - xtemp[binl][i])*(xtemp[binh][i] - xtemp[binl][i])*xw2[i]; - } - -// rat is the fraction of the "distance" from template a to template b - - rat=(ssba*ssa-ss2*saba)/(ss2*sba2-ssba*ssba); - if(rat < 0.f) {rat=0.f;} - if(rat > 1.f) {rat=1.0f;} - rnorm = (ssa+rat*ssba)/ss2; - -// Calculate the charges in the first and last pixels - - qfx = xsum[fxpix]; - if(logxpx > 1) { - qlx=xsum[lxpix]; - } else { - qlx = qfx; - } - -// Now calculate the mean bias correction and uncertainties - - float qxfrac = (qfx-qlx)/(qfx+qlx); - bias = templ.xflcorr(binq,qxfrac)+templ.xavg(binq); - -// uncertainty and final correction depend upon charge bin - - xrec = (0.125f*binl+BSHX-2.5f+rat*(binh-binl)*0.125f-(float)shiftx+originx)*xsize - bias; - sigmax = templ.xrms(binq); - -// Do goodness of fit test in x - - if(rnorm <= 0.f) {LOGERROR("SiStripTemplateReco") << "illegal chi2x normalization (2) = " << rnorm << ENDL; rnorm = 1.;} - chi2x=ss2-2.f/rnorm*ssa-2.f/rnorm*rat*ssba+(sa2+2.f*rat*saba+rat*rat*sba2)/(rnorm*rnorm)-templ.chi2xmin(binq); - if(chi2x < 0.0) {chi2x = 0.0;} - meanx = templ.chi2xavg(binq); - if(meanx < 0.01) {meanx = 0.01;} - // gsl function that calculates the chi^2 tail prob for non-integral dof - // probx = gsl_cdf_chisq_Q(chi2x, meanx); - // probx = ROOT::Math::chisquared_cdf_c(chi2x, meanx, trx0); - hchi2 = chi2x/2.; hndof = meanx/2.; - probx = 1. - TMath::Gamma(hndof, hchi2); - -// Now choose the better result - - bias = templ.xavg(binq); - biasbcn = templ.xavgbcn(binq); - sigmaxbcn = templ.xrmsbcn(binq); - - if((bias*bias+sigmax*sigmax) > (biasbcn*biasbcn+sigmaxbcn*sigmaxbcn)) { - - xrec = barycenter - biasbcn; - sigmax = sigmaxbcn; - - } - - } - -// Don't return exact zeros for the probability - - if(probx < probmin) {probx = probmin;} - -// Decide whether to generate a cluster charge probability - - if(calc_probQ) { - -// Calculate the Vavilov probability that the cluster charge is OK - - templ.vavilov_pars(mpv, sigmaQ, kappa); -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if((sigmaQ <=0.) || (mpv <= 0.) || (kappa < 0.01) || (kappa > 9.9)) { - throw cms::Exception("DataCorrupt") << "SiStripTemplateReco::Vavilov parameters mpv/sigmaQ/kappa = " << mpv << "/" << sigmaQ << "/" << kappa << std::endl; - } -#else - assert((sigmaQ > 0.) && (mpv > 0.) && (kappa > 0.01) && (kappa < 10.)); -#endif - xvav = ((double)qtotal-mpv)/sigmaQ; - beta2 = 1.; - if(use_VVIObj) { -// VVIObj is a private port of CERNLIB VVIDIS - sistripvvi::VVIObj vvidist(kappa, beta2, 1); - prvav = vvidist.fcn(xvav); - } else { -// Use faster but less accurate TMath Vavilov distribution function - prvav = TMath::VavilovI(xvav, kappa, beta2); - } -// Change to upper tail probability -// if(prvav > 0.5) prvav = 1. - prvav; -// probQ = (float)(2.*prvav); - probQ = 1. - prvav; - if(probQ < probQmin) {probQ = probQmin;} - } else { - probQ = -1; - } - - return 0; -} // StripTempReco2D - diff --git a/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplateSplit.cc b/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplateSplit.cc deleted file mode 100644 index 79f860b3ff442..0000000000000 --- a/RecoLocalTracker/SiStripRecHitConverter/src/SiStripTemplateSplit.cc +++ /dev/null @@ -1,447 +0,0 @@ -// -// SiStripTemplateSplit.cc -// -// Procedure to fit two templates (same angle hypotheses) to a single cluster -// -// Version 1.00 [based on SiPixelTemplateSplit.cc Version 2.30] -// Version 1.01 [improve error estimation for qbin=3 events] -// Version 1.05 [Incorporate VI-like speed improvements] -// Version 1.06 Clean-up irrelevant (since truncation) sorting -// Version 2.10 Clone speed improvements from the pixels (eliminate 3-d multi-arays, improve seach algorithm) -// -// Created by Morris Swartz on 04/10/08. -// -// - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -//#include -#else -#include -#endif -#include -#include -#include -#include -// ROOT::Math has a c++ function that does the probability calc, but only in v5.12 and later -#include "Math/DistFunc.h" -#include "TMath.h" -// Use current version of gsl instead of ROOT::Math -//#include - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateSplit.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/VVIObj.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#define LOGERROR(x) edm::LogError(x) -#define LOGDEBUG(x) LogDebug(x) -constexpr int theVerboseLevel = 2; -#define ENDL " " -#else -#include "SiStripTemplateSplit.h" -#include "VVIObj.h" -//#include "SiStripTemplate2D.h" -//#include "SimpleTemplate2D.h" -//static int theVerboseLevel = {2}; -#define LOGERROR(x) std::cout << x << ": " -#define LOGDEBUG(x) std::cout << x << ": " -#define ENDL std::endl -#endif - -using namespace SiStripTemplateSplit; - -// ************************************************************************************************************************************* -//! Reconstruct the best estimate of the hit positions for pixel clusters. -//! \param id - (input) identifier of the template to use -//! \param cotalpha - (input) the cotangent of the alpha track angle (see CMS IN 2004/014) -//! \param cotbeta - (input) the cotangent of the beta track angle (see CMS IN 2004/014) -//! \param locBy - (input) the sign of the local B_y field to specify the Lorentz drift direction -//! \param speed - (input) switch (-1->2) trading speed vs robustness -//! -1 totally bombproof, searches the entire ranges of template bins, -//! calculates Q probability w/ VVIObj -//! 0 totally bombproof, searches the entire template bin range at full density (no Qprob) -//! 1 faster, searches same range as 0 but at 1/2 density -//! 2 fastest, searches same range as 1 but at 1/4 density (no big pix) and 1/2 density (big pix in cluster) -//! \param cluster - (input) boost multi_array container of 7x21 array of pixel signals, -//! origin of local coords (0,0) at center of pixel cluster[0][0]. -//! \param templ - (input) the template used in the reconstruction -//! \param xrec1 - (output) best estimate of first x-coordinate of hit in microns -//! \param xrec2 - (output) best estimate of second x-coordinate of hit in microns -//! \param sigmax - (output) best estimate of uncertainty on xrec1 and xrec2 in microns -//! \param prob2x - (output) probability describing goodness-of-fit to a merged cluster hypothesis for x-reco -//! \param q2bin - (output) index (0-4) describing the charge of the cluster assuming a merged 2-hit cluster hypothesis -//! [0: 1.5& cluster, - SiStripTemplate& templ, - float& xrec1, float& xrec2, float& sigmax, float& prob2x, int& q2bin, float& prob2Q) - -{ - // Local variables - int i, j, k, binq, binqerr, midpix; - int fxpix, nxpix, lxpix, logxpx, shiftx; - int nclusx; - int nxbin, xcbin, minbinj, minbink; - int deltaj, jmin, jmax, kmin, kmax, km, fxbin, lxbin, djx; - float sxthr, delta, sigma, pseudopix, xsize, qscale; - float ss2, ssa, sa2, rat, fq, qtotal, qavg; - float originx, bias, maxpix; - double chi2x, meanx, chi2xmin, chi21max; - double hchi2, hndof; - double prvav, mpv, sigmaQ, kappa, xvav, beta2; - float xsum[BSXSIZE]; - float xsig2[BSXSIZE]; - float xw2[BSXSIZE], xsw[BSXSIZE]; - const float sqrt2x={2.00000}; - const float sqrt12={3.4641}; - const float probmin={1.110223e-16}; - const float prob2Qmin={1.e-5}; - -// bool SiStripTemplateSplit::SimpleTemplate2D(float cotalpha, float cotbeta, float xhit, float yhit, float thick, float lorxwidth, float lorywidth, -// float qavg, std::vector ydouble, std::vector xdouble, float template2d[BSXM2][BYM2]); - -// The minimum chi2 for a valid one pixel cluster = pseudopixel contribution only - - const double mean1pix={0.100}, chi21min={0.160}; - -// First, interpolate the template needed to analyze this cluster -// check to see of the track direction is in the physical range of the loaded template - - if(!templ.interpolate(id, cotalpha, cotbeta, locBy)) { - LOGDEBUG("SiStripTemplateReco") << "input cluster direction cot(alpha) = " << cotalpha << ", cot(beta) = " << cotbeta - << " is not within the acceptance of template ID = " << id << ", no reconstruction performed" << ENDL; - return 20; - } - - // Get pixel dimensions from the template (to allow multiple detectors in the future) - - xsize = templ.xsize(); - - // Define size of pseudopixel - - pseudopix = templ.s50(); - - // Get charge scaling factor - - qscale = templ.qscale(); - - // enforce maximum size - - nclusx = (int)cluster.size(); - - if(nclusx > TSXSIZE) {nclusx = TSXSIZE;} - - // First, rescale all strip charges, sum them and trunate the strip charges - - qtotal = 0.f; - for(i=0; i maxpix) {xsum[j] = maxpix;} - } - - // next, identify the x-cluster ends, count total pixels, nxpix, and logical pixels, logxpx - - fxpix = -1; - nxpix=0; - lxpix=0; - logxpx=0; - for(i=0; i 0.f) { - if(fxpix == -1) {fxpix = i;} - ++logxpx; - ++nxpix; - lxpix = i; - } - } - - - // dlengthx = (float)nxpix - templ.clslenx(); - - // Make sure cluster is continuous - - if((lxpix-fxpix+1) != nxpix) { - - LOGDEBUG("SiStripTemplateReco") << "x-length of pixel cluster doesn't agree with number of pixels above threshold" << ENDL; - if (theVerboseLevel > 2) { - LOGDEBUG("SiStripTemplateReco") << "xsum[] = "; - for(i=0; i TSXSIZE) { - - LOGDEBUG("SiStripTemplateReco") << "x-length of pixel cluster is larger than maximum template size" << ENDL; - if (theVerboseLevel > 2) { - LOGDEBUG("SiStripTemplateReco") << "xsum[] = "; - for(i=0; i 0) { - for(i=lxpix; i>=fxpix; --i) { - xsum[i+shiftx] = xsum[i]; - xsum[i] = 0.f; - } - } else if (shiftx < 0) { - for(i=fxpix; i<=lxpix; ++i) { - xsum[i+shiftx] = xsum[i]; - xsum[i] = 0.f; - } - } - lxpix +=shiftx; - fxpix +=shiftx; - - // If the cluster boundaries are OK, add pesudopixels, otherwise quit - - if(fxpix > 1 && fxpix 1 && lxpix < BSXM2) { - xsum[lxpix+1] = pseudopix; - xsum[lxpix+2] = 0.2f*pseudopix; - } else {return 9;} - - // finally, determine if pixel[0] is a double pixel and make an origin correction if it is - - originx = 0.f; - -// uncertainty and final corrections depend upon total charge bin - - qavg = templ.qavg(); - fq = qtotal/qavg; - if(fq > 3.0f) { - binq=0; - } else { - if(fq > 2.0f) { - binq=1; - } else { - if(fq > 1.70f) { - binq=2; - } else { - binq=3; - } - } - } - - // Return the charge bin via the parameter list unless the charge is too small (then flag it) - - q2bin = binq; - if(qtotal < 1.9f*templ.qmin()) {q2bin = 5;} else { - if(qtotal < 1.9f*templ.qmin(1)) {q2bin = 4;} - } - if (theVerboseLevel > 9) { - LOGDEBUG("SiStripTemplateReco") << - "ID = " << id << - " cot(alpha) = " << cotalpha << " cot(beta) = " << cotbeta << - " nclusx = " << nclusx << ENDL; - } - -// binqerr is the charge bin for error estimation - - binqerr = binq; - if(binqerr > 2) binqerr = 2; - -// Calculate the Vavilov probability that the cluster charge is consistent with a merged cluster - - if(speed < 0) { - templ.vavilov2_pars(mpv, sigmaQ, kappa); -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if((sigmaQ <=0.) || (mpv <= 0.) || (kappa < 0.01) || (kappa > 9.9)) { - throw cms::Exception("DataCorrupt") << "SiStripTemplateSplit::Vavilov parameters mpv/sigmaQ/kappa = " << mpv << "/" << sigmaQ << "/" << kappa << std::endl; - } -#else - assert((sigmaQ > 0.) && (mpv > 0.) && (kappa > 0.01) && (kappa < 10.)); -#endif - xvav = ((double)qtotal-mpv)/sigmaQ; - beta2 = 1.; -// VVIObj is a private port of CERNLIB VVIDIS - sistripvvi::VVIObj vvidist(kappa, beta2, 1); - prvav = vvidist.fcn(xvav); - prob2Q = 1. - prvav; - if(prob2Q < prob2Qmin) {prob2Q = prob2Qmin;} - } else { - prob2Q = -1.f; - } - - -// Next, generate the 3d x-template - - templ.xtemp3d_int(nxpix, nxbin); - -// retrieve the number of x-bins - - xcbin = nxbin/2; - -// Next, decide on chi^2 min search parameters - -#ifndef SI_PIXEL_TEMPLATE_STANDALONE - if(speed < -1 || speed > 2) { - throw cms::Exception("DataCorrupt") << "SiStripTemplateReco::PixelTempReco2D called with illegal speed = " << speed << std::endl; - } -#else - assert(speed >= -1 && speed < 3); -#endif - fxbin = 0; lxbin = nxbin-1; djx = 1; - if(speed > 0) { - djx = 2; - if(speed > 1) {djx = 4;} - } - -// Define the maximum signal to allow before de-weighting a pixel - - sxthr = 1.1f*maxpix; - -// Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis - -// for(i=0; i xtemp(BSXSIZE); - while(deltaj > 0) { - for(j=jmin; j - -namespace { - inline - float stripErrorSquared(const unsigned N, const float uProj) { - if( (float(N)-uProj) > 3.5f ) - return float(N*N)/12.f; - else { - const float P1=-0.339f; - const float P2=0.90f; - const float P3=0.279f; - const float uerr = P1*uProj*std::exp(-uProj*P2)+P3; - return uerr*uerr; - } - } -} - -StripClusterParameterEstimator::LocalValues -StripCPEfromTemplate::localParameters( const SiStripCluster& cluster, - const GeomDetUnit& det, - const LocalTrajectoryParameters& ltp) const -{ - StripClusterParameterEstimator::LocalValues final_lv; - - LocalPoint final_lp; - LocalError final_le; - - // Default reconstruction (needed if template reco fails) - - StripCPE::Param const& p = param( det ); - - LocalVector track = ltp.momentum(); - track *= - ( track.z()<0 ) ? fabs( p.thickness/track.z() ) : - ( track.z()>0 ) ? -fabs( p.thickness/track.z() ) : - p.maxLength/track.mag() ; - - const unsigned N = cluster.amplitudes().size(); - - const float fullProjection = p.coveredStrips( track+p.drift, ltp.position()); - - const float strip = cluster.barycenter() - 0.5f*(1.f-p.backplanecorrection) * fullProjection - + 0.5f*p.coveredStrips(track, ltp.position()); - - LocalPoint default_lp = p.topology->localPosition( strip, ltp.vector() ); - - - - - - // Get the error of the split cluster. - // If the cluster is not split, then the error is -99999.9. - // The split cluster error is in microns and it has to be transformed into centimeteres and then in measurement units - - float uerr2 = -99999.9; - float split_cluster_error = cluster.getSplitClusterError(); - - float local_pitch = p.topology->localPitch( default_lp ); - - if ( split_cluster_error > 0.0 && use_strip_split_cluster_errors ) - { - //cout << endl; - //cout << "Assign split rechit errors" << endl; - // go from microns to cm and then to strip units... - - uerr2 = - (split_cluster_error/10000.0 / local_pitch ) * - (split_cluster_error/10000.0 / local_pitch ); - } - else - { - //cout << endl; - //cout << "Assign default rechit errors" << endl; - uerr2 = stripErrorSquared( N, fabs(fullProjection) ); - } - - - LocalError default_le = p.topology->localError( strip, uerr2, ltp.vector() ); - - - - // Template reconstruction - - int ierr = 9999999; // failed template reco ( if ierr = 0, then, template reco was successful ) - float template_x_pos = -9999999.9; - float template_x_err = -9999999.9; - - // int cluster_size = (int)cluster.amplitudes().size(); - - // do not use template reco for huge clusters - if ( use_template_reco ) - { - - int id = -9999999; - - SiStripDetId ssdid = SiStripDetId( det.geographicalId() ); - - int is_stereo = (int)( ssdid.stereo() ); - - if ( p.moduleGeom == 1 ) // IB1 - { - if ( !is_stereo ) - id = 11; - else - id = 12; - } - else if ( p.moduleGeom == 2 ) // IB2 - { - id = 13; - } - else if ( p.moduleGeom == 3 ) // OB1 - { - id = 16; - } - else if ( p.moduleGeom == 4 ) // OB2 - { - if ( !is_stereo ) - id = 14; - else - id = 15; - } - //else - //cout << "Do not use templates for strip modules other than IB1, IB2, OB1 and OB2" << endl; - - const StripGeomDetUnit* stripdet = (const StripGeomDetUnit*)(&det); - - if ( (id > -9999999) && !(stripdet == nullptr) ) - { - // Variables needed by template reco - float cotalpha = -9999999.9; - float cotbeta = -9999999.9; - float locBy = -9999999.9; - std::vector vec_cluster_charge; - - // Variables returned by template reco - float xrec = -9999999.9; - float sigmax = -9999999.9; - float probx = -9999999.9; - int qbin = -9999999 ; - int speed = template_reco_speed ; - float probQ = -9999999.9; - - - LocalVector lbfield = ( stripdet->surface() ).toLocal( magfield_.inTesla( stripdet->surface().position() ) ); - locBy = lbfield.y(); - - - LocalVector localDir = ltp.momentum()/ltp.momentum().mag(); - float locx = localDir.x(); - float locy = localDir.y(); - float locz = localDir.z(); - cotalpha = locx/locz; - cotbeta = locy/locz; - - - int cluster_size = (int)( (cluster.amplitudes()).size() ); - for (int i=0; ilocalPosition( measurement_position_first_strip_center, ltp.vector() ); - - - SiStripTemplate templ(theStripTemp_); - ierr = SiStripTemplateReco::StripTempReco1D( id, - cotalpha, - cotbeta, - locBy, - vec_cluster_charge, - templ, - xrec, - sigmax, - probx, - qbin, - speed, - probQ ); - - - - // stripCPEtemplateProbability_ = probQ; - // stripCPEtemplateQbin_ = qbin; - - - template_x_pos = xrec / 10000.0 + local_position_first_strip_center.x(); - - if ( split_cluster_error > 0.0 && use_strip_split_cluster_errors ) - { - template_x_err = split_cluster_error/10000.0; - } - else - { - template_x_err = sigmax/10000.0; - } - - - } // if ( id > -9999999 && !stripdet == 0 ) - - } // if ( use_template_reco ) - - - if ( use_template_reco && ierr == 0 ) - { - //cout << "Use template reco " << ierr << endl; - - LocalPoint template_lp( template_x_pos , default_lp.y() , default_lp.z() ); - LocalError template_le( template_x_err*template_x_err, default_le.xy(), default_le.yy() ); - - - final_lv = std::make_pair( template_lp, template_le ); - - } - else - { - //cout << "Use default reco " << ierr << endl; - - final_lv = std::make_pair( default_lp, default_le ); - } - - return final_lv; - - -} - - - diff --git a/RecoLocalTracker/SubCollectionProducers/src/TrackClusterSplitter.cc b/RecoLocalTracker/SubCollectionProducers/src/TrackClusterSplitter.cc deleted file mode 100644 index dd24a1a8fbefd..0000000000000 --- a/RecoLocalTracker/SubCollectionProducers/src/TrackClusterSplitter.cc +++ /dev/null @@ -1,1858 +0,0 @@ -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "DataFormats/SiStripCluster/interface/SiStripCluster.h" -#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" -#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" -#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h" -#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" -#include "DataFormats/Common/interface/DetSetVectorNew.h" - -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/VertexReco/interface/Vertex.h" - -#include "TrackingTools/PatternTools/interface/Trajectory.h" -#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" -#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" -#include "TrackingTools/GeomPropagators/interface/Propagator.h" -#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" -#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" -#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" - -//added for my stuff H.S. -#include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" -#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" - -// gavril: the template header files -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate.h" -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplate2D.h" -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateSplit.h" -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateDefs.h" -#include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco.h" - -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplate.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateSplit.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateDefs.h" -#include "RecoLocalTracker/SiStripRecHitConverter/interface/SiStripTemplateReco.h" - -#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h" -#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" -#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" -#include "DataFormats/SiStripDetId/interface/SiStripDetId.h" - -// for strip sim splitting -#include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" -#include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" - -#include -#include -#include "boost/multi_array.hpp" - -#include -#include -using namespace std; - -class TrackClusterSplitter : public edm::stream::EDProducer<> -{ - -public: - TrackClusterSplitter(const edm::ParameterSet& iConfig) ; - ~TrackClusterSplitter() override ; - void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override ; - -private: - edm::EDGetTokenT > pixelClusters_; - edm::EDGetTokenT > stripClusters_; - - bool simSplitPixel_; - bool simSplitStrip_; - bool tmpSplitPixel_; - bool tmpSplitStrip_; - - // Template splitting needs to know the track direction. - // We can use either straight tracks, pixel tracks of fully reconstructed track. - // Straight tracks go from the first pixel verterx in the pixel vertex collection - // to the cluster center of charge (we use pixel vertices because track vertices are - // are not available at this point) - // If we set useStraightTracks_ = True, then straight tracks are used - bool useStraightTracks_; - - // If straight track approximation is not used (useStraightTracks_ = False), then, one can use either fully - // reconstructed tracks (useTrajectories_ = True) or pixel tracks ((useTrajectories_ = False). - // The use of either straight or fully reconstructed tracks give very similar performance. Use straight tracks - // by default because it's faster and less involved. Pixel tracks DO NOT work. - bool useTrajectories_; - - // These are either "generalTracks", if useTrajectories_ = True, or "pixelTracks" if useTrajectories_ = False - edm::EDGetTokenT trajTrackAssociations_; - edm::EDGetTokenT > tracks_; - - // This is the pixel primary vertex collection - edm::EDGetTokenT > vertices_; - - edm::EDGetTokenT< edm::DetSetVector > pixeldigisimlinkToken; - edm::EDGetTokenT< edm::DetSetVector > stripdigisimlinkToken; - - // gavril : what is this for ? - std::string propagatorName_; - edm::ESHandle magfield_; - edm::ESHandle propagator_; - edm::ESHandle geometry_; - - // This is needed if we want to to sim/truth pixel splitting - edm::Handle< edm::DetSetVector > pixeldigisimlink; - - // This is needed if we want to to sim/truth strip splitting - edm::Handle< edm::DetSetVector > stripdigisimlink; - - - // Template declarations - // Pixel templates - std::vector< SiPixelTemplateStore > thePixelTemp_; - std::vector< SiPixelTemplateStore2D > thePixelTemp2D_; - // Strip template - std::vector< SiStripTemplateStore > theStripTemp_; - - // A pointer to a track and a state on the detector - struct TrackAndState - { - TrackAndState(const reco::Track *aTrack, TrajectoryStateOnSurface aState) : - track(aTrack), state(aState) {} - const reco::Track* track; - TrajectoryStateOnSurface state; - }; - - // A pointer to a cluster and a list of tracks on it - template - struct ClusterWithTracks - { - ClusterWithTracks(const Cluster &c) : cluster(&c) {} - const Cluster* cluster; - std::vector tracks; - }; - - typedef ClusterWithTracks SiPixelClusterWithTracks; - typedef ClusterWithTracks SiStripClusterWithTracks; - - - // a subset of a vector, but with vector-like interface. - typedef boost::sub_range > SiPixelClustersWithTracks; - typedef boost::sub_range > SiStripClustersWithTracks; - - - // sim strip split - typedef std::pair SimHitIdpr; - TrackerHitAssociator::Config trackerHitAssociatorConfig_; - std::unique_ptr hitAssociator; - - template - static const C* getCluster(const TrackingRecHit* hit) ; - - template - static const C* equalClusters(const C &c1, const C &c2) - { - return nullptr; - } - - // Find a rechit in a vector of ClusterWithTrack - template class FindCluster - { - - public: - - FindCluster(const TrackingRecHit* hit) : toFind_( getCluster(hit) ) { } - - bool operator()(const ClusterWithTracks &test) const - { - assert(test.cluster); // make sure this is not 0 - return test.cluster == toFind_ || equalClusters(*test.cluster, *toFind_); - } - - private: - - const Cluster* toFind_; - - }; - - // Attach tracks to cluster ?!?! - template - void markClusters(std::map > > >& map, - const TrackingRecHit* hit, - const reco::Track* track, - const TrajectoryStateOnSurface& tsos) const ; - - template - std::unique_ptr > - splitClusters(const std::map > > > &input, - const reco::Vertex &vtx) const ; - - template - void splitCluster(const ClusterWithTracks &cluster, - const GlobalVector &dir, - typename edmNew::DetSetVector::FastFiller &output, - DetId detId) const ; - - /// working data - std::vector allSiPixelClusters; - std::map siPixelDetsWithClusters; - - std::vector allSiStripClusters; - std::map siStripDetsWithClusters; - - -}; - -template<> const SiPixelCluster * TrackClusterSplitter::getCluster(const TrackingRecHit *hit) ; - -template<> -void TrackClusterSplitter::splitCluster (const SiPixelClusterWithTracks &cluster, - const GlobalVector &dir, - edmNew::DetSetVector::FastFiller &output, - DetId detId - ) const ; - -template<> const SiStripCluster * TrackClusterSplitter::getCluster(const TrackingRecHit *hit) ; - -template<> -void TrackClusterSplitter::splitCluster (const SiStripClusterWithTracks &cluster, - const GlobalVector &dir, - edmNew::DetSetVector::FastFiller &output, - DetId detId - ) const ; - - -#define foreach BOOST_FOREACH - -TrackClusterSplitter::TrackClusterSplitter(const edm::ParameterSet& iConfig): - useTrajectories_(iConfig.getParameter("useTrajectories")), - trackerHitAssociatorConfig_(consumesCollector()) -{ - if (useTrajectories_) { - trajTrackAssociations_ = consumes(iConfig.getParameter("trajTrackAssociations")); - } else { - propagatorName_ = iConfig.getParameter("propagator"); - tracks_ = consumes >(iConfig.getParameter("tracks")); - } - - pixelClusters_ = consumes >(iConfig.getParameter("pixelClusters")); - stripClusters_ = consumes >(iConfig.getParameter("stripClusters")); - vertices_ = consumes >(iConfig.getParameter("vertices")); - - produces< edmNew::DetSetVector >(); - - produces< edmNew::DetSetVector >(); - - simSplitPixel_ = (iConfig.getParameter("simSplitPixel")); - simSplitStrip_ = (iConfig.getParameter("simSplitStrip")); - tmpSplitPixel_ = (iConfig.getParameter("tmpSplitPixel")); // not so nice... you don't want two bool but some switch - tmpSplitStrip_ = (iConfig.getParameter("tmpSplitStrip")); - - useStraightTracks_ = (iConfig.getParameter("useStraightTracks")); - - - if ( simSplitPixel_ ) pixeldigisimlinkToken = consumes< edm::DetSetVector >(edm::InputTag("simSiPixelDigis")); - if ( simSplitStrip_ ) stripdigisimlinkToken = consumes< edm::DetSetVector >(edm::InputTag("simSiStripDigis")); - - - - /* - cout << "TrackClusterSplitter : " << endl; - cout << endl << endl << endl; - cout << "(int)simSplitPixel_ = " << (int)simSplitPixel_ << endl; - cout << "(int)simSplitStrip_ = " << (int)simSplitStrip_ << endl; - cout << "(int)tmpSplitPixel_ = " << (int)tmpSplitPixel_ << endl; - cout << "(int)tmpSplitStrip_ = " << (int)tmpSplitStrip_ << endl; - cout << "stripClusters_ = " << stripClusters_ << endl; - cout << "pixelClusters_ = " << pixelClusters_ << endl; - cout << "(int)useTrajectories_ = " << (int)useTrajectories_ << endl; - cout << "trajectories_ = " << trajectories_ << endl; - cout << "propagatorName_ = " << propagatorName_ << endl; - cout << "vertices_ = " << vertices_ << endl; - cout << "useStraightTracks_ = " << useStraightTracks_ << endl; - cout << endl << endl << endl; - */ - - // Load template; 40 for barrel and 41 for endcaps - SiPixelTemplate::pushfile( 40, thePixelTemp_ ); - SiPixelTemplate::pushfile( 41, thePixelTemp_ ); - SiPixelTemplate2D::pushfile( 40, thePixelTemp2D_ ); - SiPixelTemplate2D::pushfile( 41, thePixelTemp2D_ ); - - // Load strip templates - SiStripTemplate::pushfile( 11, theStripTemp_ ); - SiStripTemplate::pushfile( 12, theStripTemp_ ); - SiStripTemplate::pushfile( 13, theStripTemp_ ); - SiStripTemplate::pushfile( 14, theStripTemp_ ); - SiStripTemplate::pushfile( 15, theStripTemp_ ); - SiStripTemplate::pushfile( 16, theStripTemp_ ); - -} - - -template<> -const SiStripCluster* -TrackClusterSplitter::getCluster(const TrackingRecHit* hit) -{ - if ( typeid(*hit) == typeid(SiStripRecHit2D) ) - { - return (static_cast(*hit)).cluster().get(); - } - else if ( typeid(*hit) == typeid(SiStripRecHit1D) ) - { - return (static_cast(*hit)).cluster().get(); - } - else - throw cms::Exception("Unsupported") << "Detid of type " << typeid(*hit).name() << " not supported.\n"; -} - -template<> -const SiPixelCluster* -TrackClusterSplitter::getCluster(const TrackingRecHit* hit) -{ - if ( typeid(*hit) == typeid(SiPixelRecHit) ) - { - return (static_cast(*hit)).cluster().get(); - } - else - throw cms::Exception("Unsupported") << "Detid of type " << typeid(*hit).name() << " not supported.\n"; -} - -TrackClusterSplitter::~TrackClusterSplitter() -{ -} - -void -TrackClusterSplitter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - using namespace edm; - - iSetup.get().get(geometry_); - - if ( !useTrajectories_ ) - { - iSetup.get().get( magfield_ ); - iSetup.get().get( "AnalyticalPropagator", propagator_ ); - } - - Handle > inputPixelClusters; - Handle > inputStripClusters; - - iEvent.getByToken(pixelClusters_, inputPixelClusters); - - iEvent.getByToken(stripClusters_, inputStripClusters); - - if(simSplitStrip_) - hitAssociator.reset(new TrackerHitAssociator(iEvent, trackerHitAssociatorConfig_)); - - - allSiPixelClusters.clear(); siPixelDetsWithClusters.clear(); - allSiStripClusters.clear(); siStripDetsWithClusters.clear(); - - - allSiPixelClusters.reserve(inputPixelClusters->dataSize()); // this is important, otherwise push_back invalidates the iterators - allSiStripClusters.reserve(inputStripClusters->dataSize()); // this is important, otherwise push_back invalidates the iterators - - - // fill in the list of all tracks - foreach(const edmNew::DetSet &ds, *inputPixelClusters) - { - std::vector::iterator start = allSiPixelClusters.end(); - allSiPixelClusters.insert(start, ds.begin(), ds.end()); - - std::vector::iterator end = allSiPixelClusters.end(); - siPixelDetsWithClusters[ds.detId()] = SiPixelClustersWithTracks(start,end); - } - - foreach(const edmNew::DetSet &ds, *inputStripClusters) - { - std::vector::iterator start = allSiStripClusters.end(); - allSiStripClusters.insert(start, ds.begin(), ds.end()); - - std::vector::iterator end = allSiStripClusters.end(); - siStripDetsWithClusters[ds.detId()] = SiStripClustersWithTracks(start,end); - } - - if ( useTrajectories_ ) - { - // Here use the fully reconstructed tracks to get the track angle - - Handle trajectories; - iEvent.getByToken(trajTrackAssociations_, trajectories); - for ( TrajTrackAssociationCollection::const_iterator it = trajectories->begin(), - ed = trajectories->end(); it != ed; ++it ) - { - const Trajectory & traj = *it->key; - const reco::Track * tk = &*it->val; - - if ( traj.measurements().size() != tk->recHitsSize() ) - throw cms::Exception("Aargh") << "Sizes don't match: traj " << traj.measurements().size() - << ", tk " << tk->recHitsSize() << "\n"; - - trackingRecHit_iterator it_hit = tk->recHitsBegin(), ed_hit = tk->recHitsEnd(); - - const Trajectory::DataContainer & tms = traj.measurements(); - - size_t i_hit = 0, last_hit = tms.size()-1; - - bool first = true, reversed = false; - - for (; it_hit != ed_hit; ++it_hit, ++i_hit) - { - // ignore hits with no detid - - if ((*it_hit)->geographicalId().rawId() == 0) - { - //cout << "It should never happen that a trackingRecHit has no detector ID !!!!!!!!!!!!!!!!! " << endl; - continue; - } - - // if it's the first hit, check the ordering of track vs trajectory - if (first) - { - - if ((*it_hit)->geographicalId() == tms[i_hit].recHit()->hit()->geographicalId()) - { - reversed = false; - } - else if ((*it_hit)->geographicalId() == tms[last_hit-i_hit].recHit()->hit()->geographicalId()) - { - reversed = true; - } - else - { - throw cms::Exception("Aargh") << "DetIDs don't match either way :-( \n"; - } - } - - const TrackingRecHit *hit = *it_hit; - if ( hit == nullptr || !hit->isValid() ) - continue; - - int subdet = hit->geographicalId().subdetId(); - - if (subdet >= 3) - { // strip - markClusters(siStripDetsWithClusters, hit, tk, tms[reversed ? last_hit-i_hit : i_hit].updatedState()); - } - else if (subdet >= 1) - { // pixel - markClusters(siPixelDetsWithClusters, hit, tk, tms[reversed ? last_hit-i_hit : i_hit].updatedState()); - } - else - { - edm::LogWarning("HitNotFound") << "Hit of type " << typeid(*hit).name() << ", detid " - << hit->geographicalId().rawId() << ", subdet " << subdet; - } - } - } - } - else - { - // Here use the pixel tracks to get the track angles - - Handle > tracks; - iEvent.getByToken(tracks_, tracks); - //TrajectoryStateTransform transform; - foreach (const reco::Track &track, *tracks) - { - FreeTrajectoryState atVtx = trajectoryStateTransform::innerFreeState(track, &*magfield_); - trackingRecHit_iterator it_hit = track.recHitsBegin(), ed_hit = track.recHitsEnd(); - for (; it_hit != ed_hit; ++it_hit) - { - const TrackingRecHit *hit = *it_hit; - if ( hit == nullptr || !hit->isValid() ) - continue; - - int subdet = hit->geographicalId().subdetId(); - - if ( subdet == 0 ) - continue; - - const GeomDet *det = geometry_->idToDet( hit->geographicalId() ); - - if ( det == nullptr ) - { - edm::LogError("MissingDetId") << "DetIDs " << (int)(hit->geographicalId()) << " is not in geometry.\n"; - continue; - } - - TrajectoryStateOnSurface prop = propagator_->propagate(atVtx, det->surface()); - if ( subdet >= 3 ) - { // strip - markClusters(siStripDetsWithClusters, hit, &track, prop); - } - else if (subdet >= 1) - { // pixel - markClusters(siPixelDetsWithClusters, hit, &track, prop); - } - else - { - edm::LogWarning("HitNotFound") << "Hit of type " << typeid(*hit).name() << ", detid " - << hit->geographicalId().rawId() << ", subdet " << subdet; - } - } - } - } - - Handle > vertices; - iEvent.getByToken(vertices_, vertices); - - // Needed in case of simsplit - if ( simSplitPixel_ ) - iEvent.getByToken(pixeldigisimlinkToken, pixeldigisimlink); - - // Needed in case of strip simsplit - if ( simSplitStrip_ ) - iEvent.getByToken(stripdigisimlinkToken, stripdigisimlink); - - // gavril : to do: choose the best vertex here instead of just choosing the first one ? - std::unique_ptr > newPixelClusters( splitClusters( siPixelDetsWithClusters, vertices->front() ) ); - std::unique_ptr > newStripClusters( splitClusters( siStripDetsWithClusters, vertices->front() ) ); - - iEvent.put(std::move(newPixelClusters)); - iEvent.put(std::move(newStripClusters)); - - allSiPixelClusters.clear(); siPixelDetsWithClusters.clear(); - allSiStripClusters.clear(); siStripDetsWithClusters.clear(); - -} - -template -void TrackClusterSplitter::markClusters( std::map > > >& map, - const TrackingRecHit* hit, - const reco::Track* track, - const TrajectoryStateOnSurface& tsos) const -{ - boost::sub_range > >& range = map[hit->geographicalId().rawId()]; - - typedef typename std::vector >::iterator IT; - IT match = std::find_if(range.begin(), range.end(), FindCluster(hit)); - - if ( match != range.end() ) - { - match->tracks.push_back( TrackAndState(track,tsos) ); - } - else - { - edm::LogWarning("ClusterNotFound") << "Cluster of type " << typeid(Cluster).name() << " on detid " - << hit->geographicalId().rawId() << " from hit of type " << typeid(*hit).name(); - } -} - -template -std::unique_ptr > -TrackClusterSplitter::splitClusters(const std::map > > > &input, - const reco::Vertex &vtx) const -{ - auto output = std::make_unique>(); - typedef std::pair > > > pair; - - foreach(const pair &p, input) - { - const GeomDet* det = geometry_->idToDet( DetId(p.first) ); - - if ( det == nullptr ) - { - edm::LogError("MissingDetId") << "DetIDs " << p.first << " is not in geometry.\n"; - continue; - } - - // gavril: Pass the PV instead of direction - // GlobalVector dir(det->position().x() - vtx.x(), det->position().y() - vtx.y(), det->position().z() - vtx.z()); - GlobalVector primary_vtx( vtx.x(), vtx.y(), vtx.z() ); - - // Create output collection - typename edmNew::DetSetVector::FastFiller detset(*output, p.first); - - // fill it - foreach(const ClusterWithTracks &c, p.second) - { - splitCluster(c, primary_vtx, detset, DetId(p.first) ); - } - } - - return output; -} - -template -void TrackClusterSplitter::splitCluster(const ClusterWithTracks &cluster, - const GlobalVector &dir, - typename edmNew::DetSetVector::FastFiller &output, - DetId detId) const -{ - //cout << "Should never be here: TrackClusterSplitter, TrackClusterSplitter::splitCluster(...) !!!!!!!!!!!!!!!!!!!!!!!!!!!!! " << endl; - throw cms::Exception("LogicError", "This should not be called"); -} - -template<> -void TrackClusterSplitter::splitCluster (const SiStripClusterWithTracks& c, - const GlobalVector &vtx, - edmNew::DetSetVector::FastFiller &output, - DetId detId - ) const -{ - if ( simSplitStrip_ ) - { - bool cluster_was_successfully_split = false; - - const SiStripCluster* clust = static_cast(c.cluster); - - std::vector associatedIdpr; - - hitAssociator->associateSimpleRecHitCluster(clust, detId, associatedIdpr); - - size_t splittableClusterSize = 0; - splittableClusterSize = associatedIdpr.size(); - auto const & amp = clust->amplitudes(); - int clusiz = amp.size(); - associatedIdpr.clear(); - - SiStripDetId ssdid( detId ); - - // gavril : sim splitting can be applied to the forward detectors as well... - - if ( ( splittableClusterSize > 1 && amp.size() > 2 ) && - ( (int)ssdid.moduleGeometry() == 1 || - (int)ssdid.moduleGeometry() == 2 || - (int)ssdid.moduleGeometry() == 3 || - (int)ssdid.moduleGeometry() == 4 ) ) - { - - edm::DetSetVector::const_iterator isearch = stripdigisimlink->find(detId); - - int first = clust->firstStrip(); - int last = first + clusiz; - uint16_t rawAmpl = 0, currentAmpl = 0; - - std::vector tmp1, tmp2; - - std::vector firstStrip; - std::vector trackInStrip; - std::vector trackID; - std::vector trackFraction; - std::vector< std::vector > trackAmp; - unsigned int currentChannel( 9999 ); - unsigned int thisTrackID = 0; - - if ( isearch != stripdigisimlink->end() ) - { - edm::DetSet link_detset = (*isearch); - - for ( edm::DetSet::const_iterator linkiter = link_detset.data.begin(); - linkiter != link_detset.data.end(); linkiter++) - { - if ( (int)(linkiter->channel()) >= first && (int)(linkiter->channel()) < last ) - { - int stripIdx = (int)linkiter->channel()-first; - rawAmpl = (uint16_t)(amp[stripIdx]); - - // DigiSimLinks are ordered first by channel; there can be > 1 track, and > 1 simHit for each track - - if ( linkiter->channel() != currentChannel ) - { - // New strip; store amplitudes for the previous one - uint16_t thisAmpl; - - for (size_t i=0; ichannel(); - } - - // Now deal with this new DigiSimLink - thisTrackID = linkiter->SimTrackId(); - - // Have we seen this track yet? - bool newTrack = true; - int thisTrackIdx = 9999; - - for (size_t i=0; i ampTmp; - trackAmp.push_back(ampTmp); - trackFraction.push_back(0); - thisTrackIdx = trackID.size()-1; - } - - trackInStrip[thisTrackIdx] = true; - trackFraction[thisTrackIdx] += linkiter->fraction(); - currentAmpl = rawAmpl; - - } - - }// end of loop over DigiSimLinks - - // we want to continue here!!!! - - std::vector newCluster; - // Fill amplitudes for the last strip and create a cluster for each track - uint16_t thisAmpl; - - for (size_t i=0; i < trackID.size(); ++i) - { - if ( trackInStrip[i] ) - { - if ( ( thisAmpl=rawAmpl ) < 254 ) - thisAmpl = min(uint16_t(253), max(uint16_t(0), (uint16_t)(rawAmpl*trackFraction[i]+0.5))); - - if ( thisAmpl > 0 ) - trackAmp[i].push_back( thisAmpl ); - //else - //cout << "thisAmpl = " << (int)thisAmpl << endl; - } - - newCluster.push_back( SiStripCluster( - firstStrip[i], - trackAmp[i].begin(), - trackAmp[i].end() ) ); - - } - - - for ( size_t i=0; i 0.0 && firstStrip[i] != 9999 && !trackAmp[i].empty() ) - { - // gavril : I think this should work - output.push_back( newCluster[i] ); - - //cout << endl << endl << endl; - //cout << "(int)(newCluster[i].amplitudes().size()) = " << (int)(newCluster[i].amplitudes().size()) << endl; - //for ( int j=0; j<(int)(newCluster[i].amplitudes().size()); ++j ) - //cout << "(newCluster[i].amplitudes())[j] = " << (int)(newCluster[i].amplitudes())[j] << endl; - - cluster_was_successfully_split = true; - } - else - { - //std::cout << "\t\t Rejecting new cluster" << std::endl; - - // gavril : I think this pointer should be deleted above - //delete newCluster[i]; - } - } - - } // if ( isearch != stripdigisimlink->end() ) ... - else - { - // Do nothing... - } - } - - - if ( !cluster_was_successfully_split ) - output.push_back( *c.cluster ); - - } // end of if ( strip_simSplit_ )... - - else if ( tmpSplitStrip_ ) - { - bool cluster_was_successfully_split = false; - - const SiStripCluster* theStripCluster = static_cast(c.cluster); - - if ( theStripCluster ) - { - //SiStripDetId ssdid( theStripCluster->geographicalId() ); - SiStripDetId ssdid( detId.rawId() ); - - // Do not attempt to split clusters of size less than or equal to one. - // Only split clusters in IB1, IB2, OB1, OB2 (TIB and TOB). - - if ( (int)theStripCluster->amplitudes().size() <= 1 || - ( (int)ssdid.moduleGeometry() != 1 && - (int)ssdid.moduleGeometry() != 2 && - (int)ssdid.moduleGeometry() != 3 && - (int)ssdid.moduleGeometry() != 4 ) ) - { - // Do nothing. - //cout << endl; - //cout << "Will NOT attempt to split this clusters: " << endl; - //cout << "(int)theStripCluster->amplitudes().size() = " << (int)theStripCluster->amplitudes().size() << endl; - //cout << "(int)ssdid.moduleGeometry() = " << (int)ssdid.moduleGeometry() << endl; - - } - else // if ( (int)theStripCluster->amplitudes().size() <= 1 ) - { - - //cout << endl; - //cout << "Will attempt to split this clusters: " << endl; - - int ID = -99999; - - int is_stereo = (int)( ssdid.stereo() ); - - if ( ssdid.moduleGeometry() == 1 ) // IB1 - { - if ( !is_stereo ) - ID = 11; - else - ID = 12; - } - else if ( ssdid.moduleGeometry() == 2 ) // IB2 - { - ID = 13; - } - else if ( ssdid.moduleGeometry() == 3 ) // OB1 - { - ID = 16; - } - else if ( ssdid.moduleGeometry() == 4 ) // OB2 - { - if ( !is_stereo ) - ID = 14; - else - ID = 15; - } - else - { - throw cms::Exception("TrackClusterSplitter::splitCluster") - << "\nERROR: Wrong strip teplate ID. Should only use templates for IB1, IB2, OB1 and OB2 !!!" << "\n\n"; - } - - - - - // Begin: determine incident angles ============================================================ - - float cotalpha_ = -99999.9; - float cotbeta_ = -99999.9; - - // First, determine track angles from straight track approximation - - // Find crude cluster center - // gavril : This is in local coordinates ? - float xcenter = theStripCluster->barycenter(); - - const GeomDetUnit* theDet = geometry_->idToDetUnit( detId ); - const StripGeomDetUnit* stripDet = dynamic_cast( theDet ); - - if ( !stripDet ) - { - throw cms::Exception("TrackClusterSplitter : ") - << "\nERROR: Wrong stripDet !!! " << "\n\n"; - } - - - const StripTopology* theTopol = &( stripDet->specificTopology() ); - - // Transform from measurement to local coordinates (in cm) - // gavril: may have to differently if kicks/bows are introduced. However, at this point there are no tracks...: - // LocalPoint lp = theTopol->localPosition( xcenter, /*const Topology::LocalTrackPred & */ trkPred ); - - // gavril : What is lp.y() for strips ? It is zero, but is that the strip center or one of the ends ? - LocalPoint lp = theTopol->localPosition( xcenter ); - - // Transform from local to global coordinates - GlobalPoint gp0 = theDet->surface().toGlobal( lp ); - - // Make a vector pointing from the PV to the cluster center - GlobalPoint gp(gp0.x()-vtx.x(), gp0.y()-vtx.y(), gp0.z()-vtx.z() ); - - // Make gp a unit vector, gv, pointing from the PV to the cluster center - float gp_mod = sqrt( gp.x()*gp.x() + gp.y()*gp.y() + gp.z()*gp.z() ); - float gpx = gp.x()/gp_mod; - float gpy = gp.y()/gp_mod; - float gpz = gp.z()/gp_mod; - GlobalVector gv(gpx, gpy, gpz); - - // Make unit vectors in local coordinates and then transform them in global coordinates - const Local3DVector lvx(1.0, 0.0, 0.0); - GlobalVector gvx = theDet->surface().toGlobal( lvx ); - const Local3DVector lvy(0.0, 1.0, 0.0); - GlobalVector gvy = theDet->surface().toGlobal( lvy ); - const Local3DVector lvz(0.0, 0.0, 1.0); - GlobalVector gvz = theDet->surface().toGlobal( lvz ); - - // Calculate angles alpha and beta - float gv_dot_gvx = gv.x()*gvx.x() + gv.y()*gvx.y() + gv.z()*gvx.z(); - float gv_dot_gvy = gv.x()*gvy.x() + gv.y()*gvy.y() + gv.z()*gvy.z(); - float gv_dot_gvz = gv.x()*gvz.x() + gv.y()*gvz.y() + gv.z()*gvz.z(); - - // gavril : check beta !!!!!!!!!!!! - //float alpha_ = atan2( gv_dot_gvz, gv_dot_gvx ); - //float beta_ = atan2( gv_dot_gvz, gv_dot_gvy ); - - cotalpha_ = gv_dot_gvx / gv_dot_gvz; - cotbeta_ = gv_dot_gvy / gv_dot_gvz; - - // Attempt to get a better angle from tracks (either pixel tracks or full tracks) - if ( !useStraightTracks_ ) - { - //cout << "TrackClusterSplitter.cc : " << endl; - //cout << "Should not be here for now !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " << endl; - - // Use either pixel tracks (useTrajectories_ = False) or fully reconstructed tracks (useTrajectories_ = True) - // When pixel/full tracks are not associated with the current cluster, will use angles from straight tracks - - // These are the tracks associated with this cluster - std::vector vec_tracks_states = c.tracks; - - if ( (int)vec_tracks_states.size() > 0 ) - { - //cout << "There is at least one track associated with this cluster. Pick the one with largest Pt." << endl; - //cout << "(int)vec_tracks_states.size() = " << (int)vec_tracks_states.size() << endl; - - int index_max_pt = -99999; // index of the track with the highest Pt - float max_pt = -99999.9; - - for (int i=0; i<(int)vec_tracks_states.size(); ++i ) - { - const reco::Track* one_track = vec_tracks_states[i].track; - - if ( one_track->pt() > max_pt ) - { - index_max_pt = i; - max_pt = one_track->pt(); - } - } - - // Pick the tsos from the track with highest Pt - // gavril: Should we use highest Pt or best Chi2 ? - TrajectoryStateOnSurface one_tsos = vec_tracks_states[index_max_pt].state; - - LocalTrajectoryParameters ltp = one_tsos.localParameters(); - - LocalVector localDir = ltp.momentum()/ltp.momentum().mag(); - - float locx = localDir.x(); - float locy = localDir.y(); - float locz = localDir.z(); - - //alpha_ = atan2( locz, locx ); - //beta_ = atan2( locz, locy ); - - cotalpha_ = locx/locz; - cotbeta_ = locy/locz; - - } // if ( (int)vec_tracks_states.size() > 0 ) - - } // if ( !useStraightTracks_ ) - - - // End: determine incident angles ============================================================ - - - // Calculate strip cluster charge and store amplitudes in vector for later use - - //cout << endl; - //cout << "Calculate strip cluster charge and store amplitudes in vector for later use" << endl; - - float strip_cluster_charge = 0.0; - std::vector vec_cluster_charge; - vec_cluster_charge.clear(); - int cluster_size = (int)( (theStripCluster->amplitudes()).size() ); - - int cluster_charge = 0; - for (int i=0; iamplitudes())[i] ); - - strip_cluster_charge += current_strip_charge; - vec_cluster_charge.push_back( current_strip_charge ); - - cluster_charge +=current_strip_charge; - } - - - //cout << endl; - //cout << "Calling strip qbin to see if the strip cluster has to be split..." << endl; - SiStripTemplate strip_templ_(theStripTemp_); - int strip_templQbin_ = strip_templ_.qbin( ID, cotalpha_, cotbeta_, strip_cluster_charge ); - - if ( strip_templQbin_ < 0 || strip_templQbin_ > 5 ) - { - // Do nothing... - // cout << "Wrong strip strip_templQbin_ = " << strip_templQbin_ << endl; - } // if ( strip_templQbin_ < 0 || strip_templQbin_ > 5 ) - else // if ( strip_templQbin_ < 0 || strip_templQbin_ > 5 ) {...} else - { - if ( strip_templQbin_ != 0 ) - { - // Do not split this cluster. Do nothing. - //cout << endl; - //cout << "Do NOT split this cluster" << endl; - - } // if ( strip_templQbin_ != 0 ) - else // if ( templQbin_ != 0 ) {...} else - { - //cout << endl; - //cout << "Split this cluster" << endl; - - // gavril : Is this OK ? - uint16_t first_strip = theStripCluster->firstStrip(); - - LocalVector lbfield = ( stripDet->surface() ).toLocal( magfield_->inTesla( stripDet->surface().position() ) ); - float locBy = lbfield.y(); - - // Initialize values coming back from SiStripTemplateSplit::StripTempSplit - float stripTemplXrec1_ = -99999.9; - float stripTemplXrec2_ = -99999.9; - float stripTemplSigmaX_ = -99999.9; - float stripTemplProbX_ = -99999.9; - int stripTemplQbin_ = -99999; - float stripTemplProbQ_ = -99999.9; - - - /* - cout << endl; - cout << "About to call SiStripTemplateSplit::StripTempSplit(...)" << endl; - - cout << endl; - cout << "ID = " << ID << endl; - cout << "cotalpha_ = " << cotalpha_ << endl; - cout << "cotbeta_ = " << cotbeta_ << endl; - cout << "locBy = " << locBy << endl; - cout << "Amplitudes: "; - for (int i=0; i<(int)vec_cluster_charge.size(); ++i) - cout << vec_cluster_charge[i] << ", "; - cout << endl; - */ - - int ierr = - SiStripTemplateSplit::StripTempSplit(ID, - cotalpha_, cotbeta_, - locBy, - vec_cluster_charge, - strip_templ_, - stripTemplXrec1_, - stripTemplXrec2_, - stripTemplSigmaX_, - stripTemplProbX_, - stripTemplQbin_, - stripTemplProbQ_ ); - - - - stripTemplXrec1_ += 2*strip_templ_.xsize(); - stripTemplXrec2_ += 2*strip_templ_.xsize(); - - - - if ( ierr != 0 ) - { - //cout << endl; - //cout << "Strip cluster splitting failed: ierr = " << ierr << endl; - } - else // if ( ierr != 0 ) - { - // Cluster was successfully split. - // Make the two split clusters and put them in the split cluster collection - - //cout << endl; - //cout << "Cluster was successfully split" << endl; - - cluster_was_successfully_split = true; - - std::vector strip_cluster1; - std::vector strip_cluster2; - - strip_cluster1.clear(); - strip_cluster2.clear(); - - // gavril : Is this OK ?!?!?!?! - for (int i=0; i vecSiStripDigi1; - vecSiStripDigi1.clear(); - int strip_cluster1_size = (int)strip_cluster1.size(); - for (int i=2; i 0.0 ) - { - SiStripDigi current_digi1( first_strip + i-2, strip_cluster1[i] ); - - vecSiStripDigi1.push_back( current_digi1 ); - } - } - - - - vector vecSiStripDigi2; - vecSiStripDigi2.clear(); - int strip_cluster2_size = (int)strip_cluster2.size(); - for (int i=2; i 0.0 ) - { - SiStripDigi current_digi2( first_strip + i-2, strip_cluster2[i] ); - - vecSiStripDigi2.push_back( current_digi2 ); - } - } - - - - - std::vector::const_iterator SiStripDigiIterBegin1 = vecSiStripDigi1.begin(); - std::vector::const_iterator SiStripDigiIterEnd1 = vecSiStripDigi1.end(); - std::pair::const_iterator, - std::vector::const_iterator> SiStripDigiRange1 - = make_pair(SiStripDigiIterBegin1, SiStripDigiIterEnd1); - - //if ( SiStripDigiIterBegin1 == SiStripDigiIterEnd1 ) - //{ - // throw cms::Exception("TrackClusterSplitter : ") - //<< "\nERROR: SiStripDigiIterBegin1 = SiStripDigiIterEnd1 !!!" << "\n\n"; - //} - - std::vector::const_iterator SiStripDigiIterBegin2 = vecSiStripDigi2.begin(); - std::vector::const_iterator SiStripDigiIterEnd2 = vecSiStripDigi2.end(); - std::pair::const_iterator, - std::vector::const_iterator> SiStripDigiRange2 - = make_pair(SiStripDigiIterBegin2, SiStripDigiIterEnd2); - - // Sanity check... - //if ( SiStripDigiIterBegin2 == SiStripDigiIterEnd2 ) - //{ - // cout << endl; - // cout << "SiStripDigiIterBegin2 = SiStripDigiIterEnd2 !!!!!!!!!!!!!!!" << endl; - //} - - - // Save the split clusters - - if ( SiStripDigiIterBegin1 != SiStripDigiIterEnd1 ) - { - // gavril : Raw id ? - SiStripCluster cl1( SiStripDigiRange1 ); - - cl1.setSplitClusterError( stripTemplSigmaX_ ); - - output.push_back( cl1 ); - - if ( (int)cl1.amplitudes().size() <= 0 ) - { - throw cms::Exception("TrackClusterSplitter : ") - << "\nERROR: (1) Wrong split cluster of size = " << (int)cl1.amplitudes().size() << "\n\n"; - } - - } // if ( SiStripDigiIterBegin1 != SiStripDigiIterEnd1 ) - - if ( SiStripDigiIterBegin2 != SiStripDigiIterEnd2 ) - { - // gavril : Raw id ? - SiStripCluster cl2( SiStripDigiRange2 ); - cl2.setSplitClusterError( stripTemplSigmaX_ ); - output.push_back( cl2 ); - - if ( (int)cl2.amplitudes().size() <= 0 ) - { - throw cms::Exception("TrackClusterSplitter : ") - << "\nERROR: (2) Wrong split cluster of size = " << (int)cl2.amplitudes().size() << "\n\n"; - } - - } // if ( SiStripDigiIterBegin2 != SiStripDigiIterEnd2 ) - - - - } // else // if ( ierr != 0 ) - - } // else // if ( strip_templQbin_ != 0 ) {...} else - - } // else // if ( strip_templQbin_ < 0 || strip_templQbin_ > 5 ) {...} else - - } // else // if ( (int)theStripCluster->amplitudes().size() <= 1 ) - - - if ( !cluster_was_successfully_split ) - output.push_back( *c.cluster ); - - } // if ( theStripCluster ) - else - { - throw cms::Exception("TrackClusterSplitter : ") - << "\nERROR: This is not a SiStripCluster !!!" << "\n\n"; - } - - } // else if ( strip_tmpSplit_ ) - else - { - // gavril : Neither sim nor template splitter. Just add the cluster as it was. - output.push_back( *c.cluster ); - } -} - -template<> -void TrackClusterSplitter::splitCluster (const SiPixelClusterWithTracks &c, - const GlobalVector &vtx, - edmNew::DetSetVector::FastFiller &output, - DetId detId - ) const -{ - // The sim splitter: - if ( simSplitPixel_ ) - { - // cout << "Cluster splitting using simhits " << endl; - - int minPixelRow = (*c.cluster).minPixelRow(); - int maxPixelRow = (*c.cluster).maxPixelRow(); - int minPixelCol = (*c.cluster).minPixelCol(); - int maxPixelCol = (*c.cluster).maxPixelCol(); - int dsl = 0; // number of digisimlinks - - edm::DetSetVector::const_iterator isearch = pixeldigisimlink->find(output.id()); - if (isearch != pixeldigisimlink->end()){ - edm::DetSet digiLink = (*isearch); - - edm::DetSet::const_iterator linkiter = digiLink.data.begin(); - //create a vector for the track ids in the digisimlinks - std::vector simTrackIdV; - simTrackIdV.clear(); - //create a vector for the new splittedClusters - std::vector splittedCluster; - splittedCluster.clear(); - - for ( ; linkiter != digiLink.data.end(); linkiter++) - { // loop over all digisimlinks - dsl++; - std::pair pixel_coord = PixelDigi::channelToPixel(linkiter->channel()); - - // is the digisimlink inside the cluster boundaries? - if ( pixel_coord.first <= maxPixelRow && - pixel_coord.first >= minPixelRow && - pixel_coord.second <= maxPixelCol && - pixel_coord.second >= minPixelCol ) - { - bool inStock(false); // did we see this simTrackId before? - - SiPixelCluster::PixelPos newPixelPos(pixel_coord.first, pixel_coord.second); // coordinates to the pixel - - //loop over the pixels from the cluster to get the charge in this pixel - int newPixelCharge(0); //fraction times charge in the original cluster pixel - - const std::vector& pixvector = (*c.cluster).pixels(); - - for(std::vector::const_iterator itPix = pixvector.begin(); itPix != pixvector.end(); itPix++) - { - if (((int) itPix->x) == ((int) pixel_coord.first)&&(((int) itPix->y) == ((int) pixel_coord.second))) - { - newPixelCharge = (int) (linkiter->fraction()*itPix->adc); - } - } - - if ( newPixelCharge < 2500 ) - continue; - - //add the pixel to an already existing cluster if the charge is above the threshold - int clusVecPos = 0; - std::vector::const_iterator sTIter = simTrackIdV.begin(); - - for ( ; sTIter < simTrackIdV.end(); sTIter++) - { - if (((*sTIter)== (int) linkiter->SimTrackId())) - { - inStock=true; // now we saw this id before - // // std::cout << " adding a pixel to the cluster " << (int) (clusVecPos) <SimTrackId()); // add the track id to the vector - splittedCluster.push_back(SiPixelCluster(newPixelPos,newPixelCharge)); // add the cluster to the vector - } - } - } - - // std::cout << "will add clusters : simTrackIdV.size() " << simTrackIdV.size() << std::endl; - - if ( ( ( (int)simTrackIdV.size() ) == 1 ) || ( *c.cluster).size()==1 ) - { - // cout << "putting in this cluster" << endl; - output.push_back(*c.cluster ); - // std::cout << "cluster added " << output.size() << std::endl; - } - else - { - for (std::vector::const_iterator cIter = splittedCluster.begin(); cIter != splittedCluster.end(); cIter++ ) - { - output.push_back( (*cIter) ); - } - } - - simTrackIdV.clear(); - splittedCluster.clear(); - }//if (isearch != pixeldigisimlink->end()) - } - else if ( tmpSplitPixel_ ) - { - bool cluster_was_successfully_split = false; - - const SiPixelCluster* thePixelCluster = static_cast(c.cluster); - - if ( thePixelCluster ) - { - // Do not attempt to split clusters of size one - if ( (int)thePixelCluster->size() <= 1 ) - { - // Do nothing. - //cout << "Will not attempt to split this clusters: " << endl; - //cout << "(int)thePixelCluster->size() = " << (int)thePixelCluster->size() << endl; - } - else - { - // For barrel use template id 40 and for endcaps use template id 41 - int ID = -99999; - if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelBarrel ) - { - // cout << "We are in the barrel : " << (int)PixelSubdetector::PixelBarrel << endl; - ID = 40; - } - else if ( (int)detId.subdetId() == (int)PixelSubdetector::PixelEndcap ) - { - // cout << "We are in the endcap : " << (int)PixelSubdetector::PixelEndcap << endl; - ID = 41; - } - else - { - // cout << "Not a pixel detector !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " << endl; - } - - - // Begin: determine incident angles ============================================================ - - float cotalpha_ = -99999.9; - float cotbeta_ = -99999.9; - - // First, determine track angles from straight track approximation - - // Find crude cluster center. - float xcenter = thePixelCluster->x(); - float ycenter = thePixelCluster->y(); - - const GeomDetUnit* theDet = geometry_->idToDetUnit( detId ); - const PixelGeomDetUnit* pixDet = dynamic_cast( theDet ); - - const PixelTopology* theTopol = (&(pixDet->specificTopology())); - - // Transform from measurement to local coordinates (in cm) - LocalPoint lp = theTopol->localPosition( MeasurementPoint(xcenter, ycenter) ); - - // Transform from local to global coordinates - GlobalPoint gp0 = theDet->surface().toGlobal( lp ); - - // Make a vector pointing from the PV to the cluster center - GlobalPoint gp(gp0.x()-vtx.x(), gp0.y()-vtx.y(), gp0.z()-vtx.z() ); - - // Make gp a unit vector, gv, pointing from the PV to the cluster center - float gp_mod = sqrt( gp.x()*gp.x() + gp.y()*gp.y() + gp.z()*gp.z() ); - float gpx = gp.x()/gp_mod; - float gpy = gp.y()/gp_mod; - float gpz = gp.z()/gp_mod; - GlobalVector gv(gpx, gpy, gpz); - - // Make unit vectors in local coordinates and then transform them in global coordinates - const Local3DVector lvx(1.0, 0.0, 0.0); - GlobalVector gvx = theDet->surface().toGlobal( lvx ); - const Local3DVector lvy(0.0, 1.0, 0.0); - GlobalVector gvy = theDet->surface().toGlobal( lvy ); - const Local3DVector lvz(0.0, 0.0, 1.0); - GlobalVector gvz = theDet->surface().toGlobal( lvz ); - - // Calculate angles alpha and beta - float gv_dot_gvx = gv.x()*gvx.x() + gv.y()*gvx.y() + gv.z()*gvx.z(); - float gv_dot_gvy = gv.x()*gvy.x() + gv.y()*gvy.y() + gv.z()*gvy.z(); - float gv_dot_gvz = gv.x()*gvz.x() + gv.y()*gvz.y() + gv.z()*gvz.z(); - - //float alpha_ = atan2( gv_dot_gvz, gv_dot_gvx ); - //float beta_ = atan2( gv_dot_gvz, gv_dot_gvy ); - - cotalpha_ = gv_dot_gvx / gv_dot_gvz; - cotbeta_ = gv_dot_gvy / gv_dot_gvz; - - - - - // Attempt to get a better angle from tracks (either pixel tracks or full tracks) - if ( !useStraightTracks_ ) - { - // Use either pixel tracks (useTrajectories_ = False) or fully reconstructed tracks (useTrajectories_ = True) - // When pixel/full tracks are not associated with the current cluster, will use angles from straight tracks - - // These are the tracks associated with this cluster - std::vector vec_tracks_states = c.tracks; - - - - if ( (int)vec_tracks_states.size() > 0 ) - { - //cout << "There is at least one track associated with this cluster. Pick the one with largest Pt." << endl; - //cout << "(int)vec_tracks_states.size() = " << (int)vec_tracks_states.size() << endl; - - int index_max_pt = -99999; // index of the track with the highest Pt - float max_pt = -99999.9; - - for (int i=0; i<(int)vec_tracks_states.size(); ++i ) - { - const reco::Track* one_track = vec_tracks_states[i].track; - - if ( one_track->pt() > max_pt ) - { - index_max_pt = i; - max_pt = one_track->pt(); - } - } - - // Pick the tsos from the track with highest Pt - // gavril: Should we use highest Pt or best Chi2 ? - TrajectoryStateOnSurface one_tsos = vec_tracks_states[index_max_pt].state; - - LocalTrajectoryParameters ltp = one_tsos.localParameters(); - - LocalVector localDir = ltp.momentum()/ltp.momentum().mag(); - - float locx = localDir.x(); - float locy = localDir.y(); - float locz = localDir.z(); - - //alpha_ = atan2( locz, locx ); - //beta_ = atan2( locz, locy ); - - cotalpha_ = locx/locz; - cotbeta_ = locy/locz; - - - - } // if ( (int)vec_tracks_states.size() > 0 ) - - } // if ( !useStraightTracks_ ) - - // End: determine incident angles ============================================================ - - - - //cout << "Calling qbin to see if the cluster has to be split..." << endl; - SiPixelTemplate templ_(thePixelTemp_); - SiPixelTemplate2D templ2D_(thePixelTemp2D_); - int templQbin_ = templ_.qbin( ID, cotalpha_, cotbeta_, thePixelCluster->charge() ); - - if ( templQbin_ < 0 || templQbin_ > 5 ) - { - // gavril : check this.... - // cout << "Template call failed. Cannot decide if cluster should be split !!!!!!! " << endl; - // cout << "Do nothing." << endl; - } - else // if ( templQbin_ < 0 || templQbin_ > 5 ) {...} else - { - //cout << " Returned OK from PixelTempReco2D..." << endl; - - // Check for split clusters: we split the clusters with larger than expected charge: templQbin_ == 0 - if ( templQbin_ != 0 ) - { - // gavril: do not split this cluster - //cout << "TEMPLATE SPLITTER SAYS : NO SPLIT " << endl; - //cout << "This cluster will note be split !!!!!!!!!! " << endl; - } - else // if ( templQbin_ != 0 ) {...} else - { - //cout << "TEMPLATE SPLITTER SAYS : SPLIT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl; - //cout << "Found a cluster that has to be split. templQbin_ = " << templQbin_ << endl; - - // gavril: Call the template splitter - //cout << "Calling the splitter..." << endl; - - // Put the pixels of this clusters in a 2x2 array to be used by the template splitter - - const std::vector & pixVec = thePixelCluster->pixels(); - std::vector::const_iterator pixIter = pixVec.begin(), pixEnd = pixVec.end(); - - const int cluster_matrix_size_x = 13; - const int cluster_matrix_size_y = 21; - - boost::multi_array clust_array_2d(boost::extents[cluster_matrix_size_x][cluster_matrix_size_y]); - - int row_offset = thePixelCluster->minPixelRow(); - int col_offset = thePixelCluster->minPixelCol(); - - // Copy clust's pixels (calibrated in electrons) into clust_array_2d; - - for ( ; pixIter != pixEnd; ++pixIter ) - { - int irow = int(pixIter->x) - row_offset; // do we need +0.5 ??? - int icol = int(pixIter->y) - col_offset; // do we need +0.5 ??? - - if ( irowadc; - } - } - - // Make and fill the bool arrays flagging double pixels - std::vector ydouble(cluster_matrix_size_y), xdouble(cluster_matrix_size_x); - - // x directions (shorter), rows - for (int irow = 0; irow < cluster_matrix_size_x; ++irow) - { - xdouble[irow] = theTopol->isItBigPixelInX( irow+row_offset ); - } - - // y directions (longer), columns - for (int icol = 0; icol < cluster_matrix_size_y; ++icol) - { - ydouble[icol] = theTopol->isItBigPixelInY( icol+col_offset ); - } - - // gavril: Initialize values coming back from SiPixelTemplateSplit::PixelTempSplit - float templYrec1_ = -99999.9; - float templYrec2_ = -99999.9; - float templSigmaY_ = -99999.9; - float templProbY_ = -99999.9; - float templXrec1_ = -99999.9; - float templXrec2_ = -99999.9; - float templSigmaX_ = -99999.9; - float templProbX_ = -99999.9; - float dchisq = -99999.9; - float templProbQ_ = -99999.9; - - int ierr = - SiPixelTemplateSplit::PixelTempSplit( ID, - cotalpha_, cotbeta_, - clust_array_2d, - ydouble, xdouble, - templ_, - templYrec1_, templYrec2_, templSigmaY_, templProbY_, - templXrec1_, templXrec2_, templSigmaX_, templProbX_, - templQbin_, - templProbQ_, - true, - dchisq, - templ2D_ ); - - if ( ierr != 0 ) - { - // cout << "Cluster splitting failed: ierr = " << ierr << endl; - } - else - { - // gavril: Cluster was successfully split. - // gavril: Make the two split clusters and put them in the split cluster collection - //cout << "Cluster splitting OK: ierr = " << ierr << endl; - - // 2D templates have origin at the lower left corner of template2d[1][1] which is - // also 2 pixels larger than the cluster container - - float xsize = templ_.xsize(); // this is the pixel x-size in microns - float ysize = templ_.ysize(); // this is the pixel y-size in microns - - // Shift the coordinates to the 2-D template system - float yrecp1 = -99999.9; - float yrecp2 = -99999.9; - float xrecp1 = -99999.9; - float xrecp2 = -99999.9; - - if ( ydouble[0] ) - { - yrecp1 = templYrec1_ + ysize; - yrecp2 = templYrec2_ + ysize; - } - else - { - yrecp1 = templYrec1_ + ysize/2.0; - yrecp2 = templYrec2_ + ysize/2.0; - } - - if ( xdouble[0] ) - { - xrecp1 = templXrec1_ + xsize; - xrecp2 = templXrec2_ + xsize; - } - else - { - xrecp1 = templXrec1_ + xsize/2.0; - xrecp2 = templXrec2_ + xsize/2.0; - } - - // The xytemp method adds charge to a zeroed buffer - - float template2d1[BXM2][BYM2]; - float template2d2[BXM2][BYM2]; - - for ( int j=0; j 5 ) {...} else - - } // if ( (int)thePixelCluster->size() <= 1 ) {... } else - - if ( !cluster_was_successfully_split ) - output.push_back(*c.cluster); - - } // if ( theSiPixelCluster ) - else - { - throw cms::Exception("TrackClusterSplitter :") - << "This is not a SiPixelCluster !!! " << "\n"; - } - } - else - { - // gavril : Neither sim nor template splitter. Just add the cluster as it was. - // original from G.P. - output.push_back( *c.cluster ); - } -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(TrackClusterSplitter); diff --git a/RecoLocalTracker/SubCollectionProducers/test/run_simsplit.py b/RecoLocalTracker/SubCollectionProducers/test/run_simsplit.py deleted file mode 100644 index a3acc7e973150..0000000000000 --- a/RecoLocalTracker/SubCollectionProducers/test/run_simsplit.py +++ /dev/null @@ -1,181 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process('SPLIT') -# import of standard configurations -process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.StandardSequences.Services_cff') -process.load('Configuration.EventContent.EventContent_cff') -process.load('Configuration.StandardSequences.GeometryDB_cff') -process.load('Configuration.StandardSequences.MagneticField_38T_cff') -process.load('Configuration.StandardSequences.RawToDigi_cff') -process.load('Configuration.StandardSequences.Reconstruction_cff') -process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -process.load("SimGeneral.MixingModule.mixNoPU_cfi") -process.load('Configuration/StandardSequences/Simulation_cff') -process.load('Configuration/StandardSequences/SimL1Emulator_cff') -process.load('Configuration/StandardSequences/DigiToRaw_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(100) -) -process.MessageLogger.cerr.FwkReport.reportEvery = 10 -# Input source -process.source = cms.Source("PoolSource", - secondaryFileNames = cms.untracked.vstring(), - fileNames = cms.untracked.vstring( - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTT_1500_8TeV_Tauola_cfi_py_GEN_SIM_DIGI_L1_DIGI2RAW_HLT.root' -), -) - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -# Split clusters have larger errors. Appropriate errors can be -# assigned by turning UseStripSplitClusterErrors = True. The strip hit pull -# distributons improve considerably, but it does not help with b-tagging, -# so leave it False by default -process.StripCPEfromTrackAngleESProducer.UseStripSplitClusterErrors = True - -# Turn OFF track hit sharing -process.load("TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi") -process.trajectoryCleanerBySharedHits.fractionShared = 0.0 -process.trajectoryCleanerBySharedHits.allowSharedFirstHit = False -process.load("RecoTracker.FinalTrackSelectors.simpleTrackListMerger_cfi") -process.load("RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi") -process.simpleTrackListMerger.ShareFrac = 0.0 -process.simpleTrackListMerger.allowFirstHitShare = False - -# The second step is to split merged clusters. -process.splitClusters = cms.EDProducer( - "TrackClusterSplitter", - stripClusters = cms.InputTag("siStripClusters::SPLIT"), - pixelClusters = cms.InputTag("siPixelClusters::SPLIT"), - useTrajectories = cms.bool(False), - trajTrackAssociations = cms.InputTag('generalTracks::SPLIT'), - tracks = cms.InputTag('pixelTracks::SPLIT'), - propagator = cms.string('AnalyticalPropagator'), - vertices = cms.InputTag('pixelVertices::SPLIT'), - simSplitPixel = cms.bool(True), # ideal pixel splitting turned OFF - simSplitStrip = cms.bool(True), # ideal strip splitting turned OFF - tmpSplitPixel = cms.bool(False), # template pixel spliting - tmpSplitStrip = cms.bool(False), # template strip splitting - useStraightTracks = cms.bool(True), - test = cms.bool(True) - ) - -process.mySiPixelRecHits = process.siPixelRecHits.clone(src = cms.InputTag("splitClusters")) -process.mySiStripRecHits = process.siStripMatchedRecHits.clone( - src = cms.InputTag("splitClusters"), ClusterProducer = cms.InputTag("splitClusters") - ) - -############################## inserted new stuff - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -############################## inserted new stuff - -process.newrechits = cms.Sequence(process.mySiPixelRecHits*process.mySiStripRecHits) - -######## track to vertex assoc ##################3 -## from CommonTools.RecoUtils.pf_pu_assomap_cfi import AssociationMaps -## process.Vertex2TracksDefault = AssociationMaps.clone( -## AssociationType = cms.InputTag("VertexToTracks"), -## MaxNumberOfAssociations = cms.int32(1) -## ) - -# The commands included in splitter_tracking_setup_cff.py instruct -# the tracking machinery to use the clusters and rechits generated after -# cluster splitting (instead of the default clusters and rechits) -#process.load('RecoLocalTracker.SubCollectionProducers.splitter_tracking_setup2_cff') - -process.fullreco = cms.Sequence(process.globalreco*process.highlevelreco) -process.options = cms.untracked.PSet( - -) -from RecoLocalTracker.SubCollectionProducers.splitter_tracking_setup_cff import customizeTracking -customizeTracking('splitClusters', 'splitClusters', 'mySiPixelRecHits', 'mySiStripRecHits') - -process.load("RecoTracker.TrackProducer.TrackRefitters_cff") - -# Output definition - - -process.RECOoutput = cms.OutputModule("PoolOutputModule", - outputCommands = process.FEVTDEBUGEventContent.outputCommands, - fileName = cms.untracked.string('ZpTauTau8TeV_simsplit_71X.root'), - dataset = cms.untracked.PSet( - #filterName = cms.untracked.string(''), - dataTier = cms.untracked.string('RECO') - ) -) -## process.RECOoutput.outputCommands.append( 'keep TrackingParticles_mergedtruth_MergedTrackTruth_*') -## process.RECOoutput.outputCommands.append( 'keep TrackingVertexs_mergedtruth_MergedTrackTruth_*') - -# Additional output definition -process.dump = cms.EDAnalyzer("EventContentAnalyzer") -# Other statements - -process.GlobalTag.globaltag = 'MC_71_V1::All' - -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelBarrelHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelBarrelLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelEndcapHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelEndcapLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTECHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTECLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIBHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIBLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIDHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIDLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTOBHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTOBLowTof') - - -from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import * -process.hbhereco.hbheInput= cms.InputTag("hbheprereco::SPLIT") - -# Path and EndPath definitions -process.pre_init = cms.Path(cms.Sequence(process.pdigi*process.SimL1Emulator*process.DigiToRaw)) -process.init_step = cms.Path(cms.Sequence(process.RawToDigi*process.localreco*process.offlineBeamSpot+process.recopixelvertexing)) -process.rechits_step=cms.Path(process.siPixelRecHits) -process.dump_step = cms.Path(process.dump) -process.splitClusters_step=cms.Path(process.mix+process.splitClusters) -process.newrechits_step=cms.Path(process.newrechits) -process.fullreco_step=cms.Path(process.fullreco) -process.endjob_step = cms.EndPath(process.endOfProcess) -process.RECOoutput_step = cms.EndPath(process.RECOoutput) -#process.pixeltree_tempsplit =cms.Path(process.PixelTreeSplit) -#process.vertex_assoc = cms.Path(process.Vertex2TracksDefault) - - -# Schedule definition -process.schedule = cms.Schedule(process.init_step,process.splitClusters_step,process.newrechits_step, process.fullreco_step, process.RECOoutput_step) diff --git a/RecoLocalTracker/SubCollectionProducers/test/run_simsplit_runI.py b/RecoLocalTracker/SubCollectionProducers/test/run_simsplit_runI.py deleted file mode 100644 index 8c0b4faf3a9f6..0000000000000 --- a/RecoLocalTracker/SubCollectionProducers/test/run_simsplit_runI.py +++ /dev/null @@ -1,215 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process('SPLIT') -# import of standard configurations -process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.StandardSequences.Services_cff') -process.load('Configuration.EventContent.EventContent_cff') -process.load('Configuration.StandardSequences.GeometryDB_cff') -process.load('Configuration.StandardSequences.MagneticField_38T_cff') -process.load('Configuration.StandardSequences.RawToDigi_cff') -process.load('Configuration.StandardSequences.Reconstruction_cff') -process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -process.load("SimGeneral.MixingModule.mixNoPU_cfi") -process.load('Configuration/StandardSequences/Simulation_cff') -process.load('Configuration/StandardSequences/SimL1Emulator_cff') -process.load('Configuration/StandardSequences/DigiToRaw_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(10) -) -#process.MessageLogger.cerr.FwkReport.reportEvery = 100 -# Input source -process.source = cms.Source("PoolSource", - secondaryFileNames = cms.untracked.vstring(), - fileNames = cms.untracked.vstring( - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_0.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_1.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_2.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_3.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_4.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_5.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_6.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_7.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_8.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_9.root' - -), -) - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -# Split clusters have larger errors. Appropriate errors can be -# assigned by turning UseStripSplitClusterErrors = True. The strip hit pull -# distributons improve considerably, but it does not help with b-tagging, -# so leave it False by default -process.StripCPEfromTrackAngleESProducer.UseStripSplitClusterErrors = True - -# Turn OFF track hit sharing -process.load("TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi") -process.trajectoryCleanerBySharedHits.fractionShared = 0.0 -process.trajectoryCleanerBySharedHits.allowSharedFirstHit = False -process.load("RecoTracker.FinalTrackSelectors.simpleTrackListMerger_cfi") -process.load("RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi") -process.simpleTrackListMerger.ShareFrac = 0.0 -process.simpleTrackListMerger.allowFirstHitShare = False - -# The second step is to split merged clusters. -process.splitClusters = cms.EDProducer( - "TrackClusterSplitter", - stripClusters = cms.InputTag("siStripClusters::SPLIT"), - pixelClusters = cms.InputTag("siPixelClusters::SPLIT"), - useTrajectories = cms.bool(False), - trajTrackAssociations = cms.InputTag('generalTracks::SPLIT'), - tracks = cms.InputTag('pixelTracks::SPLIT'), - propagator = cms.string('AnalyticalPropagator'), - vertices = cms.InputTag('pixelVertices::SPLIT'), - simSplitPixel = cms.bool(True), # ideal pixel splitting turned OFF - simSplitStrip = cms.bool(True), # ideal strip splitting turned OFF - tmpSplitPixel = cms.bool(False), # template pixel spliting - tmpSplitStrip = cms.bool(False), # template strip splitting - useStraightTracks = cms.bool(True), - test = cms.bool(True) - ) - -process.mySiPixelRecHits = process.siPixelRecHits.clone(src = cms.InputTag("splitClusters")) -process.mySiStripRecHits = process.siStripMatchedRecHits.clone( - src = cms.InputTag("splitClusters"), ClusterProducer = cms.InputTag("splitClusters") - ) - -############################## inserted new stuff - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; -tgrIndex = process.globalreco.index(process.trackingGlobalReco) -tgrIndexFromReco = process.reconstruction_fromRECO.index(process.trackingGlobalReco) -process.globalreco.remove(process.trackingGlobalReco) -process.reconstruction_fromRECO.remove(process.trackingGlobalReco) -del process.trackingGlobalReco -del process.ckftracks -del process.ckftracks_wodEdX -del process.ckftracks_plus_pixelless -del process.ckftracks_woBH -del process.iterTracking -del process.InitialStep -del process.LowPtTripletStep -del process.PixelPairStep -del process.DetachedTripletStep -del process.MixedTripletStep -del process.PixelLessStep -del process.TobTecStep - -# Load the new Iterative Tracking configuration -raise Exception("Please migrate to use Run2_2016_trackingLowPU era (or otherwise use trackingLowPU sub-era)") - -process.globalreco.insert(tgrIndex, process.trackingGlobalReco) -process.reconstruction_fromRECO.insert(tgrIndexFromReco, process.trackingGlobalReco) - -############################## inserted new stuff - -process.newrechits = cms.Sequence(process.mySiPixelRecHits*process.mySiStripRecHits) - -######## track to vertex assoc ##################3 -## from CommonTools.RecoUtils.pf_pu_assomap_cfi import AssociationMaps -## process.Vertex2TracksDefault = AssociationMaps.clone( -## AssociationType = cms.InputTag("VertexToTracks"), -## MaxNumberOfAssociations = cms.int32(1) -## ) - -# The commands included in splitter_tracking_setup_cff.py instruct -# the tracking machinery to use the clusters and rechits generated after -# cluster splitting (instead of the default clusters and rechits) - -from RecoLocalTracker.SubCollectionProducers.splitter_RunI_tracking_setup_cff import customizeTracking -customizeTracking('splitClusters', 'splitClusters', 'mySiPixelRecHits', 'mySiStripRecHits') - -process.fullreco = cms.Sequence(process.globalreco*process.highlevelreco) -process.options = cms.untracked.PSet( - -) - -#process.load("RecoTracker.TrackProducer.TrackRefitters_cff") - -# Output definition - - -process.RECOoutput = cms.OutputModule("PoolOutputModule", - outputCommands = process.FEVTDEBUGEventContent.outputCommands, - fileName = cms.untracked.string('ZpTauTau8TeV_simsplit_runI.root'), - dataset = cms.untracked.PSet( - #filterName = cms.untracked.string(''), - dataTier = cms.untracked.string('RECO') - ) -) -process.RECOoutput.outputCommands.append( 'keep TrackingParticles_mergedtruth_MergedTrackTruth_*') -process.RECOoutput.outputCommands.append( 'keep TrackingVertexs_mergedtruth_MergedTrackTruth_*') - -# Additional output definition -process.dump = cms.EDAnalyzer("EventContentAnalyzer") -# Other statement -from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'START70_V5::All', '') - -process.GlobalTag.globaltag = 'START70_V5::All' -from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import * -process.hbhereco.hbheInput= cms.InputTag("hbheprereco::SPLIT") - -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelBarrelHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelBarrelLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelEndcapHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsPixelEndcapLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTECHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTECLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIBHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIBLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIDHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTIDLowTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTOBHighTof') -process.mix.mixObjects.mixSH.crossingFrames.append('TrackerHitsTOBLowTof') - -process.mix.mixObjects.mixHepMC.makeCrossingFrame = True - -# Path and EndPath definitions -process.pre_init = cms.Path(cms.Sequence(process.pdigi*process.SimL1Emulator*process.DigiToRaw)) -process.init_step = cms.Path(cms.Sequence(process.RawToDigi*process.localreco*process.offlineBeamSpot+process.recopixelvertexing)) -process.rechits_step=cms.Path(process.siPixelRecHits) -process.dump_step = cms.Path(process.dump) -process.splitClusters_step=cms.Path(process.mix+process.splitClusters) -process.newrechits_step=cms.Path(process.newrechits) -process.fullreco_step=cms.Path(process.fullreco) -process.endjob_step = cms.EndPath(process.endOfProcess) -process.RECOoutput_step = cms.EndPath(process.RECOoutput) -#process.pixeltree_tempsplit =cms.Path(process.PixelTreeSplit) -#process.vertex_assoc = cms.Path(process.Vertex2TracksDefault) - -#Schedule definition -process.schedule = cms.Schedule(process.init_step,process.splitClusters_step,process.newrechits_step,process.fullreco_step, process.RECOoutput_step) diff --git a/RecoLocalTracker/SubCollectionProducers/test/run_split.py b/RecoLocalTracker/SubCollectionProducers/test/run_split.py deleted file mode 100644 index 27f529c5915df..0000000000000 --- a/RecoLocalTracker/SubCollectionProducers/test/run_split.py +++ /dev/null @@ -1,193 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process('SPLIT') - -# import of standard configurations -process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.StandardSequences.Services_cff') -process.load('Configuration.EventContent.EventContent_cff') -process.load('Configuration.StandardSequences.GeometryDB_cff') -process.load('Configuration.StandardSequences.MagneticField_38T_cff') -process.load('Configuration.StandardSequences.RawToDigi_cff') -process.load('Configuration.StandardSequences.Reconstruction_cff') -process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(10) -) -process.MessageLogger.cerr.FwkReport.reportEvery = 10 -# Input source -process.source = cms.Source("PoolSource", - secondaryFileNames = cms.untracked.vstring(), - fileNames = cms.untracked.vstring( - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTT_1500_8TeV_Tauola_cfi_py_GEN_SIM_DIGI_L1_DIGI2RAW_HLT.root' -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_0.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_1.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_2.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_3.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_4.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_5.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_6.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_7.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_8.root', -# 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_9.root' -# 'file:/afs/cern.ch/work/t/taroni/private/ClusterSplitting/CMSSW_7_1_X_2014-03-18-0200/src/ZpTT_1500_8TeV_Tauola_cfi_py_GEN_SIM_DIGI_L1_DIGI2RAW_HLT.root' - ), - -) - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -# Split clusters have larger errors. Appropriate errors can be -# assigned by turning UseStripSplitClusterErrors = True. The strip hit pull -# distributons improve considerably, but it does not help with b-tagging, -# so leave it False by default -process.StripCPEfromTrackAngleESProducer.UseStripSplitClusterErrors = True - -# Turn OFF track hit sharing -process.load("TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi") -process.trajectoryCleanerBySharedHits.fractionShared = 0.0 -process.trajectoryCleanerBySharedHits.allowSharedFirstHit = False -process.load("RecoTracker.FinalTrackSelectors.simpleTrackListMerger_cfi") -process.load("RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi") -process.simpleTrackListMerger.ShareFrac = 0.0 -process.simpleTrackListMerger.allowFirstHitShare = False - -# The second step is to split merged clusters. -process.splitClusters = cms.EDProducer( - "TrackClusterSplitter", - stripClusters = cms.InputTag("siStripClusters::SPLIT"), - pixelClusters = cms.InputTag("siPixelClusters::SPLIT"), - useTrajectories = cms.bool(False), - trajTrackAssociations = cms.InputTag('generalTracks::SPLIT'), - tracks = cms.InputTag('pixelTracks::SPLIT'), - propagator = cms.string('AnalyticalPropagator'), - vertices = cms.InputTag('pixelVertices::SPLIT'), - simSplitPixel = cms.bool(False), # ideal pixel splitting turned OFF - simSplitStrip = cms.bool(False), # ideal strip splitting turned OFF - tmpSplitPixel = cms.bool(True), # template pixel spliting - tmpSplitStrip = cms.bool(True), # template strip splitting - useStraightTracks = cms.bool(True), - test = cms.bool(True) - ) - -process.mySiPixelRecHits = process.siPixelRecHits.clone(src = cms.InputTag("splitClusters")) -process.mySiStripRecHits = process.siStripMatchedRecHits.clone( - src = cms.InputTag("splitClusters"), ClusterProducer = cms.InputTag("splitClusters") - ) - -############################## inserted new stuff - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -############################## inserted new stuff - -process.newrechits = cms.Sequence(process.mySiPixelRecHits*process.mySiStripRecHits) - -######## track to vertex assoc ##################3 -from CommonTools.RecoUtils.pf_pu_assomap_cfi import AssociationMaps -process.Vertex2TracksDefault = AssociationMaps.clone( - AssociationType = cms.InputTag("VertexToTracks"), - MaxNumberOfAssociations = cms.int32(1) -) - -# The commands included in splitter_tracking_setup_cff.py instruct -# the tracking machinery to use the clusters and rechits generated after -# cluster splitting (instead of the default clusters and rechits) -#process.load('RecoLocalTracker.SubCollectionProducers.splitter_tracking_setup2_cff') -from RecoLocalTracker.SubCollectionProducers.splitter_tracking_setup_cff import customizeTracking -customizeTracking('splitClusters', 'splitClusters', 'mySiPixelRecHits', 'mySiStripRecHits') - -process.fullreco = cms.Sequence(process.globalreco*process.highlevelreco) -process.Globalreco = cms.Sequence(process.globalreco) -process.Highlevelreco = cms.Sequence(process.highlevelreco) - -process.options = cms.untracked.PSet( - -) - -process.load("RecoTracker.TrackProducer.TrackRefitters_cff") - -# Output definition -process.PixelTreeSplit = cms.EDAnalyzer( - "PixelAnalysisTree", - verbose = cms.untracked.int32(0), - rootFileName = cms.untracked.string('pixelTrees_TS_DATA.root'), - treeName = cms.untracked.string('treeTmpSplit'), - dumpAllEvents = cms.untracked.int32(1), - globalTag = cms.string("GR_R_53::All"), - muonCollectionLabel = cms.untracked.InputTag('muons'), -# trajectoryInputLabel = cms.untracked.InputTag('TrackRefitter'), - trajectoryInputLabel = cms.untracked.InputTag('generalTracks::SPLIT'), - trackCollectionLabel = cms.untracked.InputTag('generalTracks::SPLIT'), - pixelClusterLabel = cms.untracked.InputTag('splitClusters'), - pixelRecHitLabel = cms.untracked.InputTag('mySiPixelRecHits'), - L1GTReadoutRecordLabel = cms.untracked.InputTag("gtDigis"), - hltL1GtObjectMap = cms.untracked.InputTag("hltL1GtObjectMap"), - HLTResultsLabel = cms.untracked.InputTag("TriggerResults::HLT"), - HLTProcessName = cms.untracked.string("HLT"), - mapTrack2Vertex = cms.untracked.bool(True) - ) - - -process.RECOoutput = cms.OutputModule("PoolOutputModule", - outputCommands = process.FEVTDEBUGEventContent.outputCommands, - fileName = cms.untracked.string('ZpTauTau8TeV_split_71X_10.root'), - dataset = cms.untracked.PSet( - dataTier = cms.untracked.string('GEN-SIM-RECO') - ) -) -## process.RECOoutput.outputCommands.append( 'keep TrackingParticles_mergedtruth_MergedTrackTruth_*') -## process.RECOoutput.outputCommands.append( 'keep TrackingVertexs_mergedtruth_MergedTrackTruth_*') - -# Additional output definition -process.dump = cms.EDAnalyzer("EventContentAnalyzer") -# Other statements - -process.GlobalTag.globaltag = 'MC_71_V1::All' - - - -# Path and EndPath definitions -process.init_step = cms.Path(cms.Sequence(process.RawToDigi*process.localreco*process.offlineBeamSpot+process.recopixelvertexing)) -process.dump_step = cms.Path(process.dump) -process.splitClusters_step=cms.Path(process.splitClusters) -process.newrechits_step=cms.Path(process.newrechits) -process.fullreco_step=cms.Path(process.fullreco) -process.endjob_step = cms.EndPath(process.endOfProcess) -process.RECOoutput_step = cms.EndPath(process.RECOoutput) -#process.pixeltree_tempsplit =cms.Path(process.PixelTreeSplit) -#process.vertex_assoc = cms.Path(process.Vertex2TracksDefault) - -# Schedule definition - -process.schedule = cms.Schedule(process.init_step,process.splitClusters_step,process.newrechits_step,process.fullreco_step,process.RECOoutput_step) diff --git a/RecoLocalTracker/SubCollectionProducers/test/run_split_runI.py b/RecoLocalTracker/SubCollectionProducers/test/run_split_runI.py deleted file mode 100644 index d1cf822d8086e..0000000000000 --- a/RecoLocalTracker/SubCollectionProducers/test/run_split_runI.py +++ /dev/null @@ -1,222 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -process = cms.Process('SPLIT') -# import of standard configurations -process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.StandardSequences.Services_cff') -process.load('Configuration.EventContent.EventContent_cff') -process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load('Configuration.StandardSequences.Geometry_cff') -process.load('Configuration.StandardSequences.MagneticField_38T_cff') -process.load('Configuration.StandardSequences.RawToDigi_cff') -process.load('Configuration.StandardSequences.Reconstruction_cff') -process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') - - - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(10) -) -#process.MessageLogger.cerr.FwkReport.reportEvery = 100 -# Input source -process.source = cms.Source("PoolSource", - secondaryFileNames = cms.untracked.vstring(), - fileNames = cms.untracked.vstring( -# 'file:ZpTT_1500_8TeV_Tauola_cfi_py_GEN_SIM_DIGI_L1_DIGI2RAW_HLT.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_0.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_1.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_2.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_3.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_4.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_5.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_6.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_7.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_8.root', - 'root://eoscms//eos/cms/store/user/taroni/ClusterSplitting/ZpTauTau8TeV/GEN-SIM-RAW/ZpTauTau_GEN-SIM-RAW_9.root' -), - -) - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -# Split clusters have larger errors. Appropriate errors can be -# assigned by turning UseStripSplitClusterErrors = True. The strip hit pull -# distributons improve considerably, but it does not help with b-tagging, -# so leave it False by default -process.StripCPEfromTrackAngleESProducer.UseStripSplitClusterErrors = True - -# Turn OFF track hit sharing -process.load("TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi") -process.trajectoryCleanerBySharedHits.fractionShared = 0.0 -process.trajectoryCleanerBySharedHits.allowSharedFirstHit = False -process.load("RecoTracker.FinalTrackSelectors.simpleTrackListMerger_cfi") -process.load("RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi") -process.simpleTrackListMerger.ShareFrac = 0.0 -process.simpleTrackListMerger.allowFirstHitShare = False - -# The second step is to split merged clusters. -process.splitClusters = cms.EDProducer( - "TrackClusterSplitter", - stripClusters = cms.InputTag("siStripClusters::SPLIT"), - pixelClusters = cms.InputTag("siPixelClusters::SPLIT"), - useTrajectories = cms.bool(False), - trajTrackAssociations = cms.InputTag('generalTracks::SPLIT'), - tracks = cms.InputTag('pixelTracks::SPLIT'), - propagator = cms.string('AnalyticalPropagator'), - vertices = cms.InputTag('pixelVertices::SPLIT'), - simSplitPixel = cms.bool(False), # ideal pixel splitting turned OFF - simSplitStrip = cms.bool(False), # ideal strip splitting turned OFF - tmpSplitPixel = cms.bool(True), # template pixel spliting - tmpSplitStrip = cms.bool(True), # template strip splitting - useStraightTracks = cms.bool(True), - test = cms.bool(True) - ) - -process.mySiPixelRecHits = process.siPixelRecHits.clone(src = cms.InputTag("splitClusters")) -process.mySiStripRecHits = process.siStripMatchedRecHits.clone( - src = cms.InputTag("splitClusters"), ClusterProducer = cms.InputTag("splitClusters") - ) - -############################## inserted new stuff - -# from Jean-Roch -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTrackAngleESProducer = process.StripCPEfromTemplateESProducer.clone(ComponentName='StripCPEfromTrackAngle') - -process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTemplate_cfi") -process.StripCPEfromTemplateESProducer.UseTemplateReco = True - -# Include the latest pixel templates, which are not in DB. -# These are to be used for pixel splitting. -process.load('RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi') -process.templates.LoadTemplatesFromDB = False - -# This is the default speed. Recommended. -process.StripCPEfromTrackAngleESProducer.TemplateRecoSpeed = 0; - -############################## inserted new stuff - -process.newrechits = cms.Sequence(process.mySiPixelRecHits*process.mySiStripRecHits) - -######## track to vertex assoc ##################3 -from CommonTools.RecoUtils.pf_pu_assomap_cfi import AssociationMaps -process.Vertex2TracksDefault = AssociationMaps.clone( - AssociationType = cms.InputTag("VertexToTracks"), - MaxNumberOfAssociations = cms.int32(1) -) - - -tgrIndex = process.globalreco.index(process.trackingGlobalReco) -tgrIndexFromReco = process.reconstruction_fromRECO.index(process.trackingGlobalReco) -process.globalreco.remove(process.trackingGlobalReco) -process.reconstruction_fromRECO.remove(process.trackingGlobalReco) -del process.trackingGlobalReco -del process.ckftracks -del process.ckftracks_wodEdX -del process.ckftracks_plus_pixelless -del process.ckftracks_woBH -del process.iterTracking -del process.InitialStep -del process.LowPtTripletStep -del process.PixelPairStep -del process.DetachedTripletStep -del process.MixedTripletStep -del process.PixelLessStep -del process.TobTecStep - -# Load the new Iterative Tracking configuration -raise Exception("Please migrate to use Run2_2016_trackingLowPU era (or otherwise use trackingLowPU sub-era)") - -process.globalreco.insert(tgrIndex, process.trackingGlobalReco) -process.reconstruction_fromRECO.insert(tgrIndexFromReco, process.trackingGlobalReco) - -# The commands included in splitter_tracking_setup_cff.py instruct -# the tracking machinery to use the clusters and rechits generated after -# cluster splitting (instead of the default clusters and rechits) -from RecoLocalTracker.SubCollectionProducers.splitter_tracking_RunI_setup_cff import customizeTracking -customizeTracking('splitClusters', 'splitClusters', 'mySiPixelRecHits', 'mySiStripRecHits') - - -process.fullreco = cms.Sequence(process.globalreco*process.highlevelreco) -## process.Globalreco = cms.Sequence(process.globalreco) -## process.Highlevelreco = cms.Sequence(process.highlevelreco) - -process.options = cms.untracked.PSet( - -) - -#process.load("RecoTracker.TrackProducer.TrackRefitters_cff") - -# Output definition -process.PixelTreeSplit = cms.EDAnalyzer( - "PixelAnalysisTree", - verbose = cms.untracked.int32(0), - rootFileName = cms.untracked.string('pixelTrees_TS_DATA.root'), - treeName = cms.untracked.string('treeTmpSplit'), - dumpAllEvents = cms.untracked.int32(1), - globalTag = cms.string("GR_R_53::All"), - muonCollectionLabel = cms.untracked.InputTag('muons'), -# trajectoryInputLabel = cms.untracked.InputTag('TrackRefitter'), - trajectoryInputLabel = cms.untracked.InputTag('generalTracks::SPLIT'), - trackCollectionLabel = cms.untracked.InputTag('generalTracks::SPLIT'), - pixelClusterLabel = cms.untracked.InputTag('splitClusters'), - pixelRecHitLabel = cms.untracked.InputTag('mySiPixelRecHits'), - L1GTReadoutRecordLabel = cms.untracked.InputTag("gtDigis"), - hltL1GtObjectMap = cms.untracked.InputTag("hltL1GtObjectMap"), - HLTResultsLabel = cms.untracked.InputTag("TriggerResults::HLT"), - HLTProcessName = cms.untracked.string("HLT"), - mapTrack2Vertex = cms.untracked.bool(True) - ) - - -process.RECOoutput = cms.OutputModule("PoolOutputModule", - outputCommands = process.RECOSIMEventContent.outputCommands, - fileName = cms.untracked.string('ZpTauTau8TeV_split.root'), - dataset = cms.untracked.PSet( - dataTier = cms.untracked.string('RECO') - ) -) -## process.RECOoutput.outputCommands.append( 'keep TrackingParticles_mergedtruth_MergedTrackTruth_*') -## process.RECOoutput.outputCommands.append( 'keep TrackingVertexs_mergedtruth_MergedTrackTruth_*') - -# Additional output definition -process.dump = cms.EDAnalyzer("EventContentAnalyzer") -# Other statements -from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'START70_V5::All', '') - -process.GlobalTag.globaltag = 'START70_V5::All' -#process.GlobalTag.globaltag = 'GR_R_52_V7::All' -from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import * -process.hbhereco.hbheInput= cms.InputTag("hbheprereco::SPLIT") -# Path and EndPath definitions -process.init_step = cms.Path(cms.Sequence(process.RawToDigi*process.localreco*process.offlineBeamSpot+process.recopixelvertexing)) -process.dump_step = cms.Path(process.dump) -process.splitClusters_step=cms.Path(process.splitClusters) -process.newrechits_step=cms.Path(process.newrechits) -process.fullreco_step=cms.Path(process.fullreco) - -process.endjob_step = cms.EndPath(process.endOfProcess) -process.RECOoutput_step = cms.EndPath(process.RECOoutput) -#process.pixeltree_tempsplit =cms.Path(process.PixelTreeSplit) -#process.vertex_assoc = cms.Path(process.Vertex2TracksDefault) - -# Schedule definition - -process.schedule = cms.Schedule(process.init_step,process.splitClusters_step,process.newrechits_step,process.fullreco_step,process.RECOoutput_step) diff --git a/RecoMuon/L3MuonProducer/src/L3MuonCandidateProducerFromMuons.cc b/RecoMuon/L3MuonProducer/src/L3MuonCandidateProducerFromMuons.cc index 8f3389dd5f227..db7d7bed6ab08 100644 --- a/RecoMuon/L3MuonProducer/src/L3MuonCandidateProducerFromMuons.cc +++ b/RecoMuon/L3MuonProducer/src/L3MuonCandidateProducerFromMuons.cc @@ -60,8 +60,10 @@ void L3MuonCandidateProducerFromMuons::produce(StreamID, Event& event, const Eve LogError(category) << muons.whyFailed()->what(); } else { for (unsigned int i=0; isize(); i++) { - TrackRef tkref = (*muons)[i].muonBestTrack(); // avoids crashing in case the muon is SA only. - + + // avoids crashing in case the muon is SA only. + TrackRef tkref = ((*muons)[i].innerTrack().isNonnull())? (*muons)[i].innerTrack() : (*muons)[i].muonBestTrack(); + Particle::Charge q = tkref->charge(); Particle::LorentzVector p4(tkref->px(), tkref->py(), tkref->pz(), tkref->p()); Particle::Point vtx(tkref->vx(),tkref->vy(), tkref->vz()); diff --git a/RecoMuon/MuonIsolation/doc/MuonIsolation.doc b/RecoMuon/MuonIsolation/doc/MuonIsolation.doc index 1e38bb827600d..ad7b641d9f963 100644 --- a/RecoMuon/MuonIsolation/doc/MuonIsolation.doc +++ b/RecoMuon/MuonIsolation/doc/MuonIsolation.doc @@ -42,7 +42,6 @@ Concrete isolation algorithm: extract IsoDeposit using extractor and get sumPt i - Range: helper class implementation of (min, max) range for ordered types. \subsection plugins Plugins -- ExtractorFromDeposits: finds IsoDeposit of the input track in the event record. - TrackExtractor: make IsoDeposit using "other" tracks within "DR_Veto" to "DR_Max", with |dZ|< "Diff_z" and |dr_xy| < "Diff_r" from the muon track. - CaloExtractorByAssociator: with CaloTowers or recHits on input would provide MuIsoDeposits for ecal, hcal and ho separately (3 cts) using TrackDetectorAssociator. The deposit values are hit/tower et; each hit/tower with energy>3*sigmaNoise and et> threshold, being within "DR_Max" and excluding "DR_Veto" gets an entry. diff --git a/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc b/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc index db21c238b79e3..c210beee93eb3 100644 --- a/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc +++ b/RecoMuon/MuonIsolation/plugins/CaloExtractorByAssociator.cc @@ -105,9 +105,9 @@ std::vector CaloExtractorByAssociator::deposits( const Event & event if (theDepositInstanceLabels.size() != 3){ LogError("MuonIsolation")<<"Configuration is inconsistent: Need 3 deposit instance labels"; } - if (! theDepositInstanceLabels[0].compare(0,1, std::string("e")) == 0 - || ! theDepositInstanceLabels[1].compare(0,1, std::string("h")) == 0 - || ! theDepositInstanceLabels[2].compare(0,2, std::string("ho")) == 0){ + if (! (theDepositInstanceLabels[0].compare(0,1, std::string("e")) == 0) + || ! (theDepositInstanceLabels[1].compare(0,1, std::string("h")) == 0) + || ! (theDepositInstanceLabels[2].compare(0,2, std::string("ho")) == 0)){ LogWarning("MuonIsolation")<<"Deposit instance labels do not look like (e*, h*, ho*):" <<"proceed at your own risk. The extractor interprets lab0=from ecal; lab1=from hcal; lab2=from ho"; } diff --git a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.cc b/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.cc deleted file mode 100644 index f8f88086a2341..0000000000000 --- a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.cc +++ /dev/null @@ -1,56 +0,0 @@ -#include "ExtractorFromDeposits.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h" - -using namespace edm; -using namespace std; -using namespace reco; -using namespace muonisolation; -using reco::isodeposit::Direction; - -ExtractorFromDeposits::ExtractorFromDeposits( const ParameterSet& par, edm::ConsumesCollector && iC ) : - theCollectionToken(iC.consumes(par.getParameter("IsolationCollectionTag"))) -{ } - -void ExtractorFromDeposits::fillVetos (const edm::Event & ev, - const edm::EventSetup & evSetup, const reco::TrackCollection & muons) -{ } - -IsoDeposit ExtractorFromDeposits::deposit(const Event & event, - const EventSetup & eventSetup, const Track & muon) const -{ - static const std::string metname = "RecoMuon|ExtractorFromDeposits"; - Handle depMap; - event.getByToken(theCollectionToken, depMap); - - LogWarning(metname)<<"Call this method only if the original muon track collection is lost"; - - // double vtx_z = muon.vz(); - reco::isodeposit::Direction muonDir(muon.eta(), muon.phi()); - - typedef reco::IsoDepositMap::const_iterator iterator_i; - typedef reco::IsoDepositMap::container::const_iterator iterator_ii; - iterator_i depI = depMap->begin(); - iterator_i depIEnd = depMap->end(); - for (; depI != depIEnd; ++depI){ - iterator_ii depII = depI.begin(); - iterator_ii depIIEnd = depI.end(); - for (; depII != depIIEnd; ++depII){ - reco::isodeposit::Direction depDir(depII->direction()); - if (muonDir.deltaR(depDir) < 1.e-6) return *depII; - } - } - - return IsoDeposit(); -} - -IsoDeposit ExtractorFromDeposits::deposit(const Event & event, - const EventSetup & eventSetup, const TrackRef & muon) const -{ - Handle depMap; - event.getByToken(theCollectionToken, depMap); - - return (*depMap)[muon]; -} diff --git a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h b/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h deleted file mode 100644 index acd03f2cff1a9..0000000000000 --- a/RecoMuon/MuonIsolation/plugins/ExtractorFromDeposits.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef MuonIsolation_ExtractorFromDeposits_H -#define MuonIsolation_ExtractorFromDeposits_H - -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h" - -#include "DataFormats/RecoCandidate/interface/IsoDeposit.h" -#include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" -#include - -namespace muonisolation { - -class ExtractorFromDeposits : public reco::isodeposit::IsoDepositExtractor { - -public: - - ExtractorFromDeposits(){}; - ExtractorFromDeposits(const edm::ParameterSet& par, edm::ConsumesCollector && iC); - - ~ExtractorFromDeposits() override{} - - void fillVetos ( const edm::Event & ev, const edm::EventSetup & evSetup, - const reco::TrackCollection & tracks) override; - reco::IsoDeposit deposit (const edm::Event & ev, const edm::EventSetup & evSetup, - const reco::Track & track) const override; - virtual reco::IsoDeposit deposit (const edm::Event & ev, const edm::EventSetup & evSetup, - const reco::TrackRef & track) const; - -private: - edm::EDGetTokenT theCollectionToken; -}; - -} - -#endif - diff --git a/RecoMuon/MuonIsolation/plugins/module.cc b/RecoMuon/MuonIsolation/plugins/module.cc index 8256b8c3e35ef..94b07e33d530e 100755 --- a/RecoMuon/MuonIsolation/plugins/module.cc +++ b/RecoMuon/MuonIsolation/plugins/module.cc @@ -9,13 +9,11 @@ #include "CaloExtractor.h" #include "CaloExtractorByAssociator.h" #include "JetExtractor.h" -#include "ExtractorFromDeposits.h" DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::TrackExtractor, "TrackExtractor"); DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::PixelTrackExtractor, "PixelTrackExtractor"); DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::CaloExtractor, "CaloExtractor"); DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::CaloExtractorByAssociator, "CaloExtractorByAssociator"); DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::JetExtractor, "JetExtractor"); -DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, muonisolation::ExtractorFromDeposits, "ExtractorFromDeposits"); #include "RecoMuon/MuonIsolation/interface/MuonIsolatorFactory.h" #include "RecoMuon/MuonIsolation/interface/SimpleCutsIsolator.h" diff --git a/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h b/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h index 581d2aaf9481b..b36f6362452e5 100644 --- a/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h +++ b/RecoParticleFlow/PFClusterTools/interface/PFResolutionMap.h @@ -42,7 +42,7 @@ class PFResolutionMap : public TH2D { bool WriteMapFile(const char* mapfile); /// extrapolation requires overloading of this function - int FindBin(double eta, double e); + int FindBin(double eta, double e, double z = 0 ) override; double getRes(double eta, double phi, double e,int MapEta = -1); diff --git a/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc b/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc index eb79e8572c9d8..c2c6c60913965 100644 --- a/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc +++ b/RecoParticleFlow/PFClusterTools/src/PFResolutionMap.cc @@ -254,7 +254,7 @@ double PFResolutionMap::getRes(double eta, double phi, double e, int MapEta){ -int PFResolutionMap::FindBin(double eta, double e) { +int PFResolutionMap::FindBin(double eta, double e, double z) { if(e >= GetYaxis()->GetXmax() ) e = GetYaxis()->GetXmax() - 0.001; diff --git a/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc b/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc index 89f8a955a4f09..234f45014589c 100644 --- a/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc +++ b/RecoParticleFlow/PFSimProducer/plugins/SimPFProducer.cc @@ -56,22 +56,22 @@ #include "FWCore/Utilities/interface/transform.h" class SimPFProducer : public edm::global::EDProducer<> { -public: +public: SimPFProducer(const edm::ParameterSet&); ~SimPFProducer() override { } - + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - -private: + +private: // parameters const double superClusterThreshold_, neutralEMThreshold_, neutralHADThreshold_; const bool useTiming_; - + // inputs const edm::EDGetTokenT > pfRecTracks_; const edm::EDGetTokenT > tracks_; const edm::EDGetTokenT > gsfTracks_; - const edm::EDGetTokenT muons_; + const edm::EDGetTokenT muons_; const edm::EDGetTokenT> srcTrackTime_, srcTrackTimeError_; const edm::EDGetTokenT> srcGsfTrackTime_, srcGsfTrackTimeError_; const edm::EDGetTokenT trackingParticles_; @@ -86,7 +86,7 @@ class SimPFProducer : public edm::global::EDProducer<> { DEFINE_FWK_MODULE(SimPFProducer); namespace { - + template uint64_t hashSimInfo(const T& simTruth,size_t i = 0) { uint64_t evtid = simTruth.eventId().rawId(); @@ -119,7 +119,7 @@ SimPFProducer::SimPFProducer(const edm::ParameterSet& conf) : produces(); } -void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetup& es) const { +void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetup& es) const { //get associators std::vector > associators; for( const auto& token : associators_ ) { @@ -127,7 +127,7 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu auto& back = associators.back(); evt.getByToken(token,back); } - + //get PFRecTrack edm::Handle > PFTrackCollectionH; evt.getByToken(pfRecTracks_,PFTrackCollectionH); @@ -137,7 +137,7 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu const auto ptr = PFTrackCollection.ptrAt(i); PFTrackToGeneralTrack.insert(ptr->trackRef().key()); } - + //get track collections edm::Handle > TrackCollectionH; evt.getByToken(tracks_, TrackCollectionH); @@ -160,7 +160,7 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu evt.getByToken(srcGsfTrackTime_, gsfTrackTimeH); evt.getByToken(srcGsfTrackTimeError_, gsfTrackTimeErrH); } - + //get tracking particle collections edm::Handle TPCollectionH; evt.getByToken(trackingParticles_, TPCollectionH); @@ -179,7 +179,7 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu evt.getByToken(simClusters_,SimClustersH); const std::vector& SimClusters = *SimClustersH; - std::unordered_map hashToSimCluster; + std::unordered_map hashToSimCluster; for( unsigned i = 0; i < SimClustersTruth.size(); ++i ) { const auto& simTruth = SimClustersTruth[i]; @@ -187,7 +187,7 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu } // associate the reco tracks / gsf Tracks - std::vector associatedTracks, associatedTracksGsf; + std::vector associatedTracks, associatedTracksGsf; for( auto associator : associators ) { associatedTracks.emplace_back(associator->associateRecoToSim(TrackCollectionH, TPCollectionH)); //associatedTracksGsf.emplace_back(associator->associateRecoToSim(GsfTrackCollectionH, TPCollectionH)); @@ -213,18 +213,18 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu auto pdgId = std::abs(simc->pdgId()); edm::Ref > clusterRef(SimClustersH,simc.key()); if( ( (pdgId == 22 || pdgId == 11) && clusterRef->energy() > neutralEMThreshold_) || - clusterRef->energy() > neutralHADThreshold_ ) { + clusterRef->energy() > neutralHADThreshold_ ) { good_simclusters.push_back(isc); etot += clusterRef->energy(); - pttot += clusterRef->pt(); + pttot += clusterRef->pt(); auto bec = std::make_unique(clusterRef,reco::PFBlockElement::HGCAL); block.addElement(bec.get()); simCluster2Block[simc.key()] = icp; simCluster2BlockIndex[simc.key()] = bec->index(); - caloParticle2SimCluster.emplace(icp,simc.key()); + caloParticle2SimCluster.emplace(CaloParticles[icp].g4Tracks()[0].trackId(), simc.key()); } } - + auto pdgId = std::abs(CaloParticles[icp].pdgId()); caloParticle2SuperCluster.push_back(-1); @@ -245,12 +245,13 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu superclusters->emplace_back(etot,seedpos,seed,clusters); } } + auto blocksHandle = evt.put(std::move(blocks)); auto superClustersHandle = evt.put(std::move(superclusters),"perfect"); - + // list tracks so we can mark them as used and/or fight over them - std::vector usedTrack(TrackCollection.size(),false), - //usedGsfTrack(GsfTrackCollection.size(),false), + std::vector usedTrack(TrackCollection.size(),false), + //usedGsfTrack(GsfTrackCollection.size(),false), usedSimCluster(SimClusters.size(),false); auto candidates = std::make_unique(); @@ -267,14 +268,14 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu if( assoc_tps == associatedTracks.back().end() ) continue; // assured now that we are matched to a set of tracks const auto& matches = assoc_tps->val; - + const auto absPdgId = std::abs(matches[0].first->pdgId()); const auto charge = tkRef->charge(); const auto three_mom = tkRef->momentum(); constexpr double mpion2 = 0.13957*0.13957; double energy = std::sqrt(three_mom.mag2() + mpion2); math::XYZTLorentzVector trk_p4(three_mom.x(),three_mom.y(),three_mom.z(),energy); - + reco::PFCandidate::ParticleType part_type; switch( absPdgId ) { @@ -287,22 +288,22 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu default: part_type = reco::PFCandidate::h; } - + candidates->emplace_back(charge, trk_p4, part_type); auto& candidate = candidates->back(); candidate.setTrackRef(tkRef.castTo()); - + if (useTiming_) candidate.setTime( (*trackTimeH)[tkRef], (*trackTimeErrH)[tkRef] ); - + // bind to cluster if there is one and try to gather conversions, etc - for( const auto& match : matches ) { + for( const auto& match : matches ) { uint64_t hash = hashSimInfo(*(match.first)); - if( hashToSimCluster.count(hash) ) { + if( hashToSimCluster.count(hash) ) { auto simcHash = hashToSimCluster[hash]; - - if( !usedSimCluster[simcHash] ) { - if( simCluster2Block.count(simcHash) && + + if( !usedSimCluster[simcHash] ) { + if( simCluster2Block.count(simcHash) && simCluster2BlockIndex.count(simcHash) ) { size_t block = simCluster2Block.find(simcHash)->second; size_t blockIdx = simCluster2BlockIndex.find(simcHash)->second; @@ -324,21 +325,34 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu usedSimCluster[ref.key()] = true; } } - + //*TODO* cluster time is not reliable at the moment, so just keep time from the track if available } } } } + // Now try to include also electrons that have been reconstructed using the GraphCaloParticles + else if (caloParticle2SimCluster.count(match.first->g4Tracks()[0].trackId())) { + auto range = caloParticle2SimCluster.equal_range(match.first->g4Tracks()[0].trackId()); + for (auto it = range.first; it != range.second; ++it) { + if (!usedSimCluster[it->second]) { + usedSimCluster[it->second] = true; + size_t block = simCluster2Block.find(it->second)->second; + size_t blockIdx = simCluster2BlockIndex.find(it->second)->second; + edm::Ref blockRef(blocksHandle,block); + candidate.addElementInBlock(blockRef,blockIdx); + } + } + } } - usedTrack[tkRef.key()] = true; + usedTrack[tkRef.key()] = true; // remove tracks already used by muons if( MuonTrackToGeneralTrack.count(itk) || absPdgId == 13) candidates->pop_back(); } - // now loop over the non-collected clusters in blocks + // now loop over the non-collected clusters in blocks // and turn them into neutral hadrons or photons const auto& theblocks = *blocksHandle; for( unsigned ibl = 0; ibl < theblocks.size(); ++ibl ) { @@ -367,6 +381,6 @@ void SimPFProducer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetu } } } - + evt.put(std::move(candidates)); } diff --git a/RecoTauTag/Configuration/python/loadRecoTauTagMVAsFromPrepDB_cfi.py b/RecoTauTag/Configuration/python/loadRecoTauTagMVAsFromPrepDB_cfi.py index 6fa710afb1f2f..6a34a321ed2a2 100644 --- a/RecoTauTag/Configuration/python/loadRecoTauTagMVAsFromPrepDB_cfi.py +++ b/RecoTauTag/Configuration/python/loadRecoTauTagMVAsFromPrepDB_cfi.py @@ -39,6 +39,8 @@ } tauIdDiscrMVA_trainings_run2_2017 = { 'tauIdMVAIsoDBoldDMwLT2017' : "tauIdMVAIsoDBoldDMwLT2017", + 'tauIdMVAIsoDBnewDMwLT2017' : "tauIdMVAIsoDBnewDMwLT2017", + 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : "tauIdMVAIsoDBoldDMdR0p3wLT2017", } tauIdDiscrMVA_WPs = { 'tauIdMVAoldDMwoLT' : { @@ -151,6 +153,24 @@ 'Eff60' : "DBoldDMwLTEff60", 'Eff50' : "DBoldDMwLTEff50", 'Eff40' : "DBoldDMwLTEff40" + }, + 'tauIdMVAIsoDBnewDMwLT2017' : { + 'Eff95' : "DBnewDMwLTEff95", + 'Eff90' : "DBnewDMwLTEff90", + 'Eff80' : "DBnewDMwLTEff80", + 'Eff70' : "DBnewDMwLTEff70", + 'Eff60' : "DBnewDMwLTEff60", + 'Eff50' : "DBnewDMwLTEff50", + 'Eff40' : "DBnewDMwLTEff40" + }, + 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : { + 'Eff95' : "DBoldDMdR0p3wLTEff95", + 'Eff90' : "DBoldDMdR0p3wLTEff90", + 'Eff80' : "DBoldDMdR0p3wLTEff80", + 'Eff70' : "DBoldDMdR0p3wLTEff70", + 'Eff60' : "DBoldDMdR0p3wLTEff60", + 'Eff50' : "DBoldDMdR0p3wLTEff50", + 'Eff40' : "DBoldDMdR0p3wLTEff40" } } tauIdDiscrMVA_mvaOutput_normalizations = { @@ -172,7 +192,9 @@ 'tauIdMVAIsoDBnewDMwLT2016' : "mvaOutput_normalization_DBnewDMwLT2016" } tauIdDiscrMVA_mvaOutput_normalizations_run2_2017 = { - 'tauIdMVAIsoDBoldDMwLT2017' : "mvaOutput_normalization" + 'tauIdMVAIsoDBoldDMwLT2017' : "mvaOutput_normalization", + 'tauIdMVAIsoDBnewDMwLT2017' : "mvaOutput_normalization", + 'tauIdMVAIsoDBoldDMdR0p3wLT2017' : "mvaOutput_normalization" } tauIdDiscrMVA_version = "v1" for training, gbrForestName in tauIdDiscrMVA_trainings.items(): @@ -221,6 +243,7 @@ label = cms.untracked.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, tauIdDiscrMVA_version)) ) ) +# MVAIso 2016 for training, gbrForestName in tauIdDiscrMVA_trainings_run2_2016.items(): loadRecoTauTagMVAsFromPrepDB.toGet.append( cms.PSet( @@ -244,30 +267,34 @@ label = cms.untracked.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, tauIdDiscrMVA_version)) ) ) -tauIdDiscrMVA_2017_version = "v1" -for training, gbrForestName in tauIdDiscrMVA_trainings_run2_2017.items(): - loadRecoTauTagMVAsFromPrepDB.toGet.append( - cms.PSet( - record = cms.string('GBRWrapperRcd'), - tag = cms.string("RecoTauTag_%s%s" % (gbrForestName, tauIdDiscrMVA_2017_version)), - label = cms.untracked.string("RecoTauTag_%s%s" % (gbrForestName, tauIdDiscrMVA_2017_version)) - ) - ) - for WP in tauIdDiscrMVA_WPs_run2_2017[training].keys(): +# MVAIso 2017 +tauIdDiscrMVA_2017_version = ["v1","v2"] +for ver2017 in tauIdDiscrMVA_2017_version: + for training, gbrForestName in tauIdDiscrMVA_trainings_run2_2017.items(): + if ver2017=="v1" and (training.find("newDM")>-1 or training.find("dR0p3")>-1): + continue #skip nonexistent trainings loadRecoTauTagMVAsFromPrepDB.toGet.append( cms.PSet( - record = cms.string('PhysicsTGraphPayloadRcd'), - tag = cms.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, tauIdDiscrMVA_2017_version, WP)), - label = cms.untracked.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, tauIdDiscrMVA_2017_version, WP)) + record = cms.string('GBRWrapperRcd'), + tag = cms.string("RecoTauTag_%s%s" % (gbrForestName, ver2017)), + label = cms.untracked.string("RecoTauTag_%s%s" % (gbrForestName, ver2017)) ) ) - loadRecoTauTagMVAsFromPrepDB.toGet.append( - cms.PSet( - record = cms.string('PhysicsTFormulaPayloadRcd'), - tag = cms.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, tauIdDiscrMVA_2017_version)), - label = cms.untracked.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, tauIdDiscrMVA_2017_version)) - ) - ) + for WP in tauIdDiscrMVA_WPs_run2_2017[training].keys(): + loadRecoTauTagMVAsFromPrepDB.toGet.append( + cms.PSet( + record = cms.string('PhysicsTGraphPayloadRcd'), + tag = cms.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, ver2017, WP)), + label = cms.untracked.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, ver2017, WP)) + ) + ) + loadRecoTauTagMVAsFromPrepDB.toGet.append( + cms.PSet( + record = cms.string('PhysicsTFormulaPayloadRcd'), + tag = cms.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, ver2017)), + label = cms.untracked.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, ver2017)) + ) + ) #### # register anti-electron discriminator MVA diff --git a/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc b/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc index a1e473728bef5..99b55ea904cd7 100644 --- a/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc +++ b/RecoTracker/TkNavigation/plugins/CosmicNavigationSchool.cc @@ -44,6 +44,7 @@ class dso_hidden CosmicNavigationSchool : public SimpleNavigationSchool { //FakeDetLayer* theFakeDetLayer; void linkBarrelLayers( SymmetricLayerFinder& symFinder) override; //void linkForwardLayers( SymmetricLayerFinder& symFinder); + using SimpleNavigationSchool::establishInverseRelations; void establishInverseRelations( SymmetricLayerFinder& symFinder ); void buildAdditionalBarrelLinks(); void buildAdditionalForwardLinks(SymmetricLayerFinder& symFinder); @@ -210,7 +211,6 @@ linkBarrelLayers( SymmetricLayerFinder& symFinder) } } - // identical to SimpleNavigationSchool but for the last additional stuff void CosmicNavigationSchool::establishInverseRelations(SymmetricLayerFinder& symFinder) { diff --git a/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h b/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h index e800165f8ef20..ee32a394baa7f 100644 --- a/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h +++ b/RecoTracker/TkNavigation/plugins/SimpleBarrelNavigableLayer.h @@ -30,6 +30,8 @@ class dso_hidden SimpleBarrelNavigableLayer final : public SimpleNavigableLayer nextLayers( const FreeTrajectoryState& fts, PropagationDirection timeDirection) const override; + using SimpleNavigableLayer::compatibleLayers; + std::vector compatibleLayers( NavigationDirection direction) const override; diff --git a/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h b/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h index 396147cdd3077..103047eb8f8ea 100644 --- a/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h +++ b/RecoTracker/TkNavigation/plugins/SimpleForwardNavigableLayer.h @@ -25,6 +25,8 @@ class dso_hidden SimpleForwardNavigableLayer final : public SimpleNavigableLayer nextLayers( const FreeTrajectoryState& fts, PropagationDirection timeDirection) const override; + using SimpleNavigableLayer::compatibleLayers; + std::vector compatibleLayers( NavigationDirection direction) const override; diff --git a/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h b/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h index 6081d6f7f6747..df9bfde9c3d77 100644 --- a/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h +++ b/RecoTracker/TkNavigation/plugins/SimpleNavigableLayer.h @@ -32,7 +32,7 @@ class dso_hidden SimpleNavigableLayer : public NavigableLayer { void setCheckCrossingSide(bool docheck) {theCheckCrossingSide = docheck;} - + using NavigableLayer::compatibleLayers; std::vector< const DetLayer * > compatibleLayers (const FreeTrajectoryState &fts, PropagationDirection timeDirection, int& counter) const final; diff --git a/RecoTracker/TrackProducer/plugins/DAFTrackProducer.h b/RecoTracker/TrackProducer/plugins/DAFTrackProducer.h index 1f8efb4cbde21..867415af16c46 100644 --- a/RecoTracker/TrackProducer/plugins/DAFTrackProducer.h +++ b/RecoTracker/TrackProducer/plugins/DAFTrackProducer.h @@ -26,6 +26,7 @@ class DAFTrackProducer : public KfTrackProducerBase, public edm::stream::EDProdu private: DAFTrackProducerAlgorithm theAlgo; + using TrackProducerBase::getFromEvt; void getFromEvt(edm::Event&, edm::Handle&, reco::BeamSpot&); void putInEvtTrajAnn(edm::Event& theEvent, TrajAnnealingCollection & trajannResults, std::unique_ptr& selTrajAnn); diff --git a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py index e1a8a101b1172..e2d534f9d2bb8 100644 --- a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py +++ b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilderWithTemplate_cfi.py @@ -11,3 +11,6 @@ from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140 trackingPhase2PU140.toModify(TTRHBuilderAngleAndTemplate, Phase2StripCPE = cms.string('Phase2StripCPE')) +# from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel +# phase1Pixel.toModify(TTRHBuilderAngleAndTemplate, PixelCPE = cms.string('PixelCPEClusterRepair')) + diff --git a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilders_cff.py b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilders_cff.py index 3bbbf9556f0e0..a25ae463c7bbf 100644 --- a/RecoTracker/TransientTrackingRecHit/python/TTRHBuilders_cff.py +++ b/RecoTracker/TransientTrackingRecHit/python/TTRHBuilders_cff.py @@ -8,5 +8,6 @@ from RecoTracker.TkSeedingLayers.TTRHBuilderWithoutAngle4PixelTriplets_cfi import * #TransientTRH builder with template from RecoLocalTracker.SiPixelRecHits.PixelCPETemplateReco_cfi import * +from RecoLocalTracker.SiPixelRecHits.PixelCPEClusterRepair_cfi import * from RecoTracker.TransientTrackingRecHit.TTRHBuilderWithTemplate_cfi import * diff --git a/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitration.h b/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitration.h index 7a78522240027..94572f9374bfb 100644 --- a/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitration.h +++ b/RecoVertex/AdaptiveVertexFinder/interface/TrackVertexArbitration.h @@ -271,7 +271,7 @@ std::vector TrackVertexArbitration::trackVertexArbitrator( singleFitVertex = theAdaptiveFitter.vertex(selTracks,ssv); if(singleFitVertex.isValid()) { - svhelper::updateVertexTime(singleFitVertex); + if( pv.covariance(3,3) > 0. ) svhelper::updateVertexTime(singleFitVertex); recoVertices.push_back(VTX(singleFitVertex)); diff --git a/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h b/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h index 476f867359dbc..a41c0dccf5257 100644 --- a/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h +++ b/RecoVertex/AdaptiveVertexFinder/plugins/InclusiveVertexFinder.h @@ -255,8 +255,10 @@ void TemplatedInclusiveVertexFinder::produce(edm::Event &eve } // for each transient vertex state determine if a time can be measured and fill covariance - for(auto& vtx : vertices) { - svhelper::updateVertexTime(vtx); + if( pv.covariance(3,3) > 0. ) { + for(auto& vtx : vertices) { + svhelper::updateVertexTime(vtx); + } } for(std::vector::const_iterator v = vertices.begin(); diff --git a/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc b/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc index ad9edfb2464d9..3ce8d2a5ddffd 100644 --- a/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc +++ b/RecoVertex/AdaptiveVertexFinder/src/TracksClusteringFromDisplacedSeed.cc @@ -42,7 +42,9 @@ std::pair,GlobalPoint> TracksClusteringFromDis GlobalPoint cp(dist.crossingPoint()); double timeSig = 0.; - if( edm::isFinite(seed.timeExt()) && edm::isFinite(tt->timeExt()) ) { // apply only if time available + if( primaryVertex.covariance(3,3) > 0. && + edm::isFinite(seed.timeExt()) && edm::isFinite(tt->timeExt()) ) { + // apply only if time available and being used in vertexing const double tError = std::sqrt( std::pow(seed.dtErrorExt(),2) + std::pow(tt->dtErrorExt(),2) ); timeSig = std::abs( seed.timeExt() - tt->timeExt() ) / tError; } diff --git a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc index f97f486f5e6e6..9ae5d992e4c47 100644 --- a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc +++ b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.cc @@ -73,7 +73,7 @@ CastorDigiProducer::~CastorDigiProducer() { delete theHitCorrection; } -void CastorDigiProducer::initializeEvent(edm::Event const&, edm::EventSetup const& eventSetup) { +void CastorDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const& eventSetup) { // get the appropriate gains, noises, & widths for this event edm::ESHandle conditions; eventSetup.get().get(conditions); @@ -81,6 +81,10 @@ void CastorDigiProducer::initializeEvent(edm::Event const&, edm::EventSetup cons theCoderFactory->setDbService(conditions.product()); theParameterMap->setDbService(conditions.product()); + // Cache random number engine + edm::Service rng; + randomEngine_ = &rng->getEngine(event.streamID()); + edm::LogInfo("CastorDigiProducer") << "checking the geometry..."; // get the correct geometry @@ -91,13 +95,13 @@ void CastorDigiProducer::initializeEvent(edm::Event const&, edm::EventSetup cons theCastorDigitizer->initializeHits(); } -void CastorDigiProducer::accumulateCaloHits(std::vector const& hcalHits, int bunchCrossing, CLHEP::HepRandomEngine* engine) { +void CastorDigiProducer::accumulateCaloHits(std::vector const& hcalHits, int bunchCrossing) { //fillFakeHits(); if(theHitCorrection != nullptr) { theHitCorrection->fillChargeSums(hcalHits); } - theCastorDigitizer->add(hcalHits, bunchCrossing, engine); + theCastorDigitizer->add(hcalHits, bunchCrossing, randomEngine_); } void CastorDigiProducer::accumulate(edm::Event const& e, edm::EventSetup const&) { @@ -105,7 +109,7 @@ void CastorDigiProducer::accumulate(edm::Event const& e, edm::EventSetup const&) edm::Handle > castorHandle; e.getByLabel(theHitsProducerTag, castorHandle); - accumulateCaloHits(*castorHandle.product(), 0, randomEngine(e.streamID())); + accumulateCaloHits(*castorHandle.product(), 0); } void CastorDigiProducer::accumulate(PileUpEventPrincipal const& e, edm::EventSetup const&, edm::StreamID const& streamID) { @@ -113,7 +117,7 @@ void CastorDigiProducer::accumulate(PileUpEventPrincipal const& e, edm::EventSet edm::Handle > castorHandle; e.getByLabel(theHitsProducerTag, castorHandle); - accumulateCaloHits(*castorHandle.product(), e.bunchCrossing(), randomEngine(streamID)); + accumulateCaloHits(*castorHandle.product(), e.bunchCrossing()); } void CastorDigiProducer::finalizeEvent(edm::Event& e, const edm::EventSetup& eventSetup) { @@ -122,12 +126,14 @@ void CastorDigiProducer::finalizeEvent(edm::Event& e, const edm::EventSetup& eve std::unique_ptr castorResult(new CastorDigiCollection()); // Step C: Invoke the algorithm, getting back outputs. - theCastorDigitizer->run(*castorResult, randomEngine(e.streamID())); + theCastorDigitizer->run(*castorResult, randomEngine_); edm::LogInfo("CastorDigiProducer") << "HCAL/Castor digis : " << castorResult->size(); // Step D: Put outputs into event e.put(std::move(castorResult)); + + randomEngine_ = nullptr; // to prevent access outside event } @@ -162,18 +168,3 @@ void CastorDigiProducer::checkGeometry(const edm::EventSetup & eventSetup) { //std::cout<<"CastorDigiProducer::CheckGeometry number of cells: "<setDetIds(castorCells); } - -CLHEP::HepRandomEngine* CastorDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { - edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; - } - return ptr; -} - diff --git a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h index 075fca39992ba..bdf793e344fd6 100644 --- a/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h +++ b/SimCalorimetry/CastorSim/plugins/CastorDigiProducer.h @@ -46,7 +46,7 @@ class CastorDigiProducer : public DigiAccumulatorMixMod { private: - void accumulateCaloHits(std::vector const&, int bunchCrossing, CLHEP::HepRandomEngine*); + void accumulateCaloHits(std::vector const&, int bunchCrossing); /// fills the vectors for each subdetector void sortHits(const edm::PCaloHitContainer & hits); @@ -58,8 +58,6 @@ class CastorDigiProducer : public DigiAccumulatorMixMod { edm::InputTag theHitsProducerTag; - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); - /** Reconstruction algorithm*/ typedef CaloTDigitizer CastorDigitizer; @@ -81,7 +79,7 @@ class CastorDigiProducer : public DigiAccumulatorMixMod { std::vector theCastorHits; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #endif diff --git a/SimCalorimetry/CastorSim/src/CastorAmplifier.cc b/SimCalorimetry/CastorSim/src/CastorAmplifier.cc index 88c30e51fb640..ea3717932b5af 100644 --- a/SimCalorimetry/CastorSim/src/CastorAmplifier.cc +++ b/SimCalorimetry/CastorSim/src/CastorAmplifier.cc @@ -37,6 +37,7 @@ void CastorAmplifier::amplify(CaloSamples & frame, CLHEP::HepRandomEngine* engin double gauss [32]; //big enough double noise [32]; //big enough double fCperPE = parameters.photoelectronsToAnalog(frame.id()); + double nominalfCperPE = parameters.getNominalfCperPE(); for (int i = 0; i < frame.size(); i++) { gauss[i] = CLHEP::RandGaussQ::shoot(engine, 0., 1.); } if(addNoise_) { @@ -44,9 +45,9 @@ void CastorAmplifier::amplify(CaloSamples & frame, CLHEP::HepRandomEngine* engin } for(int tbin = 0; tbin < frame.size(); ++tbin) { int capId = (theStartingCapId + tbin)%4; - double pedestal = peds->getValue (capId); + double pedestal = peds->getValue(capId); if(addNoise_) { - pedestal += noise [tbin]; + pedestal += noise [tbin]*(fCperPE/nominalfCperPE); } frame[tbin] *= fCperPE; frame[tbin] += pedestal; @@ -54,4 +55,3 @@ void CastorAmplifier::amplify(CaloSamples & frame, CLHEP::HepRandomEngine* engin } LogDebug("CastorAmplifier") << frame; } - diff --git a/SimCalorimetry/CastorSim/src/CastorSimParameters.cc b/SimCalorimetry/CastorSim/src/CastorSimParameters.cc index c14c9c96eef93..fe37f19607e09 100644 --- a/SimCalorimetry/CastorSim/src/CastorSimParameters.cc +++ b/SimCalorimetry/CastorSim/src/CastorSimParameters.cc @@ -11,7 +11,8 @@ CastorSimParameters::CastorSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog,double samplingFactor, double timePhase, bool syncPhase) : CaloSimParameters(simHitToPhotoelectrons, photoelectronsToAnalog, samplingFactor, timePhase, 6, 4, false, syncPhase), theDbService(nullptr), - theSamplingFactor( samplingFactor ) + theSamplingFactor( samplingFactor ), + nominalfCperPE( 1) { } @@ -19,29 +20,20 @@ CastorSimParameters::CastorSimParameters(double simHitToPhotoelectrons, double p CastorSimParameters::CastorSimParameters(const edm::ParameterSet & p) : CaloSimParameters(p), theDbService(nullptr), - theSamplingFactor( p.getParameter("samplingFactor") ) + theSamplingFactor( p.getParameter("samplingFactor") ), + nominalfCperPE( p.getParameter("photoelectronsToAnalog") ) { } -/* -double CastorSimParameters::simHitToPhotoelectrons(const DetId & detId) const +double CastorSimParameters::getNominalfCperPE() const { - // the gain is in units of GeV/fC. We want a constant with pe/dGeV - // pe/dGeV = (GeV/dGeV) / (GeV/fC) / (fC/pe) - double result = CaloSimParameters::simHitToPhotoelectrons(detId); - if(HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenForward - || HcalGenericDetId(detId).genericSubdet() != HcalGenericDetId::HcalGenCastor) - { - result = samplingFactor(detId) / fCtoGeV(detId) / photoelectronsToAnalog(); - } - return result; + // return the nominal PMT gain value of CASTOR from the config file. + return nominalfCperPE; } -*/ double CastorSimParameters::photoelectronsToAnalog(const DetId & detId) const { // calculate factor (PMT gain) using sampling factor value & available electron gain - //std::cout << " sampling factor = " << theSamplingFactor << " fCtoGeV = " << fCtoGeV(detId) << " and photoelectronsToAnalog = " << theSamplingFactor/fCtoGeV(detId) << std::endl; return theSamplingFactor/fCtoGeV(detId); } @@ -62,16 +54,6 @@ double CastorSimParameters::fCtoGeV(const DetId & detId) const { // only one gain will be recorded per channel, so just use capID 0 for now result = gains->getValue(0); - // if(doNoise_) - /// { - // result += CLHEP::RandGaussQ::shoot(0., gwidths->getValue(0)); - // } } return result; } -/* -double CastorSimParameters::samplingFactor(const DetId & detId) const { -HcalDetId hcalDetId(detId); -return theSamplingFactors[hcalDetId.ietaAbs()-theFirstRing]; -} -*/ diff --git a/SimCalorimetry/CastorSim/src/CastorSimParameters.h b/SimCalorimetry/CastorSim/src/CastorSimParameters.h index da138e3c5d862..e668ea0b5f6ba 100644 --- a/SimCalorimetry/CastorSim/src/CastorSimParameters.h +++ b/SimCalorimetry/CastorSim/src/CastorSimParameters.h @@ -12,35 +12,21 @@ class CastorSimParameters : public CaloSimParameters CastorSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, double samplingFactor, double timePhase, bool syncPhase); CastorSimParameters(const edm::ParameterSet & p); - /* - CastorSimParameters(double simHitToPhotoelectrons, double photoelectronsToAnalog, - double samplingFactor, double timePhase, - int readoutFrameSize, int binOfMaximum, - bool doPhotostatistics, bool syncPhase, - int firstRing, const std::vector & samplingFactors); - CastorSimParameters(const edm::ParameterSet & p); - */ - ~CastorSimParameters() override {} void setDbService(const CastorDbService * service) {theDbService = service;} -//virtual double simHitToPhotoelectrons(const DetId & detId) const; +double getNominalfCperPE() const; double photoelectronsToAnalog(const DetId & detId) const override; double fCtoGeV(const DetId & detId) const; - /// the ratio of actual incident energy to deposited energy - /// in the SimHit -// virtual double samplingFactor(const DetId & detId) const; - private: const CastorDbService * theDbService; double theSamplingFactor; -//std::vector theSamplingFactors; +double nominalfCperPE; }; #endif - diff --git a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h index 4b561ce1c61b5..49f1d9874c899 100644 --- a/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h +++ b/SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h @@ -78,7 +78,7 @@ class EcalDigiProducer : public DigiAccumulatorMixMod { virtual void cacheEEDigis( const EEDigiCollection* eeDigiPtr ) const { } typedef edm::Handle > HitsHandle; - void accumulateCaloHits(HitsHandle const& ebHandle, HitsHandle const& eeHandle, HitsHandle const& esHandle, int bunchCrossing, CLHEP::HepRandomEngine*); + void accumulateCaloHits(HitsHandle const& ebHandle, HitsHandle const& eeHandle, HitsHandle const& esHandle, int bunchCrossing); void checkGeometry(const edm::EventSetup& eventSetup) ; @@ -86,8 +86,6 @@ class EcalDigiProducer : public DigiAccumulatorMixMod { void checkCalibrations(const edm::Event& event, const edm::EventSetup& eventSetup) ; - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); - const APDShape m_APDShape ; const EBShape m_EBShape ; const EEShape m_EEShape ; @@ -148,7 +146,7 @@ class EcalDigiProducer : public DigiAccumulatorMixMod { std::array< std::unique_ptr >, 3 > m_EBCorrNoise ; std::array< std::unique_ptr >, 3 > m_EECorrNoise ; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #endif diff --git a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc index 397e64bdc6a85..9324990bba602 100644 --- a/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc +++ b/SimCalorimetry/EcalSimProducers/src/EcalDigiProducer.cc @@ -55,230 +55,16 @@ EcalDigiProducer::EcalDigiProducer( const edm::ParameterSet& params, edm::ProducerBase& mixMod, edm::ConsumesCollector& iC) : - DigiAccumulatorMixMod(), - m_APDShape ( params.getParameter( "apdShapeTstart" ) , - params.getParameter( "apdShapeTau" ) ) , - m_EBShape ( ) , - m_EEShape ( ) , - m_ESShape ( ) , - m_EBdigiCollection ( params.getParameter("EBdigiCollection") ) , - m_EEdigiCollection ( params.getParameter("EEdigiCollection") ) , - m_ESdigiCollection ( params.getParameter("ESdigiCollection") ) , - m_hitsProducerTag ( params.getParameter("hitsProducer" ) ) , - m_useLCcorrection ( params.getUntrackedParameter("UseLCcorrection") ) , - m_apdSeparateDigi ( params.getParameter ("apdSeparateDigi") ) , - - m_EBs25notCont ( params.getParameter ("EBs25notContainment") ) , - m_EEs25notCont ( params.getParameter ("EEs25notContainment") ) , - - m_readoutFrameSize ( params.getParameter ("readoutFrameSize") ) , - m_ParameterMap ( new EcalSimParameterMap( - params.getParameter ("simHitToPhotoelectronsBarrel") , - params.getParameter ("simHitToPhotoelectronsEndcap") , - params.getParameter ("photoelectronsToAnalogBarrel") , - params.getParameter ("photoelectronsToAnalogEndcap") , - params.getParameter ("samplingFactor") , - params.getParameter ("timePhase") , - m_readoutFrameSize , - params.getParameter ("binOfMaximum") , - params.getParameter ("doPhotostatistics") , - params.getParameter ("syncPhase") ) ) , - - m_apdDigiTag ( params.getParameter ("apdDigiTag" ) ) , - m_apdParameters ( new APDSimParameters( - params.getParameter ("apdAddToBarrel" ) , - m_apdSeparateDigi , - params.getParameter ("apdSimToPELow" ) , - params.getParameter ("apdSimToPEHigh" ) , - params.getParameter ("apdTimeOffset" ) , - params.getParameter ("apdTimeOffWidth" ) , - params.getParameter ("apdDoPEStats" ) , - m_apdDigiTag , - params.getParameter > ( "apdNonlParms" ) ) ) , - - m_APDResponse ( !m_apdSeparateDigi ? nullptr : - new EBHitResponse( m_ParameterMap.get() , - &m_EBShape , - true , - m_apdParameters.get() , - &m_APDShape ) ) , - - m_EBResponse ( new EBHitResponse( m_ParameterMap.get() , - &m_EBShape , - false , // barrel - m_apdParameters.get() , - &m_APDShape ) ) , - - m_EEResponse ( new EEHitResponse( m_ParameterMap.get(), - &m_EEShape ) ) , - m_ESResponse ( new ESHitResponse( m_ParameterMap.get(), &m_ESShape ) ) , - m_ESOldResponse ( new CaloHitResponse( m_ParameterMap.get(), &m_ESShape ) ) , - - m_addESNoise ( params.getParameter ("doESNoise") ) , - m_PreMix1 ( params.getParameter ("EcalPreMixStage1") ) , - m_PreMix2 ( params.getParameter ("EcalPreMixStage2") ) , - - m_doFastES ( params.getParameter ("doFast" ) ) , - - m_doEB ( params.getParameter ("doEB" ) ) , - m_doEE ( params.getParameter ("doEE" ) ) , - m_doES ( params.getParameter ("doES" ) ) , - - m_ESElectronicsSim ( m_doFastES ? nullptr : - new ESElectronicsSim( m_addESNoise ) ) , - - m_ESOldDigitizer ( m_doFastES ? nullptr : - new ESOldDigitizer( m_ESOldResponse.get() , - m_ESElectronicsSim.get() , - m_addESNoise ) ) , - - m_ESElectronicsSimFast ( !m_doFastES ? nullptr : - new ESElectronicsSimFast( m_addESNoise , - m_PreMix1) ) , - - m_ESDigitizer ( !m_doFastES ? nullptr : - new ESDigitizer( m_ESResponse.get() , - m_ESElectronicsSimFast.get() , - m_addESNoise ) ) , - - m_APDDigitizer ( nullptr ) , - m_BarrelDigitizer ( nullptr ) , - m_EndcapDigitizer ( nullptr ) , - m_ElectronicsSim ( nullptr ) , - m_Coder ( nullptr ) , - m_APDElectronicsSim ( nullptr ) , - m_APDCoder ( nullptr ) , - m_Geometry ( nullptr ) , - m_EBCorrNoise ( { {nullptr, nullptr, nullptr} } ) , - m_EECorrNoise ( { {nullptr, nullptr, nullptr} } ) + EcalDigiProducer(params, iC) { if(m_apdSeparateDigi) mixMod.produces(m_apdDigiTag); mixMod.produces(m_EBdigiCollection); mixMod.produces(m_EEdigiCollection); mixMod.produces(m_ESdigiCollection); - - if( m_doEB ) iC.consumes >(edm::InputTag(m_hitsProducerTag, "EcalHitsEB")); - if( m_doEE ) iC.consumes >(edm::InputTag(m_hitsProducerTag, "EcalHitsEE")); - if( m_doES ) iC.consumes >(edm::InputTag(m_hitsProducerTag, "EcalHitsES")); - - const std::vector ebCorMatG12 = params.getParameter< std::vector >("EBCorrNoiseMatrixG12"); - const std::vector eeCorMatG12 = params.getParameter< std::vector >("EECorrNoiseMatrixG12"); - const std::vector ebCorMatG06 = params.getParameter< std::vector >("EBCorrNoiseMatrixG06"); - const std::vector eeCorMatG06 = params.getParameter< std::vector >("EECorrNoiseMatrixG06"); - const std::vector ebCorMatG01 = params.getParameter< std::vector >("EBCorrNoiseMatrixG01"); - const std::vector eeCorMatG01 = params.getParameter< std::vector >("EECorrNoiseMatrixG01"); - - const bool applyConstantTerm = params.getParameter ("applyConstantTerm"); - const double rmsConstantTerm = params.getParameter ("ConstantTerm"); - - const bool addNoise = params.getParameter ("doENoise"); - const bool cosmicsPhase = params.getParameter ("cosmicsPhase"); - const double cosmicsShift = params.getParameter ("cosmicsShift"); - -//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - // further phase for cosmics studies - if( cosmicsPhase ) - { - if( m_doEB ) m_EBResponse->setPhaseShift( 1. + cosmicsShift ) ; - if( m_doEE ) m_EEResponse->setPhaseShift( 1. + cosmicsShift ) ; - } - - EcalCorrMatrix ebMatrix[ 3 ] ; - EcalCorrMatrix eeMatrix[ 3 ] ; - - assert( ebCorMatG12.size() == m_readoutFrameSize ) ; - assert( eeCorMatG12.size() == m_readoutFrameSize ) ; - assert( ebCorMatG06.size() == m_readoutFrameSize ) ; - assert( eeCorMatG06.size() == m_readoutFrameSize ) ; - assert( ebCorMatG01.size() == m_readoutFrameSize ) ; - assert( eeCorMatG01.size() == m_readoutFrameSize ) ; - - assert( 1.e-7 > fabs( ebCorMatG12[0] - 1.0 ) ) ; - assert( 1.e-7 > fabs( ebCorMatG06[0] - 1.0 ) ) ; - assert( 1.e-7 > fabs( ebCorMatG01[0] - 1.0 ) ) ; - assert( 1.e-7 > fabs( eeCorMatG12[0] - 1.0 ) ) ; - assert( 1.e-7 > fabs( eeCorMatG06[0] - 1.0 ) ) ; - assert( 1.e-7 > fabs( eeCorMatG01[0] - 1.0 ) ) ; - - for ( unsigned int row ( 0 ) ; row != m_readoutFrameSize ; ++row ) - { - assert( 0 == row || 1. >= ebCorMatG12[row] ) ; - assert( 0 == row || 1. >= ebCorMatG06[row] ) ; - assert( 0 == row || 1. >= ebCorMatG01[row] ) ; - assert( 0 == row || 1. >= eeCorMatG12[row] ) ; - assert( 0 == row || 1. >= eeCorMatG06[row] ) ; - assert( 0 == row || 1. >= eeCorMatG01[row] ) ; - for ( unsigned int column ( 0 ) ; column <= row ; ++column ) - { - const unsigned int index ( row - column ) ; - ebMatrix[0]( row, column ) = ebCorMatG12[ index ] ; - eeMatrix[0]( row, column ) = eeCorMatG12[ index ] ; - ebMatrix[1]( row, column ) = ebCorMatG06[ index ] ; - eeMatrix[1]( row, column ) = eeCorMatG06[ index ] ; - ebMatrix[2]( row, column ) = ebCorMatG01[ index ] ; - eeMatrix[2]( row, column ) = eeCorMatG01[ index ] ; - } - } - - m_EBCorrNoise[0].reset( new CorrelatedNoisifier( ebMatrix[0] ) ); - m_EECorrNoise[0].reset( new CorrelatedNoisifier( eeMatrix[0] ) ); - m_EBCorrNoise[1].reset( new CorrelatedNoisifier( ebMatrix[1] ) ); - m_EECorrNoise[1].reset( new CorrelatedNoisifier( eeMatrix[1] ) ); - m_EBCorrNoise[2].reset( new CorrelatedNoisifier( ebMatrix[2] ) ); - m_EECorrNoise[2].reset( new CorrelatedNoisifier( eeMatrix[2] ) ); - - m_Coder.reset( new EcalCoder( addNoise , - m_PreMix1 , - m_EBCorrNoise[0].get() , - m_EECorrNoise[0].get() , - m_EBCorrNoise[1].get() , - m_EECorrNoise[1].get() , - m_EBCorrNoise[2].get() , - m_EECorrNoise[2].get() ) ); - - m_ElectronicsSim.reset( new EcalElectronicsSim( m_ParameterMap.get() , - m_Coder.get() , - applyConstantTerm , - rmsConstantTerm ) ); - - if( m_apdSeparateDigi ) - { - m_APDCoder.reset( new EcalCoder( false , - m_PreMix1 , - m_EBCorrNoise[0].get() , - m_EECorrNoise[0].get() , - m_EBCorrNoise[1].get() , - m_EECorrNoise[1].get() , - m_EBCorrNoise[2].get() , - m_EECorrNoise[2].get() ) ); - - m_APDElectronicsSim.reset( new EcalElectronicsSim( m_ParameterMap.get() , - m_APDCoder.get() , - applyConstantTerm , - rmsConstantTerm ) ); - - m_APDDigitizer.reset( new EBDigitizer( m_APDResponse.get() , - m_APDElectronicsSim.get() , - false ) ); - } - - if( m_doEB ) { - m_BarrelDigitizer.reset( new EBDigitizer( m_EBResponse.get() , - m_ElectronicsSim.get() , - addNoise ) ); - } - - if ( m_doEE ) { - m_EndcapDigitizer.reset( new EEDigitizer( m_EEResponse.get() , - m_ElectronicsSim.get() , - addNoise ) ); - } } - -// duplicate version for Pre-Mixing, for use outside of MixingModule +// version for Pre-Mixing, for use outside of MixingModule EcalDigiProducer::EcalDigiProducer( const edm::ParameterSet& params, edm::ConsumesCollector& iC) : DigiAccumulatorMixMod(), m_APDShape ( params.getParameter( "apdShapeTstart" ) , @@ -470,6 +256,7 @@ EcalDigiProducer::EcalDigiProducer( const edm::ParameterSet& params, edm::Consu if( m_apdSeparateDigi ) { m_APDCoder.reset( new EcalCoder( false , + m_PreMix1 , m_EBCorrNoise[0].get() , m_EECorrNoise[0].get() , m_EBCorrNoise[1].get() , @@ -506,6 +293,9 @@ EcalDigiProducer::~EcalDigiProducer() void EcalDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const& eventSetup) { + edm::Service rng; + randomEngine_ = &rng->getEngine(event.streamID()); + checkGeometry( eventSetup ); checkCalibrations( event, eventSetup ); if( m_doEB ) { @@ -527,24 +317,24 @@ EcalDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const } void -EcalDigiProducer::accumulateCaloHits(HitsHandle const& ebHandle, HitsHandle const& eeHandle, HitsHandle const& esHandle, int bunchCrossing, CLHEP::HepRandomEngine* engine) { +EcalDigiProducer::accumulateCaloHits(HitsHandle const& ebHandle, HitsHandle const& eeHandle, HitsHandle const& esHandle, int bunchCrossing) { if(m_doEB && ebHandle.isValid()) { - m_BarrelDigitizer->add(*ebHandle.product(), bunchCrossing, engine); + m_BarrelDigitizer->add(*ebHandle.product(), bunchCrossing, randomEngine_); if(m_apdSeparateDigi) { - m_APDDigitizer->add(*ebHandle.product(), bunchCrossing, engine); + m_APDDigitizer->add(*ebHandle.product(), bunchCrossing, randomEngine_); } } if(m_doEE && eeHandle.isValid()) { - m_EndcapDigitizer->add(*eeHandle.product(), bunchCrossing, engine); + m_EndcapDigitizer->add(*eeHandle.product(), bunchCrossing, randomEngine_); } if(m_doES && esHandle.isValid()) { if(m_doFastES) { - m_ESDigitizer->add(*esHandle.product(), bunchCrossing, engine); + m_ESDigitizer->add(*esHandle.product(), bunchCrossing, randomEngine_); } else { - m_ESOldDigitizer->add(*esHandle.product(), bunchCrossing, engine); + m_ESOldDigitizer->add(*esHandle.product(), bunchCrossing, randomEngine_); } } } @@ -552,37 +342,49 @@ EcalDigiProducer::accumulateCaloHits(HitsHandle const& ebHandle, HitsHandle cons void EcalDigiProducer::accumulate(edm::Event const& e, edm::EventSetup const& eventSetup) { // Step A: Get Inputs - edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB"); edm::Handle > ebHandle; - e.getByLabel(ebTag, ebHandle); + if(m_doEB) { + edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB"); + e.getByLabel(ebTag, ebHandle); + } - edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE"); edm::Handle > eeHandle; - e.getByLabel(eeTag, eeHandle); + if(m_doEE) { + edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE"); + e.getByLabel(eeTag, eeHandle); + } - edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES"); edm::Handle > esHandle; - e.getByLabel(esTag, esHandle); + if(m_doES) { + edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES"); + e.getByLabel(esTag, esHandle); + } - accumulateCaloHits(ebHandle, eeHandle, esHandle, 0, randomEngine(e.streamID())); + accumulateCaloHits(ebHandle, eeHandle, esHandle, 0); } void EcalDigiProducer::accumulate(PileUpEventPrincipal const& e, edm::EventSetup const& eventSetup, edm::StreamID const& streamID) { // Step A: Get Inputs - edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB"); edm::Handle > ebHandle; - e.getByLabel(ebTag, ebHandle); + if(m_doEB) { + edm::InputTag ebTag(m_hitsProducerTag, "EcalHitsEB"); + e.getByLabel(ebTag, ebHandle); + } - edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE"); edm::Handle > eeHandle; - e.getByLabel(eeTag, eeHandle); + if(m_doEE) { + edm::InputTag eeTag(m_hitsProducerTag, "EcalHitsEE"); + e.getByLabel(eeTag, eeHandle); + } - edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES"); edm::Handle > esHandle; - e.getByLabel(esTag, esHandle); + if(m_doES) { + edm::InputTag esTag(m_hitsProducerTag, "EcalHitsES"); + e.getByLabel(esTag, esHandle); + } - accumulateCaloHits(ebHandle, eeHandle, esHandle, e.bunchCrossing(), randomEngine(streamID)); + accumulateCaloHits(ebHandle, eeHandle, esHandle, e.bunchCrossing()); } void @@ -597,27 +399,27 @@ EcalDigiProducer::finalizeEvent(edm::Event& event, edm::EventSetup const& eventS // run the algorithm if( m_doEB ) { - m_BarrelDigitizer->run( *barrelResult, randomEngine(event.streamID()) ) ; + m_BarrelDigitizer->run( *barrelResult, randomEngine_ ) ; cacheEBDigis( &*barrelResult ) ; edm::LogInfo("DigiInfo") << "EB Digis: " << barrelResult->size() ; if( m_apdSeparateDigi ) { - m_APDDigitizer->run( *apdResult, randomEngine(event.streamID()) ) ; + m_APDDigitizer->run( *apdResult, randomEngine_ ) ; edm::LogInfo("DigiInfo") << "APD Digis: " << apdResult->size() ; } } if( m_doEE ) { - m_EndcapDigitizer->run( *endcapResult, randomEngine(event.streamID()) ) ; + m_EndcapDigitizer->run( *endcapResult, randomEngine_ ) ; edm::LogInfo("EcalDigi") << "EE Digis: " << endcapResult->size() ; cacheEEDigis( &*endcapResult ) ; } if( m_doES ) { if(m_doFastES) { - m_ESDigitizer->run( *preshowerResult, randomEngine(event.streamID()) ) ; + m_ESDigitizer->run( *preshowerResult, randomEngine_ ) ; } else { - m_ESOldDigitizer->run( *preshowerResult, randomEngine(event.streamID()) ) ; + m_ESOldDigitizer->run( *preshowerResult, randomEngine_ ) ; } edm::LogInfo("EcalDigi") << "ES Digis: " << preshowerResult->size(); } @@ -631,6 +433,8 @@ EcalDigiProducer::finalizeEvent(edm::Event& event, edm::EventSetup const& eventS event.put(std::move(barrelResult), m_EBdigiCollection ) ; event.put(std::move(endcapResult), m_EEdigiCollection ) ; event.put(std::move(preshowerResult), m_ESdigiCollection ) ; + + randomEngine_ = nullptr; // to prevent access outside event } void @@ -829,20 +633,6 @@ EcalDigiProducer::updateGeometry() } } -CLHEP::HepRandomEngine* EcalDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { - edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; - } - return ptr; -} - void EcalDigiProducer::setEBNoiseSignalGenerator(EcalBaseSignalGenerator * noiseGenerator) { //noiseGenerator->setParameterMap(theParameterMap); if(nullptr != m_BarrelDigitizer) m_BarrelDigitizer->setNoiseSignalGenerator(noiseGenerator); diff --git a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc index c7abb517f098d..69ba7c63db1b5 100644 --- a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc +++ b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.cc @@ -10,74 +10,57 @@ // HGCDigiProducer::HGCDigiProducer(edm::ParameterSet const& pset, edm::ProducerBase& mixMod, edm::ConsumesCollector& iC) : - DigiAccumulatorMixMod(), - theDigitizer_(new HGCDigitizer(pset, iC) ) + HGCDigiProducer(pset, iC) { - if( theDigitizer_->producesEEDigis() ) - mixMod.produces(theDigitizer_->digiCollection()); - if( theDigitizer_->producesHEfrontDigis() ) - mixMod.produces(theDigitizer_->digiCollection()); - if( theDigitizer_->producesHEbackDigis() ) - mixMod.produces(theDigitizer_->digiCollection()); + if( theDigitizer_.producesEEDigis() ) + mixMod.produces(theDigitizer_.digiCollection()); + if( theDigitizer_.producesHEfrontDigis() ) + mixMod.produces(theDigitizer_.digiCollection()); + if( theDigitizer_.producesHEbackDigis() ) + mixMod.produces(theDigitizer_.digiCollection()); } HGCDigiProducer::HGCDigiProducer(edm::ParameterSet const& pset, edm::ConsumesCollector& iC) : DigiAccumulatorMixMod(), - theDigitizer_(new HGCDigitizer(pset, iC)) { -} - -// -HGCDigiProducer::~HGCDigiProducer() -{ + theDigitizer_(pset, iC) { } // void HGCDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const& es) { - theDigitizer_->initializeEvent(event, es); + edm::Service rng; + randomEngine_ = &rng->getEngine(event.streamID()); + theDigitizer_.initializeEvent(event, es); } // void HGCDigiProducer::finalizeEvent(edm::Event& event, edm::EventSetup const& es) { - theDigitizer_->finalizeEvent(event, es, randomEngine(event.streamID())); + theDigitizer_.finalizeEvent(event, es, randomEngine_); + randomEngine_ = nullptr; // to precent access outside event } // void HGCDigiProducer::accumulate(edm::Event const& event, edm::EventSetup const& es) { - theDigitizer_->accumulate(event, es, randomEngine(event.streamID())); + theDigitizer_.accumulate(event, es, randomEngine_); } void HGCDigiProducer::accumulate(PileUpEventPrincipal const& event, edm::EventSetup const& es, edm::StreamID const& streamID) { - theDigitizer_->accumulate(event, es, randomEngine(streamID)); + theDigitizer_.accumulate(event, es, randomEngine_); } // void HGCDigiProducer::beginRun(edm::Run const&, edm::EventSetup const& es) { - theDigitizer_->beginRun(es); + theDigitizer_.beginRun(es); } // void HGCDigiProducer::endRun(edm::Run const&, edm::EventSetup const&) { - theDigitizer_->endRun(); -} - -CLHEP::HepRandomEngine* HGCDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { - edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; - } - return ptr; + theDigitizer_.endRun(); } DEFINE_DIGI_ACCUMULATOR(HGCDigiProducer); diff --git a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h index 5d64f1558d2b5..18bb376243ce7 100644 --- a/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h +++ b/SimCalorimetry/HGCalSimProducers/plugins/HGCDigiProducer.h @@ -4,7 +4,6 @@ #include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" #include "SimCalorimetry/HGCalSimProducers/interface/HGCDigitizer.h" -#include #include namespace edm { @@ -31,12 +30,11 @@ class HGCDigiProducer : public DigiAccumulatorMixMod { void accumulate(PileUpEventPrincipal const&, edm::EventSetup const&, edm::StreamID const&) override; void beginRun(edm::Run const&, edm::EventSetup const&) override; void endRun(edm::Run const&, edm::EventSetup const&) override; - ~HGCDigiProducer() override; + ~HGCDigiProducer() override = default; private: - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); //the digitizer - std::unique_ptr theDigitizer_; - std::vector randomEngines_; + HGCDigitizer theDigitizer_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #endif diff --git a/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h b/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h index b19a601cedfa4..a7d359c197100 100644 --- a/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h +++ b/SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h @@ -38,12 +38,9 @@ class HcalDigiProducer : public DigiAccumulatorMixMod { void setQIE11NoiseSignalGenerator(HcalBaseSignalGenerator * noiseGenerator); private: - - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); - HcalDigitizer theDigitizer_; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #endif diff --git a/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc b/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc index 2345642e9bb65..36f508cd4a16e 100644 --- a/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc +++ b/SimCalorimetry/HcalSimProducers/src/HcalDigiProducer.cc @@ -31,22 +31,25 @@ HcalDigiProducer::HcalDigiProducer(edm::ParameterSet const& pset, edm::ConsumesC void HcalDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const& es) { + edm::Service rng; + randomEngine_ = &rng->getEngine(event.streamID()); theDigitizer_.initializeEvent(event, es); } void HcalDigiProducer::finalizeEvent(edm::Event& event, edm::EventSetup const& es) { - theDigitizer_.finalizeEvent(event, es, randomEngine(event.streamID())); + theDigitizer_.finalizeEvent(event, es, randomEngine_); + randomEngine_ = nullptr; // to prevent access outside event } void HcalDigiProducer::accumulate(edm::Event const& event, edm::EventSetup const& es) { - theDigitizer_.accumulate(event, es, randomEngine(event.streamID())); + theDigitizer_.accumulate(event, es, randomEngine_); } void HcalDigiProducer::accumulate(PileUpEventPrincipal const& event, edm::EventSetup const& es, edm::StreamID const& streamID) { - theDigitizer_.accumulate(event, es, randomEngine(streamID)); + theDigitizer_.accumulate(event, es, randomEngine_); } void @@ -84,17 +87,3 @@ void HcalDigiProducer::setQIE11NoiseSignalGenerator(HcalBaseSignalGenerator * noiseGenerator) { theDigitizer_.setQIE11NoiseSignalGenerator(noiseGenerator); } - -CLHEP::HepRandomEngine* HcalDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { - edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; - } - return ptr; -} diff --git a/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h b/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h index 26062efd4f1c1..c55030dde7c16 100644 --- a/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h +++ b/SimCalorimetry/HcalTestBeam/interface/HcalTBDigiProducer.h @@ -44,7 +44,7 @@ class HcalTBDigiProducer : public DigiAccumulatorMixMod { void finalizeEvent(edm::Event& e, edm::EventSetup const& c) override; private: - void accumulateCaloHits(edm::Handle > const& hits, int bunchCrossing, CLHEP::HepRandomEngine*); + void accumulateCaloHits(edm::Handle > const& hits, int bunchCrossing); /// fills the vectors for each subdetector void sortHits(const edm::PCaloHitContainer & hits); @@ -55,8 +55,6 @@ class HcalTBDigiProducer : public DigiAccumulatorMixMod { void setPhaseShift(const DetId & detId); - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); - const HcalTimeSlew* hcalTimeSlew_delay_; private: @@ -96,7 +94,7 @@ class HcalTBDigiProducer : public DigiAccumulatorMixMod { bool doPhaseShift; double tunePhaseShift; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #endif diff --git a/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc b/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc index 34f690d3fa199..0eaa2dfad5c5b 100644 --- a/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc +++ b/SimCalorimetry/HcalTestBeam/src/HcalTBDigiProducer.cc @@ -99,6 +99,10 @@ void HcalTBDigiProducer::initializeEvent(edm::Event const& e, edm::EventSetup co // get the correct geometry checkGeometry(eventSetup); + // Cache random number engine + edm::Service rng; + randomEngine_ = &rng->getEngine(e.streamID()); + theHBHEHits.clear(); theHOHits.clear(); if (doPhaseShift) { @@ -123,15 +127,15 @@ void HcalTBDigiProducer::initializeEvent(edm::Event const& e, edm::EventSetup co theHODigitizer->initializeHits(); } -void HcalTBDigiProducer::accumulateCaloHits(edm::Handle > const& hcalHandle, int bunchCrossing, CLHEP::HepRandomEngine* engine) { +void HcalTBDigiProducer::accumulateCaloHits(edm::Handle > const& hcalHandle, int bunchCrossing) { LogDebug("HcalSim") << "HcalTBDigiProducer::accumulate trying to get SimHit"; if(hcalHandle.isValid()) { std::vector hits = *hcalHandle.product(); LogDebug("HcalSim") << "HcalTBDigiProducer::accumulate Hits corrected"; - theHBHEDigitizer->add(hits, bunchCrossing, engine); - theHODigitizer->add(hits, bunchCrossing, engine); + theHBHEDigitizer->add(hits, bunchCrossing, randomEngine_); + theHODigitizer->add(hits, bunchCrossing, randomEngine_); } } @@ -142,7 +146,7 @@ void HcalTBDigiProducer::accumulate(edm::Event const& e, edm::EventSetup const&) edm::Handle > hcalHandle; e.getByLabel(hcalTag, hcalHandle); - accumulateCaloHits(hcalHandle, 0, randomEngine(e.streamID())); + accumulateCaloHits(hcalHandle, 0); } void HcalTBDigiProducer::accumulate(PileUpEventPrincipal const& e, edm::EventSetup const&, edm::StreamID const& streamID) { @@ -152,7 +156,7 @@ void HcalTBDigiProducer::accumulate(PileUpEventPrincipal const& e, edm::EventSet edm::Handle > hcalHandle; e.getByLabel(hcalTag, hcalHandle); - accumulateCaloHits(hcalHandle, e.bunchCrossing(), randomEngine(streamID)); + accumulateCaloHits(hcalHandle, e.bunchCrossing()); } void HcalTBDigiProducer::finalizeEvent(edm::Event& e, const edm::EventSetup& eventSetup) { @@ -161,9 +165,9 @@ void HcalTBDigiProducer::finalizeEvent(edm::Event& e, const edm::EventSetup& eve std::unique_ptr hoResult(new HODigiCollection()); LogDebug("HcalSim") << "HcalTBDigiProducer::produce Empty collection created"; // Step C: Invoke the algorithm, getting back outputs. - theHBHEDigitizer->run(*hbheResult, randomEngine(e.streamID())); + theHBHEDigitizer->run(*hbheResult, randomEngine_); edm::LogInfo("HcalSim") << "HcalTBDigiProducer: HBHE digis : " << hbheResult->size(); - theHODigitizer->run(*hoResult, randomEngine(e.streamID())); + theHODigitizer->run(*hoResult, randomEngine_); edm::LogInfo("HcalSim") << "HcalTBDigiProducer: HO digis : " << hoResult->size(); // Step D: Put outputs into event @@ -171,6 +175,7 @@ void HcalTBDigiProducer::finalizeEvent(edm::Event& e, const edm::EventSetup& eve e.put(std::move(hbheResult), instance); e.put(std::move(hoResult), instance); + randomEngine_ = nullptr; // to prevent access outside event } void HcalTBDigiProducer::sortHits(const edm::PCaloHitContainer & hits) { @@ -242,17 +247,3 @@ void HcalTBDigiProducer::setPhaseShift(const DetId & detId) { } } } - -CLHEP::HepRandomEngine* HcalTBDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { - edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; - } - return ptr; -} diff --git a/SimDataFormats/CaloHit/interface/CastorShowerEvent.h b/SimDataFormats/CaloHit/interface/CastorShowerEvent.h index 7c6def782f614..e879480b95ee3 100644 --- a/SimDataFormats/CaloHit/interface/CastorShowerEvent.h +++ b/SimDataFormats/CaloHit/interface/CastorShowerEvent.h @@ -21,8 +21,7 @@ CastorShowerEvent(); ~CastorShowerEvent() override; - - void Clear(); + void Clear(Option_t * option ="") override; // private: diff --git a/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h b/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h index 728318f970f96..3418bd310d79c 100644 --- a/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h +++ b/SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h @@ -14,7 +14,7 @@ class SLBin: public TObject { SLBin() {}; ~SLBin() override {}; // Setters - void Clear() {NEvts=NBins=NEvtPerBin=0;Bins.clear();}; + void Clear(Option_t * option = "") override {NEvts=NBins=NEvtPerBin=0;Bins.clear();}; void setNEvts(unsigned int n) {NEvts = n;}; void setNBins(unsigned int n) {NBins = n;}; void setNEvtPerBin(unsigned int n) {NEvtPerBin=n;}; @@ -40,8 +40,8 @@ class CastorShowerLibraryInfo : public TObject { CastorShowerLibraryInfo(); ~CastorShowerLibraryInfo() override; - - void Clear(); + + void Clear(Option_t * option = "") override; // Data members SLBin Energy; diff --git a/SimDataFormats/CaloHit/src/CastorShowerEvent.cc b/SimDataFormats/CaloHit/src/CastorShowerEvent.cc index 16fd92a2a21db..7fc6115bc3266 100644 --- a/SimDataFormats/CaloHit/src/CastorShowerEvent.cc +++ b/SimDataFormats/CaloHit/src/CastorShowerEvent.cc @@ -9,7 +9,7 @@ CastorShowerEvent::CastorShowerEvent() { CastorShowerEvent::~CastorShowerEvent() {} -void CastorShowerEvent::Clear() { +void CastorShowerEvent::Clear(Option_t * option) { nhit = 0; detID.clear(); hitPosition.clear(); diff --git a/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc b/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc index df84fc877a0ba..91930dd593d13 100644 --- a/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc +++ b/SimDataFormats/CaloHit/src/CastorShowerLibraryInfo.cc @@ -8,8 +8,7 @@ CastorShowerLibraryInfo::CastorShowerLibraryInfo() { CastorShowerLibraryInfo::~CastorShowerLibraryInfo() {} - -void CastorShowerLibraryInfo::Clear() { +void CastorShowerLibraryInfo::Clear(Option_t * option) { Energy.Clear(); Eta.Clear(); Phi.Clear(); diff --git a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc index 1d071ff1ab394..83169b076704b 100644 --- a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc +++ b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.cc @@ -31,6 +31,8 @@ FTLDigiProducer::~FTLDigiProducer() // void FTLDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup const& es) { + edm::Service rng; + randomEngine_ = &rng->getEngine(event.streamID()); for( auto& digitizer : theDigitizers_ ) { digitizer->initializeEvent(event, es); } @@ -40,22 +42,23 @@ void FTLDigiProducer::initializeEvent(edm::Event const& event, edm::EventSetup c void FTLDigiProducer::finalizeEvent(edm::Event& event, edm::EventSetup const& es) { for( auto& digitizer : theDigitizers_ ) { - digitizer->finalizeEvent(event, es, randomEngine(event.streamID())); + digitizer->finalizeEvent(event, es, randomEngine_); } + randomEngine_ = nullptr; // to prevent access outside event } // void FTLDigiProducer::accumulate(edm::Event const& event, edm::EventSetup const& es) { for( auto& digitizer : theDigitizers_ ) { - digitizer->accumulate(event, es, randomEngine(event.streamID())); + digitizer->accumulate(event, es, randomEngine_); } } void FTLDigiProducer::accumulate(PileUpEventPrincipal const& event, edm::EventSetup const& es, edm::StreamID const& streamID) { for( auto& digitizer : theDigitizers_ ) { - digitizer->accumulate(event, es, randomEngine(streamID)); + digitizer->accumulate(event, es, randomEngine_); } } @@ -74,17 +77,3 @@ void FTLDigiProducer::endRun(edm::Run const&, edm::EventSetup const&) digitizer->endRun(); } } - -CLHEP::HepRandomEngine* FTLDigiProducer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { - edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; - } - return ptr; -} diff --git a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h index f53e9ee05890f..8bdc3c7b80596 100644 --- a/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h +++ b/SimFastTiming/FastTimingCommon/plugins/FTLDigiProducer.h @@ -34,10 +34,9 @@ class FTLDigiProducer : public DigiAccumulatorMixMod { void endRun(edm::Run const&, edm::EventSetup const&) override; ~FTLDigiProducer() override; private: - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); //the digitizer std::vector > theDigitizers_; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; }; #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/SimG4Core/CustomPhysics/interface/CustomPhysicsList.h b/SimG4Core/CustomPhysics/interface/CustomPhysicsList.h index cd8faf09ffb87..100de584b72c1 100644 --- a/SimG4Core/CustomPhysics/interface/CustomPhysicsList.h +++ b/SimG4Core/CustomPhysics/interface/CustomPhysicsList.h @@ -7,7 +7,6 @@ #include class G4ProcessHelper; -class G4Decay; class CustomParticleFactory; class CustomPhysicsList : public G4VPhysicsConstructor @@ -21,9 +20,7 @@ class CustomPhysicsList : public G4VPhysicsConstructor private: - static G4ThreadLocal std::unique_ptr fDecayProcess; static G4ThreadLocal std::unique_ptr myHelper; - std::unique_ptr fParticleFactory; bool fHadronicInteraction; diff --git a/SimG4Core/CustomPhysics/python/Exotica_HSCP_SIM_cfi.py b/SimG4Core/CustomPhysics/python/Exotica_HSCP_SIM_cfi.py index 8ff2dc85635e2..81989dd294737 100644 --- a/SimG4Core/CustomPhysics/python/Exotica_HSCP_SIM_cfi.py +++ b/SimG4Core/CustomPhysics/python/Exotica_HSCP_SIM_cfi.py @@ -4,7 +4,7 @@ def customise(process): FLAVOR = process.generator.hscpFlavor.value() MASS_POINT = process.generator.massPoint.value() - SLHA_FILE = process.generator.slhaFile.value() + SLHA_FILE = process.generator.SLHAFileForPythia8.value() PROCESS_FILE = process.generator.processFile.value() PARTICLE_FILE = process.generator.particleFile.value() USE_REGGE = process.generator.useregge.value() diff --git a/SimG4Core/CustomPhysics/src/CustomParticleFactory.cc b/SimG4Core/CustomPhysics/src/CustomParticleFactory.cc index c53c0558a1acb..5a219de551f47 100644 --- a/SimG4Core/CustomPhysics/src/CustomParticleFactory.cc +++ b/SimG4Core/CustomPhysics/src/CustomParticleFactory.cc @@ -66,13 +66,13 @@ void CustomParticleFactory::loadCustomParticles(const std::string & filePath){ edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: entry to G4DecayTable: pdgID, width " << pdgId << ", " << width; + G4ParticleDefinition *aParticle = theParticleTable->FindParticle(pdgId); + if (!aParticle || width == 0.0) { continue; } G4DecayTable* aDecayTable = getDecayTable(&configFile, pdgId); - G4ParticleDefinition *aParticle = theParticleTable->FindParticle(pdgId); - G4ParticleDefinition *aAntiParticle = theParticleTable->FindAntiParticle(pdgId); - if (!aParticle) { continue; } aParticle->SetDecayTable(aDecayTable); aParticle->SetPDGStable(false); aParticle->SetPDGLifeTime(1.0/(width*CLHEP::GeV)*6.582122e-22*CLHEP::MeV*CLHEP::s); + G4ParticleDefinition *aAntiParticle = theParticleTable->FindAntiParticle(pdgId); if(aAntiParticle && aAntiParticle->GetPDGEncoding() != pdgId){ aAntiParticle->SetDecayTable(getAntiDecayTable(pdgId,aDecayTable)); aAntiParticle->SetPDGStable(false); @@ -228,6 +228,8 @@ void CustomParticleFactory::getMassTable(std::ifstream *configFile) { double mass; std::string name, tmp; std::string line; + G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable(); + // This should be compatible IMO to SLHA while (getline(*configFile,line)) { line.erase(0, line.find_first_not_of(" \t")); // remove leading whitespace @@ -241,22 +243,24 @@ void CustomParticleFactory::getMassTable(std::ifstream *configFile) { sstr >> pdgId >> mass >> tmp >> name; // Assume SLHA format, e.g.: 1000001 5.68441109E+02 # ~d_L mass = std::max(mass, 0.0); + if(theParticleTable->FindParticle(pdgId)) { continue; } edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: Calling addCustomParticle for pdgId: " << pdgId - << ", mass " << mass << " GeV, name " << name; + << ", mass " << mass << " GeV " << name + << ", isRHadron: " << CustomPDGParser::s_isRHadron(pdgId) + << ", isstopHadron: " << CustomPDGParser::s_isstopHadron(pdgId); addCustomParticle(pdgId, mass, name); + ////Find SM particle partner and check for the antiparticle. int pdgIdPartner = pdgId%100; - G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable(); G4ParticleDefinition *aParticle = theParticleTable->FindParticle(pdgIdPartner); //Add antiparticles for SUSY particles only, not for rHadrons. - edm::LogInfo("SimG4CoreCustomPhysics") - <<"CustomParticleFactory: Found aParticle = " << aParticle - << ", pdgId = " << pdgId - << ", pdgIdPartner = " << pdgIdPartner - << ", CustomPDGParser::s_isRHadron(pdgId) = " << CustomPDGParser::s_isRHadron(pdgId) - << ", CustomPDGParser::s_isstopHadron(pdgId) = " << CustomPDGParser::s_isstopHadron(pdgId); + if(aParticle) { + edm::LogInfo("SimG4CoreCustomPhysics") + <<"CustomParticleFactory: Found partner particle for " << " pdgId= " << pdgId + << ", pdgIdPartner= " << pdgIdPartner << " " << aParticle->GetParticleName(); + } if (aParticle && !CustomPDGParser::s_isRHadron(pdgId) && @@ -269,22 +273,26 @@ void CustomParticleFactory::getMassTable(std::ifstream *configFile) { pdgId!=37){ int sign = aParticle->GetAntiPDGEncoding()/pdgIdPartner; edm::LogInfo("SimG4CoreCustomPhysics") - <<"CustomParticleFactory: Found sign = " << sign - << ", aParticle->GetAntiPDGEncoding() " << aParticle->GetAntiPDGEncoding() - << ", pdgIdPartner = " << pdgIdPartner; + <<"CustomParticleFactory: For " << aParticle->GetParticleName() + <<" pdg= " << pdgIdPartner + << ", GetAntiPDGEncoding() " << aParticle->GetAntiPDGEncoding() + << " sign= " << sign; + if(std::abs(sign)!=1) { edm::LogInfo("SimG4CoreCustomPhysics") - <<"CustomParticleFactory: sgn= "<GetAntiPDGEncoding()<<" b "<GetAntiPDGEncoding()<<" b: "<DumpTable(); } if(sign==-1 && pdgId!=25 && pdgId!=35 && pdgId!=36 && pdgId!=37 && pdgId!=1000039){ tmp = "anti_"+name; - edm::LogInfo("SimG4CoreCustomPhysics") - <<"CustomParticleFactory: Calling addCustomParticle for antiparticle with pdgId: " - << -pdgId << ", mass " << mass << " GeV, name " << tmp; - addCustomParticle(-pdgId, mass, tmp); - theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId); + if(!theParticleTable->FindParticle(-pdgId)) { + edm::LogInfo("SimG4CoreCustomPhysics") + <<"CustomParticleFactory: Calling addCustomParticle for antiparticle with pdgId: " + << -pdgId << ", mass " << mass << " GeV, name " << tmp; + addCustomParticle(-pdgId, mass, tmp); + theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId); + } } else theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(pdgId); } @@ -292,11 +300,13 @@ void CustomParticleFactory::getMassTable(std::ifstream *configFile) { if(pdgId==1000039) theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(pdgId); // gravitino if(pdgId==1000024 || pdgId==1000037 || pdgId==37) { tmp = "anti_"+name; - edm::LogInfo("SimG4CoreCustomPhysics") - <<"CustomParticleFactory: Calling addCustomParticle for antiparticle (2) with pdgId: " - << -pdgId << ", mass " << mass << " GeV, name " << tmp; - addCustomParticle(-pdgId, mass, tmp); - theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId); + if(!theParticleTable->FindParticle(-pdgId)) { + edm::LogInfo("SimG4CoreCustomPhysics") + <<"CustomParticleFactory: Calling addCustomParticle for antiparticle (2) with pdgId: " + << -pdgId << ", mass " << mass << " GeV, name " << tmp; + addCustomParticle(-pdgId, mass, tmp); + theParticleTable->FindParticle(pdgId)->SetAntiPDGEncoding(-pdgId); + } } } } @@ -305,9 +315,8 @@ G4DecayTable* CustomParticleFactory::getDecayTable(std::ifstream *configFile, i double br; int nDaughters; - std::vector pdg(4); + int pdg[4] = {0}; std::string line; - std::vector name(4); G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable(); @@ -321,17 +330,14 @@ G4DecayTable* CustomParticleFactory::getDecayTable(std::ifstream *configFile, i if (line.at(0) == '#' && ToLower(line).find("br") < line.npos && ToLower(line).find("nda") < line.npos) continue; // skip a comment of the form: # BR NDA ID1 ID2 - if (line.at(0) == '#') { // other comments signal the end of the decay block + if (line.at(0) == '#' || ToLower(line).find("block") < line.npos) { edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: Finished the Decay Table "; break; } - - pdg.clear(); - name.clear(); std::stringstream sstr(line); sstr >> br >> nDaughters; // assume SLHA format, e.g.: 1.49435135E-01 2 -15 16 # BR(H+ -> tau+ nu_tau) - edm::LogInfo("SimG4CoreCustomPhysics") + LogDebug("SimG4CoreCustomPhysics") <<"CustomParticleFactory: Branching Ratio: " << br << ", Number of Daughters: " << nDaughters; if (nDaughters > 4) { edm::LogError("SimG4CoreCustomPhysics") @@ -339,9 +345,16 @@ G4DecayTable* CustomParticleFactory::getDecayTable(std::ifstream *configFile, i << " for pdgId: " << pdgId; break; } - for(int i=0; i> pdg[i]; - edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: Daughter ID " << pdg[i]; + LogDebug("SimG4CoreCustomPhysics") <<"CustomParticleFactory: Daughter ID " << pdg[i]; const G4ParticleDefinition* part = theParticleTable->FindParticle(pdg[i]); if (!part) { edm::LogWarning("SimG4CoreCustomPhysics") @@ -352,21 +365,25 @@ G4DecayTable* CustomParticleFactory::getDecayTable(std::ifstream *configFile, i } ////Set the G4 decay G4PhaseSpaceDecayChannel *aDecayChannel = new G4PhaseSpaceDecayChannel(parentName, br, nDaughters, - name[0],name[1],name[2],name[3]); + name[0],name[1],name[2],name[3]); decaytable->Insert(aDecayChannel); + edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: inserted decay channel " + <<" for pdgID= " << pdgId << " " << parentName + <<" BR= " << br << " Daughters: " << name[0] + <<" " << name[1]<< " " << name[2]<< " " << name[3]; } return decaytable; } G4DecayTable* CustomParticleFactory::getAntiDecayTable(int pdgId, G4DecayTable *theDecayTable) { - std::vector name(4); + std::string name[4] = {""}; G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable(); std::string parentName = theParticleTable->FindParticle(-pdgId)->GetParticleName(); G4DecayTable *decaytable= new G4DecayTable(); - for(int i=0;ientries();i++){ + for(int i=0;ientries(); ++i){ G4VDecayChannel *theDecayChannel = theDecayTable->GetDecayChannel(i); int nd = std::min(4, theDecayChannel->GetNumberOfDaughters()); for(int j=0; jGetBR(), nd, name[0],name[1],name[2],name[3]); decaytable->Insert(aDecayChannel); + edm::LogInfo("SimG4CoreCustomPhysics") <<"CustomParticleFactory: inserted decay channel " + <<" for pdgID= " << -pdgId << " " << parentName + <<" BR= " << theDecayChannel->GetBR() + << " Daughters: " << name[0] + <<" " << name[1]<< " " << name[2]<< " " << name[3]; } return decaytable; } diff --git a/SimG4Core/CustomPhysics/src/CustomPhysics.cc b/SimG4Core/CustomPhysics/src/CustomPhysics.cc index 7ae44ee5975b5..14f97face621a 100644 --- a/SimG4Core/CustomPhysics/src/CustomPhysics.cc +++ b/SimG4Core/CustomPhysics/src/CustomPhysics.cc @@ -27,7 +27,7 @@ CustomPhysics::CustomPhysics(G4LogicalVolumeToDDLogicalPartMap& map, bool ssPhys = p.getUntrackedParameter("ExoticaPhysicsSS",false); double timeLimit = p.getParameter("MaxTrackTime")*ns; edm::LogInfo("PhysicsList") << "You are using the simulation engine: " - << "QGSP_FTFP_BERT_EML for regular particles \n" + << "FTFP_BERT_EMM for regular particles \n" << "CustomPhysicsList " << ssPhys << " for exotics; " << " tracking cut " << tracking << " t(ns)= " << timeLimit/ns; // EM Physics diff --git a/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc b/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc index e9959d75c2053..fd52e28dc8ecb 100644 --- a/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc +++ b/SimG4Core/CustomPhysics/src/CustomPhysicsList.cc @@ -9,7 +9,6 @@ #include "FWCore/ParameterSet/interface/FileInPath.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "G4Decay.hh" #include "G4hMultipleScattering.hh" #include "G4hIonisation.hh" #include "G4ProcessManager.hh" @@ -19,7 +18,6 @@ using namespace CLHEP; -G4ThreadLocal std::unique_ptr CustomPhysicsList::fDecayProcess; G4ThreadLocal std::unique_ptr CustomPhysicsList::myHelper; CustomPhysicsList::CustomPhysicsList(const std::string& name, const edm::ParameterSet & p) @@ -33,7 +31,6 @@ CustomPhysicsList::CustomPhysicsList(const std::string& name, const edm::Paramet particleDefFilePath = fp.fullPath(); fParticleFactory.reset(new CustomParticleFactory()); - fDecayProcess.reset(nullptr); myHelper.reset(nullptr); edm::LogInfo("SimG4CoreCustomPhysics") @@ -56,7 +53,6 @@ void CustomPhysicsList::ConstructProcess() { <<"CustomPhysicsList: adding CustomPhysics processes " << "for the list of particles"; - fDecayProcess.reset(new G4Decay()); G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper(); for(auto particle : fParticleFactory.get()->GetCustomParticles()) { @@ -72,9 +68,6 @@ void CustomPhysicsList::ConstructProcess() { ph->RegisterProcess(new G4hMultipleScattering, particle); ph->RegisterProcess(new G4hIonisation, particle); } - if(fDecayProcess.get()->IsApplicable(*particle)) { - ph->RegisterProcess(fDecayProcess.get(), particle); - } if(cp->GetCloud() && fHadronicInteraction && CustomPDGParser::s_isRHadron(particle->GetPDGEncoding())) { edm::LogInfo("SimG4CoreCustomPhysics") diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc index f0c9ed8b9e865..9900ea722f696 100644 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc +++ b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.cc @@ -1,461 +1,684 @@ -// S Zenz/L Gray, May 2016 -// Loosely based on TrackingTruthAccumulator (M Grimes) +#define DEBUG false +#if DEBUG +// boost optional (used by boost graph) results in some false positives with -Wmaybe-uninitialized +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + +// BOOST GRAPH LIBRARY +#include +#include +#include +#include + +#if DEBUG +#pragma GCC diagnostic pop +#endif -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" -#include "SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.h" - -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" -#include "SimDataFormats/Vertex/interface/SimVertex.h" +#include +#include // for std::accumulate +#include -#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" - #include "FWCore/Framework/interface/ProducerBase.h" -#include "SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" -#include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalDetId.h" +#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" -#include "FWCore/Framework/interface/ESHandle.h" + +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" +#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" +#include "SimDataFormats/Vertex/interface/SimVertex.h" + +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" +#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" +#include "SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" -#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +namespace { +using Index_t = unsigned; +using Barcode_t = int; +const std::string messageCategoryGraph_("CaloTruthAccumulatorGraphProducer"); +} -#include +using boost::adjacency_list; +using boost::directedS; +using boost::listS; +using boost::vecS; +using boost::property; +using boost::edge; +using boost::edge_weight_t; +using boost::edge_weight; +using boost::add_edge; +using boost::vertex; +using boost::vertex_name_t; +using boost::vertex_name; + +/* GRAPH DEFINITIONS + + The graphs represent the full decay chain. + + The parent-child relationship is the natural one, following "time". + + Each edge has a property (edge_weight_t) that holds a const pointer to the + SimTrack that connects the 2 vertices of the edge, the number of simHits + associated to that simTrack and the cumulative number of simHits of itself + and of all its children. Only simHits within the selected detectors are + taken into account. The cumulative property is filled during the dfs + exploration of the graph: if not explored the number is 0. + + Each vertex has a property (vertex_name_t) that holds a const pointer to the + SimTrack that originated that vertex and the cumulative number of simHits of + all its outgoing edges. The cumulative property is filled during the dfs + exploration of the graph: if not explored the number is 0. + + Stable particles are recovered/added in a second iterations and are linked + to ghost vertices with an offset starting from the highest generated vertex. + + Multiple decays of a single particle that retains its original trackId are + merged into one unique vertex (the first encountered) in order to avoid + multiple counting of its associated simHits (if any). + +*/ +struct EdgeProperty { + EdgeProperty(const SimTrack* t, int h, int c) : simTrack(t), simHits(h), cumulative_simHits(c) {} + const SimTrack* simTrack; + int simHits; + int cumulative_simHits; +}; + +struct VertexProperty { + VertexProperty() : simTrack(nullptr), cumulative_simHits(0) {} + VertexProperty(const SimTrack* t, int c) : simTrack(t), cumulative_simHits(c) {} + VertexProperty(const VertexProperty& other) + : simTrack(other.simTrack), cumulative_simHits(other.cumulative_simHits) {} + const SimTrack* simTrack; + int cumulative_simHits; +}; + +using EdgeParticleClustersProperty = property; +using VertexMotherParticleProperty = property; +using DecayChain = adjacency_list; + +class CaloTruthAccumulator : public DigiAccumulatorMixMod { + public: + explicit CaloTruthAccumulator(const edm::ParameterSet& config, + edm::ProducerBase& mixMod, + edm::ConsumesCollector& iC); + + private: + void initializeEvent(const edm::Event& event, const edm::EventSetup& setup) override; + void accumulate(const edm::Event& event, const edm::EventSetup& setup) override; + void accumulate(const PileUpEventPrincipal& event, const edm::EventSetup& setup, + edm::StreamID const&) override; + void finalizeEvent(edm::Event& event, const edm::EventSetup& setup) override; + void beginLuminosityBlock(edm::LuminosityBlock const& lumi, + edm::EventSetup const& setup) override; + + /** @brief Both forms of accumulate() delegate to this templated method. */ + template + void accumulateEvent(const T& event, const edm::EventSetup& setup, + const edm::Handle& hepMCproduct); + + /** @brief Fills the supplied vector with pointers to the SimHits, checking for bad modules if + * required */ + template + void fillSimHits(std::vector >& returnValue, + std::unordered_map >& simTrackDetIdEnergyMap, + const T& event, const edm::EventSetup& setup); + + const std::string messageCategory_; + + std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations + std::unordered_multimap m_simHitBarcodeToIndex; + + /** The maximum bunch crossing BEFORE the signal crossing to create + TrackinParticles for. Use positive values. If set to zero no + previous bunches are added and only in-time, signal and after bunches + (defined by maximumSubsequentBunchCrossing_) are used. + */ + const unsigned int maximumPreviousBunchCrossing_; + /** The maximum bunch crossing AFTER the signal crossing to create + TrackinParticles for. E.g. if set to zero only + uses the signal and in time pileup (and previous bunches defined by the + maximumPreviousBunchCrossing_ parameter). + */ + const unsigned int maximumSubsequentBunchCrossing_; + + const edm::InputTag simTrackLabel_; + const edm::InputTag simVertexLabel_; + edm::Handle > hSimTracks; + edm::Handle > hSimVertices; + + std::vector collectionTags_; + edm::InputTag genParticleLabel_; + /// Needed to add HepMC::GenVertex to SimVertex + edm::InputTag hepMCproductLabel_; + + const double minEnergy_, maxPseudoRapidity_; + + public: + struct OutputCollections { + std::unique_ptr pSimClusters; + std::unique_ptr pCaloParticles; + }; + + struct calo_particles { + std::vector sc_start_; + std::vector sc_stop_; + + void swap(calo_particles& oth) { + sc_start_.swap(oth.sc_start_); + sc_stop_.swap(oth.sc_stop_); + } + + void clear() { + sc_start_.clear(); + sc_stop_.clear(); + } + }; + + private: + const HGCalTopology* hgtopo_[2]; + const HGCalDDDConstants* hgddd_[2]; + const HcalDDDRecConstants* hcddd_; + OutputCollections output_; + calo_particles m_caloParticles; +}; + +/* Graph utility functions */ + +namespace { +template +void accumulateSimHits_edge(Edge& e, const Graph& g, Visitor* v) { + auto const edge_property = get(edge_weight, g, e); + v->total_simHits += edge_property.simHits; + IfLogDebug(DEBUG, messageCategoryGraph_) + << " Examining edges " << e << " --> particle " << edge_property.simTrack->type() << "(" + << edge_property.simTrack->trackId() << ")" + << " with SimClusters: " << edge_property.simHits + << " Accumulated SimClusters: " << v->total_simHits << std::endl; +} +template +void print_vertex(Vertex& u, const Graph& g) { + auto const vertex_property = get(vertex_name, g, u); + IfLogDebug(DEBUG, messageCategoryGraph_) << " At " << u; + // The Mother of all vertices has **no** SimTrack associated. + if (vertex_property.simTrack) + IfLogDebug(DEBUG, messageCategoryGraph_) << " [" << vertex_property.simTrack->type() << "]" + << "(" << vertex_property.simTrack->trackId() << ")"; + IfLogDebug(DEBUG, messageCategoryGraph_) << std::endl; +} + +// Graphviz output functions will only be generated in DEBUG mode +#if DEBUG +std::string graphviz_vertex(const VertexProperty& v) { + std::ostringstream oss; + oss << "{id: " << (v.simTrack ? v.simTrack->trackId() : 0) + << ",\\ntype: " << (v.simTrack ? v.simTrack->type() : 0) << ",\\nchits: " << v.cumulative_simHits + << "}"; + return oss.str(); +} + +std::string graphviz_edge(const EdgeProperty& e) { + std::ostringstream oss; + oss << "[" << (e.simTrack ? e.simTrack->trackId() : 0) << "," + << (e.simTrack ? e.simTrack->type() : 0) + << "," << e.simHits + << "," << e.cumulative_simHits << "]"; + return oss.str(); +} +#endif + +class SimHitsAccumulator_dfs_visitor : public boost::default_dfs_visitor { + public: + int total_simHits = 0; + template + void examine_edge(Edge e, const Graph& g) { + accumulateSimHits_edge(e, g, this); + } + template + void finish_edge(Edge e, const Graph& g) { + auto const edge_property = get(edge_weight, g, e); + auto src = source(e, g); + auto trg = target(e, g); + auto cumulative = + edge_property.simHits + get(vertex_name, g, trg).cumulative_simHits + + (get(vertex_name, g, src).simTrack + ? get(vertex_name, g, src).cumulative_simHits + : 0); // when we hit the root vertex we have to stop adding back its contribution. + auto const src_vertex_property = get(vertex_name, g, src); + put(get(vertex_name, const_cast(g)), src, + VertexProperty(src_vertex_property.simTrack, cumulative)); + put(get(edge_weight, const_cast(g)), e, + EdgeProperty(edge_property.simTrack, edge_property.simHits, cumulative)); + IfLogDebug(DEBUG, messageCategoryGraph_) + << " Finished edge: " << e << " Track id: " << get(edge_weight, g, e).simTrack->trackId() + << " has accumulated " << cumulative << " hits" << std::endl; + IfLogDebug(DEBUG, messageCategoryGraph_) + << " SrcVtx: " << src << "\t" << get(vertex_name, g, src).simTrack << "\t" + << get(vertex_name, g, src).cumulative_simHits << std::endl; + IfLogDebug(DEBUG, messageCategoryGraph_) + << " TrgVtx: " << trg << "\t" << get(vertex_name, g, trg).simTrack << "\t" + << get(vertex_name, g, trg).cumulative_simHits << std::endl; + } +}; + +using Selector = std::function; + +class CaloParticle_dfs_visitor : public boost::default_dfs_visitor { + public: + CaloParticle_dfs_visitor(CaloTruthAccumulator::OutputCollections& output, + CaloTruthAccumulator::calo_particles& caloParticles, + std::unordered_multimap& simHitBarcodeToIndex, + std::unordered_map >& simTrackDetIdEnergyMap, + Selector selector) + : output_(output), + caloParticles_(caloParticles), + simHitBarcodeToIndex_(simHitBarcodeToIndex), + simTrackDetIdEnergyMap_(simTrackDetIdEnergyMap), + selector_(selector) {} + template + void discover_vertex(Vertex u, const Graph& g) { + // If we reach the vertex 0, it means that we are backtracking with respect + // to the first generation of stable particles: simply return; + // if (u == 0) return; + print_vertex(u, g); + auto const vertex_property = get(vertex_name, g, u); + if (!vertex_property.simTrack) return; + auto trackIdx = vertex_property.simTrack->trackId(); + IfLogDebug(DEBUG, messageCategoryGraph_) + << " Found " << simHitBarcodeToIndex_.count(trackIdx) << " associated simHits" << std::endl; + if (simHitBarcodeToIndex_.count(trackIdx)) { + output_.pSimClusters->emplace_back(*vertex_property.simTrack); + auto& simcluster = output_.pSimClusters->back(); + std::unordered_map acc_energy; + for (auto const& hit_and_energy : simTrackDetIdEnergyMap_[trackIdx]) { + acc_energy[hit_and_energy.first] += hit_and_energy.second; + } + for (auto const& hit_and_energy : acc_energy) { + simcluster.addRecHitAndFraction(hit_and_energy.first, hit_and_energy.second); + } + } + } + template + void examine_edge(Edge e, const Graph& g) { + auto src = source(e, g); + auto vertex_property = get(vertex_name, g, src); + if (src == 0 or (vertex_property.simTrack == nullptr)) { + auto edge_property = get(edge_weight, g, e); + IfLogDebug(DEBUG, messageCategoryGraph_) + << "Considering CaloParticle: " << edge_property.simTrack->trackId(); + if (selector_(edge_property)) { + IfLogDebug(DEBUG, messageCategoryGraph_) + << "Adding CaloParticle: " << edge_property.simTrack->trackId(); + output_.pCaloParticles->emplace_back(*(edge_property.simTrack)); + caloParticles_.sc_start_.push_back(output_.pSimClusters->size()); + } + } + } + + template + void finish_edge(Edge e, const Graph& g) { + auto src = source(e, g); + auto vertex_property = get(vertex_name, g, src); + if (src == 0 or (vertex_property.simTrack == nullptr)) { + auto edge_property = get(edge_weight, g, e); + if (selector_(edge_property)) { + caloParticles_.sc_stop_.push_back(output_.pSimClusters->size()); + } + } + } -CaloTruthAccumulator::CaloTruthAccumulator( const edm::ParameterSet & config, edm::ProducerBase& mixMod, edm::ConsumesCollector& iC) : - messageCategory_("CaloTruthAccumulator"), - maximumPreviousBunchCrossing_( config.getParameter("maximumPreviousBunchCrossing") ), - maximumSubsequentBunchCrossing_( config.getParameter("maximumSubsequentBunchCrossing") ), - simTrackLabel_( config.getParameter("simTrackCollection") ), - simVertexLabel_( config.getParameter("simVertexCollection") ), - collectionTags_( ), - genParticleLabel_( config.getParameter("genParticleCollection") ), - hepMCproductLabel_( config.getParameter("HepMCProductLabel") ), - minEnergy_( config.getParameter("MinEnergy") ), - maxPseudoRapidity_( config.getParameter("MaxPseudoRapidity") ) -{ - barcodeLogicWarningAlready_ = false; + private: + CaloTruthAccumulator::OutputCollections& output_; + CaloTruthAccumulator::calo_particles& caloParticles_; + std::unordered_multimap& simHitBarcodeToIndex_; + std::unordered_map >& simTrackDetIdEnergyMap_; + Selector selector_; +}; +} +CaloTruthAccumulator::CaloTruthAccumulator(const edm::ParameterSet& config, + edm::ProducerBase& mixMod, + edm::ConsumesCollector& iC) + : messageCategory_("CaloTruthAccumulator"), + maximumPreviousBunchCrossing_( + config.getParameter("maximumPreviousBunchCrossing")), + maximumSubsequentBunchCrossing_( + config.getParameter("maximumSubsequentBunchCrossing")), + simTrackLabel_(config.getParameter("simTrackCollection")), + simVertexLabel_(config.getParameter("simVertexCollection")), + collectionTags_(), + genParticleLabel_(config.getParameter("genParticleCollection")), + hepMCproductLabel_(config.getParameter("HepMCProductLabel")), + minEnergy_(config.getParameter("MinEnergy")), + maxPseudoRapidity_(config.getParameter("MaxPseudoRapidity")) { mixMod.produces("MergedCaloTruth"); mixMod.produces("MergedCaloTruth"); - + iC.consumes >(simTrackLabel_); iC.consumes >(simVertexLabel_); iC.consumes >(genParticleLabel_); iC.consumes >(genParticleLabel_); iC.consumes >(hepMCproductLabel_); - + // Fill the collection tags - const edm::ParameterSet& simHitCollectionConfig=config.getParameterSet("simHitCollections"); - std::vector parameterNames=simHitCollectionConfig.getParameterNames(); - - for( const auto& parameterName : parameterNames ) - { - std::vector tags=simHitCollectionConfig.getParameter >(parameterName); - collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end()); - } - - for( const auto& collectionTag : collectionTags_ ) { + const edm::ParameterSet& simHitCollectionConfig = config.getParameterSet("simHitCollections"); + std::vector parameterNames = simHitCollectionConfig.getParameterNames(); + + for (auto const& parameterName : parameterNames) { + std::vector tags = + simHitCollectionConfig.getParameter >(parameterName); + collectionTags_.insert(collectionTags_.end(), tags.begin(), tags.end()); + } + + for (auto const& collectionTag : collectionTags_) { iC.consumes >(collectionTag); } } -void CaloTruthAccumulator::beginLuminosityBlock( edm::LuminosityBlock const& iLumiBlock, const edm::EventSetup& iSetup ) { +void CaloTruthAccumulator::beginLuminosityBlock(edm::LuminosityBlock const& iLumiBlock, + const edm::EventSetup& iSetup) { edm::ESHandle geom; iSetup.get().get(geom); const HGCalGeometry *eegeom, *fhgeom; - const HcalGeometry *bhgeom; + const HcalGeometry* bhgeom; - eegeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCEE)); - fhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Forward,HGCHEF)); - bhgeom = dynamic_cast(geom->getSubdetectorGeometry(DetId::Hcal,HcalEndcap)); + eegeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCEE)); + fhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF)); + bhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)); hgtopo_[0] = &(eegeom->topology()); hgtopo_[1] = &(fhgeom->topology()); - for( unsigned i = 0; i < 2; ++i ) { + for (unsigned i = 0; i < 2; ++i) { hgddd_[i] = &(hgtopo_[i]->dddConstants()); } - - hcddd_ = bhgeom->topology().dddConstants(); - caloStartZ = hgddd_[0]->waferZ(1,false)*10.0; // get the location of the first plane of silicon, put in mm + hcddd_ = bhgeom->topology().dddConstants(); } -void CaloTruthAccumulator::initializeEvent( edm::Event const& event, edm::EventSetup const& setup ) -{ - output_.pSimClusters.reset( new SimClusterCollection() ); - output_.pCaloParticles.reset( new CaloParticleCollection() ); +void CaloTruthAccumulator::initializeEvent(edm::Event const& event, + edm::EventSetup const& setup) { + output_.pSimClusters.reset(new SimClusterCollection()); + output_.pCaloParticles.reset(new CaloParticleCollection()); - m_detIdToCluster.clear(); m_detIdToTotalSimEnergy.clear(); } -/// create handle to edm::HepMCProduct here because event.getByLabel with edm::HepMCProduct only works for edm::Event -/// but not for PileUpEventPrincipal; PileUpEventPrincipal::getByLabel tries to call T::value_type and T::iterator -/// (where T is the type of the object one wants to get a handle to) which is only implemented for container-like objects -/// like std::vector but not for edm::HepMCProduct! - -void CaloTruthAccumulator::accumulate( edm::Event const& event, edm::EventSetup const& setup ) { - // Call the templated version that does the same for both signal and pileup events - - edm::Handle< edm::HepMCProduct > hepmc; +/** Create handle to edm::HepMCProduct here because event.getByLabel with + edm::HepMCProduct only works for edm::Event but not for + PileUpEventPrincipal; PileUpEventPrincipal::getByLabel tries to call + T::value_type and T::iterator (where T is the type of the object one wants + to get a handle to) which is only implemented for container-like objects + like std::vector but not for edm::HepMCProduct! +*/ +void CaloTruthAccumulator::accumulate(edm::Event const& event, + edm::EventSetup const& setup) { + edm::Handle hepmc; event.getByLabel(hepMCproductLabel_, hepmc); - + edm::LogInfo(messageCategory_) << " CaloTruthAccumulator::accumulate (signal)"; - accumulateEvent( event, setup, hepmc ); + accumulateEvent(event, setup, hepmc); } -void CaloTruthAccumulator::accumulate( PileUpEventPrincipal const& event, edm::EventSetup const& setup, edm::StreamID const& ) { - // If this bunch crossing is outside the user configured limit, don't do anything. - if( event.bunchCrossing()>=-static_cast(maximumPreviousBunchCrossing_) && event.bunchCrossing()<=static_cast(maximumSubsequentBunchCrossing_) ) - { - //edm::LogInfo(messageCategory_) << "Analysing pileup event for bunch crossing " << event.bunchCrossing(); - - //simply create empty handle as we do not have a HepMCProduct in PU anyway - edm::Handle< edm::HepMCProduct > hepmc; - edm::LogInfo(messageCategory_) << " CaloTruthAccumulator::accumulate (pileup) bunchCrossing=" << event.bunchCrossing(); - accumulateEvent( event, setup, hepmc ); - } - else edm::LogInfo(messageCategory_) << "Skipping pileup event for bunch crossing " << event.bunchCrossing(); +void CaloTruthAccumulator::accumulate(PileUpEventPrincipal const& event, + edm::EventSetup const& setup, edm::StreamID const&) { + if (event.bunchCrossing() >= -static_cast(maximumPreviousBunchCrossing_) && + event.bunchCrossing() <= static_cast(maximumSubsequentBunchCrossing_)) { + // simply create empty handle as we do not have a HepMCProduct in PU anyway + edm::Handle hepmc; + edm::LogInfo(messageCategory_) + << " CaloTruthAccumulator::accumulate (pileup) bunchCrossing=" + << event.bunchCrossing(); + accumulateEvent(event, setup, hepmc); + } else { + edm::LogInfo(messageCategory_) + << "Skipping pileup event for bunch crossing " << event.bunchCrossing(); + } } -void CaloTruthAccumulator::finalizeEvent( edm::Event& event, edm::EventSetup const& setup ) { - edm::LogInfo("CaloTruthAccumulator") << "Adding " << output_.pSimClusters->size() - << " SimParticles and " << output_.pCaloParticles->size() - << " CaloParticles to the event."; +void CaloTruthAccumulator::finalizeEvent(edm::Event& event, edm::EventSetup const& setup) { + edm::LogInfo(messageCategory_) << "Adding " << output_.pSimClusters->size() + << " SimParticles and " << output_.pCaloParticles->size() + << " CaloParticles to the event."; - // now we need to normalize the hits and energies into hits and fractions - // (since we have looped over all pileup events) + // We need to normalize the hits and energies into hits and fractions (since + // we have looped over all pileup events) - for( auto& sc : *(output_.pSimClusters) ) { + for (auto& sc : *(output_.pSimClusters)) { auto hitsAndEnergies = sc.hits_and_fractions(); sc.clearHitsAndFractions(); - for( auto& hAndE : hitsAndEnergies ) { + for (auto& hAndE : hitsAndEnergies) { const float totalenergy = m_detIdToTotalSimEnergy[hAndE.first]; float fraction = 0.; - if(totalenergy>0) fraction = hAndE.second/totalenergy; - else edm::LogWarning("CaloTruthAccumulator") << "TotalSimEnergy for hit " << hAndE.first << " is 0! The fraction for this hit cannot be computed."; - sc.addRecHitAndFraction(hAndE.first,fraction); + if (totalenergy > 0) + fraction = hAndE.second / totalenergy; + else + edm::LogWarning(messageCategory_) << "TotalSimEnergy for hit " << hAndE.first + << " is 0! The fraction for this hit cannot be computed."; + sc.addRecHitAndFraction(hAndE.first, fraction); } } - + // save the SimCluster orphan handle so we can fill the calo particles - auto scHandle = event.put( std::move(output_.pSimClusters), "MergedCaloTruth" ); - + auto scHandle = event.put(std::move(output_.pSimClusters), "MergedCaloTruth"); + // now fill the calo particles - for( unsigned i = 0; i < output_.pCaloParticles->size(); ++i ) { + for (unsigned i = 0; i < output_.pCaloParticles->size(); ++i) { auto& cp = (*output_.pCaloParticles)[i]; - for( unsigned j = m_caloParticles.sc_start_[i]; j < m_caloParticles.sc_stop_[i]; ++j ) { - edm::Ref ref(scHandle,j); + for (unsigned j = m_caloParticles.sc_start_[i]; j < m_caloParticles.sc_stop_[i]; ++j) { + edm::Ref ref(scHandle, j); cp.addSimCluster(ref); } - } + } - event.put( std::move(output_.pCaloParticles), "MergedCaloTruth" ); + event.put(std::move(output_.pCaloParticles), "MergedCaloTruth"); calo_particles().swap(m_caloParticles); - std::unordered_map().swap(m_detIdToTotalSimEnergy); - - std::unordered_map().swap(m_genParticleBarcodeToIndex); - std::unordered_map().swap(m_simTrackBarcodeToIndex); - std::unordered_map().swap(m_genBarcodeToSimTrackIndex); - std::unordered_map().swap(m_simVertexBarcodeToIndex); - - std::unordered_multimap().swap(m_detIdToCluster); - std::unordered_multimap().swap(m_simHitBarcodeToIndex); - std::unordered_multimap().swap(m_simVertexBarcodeToSimTrackBarcode); - std::unordered_map().swap(m_simTrackBarcodeToSimVertexParentBarcode); - std::unordered_multimap().swap(m_simTrackToSimVertex); - std::unordered_multimap().swap(m_simVertexToSimTrackParent); - std::vector().swap(m_simVertexBarcodes); - std::unordered_map().swap(m_detIdToTotalSimEnergy); + std::unordered_map().swap(m_detIdToTotalSimEnergy); + std::unordered_multimap().swap(m_simHitBarcodeToIndex); } -template -void CaloTruthAccumulator::accumulateEvent( const T& event, - const edm::EventSetup& setup, - const edm::Handle< edm::HepMCProduct >& hepMCproduct) { - // - // Get the collections - // - - edm::Handle< std::vector > hGenParticles; - edm::Handle< std::vector > hGenParticleIndices; - - event.getByLabel( simTrackLabel_, hSimTracks ); - event.getByLabel( simVertexLabel_, hSimVertices ); - - event.getByLabel( genParticleLabel_, hGenParticles ); - event.getByLabel( genParticleLabel_, hGenParticleIndices ); - - std::vector > simHitPointers; - fillSimHits( simHitPointers, event, setup ); - +template +void CaloTruthAccumulator::accumulateEvent( + const T& event, const edm::EventSetup& setup, + const edm::Handle& hepMCproduct) { + + edm::Handle > hGenParticles; + edm::Handle > hGenParticleIndices; + + event.getByLabel(simTrackLabel_, hSimTracks); + event.getByLabel(simVertexLabel_, hSimVertices); + + event.getByLabel(genParticleLabel_, hGenParticles); + event.getByLabel(genParticleLabel_, hGenParticleIndices); + + std::vector > simHitPointers; + std::unordered_map > simTrackDetIdEnergyMap; + fillSimHits(simHitPointers, simTrackDetIdEnergyMap, event, setup); + // Clear maps from previous event fill them for this one m_simHitBarcodeToIndex.clear(); - m_simTracksConsideredForSimClusters.clear(); - for (unsigned int i = 0 ; i < simHitPointers.size(); ++i) { - m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(),i); - } - m_genParticleBarcodeToIndex.clear(); - if( hGenParticles.isValid() && hGenParticleIndices.isValid() ) { - for (unsigned int i = 0 ; i < hGenParticles->size() ; ++i) { - m_genParticleBarcodeToIndex.emplace(hGenParticleIndices->at(i),i); - } - } - m_genBarcodeToSimTrackIndex.clear(); - m_simVertexBarcodeToSimTrackBarcode.clear(); - m_simTrackBarcodeToSimVertexParentBarcode.clear(); - m_simTrackBarcodeToIndex.clear(); - for (unsigned int i = 0 ; i < hSimTracks->size() ; i++) { - if( !hSimTracks->at(i).noGenpart() ) { - m_genBarcodeToSimTrackIndex.emplace(hSimTracks->at(i).genpartIndex(), i); - } - if( !hSimTracks->at(i).noVertex() ) { - m_simVertexBarcodeToSimTrackBarcode.emplace(hSimTracks->at(i).vertIndex(), hSimTracks->at(i).trackId()); - m_simTrackBarcodeToSimVertexParentBarcode.emplace(hSimTracks->at(i).trackId(), hSimTracks->at(i).vertIndex()); - } - m_simTrackBarcodeToIndex.emplace(hSimTracks->at(i).trackId(), i); - } - m_simVertexBarcodes.clear(); - m_simVertexBarcodeToIndex.clear(); - m_simTrackToSimVertex.clear(); - m_simVertexToSimTrackParent.clear(); - for (unsigned int i = 0 ; i < hSimVertices->size() ; i++) { - m_simVertexBarcodes.push_back(i); - m_simVertexBarcodeToIndex.emplace(hSimVertices->at(i).vertexId(), i); - if (!hSimVertices->at(i).noParent()) { - m_simTrackToSimVertex.emplace(hSimVertices->at(i).parentIndex(), i); - m_simVertexToSimTrackParent.emplace( hSimVertices->at(i).vertexId(), hSimVertices->at(i).parentIndex() ); - } - } - - std::vector tracksToBecomeClustersInitial; - std::vector descendantTracks; - SimClusterCollection simClustersForGenParts; - std::vector > hitInfoList; - std::vector > simClusterPrimitives; - std::unordered_multimap genPartsToSimClusters; - const auto& simTracks = *hSimTracks; - // loop over - for (unsigned int i = 0 ; i < simTracks.size() ; ++i) { - if ( simTracks[i].momentum().E() < minEnergy_ || std::abs(simTracks[i].momentum().Eta()) >= maxPseudoRapidity_ ) continue; - if ( simTracks[i].noGenpart() ) continue; - auto temp = CaloTruthAccumulator::descendantSimClusters( simTracks[i].trackId(),simHitPointers ); - if( !temp.empty() ) { - output_.pCaloParticles->emplace_back(simTracks[i]); - m_caloParticles.sc_start_.push_back(output_.pSimClusters->size()); - auto mbegin = std::make_move_iterator(temp.begin()); - auto mend = std::make_move_iterator(temp.end()); - output_.pSimClusters->insert(output_.pSimClusters->end(), mbegin, mend); - m_caloParticles.sc_stop_.push_back(output_.pSimClusters->size()); - } - } -} - -std::vector CaloTruthAccumulator::descendantTrackBarcodes( Barcode_t barcode ) { - std::vector result; - if (m_simTrackToSimVertex.count(barcode)) { - auto vertex_range = m_simTrackToSimVertex.equal_range(barcode); - for ( auto vertex_iter = vertex_range.first ; vertex_iter != vertex_range.second ; vertex_iter++ ) { - Index_t decayVertexIndex = vertex_iter->second; - Barcode_t decayVertexBarcode = m_simVertexBarcodes[decayVertexIndex]; - auto track_range = m_simVertexBarcodeToSimTrackBarcode.equal_range( decayVertexBarcode ); - for ( auto track_iter = track_range.first ; track_iter != track_range.second ; track_iter++ ) { - result.push_back( track_iter->second ); - std::vector daughter_result = CaloTruthAccumulator::descendantTrackBarcodes( track_iter->second ); - result.insert(result.end(),daughter_result.begin(),daughter_result.end()); - } - } + for (unsigned int i = 0; i < simHitPointers.size(); ++i) { + m_simHitBarcodeToIndex.emplace(simHitPointers[i].second->geantTrackId(), i); } - return result; -} -SimClusterCollection CaloTruthAccumulator::descendantSimClusters( Barcode_t barcode, const std::vector >& hits ) { - SimClusterCollection result; - const auto& simTracks = *hSimTracks; - if ( CaloTruthAccumulator::consideredBarcode( barcode ) ) { - LogDebug("CaloParticles") << "SCZ DEBUG Ignoring descendantSimClusters call because this particle is already marked used: " << barcode << std::endl; - //return result; + auto const& tracks = *hSimTracks; + auto const& vertices = *hSimVertices; + std::unordered_map trackid_to_track_index; + DecayChain decay; + int idx = 0; + + IfLogDebug(DEBUG, messageCategory_) << " TRACKS" << std::endl; + for (auto const& t : tracks) { + IfLogDebug(DEBUG, messageCategory_) + << " " << idx << "\t" << t.trackId() << "\t" << t << std::endl; + trackid_to_track_index[t.trackId()] = idx; + idx++; } - std::unique_ptr hit_info = CaloTruthAccumulator::attachedSimHitInfo(barcode,hits, true, false, false); - //std::unique_ptr inclusive_hit_info = std::move(CaloTruthAccumulator::allAttachedSimHitInfo(barcode,hits, false) ); - - const auto& simTrack = simTracks[m_simTrackBarcodeToIndex[barcode]]; - Barcode_t vtxBarcode = m_simTrackBarcodeToSimVertexParentBarcode[barcode]; - const auto& vtx = hSimVertices->at(m_simVertexBarcodeToIndex[vtxBarcode]); - const bool isInCalo = (std::abs(vtx.position().z()) > caloStartZ - 30.0); // add a buffer region in front of the calo face - - if (!hit_info->empty()) { - // define the sim cluster starting from the earliest particle that has hits in the calorimeter - // grab everything that descends from it - std::unique_ptr marked_hit_info; - - - if( isInCalo ) { - marked_hit_info = CaloTruthAccumulator::allAttachedSimHitInfo(barcode,hits,true) ; - } else { - marked_hit_info = CaloTruthAccumulator::attachedSimHitInfo(barcode,hits,true,false,true) ; - } - - if( !marked_hit_info->empty() ) { - result.emplace_back(simTrack); - auto& simcluster = result.back(); - - std::unordered_map acc_energy; - - for( const auto& hit_and_energy : *marked_hit_info ) { - const uint32_t id = hit_and_energy.first.rawId(); - if( acc_energy.count(id) ) acc_energy[id] += hit_and_energy.second; - else acc_energy[id] = hit_and_energy.second; - } - - for( const auto& hit_and_energy : acc_energy ) { - simcluster.addRecHitAndFraction(hit_and_energy.first,hit_and_energy.second); - } - } - } - - if ( m_simTrackToSimVertex.count(barcode) ) { - auto vertex_range = m_simTrackToSimVertex.equal_range(barcode); - for ( auto vertex_iter = vertex_range.first ; vertex_iter != vertex_range.second ; vertex_iter++ ) { - Index_t decayVertexIndex = vertex_iter->second; - Barcode_t decayVertexBarcode = m_simVertexBarcodes[decayVertexIndex]; - auto track_range = m_simVertexBarcodeToSimTrackBarcode.equal_range( decayVertexBarcode ); - for ( auto track_iter = track_range.first ; track_iter != track_range.second ; track_iter++ ) { - - auto daughter_result = CaloTruthAccumulator::descendantSimClusters(track_iter->second,hits); - result.insert(result.end(),daughter_result.begin(),daughter_result.end()); + /** + Build the main decay graph and assign the SimTrack to each edge. The graph + built here will only contain the particles that have a decay vertex + associated to them. In order to recover also the particles that will not + decay, we need to keep track of the SimTrack used here and add, a-posteriori, + the ones not used, associating a ghost vertex (starting from the highest + simulated vertex number), in order to build the edge and identify them + immediately as stable (i.e. not decayed). + + To take into account the multi-bremsstrahlung effects in which a single + particle is emitting photons in different vertices **keeping the same + track index**, we also collapsed those vertices into 1 unique vertex. The + other approach of fully representing the decay chain keeping the same + track index would have the problem of over-counting the contributions of + that track, especially in terms of hits. + + The 2 auxiliary vectors are structured as follow: + + 1. used_sim_tracks is a vector that has the same size as the overall + number of simulated tracks. The associated integer is the vertexId of + the **decaying vertex for that track**. + 2. collapsed_vertices is a vector that has the same size as the overall + number of simulated vertices. The vector's index is the vertexId + itself, the associated value is the vertexId of the vertex on which + this should collapse. + */ + idx = 0; + std::vector used_sim_tracks(tracks.size(), 0); + std::vector collapsed_vertices(vertices.size(), 0); + IfLogDebug(DEBUG, messageCategory_) << " VERTICES" << std::endl; + for (auto const& v : vertices) { + IfLogDebug(DEBUG, messageCategory_) << " " << idx++ << "\t" << v << std::endl; + if (v.parentIndex() != -1) { + auto trk_idx = trackid_to_track_index[v.parentIndex()]; + auto origin_vtx = tracks[trk_idx].vertIndex(); + if (used_sim_tracks[trk_idx]) { + // collapse the vertex into the original first vertex we saw associated + // to this track. Omit adding the edge in order to avoid double + // counting of the very same particles and its associated hits. + collapsed_vertices[v.vertexId()] = used_sim_tracks[trk_idx]; + continue; } + // Perform the actual vertex collapsing, if needed. + if (collapsed_vertices[origin_vtx]) origin_vtx = collapsed_vertices[origin_vtx]; + add_edge(origin_vtx, v.vertexId(), + EdgeProperty(&tracks[trk_idx], simTrackDetIdEnergyMap[v.parentIndex()].size(), 0), + decay); + used_sim_tracks[trk_idx] = v.vertexId(); } } - - return result; -} - -std::unique_ptr CaloTruthAccumulator::attachedSimHitInfo( Barcode_t barcode , const std::vector >& hits, - bool includeOwn , bool includeOther, bool markUsed ) { - const auto& simTracks = *hSimTracks; - std::unique_ptr result(new SimHitInfoPerSimTrack_t); - - const auto& simTrack = simTracks[m_simTrackBarcodeToIndex[barcode]]; - - if ( markUsed ) { - if ( CaloTruthAccumulator::consideredBarcode( barcode ) ) { - return result; + // Build the motherParticle property to each vertex + auto const& vertexMothersProp = get(vertex_name, decay); + // Now recover the particles that did not decay. Append them with an index + // bigger than the size of the generated vertices. + int offset = vertices.size(); + for (size_t i = 0; i < tracks.size(); ++i) { + if (!used_sim_tracks[i]) { + auto origin_vtx = tracks[i].vertIndex(); + // Perform the actual vertex collapsing, if needed. + if (collapsed_vertices[origin_vtx]) origin_vtx = collapsed_vertices[origin_vtx]; + add_edge(origin_vtx, offset, + EdgeProperty(&tracks[i], simTrackDetIdEnergyMap[tracks[i].trackId()].size(), 0), + decay); + // The properties for "fake" vertices associated to stable particles have + // to be set inside this loop, since they do not belong to the vertices + // collection and would be skipped by that loop (coming next) + put(vertexMothersProp, offset, VertexProperty(&tracks[i], 0)); + offset++; } - CaloTruthAccumulator::setConsideredBarcode( barcode ); } - if (includeOwn) { - auto range = m_simHitBarcodeToIndex.equal_range( barcode ); - unsigned n = 0; - for ( auto iter = range.first ; iter != range.second ; iter++ ) { - const auto& the_hit = hits[iter->second]; - result->emplace_back(the_hit.first,the_hit.second->energy()); - ++n; - } - } - - // need to sim to the next sim track if we explicitly ask or - // if we are in the calorimeter next (no interaction) - // or if this is a continuation of the same particle - if (m_simTrackToSimVertex.count(barcode)) { - auto vertex_range = m_simTrackToSimVertex.equal_range(barcode); - for ( auto vertex_iter = vertex_range.first ; vertex_iter != vertex_range.second ; vertex_iter++ ) { - Index_t decayVertexIndex = vertex_iter->second; - const auto& nextVtx = (*hSimVertices)[decayVertexIndex]; - const bool nextInCalo = (std::abs(nextVtx.position().z()) > caloStartZ*0.1 - 20.0); // add a buffer region in front of the calo face - - Barcode_t decayVertexBarcode = m_simVertexBarcodes[decayVertexIndex]; - auto track_range = m_simVertexBarcodeToSimTrackBarcode.equal_range( decayVertexBarcode ); - for ( auto track_iter = track_range.first ; track_iter != track_range.second ; track_iter++ ) { - if( !barcodeLogicWarningAlready_ && track_iter->second < barcode ) { - barcodeLogicWarningAlready_ = true; - edm::LogWarning(messageCategory_) << " Daughter particle has a lower barcode than parent. This may screw up the logic!" << std::endl; - } - const auto& daughter = simTracks[m_simTrackBarcodeToIndex[track_iter->second]]; - - if( includeOther || nextInCalo ) { - std::unique_ptr daughter_result = CaloTruthAccumulator::allAttachedSimHitInfo(track_iter->second,hits,markUsed); - result->insert(result->end(),daughter_result->begin(),daughter_result->end()); - } else if ( daughter.type() == simTrack.type() ) { - std::unique_ptr daughter_result = CaloTruthAccumulator::attachedSimHitInfo(track_iter->second,hits,includeOwn, includeOther, markUsed); - result->insert(result->end(),daughter_result->begin(),daughter_result->end()); - } - } - } + for (auto const& v : vertices) { + if (v.parentIndex() != -1) { + // Skip collapsed_vertices + if (collapsed_vertices[v.vertexId()]) continue; + put(vertexMothersProp, v.vertexId(), + VertexProperty(&tracks[trackid_to_track_index[v.parentIndex()]], 0)); } - return result; -} - -std::unique_ptr -CaloTruthAccumulator::descendantOnlySimHitInfo( Barcode_t barcode, - const std::vector >& hits, - bool markUsed) { - return CaloTruthAccumulator::attachedSimHitInfo(barcode,hits,false,true,markUsed); -} - -std::unique_ptr -CaloTruthAccumulator::allAttachedSimHitInfo( Barcode_t barcode, - const std::vector >& hits, - bool markUsed ) { - return CaloTruthAccumulator::attachedSimHitInfo(barcode,hits,true,true,markUsed); + } + SimHitsAccumulator_dfs_visitor vis; + depth_first_search(decay, visitor(vis)); + CaloParticle_dfs_visitor caloParticleCreator( + output_, m_caloParticles, m_simHitBarcodeToIndex, simTrackDetIdEnergyMap, + [&](EdgeProperty& edge_property) -> bool { + // Apply selection on SimTracks in order to promote them to be CaloParticles. + // The function returns TRUE if the particle satisfies the selection, FALSE otherwise. + // Therefore the correct logic to select the particle is to ask for TRUE as return value. + return (edge_property.cumulative_simHits != 0 and !edge_property.simTrack->noGenpart() and + edge_property.simTrack->momentum().E() > minEnergy_ and + std::abs(edge_property.simTrack->momentum().Eta()) < maxPseudoRapidity_); + }); + depth_first_search(decay, visitor(caloParticleCreator)); + +#if DEBUG + boost::write_graphviz(std::cout, decay, make_label_writer(make_transform_value_property_map( + &graphviz_vertex, get(vertex_name, decay))), + make_label_writer(make_transform_value_property_map( + &graphviz_edge, get(edge_weight, decay)))); +#endif } -template void CaloTruthAccumulator::fillSimHits( std::vector >& returnValue, const T& event, const edm::EventSetup& setup ) { - // loop over the collections - for( const auto& collectionTag : collectionTags_ ) { - edm::Handle< std::vector > hSimHits; - const bool isHcal = ( collectionTag.instance().find("HcalHits") != std::string::npos ); - event.getByLabel( collectionTag, hSimHits ); - for( const auto& simHit : *hSimHits ) { +template +void CaloTruthAccumulator::fillSimHits( + std::vector >& returnValue, + std::unordered_map >& simTrackDetIdEnergyMap, const T& event, + const edm::EventSetup& setup) { + for (auto const& collectionTag : collectionTags_) { + edm::Handle > hSimHits; + const bool isHcal = (collectionTag.instance().find("HcalHits") != std::string::npos); + event.getByLabel(collectionTag, hSimHits); + for (auto const& simHit : *hSimHits) { DetId id(0); const uint32_t simId = simHit.id(); - if( isHcal ) { + if (isHcal) { HcalDetId hid = HcalHitRelabeller::relabel(simId, hcddd_); - if(hid.subdet()==HcalEndcap) id = hid; + if (hid.subdet() == HcalEndcap) id = hid; } else { - int subdet, layer, cell, sec, subsec, zp; - HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell); - const HGCalDDDConstants* ddd = hgddd_[subdet-3]; - std::pair recoLayerCell = ddd->simToReco(cell,layer,sec, - hgtopo_[subdet-3]->detectorType()); - cell = recoLayerCell.first; - layer = recoLayerCell.second; - // skip simhits with bad barcodes or non-existant layers - if( layer == -1 || simHit.geantTrackId() == 0 ) continue; - id = HGCalDetId((ForwardSubdetector)subdet,zp,layer,subsec,sec,cell); + int subdet, layer, cell, sec, subsec, zp; + HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell); + const HGCalDDDConstants* ddd = hgddd_[subdet - 3]; + std::pair recoLayerCell = + ddd->simToReco(cell, layer, sec, hgtopo_[subdet - 3]->detectorType()); + cell = recoLayerCell.first; + layer = recoLayerCell.second; + // skip simhits with bad barcodes or non-existant layers + if (layer == -1 || simHit.geantTrackId() == 0) continue; + id = HGCalDetId((ForwardSubdetector)subdet, zp, layer, subsec, sec, cell); } - if( DetId(0) == id ) continue; - + if (DetId(0) == id) continue; + uint32_t detId = id.rawId(); returnValue.emplace_back(id, &simHit); - - if( m_detIdToTotalSimEnergy.count(detId) ) m_detIdToTotalSimEnergy[detId] += simHit.energy(); - else m_detIdToTotalSimEnergy[detId] = simHit.energy(); + simTrackDetIdEnergyMap[simHit.geantTrackId()][id.rawId()] += simHit.energy(); + + m_detIdToTotalSimEnergy[detId] += simHit.energy(); } - } // end of loop over InputTags + } // end of loop over InputTags } // Register with the framework -DEFINE_DIGI_ACCUMULATOR (CaloTruthAccumulator); +DEFINE_DIGI_ACCUMULATOR(CaloTruthAccumulator); diff --git a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.h b/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.h deleted file mode 100644 index 300f809cdd1c3..0000000000000 --- a/SimGeneral/CaloAnalysis/plugins/CaloTruthAccumulator.h +++ /dev/null @@ -1,174 +0,0 @@ -#ifndef CaloAnalysis_CaloTruthAccumulator_h -#define CaloAnalysis_CaloTruthAccumulator_h - -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" -#include // required for std::auto_ptr -#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" -#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" - -#include -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Utilities/interface/InputTag.h" - -typedef unsigned Index_t; -typedef int Barcode_t; -typedef std::pair IndexPair_t; -typedef std::pair SimHitInfo_t; -typedef std::pair BarcodeIndexPair_t; -typedef std::pair BarcodePair_t; -typedef std::pair SimHitInfoPerRecoDetId_t; -typedef std::vector SimHitInfoPerSimTrack_t; - - -// typedef uint32_t RecoDetId_t; - -// Forward declarations -namespace edm { - class ParameterSet; - class ConsumesCollector; - class ProducerBase; - class Event; - class EventSetup; - class StreamID; -} -class PileUpEventPrincipal; -class PCaloHit; -class SimTrack; -class SimVertex; - -class CaloTruthAccumulator : public DigiAccumulatorMixMod { - public: - explicit CaloTruthAccumulator( const edm::ParameterSet& config, edm::ProducerBase& mixMod, edm::ConsumesCollector& iC); - private: - void initializeEvent( const edm::Event& event, const edm::EventSetup& setup ) override; - void accumulate( const edm::Event& event, const edm::EventSetup& setup ) override; - void accumulate( const PileUpEventPrincipal& event, const edm::EventSetup& setup, edm::StreamID const& ) override; - void finalizeEvent( edm::Event& event, const edm::EventSetup& setup ) override; - void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) override; - - /** @brief Both forms of accumulate() delegate to this templated method. */ - template void accumulateEvent( const T& event, const edm::EventSetup& setup, const edm::Handle< edm::HepMCProduct >& hepMCproduct ); - - /** @brief Fills the supplied vector with pointers to the SimHits, checking for bad modules if required */ - template void fillSimHits( std::vector > & returnValue, const T& event, const edm::EventSetup& setup ); - - std::vector descendantTrackBarcodes( Barcode_t barcode ); - std::unique_ptr attachedSimHitInfo( Barcode_t st, const std::vector > & hits, - bool includeOwn = true, bool includeOther = false, bool markUsed = false); - std::unique_ptr descendantOnlySimHitInfo( Barcode_t st, const std::vector > & hits, bool markUsed = false); - std::unique_ptr allAttachedSimHitInfo( Barcode_t st, const std::vector > & hits, bool markUsed = false); - - SimClusterCollection descendantSimClusters( Barcode_t barcode, const std::vector > & hits ); - std::set m_simTracksConsideredForSimClusters; - void setConsideredBarcode( Barcode_t barcode ) { m_simTracksConsideredForSimClusters.insert( barcode ); } - bool consideredBarcode( Barcode_t barcode ) { - // return (std::find(m_simTracksConsideredForSimClusters.begin(), m_simTracksConsideredForSimClusters.end(), barcode) != m_simTracksConsideredForSimClusters.end()); - return m_simTracksConsideredForSimClusters.count( barcode ); - } - - const std::string messageCategory_; ///< The message category used to send messages to MessageLogger - - struct calo_particles { - std::vector sc_start_; - std::vector sc_stop_; - - void swap(calo_particles& oth) { - sc_start_.swap(oth.sc_start_); - sc_stop_.swap(oth.sc_stop_); - } - - void clear() { - sc_start_.clear(); - sc_stop_.clear(); - } - }; - - calo_particles m_caloParticles; - double caloStartZ; - - std::unordered_map m_detIdToTotalSimEnergy; // keep track of cell normalizations - std::unordered_map m_genParticleBarcodeToIndex; - std::unordered_map m_simTrackBarcodeToIndex; - std::unordered_map m_genBarcodeToSimTrackIndex; - std::unordered_map m_simVertexBarcodeToIndex; - std::unordered_multimap m_detIdToCluster; - std::unordered_multimap m_simHitBarcodeToIndex; - std::unordered_multimap m_simVertexBarcodeToSimTrackBarcode; - std::unordered_map m_simTrackBarcodeToSimVertexParentBarcode; - std::unordered_multimap m_simTrackToSimVertex; - std::unordered_multimap m_simVertexToSimTrackParent; - // std::unordered_multimap m_recoDetIdToSimHits; - - std::vector m_simVertexBarcodes; - - // const double volumeRadius_; - // const double volumeZ_; - /// maximum distance for HepMC::GenVertex to be added to SimVertex - // const double vertexDistanceCut_; - // const bool ignoreTracksOutsideVolume_; - - /** The maximum bunch crossing BEFORE the signal crossing to create TrackinParticles for. Use positive values. If set to zero no - * previous bunches are added and only in-time, signal and after bunches (defined by maximumSubsequentBunchCrossing_) are used.*/ - const unsigned int maximumPreviousBunchCrossing_; - /** The maximum bunch crossing AFTER the signal crossing to create TrackinParticles for. E.g. if set to zero only - * uses the signal and in time pileup (and previous bunches defined by the maximumPreviousBunchCrossing_ parameter). */ - const unsigned int maximumSubsequentBunchCrossing_; - /// If bremsstrahlung merging, whether to also add the unmerged collection to the event or not. - // const bool createUnmergedCollection_; - // const bool createMergedCollection_; - /// Whether or not to create a separate collection for just the initial interaction vertices - // const bool createInitialVertexCollection_; - /// Whether or not to add the full parentage of any TrackingParticle that is inserted in the collection. - // const bool addAncestors_; - - const edm::InputTag simTrackLabel_; - const edm::InputTag simVertexLabel_; - edm::Handle > hSimTracks; - edm::Handle > hSimVertices; - - std::vector collectionTags_; - edm::InputTag genParticleLabel_; - /// Needed to add HepMC::GenVertex to SimVertex - edm::InputTag hepMCproductLabel_; - - const double minEnergy_, maxPseudoRapidity_; - - bool selectorFlag_; - /// Uses the same config as selector_, but can be used to drop out early since selector_ requires the TrackingParticle to be created first. - bool chargedOnly_; - /// Uses the same config as selector_, but can be used to drop out early since selector_ requires the TrackingParticle to be created first. - bool signalOnly_; - - bool barcodeLogicWarningAlready_; - - /** @brief When counting hits, allows hits in different detectors to have a different process type. - * - * Fast sim PCaloHits seem to have a peculiarity where the process type (as reported by PCaloHit::processType()) is - * different for the tracker than the muons. When counting how many hits there are, the code usually only counts - * the number of hits that have the same process type as the first hit. Setting this to true will also count hits - * that have the same process type as the first hit in the second detector.
- */ - // bool allowDifferentProcessTypeForDifferentDetectors_; - public: - // These always go hand in hand, and I need to pass them around in the internal - // functions, so I might as well package them up in a struct. - struct OutputCollections - { - std::unique_ptr pSimClusters; - std::unique_ptr pCaloParticles; - // std::auto_ptr pTrackingVertices; - // TrackingParticleRefProd refTrackingParticles; - // TrackingVertexRefProd refTrackingVertexes; - }; - private: - const HGCalTopology* hgtopo_[2]; - const HGCalDDDConstants* hgddd_[2]; - const HcalDDDRecConstants* hcddd_; - OutputCollections output_; -}; - -#endif // end of "#ifndef CaloAnalysis_CaloTruthAccumulator_h" diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.cc b/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.cc deleted file mode 100644 index b306267c774e0..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.cc +++ /dev/null @@ -1,100 +0,0 @@ -// File: DataMixingEcalDigiWorkerProd.cc -// Description: see DataMixingEcalDigiWorkerProd.h -// Author: Mike Hildreth, University of Notre Dame -// -//-------------------------------------------- - -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/EDMException.h" -#include "DataMixingEcalDigiWorkerProd.h" - - -using namespace std; -namespace edm { - // Constructor - DataMixingEcalDigiWorkerProd::DataMixingEcalDigiWorkerProd(const edm::ParameterSet& ps, edm::ConsumesCollector& iC) : - EBPileInputTag_(ps.getParameter("EBPileInputTag")), - EEPileInputTag_(ps.getParameter("EEPileInputTag")), - ESPileInputTag_(ps.getParameter("ESPileInputTag")), - m_EBs25notCont(ps.getParameter("EBs25notContainment") ) , - m_EEs25notCont(ps.getParameter("EEs25notContainment") ) , - m_peToABarrel(ps.getParameter("photoelectronsToAnalogBarrel") ) , - m_peToAEndcap(ps.getParameter("photoelectronsToAnalogEndcap") ) , - label_(ps.getParameter("Label")) - { - - theEBSignalGenerator = EBSignalGenerator(EBPileInputTag_,tok_eb_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap); - theEESignalGenerator = EESignalGenerator(EEPileInputTag_,tok_ee_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap); - theESSignalGenerator = ESSignalGenerator(ESPileInputTag_,tok_es_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap); - - // get the subdetector names - // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do... - - // declare the products to produce - - // Ecal - // Signal inputs now handled by EcalDigitizer - gets pSimHits directly - - EBDigiCollectionDM_ = ps.getParameter("EBDigiCollectionDM"); - EEDigiCollectionDM_ = ps.getParameter("EEDigiCollectionDM"); - ESDigiCollectionDM_ = ps.getParameter("ESDigiCollectionDM"); - - // initialize EcalDigitizer here... - - myEcalDigitizer_ = new EcalDigiProducer( ps , iC); - myEcalDigitizer_->setEBNoiseSignalGenerator( & theEBSignalGenerator ); - myEcalDigitizer_->setEENoiseSignalGenerator( & theEESignalGenerator ); - myEcalDigitizer_->setESNoiseSignalGenerator( & theESSignalGenerator ); - - } - - // Virtual destructor needed. - DataMixingEcalDigiWorkerProd::~DataMixingEcalDigiWorkerProd() { - delete myEcalDigitizer_; - } - - void DataMixingEcalDigiWorkerProd::beginRun(const edm::EventSetup& ES) { - } - - void DataMixingEcalDigiWorkerProd::initializeEvent(const edm::Event &e, const edm::EventSetup& ES) { - myEcalDigitizer_->initializeEvent(e, ES); - } - - void DataMixingEcalDigiWorkerProd::addEcalSignals(const edm::Event &e,const edm::EventSetup& ES) { - - myEcalDigitizer_->accumulate(e, ES); // puts SimHits into Ecal digitizer - - } // end of addEcalSignals - - void DataMixingEcalDigiWorkerProd::addEcalPileups(const int bcr, const EventPrincipal *ep, unsigned int eventNr,const edm::EventSetup& ES, - edm::ModuleCallingContext const* mcc) { - - LogDebug("DataMixingEcalDigiWorkerProd") <<"\n===============> adding pileups from event "<id()<<" for bunchcrossing "<finalizeEvent( e, ES ); - - } - - void DataMixingEcalDigiWorkerProd::beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) { - myEcalDigitizer_->beginLuminosityBlock(lumi,setup); - } - - -} //edm - diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.h b/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.h deleted file mode 100644 index fdfaeaacb98e4..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef SimDataMixingEcalDigiWorkerProd_h -#define SimDataMixingEcalDigiWorkerProd_h - -/** \class DataMixingEcalDigiWorkerProd - * - * DataMixingModule is the EDProducer subclass - * that overlays rawdata events on top of MC, - * using real data for pileup simulation - * This class takes care of the Ecal information at Digi level - * - * \author Mike Hildreth, University of Notre Dame - * - * \version 1st Version June 2008 - * - ************************************************************/ - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventPrincipal.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "CalibFormats/CaloObjects/interface/CaloSamples.h" -#include "DataFormats/Provenance/interface/ProductID.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" -#include "DataFormats/EcalDigi/interface/EBDataFrame.h" -#include "DataFormats/EcalDigi/interface/EEDataFrame.h" -#include "DataFormats/EcalDigi/interface/ESDataFrame.h" -#include "SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h" -#include "SimCalorimetry/EcalSimAlgos/interface/EcalSignalGenerator.h" -#include "SimGeneral/DataMixingModule/plugins/EcalNoiseStorage.h" - -#include -#include -#include - - -namespace edm -{ - class ConsumesCollector; - class ModuleCallingContext; - - class DataMixingEcalDigiWorkerProd - { - public: - - /** standard constructor*/ - explicit DataMixingEcalDigiWorkerProd(const edm::ParameterSet& ps, edm::ConsumesCollector& iC); - - /**Default destructor*/ - virtual ~DataMixingEcalDigiWorkerProd(); - - void putEcal(edm::Event &e,const edm::EventSetup& ES); - void addEcalSignals(const edm::Event &e,const edm::EventSetup& ES); - void addEcalPileups(const int bcr, const edm::EventPrincipal*,unsigned int EventId, - const edm::EventSetup& ES, edm::ModuleCallingContext const*); - - // set tokens for data access - void setEBAccess( edm::EDGetTokenT tok) { tok_eb_ = tok; } - void setEEAccess( edm::EDGetTokenT tok) { tok_ee_ = tok; } - void setESAccess( edm::EDGetTokenT tok) { tok_es_ = tok; } - - void beginRun(const edm::EventSetup& ES); - void initializeEvent(const edm::Event &e, const edm::EventSetup& ES); - void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup); - - private: - // data specifiers - - // Ecal - // edm::InputTag EBdigiCollectionSig_; // secondary name given to collection of digis - // edm::InputTag EEdigiCollectionSig_ ; // secondary name given to collection of digis - //edm::InputTag ESdigiCollectionSig_ ; // secondary name given to collection of digis - //edm::InputTag ZDCdigiCollectionSig_ ; // secondary name given to collection of digis - edm::InputTag EBPileInputTag_; // InputTag for Pileup Digis collection - edm::InputTag EEPileInputTag_ ; // InputTag for Pileup Digis collection - edm::InputTag ESPileInputTag_ ; // InputTag for Pileup Digis collection - - std::string EBDigiCollectionDM_; // secondary name to be given to collection of digis - std::string EEDigiCollectionDM_ ; // secondary name to be given to collection of digis - std::string ESDigiCollectionDM_ ; // secondary name to be given to collection of digis - - edm::EDGetTokenT tok_eb_; - edm::EDGetTokenT tok_ee_; - edm::EDGetTokenT tok_es_; - - const double m_EBs25notCont; - const double m_EEs25notCont; - const double m_peToABarrel; - const double m_peToAEndcap; - - EcalDigiProducer* myEcalDigitizer_; - EBSignalGenerator theEBSignalGenerator; - EESignalGenerator theEESignalGenerator; - ESSignalGenerator theESSignalGenerator; - - std::string label_; - - }; -}//edm - -#endif // SimDataMixingEcalDigiWorkerProd_h diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc index 95d2c3de73832..07303b9b2dd2d 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.cc @@ -28,9 +28,6 @@ #include "DataMixingModule.h" #include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" -#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" - using namespace std; namespace edm @@ -50,12 +47,6 @@ namespace edm QIE11PileInputTag_(ps.getParameter("QIE11PileInputTag")), label_(ps.getParameter("Label")) { - - // prepare for data access in DataMixingEcalDigiWorkerProd - tok_eb_ = consumes(EBPileInputTag_); - tok_ee_ = consumes(EEPileInputTag_); - tok_es_ = consumes(ESPileInputTag_); - // prepare for data access in DataMixingHcalDigiWorkerProd tok_hbhe_ = consumes(HBHEPileInputTag_); tok_ho_ = consumes(HOPileInputTag_); @@ -77,10 +68,6 @@ namespace edm MergeHcalDigis_ = (ps.getParameter("HcalMergeType")) == "Digis"; if(MergeHcalDigis_) MergeHcalDigisProd_ = (ps.getParameter("HcalDigiMerge")=="FullProd"); - addMCDigiNoise_ = false; - - addMCDigiNoise_ = ps.getUntrackedParameter("addMCDigiNoise"); // for Sim on Sim mixing - // Put Fast Sim Sequences here for Simplification: Fewer options! @@ -98,14 +85,7 @@ namespace edm produces< ESDigiCollection >(ESDigiCollectionDM_); - if(addMCDigiNoise_ ) { - edm::ConsumesCollector iC(consumesCollector()); - EcalDigiWorkerProd_ = new DataMixingEcalDigiWorkerProd(ps, iC); - EcalDigiWorkerProd_->setEBAccess(tok_eb_); - EcalDigiWorkerProd_->setEEAccess(tok_ee_); - EcalDigiWorkerProd_->setESAccess(tok_es_); - } - else { EMDigiWorker_ = new DataMixingEMDigiWorker(ps, consumesCollector()); } + EMDigiWorker_ = new DataMixingEMDigiWorker(ps, consumesCollector()); } else { // merge RecHits EBRecHitCollectionDM_ = ps.getParameter("EBRecHitCollectionDM"); @@ -180,53 +160,35 @@ namespace edm MuonWorker_ = new DataMixingMuonWorker(ps, consumesCollector()); - if(MergeTrackerDigis_) { + // Si-Strips - // Si-Strips + useSiStripRawDigi_ = ps.exists("SiStripRawDigiSource")? + ps.getParameter("SiStripRawDigiSource")=="PILEUP" || + ps.getParameter("SiStripRawDigiSource")=="SIGNAL" : false; - useSiStripRawDigi_ = ps.exists("SiStripRawDigiSource")? - ps.getParameter("SiStripRawDigiSource")=="PILEUP" || - ps.getParameter("SiStripRawDigiSource")=="SIGNAL" : false; - - SiStripDigiCollectionDM_ = ps.getParameter("SiStripDigiCollectionDM"); - - if(useSiStripRawDigi_) { - - produces< edm::DetSetVector > (SiStripDigiCollectionDM_); - SiStripRawWorker_ = new DataMixingSiStripRawWorker(ps, consumesCollector()); - - } else { - - produces< edm::DetSetVector > (SiStripDigiCollectionDM_); - - if( addMCDigiNoise_ ) { - SiStripMCDigiWorker_ = new DataMixingSiStripMCDigiWorker(ps, consumesCollector()); - } - else { - SiStripWorker_ = new DataMixingSiStripWorker(ps, consumesCollector()); - } - } - - // Pixels - - PixelDigiCollectionDM_ = ps.getParameter("PixelDigiCollectionDM"); - - produces< edm::DetSetVector > (PixelDigiCollectionDM_); - - if( addMCDigiNoise_ ) { - SiPixelMCDigiWorker_ = new DataMixingSiPixelMCDigiWorker(ps, consumesCollector()); - } - else { - SiPixelWorker_ = new DataMixingSiPixelWorker(ps, consumesCollector()); - } + SiStripDigiCollectionDM_ = ps.getParameter("SiStripDigiCollectionDM"); - } - else{ - //Tracks: - edm::ConsumesCollector iC(consumesCollector()); - GeneralTrackWorker_ = DigiAccumulatorMixModFactory::get()->makeDigiAccumulator(ps.getParameterSet("tracker"), *this, iC).release(); + if(useSiStripRawDigi_) { + + produces< edm::DetSetVector > (SiStripDigiCollectionDM_); + SiStripRawWorker_ = new DataMixingSiStripRawWorker(ps, consumesCollector()); + + } else { + + produces< edm::DetSetVector > (SiStripDigiCollectionDM_); + + SiStripWorker_ = new DataMixingSiStripWorker(ps, consumesCollector()); } + // Pixels + + PixelDigiCollectionDM_ = ps.getParameter("PixelDigiCollectionDM"); + + produces< edm::DetSetVector > (PixelDigiCollectionDM_); + + SiPixelWorker_ = new DataMixingSiPixelWorker(ps, consumesCollector()); + + // Pileup Information: if doing pre-mixing, we have to save the pileup information from the Secondary stream MergePileup_ = ps.getParameter("MergePileupInfo"); @@ -244,21 +206,6 @@ namespace edm PUWorker_ = new DataMixingPileupCopy(ps, consumesCollector()); } - - // Validation - - produces< std::vector >(ps.getParameter("TrackingParticleCollectionDM")); - produces< std::vector >(ps.getParameter("TrackingParticleCollectionDM")); - - produces< edm::DetSetVector >(ps.getParameter("StripDigiSimLinkCollectionDM")); - produces< edm::DetSetVector >(ps.getParameter("PixelDigiSimLinkCollectionDM")); - produces< MuonDigiCollection >(ps.getParameter("DTDigiSimLinkDM")); - produces< edm::DetSetVector >(ps.getParameter("RPCDigiSimLinkDM")); - produces< edm::DetSetVector >(ps.getParameter("CSCStripDigiSimLinkDM")); - produces< edm::DetSetVector >(ps.getParameter("CSCWireDigiSimLinkDM")); - - TrackingParticleWorker_ = new DataMixingTrackingParticleWorker(ps, consumesCollector()); - } void DataMixingModule::getSubdetectorNames() { @@ -299,47 +246,21 @@ namespace edm void DataMixingModule::initializeEvent(const edm::Event &e, const edm::EventSetup& ES) { - - if( addMCDigiNoise_ ) { - if(MergeTrackerDigis_){ - SiStripMCDigiWorker_->initializeEvent( e, ES ); - SiPixelMCDigiWorker_->initializeEvent( e, ES ); - } - else{ - GeneralTrackWorker_->initializeEvent(e,ES); - } - EcalDigiWorkerProd_->initializeEvent( e, ES ); - } - if( addMCDigiNoise_ && MergeHcalDigisProd_) { - HcalDigiWorkerProd_->initializeEvent( e, ES ); - } - - TrackingParticleWorker_->initializeEvent( e, ES ); - } void DataMixingModule::beginRun(edm::Run const& run, const edm::EventSetup& ES) { BMixingModule::beginRun( run, ES); - if( addMCDigiNoise_ ) { - EcalDigiWorkerProd_->beginRun( ES ); - HcalDigiWorkerProd_->beginRun( run, ES ); - } } void DataMixingModule::endRun(edm::Run const& run, const edm::EventSetup& ES) { - //if( addMCDigiNoise_ ) { - // HcalDigiWorkerProd_->endRun( run, ES ); // FIXME not implemented - // EcalDigiWorkerProd_->endRun( ES ); // FIXME not implemented - //} BMixingModule::endRun( run, ES); } // Virtual destructor needed. DataMixingModule::~DataMixingModule() { if(MergeEMDigis_){ - if(addMCDigiNoise_ ) {delete EcalDigiWorkerProd_;} - else {delete EMDigiWorker_;} + delete EMDigiWorker_; } else {delete EMWorker_;} if(MergeHcalDigis_) { @@ -347,20 +268,11 @@ namespace edm else { delete HcalDigiWorker_; }} else {delete HcalWorker_;} if(MuonWorker_) delete MuonWorker_; - if(MergeTrackerDigis_){ - if(useSiStripRawDigi_) - delete SiStripRawWorker_; - else if(addMCDigiNoise_ ) delete SiStripMCDigiWorker_; - else delete SiStripWorker_; - if(addMCDigiNoise_ ) delete SiPixelMCDigiWorker_; - else delete SiPixelWorker_; - } - else{ - delete GeneralTrackWorker_; - } + if(useSiStripRawDigi_) + delete SiStripRawWorker_; + else delete SiStripWorker_; + delete SiPixelWorker_; if(MergePileup_) { delete PUWorker_;} - - delete TrackingParticleWorker_; } void DataMixingModule::addSignals(const edm::Event &e, const edm::EventSetup& ES) { @@ -370,8 +282,7 @@ namespace edm // Ecal if(MergeEMDigis_) { - if(addMCDigiNoise_ ){ EcalDigiWorkerProd_->addEcalSignals(e, ES);} - else {EMDigiWorker_->addEMSignals(e, ES); } + EMDigiWorker_->addEMSignals(e, ES); } else{ EMWorker_->addEMSignals(e);} @@ -389,23 +300,13 @@ namespace edm // Muon MuonWorker_->addMuonSignals(e); - if(MergeTrackerDigis_){ - // SiStrips - if(useSiStripRawDigi_) SiStripRawWorker_->addSiStripSignals(e); - else if(addMCDigiNoise_ ) SiStripMCDigiWorker_->addSiStripSignals(e); - else SiStripWorker_->addSiStripSignals(e); - - // SiPixels - if(addMCDigiNoise_ ) SiPixelMCDigiWorker_->addSiPixelSignals(e); - else SiPixelWorker_->addSiPixelSignals(e); - }else{ - //GeneralTrackWorker_->addGeneralTrackSignal(e); - GeneralTrackWorker_->accumulate(e,ES); - } - AddedPileup_ = false; - - TrackingParticleWorker_->addTrackingParticleSignals(e); + // SiStrips + if(useSiStripRawDigi_) SiStripRawWorker_->addSiStripSignals(e); + else SiStripWorker_->addSiStripSignals(e); + // SiPixels + SiPixelWorker_->addSiPixelSignals(e); + AddedPileup_ = false; } // end of addSignals @@ -439,8 +340,7 @@ namespace edm // Ecal if(MergeEMDigis_) { - if(addMCDigiNoise_ ) { EcalDigiWorkerProd_->addEcalPileups(bcr, &ep, eventNr, ES, &moduleCallingContext);} - else { EMDigiWorker_->addEMPileups(bcr, &ep, eventNr, ES, &moduleCallingContext);} + EMDigiWorker_->addEMPileups(bcr, &ep, eventNr, ES, &moduleCallingContext); } else {EMWorker_->addEMPileups(bcr, &ep, eventNr, &moduleCallingContext); } @@ -457,23 +357,13 @@ namespace edm // Muon MuonWorker_->addMuonPileups(bcr, &ep, eventNr, &moduleCallingContext); - if(MergeTrackerDigis_){ - // SiStrips - if(useSiStripRawDigi_) SiStripRawWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); - else if(addMCDigiNoise_ ) SiStripMCDigiWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); - else SiStripWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); - - // SiPixels - //whoops this should be for the MC worker ????? SiPixelWorker_->setPileupInfo(ps,bunchSpacing); - if(addMCDigiNoise_ ) SiPixelMCDigiWorker_->addSiPixelPileups(bcr, &ep, eventNr, &moduleCallingContext); - else SiPixelWorker_->addSiPixelPileups(bcr, &ep, eventNr, &moduleCallingContext); - }else{ - PileUpEventPrincipal pep(ep,&moduleCallingContext,bcr); - GeneralTrackWorker_->accumulate(pep, ES,ep.streamID()); - } - - TrackingParticleWorker_->addTrackingParticlePileups(bcr, &ep, eventNr, &moduleCallingContext); - + // SiStrips + if(useSiStripRawDigi_) SiStripRawWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); + else SiStripWorker_->addSiStripPileups(bcr, &ep, eventNr, &moduleCallingContext); + + // SiPixels + //whoops this should be for the MC worker ????? SiPixelWorker_->setPileupInfo(ps,bunchSpacing); + SiPixelWorker_->addSiPixelPileups(bcr, &ep, eventNr, &moduleCallingContext); } @@ -506,9 +396,6 @@ namespace edm NumPU_Events = 1; } - if(!MergeTrackerDigis_) - GeneralTrackWorker_->initializeBunchCrossing(e, ES, bunchCrossing); - source->readPileUp( e.id(), recordEventID, @@ -517,10 +404,6 @@ namespace edm NumPU_Events, e.streamID() ); - - if(!MergeTrackerDigis_) - GeneralTrackWorker_->finalizeBunchCrossing(e, ES, bunchCrossing); - } } @@ -543,8 +426,7 @@ namespace edm // Ecal if(MergeEMDigis_) { - if(addMCDigiNoise_ ) {EcalDigiWorkerProd_->putEcal(e,ES);} - else { EMDigiWorker_->putEM(e,ES);} + EMDigiWorker_->putEM(e,ES); } else {EMWorker_->putEM(e);} @@ -562,30 +444,19 @@ namespace edm // Muon MuonWorker_->putMuon(e); - if(MergeTrackerDigis_){ - // SiStrips - if(useSiStripRawDigi_) SiStripRawWorker_->putSiStrip(e); - else if(addMCDigiNoise_ ) SiStripMCDigiWorker_->putSiStrip(e, ES); - else SiStripWorker_->putSiStrip(e); - - // SiPixels - if(addMCDigiNoise_ ) SiPixelMCDigiWorker_->putSiPixel(e, ES, ps, bunchSpacing); - else SiPixelWorker_->putSiPixel(e); - }else{ - GeneralTrackWorker_->finalizeEvent(e,ES); - } - - TrackingParticleWorker_->putTrackingParticle(e); + // SiStrips + if(useSiStripRawDigi_) SiStripRawWorker_->putSiStrip(e); + else SiStripWorker_->putSiStrip(e); + // SiPixels + SiPixelWorker_->putSiPixel(e); } void DataMixingModule::beginLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { BMixingModule::beginLuminosityBlock(l1, c); - if(addMCDigiNoise_ && EcalDigiWorkerProd_) EcalDigiWorkerProd_->beginLuminosityBlock(l1,c); } void DataMixingModule::endLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { - // EcalDigiWorkerProd_->endLuminosityBlock(l1,c); // FIXME Not implemented. BMixingModule::endLuminosityBlock(l1, c); } diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h index 95393fe6a4b1e..46feeb074567a 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingModule.h +++ b/SimGeneral/DataMixingModule/plugins/DataMixingModule.h @@ -26,24 +26,18 @@ #include "SimGeneral/DataMixingModule/plugins/DataMixingEMWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingHcalWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingEMDigiWorker.h" -#include "SimGeneral/DataMixingModule/plugins/DataMixingEcalDigiWorkerProd.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingHcalDigiWorkerProd.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingMuonWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripWorker.h" -#include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingSiStripRawWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingSiPixelWorker.h" -#include "SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.h" -#include "SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.h" #include "SimGeneral/DataMixingModule/plugins/DataMixingPileupCopy.h" #include #include #include -class DigiAccumulatorMixMod; - namespace edm { class ModuleCallingContext; @@ -129,7 +123,6 @@ namespace edm { DataMixingEMWorker *EMWorker_ ; DataMixingEMDigiWorker *EMDigiWorker_ ; - DataMixingEcalDigiWorkerProd *EcalDigiWorkerProd_ ; bool MergeEMDigis_; // Hcal @@ -154,9 +147,6 @@ namespace edm { edm::EDGetTokenT tok_zdc_; edm::EDGetTokenT tok_qie10_; edm::EDGetTokenT tok_qie11_; - edm::EDGetTokenT tok_eb_; - edm::EDGetTokenT tok_ee_; - edm::EDGetTokenT tok_es_; bool MergeHcalDigis_; bool MergeHcalDigisProd_; @@ -171,25 +161,14 @@ namespace edm { // Si-Strips DataMixingSiStripWorker *SiStripWorker_ ; - DataMixingSiStripMCDigiWorker *SiStripMCDigiWorker_ ; DataMixingSiStripRawWorker *SiStripRawWorker_ ; bool useSiStripRawDigi_; - bool addMCDigiNoise_; std::string siStripRawDigiSource_; // Pixels - DataMixingSiPixelMCDigiWorker *SiPixelMCDigiWorker_ ; DataMixingSiPixelWorker *SiPixelWorker_ ; - // Tracks - - DigiAccumulatorMixMod * GeneralTrackWorker_; - - - // Validation - - DataMixingTrackingParticleWorker * TrackingParticleWorker_ ; virtual void getSubdetectorNames(); diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.h b/SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.h deleted file mode 100644 index 94971d8949f8d..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.h +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef SimDataMixingSiPixelMCDigiWorker_h -#define SimDataMixingSiPixelMCDigiWorker_h - -/** \class DataMixingSiPixelMCDigiWorker - * - * DataMixingModule is the EDProducer subclass - * that overlays rawdata events on top of MC, - * using real data for pileup simulation - * This class takes care of the Si Pixel information - * - * \author Mike Hildreth, University of Notre Dame - * - * \version 1st Version October 2007 - * - ************************************************************/ - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventPrincipal.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Provenance/interface/ProductID.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Utilities/interface/RandomNumberGenerator.h" - -//Data Formats -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/Common/interface/DetSet.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" -#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" - -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/CommonDetUnit/interface/GeomDet.h" -#include "Geometry/CommonDetUnit/interface/GeomDetType.h" -#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" -#include "CondFormats/DataRecord/interface/SiPixelDynamicInefficiencyRcd.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelDynamicInefficiency.h" - - -#include -#include -#include - - -namespace CLHEP { - class HepRandomEngine; -} - -namespace edm -{ - class ModuleCallingContext; - - class DataMixingSiPixelMCDigiWorker - { - public: - - DataMixingSiPixelMCDigiWorker(); - - /** standard constructor*/ - explicit DataMixingSiPixelMCDigiWorker(const edm::ParameterSet& ps, edm::ConsumesCollector && iC); - - /**Default destructor*/ - virtual ~DataMixingSiPixelMCDigiWorker(); - - virtual void initializeEvent(edm::Event const& e, edm::EventSetup const& c); // override? - - void putSiPixel(edm::Event &e, edm::EventSetup const& iSetup, std::vector &ps, int &bs) ; - void addSiPixelSignals(const edm::Event &e); - void addSiPixelPileups(const int bcr, const edm::EventPrincipal*,unsigned int EventId, ModuleCallingContext const*); - - void setPileupInfo(const std::vector &ps, const int &bs); //this sets pu_scale - - void init_DynIneffDB(const edm::EventSetup&, const unsigned int&); - - private: - - // - // PixelEfficiencies struct - // - /** - * Internal use only. - */ - struct PixelEfficiencies { - PixelEfficiencies(const edm::ParameterSet& conf, bool AddPixelInefficiency, int NumberOfBarrelLayers, int NumberOfEndcapDisks); - bool FromConfig; // If true read from Config, otherwise use Database - - double theInstLumiScaleFactor; - std::vector pu_scale; // in config: 0-3 BPix, 4-5 FPix (inner, outer) - std::vector > thePUEfficiency; // Instlumi dependent efficiency - double thePixelEfficiency[20]; // Single pixel effciency - double thePixelColEfficiency[20]; // Column effciency - double thePixelChipEfficiency[20]; // ROC efficiency - std::vector theLadderEfficiency_BPix[20]; // Ladder efficiency - std::vector theModuleEfficiency_BPix[20]; // Module efficiency - //std::vector thePUEfficiency[20]; // Instlumi dependent efficiency - double theInnerEfficiency_FPix[20]; // Fpix inner module efficiency - double theOuterEfficiency_FPix[20]; // Fpix outer module efficiency - unsigned int FPixIndex; // The Efficiency index for FPix Disks - // Read factors from DB and fill containers - std::map PixelGeomFactors; - std::map ColGeomFactors; - std::map ChipGeomFactors; - std::map iPU; - - void init_from_db(const edm::ESHandle&, const edm::ESHandle&); - bool matches(const DetId&, const DetId&, const std::vector&); - - }; - - // Needed by dynamic inefficiency - // 0-3 BPix, 4-5 FPix (inner, outer) - //double _pu_scale[20]; - - // data specifiers - - edm::InputTag pixeldigi_collectionSig_ ; // secondary name given to collection of SiPixel digis - edm::InputTag pixeldigi_collectionPile_ ; // secondary name given to collection of SiPixel digis - std::string PixelDigiCollectionDM_ ; // secondary name to be given to new SiPixel digis - - edm::EDGetTokenT > PixelDigiToken_ ; // Token to retrieve information - edm::EDGetTokenT > PixelDigiPToken_ ; // Token to retrieve information - - edm::ESHandle pDD; - - // Get Dynamic Inefficiency scale factors from DB - edm::ESHandle SiPixelDynamicInefficiency_; - - - // - // Internal typedefs - - typedef int Amplitude; - typedef std::map > signal_map_type; // from Digi.Skel. - typedef signal_map_type::iterator signal_map_iterator; // from Digi.Skel. - typedef signal_map_type::const_iterator signal_map_const_iterator; // from Digi.Skel. - typedef std::map signalMaps; - - // Contains the accumulated hit info. - signalMaps _signal; - - typedef std::multimap OneDetectorMap; // maps by pixel ID for later combination - can have duplicate pixels - typedef std::map SiGlobalIndex; // map to all data for each detector ID - - SiGlobalIndex SiHitStorage_; - - - // unsigned int eventId_; //=0 for signal, from 1-n for pileup events - - std::string label_; - const std::string geometryType_; - - //-- Allow for upgrades - const int NumberOfBarrelLayers; // Default = 3 - const int NumberOfEndcapDisks; // Default = 2 - - //const double theInstLumiScaleFactor; - //const double bunchScaleAt25; - - const bool AddPixelInefficiency; // bool to read in inefficiencies - - PixelEfficiencies pixelEff_; - - bool FirstCall_; - - }; -}//edm - -#endif // SimDataMixingSiPixelMCDigiWorker_h diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h b/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h deleted file mode 100644 index a4625302aa85f..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingSiStripMCDigiWorker.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef SimDataMixingSiStripMCDigiWorker_h -#define SimDataMixingSiStripMCDigiWorker_h - -/** \class DataMixingSiStripMCDigiWorker - * - * DataMixingModule is the EDProducer subclass - * that overlays rawdata events on top of MC, - * using real data for pileup simulation - * This class takes care of the SiStrip information - * - * \author Mike Hildreth, University of Notre Dame - * - * \version 1st Version October 2007 - * - ************************************************************/ - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventPrincipal.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/Provenance/interface/ProductID.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Utilities/interface/RandomNumberGenerator.h" - -//Data Formats -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/Common/interface/DetSet.h" -#include "DataFormats/SiStripDigi/interface/SiStripDigi.h" - -#include "CondFormats/SiStripObjects/interface/SiStripNoises.h" -#include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" -#include "CondFormats/SiStripObjects/interface/SiStripThreshold.h" -#include "CalibFormats/SiStripObjects/interface/SiStripGain.h" -#include "SimTracker/SiStripDigitizer/interface/SiTrivialDigitalConverter.h" -#include "SimTracker/SiStripDigitizer/interface/SiGaussianTailNoiseAdder.h" -#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h" - -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/CommonDetUnit/interface/GeomDet.h" -#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" -#include "Geometry/CommonTopologies/interface/StripTopology.h" -#include "Geometry/CommonDetUnit/interface/GeomDetType.h" - - -#include -#include -#include - -namespace edm -{ - class ModuleCallingContext; - class ConsumesCollector; - class DataMixingSiStripMCDigiWorker - { - public: - - DataMixingSiStripMCDigiWorker(); - - /** standard constructor*/ - explicit DataMixingSiStripMCDigiWorker(const edm::ParameterSet& ps, edm::ConsumesCollector && iC); - /**Default destructor*/ - virtual ~DataMixingSiStripMCDigiWorker(); - - void putSiStrip(edm::Event &e, edm::EventSetup const& iSetup) ; - void addSiStripSignals(const edm::Event &e); - void addSiStripPileups(const int bcr, const edm::EventPrincipal*,unsigned int EventId, - ModuleCallingContext const*); - - - virtual void initializeEvent(const edm::Event &e, edm::EventSetup const& iSetup); - - void DMinitializeDetUnit(StripGeomDetUnit const * det, const edm::EventSetup& iSetup ); - - private: - // data specifiers - - edm::InputTag SistripLabelSig_ ; // name given to collection of SiStrip digis - edm::InputTag SiStripPileInputTag_ ; // InputTag for pileup strips - std::string SiStripDigiCollectionDM_ ; // secondary name to be given to new SiStrip digis - - edm::InputTag SistripAPVLabelSig_; // where to find vector of dead APVs - edm::InputTag SiStripAPVPileInputTag_; - std::string SistripAPVListDM_; // output tag - - - // - - typedef float Amplitude; - typedef std::pair RawDigi; // Replacement for SiStripDigi with pulse height instead of integer ADC - typedef std::vector OneDetectorMap; // maps by strip ID for later combination - can have duplicate strips - typedef std::vector OneDetectorRawMap; // maps by strip ID for later combination - can have duplicate strips - typedef std::map SiGlobalIndex; // map to all data for each detector ID - typedef std::map SiGlobalRawIndex; // map to all data for each detector ID - - typedef SiDigitalConverter::DigitalVecType DigitalVecType; - - SiGlobalIndex SiHitStorage_; - SiGlobalRawIndex SiRawDigis_; - - // unsigned int eventId_; //=0 for signal, from 1-n for pileup events - - // variables for temporary storage of mixed hits: - - - typedef std::map SignalMapType; - typedef std::map signalMaps; - - const SignalMapType* getSignal(uint32_t detID) const { - auto where = signals_.find(detID); - if(where == signals_.end()) { - return nullptr; - } - return &where->second; - } - - signalMaps signals_; - - // to keep track of dead APVs from HIP interactions - typedef std::multimap< uint32_t, std::bitset<6> > APVMap; - - APVMap theAffectedAPVmap_; - - // for noise adding: - - std::string label_; - - std::string gainLabel; - bool SingleStripNoise; - bool peakMode; - double theThreshold; - double theElectronPerADC; - bool APVSaturationFromHIP_; - int theFedAlgo; - std::string geometryType; - - std::unique_ptr theSiNoiseAdder; - std::unique_ptr theSiZeroSuppress; - std::unique_ptr theSiDigitalConverter; - - edm::ESHandle pDD; - - // bad channels for each detector ID - std::map > allBadChannels; - // channels killed by HIP interactions for each detector ID - std::map > allHIPChannels; - // first and last channel wit signal for each detector ID - std::map firstChannelsWithSignal; - std::map lastChannelsWithSignal; - - //---------------------------- - - class StrictWeakOrdering{ - public: - bool operator() (SiStripDigi i,SiStripDigi j) const {return i.strip() < j.strip();} - }; - - class StrictWeakRawOrdering{ - public: - bool operator() (RawDigi i,RawDigi j) const {return i.first < j.first;} - }; - - }; -}//edm - -#endif // SimDataMixingSiStripMCDigiWorker_h diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.cc b/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.cc deleted file mode 100644 index d6aa01d54d54c..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.cc +++ /dev/null @@ -1,401 +0,0 @@ -// File: DataMixingTrackingParticleWorker.cc -// Description: see DataMixingTrackingParticleWorker.h -// Author: Mike Hildreth, University of Notre Dame -// -//-------------------------------------------- - -#include -#include -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/EDMException.h" -#include "FWCore/Framework/interface/ConstProductRegistry.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Provenance/interface/Provenance.h" -#include "DataFormats/Provenance/interface/BranchDescription.h" -// -// -#include "DataMixingTrackingParticleWorker.h" - -using namespace std; - -namespace { - template - void appendDetSetVector(edm::DetSetVector& target, const edm::DetSetVector& source) { - for(auto& detsetSource: source) { - auto& detsetTarget = target.find_or_insert(detsetSource.detId()); - std::copy(detsetSource.begin(), detsetSource.end(), std::back_inserter(detsetTarget)); - } - } -} - -namespace edm -{ - - // Virtual constructor - - DataMixingTrackingParticleWorker::DataMixingTrackingParticleWorker() { } - - // Constructor - DataMixingTrackingParticleWorker::DataMixingTrackingParticleWorker(const edm::ParameterSet& ps, edm::ConsumesCollector && iC) - { - - // get the subdetector names - // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do... - - // declare the products to produce - - TrackingParticleLabelSig_ = ps.getParameter("TrackingParticleLabelSig"); - - TrackingParticlePileInputTag_ = ps.getParameter("TrackingParticlePileInputTag"); - - TrackingParticleCollectionDM_ = ps.getParameter("TrackingParticleCollectionDM"); - - TrackSigToken_ = iC.consumes >(TrackingParticleLabelSig_); - TrackPileToken_ = iC.consumes >(TrackingParticlePileInputTag_); - - VtxSigToken_ = iC.consumes >(TrackingParticleLabelSig_); - VtxPileToken_ = iC.consumes >(TrackingParticlePileInputTag_); - - // Pixel and Strip DigiSimlinks - - StripLinkPileInputTag_ = ps.getParameter("StripDigiSimLinkPileInputTag"); - PixelLinkPileInputTag_ = ps.getParameter("PixelDigiSimLinkPileInputTag"); - StripLinkCollectionDM_ = ps.getParameter("StripDigiSimLinkCollectionDM"); - PixelLinkCollectionDM_ = ps.getParameter("PixelDigiSimLinkCollectionDM"); - - StripLinkSigToken_ = iC.consumes >(ps.getParameter("StripDigiSimLinkLabelSig")); - StripLinkPileToken_ = iC.consumes >(StripLinkPileInputTag_); - PixelLinkSigToken_ = iC.consumes >(ps.getParameter("PixelDigiSimLinkLabelSig")); - PixelLinkPileToken_ = iC.consumes >(PixelLinkPileInputTag_); - - // Muon DigiSimLinks - - DTLinkPileInputTag_ = ps.getParameter("DTDigiSimLinkPileInputTag"); - RPCLinkPileInputTag_ = ps.getParameter("RPCDigiSimLinkPileInputTag"); - CSCWireLinkPileInputTag_ = ps.getParameter("CSCWireDigiSimLinkPileInputTag"); - CSCStripLinkPileInputTag_ = ps.getParameter("CSCStripDigiSimLinkPileInputTag"); - - DTLinkCollectionDM_ = ps.getParameter("DTDigiSimLinkDM"); - RPCLinkCollectionDM_ = ps.getParameter("RPCDigiSimLinkDM"); - CSCWireLinkCollectionDM_ = ps.getParameter("CSCWireDigiSimLinkDM"); - CSCStripLinkCollectionDM_ = ps.getParameter("CSCStripDigiSimLinkDM"); - - CSCWireLinkSigToken_ = iC.consumes >(ps.getParameter("CSCWireDigiSimLinkLabelSig")); - CSCWireLinkPileToken_ = iC.consumes >(CSCWireLinkPileInputTag_); - CSCStripLinkSigToken_ = iC.consumes >(ps.getParameter("CSCStripDigiSimLinkLabelSig")); - CSCStripLinkPileToken_ = iC.consumes >(CSCStripLinkPileInputTag_); - DTLinkSigToken_ = iC.consumes< MuonDigiCollection >(ps.getParameter("DTDigiSimLinkLabelSig")); - DTLinkPileToken_ = iC.consumes< MuonDigiCollection >(DTLinkPileInputTag_); - RPCLinkSigToken_ = iC.consumes >(ps.getParameter("RPCDigiSimLinkLabelSig")); - RPCLinkPileToken_ = iC.consumes >(RPCLinkPileInputTag_); - - } - - - // Virtual destructor needed. - DataMixingTrackingParticleWorker::~DataMixingTrackingParticleWorker() { - } - - // Need an event initialization - - void DataMixingTrackingParticleWorker::initializeEvent(edm::Event const& e, edm::EventSetup const& iSetup) { - - // Create new track/vertex lists, getting references, too, so that we can cross-link everything - - NewTrackList_ = std::unique_ptr>(new std::vector()); - //NewVertexList_ = std::unique_ptr>(new std::vector()); - TempVertexList_ = std::vector(); - - TrackListRef_ =const_cast( e ).getRefBeforePut< std::vector >(TrackingParticleCollectionDM_); - VertexListRef_ =const_cast( e ).getRefBeforePut< std::vector >(TrackingParticleCollectionDM_); - - // tracker - - NewStripLinkList_ = std::make_unique >(); - NewPixelLinkList_ = std::make_unique >(); - - // muons - - NewCSCStripLinkList_ = std::make_unique >(); - NewCSCWireLinkList_ = std::make_unique >(); - NewRPCLinkList_ = std::make_unique >(); - NewDTLinkList_ = std::make_unique< MuonDigiCollection >(); - - } - - - void DataMixingTrackingParticleWorker::addTrackingParticleSignals(const edm::Event &e) { - - // grab Vertices, store copy, preserving indices. Easier to loop over vertices first - fewer links - - edm::Handle> vtxs; - e.getByToken(VtxSigToken_, vtxs); - - const size_t StartingIndexV = TempVertexList_.size(); // should be zero here, but keep for consistency - const size_t StartingIndexT = NewTrackList_->size(); // should be zero here, but keep for consistency - - if (vtxs.isValid()) { - - for (std::vector::const_iterator vtx = vtxs->begin(); vtx != vtxs->end(); ++vtx) { - TempVertexList_.push_back(*vtx); - } - } - - // grab tracks, store copy - - edm::Handle> tracks; - e.getByToken(TrackSigToken_, tracks); - - if (tracks.isValid()) { - for (std::vector::const_iterator track = tracks->begin(); track != tracks->end(); ++track) { - auto oldRef=track->parentVertex(); - auto newRef=TrackingVertexRef( VertexListRef_, oldRef.index()+StartingIndexV ); - NewTrackList_->push_back(*track); - - auto & Ntrack = NewTrackList_->back(); //modify copy - - Ntrack.setParentVertex( newRef ); - Ntrack.clearDecayVertices(); - - // next, loop over daughter vertices, same strategy - - for( auto const& vertexRef : track->decayVertices() ) { - auto newRef=TrackingVertexRef( VertexListRef_, vertexRef.index()+StartingIndexV ); - Ntrack.addDecayVertex(newRef); - } - } - } - - // Now that tracks are handled, go back and put correct Refs in vertices - std::vector sourceTrackIndices; - std::vector daughterTrackIndices; - for (auto & vertex : TempVertexList_ ) { - - // Need to copy the indices before clearing the vectors - sourceTrackIndices.reserve(vertex.sourceTracks().size()); - daughterTrackIndices.reserve(vertex.daughterTracks().size()); - for(auto const& ref: vertex.sourceTracks()) sourceTrackIndices.push_back(ref.index()); - for(auto const& ref: vertex.daughterTracks()) daughterTrackIndices.push_back(ref.index()); - - vertex.clearParentTracks(); - vertex.clearDaughterTracks(); - - for( auto index : sourceTrackIndices ) { - auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); - vertex.addParentTrack(newRef); - } - - // next, loop over daughter tracks, same strategy - for( auto index : daughterTrackIndices ) { - auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); - vertex.addDaughterTrack(newRef); - } - - sourceTrackIndices.clear(); - daughterTrackIndices.clear(); - } - - // Accumulate DigiSimLinks - edm::Handle > stripLinks; - e.getByToken(StripLinkSigToken_, stripLinks); - if(stripLinks.isValid()) { - appendDetSetVector(*NewStripLinkList_, *stripLinks); - } - - edm::Handle > pixelLinks; - e.getByToken(PixelLinkSigToken_, pixelLinks); - if(pixelLinks.isValid()) { - appendDetSetVector(*NewPixelLinkList_, *pixelLinks); - } - - edm::Handle > CSCstripLinks; - e.getByToken(CSCStripLinkSigToken_, CSCstripLinks); - if(CSCstripLinks.isValid()) { - appendDetSetVector(*NewCSCStripLinkList_, *CSCstripLinks); - } - - edm::Handle > CSCwireLinks; - e.getByToken(CSCWireLinkSigToken_, CSCwireLinks); - if(CSCwireLinks.isValid()) { - appendDetSetVector(*NewCSCWireLinkList_, *CSCwireLinks); - } - - edm::Handle > RPCLinks; - e.getByToken(RPCLinkSigToken_, RPCLinks); - if(RPCLinks.isValid()) { - appendDetSetVector(*NewRPCLinkList_, *RPCLinks); - } - - edm::Handle< DTDigiSimLinkCollection > DTLinks; - e.getByToken(DTLinkSigToken_, DTLinks); - if(DTLinks.isValid()) { - for (DTDigiSimLinkCollection::DigiRangeIterator detUnit=DTLinks->begin(); detUnit !=DTLinks->end(); ++detUnit) { - const DTLayerId& layerid = (*detUnit).first; - const DTDigiSimLinkCollection::Range& range = (*detUnit).second; - NewDTLinkList_->put(range,layerid); - } - } - - } // end of addTrackingParticleSignals - - - - void DataMixingTrackingParticleWorker::addTrackingParticlePileups(const int bcr, const EventPrincipal *ep, unsigned int eventNr, - ModuleCallingContext const* mcc) { - - LogDebug("DataMixingTrackingParticleWorker") <<"\n===============> adding pileups from event "<id()<<" for bunchcrossing "<size(); // keep track of offsets - - std::shared_ptr > const> inputVPTR = - getProductByTag >(*ep, TrackingParticlePileInputTag_, mcc); - - if(inputVPTR ) { - - const std::vector *vtxs = const_cast< std::vector * >(inputVPTR->product()); - - // grab vertices, store copy - - for (std::vector::const_iterator vtx = vtxs->begin(); vtx != vtxs->end(); ++vtx) { - TempVertexList_.push_back(*vtx); - } - } - - - std::shared_ptr > const> inputPTR = - getProductByTag >(*ep, TrackingParticlePileInputTag_, mcc); - - if(inputPTR ) { - - const std::vector *tracks = const_cast< std::vector * >(inputPTR->product()); - - // grab tracks, store copy - for (std::vector::const_iterator track = tracks->begin(); track != tracks->end(); ++track) { - auto oldRef=track->parentVertex(); - auto newRef=TrackingVertexRef( VertexListRef_, oldRef.index()+StartingIndexV ); - NewTrackList_->push_back(*track); - - auto & Ntrack = NewTrackList_->back(); //modify copy - - Ntrack.setParentVertex( newRef ); - Ntrack.clearDecayVertices(); - - // next, loop over daughter vertices, same strategy - - for( auto const& vertexRef : track->decayVertices() ) { - auto newRef=TrackingVertexRef( VertexListRef_, vertexRef.index()+StartingIndexV ); - Ntrack.addDecayVertex(newRef); - } - } - } - - // Now that tracks are handled, go back and put correct Refs in vertices - // Operate only on the added pileup vertices, and leave the already-existing vertices untouched - std::vector sourceTrackIndices; - std::vector daughterTrackIndices; - for(size_t iVertex = StartingIndexV; iVertex != TempVertexList_.size(); ++iVertex) { - auto& vertex = TempVertexList_[iVertex]; - - // Need to copy the indices before clearing the vectors - sourceTrackIndices.reserve(vertex.sourceTracks().size()); - daughterTrackIndices.reserve(vertex.daughterTracks().size()); - for(auto const& ref: vertex.sourceTracks()) sourceTrackIndices.push_back(ref.index()); - for(auto const& ref: vertex.daughterTracks()) daughterTrackIndices.push_back(ref.index()); - - vertex.clearParentTracks(); - vertex.clearDaughterTracks(); - - for( auto index : sourceTrackIndices ) { - auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); - vertex.addParentTrack(newRef); - } - - // next, loop over daughter tracks, same strategy - for( auto index : daughterTrackIndices ) { - auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); - vertex.addDaughterTrack(newRef); - } - - sourceTrackIndices.clear(); - daughterTrackIndices.clear(); - } - - - // Accumulate DigiSimLinks - std::shared_ptr > const> inputStripPtr = - getProductByTag >(*ep, StripLinkPileInputTag_, mcc); - if(inputStripPtr) { - appendDetSetVector(*NewStripLinkList_, *(inputStripPtr->product())); - } - - std::shared_ptr > const> inputPixelPtr = - getProductByTag >(*ep, PixelLinkPileInputTag_, mcc); - if(inputPixelPtr) { - appendDetSetVector(*NewPixelLinkList_, *(inputPixelPtr->product())); - } - - std::shared_ptr > const> CSCinputStripPtr = - getProductByTag >(*ep, CSCStripLinkPileInputTag_, mcc); - if(CSCinputStripPtr) { - appendDetSetVector(*NewCSCStripLinkList_, *(CSCinputStripPtr->product())); - } - - std::shared_ptr > const> CSCinputWirePtr = - getProductByTag >(*ep, CSCWireLinkPileInputTag_, mcc); - if(CSCinputWirePtr) { - appendDetSetVector(*NewCSCWireLinkList_, *(CSCinputWirePtr->product())); - } - - std::shared_ptr > const> inputRPCPtr = - getProductByTag >(*ep, RPCLinkPileInputTag_, mcc); - if(inputRPCPtr) { - appendDetSetVector(*NewRPCLinkList_, *(inputRPCPtr->product())); - } - - std::shared_ptr const> inputDTPtr = - getProductByTag< DTDigiSimLinkCollection >(*ep, DTLinkPileInputTag_, mcc); - if(inputDTPtr) { - const DTDigiSimLinkCollection* DTLinks = const_cast< DTDigiSimLinkCollection * >(inputDTPtr->product()); - for (DTDigiSimLinkCollection::DigiRangeIterator detUnit=DTLinks->begin(); detUnit !=DTLinks->end(); ++detUnit) { - const DTLayerId& layerid = (*detUnit).first; - const DTDigiSimLinkCollection::Range& range = (*detUnit).second; - NewDTLinkList_->put(range,layerid); - } - } - - } // end of addPileups - - - - void DataMixingTrackingParticleWorker::putTrackingParticle(edm::Event &e) { - - // collection of Vertices to put in the event - - NewVertexList_ = std::unique_ptr>(new std::vector(TempVertexList_)); - - // put the collection of digis in the event - LogInfo("DataMixingTrackingParticleWorker") << "total # Merged Tracks: " << NewTrackList_->size() ; - - // put collections - - e.put(std::move(NewTrackList_), TrackingParticleCollectionDM_ ); - e.put(std::move(NewVertexList_), TrackingParticleCollectionDM_ ); - - e.put(std::move(NewStripLinkList_), StripLinkCollectionDM_ ); - e.put(std::move(NewPixelLinkList_), PixelLinkCollectionDM_ ); - - e.put(std::move(NewCSCStripLinkList_), CSCStripLinkCollectionDM_ ); - e.put(std::move(NewCSCWireLinkList_), CSCWireLinkCollectionDM_ ); - e.put(std::move(NewRPCLinkList_), RPCLinkCollectionDM_ ); - e.put(std::move(NewDTLinkList_), DTLinkCollectionDM_ ); - - - // clear local storage for this event - //NewTrackList_.clear(); - TempVertexList_.clear(); - } - -} //edm diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.h b/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.h deleted file mode 100644 index 84f0f5a033e98..0000000000000 --- a/SimGeneral/DataMixingModule/plugins/DataMixingTrackingParticleWorker.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef SimDataMixingTrackingParticleWorker_h -#define SimDataMixingTrackingParticleWorker_h - -/** \class DataMixingTrackingParticleWorker - * - * DataMixingModule is the EDProducer subclass - * that overlays rawdata events on top of MC, - * using real data for pileup simulation - * This class takes care of the TrackingParticle information - * - * \author Mike Hildreth, University of Notre Dame - * - * \version 1st Version October 2007 - * - ************************************************************/ - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventPrincipal.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" - -#include "DataFormats/Provenance/interface/ProductID.h" -#include "DataFormats/Common/interface/Handle.h" -//Data Formats -#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" -#include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h" -#include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" -#include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h" -#include "SimDataFormats/DigiSimLinks/interface/DTDigiSimLinkCollection.h" -#include "SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLink.h" -#include "DataFormats/Common/interface/DetSetVector.h" - - -#include -#include -#include - - - -namespace edm -{ - class ModuleCallingContext; - - class DataMixingTrackingParticleWorker - { - public: - - DataMixingTrackingParticleWorker(); - - /** standard constructor*/ - explicit DataMixingTrackingParticleWorker(const edm::ParameterSet& ps, edm::ConsumesCollector && iC); - - /**Default destructor*/ - virtual ~DataMixingTrackingParticleWorker(); - - virtual void initializeEvent(edm::Event const& e, edm::EventSetup const& c); // override? - - void putTrackingParticle(edm::Event &e) ; - void addTrackingParticleSignals(const edm::Event &e); - void addTrackingParticlePileups(const int bcr, const edm::EventPrincipal*,unsigned int EventId, - ModuleCallingContext const*); - - private: - // data specifiers - - edm::InputTag TrackingParticlecollectionSig_ ; // primary name given to collection of TrackingParticles - edm::InputTag TrackingParticleLabelSig_ ; // secondary name given to collection of TrackingParticles - edm::InputTag TrackingParticlePileInputTag_ ; // InputTag for pileup tracks - std::string TrackingParticleCollectionDM_ ; // secondary name to be given to new TrackingParticle - - edm::InputTag StripLinkPileInputTag_; - edm::InputTag PixelLinkPileInputTag_; - edm::InputTag DTLinkPileInputTag_; - edm::InputTag RPCLinkPileInputTag_; - edm::InputTag CSCWireLinkPileInputTag_; - edm::InputTag CSCStripLinkPileInputTag_; - - std::string StripLinkCollectionDM_; - std::string PixelLinkCollectionDM_; - std::string DTLinkCollectionDM_; - std::string RPCLinkCollectionDM_; - std::string CSCWireLinkCollectionDM_; - std::string CSCStripLinkCollectionDM_; - - edm::EDGetTokenT >TrackSigToken_ ; // Token to retrieve information - edm::EDGetTokenT >TrackPileToken_ ; // Token to retrieve information - edm::EDGetTokenT >VtxSigToken_ ; // Token to retrieve information - edm::EDGetTokenT >VtxPileToken_ ; // Token to retrieve information - - edm::EDGetTokenT > StripLinkSigToken_; - edm::EDGetTokenT > StripLinkPileToken_; - edm::EDGetTokenT > PixelLinkSigToken_; - edm::EDGetTokenT > PixelLinkPileToken_; - edm::EDGetTokenT > CSCWireLinkSigToken_; - edm::EDGetTokenT > CSCWireLinkPileToken_; - edm::EDGetTokenT > CSCStripLinkSigToken_; - edm::EDGetTokenT > CSCStripLinkPileToken_; - edm::EDGetTokenT< MuonDigiCollection > DTLinkSigToken_; - edm::EDGetTokenT< MuonDigiCollection > DTLinkPileToken_; - edm::EDGetTokenT > RPCLinkSigToken_; - edm::EDGetTokenT > RPCLinkPileToken_; - - // - - std::unique_ptr> NewTrackList_; - std::unique_ptr> NewVertexList_; - std::vector TempVertexList_; - - std::unique_ptr > NewStripLinkList_; - std::unique_ptr > NewPixelLinkList_; - std::unique_ptr< MuonDigiCollection > NewDTLinkList_; - std::unique_ptr< edm::DetSetVector > NewRPCLinkList_; - std::unique_ptr< edm::DetSetVector > NewCSCWireLinkList_; - std::unique_ptr< edm::DetSetVector > NewCSCStripLinkList_; - - TrackingParticleRefProd TrackListRef_ ; - TrackingVertexRefProd VertexListRef_ ; - - - }; -}//edm - -#endif // SimDataMixingTrackingParticleWorker_h diff --git a/SimGeneral/DataMixingModule/python/customiseForPremixingInput.py b/SimGeneral/DataMixingModule/python/customiseForPremixingInput.py deleted file mode 100644 index 00899461ac526..0000000000000 --- a/SimGeneral/DataMixingModule/python/customiseForPremixingInput.py +++ /dev/null @@ -1,74 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -def customiseForPreMixingInput(process): - from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag - - # Replace TrackingParticles and TrackingVertices globally - # only apply on validation and dqm: we don't want to apply this in the mixing and digitization sequences - for s in process.paths_().keys() + process.endpaths_().keys(): - if s.lower().find("validation")>= 0 or s.lower().find("dqm") >= 0: - massSearchReplaceAnyInputTag(getattr(process, s), cms.InputTag("mix", "MergedTrackTruth"), cms.InputTag("mixData", "MergedTrackTruth"), skipLabelTest=True) - - # Replace Pixel/StripDigiSimLinks only for the known modules - def replaceInputTag(tag, old, new): - if tag.value() == old: - tag.setValue(new) - - def replacePixelDigiSimLink(tag): - replaceInputTag(tag, "simSiPixelDigis", "mixData:PixelDigiSimLink") - def replaceStripDigiSimLink(tag): - replaceInputTag(tag, "simSiStripDigis", "mixData:StripDigiSimLink") - def replaceHcalTp(tag): - replaceInputTag(tag, "simHcalTriggerPrimitiveDigis", "DMHcalTriggerPrimitiveDigis") - - def replaceAnalyzer(label, analyzer): - if analyzer.type_() == "GlobalRecHitsAnalyzer": - replacePixelDigiSimLink(analyzer.pixelSimLinkSrc) - replaceStripDigiSimLink(analyzer.stripSimLinkSrc) - if analyzer.type_() == "SiPixelTrackingRecHitsValid": - replacePixelDigiSimLink(analyzer.pixelSimLinkSrc) - replaceStripDigiSimLink(analyzer.stripSimLinkSrc) - if analyzer.type_() == "SiStripTrackingRecHitsValid": - replacePixelDigiSimLink(analyzer.pixelSimLinkSrc) - replaceStripDigiSimLink(analyzer.stripSimLinkSrc) - if analyzer.type_() == "SiPixelRecHitsValid": - replacePixelDigiSimLink(analyzer.pixelSimLinkSrc) - replaceStripDigiSimLink(analyzer.stripSimLinkSrc) - if analyzer.type_() == "SiStripRecHitsValid": - replacePixelDigiSimLink(analyzer.pixelSimLinkSrc) - replaceStripDigiSimLink(analyzer.stripSimLinkSrc) - if analyzer.type_() == "HcalDigisValidation": - replaceHcalTp(analyzer.dataTPs) - - for label, producer in process.producers_().iteritems(): - if producer.type_() == "ClusterTPAssociationProducer": - replacePixelDigiSimLink(producer.pixelSimLinkSrc) - replaceStripDigiSimLink(producer.stripSimLinkSrc) - if producer.type_() == "QuickTrackAssociatorByHitsProducer": - replacePixelDigiSimLink(producer.pixelSimLinkSrc) - replaceStripDigiSimLink(producer.stripSimLinkSrc) - if producer.type_() == "TrackAssociatorByHitsProducer": - replacePixelDigiSimLink(producer.pixelSimLinkSrc) - replaceStripDigiSimLink(producer.stripSimLinkSrc) - if producer.type_() == "MuonAssociatorEDProducer": - producer.DTdigisimlinkTag = cms.InputTag("mixData","simMuonDTDigis") - producer.CSClinksTag = cms.InputTag("mixData","MuonCSCStripDigiSimLinks") - producer.CSCwireLinksTag = cms.InputTag("mixData","MuonCSCWireDigiSimLinks") - producer.RPCdigisimlinkTag = cms.InputTag("mixData","RPCDigiSimLink") - replacePixelDigiSimLink(producer.pixelSimLinkSrc) - replaceStripDigiSimLink(producer.stripSimLinkSrc) - if producer.type_() == "MuonToTrackingParticleAssociatorEDProducer": - producer.DTdigisimlinkTag = cms.InputTag("mixData","simMuonDTDigis") - producer.CSClinksTag = cms.InputTag("mixData","MuonCSCStripDigiSimLinks") - producer.CSCwireLinksTag = cms.InputTag("mixData","MuonCSCWireDigiSimLinks") - producer.RPCdigisimlinkTag = cms.InputTag("mixData","RPCDigiSimLink") - replacePixelDigiSimLink(producer.pixelSimLinkSrc) - replaceStripDigiSimLink(producer.stripSimLinkSrc) - # Most of DQM analyzers are nowadays EDProducers - replaceAnalyzer(label, producer) - - for label, analyzer in process.analyzers_().iteritems(): - replaceAnalyzer(label, analyzer) - - - return process diff --git a/SimGeneral/DataMixingModule/python/mixOne_data_on_data_cfi.py b/SimGeneral/DataMixingModule/python/mixOne_data_on_data_cfi.py index 2d98b6a9fab72..9e95bd805f1e5 100644 --- a/SimGeneral/DataMixingModule/python/mixOne_data_on_data_cfi.py +++ b/SimGeneral/DataMixingModule/python/mixOne_data_on_data_cfi.py @@ -24,7 +24,6 @@ # mixProdStep1 = cms.bool(False), mixProdStep2 = cms.bool(False), - TrackerMergeType = cms.string('Digis'), # kludge for fast simulation flag... # Use digis? EcalMergeType = cms.string('Digis'), # set to "Digis" to merge digis HcalMergeType = cms.string('Digis'), diff --git a/SimGeneral/DataMixingModule/python/mixOne_data_on_sim_cfi.py b/SimGeneral/DataMixingModule/python/mixOne_data_on_sim_cfi.py index a964a04135f64..ad2d418b9227e 100644 --- a/SimGeneral/DataMixingModule/python/mixOne_data_on_sim_cfi.py +++ b/SimGeneral/DataMixingModule/python/mixOne_data_on_sim_cfi.py @@ -33,7 +33,6 @@ mixProdStep1 = cms.bool(False), mixProdStep2 = cms.bool(False), # Use digis? - TrackerMergeType = cms.string("Digis"), EcalMergeType = cms.string('Digis'), # set to "Digis" to merge digis HcalMergeType = cms.string('Digis'), HcalDigiMerge = cms.string('FullProd'), diff --git a/SimGeneral/DataMixingModule/python/mixOne_sim_on_sim_cfi.py b/SimGeneral/DataMixingModule/python/mixOne_sim_on_sim_cfi.py index 8aae886968617..6bfae7bdaacd7 100644 --- a/SimGeneral/DataMixingModule/python/mixOne_sim_on_sim_cfi.py +++ b/SimGeneral/DataMixingModule/python/mixOne_sim_on_sim_cfi.py @@ -25,7 +25,6 @@ # Merge Pileup Info? MergePileupInfo = cms.bool(True), # Use digis? - TrackerMergeType = cms.string("Digis"), EcalMergeType = cms.string('Digis'), # set to "Digis" to merge digis HcalMergeType = cms.string('Digis'), HcalDigiMerge = cms.string('NotProd'), #use sim hits for signal diff --git a/SimGeneral/DataMixingModule/python/mixOne_simraw_on_sim_cfi.py b/SimGeneral/DataMixingModule/python/mixOne_simraw_on_sim_cfi.py deleted file mode 100644 index 556f809b0e041..0000000000000 --- a/SimGeneral/DataMixingModule/python/mixOne_simraw_on_sim_cfi.py +++ /dev/null @@ -1,269 +0,0 @@ -# This is the PreMixing config for the DataMixer. Not only does it do a RawToDigi conversion -# to the secondary input source, it also holds its own instances of an EcalDigiProducer and -# an HcalDigitizer. It also replicates the noise adding functions in the SiStripDigitizer. -# - - -import FWCore.ParameterSet.Config as cms -from SimCalorimetry.HcalSimProducers.hcalUnsuppressedDigis_cfi import hcalSimBlock -from SimGeneral.MixingModule.SiStripSimParameters_cfi import SiStripSimBlock -from SimGeneral.MixingModule.SiPixelSimParameters_cfi import SiPixelSimBlock -from SimCalorimetry.EcalSimProducers.ecalDigiParameters_cff import * -from SimCalorimetry.EcalSimProducers.apdSimParameters_cff import * -from SimCalorimetry.EcalSimProducers.ecalSimParameterMap_cff import * -from SimCalorimetry.EcalSimProducers.ecalElectronicsSim_cff import * -from SimCalorimetry.EcalSimProducers.esElectronicsSim_cff import * -from SimCalorimetry.EcalSimProducers.ecalNotContainmentSim_cff import * -from SimCalorimetry.EcalSimProducers.ecalCosmicsSim_cff import * - -import EventFilter.EcalRawToDigi.EcalUnpackerData_cfi -import EventFilter.ESRawToDigi.esRawToDigi_cfi -import EventFilter.HcalRawToDigi.HcalRawToDigi_cfi -import EventFilter.DTRawToDigi.dtunpacker_cfi -import EventFilter.RPCRawToDigi.rpcUnpacker_cfi -import EventFilter.CSCRawToDigi.cscUnpacker_cfi -import EventFilter.SiStripRawToDigi.SiStripDigis_cfi -import EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi - -# content from Configuration/StandardSequences/DigiToRaw_cff.py - -ecalDigis = EventFilter.EcalRawToDigi.EcalUnpackerData_cfi.ecalEBunpacker.clone() - -ecalPreshowerDigis = EventFilter.ESRawToDigi.esRawToDigi_cfi.esRawToDigi.clone() - -hcalDigis = EventFilter.HcalRawToDigi.HcalRawToDigi_cfi.hcalDigis.clone() - -muonCSCDigis = EventFilter.CSCRawToDigi.cscUnpacker_cfi.muonCSCDigis.clone() - -muonDTDigis = EventFilter.DTRawToDigi.dtunpacker_cfi.muonDTDigis.clone() - -#muonRPCDigis = EventFilter.RPCRawToDigi.rpcUnpacker_cfi.rpcunpacker.clone() -#castorDigis = EventFilter.CastorRawToDigi.CastorRawToDigi_cfi.castorDigis.clone( FEDs = cms.untracked.vint32(690,691,692) ) - -siStripDigis = EventFilter.SiStripRawToDigi.SiStripDigis_cfi.siStripDigis.clone() - -siPixelDigis = EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi.siPixelDigis.clone() - -siPixelDigis.InputLabel = 'rawDataCollector' -ecalDigis.InputLabel = 'rawDataCollector' -ecalPreshowerDigis.sourceTag = 'rawDataCollector' -hcalDigis.InputLabel = 'rawDataCollector' -muonCSCDigis.InputObjects = 'rawDataCollector' -muonDTDigis.inputLabel = 'rawDataCollector' -#muonRPCDigis.InputLabel = 'rawDataCollector' -#castorDigis.InputLabel = 'rawDataCollector' - -hcalDigis.FilterDataQuality = cms.bool(False) -hcalSimBlock.HcalPreMixStage2 = cms.bool(True) - -mixData = cms.EDProducer("DataMixingModule", - hcalSimBlock, - SiStripSimBlock, - SiPixelSimBlock, - ecal_digi_parameters, - apd_sim_parameters, - ecal_electronics_sim, - ecal_cosmics_sim, - ecal_sim_parameter_map, - ecal_notCont_sim, - es_electronics_sim, - input = cms.SecSource("EmbeddedRootSource", - producers = cms.VPSet(cms.convertToVPSet( - ecalDigis = ecalDigis, - ecalPreshowerDigis = ecalPreshowerDigis, - hcalDigis = hcalDigis, - muonDTDigis = muonDTDigis, - #muonRPCDigis = muonRPCDigis, - muonCSCDigis = muonCSCDigis, - siStripDigis = siStripDigis, - siPixelDigis = siPixelDigis, - )), - nbPileupEvents = cms.PSet( - averageNumber = cms.double(1.0) - ), - seed = cms.int32(1234567), - type = cms.string('fixed'), - sequential = cms.untracked.bool(False), # set to true for sequential reading of pileup - fileNames = cms.untracked.vstring( - 'file:DMPreProcess_RAW2DIGI.root' - ) - ), - # Mixing Module parameters - Label = cms.string(''), - maxBunch = cms.int32(0), - bunchspace = cms.int32(25), - minBunch = cms.int32(0), - # - mixProdStep1 = cms.bool(False), - mixProdStep2 = cms.bool(False), - TrackerMergeType = cms.string('Digis'), # kludge for fast simulation flag... - # Merge Pileup Info? - MergePileupInfo = cms.bool(True), - # Use digis? - EcalMergeType = cms.string('Digis'), # set to "Digis" to merge digis - HcalMergeType = cms.string('Digis'), - HcalDigiMerge = cms.string('FullProd'), #use sim hits for signal - addMCDigiNoise = cms.untracked.bool(True), - # - # Input Specifications: - # - # - # Tracking particles for validation - # - TrackingParticleLabelSig = cms.InputTag("mix","MergedTrackTruth"), - StripDigiSimLinkLabelSig = cms.InputTag("simSiStripDigis"), - PixelDigiSimLinkLabelSig = cms.InputTag("simSiPixelDigis"), - DTDigiSimLinkLabelSig = cms.InputTag("simMuonDTDigis"), - RPCDigiSimLinkLabelSig = cms.InputTag("simMuonRPCDigis","RPCDigiSimLink"), - CSCStripDigiSimLinkLabelSig = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigiSimLinks"), - CSCWireDigiSimLinkLabelSig = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigiSimLinks"), - - # - PileupInfoInputTag = cms.InputTag("addPileupInfo"), - BunchSpacingInputTag = cms.InputTag("addPileupInfo","bunchSpacing"), - CFPlaybackInputTag = cms.InputTag("mix"), - GenPUProtonsInputTags = cms.VInputTag("genPUProtons"), - # - SistripLabelSig = cms.InputTag("simSiStripDigis","ZeroSuppressed"), - # - pixeldigiCollectionSig = cms.InputTag("simSiPixelDigis"), - # - SiStripPileInputTag = cms.InputTag("siStripDigis","ZeroSuppressed","@MIXING"), - # - pixeldigiCollectionPile = cms.InputTag("siPixelDigis","","@MIXING"), - # - EBProducerSig = cms.InputTag("ecalRecHit","EcalRecHitsEB"), - EEProducerSig = cms.InputTag("ecalRecHit","EcalRecHitsEE"), - ESProducerSig = cms.InputTag("ecalPreshowerRecHit","EcalRecHitsES"), - # - HBHEProducerSig = cms.InputTag("hbhereco"), - HOProducerSig = cms.InputTag("horeco"), - HFProducerSig = cms.InputTag("hfreco"), - ZDCrechitCollectionSig = cms.InputTag("zdcreco"), - # - # - EBPileRecHitInputTag = cms.InputTag("ecalRecHit", "EcalRecHitsEB"), - EEPileRecHitInputTag = cms.InputTag("ecalRecHit", "EcalRecHitsEE"), - ESPileRecHitInputTag = cms.InputTag("ecalPreshowerRecHit", "EcalRecHitsES"), - # - HBHEPileRecHitInputTag = cms.InputTag("hbhereco", ""), - HOPileRecHitInputTag = cms.InputTag("horeco", ""), - HFPileRecHitInputTag = cms.InputTag("hfreco", ""), - ZDCPileRecHitInputTag = cms.InputTag("zdcreco",""), - # - # Calorimeter digis - # - -# EBdigiCollectionSig = cms.InputTag("simEcalUnsuppressedDigis"), -# EEdigiCollectionSig = cms.InputTag("simEcalUnsuppressedDigis"), -# ESdigiCollectionSig = cms.InputTag("simEcalUnsuppressedDigis"), - - EBdigiProducerSig = cms.InputTag("simEcalUnsuppressedDigis"), - EEdigiProducerSig = cms.InputTag("simEcalUnsuppressedDigis"), - ESdigiProducerSig = cms.InputTag("simEcalPreshowerDigis"), - HBHEdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - HOdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - HFdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - QIE10digiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - QIE11digiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - ZDCdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), - - - # Validation - TrackingParticlePileInputTag = cms.InputTag("mix","MergedTrackTruth"), - StripDigiSimLinkPileInputTag = cms.InputTag("simSiStripDigis"), - PixelDigiSimLinkPileInputTag = cms.InputTag("simSiPixelDigis"), - DTDigiSimLinkPileInputTag = cms.InputTag("simMuonDTDigis"), - RPCDigiSimLinkPileInputTag = cms.InputTag("simMuonRPCDigis","RPCDigiSimLink"), - CSCStripDigiSimLinkPileInputTag = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigiSimLinks"), - CSCWireDigiSimLinkPileInputTag = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigiSimLinks"), - - # Dead APV Vector - SistripAPVPileInputTag = cms.InputTag("mix","AffectedAPVList"), - SistripAPVLabelSig = cms.InputTag("mix","AffectedAPVList"), - - # Note: elements with "@MIXING" in the input tag are generated by - # running Raw2Digi in the input step on the Secondary input stream - EBPileInputTag = cms.InputTag("ecalDigis","ebDigis","@MIXING"), - EEPileInputTag = cms.InputTag("ecalDigis","eeDigis","@MIXING"), - ESPileInputTag = cms.InputTag("ecalPreshowerDigis","","@MIXING"), - #ESPileInputTag = cms.InputTag("esRawToDigi","","@MIXING"), - HBHEPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), - HOPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), - HFPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), - QIE10PileInputTag = cms.InputTag("hcalDigis","","@MIXING"), - QIE11PileInputTag = cms.InputTag("hcalDigis","","@MIXING"), - ZDCPileInputTag = cms.InputTag(""), - - # Signal - # - CSCwiredigiCollectionSig = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigi"), - CSCstripdigiCollectionSig = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigi"), - CSCCompdigiCollectionSig = cms.InputTag("simMuonCSCDigis","MuonCSCComparatorDigi"), - RPCDigiTagSig = cms.InputTag("simMuonRPCDigis"), - RPCdigiCollectionSig = cms.InputTag("simMuonRPCDigis"), - DTDigiTagSig = cms.InputTag("simMuonDTDigis"), - DTdigiCollectionSig = cms.InputTag("simMuonDTDigis"), - # Pileup - # - DTPileInputTag = cms.InputTag("muonDTDigis","","@MIXING"), - RPCPileInputTag = cms.InputTag("simMuonRPCDigis",""), -# RPCPileInputTag = cms.InputTag("muonRPCDigis","","@MIXING"), # use MC digis... - CSCWirePileInputTag = cms.InputTag("muonCSCDigis","MuonCSCWireDigi","@MIXING"), - CSCStripPileInputTag = cms.InputTag("muonCSCDigis","MuonCSCStripDigi","@MIXING"), - CSCCompPileInputTag = cms.InputTag("muonCSCDigis","MuonCSCComparatorDigi","@MIXING"), - # - # - # Outputs - # - SiStripDigiCollectionDM = cms.string('siStripDigisDM'), - PixelDigiCollectionDM = cms.string('siPixelDigisDM'), - EBRecHitCollectionDM = cms.string('EcalRecHitsEBDM'), - EERecHitCollectionDM = cms.string('EcalRecHitsEEDM'), - ESRecHitCollectionDM = cms.string('EcalRecHitsESDM'), - HBHERecHitCollectionDM = cms.string('HBHERecHitCollectionDM'), - HFRecHitCollectionDM = cms.string('HFRecHitCollectionDM'), - HORecHitCollectionDM = cms.string('HORecHitCollectionDM'), - ZDCRecHitCollectionDM = cms.string('ZDCRecHitCollectionDM'), - DTDigiCollectionDM = cms.string('muonDTDigisDM'), - CSCWireDigiCollectionDM = cms.string('MuonCSCWireDigisDM'), - CSCStripDigiCollectionDM = cms.string('MuonCSCStripDigisDM'), - CSCComparatorDigiCollectionDM = cms.string('MuonCSCComparatorDigisDM'), - RPCDigiCollectionDM = cms.string('muonRPCDigisDM'), - TrackingParticleCollectionDM = cms.string('MergedTrackTruth'), - StripDigiSimLinkCollectionDM = cms.string('StripDigiSimLink'), - PixelDigiSimLinkCollectionDM = cms.string('PixelDigiSimLink'), - DTDigiSimLinkDM = cms.string('simMuonDTDigis'), - RPCDigiSimLinkDM = cms.string('RPCDigiSimLink'), - CSCStripDigiSimLinkDM = cms.string('MuonCSCStripDigiSimLinks'), - CSCWireDigiSimLinkDM = cms.string('MuonCSCWireDigiSimLinks'), - SiStripAPVListDM = cms.string('SiStripAPVList'), - - # - # Calorimeter Digis - # - EBDigiCollectionDM = cms.string(''), - EEDigiCollectionDM = cms.string(''), - ESDigiCollectionDM = cms.string(''), - HBHEDigiCollectionDM = cms.string(''), - HODigiCollectionDM = cms.string(''), - HFDigiCollectionDM = cms.string(''), - QIE10DigiCollectionDM = cms.string(''), - QIE11DigiCollectionDM = cms.string(''), - ZDCDigiCollectionDM = cms.string('') -) - -mixData.doEB = cms.bool(True) -mixData.doEE = cms.bool(True) -mixData.doES = cms.bool(True) - -from Configuration.Eras.Modifier_fastSim_cff import fastSim -from FastSimulation.Tracking.recoTrackAccumulator_cfi import recoTrackAccumulator as _recoTrackAccumulator -fastSim.toModify(mixData, - # from signal: mix tracks not strip or pixel digis - TrackerMergeType = "tracks", - tracker = _recoTrackAccumulator.clone( - pileUpTracks = "mix:generalTracks" - ), - hitsProducer = "fastSimProducer" -) diff --git a/SimGeneral/Debugging/plugins/BuildFile.xml b/SimGeneral/Debugging/plugins/BuildFile.xml new file mode 100644 index 0000000000000..1eb4529ca8ff7 --- /dev/null +++ b/SimGeneral/Debugging/plugins/BuildFile.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc b/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc new file mode 100644 index 0000000000000..5e970a1070e3b --- /dev/null +++ b/SimGeneral/Debugging/plugins/CaloParticleDebugger.cc @@ -0,0 +1,361 @@ +// +// Original Author: Marco Rovere +// Created: Fri, 10 Nov 2017 14:39:18 GMT +// +// +// +// system include files +#include +#include +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "SimDataFormats/Track/interface/SimTrack.h" +#include "SimDataFormats/Vertex/interface/SimVertex.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" + +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" +#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" +#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" +#include "Geometry/CaloTopology/interface/HGCalTopology.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" + + +// +// class declaration +// + +class CaloParticleDebugger : public edm::one::EDAnalyzer<> { + public: + explicit CaloParticleDebugger(const edm::ParameterSet&); + ~CaloParticleDebugger() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + + private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + void fillSimHits(std::map &, + const edm::Event& , const edm::EventSetup &); + edm::InputTag simTracks_; + edm::InputTag genParticles_; + edm::InputTag simVertices_; + edm::InputTag trackingParticles_; + edm::InputTag caloParticles_; + edm::InputTag simClusters_; + std::vector collectionTags_; + edm::EDGetTokenT > simTracksToken_; + edm::EDGetTokenT > genParticlesToken_; + edm::EDGetTokenT > simVerticesToken_; + edm::EDGetTokenT > trackingParticlesToken_; + edm::EDGetTokenT > caloParticlesToken_; + edm::EDGetTokenT> simClustersToken_; + std::vector > > collectionTagsToken_; + // ----------member data --------------------------- +}; + +// +// constants, enums and typedefs +// + +// +// static data member definitions +// + +// +// constructors and destructor +// +CaloParticleDebugger::CaloParticleDebugger(const edm::ParameterSet& iConfig) + : simTracks_(iConfig.getParameter("simTracks")), + genParticles_(iConfig.getParameter("genParticles")), + simVertices_(iConfig.getParameter("simVertices")), + trackingParticles_(iConfig.getParameter("trackingParticles")), + caloParticles_(iConfig.getParameter("caloParticles")), + simClusters_(iConfig.getParameter("simClusters")), + collectionTags_(iConfig.getParameter >("collectionTags")) { + edm::ConsumesCollector&& iC = consumesCollector(); + simTracksToken_ = iC.consumes >(simTracks_); + genParticlesToken_ = iC.consumes > (genParticles_); + simVerticesToken_ = iC.consumes >(simVertices_); + trackingParticlesToken_ = iC.consumes >(trackingParticles_); + caloParticlesToken_ = iC.consumes >(caloParticles_); + simClustersToken_ = iC.consumes >(simClusters_); + for (auto const & collectionTag : collectionTags_) { + collectionTagsToken_.push_back(iC.consumes >(collectionTag)); + } +} + +CaloParticleDebugger::~CaloParticleDebugger() {} + + +// +// member functions +// + +// ------------ method called for each event ------------ +void +CaloParticleDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + using std::begin; + using std::end; + using std::sort; + using std::iota; + + edm::Handle > simTracksH; + edm::Handle > genParticlesH; + edm::Handle > simVerticesH; + edm::Handle > trackingParticlesH; + edm::Handle > caloParticlesH; + edm::Handle > simClustersH; + + iEvent.getByToken(simTracksToken_, simTracksH); + auto const & tracks = *simTracksH.product(); + std::vector sorted_tracks_idx(tracks.size()); + iota(begin(sorted_tracks_idx), end(sorted_tracks_idx), 0); + sort(begin(sorted_tracks_idx), + end(sorted_tracks_idx), + [&tracks] (int i, int j) { + return tracks[i].momentum().eta() < tracks[j].momentum().eta(); + }); + + iEvent.getByToken(genParticlesToken_, genParticlesH); + auto const & genParticles = *genParticlesH.product(); + std::vector sorted_genParticles_idx(genParticles.size()); + iota(begin(sorted_genParticles_idx), end(sorted_genParticles_idx), 0); + sort(begin(sorted_genParticles_idx), + end(sorted_genParticles_idx), [&genParticles](int i, int j) { + return genParticles[i].momentum().eta() < genParticles[j].momentum().eta();}); + + iEvent.getByToken(simVerticesToken_, simVerticesH); + auto const & vertices = *simVerticesH.product(); + std::vector sorted_vertices_idx(vertices.size()); + iota(begin(sorted_vertices_idx), end(sorted_vertices_idx), 0); + sort(begin(sorted_vertices_idx), + end(sorted_vertices_idx), [&vertices](int i, int j){ + return vertices[i].vertexId() < vertices[j].vertexId(); + }); + + iEvent.getByToken(trackingParticlesToken_, trackingParticlesH); + auto const & trackingpart = *trackingParticlesH.product(); + std::vector sorted_tp_idx(trackingpart.size()); + iota(begin(sorted_tp_idx), end(sorted_tp_idx), 0); + sort(begin(sorted_tp_idx), + end(sorted_tp_idx), [&trackingpart] (int i, int j){ + return trackingpart[i].eta() < trackingpart[j].eta(); + }); + + iEvent.getByToken(caloParticlesToken_, caloParticlesH); + auto const & calopart = *caloParticlesH.product(); + std::vector sorted_cp_idx(calopart.size()); + iota(begin(sorted_cp_idx), + end(sorted_cp_idx), 0); + sort(begin(sorted_cp_idx), + end(sorted_cp_idx), [&calopart](int i, int j){ + return calopart[i].eta() < calopart[j].eta();}); + + iEvent.getByToken(simClustersToken_, simClustersH); + auto const & simclusters = *simClustersH.product(); + std::vector sorted_simcl_idx(simclusters.size()); + iota(begin(sorted_simcl_idx), + end(sorted_simcl_idx), 0); + sort(begin(sorted_simcl_idx), + end(sorted_simcl_idx), [&simclusters](int i, int j){ + return simclusters[i].eta() < simclusters[j].eta();}); + + // Let's first fill in hits information + std::map detIdToTotalSimEnergy; + fillSimHits(detIdToTotalSimEnergy, iEvent, iSetup); + + int idx = 0; + + std::map trackid_to_track_index; + std::cout << "Printing SimTracks information" << std::endl; + std::cout << "IDX\tTrackId\tPDGID\tMOMENTUM(x,y,z,E)\tVertexIdx\tGenPartIdx" << std::endl; + for (auto i : sorted_tracks_idx) { + auto const & t = tracks[i]; + std::cout << idx << "\t" << t.trackId() << "\t" << t << std::endl; + trackid_to_track_index[t.trackId()] = idx; + idx++; + } + + std::cout << "Printing GenParticles information" << std::endl; + std::cout << "IDX\tPDGID\tMOMENTUM(x,y,z)\tVertex(x,y,z)" << std::endl; + for (auto i : sorted_genParticles_idx) { + auto const & gp = genParticles[i]; + std::cout << i + << "\t" << gp.pdgId() + << "\t" << gp.momentum() + << "\t" << gp.vertex() << std::endl; + } + + std::cout << "Printing SimVertex information" << std::endl; + std::cout << "IDX\tPOSITION(x,y,z)\tPARENT_INDEX\tVERTEX_ID" << std::endl; + for (auto i : sorted_vertices_idx) { + auto const & v = vertices[i]; + std::cout << i << "\t" << v << std::endl; + } + std::cout << "Printing TrackingParticles information" << std::endl; + for (auto i : sorted_tp_idx) { + auto const & tp = trackingpart[i]; + std::cout << i << "\t" << tp << std::endl; + } + + std::cout << "Printing CaloParticles information" << std::endl; + idx = 0; + for (auto i : sorted_cp_idx) { + auto const & cp = calopart[i]; + std::cout << "\n\n" << idx++ << " |Eta|: " << std::abs(cp.momentum().eta()) + << "\tType: " << cp.pdgId() + << "\tEnergy: " << cp.energy() + << "\tIdx: " << cp.g4Tracks()[0].trackId() << std::endl; // << cp << std::endl; + double total_sim_energy = 0.; + double total_cp_energy = 0.; + std::cout << "--> Overall simclusters's size: " << cp.simClusters().size() << std::endl; + // All the next mess just to print the simClusters ordered + auto const & simcs = cp.simClusters(); + std::vector sorted_sc_idx(simcs.size()); + iota(begin(sorted_sc_idx), end(sorted_sc_idx), 0); + sort(begin(sorted_sc_idx), + end(sorted_sc_idx), + [&simcs] (int i, int j) { + return simcs[i]->momentum().eta() < simcs[j]->momentum().eta(); + }); + for (auto i : sorted_sc_idx) { + std::cout << *(simcs[i]); + } + + for (auto const & sc : cp.simClusters()) { + for (auto const & cl : sc->hits_and_fractions()) { + total_sim_energy += detIdToTotalSimEnergy[cl.first]*cl.second; + total_cp_energy += cp.energy()*cl.second; + } + } + std::cout << "--> Overall SC energy (sum using sim energies): " << total_sim_energy << std::endl; + std::cout << "--> Overall SC energy (sum using CaloP energies): " << total_cp_energy << std::endl; + } + + idx = 0; + std::cout << "Printing SimClusters information" << std::endl; + for (auto i : sorted_simcl_idx) { + auto const & simcl = simclusters[i]; + std::cout << "\n\n" << idx++ << " |Eta|: " << std::abs(simcl.momentum().eta()) + << "\tType: " << simcl.pdgId() + << "\tEnergy: " << simcl.energy() + << "\tKey: " << i << std::endl; // << simcl << std::endl; + double total_sim_energy = 0.; + std::cout << "--> Overall simclusters's size: " << simcl.numberOfRecHits() << std::endl; + for (auto const & cl : simcl.hits_and_fractions()) { + total_sim_energy += detIdToTotalSimEnergy[cl.first]*cl.second; + } + std::cout << simcl << std::endl; + std::cout << "--> Overall SimCluster energy (sum using sim energies): " << total_sim_energy << std::endl; + } +} + + +// ------------ method called once each job just before starting event loop ------------ +void +CaloParticleDebugger::beginJob() {} + +// ------------ method called once each job just after ending the event loop ------------ +void +CaloParticleDebugger::endJob() {} + +void CaloParticleDebugger::fillSimHits( + std::map & detIdToTotalSimEnergy, + const edm::Event& iEvent, const edm::EventSetup& iSetup ) { + // Taken needed quantities from the EventSetup + edm::ESHandle geom; + iSetup.get().get(geom); + const HGCalGeometry *eegeom, *fhgeom; + const HcalGeometry *bhgeom; + const HGCalDDDConstants* hgddd[2]; + const HGCalTopology* hgtopo[2]; + const HcalDDDRecConstants* hcddd; + + eegeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCEE)); + fhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Forward, HGCHEF)); + bhgeom = static_cast(geom->getSubdetectorGeometry(DetId::Hcal, HcalEndcap)); + + hgtopo[0] = &(eegeom->topology()); + hgtopo[1] = &(fhgeom->topology()); + + for (unsigned i = 0; i < 2; ++i) { + hgddd[i] = &(hgtopo[i]->dddConstants()); + } + + hcddd = bhgeom->topology().dddConstants(); + + // loop over the collections + int token = 0; + for (auto const& collectionTag : collectionTags_) { + edm::Handle< std::vector > hSimHits; + const bool isHcal = ( collectionTag.instance().find("HcalHits") != std::string::npos ); + iEvent.getByToken(collectionTagsToken_[token++], hSimHits); + for (auto const& simHit : *hSimHits) { + DetId id(0); + const uint32_t simId = simHit.id(); + if (isHcal) { + HcalDetId hid = HcalHitRelabeller::relabel(simId, hcddd); + if (hid.subdet() == HcalEndcap) id = hid; + } else { + int subdet, layer, cell, sec, subsec, zp; + HGCalTestNumbering::unpackHexagonIndex(simId, subdet, zp, layer, sec, subsec, cell); + const HGCalDDDConstants* ddd = hgddd[subdet-3]; + std::pair recoLayerCell = ddd->simToReco(cell, layer, sec, + hgtopo[subdet-3]->detectorType()); + cell = recoLayerCell.first; + layer = recoLayerCell.second; + // skip simhits with bad barcodes or non-existant layers + if (layer == -1 || simHit.geantTrackId() == 0) continue; + id = HGCalDetId((ForwardSubdetector)subdet, zp, layer, subsec, sec, cell); + } + + if (DetId(0) == id) continue; + + detIdToTotalSimEnergy[id.rawId()] += simHit.energy(); + } + } // end of loop over InputTags +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void +CaloParticleDebugger::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("simTracks", edm::InputTag("g4SimHits")); + desc.add("genParticles", edm::InputTag("genParticles")); + desc.add("simVertices", edm::InputTag("g4SimHits")); + desc.add("trackingParticles", edm::InputTag("mix", "MergedTrackTruth")); + desc.add("caloParticles", edm::InputTag("mix", "MergedCaloTruth")); + desc.add("simClusters", edm::InputTag("mix", "MergedCaloTruth")); + desc.add >("collectionTags", + { edm::InputTag("g4SimHits", "HGCHitsEE"), + edm::InputTag("g4SimHits", "HGCHitsHEfront"), + edm::InputTag("g4SimHits", "HcalHits")}); + descriptions.add("caloParticleDebugger", desc); +} + +// define this as a plug-in +DEFINE_FWK_MODULE(CaloParticleDebugger); diff --git a/SimGeneral/Debugging/python/caloParticleDebugger_cfg.py b/SimGeneral/Debugging/python/caloParticleDebugger_cfg.py new file mode 100644 index 0000000000000..2f5a38c6cb903 --- /dev/null +++ b/SimGeneral/Debugging/python/caloParticleDebugger_cfg.py @@ -0,0 +1,32 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("Demo") + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.load('Configuration.Geometry.GeometryExtended2023D17Reco_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + +process.source = cms.Source("PoolSource", + inputCommands = cms.untracked.vstring(['keep *', + 'drop l1tEMTFHit2016Extras_simEmtfDigis_CSC_HLT', + 'drop l1tEMTFHit2016Extras_simEmtfDigis_RPC_HLT', + 'drop l1tEMTFHit2016s_simEmtfDigis__HLT', + 'drop l1tEMTFTrack2016Extras_simEmtfDigis__HLT', + 'drop l1tEMTFTrack2016s_simEmtfDigis__HLT']), + # replace 'myfile.root' with the source file you want to use + fileNames = cms.untracked.vstring( +# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20800.0_FourMuPt1_200+FourMuPt_1_200_pythia8_2023D20_GenSimHLBeamSpotFull+DigiFull_2023D20+RecoFullGlobal_2023D20+HARVESTFullGlobal_2023D20/step2.root' +# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20824.0_TTbar_13+TTbar_13TeV_TuneCUETP8M1_2023D20_GenSimHLBeamSpotFull+DigiFull_2023D20+RecoFullGlobal_2023D20+HARVESTFullGlobal_2023D20/step2.root' +# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20002.0_SingleElectronPt35+SingleElectronPt35_pythia8_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' +# 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20016.0_SingleGammaPt35Extended+DoubleGammaPt35Extended_pythia8_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' + 'file:/data/rovere/HGCAL/study/CMSSW_9_4_0/src/SimGeneral/Debugging/test/20088.0_SinglePiPt25Eta1p7_2p7+SinglePiPt25Eta1p7_2p7_2023D17_GenSimHLBeamSpotFull+DigiFullTrigger_2023D17+RecoFullGlobal_2023D17+HARVESTFullGlobal_2023D17/step2.root' + ) +) + +process.load("SimGeneral.Debugging.caloParticleDebugger_cfi") + +process.p = cms.Path(process.caloParticleDebugger) diff --git a/SimGeneral/MixingModule/python/castorDigitizer_cfi.py b/SimGeneral/MixingModule/python/castorDigitizer_cfi.py index 0a3fc0ddedeb4..06ef707c0380a 100644 --- a/SimGeneral/MixingModule/python/castorDigitizer_cfi.py +++ b/SimGeneral/MixingModule/python/castorDigitizer_cfi.py @@ -12,7 +12,7 @@ samplingFactor = cms.double(0.062577), ## GeV/pe doPhotoStatistics = cms.bool(True), - photoelectronsToAnalog = cms.double(4.009), + photoelectronsToAnalog = cms.double(4.1718), simHitToPhotoelectrons = cms.double(1000.0), syncPhase = cms.bool(True), timePhase = cms.double(-4.0) diff --git a/SimGeneral/PreMixingModule/plugins/BuildFile.xml b/SimGeneral/PreMixingModule/plugins/BuildFile.xml new file mode 100644 index 0000000000000..81643e2a24687 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/BuildFile.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingDigiAccumulatorWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingDigiAccumulatorWorker.cc new file mode 100644 index 0000000000000..1991a33db7e63 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingDigiAccumulatorWorker.cc @@ -0,0 +1,50 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" + +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixMod.h" +#include "SimGeneral/MixingModule/interface/DigiAccumulatorMixModFactory.h" +#include "SimGeneral/MixingModule/interface/PileUpEventPrincipal.h" + +#include "PreMixingWorker.h" + +namespace edm { + class PreMixingDigiAccumulatorWorker: public PreMixingWorker { + public: + PreMixingDigiAccumulatorWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC): + accumulator_(DigiAccumulatorMixModFactory::get()->makeDigiAccumulator(ps.getParameter("accumulator"), producer, iC)) + {} + ~PreMixingDigiAccumulatorWorker() override = default; + + void initializeEvent(const edm::Event &e, const edm::EventSetup& ES) override { + accumulator_->initializeEvent(e, ES); + } + + void initializeBunchCrossing(edm::Event const& e, edm::EventSetup const& ES, int bunchCrossing) override { + accumulator_->initializeBunchCrossing(e, ES, bunchCrossing); + } + void finalizeBunchCrossing(edm::Event& e, edm::EventSetup const& ES, int bunchCrossing) override { + accumulator_->finalizeBunchCrossing(e, ES, bunchCrossing); + } + + void addSignals(const edm::Event &e, const edm::EventSetup& ES) override { + accumulator_->accumulate(e, ES); + } + void addPileups(int bcr, const edm::EventPrincipal& ep, int EventId, + const edm::EventSetup& ES, edm::ModuleCallingContext const *mcc) override { + PileUpEventPrincipal pep(ep, mcc, bcr); + accumulator_->accumulate(pep, ES, ep.streamID()); + } + void put(edm::Event &e,const edm::EventSetup& ES, std::vector const& ps, int bs) override { + accumulator_->finalizeEvent(e, ES); + } + + private: + std::unique_ptr accumulator_; + }; +} + +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingDigiAccumulatorWorker, "PreMixingDigiAccumulatorWorker"); diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingDigiSimLinkWorkers.cc b/SimGeneral/PreMixingModule/plugins/PreMixingDigiSimLinkWorkers.cc new file mode 100644 index 0000000000000..646f91703433c --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingDigiSimLinkWorkers.cc @@ -0,0 +1,96 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" +#include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h" +#include "SimDataFormats/DigiSimLinks/interface/DTDigiSimLinkCollection.h" +#include "SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLink.h" +#include "DataFormats/Common/interface/DetSetVector.h" + +#include "PreMixingWorker.h" + +namespace edm { + template + class PreMixingDigiSimLinkWorker: public PreMixingWorker { + public: + PreMixingDigiSimLinkWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC); + ~PreMixingDigiSimLinkWorker() override = default; + + void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) override {} + void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) override; + void addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) override; + void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) override; + + private: + edm::EDGetTokenT signalToken_; + edm::InputTag pileupTag_; + std::string collectionDM_; // secondary name to be given to new digis + + std::unique_ptr merged_; + }; + + template + PreMixingDigiSimLinkWorker::PreMixingDigiSimLinkWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC): + signalToken_(iC.consumes(ps.getParameter("labelSig"))), + pileupTag_(ps.getParameter("pileInputTag")), + collectionDM_(ps.getParameter("collectionDM")) + { + producer.produces(collectionDM_); + } + + template + void PreMixingDigiSimLinkWorker::addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) { + Handle digis; + iEvent.getByToken(signalToken_, digis); + + if(digis.isValid()) { + merged_ = std::make_unique(*digis); // for signal we can just copy + } + else { + merged_ = std::make_unique(); + } + } + + template + void PreMixingDigiSimLinkWorker::addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) { + std::shared_ptr const> digisPTR = getProductByTag(ep, pileupTag_, mcc); + if(digisPTR) { + for(const auto& detsetSource: *(digisPTR->product())) { + auto& detsetTarget = merged_->find_or_insert(detsetSource.detId()); + std::copy(detsetSource.begin(), detsetSource.end(), std::back_inserter(detsetTarget)); + } + } + } + + template + void PreMixingDigiSimLinkWorker::put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) { + iEvent.put(std::move(merged_), collectionDM_); + } + + // Specialize for DT + template <> + void PreMixingDigiSimLinkWorker::addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) { + std::shared_ptr const> digisPTR = getProductByTag(ep, pileupTag_, mcc); + if(digisPTR) { + for(const auto& elem: *(digisPTR->product())) { + merged_->put(elem.second, elem.first); + } + } + } + + using PreMixingPixelDigiSimLinkWorker = PreMixingDigiSimLinkWorker >; + using PreMixingStripDigiSimLinkWorker = PreMixingDigiSimLinkWorker >; + using PreMixingRPCDigiSimLinkWorker = PreMixingDigiSimLinkWorker >; + using PreMixingDTDigiSimLinkWorker = PreMixingDigiSimLinkWorker; +} + +// register plugins +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingPixelDigiSimLinkWorker , "PreMixingPixelDigiSimLinkWorker"); +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingStripDigiSimLinkWorker , "PreMixingStripDigiSimLinkWorker"); +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingRPCDigiSimLinkWorker , "PreMixingRPCDigiSimLinkWorker"); +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingDTDigiSimLinkWorker , "PreMixingDTDigiSimLinkWorker"); diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingEcalWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingEcalWorker.cc new file mode 100644 index 0000000000000..74872a447e615 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingEcalWorker.cc @@ -0,0 +1,123 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" +#include "DataFormats/EcalDigi/interface/EBDataFrame.h" +#include "DataFormats/EcalDigi/interface/EEDataFrame.h" +#include "DataFormats/EcalDigi/interface/ESDataFrame.h" +#include "SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h" +#include "SimCalorimetry/EcalSimAlgos/interface/EcalSignalGenerator.h" + +#include "PreMixingWorker.h" + +namespace edm { + class PreMixingEcalWorker: public PreMixingWorker { + public: + PreMixingEcalWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC); + ~PreMixingEcalWorker() override = default; + + PreMixingEcalWorker(const PreMixingEcalWorker&) = delete; + PreMixingEcalWorker& operator=(const PreMixingEcalWorker&) = delete; + + void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) override; + + void initializeEvent(edm::Event const& e, edm::EventSetup const& ES) override; + void addSignals(edm::Event const& e, edm::EventSetup const& ES) override; + void addPileups(int bcr, edm::EventPrincipal const& ep, int EventId, edm::EventSetup const& es, ModuleCallingContext const*) override; + void put(edm::Event &e, edm::EventSetup const& iSetup, std::vector const& ps, int bs) override; + + private: + edm::InputTag EBPileInputTag_; // InputTag for Pileup Digis collection + edm::InputTag EEPileInputTag_ ; // InputTag for Pileup Digis collection + edm::InputTag ESPileInputTag_ ; // InputTag for Pileup Digis collection + + std::string EBDigiCollectionDM_; // secondary name to be given to collection of digis + std::string EEDigiCollectionDM_ ; // secondary name to be given to collection of digis + std::string ESDigiCollectionDM_ ; // secondary name to be given to collection of digis + + edm::EDGetTokenT tok_eb_; + edm::EDGetTokenT tok_ee_; + edm::EDGetTokenT tok_es_; + + const double m_EBs25notCont; + const double m_EEs25notCont; + const double m_peToABarrel; + const double m_peToAEndcap; + + EBSignalGenerator theEBSignalGenerator; + EESignalGenerator theEESignalGenerator; + ESSignalGenerator theESSignalGenerator; + EcalDigiProducer myEcalDigitizer_; + }; + + + // Constructor + PreMixingEcalWorker::PreMixingEcalWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC) : + EBPileInputTag_(ps.getParameter("EBPileInputTag")), + EEPileInputTag_(ps.getParameter("EEPileInputTag")), + ESPileInputTag_(ps.getParameter("ESPileInputTag")), + tok_eb_(iC.consumes(EBPileInputTag_)), + tok_ee_(iC.consumes(EEPileInputTag_)), + tok_es_(iC.consumes(ESPileInputTag_)), + m_EBs25notCont(ps.getParameter("EBs25notContainment") ) , + m_EEs25notCont(ps.getParameter("EEs25notContainment") ) , + m_peToABarrel(ps.getParameter("photoelectronsToAnalogBarrel") ) , + m_peToAEndcap(ps.getParameter("photoelectronsToAnalogEndcap") ), + theEBSignalGenerator(EBPileInputTag_,tok_eb_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap), + theEESignalGenerator(EEPileInputTag_,tok_ee_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap), + theESSignalGenerator(ESPileInputTag_,tok_es_, m_EBs25notCont, m_EEs25notCont, m_peToABarrel, m_peToAEndcap), + myEcalDigitizer_(ps, iC) + { + EBDigiCollectionDM_ = ps.getParameter("EBDigiCollectionDM"); + EEDigiCollectionDM_ = ps.getParameter("EEDigiCollectionDM"); + ESDigiCollectionDM_ = ps.getParameter("ESDigiCollectionDM"); + + producer.produces< EBDigiCollection >(EBDigiCollectionDM_); + producer.produces< EEDigiCollection >(EEDigiCollectionDM_); + producer.produces< ESDigiCollection >(ESDigiCollectionDM_); + + myEcalDigitizer_.setEBNoiseSignalGenerator( & theEBSignalGenerator ); + myEcalDigitizer_.setEENoiseSignalGenerator( & theEESignalGenerator ); + myEcalDigitizer_.setESNoiseSignalGenerator( & theESSignalGenerator ); + } + + void PreMixingEcalWorker::initializeEvent(const edm::Event &e, const edm::EventSetup& ES) { + myEcalDigitizer_.initializeEvent(e, ES); + } + + void PreMixingEcalWorker::addSignals(const edm::Event &e,const edm::EventSetup& ES) { + myEcalDigitizer_.accumulate(e, ES); + } + + void PreMixingEcalWorker::addPileups(int bcr, const EventPrincipal& ep, int eventNr, const edm::EventSetup& ES, + edm::ModuleCallingContext const* mcc) { + + LogDebug("PreMixingEcalWorker") <<"\n===============> adding pileups from event "< const& ps, int bs) { + myEcalDigitizer_.finalizeEvent( e, ES ); + } + + void PreMixingEcalWorker::beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& setup) { + myEcalDigitizer_.beginLuminosityBlock(lumi,setup); + } +} //edm + +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingEcalWorker, "PreMixingEcalWorker"); diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingHcalWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingHcalWorker.cc new file mode 100644 index 0000000000000..8ab48d50f45fd --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingHcalWorker.cc @@ -0,0 +1,158 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" +#include "DataFormats/HcalDigi/interface/HODataFrame.h" +#include "DataFormats/HcalDigi/interface/HFDataFrame.h" +#include "DataFormats/HcalDigi/interface/QIE10DataFrame.h" +#include "DataFormats/HcalDigi/interface/QIE11DataFrame.h" +#include "SimCalorimetry/HcalSimProducers/interface/HcalDigiProducer.h" +#include "SimCalorimetry/HcalSimAlgos/interface/HcalSignalGenerator.h" + +#include "PreMixingWorker.h" + +namespace edm { + class PreMixingHcalWorker: public PreMixingWorker { + public: + PreMixingHcalWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC); + ~PreMixingHcalWorker() override = default; + + PreMixingHcalWorker(const PreMixingHcalWorker&) = delete; + PreMixingHcalWorker& operator=(const PreMixingHcalWorker&) = delete; + + void beginRun(const edm::Run& run, const edm::EventSetup& ES) override; + void initializeEvent(const edm::Event &e, const edm::EventSetup& ES) override; + void addSignals(const edm::Event &e, const edm::EventSetup& ES) override; + void addPileups(int bcr, const edm::EventPrincipal&, int EventId, + const edm::EventSetup& ES, edm::ModuleCallingContext const*) override; + void put(edm::Event &e,const edm::EventSetup& ES, std::vector const& ps, int bs) override; + + + private: + edm::InputTag HBHEPileInputTag_; // InputTag for Pileup Digis collection + edm::InputTag HOPileInputTag_ ; // InputTag for Pileup Digis collection + edm::InputTag HFPileInputTag_ ; // InputTag for Pileup Digis collection + edm::InputTag ZDCPileInputTag_ ; // InputTag for Pileup Digis collection + edm::InputTag QIE10PileInputTag_ ; // InputTag for Pileup Digis collection + edm::InputTag QIE11PileInputTag_ ; // InputTag for Pileup Digis collection + std::string HBHEDigiCollectionDM_; // secondary name to be given to collection of digis + std::string HODigiCollectionDM_ ; // secondary name to be given to collection of digis + std::string HFDigiCollectionDM_ ; // secondary name to be given to collection of digis + std::string ZDCDigiCollectionDM_ ; // secondary name to be given to collection of digis + std::string QIE10DigiCollectionDM_ ; // secondary name to be given to collection of digis + std::string QIE11DigiCollectionDM_ ; // secondary name to be given to collection of digis + + edm::EDGetTokenT tok_hbhe_; + edm::EDGetTokenT tok_ho_; + edm::EDGetTokenT tok_hf_; + edm::EDGetTokenT tok_zdc_; + edm::EDGetTokenT tok_qie10_; + edm::EDGetTokenT tok_qie11_; + + HcalDigiProducer myHcalDigitizer_; + HBHESignalGenerator theHBHESignalGenerator; + HOSignalGenerator theHOSignalGenerator; + HFSignalGenerator theHFSignalGenerator; + ZDCSignalGenerator theZDCSignalGenerator; + QIE10SignalGenerator theQIE10SignalGenerator; + QIE11SignalGenerator theQIE11SignalGenerator; + }; + + // Constructor + PreMixingHcalWorker::PreMixingHcalWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC): + HBHEPileInputTag_(ps.getParameter("HBHEPileInputTag")), + HOPileInputTag_(ps.getParameter("HOPileInputTag")), + HFPileInputTag_(ps.getParameter("HFPileInputTag")), + ZDCPileInputTag_(ps.getParameter("ZDCPileInputTag")), + QIE10PileInputTag_(ps.getParameter("QIE10PileInputTag")), + QIE11PileInputTag_(ps.getParameter("QIE11PileInputTag")), + myHcalDigitizer_(ps, iC) + { + tok_hbhe_ = iC.consumes(HBHEPileInputTag_); + tok_ho_ = iC.consumes(HOPileInputTag_); + tok_hf_ = iC.consumes(HFPileInputTag_); + tok_zdc_ = iC.consumes(ZDCPileInputTag_); + tok_qie10_ = iC.consumes(QIE10PileInputTag_); + tok_qie11_ = iC.consumes(QIE11PileInputTag_); + + theHBHESignalGenerator = HBHESignalGenerator(HBHEPileInputTag_,tok_hbhe_); + theHOSignalGenerator = HOSignalGenerator(HOPileInputTag_,tok_ho_); + theHFSignalGenerator = HFSignalGenerator(HFPileInputTag_,tok_hf_); + theZDCSignalGenerator = ZDCSignalGenerator(ZDCPileInputTag_,tok_zdc_); + theQIE10SignalGenerator = QIE10SignalGenerator(QIE10PileInputTag_,tok_qie10_); + theQIE11SignalGenerator = QIE11SignalGenerator(QIE11PileInputTag_,tok_qie11_); + + // Hcal + // Signal inputs now handled by HcalDigitizer - gets pSimHits directly + + HBHEDigiCollectionDM_ = ps.getParameter("HBHEDigiCollectionDM"); + HODigiCollectionDM_ = ps.getParameter("HODigiCollectionDM"); + HFDigiCollectionDM_ = ps.getParameter("HFDigiCollectionDM"); + ZDCDigiCollectionDM_ = ps.getParameter("ZDCDigiCollectionDM"); + QIE10DigiCollectionDM_ = ps.getParameter("QIE10DigiCollectionDM"); + QIE11DigiCollectionDM_ = ps.getParameter("QIE11DigiCollectionDM"); + + producer.produces< HBHEDigiCollection >(); + producer.produces< HODigiCollection >(); + producer.produces< HFDigiCollection >(); + producer.produces< ZDCDigiCollection >(); + + producer.produces("HFQIE10DigiCollection"); + producer.produces("HBHEQIE11DigiCollection"); + + // initialize HcalDigitizer here... + myHcalDigitizer_.setHBHENoiseSignalGenerator( & theHBHESignalGenerator ); + myHcalDigitizer_.setHFNoiseSignalGenerator( & theHFSignalGenerator ); + myHcalDigitizer_.setHONoiseSignalGenerator( & theHOSignalGenerator ); + myHcalDigitizer_.setZDCNoiseSignalGenerator( & theZDCSignalGenerator ); + myHcalDigitizer_.setQIE10NoiseSignalGenerator( & theQIE10SignalGenerator ); + myHcalDigitizer_.setQIE11NoiseSignalGenerator( & theQIE11SignalGenerator ); + + } + + void PreMixingHcalWorker::beginRun(const edm::Run& run, const edm::EventSetup& ES) { + myHcalDigitizer_.beginRun(run, ES); + } + + void PreMixingHcalWorker::initializeEvent(const edm::Event &e, const edm::EventSetup& ES) { + myHcalDigitizer_.initializeEvent(e, ES); + } + + void PreMixingHcalWorker::addSignals(const edm::Event &e,const edm::EventSetup& ES) { + myHcalDigitizer_.accumulate(e, ES); + } + + void PreMixingHcalWorker::addPileups(int bcr, const EventPrincipal& ep, int eventNr,const edm::EventSetup& ES, + edm::ModuleCallingContext const* mcc) { + LogDebug("PreMixingHcalWorker") <<"\n===============> adding pileups from event "< const& ps, int bs) { + myHcalDigitizer_.finalizeEvent( e, ES); + } +} //edm + +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingHcalWorker, "PreMixingHcalWorker"); diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc new file mode 100644 index 0000000000000..4c99adc80b8d8 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingModule.cc @@ -0,0 +1,231 @@ +/** \class PreMixingModule + * + * PreMixingModule is the EDProducer subclass that overlays premixed + * MC events on top of MC. It is similar to DataMixingModule, but + * tailored for premixing use case. + * + ************************************************************/ +#include "Mixing/Base/interface/BMixingModule.h" + +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/ModuleContextSentry.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/EDMException.h" +#include "FWCore/ServiceRegistry/interface/InternalContext.h" +#include "FWCore/ServiceRegistry/interface/ModuleCallingContext.h" +#include "FWCore/ServiceRegistry/interface/ParentContext.h" + +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" +#include "SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNew.h" +#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" + +#include "PreMixingWorker.h" +#include "PreMixingWorkerFactory.h" +#include "PreMixingPileupCopy.h" + +#include +#include + +namespace edm { + class PreMixingModule: public BMixingModule { + public: + PreMixingModule(const edm::ParameterSet& ps, MixingCache::Config const* globalConf); + + ~PreMixingModule() override = default; + + void checkSignal(const edm::Event &e) override {}; + void createnewEDProduct() override {} + void addSignals(const edm::Event &e, const edm::EventSetup& ES) override; + void doPileUp(edm::Event &e,const edm::EventSetup& ES) override; + void put(edm::Event &e,const edm::EventSetup& ES) override ; + + void initializeEvent(edm::Event const& e, edm::EventSetup const& eventSetup) override; + void beginRun(edm::Run const& run, edm::EventSetup const& eventSetup) override; + void beginLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) override; + void endLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) override; + void endRun(const edm::Run& r, const edm::EventSetup& setup) override; + + private: + void pileWorker(const edm::EventPrincipal&, int bcr, int EventId,const edm::EventSetup& ES, ModuleCallingContext const*); + + PreMixingPileupCopy puWorker_; + bool addedPileup_ = false; + + std::vector > workers_; + }; + + PreMixingModule::PreMixingModule(const edm::ParameterSet& ps, MixingCache::Config const* globalConf): + BMixingModule(ps, globalConf), + puWorker_(ps.getParameter("workers").getParameter("pileup"), *this, consumesCollector()) + { + const auto& workers = ps.getParameter("workers"); + std::vector names = workers.getParameterNames(); + + // Hack to keep the random number sequence unchanged for migration + // from DataMixingModule to PreMixingModule. To be removed in a + // subsequent PR doing only that. + { + std::vector tmp; + auto hack = [&](const std::string& name) { + auto i = std::find(names.begin(), names.end(), name); + if(i != names.end()) { + tmp.push_back(*i); + names.erase(i); + } + }; + hack("ecal"); + hack("hcal"); + hack("strip"); + hack("pixel"); + std::copy(names.begin(), names.end(), std::back_inserter(tmp)); + names = std::move(tmp); + } + + for(const auto& name: names) { + if(name == "pileup") { + continue; + } + const auto& pset = workers.getParameter(name); + std::string type = pset.getParameter("workerType"); + workers_.emplace_back(PreMixingWorkerFactory::get()->create(type, pset, *this, consumesCollector())); + } + } + + + void PreMixingModule::initializeEvent(const edm::Event &e, const edm::EventSetup& ES) { + for(auto& w: workers_) { + w->initializeEvent(e, ES); + } + } + + + void PreMixingModule::beginRun(edm::Run const& run, const edm::EventSetup& ES) { + BMixingModule::beginRun( run, ES); + for(auto& w: workers_) { + w->beginRun(run, ES); + } + } + + void PreMixingModule::endRun(edm::Run const& run, const edm::EventSetup& ES) { + BMixingModule::endRun( run, ES); + } + + void PreMixingModule::addSignals(const edm::Event &e, const edm::EventSetup& ES) { + // fill in maps of hits + + LogDebug("PreMixingModule")<<"===============> adding MC signals for "<addSignals(e, ES); + } + + addedPileup_ = false; + } + + void PreMixingModule::pileWorker(const EventPrincipal &ep, int bcr, int eventNr, const edm::EventSetup& ES, edm::ModuleCallingContext const* mcc) { + InternalContext internalContext(ep.id(), mcc); + ParentContext parentContext(&internalContext); + ModuleCallingContext moduleCallingContext(&moduleDescription()); + ModuleContextSentry moduleContextSentry(&moduleCallingContext, parentContext); + + LogDebug("PreMixingModule") <<"\n===============> adding pileups from event "<addPileups(bcr, ep, eventNr, ES, &moduleCallingContext); + } + } + + void PreMixingModule::doPileUp(edm::Event &e, const edm::EventSetup& ES) + { + using namespace std::placeholders; + + std::vector recordEventID; + std::vector PileupList; + TrueNumInteractions_.clear(); + + ModuleCallingContext const* mcc = e.moduleCallingContext(); + + for (int bunchCrossing=minBunch_;bunchCrossing<=maxBunch_;++bunchCrossing) { + for (unsigned int isource=0;isource source = inputSources_[isource]; + if (!source || !(source->doPileUp(bunchCrossing))) + continue; + + if (isource==0) + source->CalculatePileup(minBunch_, maxBunch_, PileupList, TrueNumInteractions_, e.streamID()); + + int NumPU_Events = 0; + if (isource ==0) { + NumPU_Events = PileupList[bunchCrossing - minBunch_]; + } else { + // non-minbias pileup only gets one event for now. Fix later if desired. + NumPU_Events = 1; + } + + for(auto& w: workers_) { + w->initializeBunchCrossing(e, ES, bunchCrossing); + } + + source->readPileUp( + e.id(), + recordEventID, + std::bind(&PreMixingModule::pileWorker, std::ref(*this), + _1, bunchCrossing, _2, std::cref(ES), mcc), + NumPU_Events, + e.streamID() + ); + + for(auto& w: workers_) { + w->finalizeBunchCrossing(e, ES, bunchCrossing); + } + } + } + } + + void PreMixingModule::put(edm::Event &e,const edm::EventSetup& ES) { + // individual workers... + // move pileup first so we have access to the information for the put step + const auto& ps = puWorker_.getPileupSummaryInfo(); + int bunchSpacing = puWorker_.getBunchSpacing(); + + for(auto& w: workers_) { + w->put(e, ES, ps, bunchSpacing); + } + + puWorker_.putPileupInfo(e); + } + + void PreMixingModule::beginLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { + BMixingModule::beginLuminosityBlock(l1, c); + for(auto& w: workers_) { + w->beginLuminosityBlock(l1,c); + } + } + + void PreMixingModule::endLuminosityBlock(LuminosityBlock const& l1, EventSetup const& c) { + BMixingModule::endLuminosityBlock(l1, c); + } +} + +#include "FWCore/PluginManager/interface/PluginManager.h" +#include "FWCore/Framework/interface/MakerMacros.h" +using edm::PreMixingModule; +DEFINE_FWK_MODULE(PreMixingModule); + + diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingMuonWorkers.cc b/SimGeneral/PreMixingModule/plugins/PreMixingMuonWorkers.cc new file mode 100644 index 0000000000000..8e881705f2f4f --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingMuonWorkers.cc @@ -0,0 +1,214 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DataFormats/Common/interface/Handle.h" + +//DT +#include "DataFormats/DTDigi/interface/DTDigiCollection.h" +//RPC +#include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" +//CSC +#include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCComparatorDigiCollection.h" + +#include "PreMixingWorker.h" + + +namespace edm { + // Generic + template + class PreMixingMuonWorker: public PreMixingWorker { + public: + PreMixingMuonWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC): PreMixingMuonWorker(ps, producer, iC) {} + PreMixingMuonWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector& iC); + ~PreMixingMuonWorker() override = default; + + void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) override {} + void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) override; + void addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) override { + addPileups(ep, mcc); + } + void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) override { + put(iEvent); + } + + void addPileups(edm::EventPrincipal const& ep, edm::ModuleCallingContext const *mcc); + void put(edm::Event& iEvent); + private: + edm::EDGetTokenT signalToken_; + edm::InputTag pileupTag_; + std::string collectionDM_; // secondary name to be given to new digis + + std::unique_ptr accumulated_; + }; + + template + PreMixingMuonWorker::PreMixingMuonWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector& iC): + signalToken_(iC.consumes(ps.getParameter("digiTagSig"))), + pileupTag_(ps.getParameter("pileInputTag")), + collectionDM_(ps.getParameter("collectionDM")) + { + producer.produces(collectionDM_); + } + + template + void PreMixingMuonWorker::addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) { + Handle digis; + iEvent.getByToken(signalToken_, digis); + + accumulated_ = std::make_unique(*digis); // for signal we can just copy + } + + template + void PreMixingMuonWorker::addPileups(edm::EventPrincipal const& ep, edm::ModuleCallingContext const *mcc) { + std::shared_ptr const> digisPTR = getProductByTag(ep, pileupTag_, mcc); + for(const auto& elem: *(digisPTR->product())) { + accumulated_->put(elem.second, elem.first); + } + } + + template + void PreMixingMuonWorker::put(edm::Event& iEvent) { + iEvent.put(std::move(accumulated_), collectionDM_); + } + + // Specialize put for CSC strip + template <> + void PreMixingMuonWorker::put(edm::Event& iEvent) { + auto merged = std::make_unique(); + for(const auto& elem: *accumulated_) { + // The layerId + const CSCDetId& layerId = elem.first; + + // Get the iterators over the digis associated with this LayerId + const CSCStripDigiCollection::Range& range = elem.second; + + std::vector NewDigiList; + + std::vector StripList; + std::vector StripPointer; + + for(CSCStripDigiCollection::const_iterator dtdigi=range.first; dtdigi!=range.second; ++dtdigi){ + StripList.push_back( (*dtdigi).getStrip() ); + StripPointer.push_back( dtdigi ); + } + + int PrevStrip = -1; + std::vector DuplicateList; + + std::vector::const_iterator StripPtr = StripPointer.begin(); + + for( std::vector::const_iterator istrip = StripList.begin(); istrip !=StripList.end(); ++istrip) { + + const int CurrentStrip = *(istrip); + + if(CurrentStrip > PrevStrip) { + PrevStrip = CurrentStrip; + + int dupl_count; + dupl_count = std::count(StripList.begin(), StripList.end(), CurrentStrip); + if(dupl_count > 1) { + std::vector::const_iterator duplicate = istrip; + ++duplicate; + std::vector::const_iterator DuplPointer = StripPtr; + ++DuplPointer; + for( ; duplicate!=StripList.end(); ++duplicate) { + if( (*duplicate) == CurrentStrip ) { + DuplicateList.push_back(CurrentStrip); + + std::vector pileup_adc = (**DuplPointer).getADCCounts(); + std::vector signal_adc = (**StripPtr).getADCCounts(); + + std::vector::const_iterator minplace; + + minplace = std::min_element(pileup_adc.begin(), pileup_adc.end()); + + int minvalue = (*minplace); + + std::vector new_adc; + + std::vector::const_iterator newsig = signal_adc.begin(); + + for(std::vector::const_iterator ibin = pileup_adc.begin(); ibin!=pileup_adc.end(); ++ibin) { + new_adc.push_back((*newsig)+(*ibin)-minvalue); + + ++newsig; + } + + CSCStripDigi newDigi(CurrentStrip, new_adc); + NewDigiList.push_back(newDigi); + } + ++DuplPointer; + } + } + else { NewDigiList.push_back(**StripPtr); } + } // if strips monotonically increasing... Haven't hit duplicates yet + else { // reached end of signal digis, or there was no overlap + PrevStrip = 1000; // now into pileup signals, stop looking forward for duplicates + + // check if this digi was in the duplicate list + int check; + check = std::count(DuplicateList.begin(), DuplicateList.end(), CurrentStrip); + if(check == 0) NewDigiList.push_back(**StripPtr); + } + ++StripPtr; + } + + CSCStripDigiCollection::Range stripRange(NewDigiList.begin(), NewDigiList.end()); + + merged->put(stripRange, layerId); + } + + iEvent.put(std::move(merged), collectionDM_); + accumulated_.reset(); + } + + // CSC has three digi collections + class PreMixingCSCWorker: public PreMixingWorker { + public: + PreMixingCSCWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector&& iC): + stripWorker_(ps.getParameter("strip"), producer, iC), + wireWorker_(ps.getParameter("wire"), producer, iC), + comparatorWorker_(ps.getParameter("comparator"), producer, iC) {} + ~PreMixingCSCWorker() override = default; + + void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) override {} + + void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) override { + stripWorker_.addSignals(iEvent, iSetup); + wireWorker_.addSignals(iEvent, iSetup); + comparatorWorker_.addSignals(iEvent, iSetup); + } + + void addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) override { + stripWorker_.addPileups(ep, mcc); + wireWorker_.addPileups(ep, mcc); + comparatorWorker_.addPileups(ep, mcc); + } + + void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) override { + stripWorker_.put(iEvent); + wireWorker_.put(iEvent); + comparatorWorker_.put(iEvent); + } + private: + PreMixingMuonWorker stripWorker_; + PreMixingMuonWorker wireWorker_; + PreMixingMuonWorker comparatorWorker_; + }; + + // the rest are simpler + using PreMixingDTWorker = PreMixingMuonWorker; + using PreMixingRPCWorker = PreMixingMuonWorker; +} + +// register plugins +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingDTWorker , "PreMixingDTWorker"); +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingCSCWorker, "PreMixingCSCWorker"); +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingRPCWorker, "PreMixingRPCWorker"); diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.cc b/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.cc new file mode 100644 index 0000000000000..0cc54cd95e26d --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.cc @@ -0,0 +1,87 @@ +#include "PreMixingPileupCopy.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/ProducerBase.h" + +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" + +#include + +namespace edm { + PreMixingPileupCopy::PreMixingPileupCopy(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC): + pileupInfoInputTag_(ps.getParameter("PileupInfoInputTag")), + bunchSpacingInputTag_(ps.getParameter("BunchSpacingInputTag")), + cfPlaybackInputTag_(ps.getParameter("CFPlaybackInputTag")), + genPUProtonsInputTags_(ps.getParameter >("GenPUProtonsInputTags")) + { + producer.produces >(); + producer.produces("bunchSpacing"); + producer.produces(); + + for(const auto& tag: genPUProtonsInputTags_) { + producer.produces >(tag.label()); + } + } + + void PreMixingPileupCopy::addPileupInfo(const EventPrincipal& ep, unsigned int eventNr, ModuleCallingContext const* mcc) { + + LogDebug("PreMixingPileupCopy") <<"\n===============> adding pileup Info from event "< > const> pileupInfoPTR = + getProductByTag>(ep, pileupInfoInputTag_, mcc); + + std::shared_ptr const> bsPTR = + getProductByTag(ep,bunchSpacingInputTag_, mcc); + + if(pileupInfoPTR) { + pileupSummaryStorage_ = *(pileupInfoPTR->product()); + LogDebug("PreMixingPileupCopy") << "PileupInfo Size: " << pileupSummaryStorage_.size(); + } + bsStorage_ = bsPTR ? *(bsPTR->product()) : 10000; + + // Gen. PU protons + std::shared_ptr > const> genPUProtonsPTR; + for(const auto& tag: genPUProtonsInputTags_) { + genPUProtonsPTR = getProductByTag >(ep, tag, mcc); + if(genPUProtonsPTR != nullptr) { + genPUProtons_.push_back(*(genPUProtonsPTR->product())); + genPUProtons_labels_.push_back(tag.label()); + } + else { + edm::LogWarning("PreMixingPileupCopy") << "Missing product with label: " << tag.label(); + } + } + + // Playback + std::shared_ptr const> playbackPTR = + getProductByTag(ep,cfPlaybackInputTag_, mcc); + foundPlayback_ = false; + if(playbackPTR ) { + crossingFramePlaybackStorage_ = *(playbackPTR->product()); + foundPlayback_ = true; + } + } + + void PreMixingPileupCopy::putPileupInfo(edm::Event &e) { + if(foundPlayback_ ) { + e.put(std::make_unique(std::move(crossingFramePlaybackStorage_))); + } + e.put(std::make_unique >(std::move(pileupSummaryStorage_))); + e.put(std::make_unique(bsStorage_), "bunchSpacing"); + + // Gen. PU protons + for(size_t idx = 0; idx < genPUProtons_.size(); ++idx){ + e.put(std::make_unique >(std::move(genPUProtons_[idx])), + genPUProtons_labels_[idx]); + } + + // clear local storage after this event + pileupSummaryStorage_.clear(); + genPUProtons_.clear(); + genPUProtons_labels_.clear(); + } +} //edm diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.h b/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.h new file mode 100644 index 0000000000000..d2f1b32f1adbd --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingPileupCopy.h @@ -0,0 +1,62 @@ +#ifndef SimGeneral_PreMixingModule_PreMixingPileupCopy_h +#define SimGeneral_PreMixingModule_PreMixingPileupCopy_h + +/** \class PreMixingPileupCopy + * + * This class takes care of existing pileup information in the case of pre-mixing + * + * Originally from DataMixingModule, tailored further for premixing. + * + ************************************************************/ + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" + +#include "DataFormats/Provenance/interface/ProductID.h" +#include "DataFormats/Common/interface/Handle.h" + +#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" +#include "SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNew.h" + +#include +#include + +namespace reco { + class GenParticle; +} + +namespace edm { + class ModuleCallingContext; + + class PreMixingPileupCopy { + public: + PreMixingPileupCopy(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC); + ~PreMixingPileupCopy() = default; + + void addPileupInfo(edm::EventPrincipal const& ep, unsigned int EventId, ModuleCallingContext const* mcc); + const std::vector& getPileupSummaryInfo() const { return pileupSummaryStorage_; } + int getBunchSpacing() const { return bsStorage_; } + void putPileupInfo(edm::Event &e) ; + + private: + edm::InputTag pileupInfoInputTag_ ; // InputTag for PileupSummaryInfo + edm::InputTag bunchSpacingInputTag_ ; // InputTag for bunch spacing int + edm::InputTag cfPlaybackInputTag_ ; // InputTag for CrossingFrame Playback information + + std::vector genPUProtonsInputTags_ ; + + // deliver data from addPileupInfo() to getPileupInfo() and putPileupInfo() + CrossingFramePlaybackInfoNew crossingFramePlaybackStorage_; + std::vector pileupSummaryStorage_; + int bsStorage_; + + std::vector genPUProtons_labels_; + std::vector > genPUProtons_; + + bool foundPlayback_; + }; +}//edm + +#endif diff --git a/SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc similarity index 77% rename from SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.cc rename to SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc index 4e4d5da5c7a3f..f0d6249b364e4 100644 --- a/SimGeneral/DataMixingModule/plugins/DataMixingSiPixelMCDigiWorker.cc +++ b/SimGeneral/PreMixingModule/plugins/PreMixingSiPixelWorker.cc @@ -1,20 +1,25 @@ -// File: DataMixingSiPixelWorker.cc -// Description: see DataMixingSiPixelMCDigiWorker.h -// Author: Mike Hildreth, University of Notre Dame -// -//-------------------------------------------- - -#include -#include #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/EDMException.h" -#include "FWCore/Framework/interface/ConstProductRegistry.h" #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Provenance/interface/Provenance.h" -#include "DataFormats/Provenance/interface/BranchDescription.h" -// -// +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Utilities/interface/RandomNumberGenerator.h" + +//Data Formats +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSet.h" +#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" +#include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" + +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/CommonDetUnit/interface/GeomDet.h" +#include "Geometry/CommonDetUnit/interface/GeomDetType.h" +#include "CondFormats/DataRecord/interface/SiPixelDynamicInefficiencyRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelDynamicInefficiency.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h" @@ -26,37 +31,116 @@ #include "CLHEP/Random/RandFlat.h" -#include "DataMixingSiPixelMCDigiWorker.h" +#include "PreMixingWorker.h" + +#include +#include +namespace edm { + class ModuleCallingContext; + + class PreMixingSiPixelWorker: public PreMixingWorker { + public: + PreMixingSiPixelWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC); + ~PreMixingSiPixelWorker() override = default; + + void initializeEvent(edm::Event const& e, edm::EventSetup const& c) override; + void addSignals(edm::Event const& e, edm::EventSetup const& es) override; + void addPileups(int bcr, edm::EventPrincipal const&, int EventId, edm::EventSetup const& es, ModuleCallingContext const*) override; + void put(edm::Event &e, edm::EventSetup const& iSetup, std::vector const& ps, int bs) override; + + private: + void setPileupInfo(const std::vector &ps, const int &bs); //this sets pu_scale + + void init_DynIneffDB(const edm::EventSetup&, const unsigned int&); + + // + // PixelEfficiencies struct + // + /** + * Internal use only. + */ + struct PixelEfficiencies { + PixelEfficiencies(const edm::ParameterSet& conf, bool AddPixelInefficiency, int NumberOfBarrelLayers, int NumberOfEndcapDisks); + bool FromConfig; // If true read from Config, otherwise use Database + + double theInstLumiScaleFactor; + std::vector pu_scale; // in config: 0-3 BPix, 4-5 FPix (inner, outer) + std::vector > thePUEfficiency; // Instlumi dependent efficiency + double thePixelEfficiency[20]; // Single pixel effciency + double thePixelColEfficiency[20]; // Column effciency + double thePixelChipEfficiency[20]; // ROC efficiency + std::vector theLadderEfficiency_BPix[20]; // Ladder efficiency + std::vector theModuleEfficiency_BPix[20]; // Module efficiency + double theInnerEfficiency_FPix[20]; // Fpix inner module efficiency + double theOuterEfficiency_FPix[20]; // Fpix outer module efficiency + unsigned int FPixIndex; // The Efficiency index for FPix Disks + // Read factors from DB and fill containers + std::map PixelGeomFactors; + std::map ColGeomFactors; + std::map ChipGeomFactors; + std::map iPU; + + void init_from_db(const edm::ESHandle&, const edm::ESHandle&); + bool matches(const DetId&, const DetId&, const std::vector&); + + }; + edm::InputTag pixeldigi_collectionSig_ ; // secondary name given to collection of SiPixel digis + edm::InputTag pixeldigi_collectionPile_ ; // secondary name given to collection of SiPixel digis + std::string PixelDigiCollectionDM_ ; // secondary name to be given to new SiPixel digis + + edm::EDGetTokenT > PixelDigiToken_ ; // Token to retrieve information + edm::EDGetTokenT > PixelDigiPToken_ ; // Token to retrieve information + + edm::ESHandle pDD; + + // Get Dynamic Inefficiency scale factors from DB + edm::ESHandle SiPixelDynamicInefficiency_; + + + // + // Internal typedefs + + typedef int Amplitude; + typedef std::map > signal_map_type; // from Digi.Skel. + typedef signal_map_type::iterator signal_map_iterator; // from Digi.Skel. + typedef signal_map_type::const_iterator signal_map_const_iterator; // from Digi.Skel. + typedef std::map signalMaps; + + // Contains the accumulated hit info. + signalMaps _signal; -using namespace std; + typedef std::multimap OneDetectorMap; // maps by pixel ID for later combination - can have duplicate pixels + typedef std::map SiGlobalIndex; // map to all data for each detector ID -namespace edm -{ + SiGlobalIndex SiHitStorage_; - // Virtual constructor + const std::string geometryType_; - // DataMixingSiPixelMCDigiWorker::DataMixingSiPixelMCDigiWorker() { } + //-- Allow for upgrades + const int NumberOfBarrelLayers; // Default = 3 + const int NumberOfEndcapDisks; // Default = 2 + + const bool AddPixelInefficiency; // bool to read in inefficiencies + + PixelEfficiencies pixelEff_; + + bool FirstCall_; + + }; // Constructor - DataMixingSiPixelMCDigiWorker::DataMixingSiPixelMCDigiWorker(const edm::ParameterSet& ps, edm::ConsumesCollector && iC) : - label_(ps.getParameter("Label")), - geometryType_(ps.getParameter("GeometryType")), + PreMixingSiPixelWorker::PreMixingSiPixelWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC): + geometryType_(ps.getParameter("PixGeometryType")), // get external parameters: // To account for upgrade geometries do not assume the number // of layers or disks. NumberOfBarrelLayers(ps.exists("NumPixelBarrel")?ps.getParameter("NumPixelBarrel"):3), NumberOfEndcapDisks(ps.exists("NumPixelEndcap")?ps.getParameter("NumPixelEndcap"):2), - //theInstLumiScaleFactor(ps.getParameter("theInstLumiScaleFactor")), //For dynamic inefficiency PU scaling - //bunchScaleAt25(ps.getParameter("bunchScaleAt25")), //For dynamic inefficiency bunchspace scaling // Control the pixel inefficiency AddPixelInefficiency(ps.getParameter("AddPixelInefficiency")), pixelEff_(ps, AddPixelInefficiency,NumberOfBarrelLayers,NumberOfEndcapDisks) { - - // get the subdetector names - // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do... - // declare the products to produce pixeldigi_collectionSig_ = ps.getParameter("pixeldigiCollectionSig"); @@ -66,30 +150,23 @@ namespace edm PixelDigiToken_ = iC.consumes >(pixeldigi_collectionSig_); PixelDigiPToken_ = iC.consumes >(pixeldigi_collectionPile_); + producer.produces< edm::DetSetVector > (PixelDigiCollectionDM_); + // clear local storage for this event SiHitStorage_.clear(); FirstCall_ = true; } - - - // Virtual destructor needed. - DataMixingSiPixelMCDigiWorker::~DataMixingSiPixelMCDigiWorker() { - } // Need an event initialization - void DataMixingSiPixelMCDigiWorker::initializeEvent(edm::Event const& e, edm::EventSetup const& iSetup) { - + void PreMixingSiPixelWorker::initializeEvent(edm::Event const& e, edm::EventSetup const& iSetup) { iSetup.get().get(geometryType_, pDD); - //edm::ESHandle tTopoHand; - //iSetup.get().get(tTopoHand); - //const TrackerTopology *tTopo=tTopoHand.product(); } - DataMixingSiPixelMCDigiWorker::PixelEfficiencies::PixelEfficiencies(const edm::ParameterSet& conf, bool AddPixelInefficiency, int NumberOfBarrelLayers, int NumberOfEndcapDisks) { + PreMixingSiPixelWorker::PixelEfficiencies::PixelEfficiencies(const edm::ParameterSet& conf, bool AddPixelInefficiency, int NumberOfBarrelLayers, int NumberOfEndcapDisks) { // pixel inefficiency // Don't use Hard coded values, read inefficiencies in from DB/python config or don't use any int NumberOfTotLayers = NumberOfBarrelLayers + NumberOfEndcapDisks; @@ -214,7 +291,7 @@ namespace edm } // Read DynIneff Scale factors from DB -void DataMixingSiPixelMCDigiWorker::init_DynIneffDB(const edm::EventSetup& es, const unsigned int& bunchspace){ +void PreMixingSiPixelWorker::init_DynIneffDB(const edm::EventSetup& es, const unsigned int& bunchspace){ if (AddPixelInefficiency&&!pixelEff_.FromConfig) { if (bunchspace == 50) es.get().get("50ns",SiPixelDynamicInefficiency_); else es.get().get(SiPixelDynamicInefficiency_); @@ -222,7 +299,7 @@ void DataMixingSiPixelMCDigiWorker::init_DynIneffDB(const edm::EventSetup& es, c } } -void DataMixingSiPixelMCDigiWorker::PixelEfficiencies::init_from_db(const edm::ESHandle& geom, const edm::ESHandle& SiPixelDynamicInefficiency) { +void PreMixingSiPixelWorker::PixelEfficiencies::init_from_db(const edm::ESHandle& geom, const edm::ESHandle& SiPixelDynamicInefficiency) { theInstLumiScaleFactor = SiPixelDynamicInefficiency->gettheInstLumiScaleFactor(); const std::map& PixelGeomFactorsDB = SiPixelDynamicInefficiency->getPixelGeomFactors(); @@ -265,7 +342,7 @@ void DataMixingSiPixelMCDigiWorker::PixelEfficiencies::init_from_db(const edm::E pu_scale.resize(thePUEfficiency.size()); } -bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& detid, const DetId& db_id, const std::vector& DetIdmasks) { +bool PreMixingSiPixelWorker::PixelEfficiencies::matches(const DetId& detid, const DetId& db_id, const std::vector& DetIdmasks) { if (detid.subdetId() != db_id.subdetId()) return false; for (size_t i=0; i adding MC signals for "< adding MC signals for "< > input; @@ -293,7 +370,7 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti for (; DSViter!=input->end();DSViter++){ #ifdef DEBUG - LogDebug("DataMixingSiPixelMCDigiWorker") << "Processing DetID " << DSViter->id; + LogDebug("PreMixingSiPixelWorker") << "Processing DetID " << DSViter->id; #endif uint32_t detID = DSViter->id; @@ -315,32 +392,26 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti - void DataMixingSiPixelMCDigiWorker::addSiPixelPileups(const int bcr, const EventPrincipal *ep, unsigned int eventNr, - ModuleCallingContext const* mcc) { + void PreMixingSiPixelWorker::addPileups(int bcr, EventPrincipal const& ep, int eventNr, + edm::EventSetup const& es, ModuleCallingContext const* mcc) { - LogDebug("DataMixingSiPixelMCDigiWorker") <<"\n===============> adding pileups from event "<id()<<" for bunchcrossing "< adding pileups from event "< > const> inputPTR = - getProductByTag >(*ep, pixeldigi_collectionPile_, mcc); + getProductByTag >(ep, pixeldigi_collectionPile_, mcc); if(inputPTR ) { - const edm::DetSetVector *input = const_cast< edm::DetSetVector * >(inputPTR->product()); - - - - // Handle< edm::DetSetVector > input; - - // if( e->getByLabel(pixeldigi_collectionPile_,input) ) { + const edm::DetSetVector *input = inputPTR->product(); //loop on all detsets (detectorIDs) inside the input collection edm::DetSetVector::const_iterator DSViter=input->begin(); for (; DSViter!=input->end();DSViter++){ #ifdef DEBUG - LogDebug("DataMixingSiPixelMCDigiWorker") << "Pileups: Processing DetID " << DSViter->id; + LogDebug("PreMixingSiPixelWorker") << "Pileups: Processing DetID " << DSViter->id; #endif uint32_t detID = DSViter->id; @@ -383,7 +454,7 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti - void DataMixingSiPixelMCDigiWorker::putSiPixel(edm::Event &e, edm::EventSetup const& iSetup, std::vector &ps, int &bs) { + void PreMixingSiPixelWorker::put(edm::Event &e, edm::EventSetup const& iSetup, std::vector const& ps, int bs) { // collection of Digis to put in the event @@ -427,8 +498,6 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254; Signals.insert( std::make_pair(formerPixel, ADCSum)); - //PixelDigi aHit(formerPixel, ADCSum); - //SPD.push_back( aHit ); } // save pointers for next iteration formerPixel = currentPixel; @@ -440,7 +509,6 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti if (ADCSum > 511) ADCSum = 255; else if (ADCSum > 253 && ADCSum < 512) ADCSum = 254; Signals.insert( std::make_pair(formerPixel, ADCSum)); - //SPD.push_back( PixelDigi(formerPixel, ADCSum) ); } }// end of loop over one detector @@ -451,7 +519,7 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti } // end of big loop over all detector IDs // put the collection of digis in the event - LogInfo("DataMixingSiPixelMCDigiWorker") << "total # Merged Pixels: " << _signal.size() ; + LogInfo("PreMixingSiPixelWorker") << "total # Merged Pixels: " << _signal.size() ; // Now, we have to run Lumi-Dependent efficiency calculation on the merged pixels. // This is the only place where we have the PreMixed pileup information so that we can calculate @@ -510,7 +578,6 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti pixelEfficiency = pixelEff_.thePixelEfficiency[layerIndex-1]; columnEfficiency = pixelEff_.thePixelColEfficiency[layerIndex-1]; chipEfficiency = pixelEff_.thePixelChipEfficiency[layerIndex-1]; - //std::cout <<"Using BPix columnEfficiency = "<416) LogWarning ("Pixel Geometry") <<" wrong columns in barrel "<layer(detID)+pixelEff_.FPixIndex; // Use diskIndex-1 later to stay consistent with BPix unsigned int panelIndex=tTopo->pxfPanel(detID); unsigned int moduleIndex=tTopo->pxfModule(detID); - //if (pixelEff_.FPixIndex>diskIndex-1){throw cms::Exception("Configuration") <<"SiPixelDigitizer is using the wrong efficiency value. index = " - // <pxfDisk(detID);} pixelEfficiency = pixelEff_.thePixelEfficiency[diskIndex-1]; columnEfficiency = pixelEff_.thePixelColEfficiency[diskIndex-1]; chipEfficiency = pixelEff_.thePixelChipEfficiency[diskIndex-1]; - //std::cout <<"Using FPix columnEfficiency = "< chipEfficiency ) chips[iter->first]=0; } // Delete some Dcol hits. for ( iter = columns.begin(); iter != columns.end() ; iter++ ) { - //float rand = RandFlat::shoot(); float rand = CLHEP::RandFlat::shoot(engine); if( rand > columnEfficiency ) columns[iter->first]=0; } @@ -614,7 +676,6 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti // Loop over hit pixels, amplitude in electrons, channel = coded row,col for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) { - // int chan = i->first; std::pair ip = PixelDigi::channelToPixel(i->first);//get pixel pos int row = ip.first; // X in row int col = ip.second; // Y is in col @@ -624,7 +685,6 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti //dcol in mod int dColInDet = pIndexConverter->DColumnInModule(dColInChip,chipIndex); - //float rand = RandFlat::shoot(); float rand = CLHEP::RandFlat::shoot(engine); if( chips[chipIndex]==0 || columns[dColInDet]==0 || rand>pixelEfficiency ) { @@ -657,11 +717,7 @@ bool DataMixingSiPixelMCDigiWorker::PixelEfficiencies::matches(const DetId& deti SiHitStorage_.clear(); } -void DataMixingSiPixelMCDigiWorker::setPileupInfo(const std::vector &ps, const int &bunchSpacing) { - - //double bunchScale=1.0; - //if (bunchSpacing==25) bunchScale=bunchScaleAt25; - +void PreMixingSiPixelWorker::setPileupInfo(const std::vector &ps, const int &bunchSpacing) { int p = -1; for ( unsigned int i=0; i -#include -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/EDMException.h" -#include "FWCore/Framework/interface/ConstProductRegistry.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" #include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Provenance/interface/Provenance.h" -#include "DataFormats/Provenance/interface/BranchDescription.h" #include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" #include "CalibTracker/Records/interface/SiStripDependentRecords.h" -// + +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Utilities/interface/RandomNumberGenerator.h" + +//Data Formats +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSet.h" +#include "DataFormats/SiStripDigi/interface/SiStripDigi.h" + +#include "CondFormats/SiStripObjects/interface/SiStripNoises.h" +#include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" +#include "CondFormats/SiStripObjects/interface/SiStripThreshold.h" +#include "CalibFormats/SiStripObjects/interface/SiStripGain.h" +#include "SimTracker/SiStripDigitizer/interface/SiTrivialDigitalConverter.h" +#include "SimTracker/SiStripDigitizer/interface/SiGaussianTailNoiseAdder.h" +#include "RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h" + +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/CommonDetUnit/interface/GeomDet.h" +#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h" +#include "Geometry/CommonTopologies/interface/StripTopology.h" +#include "Geometry/CommonDetUnit/interface/GeomDetType.h" + #include "CLHEP/Random/RandFlat.h" -// -#include "DataMixingSiStripMCDigiWorker.h" -using namespace std; +#include "PreMixingWorker.h" + +#include +#include + +class PileupSummaryInfo; + +namespace edm { + class PreMixingSiStripWorker: public PreMixingWorker { + public: + PreMixingSiStripWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC); + ~PreMixingSiStripWorker() override = default; + + void initializeEvent(edm::Event const& e, edm::EventSetup const& c) override; + void addSignals(edm::Event const& e, edm::EventSetup const& es) override; + void addPileups(int bcr, edm::EventPrincipal const& ep, int EventId, edm::EventSetup const& es, ModuleCallingContext const*) override; + void put(edm::Event &e, edm::EventSetup const& iSetup, std::vector const& ps, int bs) override; + + private: + void DMinitializeDetUnit(StripGeomDetUnit const * det, const edm::EventSetup& iSetup ); + + // data specifiers + + edm::InputTag SistripLabelSig_ ; // name given to collection of SiStrip digis + edm::InputTag SiStripPileInputTag_ ; // InputTag for pileup strips + std::string SiStripDigiCollectionDM_ ; // secondary name to be given to new SiStrip digis + + edm::InputTag SistripAPVLabelSig_; // where to find vector of dead APVs + edm::InputTag SiStripAPVPileInputTag_; + std::string SistripAPVListDM_; // output tag + + + // + + typedef float Amplitude; + typedef std::pair RawDigi; // Replacement for SiStripDigi with pulse height instead of integer ADC + typedef std::vector OneDetectorMap; // maps by strip ID for later combination - can have duplicate strips + typedef std::vector OneDetectorRawMap; // maps by strip ID for later combination - can have duplicate strips + typedef std::map SiGlobalIndex; // map to all data for each detector ID + typedef std::map SiGlobalRawIndex; // map to all data for each detector ID + + typedef SiDigitalConverter::DigitalVecType DigitalVecType; -namespace edm -{ + SiGlobalIndex SiHitStorage_; + SiGlobalRawIndex SiRawDigis_; - // Virtual constructor + // variables for temporary storage of mixed hits: + typedef std::map SignalMapType; + typedef std::map signalMaps; - DataMixingSiStripMCDigiWorker::DataMixingSiStripMCDigiWorker() { } + const SignalMapType* getSignal(uint32_t detID) const { + auto where = signals_.find(detID); + if(where == signals_.end()) { + return nullptr; + } + return &where->second; + } + + signalMaps signals_; + + // to keep track of dead APVs from HIP interactions + typedef std::multimap< uint32_t, std::bitset<6> > APVMap; + + APVMap theAffectedAPVmap_; + + // for noise adding: + + std::string gainLabel; + bool SingleStripNoise; + bool peakMode; + double theThreshold; + double theElectronPerADC; + bool APVSaturationFromHIP_; + int theFedAlgo; + std::string geometryType; + + std::unique_ptr theSiNoiseAdder; + std::unique_ptr theSiZeroSuppress; + std::unique_ptr theSiDigitalConverter; + + edm::ESHandle pDD; + + // bad channels for each detector ID + std::map > allBadChannels; + // channels killed by HIP interactions for each detector ID + std::map > allHIPChannels; + // first and last channel wit signal for each detector ID + std::map firstChannelsWithSignal; + std::map lastChannelsWithSignal; + + //---------------------------- + + class StrictWeakOrdering{ + public: + bool operator() (SiStripDigi i,SiStripDigi j) const {return i.strip() < j.strip();} + }; - // Constructor - DataMixingSiStripMCDigiWorker::DataMixingSiStripMCDigiWorker(const edm::ParameterSet& ps, - edm::ConsumesCollector && iC) : - label_(ps.getParameter("Label")), + class StrictWeakRawOrdering{ + public: + bool operator() (RawDigi i,RawDigi j) const {return i.first < j.first;} + }; + + }; + + PreMixingSiStripWorker::PreMixingSiStripWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC): gainLabel(ps.getParameter("Gain")), SingleStripNoise(ps.getParameter("SingleStripNoise")), peakMode(ps.getParameter("APVpeakmode")), @@ -46,10 +150,6 @@ namespace edm theSiDigitalConverter(new SiTrivialDigitalConverter(theElectronPerADC, false)) // no premixing { - - // get the subdetector names - // this->getSubdetectorNames(); //something like this may be useful to check what we are supposed to do... - // declare the products to produce SistripLabelSig_ = ps.getParameter("SistripLabelSig"); @@ -58,6 +158,7 @@ namespace edm SiStripDigiCollectionDM_ = ps.getParameter("SiStripDigiCollectionDM"); SistripAPVListDM_= ps.getParameter("SiStripAPVListDM"); + producer.produces< edm::DetSetVector > (SiStripDigiCollectionDM_); if(APVSaturationFromHIP_) { SistripAPVLabelSig_ = ps.getParameter("SistripAPVLabelSig"); @@ -77,18 +178,9 @@ namespace edm } theSiNoiseAdder.reset(new SiGaussianTailNoiseAdder(theThreshold)); - - // theSiZeroSuppress = new SiStripFedZeroSuppression(theFedAlgo); - //theSiDigitalConverter(new SiTrivialDigitalConverter(theElectronPerADC)); - } - - // Virtual destructor needed. - DataMixingSiStripMCDigiWorker::~DataMixingSiStripMCDigiWorker() { - } - - void DataMixingSiStripMCDigiWorker::initializeEvent(const edm::Event &e, edm::EventSetup const& iSetup) { + void PreMixingSiStripWorker::initializeEvent(const edm::Event &e, edm::EventSetup const& iSetup) { // initialize individual detectors so we can copy real digitization code: iSetup.get().get(geometryType,pDD); @@ -110,7 +202,7 @@ namespace edm } - void DataMixingSiStripMCDigiWorker::DMinitializeDetUnit(StripGeomDetUnit const * det, const edm::EventSetup& iSetup ) { + void PreMixingSiStripWorker::DMinitializeDetUnit(StripGeomDetUnit const * det, const edm::EventSetup& iSetup ) { edm::ESHandle deadChannelHandle; iSetup.get().get(deadChannelHandle); @@ -136,7 +228,7 @@ namespace edm } - void DataMixingSiStripMCDigiWorker::addSiStripSignals(const edm::Event &e) { + void PreMixingSiStripWorker::addSignals(const edm::Event &e, edm::EventSetup const& es) { // fill in maps of hits Handle< edm::DetSetVector > input; @@ -149,7 +241,7 @@ namespace edm for (; DSViter!=input->end();DSViter++){ #ifdef DEBUG - LogDebug("DataMixingSiStripMCDigiWorker") << "Processing DetID " << DSViter->id; + LogDebug("PreMixingSiStripWorker") << "Processing DetID " << DSViter->id; #endif LocalMap.clear(); @@ -178,23 +270,18 @@ namespace edm - void DataMixingSiStripMCDigiWorker::addSiStripPileups(const int bcr, const EventPrincipal *ep, unsigned int eventNr, - ModuleCallingContext const* mcc) { - LogDebug("DataMixingSiStripMCDigiWorker") <<"\n===============> adding pileups from event "<id()<<" for bunchcrossing "< adding pileups from event "< > const> inputPTR = - getProductByTag >(*ep, SiStripPileInputTag_, mcc); + getProductByTag >(ep, SiStripPileInputTag_, mcc); if(inputPTR ) { const edm::DetSetVector *input = const_cast< edm::DetSetVector * >(inputPTR->product()); - // Handle< edm::DetSetVector > input; - - // if( e->getByLabel(Sistripdigi_collectionPile_.label(),SistripLabelPile_.label(),input) ) { - OneDetectorMap LocalMap; //loop on all detsets (detectorIDs) inside the input collection @@ -202,7 +289,7 @@ namespace edm for (; DSViter!=input->end();DSViter++){ #ifdef DEBUG - LogDebug("DataMixingSiStripMCDigiWorker") << "Pileups: Processing DetID " << DSViter->id; + LogDebug("PreMixingSiStripWorker") << "Pileups: Processing DetID " << DSViter->id; #endif // find correct local map (or new one) for this detector ID @@ -217,7 +304,7 @@ namespace edm // fill in local map with extra channels LocalMap.insert(LocalMap.end(),(DSViter->data).begin(),(DSViter->data).end()); - std::stable_sort(LocalMap.begin(),LocalMap.end(),DataMixingSiStripMCDigiWorker::StrictWeakOrdering()); + std::stable_sort(LocalMap.begin(),LocalMap.end(),PreMixingSiStripWorker::StrictWeakOrdering()); SiHitStorage_[DSViter->id]=LocalMap; } @@ -233,7 +320,7 @@ namespace edm if(APVSaturationFromHIP_) { std::shared_ptr> > > const> inputAPVPTR = - getProductByTag< std::vector> > >(*ep, SiStripAPVPileInputTag_, mcc); + getProductByTag< std::vector> > >(ep, SiStripAPVPileInputTag_, mcc); if(inputAPVPTR) { @@ -250,7 +337,7 @@ namespace edm - void DataMixingSiStripMCDigiWorker::putSiStrip(edm::Event &e, edm::EventSetup const& iSetup) { + void PreMixingSiStripWorker::put(edm::Event &e, edm::EventSetup const& iSetup, std::vector const& ps, int bs) { // set up machinery to do proper noise adding: edm::ESHandle gainHandle; @@ -507,7 +594,6 @@ namespace edm size_t lastChannelWithSignal = numStrips; if(SingleStripNoise){ - // std::cout<<"In SSN, detId="< noiseRMSv; noiseRMSv.clear(); noiseRMSv.insert(noiseRMSv.begin(),numStrips,0.); @@ -515,7 +601,6 @@ namespace edm if(!badChannels[strip]){ float gainValue = gainHandle->getStripGain(strip, detGainRange); noiseRMSv[strip] = (noiseHandle->getNoise(strip,detNoiseRange))* theElectronPerADC/gainValue; - //std::cout<<": gainValue: "<addNoiseVR(detAmpl, noiseRMSv, engine); @@ -529,7 +614,6 @@ namespace edm float RefnoiseRMS = noiseHandle->getNoise(RefStrip,detNoiseRange) *theElectronPerADC/RefgainValue; theSiNoiseAdder->addNoise(detAmpl,firstChannelWithSignal,lastChannelWithSignal,numStrips,RefnoiseRMS, engine); - //std::cout<<": RefgainValue: "< 0) { - // std::cout << " Real SiS Mixed Digi: " << detID << " ADC values "; - // for(const auto& iDigi : digis) { std::cout << iDigi.adc() << " " ;} - // std::cout << std::endl; - //} // stick this into the global vector of detector info vSiStripDigi.push_back(SSD); @@ -552,7 +631,7 @@ namespace edm } // end of big loop over all detector IDs // put the collection of digis in the event - LogInfo("DataMixingSiStripMCDigiWorker") << "total # Merged strips: " << vSiStripDigi.size() ; + LogInfo("PreMixingSiStripWorker") << "total # Merged strips: " << vSiStripDigi.size() ; // make new digi collection @@ -569,3 +648,6 @@ namespace edm } } //edm + +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingSiStripWorker, "PreMixingSiStripWorker"); diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc b/SimGeneral/PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc new file mode 100644 index 0000000000000..ba1636376c691 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingTrackingParticleWorker.cc @@ -0,0 +1,156 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventPrincipal.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "DataFormats/Common/interface/Handle.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h" + +#include "PreMixingWorker.h" + +namespace edm { + class PreMixingTrackingParticleWorker: public PreMixingWorker { + public: + PreMixingTrackingParticleWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC); + ~PreMixingTrackingParticleWorker() override = default; + + void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) override; + void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) override; + void addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) override; + void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) override; + + private: + void add(const std::vector& particles, const std::vector& vertices); + + edm::EDGetTokenT > TrackSigToken_; // Token to retrieve information + edm::EDGetTokenT > VtxSigToken_; // Token to retrieve information + + edm::InputTag TrackingParticlePileInputTag_ ; // InputTag for pileup tracks + + std::string TrackingParticleCollectionDM_; // secondary name to be given to new TrackingParticle + + + std::unique_ptr> NewTrackList_; + std::unique_ptr> NewVertexList_; + TrackingParticleRefProd TrackListRef_; + TrackingVertexRefProd VertexListRef_; + }; + + PreMixingTrackingParticleWorker::PreMixingTrackingParticleWorker(const edm::ParameterSet& ps, edm::ProducerBase& producer, edm::ConsumesCollector && iC): + TrackSigToken_(iC.consumes >(ps.getParameter("labelSig"))), + VtxSigToken_ (iC.consumes >(ps.getParameter("labelSig"))), + TrackingParticlePileInputTag_(ps.getParameter("pileInputTag")), + TrackingParticleCollectionDM_(ps.getParameter("collectionDM")) + { + producer.produces< std::vector >(TrackingParticleCollectionDM_); + producer.produces< std::vector >(TrackingParticleCollectionDM_); + } + + + void PreMixingTrackingParticleWorker::initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) { + NewTrackList_ = std::make_unique>(); + NewVertexList_ = std::make_unique>(); + + // need RefProds in order to re-key the particle<->vertex refs + // TODO: try to remove const_cast, requires making Event non-const in BMixingModule::initializeEvent + TrackListRef_ = const_cast(iEvent).getRefBeforePut< std::vector >(TrackingParticleCollectionDM_); + VertexListRef_ = const_cast(iEvent).getRefBeforePut< std::vector >(TrackingParticleCollectionDM_); + } + + void PreMixingTrackingParticleWorker::addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) { + edm::Handle> tracks; + iEvent.getByToken(TrackSigToken_, tracks); + + edm::Handle> vtxs; + iEvent.getByToken(VtxSigToken_, vtxs); + + if(tracks.isValid() && vtxs.isValid()) { + add(*tracks, *vtxs); + } + } + + void PreMixingTrackingParticleWorker::addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) { + LogDebug("PreMixingTrackingParticleWorker") <<"\n===============> adding pileups from event "< > const> inputPTR = + getProductByTag >(ep, TrackingParticlePileInputTag_, mcc); + + std::shared_ptr > const> inputVPTR = + getProductByTag >(ep, TrackingParticlePileInputTag_, mcc); + + if(inputPTR && inputVPTR) { + add(*(inputPTR->product()), *(inputVPTR->product())); + } + } + + void PreMixingTrackingParticleWorker::add(const std::vector& particles, const std::vector& vertices) { + const size_t StartingIndexV = NewVertexList_->size(); + const size_t StartingIndexT = NewTrackList_->size(); + + // grab Vertices, store copy, preserving indices. Easier to loop over vertices first - fewer links + for(const auto& vtx: vertices) { + NewVertexList_->push_back(vtx); + } + + // grab tracks, store copy + for(const auto& track: particles) { + const auto& oldRef=track.parentVertex(); + auto newRef=TrackingVertexRef( VertexListRef_, oldRef.index()+StartingIndexV ); + NewTrackList_->push_back(track); + + auto & Ntrack = NewTrackList_->back(); //modify copy + + Ntrack.setParentVertex( newRef ); + Ntrack.clearDecayVertices(); + + // next, loop over daughter vertices, same strategy + for( auto const& vertexRef : track.decayVertices() ) { + auto newRef=TrackingVertexRef( VertexListRef_, vertexRef.index()+StartingIndexV ); + Ntrack.addDecayVertex(newRef); + } + } + + // Now that tracks are handled, go back and put correct Refs in vertices + // Operate only on the added pileup vertices, and leave the already-existing vertices untouched + std::vector sourceTrackIndices; + std::vector daughterTrackIndices; + for(size_t iVertex = StartingIndexV; iVertex != NewVertexList_->size(); ++iVertex) { + auto& vertex = (*NewVertexList_)[iVertex]; + + // Need to copy the indices before clearing the vectors + sourceTrackIndices.reserve(vertex.sourceTracks().size()); + daughterTrackIndices.reserve(vertex.daughterTracks().size()); + for(auto const& ref: vertex.sourceTracks()) sourceTrackIndices.push_back(ref.index()); + for(auto const& ref: vertex.daughterTracks()) daughterTrackIndices.push_back(ref.index()); + + vertex.clearParentTracks(); + vertex.clearDaughterTracks(); + + for( auto index : sourceTrackIndices ) { + auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); + vertex.addParentTrack(newRef); + } + + // next, loop over daughter tracks, same strategy + for( auto index : daughterTrackIndices ) { + auto newRef=TrackingParticleRef( TrackListRef_, index+StartingIndexT ); + vertex.addDaughterTrack(newRef); + } + + sourceTrackIndices.clear(); + daughterTrackIndices.clear(); + } + } + + void PreMixingTrackingParticleWorker::put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) { + LogInfo("PreMixingTrackingParticleWorker") << "total # Merged Tracks: " << NewTrackList_->size() ; + iEvent.put(std::move(NewTrackList_), TrackingParticleCollectionDM_); + iEvent.put(std::move(NewVertexList_), TrackingParticleCollectionDM_); + } +} + +#include "PreMixingWorkerFactory.h" +DEFINE_EDM_PLUGIN(PreMixingWorkerFactory, edm::PreMixingTrackingParticleWorker, "PreMixingTrackingParticleWorker"); diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingWorker.h b/SimGeneral/PreMixingModule/plugins/PreMixingWorker.h new file mode 100644 index 0000000000000..7f461b9776dc0 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingWorker.h @@ -0,0 +1,29 @@ +#ifndef SimGeneral_PreMixingModule_PreMixingWorker_h +#define SimGeneral_PreMixingModule_PreMixingWorker_h + +#include "FWCore/Framework/interface/Frameworkfwd.h" + +#include + +namespace edm { + class ModuleCallingContext; +} +class PileupSummaryInfo; + +class PreMixingWorker { +public: + PreMixingWorker() = default; + virtual ~PreMixingWorker() = default; + + virtual void beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {} + virtual void beginLuminosityBlock(edm::LuminosityBlock const& iLumi, edm::EventSetup const& iSetup) {} + virtual void initializeBunchCrossing(edm::Event const& iEvent, edm::EventSetup const& iSetup, int bunchCrossing) {} + virtual void finalizeBunchCrossing(edm::Event& iEvent, edm::EventSetup const& iSetup, int bunchCrossing) {} + + virtual void initializeEvent(edm::Event const& iEvent, edm::EventSetup const& iSetup) = 0; + virtual void addSignals(edm::Event const& iEvent, edm::EventSetup const& iSetup) = 0; + virtual void addPileups(int bcr, edm::EventPrincipal const& ep, int eventNr, edm::EventSetup const& iSetup, edm::ModuleCallingContext const *mcc) = 0; + virtual void put(edm::Event& iEvent, edm::EventSetup const& iSetup, std::vector const& ps, int bunchSpacing) = 0; +}; + +#endif diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.cc b/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.cc new file mode 100644 index 0000000000000..76db7a3d2c4fe --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.cc @@ -0,0 +1,3 @@ +#include "PreMixingWorkerFactory.h" + +EDM_REGISTER_PLUGINFACTORY(PreMixingWorkerFactory, "PreMixingWorkerFactory"); diff --git a/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.h b/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.h new file mode 100644 index 0000000000000..f22adbfbf70f6 --- /dev/null +++ b/SimGeneral/PreMixingModule/plugins/PreMixingWorkerFactory.h @@ -0,0 +1,15 @@ +#ifndef SimGeneral_PreMixingModule_PreMixingWorkerFactory_h +#define SimGeneral_PreMixingModule_PreMixingWorkerFactory_h + +#include "FWCore/Framework/interface/ProducerBase.h" +#include "FWCore/PluginManager/interface/PluginFactory.h" +#include "PreMixingWorker.h" + +namespace edm { + class ParameterSet; + class ConsumesCollector; +} + +using PreMixingWorkerFactory = edmplugin::PluginFactory< PreMixingWorker* (const edm::ParameterSet&, edm::ProducerBase&, edm::ConsumesCollector&& iC) >; + +#endif diff --git a/SimGeneral/PreMixingModule/python/mixOne_premix_on_sim_cfi.py b/SimGeneral/PreMixingModule/python/mixOne_premix_on_sim_cfi.py new file mode 100644 index 0000000000000..2547d779d3cb1 --- /dev/null +++ b/SimGeneral/PreMixingModule/python/mixOne_premix_on_sim_cfi.py @@ -0,0 +1,252 @@ +# This is the PreMixing config. Not only does it do a RawToDigi +# conversion to the secondary input source, it also holds its own +# instances of an EcalDigiProducer and an HcalDigitizer. It also +# replicates the noise adding functions in the SiStripDigitizer. +# +# Adapted from DataMixingModule + + +import FWCore.ParameterSet.Config as cms +from SimCalorimetry.HcalSimProducers.hcalUnsuppressedDigis_cfi import hcalSimBlock +from SimGeneral.MixingModule.SiStripSimParameters_cfi import SiStripSimBlock +from SimGeneral.MixingModule.SiPixelSimParameters_cfi import SiPixelSimBlock +from SimGeneral.MixingModule.ecalDigitizer_cfi import ecalDigitizer + +import EventFilter.EcalRawToDigi.EcalUnpackerData_cfi +import EventFilter.ESRawToDigi.esRawToDigi_cfi +import EventFilter.HcalRawToDigi.HcalRawToDigi_cfi +import EventFilter.DTRawToDigi.dtunpacker_cfi +import EventFilter.RPCRawToDigi.rpcUnpacker_cfi +import EventFilter.CSCRawToDigi.cscUnpacker_cfi +import EventFilter.SiStripRawToDigi.SiStripDigis_cfi +import EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi + +# content from Configuration/StandardSequences/DigiToRaw_cff.py + +ecalDigis = EventFilter.EcalRawToDigi.EcalUnpackerData_cfi.ecalEBunpacker.clone() + +ecalPreshowerDigis = EventFilter.ESRawToDigi.esRawToDigi_cfi.esRawToDigi.clone() + +hcalDigis = EventFilter.HcalRawToDigi.HcalRawToDigi_cfi.hcalDigis.clone() + +muonCSCDigis = EventFilter.CSCRawToDigi.cscUnpacker_cfi.muonCSCDigis.clone() + +muonDTDigis = EventFilter.DTRawToDigi.dtunpacker_cfi.muonDTDigis.clone() + +siStripDigis = EventFilter.SiStripRawToDigi.SiStripDigis_cfi.siStripDigis.clone() + +siPixelDigis = EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi.siPixelDigis.clone() + +siPixelDigis.InputLabel = 'rawDataCollector' +ecalDigis.InputLabel = 'rawDataCollector' +ecalPreshowerDigis.sourceTag = 'rawDataCollector' +hcalDigis.InputLabel = 'rawDataCollector' +muonCSCDigis.InputObjects = 'rawDataCollector' +muonDTDigis.inputLabel = 'rawDataCollector' + +hcalDigis.FilterDataQuality = cms.bool(False) +hcalSimBlock.HcalPreMixStage2 = cms.bool(True) + +mixData = cms.EDProducer("PreMixingModule", + input = cms.SecSource("EmbeddedRootSource", + producers = cms.VPSet(cms.convertToVPSet( + ecalDigis = ecalDigis, + ecalPreshowerDigis = ecalPreshowerDigis, + hcalDigis = hcalDigis, + muonDTDigis = muonDTDigis, + muonCSCDigis = muonCSCDigis, + siStripDigis = siStripDigis, + siPixelDigis = siPixelDigis, + )), + nbPileupEvents = cms.PSet( + averageNumber = cms.double(1.0) + ), + seed = cms.int32(1234567), + type = cms.string('fixed'), + sequential = cms.untracked.bool(False), # set to true for sequential reading of pileup + fileNames = cms.untracked.vstring('file:DMPreProcess_RAW2DIGI.root') + ), + # Mixing Module parameters + bunchspace = cms.int32(25), + minBunch = cms.int32(0), + maxBunch = cms.int32(0), + mixProdStep1 = cms.bool(False), + mixProdStep2 = cms.bool(False), + # Workers + workers = cms.PSet( + pileup = cms.PSet( + PileupInfoInputTag = cms.InputTag("addPileupInfo"), + BunchSpacingInputTag = cms.InputTag("addPileupInfo","bunchSpacing"), + CFPlaybackInputTag = cms.InputTag("mix"), + GenPUProtonsInputTags = cms.VInputTag("genPUProtons"), + ), + # Note: elements with "@MIXING" in the input tag are generated by + pixel = cms.PSet( + SiPixelSimBlock, + # + workerType = cms.string("PreMixingSiPixelWorker"), + # + pixeldigiCollectionSig = cms.InputTag("simSiPixelDigis"), + pixeldigiCollectionPile = cms.InputTag("siPixelDigis","","@MIXING"), + PixelDigiCollectionDM = cms.string('siPixelDigisDM'), + ), + strip = cms.PSet( + SiStripSimBlock, + # + workerType = cms.string("PreMixingSiStripWorker"), + # + SistripLabelSig = cms.InputTag("simSiStripDigis","ZeroSuppressed"), + SiStripPileInputTag = cms.InputTag("siStripDigis","ZeroSuppressed","@MIXING"), + # Dead APV Vector + SistripAPVPileInputTag = cms.InputTag("mix","AffectedAPVList"), + SistripAPVLabelSig = cms.InputTag("mix","AffectedAPVList"), + # output + SiStripDigiCollectionDM = cms.string('siStripDigisDM'), + SiStripAPVListDM = cms.string('SiStripAPVList'), + ), + ecal = cms.PSet( + ecalDigitizer.clone(accumulatorType = None, makeDigiSimLinks=None), + # + workerType = cms.string("PreMixingEcalWorker"), + # + EBdigiProducerSig = cms.InputTag("simEcalUnsuppressedDigis"), + EEdigiProducerSig = cms.InputTag("simEcalUnsuppressedDigis"), + ESdigiProducerSig = cms.InputTag("simEcalPreshowerDigis"), + # + EBPileInputTag = cms.InputTag("ecalDigis","ebDigis","@MIXING"), + EEPileInputTag = cms.InputTag("ecalDigis","eeDigis","@MIXING"), + ESPileInputTag = cms.InputTag("ecalPreshowerDigis","","@MIXING"), + # + EBDigiCollectionDM = cms.string(''), + EEDigiCollectionDM = cms.string(''), + ESDigiCollectionDM = cms.string(''), + ), + hcal = cms.PSet( + hcalSimBlock, + # + workerType = cms.string("PreMixingHcalWorker"), + # + HBHEdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + HOdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + HFdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + QIE10digiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + QIE11digiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + ZDCdigiCollectionSig = cms.InputTag("simHcalUnsuppressedDigis"), + # + HBHEPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), + HOPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), + HFPileInputTag = cms.InputTag("hcalDigis","","@MIXING"), + QIE10PileInputTag = cms.InputTag("hcalDigis","","@MIXING"), + QIE11PileInputTag = cms.InputTag("hcalDigis","","@MIXING"), + ZDCPileInputTag = cms.InputTag(""), + # + HBHEDigiCollectionDM = cms.string(''), + HODigiCollectionDM = cms.string(''), + HFDigiCollectionDM = cms.string(''), + QIE10DigiCollectionDM = cms.string(''), + QIE11DigiCollectionDM = cms.string(''), + ZDCDigiCollectionDM = cms.string('') + ), + dt = cms.PSet( + workerType = cms.string("PreMixingDTWorker"), + # + digiTagSig = cms.InputTag("simMuonDTDigis"), + pileInputTag = cms.InputTag("muonDTDigis","","@MIXING"), + collectionDM = cms.string(''), + ), + rpc = cms.PSet( + workerType = cms.string("PreMixingRPCWorker"), + # + digiTagSig = cms.InputTag("simMuonRPCDigis"), + pileInputTag = cms.InputTag("simMuonRPCDigis",""), + collectionDM = cms.string(''), + ), + csc = cms.PSet( + workerType = cms.string("PreMixingCSCWorker"), + # + strip = cms.PSet( + digiTagSig = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigi"), + pileInputTag = cms.InputTag("muonCSCDigis","MuonCSCStripDigi","@MIXING"), + collectionDM = cms.string('MuonCSCStripDigisDM'), + ), + wire = cms.PSet( + digiTagSig = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigi"), + pileInputTag = cms.InputTag("muonCSCDigis","MuonCSCWireDigi","@MIXING"), + collectionDM = cms.string('MuonCSCWireDigisDM'), + ), + comparator = cms.PSet( + digiTagSig = cms.InputTag("simMuonCSCDigis","MuonCSCComparatorDigi"), + pileInputTag = cms.InputTag("muonCSCDigis","MuonCSCComparatorDigi","@MIXING"), + collectionDM = cms.string('MuonCSCComparatorDigisDM'), + ), + ), + trackingTruth = cms.PSet( + workerType = cms.string("PreMixingTrackingParticleWorker"), + # + labelSig = cms.InputTag("mix","MergedTrackTruth"), + pileInputTag = cms.InputTag("mix","MergedTrackTruth"), + collectionDM = cms.string('MergedTrackTruth'), + ), + pixelSimLink = cms.PSet( + workerType = cms.string("PreMixingPixelDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simSiPixelDigis"), + pileInputTag = cms.InputTag("simSiPixelDigis"), + collectionDM = cms.string('PixelDigiSimLink'), + ), + stripSimLink = cms.PSet( + workerType = cms.string("PreMixingStripDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simSiStripDigis"), + pileInputTag = cms.InputTag("simSiStripDigis"), + collectionDM = cms.string('StripDigiSimLink'), + ), + dtSimLink = cms.PSet( + workerType = cms.string("PreMixingDTDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simMuonDTDigis"), + pileInputTag = cms.InputTag("simMuonDTDigis"), + collectionDM = cms.string('simMuonDTDigis'), + ), + rpcSimLink = cms.PSet( + workerType = cms.string("PreMixingRPCDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simMuonRPCDigis","RPCDigiSimLink"), + pileInputTag = cms.InputTag("simMuonRPCDigis","RPCDigiSimLink"), + collectionDM = cms.string('RPCDigiSimLink'), + ), + cscStripSimLink = cms.PSet( + workerType = cms.string("PreMixingStripDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigiSimLinks"), + pileInputTag = cms.InputTag("simMuonCSCDigis","MuonCSCStripDigiSimLinks"), + collectionDM = cms.string('MuonCSCStripDigiSimLinks'), + ), + cscWireSimLink = cms.PSet( + workerType = cms.string("PreMixingStripDigiSimLinkWorker"), + # + labelSig = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigiSimLinks"), + pileInputTag = cms.InputTag("simMuonCSCDigis","MuonCSCWireDigiSimLinks"), + collectionDM = cms.string('MuonCSCWireDigiSimLinks'), + ), + ), +) + + +from Configuration.Eras.Modifier_fastSim_cff import fastSim +from FastSimulation.Tracking.recoTrackAccumulator_cfi import recoTrackAccumulator as _recoTrackAccumulator +fastSim.toModify(mixData, + # from signal: mix tracks not strip or pixel digis + workers = dict( + pixel = None, + strip = None, + pixelSimLink = None, + stripSimLink = None, + tracks = cms.PSet( + workerType = cms.string("PreMixingDigiAccumulatorWorker"), + accumulator = _recoTrackAccumulator.clone( + pileUpTracks = "mix:generalTracks" + ) + ) + ), +) diff --git a/SimGeneral/TrackingAnalysis/python/simHitTPAssociation_cfi.py b/SimGeneral/TrackingAnalysis/python/simHitTPAssociation_cfi.py index 2c251718a8d80..ffcde897870b0 100644 --- a/SimGeneral/TrackingAnalysis/python/simHitTPAssociation_cfi.py +++ b/SimGeneral/TrackingAnalysis/python/simHitTPAssociation_cfi.py @@ -29,3 +29,6 @@ "MuonSimHits:MuonDTHits", "MuonSimHits:MuonRPCHits"] ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(simHitTPAssocProducer, trackingParticleSrc = "mixData:MergedTrackTruth") diff --git a/SimGeneral/TrackingAnalysis/python/trackingParticleNumberOfLayersProducer_cff.py b/SimGeneral/TrackingAnalysis/python/trackingParticleNumberOfLayersProducer_cff.py index 646386efb873e..98353db571132 100644 --- a/SimGeneral/TrackingAnalysis/python/trackingParticleNumberOfLayersProducer_cff.py +++ b/SimGeneral/TrackingAnalysis/python/trackingParticleNumberOfLayersProducer_cff.py @@ -3,3 +3,6 @@ fastSim.toModify(trackingParticleNumberOfLayersProducer, simHits=['fastSimProducer:TrackerHits']) from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker phase2_tracker.toModify(trackingParticleNumberOfLayersProducer, simHits = ["g4SimHits:TrackerHitsPixelBarrelLowTof", "g4SimHits:TrackerHitsPixelEndcapLowTof"]) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleNumberOfLayersProducer, trackingParticles = "mixData:MergedTrackTruth") diff --git a/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py b/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py index fa9800bce1aa0..d36d9f9f25af3 100644 --- a/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py +++ b/SimMuon/CSCDigitizer/python/muonCSCDigis_cfi.py @@ -24,7 +24,8 @@ timingCalibrationError = cms.vdouble(0., 4.2, 4.2, 0., 0., 0., 0., 0., 0., 0., 0.), # parameters for tuning timing scaTimingOffsets = cms.vdouble(0.0, 10., 10., 0.,0.,0.,0.,0.,0.,0.,0.), - comparatorTimeBinOffset = cms.double(3.0), + ## this offset ensures that the central CLCT BX is 7 in simulation + comparatorTimeBinOffset = cms.double(4.0), comparatorSamplingTime = cms.double(25.0), scaPeakBin = cms.int32(5), pedestalSigma = cms.double(1.5), @@ -63,7 +64,7 @@ peakTimeSigma = cms.double(0.0), shapingTime = cms.int32(30), readBadChannels = cms.bool(False), - timeBitForBxZero = cms.int32(6), + timeBitForBxZero = cms.int32(8), samplingTime = cms.double(5.0), # bunchTimingOffsets - comments for strips (above) also apply bunchTimingOffsets = cms.vdouble(0.00, 21.64, 21.64, 28.29, 29.36, 29.33, 28.57, 28.61, 28.83, 29.09, 28.22), diff --git a/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py b/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py index b5cd7398ff53c..7092fcdcfbe16 100644 --- a/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py +++ b/SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py @@ -94,6 +94,13 @@ inputCSCSegmentCollection = cms.InputTag("cscSegments"), ) +from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM +from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker +run3_GEM.toModify(muonAssociatorByHitsCommonParameters, useGEMs = True) +phase2_tracker.toModify(muonAssociatorByHitsCommonParameters, + usePhase2Tracker = True, + pixelSimLinkSrc = "simSiPixelDigis:Pixel", +) from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toModify(muonAssociatorByHitsCommonParameters, @@ -107,6 +114,16 @@ RPCsimhitsXFTag = "mix:MuonSimHitsMuonRPCHits", ROUList = ['fastSimProducerTrackerHits'] ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(muonAssociatorByHitsCommonParameters, + DTdigisimlinkTag = "mixData:simMuonDTDigis", + CSClinksTag = "mixData:MuonCSCStripDigiSimLinks", + CSCwireLinksTag = "mixData:MuonCSCWireDigiSimLinks", + RPCdigisimlinkTag = "mixData:RPCDigiSimLink", + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) muonAssociatorByHits = cms.EDProducer("MuonAssociatorEDProducer", # COMMON CONFIGURATION @@ -139,8 +156,4 @@ ignoreMissingTrackCollection = cms.untracked.bool(False), ) -from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM -run3_GEM.toModify( muonAssociatorByHits, useGEMs = cms.bool(True) ) -from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker -phase2_tracker.toModify( muonAssociatorByHits, usePhase2Tracker = cms.bool(True) ) -phase2_tracker.toModify( muonAssociatorByHits, pixelSimLinkSrc = "simSiPixelDigis:Pixel" ) +premix_stage2.toModify(muonAssociatorByHits, tpTag = "mixData:MergedTrackTruth") diff --git a/SimMuon/MCTruth/python/muonAssociatorByHitsNoSimHitsHelper_cfi.py b/SimMuon/MCTruth/python/muonAssociatorByHitsNoSimHitsHelper_cfi.py index 4cae09c4d5d7c..ccc8a9c1e2e2a 100644 --- a/SimMuon/MCTruth/python/muonAssociatorByHitsNoSimHitsHelper_cfi.py +++ b/SimMuon/MCTruth/python/muonAssociatorByHitsNoSimHitsHelper_cfi.py @@ -24,9 +24,3 @@ # use only muon system muonAssociatorByHitsNoSimHitsHelper.UseTracker = False - -from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM -run3_GEM.toModify( muonAssociatorByHitsNoSimHitsHelper, useGEMs = cms.bool(True) ) -from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker -phase2_tracker.toModify( muonAssociatorByHitsNoSimHitsHelper, usePhase2Tracker = cms.bool(True) ) -phase2_tracker.toModify( muonAssociatorByHitsNoSimHitsHelper, pixelSimLinkSrc = "simSiPixelDigis:Pixel" ) diff --git a/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.cc index 0b05bba3228a4..4c7f6734b926a 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.cc @@ -27,10 +27,9 @@ using namespace edm; void PSPDigitizerAlgorithm::init(const edm::EventSetup& es) { es.get().get(geom_); } -PSPDigitizerAlgorithm::PSPDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine& eng): +PSPDigitizerAlgorithm::PSPDigitizerAlgorithm(const edm::ParameterSet& conf): Phase2TrackerDigitizerAlgorithm(conf.getParameter("AlgorithmCommon"), - conf.getParameter("PSPDigitizerAlgorithm"), - eng) + conf.getParameter("PSPDigitizerAlgorithm")) { pixelFlag = false; LogInfo("PSPDigitizerAlgorithm") << "Algorithm constructed " diff --git a/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h index 8424f8c2e2208..fad05e7e27b63 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/PSPDigitizerAlgorithm.h @@ -9,7 +9,7 @@ class TrackerTopology; class PSPDigitizerAlgorithm: public Phase2TrackerDigitizerAlgorithm { public: - PSPDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine&); + PSPDigitizerAlgorithm(const edm::ParameterSet& conf); ~PSPDigitizerAlgorithm() override; // initialization that cannot be done in the constructor diff --git a/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.cc index c27e7d9af5999..583da03882f1a 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.cc @@ -28,10 +28,9 @@ using namespace edm; void PSSDigitizerAlgorithm::init(const edm::EventSetup& es) { es.get().get(geom_); } -PSSDigitizerAlgorithm::PSSDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine& eng): +PSSDigitizerAlgorithm::PSSDigitizerAlgorithm(const edm::ParameterSet& conf): Phase2TrackerDigitizerAlgorithm(conf.getParameter("AlgorithmCommon"), - conf.getParameter("PSSDigitizerAlgorithm"), - eng) + conf.getParameter("PSSDigitizerAlgorithm")) { pixelFlag = false; LogInfo("PSSDigitizerAlgorithm") << "Algorithm constructed " diff --git a/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.h index a70f9e573b81e..b5f6fc77e1114 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/PSSDigitizerAlgorithm.h @@ -8,7 +8,7 @@ class TrackerTopology; class PSSDigitizerAlgorithm :public Phase2TrackerDigitizerAlgorithm { public: - PSSDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine&); + PSSDigitizerAlgorithm(const edm::ParameterSet& conf); ~PSSDigitizerAlgorithm() override; // initialization that cannot be done in the constructor diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc index 40a0b768a547d..c91a387c2bb14 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.cc @@ -82,7 +82,7 @@ namespace cms hitsProducer_(iConfig.getParameter("hitsProducer")), trackerContainers_(iConfig.getParameter >("ROUList")), geometryType_(iConfig.getParameter("GeometryType")), - iconfig_(iConfig) + isOuterTrackerReadoutAnalog(iConfig.getParameter("isOTreadoutAnalog")) { //edm::LogInfo("Phase2TrackerDigitizer") << "Initialize Digitizer Algorithms"; const std::string alias1("simSiPixelDigis"); @@ -93,17 +93,14 @@ namespace cms mixMod.produces >("Tracker").setBranchAlias(alias2); mixMod.produces >("Tracker").setBranchAlias(alias2); + // creating algorithm objects and pushing them into the map + algomap_[AlgorithmType::InnerPixel] = std::make_unique(iConfig); + algomap_[AlgorithmType::PixelinPS] = std::make_unique(iConfig); + algomap_[AlgorithmType::StripinPS] = std::make_unique(iConfig); + algomap_[AlgorithmType::TwoStrip] = std::make_unique(iConfig); } void Phase2TrackerDigitizer::beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) { - edm::Service rng; - if (!rng.isAvailable()) { - throw cms::Exception("Configuration") - << "Phase2TrackerDigitizer requires the RandomNumberGeneratorService\n" - "which is not present in the configuration file. You must add the service\n" - "in the configuration file or remove the modules that require it."; - } - rndEngine_ = &(rng->getEngine(lumi.index())); iSetup.get().get(pSetup_); iSetup.get().get(tTopoHand); @@ -123,21 +120,9 @@ namespace cms } } } - - // one type of Digi and DigiSimLink suffices - // changes in future: InnerPixel -> Tracker - // creating algorithm objects and pushing them into the map - algomap_[AlgorithmType::InnerPixel] = std::unique_ptr(new PixelDigitizerAlgorithm(iconfig_, (*rndEngine_))); - algomap_[AlgorithmType::PixelinPS] = std::unique_ptr(new PSPDigitizerAlgorithm(iconfig_, (*rndEngine_))); - algomap_[AlgorithmType::StripinPS] = std::unique_ptr(new PSSDigitizerAlgorithm(iconfig_, (*rndEngine_))); - algomap_[AlgorithmType::TwoStrip] = std::unique_ptr(new SSDigitizerAlgorithm(iconfig_, (*rndEngine_))); } - void Phase2TrackerDigitizer::endLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) { - algomap_.clear(); - } Phase2TrackerDigitizer::~Phase2TrackerDigitizer() { - edm::LogInfo("Phase2TrackerDigitizer") << "Destroying the Digitizer"; } void Phase2TrackerDigitizer::accumulatePixelHits(edm::Handle > hSimHits, @@ -170,10 +155,19 @@ namespace cms void Phase2TrackerDigitizer::initializeEvent(edm::Event const& e, edm::EventSetup const& iSetup) { + edm::Service rng; + if (!rng.isAvailable()) { + throw cms::Exception("Configuration") + << "Phase2TrackerDigitizer requires the RandomNumberGeneratorService\n" + "which is not present in the configuration file. You must add the service\n" + "in the configuration file or remove the modules that require it."; + } + // Must initialize all the algorithms for (auto const & el : algomap_) { if (first_) el.second->init(iSetup); - el.second->initializeEvent(); + + el.second->initializeEvent(rng->getEngine(e.streamID())); } first_ = false; // Make sure that the first crossing processed starts indexing the sim hits from zero. @@ -213,7 +207,6 @@ namespace cms } } void Phase2TrackerDigitizer::finalizeEvent(edm::Event& iEvent, const edm::EventSetup& iSetup) { - const bool isOuterTrackerReadoutAnalog = iconfig_.getParameter("isOTreadoutAnalog"); //Decide if we want analog readout for Outer Tracker. addPixelCollection(iEvent, iSetup, isOuterTrackerReadoutAnalog); if(!isOuterTrackerReadoutAnalog) diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h index 549c72339c653..9a915a4673690 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizer.h @@ -60,7 +60,6 @@ namespace cms void finalizeEvent(edm::Event& e, edm::EventSetup const& c) override; virtual void beginJob() {} void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) override; - void endLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& iSetup) override; template void accumulate_local(T const& iEvent, edm::EventSetup const& iSetup); @@ -104,11 +103,9 @@ namespace cms edm::ESHandle pDD_; edm::ESHandle pSetup_; std::map detectorUnits_; - CLHEP::HepRandomEngine* rndEngine_; edm::ESHandle tTopoHand; edm::ESWatcher theTkDigiGeomWatcher; - const edm::ParameterSet& iconfig_; - + const bool isOuterTrackerReadoutAnalog; // cache for detector types ModuleTypeCache moduleTypeCache_; diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc index dae9be3e166bf..a176cd7e92a0f 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.cc @@ -57,8 +57,7 @@ using namespace edm; using namespace sipixelobjects; Phase2TrackerDigitizerAlgorithm::Phase2TrackerDigitizerAlgorithm(const edm::ParameterSet& conf_common, - const edm::ParameterSet& conf_specific, - CLHEP::HepRandomEngine& eng): + const edm::ParameterSet& conf_specific): _signal(), makeDigiSimLinks_(conf_specific.getUntrackedParameter("makeDigiSimLinks", true)), use_ineff_from_db_(conf_specific.getParameter("Inefficiency_DB")), @@ -152,14 +151,9 @@ Phase2TrackerDigitizerAlgorithm::Phase2TrackerDigitizerAlgorithm(const edm::Para fluctuate(fluctuateCharge ? new SiG4UniversalFluctuation() : nullptr), theNoiser(addNoise ? new GaussianTailNoiseGenerator() : nullptr), theSiPixelGainCalibrationService_(use_ineff_from_db_ ? new SiPixelGainCalibrationOfflineSimService(conf_specific) : nullptr), - subdetEfficiencies_(conf_specific), - flatDistribution_((addNoise || AddPixelInefficiency || fluctuateCharge || addThresholdSmearing) ? new CLHEP::RandFlat(eng, 0., 1.) : nullptr), - gaussDistribution_((addNoise || AddPixelInefficiency || fluctuateCharge || addThresholdSmearing) ? new CLHEP::RandGaussQ(eng, 0., theReadoutNoise) : nullptr), - // Threshold smearing with gaussian distribution: - smearedThreshold_Endcap_(addThresholdSmearing ? new CLHEP::RandGaussQ(eng, theThresholdInE_Endcap , theThresholdSmearing_Endcap) : nullptr), - smearedThreshold_Barrel_(addThresholdSmearing ? new CLHEP::RandGaussQ(eng, theThresholdInE_Barrel , theThresholdSmearing_Barrel) : nullptr), - rengine_(&eng) + subdetEfficiencies_(conf_specific) { + LogInfo("Phase2TrackerDigitizerAlgorithm") << "Phase2TrackerDigitizerAlgorithm constructed\n" << "Configuration parameters:\n" << "Threshold/Gain = " @@ -719,13 +713,27 @@ void Phase2TrackerDigitizerAlgorithm::pixel_inefficiency(const SubdetEfficiencie // Now loop again over pixels to kill some of them. // Loop over hits, amplitude in electrons, channel = coded row,col for (auto & s : theSignal) { - float rand = flatDistribution_->fire(); + float rand = rengine_->flat(); if( rand>subdetEfficiency ) { // make amplitude =0 s.second.set(0.); // reset amplitude, } } } +void Phase2TrackerDigitizerAlgorithm::initializeEvent(CLHEP::HepRandomEngine& eng) { + if (addNoise || AddPixelInefficiency || fluctuateCharge || addThresholdSmearing) { + + gaussDistribution_ = std::make_unique(eng, 0., theReadoutNoise); + } + // Threshold smearing with gaussian distribution: + if (addThresholdSmearing) { + smearedThreshold_Endcap_ = std::make_unique (eng, theThresholdInE_Endcap , theThresholdSmearing_Endcap); + smearedThreshold_Barrel_ = std::make_unique (eng, theThresholdInE_Barrel , theThresholdSmearing_Barrel); + } + rengine_ = (&eng); + _signal.clear(); +} + // ======================================================================================= // // Set the drift direction accoring to the Bfield in local det-unit frame diff --git a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h index 72cebc2ff736f..06f8e4ff30980 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/Phase2TrackerDigitizerAlgorithm.h @@ -44,14 +44,12 @@ class TrackerTopology; class Phase2TrackerDigitizerAlgorithm { public: - Phase2TrackerDigitizerAlgorithm(const edm::ParameterSet& conf_common, const edm::ParameterSet& conf_specific, CLHEP::HepRandomEngine&); + Phase2TrackerDigitizerAlgorithm(const edm::ParameterSet& conf_common, const edm::ParameterSet& conf_specific); virtual ~Phase2TrackerDigitizerAlgorithm(); // initialization that cannot be done in the constructor virtual void init(const edm::EventSetup& es) = 0; - virtual void initializeEvent() { - _signal.clear(); - } + virtual void initializeEvent(CLHEP::HepRandomEngine& eng); // run the algorithm to digitize a single det virtual void accumulateSimHits(const std::vector::const_iterator inputBegin, const std::vector::const_iterator inputEnd, @@ -200,12 +198,11 @@ class Phase2TrackerDigitizerAlgorithm { const SubdetEfficiencies subdetEfficiencies_; // For random numbers - const std::unique_ptr flatDistribution_; - const std::unique_ptr gaussDistribution_; + std::unique_ptr gaussDistribution_; // Threshold gaussian smearing: - const std::unique_ptr smearedThreshold_Endcap_; - const std::unique_ptr smearedThreshold_Barrel_; + std::unique_ptr smearedThreshold_Endcap_; + std::unique_ptr smearedThreshold_Barrel_; //for engine passed into the constructor from Digitizer CLHEP::HepRandomEngine* rengine_; diff --git a/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.cc index 5abe2592ff2d8..d231a2864a16f 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.cc @@ -61,10 +61,9 @@ void PixelDigitizerAlgorithm::init(const edm::EventSetup& es) { es.get().get(geom_); } -PixelDigitizerAlgorithm::PixelDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine& eng) : +PixelDigitizerAlgorithm::PixelDigitizerAlgorithm(const edm::ParameterSet& conf) : Phase2TrackerDigitizerAlgorithm(conf.getParameter("AlgorithmCommon"), - conf.getParameter("PixelDigitizerAlgorithm"), - eng) + conf.getParameter("PixelDigitizerAlgorithm")) { pixelFlag = true; LogInfo("PixelDigitizerAlgorithm") << "Algorithm constructed " diff --git a/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h index a1f8aaa75815b..487c8cf9804d7 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/PixelDigitizerAlgorithm.h @@ -8,7 +8,7 @@ class TrackerTopology; class PixelDigitizerAlgorithm: public Phase2TrackerDigitizerAlgorithm { public: - PixelDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine&); + PixelDigitizerAlgorithm(const edm::ParameterSet& conf); ~PixelDigitizerAlgorithm() override; // initialization that cannot be done in the constructor diff --git a/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.cc b/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.cc index 348a13e56e9d2..29a6c2c455c65 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.cc +++ b/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.cc @@ -29,10 +29,9 @@ using namespace edm; void SSDigitizerAlgorithm::init(const edm::EventSetup& es) { es.get().get(geom_); } -SSDigitizerAlgorithm::SSDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine& eng) : +SSDigitizerAlgorithm::SSDigitizerAlgorithm(const edm::ParameterSet& conf) : Phase2TrackerDigitizerAlgorithm(conf.getParameter("AlgorithmCommon"), - conf.getParameter("SSDigitizerAlgorithm"), - eng) + conf.getParameter("SSDigitizerAlgorithm")) { pixelFlag = false; LogInfo("SSDigitizerAlgorithm ") << "SSDigitizerAlgorithm constructed " diff --git a/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.h b/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.h index 3ab44bcbf03d2..27c704141009c 100644 --- a/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.h +++ b/SimTracker/SiPhase2Digitizer/plugins/SSDigitizerAlgorithm.h @@ -9,7 +9,7 @@ class TrackerTopology; class SSDigitizerAlgorithm :public Phase2TrackerDigitizerAlgorithm { public: - SSDigitizerAlgorithm(const edm::ParameterSet& conf, CLHEP::HepRandomEngine&); + SSDigitizerAlgorithm(const edm::ParameterSet& conf); ~SSDigitizerAlgorithm() override; // initialization that cannot be done in the constructor diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc index e392c1f12d928..e8961d867a237 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.cc @@ -70,11 +70,6 @@ #include "FWCore/Utilities/interface/StreamID.h" #include "FWCore/Utilities/interface/Exception.h" -namespace CLHEP { - class HepRandomEngine; -} - - // // constants, enums and typedefs // @@ -135,7 +130,6 @@ namespace cms SiPixelDigitizer::accumulatePixelHits(edm::Handle > hSimHits, size_t globalSimHitIndex, const unsigned int tofBin, - CLHEP::HepRandomEngine* engine, edm::EventSetup const& iSetup) { if(hSimHits.isValid()) { std::set detIds; @@ -157,7 +151,7 @@ namespace cms GlobalVector bfield = pSetup->inTesla(pixdet->surface().position()); LogDebug ("PixelDigitizer ") << "B-field(T) at " << pixdet->surface().position() << "(cm): " << pSetup->inTesla(pixdet->surface().position()); - _pixeldigialgo->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, pixdet, bfield, tTopo, engine); + _pixeldigialgo->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, pixdet, bfield, tTopo, randomEngine_); } } } @@ -177,6 +171,10 @@ namespace cms // from zero for each crossing. crossingSimHitIndexOffset_.clear(); + // Cache random number engine + edm::Service rng; + randomEngine_ = &rng->getEngine(e.streamID()); + _pixeldigialgo->initializeEvent(); iSetup.get().get(geometryType, pDD); iSetup.get().get(pSetup); @@ -213,7 +211,7 @@ namespace cms iEvent.getByLabel(tag, simHits); unsigned int tofBin = PixelDigiSimLink::LowTof; if ((*i).find(std::string("HighTof")) != std::string::npos) tofBin = PixelDigiSimLink::HighTof; - accumulatePixelHits(simHits, crossingSimHitIndexOffset_[tag.encode()], tofBin, randomEngine(iEvent.streamID()), iSetup); + accumulatePixelHits(simHits, crossingSimHitIndexOffset_[tag.encode()], tofBin, iSetup); // Now that the hits have been processed, I'll add the amount of hits in this crossing on to // the global counter. Next time accumulateStripHits() is called it will count the sim hits // as though they were on the end of this collection. @@ -233,7 +231,7 @@ namespace cms iEvent.getByLabel(tag, simHits); unsigned int tofBin = PixelDigiSimLink::LowTof; if ((*i).find(std::string("HighTof")) != std::string::npos) tofBin = PixelDigiSimLink::HighTof; - accumulatePixelHits(simHits, crossingSimHitIndexOffset_[tag.encode()], tofBin, randomEngine(streamID), iSetup); + accumulatePixelHits(simHits, crossingSimHitIndexOffset_[tag.encode()], tofBin, iSetup); // Now that the hits have been processed, I'll add the amount of hits in this crossing on to // the global counter. Next time accumulateStripHits() is called it will count the sim hits // as though they were on the end of this collection. @@ -246,10 +244,6 @@ namespace cms // ------------ method called to produce the data ------------ void SiPixelDigitizer::finalizeEvent(edm::Event& iEvent, const edm::EventSetup& iSetup) { - - edm::Service rng; - CLHEP::HepRandomEngine* engine = &rng->getEngine(iEvent.streamID()); - edm::ESHandle tTopoHand; iSetup.get().get(tTopoHand); const TrackerTopology *tTopo=tTopoHand.product(); @@ -279,7 +273,7 @@ namespace cms collector.data, linkcollector.data, tTopo, - engine); + randomEngine_); if(!collector.data.empty()) { theDigiVector.push_back(std::move(collector)); } @@ -298,21 +292,8 @@ namespace cms // Step D: write output to file iEvent.put(std::move(output)); iEvent.put(std::move(outputlink)); - } - CLHEP::HepRandomEngine* SiPixelDigitizer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { - edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; - } - return ptr; + randomEngine_ = nullptr; // to prevent access outside event } - }// end namespace cms:: diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h index 79b0573933846..9b945ba7b3906 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizer.h @@ -71,9 +71,7 @@ namespace cms { void accumulatePixelHits(edm::Handle >, size_t globalSimHitIndex, const unsigned int tofBin, - CLHEP::HepRandomEngine*, edm::EventSetup const& c); - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); bool firstInitializeEvent_; bool firstFinalizeEvent_; @@ -95,7 +93,7 @@ namespace cms { edm::ESHandle pDD; edm::ESHandle pSetup; std::map detectorUnits; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; PileupMixingContent* PileupInfo_; diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc index e85b046895181..af6c0a19d5991 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.cc @@ -496,15 +496,15 @@ void SiPixelDigitizerAlgorithm::init_DynIneffDB(const edm::EventSetup& es, const } void SiPixelDigitizerAlgorithm::PixelEfficiencies::init_from_db(const edm::ESHandle& geom, const edm::ESHandle& SiPixelDynamicInefficiency) { - + theInstLumiScaleFactor = SiPixelDynamicInefficiency->gettheInstLumiScaleFactor(); - const std::map& PixelGeomFactorsDB = SiPixelDynamicInefficiency->getPixelGeomFactors(); + const std::map& PixelGeomFactorsDBIn = SiPixelDynamicInefficiency->getPixelGeomFactors(); const std::map& ColGeomFactorsDB = SiPixelDynamicInefficiency->getColGeomFactors(); const std::map& ChipGeomFactorsDB = SiPixelDynamicInefficiency->getChipGeomFactors(); const std::map >& PUFactors = SiPixelDynamicInefficiency->getPUFactors(); std::vector DetIdmasks = SiPixelDynamicInefficiency->getDetIdmasks(); - // Loop on all modules, calculate geometrical scale factors and store in map for easy access + // Loop on all modules, initialize map for easy access for( const auto& it_module : geom->detUnits()) { if( dynamic_cast(it_module)==nullptr) continue; const DetId detid = it_module->geographicalId(); @@ -512,11 +512,58 @@ void SiPixelDigitizerAlgorithm::PixelEfficiencies::init_from_db(const edm::ESHan PixelGeomFactors[rawid] = 1; ColGeomFactors[rawid] = 1; ChipGeomFactors[rawid] = 1; + PixelGeomFactorsROCStdPixels[rawid] = std::vector(16,1); + PixelGeomFactorsROCBigPixels[rawid] = std::vector(16,1); + } + + // ROC level inefficiency for phase 1 (disentangle scale factors for big and std size pixels) + std::map PixelGeomFactorsDB; + + if (geom->isThere(GeomDetEnumerators::P1PXB) + || geom->isThere(GeomDetEnumerators::P1PXEC)){ + for (auto db_factor : PixelGeomFactorsDBIn){ + int shift = DetId(db_factor.first).subdetId() == + static_cast(PixelSubdetector::PixelBarrel) ? BPixRocIdShift:FPixRocIdShift; + unsigned int rocMask = rocIdMaskBits << shift; + unsigned int rocId = (((db_factor.first) & rocMask) >> shift); + if (rocId != 0) { + rocId--; + unsigned int rawid = db_factor.first & (~rocMask); + const PixelGeomDetUnit * theGeomDet = dynamic_cast (geom->idToDet(rawid)); + PixelTopology const * topology = &(theGeomDet->specificTopology()); + const int nPixelsInROC = topology->rowsperroc()*topology->colsperroc(); + const int nBigPixelsInROC = 2*topology->rowsperroc()+topology->colsperroc()-2; + double factor = db_factor.second; + double badFraction = 1 - factor; + double bigPixelFraction = static_cast (nBigPixelsInROC)/nPixelsInROC; + double stdPixelFraction = 1. - bigPixelFraction; + + double badFractionBig = std::min(bigPixelFraction, badFraction); + double badFractionStd = std::max(0., badFraction - badFractionBig); + double badFractionBigReNormalized = badFractionBig/bigPixelFraction; + double badFractionStdReNormalized = badFractionStd/stdPixelFraction; + PixelGeomFactorsROCStdPixels[rawid][rocId] *= (1. - badFractionStdReNormalized); + PixelGeomFactorsROCBigPixels[rawid][rocId] *= (1. - badFractionBigReNormalized); + } + else{ + PixelGeomFactorsDB[db_factor.first] = db_factor.second; + } + } + } // is Phase 1 geometry + else{ + PixelGeomFactorsDB = PixelGeomFactorsDBIn; + } + + // Loop on all modules, store module level geometrical scale factors + for( const auto& it_module : geom->detUnits()) { + if( dynamic_cast(it_module)==nullptr) continue; + const DetId detid = it_module->geographicalId(); + uint32_t rawid = detid.rawId(); for (auto db_factor : PixelGeomFactorsDB) if (matches(detid, DetId(db_factor.first), DetIdmasks)) PixelGeomFactors[rawid] *= db_factor.second; for (auto db_factor : ColGeomFactorsDB) if (matches(detid, DetId(db_factor.first), DetIdmasks)) ColGeomFactors[rawid] *= db_factor.second; for (auto db_factor : ChipGeomFactorsDB) if (matches(detid, DetId(db_factor.first), DetIdmasks)) ChipGeomFactors[rawid] *= db_factor.second; } - + // piluep scale factors are calculated once per event // therefore vector index is stored in a map for each module that matches to a db_id size_t i=0; @@ -1482,11 +1529,14 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, const PixelTopology* topol=&pixdet->specificTopology(); int numColumns = topol->ncolumns(); // det module number of cols&rows int numRows = topol->nrows(); - + bool isPhase1 = pixdet->subDetector()==GeomDetEnumerators::SubDetector::P1PXB + || pixdet->subDetector()==GeomDetEnumerators::SubDetector::P1PXEC; // Predefined efficiencies double pixelEfficiency = 1.0; double columnEfficiency = 1.0; double chipEfficiency = 1.0; + std::vector pixelEfficiencyROCStdPixels(16,1); + std::vector pixelEfficiencyROCBigPixels(16,1); if (eff.FromConfig) { // setup the chip indices conversion @@ -1546,6 +1596,12 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, pixelEfficiency = eff.PixelGeomFactors.at(detID); columnEfficiency = eff.ColGeomFactors.at(detID)*eff.pu_scale[eff.iPU.at(detID)]; chipEfficiency = eff.ChipGeomFactors.at(detID); + if (isPhase1){ + for (unsigned int i_roc=0; i_roc >chips, columns; + std::map >chips, columns, pixelStd, pixelBig; std::map >::iterator iter; // Find out the number of columns and rocs hits @@ -1579,6 +1635,12 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, chips[chipIndex]++; columns[dColInDet]++; + if (isPhase1){ + if (topol->isItBigPixelInX(row) || topol->isItBigPixelInY(col)) + pixelBig[chipIndex]++; + else + pixelStd[chipIndex]++; + } } // Delete some ROC hits. @@ -1595,6 +1657,19 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, if( rand > columnEfficiency ) columns[iter->first]=0; } + // Delete some pixel hits based on DCDC issue damage. + if (isPhase1){ + for ( iter = pixelStd.begin(); iter != pixelStd.end() ; iter++ ) { + float rand = CLHEP::RandFlat::shoot(engine); + if( rand > pixelEfficiencyROCStdPixels[iter->first]) pixelStd[iter->first] = 0; + } + + for ( iter = pixelBig.begin(); iter != pixelBig.end() ; iter++ ) { + float rand = CLHEP::RandFlat::shoot(engine); + if( rand > pixelEfficiencyROCBigPixels[iter->first]) pixelBig[iter->first] = 0; + } + } + // Now loop again over pixels to kill some of them. // Loop over hit pixels, amplitude in electrons, channel = coded row,col for(signal_map_iterator i = theSignal.begin();i != theSignal.end(); ++i) { @@ -1612,11 +1687,19 @@ void SiPixelDigitizerAlgorithm::pixel_inefficiency(const PixelEfficiencies& eff, //float rand = RandFlat::shoot(); float rand = CLHEP::RandFlat::shoot(engine); if( chips[chipIndex]==0 || columns[dColInDet]==0 - || rand>pixelEfficiency ) { + || rand>pixelEfficiency + || (pixelStd.count(chipIndex) && pixelStd[chipIndex] == 0) + || (pixelBig.count(chipIndex) && pixelBig[chipIndex] == 0)) { // make pixel amplitude =0, pixel will be lost at clusterization - i->second.set(0.); // reset amplitude, + i->second.set(0.); // reset amplitude, } // end if - + if (isPhase1){ + if((pixelStd.count(chipIndex) && pixelStd[chipIndex] == 0) + || (pixelBig.count(chipIndex) && pixelBig[chipIndex] == 0)) { + // make pixel amplitude =0, pixel will be lost at clusterization + i->second.set(0.); // reset amplitude, + } // end if + } // is Phase 1 } // end pixel loop } // end pixel_indefficiency @@ -1737,7 +1820,7 @@ float SiPixelDigitizerAlgorithm::missCalibrate(uint32_t detID, const TrackerTopo //pp1 = y.p1; //pp2 = y.p2; //pp3 = y.p3; - + // // Use random smearing // Randomize the pixel response diff --git a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h index 0fef2619b2f5e..b226a13e103d2 100644 --- a/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h +++ b/SimTracker/SiPixelDigitizer/plugins/SiPixelDigitizerAlgorithm.h @@ -247,10 +247,15 @@ class SiPixelDigitizerAlgorithm { // Read factors from DB and fill containers std::map PixelGeomFactors; + std::map > PixelGeomFactorsROCStdPixels; + std::map > PixelGeomFactorsROCBigPixels; std::map ColGeomFactors; std::map ChipGeomFactors; std::map iPU; - + + // constants for ROC level simulation for Phase1 + enum shiftEnumerator {FPixRocIdShift = 3, BPixRocIdShift = 6}; + static const int rocIdMaskBits = 0x1F; void init_from_db(const edm::ESHandle&, const edm::ESHandle&); bool matches(const DetId&, const DetId&, const std::vector&); }; diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc index 6dee5c40d19a8..5461184f665cc 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.cc @@ -95,7 +95,7 @@ SiStripDigitizer::~SiStripDigitizer() { } void SiStripDigitizer::accumulateStripHits(edm::Handle > hSimHits, - const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin, CLHEP::HepRandomEngine* engine ) { + const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin) { // globalSimHitIndex is the index the sim hit will have when it is put in a collection // of sim hits for all crossings. This is only used when creating digi-sim links if // configured to do so. @@ -114,7 +114,7 @@ void SiStripDigitizer::accumulateStripHits(edm::Handle > hS GlobalVector bfield = pSetup->inTesla(stripdet->surface().position()); LogDebug ("Digitizer ") << "B-field(T) at " << stripdet->surface().position() << "(cm): " << pSetup->inTesla(stripdet->surface().position()); - theDigiAlgo->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, stripdet, bfield, tTopo, engine); + theDigiAlgo->accumulateSimHits(it, itEnd, globalSimHitIndex, tofBin, stripdet, bfield, tTopo, randomEngine_); } } } // end of loop over sim hits @@ -137,7 +137,7 @@ void SiStripDigitizer::accumulateStripHits(edm::Handle > hS if (trackerContainer.find(std::string("HighTof")) != std::string::npos) tofBin = StripDigiSimLink::HighTof; iEvent.getByLabel(tag, simHits); - accumulateStripHits(simHits,tTopo,crossingSimHitIndexOffset_[tag.encode()], tofBin, randomEngine(iEvent.streamID())); + accumulateStripHits(simHits,tTopo,crossingSimHitIndexOffset_[tag.encode()], tofBin); // Now that the hits have been processed, I'll add the amount of hits in this crossing on to // the global counter. Next time accumulateStripHits() is called it will count the sim hits // as though they were on the end of this collection. @@ -165,7 +165,7 @@ void SiStripDigitizer::accumulateStripHits(edm::Handle > hS if (trackerContainer.find(std::string("HighTof")) != std::string::npos) tofBin = StripDigiSimLink::HighTof; iEvent.getByLabel(tag, simHits); - accumulateStripHits(simHits,tTopo,crossingSimHitIndexOffset_[tag.encode()], tofBin, randomEngine(streamID)); + accumulateStripHits(simHits,tTopo,crossingSimHitIndexOffset_[tag.encode()], tofBin); // Now that the hits have been processed, I'll add the amount of hits in this crossing on to // the global counter. Next time accumulateStripHits() is called it will count the sim hits // as though they were on the end of this collection. @@ -190,6 +190,10 @@ void SiStripDigitizer::initializeEvent(edm::Event const& iEvent, edm::EventSetup detCabling->addConnected(theDetIdList); } + // Cache random number engine + edm::Service rng; + randomEngine_ = &rng->getEngine(iEvent.streamID()); + theDigiAlgo->initializeEvent(iSetup); iSetup.get().get(geometryType,pDD); @@ -244,7 +248,7 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& edm::DetSet collectorRaw(iu->geographicalId().rawId()); edm::DetSet collectorLink(iu->geographicalId().rawId()); theDigiAlgo->digitize(collectorZS,collectorRaw,collectorLink,sgd, - gainHandle,thresholdHandle,noiseHandle,pedestalHandle,theAffectedAPVvector,randomEngine(iEvent.streamID())); + gainHandle,thresholdHandle,noiseHandle,pedestalHandle,theAffectedAPVvector,randomEngine_); if(zeroSuppression){ if(!collectorZS.data.empty()){ theDigiVector.push_back(collectorZS); @@ -285,18 +289,5 @@ void SiStripDigitizer::finalizeEvent(edm::Event& iEvent, edm::EventSetup const& iEvent.put(std::move(output_processedraw), PRDigi); if( makeDigiSimLinks_ ) iEvent.put(std::move(pOutputDigiSimLink)); // The previous EDProducer didn't name this collection so I won't either } -} - -CLHEP::HepRandomEngine* SiStripDigitizer::randomEngine(edm::StreamID const& streamID) { - unsigned int index = streamID.value(); - if(index >= randomEngines_.size()) { - randomEngines_.resize(index + 1, nullptr); - } - CLHEP::HepRandomEngine* ptr = randomEngines_[index]; - if(!ptr) { - edm::Service rng; - ptr = &rng->getEngine(streamID); - randomEngines_[index] = ptr; - } - return ptr; + randomEngine_ = nullptr; // to prevent access outside event } diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h index 3f38d3f9e29c8..3ad1dd08cade9 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizer.h @@ -63,8 +63,7 @@ class SiStripDigitizer : public DigiAccumulatorMixMod { private: - void accumulateStripHits(edm::Handle >, const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin, CLHEP::HepRandomEngine*); - CLHEP::HepRandomEngine* randomEngine(edm::StreamID const& streamID); + void accumulateStripHits(edm::Handle >, const TrackerTopology *tTopo, size_t globalSimHitIndex, const unsigned int tofBin); typedef std::vector vstring; typedef std::map >,std::less > simhit_map; @@ -98,7 +97,7 @@ class SiStripDigitizer : public DigiAccumulatorMixMod { edm::ESHandle pDD; edm::ESHandle pSetup; std::map detectorUnits; - std::vector randomEngines_; + CLHEP::HepRandomEngine* randomEngine_ = nullptr; std::vector>> theAffectedAPVvector; PileupMixingContent* PileupInfo_; diff --git a/SimTracker/TrackAssociation/python/trackingParticleRecoTrackAsssociation_cfi.py b/SimTracker/TrackAssociation/python/trackingParticleRecoTrackAsssociation_cfi.py index a1908afc0f383..cdc07e07c9fd8 100644 --- a/SimTracker/TrackAssociation/python/trackingParticleRecoTrackAsssociation_cfi.py +++ b/SimTracker/TrackAssociation/python/trackingParticleRecoTrackAsssociation_cfi.py @@ -7,4 +7,6 @@ ignoremissingtrackcollection=cms.untracked.bool(False) ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleRecoTrackAsssociation, label_tp = "mixData:MergedTrackTruth") diff --git a/SimTracker/TrackAssociatorProducers/python/quickTrackAssociatorByHits_cfi.py b/SimTracker/TrackAssociatorProducers/python/quickTrackAssociatorByHits_cfi.py index 63317698a2e83..66b2ded41ce33 100644 --- a/SimTracker/TrackAssociatorProducers/python/quickTrackAssociatorByHits_cfi.py +++ b/SimTracker/TrackAssociatorProducers/python/quickTrackAssociatorByHits_cfi.py @@ -29,3 +29,9 @@ pixelSimLinkSrc = cms.InputTag("simSiPixelDigis","Pixel"), stripSimLinkSrc = cms.InputTag("simSiPixelDigis","Tracker") ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(quickTrackAssociatorByHits, + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/SimTracker/TrackAssociatorProducers/python/trackAssociatorByHits_cfi.py b/SimTracker/TrackAssociatorProducers/python/trackAssociatorByHits_cfi.py index 96f4991655ff7..980daf3d7d6a7 100644 --- a/SimTracker/TrackAssociatorProducers/python/trackAssociatorByHits_cfi.py +++ b/SimTracker/TrackAssociatorProducers/python/trackAssociatorByHits_cfi.py @@ -31,3 +31,8 @@ ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackAssociatorByHits, + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/SimTracker/TrackHistory/plugins/TrackingParticleBHadronRefSelector.cc b/SimTracker/TrackHistory/plugins/TrackingParticleBHadronRefSelector.cc index 5567cff067035..96da6ca9e1450 100644 --- a/SimTracker/TrackHistory/plugins/TrackingParticleBHadronRefSelector.cc +++ b/SimTracker/TrackHistory/plugins/TrackingParticleBHadronRefSelector.cc @@ -39,7 +39,7 @@ TrackingParticleBHadronRefSelector::TrackingParticleBHadronRefSelector(const edm void TrackingParticleBHadronRefSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("src", edm::InputTag("mix", "MergedTrackTruth")); - descriptions.add("trackingParticleBHadronRefSelector", desc); + descriptions.add("trackingParticleBHadronRefSelectorDefault", desc); } void TrackingParticleBHadronRefSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { diff --git a/SimTracker/TrackHistory/python/TrackHistory_cff.py b/SimTracker/TrackHistory/python/TrackHistory_cff.py index 33649d10e1b9e..026e08cefca1a 100644 --- a/SimTracker/TrackHistory/python/TrackHistory_cff.py +++ b/SimTracker/TrackHistory/python/TrackHistory_cff.py @@ -17,3 +17,5 @@ ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackHistory, trackingTruth = "mixData:MergedTrackTruth") diff --git a/SimTracker/TrackHistory/python/TrackQuality_cff.py b/SimTracker/TrackHistory/python/TrackQuality_cff.py index ee227c2ec8955..b09c7649e7b5b 100644 --- a/SimTracker/TrackHistory/python/TrackQuality_cff.py +++ b/SimTracker/TrackHistory/python/TrackQuality_cff.py @@ -16,3 +16,11 @@ stripSimLinkSrc = cms.InputTag("simSiStripDigis") ) ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackQuality, + hitAssociator = dict( + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", + ) +) diff --git a/SimTracker/TrackHistory/python/trackingParticleBHadronRefSelector_cfi.py b/SimTracker/TrackHistory/python/trackingParticleBHadronRefSelector_cfi.py new file mode 100644 index 0000000000000..436e60c27976c --- /dev/null +++ b/SimTracker/TrackHistory/python/trackingParticleBHadronRefSelector_cfi.py @@ -0,0 +1,5 @@ +from SimTracker.TrackHistory.trackingParticleBHadronRefSelectorDefault_cfi import trackingParticleBHadronRefSelectorDefault as _trackingParticleBHadronRefSelectorDefault +trackingParticleBHadronRefSelector = _trackingParticleBHadronRefSelectorDefault.clone() + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(trackingParticleBHadronRefSelector, src = "mixData:MergedTrackTruth") diff --git a/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py b/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py index d9909629cd059..599e5369145bf 100644 --- a/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py +++ b/SimTracker/TrackerHitAssociation/python/tpClusterProducer_cfi.py @@ -1,8 +1,8 @@ import FWCore.ParameterSet.Config as cms -from SimTracker.TrackerHitAssociation.tpClusterProducerDefault_cfi import * +from SimTracker.TrackerHitAssociation.tpClusterProducerDefault_cfi import tpClusterProducerDefault as _tpClusterProducerDefault -tpClusterProducer = tpClusterProducerDefault.clone() +tpClusterProducer = _tpClusterProducerDefault.clone() from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker phase2_tracker.toModify( @@ -10,3 +10,10 @@ pixelSimLinkSrc = cms.InputTag("simSiPixelDigis", "Pixel"), phase2OTSimLinkSrc = cms.InputTag("simSiPixelDigis","Tracker") ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(tpClusterProducer, + trackingParticleSrc = "mixData:MergedTrackTruth", + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.cc b/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.cc index a598d53323717..5ccd94c86b4d0 100644 --- a/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.cc +++ b/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.cc @@ -370,17 +370,6 @@ BoostedTopProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } -// ------------ method called once each job just before starting event loop ------------ -void -BoostedTopProducer::beginJob(const edm::EventSetup&) -{ -} - -// ------------ method called once each job just after ending the event loop ------------ -void -BoostedTopProducer::endJob() { -} - double BoostedTopProducer::Psi(const TLorentzVector& p1, const TLorentzVector& p2, double mass) { diff --git a/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.h b/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.h index 6333f0f98a2e9..c1b18b0c4aa5f 100644 --- a/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.h +++ b/TopQuarkAnalysis/TopPairBSM/src/BoostedTopProducer.h @@ -86,9 +86,7 @@ class BoostedTopProducer : public edm::EDProducer { ~BoostedTopProducer() override; private: - virtual void beginJob(const edm::EventSetup&) ; void produce(edm::Event&, const edm::EventSetup&) override; - void endJob() override ; // ----------member data --------------------------- diff --git a/TrackingTools/KalmanUpdators/src/KFUpdator.cc b/TrackingTools/KalmanUpdators/src/KFUpdator.cc index 2e11026418b6e..a0034e0e4e4fa 100644 --- a/TrackingTools/KalmanUpdators/src/KFUpdator.cc +++ b/TrackingTools/KalmanUpdators/src/KFUpdator.cc @@ -7,6 +7,53 @@ #include "DataFormats/Math/interface/invertPosDefMatrix.h" #include "DataFormats/Math/interface/ProjectMatrix.h" + +// test of joseph form +#ifdef KU_JF_TEST + +#include +#include +namespace { + struct Stat { + Stat(): tot(0), + nopd(0), jnopd(0), fnopd(0), + inopd(0), ijnopd(0), ifnopd(0),dtot(0) + {for (int i=0;i<5;++i) idmm[i]=0; } + + std::atomic tot; + std::atomic nopd; + std::atomic jnopd; + std::atomic fnopd; + std::atomic inopd; + std::atomic ijnopd; + std::atomic ifnopd; + + std::atomic dtot; + std::atomic idmm[5]; + double mm = 0; + double dmm[5] = {0}; + bool ok=true; + ~Stat() { + double n = 1.e-3/double(dtot); + std::cout << "KF " << tot*1.e-9 << "G " << mm <<" " + < @@ -48,9 +95,56 @@ TrajectoryStateOnSurface lupdate(const TrajectoryStateOnSurface& tsos, // Compute local filtered state vector AlgebraicVector5 fsv = x + K * r; - // Compute covariance matrix of local filtered state vector + + // Compute covariance matrix of local filtered state vector +#define KU_JosephForm +#ifdef KU_JosephForm AlgebraicSymMatrix55 fse = ROOT::Math::Similarity(M, C) + ROOT::Math::Similarity(K, V); +#else + AlgebraicSymMatrix55 fse; ROOT::Math::AssignSym::Evaluate(fse, M*C); +#endif + +// test of joseph form +#ifdef KU_JF_TEST + + AlgebraicSymMatrix55 fse2; ROOT::Math::AssignSym::Evaluate(fse2, M*C); + + // std::cout << "Joseph Form \n" << fse << std::endl; + // std::cout << "Fast Form \n" << fse2 << std::endl; + + + stat.tot++; + auto n1 = isNopd(fse); + auto n2 = isNopd(fse2); + if (n1&&n2) stat.nopd++; + if (n1) stat.jnopd++; + if (n2) stat.fnopd++; + + AlgebraicSymMatrix55 dd = fse2-fse; + auto dda = dd.Array(); + auto fsa = fse.Array(); + double ddd[15]; + for (int i=0; i<15; ++i) ddd[i] = std::abs(dda[i])/std::abs(fsa[i]); + auto mm = *std::max_element(ddd,ddd+15); + stat.mm = std::max(stat.mm,mm); + if (stat.ok && !(n1||n2)) { + stat.dtot++; + for (int i=0; i<5; ++i) { + auto dmm = std::sqrt(fse2(i,i)) - std::sqrt(fse(i,i)); + stat.dmm[i] = std::max(stat.dmm[i],std::abs(dmm)); + stat.idmm[i] += (unsigned long long)(1000.*dmm*dmm); + if (stat.idmm[i] > std::numeric_limits::max() ) stat.ok=false; + } + } + AlgebraicSymMatrix55 ifse = fse; invertPosDefMatrix(ifse); + AlgebraicSymMatrix55 ifse2 = fse2; invertPosDefMatrix(ifse2); + n1 = isNopd(ifse); + n2 = isNopd(ifse2); + if (n1&&n2) stat.inopd++; + if (n1) stat.ijnopd++; + if (n2) stat.ifnopd++; +#endif /* // expanded similariy diff --git a/Validation/CaloTowers/src/CaloTowersValidation.cc b/Validation/CaloTowers/src/CaloTowersValidation.cc index d84c63d67dcdb..7d89c06468180 100644 --- a/Validation/CaloTowers/src/CaloTowersValidation.cc +++ b/Validation/CaloTowers/src/CaloTowersValidation.cc @@ -67,15 +67,12 @@ void CaloTowersValidation::bookHistograms(DQMStore::IBooker & ibooker, edm::Run //These the single pion scan histos //------------------------------------------------------------------------------------------- - //The first three are not used - if (useAllHistos_){ - sprintf (histo, "emean_vs_ieta_E" ); - emean_vs_ieta_E = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); - sprintf (histo, "emean_vs_ieta_H" ); - emean_vs_ieta_H = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); - sprintf (histo, "emean_vs_ieta_EH" ); - emean_vs_ieta_EH = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); - } + sprintf (histo, "emean_vs_ieta_E" ); + emean_vs_ieta_E = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); + sprintf (histo, "emean_vs_ieta_H" ); + emean_vs_ieta_H = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); + sprintf (histo, "emean_vs_ieta_EH" ); + emean_vs_ieta_EH = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); //These are drawn sprintf (histo, "emean_vs_ieta_E1" ); emean_vs_ieta_E1 = ibooker.bookProfile(histo, histo, 83, -41.5, 41.5, -100., 2000., " "); @@ -721,12 +718,10 @@ void CaloTowersValidation::analyze(edm::Event const& event, edm::EventSetup cons } // end of Towers cycle - //These are the six single pion histos; only the second set is used - if (useAllHistos_){ - emean_vs_ieta_E -> Fill(double(ieta_MC), Econe); - emean_vs_ieta_H -> Fill(double(ieta_MC), Hcone); - emean_vs_ieta_EH -> Fill(double(ieta_MC), Econe+Hcone); - } + //These are the six single pion histos + emean_vs_ieta_E -> Fill(double(ieta_MC), Econe); + emean_vs_ieta_H -> Fill(double(ieta_MC), Hcone); + emean_vs_ieta_EH -> Fill(double(ieta_MC), Econe+Hcone); emean_vs_ieta_E1 -> Fill(double(ieta_MC), Ee1); emean_vs_ieta_H1 -> Fill(double(ieta_MC), Eh1); emean_vs_ieta_EH1 -> Fill(double(ieta_MC), Ee1+Eh1); diff --git a/Validation/CaloTowers/test/macros/SinglePi.C b/Validation/CaloTowers/test/macros/SinglePi.C index cfae4919ba8c8..a9ce1ad9c0190 100644 --- a/Validation/CaloTowers/test/macros/SinglePi.C +++ b/Validation/CaloTowers/test/macros/SinglePi.C @@ -43,7 +43,7 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ // service variables // //Profiles - const int Nprof = 12; + const int Nprof = 15; TProfile* f1_prof[Nprof]; TProfile* f2_prof[Nprof]; @@ -51,7 +51,7 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ char labelp[Nprof][64]; //1D Histos - const int Nhist1 = 7; + const int Nhist1 = 11; TH1* f1_hist1[Nhist1]; TH1* f2_hist1[Nhist1]; @@ -76,7 +76,9 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ sprintf(labelp[10], "RecHitsTask_timing_vs_energy_profile_HE.gif"); sprintf(labelp[11], "RecHitsTask_timing_vs_energy_profile_HF.gif"); - + sprintf(labelp[12], "CaloTowersTask_emean_vs_ieta_E.gif"); + sprintf(labelp[13], "CaloTowersTask_emean_vs_ieta_H.gif"); + sprintf(labelp[14], "CaloTowersTask_emean_vs_ieta_EH.gif"); //1D Histos sprintf(label1[0], "N_calotowers_HB.gif"); @@ -88,6 +90,13 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ sprintf(label1[5], "RecHits_energy_HO.gif"); sprintf(label1[6], "RecHits_energy_HF.gif"); + sprintf(label1[7], "Ndigis_HB.gif" ); + sprintf(label1[8], "Ndigis_HE.gif" ); + sprintf(label1[9], "Ndigis_HO.gif" ); + sprintf(label1[10], "Ndigis_HF.gif" ); + + // REFERENCE FILE + TDirectory *td = fileDirectory(&f1, "CaloTowersTask"); //f1.cd("DQMData/CaloTowersV/CaloTowersTask"); //gDirectory->pwd(); @@ -96,6 +105,10 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f1_prof[1] = (TProfile*)td->Get("emean_vs_ieta_H1"); f1_prof[2] = (TProfile*)td->Get("emean_vs_ieta_EH1"); + f1_prof[12] = (TProfile*)td->Get("emean_vs_ieta_E"); + f1_prof[13] = (TProfile*)td->Get("emean_vs_ieta_H"); + f1_prof[14] = (TProfile*)td->Get("emean_vs_ieta_EH"); + f1_hist1[0] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HB"); f1_hist1[1] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HE"); f1_hist1[2] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HF"); @@ -115,6 +128,14 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f1_hist1[5] = (TH1*)td->Get("HcalRecHitTask_energy_of_rechits_HO"); f1_hist1[6] = (TH1*)td->Get("HcalRecHitTask_energy_of_rechits_HF"); + + td = fileDirectory(&f1, "HcalDigiTask"); + f1_hist1[7] = (TH1*)td->Get("HcalDigiTask_Ndigis_HB"); + f1_hist1[8] = (TH1*)td->Get("HcalDigiTask_Ndigis_HE"); + f1_hist1[9] = (TH1*)td->Get("HcalDigiTask_Ndigis_HO"); + f1_hist1[10] = (TH1*)td->Get("HcalDigiTask_Ndigis_HF"); + + if (!fastsim) { td = fileDirectory(&f1, "HcalSimHitTask"); //f1.cd("DQMData/HcalSimHitsV/HcalSimHitTask"); @@ -123,6 +144,8 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f1_prof[8] = (TProfile*)td->Get("HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH"); } + // NEW FILE + td = fileDirectory(&f2, "CaloTowersTask"); //f2.cd("DQMData/CaloTowersV/CaloTowersTask"); //gDirectory->pwd(); @@ -131,6 +154,10 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f2_prof[1] = (TProfile*)td->Get("emean_vs_ieta_H1"); f2_prof[2] = (TProfile*)td->Get("emean_vs_ieta_EH1"); + f2_prof[12] = (TProfile*)td->Get("emean_vs_ieta_E"); + f2_prof[13] = (TProfile*)td->Get("emean_vs_ieta_H"); + f2_prof[14] = (TProfile*)td->Get("emean_vs_ieta_EH"); + f2_hist1[0] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HB"); f2_hist1[1] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HE"); f2_hist1[2] = (TH1*)td->Get("CaloTowersTask_number_of_fired_towers_HF"); @@ -150,6 +177,12 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f2_hist1[5] = (TH1*)td->Get("HcalRecHitTask_energy_of_rechits_HO"); f2_hist1[6] = (TH1*)td->Get("HcalRecHitTask_energy_of_rechits_HF"); + td = fileDirectory(&f1, "HcalDigiTask"); + f2_hist1[7] = (TH1*)td->Get("HcalDigiTask_Ndigis_HB"); + f2_hist1[8] = (TH1*)td->Get("HcalDigiTask_Ndigis_HE"); + f2_hist1[9] = (TH1*)td->Get("HcalDigiTask_Ndigis_HO"); + f2_hist1[10] = (TH1*)td->Get("HcalDigiTask_Ndigis_HF"); + if (!fastsim) { td = fileDirectory(&f2, "HcalSimHitTask"); //f2.cd("DQMData/HcalSimHitsV/HcalSimHitTask"); @@ -158,24 +191,34 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f2_prof[8] = (TProfile*)td->Get("HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH"); } - //Profiles + + + //Profiles titles f1_prof[0]->GetXaxis()->SetTitle("CaloTowers eE (GeV) vs ieta 1 Tower"); f1_prof[1]->GetXaxis()->SetTitle("CaloTowers hE (GeV) vs ieta 1 Tower"); f1_prof[2]->GetXaxis()->SetTitle("CaloTowers eE+hE (GeV) vs ieta 1 Tower"); + + f1_prof[3]->GetXaxis()->SetTitle("RecHits eE (GeV) vs ieta R = 0.3 Cone"); f1_prof[4]->GetXaxis()->SetTitle("RecHits hE (GeV) vs ieta R = 0.3 Cone"); f1_prof[5]->GetXaxis()->SetTitle("RecHits eE+hE (GeV) vs ieta R = 0.3 Cone"); + if (!fastsim) { f1_prof[6]->GetXaxis()->SetTitle("SimHits eE (GeV) vs ieta R = 0.3 Cone"); f1_prof[7]->GetXaxis()->SetTitle("SimHits hE (GeV) vs ieta R = 0.3 Cone"); f1_prof[8]->GetXaxis()->SetTitle("SimHits eE+hE (GeV) vs ieta R = 0.3 Cone"); } + f1_prof[9]->GetXaxis()->SetTitle("HB RecHits timing (ns) vs Energy (GeV)"); f1_prof[10]->GetXaxis()->SetTitle("HE RecHits timing (ns) vs Energy (GeV)"); f1_prof[11]->GetXaxis()->SetTitle("HF RecHits timing (ns) vs Energy (GeV)"); + f1_prof[12]->GetXaxis()->SetTitle("CaloTowers eE Rcone sum (GeV) vs ieta"); + f1_prof[13]->GetXaxis()->SetTitle("CaloTowers hE Rcone sumn (GeV) vs ieta"); + f1_prof[14]->GetXaxis()->SetTitle("CaloTowers eE+hE Rcone sum (GeV) vs ieta "); - //1D Histos + + //1D Histos titles f1_hist1[0]->GetXaxis()->SetTitle("Number of HB CaloTowers"); f1_hist1[1]->GetXaxis()->SetTitle("Number of HE CaloTowers"); f1_hist1[2]->GetXaxis()->SetTitle("Number of HF CaloTowers"); @@ -185,53 +228,74 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f1_hist1[5]->GetXaxis()->SetTitle("HO RecHits energy (GeV)"); f1_hist1[6]->GetXaxis()->SetTitle("HF RecHits energy (GeV)"); + f1_hist1[7]->GetXaxis()->SetTitle("N_HB Digis"); + f1_hist1[8]->GetXaxis()->SetTitle("N_HE Digis"); + f1_hist1[9]->GetXaxis()->SetTitle("N_H0 Digis"); + f1_hist1[10]->GetXaxis()->SetTitle("N_HF Digis"); + + + // - f1_prof[0]->SetMaximum(20.); + f1_prof[0]->SetMaximum(20.); // CaloTowers 1 f1_prof[1]->SetMaximum(40.); f1_prof[2]->SetMaximum(40.); - f1_prof[4]->SetMaximum(50.); - f1_prof[5]->SetMaximum(50.); - - f1_prof[0]->SetMinimum(0.); - f1_prof[1]->SetMinimum(0.); + f1_prof[0]->SetMinimum(0.); // idem + f1_prof[1]->SetMinimum(0.); f1_prof[2]->SetMinimum(0.); + + f1_prof[3]->SetMaximum(30.); // RecHits R==0.3 + f1_prof[4]->SetMaximum(50.); + f1_prof[5]->SetMaximum(60.); f1_prof[3]->SetMinimum(0.); f1_prof[4]->SetMinimum(0.); f1_prof[5]->SetMinimum(0.); - if (!fastsim) { + + if (!fastsim) { // SimHits R=0.3 f1_prof[6]->SetMinimum(0.); f1_prof[7]->SetMinimum(0.); f1_prof[8]->SetMinimum(0.); + f1_prof[6]->SetMaximum(20.); + f1_prof[7]->SetMaximum(60.); + f1_prof[8]->SetMaximum(60.); } + + f1_prof[9]->SetMinimum(-25.); // RecHits Timing + f1_prof[10]->SetMinimum(-25.); + f1_prof[11]->SetMinimum(-25.); + f1_prof[9]->SetMaximum(25.); + f1_prof[10]->SetMaximum(25.); + f1_prof[11]->SetMaximum(25.); + + + f1_prof[12]->SetMaximum(30.); // CaloTowers R=0.3 added + f1_prof[13]->SetMaximum(50.); + f1_prof[14]->SetMaximum(60.); + f1_prof[12]->SetMinimum(0.); + f1_prof[13]->SetMinimum(0.); + f1_prof[14]->SetMinimum(0.); + + f1_prof[9]->GetXaxis()->SetRangeUser(0.,75.); f1_prof[10]->GetXaxis()->SetRangeUser(0.,75.); f1_prof[11]->GetXaxis()->SetRangeUser(0.,75.); - /* - f1_prof[9]->SetMinimum(0.); - f1_prof[10]->SetMinimum(0.); - f1_prof[11]->SetMinimum(0.); - */ - - + + - // f1_hist[2]->GetXaxis()->SetRangeUser(0.,1200.); - // f1_hist[7]->GetXaxis()->SetRangeUser(0.,160.); - // hist1->GetXaxis()->SetNdivisions(-21); - // hist1->GetYaxis()->SetNdivisions(-1003); + // 1D HISTOS - f1_hist1[0]->GetXaxis()->SetRangeUser(0.,100.); - f2_hist1[0]->GetXaxis()->SetRangeUser(0.,100.); + f1_hist1[0]->GetXaxis()->SetRangeUser(0.,200.); // N_CaloTowers + f2_hist1[0]->GetXaxis()->SetRangeUser(0.,200.); f1_hist1[1]->GetXaxis()->SetRangeUser(0.,150.); f2_hist1[1]->GetXaxis()->SetRangeUser(0.,150.); - f1_hist1[2]->GetXaxis()->SetRangeUser(0.,100.); - f2_hist1[2]->GetXaxis()->SetRangeUser(0.,100.); + f1_hist1[2]->GetXaxis()->SetRangeUser(0.,500.); + f2_hist1[2]->GetXaxis()->SetRangeUser(0.,500.); - f1_hist1[3]->GetXaxis()->SetRangeUser(0.,100.); + f1_hist1[3]->GetXaxis()->SetRangeUser(0.,100.); // RecHits spectra f2_hist1[3]->GetXaxis()->SetRangeUser(0.,100.); f1_hist1[4]->GetXaxis()->SetRangeUser(0.,100.); @@ -248,6 +312,20 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f1_hist1[5]->SetMaximum(1.e8); f1_hist1[6]->SetMaximum(1.e8); + f1_hist1[7]->GetXaxis()->SetRangeUser(0.,1000); // N_Digis + f2_hist1[7]->GetXaxis()->SetRangeUser(0.,1000); + + f1_hist1[8]->GetXaxis()->SetRangeUser(0.,200); + f2_hist1[8]->GetXaxis()->SetRangeUser(0.,200); + + f1_hist1[9]->GetXaxis()->SetRangeUser(0.,100); + f2_hist1[9]->GetXaxis()->SetRangeUser(0.,100); + + f1_hist1[10]->GetXaxis()->SetRangeUser(0.,3500); + f2_hist1[10]->GetXaxis()->SetRangeUser(0.,3500); + + + // gStyle->SetErrorX(0); // 1D-histo @@ -257,7 +335,7 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ TCanvas *myc = new TCanvas("myc","",800,600); gStyle->SetOptStat(1111); - if(i > 2) myc->SetLogy(); + if(i > 2 && i < 7) myc->SetLogy(); f1_hist1[i]->SetStats(kTRUE); // stat box f2_hist1[i]->SetStats(kTRUE); @@ -297,23 +375,27 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ ptstats2->SetParent(f2_hist1[i]->GetListOfFunctions()); f1_hist1[i]->Draw(""); // "stat" - f2_hist1[i]->Draw("histsames"); + f2_hist1[i]->Draw("hist sames"); leg->Draw(); myc->SaveAs(label1[i]); if(myc) delete myc; + + std::cout << "1D histos " << i << " produced" << std::endl; + } + // Profiles for (int i = 0; i < Nprof; i++){ TCanvas *myc = new TCanvas("myc","",800,600); bool skipHisto = false; - if (fastsim && i>=6 && i<=8) skipHisto = true; + if (fastsim && i>=6 && i<=8) skipHisto = true; // SimHits to exclude if (!skipHisto) { f1_prof[i]->SetStats(kFALSE); @@ -337,22 +419,25 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ f2_prof[i]->SetMarkerStyle(20); f2_prof[i]->SetMarkerSize(0.8); - if(i > 8 ) { + if(i > 8 && i < 12) { // Timing f1_prof[i]->SetMarkerSize(0.1); f2_prof[i]->SetMarkerSize(0.3); } myc->SetGrid(); - - if( i <= 8) { - f1_prof[i]->Draw("histpl"); - f2_prof[i]->Draw("histplsame"); // esame + + if( i <= 8 || i >= 12) { // Other than RecHits timing + f1_prof[i]->Draw("histpl "); + f2_prof[i]->Draw("histplsame"); // } else { - f1_prof[i]->Draw("pl"); - f2_prof[i]->Draw("plsame"); // esame + f1_prof[i]->Draw("pl"); // RecHits Timing + f2_prof[i]->Draw("pl same"); // } + f1_prof[i]->GetOption(); + f2_prof[i]->GetOption(); + TLegend *leg = new TLegend(0.40, 0.91, 0.74, 0.99, "","brNDC"); leg->SetBorderSize(2); @@ -365,29 +450,77 @@ void SinglePi(const TString ref_vers, const TString val_vers, bool fastsim){ myc->SaveAs(labelp[i]); } if(myc) delete myc; + + std::cout << "Profile " << i << " produced" << std::endl; + + } - TCanvas *myc = new TCanvas("myc","",800,600); + + + // RATIO CaloTower 1 + + + TCanvas *myc1 = new TCanvas("myc1","",800,600); TProfile* ratio1 = (TProfile*)f2_prof[2]->Clone(); ratio1->Divide(f1_prof[2]); ratio1->SetMaximum(1.2); ratio1->SetMinimum(0.8); - myc->SetGrid(); + myc1->SetGrid(); ratio1->Draw("hist pl"); - TLegend *leg = new TLegend(0.20, 0.91, 0.70, 0.99, "","brNDC"); - leg->SetBorderSize(2); - leg->SetFillStyle(1001); - leg->AddEntry(ratio1,"CaloTowers scale (pi50) ratio "+val_vers+"/"+ref_vers+" vs ieta","pl"); - leg->Draw(""); + TLegend *leg1 = new TLegend(0.20, 0.91, 0.70, 0.99, "","brNDC"); + leg1->SetBorderSize(2); + leg1->SetFillStyle(1001); + leg1->AddEntry(ratio1,"CaloTowers scale (pi50) ratio "+val_vers+"/"+ref_vers+" vs ieta","pl"); + leg1->Draw(""); + + myc1->SaveAs("Ratio.gif"); + + + // RATIO HCAL RecHits in R=0.3 + + TCanvas *myc2 = new TCanvas("myc2","",800,600); + + TProfile* ratio2 = (TProfile*)f2_prof[4]->Clone(); + ratio2->Divide(f1_prof[4]); + ratio2->SetMaximum(1.2); + ratio2->SetMinimum(0.8); + myc2->SetGrid(); + ratio2->Draw("hist pl"); + + TLegend *leg2 = new TLegend(0.10, 0.91, 0.80, 0.99, "","brNDC"); + leg2->SetBorderSize(2); + leg2->SetFillStyle(1001); + leg2->AddEntry(ratio2,"HCAL sum ratio "+val_vers+"/"+ref_vers+" vs ieta","pl"); + leg2->Draw(""); + + myc2->SaveAs("Ratio_Hcone.gif"); + + + // RATIO CaloTowers H sum in R=0.3 + + TCanvas *myc3 = new TCanvas("myc3","",800,600); + + TProfile* ratio3 = (TProfile*)f2_prof[13]->Clone(); + ratio3->Divide(f1_prof[13]); + ratio3->SetMaximum(1.2); + ratio3->SetMinimum(0.8); + myc3->SetGrid(); + ratio3->Draw("hist pl"); + + TLegend *leg3 = new TLegend(0.10, 0.91, 0.80, 0.99, "","brNDC"); + leg3->SetBorderSize(2); + leg3->SetFillStyle(1001); + leg3->AddEntry(ratio3,"CaloTowers HAD in R=0.3 ratio "+val_vers+"/"+ref_vers+" vs ieta","pl"); + leg3->Draw(""); + myc3->SaveAs("Ratio_CaloTowers_Hcone.gif"); - // f1_prof[2]->Draw(); - myc->SaveAs("Ratio.gif"); - // close ROOT files + // close ROOT files =========================================== // f1.Close() ; f2.Close() ; diff --git a/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html b/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html index 8eaeed2414fd3..80a1b29512ffb 100644 --- a/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html +++ b/Validation/CaloTowers/test/macros/html_indices/SinglePiScan.html @@ -11,6 +11,7 @@ - 50k events - no field
- no vertex smearing
+ - no material in front of Calorimetry
- no Triggers


@@ -30,6 +31,23 @@
+
+ +Plotted in this row is the number of Digis per each subdetector
+ +

+ + + + + + + + + + + +


Plotted in this row is the HCAL subdetectors RecHits energy (mostly noise with single-pion contributin on the right side
Plots ====>>> HB >>> HE >>> HO >>> HF @@ -62,7 +80,7 @@
Plotted in this row is the RecHits energy collected in R=0.3 : EM, HAD and EM+HAD without HO
-Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> +Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of Had component

@@ -72,6 +90,9 @@ + + +


@@ -94,10 +115,33 @@ - +
+ + +Plotted in the row below is the same quantities as above,
+but for all CaloTowers in the cone R=0.3 around MC direction of the pion +
+Also added is a plot of the HAD cmponent ratio (new / previous). +

+

+Plots ====>>> Em component >>> Had component (no HO) >>> Total energy (Em+Had) >>> Ratio of Had component
+
+

+

+ + + + + + + + +


+ + Finally: number of CaloTowers in HB, HE and HF (separately)

diff --git a/Validation/GlobalRecHits/python/globalrechits_analyze_cfi.py b/Validation/GlobalRecHits/python/globalrechits_analyze_cfi.py index 9c90dcc4efa65..d8cc071607ee0 100644 --- a/Validation/GlobalRecHits/python/globalrechits_analyze_cfi.py +++ b/Validation/GlobalRecHits/python/globalrechits_analyze_cfi.py @@ -50,5 +50,8 @@ ECalEBSrc = cms.InputTag("ecalRecHit","EcalRecHitsEB") ) - - +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(globalrechitsanalyze, + pixelSimLinkSrc = "mixData:PixelDigiSimLink", + stripSimLinkSrc = "mixData:StripDigiSimLink", +) diff --git a/Validation/HGCalValidation/plugins/BuildFile.xml b/Validation/HGCalValidation/plugins/BuildFile.xml index f86a4cd44a910..36cc014ac26a6 100644 --- a/Validation/HGCalValidation/plugins/BuildFile.xml +++ b/Validation/HGCalValidation/plugins/BuildFile.xml @@ -3,6 +3,7 @@ + diff --git a/Validation/HGCalValidation/plugins/CaloParticleValidation.cc b/Validation/HGCalValidation/plugins/CaloParticleValidation.cc new file mode 100644 index 0000000000000..e7e83e614884f --- /dev/null +++ b/Validation/HGCalValidation/plugins/CaloParticleValidation.cc @@ -0,0 +1,271 @@ +// -*- C++ -*- +// +// Class: CaloParticleValidation +// Original Author: Marco Rovere +// Created: Thu, 18 Jan 2018 15:54:55 GMT +// +// + +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +#include "DataFormats/EgammaReco/interface/SuperCluster.h" +#include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" +#include "SimDataFormats/Vertex/interface/SimVertex.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" + +// +// class declaration +// + +struct Histogram_CaloParticleSingle { + ConcurrentMonitorElement eta_; + ConcurrentMonitorElement pt_; + ConcurrentMonitorElement energy_; + ConcurrentMonitorElement nSimClusters_; + ConcurrentMonitorElement nHitInSimClusters_; + ConcurrentMonitorElement selfEnergy_; // this is the sum of the energy associated to all recHits linked to all SimClusters + ConcurrentMonitorElement energyDifference_; // This contains (energy-selfEnergy)/energy + ConcurrentMonitorElement eta_Zorigin_map_; + ConcurrentMonitorElement simPFSuperClusterSize_; + ConcurrentMonitorElement simPFSuperClusterEnergy_; + ConcurrentMonitorElement pfcandidateType_; + ConcurrentMonitorElement pfcandidateEnergy_; + ConcurrentMonitorElement pfcandidatePt_; + ConcurrentMonitorElement pfcandidateEta_; + ConcurrentMonitorElement pfcandidatePhi_; + ConcurrentMonitorElement pfcandidateElementsInBlocks_; +}; + + +using Histograms_CaloParticleValidation = std::unordered_map; + +class CaloParticleValidation : public DQMGlobalEDAnalyzer { + public: + explicit CaloParticleValidation(const edm::ParameterSet&); + ~CaloParticleValidation() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + + private: + void bookHistograms(DQMStore::ConcurrentBooker &, + edm::Run const&, + edm::EventSetup const&, + Histograms_CaloParticleValidation&) const override; + + void dqmAnalyze(edm::Event const&, + edm::EventSetup const&, + Histograms_CaloParticleValidation const&) const override; + + // ----------member data --------------------------- + std::string folder_; + std::vector particles_to_monitor_; + + edm::EDGetTokenT > simVertices_; + edm::EDGetTokenT > caloParticles_; + edm::EDGetTokenT> simPFClusters_; + edm::EDGetTokenT simPFCandidates_; + edm::EDGetTokenT recHitsEE_; + edm::EDGetTokenT recHitsFH_; + edm::EDGetTokenT recHitsBH_; +}; + +// +// constants, enums and typedefs +// + +// +// static data member definitions +// + +// +// constructors and destructor +// +CaloParticleValidation::CaloParticleValidation(const edm::ParameterSet& iConfig) + : folder_(iConfig.getParameter("folder")), + particles_to_monitor_(iConfig.getParameter >("particles_to_monitor")), + simVertices_(consumes>(iConfig.getParameter("simVertices"))), + caloParticles_(consumes >(iConfig.getParameter("caloParticles"))), + simPFClusters_(consumes>(iConfig.getParameter("simPFClusters"))), + simPFCandidates_(consumes(iConfig.getParameter("simPFCandidates"))), + recHitsEE_(consumes(iConfig.getParameter("recHitsEE"))), + recHitsFH_(consumes(iConfig.getParameter("recHitsFH"))), + recHitsBH_(consumes(iConfig.getParameter("recHitsBH"))) +{ + //now do what ever initialization is needed +} + + +CaloParticleValidation::~CaloParticleValidation() +{ + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) +} + + +// +// member functions +// + +// ------------ method called for each event ------------ + +void +CaloParticleValidation::dqmAnalyze(edm::Event const& iEvent, edm::EventSetup const& iSetup, + Histograms_CaloParticleValidation const & histos) const +{ + using namespace edm; + + Handle recHitHandleEE; + Handle recHitHandleFH; + Handle recHitHandleBH; + // make a map detid-rechit + + iEvent.getByToken(recHitsEE_, recHitHandleEE); + iEvent.getByToken(recHitsFH_, recHitHandleFH); + iEvent.getByToken(recHitsBH_, recHitHandleBH); + const auto& rechitsEE = *recHitHandleEE; + const auto& rechitsFH = *recHitHandleFH; + const auto& rechitsBH = *recHitHandleBH; + std::map hitmap; + for (unsigned int i = 0; i < rechitsEE.size(); ++i) { + hitmap[rechitsEE[i].detid()] = &rechitsEE[i]; + } + for (unsigned int i = 0; i < rechitsFH.size(); ++i) { + hitmap[rechitsFH[i].detid()] = &rechitsFH[i]; + } + for (unsigned int i = 0; i < rechitsBH.size(); ++i) { + hitmap[rechitsBH[i].detid()] = &rechitsBH[i]; + } + + Handle> simVerticesHandle; + iEvent.getByToken(simVertices_, simVerticesHandle); + std::vector const & simVertices = *simVerticesHandle; + + Handle > caloParticleHandle; + iEvent.getByToken(caloParticles_, caloParticleHandle); + std::vector const & caloParticles = *caloParticleHandle; + + Handle> simPFClustersHandle; + iEvent.getByToken(simPFClusters_, simPFClustersHandle); + std::vector const & simPFClusters = *simPFClustersHandle; + + Handle simPFCandidatesHandle; + iEvent.getByToken(simPFCandidates_, simPFCandidatesHandle); + reco::PFCandidateCollection const & simPFCandidates = *simPFCandidatesHandle; + + for (auto const caloParticle : caloParticles) { + int id = caloParticle.pdgId(); + if (histos.count(id)) { + auto & histo = histos.at(id); + histo.eta_.fill(caloParticle.eta()); + histo.pt_.fill(caloParticle.pt()); + histo.energy_.fill(caloParticle.energy()); + histo.nSimClusters_.fill(caloParticle.simClusters().size()); + // Find the corresponding vertex. + histo.eta_Zorigin_map_.fill( + simVertices.at(caloParticle.g4Tracks()[0].vertIndex()).position().z(), caloParticle.eta()); + int simHits = 0; + float energy = 0.; + for (auto const sc : caloParticle.simClusters()) { + simHits += sc->hits_and_fractions().size(); + for (auto const h_and_f : sc->hits_and_fractions()) { + if (hitmap.count(h_and_f.first)) + energy += hitmap[h_and_f.first]->energy() * h_and_f.second; + } + } + histo.nHitInSimClusters_.fill((float)simHits); + histo.selfEnergy_.fill(energy); + histo.energyDifference_.fill(1.- energy/caloParticle.energy()); + } + } + + // simPFSuperClusters + for (auto const sc : simPFClusters) { + histos.at(0).simPFSuperClusterSize_.fill((float)sc.clustersSize()); + histos.at(0).simPFSuperClusterEnergy_.fill(sc.rawEnergy()); + } + + // simPFCandidates + int offset = 100000; + for (auto const pfc : simPFCandidates) { + size_t type = offset + pfc.particleId(); + histos.at(offset).pfcandidateType_.fill(type - offset); + auto & histo = histos.at(type); + histo.pfcandidateEnergy_.fill(pfc.energy()); + histo.pfcandidatePt_.fill(pfc.pt()); + histo.pfcandidateEta_.fill(pfc.eta()); + histo.pfcandidatePhi_.fill(pfc.phi()); + histo.pfcandidateElementsInBlocks_.fill(pfc.elementsInBlocks().size()); + } +} + + +void +CaloParticleValidation::bookHistograms(DQMStore::ConcurrentBooker & ibook, + edm::Run const & run, + edm::EventSetup const & iSetup, + Histograms_CaloParticleValidation & histos) const +{ + for (auto const particle : particles_to_monitor_) { + ibook.setCurrentFolder(folder_ + "CaloParticles/" + std::to_string(particle)); + auto & histo = histos[particle]; + histo.eta_ = ibook.book1D("Eta", "Eta", 80, -4., 4.); + histo.energy_ = ibook.book1D("Energy", "Energy", 250, 0., 500.); + histo.pt_ = ibook.book1D("Pt", "Pt", 100, 0., 100.); + histo.nSimClusters_ = ibook.book1D("NSimClusters", "NSimClusters", 100, 0., 100.); + histo.nHitInSimClusters_ = ibook.book1D("NHitInSimClusters", "NHitInSimClusters", 100, 0., 100.); + histo.selfEnergy_ = ibook.book1D("SelfEnergy", "SelfEnergy", 250, 0., 500.); + histo.energyDifference_ = ibook.book1D("EnergyDifference", "(Energy-SelfEnergy)/Energy", 300, -5., 1.); + histo.eta_Zorigin_map_ = ibook.book2D("Eta vs Zorigin", "Eta vs Zorigin", 80, -4., 4., 1100, -550., 550.); + } + int offset = 100000; + ibook.setCurrentFolder(folder_ + "PFCandidates"); + histos[offset].pfcandidateType_ = ibook.book1D("PFCandidateType", "PFCandidateType", 10, 0, 10); + for (size_t type = reco::PFCandidate::h; type <= reco::PFCandidate::egamma_HF; type++) { + ibook.setCurrentFolder(folder_ + "PFCandidates/" + std::to_string(type)); + auto & histo = histos[offset + type]; + histo.pfcandidateEnergy_ = ibook.book1D("PFCandidateEnergy", "PFCandidateEnergy", 250, 0., 250.); + histo.pfcandidatePt_ = ibook.book1D("PFCandidatePt", "PFCandidatePt", 250, 0., 250.); + histo.pfcandidateEta_ = ibook.book1D("PFCandidateEta", "PFCandidateEta", 100, -5., 5.); + histo.pfcandidatePhi_ = ibook.book1D("PFCandidatePhi", "PFCandidatePhi", 100, -4., 4.); + histo.pfcandidateElementsInBlocks_ = ibook.book1D("PFCandidateElements", "PFCandidateElements", 20, 0., 20.); + } + // Folder '0' is meant to be cumulative, with no connection to pdgId + ibook.setCurrentFolder(folder_ + std::to_string(0)); + histos[0].simPFSuperClusterSize_ = ibook.book1D("SimPFSuperClusterSize", "SimPFSuperClusterSize", 40, 0., 40.); + histos[0].simPFSuperClusterEnergy_ = ibook.book1D("SimPFSuperClusterEnergy", "SimPFSuperClusterEnergy", 250, 0., 500.); +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void +CaloParticleValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + edm::ParameterSetDescription desc; + desc.add("folder", "HGCAL/"); // Please keep the trailing '/' + desc.add > ("particles_to_monitor", {11, -11, 13, 22, 111, 211, -211, 321, -321}); + desc.add("simVertices", edm::InputTag("g4SimHits")); + desc.add("caloParticles", edm::InputTag("mix", "MergedCaloTruth")); + desc.add("simPFClusters", edm::InputTag("simPFProducer", "perfect")); + desc.add("simPFCandidates", edm::InputTag("simPFProducer")); + desc.add("recHitsEE", edm::InputTag("HGCalRecHit","HGCEERecHits")); + desc.add("recHitsFH", edm::InputTag("HGCalRecHit","HGCHEFRecHits")); + desc.add("recHitsBH", edm::InputTag("HGCalRecHit","HGCHEBRecHits")); + descriptions.add("caloparticlevalidation", desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(CaloParticleValidation); diff --git a/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py b/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py index a6ad02ab42580..7763c2c6ec891 100644 --- a/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py +++ b/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py @@ -17,5 +17,6 @@ ) from Validation.HGCalValidation.hgcalHitCalibration_cfi import hgcalHitCalibration +from Validation.HGCalValidation.caloparticlevalidation_cfi import caloparticlevalidation -hgcalHitValidationSequence = cms.Sequence(hgcalHitValidation+hgcalHitCalibration) +hgcalHitValidationSequence = cms.Sequence(hgcalHitValidation+hgcalHitCalibration+caloparticlevalidation) diff --git a/Validation/HcalDigis/python/HLTHcalDigisParam_cfi.py b/Validation/HcalDigis/python/HLTHcalDigisParam_cfi.py index 99320d148e319..4454d526c16c7 100644 --- a/Validation/HcalDigis/python/HLTHcalDigisParam_cfi.py +++ b/Validation/HcalDigis/python/HLTHcalDigisParam_cfi.py @@ -16,6 +16,11 @@ hltHCALdigisAnalyzer.TestNumber = cms.bool(False) hltHCALdigisAnalyzer.hep17 = cms.bool(False) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(hltHCALdigisAnalyzer, + dataTPs = "DMHcalTriggerPrimitiveDigis", +) + from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 run2_HCAL_2017.toModify(hltHCALdigisAnalyzer, TestNumber = cms.bool(True) diff --git a/Validation/HcalDigis/python/HcalDigisParam_cfi.py b/Validation/HcalDigis/python/HcalDigisParam_cfi.py index e404b98bc0e47..209dda2ef343c 100644 --- a/Validation/HcalDigis/python/HcalDigisParam_cfi.py +++ b/Validation/HcalDigis/python/HcalDigisParam_cfi.py @@ -23,6 +23,11 @@ from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toModify(hcaldigisAnalyzer, simHits = "fastSimProducer:HcalHits") +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(hcaldigisAnalyzer, + dataTPs = "DMHcalTriggerPrimitiveDigis", +) + from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 run2_HCAL_2017.toModify(hcaldigisAnalyzer, TestNumber = cms.bool(True) diff --git a/Validation/HcalDigis/src/HcalDigisValidation.cc b/Validation/HcalDigis/src/HcalDigisValidation.cc index 6d52554756e0c..88b8a1a8e675c 100644 --- a/Validation/HcalDigis/src/HcalDigisValidation.cc +++ b/Validation/HcalDigis/src/HcalDigisValidation.cc @@ -189,7 +189,7 @@ void HcalDigisValidation::booking(DQMStore::IBooker &ib, const std::string bsubd HistLim sime(200, 0., 1.0); HistLim digiAmp(360, -100., 7100.); - HistLim digiAmpWide(360, -10000., 710000.); + HistLim digiAmpWide(2410, -3000., 720000.); //300 fC binning HistLim ratio(2000, -100., 3900.); HistLim sumAmp(100, -500., 1500.); @@ -1112,7 +1112,7 @@ template void HcalDigisValidation::reco(const edm::Event& i // fraction 5,6 bins if ampl. is big. //histogram names have not been changed, but it should be understood that bin_5 is soi, and bin_6_7 is latter TS' - if (v_ampl[depth] > 30.) { + if ((v_ampl[depth] > 30. && (subdet_ != "HE" || subdet_ != "HB")) || (v_ampl[depth] > 300.)) { //300 fC cut for QIE-11 HB & HE double fbinSOI = tool[soi] - calibrations.pedestal((dataFrame)[soi].capid()); double fbinPS = 0; diff --git a/Validation/HcalHits/interface/HcalSimHitsValidation.h b/Validation/HcalHits/interface/HcalSimHitsValidation.h index d4847e7794c94..0f26f3a57283f 100644 --- a/Validation/HcalHits/interface/HcalSimHitsValidation.h +++ b/Validation/HcalHits/interface/HcalSimHitsValidation.h @@ -109,6 +109,9 @@ class HcalSimHitsValidation : public DQMEDAnalyzer { // counter int nevtot; + // sampling factors + double hf1_; + double hf2_; }; #endif diff --git a/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py b/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py index eb3e435f6e306..6e9cfa3350c39 100644 --- a/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py +++ b/Validation/HcalHits/python/HcalSimHitsValidation_cfi.py @@ -2,11 +2,23 @@ from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer HcalSimHitsAnalyser = DQMEDAnalyzer('HcalSimHitsValidation', - outputFile = cms.untracked.string('') + outputFile = cms.untracked.string(''), + hf1 = cms.double(1/0.383), + hf2 = cms.double(1/0.368) ) from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toModify( HcalSimHitsAnalyser, ModuleLabel = cms.untracked.string("fastSimProducer") ) from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 -run2_HCAL_2017.toModify( HcalSimHitsAnalyser, TestNumber = cms.untracked.bool(True), EEHitCollection = cms.untracked.string("") ) +run2_HCAL_2017.toModify( HcalSimHitsAnalyser, TestNumber = cms.untracked.bool(True) ) + +from Configuration.Eras.Modifier_phase2_hcal_cff import phase2_hcal +phase2_hcal.toModify( HcalSimHitsAnalyser, EEHitCollection = cms.untracked.string("") ) + +# post-LS1 switch for sampling factors +from Configuration.Eras.Modifier_run2_common_cff import run2_common +run2_common.toModify( HcalSimHitsAnalyser, + hf1 = cms.double(1/0.67), + hf2 = cms.double(1/0.67) +) diff --git a/Validation/HcalHits/src/HcalSimHitsValidation.cc b/Validation/HcalHits/src/HcalSimHitsValidation.cc index 2c554cff3569a..4c54a2fa563ed 100644 --- a/Validation/HcalHits/src/HcalSimHitsValidation.cc +++ b/Validation/HcalHits/src/HcalSimHitsValidation.cc @@ -13,6 +13,10 @@ HcalSimHitsValidation::HcalSimHitsValidation(edm::ParameterSet const& conf) { hcalHits_ = conf.getUntrackedParameter("HcalHitCollection","HcalHits"); ebHits_ = conf.getUntrackedParameter("EBHitCollection","EcalHitsEB"); eeHits_ = conf.getUntrackedParameter("EEHitCollection","EcalHitsEE"); + + // import sampling factors + hf1_ = conf.getParameter("hf1"); + hf2_ = conf.getParameter("hf2"); tok_evt_ = consumes(edm::InputTag("generatorSmeared")); tok_hcal_ = consumes(edm::InputTag(g4Label_,hcalHits_)); @@ -289,8 +293,8 @@ void HcalSimHitsValidation::analyze(edm::Event const& ev, edm::EventSetup const& //Approximate calibration constants const float calib_HB = 120.; const float calib_HE = 190.; - const float calib_HF1 = 1.0/0.383; - const float calib_HF2 = 1.0/0.368; + const float calib_HF1 = hf1_;//1.0/0.383; + const float calib_HF2 = hf2_;//1.0/0.368; edm::Handle hcalHits; ev.getByToken(tok_hcal_,hcalHits); diff --git a/Validation/RPCRecHits/python/rpcRecHitValidation_cfi.py b/Validation/RPCRecHits/python/rpcRecHitValidation_cfi.py index 7ab0c0c3e7c46..eaaa2b488f99c 100644 --- a/Validation/RPCRecHits/python/rpcRecHitValidation_cfi.py +++ b/Validation/RPCRecHits/python/rpcRecHitValidation_cfi.py @@ -15,3 +15,5 @@ from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toModify(rpcRecHitV, simHit = "MuonSimHits:MuonRPCHits") +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(rpcRecHitV, simTrack = "mixData:MergedTrackTruth") diff --git a/Validation/RecoMuon/python/MuonTrackValidator_cfi.py b/Validation/RecoMuon/python/MuonTrackValidator_cfi.py index c93c802f19573..a92189bdee0c6 100644 --- a/Validation/RecoMuon/python/MuonTrackValidator_cfi.py +++ b/Validation/RecoMuon/python/MuonTrackValidator_cfi.py @@ -54,3 +54,9 @@ run3_GEM.toModify( muonTrackValidator, useGEMs = cms.bool(True) ) from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon phase2_muon.toModify( muonTrackValidator, useME0 = cms.bool(True) ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(muonTrackValidator, + label_tp_effic = "mixData:MergedTrackTruth", + label_tp_fake = "mixData:MergedTrackTruth", +) diff --git a/Validation/RecoMuon/python/RecoMuonValidator_cfi.py b/Validation/RecoMuon/python/RecoMuonValidator_cfi.py index 9ad9c694c6c30..5f0db2196dff6 100644 --- a/Validation/RecoMuon/python/RecoMuonValidator_cfi.py +++ b/Validation/RecoMuon/python/RecoMuonValidator_cfi.py @@ -93,3 +93,6 @@ # Number of sim,reco Tracks # nTrks = cms.untracked.uint32(50) ) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(recoMuonValidator, simLabel = "mixData:MergedTrackTruth") diff --git a/Validation/RecoMuon/python/associators_cff.py b/Validation/RecoMuon/python/associators_cff.py index 010b94de761dc..a63a5cc27d510 100644 --- a/Validation/RecoMuon/python/associators_cff.py +++ b/Validation/RecoMuon/python/associators_cff.py @@ -9,9 +9,9 @@ import SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi trackAssociatorByHits = SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi.quickTrackAssociatorByHits.clone() -tpToTkmuTrackAssociation = cms.EDProducer('TrackAssociatorEDProducer', +from SimTracker.TrackAssociation.trackingParticleRecoTrackAsssociation_cfi import trackingParticleRecoTrackAsssociation as _trackingParticleRecoTrackAsssociation +tpToTkmuTrackAssociation = _trackingParticleRecoTrackAsssociation.clone( associator = cms.InputTag('trackAssociatorByHits'), - label_tp = cms.InputTag('mix', 'MergedTrackTruth'), # label_tr = cms.InputTag('generalTracks') label_tr = cms.InputTag('probeTracks') ) diff --git a/Validation/RecoMuon/python/selectors_cff.py b/Validation/RecoMuon/python/selectors_cff.py index e9a103e48db8d..9a3caf3e3eb19 100644 --- a/Validation/RecoMuon/python/selectors_cff.py +++ b/Validation/RecoMuon/python/selectors_cff.py @@ -16,9 +16,10 @@ stableOnly = cms.bool(True), # discard decays in flight from the signal event chargedOnly = cms.bool(True) ) +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(muonTPSet, src = "mixData:MergedTrackTruth") -me0MuonTPSet = cms.PSet( - src = cms.InputTag("mix", "MergedTrackTruth"), +me0MuonTPSet = muonTPSet.clone( pdgId = cms.vint32(13, -13), tip = cms.double(3.5), lip = cms.double(30.0), @@ -33,8 +34,7 @@ chargedOnly = cms.bool(True) ) -displacedMuonTPSet = cms.PSet( - src = cms.InputTag("mix", "MergedTrackTruth"), +displacedMuonTPSet = muonTPSet.clone( pdgId = cms.vint32(13, -13), tip = cms.double(85.), # radius to have at least the 3 outermost TOB layers lip = cms.double(210.), # z to have at least the 3 outermost TEC layers @@ -63,6 +63,7 @@ stableOnly = cms.bool(True), # accept only TP from the Generator (linked to GenParticles) chargedOnly = cms.bool(True) ) +premix_stage2.toModify(cosmicMuonTPSet, src = "mixData:MergedTrackTruth") #muonTP = cms.EDFilter("TrackingParticleSelector", # muonTPSet diff --git a/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C b/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C index 02771ad6fe8d3..3fe3057db8fe9 100644 --- a/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/IsoValHistoPublisher.C @@ -97,7 +97,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE Double_t norm [] = {0.,0.,0.,0.}; //===== Tracker, ECAL Deposits const char* plots1 [] = {"sumPt", "emEt", "sumPt_cd", "emEt_cd"}; - Plot4Histograms(newDir + "/muonIso1.pdf", + Plot4Histograms(newDir + "/muonIso1", rdir, sdir, rcollname, scollname, "IsoHistos1", "Tracker, ECAL Deposits", @@ -107,7 +107,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE //===== HCAL and HO Isolation Distributions const char* plots2 [] = {"hadEt", "hoEt", "hadEt_cd", "hoEt_cd"}; - Plot4Histograms(newDir + "/muonIso2.pdf", + Plot4Histograms(newDir + "/muonIso2", rdir, sdir, rcollname, scollname, "IsoHistos2", "HCAL, HO Deposits", @@ -117,7 +117,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE //===== N_Tracks, N_Jets around #mu const char* plots3 [] = {"nTracks", "nJets", "nTracks_cd", "nJets_cd"}; - Plot4Histograms(newDir + "/muonIso3.pdf", + Plot4Histograms(newDir + "/muonIso3", rdir, sdir, rcollname, scollname, "IsoHistos3", "Number of tracks, jets around #mu", @@ -129,7 +129,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE //===== avg Pt, weighted Et around #mu const char* plots4 [] = {"avgPt", "weightedEt", "avgPt_cd", "weightedEt_cd"}; - Plot4Histograms(newDir + "/muonIso4.pdf", + Plot4Histograms(newDir + "/muonIso4", rdir, sdir, rcollname, scollname, "IsoHistos4", "Average p_{T}, weighted E_{T} aroun #mu", @@ -141,7 +141,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE //===== Tracker and CAL deposits vs muon pT const char* plots5 [] = {"muonPt_sumPt", "muonPt_emEt", "muonPt_hadEt", "muonPt_hoEt"}; Double_t norm2 [] = {-999.,-999.,-999.,-999.}; - Plot4Histograms(newDir + "/muonIso5.pdf", + Plot4Histograms(newDir + "/muonIso5", rdir, sdir, rcollname, scollname, "IsoHistos5", "Trk, CAL Isolations vs. #mu p_{T}", @@ -151,7 +151,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE //===== NTracks, NJets, avgPt, weightedEt vs Muon pT const char* plots6 [] = {"muonPt_nTracks", "muonPt_nJets", "muonPt_avgPt", "muonPt_weightedEt"}; - Plot4Histograms(newDir + "/muonIso6.pdf", + Plot4Histograms(newDir + "/muonIso6", rdir, sdir, rcollname, scollname, "IsoHistos6", "Other stuff vs #mu p_{T}", @@ -179,7 +179,7 @@ void IsoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="RE gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf "+newDir); + gSystem->Exec("rm -rf "+newDir+"/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" diff --git a/Validation/RecoMuon/test/macro/PlotHelpers.C b/Validation/RecoMuon/test/macro/PlotHelpers.C index f0c23ced8b811..f3848677dca91 100644 --- a/Validation/RecoMuon/test/macro/PlotHelpers.C +++ b/Validation/RecoMuon/test/macro/PlotHelpers.C @@ -17,6 +17,10 @@ void NormalizeHistogramsToFirst(TH1* h1, TH1* h2); void NormalizeHistogramsTo1(TH1* h1, TH1* h2); +TH1* PlotRatiosHistograms(TH1* h1, TH1* h2); + +int ratioCounter = 0; + ///// // Uncomment the following line to get more debuggin output @@ -40,6 +44,7 @@ void SetGlobalStyle() { //tyle->SetTitleYSize(0.3); //gStyle->SetLabelSize(0.6) //gStyle->SetTextSize(0.5); + gStyle->SetOptStat(0); } // //////////////////////////////////////////////////////////// @@ -62,12 +67,15 @@ void SetHistogramStyle(TH1* h, Style_t mstyle, Color_t color, Size_t msize = 0.7 h->SetLineWidth(lwidth); h->GetYaxis()->SetTitleSize(tsize); h->GetYaxis()->SetTitleOffset(toffset); + h->GetXaxis()->SetLabelFont(63); + h->GetXaxis()->SetLabelSize(14); // labels will be 14 pixels + h->GetYaxis()->SetLabelFont(63); + h->GetYaxis()->SetLabelSize(14); } // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// -// // This function finds the list of TDirectories in a branch // that match a given string @@ -354,7 +362,7 @@ void PlotNHistograms(const TString& pdfFile, #endif rdir->GetObject(rcollname + "/" + hnames_tmp, rh); if (! rh) { - cout << "WARNING: Could not find a reference histogram or profile named " << hnames_tmp[i] + cout << "WARNING: Could not find a reference histogram or profile named " << hnames_tmp << " in " << rdir->GetName() << endl; cout << " Skipping" << endl; continue; @@ -398,8 +406,8 @@ void PlotNHistograms(const TString& pdfFile, << " from " << sdir << endl; #endif sdir->GetObject(scollname + "/" + hnames_tmp, sh); - if (! rh) { - cout << "WARNING: Could not find a signal histogram or profile named " << hnames_tmp[i] + if (! sh) { + cout << "WARNING: Could not find a signal histogram or profile named " << hnames_tmp << " in " << rdir->GetName() << endl; cout << " Skipping" << endl; continue; @@ -408,7 +416,7 @@ void PlotNHistograms(const TString& pdfFile, //If it is a 2D project it in Y... is this what we always want? if (TString(sh->IsA()->GetName()) == "TH2F") { #ifdef DEBUG - cout << "DEBUG: " << hnames_tmp[i] << " is a TH2F object... project in Y!" << endl; + cout << "DEBUG: " << hnames_tmp << " is a TH2F object... project in Y!" << endl; #endif TH1* proj = ((TH2F*) sh)->ProjectionY(); sh = proj; @@ -470,6 +478,22 @@ void PlotNHistograms(const TString& pdfFile, // Move to subpad canvas->cd(i+1); + TPad* pad1 = NULL; + TPad* pad2 = NULL; + + pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); + pad2 = new TPad("pad2", "pad2", 0, 0.0, 1, 0.3); + + pad1->SetTopMargin (0.08); + pad1->SetBottomMargin(0.01); + pad1->Draw(); + + pad2->SetTopMargin (0.05); + pad2->SetBottomMargin(0.45); + pad2->Draw(); + + pad1->cd(); + // Check Logy if (logy) { if (logy[i]) @@ -508,6 +532,12 @@ void PlotNHistograms(const TString& pdfFile, gPad->SetFillColor(kBlue-10); } } + + pad2->cd(); + + TH1* ratioplot = PlotRatiosHistograms(rh, sh); + SetHistogramStyle(ratioplot, 21, 4); + ratioplot->Draw("ep"); } // End loop @@ -534,7 +564,8 @@ void PlotNHistograms(const TString& pdfFile, l->Draw(); // Print Canvas - canvas->Print(pdfFile); + canvas->SaveAs(pdfFile+".pdf"); + canvas->SaveAs(pdfFile+".png"); // Clean memory // delete l; @@ -786,3 +817,48 @@ void plot6histos(TCanvas *canvas, } */ +//////////////////////////////////////////////////////// +// +// ratio plot from the two histograms +// +///////////////////////////////////////////////////////// + +TH1* PlotRatiosHistograms(TH1* h1, TH1* h2){ + + ++ratioCounter; + + Int_t nbinsx = h1->GetNbinsX(); + + Double_t xmin = h1->GetBinLowEdge(0); + Double_t xmax = h1->GetBinLowEdge(nbinsx+1); + + TH1F* h_ratio = new TH1F(Form("h_ratio_%d", ratioCounter), "", nbinsx, xmin, xmax); + + for (Int_t ibin=1; ibin<=nbinsx; ibin++) { + + Float_t h1Value = h1->GetBinContent(ibin); + Float_t h1Error = h1->GetBinError(ibin); + + Float_t h2Value = h2->GetBinContent(ibin); + Float_t h2Error = h2->GetBinError(ibin); + + Float_t ratioVal = 999; + Float_t ratioErr = 999; + + if (h2Value > 0) { + ratioVal = h1Value / h2Value; + ratioErr = h1Error / h2Value; + } + + h_ratio->SetBinContent(ibin, ratioVal); + h_ratio->SetBinError (ibin, ratioErr); + + } + + h_ratio->SetTitle(""); + h_ratio->GetYaxis()->SetTitle(""); + h_ratio->GetYaxis()->SetRangeUser(0.4, 1.6); + + return h_ratio; + +} diff --git a/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C b/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C index 58560926973d0..36cdbd17850e4 100644 --- a/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/RecoMuonValHistoPublisher.C @@ -117,7 +117,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "GlobalMuon(GLB) #Delta p/p", "GlobalMuon(GLB) #Delta p_{T}/p_{T} vs #sigma(#eta)", "GlobalMuon(GLB) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; - Plot4Histograms(newDir + "/muonRecoGlb.pdf", + Plot4Histograms(newDir + "/muonRecoGlb", rdir, sdir, rcollname, scollname, "RecHistosGlb", "Distributions for GlobalMuons (GLB)", @@ -138,7 +138,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil Double_t minx1 [] = {5., -1E100, 5., -1E100, -1E100, -1E100 }; Double_t maxx1 [] = {maxPT, -1E100,maxPT, -1E100, -1E100, -1E100 }; Double_t norm2 [] = {-999.,-999.,-999.,-999.,-999.,-999.}; //Normalize to first histogram - Plot4Histograms(newDir + "/muonRecoGlbEff.pdf", + Plot4Histograms(newDir + "/muonRecoGlbEff", rdir, sdir, rcollname, scollname, "RecEffHistosGlb", "Distributions for GlobalMuons (GLB), efficiencies and fractions", @@ -153,7 +153,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil (baseh + "ErrPt_vs_Eta_Sigma").Data(), (baseh + "ErrPt_vs_Pt_Sigma").Data()}; const char* plotst3[] = {"PFGlobalMuon(GLBPF) #Delta p_{T}/p_{T}", "PFGlobalMuon(GLBPF) #Delta p/p", "PFGlobalMuon(GLBPF) #Delta p_{T}/p_{T} vs #sigma(#eta)", "PFGlobalMuon(GLBPF) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; - Plot4Histograms(newDir + "/muonRecoGlbPF.pdf", + Plot4Histograms(newDir + "/muonRecoGlbPF", rdir, sdir, rcollname, scollname, "RecHistosGlbPF", "Distributions for PFGlobalMuons (GLBPF)", @@ -167,7 +167,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil (baseh + "FractP").Data(), (baseh + "FractEta").Data()}; const char* plotst4[] = {"PFGlobalMuon(GLBPF) #epsilon vs. p", "PFGlobalMuon(GLBPF) #epsilon vs. #eta", "PFGlobalMuon(GLBPF) fraction vs. p", "PFGlobalMuon(GLBPF) fraction vs. #eta"}; - Plot4Histograms(newDir + "/muonRecoGlbPFEff.pdf", + Plot4Histograms(newDir + "/muonRecoGlbPFEff", rdir, sdir, rcollname, scollname, "RecEffHistosGlbPF", "Distributions for PFGlobalMuons (GLBPF), efficiencies and fractions", @@ -186,7 +186,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "StandAloneMuon(STA) #Delta p/p", "StandAloneMuon(STA) #Delta p_{T}/p_{T} vs #sigma(#eta)", "StandAloneMuon(STA) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; - Plot4Histograms(newDir + "/muonRecoSta.pdf", + Plot4Histograms(newDir + "/muonRecoSta", rdir, sdir, rcollname, scollname, "RecHistosSta", "Distributions for StandAloneMuons (STA)", @@ -205,7 +205,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "StandAloneMuon(STA) #epsilon vs. #eta", "StandAloneMuon(STA) fraction vs. p", "StandAloneMuon(STA) fraction vs. #eta"}; - Plot4Histograms(newDir + "/muonRecoStaEff.pdf", + Plot4Histograms(newDir + "/muonRecoStaEff", rdir, sdir, rcollname, scollname, "RecEffHistosSta", "Distributions for StandAloneMuons (STA), efficiencies and fractions", @@ -225,7 +225,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "TrackerMuon(TRK) #Delta p/p", "TrackerMuon(TRK) #Delta p_{T}/p_{T} vs #sigma(#eta)", "TrackerMuon(TRK) #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; - Plot4Histograms(newDir + "/muonRecoTrk.pdf", + Plot4Histograms(newDir + "/muonRecoTrk", rdir, sdir, rcollname, scollname, "RecHistosTrk", "Distributions for TrackerMuons (TRK)", @@ -244,7 +244,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "TrackerMuon(TRK) #epsilon vs. #eta", "TrackerMuon(TRK) fraction vs. p", "TrackerMuon(TRK) fraction vs. #eta"}; - Plot4Histograms(newDir + "/muonRecoTrkEff.pdf", + Plot4Histograms(newDir + "/muonRecoTrkEff", rdir, sdir, rcollname, scollname, "RecEffHistosTrk", "Distributions for TrackerMuons (TRK), efficiencies and fractions", @@ -265,7 +265,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "Tight Muon #Delta p/p", "Tight Muon #Delta p_{T}/p_{T} vs #sigma(#eta)", "Tight Muon #Delta p_{T}/p_{T} vs #sigma(p_{T})"}; - Plot4Histograms(newDir + "/muonRecoTgt.pdf", + Plot4Histograms(newDir + "/muonRecoTgt", rdir, sdir, rcollname, scollname, "RecHistosTgt", "Distributions for Tight Muons", @@ -284,7 +284,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil "Tight Muon #epsilon vs. #eta", "Tight Muon fraction vs. p", "Tight Muon fraction vs. #eta"}; - Plot4Histograms(newDir + "/muonRecoTgtEff.pdf", + Plot4Histograms(newDir + "/muonRecoTgtEff", rdir, sdir, rcollname, scollname, "RecEffHistosTgt", "Distributions for Tight Muons, efficiencies and fractions", @@ -321,7 +321,7 @@ void RecoMuonValHistoPublisher(const char* newFile="NEW_FILE",const char* refFil cout << " ... Done" << endl; cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -r "+newDir); + gSystem->Exec("rm -r "+newDir+"/*.pdf"); } // end of "while loop" diff --git a/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C b/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C index ae98628c0679a..392bb18f56453 100644 --- a/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/RecoValHistoPublisher.C @@ -127,7 +127,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R //===== reco muon distributions: GLB_GLB const char* plots1 [] = {"GlbMuon_Glb_eta", "GlbMuon_Glb_phi", "GlbMuon_Glb_pt", "GlbMuon_Glb_chi2OverDf"}; const char* plotst1 [] = {"GlobalMuon(GLB) #eta", "GlobalMuon(GLB) #phi", "GlobalMuon(GLB) pT", "GlobalMuon(GLB) #chi^{2}/ndf"}; - Plot4Histograms(newDir + "/muonReco1.pdf", + Plot4Histograms(newDir + "/muonReco1", rdir, sdir, rcollname, scollname, "RecoHistos1", "Distributions for GlobalMuons (GLB)", @@ -142,7 +142,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R Double_t minx1 [] = {-1E100,-1E100, 5., -1E100, -1E100 }; Double_t maxx1 [] = {-1E100, -1E100,maxPT, -1E100, -1E100 }; - Plot4Histograms(newDir + "/muonReco2.pdf", + Plot4Histograms(newDir + "/muonReco2", rdir, sdir, rcollname, scollname, "RecoHistos2", "Distributions for GlobalMuons (STA)", @@ -154,7 +154,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R //===== reco muon distributions: GLB_TK const char* plots3 [] = {"GlbMuon_Tk_eta", "GlbMuon_Tk_phi", "GlbMuon_Tk_pt", "GlbMuon_Tk_chi2OverDf"}; const char* plotst3 [] = {"GlobalMuon(TK) #eta", "GlobalMuon(TK) #phi", "GlobalMuon(TK) pT", "GlobalMuon(TK) #chi^{2}/ndf"}; - Plot4Histograms(newDir + "/muonReco3.pdf", + Plot4Histograms(newDir + "/muonReco3", rdir, sdir, rcollname, scollname, "RecoHistos3", "Distributions for GlobalMuons (TK)", @@ -166,7 +166,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R //===== reco muon distributions: STA const char* plots4 [] = {"StaMuon_eta", "StaMuon_phi", "StaMuon_pt", "StaMuon_chi2OverDf"}; const char* plotst4 [] = {"StaMuon #eta", "StaMuon #phi", "StaMuon p_T", "StaMuon #chi^{2}/ndf"}; - Plot4Histograms(newDir + "/muonReco4.pdf", + Plot4Histograms(newDir + "/muonReco4", rdir, sdir, rcollname, scollname, "RecoHistos4", "Distributions for StandAlone Muons", @@ -178,7 +178,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R //===== reco muon distributions: Tracker Muons const char* plots5 [] = {"TkMuon_eta", "TkMuon_phi", "TkMuon_pt", "TkMuon_chi2OverDf"}; const char* plotst5 [] = {"TkMuon #eta", "TkMuon #phi", "TkMuon p_T", "TkMuon #chi^{2}/ndf"}; - Plot4Histograms(newDir + "/muonReco5.pdf", + Plot4Histograms(newDir + "/muonReco5", rdir, sdir, rcollname, scollname, "RecoHistos5", "Distributions for Tracker Muons", @@ -206,7 +206,7 @@ void RecoValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -r "+newDir); + gSystem->Exec("rm -r "+newDir+"/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" diff --git a/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C b/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C index 6ba156da72ce8..1e14cc19e186b 100644 --- a/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/SeedValHistoPublisher.C @@ -120,7 +120,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R /* const char* plots [] = {"", "", "", ""}; const char* plotsl[] = {"", "", "", ""}; - Plot4Histograms(newDir + "/muonIso1.pdf", + Plot4Histograms(newDir + "/muonIso1", rdir, sdir, rcollname, scollname, "", "", @@ -132,7 +132,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R //===== muon seeds plots, first page: const char* plots1 [] = {"seedEta_", "seedEtaErr_", "seedPhi_", "seedPhiErr_"}; const char* plotsl1[] = {"seed #eta", "seed #eta error", "seed #phi", "seed #phi error"}; - Plot4Histograms(newDir + "/muonSeed1.pdf", + Plot4Histograms(newDir + "/muonSeed1", rdir, sdir, rcollname, scollname, "Seeds1", "Seeds eta and phi", @@ -145,7 +145,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R // NOTE: Originally in one page, now split in two pages // const char* plots2 [] = {"seedPt_", "seedPtErrOverPt_", "seedPz_", "seedPzErrOverPz_"}; // const char* plotsl2[] = {"seed P_{T}", "seed P_{T} Err/P_{T}", "seed P_{Z}", "seed P_{Z} Err/P_{Z}"}; - // Plot4Histograms(newDir + "/muonSeed2.pdf", + // Plot4Histograms(newDir + "/muonSeed2", // rdir, sdir, // rcollname, scollname, // "Seeds2", "Seeds momenta", @@ -155,7 +155,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R // const char* plots3 [] = {"NumberOfRecHitsPerSeed_", "seedPErrOverP_", "", ""}; // const char* plotsl3[] = {"Nr RecHits per seed", "seed P Err/P", "", ""}; - // Plot4Histograms(newDir + "/muonSeed3.pdf", + // Plot4Histograms(newDir + "/muonSeed3", // rdir, sdir, // rcollname, scollname, // "Seeds3", "Seeds hits and momentum", @@ -169,7 +169,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R "NumberOfRecHitsPerSeed_", "seedPErrOverP_"}; const char* plotsl2 [] = {"seed P_{T}", "seed P_{T} Err/P_{T}", "seed P_{Z}", "seed P_{Z} Err/P_{Z}", "Nr RecHits per seed", "seed P Err/P"}; - Plot6Histograms(newDir + "/muonSeed2.pdf", + Plot6Histograms(newDir + "/muonSeed2", rdir, sdir, rcollname, scollname, "Seeds2", "Seeds momenta and hits", @@ -194,7 +194,7 @@ void SeedValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile="R gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -r "+newDir); + gSystem->Exec("rm -r "+newDir+"/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" diff --git a/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C b/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C index 061295e903563..2fac61fc73bbe 100644 --- a/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/TrackValHistoPublisher.C @@ -313,7 +313,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" const char* plots0[] = {"effic", "fakerate", "efficPt", "fakeratePt"}; const char* plotsl0[] = {"efficiency vs #eta", "fakerate vs #eta", "efficiency vs Pt", "fakerate vs Pt"}; bool logy0 [] = {false, false, false, false }; - Plot4Histograms(newDir + "/building.pdf", + Plot4Histograms(newDir + "/building", rdir, sdir, rcollname, scollname, "Seeds", "Efficiency Vs Pt and Vs #eta", @@ -325,7 +325,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" const char* plots1[] = { "effic_vs_hit", "fakerate_vs_hit","effic_vs_phi","fakerate_vs_phi"}; const char* plotsl1[] = { "efficiency vs hits", "fakerate vs hits","efficiency vs #phi","fakerate vs #phi"}; bool logy [] = {false, false, false, false }; - Plot4Histograms(newDir + "/building2.pdf", + Plot4Histograms(newDir + "/building2", rdir, sdir, rcollname, scollname, "Seeds2", "Efficiency vs hits and #phi", @@ -343,7 +343,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" // Double_t maxx2 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; // Double_t miny2 [] = {0.5, -1E100, 0., -1E100, 0.5, -1E100 }; // Double_t maxy2 [] = {1.0125, -1E100, -1E100, -1E100, -1E100, -1E100 }; - Plot4Histograms(newDir + "/hitsAndPt.pdf", + Plot4Histograms(newDir + "/hitsAndPt", rdir, sdir, rcollname, scollname, "hits", "Pt", @@ -356,7 +356,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" bool logy3 [] = {false, true, false, true }; bool doKolmo3 [] = {true, true, true, true }; const char* plots3 [] = {"chi2","chi2_prob","chi2mean", "ptres_vs_eta_Mean"}; - Plot4Histograms(newDir + "/tuning.pdf", + Plot4Histograms(newDir + "/tuning", rdir, sdir, rcollname, scollname, "IsoHistos2", "HCAL, HO Deposits", @@ -375,7 +375,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" // Double_t maxx4 [] = {10,10,10, 10, 10, 10 }; // Double_t miny4 [] = {0., -1E100, 0., -1E100, 0, -1E100 }; // Double_t maxy4 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; - Plot6Histograms(newDir + "/Pulls.pdf", + Plot6Histograms(newDir + "/Pulls", rdir, sdir, rcollname, scollname, "Pullsdis", "Pull Distributions", @@ -396,7 +396,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" // Double_t maxy5 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; resol= true; - Plot6Histograms(newDir + "/residuals.pdf", + Plot6Histograms(newDir + "/residuals", rdir, sdir, rcollname, scollname, "residualdis", "residuals vs Pt", @@ -414,7 +414,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" // Double_t maxx6 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; // Double_t miny6 [] = {0., -1E100, 0., -1E100, 0, -1E100 }; // Double_t maxy6 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; - Plot5Histograms(newDir + "/residualsEta.pdf", + Plot5Histograms(newDir + "/residualsEta", rdir, sdir, rcollname, scollname, "residualsdisEta", "residuals vs Eta", @@ -431,7 +431,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" // Double_t maxx7 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; // Double_t miny7 [] = {0., -1E100, 0., -1E100, 0, -1E100 }; // Double_t maxy7 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; - Plot5Histograms(newDir + "/meanvaluesEta.pdf", + Plot5Histograms(newDir + "/meanvaluesEta", rdir, sdir, rcollname, scollname, "meanvaluesEtadis", "mean values vs eta", @@ -451,7 +451,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" Double_t maxx8 [] = {maxPT,maxPT,maxPT,maxPT,maxPT,maxPT}; // Double_t miny8 [] = {0., -1E100, 0., -1E100, 0, -1E100 }; // Double_t maxy8 [] = {-1E100, -1E100, -1E100, -1E100, -1E100, -1E100 }; - Plot5Histograms(newDir + "/resolutionsPt.pdf", + Plot5Histograms(newDir + "/resolutionsPt", rdir, sdir, rcollname, scollname, "resolutionsPtdis", "resolution vs pt", @@ -487,7 +487,7 @@ void TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFile=" gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf "+newDir); + gSystem->Exec("rm -rf "+newDir+"/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" diff --git a/Validation/RecoMuon/test/macro/new_PlotHelpers.C b/Validation/RecoMuon/test/macro/new_PlotHelpers.C index 558bbc62dd54c..3f80c163ac0e0 100644 --- a/Validation/RecoMuon/test/macro/new_PlotHelpers.C +++ b/Validation/RecoMuon/test/macro/new_PlotHelpers.C @@ -16,6 +16,9 @@ void NormalizeHistogramsToFirst(TH1* h1, TH1* h2); void NormalizeHistogramsToOne(TH1* h1, TH1* h2); void NormalizeHistogramsAsDensity(TH1* h1, TH1* h2); +TH1* PlotRatiosHistograms(TH1* h1, TH1* h2); + +int ratioCounter = 0; // debugging printouts bool DEBUGP = false; @@ -38,6 +41,7 @@ void SetGlobalStyle() { //tyle->SetTitleYSize(0.3); //gStyle->SetLabelSize(0.6) //gStyle->SetTextSize(0.5); + gStyle->SetOptStat(0); } // //////////////////////////////////////////////////////////// @@ -60,6 +64,10 @@ void SetHistogramStyle(TH1* h, Style_t mstyle, Color_t color, Size_t msize = 0.7 h->SetLineWidth(lwidth); h->GetYaxis()->SetTitleSize(tsize); h->GetYaxis()->SetTitleOffset(toffset); + h->GetXaxis()->SetLabelFont(63); + h->GetXaxis()->SetLabelSize(14); // labels will be 14 pixels + h->GetYaxis()->SetLabelFont(63); + h->GetYaxis()->SetLabelSize(14); } // //////////////////////////////////////////////////////////// @@ -467,9 +475,24 @@ void PlotNHistograms(const TString& pdfFile, // Move to subpad canvas->cd(i+1); - // Check Logy + TPad* pad1 = NULL; + TPad* pad2 = NULL; + + pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0); + pad2 = new TPad("pad2", "pad2", 0, 0.0, 1, 0.3); + + pad1->SetTopMargin (0.08); + pad1->SetBottomMargin(0.01); + pad1->Draw(); + + pad2->SetTopMargin (0.05); + pad2->SetBottomMargin(0.45); + pad2->Draw();// Set stat boxes + pad1->cd(); + + // Check Logy if (logy[i]) gPad->SetLogy(); - if (logx[i]) gPad->SetLogx(); + if (logx[i]) {gPad->SetLogx(); pad2->SetLogx();} // Set stat boxes @@ -501,7 +524,13 @@ void PlotNHistograms(const TString& pdfFile, gPad->SetFillColor(kBlue-10); } } - } // End loop + + pad2->cd(); + + TH1* ratioplot = PlotRatiosHistograms(rh, sh); + SetHistogramStyle(ratioplot, 21, 4); + ratioplot->Draw("ep"); + } // End loop // Draw Legend @@ -526,7 +555,8 @@ void PlotNHistograms(const TString& pdfFile, l->Draw(); // Print Canvas - canvas->Print(pdfFile); + canvas->SaveAs(pdfFile+".pdf"); + canvas->SaveAs(pdfFile+".png"); // Clean memory // delete l; @@ -661,3 +691,47 @@ void NormalizeHistogramsAsDensity(TH1* h1, TH1* h2) { h2->Scale(scale2, "width"); } } +/////////////////////////////////////////////////////////// +// +// ratio plot from the two histograms +// +///////////////////////////////////////////////////////// + +TH1* PlotRatiosHistograms(TH1* h1, TH1* h2){ + + ++ratioCounter; + + Int_t nbinsx = h1->GetNbinsX(); + + Double_t xmin = h1->GetBinLowEdge(0); + Double_t xmax = h1->GetBinLowEdge(nbinsx+1); + + TH1F* h_ratio = new TH1F(Form("h_ratio_%d", ratioCounter), "", nbinsx, xmin, xmax); + + for (Int_t ibin=1; ibin<=nbinsx; ibin++) { + + Float_t h1Value = h1->GetBinContent(ibin); + Float_t h2Value = h2->GetBinContent(ibin); + + Float_t h1Error = h1->GetBinError(ibin); + Float_t h2Error = h2->GetBinError(ibin); + + Float_t ratioVal = 999; + Float_t ratioErr = 999; + + if (h2Value > 0) { + ratioVal = h1Value / h2Value; + ratioErr = h1Error / h2Value; + } + + h_ratio->SetBinContent(ibin, ratioVal); + h_ratio->SetBinError (ibin, ratioErr); + + } + + h_ratio->SetTitle(""); + h_ratio->GetYaxis()->SetTitle(""); + h_ratio->GetYaxis()->SetRangeUser(0.4, 1.6); + + return h_ratio; +} diff --git a/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C b/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C index 11b9d44edd9e2..5c0a43482dc55 100644 --- a/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C +++ b/Validation/RecoMuon/test/macro/new_TrackValHistoPublisher.C @@ -181,7 +181,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]=1.09; maxy[3]=0.; - Plot4Histograms(newDir + "/eff_eta_phi.pdf", + Plot4Histograms(newDir + "/eff_eta_phi", rdir, sdir, rcollname, scollname, "eff_eta_phi", "Efficiency vs eta and Vs phi", @@ -222,7 +222,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]= 0.; maxy[3]= 0.; - Plot4Histograms(newDir + "/eff_pt.pdf", + Plot4Histograms(newDir + "/eff_pt", rdir, sdir, rcollname, scollname, "eff_pt", "Efficiency vs pt and sim,reco distributions", @@ -258,7 +258,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]= 0.; maxy[3]= 0.; - Plot4Histograms(newDir + "/eff_hits.pdf", + Plot4Histograms(newDir + "/eff_hits", rdir, sdir, rcollname, scollname, "eff_hits", "Efficiency vs Number of hits and hit multiplicity per track", @@ -280,7 +280,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[0]= 1.09; maxy[1]= 0.; - Plot4Histograms(newDir + "/eff_pu.pdf", + Plot4Histograms(newDir + "/eff_pu", rdir, sdir, rcollname, scollname, "eff_pu", "Efficiency vs n.PU interactions", @@ -309,7 +309,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi logy[1]=false; logy[2]=false; - Plot4Histograms(newDir + "/chi2.pdf", + Plot4Histograms(newDir + "/chi2", rdir, sdir, rcollname, scollname, "chi2", "chi2 distributions", @@ -347,7 +347,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi norm[4]= 2.; norm[5]= 2.; - Plot6Histograms(newDir + "/pulls.pdf", + Plot6Histograms(newDir + "/pulls", rdir, sdir, rcollname, scollname, "pulls", "pull distributions", @@ -386,7 +386,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi norm[4]= 2.; norm[5]= 2.; - Plot6Histograms(newDir + "/residuals.pdf", + Plot6Histograms(newDir + "/residuals", rdir, sdir, rcollname, scollname, "residuals", "residual distributions", @@ -411,7 +411,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi logy[4]=true; logy[5]=false; - Plot6Histograms(newDir + "/resol_eta.pdf", + Plot6Histograms(newDir + "/resol_eta", rdir, sdir, rcollname, scollname, "resol_eta", "resolutions vs eta", @@ -442,7 +442,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi logy[4]=true; logy[5]=false; - Plot6Histograms(newDir + "/resol_pt.pdf", + Plot6Histograms(newDir + "/resol_pt", rdir, sdir, rcollname, scollname, "resol_pt", "resolutions vs pt", @@ -478,7 +478,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]= 0.; maxy[3]= 0.; - Plot4Histograms(newDir + "/chargeMisId.pdf", + Plot4Histograms(newDir + "/chargeMisId", rdir, sdir, rcollname, scollname, "chargeMisId", "charge misId rate vs eta, pt, nhits, PU", @@ -518,7 +518,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi gSystem->Rename(mergefile, destfile); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf "+newDir); + gSystem->Exec("rm -rf "+newDir+"/*.pdf"); cout << " ... Done" << endl; } // end of "while loop" @@ -526,6 +526,9 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi /////////////////////////////////////////////////////////////////////////////// // comparison plots of Muon and Track associators on the probeTracks + TString dir_MABH_vs_TABH = newDirBase + "probeTrks_MABH_vs_TABH"; + gSystem->mkdir(dir_MABH_vs_TABH, kTRUE); + // in case of HLT or HeavyIons skip the following TString new_Sample_Name("NEW_LABEL"); @@ -560,7 +563,8 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi rcollname = "NEWprobeTrks_TkAsso"; scollname = "NEWprobeTrks"; } - const char* _refLabel("REF_LABEL, REF_RELEASE REFSELECTION quickTrackAssociatorByHits"); + + const char* _refLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION quickTrackAssociatorByHits"); const char* _newLabel("NEW_LABEL, NEW_RELEASE NEWSELECTION MuonAssociatorByHits"); // efficiency and fake rate Vs eta and phi @@ -585,7 +589,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]=1.09; maxy[3]=0.; - Plot4Histograms("eff_pt_eta.pdf", + Plot4Histograms(dir_MABH_vs_TABH + "/eff_pt_eta", sdir, sdir, rcollname, scollname, "eff_pt_eta_MABHvsTABH", "Efficiency vs eta and pt - Muon vs Track Associator", @@ -610,7 +614,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[2]=1.09; maxy[3]=0.; - Plot4Histograms("eff_phi_hits.pdf", + Plot4Histograms(dir_MABH_vs_TABH + "/eff_phi_hits", sdir, sdir, rcollname, scollname, "eff_phi_hits_MABHvsTABH", "Efficiency vs phi and N. hits - Muon vs Track Associator", @@ -632,7 +636,7 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi maxy[0]= 1.09; maxy[1]= 0.; - PlotNHistograms("eff_pu.pdf", + PlotNHistograms(dir_MABH_vs_TABH + "/eff_pu", sdir, sdir, rcollname, scollname, "eff_pu_MABHvsTABH", "Efficiency vs N.PU interactions - Muon vs Track Associator", @@ -643,16 +647,16 @@ void new_TrackValHistoPublisher(const char* newFile="NEW_FILE",const char* refFi //// Merge pdf files together and rename the merged pdf after the TString _destfile = newDirBase + "probeTrks_MABH_vs_TABH" + ".pdf"; // Destination file name TString _gscommand = "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=" + _destfile + " " - + "./eff_pt_eta.pdf " - + "./eff_phi_hits.pdf " - + "./eff_pu.pdf "; + + dir_MABH_vs_TABH + "/eff_pt_eta.pdf " + + dir_MABH_vs_TABH + "/eff_phi_hits.pdf " + + dir_MABH_vs_TABH + "/eff_pu.pdf "; cout << ">> Merging partial pdfs to " << _destfile << "..." << endl; if (DEBUG) cout << " ...with command \"" << _gscommand << "\"" << endl; gSystem->Exec(_gscommand); cout << ">> Deleting partial pdf files" << endl; - gSystem->Exec("rm -rf eff_*.pdf"); + gSystem->Exec("rm -rf "+ dir_MABH_vs_TABH +"/eff_*.pdf"); cout << " ... Done" << endl; cout << ">> Removing the relval files from ROOT before closing..." << endl; diff --git a/Validation/RecoMuon/test/new_muonReleaseSummary.py b/Validation/RecoMuon/test/new_muonReleaseSummary.py index d18d22d6687b0..37d184bc3f6e6 100644 --- a/Validation/RecoMuon/test/new_muonReleaseSummary.py +++ b/Validation/RecoMuon/test/new_muonReleaseSummary.py @@ -338,6 +338,9 @@ def getReplaceMap(newparams, refparams, sample, datatype, cfgkey, cfgfile): else: print('ERROR: Could not find "' + newpath + '/RecoMuonV.pdf') + os.system('mkdir '+newpath+'/PDF') + os.system('mv '+newpath+'/*.pdf '+newpath+'/PDF/.') + if(new_userparams.Publish): newpath = GetSamplePath(new_userparams.NewParams,sample) newlocalsample = GetLocalSampleName(new_userparams.NewParams, sample) diff --git a/Validation/RecoTrack/plugins/MultiTrackValidator.cc b/Validation/RecoTrack/plugins/MultiTrackValidator.cc index d8ad71444a5b7..b4e2a31714e3e 100644 --- a/Validation/RecoTrack/plugins/MultiTrackValidator.cc +++ b/Validation/RecoTrack/plugins/MultiTrackValidator.cc @@ -220,6 +220,7 @@ void MultiTrackValidator::bookHistograms(DQMStore::ConcurrentBooker& ibook, edm: for(size_t i=0; i(i)), axis); } + h.disableAlphanumeric(); } void fillMVAHistos(const std::vector& h_mva, @@ -470,6 +472,7 @@ void MTVHistoProducerAlgoForTracker::bookRecoHistos(DQMStore::ConcurrentBooker& histograms.h_algo.push_back( ibook.book1D("h_algo","Tracks by algo",reco::TrackBase::algoSize, 0., double(reco::TrackBase::algoSize) ) ); for (size_t ibin=0; ibin