Skip to content

Commit

Permalink
Merge branch 'master' into SiStripMonitorClient-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
knoepfel committed Sep 26, 2018
2 parents edb81a9 + ebc2aba commit af644fd
Show file tree
Hide file tree
Showing 392 changed files with 9,932 additions and 4,884 deletions.
1 change: 1 addition & 0 deletions Alignment/APEEstimation/python/conditions/init.py
@@ -0,0 +1 @@
#Automatically created by SCRAM
218 changes: 146 additions & 72 deletions Alignment/APEEstimation/test/autoSubmitter/autoSubmitter.py

Large diffs are not rendered by default.

Expand Up @@ -27,3 +27,20 @@
mergeTemplate="hadd {path}/allData.root {inputFiles}"

localSettingTemplate="cmsRun $CMSSW_BASE/src/Alignment/APEEstimation/test/cfgTemplate/apeLocalSetting_cfg.py {inputCommands}"

conditionsFileHeader="""
import FWCore.ParameterSet.Config as cms
def applyConditions(process):
"""

conditionsTemplate="""
import CalibTracker.Configuration.Common.PoolDBESSource_cfi
process.my{record}Conditions = CalibTracker.Configuration.Common.PoolDBESSource_cfi.poolDBESSource.clone(
connect = cms.string('{connect}'),
toGet = cms.VPSet(cms.PSet(record = cms.string('{record}'),
tag = cms.string('{tag}')
)
)
)
process.prefer_my{record}Conditions = cms.ESPrefer("PoolDBESSource", "my{record}Conditions")
"""
8 changes: 6 additions & 2 deletions Alignment/APEEstimation/test/autoSubmitter/config.ini
Expand Up @@ -3,7 +3,7 @@
# directory where to look, probably starting with /eos/cms/store/caf/user/<username>
baseDirectory=/some/directory
# define input files, separate files with " ", use ranges for multiple files. [1-6,8,10] will be replaced by files with 1,2,3,4,5,6,8, and 10 in its place
fileNames=filename.root otherFile_[1-6,8,10].root
fileNames=filename.root otherFile_[1-6,8,10]_[1-2].root
# optional, events per file, not total maxEvents
maxEvents=-1
# optional, set to True for MC samples, False by default
Expand All @@ -22,6 +22,10 @@ alignmentName=alignmentObjectName
baselineDir=Design
# is this a baseline measurement? False by default
isDesign=False
# You can add your conditions here. If a TrackerAlignmentRcd is defined,
# it will override the one defined by alignmentName
condition TrackerAlignmentRcd=sqlite_file:/afs/asdf.db Alignments
condition TrackerSurfaceDeformationRcd=sqlite_file:/afs/asdf.db Deformations

# define measurements like this
[measurements]
Expand All @@ -30,4 +34,4 @@ isDesign=False
# where all relevant files are stored
# firstIteration and maxIterations are optional, 0 and 15 by default.
# maxIterations is forced to 0 if alignmentObject has isDesign=True
exampleName: exampleDataset alignmentObjectName firstIteration=0 maxIterations=15
exampleName: exampleDataset alignmentObject firstIteration=0 maxIterations=15
50 changes: 30 additions & 20 deletions Alignment/APEEstimation/test/batch/startSkim.py
Expand Up @@ -8,6 +8,33 @@
import argparse
import multiprocessing as mp

def replaceAllRanges(string):
if "[" in string and "]" in string:
strings = []
posS = string.find("[")
posE = string.find("]")
nums = string[posS+1:posE].split(",")
expression = string[posS:posE+1]

nums = string[string.find("[")+1:string.find("]")]
for interval in nums.split(","):
interval = interval.strip()
if "-" in interval:
lowNum = int(interval.split("-")[0])
upNum = int(interval.split("-")[1])
for i in range(lowNum, upNum+1):
newstring = string[0:posS]+str(i)+string[posE+1:]
newstring = replaceAllRanges(newstring)
strings += newstring
else:
newstring = string[0:posS]+interval+string[posE+1:]
newstring = replaceAllRanges(newstring)
strings += newstring
return strings
else:
return [string,]


def doSkim(sample):
base = os.environ['CMSSW_BASE']

Expand Down Expand Up @@ -103,28 +130,11 @@ def main(argv):

finalSamples = []
for sample in args.samples:
if "[" in sample and "]" in sample:
posS = sample.find("[")
posE = sample.find("]")
nums = sample[posS+1:posE].split(",")
expression = sample[posS:posE+1]

nums = sample[sample.find("[")+1:sample.find("]")]
for interval in nums.split(","):
interval = interval.strip()
if "-" in interval:
lowNum = int(interval.split("-")[0])
upNum = int(interval.split("-")[1])
for i in range(lowNum, upNum+1):
finalSamples.append("%s"%(sample.replace(expression,str(i))))
else:
finalSamples.append("%s"%(sample.replace(expression,interval)))
else:
finalSamples.append(sample)
parsedSamples = replaceAllRanges(sample)
finalSamples += parsedSamples

