Skip to content

Commit

Permalink
Merge pull request cms-sw#118 from mbluj/CMSSW_10_5_X_recoOnMiniAOD
Browse files Browse the repository at this point in the history
Sync with 105X
  • Loading branch information
mbluj committed Feb 11, 2019
2 parents 26c6f8f + 98e35ce commit a52e3b6
Show file tree
Hide file tree
Showing 546 changed files with 10,702 additions and 10,878 deletions.
54 changes: 22 additions & 32 deletions Alignment/CommonAlignmentMonitor/plugins/AlignmentStats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "DataFormats/Common/interface/View.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"
#include "Alignment/TrackerAlignment/interface/AlignableTracker.h"
#include "Alignment/CommonAlignment/interface/Alignable.h"
Expand Down Expand Up @@ -32,8 +31,7 @@ AlignmentStats::AlignmentStats(const edm::ParameterSet &iConfig) :
keepHitPopulation_(iConfig.getParameter<bool>("keepHitStats")),
statsTreeName_(iConfig.getParameter<string>("TrkStatsFileName")),
hitsTreeName_(iConfig.getParameter<string>("HitStatsFileName")),
prescale_(iConfig.getParameter<uint32_t>("TrkStatsPrescale")),
lastSetup_(nullptr)
prescale_(iConfig.getParameter<uint32_t>("TrkStatsPrescale"))
{

//sanity checks
Expand Down Expand Up @@ -75,7 +73,6 @@ void AlignmentStats::beginJob(){// const edm::EventSetup &iSetup
*/

tmpPresc_=prescale_;
firstEvent_=true;

//load the tracker geometry from the EventSetup
// iSetup.get<TrackerDigiGeometryRecord>().get(trackerGeometry_);
Expand All @@ -85,17 +82,15 @@ void AlignmentStats::beginJob(){// const edm::EventSetup &iSetup

void AlignmentStats::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup){

lastSetup_ = &iSetup;

//load list of detunits needed then in endJob

if(firstEvent_){
edm::ESHandle<TrackerGeometry> tmpTkGeometry;
iSetup.get<TrackerDigiGeometryRecord>().get(tmpTkGeometry);
trackerGeometry_=&(*tmpTkGeometry);
firstEvent_=false;
}
edm::ESHandle<TrackerGeometry> tmpTkGeometry;
iSetup.get<TrackerDigiGeometryRecord>().get(tmpTkGeometry);
trackerGeometry_=&(*tmpTkGeometry);

edm::ESHandle<TrackerTopology> tTopoHandle;
iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
trackerTopology_ = tTopoHandle.product();

//take trajectories and tracks to loop on
// edm::Handle<TrajTrackAssociationCollection> TrackAssoMap;
Expand Down Expand Up @@ -307,12 +302,7 @@ void AlignmentStats::endJob(){
hitstree->Branch("posPhi", &posPhi, "posPhi/F");
*/

//Retrieve tracker topology from geometry
edm::ESHandle<TrackerTopology> tTopoHandle;
lastSetup_->get<TrackerTopologyRcd>().get(tTopoHandle);
const TrackerTopology* const tTopo = tTopoHandle.product();

AlignableTracker* theAliTracker=new AlignableTracker(&(*trackerGeometry_), tTopo);
std::unique_ptr<AlignableTracker> theAliTracker=std::make_unique<AlignableTracker>(&(*trackerGeometry_), trackerTopology_);
const auto& Detunitslist = theAliTracker->deepComponents();
int ndetunits=Detunitslist.size();
edm::LogInfo("AlignmentStats")<<"Number of DetUnits in the AlignableTracker: "<< ndetunits<<std::endl;
Expand Down Expand Up @@ -372,39 +362,39 @@ void AlignmentStats::endJob(){
//get layers, petals, etc...
if(subdet==PixelSubdetector::PixelBarrel){//PXB

layer=tTopo->pxbLayer(id);
layer=trackerTopology_->pxbLayer(id);
is2D=true;
isStereo=false;
}
else if(subdet==PixelSubdetector::PixelEndcap){

layer=tTopo->pxfDisk(id);
layer=trackerTopology_->pxfDisk(id);
is2D=true;
isStereo=false;
}
else if(subdet==SiStripDetId::TIB){

layer=tTopo->tibLayer(id);
is2D=tTopo->tibIsDoubleSide(id);
isStereo=tTopo->tibIsStereo(id);
layer=trackerTopology_->tibLayer(id);
is2D=trackerTopology_->tibIsDoubleSide(id);
isStereo=trackerTopology_->tibIsStereo(id);
}
else if(subdet==SiStripDetId::TID){

layer=tTopo->tidWheel(id);
is2D=tTopo->tidIsDoubleSide(id);
isStereo=tTopo->tidIsStereo(id);
layer=trackerTopology_->tidWheel(id);
is2D=trackerTopology_->tidIsDoubleSide(id);
isStereo=trackerTopology_->tidIsStereo(id);
}
else if(subdet==SiStripDetId::TOB){

layer=tTopo->tobLayer(id);
is2D=tTopo->tobIsDoubleSide(id);
isStereo=tTopo->tobIsStereo(id);
layer=trackerTopology_->tobLayer(id);
is2D=trackerTopology_->tobIsDoubleSide(id);
isStereo=trackerTopology_->tobIsStereo(id);
}
else if(subdet==SiStripDetId::TEC){

layer=tTopo->tecWheel(id);
is2D=tTopo->tecIsDoubleSide(id);
isStereo=tTopo->tecIsStereo(id);
layer=trackerTopology_->tecWheel(id);
is2D=trackerTopology_->tecIsDoubleSide(id);
isStereo=trackerTopology_->tecIsStereo(id);
}
else{
edm::LogError("AlignmentStats")<<"Detector not belonging neither to pixels nor to strips! Skipping it. SubDet= "<<subdet;
Expand Down
5 changes: 2 additions & 3 deletions Alignment/CommonAlignmentMonitor/plugins/AlignmentStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"

// #include <Riostream.h>
#include <fstream>
Expand Down Expand Up @@ -46,7 +47,6 @@ class AlignmentStats: public edm::EDAnalyzer{
uint32_t prescale_;
//////
uint32_t tmpPresc_;
bool firstEvent_;

//Track stats
TFile *treefile_;
Expand All @@ -64,8 +64,7 @@ class AlignmentStats: public edm::EDAnalyzer{

// edm::ESHandle<TrackerGeometry> trackerGeometry_;
const TrackerGeometry* trackerGeometry_;

const edm::EventSetup *lastSetup_;
const TrackerTopology* trackerTopology_;

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/Exception.h"

Expand All @@ -33,6 +34,8 @@ class SiPixelGainCalibrationServiceBase {

SiPixelGainCalibrationServiceBase(){};
virtual ~SiPixelGainCalibrationServiceBase(){};

static void fillPSetDescription(edm::ParameterSetDescription& desc) {}

// default inplementation from PixelThresholdClusterizer
virtual void calibrate(uint32_t detID, DigiIterator b, DigiIterator e, float conversionFactor, float offset, int * electron);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ void SiStripGainCosmicCalculator::algoBeginJob(const edm::EventSetup& iSetup)
iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
tTopo = tTopoHandle.product();

eventSetupCopy_ = &iSetup;
edm::ESHandle<SiStripDetCabling> siStripDetCablingH;
iSetup.get<SiStripDetCablingRcd>().get(siStripDetCablingH);
siStripDetCabling = siStripDetCablingH.product();

edm::ESHandle<TrackerGeometry> tkGeomH;
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeomH );
tkGeom = tkGeomH.product();

std::cout<<"SiStripGainCosmicCalculator::algoBeginJob called"<<std::endl;
total_nr_of_events = 0;
HlistAPVPairs = new TObjArray(); HlistOtherHistos = new TObjArray();
Expand Down Expand Up @@ -181,10 +188,10 @@ void SiStripGainCosmicCalculator::algoAnalyze(const edm::Event & iEvent, const e
const SiStripRecHit2D::ClusterRef & cluster=sistripsimplehit->cluster();
const auto & ampls = cluster->amplitudes();
uint32_t thedetid = 0; // is zero since long time cluster->geographicalId();
double module_width = moduleWidth(thedetid, &iSetup);
double module_width = moduleWidth(thedetid);
((TH1F*) HlistOtherHistos->FindObject("LocalPosition_cm"))->Fill(local_position.x());
((TH1F*) HlistOtherHistos->FindObject("LocalPosition_normalized"))->Fill(local_position.x()/module_width);
double module_thickness = moduleThickness(thedetid, &iSetup);
double module_thickness = moduleThickness(thedetid);
int ifirststrip= cluster->firstStrip();
int theapvpairid = int(float(ifirststrip)/256.);
TH1F* histopointer = (TH1F*) HlistAPVPairs->FindObject(Form("ChargeAPVPair_%i_%i",thedetid,theapvpairid));
Expand Down Expand Up @@ -248,9 +255,8 @@ std::pair<double,double> SiStripGainCosmicCalculator::getPeakOfLandau( TH1F * in
}

//---------------------------------------------------------------------------------------------------------
double SiStripGainCosmicCalculator::moduleWidth(const uint32_t detid, const edm::EventSetup* iSetup) // get width of the module detid
double SiStripGainCosmicCalculator::moduleWidth(const uint32_t detid) // get width of the module detid
{ //dk: copied from A. Giammanco and hacked, module_width values : 10.49 12.03 6.144 7.14 9.3696
edm::ESHandle<TrackerGeometry> tkGeom; iSetup->get<TrackerDigiGeometryRecord>().get( tkGeom );
double module_width=0.;
const GeomDetUnit* it = tkGeom->idToDetUnit(DetId(detid));
if (dynamic_cast<const StripGeomDetUnit*>(it)==nullptr && dynamic_cast<const PixelGeomDetUnit*>(it)==nullptr) {
Expand All @@ -262,9 +268,8 @@ double SiStripGainCosmicCalculator::moduleWidth(const uint32_t detid, const edm:
}

//---------------------------------------------------------------------------------------------------------
double SiStripGainCosmicCalculator::moduleThickness(const uint32_t detid, const edm::EventSetup* iSetup) // get thickness of the module detid
double SiStripGainCosmicCalculator::moduleThickness(const uint32_t detid) // get thickness of the module detid
{ //dk: copied from A. Giammanco and hacked
edm::ESHandle<TrackerGeometry> tkGeom; iSetup->get<TrackerDigiGeometryRecord>().get( tkGeom );
double module_thickness=0.;
const GeomDetUnit* it = tkGeom->idToDetUnit(DetId(detid));
if (dynamic_cast<const StripGeomDetUnit*>(it)==nullptr && dynamic_cast<const PixelGeomDetUnit*>(it)==nullptr) {
Expand Down Expand Up @@ -379,7 +384,6 @@ TH1F *CorrectionOfEachAPVPairControlView = new TH1F("CorrectionOfEachAPVPairCont
((TH1F*) HlistOtherHistos->FindObject("APVPairCorrectionsTOB2"))->Fill(local_correction);
}
// control view
edm::ESHandle<SiStripDetCabling> siStripDetCabling; eventSetupCopy_->get<SiStripDetCablingRcd>().get(siStripDetCabling);
const FedChannelConnection& fedchannelconnection = siStripDetCabling->getConnection( extracted_detid, extracted_apvpairid );
std::ostringstream local_key;
// in S. Mersi's analysis the APVPair id seems to be used instead of the lldChannel, hence use the same here
Expand All @@ -392,11 +396,11 @@ TH1F *CorrectionOfEachAPVPairControlView = new TH1F("CorrectionOfEachAPVPairCont
int ibin2 = CorrectionOfEachAPVPairControlView->GetXaxis()->FindBin(control_key);
CorrectionOfEachAPVPairControlView->SetBinError(ibin2, local_error_correction);
// thickness of each module
double module_thickness = moduleThickness(extracted_detid, eventSetupCopy_);
double module_thickness = moduleThickness(extracted_detid);
if( fabs(module_thickness - 0.032)<0.001 ) ModuleThickness->Fill(1);
if( fabs(module_thickness - 0.05)<0.001 ) ModuleThickness->Fill(2);
// width of each module
double module_width = moduleWidth(extracted_detid, eventSetupCopy_);
double module_width = moduleWidth(extracted_detid);
if(fabs(module_width-6.144)<0.01) ModuleWidth->Fill(1);
if(fabs(module_width-7.14)<0.01) ModuleWidth->Fill(2);
if(fabs(module_width-9.3696)<0.01) ModuleWidth->Fill(3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <memory>

class TrackerTopology;
class SiStripDetCabling;
class TrackerGeometry;

class SiStripGainCosmicCalculator : public ConditionDBWriter<SiStripApvGain> {
public:
Expand All @@ -34,8 +36,8 @@ class SiStripGainCosmicCalculator : public ConditionDBWriter<SiStripApvGain> {
std::unique_ptr<SiStripApvGain> getNewObject() override;
private:
std::pair<double,double> getPeakOfLandau( TH1F * inputHisto );
double moduleWidth(const uint32_t detid, const edm::EventSetup* iSetup);
double moduleThickness(const uint32_t detid, const edm::EventSetup* iSetup);
double moduleWidth(const uint32_t detid);
double moduleThickness(const uint32_t detid);
private:
std::string TrackProducer;
std::string TrackLabel;
Expand All @@ -47,7 +49,8 @@ class SiStripGainCosmicCalculator : public ConditionDBWriter<SiStripApvGain> {
std::map<uint32_t, double> thickness_map; // map of detector id to respective thickness
std::vector<uint32_t> SelectedDetIds;
std::vector<uint32_t> detModulesToBeExcluded;
const edm::EventSetup * eventSetupCopy_;
SiStripDetCabling const* siStripDetCabling = nullptr;
TrackerGeometry const* tkGeom = nullptr;
unsigned int MinNrEntries;
double MaxChi2OverNDF;
bool outputHistogramsInRootFile;
Expand Down
1 change: 1 addition & 0 deletions CondCore/CTPPSPlugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<use name="CondCore/ESSources"/>
<use name="CondFormats/CTPPSReadoutObjects"/>
<use name="CondFormats/DataRecord"/>
<use name="CondFormats/AlignmentRecord"/>
<use name="CondFormats/Serialization"/>
<use name="root"/>
<use name="boost"/>
Expand Down
13 changes: 12 additions & 1 deletion CondCore/CTPPSPlugins/src/plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@
#include "CondFormats/DataRecord/interface/CTPPSPixelAnalysisMaskRcd.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelGainCalibrations.h"
#include "CondFormats/DataRecord/interface/CTPPSPixelGainCalibrationsRcd.h"

#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSRPAlignmentCorrectionsData.h"
#include "CondFormats/AlignmentRecord/interface/CTPPSRPAlignmentCorrectionsDataRcd.h"
#include "CondFormats/AlignmentRecord/interface/RPRealAlignmentRecord.h"
#include "CondFormats/AlignmentRecord/interface/RPMisalignedAlignmentRecord.h"
#include "CondFormats/CTPPSReadoutObjects/interface/PPSTimingCalibration.h"
#include "CondFormats/DataRecord/interface/PPSTimingCalibrationRcd.h"

REGISTER_PLUGIN(CTPPSPixelDAQMappingRcd,CTPPSPixelDAQMapping);
REGISTER_PLUGIN(CTPPSPixelAnalysisMaskRcd,CTPPSPixelAnalysisMask);
REGISTER_PLUGIN(CTPPSPixelGainCalibrationsRcd,CTPPSPixelGainCalibrations);
REGISTER_PLUGIN(CTPPSRPAlignmentCorrectionsDataRcd,CTPPSRPAlignmentCorrectionsData);
REGISTER_PLUGIN(RPRealAlignmentRecord,CTPPSRPAlignmentCorrectionsData);
REGISTER_PLUGIN(RPMisalignedAlignmentRecord,CTPPSRPAlignmentCorrectionsData);
REGISTER_PLUGIN(PPSTimingCalibrationRcd,PPSTimingCalibration);

11 changes: 0 additions & 11 deletions CondCore/DBOutputService/test/stubs/writeInt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
typedef std::vector<int> Payload;


namespace {

inline std::string toa(int i) {
std::ostringstream ss;
ss << i;
return ss.str();

}

}

class writeInt : public edm::EDAnalyzer {
public:
explicit writeInt(const edm::ParameterSet& iConfig );
Expand Down
8 changes: 4 additions & 4 deletions CondCore/ESSources/plugins/CondDBESSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ CondDBESSource::CondDBESSource( const edm::ParameterSet& iConfig ) :
* this will allow to initialize POOL in one go for each "database"
* The real initialization of the Data-Proxies is done in the second loop
*/
std::vector<cond::DataProxyWrapperBase *> proxyWrappers(m_tagCollection.size());
std::vector<std::unique_ptr<cond::DataProxyWrapperBase>> proxyWrappers(m_tagCollection.size());
size_t ipb=0;
for(it=itBeg;it!=itEnd;++it){
proxyWrappers[ipb++] =
cond::ProxyFactory::get()->create(buildName(it->second.recordName()));
proxyWrappers[ipb++] = std::unique_ptr<cond::DataProxyWrapperBase>{
cond::ProxyFactory::get()->create(buildName(it->second.recordName()))};
}

// now all required libraries have been loaded
Expand Down Expand Up @@ -243,7 +243,7 @@ CondDBESSource::CondDBESSource( const edm::ParameterSet& iConfig ) :
} else nsess = (*p).second;

// ownership...
ProxyP proxy(proxyWrappers[ipb++]);
ProxyP proxy(std::move(proxyWrappers[ipb++]));
// instert in the map
m_proxies.insert(std::make_pair(it->second.recordName(), proxy));
// initialize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ namespace {
void grid(TH2F* matrix) {
matrix->Draw("COLZ1");
TLine* lh = new TLine(1., 0., 1., 1.);
lh->SetLineWidth(0.2);
lh->SetLineWidth(2);
TLine* lv = new TLine(1., 0., 1., 1.);
lv->SetLineWidth(0.2);
lv->SetLineWidth(2);
// double max = (double)TEMPLATESAMPLES;
for(int i = 1; i < TEMPLATESAMPLES; i++) {
// double x = (double)i;
Expand Down
5 changes: 0 additions & 5 deletions CondCore/GEMPlugins/src/BuildFile.xml

This file was deleted.

3 changes: 3 additions & 0 deletions CondCore/GEMPlugins/src/plugins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
#include "CondCore/PluginSystem/interface/registration_macros.h"
#include "CondFormats/GEMObjects/interface/GEMELMap.h"
#include "CondFormats/DataRecord/interface/GEMELMapRcd.h"
#include "CondFormats/GEMObjects/interface/GEMeMap.h"
#include "CondFormats/DataRecord/interface/GEMeMapRcd.h"
#include "CondFormats/GEMObjects/interface/GEMMaskedStrips.h"
#include "CondFormats/DataRecord/interface/GEMMaskedStripsRcd.h"
#include "CondFormats/GEMObjects/interface/GEMDeadStrips.h"
#include "CondFormats/DataRecord/interface/GEMDeadStripsRcd.h"
REGISTER_PLUGIN(GEMELMapRcd,GEMELMap);
REGISTER_PLUGIN(GEMeMapRcd,GEMeMap);
REGISTER_PLUGIN(GEMMaskedStripsRcd, GEMMaskedStrips);
REGISTER_PLUGIN(GEMDeadStripsRcd, GEMDeadStrips);

1 change: 1 addition & 0 deletions CondCore/Utilities/src/CondDBFetch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ namespace cond {
FETCH_PAYLOAD_CASE( CTPPSPixelDAQMapping )
FETCH_PAYLOAD_CASE( CTPPSPixelAnalysisMask )
FETCH_PAYLOAD_CASE( CTPPSPixelGainCalibrations )
FETCH_PAYLOAD_CASE( CTPPSRPAlignmentCorrectionsData )
FETCH_PAYLOAD_CASE( CastorChannelQuality )
FETCH_PAYLOAD_CASE( CastorElectronicsMap )
FETCH_PAYLOAD_CASE( CastorGainWidths )
Expand Down
2 changes: 2 additions & 0 deletions CondCore/Utilities/src/CondDBImport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ namespace cond {
IMPORT_PAYLOAD_CASE( CTPPSPixelDAQMapping )
IMPORT_PAYLOAD_CASE( CTPPSPixelAnalysisMask )
IMPORT_PAYLOAD_CASE( CTPPSPixelGainCalibrations )
IMPORT_PAYLOAD_CASE( CTPPSRPAlignmentCorrectionsData )
IMPORT_PAYLOAD_CASE( CastorChannelQuality )
IMPORT_PAYLOAD_CASE( CastorElectronicsMap )
IMPORT_PAYLOAD_CASE( CastorGainWidths )
Expand Down Expand Up @@ -266,6 +267,7 @@ namespace cond {
IMPORT_PAYLOAD_CASE( PhysicsTGraphPayload )
IMPORT_PAYLOAD_CASE( PhysicsTFormulaPayload )
IMPORT_PAYLOAD_CASE( PhysicsTools::Calibration::HistogramD3D )
IMPORT_PAYLOAD_CASE( PPSTimingCalibration )
IMPORT_PAYLOAD_CASE( QGLikelihoodCategory )
IMPORT_PAYLOAD_CASE( QGLikelihoodObject )
IMPORT_PAYLOAD_CASE( QGLikelihoodSystematicsObject )
Expand Down
2 changes: 2 additions & 0 deletions CondCore/Utilities/src/CondFormats.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelDAQMapping.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelAnalysisMask.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSPixelGainCalibrations.h"
#include "CondFormats/CTPPSReadoutObjects/interface/CTPPSRPAlignmentCorrectionsData.h"
#include "CondFormats/CTPPSReadoutObjects/interface/PPSTimingCalibration.h"
#include "CondFormats/DTObjects/interface/DTCCBConfig.h"
#include "CondFormats/DTObjects/interface/DTDeadFlag.h"
#include "CondFormats/DTObjects/interface/DTHVStatus.h"
Expand Down
Loading

0 comments on commit a52e3b6

Please sign in to comment.