args.samples = finalSamples
print(args.samples)


if len(args.samples) == 1 or args.consecutive:
for sample in args.samples:
doSkim(sample)
Expand Down
33 changes: 30 additions & 3 deletions Alignment/APEEstimation/test/cfgTemplate/apeEstimator_cfg.py
Expand Up @@ -19,6 +19,7 @@
options.register('iterNumber', 0, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "Iteration number")
options.register('lastIter', False, VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.bool, "Last iteration")
options.register('alignRcd','', VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "AlignmentRcd")
options.register('conditions',"None", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "File with conditions")

# get and parse the command line arguments
options.parseArguments()
Expand Down Expand Up @@ -157,13 +158,17 @@
elif isData:
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '')



if options.conditions != "None":
import importlib
mod = importlib.import_module("Alignment.APEEstimation.conditions.{}".format(options.conditions))
mod.applyConditions(process)

## Alignment and APE
##
## Choose Alignment (w/o touching APE)
if options.alignRcd=='design':
if options.alignRcd=='fromConditions':
pass # Alignment is read from the conditions file in this case
elif options.alignRcd=='design':
CondDBAlignment = CondDB.clone(connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'))
process.myTrackerAlignment = cms.ESSource("PoolDBESSource",
CondDBAlignment,
Expand Down Expand Up @@ -205,6 +210,26 @@
)
)
process.es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource","myTrackerAlignment")

elif options.alignRcd == 'mp2853':
CondDBAlignment = CondDB.clone()
process.myTrackerAlignment = cms.ESSource("PoolDBESSource",
CondDBAlignment,
timetype = cms.string("runnumber"),
toGet = cms.VPSet(
cms.PSet(
connect = cms.string('sqlite_file:/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/MP/MPproduction/mp2853/jobData/jobm3/alignments_MP.db'),
record = cms.string('TrackerAlignmentRcd'),
tag = cms.string('Alignments'),
),
#~ cms.PSet(
#~ connect=cms.string('frontier://FrontierProd/CMS_CONDITIONS'),
#~ record=cms.string('SiPixelTemplateDBObjectRcd'),
#~ tag=cms.string('SiPixelTemplateDBObject_38T_TempForAlignmentReReco2018_v3'),
#~ )
)
)
process.es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource","myTrackerAlignment")

elif options.alignRcd == 'hp1370':
CondDBAlignment = CondDB.clone(connect = cms.string('sqlite_file:/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN2/HIP/xiaomeng/CMSSW_7_4_6_patch5/src/Alignment/HIPAlignmentAlgorithm/hp1370/alignments.db'))
Expand Down Expand Up @@ -311,3 +336,5 @@
process.ApeEstimatorSequence
)



2 changes: 1 addition & 1 deletion Alignment/CommonAlignment/src/AlignableModifier.cc
Expand Up @@ -379,7 +379,7 @@ ::addDeformation(Alignable *alignable,
}

// auto_ptr has exception safe delete (in contrast to bare pointer)
const std::auto_ptr<SurfaceDeformation> surfDef
const std::unique_ptr<SurfaceDeformation> surfDef
(SurfaceDeformationFactory::create(deformType, rndDeformation));

alignable->addSurfaceDeformation(surfDef.get(), true); // true to propagate down
Expand Down
4 changes: 2 additions & 2 deletions Alignment/CommonAlignment/src/AlignmentParametersData.cc
Expand Up @@ -23,7 +23,7 @@ AlignmentParametersData::AlignmentParametersData( AlgebraicVector* param,
{
theNumSelected = std::count_if( theSelector->begin(),
theSelector->end(),
std::bind2nd( std::equal_to<bool>(), true ) );
[](auto const &c){return c == true;});
}


Expand All @@ -36,7 +36,7 @@ AlignmentParametersData::AlignmentParametersData( const AlgebraicVector& param,
{
theNumSelected = std::count_if( theSelector->begin(),
theSelector->end(),
std::bind2nd( std::equal_to<bool>(), true ) );
[](auto const &c){return c == true;});
}


Expand Down
Expand Up @@ -336,9 +336,9 @@ void SiPixelLorentzAngleCalibration::endOfJob()
}

const unsigned int nonZeroParamsOrErrors = // Any determined value?
count_if (parameters_.begin(), parameters_.end(), std::bind2nd(std::not_equal_to<double>(),0.))
count_if (parameters_.begin(), parameters_.end(), [] (auto c) { return c != 0.;})
+ count_if(paramUncertainties_.begin(), paramUncertainties_.end(),
std::bind2nd(std::not_equal_to<double>(), 0.));
[](auto c) { return c != 0.;});

for (unsigned int iIOV = 0; iIOV < moduleGroupSelector_->numIovs(); ++iIOV) {
auto firstRunOfIOV = static_cast<cond::Time_t>(moduleGroupSelector_->firstRunOfIOV(iIOV));
Expand Down
Expand Up @@ -347,9 +347,9 @@ void SiStripBackplaneCalibration::endOfJob()
}

const unsigned int nonZeroParamsOrErrors = // Any determined value?
count_if (parameters_.begin(), parameters_.end(), std::bind2nd(std::not_equal_to<double>(),0.))
count_if (parameters_.begin(), parameters_.end(),[](auto c){return c != 0.;})
+ count_if(paramUncertainties_.begin(), paramUncertainties_.end(),
std::bind2nd(std::not_equal_to<double>(), 0.));
[](auto c){return c!= 0.;});

for (unsigned int iIOV = 0; iIOV < moduleGroupSelector_->numIovs(); ++iIOV) {
cond::Time_t firstRunOfIOV = moduleGroupSelector_->firstRunOfIOV(iIOV);
Expand Down
Expand Up @@ -366,9 +366,9 @@ void SiStripLorentzAngleCalibration::endOfJob()
}

const unsigned int nonZeroParamsOrErrors = // Any determined value?
count_if (parameters_.begin(), parameters_.end(), std::bind2nd(std::not_equal_to<double>(),0.))
count_if (parameters_.begin(), parameters_.end(), [](auto c){return c!=0.;})
+ count_if(paramUncertainties_.begin(), paramUncertainties_.end(),
std::bind2nd(std::not_equal_to<double>(), 0.));
[](auto c){return c!=0.;});

for (unsigned int iIOV = 0; iIOV < moduleGroupSelector_->numIovs(); ++iIOV) {
auto firstRunOfIOV = static_cast<cond::Time_t>(moduleGroupSelector_->firstRunOfIOV(iIOV));
Expand Down
Expand Up @@ -45,3 +45,15 @@
ALCARECOTkAlMinBias.TwoBodyDecaySelector.applyAcoplanarityFilter = False

seqALCARECOTkAlMinBias = cms.Sequence(ALCARECOTkAlMinBiasHLT*~ALCARECOTkAlMinBiasNOTHLT+ALCARECOTkAlMinBiasDCSFilter+ALCARECOTkAlMinBias)

## customizations for the pp_on_AA eras
from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017
from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
(pp_on_XeXe_2017 | pp_on_AA_2018).toModify(ALCARECOTkAlMinBiasHLT,
eventSetupPathsKey='TkAlMinBiasHI'
)

(pp_on_XeXe_2017 | pp_on_AA_2018).toModify(ALCARECOTkAlMinBias,
trackQualities = cms.vstring("highPurity")
)

2 changes: 1 addition & 1 deletion Alignment/OfflineValidation/plugins/EopTreeWriter.cc
Expand Up @@ -142,7 +142,7 @@ EopTreeWriter::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
// geo->getSubdetectorGeometry(DetId::Calo, CaloTowerDetId::SubdetId);

// temporary collection of EB+EE recHits
std::auto_ptr<EcalRecHitCollection> tmpEcalRecHitCollection(new EcalRecHitCollection);
std::unique_ptr<EcalRecHitCollection> tmpEcalRecHitCollection(new EcalRecHitCollection);
std::vector<edm::InputTag> ecalLabels_;

edm::Handle<EcalRecHitCollection> tmpEc;
Expand Down
Expand Up @@ -191,7 +191,7 @@ class TrackerOfflineValidation : public edm::EDAnalyzer {
template <typename T> TH1* make(const char* name,const char* title,int nBinX,double minBinX,double maxBinX,int nBinY,double minBinY,double maxBinY);
template <typename T> TH1* make(const char* name,const char* title,int nBinX,double minBinX,double maxBinX,double minBinY,double maxBinY); // at present not used

std::auto_ptr<TFileDirectory> tfd;
std::unique_ptr<TFileDirectory> tfd;
std::string directoryString;
const bool dqmMode;
DQMStore* theDbe;
Expand Down
Expand Up @@ -61,7 +61,7 @@ CombinedTrajectoryFactory::CombinedTrajectoryFactory( const edm::ParameterSet &
for ( itFactoryName = factoryNames.begin(); itFactoryName != factoryNames.end(); ++itFactoryName )
{
// auto_ptr to avoid missing a delete due to throw...
std::auto_ptr<TObjArray> namePset(TString((*itFactoryName).c_str()).Tokenize(","));
std::unique_ptr<TObjArray> namePset(TString((*itFactoryName).c_str()).Tokenize(","));
if (namePset->GetEntriesFast() != 2) {
throw cms::Exception("BadConfig") << "@SUB=CombinedTrajectoryFactory"
<< "TrajectoryFactoryNames must contain 2 comma "
Expand Down
2 changes: 1 addition & 1 deletion Alignment/ReferenceTrajectories/src/ReferenceTrajectory.cc
Expand Up @@ -117,7 +117,7 @@ bool ReferenceTrajectory::construct(const TrajectoryStateOnSurface &refTsos,

const SurfaceSide surfaceSide = this->surfaceSide(propDir_);
// auto_ptr to avoid memory leaks in case of not reaching delete at end of method:
std::auto_ptr<MaterialEffectsUpdator> aMaterialEffectsUpdator
std::unique_ptr<MaterialEffectsUpdator> aMaterialEffectsUpdator
(this->createUpdator(materialEffects_, mass_));
if (!aMaterialEffectsUpdator.get()) return false; // empty auto_ptr

Expand Down
2 changes: 1 addition & 1 deletion Alignment/SurveyAnalysis/src/SurveyPxbDicer.cc
Expand Up @@ -83,7 +83,7 @@ SurveyPxbDicer::coord_t SurveyPxbDicer::transform(const coord_t &x, const value_
SurveyPxbDicer::value_t SurveyPxbDicer::getParByName(const std::string &name, const std::string &par, const std::vector<edm::ParameterSet>& pars)
{
std::vector<edm::ParameterSet>::const_iterator it;
it = std::find_if(pars.begin(), pars.end(), std::bind1st(findParByName(),name));
it = std::find_if(pars.begin(), pars.end(), [&name] (auto const& c){return findParByName()(name,c);});
if (it == pars.end()) { throw std::runtime_error("Parameter not found in SurveyPxbDicer::getParByName"); }
return (*it).getParameter<value_t>(par);
}
Expand Down
14 changes: 7 additions & 7 deletions CalibCalorimetry/CaloTPG/plugins/CaloTPGTranscoderULUTs.cc
Expand Up @@ -124,28 +124,28 @@ CaloTPGTranscoderULUTs::produce(const CaloTPGRecord& iRecord)
if (read_Ascii_RCT && read_Ascii_Compression) {
edm::LogInfo("Level1") << "Using " << hfilename1_.fullPath() << " & " << hfilename2_.fullPath()
<< " for CaloTPGTranscoderULUTs HCAL initialization";
//std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(), hfilename2_.fullPath()));
//std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(), hfilename2_.fullPath()));
//return pTCoder;
file1 = hfilename1_.fullPath();
file2 = hfilename2_.fullPath();
} else if (read_Ascii_RCT && !read_Ascii_Compression) {
edm::LogInfo("Level1") << "Using analytical compression and " << hfilename2_.fullPath()
<< " RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
//std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT("", hfilename2_.fullPath()));
//std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT("", hfilename2_.fullPath()));
//return pTCoder;
file2 = hfilename2_.fullPath();
} else if (read_Ascii_Compression && !read_Ascii_RCT) {
edm::LogInfo("Level1") << "Using ASCII compression tables " << hfilename1_.fullPath()
<< " and automatic RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
//std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(),""));
//std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(hfilename1_.fullPath(),""));
//return pTCoder;
file1 = hfilename1_.fullPath();
} else {
edm::LogInfo("Level1") << "Using analytical compression and RCT decompression for CaloTPGTranscoderULUTs HCAL initialization";
//std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT());
//std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT());
//return pTCoder;
}
//std::auto_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(ietal, ietah, ZS, LUTfactor, RCTLSB, nominal_gain, file1, file2));
//std::unique_ptr<CaloTPGTranscoder> pTCoder(new CaloTPGTranscoderULUT(ietal, ietah, ZS, LUTfactor, RCTLSB, nominal_gain, file1, file2));

edm::ESHandle<HcalLutMetadata> lutMetadata;
iRecord.getRecord<HcalLutMetadataRcd>().get(lutMetadata);
Expand All @@ -158,9 +158,9 @@ CaloTPGTranscoderULUTs::produce(const CaloTPGRecord& iRecord)
HcalLutMetadata fullLut{ *lutMetadata };
fullLut.setTopo(htopo.product());

std::auto_ptr<CaloTPGTranscoderULUT> pTCoder(new CaloTPGTranscoderULUT(file1, file2));
std::unique_ptr<CaloTPGTranscoderULUT> pTCoder(new CaloTPGTranscoderULUT(file1, file2));
pTCoder->setup(fullLut, *theTrigTowerGeometry, NCTScaleShift, RCTScaleShift, lsbQIE8, lsbQIE11, linearLUTs_);
return std::auto_ptr<CaloTPGTranscoder>( pTCoder );
return std::unique_ptr<CaloTPGTranscoder>( std::move(pTCoder) );
}

//define this as a plug-in
Expand Down

0 comments on commit af644fd

Please sign in to comment.